You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
752 B

import{ROW_KEY as h}from"./const-0405ffdf.js";import{r as m,f as u,u as e,K as p}from"./index-f4658ae7.js";function T(o,l,d){const a=m([]),i=u(()=>e(o).autoCreateKey&&!e(o).rowKey),K=u(()=>{const{rowKey:n}=e(o);return e(i)?h:n}),f=u(()=>{const{isTreeTable:n}=e(o);return n?{expandedRowKeys:e(a),onExpandedRowsChange:t=>{a.value=t,d("expanded-rows-change",t)}}:{}});function w(){const n=s();a.value=n}function x(n){const{isTreeTable:t}=e(o);t&&(a.value=[...a.value,...n])}function s(n){const t=[],{childrenColumnName:g}=e(o);return p(n||e(l)).forEach(c=>{t.push(c[e(K)]);const r=c[g||"children"];r!=null&&r.length&&t.push(...s(r))}),t}function y(){a.value=[]}return{getExpandOption:f,expandAll:w,expandRows:x,collapseAll:y}}export{T as useTableExpand};