UNPKG

@react-form-builder/core

Version:

React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required

38 lines (37 loc) 783 B
const u = {}; function a(t) { const e = t.name; if (u[e]) throw new Error(`Component feature ${e} is already registered`); u[e] = t; } function c(t) { a({ name: t, allowMultiple: !1 }); } function i(t) { const e = u[t]; if (!e) throw new Error(`ComponentFeature ${t} is not registered`); return e; } function l(t, e, r) { const n = i(e), o = { ...t }, s = o[e]; return o[e] = n.allowMultiple ? s ? [...s, r] : [r] : r, o; } function p(t, ...e) { let r = t ?? {}; return e.forEach((n) => { r = l(r, n.name, n.value); }), r; } export { l as addOrUpdateFeature, p as addOrUpdateFeatures, i as getComponentFeature, c as registerBooleanComponentFeature, a as registerComponentFeature }; //# sourceMappingURL=ComponentFeature.js.map