@ishibashi0112/spreadsheet-grid-core 0.61.0 → 0.63.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 (132) hide show
  1. package/dist/controllers/autoHeightMeasurer.cjs +1 -1
  2. package/dist/controllers/autoHeightMeasurer.d.ts +1 -0
  3. package/dist/controllers/autoHeightMeasurer.js +59 -48
  4. package/dist/controllers/columnHeaderDragController.cjs +1 -1
  5. package/dist/controllers/columnHeaderDragController.js +119 -115
  6. package/dist/controllers/columnMenuController.cjs +1 -1
  7. package/dist/controllers/columnMenuController.d.ts +2 -0
  8. package/dist/controllers/columnMenuController.js +74 -60
  9. package/dist/controllers/contextMenuController.cjs +1 -1
  10. package/dist/controllers/contextMenuController.js +42 -32
  11. package/dist/controllers/detailTabOrder.cjs +1 -0
  12. package/dist/controllers/detailTabOrder.d.ts +4 -0
  13. package/dist/controllers/detailTabOrder.js +33 -0
  14. package/dist/controllers/fillHandleController.cjs +1 -1
  15. package/dist/controllers/fillHandleController.js +119 -117
  16. package/dist/controllers/filterPopoverController.cjs +1 -1
  17. package/dist/controllers/filterPopoverController.d.ts +1 -0
  18. package/dist/controllers/filterPopoverController.js +4 -2
  19. package/dist/controllers/imeInputController.cjs +1 -1
  20. package/dist/controllers/imeInputController.js +1 -1
  21. package/dist/controllers/keyboardController.cjs +1 -1
  22. package/dist/controllers/keyboardController.d.ts +5 -0
  23. package/dist/controllers/keyboardController.js +182 -86
  24. package/dist/controllers/pointerInteractionsController.cjs +1 -1
  25. package/dist/controllers/pointerInteractionsController.d.ts +1 -0
  26. package/dist/controllers/pointerInteractionsController.js +33 -17
  27. package/dist/controllers/popoverSupport.cjs +1 -1
  28. package/dist/controllers/popoverSupport.d.ts +3 -0
  29. package/dist/controllers/popoverSupport.js +25 -5
  30. package/dist/controllers/rowDragController.cjs +1 -1
  31. package/dist/controllers/rowDragController.js +166 -121
  32. package/dist/controllers/saveStatusController.cjs +1 -1
  33. package/dist/controllers/saveStatusController.js +71 -25
  34. package/dist/controllers/serverSideRowModel.cjs +1 -1
  35. package/dist/controllers/serverSideRowModel.d.ts +1 -0
  36. package/dist/controllers/serverSideRowModel.js +180 -133
  37. package/dist/controllers/toolPanelController.cjs +1 -1
  38. package/dist/controllers/toolPanelController.js +2 -0
  39. package/dist/controllers/tooltipController.cjs +1 -1
  40. package/dist/controllers/tooltipController.js +54 -53
  41. package/dist/controllers/viewportSyncController.cjs +1 -1
  42. package/dist/controllers/viewportSyncController.d.ts +3 -1
  43. package/dist/controllers/viewportSyncController.js +4 -4
  44. package/dist/engine/columnCommands.cjs +1 -1
  45. package/dist/engine/columnCommands.d.ts +2 -0
  46. package/dist/engine/columnCommands.js +71 -31
  47. package/dist/engine/columnLayout.cjs +1 -1
  48. package/dist/engine/columnLayout.js +15 -14
  49. package/dist/engine/createGridEngine.cjs +1 -1
  50. package/dist/engine/createGridEngine.d.ts +3 -1
  51. package/dist/engine/createGridEngine.js +71 -49
  52. package/dist/engine/exportCommands.cjs +1 -1
  53. package/dist/engine/exportCommands.d.ts +2 -1
  54. package/dist/engine/exportCommands.js +117 -92
  55. package/dist/engine/features.d.ts +3 -1
  56. package/dist/engine/fullFeatures.cjs +1 -1
  57. package/dist/engine/fullFeatures.js +23 -21
  58. package/dist/engine/gridApi.cjs +1 -1
  59. package/dist/engine/gridApi.d.ts +10 -2
  60. package/dist/engine/gridApi.js +389 -297
  61. package/dist/engine/notifiers.cjs +1 -1
  62. package/dist/engine/notifiers.d.ts +1 -0
  63. package/dist/engine/notifiers.js +10 -5
  64. package/dist/engine/rowPipeline.cjs +1 -1
  65. package/dist/engine/rowPipeline.d.ts +2 -0
  66. package/dist/engine/rowPipeline.js +6 -6
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.js +7 -6
  70. package/dist/logic/columnAutosize.cjs +1 -1
  71. package/dist/logic/columnAutosize.js +84 -84
  72. package/dist/logic/columnWidthState.cjs +1 -1
  73. package/dist/logic/columnWidthState.js +25 -20
  74. package/dist/logic/detailRow.cjs +1 -1
  75. package/dist/logic/detailRow.d.ts +12 -0
  76. package/dist/logic/detailRow.js +42 -4
  77. package/dist/logic/editorValues.cjs +1 -1
  78. package/dist/logic/editorValues.js +14 -13
  79. package/dist/logic/exportCsv.cjs +2 -2
  80. package/dist/logic/exportCsv.d.ts +3 -1
  81. package/dist/logic/exportCsv.js +15 -10
  82. package/dist/logic/exportData.cjs +1 -1
  83. package/dist/logic/exportData.d.ts +3 -1
  84. package/dist/logic/exportData.js +23 -15
  85. package/dist/logic/filterSummary.cjs +1 -1
  86. package/dist/logic/filterSummary.d.ts +9 -3
  87. package/dist/logic/filterSummary.js +39 -13
  88. package/dist/logic/gridAsk.cjs +1 -1
  89. package/dist/logic/gridAsk.js +106 -106
  90. package/dist/logic/gridState.cjs +1 -1
  91. package/dist/logic/gridState.d.ts +19 -0
  92. package/dist/logic/gridState.js +93 -53
  93. package/dist/logic/groupExport.cjs +1 -0
  94. package/dist/logic/groupExport.d.ts +15 -0
  95. package/dist/logic/groupExport.js +40 -0
  96. package/dist/logic/grouping.cjs +1 -1
  97. package/dist/logic/grouping.d.ts +2 -2
  98. package/dist/logic/grouping.js +58 -40
  99. package/dist/logic/localeText.cjs +1 -0
  100. package/dist/logic/localeText.d.ts +4 -0
  101. package/dist/logic/localeText.js +45 -0
  102. package/dist/logic/numberFilterCondition.cjs +1 -1
  103. package/dist/logic/numberFilterCondition.d.ts +1 -1
  104. package/dist/logic/numberFilterCondition.js +12 -9
  105. package/dist/logic/scrollTargets.cjs +1 -1
  106. package/dist/logic/scrollTargets.d.ts +6 -1
  107. package/dist/logic/scrollTargets.js +8 -8
  108. package/dist/logic/theme.cjs +1 -1
  109. package/dist/logic/theme.d.ts +2 -0
  110. package/dist/logic/theme.js +2 -2
  111. package/dist/logic/urgentFilters.cjs +1 -0
  112. package/dist/logic/urgentFilters.d.ts +3 -0
  113. package/dist/logic/urgentFilters.js +6 -0
  114. package/dist/logic/validation.cjs +1 -1
  115. package/dist/logic/validation.d.ts +1 -1
  116. package/dist/logic/validation.js +10 -10
  117. package/dist/logic/valueFormatters.d.ts +2 -1
  118. package/dist/model/gridActions.cjs +1 -1
  119. package/dist/model/gridActions.d.ts +4 -2
  120. package/dist/model/gridActions.js +12 -4
  121. package/dist/model/gridReducer.cjs +1 -1
  122. package/dist/model/gridReducer.js +2 -2
  123. package/dist/model/gridStore.cjs +1 -1
  124. package/dist/model/gridStore.d.ts +1 -0
  125. package/dist/model/gridStore.js +2 -1
  126. package/dist/model/gridTypes.core.d.ts +244 -40
  127. package/dist/utils/permissions.cjs +1 -1
  128. package/dist/utils/permissions.js +5 -3
  129. package/dist/utils/portalTokens.cjs +1 -0
  130. package/dist/utils/portalTokens.d.ts +3 -0
  131. package/dist/utils/portalTokens.js +65 -0
  132. package/package.json +1 -1
