@canvas-components/react-list-table 0.2.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/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/index.cjs +2915 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +85 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +2913 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CSSProperties, ReactNode, ForwardedRef } from 'react';
|
|
3
|
+
import { ListTableOptions, ListTableQueryChange, ListTableScrollToOptions, ListTable, ListTableColumn, ListTablePaginationOptions, ListTableQueryOptions, ListTableRowSelectionOptions } from '@canvas-components/list-table';
|
|
4
|
+
|
|
5
|
+
interface ReactListTableScrollConfig {
|
|
6
|
+
x?: number | string | true;
|
|
7
|
+
y?: number | string;
|
|
8
|
+
}
|
|
9
|
+
interface ReactListTableLocale {
|
|
10
|
+
emptyText?: string;
|
|
11
|
+
}
|
|
12
|
+
interface ReactListTableProps<RecordType = Record<string, unknown>> extends Omit<ListTableOptions<RecordType>, "type" | "ui" | "width" | "height" | "emptyText"> {
|
|
13
|
+
width?: number | string;
|
|
14
|
+
height?: number | string;
|
|
15
|
+
emptyText?: string;
|
|
16
|
+
scroll?: ReactListTableScrollConfig;
|
|
17
|
+
locale?: ReactListTableLocale;
|
|
18
|
+
onChange?: ListTableQueryChange<RecordType>;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
/** 表格标题栏左侧内容。 */
|
|
22
|
+
title?: ReactNode;
|
|
23
|
+
/** 标题栏右侧工具配置,传入 false 时隐藏整个标题栏工具区。 */
|
|
24
|
+
toolbar?: false | ReactListTableToolbarOptions;
|
|
25
|
+
}
|
|
26
|
+
interface ReactListTableToolbarOptions {
|
|
27
|
+
showRefresh?: boolean;
|
|
28
|
+
showFullscreen?: boolean;
|
|
29
|
+
showDensity?: boolean;
|
|
30
|
+
showColumnSetting?: boolean;
|
|
31
|
+
/** 列设置弹层宽度,数字值按像素处理。 */
|
|
32
|
+
columnSettingWidth?: number | string;
|
|
33
|
+
showExport?: boolean;
|
|
34
|
+
onRefresh?: () => void;
|
|
35
|
+
/** 自定义导出行为;未配置时默认异步导出全量 XLSX 数据。 */
|
|
36
|
+
onExport?: () => void;
|
|
37
|
+
/** 自定义全屏节点,默认使用表格根容器。 */
|
|
38
|
+
getFullscreenNode?: () => HTMLElement | null;
|
|
39
|
+
extra?: ReactNode;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* React 表格实例透出方法。
|
|
43
|
+
*/
|
|
44
|
+
interface ReactListTableRef<RecordType = Record<string, unknown>> {
|
|
45
|
+
validate: () => Promise<RecordType[]>;
|
|
46
|
+
exportXlsx: () => void;
|
|
47
|
+
scrollTo: (options: ListTableScrollToOptions) => void;
|
|
48
|
+
getDebugSnapshot: () => ReturnType<ListTable<RecordType>["getDebugSnapshot"]>;
|
|
49
|
+
resetSorter: () => void;
|
|
50
|
+
resetFilter: () => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* antd Table 风格的 props 类型别名。
|
|
54
|
+
*/
|
|
55
|
+
type ReactListTableTableProps<RecordType = Record<string, unknown>> = ReactListTableProps<RecordType>;
|
|
56
|
+
/**
|
|
57
|
+
* 单列类型。
|
|
58
|
+
*/
|
|
59
|
+
type ReactListTableColumnType<RecordType = Record<string, unknown>> = ListTableColumn<RecordType>;
|
|
60
|
+
/**
|
|
61
|
+
* 列数组类型。
|
|
62
|
+
*/
|
|
63
|
+
type ReactListTableColumnsType<RecordType = Record<string, unknown>> = Array<ReactListTableColumnType<RecordType>>;
|
|
64
|
+
/**
|
|
65
|
+
* 行选择类型别名。
|
|
66
|
+
*/
|
|
67
|
+
type ReactListTableRowSelection<RecordType = Record<string, unknown>> = ListTableRowSelectionOptions<RecordType>;
|
|
68
|
+
/**
|
|
69
|
+
* 分页类型别名。
|
|
70
|
+
*/
|
|
71
|
+
type ReactListTablePagination = ListTablePaginationOptions;
|
|
72
|
+
/**
|
|
73
|
+
* 查询类型别名。
|
|
74
|
+
*/
|
|
75
|
+
type ReactListTableQuery<RecordType = Record<string, unknown>> = ListTableQueryOptions<RecordType>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* ListTable 的 React 宿主组件。
|
|
79
|
+
*/
|
|
80
|
+
declare function ReactListTableInner<RecordType = Record<string, unknown>>(props: ReactListTableProps<RecordType>, ref: ForwardedRef<ReactListTableRef<RecordType>>): react.JSX.Element;
|
|
81
|
+
declare const ReactListTable: <RecordType = Record<string, unknown>>(props: ReactListTableProps<RecordType> & {
|
|
82
|
+
ref?: ForwardedRef<ReactListTableRef<RecordType>>;
|
|
83
|
+
}) => ReturnType<typeof ReactListTableInner>;
|
|
84
|
+
|
|
85
|
+
export { ReactListTable, type ReactListTableColumnType, type ReactListTableColumnsType, type ReactListTableLocale, type ReactListTablePagination, type ReactListTableProps, type ReactListTableQuery, type ReactListTableRef, type ReactListTableRowSelection, type ReactListTableScrollConfig, type ReactListTableTableProps, type ReactListTableToolbarOptions };
|