@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
157 lines (156 loc) • 6 kB
JavaScript
import { jsxs as s, jsx as e } from "react/jsx-runtime";
import { useFormikContext as f } from "formik";
import { useContext as p } from "react";
import { useIntl as m, FormattedMessage as d } from "react-intl";
import c from "../../components/builder/label.js";
import h from "../../components/builder/description.js";
import b from "../../components/builder/tooltip.js";
import g from "../../components/builder/autocomplete.js";
import { Tabs as y, TabList as v, TabPanel as a } from "../../components/formio/tabs.js";
import "clsx";
import { useErrorChecker as T } from "../../utils/errors.js";
/* empty css */
import "@floating-ui/react";
/* empty css */
import { TextFieldMultiple as M } from "../../components/formio/textfield.js";
import C from "../../components/formio/checkbox.js";
import { BuilderContext as u } from "../../context.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 E, { useDeriveComponentKey as V } from "../../components/builder/key.js";
import S from "../../components/builder/multiple.js";
import F from "../../components/builder/hidden.js";
import w from "../../components/builder/clear-on-hide.js";
import x from "../../components/builder/is-sensitive-data.js";
import D from "../../components/builder/presentation-config.js";
import "formiojs";
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import I from "../../components/builder/simple-conditional.js";
import R from "../../components/builder/is-confirmation-email.js";
import q from "../../components/builder/validate/required.js";
import P from "../../components/builder/validate/validator-select.js";
import L, { useManageValidatorsTranslations as k } from "../../components/builder/validate/i18n.js";
import A from "../../components/builder/registration/registration-attribute.js";
import "react-use";
import "../../components/builder/prefill/identifierRole.js";
import { ComponentTranslations as H } from "../../components/builder/i18n.js";
import { Basic as K, Advanced as O, Validation as B, Registration as _, Translations as j } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
/* empty css */
const Q = /* @__PURE__ */ new Set(["appointment", "single_step"]), W = () => {
const t = m(), [o, r] = V(), {
values: l
} = f(), {
hasAnyError: i
} = T();
return k(["required"]), /* @__PURE__ */ s(y, { children: [
/* @__PURE__ */ s(v, { children: [
/* @__PURE__ */ e(K, { hasErrors: i("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "multiple", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "autocomplete") }),
/* @__PURE__ */ e(O, { hasErrors: i("conditional") }),
/* @__PURE__ */ e(B, { hasErrors: i("validate") }),
/* @__PURE__ */ e(_, { hasErrors: i("registration") }),
/* @__PURE__ */ e(j, { hasErrors: i("openForms.translations") })
] }),
/* @__PURE__ */ s(a, { children: [
/* @__PURE__ */ e(c, {}),
/* @__PURE__ */ e(E, { isManuallySetRef: o, generatedValue: r }),
/* @__PURE__ */ e(h, {}),
/* @__PURE__ */ e(b, {}),
/* @__PURE__ */ e(D, {}),
/* @__PURE__ */ e(S, {}),
/* @__PURE__ */ e(F, {}),
/* @__PURE__ */ e(w, {}),
/* @__PURE__ */ e(x, {}),
/* @__PURE__ */ e(G, { multiple: !!l.multiple }),
/* @__PURE__ */ e(g, {}),
/* @__PURE__ */ e(R, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(I, {}) }),
/* @__PURE__ */ s(a, { children: [
/* @__PURE__ */ e(q, {}),
/* @__PURE__ */ e(J, {}),
/* @__PURE__ */ e(P, {}),
/* @__PURE__ */ e(L, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(A, {}) }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(H, { propertyLabels: {
label: t.formatMessage(n.label),
description: t.formatMessage(n.description),
tooltip: t.formatMessage(n.tooltip)
} }) })
] });
};
W.defaultValues = {
// basic tab
label: "",
key: "",
description: "",
showInSummary: !0,
showInEmail: !1,
showInPDF: !0,
multiple: !1,
hidden: !1,
clearOnHide: !0,
isSensitiveData: !0,
defaultValue: "",
autocomplete: "email",
confirmationRecipient: !1,
// Advanced tab
conditional: {
show: void 0,
when: "",
eq: ""
},
// Validation tab
validate: {
required: !1,
plugins: []
},
translatedErrors: {},
registration: {
attribute: ""
},
// openForms extensions
openForms: {
translations: {},
requireVerification: !1
}
};
const G = ({
multiple: t
}) => {
const o = m(), {
formType: r
} = p(u), l = o.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return r === "appointment" ? null : /* @__PURE__ */ e(M, { name: "defaultValue", type: "email", label: o.formatMessage(n.defaultValue), tooltip: l, multiple: t });
}, J = () => {
const t = m(), {
formType: o
} = p(u), r = t.formatMessage({
id: "205QX5",
defaultMessage: [{
type: 0,
value: "When email address verification is enabled, the user must verify their email address before they can submit the form. This proves the email address exists and that they have access to the account."
}]
});
return Q.has(o) ? null : /* @__PURE__ */ e(C, { name: "openForms.requireVerification", label: /* @__PURE__ */ e(d, { id: "Wb+QGm", defaultMessage: [{
type: 0,
value: "Require verification"
}] }), tooltip: r });
};
export {
W as default
};