@ishibashi0112/spreadsheet-grid-core 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/controllers/clipboardController.cjs +2 -2
  2. package/dist/controllers/clipboardController.d.ts +2 -1
  3. package/dist/controllers/clipboardController.js +78 -62
  4. package/dist/controllers/columnAutosizeRunner.cjs +1 -1
  5. package/dist/controllers/columnAutosizeRunner.d.ts +2 -0
  6. package/dist/controllers/columnAutosizeRunner.js +49 -23
  7. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  8. package/dist/controllers/columnHeaderDragController.d.ts +4 -0
  9. package/dist/controllers/columnHeaderDragController.js +140 -124
  10. package/dist/controllers/dateRolloverStore.cjs +1 -1
  11. package/dist/controllers/dateRolloverStore.js +1 -1
  12. package/dist/controllers/editController.cjs +1 -1
  13. package/dist/controllers/editController.js +71 -55
  14. package/dist/controllers/escapeClaimController.cjs +1 -0
  15. package/dist/controllers/escapeClaimController.d.ts +18 -0
  16. package/dist/controllers/escapeClaimController.js +30 -0
  17. package/dist/controllers/fillHandleController.cjs +1 -1
  18. package/dist/controllers/fillHandleController.js +129 -127
  19. package/dist/controllers/findController.cjs +1 -1
  20. package/dist/controllers/findController.d.ts +1 -0
  21. package/dist/controllers/findController.js +96 -75
  22. package/dist/controllers/globalFilteredOrder.cjs +1 -1
  23. package/dist/controllers/globalFilteredOrder.js +52 -21
  24. package/dist/controllers/keyboardController.cjs +1 -1
  25. package/dist/controllers/keyboardController.js +98 -97
  26. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  27. package/dist/controllers/pointerInteractionsController.js +159 -144
  28. package/dist/controllers/popoverSupport.cjs +1 -1
  29. package/dist/controllers/popoverSupport.js +4 -1
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.d.ts +1 -0
  32. package/dist/controllers/rowDragController.js +122 -120
  33. package/dist/controllers/scrollSyncController.cjs +1 -1
  34. package/dist/controllers/scrollSyncController.d.ts +1 -1
  35. package/dist/controllers/scrollSyncController.js +7 -4
  36. package/dist/controllers/selectOptionsCollector.cjs +1 -1
  37. package/dist/controllers/selectOptionsCollector.d.ts +5 -2
  38. package/dist/controllers/selectOptionsCollector.js +39 -27
  39. package/dist/controllers/toolPanelController.cjs +1 -1
  40. package/dist/controllers/toolPanelController.d.ts +6 -0
  41. package/dist/controllers/toolPanelController.js +69 -59
  42. package/dist/controllers/tooltipController.cjs +1 -1
  43. package/dist/controllers/tooltipController.d.ts +2 -0
  44. package/dist/controllers/tooltipController.js +68 -38
  45. package/dist/controllers/viewportSyncController.cjs +1 -1
  46. package/dist/controllers/viewportSyncController.d.ts +4 -0
  47. package/dist/controllers/viewportSyncController.js +18 -8
  48. package/dist/engine/columnCommands.cjs +1 -1
  49. package/dist/engine/columnCommands.js +2 -1
  50. package/dist/engine/columnLayout.cjs +1 -1
  51. package/dist/engine/columnLayout.d.ts +2 -0
  52. package/dist/engine/columnLayout.js +51 -18
  53. package/dist/engine/gridApi.cjs +2 -2
  54. package/dist/engine/gridApi.d.ts +1 -1
  55. package/dist/engine/gridApi.js +8 -8
  56. package/dist/engine/rowPipeline.cjs +1 -1
  57. package/dist/engine/rowPipeline.js +46 -46
  58. package/dist/engine/rowSelectionCommands.cjs +1 -1
  59. package/dist/engine/rowSelectionCommands.d.ts +8 -1
  60. package/dist/engine/rowSelectionCommands.js +36 -25
  61. package/dist/locales/en.cjs +1 -1
  62. package/dist/locales/en.js +1 -1
  63. package/dist/logic/autoScrollGeometry.cjs +1 -1
  64. package/dist/logic/autoScrollGeometry.d.ts +5 -1
  65. package/dist/logic/autoScrollGeometry.js +6 -6
  66. package/dist/logic/clearCells.cjs +1 -1
  67. package/dist/logic/clearCells.js +13 -13
  68. package/dist/logic/columnReset.cjs +1 -1
  69. package/dist/logic/columnReset.d.ts +1 -0
  70. package/dist/logic/columnReset.js +21 -19
  71. package/dist/logic/editorValues.cjs +1 -1
  72. package/dist/logic/editorValues.js +41 -15
  73. package/dist/logic/elementScale.cjs +1 -0
  74. package/dist/logic/elementScale.d.ts +8 -0
  75. package/dist/logic/elementScale.js +14 -0
  76. package/dist/logic/filtering.cjs +1 -1
  77. package/dist/logic/filtering.js +14 -11
  78. package/dist/logic/focusCycle.cjs +1 -0
  79. package/dist/logic/focusCycle.d.ts +1 -0
  80. package/dist/logic/focusCycle.js +15 -0
  81. package/dist/logic/labelRows.cjs +1 -1
  82. package/dist/logic/labelRows.d.ts +2 -0
  83. package/dist/logic/labelRows.js +8 -4
  84. package/dist/logic/localeText.cjs +1 -1
  85. package/dist/logic/localeText.js +1 -1
  86. package/dist/logic/rowSelection.cjs +1 -1
  87. package/dist/logic/rowSelection.d.ts +4 -0
  88. package/dist/logic/rowSelection.js +31 -8
  89. package/dist/logic/selectOptions.cjs +1 -1
  90. package/dist/logic/selectOptions.d.ts +2 -2
  91. package/dist/logic/selectOptions.js +16 -12
  92. package/dist/logic/selectionOverlayGeometry.cjs +1 -1
  93. package/dist/logic/selectionOverlayGeometry.js +12 -12
  94. package/dist/logic/sorting.cjs +1 -1
  95. package/dist/logic/sorting.d.ts +1 -0
  96. package/dist/logic/sorting.js +24 -12
  97. package/dist/model/gridTypes.core.d.ts +47 -21
  98. package/package.json +1 -1
