@ishibashi0112/spreadsheet-grid-core 1.4.0 → 1.5.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.
@@ -5,14 +5,14 @@ import { resolveElementScale as d } from "../logic/elementScale.js";
5
5
  import { beginEscapeCancelableDrag as f } from "./escapeClaimController.js";
6
6
  import { applySlotToElement as p } from "../logic/slotDom.js";
7
7
  import { syncPortalTokens as m } from "../utils/portalTokens.js";
8
- import { appendToPopupContainer as ee, getPopupContainerFor as h } from "../utils/popupContainer.js";
8
+ import { appendToPopupContainer as ee, getPopupContainerFor as te } from "../utils/popupContainer.js";
9
9
  //#region src/controllers/rowDragController.ts
10
- var g = 14, _ = 12, v = "0.5", y = "<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>", te = "<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>", ne = 200, b = "cubic-bezier(0.2, 0.7, 0.3, 1)", x = `transform 160ms ${b}`, S = "data-ssg-row-dragging", C = (e) => e?.closest(".ssg-motion-off") != null, w = /translateY\((-?[\d.]+)px\)/, T = (e) => {
10
+ var h = 14, g = 12, _ = "0.5", v = "<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>", y = "<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>", b = 200, x = "cubic-bezier(0.2, 0.7, 0.3, 1)", S = `transform 160ms ${x}`, C = "data-ssg-row-dragging", w = (e) => e?.closest(".ssg-motion-off") != null, T = /translateY\((-?[\d.]+)px\)/, E = (e) => {
11
11
  let t = [];
12
12
  return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
13
13
  r(e, n) || t.push(n);
14
14
  }), t;
15
- }, E = (e) => {
15
+ }, D = (e) => {
16
16
  let t = [], n = /* @__PURE__ */ new Map();
17
17
  return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
18
18
  if (r(e, i)) return;
@@ -23,32 +23,44 @@ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
23
23
  key: `band|${o}|${a}`
24
24
  });
25
25
  }), t;
26
- }, D = (e) => {
26
+ }, O = (e) => {
27
27
  e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
28
- }, O = () => {
29
- let O = null, k = null, A = null, j = null, M = (e, t) => {
30
- let n = O?.canDropAt;
28
+ }, k = "data-row-key", ne = (e, t) => {
29
+ let n = e.getAttribute(k);
30
+ if (n === t.key) return !0;
31
+ let r = T.exec(e.style.transform);
32
+ return r ? (t.index = Number(e.getAttribute("data-row-index")), t.baseY = parseFloat(r[1]), t.key = n, t.applied = void 0, !0) : !1;
33
+ }, re = (e) => {
34
+ let t = T.exec(e.style.transform);
35
+ return t ? {
36
+ index: Number(e.getAttribute("data-row-index")),
37
+ baseY: parseFloat(t[1]),
38
+ key: e.getAttribute(k)
39
+ } : null;
40
+ }, A = () => {
41
+ let A = null, j = null, M = null, N = null, P = (e, t) => {
42
+ let n = A?.canDropAt;
31
43
  if (!n) return !0;
32
- if (j !== null && j.from === e && j.slot === t) return j.allowed;
44
+ if (N !== null && N.from === e && N.slot === t) return N.allowed;
33
45
  let r = n(e, t);
34
- return j = {
46
+ return N = {
35
47
  from: e,
36
48
  slot: t,
37
49
  allowed: r
38
50
  }, r;
39
- }, N = {
51
+ }, F = {
40
52
  x: 0,
41
53
  y: 0
42
- }, P = null, F = !1, I = null, L = null, R = null, z = null, B = null, V = null, H = 0, U = null, W = () => O?.motion === "live", G = null, K = null, q = null, J = () => [
43
- O?.leftIndicatorRef.current ?? null,
44
- O?.centerIndicatorRef.current ?? null,
45
- O?.rightIndicatorRef.current ?? null
54
+ }, I = null, L = !1, R = null, z = null, B = null, V = null, H = null, U = null, ie = 0, W = null, G = () => A?.motion === "live", K = null, q = null, J = null, ae = () => [
55
+ A?.leftIndicatorRef.current ?? null,
56
+ A?.centerIndicatorRef.current ?? null,
57
+ A?.rightIndicatorRef.current ?? null
46
58
  ], Y = () => {
47
- for (let e of J()) e && (e.style.display = "none");
48
- }, re = (e) => {
49
- if (G) return;
59
+ for (let e of ae()) e && (e.style.display = "none");
60
+ }, oe = (e) => {
61
+ if (K) return;
50
62
  let t = document.createElement("div");
51
- t.setAttribute("data-grid-drag-ghost", ""), O?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), O?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), O?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
63
+ t.setAttribute("data-grid-drag-ghost", ""), A?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), A?.scrollContainerRef.current?.closest(".ssg-theme-class") != null && t.classList.add("ssg-theme-class"), A?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
52
64
  "position:fixed",
53
65
  "top:0",
54
66
  "left:0",
@@ -73,112 +85,115 @@ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
73
85
  "z-index:9999",
74
86
  "will-change:transform",
75
87
  "transform:translate(-9999px,-9999px)"
76
- ].join(";"), p(t, O?.ghostSlot);
88
+ ].join(";"), p(t, A?.ghostSlot);
77
89
  let n = document.createElement("span");
