@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.
package/dist/umd/semi-ui.js
CHANGED
|
@@ -56625,8 +56625,48 @@ Combobox_Combobox.defaultProps = {
|
|
|
56625
56625
|
format: timePicker_constants_strings.DEFAULT_FORMAT
|
|
56626
56626
|
};
|
|
56627
56627
|
/* harmony default export */ var timePicker_Combobox = (Combobox_Combobox);
|
|
56628
|
+
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/setYear/index.js
|
|
56629
|
+
|
|
56630
|
+
|
|
56631
|
+
|
|
56632
|
+
/**
|
|
56633
|
+
* @name setYear
|
|
56634
|
+
* @category Year Helpers
|
|
56635
|
+
* @summary Set the year to the given date.
|
|
56636
|
+
*
|
|
56637
|
+
* @description
|
|
56638
|
+
* Set the year to the given date.
|
|
56639
|
+
*
|
|
56640
|
+
* ### v2.0.0 breaking changes:
|
|
56641
|
+
*
|
|
56642
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
56643
|
+
*
|
|
56644
|
+
* @param {Date|Number} date - the date to be changed
|
|
56645
|
+
* @param {Number} year - the year of the new date
|
|
56646
|
+
* @returns {Date} the new date with the year set
|
|
56647
|
+
* @throws {TypeError} 2 arguments required
|
|
56648
|
+
*
|
|
56649
|
+
* @example
|
|
56650
|
+
* // Set year 2013 to 1 September 2014:
|
|
56651
|
+
* const result = setYear(new Date(2014, 8, 1), 2013)
|
|
56652
|
+
* //=> Sun Sep 01 2013 00:00:00
|
|
56653
|
+
*/
|
|
56654
|
+
|
|
56655
|
+
function setYear(dirtyDate, dirtyYear) {
|
|
56656
|
+
requiredArgs(2, arguments);
|
|
56657
|
+
var date = toDate(dirtyDate);
|
|
56658
|
+
var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
|
|
56659
|
+
|
|
56660
|
+
if (isNaN(date.getTime())) {
|
|
56661
|
+
return new Date(NaN);
|
|
56662
|
+
}
|
|
56663
|
+
|
|
56664
|
+
date.setFullYear(year);
|
|
56665
|
+
return date;
|
|
56666
|
+
}
|
|
56628
56667
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/yearAndMonthFoundation.ts
|
|
56629
56668
|
|
|
56669
|
+
|
|
56630
56670
|
class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
56631
56671
|
constructor(adapter) {
|
|
56632
56672
|
super(Object.assign({}, adapter));
|
|
@@ -56641,7 +56681,7 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
56641
56681
|
selectYear(item) {
|
|
56642
56682
|
const year = item.value;
|
|
56643
56683
|
|
|
56644
|
-
this._adapter.setCurrentYear(year);
|
|
56684
|
+
this._adapter.setCurrentYear(year, () => this.autoSelectMonth(item));
|
|
56645
56685
|
|
|
56646
56686
|
this._adapter.notifySelectYear(year);
|
|
56647
56687
|
}
|
|
@@ -56655,6 +56695,59 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
56655
56695
|
|
|
56656
56696
|
this._adapter.notifySelectMonth(month);
|
|
56657
56697
|
}
|
|
56698
|
+
/**
|
|
56699
|
+
* After selecting a year, if the currentMonth is disabled, automatically select a non-disabled month
|
|
56700
|
+
*/
|
|
56701
|
+
|
|
56702
|
+
|
|
56703
|
+
autoSelectMonth(item) {
|
|
56704
|
+
const {
|
|
56705
|
+
disabledDate,
|
|
56706
|
+
locale
|
|
56707
|
+
} = this._adapter.getProps();
|
|
56708
|
+
|
|
56709
|
+
const {
|
|
56710
|
+
months,
|
|
56711
|
+
currentMonth
|
|
56712
|
+
} = this._adapter.getStates();
|
|
56713
|
+
|
|
56714
|
+
const currentDate = setYear(Date.now(), item.year);
|
|
56715
|
+
const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth - 1));
|
|
56716
|
+
|
|
56717
|
+
if (isCurrentMonthDisabled) {
|
|
56718
|
+
const currentIndex = months.findIndex(_ref => {
|
|
56719
|
+
let {
|
|
56720
|
+
month
|
|
56721
|
+
} = _ref;
|
|
56722
|
+
return month === currentMonth;
|
|
56723
|
+
});
|
|
56724
|
+
let validMonth; // First look in the back, if you can't find it in the back, then look in the front
|
|
56725
|
+
|
|
56726
|
+
validMonth = months.slice(currentIndex).find(_ref2 => {
|
|
56727
|
+
let {
|
|
56728
|
+
month
|
|
56729
|
+
} = _ref2;
|
|
56730
|
+
return !disabledDate(setMonth(currentDate, month - 1));
|
|
56731
|
+
});
|
|
56732
|
+
|
|
56733
|
+
if (!validMonth) {
|
|
56734
|
+
validMonth = months.slice(0, currentIndex).find(_ref3 => {
|
|
56735
|
+
let {
|
|
56736
|
+
month
|
|
56737
|
+
} = _ref3;
|
|
56738
|
+
return !disabledDate(setMonth(currentDate, month - 1));
|
|
56739
|
+
});
|
|
56740
|
+
}
|
|
56741
|
+
|
|
56742
|
+
if (validMonth) {
|
|
56743
|
+
this.selectMonth({
|
|
56744
|
+
month: validMonth.month,
|
|
56745
|
+
value: locale.fullMonths[validMonth.month],
|
|
56746
|
+
disabled: false
|
|
56747
|
+
});
|
|
56748
|
+
}
|
|
56749
|
+
}
|
|
56750
|
+
}
|
|
56658
56751
|
|
|
56659
56752
|
backToMain() {
|
|
56660
56753
|
this._adapter.notifyBackToMain();
|
|
@@ -56671,45 +56764,6 @@ const getYears = () => {
|
|
|
56671
56764
|
};
|
|
56672
56765
|
|
|
56673
56766
|
/* harmony default export */ var _utils_getYears = (getYears);
|
|
56674
|
-
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/setYear/index.js
|
|
56675
|
-
|
|
56676
|
-
|
|
56677
|
-
|
|
56678
|
-
/**
|
|
56679
|
-
* @name setYear
|
|
56680
|
-
* @category Year Helpers
|
|
56681
|
-
* @summary Set the year to the given date.
|
|
56682
|
-
*
|
|
56683
|
-
* @description
|
|
56684
|
-
* Set the year to the given date.
|
|
56685
|
-
*
|
|
56686
|
-
* ### v2.0.0 breaking changes:
|
|
56687
|
-
*
|
|
56688
|
-
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
56689
|
-
*
|
|
56690
|
-
* @param {Date|Number} date - the date to be changed
|
|
56691
|
-
* @param {Number} year - the year of the new date
|
|
56692
|
-
* @returns {Date} the new date with the year set
|
|
56693
|
-
* @throws {TypeError} 2 arguments required
|
|
56694
|
-
*
|
|
56695
|
-
* @example
|
|
56696
|
-
* // Set year 2013 to 1 September 2014:
|
|
56697
|
-
* const result = setYear(new Date(2014, 8, 1), 2013)
|
|
56698
|
-
* //=> Sun Sep 01 2013 00:00:00
|
|
56699
|
-
*/
|
|
56700
|
-
|
|
56701
|
-
function setYear(dirtyDate, dirtyYear) {
|
|
56702
|
-
requiredArgs(2, arguments);
|
|
56703
|
-
var date = toDate(dirtyDate);
|
|
56704
|
-
var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
|
|
56705
|
-
|
|
56706
|
-
if (isNaN(date.getTime())) {
|
|
56707
|
-
return new Date(NaN);
|
|
56708
|
-
}
|
|
56709
|
-
|
|
56710
|
-
date.setFullYear(year);
|
|
56711
|
-
return date;
|
|
56712
|
-
}
|
|
56713
56767
|
// CONCATENATED MODULE: ./datePicker/yearAndMonth.tsx
|
|
56714
56768
|
|
|
56715
56769
|
|
|
@@ -56786,9 +56840,9 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
56786
56840
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
56787
56841
|
// updateYears: years => this.setState({ years }),
|
|
56788
56842
|
// updateMonths: months => this.setState({ months }),
|
|
56789
|
-
setCurrentYear: currentYear => this.setState({
|
|
56843
|
+
setCurrentYear: (currentYear, cb) => this.setState({
|
|
56790
56844
|
currentYear
|
|
56791
|
-
}),
|
|
56845
|
+
}, cb),
|
|
56792
56846
|
setCurrentMonth: currentMonth => this.setState({
|
|
56793
56847
|
currentMonth
|
|
56794
56848
|
}),
|
|
@@ -56823,7 +56877,8 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
56823
56877
|
const {
|
|
56824
56878
|
years,
|
|
56825
56879
|
currentYear,
|
|
56826
|
-
currentMonth
|
|
56880
|
+
currentMonth,
|
|
56881
|
+
months
|
|
56827
56882
|
} = this.state;
|
|
56828
56883
|
const {
|
|
56829
56884
|
disabledDate,
|
|
@@ -56837,10 +56892,19 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
56837
56892
|
value,
|
|
56838
56893
|
year
|
|
56839
56894
|
} = _ref;
|
|
56895
|
+
const isAllMonthDisabled = months.every(_ref2 => {
|
|
56896
|
+
let {
|
|
56897
|
+
month
|
|
56898
|
+
} = _ref2;
|
|
56899
|
+
return disabledDate(set_set(currentDate, {
|
|
56900
|
+
year,
|
|
56901
|
+
month: month - 1
|
|
56902
|
+
}));
|
|
56903
|
+
});
|
|
56840
56904
|
return {
|
|
56841
56905
|
year,
|
|
56842
56906
|
value,
|
|
56843
|
-
disabled:
|
|
56907
|
+
disabled: isAllMonthDisabled
|
|
56844
56908
|
};
|
|
56845
56909
|
});
|
|
56846
56910
|
|
|
@@ -56887,11 +56951,11 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
56887
56951
|
} // i18n
|
|
56888
56952
|
|
|
56889
56953
|
|
|
56890
|
-
const list = months.map(
|
|
56954
|
+
const list = months.map(_ref3 => {
|
|
56891
56955
|
let {
|
|
56892
56956
|
value,
|
|
56893
56957
|
month
|
|
56894
|
-
} =
|
|
56958
|
+
} = _ref3;
|
|
56895
56959
|
return {
|
|
56896
56960
|
month,
|
|
56897
56961
|
disabled: disabledDate(setMonth(currentDate, month - 1)),
|