@@ -1,15 +1,16 @@
1
1
  import { resolveMoveTargetIndex as e, resolveRowDropSlot as t, resolveRowDropSlotTop as n } from "../logic/rowReorder.js";
2
2
  import { isInsideDetailCardOf as r } from "../logic/detailRow.js";
3
3
  import { clampClientYAboveFooter as i, computeNextScrollPosition as a, hasPointerLeftActivationRadius as o, resolveAutoScrollAxisDirection as s, resolveScrollContentBox as c } from "../logic/autoScrollGeometry.js";
4
- import { applySlotToElement as l } from "../logic/slotDom.js";
5
- import { syncPortalTokens as u } from "../utils/portalTokens.js";
4
+ import { resolveElementScale as l } from "../logic/elementScale.js";
5
+ import { applySlotToElement as u } from "../logic/slotDom.js";
6
+ import { syncPortalTokens as d } from "../utils/portalTokens.js";
6
7
  //#region src/controllers/rowDragController.ts
7
- var d = 14, f = 12, p = "0.5", m = "<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>", h = "<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>", g = 200, _ = "cubic-bezier(0.2, 0.7, 0.3, 1)", v = `transform 160ms ${_}`, y = "data-ssg-row-dragging", b = (e) => e?.closest(".ssg-motion-off") != null, x = /translateY\((-?[\d.]+)px\)/, S = (e) => {
8
+ var f = 14, p = 12, m = "0.5", h = "<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>", g = "<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>", _ = 200, v = "cubic-bezier(0.2, 0.7, 0.3, 1)", y = `transform 160ms ${v}`, b = "data-ssg-row-dragging", x = (e) => e?.closest(".ssg-motion-off") != null, S = /translateY\((-?[\d.]+)px\)/, C = (e) => {
8
9
  let t = [];
9
10
  return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
10
11
  r(e, n) || t.push(n);
11
12
  }), t;
12
- }, C = (e) => {
13
+ }, w = (e) => {
13
14
  let t = [], n = /* @__PURE__ */ new Map();
14
15
  return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
15
16
  if (r(e, i)) return;
@@ -20,22 +21,22 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
20
21
  key: `band|${o}|${a}`
21
22
  });
22
23
  }), t;
23
- }, w = (e) => {
24
+ }, T = (e) => {
24
25
  e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
25
- }, T = () => {
26
- let T = null, E = null, D = null, O = {
26
+ }, E = () => {
27
+ let E = null, D = null, O = null, k = {
27
28
  x: 0,
28
29
  y: 0
29
- }, k = null, A = !1, j = null, M = null, N = null, P = null, F = null, I = null, L = 0, R = null, z = () => T?.motion === "live", B = null, V = null, H = null, U = () => [
30
- T?.leftIndicatorRef.current ?? null,
31
- T?.centerIndicatorRef.current ?? null,
32
- T?.rightIndicatorRef.current ?? null
33
- ], W = () => {
34
- for (let e of U()) e && (e.style.display = "none");
35
- }, G = (e) => {
36
- if (B) return;
30
+ }, A = null, j = !1, M = null, N = null, P = null, F = null, I = null, L = null, R = 0, z = null, B = () => E?.motion === "live", V = null, H = null, U = null, W = () => [
31
+ E?.leftIndicatorRef.current ?? null,
32
+ E?.centerIndicatorRef.current ?? null,
33
+ E?.rightIndicatorRef.current ?? null
34
+ ], G = () => {
35
+ for (let e of W()) e && (e.style.display = "none");
36
+ }, K = (e) => {
37
+ if (V) return;
37
38
  let t = document.createElement("div");
38
- 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 = [
39
+ t.setAttribute("data-grid-drag-ghost", ""), E?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), E?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), E?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
39
40
  "position:fixed",
40
41
  "top:0",
41
42
  "left:0",
@@ -60,53 +61,53 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
60
61
  "z-index:9999",
61
62
  "will-change:transform",
62
63
  "transform:translate(-9999px,-9999px)"
63
- ].join(";"), l(t, T?.ghostSlot);
64
+ ].join(";"), u(t, E?.ghostSlot);
64
65
  let n = document.createElement("span");
65
66
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
66
67
  let r = document.createElement("span");
