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