@ishibashi0112/spreadsheet-grid-core 1.9.0 → 1.11.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 (173) hide show
  1. package/dist/controllers/changeHighlightController.cjs +1 -1
  2. package/dist/controllers/changeHighlightController.js +69 -71
  3. package/dist/controllers/changeTracker.cjs +1 -1
  4. package/dist/controllers/changeTracker.d.ts +5 -0
  5. package/dist/controllers/changeTracker.js +342 -168
  6. package/dist/controllers/clipboardController.cjs +2 -1
  7. package/dist/controllers/clipboardController.d.ts +5 -1
  8. package/dist/controllers/clipboardController.js +224 -91
  9. package/dist/controllers/dateTimeEditorController.cjs +1 -0
  10. package/dist/controllers/dateTimeEditorController.d.ts +62 -0
  11. package/dist/controllers/dateTimeEditorController.js +201 -0
  12. package/dist/controllers/editController.cjs +1 -1
  13. package/dist/controllers/editController.js +259 -178
  14. package/dist/controllers/fillHandleController.cjs +1 -1
  15. package/dist/controllers/fillHandleController.js +188 -186
  16. package/dist/controllers/findController.cjs +1 -1
  17. package/dist/controllers/findController.d.ts +1 -0
  18. package/dist/controllers/findController.js +27 -25
  19. package/dist/controllers/historyController.cjs +1 -1
  20. package/dist/controllers/historyController.d.ts +1 -0
  21. package/dist/controllers/historyController.js +2 -2
  22. package/dist/controllers/keyboardController.cjs +1 -1
  23. package/dist/controllers/keyboardController.d.ts +4 -0
  24. package/dist/controllers/keyboardController.js +155 -144
  25. package/dist/controllers/multiSelectEditorController.cjs +1 -0
  26. package/dist/controllers/multiSelectEditorController.d.ts +54 -0
  27. package/dist/controllers/multiSelectEditorController.js +200 -0
  28. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  29. package/dist/controllers/pointerInteractionsController.js +155 -154
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.d.ts +1 -0
  32. package/dist/controllers/rowDragController.js +1 -0
  33. package/dist/controllers/selectOptionsCollector.cjs +1 -1
  34. package/dist/controllers/selectOptionsCollector.d.ts +2 -1
  35. package/dist/controllers/selectOptionsCollector.js +53 -52
  36. package/dist/controllers/tooltipController.cjs +1 -1
  37. package/dist/controllers/tooltipController.js +6 -1
  38. package/dist/engine/cellCommands.cjs +1 -1
  39. package/dist/engine/cellCommands.js +74 -54
  40. package/dist/engine/createGridEngine.cjs +1 -1
  41. package/dist/engine/createGridEngine.d.ts +4 -0
  42. package/dist/engine/createGridEngine.js +36 -34
  43. package/dist/engine/excelShortcutCommands.cjs +1 -0
  44. package/dist/engine/excelShortcutCommands.d.ts +29 -0
  45. package/dist/engine/excelShortcutCommands.js +281 -0
  46. package/dist/engine/exportCommands.cjs +1 -1
  47. package/dist/engine/exportCommands.js +3 -1
  48. package/dist/engine/features.cjs +1 -1
  49. package/dist/engine/features.d.ts +10 -0
  50. package/dist/engine/features.js +22 -2
  51. package/dist/engine/fullFeatures.cjs +1 -1
  52. package/dist/engine/fullFeatures.js +16 -12
  53. package/dist/engine/gridApi.cjs +10 -10
  54. package/dist/engine/gridApi.d.ts +1 -0
  55. package/dist/engine/gridApi.js +49 -31
  56. package/dist/engine/newRowController.cjs +1 -0
  57. package/dist/engine/newRowController.d.ts +31 -0
  58. package/dist/engine/newRowController.js +158 -0
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.ts +1 -1
  61. package/dist/index.js +4 -4
  62. package/dist/locales/en.cjs +1 -1
  63. package/dist/locales/en.js +19 -0
  64. package/dist/logic/cellPlacement.cjs +1 -1
  65. package/dist/logic/cellPlacement.d.ts +1 -1
  66. package/dist/logic/cellPlacement.js +1 -1
  67. package/dist/logic/cellText.cjs +1 -0
  68. package/dist/logic/cellText.d.ts +3 -0
  69. package/dist/logic/cellText.js +11 -0
  70. package/dist/logic/cellValueTransfer.cjs +1 -0
  71. package/dist/logic/cellValueTransfer.d.ts +8 -0
  72. package/dist/logic/cellValueTransfer.js +11 -0
  73. package/dist/logic/changeTracking.cjs +1 -1
  74. package/dist/logic/changeTracking.d.ts +26 -1
  75. package/dist/logic/changeTracking.js +194 -84
  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.js +133 -115
  81. package/dist/logic/columnEditor.cjs +1 -0
  82. package/dist/logic/columnEditor.d.ts +26 -0
  83. package/dist/logic/columnEditor.js +15 -0
  84. package/dist/logic/dateTimeEditor.cjs +1 -0
  85. package/dist/logic/dateTimeEditor.d.ts +54 -0
  86. package/dist/logic/dateTimeEditor.js +100 -0
  87. package/dist/logic/dateTimeValues.cjs +1 -0
  88. package/dist/logic/dateTimeValues.d.ts +19 -0
  89. package/dist/logic/dateTimeValues.js +42 -0
  90. package/dist/logic/editorKeys.cjs +1 -1
  91. package/dist/logic/editorKeys.d.ts +9 -1
  92. package/dist/logic/editorKeys.js +23 -17
  93. package/dist/logic/editorValues.cjs +1 -1
  94. package/dist/logic/editorValues.d.ts +4 -4
  95. package/dist/logic/editorValues.js +60 -49
  96. package/dist/logic/excelShortcuts.cjs +1 -0
  97. package/dist/logic/excelShortcuts.d.ts +13 -0
  98. package/dist/logic/excelShortcuts.js +36 -0
  99. package/dist/logic/exportCsv.cjs +2 -2
  100. package/dist/logic/exportCsv.d.ts +2 -1
  101. package/dist/logic/exportCsv.js +17 -17
  102. package/dist/logic/exportData.cjs +1 -1
  103. package/dist/logic/exportData.d.ts +2 -1
  104. package/dist/logic/exportData.js +26 -26
  105. package/dist/logic/featureWarnings.cjs +1 -1
  106. package/dist/logic/featureWarnings.js +25 -6
  107. package/dist/logic/fillHandle.cjs +1 -1
  108. package/dist/logic/fillHandle.js +147 -100
  109. package/dist/logic/fillSeries.cjs +1 -1
  110. package/dist/logic/fillSeries.d.ts +2 -0
  111. package/dist/logic/fillSeries.js +104 -64
  112. package/dist/logic/filterSummary.cjs +1 -1
  113. package/dist/logic/filterSummary.js +38 -37
  114. package/dist/logic/filtering.cjs +1 -1
  115. package/dist/logic/filtering.js +160 -118
  116. package/dist/logic/find.cjs +1 -1
  117. package/dist/logic/find.d.ts +6 -2
  118. package/dist/logic/find.js +36 -20
  119. package/dist/logic/gridAsk.cjs +3 -3
  120. package/dist/logic/gridAsk.js +216 -211
  121. package/dist/logic/grouping.cjs +1 -1
  122. package/dist/logic/grouping.js +34 -38
  123. package/dist/logic/imeInput.cjs +1 -1
  124. package/dist/logic/imeInput.d.ts +1 -1
  125. package/dist/logic/imeInput.js +24 -22
  126. package/dist/logic/inferFilterType.cjs +1 -1
  127. package/dist/logic/inferFilterType.js +1 -1
  128. package/dist/logic/localeText.cjs +1 -1
  129. package/dist/logic/localeText.d.ts +3 -0
  130. package/dist/logic/localeText.js +3 -0
  131. package/dist/logic/localeTextFeatures.cjs +1 -1
  132. package/dist/logic/localeTextFeatures.d.ts +22 -0
  133. package/dist/logic/localeTextFeatures.js +27 -8
  134. package/dist/logic/multiSelect.cjs +1 -0
  135. package/dist/logic/multiSelect.d.ts +55 -0
  136. package/dist/logic/multiSelect.js +150 -0
  137. package/dist/logic/newRow.cjs +1 -0
  138. package/dist/logic/newRow.d.ts +9 -0
  139. package/dist/logic/newRow.js +70 -0
  140. package/dist/logic/rowDragTarget.cjs +1 -1
  141. package/dist/logic/rowDragTarget.js +21 -23
  142. package/dist/logic/selectEditorState.cjs +1 -1
  143. package/dist/logic/selectEditorState.d.ts +1 -0
  144. package/dist/logic/selectEditorState.js +1 -1
  145. package/dist/logic/selectFillRow.cjs +1 -1
  146. package/dist/logic/selectFillRow.js +19 -18
  147. package/dist/logic/selectLabels.cjs +1 -1
  148. package/dist/logic/selectLabels.d.ts +4 -2
  149. package/dist/logic/selectLabels.js +36 -32
  150. package/dist/logic/selectOptions.cjs +1 -1
  151. package/dist/logic/selectOptions.d.ts +3 -2
  152. package/dist/logic/selectOptions.js +37 -16
  153. package/dist/logic/selectionAggregates.cjs +1 -1
  154. package/dist/logic/selectionAggregates.js +2 -2
  155. package/dist/logic/sorting.cjs +1 -1
  156. package/dist/logic/sorting.js +108 -102
  157. package/dist/logic/validation.cjs +1 -1
  158. package/dist/logic/validation.d.ts +1 -1
  159. package/dist/logic/validation.js +28 -21
  160. package/dist/model/gridStore.cjs +1 -1
  161. package/dist/model/gridStore.d.ts +17 -1
  162. package/dist/model/gridStore.js +4 -4
  163. package/dist/model/gridTypes.core.d.ts +291 -30
  164. package/dist/model/gridTypes.unbound.d.ts +1 -0
  165. package/dist/utils/clipboard.cjs +1 -1
  166. package/dist/utils/clipboard.d.ts +2 -2
  167. package/dist/utils/clipboard.js +13 -13
  168. package/dist/utils/editorVisibleBounds.cjs +1 -1
  169. package/dist/utils/editorVisibleBounds.js +1 -1
  170. package/dist/utils/permissions.cjs +1 -1
  171. package/dist/utils/permissions.d.ts +2 -2
  172. package/dist/utils/permissions.js +1 -1
  173. package/package.json +1 -1
