@ishibashi0112/spreadsheet-grid-core 1.0.1 → 1.0.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.
Files changed (103) hide show
  1. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  2. package/dist/controllers/autoHeightMeasurer.js +4 -2
  3. package/dist/controllers/clipboardController.cjs +1 -2
  4. package/dist/controllers/clipboardController.js +26 -26
  5. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  6. package/dist/controllers/columnAutosizeRunner.d.ts +2 -1
  7. package/dist/controllers/columnAutosizeRunner.js +11 -10
  8. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  9. package/dist/controllers/columnHeaderDragController.js +176 -171
  10. package/dist/controllers/columnMenuController.cjs +1 -1
  11. package/dist/controllers/columnMenuController.js +1 -1
  12. package/dist/controllers/editController.cjs +1 -1
  13. package/dist/controllers/editController.js +78 -78
  14. package/dist/controllers/escapeClaimController.cjs +1 -1
  15. package/dist/controllers/escapeClaimController.d.ts +1 -0
  16. package/dist/controllers/escapeClaimController.js +11 -5
  17. package/dist/controllers/fillHandleController.cjs +1 -1
  18. package/dist/controllers/fillHandleController.js +141 -140
  19. package/dist/controllers/filterPopoverController.cjs +1 -1
  20. package/dist/controllers/filterPopoverController.js +81 -77
  21. package/dist/controllers/findController.cjs +1 -1
  22. package/dist/controllers/findController.d.ts +1 -0
  23. package/dist/controllers/findController.js +36 -29
  24. package/dist/controllers/keyboardController.cjs +1 -1
  25. package/dist/controllers/keyboardController.js +112 -116
  26. package/dist/controllers/popoverSupport.cjs +1 -1
  27. package/dist/controllers/popoverSupport.js +10 -5
  28. package/dist/controllers/rowDragController.cjs +1 -1
  29. package/dist/controllers/rowDragController.js +128 -127
  30. package/dist/controllers/rowEnterController.cjs +1 -1
  31. package/dist/controllers/rowEnterController.d.ts +1 -0
  32. package/dist/controllers/rowEnterController.js +47 -42
  33. package/dist/controllers/tooltipController.cjs +1 -1
  34. package/dist/controllers/tooltipController.js +64 -47
  35. package/dist/controllers/viewportSyncController.cjs +1 -1
  36. package/dist/controllers/viewportSyncController.d.ts +1 -0
  37. package/dist/controllers/viewportSyncController.js +29 -8
  38. package/dist/engine/filterPopoverCommands.cjs +1 -1
  39. package/dist/engine/filterPopoverCommands.d.ts +2 -0
  40. package/dist/engine/filterPopoverCommands.js +15 -15
  41. package/dist/engine/fullFeatures.cjs +1 -1
  42. package/dist/engine/fullFeatures.js +17 -17
  43. package/dist/engine/gridApi.cjs +2 -2
  44. package/dist/engine/gridApi.d.ts +1 -0
  45. package/dist/engine/gridApi.js +11 -11
  46. package/dist/engine/rowSelectionCommands.cjs +1 -1
  47. package/dist/engine/rowSelectionCommands.d.ts +1 -0
  48. package/dist/engine/rowSelectionCommands.js +21 -12
  49. package/dist/locales/en.cjs +1 -1
  50. package/dist/locales/en.js +7 -4
  51. package/dist/logic/columnAutosize.cjs +1 -1
  52. package/dist/logic/columnAutosize.d.ts +8 -2
  53. package/dist/logic/columnAutosize.js +102 -87
  54. package/dist/logic/detailRow.cjs +1 -1
  55. package/dist/logic/detailRow.d.ts +4 -0
  56. package/dist/logic/detailRow.js +18 -15
  57. package/dist/logic/editorValues.cjs +1 -1
  58. package/dist/logic/editorValues.d.ts +1 -0
  59. package/dist/logic/editorValues.js +29 -29
  60. package/dist/logic/filterSummary.cjs +1 -1
  61. package/dist/logic/filterSummary.js +9 -2
  62. package/dist/logic/find.cjs +1 -1
  63. package/dist/logic/find.d.ts +4 -3
  64. package/dist/logic/find.js +27 -13
  65. package/dist/logic/gridAsk.cjs +2 -2
  66. package/dist/logic/gridAsk.d.ts +7 -7
  67. package/dist/logic/gridAsk.js +140 -122
  68. package/dist/logic/gridAskLocaleText.cjs +1 -1
  69. package/dist/logic/gridAskLocaleText.d.ts +2 -0
  70. package/dist/logic/gridAskLocaleText.js +1 -0
  71. package/dist/logic/gridState.d.ts +2 -2
  72. package/dist/logic/localeText.cjs +1 -1
  73. package/dist/logic/localeText.d.ts +2 -0
  74. package/dist/logic/localeText.js +1 -0
  75. package/dist/logic/localeTextFeatures.cjs +1 -1
  76. package/dist/logic/localeTextFeatures.js +2 -2
  77. package/dist/logic/localeTextFilters.cjs +1 -1
  78. package/dist/logic/localeTextFilters.d.ts +1 -0
  79. package/dist/logic/localeTextFilters.js +1 -0
  80. package/dist/logic/localeTextPopups.cjs +1 -1
  81. package/dist/logic/localeTextPopups.js +2 -2
  82. package/dist/logic/numberFilterCondition.cjs +1 -1
  83. package/dist/logic/numberFilterCondition.d.ts +1 -1
  84. package/dist/logic/numberFilterCondition.js +5 -5
  85. package/dist/logic/scrollTargets.cjs +1 -1
  86. package/dist/logic/scrollTargets.js +2 -2
  87. package/dist/logic/selectEditorState.cjs +1 -1
  88. package/dist/logic/selectEditorState.d.ts +1 -0
  89. package/dist/logic/selectEditorState.js +8 -1
  90. package/dist/logic/valueFormatters.d.ts +5 -5
  91. package/dist/logic/verticalGeometry.cjs +1 -1
  92. package/dist/logic/verticalGeometry.d.ts +1 -0
  93. package/dist/logic/verticalGeometry.js +12 -8
  94. package/dist/model/gridActions.cjs +1 -1
  95. package/dist/model/gridActions.d.ts +2 -1
  96. package/dist/model/gridActions.js +3 -2
  97. package/dist/model/gridReducer.cjs +1 -1
  98. package/dist/model/gridReducer.js +145 -62
  99. package/dist/model/gridTypes.core.d.ts +319 -298
  100. package/dist/utils/clipboard.cjs +3 -5
  101. package/dist/utils/clipboard.d.ts +1 -0
  102. package/dist/utils/clipboard.js +25 -22
  103. package/package.json +1 -1
