@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.
Files changed (89) hide show
  1. package/FormulaInput.js +8 -0
  2. package/FormulaInput.mjs +109 -0
  3. package/List.js +8 -0
  4. package/List.mjs +34 -0
  5. package/NameBox.js +8 -0
  6. package/NameBox.mjs +109 -0
  7. package/SheetsBar.js +8 -0
  8. package/SheetsBar.mjs +211 -0
  9. package/Spreadsheet.js +8 -0
  10. package/Spreadsheet.mjs +227 -0
  11. package/dist/cdn/js/kendo-react-spreadsheet.js +8 -5
  12. package/index.d.mts +715 -5
  13. package/index.d.ts +715 -8
  14. package/index.js +8 -5
  15. package/index.mjs +77 -1355
  16. package/messages.js +8 -0
  17. package/messages.mjs +115 -0
  18. package/package-metadata.js +8 -0
  19. package/package-metadata.mjs +19 -0
  20. package/package.json +11 -11
  21. package/tools/adjustDecimals.js +8 -0
  22. package/tools/adjustDecimals.mjs +49 -0
  23. package/tools/align.js +8 -0
  24. package/tools/align.mjs +95 -0
  25. package/tools/backgroundColor.js +8 -0
  26. package/tools/backgroundColor.mjs +23 -0
  27. package/tools/bold.js +8 -0
  28. package/tools/bold.mjs +16 -0
  29. package/tools/cleanFormat.js +8 -0
  30. package/tools/cleanFormat.mjs +32 -0
  31. package/tools/defaultTools.js +8 -0
  32. package/tools/defaultTools.mjs +77 -0
  33. package/tools/export.js +8 -0
  34. package/tools/export.mjs +37 -0
  35. package/tools/fontFamily.js +8 -0
  36. package/tools/fontFamily.mjs +40 -0
  37. package/tools/fontSize.js +8 -0
  38. package/tools/fontSize.mjs +89 -0
  39. package/tools/format.js +8 -0
  40. package/tools/format.mjs +45 -0
  41. package/tools/gridLines.js +8 -0
  42. package/tools/gridLines.mjs +44 -0
  43. package/tools/italic.js +8 -0
  44. package/tools/italic.mjs +16 -0
  45. package/tools/open.js +8 -0
  46. package/tools/open.mjs +55 -0
  47. package/tools/redo.js +8 -0
  48. package/tools/redo.mjs +16 -0
  49. package/tools/tableTools.js +8 -0
  50. package/tools/tableTools.mjs +96 -0
  51. package/tools/textColor.js +8 -0
  52. package/tools/textColor.mjs +23 -0
  53. package/tools/textWrap.js +8 -0
  54. package/tools/textWrap.mjs +44 -0
  55. package/tools/underline.js +8 -0
  56. package/tools/underline.mjs +16 -0
  57. package/tools/undo.js +8 -0
  58. package/tools/undo.mjs +16 -0
  59. package/tools/utils.js +8 -0
  60. package/tools/utils.mjs +97 -0
  61. package/FormulaInput.d.ts +0 -9
  62. package/List.d.ts +0 -9
  63. package/NameBox.d.ts +0 -9
  64. package/SheetsBar.d.ts +0 -8
  65. package/Spreadsheet.d.ts +0 -51
  66. package/SpreadsheetProps.d.ts +0 -192
  67. package/messages.d.ts +0 -114
  68. package/package-metadata.d.ts +0 -9
  69. package/tools/adjustDecimals.d.ts +0 -24
  70. package/tools/align.d.ts +0 -48
  71. package/tools/backgroundColor.d.ts +0 -14
  72. package/tools/bold.d.ts +0 -14
  73. package/tools/cleanFormat.d.ts +0 -15
  74. package/tools/defaultTools.d.ts +0 -9
  75. package/tools/export.d.ts +0 -15
  76. package/tools/fontFamily.d.ts +0 -15
  77. package/tools/fontSize.d.ts +0 -43
  78. package/tools/format.d.ts +0 -15
  79. package/tools/gridLines.d.ts +0 -19
  80. package/tools/index.d.ts +0 -23
  81. package/tools/italic.d.ts +0 -14
  82. package/tools/open.d.ts +0 -15
  83. package/tools/redo.d.ts +0 -14
  84. package/tools/tableTools.d.ts +0 -68
  85. package/tools/textColor.d.ts +0 -14
  86. package/tools/textWrap.d.ts +0 -19
  87. package/tools/underline.d.ts +0 -14
  88. package/tools/undo.d.ts +0 -14
  89. package/tools/utils.d.ts +0 -95
