@dooherceg/material-react-table 3.2.2-alpha.5 → 3.2.2-alpha.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/dist/index.esm.js +14 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -489,7 +489,7 @@ const cellKeyboardShortcuts = ({ cell, cellElements, cellValue, containerElement
|
|
|
489
489
|
}
|
|
490
490
|
};
|
|
491
491
|
|
|
492
|
-
const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
|
492
|
+
const getColumnId$1 = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
|
493
493
|
const getAllLeafColumnDefs = (columns) => {
|
|
494
494
|
const allLeafColumnDefs = [];
|
|
495
495
|
const getLeafColumns = (cols) => {
|
|
@@ -511,7 +511,7 @@ const prepareColumns = ({ columnDefs, tableOptions, }) => {
|
|
|
511
511
|
var _a, _b;
|
|
512
512
|
//assign columnId
|
|
513
513
|
if (!columnDef.id)
|
|
514
|
-
columnDef.id = getColumnId(columnDef);
|
|
514
|
+
columnDef.id = getColumnId$1(columnDef);
|
|
515
515
|
//assign columnDefType
|
|
516
516
|
if (!columnDef.columnDefType)
|
|
517
517
|
columnDef.columnDefType = 'data';
|
|
@@ -696,7 +696,7 @@ const getDefaultColumnOrderIds = (tableOptions, reset = false) => {
|
|
|
696
696
|
const { state: { columnOrder: currentColumnOrderIds = [] }, } = tableOptions;
|
|
697
697
|
const leadingDisplayColIds = getLeadingDisplayColumnIds(tableOptions);
|
|
698
698
|
const trailingDisplayColIds = getTrailingDisplayColumnIds(tableOptions);
|
|
699
|
-
const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId(columnDef));
|
|
699
|
+
const defaultColumnDefIds = getAllLeafColumnDefs(tableOptions.columns).map((columnDef) => getColumnId$1(columnDef));
|
|
700
700
|
let allLeafColumnDefIds = reset
|
|
701
701
|
? defaultColumnDefIds
|
|
702
702
|
: Array.from(new Set([...currentColumnOrderIds, ...defaultColumnDefIds]));
|
|
@@ -721,7 +721,7 @@ function createMRTColumnHelper() {
|
|
|
721
721
|
};
|
|
722
722
|
}
|
|
723
723
|
const createRow = (table, originalRow, rowIndex = -1, depth = 0, subRows, parentId) => reactTable.createRow(table, 'mrt-row-create', originalRow !== null && originalRow !== void 0 ? originalRow : Object.assign({}, ...getAllLeafColumnDefs(table.options.columns).map((col) => ({
|
|
724
|
-
[getColumnId(col)]: '',
|
|
724
|
+
[getColumnId$1(col)]: '',
|
|
725
725
|
}))), rowIndex, depth, subRows, parentId);
|
|
726
726
|
|
|
727
727
|
const MRT_AggregationFns = Object.assign({}, reactTable.aggregationFns);
|
|
@@ -2274,9 +2274,9 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
|
2274
2274
|
const [columnFilterFns, setColumnFilterFns] = react.useState(() => Object.assign({}, ...getAllLeafColumnDefs(definedTableOptions.columns).map((col) => {
|
|
2275
2275
|
var _a, _b, _c, _d;
|
|
2276
2276
|
return ({
|
|
2277
|
-
[getColumnId(col)]: col.filterFn instanceof Function
|
|
2277
|
+
[getColumnId$1(col)]: col.filterFn instanceof Function
|
|
2278
2278
|
? ((_a = col.filterFn.name) !== null && _a !== void 0 ? _a : 'custom')
|
|
2279
|
-
: ((_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col)),
|
|
2279
|
+
: ((_d = (_b = col.filterFn) !== null && _b !== void 0 ? _b : (_c = initialState === null || initialState === void 0 ? void 0 : initialState.columnFilterFns) === null || _c === void 0 ? void 0 : _c[getColumnId$1(col)]) !== null && _d !== void 0 ? _d : getDefaultColumnFilterFn(col)),
|
|
2280
2280
|
});
|
|
2281
2281
|
})));
|
|
2282
2282
|
const [columnOrder, onColumnOrderChange] = react.useState((_c = initialState.columnOrder) !== null && _c !== void 0 ? _c : []);
|
|
@@ -2384,7 +2384,7 @@ const useMRT_TableInstance = (definedTableOptions) => {
|
|
|
2384
2384
|
? [
|
|
2385
2385
|
...Array(Math.min(statefulTableOptions.state.pagination.pageSize, 20)).fill(null),
|
|
2386
2386
|
].map(() => Object.assign({}, ...getAllLeafColumnDefs(statefulTableOptions.columns).map((col) => ({
|
|
2387
|
-
[getColumnId(col)]: null,
|
|
2387
|
+
[getColumnId$1(col)]: null,
|
|
2388
2388
|
}))))
|
|
2389
2389
|
: rows, [
|
|
2390
2390
|
rows,
|
|
@@ -4265,14 +4265,11 @@ const getFilterableColumns = (table) => {
|
|
|
4265
4265
|
// Users define them as regular MRT_ColumnDef (same API), but they are not rendered as a column in the table.
|
|
4266
4266
|
const virtualColumns = allLeafColumns.flatMap((column) => {
|
|
4267
4267
|
var _a, _b;
|
|
4268
|
-
return ((_b = (_a = column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.extraFieldFilters) !== null && _b !== void 0 ? _b : []).map((extraColumnDef) => {
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
columnDef: Object.assign(Object.assign({}, extraColumnDef), { columnDefType: 'data', enableColumnFilter: true }),
|
|
4274
|
-
});
|
|
4275
|
-
});
|
|
4268
|
+
return ((_b = (_a = column.columnDef.meta) === null || _a === void 0 ? void 0 : _a.extraFieldFilters) !== null && _b !== void 0 ? _b : []).map((extraColumnDef) => ({
|
|
4269
|
+
// accessorKey is the primary identifier; id as fallback
|
|
4270
|
+
id: getColumnId(extraColumnDef),
|
|
4271
|
+
columnDef: Object.assign(Object.assign({}, extraColumnDef), { columnDefType: 'data', enableColumnFilter: true }),
|
|
4272
|
+
}));
|
|
4276
4273
|
});
|
|
4277
4274
|
return [...realFilterableColumns, ...virtualColumns];
|
|
4278
4275
|
};
|
|
@@ -4312,6 +4309,7 @@ const isFilterRuleIncomplete = (table, rule) => {
|
|
|
4312
4309
|
// Delegate to the operator's own value-empty check
|
|
4313
4310
|
return operator.isValueEmpty(rule.value);
|
|
4314
4311
|
};
|
|
4312
|
+
const getColumnId = (columnDef) => { var _a, _b, _c, _d; return (_d = (_a = columnDef.id) !== null && _a !== void 0 ? _a : (_c = (_b = columnDef.accessorKey) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : columnDef.header; };
|
|
4315
4313
|
|
|
4316
4314
|
const FILTER_RULE_VALUE_TEST_ID = 'mrt-filter-rule-value';
|
|
4317
4315
|
// Renders a single row in the advanced filter builder.
|
|
@@ -8093,7 +8091,7 @@ exports.flexRender = flexRender;
|
|
|
8093
8091
|
exports.getAllLeafColumnDefs = getAllLeafColumnDefs;
|
|
8094
8092
|
exports.getCanRankRows = getCanRankRows;
|
|
8095
8093
|
exports.getColumnFilterInfo = getColumnFilterInfo;
|
|
8096
|
-
exports.getColumnId = getColumnId;
|
|
8094
|
+
exports.getColumnId = getColumnId$1;
|
|
8097
8095
|
exports.getDefaultColumnFilterFn = getDefaultColumnFilterFn;
|
|
8098
8096
|
exports.getDefaultColumnOrderIds = getDefaultColumnOrderIds;
|
|
8099
8097
|
exports.getDefaultColumnPinningState = getDefaultColumnPinningState;
|