@ishibashi0112/spreadsheet-grid-core 1.0.0 → 1.0.1

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 (98) hide show
  1. package/dist/controllers/clipboardController.cjs +2 -2
  2. package/dist/controllers/clipboardController.d.ts +2 -1
  3. package/dist/controllers/clipboardController.js +78 -62
  4. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  5. package/dist/controllers/columnAutosizeRunner.d.ts +2 -0
  6. package/dist/controllers/columnAutosizeRunner.js +49 -23
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.d.ts +4 -0
  9. package/dist/controllers/columnHeaderDragController.js +140 -124
  10. package/dist/controllers/dateRolloverStore.cjs +1 -1
  11. package/dist/controllers/dateRolloverStore.js +1 -1
  12. package/dist/controllers/editController.cjs +1 -1
  13. package/dist/controllers/editController.js +71 -55
  14. package/dist/controllers/escapeClaimController.cjs +1 -0
  15. package/dist/controllers/escapeClaimController.d.ts +18 -0
  16. package/dist/controllers/escapeClaimController.js +30 -0
  17. package/dist/controllers/fillHandleController.cjs +1 -1
  18. package/dist/controllers/fillHandleController.js +129 -127
  19. package/dist/controllers/findController.cjs +1 -1
  20. package/dist/controllers/findController.d.ts +1 -0
  21. package/dist/controllers/findController.js +96 -75
  22. package/dist/controllers/globalFilteredOrder.cjs +1 -1
  23. package/dist/controllers/globalFilteredOrder.js +52 -21
  24. package/dist/controllers/keyboardController.cjs +1 -1
  25. package/dist/controllers/keyboardController.js +98 -97
  26. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  27. package/dist/controllers/pointerInteractionsController.js +159 -144
  28. package/dist/controllers/popoverSupport.cjs +1 -1
  29. package/dist/controllers/popoverSupport.js +4 -1
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.d.ts +1 -0
  32. package/dist/controllers/rowDragController.js +122 -120
  33. package/dist/controllers/scrollSyncController.cjs +1 -1
  34. package/dist/controllers/scrollSyncController.d.ts +1 -1
  35. package/dist/controllers/scrollSyncController.js +7 -4
  36. package/dist/controllers/selectOptionsCollector.cjs +1 -1
  37. package/dist/controllers/selectOptionsCollector.d.ts +5 -2
  38. package/dist/controllers/selectOptionsCollector.js +39 -27
  39. package/dist/controllers/toolPanelController.cjs +1 -1
  40. package/dist/controllers/toolPanelController.d.ts +6 -0
  41. package/dist/controllers/toolPanelController.js +69 -59
  42. package/dist/controllers/tooltipController.cjs +1 -1
  43. package/dist/controllers/tooltipController.d.ts +2 -0
  44. package/dist/controllers/tooltipController.js +68 -38
  45. package/dist/controllers/viewportSyncController.cjs +1 -1
  46. package/dist/controllers/viewportSyncController.d.ts +4 -0
  47. package/dist/controllers/viewportSyncController.js +18 -8
  48. package/dist/engine/columnCommands.cjs +1 -1
  49. package/dist/engine/columnCommands.js +2 -1
  50. package/dist/engine/columnLayout.cjs +1 -1
  51. package/dist/engine/columnLayout.d.ts +2 -0
  52. package/dist/engine/columnLayout.js +51 -18
  53. package/dist/engine/gridApi.cjs +2 -2
  54. package/dist/engine/gridApi.d.ts +1 -1
  55. package/dist/engine/gridApi.js +8 -8
  56. package/dist/engine/rowPipeline.cjs +1 -1
  57. package/dist/engine/rowPipeline.js +46 -46
  58. package/dist/engine/rowSelectionCommands.cjs +1 -1
  59. package/dist/engine/rowSelectionCommands.d.ts +8 -1
  60. package/dist/engine/rowSelectionCommands.js +36 -25
  61. package/dist/locales/en.cjs +1 -1
  62. package/dist/locales/en.js +1 -1
  63. package/dist/logic/autoScrollGeometry.cjs +1 -1
  64. package/dist/logic/autoScrollGeometry.d.ts +5 -1
  65. package/dist/logic/autoScrollGeometry.js +6 -6
  66. package/dist/logic/clearCells.cjs +1 -1
  67. package/dist/logic/clearCells.js +13 -13
  68. package/dist/logic/columnReset.cjs +1 -1
  69. package/dist/logic/columnReset.d.ts +1 -0
  70. package/dist/logic/columnReset.js +21 -19
  71. package/dist/logic/editorValues.cjs +1 -1
  72. package/dist/logic/editorValues.js +41 -15
  73. package/dist/logic/elementScale.cjs +1 -0
  74. package/dist/logic/elementScale.d.ts +8 -0
  75. package/dist/logic/elementScale.js +14 -0
  76. package/dist/logic/filtering.cjs +1 -1
  77. package/dist/logic/filtering.js +14 -11
  78. package/dist/logic/focusCycle.cjs +1 -0
  79. package/dist/logic/focusCycle.d.ts +1 -0
  80. package/dist/logic/focusCycle.js +15 -0
  81. package/dist/logic/labelRows.cjs +1 -1
  82. package/dist/logic/labelRows.d.ts +2 -0
  83. package/dist/logic/labelRows.js +8 -4
  84. package/dist/logic/localeText.cjs +1 -1
  85. package/dist/logic/localeText.js +1 -1
  86. package/dist/logic/rowSelection.cjs +1 -1
  87. package/dist/logic/rowSelection.d.ts +4 -0
  88. package/dist/logic/rowSelection.js +31 -8
  89. package/dist/logic/selectOptions.cjs +1 -1
  90. package/dist/logic/selectOptions.d.ts +2 -2
  91. package/dist/logic/selectOptions.js +16 -12
  92. package/dist/logic/selectionOverlayGeometry.cjs +1 -1
  93. package/dist/logic/selectionOverlayGeometry.js +12 -12
  94. package/dist/logic/sorting.cjs +1 -1
  95. package/dist/logic/sorting.d.ts +1 -0
  96. package/dist/logic/sorting.js +24 -12
  97. package/dist/model/gridTypes.core.d.ts +47 -21
  98. package/package.json +1 -1
