UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

144 lines (143 loc) 5.28 kB
import { jsxs as a, jsx as r } from "react/jsx-runtime"; import { useContext as m } from "react"; import { useIntl as l, FormattedMessage as p } from "react-intl"; import c from "../../components/builder/label.js"; import f from "../../components/builder/description.js"; import h from "../../components/builder/tooltip.js"; import { BuilderContext as d } from "../../context.js"; import { Tabs as g, TabList as y, TabPanel as n } from "../../components/formio/tabs.js"; import "clsx"; import { useErrorChecker as b } from "../../utils/errors.js"; /* empty css */ import "@floating-ui/react"; /* empty css */ import "formik"; import "@formio/vanilla-text-mask"; import "formiojs"; import u from "../../components/formio/checkbox.js"; import "lodash"; /* empty css */ import "react-select"; import "dompurify"; import "../../components/formio/datagrid.js"; import { LABELS as s } from "../../components/builder/messages.js"; import C, { useDeriveComponentKey as E } from "../../components/builder/key.js"; import M from "../../components/builder/hidden.js"; import I from "../../components/builder/clear-on-hide.js"; import T from "../../components/builder/is-sensitive-data.js"; import v from "../../components/builder/presentation-config.js"; import "@ckeditor/ckeditor5-react"; import "../../components/CKEditor.js"; /* empty css */ import S from "../../components/builder/simple-conditional.js"; import P from "../../components/builder/validate/required.js"; import w from "../../components/builder/validate/validator-select.js"; import x, { useManageValidatorsTranslations as D } from "../../components/builder/validate/i18n.js"; import L from "../../components/builder/registration/registration-attribute.js"; import "react-use"; import "../../components/builder/prefill/identifierRole.js"; import { ComponentTranslations as V } from "../../components/builder/i18n.js"; import { Basic as q, Advanced as A, Validation as F, Registration as R, Translations as k } from "../../components/builder/tabs.js"; import "@open-formulieren/monaco-json-editor"; import "../../components/builder/values/values-src.js"; /* empty css */ const B = () => { const t = l(), [e, o] = E(), { hasAnyError: i } = b(); return D(["required"]), /* @__PURE__ */ a(g, { children: [ /* @__PURE__ */ a(y, { children: [ /* @__PURE__ */ r(q, { hasErrors: i("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "hidden", "clearOnHide", "isSensitiveData", "includePartners", "includeChildren") }), /* @__PURE__ */ r(A, { hasErrors: i("conditional") }), /* @__PURE__ */ r(F, { hasErrors: i("validate") }), /* @__PURE__ */ r(R, { hasErrors: i("registration") }), /* @__PURE__ */ r(k, { hasErrors: i("openForms.translations") }) ] }), /* @__PURE__ */ a(n, { children: [ /* @__PURE__ */ r(c, {}), /* @__PURE__ */ r(C, { isManuallySetRef: e, generatedValue: o }), /* @__PURE__ */ r(f, {}), /* @__PURE__ */ r(h, {}), /* @__PURE__ */ r(v, {}), /* @__PURE__ */ r(M, {}), /* @__PURE__ */ r(I, {}), /* @__PURE__ */ r(T, {}), /* @__PURE__ */ r(H, {}), /* @__PURE__ */ r(K, {}) ] }), /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(S, {}) }), /* @__PURE__ */ a(n, { children: [ /* @__PURE__ */ r(P, {}), /* @__PURE__ */ r(w, {}), /* @__PURE__ */ r(x, {}) ] }), /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(L, {}) }), /* @__PURE__ */ r(n, { children: /* @__PURE__ */ r(V, { propertyLabels: { label: t.formatMessage(s.label), description: t.formatMessage(s.description), tooltip: t.formatMessage(s.tooltip) } }) }) ] }); }; B.defaultValues = { // basic tab label: "", key: "", description: "", tooltip: "", showInSummary: !0, showInEmail: !1, showInPDF: !0, hidden: !1, clearOnHide: !0, isSensitiveData: !0, includeChildren: !0, includePartners: !0, // Advanced tab conditional: { show: void 0, when: "", eq: "" }, // Validation tab validate: { required: !1, plugins: [] }, translatedErrors: {}, registration: { attribute: "" } }; const H = () => { const t = l(), { formType: e } = m(d), o = t.formatMessage({ id: "ZOytnI", defaultMessage: [{ type: 0, value: "Whether to add partners information to the component." }] }); return e === "appointment" ? null : /* @__PURE__ */ r(u, { name: "includePartners", label: /* @__PURE__ */ r(p, { id: "qmBAmr", defaultMessage: [{ type: 0, value: "Include partners" }] }), tooltip: o }); }, K = () => { const t = l(), { formType: e } = m(d), o = t.formatMessage({ id: "nC9GEx", defaultMessage: [{ type: 0, value: "Whether to add children information to the component." }] }); return e === "appointment" ? null : /* @__PURE__ */ r(u, { name: "includeChildren", label: /* @__PURE__ */ r(p, { id: "o5Mfn3", defaultMessage: [{ type: 0, value: "Include children" }] }), tooltip: o }); }; export { B as default };