UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

88 lines (87 loc) 2.35 kB
import { jsxs as n, jsx as e } from "react/jsx-runtime"; import p from "../../form/RadioGroupWithOtherString.js"; import f from "@mui/material/Checkbox"; import C from "@mui/material/FormControlLabel"; import t from "@mui/material/Grid"; import m from "@mui/material/InputLabel"; import v from "lodash-es/noop"; import { useState as b, useEffect as F, useImperativeHandle as L } from "react"; const g = { separator: ",", quoteCharacter: '"', escapeCharacter: "\\", lineEnd: ` `, isFirstLineHeader: !0 }; function T(l) { const { value: c, onChange: u = v } = l, h = c ?? l.defaultValue ?? g, [i, s] = b(h), r = c ?? i; return F(() => { u(i); }, [i, u]), L( l.ref, () => ({ getFormData: () => r }), [r] ), /* @__PURE__ */ n(t, { container: !0, spacing: 2, children: [ /* @__PURE__ */ n(t, { size: { xs: 12 }, children: [ /* @__PURE__ */ e(m, { children: "Separator" }), /* @__PURE__ */ e( p, { radioGroupProps: { row: !0, name: "separator" }, value: r.separator ?? ",", onChange: (o) => s((a) => ({ ...a, separator: o })), options: [ { value: ",", label: "Comma" }, { value: " ", label: "Tab" }, { value: ";", label: "Semicolon" } ] } ) ] }), /* @__PURE__ */ n(t, { size: { xs: 12 }, children: [ /* @__PURE__ */ e(m, { children: "Escape Character" }), /* @__PURE__ */ e( p, { radioGroupProps: { row: !0, name: "escapeCharacter" }, value: r.escapeCharacter ?? "\\", onChange: (o) => s((a) => ({ ...a, escapeCharacter: o })), options: [{ value: "\\", label: "Backslash" }] } ) ] }), /* @__PURE__ */ e(t, { size: { xs: 12 }, children: /* @__PURE__ */ e( C, { control: /* @__PURE__ */ e(f, {}), label: "First line is the header", checked: r.isFirstLineHeader, onChange: (o, a) => { s((d) => ({ ...d, isFirstLineHeader: a })); } } ) }) ] }); } export { T as default }; //# sourceMappingURL=CsvTableDescriptorForm.js.map