schummar-table 0.5.1 → 0.5.2
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 +16 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +16 -6
- package/dist/es/index.js.map +1 -1
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -926,13 +926,15 @@ function calcProps(props) {
|
|
|
926
926
|
}
|
|
927
927
|
function cleanupState(state) {
|
|
928
928
|
useEffect(() => state.addReaction((state2) => [state2.props.columns, state2.itemsById, state2.activeItemsById, state2.activeColumns], ([columns, itemsById, activeItemsById, activeColumns], draft) => {
|
|
929
|
-
var _a, _b, _c, _d, _e, _f;
|
|
930
929
|
const columnIds = new Set(columns.map((column) => column.id));
|
|
931
930
|
const activeColumnIds = new Set(activeColumns.map((column) => column.id));
|
|
932
931
|
const newSort = draft.sort.filter((s) => activeColumnIds.has(s.columnId));
|
|
933
932
|
if (newSort.length < draft.sort.length) {
|
|
934
933
|
draft.sort = newSort;
|
|
935
|
-
(
|
|
934
|
+
setTimeout(() => {
|
|
935
|
+
var _a, _b;
|
|
936
|
+
(_b = (_a = draft.props).onSortChange) == null ? void 0 : _b.call(_a, newSort);
|
|
937
|
+
});
|
|
936
938
|
}
|
|
937
939
|
for (const id of draft.filters.keys()) {
|
|
938
940
|
if (!activeColumnIds.has(id))
|
|
@@ -958,12 +960,18 @@ function cleanupState(state) {
|
|
|
958
960
|
const newSelection = intersect(draft.selection, activeItemsById);
|
|
959
961
|
if (newSelection.size !== draft.selection.size) {
|
|
960
962
|
draft.selection = newSelection;
|
|
961
|
-
(
|
|
963
|
+
setTimeout(() => {
|
|
964
|
+
var _a, _b;
|
|
965
|
+
(_b = (_a = draft.props).onSelectionChange) == null ? void 0 : _b.call(_a, newSelection);
|
|
966
|
+
});
|
|
962
967
|
}
|
|
963
968
|
const newExpanded = intersect(draft.expanded, itemsById);
|
|
964
969
|
if (newExpanded.size < draft.expanded.size) {
|
|
965
970
|
draft.expanded = newExpanded;
|
|
966
|
-
(
|
|
971
|
+
setTimeout(() => {
|
|
972
|
+
var _a, _b;
|
|
973
|
+
(_b = (_a = draft.props).onExpandedChange) == null ? void 0 : _b.call(_a, newExpanded);
|
|
974
|
+
});
|
|
967
975
|
}
|
|
968
976
|
}
|
|
969
977
|
}, { runNow: true }), [state]);
|
|
@@ -975,7 +983,6 @@ function filterColumns(state) {
|
|
|
975
983
|
}
|
|
976
984
|
function syncSelections(state) {
|
|
977
985
|
useEffect(() => state.addReaction((state2) => [state2.props.selectSyncChildren, state2.selection, state2.activeItems], ([selectSyncChildren, selection, activeItems], state2) => {
|
|
978
|
-
var _a, _b;
|
|
979
986
|
if (!selectSyncChildren)
|
|
980
987
|
return;
|
|
981
988
|
const newSelection = new Set(selection);
|
|
@@ -986,7 +993,10 @@ function syncSelections(state) {
|
|
|
986
993
|
}
|
|
987
994
|
if (newSelection.size !== selection.size) {
|
|
988
995
|
state2.selection = newSelection;
|
|
989
|
-
(
|
|
996
|
+
setTimeout(() => {
|
|
997
|
+
var _a, _b;
|
|
998
|
+
(_b = (_a = state2.props).onSelectionChange) == null ? void 0 : _b.call(_a, newSelection);
|
|
999
|
+
});
|
|
990
1000
|
}
|
|
991
1001
|
}, { runNow: true }), [state]);
|
|
992
1002
|
}
|