@douyinfe/semi-foundation 2.2.0 → 2.3.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/breadcrumb/foundation.ts +10 -1
- package/checkbox/checkboxFoundation.ts +9 -0
- 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/form/foundation.ts +20 -8
- package/form/utils.ts +2 -0
- package/input/foundation.ts +21 -2
- package/input/textareaFoundation.ts +11 -1
- package/inputNumber/foundation.ts +3 -2
- package/lib/cjs/breadcrumb/foundation.d.ts +4 -0
- package/lib/cjs/breadcrumb/foundation.js +12 -0
- package/lib/cjs/checkbox/checkboxFoundation.d.ts +3 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +8 -0
- package/lib/cjs/datePicker/datePicker.css +26 -2
- 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 +2 -1
- 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/form/foundation.d.ts +13 -0
- package/lib/cjs/form/foundation.js +32 -8
- package/lib/cjs/form/utils.d.ts +1 -0
- package/lib/cjs/form/utils.js +5 -3
- package/lib/cjs/input/foundation.d.ts +8 -0
- package/lib/cjs/input/foundation.js +24 -2
- package/lib/cjs/input/textareaFoundation.d.ts +5 -1
- package/lib/cjs/input/textareaFoundation.js +12 -0
- package/lib/cjs/inputNumber/foundation.d.ts +2 -2
- package/lib/cjs/inputNumber/foundation.js +3 -1
- package/lib/cjs/modal/modalContentFoundation.d.ts +7 -0
- package/lib/cjs/modal/modalContentFoundation.js +14 -0
- package/lib/cjs/navigation/itemFoundation.d.ts +5 -0
- package/lib/cjs/navigation/itemFoundation.js +12 -0
- package/lib/cjs/navigation/subNavFoundation.d.ts +6 -0
- package/lib/cjs/navigation/subNavFoundation.js +14 -0
- package/lib/cjs/notification/notificationListFoundation.js +1 -1
- package/lib/cjs/radio/radio.css +7 -1
- package/lib/cjs/radio/radio.scss +8 -1
- package/lib/cjs/select/foundation.d.ts +2 -0
- package/lib/cjs/select/foundation.js +40 -6
- package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/cjs/slider/foundation.d.ts +6 -1
- package/lib/cjs/slider/foundation.js +6 -12
- package/lib/cjs/slider/slider.css +1 -0
- package/lib/cjs/slider/slider.scss +1 -0
- package/lib/cjs/table/table.css +0 -2
- package/lib/cjs/table/table.scss +0 -2
- package/lib/cjs/table/utils.d.ts +7 -0
- package/lib/cjs/table/utils.js +26 -0
- package/lib/cjs/tagInput/foundation.d.ts +4 -0
- package/lib/cjs/tagInput/foundation.js +12 -0
- package/lib/cjs/tooltip/foundation.js +7 -6
- package/lib/cjs/transfer/transfer.css +0 -2
- package/lib/cjs/transfer/transfer.scss +0 -2
- package/lib/cjs/tree/foundation.d.ts +1 -0
- package/lib/cjs/tree/foundation.js +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +9 -1
- package/lib/cjs/treeSelect/foundation.js +22 -0
- package/lib/cjs/utils/isEnterPress.d.ts +4 -0
- package/lib/cjs/utils/isEnterPress.js +22 -0
- package/lib/cjs/utils/keyCode.d.ts +2 -0
- package/lib/cjs/utils/keyCode.js +5 -1
- package/lib/cjs/utils/uuid.d.ts +16 -1
- package/lib/cjs/utils/uuid.js +32 -0
- package/lib/es/breadcrumb/foundation.d.ts +4 -0
- package/lib/es/breadcrumb/foundation.js +11 -0
- package/lib/es/checkbox/checkboxFoundation.d.ts +3 -0
- package/lib/es/checkbox/checkboxFoundation.js +7 -0
- package/lib/es/datePicker/datePicker.css +26 -2
- 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 +2 -1
- 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/form/foundation.d.ts +13 -0
- package/lib/es/form/foundation.js +31 -8
- package/lib/es/form/utils.d.ts +1 -0
- package/lib/es/form/utils.js +5 -3
- package/lib/es/input/foundation.d.ts +8 -0
- package/lib/es/input/foundation.js +23 -2
- package/lib/es/input/textareaFoundation.d.ts +5 -1
- package/lib/es/input/textareaFoundation.js +11 -0
- package/lib/es/inputNumber/foundation.d.ts +2 -2
- package/lib/es/inputNumber/foundation.js +3 -1
- package/lib/es/modal/modalContentFoundation.d.ts +7 -0
- package/lib/es/modal/modalContentFoundation.js +14 -0
- package/lib/es/navigation/itemFoundation.d.ts +5 -0
- package/lib/es/navigation/itemFoundation.js +11 -0
- package/lib/es/navigation/subNavFoundation.d.ts +6 -0
- package/lib/es/navigation/subNavFoundation.js +13 -0
- package/lib/es/notification/notificationListFoundation.js +1 -1
- package/lib/es/radio/radio.css +7 -1
- package/lib/es/radio/radio.scss +8 -1
- package/lib/es/select/foundation.d.ts +2 -0
- package/lib/es/select/foundation.js +31 -6
- package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
- package/lib/es/slider/foundation.d.ts +6 -1
- package/lib/es/slider/foundation.js +6 -12
- package/lib/es/slider/slider.css +1 -0
- package/lib/es/slider/slider.scss +1 -0
- package/lib/es/table/table.css +0 -2
- package/lib/es/table/table.scss +0 -2
- package/lib/es/table/utils.d.ts +7 -0
- package/lib/es/table/utils.js +24 -0
- package/lib/es/tagInput/foundation.d.ts +4 -0
- package/lib/es/tagInput/foundation.js +11 -0
- package/lib/es/tooltip/foundation.js +7 -6
- package/lib/es/transfer/transfer.css +0 -2
- package/lib/es/transfer/transfer.scss +0 -2
- package/lib/es/tree/foundation.d.ts +1 -0
- package/lib/es/tree/foundation.js +1 -1
- package/lib/es/treeSelect/foundation.d.ts +9 -1
- package/lib/es/treeSelect/foundation.js +22 -1
- package/lib/es/utils/isEnterPress.d.ts +4 -0
- package/lib/es/utils/isEnterPress.js +8 -0
- package/lib/es/utils/keyCode.d.ts +2 -0
- package/lib/es/utils/keyCode.js +2 -0
- package/lib/es/utils/uuid.d.ts +16 -1
- package/lib/es/utils/uuid.js +32 -1
- package/modal/modalContentFoundation.ts +18 -0
- package/navigation/itemFoundation.ts +11 -0
- package/navigation/subNavFoundation.ts +12 -0
- package/notification/notificationListFoundation.ts +4 -8
- package/package.json +3 -3
- package/radio/radio.scss +8 -1
- package/select/foundation.ts +26 -7
- package/sideSheet/sideSheetFoundation.ts +3 -5
- package/slider/foundation.ts +10 -13
- package/slider/slider.scss +1 -0
- package/table/table.scss +0 -2
- package/table/utils.ts +16 -0
- package/tagInput/foundation.ts +10 -0
- package/tooltip/foundation.ts +5 -5
- package/transfer/transfer.scss +0 -2
- package/tree/foundation.ts +2 -1
- package/treeSelect/foundation.ts +20 -0
- package/utils/isEnterPress.ts +8 -0
- package/utils/keyCode.ts +3 -0
- package/utils/uuid.ts +29 -1
|
@@ -96,12 +96,10 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
96
96
|
};
|
|
97
97
|
|
|
98
98
|
this._isRangeValueComplete = value => {
|
|
99
|
-
let result =
|
|
99
|
+
let result = false;
|
|
100
100
|
|
|
101
101
|
if ((0, _isArray.default)(value)) {
|
|
102
102
|
result = !(0, _some.default)(value).call(value, date => (0, _isNullOrUndefined.default)(date));
|
|
103
|
-
} else {
|
|
104
|
-
result = false;
|
|
105
103
|
}
|
|
106
104
|
|
|
107
105
|
return result;
|
|
@@ -250,12 +248,10 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
250
248
|
* 2. set cachedSelectedValue using given dates(in needConfirm mode)
|
|
251
249
|
* - directly closePanel without click confirm will set cachedSelectedValue to state value
|
|
252
250
|
* - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
|
|
253
|
-
* @param {String} inputValue
|
|
254
|
-
* @param {Date[]} dates
|
|
255
251
|
*/
|
|
256
252
|
|
|
257
253
|
|
|
258
|
-
rangeTypeSideEffectsWhenClosePanel(inputValue,
|
|
254
|
+
rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates) {
|
|
259
255
|
if (this._isRangeType()) {
|
|
260
256
|
this._adapter.setRangeInputFocus(false);
|
|
261
257
|
/**
|
|
@@ -265,17 +261,36 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
265
261
|
|
|
266
262
|
|
|
267
263
|
this.handleInputBlur(inputValue);
|
|
264
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* clear input value when selected date is not confirmed
|
|
269
|
+
*/
|
|
268
270
|
|
|
269
|
-
const {
|
|
270
|
-
value,
|
|
271
|
-
cachedSelectedValue
|
|
272
|
-
} = this._adapter.getStates();
|
|
273
271
|
|
|
274
|
-
|
|
272
|
+
needConfirmSideEffectsWhenClosePanel(willUpdateDates) {
|
|
273
|
+
if (this._adapter.needConfirm() && !this._isRangeType()) {
|
|
274
|
+
/**
|
|
275
|
+
* if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
|
|
276
|
+
* if `` input element will show `` directly
|
|
277
|
+
*/
|
|
278
|
+
this._adapter.updateInputValue(null);
|
|
275
279
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
280
|
+
this.resetCachedSelectedValue(willUpdateDates);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
resetCachedSelectedValue(willUpdateDates) {
|
|
285
|
+
const {
|
|
286
|
+
value,
|
|
287
|
+
cachedSelectedValue
|
|
288
|
+
} = this._adapter.getStates();
|
|
289
|
+
|
|
290
|
+
const newCachedSelectedValue = (0, _isArray.default)(willUpdateDates) ? willUpdateDates : value;
|
|
291
|
+
|
|
292
|
+
if (!(0, _isEqual2.default)(newCachedSelectedValue, cachedSelectedValue)) {
|
|
293
|
+
this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
|
|
279
294
|
}
|
|
280
295
|
}
|
|
281
296
|
/**
|
|
@@ -294,7 +309,14 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
294
309
|
|
|
295
310
|
closePanel(e) {
|
|
296
311
|
let inputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
297
|
-
let dates = arguments.length > 2
|
|
312
|
+
let dates = arguments.length > 2 ? arguments[2] : undefined;
|
|
313
|
+
|
|
314
|
+
const {
|
|
315
|
+
value,
|
|
316
|
+
cachedSelectedValue
|
|
317
|
+
} = this._adapter.getStates();
|
|
318
|
+
|
|
319
|
+
const willUpdateDates = (0, _isNullOrUndefined.default)(dates) ? this._adapter.needConfirm() ? value : cachedSelectedValue : dates;
|
|
298
320
|
|
|
299
321
|
if (!this._isControlledComponent('open')) {
|
|
300
322
|
this._adapter.togglePanel(false);
|
|
@@ -303,7 +325,8 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
303
325
|
} // range type picker, closing panel requires the following side effects
|
|
304
326
|
|
|
305
327
|
|
|
306
|
-
this.rangeTypeSideEffectsWhenClosePanel(inputValue,
|
|
328
|
+
this.rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates);
|
|
329
|
+
this.needConfirmSideEffectsWhenClosePanel(willUpdateDates);
|
|
307
330
|
|
|
308
331
|
this._adapter.notifyOpenChange(false);
|
|
309
332
|
|
|
@@ -365,7 +388,8 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
365
388
|
if (parsedResult && parsedResult.length) {
|
|
366
389
|
this._updateValueAndInput(parsedResult, input === '');
|
|
367
390
|
} else if (input === '') {
|
|
368
|
-
|
|
391
|
+
// if clear input, set input to `''`
|
|
392
|
+
this._updateValueAndInput('', true, '');
|
|
369
393
|
} else {
|
|
370
394
|
this._updateValueAndInput(stateValue);
|
|
371
395
|
}
|
|
@@ -729,7 +753,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
729
753
|
|
|
730
754
|
if (!this._someDateDisabled(changedDates)) {
|
|
731
755
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
732
|
-
const isRangeTypeAndInputIncomplete = this._isRangeType() &&
|
|
756
|
+
const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
|
|
733
757
|
/**
|
|
734
758
|
* If the input is incomplete when under control, the notifyChange is not triggered because
|
|
735
759
|
* 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;
|
|
@@ -245,6 +246,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
245
246
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
246
247
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
247
248
|
*/
|
|
248
|
-
getYAMOpenType(): "left" | "right" | "
|
|
249
|
+
getYAMOpenType(): "left" | "right" | "both" | "none";
|
|
249
250
|
}
|
|
250
251
|
export {};
|
|
@@ -28,6 +28,8 @@ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
28
28
|
|
|
29
29
|
var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim"));
|
|
30
30
|
|
|
31
|
+
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
32
|
+
|
|
31
33
|
var _isEqual2 = _interopRequireDefault(require("lodash/isEqual"));
|
|
32
34
|
|
|
33
35
|
var _isSet2 = _interopRequireDefault(require("lodash/isSet"));
|
|
@@ -731,13 +733,16 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
731
733
|
rangeStart,
|
|
732
734
|
rangeEnd
|
|
733
735
|
} = this.getStates();
|
|
736
|
+
|
|
734
737
|
const {
|
|
735
738
|
startDateOffset,
|
|
736
739
|
endDateOffset,
|
|
737
740
|
type,
|
|
738
741
|
dateFnsLocale,
|
|
739
|
-
rangeInputFocus
|
|
740
|
-
|
|
742
|
+
rangeInputFocus,
|
|
743
|
+
triggerRender
|
|
744
|
+
} = this._adapter.getProps();
|
|
745
|
+
|
|
741
746
|
const {
|
|
742
747
|
fullDate
|
|
743
748
|
} = day;
|
|
@@ -818,9 +823,17 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
818
823
|
date = [start, end];
|
|
819
824
|
}
|
|
820
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* no need to check focus then
|
|
828
|
+
* - dateRange and isDateRangeAndHasOffset
|
|
829
|
+
* - dateRange and triggerRender
|
|
830
|
+
*/
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
const needCheckFocusRecord = !(type === 'dateRange' && (isDateRangeAndHasOffset || (0, _isFunction2.default)(triggerRender)));
|
|
821
834
|
|
|
822
835
|
this._adapter.notifySelectedChange(date, {
|
|
823
|
-
needCheckFocusRecord
|
|
836
|
+
needCheckFocusRecord
|
|
824
837
|
});
|
|
825
838
|
}
|
|
826
839
|
}
|
|
@@ -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;
|
|
@@ -19,6 +19,19 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
19
19
|
_formValidate(): Promise<unknown>;
|
|
20
20
|
_fieldsValidate(fieldPaths: Array<string>): Promise<unknown>;
|
|
21
21
|
submit(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Case A:
|
|
24
|
+
* All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
|
|
25
|
+
* input => output:
|
|
26
|
+
* a => a[0]、a[1]
|
|
27
|
+
* b => b.type、b.name[0]、b.name[2]
|
|
28
|
+
*
|
|
29
|
+
* Case B:
|
|
30
|
+
* All fields: activity.a[0]、activity.a[1]、activity.c、activity.d、other
|
|
31
|
+
* input => output:
|
|
32
|
+
* activity.a => activity.a[0]、activity.a[1]
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
22
35
|
_getNestedField(path: string): Map<string, FieldStaff>;
|
|
23
36
|
_getOperateFieldMap(fieldPaths?: Array<string>): Map<string, FieldStaff>;
|
|
24
37
|
reset(fieldPaths?: Array<string>): void;
|
|
@@ -28,6 +28,8 @@ var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-st
|
|
|
28
28
|
|
|
29
29
|
var _map2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
30
30
|
|
|
31
|
+
var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
|
|
32
|
+
|
|
31
33
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/keys"));
|
|
32
34
|
|
|
33
35
|
var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
|
|
@@ -320,10 +322,20 @@ class FormFoundation extends _foundation.default {
|
|
|
320
322
|
|
|
321
323
|
this._adapter.notifySubmitFail(_errors, _values);
|
|
322
324
|
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Case A:
|
|
328
|
+
* All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
|
|
329
|
+
* input => output:
|
|
330
|
+
* a => a[0]、a[1]
|
|
331
|
+
* b => b.type、b.name[0]、b.name[2]
|
|
332
|
+
*
|
|
333
|
+
* Case B:
|
|
334
|
+
* All fields: activity.a[0]、activity.a[1]、activity.c、activity.d、other
|
|
335
|
+
* input => output:
|
|
336
|
+
* activity.a => activity.a[0]、activity.a[1]
|
|
337
|
+
*
|
|
338
|
+
*/
|
|
327
339
|
|
|
328
340
|
|
|
329
341
|
_getNestedField(path) {
|
|
@@ -336,7 +348,7 @@ class FormFoundation extends _foundation.default {
|
|
|
336
348
|
let itemPath = (0, _toPath2.default)(item);
|
|
337
349
|
let targetPath = (0, _toPath2.default)(path);
|
|
338
350
|
|
|
339
|
-
if (
|
|
351
|
+
if ((0, _every.default)(targetPath).call(targetPath, (path, i) => targetPath[i] === itemPath[i])) {
|
|
340
352
|
const realField = allRegisterField.get(item);
|
|
341
353
|
nestedFieldPath.set(item, realField);
|
|
342
354
|
}
|
|
@@ -610,7 +622,11 @@ class FormFoundation extends _foundation.default {
|
|
|
610
622
|
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
611
623
|
let fieldPath = fieldStaff.field;
|
|
612
624
|
let newFieldVal = ObjectUtil.get((0, _values2.default)(this.data), fieldPath);
|
|
613
|
-
|
|
625
|
+
let nestedBatchUpdateOpts = {
|
|
626
|
+
notNotify: true,
|
|
627
|
+
notUpdate: true
|
|
628
|
+
};
|
|
629
|
+
fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
|
|
614
630
|
});
|
|
615
631
|
} // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
|
|
616
632
|
|
|
@@ -639,7 +655,11 @@ class FormFoundation extends _foundation.default {
|
|
|
639
655
|
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
640
656
|
let fieldPath = fieldStaff.field;
|
|
641
657
|
let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
|
|
642
|
-
|
|
658
|
+
let nestedBatchUpdateOpts = {
|
|
659
|
+
notNotify: true,
|
|
660
|
+
notUpdate: true
|
|
661
|
+
};
|
|
662
|
+
fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
|
|
643
663
|
});
|
|
644
664
|
}
|
|
645
665
|
|
|
@@ -665,7 +685,11 @@ class FormFoundation extends _foundation.default {
|
|
|
665
685
|
(0, _forEach.default)(nestedFields).call(nestedFields, fieldStaff => {
|
|
666
686
|
let fieldPath = fieldStaff.field;
|
|
667
687
|
let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
|
|
668
|
-
|
|
688
|
+
let nestedBatchUpdateOpts = {
|
|
689
|
+
notNotify: true,
|
|
690
|
+
notUpdate: true
|
|
691
|
+
};
|
|
692
|
+
fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
|
|
669
693
|
});
|
|
670
694
|
}
|
|
671
695
|
|
package/lib/cjs/form/utils.d.ts
CHANGED
package/lib/cjs/form/utils.js
CHANGED
|
@@ -183,9 +183,10 @@ function mergeProps(props) {
|
|
|
183
183
|
helpText,
|
|
184
184
|
extraText,
|
|
185
185
|
extraTextPosition,
|
|
186
|
-
pure
|
|
186
|
+
pure,
|
|
187
|
+
id
|
|
187
188
|
} = _a,
|
|
188
|
-
rest = __rest(_a, ["field", "label", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "initValue", "validate", "validateStatus", "trigger", "allowEmptyString", "allowEmpty", "emptyValue", "rules", "onChange", "keepState", "transform", "name", "fieldClassName", "fieldStyle", "noLabel", "noErrorMessage", "isInInputGroup", "stopValidateWithError", "convert", "showValidateIcon", "helpText", "extraText", "extraTextPosition", "pure"]); // Form中的任何类型组件,初始值都统一通过initValue字段来传入,同时将可能会导致组件行为错误的props抽取出来,防止透传到组件中
|
|
189
|
+
rest = __rest(_a, ["field", "label", "labelPosition", "labelWidth", "labelAlign", "labelCol", "wrapperCol", "initValue", "validate", "validateStatus", "trigger", "allowEmptyString", "allowEmpty", "emptyValue", "rules", "onChange", "keepState", "transform", "name", "fieldClassName", "fieldStyle", "noLabel", "noErrorMessage", "isInInputGroup", "stopValidateWithError", "convert", "showValidateIcon", "helpText", "extraText", "extraTextPosition", "pure", "id"]); // Form中的任何类型组件,初始值都统一通过initValue字段来传入,同时将可能会导致组件行为错误的props抽取出来,防止透传到组件中
|
|
189
190
|
// For any type of field component in Form, the initial value is uniformly passed in through the initValue field.
|
|
190
191
|
// At the same time, the props that may cause component behavior errors are extracted to prevent transparent transmission to the component.
|
|
191
192
|
|
|
@@ -233,7 +234,8 @@ function mergeProps(props) {
|
|
|
233
234
|
extraText,
|
|
234
235
|
extraTextPosition,
|
|
235
236
|
pure,
|
|
236
|
-
rest
|
|
237
|
+
rest,
|
|
238
|
+
id
|
|
237
239
|
};
|
|
238
240
|
}
|
|
239
241
|
|
|
@@ -75,5 +75,13 @@ declare class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
75
75
|
* @param {Event} e
|
|
76
76
|
*/
|
|
77
77
|
handlePreventMouseDown(e: any): void;
|
|
78
|
+
/**
|
|
79
|
+
* A11y: simulate clear button click
|
|
80
|
+
*/
|
|
81
|
+
handleClearEnterPress(e: any): void;
|
|
82
|
+
/**
|
|
83
|
+
* A11y: simulate password button click
|
|
84
|
+
*/
|
|
85
|
+
handleModeEnterPress(e: any): void;
|
|
78
86
|
}
|
|
79
87
|
export default InputFoundation;
|
|
@@ -28,7 +28,9 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
28
28
|
|
|
29
29
|
var _constants = require("./constants");
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
32
|
+
|
|
33
|
+
var _keyCode = require("./../utils/keyCode");
|
|
32
34
|
|
|
33
35
|
class InputFoundation extends _foundation.default {
|
|
34
36
|
constructor(adapter) {
|
|
@@ -323,7 +325,7 @@ class InputFoundation extends _foundation.default {
|
|
|
323
325
|
handleKeyPress(e) {
|
|
324
326
|
this._adapter.notifyKeyPress(e);
|
|
325
327
|
|
|
326
|
-
if (e.key ===
|
|
328
|
+
if (e.key === _keyCode.ENTER_KEY) {
|
|
327
329
|
this._adapter.notifyEnterPress(e);
|
|
328
330
|
}
|
|
329
331
|
}
|
|
@@ -372,6 +374,26 @@ class InputFoundation extends _foundation.default {
|
|
|
372
374
|
e.preventDefault();
|
|
373
375
|
}
|
|
374
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* A11y: simulate clear button click
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
handleClearEnterPress(e) {
|
|
383
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
384
|
+
this.handleClear(e);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* A11y: simulate password button click
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
handleModeEnterPress(e) {
|
|
393
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
394
|
+
this.handleClickEye(e);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
375
397
|
|
|
376
398
|
}
|
|
377
399
|
|
|
@@ -55,9 +55,13 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
|
|
|
55
55
|
handleFocus(e: any): void;
|
|
56
56
|
handleBlur(e: any): void;
|
|
57
57
|
handleKeyDown(e: any): void;
|
|
58
|
-
resizeTextarea: (cb
|
|
58
|
+
resizeTextarea: (cb?: any) => void;
|
|
59
59
|
handleMouseEnter(e: any): void;
|
|
60
60
|
handleMouseLeave(e: any): void;
|
|
61
61
|
isAllowClear(): boolean;
|
|
62
62
|
handleClear(e: any): void;
|
|
63
|
+
/**
|
|
64
|
+
* A11y: simulate clear button click
|
|
65
|
+
*/
|
|
66
|
+
handleClearEnterPress(e: any): void;
|
|
63
67
|
}
|
|
@@ -28,6 +28,8 @@ var _calculateNodeHeight = _interopRequireDefault(require("./util/calculateNodeH
|
|
|
28
28
|
|
|
29
29
|
var _getSizingData = _interopRequireDefault(require("./util/getSizingData"));
|
|
30
30
|
|
|
31
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
32
|
+
|
|
31
33
|
class TextAreaFoundation extends _foundation.default {
|
|
32
34
|
constructor(adapter) {
|
|
33
35
|
super((0, _assign.default)((0, _assign.default)({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
|
|
@@ -293,6 +295,16 @@ class TextAreaFoundation extends _foundation.default {
|
|
|
293
295
|
|
|
294
296
|
this.stopPropagation(e);
|
|
295
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* A11y: simulate clear button click
|
|
300
|
+
*/
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
handleClearEnterPress(e) {
|
|
304
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
305
|
+
this.handleClear(e);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
296
308
|
|
|
297
309
|
}
|
|
298
310
|
|
|
@@ -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
|
|
@@ -140,6 +140,8 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
140
140
|
|
|
141
141
|
this._adapter.setFocusing(true, null);
|
|
142
142
|
|
|
143
|
+
this._adapter.setClickUpOrDown(false);
|
|
144
|
+
|
|
143
145
|
this._adapter.notifyFocus(e);
|
|
144
146
|
}
|
|
145
147
|
/**
|
|
@@ -476,7 +478,7 @@ class InputNumberFoundation extends _foundation.default {
|
|
|
476
478
|
}
|
|
477
479
|
/**
|
|
478
480
|
* format number to string
|
|
479
|
-
* @param {number} value
|
|
481
|
+
* @param {string|number} value
|
|
480
482
|
* @param {boolean} needAdjustPrec
|
|
481
483
|
* @returns {string}
|
|
482
484
|
*/
|
|
@@ -10,6 +10,7 @@ export interface ModalContentProps extends ModalProps {
|
|
|
10
10
|
}
|
|
11
11
|
export interface ModalContentState {
|
|
12
12
|
dialogMouseDown: boolean;
|
|
13
|
+
prevFocusElement: HTMLElement;
|
|
13
14
|
}
|
|
14
15
|
export interface ModalContentAdapter extends DefaultAdapter<ModalContentProps, ModalContentState> {
|
|
15
16
|
notifyClose: (e: any) => void;
|
|
@@ -18,6 +19,9 @@ export interface ModalContentAdapter extends DefaultAdapter<ModalContentProps, M
|
|
|
18
19
|
addKeyDownEventListener: () => void;
|
|
19
20
|
removeKeyDownEventListener: () => void;
|
|
20
21
|
getMouseState: () => boolean;
|
|
22
|
+
modalDialogFocus: () => void;
|
|
23
|
+
modalDialogBlur: () => void;
|
|
24
|
+
prevFocusElementReFocus: () => void;
|
|
21
25
|
}
|
|
22
26
|
export default class ModalContentFoundation extends BaseFoundation<ModalContentAdapter> {
|
|
23
27
|
constructor(adapter: ModalContentAdapter);
|
|
@@ -30,4 +34,7 @@ export default class ModalContentFoundation extends BaseFoundation<ModalContentA
|
|
|
30
34
|
getMouseState(): void;
|
|
31
35
|
handleMaskClick(e: any): void;
|
|
32
36
|
close(e: any): void;
|
|
37
|
+
modalDialogFocus(): void;
|
|
38
|
+
modalDialogBlur(): void;
|
|
39
|
+
prevFocusElementReFocus(): void;
|
|
33
40
|
}
|
|
@@ -23,6 +23,8 @@ class ModalContentFoundation extends _foundation.default {
|
|
|
23
23
|
|
|
24
24
|
destroy() {
|
|
25
25
|
this.handleKeyDownEventListenerUnmount();
|
|
26
|
+
this.modalDialogBlur();
|
|
27
|
+
this.prevFocusElementReFocus();
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
handleDialogMouseDown() {
|
|
@@ -71,6 +73,18 @@ class ModalContentFoundation extends _foundation.default {
|
|
|
71
73
|
this._adapter.notifyClose(e);
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
modalDialogFocus() {
|
|
77
|
+
this._adapter.modalDialogFocus();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
modalDialogBlur() {
|
|
81
|
+
this._adapter.modalDialogBlur();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
prevFocusElementReFocus() {
|
|
85
|
+
this._adapter.prevFocusElementReFocus();
|
|
86
|
+
}
|
|
87
|
+
|
|
74
88
|
}
|
|
75
89
|
|
|
76
90
|
exports.default = ModalContentFoundation;
|
|
@@ -33,6 +33,7 @@ export interface ItemAdapter<P = Record<string, any>, S = Record<string, any>> e
|
|
|
33
33
|
notifyMouseLeave(e: any): void;
|
|
34
34
|
getIsCollapsed(): boolean;
|
|
35
35
|
getSelected(): boolean;
|
|
36
|
+
getIsOpen(): boolean;
|
|
36
37
|
}
|
|
37
38
|
export default class ItemFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ItemAdapter<P, S>, P, S> {
|
|
38
39
|
_timer: number;
|
|
@@ -42,4 +43,8 @@ export default class ItemFoundation<P = Record<string, any>, S = Record<string,
|
|
|
42
43
|
destroy(): void;
|
|
43
44
|
isValidKey(itemKey: string): boolean;
|
|
44
45
|
handleClick(e: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* A11y: simulate item click
|
|
48
|
+
*/
|
|
49
|
+
handleKeyPress(e: any): void;
|
|
45
50
|
}
|
|
@@ -14,6 +14,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
16
16
|
|
|
17
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
18
|
+
|
|
17
19
|
/* argus-disable unPkgSensitiveInfo */
|
|
18
20
|
class ItemFoundation extends _foundation.default {
|
|
19
21
|
constructor(adapter) {
|
|
@@ -78,6 +80,16 @@ class ItemFoundation extends _foundation.default {
|
|
|
78
80
|
domEvent: e
|
|
79
81
|
});
|
|
80
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* A11y: simulate item click
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
handleKeyPress(e) {
|
|
89
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
90
|
+
this.handleClick(e);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
81
93
|
|
|
82
94
|
}
|
|
83
95
|
|
|
@@ -36,4 +36,10 @@ export default class SubNavFoundation<P = Record<string, any>, S = Record<string
|
|
|
36
36
|
* @param {HTMLElement} titleRef
|
|
37
37
|
*/
|
|
38
38
|
handleClick(e: any, titleRef: any): void;
|
|
39
|
+
/**
|
|
40
|
+
* A11y: simulate sub nav click
|
|
41
|
+
* @param e
|
|
42
|
+
* @param titleRef
|
|
43
|
+
*/
|
|
44
|
+
handleKeyPress(e: any, titleRef: any): void;
|
|
39
45
|
}
|
|
@@ -20,6 +20,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
20
20
|
|
|
21
21
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
22
22
|
|
|
23
|
+
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
24
|
+
|
|
23
25
|
const addKeys = function addKeys() {
|
|
24
26
|
let originKeys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
25
27
|
const keySet = new _set.default(originKeys);
|
|
@@ -141,6 +143,18 @@ class SubNavFoundation extends _foundation.default {
|
|
|
141
143
|
|
|
142
144
|
this._adapter.notifyGlobalOnClick(cbVal);
|
|
143
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* A11y: simulate sub nav click
|
|
148
|
+
* @param e
|
|
149
|
+
* @param titleRef
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
handleKeyPress(e, titleRef) {
|
|
154
|
+
if ((0, _isEnterPress.default)(e)) {
|
|
155
|
+
this.handleClick(e, titleRef);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
144
158
|
|
|
145
159
|
}
|
|
146
160
|
|
package/lib/cjs/radio/radio.css
CHANGED
|
@@ -236,7 +236,13 @@
|
|
|
236
236
|
}
|
|
237
237
|
.semi-radio .semi-radio-inner-buttonRadio,
|
|
238
238
|
.semi-radio .semi-radio-inner-pureCardRadio {
|
|
239
|
-
|
|
239
|
+
position: absolute;
|
|
240
|
+
top: 0;
|
|
241
|
+
left: 0;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: 100%;
|
|
244
|
+
z-index: -1;
|
|
245
|
+
opacity: 0;
|
|
240
246
|
}
|
|
241
247
|
.semi-radio-disabled, .semi-radio-disabled:hover {
|
|
242
248
|
cursor: not-allowed;
|