@douyinfe/semi-foundation 2.2.2 → 2.3.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/breadcrumb/foundation.ts +10 -1
  2. package/checkbox/checkboxFoundation.ts +9 -0
  3. package/form/foundation.ts +20 -8
  4. package/form/utils.ts +2 -0
  5. package/input/foundation.ts +21 -2
  6. package/input/textareaFoundation.ts +11 -1
  7. package/lib/cjs/breadcrumb/foundation.d.ts +4 -0
  8. package/lib/cjs/breadcrumb/foundation.js +12 -0
  9. package/lib/cjs/checkbox/checkboxFoundation.d.ts +3 -0
  10. package/lib/cjs/checkbox/checkboxFoundation.js +8 -0
  11. package/lib/cjs/form/foundation.d.ts +13 -0
  12. package/lib/cjs/form/foundation.js +32 -8
  13. package/lib/cjs/form/utils.d.ts +1 -0
  14. package/lib/cjs/form/utils.js +5 -3
  15. package/lib/cjs/input/foundation.d.ts +8 -0
  16. package/lib/cjs/input/foundation.js +24 -2
  17. package/lib/cjs/input/textareaFoundation.d.ts +5 -1
  18. package/lib/cjs/input/textareaFoundation.js +12 -0
  19. package/lib/cjs/modal/modalContentFoundation.d.ts +7 -0
  20. package/lib/cjs/modal/modalContentFoundation.js +14 -0
  21. package/lib/cjs/navigation/itemFoundation.d.ts +5 -0
  22. package/lib/cjs/navigation/itemFoundation.js +12 -0
  23. package/lib/cjs/navigation/subNavFoundation.d.ts +6 -0
  24. package/lib/cjs/navigation/subNavFoundation.js +14 -0
  25. package/lib/cjs/radio/radio.css +7 -1
  26. package/lib/cjs/radio/radio.scss +8 -1
  27. package/lib/cjs/select/foundation.d.ts +2 -0
  28. package/lib/cjs/select/foundation.js +40 -6
  29. package/lib/cjs/sideSheet/sideSheetFoundation.d.ts +1 -0
  30. package/lib/cjs/slider/foundation.d.ts +6 -1
  31. package/lib/cjs/slider/foundation.js +6 -12
  32. package/lib/cjs/slider/slider.css +1 -0
  33. package/lib/cjs/slider/slider.scss +1 -0
  34. package/lib/cjs/table/utils.d.ts +7 -0
  35. package/lib/cjs/table/utils.js +26 -0
  36. package/lib/cjs/tagInput/foundation.d.ts +4 -0
  37. package/lib/cjs/tagInput/foundation.js +12 -0
  38. package/lib/cjs/tooltip/foundation.js +7 -6
  39. package/lib/cjs/transfer/transfer.css +0 -2
  40. package/lib/cjs/transfer/transfer.scss +0 -2
  41. package/lib/cjs/tree/foundation.d.ts +1 -0
  42. package/lib/cjs/tree/foundation.js +1 -1
  43. package/lib/cjs/treeSelect/foundation.d.ts +9 -1
  44. package/lib/cjs/treeSelect/foundation.js +22 -0
  45. package/lib/cjs/utils/isEnterPress.d.ts +4 -0
  46. package/lib/cjs/utils/isEnterPress.js +22 -0
  47. package/lib/cjs/utils/keyCode.d.ts +2 -0
  48. package/lib/cjs/utils/keyCode.js +5 -1
  49. package/lib/cjs/utils/uuid.d.ts +15 -1
  50. package/lib/cjs/utils/uuid.js +31 -0
  51. package/lib/es/breadcrumb/foundation.d.ts +4 -0
  52. package/lib/es/breadcrumb/foundation.js +11 -0
  53. package/lib/es/checkbox/checkboxFoundation.d.ts +3 -0
  54. package/lib/es/checkbox/checkboxFoundation.js +7 -0
  55. package/lib/es/form/foundation.d.ts +13 -0
  56. package/lib/es/form/foundation.js +31 -8
  57. package/lib/es/form/utils.d.ts +1 -0
  58. package/lib/es/form/utils.js +5 -3
  59. package/lib/es/input/foundation.d.ts +8 -0
  60. package/lib/es/input/foundation.js +23 -2
  61. package/lib/es/input/textareaFoundation.d.ts +5 -1
  62. package/lib/es/input/textareaFoundation.js +11 -0
  63. package/lib/es/modal/modalContentFoundation.d.ts +7 -0
  64. package/lib/es/modal/modalContentFoundation.js +14 -0
  65. package/lib/es/navigation/itemFoundation.d.ts +5 -0
  66. package/lib/es/navigation/itemFoundation.js +11 -0
  67. package/lib/es/navigation/subNavFoundation.d.ts +6 -0
  68. package/lib/es/navigation/subNavFoundation.js +13 -0
  69. package/lib/es/radio/radio.css +7 -1
  70. package/lib/es/radio/radio.scss +8 -1
  71. package/lib/es/select/foundation.d.ts +2 -0
  72. package/lib/es/select/foundation.js +31 -6
  73. package/lib/es/sideSheet/sideSheetFoundation.d.ts +1 -0
  74. package/lib/es/slider/foundation.d.ts +6 -1
  75. package/lib/es/slider/foundation.js +6 -12
  76. package/lib/es/slider/slider.css +1 -0
  77. package/lib/es/slider/slider.scss +1 -0
  78. package/lib/es/table/utils.d.ts +7 -0
  79. package/lib/es/table/utils.js +24 -0
  80. package/lib/es/tagInput/foundation.d.ts +4 -0
  81. package/lib/es/tagInput/foundation.js +11 -0
  82. package/lib/es/tooltip/foundation.js +7 -6
  83. package/lib/es/transfer/transfer.css +0 -2
  84. package/lib/es/transfer/transfer.scss +0 -2
  85. package/lib/es/tree/foundation.d.ts +1 -0
  86. package/lib/es/tree/foundation.js +1 -1
  87. package/lib/es/treeSelect/foundation.d.ts +9 -1
  88. package/lib/es/treeSelect/foundation.js +22 -1
  89. package/lib/es/utils/isEnterPress.d.ts +4 -0
  90. package/lib/es/utils/isEnterPress.js +8 -0
  91. package/lib/es/utils/keyCode.d.ts +2 -0
  92. package/lib/es/utils/keyCode.js +2 -0
  93. package/lib/es/utils/uuid.d.ts +15 -1
  94. package/lib/es/utils/uuid.js +31 -1
  95. package/modal/modalContentFoundation.ts +18 -0
  96. package/navigation/itemFoundation.ts +11 -0
  97. package/navigation/subNavFoundation.ts +12 -0
  98. package/package.json +3 -3
  99. package/radio/radio.scss +8 -1
  100. package/select/foundation.ts +26 -7
  101. package/sideSheet/sideSheetFoundation.ts +3 -5
  102. package/slider/foundation.ts +10 -13
  103. package/slider/slider.scss +1 -0
  104. package/table/utils.ts +16 -0
  105. package/tagInput/foundation.ts +10 -0
  106. package/tooltip/foundation.ts +5 -5
  107. package/transfer/transfer.scss +0 -2
  108. package/tree/foundation.ts +2 -1
  109. package/treeSelect/foundation.ts +20 -0
  110. package/utils/isEnterPress.ts +8 -0
  111. package/utils/keyCode.ts +3 -0
  112. package/utils/uuid.ts +23 -1
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable prefer-const */
2
2
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
-
3
+ import isEnterPress from '../utils/isEnterPress';
4
4
  import { BreadcrumbItemInfo, Route } from './itemFoundation';
