material-react-table 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/column.utils.ts
CHANGED
|
@@ -21,19 +21,18 @@ export const getColumnId = <TData extends Record<string, any> = {}>(
|
|
|
21
21
|
export const getAllLeafColumnDefs = <TData extends Record<string, any> = {}>(
|
|
22
22
|
columns: MRT_ColumnDef<TData>[],
|
|
23
23
|
): MRT_ColumnDef<TData>[] => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return lowestLevelColumns.filter((col) => !col.columns);
|
|
24
|
+
const allLeafColumnDefs: MRT_ColumnDef<TData>[] = [];
|
|
25
|
+
const getLeafColumns = (cols: MRT_ColumnDef<TData>[]) => {
|
|
26
|
+
cols.forEach((col) => {
|
|
27
|
+
if (col.columns) {
|
|
28
|
+
getLeafColumns(col.columns);
|
|
29
|
+
} else {
|
|
30
|
+
allLeafColumnDefs.push(col);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
getLeafColumns(columns);
|
|
35
|
+
return allLeafColumnDefs;
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
export const prepareColumns = <TData extends Record<string, any> = {}>({
|
|
@@ -120,9 +119,10 @@ export const getLeadingDisplayColumnIds = <
|
|
|
120
119
|
) =>
|
|
121
120
|
[
|
|
122
121
|
(props.enableRowDragging || props.enableRowOrdering) && 'mrt-row-drag',
|
|
123
|
-
|
|
124
|
-
(props.
|
|
125
|
-
|
|
122
|
+
props.positionActionsColumn === 'first' &&
|
|
123
|
+
(props.enableRowActions ||
|
|
124
|
+
(props.enableEditing &&
|
|
125
|
+
['row', 'modal'].includes(props.editingMode ?? ''))) &&
|
|
126
126
|
'mrt-row-actions',
|
|
127
127
|
props.positionExpandColumn === 'first' &&
|
|
128
128
|
showExpandColumn(props) &&
|
|
@@ -136,9 +136,10 @@ export const getTrailingDisplayColumnIds = <
|
|
|
136
136
|
>(
|
|
137
137
|
props: MaterialReactTableProps<TData>,
|
|
138
138
|
) => [
|
|
139
|
-
|
|
140
|
-
(props.
|
|
141
|
-
|
|
139
|
+
props.positionActionsColumn === 'last' &&
|
|
140
|
+
(props.enableRowActions ||
|
|
141
|
+
(props.enableEditing &&
|
|
142
|
+
['row', 'modal'].includes(props.editingMode ?? ''))) &&
|
|
142
143
|
'mrt-row-actions',
|
|
143
144
|
props.positionExpandColumn === 'last' &&
|
|
144
145
|
showExpandColumn(props) &&
|