@douyinfe/semi-foundation 2.31.2 → 2.32.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 (67) hide show
  1. package/cascader/foundation.ts +8 -1
  2. package/datePicker/_utils/getDefaultFormatToken.ts +1 -0
  3. package/datePicker/_utils/getInsetInputFormatToken.ts +1 -0
  4. package/datePicker/_utils/getInsetInputValueFromInsetInputStr.ts +1 -0
  5. package/datePicker/constants.ts +1 -1
  6. package/datePicker/datePicker.scss +33 -6
  7. package/datePicker/foundation.ts +132 -74
  8. package/datePicker/inputFoundation.ts +8 -2
  9. package/datePicker/variables.scss +6 -4
  10. package/datePicker/yearAndMonthFoundation.ts +65 -18
  11. package/lib/cjs/cascader/foundation.d.ts +2 -0
  12. package/lib/cjs/datePicker/_utils/getDefaultFormatToken.d.ts +1 -0
  13. package/lib/cjs/datePicker/_utils/getDefaultFormatToken.js +2 -1
  14. package/lib/cjs/datePicker/_utils/getInsetInputFormatToken.js +1 -0
  15. package/lib/cjs/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -0
  16. package/lib/cjs/datePicker/constants.d.ts +1 -1
  17. package/lib/cjs/datePicker/constants.js +1 -1
  18. package/lib/cjs/datePicker/datePicker.css +29 -11
  19. package/lib/cjs/datePicker/datePicker.scss +33 -6
  20. package/lib/cjs/datePicker/foundation.d.ts +34 -6
  21. package/lib/cjs/datePicker/foundation.js +145 -69
  22. package/lib/cjs/datePicker/inputFoundation.d.ts +1 -1
  23. package/lib/cjs/datePicker/inputFoundation.js +13 -1
  24. package/lib/cjs/datePicker/variables.scss +6 -4
  25. package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +66 -13
  26. package/lib/cjs/datePicker/yearAndMonthFoundation.js +55 -14
  27. package/lib/cjs/modal/modal.css +1 -0
  28. package/lib/cjs/modal/modal.scss +1 -0
  29. package/lib/cjs/modal/variables.scss +1 -0
  30. package/lib/cjs/sideSheet/sideSheet.css +10 -0
  31. package/lib/cjs/sideSheet/sideSheet.scss +15 -0
  32. package/lib/cjs/sideSheet/variables.scss +6 -0
  33. package/lib/cjs/switch/foundation.js +0 -3
  34. package/lib/cjs/treeSelect/foundation.d.ts +3 -0
  35. package/lib/cjs/treeSelect/foundation.js +3 -2
  36. package/lib/es/cascader/foundation.d.ts +2 -0
  37. package/lib/es/datePicker/_utils/getDefaultFormatToken.d.ts +1 -0
  38. package/lib/es/datePicker/_utils/getDefaultFormatToken.js +2 -1
  39. package/lib/es/datePicker/_utils/getInsetInputFormatToken.js +1 -0
  40. package/lib/es/datePicker/_utils/getInsetInputValueFromInsetInputStr.js +1 -0
  41. package/lib/es/datePicker/constants.d.ts +1 -1
  42. package/lib/es/datePicker/constants.js +1 -1
  43. package/lib/es/datePicker/datePicker.css +29 -11
  44. package/lib/es/datePicker/datePicker.scss +33 -6
  45. package/lib/es/datePicker/foundation.d.ts +34 -6
  46. package/lib/es/datePicker/foundation.js +145 -69
  47. package/lib/es/datePicker/inputFoundation.d.ts +1 -1
  48. package/lib/es/datePicker/inputFoundation.js +13 -1
  49. package/lib/es/datePicker/variables.scss +6 -4
  50. package/lib/es/datePicker/yearAndMonthFoundation.d.ts +66 -13
  51. package/lib/es/datePicker/yearAndMonthFoundation.js +58 -14
  52. package/lib/es/modal/modal.css +1 -0
  53. package/lib/es/modal/modal.scss +1 -0
  54. package/lib/es/modal/variables.scss +1 -0
  55. package/lib/es/sideSheet/sideSheet.css +10 -0
  56. package/lib/es/sideSheet/sideSheet.scss +15 -0
  57. package/lib/es/sideSheet/variables.scss +6 -0
  58. package/lib/es/switch/foundation.js +0 -3
  59. package/lib/es/treeSelect/foundation.d.ts +3 -0
  60. package/lib/es/treeSelect/foundation.js +3 -2
  61. package/modal/modal.scss +1 -0
  62. package/modal/variables.scss +1 -0
  63. package/package.json +2 -2
  64. package/sideSheet/sideSheet.scss +15 -0
  65. package/sideSheet/variables.scss +6 -0
  66. package/switch/foundation.ts +2 -3
  67. package/treeSelect/foundation.ts +6 -3
