@gx-design-vue/pro-table 0.2.0-beta.75 → 0.2.0-beta.77

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.
@@ -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.75",
3
+ "version": "0.2.0-beta.77",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "vite build",