UNPKG

@progress/kendo-react-spreadsheet

Version:
98 lines (97 loc) 3.07 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as r from "react"; import { Button as v } from "@progress/kendo-react-buttons"; import { ColorPicker as C } from "@progress/kendo-react-inputs"; import { useLocalization as s } from "@progress/kendo-react-intl"; import { messages as m } from "../messages.mjs"; const x = ["Arial", "Courier New", "Georgia", "Times New Roman", "Trebuchet MS", "Verdana"], _ = "Arial", b = [8, 9, 10, 11, 12, 13, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72], h = 12, A = [ { 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" } ], F = (e) => (l) => { const { property: t, icon: o, svgIcon: c, titleKey: a } = e, { spreadsheetRef: u, value: n } = l, i = r.useCallback(() => { if (u.current) { const y = { command: "PropertyChangeCommand", options: { property: t, value: !n } }; u.current.executeCommand(y); } }, [n]); return /* @__PURE__ */ r.createElement( v, { type: "button", icon: o, svgIcon: c, fillMode: "flat", togglable: !0, onClick: i, selected: !!n, title: s().toLanguageString(a, m[a]) } ); }, S = (e) => (l) => { const { property: t, titleKey: o, ...c } = e, { spreadsheetRef: a, value: u } = l, n = r.useCallback( (i) => { if (a.current) { const d = { command: "PropertyChangeCommand", options: { property: t, value: i.value || null } }; a.current.executeCommand(d); } }, [t] ); return /* @__PURE__ */ r.createElement( C, { onChange: n, onActiveColorClick: n, fillMode: "flat", ...c, title: s().toLanguageString(o, m[o]), value: u } ); }, M = (e) => (l) => { const { spreadsheetRef: t } = l, o = r.useCallback(() => { t.current && t.current.workbook.undoRedoStack[e.action](); }, []); return /* @__PURE__ */ r.createElement( v, { type: "button", icon: e.icon, svgIcon: e.svgIcon, fillMode: "flat", title: s().toLanguageString(e.titleKey, m[e.titleKey]), onClick: o, togglable: !0 } ); }; export { S as ColorTool, _ as DEFAULT_FONT_FAMILY, h as DEFAULT_FONT_SIZE, x as FONT_FAMILIES, b as FONT_SIZES, A as FORMATS, F as PropertyChangeTool, M as UndoRedo };