@douyinfe/semi-foundation 2.10.0-beta.0 → 2.10.2

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 (117) hide show
  1. package/carousel/carousel.scss +4 -4
  2. package/carousel/foundation.ts +0 -2
  3. package/cascader/foundation.ts +6 -6
  4. package/checkbox/checkboxGroupFoundation.ts +2 -2
  5. package/datePicker/_utils/getDefaultPickerDate.ts +3 -3
  6. package/datePicker/_utils/parser.ts +1 -1
  7. package/datePicker/foundation.ts +4 -4
  8. package/datePicker/monthsGridFoundation.ts +11 -11
  9. package/datePicker/yearAndMonthFoundation.ts +1 -1
  10. package/form/foundation.ts +9 -5
  11. package/form/interface.ts +1 -0
  12. package/input/textareaFoundation.ts +5 -5
  13. package/inputNumber/foundation.ts +25 -9
  14. package/lib/cjs/carousel/carousel.css +4 -4
  15. package/lib/cjs/carousel/carousel.scss +4 -4
  16. package/lib/cjs/carousel/foundation.d.ts +0 -1
  17. package/lib/cjs/carousel/foundation.js +0 -3
  18. package/lib/cjs/cascader/foundation.d.ts +2 -2
  19. package/lib/cjs/cascader/foundation.js +6 -6
  20. package/lib/cjs/checkbox/checkboxGroupFoundation.d.ts +1 -1
  21. package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -2
  22. package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +2 -2
  23. package/lib/cjs/datePicker/_utils/parser.d.ts +1 -1
  24. package/lib/cjs/datePicker/_utils/parser.js +2 -2
  25. package/lib/cjs/datePicker/foundation.js +3 -3
  26. package/lib/cjs/datePicker/monthsGridFoundation.js +9 -9
  27. package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -1
  28. package/lib/cjs/datePicker/yearAndMonthFoundation.js +2 -2
  29. package/lib/cjs/form/foundation.d.ts +1 -0
  30. package/lib/cjs/form/foundation.js +9 -5
  31. package/lib/cjs/form/interface.d.ts +1 -0
  32. package/lib/cjs/input/textareaFoundation.d.ts +5 -5
  33. package/lib/cjs/inputNumber/foundation.d.ts +8 -0
  34. package/lib/cjs/inputNumber/foundation.js +20 -8
  35. package/lib/cjs/navigation/foundation.d.ts +3 -3
  36. package/lib/cjs/navigation/foundation.js +13 -13
  37. package/lib/cjs/tabs/foundation.js +2 -2
  38. package/lib/cjs/timePicker/ComboxFoundation.js +1 -1
  39. package/lib/cjs/timePicker/constants.d.ts +1 -1
  40. package/lib/cjs/timePicker/constants.js +1 -1
  41. package/lib/cjs/timePicker/foundation.js +1 -1
  42. package/lib/cjs/transfer/foundation.js +3 -3
  43. package/lib/cjs/transfer/{transferUtlls.d.ts → transferUtils.d.ts} +0 -0
  44. package/lib/cjs/transfer/{transferUtlls.js → transferUtils.js} +0 -0
  45. package/lib/cjs/tree/foundation.d.ts +2 -2
  46. package/lib/cjs/tree/foundation.js +4 -4
  47. package/lib/cjs/tree/treeUtil.js +11 -11
  48. package/lib/cjs/treeSelect/constants.d.ts +1 -1
  49. package/lib/cjs/treeSelect/constants.js +1 -1
  50. package/lib/cjs/treeSelect/foundation.d.ts +2 -2
  51. package/lib/cjs/treeSelect/foundation.js +4 -4
  52. package/lib/cjs/upload/foundation.js +9 -8
  53. package/lib/cjs/upload/utils.js +1 -1
  54. package/lib/cjs/utils/isNullOrUndefined.d.ts +1 -1
  55. package/lib/cjs/utils/isNullOrUndefined.js +1 -1
  56. package/lib/cjs/utils/object.d.ts +6 -6
  57. package/lib/cjs/utils/object.js +2 -2
  58. package/lib/es/carousel/carousel.css +4 -4
  59. package/lib/es/carousel/carousel.scss +4 -4
  60. package/lib/es/carousel/foundation.d.ts +0 -1
  61. package/lib/es/carousel/foundation.js +0 -2
  62. package/lib/es/cascader/foundation.d.ts +2 -2
  63. package/lib/es/cascader/foundation.js +6 -6
  64. package/lib/es/checkbox/checkboxGroupFoundation.d.ts +1 -1
  65. package/lib/es/checkbox/checkboxGroupFoundation.js +2 -2
  66. package/lib/es/datePicker/_utils/getDefaultPickerDate.js +3 -3
  67. package/lib/es/datePicker/_utils/parser.d.ts +1 -1
  68. package/lib/es/datePicker/_utils/parser.js +1 -1
  69. package/lib/es/datePicker/foundation.js +4 -4
  70. package/lib/es/datePicker/monthsGridFoundation.js +10 -10
  71. package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -1
  72. package/lib/es/datePicker/yearAndMonthFoundation.js +1 -1
  73. package/lib/es/form/foundation.d.ts +1 -0
  74. package/lib/es/form/foundation.js +9 -5
  75. package/lib/es/form/interface.d.ts +1 -0
  76. package/lib/es/input/textareaFoundation.d.ts +5 -5
  77. package/lib/es/inputNumber/foundation.d.ts +8 -0
  78. package/lib/es/inputNumber/foundation.js +18 -8
  79. package/lib/es/navigation/foundation.d.ts +3 -3
  80. package/lib/es/navigation/foundation.js +13 -13
  81. package/lib/es/tabs/foundation.js +2 -2
  82. package/lib/es/timePicker/ComboxFoundation.js +1 -1
  83. package/lib/es/timePicker/constants.d.ts +1 -1
  84. package/lib/es/timePicker/constants.js +1 -1
  85. package/lib/es/timePicker/foundation.js +1 -1
  86. package/lib/es/transfer/foundation.js +1 -1
  87. package/lib/es/transfer/{transferUtlls.d.ts → transferUtils.d.ts} +0 -0
  88. package/lib/es/transfer/{transferUtlls.js → transferUtils.js} +0 -0
  89. package/lib/es/tree/foundation.d.ts +2 -2
  90. package/lib/es/tree/foundation.js +4 -4
  91. package/lib/es/tree/treeUtil.js +11 -11
  92. package/lib/es/treeSelect/constants.d.ts +1 -1
  93. package/lib/es/treeSelect/constants.js +1 -1
  94. package/lib/es/treeSelect/foundation.d.ts +2 -2
  95. package/lib/es/treeSelect/foundation.js +4 -4
  96. package/lib/es/upload/foundation.js +9 -8
  97. package/lib/es/upload/utils.js +1 -1
  98. package/lib/es/utils/isNullOrUndefined.d.ts +1 -1
  99. package/lib/es/utils/isNullOrUndefined.js +1 -1
  100. package/lib/es/utils/object.d.ts +6 -6
  101. package/lib/es/utils/object.js +2 -2
  102. package/navigation/foundation.ts +12 -12
  103. package/package.json +3 -3
  104. package/tabs/foundation.ts +2 -2
  105. package/timePicker/ComboxFoundation.ts +1 -1
  106. package/timePicker/constants.ts +1 -1
  107. package/timePicker/foundation.ts +1 -1
  108. package/transfer/foundation.ts +1 -1
  109. package/transfer/{transferUtlls.ts → transferUtils.ts} +0 -0
  110. package/tree/foundation.ts +4 -4
  111. package/tree/treeUtil.ts +11 -11
  112. package/treeSelect/constants.ts +1 -1
  113. package/treeSelect/foundation.ts +4 -4
  114. package/upload/foundation.ts +9 -8
  115. package/upload/utils.ts +1 -1
  116. package/utils/isNullOrUndefined.ts +1 -1
  117. package/utils/object.ts +10 -10
