@douyinfe/semi-foundation 2.71.1 → 2.72.0-beta.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.
@@ -7,7 +7,8 @@ export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any
7
7
  setNewActiveIndex: (activeIndex: number) => void;
8
8
  setPreActiveIndex: (activeIndex: number) => void;
9
9
  setIsReverse: (isReverse: boolean) => void;
10
- setIsInit: (isInit: boolean) => void
10
+ setIsInit: (isInit: boolean) => void;
11
+ getChildren: () => any[]
11
12
  }
12
13
 
13
14
  class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
@@ -102,7 +103,7 @@ class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> exten
102
103
  }
103
104
 
104
105
  getValidIndex(index: number): number {
105
- const { children } = this.getStates();
106
+ const children = this._adapter.getChildren();
106
107
  return (index + children.length) % children.length;
107
108
  }
108
109
 
@@ -124,7 +125,7 @@ class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> exten
124
125
 
125
126
  handleAutoPlay(): void {
126
127
  const { autoPlay } = this.getProps();
127
- const { children } = this.getStates();
128
+ const children = this._adapter.getChildren();
128
129
  const autoPlayType = typeof autoPlay;
129
130
  // when user manually call the play function, force play
130
131
  // only when carousel children length > 1 to start play
package/image/image.scss CHANGED
@@ -204,6 +204,12 @@ $module: #{$prefix}-image;
204
204
  // transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
205
205
  z-index: 0;
206
206
  user-select: none;
207
+ /**
208
+ * In tailwind, the max-width of img/video is set to 100%,
209
+ * which will affect the amplification effect of the picture.
210
+ * So we need to set max-width to none.
211
+ */
212
+ max-width: none;
207
213
  }
208
214
 
209
215
  &-spin {
@@ -5,6 +5,7 @@ export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any
5
5
  setPreActiveIndex: (activeIndex: number) => void;
6
6
  setIsReverse: (isReverse: boolean) => void;
7
7
  setIsInit: (isInit: boolean) => void;
8
+ getChildren: () => any[];
8
9
  }
9
10
  declare class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
10
11
  constructor(adapter: CarouselAdapter<P, S>);
@@ -97,9 +97,7 @@ class CarouselFoundation extends _foundation.default {
97
97
  }
98
98
  }
99
99
  getValidIndex(index) {
100
- const {
101
- children
102
- } = this.getStates();
100
+ const children = this._adapter.getChildren();
103
101
  return (index + children.length) % children.length;
104
102
  }
