1+ import { ReactElement } from 'react' ;
12import { TableCellProps } from '@mui/material/TableCell' ;
2- import { BaseFieldProps } from 'ra-core' ;
3+ import { BaseFieldProps , ExtractRecordPaths , HintedString } from 'ra-core' ;
34
45type TextAlign = TableCellProps [ 'align' ] ;
6+ type SortOrder = 'ASC' | 'DESC' ;
57
68export interface FieldProps <
79 RecordType extends Record < string , any > = Record < string , any > ,
@@ -21,6 +23,91 @@ export interface FieldProps<
2123 */
2224 headerClassName ?: string ;
2325
26+ /**
27+ * Label to use as column header when using <Datagrid> or <SimpleShowLayout>.
28+ * Defaults to the capitalized field name. Set to false to disable the label.
29+ *
30+ * @see https://marmelab.com/react-admin/Fields.html#label
31+ * @example
32+ * const PostList = () => (
33+ * <List>
34+ * <Datagrid>
35+ * <TextField source="title" />
36+ * <TextField source="body" label="Content" />
37+ * </Datagrid>
38+ * </List>
39+ * );
40+ */
41+ label ?: string | ReactElement | boolean ;
42+
43+ /**
44+ * Set it to false to disable the click handler on the column header when used inside <Datagrid>.
45+ *
46+ * @see https://marmelab.com/react-admin/Fields.html#sortable
47+ * @example
48+ * const PostList = () => (
49+ * <List>
50+ * <Datagrid>
51+ * <TextField source="title" />
52+ * <ReferenceField source="author_id" sortable={false}>
53+ * <TextField source="name" />
54+ * </ReferenceField>
55+ * </Datagrid>
56+ * </List>
57+ * );
58+ */
59+ sortable ?: boolean ;
60+
61+ /**
62+ * The text to display when the field value is empty. Defaults to empty string.
63+ *
64+ * @see https://marmelab.com/react-admin/Fields.html#emptytext
65+ * @example
66+ * const PostList = () => (
67+ * <List>
68+ * <Datagrid>
69+ * <TextField source="title" />
70+ * <TextField source="author" emptyText="missing data" />
71+ * </Datagrid>
72+ * </List>
73+ * );
74+ */
75+ emptyText ?: string ;
76+
77+ /**
78+ * The field to use for sorting when users click this column head, if sortable.
79+ *
80+ * @see https://marmelab.com/react-admin/Fields.html#sortby
81+ * @example
82+ * const PostList = () => (
83+ * <List>
84+ * <Datagrid>
85+ * <TextField source="title" />
86+ * <ReferenceField source="author_id" sortBy="author.name">
87+ * <TextField source="name" />
88+ * </ReferenceField>
89+ * </Datagrid>
90+ * </List>
91+ * );
92+ */
93+ sortBy ?: HintedString < ExtractRecordPaths < RecordType > > ;
94+
95+ /**
96+ * The order used for sorting when users click this column head, if sortable.
97+ *
98+ * @see https://marmelab.com/react-admin/Fields.html#sortbyorder
99+ * @example
100+ * const PostList = () => (
101+ * <List>
102+ * <Datagrid>
103+ * <TextField source="title" />
104+ * <DateField source="updated_at" sortByOrder="DESC" />
105+ * </Datagrid>
106+ * </List>
107+ * );
108+ */
109+ sortByOrder ?: SortOrder ;
110+
24111 /**
25112 * The text alignment for the cell content, when used inside <Datagrid>.
26113 *
0 commit comments