@douyinfe/semi-foundation 2.0.9-alpha.2 → 2.1.0-alpha.2
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/calendar/foundation.ts +1 -1
- package/cascader/foundation.ts +1 -1
- package/collapse/foundation.ts +1 -1
- package/lib/es/anchor/foundation.js +12 -20
- package/lib/es/backtop/foundation.js +3 -5
- package/lib/es/base/foundation.js +2 -7
- package/lib/es/calendar/eventUtil.js +3 -9
- package/lib/es/cascader/foundation.d.ts +1 -1
- package/lib/es/cascader/foundation.js +4 -8
- package/lib/es/collapse/foundation.d.ts +1 -1
- package/lib/es/datePicker/_utils/formatter.js +5 -7
- package/lib/es/datePicker/_utils/getDayOfWeek.js +3 -4
- package/lib/es/datePicker/_utils/getMonthTable.js +2 -6
- package/lib/es/datePicker/_utils/isBetween.js +4 -5
- package/lib/es/datePicker/_utils/isWithinInterval.js +4 -5
- package/lib/es/datePicker/foundation.js +16 -46
- package/lib/es/datePicker/monthsGridFoundation.js +7 -15
- package/lib/es/form/foundation.js +8 -14
- package/lib/es/form/utils.js +2 -4
- package/lib/es/input/util/calculateNodeHeight.js +1 -4
- package/lib/es/inputNumber/foundation.js +5 -18
- package/lib/es/navigation/NavItem.js +1 -3
- package/lib/es/navigation/foundation.js +6 -25
- package/lib/es/navigation/subNavFoundation.js +2 -12
- package/lib/es/overflowList/foundation.js +3 -6
- package/lib/es/pagination/foundation.js +1 -5
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +2 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +4 -0
- package/lib/es/scrollList/itemFoundation.js +2 -4
- package/lib/es/scrollList/scrollTo.js +3 -4
- package/lib/es/select/foundation.js +11 -7
- package/lib/es/sideSheet/sideSheetFoundation.js +8 -11
- package/lib/es/slider/foundation.js +4 -11
- package/lib/es/table/bodyFoundation.js +1 -5
- package/lib/es/table/foundation.js +13 -29
- package/lib/es/table/utils.js +24 -64
- package/lib/es/tabs/foundation.d.ts +3 -0
- package/lib/es/tabs/foundation.js +4 -8
- package/lib/es/tabs/tabs.css +13 -1
- package/lib/es/tabs/tabs.scss +96 -76
- package/lib/es/tagInput/foundation.d.ts +1 -0
- package/lib/es/tagInput/foundation.js +2 -0
- package/lib/es/timePicker/ComboxFoundation.js +1 -2
- package/lib/es/timePicker/foundation.js +11 -20
- package/lib/es/timePicker/utils/index.js +5 -16
- package/lib/es/timePicker/utils/localeDate.js +2 -8
- package/lib/es/timeline/timeline.css +1 -0
- package/lib/es/timeline/timeline.scss +1 -0
- package/lib/es/timeline/variables.scss +1 -0
- package/lib/es/tooltip/foundation.js +19 -26
- package/lib/es/tree/foundation.d.ts +1 -1
- package/lib/es/tree/foundation.js +2 -4
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/tree/treeUtil.js +19 -29
- package/lib/es/treeSelect/foundation.d.ts +10 -11
- package/lib/es/treeSelect/foundation.js +1 -2
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/upload/foundation.js +27 -32
- package/lib/es/utils/Event.js +4 -11
- package/lib/es/utils/Logger.js +5 -27
- package/lib/es/utils/array.js +1 -3
- package/lib/es/utils/classnames.js +2 -12
- package/lib/es/utils/dom.js +2 -10
- package/lib/es/utils/getHighlight.js +19 -24
- package/lib/es/utils/log.js +1 -5
- package/lib/es/utils/object.js +2 -5
- package/lib/es/utils/touchPolyfill.js +1 -3
- package/package.json +3 -3
- package/popconfirm/popconfirmFoundation.ts +5 -0
- package/select/foundation.ts +6 -5
- package/tabs/foundation.ts +7 -8
- package/tabs/tabs.scss +96 -76
- package/tagInput/foundation.ts +2 -0
- package/timeline/timeline.scss +1 -0
- package/timeline/variables.scss +1 -0
- package/tooltip/foundation.ts +4 -2
- package/tree/foundation.ts +1 -1
- package/tree/treeUtil.ts +1 -1
- package/treeSelect/foundation.ts +10 -9
package/lib/es/table/utils.js
CHANGED
|
@@ -29,16 +29,12 @@ export function cloneDeep(value, customizer) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
export function equalWith(value, other, customizer) {
|
|
32
|
-
return isEqualWith(value, other,
|
|
32
|
+
return isEqualWith(value, other, (objVal, othVal, ...rest) => {
|
|
33
33
|
if (typeof objVal === 'function' && typeof othVal === 'function') {
|
|
34
34
|
return toString(objVal) === toString(othVal);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (typeof customizer === 'function') {
|
|
38
|
-
for (var _len = arguments.length, rest = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
39
|
-
rest[_key - 2] = arguments[_key];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
return customizer(objVal, othVal, ...rest);
|
|
43
39
|
} // If customizer returns undefined, comparisons are handled by isEqual instead
|
|
44
40
|
|
|
@@ -60,11 +56,7 @@ export function getColumnKey(column, keyPropNames) {
|
|
|
60
56
|
});
|
|
61
57
|
return key;
|
|
62
58
|
}
|
|
63
|
-
export function mergeColumns() {
|
|
64
|
-
let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
65
|
-
let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
66
|
-
let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
67
|
-
let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
59
|
+
export function mergeColumns(oldColumns = [], newColumns = [], keyPropNames = null, deep = true) {
|
|
68
60
|
const finalColumns = [];
|
|
69
61
|
const clone = deep ? cloneDeep : lodashClone;
|
|
70
62
|
map(newColumns, newColumn => {
|
|
@@ -88,10 +80,7 @@ export function mergeColumns() {
|
|
|
88
80
|
* @returns {number}
|
|
89
81
|
*/
|
|
90
82
|
|
|
91
|
-
export function arrayAdd() {
|
|
92
|
-
let arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
93
|
-
let beginIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
94
|
-
let endIndex = arguments.length > 2 ? arguments[2] : undefined;
|
|
83
|
+
export function arrayAdd(arr = [], beginIndex = 0, endIndex) {
|
|
95
84
|
beginIndex = beginIndex < 0 || typeof beginIndex !== 'number' ? 0 : beginIndex;
|
|
96
85
|
endIndex = endIndex > arr.length || typeof endIndex !== 'number' ? arr.length : endIndex;
|
|
97
86
|
let result = 0;
|
|
@@ -102,21 +91,17 @@ export function arrayAdd() {
|
|
|
102
91
|
});
|
|
103
92
|
return result;
|
|
104
93
|
}
|
|
105
|
-
export function isLastLeftFixed(columns, column) {
|
|
106
|
-
let checkKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['key'];
|
|
94
|
+
export function isLastLeftFixed(columns, column, checkKeys = ['key']) {
|
|
107
95
|
const leftFixedColumns = filter(columns, col => col.fixed === true || col.fixed === 'left');
|
|
108
96
|
const index = findIndex(leftFixedColumns, col => _everyInstanceProperty(checkKeys).call(checkKeys, key => col[key] != null && col[key] === column[key]));
|
|
109
97
|
return leftFixedColumns.length > 0 && index === leftFixedColumns.length - 1;
|
|
110
98
|
}
|
|
111
|
-
export function isFirstFixedRight(columns, column) {
|
|
112
|
-
let checkKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ['key'];
|
|
99
|
+
export function isFirstFixedRight(columns, column, checkKeys = ['key']) {
|
|
113
100
|
const rightFixedColumns = filter(columns, col => col.fixed === 'right');
|
|
114
101
|
const index = findIndex(rightFixedColumns, col => _everyInstanceProperty(checkKeys).call(checkKeys, key => col[key] != null && col[key] === column[key]));
|
|
115
102
|
return rightFixedColumns.length > 0 && index === 0;
|
|
116
103
|
}
|
|
117
|
-
export function isAnyFixed(columns) {
|
|
118
|
-
let fixedSet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['left', true, 'right'];
|
|
119
|
-
|
|
104
|
+
export function isAnyFixed(columns, fixedSet = ['left', true, 'right']) {
|
|
120
105
|
if (typeof fixedSet === 'string' || typeof fixedSet === 'boolean') {
|
|
121
106
|
fixedSet = [fixedSet];
|
|
122
107
|
}
|
|
@@ -153,8 +138,7 @@ export function isScrollbarColumn(column) {
|
|
|
153
138
|
export function isSelectionColumn(column) {
|
|
154
139
|
return get(column, 'key') === strings.DEFAULT_KEY_COLUMN_SELECTION;
|
|
155
140
|
}
|
|
156
|
-
export function filterColumns(columns) {
|
|
157
|
-
let ignoreKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [strings.DEFAULT_KEY_COLUMN_SCROLLBAR];
|
|
141
|
+
export function filterColumns(columns, ignoreKeys = [strings.DEFAULT_KEY_COLUMN_SCROLLBAR]) {
|
|
158
142
|
return filter(columns, col => !_includesInstanceProperty(ignoreKeys).call(ignoreKeys, col.key));
|
|
159
143
|
}
|
|
160
144
|
/**
|
|
@@ -163,8 +147,7 @@ export function filterColumns(columns) {
|
|
|
163
147
|
* @returns {Number|undefined}
|
|
164
148
|
*/
|
|
165
149
|
|
|
166
|
-
export function getScrollbarColumnWidth() {
|
|
167
|
-
let columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
150
|
+
export function getScrollbarColumnWidth(columns = []) {
|
|
168
151
|
const len = columns.length;
|
|
169
152
|
|
|
170
153
|
if (len) {
|
|
@@ -223,19 +206,14 @@ export function getRecordChildren(record, childrenRecordName) {
|
|
|
223
206
|
|
|
224
207
|
return get(record, childrenRecordName);
|
|
225
208
|
}
|
|
226
|
-
export function genExpandedRowKey() {
|
|
227
|
-
let recordKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
228
|
-
let suffix = arguments.length > 1 ? arguments[1] : undefined;
|
|
229
|
-
|
|
209
|
+
export function genExpandedRowKey(recordKey = '', suffix) {
|
|
230
210
|
if (suffix === undefined) {
|
|
231
211
|
suffix = '__expanded_row';
|
|
232
212
|
}
|
|
233
213
|
|
|
234
214
|
return recordKey + suffix;
|
|
235
215
|
}
|
|
236
|
-
export function getDefaultVirtualizedRowConfig() {
|
|
237
|
-
let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
238
|
-
let sectionRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
216
|
+
export function getDefaultVirtualizedRowConfig(size = '', sectionRow = false) {
|
|
239
217
|
const config = {};
|
|
240
218
|
|
|
241
219
|
if (size === 'small') {
|
|
@@ -251,8 +229,7 @@ export function getDefaultVirtualizedRowConfig() {
|
|
|
251
229
|
|
|
252
230
|
return config;
|
|
253
231
|
}
|
|
254
|
-
export function flattenColumns(cols) {
|
|
255
|
-
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
232
|
+
export function flattenColumns(cols, childrenColumnName = 'children') {
|
|
256
233
|
const list = [];
|
|
257
234
|
|
|
258
235
|
if (_Array$isArray(cols) && cols.length) {
|
|
@@ -268,9 +245,7 @@ export function flattenColumns(cols) {
|
|
|
268
245
|
|
|
269
246
|
return list;
|
|
270
247
|
}
|
|
271
|
-
export function assignColumnKeys(columns) {
|
|
272
|
-
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
273
|
-
let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
248
|
+
export function assignColumnKeys(columns, childrenColumnName = 'children', level = 0) {
|
|
274
249
|
const sameLevelCols = [];
|
|
275
250
|
each(columns, (column, index) => {
|
|
276
251
|
if (column.key == null) {
|
|
@@ -290,10 +265,7 @@ export function assignColumnKeys(columns) {
|
|
|
290
265
|
|
|
291
266
|
return columns;
|
|
292
267
|
}
|
|
293
|
-
export function sliceColumnsByLevel(columns) {
|
|
294
|
-
let targetLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
295
|
-
let childrenColumnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
|
|
296
|
-
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
268
|
+
export function sliceColumnsByLevel(columns, targetLevel = 0, childrenColumnName = 'children', currentLevel = 0) {
|
|
297
269
|
const slicedColumns = [];
|
|
298
270
|
|
|
299
271
|
if (_Array$isArray(columns) && columns.length && currentLevel <= targetLevel) {
|
|
@@ -310,12 +282,7 @@ export function sliceColumnsByLevel(columns) {
|
|
|
310
282
|
|
|
311
283
|
return slicedColumns;
|
|
312
284
|
}
|
|
313
|
-
export function getColumnsByLevel(columns) {
|
|
314
|
-
let targetLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
315
|
-
let targetColumns = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
316
|
-
let currentLevel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
317
|
-
let childrenColumnName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'children';
|
|
318
|
-
|
|
285
|
+
export function getColumnsByLevel(columns, targetLevel = 0, targetColumns = [], currentLevel = 0, childrenColumnName = 'children') {
|
|
319
286
|
if (_Array$isArray(columns) && columns.length) {
|
|
320
287
|
if (targetLevel === currentLevel) {
|
|
321
288
|
targetColumns.push(...columns);
|
|
@@ -328,8 +295,7 @@ export function getColumnsByLevel(columns) {
|
|
|
328
295
|
|
|
329
296
|
return targetColumns;
|
|
330
297
|
}
|
|
331
|
-
export function getAllLevelColumns(columns) {
|
|
332
|
-
let childrenColumnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'children';
|
|
298
|
+
export function getAllLevelColumns(columns, childrenColumnName = 'children') {
|
|
333
299
|
const all = [];
|
|
334
300
|
|
|
335
301
|
if (_Array$isArray(columns) && columns.length) {
|
|
@@ -351,14 +317,11 @@ export function getAllLevelColumns(columns) {
|
|
|
351
317
|
|
|
352
318
|
return all;
|
|
353
319
|
}
|
|
354
|
-
export function getColumnByLevelIndex(columns, index) {
|
|
355
|
-
let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
356
|
-
let childrenColumnName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'children';
|
|
320
|
+
export function getColumnByLevelIndex(columns, index, level = 0, childrenColumnName = 'children') {
|
|
357
321
|
const allLevelColumns = getAllLevelColumns(columns, childrenColumnName);
|
|
358
322
|
return allLevelColumns[level][index];
|
|
359
323
|
}
|
|
360
|
-
export function findColumn(columns, column) {
|
|
361
|
-
let childrenColumnName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
|
|
324
|
+
export function findColumn(columns, column, childrenColumnName = 'children') {
|
|
362
325
|
let found;
|
|
363
326
|
each(columns, item => {
|
|
364
327
|
if (item && item.key != null && !found) {
|
|
@@ -404,9 +367,7 @@ export function expandBtnShouldInRow(props) {
|
|
|
404
367
|
* @param {*} queries
|
|
405
368
|
*/
|
|
406
369
|
|
|
407
|
-
export function mergeQueries(query) {
|
|
408
|
-
let queries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
409
|
-
|
|
370
|
+
export function mergeQueries(query, queries = []) {
|
|
410
371
|
let _mergedQuery;
|
|
411
372
|
|
|
412
373
|
const idx = _findIndexInstanceProperty(queries).call(queries, item => {
|
|
@@ -453,13 +414,12 @@ export function withResizeWidth(columns, newColumns) {
|
|
|
453
414
|
* This is not accessible in getDerivedStateFromProps, so fork one out
|
|
454
415
|
*/
|
|
455
416
|
|
|
456
|
-
export function getAllDisabledRowKeys(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
} = _ref;
|
|
417
|
+
export function getAllDisabledRowKeys({
|
|
418
|
+
dataSource,
|
|
419
|
+
getCheckboxProps,
|
|
420
|
+
childrenRecordName,
|
|
421
|
+
rowKey
|
|
422
|
+
}) {
|
|
463
423
|
const disabledRowKeys = [];
|
|
464
424
|
|
|
465
425
|
if (_Array$isArray(dataSource) && dataSource.length && typeof getCheckboxProps === 'function') {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
export interface TabsAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
3
|
collectPane: () => void;
|
|
4
|
+
collectActiveKey: () => void;
|
|
4
5
|
notifyTabClick: (activeKey: string, event: any) => void;
|
|
5
6
|
notifyChange: (activeKey: string) => void;
|
|
6
7
|
setNewActiveKey: (activeKey: string) => void;
|
|
7
8
|
getDefaultActiveKeyFromChildren: () => string;
|
|
9
|
+
notifyTabDelete: (tabKey: string) => void;
|
|
8
10
|
}
|
|
9
11
|
declare class TabsFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<TabsAdapter<P, S>, P, S> {
|
|
10
12
|
constructor(adapter: TabsAdapter<P, S>);
|
|
@@ -16,5 +18,6 @@ declare class TabsFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
16
18
|
getDefaultActiveKey(): string;
|
|
17
19
|
handleTabListChange(): void;
|
|
18
20
|
handleTabPanesChange(): void;
|
|
21
|
+
handleTabDelete(tabKey: string): void;
|
|
19
22
|
}
|
|
20
23
|
export default TabsFoundation;
|
|
@@ -68,15 +68,11 @@ class TabsFoundation extends BaseFoundation {
|
|
|
68
68
|
handleTabPanesChange() {
|
|
69
69
|
this._adapter.collectPane();
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (typeof activeKey === 'undefined') {
|
|
74
|
-
activeKey = this._adapter.getDefaultActiveKeyFromChildren();
|
|
75
|
-
}
|
|
71
|
+
this._adapter.collectActiveKey();
|
|
72
|
+
}
|
|
76
73
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
74
|
+
handleTabDelete(tabKey) {
|
|
75
|
+
this._adapter.notifyTabDelete(tabKey);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
}
|
package/lib/es/tabs/tabs.css
CHANGED
|
@@ -40,6 +40,13 @@
|
|
|
40
40
|
top: 3px;
|
|
41
41
|
color: var(--semi-color-text-2);
|
|
42
42
|
}
|
|
43
|
+
.semi-tabs-bar .semi-tabs-tab .semi-icon-close {
|
|
44
|
+
margin-right: 0;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
color: var(--semi-color-text-2);
|
|
47
|
+
margin-left: 10px;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
43
50
|
.semi-tabs-bar .semi-tabs-tab:hover {
|
|
44
51
|
color: var(--semi-color-text-0);
|
|
45
52
|
}
|
|
@@ -53,7 +60,6 @@
|
|
|
53
60
|
color: var(--semi-color-text-0);
|
|
54
61
|
}
|
|
55
62
|
.semi-tabs-bar .semi-tabs-tab-active, .semi-tabs-bar .semi-tabs-tab-active:hover {
|
|
56
|
-
color: var(--semi-color-text-0);
|
|
57
63
|
cursor: default;
|
|
58
64
|
font-weight: 600;
|
|
59
65
|
color: var(--semi-color-text-0);
|
|
@@ -61,6 +67,12 @@
|
|
|
61
67
|
.semi-tabs-bar .semi-tabs-tab-active .semi-icon, .semi-tabs-bar .semi-tabs-tab-active:hover .semi-icon {
|
|
62
68
|
color: var(--semi-color-primary);
|
|
63
69
|
}
|
|
70
|
+
.semi-tabs-bar .semi-tabs-tab-active .semi-icon-close, .semi-tabs-bar .semi-tabs-tab-active:hover .semi-icon-close {
|
|
71
|
+
color: var(--semi-color-text-2);
|
|
72
|
+
}
|
|
73
|
+
.semi-tabs-bar .semi-tabs-tab-active .semi-icon-close:hover {
|
|
74
|
+
color: var(--semi-color-text-1);
|
|
75
|
+
}
|
|
64
76
|
.semi-tabs-bar .semi-tabs-tab-disabled {
|
|
65
77
|
cursor: not-allowed;
|
|
66
78
|
color: var(--semi-color-disabled-text);
|