import { CollectionProxy, useCollectionProxy } from 'onekijs-framework'; import TreeService from '../TreeService'; import { TreeItem, TreeState, UseTreeOptions } from '../typings'; import useTreeInitialState from './useTreeInitialState'; const useTreeController = = TreeItem>( dataSource?: string | T[] | CollectionProxy, TreeService>>, options: UseTreeOptions = {}, ): CollectionProxy, TreeService>> => { const tableState = useTreeInitialState(dataSource, options); return useCollectionProxy, TreeService>>( dataSource, TreeService, tableState, ); }; export default useTreeController;