@ishibashi0112/spreadsheet-grid-core 0.39.0
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/LICENSE +21 -0
- package/dist/controllers/autoHeightMeasurer.cjs +1 -0
- package/dist/controllers/autoHeightMeasurer.d.ts +30 -0
- package/dist/controllers/autoHeightMeasurer.js +74 -0
- package/dist/controllers/clipboardController.cjs +2 -0
- package/dist/controllers/clipboardController.d.ts +31 -0
- package/dist/controllers/clipboardController.js +88 -0
- package/dist/controllers/columnAutosizeRunner.cjs +1 -0
- package/dist/controllers/columnAutosizeRunner.d.ts +31 -0
- package/dist/controllers/columnAutosizeRunner.js +61 -0
- package/dist/controllers/columnHeaderDragController.cjs +1 -0
- package/dist/controllers/columnHeaderDragController.d.ts +44 -0
- package/dist/controllers/columnHeaderDragController.js +256 -0
- package/dist/controllers/columnMenuController.cjs +1 -0
- package/dist/controllers/columnMenuController.d.ts +49 -0
- package/dist/controllers/columnMenuController.js +110 -0
- package/dist/controllers/contextMenuController.cjs +1 -0
- package/dist/controllers/contextMenuController.d.ts +30 -0
- package/dist/controllers/contextMenuController.js +65 -0
- package/dist/controllers/debouncedValueStore.cjs +1 -0
- package/dist/controllers/debouncedValueStore.d.ts +11 -0
- package/dist/controllers/debouncedValueStore.js +22 -0
- package/dist/controllers/editController.cjs +1 -0
- package/dist/controllers/editController.d.ts +27 -0
- package/dist/controllers/editController.js +76 -0
- package/dist/controllers/filterPopoverController.cjs +1 -0
- package/dist/controllers/filterPopoverController.d.ts +53 -0
- package/dist/controllers/filterPopoverController.js +146 -0
- package/dist/controllers/globalFilteredOrder.cjs +1 -0
- package/dist/controllers/globalFilteredOrder.d.ts +38 -0
- package/dist/controllers/globalFilteredOrder.js +78 -0
- package/dist/controllers/historyController.cjs +1 -0
- package/dist/controllers/historyController.d.ts +28 -0
- package/dist/controllers/historyController.js +52 -0
- package/dist/controllers/keyboardController.cjs +1 -0
- package/dist/controllers/keyboardController.d.ts +36 -0
- package/dist/controllers/keyboardController.js +111 -0
- package/dist/controllers/panelHeaderDragController.cjs +1 -0
- package/dist/controllers/panelHeaderDragController.d.ts +21 -0
- package/dist/controllers/panelHeaderDragController.js +32 -0
- package/dist/controllers/pointerInteractionsController.cjs +1 -0
- package/dist/controllers/pointerInteractionsController.d.ts +74 -0
- package/dist/controllers/pointerInteractionsController.js +262 -0
- package/dist/controllers/popoverSupport.cjs +1 -0
- package/dist/controllers/popoverSupport.d.ts +18 -0
- package/dist/controllers/popoverSupport.js +25 -0
- package/dist/controllers/rowDragController.cjs +1 -0
- package/dist/controllers/rowDragController.d.ts +40 -0
- package/dist/controllers/rowDragController.js +192 -0
- package/dist/controllers/scrollSyncController.cjs +1 -0
- package/dist/controllers/scrollSyncController.d.ts +17 -0
- package/dist/controllers/scrollSyncController.js +51 -0
- package/dist/controllers/selectOptionsCollector.cjs +1 -0
- package/dist/controllers/selectOptionsCollector.d.ts +31 -0
- package/dist/controllers/selectOptionsCollector.js +88 -0
- package/dist/controllers/serverSideRowModel.cjs +1 -0
- package/dist/controllers/serverSideRowModel.d.ts +36 -0
- package/dist/controllers/serverSideRowModel.js +153 -0
- package/dist/controllers/systemColorSchemeStore.cjs +1 -0
- package/dist/controllers/systemColorSchemeStore.d.ts +5 -0
- package/dist/controllers/systemColorSchemeStore.js +18 -0
- package/dist/controllers/toolPanelController.cjs +1 -0
- package/dist/controllers/toolPanelController.d.ts +36 -0
- package/dist/controllers/toolPanelController.js +112 -0
- package/dist/controllers/tooltipController.cjs +1 -0
- package/dist/controllers/tooltipController.d.ts +6 -0
- package/dist/controllers/tooltipController.js +75 -0
- package/dist/controllers/viewportSyncController.cjs +1 -0
- package/dist/controllers/viewportSyncController.d.ts +30 -0
- package/dist/controllers/viewportSyncController.js +40 -0
- package/dist/engine/columnCommands.cjs +1 -0
- package/dist/engine/columnCommands.d.ts +56 -0
- package/dist/engine/columnCommands.js +199 -0
- package/dist/engine/columnLayout.cjs +1 -0
- package/dist/engine/columnLayout.d.ts +43 -0
- package/dist/engine/columnLayout.js +91 -0
- package/dist/engine/createGridEngine.cjs +1 -0
- package/dist/engine/createGridEngine.d.ts +46 -0
- package/dist/engine/createGridEngine.js +52 -0
- package/dist/engine/filterPopoverCommands.cjs +1 -0
- package/dist/engine/filterPopoverCommands.d.ts +56 -0
- package/dist/engine/filterPopoverCommands.js +303 -0
- package/dist/engine/gridApi.cjs +1 -0
- package/dist/engine/gridApi.d.ts +61 -0
- package/dist/engine/gridApi.js +389 -0
- package/dist/engine/memo.cjs +1 -0
- package/dist/engine/memo.d.ts +2 -0
- package/dist/engine/memo.js +18 -0
- package/dist/engine/notifiers.cjs +1 -0
- package/dist/engine/notifiers.d.ts +35 -0
- package/dist/engine/notifiers.js +34 -0
- package/dist/engine/rowPipeline.cjs +1 -0
- package/dist/engine/rowPipeline.d.ts +50 -0
- package/dist/engine/rowPipeline.js +84 -0
- package/dist/engine/rowSelectionCommands.cjs +1 -0
- package/dist/engine/rowSelectionCommands.d.ts +21 -0
- package/dist/engine/rowSelectionCommands.js +57 -0
- package/dist/engine/verticalLayout.cjs +1 -0
- package/dist/engine/verticalLayout.d.ts +52 -0
- package/dist/engine/verticalLayout.js +60 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +5 -0
- package/dist/logic/aggregation.cjs +1 -0
- package/dist/logic/aggregation.d.ts +13 -0
- package/dist/logic/aggregation.js +28 -0
- package/dist/logic/autoScrollGeometry.cjs +1 -0
- package/dist/logic/autoScrollGeometry.d.ts +27 -0
- package/dist/logic/autoScrollGeometry.js +19 -0
- package/dist/logic/autoSizeOnData.cjs +1 -0
- package/dist/logic/autoSizeOnData.d.ts +10 -0
- package/dist/logic/autoSizeOnData.js +19 -0
- package/dist/logic/cellOverflowTooltip.cjs +1 -0
- package/dist/logic/cellOverflowTooltip.d.ts +5 -0
- package/dist/logic/cellOverflowTooltip.js +4 -0
- package/dist/logic/checkboxEditor.cjs +1 -0
- package/dist/logic/checkboxEditor.d.ts +12 -0
- package/dist/logic/checkboxEditor.js +17 -0
- package/dist/logic/chunkedLoop.cjs +1 -0
- package/dist/logic/chunkedLoop.d.ts +8 -0
- package/dist/logic/chunkedLoop.js +18 -0
- package/dist/logic/clearCells.cjs +1 -0
- package/dist/logic/clearCells.d.ts +31 -0
- package/dist/logic/clearCells.js +91 -0
- package/dist/logic/columnAutosize.cjs +1 -0
- package/dist/logic/columnAutosize.d.ts +18 -0
- package/dist/logic/columnAutosize.js +150 -0
- package/dist/logic/columnFlex.cjs +1 -0
- package/dist/logic/columnFlex.d.ts +4 -0
- package/dist/logic/columnFlex.js +60 -0
- package/dist/logic/columnReset.cjs +1 -0
- package/dist/logic/columnReset.d.ts +7 -0
- package/dist/logic/columnReset.js +25 -0
- package/dist/logic/contextMenuTarget.cjs +1 -0
- package/dist/logic/contextMenuTarget.d.ts +4 -0
- package/dist/logic/contextMenuTarget.js +18 -0
- package/dist/logic/cx.cjs +1 -0
- package/dist/logic/cx.d.ts +1 -0
- package/dist/logic/cx.js +6 -0
- package/dist/logic/dateFilterCondition.cjs +1 -0
- package/dist/logic/dateFilterCondition.d.ts +26 -0
- package/dist/logic/dateFilterCondition.js +110 -0
- package/dist/logic/dateFilterPresets.cjs +1 -0
- package/dist/logic/dateFilterPresets.d.ts +13 -0
- package/dist/logic/dateFilterPresets.js +30 -0
- package/dist/logic/dateFilterTree.cjs +1 -0
- package/dist/logic/dateFilterTree.d.ts +17 -0
- package/dist/logic/dateFilterTree.js +75 -0
- package/dist/logic/datePickerCalendar.cjs +1 -0
- package/dist/logic/datePickerCalendar.d.ts +12 -0
- package/dist/logic/datePickerCalendar.js +41 -0
- package/dist/logic/detailRow.cjs +1 -0
- package/dist/logic/detailRow.d.ts +38 -0
- package/dist/logic/detailRow.js +78 -0
- package/dist/logic/domGuards.cjs +1 -0
- package/dist/logic/domGuards.d.ts +7 -0
- package/dist/logic/domGuards.js +4 -0
- package/dist/logic/editorValues.cjs +1 -0
- package/dist/logic/editorValues.d.ts +5 -0
- package/dist/logic/editorValues.js +32 -0
- package/dist/logic/exportCsv.cjs +3 -0
- package/dist/logic/exportCsv.d.ts +12 -0
- package/dist/logic/exportCsv.js +19 -0
- package/dist/logic/exportData.cjs +1 -0
- package/dist/logic/exportData.d.ts +9 -0
- package/dist/logic/exportData.js +24 -0
- package/dist/logic/exportScope.cjs +1 -0
- package/dist/logic/exportScope.d.ts +3 -0
- package/dist/logic/exportScope.js +4 -0
- package/dist/logic/filterPopoverLayout.cjs +1 -0
- package/dist/logic/filterPopoverLayout.d.ts +17 -0
- package/dist/logic/filterPopoverLayout.js +13 -0
- package/dist/logic/filterPopoverOutsideClick.cjs +1 -0
- package/dist/logic/filterPopoverOutsideClick.d.ts +2 -0
- package/dist/logic/filterPopoverOutsideClick.js +4 -0
- package/dist/logic/filterSummary.cjs +1 -0
- package/dist/logic/filterSummary.d.ts +3 -0
- package/dist/logic/filterSummary.js +22 -0
- package/dist/logic/filtering.cjs +1 -0
- package/dist/logic/filtering.d.ts +33 -0
- package/dist/logic/filtering.js +313 -0
- package/dist/logic/geometry.cjs +1 -0
- package/dist/logic/geometry.d.ts +72 -0
- package/dist/logic/geometry.js +161 -0
- package/dist/logic/gridState.cjs +1 -0
- package/dist/logic/gridState.d.ts +13 -0
- package/dist/logic/gridState.js +165 -0
- package/dist/logic/grouping.cjs +1 -0
- package/dist/logic/grouping.d.ts +34 -0
- package/dist/logic/grouping.js +93 -0
- package/dist/logic/history.cjs +1 -0
- package/dist/logic/history.d.ts +16 -0
- package/dist/logic/history.js +34 -0
- package/dist/logic/inferFilterType.cjs +1 -0
- package/dist/logic/inferFilterType.d.ts +19 -0
- package/dist/logic/inferFilterType.js +54 -0
- package/dist/logic/numberFilterCondition.cjs +1 -0
- package/dist/logic/numberFilterCondition.d.ts +21 -0
- package/dist/logic/numberFilterCondition.js +130 -0
- package/dist/logic/panelDragGeometry.cjs +1 -0
- package/dist/logic/panelDragGeometry.d.ts +13 -0
- package/dist/logic/panelDragGeometry.js +10 -0
- package/dist/logic/rowHeightStore.cjs +1 -0
- package/dist/logic/rowHeightStore.d.ts +13 -0
- package/dist/logic/rowHeightStore.js +41 -0
- package/dist/logic/rowReorder.cjs +1 -0
- package/dist/logic/rowReorder.d.ts +18 -0
- package/dist/logic/rowReorder.js +22 -0
- package/dist/logic/rowSelection.cjs +1 -0
- package/dist/logic/rowSelection.d.ts +16 -0
- package/dist/logic/rowSelection.js +49 -0
- package/dist/logic/scrollHint.cjs +1 -0
- package/dist/logic/scrollHint.d.ts +41 -0
- package/dist/logic/scrollHint.js +66 -0
- package/dist/logic/scrollTargets.cjs +1 -0
- package/dist/logic/scrollTargets.d.ts +22 -0
- package/dist/logic/scrollTargets.js +24 -0
- package/dist/logic/selectEditorState.cjs +1 -0
- package/dist/logic/selectEditorState.d.ts +28 -0
- package/dist/logic/selectEditorState.js +31 -0
- package/dist/logic/selectOptions.cjs +1 -0
- package/dist/logic/selectOptions.d.ts +9 -0
- package/dist/logic/selectOptions.js +23 -0
- package/dist/logic/serverSideBlocks.cjs +1 -0
- package/dist/logic/serverSideBlocks.d.ts +2 -0
- package/dist/logic/serverSideBlocks.js +14 -0
- package/dist/logic/serverSideCache.cjs +1 -0
- package/dist/logic/serverSideCache.d.ts +14 -0
- package/dist/logic/serverSideCache.js +42 -0
- package/dist/logic/serverSideEdits.cjs +1 -0
- package/dist/logic/serverSideEdits.d.ts +16 -0
- package/dist/logic/serverSideEdits.js +47 -0
- package/dist/logic/serverSideQuery.cjs +1 -0
- package/dist/logic/serverSideQuery.d.ts +7 -0
- package/dist/logic/serverSideQuery.js +21 -0
- package/dist/logic/setFilterSearch.cjs +1 -0
- package/dist/logic/setFilterSearch.d.ts +14 -0
- package/dist/logic/setFilterSearch.js +14 -0
- package/dist/logic/setFilterSelection.cjs +1 -0
- package/dist/logic/setFilterSelection.d.ts +5 -0
- package/dist/logic/setFilterSelection.js +4 -0
- package/dist/logic/slotDom.cjs +1 -0
- package/dist/logic/slotDom.d.ts +8 -0
- package/dist/logic/slotDom.js +22 -0
- package/dist/logic/slotProps.cjs +1 -0
- package/dist/logic/slotProps.d.ts +18 -0
- package/dist/logic/slotProps.js +63 -0
- package/dist/logic/sorting.cjs +1 -0
- package/dist/logic/sorting.d.ts +11 -0
- package/dist/logic/sorting.js +96 -0
- package/dist/logic/textFilterCondition.cjs +1 -0
- package/dist/logic/textFilterCondition.d.ts +18 -0
- package/dist/logic/textFilterCondition.js +55 -0
- package/dist/logic/theme.cjs +1 -0
- package/dist/logic/theme.d.ts +3 -0
- package/dist/logic/theme.js +4 -0
- package/dist/logic/tooltipGeometry.cjs +1 -0
- package/dist/logic/tooltipGeometry.d.ts +19 -0
- package/dist/logic/tooltipGeometry.js +16 -0
- package/dist/logic/validation.cjs +1 -0
- package/dist/logic/validation.d.ts +14 -0
- package/dist/logic/validation.js +47 -0
- package/dist/logic/valueFormatters.cjs +1 -0
- package/dist/logic/valueFormatters.d.ts +9 -0
- package/dist/logic/valueFormatters.js +17 -0
- package/dist/logic/valueStore.cjs +1 -0
- package/dist/logic/valueStore.d.ts +6 -0
- package/dist/logic/valueStore.js +18 -0
- package/dist/logic/verticalGeometry.cjs +1 -0
- package/dist/logic/verticalGeometry.d.ts +58 -0
- package/dist/logic/verticalGeometry.js +90 -0
- package/dist/model/gridActions.cjs +1 -0
- package/dist/model/gridActions.d.ts +125 -0
- package/dist/model/gridActions.js +114 -0
- package/dist/model/gridReducer.cjs +1 -0
- package/dist/model/gridReducer.d.ts +4 -0
- package/dist/model/gridReducer.js +247 -0
- package/dist/model/gridSelectors.cjs +1 -0
- package/dist/model/gridSelectors.d.ts +40 -0
- package/dist/model/gridSelectors.js +68 -0
- package/dist/model/gridStore.cjs +1 -0
- package/dist/model/gridStore.d.ts +24 -0
- package/dist/model/gridStore.js +38 -0
- package/dist/model/gridTypes.core.cjs +1 -0
- package/dist/model/gridTypes.core.d.ts +797 -0
- package/dist/model/gridTypes.core.js +0 -0
- package/dist/model/gridTypes.unbound.cjs +1 -0
- package/dist/model/gridTypes.unbound.d.ts +31 -0
- package/dist/model/gridTypes.unbound.js +0 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.js +51 -0
- package/dist/utils/clipboard.cjs +7 -0
- package/dist/utils/clipboard.d.ts +29 -0
- package/dist/utils/clipboard.js +110 -0
- package/dist/utils/excelColumnName.cjs +1 -0
- package/dist/utils/excelColumnName.d.ts +1 -0
- package/dist/utils/excelColumnName.js +9 -0
- package/dist/utils/permissions.cjs +1 -0
- package/dist/utils/permissions.d.ts +4 -0
- package/dist/utils/permissions.js +7 -0
- package/dist/utils/scheduler.cjs +1 -0
- package/dist/utils/scheduler.d.ts +1 -0
- package/dist/utils/scheduler.js +13 -0
- package/package.json +58 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { reorderColumnsByPane as e } from "./geometry.js";
|
|
2
|
+
//#region src/logic/gridState.ts
|
|
3
|
+
var t = 2, n = (e) => {
|
|
4
|
+
switch (e.kind) {
|
|
5
|
+
case "set": return {
|
|
6
|
+
...e,
|
|
7
|
+
values: [...e.values]
|
|
8
|
+
};
|
|
9
|
+
case "number": return {
|
|
10
|
+
...e,
|
|
11
|
+
parsed: e.parsed ? { ...e.parsed } : null
|
|
12
|
+
};
|
|
13
|
+
case "numberSet": return {
|
|
14
|
+
...e,
|
|
15
|
+
condition: e.condition ? { ...e.condition } : null,
|
|
16
|
+
set: e.set ? {
|
|
17
|
+
...e.set,
|
|
18
|
+
values: [...e.set.values]
|
|
19
|
+
} : null
|
|
20
|
+
};
|
|
21
|
+
case "textSet": return {
|
|
22
|
+
...e,
|
|
23
|
+
condition: e.condition ? { ...e.condition } : null,
|
|
24
|
+
set: e.set ? {
|
|
25
|
+
...e.set,
|
|
26
|
+
values: [...e.set.values]
|
|
27
|
+
} : null
|
|
28
|
+
};
|
|
29
|
+
case "dateSet": return {
|
|
30
|
+
...e,
|
|
31
|
+
condition: e.condition ? { ...e.condition } : null,
|
|
32
|
+
set: e.set ? {
|
|
33
|
+
...e.set,
|
|
34
|
+
values: [...e.set.values]
|
|
35
|
+
} : null
|
|
36
|
+
};
|
|
37
|
+
case "text":
|
|
38
|
+
case "date":
|
|
39
|
+
case "select": return { ...e };
|
|
40
|
+
case "custom": return { ...e };
|
|
41
|
+
}
|
|
42
|
+
}, r = (e) => {
|
|
43
|
+
let t = {};
|
|
44
|
+
for (let r of Object.keys(e)) t[r] = n(e[r]);
|
|
45
|
+
return t;
|
|
46
|
+
}, i = (e) => {
|
|
47
|
+
let t = { key: e.key };
|
|
48
|
+
return e.visible !== void 0 && (t.visible = e.visible), e.pinned !== void 0 && (t.pinned = e.pinned), t;
|
|
49
|
+
}, a = (e) => e.map((e) => {
|
|
50
|
+
let t = { key: e.key };
|
|
51
|
+
return e.visible !== void 0 && (t.visible = e.visible), e.pinned !== void 0 && (t.pinned = e.pinned), t;
|
|
52
|
+
}), o = (e, t, n, a = [], o = 2) => ({
|
|
53
|
+
version: o,
|
|
54
|
+
columnWidths: { ...e },
|
|
55
|
+
filters: {
|
|
56
|
+
globalText: t.globalText,
|
|
57
|
+
columnFilters: r(t.columnFilters)
|
|
58
|
+
},
|
|
59
|
+
sort: n.map((e) => ({ ...e })),
|
|
60
|
+
columns: a.map(i)
|
|
61
|
+
}), s = (e) => {
|
|
62
|
+
let t = e && typeof e == "object" ? e : {}, r = {}, i = t.columnWidths;
|
|
63
|
+
if (i && typeof i == "object") {
|
|
64
|
+
let e = i;
|
|
65
|
+
for (let t of Object.keys(e)) {
|
|
66
|
+
let n = e[t];
|
|
67
|
+
typeof n == "number" && Number.isFinite(n) && (r[t] = n);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
let a = t.filters && typeof t.filters == "object" ? t.filters : {}, o = typeof a.globalText == "string" ? a.globalText : "", s = {}, c = a.columnFilters;
|
|
71
|
+
if (c && typeof c == "object") {
|
|
72
|
+
let e = c;
|
|
73
|
+
for (let t of Object.keys(e)) {
|
|
74
|
+
let r = e[t];
|
|
75
|
+
r && typeof r == "object" && "kind" in r && (s[t] = n(r));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let l = [], u = t.sort;
|
|
79
|
+
if (Array.isArray(u)) {
|
|
80
|
+
for (let e of u) if (e && typeof e == "object") {
|
|
81
|
+
let t = e;
|
|
82
|
+
typeof t.columnKey == "string" && (t.direction === "asc" || t.direction === "desc") && l.push({
|
|
83
|
+
columnKey: t.columnKey,
|
|
84
|
+
direction: t.direction
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let d, f = t.columns;
|
|
89
|
+
if (Array.isArray(f)) {
|
|
90
|
+
let e = [];
|
|
91
|
+
for (let t of f) {
|
|
92
|
+
if (!t || typeof t != "object") continue;
|
|
93
|
+
let n = t;
|
|
94
|
+
if (typeof n.key != "string") continue;
|
|
95
|
+
let r = { key: n.key };
|
|
96
|
+
typeof n.visible == "boolean" && (r.visible = n.visible), (n.pinned === "left" || n.pinned === "right") && (r.pinned = n.pinned), e.push(r);
|
|
97
|
+
}
|
|
98
|
+
d = e;
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
version: 2,
|
|
102
|
+
columnWidths: r,
|
|
103
|
+
filters: {
|
|
104
|
+
globalText: o,
|
|
105
|
+
columnFilters: s
|
|
106
|
+
},
|
|
107
|
+
sort: l,
|
|
108
|
+
columns: d
|
|
109
|
+
};
|
|
110
|
+
}, c = (t, n, r) => {
|
|
111
|
+
let i = new Map(t.map((e) => [e.key, e])), a = /* @__PURE__ */ new Set(), o = (e, t) => {
|
|
112
|
+
let n = r[e.key], i = typeof n == "number";
|
|
113
|
+
if (!t && !i) return e;
|
|
114
|
+
let a = { ...e };
|
|
115
|
+
return t && (a.visible = t.visible, a.pinned = t.pinned), i && (a.width = n), a;
|
|
116
|
+
}, s = [];
|
|
117
|
+
for (let e of n) {
|
|
118
|
+
let t = i.get(e.key);
|
|
119
|
+
t && (a.add(e.key), s.push(o(t, e)));
|
|
120
|
+
}
|
|
121
|
+
for (let e of t) a.has(e.key) || s.push(o(e, void 0));
|
|
122
|
+
return e(s);
|
|
123
|
+
}, l = (e, t) => e === null || t === null ? e === t : e.mode === "blank" || e.mode === "notBlank" || t.mode === "blank" || t.mode === "notBlank" ? e.mode === t.mode : e.mode === t.mode && e.value === t.value, u = (e, t) => e === null || t === null ? e === t : e.mode === t.mode ? e.mode === "range" && t.mode === "range" ? e.from === t.from && e.to === t.to : e.mode === "preset" && t.mode === "preset" ? e.preset === t.preset : e.mode === "blank" || e.mode === "notBlank" ? !0 : "value" in e && "value" in t && e.value === t.value : !1, d = (e, t) => e === null || t === null ? e === t : (e.mode ?? "include") === (t.mode ?? "include") && e.values.length === t.values.length && e.values.every((e, n) => e === t.values[n]), f = (e, t) => e === null || t === null ? e === t : e.mode === "comparison" && t.mode === "comparison" ? e.operator === t.operator && e.value === t.value : e.mode === "range" && t.mode === "range" ? e.min === t.min && e.max === t.max : e.mode === "blank" || e.mode === "notBlank" ? e.mode === t.mode : !1, p = (e, t) => {
|
|
124
|
+
switch (e.kind) {
|
|
125
|
+
case "set": return t.kind === "set" && (e.mode ?? "include") === (t.mode ?? "include") && e.values.length === t.values.length && e.values.every((e, n) => e === t.values[n]);
|
|
126
|
+
case "number": return t.kind === "number" && e.raw === t.raw && f(e.parsed, t.parsed);
|
|
127
|
+
case "numberSet": return t.kind === "numberSet" && f(e.condition, t.condition) && d(e.set, t.set);
|
|
128
|
+
case "textSet": return t.kind === "textSet" && l(e.condition, t.condition) && d(e.set, t.set);
|
|
129
|
+
case "dateSet": return t.kind === "dateSet" && u(e.condition, t.condition) && d(e.set, t.set);
|
|
130
|
+
case "text": return t.kind === "text" && e.value === t.value;
|
|
131
|
+
case "date": return t.kind === "date" && e.value === t.value;
|
|
132
|
+
case "select": return t.kind === "select" && e.value === t.value;
|
|
133
|
+
case "custom": return t.kind === "custom" && Object.is(e.value, t.value);
|
|
134
|
+
}
|
|
135
|
+
}, m = (e, t) => {
|
|
136
|
+
let n = Object.keys(e);
|
|
137
|
+
if (n.length !== Object.keys(t).length) return !1;
|
|
138
|
+
for (let r of n) if (!(r in t) || e[r] !== t[r]) return !1;
|
|
139
|
+
return !0;
|
|
140
|
+
}, h = (e, t) => {
|
|
141
|
+
let n = Object.keys(e);
|
|
142
|
+
if (n.length !== Object.keys(t).length) return !1;
|
|
143
|
+
for (let r of n) if (!(r in t) || !p(e[r], t[r])) return !1;
|
|
144
|
+
return !0;
|
|
145
|
+
}, g = (e, t) => {
|
|
146
|
+
if (e === void 0 || t === void 0) return e === t;
|
|
147
|
+
if (e.length !== t.length) return !1;
|
|
148
|
+
for (let n = 0; n < e.length; n += 1) if (e[n].key !== t[n].key || e[n].visible !== t[n].visible || e[n].pinned !== t[n].pinned) return !1;
|
|
149
|
+
return !0;
|
|
150
|
+
}, _ = (e, t) => {
|
|
151
|
+
if (e.version !== t.version || !m(e.columnWidths, t.columnWidths) || e.filters.globalText !== t.filters.globalText || !h(e.filters.columnFilters, t.filters.columnFilters) || e.sort.length !== t.sort.length) return !1;
|
|
152
|
+
for (let n = 0; n < e.sort.length; n += 1) if (e.sort[n].columnKey !== t.sort[n].columnKey || e.sort[n].direction !== t.sort[n].direction) return !1;
|
|
153
|
+
return !!g(e.columns, t.columns);
|
|
154
|
+
}, v = (e, t, n) => n ? {
|
|
155
|
+
emit: !1,
|
|
156
|
+
nextLast: e
|
|
157
|
+
} : e === null || _(e, t) ? {
|
|
158
|
+
emit: !1,
|
|
159
|
+
nextLast: t
|
|
160
|
+
} : {
|
|
161
|
+
emit: !0,
|
|
162
|
+
nextLast: t
|
|
163
|
+
};
|
|
164
|
+
//#endregion
|
|
165
|
+
export { t as GRID_STATE_VERSION, c as applyColumnState, o as buildGridState, n as cloneColumnFilterValue, v as decideStateChangeEmit, a as extractColumnState, _ as isSameGridState, s as migrateGridState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/permissions.cjs"),t=require("./aggregation.cjs");var n=`(空白)`,r=`__ssg-group__:`,i=`__ssg_group__`,a=e=>r+e.groupKey,o=e=>e<0,s=e=>-e-1,c=e=>{if(e==null||e===``)return`e`;let t=typeof e;return`${t===`number`?`n`:t===`boolean`?`b`:t===`string`?`s`:`o`}:${String(e)}`},l=e=>({groupColumns:e.filter(e=>e.rowGroup===!0),aggColumns:e.filter(e=>e.aggFunc!=null)}),u=(r,i,a,o)=>{let s=a.length,l=o.length,u=o.map(e=>typeof e.aggFunc==`function`),d=u.includes(!0),f=[],p=new Map,m=0,h=(e,r,i,a,s)=>{let c=`${r.key}\u0001${i}`,l=i===`e`;return m+=1,{groupRow:{kind:`group`,groupKey:e===null?c:`${e}\u0000${c}`,columnKey:r.key,value:l?null:a,label:l?n:String(a),level:s,leafCount:0,aggregates:{}},children:[],childIndex:new Map,leafSourceIndexes:[],accumulators:o.map(()=>t.createBuiltinAggAccumulator()),customValues:u.map(e=>e?[]:null),customRows:[]}},g=i.length;for(let n=0;n<g;n+=1){let u=i[n],m=r[u],g=null;if(l>0){g=Array(l);for(let t=0;t<l;t+=1)g[t]=e.getCellValue(m,o[t])}let _=f,v=p,y=null;for(let n=0;n<s;n+=1){let r=a[n],i=e.getCellValue(m,r),o=c(i),f=v.get(o);if(f||(f=h(y,r,o,i,n),_.push(f),v.set(o,f)),f.groupRow.leafCount+=1,g!==null){for(let e=0;e<l;e+=1){t.accumulateBuiltinAgg(f.accumulators[e],g[e]);let n=f.customValues[e];n!==null&&n.push(g[e])}d&&f.customRows.push(m)}n===s-1&&f.leafSourceIndexes.push(u),_=f.children,v=f.childIndex,y=f.groupRow.groupKey}}let _=e=>{for(let n=0;n<l;n+=1){let r=o[n];u[n]?e.groupRow.aggregates[r.key]=r.aggFunc({values:e.customValues[n]??[],rows:e.customRows,column:r}):t.isBuiltinAggFuncName(r.aggFunc)&&(e.groupRow.aggregates[r.key]=t.finalizeBuiltinAgg(r.aggFunc,e.accumulators[n]))}for(let t of e.children)_(t)};for(let e of f)_(e);return{roots:f,groupCount:m}},d=(e,t)=>{let n=[],r=[],i=e=>{if(r.push(e.groupRow),n.push(-r.length),!t.has(e.groupRow.groupKey)){if(e.children.length>0){for(let t of e.children)i(t);return}for(let t of e.leafSourceIndexes)n.push(t)}};for(let t of e.roots)i(t);return{displayOrder:Int32Array.from(n),groups:r}},f=e=>{let t=[],n=e=>{t.push(e.groupRow);for(let t of e.children)n(t)};for(let t of e.roots)n(t);return t},p=e=>f(e).map(e=>e.groupKey);exports.GROUP_AUTO_COLUMN_KEY=i,exports.GROUP_EMPTY_LABEL=n,exports.GROUP_ROW_KEY_PREFIX=r,exports.buildGroupTree=u,exports.collectAllGroupKeys=p,exports.collectAllGroupRows=f,exports.collectGroupingColumns=l,exports.flattenGroupTree=d,exports.groupIndexOfOrderValue=s,exports.groupRowKey=a,exports.isGroupOrderValue=o;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GridColumn, GridGroupRow, GridRowKey } from '../model/gridTypes.unbound';
|
|
2
|
+
import type { RowOrder } from './filtering';
|
|
3
|
+
import { type BuiltinAggAccumulator } from './aggregation';
|
|
4
|
+
export declare const GROUP_EMPTY_LABEL = "(\u7A7A\u767D)";
|
|
5
|
+
export declare const GROUP_ROW_KEY_PREFIX = "__ssg-group__:";
|
|
6
|
+
export declare const GROUP_AUTO_COLUMN_KEY = "__ssg_group__";
|
|
7
|
+
export declare const groupRowKey: (groupRow: GridGroupRow) => GridRowKey;
|
|
8
|
+
export declare const isGroupOrderValue: (value: number) => boolean;
|
|
9
|
+
export declare const groupIndexOfOrderValue: (value: number) => number;
|
|
10
|
+
export declare const collectGroupingColumns: <T>(columns: GridColumn<T>[]) => {
|
|
11
|
+
groupColumns: GridColumn<T>[];
|
|
12
|
+
aggColumns: GridColumn<T>[];
|
|
13
|
+
};
|
|
14
|
+
export type GroupTreeNode<T> = {
|
|
15
|
+
groupRow: GridGroupRow;
|
|
16
|
+
children: GroupTreeNode<T>[];
|
|
17
|
+
childIndex: Map<string, GroupTreeNode<T>>;
|
|
18
|
+
leafSourceIndexes: number[];
|
|
19
|
+
accumulators: BuiltinAggAccumulator[];
|
|
20
|
+
customValues: (unknown[] | null)[];
|
|
21
|
+
customRows: T[];
|
|
22
|
+
};
|
|
23
|
+
export type GroupTree<T> = {
|
|
24
|
+
roots: GroupTreeNode<T>[];
|
|
25
|
+
groupCount: number;
|
|
26
|
+
};
|
|
27
|
+
export type GroupedDisplay = {
|
|
28
|
+
displayOrder: RowOrder;
|
|
29
|
+
groups: GridGroupRow[];
|
|
30
|
+
};
|
|
31
|
+
export declare const buildGroupTree: <T>(rows: T[], order: RowOrder, groupColumns: GridColumn<T>[], aggColumns: GridColumn<T>[]) => GroupTree<T>;
|
|
32
|
+
export declare const flattenGroupTree: <T>(tree: GroupTree<T>, collapsedGroupKeys: ReadonlySet<string>) => GroupedDisplay;
|
|
33
|
+
export declare const collectAllGroupRows: <T>(tree: GroupTree<T>) => GridGroupRow[];
|
|
34
|
+
export declare const collectAllGroupKeys: <T>(tree: GroupTree<T>) => string[];
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getCellValue as e } from "../utils/permissions.js";
|
|
2
|
+
import { accumulateBuiltinAgg as t, createBuiltinAggAccumulator as n, finalizeBuiltinAgg as r, isBuiltinAggFuncName as i } from "./aggregation.js";
|
|
3
|
+
//#region src/logic/grouping.ts
|
|
4
|
+
var a = "(空白)", o = "__ssg-group__:", s = "__ssg_group__", c = (e) => o + e.groupKey, l = (e) => e < 0, u = (e) => -e - 1, d = (e) => {
|
|
5
|
+
if (e == null || e === "") return "e";
|
|
6
|
+
let t = typeof e;
|
|
7
|
+
return `${t === "number" ? "n" : t === "boolean" ? "b" : t === "string" ? "s" : "o"}:${String(e)}`;
|
|
8
|
+
}, f = (e) => ({
|
|
9
|
+
groupColumns: e.filter((e) => e.rowGroup === !0),
|
|
10
|
+
aggColumns: e.filter((e) => e.aggFunc != null)
|
|
11
|
+
}), p = (o, s, c, l) => {
|
|
12
|
+
let u = c.length, f = l.length, p = l.map((e) => typeof e.aggFunc == "function"), m = p.includes(!0), h = [], g = /* @__PURE__ */ new Map(), _ = 0, v = (e, t, r, i, o) => {
|
|
13
|
+
let s = `${t.key}\u0001${r}`, c = r === "e";
|
|
14
|
+
return _ += 1, {
|
|
15
|
+
groupRow: {
|
|
16
|
+
kind: "group",
|
|
17
|
+
groupKey: e === null ? s : `${e}\u0000${s}`,
|
|
18
|
+
columnKey: t.key,
|
|
19
|
+
value: c ? null : i,
|
|
20
|
+
label: c ? a : String(i),
|
|
21
|
+
level: o,
|
|
22
|
+
leafCount: 0,
|
|
23
|
+
aggregates: {}
|
|
24
|
+
},
|
|
25
|
+
children: [],
|
|
26
|
+
childIndex: /* @__PURE__ */ new Map(),
|
|
27
|
+
leafSourceIndexes: [],
|
|
28
|
+
accumulators: l.map(() => n()),
|
|
29
|
+
customValues: p.map((e) => e ? [] : null),
|
|
30
|
+
customRows: []
|
|
31
|
+
};
|
|
32
|
+
}, y = s.length;
|
|
33
|
+
for (let n = 0; n < y; n += 1) {
|
|
34
|
+
let r = s[n], i = o[r], a = null;
|
|
35
|
+
if (f > 0) {
|
|
36
|
+
a = Array(f);
|
|
37
|
+
for (let t = 0; t < f; t += 1) a[t] = e(i, l[t]);
|
|
38
|
+
}
|
|
39
|
+
let p = h, _ = g, y = null;
|
|
40
|
+
for (let n = 0; n < u; n += 1) {
|
|
41
|
+
let o = c[n], s = e(i, o), l = d(s), h = _.get(l);
|
|
42
|
+
if (h || (h = v(y, o, l, s, n), p.push(h), _.set(l, h)), h.groupRow.leafCount += 1, a !== null) {
|
|
43
|
+
for (let e = 0; e < f; e += 1) {
|
|
44
|
+
t(h.accumulators[e], a[e]);
|
|
45
|
+
let n = h.customValues[e];
|
|
46
|
+
n !== null && n.push(a[e]);
|
|
47
|
+
}
|
|
48
|
+
m && h.customRows.push(i);
|
|
49
|
+
}
|
|
50
|
+
n === u - 1 && h.leafSourceIndexes.push(r), p = h.children, _ = h.childIndex, y = h.groupRow.groupKey;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
let b = (e) => {
|
|
54
|
+
for (let t = 0; t < f; t += 1) {
|
|
55
|
+
let n = l[t];
|
|
56
|
+
p[t] ? e.groupRow.aggregates[n.key] = n.aggFunc({
|
|
57
|
+
values: e.customValues[t] ?? [],
|
|
58
|
+
rows: e.customRows,
|
|
59
|
+
column: n
|
|
60
|
+
}) : i(n.aggFunc) && (e.groupRow.aggregates[n.key] = r(n.aggFunc, e.accumulators[t]));
|
|
61
|
+
}
|
|
62
|
+
for (let t of e.children) b(t);
|
|
63
|
+
};
|
|
64
|
+
for (let e of h) b(e);
|
|
65
|
+
return {
|
|
66
|
+
roots: h,
|
|
67
|
+
groupCount: _
|
|
68
|
+
};
|
|
69
|
+
}, m = (e, t) => {
|
|
70
|
+
let n = [], r = [], i = (e) => {
|
|
71
|
+
if (r.push(e.groupRow), n.push(-r.length), !t.has(e.groupRow.groupKey)) {
|
|
72
|
+
if (e.children.length > 0) {
|
|
73
|
+
for (let t of e.children) i(t);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
for (let t of e.leafSourceIndexes) n.push(t);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
for (let t of e.roots) i(t);
|
|
80
|
+
return {
|
|
81
|
+
displayOrder: Int32Array.from(n),
|
|
82
|
+
groups: r
|
|
83
|
+
};
|
|
84
|
+
}, h = (e) => {
|
|
85
|
+
let t = [], n = (e) => {
|
|
86
|
+
t.push(e.groupRow);
|
|
87
|
+
for (let t of e.children) n(t);
|
|
88
|
+
};
|
|
89
|
+
for (let t of e.roots) n(t);
|
|
90
|
+
return t;
|
|
91
|
+
}, g = (e) => h(e).map((e) => e.groupKey);
|
|
92
|
+
//#endregion
|
|
93
|
+
export { s as GROUP_AUTO_COLUMN_KEY, a as GROUP_EMPTY_LABEL, o as GROUP_ROW_KEY_PREFIX, p as buildGroupTree, g as collectAllGroupKeys, h as collectAllGroupRows, f as collectGroupingColumns, m as flattenGroupTree, u as groupIndexOfOrderValue, c as groupRowKey, l as isGroupOrderValue };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=()=>({past:[],future:[]}),t=e=>e.past.length>0,n=e=>e.future.length>0,r=(e,t,n)=>{if(n<=0)return e;let r=[...e.past,t];return{past:r.length>n?r.slice(r.length-n):r,future:[]}},i=(e,t)=>{if(e.past.length===0)return null;let n=e.past[e.past.length-1];return{stack:{past:e.past.slice(0,-1),future:[...e.future,t]},snapshot:n}},a=(e,t)=>{if(e.future.length===0)return null;let n=e.future[e.future.length-1];return{stack:{past:[...e.past,t],future:e.future.slice(0,-1)},snapshot:n}};exports.canRedoHistory=n,exports.canUndoHistory=t,exports.createHistoryStack=e,exports.pushHistory=r,exports.redoHistory=a,exports.undoHistory=i;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type HistoryStack<S> = {
|
|
2
|
+
past: S[];
|
|
3
|
+
future: S[];
|
|
4
|
+
};
|
|
5
|
+
export declare const createHistoryStack: <S>() => HistoryStack<S>;
|
|
6
|
+
export declare const canUndoHistory: <S>(stack: HistoryStack<S>) => boolean;
|
|
7
|
+
export declare const canRedoHistory: <S>(stack: HistoryStack<S>) => boolean;
|
|
8
|
+
export declare const pushHistory: <S>(stack: HistoryStack<S>, snapshot: S, limit: number) => HistoryStack<S>;
|
|
9
|
+
export declare const undoHistory: <S>(stack: HistoryStack<S>, current: S) => {
|
|
10
|
+
stack: HistoryStack<S>;
|
|
11
|
+
snapshot: S;
|
|
12
|
+
} | null;
|
|
13
|
+
export declare const redoHistory: <S>(stack: HistoryStack<S>, current: S) => {
|
|
14
|
+
stack: HistoryStack<S>;
|
|
15
|
+
snapshot: S;
|
|
16
|
+
} | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/logic/history.ts
|
|
2
|
+
var e = () => ({
|
|
3
|
+
past: [],
|
|
4
|
+
future: []
|
|
5
|
+
}), t = (e) => e.past.length > 0, n = (e) => e.future.length > 0, r = (e, t, n) => {
|
|
6
|
+
if (n <= 0) return e;
|
|
7
|
+
let r = [...e.past, t];
|
|
8
|
+
return {
|
|
9
|
+
past: r.length > n ? r.slice(r.length - n) : r,
|
|
10
|
+
future: []
|
|
11
|
+
};
|
|
12
|
+
}, i = (e, t) => {
|
|
13
|
+
if (e.past.length === 0) return null;
|
|
14
|
+
let n = e.past[e.past.length - 1];
|
|
15
|
+
return {
|
|
16
|
+
stack: {
|
|
17
|
+
past: e.past.slice(0, -1),
|
|
18
|
+
future: [...e.future, t]
|
|
19
|
+
},
|
|
20
|
+
snapshot: n
|
|
21
|
+
};
|
|
22
|
+
}, a = (e, t) => {
|
|
23
|
+
if (e.future.length === 0) return null;
|
|
24
|
+
let n = e.future[e.future.length - 1];
|
|
25
|
+
return {
|
|
26
|
+
stack: {
|
|
27
|
+
past: [...e.past, t],
|
|
28
|
+
future: e.future.slice(0, -1)
|
|
29
|
+
},
|
|
30
|
+
snapshot: n
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { n as canRedoHistory, t as canUndoHistory, e as createHistoryStack, r as pushHistory, a as redoHistory, i as undoHistory };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./filtering.cjs");var t=1e3,n=2e4,r=e=>{if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`string`)return!1;let t=e.trim();return!t||/^-?0\d/.test(t)?!1:Number.isFinite(Number(t))},i=t=>e.toDateKey(t)!==null,a=({editorType:a,isServerSide:o=!1,rowCount:s,getRawValueAt:c,sampleLimit:l=t,scanLimit:u=n})=>{if(a===`number`)return{filterType:`numberSet`,source:`editor`,conclusive:!0};if(a===`date`)return{filterType:`dateSet`,source:`editor`,conclusive:!0};if(o)return{filterType:`text`,source:`fallback`,conclusive:!0};let d=Math.min(s,u),f=0,p=0,m=0;for(let t=0;t<d&&f<l;t+=1){let n=c(t);if(!e.isBlankCellValue(n)){if(f+=1,i(n)){p+=1;continue}r(n)&&(m+=1)}}return f===0?{filterType:`textSet`,source:`fallback`,conclusive:!1}:p===f?{filterType:`dateSet`,source:`values`,conclusive:!0}:m===f?{filterType:`numberSet`,source:`values`,conclusive:!0}:{filterType:`textSet`,source:`values`,conclusive:!0}};exports.INFER_SAMPLE_LIMIT=t,exports.INFER_SCAN_LIMIT=n,exports.inferColumnFilterType=a;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ColumnFilterUiType } from '../model/gridTypes.unbound';
|
|
2
|
+
export type InferredColumnFilterType = Extract<ColumnFilterUiType, 'numberSet' | 'textSet' | 'dateSet' | 'text'>;
|
|
3
|
+
export type InferFilterTypeResult = {
|
|
4
|
+
filterType: InferredColumnFilterType;
|
|
5
|
+
source: 'editor' | 'values' | 'fallback';
|
|
6
|
+
conclusive: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const INFER_SAMPLE_LIMIT = 1000;
|
|
9
|
+
export declare const INFER_SCAN_LIMIT = 20000;
|
|
10
|
+
type InferFilterTypeInput = {
|
|
11
|
+
editorType?: string;
|
|
12
|
+
isServerSide?: boolean;
|
|
13
|
+
rowCount: number;
|
|
14
|
+
getRawValueAt: (index: number) => unknown;
|
|
15
|
+
sampleLimit?: number;
|
|
16
|
+
scanLimit?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const inferColumnFilterType: ({ editorType, isServerSide, rowCount, getRawValueAt, sampleLimit, scanLimit, }: InferFilterTypeInput) => InferFilterTypeResult;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isBlankCellValue as e, toDateKey as t } from "./filtering.js";
|
|
2
|
+
//#region src/logic/inferFilterType.ts
|
|
3
|
+
var n = 1e3, r = 2e4, i = (e) => {
|
|
4
|
+
if (typeof e == "number") return Number.isFinite(e);
|
|
5
|
+
if (typeof e != "string") return !1;
|
|
6
|
+
let t = e.trim();
|
|
7
|
+
return !t || /^-?0\d/.test(t) ? !1 : Number.isFinite(Number(t));
|
|
8
|
+
}, a = (e) => t(e) !== null, o = ({ editorType: t, isServerSide: o = !1, rowCount: s, getRawValueAt: c, sampleLimit: l = n, scanLimit: u = r }) => {
|
|
9
|
+
if (t === "number") return {
|
|
10
|
+
filterType: "numberSet",
|
|
11
|
+
source: "editor",
|
|
12
|
+
conclusive: !0
|
|
13
|
+
};
|
|
14
|
+
if (t === "date") return {
|
|
15
|
+
filterType: "dateSet",
|
|
16
|
+
source: "editor",
|
|
17
|
+
conclusive: !0
|
|
18
|
+
};
|
|
19
|
+
if (o) return {
|
|
20
|
+
filterType: "text",
|
|
21
|
+
source: "fallback",
|
|
22
|
+
conclusive: !0
|
|
23
|
+
};
|
|
24
|
+
let d = Math.min(s, u), f = 0, p = 0, m = 0;
|
|
25
|
+
for (let t = 0; t < d && f < l; t += 1) {
|
|
26
|
+
let n = c(t);
|
|
27
|
+
if (!e(n)) {
|
|
28
|
+
if (f += 1, a(n)) {
|
|
29
|
+
p += 1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
i(n) && (m += 1);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return f === 0 ? {
|
|
36
|
+
filterType: "textSet",
|
|
37
|
+
source: "fallback",
|
|
38
|
+
conclusive: !1
|
|
39
|
+
} : p === f ? {
|
|
40
|
+
filterType: "dateSet",
|
|
41
|
+
source: "values",
|
|
42
|
+
conclusive: !0
|
|
43
|
+
} : m === f ? {
|
|
44
|
+
filterType: "numberSet",
|
|
45
|
+
source: "values",
|
|
46
|
+
conclusive: !0
|
|
47
|
+
} : {
|
|
48
|
+
filterType: "textSet",
|
|
49
|
+
source: "values",
|
|
50
|
+
conclusive: !0
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { n as INFER_SAMPLE_LIMIT, r as INFER_SCAN_LIMIT, o as inferColumnFilterType };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./filtering.cjs");var t={operator:`gte`,value1:``,value2:``},n=[{value:`gte`,label:`以上`},{value:`gt`,label:`より大きい`},{value:`lte`,label:`以下`},{value:`lt`,label:`未満`},{value:`eq`,label:`に等しい`},{value:`ne`,label:`に等しくない`},{value:`between`,label:`範囲`},{value:`blank`,label:`空白`},{value:`notBlank`,label:`空白でない`}],r=e=>e===`blank`||e===`notBlank`?0:e===`between`?2:1,i=e=>{let t=e.trim();if(!t)return null;let n=Number(t);return Number.isFinite(n)?n:null},a={gte:`>=`,gt:`>`,lte:`<=`,lt:`<`,eq:`=`,ne:`!=`},o=e=>{if(e.operator===`blank`||e.operator===`notBlank`)return{mode:e.operator};if(e.operator===`between`){let t=i(e.value1),n=i(e.value2);return t!==null&&n!==null?{mode:`range`,min:Math.min(t,n),max:Math.max(t,n)}:t===null?n===null?null:{mode:`comparison`,operator:`<=`,value:n}:{mode:`comparison`,operator:`>=`,value:t}}let t=i(e.value1);return t===null?null:{mode:`comparison`,operator:a[e.operator],value:t}},s=e=>{switch(e.mode){case`comparison`:switch(e.operator){case`>=`:return`${e.value} 以上`;case`>`:return`${e.value} より大きい`;case`<=`:return`${e.value} 以下`;case`<`:return`${e.value} 未満`;case`!=`:return`${e.value} に等しくない`;default:return`${e.value} に等しい`}case`range`:return`${e.min} 〜 ${e.max}`;case`blank`:return`(空白)`;case`notBlank`:return`(空白でない)`}},c=e=>{let t=o(e);return t===null?null:{kind:`number`,raw:s(t),parsed:t}},l=(t,n)=>n?t.filter(t=>e.matchesParsedNumberFilter(n,t.value)):t,u={">=":`gte`,">":`gt`,"<=":`lte`,"<":`lt`,"=":`eq`,"!=":`ne`},d=e=>{if(!e)return t;switch(e.mode){case`comparison`:return{operator:u[e.operator],value1:String(e.value),value2:``};case`range`:return{operator:`between`,value1:String(e.min),value2:String(e.max)};case`blank`:case`notBlank`:return{operator:e.mode,value1:``,value2:``}}},f=e=>d(e?.parsed);exports.DEFAULT_NUMBER_FILTER_DRAFT=t,exports.NUMBER_FILTER_OPERATOR_OPTIONS=n,exports.buildNumberColumnFilterValueFromDraft=c,exports.buildParsedNumberFilterFromDraft=o,exports.filterOptionsByNumberCondition=l,exports.formatParsedNumberFilter=s,exports.numberFilterOperandCount=r,exports.numberFilterValueToConditionDraft=f,exports.parsedNumberFilterToConditionDraft=d;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { NumberColumnFilterValue, ParsedNumberFilter } from '../model/gridTypes.unbound';
|
|
2
|
+
export type NumberFilterOperator = 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'ne' | 'between' | 'blank' | 'notBlank';
|
|
3
|
+
export type NumberFilterConditionDraft = {
|
|
4
|
+
operator: NumberFilterOperator;
|
|
5
|
+
value1: string;
|
|
6
|
+
value2: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const DEFAULT_NUMBER_FILTER_DRAFT: NumberFilterConditionDraft;
|
|
9
|
+
export declare const NUMBER_FILTER_OPERATOR_OPTIONS: ReadonlyArray<{
|
|
10
|
+
value: NumberFilterOperator;
|
|
11
|
+
label: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const numberFilterOperandCount: (operator: NumberFilterOperator) => 0 | 1 | 2;
|
|
14
|
+
export declare const buildParsedNumberFilterFromDraft: (draft: NumberFilterConditionDraft) => ParsedNumberFilter | null;
|
|
15
|
+
export declare const formatParsedNumberFilter: (parsed: ParsedNumberFilter) => string;
|
|
16
|
+
export declare const buildNumberColumnFilterValueFromDraft: (draft: NumberFilterConditionDraft) => NumberColumnFilterValue | null;
|
|
17
|
+
export declare const filterOptionsByNumberCondition: <O extends {
|
|
18
|
+
value: string;
|
|
19
|
+
}>(options: O[], condition: ParsedNumberFilter | null) => O[];
|
|
20
|
+
export declare const parsedNumberFilterToConditionDraft: (parsed: ParsedNumberFilter | null | undefined) => NumberFilterConditionDraft;
|
|
21
|
+
export declare const numberFilterValueToConditionDraft: (value: NumberColumnFilterValue | undefined) => NumberFilterConditionDraft;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { matchesParsedNumberFilter as e } from "./filtering.js";
|
|
2
|
+
//#region src/logic/numberFilterCondition.ts
|
|
3
|
+
var t = {
|
|
4
|
+
operator: "gte",
|
|
5
|
+
value1: "",
|
|
6
|
+
value2: ""
|
|
7
|
+
}, n = [
|
|
8
|
+
{
|
|
9
|
+
value: "gte",
|
|
10
|
+
label: "以上"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "gt",
|
|
14
|
+
label: "より大きい"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "lte",
|
|
18
|
+
label: "以下"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "lt",
|
|
22
|
+
label: "未満"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "eq",
|
|
26
|
+
label: "に等しい"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "ne",
|
|
30
|
+
label: "に等しくない"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: "between",
|
|
34
|
+
label: "範囲"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "blank",
|
|
38
|
+
label: "空白"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "notBlank",
|
|
42
|
+
label: "空白でない"
|
|
43
|
+
}
|
|
44
|
+
], r = (e) => e === "blank" || e === "notBlank" ? 0 : e === "between" ? 2 : 1, i = (e) => {
|
|
45
|
+
let t = e.trim();
|
|
46
|
+
if (!t) return null;
|
|
47
|
+
let n = Number(t);
|
|
48
|
+
return Number.isFinite(n) ? n : null;
|
|
49
|
+
}, a = {
|
|
50
|
+
gte: ">=",
|
|
51
|
+
gt: ">",
|
|
52
|
+
lte: "<=",
|
|
53
|
+
lt: "<",
|
|
54
|
+
eq: "=",
|
|
55
|
+
ne: "!="
|
|
56
|
+
}, o = (e) => {
|
|
57
|
+
if (e.operator === "blank" || e.operator === "notBlank") return { mode: e.operator };
|
|
58
|
+
if (e.operator === "between") {
|
|
59
|
+
let t = i(e.value1), n = i(e.value2);
|
|
60
|
+
return t !== null && n !== null ? {
|
|
61
|
+
mode: "range",
|
|
62
|
+
min: Math.min(t, n),
|
|
63
|
+
max: Math.max(t, n)
|
|
64
|
+
} : t === null ? n === null ? null : {
|
|
65
|
+
mode: "comparison",
|
|
66
|
+
operator: "<=",
|
|
67
|
+
value: n
|
|
68
|
+
} : {
|
|
69
|
+
mode: "comparison",
|
|
70
|
+
operator: ">=",
|
|
71
|
+
value: t
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
let t = i(e.value1);
|
|
75
|
+
return t === null ? null : {
|
|
76
|
+
mode: "comparison",
|
|
77
|
+
operator: a[e.operator],
|
|
78
|
+
value: t
|
|
79
|
+
};
|
|
80
|
+
}, s = (e) => {
|
|
81
|
+
switch (e.mode) {
|
|
82
|
+
case "comparison": switch (e.operator) {
|
|
83
|
+
case ">=": return `${e.value} 以上`;
|
|
84
|
+
case ">": return `${e.value} より大きい`;
|
|
85
|
+
case "<=": return `${e.value} 以下`;
|
|
86
|
+
case "<": return `${e.value} 未満`;
|
|
87
|
+
case "!=": return `${e.value} に等しくない`;
|
|
88
|
+
default: return `${e.value} に等しい`;
|
|
89
|
+
}
|
|
90
|
+
case "range": return `${e.min} 〜 ${e.max}`;
|
|
91
|
+
case "blank": return "(空白)";
|
|
92
|
+
case "notBlank": return "(空白でない)";
|
|
93
|
+
}
|
|
94
|
+
}, c = (e) => {
|
|
95
|
+
let t = o(e);
|
|
96
|
+
return t === null ? null : {
|
|
97
|
+
kind: "number",
|
|
98
|
+
raw: s(t),
|
|
99
|
+
parsed: t
|
|
100
|
+
};
|
|
101
|
+
}, l = (t, n) => n ? t.filter((t) => e(n, t.value)) : t, u = {
|
|
102
|
+
">=": "gte",
|
|
103
|
+
">": "gt",
|
|
104
|
+
"<=": "lte",
|
|
105
|
+
"<": "lt",
|
|
106
|
+
"=": "eq",
|
|
107
|
+
"!=": "ne"
|
|
108
|
+
}, d = (e) => {
|
|
109
|
+
if (!e) return t;
|
|
110
|
+
switch (e.mode) {
|
|
111
|
+
case "comparison": return {
|
|
112
|
+
operator: u[e.operator],
|
|
113
|
+
value1: String(e.value),
|
|
114
|
+
value2: ""
|
|
115
|
+
};
|
|
116
|
+
case "range": return {
|
|
117
|
+
operator: "between",
|
|
118
|
+
value1: String(e.min),
|
|
119
|
+
value2: String(e.max)
|
|
120
|
+
};
|
|
121
|
+
case "blank":
|
|
122
|
+
case "notBlank": return {
|
|
123
|
+
operator: e.mode,
|
|
124
|
+
value1: "",
|
|
125
|
+
value2: ""
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}, f = (e) => d(e?.parsed);
|
|
129
|
+
//#endregion
|
|
130
|
+
export { t as DEFAULT_NUMBER_FILTER_DRAFT, n as NUMBER_FILTER_OPERATOR_OPTIONS, c as buildNumberColumnFilterValueFromDraft, o as buildParsedNumberFilterFromDraft, l as filterOptionsByNumberCondition, s as formatParsedNumberFilter, r as numberFilterOperandCount, f as numberFilterValueToConditionDraft, d as parsedNumberFilterToConditionDraft };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=8,t=40,n=({top:e,left:t,panelWidth:n,viewportWidth:r,viewportHeight:i})=>{let a=Math.max(8,Math.min(t,r-n-8));return{top:Math.max(8,Math.min(e,i-40)),left:a}};exports.PANEL_DRAG_MIN_VISIBLE=t,exports.PANEL_DRAG_VIEWPORT_MARGIN=e,exports.clampPanelDragPosition=n;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const PANEL_DRAG_VIEWPORT_MARGIN = 8;
|
|
2
|
+
export declare const PANEL_DRAG_MIN_VISIBLE = 40;
|
|
3
|
+
export type PanelDragClampArgs = {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
panelWidth: number;
|
|
7
|
+
viewportWidth: number;
|
|
8
|
+
viewportHeight: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const clampPanelDragPosition: ({ top, left, panelWidth, viewportWidth, viewportHeight, }: PanelDragClampArgs) => {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/logic/panelDragGeometry.ts
|
|
2
|
+
var e = 8, t = 40, n = ({ top: e, left: t, panelWidth: n, viewportWidth: r, viewportHeight: i }) => {
|
|
3
|
+
let a = Math.max(8, Math.min(t, r - n - 8));
|
|
4
|
+
return {
|
|
5
|
+
top: Math.max(8, Math.min(e, i - 40)),
|
|
6
|
+
left: a
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as PANEL_DRAG_MIN_VISIBLE, e as PANEL_DRAG_VIEWPORT_MARGIN, n as clampPanelDragPosition };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>{let{heights:n,prefix:r,rowCount:i}=e,a=Math.max(t,0);for(let e=a;e<i;e+=1)r[e+1]=r[e]+n[e]},t=(t,n,r,i)=>{let a=i??new Map,o=Math.max(t,0),s=new Float64Array(o);for(let e=0;e<o;e+=1){let t=a.get(r(e));s[e]=t===void 0?n:t}let c={rowCount:o,estimate:n,heights:s,prefix:new Float64Array(o+1),measured:a};return e(c,0),c},n=(e,t,n,r)=>t<0||t>=e.rowCount||(e.measured.set(n,r),e.heights[t]===r)?!1:(e.heights[t]=r,!0),r=(e,t,n)=>{if(t<=0||n<=0)return 0;if(n>=e[t])return t-1;let r=0,i=t;for(;r<i;){let t=r+i+1>>1;e[t]<=n?r=t:i=t-1}return Math.min(Math.max(r,0),t-1)},i=e=>{let{prefix:t,rowCount:n}=e;return{rowCount:n,rowTop:e=>t[Math.min(Math.max(e,0),n)],rowsHeight:(e,r)=>t[Math.min(Math.max(r+1,0),n)]-t[Math.min(Math.max(e,0),n)],totalBodyHeight:t[n],rowAtContentY:e=>r(t,n,e),cellHeight:e=>t[Math.min(Math.max(e+1,0),n)]-t[Math.min(Math.max(e,0),n)],detailHeight:()=>0}};exports.buildRowHeightStore=t,exports.createAutoHeightRowMetrics=i,exports.rebuildPrefixFrom=e,exports.setMeasuredRowHeight=n;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { GridRowKey } from '../model/gridTypes.unbound';
|
|
2
|
+
import type { RowMetrics } from './verticalGeometry';
|
|
3
|
+
export type RowHeightStore = {
|
|
4
|
+
rowCount: number;
|
|
5
|
+
estimate: number;
|
|
6
|
+
heights: Float64Array;
|
|
7
|
+
prefix: Float64Array;
|
|
8
|
+
measured: Map<GridRowKey, number>;
|
|
9
|
+
};
|
|
10
|
+
export declare const rebuildPrefixFrom: (store: RowHeightStore, fromIndex: number) => void;
|
|
11
|
+
export declare const buildRowHeightStore: (rowCount: number, estimate: number, getRowKey: (viewIndex: number) => GridRowKey, measured?: Map<GridRowKey, number>) => RowHeightStore;
|
|
12
|
+
export declare const setMeasuredRowHeight: (store: RowHeightStore, viewIndex: number, rowKey: GridRowKey, height: number) => boolean;
|
|
13
|
+
export declare const createAutoHeightRowMetrics: (store: RowHeightStore) => RowMetrics;
|