@@ -2,10 +2,11 @@ import { createValueStore as e } from "../logic/valueStore.js";
2
2
  import { isViewCellEditable as t } from "../utils/permissions.js";
3
3
  import { gridActions as n } from "../model/gridActions.js";
4
4
  import { computeNextScrollPosition as r, hasPointerLeftActivationRadius as i, resolveAutoScrollAxisDirection as a, resolveScrollContentBox as o } from "../logic/autoScrollGeometry.js";
5
- import { createPopoverWindowBindings as s, isInsideGridRoot as c, restoreGridFocus as l } from "./popoverSupport.js";
6
- import { applyFillEditsToRows as u, buildFillEdits as d, isSameFillRange as f, previewFillValue as p, resolveFillColumnBounds as m, resolveFillDoubleClickTarget as h, resolveFillSource as g, resolveFillTarget as _, unionFillRange as v } from "../logic/fillHandle.js";
5
+ import { resolveElementScale as s } from "../logic/elementScale.js";
6
+ import { createPopoverWindowBindings as c, isInsideGridRoot as l, restoreGridFocus as u } from "./popoverSupport.js";
7
+ import { applyFillEditsToRows as d, buildFillEdits as f, isSameFillRange as p, previewFillValue as m, resolveFillColumnBounds as h, resolveFillDoubleClickTarget as g, resolveFillSource as _, resolveFillTarget as v, unionFillRange as y } from "../logic/fillHandle.js";
7
8
  //#region src/controllers/fillHandleController.ts
