@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
139 lines (138 loc) • 5.26 kB
JavaScript
import { jsxs as i, jsx as t } from "react/jsx-runtime";
import { useFormikContext as f } from "formik";
import { useContext as n } 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 y from "../../components/builder/autocomplete.js";
import { Tabs as T, TabList as C, TabPanel as r } 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 M } from "../../components/formio/textfield.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 a } from "../../components/builder/messages.js";
import V, { 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 A from "../../components/builder/validate/required.js";
import L from "../../components/builder/validate/regex.js";
import P from "../../components/builder/validate/validator-select.js";
import R, { useManageValidatorsTranslations as q } from "../../components/builder/validate/i18n.js";
import k 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 B, Validation as O, Registration as j, Translations as J } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
/* empty css */
const z = () => {
const e = p(), [m, l] = v(), {
values: s
} = f(), {
hasAnyError: o
} = E(), {
formType: d
} = n(u);
return q(d === "appointment" ? ["required"] : ["required", "pattern"]), /* @__PURE__ */ i(T, { children: [
/* @__PURE__ */ i(C, { children: [
/* @__PURE__ */ t(K, { hasErrors: o("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "multiple", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "autocomplete") }),
/* @__PURE__ */ t(B, { hasErrors: o("conditional") }),
/* @__PURE__ */ t(O, { hasErrors: o("validate") }),
/* @__PURE__ */ t(j, { hasErrors: o("registration") }),
/* @__PURE__ */ t(J, { hasErrors: o("openForms.translations") })
] }),
/* @__PURE__ */ i(r, { children: [
/* @__PURE__ */ t(h, {}),
/* @__PURE__ */ t(V, { isManuallySetRef: m, generatedValue: l }),
/* @__PURE__ */ t(b, {}),
/* @__PURE__ */ t(g, {}),
/* @__PURE__ */ t(D, {}),
/* @__PURE__ */ t(S, {}),
/* @__PURE__ */ t(F, {}),
/* @__PURE__ */ t(w, {}),
/* @__PURE__ */ t(x, {}),
/* @__PURE__ */ t(G, { multiple: !!s.multiple }),
/* @__PURE__ */ t(y, {})
] }),
/* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(I, {}) }),
/* @__PURE__ */ i(r, { children: [
/* @__PURE__ */ t(A, {}),
/* @__PURE__ */ t(P, {}),
/* @__PURE__ */ t(L, {}),
/* @__PURE__ */ t(R, {})
] }),
/* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(k, {}) }),
/* @__PURE__ */ t(r, { children: /* @__PURE__ */ t(H, { propertyLabels: {
label: e.formatMessage(a.label),
description: e.formatMessage(a.description),
tooltip: e.formatMessage(a.tooltip)
} }) })
] });
};
z.defaultValues = {
// basic tab
label: "",
key: "",
description: "",
tooltip: "",
showInSummary: !0,
showInEmail: !1,
showInPDF: !0,
multiple: !1,
hidden: !1,
clearOnHide: !0,
isSensitiveData: !0,
defaultValue: "",
autocomplete: "tel",
// Advanced tab
conditional: {
show: void 0,
when: "",
eq: ""
},
// Validation tab
validate: {
required: !1,
plugins: [],
pattern: ""
},
translatedErrors: {},
registration: {
attribute: ""
}
};
const G = ({
multiple: e
}) => {
const m = p(), {
formType: l
} = n(u), s = m.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return l === "appointment" ? null : /* @__PURE__ */ t(M, { name: "defaultValue", label: /* @__PURE__ */ t(c, { ...a.defaultValue }), tooltip: s, multiple: e, inputMode: "decimal" });
};
export {
z as default
};