UNPKG

ant-design-x-vue-next

Version:

Ant Design X for Vue — community continuation aligned with @ant-design/x

26 lines (25 loc) 750 B
import { computed as a, toValue as v } from "vue"; import m from "../../_util/hooks/useMergedState.mjs"; function b(r, c) { const n = a(() => !!v(r)), e = a(() => v(c) || {}), o = a( () => !n.value || e.value.expandedKeys === void 0 ), i = a( () => o.value ? void 0 : e.value.expandedKeys ), [t, x] = m( () => e.value.defaultExpandedKeys || [], { value: i } ); return { enableCollapse: n, expandedKeys: t, onItemExpand: (d) => { var u, p; if (!n.value) return; const l = o.value ? t.value : e.value.expandedKeys || [], s = l.includes(d) ? l.filter((f) => f !== d) : [...l, d]; (p = (u = e.value).onExpand) == null || p.call(u, s), o.value && x(s); } }; } export { b as default };