@@ -2,26 +2,40 @@ import { resolveMoveTargetIndex as e, resolveRowDropSlot as t, resolveRowDropSlo
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
4
  import { applySlotToElement as l } from "../logic/slotDom.js";
5
+ import { syncPortalTokens as u } from "../utils/portalTokens.js";
5
6
  //#region src/controllers/rowDragController.ts
6
- var u = 14, d = 12, f = "0.5", p = "<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>", m = "<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>", h = 200, g = "cubic-bezier(0.2, 0.7, 0.3, 1)", _ = `transform 160ms ${g}`, v = "data-ssg-row-dragging", y = (e) => e?.closest(".ssg-motion-off") != null, b = /translateY\((-?[\d.]+)px\)/, x = (e) => {
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) => {
7
8
  let t = [];
8
9
  return e.querySelectorAll(".ssg-body-row[data-row-index]").forEach((n) => {
9
10
  r(e, n) || t.push(n);
10
11
  }), t;
11
- }, S = () => {
12
- let S = null, C = null, w = null, T = {
12
+ }, C = (e) => {
13
+ let t = [], n = /* @__PURE__ */ new Map();
14
+ return e.querySelectorAll(".ssg-detail-band[data-detail-row-index]").forEach((i) => {
15
+ if (r(e, i)) return;
16
+ let a = Number(i.getAttribute("data-detail-row-index")), o = n.get(a) ?? 0;
17
+ n.set(a, o + 1), t.push({
18
+ el: i,
19
+ index: a,
20
+ key: `band|${o}|${a}`
21
+ });
22
+ }), t;
23
+ }, w = (e) => {
24
+ e.style.transition = "", e.style.transform = "", e.style.willChange = "", e.style.zIndex = "";
25
+ }, T = () => {
26
+ let T = null, E = null, D = null, O = {
13
27
  x: 0,
14
28
  y: 0
15
- }, E = null, D = !1, O = null, k = null, A = null, j = null, M = null, N = null, P = 0, F = () => S?.motion === "live", I = null, L = null, R = null, z = () => [
16
- S?.leftIndicatorRef.current ?? null,
17
- S?.centerIndicatorRef.current ?? null,
18
- S?.rightIndicatorRef.current ?? null
19
- ], B = () => {
20
- for (let e of z()) e && (e.style.display = "none");
21
- }, V = (e) => {
22
- if (I) return;
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;
23
37
  let t = document.createElement("div");
24
- t.setAttribute("data-grid-drag-ghost", ""), S?.scrollContainerRef.current?.closest(".ssg-theme-dark") != null && t.classList.add("ssg-theme-dark"), S?.scrollContainerRef.current?.closest(".ssg-motion-off") != null && t.classList.add("ssg-motion-off"), t.style.cssText = [
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 = [
25
39
  "position:fixed",
26
40
  "top:0",
27
41
  "left:0",
@@ -46,53 +60,53 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
46
60
  "z-index:9999",
47
61
  "will-change:transform",
48
62
  "transform:translate(-9999px,-9999px)"
49
- ].join(";"), l(t, S?.ghostSlot);
63
+ ].join(";"), l(t, T?.ghostSlot);
50
64
  let n = document.createElement("span");
51
65
  n.style.cssText = "display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none";
52
66
  let r = document.createElement("span");
53
- r.style.cssText = "overflow:hidden;text-overflow:ellipsis", r.textContent = e, t.appendChild(n), t.appendChild(r), document.body.appendChild(t), I = t, L = n, R = null;
54
- }, H = (e) => {
55
- let t = I;
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;
56
70
  if (!t) return;
57
- t.style.transform = "translate(" + (T.x + u) + "px," + (T.y + d) + "px)";
71
+ t.style.transform = "translate(" + (O.x + d) + "px," + (O.y + f) + "px)";
58
72
  let n = e ? "move" : "out";
59
- if (R === n) return;
60
- R = n;
61
- let r = L;
62
- n === "out" ? (t.style.opacity = f, r && (r.innerHTML = m)) : (t.style.opacity = "1", r && (r.innerHTML = p));
63
- }, U = () => {
64
- I && I.parentNode && I.parentNode.removeChild(I), I = null, L = null, R = null;
65
- }, W = (e, t) => {
66
- let n = S?.scrollContainerRef.current ?? null;
67
- !n || t && e === null || n.querySelectorAll(t ? `.ssg-body-row[data-row-index="${e}"]` : `.ssg-body-row[${v}]`).forEach((e) => {
68
- r(n, e) || (t ? e.setAttribute(v, F() ? "live" : "") : e.removeAttribute(v));
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));
77
+ }, q = () => {
78
+ B && B.parentNode && B.parentNode.removeChild(B), B = null, V = null, H = null;
79
+ }, 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));
69
83
  });
