UNPKG

@react-form-builder/core

Version:

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

35 lines (34 loc) 1.09 kB
import { jsx as l } from "react/jsx-runtime"; import { groupBy as C } from "./groupBy.js"; import { needRender as g } from "./needRender.js"; const d = /* @__PURE__ */ new Map(); function y(e) { const o = d.get(e); if (o) return o; const t = new Function("parentProps", e); return d.set(e, t), t; } function S(e, o) { const t = e.slotCondition?.trim(); if (!t) return !0; const i = y(t); try { return i(o); } catch (r) { return console.warn(r), !1; } } const w = "children"; function k(e, o, t) { const i = e.field?.fieldType === "repeater" ? e.field.componentData : e.children, r = o, f = {}, p = C(i, (n) => n.store.slot || w), a = (n) => S(n.store, t), u = (n) => g(n.store, e.dataRoot); for (const [n, m] of Object.entries(p)) { const s = m.filter(a).filter(u); s.length && (f[n] = e.model.propsBindingTypes[n] === "array" ? s.map((c) => [c]).map((c, h) => /* @__PURE__ */ l(r, { data: c }, h)) : /* @__PURE__ */ l(r, { data: s })); } return f; } export { S as checkSlotCondition, k as getChildren }; //# sourceMappingURL=getChildren.js.map