material-react-table 1.0.4 → 1.0.5
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> = {}>({
|