70
- }, G = () => {
71
- let e = S?.scrollContainerRef.current ?? null;
84
+ }, ee = () => {
85
+ let e = T?.scrollContainerRef.current ?? null;
72
86
  if (!e) return null;
73
87
  let t = /* @__PURE__ */ new Map();
74
- for (let n of x(e)) {
75
- let e = b.exec(n.style.transform);
88
+ for (let n of S(e)) {
89
+ let e = x.exec(n.style.transform);
76
90
  e && t.set(n, {
77
91
  index: Number(n.getAttribute("data-row-index")),
78
92
  baseY: parseFloat(e[1])
79
93
  });
80
94
  }
81
95
  return t;
82
- }, K = (t) => {
83
- let n = N, r = C;
84
- if (!n || r === null || S === null) return;
85
- let i = S.scrollContainerRef.current;
96
+ }, te = (t) => {
97
+ let n = I, r = E;
98
+ if (!n || r === null || T === null) return;
99
+ let i = T.scrollContainerRef.current;
86
100
  if (!i) return;
87
- for (let e of x(i)) {
101
+ for (let e of S(i)) {
88
102
  if (n.has(e)) continue;
89
- let t = b.exec(e.style.transform);
103
+ let t = x.exec(e.style.transform);
90
104
  t && n.set(e, {
91
105
  index: Number(e.getAttribute("data-row-index")),
92
106
  baseY: parseFloat(t[1])
93
107
  });
94
108
  }
95
- let a = S.rowMetrics.rowsHeight(r, r), o = (i.scrollTop - P) * S.verticalScaleFactor, s = (E ? T.y - E.y : 0) + o, c = t === null ? null : e(r, t);
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);
96
110
  n.forEach((e, t) => {
97
111
  let { index: i, baseY: o } = e;
98
112
  if (!t.isConnected) {
@@ -104,38 +118,53 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
104
118
  return;
105
119
  }
106
120
  let l = 0;
107
- c !== null && (r < i && i <= c ? l = -a : c <= i && i < r && (l = a)), t.style.transition = _, t.style.transform = `translateY(${o + l}px)`, e.applied = t.style.transform;
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;
108
122
  });
109
- }, q = (e, r) => {
110
- if (S === null) return null;
111
- let { scrollContainerRef: a, bodyScrollRef: o, rowMetrics: s, headerHeight: c, verticalScaleFactor: l, windowBaseOffsetPx: u } = S, d = a.current, f = o.current;
123
+ let l = R ?? /* @__PURE__ */ new Set();
124
+ R = l;
125
+ for (let { el: e, index: t } of C(i)) {
126
+ if (l.add(e), t === r) {
127
+ e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", e.style.zIndex = "10";
128
+ continue;
129
+ }
130
+ 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
+ }
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;
112
136
  if (!d || !f) return null;
113
137
  let p = d.getBoundingClientRect();
114
138
  if (e < p.left || e > p.right || r < p.top || r > p.bottom) return null;
115
- let m = i(r, p.top + d.clientTop + d.clientHeight, S.footerHeight ?? 0), h = f.getBoundingClientRect(), g = t(f.scrollTop + m - h.top - c - d.scrollTop * (1 - l), s);
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
+ if (v !== null && y > 0) {
141
+ let e = t(g + y, s);
142
+ e > v + 1 && (_ = e);
143
+ }
144
+ let b = n(_, s);
116
145
  return {
117
- slot: g,
118
- top: c + n(g, s) - u
146
+ slot: _,
147
+ top: c + b - u
119
148
  };
120
- }, J = () => {
121
- let t = q(T.x, T.y), n = C;
122
- if (F()) {
123
- t && n !== null && (w = e(n, t.slot) === null ? null : t.slot), B(), K(w);
149
+ }, 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);
124
153
  return;
125
154
  }
