@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
130 lines (129 loc) • 4.91 kB
JavaScript
import { jsxs as i, jsx as t } from "react/jsx-runtime";
import { useFormikContext as p } from "formik";
import { useContext as u } from "react";
import { useIntl as n, FormattedMessage as d } from "react-intl";
import f from "../../components/builder/label.js";
import c from "../../components/builder/description.js";
import h from "../../components/builder/tooltip.js";
import { BuilderContext as b } from "../../context.js";
import { Tabs as g, TabList as y, TabPanel as e } 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 E } 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 C, { useDeriveComponentKey as v } from "../../components/builder/key.js";
import M from "../../components/builder/multiple.js";
import S from "../../components/builder/hidden.js";
import V from "../../components/builder/clear-on-hide.js";
import w from "../../components/builder/is-sensitive-data.js";
import x from "../../components/builder/presentation-config.js";
import "formiojs";
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import D from "../../components/builder/simple-conditional.js";
import F from "../../components/builder/validate/required.js";
import I from "../../components/builder/validate/validator-select.js";
import L, { useManageValidatorsTranslations as P } from "../../components/builder/validate/i18n.js";
import R from "../../components/builder/registration/registration-attribute.js";
import "react-use";
import "../../components/builder/prefill/identifierRole.js";
import { ComponentTranslations as k } from "../../components/builder/i18n.js";
import { Basic as q, Advanced as A, Validation as H, Registration as K, Translations as B } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
/* empty css */
const O = () => {
const r = n(), [s, l] = v(), {
values: m
} = p(), {
hasAnyError: o
} = T();
return P(["required"]), /* @__PURE__ */ i(g, { children: [
/* @__PURE__ */ i(y, { children: [
/* @__PURE__ */ t(q, { hasErrors: o("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "multiple", "hidden", "clearOnHide", "isSensitiveData", "defaultValue") }),
/* @__PURE__ */ t(A, { hasErrors: o("conditional") }),
/* @__PURE__ */ t(H, { hasErrors: o("validate") }),
/* @__PURE__ */ t(K, { hasErrors: o("registration") }),
/* @__PURE__ */ t(B, { hasErrors: o("openForms.translations") })
] }),
/* @__PURE__ */ i(e, { children: [
/* @__PURE__ */ t(f, {}),
/* @__PURE__ */ t(C, { isManuallySetRef: s, generatedValue: l }),
/* @__PURE__ */ t(c, {}),
/* @__PURE__ */ t(h, {}),
/* @__PURE__ */ t(x, {}),
/* @__PURE__ */ t(M, {}),
/* @__PURE__ */ t(S, {}),
/* @__PURE__ */ t(V, {}),
/* @__PURE__ */ t(w, {}),
/* @__PURE__ */ t(j, { multiple: !!m.multiple })
] }),
/* @__PURE__ */ t(e, { children: /* @__PURE__ */ t(D, {}) }),
/* @__PURE__ */ i(e, { children: [
/* @__PURE__ */ t(F, {}),
/* @__PURE__ */ t(I, {}),
/* @__PURE__ */ t(L, {})
] }),
/* @__PURE__ */ t(e, { children: /* @__PURE__ */ t(R, {}) }),
/* @__PURE__ */ t(e, { children: /* @__PURE__ */ t(k, { propertyLabels: {
label: r.formatMessage(a.label),
description: r.formatMessage(a.description),
tooltip: r.formatMessage(a.tooltip)
} }) })
] });
};
O.defaultValues = {
// basic tab
label: "",
key: "",
description: "",
tooltip: "",
showInSummary: !0,
showInEmail: !1,
showInPDF: !0,
multiple: !1,
hidden: !1,
clearOnHide: !0,
isSensitiveData: !0,
// Advanced tab
conditional: {
show: void 0,
when: "",
eq: ""
},
// Validation tab
validate: {
required: !1,
plugins: []
},
translatedErrors: {},
registration: {
attribute: ""
}
};
const j = ({
multiple: r
}) => {
const s = n(), {
formType: l
} = u(b), m = s.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(E, { name: "defaultValue", label: /* @__PURE__ */ t(d, { ...a.defaultValue }), tooltip: m, multiple: r });
};
export {
O as default
};