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