UNPKG

@frontify/fondue

Version:
34 lines (33 loc) 1.51 kB
import { isEqualWith as a } from "lodash-es"; import { getReactNodeIdsInFlatArray as l, removeReactNodesFromFlatArray as h, getReactNodesInFlatArray as I } from "./nodes.es.js"; const x = (t, r) => r && (t.key === "Meta" || t.ctrlKey), m = (t, r) => t.findIndex((o) => o.props.id === r), F = (t, r) => t.filter((o) => o.props.parentId === r).map((o) => o.props.id), N = (t, r, o) => { const s = l(t, r), e = s.length > 0 ? h(t, s) : t, n = m(e, r); return n === -1 ? t : [...e.slice(0, n + 1), ...o, ...e.slice(n + 1)]; }, C = (t, r, o) => { const s = []; for (const e of o) if (s.push(e), !!r.has(e.props.id)) for (const n of I(t, e.props.id)) s.push(n); return s; }, A = (t, r, o) => { var s, e; for (const n of t) { const p = o.find((f) => f.props.id === n), i = (s = p == null ? void 0 : p.props) == null ? void 0 : s.contentComponent, d = r.find((f) => f.props.id === n), c = (e = d == null ? void 0 : d.props) == null ? void 0 : e.contentComponent; if ((!c || !i) && !a(d == null ? void 0 : d.props, p == null ? void 0 : p.props, u) || !a(c == null ? void 0 : c.props, i == null ? void 0 : i.props, u)) return !0; } return !1; }, u = (t, r) => { if (typeof t == "function" || typeof r == "function") return !0; }; export { A as currentNodesChanged, m as findIndexById, C as getCurrentChildrenForNewNodesIfExpanded, F as getNodeChildrenIds, x as shouldUpdateTreeState, N as updateNodeWithNewChildren }; //# sourceMappingURL=reducer.es.js.map