schummar-table 0.7.0 → 0.7.1
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/cjs/index.js +11 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +11 -10
- package/dist/es/index.js.map +1 -1
- package/dist/types/types.d.ts +2 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -310,10 +310,11 @@ function calcItems(state) {
|
|
|
310
310
|
state2.activeColumns,
|
|
311
311
|
state2.expanded
|
|
312
312
|
], ([items = [], id, parentId, revealFiltered, sort, filters, filterValues, activeColumns], draft) => {
|
|
313
|
-
const tableItems = items.map((item) =>
|
|
313
|
+
const tableItems = items.map((item) => ({
|
|
314
314
|
id: id(item),
|
|
315
315
|
parentId: parentId == null ? void 0 : parentId(item),
|
|
316
|
-
children: []
|
|
316
|
+
children: [],
|
|
317
|
+
value: item
|
|
317
318
|
}));
|
|
318
319
|
let sorted;
|
|
319
320
|
if (sort.length === 0) {
|
|
@@ -328,7 +329,7 @@ function calcItems(state) {
|
|
|
328
329
|
direction: sort2.direction
|
|
329
330
|
}));
|
|
330
331
|
}).filter(Boolean);
|
|
331
|
-
sorted = orderBy(tableItems, selectors.map((x) => x.selector), selectors.map((x) => x.direction));
|
|
332
|
+
sorted = orderBy(tableItems, selectors.map((x) => (item) => x.selector(item.value)), selectors.map((x) => x.direction));
|
|
332
333
|
}
|
|
333
334
|
const lookup = /* @__PURE__ */ new Map();
|
|
334
335
|
for (const item of sorted) {
|
|
@@ -362,7 +363,7 @@ function calcItems(state) {
|
|
|
362
363
|
if (filterValue === void 0 || !filter.isActive(filterValue))
|
|
363
364
|
return true;
|
|
364
365
|
const filterBy = (_a = filter.filterBy) != null ? _a : (x) => x;
|
|
365
|
-
const value = filterBy(column.value(item), item);
|
|
366
|
+
const value = filterBy(column.value(item.value), item.value);
|
|
366
367
|
return castArray(value).some((value2) => filter.test(filterValue, value2));
|
|
367
368
|
}));
|
|
368
369
|
if (isActive && item.parentId !== void 0) {
|
|
@@ -870,7 +871,7 @@ function Export$1() {
|
|
|
870
871
|
activeColumns,
|
|
871
872
|
activeItems
|
|
872
873
|
} = table.getState();
|
|
873
|
-
const data = [activeColumns.map((column) => String(column.id)), ...activeItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item), item)))];
|
|
874
|
+
const data = [activeColumns.map((column) => String(column.id)), ...activeItems.map((item) => activeColumns.map((column) => column.exportCell(column.value(item.value), item.value)))];
|
|
874
875
|
return csvExport(data, options);
|
|
875
876
|
};
|
|
876
877
|
const copy = () => {
|
|
@@ -1090,11 +1091,11 @@ const Cell = react.memo(function Cell2({
|
|
|
1090
1091
|
const className2 = useTheme((t) => cx(...calcClassNames(t.classes, item, rowIndex)));
|
|
1091
1092
|
if (!column || !item)
|
|
1092
1093
|
return null;
|
|
1093
|
-
const content = column.renderCell(column.value(item), item);
|
|
1094
|
+
const content = column.renderCell(column.value(item.value), item.value);
|
|
1094
1095
|
return jsxRuntime.jsx("div", {
|
|
1095
1096
|
className: className2,
|
|
1096
1097
|
css: [tableTheme.defaultClasses.cell, columnStyleOverride],
|
|
1097
|
-
children: wrapCell(content, column.value(item), item, rowIndex)
|
|
1098
|
+
children: wrapCell(content, column.value(item.value), item.value, rowIndex)
|
|
1098
1099
|
});
|
|
1099
1100
|
});
|
|
1100
1101
|
function ExpandControl({
|
|
@@ -1248,10 +1249,10 @@ const Row = react.memo(function Row2({
|
|
|
1248
1249
|
className: cx(...calcClassNames(classes, item, rowIndex)),
|
|
1249
1250
|
indent: item ? getAncestors(state.activeItemsById, item).size : 0,
|
|
1250
1251
|
hasChildren: !!(item == null ? void 0 : item.children.length),
|
|
1251
|
-
hasDeferredChildren: item && ((_b = (_a = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a, item)),
|
|
1252
|
+
hasDeferredChildren: item && ((_b = (_a = state.props).hasDeferredChildren) == null ? void 0 : _b.call(_a, item.value)),
|
|
1252
1253
|
columnIds: state.activeColumns.map((column) => column.id),
|
|
1253
1254
|
enableSelection: state.props.enableSelection,
|
|
1254
|
-
rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item, rowIndex) : null : state.props.rowAction
|
|
1255
|
+
rowAction: state.props.rowAction instanceof Function ? item ? state.props.rowAction(item.value, rowIndex) : null : state.props.rowAction
|
|
1255
1256
|
};
|
|
1256
1257
|
});
|
|
1257
1258
|
react.useEffect(() => {
|
|
@@ -2629,7 +2630,7 @@ function SelectFilter(_m) {
|
|
|
2629
2630
|
const column = state.activeColumns.find((column2) => column2.id === columnId);
|
|
2630
2631
|
if (!column)
|
|
2631
2632
|
return [];
|
|
2632
|
-
return uniq(flatMap(state.items, (item) => castArray(filterBy(column.value(item), item))));
|
|
2633
|
+
return uniq(flatMap(state.items, (item) => castArray(filterBy(column.value(item.value), item.value))));
|
|
2633
2634
|
});
|
|
2634
2635
|
const [query, setQuery] = react.useState("");
|
|
2635
2636
|
const filtered = options.filter((option) => !query || stringValue(option).toLowerCase().includes(query.toLowerCase()));
|