78
90
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
79
91
  let r = document.createElement("span");
80
- r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, h(O?.scrollContainerRef.current)), m(O?.scrollContainerRef.current, t), G = t, K = n, q = null;
81
- }, ie = (e) => {
82
- let t = G;
92
+ r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), ee(t, te(A?.scrollContainerRef.current)), m(A?.scrollContainerRef.current, t), K = t, q = n, J = null;
93
+ }, se = (e) => {
94
+ let t = K;
83
95
  if (!t) return;
84
- t.style.transform = "translate(" + (N.x + g) + "px," + (N.y + _) + "px)";
96
+ t.style.transform = "translate(" + (F.x + h) + "px," + (F.y + g) + "px)";
85
97
  let n = e ? "move" : "out";
86
- if (q === n) return;
87
- q = n;
88
- let r = K;
89
- n === "out" ? (t.style.opacity = v, r && (r.innerHTML = te)) : (t.style.opacity = "1", r && (r.innerHTML = y));
90
- }, X = () => {
91
- G && G.parentNode && G.parentNode.removeChild(G), G = null, K = null, q = null;
92
- }, Z = (e, t) => {
93
- let n = O?.scrollContainerRef.current ?? null;
94
- !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${S}]`).forEach((e) => {
95
- r(n, e) || (t ? e.setAttribute(S, W() ? "live" : "") : e.removeAttribute(S));
98
+ if (J === n) return;
99
+ J = n;
100
+ let r = q;
101
+ n === "out" ? (t.style.opacity = _, r && (r.innerHTML = y)) : (t.style.opacity = "1", r && (r.innerHTML = v));
102
+ }, ce = () => {
103
+ K && K.parentNode && K.parentNode.removeChild(K), K = null, q = null, J = null;
104
+ }, X = (e, t) => {
105
+ let n = A?.scrollContainerRef.current ?? null;
106
+ !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${C}]`).forEach((e) => {
107
+ r(n, e) || (t ? e.setAttribute(C, G() ? "live" : "") : e.removeAttribute(C));
108
+ });
109
+ }, le = () => {
110
+ let e = A?.scrollContainerRef.current ?? null;
111
+ if (!e || j === null) return;
112
+ let t = String(j), n = G() ? "live" : "";
113
+ e.querySelectorAll(`.ssg-body-row[${C}]`).forEach((n) => {
114
+ n.getAttribute("data-row-index") !== t && !r(e, n) && n.removeAttribute(C);
115
+ }), e.querySelectorAll(`.ssg-body-row[data-row-index="${t}"]`).forEach((t) => {
116
+ t.getAttribute(C) !== n && !r(e, t) && t.setAttribute(C, n);
96
117
  });
97
- }, ae = () => {
98
- let e = O?.scrollContainerRef.current ?? null;
118
+ }, ue = () => {
119
+ let e = A?.scrollContainerRef.current ?? null;
99
120
  if (!e) return null;
100
121
  let t = /* @__PURE__ */ new Map();
101
- for (let n of T(e)) {
102
- let e = w.exec(n.style.transform);
103
- e && t.set(n, {
104
- index: Number(n.getAttribute("data-row-index")),
105
- baseY: parseFloat(e[1])
106
- });
122
+ for (let n of E(e)) {
123
+ let e = re(n);
124
+ e && t.set(n, e);
107
125
  }
108
126
  return t;
109
- }, oe = (t) => {
110
- let n = V, r = k;
111
- if (!n || r === null || O === null) return;
112
- let i = O.scrollContainerRef.current;
127
+ }, de = (t) => {
128
+ let n = U, r = j;
129
+ if (!n || r === null || A === null) return;
130
+ let i = A.scrollContainerRef.current;
113
131
  if (!i) return;
114
- for (let e of T(i)) {
132
+ for (let e of E(i)) {
115
133
  if (n.has(e)) continue;
116
- let t = w.exec(e.style.transform);
117
- t && n.set(e, {
118
- index: Number(e.getAttribute("data-row-index")),
119
- baseY: parseFloat(t[1])
120
- });
134
+ let t = re(e);
135
+ t && n.set(e, t);
121
136
  }
122
- let a = O.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - H) * O.verticalScaleFactor, s = (P ? N.y - P.y : 0) + o, c = t === null ? null : e(r, t);
137
+ let a = A.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - ie) * A.verticalScaleFactor, s = (I ? F.y - I.y : 0) + o, c = t === null ? null : e(r, t);
123
138
  n.forEach((e, t) => {
124
- let { index: i, baseY: o } = e;
125
- if (!t.isConnected) {
139
+ if (!t.isConnected || !ne(t, e)) {
126
140
  n.delete(t);
127
141
  return;
128
142
  }
143
+ let { index: i, baseY: o } = e;
129
144
  if (i === r) {
130
145
  t.style.transition = "none", t.style.transform = `translateY(${o + s}px)`, t.style.willChange = "transform", e.applied = t.style.transform;
131
146
  return;
132
147
  }
133
148
  let l = 0;
134
- c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = x, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
149
+ c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = S, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
135
150
  });
136
- let l = U ?? /* @__PURE__ */ new Set();
137
- U = l;
138
- for (let { el: e, index: t } of E(i)) {
151
+ let l = W ?? /* @__PURE__ */ new Set();
152
+ W = l;
153
+ for (let { el: e, index: t } of D(i)) {
139
154
  if (l.add(e), t === r) {
140
155
  e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
141
156
  continue;
142
157
  }
143
158
  let n = 0;
144
- c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = x, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
159
+ c !== null && (r < t && t <= c ? n = -a : c <= t && t < r && (n = a)), e.style.transition = S, e.style.transform = `translateY(${n}px)`, e.style.zIndex = "";
145
160
  }
146
- }, se = (e, r) => {
147
- if (O === null) return null;
148
- let { scrollContainerRef: o, bodyScrollRef: s, rowMetrics: c, headerHeight: l, verticalScaleFactor: u, windowBaseOffsetPx: d } = O, f = o.current, p = s.current;
161
+ }, fe = (e, r) => {
162
+ if (A === null) return null;
163
+ let { scrollContainerRef: o, bodyScrollRef: s, rowMetrics: c, headerHeight: l, verticalScaleFactor: u, windowBaseOffsetPx: d } = A, f = o.current, p = s.current;
149
164
  if (!f || !p) return null;
150
165
  let m = f.getBoundingClientRect();
151
166
  if (e < m.left || e > m.right || r < m.top || r > m.bottom) return null;
152
- let ee = a(i(r, m.top + f.clientTop + f.clientHeight, O.footerHeight ?? 0), m.top + f.clientTop, O.stickyTopHeight ?? 0), h = p.getBoundingClientRect(), g = p.scrollTop + ee - h.top - l - f.scrollTop * (1 - u), _ = t(g, c), v = k, y = v !== null && W() ? c.detailHeight(v) : 0;
153
- if (v !== null && y > 0) {
154
- let e = t(g + y, c);
155
- e > v + 1 && (_ = e);
167
+ let ee = a(i(r, m.top + f.clientTop + f.clientHeight, A.footerHeight ?? 0), m.top + f.clientTop, A.stickyTopHeight ?? 0), te = p.getBoundingClientRect(), h = p.scrollTop + ee - te.top - l - f.scrollTop * (1 - u), g = t(h, c), _ = j, v = _ !== null && G() ? c.detailHeight(_) : 0;
168
+ if (_ !== null && v > 0) {
169
+ let e = t(h + v, c);
170
+ e > _ + 1 && (g = e);
156
171
  }
157
- let te = n(_, c);
172
+ let y = n(g, c);
158
173
  return {
159
- slot: _,
160
- top: l + te - d
174
+ slot: g,
175
+ top: l + y - d
161
176
  };
162
- }, Q = () => {
163
- let t = se(N.x, N.y), n = k;
164
- if (W()) {
165
- t && n !== null && (e(n, t.slot) === null ? A = null : M(n, t.slot) && (A = t.slot)), Y(), oe(A);
177
+ }, Z = () => {
178
+ let t = fe(F.x, F.y), n = j;
179
+ if (G()) {
180
+ t && n !== null && (e(n, t.slot) === null ? M = null : P(n, t.slot) && (M = t.slot)), Y(), de(M);
166
181
  return;
167
182
  }
168
- let r = t !== null && n !== null && e(n, t.slot) !== null && !M(n, t.slot);
169
- if (ie(r ? null : t), !t || n === null || r || e(n, t.slot) === null) {
170
- A = null, Y();
183
+ let r = t !== null && n !== null && e(n, t.slot) !== null && !P(n, t.slot);
184
+ if (se(r ? null : t), !t || n === null || r || e(n, t.slot) === null) {
185
+ M = null, Y();
171
186
  return;
172
187
  }
173
- A = t.slot;
174
- for (let e of J()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
175
- }, ce = () => {
176
- if (k === null) {
177
- R = null;
188
+ M = t.slot;
189
+ for (let e of ae()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
190
+ }, Q = () => {
191
+ if (j === null) {
192
+ B = null;
178
193
  return;
179
194
  }
180
- let e = O?.scrollContainerRef.current ?? null;
181
- if (e && (F || (!P || s(P, N, 6)) && (F = !0), F)) {
195
+ let e = A?.scrollContainerRef.current ?? null;
196
+ if (e && (L || (!I || s(I, F, 6)) && (L = !0), L)) {
182
197
  let t = e.getBoundingClientRect(), n = d(e, t), r = l({
183
198
  rectLeft: t.left,
184
199
  rectTop: t.top,
@@ -187,34 +202,36 @@ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
187
202
  clientWidth: e.clientWidth,
188
203
  clientHeight: e.clientHeight,
189
204
  scale: n
190
- }), i = c(N.y, u(r.top, (O?.stickyTopHeight ?? 0) * n.y, 24), r.bottom - (O?.footerHeight ?? 0), 24), a = o(e.scrollTop, i, 18, e.scrollHeight - e.clientHeight);
205
+ }), i = c(F.y, u(r.top, (A?.stickyTopHeight ?? 0) * n.y, 24), r.bottom - (A?.footerHeight ?? 0), 24), a = o(e.scrollTop, i, 18, e.scrollHeight - e.clientHeight);
191
206
  a !== e.scrollTop && e.scrollTo({
192
207
  top: a,
193
208
  behavior: "auto"
194
209
  });
195
210
  }
196
- Q(), R = requestAnimationFrame(ce);
197
- }, le = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, ue = () => {
198
- let e = O?.scrollContainerRef.current ?? null;
211
+ le(), Z(), B = requestAnimationFrame(Q);
212
+ }, pe = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, me = () => {
213
+ let e = A?.scrollContainerRef.current ?? null;
199
214
  if (!e) return null;
200
215
  let t = /* @__PURE__ */ new Map();
201
- for (let n of T(e)) t.set(le(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
202
- for (let n of E(e)) t.set(n.key, n.el.getBoundingClientRect().top);
216
+ for (let n of E(e)) t.set(pe(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
217
+ for (let n of D(e)) t.set(n.key, n.el.getBoundingClientRect().top);
203
218
  return t;
204
219
  }, $ = (t) => {
205
- R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", Y(), X();
206
- let n = k, r = A, i = B;
207
- Z(n, !1), k = null, B = null, A = null, P = null, L = null;
208
- let a = n === null || r === null ? null : e(n, r), o = a !== null && n !== null && r !== null && t && !M(n, r) ? null : a;
209
- j = null;
210
- let s = t && n !== null && o !== null && O !== null, c = V;
211
- V = null;
212
- let l = c && s && O !== null && !C(O.scrollContainerRef.current) ? ue() : null, u = U;
213
- if (U = null, u && (s ? u.forEach(D) : (u.forEach((e) => {
214
- e.isConnected && (e.style.transition = x, e.style.transform = "translateY(0px)", e.style.zIndex = "");
220
+ B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "", Y(), ce();
221
+ let n = j, r = M, i = H;
222
+ X(n, !1), j = null, H = null, M = null, I = null, z = null;
223
+ let a = n === null || r === null ? null : e(n, r), o = a !== null && n !== null && r !== null && t && !P(n, r) ? null : a;
224
+ N = null;
225
+ let s = t && n !== null && o !== null && A !== null, c = U;
226
+ U = null, c?.forEach((e, t) => {
227
+ t.isConnected && !ne(t, e) && c.delete(t);
228
+ });
229
+ let l = c && s && A !== null && !w(A.scrollContainerRef.current) ? me() : null, u = W;
230
+ if (W = null, u && (s ? u.forEach(O) : (u.forEach((e) => {
231
+ e.isConnected && (e.style.transition = S, e.style.transform = "translateY(0px)", e.style.zIndex = "");
215
232
  }), window.setTimeout(() => {
216
233
  u.forEach((e) => {
217
- U?.has(e) || D(e);
234
+ W?.has(e) || O(e);
218
235
  });
219
236
  }, 200))), c) if (s) c.forEach(({ baseY: e }, t) => {
220
237
  t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
@@ -222,78 +239,78 @@ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
222
239
  else {
223
240
  let e = [];
224
241
  c.forEach(({ baseY: t }, n) => {
225
- n.isConnected && (n.style.transition = x, n.style.transform = `translateY(${t}px)`, e.push(n));
242
+ n.isConnected && (n.style.transition = S, n.style.transform = `translateY(${t}px)`, e.push(n));
226
243
  }), window.setTimeout(() => {
227
244
  for (let t of e) t.style.transition = "", t.style.willChange = "";
228
245
  }, 200);
229
246
  }
230
- if (!s || n === null || o === null || O === null) return;
231
- let d = l ?? (C(O.scrollContainerRef.current) ? null : ue()), f = d ? {
247
+ if (!s || n === null || o === null || A === null) return;
248
+ let d = l ?? (w(A.scrollContainerRef.current) ? null : me()), f = d ? {
232
249
  tops: d,
233
250
  from: n,
234
251
  to: o,
235
252
  row: i
236
253
  } : null;
237
- z = f, O.commitRowMove(n, o), f && requestAnimationFrame(() => {
238
- z === f && (z = null);
254
+ V = f, A.commitRowMove(n, o), f && requestAnimationFrame(() => {
255
+ V === f && (V = null);
239
256
  });
240
- }, de = () => {
241
- let e = z;
242
- if (z = null, !e) return;
243
- let t = O?.scrollContainerRef.current ?? null;
257
+ }, he = () => {
258
+ let e = V;
259
+ if (V = null, !e) return;
260
+ let t = A?.scrollContainerRef.current ?? null;
244
261
  if (!t) return;
245
262
  let { tops: n, from: r, to: i } = e;
246
- if (O?.locateDragRow && e.row !== null && O.locateDragRow(e.row, i) !== i) return;
263
+ if (A?.locateDragRow && e.row !== null && A.locateDragRow(e.row, i) !== i) return;
247
264
  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();
248
- T(t).forEach((e) => {
249
- let t = n.get(le(e, a(Number(e.getAttribute("data-row-index")))));
265
+ E(t).forEach((e) => {
266
+ let t = n.get(pe(e, a(Number(e.getAttribute("data-row-index")))));
250
267
  if (t === void 0) return;
251
268
  let r = t - e.getBoundingClientRect().top;
252
269
  if (Math.abs(r) < .5) return;
253
- let i = w.exec(e.style.transform);
270
+ let i = T.exec(e.style.transform);
254
271
  if (!i) return;
255
272
  let c = parseFloat(i[1]);
256
273
  s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
257
274
  });
258
275
  let c = [];
259
- if (E(t).forEach(({ el: e, index: t, key: r }) => {
276
+ if (D(t).forEach(({ el: e, index: t, key: r }) => {
260
277
  let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
261
278
  if (o === void 0) return;
262
279
  let s = o - e.getBoundingClientRect().top;
263
280
  Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
264
281
  }), !(o.length === 0 && c.length === 0)) {
265
282
  t.getBoundingClientRect();
266
- for (let e of o) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
267
- for (let e of c) e.style.transition = `transform ${ne}ms ${b}`, e.style.transform = "translateY(0px)";
283
+ for (let e of o) e.style.transition = `transform ${b}ms ${x}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
284
+ for (let e of c) e.style.transition = `transform ${b}ms ${x}`, e.style.transform = "translateY(0px)";
268
285
  window.setTimeout(() => {
269
286
  for (let e of o) e.style.transition = "", e.style.willChange = "";
270
- for (let e of c) U?.has(e) || D(e);
287
+ for (let e of c) W?.has(e) || O(e);
271
288
  }, 280);
272
289
  }
273
- }, fe = (e, t) => {
274
- if (O === null || !O.enabled || t.button !== 0) return;
275
- if (t.stopPropagation(), t.preventDefault(), O.gridRootRef?.current?.focus({ preventScroll: !0 }), k !== null) {
276
- if (t.pointerId !== L) return;
277
- I?.(), $(!1);
290
+ }, ge = (e, t) => {
291
+ if (A === null || !A.enabled || t.button !== 0) return;
292
+ if (t.stopPropagation(), t.preventDefault(), A.gridRootRef?.current?.focus({ preventScroll: !0 }), A.endEditLeftOpen?.(), j !== null) {
293
+ if (t.pointerId !== z) return;
294
+ R?.(), $(!1);
278
295
  }
279
- k = e, B = O.getDragRow?.(e) ?? null, L = t.pointerId, A = null, N = {
296
+ j = e, H = A.getDragRow?.(e) ?? null, z = t.pointerId, M = null, F = {
280
297
  x: t.clientX,
281
298
  y: t.clientY
282
- }, P = {
299
+ }, I = {
283
300
  x: t.clientX,
284
301
  y: t.clientY
285
- }, F = !1, document.body.style.cursor = "grabbing", W() ? (V = ae(), H = O.scrollContainerRef.current?.scrollTop ?? 0) : re(O.getRowDragLabel(e)), Z(e, !0);
302
+ }, L = !1, document.body.style.cursor = "grabbing", G() ? (U = ue(), ie = A.scrollContainerRef.current?.scrollTop ?? 0) : oe(A.getRowDragLabel(e)), X(e, !0);
286
303
  let n = t.currentTarget, r = t.pointerId;
287
304
  try {
288
305
  n.setPointerCapture(r);
289
306
  } catch {}
290
307
  let i = (e) => {
291
- e.pointerId === r && (N = {
308
+ e.pointerId === r && (F = {
292
309
  x: e.clientX,
293
310
  y: e.clientY
294
- }, Q());
311
+ }, Z());
295
312
  }, a = f(), o = () => {
296
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", u), a(), I = null;
313
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", s), window.removeEventListener("pointercancel", c), window.removeEventListener("keydown", l, !0), window.removeEventListener("blur", u), a(), R = null;
297
314
  try {
298
315
  n.releasePointerCapture(r);
299
316
  } catch {}
@@ -310,43 +327,43 @@ var g = 14, _ = 12, v = "0.5", y = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
310
327
  function u() {
311
328
  o(), $(!1);
312
329
  }
313
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), I = o, Q(), R = requestAnimationFrame(ce);
314
- }, pe = (e) => {
315
- if (k === null || B == null || O?.locateDragRow === void 0) return;
316
- let t = O.locateDragRow(B, k);
317
- if (V && V.forEach((e, t) => {
330
+ window.addEventListener("pointermove", i), window.addEventListener("pointerup", s), window.addEventListener("pointercancel", c), window.addEventListener("keydown", l, !0), window.addEventListener("blur", u), R = o, Z(), B = requestAnimationFrame(Q);
331
+ }, _e = (e) => {
332
+ if (j === null || H == null || A?.locateDragRow === void 0) return;
333
+ let t = A.locateDragRow(H, j);
334
+ if (U && U.forEach((e, t) => {
318
335
  if (!t.isConnected) {
319
- V?.delete(t);
336
+ U?.delete(t);
320
337
  return;
321
338
  }
322
- let n = Number(t.getAttribute("data-row-index"));
323
- if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
324
- let r = w.exec(t.style.transform);
325
- if (!r) {
326
- V?.delete(t);
339
+ let n = Number(t.getAttribute("data-row-index")), r = t.getAttribute(k);
340
+ if (n === e.index && r === e.key && (e.applied === void 0 || t.style.transform === e.applied)) return;
341
+ let i = T.exec(t.style.transform);
342
+ if (!i) {
343
+ U?.delete(t);
327
344
  return;
328
345
  }
329
- e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
346
+ e.index = n, e.baseY = parseFloat(i[1]), e.key = r, e.applied = void 0;
330
347
  }), t === null) {
331
- I?.(), $(!1);
348
+ R?.(), $(!1);
332
349
  return;
333
350
  }
334
- V && t !== k && P !== null && e !== null && (P = {
335
- x: P.x,
336
- y: P.y + O.rowMetrics.rowTop(t) - e.rowTop(k)
337
- }), t !== k && (Z(null, !1), k = t, Z(t, !0)), Q();
351
+ U && t !== j && I !== null && e !== null && (I = {
352
+ x: I.x,
353
+ y: I.y + A.rowMetrics.rowTop(t) - e.rowTop(j)
354
+ }), t !== j && (X(null, !1), j = t, X(t, !0)), Z();
338
355
  };
339
356
  return {
340
357
  update: (e) => {
341
- let t = O;
342
- O = e, t?.canDropAt !== e.canDropAt && (j = null), k !== null && t !== null && t.locateDragRow !== e.locateDragRow && pe(t.rowMetrics);
358
+ let t = A;
359
+ A = e, t?.canDropAt !== e.canDropAt && (N = null), j !== null && t !== null && t.locateDragRow !== e.locateDragRow && _e(t.rowMetrics);
343
360
  },
344
- onRowDragHandlePointerDown: fe,
345
- applyReorderSettle: de,
361
+ onRowDragHandlePointerDown: ge,
362
+ applyReorderSettle: he,
346
363
  dispose: () => {
347
- I?.(), I = null, R !== null && (cancelAnimationFrame(R), R = null), document.body.style.cursor = "", X(), Z(k, !1), k = null, B = null, A = null, j = null, V = null, U?.forEach(D), U = null, z = null;
364
+ R?.(), R = null, B !== null && (cancelAnimationFrame(B), B = null), document.body.style.cursor = "", ce(), X(j, !1), j = null, H = null, M = null, N = null, U = null, W?.forEach(O), W = null, V = null;
348
365
  }
349
366
  };
350
367
  };
351
368
  //#endregion
352
- export { O as createRowDragController };
369
+ export { A as createRowDragController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=`ssg-body-row--enter`,n=`--ssg-row-enter-index`,r=12,i=1500,a=1e3,o=e=>Number(e.getAttribute(`data-row-index`)),s=/(?:^|;)\s*transform\s*:\s*([^;]+)/,c=e=>{if(!e)return null;let t=s.exec(e);return t?t[1].trim():null},l=e=>e instanceof HTMLElement&&e.classList.contains(`ssg-body-row`),u=`ssg-scroll-container--scrolling`,d=()=>{let r=null,s=null,d=!1,f={skeletonEnter:!1,mountEnter:!1},p=new Map,m=-1/0,h=e=>{e.classList.remove(t),e.style.removeProperty(n);let r=p.get(e);r!==void 0&&(clearTimeout(r),p.delete(e))},g=(e,r)=>{e.style.setProperty(n,String(r)),e.classList.add(t);let a=()=>{e.removeEventListener(`animationend`,a),h(e)};e.addEventListener(`animationend`,a),p.set(e,setTimeout(()=>{e.removeEventListener(`animationend`,a),h(e)},i))},_=(e,t)=>{let n=[];for(let r of e){if(r.style.transition)continue;let e=c(t.get(r)??null),i=r.style.transform;!e||!i||e===i||n.push({el:r,from:e,to:i})}if(n.length!==0){for(let{el:e,from:t}of n)e.style.transform=t;s?.getBoundingClientRect();for(let{el:e,to:t}of n)e.style.transform=t}},v=t=>l(t)&&(s===null||!e.isInsideDetailCardOf(s,t)),y=t=>{let n=new Set,r=new Map,i=new Set,c=[];for(let a of t){if(a.type===`attributes`){let e=a.target;v(e)&&!r.has(e)&&r.set(e,a.oldValue);continue}let t=s!==null&&a.target instanceof Element&&e.isInsideDetailCardOf(s,a.target);a.removedNodes.forEach(e=>{t||!l(e)||(e.hasAttribute(`data-skeleton-row`)?n.add(o(e)):i.add(e))}),a.addedNodes.forEach(e=>{v(e)&&!e.hasAttribute(`data-skeleton-row`)&&c.push(e)})}if(c.length===0)return;let d=s?.classList.contains(u)===!0;f.mountEnter&&!d&&_(c.filter(e=>i.has(e)),r);let p=f.mountEnter&&!d;if(p&&c.some(e=>!i.has(e))){let e=Date.now();p=e-m>=a,m=e}let h=c.filter(e=>p&&!i.has(e)||f.skeletonEnter&&n.has(o(e)));if(h.length===0)return;let y=Array.from(new Set(h.map(o))).sort((e,t)=>e-t),b=new Map;y.forEach((e,t)=>{b.set(e,Math.min(t,12))});for(let e of h)g(e,b.get(o(e))??0)},b=()=>{r?.disconnect(),r=null,s=null,d=!1;for(let e of Array.from(p.keys()))h(e)};return{update:({scrollContainerRef:e,skeletonEnter:t,mountEnter:n})=>{f={skeletonEnter:t,mountEnter:n};let i=t||n?e.current:null;i===s&&n===d||(b(),!(!i||typeof MutationObserver>`u`)&&(r=new MutationObserver(y),r.observe(i,n?{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`],attributeOldValue:!0}:{childList:!0,subtree:!0}),s=i,d=n))},dispose:b}};exports.ROW_ENTER_CLASS_NAME=t,exports.ROW_ENTER_FALLBACK_MS=i,exports.ROW_ENTER_INDEX_VAR=n,exports.ROW_ENTER_LIVE_WINDOW_MS=a,exports.ROW_ENTER_STAGGER_CAP=r,exports.createRowEnterController=d,exports.transformOfStyleText=c;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=`ssg-body-row--enter`,n=`--ssg-row-enter-index`,r=12,i=1500,a=1e3,o=e=>Number(e.getAttribute(`data-row-index`)),s=/(?:^|;)\s*transform\s*:\s*([^;]+)/,c=e=>{if(!e)return null;let t=s.exec(e);return t?t[1].trim():null},l=e=>e instanceof HTMLElement&&e.classList.contains(`ssg-body-row`),u=`data-row-key`,d=`ssg-scroll-container--scrolling`,f=()=>{let r=null,s=null,f=!1,p={skeletonEnter:!1,mountEnter:!1},m=new Map,h=-1/0,g=e=>{e.classList.remove(t),e.style.removeProperty(n);let r=m.get(e);r!==void 0&&(clearTimeout(r),m.delete(e))},_=(e,r)=>{e.style.setProperty(n,String(r)),e.classList.add(t);let a=()=>{e.removeEventListener(`animationend`,a),g(e)};e.addEventListener(`animationend`,a),m.set(e,setTimeout(()=>{e.removeEventListener(`animationend`,a),g(e)},i))},v=(e,t)=>{let n=[];for(let r of e){if(r.style.transition)continue;let e=c(t.get(r)??null),i=r.style.transform;!e||!i||e===i||n.push({el:r,from:e,to:i})}if(n.length!==0){for(let{el:e,from:t}of n)e.style.transform=t;s?.getBoundingClientRect();for(let{el:e,to:t}of n)e.style.transform=t}},y=t=>l(t)&&(s===null||!e.isInsideDetailCardOf(s,t)),b=t=>{let n=new Set,r=new Map,i=new Set,c=[],f=new Set;for(let a of t){if(a.type===`attributes`){let e=a.target;if(!y(e))continue;if(a.attributeName===u){a.oldValue!==null&&a.oldValue!==e.getAttribute(u)&&f.add(e);continue}r.has(e)||r.set(e,a.oldValue);continue}let t=s!==null&&a.target instanceof Element&&e.isInsideDetailCardOf(s,a.target);a.removedNodes.forEach(e=>{t||!l(e)||(e.hasAttribute(`data-skeleton-row`)?n.add(o(e)):i.add(e))}),a.addedNodes.forEach(e=>{y(e)&&!e.hasAttribute(`data-skeleton-row`)&&c.push(e)})}let m=new Set(c);for(let e of f)g(e),e.isConnected&&!m.has(e)&&!e.hasAttribute(`data-skeleton-row`)&&c.push(e);if(c.length===0)return;let b=s?.classList.contains(d)===!0;p.mountEnter&&!b&&v(c.filter(e=>i.has(e)),r);let x=p.mountEnter&&!b;if(x&&c.some(e=>!i.has(e))){let e=Date.now();x=e-h>=a,h=e}let S=c.filter(e=>x&&!i.has(e)||p.skeletonEnter&&n.has(o(e)));if(S.length===0)return;let C=Array.from(new Set(S.map(o))).sort((e,t)=>e-t),w=new Map;C.forEach((e,t)=>{w.set(e,Math.min(t,12))});for(let e of S)_(e,w.get(o(e))??0)},x=()=>{r?.disconnect(),r=null,s=null,f=!1;for(let e of Array.from(m.keys()))g(e)};return{update:({scrollContainerRef:e,skeletonEnter:t,mountEnter:n})=>{p={skeletonEnter:t,mountEnter:n};let i=t||n?e.current:null;i===s&&n===f||(x(),!(!i||typeof MutationObserver>`u`)&&(r=new MutationObserver(b),r.observe(i,{childList:!0,subtree:!0,attributes:!0,attributeFilter:n?[`style`,u]:[u],attributeOldValue:!0}),s=i,f=n))},dispose:x}};exports.ROW_ENTER_CLASS_NAME=t,exports.ROW_ENTER_FALLBACK_MS=i,exports.ROW_ENTER_INDEX_VAR=n,exports.ROW_ENTER_LIVE_WINDOW_MS=a,exports.ROW_ENTER_STAGGER_CAP=r,exports.createRowEnterController=f,exports.transformOfStyleText=c;