@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.
Files changed (149) hide show
  1. package/breadcrumb/foundation.ts +10 -1
  2. package/checkbox/checkboxFoundation.ts +9 -0
  3. package/datePicker/datePicker.scss +11 -0
  4. package/datePicker/foundation.ts +33 -15
  5. package/datePicker/inputFoundation.ts +2 -0
  6. package/datePicker/monthsGridFoundation.ts +10 -3
  7. package/datePicker/rtl.scss +15 -1
  8. package/datePicker/variables.scss +2 -0
  9. package/form/foundation.ts +20 -8
  10. package/form/utils.ts +2 -0
  11. package/input/foundation.ts +21 -2
  12. package/input/textareaFoundation.ts +11 -1
  13. package/inputNumber/foundation.ts +3 -2
  14. package/lib/cjs/breadcrumb/foundation.d.ts +4 -0
  15. package/lib/cjs/breadcrumb/foundation.js +12 -0
  16. package/lib/cjs/checkbox/checkboxFoundation.d.ts +3 -0
  17. package/lib/cjs/checkbox/checkboxFoundation.js +8 -0
  18. package/lib/cjs/datePicker/datePicker.css +26 -2
  19. package/lib/cjs/datePicker/datePicker.scss +11 -0
  20. package/lib/cjs/datePicker/foundation.d.ts +6 -3
  21. package/lib/cjs/datePicker/foundation.js +42 -18
  22. package/lib/cjs/datePicker/inputFoundation.js +3 -0
  23. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +2 -1
  24. package/lib/cjs/datePicker/monthsGridFoundation.js +16 -3
  25. package/lib/cjs/datePicker/rtl.scss +15 -1
  26. package/lib/cjs/datePicker/variables.scss +2 -0
  27. package/lib/cjs/form/foundation.d.ts +13 -0
  28. package/lib/cjs/form/foundation.js +32 -8
  29. package/lib/cjs/form/utils.d.ts +1 -0
  30. package/lib/cjs/form/utils.js +5 -3
  31. package/lib/cjs/input/foundation.d.ts +8 -0
  32. package/lib/cjs/input/foundation.js +24 -2
  33. package/lib/cjs/input/textareaFoundation.d.ts +5 -1
  34. package/lib/cjs/input/textareaFoundation.js +12 -0
  35. package/lib/cjs/inputNumber/foundation.d.ts +2 -2
  36. package/lib/cjs/inputNumber/foundation.js +3 -1
  37. package/lib/cjs/modal/modalContentFoundation.d.ts +7 -0
  38. package/lib/cjs/modal/modalContentFoundation.js +14 -0
  39. package/lib/cjs/navigation/itemFoundation.d.ts +5 -0
  40. package/lib/cjs/navigation/itemFoundation.js +12 -0
  41. package/lib/cjs/navigation/subNavFoundation.d.ts +6 -0
  42. package/lib/cjs/navigation/subNavFoundation.js +14 -0
  43. package/lib/cjs/notification/notificationListFoundation.js +1 -1
  44. package/lib/cjs/radio/radio.css +7 -1
  45. package/lib/cjs/radio/radio.scss +8 -1
  46. package/lib/cjs/select/foundation.d.ts +2 -0
  47. package/lib/cjs/select/foundation.js +40 -6
  48. package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
  49. package/lib/cjs/slider/foundation.d.ts +6 -1
  50. package/lib/cjs/slider/foundation.js +6 -12
  51. package/lib/cjs/slider/slider.css +1 -0
  52. package/lib/cjs/slider/slider.scss +1 -0
  53. package/lib/cjs/table/table.css +0 -2
  54. package/lib/cjs/table/table.scss +0 -2
  55. package/lib/cjs/table/utils.d.ts +7 -0
  56. package/lib/cjs/table/utils.js +26 -0
  57. package/lib/cjs/tagInput/foundation.d.ts +4 -0
  58. package/lib/cjs/tagInput/foundation.js +12 -0
  59. package/lib/cjs/tooltip/foundation.js +7 -6
  60. package/lib/cjs/transfer/transfer.css +0 -2
  61. package/lib/cjs/transfer/transfer.scss +0 -2
  62. package/lib/cjs/tree/foundation.d.ts +1 -0
  63. package/lib/cjs/tree/foundation.js +1 -1
  64. package/lib/cjs/treeSelect/foundation.d.ts +9 -1
  65. package/lib/cjs/treeSelect/foundation.js +22 -0
  66. package/lib/cjs/utils/isEnterPress.d.ts +4 -0
  67. package/lib/cjs/utils/isEnterPress.js +22 -0
  68. package/lib/cjs/utils/keyCode.d.ts +2 -0
  69. package/lib/cjs/utils/keyCode.js +5 -1
  70. package/lib/cjs/utils/uuid.d.ts +16 -1
  71. package/lib/cjs/utils/uuid.js +32 -0
  72. package/lib/es/breadcrumb/foundation.d.ts +4 -0
  73. package/lib/es/breadcrumb/foundation.js +11 -0
  74. package/lib/es/checkbox/checkboxFoundation.d.ts +3 -0
  75. package/lib/es/checkbox/checkboxFoundation.js +7 -0
  76. package/lib/es/datePicker/datePicker.css +26 -2
  77. package/lib/es/datePicker/datePicker.scss +11 -0
  78. package/lib/es/datePicker/foundation.d.ts +6 -3
  79. package/lib/es/datePicker/foundation.js +42 -18
  80. package/lib/es/datePicker/inputFoundation.js +3 -0
  81. package/lib/es/datePicker/monthsGridFoundation.d.ts +2 -1
  82. package/lib/es/datePicker/monthsGridFoundation.js +15 -3
  83. package/lib/es/datePicker/rtl.scss +15 -1
  84. package/lib/es/datePicker/variables.scss +2 -0
  85. package/lib/es/form/foundation.d.ts +13 -0
  86. package/lib/es/form/foundation.js +31 -8
  87. package/lib/es/form/utils.d.ts +1 -0
  88. package/lib/es/form/utils.js +5 -3
  89. package/lib/es/input/foundation.d.ts +8 -0
  90. package/lib/es/input/foundation.js +23 -2
  91. package/lib/es/input/textareaFoundation.d.ts +5 -1
  92. package/lib/es/input/textareaFoundation.js +11 -0
  93. package/lib/es/inputNumber/foundation.d.ts +2 -2
  94. package/lib/es/inputNumber/foundation.js +3 -1
  95. package/lib/es/modal/modalContentFoundation.d.ts +7 -0
  96. package/lib/es/modal/modalContentFoundation.js +14 -0
  97. package/lib/es/navigation/itemFoundation.d.ts +5 -0
  98. package/lib/es/navigation/itemFoundation.js +11 -0
  99. package/lib/es/navigation/subNavFoundation.d.ts +6 -0
  100. package/lib/es/navigation/subNavFoundation.js +13 -0
  101. package/lib/es/notification/notificationListFoundation.js +1 -1
  102. package/lib/es/radio/radio.css +7 -1
  103. package/lib/es/radio/radio.scss +8 -1
  104. package/lib/es/select/foundation.d.ts +2 -0
  105. package/lib/es/select/foundation.js +31 -6
  106. package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
  107. package/lib/es/slider/foundation.d.ts +6 -1
  108. package/lib/es/slider/foundation.js +6 -12
  109. package/lib/es/slider/slider.css +1 -0
  110. package/lib/es/slider/slider.scss +1 -0
  111. package/lib/es/table/table.css +0 -2
  112. package/lib/es/table/table.scss +0 -2
  113. package/lib/es/table/utils.d.ts +7 -0
  114. package/lib/es/table/utils.js +24 -0
  115. package/lib/es/tagInput/foundation.d.ts +4 -0
  116. package/lib/es/tagInput/foundation.js +11 -0
  117. package/lib/es/tooltip/foundation.js +7 -6
  118. package/lib/es/transfer/transfer.css +0 -2
  119. package/lib/es/transfer/transfer.scss +0 -2
  120. package/lib/es/tree/foundation.d.ts +1 -0
  121. package/lib/es/tree/foundation.js +1 -1
  122. package/lib/es/treeSelect/foundation.d.ts +9 -1
  123. package/lib/es/treeSelect/foundation.js +22 -1
  124. package/lib/es/utils/isEnterPress.d.ts +4 -0
  125. package/lib/es/utils/isEnterPress.js +8 -0
  126. package/lib/es/utils/keyCode.d.ts +2 -0
  127. package/lib/es/utils/keyCode.js +2 -0
  128. package/lib/es/utils/uuid.d.ts +16 -1
  129. package/lib/es/utils/uuid.js +32 -1
  130. package/modal/modalContentFoundation.ts +18 -0
  131. package/navigation/itemFoundation.ts +11 -0
  132. package/navigation/subNavFoundation.ts +12 -0
  133. package/notification/notificationListFoundation.ts +4 -8
  134. package/package.json +3 -3
  135. package/radio/radio.scss +8 -1
  136. package/select/foundation.ts +26 -7
  137. package/sideSheet/sideSheetFoundation.ts +3 -5
  138. package/slider/foundation.ts +10 -13
  139. package/slider/slider.scss +1 -0
  140. package/table/table.scss +0 -2
  141. package/table/utils.ts +16 -0
  142. package/tagInput/foundation.ts +10 -0
  143. package/tooltip/foundation.ts +5 -5
  144. package/transfer/transfer.scss +0 -2
  145. package/tree/foundation.ts +2 -1
  146. package/treeSelect/foundation.ts +20 -0
  147. package/utils/isEnterPress.ts +8 -0
  148. package/utils/keyCode.ts +3 -0
  149. 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 = true;
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, dates) {
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
- const newCachedSelectedValue = (0, _isArray.default)(dates) && dates.length ? dates : value;
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
- if (!(0, _isEqual2.default)(newCachedSelectedValue, cachedSelectedValue)) {
277
- this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
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 && arguments[2] !== undefined ? arguments[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, dates);
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
- this._updateValueAndInput('', true);
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() && ((0, _isNullOrUndefined.default)(dates[0]) || (0, _isNullOrUndefined.default)(dates[1]));
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
@@ -56,6 +56,9 @@ class InputFoundation extends _foundation.default {
56
56
  }
57
57
 
58
58
  handleRangeInputClear(e) {
59
+ // prevent trigger click outside
60
+ this.stopPropagation(e);
61
+
59
62
  this._adapter.notifyRangeInputClear(e);
60
63
  }
61
64
 
@@ -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" | "none" | "both";
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
- } = this.getProps();
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: !(type === 'dateRange' && isDateRangeAndHasOffset)
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
- } // All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
324
- // input => output:
325
- // a => a[0]、a[1]
326
- // b => b.type、b.name[3]、b.name[2]
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 (itemPath[0] === targetPath[0]) {
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
- fieldStaff.fieldApi.setValue(newFieldVal, opts);
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
- fieldStaff.fieldApi.setError(newFieldError, opts);
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
- fieldStaff.fieldApi.setTouched(newFieldTouch, opts);
688
+ let nestedBatchUpdateOpts = {
689
+ notNotify: true,
690
+ notUpdate: true
691
+ };
692
+ fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
669
693
  });
670
694
  }
671
695
 
@@ -49,4 +49,5 @@ export declare function mergeProps(props: any): {
49
49
  extraTextPosition: any;
50
50
  pure: any;
51
51
  rest: any;
52
+ id: any;
52
53
  };
@@ -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
- const ENTER_KEY_CODE = 'Enter';
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 === ENTER_KEY_CODE) {
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: any) => void;
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
 
@@ -26,7 +26,7 @@ class NotificationListFoundation extends _foundation.default {
26
26
  // }
27
27
 
28
28
 
29
- this._adapter.updateNotices([...notices, opts]); // return id;
29
+ this._adapter.updateNotices([opts, ...notices]); // return id;
30
30
 
31
31
  }
32
32
 
@@ -236,7 +236,13 @@
236
236
  }
237
237
  .semi-radio .semi-radio-inner-buttonRadio,
238
238
  .semi-radio .semi-radio-inner-pureCardRadio {
239
- display: none;
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;