@douyinfe/semi-foundation 2.71.3 → 2.72.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.
@@ -34,6 +34,9 @@ export interface BaseColumnProps<RecordType> {
34
34
  width?: string | number;
35
35
  ellipsis?: BaseEllipsis;
36
36
  }
37
+ export interface OnChangeExtra {
38
+ changeType?: 'sorter' | 'filter' | 'pagination';
39
+ }
37
40
  export interface TableAdapter<RecordType> extends DefaultAdapter {
38
41
  resetScrollY: () => void;
39
42
  setSelectedRowKeys: (selectedRowKeys: BaseRowKeyType[]) => void;
@@ -63,7 +66,7 @@ export interface TableAdapter<RecordType> extends DefaultAdapter {
63
66
  pagination: BasePagination;
64
67
  filters: BaseChangeInfoFilter<RecordType>[];
65
68
  sorter: BaseChangeInfoSorter<RecordType>;
66
- extra: any;
69
+ extra: OnChangeExtra;
67
70
  }) => void;
68
71
  notifyExpand: (expanded?: boolean, record?: BaseIncludeGroupRecord<RecordType>, mouseEvent?: any) => void;
69
72
  notifyExpandedRowsChange: (expandedRows: BaseIncludeGroupRecord<RecordType>[]) => void;
@@ -173,7 +176,7 @@ declare class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<Re
173
176
  * Add non-repeating elements to the array itself
174
177
  */
175
178
  _addNoDuplicatedItemsToArr(srcArr?: any[], ...objArrs: any[][]): any[];
176
- _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: RecordType): void;
179
+ _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: OnChangeExtra): void;
177
180
  _rowExpansionIsControlled(): boolean;
178
181
  _pagerIsControlled(): boolean;
179
182
  _selectionIsControlled(): boolean;
@@ -92,7 +92,9 @@ class TableFoundation extends _foundation.default {
92
92
  this._adapter.setPagination(pagination);
93
93
  this._adapter.setDataSource(dataSource);
94
94
  }
95
- this._notifyChange(pagination);
95
+ this._notifyChange(pagination, undefined, undefined, {
96
+ changeType: 'pagination'
97
+ });
96
98
  };
97
99
  /**
98
100
  * Cache related data when initializing or updating the calculated dataSource
@@ -864,7 +866,9 @@ class TableFoundation extends _foundation.default {
864
866
  this._adapter.setQueries(queries);
865
867
  this.handleClickFilterOrSorter(queries);
866
868
  }
867
- this._notifyChange(null, filters);
869
+ this._notifyChange(null, filters, undefined, {
870
+ changeType: 'filter'
871
+ });
868
872
  }
869
873
  /**
870
874
  * Click the sort button to call
@@ -912,7 +916,9 @@ class TableFoundation extends _foundation.default {
912
916
  this.handleClickFilterOrSorter(queries);
913
917
  }
914
918
  // notify sort event
915
- this._notifyChange(null, null, curQuery, null);
919
+ this._notifyChange(null, null, curQuery, {
920
+ changeType: 'sorter'
921
+ });
916
922
  }
917
923
  /**
918
924
  * Recalculate the cached data after clicking filter or sorter
@@ -34,6 +34,9 @@ export interface BaseColumnProps<RecordType> {
34
34
  width?: string | number;
35
35
  ellipsis?: BaseEllipsis;
36
36
  }
37
+ export interface OnChangeExtra {
38
+ changeType?: 'sorter' | 'filter' | 'pagination';
39
+ }
37
40
  export interface TableAdapter<RecordType> extends DefaultAdapter {
38
41
  resetScrollY: () => void;
39
42
  setSelectedRowKeys: (selectedRowKeys: BaseRowKeyType[]) => void;
@@ -63,7 +66,7 @@ export interface TableAdapter<RecordType> extends DefaultAdapter {
63
66
  pagination: BasePagination;
64
67
  filters: BaseChangeInfoFilter<RecordType>[];
65
68
  sorter: BaseChangeInfoSorter<RecordType>;
66
- extra: any;
69
+ extra: OnChangeExtra;
67
70
  }) => void;
68
71
  notifyExpand: (expanded?: boolean, record?: BaseIncludeGroupRecord<RecordType>, mouseEvent?: any) => void;
69
72
  notifyExpandedRowsChange: (expandedRows: BaseIncludeGroupRecord<RecordType>[]) => void;
@@ -173,7 +176,7 @@ declare class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<Re
173
176
  * Add non-repeating elements to the array itself
174
177
  */
175
178
  _addNoDuplicatedItemsToArr(srcArr?: any[], ...objArrs: any[][]): any[];
176
- _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: RecordType): void;
179
+ _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: OnChangeExtra): void;
177
180
  _rowExpansionIsControlled(): boolean;
178
181
  _pagerIsControlled(): boolean;
179
182
  _selectionIsControlled(): boolean;
@@ -85,7 +85,9 @@ class TableFoundation extends BaseFoundation {
85
85
  this._adapter.setPagination(pagination);
86
86
  this._adapter.setDataSource(dataSource);
87
87
  }
88
- this._notifyChange(pagination);
88
+ this._notifyChange(pagination, undefined, undefined, {
89
+ changeType: 'pagination'
90
+ });
89
91
  };
