@douyinfe/semi-foundation 2.1.6-alpha.0 → 2.2.1
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/cascader/cascader.scss +1 -1
- package/cascader/constants.ts +4 -0
- package/cascader/foundation.ts +29 -15
- package/cascader/util.ts +13 -0
- package/datePicker/_utils/parser.ts +4 -3
- package/datePicker/datePicker.scss +29 -0
- package/datePicker/foundation.ts +31 -11
- package/datePicker/inputFoundation.ts +2 -0
- package/datePicker/monthsGridFoundation.ts +101 -8
- package/datePicker/rtl.scss +15 -1
- package/datePicker/variables.scss +2 -0
- package/gulpfile.js +3 -1
- package/lib/cjs/cascader/cascader.css +2 -2
- package/lib/cjs/cascader/cascader.scss +1 -1
- package/lib/cjs/cascader/constants.d.ts +3 -0
- package/lib/cjs/cascader/constants.js +6 -1
- package/lib/cjs/cascader/foundation.d.ts +4 -1
- package/lib/cjs/cascader/foundation.js +24 -11
- package/lib/cjs/cascader/util.d.ts +1 -0
- package/lib/cjs/cascader/util.js +17 -0
- package/lib/cjs/datePicker/_utils/parser.d.ts +6 -1
- package/lib/cjs/datePicker/_utils/parser.js +3 -1
- package/lib/cjs/datePicker/datePicker.css +32 -3
- package/lib/cjs/datePicker/datePicker.scss +29 -0
- package/lib/cjs/datePicker/foundation.d.ts +6 -3
- package/lib/cjs/datePicker/foundation.js +40 -14
- package/lib/cjs/datePicker/inputFoundation.js +3 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +35 -3
- package/lib/cjs/datePicker/monthsGridFoundation.js +139 -6
- package/lib/cjs/datePicker/rtl.scss +15 -1
- package/lib/cjs/datePicker/variables.scss +2 -0
- package/lib/cjs/navigation/navigation.css +0 -1
- package/lib/cjs/notification/notification.css +8 -4
- package/lib/cjs/notification/notification.scss +9 -5
- package/lib/cjs/notification/variables.scss +1 -0
- package/lib/cjs/select/foundation.d.ts +10 -1
- package/lib/cjs/select/foundation.js +11 -9
- package/lib/cjs/table/table.css +0 -2
- package/lib/cjs/table/table.scss +0 -2
- package/lib/cjs/tree/treeUtil.js +14 -14
- package/lib/cjs/upload/foundation.d.ts +1 -0
- package/lib/cjs/upload/foundation.js +106 -0
- package/lib/cjs/upload/rtl.scss +0 -4
- package/lib/cjs/upload/upload.css +30 -18
- package/lib/cjs/upload/upload.scss +31 -8
- package/lib/cjs/upload/variables.scss +5 -1
- package/lib/es/cascader/cascader.css +2 -2
- package/lib/es/cascader/cascader.scss +1 -1
- package/lib/es/cascader/constants.d.ts +3 -0
- package/lib/es/cascader/constants.js +6 -1
- package/lib/es/cascader/foundation.d.ts +4 -1
- package/lib/es/cascader/foundation.js +24 -12
- package/lib/es/cascader/util.d.ts +1 -0
- package/lib/es/cascader/util.js +14 -0
- package/lib/es/datePicker/_utils/parser.d.ts +6 -1
- package/lib/es/datePicker/_utils/parser.js +3 -1
- package/lib/es/datePicker/datePicker.css +32 -3
- package/lib/es/datePicker/datePicker.scss +29 -0
- package/lib/es/datePicker/foundation.d.ts +6 -3
- package/lib/es/datePicker/foundation.js +40 -14
- package/lib/es/datePicker/inputFoundation.js +3 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +35 -3
- package/lib/es/datePicker/monthsGridFoundation.js +139 -6
- package/lib/es/datePicker/rtl.scss +15 -1
- package/lib/es/datePicker/variables.scss +2 -0
- package/lib/es/navigation/navigation.css +0 -1
- package/lib/es/notification/notification.css +8 -4
- package/lib/es/notification/notification.scss +9 -5
- package/lib/es/notification/variables.scss +1 -0
- package/lib/es/select/foundation.d.ts +10 -1
- package/lib/es/select/foundation.js +12 -9
- package/lib/es/table/table.css +0 -2
- package/lib/es/table/table.scss +0 -2
- package/lib/es/tree/treeUtil.js +13 -12
- package/lib/es/upload/foundation.d.ts +1 -0
- package/lib/es/upload/foundation.js +107 -0
- package/lib/es/upload/rtl.scss +0 -4
- package/lib/es/upload/upload.css +30 -18
- package/lib/es/upload/upload.scss +31 -8
- package/lib/es/upload/variables.scss +5 -1
- package/notification/notification.scss +9 -5
- package/notification/variables.scss +1 -0
- package/package.json +4 -4
- package/select/foundation.ts +11 -9
- package/table/table.scss +0 -2
- package/tree/treeUtil.ts +6 -2
- package/upload/foundation.ts +81 -0
- package/upload/rtl.scss +0 -4
- package/upload/upload.scss +31 -8
- package/upload/variables.scss +5 -1
|
@@ -210,11 +210,99 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
210
210
|
|
|
211
211
|
|
|
212
212
|
destroy() {}
|
|
213
|
+
/**
|
|
214
|
+
* sync change another panel month when change months from the else yam panel
|
|
215
|
+
* call it when
|
|
216
|
+
* - current change panel targe date month is same with another panel date
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* - panelType=right, target=new Date('2022-09-01') and left panel is in '2022-09' => call it, left panel minus one month to '2022-08'
|
|
220
|
+
* - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
handleSyncChangeMonths(options) {
|
|
225
|
+
const {
|
|
226
|
+
panelType,
|
|
227
|
+
target
|
|
228
|
+
} = options;
|
|
229
|
+
|
|
230
|
+
const {
|
|
231
|
+
type
|
|
232
|
+
} = this._adapter.getProps();
|
|
233
|
+
|
|
234
|
+
const {
|
|
235
|
+
monthLeft,
|
|
236
|
+
monthRight
|
|
237
|
+
} = this._adapter.getStates();
|
|
238
|
+
|
|
239
|
+
if (this.isRangeType(type)) {
|
|
240
|
+
if (panelType === 'right' && differenceInCalendarMonths(target, monthLeft.pickerDate) === 0) {
|
|
241
|
+
this.handleYearOrMonthChange('prevMonth', 'left', 1, true);
|
|
242
|
+
} else if (panelType === 'left' && differenceInCalendarMonths(monthRight.pickerDate, target) === 0) {
|
|
243
|
+
this.handleYearOrMonthChange('nextMonth', 'right', 1, true);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the target date based on the panel type and switch type
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
getTargetChangeDate(options) {
|
|
253
|
+
const {
|
|
254
|
+
panelType,
|
|
255
|
+
switchType
|
|
256
|
+
} = options;
|
|
257
|
+
|
|
258
|
+
const {
|
|
259
|
+
monthRight,
|
|
260
|
+
monthLeft
|
|
261
|
+
} = this._adapter.getStates();
|
|
262
|
+
|
|
263
|
+
const currentDate = panelType === 'left' ? monthLeft.pickerDate : monthRight.pickerDate;
|
|
264
|
+
let target;
|
|
265
|
+
|
|
266
|
+
switch (switchType) {
|
|
267
|
+
case 'prevMonth':
|
|
268
|
+
target = addMonths(currentDate, -1);
|
|
269
|
+
break;
|
|
270
|
+
|
|
271
|
+
case 'nextMonth':
|
|
272
|
+
target = addMonths(currentDate, 1);
|
|
273
|
+
break;
|
|
274
|
+
|
|
275
|
+
case 'prevYear':
|
|
276
|
+
target = addYears(currentDate, -1);
|
|
277
|
+
break;
|
|
278
|
+
|
|
279
|
+
case 'nextYear':
|
|
280
|
+
target = addYears(currentDate, 1);
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return target;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Change month by yam panel
|
|
288
|
+
*/
|
|
289
|
+
|
|
213
290
|
|
|
214
291
|
toMonth(panelType, target) {
|
|
292
|
+
const {
|
|
293
|
+
type
|
|
294
|
+
} = this._adapter.getProps();
|
|
295
|
+
|
|
215
296
|
const diff = this._getDiff('month', target, panelType);
|
|
216
297
|
|
|
217
298
|
this.handleYearOrMonthChange(diff < 0 ? 'prevMonth' : 'nextMonth', panelType, Math.abs(diff), false);
|
|
299
|
+
|
|
300
|
+
if (this.isRangeType(type)) {
|
|
301
|
+
this.handleSyncChangeMonths({
|
|
302
|
+
panelType,
|
|
303
|
+
target
|
|
304
|
+
});
|
|
305
|
+
}
|
|
218
306
|
}
|
|
219
307
|
|
|
220
308
|
toYear(panelType, target) {
|
|
@@ -236,34 +324,51 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
236
324
|
return typeof realType === 'string' && /range/i.test(realType);
|
|
237
325
|
}
|
|
238
326
|
|
|
239
|
-
|
|
327
|
+
handleSwitchMonthOrYear(switchType, panelType) {
|
|
240
328
|
const {
|
|
241
329
|
type,
|
|
242
330
|
syncSwitchMonth
|
|
243
331
|
} = this.getProps();
|
|
332
|
+
const rangeType = this.isRangeType(type); // range type and syncSwitchMonth, we should change panels at same time
|
|
244
333
|
|
|
245
|
-
if (
|
|
334
|
+
if (rangeType && syncSwitchMonth) {
|
|
246
335
|
this.handleYearOrMonthChange(switchType, 'left', 1, true);
|
|
247
336
|
this.handleYearOrMonthChange(switchType, 'right', 1, true);
|
|
248
337
|
} else {
|
|
249
338
|
this.handleYearOrMonthChange(switchType, panelType);
|
|
339
|
+
/**
|
|
340
|
+
* default behavior (v2.2.0)
|
|
341
|
+
* In order to prevent the two panels from being the same month, this will confuse the user when selecting the range
|
|
342
|
+
* https://github.com/DouyinFE/semi-design/issues/260
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
if (rangeType) {
|
|
346
|
+
const target = this.getTargetChangeDate({
|
|
347
|
+
panelType,
|
|
348
|
+
switchType
|
|
349
|
+
});
|
|
350
|
+
this.handleSyncChangeMonths({
|
|
351
|
+
panelType,
|
|
352
|
+
target
|
|
353
|
+
});
|
|
354
|
+
}
|
|
250
355
|
}
|
|
251
356
|
}
|
|
252
357
|
|
|
253
358
|
prevMonth(panelType) {
|
|
254
|
-
this.
|
|
359
|
+
this.handleSwitchMonthOrYear('prevMonth', panelType);
|
|
255
360
|
}
|
|
256
361
|
|
|
257
362
|
nextMonth(panelType) {
|
|
258
|
-
this.
|
|
363
|
+
this.handleSwitchMonthOrYear('nextMonth', panelType);
|
|
259
364
|
}
|
|
260
365
|
|
|
261
366
|
prevYear(panelType) {
|
|
262
|
-
this.
|
|
367
|
+
this.handleSwitchMonthOrYear('prevYear', panelType);
|
|
263
368
|
}
|
|
264
369
|
|
|
265
370
|
nextYear(panelType) {
|
|
266
|
-
this.
|
|
371
|
+
this.handleSwitchMonthOrYear('nextYear', panelType);
|
|
267
372
|
}
|
|
268
373
|
/**
|
|
269
374
|
* Calculate the year and month difference
|
|
@@ -920,5 +1025,33 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
920
1025
|
isYearPickerOpen: false
|
|
921
1026
|
});
|
|
922
1027
|
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Get year and month panel open type
|
|
1030
|
+
*
|
|
1031
|
+
* It is useful info to set minHeight of weeks.
|
|
1032
|
+
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
1033
|
+
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
1034
|
+
*/
|
|
1035
|
+
|
|
1036
|
+
|
|
1037
|
+
getYAMOpenType() {
|
|
1038
|
+
const {
|
|
1039
|
+
monthLeft,
|
|
1040
|
+
monthRight
|
|
1041
|
+
} = this._adapter.getStates();
|
|
1042
|
+
|
|
1043
|
+
const leftYearPickerOpen = monthLeft.isYearPickerOpen;
|
|
1044
|
+
const rightYearPickerOpen = monthRight.isYearPickerOpen;
|
|
1045
|
+
|
|
1046
|
+
if (leftYearPickerOpen && rightYearPickerOpen) {
|
|
1047
|
+
return 'both';
|
|
1048
|
+
} else if (leftYearPickerOpen) {
|
|
1049
|
+
return 'left';
|
|
1050
|
+
} else if (rightYearPickerOpen) {
|
|
1051
|
+
return 'right';
|
|
1052
|
+
} else {
|
|
1053
|
+
return 'none';
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
923
1056
|
|
|
924
1057
|
}
|
|
@@ -9,6 +9,18 @@ $module: #{$prefix}-datepicker;
|
|
|
9
9
|
padding-right: 0;
|
|
10
10
|
padding-left: $spacing-datepicker_footer-paddingRight;
|
|
11
11
|
text-align: left;
|
|
12
|
+
|
|
13
|
+
.#{$prefix}-button {
|
|
14
|
+
&:first-of-type {
|
|
15
|
+
margin-left: 0;
|
|
16
|
+
margin-right: 0;
|
|
17
|
+
}
|
|
18
|
+
// confirm button
|
|
19
|
+
&:nth-of-type(2) {
|
|
20
|
+
margin-right: $spacing-datepicker_footer_cancel_button-marginRight;
|
|
21
|
+
margin-left: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
&-day {
|
|
@@ -66,7 +78,9 @@ $module: #{$prefix}-datepicker;
|
|
|
66
78
|
&-yam {
|
|
67
79
|
// rtl 对箭头进行翻转
|
|
68
80
|
.#{$prefix}-icon-chevron_left,
|
|
69
|
-
.#{$prefix}-icon-chevron_right
|
|
81
|
+
.#{$prefix}-icon-chevron_right,
|
|
82
|
+
.#{$prefix}-icon-double_chevron_left,
|
|
83
|
+
.#{$prefix}-icon-double_chevron_right {
|
|
70
84
|
transform: scaleX(-1);
|
|
71
85
|
}
|
|
72
86
|
}
|
|
@@ -33,6 +33,8 @@ $spacing-datepicker_scrolllist_body-padding: 0; // 时间选择滚动菜单内
|
|
|
33
33
|
$spacing-datepicker_footer-paddingTop: 10px; // 确认选择 footer 顶部内边距
|
|
34
34
|
$spacing-datepicker_footer-paddingBottom: 10px; // 确认选择 footer 底部内边距
|
|
35
35
|
$spacing-datepicker_footer-paddingRight: 8px; // 确认选择 footer 右侧内边距
|
|
36
|
+
$spacing-datepicker_footer_cancel_button-marginRight: 12px; // 确认选择 footer 取消按钮右外边距
|
|
37
|
+
$spacing-datepicker_footer_confirm_button-marginRight: 8px; // 确认选择 footer 确认按钮右外边距
|
|
36
38
|
$spacing-datepicker_navigation-paddingY: $spacing-base-tight; // 年月切换 header 垂直内边距
|
|
37
39
|
$spacing-datepicker_navigation-paddingX: $spacing-base; // 年月切换 header 水平内边距
|
|
38
40
|
$spacing-datepicker_month-padding: $spacing-base;
|
|
@@ -79,19 +79,23 @@
|
|
|
79
79
|
color: var(--semi-color-success);
|
|
80
80
|
}
|
|
81
81
|
.semi-notification-notice-light.semi-notification-notice-warning {
|
|
82
|
-
background-
|
|
82
|
+
background-image: linear-gradient(0deg, var(--semi-color-warning-light-default), var(--semi-color-warning-light-default));
|
|
83
|
+
background-color: var(--semi-color-bg-0);
|
|
83
84
|
border: 1px solid var(--semi-color-warning);
|
|
84
85
|
}
|
|
85
86
|
.semi-notification-notice-light.semi-notification-notice-success {
|
|
86
|
-
background-
|
|
87
|
+
background-image: linear-gradient(0deg, var(--semi-color-success-light-default), var(--semi-color-success-light-default));
|
|
88
|
+
background-color: var(--semi-color-bg-0);
|
|
87
89
|
border: 1px solid var(--semi-color-success);
|
|
88
90
|
}
|
|
89
91
|
.semi-notification-notice-light.semi-notification-notice-info, .semi-notification-notice-light.semi-notification-notice-default {
|
|
90
|
-
background-
|
|
92
|
+
background-image: linear-gradient(0deg, var(--semi-color-info-light-default), var(--semi-color-info-light-default));
|
|
93
|
+
background-color: var(--semi-color-bg-0);
|
|
91
94
|
border: 1px solid var(--semi-color-info);
|
|
92
95
|
}
|
|
93
96
|
.semi-notification-notice-light.semi-notification-notice-error {
|
|
94
|
-
background-
|
|
97
|
+
background-image: linear-gradient(0deg, var(--semi-color-danger-light-default), var(--semi-color-danger-light-default));
|
|
98
|
+
background-color: var(--semi-color-bg-0);
|
|
95
99
|
border: 1px solid var(--semi-color-danger);
|
|
96
100
|
}
|
|
97
101
|
.semi-notification-notice-title {
|
|
@@ -93,23 +93,27 @@ $module: #{$prefix}-notification;
|
|
|
93
93
|
|
|
94
94
|
&-light {
|
|
95
95
|
&.#{$module}-notice-warning {
|
|
96
|
-
background-
|
|
96
|
+
background-image: linear-gradient(0deg, $color-notification_warning_light-bg, $color-notification_warning_light-bg);
|
|
97
|
+
background-color: $color-notification_ambient-bg;
|
|
97
98
|
border: $width-notification_notice-border solid $color-notification_warning_light-border;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
&.#{$module}-notice-success {
|
|
101
|
-
background-
|
|
102
|
+
background-image: linear-gradient(0deg, $color-notification_success_light-bg, $color-notification_success_light-bg);
|
|
103
|
+
background-color: $color-notification_ambient-bg;
|
|
102
104
|
border: $width-notification_notice-border solid $color-notification_success_light-border;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
&.#{$module}-notice-info,
|
|
106
108
|
&.#{$module}-notice-default {
|
|
107
|
-
background-
|
|
109
|
+
background-image: linear-gradient(0deg, $color-notification_info_light-bg, $color-notification_info_light-bg);
|
|
110
|
+
background-color: $color-notification_ambient-bg;
|
|
108
111
|
border: $width-notification_notice-border solid $color-notification_info_light-border;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
&.#{$module}-notice-error {
|
|
112
|
-
background-
|
|
115
|
+
background-image: linear-gradient(0deg, $color-notification_danger_light-bg, $color-notification_danger_light-bg);
|
|
116
|
+
background-color: $color-notification_ambient-bg;
|
|
113
117
|
border: $width-notification_notice-border solid $color-notification_danger_light-border;
|
|
114
118
|
}
|
|
115
119
|
}
|
|
@@ -165,4 +169,4 @@ $module: #{$prefix}-notification;
|
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
@import "./rtl.scss";
|
|
172
|
+
@import "./rtl.scss";
|
|
@@ -15,6 +15,7 @@ $color-notification_info_light-bg: var(--semi-color-info-light-default); // 彩
|
|
|
15
15
|
$color-notification_info_light-border: var(--semi-color-info); // 彩色通知信息描边色
|
|
16
16
|
$color-notification_danger_light-bg: var(--semi-color-danger-light-default); // 彩色通知危险背景色
|
|
17
17
|
$color-notification_danger_light-border: var(--semi-color-danger); // 彩色通知危险描边色
|
|
18
|
+
$color-notification_ambient-bg: var(--semi-color-bg-0); // 透明背景色叠加层(与bg0保持一致不建议修改)
|
|
18
19
|
|
|
19
20
|
// Width/Height
|
|
20
21
|
$width-notification_notice: auto; // 通知宽度
|
|
@@ -82,7 +82,16 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
|
|
|
82
82
|
_handleEnterKeyDown(event: KeyboardEvent): void;
|
|
83
83
|
_handleBackspaceKeyDown(): void;
|
|
84
84
|
_notifyChange(selections: Map<any, any>): void;
|
|
85
|
-
_removeInternalKey(option: BasicOptionProps):
|
|
85
|
+
_removeInternalKey(option: BasicOptionProps): {
|
|
86
|
+
[x: string]: any;
|
|
87
|
+
value?: string | number;
|
|
88
|
+
label?: unknown;
|
|
89
|
+
children?: unknown;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
showTick?: boolean;
|
|
92
|
+
className?: string;
|
|
93
|
+
style?: Record<string, any>;
|
|
94
|
+
};
|
|
86
95
|
_notifySelect(value: BasicOptionProps['value'], option: BasicOptionProps): void;
|
|
87
96
|
_notifyDeselect(value: BasicOptionProps['value'], option: BasicOptionProps): void;
|
|
88
97
|
_diffSelections(selections: Map<any, any>, oldSelections: Map<any, any>, isMultiple: boolean): boolean;
|
|
@@ -1020,17 +1020,20 @@ export default class SelectFoundation extends BaseFoundation {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
_removeInternalKey(option) {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
delete
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1023
|
+
// eslint-disable-next-line
|
|
1024
|
+
let newOption = _Object$assign({}, option);
|
|
1025
|
+
|
|
1026
|
+
delete newOption._parentGroup;
|
|
1027
|
+
delete newOption._show;
|
|
1028
|
+
delete newOption._selected;
|
|
1029
|
+
delete newOption._scrollIndex;
|
|
1030
|
+
|
|
1031
|
+
if ('_keyInOptionList' in newOption) {
|
|
1032
|
+
newOption.key = newOption._keyInOptionList;
|
|
1033
|
+
delete newOption._keyInOptionList;
|
|
1031
1034
|
}
|
|
1032
1035
|
|
|
1033
|
-
return
|
|
1036
|
+
return newOption;
|
|
1034
1037
|
}
|
|
1035
1038
|
|
|
1036
1039
|
_notifySelect(value, option) {
|
package/lib/es/table/table.css
CHANGED
|
@@ -52,12 +52,10 @@
|
|
|
52
52
|
color: var(--semi-color-text-0);
|
|
53
53
|
width: 100%;
|
|
54
54
|
}
|
|
55
|
-
.semi-table-middle .semi-table-thead > .semi-table-row > .semi-table-row-head,
|
|
56
55
|
.semi-table-middle .semi-table-tbody > .semi-table-row > .semi-table-row-cell {
|
|
57
56
|
padding-top: 12px;
|
|
58
57
|
padding-bottom: 12px;
|
|
59
58
|
}
|
|
60
|
-
.semi-table-small .semi-table-thead > .semi-table-row > .semi-table-row-head,
|
|
61
59
|
.semi-table-small .semi-table-tbody > .semi-table-row > .semi-table-row-cell {
|
|
62
60
|
padding-top: 8px;
|
|
63
61
|
padding-bottom: 8px;
|
package/lib/es/table/table.scss
CHANGED
|
@@ -25,7 +25,6 @@ $module: #{$prefix}-table;
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
&-middle {
|
|
28
|
-
.#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
|
|
29
28
|
.#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
|
|
30
29
|
padding-top: $spacing-table_middle-paddingY;
|
|
31
30
|
padding-bottom: $spacing-table_middle-paddingY;
|
|
@@ -33,7 +32,6 @@ $module: #{$prefix}-table;
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
&-small {
|
|
36
|
-
.#{$module}-thead > .#{$module}-row > .#{$module}-row-head,
|
|
37
35
|
.#{$module}-tbody > .#{$module}-row > .#{$module}-row-cell {
|
|
38
36
|
padding-top: $spacing-table_small-paddingY;
|
|
39
37
|
padding-bottom: $spacing-table_small-paddingY;
|
package/lib/es/tree/treeUtil.js
CHANGED
|
@@ -17,9 +17,8 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
|
|
|
17
17
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
18
18
|
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
19
19
|
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
20
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
21
|
-
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
22
20
|
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
21
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
23
22
|
import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
|
|
24
23
|
const DRAG_OFFSET = 0.45;
|
|
25
24
|
|
|
@@ -498,7 +497,7 @@ export function normalizedArr(val) {
|
|
|
498
497
|
}
|
|
499
498
|
export function normalizeKeyList(keyList, keyEntities) {
|
|
500
499
|
let leafOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
501
|
-
|
|
500
|
+
const res = [];
|
|
502
501
|
const keyListSet = new _Set(keyList);
|
|
503
502
|
|
|
504
503
|
if (!leafOnly) {
|
|
@@ -518,9 +517,11 @@ export function normalizeKeyList(keyList, keyEntities) {
|
|
|
518
517
|
res.push(key);
|
|
519
518
|
});
|
|
520
519
|
} else {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
520
|
+
_forEachInstanceProperty(keyList).call(keyList, key => {
|
|
521
|
+
if (keyEntities[key] && !isValid(keyEntities[key].children)) {
|
|
522
|
+
res.push(key);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
524
525
|
}
|
|
525
526
|
|
|
526
527
|
return res;
|
|
@@ -529,9 +530,9 @@ export function getMotionKeys(eventKey, expandedKeys, keyEntities) {
|
|
|
529
530
|
const res = [];
|
|
530
531
|
|
|
531
532
|
const getChild = itemKey => {
|
|
532
|
-
var
|
|
533
|
+
var _context8;
|
|
533
534
|
|
|
534
|
-
keyEntities[itemKey].children && _forEachInstanceProperty(
|
|
535
|
+
keyEntities[itemKey].children && _forEachInstanceProperty(_context8 = keyEntities[itemKey].children).call(_context8, item => {
|
|
535
536
|
const {
|
|
536
537
|
key
|
|
537
538
|
} = item;
|
|
@@ -647,7 +648,7 @@ export function calcCheckedKeysForUnchecked(key, keyEntities, checkedKeys, halfC
|
|
|
647
648
|
};
|
|
648
649
|
}
|
|
649
650
|
export function filterTreeData(info) {
|
|
650
|
-
var
|
|
651
|
+
var _context9, _context10;
|
|
651
652
|
|
|
652
653
|
const {
|
|
653
654
|
showFilteredOnly,
|
|
@@ -659,7 +660,7 @@ export function filterTreeData(info) {
|
|
|
659
660
|
prevExpandedKeys
|
|
660
661
|
} = info;
|
|
661
662
|
let filteredOptsKeys = [];
|
|
662
|
-
filteredOptsKeys = _mapInstanceProperty(
|
|
663
|
+
filteredOptsKeys = _mapInstanceProperty(_context9 = _filterInstanceProperty(_context10 = _Object$values(keyEntities)).call(_context10, item => filter(inputValue, item.data, filterTreeNode, filterProps))).call(_context9, item => item.key);
|
|
663
664
|
let expandedOptsKeys = findAncestorKeys(filteredOptsKeys, keyEntities, false);
|
|
664
665
|
|
|
665
666
|
if (prevExpandedKeys.length) {
|
|
@@ -700,9 +701,9 @@ export function updateKeys(keySet, keyEntities) {
|
|
|
700
701
|
return _filterInstanceProperty(keyArr).call(keyArr, key => key in keyEntities);
|
|
701
702
|
}
|
|
702
703
|
export function calcDisabledKeys(keyEntities) {
|
|
703
|
-
var
|
|
704
|
+
var _context11;
|
|
704
705
|
|
|
705
|
-
const disabledKeys = _filterInstanceProperty(
|
|
706
|
+
const disabledKeys = _filterInstanceProperty(_context11 = _Object$keys(keyEntities)).call(_context11, key => keyEntities[key].data.disabled);
|
|
706
707
|
|
|
707
708
|
const {
|
|
708
709
|
checkedKeys
|
|
@@ -119,6 +119,7 @@ declare class UploadFoundation<P = Record<string, any>, S = Record<string, any>>
|
|
|
119
119
|
buildFileItem(fileInstance: CustomFile, uploadTrigger: string): BaseFileItem;
|
|
120
120
|
replaceFileList(files: Array<CustomFile>): void;
|
|
121
121
|
addFilesToList(files: Array<CustomFile>): void;
|
|
122
|
+
insertFileToList(files: Array<CustomFile>, index: number): void;
|
|
122
123
|
manualUpload(): void;
|
|
123
124
|
startUpload(fileList: Array<BaseFileItem>): void;
|
|
124
125
|
upload(file: BaseFileItem): void;
|
|
@@ -383,6 +383,113 @@ class UploadFoundation extends BaseFoundation {
|
|
|
383
383
|
this.startUpload(currentFiles);
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
|
+
} // 插入多个文件到指定位置
|
|
387
|
+
// Insert files to the specified location
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
insertFileToList(files, index) {
|
|
391
|
+
const {
|
|
392
|
+
limit,
|
|
393
|
+
transformFile,
|
|
394
|
+
accept,
|
|
395
|
+
uploadTrigger
|
|
396
|
+
} = this.getProps();
|
|
397
|
+
const {
|
|
398
|
+
fileList
|
|
399
|
+
} = this.getStates();
|
|
400
|
+
const unAcceptFileList = []; // 当次选中的文件
|
|
401
|
+
// current selected file
|
|
402
|
+
|
|
403
|
+
let currentFileList = _Array$from(files);
|
|
404
|
+
|
|
405
|
+
if (typeof accept !== 'undefined') {
|
|
406
|
+
currentFileList = _filterInstanceProperty(currentFileList).call(currentFileList, item => {
|
|
407
|
+
const isValid = this.checkFileFormat(accept, item);
|
|
408
|
+
|
|
409
|
+
if (!isValid) {
|
|
410
|
+
unAcceptFileList.push(item);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return isValid;
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
if (unAcceptFileList.length !== 0) {
|
|
417
|
+
this._adapter.notifyAcceptInvalid(unAcceptFileList);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
if (currentFileList.length === 0) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
currentFileList = _mapInstanceProperty(currentFileList).call(currentFileList, file => {
|
|
426
|
+
if (!file.uid) {
|
|
427
|
+
file.uid = getUuidv4();
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
if (this.checkFileSize(file)) {
|
|
431
|
+
file._sizeInvalid = true;
|
|
432
|
+
file.status = FILE_STATUS_VALID_FAIL;
|
|
433
|
+
|
|
434
|
+
this._adapter.notifySizeError(file, fileList);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (transformFile) {
|
|
438
|
+
file = transformFile(file);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
return file;
|
|
442
|
+
});
|
|
443
|
+
const total = fileList.length + currentFileList.length;
|
|
444
|
+
|
|
445
|
+
if (typeof limit !== 'undefined') {
|
|
446
|
+
// 判断是否超出限制
|
|
447
|
+
// Determine whether the limit is exceeded
|
|
448
|
+
if (total > limit) {
|
|
449
|
+
if (limit === 1) {
|
|
450
|
+
// 使用最后面的文件对当前文件进行替换
|
|
451
|
+
// Use the last file to replace the current file
|
|
452
|
+
currentFileList = _sliceInstanceProperty(currentFileList).call(currentFileList, -1);
|
|
453
|
+
|
|
454
|
+
this._adapter.notifyFileSelect(currentFileList);
|
|
455
|
+
|
|
456
|
+
this._adapter.resetInput();
|
|
457
|
+
|
|
458
|
+
this.replaceFileList(currentFileList);
|
|
459
|
+
return;
|
|
460
|
+
} // 如果超出了限制,则计算还能添加几个文件,将剩余的文件继续上传
|
|
461
|
+
// If the limit is exceeded, several files can be added to the calculation, and the remaining files will continue to be uploaded
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
const restNum = limit - fileList.length;
|
|
465
|
+
currentFileList = _sliceInstanceProperty(currentFileList).call(currentFileList, 0, restNum);
|
|
466
|
+
|
|
467
|
+
this._adapter.notifyExceed(currentFileList);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const fileItemList = _mapInstanceProperty(currentFileList).call(currentFileList, file => this.buildFileItem(file, uploadTrigger));
|
|
472
|
+
|
|
473
|
+
const newFileList = _sliceInstanceProperty(fileList).call(fileList);
|
|
474
|
+
|
|
475
|
+
if (typeof index !== 'undefined') {
|
|
476
|
+
_spliceInstanceProperty(newFileList).call(newFileList, index, 0, ...fileItemList);
|
|
477
|
+
} else {
|
|
478
|
+
newFileList.push(...fileItemList);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
this._adapter.notifyFileSelect(currentFileList);
|
|
482
|
+
|
|
483
|
+
this._adapter.notifyChange({
|
|
484
|
+
fileList: newFileList,
|
|
485
|
+
currentFile: null
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
this._adapter.updateFileList(newFileList, () => {
|
|
489
|
+
if (uploadTrigger === TRIGGER_AUTO) {
|
|
490
|
+
this.startUpload(fileItemList);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
386
493
|
}
|
|
387
494
|
|
|
388
495
|
manualUpload() {
|
package/lib/es/upload/rtl.scss
CHANGED
|
@@ -22,8 +22,6 @@ $module: #{$prefix}-upload;
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
&-file-card {
|
|
25
|
-
margin-right: 0;
|
|
26
|
-
margin-left: $spacing-upload_picture_file_card-marginRight;
|
|
27
25
|
|
|
28
26
|
&-info {
|
|
29
27
|
|
|
@@ -53,8 +51,6 @@ $module: #{$prefix}-upload;
|
|
|
53
51
|
&-picture {
|
|
54
52
|
|
|
55
53
|
&-file-card {
|
|
56
|
-
margin-right: 0;
|
|
57
|
-
margin-left: $spacing-upload_picture_file_card-marginRight;
|
|
58
54
|
|
|
59
55
|
&-close {
|
|
60
56
|
right: auto;
|