67
- r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), u(T?.scrollContainerRef.current, t), B = t, V = n, H = null;
68
- }, K = (e) => {
69
- let t = B;
68
+ r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), d(E?.scrollContainerRef.current, t), V = t, H = n, U = null;
69
+ }, ee = (e) => {
70
+ let t = V;
70
71
  if (!t) return;
71
- t.style.transform = "translate(" + (O.x + d) + "px," + (O.y + f) + "px)";
72
+ t.style.transform = "translate(" + (k.x + f) + "px," + (k.y + p) + "px)";
72
73
  let n = e ? "move" : "out";
73
- if (H === n) return;
74
- H = n;
75
- let r = V;
76
- n === "out" ? (t.style.opacity = p, r && (r.innerHTML = h)) : (t.style.opacity = "1", r && (r.innerHTML = m));
74
+ if (U === n) return;
75
+ U = n;
76
+ let r = H;
77
+ n === "out" ? (t.style.opacity = m, r && (r.innerHTML = g)) : (t.style.opacity = "1", r && (r.innerHTML = h));
77
78
  }, q = () => {
78
- B && B.parentNode && B.parentNode.removeChild(B), B = null, V = null, H = null;
79
+ V && V.parentNode && V.parentNode.removeChild(V), V = null, H = null, U = null;
79
80
  }, J = (e, t) => {
80
- let n = T?.scrollContainerRef.current ?? null;
81
- !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${y}]`).forEach((e) => {
82
- r(n, e) || (t ? e.setAttribute(y, z() ? "live" : "") : e.removeAttribute(y));
81
+ let n = E?.scrollContainerRef.current ?? null;
82
+ !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${b}]`).forEach((e) => {
83
+ r(n, e) || (t ? e.setAttribute(b, B() ? "live" : "") : e.removeAttribute(b));
83
84
  });
