UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

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