UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

227 lines (226 loc) 8.04 kB
import { jsxs as m, jsx as t } from "react/jsx-runtime"; import { useContext as s } from "react"; import { useIntl as n, FormattedMessage as f } from "react-intl"; import c from "../../components/builder/label.js"; import g from "../../components/builder/description.js"; import h from "../../components/builder/tooltip.js"; import { BuilderContext as p } from "../../context.js"; import { Tabs as v, TabList as y, TabPanel as a } from "../../components/formio/tabs.js"; import "clsx"; import { useErrorChecker as b } from "../../utils/errors.js"; /* empty css */ import "@floating-ui/react"; /* empty css */ import "../../components/formio/textfield.js"; import M from "../../components/formio/checkbox.js"; import "../../components/formio/datefield.js"; import "../../components/formio/datetimefield.js"; import "../../components/formio/timefield.js"; /* empty css */ import "formik"; import "react-select"; import { NumberField as u } from "../../components/formio/number.js"; import "../../components/formio/textarea.js"; import "../../components/formio/datagrid.js"; /* empty css */ import { LABELS as l } from "../../components/builder/messages.js"; import T, { useDeriveComponentKey as x } from "../../components/builder/key.js"; import E from "../../components/builder/hidden.js"; import w from "../../components/builder/clear-on-hide.js"; import C from "../../components/builder/is-sensitive-data.js"; import S from "../../components/builder/presentation-config.js"; import "../addressNL/index.js"; import "../bsn/index.js"; import "../checkbox/index.js"; import "../children/index.js"; import "../columns/index.js"; import "../content/index.js"; import "../cosignV1/index.js"; import "../cosignV2/index.js"; import "../currency/index.js"; import "../customerProfile/index.js"; import "../date/index.js"; import "../datetime/index.js"; import "../editgrid/index.js"; import "../email/index.js"; import "../fieldset/index.js"; import "../file/index.js"; import "../iban/index.js"; import "../licenseplate/index.js"; import "../map/index.js"; import "../npFamilyMembers/index.js"; import "./index.js"; import "../partners/index.js"; import "../phonenumber/index.js"; import "../postcode/index.js"; import "../radio/index.js"; import "../select/index.js"; import "../selectboxes/index.js"; import "../signature/index.js"; import "../softRequiredErrors/index.js"; import "../textarea/index.js"; import "../textfield/index.js"; import "../time/index.js"; import "@ckeditor/ckeditor5-react"; import "../../components/CKEditor.js"; /* empty css */ import V from "../../components/builder/simple-conditional.js"; import L from "../../components/builder/suffix.js"; import D from "../../components/builder/validate/required.js"; import F from "../../components/builder/validate/max.js"; import I from "../../components/builder/validate/min.js"; import A from "../../components/builder/validate/validator-select.js"; import P, { useManageValidatorsTranslations as R } from "../../components/builder/validate/i18n.js"; import q from "../../components/builder/registration/registration-attribute.js"; import { PrefillConfiguration as K } from "../../components/builder/prefill/index.js"; import { ComponentTranslations as B } from "../../components/builder/i18n.js"; import { Basic as N, Advanced as k, Validation as H, Registration as O, Prefill as j, Translations as J } from "../../components/builder/tabs.js"; import "@open-formulieren/monaco-json-editor"; import "react-use"; import "../../components/builder/values/values-src.js"; import "lodash"; /* empty css */ const W = () => { const i = n(), [e, o] = x(), { hasAnyError: r } = b(), { formType: d } = s(p); return R(d === "appointment" ? ["required"] : ["required", "min", "max"]), /* @__PURE__ */ m(v, { children: [ /* @__PURE__ */ m(y, { children: [ /* @__PURE__ */ t(N, { hasErrors: r("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "decimalLimit", "allowNegative", "suffix") }), /* @__PURE__ */ t(k, { hasErrors: r("conditional") }), /* @__PURE__ */ t(H, { hasErrors: r("validate") }), /* @__PURE__ */ t(O, { hasErrors: r("registration") }), /* @__PURE__ */ t(j, { hasErrors: r("prefill") }), /* @__PURE__ */ t(J, { hasErrors: r("openForms.translations") }) ] }), /* @__PURE__ */ m(a, { children: [ /* @__PURE__ */ t(c, {}), /* @__PURE__ */ t(T, { isManuallySetRef: e, generatedValue: o }), /* @__PURE__ */ t(g, {}), /* @__PURE__ */ t(h, {}), /* @__PURE__ */ t(L, {}), /* @__PURE__ */ t(S, {}), /* @__PURE__ */ t(E, {}), /* @__PURE__ */ t(w, {}), /* @__PURE__ */ t(C, {}), /* @__PURE__ */ t(X, {}), /* @__PURE__ */ t(z, {}), /* @__PURE__ */ t(G, {}) ] }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(V, {}) }), /* @__PURE__ */ m(a, { children: [ /* @__PURE__ */ t(D, {}), /* @__PURE__ */ t(A, {}), /* @__PURE__ */ t(I, {}), /* @__PURE__ */ t(F, {}), /* @__PURE__ */ t(P, {}) ] }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(q, {}) }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(K, {}) }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(B, { propertyLabels: { label: i.formatMessage(l.label), description: i.formatMessage(l.description), tooltip: i.formatMessage(l.tooltip), prefix: i.formatMessage({ id: "OaeVI8", defaultMessage: [{ type: 0, value: "Prefix" }] }), suffix: i.formatMessage({ id: "oWJX5K", defaultMessage: [{ type: 0, value: "Suffix (e.g. m²)" }] }) }, ignoreKeysForTranslations: d === "appointment" ? ["prefix", "suffix"] : [] }) }) ] }); }; W.defaultValues = { // basic tab label: "", key: "", description: "", tooltip: "", showInSummary: !0, showInEmail: !1, showInPDF: !0, hidden: !1, clearOnHide: !0, isSensitiveData: !1, defaultValue: null, decimalLimit: void 0, allowNegative: !1, suffix: "", // Advanced tab conditional: { show: void 0, when: "", eq: "" }, // Validation tab validate: { required: !1, plugins: [], min: void 0, max: void 0 }, translatedErrors: {}, // Registration tab registration: { attribute: "" }, prefill: { plugin: "", attribute: "", identifierRole: "main" } }; const X = () => { const i = n(), { formType: e } = s(p), o = i.formatMessage({ id: "FffJxu", defaultMessage: [{ type: 0, value: "This will be the initial value for this field before user interaction." }] }); return e === "appointment" ? null : /* @__PURE__ */ t(u, { name: "defaultValue", label: /* @__PURE__ */ t(f, { ...l.defaultValue }), tooltip: o }); }, z = () => { const i = n(), { formType: e } = s(p), o = i.formatMessage({ id: "m20av3", defaultMessage: [{ type: 0, value: "The maximum number of decimal places." }] }); return e === "appointment" ? null : /* @__PURE__ */ t(u, { name: "decimalLimit", label: /* @__PURE__ */ t(f, { id: "BvRBef", defaultMessage: [{ type: 0, value: "Decimal places" }] }), tooltip: o }); }, G = () => { const i = n(), { formType: e } = s(p), o = i.formatMessage({ id: "3LEg1l", defaultMessage: [{ type: 0, value: "Allow negative values." }] }); return e === "appointment" ? null : /* @__PURE__ */ t(M, { name: "allowNegative", label: /* @__PURE__ */ t(f, { id: "E8Tuiq", defaultMessage: [{ type: 0, value: "Allow negative values" }] }), tooltip: o }); }, Ei = u; export { Ei as ComparisonValueInput, W as default };