@gx-design-vue/pro-table 0.2.0-beta.74 → 0.2.0-beta.76

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/props.d.ts CHANGED
@@ -29,7 +29,6 @@ export declare const proTableProps: {
29
29
  };
30
30
  virtualScroll: PropType<ProTableProps["virtualScroll"]>;
31
31
  params: PropType<ProTableProps["params"]>;
32
- postData: PropType<ProTableProps["postData"]>;
33
32
  waitRequest: {
34
33
  type: PropType<ProTableProps["waitRequest"]>;
35
34
  default: boolean;
@@ -67,12 +66,6 @@ export declare const proTableProps: {
67
66
  type: PropType<ProTableProps["emptyText"]>;
68
67
  default: () => undefined;
69
68
  };
70
- /**
71
- * @Author gx12358
72
- * @DateTime 2022/2/8
73
- * @lastTime 2022/2/8
74
- * @description 添加表格class
75
- */
76
69
  showLoading: {
77
70
  type: PropType<ProTableProps["showLoading"]>;
78
71
  default: boolean;
@@ -244,6 +237,7 @@ export declare const proTableProps: {
244
237
  * @lastTime 2022/2/8
245
238
  * @description Pro-Table 的方法
246
239
  */
240
+ postData: PropType<ProTableProps["postData"]>;
247
241
  onReset: PropType<ProTableProps["onReset"]>;
248
242
  onReload: PropType<ProTableProps["onReload"]>;
249
243
  onSubmit: PropType<ProTableProps["onSubmit"]>;
@@ -252,167 +246,19 @@ export declare const proTableProps: {
252
246
  onRequestError: PropType<ProTableProps["onRequestError"]>;
253
247
  onBeforeSearchSubmit: PropType<ProTableProps["onBeforeSearchSubmit"]>;
254
248
  onColumnsStateChange: PropType<ProTableProps["onColumnsStateChange"]>;
255
- prefixCls: {
256
- type: PropType<string>;
257
- default: undefined;
258
- };
259
- tableLayout: {
260
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["tableLayout"]>;
261
- default: undefined;
262
- };
263
- rowClassName: {
264
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["rowClassName"]>;
265
- default: undefined;
266
- };
267
- title: {
268
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["title"]>;
269
- default: undefined;
270
- };
271
- footer: {
272
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["footer"]>;
273
- default: undefined;
274
- };
275
- id: {
276
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["id"]>;
277
- default: undefined;
278
- };
279
- showHeader: {
280
- type: PropType<boolean>;
281
- default: undefined;
282
- };
283
- components: {
284
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["components"]>;
285
- default: undefined;
286
- };
287
- customRow: {
288
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["customRow"]>;
289
- default: undefined;
290
- };
291
- customHeaderRow: {
292
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["customHeaderRow"]>;
293
- default: undefined;
294
- };
295
- direction: {
296
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["direction"]>;
297
- default: undefined;
298
- };
299
- expandFixed: {
300
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["expandFixed"]>;
301
- default: undefined;
302
- };
303
- expandColumnWidth: {
304
- type: PropType<number>;
305
- default: undefined;
306
- };
307
- expandedRowKeys: {
308
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["expandedRowKeys"]>;
309
- default: undefined;
310
- };
311
- defaultExpandedRowKeys: {
312
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["defaultExpandedRowKeys"]>;
313
- default: undefined;
314
- };
315
- expandedRowRender: {
316
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["expandedRowRender"]>;
317
- default: undefined;
318
- };
319
- expandRowByClick: {
320
- type: PropType<boolean>;
321
- default: undefined;
322
- };
323
- expandIcon: {
324
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["expandIcon"]>;
325
- default: undefined;
326
- };
327
- onExpand: {
328
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["onExpand"]>;
329
- default: undefined;
330
- };
331
- onExpandedRowsChange: {
332
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["onExpandedRowsChange"]>;
333
- default: undefined;
334
- };
335
- 'onUpdate:expandedRowKeys': {
336
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["onExpandedRowsChange"]>;
337
- default: undefined;
338
- };
339
- defaultExpandAllRows: {
340
- type: PropType<boolean>;
341
- default: undefined;
342
- };
343
- indentSize: {
344
- type: PropType<number>;
345
- default: undefined;
346
- };
347
- expandIconColumnIndex: {
348
- type: PropType<number>;
349
- default: undefined;
350
- };
351
- showExpandColumn: {
352
- type: PropType<boolean>;
353
- default: undefined;
354
- };
355
- expandedRowClassName: {
356
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["expandedRowClassName"]>;
357
- default: undefined;
358
- };
359
- childrenColumnName: {
360
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["childrenColumnName"]>;
361
- default: undefined;
362
- };
363
- rowExpandable: {
364
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["rowExpandable"]>;
365
- default: undefined;
366
- };
367
- sticky: {
368
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["sticky"]>;
369
- default: undefined;
370
- };
371
- dropdownPrefixCls: {
372
- type: PropType<string>;
373
- default: undefined;
374
- };
375
- dataSource: {
376
- type: PropType<import("ant-design-vue/es/vc-table/Table").TableProps["data"]>;
377
- default: undefined;
378
- };
379
249
  loading: {
380
250
  type: PropType<boolean | import("ant-design-vue/es/spin/Spin").SpinProps>;
381
251
  default: undefined;
382
252
  };
383
- locale: {
384
- type: PropType<import("ant-design-vue/es/table/interface").TableLocale>;
385
- default: undefined;
386
- };
387
- onChange: {
388
- type: PropType<(pagination: import("./types/TableTypings").ProTablePagination, filters: Record<string, import("ant-design-vue/es/table/interface").FilterValue | null>, sorter: import("ant-design-vue/es/table/interface").SorterResult | import("ant-design-vue/es/table/interface").SorterResult[], extra: import("ant-design-vue/es/table/interface").TableCurrentDataSource) => void>;
389
- default: undefined;
390
- };
391
- onResizeColumn: {
392
- type: PropType<(w: number, col: import("ant-design-vue/es/table/interface").ColumnType) => void>;
393
- default: undefined;
394
- };
395
- getPopupContainer: {
396
- type: PropType<import("ant-design-vue/es/table/interface").GetPopupContainer>;
397
- default: undefined;
398
- };
399
253
  scroll: {
400
254
  type: PropType<import("ant-design-vue/es/vc-table/Table").TableProps["scroll"] & {
401
255
  scrollToFirstRowOnChange?: boolean;
402
256
  }>;
403
257
  default: undefined;
404
258
  };
405
- sortDirections: {
406
- type: PropType<import("ant-design-vue/es/table/interface").SortOrder[]>;
407
- default: undefined;
408
- };
409
- showSorterTooltip: {
410
- type: PropType<boolean | import("ant-design-vue").TooltipProps>;
411
- default: boolean;
412
- };
413
- transformCellText: {
414
- type: PropType<import("ant-design-vue/es/table/Table").TableProps["transformCellText"]>;
415
- default: undefined;
259
+ 'onUpdate:expandedRowKeys': {
260
+ type: import("vue").PropType<(expandedKeys: import("ant-design-vue/es/vc-table/interface").Key[]) => void>;
261
+ default: (expandedKeys: import("ant-design-vue/es/vc-table/interface").Key[]) => void;
416
262
  };
417
263
  };
418
264
  export type BaseTableProps = Partial<ExtractPropTypes<typeof proTableProps>>;
@@ -1,4 +1,4 @@
1
- import type { ProColumn, RecordType, VueNode } from '@gx-design-vue/pro-utils';
1
+ import type { ProColumn, VueNode } from '@gx-design-vue/pro-utils';
2
2
  import type { DefaultRecordType } from '../typing';
3
3
  import type { ColumnType } from '../_utils';
4
4
  /**
@@ -50,13 +50,13 @@ export type ProSearchMap<ValueType = 'text', ParamsKey = string> = {
50
50
  /** valueType为select生效 */
51
51
  loading?: boolean;
52
52
  /** valueType为date、dateRange生效 */
53
- showTime?: RecordType | boolean;
53
+ showTime?: DefaultRecordType | boolean;
54
54
  /** 搜索表单的默认值 */
55
55
  initialValue?: any;
56
56
  /** 针对select、treeselect取值的key */
57
57
  valueKey?: string;
58
58
  /** 表单的属性值(ant-design) */
59
- field?: RecordType;
59
+ field?: DefaultRecordType;
60
60
  /**
61
61
  * 支持 object 和Map,Map 是支持其他基础类型作为 key
62
62
  *
@@ -64,7 +64,7 @@ export type ProSearchMap<ValueType = 'text', ParamsKey = string> = {
64
64
  */
65
65
  valueEnum?: ProSchemaValueEnumType[];
66
66
  };
67
- export type ProColumnType<DataValue = DefaultRecordType, SearchParama = RecordType> = ProColumn<Omit<ColumnType<DataValue>, 'key' | 'dataIndex' | 'width'> & {
67
+ export type ProColumnType<DataValue = DefaultRecordType, SearchParama = DefaultRecordType> = ProColumn<Omit<ColumnType<DataValue>, 'key' | 'dataIndex' | 'width'> & {
68
68
  children?: ProColumnsType<DataValue, SearchParama>;
69
69
  uuid?: string | number;
70
70
  index?: number;
@@ -84,7 +84,7 @@ export type ProColumnType<DataValue = DefaultRecordType, SearchParama = RecordTy
84
84
  columnEmptyText?: string;
85
85
  valueType?: ProColumnsValueType;
86
86
  }>;
87
- export type ProColumnsType<DataValue = DefaultRecordType, SearchParama = RecordType> = ProColumnType<DataValue, SearchParama>[];
87
+ export type ProColumnsType<DataValue = DefaultRecordType, SearchParama = DefaultRecordType> = ProColumnType<DataValue, SearchParama>[];
88
88
  export type ProColumnsValueType = 'text' | 'link' | 'time' | 'dateMonth' | 'dateTime' | {
89
89
  node?: string;
90
90
  class?: string;
@@ -1,7 +1,8 @@
1
- import type { CustomRender, RecordType, WithFalse } from '@gx-design-vue/pro-utils';
1
+ import type { CustomRender, WithFalse } from '@gx-design-vue/pro-utils';
2
+ import type { DefaultRecordType } from '../typing';
2
3
  import type { ProColumnType } from '../types/ColumnTypings';
3
4
  import type { ColumnType, RenderExpandIconProps } from '../_utils';
4
- export type ProTableBodyCellProps<T = Record<string, any>> = {
5
+ export type ProTableBodyCellProps<T = DefaultRecordType> = {
5
6
  text: any;
6
7
  value: any;
7
8
  record: T;
@@ -28,9 +29,9 @@ export type AntTabelSlotsType = {
28
29
  export type ProTableSlotsKey = 'search' | 'headerTitle' | 'toolBarBtn' | 'titleTip' | 'settingExtra' | 'optionsExtra' | 'pageItemRender' | 'customRender';
29
30
  export declare const proTableSlotsKey: ProTableSlotsKey[];
30
31
  export type Slots = Readonly<Omit<Record<ProTableSlotsKey, () => void>, 'customRender'> & {
31
- customRender: (currentData: any[], dataSource: any[]) => void;
32
+ customRender: (params: CustomRenderResult) => void;
32
33
  }>;
33
- export type CustomRenderResult<T = RecordType> = {
34
+ export type CustomRenderResult<T = DefaultRecordType> = {
34
35
  currentData: T[];
35
36
  dataSource: T[];
36
37
  };
@@ -39,7 +40,7 @@ export type PageItemFn = (opt: {
39
40
  type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next';
40
41
  originalElement: any;
41
42
  }) => CustomRender;
42
- export type CustomDataFn<T = any> = (params: CustomRenderResult<T>) => CustomRender;
43
+ export type CustomDataFn<T = DefaultRecordType> = (params: CustomRenderResult<T>) => CustomRender;
43
44
  export type DefaultRender = WithFalse<CustomRender>;
44
45
  export type PageItemRender = WithFalse<PageItemFn>;
45
- export type CustomDataRender = WithFalse<CustomDataFn>;
46
+ export type CustomDataRender<T = DefaultRecordType> = WithFalse<CustomDataFn<T>>;
@@ -1,11 +1,12 @@
1
1
  import type { CSSProperties, ComputedRef, Ref } from 'vue';
2
- import type { Breakpoint, CustomRender, RecordType, SizeType, VueNode, WithFalse } from '@gx-design-vue/pro-utils';
2
+ import type { Breakpoint, CustomRender, SizeType, VueNode, WithFalse } from '@gx-design-vue/pro-utils';
3
3
  import type { ProColumnType, ProColumnsType, ProSearchMap } from './ColumnTypings';
4
4
  import type { CustomDataRender, DefaultRender, PageItemRender } from './SlotsTypings';
5
- import type { FilterValue, SorterResult, TableCurrentDataSource, TablePaginationConfig, TableProps, TableRowSelection } from '../_utils';
5
+ import type { FilterValue, SelectionSelectFn, SorterResult, TableCurrentDataSource, TablePaginationConfig, TableProps, TableRowSelection } from '../_utils';
6
+ import type { DefaultRecordType } from '../typing';
6
7
  import type { ColumnSettingProps } from '../components/ColumnSetting';
7
8
  import type { ColumnsState, ColumnsStateType } from '../hooks/useColumnSetting';
8
- export type ProTabelFeachParams<R = RecordType> = {
9
+ export type ProTabelFeachParams<R = DefaultRecordType> = {
9
10
  params?: R;
10
11
  filters?: Record<string, FilterValue | null>;
11
12
  sorter?: SorterResult | SorterResult[];
@@ -63,17 +64,21 @@ export interface OptionConfig {
63
64
  fullScreen?: (() => VueNode | JSX.Element) | boolean | (() => Promise<void>);
64
65
  }
65
66
  /** action表格实例 */
66
- export interface ProCoreActionType<T = RecordType, R = RecordType> {
67
+ export interface ProCoreActionType<T = DefaultRecordType, R = DefaultRecordType> {
67
68
  /** @name loadingStatus */
68
69
  loading: Ref<boolean>;
69
70
  dataSource: ComputedRef<T[]>;
70
71
  getLoadingStatus: () => boolean;
71
72
  pagination: R | boolean;
72
73
  pageState: PageState;
73
- rowsSelection?: () => {
74
- keys: (string | number)[];
75
- items: T[];
74
+ selectedKey: ComputedRef<(string | number)[]>;
75
+ selectedItem: ComputedRef<T[]>;
76
+ rowsSelection?: {
76
77
  clear: () => void;
78
+ sync: (data: T[]) => void;
79
+ remove: (keys: (string | number)[]) => void;
80
+ select: SelectionSelectFn<T>;
81
+ selectAll: TableRowSelection<T>['onSelectAll'];
77
82
  };
78
83
  /** @name 刷新 */
79
84
  reload: (info?: ProTabelFeachParams<R>) => void;
@@ -98,7 +103,7 @@ export interface ProCoreActionType<T = RecordType, R = RecordType> {
98
103
  setLoading: (loading: boolean) => void;
99
104
  }
100
105
  /** form查询表单实例 */
101
- export interface ProCoreFormType<R = RecordType> {
106
+ export interface ProCoreFormType<R = DefaultRecordType> {
102
107
  /** @name 获取表格-表单请求参数 */
103
108
  getFormState?: () => R;
104
109
  /** @name 获取表格-内部表单参数 */
@@ -106,23 +111,23 @@ export interface ProCoreFormType<R = RecordType> {
106
111
  /** @name 重置内部表单组件参数 */
107
112
  restFormState?: (callBack?: () => void) => void;
108
113
  }
109
- export interface ProTableRef<T = RecordType, R = RecordType> {
114
+ export interface ProTableRef<T = DefaultRecordType, R = DefaultRecordType> {
110
115
  formRef: () => ProCoreFormType<R>;
111
116
  actionRef: () => ProCoreActionType<T, R>;
112
117
  }
113
- export type ProTableProps<DataRecord extends object = Record<string, any>, ParamsType extends object = Record<string, any>> = Omit<TableProps, 'columns' | 'dataSource'> & Partial<{
118
+ export type ProTableProps<DataRecord extends object = DefaultRecordType, ParamsType extends object = DefaultRecordType> = Omit<TableProps, 'columns' | 'dataSource'> & Partial<{
114
119
  dataSource: DataRecord[];
115
120
  tableProps: {
116
121
  class?: string;
117
122
  style?: CSSProperties;
118
123
  };
119
- rowKey: string;
124
+ rowKey: keyof DataRecord;
120
125
  titleTipText: string;
121
126
  autoScroll: boolean;
122
127
  emptyTextProps: {
123
128
  class?: string;
124
129
  style?: CSSProperties;
125
- extraProps?: Record<string, any>;
130
+ extraProps?: DefaultRecordType;
126
131
  };
127
132
  columnEmptyText: ProFieldEmptyText;
128
133
  showLoading: boolean;
@@ -144,17 +149,17 @@ export type ProTableProps<DataRecord extends object = Record<string, any>, Param
144
149
  debounceTime: number;
145
150
  request: RequsetFunction<DataRecord, ParamsType>;
146
151
  params: ParamsType;
147
- postData: (data: any[]) => any;
152
+ postData: (data: DataRecord[]) => DataRecord[];
148
153
  pagination: ProTablePagination;
149
154
  search: SearchConfig | boolean;
150
155
  searchMap: ProSearchMap<undefined, keyof ParamsType | keyof DataRecord>[];
151
- onReset: (params?: Partial<ParamsType>) => any;
152
- onReload: (params?: Partial<ParamsType>) => any;
153
- onSubmit: (params?: Partial<ParamsType>) => any;
156
+ onReset: (params?: Partial<ParamsType>) => void;
157
+ onReload: (params?: Partial<ParamsType>) => void;
158
+ onSubmit: (params?: Partial<ParamsType>) => void;
154
159
  onSizeChange: (size: string) => any;
155
160
  onLoadingChange: (loading: boolean) => any;
156
161
  onRequestError: (e: Error) => void;
157
- onBeforeSearchSubmit: RequsetFunction<RecordType>;
162
+ onBeforeSearchSubmit: RequsetFunction<DataRecord, ParamsType>;
158
163
  onColumnsStateChange: (data: ColumnsState[]) => void;
159
164
  titleTip: DefaultRender;
160
165
  emptyText: DefaultRender;
package/dist/typing.d.ts CHANGED
@@ -1 +1 @@
1
- export declare type DefaultRecordType = Record<string, unknown>;
1
+ export declare type DefaultRecordType = Record<string, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gx-design-vue/pro-table",
3
- "version": "0.2.0-beta.74",
3
+ "version": "0.2.0-beta.76",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",
@@ -28,7 +28,7 @@
28
28
  "@vueuse/core": "^9.10.0",
29
29
  "@gx-design-vue/pro-utils": "^0.2.0-beta.47",
30
30
  "@gx-design-vue/pro-hooks": "^0.2.0-beta.32",
31
- "@gx-design-vue/pro-provider": "^0.1.0-beta.92",
31
+ "@gx-design-vue/pro-provider": "^0.1.0-beta.94",
32
32
  "@gx-design-vue/pro-app": "^0.1.0-beta.22",
33
33
  "dayjs": "^1.11.0",
34
34
  "lodash-es": "^4.17.21"