@gx-design-vue/pro-table 0.2.0-beta.13 → 0.2.0-beta.131
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/dist/ProTable.d.ts +253 -792
- package/dist/_utils/ant-design-vue/index.d.ts +4 -2
- package/dist/_utils/ant-design-vue/input/typings.d.ts +1 -0
- package/dist/_utils/ant-design-vue/table/props.d.ts +33 -2
- package/dist/_utils/ant-design-vue/table/typings.d.ts +6 -5
- package/dist/_utils/ant-design-vue/tooltip/typings.d.ts +1 -0
- package/dist/_utils/index.d.ts +1 -1
- package/dist/components/Form/components/RequestSelect.d.ts +39 -0
- package/dist/components/Form/{useForm.d.ts → hooks/useForm.d.ts} +1 -1
- package/dist/components/Form/index.d.ts +15 -27
- package/dist/components/Form/style.d.ts +2 -5
- package/dist/components/Form/utils/config.d.ts +5 -0
- package/dist/components/Form/utils/dateFormat.d.ts +20 -0
- package/dist/components/ListToolBar/index.d.ts +20 -33
- package/dist/components/ListToolBar/style.d.ts +2 -5
- package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -1
- package/dist/components/ToolBar/index.d.ts +22 -23
- package/dist/context/TableContext.d.ts +15 -16
- package/dist/hooks/tryOnActivated.d.ts +2 -0
- package/dist/hooks/useColumnSetting.d.ts +6 -7
- package/dist/hooks/useColumns.d.ts +101 -0
- package/dist/hooks/useDebounceFn.d.ts +2 -2
- package/dist/hooks/useFetchData.d.ts +21 -16
- package/dist/hooks/useLoading.d.ts +5 -8
- package/dist/hooks/usePagination.d.ts +7 -6
- package/dist/hooks/useRowSelection.d.ts +11 -8
- package/dist/hooks/useTable.d.ts +40 -11
- package/dist/hooks/useTableForm.d.ts +9 -9
- package/dist/hooks/useTableScroll.d.ts +17 -18
- package/dist/hooks/useTableSize.d.ts +4 -7
- package/dist/index.d.ts +8 -7
- package/dist/pro-table.js +2307 -0
- package/dist/pro-table.umd.cjs +12 -0
- package/dist/props.d.ts +94 -377
- package/dist/style.d.ts +2 -6
- package/dist/types/ColumnTypings.d.ts +54 -16
- package/dist/types/SlotsTypings.d.ts +47 -9
- package/dist/types/TableTypings.d.ts +124 -76
- package/dist/utils/utils.d.ts +4 -1
- package/package.json +31 -51
- package/volar.d.ts +3 -3
- package/dist/components/ColumnSetting/hooks/useRefFunction/index.d.ts +0 -1
- package/dist/components/ColumnSetting/index.d.ts +0 -35
- package/dist/components/ColumnSetting/style.d.ts +0 -6
- package/dist/components/ToolBar/DensityIcon.d.ts +0 -3
- package/dist/hooks/useColums.d.ts +0 -24
- package/dist/pro-table.mjs +0 -35100
- package/dist/pro-table.umd.js +0 -364
- package/dist/typing.d.ts +0 -1
- package/dist/utils/config.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RecordType, VueNode } from '@gx-design-vue/pro-utils';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ColumnType } from '../_utils';
|
|
2
|
+
import type { CSSProperties } from 'vue';
|
|
3
|
+
import type { AlignType, ColumnType, TooltipProps } from '../_utils';
|
|
4
4
|
/**
|
|
5
5
|
* @param text 文本框
|
|
6
6
|
* @param date 日期 YYYY-MM-DD
|
|
@@ -9,7 +9,7 @@ import type { ColumnType } from '../_utils';
|
|
|
9
9
|
* @param time: 时间 HH:mm:ss
|
|
10
10
|
* @param select 下拉选择器
|
|
11
11
|
*/
|
|
12
|
-
export type ProFieldValueType = 'text' | '
|
|
12
|
+
export type ProFieldValueType = 'text' | 'number' | 'numberRange' | 'select' | 'treeSelect' | 'date' | 'dateWeek' | 'dateQuarter' | 'dateMonth' | 'dateYear' | 'dateRange' | 'time';
|
|
13
13
|
/**
|
|
14
14
|
* @param text 文本框
|
|
15
15
|
* @param date 日期 YYYY-MM-DD
|
|
@@ -19,17 +19,18 @@ export type ProFieldValueType = 'text' | 'date' | 'select' | 'treeSelect' | 'dat
|
|
|
19
19
|
* @param select 下拉选择器
|
|
20
20
|
*/
|
|
21
21
|
export type ProFieldValueFormat = 'YYYY-MM-DD' | 'YYYY-MM' | 'YYYY-MM-DD HH:mm:ss' | 'HH:mm:ss';
|
|
22
|
-
export
|
|
22
|
+
export interface ProSchemaValueEnumType {
|
|
23
23
|
/** @name 演示的文案 */
|
|
24
|
-
|
|
24
|
+
label: VueNode | JSX.Element;
|
|
25
25
|
/** @name 演示的value值 */
|
|
26
26
|
value: any;
|
|
27
27
|
/** @name 是否禁用 */
|
|
28
28
|
disabled?: boolean;
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
30
|
type ProSchemaValueType<ValueType> = (ValueType | ProFieldValueType);
|
|
31
|
-
export
|
|
32
|
-
name
|
|
31
|
+
export interface ProSearchMap<ValueType = 'text', ParamsKey = string> {
|
|
32
|
+
name: ParamsKey;
|
|
33
|
+
order?: number;
|
|
33
34
|
/** 选择如何渲染相应的模式 */
|
|
34
35
|
valueType?: ProSchemaValueType<ValueType>;
|
|
35
36
|
/** valueType为date|dateMonth|dateRange|time生效 */
|
|
@@ -55,18 +56,55 @@ export type ProSearchMap<ValueType = 'text'> = {
|
|
|
55
56
|
initialValue?: any;
|
|
56
57
|
/** 针对select、treeselect取值的key */
|
|
57
58
|
valueKey?: string;
|
|
58
|
-
/**
|
|
59
|
-
|
|
59
|
+
/** 远程查询数据 */
|
|
60
|
+
request?: {
|
|
61
|
+
fetch?: () => Promise<ProSchemaValueEnumType[]>;
|
|
62
|
+
manual?: boolean;
|
|
63
|
+
debounceTime?: number;
|
|
64
|
+
};
|
|
65
|
+
/** 查询表单label */
|
|
66
|
+
label?: string;
|
|
67
|
+
/** 查询表单label - 宽度 */
|
|
68
|
+
labelWidth?: string | number;
|
|
69
|
+
/** 查询表单label - 对齐方式 */
|
|
70
|
+
labelAlign?: 'center' | 'left' | 'right';
|
|
71
|
+
/** 表单的属性值(ant-design) */
|
|
72
|
+
field?: {
|
|
73
|
+
rules?: RegExp;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
};
|
|
60
76
|
/**
|
|
61
77
|
* 支持 object 和Map,Map 是支持其他基础类型作为 key
|
|
62
78
|
*
|
|
63
79
|
* @name 映射值的类型
|
|
64
80
|
*/
|
|
65
81
|
valueEnum?: ProSchemaValueEnumType[];
|
|
82
|
+
}
|
|
83
|
+
export type ColumnWithKeyOrDataIndex<T = any[]> = {
|
|
84
|
+
key: keyof T | 'action' | string;
|
|
85
|
+
dataIndex?: keyof T | 'action' | string;
|
|
86
|
+
} | {
|
|
87
|
+
key?: keyof T | 'action' | string;
|
|
88
|
+
dataIndex: keyof T | 'action' | string;
|
|
66
89
|
};
|
|
67
|
-
export
|
|
68
|
-
children?: ProColumnsType<RecordType>;
|
|
90
|
+
export interface DefaultProColumn {
|
|
69
91
|
uuid?: string | number;
|
|
92
|
+
align?: AlignType;
|
|
93
|
+
fixed?: boolean | 'right' | 'left';
|
|
94
|
+
width?: number | string;
|
|
95
|
+
}
|
|
96
|
+
export type DefaultProColumnWithKeyOrDataIndex<T = any[]> = DefaultProColumn & ColumnWithKeyOrDataIndex<T>;
|
|
97
|
+
export type ProColumn<T = undefined, R = any[]> = T extends undefined ? DefaultProColumnWithKeyOrDataIndex<R> : DefaultProColumnWithKeyOrDataIndex<R> & T;
|
|
98
|
+
export type ProColumnType<DataValue = RecordType, SearchParams = RecordType> = ProColumn<Omit<ColumnType<DataValue>, keyof DefaultProColumnWithKeyOrDataIndex> & {
|
|
99
|
+
children?: ProColumnsType<DataValue, SearchParams>;
|
|
100
|
+
index?: number;
|
|
101
|
+
copyText?: string | ((record: ProColumnType) => string);
|
|
102
|
+
tooltip?: false | (TooltipProps & {
|
|
103
|
+
width?: number;
|
|
104
|
+
targetStyle?: Partial<CSSProperties>;
|
|
105
|
+
hiddenLine?: number;
|
|
106
|
+
class?: string;
|
|
107
|
+
});
|
|
70
108
|
/** 不在列表中显示 */
|
|
71
109
|
show?: boolean;
|
|
72
110
|
/** 列表顺序值 */
|
|
@@ -74,15 +112,15 @@ export type ProColumnType<RecordType = DefaultRecordType> = ColumnType<RecordTyp
|
|
|
74
112
|
/** 不在配置工具中显示 */
|
|
75
113
|
hideInSetting?: boolean;
|
|
76
114
|
/** 表单搜索配置 */
|
|
77
|
-
searchConfig?: ProSearchMap
|
|
115
|
+
searchConfig?: ProSearchMap<undefined, keyof DataValue | keyof SearchParams>;
|
|
78
116
|
/** 是否拷贝 */
|
|
79
117
|
copyable?: boolean;
|
|
80
118
|
/** 值为空时,默认取值 */
|
|
81
119
|
columnEmptyText?: string;
|
|
82
120
|
valueType?: ProColumnsValueType;
|
|
83
|
-
}
|
|
84
|
-
export type ProColumnsType<RecordType =
|
|
85
|
-
export type ProColumnsValueType = 'text' | 'link' | 'time' | 'dateMonth' | 'dateTime' | {
|
|
121
|
+
}, DataValue>;
|
|
122
|
+
export type ProColumnsType<DataValue = RecordType, SearchParams = RecordType> = ProColumnType<DataValue, SearchParams>[];
|
|
123
|
+
export type ProColumnsValueType = 'text' | 'link' | 'time' | 'dateMonth' | 'dateTime' | 'date' | {
|
|
86
124
|
node?: string;
|
|
87
125
|
class?: string;
|
|
88
126
|
attr?: string;
|
|
@@ -1,12 +1,50 @@
|
|
|
1
|
-
import type { CustomRender, WithFalse } from '@gx-design-vue/pro-utils';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import type { CustomRender, RecordType, WithFalse } from '@gx-design-vue/pro-utils';
|
|
2
|
+
import type { ColumnType, RenderExpandIconProps } from '../_utils';
|
|
3
|
+
import type { ProColumnType } from '../types/ColumnTypings';
|
|
4
|
+
export interface ProTableBodyCellProps<T = RecordType> {
|
|
5
|
+
text: any;
|
|
6
|
+
value: any;
|
|
7
|
+
record: T;
|
|
8
|
+
index: number;
|
|
9
|
+
column: ProColumnType<T>;
|
|
10
|
+
}
|
|
11
|
+
export interface AntTableSlotsType {
|
|
12
|
+
emptyText?: any;
|
|
13
|
+
expandIcon?: RenderExpandIconProps<any>;
|
|
14
|
+
title?: any;
|
|
15
|
+
footer?: any;
|
|
16
|
+
summary?: any;
|
|
17
|
+
expandedRowRender?: any;
|
|
18
|
+
expandColumnTitle?: any;
|
|
19
|
+
bodyCell?: (props: ProTableBodyCellProps<any>) => void;
|
|
20
|
+
headerCell?: (props: {
|
|
21
|
+
title: any;
|
|
22
|
+
column: ColumnType;
|
|
23
|
+
}) => void;
|
|
24
|
+
customFilterIcon?: any;
|
|
25
|
+
customFilterDropdown?: any;
|
|
26
|
+
default: any;
|
|
27
|
+
}
|
|
28
|
+
export type ProTableSlotsKey = 'search' | 'actions' | 'headerTitle' | 'titleTip' | 'settingExtra' | 'pageItemRender' | 'customRender';
|
|
29
|
+
export declare const proTableSlotsKey: ProTableSlotsKey[];
|
|
30
|
+
export type Slots = Readonly<Omit<Record<ProTableSlotsKey, () => void>, 'customRender' | 'pageItemRender'> & {
|
|
31
|
+
customRender: (params: CustomRenderResult) => void;
|
|
32
|
+
pageItemRender: (params: {
|
|
33
|
+
page: number;
|
|
34
|
+
type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
|
|
35
|
+
originalElement: any;
|
|
36
|
+
}) => void;
|
|
37
|
+
}>;
|
|
38
|
+
export interface CustomRenderResult<T = RecordType> {
|
|
39
|
+
currentData: T[];
|
|
40
|
+
dataSource: T[];
|
|
41
|
+
}
|
|
42
|
+
export type PageItemFn = (opt: {
|
|
8
43
|
page: number;
|
|
9
44
|
type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
|
|
10
45
|
originalElement: any;
|
|
11
|
-
}) => CustomRender
|
|
12
|
-
export type
|
|
46
|
+
}) => CustomRender;
|
|
47
|
+
export type CustomDataFn<T = RecordType> = (params: CustomRenderResult<T>) => CustomRender;
|
|
48
|
+
export type DefaultRender = WithFalse<CustomRender>;
|
|
49
|
+
export type PageItemRender = WithFalse<PageItemFn>;
|
|
50
|
+
export type CustomDataRender<T = RecordType> = WithFalse<CustomDataFn<T>>;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
params?: any;
|
|
11
|
-
filters?: TableFilters;
|
|
12
|
-
sorter?: TableSorter;
|
|
1
|
+
import type { Breakpoint, CustomRender, RecordType, SizeType, WithFalse } from '@gx-design-vue/pro-utils';
|
|
2
|
+
import type { ComputedRef, CSSProperties, Ref } from 'vue';
|
|
3
|
+
import type { FilterValue, SelectionSelectFn, SorterResult, TableCurrentDataSource, TablePaginationConfig, TableProps, TableRowSelection, TableSorterRecord } from '../_utils';
|
|
4
|
+
import type { ProColumnsType, ProColumnType, ProSearchMap } from './ColumnTypings';
|
|
5
|
+
import type { CustomDataRender, DefaultRender, PageItemRender } from './SlotsTypings';
|
|
6
|
+
export interface ProTableFetchParams<R = RecordType> {
|
|
7
|
+
params?: R;
|
|
8
|
+
filters?: Record<string, FilterValue | null>;
|
|
9
|
+
sorter?: SorterResult | SorterResult[];
|
|
13
10
|
pagination?: ProTablePagination;
|
|
14
11
|
removeKeys?: (string | number)[];
|
|
15
12
|
immediate?: boolean;
|
|
16
13
|
isPolling?: boolean;
|
|
17
|
-
|
|
14
|
+
showLoading?: boolean;
|
|
15
|
+
extra?: TableCurrentDataSource;
|
|
16
|
+
}
|
|
17
|
+
export type TableActionPlacement = 'left' | 'right';
|
|
18
18
|
export type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
19
19
|
export type ProFieldEmptyText = string | false;
|
|
20
20
|
export type ProTableRowSelection<T = any> = Omit<TableRowSelection<T>, 'selectedRowKeys'> & {
|
|
21
|
+
selectedRows?: T[];
|
|
21
22
|
selectedRowKeys?: (string | number)[];
|
|
22
23
|
};
|
|
23
24
|
export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'position'> {
|
|
@@ -25,112 +26,159 @@ export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'p
|
|
|
25
26
|
position?: TablePaginationPosition[];
|
|
26
27
|
}
|
|
27
28
|
export type ProTablePagination = ProTablePaginationConfig | false;
|
|
28
|
-
export
|
|
29
|
+
export interface PageState {
|
|
30
|
+
pageSize: number;
|
|
31
|
+
pageNum: number;
|
|
32
|
+
}
|
|
33
|
+
export interface RequestData<T = any> {
|
|
29
34
|
data: T[] | undefined;
|
|
30
35
|
success: boolean;
|
|
31
36
|
total: number;
|
|
32
|
-
}
|
|
33
|
-
export
|
|
34
|
-
params: {
|
|
35
|
-
pageSize
|
|
36
|
-
pageNum
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
filter:
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
}
|
|
38
|
+
export interface RequestConfig<T> {
|
|
39
|
+
params: T extends undefined ? PageState : {
|
|
40
|
+
pageSize: number;
|
|
41
|
+
pageNum: number;
|
|
42
|
+
} & Partial<T>;
|
|
43
|
+
sorter: TableSorterRecord[];
|
|
44
|
+
filter: Record<string, FilterValue | null>;
|
|
45
|
+
extra?: TableCurrentDataSource;
|
|
46
|
+
}
|
|
47
|
+
export type RequestFunction<T = any, D = undefined> = (props: RequestConfig<D>) => Promise<Partial<RequestData<T>> | undefined>;
|
|
42
48
|
export type ColConfig = Partial<Record<Breakpoint, number>>;
|
|
43
|
-
export
|
|
44
|
-
searchText?: string;
|
|
45
|
-
resetText?: string;
|
|
49
|
+
export interface SearchConfig {
|
|
46
50
|
className?: string;
|
|
51
|
+
actions?: {
|
|
52
|
+
reload?: boolean;
|
|
53
|
+
reset?: boolean;
|
|
54
|
+
searchText?: string;
|
|
55
|
+
resetText?: string;
|
|
56
|
+
};
|
|
57
|
+
collapsed?: boolean;
|
|
47
58
|
defaultCollapsed?: boolean;
|
|
48
|
-
|
|
49
|
-
showReset?: boolean;
|
|
59
|
+
autoRequest?: boolean;
|
|
50
60
|
collapseRender?: WithFalse<(collapsed?: boolean) => CustomRender>;
|
|
51
61
|
span?: ColConfig;
|
|
52
|
-
|
|
62
|
+
label?: {
|
|
63
|
+
gap?: number;
|
|
64
|
+
colon?: boolean;
|
|
65
|
+
width?: number;
|
|
66
|
+
align?: 'center' | 'left' | 'right';
|
|
67
|
+
};
|
|
68
|
+
}
|
|
53
69
|
export interface OptionConfig {
|
|
54
|
-
reload?: (() =>
|
|
55
|
-
|
|
56
|
-
setting?: boolean | ColumnSettingProps;
|
|
57
|
-
fullScreen?: (() => VueNode | JSX.Element) | boolean | (() => Promise<void>);
|
|
70
|
+
reload?: (() => CustomRender) | boolean;
|
|
71
|
+
fullScreen?: (() => CustomRender) | boolean | (() => Promise<void>);
|
|
58
72
|
}
|
|
59
73
|
/** action表格实例 */
|
|
60
|
-
export interface ProCoreActionType {
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
export interface ProCoreActionType<T = RecordType, R = RecordType> {
|
|
75
|
+
/** @name loadingStatus */
|
|
76
|
+
loading: Ref<boolean>;
|
|
77
|
+
dataSource: ComputedRef<T[]>;
|
|
78
|
+
getLoadingStatus: () => boolean;
|
|
79
|
+
pagination: R | boolean;
|
|
80
|
+
pageState: PageState;
|
|
81
|
+
selectedKeys: ComputedRef<(string | number)[]>;
|
|
82
|
+
selectedItems: ComputedRef<T[]>;
|
|
83
|
+
rowsSelection?: {
|
|
84
|
+
clear: () => void;
|
|
85
|
+
sync: (data: T[]) => void;
|
|
86
|
+
remove: (keys: (string | number)[]) => void;
|
|
87
|
+
select: SelectionSelectFn<T>;
|
|
88
|
+
selectAll: TableRowSelection<T>['onSelectAll'];
|
|
89
|
+
};
|
|
63
90
|
/** @name 刷新 */
|
|
64
|
-
reload
|
|
91
|
+
reload: (info?: ProTableFetchParams<R>) => void;
|
|
65
92
|
/** @name 刷新并清空表单,重置为第一页 */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
reloadAndReset: (options?: {
|
|
94
|
+
callBack?: () => void;
|
|
95
|
+
wait?: boolean;
|
|
96
|
+
}) => void;
|
|
97
|
+
/** @name 设置翻页 */
|
|
98
|
+
setPagination: (pagination: ProTablePaginationConfig) => void;
|
|
99
|
+
/** @name 设置翻页、排序、筛选、并且reload */
|
|
100
|
+
setPageAndReload: (pagination: ProTablePaginationConfig, filters?: Record<string, FilterValue | null>, sorter?: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
|
|
69
101
|
/** @name 更新TableData属性值 */
|
|
70
|
-
reSetDataList
|
|
102
|
+
reSetDataList: (data: T[]) => void;
|
|
71
103
|
/** @name 更新TableData属性值 */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
104
|
+
setDataValue: ({ key, type, row, value }: {
|
|
105
|
+
row?: Partial<T>;
|
|
106
|
+
key?: keyof T;
|
|
107
|
+
value?: any;
|
|
108
|
+
type?: 'update' | 'push' | 'delete' | 'unshift';
|
|
75
109
|
}) => void;
|
|
76
110
|
/** @name 改变loading状态 */
|
|
77
|
-
|
|
111
|
+
setLoading: (loading: boolean) => void;
|
|
78
112
|
}
|
|
79
113
|
/** form查询表单实例 */
|
|
80
|
-
export interface ProCoreFormType {
|
|
114
|
+
export interface ProCoreFormType<R = RecordType> {
|
|
81
115
|
/** @name 获取表格-表单请求参数 */
|
|
82
|
-
|
|
116
|
+
getFormState?: () => R;
|
|
83
117
|
/** @name 获取表格-内部表单参数 */
|
|
84
|
-
|
|
118
|
+
getFormInnerState?: () => R;
|
|
85
119
|
/** @name 重置内部表单组件参数 */
|
|
86
|
-
|
|
120
|
+
restFormState?: (callBack?: () => void) => void;
|
|
87
121
|
}
|
|
88
|
-
export interface ProTableRef {
|
|
89
|
-
formRef: () => ProCoreFormType
|
|
90
|
-
actionRef: () => ProCoreActionType
|
|
122
|
+
export interface ProTableRef<T = RecordType, R = RecordType> {
|
|
123
|
+
formRef: () => ProCoreFormType<R>;
|
|
124
|
+
actionRef: () => ProCoreActionType<T, R>;
|
|
91
125
|
}
|
|
92
|
-
export type ProTableProps<RecordType extends
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
126
|
+
export type ProTableProps<DataRecord extends object = RecordType, ParamsType extends object = RecordType> = Omit<TableProps, 'columns' | 'dataSource'> & Partial<{
|
|
127
|
+
dataSource: DataRecord[];
|
|
128
|
+
tableProps: {
|
|
129
|
+
class?: string;
|
|
130
|
+
style?: CSSProperties;
|
|
131
|
+
};
|
|
132
|
+
actionProps: {
|
|
133
|
+
placement?: TableActionPlacement;
|
|
134
|
+
actions?: DefaultRender[];
|
|
135
|
+
};
|
|
136
|
+
rowKey: keyof DataRecord;
|
|
96
137
|
titleTipText: string;
|
|
97
138
|
autoScroll: boolean;
|
|
139
|
+
showSearch: boolean;
|
|
140
|
+
keepAliveReload: boolean;
|
|
141
|
+
emptyTextProps: {
|
|
142
|
+
class?: string;
|
|
143
|
+
style?: CSSProperties;
|
|
144
|
+
extraProps?: RecordType;
|
|
145
|
+
};
|
|
98
146
|
columnEmptyText: ProFieldEmptyText;
|
|
147
|
+
showLoading: boolean;
|
|
99
148
|
neverScroll: boolean;
|
|
100
149
|
modalScroll: boolean;
|
|
101
150
|
scrollBreakpoint: Breakpoint | number;
|
|
102
|
-
|
|
151
|
+
useDefaultScrollStyle: boolean;
|
|
152
|
+
draggable: boolean;
|
|
103
153
|
bordered: boolean;
|
|
104
154
|
showIndex: boolean;
|
|
155
|
+
cardBordered: boolean;
|
|
105
156
|
virtualScroll: boolean;
|
|
106
157
|
size: SizeType;
|
|
107
158
|
align: ProColumnType['align'];
|
|
108
159
|
options: OptionConfig | boolean;
|
|
109
160
|
rowSelection: ProTableRowSelection;
|
|
110
|
-
columns: ProColumnsType<
|
|
111
|
-
columnsState: ColumnsStateType;
|
|
161
|
+
columns: ProColumnsType<DataRecord, ParamsType>;
|
|
112
162
|
waitRequest: boolean;
|
|
113
163
|
polling: number;
|
|
114
164
|
debounceTime: number;
|
|
115
|
-
request:
|
|
116
|
-
params:
|
|
117
|
-
postData: (data:
|
|
165
|
+
request: RequestFunction<DataRecord, ParamsType>;
|
|
166
|
+
params: ParamsType;
|
|
167
|
+
postData: (data: DataRecord[]) => DataRecord[];
|
|
118
168
|
pagination: ProTablePagination;
|
|
119
|
-
search: SearchConfig;
|
|
120
|
-
searchMap: ProSearchMap[];
|
|
121
|
-
onReset: (params?: Partial<
|
|
122
|
-
onReload: (params?: Partial<
|
|
123
|
-
onSubmit: (params?: Partial<
|
|
169
|
+
search: SearchConfig | false;
|
|
170
|
+
searchMap: ProSearchMap<undefined, keyof ParamsType | keyof DataRecord>[];
|
|
171
|
+
onReset: (params?: Partial<ParamsType>) => void;
|
|
172
|
+
onReload: (params?: Partial<ParamsType>) => void;
|
|
173
|
+
onSubmit: (params?: Partial<ParamsType>) => void;
|
|
124
174
|
onSizeChange: (size: string) => any;
|
|
125
175
|
onLoadingChange: (loading: boolean) => any;
|
|
126
176
|
onRequestError: (e: Error) => void;
|
|
127
|
-
onBeforeSearchSubmit:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
headerTitle:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
optionsExtra: OptionsExtraRender;
|
|
134
|
-
settingExtra: SettingExtraRender;
|
|
177
|
+
onBeforeSearchSubmit: RequestFunction<DataRecord, ParamsType>;
|
|
178
|
+
titleTip: DefaultRender;
|
|
179
|
+
emptyText: DefaultRender;
|
|
180
|
+
headerTitle: DefaultRender;
|
|
181
|
+
customRender: CustomDataRender;
|
|
182
|
+
settingExtra: DefaultRender;
|
|
135
183
|
pageItemRender: PageItemRender;
|
|
136
184
|
}>;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import type { ProColumnsValueType } from '../types/ColumnTypings';
|
|
2
|
-
|
|
2
|
+
import type { ProTablePagination } from '../types/TableTypings';
|
|
3
|
+
export declare function valueFormat(value: any, format: ProColumnsValueType | undefined, className: string, hashId: string): any;
|
|
4
|
+
export declare function getCurrentData(data: any[], pageInfo: ProTablePagination): any[];
|
|
5
|
+
export declare function handleCopy(codeStr: string): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gx-design-vue/pro-table",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.2.0-beta.131",
|
|
5
|
+
"description": "Gx Design Pro Table",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/pro-table.js",
|
|
10
|
+
"require": "./dist/pro-table.umd.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/pro-table.umd.cjs",
|
|
14
|
+
"module": "./dist/pro-table.js",
|
|
15
|
+
"types": "./dist",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"volar.d.ts"
|
|
19
|
+
],
|
|
4
20
|
"scripts": {
|
|
5
21
|
"dev": "vite",
|
|
6
22
|
"build": "vite build",
|
|
@@ -10,61 +26,25 @@
|
|
|
10
26
|
"typecheck": "vue-tsc --noEmit && vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
|
|
11
27
|
"lint": "TIMING=1 eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
|
|
12
28
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"types": "./dist",
|
|
18
|
-
"main": "./dist/pro-table.umd.js",
|
|
19
|
-
"module": "./dist/pro-table.mjs",
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"import": "./dist/pro-table.mjs",
|
|
23
|
-
"require": "./dist/pro-table.umd.js"
|
|
24
|
-
}
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"vxe-table": "^4.17.11",
|
|
31
|
+
"ant-design-vue": "^4.2.6",
|
|
32
|
+
"vue": ">=3.0.0"
|
|
25
33
|
},
|
|
26
34
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@gx-design-vue/pro-
|
|
29
|
-
"@gx-design-vue/pro-
|
|
30
|
-
"@gx-design-vue/pro-
|
|
31
|
-
"
|
|
35
|
+
"@gx-design-vue/pro-app": "^0.1.0-beta.33",
|
|
36
|
+
"@gx-design-vue/pro-hooks": "^0.2.0-beta.60",
|
|
37
|
+
"@gx-design-vue/pro-provider": "^0.1.0-beta.133",
|
|
38
|
+
"@gx-design-vue/pro-utils": "^0.2.0-beta.84",
|
|
39
|
+
"@vueuse/core": "^14.0.0",
|
|
32
40
|
"dayjs": "^1.11.0",
|
|
33
|
-
"lodash-es": "^4.17.21"
|
|
34
|
-
"vue": "^3.2.45",
|
|
35
|
-
"vue-types": "^4.1.1"
|
|
41
|
+
"lodash-es": "^4.17.21"
|
|
36
42
|
},
|
|
37
43
|
"devDependencies": {
|
|
38
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
39
|
-
"@rushstack/eslint-patch": "^1.1.0",
|
|
40
44
|
"@types/lodash-es": "^4.17.6",
|
|
41
|
-
"
|
|
42
|
-
"@types/node": "^16.11.26",
|
|
43
|
-
"@vitejs/plugin-vue": "^4.2.3",
|
|
44
|
-
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
|
45
|
-
"@vue/eslint-config-prettier": "^7.0.0",
|
|
46
|
-
"@vue/eslint-config-typescript": "^10.0.0",
|
|
47
|
-
"@vue/tsconfig": "^0.1.3",
|
|
48
|
-
"eslint": "^8.13.0",
|
|
49
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
50
|
-
"eslint-plugin-vue": "^8.6.0",
|
|
51
|
-
"jsdom": "^19.0.0",
|
|
52
|
-
"less": "^4.1.2",
|
|
53
|
-
"postcss": "^8.4.12",
|
|
54
|
-
"postcss-html": "^1.4.1",
|
|
55
|
-
"postcss-less": "^6.0.0",
|
|
56
|
-
"prettier": "^2.6.2",
|
|
57
|
-
"rollup": "^2.70.2",
|
|
58
|
-
"stylelint": "^14.7.1",
|
|
59
|
-
"stylelint-config-prettier": "^9.0.3",
|
|
60
|
-
"stylelint-config-recommended": "^7.0.0",
|
|
61
|
-
"stylelint-config-recommended-vue": "^1.4.0",
|
|
62
|
-
"stylelint-config-standard": "^25.0.0",
|
|
63
|
-
"stylelint-order": "^5.0.0",
|
|
64
|
-
"typescript": "^4.6.4",
|
|
65
|
-
"vite": "^4.3.8",
|
|
66
|
-
"vue-eslint-parser": "^9.0.3",
|
|
67
|
-
"vue-tsc": "^1.0.24"
|
|
45
|
+
"typescript": "^5.3.3"
|
|
68
46
|
},
|
|
69
|
-
"
|
|
47
|
+
"authors": [
|
|
48
|
+
"gx12358 <gx12358@gmail.com> (https://github.com/gx12358)"
|
|
49
|
+
]
|
|
70
50
|
}
|
package/volar.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Auto generated component declarations
|
|
2
|
-
declare module
|
|
2
|
+
declare module 'vue' {
|
|
3
3
|
export interface GlobalComponents {
|
|
4
|
-
GProTable: typeof import(
|
|
4
|
+
GProTable: typeof import('@gx-design-vue/pro-table')['GProTable'];
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export {}
|
|
8
|
+
export {}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useRefFunction: <T extends (...args: any) => any>(reFunction: T) => (...rest: Parameters<T>) => ReturnType<T>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
import type { SettingExtraRender } from '../../types/SlotsTypings';
|
|
3
|
-
export type ColumnSettingProps = {
|
|
4
|
-
draggable?: boolean;
|
|
5
|
-
checkable?: boolean;
|
|
6
|
-
extra?: SettingExtraRender;
|
|
7
|
-
checkedReset?: boolean;
|
|
8
|
-
};
|
|
9
|
-
declare const ColumnSetting: import("vue").DefineComponent<{
|
|
10
|
-
draggable: {
|
|
11
|
-
type: PropType<boolean | undefined>;
|
|
12
|
-
default: undefined;
|
|
13
|
-
};
|
|
14
|
-
checkable: {
|
|
15
|
-
type: PropType<boolean | undefined>;
|
|
16
|
-
default: undefined;
|
|
17
|
-
};
|
|
18
|
-
checkedReset: PropType<boolean | undefined>;
|
|
19
|
-
extra: PropType<SettingExtraRender>;
|
|
20
|
-
}, () => import("ant-design-vue/es/_util/type").VueNode, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
-
draggable: {
|
|
22
|
-
type: PropType<boolean | undefined>;
|
|
23
|
-
default: undefined;
|
|
24
|
-
};
|
|
25
|
-
checkable: {
|
|
26
|
-
type: PropType<boolean | undefined>;
|
|
27
|
-
default: undefined;
|
|
28
|
-
};
|
|
29
|
-
checkedReset: PropType<boolean | undefined>;
|
|
30
|
-
extra: PropType<SettingExtraRender>;
|
|
31
|
-
}>>, {
|
|
32
|
-
checkable: boolean | undefined;
|
|
33
|
-
draggable: boolean | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
export default ColumnSetting;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ProAliasToken } from '@gx-design-vue/pro-provider';
|
|
2
|
-
export interface ProToken extends ProAliasToken {
|
|
3
|
-
componentCls: string;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: (_prefixCls?: string | import("vue").Ref<string> | undefined) => import("ant-design-vue/es/theme/internal").UseComponentStyleResult;
|
|
6
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Ref, ComputedRef } from 'vue';
|
|
2
|
-
import type { ColumnsState } from './useColumnSetting';
|
|
3
|
-
import type { ProTableProps } from '../types/TableTypings';
|
|
4
|
-
import type { ProColumnType, ProColumnsType } from '../types/ColumnTypings';
|
|
5
|
-
export type ConfigColumns = {
|
|
6
|
-
draggabled: ComputedRef<ProTableProps['draggabled']>;
|
|
7
|
-
neverScroll: ComputedRef<ProTableProps['neverScroll']>;
|
|
8
|
-
autoScroll: ComputedRef<ProTableProps['autoScroll']>;
|
|
9
|
-
};
|
|
10
|
-
type UseColumnsType = {
|
|
11
|
-
scroll: ComputedRef<ProTableProps['scroll']>;
|
|
12
|
-
breakpoint: ComputedRef<boolean>;
|
|
13
|
-
columns: ComputedRef<ProColumnsType>;
|
|
14
|
-
} & ConfigColumns;
|
|
15
|
-
export declare function useConfigColumns(props: ProTableProps): ConfigColumns;
|
|
16
|
-
export declare function useColumns({ scroll, columns, breakpoint, draggabled, autoScroll, neverScroll }: UseColumnsType): {
|
|
17
|
-
breakpoint: ComputedRef<boolean>;
|
|
18
|
-
getProColumns: ComputedRef<ProColumnType<import("../typing").DefaultRecordType>[]>;
|
|
19
|
-
cacheProColumns: Ref<ProColumnsType<import("../typing").DefaultRecordType>>;
|
|
20
|
-
setColumns: (columnList: ProColumnsType<import("../typing").DefaultRecordType>) => void;
|
|
21
|
-
changeColumns: (columnState: Record<string, ColumnsState>) => void;
|
|
22
|
-
resizeColumnWidth: (w: number, col: ProColumnType) => void;
|
|
23
|
-
};
|
|
24
|
-
export {};
|