@douyinfe/semi-ui 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.
- package/dist/css/semi.css +40 -11
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +490 -179
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/cascader/index.d.ts +1 -0
- package/lib/cjs/cascader/index.js +10 -1
- package/lib/cjs/datePicker/dateInput.d.ts +5 -1
- package/lib/cjs/datePicker/dateInput.js +16 -9
- package/lib/cjs/datePicker/datePicker.d.ts +32 -4
- package/lib/cjs/datePicker/datePicker.js +104 -23
- package/lib/cjs/datePicker/index.d.ts +1 -0
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.js +11 -3
- package/lib/cjs/datePicker/yearAndMonth.d.ts +10 -6
- package/lib/cjs/datePicker/yearAndMonth.js +84 -30
- package/lib/cjs/form/baseForm.d.ts +2 -2
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/locale/interface.d.ts +1 -0
- package/lib/cjs/locale/source/ar.js +2 -1
- package/lib/cjs/locale/source/de.js +2 -1
- package/lib/cjs/locale/source/en_GB.js +2 -1
- package/lib/cjs/locale/source/en_US.js +2 -1
- package/lib/cjs/locale/source/es.js +2 -1
- package/lib/cjs/locale/source/fr.js +2 -1
- package/lib/cjs/locale/source/id_ID.js +2 -1
- package/lib/cjs/locale/source/it.js +2 -1
- package/lib/cjs/locale/source/ja_JP.js +2 -1
- package/lib/cjs/locale/source/ko_KR.js +2 -1
- package/lib/cjs/locale/source/ms_MY.js +2 -1
- package/lib/cjs/locale/source/nl_NL.js +2 -1
- package/lib/cjs/locale/source/pl_PL.js +2 -1
- package/lib/cjs/locale/source/pt_BR.js +2 -1
- package/lib/cjs/locale/source/ro.d.ts +1 -0
- package/lib/cjs/locale/source/ro.js +2 -1
- package/lib/cjs/locale/source/ru_RU.js +2 -1
- package/lib/cjs/locale/source/sv_SE.js +2 -1
- package/lib/cjs/locale/source/th_TH.js +2 -1
- package/lib/cjs/locale/source/tr_TR.js +2 -1
- package/lib/cjs/locale/source/vi_VN.js +2 -1
- package/lib/cjs/locale/source/zh_CN.js +2 -1
- package/lib/cjs/locale/source/zh_TW.js +2 -1
- package/lib/cjs/select/index.d.ts +18 -1
- package/lib/cjs/select/index.js +4 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/cjs/sideSheet/SideSheetContent.js +3 -2
- package/lib/cjs/sideSheet/index.js +6 -3
- package/lib/cjs/space/index.js +5 -2
- package/lib/cjs/switch/index.js +1 -1
- package/lib/cjs/treeSelect/index.d.ts +1 -0
- package/lib/cjs/treeSelect/index.js +7 -3
- package/lib/es/cascader/index.d.ts +1 -0
- package/lib/es/cascader/index.js +10 -1
- package/lib/es/datePicker/dateInput.d.ts +5 -1
- package/lib/es/datePicker/dateInput.js +16 -9
- package/lib/es/datePicker/datePicker.d.ts +32 -4
- package/lib/es/datePicker/datePicker.js +109 -23
- package/lib/es/datePicker/index.d.ts +1 -0
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.js +11 -3
- package/lib/es/datePicker/yearAndMonth.d.ts +10 -6
- package/lib/es/datePicker/yearAndMonth.js +83 -29
- package/lib/es/form/baseForm.d.ts +2 -2
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/locale/interface.d.ts +1 -0
- package/lib/es/locale/source/ar.js +2 -1
- package/lib/es/locale/source/de.js +2 -1
- package/lib/es/locale/source/en_GB.js +2 -1
- package/lib/es/locale/source/en_US.js +2 -1
- package/lib/es/locale/source/es.js +2 -1
- package/lib/es/locale/source/fr.js +2 -1
- package/lib/es/locale/source/id_ID.js +2 -1
- package/lib/es/locale/source/it.js +2 -1
- package/lib/es/locale/source/ja_JP.js +2 -1
- package/lib/es/locale/source/ko_KR.js +2 -1
- package/lib/es/locale/source/ms_MY.js +2 -1
- package/lib/es/locale/source/nl_NL.js +2 -1
- package/lib/es/locale/source/pl_PL.js +2 -1
- package/lib/es/locale/source/pt_BR.js +2 -1
- package/lib/es/locale/source/ro.d.ts +1 -0
- package/lib/es/locale/source/ro.js +2 -1
- package/lib/es/locale/source/ru_RU.js +2 -1
- package/lib/es/locale/source/sv_SE.js +2 -1
- package/lib/es/locale/source/th_TH.js +2 -1
- package/lib/es/locale/source/tr_TR.js +2 -1
- package/lib/es/locale/source/vi_VN.js +2 -1
- package/lib/es/locale/source/zh_CN.js +2 -1
- package/lib/es/locale/source/zh_TW.js +2 -1
- package/lib/es/select/index.d.ts +18 -1
- package/lib/es/select/index.js +4 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +3 -1
- package/lib/es/sideSheet/SideSheetContent.js +3 -2
- package/lib/es/sideSheet/index.js +6 -3
- package/lib/es/space/index.js +4 -2
- package/lib/es/switch/index.js +1 -1
- package/lib/es/treeSelect/index.d.ts +1 -0
- package/lib/es/treeSelect/index.js +7 -3
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -21396,7 +21396,8 @@ const local = {
|
|
|
21396
21396
|
date: '请选择日期',
|
|
21397
21397
|
dateTime: '请选择日期及时间',
|
|
21398
21398
|
dateRange: ['开始日期', '结束日期'],
|
|
21399
|
-
dateTimeRange: ['开始日期', '结束日期']
|
|
21399
|
+
dateTimeRange: ['开始日期', '结束日期'],
|
|
21400
|
+
monthRange: ['开始月份', '结束月份']
|
|
21400
21401
|
},
|
|
21401
21402
|
footer: {
|
|
21402
21403
|
confirm: '确定',
|
|
@@ -37075,6 +37076,16 @@ const utils_flatten = children => {
|
|
|
37075
37076
|
});
|
|
37076
37077
|
return res;
|
|
37077
37078
|
};
|
|
37079
|
+
// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
|
|
37080
|
+
function getDataAttr(props) {
|
|
37081
|
+
return Object.keys(props).reduce((prev, key) => {
|
|
37082
|
+
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
|
|
37083
|
+
prev[key] = props[key];
|
|
37084
|
+
}
|
|
37085
|
+
|
|
37086
|
+
return prev;
|
|
37087
|
+
}, {});
|
|
37088
|
+
}
|
|
37078
37089
|
// CONCATENATED MODULE: ./space/index.tsx
|
|
37079
37090
|
|
|
37080
37091
|
|
|
@@ -37085,6 +37096,7 @@ const utils_flatten = children => {
|
|
|
37085
37096
|
|
|
37086
37097
|
|
|
37087
37098
|
|
|
37099
|
+
|
|
37088
37100
|
const space_prefixCls = space_constants_cssClasses.PREFIX;
|
|
37089
37101
|
|
|
37090
37102
|
class space_Space extends external_root_React_commonjs2_react_commonjs_react_amd_react_["PureComponent"] {
|
|
@@ -37136,11 +37148,12 @@ class space_Space extends external_root_React_commonjs2_react_commonjs_react_amd
|
|
|
37136
37148
|
[`${space_prefixCls}-loose-vertical`]: spacingVerticalType === space_constants_strings.SPACING_LOOSE
|
|
37137
37149
|
});
|
|
37138
37150
|
const childrenNodes = utils_flatten(children);
|
|
37139
|
-
|
|
37151
|
+
const dataAttributes = getDataAttr(this.props);
|
|
37152
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", Object.assign({}, dataAttributes, {
|
|
37140
37153
|
className: classNames,
|
|
37141
37154
|
style: realStyle,
|
|
37142
37155
|
"x-semi-prop": "children"
|
|
37143
|
-
}, childrenNodes);
|
|
37156
|
+
}), childrenNodes);
|
|
37144
37157
|
}
|
|
37145
37158
|
|
|
37146
37159
|
}
|
|
@@ -37640,16 +37653,6 @@ class foundation_CarouselFoundation extends foundation {
|
|
|
37640
37653
|
}
|
|
37641
37654
|
|
|
37642
37655
|
/* harmony default export */ var carousel_foundation = (foundation_CarouselFoundation);
|
|
37643
|
-
// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
|
|
37644
|
-
function getDataAttr(props) {
|
|
37645
|
-
return Object.keys(props).reduce((prev, key) => {
|
|
37646
|
-
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
|
|
37647
|
-
prev[key] = props[key];
|
|
37648
|
-
}
|
|
37649
|
-
|
|
37650
|
-
return prev;
|
|
37651
|
-
}, {});
|
|
37652
|
-
}
|
|
37653
37656
|
// CONCATENATED MODULE: ./carousel/CarouselIndicator.tsx
|
|
37654
37657
|
var CarouselIndicator_rest = undefined && undefined.__rest || function (s, e) {
|
|
37655
37658
|
var t = {};
|
|
@@ -44425,6 +44428,13 @@ class cascader_Cascader extends baseComponent_BaseComponent {
|
|
|
44425
44428
|
this.foundation.handleTagRemove(e, tagValuePath);
|
|
44426
44429
|
};
|
|
44427
44430
|
|
|
44431
|
+
this.handleRemoveByKey = key => {
|
|
44432
|
+
const {
|
|
44433
|
+
keyEntities
|
|
44434
|
+
} = this.state;
|
|
44435
|
+
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
44436
|
+
};
|
|
44437
|
+
|
|
44428
44438
|
this.renderTagItem = (value, idx, type) => {
|
|
44429
44439
|
const {
|
|
44430
44440
|
keyEntities,
|
|
@@ -44714,7 +44724,9 @@ class cascader_Cascader extends baseComponent_BaseComponent {
|
|
|
44714
44724
|
disabled: disabled,
|
|
44715
44725
|
triggerRender: triggerRender,
|
|
44716
44726
|
componentName: 'Cascader',
|
|
44717
|
-
componentProps: Object.assign({}, this.props)
|
|
44727
|
+
componentProps: Object.assign({}, this.props),
|
|
44728
|
+
onSearch: this.handleInputChange,
|
|
44729
|
+
onRemove: this.handleRemoveByKey
|
|
44718
44730
|
});
|
|
44719
44731
|
};
|
|
44720
44732
|
|
|
@@ -46281,7 +46293,7 @@ const datePicker_constants_strings = Object.assign({
|
|
|
46281
46293
|
DEFAULT_SEPARATOR_MULTIPLE: ',',
|
|
46282
46294
|
DEFAULT_SEPARATOR_RANGE: ' ~ ',
|
|
46283
46295
|
SIZE_SET: ['small', 'default', 'large'],
|
|
46284
|
-
TYPE_SET: ['date', 'dateRange', 'year', 'month', 'dateTime', 'dateTimeRange'],
|
|
46296
|
+
TYPE_SET: ['date', 'dateRange', 'year', 'month', 'monthRange', 'dateTime', 'dateTimeRange'],
|
|
46285
46297
|
PRESET_POSITION_SET: ['left', 'right', 'top', 'bottom'],
|
|
46286
46298
|
DENSITY_SET: ['default', 'compact'],
|
|
46287
46299
|
PANEL_TYPE_LEFT: 'left',
|
|
@@ -50441,7 +50453,8 @@ const defaultFormatTokens = {
|
|
|
50441
50453
|
dateTime: datePicker_constants_strings.FORMAT_DATE_TIME,
|
|
50442
50454
|
dateRange: datePicker_constants_strings.FORMAT_FULL_DATE,
|
|
50443
50455
|
dateTimeRange: datePicker_constants_strings.FORMAT_DATE_TIME,
|
|
50444
|
-
month: datePicker_constants_strings.FORMAT_YEAR_MONTH
|
|
50456
|
+
month: datePicker_constants_strings.FORMAT_YEAR_MONTH,
|
|
50457
|
+
monthRange: datePicker_constants_strings.FORMAT_YEAR_MONTH
|
|
50445
50458
|
};
|
|
50446
50459
|
|
|
50447
50460
|
const getDefaultFormatToken = type => defaultFormatTokens;
|
|
@@ -50487,6 +50500,7 @@ function getInsetInputFormatToken(options) {
|
|
|
50487
50500
|
|
|
50488
50501
|
case 'date':
|
|
50489
50502
|
case 'month':
|
|
50503
|
+
case 'monthRange':
|
|
50490
50504
|
case 'dateRange':
|
|
50491
50505
|
default:
|
|
50492
50506
|
const dateResult = dateReg.exec(format);
|
|
@@ -50535,6 +50549,7 @@ function getInsetInputValueFromInsetInputStr(options) {
|
|
|
50535
50549
|
switch (type) {
|
|
50536
50550
|
case 'date':
|
|
50537
50551
|
case 'month':
|
|
50552
|
+
case 'monthRange':
|
|
50538
50553
|
insetInputValue.monthLeft.dateInput = inputValue;
|
|
50539
50554
|
break;
|
|
50540
50555
|
|
|
@@ -50669,9 +50684,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
50669
50684
|
this._adapter.updatePrevTimezone(prevTimeZone); // reset input value when value update
|
|
50670
50685
|
|
|
50671
50686
|
|
|
50672
|
-
this.
|
|
50673
|
-
|
|
50674
|
-
this._adapter.updateInsetInputValue(null);
|
|
50687
|
+
this.clearInputValue();
|
|
50675
50688
|
|
|
50676
50689
|
this._adapter.updateValue(result);
|
|
50677
50690
|
|
|
@@ -50758,7 +50771,8 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
50758
50771
|
|
|
50759
50772
|
destroy() {
|
|
50760
50773
|
// Ensure that event listeners will be uninstalled and users may not trigger closePanel
|
|
50761
|
-
|
|
50774
|
+
this._adapter.togglePanel(false);
|
|
50775
|
+
|
|
50762
50776
|
this._adapter.unregisterClickOutSide();
|
|
50763
50777
|
}
|
|
50764
50778
|
|
|
@@ -50777,52 +50791,47 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
50777
50791
|
openPanel() {
|
|
50778
50792
|
if (!this.getProp('disabled')) {
|
|
50779
50793
|
if (!this._isControlledComponent('open')) {
|
|
50780
|
-
this.
|
|
50781
|
-
|
|
50782
|
-
this._adapter.registerClickOutSide();
|
|
50794
|
+
this.open();
|
|
50783
50795
|
}
|
|
50784
50796
|
|
|
50785
50797
|
this._adapter.notifyOpenChange(true);
|
|
50786
50798
|
}
|
|
50787
50799
|
}
|
|
50788
50800
|
/**
|
|
50801
|
+
* @deprecated
|
|
50789
50802
|
* do these side effects when type is dateRange or dateTimeRange
|
|
50790
50803
|
* 1. trigger input blur, if input value is invalid, set input value and state value to previous status
|
|
50791
50804
|
* 2. set cachedSelectedValue using given dates(in needConfirm mode)
|
|
50792
50805
|
* - directly closePanel without click confirm will set cachedSelectedValue to state value
|
|
50793
50806
|
* - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
|
|
50794
50807
|
*/
|
|
50808
|
+
// rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]) {
|
|
50809
|
+
// if (this._isRangeType()) {
|
|
50810
|
+
// this._adapter.setRangeInputFocus(false);
|
|
50811
|
+
// /**
|
|
50812
|
+
// * inputValue is string when it is not disabled or can't parsed
|
|
50813
|
+
// * when inputValue is null, picker value will back to last selected value
|
|
50814
|
+
// */
|
|
50815
|
+
// this.handleInputBlur(inputValue);
|
|
50816
|
+
// this.resetCachedSelectedValue(willUpdateDates);
|
|
50817
|
+
// }
|
|
50818
|
+
// }
|
|
50795
50819
|
|
|
50796
|
-
|
|
50797
|
-
rangeTypeSideEffectsWhenClosePanel(inputValue, willUpdateDates) {
|
|
50798
|
-
if (this._isRangeType()) {
|
|
50799
|
-
this._adapter.setRangeInputFocus(false);
|
|
50800
|
-
/**
|
|
50801
|
-
* inputValue is string when it is not disabled or can't parsed
|
|
50802
|
-
* when inputValue is null, picker value will back to last selected value
|
|
50803
|
-
*/
|
|
50804
|
-
|
|
50805
|
-
|
|
50806
|
-
this.handleInputBlur(inputValue);
|
|
50807
|
-
this.resetCachedSelectedValue(willUpdateDates);
|
|
50808
|
-
}
|
|
50809
|
-
}
|
|
50810
50820
|
/**
|
|
50821
|
+
* @deprecated
|
|
50811
50822
|
* clear input value when selected date is not confirmed
|
|
50812
50823
|
*/
|
|
50824
|
+
// needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined) {
|
|
50825
|
+
// if (this._adapter.needConfirm() && !this._isRangeType()) {
|
|
50826
|
+
// /**
|
|
50827
|
+
// * if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
|
|
50828
|
+
// * if `` input element will show `` directly
|
|
50829
|
+
// */
|
|
50830
|
+
// this._adapter.updateInputValue(null);
|
|
50831
|
+
// this.resetCachedSelectedValue(willUpdateDates);
|
|
50832
|
+
// }
|
|
50833
|
+
// }
|
|
50813
50834
|
|
|
50814
|
-
|
|
50815
|
-
needConfirmSideEffectsWhenClosePanel(willUpdateDates) {
|
|
50816
|
-
if (this._adapter.needConfirm() && !this._isRangeType()) {
|
|
50817
|
-
/**
|
|
50818
|
-
* if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
|
|
50819
|
-
* if `` input element will show `` directly
|
|
50820
|
-
*/
|
|
50821
|
-
this._adapter.updateInputValue(null);
|
|
50822
|
-
|
|
50823
|
-
this.resetCachedSelectedValue(willUpdateDates);
|
|
50824
|
-
}
|
|
50825
|
-
}
|
|
50826
50835
|
/**
|
|
50827
50836
|
* clear inset input value when close panel
|
|
50828
50837
|
*/
|
|
@@ -50879,20 +50888,114 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
50879
50888
|
const willUpdateDates = isNullOrUndefined(dates) ? value : dates;
|
|
50880
50889
|
|
|
50881
50890
|
if (!this._isControlledComponent('open')) {
|
|
50882
|
-
this.
|
|
50891
|
+
this.close();
|
|
50892
|
+
} else {
|
|
50893
|
+
this.resetInnerSelectedStates(willUpdateDates);
|
|
50894
|
+
}
|
|
50883
50895
|
|
|
50884
|
-
|
|
50885
|
-
|
|
50896
|
+
this._adapter.notifyOpenChange(false);
|
|
50897
|
+
}
|
|
50886
50898
|
|
|
50899
|
+
open() {
|
|
50900
|
+
this._adapter.togglePanel(true);
|
|
50887
50901
|
|
|
50888
|
-
this.
|
|
50889
|
-
|
|
50890
|
-
this.clearInsetInputValue();
|
|
50902
|
+
this._adapter.registerClickOutSide();
|
|
50903
|
+
}
|
|
50891
50904
|
|
|
50892
|
-
|
|
50905
|
+
close() {
|
|
50906
|
+
this._adapter.togglePanel(false, () => this.resetInnerSelectedStates());
|
|
50907
|
+
|
|
50908
|
+
this._adapter.unregisterClickOutSide();
|
|
50909
|
+
}
|
|
50910
|
+
|
|
50911
|
+
focus(focusType) {
|
|
50912
|
+
if (this._isRangeType()) {
|
|
50913
|
+
const rangeInputFocus = focusType !== null && focusType !== void 0 ? focusType : 'rangeStart';
|
|
50914
|
+
|
|
50915
|
+
this._adapter.setRangeInputFocus(rangeInputFocus);
|
|
50916
|
+
} else {
|
|
50917
|
+
this._adapter.setInputFocus();
|
|
50918
|
+
}
|
|
50919
|
+
}
|
|
50920
|
+
|
|
50921
|
+
blur() {
|
|
50922
|
+
if (this._isRangeType()) {
|
|
50923
|
+
this._adapter.setRangeInputBlur();
|
|
50924
|
+
} else {
|
|
50925
|
+
this._adapter.setInputBlur();
|
|
50926
|
+
}
|
|
50927
|
+
}
|
|
50928
|
+
/**
|
|
50929
|
+
* reset cachedSelectedValue, inputValue when close panel
|
|
50930
|
+
*/
|
|
50931
|
+
|
|
50932
|
+
|
|
50933
|
+
resetInnerSelectedStates(willUpdateDates) {
|
|
50934
|
+
const {
|
|
50935
|
+
value
|
|
50936
|
+
} = this._adapter.getStates();
|
|
50937
|
+
|
|
50938
|
+
const needResetCachedSelectedValue = !this.isCachedSelectedValueValid(willUpdateDates) || this._adapter.needConfirm() && !this.clickConfirmButton;
|
|
50939
|
+
|
|
50940
|
+
if (needResetCachedSelectedValue) {
|
|
50941
|
+
this.resetCachedSelectedValue(value);
|
|
50942
|
+
}
|
|
50943
|
+
|
|
50944
|
+
this.resetFocus();
|
|
50945
|
+
this.clearInputValue();
|
|
50946
|
+
this.clickConfirmButton = false;
|
|
50947
|
+
}
|
|
50948
|
+
|
|
50949
|
+
resetFocus(e) {
|
|
50950
|
+
this._adapter.setRangeInputFocus(false);
|
|
50893
50951
|
|
|
50894
50952
|
this._adapter.notifyBlur(e);
|
|
50895
50953
|
}
|
|
50954
|
+
/**
|
|
50955
|
+
* cachedSelectedValue can be `(Date|null)[]` or `null`
|
|
50956
|
+
*/
|
|
50957
|
+
|
|
50958
|
+
|
|
50959
|
+
isCachedSelectedValueValid(dates) {
|
|
50960
|
+
const cachedSelectedValue = dates || this._adapter.getState('cachedSelectedValue');
|
|
50961
|
+
|
|
50962
|
+
const {
|
|
50963
|
+
type
|
|
50964
|
+
} = this._adapter.getProps();
|
|
50965
|
+
|
|
50966
|
+
let isValid = true;
|
|
50967
|
+
|
|
50968
|
+
switch (true) {
|
|
50969
|
+
case type === 'dateRange':
|
|
50970
|
+
case type === 'dateTimeRange':
|
|
50971
|
+
if (!this._isRangeValueComplete(cachedSelectedValue)) {
|
|
50972
|
+
isValid = false;
|
|
50973
|
+
}
|
|
50974
|
+
|
|
50975
|
+
break;
|
|
50976
|
+
|
|
50977
|
+
default:
|
|
50978
|
+
const value = cachedSelectedValue === null || cachedSelectedValue === void 0 ? void 0 : cachedSelectedValue.filter(item => item);
|
|
50979
|
+
|
|
50980
|
+
if (!(Array.isArray(value) && value.length)) {
|
|
50981
|
+
isValid = false;
|
|
50982
|
+
}
|
|
50983
|
+
|
|
50984
|
+
break;
|
|
50985
|
+
}
|
|
50986
|
+
|
|
50987
|
+
return isValid;
|
|
50988
|
+
}
|
|
50989
|
+
/**
|
|
50990
|
+
* 将输入框内容置空
|
|
50991
|
+
*/
|
|
50992
|
+
|
|
50993
|
+
|
|
50994
|
+
clearInputValue() {
|
|
50995
|
+
this._adapter.updateInputValue(null);
|
|
50996
|
+
|
|
50997
|
+
this._adapter.updateInsetInputValue(null);
|
|
50998
|
+
}
|
|
50896
50999
|
/**
|
|
50897
51000
|
* Callback when the content of the input box changes
|
|
50898
51001
|
* Update the date panel if the changed value is a legal date, otherwise only update the input box
|
|
@@ -50995,36 +51098,12 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
50995
51098
|
* @param {String} input
|
|
50996
51099
|
* @param {Event} e
|
|
50997
51100
|
*/
|
|
51101
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
50998
51102
|
|
|
50999
51103
|
|
|
51000
51104
|
handleInputBlur() {
|
|
51001
51105
|
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
51002
51106
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
51003
|
-
const parsedResult = input ? this._isMultiple() ? this.parseMultipleInput(input, ',', true) : this.parseInput(input) : [];
|
|
51004
|
-
const stateValue = this.getState('value'); // console.log(input, parsedResult);
|
|
51005
|
-
|
|
51006
|
-
if (parsedResult && parsedResult.length) {
|
|
51007
|
-
this._updateValueAndInput(parsedResult, input === '');
|
|
51008
|
-
} else if (input === '') {
|
|
51009
|
-
// if clear input, set input to `''`
|
|
51010
|
-
this._updateValueAndInput('', true, '');
|
|
51011
|
-
} else {
|
|
51012
|
-
this._updateValueAndInput(stateValue);
|
|
51013
|
-
}
|
|
51014
|
-
/**
|
|
51015
|
-
* 当不是范围类型且不需要确认时,使用 stateValue 重置 cachedSelectedValue
|
|
51016
|
-
* 这样做的目的是,在输入非法值时,使用上次选中的值作为已选值
|
|
51017
|
-
* needConfirm 或者 range type 时,我们在 close panel 时调用 resetCachedSelectedValue,这里不用重复调用
|
|
51018
|
-
*
|
|
51019
|
-
* Use stateValue to reset cachedSelectedValue when it is not a range type and does not require confirmation
|
|
51020
|
-
* The purpose of this is to use the last selected value as the selected value when an invalid value is entered
|
|
51021
|
-
* When needConfirm or range type, we call resetCachedSelectedValue when close panel, no need to call repeatedly here
|
|
51022
|
-
*/
|
|
51023
|
-
|
|
51024
|
-
|
|
51025
|
-
if (!this._adapter.needConfirm() && !this._isRangeType()) {
|
|
51026
|
-
this.resetCachedSelectedValue(stateValue);
|
|
51027
|
-
}
|
|
51028
51107
|
}
|
|
51029
51108
|
/**
|
|
51030
51109
|
* called when range type rangeEnd input tab press
|
|
@@ -51159,6 +51238,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51159
51238
|
|
|
51160
51239
|
case 'dateRange':
|
|
51161
51240
|
case 'dateTimeRange':
|
|
51241
|
+
case 'monthRange':
|
|
51162
51242
|
const separator = rangeSeparator;
|
|
51163
51243
|
const values = input.split(separator);
|
|
51164
51244
|
parsedResult = values && values.reduce((arr, cur) => {
|
|
@@ -51382,6 +51462,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51382
51462
|
|
|
51383
51463
|
case 'dateRange':
|
|
51384
51464
|
case 'dateTimeRange':
|
|
51465
|
+
case 'monthRange':
|
|
51385
51466
|
const startIsTruthy = !isNullOrUndefined(dates[0]);
|
|
51386
51467
|
const endIsTruthy = !isNullOrUndefined(dates[1]);
|
|
51387
51468
|
|
|
@@ -51430,6 +51511,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51430
51511
|
|
|
51431
51512
|
case 'dateRange':
|
|
51432
51513
|
case 'dateTimeRange':
|
|
51514
|
+
case 'monthRange':
|
|
51433
51515
|
for (let i = 0; i < dates.length; i += 2) {
|
|
51434
51516
|
strs.push(this.formatDates(dates.slice(i, i + 2), customFormat));
|
|
51435
51517
|
}
|
|
@@ -51579,7 +51661,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51579
51661
|
}
|
|
51580
51662
|
}
|
|
51581
51663
|
/**
|
|
51582
|
-
* when changing the year and month through the panel when the type is year or month
|
|
51664
|
+
* when changing the year and month through the panel when the type is year or month or monthRange
|
|
51583
51665
|
* @param {*} item
|
|
51584
51666
|
*/
|
|
51585
51667
|
|
|
@@ -51591,15 +51673,23 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51591
51673
|
currentMonth,
|
|
51592
51674
|
currentYear
|
|
51593
51675
|
} = item;
|
|
51676
|
+
const {
|
|
51677
|
+
type
|
|
51678
|
+
} = this.getProps();
|
|
51594
51679
|
|
|
51595
|
-
if (
|
|
51596
|
-
|
|
51597
|
-
const date = new Date(currentYear, currentMonth - 1);
|
|
51680
|
+
if (type === 'month') {
|
|
51681
|
+
const date = new Date(currentYear['left'], currentMonth['left'] - 1);
|
|
51598
51682
|
this.handleSelectedChange([date]);
|
|
51683
|
+
} else {
|
|
51684
|
+
const dateLeft = new Date(currentYear['left'], currentMonth['left'] - 1);
|
|
51685
|
+
const dateRight = new Date(currentYear['right'], currentMonth['right'] - 1);
|
|
51686
|
+
this.handleSelectedChange([dateLeft, dateRight]);
|
|
51599
51687
|
}
|
|
51600
51688
|
}
|
|
51601
51689
|
|
|
51602
51690
|
handleConfirm() {
|
|
51691
|
+
this.clickConfirmButton = true;
|
|
51692
|
+
|
|
51603
51693
|
const {
|
|
51604
51694
|
cachedSelectedValue,
|
|
51605
51695
|
value
|
|
@@ -51725,6 +51815,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
51725
51815
|
|
|
51726
51816
|
case 'dateRange':
|
|
51727
51817
|
case 'dateTimeRange':
|
|
51818
|
+
case 'monthRange':
|
|
51728
51819
|
notifyValue = _value.map(v => v && this.localeFormat(v, formatToken));
|
|
51729
51820
|
notifyDate = [..._value];
|
|
51730
51821
|
break;
|
|
@@ -52293,6 +52384,13 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
52293
52384
|
text = formatDateValues(value, formatToken, undefined, dateFnsLocale);
|
|
52294
52385
|
break;
|
|
52295
52386
|
|
|
52387
|
+
case 'monthRange':
|
|
52388
|
+
text = formatDateValues(value, formatToken, {
|
|
52389
|
+
groupSize: 2,
|
|
52390
|
+
groupInnerSeparator: rangeSeparator
|
|
52391
|
+
}, dateFnsLocale);
|
|
52392
|
+
break;
|
|
52393
|
+
|
|
52296
52394
|
default:
|
|
52297
52395
|
break;
|
|
52298
52396
|
}
|
|
@@ -52414,7 +52512,8 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
52414
52512
|
getInsetInputPlaceholder() {
|
|
52415
52513
|
const {
|
|
52416
52514
|
type,
|
|
52417
|
-
format
|
|
52515
|
+
format,
|
|
52516
|
+
rangeSeparator
|
|
52418
52517
|
} = this._adapter.getProps();
|
|
52419
52518
|
|
|
52420
52519
|
const insetInputFormat = getInsetInputFormatToken({
|
|
@@ -52433,6 +52532,9 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
52433
52532
|
case 'dateTime':
|
|
52434
52533
|
case 'dateTimeRange':
|
|
52435
52534
|
[datePlaceholder, timePlaceholder] = insetInputFormat.split(' ');
|
|
52535
|
+
|
|
52536
|
+
case 'monthRange':
|
|
52537
|
+
datePlaceholder = insetInputFormat + rangeSeparator + insetInputFormat;
|
|
52436
52538
|
break;
|
|
52437
52539
|
}
|
|
52438
52540
|
|
|
@@ -52517,6 +52619,7 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
52517
52619
|
switch (type) {
|
|
52518
52620
|
case 'date':
|
|
52519
52621
|
case 'month':
|
|
52622
|
+
case 'monthRange':
|
|
52520
52623
|
inputValue = insetInputValue.monthLeft.dateInput;
|
|
52521
52624
|
break;
|
|
52522
52625
|
|
|
@@ -52886,6 +52989,14 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
52886
52989
|
})), this.renderRangeClearBtn(rangeStart, rangeEnd), this.renderRangeSuffix(suffix));
|
|
52887
52990
|
}
|
|
52888
52991
|
|
|
52992
|
+
isRenderMultipleInputs() {
|
|
52993
|
+
const {
|
|
52994
|
+
type
|
|
52995
|
+
} = this.props; // isRange and not monthRange render multiple inputs
|
|
52996
|
+
|
|
52997
|
+
return type.includes('Range') && type !== 'monthRange';
|
|
52998
|
+
}
|
|
52999
|
+
|
|
52889
53000
|
renderInputInset() {
|
|
52890
53001
|
const {
|
|
52891
53002
|
type,
|
|
@@ -52899,9 +53010,6 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
52899
53010
|
density,
|
|
52900
53011
|
insetInput
|
|
52901
53012
|
} = this.props;
|
|
52902
|
-
|
|
52903
|
-
const _isRangeType = type.includes('Range');
|
|
52904
|
-
|
|
52905
53013
|
const newInsetInputValue = this.foundation.getInsetInputValue({
|
|
52906
53014
|
value,
|
|
52907
53015
|
insetInputValue
|
|
@@ -52938,7 +53046,7 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
52938
53046
|
valuePath: 'monthLeft.timeInput',
|
|
52939
53047
|
onChange: this.handleInsetInputChange,
|
|
52940
53048
|
onFocus: handleInsetTimeFocus
|
|
52941
|
-
}),
|
|
53049
|
+
}), this.isRenderMultipleInputs() && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
52942
53050
|
className: separatorCls
|
|
52943
53051
|
}, density === 'compact' ? null : '-'), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(InsetDateInput, {
|
|
52944
53052
|
forwardRef: rangeInputEndRef,
|
|
@@ -52983,6 +53091,7 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
52983
53091
|
prefix,
|
|
52984
53092
|
autofocus,
|
|
52985
53093
|
size,
|
|
53094
|
+
inputRef,
|
|
52986
53095
|
// range input support props, no need passing to not range type
|
|
52987
53096
|
rangeInputStartRef,
|
|
52988
53097
|
rangeInputEndRef,
|
|
@@ -52995,7 +53104,7 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
52995
53104
|
insetInputValue,
|
|
52996
53105
|
defaultPickerValue
|
|
52997
53106
|
} = _a,
|
|
52998
|
-
rest = dateInput_rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue", "defaultPickerValue"]);
|
|
53107
|
+
rest = dateInput_rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "inputRef", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator", "insetInput", "insetInputValue", "defaultPickerValue"]);
|
|
52999
53108
|
|
|
53000
53109
|
const dateIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCalendar, {
|
|
53001
53110
|
"aria-hidden": true
|
|
@@ -53013,22 +53122,23 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
53013
53122
|
}
|
|
53014
53123
|
|
|
53015
53124
|
const inputCls = classnames_default()({
|
|
53016
|
-
[`${prefixCls}-input-readonly`]: inputReadOnly
|
|
53125
|
+
[`${prefixCls}-input-readonly`]: inputReadOnly,
|
|
53126
|
+
[`${prefixCls}-monthRange-input`]: type === 'monthRange'
|
|
53017
53127
|
});
|
|
53018
|
-
const isRangeType = /range/i.test(type);
|
|
53019
53128
|
const rangeProps = Object.assign(Object.assign({}, this.props), {
|
|
53020
53129
|
text,
|
|
53021
53130
|
suffix,
|
|
53022
53131
|
inputCls
|
|
53023
53132
|
});
|
|
53024
|
-
return
|
|
53133
|
+
return this.isRenderMultipleInputs() ? this.renderRangeInput(rangeProps) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(input_0, Object.assign({}, rest, {
|
|
53134
|
+
ref: inputRef,
|
|
53025
53135
|
insetLabel: insetLabel,
|
|
53026
53136
|
disabled: disabled,
|
|
53027
53137
|
readonly: inputReadOnly,
|
|
53028
53138
|
className: inputCls,
|
|
53029
53139
|
style: inputStyle,
|
|
53030
53140
|
hideSuffix: showClear,
|
|
53031
|
-
placeholder: placeholder,
|
|
53141
|
+
placeholder: type === 'monthRange' && Array.isArray(placeholder) ? placeholder[0] + rangeSeparator + placeholder[1] : placeholder,
|
|
53032
53142
|
onEnterPress: this.handleEnterPress,
|
|
53033
53143
|
onChange: this.handleChange,
|
|
53034
53144
|
onClear: this.handleInputClear,
|
|
@@ -56989,6 +57099,8 @@ function setYear(dirtyDate, dirtyYear) {
|
|
|
56989
57099
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/yearAndMonthFoundation.ts
|
|
56990
57100
|
|
|
56991
57101
|
|
|
57102
|
+
|
|
57103
|
+
|
|
56992
57104
|
class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
56993
57105
|
constructor(adapter) {
|
|
56994
57106
|
super(Object.assign({}, adapter));
|
|
@@ -57000,18 +57112,58 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
57000
57112
|
|
|
57001
57113
|
destroy() {}
|
|
57002
57114
|
|
|
57003
|
-
selectYear(item) {
|
|
57004
|
-
const year = item.value;
|
|
57115
|
+
selectYear(item, panelType) {
|
|
57116
|
+
// const year = item.value;
|
|
57117
|
+
const {
|
|
57118
|
+
currentYear,
|
|
57119
|
+
currentMonth
|
|
57120
|
+
} = this.getStates();
|
|
57121
|
+
const {
|
|
57122
|
+
type
|
|
57123
|
+
} = this.getProps();
|
|
57124
|
+
const left = datePicker_constants_strings.PANEL_TYPE_LEFT;
|
|
57125
|
+
const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
57126
|
+
|
|
57127
|
+
const year = cloneDeep_default()(currentYear);
|
|
57128
|
+
|
|
57129
|
+
year[panelType] = item.value; // make sure the right panel time is always less than the left panel time
|
|
57005
57130
|
|
|
57006
|
-
|
|
57131
|
+
if (type === 'monthRange') {
|
|
57132
|
+
const isSameYearIllegalDate = year[left] === year[right] && currentMonth[left] > currentMonth[right];
|
|
57133
|
+
|
|
57134
|
+
if (panelType === left && item.value > year[right] || panelType === left && isSameYearIllegalDate) {
|
|
57135
|
+
// 1. select left year and left year > right year
|
|
57136
|
+
// 2. select left year, left year = right year, but left date > right date
|
|
57137
|
+
year[right] = item.value + 1;
|
|
57138
|
+
} else if (panelType === right && isSameYearIllegalDate) {
|
|
57139
|
+
// 1. select right year, left year = right year, but left date > right date
|
|
57140
|
+
year[left] = item.value - 1;
|
|
57141
|
+
}
|
|
57142
|
+
}
|
|
57143
|
+
|
|
57144
|
+
this._adapter.setCurrentYear(year, () => this.autoSelectMonth(item, panelType, year));
|
|
57007
57145
|
|
|
57008
57146
|
this._adapter.notifySelectYear(year);
|
|
57009
57147
|
}
|
|
57010
57148
|
|
|
57011
|
-
selectMonth(item) {
|
|
57149
|
+
selectMonth(item, panelType) {
|
|
57012
57150
|
const {
|
|
57013
|
-
|
|
57014
|
-
|
|
57151
|
+
currentMonth,
|
|
57152
|
+
currentYear
|
|
57153
|
+
} = this.getStates();
|
|
57154
|
+
const {
|
|
57155
|
+
type
|
|
57156
|
+
} = this.getProps();
|
|
57157
|
+
const left = datePicker_constants_strings.PANEL_TYPE_LEFT;
|
|
57158
|
+
const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
57159
|
+
|
|
57160
|
+
const month = cloneDeep_default()(currentMonth);
|
|
57161
|
+
|
|
57162
|
+
month[panelType] = item.month; // make sure the right panel time is always less than the left panel time
|
|
57163
|
+
|
|
57164
|
+
if (type === 'monthRange' && panelType === left && currentYear[left] === currentYear[right] && item.value > month[right]) {
|
|
57165
|
+
month[right] = item.month + 1;
|
|
57166
|
+
}
|
|
57015
57167
|
|
|
57016
57168
|
this._adapter.setCurrentMonth(month);
|
|
57017
57169
|
|
|
@@ -57022,7 +57174,7 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
57022
57174
|
*/
|
|
57023
57175
|
|
|
57024
57176
|
|
|
57025
|
-
autoSelectMonth(item) {
|
|
57177
|
+
autoSelectMonth(item, panelType, year) {
|
|
57026
57178
|
const {
|
|
57027
57179
|
disabledDate,
|
|
57028
57180
|
locale
|
|
@@ -57034,14 +57186,14 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
57034
57186
|
} = this._adapter.getStates();
|
|
57035
57187
|
|
|
57036
57188
|
const currentDate = setYear(Date.now(), item.year);
|
|
57037
|
-
const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth - 1));
|
|
57189
|
+
const isCurrentMonthDisabled = disabledDate(setMonth(currentDate, currentMonth[panelType] - 1));
|
|
57038
57190
|
|
|
57039
57191
|
if (isCurrentMonthDisabled) {
|
|
57040
57192
|
const currentIndex = months.findIndex(_ref => {
|
|
57041
57193
|
let {
|
|
57042
57194
|
month
|
|
57043
57195
|
} = _ref;
|
|
57044
|
-
return month === currentMonth;
|
|
57196
|
+
return month === currentMonth[panelType];
|
|
57045
57197
|
});
|
|
57046
57198
|
let validMonth; // First look in the back, if you can't find it in the back, then look in the front
|
|
57047
57199
|
|
|
@@ -57062,11 +57214,13 @@ class yearAndMonthFoundation_YearAndMonthFoundation extends foundation {
|
|
|
57062
57214
|
}
|
|
57063
57215
|
|
|
57064
57216
|
if (validMonth) {
|
|
57065
|
-
|
|
57066
|
-
|
|
57067
|
-
|
|
57068
|
-
|
|
57069
|
-
|
|
57217
|
+
const month = cloneDeep_default()(currentMonth);
|
|
57218
|
+
|
|
57219
|
+
month[panelType] = validMonth.month; // change year and month same time
|
|
57220
|
+
|
|
57221
|
+
this._adapter.setCurrentYearAndMonth(year, month);
|
|
57222
|
+
|
|
57223
|
+
this._adapter.notifySelectYearAndMonth(year, month);
|
|
57070
57224
|
}
|
|
57071
57225
|
}
|
|
57072
57226
|
}
|
|
@@ -57090,8 +57244,8 @@ const getYears = () => {
|
|
|
57090
57244
|
|
|
57091
57245
|
|
|
57092
57246
|
|
|
57093
|
-
/* eslint-disable max-len */
|
|
57094
57247
|
|
|
57248
|
+
/* eslint-disable max-len */
|
|
57095
57249
|
|
|
57096
57250
|
|
|
57097
57251
|
|
|
@@ -57110,12 +57264,12 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57110
57264
|
constructor(props) {
|
|
57111
57265
|
super(props);
|
|
57112
57266
|
|
|
57113
|
-
this.selectYear = item => {
|
|
57114
|
-
this.foundation.selectYear(item);
|
|
57267
|
+
this.selectYear = (item, panelType) => {
|
|
57268
|
+
this.foundation.selectYear(item, panelType);
|
|
57115
57269
|
};
|
|
57116
57270
|
|
|
57117
|
-
this.selectMonth = item => {
|
|
57118
|
-
this.foundation.selectMonth(item);
|
|
57271
|
+
this.selectMonth = (item, panelType) => {
|
|
57272
|
+
this.foundation.selectMonth(item, panelType);
|
|
57119
57273
|
};
|
|
57120
57274
|
|
|
57121
57275
|
this.reselect = () => {
|
|
@@ -57139,8 +57293,16 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57139
57293
|
currentYear,
|
|
57140
57294
|
currentMonth
|
|
57141
57295
|
} = props;
|
|
57142
|
-
|
|
57143
|
-
|
|
57296
|
+
const currentLeftYear = currentYear.left || now.getFullYear();
|
|
57297
|
+
const currentLeftMonth = currentMonth.left || now.getMonth() + 1;
|
|
57298
|
+
currentYear = {
|
|
57299
|
+
left: currentLeftYear,
|
|
57300
|
+
right: currentLeftYear
|
|
57301
|
+
};
|
|
57302
|
+
currentMonth = {
|
|
57303
|
+
left: currentLeftMonth,
|
|
57304
|
+
right: currentMonth.right || currentLeftMonth + 1
|
|
57305
|
+
};
|
|
57144
57306
|
this.state = {
|
|
57145
57307
|
years: _utils_getYears().map(year => ({
|
|
57146
57308
|
value: year,
|
|
@@ -57168,6 +57330,10 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57168
57330
|
setCurrentMonth: currentMonth => this.setState({
|
|
57169
57331
|
currentMonth
|
|
57170
57332
|
}),
|
|
57333
|
+
setCurrentYearAndMonth: (currentYear, currentMonth) => this.setState({
|
|
57334
|
+
currentYear,
|
|
57335
|
+
currentMonth
|
|
57336
|
+
}),
|
|
57171
57337
|
notifySelectYear: year => this.props.onSelect({
|
|
57172
57338
|
currentMonth: this.state.currentMonth,
|
|
57173
57339
|
currentYear: year
|
|
@@ -57176,26 +57342,29 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57176
57342
|
currentYear: this.state.currentYear,
|
|
57177
57343
|
currentMonth: month
|
|
57178
57344
|
}),
|
|
57345
|
+
notifySelectYearAndMonth: (year, month) => this.props.onSelect({
|
|
57346
|
+
currentYear: year,
|
|
57347
|
+
currentMonth: month
|
|
57348
|
+
}),
|
|
57179
57349
|
notifyBackToMain: () => this.props.onBackToMain()
|
|
57180
57350
|
});
|
|
57181
57351
|
}
|
|
57182
57352
|
|
|
57183
57353
|
static getDerivedStateFromProps(props, state) {
|
|
57184
57354
|
const willUpdateStates = {};
|
|
57185
|
-
const now = new Date();
|
|
57186
57355
|
|
|
57187
|
-
if (!
|
|
57188
|
-
willUpdateStates.
|
|
57356
|
+
if (!isEqual_default()(props.currentYear, state.currentYear) && props.currentYear.left !== 0) {
|
|
57357
|
+
willUpdateStates.currentYear = props.currentYear;
|
|
57189
57358
|
}
|
|
57190
57359
|
|
|
57191
|
-
if (
|
|
57192
|
-
willUpdateStates.
|
|
57360
|
+
if (!isEqual_default()(props.currentMonth, state.currentMonth) && props.currentMonth.left !== 0) {
|
|
57361
|
+
willUpdateStates.currentMonth = props.currentMonth;
|
|
57193
57362
|
}
|
|
57194
57363
|
|
|
57195
57364
|
return willUpdateStates;
|
|
57196
57365
|
}
|
|
57197
57366
|
|
|
57198
|
-
renderColYear() {
|
|
57367
|
+
renderColYear(panelType) {
|
|
57199
57368
|
const {
|
|
57200
57369
|
years,
|
|
57201
57370
|
currentYear,
|
|
@@ -57208,7 +57377,22 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57208
57377
|
yearCycled,
|
|
57209
57378
|
yearAndMonthOpts
|
|
57210
57379
|
} = this.props;
|
|
57211
|
-
const currentDate = setMonth(Date.now(), currentMonth - 1);
|
|
57380
|
+
const currentDate = setMonth(Date.now(), currentMonth[panelType] - 1);
|
|
57381
|
+
const left = datePicker_constants_strings.PANEL_TYPE_LEFT;
|
|
57382
|
+
const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
57383
|
+
|
|
57384
|
+
const needDisabled = year => {
|
|
57385
|
+
if (panelType === right && currentYear[left]) {
|
|
57386
|
+
if (currentMonth[left] <= currentMonth[right]) {
|
|
57387
|
+
return currentYear[left] > year;
|
|
57388
|
+
} else {
|
|
57389
|
+
return currentYear[left] >= year;
|
|
57390
|
+
}
|
|
57391
|
+
}
|
|
57392
|
+
|
|
57393
|
+
return false;
|
|
57394
|
+
};
|
|
57395
|
+
|
|
57212
57396
|
const list = years.map(_ref => {
|
|
57213
57397
|
let {
|
|
57214
57398
|
value,
|
|
@@ -57223,10 +57407,11 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57223
57407
|
month: month - 1
|
|
57224
57408
|
}));
|
|
57225
57409
|
});
|
|
57410
|
+
const isRightPanelDisabled = needDisabled(year);
|
|
57226
57411
|
return {
|
|
57227
57412
|
year,
|
|
57228
57413
|
value,
|
|
57229
|
-
disabled: isAllMonthDisabled
|
|
57414
|
+
disabled: isAllMonthDisabled || isRightPanelDisabled
|
|
57230
57415
|
};
|
|
57231
57416
|
});
|
|
57232
57417
|
|
|
@@ -57242,14 +57427,14 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57242
57427
|
cycled: yearCycled,
|
|
57243
57428
|
list: list,
|
|
57244
57429
|
transform: transform,
|
|
57245
|
-
selectedIndex: years.findIndex(item => item.value === currentYear),
|
|
57430
|
+
selectedIndex: years.findIndex(item => item.value === currentYear[panelType]),
|
|
57246
57431
|
type: "year",
|
|
57247
|
-
onSelect: this.selectYear,
|
|
57432
|
+
onSelect: item => this.selectYear(item, panelType),
|
|
57248
57433
|
mode: "normal"
|
|
57249
57434
|
}, yearAndMonthOpts));
|
|
57250
57435
|
}
|
|
57251
57436
|
|
|
57252
|
-
renderColMonth() {
|
|
57437
|
+
renderColMonth(panelType) {
|
|
57253
57438
|
const {
|
|
57254
57439
|
months,
|
|
57255
57440
|
currentMonth,
|
|
@@ -57265,7 +57450,9 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57265
57450
|
|
|
57266
57451
|
let transform = val => val;
|
|
57267
57452
|
|
|
57268
|
-
const currentDate = setYear(Date.now(), currentYear);
|
|
57453
|
+
const currentDate = setYear(Date.now(), currentYear[panelType]);
|
|
57454
|
+
const left = datePicker_constants_strings.PANEL_TYPE_LEFT;
|
|
57455
|
+
const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
57269
57456
|
|
|
57270
57457
|
if (localeCode === 'zh-CN' || localeCode === 'zh-TW') {
|
|
57271
57458
|
// Only Chinese needs to add [month] after the selected month
|
|
@@ -57278,14 +57465,15 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57278
57465
|
value,
|
|
57279
57466
|
month
|
|
57280
57467
|
} = _ref3;
|
|
57468
|
+
const isRightPanelDisabled = panelType === right && currentMonth[left] && currentYear[left] === currentYear[right] && currentMonth[left] > month;
|
|
57281
57469
|
return {
|
|
57282
57470
|
month,
|
|
57283
|
-
disabled: disabledDate(setMonth(currentDate, month - 1)),
|
|
57471
|
+
disabled: disabledDate(setMonth(currentDate, month - 1)) || isRightPanelDisabled,
|
|
57284
57472
|
value: locale.fullMonths[value] // Actual rendered text
|
|
57285
57473
|
|
|
57286
57474
|
};
|
|
57287
57475
|
});
|
|
57288
|
-
const selectedIndex = list.findIndex(item => item.month === currentMonth);
|
|
57476
|
+
const selectedIndex = list.findIndex(item => item.month === currentMonth[panelType]);
|
|
57289
57477
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(scrollItem_ScrollItem, Object.assign({
|
|
57290
57478
|
ref: this.monthRef,
|
|
57291
57479
|
cycled: monthCycled,
|
|
@@ -57293,11 +57481,15 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57293
57481
|
transform: transform,
|
|
57294
57482
|
selectedIndex: selectedIndex,
|
|
57295
57483
|
type: "month",
|
|
57296
|
-
onSelect: this.selectMonth,
|
|
57484
|
+
onSelect: item => this.selectMonth(item, panelType),
|
|
57297
57485
|
mode: 'normal'
|
|
57298
57486
|
}, yearAndMonthOpts));
|
|
57299
57487
|
}
|
|
57300
57488
|
|
|
57489
|
+
renderPanel(panelType) {
|
|
57490
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(scrollList_0, null, this.renderColYear(panelType), this.renderColMonth(panelType)));
|
|
57491
|
+
}
|
|
57492
|
+
|
|
57301
57493
|
render() {
|
|
57302
57494
|
const {
|
|
57303
57495
|
locale,
|
|
@@ -57305,13 +57497,27 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57305
57497
|
density,
|
|
57306
57498
|
presetPosition,
|
|
57307
57499
|
renderQuickControls,
|
|
57308
|
-
renderDateInput
|
|
57500
|
+
renderDateInput,
|
|
57501
|
+
type
|
|
57309
57502
|
} = this.props;
|
|
57310
|
-
const prefix = `${yearAndMonth_prefixCls}-yearmonth-header`;
|
|
57503
|
+
const prefix = `${yearAndMonth_prefixCls}-yearmonth-header`;
|
|
57504
|
+
const bodyCls = `${yearAndMonth_prefixCls}-yearmonth-body`; // i18n
|
|
57311
57505
|
|
|
57312
57506
|
const selectDateText = locale.selectDate;
|
|
57313
57507
|
const iconSize = density === 'compact' ? 'default' : 'large';
|
|
57314
57508
|
const buttonSize = density === 'compact' ? 'small' : 'default';
|
|
57509
|
+
const panelTypeLeft = datePicker_constants_strings.PANEL_TYPE_LEFT;
|
|
57510
|
+
const panelTypeRight = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
57511
|
+
let content = null;
|
|
57512
|
+
|
|
57513
|
+
if (type === 'month') {
|
|
57514
|
+
content = this.renderPanel(panelTypeLeft);
|
|
57515
|
+
} else {
|
|
57516
|
+
content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
57517
|
+
className: bodyCls
|
|
57518
|
+
}, this.renderPanel(panelTypeLeft), this.renderPanel(panelTypeRight));
|
|
57519
|
+
}
|
|
57520
|
+
|
|
57315
57521
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, noBackBtn ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
57316
57522
|
className: prefix
|
|
57317
57523
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(iconButton_0, {
|
|
@@ -57326,14 +57532,14 @@ class yearAndMonth_YearAndMonth extends baseComponent_BaseComponent {
|
|
|
57326
57532
|
style: {
|
|
57327
57533
|
display: 'flex'
|
|
57328
57534
|
}
|
|
57329
|
-
}, presetPosition === "left" && renderQuickControls, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", null, renderDateInput,
|
|
57535
|
+
}, presetPosition === "left" && type !== 'monthRange' && renderQuickControls, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", null, renderDateInput, content), presetPosition === "right" && type !== 'monthRange' && renderQuickControls) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, renderDateInput, content));
|
|
57330
57536
|
}
|
|
57331
57537
|
|
|
57332
57538
|
}
|
|
57333
57539
|
|
|
57334
57540
|
yearAndMonth_YearAndMonth.propTypes = {
|
|
57335
|
-
currentYear: prop_types_default.a.
|
|
57336
|
-
currentMonth: prop_types_default.a.
|
|
57541
|
+
currentYear: prop_types_default.a.object,
|
|
57542
|
+
currentMonth: prop_types_default.a.object,
|
|
57337
57543
|
onSelect: prop_types_default.a.func,
|
|
57338
57544
|
locale: prop_types_default.a.object,
|
|
57339
57545
|
localeCode: prop_types_default.a.string,
|
|
@@ -57344,14 +57550,16 @@ yearAndMonth_YearAndMonth.propTypes = {
|
|
|
57344
57550
|
density: prop_types_default.a.string,
|
|
57345
57551
|
presetPosition: prop_types_default.a.oneOf(datePicker_constants_strings.PRESET_POSITION_SET),
|
|
57346
57552
|
renderQuickControls: prop_types_default.a.node,
|
|
57347
|
-
renderDateInput: prop_types_default.a.node
|
|
57553
|
+
renderDateInput: prop_types_default.a.node,
|
|
57554
|
+
type: prop_types_default.a.oneOf(datePicker_constants_strings.TYPE_SET)
|
|
57348
57555
|
};
|
|
57349
57556
|
yearAndMonth_YearAndMonth.defaultProps = {
|
|
57350
57557
|
disabledDate: stubFalse_default.a,
|
|
57351
57558
|
monthCycled: false,
|
|
57352
57559
|
yearCycled: false,
|
|
57353
57560
|
noBackBtn: false,
|
|
57354
|
-
onSelect: noop_default.a
|
|
57561
|
+
onSelect: noop_default.a,
|
|
57562
|
+
type: 'month'
|
|
57355
57563
|
};
|
|
57356
57564
|
/* harmony default export */ var yearAndMonth = (yearAndMonth_YearAndMonth);
|
|
57357
57565
|
// CONCATENATED MODULE: ./datePicker/monthsGrid.tsx
|
|
@@ -57839,9 +58047,17 @@ class monthsGrid_MonthsGrid extends baseComponent_BaseComponent {
|
|
|
57839
58047
|
ref: current => this.cacheRefCurrent(`yam-${panelType}`, current),
|
|
57840
58048
|
locale: locale,
|
|
57841
58049
|
localeCode: localeCode,
|
|
57842
|
-
currentYear
|
|
57843
|
-
currentMonth
|
|
57844
|
-
|
|
58050
|
+
// currentYear={y}
|
|
58051
|
+
// currentMonth={m}
|
|
58052
|
+
currentYear: {
|
|
58053
|
+
left: y,
|
|
58054
|
+
right: 0
|
|
58055
|
+
},
|
|
58056
|
+
currentMonth: {
|
|
58057
|
+
left: m,
|
|
58058
|
+
right: 0
|
|
58059
|
+
},
|
|
58060
|
+
onSelect: item => this.foundation.toYearMonth(panelType, new Date(item.currentYear.left, item.currentMonth.left - 1)),
|
|
57845
58061
|
onBackToMain: () => {
|
|
57846
58062
|
this.foundation.showDatePanel(panelType);
|
|
57847
58063
|
const wrapCurrent = this.adapter.getCache(`wrap-${panelType}`);
|
|
@@ -58302,7 +58518,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58302
58518
|
density,
|
|
58303
58519
|
topSlot,
|
|
58304
58520
|
bottomSlot,
|
|
58305
|
-
presetPosition
|
|
58521
|
+
presetPosition,
|
|
58522
|
+
type
|
|
58306
58523
|
} = this.props;
|
|
58307
58524
|
const wrapCls = classnames_default()(datePicker_constants_cssClasses.PREFIX, {
|
|
58308
58525
|
[datePicker_constants_cssClasses.PANEL_YAM]: this.adapter.typeIsYearOrMonth(),
|
|
@@ -58311,11 +58528,12 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58311
58528
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
58312
58529
|
ref: this.panelRef,
|
|
58313
58530
|
className: wrapCls,
|
|
58314
|
-
style: dropdownStyle
|
|
58531
|
+
style: dropdownStyle,
|
|
58532
|
+
"x-type": type
|
|
58315
58533
|
}, topSlot && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
58316
58534
|
className: `${datePicker_constants_cssClasses.PREFIX}-topSlot`,
|
|
58317
58535
|
"x-semi-prop": "topSlot"
|
|
58318
|
-
}, topSlot), presetPosition === "top" && this.renderQuickControls(), this.adapter.typeIsYearOrMonth() ? this.renderYearMonthPanel(locale, localeCode) : this.renderMonthGrid(locale, localeCode, dateFnsLocale), presetPosition === "bottom" && this.renderQuickControls(), bottomSlot && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
58536
|
+
}, topSlot), presetPosition === "top" && type !== 'monthRange' && this.renderQuickControls(), this.adapter.typeIsYearOrMonth() ? this.renderYearMonthPanel(locale, localeCode) : this.renderMonthGrid(locale, localeCode, dateFnsLocale), presetPosition === "bottom" && type !== 'monthRange' && this.renderQuickControls(), bottomSlot && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
58319
58537
|
className: `${datePicker_constants_cssClasses.PREFIX}-bottomSlot`,
|
|
58320
58538
|
"x-semi-prop": "bottomSlot"
|
|
58321
58539
|
}, bottomSlot), this.renderFooter(locale, localeCode));
|
|
@@ -58325,15 +58543,31 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58325
58543
|
const {
|
|
58326
58544
|
density,
|
|
58327
58545
|
presetPosition,
|
|
58328
|
-
yearAndMonthOpts
|
|
58546
|
+
yearAndMonthOpts,
|
|
58547
|
+
type
|
|
58329
58548
|
} = this.props;
|
|
58330
58549
|
const date = this.state.value[0];
|
|
58331
|
-
|
|
58332
|
-
|
|
58550
|
+
const year = {
|
|
58551
|
+
left: 0,
|
|
58552
|
+
right: 0
|
|
58553
|
+
};
|
|
58554
|
+
const month = {
|
|
58555
|
+
left: 0,
|
|
58556
|
+
right: 0
|
|
58557
|
+
};
|
|
58333
58558
|
|
|
58334
58559
|
if (isDate_default()(date)) {
|
|
58335
|
-
year = date.getFullYear();
|
|
58336
|
-
month = date.getMonth() + 1;
|
|
58560
|
+
year.left = date.getFullYear();
|
|
58561
|
+
month.left = date.getMonth() + 1;
|
|
58562
|
+
}
|
|
58563
|
+
|
|
58564
|
+
if (type === 'monthRange') {
|
|
58565
|
+
const dateRight = this.state.value[1];
|
|
58566
|
+
|
|
58567
|
+
if (isDate_default()(dateRight)) {
|
|
58568
|
+
year.right = dateRight.getFullYear();
|
|
58569
|
+
month.right = dateRight.getMonth() + 1;
|
|
58570
|
+
}
|
|
58337
58571
|
}
|
|
58338
58572
|
|
|
58339
58573
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(yearAndMonth, {
|
|
@@ -58349,6 +58583,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58349
58583
|
presetPosition: presetPosition,
|
|
58350
58584
|
renderQuickControls: this.renderQuickControls(),
|
|
58351
58585
|
renderDateInput: this.renderDateInput(),
|
|
58586
|
+
type: type,
|
|
58352
58587
|
yearAndMonthOpts: yearAndMonthOpts
|
|
58353
58588
|
});
|
|
58354
58589
|
};
|
|
@@ -58408,6 +58643,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58408
58643
|
this.triggerElRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58409
58644
|
this.panelRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58410
58645
|
this.monthGrid = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58646
|
+
this.inputRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58411
58647
|
this.rangeInputStartRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58412
58648
|
this.rangeInputEndRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
58413
58649
|
this.focusRecordsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef(); // @ts-ignore ignore readonly
|
|
@@ -58423,10 +58659,10 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58423
58659
|
var _this2 = this;
|
|
58424
58660
|
|
|
58425
58661
|
return Object.assign(Object.assign({}, super.adapter), {
|
|
58426
|
-
togglePanel: panelShow => {
|
|
58662
|
+
togglePanel: (panelShow, cb) => {
|
|
58427
58663
|
this.setState({
|
|
58428
58664
|
panelShow
|
|
58429
|
-
});
|
|
58665
|
+
}, cb);
|
|
58430
58666
|
|
|
58431
58667
|
if (!panelShow) {
|
|
58432
58668
|
this.focusRecordsRef.current.rangeEnd = false;
|
|
@@ -58440,17 +58676,20 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58440
58676
|
}
|
|
58441
58677
|
|
|
58442
58678
|
this.clickOutSideHandler = e => {
|
|
58443
|
-
if (this.adapter.needConfirm()) {
|
|
58444
|
-
return;
|
|
58445
|
-
}
|
|
58446
|
-
|
|
58447
58679
|
const triggerEl = this.triggerElRef && this.triggerElRef.current;
|
|
58448
58680
|
const panelEl = this.panelRef && this.panelRef.current;
|
|
58449
58681
|
const isInTrigger = triggerEl && triggerEl.contains(e.target);
|
|
58450
58682
|
const isInPanel = panelEl && panelEl.contains(e.target);
|
|
58683
|
+
const clickOutSide = !isInTrigger && !isInPanel && this._mounted;
|
|
58451
58684
|
|
|
58452
|
-
if (
|
|
58453
|
-
this.
|
|
58685
|
+
if (this.adapter.needConfirm()) {
|
|
58686
|
+
clickOutSide && this.props.onClickOutSide();
|
|
58687
|
+
return;
|
|
58688
|
+
} else {
|
|
58689
|
+
if (clickOutSide) {
|
|
58690
|
+
this.props.onClickOutSide();
|
|
58691
|
+
this.foundation.closePanel(e);
|
|
58692
|
+
}
|
|
58454
58693
|
}
|
|
58455
58694
|
};
|
|
58456
58695
|
|
|
@@ -58517,7 +58756,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58517
58756
|
}
|
|
58518
58757
|
},
|
|
58519
58758
|
needConfirm: () => ['dateTime', 'dateTimeRange'].includes(this.props.type) && this.props.needConfirm === true,
|
|
58520
|
-
typeIsYearOrMonth: () => ['month', 'year'].includes(this.props.type),
|
|
58759
|
+
typeIsYearOrMonth: () => ['month', 'year', 'monthRange'].includes(this.props.type),
|
|
58521
58760
|
setRangeInputFocus: rangeInputFocus => {
|
|
58522
58761
|
const {
|
|
58523
58762
|
preventScroll
|
|
@@ -58619,6 +58858,39 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58619
58858
|
break;
|
|
58620
58859
|
}
|
|
58621
58860
|
},
|
|
58861
|
+
setInputFocus: () => {
|
|
58862
|
+
const {
|
|
58863
|
+
preventScroll
|
|
58864
|
+
} = this.props;
|
|
58865
|
+
|
|
58866
|
+
const inputNode = get_default()(this, 'inputRef.current');
|
|
58867
|
+
|
|
58868
|
+
inputNode && inputNode.focus({
|
|
58869
|
+
preventScroll
|
|
58870
|
+
});
|
|
58871
|
+
},
|
|
58872
|
+
setInputBlur: () => {
|
|
58873
|
+
const inputNode = get_default()(this, 'inputRef.current');
|
|
58874
|
+
|
|
58875
|
+
inputNode && inputNode.blur();
|
|
58876
|
+
},
|
|
58877
|
+
setRangeInputBlur: () => {
|
|
58878
|
+
const {
|
|
58879
|
+
rangeInputFocus
|
|
58880
|
+
} = this.state;
|
|
58881
|
+
|
|
58882
|
+
if (rangeInputFocus === 'rangeStart') {
|
|
58883
|
+
const inputStartNode = get_default()(this, 'rangeInputStartRef.current');
|
|
58884
|
+
|
|
58885
|
+
inputStartNode && inputStartNode.blur();
|
|
58886
|
+
} else if (rangeInputFocus === 'rangeEnd') {
|
|
58887
|
+
const inputEndNode = get_default()(this, 'rangeInputEndRef.current');
|
|
58888
|
+
|
|
58889
|
+
inputEndNode && inputEndNode.blur();
|
|
58890
|
+
}
|
|
58891
|
+
|
|
58892
|
+
this.adapter.setRangeInputFocus(false);
|
|
58893
|
+
},
|
|
58622
58894
|
setTriggerDisabled: disabled => {
|
|
58623
58895
|
this.setState({
|
|
58624
58896
|
triggerDisabled: disabled
|
|
@@ -58661,6 +58933,33 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58661
58933
|
super.componentWillUnmount();
|
|
58662
58934
|
}
|
|
58663
58935
|
|
|
58936
|
+
open() {
|
|
58937
|
+
this.foundation.open();
|
|
58938
|
+
}
|
|
58939
|
+
|
|
58940
|
+
close() {
|
|
58941
|
+
this.foundation.close();
|
|
58942
|
+
}
|
|
58943
|
+
/**
|
|
58944
|
+
*
|
|
58945
|
+
* When selecting a range, the default focus is on the start input box, passing in `rangeEnd` can focus on the end input box
|
|
58946
|
+
*
|
|
58947
|
+
* When `insetInput` is `true`, due to trigger disabled, the cursor will focus on the input box of the popup layer panel
|
|
58948
|
+
*
|
|
58949
|
+
* 范围选择时,默认聚焦在开始输入框,传入 `rangeEnd` 可以聚焦在结束输入框
|
|
58950
|
+
*
|
|
58951
|
+
* `insetInput` 打开时,由于 trigger 禁用,会把焦点放在弹出面板的输入框上
|
|
58952
|
+
*/
|
|
58953
|
+
|
|
58954
|
+
|
|
58955
|
+
focus(focusType) {
|
|
58956
|
+
this.foundation.focus(focusType);
|
|
58957
|
+
}
|
|
58958
|
+
|
|
58959
|
+
blur() {
|
|
58960
|
+
this.foundation.blur();
|
|
58961
|
+
}
|
|
58962
|
+
|
|
58664
58963
|
renderMonthGrid(locale, localeCode, dateFnsLocale) {
|
|
58665
58964
|
const {
|
|
58666
58965
|
type,
|
|
@@ -58782,7 +59081,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58782
59081
|
})) : null;
|
|
58783
59082
|
}
|
|
58784
59083
|
|
|
58785
|
-
renderInner(
|
|
59084
|
+
renderInner() {
|
|
58786
59085
|
const {
|
|
58787
59086
|
clearIcon,
|
|
58788
59087
|
type,
|
|
@@ -58824,7 +59123,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58824
59123
|
const phText = placeholder || locale.placeholder[type]; // i18n
|
|
58825
59124
|
// These values should be passed to triggerRender, do not delete any key if it is not necessary
|
|
58826
59125
|
|
|
58827
|
-
const props =
|
|
59126
|
+
const props = {
|
|
58828
59127
|
placeholder: phText,
|
|
58829
59128
|
clearIcon,
|
|
58830
59129
|
disabled: inputDisabled,
|
|
@@ -58858,8 +59157,9 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
58858
59157
|
onRangeClear: this.handleRangeInputClear,
|
|
58859
59158
|
onRangeEndTabPress: this.handleRangeEndTabPress,
|
|
58860
59159
|
rangeInputStartRef: insetInput ? null : this.rangeInputStartRef,
|
|
58861
|
-
rangeInputEndRef: insetInput ? null : this.rangeInputEndRef
|
|
58862
|
-
|
|
59160
|
+
rangeInputEndRef: insetInput ? null : this.rangeInputEndRef,
|
|
59161
|
+
inputRef: this.inputRef
|
|
59162
|
+
};
|
|
58863
59163
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
58864
59164
|
// tooltip will mount a11y props to children
|
|
58865
59165
|
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
@@ -58974,7 +59274,8 @@ datePicker_DatePicker.propTypes = {
|
|
|
58974
59274
|
onPanelChange: prop_types_default.a.func,
|
|
58975
59275
|
rangeSeparator: prop_types_default.a.string,
|
|
58976
59276
|
preventScroll: prop_types_default.a.bool,
|
|
58977
|
-
yearAndMonthOpts: prop_types_default.a.object
|
|
59277
|
+
yearAndMonthOpts: prop_types_default.a.object,
|
|
59278
|
+
onClickOutSide: prop_types_default.a.func
|
|
58978
59279
|
};
|
|
58979
59280
|
datePicker_DatePicker.defaultProps = {
|
|
58980
59281
|
onChangeWithDateFirst: true,
|
|
@@ -59011,7 +59312,8 @@ datePicker_DatePicker.defaultProps = {
|
|
|
59011
59312
|
autoSwitchDate: true,
|
|
59012
59313
|
syncSwitchMonth: false,
|
|
59013
59314
|
rangeSeparator: datePicker_constants_strings.DEFAULT_SEPARATOR_RANGE,
|
|
59014
|
-
insetInput: false
|
|
59315
|
+
insetInput: false,
|
|
59316
|
+
onClickOutSide: noop_default.a
|
|
59015
59317
|
};
|
|
59016
59318
|
// CONCATENATED MODULE: ./datePicker/index.tsx
|
|
59017
59319
|
|
|
@@ -73524,11 +73826,14 @@ class select_Select extends baseComponent_BaseComponent {
|
|
|
73524
73826
|
}, arrowIcon) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
73525
73827
|
className: `${select_prefixcls}-arrow-empty`
|
|
73526
73828
|
});
|
|
73527
|
-
const clear = clearIcon ? clearIcon : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconClear, null);
|
|
73829
|
+
const clear = clearIcon ? clearIcon : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconClear, null); // semantics of onSearch are more in line with behavior, onChange is alias of onSearch, will be deprecate next major version
|
|
73830
|
+
|
|
73528
73831
|
const inner = useCustomTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(trigger_0, {
|
|
73529
73832
|
value: Array.from(selections.values()),
|
|
73530
73833
|
inputValue: inputValue,
|
|
73531
73834
|
onChange: this.handleInputChange,
|
|
73835
|
+
onSearch: this.handleInputChange,
|
|
73836
|
+
onRemove: item => this.foundation.removeTag(item),
|
|
73532
73837
|
onClear: this.onClear,
|
|
73533
73838
|
disabled: disabled,
|
|
73534
73839
|
triggerRender: triggerRender,
|
|
@@ -77045,7 +77350,7 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
|
|
|
77045
77350
|
key: "dialog-element",
|
|
77046
77351
|
role: "dialog",
|
|
77047
77352
|
tabIndex: -1,
|
|
77048
|
-
className: classnames_default()(`${SideSheetContent_prefixCls}-inner`, `${SideSheetContent_prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : ""),
|
|
77353
|
+
className: classnames_default()(`${SideSheetContent_prefixCls}-inner`, `${SideSheetContent_prefixCls}-inner-wrap`, (_a = this.props.dialogClassName) !== null && _a !== void 0 ? _a : "", `${SideSheetContent_prefixCls}-size-${props.size}`),
|
|
77049
77354
|
// onMouseDown={this.onDialogMouseDown}
|
|
77050
77355
|
style: Object.assign(Object.assign({}, props.style), style)
|
|
77051
77356
|
}, this.props.wrapperExtraProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
@@ -77068,7 +77373,8 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
|
|
|
77068
77373
|
width
|
|
77069
77374
|
} = this.props;
|
|
77070
77375
|
const wrapperCls = classnames_default()(className, {
|
|
77071
|
-
[`${SideSheetContent_prefixCls}-fixed`]: !mask
|
|
77376
|
+
[`${SideSheetContent_prefixCls}-fixed`]: !mask,
|
|
77377
|
+
[`${SideSheetContent_prefixCls}-size-${this.props.size}`]: !mask
|
|
77072
77378
|
});
|
|
77073
77379
|
const wrapperStyle = {};
|
|
77074
77380
|
|
|
@@ -77316,7 +77622,6 @@ class sideSheet_SideSheet extends baseComponent_BaseComponent {
|
|
|
77316
77622
|
} = this.context;
|
|
77317
77623
|
const isVertical = placement === 'left' || placement === 'right';
|
|
77318
77624
|
const isHorizontal = placement === 'top' || placement === 'bottom';
|
|
77319
|
-
const sheetWidth = isVertical ? width ? width : defaultWidthList[size] : '100%';
|
|
77320
77625
|
const sheetHeight = isHorizontal ? height ? height : sideSheet_defaultHeight : '100%';
|
|
77321
77626
|
const classList = classnames_default()(sideSheet_prefixCls, className, {
|
|
77322
77627
|
[`${sideSheet_prefixCls}-${placement}`]: placement,
|
|
@@ -77325,11 +77630,15 @@ class sideSheet_SideSheet extends baseComponent_BaseComponent {
|
|
|
77325
77630
|
[`${sideSheet_prefixCls}-rtl`]: direction === 'rtl',
|
|
77326
77631
|
[`${sideSheet_prefixCls}-hidden`]: keepDOM && this.state.displayNone
|
|
77327
77632
|
});
|
|
77328
|
-
const contentProps = Object.assign(Object.assign({},
|
|
77633
|
+
const contentProps = Object.assign(Object.assign(Object.assign({}, isVertical ? width ? {
|
|
77634
|
+
width
|
|
77635
|
+
} : {} : {
|
|
77636
|
+
width: "100%"
|
|
77637
|
+
}), props), {
|
|
77329
77638
|
visible,
|
|
77330
77639
|
motion: false,
|
|
77640
|
+
size,
|
|
77331
77641
|
className: classList,
|
|
77332
|
-
width: sheetWidth,
|
|
77333
77642
|
height: sheetHeight,
|
|
77334
77643
|
onClose: this.handleCancel
|
|
77335
77644
|
});
|
|
@@ -79923,11 +80232,8 @@ class foundation_SwitchFoundation extends foundation {
|
|
|
79923
80232
|
|
|
79924
80233
|
init() {
|
|
79925
80234
|
const {
|
|
79926
|
-
defaultChecked,
|
|
79927
|
-
checked,
|
|
79928
80235
|
disabled
|
|
79929
80236
|
} = this.getProps();
|
|
79930
|
-
this.setChecked(defaultChecked || checked);
|
|
79931
80237
|
this.setDisabled(disabled);
|
|
79932
80238
|
}
|
|
79933
80239
|
|
|
@@ -80006,7 +80312,7 @@ class switch_Switch extends baseComponent_BaseComponent {
|
|
|
80006
80312
|
};
|
|
80007
80313
|
|
|
80008
80314
|
this.state = {
|
|
80009
|
-
nativeControlChecked:
|
|
80315
|
+
nativeControlChecked: props.defaultChecked || props.checked,
|
|
80010
80316
|
nativeControlDisabled: false,
|
|
80011
80317
|
focusVisible: false
|
|
80012
80318
|
};
|
|
@@ -93698,7 +94004,8 @@ class foundation_TreeSelectFoundation extends foundation {
|
|
|
93698
94004
|
isFocus
|
|
93699
94005
|
} = this.getStates();
|
|
93700
94006
|
const {
|
|
93701
|
-
searchPosition
|
|
94007
|
+
searchPosition,
|
|
94008
|
+
clickTriggerToHide
|
|
93702
94009
|
} = this.getProps();
|
|
93703
94010
|
|
|
93704
94011
|
if (isDisabled) {
|
|
@@ -93713,7 +94020,7 @@ class foundation_TreeSelectFoundation extends foundation {
|
|
|
93713
94020
|
return;
|
|
93714
94021
|
}
|
|
93715
94022
|
|
|
93716
|
-
this.close(e);
|
|
94023
|
+
clickTriggerToHide && this.close(e);
|
|
93717
94024
|
} else {
|
|
93718
94025
|
this.open();
|
|
93719
94026
|
}
|
|
@@ -94701,7 +95008,9 @@ class treeSelect_TreeSelect extends baseComponent_BaseComponent {
|
|
|
94701
95008
|
onClear: this.handleClear,
|
|
94702
95009
|
componentName: 'TreeSelect',
|
|
94703
95010
|
triggerRender: triggerRender,
|
|
94704
|
-
componentProps: Object.assign({}, this.props)
|
|
95011
|
+
componentProps: Object.assign({}, this.props),
|
|
95012
|
+
onSearch: this.search,
|
|
95013
|
+
onRemove: this.removeTag
|
|
94705
95014
|
}) : [/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_["Fragment"], {
|
|
94706
95015
|
key: 'prefix'
|
|
94707
95016
|
}, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_["Fragment"], {
|
|
@@ -95635,7 +95944,8 @@ treeSelect_TreeSelect.propTypes = {
|
|
|
95635
95944
|
'aria-label': prop_types_default.a.string,
|
|
95636
95945
|
showRestTagsPopover: prop_types_default.a.bool,
|
|
95637
95946
|
restTagsPopoverProps: prop_types_default.a.object,
|
|
95638
|
-
preventScroll: prop_types_default.a.bool
|
|
95947
|
+
preventScroll: prop_types_default.a.bool,
|
|
95948
|
+
clickTriggerToHide: prop_types_default.a.bool
|
|
95639
95949
|
};
|
|
95640
95950
|
treeSelect_TreeSelect.defaultProps = {
|
|
95641
95951
|
searchPosition: treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN,
|
|
@@ -95665,7 +95975,8 @@ treeSelect_TreeSelect.defaultProps = {
|
|
|
95665
95975
|
checkRelation: 'related',
|
|
95666
95976
|
'aria-label': 'TreeSelect',
|
|
95667
95977
|
showRestTagsPopover: false,
|
|
95668
|
-
restTagsPopoverProps: {}
|
|
95978
|
+
restTagsPopoverProps: {},
|
|
95979
|
+
clickTriggerToHide: true
|
|
95669
95980
|
};
|
|
95670
95981
|
/* harmony default export */ var treeSelect_0 = (treeSelect_TreeSelect);
|
|
95671
95982
|
// CONCATENATED MODULE: ../semi-foundation/upload/constants.ts
|