@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
@@ -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
@@ -98,6 +98,12 @@
98
98
  text-align: right;
99
99
  background-color: var(--semi-color-fill-0);
100
100
  }
101
+ .semi-datepicker-footer .semi-button:first-of-type {
102
+ margin-right: 12px;
103
+ }
104
+ .semi-datepicker-footer .semi-button:nth-of-type(2) {
105
+ margin-right: 8px;
106
+ }
101
107
  .semi-datepicker-yam {
102
108
  position: absolute;
103
109
  top: 0;
@@ -705,6 +711,16 @@
705
711
  padding-left: 8px;
706
712
  text-align: left;
707
713
  }
714
+ .semi-rtl .semi-datepicker-footer .semi-button:first-of-type,
715
+ .semi-portal-rtl .semi-datepicker-footer .semi-button:first-of-type {
716
+ margin-left: 0;
717
+ margin-right: 0;
718
+ }
719
+ .semi-rtl .semi-datepicker-footer .semi-button:nth-of-type(2),
720
+ .semi-portal-rtl .semi-datepicker-footer .semi-button:nth-of-type(2) {
721
+ margin-right: 12px;
722
+ margin-left: 0;
723
+ }
708
724
  .semi-rtl .semi-datepicker-day-offsetrange-start .semi-datepicker-day-main,
709
725
  .semi-portal-rtl .semi-datepicker-day-offsetrange-start .semi-datepicker-day-main {
710
726
  border-radius: 0 var(--semi-border-radius-small) var(--semi-border-radius-small) 0;
@@ -740,12 +756,20 @@
740
756
  margin-right: 8px;
741
757
  }
742
758
  .semi-rtl .semi-datepicker-navigation .semi-icon-chevron_left,
743
- .semi-rtl .semi-datepicker-navigation .semi-icon-chevron_right, .semi-rtl .semi-datepicker-yam .semi-icon-chevron_left,
759
+ .semi-rtl .semi-datepicker-navigation .semi-icon-chevron_right,
760
+ .semi-rtl .semi-datepicker-navigation .semi-icon-double_chevron_left,
761
+ .semi-rtl .semi-datepicker-navigation .semi-icon-double_chevron_right, .semi-rtl .semi-datepicker-yam .semi-icon-chevron_left,
744
762
  .semi-rtl .semi-datepicker-yam .semi-icon-chevron_right,
763
+ .semi-rtl .semi-datepicker-yam .semi-icon-double_chevron_left,
764
+ .semi-rtl .semi-datepicker-yam .semi-icon-double_chevron_right,
745
765
  .semi-portal-rtl .semi-datepicker-navigation .semi-icon-chevron_left,
746
766
  .semi-portal-rtl .semi-datepicker-navigation .semi-icon-chevron_right,
767
+ .semi-portal-rtl .semi-datepicker-navigation .semi-icon-double_chevron_left,
768
+ .semi-portal-rtl .semi-datepicker-navigation .semi-icon-double_chevron_right,
747
769
  .semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_left,
748
- .semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_right {
770
+ .semi-portal-rtl .semi-datepicker-yam .semi-icon-chevron_right,
771
+ .semi-portal-rtl .semi-datepicker-yam .semi-icon-double_chevron_left,
772
+ .semi-portal-rtl .semi-datepicker-yam .semi-icon-double_chevron_right {
749
773
  transform: scaleX(-1);
750
774
  }
751
775
  .semi-rtl .semi-datepicker-range-input-prefix,
@@ -140,6 +140,17 @@ $module: #{$prefix}-datepicker;
140
140
  padding-bottom: $spacing-datepicker_footer-paddingBottom;
141
141
  text-align: right;
142
142
  background-color: $color-datepicker_footer-bg-default;
143
+
144
+ .#{$prefix}-button {
145
+ // cancel button
146
+ &:first-of-type {
147
+ margin-right: $spacing-datepicker_footer_cancel_button-marginRight;
148
+ }
149
+ // confirm button
150
+ &:nth-of-type(2) {
151
+ margin-right: $spacing-datepicker_footer_confirm_button-marginRight;
152
+ }
153
+ }
143
154
  }
144
155
 
145
156
  // 年月选择
@@ -201,10 +201,13 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
201
201
  * 2. set cachedSelectedValue using given dates(in needConfirm mode)
202
202
  * - directly closePanel without click confirm will set cachedSelectedValue to state value
203
203
  * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
204
- * @param {String} inputValue
205
- * @param {Date[]} dates
206
204
  */
207
- rangeTypeSideEffectsWhenClosePanel(inputValue: string, dates: Date[]): void;
205
+ rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]): void;
206
+ /**
207
+ * clear input value when selected date is not confirmed
208
+ */
209
+ needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined): void;
210
+ resetCachedSelectedValue(willUpdateDates?: Date[]): void;
208
211
  /**
209
212
  * timing to call closePanel
210
213
  * 1. click confirm button
@@ -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;
@@ -212,12 +210,10 @@ export default class DatePickerFoundation extends BaseFoundation {
212
210
  * 2. set cachedSelectedValue using given dates(in needConfirm mode)
213
211
  * - directly closePanel without click confirm will set cachedSelectedValue to state value
214
212
  * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
215
- * @param {String} inputValue
216
- * @param {Date[]} dates
217
213
  */