126
- if (H(t), !t || n === null || e(n, t.slot) === null) {
127
- w = null, B();
155
+ if (K(t), !t || n === null || e(n, t.slot) === null) {
156
+ D = null, W();
128
157
  return;
129
158
  }
130
- w = t.slot;
131
- for (let e of z()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
132
- }, Y = () => {
133
- if (C === null) {
134
- A = null;
159
+ D = t.slot;
160
+ for (let e of U()) e && (e.style.top = `${t.top}px`, e.style.display = "block");
161
+ }, X = () => {
162
+ if (E === null) {
163
+ N = null;
135
164
  return;
136
165
  }
137
- let e = S?.scrollContainerRef.current ?? null;
138
- if (e && (D || (!E || o(E, T, 6)) && (D = !0), D)) {
166
+ let e = T?.scrollContainerRef.current ?? null;
167
+ if (e && (A || (!k || o(k, O, 6)) && (A = !0), A)) {
139
168
  let t = e.getBoundingClientRect(), n = c({
140
169
  rectLeft: t.left,
141
170
  rectTop: t.top,
@@ -143,148 +172,164 @@ var u = 14, d = 12, f = "0.5", p = "<svg viewBox=\"0 0 24 24\" width=\"14\" heig
143
172
  clientTop: e.clientTop,
144
173
  clientWidth: e.clientWidth,
145
174
  clientHeight: e.clientHeight
146
- }), r = s(T.y, n.top, n.bottom - (S?.footerHeight ?? 0), 24), i = a(e.scrollTop, r, 18, e.scrollHeight - 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);
147
176
  i !== e.scrollTop && e.scrollTo({
148
177
  top: i,
149
178
  behavior: "auto"
150
179
  });
151
180
  }
152
- J(), A = requestAnimationFrame(Y);
153
- }, X = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Z = () => {
154
- let e = S?.scrollContainerRef.current ?? null;
181
+ Y(), N = requestAnimationFrame(X);
182
+ }, Z = (e, t) => `${e.getAttribute("data-pane") ?? ""}|${t}`, Q = () => {
183
+ let e = T?.scrollContainerRef.current ?? null;
155
184
  if (!e) return null;
156
185
  let t = /* @__PURE__ */ new Map();
157
- for (let n of x(e)) t.set(X(n, Number(n.getAttribute("data-row-index"))), n.getBoundingClientRect().top);
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);
158
188
  return t;
159
- }, Q = (t) => {
160
- A !== null && (cancelAnimationFrame(A), A = null), document.body.style.cursor = "", B(), U();
161
- let n = C, r = w, i = M;
162
- W(n, !1), C = null, M = null, w = null, E = null, k = null;
163
- let a = n === null || r === null ? null : e(n, r), o = t && n !== null && a !== null && S !== null, s = N;
164
- N = null;
165
- let c = s && o && S !== null && !y(S.scrollContainerRef.current) ? Z() : null;
166
- if (s) if (o) s.forEach(({ baseY: e }, t) => {
189
+ }, $ = (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 = "");
198
+ }), window.setTimeout(() => {
199
+ l.forEach((e) => {
200
+ R?.has(e) || w(e);
201
+ });
202
+ }, 200))), s) if (o) s.forEach(({ baseY: e }, t) => {
167
203
  t.style.transition = "", t.style.willChange = "", t.isConnected && (t.style.transform = `translateY(${e}px)`);
168
204
  });
169
205
  else {
170
206
  let e = [];
171
207
  s.forEach(({ baseY: t }, n) => {
172
- n.isConnected && (n.style.transition = _, n.style.transform = `translateY(${t}px)`, e.push(n));
208
+ n.isConnected && (n.style.transition = v, n.style.transform = `translateY(${t}px)`, e.push(n));
173
209
  }), window.setTimeout(() => {
174
210
  for (let t of e) t.style.transition = "", t.style.willChange = "";
175
211
  }, 200);
176
212
  }
