@douyinfe/semi-ui 2.24.0 → 2.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,9 +96,9 @@ class YearAndMonth extends _baseComponent.default {
96
96
  return Object.assign(Object.assign({}, super.adapter), {
97
97
  // updateYears: years => this.setState({ years }),
98
98
  // updateMonths: months => this.setState({ months }),
99
- setCurrentYear: currentYear => this.setState({
99
+ setCurrentYear: (currentYear, cb) => this.setState({
100
100
  currentYear
101
- }),
101
+ }, cb),
102
102
  setCurrentMonth: currentMonth => this.setState({
103
103
  currentMonth
104
104
  }),
@@ -133,7 +133,8 @@ class YearAndMonth extends _baseComponent.default {
133
133
  const {
134
134
  years,
135
135
  currentYear,
136
- currentMonth
136
+ currentMonth,
137
+ months
137
138
  } = this.state;
138
139
  const {
139
140
  disabledDate,
@@ -147,10 +148,19 @@ class YearAndMonth extends _baseComponent.default {
147
148
  value,
148
149
  year
149
150
  } = _ref;
151
+ const isAllMonthDisabled = months.every(_ref2 => {
152
+ let {
153
+ month
154
+ } = _ref2;
155
+ return disabledDate((0, _dateFns.set)(currentDate, {
156
+ year,
157
+ month: month - 1
158
+ }));
159
+ });
150
160
  return {
151
161
  year,
152
162
  value,
153
- disabled: disabledDate((0, _dateFns.setYear)(currentDate, year))
163
+ disabled: isAllMonthDisabled
154
164
  };
155
165
  });
156
166
 
@@ -197,11 +207,11 @@ class YearAndMonth extends _baseComponent.default {
197
207
  } // i18n
198
208
 
199
209
 
200
- const list = months.map(_ref2 => {
210
+ const list = months.map(_ref3 => {
201
211
  let {
202
212
  value,
203
213
  month
204
- } = _ref2;
214
+ } = _ref3;
205
215
  return {
206
216
  month,
207
217
  disabled: disabledDate((0, _dateFns.setMonth)(currentDate, month - 1)),
@@ -13,7 +13,7 @@ import isNullOrUndefined from '@douyinfe/semi-foundation/lib/es/utils/isNullOrUn
13
13
  import IconButton from '../iconButton';
14
14
  import { IconChevronLeft } from '@douyinfe/semi-icons';
15
15
  import { BASE_CLASS_PREFIX } from '@douyinfe/semi-foundation/lib/es/base/constants';
16
- import { setYear, setMonth } from 'date-fns';
16
+ import { setYear, setMonth, set } from 'date-fns';
17
17
  import { strings } from '@douyinfe/semi-foundation/lib/es/datePicker/constants';
18
18
  const prefixCls = "".concat(BASE_CLASS_PREFIX, "-datepicker");
19
19
 
@@ -73,9 +73,9 @@ class YearAndMonth extends BaseComponent {
73
73
  return Object.assign(Object.assign({}, super.adapter), {
74
74
  // updateYears: years => this.setState({ years }),
75
75
  // updateMonths: months => this.setState({ months }),
76
- setCurrentYear: currentYear => this.setState({
76
+ setCurrentYear: (currentYear, cb) => this.setState({
77
77
  currentYear
78
- }),
78
+ }, cb),
79
79
  setCurrentMonth: currentMonth => this.setState({
80
80
  currentMonth
81
81
  }),
@@ -110,7 +110,8 @@ class YearAndMonth extends BaseComponent {
110
110
  const {
111
111
  years,
112
112
  currentYear,
113
- currentMonth
113
+ currentMonth,
114
+ months
114
115
  } = this.state;
115
116
  const {
116
117
  disabledDate,
@@ -124,10 +125,19 @@ class YearAndMonth extends BaseComponent {
124
125
  value,
125
126
  year
126
127
  } = _ref;
128
+ const isAllMonthDisabled = months.every(_ref2 => {
129
+ let {
130
+ month
131
+ } = _ref2;
132
+ return disabledDate(set(currentDate, {
133
+ year,
134
+ month: month - 1
135
+ }));
136
+ });
127
137
  return {
128
138
  year,
129
139
  value,
130
- disabled: disabledDate(setYear(currentDate, year))
140
+ disabled: isAllMonthDisabled
131
141
  };
132
142
  });
133
143
 
@@ -174,11 +184,11 @@ class YearAndMonth extends BaseComponent {
174
184
  } // i18n
175
185
 
176
186
 
177
- const list = months.map(_ref2 => {
187
+ const list = months.map(_ref3 => {
178
188
  let {
179
189
  value,
180
190
  month
181
- } = _ref2;
191
+ } = _ref3;
182
192
  return {
183
193
  month,
184
194
  disabled: disabledDate(setMonth(currentDate, month - 1)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.24.0",
3
+ "version": "2.24.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.24.0",
21
- "@douyinfe/semi-animation-react": "2.24.0",
22
- "@douyinfe/semi-foundation": "2.24.0",
23
- "@douyinfe/semi-icons": "2.24.0",
24
- "@douyinfe/semi-illustrations": "2.24.0",
25
- "@douyinfe/semi-theme-default": "2.24.0",
20
+ "@douyinfe/semi-animation": "2.24.1",
21
+ "@douyinfe/semi-animation-react": "2.24.1",
22
+ "@douyinfe/semi-foundation": "2.24.1",
23
+ "@douyinfe/semi-icons": "2.24.1",
24
+ "@douyinfe/semi-illustrations": "2.24.1",
25
+ "@douyinfe/semi-theme-default": "2.24.1",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "3cf6c8a6fa76511fd3797c7168f9ecd4bc0ef662",
72
+ "gitHead": "cdd012ac90665b020133f4b01c4c07c8399e4296",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",