import 'element-plus';

"use strict";
function useExpand(treeRef) {
  const setExpandKeys = (keys, flag = true) => {
    if (!treeRef.value) return;
    const nodesMap = treeRef.value.store.nodesMap;
    for (const key in nodesMap) {
      if (keys.includes(key)) nodesMap[key].expanded = flag;
    }
  };
  const toggleExpandAll = (flag) => {
    if (!treeRef.value) return;
    const nodesMap = treeRef.value.store.nodesMap;
    console.log(nodesMap);
    for (const key in nodesMap) {
      nodesMap[key].expanded = flag;
    }
  };
  const getExpandKeys = () => {
    if (!treeRef.value) return;
    const nodesMap = Object.values(treeRef.value?.store?.nodesMap);
    const res = nodesMap.filter((item) => item.expanded).map((item) => item.key);
    return res;
  };
  return { toggleExpandAll, setExpandKeys, getExpandKeys };
}

export { useExpand };
//# sourceMappingURL=useExpand.mjs.map
