@sheetxl/react 0.8.0-beta.11 → 0.8.0-beta.13

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 (141) hide show
  1. package/browser/esm/{B93LSmhnvkxNXTq-.mjs → -wQNyCnoJdQUTTfP.mjs} +1 -1
  2. package/browser/esm/{Bl2BFCQ00fotauKB.mjs → AL94cpxFjPurAMQG.mjs} +1 -1
  3. package/browser/esm/{BQYS2Yf-EAV_tBLr.mjs → B4K8rf7TAv0SBkbG.mjs} +1 -1
  4. package/browser/esm/{ClAtIfYbsUPA073B.mjs → BrwfFgqKdMG_-iar.mjs} +1 -1
  5. package/browser/esm/ByBGwdqhc_l75i5G.mjs +145 -0
  6. package/browser/esm/{DgL7Dy-Lqcr1TvW6.mjs → C1zqAqKQ6oa4FiTH.mjs} +4851 -4818
  7. package/browser/esm/C9lQPmVMIlUwXkKr.mjs +303 -0
  8. package/browser/esm/{Dnh1kpz3v1JKtRD_.mjs → CIrcPI7uOT93ydNn.mjs} +2 -2
  9. package/browser/esm/{DS66lAIM-9M-YoZQ.mjs → CZsNidKZjsn0lNnA.mjs} +112 -104
  10. package/browser/esm/{Bos4Rkp8UTF7QXUB.mjs → CcewpxckpDrXSiZ-.mjs} +1 -1
  11. package/browser/esm/{BegvsXeRs7e-9t8k.mjs → CdDvFP8Fqm8uU7Rw.mjs} +1 -1
  12. package/browser/esm/{D2u6THGErqw64KQI.mjs → CfewUx0gINn-wXt3.mjs} +1 -1
  13. package/browser/esm/{C1pc9F4Rt2C5FKUo.mjs → CfvYfq6ALVqkCsdg.mjs} +1 -1
  14. package/browser/esm/CulxiChz6lj3G9lw.mjs +341 -0
  15. package/browser/esm/D5Uy22WeT7vUS36Z.mjs +19 -0
  16. package/browser/esm/{1-LEUre9ZLG0OYYB.mjs → Dd8deQ2CDMdrhzF1.mjs} +6 -6
  17. package/browser/esm/Dit7p67J_fDF5RDj.mjs +262 -0
  18. package/browser/esm/{CPnnESfZz2jjJd82.mjs → DzWFl-_dCN-EOkio.mjs} +3 -3
  19. package/browser/esm/{94dxo1A-z8lgiiGw.mjs → MIDbAwdzknMaoTU5.mjs} +2 -2
  20. package/browser/esm/{B26QVfjer2oY2ewK.mjs → ao9zR4H88b7AmZEV.mjs} +1 -1
  21. package/browser/esm/chart.mjs +28 -27
  22. package/browser/esm/control.mjs +74 -73
  23. package/browser/esm/group.mjs +3 -3
  24. package/browser/esm/index.mjs +6195 -5307
  25. package/browser/esm/note.mjs +5 -5
  26. package/browser/esm/picture.mjs +2 -81
  27. package/browser/esm/sXn9faQLuh4P0TZ9.mjs +401 -0
  28. package/browser/esm/shape.mjs +2 -2
  29. package/browser/esm/slicer.mjs +112 -111
  30. package/browser/esm/{CzRIbc-Lk__VMLKM.mjs → u3A8I4A7GKIOLOOb.mjs} +3 -3
  31. package/browser/esm/{DMdsMPT0fWBbTkNn.mjs → x6A47UA3fzV361tO.mjs} +1 -1
  32. package/node/esm/{BiaDWnN3tT7neoRL.mjs → A_4Y7EtzCWp1AG3Y.mjs} +1 -1
  33. package/node/esm/BNwVylzKMErhrx4i.mjs +406 -0
  34. package/node/esm/BPBUSXc5TVnD15By.mjs +146 -0
  35. package/node/esm/{DxQZmb-j4NLUO9Af.mjs → BTT6UB5lGvPxcq3F.mjs} +1 -1
  36. package/node/esm/{JiQGhLkoL8CJpVvA.mjs → BYiAmyF-aOOuMkD1.mjs} +1 -1
  37. package/node/esm/BqS8o-CmPoCjHDHp.mjs +263 -0
  38. package/node/esm/{b-XRVRI1fYQQMkTC.mjs → CC_XgLOFPvqmFyZ_.mjs} +525 -492
  39. package/node/esm/{BaRfst1euuhquupX.mjs → CMGUrHMaBDeCezK5.mjs} +1 -1
  40. package/node/esm/{umljAT66yb3_rURh.mjs → CP07qkepi21zlB0n.mjs} +118 -110
  41. package/node/esm/{BlxXufqBBg1PtsXd.mjs → CQJJMfuXl6mbgHdT.mjs} +1 -1
  42. package/node/esm/{C_SNx7TlFEcwbYjx.mjs → CVDVFhM7OIpaOlyN.mjs} +1 -1
  43. package/node/esm/{gpD-9LDW92phhoma.mjs → CVMuO9bpR5YK0pPb.mjs} +1 -1
  44. package/node/esm/{BMVK5plvmBOAIlxP.mjs → CaZG4HD3SmHvD-Tu.mjs} +1 -1
  45. package/node/esm/{6zApGj9DozhFy-bx.mjs → CuRPfxQCj2jookWL.mjs} +1 -1
  46. package/node/esm/D8mYmUPUA6i8oFgR.mjs +19 -0
  47. package/node/esm/{Dj5FM7_-YWhCtCCt.mjs → DAUtyjkW5uSdnTli.mjs} +1 -1
  48. package/node/esm/{D_pCpfdQowV_4Aje.mjs → DfvJ0Dpn-AP2mGtz.mjs} +5 -5
  49. package/node/esm/{DTMTIrYIK1eZswsM.mjs → DipZYwHed-W6QMtQ.mjs} +1 -1
  50. package/node/esm/{Be9c1GwQkPo8Piuh.mjs → NvP_j9pSsDiJ_PyY.mjs} +3 -3
  51. package/node/esm/chart.mjs +26 -25
  52. package/node/esm/control.mjs +79 -78
  53. package/node/esm/{sigD1UFqvPlWUw_9.mjs → eecr5gnC2KqVhOzX.mjs} +2 -2
  54. package/node/esm/group.mjs +3 -3
  55. package/node/esm/index.mjs +6594 -5705
  56. package/node/esm/note.mjs +18 -18
  57. package/node/esm/picture.mjs +269 -50
  58. package/node/esm/shape.mjs +185 -578
  59. package/node/esm/slicer.mjs +51 -50
  60. package/package.json +7 -7
  61. package/resources/locales/de/picture.cmd.json +157 -0
  62. package/resources/locales/de/sheet.cmd.json +45 -2
  63. package/resources/locales/de/ui.msg.json +3 -0
  64. package/resources/locales/de/workbook.cmd.json +6 -0
  65. package/resources/locales/en/picture.cmd.json +157 -0
  66. package/resources/locales/en/sheet.cmd.json +45 -2
  67. package/resources/locales/en/ui.msg.json +5 -0
  68. package/resources/locales/en/workbook.cmd.json +6 -0
  69. package/types/src/border/useBorders.d.ts +2 -2
  70. package/types/src/cell/CellCheckboxRenderer.d.ts +20 -0
  71. package/types/src/cell/CellContent.d.ts +68 -0
  72. package/types/src/cell/CellControlContext.d.ts +37 -0
  73. package/types/src/cell/{FormulaCellRenderer.d.ts → CellFormulaRenderer.d.ts} +5 -5
  74. package/types/src/cell/CellImageRenderer.d.ts +11 -0
  75. package/types/src/cell/CellRenderers.d.ts +190 -0
  76. package/types/src/cell/{SheetCellRenderer.d.ts → CellTextRenderer.d.ts} +9 -6
  77. package/types/src/cell/ColumnButton.d.ts +3 -3
  78. package/types/src/cell/OutlineButton.d.ts +4 -4
  79. package/types/src/cell/SheetHeaderRenderer.d.ts +1 -1
  80. package/types/src/cell/index.d.ts +8 -2
  81. package/types/src/cell/useFormulaViewAnchor.d.ts +1 -1
  82. package/types/src/cell/useInsertableCellControls.d.ts +25 -0
  83. package/types/src/chart/ChartCommands.d.ts +1 -1
  84. package/types/src/chart/ChartEditor.d.ts +2 -0
  85. package/types/src/chart/ChartElement.d.ts +14 -3
  86. package/types/src/chart/paint/_graphics.d.ts +0 -8
  87. package/types/src/chart/paint/_mode.d.ts +6 -0
  88. package/types/src/chart/paint/echarts.d.ts +6 -3
  89. package/types/src/chart/paint/index.d.ts +1 -1
  90. package/types/src/chart/paint/kinds/ChartPaintKind.d.ts +9 -1
  91. package/types/src/chart/paint/kinds/_builtIns.d.ts +0 -9
  92. package/types/src/chart/paint/toEChartsOption.d.ts +12 -1
  93. package/types/src/editableLabel/EditableLabel.d.ts +3 -1
  94. package/types/src/editor/SheetReferenceHeaderLayer.d.ts +1 -1
  95. package/types/src/editor/useFormulaHints.d.ts +1 -1
  96. package/types/src/layer/CellErrorLayer.d.ts +3 -2
  97. package/types/src/layer/CellIndicatorLayer.d.ts +31 -0
  98. package/types/src/layer/CircularIndicatorLayer.d.ts +1 -1
  99. package/types/src/layer/HeaderSelectionLayer.d.ts +4 -4
  100. package/types/src/layer/HyperlinkLayer.d.ts +12 -5
  101. package/types/src/layer/ProtectionLayer.d.ts +1 -2
  102. package/types/src/layer/SheetCellLayer.d.ts +11 -4
  103. package/types/src/layer/SheetMovableLayer.d.ts +2 -1
  104. package/types/src/layer/SheetOutlineLayer.d.ts +1 -1
  105. package/types/src/layer/TableLayer.d.ts +1 -1
  106. package/types/src/layer/TableToolbar.d.ts +1 -1
  107. package/types/src/layer/ValidationPromptLayer.d.ts +16 -4
  108. package/types/src/layer/_visibleCellFeatures.d.ts +11 -0
  109. package/types/src/layer/index.d.ts +1 -0
  110. package/types/src/layer/useValidationPicker.d.ts +1 -1
  111. package/types/src/listener/useRangeListener.d.ts +13 -7
  112. package/types/src/movable/DefaultMovable.d.ts +1 -1
  113. package/types/src/movable/MovableControl.d.ts +3 -1
  114. package/types/src/movable/MovableFrame.d.ts +2 -1
  115. package/types/src/movable/MovableLayer.d.ts +6 -3
  116. package/types/src/movable/useFramePreview.d.ts +17 -0
  117. package/types/src/picture/PictureCommands.d.ts +8 -0
  118. package/types/src/picture/_pictureHyperlink.d.ts +13 -0
  119. package/types/src/picture/pictureCrop.d.ts +32 -0
  120. package/types/src/sheet/ISheetHeaderElement.d.ts +2 -2
  121. package/types/src/sheet/IWorksheetElement.d.ts +21 -22
  122. package/types/src/sheet/SheetCommandProvider.d.ts +3 -0
  123. package/types/src/sheet/SheetOutlineElement.d.ts +2 -2
  124. package/types/src/sheet/SheetPanels.d.ts +2 -2
  125. package/types/src/sheet/_hyperlinkEdit.d.ts +7 -0
  126. package/types/src/sheet/circularReferences.d.ts +1 -1
  127. package/types/src/tabStrip/Sortable.d.ts +5 -5
  128. package/types/src/tabStrip/TabStrip.d.ts +6 -6
  129. package/types/src/tabStrip/TabStripItem.d.ts +15 -13
  130. package/types/src/taskPane/CellControlPane.d.ts +17 -0
  131. package/types/src/taskPane/index.d.ts +1 -0
  132. package/types/src/taskPane/useTaskPane.d.ts +6 -3
  133. package/types/src/theme/buildDocThemeCSS.d.ts +4 -1
  134. package/types/src/workbook/DefaultRenderers.d.ts +4 -4
  135. package/types/src/workbook/IWorkbookElement.d.ts +52 -20
  136. package/types/src/workbook/WorkbookStrip.d.ts +5 -5
  137. package/browser/esm/CRi6DQ3UXmPEv-w_.mjs +0 -729
  138. package/browser/esm/cQ6xdPFkEcuDlNTN.mjs +0 -75
  139. package/browser/esm/ugfE7YeZALQURDKF.mjs +0 -241
  140. package/node/esm/DJPgbB1X22YmhbaR.mjs +0 -242
  141. package/node/esm/DgGEHydEjD7nfsDB.mjs +0 -76