@@ -1,95 +1,96 @@
1
1
  import { gridActions as e } from "../model/gridActions.js";
2
- import { nextSortEntries as t } from "../logic/sorting.js";
3
- import { isSyntheticColumnKey as n } from "../logic/detailRow.js";
4
- import { clamp as r, findLogicalIndexFromPaneOffset as i } from "../logic/geometry.js";
5
- import { readLiveUiState as a } from "./liveUiState.js";
6
- import { clampClientYAboveFooter as o, clampClientYBelowHeader as s, computeNextScrollPosition as c, hasPointerLeftActivationRadius as l, resolveAutoScrollAxisDirection as u, resolveScrollContentBox as d, resolveTopAutoScrollStart as f } from "../logic/autoScrollGeometry.js";
7
- import { resolveElementScale as p } from "../logic/elementScale.js";
8
- import { clientYToRowIndex as m } from "../logic/verticalGeometry.js";
2
+ import { mayHaveEditorType as t } from "../logic/columnEditor.js";
3
+ import { nextSortEntries as n } from "../logic/sorting.js";
4
+ import { isSyntheticColumnKey as r } from "../logic/detailRow.js";
5
+ import { clamp as i, findLogicalIndexFromPaneOffset as a } from "../logic/geometry.js";
6
+ import { readLiveUiState as o } from "./liveUiState.js";
7
+ import { clampClientYAboveFooter as s, clampClientYBelowHeader as c, computeNextScrollPosition as l, hasPointerLeftActivationRadius as u, resolveAutoScrollAxisDirection as d, resolveScrollContentBox as f, resolveTopAutoScrollStart as p } from "../logic/autoScrollGeometry.js";
8
+ import { resolveElementScale as m } from "../logic/elementScale.js";
9
+ import { clientYToRowIndex as h } from "../logic/verticalGeometry.js";
9
10
  //#region src/controllers/pointerInteractionsController.ts
