@progress/kendo-react-spreadsheet 7.2.4-develop.3 → 7.3.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormulaInput.js +8 -0
- package/FormulaInput.mjs +109 -0
- package/List.js +8 -0
- package/List.mjs +34 -0
- package/NameBox.js +8 -0
- package/NameBox.mjs +109 -0
- package/SheetsBar.js +8 -0
- package/SheetsBar.mjs +211 -0
- package/Spreadsheet.js +8 -0
- package/Spreadsheet.mjs +227 -0
- package/dist/cdn/js/kendo-react-spreadsheet.js +8 -5
- package/index.d.mts +715 -5
- package/index.d.ts +715 -8
- package/index.js +8 -5
- package/index.mjs +77 -1355
- package/messages.js +8 -0
- package/messages.mjs +115 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +11 -11
- package/tools/adjustDecimals.js +8 -0
- package/tools/adjustDecimals.mjs +49 -0
- package/tools/align.js +8 -0
- package/tools/align.mjs +95 -0
- package/tools/backgroundColor.js +8 -0
- package/tools/backgroundColor.mjs +23 -0
- package/tools/bold.js +8 -0
- package/tools/bold.mjs +16 -0
- package/tools/cleanFormat.js +8 -0
- package/tools/cleanFormat.mjs +32 -0
- package/tools/defaultTools.js +8 -0
- package/tools/defaultTools.mjs +77 -0
- package/tools/export.js +8 -0
- package/tools/export.mjs +37 -0
- package/tools/fontFamily.js +8 -0
- package/tools/fontFamily.mjs +40 -0
- package/tools/fontSize.js +8 -0
- package/tools/fontSize.mjs +89 -0
- package/tools/format.js +8 -0
- package/tools/format.mjs +45 -0
- package/tools/gridLines.js +8 -0
- package/tools/gridLines.mjs +44 -0
- package/tools/italic.js +8 -0
- package/tools/italic.mjs +16 -0
- package/tools/open.js +8 -0
- package/tools/open.mjs +55 -0
- package/tools/redo.js +8 -0
- package/tools/redo.mjs +16 -0
- package/tools/tableTools.js +8 -0
- package/tools/tableTools.mjs +96 -0
- package/tools/textColor.js +8 -0
- package/tools/textColor.mjs +23 -0
- package/tools/textWrap.js +8 -0
- package/tools/textWrap.mjs +44 -0
- package/tools/underline.js +8 -0
- package/tools/underline.mjs +16 -0
- package/tools/undo.js +8 -0
- package/tools/undo.mjs +16 -0
- package/tools/utils.js +8 -0
- package/tools/utils.mjs +97 -0
- package/FormulaInput.d.ts +0 -9
- package/List.d.ts +0 -9
- package/NameBox.d.ts +0 -9
- package/SheetsBar.d.ts +0 -8
- package/Spreadsheet.d.ts +0 -51
- package/SpreadsheetProps.d.ts +0 -192
- package/messages.d.ts +0 -114
- package/package-metadata.d.ts +0 -9
- package/tools/adjustDecimals.d.ts +0 -24
- package/tools/align.d.ts +0 -48
- package/tools/backgroundColor.d.ts +0 -14
- package/tools/bold.d.ts +0 -14
- package/tools/cleanFormat.d.ts +0 -15
- package/tools/defaultTools.d.ts +0 -9
- package/tools/export.d.ts +0 -15
- package/tools/fontFamily.d.ts +0 -15
- package/tools/fontSize.d.ts +0 -43
- package/tools/format.d.ts +0 -15
- package/tools/gridLines.d.ts +0 -19
- package/tools/index.d.ts +0 -23
- package/tools/italic.d.ts +0 -14
- package/tools/open.d.ts +0 -15
- package/tools/redo.d.ts +0 -14
- package/tools/tableTools.d.ts +0 -68
- package/tools/textColor.d.ts +0 -14
- package/tools/textWrap.d.ts +0 -19
- package/tools/underline.d.ts +0 -14
- package/tools/undo.d.ts +0 -14
- package/tools/utils.d.ts +0 -95
package/index.mjs
CHANGED
|
@@ -1,1358 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
5
8
|
"use client";
|
|
6
|
-
import
|
|
7
|
-
import F from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
element: s.current,
|
|
27
|
-
props: t
|
|
28
|
-
})), e.useImperativeHandle(n, () => a.current), /* @__PURE__ */ e.createElement("div", { className: "k-list k-list-md" }, /* @__PURE__ */ e.createElement("div", { className: "k-list-content" }, /* @__PURE__ */ e.createElement(
|
|
29
|
-
"ul",
|
|
30
|
-
{
|
|
31
|
-
ref: s,
|
|
32
|
-
className: "k-spreadsheet-formula-list k-list-ul",
|
|
33
|
-
onMouseDown: (o) => o.preventDefault(),
|
|
34
|
-
style: { maxHeight: 280 }
|
|
35
|
-
},
|
|
36
|
-
t.data.map(
|
|
37
|
-
(o) => /* @__PURE__ */ e.createElement("li", { key: o.text, className: "k-list-item", onClick: () => t.onItemClick(o.value) }, /* @__PURE__ */ e.createElement(P, { name: "formula-fx", icon: me }), /* @__PURE__ */ e.createElement("span", { className: "k-list-item-text" }, o.text))
|
|
38
|
-
)
|
|
39
|
-
)));
|
|
40
|
-
});
|
|
41
|
-
Z.displayName = "List";
|
|
42
|
-
Z.propTypes = {};
|
|
43
|
-
const _ = e.forwardRef((t, n) => {
|
|
44
|
-
const [a, s] = e.useState(!1), [o, l] = e.useState(0), [d, u] = e.useState([]), r = e.useMemo(() => ({}), []);
|
|
45
|
-
r.showPopup = a, r.popupContentKey = o, r.data = d;
|
|
46
|
-
const v = e.useRef(null), y = e.useRef(null), C = e.useRef(null), w = e.useCallback(() => {
|
|
47
|
-
if (C.current && C.current.element)
|
|
48
|
-
return C.current.element.querySelector(".k-focus");
|
|
49
|
-
}, []), b = e.useCallback(() => {
|
|
50
|
-
const f = w();
|
|
51
|
-
f && f.classList.remove("k-focus");
|
|
52
|
-
}, []), p = e.useCallback((f) => {
|
|
53
|
-
const I = Array.from(C.current && C.current.element.children || []), D = w();
|
|
54
|
-
let m;
|
|
55
|
-
if (D) {
|
|
56
|
-
const x = I.indexOf(D);
|
|
57
|
-
D.classList.remove("k-focus"), m = I[x + f] ? I[x + f] : f === 1 ? I[0] : I[I.length - 1];
|
|
58
|
-
} else
|
|
59
|
-
m = f === 1 ? I[0] : I[I.length - 1];
|
|
60
|
-
m && m.classList.add("k-focus");
|
|
61
|
-
}, []);
|
|
62
|
-
e.useImperativeHandle(v, () => ({
|
|
63
|
-
element: y.current,
|
|
64
|
-
props: t,
|
|
65
|
-
popup: {
|
|
66
|
-
open: () => {
|
|
67
|
-
s(!0);
|
|
68
|
-
},
|
|
69
|
-
close: () => {
|
|
70
|
-
s(!1);
|
|
71
|
-
},
|
|
72
|
-
position: () => {
|
|
73
|
-
l(r.popupContentKey + 1);
|
|
74
|
-
},
|
|
75
|
-
visible: () => r.showPopup
|
|
76
|
-
},
|
|
77
|
-
list: {
|
|
78
|
-
get element() {
|
|
79
|
-
return C.current && C.current.element;
|
|
80
|
-
},
|
|
81
|
-
data: (f) => {
|
|
82
|
-
if (f)
|
|
83
|
-
u(f);
|
|
84
|
-
else
|
|
85
|
-
return r.data;
|
|
86
|
-
},
|
|
87
|
-
value: () => ({}),
|
|
88
|
-
focus: () => Array.from(C.current && C.current.element && C.current.element.children || []).indexOf(w()),
|
|
89
|
-
// select: (x) => {
|
|
90
|
-
// console.log('select', x);
|
|
91
|
-
// },
|
|
92
|
-
focusNext: () => {
|
|
93
|
-
p(1);
|
|
94
|
-
},
|
|
95
|
-
focusPrev: () => {
|
|
96
|
-
p(-1);
|
|
97
|
-
},
|
|
98
|
-
focusFirst: () => {
|
|
99
|
-
const f = C.current && C.current.element;
|
|
100
|
-
f && f.children.item(0) && (b(), f.children.item(0).classList.add("k-focus"));
|
|
101
|
-
},
|
|
102
|
-
focusLast: () => {
|
|
103
|
-
const f = C.current && C.current.element;
|
|
104
|
-
f && f.children.length && (b(), f.children.item(f.children.length - 1).classList.add("k-focus"));
|
|
105
|
-
},
|
|
106
|
-
itemClick: (f) => {
|
|
107
|
-
r.itemClick = f;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}), []), e.useImperativeHandle(n, () => v.current, []);
|
|
111
|
-
const h = e.useCallback((f) => {
|
|
112
|
-
r.itemClick && r.itemClick(f);
|
|
113
|
-
}, []);
|
|
114
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
115
|
-
"div",
|
|
116
|
-
{
|
|
117
|
-
className: J("k-spreadsheet-formula-input", t.className),
|
|
118
|
-
contentEditable: "true",
|
|
119
|
-
spellCheck: "false",
|
|
120
|
-
style: { whiteSpace: "pre" },
|
|
121
|
-
ref: y
|
|
122
|
-
}
|
|
123
|
-
), /* @__PURE__ */ e.createElement(
|
|
124
|
-
Zt,
|
|
125
|
-
{
|
|
126
|
-
show: a,
|
|
127
|
-
anchor: y.current,
|
|
128
|
-
animate: { openDuration: 100, closeDuration: 100 },
|
|
129
|
-
contentKey: o,
|
|
130
|
-
popupClass: "k-list-container"
|
|
131
|
-
},
|
|
132
|
-
/* @__PURE__ */ e.createElement(Z, { data: d, ref: C, onItemClick: h })
|
|
133
|
-
));
|
|
134
|
-
});
|
|
135
|
-
_.displayName = "FormulaInput";
|
|
136
|
-
_.propTypes = {};
|
|
137
|
-
const ye = "spreadsheet.bold", be = "spreadsheet.italic", ke = "spreadsheet.underline", xe = "spreadsheet.openFile", Ee = "spreadsheet.textColor", Se = "spreadsheet.background", Ie = "spreadsheet.addRowAbove", we = "spreadsheet.addRowBelow", Ne = "spreadsheet.addColumnLeft", Re = "spreadsheet.addColumnRight", Ae = "spreadsheet.deleteRow", De = "spreadsheet.deleteColumn", Te = "spreadsheet.undo", Le = "spreadsheet.redo", Fe = "spreadsheet.fontSize", Ke = "spreadsheet.fontSizeIncrease", Me = "spreadsheet.fontSizeDecrease", ze = "spreadsheet.fontName", Be = "spreadsheet.cleanFormatting", Pe = "spreadsheet.format", He = "spreadsheet.alignHorizontally", Oe = "spreadsheet.alignVertically", Ue = "spreadsheet.align", Ve = "spreadsheet.alignLeft", We = "spreadsheet.alignRight", _e = "spreadsheet.alignCenter", Je = "spreadsheet.center", $e = "spreadsheet.alignJustify", je = "spreadsheet.justify", Ge = "spreadsheet.alignTop", qe = "spreadsheet.alignMiddle", Xe = "spreadsheet.alignBottom", Ze = "spreadsheet.increaseDecimal", Ye = "spreadsheet.decreaseDecimal", Qe = "spreadsheet.textWrap", et = "spreadsheet.gridLines", tt = "spreadsheet.exportToExcel", nt = "spreadsheet.nameBox", ot = "spreadsheet.defaultSheetName", at = "spreadsheet.home", lt = "spreadsheet.file", st = "spreadsheet.insert", rt = "spreadsheet.formatTab", ct = "spreadsheet.addNewSheet", it = "spreadsheet.error", dt = "spreadsheet.ok", ut = "spreadsheet.modifyMerged", mt = "spreadsheet.cannotModifyDisabled", pt = "spreadsheet.openUnsupported", ft = "spreadsheet.duplicateSheetName", E = {
|
|
138
|
-
[ye]: "Bold",
|
|
139
|
-
[be]: "Italic",
|
|
140
|
-
[ke]: "Underline",
|
|
141
|
-
[Te]: "Undo",
|
|
142
|
-
[Le]: "Redo",
|
|
143
|
-
[Fe]: "Font size",
|
|
144
|
-
[Ke]: "Increase Font size",
|
|
145
|
-
[Me]: "Decrease Font size",
|
|
146
|
-
[ze]: "Font",
|
|
147
|
-
[Be]: "Clean formatting",
|
|
148
|
-
[Pe]: "Custom format...",
|
|
149
|
-
[He]: "Align horizontally",
|
|
150
|
-
[Oe]: "Align vertically",
|
|
151
|
-
[Ue]: "Align",
|
|
152
|
-
[Ve]: "Align left",
|
|
153
|
-
[We]: "Align right",
|
|
154
|
-
[_e]: "Align center",
|
|
155
|
-
[$e]: "Align justify",
|
|
156
|
-
[Je]: "Center",
|
|
157
|
-
[je]: "Justify",
|
|
158
|
-
[Ge]: "Align top",
|
|
159
|
-
[qe]: "Align middle",
|
|
160
|
-
[Xe]: "Align bottom",
|
|
161
|
-
[Ze]: "Increase decimal",
|
|
162
|
-
[Ye]: "Decrease decimal",
|
|
163
|
-
[Ee]: "Text Color",
|
|
164
|
-
[Se]: "Background color",
|
|
165
|
-
[Ie]: "Add row above",
|
|
166
|
-
[we]: "Add row below",
|
|
167
|
-
[Ne]: "Add column left",
|
|
168
|
-
[Re]: "Add column right",
|
|
169
|
-
[Ae]: "Delete row",
|
|
170
|
-
[De]: "Delete column",
|
|
171
|
-
[xe]: "Open...",
|
|
172
|
-
[tt]: "Export to Excel",
|
|
173
|
-
[Qe]: "Text Wrap",
|
|
174
|
-
[et]: "Toggle gridlines",
|
|
175
|
-
[nt]: "Name Box",
|
|
176
|
-
[ot]: "Sheet",
|
|
177
|
-
[at]: "Home",
|
|
178
|
-
[lt]: "File",
|
|
179
|
-
[st]: "Insert",
|
|
180
|
-
[ct]: "Add new sheet",
|
|
181
|
-
[rt]: "Format",
|
|
182
|
-
[ut]: "Cannot change part of a merged cell.",
|
|
183
|
-
[mt]: "Cannot modify disabled cells.",
|
|
184
|
-
[pt]: "Unsupported format. Please select an .xlsx file.",
|
|
185
|
-
[ft]: "There is an existing sheet with this name. Please enter another name.",
|
|
186
|
-
[it]: "Error",
|
|
187
|
-
[dt]: "OK"
|
|
188
|
-
}, c = {
|
|
189
|
-
bold: ye,
|
|
190
|
-
italic: be,
|
|
191
|
-
underline: ke,
|
|
192
|
-
undo: Te,
|
|
193
|
-
redo: Le,
|
|
194
|
-
fontSize: Fe,
|
|
195
|
-
fontSizeIncrease: Ke,
|
|
196
|
-
fontSizeDecrease: Me,
|
|
197
|
-
fontName: ze,
|
|
198
|
-
cleanFormatting: Be,
|
|
199
|
-
format: Pe,
|
|
200
|
-
alignHorizontally: He,
|
|
201
|
-
alignVertically: Oe,
|
|
202
|
-
align: Ue,
|
|
203
|
-
alignLeft: Ve,
|
|
204
|
-
alignRight: We,
|
|
205
|
-
alignCenter: _e,
|
|
206
|
-
center: Je,
|
|
207
|
-
alignJustify: $e,
|
|
208
|
-
justify: je,
|
|
209
|
-
alignTop: Ge,
|
|
210
|
-
alignMiddle: qe,
|
|
211
|
-
alignBottom: Xe,
|
|
212
|
-
increaseDecimal: Ze,
|
|
213
|
-
decreaseDecimal: Ye,
|
|
214
|
-
textColor: Ee,
|
|
215
|
-
background: Se,
|
|
216
|
-
addRowAbove: Ie,
|
|
217
|
-
addRowBelow: we,
|
|
218
|
-
addColumnLeft: Ne,
|
|
219
|
-
addColumnRight: Re,
|
|
220
|
-
deleteRow: Ae,
|
|
221
|
-
deleteColumn: De,
|
|
222
|
-
open: xe,
|
|
223
|
-
exportToExcel: tt,
|
|
224
|
-
textWrap: Qe,
|
|
225
|
-
gridLines: et,
|
|
226
|
-
nameBox: nt,
|
|
227
|
-
defaultSheetName: ot,
|
|
228
|
-
file: lt,
|
|
229
|
-
home: at,
|
|
230
|
-
insert: st,
|
|
231
|
-
addNewSheet: ct,
|
|
232
|
-
error: it,
|
|
233
|
-
ok: dt,
|
|
234
|
-
modifyMerged: ut,
|
|
235
|
-
cannotModifyDisabled: mt,
|
|
236
|
-
openUnsupported: pt,
|
|
237
|
-
duplicateSheetName: ft,
|
|
238
|
-
formatTab: rt
|
|
239
|
-
}, Y = e.forwardRef((t, n) => {
|
|
240
|
-
const a = e.useRef(null), s = e.useRef(null), [o, l] = e.useState([]), [d, u] = e.useState(!1), [r, v] = e.useState(""), y = e.useMemo(() => ({}), []);
|
|
241
|
-
y.data = o, e.useImperativeHandle(a, () => ({
|
|
242
|
-
value: (m) => {
|
|
243
|
-
if (m === void 0) {
|
|
244
|
-
const x = s.current && s.current.value;
|
|
245
|
-
return x && (x.name || x);
|
|
246
|
-
} else
|
|
247
|
-
v(m || "");
|
|
248
|
-
}
|
|
249
|
-
}), []), e.useImperativeHandle(n, () => a.current, []);
|
|
250
|
-
const C = e.useCallback((m) => {
|
|
251
|
-
const x = t.nameEditor();
|
|
252
|
-
x && x.trigger("delete", { name: m });
|
|
253
|
-
}, []), w = e.useCallback((m, x) => {
|
|
254
|
-
const T = /* @__PURE__ */ e.createElement(e.Fragment, null, m.props.children, /* @__PURE__ */ e.createElement(
|
|
255
|
-
"span",
|
|
256
|
-
{
|
|
257
|
-
role: "button",
|
|
258
|
-
className: "k-button-delete",
|
|
259
|
-
onClick: () => C(x.dataItem[x.textField]),
|
|
260
|
-
onMouseDown: (k) => k.preventDefault(),
|
|
261
|
-
onPointerDown: (k) => k.preventDefault(),
|
|
262
|
-
"data-role": "delete"
|
|
263
|
-
},
|
|
264
|
-
/* @__PURE__ */ e.createElement(
|
|
265
|
-
P,
|
|
266
|
-
{
|
|
267
|
-
name: "x",
|
|
268
|
-
icon: pe
|
|
269
|
-
}
|
|
270
|
-
)
|
|
271
|
-
));
|
|
272
|
-
return e.cloneElement(m, m.props, T);
|
|
273
|
-
}, []), b = e.useCallback((m) => e.cloneElement(m, { ...m.props }, /* @__PURE__ */ e.createElement("div", null)), []), p = e.useCallback((m) => {
|
|
274
|
-
if (m.syntheticEvent && m.syntheticEvent.type === "change")
|
|
275
|
-
return;
|
|
276
|
-
const x = t.nameEditor();
|
|
277
|
-
x && (l(x.readData()), u(!0));
|
|
278
|
-
}, []), h = e.useCallback(() => {
|
|
279
|
-
u(!1);
|
|
280
|
-
}, []), f = e.useCallback((m) => {
|
|
281
|
-
if (m.syntheticEvent.target.closest("[data-role]"))
|
|
282
|
-
return;
|
|
283
|
-
const x = t.nameEditor();
|
|
284
|
-
if (x && m.value) {
|
|
285
|
-
const T = m.value.name;
|
|
286
|
-
T !== r && (x.trigger("select", { name: T }), v(T));
|
|
287
|
-
}
|
|
288
|
-
}, [r]), I = e.useCallback((m) => {
|
|
289
|
-
const x = t.nameEditor();
|
|
290
|
-
if (x)
|
|
291
|
-
if (m.key === "Enter") {
|
|
292
|
-
const T = m.target.value;
|
|
293
|
-
x.trigger("enter", { value: T }), v(T);
|
|
294
|
-
} else
|
|
295
|
-
m.key === "Escape" && (x.trigger("cancel"), v(y.prevValue));
|
|
296
|
-
}, []), D = e.useCallback((m) => {
|
|
297
|
-
y.prevValue = m.value.name;
|
|
298
|
-
}, []);
|
|
299
|
-
return /* @__PURE__ */ e.createElement(
|
|
300
|
-
"div",
|
|
301
|
-
{
|
|
302
|
-
className: "k-spreadsheet-name-editor",
|
|
303
|
-
onKeyDown: I
|
|
304
|
-
},
|
|
305
|
-
/* @__PURE__ */ e.createElement(
|
|
306
|
-
he,
|
|
307
|
-
{
|
|
308
|
-
ref: s,
|
|
309
|
-
title: R().toLanguageString(c.nameBox, E[c.nameBox]),
|
|
310
|
-
popupSettings: { className: "k-spreadsheet-names-popup" },
|
|
311
|
-
fillMode: "flat",
|
|
312
|
-
clearButton: !1,
|
|
313
|
-
dataItemKey: "name",
|
|
314
|
-
textField: "name",
|
|
315
|
-
itemRender: w,
|
|
316
|
-
data: o,
|
|
317
|
-
value: r ? o.find((m) => m.name === r) || { name: r } : null,
|
|
318
|
-
onChange: f,
|
|
319
|
-
opened: d,
|
|
320
|
-
onOpen: p,
|
|
321
|
-
onClose: h,
|
|
322
|
-
onFocus: D,
|
|
323
|
-
listNoDataRender: b,
|
|
324
|
-
allowCustom: !0
|
|
325
|
-
}
|
|
326
|
-
)
|
|
327
|
-
);
|
|
328
|
-
});
|
|
329
|
-
Y.displayName = "NameBox";
|
|
330
|
-
Y.propTypes = {};
|
|
331
|
-
const zn = {
|
|
332
|
-
onSelect: () => {
|
|
333
|
-
},
|
|
334
|
-
onDelete: () => {
|
|
335
|
-
},
|
|
336
|
-
onEnterEdit: () => {
|
|
337
|
-
},
|
|
338
|
-
onCancelEdit: () => {
|
|
339
|
-
},
|
|
340
|
-
onExitEdit: () => {
|
|
341
|
-
},
|
|
342
|
-
onEdit: () => {
|
|
343
|
-
}
|
|
344
|
-
}, gt = e.createContext(zn), Bn = (t) => {
|
|
345
|
-
const n = t.dataItem, { onSelect: a, onDelete: s, onEnterEdit: o, onExitEdit: l, onCancelEdit: d, onEdit: u } = e.useContext(gt), r = e.useCallback((p) => {
|
|
346
|
-
p.target instanceof HTMLElement && p.target.nodeName === "INPUT" || a.call(void 0, n, p);
|
|
347
|
-
}, [n, a]), v = e.useCallback((p) => {
|
|
348
|
-
s.call(void 0, n, p);
|
|
349
|
-
}, [n, s]), y = e.useCallback((p) => {
|
|
350
|
-
p.target instanceof HTMLElement && p.target.nodeName === "INPUT" || o.call(void 0, n, p);
|
|
351
|
-
}, [n, o]), C = e.useCallback((p) => {
|
|
352
|
-
l.call(void 0, n, p);
|
|
353
|
-
}, [n, l]), w = e.useCallback((p) => {
|
|
354
|
-
p.key === "Enter" ? l.call(void 0, n, p) : p.key === "Escape" && d.call(void 0, n, p);
|
|
355
|
-
}, [n, l, d]), b = e.useCallback((p) => {
|
|
356
|
-
u.call(void 0, { ...n, text: p.target.value }, p);
|
|
357
|
-
}, [n, u]);
|
|
358
|
-
return /* @__PURE__ */ e.createElement(
|
|
359
|
-
"li",
|
|
360
|
-
{
|
|
361
|
-
style: t.style,
|
|
362
|
-
...t.attributes,
|
|
363
|
-
ref: t.forwardRef,
|
|
364
|
-
role: "tab",
|
|
365
|
-
className: J("k-item k-tabstrip-item", {
|
|
366
|
-
"k-disabled": t.isDisabled,
|
|
367
|
-
"k-active k-state-tab-on-top k-spreadsheet-sheets-bar-active": n.active,
|
|
368
|
-
"k-spreadsheet-sheets-bar-inactive": !n.active,
|
|
369
|
-
"k-first": n.first,
|
|
370
|
-
"k-last": n.last
|
|
371
|
-
}),
|
|
372
|
-
onClick: r,
|
|
373
|
-
onDoubleClick: y
|
|
374
|
-
},
|
|
375
|
-
n.inEdit ? /* @__PURE__ */ e.createElement(
|
|
376
|
-
"input",
|
|
377
|
-
{
|
|
378
|
-
type: "text",
|
|
379
|
-
className: "k-textbox k-spreadsheet-sheets-editor",
|
|
380
|
-
value: n.text,
|
|
381
|
-
onChange: b,
|
|
382
|
-
maxLength: 50,
|
|
383
|
-
autoFocus: !0,
|
|
384
|
-
onBlur: C,
|
|
385
|
-
onKeyDown: w
|
|
386
|
-
}
|
|
387
|
-
) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("span", { className: "k-link" }, n.text), n.first && n.last ? null : /* @__PURE__ */ e.createElement("span", { className: "k-link k-spreadsheet-sheets-remove", onClick: v }, /* @__PURE__ */ e.createElement(P, { name: "x", icon: pe })))
|
|
388
|
-
);
|
|
389
|
-
}, ht = e.forwardRef((t, n) => {
|
|
390
|
-
const { children: a, className: s, ...o } = t;
|
|
391
|
-
return /* @__PURE__ */ e.createElement(
|
|
392
|
-
"ul",
|
|
393
|
-
{
|
|
394
|
-
className: J("k-tabstrip-items k-reset", s),
|
|
395
|
-
role: "tablist",
|
|
396
|
-
...o,
|
|
397
|
-
ref: n
|
|
398
|
-
},
|
|
399
|
-
a
|
|
400
|
-
);
|
|
401
|
-
});
|
|
402
|
-
ht.displayName = "TabsList";
|
|
403
|
-
const Pn = (t) => {
|
|
404
|
-
const { sheets: n, setSheets: a, onSheetSelect: s, onSheetDelete: o, onSheetEdit: l, onSheetReorderEnd: d } = t, [u, r] = e.useState(null), v = e.useRef(!1), y = e.useRef(-1), C = e.useCallback((k) => {
|
|
405
|
-
a(k.map((N, L, A) => ({ ...N, first: L === 0, last: L === A.length - 1 })));
|
|
406
|
-
}, []), w = e.useCallback((k) => {
|
|
407
|
-
C(k.newState);
|
|
408
|
-
}, [C, d]), b = e.useCallback((k) => {
|
|
409
|
-
d.call(void 0, k);
|
|
410
|
-
}, [d]), p = e.useCallback((k) => {
|
|
411
|
-
v.current = !0, y.current = k.prevIndex;
|
|
412
|
-
}, []), h = e.useCallback((k) => {
|
|
413
|
-
setTimeout(() => {
|
|
414
|
-
v.current = !1;
|
|
415
|
-
}, 50), d.call(void 0, { ...k, prevIndex: y.current });
|
|
416
|
-
}, []), f = e.useCallback((k, N) => {
|
|
417
|
-
v.current || s.call(void 0, k, N);
|
|
418
|
-
}, [s]), I = e.useCallback((k, N) => {
|
|
419
|
-
N.stopPropagation(), o.call(void 0, k);
|
|
420
|
-
}, [n, o]), D = e.useCallback((k, N) => {
|
|
421
|
-
N.stopPropagation(), N.preventDefault();
|
|
422
|
-
const L = n.map((A) => ({ ...A, active: A.id === k.id, inEdit: A.id === k.id }));
|
|
423
|
-
a(L), r({ ...k });
|
|
424
|
-
}, [n]), m = e.useCallback((k, N) => {
|
|
425
|
-
N.stopPropagation(), N.preventDefault();
|
|
426
|
-
const L = n.map((A) => ({ ...A, inEdit: !1, text: A.inEdit && u ? u.text : A.text }));
|
|
427
|
-
a(L), r(null);
|
|
428
|
-
}, [n, u]), x = e.useCallback((k, N) => {
|
|
429
|
-
N.stopPropagation(), N.preventDefault();
|
|
430
|
-
const L = n.map((H) => ({ ...H, inEdit: !1 })), A = n.findIndex((H) => H.id === k.id);
|
|
431
|
-
a(L), r(null), l.call(void 0, k, A);
|
|
432
|
-
}, [n, l]), T = e.useCallback((k, N) => {
|
|
433
|
-
N.stopPropagation(), N.preventDefault();
|
|
434
|
-
const L = n.map((A) => ({ ...A, text: k.id === A.id ? k.text : A.text }));
|
|
435
|
-
a(L);
|
|
436
|
-
}, [n]);
|
|
437
|
-
return /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-sheets-items k-tabstrip k-floatwrap k-tabstrip-bottom" }, /* @__PURE__ */ e.createElement("div", { className: "k-tabstrip-items-wrapper k-hstack" }, /* @__PURE__ */ e.createElement(gt.Provider, { value: { onSelect: f, onDelete: I, onEnterEdit: D, onCancelEdit: m, onExitEdit: x, onEdit: T } }, /* @__PURE__ */ e.createElement(
|
|
438
|
-
Ln,
|
|
439
|
-
{
|
|
440
|
-
idField: "id",
|
|
441
|
-
data: n,
|
|
442
|
-
itemUI: Bn,
|
|
443
|
-
itemsWrapUI: ht,
|
|
444
|
-
onDragOver: w,
|
|
445
|
-
onNavigate: b,
|
|
446
|
-
onDragStart: p,
|
|
447
|
-
onDragEnd: h
|
|
448
|
-
}
|
|
449
|
-
))));
|
|
450
|
-
}, Hn = (t, n, a) => t.map((s, o, l) => ({
|
|
451
|
-
text: s.name(),
|
|
452
|
-
id: a + "-sheet-" + o,
|
|
453
|
-
first: o === 0,
|
|
454
|
-
last: o === l.length - 1,
|
|
455
|
-
active: s.name() === n
|
|
456
|
-
})), On = (t) => {
|
|
457
|
-
const { spreadsheetRef: n } = t, [a, s] = e.useState([]), o = e.useRef((a.find((b) => b.active) || {}).text), l = Yt(), d = e.useCallback(() => {
|
|
458
|
-
n.current && (n.current.view.sheetsbar.onSheetSelect(o.current), s(Hn(n.current.sheets(), o.current, l)));
|
|
459
|
-
}, []), u = e.useCallback(() => {
|
|
460
|
-
if (n.current) {
|
|
461
|
-
const b = n.current.sheets();
|
|
462
|
-
b.find((p) => p.name() === o.current) || (o.current = b[b.length - 1].name()), d();
|
|
463
|
-
}
|
|
464
|
-
}, []);
|
|
465
|
-
e.useEffect(() => (n.current && (n.current.sheets().length && (o.current = n.current.sheets()[0].name(), d()), n.current.view.bind("update", u)), () => {
|
|
466
|
-
n.current && n.current.view.unbind("update", u);
|
|
467
|
-
}), [n.current]);
|
|
468
|
-
const r = e.useCallback((b) => {
|
|
469
|
-
o.current !== b.text && (o.current = b.text, d());
|
|
470
|
-
}, []), v = e.useCallback(() => {
|
|
471
|
-
if (n.current) {
|
|
472
|
-
n.current.view.sheetsbar.onAddSelect();
|
|
473
|
-
const b = n.current.sheets();
|
|
474
|
-
o.current = b[b.length - 1].name(), d();
|
|
475
|
-
}
|
|
476
|
-
}, []), y = e.useCallback((b) => {
|
|
477
|
-
if (n.current) {
|
|
478
|
-
if (o.current === b.text) {
|
|
479
|
-
const p = n.current.sheets(), h = p.findIndex((I) => I.name() === b.text), f = p[h + 1] || p[h - 1];
|
|
480
|
-
o.current = f ? f.name() : "";
|
|
481
|
-
}
|
|
482
|
-
n.current.view.sheetsbar.onSheetRemove(b.text), d();
|
|
483
|
-
}
|
|
484
|
-
}, []), C = e.useCallback((b, p) => {
|
|
485
|
-
if (n.current) {
|
|
486
|
-
let h = b.text;
|
|
487
|
-
const f = n.current.sheets(), I = f[p];
|
|
488
|
-
if (!h) {
|
|
489
|
-
o.current = I.name(), d();
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
if (I && I.name() === h)
|
|
493
|
-
return;
|
|
494
|
-
f.find((D) => D.name() === h) && (h = I.name()), n.current.view.sheetsbar.onSheetRename(h, p), o.current = h, d();
|
|
495
|
-
}
|
|
496
|
-
}, []), w = e.useCallback((b) => {
|
|
497
|
-
if (n.current) {
|
|
498
|
-
const { prevIndex: p, nextIndex: h } = b;
|
|
499
|
-
o.current = n.current.sheets()[p].name(), n.current.view.sheetsbar.onSheetReorderEnd({ oldIndex: p, newIndex: h }), d();
|
|
500
|
-
}
|
|
501
|
-
}, []);
|
|
502
|
-
return /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-sheets-bar k-header" }, /* @__PURE__ */ e.createElement(
|
|
503
|
-
K,
|
|
504
|
-
{
|
|
505
|
-
fillMode: "flat",
|
|
506
|
-
icon: "plus",
|
|
507
|
-
className: "k-spreadsheet-sheets-bar-add",
|
|
508
|
-
title: R().toLanguageString(c.addNewSheet, E[c.addNewSheet]),
|
|
509
|
-
svgIcon: nn,
|
|
510
|
-
onClick: v
|
|
511
|
-
}
|
|
512
|
-
), /* @__PURE__ */ e.createElement(
|
|
513
|
-
Pn,
|
|
514
|
-
{
|
|
515
|
-
sheets: a,
|
|
516
|
-
setSheets: s,
|
|
517
|
-
onSheetSelect: r,
|
|
518
|
-
onSheetDelete: y,
|
|
519
|
-
onSheetEdit: C,
|
|
520
|
-
onSheetReorderEnd: w
|
|
521
|
-
}
|
|
522
|
-
));
|
|
523
|
-
}, Ct = (t) => {
|
|
524
|
-
const { spreadsheetRef: n } = t, a = e.useCallback(() => {
|
|
525
|
-
n.current && n.current.saveAsExcel({
|
|
526
|
-
...n.current.options.excel,
|
|
527
|
-
saveAs: Ce,
|
|
528
|
-
Workbook: ve
|
|
529
|
-
});
|
|
530
|
-
}, []);
|
|
531
|
-
return /* @__PURE__ */ e.createElement(
|
|
532
|
-
K,
|
|
533
|
-
{
|
|
534
|
-
className: "k-toolbar-button",
|
|
535
|
-
title: "Export...",
|
|
536
|
-
icon: "download",
|
|
537
|
-
fillMode: "flat",
|
|
538
|
-
svgIcon: on,
|
|
539
|
-
onClick: a
|
|
540
|
-
}
|
|
541
|
-
);
|
|
542
|
-
};
|
|
543
|
-
Ct.displayName = "ExcelExport";
|
|
544
|
-
const vt = (t) => {
|
|
545
|
-
const { spreadsheetRef: n } = t, a = e.useCallback((o) => {
|
|
546
|
-
const l = o.target;
|
|
547
|
-
if (l instanceof Element && l.parentNode) {
|
|
548
|
-
const d = l.closest(".k-toolbar"), u = d && d.querySelector(".k-upload input");
|
|
549
|
-
u && u.click();
|
|
550
|
-
}
|
|
551
|
-
}, []), s = e.useCallback((o) => {
|
|
552
|
-
const l = o.newState;
|
|
553
|
-
if (l[0] && l[0].getRawFile) {
|
|
554
|
-
const d = l[0].getRawFile();
|
|
555
|
-
n.current && n.current.executeCommand({ command: "OpenCommand", options: { file: d } });
|
|
556
|
-
}
|
|
557
|
-
}, []);
|
|
558
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(
|
|
559
|
-
K,
|
|
560
|
-
{
|
|
561
|
-
className: "k-toolbar-button",
|
|
562
|
-
title: R().toLanguageString(c.open, E[c.open]),
|
|
563
|
-
icon: "folder-open",
|
|
564
|
-
svgIcon: an,
|
|
565
|
-
fillMode: "flat",
|
|
566
|
-
onClick: a
|
|
567
|
-
}
|
|
568
|
-
), /* @__PURE__ */ e.createElement("div", { style: { display: "none" } }, /* @__PURE__ */ e.createElement(
|
|
569
|
-
Kn,
|
|
570
|
-
{
|
|
571
|
-
restrictions: { allowedExtensions: [".xlsx"] },
|
|
572
|
-
onAdd: s,
|
|
573
|
-
autoUpload: !1,
|
|
574
|
-
defaultFiles: [],
|
|
575
|
-
multiple: !1,
|
|
576
|
-
accept: ".xlsx,.XLSX",
|
|
577
|
-
withCredentials: !1
|
|
578
|
-
}
|
|
579
|
-
)));
|
|
580
|
-
};
|
|
581
|
-
vt.displayName = "Open";
|
|
582
|
-
const Un = ["Arial", "Courier New", "Georgia", "Times New Roman", "Trebuchet MS", "Verdana"], Vn = "Arial", Wn = [8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72], _n = 12, Jn = [
|
|
583
|
-
{ text: "Automatic", value: null },
|
|
584
|
-
{ text: "Text", value: "@" },
|
|
585
|
-
{ text: "Number", value: "#,0.00" },
|
|
586
|
-
{ text: "Percent", value: "0.00%" },
|
|
587
|
-
{ text: "Financial", value: '_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)' },
|
|
588
|
-
{ text: "Currency", value: "$#,##0.00;[Red]$#,##0.00" },
|
|
589
|
-
{ text: "Date", value: "m/d/yyyy" },
|
|
590
|
-
{ text: "Time", value: "h:mm:ss AM/PM" },
|
|
591
|
-
{ text: "Date time", value: "m/d/yyyy h:mm" },
|
|
592
|
-
{ text: "Duration", value: "[h]:mm:ss" }
|
|
593
|
-
], Q = (t) => (a) => {
|
|
594
|
-
const { property: s, icon: o, svgIcon: l, titleKey: d } = t, { spreadsheetRef: u, value: r } = a, v = e.useCallback(() => {
|
|
595
|
-
if (u.current) {
|
|
596
|
-
const C = {
|
|
597
|
-
command: "PropertyChangeCommand",
|
|
598
|
-
options: { property: s, value: !r }
|
|
599
|
-
};
|
|
600
|
-
u.current.executeCommand(C);
|
|
601
|
-
}
|
|
602
|
-
}, [r]);
|
|
603
|
-
return /* @__PURE__ */ e.createElement(
|
|
604
|
-
K,
|
|
605
|
-
{
|
|
606
|
-
type: "button",
|
|
607
|
-
icon: o,
|
|
608
|
-
svgIcon: l,
|
|
609
|
-
fillMode: "flat",
|
|
610
|
-
togglable: !0,
|
|
611
|
-
onClick: v,
|
|
612
|
-
selected: r,
|
|
613
|
-
title: R().toLanguageString(d, E[d])
|
|
614
|
-
}
|
|
615
|
-
);
|
|
616
|
-
}, yt = (t) => (a) => {
|
|
617
|
-
const { property: s, titleKey: o, ...l } = t, { spreadsheetRef: d, value: u } = a, r = e.useCallback(
|
|
618
|
-
(v) => {
|
|
619
|
-
if (d.current) {
|
|
620
|
-
const y = {
|
|
621
|
-
command: "PropertyChangeCommand",
|
|
622
|
-
options: { property: s, value: v.value || null }
|
|
623
|
-
};
|
|
624
|
-
d.current.executeCommand(y);
|
|
625
|
-
}
|
|
626
|
-
},
|
|
627
|
-
[s]
|
|
628
|
-
);
|
|
629
|
-
return /* @__PURE__ */ e.createElement(
|
|
630
|
-
Mn,
|
|
631
|
-
{
|
|
632
|
-
onChange: r,
|
|
633
|
-
onActiveColorClick: r,
|
|
634
|
-
fillMode: "flat",
|
|
635
|
-
...l,
|
|
636
|
-
title: R().toLanguageString(o, E[o]),
|
|
637
|
-
value: u
|
|
638
|
-
}
|
|
639
|
-
);
|
|
640
|
-
}, bt = (t) => (a) => {
|
|
641
|
-
const { spreadsheetRef: s } = a, o = e.useCallback(() => {
|
|
642
|
-
s.current && s.current.workbook.undoRedoStack[t.action]();
|
|
643
|
-
}, []);
|
|
644
|
-
return /* @__PURE__ */ e.createElement(
|
|
645
|
-
K,
|
|
646
|
-
{
|
|
647
|
-
type: "button",
|
|
648
|
-
icon: t.icon,
|
|
649
|
-
svgIcon: t.svgIcon,
|
|
650
|
-
fillMode: "flat",
|
|
651
|
-
title: R().toLanguageString(t.titleKey, E[t.titleKey]),
|
|
652
|
-
onClick: o
|
|
653
|
-
}
|
|
654
|
-
);
|
|
655
|
-
}, $n = { property: "bold", icon: "bold", svgIcon: ln, titleKey: c.bold }, kt = Q($n);
|
|
656
|
-
kt.displayName = "Bold";
|
|
657
|
-
const jn = { property: "italic", icon: "italic", svgIcon: sn, titleKey: c.italic }, xt = Q(jn);
|
|
658
|
-
xt.displayName = "Italic";
|
|
659
|
-
const Gn = { property: "underline", icon: "underline", svgIcon: rn, titleKey: c.underline }, Et = Q(Gn);
|
|
660
|
-
Et.displayName = "Underline";
|
|
661
|
-
const St = (t) => {
|
|
662
|
-
const { spreadsheetRef: n, value: a } = t, s = e.useCallback((o) => {
|
|
663
|
-
if (n.current) {
|
|
664
|
-
const l = {
|
|
665
|
-
command: "PropertyChangeCommand",
|
|
666
|
-
options: { property: "fontFamily", value: o.value || null }
|
|
667
|
-
};
|
|
668
|
-
n.current.executeCommand(l);
|
|
669
|
-
}
|
|
670
|
-
}, []);
|
|
671
|
-
return /* @__PURE__ */ e.createElement(
|
|
672
|
-
Dn,
|
|
673
|
-
{
|
|
674
|
-
onChange: s,
|
|
675
|
-
value: a,
|
|
676
|
-
data: Un,
|
|
677
|
-
defaultValue: Vn,
|
|
678
|
-
fillMode: "flat",
|
|
679
|
-
title: R().toLanguageString(c.fontName, E[c.fontName]),
|
|
680
|
-
leftRightKeysNavigation: !1
|
|
681
|
-
}
|
|
682
|
-
);
|
|
683
|
-
};
|
|
684
|
-
St.displayName = "FontFamily";
|
|
685
|
-
const $ = 1, j = 409, G = (t) => typeof t == "string" ? parseFloat(t) : t, It = (t) => {
|
|
686
|
-
const { spreadsheetRef: n } = t, a = G(t.value), s = e.useCallback((o) => {
|
|
687
|
-
var u;
|
|
688
|
-
let l = o.value ? G(o.value) : a;
|
|
689
|
-
l = isNaN(l) ? a : l, l = Math.min(j, Math.max($, l));
|
|
690
|
-
const d = {
|
|
691
|
-
command: "PropertyChangeCommand",
|
|
692
|
-
options: { property: "fontSize", value: l }
|
|
693
|
-
};
|
|
694
|
-
o.nativeEvent.type === "keydown" || o.nativeEvent.type === "focusout" ? (u = n.current) == null || u.executeCommand(d) : setTimeout(() => {
|
|
695
|
-
var r;
|
|
696
|
-
(r = n.current) == null || r.executeCommand(d);
|
|
697
|
-
}, 0);
|
|
698
|
-
}, [a]);
|
|
699
|
-
return /* @__PURE__ */ e.createElement(
|
|
700
|
-
he,
|
|
701
|
-
{
|
|
702
|
-
onChange: s,
|
|
703
|
-
value: a,
|
|
704
|
-
data: Wn,
|
|
705
|
-
defaultValue: _n,
|
|
706
|
-
allowCustom: !0,
|
|
707
|
-
fillMode: "flat",
|
|
708
|
-
title: R().toLanguageString(c.fontSize, E[c.fontSize]),
|
|
709
|
-
tabIndex: -1,
|
|
710
|
-
clearButton: !1
|
|
711
|
-
}
|
|
712
|
-
);
|
|
713
|
-
};
|
|
714
|
-
It.displayName = "FontSize";
|
|
715
|
-
const wt = (t) => {
|
|
716
|
-
const n = (a) => {
|
|
717
|
-
const { property: s, icon: o, svgIcon: l, titleKey: d, step: u } = t, { spreadsheetRef: r } = a, v = G(a.value), y = e.useCallback(() => {
|
|
718
|
-
var w;
|
|
719
|
-
const C = {
|
|
720
|
-
command: "PropertyChangeCommand",
|
|
721
|
-
options: { property: s, value: Math.min(j, Math.max($, v + u)) }
|
|
722
|
-
};
|
|
723
|
-
(w = r.current) == null || w.executeCommand(C);
|
|
724
|
-
}, [v]);
|
|
725
|
-
return /* @__PURE__ */ e.createElement(
|
|
726
|
-
K,
|
|
727
|
-
{
|
|
728
|
-
type: "button",
|
|
729
|
-
icon: o,
|
|
730
|
-
svgIcon: l,
|
|
731
|
-
fillMode: "flat",
|
|
732
|
-
onClick: y,
|
|
733
|
-
disabled: v + u < $ || v + u > j,
|
|
734
|
-
title: R().toLanguageString(d, E[d])
|
|
735
|
-
}
|
|
736
|
-
);
|
|
737
|
-
};
|
|
738
|
-
return n.displayName = t.displayName, n;
|
|
739
|
-
}, qn = wt({
|
|
740
|
-
property: "fontSize",
|
|
741
|
-
icon: "font-grow",
|
|
742
|
-
svgIcon: cn,
|
|
743
|
-
titleKey: c.fontSizeIncrease,
|
|
744
|
-
displayName: "IncreaseFontSize",
|
|
745
|
-
step: 1
|
|
746
|
-
}), Xn = wt({
|
|
747
|
-
property: "fontSize",
|
|
748
|
-
icon: "font-shrink",
|
|
749
|
-
svgIcon: dn,
|
|
750
|
-
titleKey: c.fontSizeDecrease,
|
|
751
|
-
displayName: "DecreaseFontSize",
|
|
752
|
-
step: -1
|
|
753
|
-
}), Nt = yt({
|
|
754
|
-
icon: "foreground-color",
|
|
755
|
-
svgIcon: un,
|
|
756
|
-
view: "palette",
|
|
757
|
-
property: "color",
|
|
758
|
-
titleKey: c.textColor,
|
|
759
|
-
ariaLabel: "Text Color"
|
|
760
|
-
});
|
|
761
|
-
Nt.displayName = "TextColor";
|
|
762
|
-
const Rt = yt({
|
|
763
|
-
icon: "droplet",
|
|
764
|
-
svgIcon: mn,
|
|
765
|
-
view: "palette",
|
|
766
|
-
property: "background",
|
|
767
|
-
titleKey: c.background,
|
|
768
|
-
ariaLabel: "Background"
|
|
769
|
-
});
|
|
770
|
-
Rt.displayName = "BackgroundColor";
|
|
771
|
-
const O = [
|
|
772
|
-
{ icon: "align-left", svgIcon: X, textKey: c.alignLeft, commandName: "textAlign", value: "left", selected: !1 },
|
|
773
|
-
{ icon: "align-center", svgIcon: pn, textKey: c.alignCenter, commandName: "textAlign", value: "center", selected: !1 },
|
|
774
|
-
{ icon: "align-right", svgIcon: fn, textKey: c.alignRight, commandName: "textAlign", value: "right", selected: !1 },
|
|
775
|
-
{ icon: "align-justify", svgIcon: gn, textKey: c.alignJustify, commandName: "textAlign", value: "justify", selected: !1 },
|
|
776
|
-
{ icon: "align-top", svgIcon: hn, textKey: c.alignTop, commandName: "verticalAlign", value: "top", selected: !1 },
|
|
777
|
-
{ icon: "align-middle", svgIcon: Cn, textKey: c.alignMiddle, commandName: "verticalAlign", value: "center", selected: !1 },
|
|
778
|
-
{ icon: "align-bottom", svgIcon: ge, textKey: c.alignBottom, commandName: "verticalAlign", value: "bottom", selected: !1 }
|
|
779
|
-
], Zn = [
|
|
780
|
-
O[0],
|
|
781
|
-
{ ...O[1], textKey: c.center },
|
|
782
|
-
O[2],
|
|
783
|
-
{ ...O[3], textKey: c.justify }
|
|
784
|
-
], Yn = O.filter((t) => t.commandName === "verticalAlign"), Qn = (t) => {
|
|
785
|
-
const { value: n, spreadsheetRef: a } = t, { textAlign: s, verticalAlign: o } = n || {}, l = R(), d = e.useCallback((r) => {
|
|
786
|
-
if (a.current) {
|
|
787
|
-
const v = r.item, y = {
|
|
788
|
-
command: "PropertyChangeCommand",
|
|
789
|
-
options: { property: v.commandName, value: v.value || null }
|
|
790
|
-
};
|
|
791
|
-
a.current.executeCommand(y);
|
|
792
|
-
}
|
|
793
|
-
}, []);
|
|
794
|
-
let u = O.slice();
|
|
795
|
-
return u = u.map((r) => ({ ...r, text: l.toLanguageString(r.textKey, E[r.textKey]) })), s && (u = u.map((r) => r.commandName === "textAlign" ? { ...r, selected: r.value === s } : r)), o && (u = u.map((r) => r.commandName === "verticalAlign" ? { ...r, selected: r.value === o } : r)), /* @__PURE__ */ e.createElement(
|
|
796
|
-
q,
|
|
797
|
-
{
|
|
798
|
-
icon: "align-left",
|
|
799
|
-
svgIcon: X,
|
|
800
|
-
items: u,
|
|
801
|
-
fillMode: "flat",
|
|
802
|
-
onItemClick: d,
|
|
803
|
-
title: l.toLanguageString(c.align, E[c.align]),
|
|
804
|
-
text: /* @__PURE__ */ e.createElement(P, { name: "caret-alt-down", icon: fe })
|
|
805
|
-
}
|
|
806
|
-
);
|
|
807
|
-
};
|
|
808
|
-
Qn.displayName = "Alignment";
|
|
809
|
-
const eo = {
|
|
810
|
-
items: Zn,
|
|
811
|
-
icon: { icon: "align-left", svgIcon: X },
|
|
812
|
-
displayName: "AlignHorizontally",
|
|
813
|
-
titleKey: c.alignHorizontally
|
|
814
|
-
}, to = {
|
|
815
|
-
items: Yn,
|
|
816
|
-
icon: { icon: "align-bottom", svgIcon: ge },
|
|
817
|
-
displayName: "AlignVertically",
|
|
818
|
-
titleKey: c.alignVertically
|
|
819
|
-
}, At = (t) => {
|
|
820
|
-
const n = (a) => {
|
|
821
|
-
const { value: s, spreadsheetRef: o } = a, l = R(), d = e.useCallback((y) => {
|
|
822
|
-
if (o.current) {
|
|
823
|
-
const C = y.item, w = {
|
|
824
|
-
command: "PropertyChangeCommand",
|
|
825
|
-
options: { property: C.commandName, value: C.value || null }
|
|
826
|
-
};
|
|
827
|
-
o.current.executeCommand(w);
|
|
828
|
-
}
|
|
829
|
-
}, []);
|
|
830
|
-
let u = t.items.slice();
|
|
831
|
-
u = u.map((y) => ({ ...y, text: l.toLanguageString(y.textKey, E[y.textKey]) })), u = u.map((y) => ({ ...y, selected: y.value === s }));
|
|
832
|
-
const r = { ...t.icon }, v = u.find((y) => y.selected);
|
|
833
|
-
return v && (r.icon = v.icon, r.svgIcon = v.svgIcon), /* @__PURE__ */ e.createElement(
|
|
834
|
-
q,
|
|
835
|
-
{
|
|
836
|
-
...r,
|
|
837
|
-
items: u,
|
|
838
|
-
fillMode: "flat",
|
|
839
|
-
onItemClick: d,
|
|
840
|
-
title: l.toLanguageString(t.titleKey, E[t.titleKey]),
|
|
841
|
-
text: /* @__PURE__ */ e.createElement(P, { name: "caret-alt-down", icon: fe })
|
|
842
|
-
}
|
|
843
|
-
);
|
|
844
|
-
};
|
|
845
|
-
return n.displayName = t.displayName, n;
|
|
846
|
-
}, no = At(eo), oo = At(to), Dt = (t) => {
|
|
847
|
-
const { value: n, spreadsheetRef: a } = t, s = e.useCallback(() => {
|
|
848
|
-
if (a.current) {
|
|
849
|
-
const o = a.current.activeSheet();
|
|
850
|
-
if (o) {
|
|
851
|
-
const u = {
|
|
852
|
-
command: "TextWrapCommand",
|
|
853
|
-
options: { property: "wrap", value: !o.range(o.activeCell()).wrap() }
|
|
854
|
-
};
|
|
855
|
-
a.current.executeCommand(u);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
}, []);
|
|
859
|
-
return /* @__PURE__ */ e.createElement(
|
|
860
|
-
K,
|
|
861
|
-
{
|
|
862
|
-
type: "button",
|
|
863
|
-
togglable: !0,
|
|
864
|
-
icon: "text-wrap",
|
|
865
|
-
svgIcon: vn,
|
|
866
|
-
fillMode: "flat",
|
|
867
|
-
title: R().toLanguageString(c.textWrap, E[c.textWrap]),
|
|
868
|
-
onClick: s,
|
|
869
|
-
selected: n
|
|
870
|
-
}
|
|
871
|
-
);
|
|
872
|
-
};
|
|
873
|
-
Dt.displayName = "TextWrap";
|
|
874
|
-
const Tt = (t) => {
|
|
875
|
-
const { value: n, spreadsheetRef: a } = t, s = e.useCallback(() => {
|
|
876
|
-
if (a.current) {
|
|
877
|
-
const o = a.current.activeSheet();
|
|
878
|
-
if (o) {
|
|
879
|
-
const d = {
|
|
880
|
-
command: "GridLinesChangeCommand",
|
|
881
|
-
options: { property: "gridLines", value: !o.showGridLines() }
|
|
882
|
-
};
|
|
883
|
-
a.current.executeCommand(d);
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
}, []);
|
|
887
|
-
return /* @__PURE__ */ e.createElement(
|
|
888
|
-
K,
|
|
889
|
-
{
|
|
890
|
-
type: "button",
|
|
891
|
-
togglable: !0,
|
|
892
|
-
icon: "borders-none",
|
|
893
|
-
svgIcon: yn,
|
|
894
|
-
fillMode: "flat",
|
|
895
|
-
title: R().toLanguageString(c.gridLines, E[c.gridLines]),
|
|
896
|
-
onClick: s,
|
|
897
|
-
selected: n
|
|
898
|
-
}
|
|
899
|
-
);
|
|
900
|
-
};
|
|
901
|
-
Tt.displayName = "GridLines";
|
|
902
|
-
const Lt = (t) => {
|
|
903
|
-
const { spreadsheetRef: n } = t, a = e.useCallback((s) => {
|
|
904
|
-
const o = s.item.value || null;
|
|
905
|
-
setTimeout(() => {
|
|
906
|
-
if (n.current) {
|
|
907
|
-
const l = {
|
|
908
|
-
command: "PropertyChangeCommand",
|
|
909
|
-
options: { property: "format", value: o }
|
|
910
|
-
};
|
|
911
|
-
n.current.executeCommand(l);
|
|
912
|
-
}
|
|
913
|
-
}, 0);
|
|
914
|
-
}, []);
|
|
915
|
-
return /* @__PURE__ */ e.createElement(
|
|
916
|
-
q,
|
|
917
|
-
{
|
|
918
|
-
icon: "custom-format",
|
|
919
|
-
svgIcon: bn,
|
|
920
|
-
fillMode: "flat",
|
|
921
|
-
onItemClick: a,
|
|
922
|
-
items: Jn,
|
|
923
|
-
title: R().toLanguageString(c.format, E[c.format]),
|
|
924
|
-
text: /* @__PURE__ */ e.createElement(P, { name: "caret-alt-down" })
|
|
925
|
-
}
|
|
926
|
-
);
|
|
927
|
-
};
|
|
928
|
-
Lt.displayName = "Format";
|
|
929
|
-
const U = (t) => (a) => {
|
|
930
|
-
const { spreadsheetRef: s, value: o } = a, l = e.useCallback(() => {
|
|
931
|
-
if (s.current) {
|
|
932
|
-
const d = {
|
|
933
|
-
command: t.command,
|
|
934
|
-
options: { value: t.value }
|
|
935
|
-
};
|
|
936
|
-
s.current.executeCommand(d);
|
|
937
|
-
}
|
|
938
|
-
}, []);
|
|
939
|
-
return /* @__PURE__ */ e.createElement(
|
|
940
|
-
K,
|
|
941
|
-
{
|
|
942
|
-
type: "button",
|
|
943
|
-
icon: t.icon,
|
|
944
|
-
svgIcon: t.svgIcon,
|
|
945
|
-
fillMode: "flat",
|
|
946
|
-
title: R().toLanguageString(t.titleKey, E[t.titleKey]),
|
|
947
|
-
onClick: l,
|
|
948
|
-
disabled: o && t.disabled(o)
|
|
949
|
-
}
|
|
950
|
-
);
|
|
951
|
-
}, ao = {
|
|
952
|
-
command: "AddColumnCommand",
|
|
953
|
-
value: "left",
|
|
954
|
-
icon: "table-column-insert-left",
|
|
955
|
-
svgIcon: kn,
|
|
956
|
-
titleKey: c.addColumnLeft,
|
|
957
|
-
disabled: (t) => t.allCols,
|
|
958
|
-
displayName: "AddColumnLeft"
|
|
959
|
-
}, lo = {
|
|
960
|
-
command: "AddColumnCommand",
|
|
961
|
-
value: "right",
|
|
962
|
-
icon: "table-column-insert-right",
|
|
963
|
-
svgIcon: xn,
|
|
964
|
-
titleKey: c.addColumnRight,
|
|
965
|
-
disabled: (t) => t.allCols,
|
|
966
|
-
displayName: "AddColumnRight"
|
|
967
|
-
}, so = {
|
|
968
|
-
command: "AddRowCommand",
|
|
969
|
-
value: "below",
|
|
970
|
-
icon: "table-row-insert-below",
|
|
971
|
-
svgIcon: En,
|
|
972
|
-
titleKey: c.addRowBelow,
|
|
973
|
-
disabled: (t) => t.allRows,
|
|
974
|
-
displayName: "AddRowBelow"
|
|
975
|
-
}, ro = {
|
|
976
|
-
command: "AddRowCommand",
|
|
977
|
-
value: "above",
|
|
978
|
-
icon: "table-row-insert-above",
|
|
979
|
-
svgIcon: Sn,
|
|
980
|
-
titleKey: c.addRowAbove,
|
|
981
|
-
disabled: (t) => t.allRows,
|
|
982
|
-
displayName: "AddRowAbove"
|
|
983
|
-
}, co = {
|
|
984
|
-
command: "DeleteColumnCommand",
|
|
985
|
-
icon: "table-column-delete",
|
|
986
|
-
svgIcon: In,
|
|
987
|
-
titleKey: c.deleteColumn,
|
|
988
|
-
disabled: (t) => t.allCols,
|
|
989
|
-
displayName: "DeleteColumn"
|
|
990
|
-
}, io = {
|
|
991
|
-
command: "DeleteRowCommand",
|
|
992
|
-
icon: "table-row-delete",
|
|
993
|
-
svgIcon: wn,
|
|
994
|
-
titleKey: c.deleteRow,
|
|
995
|
-
disabled: (t) => t.allRows,
|
|
996
|
-
displayName: "DeleteRow"
|
|
997
|
-
}, Ft = U(ao), Kt = U(lo), Mt = U(so), zt = U(ro), Bt = U(co), Pt = U(io);
|
|
998
|
-
Ft.displayName = "AddColumnLeft";
|
|
999
|
-
Kt.displayName = "AddColumnRight";
|
|
1000
|
-
Mt.displayName = "AddRowBelow";
|
|
1001
|
-
zt.displayName = "AddRowAbove";
|
|
1002
|
-
Bt.displayName = "DeleteColumn";
|
|
1003
|
-
Pt.displayName = "DeleteRow";
|
|
1004
|
-
const uo = { action: "undo", icon: "reset", svgIcon: Nn, titleKey: c.undo }, Ht = bt(uo);
|
|
1005
|
-
Ht.displayName = "Undo";
|
|
1006
|
-
const mo = { action: "redo", icon: "reload", svgIcon: Rn, titleKey: c.redo }, Ot = bt(mo);
|
|
1007
|
-
Ot.displayName = "Redo";
|
|
1008
|
-
const Ut = (t) => (a) => {
|
|
1009
|
-
const { icon: s, svgIcon: o, titleKey: l, value: d } = t, { spreadsheetRef: u } = a, r = e.useCallback(() => {
|
|
1010
|
-
if (u.current) {
|
|
1011
|
-
const v = {
|
|
1012
|
-
command: "AdjustDecimalsCommand",
|
|
1013
|
-
options: { value: d }
|
|
1014
|
-
};
|
|
1015
|
-
u.current.executeCommand(v);
|
|
1016
|
-
}
|
|
1017
|
-
}, []);
|
|
1018
|
-
return /* @__PURE__ */ e.createElement(
|
|
1019
|
-
K,
|
|
1020
|
-
{
|
|
1021
|
-
type: "button",
|
|
1022
|
-
icon: s,
|
|
1023
|
-
svgIcon: o,
|
|
1024
|
-
fillMode: "flat",
|
|
1025
|
-
onClick: r,
|
|
1026
|
-
title: R().toLanguageString(l, E[l])
|
|
1027
|
-
}
|
|
1028
|
-
);
|
|
1029
|
-
}, po = Ut({
|
|
1030
|
-
icon: le.name,
|
|
1031
|
-
svgIcon: le,
|
|
1032
|
-
value: 1,
|
|
1033
|
-
titleKey: c.increaseDecimal
|
|
1034
|
-
}), fo = Ut({
|
|
1035
|
-
icon: se.name,
|
|
1036
|
-
svgIcon: se,
|
|
1037
|
-
value: -1,
|
|
1038
|
-
titleKey: c.decreaseDecimal
|
|
1039
|
-
}), re = [
|
|
1040
|
-
{
|
|
1041
|
-
textKey: c.file,
|
|
1042
|
-
tools: [
|
|
1043
|
-
vt,
|
|
1044
|
-
Ct
|
|
1045
|
-
]
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
textKey: c.home,
|
|
1049
|
-
selected: !0,
|
|
1050
|
-
tools: [
|
|
1051
|
-
[Ht, Ot],
|
|
1052
|
-
B,
|
|
1053
|
-
St,
|
|
1054
|
-
It,
|
|
1055
|
-
qn,
|
|
1056
|
-
Xn,
|
|
1057
|
-
B,
|
|
1058
|
-
[kt, xt, Et],
|
|
1059
|
-
Nt,
|
|
1060
|
-
B,
|
|
1061
|
-
Rt,
|
|
1062
|
-
B,
|
|
1063
|
-
no,
|
|
1064
|
-
oo,
|
|
1065
|
-
Dt,
|
|
1066
|
-
B,
|
|
1067
|
-
Tt
|
|
1068
|
-
]
|
|
1069
|
-
},
|
|
1070
|
-
{
|
|
1071
|
-
textKey: c.insert,
|
|
1072
|
-
tools: [
|
|
1073
|
-
[Ft, Kt, Mt, zt],
|
|
1074
|
-
B,
|
|
1075
|
-
[Bt, Pt]
|
|
1076
|
-
]
|
|
1077
|
-
},
|
|
1078
|
-
{
|
|
1079
|
-
textKey: c.formatTab,
|
|
1080
|
-
tools: [
|
|
1081
|
-
Lt,
|
|
1082
|
-
[fo, po]
|
|
1083
|
-
]
|
|
1084
|
-
}
|
|
1085
|
-
], ce = {
|
|
1086
|
-
name: "@progress/kendo-react-spreadsheet",
|
|
1087
|
-
productName: "KendoReact",
|
|
1088
|
-
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
1089
|
-
publishDate: 1709632275,
|
|
1090
|
-
version: "",
|
|
1091
|
-
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning"
|
|
1092
|
-
}, ie = ["bold", "italic", "underline", "fontFamily", "fontSize", "color", "background", "textAlign", "verticalAlign", "wrap", "gridLines"], de = {
|
|
1093
|
-
Bold: (t) => t.bold,
|
|
1094
|
-
Italic: (t) => t.italic,
|
|
1095
|
-
Underline: (t) => t.underline,
|
|
1096
|
-
FontFamily: (t) => t.fontFamily,
|
|
1097
|
-
FontSize: (t) => t.fontSize,
|
|
1098
|
-
IncreaseFontSize: (t) => t.fontSize,
|
|
1099
|
-
DecreaseFontSize: (t) => t.fontSize,
|
|
1100
|
-
TextColor: (t) => t.color,
|
|
1101
|
-
BackgroundColor: (t) => t.background,
|
|
1102
|
-
Alignment: (t) => ({ textAlign: t.textAlign, verticalAlign: t.verticalAlign }),
|
|
1103
|
-
AlignHorizontally: (t) => t.textAlign,
|
|
1104
|
-
AlignVertically: (t) => t.verticalAlign,
|
|
1105
|
-
TextWrap: (t) => t.wrap,
|
|
1106
|
-
GridLines: (t) => t.gridLines,
|
|
1107
|
-
AddColumnLeft: (t) => t.selectedHeaders,
|
|
1108
|
-
AddColumnRight: (t) => t.selectedHeaders,
|
|
1109
|
-
AddRowBelow: (t) => t.selectedHeaders,
|
|
1110
|
-
AddRowAbove: (t) => t.selectedHeaders,
|
|
1111
|
-
DeleteColumn: (t) => t.selectedHeaders,
|
|
1112
|
-
DeleteRow: (t) => t.selectedHeaders
|
|
1113
|
-
}, ue = ":not(.k-dropdownlist button):not(.k-combobox button):not(.k-upload-button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)", go = [
|
|
1114
|
-
"button" + ue,
|
|
1115
|
-
".k-button-group > button" + ue,
|
|
1116
|
-
".k-dropdownlist",
|
|
1117
|
-
".k-combobox",
|
|
1118
|
-
".k-colorpicker"
|
|
1119
|
-
], Vt = e.forwardRef((t, n) => {
|
|
1120
|
-
Qt(ce);
|
|
1121
|
-
const a = en(ce), { toolbar: s = re } = t, o = [];
|
|
1122
|
-
typeof s == "boolean" ? o.push(...s ? re : []) : o.push(...s);
|
|
1123
|
-
const [l, d] = e.useState(null), [u, r] = e.useState(o.findIndex((i) => i.selected) || 0), [v, y] = e.useState(!1), C = e.useRef(null), w = e.useRef(null), b = e.useRef(null), p = e.useRef(null), h = e.useRef(null), [f, I] = e.useState({}), D = e.useRef({});
|
|
1124
|
-
D.current = f;
|
|
1125
|
-
const m = e.useRef({});
|
|
1126
|
-
m.current = t;
|
|
1127
|
-
const x = R(), T = e.useCallback((i) => {
|
|
1128
|
-
m.current.onSelect && m.current.onSelect.call(void 0, i);
|
|
1129
|
-
}, []), k = e.useCallback((i) => {
|
|
1130
|
-
m.current.onChange && m.current.onChange.call(void 0, i);
|
|
1131
|
-
}, []), N = e.useCallback((i) => {
|
|
1132
|
-
m.current.onChangeFormat && m.current.onChangeFormat.call(void 0, i);
|
|
1133
|
-
}, []), L = e.useCallback((i) => {
|
|
1134
|
-
m.current.onExcelImport && m.current.onExcelImport.call(void 0, i);
|
|
1135
|
-
}, []), A = e.useCallback((i) => {
|
|
1136
|
-
m.current.onExcelExport && m.current.onExcelExport.call(void 0, i);
|
|
1137
|
-
}, []), H = e.useRef(null);
|
|
1138
|
-
e.useImperativeHandle(H, () => ({
|
|
1139
|
-
element: C.current,
|
|
1140
|
-
get instance() {
|
|
1141
|
-
return h.current;
|
|
1142
|
-
},
|
|
1143
|
-
props: t,
|
|
1144
|
-
get view() {
|
|
1145
|
-
return h.current.view;
|
|
1146
|
-
},
|
|
1147
|
-
get workbook() {
|
|
1148
|
-
return h.current.workbook;
|
|
1149
|
-
},
|
|
1150
|
-
executeCommand(i) {
|
|
1151
|
-
var g;
|
|
1152
|
-
(g = h.current) == null || g.executeCommand(i);
|
|
1153
|
-
},
|
|
1154
|
-
fromJSON(i) {
|
|
1155
|
-
var g;
|
|
1156
|
-
return (g = h.current) == null ? void 0 : g.fromJSON(i);
|
|
1157
|
-
},
|
|
1158
|
-
toJSON() {
|
|
1159
|
-
return h.current.toJSON();
|
|
1160
|
-
},
|
|
1161
|
-
saveJSON() {
|
|
1162
|
-
return h.current.saveJSON();
|
|
1163
|
-
},
|
|
1164
|
-
fromFile(i) {
|
|
1165
|
-
return h.current.fromFile(i);
|
|
1166
|
-
},
|
|
1167
|
-
saveAsExcel(i) {
|
|
1168
|
-
var g;
|
|
1169
|
-
(g = h.current) == null || g.saveAsExcel({
|
|
1170
|
-
...h.current.options.excel,
|
|
1171
|
-
saveAs: Ce,
|
|
1172
|
-
Workbook: ve,
|
|
1173
|
-
...i
|
|
1174
|
-
});
|
|
1175
|
-
},
|
|
1176
|
-
activeSheet(i) {
|
|
1177
|
-
var g;
|
|
1178
|
-
return (g = h.current) == null ? void 0 : g.activeSheet(i);
|
|
1179
|
-
},
|
|
1180
|
-
sheets() {
|
|
1181
|
-
return h.current.sheets();
|
|
1182
|
-
},
|
|
1183
|
-
refresh() {
|
|
1184
|
-
var i;
|
|
1185
|
-
return (i = h.current) == null ? void 0 : i.refresh();
|
|
1186
|
-
}
|
|
1187
|
-
}), [t]), e.useImperativeHandle(n, () => H.current);
|
|
1188
|
-
const Wt = e.useCallback(() => h.current && h.current.view.nameEditor, []), ee = e.useCallback((i) => {
|
|
1189
|
-
const g = {};
|
|
1190
|
-
ie.forEach((S) => {
|
|
1191
|
-
typeof i.range[S] == "function" ? g[S] = i.range[S]() : S === "gridLines" && (g[S] = i.range.sheet().showGridLines());
|
|
1192
|
-
}), g.selectedHeaders = i.range.sheet().selectedHeaders(), (ie.some((S) => g[S] !== D.current[S]) || g.selectedHeaders.allCols !== D.current.selectedHeaders.allCols || g.selectedHeaders.allRows !== D.current.selectedHeaders.allRows) && I(g);
|
|
1193
|
-
}, []), _t = e.useCallback((i) => {
|
|
1194
|
-
const g = i.name, S = c[g];
|
|
1195
|
-
d({
|
|
1196
|
-
title: i.title === "Error" ? x.toLanguageString(c.error, E[c.error] || i.title) : i.title,
|
|
1197
|
-
message: S ? x.toLanguageString(S, E[S] || i.text) : i.text,
|
|
1198
|
-
close: i.close
|
|
1199
|
-
});
|
|
1200
|
-
}, []), te = e.useCallback(() => {
|
|
1201
|
-
d(null), l == null || l.close();
|
|
1202
|
-
}, [l]), V = Tn(), ne = R();
|
|
1203
|
-
e.useEffect(() => {
|
|
1204
|
-
var W;
|
|
1205
|
-
const i = {
|
|
1206
|
-
...t.defaultProps,
|
|
1207
|
-
sheets: structuredClone((W = t.defaultProps) == null ? void 0 : W.sheets),
|
|
1208
|
-
messages: {
|
|
1209
|
-
workbook: {
|
|
1210
|
-
defaultSheetName: ne.toLanguageString(c.defaultSheetName, E[c.defaultSheetName])
|
|
1211
|
-
}
|
|
1212
|
-
},
|
|
1213
|
-
intl: {
|
|
1214
|
-
localeInfo: () => V.localeInfo(),
|
|
1215
|
-
localeCurrency: () => V.localeCurrency(),
|
|
1216
|
-
parseDate: (M, z) => V.parseDate(M, z),
|
|
1217
|
-
toString: (M, z) => V.toString(M, z),
|
|
1218
|
-
format: (M, ...z) => V.format(M, ...z)
|
|
1219
|
-
},
|
|
1220
|
-
formulaBarInputRef: w,
|
|
1221
|
-
formulaCellInputRef: b,
|
|
1222
|
-
nameBoxRef: p
|
|
1223
|
-
}, g = new Fn(C.current, i);
|
|
1224
|
-
h.current = g, g.bind("select", T), g.bind("change", k), g.bind("changeFormat", N), g.bind("excelImport", L), g.bind("excelExport", A), g.view.bind("update", ee), g.view.bind("message", _t);
|
|
1225
|
-
const S = g.activeSheet();
|
|
1226
|
-
return S && ee({ range: S.range(S.activeCell()) }), y(!0), () => {
|
|
1227
|
-
g.destroy();
|
|
1228
|
-
};
|
|
1229
|
-
}, []);
|
|
1230
|
-
const oe = e.useCallback((i, g) => {
|
|
1231
|
-
const S = /* @__PURE__ */ e.createElement(
|
|
1232
|
-
i,
|
|
1233
|
-
{
|
|
1234
|
-
spreadsheetRef: h,
|
|
1235
|
-
value: de[i.displayName] ? de[i.displayName](f) : void 0,
|
|
1236
|
-
key: g
|
|
1237
|
-
}
|
|
1238
|
-
);
|
|
1239
|
-
return S.type === B ? /* @__PURE__ */ e.createElement(i, { key: g }) : S;
|
|
1240
|
-
}, [f]);
|
|
1241
|
-
let ae = null;
|
|
1242
|
-
return o.length && (ae = /* @__PURE__ */ e.createElement(
|
|
1243
|
-
jt,
|
|
1244
|
-
{
|
|
1245
|
-
selected: u,
|
|
1246
|
-
animation: !1,
|
|
1247
|
-
className: "k-floatwrap k-spreadsheet-tabstrip",
|
|
1248
|
-
style: { minHeight: "auto" },
|
|
1249
|
-
onSelect: (i) => r(i.selected)
|
|
1250
|
-
},
|
|
1251
|
-
o.map((i) => {
|
|
1252
|
-
const g = i.textKey ? ne.toLanguageString(i.textKey, E[i.textKey]) : i.text;
|
|
1253
|
-
return /* @__PURE__ */ e.createElement(Gt, { key: i.textKey || i.text, title: g }, /* @__PURE__ */ e.createElement(Jt, { buttons: go, className: "k-spreadsheet-toolbar" }, i.tools.map((S, W) => Array.isArray(S) ? /* @__PURE__ */ e.createElement($t, { key: W }, S.map((M, z) => oe(M, z))) : oe(S, W))));
|
|
1254
|
-
})
|
|
1255
|
-
)), /* @__PURE__ */ e.createElement(
|
|
1256
|
-
"div",
|
|
1257
|
-
{
|
|
1258
|
-
ref: C,
|
|
1259
|
-
style: t.style,
|
|
1260
|
-
className: J("k-widget k-spreadsheet", t.className),
|
|
1261
|
-
role: "application"
|
|
1262
|
-
},
|
|
1263
|
-
ae,
|
|
1264
|
-
/* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-action-bar" }, /* @__PURE__ */ e.createElement(Y, { ref: p, nameEditor: Wt }), /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-formula-bar" }, /* @__PURE__ */ e.createElement(P, { name: "formula-fx", icon: me }), /* @__PURE__ */ e.createElement(_, { ref: w }))),
|
|
1265
|
-
/* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-view" }, /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-fixed-container" }), /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-scroller" }, /* @__PURE__ */ e.createElement("div", { className: "k-spreadsheet-view-size" })), /* @__PURE__ */ e.createElement("div", { tabIndex: 0, className: "k-spreadsheet-clipboard", contentEditable: "true" }), /* @__PURE__ */ e.createElement(_, { ref: b, className: "k-spreadsheet-cell-editor" })),
|
|
1266
|
-
/* @__PURE__ */ e.createElement(On, { spreadsheetRef: h }),
|
|
1267
|
-
l && /* @__PURE__ */ e.createElement(qt, { title: l.title, onClose: te }, /* @__PURE__ */ e.createElement("div", null, l.message), /* @__PURE__ */ e.createElement(Xt, { layout: "start" }, /* @__PURE__ */ e.createElement(
|
|
1268
|
-
K,
|
|
1269
|
-
{
|
|
1270
|
-
themeColor: "primary",
|
|
1271
|
-
onClick: te,
|
|
1272
|
-
autoFocus: !0
|
|
1273
|
-
},
|
|
1274
|
-
x.toLanguageString(c.ok, E[c.ok])
|
|
1275
|
-
))),
|
|
1276
|
-
a && /* @__PURE__ */ e.createElement(tn, null)
|
|
1277
|
-
);
|
|
1278
|
-
});
|
|
1279
|
-
Vt.displayName = "KendoReactSpreadsheet";
|
|
1280
|
-
Vt.propTypes = {
|
|
1281
|
-
className: F.string,
|
|
1282
|
-
defaultProps: F.any,
|
|
1283
|
-
toolbar: F.oneOfType([F.bool, F.arrayOf(F.any)]),
|
|
1284
|
-
style: F.object,
|
|
1285
|
-
onSelect: F.func,
|
|
1286
|
-
onChange: F.func,
|
|
1287
|
-
onChangeFormat: F.func,
|
|
1288
|
-
onExcelImport: F.func,
|
|
1289
|
-
onExcelExport: F.func
|
|
1290
|
-
};
|
|
1291
|
-
const To = (t) => {
|
|
1292
|
-
const { spreadsheetRef: n } = t, a = e.useCallback(() => {
|
|
1293
|
-
n.current && n.current.executeCommand({ command: "PropertyCleanCommand" });
|
|
1294
|
-
}, []);
|
|
1295
|
-
return /* @__PURE__ */ e.createElement(
|
|
1296
|
-
K,
|
|
1297
|
-
{
|
|
1298
|
-
type: "button",
|
|
1299
|
-
icon: "clean-css",
|
|
1300
|
-
svgIcon: An,
|
|
1301
|
-
fillMode: "flat",
|
|
1302
|
-
onClick: a,
|
|
1303
|
-
title: R().toLanguageString(c.cleanFormatting, E[c.cleanFormatting])
|
|
1304
|
-
}
|
|
1305
|
-
);
|
|
1306
|
-
};
|
|
9
|
+
import { Spreadsheet as r } from "./Spreadsheet.mjs";
|
|
10
|
+
import { CalcError as n, CellRef as a, Context as m, Matrix as f, NULLREF as l, NameRef as p, Range as i, RangeRef as x, Ref as d, Sheet as c, SpreadsheetWidget as R, UnionRef as g, View as s, Workbook as u, dateToSerial as A, defineAlias as C, defineFunction as F, packDate as k, packTime as S, serialToDate as T, unpackDate as D, unpackTime as w } from "@progress/kendo-spreadsheet-common";
|
|
11
|
+
import { AlignHorizontally as z, AlignVertically as E, Alignment as L } from "./tools/align.mjs";
|
|
12
|
+
import { BackgroundColor as b } from "./tools/backgroundColor.mjs";
|
|
13
|
+
import { Bold as B } from "./tools/bold.mjs";
|
|
14
|
+
import { defaultTabs as I } from "./tools/defaultTools.mjs";
|
|
15
|
+
import { ExcelExport as V } from "./tools/export.mjs";
|
|
16
|
+
import { FontFamily as G } from "./tools/fontFamily.mjs";
|
|
17
|
+
import { DecreaseFontSize as M, FontSize as O, IncreaseFontSize as j } from "./tools/fontSize.mjs";
|
|
18
|
+
import { CleanFormatting as J } from "./tools/cleanFormat.mjs";
|
|
19
|
+
import { Format as P } from "./tools/format.mjs";
|
|
20
|
+
import { GridLines as X } from "./tools/gridLines.mjs";
|
|
21
|
+
import { Italic as Z } from "./tools/italic.mjs";
|
|
22
|
+
import { Open as $ } from "./tools/open.mjs";
|
|
23
|
+
import { Redo as oe } from "./tools/redo.mjs";
|
|
24
|
+
import { AddColumnLeft as te, AddColumnRight as ne, AddRowAbove as ae, AddRowBelow as me, DeleteColumn as fe, DeleteRow as le } from "./tools/tableTools.mjs";
|
|
25
|
+
import { TextColor as ie } from "./tools/textColor.mjs";
|
|
26
|
+
import { TextWrap as de } from "./tools/textWrap.mjs";
|
|
27
|
+
import { Underline as Re } from "./tools/underline.mjs";
|
|
28
|
+
import { Undo as se } from "./tools/undo.mjs";
|
|
1307
29
|
export {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
30
|
+
te as AddColumnLeft,
|
|
31
|
+
ne as AddColumnRight,
|
|
32
|
+
ae as AddRowAbove,
|
|
33
|
+
me as AddRowBelow,
|
|
34
|
+
z as AlignHorizontally,
|
|
35
|
+
E as AlignVertically,
|
|
36
|
+
L as Alignment,
|
|
37
|
+
b as BackgroundColor,
|
|
38
|
+
B as Bold,
|
|
39
|
+
n as CalcError,
|
|
40
|
+
a as CellRef,
|
|
41
|
+
J as CleanFormatting,
|
|
42
|
+
m as Context,
|
|
43
|
+
M as DecreaseFontSize,
|
|
44
|
+
fe as DeleteColumn,
|
|
45
|
+
le as DeleteRow,
|
|
46
|
+
V as ExcelExport,
|
|
47
|
+
G as FontFamily,
|
|
48
|
+
O as FontSize,
|
|
49
|
+
P as Format,
|
|
50
|
+
X as GridLines,
|
|
51
|
+
j as IncreaseFontSize,
|
|
52
|
+
Z as Italic,
|
|
53
|
+
f as Matrix,
|
|
54
|
+
l as NULLREF,
|
|
55
|
+
p as NameRef,
|
|
56
|
+
$ as Open,
|
|
57
|
+
i as Range,
|
|
58
|
+
x as RangeRef,
|
|
59
|
+
oe as Redo,
|
|
60
|
+
d as Ref,
|
|
61
|
+
c as Sheet,
|
|
62
|
+
r as Spreadsheet,
|
|
63
|
+
R as SpreadsheetWidget,
|
|
64
|
+
ie as TextColor,
|
|
65
|
+
de as TextWrap,
|
|
66
|
+
Re as Underline,
|
|
67
|
+
se as Undo,
|
|
68
|
+
g as UnionRef,
|
|
69
|
+
s as View,
|
|
70
|
+
u as Workbook,
|
|
71
|
+
A as dateToSerial,
|
|
72
|
+
I as defaultTabs,
|
|
73
|
+
C as defineAlias,
|
|
74
|
+
F as defineFunction,
|
|
75
|
+
k as packDate,
|
|
76
|
+
S as packTime,
|
|
77
|
+
T as serialToDate,
|
|
78
|
+
D as unpackDate,
|
|
79
|
+
w as unpackTime
|
|
1358
80
|
};
|