@@ -381,7 +381,7 @@ $module: #{$prefix}-carousel;
381
381
  @keyframes #{$module}-content-item-keyframe-slide-in {
382
382
 
383
383
  from {
384
- transform: translateX(-100%);
384
+ transform: translateX(100%);
385
385
  }
386
386
 
387
387
  to {
@@ -396,14 +396,14 @@ $module: #{$prefix}-carousel;
396
396
  }
397
397
 
398
398
  to {
399
- transform: translateX(100%);
399
+ transform: translateX(-100%);
400
400
  }
401
401
  }
402
402
 
403
403
  @keyframes #{$module}-content-item-keyframe-slide-in-reverse {
404
404
 
405
405
  from {
406
- transform: translateX(100%);
406
+ transform: translateX(-100%);
407
407
  }
408
408
 
409
409
  to {
@@ -418,7 +418,7 @@ $module: #{$prefix}-carousel;
418
418
  }
419
419
 
420
420
  to {
421
- transform: translateX(-100%);
421
+ transform: translateX(100%);
422
422
  }
423
423
  }
424
424
 
@@ -12,11 +12,9 @@ export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any
12
12
  }
13
13
 
14
14
  class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
15
- throttleChange: any;
16
15
 
17
16
  constructor(adapter: CarouselAdapter<P, S>) {
18
17
  super({ ...adapter });
19
- this.throttleChange = throttle(this.onIndicatorChange, this.getSwitchingTime());
20
18
  }
21
19
 
22
20
  _interval = null;
@@ -409,7 +409,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
409
409
  activeKeys,
410
410
  loadingKeys,
411
411
  loading,
412
- keyEntities: keyEntitieState,
412
+ keyEntities: keyEntityState,
413
413
  selectedKeys: selectedKeysState
