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

Add PropTypes to SimpleForm and TabbedForm #3996

Merged
merged 4 commits into from
Nov 24, 2019
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
22 changes: 22 additions & 0 deletions packages/ra-ui-materialui/src/form/SimpleForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,28 @@ const SimpleForm = ({ initialValues, defaultValue, saving, ...props }) => {
);
};

SimpleForm.propTypes = {
basePath: PropTypes.string,
children: PropTypes.node,
className: PropTypes.string,
defaultValue: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), // @deprecated
initialValues: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
record: PropTypes.object,
redirect: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
PropTypes.func,
]),
resource: PropTypes.string,
save: PropTypes.func,
saving: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
submitOnEnter: PropTypes.bool,
toolbar: PropTypes.element,
undoable: PropTypes.bool,
validate: PropTypes.func,
WiXSL marked this conversation as resolved.
Show resolved Hide resolved
version: PropTypes.number,
};

const defaultSubscription = {
submitting: true,
pristine: true,
Expand Down
29 changes: 29 additions & 0 deletions packages/ra-ui-materialui/src/form/TabbedForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,35 @@ const TabbedForm = ({ initialValues, defaultValue, saving, ...props }) => {
);
};

TabbedForm.propTypes = {
basePath: PropTypes.string,
WiXSL marked this conversation as resolved.
Show resolved Hide resolved
children: PropTypes.node,
className: PropTypes.string,
classes: PropTypes.object,
defaultValue: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), // @deprecated
initialValues: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
location: PropTypes.object,
match: PropTypes.object,
record: PropTypes.object,
redirect: PropTypes.oneOfType([
PropTypes.string,
PropTypes.bool,
PropTypes.func,
]),
resource: PropTypes.string,
save: PropTypes.func, // the handler defined in the parent, which triggers the REST submission
saving: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
submitOnEnter: PropTypes.bool,
tabs: PropTypes.element.isRequired,
tabsWithErrors: PropTypes.arrayOf(PropTypes.string),
toolbar: PropTypes.element,
translate: PropTypes.func,
undoable: PropTypes.bool,
validate: PropTypes.func,
value: PropTypes.number,
version: PropTypes.number,
};

const defaultSubscription = {
submitting: true,
pristine: true,
Expand Down
11 changes: 11 additions & 0 deletions packages/ra-ui-materialui/src/list/DatagridLoading.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { memo } from 'react';
import PropTypes from 'prop-types';
import Table from '@material-ui/core/Table';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
Expand Down Expand Up @@ -106,4 +107,14 @@ const DatagridLoading = ({
</Table>
);

DatagridLoading.propTypes = {
classes: PropTypes.object,
className: PropTypes.string,
expand: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]),
hasBulkActions: PropTypes.bool,
nbChildren: PropTypes.number,
nbFakeLines: PropTypes.number,
size: PropTypes.oneOf(['small', 'medium']),
};

export default memo(DatagridLoading);