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