mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): refactor useTable
This commit is contained in:
40
src/typings/naive-ui.d.ts
vendored
40
src/typings/naive-ui.d.ts
vendored
@ -1,4 +1,44 @@
|
||||
declare namespace NaiveUI {
|
||||
type ThemeColor = 'default' | 'error' | 'primary' | 'info' | 'success' | 'warning';
|
||||
type Align = 'stretch' | 'baseline' | 'start' | 'end' | 'center' | 'flex-end' | 'flex-start';
|
||||
|
||||
type DataTableBaseColumn<T> = import('naive-ui').DataTableBaseColumn<T>;
|
||||
type DataTableExpandColumn<T> = import('naive-ui').DataTableExpandColumn<T>;
|
||||
type DataTableSelectionColumn<T> = import('naive-ui').DataTableSelectionColumn<T>;
|
||||
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 FlatResponseData<T> = import('@sa/axios').FlatResponseData<T>;
|
||||
|
||||
type CustomColumnKey = 'index' | 'operate';
|
||||
|
||||
type SetTableColumnKey<C, T> = Omit<C, 'key'> & { key: keyof T | CustomColumnKey };
|
||||
|
||||
type TableData = Api.Common.CommonRecord<object>;
|
||||
|
||||
type TableColumnWithKey<T extends TableData = TableData> =
|
||||
| SetTableColumnKey<DataTableBaseColumn<T>, T>
|
||||
| SetTableColumnKey<TableColumnGroup<T>, T>;
|
||||
|
||||
type TableColumn<T extends TableData = TableData> =
|
||||
| TableColumnWithKey<T>
|
||||
| DataTableSelectionColumn<T>
|
||||
| DataTableExpandColumn<T>;
|
||||
|
||||
type TableApiFn<T extends TableData = TableData> = (
|
||||
params: Api.SystemManage.CommonSearchParams
|
||||
) => Promise<FlatResponseData<Api.Common.PaginatingQueryRecord<T>>>;
|
||||
|
||||
/**
|
||||
* the type of table operation
|
||||
*
|
||||
* - add: add table item
|
||||
* - edit: edit table item
|
||||
*/
|
||||
type TableOperateType = 'add' | 'edit';
|
||||
|
||||
type NaiveTableConfig<T extends TableData = TableData, A extends TableApiFn<T> = TableApiFn<T>> = Pick<
|
||||
import('@sa/hooks').TableConfig<A, T, TableColumn<T>>,
|
||||
'apiFn' | 'apiParams' | 'columns' | 'immediate'
|
||||
>;
|
||||
}
|
||||
|
Reference in New Issue
Block a user