@@ -1,11 +1,17 @@
1
1
  import { setMonth, setYear } from 'date-fns';
2
2
  import BaseFoundation, { DefaultAdapter } from '../base/foundation';
3
3
  import { PresetPosition } from './foundation';
4
+ import { ArrayElement } from '../utils/type';
5
+ import { strings } from './constants';
6
+ import { PanelType } from './monthsGridFoundation';
7
+ import { cloneDeep } from 'lodash';
8
+
9
+ type Type = ArrayElement<typeof strings.TYPE_SET>;
4
10
 
5
11
  export interface YearAndMonthFoundationProps {
6
- currentYear?: number;
7
- currentMonth?: number;
8
- onSelect?: (obj: { currentMonth: number; currentYear: number }) => void;
12
+ currentYear: { left: number; right: number };
13
+ currentMonth: { left: number; right: number };
14
+ onSelect?: (obj: { currentMonth: { left: number; right: number }; currentYear: { left: number; right: number } }) => void;
9
15
  onBackToMain?: () => void;
10
16
  locale?: any;
11
17
  localeCode?: string;
@@ -17,20 +23,23 @@ export interface YearAndMonthFoundationProps {
17
23
  presetPosition?: PresetPosition;
18
24
  renderQuickControls?: any;
19
25
  renderDateInput?: any;
26
+ type?: Type;
20
27
  yearAndMonthOpts?: any
21
28
  }
22
29
 
23
30
  export interface YearAndMonthFoundationState {
24
31
  years: Array<{ value: number; year: number }>;
25
32
  months: Array<{ value: number; month: number }>;
26
- currentYear: number;
27
- currentMonth: number
33
+ currentYear: { left: number; right: number };
34
+ currentMonth: { left: number; right: number }
28
35
  }
29
36
  export interface YearAndMonthAdapter extends DefaultAdapter<YearAndMonthFoundationProps, YearAndMonthFoundationState> {
30
- setCurrentYear: (currentYear: number, cb?: () => void) => void;
31
- setCurrentMonth: (currentMonth: number) => void;
32
- notifySelectYear: (year: number) => void;
33
- notifySelectMonth: (month: number) => void;
37
+ setCurrentYear: (currentYear: { left: number; right: number }, cb?: () => void) => void;
38
+ setCurrentMonth: (currentMonth: { left: number; right: number }) => void;
39
+ setCurrentYearAndMonth: (currentYear: { left: number; right: number }, currentMonth: { left: number; right: number }) => void;
40
+ notifySelectYear: (year: { left: number; right: number }) => void;
41
+ notifySelectMonth: (month: { left: number; right: number }) => void;
42
+ notifySelectYearAndMonth: (year: { left: number; right: number }, month: { left: number; right: number }) => void;
34
43
  notifyBackToMain: () => void
35
44
  }
36
45
 
@@ -60,14 +69,47 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
60
69
  // eslint-disable-next-line @typescript-eslint/no-empty-function
61
70
  destroy() {}
62
71
 
63
- selectYear(item: YearScrollItem) {
64
- const year = item.value;
65
- this._adapter.setCurrentYear(year, () => this.autoSelectMonth(item));
72
+ selectYear(item: YearScrollItem, panelType?: PanelType) {
73
+ // const year = item.value;
74
+ const { currentYear, currentMonth } = this.getStates();
75
+ const { type } = this.getProps();
76
+ const left = strings.PANEL_TYPE_LEFT;
77
+ const right = strings.PANEL_TYPE_RIGHT;
78
+
79
+ const year = cloneDeep(currentYear);
80
+ year[panelType] = item.value;
81
+
82
+ // make sure the right panel time is always less than the left panel time
83
+ if (type === 'monthRange') {
84
+ const isSameYearIllegalDate = year[left] === year[right] && currentMonth[left] > currentMonth[right];
85
+ if ((panelType === left && item.value > year[right]) || (panelType === left && isSameYearIllegalDate)) {
86
+ // 1. select left year and left year > right year
87
+ // 2. select left year, left year = right year, but left date > right date
88
+ year[right] = item.value + 1;
89
+ } else if (panelType === right && isSameYearIllegalDate) {
90
+ // 1. select right year, left year = right year, but left date > right date
91
+ year[left] = item.value - 1;
92
+ }
93
+ }
94
+
95
+ this._adapter.setCurrentYear(year, () => this.autoSelectMonth(item, panelType, year));
66
96
  this._adapter.notifySelectYear(year);
67
97
  }
68
98
 
69
- selectMonth(item: MonthScrollItem) {
70
- const { month } = item;
99
+ selectMonth(item: MonthScrollItem, panelType?: PanelType) {
100
+ const { currentMonth, currentYear } = this.getStates();
101
+ const { type } = this.getProps();
102
+ const left = strings.PANEL_TYPE_LEFT;
103
+ const right = strings.PANEL_TYPE_RIGHT;
104
+
105
+ const month = cloneDeep(currentMonth);
106
+ month[panelType] = item.month;
107
+
108
+ // make sure the right panel time is always less than the left panel time
109
+ if (type === 'monthRange' && panelType === left && currentYear[left] === currentYear[right] && item.value > month[right]) {
110
+ month[right] = item.month + 1;
111
+ }
112
+
71
113
  this._adapter.setCurrentMonth(month);
72
114
  this._adapter.notifySelectMonth(month);
73
115
  }
@@ -75,14 +117,14 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
75
117
  /**
76
118
  * After selecting a year, if the currentMonth is disabled, automatically select a non-disabled month
77
119
  */
78
- autoSelectMonth(item: YearScrollItem) {
120
+ autoSelectMonth(item: YearScrollItem, panelType: PanelType, year: { left: number; right: number }) {
79
121
  const { disabledDate, locale } = this._adapter.getProps();
80
122
  const { months, currentMonth } = this._adapter.getStates();
81
123
 
82
124
  const currentDate = setYear(Date.now(), item.year);
83
- const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth - 1));
125
+ const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth[panelType] - 1));
84
126
  if (isCurrentMonthDisabled) {
85
- const currentIndex = months.findIndex(({ month }) => month === currentMonth);
127
+ const currentIndex = months.findIndex(({ month }) => month === currentMonth[panelType]);
86
128
  let validMonth: typeof months[number];
87
129
  // First look in the back, if you can't find it in the back, then look in the front
88
130
  validMonth = months.slice(currentIndex).find(({ month }) => !disabledDate(setMonth(currentDate, month - 1)));
@@ -90,7 +132,12 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
90
132
  validMonth = months.slice(0, currentIndex).find(({ month }) => !disabledDate(setMonth(currentDate, month - 1)));
91
133
  }
92
134
  if (validMonth) {
93
- this.selectMonth({ month: validMonth.month, value: locale.fullMonths[validMonth.month], disabled: false });
135
+ const month = cloneDeep(currentMonth);
136
+ month[panelType] = validMonth.month;
137
+
138
+ // change year and month same time
139
+ this._adapter.setCurrentYearAndMonth(year, month);
140
+ this._adapter.notifySelectYearAndMonth(year, month);
94
141
  }
95
142
  }
