@sheetxl/studio-vanilla
Version:
SheetXL Studio - Vanilla entry point for integrating SheetXL UI.
21 lines (20 loc) • 1.7 kB
JavaScript
import { r as a, z as S, j as n, A as T, B as k, $ as v, F as w, C as F } from "./Bf37sZn7h1jSr98w.mjs";
/**
* @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 I = ["Ok", "Cancel"], A = a.memo((x) => {
const { onInput: m, onOption: d, onValidateOption: V, onDone: r, options: u = I, defaultOption: o = u?.[0], cancelOption: l = "Cancel", sx: h, initialValue: t, context: i, ...O } = x, [b, f] = a.useState(!1), [s, j] = a.useState(() => t?.hasHeader ?? !1), [c, C] = a.useState(() => t?.ranges ?? null), D = S((e) => {
const p = { ...t, hasHeader: s, ranges: c }, g = e === l;
g || m?.(p), d?.(e, g, e === o), r?.({ option: e, tableOptions: p });
}, [r, d, o, l, s, c, t]), N = a.useCallback(async (e, p) => null, []);
return n.jsx(T, { title: "Insert Table", options: u, onDone: D, onValidateOption: N, defaultOption: o, cancelOption: l, autoFocusSel: ".range-input input", sx: { width: "360px", ...h }, ...O, children: n.jsxs(k, { sx: { paddingTop: (e) => e.spacing(1), paddingBottom: (e) => e.spacing(0), rowGap: (e) => e.spacing(1), display: "flex", flexDirection: "column" }, children: [n.jsx(v, { formName: "range", value: c, onChangeInput: (e) => C(e), resolvedAddress: i ? i().getNames().getRanges.bind(i().getNames()) : void 0, onFocus: (e) => {
b || e.target?.select(), f(!0);
} }), n.jsx(w, { control: n.jsx(F, { checked: s, onChange: () => j(!s) }), label: "Table has headers", labelPlacement: "end" })] }) });
});
export {
A as TableNewDialog,
A as default
};