177
- if (!o || n === null || a === null || S === null) return;
178
- let l = c ?? (y(S.scrollContainerRef.current) ? null : Z()), u = l ? {
179
- tops: l,
213
+ if (!o || n === null || a === null || T === null) return;
214
+ let u = c ?? (b(T.scrollContainerRef.current) ? null : Q()), d = u ? {
215
+ tops: u,
180
216
  from: n,
181
217
  to: a,
182
218
  row: i
183
219
  } : null;
184
- j = u, S.commitRowMove(n, a), u && requestAnimationFrame(() => {
185
- j === u && (j = null);
220
+ P = d, T.commitRowMove(n, a), d && requestAnimationFrame(() => {
221
+ P === d && (P = null);
186
222
  });
187
- }, $ = () => {
188
- let e = j;
189
- if (j = null, !e) return;
190
- let t = S?.scrollContainerRef.current ?? null;
223
+ }, re = () => {
224
+ let e = P;
225
+ if (P = null, !e) return;
226
+ let t = T?.scrollContainerRef.current ?? null;
191
227
  if (!t) return;
192
228
  let { tops: n, from: r, to: i } = e;
193
- if (S?.locateDragRow && e.row !== null && S.locateDragRow(e.row, i) !== i) return;
229
+ if (T?.locateDragRow && e.row !== null && T.locateDragRow(e.row, i) !== i) return;
194
230
  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();
195
- if (x(t).forEach((e) => {
196
- let t = n.get(X(e, a(Number(e.getAttribute("data-row-index")))));
231
+ S(t).forEach((e) => {
232
+ let t = n.get(Z(e, a(Number(e.getAttribute("data-row-index")))));
197
233
  if (t === void 0) return;
198
234
  let r = t - e.getBoundingClientRect().top;
199
235
  if (Math.abs(r) < .5) return;
200
- let i = b.exec(e.style.transform);
236
+ let i = x.exec(e.style.transform);
201
237
  if (!i) return;
202
238
  let c = parseFloat(i[1]);
203
239
  s.set(e, c), e.style.transition = "none", e.style.transform = `translateY(${c + r}px)`, e.style.willChange = "transform", o.push(e);
204
- }), o.length !== 0) {
240
+ });
241
+ let c = [];
242
+ if (C(t).forEach(({ el: e, index: t, key: r }) => {
243
+ let i = a(t), o = n.get(r.slice(0, r.lastIndexOf("|") + 1) + i);
244
+ if (o === void 0) return;
245
+ let s = o - e.getBoundingClientRect().top;
246
+ Math.abs(s) < .5 || (e.style.transition = "none", e.style.transform = `translateY(${s}px)`, e.style.willChange = "transform", c.push(e));
247
+ }), !(o.length === 0 && c.length === 0)) {
205
248
  t.getBoundingClientRect();
206
- for (let e of o) e.style.transition = `transform ${h}ms ${g}`, e.style.transform = `translateY(${s.get(e) ?? 0}px)`;
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)";
207
251
  window.setTimeout(() => {
208
252
  for (let e of o) e.style.transition = "", e.style.willChange = "";
253
+ for (let e of c) R?.has(e) || w(e);
209
254
  }, 280);
210
255
  }
211
- }, ee = (e, t) => {
212
- if (S === null || !S.enabled || t.button !== 0) return;
213
- if (t.stopPropagation(), t.preventDefault(), C !== null) {
214
- if (t.pointerId !== k) return;
215
- O?.(), Q(!1);
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);
216
261
  }
217
- C = e, M = S.getDragRow?.(e) ?? null, k = t.pointerId, w = null, T = {
262
+ E = e, F = T.getDragRow?.(e) ?? null, M = t.pointerId, D = null, O = {
218
263
  x: t.clientX,
219
264
  y: t.clientY
220
- }, E = {
265
+ }, k = {
221
266
  x: t.clientX,
222
267
  y: t.clientY
223
- }, D = !1, document.body.style.cursor = "grabbing", F() ? (N = G(), P = S.scrollContainerRef.current?.scrollTop ?? 0) : V(S.getRowDragLabel(e)), W(e, !0);
268
+ }, A = !1, document.body.style.cursor = "grabbing", z() ? (I = ee(), L = T.scrollContainerRef.current?.scrollTop ?? 0) : G(T.getRowDragLabel(e)), J(e, !0);
224
269
  let n = t.currentTarget, r = t.pointerId;
225
270
  try {
226
271
  n.setPointerCapture(r);
227
272
  } catch {}
228
273
  let i = (e) => {
229
- e.pointerId === r && (T = {
274
+ e.pointerId === r && (O = {
230
275
  x: e.clientX,
231
276
  y: e.clientY
232
- }, J());
277
+ }, Y());
233
278
  }, a = () => {
234
- window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), O = null;
279
+ window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", o), window.removeEventListener("pointercancel", s), window.removeEventListener("keydown", c), window.removeEventListener("blur", l), j = null;
235
280
  try {
236
281
  n.releasePointerCapture(r);
237
282
  } catch {}
238
283
  };
239
284
  function o(e) {
240
- e.pointerId === r && (a(), Q(!0));
285
+ e.pointerId === r && (a(), $(!0));
241
286
  }
242
287
  function s(e) {
243
- e.pointerId === r && (a(), Q(!1));
288
+ e.pointerId === r && (a(), $(!1));
244
289
  }
245
290
  function c(e) {
246
- e.key === "Escape" && (a(), Q(!1));
291
+ e.key === "Escape" && (a(), $(!1));
247
292
  }
248
293
  function l() {
249
- a(), Q(!1);
294
+ a(), $(!1);
250
295
  }
251
- window.addEventListener("pointermove", i), window.addEventListener("pointerup", o), window.addEventListener("pointercancel", s), window.addEventListener("keydown", c), window.addEventListener("blur", l), O = a, J(), A = requestAnimationFrame(Y);
252
- }, te = (e) => {
253
- if (C === null || M == null || S?.locateDragRow === void 0) return;
254
- let t = S.locateDragRow(M, C);
255
- if (N && N.forEach((e, t) => {
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) => {
256
301
  if (!t.isConnected) {
257
- N?.delete(t);
302
+ I?.delete(t);
258
303
  return;
259
304
  }
260
305
  let n = Number(t.getAttribute("data-row-index"));
261
306
  if (n === e.index && (e.applied === void 0 || t.style.transform === e.applied)) return;
262
- let r = b.exec(t.style.transform);
307
+ let r = x.exec(t.style.transform);
263
308
  if (!r) {
264
- N?.delete(t);
309
+ I?.delete(t);
265
310
  return;
266
311
  }
267
312
  e.index = n, e.baseY = parseFloat(r[1]), e.applied = void 0;
268
313
  }), t === null) {
269
- O?.(), Q(!1);
314
+ j?.(), $(!1);
270
315
  return;
271
316
  }
272
- N && t !== C && E !== null && e !== null && (E = {
273
- x: E.x,
274
- y: E.y + S.rowMetrics.rowTop(t) - e.rowTop(C)
275
- }), t !== C && (W(null, !1), C = t, W(t, !0)), J();
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();
276
321
  };
277
322
  return {
278
323
  update: (e) => {
279
- let t = S;
280
- S = e, C !== null && t !== null && t.locateDragRow !== e.locateDragRow && te(t.rowMetrics);
324
+ let t = T;
325
+ T = e, E !== null && t !== null && t.locateDragRow !== e.locateDragRow && ae(t.rowMetrics);
281
326
  },
282
- onRowDragHandlePointerDown: ee,
283
- applyReorderSettle: $,
327
+ onRowDragHandlePointerDown: ie,
328
+ applyReorderSettle: re,
284
329
  dispose: () => {
285
- O?.(), O = null, A !== null && (cancelAnimationFrame(A), A = null), document.body.style.cursor = "", U(), W(C, !1), C = null, M = null, w = null, N = null, j = null;
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;
286
331
  }
287
332
  };
