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