@@ -62,7 +62,87 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
62
62
  anchorRow: a
63
63
  }
64
64
  })), o;
65
- }, c = () => ({
65
+ }, c = (e, t) => {
66
+ let { activeCell: n, selection: r, dragState: i } = e;
67
+ if (t <= 0) {
68
+ let t = r !== null && r.type !== "row", a = i?.type === "selection" && i.selectionKind !== "row";
69
+ return n === null && !t && !a ? e : {
70
+ ...e,
71
+ activeCell: null,
72
+ selection: t ? null : r,
73
+ dragState: a ? null : i
74
+ };
75
+ }
76
+ let a = t - 1, o = e;
77
+ if (n !== null && n.col > a && (o = {
78
+ ...o,
79
+ activeCell: {
80
+ row: n.row,
81
+ col: a
82
+ }
83
+ }), r?.type === "cell") {
84
+ let { start: e, end: t } = r.range;
85
+ (e.col > a || t.col > a) && (o = {
86
+ ...o,
87
+ selection: {
88
+ type: "cell",
89
+ range: {
90
+ start: {
91
+ row: e.row,
92
+ col: Math.min(e.col, a)
93
+ },
94
+ end: {
95
+ row: t.row,
96
+ col: Math.min(t.col, a)
97
+ }
98
+ }
99
+ }
100
+ });
101
+ } else r?.type === "col" && (r.startCol > a || r.endCol > a) && (o = {
102
+ ...o,
103
+ selection: {
104
+ type: "col",
105
+ startCol: Math.min(r.startCol, a),
106
+ endCol: Math.min(r.endCol, a)
107
+ }
108
+ });
109
+ return i?.type === "selection" && (i.selectionKind === "cell" && i.anchor.col > a ? o = {
110
+ ...o,
111
+ dragState: {
112
+ ...i,
113
+ anchor: {
114
+ row: i.anchor.row,
115
+ col: a
116
+ }
117
+ }
118
+ } : i.selectionKind === "col" && i.anchorCol > a && (o = {
119
+ ...o,
120
+ dragState: {
121
+ ...i,
122
+ anchorCol: a
123
+ }
124
+ })), o;
125
+ }, l = (e, t, n) => {
126
+ if (t === null) return e;
127
+ let r = new Set(n.map((e) => e.key)), i = new Set(t.filter((e) => !r.has(e.key)).map((e) => e.key));
128
+ if (i.size === 0) return e;
129
+ let a = e, o = e.filters.columnFilters;
130
+ if (Object.keys(o).some((e) => i.has(e))) {
131
+ let e = {};
132
+ for (let [t, n] of Object.entries(o)) i.has(t) || (e[t] = n);
133
+ a = {
134
+ ...a,
135
+ filters: {
136
+ ...a.filters,
137
+ columnFilters: e
138
+ }
139
+ };
140
+ }
141
+ return e.sort.some((e) => i.has(e.columnKey)) && (a = {
142
+ ...a,
143
+ sort: e.sort.filter((e) => !i.has(e.columnKey))
144
+ }), a;
145
+ }, u = () => ({
66
146
  activeCell: null,
67
147
  selection: null,
68
148
  rowSelection: t(),
@@ -76,86 +156,86 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
76
156
  sort: [],
77
157
  collapsedGroupKeys: /* @__PURE__ */ new Set(),
78
158
  expandedDetailRowKeys: /* @__PURE__ */ new Set()
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 : {
159
+ }), d = (t, u) => {
160
+ switch (u.type) {
161
+ case "cell/activate": return u.cell === t.activeCell || u.cell !== null && t.activeCell !== null && u.cell.row === t.activeCell.row && u.cell.col === t.activeCell.col ? t : {
82
162
  ...t,
83
- activeCell: c.cell
163
+ activeCell: u.cell
84
164
  };
85
165
  case "selection/start": return {
86
166
  ...t,
87
- activeCell: c.cell,
167
+ activeCell: u.cell,
88
168
  selection: {
89
169
  type: "cell",
90
170
  range: {
91
- start: c.cell,
92
- end: c.cell
171
+ start: u.cell,
172
+ end: u.cell
93
173
  }
94
174
  },
95
175
  dragState: {
96
176
  type: "selection",
97
177
  selectionKind: "cell",
98
- anchor: c.cell
178
+ anchor: u.cell
99
179
  }
100
180
  };
101
181
  case "rowSelection/start": return {
102
182
  ...t,
103
183
  activeCell: {
104
- row: c.row,
105
- col: t.activeCell?.col ?? c.col ?? 0
184
+ row: u.row,
185
+ col: t.activeCell?.col ?? u.col ?? 0
106
186
  },
107
187
  selection: {
108
188
  type: "row",
109
- startRow: c.row,
110
- endRow: c.row
189
+ startRow: u.row,
190
+ endRow: u.row
111
191
  },
112
192
  dragState: {
113
193
  type: "selection",
114
194
  selectionKind: "row",
115
- anchorRow: c.row
195
+ anchorRow: u.row
116
196
  }
117
197
  };
118
- case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow === c.row ? t : {
198
+ case "rowSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "row" || t.selection?.type === "row" && t.selection.endRow === u.row ? t : {
119
199
  ...t,
120
200
  selection: {
121
201
  type: "row",
122
202
  startRow: t.dragState.anchorRow,
123
- endRow: c.row
203
+ endRow: u.row
124
204
  }
125
205
  };
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 : {
206
+ case "selection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "cell" || t.selection?.type === "cell" && t.selection.range.end.row === u.cell.row && t.selection.range.end.col === u.cell.col ? t : {
127
207
  ...t,
128
208
  selection: {
129
209
  type: "cell",
130
210
  range: {
131
211
  start: t.dragState.anchor,
132
- end: c.cell
212
+ end: u.cell
133
213
  }
134
214
  }
135
215
  };
136
216
  case "columnSelection/start": return {
137
217
  ...t,
138
218
  activeCell: {
139
- row: t.activeCell?.row ?? c.row ?? 0,
140
- col: c.col
219
+ row: t.activeCell?.row ?? u.row ?? 0,
220
+ col: u.col
141
221
  },
142
222
  selection: {
143
223
  type: "col",
144
- startCol: c.col,
145
- endCol: c.col
224
+ startCol: u.col,
225
+ endCol: u.col
146
226
  },
147
227
  dragState: {
148
228
  type: "selection",
149
229
  selectionKind: "col",
150
- anchorCol: c.col
230
+ anchorCol: u.col
151
231
  }
152
232
  };
153
- case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol === c.col ? t : {
233
+ case "columnSelection/update": return t.dragState?.type !== "selection" || t.dragState.selectionKind !== "col" || t.selection?.type === "col" && t.selection.endCol === u.col ? t : {
154
234
  ...t,
155
235
  selection: {
156
236
  type: "col",
157
237
  startCol: t.dragState.anchorCol,
158
- endCol: c.col
238
+ endCol: u.col
159
239
  }
160
240
  };
161
241
  case "selection/end": return t.dragState?.type === "selection" ? {
@@ -167,11 +247,14 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
167
247
  selection: null,
168
248
  dragState: null
169
249
  };
170
- case "selection/clampToRowCount": return s(t, c.rowCount);
250
+ case "selection/clampToRowCount": {
251
+ let e = s(t, u.rowCount);
252
+ return u.colCount === void 0 ? e : c(e, u.colCount);
253
+ }
171
254
  case "edit/start": return {
172
255
  ...t,
173
- editingCell: c.cell,
174
- activeCell: c.cell
256
+ editingCell: u.cell,
257
+ activeCell: u.cell
175
258
  };
176
259
  case "edit/stop": return t.editingCell === null ? t : {
177
260
  ...t,
@@ -181,16 +264,16 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
181
264
  ...t,
182
265
  dragState: {
183
266
  type: "columnResize",
184
- columnKey: c.columnKey,
185
- startX: c.startX,
186
- startWidth: c.startWidth,
187
- minWidth: c.minWidth ?? a,
188
- maxWidth: c.maxWidth ?? Infinity
267
+ columnKey: u.columnKey,
268
+ startX: u.startX,
269
+ startWidth: u.startWidth,
270
+ minWidth: u.minWidth ?? a,
271
+ maxWidth: u.maxWidth ?? Infinity
189
272
  }
190
273
  };
191
274
  case "column/resizeUpdate": {
192
275
  if (t.dragState?.type !== "columnResize") return t;
193
- let e = o(t.dragState.startWidth + (c.clientX - t.dragState.startX), t.dragState.minWidth, t.dragState.maxWidth);
276
+ let e = o(t.dragState.startWidth + (u.clientX - t.dragState.startX), t.dragState.minWidth, t.dragState.maxWidth);
194
277
  return t.columnWidths[t.dragState.columnKey] === e ? t : {
195
278
  ...t,
196
279
  columnWidths: {
@@ -207,44 +290,44 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
207
290
  ...t,
208
291
  columnWidths: {
209
292
  ...t.columnWidths,
210
- ...c.widths
293
+ ...u.widths
211
294
  }
212
295
  };
213
296
  case "columnWidths/reset": return {
214
297
  ...t,
215
- columnWidths: c.widths
298
+ columnWidths: u.widths
216
299
  };
217
300
  case "columnWidths/reconcile": {
218
- let n = e(t.columnWidths, c.prevColumns, c.nextColumns);
219
- return n === t.columnWidths ? t : {
301
+ let n = e(t.columnWidths, u.prevColumns, u.nextColumns);
302
+ return l(n === t.columnWidths ? t : {
220
303
  ...t,
221
304
  columnWidths: n
222
- };
305
+ }, u.prevColumns, u.nextColumns);
223
306
  }
224
- case "filter/setGlobal": return t.filters.globalText === c.value ? t : {
307
+ case "filter/setGlobal": return t.filters.globalText === u.value ? t : {
225
308
  ...t,
226
309
  filters: {
227
310
  ...t.filters,
228
- globalText: c.value
311
+ globalText: u.value
229
312
  }
230
313
  };
231
314
  case "filter/setColumn": {
232
- let e = t.filters.columnFilters[c.columnKey];
233
- return e !== void 0 && (e === c.value || r(e, c.value)) ? t : {
315
+ let e = t.filters.columnFilters[u.columnKey];
316
+ return e !== void 0 && (e === u.value || r(e, u.value)) ? t : {
234
317
  ...t,
235
318
  filters: {
236
319
  ...t.filters,
237
320
  columnFilters: {
238
321
  ...t.filters.columnFilters,
239
- [c.columnKey]: c.value
322
+ [u.columnKey]: u.value
240
323
  }
241
324
  }
242
325
  };
243
326
  }
244
327
  case "filter/clearColumn": {
245
- if (!(c.columnKey in t.filters.columnFilters)) return t;
328
+ if (!(u.columnKey in t.filters.columnFilters)) return t;
246
329
  let e = { ...t.filters.columnFilters };
247
- return delete e[c.columnKey], {
330
+ return delete e[u.columnKey], {
248
331
  ...t,
249
332
  filters: {
250
333
  ...t.filters,
@@ -261,60 +344,60 @@ var a = 60, o = (e, t, n) => Math.min(Math.max(e, t), n), s = (e, t) => {
261
344
  };
262
345
  case "filter/setAll": return {
263
346
  ...t,
264
- filters: c.filters
347
+ filters: u.filters
265
348
  };
266
- case "sort/set": return i(t.sort, c.entries) ? t : {
349
+ case "sort/set": return i(t.sort, u.entries) ? t : {
267
350
  ...t,
268
- sort: c.entries
351
+ sort: u.entries
269
352
  };
270
353
  case "sort/clear": return t.sort.length === 0 ? t : {
271
354
  ...t,
272
355
  sort: []
273
356
  };
274
- case "rowSelect/set": return n(t.rowSelection, c.state) ? t : {
357
+ case "rowSelect/set": return n(t.rowSelection, u.state) ? t : {
275
358
  ...t,
276
- rowSelection: c.state
359
+ rowSelection: u.state
277
360
  };
278
361
  case "group/toggleCollapsed": {
279
362
  let e = new Set(t.collapsedGroupKeys);
280
- return e.has(c.groupKey) ? e.delete(c.groupKey) : e.add(c.groupKey), {
363
+ return e.has(u.groupKey) ? e.delete(u.groupKey) : e.add(u.groupKey), {
281
364
  ...t,
282
365
  collapsedGroupKeys: e
283
366
  };
284
367
  }
285
368
  case "group/setCollapsed": {
286
- if (t.collapsedGroupKeys.has(c.groupKey) === c.collapsed) return t;
369
+ if (t.collapsedGroupKeys.has(u.groupKey) === u.collapsed) return t;
287
370
  let e = new Set(t.collapsedGroupKeys);
288
- return c.collapsed ? e.add(c.groupKey) : e.delete(c.groupKey), {
371
+ return u.collapsed ? e.add(u.groupKey) : e.delete(u.groupKey), {
289
372
  ...t,
290
373
  collapsedGroupKeys: e
291
374
  };
292
375
  }
293
- case "group/setCollapsedKeys": return c.keys === t.collapsedGroupKeys || c.keys.size === 0 && t.collapsedGroupKeys.size === 0 ? t : {
376
+ case "group/setCollapsedKeys": return u.keys === t.collapsedGroupKeys || u.keys.size === 0 && t.collapsedGroupKeys.size === 0 ? t : {
294
377
  ...t,
295
- collapsedGroupKeys: c.keys
378
+ collapsedGroupKeys: u.keys
296
379
  };
297
380
  case "detail/toggle": {
298
381
  let e = new Set(t.expandedDetailRowKeys);
299
- return e.has(c.rowKey) ? e.delete(c.rowKey) : e.add(c.rowKey), {
382
+ return e.has(u.rowKey) ? e.delete(u.rowKey) : e.add(u.rowKey), {
300
383
  ...t,
301
384
  expandedDetailRowKeys: e
302
385
  };
303
386
  }
304
387
  case "detail/setExpanded": {
305
- if (t.expandedDetailRowKeys.has(c.rowKey) === c.expanded) return t;
388
+ if (t.expandedDetailRowKeys.has(u.rowKey) === u.expanded) return t;
306
389
  let e = new Set(t.expandedDetailRowKeys);
307
- return c.expanded ? e.add(c.rowKey) : e.delete(c.rowKey), {
390
+ return u.expanded ? e.add(u.rowKey) : e.delete(u.rowKey), {
308
391
  ...t,
309
392
  expandedDetailRowKeys: e
310
393
  };
311
394
  }
312
- case "detail/setKeys": return c.keys === t.expandedDetailRowKeys || c.keys.size === 0 && t.expandedDetailRowKeys.size === 0 ? t : {
395
+ case "detail/setKeys": return u.keys === t.expandedDetailRowKeys || u.keys.size === 0 && t.expandedDetailRowKeys.size === 0 ? t : {
313
396
  ...t,
314
- expandedDetailRowKeys: c.keys
397
+ expandedDetailRowKeys: u.keys
315
398
  };
316
399
  default: return t;
317
400
  }
318
401
  };
319
402
  //#endregion
320
- export { c as createInitialGridUiState, l as gridUiReducer };
403
+ export { u as createInitialGridUiState, d as gridUiReducer };