@douyinfe/semi-foundation 2.31.2-alpha.0 → 2.31.3-alpha.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.
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -219,7 +219,8 @@ class SelectFoundation extends _foundation.default {
219
219
  handleValueChange(value) {
220
220
  const {
221
221
  allowCreate,
222
- autoClearSearchValue
222
+ autoClearSearchValue,
223
+ remote
223
224
  } = this.getProps();
224
225
  const {
225
226
  inputValue
@@ -239,7 +240,7 @@ class SelectFoundation extends _foundation.default {
239
240
 
240
241
  this._adapter.rePositionDropdown();
241
242
 
242
- if (this._isFilterable() && !autoClearSearchValue && inputValue) {
243
+ if (this._isFilterable() && !autoClearSearchValue && inputValue && !remote) {
243
244
  originalOptions = this._filterOption(originalOptions, inputValue);
244
245
  }
245
246
 
@@ -36,11 +36,8 @@ class SwitchFoundation extends _foundation.default {
36
36
 
37
37
  init() {
38
38
  const {
39
- defaultChecked,
40
- checked,
41
39
  disabled
42
40
  } = this.getProps();
43
- this.setChecked(defaultChecked || checked);
44
41
  this.setDisabled(disabled);
45
42
  }
46
43
 
@@ -1,8 +1,6 @@
1
1
  import { strings } from './constants';
2
- export declare function cloneDeep(value: any, customizer?: (v: any) => any): any;
3
2
  export declare function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean): boolean;
4
3
  export declare function getColumnKey(column: any, keyPropNames: any[]): any;
5
- export declare function mergeColumns(oldColumns?: any[], newColumns?: any[], keyPropNames?: any[], deep?: boolean): any[];
6
4
  /**
7
5
  *
8
6
  * @param {Array<number>} arr
@@ -81,7 +79,58 @@ export declare function mergeQueries(query: Record<string, any>, queries?: Recor
81
79
  * @param {Object[]} columns columns retain the column width after resize
82
80
  * @param {Object[]} newColumns
83
81
  */
84
- export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): any;
82
+ export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): {
83
+ [x: number]: Record<string, any>;
84
+ length: number;
85
+ toString(): string;
86
+ toLocaleString(): string;
87
+ pop(): Record<string, any>;
88
+ push(...items: Record<string, any>[]): number;
89
+ concat(...items: ConcatArray<Record<string, any>>[]): Record<string, any>[];
90
+ concat(...items: (Record<string, any> | ConcatArray<Record<string, any>>)[]): Record<string, any>[];
91
+ join(separator?: string): string;
92
+ reverse(): Record<string, any>[];
93
+ shift(): Record<string, any>;
94
+ slice(start?: number, end?: number): Record<string, any>[];
95
+ sort(compareFn?: (a: Record<string, any>, b: Record<string, any>) => number): Record<string, any>[];
96
+ splice(start: number, deleteCount?: number): Record<string, any>[];
97
+ splice(start: number, deleteCount: number, ...items: Record<string, any>[]): Record<string, any>[];
98
+ unshift(...items: Record<string, any>[]): number;
99
+ indexOf(searchElement: Record<string, any>, fromIndex?: number): number;
100
+ lastIndexOf(searchElement: Record<string, any>, fromIndex?: number): number;
101
+ every<S extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S, thisArg?: any): this is S[];
102
+ every(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
103
+ some(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
104
+ forEach(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => void, thisArg?: any): void;
105
+ map<U>(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => U, thisArg?: any): U[];
106
+ filter<S_1 extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S_1, thisArg?: any): S_1[];
107
+ filter(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>[];
108
+ reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
109
+ reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
110
+ reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_1, initialValue: U_1): U_1;
111
+ reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
112
+ reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
113
+ reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_2, initialValue: U_2): U_2;
114
+ find<S_2 extends Record<string, any>>(predicate: (this: void, value: Record<string, any>, index: number, obj: Record<string, any>[]) => value is S_2, thisArg?: any): S_2;
115
+ find(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>;
116
+ findIndex(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): number;
117
+ fill(value: Record<string, any>, start?: number, end?: number): Record<string, any>[];
118
+ copyWithin(target: number, start: number, end?: number): Record<string, any>[];
119
+ entries(): IterableIterator<[number, Record<string, any>]>;
120
+ keys(): IterableIterator<number>;
121
+ values(): IterableIterator<Record<string, any>>;
122
+ includes(searchElement: Record<string, any>, fromIndex?: number): boolean;
123
+ [Symbol.iterator](): IterableIterator<Record<string, any>>;
124
+ [Symbol.unscopables](): {
125
+ copyWithin: boolean;
126
+ entries: boolean;
127
+ fill: boolean;
128
+ find: boolean;
129
+ findIndex: boolean;
130
+ keys: boolean;
131
+ values: boolean;
132
+ };
133
+ };
85
134
  /**
86
135
  * Pure function version of the same function in table foundation
87
136
  * This is not accessible in getDerivedStateFromProps, so fork one out
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.arrayAdd = arrayAdd;
7
7
  exports.assignColumnKeys = assignColumnKeys;
8
- exports.cloneDeep = cloneDeep;
9
8
  exports.equalWith = equalWith;
10
9
  exports.expandBtnShouldInRow = expandBtnShouldInRow;
11
10
  exports.filterColumns = filterColumns;
@@ -38,7 +37,6 @@ exports.isScrollbarColumn = isScrollbarColumn;
38
37
  exports.isSelected = isSelected;
39
38
  exports.isSelectionColumn = isSelectionColumn;
40
39
  exports.isTreeTable = isTreeTable;
41
- exports.mergeColumns = mergeColumns;
42
40
  exports.mergeQueries = mergeQueries;
43
41
  exports.sliceColumnsByLevel = sliceColumnsByLevel;
44
42
  exports.warnIfNoDataIndex = warnIfNoDataIndex;
@@ -56,10 +54,6 @@ var _findIndex2 = _interopRequireDefault(require("lodash/findIndex"));
56
54
 
57
55
  var _each2 = _interopRequireDefault(require("lodash/each"));
58
56
 
59
- var _clone2 = _interopRequireDefault(require("lodash/clone"));
60
-
61
- var _map2 = _interopRequireDefault(require("lodash/map"));
62
-
63
57
  var _find2 = _interopRequireDefault(require("lodash/find"));
64
58
 
65
59
  var _filter2 = _interopRequireDefault(require("lodash/filter"));
@@ -68,8 +62,6 @@ var _get2 = _interopRequireDefault(require("lodash/get"));
68
62
 
69
63
  var _isEqualWith2 = _interopRequireDefault(require("lodash/isEqualWith"));
70
64
 
71
- var _cloneDeepWith2 = _interopRequireDefault(require("lodash/cloneDeepWith"));
72
-
73
65
  var _constants = require("./constants");
74
66
 
75
67
  var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
@@ -78,18 +70,6 @@ var _Logger = _interopRequireDefault(require("../utils/Logger"));
78
70
 
79
71
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
80
72
 
81
- function cloneDeep(value, customizer) {
82
- return (0, _cloneDeepWith2.default)(value, v => {
83
- if (typeof v === 'function') {
84
- return v;
85
- } else if (typeof customizer === 'function') {
86
- return customizer(v);
87
- }
88
-
89
- return undefined;
90
- });
91
- }
92
-
93
73
  function equalWith(value, other, customizer) {
94
74
  return (0, _isEqualWith2.default)(value, other, function (objVal, othVal) {
95
75
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -123,33 +103,6 @@ function getColumnKey(column, keyPropNames) {
123
103
  });
124
104
  return key;
125
105
  }
126
-
127
- function mergeColumns() {
128
- let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
129
- let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
130
- let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
131
- let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
132
- const finalColumns = [];
133
- const clone = deep ? cloneDeep : _clone2.default;
134
-
135
- if (deep) {
136
- const logger = new _Logger.default('[@douyinfe/semi-ui Table]');
137
- logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
138
- }
139
-
140
- (0, _map2.default)(newColumns, newColumn => {
141
- newColumn = Object.assign({}, newColumn);
142
- const key = getColumnKey(newColumn, keyPropNames);
143
- const oldColumn = key != null && (0, _find2.default)(oldColumns, item => getColumnKey(item, keyPropNames) === key);
144
-
145
- if (oldColumn) {
146
- finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
147
- } else {
148
- finalColumns.push(clone(newColumn));
149
- }
150
- });
151
- return finalColumns;
152
- }
153
106
  /**
154
107
  *
155
108
  * @param {Array<number>} arr
@@ -529,7 +482,7 @@ function mergeQueries(query) {
529
482
 
530
483
 
531
484
  function withResizeWidth(columns, newColumns) {
532
- const _newColumns = cloneDeep(newColumns);
485
+ const _newColumns = Object.assign({}, newColumns);
533
486
 
534
487
  for (const column of columns) {
535
488
  if (!(0, _isNullOrUndefined.default)(column.width)) {
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -197,7 +197,8 @@ export default class SelectFoundation extends BaseFoundation {
197
197
  handleValueChange(value) {
198
198
  const {
199
199
  allowCreate,
200
- autoClearSearchValue
200
+ autoClearSearchValue,
201
+ remote
201
202
  } = this.getProps();
202
203
  const {
203
204
  inputValue
@@ -217,7 +218,7 @@ export default class SelectFoundation extends BaseFoundation {
217
218
 
218
219
  this._adapter.rePositionDropdown();
219
220
 
220
- if (this._isFilterable() && !autoClearSearchValue && inputValue) {
221
+ if (this._isFilterable() && !autoClearSearchValue && inputValue && !remote) {
221
222
  originalOptions = this._filterOption(originalOptions, inputValue);
222
223
  }
223
224
 
@@ -25,11 +25,8 @@ export default class SwitchFoundation extends BaseFoundation {
25
25
 
26
26
  init() {
27
27
  const {
28
- defaultChecked,
29
- checked,
30
28
  disabled
31
29
  } = this.getProps();
32
- this.setChecked(defaultChecked || checked);
33
30
  this.setDisabled(disabled);
34
31
  }
35
32
 
@@ -1,8 +1,6 @@
1
1
  import { strings } from './constants';
2
- export declare function cloneDeep(value: any, customizer?: (v: any) => any): any;
3
2
  export declare function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean): boolean;
4
3
  export declare function getColumnKey(column: any, keyPropNames: any[]): any;
5
- export declare function mergeColumns(oldColumns?: any[], newColumns?: any[], keyPropNames?: any[], deep?: boolean): any[];
6
4
  /**
7
5
  *
8
6
  * @param {Array<number>} arr
@@ -81,7 +79,58 @@ export declare function mergeQueries(query: Record<string, any>, queries?: Recor
81
79
  * @param {Object[]} columns columns retain the column width after resize
82
80
  * @param {Object[]} newColumns
83
81
  */
84
- export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): any;
82
+ export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): {
83
+ [x: number]: Record<string, any>;
84
+ length: number;
85
+ toString(): string;
86
+ toLocaleString(): string;
87
+ pop(): Record<string, any>;
88
+ push(...items: Record<string, any>[]): number;
89
+ concat(...items: ConcatArray<Record<string, any>>[]): Record<string, any>[];
90
+ concat(...items: (Record<string, any> | ConcatArray<Record<string, any>>)[]): Record<string, any>[];
91
+ join(separator?: string): string;
92
+ reverse(): Record<string, any>[];
93
+ shift(): Record<string, any>;
94
+ slice(start?: number, end?: number): Record<string, any>[];
95
+ sort(compareFn?: (a: Record<string, any>, b: Record<string, any>) => number): Record<string, any>[];
96
+ splice(start: number, deleteCount?: number): Record<string, any>[];
97
+ splice(start: number, deleteCount: number, ...items: Record<string, any>[]): Record<string, any>[];
98
+ unshift(...items: Record<string, any>[]): number;
99
+ indexOf(searchElement: Record<string, any>, fromIndex?: number): number;
100
+ lastIndexOf(searchElement: Record<string, any>, fromIndex?: number): number;
101
+ every<S extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S, thisArg?: any): this is S[];
102
+ every(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
103
+ some(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
104
+ forEach(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => void, thisArg?: any): void;
105
+ map<U>(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => U, thisArg?: any): U[];
106
+ filter<S_1 extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S_1, thisArg?: any): S_1[];
107
+ filter(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>[];
108
+ reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
109
+ reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
110
+ reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_1, initialValue: U_1): U_1;
111
+ reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
112
+ reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
113
+ reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_2, initialValue: U_2): U_2;
114
+ find<S_2 extends Record<string, any>>(predicate: (this: void, value: Record<string, any>, index: number, obj: Record<string, any>[]) => value is S_2, thisArg?: any): S_2;
115
+ find(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>;
116
+ findIndex(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): number;
117
+ fill(value: Record<string, any>, start?: number, end?: number): Record<string, any>[];
118
+ copyWithin(target: number, start: number, end?: number): Record<string, any>[];
119
+ entries(): IterableIterator<[number, Record<string, any>]>;
120
+ keys(): IterableIterator<number>;
121
+ values(): IterableIterator<Record<string, any>>;
122
+ includes(searchElement: Record<string, any>, fromIndex?: number): boolean;
123
+ [Symbol.iterator](): IterableIterator<Record<string, any>>;
124
+ [Symbol.unscopables](): {
125
+ copyWithin: boolean;
126
+ entries: boolean;
127
+ fill: boolean;
128
+ find: boolean;
129
+ findIndex: boolean;
130
+ keys: boolean;
131
+ values: boolean;
132
+ };
133
+ };
85
134
  /**
86
135
  * Pure function version of the same function in table foundation
87
136
  * This is not accessible in getDerivedStateFromProps, so fork one out
@@ -4,27 +4,13 @@ import _includes from "lodash/includes";
4
4
  import _some from "lodash/some";
5
5
  import _findIndex from "lodash/findIndex";
6
6
  import _each from "lodash/each";
7
- import _clone from "lodash/clone";
8
- import _map from "lodash/map";
9
7
  import _find from "lodash/find";
10
8
  import _filter from "lodash/filter";
11
9
  import _get from "lodash/get";
12
10
  import _isEqualWith from "lodash/isEqualWith";
13
- import _cloneDeepWith from "lodash/cloneDeepWith";
14
11
  import { strings, numbers } from './constants';
15
12
  import isNullOrUndefined from '../utils/isNullOrUndefined';
16
13
  import Logger from '../utils/Logger';
17
- export function cloneDeep(value, customizer) {
18
- return _cloneDeepWith(value, v => {
19
- if (typeof v === 'function') {
20
- return v;
21
- } else if (typeof customizer === 'function') {
22
- return customizer(v);
23
- }
24
-
25
- return undefined;
26
- });
27
- }
28
14
  export function equalWith(value, other, customizer) {
29
15
  return _isEqualWith(value, other, function (objVal, othVal) {
30
16
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -59,34 +45,6 @@ export function getColumnKey(column, keyPropNames) {
59
45
 
60
46
  return key;
61
47
  }
62
- export function mergeColumns() {
63
- let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
64
- let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
65
- let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
66
- let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
67
- const finalColumns = [];
68
- const clone = deep ? cloneDeep : _clone;
69
-
70
- if (deep) {
71
- const logger = new Logger('[@douyinfe/semi-ui Table]');
72
- logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
73
- }
74
-
75
- _map(newColumns, newColumn => {
76
- newColumn = Object.assign({}, newColumn);
77
- const key = getColumnKey(newColumn, keyPropNames);
78
-
79
- const oldColumn = key != null && _find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
80
-
81
- if (oldColumn) {
82
- finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
83
- } else {
84
- finalColumns.push(clone(newColumn));
85
- }
86
- });
87
-
88
- return finalColumns;
89
- }
90
48
  /**
91
49
  *
92
50
  * @param {Array<number>} arr
@@ -445,7 +403,7 @@ export function mergeQueries(query) {
445
403
  */
446
404
 
447
405
  export function withResizeWidth(columns, newColumns) {
448
- const _newColumns = cloneDeep(newColumns);
406
+ const _newColumns = Object.assign({}, newColumns);
449
407
 
450
408
  for (const column of columns) {
451
409
  if (!isNullOrUndefined(column.width)) {
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.31.2-alpha.0",
3
+ "version": "2.31.3-alpha.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "b502692ae72f3cb550595912d9caefe0517c52c6",
26
+ "gitHead": "132450ec528a6a6396458866467d7e5acd74dfb3",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -94,7 +94,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
94
94
  if (isFilterable && isMultiple) {
95
95
  // when filter and multiple, only focus input
96
96
  this.focusInput();
97
- } else if (isFilterable && !isMultiple){
97
+ } else if (isFilterable && !isMultiple) {
98
98
  // when filter and not multiple, only show input and focus input
99
99
  this.toggle2SearchInput(true);
100
100
  } else {
@@ -196,7 +196,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
196
196
 
197
197
  // call when props.value change
198
198
  handleValueChange(value: PropValue) {
199
- const { allowCreate, autoClearSearchValue } = this.getProps();
199
+ const { allowCreate, autoClearSearchValue, remote } = this.getProps();
200
200
  const { inputValue } = this.getStates();
201
201
  let originalOptions;
202
202
  // AllowCreate and controlled mode, no need to re-collect optionList
@@ -212,7 +212,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
212
212
  // Multi-selection, controlled mode, you need to reposition the drop-down menu after updating
213
213
  this._adapter.rePositionDropdown();
214
214
 
215
- if (this._isFilterable() && !autoClearSearchValue && inputValue) {
215
+ if (this._isFilterable() && !autoClearSearchValue && inputValue && !remote) {
216
216
  originalOptions = this._filterOption(originalOptions, inputValue);
217
217
  }
218
218
 
@@ -555,7 +555,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
555
555
  clearInput(event?: any) {
556
556
  const { inputValue } = this.getStates();
557
557
  // only when input is not null, select should notifySearch and updateOptions
558
- if (inputValue !== ''){
558
+ if (inputValue !== '') {
559
559
  this._adapter.updateInputValue('');
560
560
  this._adapter.notifySearch('', event);
561
561
  // reset options filter
@@ -793,16 +793,16 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
793
793
  isOpen ? this._getEnableFocusIndex(offset) : this.open();
794
794
  }
795
795
 
796
- _handleTabKeyDown(event: any){
796
+ _handleTabKeyDown(event: any) {
797
797
  const { isOpen } = this.getStates();
798
798
  this._adapter.updateFocusState(false);
799
799
 
800
- if (isOpen){
800
+ if (isOpen) {
801
801
  const container = this._adapter.getContainer();
802
802
  const focusableElements = this._adapter.getFocusableElements(container);
803
803
  const focusableNum = focusableElements.length;
804
804
 
805
- if (focusableNum > 0){
805
+ if (focusableNum > 0) {
806
806
  // Shift + Tab will move focus backward
807
807
  if (event.shiftKey) {
808
808
  this._handlePanelOpenShiftTabKeyDown(focusableElements, event);
@@ -823,7 +823,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
823
823
  _handlePanelOpenTabKeyDown(focusableElements: any[], event: any) {
824
824
  const activeElement = this._adapter.getActiveElement();
825
825
  const isFocusInContainer = this._adapter.getIsFocusInContainer();
826
- if (!isFocusInContainer){
826
+ if (!isFocusInContainer) {
827
827
  // focus in trigger, set next focus to the first element in container
828
828
  focusableElements[0].focus();
829
829
  this._adapter.setIsFocusInContainer(true);
@@ -854,7 +854,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
854
854
 
855
855
  _handleEnterKeyDown(event: KeyboardEvent) {
856
856
  const { isOpen, options, focusIndex } = this.getStates();
857
- if (!isOpen){
857
+ if (!isOpen) {
858
858
  this.open();
859
859
  } else {
860
860
  if (focusIndex !== -1) {
@@ -15,8 +15,7 @@ export default class SwitchFoundation<P = Record<string, any>, S = Record<string
15
15
  }
16
16
 
17
17
  init(): void {
18
- const { defaultChecked, checked, disabled } = this.getProps();
19
- this.setChecked(defaultChecked || checked);
18
+ const { disabled } = this.getProps();
20
19
  this.setDisabled(disabled);
21
20
  }
22
21
 
@@ -45,7 +44,7 @@ export default class SwitchFoundation<P = Record<string, any>, S = Record<string
45
44
  if (target.matches(':focus-visible')) {
46
45
  this._adapter.setFocusVisible(true);
47
46
  }
48
- } catch (error){
47
+ } catch (error) {
49
48
  warning(true, 'Warning: [Semi Switch] The current browser does not support the focus-visible');
50
49
  }
51
50
  }
package/table/utils.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  /* eslint-disable no-param-reassign */
3
3
  /* eslint-disable eqeqeq */
4
4
  import {
5
- cloneDeepWith,
6
5
  isEqualWith,
7
6
  get,
8
7
  filter,
@@ -21,17 +20,6 @@ import isNullOrUndefined from '../utils/isNullOrUndefined';
21
20
  import Logger from '../utils/Logger';
22
21
 
23
22
 
24
- export function cloneDeep(value: any, customizer?: (v: any) => any) {
25
- return cloneDeepWith(value, v => {
26
- if (typeof v === 'function') {
27
- return v;
28
- } else if (typeof customizer === 'function') {
29
- return customizer(v);
30
- }
31
- return undefined;
32
- });
33
- }
34
-
35
23
  export function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean) {
36
24
  return isEqualWith(value, other, (objVal, othVal, ...rest) => {
37
25
  if (typeof objVal === 'function' && typeof othVal === 'function') {
@@ -61,36 +49,6 @@ export function getColumnKey(column: any, keyPropNames: any[]): any {
61
49
  return key;
62
50
  }
63
51
 
64
- export function mergeColumns(oldColumns: any[] = [], newColumns: any[] = [], keyPropNames: any[] = null, deep = true) {
65
- const finalColumns: any[] = [];
66
- const clone = deep ? cloneDeep : lodashClone;
67
-
68
- if (deep) {
69
- const logger = new Logger('[@douyinfe/semi-ui Table]');
70
- logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
71
- }
72
-
73
- map(newColumns, newColumn => {
74
- newColumn = { ...newColumn };
75
- const key = getColumnKey(newColumn, keyPropNames);
76
-
77
- const oldColumn = key != null && find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
78
-
79
- if (oldColumn) {
80
- finalColumns.push(
81
- clone({
82
- ...oldColumn,
83
- ...newColumn,
84
- })
85
- );
86
- } else {
87
- finalColumns.push(clone(newColumn));
88
- }
89
- });
90
-
91
- return finalColumns;
92
- }
93
-
94
52
  /**
95
53
  *
96
54
  * @param {Array<number>} arr
@@ -437,7 +395,7 @@ export function mergeQueries(query: Record<string, any>, queries: Record<string,
437
395
  * @param {Object[]} newColumns
438
396
  */
439
397
  export function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]) {
440
- const _newColumns = cloneDeep(newColumns);
398
+ const _newColumns = { ...newColumns };
441
399
  for (const column of columns) {
442
400
  if (!isNullOrUndefined(column.width)) {
443
401
  const currentColumn = column.key;