96
143
  }
@@ -47,8 +47,10 @@ export interface BasicTriggerRenderProps {
47
47
  * should call this function when the value of the Input component
48
48
  * customized by triggerRender is updated to synchronize the state
49
49
  * with Cascader. */
50
+ onSearch: (inputValue: string) => void;
50
51
  onChange: (inputValue: string) => void;
51
52
  onClear: (e: any) => void;
53
+ onRemove: (key: string) => void;
52
54
  }
53
55
  export interface BasicScrollPanelProps {
54
56
  panelIndex: number;
@@ -4,6 +4,7 @@ declare const getDefaultFormatToken: (type: string) => {
4
4
  readonly dateRange: "yyyy-MM-dd";
5
5
  readonly dateTimeRange: "yyyy-MM-dd HH:mm:ss";
6
6
  readonly month: "yyyy-MM";
7
+ readonly monthRange: "yyyy-MM";
7
8
  };
8
9
  export declare function getDefaultFormatTokenByType(type: string): any;
9
10
  export default getDefaultFormatToken;
@@ -13,7 +13,8 @@ const defaultFormatTokens = {
13
13
  dateTime: _constants.strings.FORMAT_DATE_TIME,
14
14
  dateRange: _constants.strings.FORMAT_FULL_DATE,
15
15
  dateTimeRange: _constants.strings.FORMAT_DATE_TIME,
16
- month: _constants.strings.FORMAT_YEAR_MONTH
16
+ month: _constants.strings.FORMAT_YEAR_MONTH,
17
+ monthRange: _constants.strings.FORMAT_YEAR_MONTH
17
18
  };
18
19
 
19
20
  const getDefaultFormatToken = type => defaultFormatTokens;
@@ -41,6 +41,7 @@ function getInsetInputFormatToken(options) {
41
41
 
42
42
  case 'date':
43
43
  case 'month':
44
+ case 'monthRange':
44
45
  case 'dateRange':
45
46
  default:
46
47
  const dateResult = dateReg.exec(format);
@@ -43,6 +43,7 @@ function getInsetInputValueFromInsetInputStr(options) {
43
43
  switch (type) {
44
44
  case 'date':
45
45
  case 'month':
46
+ case 'monthRange':
46
47
  insetInputValue.monthLeft.dateInput = inputValue;
47
48
  break;
48
49
 
@@ -35,7 +35,7 @@ declare const strings: {
35
35
  readonly DEFAULT_SEPARATOR_MULTIPLE: ",";
36
36
  readonly DEFAULT_SEPARATOR_RANGE: " ~ ";
37
37
  readonly SIZE_SET: readonly ["small", "default", "large"];
38
- readonly TYPE_SET: readonly ["date", "dateRange", "year", "month", "dateTime", "dateTimeRange"];
38
+ readonly TYPE_SET: readonly ["date", "dateRange", "year", "month", "monthRange", "dateTime", "dateTimeRange"];
39
39
  readonly PRESET_POSITION_SET: readonly ["left", "right", "top", "bottom"];
40
40
  readonly DENSITY_SET: readonly ["default", "compact"];
41
41
  readonly PANEL_TYPE_LEFT: "left";
@@ -51,7 +51,7 @@ const strings = Object.assign({
51
51
  DEFAULT_SEPARATOR_MULTIPLE: ',',
52
52
  DEFAULT_SEPARATOR_RANGE: ' ~ ',
53
53
  SIZE_SET: ['small', 'default', 'large'],
54
- TYPE_SET: ['date', 'dateRange', 'year', 'month', 'dateTime', 'dateTimeRange'],
54
+ TYPE_SET: ['date', 'dateRange', 'year', 'month', 'monthRange', 'dateTime', 'dateTimeRange'],
55
55
  PRESET_POSITION_SET: ['left', 'right', 'top', 'bottom'],
56
56
  DENSITY_SET: ['default', 'compact'],
57
57
  PANEL_TYPE_LEFT: 'left',
@@ -118,6 +118,15 @@
118
118
  .semi-datepicker-panel-yam {
119
119
  max-width: 484px;
120
120
  }
121
+ .semi-datepicker-panel-yam[x-type=monthRange] {
122
+ max-width: 584px;
123
+ }
124
+ .semi-datepicker-panel-yam .semi-datepicker-yearmonth-body {
125
+ display: flex;
126
+ }
127
+ .semi-datepicker-panel-yam .semi-datepicker-yearmonth-body .semi-scrolllist:nth-child(2) {
128
+ border-left: 1px solid var(--semi-color-border);
129
+ }
121
130
  .semi-datepicker-panel-yam .semi-scrolllist {
122
131
  box-shadow: none;
123
132
  height: 266px;
@@ -132,10 +141,7 @@
132
141
  padding: 0;
133
142
  overflow: hidden;
134
143
  }
135
- .semi-datepicker-panel-yam .semi-scrolllist-body .semi-scrolllist-item-wheel {
136
- border: none;
137
- }
138
- .semi-datepicker-panel-yam .semi-scrolllist-body .semi-scrolllist-item {
144
+ .semi-datepicker-panel-yam .semi-scrolllist-body .semi-scrolllist-item-wheel:not(#neverExistElement) {
139
145
  border: none;
140
146
  }
141
147
  .semi-datepicker-footer {
@@ -456,16 +462,16 @@
456
462
  .semi-datepicker-quick-control-top-month-content, .semi-datepicker-quick-control-bottom-month-content {
457
463
  box-sizing: border-box;
458
464
  display: grid;
459
- grid-template-columns: repeat(2, minmax(65.5px, 73px));
465
+ grid-template-columns: repeat(2, minmax(51px, 58.5px));
460
466
  grid-gap: 8px;
461
467
  align-content: flex-start;
462
468
  padding: 8px 20px;
463
469
  }
464
470
  .semi-datepicker-quick-control-top-month-content-item, .semi-datepicker-quick-control-bottom-month-content-item {
465
- max-width: 73px;
471
+ max-width: 58.5px;
466
472
  }
467
473
  .semi-datepicker-quick-control-top-month-content-item-ellipsis, .semi-datepicker-quick-control-bottom-month-content-item-ellipsis {
468
- max-width: 57px;
474
+ max-width: 42.5px;
469
475
  color: var(--semi-color-primary);
470
476
  }
471
477
  .semi-datepicker-quick-control-month {
@@ -555,7 +561,10 @@
555
561
  width: 568px;
556
562
  }
557
563
  .semi-datepicker-inset-input-wrapper[x-type=month] {
558
- width: 204px;
564
+ width: 165px;
565
+ }
566
+ .semi-datepicker-inset-input-wrapper[x-type=monthRange] {
567
+ width: 331px;
559
568
  }
560
569
  .semi-datepicker-inset-input-wrapper .semi-input-wrapper {
561
570
  flex: 1;
@@ -585,6 +594,9 @@
585
594
  .semi-datepicker-range-input:active {
586
595
  border-color: transparent;
587
596
  }
597
+ .semi-datepicker-range-input .semi-datepicker-monthRange-input {
598
+ background-color: transparent;
599
+ }
588
600
  .semi-datepicker-range-input-wrapper {
589
601
  box-sizing: border-box;
590
602
  background-color: transparent;
@@ -754,6 +766,12 @@
754
766
  height: 48px;
755
767
  padding: 12px;
756
768
  }
769
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yearmonth-body {
770
+ display: flex;
771
+ }
772
+ .semi-datepicker-compact .semi-datepicker-month-grid .semi-datepicker-yearmonth-body .semi-scrolllist:nth-child(2) {
773
+ border: 1px solid var(--semi-color-border);
774
+ }
757
775
  .semi-datepicker-compact .semi-datepicker-month-grid .semi-scrolllist {
758
776
  font-size: 12px;
759
777
  line-height: 16px;
@@ -955,16 +973,16 @@
955
973
  }
956
974
  .semi-datepicker-compact .semi-datepicker-quick-control-top-month-content, .semi-datepicker-compact .semi-datepicker-quick-control-bottom-month-content {
957
975
  display: grid;
958
- grid-template-columns: repeat(2, minmax(75.5px, 83px));
976
+ grid-template-columns: repeat(2, minmax(61px, 68.5px));
959
977
  grid-gap: 8px;
960
978
  align-content: flex-start;
961
979
  padding: 8px 10px;
962
980
  }
963
981
  .semi-datepicker-compact .semi-datepicker-quick-control-top-month-content-item, .semi-datepicker-compact .semi-datepicker-quick-control-bottom-month-content-item {
964
- max-width: 83px;
982
+ max-width: 68.5px;
965
983
  }
966
984
  .semi-datepicker-compact .semi-datepicker-quick-control-top-month-content-item-ellipsis, .semi-datepicker-compact .semi-datepicker-quick-control-bottom-month-content-item-ellipsis {
967
- max-width: 67px;
985
+ max-width: 52.5px;
968
986
  font-size: 12px;
969
987
  color: var(--semi-color-primary);
970
988
  }
@@ -169,11 +169,23 @@ $module-list: #{$prefix}-scrolllist;
169
169
  }
170
170
 
171
171
  // 年月选择器
172
-
173
172
  &-panel-yam {
174
173
  // add left or right preset panel to panel yam, max-width will be bigger
175
174
  max-width: $width-datepicker_monthPanel_max + $width-datepicker_presetPanel_left_and_right;
176
175
 
176
+ &[x-type="monthRange"] {
177
+ max-width: $width-datepicker_monthRangePanel_max + $width-datepicker_presetPanel_left_and_right;
178
+ }
179
+
180
+ .#{$module}-yearmonth-body {
181
+ display: flex;
182
+
183
+ .#{$prefix}-scrolllist:nth-child(2) {
184
+ border-left: 1px solid var(--semi-color-border);
185
+
186
+ }
187
+ }
188
+
177
189
  .#{$prefix}-scrolllist {
178
190
  box-shadow: none;
179
191
  height: $height-datepicker_panel_yam_scrolllist;
@@ -196,13 +208,14 @@ $module-list: #{$prefix}-scrolllist;
196
208
  padding: 0;
197
209
  overflow: hidden;
198
210
 
199
- .#{$prefix}-scrolllist-item-wheel {
211
+ .#{$prefix}-scrolllist-item-wheel:not(#neverExistElement) {
212
+ // equal to #{$prefix}-scrolllist-item-wheel, add [:not] selector only to increase selector priority
200
213
  border: none;
201
214
  }
202
215
 
203
- .#{$prefix}-scrolllist-item {
204
- border: none;
205
- }
216
+ // .#{$prefix}-scrolllist-item {
217
+ // border: none;
218
+ // }
206
219
  }
207
220
  }
208
221
  }
@@ -832,6 +845,9 @@ $module-list: #{$prefix}-scrolllist;
832
845
  &[x-type=month] {
833
846
  width: $width-datepicker_insetInput_month_type_wrapper;
834
847
  }
848
+ &[x-type=monthRange] {
849
+ width: $width-datepicker_insetInput_month_range_type_wrapper;
850
+ }
835
851
 
836
852
  .#{$prefix}-input-wrapper {
837
853
  flex: 1;
@@ -869,7 +885,9 @@ $module-list: #{$prefix}-scrolllist;
869
885
  border-color: $color-datepicker_range_trigger-border-active ;
870
886
  }
871
887
 
872
-
888
+ .#{$module}-monthRange-input {
889
+ background-color: transparent;
890
+ }
873
891
 
874
892
  &-wrapper {
875
893
  box-sizing: border-box;
@@ -1108,6 +1126,15 @@ $module-list: #{$prefix}-scrolllist;
1108
1126
  padding: $spacing-datepicker_yam_panel_header_compact-padding;
1109
1127
  }
1110
1128
 
1129
+ .#{$module}-yearmonth-body {
1130
+ display: flex;
1131
+
1132
+ .#{$prefix}-scrolllist:nth-child(2){
1133
+ border: 1px solid var(--semi-color-border);
1134
+
1135
+ }
1136
+ }
1137
+
1111
1138
  .#{$prefix}-scrolllist {
