UNPKG

ant-design-x-vue

Version:

Craft AI-driven interfaces effortlessly

45 lines (44 loc) 1.08 kB
import r from "../../_util/hooks/use-state.mjs"; import { computed as p, toValue as u, watch as c } from "vue"; const b = (t, f, m) => { const n = p(() => { const e = u(t); let a = { expandedKeys: [], onExpand: () => { } }; return e ? (typeof e == "object" && (a = { ...a, ...e }), { enableCollapse: !0, customizeExpandedKeys: a.expandedKeys, customizeOnExpand: a.onExpand }) : { enableCollapse: !1, customizeExpandedKeys: a.expandedKeys, customizeOnExpand: a.onExpand }; }), [s, o] = r(n.value.customizeExpandedKeys), i = (e) => { var l, d; if (!n.value.enableCollapse) return; const a = s.value.includes(e) ? s.value.filter((x) => x !== e) : [...s.value, e]; (d = (l = n.value).customizeOnExpand) == null || d.call(l, a), typeof u(t) != "object" && o(a); }; return c( n, (e) => { o(e.customizeExpandedKeys); }, { deep: 1 } ), [ p(() => n.value.enableCollapse), s, i // collapseMotion, ]; }; export { b as default };