@ishibashi0112/spreadsheet-grid-core 1.2.0 → 1.3.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 (118) hide show
  1. package/dist/controllers/clipboardController.cjs +1 -1
  2. package/dist/controllers/clipboardController.d.ts +1 -0
  3. package/dist/controllers/clipboardController.js +79 -70
  4. package/dist/controllers/columnMenuController.cjs +1 -1
  5. package/dist/controllers/columnMenuController.js +75 -73
  6. package/dist/controllers/contextMenuController.cjs +1 -1
  7. package/dist/controllers/contextMenuController.js +63 -61
  8. package/dist/controllers/detailRowController.cjs +1 -0
  9. package/dist/controllers/detailRowController.d.ts +41 -0
  10. package/dist/controllers/detailRowController.js +97 -0
  11. package/dist/controllers/detailTabOrder.cjs +1 -1
  12. package/dist/controllers/detailTabOrder.js +17 -16
  13. package/dist/controllers/editController.cjs +1 -1
  14. package/dist/controllers/editController.d.ts +4 -1
  15. package/dist/controllers/editController.js +163 -91
  16. package/dist/controllers/escapeClaimController.cjs +1 -1
  17. package/dist/controllers/escapeClaimController.js +23 -19
  18. package/dist/controllers/fillHandleController.cjs +1 -1
  19. package/dist/controllers/fillHandleController.js +107 -106
  20. package/dist/controllers/filterPopoverController.cjs +1 -1
  21. package/dist/controllers/filterPopoverController.js +1 -0
  22. package/dist/controllers/imeInputController.cjs +1 -1
  23. package/dist/controllers/imeInputController.js +87 -76
  24. package/dist/controllers/keyboardController.cjs +1 -1
  25. package/dist/controllers/keyboardController.d.ts +4 -0
  26. package/dist/controllers/keyboardController.js +101 -97
  27. package/dist/controllers/liveUiState.cjs +1 -0
  28. package/dist/controllers/liveUiState.d.ts +7 -0
  29. package/dist/controllers/liveUiState.js +4 -0
  30. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  31. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  32. package/dist/controllers/pointerInteractionsController.js +127 -126
  33. package/dist/controllers/popoverSupport.cjs +1 -1
  34. package/dist/controllers/popoverSupport.d.ts +3 -0
  35. package/dist/controllers/popoverSupport.js +62 -41
  36. package/dist/controllers/toolPanelController.cjs +1 -1
  37. package/dist/controllers/toolPanelController.js +74 -73
  38. package/dist/controllers/tooltipController.cjs +1 -1
  39. package/dist/controllers/tooltipController.d.ts +1 -1
  40. package/dist/controllers/tooltipController.js +122 -97
  41. package/dist/controllers/viewportSyncController.cjs +1 -1
  42. package/dist/controllers/viewportSyncController.js +55 -54
  43. package/dist/engine/cellCommands.cjs +1 -0
  44. package/dist/engine/cellCommands.d.ts +27 -0
  45. package/dist/engine/cellCommands.js +89 -0
  46. package/dist/engine/columnCommands.cjs +1 -1
  47. package/dist/engine/columnCommands.d.ts +2 -1
  48. package/dist/engine/columnCommands.js +98 -67
  49. package/dist/engine/exportCommands.cjs +1 -1
  50. package/dist/engine/exportCommands.js +2 -2
  51. package/dist/engine/gridApi.cjs +6 -5
  52. package/dist/engine/gridApi.d.ts +3 -0
  53. package/dist/engine/gridApi.js +158 -144
  54. package/dist/engine/rowSelectionCommands.cjs +1 -1
  55. package/dist/engine/rowSelectionCommands.d.ts +5 -0
  56. package/dist/engine/rowSelectionCommands.js +73 -38
  57. package/dist/locales/en.cjs +1 -1
  58. package/dist/locales/en.js +2 -2
  59. package/dist/logic/cellPlacement.cjs +1 -0
  60. package/dist/logic/cellPlacement.d.ts +22 -0
  61. package/dist/logic/cellPlacement.js +44 -0
  62. package/dist/logic/contextMenuTarget.cjs +1 -1
  63. package/dist/logic/contextMenuTarget.d.ts +20 -2
  64. package/dist/logic/contextMenuTarget.js +62 -3
  65. package/dist/logic/dateFilterCondition.cjs +1 -1
  66. package/dist/logic/dateFilterCondition.d.ts +1 -0
  67. package/dist/logic/dateFilterCondition.js +17 -13
  68. package/dist/logic/density.cjs +1 -0
  69. package/dist/logic/density.d.ts +5 -0
  70. package/dist/logic/density.js +17 -0
  71. package/dist/logic/detailRow.cjs +1 -1
  72. package/dist/logic/detailRow.d.ts +6 -1
  73. package/dist/logic/detailRow.js +21 -17
  74. package/dist/logic/domGuards.cjs +1 -1
  75. package/dist/logic/domGuards.d.ts +10 -0
  76. package/dist/logic/domGuards.js +18 -2
  77. package/dist/logic/editorKeys.cjs +1 -0
  78. package/dist/logic/editorKeys.d.ts +30 -0
  79. package/dist/logic/editorKeys.js +34 -0
  80. package/dist/logic/editorStart.cjs +1 -0
  81. package/dist/logic/editorStart.d.ts +7 -0
  82. package/dist/logic/editorStart.js +23 -0
  83. package/dist/logic/editorValues.cjs +1 -1
  84. package/dist/logic/editorValues.d.ts +1 -0
  85. package/dist/logic/editorValues.js +10 -7
  86. package/dist/logic/gridBarSummary.cjs +1 -0
  87. package/dist/logic/gridBarSummary.d.ts +27 -0
  88. package/dist/logic/gridBarSummary.js +137 -0
  89. package/dist/logic/gridState.cjs +1 -1
  90. package/dist/logic/gridState.d.ts +1 -0
  91. package/dist/logic/gridState.js +19 -16
  92. package/dist/logic/localeText.cjs +1 -1
  93. package/dist/logic/localeText.js +2 -2
  94. package/dist/logic/rowDragTarget.cjs +1 -0
  95. package/dist/logic/rowDragTarget.d.ts +14 -0
  96. package/dist/logic/rowDragTarget.js +47 -0
  97. package/dist/logic/selectEditorState.cjs +1 -1
  98. package/dist/logic/selectEditorState.d.ts +27 -4
  99. package/dist/logic/selectEditorState.js +29 -14
  100. package/dist/logic/valueFormatters.d.ts +8 -3
  101. package/dist/model/gridTypes.core.d.ts +31 -12
  102. package/dist/utils/clipboard.cjs +4 -4
  103. package/dist/utils/clipboard.js +60 -59
  104. package/dist/utils/editorVisibleBounds.cjs +1 -0
  105. package/dist/utils/editorVisibleBounds.d.ts +10 -0
  106. package/dist/utils/editorVisibleBounds.js +40 -0
  107. package/dist/utils/errorBubblePlacement.cjs +1 -0
  108. package/dist/utils/errorBubblePlacement.d.ts +8 -0
  109. package/dist/utils/errorBubblePlacement.js +26 -0
  110. package/dist/utils/multilineEditor.cjs +2 -0
  111. package/dist/utils/multilineEditor.d.ts +7 -0
  112. package/dist/utils/multilineEditor.js +22 -0
  113. package/dist/utils/popupContainer.cjs +1 -1
  114. package/dist/utils/popupContainer.js +35 -28
  115. package/dist/utils/shadowDom.cjs +1 -0
  116. package/dist/utils/shadowDom.d.ts +5 -0
  117. package/dist/utils/shadowDom.js +33 -0
  118. package/package.json +1 -1
