@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
210 lines (209 loc) • 7.39 kB
JavaScript
import { jsxs as a, jsx as t } from "react/jsx-runtime";
import { useFormikContext as h } from "formik";
import { useContext as n } from "react";
import { useIntl as l, FormattedMessage as u } from "react-intl";
import T from "../../components/builder/label.js";
import b from "../../components/builder/description.js";
import y from "../../components/builder/tooltip.js";
import { BuilderContext as p } from "../../context.js";
import { Tabs as g, TabList as M, TabPanel as m } from "../../components/formio/tabs.js";
import "clsx";
import { useErrorChecker as v } from "../../utils/errors.js";
/* empty css */
import "@floating-ui/react";
/* empty css */
import "../../components/formio/textfield.js";
import "../../components/formio/datefield.js";
import "../../components/formio/datetimefield.js";
import { TimeFieldMultiple as f } from "../../components/formio/timefield.js";
/* empty css */
import "react-select";
import "dompurify";
import "../../components/formio/textarea.js";
import "../../components/formio/datagrid.js";
/* empty css */
import { LABELS as s } from "../../components/builder/messages.js";
import C, { useDeriveComponentKey as E } from "../../components/builder/key.js";
import x from "../../components/builder/multiple.js";
import F from "../../components/builder/hidden.js";
import V from "../../components/builder/clear-on-hide.js";
import S from "../../components/builder/is-sensitive-data.js";
import w from "../../components/builder/readonly.js";
import D from "../../components/builder/presentation-config.js";
import "../addressNL/index.js";
import "../bsn/index.js";
import "../checkbox/index.js";
import "../children/index.js";
import "../columns/index.js";
import "../content/index.js";
import "../cosignV1/index.js";
import "../cosignV2/index.js";
import "../currency/index.js";
import "../customerProfile/index.js";
import "../date/index.js";
import "../datetime/index.js";
import "../editgrid/index.js";
import "../email/index.js";
import "../fieldset/index.js";
import "../file/index.js";
import "../iban/index.js";
import "../licenseplate/index.js";
import "../map/index.js";
import "../npFamilyMembers/index.js";
import "../number/index.js";
import "../partners/index.js";
import "../phonenumber/index.js";
import "../postcode/index.js";
import "../radio/index.js";
import "../select/index.js";
import "../selectboxes/index.js";
import "../signature/index.js";
import "../softRequiredErrors/index.js";
import "../textarea/index.js";
import "../textfield/index.js";
import "./index.js";
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import I from "../../components/builder/simple-conditional.js";
import P from "../../components/builder/validate/required.js";
import A from "../../components/builder/validate/validator-select.js";
import L, { useManageValidatorsTranslations as R } from "../../components/builder/validate/i18n.js";
import q 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 k, Advanced as H, Validation as O, Registration as B, Translations as U } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
import "lodash";
/* empty css */
const j = () => {
const e = l(), [i, o] = E(), {
values: {
multiple: d = !1
}
} = h(), {
hasAnyError: r
} = v(), {
formType: c
} = n(p);
return R(c === "appointment" ? ["required"] : ["required", "minTime", "maxTime", "invalid_time"]), /* @__PURE__ */ a(g, { children: [
/* @__PURE__ */ a(M, { children: [
/* @__PURE__ */ t(k, { hasErrors: r("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "multiple", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "disabled") }),
/* @__PURE__ */ t(H, { hasErrors: r("conditional") }),
/* @__PURE__ */ t(O, { hasErrors: r("validate") }),
/* @__PURE__ */ t(B, { hasErrors: r("registration") }),
/* @__PURE__ */ t(U, { hasErrors: r("openForms.translations") })
] }),
/* @__PURE__ */ a(m, { children: [
/* @__PURE__ */ t(T, {}),
/* @__PURE__ */ t(C, { isManuallySetRef: i, generatedValue: o }),
/* @__PURE__ */ t(b, {}),
/* @__PURE__ */ t(y, {}),
/* @__PURE__ */ t(D, {}),
/* @__PURE__ */ t(x, {}),
/* @__PURE__ */ t(F, {}),
/* @__PURE__ */ t(V, {}),
/* @__PURE__ */ t(S, {}),
/* @__PURE__ */ t(G, { multiple: d }),
/* @__PURE__ */ t(w, {})
] }),
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(I, {}) }),
/* @__PURE__ */ a(m, { children: [
/* @__PURE__ */ t(P, {}),
/* @__PURE__ */ t(A, {}),
/* @__PURE__ */ t(J, {}),
/* @__PURE__ */ t(_, {}),
/* @__PURE__ */ t(L, {})
] }),
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(q, {}) }),
/* @__PURE__ */ t(m, { children: /* @__PURE__ */ t(K, { propertyLabels: {
label: e.formatMessage(s.label),
description: e.formatMessage(s.description),
tooltip: e.formatMessage(s.tooltip)
} }) })
] });
};
j.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: [],
minTime: "",
maxTime: ""
},
translatedErrors: {},
openForms: {
translations: {}
},
// Registration tab
registration: {
attribute: ""
}
};
const G = ({
multiple: e
}) => {
const i = l(), {
formType: o
} = n(p), d = i.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return o === "appointment" ? null : /* @__PURE__ */ t(f, { name: "defaultValue", label: /* @__PURE__ */ t(u, { ...s.defaultValue }), tooltip: d, multiple: e });
}, J = () => {
const e = l(), {
formType: i
} = n(p), o = e.formatMessage({
id: "tU1UVF",
defaultMessage: [{
type: 0,
value: "The earliest possible value that can be entered."
}]
});
return i === "appointment" ? null : /* @__PURE__ */ t(f, { name: "validate.minTime", label: /* @__PURE__ */ t(u, { id: "Un5b5T", defaultMessage: [{
type: 0,
value: "Minimum time"
}] }), tooltip: o });
}, _ = () => {
const e = l(), {
formType: i
} = n(p), o = e.formatMessage({
id: "eg8uKC",
defaultMessage: [{
type: 0,
value: "The latest possible value that can be entered."
}]
});
return i === "appointment" ? null : /* @__PURE__ */ t(f, { name: "validate.maxTime", label: /* @__PURE__ */ t(u, { id: "5yP7G/", defaultMessage: [{
type: 0,
value: "Maximum time"
}] }), tooltip: o });
};
export {
j as default
};