@progress/kendo-react-spreadsheet 8.2.0-develop.4 → 8.2.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FormulaInput.js +1 -1
- package/FormulaInput.mjs +32 -28
- package/NameBox.js +1 -1
- package/NameBox.mjs +36 -35
- package/dist/cdn/js/kendo-react-spreadsheet.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
- package/tools/fontSize.js +1 -1
- package/tools/fontSize.mjs +24 -23
- package/tools/utils.js +1 -1
- package/tools/utils.mjs +3 -2
package/FormulaInput.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),S=require("@progress/kendo-react-popup"),w=require("./List.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),S=require("@progress/kendo-react-popup"),w=require("./List.js"),x=require("@progress/kendo-react-common");function I(c){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const o in c)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(c,o);Object.defineProperty(u,o,l.get?l:{enumerable:!0,get:()=>c[o]})}}return u.default=c,Object.freeze(u)}const t=I(R),f=t.forwardRef((c,u)=>{const[o,l]=t.useState(!1),[d,g]=t.useState(0),[h,P]=t.useState([]),s=t.useMemo(()=>({}),[]);s.showPopup=o,s.popupContentKey=d,s.data=h;const k=t.useRef(null),i=t.useRef(null),n=t.useRef(null),m=t.useCallback(()=>{if(n.current&&n.current.element)return n.current.element.querySelector(".k-focus")},[]),b=t.useCallback(()=>{const e=m();e&&e.classList.remove("k-focus")},[]),y=t.useCallback(e=>{const r=Array.from(n.current&&n.current.element.children||[]),p=m();let a;if(p){const C=r.indexOf(p);p.classList.remove("k-focus"),a=r[C+e]?r[C+e]:e===1?r[0]:r[r.length-1]}else a=e===1?r[0]:r[r.length-1];a&&a.classList.add("k-focus")},[]);t.useImperativeHandle(k,()=>({element:i.current,props:c,popup:{open:()=>{l(!0)},close:()=>{l(!1)},position:()=>{g(s.popupContentKey+1)},visible:()=>s.showPopup},list:{get element(){return n.current&&n.current.element},data:e=>{if(e)P(e);else return s.data},value:()=>({}),focus:()=>Array.from(n.current&&n.current.element&&n.current.element.children||[]).indexOf(m()),focusNext:()=>{y(1)},focusPrev:()=>{y(-1)},focusFirst:()=>{const e=n.current&&n.current.element;e&&e.children.item(0)&&(b(),e.children.item(0).classList.add("k-focus"))},focusLast:()=>{const e=n.current&&n.current.element;e&&e.children.length&&(b(),e.children.item(e.children.length-1).classList.add("k-focus"))},itemClick:e=>{s.itemClick=e}}}),[]),t.useImperativeHandle(u,()=>k.current,[]);const v=t.useCallback(e=>{s.itemClick&&s.itemClick(e)},[]);return t.createElement(t.Fragment,null,t.createElement("div",{className:x.classNames("k-spreadsheet-formula-input",c.className),contentEditable:"true",spellCheck:"false",style:{whiteSpace:"pre"},ref:i,"aria-haspopup":"menu",title:"Formula Input","aria-expanded":o,role:"combobox"}),t.createElement(S.Popup,{show:o,anchor:i.current,animate:{openDuration:100,closeDuration:100},contentKey:d,popupClass:"k-list-container"},t.createElement(w.List,{data:h,ref:n,onItemClick:v})))});f.displayName="FormulaInput";f.propTypes={};exports.FormulaInput=f;
|
package/FormulaInput.mjs
CHANGED
|
@@ -7,31 +7,31 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import { Popup as
|
|
11
|
-
import { List as
|
|
12
|
-
import { classNames as
|
|
13
|
-
const y = t.forwardRef((
|
|
14
|
-
const [
|
|
15
|
-
s.showPopup =
|
|
16
|
-
const d = t.useRef(null),
|
|
10
|
+
import { Popup as w } from "@progress/kendo-react-popup";
|
|
11
|
+
import { List as I } from "./List.mjs";
|
|
12
|
+
import { classNames as L } from "@progress/kendo-react-common";
|
|
13
|
+
const y = t.forwardRef((i, x) => {
|
|
14
|
+
const [c, m] = t.useState(!1), [p, b] = t.useState(0), [f, v] = t.useState([]), s = t.useMemo(() => ({}), []);
|
|
15
|
+
s.showPopup = c, s.popupContentKey = p, s.data = f;
|
|
16
|
+
const d = t.useRef(null), l = t.useRef(null), n = t.useRef(null), u = t.useCallback(() => {
|
|
17
17
|
if (n.current && n.current.element)
|
|
18
18
|
return n.current.element.querySelector(".k-focus");
|
|
19
19
|
}, []), h = t.useCallback(() => {
|
|
20
|
-
const e =
|
|
20
|
+
const e = u();
|
|
21
21
|
e && e.classList.remove("k-focus");
|
|
22
22
|
}, []), k = t.useCallback((e) => {
|
|
23
|
-
const r = Array.from(n.current && n.current.element.children || []),
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
const C = r.indexOf(
|
|
27
|
-
|
|
23
|
+
const r = Array.from(n.current && n.current.element.children || []), a = u();
|
|
24
|
+
let o;
|
|
25
|
+
if (a) {
|
|
26
|
+
const C = r.indexOf(a);
|
|
27
|
+
a.classList.remove("k-focus"), o = r[C + e] ? r[C + e] : e === 1 ? r[0] : r[r.length - 1];
|
|
28
28
|
} else
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
o = e === 1 ? r[0] : r[r.length - 1];
|
|
30
|
+
o && o.classList.add("k-focus");
|
|
31
31
|
}, []);
|
|
32
32
|
t.useImperativeHandle(d, () => ({
|
|
33
|
-
element:
|
|
34
|
-
props:
|
|
33
|
+
element: l.current,
|
|
34
|
+
props: i,
|
|
35
35
|
popup: {
|
|
36
36
|
open: () => {
|
|
37
37
|
m(!0);
|
|
@@ -40,7 +40,7 @@ const y = t.forwardRef((a, v) => {
|
|
|
40
40
|
m(!1);
|
|
41
41
|
},
|
|
42
42
|
position: () => {
|
|
43
|
-
|
|
43
|
+
b(s.popupContentKey + 1);
|
|
44
44
|
},
|
|
45
45
|
visible: () => s.showPopup
|
|
46
46
|
},
|
|
@@ -50,12 +50,12 @@ const y = t.forwardRef((a, v) => {
|
|
|
50
50
|
},
|
|
51
51
|
data: (e) => {
|
|
52
52
|
if (e)
|
|
53
|
-
|
|
53
|
+
v(e);
|
|
54
54
|
else
|
|
55
55
|
return s.data;
|
|
56
56
|
},
|
|
57
57
|
value: () => ({}),
|
|
58
|
-
focus: () => Array.from(n.current && n.current.element && n.current.element.children || []).indexOf(
|
|
58
|
+
focus: () => Array.from(n.current && n.current.element && n.current.element.children || []).indexOf(u()),
|
|
59
59
|
// select: (x) => {
|
|
60
60
|
// console.log('select', x);
|
|
61
61
|
// },
|
|
@@ -77,29 +77,33 @@ const y = t.forwardRef((a, v) => {
|
|
|
77
77
|
s.itemClick = e;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
}), []), t.useImperativeHandle(
|
|
81
|
-
const
|
|
80
|
+
}), []), t.useImperativeHandle(x, () => d.current, []);
|
|
81
|
+
const g = t.useCallback((e) => {
|
|
82
82
|
s.itemClick && s.itemClick(e);
|
|
83
83
|
}, []);
|
|
84
84
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
85
85
|
"div",
|
|
86
86
|
{
|
|
87
|
-
className:
|
|
87
|
+
className: L("k-spreadsheet-formula-input", i.className),
|
|
88
88
|
contentEditable: "true",
|
|
89
89
|
spellCheck: "false",
|
|
90
90
|
style: { whiteSpace: "pre" },
|
|
91
|
-
ref:
|
|
91
|
+
ref: l,
|
|
92
|
+
"aria-haspopup": "menu",
|
|
93
|
+
title: "Formula Input",
|
|
94
|
+
"aria-expanded": c,
|
|
95
|
+
role: "combobox"
|
|
92
96
|
}
|
|
93
97
|
), /* @__PURE__ */ t.createElement(
|
|
94
|
-
|
|
98
|
+
w,
|
|
95
99
|
{
|
|
96
|
-
show:
|
|
97
|
-
anchor:
|
|
100
|
+
show: c,
|
|
101
|
+
anchor: l.current,
|
|
98
102
|
animate: { openDuration: 100, closeDuration: 100 },
|
|
99
103
|
contentKey: p,
|
|
100
104
|
popupClass: "k-list-container"
|
|
101
105
|
},
|
|
102
|
-
/* @__PURE__ */ t.createElement(
|
|
106
|
+
/* @__PURE__ */ t.createElement(I, { data: f, ref: n, onItemClick: g })
|
|
103
107
|
));
|
|
104
108
|
});
|
|
105
109
|
y.displayName = "FormulaInput";
|
package/NameBox.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),I=require("@progress/kendo-react-dropdowns"),O=require("@progress/kendo-react-common"),w=require("@progress/kendo-svg-icons"),B=require("@progress/kendo-react-intl"),f=require("./messages.js");function q(a){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const r in a)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(a,r);Object.defineProperty(l,r,s.get?s:{enumerable:!0,get:()=>a[r]})}}return l.default=a,Object.freeze(l)}const t=q(N),p=t.forwardRef((a,l)=>{const r=t.useRef(null),s=t.useRef(null),[i,k]=t.useState([]),[v,g]=t.useState(!1),[c,u]=t.useState(""),m=t.useMemo(()=>({}),[]);m.data=i,t.useImperativeHandle(r,()=>({value:e=>{if(e===void 0){const n=s.current&&s.current.value;return n&&(n.name||n)}else u(e||"")}}),[]),t.useImperativeHandle(l,()=>r.current,[]);const y=t.useCallback(e=>{const n=a.nameEditor();n&&n.trigger("delete",{name:e})},[]),E=t.useCallback((e,n)=>{const o=t.createElement(t.Fragment,null,e.props.children,t.createElement("span",{role:"button",className:"k-button-delete",onClick:()=>y(n.dataItem[n.textField]),onMouseDown:d=>d.preventDefault(),onPointerDown:d=>d.preventDefault(),"data-role":"delete"},t.createElement(O.IconWrap,{name:"x",icon:w.xIcon})));return t.cloneElement(e,e.props,o)},[]),C=t.useCallback(e=>t.cloneElement(e,{...e.props},t.createElement("div",null)),[]),D=t.useCallback(e=>{if(e.syntheticEvent&&e.syntheticEvent.type==="change")return;const n=a.nameEditor();n&&(k(n.readData()),g(!0))},[]),x=t.useCallback(()=>{g(!1)},[]),R=t.useCallback(e=>{if(e.syntheticEvent.target.closest("[data-role]"))return;const n=a.nameEditor();if(n&&e.value){const o=e.value.name;o!==c&&(n.trigger("select",{name:o}),u(o))}},[c]),S=t.useCallback(e=>{const n=a.nameEditor();if(n)if(e.key==="Enter"){const o=e.target.value;n.trigger("enter",{value:o}),u(o)}else e.key==="Escape"&&(n.trigger("cancel"),u(m.prevValue))},[]),h=t.useCallback(e=>{m.prevValue=e.value.name},[]),b=B.useLocalization().toLanguageString(f.keys.nameBox,f.messages[f.keys.nameBox]);return t.createElement("div",{className:"k-spreadsheet-name-editor",onKeyDown:S},t.createElement(I.ComboBox,{ref:s,title:b,popupSettings:{className:"k-spreadsheet-names-popup"},fillMode:"flat",clearButton:!1,dataItemKey:"name",textField:"name",itemRender:E,data:i,value:c?i.find(e=>e.name===c)||{name:c}:null,onChange:R,opened:v,onOpen:D,onClose:x,onFocus:h,listNoDataRender:C,allowCustom:!0,ariaLabel:b}))});p.displayName="NameBox";p.propTypes={};exports.NameBox=p;
|
package/NameBox.mjs
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
|
-
import { ComboBox as
|
|
11
|
-
import { IconWrap as
|
|
12
|
-
import { xIcon as
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { keys as
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
m.data = c, t.useImperativeHandle(
|
|
10
|
+
import { ComboBox as B } from "@progress/kendo-react-dropdowns";
|
|
11
|
+
import { IconWrap as I } from "@progress/kendo-react-common";
|
|
12
|
+
import { xIcon as w } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { useLocalization as S } from "@progress/kendo-react-intl";
|
|
14
|
+
import { keys as f, messages as F } from "./messages.mjs";
|
|
15
|
+
const g = t.forwardRef((l, E) => {
|
|
16
|
+
const u = t.useRef(null), s = t.useRef(null), [c, k] = t.useState([]), [v, d] = t.useState(!1), [o, r] = t.useState(""), m = t.useMemo(() => ({}), []);
|
|
17
|
+
m.data = c, t.useImperativeHandle(u, () => ({
|
|
18
18
|
value: (e) => {
|
|
19
19
|
if (e === void 0) {
|
|
20
20
|
const a = s.current && s.current.value;
|
|
@@ -22,8 +22,8 @@ const f = t.forwardRef((l, g) => {
|
|
|
22
22
|
} else
|
|
23
23
|
r(e || "");
|
|
24
24
|
}
|
|
25
|
-
}), []), t.useImperativeHandle(
|
|
26
|
-
const
|
|
25
|
+
}), []), t.useImperativeHandle(E, () => u.current, []);
|
|
26
|
+
const b = t.useCallback((e) => {
|
|
27
27
|
const a = l.nameEditor();
|
|
28
28
|
a && a.trigger("delete", { name: e });
|
|
29
29
|
}, []), C = t.useCallback((e, a) => {
|
|
@@ -32,28 +32,28 @@ const f = t.forwardRef((l, g) => {
|
|
|
32
32
|
{
|
|
33
33
|
role: "button",
|
|
34
34
|
className: "k-button-delete",
|
|
35
|
-
onClick: () =>
|
|
36
|
-
onMouseDown: (
|
|
37
|
-
onPointerDown: (
|
|
35
|
+
onClick: () => b(a.dataItem[a.textField]),
|
|
36
|
+
onMouseDown: (i) => i.preventDefault(),
|
|
37
|
+
onPointerDown: (i) => i.preventDefault(),
|
|
38
38
|
"data-role": "delete"
|
|
39
39
|
},
|
|
40
40
|
/* @__PURE__ */ t.createElement(
|
|
41
|
-
|
|
41
|
+
I,
|
|
42
42
|
{
|
|
43
43
|
name: "x",
|
|
44
|
-
icon:
|
|
44
|
+
icon: w
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
47
|
));
|
|
48
48
|
return t.cloneElement(e, e.props, n);
|
|
49
|
-
}, []),
|
|
49
|
+
}, []), x = t.useCallback((e) => t.cloneElement(e, { ...e.props }, /* @__PURE__ */ t.createElement("div", null)), []), y = t.useCallback((e) => {
|
|
50
50
|
if (e.syntheticEvent && e.syntheticEvent.type === "change")
|
|
51
51
|
return;
|
|
52
52
|
const a = l.nameEditor();
|
|
53
|
-
a && (
|
|
54
|
-
}, []),
|
|
53
|
+
a && (k(a.readData()), d(!0));
|
|
54
|
+
}, []), h = t.useCallback(() => {
|
|
55
55
|
d(!1);
|
|
56
|
-
}, []),
|
|
56
|
+
}, []), D = t.useCallback((e) => {
|
|
57
57
|
if (e.syntheticEvent.target.closest("[data-role]"))
|
|
58
58
|
return;
|
|
59
59
|
const a = l.nameEditor();
|
|
@@ -61,7 +61,7 @@ const f = t.forwardRef((l, g) => {
|
|
|
61
61
|
const n = e.value.name;
|
|
62
62
|
n !== o && (a.trigger("select", { name: n }), r(n));
|
|
63
63
|
}
|
|
64
|
-
}, [o]),
|
|
64
|
+
}, [o]), N = t.useCallback((e) => {
|
|
65
65
|
const a = l.nameEditor();
|
|
66
66
|
if (a)
|
|
67
67
|
if (e.key === "Enter") {
|
|
@@ -69,20 +69,20 @@ const f = t.forwardRef((l, g) => {
|
|
|
69
69
|
a.trigger("enter", { value: n }), r(n);
|
|
70
70
|
} else
|
|
71
71
|
e.key === "Escape" && (a.trigger("cancel"), r(m.prevValue));
|
|
72
|
-
}, []),
|
|
72
|
+
}, []), R = t.useCallback((e) => {
|
|
73
73
|
m.prevValue = e.value.name;
|
|
74
|
-
}, []);
|
|
74
|
+
}, []), p = S().toLanguageString(f.nameBox, F[f.nameBox]);
|
|
75
75
|
return /* @__PURE__ */ t.createElement(
|
|
76
76
|
"div",
|
|
77
77
|
{
|
|
78
78
|
className: "k-spreadsheet-name-editor",
|
|
79
|
-
onKeyDown:
|
|
79
|
+
onKeyDown: N
|
|
80
80
|
},
|
|
81
81
|
/* @__PURE__ */ t.createElement(
|
|
82
|
-
|
|
82
|
+
B,
|
|
83
83
|
{
|
|
84
84
|
ref: s,
|
|
85
|
-
title:
|
|
85
|
+
title: p,
|
|
86
86
|
popupSettings: { className: "k-spreadsheet-names-popup" },
|
|
87
87
|
fillMode: "flat",
|
|
88
88
|
clearButton: !1,
|
|
@@ -91,19 +91,20 @@ const f = t.forwardRef((l, g) => {
|
|
|
91
91
|
itemRender: C,
|
|
92
92
|
data: c,
|
|
93
93
|
value: o ? c.find((e) => e.name === o) || { name: o } : null,
|
|
94
|
-
onChange:
|
|
95
|
-
opened:
|
|
96
|
-
onOpen:
|
|
97
|
-
onClose:
|
|
98
|
-
onFocus:
|
|
99
|
-
listNoDataRender:
|
|
100
|
-
allowCustom: !0
|
|
94
|
+
onChange: D,
|
|
95
|
+
opened: v,
|
|
96
|
+
onOpen: y,
|
|
97
|
+
onClose: h,
|
|
98
|
+
onFocus: R,
|
|
99
|
+
listNoDataRender: x,
|
|
100
|
+
allowCustom: !0,
|
|
101
|
+
ariaLabel: p
|
|
101
102
|
}
|
|
102
103
|
)
|
|
103
104
|
);
|
|
104
105
|
});
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
g.displayName = "NameBox";
|
|
107
|
+
g.propTypes = {};
|
|
107
108
|
export {
|
|
108
|
-
|
|
109
|
+
g as NameBox
|
|
109
110
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
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",N="spreadsheet.addRowAbove",R="spreadsheet.addRowBelow",A="spreadsheet.addColumnLeft",D="spreadsheet.addColumnRight",L="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",[N]:"Add row above",[R]:"Add row below",[A]:"Add column left",[D]:"Add column right",[L]:"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:N,addRowBelow:R,addColumnLeft:A,addColumnRight:D,deleteRow:L,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 Ne=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],Re=[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"}],De=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])})},Le=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=De({property:"bold",icon:"bold",svgIcon:c.boldIcon,titleKey:he.bold});Fe.displayName="Bold";const Te=De({property:"italic",icon:"italic",svgIcon:c.italicIcon,titleKey:he.italic});Te.displayName="Italic";const ze=De({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:Ne,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:Re,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=Le({icon:"foreground-color",svgIcon:c.foregroundColorIcon,view:"palette",property:"color",titleKey:he.textColor,ariaLabel:"Text Color"});We.displayName="TextColor";const Ue=Le({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});ht.displayName="IncreaseDecimal";const yt=vt({icon:c.decimalDecreaseIcon.name,svgIcon:c.decimalDecreaseIcon,value:-1,titleKey:he.decreaseDecimal});yt.displayName="DecreaseDecimal";const 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),[N,R]=h.useState({}),A=h.useRef({});A.current=N;const D=h.useRef({});D.current=e;const L=d.useLocalization(),K=h.useCallback((e=>{D.current.onSelect&&D.current.onSelect.call(void 0,e)}),[]),F=h.useCallback((e=>{D.current.onChange&&D.current.onChange.call(void 0,e)}),[]),T=h.useCallback((e=>{D.current.onChangeFormat&&D.current.onChangeFormat.call(void 0,e)}),[]),z=h.useCallback((e=>{D.current.onExcelImport&&D.current.onExcelImport.call(void 0,e)}),[]),P=h.useCallback((e=>{D.current.onExcelExport&&D.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)&&R(t)}),[]),j=h.useCallback((e=>{const t=e.name,n=he[t];f({title:"Error"===e.title?L.toLanguageString(he.error,ve[he.error]):e.title,message:n?L.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](N):void 0,key:t});return n.type===a.ToolbarSeparator?h.createElement(e,{key:t}):n}),[N]);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},L.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.DecreaseDecimal=yt,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.IncreaseDecimal=ht,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,e.toolsValueMap=Et}));
|
|
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,"aria-haspopup":"menu",title:"Formula Input","aria-expanded":n,role:"combobox"}),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",N="spreadsheet.addRowAbove",R="spreadsheet.addRowBelow",A="spreadsheet.addColumnLeft",D="spreadsheet.addColumnRight",L="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",[N]:"Add row above",[R]:"Add row below",[A]:"Add column left",[D]:"Add column right",[L]:"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:N,addRowBelow:R,addColumnLeft:A,addColumnRight:D,deleteRow:L,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}),[]),I=d.useLocalization().toLanguageString(he.nameBox,ve[he.nameBox]);return h.createElement("div",{className:"k-spreadsheet-name-editor",onKeyDown:x},h.createElement(i.ComboBox,{ref:a,title:I,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,ariaLabel:I}))}));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 Ne=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],Re=[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"}],De=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])})},Le=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,togglable:!0})},Fe=De({property:"bold",icon:"bold",svgIcon:c.boldIcon,titleKey:he.bold});Fe.displayName="Bold";const Te=De({property:"italic",icon:"italic",svgIcon:c.italicIcon,titleKey:he.italic});Te.displayName="Italic";const ze=De({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:Ne,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]),o=d.useLocalization().toLanguageString(he.fontSize,ve[he.fontSize]);return h.createElement(i.ComboBox,{onChange:a,value:n,data:Re,defaultValue:12,allowCustom:!0,fillMode:"flat",title:o,tabIndex:-1,clearButton:!1,ariaLabel:o})};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=Le({icon:"foreground-color",svgIcon:c.foregroundColorIcon,view:"palette",property:"color",titleKey:he.textColor,ariaLabel:"Text Color"});We.displayName="TextColor";const Ue=Le({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});ht.displayName="IncreaseDecimal";const yt=vt({icon:c.decimalDecreaseIcon.name,svgIcon:c.decimalDecreaseIcon,value:-1,titleKey:he.decreaseDecimal});yt.displayName="DecreaseDecimal";const 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),[N,R]=h.useState({}),A=h.useRef({});A.current=N;const D=h.useRef({});D.current=e;const L=d.useLocalization(),K=h.useCallback((e=>{D.current.onSelect&&D.current.onSelect.call(void 0,e)}),[]),F=h.useCallback((e=>{D.current.onChange&&D.current.onChange.call(void 0,e)}),[]),T=h.useCallback((e=>{D.current.onChangeFormat&&D.current.onChangeFormat.call(void 0,e)}),[]),z=h.useCallback((e=>{D.current.onExcelImport&&D.current.onExcelImport.call(void 0,e)}),[]),P=h.useCallback((e=>{D.current.onExcelExport&&D.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)&&R(t)}),[]),j=h.useCallback((e=>{const t=e.name,n=he[t];f({title:"Error"===e.title?L.toLanguageString(he.error,ve[he.error]):e.title,message:n?L.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](N):void 0,key:t});return n.type===a.ToolbarSeparator?h.createElement(e,{key:t}):n}),[N]);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},L.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.DecreaseDecimal=yt,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.IncreaseDecimal=ht,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,e.toolsValueMap=Et}));
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-spreadsheet",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1720427159,
|
|
14
14
|
version: "",
|
|
15
15
|
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"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-spreadsheet",
|
|
3
|
-
"version": "8.2.0-develop.
|
|
3
|
+
"version": "8.2.0-develop.5",
|
|
4
4
|
"description": "KendoReact Spreadsheet package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"@progress/kendo-file-saver": "^1.1.1",
|
|
30
30
|
"@progress/kendo-licensing": "^1.3.4",
|
|
31
31
|
"@progress/kendo-ooxml": "^1.7.0",
|
|
32
|
-
"@progress/kendo-react-buttons": "8.2.0-develop.
|
|
33
|
-
"@progress/kendo-react-common": "8.2.0-develop.
|
|
34
|
-
"@progress/kendo-react-dialogs": "8.2.0-develop.
|
|
35
|
-
"@progress/kendo-react-dropdowns": "8.2.0-develop.
|
|
36
|
-
"@progress/kendo-react-inputs": "8.2.0-develop.
|
|
37
|
-
"@progress/kendo-react-intl": "8.2.0-develop.
|
|
38
|
-
"@progress/kendo-react-layout": "8.2.0-develop.
|
|
39
|
-
"@progress/kendo-react-popup": "8.2.0-develop.
|
|
40
|
-
"@progress/kendo-react-sortable": "8.2.0-develop.
|
|
41
|
-
"@progress/kendo-react-upload": "8.2.0-develop.
|
|
32
|
+
"@progress/kendo-react-buttons": "8.2.0-develop.5",
|
|
33
|
+
"@progress/kendo-react-common": "8.2.0-develop.5",
|
|
34
|
+
"@progress/kendo-react-dialogs": "8.2.0-develop.5",
|
|
35
|
+
"@progress/kendo-react-dropdowns": "8.2.0-develop.5",
|
|
36
|
+
"@progress/kendo-react-inputs": "8.2.0-develop.5",
|
|
37
|
+
"@progress/kendo-react-intl": "8.2.0-develop.5",
|
|
38
|
+
"@progress/kendo-react-layout": "8.2.0-develop.5",
|
|
39
|
+
"@progress/kendo-react-popup": "8.2.0-develop.5",
|
|
40
|
+
"@progress/kendo-react-sortable": "8.2.0-develop.5",
|
|
41
|
+
"@progress/kendo-react-upload": "8.2.0-develop.5",
|
|
42
42
|
"@progress/kendo-spreadsheet-common": "v1.1.2",
|
|
43
43
|
"@progress/kendo-svg-icons": "^3.0.0",
|
|
44
44
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
package/tools/fontSize.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),v=require("@progress/kendo-react-dropdowns"),y=require("./utils.js"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),v=require("@progress/kendo-react-dropdowns"),y=require("./utils.js"),i=require("../messages.js"),g=require("@progress/kendo-react-intl"),h=require("@progress/kendo-react-buttons"),z=require("@progress/kendo-svg-icons");function N(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const m=N(I),d=1,f=409,p=e=>typeof e=="string"?parseFloat(e):e,b=e=>{const{spreadsheetRef:o}=e,t=p(e.value),s=m.useCallback(r=>{var u;let n=r.value?p(r.value):t;n=isNaN(n)?t:n,n=Math.min(f,Math.max(d,n));const c={command:"PropertyChangeCommand",options:{property:"fontSize",value:n}};r.nativeEvent.type==="keydown"||r.nativeEvent.type==="focusout"?(u=o.current)==null||u.executeCommand(c):setTimeout(()=>{var a;(a=o.current)==null||a.executeCommand(c)},0)},[t]),l=g.useLocalization().toLanguageString(i.keys.fontSize,i.messages[i.keys.fontSize]);return m.createElement(v.ComboBox,{onChange:s,value:t,data:y.FONT_SIZES,defaultValue:y.DEFAULT_FONT_SIZE,allowCustom:!0,fillMode:"flat",title:l,tabIndex:-1,clearButton:!1,ariaLabel:l})};b.displayName="FontSize";const k=e=>{const o=t=>{const{property:s,icon:l,svgIcon:r,titleKey:n,step:c}=e,{spreadsheetRef:u}=t,a=p(t.value),F=m.useCallback(()=>{var S;const C={command:"PropertyChangeCommand",options:{property:s,value:Math.min(f,Math.max(d,a+c))}};(S=u.current)==null||S.executeCommand(C)},[a]);return m.createElement(h.Button,{type:"button",icon:l,svgIcon:r,fillMode:"flat",onClick:F,disabled:a+c<d||a+c>f,title:g.useLocalization().toLanguageString(n,i.messages[n])})};return o.displayName=e.displayName,o},x=k({property:"fontSize",icon:"font-grow",svgIcon:z.fontGrowIcon,titleKey:i.keys.fontSizeIncrease,displayName:"IncreaseFontSize",step:1}),T=k({property:"fontSize",icon:"font-shrink",svgIcon:z.fontShrinkIcon,titleKey:i.keys.fontSizeDecrease,displayName:"DecreaseFontSize",step:-1});exports.DecreaseFontSize=T;exports.FontSize=b;exports.IncreaseFontSize=x;
|
package/tools/fontSize.mjs
CHANGED
|
@@ -6,28 +6,28 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as l from "react";
|
|
10
10
|
import { ComboBox as F } from "@progress/kendo-react-dropdowns";
|
|
11
11
|
import { FONT_SIZES as I, DEFAULT_FONT_SIZE as v } from "./utils.mjs";
|
|
12
|
-
import { keys as
|
|
12
|
+
import { keys as m, messages as y } from "../messages.mjs";
|
|
13
13
|
import { useLocalization as z } from "@progress/kendo-react-intl";
|
|
14
14
|
import { Button as x } from "@progress/kendo-react-buttons";
|
|
15
15
|
import { fontGrowIcon as N, fontShrinkIcon as b } from "@progress/kendo-svg-icons";
|
|
16
16
|
const p = 1, f = 409, d = (e) => typeof e == "string" ? parseFloat(e) : e, k = (e) => {
|
|
17
|
-
const { spreadsheetRef: r } = e, o = d(e.value), u =
|
|
18
|
-
var
|
|
19
|
-
let t =
|
|
17
|
+
const { spreadsheetRef: r } = e, o = d(e.value), u = l.useCallback((a) => {
|
|
18
|
+
var c;
|
|
19
|
+
let t = a.value ? d(a.value) : o;
|
|
20
20
|
t = isNaN(t) ? o : t, t = Math.min(f, Math.max(p, t));
|
|
21
21
|
const i = {
|
|
22
22
|
command: "PropertyChangeCommand",
|
|
23
23
|
options: { property: "fontSize", value: t }
|
|
24
24
|
};
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
(
|
|
25
|
+
a.nativeEvent.type === "keydown" || a.nativeEvent.type === "focusout" ? (c = r.current) == null || c.executeCommand(i) : setTimeout(() => {
|
|
26
|
+
var n;
|
|
27
|
+
(n = r.current) == null || n.executeCommand(i);
|
|
28
28
|
}, 0);
|
|
29
|
-
}, [o]);
|
|
30
|
-
return /* @__PURE__ */
|
|
29
|
+
}, [o]), s = z().toLanguageString(m.fontSize, y[m.fontSize]);
|
|
30
|
+
return /* @__PURE__ */ l.createElement(
|
|
31
31
|
F,
|
|
32
32
|
{
|
|
33
33
|
onChange: u,
|
|
@@ -36,33 +36,34 @@ const p = 1, f = 409, d = (e) => typeof e == "string" ? parseFloat(e) : e, k = (
|
|
|
36
36
|
defaultValue: v,
|
|
37
37
|
allowCustom: !0,
|
|
38
38
|
fillMode: "flat",
|
|
39
|
-
title:
|
|
39
|
+
title: s,
|
|
40
40
|
tabIndex: -1,
|
|
41
|
-
clearButton: !1
|
|
41
|
+
clearButton: !1,
|
|
42
|
+
ariaLabel: s
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
};
|
|
45
46
|
k.displayName = "FontSize";
|
|
46
47
|
const g = (e) => {
|
|
47
48
|
const r = (o) => {
|
|
48
|
-
const { property: u, icon:
|
|
49
|
+
const { property: u, icon: s, svgIcon: a, titleKey: t, step: i } = e, { spreadsheetRef: c } = o, n = d(o.value), C = l.useCallback(() => {
|
|
49
50
|
var S;
|
|
50
51
|
const h = {
|
|
51
52
|
command: "PropertyChangeCommand",
|
|
52
|
-
options: { property: u, value: Math.min(f, Math.max(p,
|
|
53
|
+
options: { property: u, value: Math.min(f, Math.max(p, n + i)) }
|
|
53
54
|
};
|
|
54
|
-
(S =
|
|
55
|
-
}, [
|
|
56
|
-
return /* @__PURE__ */
|
|
55
|
+
(S = c.current) == null || S.executeCommand(h);
|
|
56
|
+
}, [n]);
|
|
57
|
+
return /* @__PURE__ */ l.createElement(
|
|
57
58
|
x,
|
|
58
59
|
{
|
|
59
60
|
type: "button",
|
|
60
|
-
icon:
|
|
61
|
-
svgIcon:
|
|
61
|
+
icon: s,
|
|
62
|
+
svgIcon: a,
|
|
62
63
|
fillMode: "flat",
|
|
63
64
|
onClick: C,
|
|
64
|
-
disabled:
|
|
65
|
-
title: z().toLanguageString(
|
|
65
|
+
disabled: n + i < p || n + i > f,
|
|
66
|
+
title: z().toLanguageString(t, y[t])
|
|
66
67
|
}
|
|
67
68
|
);
|
|
68
69
|
};
|
|
@@ -71,14 +72,14 @@ const g = (e) => {
|
|
|
71
72
|
property: "fontSize",
|
|
72
73
|
icon: "font-grow",
|
|
73
74
|
svgIcon: N,
|
|
74
|
-
titleKey:
|
|
75
|
+
titleKey: m.fontSizeIncrease,
|
|
75
76
|
displayName: "IncreaseFontSize",
|
|
76
77
|
step: 1
|
|
77
78
|
}), K = g({
|
|
78
79
|
property: "fontSize",
|
|
79
80
|
icon: "font-shrink",
|
|
80
81
|
svgIcon: b,
|
|
81
|
-
titleKey:
|
|
82
|
+
titleKey: m.fontSizeDecrease,
|
|
82
83
|
displayName: "DecreaseFontSize",
|
|
83
84
|
step: -1
|
|
84
85
|
});
|
package/tools/utils.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),g=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-react-inputs"),m=require("@progress/kendo-react-intl"),d=require("../messages.js");function v(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=v(y),_=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],C="Arial",b=[8,9,10,11,12,13,14,16,18,20,22,24,26,28,36,48,72],k=12,F=[{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"}],S=e=>t=>{const{property:o,icon:r,svgIcon:u,titleKey:l}=e,{spreadsheetRef:s,value:a}=t,i=c.useCallback(()=>{if(s.current){const p={command:"PropertyChangeCommand",options:{property:o,value:!a}};s.current.executeCommand(p)}},[a]);return c.createElement(g.Button,{type:"button",icon:r,svgIcon:u,fillMode:"flat",togglable:!0,onClick:i,selected
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),g=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-react-inputs"),m=require("@progress/kendo-react-intl"),d=require("../messages.js");function v(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=v(y),_=["Arial","Courier New","Georgia","Times New Roman","Trebuchet MS","Verdana"],C="Arial",b=[8,9,10,11,12,13,14,16,18,20,22,24,26,28,36,48,72],k=12,F=[{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"}],S=e=>t=>{const{property:o,icon:r,svgIcon:u,titleKey:l}=e,{spreadsheetRef:s,value:a}=t,i=c.useCallback(()=>{if(s.current){const p={command:"PropertyChangeCommand",options:{property:o,value:!a}};s.current.executeCommand(p)}},[a]);return c.createElement(g.Button,{type:"button",icon:r,svgIcon:u,fillMode:"flat",togglable:!0,onClick:i,selected:!!a,title:m.useLocalization().toLanguageString(l,d.messages[l])})},O=e=>t=>{const{property:o,titleKey:r,...u}=e,{spreadsheetRef:l,value:s}=t,a=c.useCallback(i=>{if(l.current){const T={command:"PropertyChangeCommand",options:{property:o,value:i.value||null}};l.current.executeCommand(T)}},[o]);return c.createElement(f.ColorPicker,{onChange:a,onActiveColorClick:a,fillMode:"flat",...u,title:m.useLocalization().toLanguageString(r,d.messages[r]),value:s})},A=e=>t=>{const{spreadsheetRef:o}=t,r=c.useCallback(()=>{o.current&&o.current.workbook.undoRedoStack[e.action]()},[]);return c.createElement(g.Button,{type:"button",icon:e.icon,svgIcon:e.svgIcon,fillMode:"flat",title:m.useLocalization().toLanguageString(e.titleKey,d.messages[e.titleKey]),onClick:r,togglable:!0})};exports.ColorTool=O;exports.DEFAULT_FONT_FAMILY=C;exports.DEFAULT_FONT_SIZE=k;exports.FONT_FAMILIES=_;exports.FONT_SIZES=b;exports.FORMATS=F;exports.PropertyChangeTool=S;exports.UndoRedo=A;
|
package/tools/utils.mjs
CHANGED
|
@@ -41,7 +41,7 @@ const x = ["Arial", "Courier New", "Georgia", "Times New Roman", "Trebuchet MS",
|
|
|
41
41
|
fillMode: "flat",
|
|
42
42
|
togglable: !0,
|
|
43
43
|
onClick: i,
|
|
44
|
-
selected: n,
|
|
44
|
+
selected: !!n,
|
|
45
45
|
title: s().toLanguageString(a, m[a])
|
|
46
46
|
}
|
|
47
47
|
);
|
|
@@ -81,7 +81,8 @@ const x = ["Arial", "Courier New", "Georgia", "Times New Roman", "Trebuchet MS",
|
|
|
81
81
|
svgIcon: e.svgIcon,
|
|
82
82
|
fillMode: "flat",
|
|
83
83
|
title: s().toLanguageString(e.titleKey, m[e.titleKey]),
|
|
84
|
-
onClick: o
|
|
84
|
+
onClick: o,
|
|
85
|
+
togglable: !0
|
|
85
86
|
}
|
|
86
87
|
);
|
|
87
88
|
};
|