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