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