1112
1139
  @include font-size-small;
1113
1140
  line-height: $lineHeight-datepicker_compact;
@@ -85,6 +85,7 @@ export interface EventHandlerProps {
85
85
  onClear?: (e: any) => void;
86
86
  onFocus?: (e: any, rangType: RangeType) => void;
87
87
  onPresetClick?: OnPresetClickType;
88
+ onClickOutSide?: () => void;
88
89
  }
89
90
  export interface DatePickerFoundationProps extends ElementProps, RenderProps, EventHandlerProps {
90
91
  autoAdjustOverflow?: boolean;
@@ -155,7 +156,7 @@ export interface DatePickerFoundationState {
155
156
  }
156
157
  export { Type, DateInputFoundationProps };
157
158
  export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationProps, DatePickerFoundationState> {
158
- togglePanel: (panelShow: boolean) => void;
159
+ togglePanel: (panelShow: boolean, cb?: () => void) => void;
159
160
  registerClickOutSide: () => void;
160
161
  unregisterClickOutSide: () => void;
161
162
  notifyBlur: DatePickerFoundationProps['onBlur'];
@@ -178,6 +179,9 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
178
179
  updateInsetInputValue: (insetInputValue: InsetInputValue) => void;
179
180
  setInsetInputFocus: () => void;
180
181
  setTriggerDisabled: (disabled: boolean) => void;
182
+ setInputFocus: () => void;
183
+ setInputBlur: () => void;
184
+ setRangeInputBlur: () => void;
181
185
  }
182
186
  /**
183
187
  * The datePicker foundation.js is responsible for maintaining the date value and the input box value, as well as the callback of both
@@ -185,6 +189,7 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
185
189
  * task 2. When the input box changes, update the date value = > Notify the change
186
190
  */
187
191
  export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapter> {
192
+ clickConfirmButton: boolean;
188
193
  constructor(adapter: DatePickerAdapter);
189
194
  init(): void;
190
195
  isValidTimeZone(timeZone?: string | number): boolean;
@@ -215,17 +220,17 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
215
220
  initPanelOpenStatus(defaultOpen?: boolean): void;
216
221
  openPanel(): void;
217
222
  /**
223
+ * @deprecated
218
224
  * do these side effects when type is dateRange or dateTimeRange
219
225
  * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
220
226
  * 2. set cachedSelectedValue using given dates(in needConfirm mode)
221
227
  * - directly closePanel without click confirm will set cachedSelectedValue to state value
222
228
  * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
223
229
  */
224
- rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]): void;
225
230
  /**
231
+ * @deprecated
226
232
  * clear input value when selected date is not confirmed
227
233
  */
