UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

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