@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
215 lines (214 loc) • 7.81 kB
JavaScript
import { jsxs as m, jsx as t } from "react/jsx-runtime";
import { useFormikContext as c } from "formik";
import { useContext as s } from "react";
import { useIntl as l, FormattedMessage as d } from "react-intl";
import h from "../../components/builder/label.js";
import g from "../../components/builder/description.js";
import y from "../../components/builder/tooltip.js";
import b from "../../components/builder/autocomplete.js";
import x from "../../components/builder/placeholder.js";
import T, { useDeriveComponentKey as w } from "../../components/builder/key.js";
import C from "../../components/builder/multiple.js";
import M from "../../components/builder/hidden.js";
import E from "../../components/builder/clear-on-hide.js";
import v from "../../components/builder/is-sensitive-data.js";
import V from "../../components/builder/readonly.js";
import S from "../../components/builder/show-char-count.js";
import A from "../../components/builder/presentation-config.js";
import { BuilderContext as n } from "../../context.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 "./index.js";
import "../textfield/index.js";
import "../time/index.js";
import { Tabs as D, TabList as F, TabPanel as p } from "../../components/formio/tabs.js";
import "clsx";
import { useErrorChecker as L } from "../../utils/errors.js";
/* empty css */
import "@floating-ui/react";
/* empty css */
import "../../components/formio/textfield.js";
import I from "../../components/formio/checkbox.js";
import "../../components/formio/datefield.js";
import "../../components/formio/datetimefield.js";
import "../../components/formio/timefield.js";
/* empty css */
import "react-select";
import { NumberField as k } from "../../components/formio/number.js";
import { TextAreaMultiple as P } from "../../components/formio/textarea.js";
import "../../components/formio/datagrid.js";
/* empty css */
import "@ckeditor/ckeditor5-react";
import "../../components/CKEditor.js";
/* empty css */
import R from "../../components/builder/simple-conditional.js";
import q from "../../components/builder/validate/required.js";
import H from "../../components/builder/validate/maxlength.js";
import K from "../../components/builder/validate/regex.js";
import O from "../../components/builder/validate/validator-select.js";
import N, { useManageValidatorsTranslations as j } from "../../components/builder/validate/i18n.js";
import "react-use";
import "../../components/builder/prefill/identifierRole.js";
import { ComponentTranslations as B } from "../../components/builder/i18n.js";
import { Basic as J, Advanced as z, Validation as G, Translations as Q } from "../../components/builder/tabs.js";
import "@open-formulieren/monaco-json-editor";
import "../../components/builder/values/values-src.js";
import "lodash";
/* empty css */
import { LABELS as i } from "../../components/builder/messages.js";
const U = () => {
const o = l(), [e, r] = w(), {
values: u
} = c(), {
hasAnyError: a
} = L(), {
formType: f
} = s(n);
return j(f === "appointment" ? ["required"] : ["required", "maxLength", "pattern"]), /* @__PURE__ */ m(D, { children: [
/* @__PURE__ */ m(F, { children: [
/* @__PURE__ */ t(J, { hasErrors: a("label", "key", "description", "tooltip", "showInSummary", "showInEmail", "showInPDF", "multiple", "hidden", "clearOnHide", "isSensitiveData", "defaultValue", "autocomplete", "disabled", "placeholder", "showCharCount", "autoExpand", "rows") }),
/* @__PURE__ */ t(z, { hasErrors: a("conditional") }),
/* @__PURE__ */ t(G, { hasErrors: a("validate") }),
/* @__PURE__ */ t(Q, { hasErrors: a("openForms.translations") })
] }),
/* @__PURE__ */ m(p, { children: [
/* @__PURE__ */ t(h, {}),
/* @__PURE__ */ t(T, { isManuallySetRef: e, generatedValue: r }),
/* @__PURE__ */ t(g, {}),
/* @__PURE__ */ t(y, {}),
/* @__PURE__ */ t(A, {}),
/* @__PURE__ */ t(C, {}),
/* @__PURE__ */ t(M, {}),
/* @__PURE__ */ t(E, {}),
/* @__PURE__ */ t(v, {}),
/* @__PURE__ */ t(W, { multiple: !!u.multiple }),
/* @__PURE__ */ t(b, {}),
/* @__PURE__ */ t(V, {}),
/* @__PURE__ */ t(x, {}),
/* @__PURE__ */ t(S, {}),
/* @__PURE__ */ t(X, {}),
/* @__PURE__ */ t(Y, {})
] }),
/* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(R, {}) }),
/* @__PURE__ */ m(p, { children: [
/* @__PURE__ */ t(q, {}),
/* @__PURE__ */ t(O, {}),
/* @__PURE__ */ t(H, {}),
/* @__PURE__ */ t(K, {}),
/* @__PURE__ */ t(N, {})
] }),
/* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(B, { propertyLabels: {
label: o.formatMessage(i.label),
description: o.formatMessage(i.description),
tooltip: o.formatMessage(i.tooltip),
placeholder: o.formatMessage(i.placeholder)
} }) })
] });
};
U.defaultValues = {
// basic tab
label: "",
key: "",
description: "",
tooltip: "",
showInSummary: !0,
showInEmail: !1,
showInPDF: !0,
multiple: !1,
hidden: !1,
clearOnHide: !0,
isSensitiveData: !1,
defaultValue: "",
autocomplete: "",
disabled: !1,
placeholder: "",
autoExpand: !1,
showCharCount: !1,
rows: 3,
// Advanced tab
conditional: {
show: void 0,
when: "",
eq: ""
},
// Validation tab
validate: {
required: !1,
plugins: [],
maxLength: 1e4,
pattern: ""
},
translatedErrors: {}
};
const W = ({
multiple: o
}) => {
const e = l(), {
formType: r
} = s(n), u = e.formatMessage({
id: "FffJxu",
defaultMessage: [{
type: 0,
value: "This will be the initial value for this field before user interaction."
}]
});
return r === "appointment" ? null : /* @__PURE__ */ t(P, { name: "defaultValue", label: /* @__PURE__ */ t(d, { ...i.defaultValue }), tooltip: u, multiple: o });
}, X = () => {
const o = l(), {
formType: e
} = s(n), r = o.formatMessage({
id: "jV58dA",
defaultMessage: [{
type: 0,
value: "This will make the text area auto expand its height as the user is typing into the area."
}]
});
return e === "appointment" ? null : /* @__PURE__ */ t(I, { name: "autoExpand", label: /* @__PURE__ */ t(d, { id: "LJckD5", defaultMessage: [{
type: 0,
value: "Auto Expand"
}] }), tooltip: r });
}, Y = () => {
const o = l(), {
formType: e
} = s(n), r = o.formatMessage({
id: "KwatvH",
defaultMessage: [{
type: 0,
value: "The number of rows for this text area."
}]
});
return e === "appointment" ? null : /* @__PURE__ */ t(k, { name: "rows", label: /* @__PURE__ */ t(d, { id: "pDVNSf", defaultMessage: [{
type: 0,
value: "Number of rows"
}] }), tooltip: r });
};
export {
U as default
};