UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

204 lines (203 loc) 7.33 kB
import { jsxs as m, jsx as t } from "react/jsx-runtime"; import { useContext as s } from "react"; import { useIntl as n, FormattedMessage as u } 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 b, TabPanel as a } from "../../components/formio/tabs.js"; import "clsx"; import { useErrorChecker as y } from "../../utils/errors.js"; /* empty css */ import "@floating-ui/react"; /* empty css */ import "../../components/formio/textfield.js"; import T 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 d } 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 M, { useDeriveComponentKey as E } from "../../components/builder/key.js"; import w from "../../components/builder/hidden.js"; import C from "../../components/builder/clear-on-hide.js"; import x from "../../components/builder/is-sensitive-data.js"; import V 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 "./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 "../number/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 L from "../../components/builder/simple-conditional.js"; import S from "../../components/builder/validate/required.js"; import D from "../../components/builder/validate/max.js"; import I from "../../components/builder/validate/min.js"; import A from "../../components/builder/validate/validator-select.js"; import F, { 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 P } from "../../components/builder/i18n.js"; import { Basic as B, Advanced as N, Validation as k, Registration as H, Translations as K } from "../../components/builder/tabs.js"; import "@open-formulieren/monaco-json-editor"; import "../../components/builder/values/values-src.js"; import "lodash"; /* empty css */ const O = () => { const o = n(), [i, r] = E(), { hasAnyError: e } = y(), { formType: f } = s(p); return R(f === "appointment" ? ["required"] : ["required", "min", "max"]), /* @__PURE__ */ m(v, { children: [ /* @__PURE__ */ m(b, { children: [ /* @__PURE__ */ t(B, { hasErrors: e("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "decimalLimit", "allowNegative") }), /* @__PURE__ */ t(N, { hasErrors: e("conditional") }), /* @__PURE__ */ t(k, { hasErrors: e("validate") }), /* @__PURE__ */ t(H, { hasErrors: e("registration") }), /* @__PURE__ */ t(K, { hasErrors: e("openForms.translations") }) ] }), /* @__PURE__ */ m(a, { children: [ /* @__PURE__ */ t(c, {}), /* @__PURE__ */ t(M, { isManuallySetRef: i, generatedValue: r }), /* @__PURE__ */ t(g, {}), /* @__PURE__ */ t(h, {}), /* @__PURE__ */ t(V, {}), /* @__PURE__ */ t(w, {}), /* @__PURE__ */ t(C, {}), /* @__PURE__ */ t(x, {}), /* @__PURE__ */ t(j, {}), /* @__PURE__ */ t(J, {}), /* @__PURE__ */ t(U, {}) ] }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(L, {}) }), /* @__PURE__ */ m(a, { children: [ /* @__PURE__ */ t(S, {}), /* @__PURE__ */ t(A, {}), /* @__PURE__ */ t(I, {}), /* @__PURE__ */ t(D, {}), /* @__PURE__ */ t(F, {}) ] }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(q, {}) }), /* @__PURE__ */ t(a, { children: /* @__PURE__ */ t(P, { propertyLabels: { label: o.formatMessage(l.label), description: o.formatMessage(l.description), tooltip: o.formatMessage(l.tooltip) } }) }) ] }); }; O.defaultValues = { currency: "EUR", // 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, // 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: "" } }; const j = () => { const o = n(), { formType: i } = s(p), r = o.formatMessage({ id: "FffJxu", defaultMessage: [{ type: 0, value: "This will be the initial value for this field before user interaction." }] }); return i === "appointment" ? null : /* @__PURE__ */ t(d, { name: "defaultValue", label: /* @__PURE__ */ t(u, { ...l.defaultValue }), tooltip: r, prefix: "€" }); }, J = () => { const o = n(), { formType: i } = s(p), r = o.formatMessage({ id: "m20av3", defaultMessage: [{ type: 0, value: "The maximum number of decimal places." }] }); return i === "appointment" ? null : /* @__PURE__ */ t(d, { name: "decimalLimit", label: /* @__PURE__ */ t(u, { id: "BvRBef", defaultMessage: [{ type: 0, value: "Decimal places" }] }), tooltip: r }); }, U = () => { const o = n(), { formType: i } = s(p), r = o.formatMessage({ id: "3LEg1l", defaultMessage: [{ type: 0, value: "Allow negative values." }] }); return i === "appointment" ? null : /* @__PURE__ */ t(T, { name: "allowNegative", label: /* @__PURE__ */ t(u, { id: "E8Tuiq", defaultMessage: [{ type: 0, value: "Allow negative values" }] }), tooltip: r }); }, yo = d; export { yo as ComparisonValueInput, O as default };