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