@ishibashi0112/spreadsheet-grid-core 1.1.0 → 1.2.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.
Files changed (105) hide show
  1. package/dist/controllers/activeRowFollowController.cjs +1 -0
  2. package/dist/controllers/activeRowFollowController.d.ts +18 -0
  3. package/dist/controllers/activeRowFollowController.js +68 -0
  4. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  5. package/dist/controllers/autoHeightMeasurer.js +17 -17
  6. package/dist/controllers/clipboardController.cjs +1 -1
  7. package/dist/controllers/clipboardController.d.ts +1 -0
  8. package/dist/controllers/clipboardController.js +58 -49
  9. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  10. package/dist/controllers/columnAutosizeRunner.js +10 -10
  11. package/dist/controllers/contextMenuController.cjs +1 -1
  12. package/dist/controllers/contextMenuController.d.ts +1 -0
  13. package/dist/controllers/contextMenuController.js +12 -7
  14. package/dist/controllers/editController.cjs +1 -1
  15. package/dist/controllers/editController.d.ts +1 -0
  16. package/dist/controllers/editController.js +106 -99
  17. package/dist/controllers/fillHandleController.cjs +1 -1
  18. package/dist/controllers/fillHandleController.js +78 -78
  19. package/dist/controllers/filterPopoverController.cjs +1 -1
  20. package/dist/controllers/filterPopoverController.js +6 -6
  21. package/dist/controllers/findController.cjs +1 -1
  22. package/dist/controllers/findController.d.ts +1 -0
  23. package/dist/controllers/findController.js +16 -15
  24. package/dist/controllers/imeInputController.cjs +1 -1
  25. package/dist/controllers/imeInputController.js +65 -54
  26. package/dist/controllers/keyboardController.cjs +1 -1
  27. package/dist/controllers/keyboardController.js +43 -43
  28. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  29. package/dist/controllers/pointerInteractionsController.js +64 -64
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.d.ts +1 -0
  32. package/dist/controllers/rowDragController.js +117 -104
  33. package/dist/controllers/scrollSyncController.cjs +1 -1
  34. package/dist/controllers/scrollSyncController.js +45 -43
  35. package/dist/controllers/serverSideRowModel.cjs +1 -1
  36. package/dist/controllers/serverSideRowModel.js +19 -19
  37. package/dist/controllers/viewportSyncController.cjs +1 -1
  38. package/dist/controllers/viewportSyncController.d.ts +1 -0
  39. package/dist/controllers/viewportSyncController.js +1 -1
  40. package/dist/engine/columnCommands.cjs +1 -1
  41. package/dist/engine/columnCommands.js +113 -113
  42. package/dist/engine/createGridEngine.cjs +3 -3
  43. package/dist/engine/createGridEngine.d.ts +2 -0
  44. package/dist/engine/createGridEngine.js +72 -70
  45. package/dist/engine/exportCommands.cjs +1 -1
  46. package/dist/engine/exportCommands.js +4 -2
  47. package/dist/engine/fullFeatures.cjs +1 -1
  48. package/dist/engine/fullFeatures.js +6 -6
  49. package/dist/engine/gridApi.cjs +6 -6
  50. package/dist/engine/gridApi.d.ts +2 -0
  51. package/dist/engine/gridApi.js +193 -183
  52. package/dist/engine/notifiers.cjs +1 -1
  53. package/dist/engine/notifiers.d.ts +4 -0
  54. package/dist/engine/notifiers.js +7 -7
  55. package/dist/index.cjs +1 -1
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +4 -4
  58. package/dist/locales/en.cjs +1 -1
  59. package/dist/locales/en.js +2 -0
  60. package/dist/logic/exportCsv.cjs +2 -2
  61. package/dist/logic/exportCsv.d.ts +2 -1
  62. package/dist/logic/exportCsv.js +13 -13
  63. package/dist/logic/exportData.cjs +1 -1
  64. package/dist/logic/exportData.d.ts +2 -1
  65. package/dist/logic/exportData.js +18 -18
  66. package/dist/logic/geometry.cjs +1 -1
  67. package/dist/logic/geometry.d.ts +2 -0
  68. package/dist/logic/geometry.js +41 -20
  69. package/dist/logic/gridState.cjs +1 -1
  70. package/dist/logic/gridState.d.ts +3 -2
  71. package/dist/logic/gridState.js +32 -23
  72. package/dist/logic/grouping.cjs +1 -1
  73. package/dist/logic/grouping.js +1 -1
  74. package/dist/logic/imeInput.cjs +1 -1
  75. package/dist/logic/imeInput.js +6 -4
  76. package/dist/logic/localeTextFeatures.cjs +1 -1
  77. package/dist/logic/localeTextFeatures.d.ts +4 -0
  78. package/dist/logic/localeTextFeatures.js +8 -5
  79. package/dist/logic/pasteFill.cjs +1 -0
  80. package/dist/logic/pasteFill.d.ts +2 -0
  81. package/dist/logic/pasteFill.js +25 -0
  82. package/dist/logic/selectEditorState.cjs +1 -1
  83. package/dist/logic/selectEditorState.d.ts +4 -1
  84. package/dist/logic/selectEditorState.js +14 -14
  85. package/dist/logic/selectionAggregates.cjs +1 -1
  86. package/dist/logic/selectionAggregates.js +2 -3
  87. package/dist/logic/validation.cjs +1 -1
  88. package/dist/logic/validation.d.ts +1 -1
  89. package/dist/logic/validation.js +21 -21
  90. package/dist/model/gridActions.cjs +1 -1
  91. package/dist/model/gridActions.d.ts +13 -0
  92. package/dist/model/gridActions.js +11 -0
  93. package/dist/model/gridReducer.cjs +1 -1
  94. package/dist/model/gridReducer.js +128 -65
  95. package/dist/model/gridTypes.core.d.ts +172 -26
  96. package/dist/utils/gridVisibleBand.cjs +1 -0
  97. package/dist/utils/gridVisibleBand.d.ts +4 -0
  98. package/dist/utils/gridVisibleBand.js +24 -0
  99. package/dist/utils/scrollBottom.cjs +1 -0
  100. package/dist/utils/scrollBottom.d.ts +1 -0
  101. package/dist/utils/scrollBottom.js +4 -0
  102. package/dist/utils/topAlignedInput.cjs +1 -0
  103. package/dist/utils/topAlignedInput.d.ts +3 -0
  104. package/dist/utils/topAlignedInput.js +23 -0
  105. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import { createValueStore as e } from "../logic/valueStore.js";
1
+ import { gridActions as e } from "../model/gridActions.js";
2
2
  import { isViewCellEditable as t } from "../utils/permissions.js";
3
- import { gridActions as n } from "../model/gridActions.js";
3
+ import { createValueStore as n } from "../logic/valueStore.js";
4
4
  import { computeNextScrollPosition as r, hasPointerLeftActivationRadius as i, resolveAutoScrollAxisDirection as a, resolveScrollContentBox as o, resolveTopAutoScrollStart as s } from "../logic/autoScrollGeometry.js";
5
5
  import { resolveElementScale as c } from "../logic/elementScale.js";
6
6
  import { beginEscapeCancelableDrag as l } from "./escapeClaimController.js";
7
7
  import { createPopoverWindowBindings as u, isInsideGridRoot as d, restoreGridFocus as f } from "./popoverSupport.js";
8
8
  import { applyFillEditsToRows as p, buildFillEdits as m, isSameFillRange as h, previewFillValue as g, resolveFillColumnBounds as _, resolveFillDoubleClickTarget as v, resolveFillSource as y, resolveFillTarget as b, unionFillRange as x } from "../logic/fillHandle.js";