414
414
  } = this.getStates();
415
415
  const filterable = this._isFilterable();
@@ -472,7 +472,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
472
472
  } else if (loading) {
473
473
  // Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
474
474
  // Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
475
- updateStates.keyEntities = assign(keyEntitieState, keyEntities);
475
+ updateStates.keyEntities = assign(keyEntityState, keyEntities);
476
476
  this._adapter.updateStates(updateStates);
477
477
  return;
478
478
  } else {
@@ -729,14 +729,14 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
729
729
  const prevCheckedStatus = checkedKeys.has(key);
730
730
  // next checked status
731
731
  const curCheckedStatus = disableStrictly ?
732
- this.calcChekcedStatus(!prevCheckedStatus, key) :
732
+ this.calcCheckedStatus(!prevCheckedStatus, key) :
733
733
  !prevCheckedStatus;
734
734
  // calculate all key of nodes that are checked or half checked
735
735
  const {
736
736
  checkedKeys: curCheckedKeys,
737
737
  halfCheckedKeys: curHalfCheckedKeys
738
738
  } = disableStrictly ?
739
- this.calcNonDisabedCheckedKeys(key, curCheckedStatus) :
739
+ this.calcNonDisabledCheckedKeys(key, curCheckedStatus) :
740
740
  this.calcCheckedKeys(key, curCheckedStatus);
741
741
 
742
742
  const mergeType = calcMergeType(autoMergeValue, leafOnly);
@@ -791,7 +791,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
791
791
  this._adapter.updateStates({ inputValue: '' });
792
792
  }
793
793
 
794
- calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean) {
794
+ calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean) {
795
795
  const { keyEntities, disabledKeys } = this.getStates();
796
796
  const { checkedKeys } = this.getCopyFromState(['checkedKeys']);
797
797
  const descendantKeys = normalizeKeyList(findDescendantKeys([eventKey], keyEntities, false), keyEntities, true);
@@ -807,7 +807,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
807
807
  return calcCheckedKeys(newCheckedKeys, keyEntities);
808
808
  }
809
809
 