5
5
  export interface BreadcrumbAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
6
6
  notifyClick: (itemInfo: BreadcrumbItemInfo, event: any) => void;
@@ -21,6 +21,15 @@ export default class BreadcrumbFoundation<P = Record<string, any>, S = Record<st
21
21
  this._adapter.expandCollapsed(clickEvent);
22
22
  }
23
23
 
24
+ /**
25
+ * A11y: simulate clear button click
26
+ */
27
+ handleExpandEnterPress(keyboardEvent: any) {
28
+ if (isEnterPress(keyboardEvent)) {
29
+ this.handleExpand(keyboardEvent);
30
+ }
31
+ }
32
+
24
33
  genRoutes(routes: Array<Route>) {
25
34
  return routes.map(route => {
26
35
  if (typeof route !== 'object') {
@@ -1,4 +1,5 @@
1
1
  import BaseFoundation, { DefaultAdapter, noopFunction } from '../base/foundation';
2
+ import isEnterPress from '../utils/isEnterPress';
2
3
 
3
4
  export interface BasicTargetObject {
4
5
  [x: string]: any;
@@ -98,6 +99,12 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
98
99
  this._adapter.notifyGroupChange(event);
99
100
  }
100
101
 
102
+ handleEnterPress(e: any) {
103
+ if (isEnterPress(e)) {
104
+ this.handleChange(e);
105
+ }
106
+ }
107
+
101
108
  setChecked(checked: boolean) {
102
109
  this._adapter.setNativeControlChecked(checked);
103
110
  }
@@ -121,6 +128,8 @@ export interface BaseCheckboxProps {
121
128
  onMouseEnter?: (e: any) => void;
122
129
  onMouseLeave?: (e: any) => void;
123
130
  extra?: any;
131
+ addonId?: string;
132
+ extraId?: string;
124
133
  }
125
134
 
126
135
  export default CheckboxFoundation;
@@ -258,10 +258,19 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
258
258
  });
259
259
  }
260
260
 
261
- // All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
262
- // input => output:
263
- // a => a[0]、a[1]
264
- // b => b.type、b.name[3]、b.name[2]
261
+ /**
262
+ * Case A:
263
+ * All fields: a[0]、a[1]、b.type、b.name[2]、b.name[0]
264
+ * input => output:
265
+ * a => a[0]、a[1]
266
+ * b => b.type、b.name[0]、b.name[2]
267
+ *
268
+ * Case B:
269
+ * All fields: activity.a[0]、activity.a[1]、activity.c、activity.d、other
270
+ * input => output:
271
+ * activity.a => activity.a[0]、activity.a[1]
272
+ *
273
+ */
265
274
  _getNestedField(path: string): Map<string, FieldStaff> {
266
275
  const allRegisterField = this.fields;
267
276
  const allFieldPath = [...allRegisterField].map(item => item[0]);
@@ -269,7 +278,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
269
278
  allFieldPath.forEach(item => {
270
279
  let itemPath = toPath(item);
271
280
  let targetPath = toPath(path);
272
- if (itemPath[0] === targetPath[0]) {
281
+ if (targetPath.every((path, i) => (targetPath[i] === itemPath[i]))) {
273
282
  const realField = allRegisterField.get(item);
274
283
  nestedFieldPath.set(item, realField);
275
284
  }
@@ -503,7 +512,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
503
512
  nestedFields.forEach(fieldStaff => {
504
513
  let fieldPath = fieldStaff.field;
505
514
  let newFieldVal = ObjectUtil.get(this.data.values, fieldPath);
506
- fieldStaff.fieldApi.setValue(newFieldVal, opts);
515
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
516
+ fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
507
517
  });
508
518
  }
509
519
  // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
@@ -524,7 +534,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
524
534
  nestedFields.forEach(fieldStaff => {
525
535
  let fieldPath = fieldStaff.field;
526
536
  let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
527
- fieldStaff.fieldApi.setError(newFieldError, opts);
537
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
538
+ fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
528
539
  });
529
540
  }
530
541
  if (this.getArrayField(field)) {
@@ -544,7 +555,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
544
555
  nestedFields.forEach(fieldStaff => {
545
556
  let fieldPath = fieldStaff.field;
546
557
  let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
547
- fieldStaff.fieldApi.setTouched(newFieldTouch, opts);
558
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
559
+ fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
548
560
  });
549
561
  }
550
562
  if (this.getArrayField(field)) {
package/form/utils.ts CHANGED
@@ -133,6 +133,7 @@ export function mergeProps(props: any) {
133
133
  extraText,
134
134
  extraTextPosition,
135
135
  pure,
136
+ id,
136
137
  ...rest
137
138
  }: any = { ...defaultProps, ...props };
138
139
  // Form中的任何类型组件,初始值都统一通过initValue字段来传入,同时将可能会导致组件行为错误的props抽取出来,防止透传到组件中
@@ -183,6 +184,7 @@ export function mergeProps(props: any) {
183
184
  extraTextPosition,
184
185
  pure,
185
186
  rest,
187
+ id
186
188
  };
187
189
  }
188
190
 
@@ -2,7 +2,8 @@ import BaseFoundation, { DefaultAdapter, noopFunction } from '../base/foundation
2
2
  import { strings } from './constants';
3
3
  import { noop, set, isNumber, isString, isFunction } from 'lodash';
4
4
 
5
- const ENTER_KEY_CODE = 'Enter';
5
+ import isEnterPress from '../utils/isEnterPress';
6
+ import { ENTER_KEY } from './../utils/keyCode';
6
7
 
7
8
  export interface InputDefaultAdapter {
8
9
  notifyChange: noopFunction;
@@ -261,7 +262,7 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
261
262
 
262
263
  handleKeyPress(e: any) {
263
264
  this._adapter.notifyKeyPress(e);
264
- if (e.key === ENTER_KEY_CODE) {
265
+ if (e.key === ENTER_KEY) {
265
266
  this._adapter.notifyEnterPress(e);
266
267
  }
267
268
  }
@@ -294,5 +295,23 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
294
295
  e.preventDefault();
295
296
  }
296
297
  }
298
+
299
+ /**
300
+ * A11y: simulate clear button click
301
+ */
302
+ handleClearEnterPress(e: any) {
303
+ if (isEnterPress(e)) {
304
+ this.handleClear(e);
305
+ }
306
+ }
307
+
308
+ /**
309
+ * A11y: simulate password button click
310
+ */
311
+ handleModeEnterPress(e: any) {
312
+ if (isEnterPress(e)) {
313
+ this.handleClickEye(e);
314
+ }
315
+ }
297
316
  }
298
317
  export default InputFoundation;
@@ -7,6 +7,7 @@ import {
7
7
  } from 'lodash';
8
8
  import calculateNodeHeight from './util/calculateNodeHeight';
9
9
  import getSizingData from './util/getSizingData';
10
+ import isEnterPress from '../utils/isEnterPress';
10
11
 
11
12
  export interface TextAreaDefaultAdpter {
12
13
  notifyChange: noopFunction;
@@ -171,7 +172,7 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
171
172
  }
172
173
  }
173
174
 
174
- resizeTextarea = (cb: any) => {
175
+ resizeTextarea = (cb?: any) => {
175
176
  const { height } = this.getStates();
176
177
  const { rows } = this.getProps();
177
178
  const node = this._adapter.getRef().current;
@@ -232,4 +233,13 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
232
233
  this._adapter.notifyClear(e);
233
234
  this.stopPropagation(e);
234
235
  }
236
+
237
+ /**
238
+ * A11y: simulate clear button click
239
+ */
240
+ handleClearEnterPress(e: any) {
241
+ if (isEnterPress(e)) {
242
+ this.handleClear(e);
243
+ }
244
+ }
235
245
  }
@@ -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: {
@@ -16,6 +16,8 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
16
16
 
17
17
  var _foundation = _interopRequireDefault(require("../base/foundation"));
18
18
 
19
+ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
20
+
19
21
  /* eslint-disable prefer-const */
20
22
  class BreadcrumbFoundation extends _foundation.default {
21
23
  constructor(adapter) {
@@ -29,6 +31,16 @@ class BreadcrumbFoundation extends _foundation.default {
29
31
  handleExpand(clickEvent) {
30
32
  this._adapter.expandCollapsed(clickEvent);
31
33
  }
34
+ /**
35
+ * A11y: simulate clear button click
36
+ */
37
+
38
+
39
+ handleExpandEnterPress(keyboardEvent) {
40
+ if ((0, _isEnterPress.default)(keyboardEvent)) {
41
+ this.handleExpand(keyboardEvent);
42
+ }
43
+ }
32
44
 
33
45
  genRoutes(routes) {
34
46
  return (0, _map.default)(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;
@@ -16,6 +16,8 @@ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-s
16
16
 
17
17
  var _foundation = _interopRequireDefault(require("../base/foundation"));
18
18
 
19
+ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
20
+
19
21
  class CheckboxFoundation extends _foundation.default {
20
22
  constructor(adapter) {
21
23
  super((0, _assign.default)({}, adapter));
@@ -99,6 +101,12 @@ class CheckboxFoundation extends _foundation.default {
99
101
  this._adapter.notifyGroupChange(event);
100
102
  }
101
103
 
104
+ handleEnterPress(e) {
105
+ if ((0, _isEnterPress.default)(e)) {
106
+ this.handleChange(e);
107
+ }
108
+ }
109
+
102
110
  setChecked(checked) {
103
111
  this._adapter.setNativeControlChecked(checked);
104
112
  } // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -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
 
@@ -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