@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
191 lines (190 loc) • 6.82 kB
JavaScript
import { jsxs as l, jsx as e } from "react/jsx-runtime";
import { useContext as n } from "react";
import { useIntl as m, FormattedMessage as f } from "react-intl";
import c from "../../components/builder/label.js";
import g from "../../components/builder/description.js";
import h from "../../components/builder/tooltip.js";
import { BuilderContext as p } from "../../context.js";
import { Tabs as v, TabList as y, TabPanel as a } from "../../components/formio/tabs.js";
import "clsx";
import { useErrorChecker as b } from "../../utils/errors.js";
/* empty css */
import "@floating-ui/react";
/* empty css */
import "formik";
import "@formio/vanilla-text-mask";
import "formiojs";
import M from "../../components/formio/checkbox.js";
import "lodash";
/* empty css */
import "react-select";
import { NumberField as u } from "../../components/formio/number.js";
import "../../components/formio/datagrid.js";
import { LABELS as s } from "../../components/builder/messages.js";
import T, { useDeriveComponentKey as x } from "../../components/builder/key.js";
import E from "../../components/builder/hidden.js";
import w from "../../components/builder/clear-on-hide.js";
import C from "../../components/builder/is-sensitive-data.js";
import S from "../../components/builder/presentation-config.js";
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import V from "../../components/builder/simple-conditional.js";
import L from "../../components/builder/suffix.js";
import D from "../../components/builder/validate/required.js";
import F from "../../components/builder/validate/max.js";
import I from "../../components/builder/validate/min.js";
import A from "../../components/builder/validate/validator-select.js";
import P, { useManageValidatorsTranslations as R } from "../../components/builder/validate/i18n.js";
import q from "../../components/builder/registration/registration-attribute.js";
import { PrefillConfiguration as K } from "../../components/builder/prefill/index.js";
import { ComponentTranslations as B } from "../../components/builder/i18n.js";
import { Basic as N, Advanced as k, Validation as H, Registration as O, Prefill as j, Translations as J } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "react-use";
import "../../components/builder/values/values-src.js";
/* empty css */
const W = () => {
const t = m(), [i, o] = x(), {
hasAnyError: r
} = b(), {
formType: d
} = n(p);
return R(d === "appointment" ? ["required"] : ["required", "min", "max"]), /* @__PURE__ */ l(v, { children: [
/* @__PURE__ */ l(y, { children: [
/* @__PURE__ */ e(N, { hasErrors: r("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "decimalLimit", "allowNegative", "suffix") }),
/* @__PURE__ */ e(k, { hasErrors: r("conditional") }),
/* @__PURE__ */ e(H, { hasErrors: r("validate") }),
/* @__PURE__ */ e(O, { hasErrors: r("registration") }),
/* @__PURE__ */ e(j, { hasErrors: r("prefill") }),
/* @__PURE__ */ e(J, { hasErrors: r("openForms.translations") })
] }),
/* @__PURE__ */ l(a, { children: [
/* @__PURE__ */ e(c, {}),
/* @__PURE__ */ e(T, { isManuallySetRef: i, generatedValue: o }),
/* @__PURE__ */ e(g, {}),
/* @__PURE__ */ e(h, {}),
/* @__PURE__ */ e(L, {}),
/* @__PURE__ */ e(S, {}),
/* @__PURE__ */ e(E, {}),
/* @__PURE__ */ e(w, {}),
/* @__PURE__ */ e(C, {}),
/* @__PURE__ */ e(X, {}),
/* @__PURE__ */ e(z, {}),
/* @__PURE__ */ e(G, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(V, {}) }),
/* @__PURE__ */ l(a, { children: [
/* @__PURE__ */ e(D, {}),
/* @__PURE__ */ e(A, {}),
/* @__PURE__ */ e(I, {}),
/* @__PURE__ */ e(F, {}),
/* @__PURE__ */ e(P, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(q, {}) }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(K, {}) }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(B, { propertyLabels: {
label: t.formatMessage(s.label),
description: t.formatMessage(s.description),
tooltip: t.formatMessage(s.tooltip),
prefix: t.formatMessage({
id: "OaeVI8",
defaultMessage: [{
type: 0,
value: "Prefix"
}]
}),
suffix: t.formatMessage({
id: "oWJX5K",
defaultMessage: [{
type: 0,
value: "Suffix (e.g. m²)"
}]
})
}, ignoreKeysForTranslations: d === "appointment" ? ["prefix", "suffix"] : [] }) })
] });
};
W.defaultValues = {
// basic tab
label: "",
key: "",
description: "",
tooltip: "",
showInSummary: !0,
showInEmail: !1,
showInPDF: !0,
hidden: !1,
clearOnHide: !0,
isSensitiveData: !1,
defaultValue: null,
decimalLimit: void 0,
allowNegative: !1,
suffix: "",
// Advanced tab
conditional: {
show: void 0,
when: "",
eq: ""
},
// Validation tab
validate: {
required: !1,
plugins: [],
min: void 0,
max: void 0
},
translatedErrors: {},
// Registration tab
registration: {
attribute: ""
},
prefill: {
plugin: "",
attribute: "",
identifierRole: "main"
}
};
const X = () => {
const t = m(), {
formType: i
} = n(p), o = t.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return i === "appointment" ? null : /* @__PURE__ */ e(u, { name: "defaultValue", label: /* @__PURE__ */ e(f, { ...s.defaultValue }), tooltip: o });
}, z = () => {
const t = m(), {
formType: i
} = n(p), o = t.formatMessage({
id: "m20av3",
defaultMessage: [{
type: 0,
value: "The maximum number of decimal places."
}]
});
return i === "appointment" ? null : /* @__PURE__ */ e(u, { name: "decimalLimit", label: /* @__PURE__ */ e(f, { id: "BvRBef", defaultMessage: [{
type: 0,
value: "Decimal places"
}] }), tooltip: o });
}, G = () => {
const t = m(), {
formType: i
} = n(p), o = t.formatMessage({
id: "3LEg1l",
defaultMessage: [{
type: 0,
value: "Allow negative values."
}]
});
return i === "appointment" ? null : /* @__PURE__ */ e(M, { name: "allowNegative", label: /* @__PURE__ */ e(f, { id: "E8Tuiq", defaultMessage: [{
type: 0,
value: "Allow negative values"
}] }), tooltip: o });
}, Oe = u;
export {
Oe as ComparisonValueInput,
W as default
};