@gx-design-vue/pro-table 0.2.0-beta.14 → 0.2.0-beta.141
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 +293 -823
- 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 +37 -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} +2 -2
- package/dist/components/Form/index.d.ts +19 -28
- package/dist/components/Form/style.d.ts +1 -1
- 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 +32 -39
- package/dist/components/ListToolBar/style.d.ts +1 -1
- package/dist/components/ScrollBar/Bar/index.d.ts +44 -0
- package/dist/components/ScrollBar/Bar/props.d.ts +21 -0
- package/dist/components/ScrollBar/Thumb/index.d.ts +35 -0
- package/dist/components/ScrollBar/Thumb/props.d.ts +16 -0
- package/dist/components/ScrollBar/context.d.ts +11 -0
- package/dist/components/ScrollBar/util.d.ts +29 -0
- package/dist/components/ToolBar/FullscreenIcon.d.ts +1 -1
- package/dist/components/ToolBar/index.d.ts +24 -25
- package/dist/context/TableContext.d.ts +19 -17
- package/dist/hooks/tryOnActivated.d.ts +2 -0
- package/dist/hooks/useColumns.d.ts +18 -0
- package/dist/hooks/useDebounceFn.d.ts +2 -2
- package/dist/hooks/useFetchData.d.ts +24 -17
- 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/useScrollArea.d.ts +15 -0
- package/dist/hooks/useTable.d.ts +57 -11
- package/dist/hooks/useTableForm.d.ts +72 -10
- package/dist/hooks/useTableScroll.d.ts +14 -20
- package/dist/hooks/useTableSize.d.ts +4 -7
- package/dist/index.d.ts +8 -7
- package/dist/pro-table.js +2739 -0
- package/dist/pro-table.umd.cjs +12 -0
- package/dist/props.d.ts +129 -390
- package/dist/{components/ColumnSetting/style.d.ts → style/fit-page.d.ts} +2 -2
- package/dist/style/index.d.ts +6 -0
- package/dist/{style.d.ts → style/list.d.ts} +2 -2
- package/dist/style/scroll.d.ts +3 -0
- package/dist/types/ColumnTypings.d.ts +54 -16
- package/dist/types/SlotsTypings.d.ts +47 -9
- package/dist/types/TableTypings.d.ts +171 -80
- package/dist/utils/utils.d.ts +5 -1
- package/package.json +33 -52
- 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/ToolBar/DensityIcon.d.ts +0 -3
- package/dist/hooks/useColumnSetting.d.ts +0 -31
- package/dist/hooks/useColums.d.ts +0 -24
- package/dist/pro-table.mjs +0 -34948
- package/dist/pro-table.umd.js +0 -327
- package/dist/typing.d.ts +0 -1
- package/dist/utils/config.d.ts +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProAliasToken } from '@gx-design-vue/pro-provider';
|
|
2
|
+
import type { GenerateStyle } from 'ant-design-vue/es/theme/internal';
|
|
3
|
+
export * from './list';
|
|
4
|
+
export * from './scroll';
|
|
5
|
+
export * from './fit-page';
|
|
6
|
+
export declare const genProTableStyle: GenerateStyle<ProAliasToken>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { GenerateStyle } from 'ant-design-vue/es/theme/internal';
|
|
2
1
|
import type { ProAliasToken } from '@gx-design-vue/pro-provider';
|
|
3
|
-
|
|
2
|
+
import type { GenerateStyle } from 'ant-design-vue/es/theme/internal';
|
|
3
|
+
export declare const genProTableList: GenerateStyle<ProAliasToken>;
|
|
@@ -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,31 @@
|
|
|
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, SemanticClassNames, SemanticStyles, 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
|
+
export interface TableScroll {
|
|
20
|
+
x?: number | string;
|
|
21
|
+
y?: number | string;
|
|
22
|
+
}
|
|
23
|
+
export type TableSemanticName = 'root' | 'content' | 'search' | 'searchItem' | 'searchControl' | 'searchContent' | 'searchText' | 'searchButtons' | 'card' | 'toolbar' | 'toolbarAfter' | 'toolbarLeft' | 'toolbarRight' | 'list' | 'listContent' | 'pagination' | 'table';
|
|
24
|
+
export type TableStylesType = SemanticStyles<TableSemanticName>;
|
|
25
|
+
export type TableClassNamesType = SemanticClassNames<TableSemanticName>;
|
|
19
26
|
export type ProFieldEmptyText = string | false;
|
|
20
27
|
export type ProTableRowSelection<T = any> = Omit<TableRowSelection<T>, 'selectedRowKeys'> & {
|
|
28
|
+
selectedRows?: T[];
|
|
21
29
|
selectedRowKeys?: (string | number)[];
|
|
22
30
|
};
|
|
23
31
|
export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'position'> {
|
|
@@ -25,112 +33,195 @@ export interface ProTablePaginationConfig extends Omit<TablePaginationConfig, 'p
|
|
|
25
33
|
position?: TablePaginationPosition[];
|
|
26
34
|
}
|
|
27
35
|
export type ProTablePagination = ProTablePaginationConfig | false;
|
|
28
|
-
export
|
|
36
|
+
export interface PageState {
|
|
37
|
+
current: number;
|
|
38
|
+
pageSize: number;
|
|
39
|
+
total?: number;
|
|
40
|
+
}
|
|
41
|
+
export interface RequestData<T = any> {
|
|
29
42
|
data: T[] | undefined;
|
|
30
|
-
success
|
|
31
|
-
total
|
|
32
|
-
}
|
|
33
|
-
export
|
|
34
|
-
params:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
41
|
-
export type RequsetFunction<T = any> = (params: RequsetConfig['params'], sort: RequsetConfig['sort'], filter: RequsetConfig['filter']) => Promise<Partial<RequestData<T>>>;
|
|
43
|
+
success?: boolean;
|
|
44
|
+
total?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface RequestConfig<T> {
|
|
47
|
+
params: T extends undefined ? PageState : PageState & Partial<T>;
|
|
48
|
+
sorter: TableSorterRecord[];
|
|
49
|
+
filter: Record<string, FilterValue | null>;
|
|
50
|
+
extra?: TableCurrentDataSource;
|
|
51
|
+
}
|
|
52
|
+
export type RequestFunction<T = any, D = undefined> = (props: RequestConfig<D>) => Promise<Partial<RequestData<T>> | undefined>;
|
|
42
53
|
export type ColConfig = Partial<Record<Breakpoint, number>>;
|
|
43
|
-
export
|
|
44
|
-
searchText?: string;
|
|
45
|
-
resetText?: string;
|
|
54
|
+
export interface FormConfig {
|
|
46
55
|
className?: string;
|
|
56
|
+
/** @name actions 表单动作的配置参数 */
|
|
57
|
+
/** @params reset 是否展示重置按钮 */
|
|
58
|
+
/** @params resetReload 重置按钮点击后是否重新请求数据 */
|
|
59
|
+
/** @params searchText 搜索按钮文案 */
|
|
60
|
+
/** @params resetText 重置按钮文案 */
|
|
61
|
+
actions?: {
|
|
62
|
+
reset?: boolean;
|
|
63
|
+
resetReload?: boolean;
|
|
64
|
+
searchText?: string;
|
|
65
|
+
resetText?: string;
|
|
66
|
+
};
|
|
67
|
+
/** @name collapsed 收起状态 */
|
|
68
|
+
collapsed?: boolean;
|
|
69
|
+
/** @name defaultCollapsed 默认收起状态 */
|
|
47
70
|
defaultCollapsed?: boolean;
|
|
48
|
-
|
|
49
|
-
|
|
71
|
+
/** @name autoRequest 表单搜索条件变化后自动请求request */
|
|
72
|
+
autoRequest?: boolean;
|
|
73
|
+
/** @name collapseRender 展开收起自定义渲染 */
|
|
50
74
|
collapseRender?: WithFalse<(collapsed?: boolean) => CustomRender>;
|
|
75
|
+
/** @name span 支持断点('xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs')一行展示几个 */
|
|
76
|
+
/** @name demo { xl: 4, lg: 3 } */
|
|
51
77
|
span?: ColConfig;
|
|
52
|
-
|
|
78
|
+
/** @name breakpoint 断点配置支持写入具体宽度 一行展示几个(这里是指大于宽度生效),优先级比span要高 */
|
|
79
|
+
/** @name demo { 1440: 4 } */
|
|
80
|
+
breakpoint?: Record<number, number>;
|
|
81
|
+
gap?: number | string;
|
|
82
|
+
/** @name label 搜索表单的label配置参数 */
|
|
83
|
+
/** @params gap label与表单项之间的间隔:仅支持数字 */
|
|
84
|
+
/** @params width label的宽度:支持数字和字符 */
|
|
85
|
+
/** @params colon label与表单项之间的间否使用冒号间隔 */
|
|
86
|
+
/** @params align label在宽度内的对齐方式:'center' | 'left' | 'right' */
|
|
87
|
+
label?: {
|
|
88
|
+
gap?: number;
|
|
89
|
+
colon?: boolean;
|
|
90
|
+
width?: number | string;
|
|
91
|
+
align?: 'center' | 'left' | 'right';
|
|
92
|
+
};
|
|
93
|
+
}
|
|
53
94
|
export interface OptionConfig {
|
|
54
|
-
reload?: (() =>
|
|
55
|
-
|
|
56
|
-
setting?: boolean | ColumnSettingProps;
|
|
57
|
-
fullScreen?: (() => VueNode | JSX.Element) | boolean | (() => Promise<void>);
|
|
95
|
+
reload?: (() => CustomRender) | boolean;
|
|
96
|
+
fullScreen?: (() => CustomRender) | boolean | (() => Promise<void>);
|
|
58
97
|
}
|
|
59
98
|
/** action表格实例 */
|
|
60
|
-
export interface ProCoreActionType {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/** @name
|
|
64
|
-
|
|
99
|
+
export interface ProCoreActionType<T = RecordType, R = RecordType> {
|
|
100
|
+
/** @name loading 状态,可以直接进行修改 */
|
|
101
|
+
loading: Ref<boolean>;
|
|
102
|
+
/** @name 只读表格数据,不能修改 */
|
|
103
|
+
dataSource: ComputedRef<T[]>;
|
|
104
|
+
/** @name 主动表格loading状态 */
|
|
105
|
+
getLoadingStatus: () => boolean;
|
|
106
|
+
/** @name 表格翻页参数 */
|
|
107
|
+
pagination: R | boolean;
|
|
108
|
+
/** @name 表格的翻页参数(只有current、pageSize、total) */
|
|
109
|
+
pageInfo: PageState;
|
|
110
|
+
/** @name 表格列选择keys,只读 */
|
|
111
|
+
selectedKeys: ComputedRef<(string | number)[]>;
|
|
112
|
+
/** @name 表格列选择rows,只读 */
|
|
113
|
+
selectedItems: ComputedRef<T[]>;
|
|
114
|
+
/** @name 表格列选项操作 */
|
|
115
|
+
rowsSelection?: {
|
|
116
|
+
/** @name 清楚全部选项 */
|
|
117
|
+
clear: () => void;
|
|
118
|
+
/** @name 表格数据变化后,主动同步选择项 */
|
|
119
|
+
sync: (data: T[]) => void;
|
|
120
|
+
/** @name 删除选择项 */
|
|
121
|
+
remove: (keys: (string | number)[]) => void;
|
|
122
|
+
/** @name 选中选择项 */
|
|
123
|
+
select: SelectionSelectFn<T>;
|
|
124
|
+
/** @name 当前表格数据全部选择 */
|
|
125
|
+
selectAll: TableRowSelection<T>['onSelectAll'];
|
|
126
|
+
};
|
|
127
|
+
/** @name 主动刷新,按照当前的参数在当前页重新请求下 */
|
|
128
|
+
reload: (info?: ProTableFetchParams<R>) => void;
|
|
65
129
|
/** @name 刷新并清空表单,重置为第一页 */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
130
|
+
reloadAndReset: (options?: {
|
|
131
|
+
callBack?: () => void;
|
|
132
|
+
wait?: boolean;
|
|
133
|
+
}) => void;
|
|
134
|
+
/** @name 设置翻页参数 */
|
|
135
|
+
setPagination: (pagination: ProTablePaginationConfig) => void;
|
|
136
|
+
/** @name 设置翻页、排序、筛选、并且刷新(reload) */
|
|
137
|
+
setPageInfo: (pagination: ProTablePaginationConfig, filters?: Record<string, FilterValue | null>, sorter?: SorterResult | SorterResult[], extra?: TableCurrentDataSource) => void;
|
|
138
|
+
/** @name 更新表格数据,直接替换,谨慎操作 */
|
|
139
|
+
setTableDataList: (data: T[]) => void;
|
|
71
140
|
/** @name 更新TableData属性值 */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
141
|
+
operateTableDataRow: ({ key, type, row, value }: {
|
|
142
|
+
/** @name 更新、添加(后、前)操作需要传入的参数 */
|
|
143
|
+
row?: Partial<T>;
|
|
144
|
+
/** @name 这里是表格数据的唯一字段,确保字段值为唯一 */
|
|
145
|
+
key?: keyof T;
|
|
146
|
+
/** @name 更新、删除操作时,要把要操作的row的唯一字段的值传入,用作判断 */
|
|
147
|
+
value?: any;
|
|
148
|
+
/** @name 操作类型:更新、后新增、删除、前新增 */
|
|
149
|
+
type?: 'update' | 'push' | 'delete' | 'unshift';
|
|
75
150
|
}) => void;
|
|
76
151
|
/** @name 改变loading状态 */
|
|
77
|
-
|
|
152
|
+
setLoading: (loading: boolean) => void;
|
|
78
153
|
}
|
|
79
154
|
/** form查询表单实例 */
|
|
80
|
-
export interface ProCoreFormType {
|
|
155
|
+
export interface ProCoreFormType<R = RecordType> {
|
|
81
156
|
/** @name 获取表格-表单请求参数 */
|
|
82
|
-
|
|
157
|
+
getFormSearch?: () => R;
|
|
83
158
|
/** @name 获取表格-内部表单参数 */
|
|
84
|
-
|
|
159
|
+
getFormInnerState?: () => R;
|
|
85
160
|
/** @name 重置内部表单组件参数 */
|
|
86
|
-
|
|
161
|
+
restFormState?: (callBack?: () => void) => void;
|
|
87
162
|
}
|
|
88
|
-
export interface ProTableRef {
|
|
89
|
-
formRef: () => ProCoreFormType
|
|
90
|
-
actionRef: () => ProCoreActionType
|
|
163
|
+
export interface ProTableRef<T = RecordType, R = RecordType> {
|
|
164
|
+
formRef: () => ProCoreFormType<R>;
|
|
165
|
+
actionRef: () => ProCoreActionType<T, R>;
|
|
91
166
|
}
|
|
92
|
-
export type ProTableProps<RecordType extends
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
167
|
+
export type ProTableProps<DataRecord extends object = RecordType, ParamsType extends object = RecordType> = Omit<TableProps, 'columns' | 'dataSource'> & Partial<{
|
|
168
|
+
fitPage: boolean;
|
|
169
|
+
class: string;
|
|
170
|
+
style: CSSProperties;
|
|
171
|
+
id: string;
|
|
172
|
+
classNames: TableClassNamesType;
|
|
173
|
+
styles: TableStylesType;
|
|
174
|
+
dataSource: DataRecord[];
|
|
175
|
+
actionProps: {
|
|
176
|
+
placement?: TableActionPlacement;
|
|
177
|
+
actions?: DefaultRender[];
|
|
178
|
+
};
|
|
179
|
+
rowKey: keyof DataRecord;
|
|
96
180
|
titleTipText: string;
|
|
97
181
|
autoScroll: boolean;
|
|
182
|
+
showSearch: boolean;
|
|
183
|
+
keepAliveReload: boolean;
|
|
184
|
+
emptyTextProps: {
|
|
185
|
+
class?: string;
|
|
186
|
+
style?: CSSProperties;
|
|
187
|
+
extraProps?: RecordType;
|
|
188
|
+
};
|
|
98
189
|
columnEmptyText: ProFieldEmptyText;
|
|
190
|
+
showLoading: boolean;
|
|
99
191
|
neverScroll: boolean;
|
|
100
192
|
modalScroll: boolean;
|
|
101
193
|
scrollBreakpoint: Breakpoint | number;
|
|
102
|
-
|
|
194
|
+
draggable: boolean;
|
|
103
195
|
bordered: boolean;
|
|
104
196
|
showIndex: boolean;
|
|
197
|
+
cardBordered: boolean;
|
|
105
198
|
virtualScroll: boolean;
|
|
106
199
|
size: SizeType;
|
|
107
200
|
align: ProColumnType['align'];
|
|
108
201
|
options: OptionConfig | boolean;
|
|
109
202
|
rowSelection: ProTableRowSelection;
|
|
110
|
-
columns: ProColumnsType<
|
|
111
|
-
columnsState: ColumnsStateType;
|
|
203
|
+
columns: ProColumnsType<DataRecord, ParamsType>;
|
|
112
204
|
waitRequest: boolean;
|
|
113
205
|
polling: number;
|
|
114
206
|
debounceTime: number;
|
|
115
|
-
request:
|
|
116
|
-
|
|
117
|
-
|
|
207
|
+
request: RequestFunction<DataRecord, ParamsType>;
|
|
208
|
+
autoRequest: boolean;
|
|
209
|
+
params: ParamsType;
|
|
210
|
+
postData: (data: DataRecord[]) => DataRecord[];
|
|
118
211
|
pagination: ProTablePagination;
|
|
119
|
-
|
|
120
|
-
searchMap: ProSearchMap[];
|
|
121
|
-
onReset: (params?: Partial<
|
|
122
|
-
onReload: (params?: Partial<
|
|
123
|
-
onSubmit: (params?: Partial<
|
|
212
|
+
form: FormConfig | false;
|
|
213
|
+
searchMap: ProSearchMap<undefined, keyof ParamsType | keyof DataRecord>[];
|
|
214
|
+
onReset: (params?: Partial<ParamsType>) => void;
|
|
215
|
+
onReload: (params?: Partial<ParamsType>) => void;
|
|
216
|
+
onSubmit: (params?: Partial<ParamsType>) => void;
|
|
124
217
|
onSizeChange: (size: string) => any;
|
|
125
218
|
onLoadingChange: (loading: boolean) => any;
|
|
126
219
|
onRequestError: (e: Error) => void;
|
|
127
|
-
onBeforeSearchSubmit:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
customRender:
|
|
133
|
-
optionsExtra: OptionsExtraRender;
|
|
134
|
-
settingExtra: SettingExtraRender;
|
|
220
|
+
onBeforeSearchSubmit: RequestFunction<DataRecord, ParamsType>;
|
|
221
|
+
emptyText: DefaultRender;
|
|
222
|
+
headerTitle: DefaultRender;
|
|
223
|
+
headerTitleTip: DefaultRender;
|
|
224
|
+
listToolAfter: DefaultRender;
|
|
225
|
+
customRender: CustomDataRender;
|
|
135
226
|
pageItemRender: PageItemRender;
|
|
136
227
|
}>;
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
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;
|
|
6
|
+
export declare function watchElementHeightByClass(root: string | (() => (HTMLElement | undefined | null)), onChange: (el: HTMLElement | undefined) => void): () => 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.141",
|
|
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,62 +26,27 @@
|
|
|
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/
|
|
30
|
-
"@gx-design-vue/pro-
|
|
31
|
-
"@gx-design-vue/pro-
|
|
32
|
-
"
|
|
35
|
+
"@ctrl/tinycolor": "^3.5.0",
|
|
36
|
+
"@gx-design-vue/pro-app": "^0.1.0-beta.35",
|
|
37
|
+
"@gx-design-vue/context": "^0.0.5",
|
|
38
|
+
"@gx-design-vue/pro-hooks": "^0.2.0-beta.61",
|
|
39
|
+
"@gx-design-vue/pro-provider": "^0.1.0-beta.140",
|
|
40
|
+
"@gx-design-vue/pro-utils": "^0.2.0-beta.87",
|
|
41
|
+
"@vueuse/core": "^14.0.0",
|
|
33
42
|
"dayjs": "^1.11.0",
|
|
34
|
-
"lodash-es": "^4.17.21"
|
|
35
|
-
"vue": "^3.2.45",
|
|
36
|
-
"vue-types": "^4.1.1"
|
|
43
|
+
"lodash-es": "^4.17.21"
|
|
37
44
|
},
|
|
38
45
|
"devDependencies": {
|
|
39
|
-
"@rollup/plugin-typescript": "^8.3.0",
|
|
40
|
-
"@rushstack/eslint-patch": "^1.1.0",
|
|
41
46
|
"@types/lodash-es": "^4.17.6",
|
|
42
|
-
"
|
|
43
|
-
"@types/node": "^16.11.26",
|
|
44
|
-
"@vitejs/plugin-vue": "^4.2.3",
|
|
45
|
-
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
|
46
|
-
"@vue/eslint-config-prettier": "^7.0.0",
|
|
47
|
-
"@vue/eslint-config-typescript": "^10.0.0",
|
|
48
|
-
"@vue/tsconfig": "^0.1.3",
|
|
49
|
-
"eslint": "^8.13.0",
|
|
50
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
51
|
-
"eslint-plugin-vue": "^8.6.0",
|
|
52
|
-
"jsdom": "^19.0.0",
|
|
53
|
-
"less": "^4.1.2",
|
|
54
|
-
"postcss": "^8.4.12",
|
|
55
|
-
"postcss-html": "^1.4.1",
|
|
56
|
-
"postcss-less": "^6.0.0",
|
|
57
|
-
"prettier": "^2.6.2",
|
|
58
|
-
"rollup": "^2.70.2",
|
|
59
|
-
"stylelint": "^14.7.1",
|
|
60
|
-
"stylelint-config-prettier": "^9.0.3",
|
|
61
|
-
"stylelint-config-recommended": "^7.0.0",
|
|
62
|
-
"stylelint-config-recommended-vue": "^1.4.0",
|
|
63
|
-
"stylelint-config-standard": "^25.0.0",
|
|
64
|
-
"stylelint-order": "^5.0.0",
|
|
65
|
-
"typescript": "^4.6.4",
|
|
66
|
-
"vite": "^4.3.8",
|
|
67
|
-
"vue-eslint-parser": "^9.0.3",
|
|
68
|
-
"vue-tsc": "^1.0.24"
|
|
47
|
+
"typescript": "^5.3.3"
|
|
69
48
|
},
|
|
70
|
-
"
|
|
49
|
+
"authors": [
|
|
50
|
+
"gx12358 <gx12358@gmail.com> (https://github.com/gx12358)"
|
|
51
|
+
]
|
|
71
52
|
}
|
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>;
|