@@ -1,13 +1,14 @@
1
1
  import { gridActions as e } from "../model/gridActions.js";
2
2
  import { isViewCellEditable as t } from "../utils/permissions.js";
3
- import { createValueStore as n } from "../logic/valueStore.js";
4
- import { computeNextScrollPosition as r, hasPointerLeftActivationRadius as i, resolveAutoScrollAxisDirection as a, resolveScrollContentBox as o, resolveTopAutoScrollStart as s } from "../logic/autoScrollGeometry.js";
5
- import { resolveElementScale as c } from "../logic/elementScale.js";
6
- import { beginEscapeCancelableDrag as l } from "./escapeClaimController.js";
7
- import { createPopoverWindowBindings as u, isInsideGridRoot as d, restoreGridFocus as f } from "./popoverSupport.js";
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";
3
+ import { getActiveElement as n } from "../utils/shadowDom.js";
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";
9
10
  //#region src/controllers/fillHandleController.ts
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
+ 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) => {
11
12
  if (e.valueFormatter) try {
12
13
  return e.valueFormatter({
13
14
  value: n,
@@ -18,81 +19,81 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
18
19
  return String(n ?? "");
19
20
  }
20
21
  return String(n ?? "");
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
+ }, 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) => {
22
23
  let t = e.currentTarget;
23
24
  if (!(t instanceof Element)) return !0;
24
25
  let n = t.getBoundingClientRect();
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({
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({
28
29
  readOnly: e.readOnly,
29
30
  canEditCell: e.canEditCell
30
- }, e.rowModel, n, r, i, a), V = () => {
31
- if (R === null || C === null) return;
31
+ }, e.rowModel, n, r, i, a), U = () => {
32
+ if (B === null || C === null) return;
32
33
  let e = w.getSnapshot();
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
+ 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;
34
35
  let t = null;
35
- if (R.target !== null) {
36
- let e = g({
36
+ if (B.target !== null) {
37
+ let e = _({
37
38
  rowModel: C.rowModel,
38
39
  columns: C.columns,
39
- source: R.source,
40
- target: R.target,
41
- request: z(R.toggled),
42
- canWriteCell: B(C),
40
+ source: B.source,
41
+ target: B.target,
42
+ request: V(B.toggled),
43
+ canWriteCell: H(C),
43
44
  getFillValue: C.getFillValue
44
45
  });
45
46
  t = e && O(e.column, e.row, e.value) || null;
46
47
  }
47
48
  w.setSnapshot({
48
49
  status: "dragging",
49
- source: R.source,
50
- target: R.target,
51
- toggled: R.toggled,
50
+ source: B.source,
51
+ target: B.target,
52
+ toggled: B.toggled,
52
53
  previewText: t
53
54
  });
54
- }, H = () => {
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
- }, U = () => {
59
- if (R === null || C === null) return;
60
- let e = R;
61
- e.rafId = requestAnimationFrame(U);
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);
62
63
  let t = C.scrollContainerRef.current;
63
64
  if (!t) return;
64
65
  if (!e.armed) {
65
- if (!i(e.origin, e.pointer, 6)) return;
66
+ if (!a(e.origin, e.pointer, 6)) return;
66
67
  e.armed = !0;
67
68
  }
68
- let n = t.getBoundingClientRect(), l = c(t, n), u = o({
69
+ let n = t.getBoundingClientRect(), r = l(t, n), u = s({
69
70
  rectLeft: n.left,
70
71
  rectTop: n.top,
71
72
  clientLeft: t.clientLeft,
72
73
  clientTop: t.clientTop,
73
74
  clientWidth: t.clientWidth,
74
75
  clientHeight: t.clientHeight,
75
- scale: l
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);
76
+ 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);
77
78
  (d !== t.scrollTop || f !== t.scrollLeft) && (t.scrollTo({
78
79
  top: d,
79
80
  left: f,
80
81
  behavior: "auto"
81
- }), H());
82
- }, W = (e, t) => {
83
- let n = R;
82
+ }), W());
83
+ }, K = (e, t) => {
84
+ let n = B;
84
85
  if (n !== null) {
85
- if (R = null, n.cleanup(), n.rafId !== null && cancelAnimationFrame(n.rafId), A.setSnapshot(null), w.setSnapshot(D), e && n.target !== null) {
86
- L = null, q(n.source, n.target, z(n.toggled), n.activeCell);
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
88
  return;
88
89
  }
89
- L = e && t !== void 0 && n.onSquare ? {
90
+ z = e && t !== void 0 && n.onSquare ? {
90
91
  time: t,
91
92
  x: n.origin.x,
92
93
  y: n.origin.y
93
94
  } : null;
94
95
  }
95
- }, G = (t, n) => {
96
+ }, te = (t, n) => {
96
97
  if (C === null) return;
97
98
  let { dispatch: r } = C;
98
99
  r(e.startSelection({
@@ -105,33 +106,33 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
105
106
  row: t.startRow,
106
107
  col: t.startCol
107
108
  }));
108
- }, K = (e, t) => {
109
+ }, ne = (e, t) => {
109
110
  let n = [];
110
111
  for (let r = t.startRow; r <= t.endRow; r += 1) n.push(e.getRowKey(r));
111
112
  return n;
112
113
  }, q = (e, t, n, r) => {
113
114
  if (C === null || !C.enabled) return;
114
- let i = C, a = m({
115
+ let i = C, a = h({
115
116
  rowModel: i.rowModel,
116
117
  columns: i.columns,
117
118
  source: e,
118
119
  target: t,
119
120
  request: n,
120
- canWriteCell: B(i),
121
+ canWriteCell: H(i),
121
122
  getFillValue: i.getFillValue
122
123
  });
123
124
  if (a.edits.length === 0) return;
124
- let o = x(e, t), s = null, c = [], l = null;
125
+ let o = S(e, t), s = null, c = [], l = null;
125
126
  if (i.isServerSide) {
126
127
  if (!i.applyServerSideCellEdits) return;
127
- l = K(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
128
+ l = ne(i.rowModel, o), i.applyServerSideCellEdits(a.edits);
128
129
  } else {
129
130
  if (!i.applyRowsChange) return;
130
- let e = p(i.rows, i.rowModel, a.edits);
131
+ let e = m(i.rows, i.rowModel, a.edits);
131
132
  if (e === i.rows) return;
132
133
  s = i.rows, c.push(e), i.applyRowsChange(e);
133
134
  }
134
- I = {
135
+ R = {
135
136
  source: e,
136
137
  target: t,
137
138
  range: o,
@@ -145,20 +146,20 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
145
146
  baseRowModel: i.isServerSide ? null : i.rowModel,
146
147
  emittedRows: c,
147
148
  rowKeys: l
148
- }, G(o, r), w.setSnapshot({
149
+ }, te(o, r), w.setSnapshot({
149
150
  status: "filled",
150
151
  range: o,
151
152
  kind: a.kind,
152
153
  seriesAvailable: a.seriesAvailable,
153
154
  menu: null
154
155
  });
155
- }, J = u({
156
+ }, J = d({
156
157
  onScroll: (e) => {
157
- e.target instanceof Node && N.current?.contains(e.target) || X(!1);
158
+ e.target instanceof Node && F.current?.contains(e.target) || X(!1);
158
159
  },
159
160
  onResize: () => X(!1),
160
- isInside: (e) => N.current?.contains(e) === !0 || F.current?.contains(e) === !0,
161
- onOutsidePointerDown: (e) => X(C !== null && d(C.gridRootRef, e)),
161
+ isInside: (e) => F.current?.contains(e) === !0 || L.current?.contains(e) === !0,
162
+ onOutsidePointerDown: (e) => X(C !== null && f(C.gridRootRef, e)),
162
163
  getGridRoot: () => C?.gridRootRef.current ?? null,
163
164
  onGridHidden: () => X(!1),
164
165
  onKeyDown: (e) => {
@@ -171,48 +172,48 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
171
172
  menu: e
172
173
  });
173
174
  }, X = (e) => {
174
- J.detach(), Y(null), e && C !== null && f(C.gridRootRef);
175
+ J.detach(), Y(null), e && C !== null && p(C.gridRootRef);
175
176
  }, Z = () => {
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
- }, ne = (e) => {
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) => {
179
180
  let t = w.getSnapshot();
180
181
  if (t.status !== "filled") return;
181
182
  if (t.menu !== null) {
182
183
  X(!0);
183
184
  return;
184
185
  }
185
- let n = Math.min(e.left, window.innerWidth - S - E);
186
+ let n = Math.min(e.left, window.innerWidth - ee - E);
186
187
  n = Math.max(E, n);
187
188
  let r = e.bottom + 4, i = T();
188
189
  r + i > window.innerHeight - E && (r = Math.max(E, e.top - 4 - i)), Y({
189
190
  top: r,
190
191
  left: n
191
192
  }), J.attach();
192
- }, re = (e, t) => {
193
+ }, ie = (e, t) => {
193
194
  let n = t.rowKeys;
194
195
  if (n === null) return !1;
195
196
  for (let r = 0; r < n.length; r += 1) if (e.getRowKey(t.range.startRow + r) !== n[r]) return !1;
196
197
  return !0;
197
- }, ie = (e) => {
198
- let n = w.getSnapshot(), r = I;
198
+ }, ae = (e) => {
199
+ let n = w.getSnapshot(), r = R;
199
200
  if (X(!0), C === null || r === null || n.status !== "filled" || r.request === e) return;
200
201
  let i = C;
201
202
  if (i.isServerSide) {
202
- if (!i.applyServerSideCellEdits || !re(i.rowModel, r)) {
203
+ if (!i.applyServerSideCellEdits || !ie(i.rowModel, r)) {
203
204
  Z();
204
205
  return;
205
206
  }
206
- let t = m({
207
+ let t = h({
207
208
  rowModel: i.rowModel,
208
209
  columns: r.columns,
209
210
  source: r.source,
210
211
  target: r.target,
211
212
  request: e,
212
- canWriteCell: B(i),
213
+ canWriteCell: H(i),
213
214
  getFillValue: i.getFillValue
214
215
  });
215
- r.request = e, t.edits.length > 0 && !P(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, w.setSnapshot({
216
+ r.request = e, t.edits.length > 0 && !I(t.edits, r.edits) && i.applyServerSideCellEdits(t.edits), r.edits = t.edits, w.setSnapshot({
216
217
  ...n,
217
218
  kind: t.kind,
218
219
  menu: null
@@ -223,7 +224,7 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
223
224
  Z();
224
225
  return;
225
226
  }
226
- let a = r.baseRowModel, o = m({
227
+ let a = r.baseRowModel, o = h({
227
228
  rowModel: a,
228
229
  columns: r.columns,
229
230
  source: r.source,
@@ -235,8 +236,8 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
235
236
  }, a, e, n, r, o),
236
237
  getFillValue: i.getFillValue
237
238
  });
238
- if (r.request = e, !P(o.edits, r.edits)) {
239
- let e = p(r.baseRows, a, o.edits);
239
+ if (r.request = e, !I(o.edits, r.edits)) {
240
+ let e = m(r.baseRows, a, o.edits);
240
241
  r.emittedRows.push(e), r.edits = o.edits, i.amendRowsChange(e);
241
242
  }
242
243
  w.setSnapshot({
@@ -247,16 +248,16 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
247
248
  }, Q = (e, t) => {
248
249
  if (e?.type !== "cell") return !1;
249
250
  let { start: n, end: r } = e.range;
250
- return h(t, {
251
+ return g(t, {
251
252
  startRow: Math.min(n.row, r.row),
252
253
  endRow: Math.max(n.row, r.row),
253
254
  startCol: Math.min(n.col, r.col),
254
255
  endCol: Math.max(n.col, r.col)
255
256
  });
256
- }, ae = (e) => {
257
- let t = I;
257
+ }, oe = (e) => {
258
+ let t = R;
258
259
  if (t !== null) {
259
- if (!e.enabled || e.editing || !ee(e.columns, t.columns) || !M(e.viewKey, t.viewKey)) {
260
+ if (!e.enabled || e.editing || !k(e.columns, t.columns) || !P(e.viewKey, t.viewKey)) {
260
261
  Z();
261
262
  return;
262
263
  }
@@ -270,42 +271,42 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
270
271
  }
271
272
  !t.selectionConfirmed && Q(e.selection, t.previousSource) || Z();
272
273
  }
273
- }, oe = (e) => {
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);
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);
276
277
  if (t === null) return;
277
- let n = L;
278
- L = null;
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) {
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) {
281
282
  C.gridRootRef.current?.focus({ preventScroll: !0 }), $();
282
283
  return;
283
284
  }
284
285
  Z(), C.gridRootRef.current?.focus({ preventScroll: !0 });
285
286
  let i = e.pointerId, a = (e) => {
286
- R === null || e.pointerId !== i || (R.pointer = {
287
+ B === null || e.pointerId !== i || (B.pointer = {
287
288
  x: e.clientX,
288
289
  y: e.clientY
289
- }, R.toggled = e.ctrlKey || e.metaKey, A.setSnapshot(R.pointer), H());
290
+ }, B.toggled = e.ctrlKey || e.metaKey, M.setSnapshot(B.pointer), W());
290
291
  }, o = (e) => {
291
- R === null || e.pointerId !== i || (R.toggled = e.ctrlKey || e.metaKey, W(!0, e.timeStamp));
292
+ B === null || e.pointerId !== i || (B.toggled = e.ctrlKey || e.metaKey, K(!0, e.timeStamp));
292
293
  }, s = (e) => {
293
- e.pointerId === i && W(!1);
294
+ e.pointerId === i && K(!1);
294
295
  }, c = (e) => {
295
- if (R === null) return;
296
+ if (B === null) return;
296
297
  if (e.preventDefault(), e.stopPropagation(), e.type === "keydown" && e.key === "Escape") {
297
- W(!1);
298
+ K(!1);
298
299
  return;
299
300
  }
300
301
  let t = e.ctrlKey || e.metaKey;
301
- t !== R.toggled && (R.toggled = t, V());
302
- }, u = () => W(!1);
303
- 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", u);
304
- let d = l(), f = {
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 = {
305
306
  x: e.clientX,
306
307
  y: e.clientY
307
308
  };
308
- R = {
309
+ B = {
309
310
  pointerId: i,
310
311
  source: t,
311
312
  activeCell: C.activeCell,
@@ -317,35 +318,35 @@ var S = 168, C = 84, w = 106, T = () => typeof matchMedia == "function" && match
317
318
  armed: !1,
318
319
  rafId: null,
319
320
  cleanup: () => {
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
+ 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();
321
322
  }
322
- }, A.setSnapshot(f), V(), R.rafId = requestAnimationFrame(U);
323
+ }, M.setSnapshot(f), U(), B.rafId = requestAnimationFrame(G);
323
324
  }, $ = () => {
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);
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
327
  if (e === null) return;
327
- let t = v(e, C.rowModel, C.columns);
328
+ let t = y(e, C.rowModel, C.columns);
328
329
  t !== null && (Z(), q(e, t, "auto", C.activeCell));
329
330
  };
330
331
  return {
331
332
  update: (e) => {
332
- C = e, R !== null && (!e.enabled || e.editing) && W(!1), ae(e);
333
+ C = e, B !== null && (!e.enabled || e.editing) && K(!1), oe(e);
333
334
  },
334
335
  subscribe: w.subscribe,
335
336
  getSnapshot: w.getSnapshot,
336
- subscribePointer: A.subscribe,
337
- getPointerSnapshot: A.getSnapshot,
338
- handlePointerDown: oe,
337
+ subscribePointer: M.subscribe,
338
+ getPointerSnapshot: M.getSnapshot,
339
+ handlePointerDown: se,
339
340
  handleDoubleClick: $,
340
- toggleMenu: ne,
341
+ toggleMenu: re,
341
342
  closeMenu: () => X(!0),
342
- chooseKind: ie,
343
- menuPanel: N,
344
- chipElement: F,
343
+ chooseKind: ae,
344
+ menuPanel: F,
345
+ chipElement: L,
345
346
  dispose: () => {
346
- W(!1), J.detach(), I = null;
347
+ K(!1), J.detach(), R = null;
347
348
  }
348
349
  };
349
350
  };
350
351
  //#endregion
351
- export { F as createFillHandleController };
352
+ export { L 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("./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
+ 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),onOtherGridPopupOpen:()=>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;
@@ -74,6 +74,7 @@ var _ = 240, v = 8, y = 8, b = 230, x = 340, S = 480, C = (e, t) => {
74
74
  onOutsidePointerDown: (e) => W(T !== null && i(T.gridRootRef, e)),
75
75
  getGridRoot: () => T?.gridRootRef.current ?? null,
76
76
  onGridHidden: () => W(!1),
77
+ onOtherGridPopupOpen: () => W(!1),
77
78
  onKeyDown: (e) => {
78
79
  e.key !== "Escape" || D.current !== null || (e.preventDefault(), G());
79
80
  }
@@ -1 +1 @@
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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../utils/shadowDom.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/domGuards.cjs"),r=require("../logic/elementScale.cjs"),i=require("../utils/gridVisibleBand.cjs"),a=require("../utils/topAlignedInput.cjs");var o=24,s=`ssg-ime-input--composing`,c=(e,n,r)=>{let i=e.querySelectorAll(`.ssg-body-row[data-row-index="${n.row}"]`);for(let n of Array.from(i)){if(t.isInsideDetailCardOf(e,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},l=(e,t)=>e===t||e!==null&&t!==null&&e.row===t.row&&e.col===t.col,u=()=>{let t=null,u=null,d=null,f=null,p=!1,m=null,h=!1,g=!1,_=!1,v=null,y=null,b=()=>t?.gridRootRef.current??null,x=()=>{u&&e.getActiveElement(u)!==u&&u.focus({preventScroll:!0})},S=(e,n)=>{let s=b(),l=t?.resolveCell(e)??null;if(!u||!s||!l)return!1;let d=c(s,e,l.colKey);if(!d)return!1;let f=s.getBoundingClientRect(),p=d.getBoundingClientRect(),m=r.resolveElementScale(s,f),h=p.top,g=p.bottom;if(n){let e=i.resolveGridVisibleBand(d);if(e!==null){let t=Math.max(h,e.top),n=Math.min(g,e.bottom);n-t>=o*m.y&&(h=t,g=n)}}let _=(g-h)/m.y;return u.style.left=`${(p.left-f.left)/m.x-s.clientLeft}px`,u.style.top=`${(h-f.top)/m.y-s.clientTop}px`,u.style.width=`${p.width/m.x}px`,u.style.height=`${_}px`,u.style.textAlign=n&&l.align?l.align:``,a.alignInputTextToTop(u,n&&d.classList.contains(`ssg-body-cell--valign-top`),_),!0},C=()=>{let e=u?.ownerDocument.defaultView??null;e===null||y!==null||(y={view:e,id:e.requestAnimationFrame(()=>{y=null,!(t===null||!t.enabled||m!==null||h||t.activeCell===null)&&l(v,t.activeCell)&&(S(t.activeCell,!1)||(v=null))})})},w=()=>{y!==null&&(y.view.cancelAnimationFrame(y.id),y=null)},T=()=>{u&&(u.classList.remove(s),u.value=``,u.style.textAlign=``,a.alignInputTextToTop(u,!1,0))},E=e=>{t===null||!t.enabled||t.editing||g||e.target===d&&x()},D=()=>{if(t===null||!t.enabled||t.editing||t.activeCell===null){m=null;return}let e=t.activeCell,n=t.canStartEdit(e);m={cell:e,allowed:n},_=!1,n&&(u?.classList.add(s),S(e,!0),v=e)},O=n=>{let r=m;m=null;let i=_;if(_=!1,!u||r===null||!r.allowed||i){T();return}let a=u.value||n.data||``;queueMicrotask(()=>{let n=u;if(t===null||!t.enabled||!n||a===``||e.getActiveElement(n)!==n||!t.canStartEdit(r.cell)){T();return}let i=t.resolveEditText?t.resolveEditText(r.cell,a):a;if(i===null||i===``){T();return}h=!0,t.startEdit(r.cell,i),requestAnimationFrame(()=>{h&&t!==null&&!t.editing&&(h=!1,T())})})},k=()=>{m===null&&!h&&u&&(u.value=``)},A=t=>{if(e.getEventTarget(t,u)!==u||t.key!==`Tab`||t.defaultPrevented||n.isImeComposingKeyEvent(t)||e.getActiveElement(u)!==u)return;let r=b();if(r){g=!0;try{r.focus({preventScroll:!0})}finally{g=!1}}},j=()=>{m!==null&&(_=!0)},M=e=>{d!==e&&(d?.removeEventListener(`focus`,E),d=e,d?.addEventListener(`focus`,E))},N=e=>{typeof document>`u`||p===e||(p=e,e?(document.addEventListener(`keydown`,A),document.addEventListener(`pointerdown`,j,!0)):(document.removeEventListener(`keydown`,A),document.removeEventListener(`pointerdown`,j,!0)))},P=e=>{f!==e&&(f&&(f.removeEventListener(`compositionstart`,D),f.removeEventListener(`compositionend`,O),f.removeEventListener(`input`,k)),f=e,f&&(f.addEventListener(`compositionstart`,D),f.addEventListener(`compositionend`,O),f.addEventListener(`input`,k)))};return{update:n=>{t=n;let r=n.gridRootRef.current;if(M(n.enabled?r:null),P(n.enabled?u:null),N(n.enabled),!n.enabled){m=null,h=!1,T(),u&&r&&e.getActiveElement(u)===u&&r.focus({preventScroll:!0});return}h&&n.editing&&(h=!1,T()),!(m!==null||h)&&(n.activeCell!==null&&!l(v,n.activeCell)&&S(n.activeCell,!1)&&(v=n.activeCell,C()),!n.editing&&r&&e.getActiveElement(r)===r&&x())},attach:e=>{u!==e&&(u=e,P(t?.enabled?u:null),u&&(typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches&&(u.inputMode=`none`),v=null))},dispose:()=>{w(),P(null),M(null),N(!1),m=null,h=!1,t=null}}};exports.IME_INPUT_COMPOSING_CLASS=s,exports.createImeInputController=u;