@base-stone/hooks 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # design-hooks
2
+
3
+
4
+ ## 安装
5
+
6
+ ```
7
+
8
+ pnpm add @base-stone/design-hooks
9
+
10
+ ```
11
+
@@ -0,0 +1,61 @@
1
+ import { Key } from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { TablePaginationConfig } from 'antd/es/table/interface';
4
+ import { TableProps as TableProps_2 } from 'antd';
5
+
6
+ /**
7
+ * 配置全局表格参数
8
+ * @param config Map 配置对象
9
+ * @example
10
+ * configureTable(new Map([
11
+ * ['sortField', ['sort', 'sortBy']],
12
+ * ['sortOrder', ['asc', 'desc']],
13
+ * ['pageSize', 20]
14
+ * ]))
15
+ */
16
+ export declare function configureTableOption(config: Map<string, number[] | string[]>): void;
17
+
18
+ declare interface QueryParamsData {
19
+ pageNo: number;
20
+ pageSize: number;
21
+ orderType?: string;
22
+ orderField?: string;
23
+ [key: string]: any;
24
+ }
25
+
26
+ declare interface TableListResult<T> {
27
+ /** 查询参数 */
28
+ queryParams: QueryParamsData;
29
+ /** 执行查询方法 */
30
+ reload: (params?: Record<string, any>) => void;
31
+ /** 选中的行 keys */
32
+ selectedRowKeys: Key[];
33
+ /** 表格属性 */
34
+ tableProps: TableProps<T>;
35
+ }
36
+
37
+ declare interface TableProps<T> {
38
+ bordered: boolean;
39
+ size: 'middle';
40
+ sticky: boolean;
41
+ rowSelection: TableProps_2<T>['rowSelection'] | undefined;
42
+ pagination: TablePaginationConfig;
43
+ loading: boolean;
44
+ dataSource: T[];
45
+ onChange: TableProps_2<T>['onChange'];
46
+ locale: {
47
+ emptyText: string | ReactNode;
48
+ };
49
+ }
50
+
51
+ declare interface TableResponse<T> {
52
+ status: string;
53
+ data: {
54
+ list: T[];
55
+ totalCount: number;
56
+ };
57
+ }
58
+
59
+ export declare function useTableList<T>(getRequestFn: (data: QueryParamsData) => Promise<TableResponse<T>>, initParams?: Record<string, any>): TableListResult<T>;
60
+
61
+ export { }