218
214
 
219
215
 
220
- rangeTypeSideEffectsWhenClosePanel(inputValue, dates) {
216
+ rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates) {
221
217
  if (this._isRangeType()) {
222
218
  this._adapter.setRangeInputFocus(false);
223
219
  /**
@@ -227,17 +223,36 @@ export default class DatePickerFoundation extends BaseFoundation {
227
223
 
228
224
 
229
225
  this.handleInputBlur(inputValue);
226
+ this.resetCachedSelectedValue(willUpdateDates);
227
+ }
228
+ }
229
+ /**
230
+ * clear input value when selected date is not confirmed
231
+ */
230
232
 
231
- const {
232
- value,
233
- cachedSelectedValue
234
- } = this._adapter.getStates();
235
233
 
236
- const newCachedSelectedValue = _Array$isArray(dates) && dates.length ? dates : value;
234
+ needConfirmSideEffectsWhenClosePanel(willUpdateDates) {
235
+ if (this._adapter.needConfirm() && !this._isRangeType()) {
236
+ /**
237
+ * if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
238
+ * if `` input element will show `` directly
239
+ */
240
+ this._adapter.updateInputValue(null);
237
241
 
238
- if (!_isEqual(newCachedSelectedValue, cachedSelectedValue)) {
239
- this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
240
- }
242
+ this.resetCachedSelectedValue(willUpdateDates);
243
+ }
244
+ }
245
+
246
+ resetCachedSelectedValue(willUpdateDates) {
247
+ const {
248
+ value,
249
+ cachedSelectedValue
250
+ } = this._adapter.getStates();
251
+
252
+ const newCachedSelectedValue = _Array$isArray(willUpdateDates) ? willUpdateDates : value;
253
+
254
+ if (!_isEqual(newCachedSelectedValue, cachedSelectedValue)) {
255
+ this._adapter.updateCachedSelectedValue(newCachedSelectedValue);
241
256
  }
242
257
  }
243
258
  /**
@@ -256,7 +271,14 @@ export default class DatePickerFoundation extends BaseFoundation {
256
271
 
257
272
  closePanel(e) {
258
273
  let inputValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
259
- let dates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
274
+ let dates = arguments.length > 2 ? arguments[2] : undefined;
275
+
276
+ const {
277
+ value,
278
+ cachedSelectedValue
279
+ } = this._adapter.getStates();
280
+
281
+ const willUpdateDates = isNullOrUndefined(dates) ? this._adapter.needConfirm() ? value : cachedSelectedValue : dates;
260
282
 
261
283
  if (!this._isControlledComponent('open')) {
262
284
  this._adapter.togglePanel(false);
@@ -265,7 +287,8 @@ export default class DatePickerFoundation extends BaseFoundation {
265
287
  } // range type picker, closing panel requires the following side effects
266
288
 
267
289
 
268
- this.rangeTypeSideEffectsWhenClosePanel(inputValue, dates);
290
+ this.rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates);
291
+ this.needConfirmSideEffectsWhenClosePanel(willUpdateDates);
269
292
 
270
293
  this._adapter.notifyOpenChange(false);
271
294
 
@@ -327,7 +350,8 @@ export default class DatePickerFoundation extends BaseFoundation {
327
350
  if (parsedResult && parsedResult.length) {
328
351
  this._updateValueAndInput(parsedResult, input === '');
329
352
  } else if (input === '') {
330
- this._updateValueAndInput('', true);
353
+ // if clear input, set input to `''`
354
+ this._updateValueAndInput('', true, '');
331
355
  } else {
332
356
  this._updateValueAndInput(stateValue);
333
357
  }
@@ -695,7 +719,7 @@ export default class DatePickerFoundation extends BaseFoundation {
695
719
 
696
720
  if (!this._someDateDisabled(changedDates)) {
697
721
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
698
- const isRangeTypeAndInputIncomplete = this._isRangeType() && (isNullOrUndefined(dates[0]) || isNullOrUndefined(dates[1]));
722
+ const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
699
723
  /**
700
724
  * If the input is incomplete when under control, the notifyChange is not triggered because
701
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
@@ -40,6 +40,9 @@ export default class InputFoundation extends BaseFoundation {
40
40
  }
41
41
 
42
42
  handleRangeInputClear(e) {
43
+ // prevent trigger click outside
44
+ this.stopPropagation(e);
45
+
43
46
  this._adapter.notifyRangeInputClear(e);
44
47
  }
45
48
 
@@ -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 {};
@@ -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
  }
@@ -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;
@@ -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
  }