@@ -0,0 +1,263 @@
1
+ /**
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.8.0-beta.13
3
+ *
4
+ * (C) 2026-present SheetXL Inc. & Michael T. Ford
5
+ * License: The license can be found at https://www.sheetxl.com/license.
6
+ */
7
+ import { forwardRef as e, memo as t, useCallback as r, useEffect as n, useLayoutEffect as o, useRef as l, useState as s } from "react";
8
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
9
+ import { CommonUtils as c, defineLazyModule as d } from "@sheetxl/utils";
10
+ import { useImperativeElement as u, useMeasure as h, usePendingRender as g, usePersistentState as m, useResolvedThemeMode as p } from "@sheetxl/utils-react";
11
+ import { useMergeRefs as f } from "react-merge-refs";
12
+ var y = {
13
+ Mode: "themeMode",
14
+ DarkGrid: "enableDarkGrid",
15
+ DarkImages: "enableDarkImages"
16
+ }, b = {
17
+ [y.Mode]: null,
18
+ [y.DarkGrid]: !1,
19
+ [y.DarkImages]: !1
20
+ }, x = (e) => {
21
+ const [t] = m(y.Mode, b[y.Mode]), [r] = m(y.DarkGrid, b[y.DarkGrid]), { themeMode: n } = p({ mode: e ?? t ?? void 0 });
22
+ return e || ("dark" === n && r ? "dark" : "light");
23
+ }, v = () => {
24
+ const [e] = m(y.Mode, b[y.Mode]), { themeMode: t } = p({ mode: e ?? void 0 });
25
+ return t;
26
+ }, k = d("chart:paint", () => import("./CC_XgLOFPvqmFyZ_.mjs")), w = (e, t) => {
27
+ const r = e.getElementType();
28
+ if ("point" === r) {
29
+ const r = e.getParent();
30
+ return t === r || "point" === t?.getElementType() && t.getParent() === r ? e : r;
31
+ }
32
+ if ("legendEntry" === r) {
33
+ const r = e.getParent();
34
+ return t === r || "legendEntry" === t?.getElementType() ? e : r;
35
+ }
36
+ if ("dataLabel" === r) {
37
+ const r = e.getParent()?.getParent(), n = r?.getDataLabels();
38
+ return n ? t === n || "dataLabel" === t?.getElementType() && t.getParent()?.getParent() === r ? e : n : e;
39
+ }
40
+ return e;
41
+ }, E = {
42
+ boxes: [],
43
+ handles: []
44
+ }, M = t(e((e, t) => {
45
+ const { children: d, style: m, chart: p, onChartChange: y, zoom: b = 1, width: x, height: M, selection: P = null, colorScheme: C, onElementPress: D, onPointerDown: L, ...A } = e, [G, S] = s(() => c.isPromiseLike(p) ? null : p), [T, z] = s(null), F = l(y);
46
+ F.current = y;
47
+ const I = l(null);
48
+ n(() => {
49
+ let e = !0;
50
+ const t = (e, t) => {
51
+ z(t), S(e), I.current !== e && (I.current = e, F.current?.(e));
52
+ };
53
+ if (c.isPromiseLike(p)) return p.then((r) => {
54
+ e && t(r, null);
55
+ }, (r) => {
56
+ e && t(null, r);
57
+ }), () => {
58
+ e = !1;
59
+ };
60
+ t(p, null);
61
+ }, [p]);
62
+ const [N, $] = h(), B = "number" == typeof x ? x : $.width, R = "number" == typeof M ? M : $.height, j = B ? Math.round(B / b) : 0, V = R ? Math.round(R / b) : 0, X = l({
63
+ width: j,
64
+ height: V
65
+ });
66
+ X.current = {
67
+ width: j,
68
+ height: V
69
+ };
70
+ const Y = v(), q = "dark" === (C ?? Y), H = r(async (e) => {
71
+ const t = X.current;
72
+ if (!G || !t.width || !t.height) return null;
73
+ const r = G.getLayout(t);
74
+ return r ? (await k.load()).renderChartToSVG(r, { darkMode: e?.darkMode ?? !1 }) : null;
75
+ }, [G]), J = l(null), K = l(null), O = l(b);
76
+ O.current = b;
77
+ const Q = r((e, t) => {
78
+ const r = J.current;
79
+ if (!r) return null;
80
+ const n = r.getBoundingClientRect(), o = O.current || 1;
81
+ return {
82
+ x: (e - n.left) / o,
83
+ y: (t - n.top) / o
84
+ };
85
+ }, []), U = r((e, t) => {
86
+ const r = K.current, n = Q(e, t);
87
+ return G && r && n ? G.getElementAt(n, r) : null;
88
+ }, [G, Q]), W = u(t, () => ({
89
+ isChartElement: () => !0,
90
+ getChart: () => G,
91
+ toSVG: H,
92
+ getElementAt: U
93
+ }), [
94
+ G,
95
+ H,
96
+ U
97
+ ]), Z = f([
98
+ W,
99
+ N,
100
+ J
101
+ ]), _ = l(null), ee = l(null), [te, re] = s(() => k.peek() ?? null), [ne, oe] = s(null), [le, se] = s(0), [ie, ae] = s(E);
102
+ n(() => G?.addListeners({ onLayoutChange: () => se((e) => e + 1) }), [G]), g(!(ne || T || te && G)), n(() => {
103
+ if (te) return;
104
+ let e = !0;
105
+ return k.load().then((t) => {
106
+ e && re(t);
107
+ }, (t) => {
108
+ e && oe(t);
109
+ }), () => {
110
+ e = !1;
111
+ };
112
+ }, [te]);
113
+ const ce = r(() => {
114
+ const e = K.current;
115
+ ae(G && e && P && !P.isEmpty() ? ((e, t, r) => {
116
+ const n = [], o = [];
117
+ for (const l of r.getItems()) {
118
+ if (l.getChart() !== e) continue;
119
+ const s = l.getElementType();
120
+ if ("series" === s || "dataLabels" === s) {
121
+ const r = "series" === s ? l : l.getParent(), o = "series" === s ? r.getPoints() : r.getPoints().map((e) => e.getDataLabel());
122
+ for (const r of o) {
123
+ const o = e.getElementBounds(r, t);
124
+ o && n.push(o);
125
+ }
126
+ if (n.length > 0) continue;
127
+ }
128
+ const i = e.getElementBounds(l, t);
129
+ if (i && (n.push(i), 1 === r.getItems().length)) {
130
+ const e = [
131
+ i.x,
132
+ i.x + i.width / 2,
133
+ i.x + i.width
134
+ ], t = [
135
+ i.y,
136
+ i.y + i.height / 2,
137
+ i.y + i.height
138
+ ];
139
+ for (const r of e) for (const n of t) r === e[1] && n === t[1] || o.push({
140
+ x: r,
141
+ y: n
142
+ });
143
+ }
144
+ }
145
+ return {
146
+ boxes: n,
147
+ handles: o
148
+ };
149
+ })(G, e, P) : E);
150
+ }, [G, P]);
151
+ n(() => P?.addListeners({ onChange: ce }), [P, ce]), o(() => {
152
+ const e = _.current;
153
+ if (!(te && e && G && j && V)) return;
154
+ const t = G.getLayout({
155
+ width: j,
156
+ height: V
157
+ });
158
+ if (K.current = t, !t) return ee.current?.dispose(), ee.current = null, e.style.backgroundColor = "", void ce();
159
+ const r = void 0 === t.chartArea.fill;
160
+ e.style.backgroundColor = r ? `var(--sxl-color-base-100, ${q ? "#121212" : "#FFFFFF"})` : "", e.style.borderRadius = r ? `${t.chartArea.cornerRadius}px` : "";
161
+ const n = {
162
+ darkMode: q,
163
+ background: "transparent"
164
+ };
165
+ ee.current ? ee.current.update(t, n) : ee.current = te.mountChart(e, t, n), ce();
166
+ }, [
167
+ te,
168
+ G,
169
+ j,
170
+ V,
171
+ le,
172
+ q,
173
+ ce
174
+ ]), n(() => () => {
175
+ ee.current?.dispose(), ee.current = null, K.current = null;
176
+ }, [G]);
177
+ const de = r((e) => {
178
+ if (L?.(e), 0 !== e.button && 2 !== e.button) return;
179
+ const t = K.current, r = Q(e.clientX, e.clientY);
180
+ if (!G || !t || !r) return;
181
+ const n = G.getElementAt(r, t);
182
+ if (D?.({
183
+ element: n,
184
+ point: r,
185
+ event: e
186
+ }), !P) return;
187
+ if (!n || "chartArea" === n.getElementType()) return void P.clear();
188
+ const o = w(n, P.getActive());
189
+ P.isSelected(o) && 1 === P.getItems().length || P.select([o]);
190
+ }, [
191
+ G,
192
+ P,
193
+ D,
194
+ L,
195
+ Q
196
+ ]);
197
+ if (G?.isDeleted()) return;
198
+ const ue = ne ?? T;
199
+ return a("div", {
200
+ ...A,
201
+ onPointerDown: de,
202
+ style: {
203
+ ...void 0 !== x ? { width: x } : {},
204
+ ...void 0 !== M ? { height: M } : {},
205
+ ...m,
206
+ overflow: "hidden"
207
+ },
208
+ ref: Z,
209
+ children: [
210
+ ue ? i("div", {
211
+ className: "chart-element-error",
212
+ style: {
213
+ padding: "8px",
214
+ fontSize: "12px",
215
+ color: "var(--sxl-color-error, #b00020)"
216
+ },
217
+ children: ue.message
218
+ }) : null,
219
+ i("div", {
220
+ className: "chart-element",
221
+ ref: _,
222
+ style: {
223
+ width: j || "100%",
224
+ height: V || "100%",
225
+ zoom: b,
226
+ position: "relative"
227
+ }
228
+ }),
229
+ ie.boxes.length > 0 ? a("div", {
230
+ className: "chart-element-selection",
231
+ style: {
232
+ position: "absolute",
233
+ left: 0,
234
+ top: 0,
235
+ width: j,
236
+ height: V,
237
+ zoom: b,
238
+ pointerEvents: "none"
239
+ },
240
+ children: [ie.boxes.map((e, t) => i("div", { style: {
241
+ position: "absolute",
242
+ left: e.x - 1,
243
+ top: e.y - 1,
244
+ width: Math.max(0, e.width),
245
+ height: Math.max(0, e.height),
246
+ border: "1px solid var(--sxl-color-primary, #1a73e8)",
247
+ boxSizing: "content-box"
248
+ } }, `box-${t}`)), ie.handles.map((e, t) => i("div", { style: {
249
+ position: "absolute",
250
+ left: e.x - 3,
251
+ top: e.y - 3,
252
+ width: 6,
253
+ height: 6,
254
+ background: "var(--sxl-color-base-100, #fff)",
255
+ border: "1px solid var(--sxl-color-primary, #1a73e8)",
256
+ boxSizing: "border-box"
257
+ } }, `handle-${t}`))]
258
+ }) : null
259
+ ]
260
+ });
261
+ }));
262
+ M.displayName = "ChartElement";
263
+ export { b as a, x as i, w as n, y as o, v as r, M as t };