10
- var h = 10, g = 300, _ = () => {
11
- let h = null, g = !1, _ = !1, v = null, y = null, b = "mouse", x = null, S = null, C = !1, w = !1, T = () => h === null ? null : a(h).dragState ?? null, E = null, D = (e) => {
12
- let t = h?.footerHeight ?? 0, n = h?.stickyTopHeight ?? 0, r = h?.scrollContainerRef.current ?? null;
11
+ var g = 10, _ = 300, v = () => {
12
+ let g = null, _ = !1, v = !1, y = null, b = null, x = "mouse", S = null, C = null, w = !1, T = !1, E = () => g === null ? null : o(g).dragState ?? null, D = null, O = (e) => {
13
+ let t = g?.footerHeight ?? 0, n = g?.stickyTopHeight ?? 0, r = g?.scrollContainerRef.current ?? null;
13
14
  if (t <= 0 && n <= 0 || !r) return e;
14
- let i = r.getBoundingClientRect(), a = p(r, i);
15
- return s(o(e, i.top + (r.clientTop + r.clientHeight) * a.y, t * a.y), i.top + r.clientTop * a.y, n * a.y);
16
- }, O = (e, t) => {
17
- if (h === null) return null;
18
- let { bodyScrollRef: n, scrollContainerRef: a, leftPaneScrollRef: o, rightPaneScrollRef: s, filteredRowsLength: c, visibleColumnsLength: l, paneLayout: u, leftLeadingWidth: d, centerLeadingWidth: f, rightLeadingWidth: g, headerHeight: _, rowMetrics: v, verticalScaleFactor: y } = h, b = n.current;
15
+ let i = r.getBoundingClientRect(), a = m(r, i);
16
+ return c(s(e, i.top + (r.clientTop + r.clientHeight) * a.y, t * a.y), i.top + r.clientTop * a.y, n * a.y);
17
+ }, k = (e, t) => {
18
+ if (g === null) return null;
19
+ let { bodyScrollRef: n, scrollContainerRef: r, leftPaneScrollRef: o, rightPaneScrollRef: s, filteredRowsLength: c, visibleColumnsLength: l, paneLayout: u, leftLeadingWidth: d, centerLeadingWidth: f, rightLeadingWidth: p, headerHeight: _, rowMetrics: v, verticalScaleFactor: y } = g, b = n.current;
19
20
  if (!b || c === 0 || l === 0) return null;
20
- let x = b.getBoundingClientRect(), S = p(b, x), C = m(b.scrollTop + (D(t) - x.top) / S.y - _, a.current?.scrollTop ?? 0, y, v), w = null, T = o.current;
21
+ let x = b.getBoundingClientRect(), S = m(b, x), C = h(b.scrollTop + (O(t) - x.top) / S.y - _, r.current?.scrollTop ?? 0, y, v), w = null, T = o.current;
21
22
  if (w === null && T && u.left.entries.length > 0) {
22
23
  let t = T.getBoundingClientRect();
23
24
  if (e < t.right) {
24
25
  let n = (e - t.left) / S.x - d;
25
- w = i(u.left, n);
26
+ w = a(u.left, n);
26
27
  }
27
28
  }
28
29
  let E = s.current;
29
30
  if (w === null && E && u.right.entries.length > 0) {
30
31
  let t = E.getBoundingClientRect();
31
32
  if (e >= t.left) {
32
- let n = (e - t.left) / S.x - g;
33
- w = i(u.right, n);
33
+ let n = (e - t.left) / S.x - p;
34
+ w = a(u.right, n);
34
35
  }
35
36
  }
36
37
  if (w === null && u.center.entries.length > 0) {
37
38
  let t = T && u.left.entries.length === 0 ? Math.max(e, T.getBoundingClientRect().left + d * S.x) : e, n = b.scrollLeft + (t - x.left) / S.x - f;
38
- w = i(u.center, Math.max(n, 0));
39
+ w = a(u.center, Math.max(n, 0));
39
40
  }
40
41
  return w === null ? null : {
41
42
  row: C,
42
- col: r(w, 0, l - 1)
43
+ col: i(w, 0, l - 1)
43
44
  };
44
- }, k = null, A = null, j = (t) => {
45
- if (h === null) return;
46
- let n = k;
45
+ }, A = null, j = null, M = (t) => {
46
+ if (g === null) return;
47
+ let n = A;
47
48
  if (n === null) {
48
- h.dispatch(e.updateColumnSelection(t));
49
+ g.dispatch(e.updateColumnSelection(t));
49
50
  return;
50
51
  }
51
52
  let r = t >= n.lo && t <= n.hi;
52
53
  if (n.fixedAnchor !== null) {
53
54
  let i = n.fixedAnchor, a = Math.abs(n.hi - i) >= Math.abs(n.lo - i) ? n.hi : n.lo;
54
- h.dispatch(e.updateColumnSelection(r ? a : t));
55
+ g.dispatch(e.updateColumnSelection(r ? a : t));
55
56
  return;
56
57
  }
57
58
  let i = t < n.lo ? n.hi : n.lo;
58
- i !== n.anchor && (n.anchor = i, h.dispatch(e.startColumnSelection(i, h.resolveFirstDataCell?.().row))), h.dispatch(e.updateColumnSelection(t < n.lo ? t : Math.max(n.hi, t)));
59
- }, M = (t, n) => {
60
- let r = T();
61
- if (h === null || !r || r.type !== "selection") return;
62
- let i = O(t, n);
59
+ i !== n.anchor && (n.anchor = i, g.dispatch(e.startColumnSelection(i, g.resolveFirstDataCell?.().row))), g.dispatch(e.updateColumnSelection(t < n.lo ? t : Math.max(n.hi, t)));
60
+ }, N = (t, n) => {
61
+ let r = E();
62
+ if (g === null || !r || r.type !== "selection") return;
63
+ let i = k(t, n);
63
64
  if (i) {
64
65
  if (r.selectionKind === "cell") {
65
- h.dispatch(e.updateSelection(i));
66
+ g.dispatch(e.updateSelection(i));
66
67
  return;
67
68
  }
68
69
  if (r.selectionKind === "row") {
69
- h.dispatch(e.updateRowSelection(i.row));
70
+ g.dispatch(e.updateRowSelection(i.row));
70
71
  return;
71
72
  }
72
- r.selectionKind === "col" && j(i.col);
73
+ r.selectionKind === "col" && M(i.col);
73
74
  }
74
- }, N = (t, n) => {
75
+ }, P = (t, n) => {
75
76
  let r = n.timeStamp;
76
- if (h === null) return;
77
- let { gridRootRef: i, dispatch: a, enableRangeSelection: o, enableRowSelection: s, onGutterRowSelect: c, onCellDoubleClickRef: l, resolveFirstDataCell: u } = h;
78
- i.current?.focus({ preventScroll: !0 }), h.endEditLeftOpen?.();
77
+ if (g === null) return;
78
+ let { gridRootRef: i, dispatch: a, enableRangeSelection: o, enableRowSelection: s, onGutterRowSelect: c, onCellDoubleClickRef: l, resolveFirstDataCell: u } = g;
79
+ i.current?.focus({ preventScroll: !0 }), g.endEditLeftOpen?.();
79
80
  let { target: d } = t;
80
81
  if (d.kind === "cell") {
81
- let t = y;
82
+ let t = b;
82
83
  if (t && t.cell.row === d.cell.row && t.cell.col === d.cell.col && r - t.time < 300) {
83
- y = null, l.current(d.cell, n);
84
+ b = null, l.current(d.cell, n);
84
85
  return;
85
86
  }
86
- y = {
87
+ b = {
87
88
  cell: d.cell,
88
89
  time: r
89
90
  }, a(e.activateCell(d.cell)), o && (a(e.startSelection(d.cell)), a(e.endSelection()));
90
91
  return;
91
92
  }
92
- if (y = null, d.kind === "row") {
93
+ if (b = null, d.kind === "row") {
93
94
  if (s) {
94
95
  c(d.rowIndex, { shiftKey: !1 });
95
96
  return;
@@ -98,50 +99,50 @@ var h = 10, g = 300, _ = () => {
98
99
  return;
99
100
  }
100
101
  a(e.startColumnSelection(d.colIndex, u?.().row)), d.lastColIndex !== void 0 && a(e.updateColumnSelection(d.lastColIndex)), a(e.endSelection());
101
- }, P = () => {
102
- h !== null && (_ = !1, k = null, h.dispatch(e.endSelection()), h.dispatch(e.endColumnResize()));
103
- }, F = (t) => {
104
- if (h === null) return;
105
- h.pointerClientRef.current = {
102
+ }, F = () => {
103
+ g !== null && (v = !1, A = null, g.dispatch(e.endSelection()), g.dispatch(e.endColumnResize()));
104
+ }, I = (t) => {
105
+ if (g === null) return;
106
+ g.pointerClientRef.current = {
106
107
  x: t.clientX,
107
108
  y: t.clientY
108
109
  };
109
- let n = T();
110
+ let n = E();
110
111
  if (n?.type === "columnResize") {
111
- (E === null || E.drag !== n) && (E = {
112
+ (D === null || D.drag !== n) && (D = {
112
113
  drag: n,
113
- x: p(h.scrollContainerRef.current).x
114
+ x: m(g.scrollContainerRef.current).x
114
115
  });
115
- let r = E.x === 1 ? t.clientX : n.startX + (t.clientX - n.startX) / E.x;
116
- h.dispatch(e.updateColumnResize(r));
116
+ let r = D.x === 1 ? t.clientX : n.startX + (t.clientX - n.startX) / D.x;
117
+ g.dispatch(e.updateColumnResize(r));
117
118
  }
118
- }, I = (e) => {
119
- let t = v;
120
- t && (v = null, e.pointerId === t.pointerId && Math.abs(e.clientX - t.x) < 10 && Math.abs(e.clientY - t.y) < 10 && N(t, e)), P();
121
- }, L = () => {
122
- v = null, P();
119
+ }, L = (e) => {
120
+ let t = y;
121
+ t && (y = null, e.pointerId === t.pointerId && Math.abs(e.clientX - t.x) < 10 && Math.abs(e.clientY - t.y) < 10 && P(t, e)), F();
123
122
  }, R = () => {
124
- g || (g = !0, window.addEventListener("pointermove", F), window.addEventListener("pointerup", I), window.addEventListener("pointercancel", L));
123
+ y = null, F();
125
124
  }, z = () => {
126
- g && (g = !1, window.removeEventListener("pointermove", F), window.removeEventListener("pointerup", I), window.removeEventListener("pointercancel", L));
125
+ _ || (_ = !0, window.addEventListener("pointermove", I), window.addEventListener("pointerup", L), window.addEventListener("pointercancel", R));
127
126
  }, B = () => {
128
- w = !1, h !== null && h.autoScrollFrameRef.current !== null && (cancelAnimationFrame(h.autoScrollFrameRef.current), h.autoScrollFrameRef.current = null);
127
+ _ && (_ = !1, window.removeEventListener("pointermove", I), window.removeEventListener("pointerup", L), window.removeEventListener("pointercancel", R));
129
128
  }, V = () => {
130
- if (h === null || !w) return;
131
- let { scrollContainerRef: e, pointerClientRef: t, autoScrollFrameRef: n } = h, r = e.current, i = t.current;
129
+ T = !1, g !== null && g.autoScrollFrameRef.current !== null && (cancelAnimationFrame(g.autoScrollFrameRef.current), g.autoScrollFrameRef.current = null);
130
+ }, H = () => {
131
+ if (g === null || !T) return;
132
+ let { scrollContainerRef: e, pointerClientRef: t, autoScrollFrameRef: n } = g, r = e.current, i = t.current;
132
133
  if (!r || !i) {
133
- n.current = requestAnimationFrame(V);
134
+ n.current = requestAnimationFrame(H);
134
135
  return;
135
136
  }
136
- if (!C) {
137
- let e = S;
138
- if (e && !l(e, i, 6)) {
139
- n.current = requestAnimationFrame(V);
137
+ if (!w) {
138
+ let e = C;
139
+ if (e && !u(e, i, 6)) {
140
+ n.current = requestAnimationFrame(H);
140
141
  return;
141
142
  }
142
- C = !0;
143
+ w = !0;
143
144
  }
144
- let a = r.getBoundingClientRect(), o = p(r, a), s = d({
145
+ let a = r.getBoundingClientRect(), o = m(r, a), s = f({
145
146
  rectLeft: a.left,
146
147
  rectTop: a.top,
147
148
  clientLeft: r.clientLeft,
@@ -149,36 +150,36 @@ var h = 10, g = 300, _ = () => {
149
150
  clientWidth: r.clientWidth,
150
151
  clientHeight: r.clientHeight,
151
152
  scale: o
152
- }), m = T(), g = m?.type === "selection" && m.selectionKind === "col", _ = m?.type === "selection" && m.selectionKind === "row", v = g ? 0 : u(i.y, f(s.top, (h.stickyTopHeight ?? 0) * o.y, 24), s.bottom - (h.footerHeight ?? 0), 24), y = _ ? 0 : u(i.x, s.left, s.right, 24), b = c(r.scrollTop, v, 18, r.scrollHeight - r.clientHeight), x = c(r.scrollLeft, y, 18, r.scrollWidth - r.clientWidth);
153
+ }), c = E(), h = c?.type === "selection" && c.selectionKind === "col", _ = c?.type === "selection" && c.selectionKind === "row", v = h ? 0 : d(i.y, p(s.top, (g.stickyTopHeight ?? 0) * o.y, 24), s.bottom - (g.footerHeight ?? 0), 24), y = _ ? 0 : d(i.x, s.left, s.right, 24), b = l(r.scrollTop, v, 18, r.scrollHeight - r.clientHeight), x = l(r.scrollLeft, y, 18, r.scrollWidth - r.clientWidth);
153
154
  (b !== r.scrollTop || x !== r.scrollLeft) && (r.scrollTo({
154
155
  top: b,
155
156
  left: x,
156
157
  behavior: "auto"
157
- }), M(i.x, i.y)), n.current = requestAnimationFrame(V);
158
- }, H = () => {
159
- let e = T()?.type === "selection";
160
- e && !w ? (w = !0, h !== null && (h.autoScrollFrameRef.current = requestAnimationFrame(V))) : !e && w && B();
158
+ }), N(i.x, i.y)), n.current = requestAnimationFrame(H);
161
159
  }, U = () => {
162
- if (x !== null) return;
160
+ let e = E()?.type === "selection";
161
+ e && !T ? (T = !0, g !== null && (g.autoScrollFrameRef.current = requestAnimationFrame(H))) : !e && T && V();
162
+ }, W = () => {
163
+ if (S !== null) return;
163
164
  let e = () => {
164
- if (!_ || h === null) {
165
- x = null;
165
+ if (!v || g === null) {
166
+ S = null;
166
167
  return;
167
168
  }
168
- let { scrollContainerRef: t, pointerClientRef: n, onGutterRowSelectDrag: r } = h, i = t.current, a = n.current;
169
+ let { scrollContainerRef: t, pointerClientRef: n, onGutterRowSelectDrag: r } = g, i = t.current, a = n.current;
169
170
  if (!i || !a) {
170
- x = requestAnimationFrame(e);
171
+ S = requestAnimationFrame(e);
171
172
  return;
172
173
  }
173
- if (!C) {
174
- let t = S;
175
- if (t && !l(t, a, 6)) {
176
- x = requestAnimationFrame(e);
174
+ if (!w) {
175
+ let t = C;
176
+ if (t && !u(t, a, 6)) {
177
+ S = requestAnimationFrame(e);
177
178
  return;
178
179
  }
179
- C = !0;
180
+ w = !0;
180
181
  }
181
- let o = i.getBoundingClientRect(), s = p(i, o), m = d({
182
+ let o = i.getBoundingClientRect(), s = m(i, o), c = f({
182
183
  rectLeft: o.left,
183
184
  rectTop: o.top,
184
185
  clientLeft: i.clientLeft,
@@ -186,165 +187,165 @@ var h = 10, g = 300, _ = () => {
186
187
  clientWidth: i.clientWidth,
187
188
  clientHeight: i.clientHeight,
188
189
  scale: s
189
- }), g = u(a.y, f(m.top, (h.stickyTopHeight ?? 0) * s.y, 24), m.bottom - (h.footerHeight ?? 0), 24), v = c(i.scrollTop, g, 18, i.scrollHeight - i.clientHeight);
190
- if (v !== i.scrollTop) {
190
+ }), h = d(a.y, p(c.top, (g.stickyTopHeight ?? 0) * s.y, 24), c.bottom - (g.footerHeight ?? 0), 24), _ = l(i.scrollTop, h, 18, i.scrollHeight - i.clientHeight);
191
+ if (_ !== i.scrollTop) {
191
192
  i.scrollTo({
192
- top: v,
193
+ top: _,
193
194
  left: i.scrollLeft,
194
195
  behavior: "auto"
195
196
  });
196
- let e = O(a.x, a.y);
197
+ let e = k(a.x, a.y);
197
198
  e && r(e.row);
198
199
  }
199
- x = requestAnimationFrame(e);
200
+ S = requestAnimationFrame(e);
200
201
  };
201
- x = requestAnimationFrame(e);
202
- }, W = (e, t) => {
203
- if (e.preventDefault(), h === null || e.button !== 0) return !1;
204
- let n = a(h).editingCell;
205
- return t.kind === "cell" && n !== null && n.row === t.cell.row && n.col === t.cell.col && h.orderedColumns[n.col]?.editor?.type === "custom" ? !1 : (b = e.pointerType, e.pointerType === "touch" ? (v = {
202
+ S = requestAnimationFrame(e);
203
+ }, G = (e, n) => {
204
+ if (e.preventDefault(), g === null || e.button !== 0) return !1;
205
+ let r = o(g).editingCell;
206
+ return n.kind === "cell" && r !== null && r.row === n.cell.row && r.col === n.cell.col && t(g.orderedColumns[r.col] ?? {}, "custom") ? !1 : (x = e.pointerType, e.pointerType === "touch" ? (y = {
206
207
  pointerId: e.pointerId,
207
208
  x: e.clientX,
208
209
  y: e.clientY,
209
- target: t
210
- }, !1) : (k = null, h.gridRootRef.current?.focus({ preventScroll: !0 }), h.endEditLeftOpen?.(), h.pointerClientRef.current = {
210
+ target: n
211
+ }, !1) : (A = null, g.gridRootRef.current?.focus({ preventScroll: !0 }), g.endEditLeftOpen?.(), g.pointerClientRef.current = {
211
212
  x: e.clientX,
212
213
  y: e.clientY
213
- }, S = {
214
+ }, C = {
214
215
  x: e.clientX,
215
216
  y: e.clientY
216
- }, C = !1, !0));
217
+ }, w = !1, !0));
217
218
  };
218
219
  return {
219
220
  update: (e) => {
220
- h = e, R(), H();
221
+ g = e, z(), U();
221
222
  },
222
- getCellCoordFromClientPoint: O,
223
- updateSelectionFromPointer: M,
223
+ getCellCoordFromClientPoint: k,
224
+ updateSelectionFromPointer: N,
224
225
  handleCellPointerDown: (t, n) => {
225
- if (!(!W(n, {
226
+ if (!(!G(n, {
226
227
  kind: "cell",
227
228
  cell: t
228
- }) || h === null)) {
229
- if (n.shiftKey && h.enableRangeSelection) {
230
- let { selection: n, activeCell: r } = a(h), i = n?.type === "cell" ? n.range.start : r;
229
+ }) || g === null)) {
230
+ if (n.shiftKey && g.enableRangeSelection) {
231
+ let { selection: n, activeCell: r } = o(g), i = n?.type === "cell" ? n.range.start : r;
231
232
  if (i) {
232
- h.dispatch(e.startSelection(i)), h.dispatch(e.updateSelection(t));
233
+ g.dispatch(e.startSelection(i)), g.dispatch(e.updateSelection(t));
233
234
  return;
234
235
  }
235
236
  }
236
- h.dispatch(e.activateCell(t)), h.enableRangeSelection && h.dispatch(e.startSelection(t));
237
+ g.dispatch(e.activateCell(t)), g.enableRangeSelection && g.dispatch(e.startSelection(t));
237
238
  }
238
239
  },
239
240
  handleCellDoubleClick: (e, t) => {
240
- b === "touch" || h === null || h.onCellDoubleClickRef.current(e, t);
241
+ x === "touch" || g === null || g.onCellDoubleClickRef.current(e, t);
241
242
  },
242
243
  handleCellPointerEnter: (t, n) => {
243
- if (h === null || (h.enableRowHover && h.setHoveredRowIndex(t.row), h.enableColumnHover && h.setHoveredColumnIndex(t.col), !h.enableRangeSelection)) return;
244
- let r = T();
245
- r?.type !== "selection" || r.selectionKind !== "cell" || (h.pointerClientRef.current = {
244
+ if (g === null || (g.enableRowHover && g.setHoveredRowIndex(t.row), g.enableColumnHover && g.setHoveredColumnIndex(t.col), !g.enableRangeSelection)) return;
245
+ let r = E();
246
+ r?.type !== "selection" || r.selectionKind !== "cell" || (g.pointerClientRef.current = {
246
247
  x: n.clientX,
247
248
  y: n.clientY
248
- }, h.dispatch(e.updateSelection(t)));
249
+ }, g.dispatch(e.updateSelection(t)));
249
250
  },
250
251
  handleNativeDragStart: (e) => {
251
252
  e.preventDefault();
252
253
  },
253
254
  handleRowHeaderPointerDown: (t, n) => {
254
- if (!(!W(n, {
255
+ if (!(!G(n, {
255
256
  kind: "row",
256
257
  rowIndex: t
257
- }) || h === null)) {
258
- if (h.enableRowSelection) {
259
- _ = !0, h.onGutterRowSelect(t, { shiftKey: n.shiftKey }), U();
258
+ }) || g === null)) {
259
+ if (g.enableRowSelection) {
260
+ v = !0, g.onGutterRowSelect(t, { shiftKey: n.shiftKey }), W();
260
261
  return;
261
262
  }
262
263
  if (n.shiftKey) {
263
- let { selection: n, activeCell: r } = a(h), i = n?.type === "row" ? n.startRow : r?.row;
264
+ let { selection: n, activeCell: r } = o(g), i = n?.type === "row" ? n.startRow : r?.row;
264
265
  if (i !== void 0) {
265
- h.dispatch(e.startRowSelection(i, h.resolveFirstDataCell?.().col)), h.dispatch(e.updateRowSelection(t));
266
+ g.dispatch(e.startRowSelection(i, g.resolveFirstDataCell?.().col)), g.dispatch(e.updateRowSelection(t));
266
267
  return;
267
268
  }
268
269
  }
269
- h.dispatch(e.startRowSelection(t, h.resolveFirstDataCell?.().col));
270
+ g.dispatch(e.startRowSelection(t, g.resolveFirstDataCell?.().col));
270
271
  }
271
272
  },
272
273
  handleRowHeaderPointerEnter: (t, n) => {
273
- if (h === null) return;
274
- if (h.enableRowHover && h.setHoveredRowIndex(t), _) {
275
- h.pointerClientRef.current = {
274
+ if (g === null) return;
275
+ if (g.enableRowHover && g.setHoveredRowIndex(t), v) {
276
+ g.pointerClientRef.current = {
276
277
  x: n.clientX,
277
278
  y: n.clientY
278
- }, h.onGutterRowSelectDrag(t);
279
+ }, g.onGutterRowSelectDrag(t);
279
280
  return;
280
281
  }
281
- let r = T();
282
- r?.type !== "selection" || r.selectionKind !== "row" || (h.pointerClientRef.current = {
282
+ let r = E();
283
+ r?.type !== "selection" || r.selectionKind !== "row" || (g.pointerClientRef.current = {
283
284
  x: n.clientX,
284
285
  y: n.clientY
285
- }, h.dispatch(e.updateRowSelection(t)));
286
+ }, g.dispatch(e.updateRowSelection(t)));
286
287
  },
287
- handleColumnHeaderPointerDown: (r, i) => {
288
- if (!(!W(i, {
288
+ handleColumnHeaderPointerDown: (t, i) => {
289
+ if (!(!G(i, {
289
290
  kind: "col",
290
- colIndex: r
291
- }) || h === null)) {
292
- if (i.shiftKey && h.enableSorting) {
293
- let i = h.orderedColumns[r];
294
- if (i && !n(i.key)) {
295
- let n = a(h).sort, r = n.find((e) => e.columnKey === i.key)?.direction ? "desc" : "asc", o = t(n, i.key, r, !0);
296
- h.dispatch(o.length === 0 ? e.clearSort() : e.setSort(o));
291
+ colIndex: t
292
+ }) || g === null)) {
293
+ if (i.shiftKey && g.enableSorting) {
294
+ let i = g.orderedColumns[t];
295
+ if (i && !r(i.key)) {
296
+ let t = o(g).sort, r = t.find((e) => e.columnKey === i.key)?.direction ? "desc" : "asc", a = n(t, i.key, r, !0);
297
+ g.dispatch(a.length === 0 ? e.clearSort() : e.setSort(a));
297
298
  }
298
299
  return;
299
300
  }
300
- h.dispatch(e.startColumnSelection(r, h.resolveFirstDataCell?.().row));
301
+ g.dispatch(e.startColumnSelection(t, g.resolveFirstDataCell?.().row));
301
302
  }
302
303
  },
303
304
  handleColumnHeaderPointerEnter: (e, t) => {
304
- if (h === null) return;
305
- h.setHoveredRowIndex(null), h.enableColumnHeaderHover && h.setHoveredColumnIndex(e);
306
- let n = T();
307
- n?.type !== "selection" || n.selectionKind !== "col" || (h.pointerClientRef.current = {
305
+ if (g === null) return;
306
+ g.setHoveredRowIndex(null), g.enableColumnHeaderHover && g.setHoveredColumnIndex(e);
307
+ let n = E();
308
+ n?.type !== "selection" || n.selectionKind !== "col" || (g.pointerClientRef.current = {
308
309
  x: t.clientX,
309
310
  y: t.clientY
310
- }, j(e));
311
+ }, M(e));
311
312
  },
312
313
  handleColumnGroupHeaderPointerDown: (t, n, r) => {
313
- if (!W(r, {
314
+ if (!G(r, {
314
315
  kind: "col",
315
316
  colIndex: t,
316
317
  lastColIndex: n
317
- }) || h === null) return;
318
- let { selection: i, activeCell: o } = a(h), s = i?.type === "cell" ? i.range.start.col : o?.col ?? null;
318
+ }) || g === null) return;
319
+ let { selection: i, activeCell: a } = o(g), s = i?.type === "cell" ? i.range.start.col : a?.col ?? null;
319
320
  if (r.shiftKey && (i?.type === "col" || s !== null)) {
320
- let r, a, o = A;
321
+ let r, a, o = j;
321
322
  if (i?.type === "col") {
322
323
  let e = Math.min(i.startCol, i.endCol), t = Math.max(i.startCol, i.endCol), n = o !== null && e <= o.lo && o.hi <= t && i.startCol >= o.lo && i.startCol <= o.hi;
323
324
  r = n ? o.lo : i.startCol, a = n ? o.hi : i.startCol;
324
- } else A = null, r = s ?? t, a = r;
325
+ } else j = null, r = s ?? t, a = r;
325
326
  let c = t < r, l = c ? Math.max(a, n) : Math.min(r, t), u = c ? t : Math.max(a, n);
326
- k = {
327
+ A = {
327
328
  lo: t,
328
329
  hi: n,
329
330
  anchor: l,
330
331
  fixedAnchor: l
331
- }, h.dispatch(e.startColumnSelection(l, h.resolveFirstDataCell?.().row)), h.dispatch(e.updateColumnSelection(u));
332
+ }, g.dispatch(e.startColumnSelection(l, g.resolveFirstDataCell?.().row)), g.dispatch(e.updateColumnSelection(u));
332
333
  return;
333
334
  }
334
- A = {
335
+ j = {
335
336
  lo: t,
336
337
  hi: n
337
- }, k = {
338
+ }, A = {
338
339
  lo: t,
339
340
  hi: n,
340
341
  anchor: t,
341
342
  fixedAnchor: null
342
- }, h.dispatch(e.startColumnSelection(t, h.resolveFirstDataCell?.().row)), h.dispatch(e.updateColumnSelection(n));
343
+ }, g.dispatch(e.startColumnSelection(t, g.resolveFirstDataCell?.().row)), g.dispatch(e.updateColumnSelection(n));
343
344
  },
344
345
  dispose: () => {
345
- z(), B(), x !== null && (cancelAnimationFrame(x), x = null);
346
+ B(), V(), S !== null && (cancelAnimationFrame(S), S = null);
346
347
  }
347
348
  };
348
349
  };
349
350
  //#endregion
350
- export { g as TOUCH_DOUBLE_TAP_MS, h as TOUCH_TAP_SLOP_PX, _ as createPointerInteractionsController };
351
+ export { _ as TOUCH_DOUBLE_TAP_MS, g as TOUCH_TAP_SLOP_PX, v as createPointerInteractionsController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/elementScale.cjs"),i=require("./escapeClaimController.cjs"),a=require("../logic/slotDom.cjs"),o=require("../utils/portalTokens.cjs"),s=require("../utils/popupContainer.cjs");var c=14,l=12,u=`0.5`,d=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,f=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=`transform 160ms ${m}`,g=`data-ssg-row-dragging`,_=e=>e?.closest(`.ssg-motion-off`)!=null,v=/translateY\((-?[\d.]+)px\)/,y=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},b=e=>{let n=[],r=new Map;return e.querySelectorAll(`.ssg-detail-band[data-detail-row-index]`).forEach(i=>{if(t.isInsideDetailCardOf(e,i))return;let a=Number(i.getAttribute(`data-detail-row-index`)),o=r.get(a)??0;r.set(a,o+1),n.push({el:i,index:a,key:`band|${o}|${a}`})}),n},x=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},S=`data-row-key`,C=(e,t)=>{let n=e.getAttribute(S);if(n===t.key)return!0;let r=v.exec(e.style.transform);return r?(t.index=Number(e.getAttribute(`data-row-index`)),t.baseY=parseFloat(r[1]),t.key=n,t.applied=void 0,!0):!1},w=e=>{let t=v.exec(e.style.transform);return t?{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1]),key:e.getAttribute(S)}:null},T=()=>{let T=null,E=null,D=null,O=null,k=(e,t)=>{let n=T?.canDropAt;if(!n)return!0;if(O!==null&&O.from===e&&O.slot===t)return O.allowed;let r=n(e,t);return O={from:e,slot:t,allowed:r},r},A={x:0,y:0},j=null,M=!1,N=null,P=null,F=null,I=null,L=null,R=null,z=0,B=null,V=()=>T?.motion===`live`,H=null,U=null,W=null,G=()=>[T?.leftIndicatorRef.current??null,T?.centerIndicatorRef.current??null,T?.rightIndicatorRef.current??null],K=()=>{for(let e of G())e&&(e.style.display=`none`)},ee=e=>{if(H)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),T?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),T?.scrollContainerRef.current?.closest(`.ssg-theme-class`)!=null&&t.classList.add(`ssg-theme-class`),T?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),a.applySlotToElement(t,T?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let r=document.createElement(`span`);r.style.cssText=`overflow:hidden;text-overflow:ellipsis`,r.textContent=e,t.appendChild(n),t.appendChild(r),s.appendToPopupContainer(t,s.getPopupContainerFor(T?.scrollContainerRef.current)),o.syncPortalTokens(T?.scrollContainerRef.current,t),H=t,U=n,W=null},te=e=>{let t=H;if(!t)return;t.style.transform=`translate(`+(A.x+c)+`px,`+(A.y+l)+`px)`;let n=e?`move`:`out`;if(W===n)return;W=n;let r=U;n===`out`?(t.style.opacity=u,r&&(r.innerHTML=f)):(t.style.opacity=`1`,r&&(r.innerHTML=d))},q=()=>{H&&H.parentNode&&H.parentNode.removeChild(H),H=null,U=null,W=null},J=(e,n)=>{let r=T?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${g}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(g,V()?`live`:``):e.removeAttribute(g))})},ne=()=>{let e=T?.scrollContainerRef.current??null;if(!e||E===null)return;let n=String(E),r=V()?`live`:``;e.querySelectorAll(`.ssg-body-row[${g}]`).forEach(r=>{r.getAttribute(`data-row-index`)!==n&&!t.isInsideDetailCardOf(e,r)&&r.removeAttribute(g)}),e.querySelectorAll(`.ssg-body-row[data-row-index="${n}"]`).forEach(n=>{n.getAttribute(g)!==r&&!t.isInsideDetailCardOf(e,n)&&n.setAttribute(g,r)})},re=()=>{let e=T?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e)){let e=w(n);e&&t.set(n,e)}return t},ie=t=>{let n=R,r=E;if(!n||r===null||T===null)return;let i=T.scrollContainerRef.current;if(!i)return;for(let e of y(i)){if(n.has(e))continue;let t=w(e);t&&n.set(e,t)}let a=T.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-z)*T.verticalScaleFactor,s=(j?A.y-j.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{if(!t.isConnected||!C(t,e)){n.delete(t);return}let{index:i,baseY:o}=e;if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=h,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=B??new Set;B=l;for(let{el:e,index:t}of b(i)){if(l.add(e),t===r){e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,e.style.zIndex=`10`;continue}let n=0;c!==null&&(r<t&&t<=c?n=-a:c<=t&&t<r&&(n=a)),e.style.transition=h,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},ae=(t,r)=>{if(T===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=T,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYBelowHeader(n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,T.footerHeight??0),f.top+u.clientTop,T.stickyTopHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=E,v=_!==null&&V()?o.detailHeight(_):0;if(_!==null&&v>0){let t=e.resolveRowDropSlot(h+v,o);t>_+1&&(g=t)}let y=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+y-l}},Y=()=>{let t=ae(A.x,A.y),n=E;if(V()){t&&n!==null&&(e.resolveMoveTargetIndex(n,t.slot)===null?D=null:k(n,t.slot)&&(D=t.slot)),K(),ie(D);return}let r=t!==null&&n!==null&&e.resolveMoveTargetIndex(n,t.slot)!==null&&!k(n,t.slot);if(te(r?null:t),!t||n===null||r||e.resolveMoveTargetIndex(n,t.slot)===null){D=null,K();return}D=t.slot;for(let e of G())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},X=()=>{if(E===null){F=null;return}let e=T?.scrollContainerRef.current??null;if(e&&(M||(!j||n.hasPointerLeftActivationRadius(j,A,6))&&(M=!0),M)){let t=e.getBoundingClientRect(),i=r.resolveElementScale(e,t),a=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scale:i}),o=n.resolveAutoScrollAxisDirection(A.y,n.resolveTopAutoScrollStart(a.top,(T?.stickyTopHeight??0)*i.y,24),a.bottom-(T?.footerHeight??0),24),s=n.computeNextScrollPosition(e.scrollTop,o,18,e.scrollHeight-e.clientHeight);s!==e.scrollTop&&e.scrollTo({top:s,behavior:`auto`})}ne(),Y(),F=requestAnimationFrame(X)},Z=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,Q=()=>{let e=T?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e))t.set(Z(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of b(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},$=t=>{F!==null&&(cancelAnimationFrame(F),F=null),document.body.style.cursor=``,K(),q();let n=E,r=D,i=L;J(n,!1),E=null,L=null,D=null,j=null,P=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=a!==null&&n!==null&&r!==null&&t&&!k(n,r)?null:a;O=null;let s=t&&n!==null&&o!==null&&T!==null,c=R;R=null,c?.forEach((e,t)=>{t.isConnected&&!C(t,e)&&c.delete(t)});let l=c&&s&&T!==null&&!_(T.scrollContainerRef.current)?Q():null,u=B;if(B=null,u&&(s?u.forEach(x):(u.forEach(e=>{e.isConnected&&(e.style.transition=h,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{u.forEach(e=>{B?.has(e)||x(e)})},200))),c)if(s)c.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];c.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=h,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!s||n===null||o===null||T===null)return;let d=l??(_(T.scrollContainerRef.current)?null:Q()),f=d?{tops:d,from:n,to:o,row:i}:null;I=f,T.commitRowMove(n,o),f&&requestAnimationFrame(()=>{I===f&&(I=null)})},oe=()=>{let e=I;if(I=null,!e)return;let t=T?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(T?.locateDragRow&&e.row!==null&&T.locateDragRow(e.row,i)!==i)return;let a=e=>e===i?r:r<i&&e>=r&&e<i?e+1:i<r&&e>i&&e<=r?e-1:e,o=[],s=new Map;y(t).forEach(e=>{let t=n.get(Z(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=v.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)});let c=[];if(b(t).forEach(({el:e,index:t,key:r})=>{let i=a(t),o=n.get(r.slice(0,r.lastIndexOf(`|`)+1)+i);if(o===void 0)return;let s=o-e.getBoundingClientRect().top;Math.abs(s)<.5||(e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,c.push(e))}),!(o.length===0&&c.length===0)){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)B?.has(e)||x(e)},280)}},se=(e,t)=>{if(T===null||!T.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),T.gridRootRef?.current?.focus({preventScroll:!0}),T.endEditLeftOpen?.(),E!==null){if(t.pointerId!==P)return;N?.(),$(!1)}E=e,L=T.getDragRow?.(e)??null,P=t.pointerId,D=null,A={x:t.clientX,y:t.clientY},j={x:t.clientX,y:t.clientY},M=!1,document.body.style.cursor=`grabbing`,V()?(R=re(),z=T.scrollContainerRef.current?.scrollTop??0):ee(T.getRowDragLabel(e)),J(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let a=e=>{e.pointerId===r&&(A={x:e.clientX,y:e.clientY},Y())},o=i.beginEscapeCancelableDrag(),s=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,l),window.removeEventListener(`keydown`,u,!0),window.removeEventListener(`blur`,d),o(),N=null;try{n.releasePointerCapture(r)}catch{}};function c(e){e.pointerId===r&&(s(),$(!0))}function l(e){e.pointerId===r&&(s(),$(!1))}function u(e){e.key===`Escape`&&(s(),$(!1))}function d(){s(),$(!1)}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,l),window.addEventListener(`keydown`,u,!0),window.addEventListener(`blur`,d),N=s,Y(),F=requestAnimationFrame(X)},ce=e=>{if(E===null||L==null||T?.locateDragRow===void 0)return;let t=T.locateDragRow(L,E);if(R&&R.forEach((e,t)=>{if(!t.isConnected){R?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`)),r=t.getAttribute(S);if(n===e.index&&r===e.key&&(e.applied===void 0||t.style.transform===e.applied))return;let i=v.exec(t.style.transform);if(!i){R?.delete(t);return}e.index=n,e.baseY=parseFloat(i[1]),e.key=r,e.applied=void 0}),t===null){N?.(),$(!1);return}R&&t!==E&&j!==null&&e!==null&&(j={x:j.x,y:j.y+T.rowMetrics.rowTop(t)-e.rowTop(E)}),t!==E&&(J(null,!1),E=t,J(t,!0)),Y()};return{update:e=>{let t=T;T=e,t?.canDropAt!==e.canDropAt&&(O=null),E!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&ce(t.rowMetrics)},onRowDragHandlePointerDown:se,applyReorderSettle:oe,dispose:()=>{N?.(),N=null,F!==null&&(cancelAnimationFrame(F),F=null),document.body.style.cursor=``,q(),J(E,!1),E=null,L=null,D=null,O=null,R=null,B?.forEach(x),B=null,I=null}}};exports.createRowDragController=T;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/rowReorder.cjs"),t=require("../logic/detailRow.cjs"),n=require("../logic/autoScrollGeometry.cjs"),r=require("../logic/elementScale.cjs"),i=require("./escapeClaimController.cjs"),a=require("../logic/slotDom.cjs"),o=require("../utils/portalTokens.cjs"),s=require("../utils/popupContainer.cjs");var c=14,l=12,u=`0.5`,d=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="8 6 12 2 16 6"/><polyline points="16 18 12 22 8 18"/><line x1="12" y1="2" x2="12" y2="22"/></svg>`,f=`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="4.9" y1="4.9" x2="19.1" y2="19.1"/></svg>`,p=200,m=`cubic-bezier(0.2, 0.7, 0.3, 1)`,h=`transform 160ms ${m}`,g=`data-ssg-row-dragging`,_=e=>e?.closest(`.ssg-motion-off`)!=null,v=/translateY\((-?[\d.]+)px\)/,y=e=>{let n=[];return e.querySelectorAll(`.ssg-body-row[data-row-index]`).forEach(r=>{t.isInsideDetailCardOf(e,r)||n.push(r)}),n},b=e=>{let n=[],r=new Map;return e.querySelectorAll(`.ssg-detail-band[data-detail-row-index]`).forEach(i=>{if(t.isInsideDetailCardOf(e,i))return;let a=Number(i.getAttribute(`data-detail-row-index`)),o=r.get(a)??0;r.set(a,o+1),n.push({el:i,index:a,key:`band|${o}|${a}`})}),n},x=e=>{e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.zIndex=``},S=`data-row-key`,C=(e,t)=>{let n=e.getAttribute(S);if(n===t.key)return!0;let r=v.exec(e.style.transform);return r?(t.index=Number(e.getAttribute(`data-row-index`)),t.baseY=parseFloat(r[1]),t.key=n,t.applied=void 0,!0):!1},w=e=>{let t=v.exec(e.style.transform);return t?{index:Number(e.getAttribute(`data-row-index`)),baseY:parseFloat(t[1]),key:e.getAttribute(S)}:null},T=()=>{let T=null,E=null,D=null,O=null,k=(e,t)=>{let n=T?.canDropAt;if(!n)return!0;if(O!==null&&O.from===e&&O.slot===t)return O.allowed;let r=n(e,t);return O={from:e,slot:t,allowed:r},r},A={x:0,y:0},j=null,M=!1,N=null,P=null,F=null,I=null,L=null,R=null,z=0,B=null,V=()=>T?.motion===`live`,H=null,U=null,W=null,G=()=>[T?.leftIndicatorRef.current??null,T?.centerIndicatorRef.current??null,T?.rightIndicatorRef.current??null],K=()=>{for(let e of G())e&&(e.style.display=`none`)},ee=e=>{if(H)return;let t=document.createElement(`div`);t.setAttribute(`data-grid-drag-ghost`,``),T?.scrollContainerRef.current?.closest(`.ssg-theme-dark`)!=null&&t.classList.add(`ssg-theme-dark`),T?.scrollContainerRef.current?.closest(`.ssg-theme-class`)!=null&&t.classList.add(`ssg-theme-class`),T?.scrollContainerRef.current?.closest(`.ssg-motion-off`)!=null&&t.classList.add(`ssg-motion-off`),t.style.cssText=[`position:fixed`,`top:0`,`left:0`,`display:inline-flex`,`align-items:center`,`gap:7px`,`padding:7px 12px 7px 10px`,`border-radius:9px`,`border:1px solid var(--ssg-ghost-border)`,`background:var(--ssg-ghost-bg)`,`color:var(--ssg-ghost-text)`,`font-size:12px`,`font-weight:600`,`line-height:1`,`white-space:nowrap`,`max-width:280px`,`overflow:hidden`,`text-overflow:ellipsis`,`box-shadow:var(--ssg-ghost-shadow)`,`pointer-events:none`,`user-select:none`,`z-index:9999`,`will-change:transform`,`transform:translate(-9999px,-9999px)`].join(`;`),a.applySlotToElement(t,T?.ghostSlot);let n=document.createElement(`span`);n.style.cssText=`display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none`;let r=document.createElement(`span`);r.style.cssText=`overflow:hidden;text-overflow:ellipsis`,r.textContent=e,t.appendChild(n),t.appendChild(r),s.appendToPopupContainer(t,s.getPopupContainerFor(T?.scrollContainerRef.current)),o.syncPortalTokens(T?.scrollContainerRef.current,t),H=t,U=n,W=null},te=e=>{let t=H;if(!t)return;t.style.transform=`translate(`+(A.x+c)+`px,`+(A.y+l)+`px)`;let n=e?`move`:`out`;if(W===n)return;W=n;let r=U;n===`out`?(t.style.opacity=u,r&&(r.innerHTML=f)):(t.style.opacity=`1`,r&&(r.innerHTML=d))},q=()=>{H&&H.parentNode&&H.parentNode.removeChild(H),H=null,U=null,W=null},J=(e,n)=>{let r=T?.scrollContainerRef.current??null;!r||n&&e===null||r.querySelectorAll(n?`.ssg-body-row[data-row-index="${e}"]`:`.ssg-body-row[${g}]`).forEach(e=>{t.isInsideDetailCardOf(r,e)||(n?e.setAttribute(g,V()?`live`:``):e.removeAttribute(g))})},ne=()=>{let e=T?.scrollContainerRef.current??null;if(!e||E===null)return;let n=String(E),r=V()?`live`:``;e.querySelectorAll(`.ssg-body-row[${g}]`).forEach(r=>{r.getAttribute(`data-row-index`)!==n&&!t.isInsideDetailCardOf(e,r)&&r.removeAttribute(g)}),e.querySelectorAll(`.ssg-body-row[data-row-index="${n}"]`).forEach(n=>{n.getAttribute(g)!==r&&!t.isInsideDetailCardOf(e,n)&&n.setAttribute(g,r)})},re=()=>{let e=T?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e)){let e=w(n);e&&t.set(n,e)}return t},ie=t=>{let n=R,r=E;if(!n||r===null||T===null)return;let i=T.scrollContainerRef.current;if(!i)return;for(let e of y(i)){if(n.has(e))continue;let t=w(e);t&&n.set(e,t)}let a=T.rowMetrics.rowsHeight(r,r),o=(i.scrollTop-z)*T.verticalScaleFactor,s=(j?A.y-j.y:0)+o,c=t===null?null:e.resolveMoveTargetIndex(r,t);n.forEach((e,t)=>{if(!t.isConnected||!C(t,e)){n.delete(t);return}let{index:i,baseY:o}=e;if(i===r){t.style.transition=`none`,t.style.transform=`translateY(${o+s}px)`,t.style.willChange=`transform`,e.applied=t.style.transform;return}let l=0;c!==null&&(r<i&&i<=c?l=-a:c<=i&&i<r&&(l=a)),t.style.transition=h,t.style.transform=`translateY(${o+l}px)`,e.applied=t.style.transform});let l=B??new Set;B=l;for(let{el:e,index:t}of b(i)){if(l.add(e),t===r){e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,e.style.zIndex=`10`;continue}let n=0;c!==null&&(r<t&&t<=c?n=-a:c<=t&&t<r&&(n=a)),e.style.transition=h,e.style.transform=`translateY(${n}px)`,e.style.zIndex=``}},ae=(t,r)=>{if(T===null)return null;let{scrollContainerRef:i,bodyScrollRef:a,rowMetrics:o,headerHeight:s,verticalScaleFactor:c,windowBaseOffsetPx:l}=T,u=i.current,d=a.current;if(!u||!d)return null;let f=u.getBoundingClientRect();if(t<f.left||t>f.right||r<f.top||r>f.bottom)return null;let p=n.clampClientYBelowHeader(n.clampClientYAboveFooter(r,f.top+u.clientTop+u.clientHeight,T.footerHeight??0),f.top+u.clientTop,T.stickyTopHeight??0),m=d.getBoundingClientRect(),h=d.scrollTop+p-m.top-s-u.scrollTop*(1-c),g=e.resolveRowDropSlot(h,o),_=E,v=_!==null&&V()?o.detailHeight(_):0;if(_!==null&&v>0){let t=e.resolveRowDropSlot(h+v,o);t>_+1&&(g=t)}T.maxDropSlot!==void 0&&g>T.maxDropSlot&&(g=T.maxDropSlot);let y=e.resolveRowDropSlotTop(g,o);return{slot:g,top:s+y-l}},Y=()=>{let t=ae(A.x,A.y),n=E;if(V()){t&&n!==null&&(e.resolveMoveTargetIndex(n,t.slot)===null?D=null:k(n,t.slot)&&(D=t.slot)),K(),ie(D);return}let r=t!==null&&n!==null&&e.resolveMoveTargetIndex(n,t.slot)!==null&&!k(n,t.slot);if(te(r?null:t),!t||n===null||r||e.resolveMoveTargetIndex(n,t.slot)===null){D=null,K();return}D=t.slot;for(let e of G())e&&(e.style.top=`${t.top}px`,e.style.display=`block`)},X=()=>{if(E===null){F=null;return}let e=T?.scrollContainerRef.current??null;if(e&&(M||(!j||n.hasPointerLeftActivationRadius(j,A,6))&&(M=!0),M)){let t=e.getBoundingClientRect(),i=r.resolveElementScale(e,t),a=n.resolveScrollContentBox({rectLeft:t.left,rectTop:t.top,clientLeft:e.clientLeft,clientTop:e.clientTop,clientWidth:e.clientWidth,clientHeight:e.clientHeight,scale:i}),o=n.resolveAutoScrollAxisDirection(A.y,n.resolveTopAutoScrollStart(a.top,(T?.stickyTopHeight??0)*i.y,24),a.bottom-(T?.footerHeight??0),24),s=n.computeNextScrollPosition(e.scrollTop,o,18,e.scrollHeight-e.clientHeight);s!==e.scrollTop&&e.scrollTo({top:s,behavior:`auto`})}ne(),Y(),F=requestAnimationFrame(X)},Z=(e,t)=>`${e.getAttribute(`data-pane`)??``}|${t}`,Q=()=>{let e=T?.scrollContainerRef.current??null;if(!e)return null;let t=new Map;for(let n of y(e))t.set(Z(n,Number(n.getAttribute(`data-row-index`))),n.getBoundingClientRect().top);for(let n of b(e))t.set(n.key,n.el.getBoundingClientRect().top);return t},$=t=>{F!==null&&(cancelAnimationFrame(F),F=null),document.body.style.cursor=``,K(),q();let n=E,r=D,i=L;J(n,!1),E=null,L=null,D=null,j=null,P=null;let a=n===null||r===null?null:e.resolveMoveTargetIndex(n,r),o=a!==null&&n!==null&&r!==null&&t&&!k(n,r)?null:a;O=null;let s=t&&n!==null&&o!==null&&T!==null,c=R;R=null,c?.forEach((e,t)=>{t.isConnected&&!C(t,e)&&c.delete(t)});let l=c&&s&&T!==null&&!_(T.scrollContainerRef.current)?Q():null,u=B;if(B=null,u&&(s?u.forEach(x):(u.forEach(e=>{e.isConnected&&(e.style.transition=h,e.style.transform=`translateY(0px)`,e.style.zIndex=``)}),window.setTimeout(()=>{u.forEach(e=>{B?.has(e)||x(e)})},200))),c)if(s)c.forEach(({baseY:e},t)=>{t.style.transition=``,t.style.willChange=``,t.isConnected&&(t.style.transform=`translateY(${e}px)`)});else{let e=[];c.forEach(({baseY:t},n)=>{n.isConnected&&(n.style.transition=h,n.style.transform=`translateY(${t}px)`,e.push(n))}),window.setTimeout(()=>{for(let t of e)t.style.transition=``,t.style.willChange=``},200)}if(!s||n===null||o===null||T===null)return;let d=l??(_(T.scrollContainerRef.current)?null:Q()),f=d?{tops:d,from:n,to:o,row:i}:null;I=f,T.commitRowMove(n,o),f&&requestAnimationFrame(()=>{I===f&&(I=null)})},oe=()=>{let e=I;if(I=null,!e)return;let t=T?.scrollContainerRef.current??null;if(!t)return;let{tops:n,from:r,to:i}=e;if(T?.locateDragRow&&e.row!==null&&T.locateDragRow(e.row,i)!==i)return;let a=e=>e===i?r:r<i&&e>=r&&e<i?e+1:i<r&&e>i&&e<=r?e-1:e,o=[],s=new Map;y(t).forEach(e=>{let t=n.get(Z(e,a(Number(e.getAttribute(`data-row-index`)))));if(t===void 0)return;let r=t-e.getBoundingClientRect().top;if(Math.abs(r)<.5)return;let i=v.exec(e.style.transform);if(!i)return;let c=parseFloat(i[1]);s.set(e,c),e.style.transition=`none`,e.style.transform=`translateY(${c+r}px)`,e.style.willChange=`transform`,o.push(e)});let c=[];if(b(t).forEach(({el:e,index:t,key:r})=>{let i=a(t),o=n.get(r.slice(0,r.lastIndexOf(`|`)+1)+i);if(o===void 0)return;let s=o-e.getBoundingClientRect().top;Math.abs(s)<.5||(e.style.transition=`none`,e.style.transform=`translateY(${s}px)`,e.style.willChange=`transform`,c.push(e))}),!(o.length===0&&c.length===0)){t.getBoundingClientRect();for(let e of o)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(${s.get(e)??0}px)`;for(let e of c)e.style.transition=`transform ${p}ms ${m}`,e.style.transform=`translateY(0px)`;window.setTimeout(()=>{for(let e of o)e.style.transition=``,e.style.willChange=``;for(let e of c)B?.has(e)||x(e)},280)}},se=(e,t)=>{if(T===null||!T.enabled||t.button!==0)return;if(t.stopPropagation(),t.preventDefault(),T.gridRootRef?.current?.focus({preventScroll:!0}),T.endEditLeftOpen?.(),E!==null){if(t.pointerId!==P)return;N?.(),$(!1)}E=e,L=T.getDragRow?.(e)??null,P=t.pointerId,D=null,A={x:t.clientX,y:t.clientY},j={x:t.clientX,y:t.clientY},M=!1,document.body.style.cursor=`grabbing`,V()?(R=re(),z=T.scrollContainerRef.current?.scrollTop??0):ee(T.getRowDragLabel(e)),J(e,!0);let n=t.currentTarget,r=t.pointerId;try{n.setPointerCapture(r)}catch{}let a=e=>{e.pointerId===r&&(A={x:e.clientX,y:e.clientY},Y())},o=i.beginEscapeCancelableDrag(),s=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,l),window.removeEventListener(`keydown`,u,!0),window.removeEventListener(`blur`,d),o(),N=null;try{n.releasePointerCapture(r)}catch{}};function c(e){e.pointerId===r&&(s(),$(!0))}function l(e){e.pointerId===r&&(s(),$(!1))}function u(e){e.key===`Escape`&&(s(),$(!1))}function d(){s(),$(!1)}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,l),window.addEventListener(`keydown`,u,!0),window.addEventListener(`blur`,d),N=s,Y(),F=requestAnimationFrame(X)},ce=e=>{if(E===null||L==null||T?.locateDragRow===void 0)return;let t=T.locateDragRow(L,E);if(R&&R.forEach((e,t)=>{if(!t.isConnected){R?.delete(t);return}let n=Number(t.getAttribute(`data-row-index`)),r=t.getAttribute(S);if(n===e.index&&r===e.key&&(e.applied===void 0||t.style.transform===e.applied))return;let i=v.exec(t.style.transform);if(!i){R?.delete(t);return}e.index=n,e.baseY=parseFloat(i[1]),e.key=r,e.applied=void 0}),t===null){N?.(),$(!1);return}R&&t!==E&&j!==null&&e!==null&&(j={x:j.x,y:j.y+T.rowMetrics.rowTop(t)-e.rowTop(E)}),t!==E&&(J(null,!1),E=t,J(t,!0)),Y()};return{update:e=>{let t=T;T=e,t?.canDropAt!==e.canDropAt&&(O=null),E!==null&&t!==null&&t.locateDragRow!==e.locateDragRow&&ce(t.rowMetrics)},onRowDragHandlePointerDown:se,applyReorderSettle:oe,dispose:()=>{N?.(),N=null,F!==null&&(cancelAnimationFrame(F),F=null),document.body.style.cursor=``,q(),J(E,!1),E=null,L=null,D=null,O=null,R=null,B?.forEach(x),B=null,I=null}}};exports.createRowDragController=T;
@@ -25,6 +25,7 @@ export type RowDragArgs = {
25
25
  gridRootRef?: ReadonlyRef<HTMLElement | null>;
26
26
  endEditLeftOpen?: (() => void) | undefined;
27
27
  canDropAt?: (fromIndex: number, slot: number) => boolean;
28
+ maxDropSlot?: number | undefined;
28
29
  };
29
30
  export type RowDragHandlePointerEvent = {
30
31
  button: number;
@@ -169,6 +169,7 @@ var h = 14, g = 12, _ = "0.5", v = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
169
169
  let e = t(h + v, c);
170
170
  e > _ + 1 && (g = e);
171
171
  }
172
+ A.maxDropSlot !== void 0 && g > A.maxDropSlot && (g = A.maxDropSlot);
172
173
  let y = n(g, c);
173
174
  return {
174
175
  slot: g,
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/valueStore.cjs"),t=require("../logic/chunkedLoop.cjs"),n=require("../logic/selectOptions.cjs");var r=5e4,i=[],a=new Set,o={status:`idle`,options:i,allValues:a,progress:0},s={status:`collecting`,options:i,allValues:a,progress:0},c=e=>new Set(e.map(e=>e.value)),l=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,u=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},d=(e,t,r,i=!1)=>{if(!e||!u(e))return o;let a=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(a)return{status:`ready`,options:a,allValues:c(a),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r,i);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},f={source:null,rowCount:0,result:o},p=(e,t,n,r)=>e.source===n&&e.rowCount===t||r!==void 0&&e.sourceKey===r&&e.result.status===`ready`?e.result:s,m=()=>{let r=e.createValueStore(f),o=null,s=null,l=null,u=e=>{let{getRawValueAt:f,rowCount:p,sourceKey:m}=e,h=n.createSelectOptionsAccumulator(e.numeric===!0),g=!1,_=()=>{g=!0};s=_,l=e,t.runChunked(p,e=>h.collect(f(e)),{isCancelled:()=>g,onYield:(e,t)=>{let n=r.getSnapshot();m!==void 0&&n.sourceKey===m&&n.result.status===`ready`||n.source===f&&n.rowCount===p&&n.result.status===`ready`||r.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`collecting`,options:i,allValues:a,progress:e/t}})}}).then(t=>{if(s===_&&(s=null,l=null),!t)return;let n=h.finalize();r.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`ready`,options:n,allValues:c(n),progress:1}}),o!==null&&o!==e&&o.needsAsync&&d(o,e)&&u(o)})},d=(e,t)=>e.rowCount!==t.rowCount||e.getRawValueAt!==t.getRawValueAt||e.numeric!==t.numeric;return{update:e=>{let t=o===null||o.needsAsync!==e.needsAsync||o.rowCount!==e.rowCount||o.getRawValueAt!==e.getRawValueAt||o.numeric!==e.numeric;if(o=e,!t||e.needsAsync&&l!==null&&s!==null&&e.sourceKey!==void 0&&l.sourceKey===e.sourceKey&&l.numeric===e.numeric)return;if(s?.(),s=null,l=null,e.needsAsync){u(e);return}let n=r.getSnapshot();n.sourceKey!==void 0&&r.setSnapshot({...n,sourceKey:void 0})},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s!==null&&(s(),s=null,l=null,o=null)}}};exports.ASYNC_SELECT_COLLECT_ROW_THRESHOLD=r,exports.IDLE_SELECT_OPTIONS_RESULT=o,exports.createSelectOptionsCollector=m,exports.isSelectLikeFilterType=l,exports.resolveSyncSelectOptions=d,exports.selectCollectorResult=p;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/multiSelect.cjs"),t=require("../logic/valueStore.cjs"),n=require("../logic/chunkedLoop.cjs"),r=require("../logic/selectOptions.cjs");var i=5e4,a=[],o=new Set,s={status:`idle`,options:a,allValues:o,progress:0},c={status:`collecting`,options:a,allValues:o,progress:0},l=e=>new Set(e.map(e=>e.value)),u=e=>e===`select`||e===`set`||e===`numberSet`||e===`textSet`||e===`dateSet`,d=e=>{let t=e?.filterType??null;return t===`select`||t===`set`||t===`numberSet`||t===`textSet`||t===`dateSet`},f=(t,n,i,a=!1)=>{if(!t||!d(t))return s;let o=t.filterOptions&&t.filterOptions.length>0?t.filterOptions:null;if(o)return{status:`ready`,options:o,allValues:l(o),progress:1};if(n<=5e4){let o=r.collectSelectOptions(n,i,a,e.resolveMultiSelectFilterOptions(t));return{status:`ready`,options:o,allValues:l(o),progress:1}}return null},p={source:null,rowCount:0,result:s},m=(e,t,n,r)=>e.source===n&&e.rowCount===t||r!==void 0&&e.sourceKey===r&&e.result.status===`ready`?e.result:c,h=()=>{let e=t.createValueStore(p),i=null,s=null,c=null,u=t=>{let{getRawValueAt:f,rowCount:p,sourceKey:m}=t,h=r.createSelectOptionsAccumulator(t.numeric===!0,t.multiOptions),g=!1,_=()=>{g=!0};s=_,c=t,n.runChunked(p,e=>h.collect(f(e)),{isCancelled:()=>g,onYield:(t,n)=>{let r=e.getSnapshot();m!==void 0&&r.sourceKey===m&&r.result.status===`ready`||r.source===f&&r.rowCount===p&&r.result.status===`ready`||e.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`collecting`,options:a,allValues:o,progress:t/n}})}}).then(n=>{if(s===_&&(s=null,c=null),!n)return;let r=h.finalize();e.setSnapshot({source:f,rowCount:p,sourceKey:m,result:{status:`ready`,options:r,allValues:l(r),progress:1}}),i!==null&&i!==t&&i.needsAsync&&d(i,t)&&u(i)})},d=(e,t)=>e.rowCount!==t.rowCount||e.getRawValueAt!==t.getRawValueAt||e.numeric!==t.numeric||e.multiOptions!==t.multiOptions;return{update:t=>{let n=i===null||i.needsAsync!==t.needsAsync||i.rowCount!==t.rowCount||i.getRawValueAt!==t.getRawValueAt||i.numeric!==t.numeric||i.multiOptions!==t.multiOptions;if(i=t,!n||t.needsAsync&&c!==null&&s!==null&&t.sourceKey!==void 0&&c.sourceKey===t.sourceKey&&c.numeric===t.numeric&&c.multiOptions===t.multiOptions)return;if(s?.(),s=null,c=null,t.needsAsync){u(t);return}let r=e.getSnapshot();r.sourceKey!==void 0&&e.setSnapshot({...r,sourceKey:void 0})},subscribe:e.subscribe,getSnapshot:e.getSnapshot,dispose:()=>{s!==null&&(s(),s=null,c=null,i=null)}}};exports.ASYNC_SELECT_COLLECT_ROW_THRESHOLD=i,exports.IDLE_SELECT_OPTIONS_RESULT=s,exports.createSelectOptionsCollector=h,exports.isSelectLikeFilterType=u,exports.resolveSyncSelectOptions=f,exports.selectCollectorResult=m;
@@ -1,4 +1,4 @@
1
- import type { GridColumn } from '../model/gridTypes.unbound.js';
1
+ import type { GridColumn, GridSelectEditorOption } from '../model/gridTypes.unbound.js';
2
2
  import { type SelectOptionEntry } from '../logic/selectOptions.js';
3
3
  export declare const ASYNC_SELECT_COLLECT_ROW_THRESHOLD = 50000;
4
4
  export type ColumnSelectOptionsStatus = 'idle' | 'collecting' | 'loading' | 'ready' | 'error';
@@ -20,6 +20,7 @@ export type SelectOptionsCollectorArgs = {
20
20
  getRawValueAt: RawValueAccessor;
21
21
  numeric?: boolean;
22
22
  sourceKey?: string;
23
+ multiOptions?: readonly GridSelectEditorOption[] | undefined;
23
24
  };
24
25
  export type SelectOptionsCollectSnapshot = {
25
26
  source: RawValueAccessor | null;