@douyinfe/semi-foundation 2.2.0-beta.0 → 2.2.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/datePicker/_utils/parser.ts +4 -3
- package/datePicker/datePicker.scss +11 -0
- package/datePicker/foundation.ts +33 -15
- package/datePicker/inputFoundation.ts +2 -0
- package/datePicker/monthsGridFoundation.ts +10 -3
- package/datePicker/rtl.scss +15 -1
- package/datePicker/variables.scss +2 -0
- package/gulpfile.js +3 -1
- package/inputNumber/foundation.ts +3 -2
- 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 +26 -3
- package/lib/cjs/datePicker/datePicker.scss +11 -0
- package/lib/cjs/datePicker/foundation.d.ts +6 -3
- package/lib/cjs/datePicker/foundation.js +42 -18
- package/lib/cjs/datePicker/inputFoundation.js +3 -0
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGridFoundation.js +16 -3
- package/lib/cjs/datePicker/rtl.scss +15 -1
- package/lib/cjs/datePicker/variables.scss +2 -0
- package/lib/cjs/inputNumber/foundation.d.ts +2 -2
- package/lib/cjs/inputNumber/foundation.js +3 -1
- 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/es/datePicker/_utils/parser.d.ts +6 -1
- package/lib/es/datePicker/_utils/parser.js +3 -1
- package/lib/es/datePicker/datePicker.css +26 -3
- package/lib/es/datePicker/datePicker.scss +11 -0
- package/lib/es/datePicker/foundation.d.ts +6 -3
- package/lib/es/datePicker/foundation.js +42 -18
- package/lib/es/datePicker/inputFoundation.js +3 -0
- package/lib/es/datePicker/monthsGridFoundation.d.ts +1 -0
- package/lib/es/datePicker/monthsGridFoundation.js +15 -3
- package/lib/es/datePicker/rtl.scss +15 -1
- package/lib/es/datePicker/variables.scss +2 -0
- package/lib/es/inputNumber/foundation.d.ts +2 -2
- package/lib/es/inputNumber/foundation.js +3 -1
- 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/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
|
@@ -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;
|
|
@@ -1038,17 +1038,19 @@ class SelectFoundation extends _foundation.default {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
1040
1040
|
_removeInternalKey(option) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
delete
|
|
1044
|
-
delete
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1041
|
+
// eslint-disable-next-line
|
|
1042
|
+
let newOption = (0, _assign.default)({}, option);
|
|
1043
|
+
delete newOption._parentGroup;
|
|
1044
|
+
delete newOption._show;
|
|
1045
|
+
delete newOption._selected;
|
|
1046
|
+
delete newOption._scrollIndex;
|
|
1047
|
+
|
|
1048
|
+
if ('_keyInOptionList' in newOption) {
|
|
1049
|
+
newOption.key = newOption._keyInOptionList;
|
|
1050
|
+
delete newOption._keyInOptionList;
|
|
1049
1051
|
}
|
|
1050
1052
|
|
|
1051
|
-
return
|
|
1053
|
+
return newOption;
|
|
1052
1054
|
}
|
|
1053
1055
|
|
|
1054
1056
|
_notifySelect(value, option) {
|
package/lib/cjs/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/cjs/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;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file
|
|
3
|
+
* Various date-related analysis methods
|
|
4
|
+
*/
|
|
5
|
+
import { Locale } from 'date-fns';
|
|
1
6
|
/**
|
|
2
7
|
* Parsing value to Date object
|
|
3
8
|
*/
|
|
4
|
-
export declare function compatiableParse(value: string, formatToken?: string, baseDate?: Date, locale?:
|
|
9
|
+
export declare function compatiableParse(value: string, formatToken?: string, baseDate?: Date, locale?: Locale): Date | null;
|
|
@@ -26,7 +26,9 @@ export function compatiableParse(value, formatToken, baseDate, locale) {
|
|
|
26
26
|
result = new Date(Date.parse(value));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
const yearInvalid = isValid(result) && String(result.getFullYear()).length > 4;
|
|
30
|
+
|
|
31
|
+
if (!isValid(result) || yearInvalid) {
|
|
30
32
|
result = null;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@charset "UTF-8";
|
|
2
1
|
/* shadow */
|
|
3
2
|
/* sizing */
|
|
4
3
|
/* spacing */
|
|
@@ -99,6 +98,12 @@
|
|
|
99
98
|
text-align: right;
|
|
100
99
|
background-color: var(--semi-color-fill-0);
|
|
101
100
|
}
|
|
101
|
+
.semi-datepicker-footer .semi-button:first-of-type {
|
|
102
|
+
margin-right: 12px;
|
|
103
|
+
}
|
|
104
|
+
.semi-datepicker-footer .semi-button:nth-of-type(2) {
|
|
105
|
+
margin-right: 8px;
|
|
106
|
+
}
|
|
102
107
|
.semi-datepicker-yam {
|
|
103
108
|
position: absolute;
|
|
104
109
|
top: 0;
|
|
@@ -706,6 +711,16 @@
|
|
|
706
711
|
padding-left: 8px;
|
|
707
712
|
text-align: left;
|
|
708
713
|
}
|
|
714
|
+
.semi-rtl .semi-datepicker-footer .semi-button:first-of-type,
|
|
715
|
+
.semi-portal-rtl .semi-datepicker-footer .semi-button:first-of-type {
|
|
716
|
+
margin-left: 0;
|
|
717
|
+
margin-right: 0;
|
|
718
|
+
}
|
|
719
|
+
.semi-rtl .semi-datepicker-footer .semi-button:nth-of-type(2),
|
|
720
|
+
.semi-portal-rtl .semi-datepicker-footer .semi-button:nth-of-type(2) {
|
|
721
|
+
margin-right: 12px;
|
|
722
|
+
margin-left: 0;
|
|
723
|
+
}
|
|
709
724
|
.semi-rtl .semi-datepicker-day-offsetrange-start .semi-datepicker-day-main,
|
|
710
725
|
.semi-portal-rtl .semi-datepicker-day-offsetrange-start .semi-datepicker-day-main {
|
|
711
726
|
border-radius: 0 var(--semi-border-radius-small) var(--semi-border-radius-small) 0;
|
|
@@ -741,12 +756,20 @@
|
|
|
741
756
|
margin-right: 8px;
|
|
742
757
|
}
|
|
743
758
|
.semi-rtl .semi-datepicker-navigation .semi-icon-chevron_left,
|
|
744
|
-
.semi-rtl .semi-datepicker-navigation .semi-icon-chevron_right,
|
|
759
|
+
.semi-rtl .semi-datepicker-navigation .semi-icon-chevron_right,
|
|
760
|
+
.semi-rtl .semi-datepicker-navigation .semi-icon-double_chevron_left,
|
|
761
|
+
.semi-rtl .semi-datepicker-navigation .semi-icon-double_chevron_right, .semi-rtl .semi-datepicker-yam .semi-icon-chevron_left,
|
|
745
762
|
.semi-rtl .semi-datepicker-yam .semi-icon-chevron_right,
|
|
763
|
+
.semi-rtl .semi-datepicker-yam .semi-icon-double_chevron_left,
|
|
764
|
+
.semi-rtl .semi-datepicker-yam .semi-icon-double_chevron_right,
|
|
746
765
|
.semi-portal-rtl .semi-datepicker-navigation .semi-icon-chevron_left,
|
|
747
766
|
.semi-portal-rtl .semi-datepicker-navigation .semi-icon-chevron_right,
|
|
767
|
+
.semi-portal-rtl .semi-datepicker-navigation .semi-icon-double_chevron_left,
|
|
768
|
+
.semi-portal-rtl .semi-datepicker-navigation .semi-icon-double_chevron_right,
|
|
748
769
|
.semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_left,
|
|
749
|
-
.semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_right
|
|
770
|
+
.semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_right,
|
|
771
|
+
.semi-portal-rtl .semi-datepicker-yam .semi-icon-double_chevron_left,
|
|
772
|
+
.semi-portal-rtl .semi-datepicker-yam .semi-icon-double_chevron_right {
|
|
750
773
|
transform: scaleX(-1);
|
|
751
774
|
}
|
|
752
775
|
.semi-rtl .semi-datepicker-range-input-prefix,
|
|
@@ -140,6 +140,17 @@ $module: #{$prefix}-datepicker;
|
|
|
140
140
|
padding-bottom: $spacing-datepicker_footer-paddingBottom;
|
|
141
141
|
text-align: right;
|
|
142
142
|
background-color: $color-datepicker_footer-bg-default;
|
|
143
|
+
|
|
144
|
+
.#{$prefix}-button {
|
|
145
|
+
// cancel button
|
|
146
|
+
&:first-of-type {
|
|
147
|
+
margin-right: $spacing-datepicker_footer_cancel_button-marginRight;
|
|
148
|
+
}
|
|
149
|
+
// confirm button
|
|
150
|
+
&:nth-of-type(2) {
|
|
151
|
+
margin-right: $spacing-datepicker_footer_confirm_button-marginRight;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
// 年月选择
|
|
@@ -201,10 +201,13 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
201
201
|
* 2. set cachedSelectedValue using given dates(in needConfirm mode)
|
|
202
202
|
* - directly closePanel without click confirm will set cachedSelectedValue to state value
|
|
203
203
|
* - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
|
|
204
|
-
* @param {String} inputValue
|
|
205
|
-
* @param {Date[]} dates
|
|
206
204
|
*/
|
|
207
|
-
rangeTypeSideEffectsWhenClosePanel(inputValue: string,
|
|
205
|
+
rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]): void;
|
|
206
|
+
/**
|
|
207
|
+
* clear input value when selected date is not confirmed
|
|
208
|
+
*/
|
|
209
|
+
needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined): void;
|
|
210
|
+
resetCachedSelectedValue(willUpdateDates?: Date[]): void;
|
|
208
211
|
/**
|
|
209
212
|
* timing to call closePanel
|
|
210
213
|
* 1. click confirm button
|
|
@@ -58,12 +58,10 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
this._isRangeValueComplete = value => {
|
|
61
|
-
let result =
|
|
61
|
+
let result = false;
|
|
62
62
|
|
|
63
63
|
if (_Array$isArray(value)) {
|
|
64
64
|
result = !_someInstanceProperty(value).call(value, date => isNullOrUndefined(date));
|
|
65
|
-
} else {
|
|
66
|
-
result = false;
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
return result;
|
|
@@ -212,12 +210,10 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
212
210
|
* 2. set cachedSelectedValue using given dates(in needConfirm mode)
|
|
213
211
|
* - directly closePanel without click confirm will set cachedSelectedValue to state value
|
|
214
212
|
* - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
|
|
215
|
-
* @param {String} inputValue
|
|
216
|
-
* @param {Date[]} dates
|
|
217
213
|
*/
|
|
218
214
|
|
|
219
215
|
|
|
220
|
-
rangeTypeSideEffectsWhenClosePanel(inputValue,
|
|
216
|
+
rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates) {
|
|
221
217
|
if (this._isRangeType()) {
|
|
222
218
|
this._adapter.setRangeInputFocus(false);
|
|
223
219
|
/**
|
|
@@ -227,17 +223,36 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
227
223
|
|
|
228
224
|
|
|
229
225
|
this.handleInputBlur(inputValue);
|
|
226
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* clear input value when selected date is not confirmed
|
|
231
|
+
*/
|
|
230
232
|
|
|
231
|
-
const {
|
|
232
|
-
value,
|
|
233
|
-
cachedSelectedValue
|
|
234
|
-
} = this._adapter.getStates();
|
|
235
233
|
|
|
236
|
-
|
|
234
|
+
needConfirmSideEffectsWhenClosePanel(willUpdateDates) {
|
|
235
|
+
if (this._adapter.needConfirm() && !this._isRangeType()) {
|
|
236
|
+
/**
|
|
237
|
+
* if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
|
|
238
|
+
* if `` input element will show `` directly
|
|
239
|
+
*/
|
|
240
|
+
this._adapter.updateInputValue(null);
|
|
237
241
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
242
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
resetCachedSelectedValue(willUpdateDates) {
|
|
247
|
+
const {
|
|
248
|
+
value,
|
|
249
|
+
cachedSelectedValue
|
|
250
|
+
} = this._adapter.getStates();
|
|
251
|
+
|
|
252
|
+
const newCachedSelectedValue = _Array$isArray(willUpdateDates) ? willUpdateDates : value;
|
|
253
|
+
|
|
254
|
+
if (!_isEqual(newCachedSelectedValue, cachedSelectedValue)) {
|
|
255
|
+
this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
|
|
241
256
|
}
|
|
242
257
|
}
|
|
243
258
|
/**
|
|
@@ -256,7 +271,14 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
256
271
|
|
|
257
272
|
closePanel(e) {
|
|
258
273
|
let inputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
259
|
-
let dates = arguments.length > 2
|
|
274
|
+
let dates = arguments.length > 2 ? arguments[2] : undefined;
|
|
275
|
+
|
|
276
|
+
const {
|
|
277
|
+
value,
|
|
278
|
+
cachedSelectedValue
|
|
279
|
+
} = this._adapter.getStates();
|
|
280
|
+
|
|
281
|
+
const willUpdateDates = isNullOrUndefined(dates) ? this._adapter.needConfirm() ? value : cachedSelectedValue : dates;
|
|
260
282
|
|
|
261
283
|
if (!this._isControlledComponent('open')) {
|
|
262
284
|
this._adapter.togglePanel(false);
|
|
@@ -265,7 +287,8 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
265
287
|
} // range type picker, closing panel requires the following side effects
|
|
266
288
|
|
|
267
289
|
|
|
268
|
-
this.rangeTypeSideEffectsWhenClosePanel(inputValue,
|
|
290
|
+
this.rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates);
|
|
291
|
+
this.needConfirmSideEffectsWhenClosePanel(willUpdateDates);
|
|
269
292
|
|
|
270
293
|
this._adapter.notifyOpenChange(false);
|
|
271
294
|
|
|
@@ -327,7 +350,8 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
327
350
|
if (parsedResult && parsedResult.length) {
|
|
328
351
|
this._updateValueAndInput(parsedResult, input === '');
|
|
329
352
|
} else if (input === '') {
|
|
330
|
-
|
|
353
|
+
// if clear input, set input to `''`
|
|
354
|
+
this._updateValueAndInput('', true, '');
|
|
331
355
|
} else {
|
|
332
356
|
this._updateValueAndInput(stateValue);
|
|
333
357
|
}
|
|
@@ -695,7 +719,7 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
695
719
|
|
|
696
720
|
if (!this._someDateDisabled(changedDates)) {
|
|
697
721
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
698
|
-
const isRangeTypeAndInputIncomplete = this._isRangeType() && (
|
|
722
|
+
const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
|
|
699
723
|
/**
|
|
700
724
|
* If the input is incomplete when under control, the notifyChange is not triggered because
|
|
701
725
|
* You need to update the value of the input box, otherwise there will be a problem that a date is selected but the input box does not show the date #1357
|
|
@@ -53,6 +53,7 @@ export interface MonthsGridFoundationProps extends MonthsGridElementProps {
|
|
|
53
53
|
setRangeInputFocus?: (rangeInputFocus: 'rangeStart' | 'rangeEnd') => void;
|
|
54
54
|
isAnotherPanelHasOpened?: (currentRangeInput: 'rangeStart' | 'rangeEnd') => boolean;
|
|
55
55
|
focusRecordsRef?: any;
|
|
56
|
+
triggerRender?: (props: Record<string, any>) => any;
|
|
56
57
|
}
|
|
57
58
|
export interface MonthInfo {
|
|
58
59
|
pickerDate: Date;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _isFunction from "lodash/isFunction";
|
|
1
2
|
import _isEqual from "lodash/isEqual";
|
|
2
3
|
import _isSet from "lodash/isSet";
|
|
3
4
|
import _includes from "lodash/includes";
|
|
@@ -704,13 +705,16 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
704
705
|
rangeStart,
|
|
705
706
|
rangeEnd
|
|
706
707
|
} = this.getStates();
|
|
708
|
+
|
|
707
709
|
const {
|
|
708
710
|
startDateOffset,
|
|
709
711
|
endDateOffset,
|
|
710
712
|
type,
|
|
711
713
|
dateFnsLocale,
|
|
712
|
-
rangeInputFocus
|
|
713
|
-
|
|
714
|
+
rangeInputFocus,
|
|
715
|
+
triggerRender
|
|
716
|
+
} = this._adapter.getProps();
|
|
717
|
+
|
|
714
718
|
const {
|
|
715
719
|
fullDate
|
|
716
720
|
} = day;
|
|
@@ -791,9 +795,17 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
791
795
|
date = [start, end];
|
|
792
796
|
}
|
|
793
797
|
}
|
|
798
|
+
/**
|
|
799
|
+
* no need to check focus then
|
|
800
|
+
* - dateRange and isDateRangeAndHasOffset
|
|
801
|
+
* - dateRange and triggerRender
|
|
802
|
+
*/
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
const needCheckFocusRecord = !(type === 'dateRange' && (isDateRangeAndHasOffset || _isFunction(triggerRender)));
|
|
794
806
|
|
|
795
807
|
this._adapter.notifySelectedChange(date, {
|
|
796
|
-
needCheckFocusRecord
|
|
808
|
+
needCheckFocusRecord
|
|
797
809
|
});
|
|
798
810
|
}
|
|
799
811
|
}
|
|
@@ -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;
|
|
@@ -63,11 +63,11 @@ declare class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
63
63
|
_adjustPrec(num: string | number): string;
|
|
64
64
|
/**
|
|
65
65
|
* format number to string
|
|
66
|
-
* @param {number} value
|
|
66
|
+
* @param {string|number} value
|
|
67
67
|
* @param {boolean} needAdjustPrec
|
|
68
68
|
* @returns {string}
|
|
69
69
|
*/
|
|
70
|
-
doFormat(value?: number, needAdjustPrec?: boolean): string;
|
|
70
|
+
doFormat(value?: string | number, needAdjustPrec?: boolean): string;
|
|
71
71
|
/**
|
|
72
72
|
*
|
|
73
73
|
* @param {number} current
|
|
@@ -116,6 +116,8 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
116
116
|
|
|
117
117
|
this._adapter.setFocusing(true, null);
|
|
118
118
|
|
|
119
|
+
this._adapter.setClickUpOrDown(false);
|
|
120
|
+
|
|
119
121
|
this._adapter.notifyFocus(e);
|
|
120
122
|
}
|
|
121
123
|
/**
|
|
@@ -454,7 +456,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
454
456
|
}
|
|
455
457
|
/**
|
|
456
458
|
* format number to string
|
|
457
|
-
* @param {number} value
|
|
459
|
+
* @param {string|number} value
|
|
458
460
|
* @param {boolean} needAdjustPrec
|
|
459
461
|
* @returns {string}
|
|
460
462
|
*/
|
|
@@ -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;
|