Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript] Fix view action component types aren't exported #6200

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/ra-ui-materialui/src/detail/CreateActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { useCreateContext, useResourceDefinition } from 'ra-core';
* </Create>
* );
*/
const CreateActions = ({ className, ...rest }: CreateActionsProps) => {
export const CreateActions = ({ className, ...rest }: CreateActionsProps) => {
const { basePath } = useCreateContext(rest);
const { hasList } = useResourceDefinition(rest);
return (
Expand All @@ -48,18 +48,22 @@ const sanitizeRestProps = ({
...rest
}) => rest;

interface CreateActionsProps {
export interface CreateActionsProps {
basePath?: string;
className?: string;
hasShow?: boolean;
hasCreate?: boolean;
hasEdit?: boolean;
hasList?: boolean;
hasShow?: boolean;
resource?: string;
}

CreateActions.propTypes = {
basePath: PropTypes.string,
className: PropTypes.string,
hasCreate: PropTypes.bool,
hasEdit: PropTypes.bool,
hasShow: PropTypes.bool,
hasList: PropTypes.bool,
resource: PropTypes.string,
};

export default CreateActions;
11 changes: 7 additions & 4 deletions packages/ra-ui-materialui/src/detail/EditActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TopToolbar from '../layout/TopToolbar';
* </Edit>
* );
*/
const EditActions = ({ className, ...rest }: EditActionsProps) => {
export const EditActions = ({ className, ...rest }: EditActionsProps) => {
const { basePath, record } = useEditContext(rest);
const { hasShow } = useResourceDefinition(rest);

Expand All @@ -54,17 +54,20 @@ export interface EditActionsProps {
basePath?: string;
className?: string;
data?: Record;
hasShow?: boolean;
hasCreate?: boolean;
hasEdit?: boolean;
hasList?: boolean;
hasShow?: boolean;
resource?: string;
}

EditActions.propTypes = {
basePath: PropTypes.string,
className: PropTypes.string,
data: PropTypes.object,
hasCreate: PropTypes.bool,
hasEdit: PropTypes.bool,
hasShow: PropTypes.bool,
hasList: PropTypes.bool,
resource: PropTypes.string,
};

export default EditActions;
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/detail/EditView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useEditContext,
} from 'ra-core';

import DefaultActions from './EditActions';
import { EditActions as DefaultActions } from './EditActions';
import TitleForRecord from '../layout/TitleForRecord';
import { EditProps } from '../types';

Expand Down
8 changes: 5 additions & 3 deletions packages/ra-ui-materialui/src/detail/ShowActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const sanitizeRestProps = ({
* </Show>
* );
*/
const ShowActions = ({ className, ...rest }: ShowActionsProps) => {
export const ShowActions = ({ className, ...rest }: ShowActionsProps) => {
const { basePath, record } = useShowContext(rest);
const { hasEdit } = useResourceDefinition(rest);
return (
Expand All @@ -53,7 +53,9 @@ export interface ShowActionsProps {
basePath?: string;
className?: string;
data?: Record;
hasCreate?: boolean;
hasEdit?: boolean;
hasShow?: boolean;
hasList?: boolean;
resource?: string;
}
Expand All @@ -62,9 +64,9 @@ ShowActions.propTypes = {
basePath: PropTypes.string,
className: PropTypes.string,
data: PropTypes.object,
hasCreate: PropTypes.bool,
hasEdit: PropTypes.bool,
hasShow: PropTypes.bool,
hasList: PropTypes.bool,
resource: PropTypes.string,
};

export default ShowActions;
2 changes: 1 addition & 1 deletion packages/ra-ui-materialui/src/detail/ShowView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
useShowContext,
} from 'ra-core';

import DefaultActions from './ShowActions';
import { ShowActions as DefaultActions } from './ShowActions';
import TitleForRecord from '../layout/TitleForRecord';
import { ShowProps } from '../types';

Expand Down
11 changes: 4 additions & 7 deletions packages/ra-ui-materialui/src/detail/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
import { Create } from './Create';
import { CreateView } from './CreateView';
import CreateActions from './CreateActions';
import { Edit } from './Edit';
import { EditView } from './EditView';
import EditActions, { EditActionsProps } from './EditActions';
import EditGuesser from './EditGuesser';
import { Show } from './Show';
import { ShowView } from './ShowView';
import ShowActions, { ShowActionsProps } from './ShowActions';
import ShowGuesser from './ShowGuesser';
import SimpleShowLayout, { SimpleShowLayoutProps } from './SimpleShowLayout';

export * from './CreateActions';
export * from './EditActions';
export * from './ShowActions';
export * from './TabbedShowLayout';
export * from './TabbedShowLayoutTabs';
export * from './Tab';

export {
Create,
CreateView,
CreateActions,
Edit,
EditView,
EditActions,
EditGuesser,
Show,
ShowView,
ShowActions,
ShowGuesser,
SimpleShowLayout,
};

export type { EditActionsProps, SimpleShowLayoutProps, ShowActionsProps };
export type { SimpleShowLayoutProps };