@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
168 lines (167 loc) • 6.12 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 u } 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 b, TabPanel as a } from "../../components/formio/tabs.js";
import "clsx";
import { useErrorChecker as y } from "../../utils/errors.js";
/* empty css */
import "@floating-ui/react";
/* empty css */
import "formik";
import "@formio/vanilla-text-mask";
import "formiojs";
import T from "../../components/formio/checkbox.js";
import "lodash";
/* empty css */
import "react-select";
import { NumberField as d } from "../../components/formio/number.js";
import "../../components/formio/datagrid.js";
import { LABELS as s } from "../../components/builder/messages.js";
import M, { useDeriveComponentKey as E } from "../../components/builder/key.js";
import w from "../../components/builder/hidden.js";
import C from "../../components/builder/clear-on-hide.js";
import x from "../../components/builder/is-sensitive-data.js";
import V from "../../components/builder/presentation-config.js";
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import L from "../../components/builder/simple-conditional.js";
import S from "../../components/builder/validate/required.js";
import D from "../../components/builder/validate/max.js";
import I from "../../components/builder/validate/min.js";
import A from "../../components/builder/validate/validator-select.js";
import F, { 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 P } from "../../components/builder/i18n.js";
import { Basic as B, Advanced as N, Validation as k, Registration as H, Translations as K } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
/* empty css */
const O = () => {
const t = m(), [o, i] = E(), {
hasAnyError: r
} = y(), {
formType: f
} = n(p);
return R(f === "appointment" ? ["required"] : ["required", "min", "max"]), /* @__PURE__ */ l(v, { children: [
/* @__PURE__ */ l(b, { children: [
/* @__PURE__ */ e(B, { hasErrors: r("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "decimalLimit", "allowNegative") }),
/* @__PURE__ */ e(N, { hasErrors: r("conditional") }),
/* @__PURE__ */ e(k, { hasErrors: r("validate") }),
/* @__PURE__ */ e(H, { hasErrors: r("registration") }),
/* @__PURE__ */ e(K, { hasErrors: r("openForms.translations") })
] }),
/* @__PURE__ */ l(a, { children: [
/* @__PURE__ */ e(c, {}),
/* @__PURE__ */ e(M, { isManuallySetRef: o, generatedValue: i }),
/* @__PURE__ */ e(g, {}),
/* @__PURE__ */ e(h, {}),
/* @__PURE__ */ e(V, {}),
/* @__PURE__ */ e(w, {}),
/* @__PURE__ */ e(C, {}),
/* @__PURE__ */ e(x, {}),
/* @__PURE__ */ e(j, {}),
/* @__PURE__ */ e(J, {}),
/* @__PURE__ */ e(U, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(L, {}) }),
/* @__PURE__ */ l(a, { children: [
/* @__PURE__ */ e(S, {}),
/* @__PURE__ */ e(A, {}),
/* @__PURE__ */ e(I, {}),
/* @__PURE__ */ e(D, {}),
/* @__PURE__ */ e(F, {})
] }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(q, {}) }),
/* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(P, { propertyLabels: {
label: t.formatMessage(s.label),
description: t.formatMessage(s.description),
tooltip: t.formatMessage(s.tooltip)
} }) })
] });
};
O.defaultValues = {
currency: "EUR",
// 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,
// 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: ""
}
};
const j = () => {
const t = m(), {
formType: o
} = n(p), i = t.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return o === "appointment" ? null : /* @__PURE__ */ e(d, { name: "defaultValue", label: /* @__PURE__ */ e(u, { ...s.defaultValue }), tooltip: i, prefix: "€" });
}, J = () => {
const t = m(), {
formType: o
} = n(p), i = t.formatMessage({
id: "m20av3",
defaultMessage: [{
type: 0,
value: "The maximum number of decimal places."
}]
});
return o === "appointment" ? null : /* @__PURE__ */ e(d, { name: "decimalLimit", label: /* @__PURE__ */ e(u, { id: "BvRBef", defaultMessage: [{
type: 0,
value: "Decimal places"
}] }), tooltip: i });
}, U = () => {
const t = m(), {
formType: o
} = n(p), i = t.formatMessage({
id: "3LEg1l",
defaultMessage: [{
type: 0,
value: "Allow negative values."
}]
});
return o === "appointment" ? null : /* @__PURE__ */ e(T, { name: "allowNegative", label: /* @__PURE__ */ e(u, { id: "E8Tuiq", defaultMessage: [{
type: 0,
value: "Allow negative values"
}] }), tooltip: i });
}, Be = d;
export {
Be as ComparisonValueInput,
O as default
};