schummar-table 0.5.0 → 0.5.3
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/README.md +4 -0
- package/dist/cjs/index.js +20 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/tableTheme.js +4 -4
- package/dist/cjs/tableTheme.js.map +1 -1
- package/dist/es/index.js +20 -10
- package/dist/es/index.js.map +1 -1
- package/dist/es/tableTheme.js +4 -4
- package/dist/es/tableTheme.js.map +1 -1
- package/dist/types/internalState/syncSelections.d.ts +1 -1
- package/dist/types/theme/{defaultClasses.d.ts → defaultTheme/defaultClasses.d.ts} +0 -0
- package/dist/types/theme/{defaultColors.d.ts → defaultTheme/defaultColors.d.ts} +1 -1
- package/dist/types/theme/defaultTheme/defaultComponents.d.ts +2 -0
- package/dist/types/theme/{defaultIcons.d.ts → defaultTheme/defaultIcons.d.ts} +1 -1
- package/dist/types/theme/{defaultTexts.d.ts → defaultTheme/defaultTexts.d.ts} +1 -1
- package/dist/types/theme/defaultTheme/index.d.ts +1 -1
- package/dist/types/theme/tableTheme.d.ts +1 -1
- package/dist/types/types.d.ts +3 -2
- package/package.json +10 -12
- package/dist/types/misc/deepPartial.d.ts +0 -3
- package/dist/types/theme/defaultTheme/defaultTableTheme.d.ts +0 -2
package/README.md
ADDED
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 = state.getState().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 = state.getState().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 = state.getState().props).onExpandedChange) == null ? void 0 : _b.call(_a, newExpanded);
|
|
976
|
+
});
|
|
969
977
|
}
|
|
970
978
|
}
|
|
971
979
|
}, { runNow: true }), [state]);
|
|
@@ -975,9 +983,8 @@ function filterColumns(state) {
|
|
|
975
983
|
draft.activeColumns = orderBy(columns.filter((column) => !hiddenColumns.has(column.id)), [(column) => columnOrder.indexOf(column.id)]);
|
|
976
984
|
}, { runNow: true }), [state]);
|
|
977
985
|
}
|
|
978
|
-
function syncSelections(
|
|
979
|
-
react.useEffect(() =>
|
|
980
|
-
var _a, _b;
|
|
986
|
+
function syncSelections(table) {
|
|
987
|
+
react.useEffect(() => table.addReaction((state) => [state.props.selectSyncChildren, state.selection, state.activeItems], ([selectSyncChildren, selection, activeItems], state) => {
|
|
981
988
|
if (!selectSyncChildren)
|
|
982
989
|
return;
|
|
983
990
|
const newSelection = new Set(selection);
|
|
@@ -987,10 +994,13 @@ function syncSelections(state) {
|
|
|
987
994
|
}
|
|
988
995
|
}
|
|
989
996
|
if (newSelection.size !== selection.size) {
|
|
990
|
-
|
|
991
|
-
(
|
|
997
|
+
state.selection = newSelection;
|
|
998
|
+
setTimeout(() => {
|
|
999
|
+
var _a, _b;
|
|
1000
|
+
(_b = (_a = table.getState().props).onSelectionChange) == null ? void 0 : _b.call(_a, newSelection);
|
|
1001
|
+
});
|
|
992
1002
|
}
|
|
993
|
-
}, { runNow: true }), [
|
|
1003
|
+
}, { runNow: true }), [table]);
|
|
994
1004
|
}
|
|
995
1005
|
function useTableState(_props) {
|
|
996
1006
|
const props = calcProps(_props);
|