90
92
  /**
91
93
  * Cache related data when initializing or updating the calculated dataSource
@@ -857,7 +859,9 @@ class TableFoundation extends BaseFoundation {
857
859
  this._adapter.setQueries(queries);
858
860
  this.handleClickFilterOrSorter(queries);
859
861
  }
860
- this._notifyChange(null, filters);
862
+ this._notifyChange(null, filters, undefined, {
863
+ changeType: 'filter'
864
+ });
861
865
  }
862
866
  /**
863
867
  * Click the sort button to call
@@ -905,7 +909,9 @@ class TableFoundation extends BaseFoundation {
905
909
  this.handleClickFilterOrSorter(queries);
906
910
  }
907
911
  // notify sort event
908
- this._notifyChange(null, null, curQuery, null);
912
+ this._notifyChange(null, null, curQuery, {
913
+ changeType: 'sorter'
914
+ });
909
915
  }
910
916
  /**
911
917
  * Recalculate the cached data after clicking filter or sorter
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.71.3",
3
+ "version": "2.72.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.71.3",
11
- "@douyinfe/semi-json-viewer-core": "2.71.3",
10
+ "@douyinfe/semi-animation": "2.72.0",
11
+ "@douyinfe/semi-json-viewer-core": "2.72.0",
12
12
  "@mdx-js/mdx": "^3.0.1",
13
13
  "async-validator": "^3.5.0",
14
14
  "classnames": "^2.2.6",
@@ -29,7 +29,7 @@
29
29
  "*.scss",
30
30
  "*.css"
31
31
  ],
32
- "gitHead": "2c3f3a4e4e1dee2fe1a55586edc11d6dc3a6bd93",
32
+ "gitHead": "66267e4192e4ef74683aaf53e4e721908b1cea0d",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",
@@ -55,6 +55,10 @@ export interface BaseColumnProps<RecordType> {
55
55
  ellipsis?: BaseEllipsis
56
56
  }
57
57
 
58
+ export interface OnChangeExtra {
59
+ changeType?: 'sorter' | 'filter' | 'pagination'
60
+ }
61
+
58
62
  export interface TableAdapter<RecordType> extends DefaultAdapter {
59
63
  resetScrollY: () => void;
60
64
  setSelectedRowKeys: (selectedRowKeys: BaseRowKeyType[]) => void;
@@ -80,7 +84,7 @@ export interface TableAdapter<RecordType> extends DefaultAdapter {
80
84
  getAllDisabledRowKeys: () => BaseRowKeyType[];
81
85
  getAllDisabledRowKeysSet: () => Set<BaseRowKeyType>;
82
86
  notifyFilterDropdownVisibleChange: (visible: boolean, dataIndex: string) => void;
83
- notifyChange: (changeInfo: { pagination: BasePagination; filters: BaseChangeInfoFilter<RecordType>[]; sorter: BaseChangeInfoSorter<RecordType>; extra: any }) => void;
87
+ notifyChange: (changeInfo: { pagination: BasePagination; filters: BaseChangeInfoFilter<RecordType>[]; sorter: BaseChangeInfoSorter<RecordType>; extra: OnChangeExtra }) => void;
84
88
  notifyExpand: (expanded?: boolean, record?: BaseIncludeGroupRecord<RecordType>, mouseEvent?: any) => void;
85
89
  notifyExpandedRowsChange: (expandedRows: BaseIncludeGroupRecord<RecordType>[]) => void;
86
90
  notifySelect: (record?: BaseIncludeGroupRecord<RecordType>, selected?: boolean, selectedRows?: BaseIncludeGroupRecord<RecordType>[], nativeEvent?: any) => void;
@@ -400,7 +404,7 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
400
404
  this._adapter.setDataSource(dataSource);
401
405
  }
402
406
 
403
- this._notifyChange(pagination);
407
+ this._notifyChange(pagination, undefined, undefined, { changeType: 'pagination' });
404
408
  };
405
409
 
406
410
  /**
@@ -579,7 +583,7 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
579
583
  return srcArr;
580
584
  }
581
585
 
582
- _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: RecordType) {
586
+ _notifyChange(pagination: BasePagination, filters?: BaseChangeInfoFilter<RecordType>[], sorter?: BaseChangeInfoSorter<RecordType>, extra?: OnChangeExtra) {
583
587
  pagination = pagination == null ? this._getPagination() : pagination;
584
588
  filters = filters == null ? this._getAllFilters() : filters;
585
589
  sorter = sorter == null ? this._getAllSorters()[0] as BaseChangeInfoSorter<RecordType> : sorter;
@@ -1067,7 +1071,7 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
1067
1071
  this.handleClickFilterOrSorter(queries);
1068
1072
  }
1069
1073
 
1070
- this._notifyChange(null, filters);
1074
+ this._notifyChange(null, filters, undefined, { changeType: 'filter' });
1071
1075
  }
1072
1076
 
1073
1077
  /**
@@ -1120,7 +1124,7 @@ class TableFoundation<RecordType> extends BaseFoundation<TableAdapter<RecordType
1120
1124
  }
1121
1125
 
1122
1126
  // notify sort event
1123
- this._notifyChange(null, null, curQuery, null);
1127
+ this._notifyChange(null, null, curQuery, { changeType: 'sorter' });
1124
1128
  }
1125
1129
 
1126
1130
  /**