288
333
  };
289
334
  //#endregion
290
- export { S as createRowDragController };
335
+ export { T as createRowDragController };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=`data-ssg-save`,n=`ssg-save-indicator`,r=`ssg-save-failed-chip`,i=1300,a=1300,o=4e3,s=`保存に失敗しました。値を戻しました`,c=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`),l=()=>{let l=null,u=new Set,d=new Set,f=null,p=null,m=null,h=(e,t)=>{let n=setTimeout(()=>{u.delete(n),t()},e);u.add(n)},g=t=>{let n=l?.scrollContainerRef.current;if(!n)return[];let r=[];for(let i of t.cells){let t=`.ssg-body-row[data-row-key="${c(String(i.rowKey))}"]`;for(let a of i.columnKeys)n.querySelectorAll(`${t} .ssg-body-cell[data-ssg-col-key="${c(a)}"]`).forEach(t=>{e.isInsideDetailCardOf(n,t)||r.push(t)})}return r},_=(e,t)=>{let r=e.querySelector(`:scope > .${n}`);if(t===null){r?.remove();return}r||(r=document.createElement(`span`),r.className=n,r.setAttribute(`aria-hidden`,`true`),e.appendChild(r)),r.setAttribute(`data-kind`,t),r.textContent=t===`ok`?`✓`:t===`failed`?`✕`:``},v=e=>{e.removeAttribute(t),_(e,null)},y=()=>{f?.remove(),f=null,p!==null&&(clearTimeout(p),u.delete(p),p=null),m&&=(m.removeEventListener(`scroll`,y),null)},b=e=>{y();let t=l?.scrollContainerRef.current,n=l?.shellRef?.current??t;if(!t||!n)return;let i=e.getBoundingClientRect(),a=n.getBoundingClientRect();f=document.createElement(`div`),f.className=r,f.setAttribute(`role`,`status`),f.textContent=s,f.style.left=`${Math.max(0,i.left-a.left)}px`,f.style.top=`${i.bottom-a.top+4}px`,n.appendChild(f),m=t,t.addEventListener(`scroll`,y,{passive:!0}),p=setTimeout(()=>{p=null,y()},o),u.add(p)},x=e=>{let n=g(e);for(let r of n){if(e.state===`cleared`){v(r);continue}r.setAttribute(t,e.state),_(r,e.state),e.state===`ok`?h(i,()=>{r.getAttribute(`data-ssg-save`)===`ok`&&v(r)}):e.state===`failed`&&h(a,()=>{r.getAttribute(`data-ssg-save`)===`failed`&&v(r)})}e.state===`failed`&&n.length>0&&b(n[0])};return{update:e=>{l=e},handle:e=>{if(!l?.enabled)return;if(typeof requestAnimationFrame!=`function`){x(e);return}let t=requestAnimationFrame(()=>{d.delete(t),x(e)});d.add(t)},dispose:()=>{for(let e of u)clearTimeout(e);if(u.clear(),typeof cancelAnimationFrame==`function`)for(let e of d)cancelAnimationFrame(e);d.clear(),y();let n=l?.scrollContainerRef.current;n?.querySelectorAll(`[${t}]`).forEach(t=>{e.isInsideDetailCardOf(n,t)||v(t)}),l=null}}};exports.FAILED_BADGE_MS=a,exports.FAILED_CHIP_MS=o,exports.FAILED_CHIP_TEXT=s,exports.OK_BADGE_MS=i,exports.SAVE_FAILED_CHIP_CLASS_NAME=r,exports.SAVE_INDICATOR_CLASS_NAME=n,exports.SAVE_STATE_ATTRIBUTE=t,exports.createSaveStatusController=l;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../logic/detailRow.cjs");var t=`data-ssg-save`,n=`ssg-save-indicator`,r=`ssg-save-failed-chip`,i=1300,a=1300,o=4e3,s=`保存に失敗しました。値を戻しました`,c=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`),l=()=>{let l=null,u=new Set,d=new Set,f=null,p=null,m=null,h=new Map,g=null,_=null,v=null,y=(e,t)=>{let n=setTimeout(()=>{u.delete(n),t()},e);u.add(n)},b=t=>{let n=l?.scrollContainerRef.current;if(!n)return[];let r=[];for(let i of t.cells){let t=`.ssg-body-row[data-row-key="${c(String(i.rowKey))}"]`;for(let a of i.columnKeys)n.querySelectorAll(`${t} .ssg-body-cell[data-ssg-col-key="${c(a)}"]`).forEach(t=>{e.isInsideDetailCardOf(n,t)||r.push(t)})}return r},x=(e,t)=>{let r=e.querySelector(`:scope > .${n}`);if(t===null){r?.remove();return}r||(r=document.createElement(`span`),r.className=n,r.setAttribute(`aria-hidden`,`true`),e.appendChild(r)),r.setAttribute(`data-kind`,t),r.textContent=t===`ok`?`✓`:t===`failed`?`✕`:``},S=e=>{e.removeAttribute(t),x(e,null)},C=()=>{f?.remove(),f=null,p!==null&&(clearTimeout(p),u.delete(p),p=null),m&&=(m.removeEventListener(`scroll`,C),null)},w=e=>{C();let t=l?.scrollContainerRef.current,n=l?.shellRef?.current??t;if(!t||!n)return;let i=e.getBoundingClientRect(),a=n.getBoundingClientRect();f=document.createElement(`div`),f.className=r,f.setAttribute(`role`,`status`),f.textContent=s,f.style.left=`${Math.max(0,i.left-a.left)}px`,f.style.top=`${i.bottom-a.top+4}px`,n.appendChild(f),m=t,t.addEventListener(`scroll`,C,{passive:!0}),p=setTimeout(()=>{p=null,C()},o),u.add(p)},T=()=>{g?.disconnect(),g=null,_=null,v!==null&&(typeof cancelAnimationFrame==`function`&&cancelAnimationFrame(v),d.delete(v),v=null)},E=()=>{let n=l?.scrollContainerRef.current;!n||h.size===0||n.querySelectorAll(`.ssg-body-row[data-row-key]`).forEach(r=>{let i=h.get(r.getAttribute(`data-row-key`)??``);i&&r.querySelectorAll(`.ssg-body-cell[data-ssg-col-key]`).forEach(r=>{i.has(r.getAttribute(`data-ssg-col-key`)??``)&&r.getAttribute(`data-ssg-save`)!==`pending`&&!e.isInsideDetailCardOf(n,r)&&(r.setAttribute(t,`pending`),x(r,`pending`))})})},D=()=>{if(v!==null)return;if(typeof requestAnimationFrame!=`function`){E();return}let e=requestAnimationFrame(()=>{d.delete(e),v===e&&(v=null),E()});v=e,d.add(e)},O=()=>{let e=l?.scrollContainerRef.current??null;if(h.size===0||!e||typeof MutationObserver!=`function`){T();return}g&&_===e||(T(),g=new MutationObserver(D),g.observe(e,{childList:!0,subtree:!0}),_=e)},k=e=>{for(let t of e.cells){let n=String(t.rowKey);if(e.state===`pending`){let e=h.get(n)??new Set;for(let n of t.columnKeys)e.add(n);h.set(n,e);continue}let r=h.get(n);if(r){for(let e of t.columnKeys)r.delete(e);r.size===0&&h.delete(n)}}O()},A=e=>{let n=b(e);for(let r of n){if(e.state===`cleared`){S(r);continue}r.setAttribute(t,e.state),x(r,e.state),e.state===`ok`?y(i,()=>{r.getAttribute(`data-ssg-save`)===`ok`&&S(r)}):e.state===`failed`&&y(a,()=>{r.getAttribute(`data-ssg-save`)===`failed`&&S(r)})}e.state===`failed`&&n.length>0&&w(n[0])};return{update:e=>{l=e,e.enabled||h.clear(),O()},handle:e=>{if(!l?.enabled)return;if(k(e),typeof requestAnimationFrame!=`function`){A(e);return}let t=requestAnimationFrame(()=>{d.delete(t),A(e)});d.add(t)},dispose:()=>{for(let e of u)clearTimeout(e);if(u.clear(),typeof cancelAnimationFrame==`function`)for(let e of d)cancelAnimationFrame(e);d.clear(),v=null,h.clear(),T(),C();let n=l?.scrollContainerRef.current;n?.querySelectorAll(`[${t}]`).forEach(t=>{e.isInsideDetailCardOf(n,t)||S(t)}),l=null}}};exports.FAILED_BADGE_MS=a,exports.FAILED_CHIP_MS=o,exports.FAILED_CHIP_TEXT=s,exports.OK_BADGE_MS=i,exports.SAVE_FAILED_CHIP_CLASS_NAME=r,exports.SAVE_INDICATOR_CLASS_NAME=n,exports.SAVE_STATE_ATTRIBUTE=t,exports.createSaveStatusController=l;
@@ -1,12 +1,12 @@
1
1
  import { isInsideDetailCardOf as e } from "../logic/detailRow.js";
