@douyinfe/semi-foundation 2.31.2 → 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.
- package/lib/cjs/overflowList/constants.d.ts +1 -1
- package/lib/cjs/switch/foundation.js +0 -3
- package/lib/cjs/table/utils.d.ts +52 -3
- package/lib/cjs/table/utils.js +1 -48
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/es/overflowList/constants.d.ts +1 -1
- package/lib/es/switch/foundation.js +0 -3
- package/lib/es/table/utils.d.ts +52 -3
- package/lib/es/table/utils.js +1 -43
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/package.json +2 -2
- package/switch/foundation.ts +2 -3
- package/table/utils.ts +1 -43
package/lib/cjs/table/utils.d.ts
CHANGED
|
@@ -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>[]):
|
|
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
|
package/lib/cjs/table/utils.js
CHANGED
|
@@ -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 =
|
|
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):
|
|
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: ("
|
|
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/lib/es/table/utils.d.ts
CHANGED
|
@@ -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>[]):
|
|
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
|
package/lib/es/table/utils.js
CHANGED
|
@@ -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 =
|
|
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):
|
|
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: ("
|
|
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.
|
|
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": "
|
|
26
|
+
"gitHead": "132450ec528a6a6396458866467d7e5acd74dfb3",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/switch/foundation.ts
CHANGED
|
@@ -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 {
|
|
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 =
|
|
398
|
+
const _newColumns = { ...newColumns };
|
|
441
399
|
for (const column of columns) {
|
|
442
400
|
if (!isNullOrUndefined(column.width)) {
|
|
443
401
|
const currentColumn = column.key;
|