@ishibashi0112/spreadsheet-grid-core 0.48.0 → 0.50.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/dist/controllers/autoHeightMeasurer.cjs +1 -1
- package/dist/controllers/autoHeightMeasurer.js +4 -2
- package/dist/controllers/clipboardController.cjs +1 -1
- package/dist/controllers/clipboardController.d.ts +2 -1
- package/dist/controllers/clipboardController.js +67 -61
- package/dist/controllers/columnAutosizeRunner.cjs +1 -1
- package/dist/controllers/columnAutosizeRunner.d.ts +3 -0
- package/dist/controllers/columnAutosizeRunner.js +40 -24
- package/dist/controllers/columnHeaderDragController.cjs +1 -1
- package/dist/controllers/columnHeaderDragController.js +5 -2
- package/dist/controllers/dateRolloverStore.cjs +1 -0
- package/dist/controllers/dateRolloverStore.d.ts +13 -0
- package/dist/controllers/dateRolloverStore.js +41 -0
- package/dist/controllers/editController.cjs +1 -1
- package/dist/controllers/editController.js +2 -2
- package/dist/controllers/fillHandleController.cjs +1 -0
- package/dist/controllers/fillHandleController.d.ts +87 -0
- package/dist/controllers/fillHandleController.js +346 -0
- package/dist/controllers/filterPopoverController.cjs +1 -1
- package/dist/controllers/filterPopoverController.js +55 -46
- package/dist/controllers/globalFilteredOrder.cjs +1 -1
- package/dist/controllers/globalFilteredOrder.js +5 -5
- package/dist/controllers/historyController.cjs +1 -1
- package/dist/controllers/historyController.d.ts +1 -0
- package/dist/controllers/historyController.js +8 -5
- package/dist/controllers/keyboardController.cjs +1 -1
- package/dist/controllers/keyboardController.js +2 -2
- package/dist/controllers/pointerInteractionsController.cjs +1 -1
- package/dist/controllers/pointerInteractionsController.d.ts +2 -0
- package/dist/controllers/pointerInteractionsController.js +136 -132
- package/dist/controllers/rowDragController.cjs +1 -1
- package/dist/controllers/rowDragController.d.ts +1 -0
- package/dist/controllers/rowDragController.js +104 -97
- package/dist/controllers/scrollSyncController.cjs +1 -1
- package/dist/controllers/scrollSyncController.d.ts +1 -0
- package/dist/controllers/scrollSyncController.js +32 -21
- package/dist/controllers/selectOptionsCollector.cjs +1 -1
- package/dist/controllers/selectOptionsCollector.js +5 -5
- package/dist/controllers/selectionAggregatesRunner.cjs +1 -0
- package/dist/controllers/selectionAggregatesRunner.d.ts +27 -0
- package/dist/controllers/selectionAggregatesRunner.js +65 -0
- package/dist/controllers/serverSideRowModel.cjs +1 -1
- package/dist/controllers/serverSideRowModel.js +75 -69
- package/dist/controllers/tooltipController.cjs +1 -1
- package/dist/controllers/tooltipController.js +44 -43
- package/dist/controllers/viewportSyncController.cjs +1 -1
- package/dist/controllers/viewportSyncController.d.ts +3 -2
- package/dist/controllers/viewportSyncController.js +6 -4
- package/dist/engine/columnCommands.cjs +1 -1
- package/dist/engine/columnCommands.js +1 -1
- package/dist/engine/columnLayout.cjs +1 -1
- package/dist/engine/columnLayout.js +1 -1
- package/dist/engine/createGridEngine.cjs +1 -1
- package/dist/engine/createGridEngine.d.ts +4 -0
- package/dist/engine/createGridEngine.js +58 -54
- package/dist/engine/gridApi.cjs +1 -1
- package/dist/engine/gridApi.d.ts +6 -0
- package/dist/engine/gridApi.js +130 -119
- package/dist/engine/rowPipeline.cjs +1 -1
- package/dist/engine/rowPipeline.d.ts +2 -0
- package/dist/engine/rowPipeline.js +67 -35
- package/dist/logic/aggregation.cjs +1 -1
- package/dist/logic/aggregation.d.ts +1 -0
- package/dist/logic/aggregation.js +16 -7
- package/dist/logic/autoScrollGeometry.cjs +1 -1
- package/dist/logic/autoScrollGeometry.d.ts +1 -0
- package/dist/logic/autoScrollGeometry.js +3 -3
- package/dist/logic/clearCells.cjs +1 -1
- package/dist/logic/clearCells.d.ts +1 -1
- package/dist/logic/clearCells.js +7 -7
- package/dist/logic/columnAutosize.cjs +1 -1
- package/dist/logic/columnAutosize.d.ts +6 -0
- package/dist/logic/columnAutosize.js +60 -39
- package/dist/logic/columnFlex.cjs +1 -1
- package/dist/logic/columnFlex.js +20 -22
- package/dist/logic/exportCsv.cjs +2 -2
- package/dist/logic/exportCsv.d.ts +5 -1
- package/dist/logic/exportCsv.js +16 -15
- package/dist/logic/exportData.cjs +1 -1
- package/dist/logic/exportData.d.ts +2 -1
- package/dist/logic/exportData.js +27 -21
- package/dist/logic/fillHandle.cjs +1 -0
- package/dist/logic/fillHandle.d.ts +69 -0
- package/dist/logic/fillHandle.js +254 -0
- package/dist/logic/fillSeries.cjs +1 -0
- package/dist/logic/fillSeries.d.ts +11 -0
- package/dist/logic/fillSeries.js +239 -0
- package/dist/logic/filtering.cjs +1 -1
- package/dist/logic/filtering.d.ts +2 -0
- package/dist/logic/filtering.js +50 -37
- package/dist/logic/gridState.cjs +1 -1
- package/dist/logic/gridState.d.ts +1 -0
- package/dist/logic/gridState.js +2 -2
- package/dist/logic/imeInput.cjs +1 -1
- package/dist/logic/imeInput.js +2 -2
- package/dist/logic/labelRows.cjs +1 -1
- package/dist/logic/labelRows.js +1 -1
- package/dist/logic/selectOptions.cjs +1 -1
- package/dist/logic/selectOptions.js +1 -1
- package/dist/logic/selectionAggregates.cjs +1 -0
- package/dist/logic/selectionAggregates.d.ts +25 -0
- package/dist/logic/selectionAggregates.js +74 -0
- package/dist/logic/sorting.cjs +1 -1
- package/dist/logic/sorting.d.ts +18 -0
- package/dist/logic/sorting.js +133 -64
- package/dist/logic/totalRow.cjs +1 -0
- package/dist/logic/totalRow.d.ts +25 -0
- package/dist/logic/totalRow.js +90 -0
- package/dist/model/gridReducer.cjs +1 -1
- package/dist/model/gridReducer.js +73 -68
- package/dist/model/gridTypes.core.d.ts +204 -17
- package/dist/model/gridTypes.unbound.d.ts +4 -0
- package/dist/utils/clipboard.cjs +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.js +9 -9
- package/dist/utils/permissions.cjs +1 -1
- package/dist/utils/permissions.d.ts +6 -2
- package/dist/utils/permissions.js +8 -2
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { reconcileColumnWidths as e } from "../logic/columnWidthState.js";
|
|
2
2
|
import { createEmptyRowSelection as t, rowSelectionStateEquals as n } from "../logic/rowSelection.js";
|
|
3
|
+
import { isSameColumnFilterValue as r, isSameSortState as i } from "../logic/gridState.js";
|
|
3
4
|
//#region src/model/gridReducer.ts
|
|
4
|
-
var
|
|
5
|
+
var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
|
|
5
6
|
let { activeCell: n, selection: r, dragState: i } = e;
|
|
6
7
|
if (t <= 0) {
|
|
7
8
|
let t = r !== null && r.type !== "col", a = i?.type === "selection" && i.selectionKind !== "col";
|
|
@@ -61,7 +62,7 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
61
62
|
anchorRow: a
|
|
62
63
|
}
|
|
63
64
|
})), o;
|
|
64
|
-
},
|
|
65
|
+
}, c = () => ({
|
|
65
66
|
activeCell: null,
|
|
66
67
|
selection: null,
|
|
67
68
|
rowSelection: t(),
|
|
@@ -75,60 +76,60 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
75
76
|
sort: [],
|
|
76
77
|
collapsedGroupKeys: /* @__PURE__ */ new Set(),
|
|
77
78
|
expandedDetailRowKeys: /* @__PURE__ */ new Set()
|
|
78
|
-
}),
|
|
79
|
-
switch (
|
|
80
|
-
case "cell/activate": return {
|
|
79
|
+
}), l = (t, c) => {
|
|
80
|
+
switch (c.type) {
|
|
81
|
+
case "cell/activate": return c.cell === t.activeCell || c.cell !== null && t.activeCell !== null && c.cell.row === t.activeCell.row && c.cell.col === t.activeCell.col ? t : {
|
|
81
82
|
...t,
|
|
82
|
-
activeCell:
|
|
83
|
+
activeCell: c.cell
|
|
83
84
|
};
|
|
84
85
|
case "selection/start": return {
|
|
85
86
|
...t,
|
|
86
|
-
activeCell:
|
|
87
|
+
activeCell: c.cell,
|
|
87
88
|
selection: {
|
|
88
89
|
type: "cell",
|
|
89
90
|
range: {
|
|
90
|
-
start:
|
|
91
|
-
end:
|
|
91
|
+
start: c.cell,
|
|
92
|
+
end: c.cell
|
|
92
93
|
}
|
|
93
94
|
},
|
|
94
95
|
dragState: {
|
|
95
96
|
type: "selection",
|
|
96
97
|
selectionKind: "cell",
|
|
97
|
-
anchor:
|
|
98
|
+
anchor: c.cell
|
|
98
99
|
}
|
|
99
100
|
};
|
|
100
101
|
case "rowSelection/start": return {
|
|
101
102
|
...t,
|
|
102
103
|
activeCell: {
|
|
103
|
-
row:
|
|
104
|
+
row: c.row,
|
|
104
105
|
col: t.activeCell?.col ?? 0
|
|
105
106
|
},
|
|
106
107
|
selection: {
|
|
107
108
|
type: "row",
|
|
108
|
-
startRow:
|
|
109
|
-
endRow:
|
|
109
|
+
startRow: c.row,
|
|
110
|
+
endRow: c.row
|
|
110
111
|
},
|
|
111
112
|
dragState: {
|
|
112
113
|
type: "selection",
|
|
113
114
|
selectionKind: "row",
|
|
114
|
-
anchorRow:
|
|
115
|
+
anchorRow: c.row
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
|
-
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow ===
|
|
118
|
+
case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow === c.row ? t : {
|
|
118
119
|
...t,
|
|
119
120
|
selection: {
|
|
120
121
|
type: "row",
|
|
121
122
|
startRow: t.dragState.anchorRow,
|
|
122
|
-
endRow:
|
|
123
|
+
endRow: c.row
|
|
123
124
|
}
|
|
124
125
|
};
|
|
125
|
-
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row ===
|
|
126
|
+
case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row === c.cell.row && t.selection.range.end.col === c.cell.col ? t : {
|
|
126
127
|
...t,
|
|
127
128
|
selection: {
|
|
128
129
|
type: "cell",
|
|
129
130
|
range: {
|
|
130
131
|
start: t.dragState.anchor,
|
|
131
|
-
end:
|
|
132
|
+
end: c.cell
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
};
|
|
@@ -136,43 +137,43 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
136
137
|
...t,
|
|
137
138
|
activeCell: {
|
|
138
139
|
row: t.activeCell?.row ?? 0,
|
|
139
|
-
col:
|
|
140
|
+
col: c.col
|
|
140
141
|
},
|
|
141
142
|
selection: {
|
|
142
143
|
type: "col",
|
|
143
|
-
startCol:
|
|
144
|
-
endCol:
|
|
144
|
+
startCol: c.col,
|
|
145
|
+
endCol: c.col
|
|
145
146
|
},
|
|
146
147
|
dragState: {
|
|
147
148
|
type: "selection",
|
|
148
149
|
selectionKind: "col",
|
|
149
|
-
anchorCol:
|
|
150
|
+
anchorCol: c.col
|
|
150
151
|
}
|
|
151
152
|
};
|
|
152
|
-
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol ===
|
|
153
|
+
case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol === c.col ? t : {
|
|
153
154
|
...t,
|
|
154
155
|
selection: {
|
|
155
156
|
type: "col",
|
|
156
157
|
startCol: t.dragState.anchorCol,
|
|
157
|
-
endCol:
|
|
158
|
+
endCol: c.col
|
|
158
159
|
}
|
|
159
160
|
};
|
|
160
161
|
case "selection/end": return t.dragState?.type === "selection" ? {
|
|
161
162
|
...t,
|
|
162
163
|
dragState: null
|
|
163
164
|
} : t;
|
|
164
|
-
case "selection/clear": return {
|
|
165
|
+
case "selection/clear": return t.selection === null && t.dragState === null ? t : {
|
|
165
166
|
...t,
|
|
166
167
|
selection: null,
|
|
167
168
|
dragState: null
|
|
168
169
|
};
|
|
169
|
-
case "selection/clampToRowCount": return
|
|
170
|
+
case "selection/clampToRowCount": return s(t, c.rowCount);
|
|
170
171
|
case "edit/start": return {
|
|
171
172
|
...t,
|
|
172
|
-
editingCell:
|
|
173
|
-
activeCell:
|
|
173
|
+
editingCell: c.cell,
|
|
174
|
+
activeCell: c.cell
|
|
174
175
|
};
|
|
175
|
-
case "edit/stop": return {
|
|
176
|
+
case "edit/stop": return t.editingCell === null ? t : {
|
|
176
177
|
...t,
|
|
177
178
|
editingCell: null
|
|
178
179
|
};
|
|
@@ -180,16 +181,16 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
180
181
|
...t,
|
|
181
182
|
dragState: {
|
|
182
183
|
type: "columnResize",
|
|
183
|
-
columnKey:
|
|
184
|
-
startX:
|
|
185
|
-
startWidth:
|
|
186
|
-
minWidth:
|
|
187
|
-
maxWidth:
|
|
184
|
+
columnKey: c.columnKey,
|
|
185
|
+
startX: c.startX,
|
|
186
|
+
startWidth: c.startWidth,
|
|
187
|
+
minWidth: c.minWidth ?? a,
|
|
188
|
+
maxWidth: c.maxWidth ?? Infinity
|
|
188
189
|
}
|
|
189
190
|
};
|
|
190
191
|
case "column/resizeUpdate": {
|
|
191
192
|
if (t.dragState?.type !== "columnResize") return t;
|
|
192
|
-
let e =
|
|
193
|
+
let e = o(t.dragState.startWidth + (c.clientX - t.dragState.startX), t.dragState.minWidth, t.dragState.maxWidth);
|
|
193
194
|
return t.columnWidths[t.dragState.columnKey] === e ? t : {
|
|
194
195
|
...t,
|
|
195
196
|
columnWidths: {
|
|
@@ -206,40 +207,44 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
206
207
|
...t,
|
|
207
208
|
columnWidths: {
|
|
208
209
|
...t.columnWidths,
|
|
209
|
-
...
|
|
210
|
+
...c.widths
|
|
210
211
|
}
|
|
211
212
|
};
|
|
212
213
|
case "columnWidths/reset": return {
|
|
213
214
|
...t,
|
|
214
|
-
columnWidths:
|
|
215
|
+
columnWidths: c.widths
|
|
215
216
|
};
|
|
216
217
|
case "columnWidths/reconcile": {
|
|
217
|
-
let n = e(t.columnWidths,
|
|
218
|
+
let n = e(t.columnWidths, c.prevColumns, c.nextColumns);
|
|
218
219
|
return n === t.columnWidths ? t : {
|
|
219
220
|
...t,
|
|
220
221
|
columnWidths: n
|
|
221
222
|
};
|
|
222
223
|
}
|
|
223
|
-
case "filter/setGlobal": return {
|
|
224
|
+
case "filter/setGlobal": return t.filters.globalText === c.value ? t : {
|
|
224
225
|
...t,
|
|
225
226
|
filters: {
|
|
226
227
|
...t.filters,
|
|
227
|
-
globalText:
|
|
228
|
+
globalText: c.value
|
|
228
229
|
}
|
|
229
230
|
};
|
|
230
|
-
case "filter/setColumn":
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
...t
|
|
234
|
-
|
|
235
|
-
...t.filters
|
|
236
|
-
|
|
231
|
+
case "filter/setColumn": {
|
|
232
|
+
let e = t.filters.columnFilters[c.columnKey];
|
|
233
|
+
return e !== void 0 && (e === c.value || r(e, c.value)) ? t : {
|
|
234
|
+
...t,
|
|
235
|
+
filters: {
|
|
236
|
+
...t.filters,
|
|
237
|
+
columnFilters: {
|
|
238
|
+
...t.filters.columnFilters,
|
|
239
|
+
[c.columnKey]: c.value
|
|
240
|
+
}
|
|
237
241
|
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
242
|
+
};
|
|
243
|
+
}
|
|
240
244
|
case "filter/clearColumn": {
|
|
245
|
+
if (!(c.columnKey in t.filters.columnFilters)) return t;
|
|
241
246
|
let e = { ...t.filters.columnFilters };
|
|
242
|
-
return delete e[
|
|
247
|
+
return delete e[c.columnKey], {
|
|
243
248
|
...t,
|
|
244
249
|
filters: {
|
|
245
250
|
...t.filters,
|
|
@@ -247,7 +252,7 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
247
252
|
}
|
|
248
253
|
};
|
|
249
254
|
}
|
|
250
|
-
case "filter/resetAll": return {
|
|
255
|
+
case "filter/resetAll": return t.filters.globalText === "" && Object.keys(t.filters.columnFilters).length === 0 ? t : {
|
|
251
256
|
...t,
|
|
252
257
|
filters: {
|
|
253
258
|
globalText: "",
|
|
@@ -256,60 +261,60 @@ var r = 60, i = (e, t, n) => Math.min(Math.max(e, t), n), a = (e, t) => {
|
|
|
256
261
|
};
|
|
257
262
|
case "filter/setAll": return {
|
|
258
263
|
...t,
|
|
259
|
-
filters:
|
|
264
|
+
filters: c.filters
|
|
260
265
|
};
|
|
261
|
-
case "sort/set": return {
|
|
266
|
+
case "sort/set": return i(t.sort, c.entries) ? t : {
|
|
262
267
|
...t,
|
|
263
|
-
sort:
|
|
268
|
+
sort: c.entries
|
|
264
269
|
};
|
|
265
|
-
case "sort/clear": return {
|
|
270
|
+
case "sort/clear": return t.sort.length === 0 ? t : {
|
|
266
271
|
...t,
|
|
267
272
|
sort: []
|
|
268
273
|
};
|
|
269
|
-
case "rowSelect/set": return n(t.rowSelection,
|
|
274
|
+
case "rowSelect/set": return n(t.rowSelection, c.state) ? t : {
|
|
270
275
|
...t,
|
|
271
|
-
rowSelection:
|
|
276
|
+
rowSelection: c.state
|
|
272
277
|
};
|
|
273
278
|
case "group/toggleCollapsed": {
|
|
274
279
|
let e = new Set(t.collapsedGroupKeys);
|
|
275
|
-
return e.has(
|
|
280
|
+
return e.has(c.groupKey) ? e.delete(c.groupKey) : e.add(c.groupKey), {
|
|
276
281
|
...t,
|
|
277
282
|
collapsedGroupKeys: e
|
|
278
283
|
};
|
|
279
284
|
}
|
|
280
285
|
case "group/setCollapsed": {
|
|
281
|
-
if (t.collapsedGroupKeys.has(
|
|
286
|
+
if (t.collapsedGroupKeys.has(c.groupKey) === c.collapsed) return t;
|
|
282
287
|
let e = new Set(t.collapsedGroupKeys);
|
|
283
|
-
return
|
|
288
|
+
return c.collapsed ? e.add(c.groupKey) : e.delete(c.groupKey), {
|
|
284
289
|
...t,
|
|
285
290
|
collapsedGroupKeys: e
|
|
286
291
|
};
|
|
287
292
|
}
|
|
288
|
-
case "group/setCollapsedKeys": return
|
|
293
|
+
case "group/setCollapsedKeys": return c.keys === t.collapsedGroupKeys || c.keys.size === 0 && t.collapsedGroupKeys.size === 0 ? t : {
|
|
289
294
|
...t,
|
|
290
|
-
collapsedGroupKeys:
|
|
295
|
+
collapsedGroupKeys: c.keys
|
|
291
296
|
};
|
|
292
297
|
case "detail/toggle": {
|
|
293
298
|
let e = new Set(t.expandedDetailRowKeys);
|
|
294
|
-
return e.has(
|
|
299
|
+
return e.has(c.rowKey) ? e.delete(c.rowKey) : e.add(c.rowKey), {
|
|
295
300
|
...t,
|
|
296
301
|
expandedDetailRowKeys: e
|
|
297
302
|
};
|
|
298
303
|
}
|
|
299
304
|
case "detail/setExpanded": {
|
|
300
|
-
if (t.expandedDetailRowKeys.has(
|
|
305
|
+
if (t.expandedDetailRowKeys.has(c.rowKey) === c.expanded) return t;
|
|
301
306
|
let e = new Set(t.expandedDetailRowKeys);
|
|
302
|
-
return
|
|
307
|
+
return c.expanded ? e.add(c.rowKey) : e.delete(c.rowKey), {
|
|
303
308
|
...t,
|
|
304
309
|
expandedDetailRowKeys: e
|
|
305
310
|
};
|
|
306
311
|
}
|
|
307
|
-
case "detail/setKeys": return
|
|
312
|
+
case "detail/setKeys": return c.keys === t.expandedDetailRowKeys || c.keys.size === 0 && t.expandedDetailRowKeys.size === 0 ? t : {
|
|
308
313
|
...t,
|
|
309
|
-
expandedDetailRowKeys:
|
|
314
|
+
expandedDetailRowKeys: c.keys
|
|
310
315
|
};
|
|
311
316
|
default: return t;
|
|
312
317
|
}
|
|
313
318
|
};
|
|
314
319
|
//#endregion
|
|
315
|
-
export {
|
|
320
|
+
export { c as createInitialGridUiState, l as gridUiReducer };
|