2
2
  //#region src/controllers/saveStatusController.ts
3
3
  var t = "data-ssg-save", n = "ssg-save-indicator", r = "ssg-save-failed-chip", i = 1300, a = 1300, o = 4e3, s = "保存に失敗しました。値を戻しました", c = (e) => typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\]/g, "\\$&"), l = () => {
4
- let l = null, u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = null, p = null, m = null, h = (e, t) => {
4
+ let l = null, u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), f = null, p = null, m = null, h = /* @__PURE__ */ new Map(), g = null, _ = null, v = null, y = (e, t) => {
5
5
  let n = setTimeout(() => {
6
6
  u.delete(n), t();
7
7
  }, e);
8
8
  u.add(n);
9
- }, g = (t) => {
9
+ }, b = (t) => {
10
10
  let n = l?.scrollContainerRef.current;
11
11
  if (!n) return [];
12
12
  let r = [];
@@ -17,62 +17,108 @@ var t = "data-ssg-save", n = "ssg-save-indicator", r = "ssg-save-failed-chip", i
17
17
  });
18
18
  }
19
19
  return r;
20
- }, _ = (e, t) => {
20
+ }, x = (e, t) => {
21
21
  let r = e.querySelector(`:scope > .${n}`);
22
22
  if (t === null) {
23
23
  r?.remove();
24
24
  return;
25
25
  }
26
26
  r || (r = document.createElement("span"), r.className = n, r.setAttribute("aria-hidden", "true"), e.appendChild(r)), r.setAttribute("data-kind", t), r.textContent = t === "ok" ? "✓" : t === "failed" ? "✕" : "";
27
- }, v = (e) => {
28
- e.removeAttribute(t), _(e, null);
29
- }, y = () => {
30
- f?.remove(), f = null, p !== null && (clearTimeout(p), u.delete(p), p = null), m &&= (m.removeEventListener("scroll", y), null);
31
- }, b = (e) => {
32
- y();
27
+ }, S = (e) => {
28
+ e.removeAttribute(t), x(e, null);
29
+ }, C = () => {
30
+ f?.remove(), f = null, p !== null && (clearTimeout(p), u.delete(p), p = null), m &&= (m.removeEventListener("scroll", C), null);
31
+ }, w = (e) => {
32
+ C();
33
33
  let t = l?.scrollContainerRef.current, n = l?.shellRef?.current ?? t;
34
34
  if (!t || !n) return;
35
35
  let i = e.getBoundingClientRect(), a = n.getBoundingClientRect();
36
- f = document.createElement("div"), f.className = r, f.setAttribute("role", "status"), f.textContent = s, f.style.left = `${Math.max(0, i.left - a.left)}px`, f.style.top = `${i.bottom - a.top + 4}px`, n.appendChild(f), m = t, t.addEventListener("scroll", y, { passive: !0 }), p = setTimeout(() => {
37
- p = null, y();
36
+ f = document.createElement("div"), f.className = r, f.setAttribute("role", "status"), f.textContent = s, f.style.left = `${Math.max(0, i.left - a.left)}px`, f.style.top = `${i.bottom - a.top + 4}px`, n.appendChild(f), m = t, t.addEventListener("scroll", C, { passive: !0 }), p = setTimeout(() => {
37
+ p = null, C();
38
38
  }, o), u.add(p);
39
- }, x = (e) => {
40
- let n = g(e);
39
+ }, T = () => {
40
+ g?.disconnect(), g = null, _ = null, v !== null && (typeof cancelAnimationFrame == "function" && cancelAnimationFrame(v), d.delete(v), v = null);
41
+ }, E = () => {
42
+ let n = l?.scrollContainerRef.current;
43
+ !n || h.size === 0 || n.querySelectorAll(".ssg-body-row[data-row-key]").forEach((r) => {
44
+ let i = h.get(r.getAttribute("data-row-key") ?? "");
45
+ i && r.querySelectorAll(".ssg-body-cell[data-ssg-col-key]").forEach((r) => {
46
+ i.has(r.getAttribute("data-ssg-col-key") ?? "") && r.getAttribute("data-ssg-save") !== "pending" && !e(n, r) && (r.setAttribute(t, "pending"), x(r, "pending"));
47
+ });
48
+ });
49
+ }, D = () => {
50
+ if (v !== null) return;
51
+ if (typeof requestAnimationFrame != "function") {
52
+ E();
53
+ return;
54
+ }
55
+ let e = requestAnimationFrame(() => {
56
+ d.delete(e), v === e && (v = null), E();
57
+ });
58
+ v = e, d.add(e);
59
+ }, O = () => {
60
+ let e = l?.scrollContainerRef.current ?? null;
61
+ if (h.size === 0 || !e || typeof MutationObserver != "function") {
62
+ T();
63
+ return;
64
+ }
65
+ g && _ === e || (T(), g = new MutationObserver(D), g.observe(e, {
66
+ childList: !0,
67
+ subtree: !0
68
+ }), _ = e);
69
+ }, k = (e) => {
70
+ for (let t of e.cells) {
71
+ let n = String(t.rowKey);
72
+ if (e.state === "pending") {
73
+ let e = h.get(n) ?? /* @__PURE__ */ new Set();
74
+ for (let n of t.columnKeys) e.add(n);
75
+ h.set(n, e);
76
+ continue;
77
+ }
78
+ let r = h.get(n);
79
+ if (r) {
80
+ for (let e of t.columnKeys) r.delete(e);
81
+ r.size === 0 && h.delete(n);
82
+ }
83
+ }
84
+ O();
85
+ }, A = (e) => {
86
+ let n = b(e);
41
87
  for (let r of n) {
42
88
  if (e.state === "cleared") {
43
- v(r);
89
+ S(r);
44
90
  continue;
45
91
  }
46
- r.setAttribute(t, e.state), _(r, e.state), e.state === "ok" ? h(i, () => {
47
- r.getAttribute("data-ssg-save") === "ok" && v(r);
48
- }) : e.state === "failed" && h(a, () => {
49
- r.getAttribute("data-ssg-save") === "failed" && v(r);
92
+ r.setAttribute(t, e.state), x(r, e.state), e.state === "ok" ? y(i, () => {
93
+ r.getAttribute("data-ssg-save") === "ok" && S(r);
94
+ }) : e.state === "failed" && y(a, () => {
95
+ r.getAttribute("data-ssg-save") === "failed" && S(r);
50
96
  });
51
97
  }
52
- e.state === "failed" && n.length > 0 && b(n[0]);
98
+ e.state === "failed" && n.length > 0 && w(n[0]);
53
99
  };
54
100
  return {
55
101
  update: (e) => {
56
- l = e;
102
+ l = e, e.enabled || h.clear(), O();
57
103
  },
58
104
  handle: (e) => {
59
105
  if (!l?.enabled) return;
60
- if (typeof requestAnimationFrame != "function") {
61
- x(e);
106
+ if (k(e), typeof requestAnimationFrame != "function") {
107
+ A(e);
62
108
  return;
63
109
  }
64
110
  let t = requestAnimationFrame(() => {
65
- d.delete(t), x(e);
111
+ d.delete(t), A(e);
66
112
  });
67
113
  d.add(t);
68
114
  },
69
115
  dispose: () => {
70
116
  for (let e of u) clearTimeout(e);
71
117
  if (u.clear(), typeof cancelAnimationFrame == "function") for (let e of d) cancelAnimationFrame(e);
72
- d.clear(), y();
118
+ d.clear(), v = null, h.clear(), T(), C();
73
119
  let n = l?.scrollContainerRef.current;
74
120
  n?.querySelectorAll(`[${t}]`).forEach((t) => {
75
- e(n, t) || v(t);
121
+ e(n, t) || S(t);
76
122
  }), l = null;
77
123
  }
78
124
  };