@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
23 lines (22 loc) • 1.78 kB
JavaScript
import { a as e } from "./DrQ2E12IEJK6WHfw.js";
import { r as n } from "./BTLmGxC1eZDXb9cY.js";
import { Y as S, Z as T, B as k, ac as v, C as w, E as I } from "./elB9a338Kjeh3S89.js";
/**
* @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.7.27
*
* (C) 2025-present SheetXL Inc. & Michael T. Ford
* License: The license can be found at https://www.sheetxl.com/license.
*/
const V = ["Ok", "Cancel"], A = n.memo((m) => {
const { onInput: x, onOption: r, onValidateOption: y, onDone: d, options: u = V, defaultOption: s = u?.[0], cancelOption: l = "Cancel", sx: h, initialValue: t, context: i, ...f } = m, [O, b] = n.useState(!1), [o, C] = n.useState(() => t?.hasHeader ?? !1), [p, j] = n.useState(() => t?.ranges ?? null), D = S((a) => {
const c = { ...t, hasHeader: o, ranges: p }, g = a === l;
g || x?.(c), r?.(a, g, a === s), d?.({ option: a, tableOptions: c });
}, [d, r, s, l, o, p, t]), N = n.useCallback(async (a, c) => null, []);
return e.jsx(T, { title: "Insert Table", options: u, onDone: D, onValidateOption: N, defaultOption: s, cancelOption: l, autoFocusSel: ".range-input input", sx: { width: "360px", ...h }, ...f, children: e.jsxs(k, { sx: { paddingTop: (a) => a.spacing(1), paddingBottom: (a) => a.spacing(0), rowGap: (a) => a.spacing(1), display: "flex", flexDirection: "column" }, children: [e.jsx(v, { formName: "range", value: p, onChangeInput: (a) => j(a), resolvedAddress: i ? i().getNames().getRanges.bind(i().getNames()) : void 0, onFocus: (a) => {
O || a.target?.select(), b(!0);
} }), e.jsx(w, { control: e.jsx(I, { checked: o, onChange: () => C(!o) }), label: "Table has headers", labelPlacement: "end" })] }) });
});
export {
A as TableNewDialog,
A as default
};