UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

30 lines (29 loc) 963 B
import { isNull as o, toFalse as k } from "@vexip-ui/utils"; function f(a) { function l(n) { let c = a.getNode(n); if (c) for (; !o(c.parent); ) { const r = c.parent, e = a.getNode(r); if (!e || c.checked === e.checked && c.partial === e.partial) break; c.checked ? (e.checked = e.children.every((d) => d.checked), e.partial = !e.checked) : (e.checked = !1, e.partial = e.children.some((d) => d.checked || d.partial)), c = e; } } function h(n) { const c = a.getNode(n); if (!c) return; const r = typeof a.disableNode == "function" ? a.disableNode : k, e = c.checked, d = c.partial, i = [...c.children]; let t; for (; i.length; ) t = i.shift(), !r(t) && (t.checked = e, t.partial = d, t.children.length && i.push(...t.children)); } return { updateCheckedUpward: l, updateCheckedDown: h }; } export { f as useCascadedChecked }; //# sourceMappingURL=hooks.mjs.map