refactor(projects): finish refactor useTable and apply

This commit is contained in:
Soybean
2024-03-21 19:38:29 +08:00
parent 4158a72bd8
commit 3fd15e5649
14 changed files with 264 additions and 843 deletions

View File

@ -219,5 +219,8 @@ declare namespace Api {
/** children menu */
children?: Menu[];
}>;
/** menu list */
type MenuList = Common.PaginatingQueryRecord<Menu>;
}
}

View File

@ -8,9 +8,15 @@ declare namespace NaiveUI {
type TableColumnGroup<T> = import('naive-ui/es/data-table/src/interface').TableColumnGroup<T>;
type PaginationProps = import('naive-ui').PaginationProps;
type TableColumnCheck = import('@sa/hooks').TableColumnCheck;
type TableDataWithIndex<T> = import('@sa/hooks').TableDataWithIndex<T>;
type FlatResponseData<T> = import('@sa/axios').FlatResponseData<T>;
type CustomColumnKey = 'index' | 'operate';
/**
* the custom column key
*
* if you want to add a custom column, you should add a key to this type
*/
type CustomColumnKey = 'operate';
type SetTableColumnKey<C, T> = Omit<C, 'key'> & { key: keyof T | CustomColumnKey };
@ -35,7 +41,7 @@ declare namespace NaiveUI {
type GetTableData<A extends TableApiFn> = A extends TableApiFn<infer T> ? T : never;
type NaiveTableConfig<A extends TableApiFn> = Pick<
import('@sa/hooks').TableConfig<A, GetTableData<A>, TableColumn<GetTableData<A>>>,
import('@sa/hooks').TableConfig<A, GetTableData<A>, TableColumn<NaiveUI.TableDataWithIndex<GetTableData<A>>>>,
'apiFn' | 'apiParams' | 'columns' | 'immediate'
>;
}