105
103
  getSwitchingTime() {
@@ -123,9 +121,7 @@ class CarouselFoundation extends _foundation.default {
123
121
  const {
124
122
  autoPlay
125
123
  } = this.getProps();
126
- const {
127
- children
128
- } = this.getStates();
124
+ const children = this._adapter.getChildren();
129
125
  const autoPlayType = typeof autoPlay;
130
126
  // when user manually call the play function, force play
131
127
  // only when carousel children length > 1 to start play
@@ -177,6 +177,12 @@
177
177
  transform: scale3d(1, 1, 1) var(--semi-transform-rotate-none);
178
178
  z-index: 0;
179
179
  user-select: none;
180
+ /**
181
+ * In tailwind, the max-width of img/video is set to 100%,
182
+ * which will affect the amplification effect of the picture.
183
+ * So we need to set max-width to none.
184
+ */
185
+ max-width: none;
180
186
  }
181
187
  .semi-image-preview-image-spin {
182
188
  position: absolute;
@@ -204,6 +204,12 @@ $module: #{$prefix}-image;
204
204
  // transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
205
205
  z-index: 0;
206
206
  user-select: none;
207
+ /**
208
+ * In tailwind, the max-width of img/video is set to 100%,
209
+ * which will affect the amplification effect of the picture.
210
+ * So we need to set max-width to none.
211
+ */
212
+ max-width: none;
207
213
  }
208
214
 
209
215
  &-spin {
@@ -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
@@ -416,7 +416,8 @@ class Tooltip extends _foundation.default {
416
416
  }
417
417
  _togglePortalVisible(isVisible) {
418
418
  const nowVisible = this.getState('visible');
419
- if (nowVisible !== isVisible) {
419
+ const isInsert = this.getState("isInsert");
420
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
420
421
  this._adapter.togglePortalVisible(isVisible, () => {
421
422
  if (isVisible) {
422
423
  this._adapter.setInitialFocus();
@@ -5,6 +5,7 @@ export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any
5
5
  setPreActiveIndex: (activeIndex: number) => void;
6
6
  setIsReverse: (isReverse: boolean) => void;
7
7
  setIsInit: (isInit: boolean) => void;
8
+ getChildren: () => any[];
8
9
  }
9
10
  declare class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
10
11
  constructor(adapter: CarouselAdapter<P, S>);
@@ -90,9 +90,7 @@ class CarouselFoundation extends BaseFoundation {
90
90
  }
91
91
  }
92
92
  getValidIndex(index) {
93
- const {
94
- children
95
- } = this.getStates();
93
+ const children = this._adapter.getChildren();
96
94
  return (index + children.length) % children.length;
97
95
  }
98
96
  getSwitchingTime() {
@@ -116,9 +114,7 @@ class CarouselFoundation extends BaseFoundation {
116
114
  const {
117
115
  autoPlay
118
116
  } = this.getProps();
119
- const {
120
- children
121
- } = this.getStates();
117
+ const children = this._adapter.getChildren();
122
118
  const autoPlayType = typeof autoPlay;
123
119
  // when user manually call the play function, force play
124
120
  // only when carousel children length > 1 to start play
@@ -177,6 +177,12 @@
177
177
  transform: scale3d(1, 1, 1) var(--semi-transform-rotate-none);
178
178
  z-index: 0;
179
179
  user-select: none;
180
+ /**
181
+ * In tailwind, the max-width of img/video is set to 100%,
182
+ * which will affect the amplification effect of the picture.
183
+ * So we need to set max-width to none.
184
+ */
185
+ max-width: none;
180
186
  }
181
187
  .semi-image-preview-image-spin {
182
188
  position: absolute;
@@ -204,6 +204,12 @@ $module: #{$prefix}-image;
204
204
  // transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
205
205
  z-index: 0;
206
206
  user-select: none;
207
+ /**
208
+ * In tailwind, the max-width of img/video is set to 100%,
209
+ * which will affect the amplification effect of the picture.
210
+ * So we need to set max-width to none.
211
+ */
212
+ max-width: none;
207
213
  }
208
214
 
209
215
  &-spin {
@@ -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
@@ -409,7 +409,8 @@ export default class Tooltip extends BaseFoundation {
409
409
  }
410
410
  _togglePortalVisible(isVisible) {
411
411
  const nowVisible = this.getState('visible');
412
- if (nowVisible !== isVisible) {
412
+ const isInsert = this.getState("isInsert");
413
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
413
414
  this._adapter.togglePortalVisible(isVisible, () => {
414
415
  if (isVisible) {
415
416
  this._adapter.setInitialFocus();
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.71.1",
3
+ "version": "2.72.0-beta.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.1",
11
- "@douyinfe/semi-json-viewer-core": "2.71.1",
10
+ "@douyinfe/semi-animation": "2.72.0-beta.0",
11
+ "@douyinfe/semi-json-viewer-core": "2.72.0-beta.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": "e109344a9a8f3aff3e4c5ac020c90dc134b8ea7f",
32
+ "gitHead": "229a05b561c1c65c7df4ec7031cda4c52d6df631",
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
  /**
@@ -383,7 +383,8 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
383
383
 
384
384
  _togglePortalVisible(isVisible: boolean) {
385
385
  const nowVisible = this.getState('visible');
386
- if (nowVisible !== isVisible) {
386
+ const isInsert = this.getState("isInsert");
387
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
387
388
  this._adapter.togglePortalVisible(isVisible, () => {
388
389
  if (isVisible) {
389
390
  this._adapter.setInitialFocus();