@douyinfe/semi-foundation 2.2.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/breadcrumb/foundation.ts +10 -1
  2. package/checkbox/checkboxFoundation.ts +9 -0
  3. package/datePicker/foundation.ts +2 -4
  4. package/datePicker/monthsGridFoundation.ts +10 -3
  5. package/form/foundation.ts +20 -8
  6. package/form/utils.ts +2 -0
  7. package/input/foundation.ts +21 -2
  8. package/input/textareaFoundation.ts +11 -1
  9. package/inputNumber/foundation.ts +3 -2
  10. package/lib/cjs/breadcrumb/foundation.d.ts +4 -0
  11. package/lib/cjs/breadcrumb/foundation.js +12 -0
  12. package/lib/cjs/checkbox/checkboxFoundation.d.ts +3 -0
  13. package/lib/cjs/checkbox/checkboxFoundation.js +8 -0
  14. package/lib/cjs/datePicker/foundation.js +2 -4
  15. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +1 -0
  16. package/lib/cjs/datePicker/monthsGridFoundation.js +16 -3
  17. package/lib/cjs/form/foundation.d.ts +13 -0
  18. package/lib/cjs/form/foundation.js +32 -8
  19. package/lib/cjs/form/utils.d.ts +1 -0
  20. package/lib/cjs/form/utils.js +5 -3
  21. package/lib/cjs/input/foundation.d.ts +8 -0
  22. package/lib/cjs/input/foundation.js +24 -2
  23. package/lib/cjs/input/textareaFoundation.d.ts +5 -1
  24. package/lib/cjs/input/textareaFoundation.js +12 -0
  25. package/lib/cjs/inputNumber/foundation.d.ts +2 -2
  26. package/lib/cjs/inputNumber/foundation.js +3 -1
  27. package/lib/cjs/modal/modalContentFoundation.d.ts +7 -0
  28. package/lib/cjs/modal/modalContentFoundation.js +14 -0
  29. package/lib/cjs/navigation/itemFoundation.d.ts +5 -0
  30. package/lib/cjs/navigation/itemFoundation.js +12 -0
  31. package/lib/cjs/navigation/subNavFoundation.d.ts +6 -0
  32. package/lib/cjs/navigation/subNavFoundation.js +14 -0
  33. package/lib/cjs/notification/notificationListFoundation.js +1 -1
  34. package/lib/cjs/radio/radio.css +7 -1
  35. package/lib/cjs/radio/radio.scss +8 -1
  36. package/lib/cjs/select/foundation.d.ts +2 -0
  37. package/lib/cjs/select/foundation.js +40 -6
  38. package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
  39. package/lib/cjs/slider/foundation.d.ts +6 -1
  40. package/lib/cjs/slider/foundation.js +6 -12
  41. package/lib/cjs/slider/slider.css +1 -0
  42. package/lib/cjs/slider/slider.scss +1 -0
  43. package/lib/cjs/table/utils.d.ts +7 -0
  44. package/lib/cjs/table/utils.js +26 -0
  45. package/lib/cjs/tagInput/foundation.d.ts +4 -0
  46. package/lib/cjs/tagInput/foundation.js +12 -0
  47. package/lib/cjs/tooltip/foundation.js +7 -6
  48. package/lib/cjs/transfer/transfer.css +0 -2
  49. package/lib/cjs/transfer/transfer.scss +0 -2
  50. package/lib/cjs/tree/foundation.d.ts +1 -0
  51. package/lib/cjs/tree/foundation.js +1 -1
  52. package/lib/cjs/treeSelect/foundation.d.ts +9 -1
  53. package/lib/cjs/treeSelect/foundation.js +22 -0
  54. package/lib/cjs/utils/isEnterPress.d.ts +4 -0
  55. package/lib/cjs/utils/isEnterPress.js +22 -0
  56. package/lib/cjs/utils/keyCode.d.ts +2 -0
  57. package/lib/cjs/utils/keyCode.js +5 -1
  58. package/lib/cjs/utils/uuid.d.ts +16 -1
  59. package/lib/cjs/utils/uuid.js +32 -0
  60. package/lib/es/breadcrumb/foundation.d.ts +4 -0
  61. package/lib/es/breadcrumb/foundation.js +11 -0
  62. package/lib/es/checkbox/checkboxFoundation.d.ts +3 -0
  63. package/lib/es/checkbox/checkboxFoundation.js +7 -0
  64. package/lib/es/datePicker/foundation.js +2 -4
  65. package/lib/es/datePicker/monthsGridFoundation.d.ts +1 -0
  66. package/lib/es/datePicker/monthsGridFoundation.js +15 -3
  67. package/lib/es/form/foundation.d.ts +13 -0
  68. package/lib/es/form/foundation.js +31 -8
  69. package/lib/es/form/utils.d.ts +1 -0
  70. package/lib/es/form/utils.js +5 -3
  71. package/lib/es/input/foundation.d.ts +8 -0
  72. package/lib/es/input/foundation.js +23 -2
  73. package/lib/es/input/textareaFoundation.d.ts +5 -1
  74. package/lib/es/input/textareaFoundation.js +11 -0
  75. package/lib/es/inputNumber/foundation.d.ts +2 -2
  76. package/lib/es/inputNumber/foundation.js +3 -1
  77. package/lib/es/modal/modalContentFoundation.d.ts +7 -0
  78. package/lib/es/modal/modalContentFoundation.js +14 -0
  79. package/lib/es/navigation/itemFoundation.d.ts +5 -0
  80. package/lib/es/navigation/itemFoundation.js +11 -0
  81. package/lib/es/navigation/subNavFoundation.d.ts +6 -0
  82. package/lib/es/navigation/subNavFoundation.js +13 -0
  83. package/lib/es/notification/notificationListFoundation.js +1 -1
  84. package/lib/es/radio/radio.css +7 -1
  85. package/lib/es/radio/radio.scss +8 -1
  86. package/lib/es/select/foundation.d.ts +2 -0
  87. package/lib/es/select/foundation.js +31 -6
  88. package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
  89. package/lib/es/slider/foundation.d.ts +6 -1
  90. package/lib/es/slider/foundation.js +6 -12
  91. package/lib/es/slider/slider.css +1 -0
  92. package/lib/es/slider/slider.scss +1 -0
  93. package/lib/es/table/utils.d.ts +7 -0
  94. package/lib/es/table/utils.js +24 -0
  95. package/lib/es/tagInput/foundation.d.ts +4 -0
  96. package/lib/es/tagInput/foundation.js +11 -0
  97. package/lib/es/tooltip/foundation.js +7 -6
  98. package/lib/es/transfer/transfer.css +0 -2
  99. package/lib/es/transfer/transfer.scss +0 -2
  100. package/lib/es/tree/foundation.d.ts +1 -0
  101. package/lib/es/tree/foundation.js +1 -1
  102. package/lib/es/treeSelect/foundation.d.ts +9 -1
  103. package/lib/es/treeSelect/foundation.js +22 -1
  104. package/lib/es/utils/isEnterPress.d.ts +4 -0
  105. package/lib/es/utils/isEnterPress.js +8 -0
  106. package/lib/es/utils/keyCode.d.ts +2 -0
  107. package/lib/es/utils/keyCode.js +2 -0
  108. package/lib/es/utils/uuid.d.ts +16 -1
  109. package/lib/es/utils/uuid.js +32 -1
  110. package/modal/modalContentFoundation.ts +18 -0
  111. package/navigation/itemFoundation.ts +11 -0
  112. package/navigation/subNavFoundation.ts +12 -0
  113. package/notification/notificationListFoundation.ts +4 -8
  114. package/package.json +3 -3
  115. package/radio/radio.scss +8 -1
  116. package/select/foundation.ts +26 -7
  117. package/sideSheet/sideSheetFoundation.ts +3 -5
  118. package/slider/foundation.ts +10 -13
  119. package/slider/slider.scss +1 -0
  120. package/table/utils.ts +16 -0
  121. package/tagInput/foundation.ts +10 -0
  122. package/tooltip/foundation.ts +5 -5
  123. package/transfer/transfer.scss +0 -2
  124. package/tree/foundation.ts +2 -1
  125. package/treeSelect/foundation.ts +20 -0
  126. package/utils/isEnterPress.ts +8 -0
  127. package/utils/keyCode.ts +3 -0
  128. package/utils/uuid.ts +29 -1