9
9
  //#region src/controllers/fillHandleController.ts
10
- var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
10
+ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && matchMedia("(pointer: coarse)").matches ? w : C, E = 8, D = { status: "idle" }, O = (e, t, n) => {
11
11
  if (e.valueFormatter) try {
12
12
  return e.valueFormatter({
13
13
  value: n,
@@ -18,33 +18,33 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
18
18
  return String(n ?? "");
19
19
  }
20
20
  return String(n ?? "");
21
- }, ee = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), te = 500, D = 6, O = 2, k = (e) => {
21
+ }, ee = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), te = 500, k = 6, A = 2, j = (e) => {
22
22
  let t = e.currentTarget;
23
23
  if (!(t instanceof Element)) return !0;
24
24
  let n = t.getBoundingClientRect();
25
- return e.clientX >= n.left - O && e.clientX <= n.right + O && e.clientY >= n.top - O && e.clientY <= n.bottom + O;
26
- }, A = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), j = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), M = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && j(e.value, t[n].value)), N = () => {
27
- let O = null, j = e(T), N = e(null), P = { current: null }, F = { current: null }, I = null, L = null, R = null, z = (e) => e ? "toggled" : "auto", B = (e) => (n, r, i, a) => t({
25
+ return e.clientX >= n.left - A && e.clientX <= n.right + A && e.clientY >= n.top - A && e.clientY <= n.bottom + A;
26
+ }, M = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), N = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), P = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && N(e.value, t[n].value)), F = () => {
27
+ let C = null, w = n(D), A = n(null), N = { current: null }, F = { current: null }, I = null, L = null, R = null, z = (e) => e ? "toggled" : "auto", B = (e) => (n, r, i, a) => t({
28
28
  readOnly: e.readOnly,
29
29
  canEditCell: e.canEditCell
30
30
  }, e.rowModel, n, r, i, a), V = () => {
31
- if (R === null || O === null) return;
32
- let e = j.getSnapshot();
31
+ if (R === null || C === null) return;
32
+ let e = w.getSnapshot();
33
33
  if (e.status === "dragging" && e.toggled === R.toggled && (e.target === R.target || e.target !== null && R.target !== null && e.target.direction === R.target.direction && h(e.target.range, R.target.range))) return;
34
34
  let t = null;
35
35
  if (R.target !== null) {
36
36
  let e = g({
37
- rowModel: O.rowModel,
38
- columns: O.columns,
37
+ rowModel: C.rowModel,
38
+ columns: C.columns,
39
39
  source: R.source,
40
40
  target: R.target,
41
41
  request: z(R.toggled),
42
- canWriteCell: B(O),
43
- getFillValue: O.getFillValue
42
+ canWriteCell: B(C),
43
+ getFillValue: C.getFillValue
44
44
  });
45
- t = e && E(e.column, e.row, e.value) || null;
45
+ t = e && O(e.column, e.row, e.value) || null;
46
46
  }
47
- j.setSnapshot({
47
+ w.setSnapshot({
48
48
  status: "dragging",
49
49
  source: R.source,
50
50
  target: R.target,
@@ -52,14 +52,14 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
52
52
  previewText: t
53
53
  });
54
54
  }, H = () => {
55
- if (R === null || O === null) return;
56
- let e = _(O.columns), t = O.hitTest(R.pointer.x, R.pointer.y);
57
- e === null || t === null || (R.target = b(R.source, t, O.rowModel.getRowCount(), e), V());
55
+ if (R === null || C === null) return;
56
+ let e = _(C.columns), t = C.hitTest(R.pointer.x, R.pointer.y);
57
+ e === null || t === null || (R.target = b(R.source, t, C.rowModel.getRowCount(), e), V());
58
58
  }, U = () => {
59
- if (R === null || O === null) return;
59
+ if (R === null || C === null) return;
60
60
  let e = R;
61
61
  e.rafId = requestAnimationFrame(U);
62
- let t = O.scrollContainerRef.current;
62
+ let t = C.scrollContainerRef.current;
63
63
  if (!t) return;
64
64
  if (!e.armed) {
65
65
  if (!i(e.origin, e.pointer, 6)) return;
@@ -73,7 +73,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
73
73
  clientWidth: t.clientWidth,
74
74
  clientHeight: t.clientHeight,
75
75
  scale: l
76
- }), d = r(t.scrollTop, a(e.pointer.y, s(u.top, (O.stickyTopHeight ?? 0) * l.y, 24), u.bottom - (O.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), f = r(t.scrollLeft, a(e.pointer.x, u.left, u.right, 24), 18, t.scrollWidth - t.clientWidth);
76
+ }), d = r(t.scrollTop, a(e.pointer.y, s(u.top, (C.stickyTopHeight ?? 0) * l.y, 24), u.bottom - (C.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), f = r(t.scrollLeft, a(e.pointer.x, u.left, u.right, 24), 18, t.scrollWidth - t.clientWidth);
77
77
  (d !== t.scrollTop || f !== t.scrollLeft) && (t.scrollTo({
78
78
  top: d,
79
79
  left: f,
@@ -82,7 +82,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
82
82
  }, W = (e, t) => {
83
83
  let n = R;
84
84
  if (n !== null) {
85
- if (R = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), N.setSnapshot(null), j.setSnapshot(T), e && n.target !== null) {
85
+ if (R = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), A.setSnapshot(null), w.setSnapshot(D), e && n.target !== null) {
86
86
  L = null, q(n.source, n.target, z(n.toggled), n.activeCell);
87
87
  return;
88
88
  }
@@ -92,26 +92,26 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
92
92
  y: n.origin.y
93
93
  } : null;
94
94
  }
95
- }, G = (e, t) => {
96
- if (O === null) return;
97
- let { dispatch: r } = O;
98
- r(n.startSelection({
99
- row: e.startRow,
100
- col: e.startCol
101
- })), r(n.updateSelection({
102
- row: e.endRow,
103
- col: e.endCol
104
- })), r(n.endSelection()), r(n.activateCell(t ?? {
105
- row: e.startRow,
106
- col: e.startCol
95
+ }, G = (t, n) => {
96
+ if (C === null) return;
97
+ let { dispatch: r } = C;
98
+ r(e.startSelection({
99
+ row: t.startRow,
100
+ col: t.startCol
101
+ })), r(e.updateSelection({
102
+ row: t.endRow,
103
+ col: t.endCol
104
+ })), r(e.endSelection()), r(e.activateCell(n ?? {
105
+ row: t.startRow,
106
+ col: t.startCol
107
107
  }));
108
108
  }, K = (e, t) => {
109
109
  let n = [];
110
110
  for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
111
111
  return n;
112
112
  }, q = (e, t, n, r) => {
113
- if (O === null || !O.enabled) return;
114
- let i = O, a = m({
113
+ if (C === null || !C.enabled) return;
114
+ let i = C, a = m({
115
115
  rowModel: i.rowModel,
116
116
  columns: i.columns,
117
117
  source: e,
@@ -145,7 +145,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
145
145
  baseRowModel: i.isServerSide ? null : i.rowModel,
146
146
  emittedRows: c,
147
147
  rowKeys: l
148
- }, G(o, r), j.setSnapshot({
148
+ }, G(o, r), w.setSnapshot({
149
149
  status: "filled",
150
150
  range: o,
151
151
  kind: a.kind,
@@ -154,38 +154,38 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
154
154
  });
155
155
  }, J = u({
156
156
  onScroll: (e) => {
157
- e.target instanceof Node && P.current?.contains(e.target) || X(!1);
157
+ e.target instanceof Node && N.current?.contains(e.target) || X(!1);
158
158
  },
159
159
  onResize: () => X(!1),
160
- isInside: (e) => P.current?.contains(e) === !0 || F.current?.contains(e) === !0,
161
- onOutsidePointerDown: (e) => X(O !== null && d(O.gridRootRef, e)),
162
- getGridRoot: () => O?.gridRootRef.current ?? null,
160
+ isInside: (e) => N.current?.contains(e) === !0 || F.current?.contains(e) === !0,
161
+ onOutsidePointerDown: (e) => X(C !== null && d(C.gridRootRef, e)),
162
+ getGridRoot: () => C?.gridRootRef.current ?? null,
163
163
  onGridHidden: () => X(!1),
164
164
  onKeyDown: (e) => {
165
165
  e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), X(!0));
166
166
  }
167
167
  }), Y = (e) => {
168
- let t = j.getSnapshot();
169
- t.status !== "filled" || t.menu === e || j.setSnapshot({
168
+ let t = w.getSnapshot();
169
+ t.status !== "filled" || t.menu === e || w.setSnapshot({
170
170
  ...t,
171
171
  menu: e
172
172
  });
173
173
  }, X = (e) => {
174
- J.detach(), Y(null), e && O !== null && f(O.gridRootRef);
174
+ J.detach(), Y(null), e && C !== null && f(C.gridRootRef);
175
175
  }, Z = () => {
176
- let e = typeof document < "u" && P.current?.contains(document.activeElement) === !0;
177
- I = null, J.detach(), j.getSnapshot().status === "filled" && j.setSnapshot(T), e && O !== null && f(O.gridRootRef);
176
+ let e = typeof document < "u" && N.current?.contains(document.activeElement) === !0;
177
+ I = null, J.detach(), w.getSnapshot().status === "filled" && w.setSnapshot(D), e && C !== null && f(C.gridRootRef);
178
178
  }, ne = (e) => {
179
- let t = j.getSnapshot();
179
+ let t = w.getSnapshot();
180
180
  if (t.status !== "filled") return;
181
181
  if (t.menu !== null) {
182
182
  X(!0);
183
183
  return;
184
184
  }
185
- let n = Math.min(e.left, window.innerWidth - S - w);
186
- n = Math.max(w, n);
187
- let r = e.bottom + 4;
188
- r + C > window.innerHeight - w && (r = Math.max(w, e.top - 4 - C)), Y({
185
+ let n = Math.min(e.left, window.innerWidth - S - E);
186
+ n = Math.max(E, n);
187
+ let r = e.bottom + 4, i = T();
188
+ r + i > window.innerHeight - E && (r = Math.max(E, e.top - 4 - i)), Y({
189
189
  top: r,
190
190
  left: n
191
191
  }), J.attach();
@@ -195,9 +195,9 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
195
195
  for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
196
196
  return !0;
197
197
  }, ie = (e) => {
198
- let n = j.getSnapshot(), r = I;
199
- if (X(!0), O === null || r === null || n.status !== "filled" || r.request === e) return;
200
- let i = O;
198
+ let n = w.getSnapshot(), r = I;
199
+ if (X(!0), C === null || r === null || n.status !== "filled" || r.request === e) return;
200
+ let i = C;
201
201
  if (i.isServerSide) {
202
202
  if (!i.applyServerSideCellEdits || !re(i.rowModel, r)) {
203
203
  Z();
@@ -212,7 +212,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
212
212
  canWriteCell: B(i),
213
213
  getFillValue: i.getFillValue
214
214
  });
215
- r.request = e, t.edits.length > 0 && !M(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, j.setSnapshot({
215
+ r.request = e, t.edits.length > 0 && !P(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, w.setSnapshot({
216
216
  ...n,
217
217
  kind: t.kind,
218
218
  menu: null
@@ -235,11 +235,11 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
235
235
  }, a, e, n, r, o),
236
236
  getFillValue: i.getFillValue
237
237
  });
238
- if (r.request = e, !M(o.edits, r.edits)) {
238
+ if (r.request = e, !P(o.edits, r.edits)) {
239
239
  let e = p(r.baseRows, a, o.edits);
240
240
  r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
241
241
  }
242
- j.setSnapshot({
242
+ w.setSnapshot({
243
243
  ...n,
244
244
  kind: o.kind,
245
245
  menu: null
@@ -256,7 +256,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
256
256
  }, ae = (e) => {
257
257
  let t = I;
258
258
  if (t !== null) {
259
- if (!e.enabled || e.editing || !ee(e.columns, t.columns) || !A(e.viewKey, t.viewKey)) {
259
+ if (!e.enabled || e.editing || !ee(e.columns, t.columns) || !M(e.viewKey, t.viewKey)) {
260
260
  Z();
261
261
  return;
262
262
  }
@@ -271,22 +271,22 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
271
271
  !t.selectionConfirmed && Q(e.selection, t.previousSource) || Z();
272
272
  }
273
273
  }, oe = (e) => {
274
- if (O === null || e.button !== 0 || (e.preventDefault(), R !== null || !O.enabled || O.editing)) return;
275
- let t = y(O.selection, O.activeCell, O.rowModel.getRowCount(), O.columns.length);
274
+ if (C === null || e.button !== 0 || (e.preventDefault(), R !== null || !C.enabled || C.editing)) return;
275
+ let t = y(C.selection, C.activeCell, C.rowModel.getRowCount(), C.columns.length);
276
276
  if (t === null) return;
277
277
  let n = L;
278
278
  L = null;
279
- let r = k(e);
280
- if (n !== null && r && e.timeStamp - n.time <= te && Math.abs(e.clientX - n.x) <= D && Math.abs(e.clientY - n.y) <= D) {
281
- O.gridRootRef.current?.focus({ preventScroll: !0 }), $();
279
+ let r = j(e);
280
+ if (n !== null && r && e.timeStamp - n.time <= te && Math.abs(e.clientX - n.x) <= k && Math.abs(e.clientY - n.y) <= k) {
281
+ C.gridRootRef.current?.focus({ preventScroll: !0 }), $();
282
282
  return;
283
283
  }
284
- Z(), O.gridRootRef.current?.focus({ preventScroll: !0 });
284
+ Z(), C.gridRootRef.current?.focus({ preventScroll: !0 });
285
285
  let i = e.pointerId, a = (e) => {
286
286
  R === null || e.pointerId !== i || (R.pointer = {
287
287
  x: e.clientX,
288
288
  y: e.clientY
289
- }, R.toggled = e.ctrlKey || e.metaKey, N.setSnapshot(R.pointer), H());
289
+ }, R.toggled = e.ctrlKey || e.metaKey, A.setSnapshot(R.pointer), H());
290
290
  }, o = (e) => {
291
291
  R === null || e.pointerId !== i || (R.toggled = e.ctrlKey || e.metaKey, W(!0, e.timeStamp));
292
292
  }, s = (e) => {
@@ -308,7 +308,7 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
308
308
  R = {
309
309
  pointerId: i,
310
310
  source: t,
311
- activeCell: O.activeCell,
311
+ activeCell: C.activeCell,
312
312
  origin: f,
313
313
  onSquare: r,
314
314
  pointer: f,
@@ -319,28 +319,28 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
319
319
  cleanup: () => {
320
320
  window.removeEventListener("pointermove", a), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c, !0), window.removeEventListener("keyup", c, !0), window.removeEventListener("blur", u), d();
321
321
  }
322
- }, N.setSnapshot(f), V(), R.rafId = requestAnimationFrame(U);
322
+ }, A.setSnapshot(f), V(), R.rafId = requestAnimationFrame(U);
323
323
  }, $ = () => {
324
- if (O === null || R !== null || !O.enabled || O.editing) return;
325
- let e = y(O.selection, O.activeCell, O.rowModel.getRowCount(), O.columns.length);
324
+ if (C === null || R !== null || !C.enabled || C.editing) return;
325
+ let e = y(C.selection, C.activeCell, C.rowModel.getRowCount(), C.columns.length);
326
326
  if (e === null) return;
327
- let t = v(e, O.rowModel, O.columns);
328
- t !== null && (Z(), q(e, t, "auto", O.activeCell));
327
+ let t = v(e, C.rowModel, C.columns);
328
+ t !== null && (Z(), q(e, t, "auto", C.activeCell));
329
329
  };
330
330
  return {
331
331
  update: (e) => {
332
- O = e, R !== null && (!e.enabled || e.editing) && W(!1), ae(e);
332
+ C = e, R !== null && (!e.enabled || e.editing) && W(!1), ae(e);
333
333
  },
334
- subscribe: j.subscribe,
335
- getSnapshot: j.getSnapshot,
336
- subscribePointer: N.subscribe,
337
- getPointerSnapshot: N.getSnapshot,
334
+ subscribe: w.subscribe,
335
+ getSnapshot: w.getSnapshot,
336
+ subscribePointer: A.subscribe,
337
+ getPointerSnapshot: A.getSnapshot,
338
338
  handlePointerDown: oe,
339
339
  handleDoubleClick: $,
340
340
  toggleMenu: ne,
341
341
  closeMenu: () => X(!0),
342
342
  chooseKind: ie,
343
- menuPanel: P,
343
+ menuPanel: N,
344
344
  chipElement: F,
345
345
  dispose: () => {
346
346
  W(!1), J.detach(), I = null;
@@ -348,4 +348,4 @@ var S = 168, C = 84, w = 8, T = { status: "idle" }, E = (e, t, n) => {
348
348
  };
349
349
  };
350
350
  //#endregion
351
- export { N as createFillHandleController };
351
+ export { F as createFillHandleController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/detailRow.cjs"),n=require("./popoverSupport.cjs"),r=require("../logic/filtering.cjs"),i=require("../logic/numberFilterCondition.cjs"),a=require("../logic/textFilterCondition.cjs"),o=require("../logic/dateFilterCondition.cjs"),s=require("../logic/filterPopoverLayout.cjs"),c=require("../logic/filterPopoverOutsideClick.cjs");var l=240,u=8,d=8,f=230,p=340,m=480,h=(e,t)=>{if(!t)return null;let n=e.find(e=>e.key===t.columnKey)??null;return!n||n.filterType===t.filterType?n:{...n,filterType:t.filterType}},g=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,_=()=>{let _=null,v=e.createValueStore({state:null,layout:null}),y={current:null},b={current:null},x={current:null},S=null,C=null,w=null,T=null,E=null,D=null,O=null,k=null,A=e=>{let t=v.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||v.setSnapshot({...t,layout:e})},j=()=>_===null?null:h(_.visibleColumns,v.getSnapshot().state),M=e=>{let n=_?.gridRootRef.current??null;if(!n)return null;let r=_?.resolveAnchorColumnKey?.(e)??e,i=n.querySelectorAll(`[data-ssg-col-key]`);return Array.from(i).find(e=>e.dataset.ssgColKey===r&&!t.isInsideDetailCardOf(n,e))??null},N=()=>{let e=v.getSnapshot().state;if(!e||!S){A(null);return}if(!S.isConnected){let t=M(e.columnKey);if(t===null)return;S=t}let t=S.getBoundingClientRect(),n=j()?.filterType,r=n===`numberSet`||n===`textSet`||n===`dateSet`?m:n===`set`?p:f,{top:i,left:a,maxHeight:o}=s.computeFilterPopoverPlacement({anchorTop:t.top,anchorBottom:t.bottom,anchorRight:t.right,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,popupWidth:l,popupHeight:C??r,offsetY:d,viewportMargin:u});A({top:i,left:a,width:l,maxHeight:o})},P=()=>{E!==null&&(cancelAnimationFrame(E),E=null),D!==null&&(cancelAnimationFrame(D),D=null)},F=()=>{w?.disconnect(),w=null,T=null},I=e=>{v.setSnapshot({state:null,layout:null}),S=null,b.current=null,x.current=null,C=null,R.detach(),F(),P(),O=null,_!==null&&e&&n.restoreGridFocus(_.gridRootRef)},L=()=>I(!0),R=n.createPopoverWindowBindings({onResize:N,onScroll:N,isInside:e=>!c.isFilterPopoverOutsideTarget(e,y.current),onOutsidePointerDown:e=>I(_!==null&&n.isInsideGridRoot(_.gridRootRef,e)),getGridRoot:()=>_?.gridRootRef.current??null,onGridHidden:()=>I(!1),onKeyDown:e=>{e.key!==`Escape`||y.current!==null||(e.preventDefault(),L())}}),z=e=>{if(_===null||!_.enableColumnFilter)return;let{gridRootRef:t,resolveColumnFilterType:s,columnFilterValues:c}=_;n.blurForPopover(t.current),S=M(e.key);let l=e.filterType===`auto`&&s?s(e):e.filterType??`text`,u=c[e.key],d=l===`number`?i.numberFilterValueToConditionDraft(r.isNumberColumnFilterValue(u)?u:void 0):l===`numberSet`?i.parsedNumberFilterToConditionDraft(r.isNumberSetColumnFilterValue(u)?u.condition:void 0):null,f=l===`textSet`?a.parsedTextFilterToConditionDraft(r.isTextSetColumnFilterValue(u)?u.condition:void 0):null,p=l===`dateSet`?o.parsedDateFilterToConditionDraft(r.isDateSetColumnFilterValue(u)?u.condition:void 0):null;v.setSnapshot({...v.getSnapshot(),state:{columnKey:e.key,filterType:l,draftValue:r.columnFilterValueToDraftText(u),numberDraft:d,textDraft:f,dateDraft:p}}),N(),R.attach()},B=e=>{let t=v.getSnapshot();t.state&&v.setSnapshot({...t,state:{...t.state,...e}})},V=()=>{let e=y.current;if(!(v.getSnapshot().layout!==null&&e!==null)||typeof ResizeObserver>`u`){F();return}T!==e&&(F(),w=new ResizeObserver(()=>{let e=y.current?.getBoundingClientRect().height??null;e===null||e===C||(C=e,N())}),w.observe(e),T=e)},H=()=>{let{state:e,layout:t}=v.getSnapshot(),n=j();if(!e||!n||!t){P(),O=null;return}if(y.current===null){P(),O=null;return}let r=k!==_?.visibleColumns,i=`${e.columnKey}|${e.filterType}|${t.top}|${t.left}|${t.width}`;if(!r&&O===i)return;O=i,k=_?.visibleColumns??null,P();let a=n.filterType??`text`;E=requestAnimationFrame(()=>{E=null,D=requestAnimationFrame(()=>{if(D=null,a===`select`){x.current?.focus();return}if(g()){y.current?.focus({preventScroll:!0});return}let e=b.current;if(e&&(e.focus(),e.type===`text`)){let t=e.value.length;e.setSelectionRange(t,t)}})})};return{update:e=>{_=e,V(),H()},subscribe:v.subscribe,getSnapshot:v.getSnapshot,panelRef:y,textInputRef:b,selectRef:x,open:z,close:L,updateDraft:e=>B({draftValue:e}),updateNumberDraft:e=>B({numberDraft:e}),updateTextDraft:e=>B({textDraft:e}),updateDateDraft:e=>B({dateDraft:e}),dispose:()=>{R.detach(),F(),P()}}};exports.createFilterPopoverController=_,exports.resolveOpenedFilterColumn=h;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("./popoverSupport.cjs"),r=require("../logic/filtering.cjs"),i=require("../logic/numberFilterCondition.cjs"),a=require("../logic/textFilterCondition.cjs"),o=require("../logic/dateFilterCondition.cjs"),s=require("../logic/filterPopoverLayout.cjs"),c=require("../logic/filterPopoverOutsideClick.cjs");var l=240,u=8,d=8,f=230,p=340,m=480,h=(e,t)=>{if(!t)return null;let n=e.find(e=>e.key===t.columnKey)??null;return!n||n.filterType===t.filterType?n:{...n,filterType:t.filterType}},g=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,_=()=>{let _=null,v=t.createValueStore({state:null,layout:null}),y={current:null},b={current:null},x={current:null},S=null,C=null,w=null,T=null,E=null,D=null,O=null,k=null,A=e=>{let t=v.getSnapshot(),n=t.layout;n===e||n!==null&&e!==null&&n.top===e.top&&n.left===e.left&&n.width===e.width&&n.maxHeight===e.maxHeight||v.setSnapshot({...t,layout:e})},j=()=>_===null?null:h(_.visibleColumns,v.getSnapshot().state),M=t=>{let n=_?.gridRootRef.current??null;if(!n)return null;let r=_?.resolveAnchorColumnKey?.(t)??t,i=n.querySelectorAll(`[data-ssg-col-key]`);return Array.from(i).find(t=>t.dataset.ssgColKey===r&&!e.isInsideDetailCardOf(n,t))??null},N=()=>{let e=v.getSnapshot().state;if(!e||!S){A(null);return}if(!S.isConnected){let t=M(e.columnKey);if(t===null)return;S=t}let t=S.getBoundingClientRect(),n=j()?.filterType,r=n===`numberSet`||n===`textSet`||n===`dateSet`?m:n===`set`?p:f,{top:i,left:a,maxHeight:o}=s.computeFilterPopoverPlacement({anchorTop:t.top,anchorBottom:t.bottom,anchorRight:t.right,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,popupWidth:l,popupHeight:C??r,offsetY:d,viewportMargin:u});A({top:i,left:a,width:l,maxHeight:o})},P=()=>{E!==null&&(cancelAnimationFrame(E),E=null),D!==null&&(cancelAnimationFrame(D),D=null)},F=()=>{w?.disconnect(),w=null,T=null},I=e=>{v.setSnapshot({state:null,layout:null}),S=null,b.current=null,x.current=null,C=null,R.detach(),F(),P(),O=null,_!==null&&e&&n.restoreGridFocus(_.gridRootRef)},L=()=>I(!0),R=n.createPopoverWindowBindings({onResize:N,onScroll:N,isInside:e=>!c.isFilterPopoverOutsideTarget(e,y.current),onOutsidePointerDown:e=>I(_!==null&&n.isInsideGridRoot(_.gridRootRef,e)),getGridRoot:()=>_?.gridRootRef.current??null,onGridHidden:()=>I(!1),onKeyDown:e=>{e.key!==`Escape`||y.current!==null||(e.preventDefault(),L())}}),z=e=>{if(_===null||!_.enableColumnFilter)return;let{gridRootRef:t,resolveColumnFilterType:s,columnFilterValues:c}=_;n.blurForPopover(t.current),S=M(e.key);let l=e.filterType===`auto`&&s?s(e):e.filterType??`text`,u=c[e.key],d=l===`number`?i.numberFilterValueToConditionDraft(r.isNumberColumnFilterValue(u)?u:void 0):l===`numberSet`?i.parsedNumberFilterToConditionDraft(r.isNumberSetColumnFilterValue(u)?u.condition:void 0):null,f=l===`textSet`?a.parsedTextFilterToConditionDraft(r.isTextSetColumnFilterValue(u)?u.condition:void 0):null,p=l===`dateSet`?o.parsedDateFilterToConditionDraft(r.isDateSetColumnFilterValue(u)?u.condition:void 0):null;v.setSnapshot({...v.getSnapshot(),state:{columnKey:e.key,filterType:l,draftValue:r.columnFilterValueToDraftText(u),numberDraft:d,textDraft:f,dateDraft:p}}),N(),R.attach()},B=e=>{let t=v.getSnapshot();t.state&&v.setSnapshot({...t,state:{...t.state,...e}})},V=()=>{let e=y.current;if(!(v.getSnapshot().layout!==null&&e!==null)||typeof ResizeObserver>`u`){F();return}T!==e&&(F(),w=new ResizeObserver(()=>{let e=y.current?.getBoundingClientRect().height??null;e===null||e===C||(C=e,N())}),w.observe(e),T=e)},H=()=>{let{state:e,layout:t}=v.getSnapshot(),n=j();if(!e||!n||!t){P(),O=null;return}if(y.current===null){P(),O=null;return}let r=k!==_?.visibleColumns,i=`${e.columnKey}|${e.filterType}|${t.top}|${t.left}|${t.width}`;if(!r&&O===i)return;O=i,k=_?.visibleColumns??null,P();let a=n.filterType??`text`;E=requestAnimationFrame(()=>{E=null,D=requestAnimationFrame(()=>{if(D=null,a===`select`){x.current?.focus();return}if(g()){y.current?.focus({preventScroll:!0});return}let e=b.current;if(e&&(e.focus(),e.type===`text`)){let t=e.value.length;e.setSelectionRange(t,t)}})})};return{update:e=>{_=e,V(),H()},subscribe:v.subscribe,getSnapshot:v.getSnapshot,panelRef:y,textInputRef:b,selectRef:x,open:z,close:L,updateDraft:e=>B({draftValue:e}),updateNumberDraft:e=>B({numberDraft:e}),updateTextDraft:e=>B({textDraft:e}),updateDateDraft:e=>B({dateDraft:e}),dispose:()=>{R.detach(),F(),P()}}};exports.createFilterPopoverController=_,exports.resolveOpenedFilterColumn=h;
@@ -1,5 +1,5 @@
1
- import { createValueStore as e } from "../logic/valueStore.js";
2
- import { isInsideDetailCardOf as t } from "../logic/detailRow.js";
1
+ import { isInsideDetailCardOf as e } from "../logic/detailRow.js";
2
+ import { createValueStore as t } from "../logic/valueStore.js";
3
3
  import { blurForPopover as n, createPopoverWindowBindings as r, isInsideGridRoot as i, restoreGridFocus as a } from "./popoverSupport.js";
4
4
  import { columnFilterValueToDraftText as o, isDateSetColumnFilterValue as s, isNumberColumnFilterValue as c, isNumberSetColumnFilterValue as l, isTextSetColumnFilterValue as u } from "../logic/filtering.js";
5
5
  import { numberFilterValueToConditionDraft as d, parsedNumberFilterToConditionDraft as f } from "../logic/numberFilterCondition.js";
@@ -16,7 +16,7 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
16
16
  filterType: t.filterType
17
17
  };
18
18
  }, w = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(pointer: coarse)").matches, T = () => {
19
- let T = null, E = e({
19
+ let T = null, E = t({
20
20
  state: null,
21
21
  layout: null
22
22
  }), D = { current: null }, O = { current: null }, k = { current: null }, A = null, j = null, M = null, N = null, P = null, F = null, I = null, L = null, R = (e) => {
@@ -25,11 +25,11 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
25
25
  ...t,
26
26
  layout: e
27
27
  });
28
- }, z = () => T === null ? null : C(T.visibleColumns, E.getSnapshot().state), B = (e) => {
28
+ }, z = () => T === null ? null : C(T.visibleColumns, E.getSnapshot().state), B = (t) => {
29
29
  let n = T?.gridRootRef.current ?? null;
30
30
  if (!n) return null;
31
- let r = T?.resolveAnchorColumnKey?.(e) ?? e, i = n.querySelectorAll("[data-ssg-col-key]");
32
- return Array.from(i).find((e) => e.dataset.ssgColKey === r && !t(n, e)) ?? null;
31
+ let r = T?.resolveAnchorColumnKey?.(t) ?? t, i = n.querySelectorAll("[data-ssg-col-key]");
32
+ return Array.from(i).find((t) => t.dataset.ssgColKey === r && !e(n, t)) ?? null;
33
33
  }, V = () => {
34
34
  let e = E.getSnapshot().state;
35
35
  if (!e || !A) {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/detailRow.cjs"),r=require("../logic/find.cjs");var i=1e4,a=5e4,o=new Map,s=[],c=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex&&e.columnKey===r.columnKey&&e.start===r.start&&e.length===r.length}),l=()=>{let i=null,l=0,u=null,d=!1,f=null,p=e.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),m=e=>{p.setSnapshot({...p.getSnapshot(),...e})},h=null,g=()=>{let e=p.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};h!==null&&h.query===t.query&&h.matchCount===t.matchCount&&h.currentIndex===t.currentIndex&&h.open===t.open||(h=t,i?.onChange?.(t))},_=()=>{let e=p.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},v=()=>{l+=1,f=null,u=null,d=!1,m({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},y=(e,o=!1)=>{let h=i,b=p.getSnapshot();if(!h||!b.open||b.query.length===0){v(),g();return}l+=1;let x=l,{rowModel:S,columns:C,caseSensitive:w}=h,T=h.conditionalFormat!==!1,E=b.query,D=f!==null&&f.query===E&&f.caseSensitive===w;f={rowModel:S,columns:C,query:E,caseSensitive:w,conditionalFormatShown:T},(o||u===null||u.columns!==C||u.query!==E||u.caseSensitive!==w||u.conditionalFormatShown!==T)&&(u={columns:C,query:E,caseSensitive:w,conditionalFormatShown:T,byRow:new WeakMap});let O=u.byRow,k=0,A=e||d;d=A;let j=b.currentIndex===null?null:b.matches[b.currentIndex]??null,M=[],N=!1,P=S.getRowCount(),F=P>a,I=(e,t)=>{let i=[];return C.forEach((a,o)=>{if(n.isSyntheticColumnKey(a.key)||!r.isFindableColumn(a,T))return;let s=r.resolveFindCellText(a,e,!T||a.conditionalFormat?.chips===void 0?void 0:{rowIndex:t,sourceRowIndex:S.getSourceIndex(t)??t,rowKey:S.getRowKey(t)??t,colIndex:o});for(let e of r.findRangesInText(s,E,w))i.push({colIndex:o,columnKey:String(a.key),start:e.start,length:e.length})}),i.length===0?s:i};!D&&!b.scanning&&m({scanning:!0}),t.runChunked(P,e=>{if(N)return;let t=S.getRow(e);if(t===void 0)return;let n;F&&typeof t==`object`&&t?(n=O.get(t),n===void 0?(n=I(t,e),O.set(t,n)):k+=1):n=I(t,e);for(let t of n){if(M.length>=1e4){N=!0;return}M.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==x}).then(e=>{if(!e||l!==x||(d=!1,o&&N===p.getSnapshot().truncated&&c(p.getSnapshot().matches,M)))return;let t=r.resolveCurrentAfterRescan(M,j);m({matches:M,index:r.buildFindIndex(M),currentIndex:t,scanning:!1,truncated:N}),g(),A&&_(),!o&&k>0&&y(!1,!0)})},b=()=>{let e=p.getSnapshot();return!i||!e.open||e.query.length===0?!1:f===null||f.rowModel!==i.rowModel||f.columns!==i.columns||f.query!==e.query||f.caseSensitive!==i.caseSensitive||f.conditionalFormatShown!==(i.conditionalFormat!==!1)};return{update:e=>{let t=i;if(i=e,!e.enabled){p.getSnapshot().open&&(m({open:!1,query:``}),v(),g());return}t!==e&&b()&&y(!1)},open:e=>{if(!i?.enabled)return;let t=p.getSnapshot(),n=e??t.query;m({open:!0,query:n}),n!==t.query||!t.open?y(!0):g()},close:()=>{p.getSnapshot().open&&(m({open:!1,query:``}),v(),g())},setQuery:e=>{let t=p.getSnapshot();!t.open||e===t.query||(m({query:e}),y(!0))},next:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);m({currentIndex:t}),g(),_()},prev:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);m({currentIndex:t}),g(),_()},subscribe:p.subscribe,getSnapshot:p.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/chunkedLoop.cjs"),r=require("../logic/find.cjs");var i=1e4,a=5e4,o=new Map,s=[],c=(e,t)=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.rowIndex===r.rowIndex&&e.colIndex===r.colIndex&&e.columnKey===r.columnKey&&e.start===r.start&&e.length===r.length}),l=()=>{let i=null,l=0,u=null,d=!1,f=null,p=t.createValueStore({open:!1,query:``,matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1}),m=e=>{p.setSnapshot({...p.getSnapshot(),...e})},h=null,g=()=>{let e=p.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open,truncated:e.truncated};h!==null&&h.query===t.query&&h.matchCount===t.matchCount&&h.currentIndex===t.currentIndex&&h.open===t.open&&h.truncated===t.truncated||(h=t,i?.onChange?.(t))},_=()=>{let e=p.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},v=()=>{l+=1,f=null,u=null,d=!1,m({matches:[],index:o,currentIndex:null,scanning:!1,truncated:!1})},y=(t,o=!1)=>{let h=i,b=p.getSnapshot();if(!h||!b.open||b.query.length===0){v(),g();return}l+=1;let x=l,{rowModel:S,columns:C,caseSensitive:w}=h,T=h.conditionalFormat!==!1,E=b.query,D=f!==null&&f.query===E&&f.caseSensitive===w;f={rowModel:S,columns:C,query:E,caseSensitive:w,conditionalFormatShown:T},(o||u===null||u.columns!==C||u.query!==E||u.caseSensitive!==w||u.conditionalFormatShown!==T)&&(u={columns:C,query:E,caseSensitive:w,conditionalFormatShown:T,byRow:new WeakMap});let O=u.byRow,k=0,A=t||d;d=A;let j=b.currentIndex===null?null:b.matches[b.currentIndex]??null,M=[],N=!1,P=S.getRowCount(),F=P>a,I=(t,n)=>{let i=[];return C.forEach((a,o)=>{if(e.isSyntheticColumnKey(a.key)||!r.isFindableColumn(a,T))return;let s=r.resolveFindCellText(a,t,!T||a.conditionalFormat?.chips===void 0?void 0:{rowIndex:n,sourceRowIndex:S.getSourceIndex(n)??n,rowKey:S.getRowKey(n)??n,colIndex:o});for(let e of r.findRangesInText(s,E,w))i.push({colIndex:o,columnKey:String(a.key),start:e.start,length:e.length})}),i.length===0?s:i};!D&&!b.scanning&&m({scanning:!0}),n.runChunked(P,e=>{if(N)return;let t=S.getRow(e);if(t===void 0)return;let n;F&&typeof t==`object`&&t?(n=O.get(t),n===void 0?(n=I(t,e),O.set(t,n)):k+=1):n=I(t,e);for(let t of n){if(M.length>=1e4){N=!0;return}M.push({rowIndex:e,colIndex:t.colIndex,columnKey:t.columnKey,start:t.start,length:t.length})}},{isCancelled:()=>l!==x}).then(e=>{if(!e||l!==x||(d=!1,o&&N===p.getSnapshot().truncated&&c(p.getSnapshot().matches,M)))return;let t=r.resolveCurrentAfterRescan(M,j);m({matches:M,index:r.buildFindIndex(M),currentIndex:t,scanning:!1,truncated:N}),g(),A&&_(),!o&&k>0&&y(!1,!0)})},b=()=>{let e=p.getSnapshot();return!i||!e.open||e.query.length===0?!1:f===null||f.rowModel!==i.rowModel||f.columns!==i.columns||f.query!==e.query||f.caseSensitive!==i.caseSensitive||f.conditionalFormatShown!==(i.conditionalFormat!==!1)};return{update:e=>{let t=i;if(i=e,!e.enabled){p.getSnapshot().open&&(m({open:!1,query:``}),v(),g());return}t!==e&&b()&&y(!1)},open:e=>{if(!i?.enabled)return;let t=p.getSnapshot(),n=e??t.query;m({open:!0,query:n}),n!==t.query||!t.open?y(!0):g()},close:()=>{p.getSnapshot().open&&(m({open:!1,query:``}),v(),g())},setQuery:e=>{let t=p.getSnapshot();!t.open||e===t.query||(m({query:e}),y(!0))},next:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);m({currentIndex:t}),g(),_()},prev:()=>{let e=p.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);m({currentIndex:t}),g(),_()},subscribe:p.subscribe,getSnapshot:p.getSnapshot,dispose:()=>{l+=1,i=null}}};exports.FIND_HIT_CACHE_ROW_THRESHOLD=a,exports.MAX_FIND_MATCHES=i,exports.createFindController=l;
@@ -5,6 +5,7 @@ export type FindChangeParams = {
5
5
  matchCount: number;
6
6
  currentIndex: number | null;
7
7
  open: boolean;
8
+ truncated: boolean;
8
9
  };
9
10
  export type FindArgs<T> = {
10
11
  enabled: boolean;
@@ -1,13 +1,13 @@
1
- import { createValueStore as e } from "../logic/valueStore.js";
2
- import { runChunked as t } from "../logic/chunkedLoop.js";
3
- import { isSyntheticColumnKey as n } from "../logic/detailRow.js";
1
+ import { isSyntheticColumnKey as e } from "../logic/detailRow.js";
2
+ import { createValueStore as t } from "../logic/valueStore.js";
3
+ import { runChunked as n } from "../logic/chunkedLoop.js";
4
4
  import { buildFindIndex as r, findRangesInText as i, isFindableColumn as a, resolveCurrentAfterRescan as o, resolveFindCellText as s, stepFindIndex as c } from "../logic/find.js";
5
5
  //#region src/controllers/findController.ts
6
6
  var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.length === t.length && e.every((e, n) => {
7
7
  let r = t[n];
8
8
  return e.rowIndex === r.rowIndex && e.colIndex === r.colIndex && e.columnKey === r.columnKey && e.start === r.start && e.length === r.length;
9
9
  }), m = () => {
10
- let l = null, m = 0, h = null, g = !1, _ = null, v = e({
10
+ let l = null, m = 0, h = null, g = !1, _ = null, v = t({
11
11
  open: !1,
12
12
  query: "",
13
13
  matches: [],
@@ -25,9 +25,10 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
25
25
  query: e.query,
26
26
  matchCount: e.matches.length,
27
27
  currentIndex: e.currentIndex,
28
- open: e.open
28
+ open: e.open,
29
+ truncated: e.truncated
29
30
  };
30
- b !== null && b.query === t.query && b.matchCount === t.matchCount && b.currentIndex === t.currentIndex && b.open === t.open || (b = t, l?.onChange?.(t));
31
+ b !== null && b.query === t.query && b.matchCount === t.matchCount && b.currentIndex === t.currentIndex && b.open === t.open && b.truncated === t.truncated || (b = t, l?.onChange?.(t));
31
32
  }, S = () => {
32
33
  let e = v.getSnapshot();
33
34
  if (e.currentIndex === null) return;
@@ -41,7 +42,7 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
41
42
  scanning: !1,
42
43
  truncated: !1
43
44
  });
44
- }, w = (e, c = !1) => {
45
+ }, w = (t, c = !1) => {
45
46
  let d = l, b = v.getSnapshot();
46
47
  if (!d || !b.open || b.query.length === 0) {
47
48
  C(), x();
@@ -62,16 +63,16 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
62
63
  conditionalFormatShown: k,
63
64
  byRow: /* @__PURE__ */ new WeakMap()
64
65
  });
65
- let M = h.byRow, N = 0, P = e || g;
66
+ let M = h.byRow, N = 0, P = t || g;
66
67
  g = P;
67
- let F = b.currentIndex === null ? null : b.matches[b.currentIndex] ?? null, I = [], L = !1, R = E.getRowCount(), z = R > u, B = (e, t) => {
68
+ let F = b.currentIndex === null ? null : b.matches[b.currentIndex] ?? null, I = [], L = !1, R = E.getRowCount(), z = R > u, B = (t, n) => {
68
69
  let r = [];
69
70
  return D.forEach((o, c) => {
70
- if (n(o.key) || !a(o, k)) return;
71
- let l = s(o, e, !k || o.conditionalFormat?.chips === void 0 ? void 0 : {
72
- rowIndex: t,
73
- sourceRowIndex: E.getSourceIndex(t) ?? t,
74
- rowKey: E.getRowKey(t) ?? t,
71
+ if (e(o.key) || !a(o, k)) return;
72
+ let l = s(o, t, !k || o.conditionalFormat?.chips === void 0 ? void 0 : {
73
+ rowIndex: n,
74
+ sourceRowIndex: E.getSourceIndex(n) ?? n,
75
+ rowKey: E.getRowKey(n) ?? n,
75
76
  colIndex: c
76
77
  });
77
78
  for (let e of i(l, A, O)) r.push({
@@ -82,7 +83,7 @@ var l = 1e4, u = 5e4, d = /* @__PURE__ */ new Map(), f = [], p = (e, t) => e.len
82
83
  });
83
84
  }), r.length === 0 ? f : r;
84
85
  };
85
- !j && !b.scanning && y({ scanning: !0 }), t(R, (e) => {
86
+ !j && !b.scanning && y({ scanning: !0 }), n(R, (e) => {
86
87
  if (L) return;
87
88
  let t = E.getRow(e);
88
89
  if (t === void 0) return;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/domGuards.cjs");var n=`ssg-ime-input--composing`,r=(t,n,r)=>{let i=t.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(e.isInsideDetailCardOf(t,n))continue;let i=n.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(i))if(e.getAttribute(`data-ssg-col-key`)===r)return e}return null},i=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,a=()=>{let e=null,a=null,o=null,s=null,c=!1,l=null,u=!1,d=!1,f=!1,p=null,m=()=>e?.gridRootRef.current??null,h=()=>{a&&a.ownerDocument.activeElement!==a&&a.focus({preventScroll:!0})},g=(t,n)=>{let i=m(),o=e?.resolveCell(t)??null;if(!a||!i||!o)return!1;let s=r(i,t,o.colKey);if(!s)return!1;let c=i.getBoundingClientRect(),l=s.getBoundingClientRect();return a.style.left=`${l.left-c.left-i.clientLeft}px`,a.style.top=`${l.top-c.top-i.clientTop}px`,a.style.width=`${l.width}px`,a.style.height=`${l.height}px`,a.style.textAlign=n&&o.align?o.align:``,!0},_=()=>{a&&(a.classList.remove(n),a.value=``,a.style.textAlign=``)},v=t=>{e===null||!e.enabled||e.editing||d||t.target===o&&h()},y=()=>{if(e===null||!e.enabled||e.editing||e.activeCell===null){l=null;return}let t=e.activeCell,r=e.canStartEdit(t);l={cell:t,allowed:r},f=!1,r&&(g(t,!0),p=t,a?.classList.add(n))},b=t=>{let n=l;l=null;let r=f;if(f=!1,!a||n===null||!n.allowed||r){_();return}let i=a.value||t.data||``;queueMicrotask(()=>{let t=a;if(e===null||!e.enabled||!t||i===``||t.ownerDocument.activeElement!==t||!e.canStartEdit(n.cell)){_();return}let r=e.resolveEditText?e.resolveEditText(n.cell,i):i;if(r===null||r===``){_();return}u=!0,e.startEdit(n.cell,r),requestAnimationFrame(()=>{u&&e!==null&&!e.editing&&(u=!1,_())})})},x=()=>{l===null&&!u&&a&&(a.value=``)},S=e=>{if(e.target!==a||e.key!==`Tab`||e.defaultPrevented||t.isImeComposingKeyEvent(e)||document.activeElement!==a)return;let n=m();if(n){d=!0;try{n.focus({preventScroll:!0})}finally{d=!1}}},C=()=>{l!==null&&(f=!0)},w=e=>{o!==e&&(o?.removeEventListener(`focus`,v),o=e,o?.addEventListener(`focus`,v))},T=e=>{typeof document>`u`||c===e||(c=e,e?(document.addEventListener(`keydown`,S),document.addEventListener(`pointerdown`,C,!0)):(document.removeEventListener(`keydown`,S),document.removeEventListener(`pointerdown`,C,!0)))},E=e=>{s!==e&&(s&&(s.removeEventListener(`compositionstart`,y),s.removeEventListener(`compositionend`,b),s.removeEventListener(`input`,x)),s=e,s&&(s.addEventListener(`compositionstart`,y),s.addEventListener(`compositionend`,b),s.addEventListener(`input`,x)))};return{update:t=>{e=t;let n=t.gridRootRef.current;if(w(t.enabled?n:null),E(t.enabled?a:null),T(t.enabled),!t.enabled){l=null,u=!1,_(),a&&n&&a.ownerDocument.activeElement===a&&n.focus({preventScroll:!0});return}u&&t.editing&&(u=!1,_()),!(l!==null||u)&&(t.activeCell!==null&&!i(p,t.activeCell)&&g(t.activeCell,!1)&&(p=t.activeCell),!t.editing&&n&&n.ownerDocument.activeElement===n&&h())},attach:t=>{a!==t&&(a=t,E(e?.enabled?a:null),a&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(a.inputMode=`none`),p=null))},dispose:()=>{E(null),w(null),T(!1),l=null,u=!1,e=null}}};exports.IME_INPUT_COMPOSING_CLASS=n,exports.createImeInputController=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs"),t=require("../logic/domGuards.cjs"),n=require("../logic/elementScale.cjs"),r=require("../utils/gridVisibleBand.cjs"),i=require("../utils/topAlignedInput.cjs");var a=24,o=`ssg-ime-input--composing`,s=(t,n,r)=>{let i=t.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(e.isInsideDetailCardOf(t,n))continue;let i=n.querySelectorAll(`.ssg-body-cell`);for(let e of Array.from(i))if(e.getAttribute(`data-ssg-col-key`)===r)return e}return null},c=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,l=()=>{let e=null,l=null,u=null,d=null,f=!1,p=null,m=!1,h=!1,g=!1,_=null,v=()=>e?.gridRootRef.current??null,y=()=>{l&&l.ownerDocument.activeElement!==l&&l.focus({preventScroll:!0})},b=(t,o)=>{let c=v(),u=e?.resolveCell(t)??null;if(!l||!c||!u)return!1;let d=s(c,t,u.colKey);if(!d)return!1;let f=c.getBoundingClientRect(),p=d.getBoundingClientRect(),m=n.resolveElementScale(c,f),h=p.top,g=p.bottom;if(o){let e=r.resolveGridVisibleBand(d);if(e!==null){let t=Math.max(h,e.top),n=Math.min(g,e.bottom);n-t>=a*m.y&&(h=t,g=n)}}let _=(g-h)/m.y;return l.style.left=`${(p.left-f.left)/m.x-c.clientLeft}px`,l.style.top=`${(h-f.top)/m.y-c.clientTop}px`,l.style.width=`${p.width/m.x}px`,l.style.height=`${_}px`,l.style.textAlign=o&&u.align?u.align:``,i.alignInputTextToTop(l,o&&d.classList.contains(`ssg-body-cell--valign-top`),_),!0},x=()=>{l&&(l.classList.remove(o),l.value=``,l.style.textAlign=``,i.alignInputTextToTop(l,!1,0))},S=t=>{e===null||!e.enabled||e.editing||h||t.target===u&&y()},C=()=>{if(e===null||!e.enabled||e.editing||e.activeCell===null){p=null;return}let t=e.activeCell,n=e.canStartEdit(t);p={cell:t,allowed:n},g=!1,n&&(l?.classList.add(o),b(t,!0),_=t)},w=t=>{let n=p;p=null;let r=g;if(g=!1,!l||n===null||!n.allowed||r){x();return}let i=l.value||t.data||``;queueMicrotask(()=>{let t=l;if(e===null||!e.enabled||!t||i===``||t.ownerDocument.activeElement!==t||!e.canStartEdit(n.cell)){x();return}let r=e.resolveEditText?e.resolveEditText(n.cell,i):i;if(r===null||r===``){x();return}m=!0,e.startEdit(n.cell,r),requestAnimationFrame(()=>{m&&e!==null&&!e.editing&&(m=!1,x())})})},T=()=>{p===null&&!m&&l&&(l.value=``)},E=e=>{if(e.target!==l||e.key!==`Tab`||e.defaultPrevented||t.isImeComposingKeyEvent(e)||document.activeElement!==l)return;let n=v();if(n){h=!0;try{n.focus({preventScroll:!0})}finally{h=!1}}},D=()=>{p!==null&&(g=!0)},O=e=>{u!==e&&(u?.removeEventListener(`focus`,S),u=e,u?.addEventListener(`focus`,S))},k=e=>{typeof document>`u`||f===e||(f=e,e?(document.addEventListener(`keydown`,E),document.addEventListener(`pointerdown`,D,!0)):(document.removeEventListener(`keydown`,E),document.removeEventListener(`pointerdown`,D,!0)))},A=e=>{d!==e&&(d&&(d.removeEventListener(`compositionstart`,C),d.removeEventListener(`compositionend`,w),d.removeEventListener(`input`,T)),d=e,d&&(d.addEventListener(`compositionstart`,C),d.addEventListener(`compositionend`,w),d.addEventListener(`input`,T)))};return{update:t=>{e=t;let n=t.gridRootRef.current;if(O(t.enabled?n:null),A(t.enabled?l:null),k(t.enabled),!t.enabled){p=null,m=!1,x(),l&&n&&l.ownerDocument.activeElement===l&&n.focus({preventScroll:!0});return}m&&t.editing&&(m=!1,x()),!(p!==null||m)&&(t.activeCell!==null&&!c(_,t.activeCell)&&b(t.activeCell,!1)&&(_=t.activeCell),!t.editing&&n&&n.ownerDocument.activeElement===n&&y())},attach:t=>{l!==t&&(l=t,A(e?.enabled?l:null),l&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(l.inputMode=`none`),_=null))},dispose:()=>{A(null),O(null),k(!1),p=null,m=!1,e=null}}};exports.IME_INPUT_COMPOSING_CLASS=o,exports.createImeInputController=l;