@@ -0,0 +1,227 @@
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
+ */
8
+ "use client";
9
+ import * as t from "react";
10
+ import l from "prop-types";
11
+ import { ToolbarSeparator as Z, Toolbar as $, ButtonGroup as ee, Button as te } from "@progress/kendo-react-buttons";
12
+ import { TabStrip as re, TabStripTab as oe } from "@progress/kendo-react-layout";
13
+ import { Dialog as ne, DialogActionsBar as ae } from "@progress/kendo-react-dialogs";
14
+ import { FormulaInput as H } from "./FormulaInput.mjs";
15
+ import { NameBox as le } from "./NameBox.mjs";
16
+ import { SheetsBar as se } from "./SheetsBar.mjs";
17
+ import { SpreadsheetWidget as ce } from "@progress/kendo-spreadsheet-common";
18
+ import { defaultTabs as L } from "./tools/defaultTools.mjs";
19
+ import { validatePackage as ie, shouldShowValidationUI as ue, classNames as me, IconWrap as de, WatermarkOverlay as fe } from "@progress/kendo-react-common";
20
+ import { packageMetadata as T } from "./package-metadata.mjs";
21
+ import { formulaFxIcon as pe } from "@progress/kendo-svg-icons";
22
+ import { useLocalization as z, useInternationalization as ge } from "@progress/kendo-react-intl";
23
+ import { saveAs as ke } from "@progress/kendo-file-saver";
24
+ import { Workbook as be } from "@progress/kendo-ooxml";
25
+ import { keys as m, messages as g } from "./messages.mjs";
26
+ const B = ["bold", "italic", "underline", "fontFamily", "fontSize", "color", "background", "textAlign", "verticalAlign", "wrap", "gridLines"], O = {
27
+ Bold: (r) => r.bold,
28
+ Italic: (r) => r.italic,
29
+ Underline: (r) => r.underline,
30
+ FontFamily: (r) => r.fontFamily,
31
+ FontSize: (r) => r.fontSize,
32
+ IncreaseFontSize: (r) => r.fontSize,
33
+ DecreaseFontSize: (r) => r.fontSize,
34
+ TextColor: (r) => r.color,
35
+ BackgroundColor: (r) => r.background,
36
+ Alignment: (r) => ({ textAlign: r.textAlign, verticalAlign: r.verticalAlign }),
37
+ AlignHorizontally: (r) => r.textAlign,
38
+ AlignVertically: (r) => r.verticalAlign,
39
+ TextWrap: (r) => r.wrap,
40
+ GridLines: (r) => r.gridLines,
41
+ AddColumnLeft: (r) => r.selectedHeaders,
42
+ AddColumnRight: (r) => r.selectedHeaders,
43
+ AddRowBelow: (r) => r.selectedHeaders,
44
+ AddRowAbove: (r) => r.selectedHeaders,
45
+ DeleteColumn: (r) => r.selectedHeaders,
46
+ DeleteRow: (r) => r.selectedHeaders
47
+ }, J = ":not(.k-dropdownlist button):not(.k-combobox button):not(.k-upload-button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)", he = [
48
+ "button" + J,
49
+ ".k-button-group > button" + J,
50
+ ".k-dropdownlist",
51
+ ".k-combobox",
52
+ ".k-colorpicker"
53
+ ], W = t.forwardRef((r, K) => {
54
+ ie(T);
55
+ const P = ue(T), { toolbar: b = L } = r, d = [];
56
+ typeof b == "boolean" ? d.push(...b ? L : []) : d.push(...b);
57
+ const [c, v] = t.useState(null), [D, G] = t.useState(d.findIndex((e) => e.selected) || 0), [Se, M] = t.useState(!1), h = t.useRef(null), x = t.useRef(null), y = t.useRef(null), C = t.useRef(null), a = t.useRef(null), [S, U] = t.useState({}), k = t.useRef({});
58
+ k.current = S;
59
+ const s = t.useRef({});
60
+ s.current = r;
61
+ const E = z(), V = t.useCallback((e) => {
62
+ s.current.onSelect && s.current.onSelect.call(void 0, e);
63
+ }, []), j = t.useCallback((e) => {
64
+ s.current.onChange && s.current.onChange.call(void 0, e);
65
+ }, []), _ = t.useCallback((e) => {
66
+ s.current.onChangeFormat && s.current.onChangeFormat.call(void 0, e);
67
+ }, []), q = t.useCallback((e) => {
68
+ s.current.onExcelImport && s.current.onExcelImport.call(void 0, e);
69
+ }, []), Q = t.useCallback((e) => {
70
+ s.current.onExcelExport && s.current.onExcelExport.call(void 0, e);
71
+ }, []), w = t.useRef(null);
72
+ t.useImperativeHandle(w, () => ({
73
+ element: h.current,
74
+ get instance() {
75
+ return a.current;
76
+ },
77
+ props: r,
78
+ get view() {
79
+ return a.current.view;
80
+ },
81
+ get workbook() {
82
+ return a.current.workbook;
83
+ },
84
+ executeCommand(e) {
85
+ var o;
86
+ (o = a.current) == null || o.executeCommand(e);
87
+ },
88
+ fromJSON(e) {
89
+ var o;
90
+ return (o = a.current) == null ? void 0 : o.fromJSON(e);
91
+ },
92
+ toJSON() {
93
+ return a.current.toJSON();
94
+ },
95
+ saveJSON() {
96
+ return a.current.saveJSON();
97
+ },
98
+ fromFile(e) {
99
+ return a.current.fromFile(e);
100
+ },
101
+ saveAsExcel(e) {
102
+ var o;
103
+ (o = a.current) == null || o.saveAsExcel({
104
+ ...a.current.options.excel,
105
+ saveAs: ke,
106
+ Workbook: be,
107
+ ...e
108
+ });
109
+ },
110
+ activeSheet(e) {
111
+ var o;
112
+ return (o = a.current) == null ? void 0 : o.activeSheet(e);
113
+ },
114
+ sheets() {
115
+ return a.current.sheets();
116
+ },
117
+ refresh() {
118
+ var e;
119
+ return (e = a.current) == null ? void 0 : e.refresh();
120
+ }
121
+ }), [r]), t.useImperativeHandle(K, () => w.current);
122
+ const X = t.useCallback(() => a.current && a.current.view.nameEditor, []), N = t.useCallback((e) => {
123
+ const o = {};
124
+ B.forEach((n) => {
125
+ typeof e.range[n] == "function" ? o[n] = e.range[n]() : n === "gridLines" && (o[n] = e.range.sheet().showGridLines());
126
+ }), o.selectedHeaders = e.range.sheet().selectedHeaders(), (B.some((n) => o[n] !== k.current[n]) || o.selectedHeaders.allCols !== k.current.selectedHeaders.allCols || o.selectedHeaders.allRows !== k.current.selectedHeaders.allRows) && U(o);
127
+ }, []), Y = t.useCallback((e) => {
128
+ const o = e.name, n = m[o];
129
+ v({
130
+ title: e.title === "Error" ? E.toLanguageString(m.error, g[m.error] || e.title) : e.title,
131
+ message: n ? E.toLanguageString(n, g[n] || e.text) : e.text,
132
+ close: e.close
133
+ });
134
+ }, []), R = t.useCallback(() => {
135
+ v(null), c == null || c.close();
136
+ }, [c]), f = ge(), A = z();
137
+ t.useEffect(() => {
138
+ var p;
139
+ const e = {
140
+ ...r.defaultProps,
141
+ sheets: structuredClone((p = r.defaultProps) == null ? void 0 : p.sheets),
142
+ messages: {
143
+ workbook: {
144
+ defaultSheetName: A.toLanguageString(m.defaultSheetName, g[m.defaultSheetName])
145
+ }
146
+ },
147
+ intl: {
148
+ localeInfo: () => f.localeInfo(),
149
+ localeCurrency: () => f.localeCurrency(),
150
+ parseDate: (i, u) => f.parseDate(i, u),
151
+ toString: (i, u) => f.toString(i, u),
152
+ format: (i, ...u) => f.format(i, ...u)
153
+ },
154
+ formulaBarInputRef: x,
155
+ formulaCellInputRef: y,
156
+ nameBoxRef: C
157
+ }, o = new ce(h.current, e);
158
+ a.current = o, o.bind("select", V), o.bind("change", j), o.bind("changeFormat", _), o.bind("excelImport", q), o.bind("excelExport", Q), o.view.bind("update", N), o.view.bind("message", Y);
159
+ const n = o.activeSheet();
160
+ return n && N({ range: n.range(n.activeCell()) }), M(!0), () => {
161
+ o.destroy();
162
+ };
163
+ }, []);
164
+ const I = t.useCallback((e, o) => {
165
+ const n = /* @__PURE__ */ t.createElement(
166
+ e,
167
+ {
168
+ spreadsheetRef: a,
169
+ value: O[e.displayName] ? O[e.displayName](S) : void 0,
170
+ key: o
171
+ }
172
+ );
173
+ return n.type === Z ? /* @__PURE__ */ t.createElement(e, { key: o }) : n;
174
+ }, [S]);
175
+ let F = null;
176
+ return d.length && (F = /* @__PURE__ */ t.createElement(
177
+ re,
178
+ {
179
+ selected: D,
180
+ animation: !1,
181
+ className: "k-floatwrap k-spreadsheet-tabstrip",
182
+ style: { minHeight: "auto" },
183
+ onSelect: (e) => G(e.selected)
184
+ },
185
+ d.map((e) => {
186
+ const o = e.textKey ? A.toLanguageString(e.textKey, g[e.textKey]) : e.text;
187
+ return /* @__PURE__ */ t.createElement(oe, { key: e.textKey || e.text, title: o }, /* @__PURE__ */ t.createElement($, { buttons: he, className: "k-spreadsheet-toolbar" }, e.tools.map((n, p) => Array.isArray(n) ? /* @__PURE__ */ t.createElement(ee, { key: p }, n.map((i, u) => I(i, u))) : I(n, p))));
188
+ })
189
+ )), /* @__PURE__ */ t.createElement(
190
+ "div",
191
+ {
192
+ ref: h,
193
+ style: r.style,
194
+ className: me("k-widget k-spreadsheet", r.className),
195
+ role: "application"
196
+ },
197
+ F,
198
+ /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-action-bar" }, /* @__PURE__ */ t.createElement(le, { ref: C, nameEditor: X }), /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-formula-bar" }, /* @__PURE__ */ t.createElement(de, { name: "formula-fx", icon: pe }), /* @__PURE__ */ t.createElement(H, { ref: x }))),
199
+ /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-view" }, /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-fixed-container" }), /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-scroller" }, /* @__PURE__ */ t.createElement("div", { className: "k-spreadsheet-view-size" })), /* @__PURE__ */ t.createElement("div", { tabIndex: 0, className: "k-spreadsheet-clipboard", contentEditable: "true" }), /* @__PURE__ */ t.createElement(H, { ref: y, className: "k-spreadsheet-cell-editor" })),
200
+ /* @__PURE__ */ t.createElement(se, { spreadsheetRef: a }),
201
+ c && /* @__PURE__ */ t.createElement(ne, { title: c.title, onClose: R }, /* @__PURE__ */ t.createElement("div", null, c.message), /* @__PURE__ */ t.createElement(ae, { layout: "start" }, /* @__PURE__ */ t.createElement(
202
+ te,
203
+ {
204
+ themeColor: "primary",
205
+ onClick: R,
206
+ autoFocus: !0
207
+ },
208
+ E.toLanguageString(m.ok, g[m.ok])
209
+ ))),
210
+ P && /* @__PURE__ */ t.createElement(fe, null)
211
+ );
212
+ });
213
+ W.displayName = "KendoReactSpreadsheet";
214
+ W.propTypes = {
215
+ className: l.string,
216
+ defaultProps: l.any,
217
+ toolbar: l.oneOfType([l.bool, l.arrayOf(l.any)]),
218
+ style: l.object,
219
+ onSelect: l.func,
220
+ onChange: l.func,
221
+ onChangeFormat: l.func,
222
+ onExcelImport: l.func,
223
+ onExcelExport: l.func
224
+ };
225
+ export {
226
+ W as Spreadsheet
227
+ };
@@ -1,5 +1,8 @@
1
- /**-----------------------------------------------------------------------------------------
2
- * Copyright © 2024 Progress Software Corporation. All rights reserved.
3
- * Licensed under commercial license. See LICENSE.md in the package root for more information
4
- *-------------------------------------------------------------------------------------------*/
5
- (function(l,V){typeof exports=="object"&&typeof module!="undefined"?V(exports,require("react"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-dialogs"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-common"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-dropdowns"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-sortable"),require("@progress/kendo-spreadsheet-common"),require("@progress/kendo-file-saver"),require("@progress/kendo-ooxml"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-inputs")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-dialogs","@progress/kendo-react-popup","@progress/kendo-react-common","@progress/kendo-svg-icons","@progress/kendo-react-dropdowns","@progress/kendo-react-intl","@progress/kendo-react-sortable","@progress/kendo-spreadsheet-common","@progress/kendo-file-saver","@progress/kendo-ooxml","@progress/kendo-react-upload","@progress/kendo-react-inputs"],V):(l=typeof globalThis!="undefined"?globalThis:l||self,V(l.KendoReactSpreadsheet={},l.React,l.PropTypes,l.KendoReactButtons,l.KendoReactLayout,l.KendoReactDialogs,l.KendoReactPopup,l.KendoReactCommon,l.KendoSvgIcons,l.KendoReactDropdowns,l.KendoReactIntl,l.KendoReactSortable,l.KendoSpreadsheetCommon,l.KendoFileSaver,l.KendoOoxml,l.KendoReactUpload,l.KendoReactInputs))})(this,function(l,V,O,N,we,ke,Vt,K,f,$,L,_t,S,Ne,Ie,qt,Jt){"use strict";"use client";function $t(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const e=$t(V),G=e.forwardRef((t,n)=>{const o=e.useRef(null),r=e.useRef(null);return e.useImperativeHandle(o,()=>({element:r.current,props:t})),e.useImperativeHandle(n,()=>o.current),e.createElement("div",{className:"k-list k-list-md"},e.createElement("div",{className:"k-list-content"},e.createElement("ul",{ref:r,className:"k-spreadsheet-formula-list k-list-ul",onMouseDown:a=>a.preventDefault(),style:{maxHeight:280}},t.data.map(a=>e.createElement("li",{key:a.text,className:"k-list-item",onClick:()=>t.onItemClick(a.value)},e.createElement(K.IconWrap,{name:"formula-fx",icon:f.formulaFxIcon}),e.createElement("span",{className:"k-list-item-text"},a.text))))))});G.displayName="List",G.propTypes={};const J=e.forwardRef((t,n)=>{const[o,r]=e.useState(!1),[a,s]=e.useState(0),[d,m]=e.useState([]),i=e.useMemo(()=>({}),[]);i.showPopup=o,i.popupContentKey=a,i.data=d;const v=e.useRef(null),E=e.useRef(null),C=e.useRef(null),R=e.useCallback(()=>{if(C.current&&C.current.element)return C.current.element.querySelector(".k-focus")},[]),x=e.useCallback(()=>{const b=R();b&&b.classList.remove("k-focus")},[]),g=e.useCallback(b=>{const D=Array.from(C.current&&C.current.element.children||[]),z=R();let p;if(z){const k=D.indexOf(z);z.classList.remove("k-focus"),p=D[k+b]?D[k+b]:b===1?D[0]:D[D.length-1]}else p=b===1?D[0]:D[D.length-1];p&&p.classList.add("k-focus")},[]);e.useImperativeHandle(v,()=>({element:E.current,props:t,popup:{open:()=>{r(!0)},close:()=>{r(!1)},position:()=>{s(i.popupContentKey+1)},visible:()=>i.showPopup},list:{get element(){return C.current&&C.current.element},data:b=>{if(b)m(b);else return i.data},value:()=>({}),focus:()=>Array.from(C.current&&C.current.element&&C.current.element.children||[]).indexOf(R()),focusNext:()=>{g(1)},focusPrev:()=>{g(-1)},focusFirst:()=>{const b=C.current&&C.current.element;b&&b.children.item(0)&&(x(),b.children.item(0).classList.add("k-focus"))},focusLast:()=>{const b=C.current&&C.current.element;b&&b.children.length&&(x(),b.children.item(b.children.length-1).classList.add("k-focus"))},itemClick:b=>{i.itemClick=b}}}),[]),e.useImperativeHandle(n,()=>v.current,[]);const y=e.useCallback(b=>{i.itemClick&&i.itemClick(b)},[]);return e.createElement(e.Fragment,null,e.createElement("div",{className:K.classNames("k-spreadsheet-formula-input",t.className),contentEditable:"true",spellCheck:"false",style:{whiteSpace:"pre"},ref:E}),e.createElement(Vt.Popup,{show:o,anchor:E.current,animate:{openDuration:100,closeDuration:100},contentKey:a,popupClass:"k-list-container"},e.createElement(G,{data:d,ref:C,onItemClick:y})))});J.displayName="FormulaInput",J.propTypes={};const Se="spreadsheet.bold",Ae="spreadsheet.italic",De="spreadsheet.underline",Le="spreadsheet.openFile",Re="spreadsheet.textColor",Te="spreadsheet.background",Fe="spreadsheet.addRowAbove",Ke="spreadsheet.addRowBelow",ze="spreadsheet.addColumnLeft",Oe="spreadsheet.addColumnRight",Pe="spreadsheet.deleteRow",Me="spreadsheet.deleteColumn",Be="spreadsheet.undo",je="spreadsheet.redo",He="spreadsheet.fontSize",Ue="spreadsheet.fontSizeIncrease",We="spreadsheet.fontSizeDecrease",Ve="spreadsheet.fontName",_e="spreadsheet.cleanFormatting",qe="spreadsheet.format",Je="spreadsheet.alignHorizontally",$e="spreadsheet.alignVertically",Ge="spreadsheet.align",Xe="spreadsheet.alignLeft",Ze="spreadsheet.alignRight",Ye="spreadsheet.alignCenter",Qe="spreadsheet.center",et="spreadsheet.alignJustify",tt="spreadsheet.justify",nt="spreadsheet.alignTop",at="spreadsheet.alignMiddle",ot="spreadsheet.alignBottom",lt="spreadsheet.increaseDecimal",rt="spreadsheet.decreaseDecimal",st="spreadsheet.textWrap",ct="spreadsheet.gridLines",it="spreadsheet.exportToExcel",ut="spreadsheet.nameBox",dt="spreadsheet.defaultSheetName",mt="spreadsheet.home",pt="spreadsheet.file",ft="spreadsheet.insert",gt="spreadsheet.formatTab",bt="spreadsheet.addNewSheet",ht="spreadsheet.error",yt="spreadsheet.ok",Ct="spreadsheet.modifyMerged",vt="spreadsheet.cannotModifyDisabled",Et="spreadsheet.openUnsupported",xt="spreadsheet.duplicateSheetName",I={[Se]:"Bold",[Ae]:"Italic",[De]:"Underline",[Be]:"Undo",[je]:"Redo",[He]:"Font size",[Ue]:"Increase Font size",[We]:"Decrease Font size",[Ve]:"Font",[_e]:"Clean formatting",[qe]:"Custom format...",[Je]:"Align horizontally",[$e]:"Align vertically",[Ge]:"Align",[Xe]:"Align left",[Ze]:"Align right",[Ye]:"Align center",[et]:"Align justify",[Qe]:"Center",[tt]:"Justify",[nt]:"Align top",[at]:"Align middle",[ot]:"Align bottom",[lt]:"Increase decimal",[rt]:"Decrease decimal",[Re]:"Text Color",[Te]:"Background color",[Fe]:"Add row above",[Ke]:"Add row below",[ze]:"Add column left",[Oe]:"Add column right",[Pe]:"Delete row",[Me]:"Delete column",[Le]:"Open...",[it]:"Export to Excel",[st]:"Text Wrap",[ct]:"Toggle gridlines",[ut]:"Name Box",[dt]:"Sheet",[mt]:"Home",[pt]:"File",[ft]:"Insert",[bt]:"Add new sheet",[gt]:"Format",[Ct]:"Cannot change part of a merged cell.",[vt]:"Cannot modify disabled cells.",[Et]:"Unsupported format. Please select an .xlsx file.",[xt]:"There is an existing sheet with this name. Please enter another name.",[ht]:"Error",[yt]:"OK"},c={bold:Se,italic:Ae,underline:De,undo:Be,redo:je,fontSize:He,fontSizeIncrease:Ue,fontSizeDecrease:We,fontName:Ve,cleanFormatting:_e,format:qe,alignHorizontally:Je,alignVertically:$e,align:Ge,alignLeft:Xe,alignRight:Ze,alignCenter:Ye,center:Qe,alignJustify:et,justify:tt,alignTop:nt,alignMiddle:at,alignBottom:ot,increaseDecimal:lt,decreaseDecimal:rt,textColor:Re,background:Te,addRowAbove:Fe,addRowBelow:Ke,addColumnLeft:ze,addColumnRight:Oe,deleteRow:Pe,deleteColumn:Me,open:Le,exportToExcel:it,textWrap:st,gridLines:ct,nameBox:ut,defaultSheetName:dt,file:pt,home:mt,insert:ft,addNewSheet:bt,error:ht,ok:yt,modifyMerged:Ct,cannotModifyDisabled:vt,openUnsupported:Et,duplicateSheetName:xt,formatTab:gt},X=e.forwardRef((t,n)=>{const o=e.useRef(null),r=e.useRef(null),[a,s]=e.useState([]),[d,m]=e.useState(!1),[i,v]=e.useState(""),E=e.useMemo(()=>({}),[]);E.data=a,e.useImperativeHandle(o,()=>({value:p=>{if(p===void 0){const k=r.current&&r.current.value;return k&&(k.name||k)}else v(p||"")}}),[]),e.useImperativeHandle(n,()=>o.current,[]);const C=e.useCallback(p=>{const k=t.nameEditor();k&&k.trigger("delete",{name:p})},[]),R=e.useCallback((p,k)=>{const P=e.createElement(e.Fragment,null,p.props.children,e.createElement("span",{role:"button",className:"k-button-delete",onClick:()=>C(k.dataItem[k.textField]),onMouseDown:w=>w.preventDefault(),onPointerDown:w=>w.preventDefault(),"data-role":"delete"},e.createElement(K.IconWrap,{name:"x",icon:f.xIcon})));return e.cloneElement(p,p.props,P)},[]),x=e.useCallback(p=>e.cloneElement(p,{...p.props},e.createElement("div",null)),[]),g=e.useCallback(p=>{if(p.syntheticEvent&&p.syntheticEvent.type==="change")return;const k=t.nameEditor();k&&(s(k.readData()),m(!0))},[]),y=e.useCallback(()=>{m(!1)},[]),b=e.useCallback(p=>{if(p.syntheticEvent.target.closest("[data-role]"))return;const k=t.nameEditor();if(k&&p.value){const P=p.value.name;P!==i&&(k.trigger("select",{name:P}),v(P))}},[i]),D=e.useCallback(p=>{const k=t.nameEditor();if(k)if(p.key==="Enter"){const P=p.target.value;k.trigger("enter",{value:P}),v(P)}else p.key==="Escape"&&(k.trigger("cancel"),v(E.prevValue))},[]),z=e.useCallback(p=>{E.prevValue=p.value.name},[]);return e.createElement("div",{className:"k-spreadsheet-name-editor",onKeyDown:D},e.createElement($.ComboBox,{ref:r,title:L.useLocalization().toLanguageString(c.nameBox,I[c.nameBox]),popupSettings:{className:"k-spreadsheet-names-popup"},fillMode:"flat",clearButton:!1,dataItemKey:"name",textField:"name",itemRender:R,data:a,value:i?a.find(p=>p.name===i)||{name:i}:null,onChange:b,opened:d,onOpen:g,onClose:y,onFocus:z,listNoDataRender:x,allowCustom:!0}))});X.displayName="NameBox",X.propTypes={};const Gt={onSelect:()=>{},onDelete:()=>{},onEnterEdit:()=>{},onCancelEdit:()=>{},onExitEdit:()=>{},onEdit:()=>{}},wt=e.createContext(Gt),Xt=t=>{const n=t.dataItem,{onSelect:o,onDelete:r,onEnterEdit:a,onExitEdit:s,onCancelEdit:d,onEdit:m}=e.useContext(wt),i=e.useCallback(g=>{g.target instanceof HTMLElement&&g.target.nodeName==="INPUT"||o.call(void 0,n,g)},[n,o]),v=e.useCallback(g=>{r.call(void 0,n,g)},[n,r]),E=e.useCallback(g=>{g.target instanceof HTMLElement&&g.target.nodeName==="INPUT"||a.call(void 0,n,g)},[n,a]),C=e.useCallback(g=>{s.call(void 0,n,g)},[n,s]),R=e.useCallback(g=>{g.key==="Enter"?s.call(void 0,n,g):g.key==="Escape"&&d.call(void 0,n,g)},[n,s,d]),x=e.useCallback(g=>{m.call(void 0,{...n,text:g.target.value},g)},[n,m]);return e.createElement("li",{style:t.style,...t.attributes,ref:t.forwardRef,role:"tab",className:K.classNames("k-item k-tabstrip-item",{"k-disabled":t.isDisabled,"k-active k-state-tab-on-top k-spreadsheet-sheets-bar-active":n.active,"k-spreadsheet-sheets-bar-inactive":!n.active,"k-first":n.first,"k-last":n.last}),onClick:i,onDoubleClick:E},n.inEdit?e.createElement("input",{type:"text",className:"k-textbox k-spreadsheet-sheets-editor",value:n.text,onChange:x,maxLength:50,autoFocus:!0,onBlur:C,onKeyDown:R}):e.createElement(e.Fragment,null,e.createElement("span",{className:"k-link"},n.text),n.first&&n.last?null:e.createElement("span",{className:"k-link k-spreadsheet-sheets-remove",onClick:v},e.createElement(K.IconWrap,{name:"x",icon:f.xIcon}))))},kt=e.forwardRef((t,n)=>{const{children:o,className:r,...a}=t;return e.createElement("ul",{className:K.classNames("k-tabstrip-items k-reset",r),role:"tablist",...a,ref:n},o)});kt.displayName="TabsList";const Zt=t=>{const{sheets:n,setSheets:o,onSheetSelect:r,onSheetDelete:a,onSheetEdit:s,onSheetReorderEnd:d}=t,[m,i]=e.useState(null),v=e.useRef(!1),E=e.useRef(-1),C=e.useCallback(w=>{o(w.map((T,M,F)=>({...T,first:M===0,last:M===F.length-1})))},[]),R=e.useCallback(w=>{C(w.newState)},[C,d]),x=e.useCallback(w=>{d.call(void 0,w)},[d]),g=e.useCallback(w=>{v.current=!0,E.current=w.prevIndex},[]),y=e.useCallback(w=>{setTimeout(()=>{v.current=!1},50),d.call(void 0,{...w,prevIndex:E.current})},[]),b=e.useCallback((w,T)=>{v.current||r.call(void 0,w,T)},[r]),D=e.useCallback((w,T)=>{T.stopPropagation(),a.call(void 0,w)},[n,a]),z=e.useCallback((w,T)=>{T.stopPropagation(),T.preventDefault();const M=n.map(F=>({...F,active:F.id===w.id,inEdit:F.id===w.id}));o(M),i({...w})},[n]),p=e.useCallback((w,T)=>{T.stopPropagation(),T.preventDefault();const M=n.map(F=>({...F,inEdit:!1,text:F.inEdit&&m?m.text:F.text}));o(M),i(null)},[n,m]),k=e.useCallback((w,T)=>{T.stopPropagation(),T.preventDefault();const M=n.map(W=>({...W,inEdit:!1})),F=n.findIndex(W=>W.id===w.id);o(M),i(null),s.call(void 0,w,F)},[n,s]),P=e.useCallback((w,T)=>{T.stopPropagation(),T.preventDefault();const M=n.map(F=>({...F,text:w.id===F.id?w.text:F.text}));o(M)},[n]);return e.createElement("div",{className:"k-spreadsheet-sheets-items k-tabstrip k-floatwrap k-tabstrip-bottom"},e.createElement("div",{className:"k-tabstrip-items-wrapper k-hstack"},e.createElement(wt.Provider,{value:{onSelect:b,onDelete:D,onEnterEdit:z,onCancelEdit:p,onExitEdit:k,onEdit:P}},e.createElement(_t.Sortable,{idField:"id",data:n,itemUI:Xt,itemsWrapUI:kt,onDragOver:R,onNavigate:x,onDragStart:g,onDragEnd:y}))))},Yt=(t,n,o)=>t.map((r,a,s)=>({text:r.name(),id:o+"-sheet-"+a,first:a===0,last:a===s.length-1,active:r.name()===n})),Qt=t=>{const{spreadsheetRef:n}=t,[o,r]=e.useState([]),a=e.useRef((o.find(x=>x.active)||{}).text),s=K.useId(),d=e.useCallback(()=>{n.current&&(n.current.view.sheetsbar.onSheetSelect(a.current),r(Yt(n.current.sheets(),a.current,s)))},[]),m=e.useCallback(()=>{if(n.current){const x=n.current.sheets();x.find(g=>g.name()===a.current)||(a.current=x[x.length-1].name()),d()}},[]);e.useEffect(()=>(n.current&&(n.current.sheets().length&&(a.current=n.current.sheets()[0].name(),d()),n.current.view.bind("update",m)),()=>{n.current&&n.current.view.unbind("update",m)}),[n.current]);const i=e.useCallback(x=>{a.current!==x.text&&(a.current=x.text,d())},[]),v=e.useCallback(()=>{if(n.current){n.current.view.sheetsbar.onAddSelect();const x=n.current.sheets();a.current=x[x.length-1].name(),d()}},[]),E=e.useCallback(x=>{if(n.current){if(a.current===x.text){const g=n.current.sheets(),y=g.findIndex(D=>D.name()===x.text),b=g[y+1]||g[y-1];a.current=b?b.name():""}n.current.view.sheetsbar.onSheetRemove(x.text),d()}},[]),C=e.useCallback((x,g)=>{if(n.current){let y=x.text;const b=n.current.sheets(),D=b[g];if(!y){a.current=D.name(),d();return}if(D&&D.name()===y)return;b.find(z=>z.name()===y)&&(y=D.name()),n.current.view.sheetsbar.onSheetRename(y,g),a.current=y,d()}},[]),R=e.useCallback(x=>{if(n.current){const{prevIndex:g,nextIndex:y}=x;a.current=n.current.sheets()[g].name(),n.current.view.sheetsbar.onSheetReorderEnd({oldIndex:g,newIndex:y}),d()}},[]);return e.createElement("div",{className:"k-spreadsheet-sheets-bar k-header"},e.createElement(N.Button,{fillMode:"flat",icon:"plus",className:"k-spreadsheet-sheets-bar-add",title:L.useLocalization().toLanguageString(c.addNewSheet,I[c.addNewSheet]),svgIcon:f.plusIcon,onClick:v}),e.createElement(Zt,{sheets:o,setSheets:r,onSheetSelect:i,onSheetDelete:E,onSheetEdit:C,onSheetReorderEnd:R}))},Z=t=>{const{spreadsheetRef:n}=t,o=e.useCallback(()=>{n.current&&n.current.saveAsExcel({...n.current.options.excel,saveAs:Ne.saveAs,Workbook:Ie.Workbook})},[]);return e.createElement(N.Button,{className:"k-toolbar-button",title:"Export...",icon:"download",fillMode:"flat",svgIcon:f.downloadIcon,onClick:o})};Z.displayName="ExcelExport";const Y=t=>{const{spreadsheetRef:n}=t,o=e.useCallback(a=>{const s=a.target;if(s instanceof Element&&s.parentNode){const d=s.closest(".k-toolbar"),m=d&&d.querySelector(".k-upload input");m&&m.click()}},[]),r=e.useCallback(a=>{const s=a.newState;if(s[0]&&s[0].getRawFile){const d=s[0].getRawFile();n.current&&n.current.executeCommand({command:"OpenCommand",options:{file:d}})}},[]);return e.createElement(e.Fragment,null,e.createElement(N.Button,{className:"k-toolbar-button",title:L.useLocalization().toLanguageString(c.open,I[c.open]),icon:"folder-open",svgIcon:f.folderOpenIcon,fillMode:"flat",onClick:o}),e.createElement("div",{style:{display:"none"}},e.createElement(qt.Upload,{restrictions:{allowedExtensions:[".xlsx"]},onAdd:r,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".xlsx,.XLSX",withCredentials:!1})))};Y.displayName="Open";const en=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],tn="Arial",nn=[8,9,10,11,12,13,14,16,18,20,22,24,26,28,36,48,72],an=12,on=[{text:"Automatic",value:null},{text:"Text",value:"@"},{text:"Number",value:"#,0.00"},{text:"Percent",value:"0.00%"},{text:"Financial",value:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)'},{text:"Currency",value:"$#,##0.00;[Red]$#,##0.00"},{text:"Date",value:"m/d/yyyy"},{text:"Time",value:"h:mm:ss AM/PM"},{text:"Date time",value:"m/d/yyyy h:mm"},{text:"Duration",value:"[h]:mm:ss"}],Q=t=>o=>{const{property:r,icon:a,svgIcon:s,titleKey:d}=t,{spreadsheetRef:m,value:i}=o,v=e.useCallback(()=>{if(m.current){const C={command:"PropertyChangeCommand",options:{property:r,value:!i}};m.current.executeCommand(C)}},[i]);return e.createElement(N.Button,{type:"button",icon:a,svgIcon:s,fillMode:"flat",togglable:!0,onClick:v,selected:i,title:L.useLocalization().toLanguageString(d,I[d])})},Nt=t=>o=>{const{property:r,titleKey:a,...s}=t,{spreadsheetRef:d,value:m}=o,i=e.useCallback(v=>{if(d.current){const E={command:"PropertyChangeCommand",options:{property:r,value:v.value||null}};d.current.executeCommand(E)}},[r]);return e.createElement(Jt.ColorPicker,{onChange:i,onActiveColorClick:i,fillMode:"flat",...s,title:L.useLocalization().toLanguageString(a,I[a]),value:m})},It=t=>o=>{const{spreadsheetRef:r}=o,a=e.useCallback(()=>{r.current&&r.current.workbook.undoRedoStack[t.action]()},[]);return e.createElement(N.Button,{type:"button",icon:t.icon,svgIcon:t.svgIcon,fillMode:"flat",title:L.useLocalization().toLanguageString(t.titleKey,I[t.titleKey]),onClick:a})},ln={property:"bold",icon:"bold",svgIcon:f.boldIcon,titleKey:c.bold},ee=Q(ln);ee.displayName="Bold";const rn={property:"italic",icon:"italic",svgIcon:f.italicIcon,titleKey:c.italic},te=Q(rn);te.displayName="Italic";const sn={property:"underline",icon:"underline",svgIcon:f.underlineIcon,titleKey:c.underline},ne=Q(sn);ne.displayName="Underline";const ae=t=>{const{spreadsheetRef:n,value:o}=t,r=e.useCallback(a=>{if(n.current){const s={command:"PropertyChangeCommand",options:{property:"fontFamily",value:a.value||null}};n.current.executeCommand(s)}},[]);return e.createElement($.DropDownList,{onChange:r,value:o,data:en,defaultValue:tn,fillMode:"flat",title:L.useLocalization().toLanguageString(c.fontName,I[c.fontName]),leftRightKeysNavigation:!1})};ae.displayName="FontFamily";const oe=1,le=409,re=t=>typeof t=="string"?parseFloat(t):t,se=t=>{const{spreadsheetRef:n}=t,o=re(t.value),r=e.useCallback(a=>{var m;let s=a.value?re(a.value):o;s=isNaN(s)?o:s,s=Math.min(le,Math.max(oe,s));const d={command:"PropertyChangeCommand",options:{property:"fontSize",value:s}};a.nativeEvent.type==="keydown"||a.nativeEvent.type==="focusout"?(m=n.current)==null||m.executeCommand(d):setTimeout(()=>{var i;(i=n.current)==null||i.executeCommand(d)},0)},[o]);return e.createElement($.ComboBox,{onChange:r,value:o,data:nn,defaultValue:an,allowCustom:!0,fillMode:"flat",title:L.useLocalization().toLanguageString(c.fontSize,I[c.fontSize]),tabIndex:-1,clearButton:!1})};se.displayName="FontSize";const St=t=>{const n=o=>{const{property:r,icon:a,svgIcon:s,titleKey:d,step:m}=t,{spreadsheetRef:i}=o,v=re(o.value),E=e.useCallback(()=>{var R;const C={command:"PropertyChangeCommand",options:{property:r,value:Math.min(le,Math.max(oe,v+m))}};(R=i.current)==null||R.executeCommand(C)},[v]);return e.createElement(N.Button,{type:"button",icon:a,svgIcon:s,fillMode:"flat",onClick:E,disabled:v+m<oe||v+m>le,title:L.useLocalization().toLanguageString(d,I[d])})};return n.displayName=t.displayName,n},At=St({property:"fontSize",icon:"font-grow",svgIcon:f.fontGrowIcon,titleKey:c.fontSizeIncrease,displayName:"IncreaseFontSize",step:1}),Dt=St({property:"fontSize",icon:"font-shrink",svgIcon:f.fontShrinkIcon,titleKey:c.fontSizeDecrease,displayName:"DecreaseFontSize",step:-1}),ce=Nt({icon:"foreground-color",svgIcon:f.foregroundColorIcon,view:"palette",property:"color",titleKey:c.textColor,ariaLabel:"Text Color"});ce.displayName="TextColor";const ie=Nt({icon:"droplet",svgIcon:f.dropletIcon,view:"palette",property:"background",titleKey:c.background,ariaLabel:"Background"});ie.displayName="BackgroundColor";const H=[{icon:"align-left",svgIcon:f.alignLeftIcon,textKey:c.alignLeft,commandName:"textAlign",value:"left",selected:!1},{icon:"align-center",svgIcon:f.alignCenterIcon,textKey:c.alignCenter,commandName:"textAlign",value:"center",selected:!1},{icon:"align-right",svgIcon:f.alignRightIcon,textKey:c.alignRight,commandName:"textAlign",value:"right",selected:!1},{icon:"align-justify",svgIcon:f.alignJustifyIcon,textKey:c.alignJustify,commandName:"textAlign",value:"justify",selected:!1},{icon:"align-top",svgIcon:f.alignTopIcon,textKey:c.alignTop,commandName:"verticalAlign",value:"top",selected:!1},{icon:"align-middle",svgIcon:f.alignMiddleIcon,textKey:c.alignMiddle,commandName:"verticalAlign",value:"center",selected:!1},{icon:"align-bottom",svgIcon:f.alignBottomIcon,textKey:c.alignBottom,commandName:"verticalAlign",value:"bottom",selected:!1}],cn=[H[0],{...H[1],textKey:c.center},H[2],{...H[3],textKey:c.justify}],un=H.filter(t=>t.commandName==="verticalAlign"),Lt=t=>{const{value:n,spreadsheetRef:o}=t,{textAlign:r,verticalAlign:a}=n||{},s=L.useLocalization(),d=e.useCallback(i=>{if(o.current){const v=i.item,E={command:"PropertyChangeCommand",options:{property:v.commandName,value:v.value||null}};o.current.executeCommand(E)}},[]);let m=H.slice();return m=m.map(i=>({...i,text:s.toLanguageString(i.textKey,I[i.textKey])})),r&&(m=m.map(i=>i.commandName==="textAlign"?{...i,selected:i.value===r}:i)),a&&(m=m.map(i=>i.commandName==="verticalAlign"?{...i,selected:i.value===a}:i)),e.createElement(N.DropDownButton,{icon:"align-left",svgIcon:f.alignLeftIcon,items:m,fillMode:"flat",onItemClick:d,title:s.toLanguageString(c.align,I[c.align]),text:e.createElement(K.IconWrap,{name:"caret-alt-down",icon:f.caretAltDownIcon})})};Lt.displayName="Alignment";const dn={items:cn,icon:{icon:"align-left",svgIcon:f.alignLeftIcon},displayName:"AlignHorizontally",titleKey:c.alignHorizontally},mn={items:un,icon:{icon:"align-bottom",svgIcon:f.alignBottomIcon},displayName:"AlignVertically",titleKey:c.alignVertically},Rt=t=>{const n=o=>{const{value:r,spreadsheetRef:a}=o,s=L.useLocalization(),d=e.useCallback(E=>{if(a.current){const C=E.item,R={command:"PropertyChangeCommand",options:{property:C.commandName,value:C.value||null}};a.current.executeCommand(R)}},[]);let m=t.items.slice();m=m.map(E=>({...E,text:s.toLanguageString(E.textKey,I[E.textKey])})),m=m.map(E=>({...E,selected:E.value===r}));const i={...t.icon},v=m.find(E=>E.selected);return v&&(i.icon=v.icon,i.svgIcon=v.svgIcon),e.createElement(N.DropDownButton,{...i,items:m,fillMode:"flat",onItemClick:d,title:s.toLanguageString(t.titleKey,I[t.titleKey]),text:e.createElement(K.IconWrap,{name:"caret-alt-down",icon:f.caretAltDownIcon})})};return n.displayName=t.displayName,n},Tt=Rt(dn),Ft=Rt(mn),ue=t=>{const{value:n,spreadsheetRef:o}=t,r=e.useCallback(()=>{if(o.current){const a=o.current.activeSheet();if(a){const m={command:"TextWrapCommand",options:{property:"wrap",value:!a.range(a.activeCell()).wrap()}};o.current.executeCommand(m)}}},[]);return e.createElement(N.Button,{type:"button",togglable:!0,icon:"text-wrap",svgIcon:f.textWrapIcon,fillMode:"flat",title:L.useLocalization().toLanguageString(c.textWrap,I[c.textWrap]),onClick:r,selected:n})};ue.displayName="TextWrap";const de=t=>{const{value:n,spreadsheetRef:o}=t,r=e.useCallback(()=>{if(o.current){const a=o.current.activeSheet();if(a){const d={command:"GridLinesChangeCommand",options:{property:"gridLines",value:!a.showGridLines()}};o.current.executeCommand(d)}}},[]);return e.createElement(N.Button,{type:"button",togglable:!0,icon:"borders-none",svgIcon:f.bordersNoneIcon,fillMode:"flat",title:L.useLocalization().toLanguageString(c.gridLines,I[c.gridLines]),onClick:r,selected:n})};de.displayName="GridLines";const me=t=>{const{spreadsheetRef:n}=t,o=e.useCallback(r=>{const a=r.item.value||null;setTimeout(()=>{if(n.current){const s={command:"PropertyChangeCommand",options:{property:"format",value:a}};n.current.executeCommand(s)}},0)},[]);return e.createElement(N.DropDownButton,{icon:"custom-format",svgIcon:f.customFormatIcon,fillMode:"flat",onItemClick:o,items:on,title:L.useLocalization().toLanguageString(c.format,I[c.format]),text:e.createElement(K.IconWrap,{name:"caret-alt-down"})})};me.displayName="Format";const U=t=>o=>{const{spreadsheetRef:r,value:a}=o,s=e.useCallback(()=>{if(r.current){const d={command:t.command,options:{value:t.value}};r.current.executeCommand(d)}},[]);return e.createElement(N.Button,{type:"button",icon:t.icon,svgIcon:t.svgIcon,fillMode:"flat",title:L.useLocalization().toLanguageString(t.titleKey,I[t.titleKey]),onClick:s,disabled:a&&t.disabled(a)})},pn={command:"AddColumnCommand",value:"left",icon:"table-column-insert-left",svgIcon:f.tableColumnInsertLeftIcon,titleKey:c.addColumnLeft,disabled:t=>t.allCols,displayName:"AddColumnLeft"},fn={command:"AddColumnCommand",value:"right",icon:"table-column-insert-right",svgIcon:f.tableColumnInsertRightIcon,titleKey:c.addColumnRight,disabled:t=>t.allCols,displayName:"AddColumnRight"},gn={command:"AddRowCommand",value:"below",icon:"table-row-insert-below",svgIcon:f.tableRowInsertBelowIcon,titleKey:c.addRowBelow,disabled:t=>t.allRows,displayName:"AddRowBelow"},bn={command:"AddRowCommand",value:"above",icon:"table-row-insert-above",svgIcon:f.tableRowInsertAboveIcon,titleKey:c.addRowAbove,disabled:t=>t.allRows,displayName:"AddRowAbove"},hn={command:"DeleteColumnCommand",icon:"table-column-delete",svgIcon:f.tableColumnDeleteIcon,titleKey:c.deleteColumn,disabled:t=>t.allCols,displayName:"DeleteColumn"},yn={command:"DeleteRowCommand",icon:"table-row-delete",svgIcon:f.tableRowDeleteIcon,titleKey:c.deleteRow,disabled:t=>t.allRows,displayName:"DeleteRow"},pe=U(pn),fe=U(fn),ge=U(gn),be=U(bn),he=U(hn),ye=U(yn);pe.displayName="AddColumnLeft",fe.displayName="AddColumnRight",ge.displayName="AddRowBelow",be.displayName="AddRowAbove",he.displayName="DeleteColumn",ye.displayName="DeleteRow";const Cn={action:"undo",icon:"reset",svgIcon:f.arrowRotateCcwIcon,titleKey:c.undo},Ce=It(Cn);Ce.displayName="Undo";const vn={action:"redo",icon:"reload",svgIcon:f.arrowRotateCwIcon,titleKey:c.redo},ve=It(vn);ve.displayName="Redo";const Kt=t=>o=>{const{icon:r,svgIcon:a,titleKey:s,value:d}=t,{spreadsheetRef:m}=o,i=e.useCallback(()=>{if(m.current){const v={command:"AdjustDecimalsCommand",options:{value:d}};m.current.executeCommand(v)}},[]);return e.createElement(N.Button,{type:"button",icon:r,svgIcon:a,fillMode:"flat",onClick:i,title:L.useLocalization().toLanguageString(s,I[s])})},En=Kt({icon:f.decimalIncreaseIcon.name,svgIcon:f.decimalIncreaseIcon,value:1,titleKey:c.increaseDecimal}),xn=Kt({icon:f.decimalDecreaseIcon.name,svgIcon:f.decimalDecreaseIcon,value:-1,titleKey:c.decreaseDecimal}),Ee=[{textKey:c.file,tools:[Y,Z]},{textKey:c.home,selected:!0,tools:[[Ce,ve],N.ToolbarSeparator,ae,se,At,Dt,N.ToolbarSeparator,[ee,te,ne],ce,N.ToolbarSeparator,ie,N.ToolbarSeparator,Tt,Ft,ue,N.ToolbarSeparator,de]},{textKey:c.insert,tools:[[pe,fe,ge,be],N.ToolbarSeparator,[he,ye]]},{textKey:c.formatTab,tools:[me,[xn,En]]}],zt={name:"@progress/kendo-react-spreadsheet",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1683639393,version:"",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"},Ot=["bold","italic","underline","fontFamily","fontSize","color","background","textAlign","verticalAlign","wrap","gridLines"],Pt={Bold:t=>t.bold,Italic:t=>t.italic,Underline:t=>t.underline,FontFamily:t=>t.fontFamily,FontSize:t=>t.fontSize,IncreaseFontSize:t=>t.fontSize,DecreaseFontSize:t=>t.fontSize,TextColor:t=>t.color,BackgroundColor:t=>t.background,Alignment:t=>({textAlign:t.textAlign,verticalAlign:t.verticalAlign}),AlignHorizontally:t=>t.textAlign,AlignVertically:t=>t.verticalAlign,TextWrap:t=>t.wrap,GridLines:t=>t.gridLines,AddColumnLeft:t=>t.selectedHeaders,AddColumnRight:t=>t.selectedHeaders,AddRowBelow:t=>t.selectedHeaders,AddRowAbove:t=>t.selectedHeaders,DeleteColumn:t=>t.selectedHeaders,DeleteRow:t=>t.selectedHeaders},Mt=":not(.k-dropdownlist button):not(.k-combobox button):not(.k-upload-button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)",wn=["button"+Mt,".k-button-group > button"+Mt,".k-dropdownlist",".k-combobox",".k-colorpicker"],xe=e.forwardRef((t,n)=>{K.validatePackage(zt);const o=K.shouldShowValidationUI(zt),{toolbar:r=Ee}=t,a=[];typeof r=="boolean"?a.push(...r?Ee:[]):a.push(...r);const[s,d]=e.useState(null),[m,i]=e.useState(a.findIndex(u=>u.selected)||0),[v,E]=e.useState(!1),C=e.useRef(null),R=e.useRef(null),x=e.useRef(null),g=e.useRef(null),y=e.useRef(null),[b,D]=e.useState({}),z=e.useRef({});z.current=b;const p=e.useRef({});p.current=t;const k=L.useLocalization(),P=e.useCallback(u=>{p.current.onSelect&&p.current.onSelect.call(void 0,u)},[]),w=e.useCallback(u=>{p.current.onChange&&p.current.onChange.call(void 0,u)},[]),T=e.useCallback(u=>{p.current.onChangeFormat&&p.current.onChangeFormat.call(void 0,u)},[]),M=e.useCallback(u=>{p.current.onExcelImport&&p.current.onExcelImport.call(void 0,u)},[]),F=e.useCallback(u=>{p.current.onExcelExport&&p.current.onExcelExport.call(void 0,u)},[]),W=e.useRef(null);e.useImperativeHandle(W,()=>({element:C.current,get instance(){return y.current},props:t,get view(){return y.current.view},get workbook(){return y.current.workbook},executeCommand(u){var h;(h=y.current)==null||h.executeCommand(u)},fromJSON(u){var h;return(h=y.current)==null?void 0:h.fromJSON(u)},toJSON(){return y.current.toJSON()},saveJSON(){return y.current.saveJSON()},fromFile(u){return y.current.fromFile(u)},saveAsExcel(u){var h;(h=y.current)==null||h.saveAsExcel({...y.current.options.excel,saveAs:Ne.saveAs,Workbook:Ie.Workbook,...u})},activeSheet(u){var h;return(h=y.current)==null?void 0:h.activeSheet(u)},sheets(){return y.current.sheets()},refresh(){var u;return(u=y.current)==null?void 0:u.refresh()}}),[t]),e.useImperativeHandle(n,()=>W.current);const Nn=e.useCallback(()=>y.current&&y.current.view.nameEditor,[]),Bt=e.useCallback(u=>{const h={};Ot.forEach(A=>{typeof u.range[A]=="function"?h[A]=u.range[A]():A==="gridLines"&&(h[A]=u.range.sheet().showGridLines())}),h.selectedHeaders=u.range.sheet().selectedHeaders(),(Ot.some(A=>h[A]!==z.current[A])||h.selectedHeaders.allCols!==z.current.selectedHeaders.allCols||h.selectedHeaders.allRows!==z.current.selectedHeaders.allRows)&&D(h)},[]),In=e.useCallback(u=>{const h=u.name,A=c[h];d({title:u.title==="Error"?k.toLanguageString(c.error,I[c.error]||u.title):u.title,message:A?k.toLanguageString(A,I[A]||u.text):u.text,close:u.close})},[]),jt=e.useCallback(()=>{d(null),s==null||s.close()},[s]),_=L.useInternationalization(),Ht=L.useLocalization();e.useEffect(()=>{var q;const u={...t.defaultProps,sheets:structuredClone((q=t.defaultProps)==null?void 0:q.sheets),messages:{workbook:{defaultSheetName:Ht.toLanguageString(c.defaultSheetName,I[c.defaultSheetName])}},intl:{localeInfo:()=>_.localeInfo(),localeCurrency:()=>_.localeCurrency(),parseDate:(B,j)=>_.parseDate(B,j),toString:(B,j)=>_.toString(B,j),format:(B,...j)=>_.format(B,...j)},formulaBarInputRef:R,formulaCellInputRef:x,nameBoxRef:g},h=new S.SpreadsheetWidget(C.current,u);y.current=h,h.bind("select",P),h.bind("change",w),h.bind("changeFormat",T),h.bind("excelImport",M),h.bind("excelExport",F),h.view.bind("update",Bt),h.view.bind("message",In);const A=h.activeSheet();return A&&Bt({range:A.range(A.activeCell())}),E(!0),()=>{h.destroy()}},[]);const Ut=e.useCallback((u,h)=>{const A=e.createElement(u,{spreadsheetRef:y,value:Pt[u.displayName]?Pt[u.displayName](b):void 0,key:h});return A.type===N.ToolbarSeparator?e.createElement(u,{key:h}):A},[b]);let Wt=null;return a.length&&(Wt=e.createElement(we.TabStrip,{selected:m,animation:!1,className:"k-floatwrap k-spreadsheet-tabstrip",style:{minHeight:"auto"},onSelect:u=>i(u.selected)},a.map(u=>{const h=u.textKey?Ht.toLanguageString(u.textKey,I[u.textKey]):u.text;return e.createElement(we.TabStripTab,{key:u.textKey||u.text,title:h},e.createElement(N.Toolbar,{buttons:wn,className:"k-spreadsheet-toolbar"},u.tools.map((A,q)=>Array.isArray(A)?e.createElement(N.ButtonGroup,{key:q},A.map((B,j)=>Ut(B,j))):Ut(A,q))))}))),e.createElement("div",{ref:C,style:t.style,className:K.classNames("k-widget k-spreadsheet",t.className),role:"application"},Wt,e.createElement("div",{className:"k-spreadsheet-action-bar"},e.createElement(X,{ref:g,nameEditor:Nn}),e.createElement("div",{className:"k-spreadsheet-formula-bar"},e.createElement(K.IconWrap,{name:"formula-fx",icon:f.formulaFxIcon}),e.createElement(J,{ref:R}))),e.createElement("div",{className:"k-spreadsheet-view"},e.createElement("div",{className:"k-spreadsheet-fixed-container"}),e.createElement("div",{className:"k-spreadsheet-scroller"},e.createElement("div",{className:"k-spreadsheet-view-size"})),e.createElement("div",{tabIndex:0,className:"k-spreadsheet-clipboard",contentEditable:"true"}),e.createElement(J,{ref:x,className:"k-spreadsheet-cell-editor"})),e.createElement(Qt,{spreadsheetRef:y}),s&&e.createElement(ke.Dialog,{title:s.title,onClose:jt},e.createElement("div",null,s.message),e.createElement(ke.DialogActionsBar,{layout:"start"},e.createElement(N.Button,{themeColor:"primary",onClick:jt,autoFocus:!0},k.toLanguageString(c.ok,I[c.ok])))),o&&e.createElement(K.WatermarkOverlay,null))});xe.displayName="KendoReactSpreadsheet",xe.propTypes={className:O.string,defaultProps:O.any,toolbar:O.oneOfType([O.bool,O.arrayOf(O.any)]),style:O.object,onSelect:O.func,onChange:O.func,onChangeFormat:O.func,onExcelImport:O.func,onExcelExport:O.func};const kn=t=>{const{spreadsheetRef:n}=t,o=e.useCallback(()=>{n.current&&n.current.executeCommand({command:"PropertyCleanCommand"})},[]);return e.createElement(N.Button,{type:"button",icon:"clean-css",svgIcon:f.clearCssIcon,fillMode:"flat",onClick:o,title:L.useLocalization().toLanguageString(c.cleanFormatting,I[c.cleanFormatting])})};Object.defineProperty(l,"CalcError",{enumerable:!0,get:()=>S.CalcError}),Object.defineProperty(l,"CellRef",{enumerable:!0,get:()=>S.CellRef}),Object.defineProperty(l,"Context",{enumerable:!0,get:()=>S.Context}),Object.defineProperty(l,"Matrix",{enumerable:!0,get:()=>S.Matrix}),Object.defineProperty(l,"NULLREF",{enumerable:!0,get:()=>S.NULLREF}),Object.defineProperty(l,"NameRef",{enumerable:!0,get:()=>S.NameRef}),Object.defineProperty(l,"Range",{enumerable:!0,get:()=>S.Range}),Object.defineProperty(l,"RangeRef",{enumerable:!0,get:()=>S.RangeRef}),Object.defineProperty(l,"Ref",{enumerable:!0,get:()=>S.Ref}),Object.defineProperty(l,"Sheet",{enumerable:!0,get:()=>S.Sheet}),Object.defineProperty(l,"SpreadsheetWidget",{enumerable:!0,get:()=>S.SpreadsheetWidget}),Object.defineProperty(l,"UnionRef",{enumerable:!0,get:()=>S.UnionRef}),Object.defineProperty(l,"View",{enumerable:!0,get:()=>S.View}),Object.defineProperty(l,"Workbook",{enumerable:!0,get:()=>S.Workbook}),Object.defineProperty(l,"dateToSerial",{enumerable:!0,get:()=>S.dateToSerial}),Object.defineProperty(l,"defineAlias",{enumerable:!0,get:()=>S.defineAlias}),Object.defineProperty(l,"defineFunction",{enumerable:!0,get:()=>S.defineFunction}),Object.defineProperty(l,"packDate",{enumerable:!0,get:()=>S.packDate}),Object.defineProperty(l,"packTime",{enumerable:!0,get:()=>S.packTime}),Object.defineProperty(l,"serialToDate",{enumerable:!0,get:()=>S.serialToDate}),Object.defineProperty(l,"unpackDate",{enumerable:!0,get:()=>S.unpackDate}),Object.defineProperty(l,"unpackTime",{enumerable:!0,get:()=>S.unpackTime}),l.AddColumnLeft=pe,l.AddColumnRight=fe,l.AddRowAbove=be,l.AddRowBelow=ge,l.AlignHorizontally=Tt,l.AlignVertically=Ft,l.Alignment=Lt,l.BackgroundColor=ie,l.Bold=ee,l.CleanFormatting=kn,l.DecreaseFontSize=Dt,l.DeleteColumn=he,l.DeleteRow=ye,l.ExcelExport=Z,l.FontFamily=ae,l.FontSize=se,l.Format=me,l.GridLines=de,l.IncreaseFontSize=At,l.Italic=te,l.Open=Y,l.Redo=ve,l.Spreadsheet=xe,l.TextColor=ce,l.TextWrap=ue,l.Underline=ne,l.Undo=Ce,l.defaultTabs=Ee,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
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
+ */
8
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("prop-types"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-layout"),require("@progress/kendo-react-dialogs"),require("@progress/kendo-react-popup"),require("@progress/kendo-react-common"),require("@progress/kendo-svg-icons"),require("@progress/kendo-react-dropdowns"),require("@progress/kendo-react-intl"),require("@progress/kendo-react-sortable"),require("@progress/kendo-spreadsheet-common"),require("@progress/kendo-file-saver"),require("@progress/kendo-ooxml"),require("@progress/kendo-react-upload"),require("@progress/kendo-react-inputs")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-buttons","@progress/kendo-react-layout","@progress/kendo-react-dialogs","@progress/kendo-react-popup","@progress/kendo-react-common","@progress/kendo-svg-icons","@progress/kendo-react-dropdowns","@progress/kendo-react-intl","@progress/kendo-react-sortable","@progress/kendo-spreadsheet-common","@progress/kendo-file-saver","@progress/kendo-ooxml","@progress/kendo-react-upload","@progress/kendo-react-inputs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactSpreadsheet={},e.React,e.PropTypes,e.KendoReactButtons,e.KendoReactLayout,e.KendoReactDialogs,e.KendoReactPopup,e.KendoReactCommon,e.KendoSvgIcons,e.KendoReactDropdowns,e.KendoReactIntl,e.KendoReactSortable,e.KendoSpreadsheetCommon,e.KendoFileSaver,e.KendoOoxml,e.KendoReactUpload,e.KendoReactInputs)}(this,(function(e,t,n,a,o,r,l,s,c,i,d,u,m,p,g,f,b){"use strict";function v(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var h=v(t);const y=h.forwardRef(((e,t)=>{const n=h.useRef(null),a=h.useRef(null);return h.useImperativeHandle(n,(()=>({element:a.current,props:e}))),h.useImperativeHandle(t,(()=>n.current)),h.createElement("div",{className:"k-list k-list-md"},h.createElement("div",{className:"k-list-content"},h.createElement("ul",{ref:a,className:"k-spreadsheet-formula-list k-list-ul",onMouseDown:e=>e.preventDefault(),style:{maxHeight:280}},e.data.map((t=>h.createElement("li",{key:t.text,className:"k-list-item",onClick:()=>e.onItemClick(t.value)},h.createElement(s.IconWrap,{name:"formula-fx",icon:c.formulaFxIcon}),h.createElement("span",{className:"k-list-item-text"},t.text)))))))}));y.displayName="List",y.propTypes={};const k=h.forwardRef(((e,t)=>{const[n,a]=h.useState(!1),[o,r]=h.useState(0),[c,i]=h.useState([]),d=h.useMemo((()=>({})),[]);d.showPopup=n,d.popupContentKey=o,d.data=c;const u=h.useRef(null),m=h.useRef(null),p=h.useRef(null),g=h.useCallback((()=>{if(p.current&&p.current.element)return p.current.element.querySelector(".k-focus")}),[]),f=h.useCallback((()=>{const e=g();e&&e.classList.remove("k-focus")}),[]),b=h.useCallback((e=>{const t=Array.from(p.current&&p.current.element.children||[]),n=g();let a;if(n){const o=t.indexOf(n);n.classList.remove("k-focus"),a=t[o+e]?t[o+e]:1===e?t[0]:t[t.length-1]}else a=1===e?t[0]:t[t.length-1];a&&a.classList.add("k-focus")}),[]);h.useImperativeHandle(u,(()=>({element:m.current,props:e,popup:{open:()=>{a(!0)},close:()=>{a(!1)},position:()=>{r(d.popupContentKey+1)},visible:()=>d.showPopup},list:{get element(){return p.current&&p.current.element},data:e=>{if(!e)return d.data;i(e)},value:()=>({}),focus:()=>Array.from(p.current&&p.current.element&&p.current.element.children||[]).indexOf(g()),focusNext:()=>{b(1)},focusPrev:()=>{b(-1)},focusFirst:()=>{const e=p.current&&p.current.element;e&&e.children.item(0)&&(f(),e.children.item(0).classList.add("k-focus"))},focusLast:()=>{const e=p.current&&p.current.element;e&&e.children.length&&(f(),e.children.item(e.children.length-1).classList.add("k-focus"))},itemClick:e=>{d.itemClick=e}}})),[]),h.useImperativeHandle(t,(()=>u.current),[]);const v=h.useCallback((e=>{d.itemClick&&d.itemClick(e)}),[]);return h.createElement(h.Fragment,null,h.createElement("div",{className:s.classNames("k-spreadsheet-formula-input",e.className),contentEditable:"true",spellCheck:"false",style:{whiteSpace:"pre"},ref:m}),h.createElement(l.Popup,{show:n,anchor:m.current,animate:{openDuration:100,closeDuration:100},contentKey:o,popupClass:"k-list-container"},h.createElement(y,{data:c,ref:p,onItemClick:v})))}));k.displayName="FormulaInput",k.propTypes={};const C="spreadsheet.bold",x="spreadsheet.italic",E="spreadsheet.underline",I="spreadsheet.openFile",S="spreadsheet.textColor",w="spreadsheet.background",R="spreadsheet.addRowAbove",N="spreadsheet.addRowBelow",A="spreadsheet.addColumnLeft",L="spreadsheet.addColumnRight",D="spreadsheet.deleteRow",K="spreadsheet.deleteColumn",F="spreadsheet.undo",T="spreadsheet.redo",z="spreadsheet.fontSize",P="spreadsheet.fontSizeIncrease",B="spreadsheet.fontSizeDecrease",O="spreadsheet.fontName",M="spreadsheet.cleanFormatting",j="spreadsheet.format",H="spreadsheet.alignHorizontally",W="spreadsheet.alignVertically",U="spreadsheet.align",q="spreadsheet.alignLeft",V="spreadsheet.alignRight",J="spreadsheet.alignCenter",_="spreadsheet.center",G="spreadsheet.alignJustify",$="spreadsheet.justify",X="spreadsheet.alignTop",Q="spreadsheet.alignMiddle",Y="spreadsheet.alignBottom",Z="spreadsheet.increaseDecimal",ee="spreadsheet.decreaseDecimal",te="spreadsheet.textWrap",ne="spreadsheet.gridLines",ae="spreadsheet.exportToExcel",oe="spreadsheet.nameBox",re="spreadsheet.defaultSheetName",le="spreadsheet.home",se="spreadsheet.file",ce="spreadsheet.insert",ie="spreadsheet.formatTab",de="spreadsheet.addNewSheet",ue="spreadsheet.error",me="spreadsheet.ok",pe="spreadsheet.modifyMerged",ge="spreadsheet.cannotModifyDisabled",fe="spreadsheet.openUnsupported",be="spreadsheet.duplicateSheetName",ve={[C]:"Bold",[x]:"Italic",[E]:"Underline",[F]:"Undo",[T]:"Redo",[z]:"Font size",[P]:"Increase Font size",[B]:"Decrease Font size",[O]:"Font",[M]:"Clean formatting",[j]:"Custom format...",[H]:"Align horizontally",[W]:"Align vertically",[U]:"Align",[q]:"Align left",[V]:"Align right",[J]:"Align center",[G]:"Align justify",[_]:"Center",[$]:"Justify",[X]:"Align top",[Q]:"Align middle",[Y]:"Align bottom",[Z]:"Increase decimal",[ee]:"Decrease decimal",[S]:"Text Color",[w]:"Background color",[R]:"Add row above",[N]:"Add row below",[A]:"Add column left",[L]:"Add column right",[D]:"Delete row",[K]:"Delete column",[I]:"Open...",[ae]:"Export to Excel",[te]:"Text Wrap",[ne]:"Toggle gridlines",[oe]:"Name Box",[re]:"Sheet",[le]:"Home",[se]:"File",[ce]:"Insert",[de]:"Add new sheet",[ie]:"Format",[pe]:"Cannot change part of a merged cell.",[ge]:"Cannot modify disabled cells.",[fe]:"Unsupported format. Please select an .xlsx file.",[be]:"There is an existing sheet with this name. Please enter another name.",[ue]:"Error",[me]:"OK"},he={bold:C,italic:x,underline:E,undo:F,redo:T,fontSize:z,fontSizeIncrease:P,fontSizeDecrease:B,fontName:O,cleanFormatting:M,format:j,alignHorizontally:H,alignVertically:W,align:U,alignLeft:q,alignRight:V,alignCenter:J,center:_,alignJustify:G,justify:$,alignTop:X,alignMiddle:Q,alignBottom:Y,increaseDecimal:Z,decreaseDecimal:ee,textColor:S,background:w,addRowAbove:R,addRowBelow:N,addColumnLeft:A,addColumnRight:L,deleteRow:D,deleteColumn:K,open:I,exportToExcel:ae,textWrap:te,gridLines:ne,nameBox:oe,defaultSheetName:re,file:se,home:le,insert:ce,addNewSheet:de,error:ue,ok:me,modifyMerged:pe,cannotModifyDisabled:ge,openUnsupported:fe,duplicateSheetName:be,formatTab:ie},ye=h.forwardRef(((e,t)=>{const n=h.useRef(null),a=h.useRef(null),[o,r]=h.useState([]),[l,u]=h.useState(!1),[m,p]=h.useState(""),g=h.useMemo((()=>({})),[]);g.data=o,h.useImperativeHandle(n,(()=>({value:e=>{if(void 0===e){const e=a.current&&a.current.value;return e&&(e.name||e)}p(e||"")}})),[]),h.useImperativeHandle(t,(()=>n.current),[]);const f=h.useCallback((t=>{const n=e.nameEditor();n&&n.trigger("delete",{name:t})}),[]),b=h.useCallback(((e,t)=>{const n=h.createElement(h.Fragment,null,e.props.children,h.createElement("span",{role:"button",className:"k-button-delete",onClick:()=>f(t.dataItem[t.textField]),onMouseDown:e=>e.preventDefault(),onPointerDown:e=>e.preventDefault(),"data-role":"delete"},h.createElement(s.IconWrap,{name:"x",icon:c.xIcon})));return h.cloneElement(e,e.props,n)}),[]),v=h.useCallback((e=>h.cloneElement(e,{...e.props},h.createElement("div",null))),[]),y=h.useCallback((t=>{if(t.syntheticEvent&&"change"===t.syntheticEvent.type)return;const n=e.nameEditor();n&&(r(n.readData()),u(!0))}),[]),k=h.useCallback((()=>{u(!1)}),[]),C=h.useCallback((t=>{if(t.syntheticEvent.target.closest("[data-role]"))return;const n=e.nameEditor();if(n&&t.value){const e=t.value.name;e!==m&&(n.trigger("select",{name:e}),p(e))}}),[m]),x=h.useCallback((t=>{const n=e.nameEditor();if(n)if("Enter"===t.key){const e=t.target.value;n.trigger("enter",{value:e}),p(e)}else"Escape"===t.key&&(n.trigger("cancel"),p(g.prevValue))}),[]),E=h.useCallback((e=>{g.prevValue=e.value.name}),[]);return h.createElement("div",{className:"k-spreadsheet-name-editor",onKeyDown:x},h.createElement(i.ComboBox,{ref:a,title:d.useLocalization().toLanguageString(he.nameBox,ve[he.nameBox]),popupSettings:{className:"k-spreadsheet-names-popup"},fillMode:"flat",clearButton:!1,dataItemKey:"name",textField:"name",itemRender:b,data:o,value:m?o.find((e=>e.name===m))||{name:m}:null,onChange:C,opened:l,onOpen:y,onClose:k,onFocus:E,listNoDataRender:v,allowCustom:!0}))}));ye.displayName="NameBox",ye.propTypes={};const ke=h.createContext({onSelect:()=>{},onDelete:()=>{},onEnterEdit:()=>{},onCancelEdit:()=>{},onExitEdit:()=>{},onEdit:()=>{}}),Ce=e=>{const t=e.dataItem,{onSelect:n,onDelete:a,onEnterEdit:o,onExitEdit:r,onCancelEdit:l,onEdit:i}=h.useContext(ke),d=h.useCallback((e=>{e.target instanceof HTMLElement&&"INPUT"===e.target.nodeName||n.call(void 0,t,e)}),[t,n]),u=h.useCallback((e=>{a.call(void 0,t,e)}),[t,a]),m=h.useCallback((e=>{e.target instanceof HTMLElement&&"INPUT"===e.target.nodeName||o.call(void 0,t,e)}),[t,o]),p=h.useCallback((e=>{r.call(void 0,t,e)}),[t,r]),g=h.useCallback((e=>{"Enter"===e.key?r.call(void 0,t,e):"Escape"===e.key&&l.call(void 0,t,e)}),[t,r,l]),f=h.useCallback((e=>{i.call(void 0,{...t,text:e.target.value},e)}),[t,i]);return h.createElement("li",{style:e.style,...e.attributes,ref:e.forwardRef,role:"tab",className:s.classNames("k-item k-tabstrip-item",{"k-disabled":e.isDisabled,"k-active k-state-tab-on-top k-spreadsheet-sheets-bar-active":t.active,"k-spreadsheet-sheets-bar-inactive":!t.active,"k-first":t.first,"k-last":t.last}),onClick:d,onDoubleClick:m},t.inEdit?h.createElement("input",{type:"text",className:"k-textbox k-spreadsheet-sheets-editor",value:t.text,onChange:f,maxLength:50,autoFocus:!0,onBlur:p,onKeyDown:g}):h.createElement(h.Fragment,null,h.createElement("span",{className:"k-link"},t.text),t.first&&t.last?null:h.createElement("span",{className:"k-link k-spreadsheet-sheets-remove",onClick:u},h.createElement(s.IconWrap,{name:"x",icon:c.xIcon}))))},xe=h.forwardRef(((e,t)=>{const{children:n,className:a,...o}=e;return h.createElement("ul",{className:s.classNames("k-tabstrip-items k-reset",a),role:"tablist",...o,ref:t},n)}));xe.displayName="TabsList";const Ee=e=>{const{sheets:t,setSheets:n,onSheetSelect:a,onSheetDelete:o,onSheetEdit:r,onSheetReorderEnd:l}=e,[s,c]=h.useState(null),i=h.useRef(!1),d=h.useRef(-1),m=h.useCallback((e=>{n(e.map(((e,t,n)=>({...e,first:0===t,last:t===n.length-1}))))}),[]),p=h.useCallback((e=>{m(e.newState)}),[m,l]),g=h.useCallback((e=>{l.call(void 0,e)}),[l]),f=h.useCallback((e=>{i.current=!0,d.current=e.prevIndex}),[]),b=h.useCallback((e=>{setTimeout((()=>{i.current=!1}),50),l.call(void 0,{...e,prevIndex:d.current})}),[]),v=h.useCallback(((e,t)=>{i.current||a.call(void 0,e,t)}),[a]),y=h.useCallback(((e,t)=>{t.stopPropagation(),o.call(void 0,e)}),[t,o]),k=h.useCallback(((e,a)=>{a.stopPropagation(),a.preventDefault();const o=t.map((t=>({...t,active:t.id===e.id,inEdit:t.id===e.id})));n(o),c({...e})}),[t]),C=h.useCallback(((e,a)=>{a.stopPropagation(),a.preventDefault();const o=t.map((e=>({...e,inEdit:!1,text:e.inEdit&&s?s.text:e.text})));n(o),c(null)}),[t,s]),x=h.useCallback(((e,a)=>{a.stopPropagation(),a.preventDefault();const o=t.map((e=>({...e,inEdit:!1}))),l=t.findIndex((t=>t.id===e.id));n(o),c(null),r.call(void 0,e,l)}),[t,r]),E=h.useCallback(((e,a)=>{a.stopPropagation(),a.preventDefault();const o=t.map((t=>({...t,text:e.id===t.id?e.text:t.text})));n(o)}),[t]);return h.createElement("div",{className:"k-spreadsheet-sheets-items k-tabstrip k-floatwrap k-tabstrip-bottom"},h.createElement("div",{className:"k-tabstrip-items-wrapper k-hstack"},h.createElement(ke.Provider,{value:{onSelect:v,onDelete:y,onEnterEdit:k,onCancelEdit:C,onExitEdit:x,onEdit:E}},h.createElement(u.Sortable,{idField:"id",data:t,itemUI:Ce,itemsWrapUI:xe,onDragOver:p,onNavigate:g,onDragStart:f,onDragEnd:b}))))},Ie=e=>{const{spreadsheetRef:t}=e,[n,o]=h.useState([]),r=h.useRef((n.find((e=>e.active))||{}).text),l=s.useId(),i=h.useCallback((()=>{t.current&&(t.current.view.sheetsbar.onSheetSelect(r.current),o(((e,t,n)=>e.map(((e,a,o)=>({text:e.name(),id:n+"-sheet-"+a,first:0===a,last:a===o.length-1,active:e.name()===t}))))(t.current.sheets(),r.current,l)))}),[]),u=h.useCallback((()=>{if(t.current){const e=t.current.sheets();e.find((e=>e.name()===r.current))||(r.current=e[e.length-1].name()),i()}}),[]);h.useEffect((()=>(t.current&&(t.current.sheets().length&&(r.current=t.current.sheets()[0].name(),i()),t.current.view.bind("update",u)),()=>{t.current&&t.current.view.unbind("update",u)})),[t.current]);const m=h.useCallback((e=>{r.current!==e.text&&(r.current=e.text,i())}),[]),p=h.useCallback((()=>{if(t.current){t.current.view.sheetsbar.onAddSelect();const e=t.current.sheets();r.current=e[e.length-1].name(),i()}}),[]),g=h.useCallback((e=>{if(t.current){if(r.current===e.text){const n=t.current.sheets(),a=n.findIndex((t=>t.name()===e.text)),o=n[a+1]||n[a-1];r.current=o?o.name():""}t.current.view.sheetsbar.onSheetRemove(e.text),i()}}),[]),f=h.useCallback(((e,n)=>{if(t.current){let a=e.text;const o=t.current.sheets(),l=o[n];if(!a)return r.current=l.name(),void i();if(l&&l.name()===a)return;o.find((e=>e.name()===a))&&(a=l.name()),t.current.view.sheetsbar.onSheetRename(a,n),r.current=a,i()}}),[]),b=h.useCallback((e=>{if(t.current){const{prevIndex:n,nextIndex:a}=e;r.current=t.current.sheets()[n].name(),t.current.view.sheetsbar.onSheetReorderEnd({oldIndex:n,newIndex:a}),i()}}),[]);return h.createElement("div",{className:"k-spreadsheet-sheets-bar k-header"},h.createElement(a.Button,{fillMode:"flat",icon:"plus",className:"k-spreadsheet-sheets-bar-add",title:d.useLocalization().toLanguageString(he.addNewSheet,ve[he.addNewSheet]),svgIcon:c.plusIcon,onClick:p}),h.createElement(Ee,{sheets:n,setSheets:o,onSheetSelect:m,onSheetDelete:g,onSheetEdit:f,onSheetReorderEnd:b}))},Se=e=>{const{spreadsheetRef:t}=e,n=h.useCallback((()=>{t.current&&t.current.saveAsExcel({...t.current.options.excel,saveAs:p.saveAs,Workbook:g.Workbook})}),[]);return h.createElement(a.Button,{className:"k-toolbar-button",title:"Export...",icon:"download",fillMode:"flat",svgIcon:c.downloadIcon,onClick:n})};Se.displayName="ExcelExport";const we=e=>{const{spreadsheetRef:t}=e,n=h.useCallback((e=>{const t=e.target;if(t instanceof Element&&t.parentNode){const e=t.closest(".k-toolbar"),n=e&&e.querySelector(".k-upload input");n&&n.click()}}),[]),o=h.useCallback((e=>{const n=e.newState;if(n[0]&&n[0].getRawFile){const e=n[0].getRawFile();t.current&&t.current.executeCommand({command:"OpenCommand",options:{file:e}})}}),[]);return h.createElement(h.Fragment,null,h.createElement(a.Button,{className:"k-toolbar-button",title:d.useLocalization().toLanguageString(he.open,ve[he.open]),icon:"folder-open",svgIcon:c.folderOpenIcon,fillMode:"flat",onClick:n}),h.createElement("div",{style:{display:"none"}},h.createElement(f.Upload,{restrictions:{allowedExtensions:[".xlsx"]},onAdd:o,autoUpload:!1,defaultFiles:[],multiple:!1,accept:".xlsx,.XLSX",withCredentials:!1})))};we.displayName="Open";const Re=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],Ne=[8,9,10,11,12,13,14,16,18,20,22,24,26,28,36,48,72],Ae=[{text:"Automatic",value:null},{text:"Text",value:"@"},{text:"Number",value:"#,0.00"},{text:"Percent",value:"0.00%"},{text:"Financial",value:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)'},{text:"Currency",value:"$#,##0.00;[Red]$#,##0.00"},{text:"Date",value:"m/d/yyyy"},{text:"Time",value:"h:mm:ss AM/PM"},{text:"Date time",value:"m/d/yyyy h:mm"},{text:"Duration",value:"[h]:mm:ss"}],Le=e=>t=>{const{property:n,icon:o,svgIcon:r,titleKey:l}=e,{spreadsheetRef:s,value:c}=t,i=h.useCallback((()=>{if(s.current){const e={command:"PropertyChangeCommand",options:{property:n,value:!c}};s.current.executeCommand(e)}}),[c]);return h.createElement(a.Button,{type:"button",icon:o,svgIcon:r,fillMode:"flat",togglable:!0,onClick:i,selected:c,title:d.useLocalization().toLanguageString(l,ve[l])})},De=e=>t=>{const{property:n,titleKey:a,...o}=e,{spreadsheetRef:r,value:l}=t,s=h.useCallback((e=>{if(r.current){const t={command:"PropertyChangeCommand",options:{property:n,value:e.value||null}};r.current.executeCommand(t)}}),[n]);return h.createElement(b.ColorPicker,{onChange:s,onActiveColorClick:s,fillMode:"flat",...o,title:d.useLocalization().toLanguageString(a,ve[a]),value:l})},Ke=e=>t=>{const{spreadsheetRef:n}=t,o=h.useCallback((()=>{n.current&&n.current.workbook.undoRedoStack[e.action]()}),[]);return h.createElement(a.Button,{type:"button",icon:e.icon,svgIcon:e.svgIcon,fillMode:"flat",title:d.useLocalization().toLanguageString(e.titleKey,ve[e.titleKey]),onClick:o})},Fe=Le({property:"bold",icon:"bold",svgIcon:c.boldIcon,titleKey:he.bold});Fe.displayName="Bold";const Te=Le({property:"italic",icon:"italic",svgIcon:c.italicIcon,titleKey:he.italic});Te.displayName="Italic";const ze=Le({property:"underline",icon:"underline",svgIcon:c.underlineIcon,titleKey:he.underline});ze.displayName="Underline";const Pe=e=>{const{spreadsheetRef:t,value:n}=e,a=h.useCallback((e=>{if(t.current){const n={command:"PropertyChangeCommand",options:{property:"fontFamily",value:e.value||null}};t.current.executeCommand(n)}}),[]);return h.createElement(i.DropDownList,{onChange:a,value:n,data:Re,defaultValue:"Arial",fillMode:"flat",title:d.useLocalization().toLanguageString(he.fontName,ve[he.fontName]),leftRightKeysNavigation:!1})};Pe.displayName="FontFamily";const Be=e=>"string"==typeof e?parseFloat(e):e,Oe=e=>{const{spreadsheetRef:t}=e,n=Be(e.value),a=h.useCallback((e=>{var a;let o=e.value?Be(e.value):n;o=isNaN(o)?n:o,o=Math.min(409,Math.max(1,o));const r={command:"PropertyChangeCommand",options:{property:"fontSize",value:o}};"keydown"===e.nativeEvent.type||"focusout"===e.nativeEvent.type?null==(a=t.current)||a.executeCommand(r):setTimeout((()=>{var e;null==(e=t.current)||e.executeCommand(r)}),0)}),[n]);return h.createElement(i.ComboBox,{onChange:a,value:n,data:Ne,defaultValue:12,allowCustom:!0,fillMode:"flat",title:d.useLocalization().toLanguageString(he.fontSize,ve[he.fontSize]),tabIndex:-1,clearButton:!1})};Oe.displayName="FontSize";const Me=e=>{const t=t=>{const{property:n,icon:o,svgIcon:r,titleKey:l,step:s}=e,{spreadsheetRef:c}=t,i=Be(t.value),u=h.useCallback((()=>{var e;const t={command:"PropertyChangeCommand",options:{property:n,value:Math.min(409,Math.max(1,i+s))}};null==(e=c.current)||e.executeCommand(t)}),[i]);return h.createElement(a.Button,{type:"button",icon:o,svgIcon:r,fillMode:"flat",onClick:u,disabled:i+s<1||i+s>409,title:d.useLocalization().toLanguageString(l,ve[l])})};return t.displayName=e.displayName,t},je=Me({property:"fontSize",icon:"font-grow",svgIcon:c.fontGrowIcon,titleKey:he.fontSizeIncrease,displayName:"IncreaseFontSize",step:1}),He=Me({property:"fontSize",icon:"font-shrink",svgIcon:c.fontShrinkIcon,titleKey:he.fontSizeDecrease,displayName:"DecreaseFontSize",step:-1}),We=De({icon:"foreground-color",svgIcon:c.foregroundColorIcon,view:"palette",property:"color",titleKey:he.textColor,ariaLabel:"Text Color"});We.displayName="TextColor";const Ue=De({icon:"droplet",svgIcon:c.dropletIcon,view:"palette",property:"background",titleKey:he.background,ariaLabel:"Background"});Ue.displayName="BackgroundColor";const qe=[{icon:"align-left",svgIcon:c.alignLeftIcon,textKey:he.alignLeft,commandName:"textAlign",value:"left",selected:!1},{icon:"align-center",svgIcon:c.alignCenterIcon,textKey:he.alignCenter,commandName:"textAlign",value:"center",selected:!1},{icon:"align-right",svgIcon:c.alignRightIcon,textKey:he.alignRight,commandName:"textAlign",value:"right",selected:!1},{icon:"align-justify",svgIcon:c.alignJustifyIcon,textKey:he.alignJustify,commandName:"textAlign",value:"justify",selected:!1},{icon:"align-top",svgIcon:c.alignTopIcon,textKey:he.alignTop,commandName:"verticalAlign",value:"top",selected:!1},{icon:"align-middle",svgIcon:c.alignMiddleIcon,textKey:he.alignMiddle,commandName:"verticalAlign",value:"center",selected:!1},{icon:"align-bottom",svgIcon:c.alignBottomIcon,textKey:he.alignBottom,commandName:"verticalAlign",value:"bottom",selected:!1}],Ve=[qe[0],{...qe[1],textKey:he.center},qe[2],{...qe[3],textKey:he.justify}],Je=qe.filter((e=>"verticalAlign"===e.commandName)),_e=e=>{const{value:t,spreadsheetRef:n}=e,{textAlign:o,verticalAlign:r}=t||{},l=d.useLocalization(),i=h.useCallback((e=>{if(n.current){const t=e.item,a={command:"PropertyChangeCommand",options:{property:t.commandName,value:t.value||null}};n.current.executeCommand(a)}}),[]);let u=qe.slice();return u=u.map((e=>({...e,text:l.toLanguageString(e.textKey,ve[e.textKey])}))),o&&(u=u.map((e=>"textAlign"===e.commandName?{...e,selected:e.value===o}:e))),r&&(u=u.map((e=>"verticalAlign"===e.commandName?{...e,selected:e.value===r}:e))),h.createElement(a.DropDownButton,{icon:"align-left",svgIcon:c.alignLeftIcon,items:u,fillMode:"flat",onItemClick:i,title:l.toLanguageString(he.align,ve[he.align]),text:h.createElement(s.IconWrap,{name:"caret-alt-down",icon:c.caretAltDownIcon})})};_e.displayName="Alignment";const Ge={items:Ve,icon:{icon:"align-left",svgIcon:c.alignLeftIcon},displayName:"AlignHorizontally",titleKey:he.alignHorizontally},$e={items:Je,icon:{icon:"align-bottom",svgIcon:c.alignBottomIcon},displayName:"AlignVertically",titleKey:he.alignVertically},Xe=e=>{const t=t=>{const{value:n,spreadsheetRef:o}=t,r=d.useLocalization(),l=h.useCallback((e=>{if(o.current){const t=e.item,n={command:"PropertyChangeCommand",options:{property:t.commandName,value:t.value||null}};o.current.executeCommand(n)}}),[]);let i=e.items.slice();i=i.map((e=>({...e,text:r.toLanguageString(e.textKey,ve[e.textKey])}))),i=i.map((e=>({...e,selected:e.value===n})));const u={...e.icon},m=i.find((e=>e.selected));return m&&(u.icon=m.icon,u.svgIcon=m.svgIcon),h.createElement(a.DropDownButton,{...u,items:i,fillMode:"flat",onItemClick:l,title:r.toLanguageString(e.titleKey,ve[e.titleKey]),text:h.createElement(s.IconWrap,{name:"caret-alt-down",icon:c.caretAltDownIcon})})};return t.displayName=e.displayName,t},Qe=Xe(Ge),Ye=Xe($e),Ze=e=>{const{value:t,spreadsheetRef:n}=e,o=h.useCallback((()=>{if(n.current){const e=n.current.activeSheet();if(e){const t={command:"TextWrapCommand",options:{property:"wrap",value:!e.range(e.activeCell()).wrap()}};n.current.executeCommand(t)}}}),[]);return h.createElement(a.Button,{type:"button",togglable:!0,icon:"text-wrap",svgIcon:c.textWrapIcon,fillMode:"flat",title:d.useLocalization().toLanguageString(he.textWrap,ve[he.textWrap]),onClick:o,selected:t})};Ze.displayName="TextWrap";const et=e=>{const{value:t,spreadsheetRef:n}=e,o=h.useCallback((()=>{if(n.current){const e=n.current.activeSheet();if(e){const t={command:"GridLinesChangeCommand",options:{property:"gridLines",value:!e.showGridLines()}};n.current.executeCommand(t)}}}),[]);return h.createElement(a.Button,{type:"button",togglable:!0,icon:"borders-none",svgIcon:c.bordersNoneIcon,fillMode:"flat",title:d.useLocalization().toLanguageString(he.gridLines,ve[he.gridLines]),onClick:o,selected:t})};et.displayName="GridLines";const tt=e=>{const{spreadsheetRef:t}=e,n=h.useCallback((e=>{const n=e.item.value||null;setTimeout((()=>{if(t.current){const e={command:"PropertyChangeCommand",options:{property:"format",value:n}};t.current.executeCommand(e)}}),0)}),[]);return h.createElement(a.DropDownButton,{icon:"custom-format",svgIcon:c.customFormatIcon,fillMode:"flat",onItemClick:n,items:Ae,title:d.useLocalization().toLanguageString(he.format,ve[he.format]),text:h.createElement(s.IconWrap,{name:"caret-alt-down"})})};tt.displayName="Format";const nt=e=>t=>{const{spreadsheetRef:n,value:o}=t,r=h.useCallback((()=>{if(n.current){const t={command:e.command,options:{value:e.value}};n.current.executeCommand(t)}}),[]);return h.createElement(a.Button,{type:"button",icon:e.icon,svgIcon:e.svgIcon,fillMode:"flat",title:d.useLocalization().toLanguageString(e.titleKey,ve[e.titleKey]),onClick:r,disabled:o&&e.disabled(o)})},at={command:"AddColumnCommand",value:"left",icon:"table-column-insert-left",svgIcon:c.tableColumnInsertLeftIcon,titleKey:he.addColumnLeft,disabled:e=>e.allCols,displayName:"AddColumnLeft"},ot={command:"AddColumnCommand",value:"right",icon:"table-column-insert-right",svgIcon:c.tableColumnInsertRightIcon,titleKey:he.addColumnRight,disabled:e=>e.allCols,displayName:"AddColumnRight"},rt={command:"AddRowCommand",value:"below",icon:"table-row-insert-below",svgIcon:c.tableRowInsertBelowIcon,titleKey:he.addRowBelow,disabled:e=>e.allRows,displayName:"AddRowBelow"},lt={command:"AddRowCommand",value:"above",icon:"table-row-insert-above",svgIcon:c.tableRowInsertAboveIcon,titleKey:he.addRowAbove,disabled:e=>e.allRows,displayName:"AddRowAbove"},st={command:"DeleteColumnCommand",icon:"table-column-delete",svgIcon:c.tableColumnDeleteIcon,titleKey:he.deleteColumn,disabled:e=>e.allCols,displayName:"DeleteColumn"},ct={command:"DeleteRowCommand",icon:"table-row-delete",svgIcon:c.tableRowDeleteIcon,titleKey:he.deleteRow,disabled:e=>e.allRows,displayName:"DeleteRow"},it=nt(at),dt=nt(ot),ut=nt(rt),mt=nt(lt),pt=nt(st),gt=nt(ct);it.displayName="AddColumnLeft",dt.displayName="AddColumnRight",ut.displayName="AddRowBelow",mt.displayName="AddRowAbove",pt.displayName="DeleteColumn",gt.displayName="DeleteRow";const ft=Ke({action:"undo",icon:"reset",svgIcon:c.arrowRotateCcwIcon,titleKey:he.undo});ft.displayName="Undo";const bt=Ke({action:"redo",icon:"reload",svgIcon:c.arrowRotateCwIcon,titleKey:he.redo});bt.displayName="Redo";const vt=e=>t=>{const{icon:n,svgIcon:o,titleKey:r,value:l}=e,{spreadsheetRef:s}=t,c=h.useCallback((()=>{if(s.current){const e={command:"AdjustDecimalsCommand",options:{value:l}};s.current.executeCommand(e)}}),[]);return h.createElement(a.Button,{type:"button",icon:n,svgIcon:o,fillMode:"flat",onClick:c,title:d.useLocalization().toLanguageString(r,ve[r])})},ht=vt({icon:c.decimalIncreaseIcon.name,svgIcon:c.decimalIncreaseIcon,value:1,titleKey:he.increaseDecimal}),yt=vt({icon:c.decimalDecreaseIcon.name,svgIcon:c.decimalDecreaseIcon,value:-1,titleKey:he.decreaseDecimal}),kt=[{textKey:he.file,tools:[we,Se]},{textKey:he.home,selected:!0,tools:[[ft,bt],a.ToolbarSeparator,Pe,Oe,je,He,a.ToolbarSeparator,[Fe,Te,ze],We,a.ToolbarSeparator,Ue,a.ToolbarSeparator,Qe,Ye,Ze,a.ToolbarSeparator,et]},{textKey:he.insert,tools:[[it,dt,ut,mt],a.ToolbarSeparator,[pt,gt]]},{textKey:he.formatTab,tools:[tt,[yt,ht]]}],Ct={name:"@progress/kendo-react-spreadsheet",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1683639393,version:"",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"},xt=["bold","italic","underline","fontFamily","fontSize","color","background","textAlign","verticalAlign","wrap","gridLines"],Et={Bold:e=>e.bold,Italic:e=>e.italic,Underline:e=>e.underline,FontFamily:e=>e.fontFamily,FontSize:e=>e.fontSize,IncreaseFontSize:e=>e.fontSize,DecreaseFontSize:e=>e.fontSize,TextColor:e=>e.color,BackgroundColor:e=>e.background,Alignment:e=>({textAlign:e.textAlign,verticalAlign:e.verticalAlign}),AlignHorizontally:e=>e.textAlign,AlignVertically:e=>e.verticalAlign,TextWrap:e=>e.wrap,GridLines:e=>e.gridLines,AddColumnLeft:e=>e.selectedHeaders,AddColumnRight:e=>e.selectedHeaders,AddRowBelow:e=>e.selectedHeaders,AddRowAbove:e=>e.selectedHeaders,DeleteColumn:e=>e.selectedHeaders,DeleteRow:e=>e.selectedHeaders},It=":not(.k-dropdownlist button):not(.k-combobox button):not(.k-upload-button):not(.k-colorpicker button):not(.k-split-button .k-split-button-arrow)",St=["button"+It,".k-button-group > button"+It,".k-dropdownlist",".k-combobox",".k-colorpicker"],wt=h.forwardRef(((e,t)=>{s.validatePackage(Ct);const n=s.shouldShowValidationUI(Ct),{toolbar:l=kt}=e,i=[];"boolean"==typeof l?i.push(...l?kt:[]):i.push(...l);const[u,f]=h.useState(null),[b,v]=h.useState(i.findIndex((e=>e.selected))||0),[y,C]=h.useState(!1),x=h.useRef(null),E=h.useRef(null),I=h.useRef(null),S=h.useRef(null),w=h.useRef(null),[R,N]=h.useState({}),A=h.useRef({});A.current=R;const L=h.useRef({});L.current=e;const D=d.useLocalization(),K=h.useCallback((e=>{L.current.onSelect&&L.current.onSelect.call(void 0,e)}),[]),F=h.useCallback((e=>{L.current.onChange&&L.current.onChange.call(void 0,e)}),[]),T=h.useCallback((e=>{L.current.onChangeFormat&&L.current.onChangeFormat.call(void 0,e)}),[]),z=h.useCallback((e=>{L.current.onExcelImport&&L.current.onExcelImport.call(void 0,e)}),[]),P=h.useCallback((e=>{L.current.onExcelExport&&L.current.onExcelExport.call(void 0,e)}),[]),B=h.useRef(null);h.useImperativeHandle(B,(()=>({element:x.current,get instance(){return w.current},props:e,get view(){return w.current.view},get workbook(){return w.current.workbook},executeCommand(e){var t;null==(t=w.current)||t.executeCommand(e)},fromJSON(e){var t;return null==(t=w.current)?void 0:t.fromJSON(e)},toJSON:()=>w.current.toJSON(),saveJSON:()=>w.current.saveJSON(),fromFile:e=>w.current.fromFile(e),saveAsExcel(e){var t;null==(t=w.current)||t.saveAsExcel({...w.current.options.excel,saveAs:p.saveAs,Workbook:g.Workbook,...e})},activeSheet(e){var t;return null==(t=w.current)?void 0:t.activeSheet(e)},sheets:()=>w.current.sheets(),refresh(){var e;return null==(e=w.current)?void 0:e.refresh()}})),[e]),h.useImperativeHandle(t,(()=>B.current));const O=h.useCallback((()=>w.current&&w.current.view.nameEditor),[]),M=h.useCallback((e=>{const t={};xt.forEach((n=>{"function"==typeof e.range[n]?t[n]=e.range[n]():"gridLines"===n&&(t[n]=e.range.sheet().showGridLines())})),t.selectedHeaders=e.range.sheet().selectedHeaders(),(xt.some((e=>t[e]!==A.current[e]))||t.selectedHeaders.allCols!==A.current.selectedHeaders.allCols||t.selectedHeaders.allRows!==A.current.selectedHeaders.allRows)&&N(t)}),[]),j=h.useCallback((e=>{const t=e.name,n=he[t];f({title:"Error"===e.title?D.toLanguageString(he.error,ve[he.error]):e.title,message:n?D.toLanguageString(n,ve[n]||e.text):e.text,close:e.close})}),[]),H=h.useCallback((()=>{f(null),null==u||u.close()}),[u]),W=d.useInternationalization(),U=d.useLocalization();h.useEffect((()=>{var t;const n={...e.defaultProps,sheets:structuredClone(null==(t=e.defaultProps)?void 0:t.sheets),messages:{workbook:{defaultSheetName:U.toLanguageString(he.defaultSheetName,ve[he.defaultSheetName])}},intl:{localeInfo:()=>W.localeInfo(),localeCurrency:()=>W.localeCurrency(),parseDate:(e,t)=>W.parseDate(e,t),toString:(e,t)=>W.toString(e,t),format:(e,...t)=>W.format(e,...t)},formulaBarInputRef:E,formulaCellInputRef:I,nameBoxRef:S},a=new m.SpreadsheetWidget(x.current,n);w.current=a,a.bind("select",K),a.bind("change",F),a.bind("changeFormat",T),a.bind("excelImport",z),a.bind("excelExport",P),a.view.bind("update",M),a.view.bind("message",j);const o=a.activeSheet();return o&&M({range:o.range(o.activeCell())}),C(!0),()=>{a.destroy()}}),[]);const q=h.useCallback(((e,t)=>{const n=h.createElement(e,{spreadsheetRef:w,value:Et[e.displayName]?Et[e.displayName](R):void 0,key:t});return n.type===a.ToolbarSeparator?h.createElement(e,{key:t}):n}),[R]);let V=null;return i.length&&(V=h.createElement(o.TabStrip,{selected:b,animation:!1,className:"k-floatwrap k-spreadsheet-tabstrip",style:{minHeight:"auto"},onSelect:e=>v(e.selected)},i.map((e=>{const t=e.textKey?U.toLanguageString(e.textKey,ve[e.textKey]):e.text;return h.createElement(o.TabStripTab,{key:e.textKey||e.text,title:t},h.createElement(a.Toolbar,{buttons:St,className:"k-spreadsheet-toolbar"},e.tools.map(((e,t)=>Array.isArray(e)?h.createElement(a.ButtonGroup,{key:t},e.map(((e,t)=>q(e,t)))):q(e,t)))))})))),h.createElement("div",{ref:x,style:e.style,className:s.classNames("k-widget k-spreadsheet",e.className),role:"application"},V,h.createElement("div",{className:"k-spreadsheet-action-bar"},h.createElement(ye,{ref:S,nameEditor:O}),h.createElement("div",{className:"k-spreadsheet-formula-bar"},h.createElement(s.IconWrap,{name:"formula-fx",icon:c.formulaFxIcon}),h.createElement(k,{ref:E}))),h.createElement("div",{className:"k-spreadsheet-view"},h.createElement("div",{className:"k-spreadsheet-fixed-container"}),h.createElement("div",{className:"k-spreadsheet-scroller"},h.createElement("div",{className:"k-spreadsheet-view-size"})),h.createElement("div",{tabIndex:0,className:"k-spreadsheet-clipboard",contentEditable:"true"}),h.createElement(k,{ref:I,className:"k-spreadsheet-cell-editor"})),h.createElement(Ie,{spreadsheetRef:w}),u&&h.createElement(r.Dialog,{title:u.title,onClose:H},h.createElement("div",null,u.message),h.createElement(r.DialogActionsBar,{layout:"start"},h.createElement(a.Button,{themeColor:"primary",onClick:H,autoFocus:!0},D.toLanguageString(he.ok,ve[he.ok])))),n&&h.createElement(s.WatermarkOverlay,null))}));wt.displayName="KendoReactSpreadsheet",wt.propTypes={className:n.string,defaultProps:n.any,toolbar:n.oneOfType([n.bool,n.arrayOf(n.any)]),style:n.object,onSelect:n.func,onChange:n.func,onChangeFormat:n.func,onExcelImport:n.func,onExcelExport:n.func};Object.defineProperty(e,"CalcError",{enumerable:!0,get:function(){return m.CalcError}}),Object.defineProperty(e,"CellRef",{enumerable:!0,get:function(){return m.CellRef}}),Object.defineProperty(e,"Context",{enumerable:!0,get:function(){return m.Context}}),Object.defineProperty(e,"Matrix",{enumerable:!0,get:function(){return m.Matrix}}),Object.defineProperty(e,"NULLREF",{enumerable:!0,get:function(){return m.NULLREF}}),Object.defineProperty(e,"NameRef",{enumerable:!0,get:function(){return m.NameRef}}),Object.defineProperty(e,"Range",{enumerable:!0,get:function(){return m.Range}}),Object.defineProperty(e,"RangeRef",{enumerable:!0,get:function(){return m.RangeRef}}),Object.defineProperty(e,"Ref",{enumerable:!0,get:function(){return m.Ref}}),Object.defineProperty(e,"Sheet",{enumerable:!0,get:function(){return m.Sheet}}),Object.defineProperty(e,"SpreadsheetWidget",{enumerable:!0,get:function(){return m.SpreadsheetWidget}}),Object.defineProperty(e,"UnionRef",{enumerable:!0,get:function(){return m.UnionRef}}),Object.defineProperty(e,"View",{enumerable:!0,get:function(){return m.View}}),Object.defineProperty(e,"Workbook",{enumerable:!0,get:function(){return m.Workbook}}),Object.defineProperty(e,"dateToSerial",{enumerable:!0,get:function(){return m.dateToSerial}}),Object.defineProperty(e,"defineAlias",{enumerable:!0,get:function(){return m.defineAlias}}),Object.defineProperty(e,"defineFunction",{enumerable:!0,get:function(){return m.defineFunction}}),Object.defineProperty(e,"packDate",{enumerable:!0,get:function(){return m.packDate}}),Object.defineProperty(e,"packTime",{enumerable:!0,get:function(){return m.packTime}}),Object.defineProperty(e,"serialToDate",{enumerable:!0,get:function(){return m.serialToDate}}),Object.defineProperty(e,"unpackDate",{enumerable:!0,get:function(){return m.unpackDate}}),Object.defineProperty(e,"unpackTime",{enumerable:!0,get:function(){return m.unpackTime}}),e.AddColumnLeft=it,e.AddColumnRight=dt,e.AddRowAbove=mt,e.AddRowBelow=ut,e.AlignHorizontally=Qe,e.AlignVertically=Ye,e.Alignment=_e,e.BackgroundColor=Ue,e.Bold=Fe,e.CleanFormatting=e=>{const{spreadsheetRef:t}=e,n=h.useCallback((()=>{t.current&&t.current.executeCommand({command:"PropertyCleanCommand"})}),[]);return h.createElement(a.Button,{type:"button",icon:"clean-css",svgIcon:c.clearCssIcon,fillMode:"flat",onClick:n,title:d.useLocalization().toLanguageString(he.cleanFormatting,ve[he.cleanFormatting])})},e.DecreaseFontSize=He,e.DeleteColumn=pt,e.DeleteRow=gt,e.ExcelExport=Se,e.FontFamily=Pe,e.FontSize=Oe,e.Format=tt,e.GridLines=et,e.IncreaseFontSize=je,e.Italic=Te,e.Open=we,e.Redo=bt,e.Spreadsheet=wt,e.TextColor=We,e.TextWrap=Ze,e.Underline=ze,e.Undo=ft,e.defaultTabs=kt}));