228
- needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined): void;
229
234
  /**
230
235
  * clear inset input value when close panel
231
236
  */
@@ -247,6 +252,23 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
247
252
  * @param {Date[]} dates
248
253
  */
249
254
  closePanel(e?: any, inputValue?: string, dates?: Date[]): void;
255
+ open(): void;
256
+ close(): void;
257
+ focus(focusType?: Exclude<RangeType, false>): void;
258
+ blur(): void;
259
+ /**
260
+ * reset cachedSelectedValue, inputValue when close panel
261
+ */
262
+ resetInnerSelectedStates(willUpdateDates?: Date[]): void;
263
+ resetFocus(e?: any): void;
264
+ /**
265
+ * cachedSelectedValue can be `(Date|null)[]` or `null`
266
+ */
267
+ isCachedSelectedValueValid(dates: Date[]): boolean;
268
+ /**
269
+ * 将输入框内容置空
270
+ */
271
+ clearInputValue(): void;
250
272
  /**
251
273
  * clear range input focus when open is controlled
252
274
  * fixed github 1375
@@ -381,12 +403,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
381
403
  needCheckFocusRecord?: boolean;
382
404
  }): void;
383
405
  /**
384
- * when changing the year and month through the panel when the type is year or month
406
+ * when changing the year and month through the panel when the type is year or month or monthRange
385
407
  * @param {*} item
386
408
  */
387
409
  handleYMSelectedChange(item?: {
388
- currentMonth?: number;
389
- currentYear?: number;
410
+ currentMonth?: {
411
+ left: number;
412
+ right: number;
413
+ };
414
+ currentYear?: {
415
+ left: number;
416
+ right: number;
417
+ };
390
418
  }): void;
391
419
  handleConfirm(): void;
392
420
  handleCancel(): void;