@@ -54,6 +54,8 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
54
54
 
55
55
  var _treeUtil = require("../tree/treeUtil");
56
56
 
57
+ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
58
+
57
59
  // eslint-disable-next-line max-len
58
60
  class TreeSelectFoundation extends _foundation.default {
59
61
  constructor(adapter) {
@@ -338,6 +340,16 @@ class TreeSelectFoundation extends _foundation.default {
338
340
  this.close(e);
339
341
  }
340
342
  }
343
+ /**
344
+ * A11y: simulate selection click
345
+ */
346
+
347
+
348
+ handleSelectionEnterPress(e) {
349
+ if ((0, _isEnterPress.default)(e)) {
350
+ this.handleClick(e);
351
+ }
352
+ }
341
353
 
342
354
  handleClear(e) {
343
355
  const {
@@ -379,6 +391,16 @@ class TreeSelectFoundation extends _foundation.default {
379
391
  }
380
392
  }
381
393
  }
394
+ /**
395
+ * A11y: simulate clear button click
396
+ */
397
+
398
+
399
+ handleClearEnterPress(e) {
400
+ if ((0, _isEnterPress.default)(e)) {
401
+ this.handleClear(e);
402
+ }
403
+ }
382
404
 
383
405
  removeTag(eventKey) {
384
406
  const {
@@ -0,0 +1,4 @@
1
+ declare function isEnterPress<T extends {
2
+ key: string;
3
+ }>(e: T): boolean;
4
+ export default isEnterPress;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
+
7
+ _Object$defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+
11
+ exports.default = void 0;
12
+
13
+ var _get2 = _interopRequireDefault(require("lodash/get"));
14
+
15
+ var _keyCode = require("./keyCode");
16
+
17
+ function isEnterPress(e) {
18
+ return (0, _get2.default)(e, 'key') === _keyCode.ENTER_KEY ? true : false;
19
+ }
20
+
21
+ var _default = isEnterPress;
22
+ exports.default = _default;
@@ -424,4 +424,6 @@ declare const keyCode: {
424
424
  */
425
425
  WIN_IME: number;
426
426
  };
427
+ export declare const ENTER_KEY = "Enter";
428
+ export declare const TAB_KEY = "Tab";
427
429
  export default keyCode;
@@ -6,7 +6,7 @@ _Object$defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
 
9
- exports.default = void 0;
9
+ exports.default = exports.TAB_KEY = exports.ENTER_KEY = void 0;
10
10
 
11
11
  /**
12
12
  * @ignore
@@ -538,5 +538,9 @@ const keyCode = {
538
538
  */
539
539
  WIN_IME: 229
540
540
  };
541
+ const ENTER_KEY = 'Enter';
542
+ exports.ENTER_KEY = ENTER_KEY;
543
+ const TAB_KEY = 'Tab';
544
+ exports.TAB_KEY = TAB_KEY;
541
545
  var _default = keyCode;
542
546
  exports.default = _default;
@@ -1,3 +1,18 @@
1
1
  export default function getUuid(prefix: string): string;
2
2
  declare function getUuidv4(): string;
3
- export { getUuid, getUuidv4 };
3
+ /**
4
+ * Get a random id with prefix, it not strictly guarantee id uniqueness
5
+ *
6
+ * Note: the return value of getUuid is too long, we need a short one
7
+ *
8
+ * @example
9
+ * getUuidShort({ prefix: 'semi' }) => 'semi-46dinzc'
10
+ * getUuidShort({ prefix: '' }) => '0eer2i0'
11
+ * getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
12
+ */
13
+ declare function getUuidShort(options?: GetUuidShortOptions): string;
14
+ interface GetUuidShortOptions {
15
+ prefix?: string;
16
+ length?: number;
17
+ }
18
+ export { getUuid, getUuidv4, getUuidShort };
@@ -9,6 +9,7 @@ _Object$defineProperty(exports, "__esModule", {
9
9
  });
10
10
 
11
11
  exports.getUuid = exports.default = getUuid;
12
+ exports.getUuidShort = getUuidShort;
12
13
  exports.getUuidv4 = getUuidv4;
13
14
 
14
15
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
@@ -26,4 +27,35 @@ function getUuidv4() {
26
27
  } catch (err) {
27
28
  return getUuid('semi');
28
29
  }
30
+ }
31
+ /**
32
+ * Get a random id with prefix, it not strictly guarantee id uniqueness
33
+ *
34
+ * Note: the return value of getUuid is too long, we need a short one
35
+ *
36
+ * @example
37
+ * getUuidShort({ prefix: 'semi' }) => 'semi-46dinzc'
38
+ * getUuidShort({ prefix: '' }) => '0eer2i0'
39
+ * getUuidShort({ prefix: 'semi', length: 4 }) => 'semi-8jts'
40
+ */
41
+
42
+
43
+ function getUuidShort() {
44
+ var _context3;
45
+
46
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47
+ const {
48
+ prefix = '',
49
+ length = 7
50
+ } = options;
51
+ const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
52
+ const total = characters.length;
53
+ let randomId = '';
54
+
55
+ for (let i = 0; i < length; i++) {
56
+ const random = Math.floor(Math.random() * total);
57
+ randomId += characters.charAt(random);
58
+ }
59
+
60
+ return prefix ? (0, _concat.default)(_context3 = "".concat(prefix, "-")).call(_context3, randomId) : randomId;
29
61
  }
@@ -8,6 +8,10 @@ export default class BreadcrumbFoundation<P = Record<string, any>, S = Record<st
8
8
  constructor(adapter: BreadcrumbAdapter<P, S>);
9
9
  handleClick(info: BreadcrumbItemInfo, event: any): void;
10
10
  handleExpand(clickEvent: any): void;
11
+ /**
12
+ * A11y: simulate clear button click
13
+ */
14
+ handleExpandEnterPress(keyboardEvent: any): void;
11
15
  genRoutes(routes: Array<Route>): ({
12
16
  name: never;
13
17
  _origin: {
@@ -3,6 +3,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
3
3
 
4
4
  /* eslint-disable prefer-const */
5
5
  import BaseFoundation from '../base/foundation';
6
+ import isEnterPress from '../utils/isEnterPress';
6
7
  export default class BreadcrumbFoundation extends BaseFoundation {
7
8
  constructor(adapter) {
8
9
  super(_Object$assign({}, adapter));
@@ -15,6 +16,16 @@ export default class BreadcrumbFoundation extends BaseFoundation {
15
16
  handleExpand(clickEvent) {
16
17
  this._adapter.expandCollapsed(clickEvent);
17
18
  }
19
+ /**
20
+ * A11y: simulate clear button click
21
+ */
22
+
23
+
24
+ handleExpandEnterPress(keyboardEvent) {
25
+ if (isEnterPress(keyboardEvent)) {
26
+ this.handleExpand(keyboardEvent);
27
+ }
28
+ }
18
29
 
19
30
  genRoutes(routes) {
20
31
  return _mapInstanceProperty(routes).call(routes, route => {
@@ -34,6 +34,7 @@ declare class CheckboxFoundation<P = Record<string, any>, S = Record<string, any
34
34
  notifyChange(checked: boolean, e: any): void;
35
35
  handleChange(e: any): void;
36
36
  handleChangeInGroup(e: any): void;
37
+ handleEnterPress(e: any): void;
37
38
  setChecked(checked: boolean): void;
38
39
  destroy(): void;
39
40
  }
@@ -52,5 +53,7 @@ export interface BaseCheckboxProps {
52
53
  onMouseEnter?: (e: any) => void;
53
54
  onMouseLeave?: (e: any) => void;
54
55
  extra?: any;
56
+ addonId?: string;
57
+ extraId?: string;
55
58
  }
56
59
  export default CheckboxFoundation;
@@ -1,6 +1,7 @@
1
1
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
2
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
3
3
  import BaseFoundation from '../base/foundation';
4
+ import isEnterPress from '../utils/isEnterPress';
4
5
 
5
6
  class CheckboxFoundation extends BaseFoundation {
6
7
  constructor(adapter) {
@@ -86,6 +87,12 @@ class CheckboxFoundation extends BaseFoundation {
86
87
  this._adapter.notifyGroupChange(event);
87
88
  }
88
89
 
90
+ handleEnterPress(e) {
91
+ if (isEnterPress(e)) {
92
+ this.handleChange(e);
93
+ }
94
+ }
95
+
89
96
  setChecked(checked) {
90
97
  this._adapter.setNativeControlChecked(checked);
91
98
  } // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -58,12 +58,10 @@ export default class DatePickerFoundation extends BaseFoundation {
58
58
  };
59
59
 
60
60
  this._isRangeValueComplete = value => {
61
- let result = true;
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;
@@ -721,7 +719,7 @@ export default class DatePickerFoundation extends BaseFoundation {
721
719
 
722
720
  if (!this._someDateDisabled(changedDates)) {
723
721
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
724
- const isRangeTypeAndInputIncomplete = this._isRangeType() && (isNullOrUndefined(dates[0]) || isNullOrUndefined(dates[1]));
722
+ const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
725
723
  /**
726
724
  * If the input is incomplete when under control, the notifyChange is not triggered because
727
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
- } = this.getProps();
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: !(type === 'dateRange' && isDateRangeAndHasOffset)
808
+ needCheckFocusRecord
797
809
  });
798
810
  }
799
811
  }
@@ -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;
@@ -8,6 +8,7 @@ import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
8
8
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
9
9
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
10
10
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
11
+ import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
11
12
  import _keysInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/keys";
12
13
  import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
13
14
 
@@ -285,10 +286,20 @@ export default class FormFoundation extends BaseFoundation {
285
286
 
286
287
  this._adapter.notifySubmitFail(_errors, _values);
287
288
  });
288
- } // All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
289
- // input => output:
290
- // a => a[0]、a[1]
291
- // b => b.type、b.name[3]、b.name[2]
289
+ }
290
+ /**
291
+ * Case A:
292
+ * All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
293
+ * input => output:
294
+ * a => a[0]、a[1]
295
+ * b => b.type、b.name[0]、b.name[2]
296
+ *
297
+ * Case B:
298
+ * All fields: activity.a[0]、activity.a[1]、activity.c、activity.d、other
299
+ * input => output:
300
+ * activity.a => activity.a[0]、activity.a[1]
301
+ *
302
+ */
292
303
 
293
304
 
294
305
  _getNestedField(path) {
@@ -305,7 +316,7 @@ export default class FormFoundation extends BaseFoundation {
305
316
 
306
317
  let targetPath = _toPath(path);
307
318
 
308
- if (itemPath[0] === targetPath[0]) {
319
+ if (_everyInstanceProperty(targetPath).call(targetPath, (path, i) => targetPath[i] === itemPath[i])) {
309
320
  const realField = allRegisterField.get(item);
310
321
  nestedFieldPath.set(item, realField);
311
322
  }
@@ -583,7 +594,11 @@ export default class FormFoundation extends BaseFoundation {
583
594
  _forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
584
595
  let fieldPath = fieldStaff.field;
585
596
  let newFieldVal = ObjectUtil.get(_valuesInstanceProperty(this.data), fieldPath);
586
- fieldStaff.fieldApi.setValue(newFieldVal, opts);
597
+ let nestedBatchUpdateOpts = {
598
+ notNotify: true,
599
+ notUpdate: true
600
+ };
601
+ fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
587
602
  });
588
603
  } // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
589
604
 
@@ -612,7 +627,11 @@ export default class FormFoundation extends BaseFoundation {
612
627
  _forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
613
628
  let fieldPath = fieldStaff.field;
614
629
  let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
615
- fieldStaff.fieldApi.setError(newFieldError, opts);
630
+ let nestedBatchUpdateOpts = {
631
+ notNotify: true,
632
+ notUpdate: true
633
+ };
634
+ fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
616
635
  });
617
636
  }
618
637
 
@@ -638,7 +657,11 @@ export default class FormFoundation extends BaseFoundation {
638
657
  _forEachInstanceProperty(nestedFields).call(nestedFields, fieldStaff => {
639
658
  let fieldPath = fieldStaff.field;
640
659
  let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
641
- fieldStaff.fieldApi.setTouched(newFieldTouch, opts);
660
+ let nestedBatchUpdateOpts = {
661
+ notNotify: true,
662
+ notUpdate: true
663
+ };
664
+ fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
642
665
  });
643
666
  }
644
667
 
@@ -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
  };
@@ -156,9 +156,10 @@ export function mergeProps(props) {
156
156
  helpText,
157
157
  extraText,
158
158
  extraTextPosition,
159
- pure
159
+ pure,
160
+ id
160
161
  } = _a,
161
- 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抽取出来,防止透传到组件中
162
+ 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抽取出来,防止透传到组件中
162
163
  // For any type of field component in Form, the initial value is uniformly passed in through the initValue field.
163
164
  // At the same time, the props that may cause component behavior errors are extracted to prevent transparent transmission to the component.
164
165
 
@@ -206,7 +207,8 @@ export function mergeProps(props) {
206
207
  extraText,
207
208
  extraTextPosition,
208
209
  pure,
209
- rest
210
+ rest,
211
+ id
210
212
  };
211
213
  }
212
214
 
@@ -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;
@@ -7,7 +7,8 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
7
7
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
8
8
  import BaseFoundation from '../base/foundation';
9
9
  import { strings } from './constants';
10
- const ENTER_KEY_CODE = 'Enter';
10
+ import isEnterPress from '../utils/isEnterPress';
11
+ import { ENTER_KEY } from './../utils/keyCode';
11
12
 
12
13
  class InputFoundation extends BaseFoundation {
13
14
  constructor(adapter) {
@@ -303,7 +304,7 @@ class InputFoundation extends BaseFoundation {
303
304
  handleKeyPress(e) {
304
305
  this._adapter.notifyKeyPress(e);
305
306
 
306
- if (e.key === ENTER_KEY_CODE) {
307
+ if (e.key === ENTER_KEY) {
307
308
  this._adapter.notifyEnterPress(e);
308
309
  }
309
310
  }
@@ -352,6 +353,26 @@ class InputFoundation extends BaseFoundation {
352
353
  e.preventDefault();
353
354
  }
354
355
  }
356
+ /**
357
+ * A11y: simulate clear button click
358
+ */
359
+
360
+
361
+ handleClearEnterPress(e) {
362
+ if (isEnterPress(e)) {
363
+ this.handleClear(e);
364
+ }
365
+ }
366
+ /**
367
+ * A11y: simulate password button click
368
+ */
369
+
370
+
371
+ handleModeEnterPress(e) {
372
+ if (isEnterPress(e)) {
373
+ this.handleClickEye(e);
374
+ }
375
+ }
355
376
 
356
377
  }
357
378
 
@@ -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
  }
@@ -7,6 +7,7 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
7
7
  import BaseFoundation from '../base/foundation';
8
8
  import calculateNodeHeight from './util/calculateNodeHeight';
9
9
  import getSizingData from './util/getSizingData';
10
+ import isEnterPress from '../utils/isEnterPress';
10
11
  export default class TextAreaFoundation extends BaseFoundation {
11
12
  constructor(adapter) {
12
13
  super(_Object$assign(_Object$assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
@@ -272,5 +273,15 @@ export default class TextAreaFoundation extends BaseFoundation {
272
273
 
273
274
  this.stopPropagation(e);
274
275
  }
276
+ /**
277
+ * A11y: simulate clear button click
278
+ */
279
+
280
+
281
+ handleClearEnterPress(e) {
282
+ if (isEnterPress(e)) {
283
+ this.handleClear(e);
284
+ }
285
+ }
275
286
 
276
287
  }
@@ -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
  */
@@ -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
  }
@@ -8,6 +8,8 @@ export default class ModalContentFoundation extends BaseFoundation {
8
8
 
9
9
  destroy() {
10
10
  this.handleKeyDownEventListenerUnmount();
11
+ this.modalDialogBlur();
12
+ this.prevFocusElementReFocus();
11
13
  }
12
14
 
13
15
  handleDialogMouseDown() {
@@ -56,4 +58,16 @@ export default class ModalContentFoundation extends BaseFoundation {
56
58
  this._adapter.notifyClose(e);
57
59
  }
58
60
 
61
+ modalDialogFocus() {
62
+ this._adapter.modalDialogFocus();
63
+ }
64
+
65
+ modalDialogBlur() {
66
+ this._adapter.modalDialogBlur();
67
+ }
68
+
69
+ prevFocusElementReFocus() {
70
+ this._adapter.prevFocusElementReFocus();
71
+ }
72
+
59
73
  }
@@ -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
  }