84
- }, ee = () => {
85
- let e = T?.scrollContainerRef.current ?? null;
85
+ }, te = () => {
86
+ let e = E?.scrollContainerRef.current ?? null;
86
87
  if (!e) return null;
87
88
  let t = /* @__PURE__ */ new Map();
88
- for (let n of S(e)) {
89
- let e = x.exec(n.style.transform);
89
+ for (let n of C(e)) {
90
+ let e = S.exec(n.style.transform);
90
91
  e && t.set(n, {
91
92
  index: Number(n.getAttribute("data-row-index")),
92
93
  baseY: parseFloat(e[1])
93
94
  });
94
95
  }
95
96
  return t;
96
- }, te = (t) => {
97
- let n = I, r = E;
98
- if (!n || r === null || T === null) return;
99
- let i = T.scrollContainerRef.current;
97
+ }, ne = (t) => {
98
+ let n = L, r = D;
99
+ if (!n || r === null || E === null) return;
100
+ let i = E.scrollContainerRef.current;
100
101
  if (!i) return;
101
- for (let e of S(i)) {
102
+ for (let e of C(i)) {
102
103
  if (n.has(e)) continue;
103
- let t = x.exec(e.style.transform);
104
+ let t = S.exec(e.style.transform);
104
105
  t && n.set(e, {
105
106
  index: Number(e.getAttribute("data-row-index")),
106
107
  baseY: parseFloat(t[1])
107
108
  });
108
109
  }
109
- let a = T.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - L) * T.verticalScaleFactor, s = (k ? O.y - k.y : 0) + o, c = t === null ? null : e(r, t);
110
+ let a = E.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - R) * E.verticalScaleFactor, s = (A ? k.y - A.y : 0) + o, c = t === null ? null : e(r, t);
110
111
  n.forEach((e, t) => {
111
112
  let { index: i, baseY: o } = e;
112
113
  if (!t.isConnected) {
@@ -118,25 +119,25 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
118
119
  return;
119
120
  }
120
121
  let l = 0;
121
- c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = v, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
122
+ c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = y, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
122
123
  });
123
- let l = R ?? /* @__PURE__ */ new Set();
124
- R = l;
125
- for (let { el: e, index: t } of C(i)) {
124
+ let l = z ?? /* @__PURE__ */ new Set();
125
+ z = l;
126
+ for (let { el: e, index: t } of w(i)) {
126
127
  if (l.add(e), t === r) {
127
128
  e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
128
129
  continue;
129
130
  }
130
131
  let n = 0;
131
- c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = v, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
132
+ c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = y, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
132
133
  }
133
- }, ne = (e, r) => {
134
- if (T === null) return null;
135
- let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = T, d = a.current, f = o.current;
134
+ }, re = (e, r) => {
135
+ if (E === null) return null;
136
+ let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = E, d = a.current, f = o.current;
136
137
  if (!d || !f) return null;
137
138
  let p = d.getBoundingClientRect();
138
139
  if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
139
- let m = i(r, p.top + d.clientTop + d.clientHeight, T.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = E, y = v !== null && z() ? s.detailHeight(v) : 0;
140
+ let m = i(r, p.top + d.clientTop + d.clientHeight, E.footerHeight ?? 0), h = f.getBoundingClientRect(), g = f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), _ = t(g, s), v = D, y = v !== null && B() ? s.detailHeight(v) : 0;
140
141
  if (v !== null && y > 0) {
141
142
  let e = t(g + y, s);
142
143
  e > v + 1 && (_ = e);
@@ -147,57 +148,58 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
147
148
  top: c + b - u
148
149
  };
149
150
  }, Y = () => {
150
- let t = ne(O.x, O.y), n = E;
151
- if (z()) {
152
- t && n !== null && (D = e(n, t.slot) === null ? null : t.slot), W(), te(D);
151
+ let t = re(k.x, k.y), n = D;
152
+ if (B()) {
153
+ t && n !== null && (O = e(n, t.slot) === null ? null : t.slot), G(), ne(O);
153
154
  return;
154
155
  }
155
- if (K(t), !t || n === null || e(n, t.slot) === null) {
156
- D = null, W();
156
+ if (ee(t), !t || n === null || e(n, t.slot) === null) {
157
+ O = null, G();
157
158
  return;
158
159
  }
159
- D = t.slot;
160
- for (let e of U()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
160
+ O = t.slot;
161
+ for (let e of W()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
161
162
  }, X = () => {
162
- if (E === null) {
163
- N = null;
163
+ if (D === null) {
164
+ P = null;
164
165
  return;
165
166
  }
166
- let e = T?.scrollContainerRef.current ?? null;
167
- if (e && (A || (!k || o(k, O, 6)) && (A = !0), A)) {
167
+ let e = E?.scrollContainerRef.current ?? null;
168
+ if (e && (j || (!A || o(A, k, 6)) && (j = !0), j)) {
168
169
  let t = e.getBoundingClientRect(), n = c({
169
170
  rectLeft: t.left,
170
171
  rectTop: t.top,
171
172
  clientLeft: e.clientLeft,
172
173
  clientTop: e.clientTop,
173
174
  clientWidth: e.clientWidth,
174
- clientHeight: e.clientHeight
175
- }), r = s(O.y, n.top, n.bottom - (T?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
175
+ clientHeight: e.clientHeight,
176
+ scale: l(e, t)
177
+ }), r = s(k.y, n.top, n.bottom - (E?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - e.clientHeight);
176
178
  i !== e.scrollTop && e.scrollTo({
177
179
  top: i,
178
180
  behavior: "auto"
179
181
  });
180
182
  }
181
- Y(), N = requestAnimationFrame(X);
183
+ Y(), P = requestAnimationFrame(X);
182
184
  }, Z = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Q = () => {
183
- let e = T?.scrollContainerRef.current ?? null;
185
+ let e = E?.scrollContainerRef.current ?? null;
184
186
  if (!e) return null;
185
187
  let t = /* @__PURE__ */ new Map();
186
- for (let n of S(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
187
- for (let n of C(e)) t.set(n.key, n.el.getBoundingClientRect().top);
188
+ for (let n of C(e)) t.set(Z(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
189
+ for (let n of w(e)) t.set(n.key, n.el.getBoundingClientRect().top);
188
190
  return t;
189
191
  }, $ = (t) => {
190
- N !== null && (cancelAnimationFrame(N), N = null), document.body.style.cursor = "", W(), q();
191
- let n = E, r = D, i = F;
192
- J(n, !1), E = null, F = null, D = null, k = null, M = null;
193
- let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && T !== null, s = I;
194
- I = null;
195
- let c = s && o && T !== null && !b(T.scrollContainerRef.current) ? Q() : null, l = R;
196
- if (R = null, l && (o ? l.forEach(w) : (l.forEach((e) => {
197
- e.isConnected && (e.style.transition = v, e.style.transform = "translateY(0px)", e.style.zIndex = "");
192
+ P !== null && (cancelAnimationFrame(P), P = null), document.body.style.cursor = "", G(), q();
193
+ let n = D, r = O, i = I;
194
+ J(n, !1), D = null, I = null, O = null, A = null, N = null;
195
+ let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && E !== null, s = L;
196
+ L = null;
197
+ let c = s && o && E !== null && !x(E.scrollContainerRef.current) ? Q() : null, l = z;
198
+ if (z = null, l && (o ? l.forEach(T) : (l.forEach((e) => {
199
+ e.isConnected && (e.style.transition = y, e.style.transform = "translateY(0px)", e.style.zIndex = "");
198
200
  }), window.setTimeout(() => {
199
201
  l.forEach((e) => {
200
- R?.has(e) || w(e);
202
+ z?.has(e) || T(e);
201
203
  });
202
204
  }, 200))), s) if (o) s.forEach(({ baseY: e }, t) => {
203
205
  t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
@@ -205,78 +207,78 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
205
207
  else {
206
208
  let e = [];
207
209
  s.forEach(({ baseY: t }, n) => {
208
- n.isConnected && (n.style.transition = v, n.style.transform = `translateY(${t}px)`, e.push(n));
210
+ n.isConnected && (n.style.transition = y, n.style.transform = `translateY(${t}px)`, e.push(n));
209
211
  }), window.setTimeout(() => {
210
212
  for (let t of e) t.style.transition = "", t.style.willChange = "";
211
213
  }, 200);
212
214
  }
213
- if (!o || n === null || a === null || T === null) return;
214
- let u = c ?? (b(T.scrollContainerRef.current) ? null : Q()), d = u ? {
215
+ if (!o || n === null || a === null || E === null) return;
216
+ let u = c ?? (x(E.scrollContainerRef.current) ? null : Q()), d = u ? {
215
217
  tops: u,
216
218
  from: n,
217
219
  to: a,
218
220
  row: i
219
221
  } : null;
220
- P = d, T.commitRowMove(n, a), d && requestAnimationFrame(() => {
221
- P === d && (P = null);
222
+ F = d, E.commitRowMove(n, a), d && requestAnimationFrame(() => {
223
+ F === d && (F = null);
222
224
  });
223
- }, re = () => {
224
- let e = P;
225
- if (P = null, !e) return;
226
- let t = T?.scrollContainerRef.current ?? null;
225
+ }, ie = () => {
226
+ let e = F;
227
+ if (F = null, !e) return;
228
+ let t = E?.scrollContainerRef.current ?? null;
227
229
  if (!t) return;
228
230
  let { tops: n, from: r, to: i } = e;
229
- if (T?.locateDragRow && e.row !== null && T.locateDragRow(e.row, i) !== i) return;
231
+ if (E?.locateDragRow && e.row !== null && E.locateDragRow(e.row, i) !== i) return;
230
232
  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 = /* @__PURE__ */ new Map();
231
- S(t).forEach((e) => {
233
+ C(t).forEach((e) => {
232
234
  let t = n.get(Z(e, a(Number(e.getAttribute("data-row-index")))));
233
235
  if (t === void 0) return;
234
236
  let r = t - e.getBoundingClientRect().top;
235
237
  if (Math.abs(r) < .5) return;
236
- let i = x.exec(e.style.transform);
238
+ let i = S.exec(e.style.transform);
237
239
  if (!i) return;
238
240
  let c = parseFloat(i[1]);
239
241
  s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
240
242
  });
241
243
  let c = [];
242
- if (C(t).forEach(({ el: e, index: t, key: r }) => {
244
+ if (w(t).forEach(({ el: e, index: t, key: r }) => {
243
245
  let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
244
246
  if (o === void 0) return;
245
247
  let s = o - e.getBoundingClientRect().top;
246
248
  Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
247
249
  }), !(o.length === 0 && c.length === 0)) {
248
250
  t.getBoundingClientRect();
249
- for (let e of o) e.style.transition = `transform ${g}ms ${_}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
250
- for (let e of c) e.style.transition = `transform ${g}ms ${_}`, e.style.transform = "translateY(0px)";
251
+ for (let e of o) e.style.transition = `transform ${_}ms ${v}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
252
+ for (let e of c) e.style.transition = `transform ${_}ms ${v}`, e.style.transform = "translateY(0px)";
251
253
  window.setTimeout(() => {
252
254
  for (let e of o) e.style.transition = "", e.style.willChange = "";
253
- for (let e of c) R?.has(e) || w(e);
255
+ for (let e of c) z?.has(e) || T(e);
254
256
  }, 280);
255
257
  }
256
- }, ie = (e, t) => {
257
- if (T === null || !T.enabled || t.button !== 0) return;
258
- if (t.stopPropagation(), t.preventDefault(), E !== null) {
259
- if (t.pointerId !== M) return;
260
- j?.(), $(!1);
258
+ }, ae = (e, t) => {
259
+ if (E === null || !E.enabled || t.button !== 0) return;
260
+ if (t.stopPropagation(), t.preventDefault(), E.gridRootRef?.current?.focus({ preventScroll: !0 }), D !== null) {
261
+ if (t.pointerId !== N) return;
262
+ M?.(), $(!1);
261
263
  }
262
- E = e, F = T.getDragRow?.(e) ?? null, M = t.pointerId, D = null, O = {
264
+ D = e, I = E.getDragRow?.(e) ?? null, N = t.pointerId, O = null, k = {
263
265
  x: t.clientX,
264
266
  y: t.clientY
265
- }, k = {
267
+ }, A = {
266
268
  x: t.clientX,
267
269
  y: t.clientY
268
- }, A = !1, document.body.style.cursor = "grabbing", z() ? (I = ee(), L = T.scrollContainerRef.current?.scrollTop ?? 0) : G(T.getRowDragLabel(e)), J(e, !0);
270
+ }, j = !1, document.body.style.cursor = "grabbing", B() ? (L = te(), R = E.scrollContainerRef.current?.scrollTop ?? 0) : K(E.getRowDragLabel(e)), J(e, !0);
269
271
  let n = t.currentTarget, r = t.pointerId;
270
272
  try {
271
273
  n.setPointerCapture(r);
272
274
  } catch {}
273
275
  let i = (e) => {
274
- e.pointerId === r && (O = {
276
+ e.pointerId === r && (k = {
275
277
  x: e.clientX,
276
278
  y: e.clientY
277
279
  }, Y());
278
280
  }, a = () => {
279
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), j = null;
281
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), M = null;
280
282
  try {
281
283
  n.releasePointerCapture(r);
282
284
  } catch {}
@@ -293,43 +295,43 @@ var d = 14, f = 12, p = "0.5", m = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
293
295
  function l() {
294
296
  a(), $(!1);
295
297
  }
296
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), j = a, Y(), N = requestAnimationFrame(X);
297
- }, ae = (e) => {
298
- if (E === null || F == null || T?.locateDragRow === void 0) return;
299
- let t = T.locateDragRow(F, E);
300
- if (I && I.forEach((e, t) => {
298
+ window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), M = a, Y(), P = requestAnimationFrame(X);
299
+ }, oe = (e) => {
300
+ if (D === null || I == null || E?.locateDragRow === void 0) return;
301
+ let t = E.locateDragRow(I, D);
302
+ if (L && L.forEach((e, t) => {
301
303
  if (!t.isConnected) {
302
- I?.delete(t);
304
+ L?.delete(t);
303
305
  return;
304
306
  }
305
307
  let n = Number(t.getAttribute("data-row-index"));
306
308
  if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
307
- let r = x.exec(t.style.transform);
309
+ let r = S.exec(t.style.transform);
308
310
  if (!r) {
309
- I?.delete(t);
311
+ L?.delete(t);
310
312
  return;
311
313
  }
312
314
  e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
313
315
  }), t === null) {
314
- j?.(), $(!1);
316
+ M?.(), $(!1);
315
317
  return;
316
318
  }
317
- I && t !== E && k !== null && e !== null && (k = {
318
- x: k.x,
319
- y: k.y + T.rowMetrics.rowTop(t) - e.rowTop(E)
320
- }), t !== E && (J(null, !1), E = t, J(t, !0)), Y();
319
+ L && t !== D && A !== null && e !== null && (A = {
320
+ x: A.x,
321
+ y: A.y + E.rowMetrics.rowTop(t) - e.rowTop(D)
322
+ }), t !== D && (J(null, !1), D = t, J(t, !0)), Y();
321
323
  };
322
324
  return {
323
325
  update: (e) => {
324
- let t = T;
325
- T = e, E !== null && t !== null && t.locateDragRow !== e.locateDragRow && ae(t.rowMetrics);
326
+ let t = E;
327
+ E = e, D !== null && t !== null && t.locateDragRow !== e.locateDragRow && oe(t.rowMetrics);
326
328
  },
327
- onRowDragHandlePointerDown: ie,
328
- applyReorderSettle: re,
329
+ onRowDragHandlePointerDown: ae,
330
+ applyReorderSettle: ie,
329
331
  dispose: () => {
330
- j?.(), j = null, N !== null && (cancelAnimationFrame(N), N = null), document.body.style.cursor = "", q(), J(E, !1), E = null, F = null, D = null, I = null, R?.forEach(w), R = null, P = null;
332
+ M?.(), M = null, P !== null && (cancelAnimationFrame(P), P = null), document.body.style.cursor = "", q(), J(D, !1), D = null, I = null, O = null, L = null, z?.forEach(T), z = null, F = null;
331
333
  }
332
334
  };
333
335
  };
334
336
  //#endregion
335
- export { T as createRowDragController };
337
+ export { E as createRowDragController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-scroll-container--scrolling`,t=120,n=()=>{let t=null,n=null,r=0,i=null,a=null,o=null,s=null,c=()=>{a=null;let e=i;i=null,e&&t?.onScroll?.(e)},l=e=>Math.max(e.clientHeight-(t?.footerHeight??0),0),u=u=>{s=u,t?.setViewState({scrollTop:u.scrollTop,viewportHeight:l(u),viewportWidth:u.clientWidth});let d=()=>{t?.setViewState({scrollTop:u.scrollTop}),u.classList.add(e),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,u.classList.remove(e)},120);let n=r>0?`api`:`user`;n===`api`&&--r;let s=i;i={top:u.scrollTop,left:u.scrollLeft,source:s?.source===`user`?`user`:n},t?.onScroll&&a===null&&(a=requestAnimationFrame(c))};u.addEventListener(`scroll`,d,{passive:!0});let f=null,p=new ResizeObserver(()=>{f??=requestAnimationFrame(()=>{f=null,u.clientWidth!==0&&t?.setViewState({viewportHeight:l(u),viewportWidth:u.clientWidth})})});p.observe(u),n=()=>{u.removeEventListener(`scroll`,d),a!==null&&(cancelAnimationFrame(a),a=null),o!==null&&(clearTimeout(o),o=null),u.classList.remove(e),p.disconnect(),f!==null&&cancelAnimationFrame(f),s=null}};return{update:e=>{let r=t?.footerHeight??0;if(t=e,n===null){let t=e.scrollContainerRef.current;t&&u(t);return}let i=e.footerHeight??0;if(i!==r&&s?.clientWidth){let t=s,n=i-r;if(n>0){let e=t.scrollHeight-n-t.clientHeight;e>0&&t.scrollTop>=e-1&&(t.scrollTop=t.scrollHeight-t.clientHeight)}e.setViewState({viewportHeight:l(t)})}},markApiScroll:()=>{r+=1},dispose:()=>{n?.(),n=null}}};exports.SCROLLING_CLASS_NAME=e,exports.SCROLLING_IDLE_MS=t,exports.createScrollSyncController=n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`ssg-scroll-container--scrolling`,t=120,n=()=>{let t=null,n=null,r=!1,i=null,a=null,o=null,s=null,c=()=>{a=null;let e=i;i=null,e&&t?.onScroll?.(e)},l=e=>Math.max(e.clientHeight-(t?.footerHeight??0),0),u=u=>{s=u,t?.setViewState({scrollTop:u.scrollTop,viewportHeight:l(u),viewportWidth:u.clientWidth});let d=()=>{t?.setViewState({scrollTop:u.scrollTop}),u.classList.add(e),o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,u.classList.remove(e)},120);let n=r?`api`:`user`;r=!1;let s=i;i={top:u.scrollTop,left:u.scrollLeft,source:s?.source===`user`?`user`:n},t?.onScroll&&a===null&&(a=requestAnimationFrame(c))};u.addEventListener(`scroll`,d,{passive:!0});let f=null,p=new ResizeObserver(()=>{f??=requestAnimationFrame(()=>{f=null,u.clientWidth!==0&&t?.setViewState({viewportHeight:l(u),viewportWidth:u.clientWidth})})});p.observe(u),n=()=>{u.removeEventListener(`scroll`,d),a!==null&&(cancelAnimationFrame(a),a=null),o!==null&&(clearTimeout(o),o=null),u.classList.remove(e),p.disconnect(),f!==null&&cancelAnimationFrame(f),s=null}};return{update:e=>{let r=t?.footerHeight??0;if(t=e,n===null){let t=e.scrollContainerRef.current;t&&u(t);return}let i=e.footerHeight??0;if(i!==r&&s?.clientWidth){let t=s,n=i-r;if(n>0){let e=t.scrollHeight-n-t.clientHeight;e>0&&t.scrollTop>=e-1&&(t.scrollTop=t.scrollHeight-t.clientHeight)}e.setViewState({viewportHeight:l(t)})}},markApiScroll:()=>{let e=r;return r=!0,()=>{r=e}},dispose:()=>{n?.(),n=null}}};exports.SCROLLING_CLASS_NAME=e,exports.SCROLLING_IDLE_MS=t,exports.createScrollSyncController=n;
@@ -11,7 +11,7 @@ export type ScrollSyncArgs = {
11
11
  };
12
12
  export type ScrollSyncController = {
13
13
  update: (args: ScrollSyncArgs) => void;
14
- markApiScroll: () => void;
14
+ markApiScroll: () => () => void;
15
15
  dispose: () => void;
16
16
  };
17
17
  export declare const SCROLLING_CLASS_NAME = "ssg-scroll-container--scrolling";
@@ -1,6 +1,6 @@
1
1
  //#region src/controllers/scrollSyncController.ts
2
2
  var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
3
- let t = null, n = null, r = 0, i = null, a = null, o = null, s = null, c = () => {
3
+ let t = null, n = null, r = !1, i = null, a = null, o = null, s = null, c = () => {
4
4
  a = null;
5
5
  let e = i;
6
6
  i = null, e && t?.onScroll?.(e);
@@ -14,8 +14,8 @@ var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
14
14
  t?.setViewState({ scrollTop: u.scrollTop }), u.classList.add(e), o !== null && clearTimeout(o), o = setTimeout(() => {
15
15
  o = null, u.classList.remove(e);
16
16
  }, 120);
17
- let n = r > 0 ? "api" : "user";
18
- n === "api" && --r;
17
+ let n = r ? "api" : "user";
18
+ r = !1;
19
19
  let s = i;
20
20
  i = {
21
21
  top: u.scrollTop,
@@ -55,7 +55,10 @@ var e = "ssg-scroll-container--scrolling", t = 120, n = () => {
55
55
  }
56
56
  },
57
57
  markApiScroll: () => {
58
- r += 1;
58
+ let e = r;
59
+ return r = !0, () => {
60
+ r = e;
61
+ };
59
62
  },
60
63
  dispose: () => {
61
64
  n?.(), n = null;
@@ -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)=>{if(!e||!u(e))return o;let i=e.filterOptions&&e.filterOptions.length>0?e.filterOptions:null;if(i)return{status:`ready`,options:i,allValues:c(i),progress:1};if(t<=5e4){let e=n.collectSelectOptions(t,r);return{status:`ready`,options:e,allValues:c(e),progress:1}}return null},f={source:null,rowCount:0,result:o},p=(e,t,n)=>e.source===n&&e.rowCount===t?e.result:s,m=()=>{let r=e.createValueStore(f),o=null,s=null,l=e=>{let{getRawValueAt:o,rowCount:l}=e,u=n.createSelectOptionsAccumulator(),d=!1,f=()=>{d=!0};s=f,t.runChunked(l,e=>u.collect(o(e)),{isCancelled:()=>d,onYield:(e,t)=>{r.setSnapshot({source:o,rowCount:l,result:{status:`collecting`,options:i,allValues:a,progress:e/t}})}}).then(e=>{if(s===f&&(s=null),!e)return;let t=u.finalize();r.setSnapshot({source:o,rowCount:l,result:{status:`ready`,options:t,allValues:c(t),progress:1}})})};return{update:e=>{let t=o===null||o.needsAsync!==e.needsAsync||o.rowCount!==e.rowCount||o.getRawValueAt!==e.getRawValueAt;o=e,t&&(s?.(),s=null,e.needsAsync&&l(e))},subscribe:r.subscribe,getSnapshot:r.getSnapshot,dispose:()=>{s!==null&&(s(),s=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/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;
@@ -13,18 +13,21 @@ export type ColumnSelectOptionsResult = {
13
13
  export declare const IDLE_SELECT_OPTIONS_RESULT: ColumnSelectOptionsResult;
14
14
  export type RawValueAccessor = (index: number) => unknown;
15
15
  export declare const isSelectLikeFilterType: (filterType: string | null | undefined) => boolean;
16
- export declare const resolveSyncSelectOptions: <T>(column: GridColumn<T> | null, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult | null;
16
+ export declare const resolveSyncSelectOptions: <T>(column: GridColumn<T> | null, rowCount: number, getRawValueAt: RawValueAccessor, numeric?: boolean) => ColumnSelectOptionsResult | null;
17
17
  export type SelectOptionsCollectorArgs = {
18
18
  needsAsync: boolean;
19
19
  rowCount: number;
20
20
  getRawValueAt: RawValueAccessor;
21
+ numeric?: boolean;
22
+ sourceKey?: string;
21
23
  };
22
24
  export type SelectOptionsCollectSnapshot = {
23
25
  source: RawValueAccessor | null;
24
26
  rowCount: number;
27
+ sourceKey?: string;
25
28
  result: ColumnSelectOptionsResult;
26
29
  };
27
- export declare const selectCollectorResult: (snapshot: SelectOptionsCollectSnapshot, rowCount: number, getRawValueAt: RawValueAccessor) => ColumnSelectOptionsResult;
30
+ export declare const selectCollectorResult: (snapshot: SelectOptionsCollectSnapshot, rowCount: number, getRawValueAt: RawValueAccessor, sourceKey?: string) => ColumnSelectOptionsResult;
28
31
  export type SelectOptionsCollector = {
29
32
  update: (args: SelectOptionsCollectorArgs) => void;
30
33
  subscribe: (listener: () => void) => () => void;
@@ -15,17 +15,17 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
15
15
  }, l = (e) => new Set(e.map((e) => e.value)), u = (e) => e === "select" || e === "set" || e === "numberSet" || e === "textSet" || e === "dateSet", d = (e) => {
16
16
  let t = e?.filterType ?? null;
17
17
  return t === "select" || t === "set" || t === "numberSet" || t === "textSet" || t === "dateSet";
18
- }, f = (e, t, r) => {
18
+ }, f = (e, t, r, i = !1) => {
19
19
  if (!e || !d(e)) return s;
20
- let i = e.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : null;
21
- if (i) return {
20
+ let a = e.filterOptions && e.filterOptions.length > 0 ? e.filterOptions : null;
21
+ if (a) return {
22
22
  status: "ready",
23
- options: i,
24
- allValues: l(i),
23
+ options: a,
24
+ allValues: l(a),
25
25
  progress: 1
26
26
  };
27
27
  if (t <= 5e4) {
28
- let e = n(t, r);
28
+ let e = n(t, r, i);
29
29
  return {
30
30
  status: "ready",
31
31
  options: e,
@@ -38,17 +38,19 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
38
38
  source: null,
39
39
  rowCount: 0,
40
40
  result: s
41
- }, m = (e, t, n) => e.source === n && e.rowCount === t ? e.result : c, h = () => {
42
- let n = e(p), i = null, s = null, c = (e) => {
43
- let { getRawValueAt: i, rowCount: c } = e, u = r(), d = !1, f = () => {
44
- d = !0;
41
+ }, 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 = () => {
42
+ let n = e(p), i = null, s = null, c = null, u = (e) => {
43
+ let { getRawValueAt: f, rowCount: p, sourceKey: m } = e, h = r(e.numeric === !0), g = !1, _ = () => {
44
+ g = !0;
45
45
  };
46
- s = f, t(c, (e) => u.collect(i(e)), {
47
- isCancelled: () => d,
46
+ s = _, c = e, t(p, (e) => h.collect(f(e)), {
47
+ isCancelled: () => g,
48
48
  onYield: (e, t) => {
49
- n.setSnapshot({
50
- source: i,
51
- rowCount: c,
49
+ let r = n.getSnapshot();
50
+ m !== void 0 && r.sourceKey === m && r.result.status === "ready" || r.source === f && r.rowCount === p && r.result.status === "ready" || n.setSnapshot({
51
+ source: f,
52
+ rowCount: p,
53
+ sourceKey: m,
52
54
  result: {
53
55
  status: "collecting",
54
56
  options: a,
@@ -57,30 +59,40 @@ var i = 5e4, a = [], o = /* @__PURE__ */ new Set(), s = {
57
59
  }
58
60
  });
59
61
  }
60
- }).then((e) => {
61
- if (s === f && (s = null), !e) return;
62
- let t = u.finalize();
62
+ }).then((t) => {
63
+ if (s === _ && (s = null, c = null), !t) return;
64
+ let r = h.finalize();
63
65
  n.setSnapshot({
64
- source: i,
65
- rowCount: c,
66
+ source: f,
67
+ rowCount: p,
68
+ sourceKey: m,
66
69
  result: {
67
70
  status: "ready",
68
- options: t,
69
- allValues: l(t),
71
+ options: r,
72
+ allValues: l(r),
70
73
  progress: 1
71
74
  }
72
- });
75
+ }), i !== null && i !== e && i.needsAsync && d(i, e) && u(i);
73
76
  });
74
- };
77
+ }, d = (e, t) => e.rowCount !== t.rowCount || e.getRawValueAt !== t.getRawValueAt || e.numeric !== t.numeric;
75
78
  return {
76
79
  update: (e) => {
77
- let t = i === null || i.needsAsync !== e.needsAsync || i.rowCount !== e.rowCount || i.getRawValueAt !== e.getRawValueAt;
78
- i = e, t && (s?.(), s = null, e.needsAsync && c(e));
80
+ let t = i === null || i.needsAsync !== e.needsAsync || i.rowCount !== e.rowCount || i.getRawValueAt !== e.getRawValueAt || i.numeric !== e.numeric;
81
+ if (i = e, !t || e.needsAsync && c !== null && s !== null && e.sourceKey !== void 0 && c.sourceKey === e.sourceKey && c.numeric === e.numeric) return;
82
+ if (s?.(), s = null, c = null, e.needsAsync) {
83
+ u(e);
84
+ return;
85
+ }
86
+ let r = n.getSnapshot();
87
+ r.sourceKey !== void 0 && n.setSnapshot({
88
+ ...r,
89
+ sourceKey: void 0
90
+ });
79
91
  },
80
92
  subscribe: n.subscribe,
81
93
  getSnapshot: n.getSnapshot,
82
94
  dispose: () => {
83
- s !== null && (s(), s = null, i = null);
95
+ s !== null && (s(), s = null, c = null, i = null);
84
96
  }
85
97
  };
86
98
  };