8
- var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
9
+ var b = 168, x = 84, S = 8, C = { status: "idle" }, w = (e, t, n) => {
9
10
  if (e.valueFormatter) try {
10
11
  return e.valueFormatter({
11
12
  value: n,
@@ -16,80 +17,81 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
16
17
  return String(n ?? "");
17
18
  }
18
19
  return String(n ?? "");
19
- }, w = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), T = 500, E = 6, D = 2, O = (e) => {
20
+ }, ee = (e, t) => e === t || e.length === t.length && e.every((e, n) => e.key === t[n].key), T = 500, E = 6, D = 2, te = (e) => {
20
21
  let t = e.currentTarget;
21
22
  if (!(t instanceof Element)) return !0;
22
23
  let n = t.getBoundingClientRect();
23
24
  return e.clientX >= n.left - D && e.clientX <= n.right + D && e.clientY >= n.top - D && e.clientY <= n.bottom + D;
24
- }, k = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), A = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), j = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && A(e.value, t[n].value)), M = () => {
25
- let D = null, A = e(S), M = e(null), N = { current: null }, P = { current: null }, F = null, I = null, L = null, R = (e) => e ? "toggled" : "auto", z = (e) => (n, r, i, a) => t({
25
+ }, O = (e, t) => e === t || e !== void 0 && t !== void 0 && e.length === t.length && e.every((e, n) => Object.is(e, t[n])), k = (e, t) => Object.is(e, t) || e instanceof Date && t instanceof Date && e.getTime() === t.getTime(), A = (e, t) => e.length === t.length && e.every((e, n) => e.viewIndex === t[n].viewIndex && e.column.key === t[n].column.key && k(e.value, t[n].value)), j = () => {
26
+ let D = null, k = e(C), j = e(null), M = { current: null }, N = { current: null }, P = null, F = null, I = null, L = (e) => e ? "toggled" : "auto", R = (e) => (n, r, i, a) => t({
26
27
  readOnly: e.readOnly,
27
28
  canEditCell: e.canEditCell
28
- }, e.rowModel, n, r, i, a), B = () => {
29
- if (L === null || D === null) return;
30
- let e = A.getSnapshot();
31
- if (e.status === "dragging" && e.toggled === L.toggled && (e.target === L.target || e.target !== null && L.target !== null && e.target.direction === L.target.direction && f(e.target.range, L.target.range))) return;
29
+ }, e.rowModel, n, r, i, a), z = () => {
30
+ if (I === null || D === null) return;
31
+ let e = k.getSnapshot();
32
+ if (e.status === "dragging" && e.toggled === I.toggled && (e.target === I.target || e.target !== null && I.target !== null && e.target.direction === I.target.direction && p(e.target.range, I.target.range))) return;
32
33
  let t = null;
33
- if (L.target !== null) {
34
- let e = p({
34
+ if (I.target !== null) {
35
+ let e = m({
35
36
  rowModel: D.rowModel,
36
37
  columns: D.columns,
37
- source: L.source,
38
- target: L.target,
39
- request: R(L.toggled),
40
- canWriteCell: z(D),
38
+ source: I.source,
39
+ target: I.target,
40
+ request: L(I.toggled),
41
+ canWriteCell: R(D),
41
42
  getFillValue: D.getFillValue
42
43
  });
43
- t = e && C(e.column, e.row, e.value) || null;
44
+ t = e && w(e.column, e.row, e.value) || null;
44
45
  }
45
- A.setSnapshot({
46
+ k.setSnapshot({
46
47
  status: "dragging",
47
- source: L.source,
48
- target: L.target,
49
- toggled: L.toggled,
48
+ source: I.source,
49
+ target: I.target,
50
+ toggled: I.toggled,
50
51
  previewText: t
51
52
  });
53
+ }, B = () => {
54
+ if (I === null || D === null) return;
55
+ let e = h(D.columns), t = D.hitTest(I.pointer.x, I.pointer.y);
56
+ e === null || t === null || (I.target = v(I.source, t, D.rowModel.getRowCount(), e), z());
52
57
  }, V = () => {
53
- if (L === null || D === null) return;
54
- let e = m(D.columns), t = D.hitTest(L.pointer.x, L.pointer.y);
55
- e === null || t === null || (L.target = _(L.source, t, D.rowModel.getRowCount(), e), B());
56
- }, H = () => {
57
- if (L === null || D === null) return;
58
- let e = L;
59
- e.rafId = requestAnimationFrame(H);
58
+ if (I === null || D === null) return;
59
+ let e = I;
60
+ e.rafId = requestAnimationFrame(V);
60
61
  let t = D.scrollContainerRef.current;
61
62
  if (!t) return;
62
63
  if (!e.armed) {
63
64
  if (!i(e.origin, e.pointer, 6)) return;
64
65
  e.armed = !0;
65
66
  }
66
- let n = t.getBoundingClientRect(), s = o({
67
+ let n = t.getBoundingClientRect(), c = o({
67
68
  rectLeft: n.left,
68
69
  rectTop: n.top,
69
70
  clientLeft: t.clientLeft,
70
71
  clientTop: t.clientTop,
71
72
  clientWidth: t.clientWidth,
72
- clientHeight: t.clientHeight
73
- }), c = r(t.scrollTop, a(e.pointer.y, s.top, s.bottom - (D.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), l = r(t.scrollLeft, a(e.pointer.x, s.left, s.right, 24), 18, t.scrollWidth - t.clientWidth);
74
- (c !== t.scrollTop || l !== t.scrollLeft) && (t.scrollTo({
75
- top: c,
76
- left: l,
73
+ clientHeight: t.clientHeight,
74
+ scale: s(t, n)
75
+ }), l = r(t.scrollTop, a(e.pointer.y, c.top, c.bottom - (D.footerHeight ?? 0), 24), 18, t.scrollHeight - t.clientHeight), u = r(t.scrollLeft, a(e.pointer.x, c.left, c.right, 24), 18, t.scrollWidth - t.clientWidth);
76
+ (l !== t.scrollTop || u !== t.scrollLeft) && (t.scrollTo({
77
+ top: l,
78
+ left: u,
77
79
  behavior: "auto"
78
- }), V());
79
- }, U = (e, t) => {
80
- let n = L;
80
+ }), B());
81
+ }, H = (e, t) => {
82
+ let n = I;
81
83
  if (n !== null) {
82
- if (L = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), M.setSnapshot(null), A.setSnapshot(S), e && n.target !== null) {
83
- I = null, K(n.source, n.target, R(n.toggled), n.activeCell);
84
+ if (I = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), j.setSnapshot(null), k.setSnapshot(C), e && n.target !== null) {
85
+ F = null, G(n.source, n.target, L(n.toggled), n.activeCell);
84
86
  return;
85
87
  }
86
- I = e && t !== void 0 && n.onSquare ? {
88
+ F = e && t !== void 0 && n.onSquare ? {
87
89
  time: t,
88
90
  x: n.origin.x,
89
91
  y: n.origin.y
90
92
  } : null;
91
93
  }
92
- }, W = (e, t) => {
94
+ }, U = (e, t) => {
93
95
  if (D === null) return;
94
96
  let { dispatch: r } = D;
95
97
  r(n.startSelection({
@@ -102,33 +104,33 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
102
104
  row: e.startRow,
103
105
  col: e.startCol
104
106
  }));
105
- }, G = (e, t) => {
107
+ }, W = (e, t) => {
106
108
  let n = [];
107
109
  for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
108
110
  return n;
109
- }, K = (e, t, n, r) => {
111
+ }, G = (e, t, n, r) => {
110
112
  if (D === null || !D.enabled) return;
111
- let i = D, a = d({
113
+ let i = D, a = f({
112
114
  rowModel: i.rowModel,
113
115
  columns: i.columns,
114
116
  source: e,
115
117
  target: t,
116
118
  request: n,
117
- canWriteCell: z(i),
119
+ canWriteCell: R(i),
118
120
  getFillValue: i.getFillValue
119
121
  });
120
122
  if (a.edits.length === 0) return;
121
- let o = v(e, t), s = null, c = [], l = null;
123
+ let o = y(e, t), s = null, c = [], l = null;
122
124
  if (i.isServerSide) {
123
125
  if (!i.applyServerSideCellEdits) return;
124
- l = G(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
126
+ l = W(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
125
127
  } else {
126
128
  if (!i.applyRowsChange) return;
127
- let e = u(i.rows, i.rowModel, a.edits);
129
+ let e = d(i.rows, i.rowModel, a.edits);
128
130
  if (e === i.rows) return;
129
131
  s = i.rows, c.push(e), i.applyRowsChange(e);
130
132
  }
131
- F = {
133
+ P = {
132
134
  source: e,
133
135
  target: t,
134
136
  range: o,
@@ -142,74 +144,74 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
142
144
  baseRowModel: i.isServerSide ? null : i.rowModel,
143
145
  emittedRows: c,
144
146
  rowKeys: l
145
- }, W(o, r), A.setSnapshot({
147
+ }, U(o, r), k.setSnapshot({
146
148
  status: "filled",
147
149
  range: o,
148
150
  kind: a.kind,
149
151
  seriesAvailable: a.seriesAvailable,
150
152
  menu: null
151
153
  });
152
- }, q = s({
154
+ }, K = c({
153
155
  onScroll: (e) => {
154
- e.target instanceof Node && N.current?.contains(e.target) || Y(!1);
156
+ e.target instanceof Node && M.current?.contains(e.target) || J(!1);
155
157
  },
156
- onResize: () => Y(!1),
157
- isInside: (e) => N.current?.contains(e) === !0 || P.current?.contains(e) === !0,
158
- onOutsidePointerDown: (e) => Y(D !== null && c(D.gridRootRef, e)),
158
+ onResize: () => J(!1),
159
+ isInside: (e) => M.current?.contains(e) === !0 || N.current?.contains(e) === !0,
160
+ onOutsidePointerDown: (e) => J(D !== null && l(D.gridRootRef, e)),
159
161
  getGridRoot: () => D?.gridRootRef.current ?? null,
160
- onGridHidden: () => Y(!1),
162
+ onGridHidden: () => J(!1),
161
163
  onKeyDown: (e) => {
162
- e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), Y(!0));
164
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), J(!0));
163
165
  }
164
- }), J = (e) => {
165
- let t = A.getSnapshot();
166
- t.status !== "filled" || t.menu === e || A.setSnapshot({
166
+ }), q = (e) => {
167
+ let t = k.getSnapshot();
168
+ t.status !== "filled" || t.menu === e || k.setSnapshot({
167
169
  ...t,
168
170
  menu: e
169
171
  });
170
- }, Y = (e) => {
171
- q.detach(), J(null), e && D !== null && l(D.gridRootRef);
172
- }, X = () => {
173
- let e = typeof document < "u" && N.current?.contains(document.activeElement) === !0;
174
- F = null, q.detach(), A.getSnapshot().status === "filled" && A.setSnapshot(S), e && D !== null && l(D.gridRootRef);
175
- }, Z = (e) => {
176
- let t = A.getSnapshot();
172
+ }, J = (e) => {
173
+ K.detach(), q(null), e && D !== null && u(D.gridRootRef);
174
+ }, Y = () => {
175
+ let e = typeof document < "u" && M.current?.contains(document.activeElement) === !0;
176
+ P = null, K.detach(), k.getSnapshot().status === "filled" && k.setSnapshot(C), e && D !== null && u(D.gridRootRef);
177
+ }, X = (e) => {
178
+ let t = k.getSnapshot();
177
179
  if (t.status !== "filled") return;
178
180
  if (t.menu !== null) {
179
- Y(!0);
181
+ J(!0);
180
182
  return;
181
183
  }
182
- let n = Math.min(e.left, window.innerWidth - y - x);
183
- n = Math.max(x, n);
184
+ let n = Math.min(e.left, window.innerWidth - b - S);
185
+ n = Math.max(S, n);
184
186
  let r = e.bottom + 4;
185
- r + b > window.innerHeight - x && (r = Math.max(x, e.top - 4 - b)), J({
187
+ r + x > window.innerHeight - S && (r = Math.max(S, e.top - 4 - x)), q({
186
188
  top: r,
187
189
  left: n
188
- }), q.attach();
189
- }, ee = (e, t) => {
190
+ }), K.attach();
191
+ }, Z = (e, t) => {
190
192
  let n = t.rowKeys;
191
193
  if (n === null) return !1;
192
194
  for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
193
195
  return !0;
194
- }, te = (e) => {
195
- let n = A.getSnapshot(), r = F;
196
- if (Y(!0), D === null || r === null || n.status !== "filled" || r.request === e) return;
196
+ }, ne = (e) => {
197
+ let n = k.getSnapshot(), r = P;
198
+ if (J(!0), D === null || r === null || n.status !== "filled" || r.request === e) return;
197
199
  let i = D;
198
200
  if (i.isServerSide) {
199
- if (!i.applyServerSideCellEdits || !ee(i.rowModel, r)) {
200
- X();
201
+ if (!i.applyServerSideCellEdits || !Z(i.rowModel, r)) {
202
+ Y();
201
203
  return;
202
204
  }
203
- let t = d({
205
+ let t = f({
204
206
  rowModel: i.rowModel,
205
207
  columns: r.columns,
206
208
  source: r.source,
207
209
  target: r.target,
208
210
  request: e,
209
- canWriteCell: z(i),
211
+ canWriteCell: R(i),
210
212
  getFillValue: i.getFillValue
211
213
  });
212
- r.request = e, t.edits.length > 0 && !j(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, A.setSnapshot({
214
+ r.request = e, t.edits.length > 0 && !A(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, k.setSnapshot({
213
215
  ...n,
214
216
  kind: t.kind,
215
217
  menu: null
@@ -217,10 +219,10 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
217
219
  return;
218
220
  }
219
221
  if (!i.amendRowsChange || r.baseRows === null || r.baseRowModel === null) {
220
- X();
222
+ Y();
221
223
  return;
222
224
  }
223
- let a = r.baseRowModel, o = d({
225
+ let a = r.baseRowModel, o = f({
224
226
  rowModel: a,
225
227
  columns: r.columns,
226
228
  source: r.source,
@@ -232,11 +234,11 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
232
234
  }, a, e, n, r, o),
233
235
  getFillValue: i.getFillValue
234
236
  });
235
- if (r.request = e, !j(o.edits, r.edits)) {
236
- let e = u(r.baseRows, a, o.edits);
237
+ if (r.request = e, !A(o.edits, r.edits)) {
238
+ let e = d(r.baseRows, a, o.edits);
237
239
  r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
238
240
  }
239
- A.setSnapshot({
241
+ k.setSnapshot({
240
242
  ...n,
241
243
  kind: o.kind,
242
244
  menu: null
@@ -244,65 +246,65 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
244
246
  }, Q = (e, t) => {
245
247
  if (e?.type !== "cell") return !1;
246
248
  let { start: n, end: r } = e.range;
247
- return f(t, {
249
+ return p(t, {
248
250
  startRow: Math.min(n.row, r.row),
249
251
  endRow: Math.max(n.row, r.row),
250
252
  startCol: Math.min(n.col, r.col),
251
253
  endCol: Math.max(n.col, r.col)
252
254
  });
253
- }, ne = (e) => {
254
- let t = F;
255
+ }, re = (e) => {
256
+ let t = P;
255
257
  if (t !== null) {
256
- if (!e.enabled || e.editing || !w(e.columns, t.columns) || !k(e.viewKey, t.viewKey)) {
257
- X();
258
+ if (!e.enabled || e.editing || !ee(e.columns, t.columns) || !O(e.viewKey, t.viewKey)) {
259
+ Y();
258
260
  return;
259
261
  }
260
262
  if (!e.isServerSide && e.rows !== t.baseRows && !t.emittedRows.includes(e.rows)) {
261
- X();
263
+ Y();
262
264
  return;
263
265
  }
264
266
  if (Q(e.selection, t.range)) {
265
267
  t.selectionConfirmed = !0;
266
268
  return;
267
269
  }
268
- !t.selectionConfirmed && Q(e.selection, t.previousSource) || X();
270
+ !t.selectionConfirmed && Q(e.selection, t.previousSource) || Y();
269
271
  }
270
- }, re = (e) => {
271
- if (D === null || e.button !== 0 || (e.preventDefault(), L !== null || !D.enabled || D.editing)) return;
272
- let t = g(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
272
+ }, ie = (e) => {
273
+ if (D === null || e.button !== 0 || (e.preventDefault(), I !== null || !D.enabled || D.editing)) return;
274
+ let t = _(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
273
275
  if (t === null) return;
274
- let n = I;
275
- I = null;
276
- let r = O(e);
276
+ let n = F;
277
+ F = null;
278
+ let r = te(e);
277
279
  if (n !== null && r && e.timeStamp - n.time <= T && Math.abs(e.clientX - n.x) <= E && Math.abs(e.clientY - n.y) <= E) {
278
280
  D.gridRootRef.current?.focus({ preventScroll: !0 }), $();
279
281
  return;
280
282
  }
281
- X(), D.gridRootRef.current?.focus({ preventScroll: !0 });
283
+ Y(), D.gridRootRef.current?.focus({ preventScroll: !0 });
282
284
  let i = e.pointerId, a = (e) => {
283
- L === null || e.pointerId !== i || (L.pointer = {
285
+ I === null || e.pointerId !== i || (I.pointer = {
284
286
  x: e.clientX,
285
287
  y: e.clientY
286
- }, L.toggled = e.ctrlKey || e.metaKey, M.setSnapshot(L.pointer), V());
288
+ }, I.toggled = e.ctrlKey || e.metaKey, j.setSnapshot(I.pointer), B());
287
289
  }, o = (e) => {
288
- L === null || e.pointerId !== i || (L.toggled = e.ctrlKey || e.metaKey, U(!0, e.timeStamp));
290
+ I === null || e.pointerId !== i || (I.toggled = e.ctrlKey || e.metaKey, H(!0, e.timeStamp));
289
291
  }, s = (e) => {
290
- e.pointerId === i && U(!1);
292
+ e.pointerId === i && H(!1);
291
293
  }, c = (e) => {
292
- if (L === null) return;
294
+ if (I === null) return;
293
295
  if (e.preventDefault(), e.stopPropagation(), e.type === "keydown" && e.key === "Escape") {
294
- U(!1);
296
+ H(!1);
295
297
  return;
296
298
  }
297
299
  let t = e.ctrlKey || e.metaKey;
298
- t !== L.toggled && (L.toggled = t, B());
299
- }, l = () => U(!1);
300
+ t !== I.toggled && (I.toggled = t, z());
301
+ }, l = () => H(!1);
300
302
  window.addEventListener("pointermove", a), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c, !0), window.addEventListener("keyup", c, !0), window.addEventListener("blur", l);
301
303
  let u = {
302
304
  x: e.clientX,
303
305
  y: e.clientY
304
306
  };
305
- L = {
307
+ I = {
306
308
  pointerId: i,
307
309
  source: t,
308
310
  activeCell: D.activeCell,
@@ -316,33 +318,33 @@ var y = 168, b = 84, x = 8, S = { status: "idle" }, C = (e, t, n) => {
316
318
  cleanup: () => {
317
319
  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", l);
318
320
  }
319
- }, M.setSnapshot(u), B(), L.rafId = requestAnimationFrame(H);
321
+ }, j.setSnapshot(u), z(), I.rafId = requestAnimationFrame(V);
320
322
  }, $ = () => {
321
- if (D === null || L !== null || !D.enabled || D.editing) return;
322
- let e = g(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
323
+ if (D === null || I !== null || !D.enabled || D.editing) return;
324
+ let e = _(D.selection, D.activeCell, D.rowModel.getRowCount(), D.columns.length);
323
325
  if (e === null) return;
324
- let t = h(e, D.rowModel, D.columns);
325
- t !== null && (X(), K(e, t, "auto", D.activeCell));
326
+ let t = g(e, D.rowModel, D.columns);
327
+ t !== null && (Y(), G(e, t, "auto", D.activeCell));
326
328
  };
327
329
  return {
328
330
  update: (e) => {
329
- D = e, L !== null && (!e.enabled || e.editing) && U(!1), ne(e);
331
+ D = e, I !== null && (!e.enabled || e.editing) && H(!1), re(e);
330
332
  },
331
- subscribe: A.subscribe,
332
- getSnapshot: A.getSnapshot,
333
- subscribePointer: M.subscribe,
334
- getPointerSnapshot: M.getSnapshot,
335
- handlePointerDown: re,
333
+ subscribe: k.subscribe,
334
+ getSnapshot: k.getSnapshot,
335
+ subscribePointer: j.subscribe,
336
+ getPointerSnapshot: j.getSnapshot,
337
+ handlePointerDown: ie,
336
338
  handleDoubleClick: $,
337
- toggleMenu: Z,
338
- closeMenu: () => Y(!0),
339
- chooseKind: te,
340
- menuPanel: N,
341
- chipElement: P,
339
+ toggleMenu: X,
340
+ closeMenu: () => J(!0),
341
+ chooseKind: ne,
342
+ menuPanel: M,
343
+ chipElement: N,
342
344
  dispose: () => {
343
- U(!1), q.detach(), F = null;
345
+ H(!1), K.detach(), P = null;
344
346
  }
345
347
  };
346
348
  };
347
349
  //#endregion
348
- export { M as createFillHandleController };
350
+ export { j as createFillHandleController };
@@ -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=new Map,o=()=>{let i=null,o=0,s=null,c=e.createValueStore({open:!1,query:``,matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1}),l=e=>{c.setSnapshot({...c.getSnapshot(),...e})},u=null,d=()=>{let e=c.getSnapshot(),t={query:e.query,matchCount:e.matches.length,currentIndex:e.currentIndex,open:e.open};u!==null&&u.query===t.query&&u.matchCount===t.matchCount&&u.currentIndex===t.currentIndex&&u.open===t.open||(u=t,i?.onChange?.(t))},f=()=>{let e=c.getSnapshot();if(e.currentIndex===null)return;let t=e.matches[e.currentIndex];t&&i?.onNavigate(t.rowIndex,t.colIndex)},p=()=>{o+=1,s=null,l({matches:[],index:a,currentIndex:null,scanning:!1,truncated:!1})},m=e=>{let a=i,u=c.getSnapshot();if(!a||!u.open||u.query.length===0){p(),d();return}o+=1;let m=o,{rowModel:h,columns:g,caseSensitive:_}=a,v=u.query;s={rowModel:h,columns:g,query:v,caseSensitive:_};let y=u.currentIndex===null?null:u.matches[u.currentIndex]??null,b=[],x=!1,S=h.getRowCount();l({scanning:!0}),t.runChunked(S,e=>{if(x)return;let t=h.getRow(e);t!==void 0&&g.forEach((i,a)=>{if(x||n.isSyntheticColumnKey(i.key)||!r.isFindableColumn(i))return;let o=r.resolveFindCellText(i,t);for(let t of r.findRangesInText(o,v,_)){if(b.length>=1e4){x=!0;return}b.push({rowIndex:e,colIndex:a,columnKey:String(i.key),start:t.start,length:t.length})}})},{isCancelled:()=>o!==m}).then(t=>{if(!t||o!==m)return;let n=r.resolveCurrentAfterRescan(b,y);l({matches:b,index:r.buildFindIndex(b),currentIndex:n,scanning:!1,truncated:x}),d(),e&&f()})},h=()=>{let e=c.getSnapshot();return!i||!e.open||e.query.length===0?!1:s===null||s.rowModel!==i.rowModel||s.columns!==i.columns||s.query!==e.query||s.caseSensitive!==i.caseSensitive};return{update:e=>{let t=i;if(i=e,!e.enabled){c.getSnapshot().open&&(l({open:!1,query:``}),p(),d());return}t!==e&&h()&&m(!1)},open:e=>{if(!i?.enabled)return;let t=c.getSnapshot(),n=e??t.query;l({open:!0,query:n}),n!==t.query||!t.open?m(!0):d()},close:()=>{c.getSnapshot().open&&(l({open:!1,query:``}),p(),d())},setQuery:e=>{let t=c.getSnapshot();!t.open||e===t.query||(l({query:e}),m(!0))},next:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,1);l({currentIndex:t}),d(),f()},prev:()=>{let e=c.getSnapshot(),t=r.stepFindIndex(e.currentIndex,e.matches.length,-1);l({currentIndex:t}),d(),f()},subscribe:c.subscribe,getSnapshot:c.getSnapshot,dispose:()=>{o+=1,i=null}}};exports.MAX_FIND_MATCHES=i,exports.createFindController=o;
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=b.query,E=f!==null&&f.query===T&&f.caseSensitive===w;f={rowModel:S,columns:C,query:T,caseSensitive:w},(o||u===null||u.columns!==C||u.query!==T||u.caseSensitive!==w)&&(u={columns:C,query:T,caseSensitive:w,byRow:new WeakMap});let D=u.byRow,O=0,k=e||d;d=k;let A=b.currentIndex===null?null:b.matches[b.currentIndex]??null,j=[],M=!1,N=S.getRowCount(),P=N>a,F=e=>{let t=[];return C.forEach((i,a)=>{if(n.isSyntheticColumnKey(i.key)||!r.isFindableColumn(i))return;let o=r.resolveFindCellText(i,e);for(let e of r.findRangesInText(o,T,w))t.push({colIndex:a,columnKey:String(i.key),start:e.start,length:e.length})}),t.length===0?s:t};!E&&!b.scanning&&m({scanning:!0}),t.runChunked(N,e=>{if(M)return;let t=S.getRow(e);if(t===void 0)return;let n;P&&typeof t==`object`&&t?(n=D.get(t),n===void 0?(n=F(t),D.set(t,n)):O+=1):n=F(t);for(let t of n){if(j.length>=1e4){M=!0;return}j.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&&M===p.getSnapshot().truncated&&c(p.getSnapshot().matches,j)))return;let t=r.resolveCurrentAfterRescan(j,A);m({matches:j,index:r.buildFindIndex(j),currentIndex:t,scanning:!1,truncated:M}),g(),k&&_(),!o&&O>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};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;
@@ -35,4 +35,5 @@ export type FindController<T> = {
35
35
  dispose: () => void;
36
36
  };
37
37
  export declare const MAX_FIND_MATCHES = 10000;
38
+ export declare const FIND_HIT_CACHE_ROW_THRESHOLD = 50000;
38
39
  export declare const createFindController: <T>() => FindController<T>;