810
- calcChekcedStatus(targetStatus: boolean, eventKey: string) {
810
+ calcCheckedStatus(targetStatus: boolean, eventKey: string) {
811
811
  if (!targetStatus) {
812
812
  return targetStatus;
813
813
  }
@@ -7,12 +7,12 @@ export interface CheckboxGroupAdapter extends DefaultAdapter{
7
7
  notifyChange: (value: any[]) => void;
8
8
  }
9
9
  class CheckboxGroupFoundation extends BaseFoundation<CheckboxGroupAdapter> {
10
- static get checkboxGroupdefaultAdapter() {
10
+ static get checkboxGroupDefaultAdapter() {
11
11
  return {};
12
12
  }
13
13
 
14
14
  constructor(adapter: CheckboxGroupAdapter) {
15
- super({ ...CheckboxGroupFoundation.checkboxGroupdefaultAdapter, ...adapter });
15
+ super({ ...CheckboxGroupFoundation.checkboxGroupDefaultAdapter, ...adapter });
16
16
  }
17
17
 
18
18
  init() {
@@ -1,6 +1,6 @@
1
1
  import { addMonths, Locale as dateFnsLocale } from 'date-fns';
2
2
  import isValidDate from './isValidDate';
3
- import { compatiableParse } from './parser';
3
+ import { compatibleParse } from './parser';
4
4
  import isTimestamp from './isTimestamp';
5
5
 
6
6
  /**
@@ -18,7 +18,7 @@ export default function getDefaultPickerDate(options: GetDefaultPickerValueDateO
18
18
  nowDate = new Date(nowDate);
19
19
  break;
20
20
  case typeof nowDate === 'string':
21
- nowDate = compatiableParse(nowDate as string, format, undefined, dateFnsLocale);
21
+ nowDate = compatibleParse(nowDate as string, format, undefined, dateFnsLocale);
22
22
  break;
23
23
  default:
24
24
  nowDate = new Date();
@@ -32,7 +32,7 @@ export default function getDefaultPickerDate(options: GetDefaultPickerValueDateO
32
32
  nextDate = new Date(nextDate);
33
33
  break;
34
34
  case typeof nextDate === 'string':
35
- nextDate = compatiableParse(nextDate as string, format, undefined, dateFnsLocale);
35
+ nextDate = compatibleParse(nextDate as string, format, undefined, dateFnsLocale);
36
36
  break;
37
37
  default:
38
38
  nextDate = addMonths(nowDate as Date, 1);
@@ -7,7 +7,7 @@ import { isValid, parseISO, parse, Locale } from 'date-fns';
7
7
  /**
8
8
  * Parsing value to Date object
9
9
  */
10
- export function compatiableParse(
10
+ export function compatibleParse(
11
11
  value: string,
12
12
  formatToken?: string,
13
13
  baseDate?: Date,
@@ -7,7 +7,7 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
7
7
  import { isValidDate, isTimestamp } from './_utils/index';
8
8
  import isNullOrUndefined from '../utils/isNullOrUndefined';
9
9
  import { utcToZonedTime, zonedTimeToUtc } from '../utils/date-fns-extra';
10
- import { compatiableParse } from './_utils/parser';
10
+ import { compatibleParse } from './_utils/parser';
11
11
  import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
12
12
  import { strings } from './constants';
13
13
  import { strings as inputStrings } from '../input/constants';
@@ -292,7 +292,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
292
292
  if (isValidDate(value)) {
293
293
  dateObj = value as Date;
294
294
  } else if (isString(value)) {
295
- dateObj = compatiableParse(value as string, this.getProp('format'), undefined, dateFnsLocale);
295
+ dateObj = compatibleParse(value as string, this.getProp('format'), undefined, dateFnsLocale);
296
296
  } else if (isTimestamp(value)) {
297
297
  dateObj = new Date(value);
298
298
  } else {
@@ -613,7 +613,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
613
613
  case 'date':
614
614
  case 'dateTime':
615
615
  case 'month':
616
- parsedResult = input ? compatiableParse(input, formatToken, nowDate, dateFnsLocale) : '';
616
+ parsedResult = input ? compatibleParse(input, formatToken, nowDate, dateFnsLocale) : '';
617
617
  formatedInput = parsedResult && isValid(parsedResult) && this.localeFormat(parsedResult as Date, formatToken);
618
618
  if (parsedResult && formatedInput === input) {
619
619
  result = [parsedResult as Date];
@@ -626,7 +626,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
626
626
  parsedResult =
627
627
  values &&
628
628
  values.reduce((arr, cur) => {
629
- const parsedVal = cur && compatiableParse(cur, formatToken, nowDate, dateFnsLocale);
629
+ const parsedVal = cur && compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
630
630
  parsedVal && arr.push(parsedVal);
631
631
  return arr;
632
632
  }, []);
@@ -15,7 +15,7 @@ import {
15
15
  } from 'date-fns';
16
16
  import { isBefore, isValidDate, getDefaultFormatToken, getFullDateOffset } from './_utils/index';
17
17
  import { formatFullDate, WeekStartNumber } from './_utils/getMonthTable';
18
- import { compatiableParse } from './_utils/parser';
18
+ import { compatibleParse } from './_utils/parser';
19
19
  import { includes, isSet, isEqual, isFunction } from 'lodash';
20
20
  import { zonedTimeToUtc } from '../utils/date-fns-extra';
21
21
  import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
@@ -148,7 +148,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
148
148
  }
149
149
 
150
150
  initDefaultPickerValue() {
151
- const defaultPickerValue = compatiableParse(this.getProp('defaultPickerValue'));
151
+ const defaultPickerValue = compatibleParse(this.getProp('defaultPickerValue'));
152
152
 
153
153
  if (defaultPickerValue && isValidDate(defaultPickerValue)) {
154
154
  this._updatePanelDetail(strings.PANEL_TYPE_LEFT, {
@@ -600,7 +600,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
600
600
 
601
601
  const dateFormat = this.getValidDateFormat();
602
602
  // When passed to the upper layer, it is converted into a Date object to ensure that the input parameter format of initFormDefaultValue is consistent
603
- const newSelectedDates = [...newSelected].map(_dateStr => compatiableParse(_dateStr, dateFormat, undefined, dateFnsLocale));
603
+ const newSelectedDates = [...newSelected].map(_dateStr => compatibleParse(_dateStr, dateFormat, undefined, dateFnsLocale));
604
604
 
605
605
  this.handleShowDateAndTime(panelType, time);
606
606
 
@@ -628,15 +628,15 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
628
628
  _mergeDateAndTime(date: Date | string, time: Date | string) {
629
629
  const dateFnsLocale = this._adapter.getProp('dateFnsLocale');
630
630
  const dateStr = format(
631
- isValidDate(date) ? date as Date : compatiableParse(date as string, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale),
631
+ isValidDate(date) ? date as Date : compatibleParse(date as string, strings.FORMAT_FULL_DATE, undefined, dateFnsLocale),
632
632
  strings.FORMAT_FULL_DATE
633
633
  );
634
634
  const timeStr = format(
635
- isValidDate(time) ? time as Date : compatiableParse(time as string, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale),
635
+ isValidDate(time) ? time as Date : compatibleParse(time as string, strings.FORMAT_TIME_PICKER, undefined, dateFnsLocale),
636
636
  strings.FORMAT_TIME_PICKER
637
637
  );
638
638
  const timeFormat = this.getValidTimeFormat();
639
- return compatiableParse(`${dateStr} ${timeStr}`, timeFormat, undefined, dateFnsLocale);
639
+ return compatibleParse(`${dateStr} ${timeStr}`, timeFormat, undefined, dateFnsLocale);
640
640
  }
641
641
 
642
642
  handleRangeSelected(day: MonthDayInfo) {
@@ -700,8 +700,8 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
700
700
  // only notify when choose completed
701
701
  if (rangeStart || rangeEnd) {
702
702
  const [startDate, endDate] = [
703
- compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale),
704
- compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale),
703
+ compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale),
704
+ compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale),
705
705
  ];
706
706
  let date: [Date, Date] = [startDate, endDate];
707
707
 
@@ -812,7 +812,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
812
812
  // date = pickerDate.getDate();
813
813
  // } else
814
814
  if (type === 'dateTimeRange' && destRange) {
815
- const rangeDate = compatiableParse(destRange, dateFormat, undefined, dateFnsLocale);
815
+ const rangeDate = compatibleParse(destRange, dateFormat, undefined, dateFnsLocale);
816
816
  year = rangeDate.getFullYear();
817
817
  monthNo = rangeDate.getMonth();
818
818
  date = rangeDate.getDate();
@@ -859,8 +859,8 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
859
859
  const dateFormat = this.getValidDateFormat();
860
860
  // TODO: Modify a time individually
861
861
  if (rangeStart && rangeEnd) {
862
- let startDate = compatiableParse(rangeStart, dateFormat, undefined, dateFnsLocale);
863
- let endDate = compatiableParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
862
+ let startDate = compatibleParse(rangeStart, dateFormat, undefined, dateFnsLocale);
863
+ let endDate = compatibleParse(rangeEnd, dateFormat, undefined, dateFnsLocale);
864
864
  // console.log('_updateTimeInDateRange()', rangeStart, rangeEnd, startDate, endDate);
865
865
 
866
866
  if (panelType === strings.PANEL_TYPE_RIGHT) {
@@ -42,7 +42,7 @@ export interface YearScrollItem {
42
42
  disabled: boolean;
43
43
  }
44
44
 
45
- export default class YearAndMonthFoundataion extends BaseFoundation<YearAndMonthAdapter> {
45
+ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthAdapter> {
46
46
 
47
47
  constructor(adapter: YearAndMonthAdapter) {
48
48
  super({ ...adapter });
@@ -75,6 +75,10 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
75
75
  this.scrollToField = this.scrollToField.bind(this);
76
76
  }
77
77
 
78
+ init() {
79
+ this._adapter.initFormId();
80
+ }
81
+
78
82
  getField(field: string): FieldStaff | undefined {
79
83
  const targetField = this.fields.get(field);
80
84
  return targetField;
@@ -290,7 +294,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
290
294
  _getOperateFieldMap(fieldPaths?: Array<string>): Map<string, FieldStaff> {
291
295
  let targetFields = new Map();
292
296
  if (!isUndefined(fieldPaths)) {
293
- // reset or validate spcific fields
297
+ // reset or validate specific fields
294
298
  fieldPaths.forEach(path => {
295
299
  const field = this.fields.get(path);
296
300
  // may be undefined, if exists two fields like 'a[0]'、'a[1]', but user directly call reset(['a']) / validate(['a'])
@@ -396,8 +400,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
396
400
  this.updateArrayField(path, { updateKey: new Date().valueOf() });
397
401
  });
398
402
  }
399
- // When isOverrid is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values
400
- // 当isOverrid为true,传入的values中可能存在不存在的field时,直接将其同步到formState.values中
403
+ // When isOverride is true, there may be a non-existent field in the values passed in, directly synchronized to formState.values
404
+ // 当isOverride为true,传入的values中可能存在不存在的field时,直接将其同步到formState.values中
401
405
  if (isOverride) {
402
406
  this.data.values = _values;
403
407
  }
@@ -548,7 +552,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
548
552
  };
549
553
  const setTouched = (field: string, isTouched: boolean, opts: CallOpts) => {
550
554
  const fieldApi = this.fields.get(field) ? this.fields.get(field).fieldApi : undefined;
551
- // touched is boolean variable, no need to execu deepClone like setValue
555
+ // touched is boolean variable, no need to exec deepClone like setValue
552
556
  if (fieldApi) {
553
557
  fieldApi.setTouched(isTouched, opts);
554
558
  } else {
@@ -619,7 +623,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
619
623
  }
620
624
 
621
625
  getFormState(needClone = false): FormState {
622
- // NOTES:这里如果直接返回this.data,forceUpdae触发Formrerender时,通过context传下去的formState会被认为是同一个对象【应该是浅对比的原因】
626
+ // NOTES:这里如果直接返回this.data,forceUpdate 触发 Form rerender 时,通过context传下去的formState会被认为是同一个对象【应该是浅对比的原因】
623
627
  // 使用了useFormState相关的component都不会触发重新渲染。所以使用...复制一次
624
628
 
625
629
  /*
package/form/interface.ts CHANGED
@@ -20,6 +20,7 @@ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any
20
20
  getFormProps: (keys: undefined | string | Array<string>) => any;
21
21
  getAllErrorDOM: () => NodeList;
22
22
  getFieldDOM: (field: string) => Node;
23
+ initFormId: () => void;
23
24
  }
24
25
 
25
26
  export interface FormState<T extends Record<string, any> = any> {
@@ -9,7 +9,7 @@ import calculateNodeHeight from './util/calculateNodeHeight';
9
9
  import getSizingData from './util/getSizingData';
10
10
  import isEnterPress from '../utils/isEnterPress';
11
11
 
12
- export interface TextAreaDefaultAdpter {
12
+ export interface TextAreaDefaultAdapter {
13
13
  notifyChange: noopFunction;
14
14
  setValue: noopFunction;
15
15
  toggleFocusing: noopFunction;
@@ -17,18 +17,18 @@ export interface TextAreaDefaultAdpter {
17
17
  notifyBlur: noopFunction;
18
18
  notifyKeyDown: noopFunction;
19
19
  notifyEnterPress: noopFunction;
20
- toggleHovering(hoving: boolean): void;
20
+ toggleHovering(hovering: boolean): void;
21
21
  notifyClear(e: any): void;
22
22
  }
23
23
 
24
- export interface TextAreaAdpter extends Partial<DefaultAdapter>, Partial<TextAreaDefaultAdpter> {
24
+ export interface TextAreaAdapter extends Partial<DefaultAdapter>, Partial<TextAreaDefaultAdapter> {
25
25
  setMinLength(length: number): void;
26
26
  notifyPressEnter(e: any): void;
27
27
  getRef(): any;
28
28
  notifyHeightUpdate(e: any): void;
29
29
  }
30
30
 
31
- export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
31
+ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter> {
32
32
  static get textAreaDefaultAdapter() {
33
33
  return {
34
34
  notifyChange: noop,
@@ -42,7 +42,7 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdpter> {
42
42
  };
43
43
  }
44
44
 
45
- constructor(adapter: TextAreaAdpter) {
45
+ constructor(adapter: TextAreaAdapter) {
46
46
  super({
47
47
  ...TextAreaFoundation.textAreaDefaultAdapter,
48
48
  ...adapter
@@ -4,7 +4,7 @@
4
4
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
5
5
  import keyCode from '../utils/keyCode';
6
6
  import { numbers } from './constants';
7
- import { toNumber, toString, get } from 'lodash';
7
+ import { toNumber, toString, get, isString } from 'lodash';
8
8
  import { minus as numberMinus } from '../utils/number';
9
9
 
10
10
  export interface InputNumberAdapter extends DefaultAdapter {
@@ -26,6 +26,14 @@ export interface InputNumberAdapter extends DefaultAdapter {
26
26
  restoreCursor: (str?: string) => boolean;
27
27
  fixCaret: (start: number, end: number) => void;
28
28
  setClickUpOrDown: (clicked: boolean) => void;
29
+ updateStates: (states: BaseInputNumberState, callback?: () => void) => void;
30
+ }
31
+
32
+ export interface BaseInputNumberState {
33
+ value?: number | string;
34
+ number?: number | null;
35
+ focusing?: boolean;
36
+ hovering?: boolean;
29
37
  }
30
38
 
31
39
  class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
@@ -207,9 +215,9 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
207
215
  if (code === keyCode.UP || code === keyCode.DOWN) {
208
216
  this._adapter.setClickUpOrDown(true);
209
217
  this._adapter.recordCursorPosition();
210
- const formatedVal = code === keyCode.UP ? this.add() : this.minus();
218
+ const formattedVal = code === keyCode.UP ? this.add() : this.minus();
211
219
 
212
- this._doInput(formatedVal, event, () => {
220
+ this._doInput(formattedVal, event, () => {
213
221
  this._adapter.restoreCursor();
214
222
  });
215
223
 
@@ -360,17 +368,21 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
360
368
  const { defaultValue, value } = this.getProps();
361
369
 
362
370
  const propsValue = this._isControlledComponent('value') ? value : defaultValue;
363
- const tmpNumer = this.doParse(toString(propsValue), false, true, true);
371
+ const tmpNumber = this.doParse(toString(propsValue), false, true, true);
364
372
 
365
373
  let number = null;
366
- if (typeof tmpNumer === 'number' && !isNaN(tmpNumer)) {
367
- number = tmpNumer;
374
+ if (typeof tmpNumber === 'number' && !isNaN(tmpNumber)) {
375
+ number = tmpNumber;
368
376
  }
369
377
 
370
- const formatedValue = typeof number === 'number' ? this.doFormat(number, true) : '';
378
+ const formattedValue = typeof number === 'number' ? this.doFormat(number, true) : '';
371
379
 
372
380
  this._adapter.setNumber(number);
373
- this._adapter.setValue(formatedValue);
381
+ this._adapter.setValue(formattedValue);
382
+
383
+ if (isString(formattedValue) && formattedValue !== String(propsValue)) {
384
+ this.notifyChange(formattedValue, null);
385
+ }
374
386
  }
375
387
 
376
388
  add(step?: number, event?: any): string {
@@ -432,7 +444,7 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
432
444
 
433
445
  _adjustPrec(num: string | number) {
434
446
  const precision = this.getProp('precision');
435
- if (typeof precision === 'number' && num !== '') {
447
+ if (typeof precision === 'number' && num !== '' && num !== null && !Number.isNaN(Number(num))) {
436
448
  num = Number(num).toFixed(precision);
437
449
  }
438
450
  return toString(num);
@@ -616,6 +628,10 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
616
628
  this._adapter.notifyNumberChange(value, e);
617
629
  }
618
630
  }
631
+
632
+ updateStates(states: BaseInputNumberState, callback?: () => void) {
633
+ this._adapter.updateStates(states, callback);
634
+ }
619
635
  }
620
636
 
621
637
  export default InputNumberFoundation;
@@ -273,7 +273,7 @@
273
273
 
274
274
  @keyframes semi-carousel-content-item-keyframe-slide-in {
275
275
  from {
276
- transform: translateX(-100%);
276
+ transform: translateX(100%);
277
277
  }
278
278
  to {
279
279
  transform: translateX(0);
@@ -284,12 +284,12 @@
284
284
  transform: translateX(0);
285
285
  }
286
286
  to {
287
- transform: translateX(100%);
287
+ transform: translateX(-100%);
288
288
  }
289
289
  }
290
290
  @keyframes semi-carousel-content-item-keyframe-slide-in-reverse {
291
291
  from {
292
- transform: translateX(100%);
292
+ transform: translateX(-100%);
293
293
  }
294
294
  to {
295
295
  transform: translateX(0);
@@ -300,7 +300,7 @@
300
300
  transform: translateX(0);
301
301
  }
302
302
  to {
303
- transform: translateX(-100%);
303
+ transform: translateX(100%);
304
304
  }
305
305
  }
306
306
  .semi-rtl .semi-carousel,
@@ -381,7 +381,7 @@ $module: #{$prefix}-carousel;
381
381
  @keyframes #{$module}-content-item-keyframe-slide-in {
382
382
 
383
383
  from {
384
- transform: translateX(-100%);
384
+ transform: translateX(100%);
385
385
  }
386
386
 
387
387
  to {
@@ -396,14 +396,14 @@ $module: #{$prefix}-carousel;
396
396
  }
397
397
 
398
398
  to {
399
- transform: translateX(100%);
399
+ transform: translateX(-100%);
400
400
  }
401
401
  }
402
402
 
403
403
  @keyframes #{$module}-content-item-keyframe-slide-in-reverse {
404
404
 
405
405
  from {
406
- transform: translateX(100%);
406
+ transform: translateX(-100%);
407
407
  }
408
408
 
409
409
  to {
@@ -418,7 +418,7 @@ $module: #{$prefix}-carousel;
418
418
  }
419
419
 
420
420
  to {
421
- transform: translateX(-100%);
421
+ transform: translateX(100%);
422
422
  }
423
423
  }
424
424
 
@@ -7,7 +7,6 @@ export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any
7
7
  setIsInit: (isInit: boolean) => void;
8
8
  }
9
9
  declare class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
10
- throttleChange: any;
11
10
  constructor(adapter: CarouselAdapter<P, S>);
12
11
  _interval: any;
13
12
  play(interval: number): void;
@@ -14,8 +14,6 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
14
14
 
15
15
  var _setInterval2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-interval"));
16
16
 
17
- var _throttle2 = _interopRequireDefault(require("lodash/throttle"));
18
-
19
17
  var _get2 = _interopRequireDefault(require("lodash/get"));
20
18
 
21
19
  var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
@@ -28,7 +26,6 @@ class CarouselFoundation extends _foundation.default {
28
26
  constructor(adapter) {
29
27
  super((0, _assign.default)({}, adapter));
30
28
  this._interval = null;
31
- this.throttleChange = (0, _throttle2.default)(this.onIndicatorChange, this.getSwitchingTime());
32
29
  }
33
30
 
34
31
  play(interval) {
@@ -204,7 +204,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
204
204
  notifyIfLoadData(item: BasicEntity | BasicData): void;
205
205
  handleSingleSelect(e: any, item: BasicEntity | BasicData): void;
206
206
  _handleMultipleSelect(item: BasicEntity | BasicData): void;
207
- calcNonDisabedCheckedKeys(eventKey: string, targetStatus: boolean): {
207
+ calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean): {
208
208
  /**
209
209
  * The typical scenario is: suppose we select the 0-0 node, at this time
210
210
  * selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
@@ -219,7 +219,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
219
219
  checkedKeys: Set<string>;
220
220
  halfCheckedKeys: Set<any>;
221
221
  };
222
- calcChekcedStatus(targetStatus: boolean, eventKey: string): boolean;
222
+ calcCheckedStatus(targetStatus: boolean, eventKey: string): boolean;
223
223
  _notifySelect(keys: Set<string>): void;
224
224
  /**
225
225
  * calculate all key of nodes that are checked or half checked
@@ -336,7 +336,7 @@ class CascaderFoundation extends _foundation.default {
336
336
  activeKeys,
337
337
  loadingKeys,
338
338
  loading,
339
- keyEntities: keyEntitieState,
339
+ keyEntities: keyEntityState,
340
340
  selectedKeys: selectedKeysState
341
341
  } = this.getStates();
342
342
 
@@ -406,7 +406,7 @@ class CascaderFoundation extends _foundation.default {
406
406
  } else if (loading) {
407
407
  // Use assign to avoid overwriting the'not-exist- * 'property of keyEntities after asynchronous loading
408
408
  // Overwriting'not-exist- * 'will cause selectionContent to be emptied unexpectedly when clicking on a dropDown item
409
- updateStates.keyEntities = (0, _assign3.default)(keyEntitieState, keyEntities);
409
+ updateStates.keyEntities = (0, _assign3.default)(keyEntityState, keyEntities);
410
410
 
411
411
  this._adapter.updateStates(updateStates);
412
412
 
@@ -760,12 +760,12 @@ class CascaderFoundation extends _foundation.default {
760
760
 
761
761
  const prevCheckedStatus = checkedKeys.has(key); // next checked status
762
762
 
763
- const curCheckedStatus = disableStrictly ? this.calcChekcedStatus(!prevCheckedStatus, key) : !prevCheckedStatus; // calculate all key of nodes that are checked or half checked
763
+ const curCheckedStatus = disableStrictly ? this.calcCheckedStatus(!prevCheckedStatus, key) : !prevCheckedStatus; // calculate all key of nodes that are checked or half checked
764
764
 
765
765
  const {
766
766
  checkedKeys: curCheckedKeys,
767
767
  halfCheckedKeys: curHalfCheckedKeys
768
- } = disableStrictly ? this.calcNonDisabedCheckedKeys(key, curCheckedStatus) : this.calcCheckedKeys(key, curCheckedStatus);
768
+ } = disableStrictly ? this.calcNonDisabledCheckedKeys(key, curCheckedStatus) : this.calcCheckedKeys(key, curCheckedStatus);
769
769
  const mergeType = (0, _util.calcMergeType)(autoMergeValue, leafOnly);
770
770
  const isLeafOnlyMerge = mergeType === _constants.strings.LEAF_ONLY_MERGE_TYPE;
771
771
  const isNoneMerge = mergeType === _constants.strings.NONE_MERGE_TYPE;
@@ -821,7 +821,7 @@ class CascaderFoundation extends _foundation.default {
821
821
  });
822
822
  }
823
823
 
824
- calcNonDisabedCheckedKeys(eventKey, targetStatus) {
824
+ calcNonDisabledCheckedKeys(eventKey, targetStatus) {
825
825
  const {
826
826
  keyEntities,
827
827
  disabledKeys
@@ -841,7 +841,7 @@ class CascaderFoundation extends _foundation.default {
841
841
  return (0, _treeUtil.calcCheckedKeys)(newCheckedKeys, keyEntities);
842
842
  }
843
843
 
844
- calcChekcedStatus(targetStatus, eventKey) {
844
+ calcCheckedStatus(targetStatus, eventKey) {
845
845
  if (!targetStatus) {
846
846
  return targetStatus;
847
847
  }
@@ -5,7 +5,7 @@ export interface CheckboxGroupAdapter extends DefaultAdapter {
5
5
  notifyChange: (value: any[]) => void;
6
6
  }
7
7
  declare class CheckboxGroupFoundation extends BaseFoundation<CheckboxGroupAdapter> {
8
- static get checkboxGroupdefaultAdapter(): {};
8
+ static get checkboxGroupDefaultAdapter(): {};
9
9
  constructor(adapter: CheckboxGroupAdapter);
10
10
  init(): void;
11
11
  notifyChange(value: any[]): void;
@@ -21,12 +21,12 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
21
21
  var _warning = _interopRequireDefault(require("../utils/warning"));
22
22
 
23
23
  class CheckboxGroupFoundation extends _foundation.default {
24
- static get checkboxGroupdefaultAdapter() {
24
+ static get checkboxGroupDefaultAdapter() {
25
25
  return {};
26
26
  }
27
27
 
28
28
  constructor(adapter) {
29
- super((0, _assign.default)((0, _assign.default)({}, CheckboxGroupFoundation.checkboxGroupdefaultAdapter), adapter));
29
+ super((0, _assign.default)((0, _assign.default)({}, CheckboxGroupFoundation.checkboxGroupDefaultAdapter), adapter));
30
30
  }
31
31
 
32
32
  init() {