@douyinfe/semi-foundation 2.29.0 → 2.30.0-beta.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/datePicker/monthsGridFoundation.ts +9 -3
- package/lib/cjs/datePicker/monthsGridFoundation.js +14 -3
- package/lib/cjs/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/cjs/popconfirm/popconfirmFoundation.js +21 -1
- package/lib/cjs/tag/tag.css +9 -2
- package/lib/cjs/tag/tag.scss +13 -4
- package/lib/cjs/tooltip/foundation.d.ts +1 -1
- package/lib/cjs/tooltip/foundation.js +2 -3
- package/lib/cjs/typography/formatNumeral.js +2 -7
- package/lib/es/datePicker/monthsGridFoundation.js +14 -3
- package/lib/es/popconfirm/popconfirmFoundation.d.ts +4 -0
- package/lib/es/popconfirm/popconfirmFoundation.js +20 -1
- package/lib/es/tag/tag.css +9 -2
- package/lib/es/tag/tag.scss +13 -4
- package/lib/es/tooltip/foundation.d.ts +1 -1
- package/lib/es/tooltip/foundation.js +2 -3
- package/lib/es/typography/formatNumeral.js +2 -7
- package/package.json +3 -3
- package/popconfirm/popconfirmFoundation.ts +20 -1
- package/tag/tag.scss +13 -4
- package/tooltip/foundation.ts +2 -2
- package/typography/formatNumeral.ts +2 -5
|
@@ -228,12 +228,13 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
_initDatePickerFromValue(values: Date[], refreshPicker = true) {
|
|
231
|
-
const monthLeft = this.
|
|
231
|
+
const { monthLeft } = this._adapter.getStates();
|
|
232
232
|
const newMonthLeft = { ...monthLeft };
|
|
233
233
|
// REMOVE:
|
|
234
234
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
235
235
|
const newSelected = new Set<string>();
|
|
236
|
-
|
|
236
|
+
const isMultiple = this._isMultiple();
|
|
237
|
+
if (!isMultiple) {
|
|
237
238
|
values[0] && newSelected.add(format(values[0] as Date, strings.FORMAT_FULL_DATE));
|
|
238
239
|
} else {
|
|
239
240
|
values.forEach(date => {
|
|
@@ -241,7 +242,12 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
241
242
|
});
|
|
242
243
|
}
|
|
243
244
|
if (refreshPicker) {
|
|
244
|
-
|
|
245
|
+
if (isMultiple) {
|
|
246
|
+
const leftPickerDateInSelected = values?.some(item => item && differenceInCalendarMonths(item, monthLeft.pickerDate) === 0);
|
|
247
|
+
!leftPickerDateInSelected && this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
248
|
+
} else {
|
|
249
|
+
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
250
|
+
}
|
|
245
251
|
} else {
|
|
246
252
|
// FIXME:
|
|
247
253
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
@@ -154,14 +154,20 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
154
154
|
|
|
155
155
|
_initDatePickerFromValue(values) {
|
|
156
156
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
157
|
-
|
|
157
|
+
|
|
158
|
+
const {
|
|
159
|
+
monthLeft
|
|
160
|
+
} = this._adapter.getStates();
|
|
161
|
+
|
|
158
162
|
const newMonthLeft = Object.assign({}, monthLeft); // REMOVE:
|
|
159
163
|
|
|
160
164
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
161
165
|
|
|
162
166
|
const newSelected = new Set();
|
|
163
167
|
|
|
164
|
-
|
|
168
|
+
const isMultiple = this._isMultiple();
|
|
169
|
+
|
|
170
|
+
if (!isMultiple) {
|
|
165
171
|
values[0] && newSelected.add((0, _dateFns.format)(values[0], _constants.strings.FORMAT_FULL_DATE));
|
|
166
172
|
} else {
|
|
167
173
|
values.forEach(date => {
|
|
@@ -170,7 +176,12 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
170
176
|
}
|
|
171
177
|
|
|
172
178
|
if (refreshPicker) {
|
|
173
|
-
|
|
179
|
+
if (isMultiple) {
|
|
180
|
+
const leftPickerDateInSelected = values === null || values === void 0 ? void 0 : values.some(item => item && (0, _dateFns.differenceInCalendarMonths)(item, monthLeft.pickerDate) === 0);
|
|
181
|
+
!leftPickerDateInSelected && this.handleShowDateAndTime(_constants.strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
182
|
+
} else {
|
|
183
|
+
this.handleShowDateAndTime(_constants.strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
184
|
+
}
|
|
174
185
|
} else {
|
|
175
186
|
// FIXME:
|
|
176
187
|
this.handleShowDateAndTime(_constants.strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
@@ -7,6 +7,9 @@ export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
7
7
|
notifyCancel: (e: any) => Promise<any> | void;
|
|
8
8
|
notifyVisibleChange: (visible: boolean) => void;
|
|
9
9
|
notifyClickOutSide: (e: any) => void;
|
|
10
|
+
focusCancelButton: () => void;
|
|
11
|
+
focusOkButton: () => void;
|
|
12
|
+
focusPrevFocusElement: () => void;
|
|
10
13
|
}
|
|
11
14
|
export default class PopConfirmFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
12
15
|
init(): void;
|
|
@@ -15,4 +18,5 @@ export default class PopConfirmFoundation<P = Record<string, any>, S = Record<st
|
|
|
15
18
|
handleConfirm(e: any): void;
|
|
16
19
|
handleClickOutSide(e: any): void;
|
|
17
20
|
handleVisibleChange(visible: boolean): void;
|
|
21
|
+
handleFocusOperateButton(): void;
|
|
18
22
|
}
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
9
|
+
|
|
8
10
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
9
11
|
|
|
10
12
|
var _isPromise = _interopRequireDefault(require("../utils/isPromise"));
|
|
11
13
|
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
15
16
|
class PopConfirmFoundation extends _foundation.default {
|
|
16
17
|
init() {}
|
|
17
18
|
|
|
@@ -62,9 +63,28 @@ class PopConfirmFoundation extends _foundation.default {
|
|
|
62
63
|
this._adapter.setVisible(visible);
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
if (visible) {
|
|
67
|
+
this.handleFocusOperateButton();
|
|
68
|
+
} else {
|
|
69
|
+
this._adapter.focusPrevFocusElement();
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
this._adapter.notifyVisibleChange(visible);
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
handleFocusOperateButton() {
|
|
76
|
+
const {
|
|
77
|
+
cancelButtonProps,
|
|
78
|
+
okButtonProps
|
|
79
|
+
} = this._adapter.getProps();
|
|
80
|
+
|
|
81
|
+
if ((0, _get2.default)(cancelButtonProps, 'autoFocus') && !(0, _get2.default)(cancelButtonProps, 'disabled')) {
|
|
82
|
+
this._adapter.focusCancelButton();
|
|
83
|
+
} else if ((0, _get2.default)(okButtonProps, 'autoFocus') && !(0, _get2.default)(okButtonProps, 'disabled')) {
|
|
84
|
+
this._adapter.focusOkButton();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
68
88
|
}
|
|
69
89
|
|
|
70
90
|
exports.default = PopConfirmFoundation;
|
package/lib/cjs/tag/tag.css
CHANGED
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
padding-left: 4px;
|
|
59
59
|
cursor: pointer;
|
|
60
60
|
}
|
|
61
|
-
.semi-tag-close
|
|
61
|
+
.semi-tag-close:hover {
|
|
62
62
|
color: var(--semi-color-text-1);
|
|
63
63
|
}
|
|
64
|
-
.semi-tag-close
|
|
64
|
+
.semi-tag-close:active {
|
|
65
65
|
color: var(--semi-color-text-0);
|
|
66
66
|
}
|
|
67
67
|
.semi-tag-closable {
|
|
@@ -414,6 +414,13 @@
|
|
|
414
414
|
|
|
415
415
|
.semi-tag-solid .semi-tag-close {
|
|
416
416
|
color: var(--semi-color-white);
|
|
417
|
+
opacity: 0.8;
|
|
418
|
+
}
|
|
419
|
+
.semi-tag-solid .semi-tag-close:hover {
|
|
420
|
+
opacity: 1;
|
|
421
|
+
}
|
|
422
|
+
.semi-tag-solid .semi-tag-close:active {
|
|
423
|
+
opacity: 0.9;
|
|
417
424
|
}
|
|
418
425
|
|
|
419
426
|
.semi-rtl .semi-tag,
|
package/lib/cjs/tag/tag.scss
CHANGED
|
@@ -64,12 +64,12 @@ $types: "ghost", "solid", "light";
|
|
|
64
64
|
padding-left: $spacing-tag_close-paddingLeft;
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
color: $color-tag_close-icon-hover
|
|
67
|
+
&:hover {
|
|
68
|
+
color: $color-tag_close-icon-hover;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
color: $color-tag_close-icon-active
|
|
71
|
+
&:active {
|
|
72
|
+
color: $color-tag_close-icon-active;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -208,6 +208,15 @@ $types: "ghost", "solid", "light";
|
|
|
208
208
|
.#{$module}-solid {
|
|
209
209
|
.#{$module}-close {
|
|
210
210
|
color: $color-tag_close-icon_deep-default;
|
|
211
|
+
opacity: .8;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
opacity: 1.0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&:active {
|
|
218
|
+
opacity: .9;
|
|
219
|
+
}
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
222
|
|
|
@@ -133,7 +133,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
133
133
|
* 如果 trigger 是 focus 或者 hover,则它绑定了 onFocus,这里我们如果重新 focus 的话,popup 会再次打开
|
|
134
134
|
* 因此 returnFocusOnClose 只支持 click trigger
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
focusTrigger(): void;
|
|
137
137
|
_handleEscKeyDown(event: any): void;
|
|
138
138
|
_handleContainerTabKeyDown(focusableElements: any[], event: any): void;
|
|
139
139
|
_handleContainerShiftTabKeyDown(focusableElements: any[], event: any): void;
|
|
@@ -1229,7 +1229,7 @@ class Tooltip extends _foundation.default {
|
|
|
1229
1229
|
*/
|
|
1230
1230
|
|
|
1231
1231
|
|
|
1232
|
-
|
|
1232
|
+
focusTrigger() {
|
|
1233
1233
|
const {
|
|
1234
1234
|
trigger,
|
|
1235
1235
|
returnFocusOnClose,
|
|
@@ -1255,8 +1255,7 @@ class Tooltip extends _foundation.default {
|
|
|
1255
1255
|
if (trigger !== 'custom') {
|
|
1256
1256
|
// Move the focus into the trigger first and then close the pop-up layer
|
|
1257
1257
|
// to avoid the problem of opening the pop-up layer again when the focus returns to the trigger in the case of hover and focus
|
|
1258
|
-
this.
|
|
1259
|
-
|
|
1258
|
+
this.focusTrigger();
|
|
1260
1259
|
this.hide();
|
|
1261
1260
|
}
|
|
1262
1261
|
|
|
@@ -32,13 +32,8 @@ class FormatNumeral {
|
|
|
32
32
|
return `${this.truncatePrecision(value)} ${units[i]}`;
|
|
33
33
|
},
|
|
34
34
|
percentages: value => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (Number(cArr[0]) === 0) {
|
|
38
|
-
return `${this.truncatePrecision(value * 100)}%`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return `${this.truncatePrecision(value)}%`;
|
|
35
|
+
// The rules here have been modified in version v2.30.0
|
|
36
|
+
return `${this.truncatePrecision(value * 100)}%`;
|
|
42
37
|
},
|
|
43
38
|
exponential: value => {
|
|
44
39
|
const vExponential = value.toExponential(this.precision + 2);
|
|
@@ -133,14 +133,20 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
133
133
|
|
|
134
134
|
_initDatePickerFromValue(values) {
|
|
135
135
|
let refreshPicker = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
136
|
-
|
|
136
|
+
|
|
137
|
+
const {
|
|
138
|
+
monthLeft
|
|
139
|
+
} = this._adapter.getStates();
|
|
140
|
+
|
|
137
141
|
const newMonthLeft = Object.assign({}, monthLeft); // REMOVE:
|
|
138
142
|
|
|
139
143
|
this._adapter.updateMonthOnLeft(newMonthLeft);
|
|
140
144
|
|
|
141
145
|
const newSelected = new Set();
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
const isMultiple = this._isMultiple();
|
|
148
|
+
|
|
149
|
+
if (!isMultiple) {
|
|
144
150
|
values[0] && newSelected.add(format(values[0], strings.FORMAT_FULL_DATE));
|
|
145
151
|
} else {
|
|
146
152
|
values.forEach(date => {
|
|
@@ -149,7 +155,12 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
149
155
|
}
|
|
150
156
|
|
|
151
157
|
if (refreshPicker) {
|
|
152
|
-
|
|
158
|
+
if (isMultiple) {
|
|
159
|
+
const leftPickerDateInSelected = values === null || values === void 0 ? void 0 : values.some(item => item && differenceInCalendarMonths(item, monthLeft.pickerDate) === 0);
|
|
160
|
+
!leftPickerDateInSelected && this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
161
|
+
} else {
|
|
162
|
+
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
163
|
+
}
|
|
153
164
|
} else {
|
|
154
165
|
// FIXME:
|
|
155
166
|
this.handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
@@ -7,6 +7,9 @@ export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
7
7
|
notifyCancel: (e: any) => Promise<any> | void;
|
|
8
8
|
notifyVisibleChange: (visible: boolean) => void;
|
|
9
9
|
notifyClickOutSide: (e: any) => void;
|
|
10
|
+
focusCancelButton: () => void;
|
|
11
|
+
focusOkButton: () => void;
|
|
12
|
+
focusPrevFocusElement: () => void;
|
|
10
13
|
}
|
|
11
14
|
export default class PopConfirmFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
12
15
|
init(): void;
|
|
@@ -15,4 +18,5 @@ export default class PopConfirmFoundation<P = Record<string, any>, S = Record<st
|
|
|
15
18
|
handleConfirm(e: any): void;
|
|
16
19
|
handleClickOutSide(e: any): void;
|
|
17
20
|
handleVisibleChange(visible: boolean): void;
|
|
21
|
+
handleFocusOperateButton(): void;
|
|
18
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import _get from "lodash/get";
|
|
2
2
|
import BaseFoundation from '../base/foundation';
|
|
3
3
|
import isPromise from '../utils/isPromise';
|
|
4
4
|
export default class PopConfirmFoundation extends BaseFoundation {
|
|
@@ -51,7 +51,26 @@ export default class PopConfirmFoundation extends BaseFoundation {
|
|
|
51
51
|
this._adapter.setVisible(visible);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
if (visible) {
|
|
55
|
+
this.handleFocusOperateButton();
|
|
56
|
+
} else {
|
|
57
|
+
this._adapter.focusPrevFocusElement();
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
this._adapter.notifyVisibleChange(visible);
|
|
55
61
|
}
|
|
56
62
|
|
|
63
|
+
handleFocusOperateButton() {
|
|
64
|
+
const {
|
|
65
|
+
cancelButtonProps,
|
|
66
|
+
okButtonProps
|
|
67
|
+
} = this._adapter.getProps();
|
|
68
|
+
|
|
69
|
+
if (_get(cancelButtonProps, 'autoFocus') && !_get(cancelButtonProps, 'disabled')) {
|
|
70
|
+
this._adapter.focusCancelButton();
|
|
71
|
+
} else if (_get(okButtonProps, 'autoFocus') && !_get(okButtonProps, 'disabled')) {
|
|
72
|
+
this._adapter.focusOkButton();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
}
|
package/lib/es/tag/tag.css
CHANGED
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
padding-left: 4px;
|
|
59
59
|
cursor: pointer;
|
|
60
60
|
}
|
|
61
|
-
.semi-tag-close
|
|
61
|
+
.semi-tag-close:hover {
|
|
62
62
|
color: var(--semi-color-text-1);
|
|
63
63
|
}
|
|
64
|
-
.semi-tag-close
|
|
64
|
+
.semi-tag-close:active {
|
|
65
65
|
color: var(--semi-color-text-0);
|
|
66
66
|
}
|
|
67
67
|
.semi-tag-closable {
|
|
@@ -414,6 +414,13 @@
|
|
|
414
414
|
|
|
415
415
|
.semi-tag-solid .semi-tag-close {
|
|
416
416
|
color: var(--semi-color-white);
|
|
417
|
+
opacity: 0.8;
|
|
418
|
+
}
|
|
419
|
+
.semi-tag-solid .semi-tag-close:hover {
|
|
420
|
+
opacity: 1;
|
|
421
|
+
}
|
|
422
|
+
.semi-tag-solid .semi-tag-close:active {
|
|
423
|
+
opacity: 0.9;
|
|
417
424
|
}
|
|
418
425
|
|
|
419
426
|
.semi-rtl .semi-tag,
|
package/lib/es/tag/tag.scss
CHANGED
|
@@ -64,12 +64,12 @@ $types: "ghost", "solid", "light";
|
|
|
64
64
|
padding-left: $spacing-tag_close-paddingLeft;
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
color: $color-tag_close-icon-hover
|
|
67
|
+
&:hover {
|
|
68
|
+
color: $color-tag_close-icon-hover;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
color: $color-tag_close-icon-active
|
|
71
|
+
&:active {
|
|
72
|
+
color: $color-tag_close-icon-active;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -208,6 +208,15 @@ $types: "ghost", "solid", "light";
|
|
|
208
208
|
.#{$module}-solid {
|
|
209
209
|
.#{$module}-close {
|
|
210
210
|
color: $color-tag_close-icon_deep-default;
|
|
211
|
+
opacity: .8;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
opacity: 1.0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&:active {
|
|
218
|
+
opacity: .9;
|
|
219
|
+
}
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
222
|
|
|
@@ -133,7 +133,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
133
133
|
* 如果 trigger 是 focus 或者 hover,则它绑定了 onFocus,这里我们如果重新 focus 的话,popup 会再次打开
|
|
134
134
|
* 因此 returnFocusOnClose 只支持 click trigger
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
focusTrigger(): void;
|
|
137
137
|
_handleEscKeyDown(event: any): void;
|
|
138
138
|
_handleContainerTabKeyDown(focusableElements: any[], event: any): void;
|
|
139
139
|
_handleContainerShiftTabKeyDown(focusableElements: any[], event: any): void;
|
|
@@ -1219,7 +1219,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1219
1219
|
*/
|
|
1220
1220
|
|
|
1221
1221
|
|
|
1222
|
-
|
|
1222
|
+
focusTrigger() {
|
|
1223
1223
|
const {
|
|
1224
1224
|
trigger,
|
|
1225
1225
|
returnFocusOnClose,
|
|
@@ -1245,8 +1245,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
1245
1245
|
if (trigger !== 'custom') {
|
|
1246
1246
|
// Move the focus into the trigger first and then close the pop-up layer
|
|
1247
1247
|
// to avoid the problem of opening the pop-up layer again when the focus returns to the trigger in the case of hover and focus
|
|
1248
|
-
this.
|
|
1249
|
-
|
|
1248
|
+
this.focusTrigger();
|
|
1250
1249
|
this.hide();
|
|
1251
1250
|
}
|
|
1252
1251
|
|
|
@@ -25,13 +25,8 @@ export default class FormatNumeral {
|
|
|
25
25
|
return `${this.truncatePrecision(value)} ${units[i]}`;
|
|
26
26
|
},
|
|
27
27
|
percentages: value => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (Number(cArr[0]) === 0) {
|
|
31
|
-
return `${this.truncatePrecision(value * 100)}%`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return `${this.truncatePrecision(value)}%`;
|
|
28
|
+
// The rules here have been modified in version v2.30.0
|
|
29
|
+
return `${this.truncatePrecision(value * 100)}%`;
|
|
35
30
|
},
|
|
36
31
|
exponential: value => {
|
|
37
32
|
const vExponential = value.toExponential(this.precision + 2);
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build:lib": "node ./scripts/compileLib.js",
|
|
6
|
+
"build:lib": "export NODE_OPTIONS=--no-experimental-fetch && node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "330e8cf3c8bced4dee7d5c77c7e3931a0f40376b",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
2
2
|
|
|
3
|
+
import { get } from 'lodash';
|
|
4
|
+
|
|
3
5
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
4
6
|
import isPromise from '../utils/isPromise';
|
|
5
7
|
|
|
@@ -10,7 +12,10 @@ export interface PopconfirmAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
10
12
|
notifyConfirm: (e: any) => Promise<any> | void;
|
|
11
13
|
notifyCancel: (e: any) => Promise<any> | void;
|
|
12
14
|
notifyVisibleChange: (visible: boolean) => void;
|
|
13
|
-
notifyClickOutSide: (e: any) => void
|
|
15
|
+
notifyClickOutSide: (e: any) => void;
|
|
16
|
+
focusCancelButton: () => void;
|
|
17
|
+
focusOkButton: () => void;
|
|
18
|
+
focusPrevFocusElement: () => void
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export default class PopConfirmFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PopconfirmAdapter<P, S>, P, S> {
|
|
@@ -63,6 +68,20 @@ export default class PopConfirmFoundation<P = Record<string, any>, S = Record<st
|
|
|
63
68
|
if (!this._isControlledComponent('visible')) {
|
|
64
69
|
this._adapter.setVisible(visible);
|
|
65
70
|
}
|
|
71
|
+
if (visible) {
|
|
72
|
+
this.handleFocusOperateButton();
|
|
73
|
+
} else {
|
|
74
|
+
this._adapter.focusPrevFocusElement();
|
|
75
|
+
}
|
|
66
76
|
this._adapter.notifyVisibleChange(visible);
|
|
67
77
|
}
|
|
78
|
+
|
|
79
|
+
handleFocusOperateButton() {
|
|
80
|
+
const { cancelButtonProps, okButtonProps } = this._adapter.getProps() as any;
|
|
81
|
+
if (get(cancelButtonProps, 'autoFocus') && !get(cancelButtonProps, 'disabled')) {
|
|
82
|
+
this._adapter.focusCancelButton();
|
|
83
|
+
} else if (get(okButtonProps, 'autoFocus') && !get(okButtonProps, 'disabled')) {
|
|
84
|
+
this._adapter.focusOkButton();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
68
87
|
}
|
package/tag/tag.scss
CHANGED
|
@@ -64,12 +64,12 @@ $types: "ghost", "solid", "light";
|
|
|
64
64
|
padding-left: $spacing-tag_close-paddingLeft;
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
color: $color-tag_close-icon-hover
|
|
67
|
+
&:hover {
|
|
68
|
+
color: $color-tag_close-icon-hover;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
color: $color-tag_close-icon-active
|
|
71
|
+
&:active {
|
|
72
|
+
color: $color-tag_close-icon-active;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -208,6 +208,15 @@ $types: "ghost", "solid", "light";
|
|
|
208
208
|
.#{$module}-solid {
|
|
209
209
|
.#{$module}-close {
|
|
210
210
|
color: $color-tag_close-icon_deep-default;
|
|
211
|
+
opacity: .8;
|
|
212
|
+
|
|
213
|
+
&:hover {
|
|
214
|
+
opacity: 1.0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&:active {
|
|
218
|
+
opacity: .9;
|
|
219
|
+
}
|
|
211
220
|
}
|
|
212
221
|
}
|
|
213
222
|
|
package/tooltip/foundation.ts
CHANGED
|
@@ -1126,7 +1126,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
1126
1126
|
* 如果 trigger 是 focus 或者 hover,则它绑定了 onFocus,这里我们如果重新 focus 的话,popup 会再次打开
|
|
1127
1127
|
* 因此 returnFocusOnClose 只支持 click trigger
|
|
1128
1128
|
*/
|
|
1129
|
-
|
|
1129
|
+
focusTrigger() {
|
|
1130
1130
|
const { trigger, returnFocusOnClose, preventScroll } = this.getProps();
|
|
1131
1131
|
if (returnFocusOnClose && trigger !== 'custom') {
|
|
1132
1132
|
const triggerNode = this._adapter.getTriggerNode();
|
|
@@ -1141,7 +1141,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
1141
1141
|
if (trigger !== 'custom') {
|
|
1142
1142
|
// Move the focus into the trigger first and then close the pop-up layer
|
|
1143
1143
|
// to avoid the problem of opening the pop-up layer again when the focus returns to the trigger in the case of hover and focus
|
|
1144
|
-
this.
|
|
1144
|
+
this.focusTrigger();
|
|
1145
1145
|
this.hide();
|
|
1146
1146
|
}
|
|
1147
1147
|
this._adapter.notifyEscKeydown(event);
|
|
@@ -42,11 +42,8 @@ export default class FormatNumeral {
|
|
|
42
42
|
return `${this.truncatePrecision(value)} ${units[i]}`;
|
|
43
43
|
},
|
|
44
44
|
percentages: (value: number) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return `${this.truncatePrecision(value * 100)}%`;
|
|
48
|
-
}
|
|
49
|
-
return `${this.truncatePrecision(value)}%`;
|
|
45
|
+
// The rules here have been modified in version v2.30.0
|
|
46
|
+
return `${this.truncatePrecision(value * 100)}%`;
|
|
50
47
|
},
|
|
51
48
|
exponential: (value: number) => {
|
|
52
49
|
const vExponential = value.toExponential(this.precision + 2);
|