@douyinfe/semi-ui 2.10.2 → 2.11.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/anchor/link.tsx +2 -2
- package/autoComplete/index.tsx +3 -3
- package/avatar/interface.ts +2 -2
- package/badge/index.tsx +1 -1
- package/banner/index.tsx +4 -4
- package/breadcrumb/bread-context.tsx +1 -1
- package/card/cardGroup.tsx +1 -1
- package/card/index.tsx +1 -1
- package/cascader/index.tsx +4 -4
- package/checkbox/checkbox.tsx +16 -6
- package/collapse/index.tsx +1 -1
- package/collapse/item.tsx +1 -1
- package/collapsible/index.tsx +1 -1
- package/datePicker/_story/datePicker.stories.js +48 -1
- package/datePicker/_story/v2/AutoFillTime.jsx +37 -0
- package/datePicker/_story/v2/InputFormat.jsx +29 -0
- package/datePicker/_story/v2/InputFormatConfirm.jsx +44 -0
- package/datePicker/_story/v2/InputFormatDisabled.jsx +27 -0
- package/datePicker/_story/v2/index.js +4 -0
- package/datePicker/dateInput.tsx +7 -0
- package/datePicker/datePicker.tsx +7 -11
- package/datePicker/monthsGrid.tsx +2 -1
- package/descriptions/item.tsx +1 -1
- package/dist/umd/semi-ui.js +521 -197
- 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/empty/index.tsx +1 -1
- package/form/errorMessage.tsx +1 -1
- package/form/interface.ts +1 -1
- package/form/label.tsx +1 -1
- package/form/section.tsx +2 -2
- package/form/slot.tsx +1 -1
- package/layout/Sider.tsx +1 -1
- package/lib/cjs/anchor/link.d.ts +2 -2
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/autoComplete/index.js +1 -1
- package/lib/cjs/avatar/interface.d.ts +2 -2
- package/lib/cjs/badge/index.d.ts +1 -1
- package/lib/cjs/banner/index.d.ts +4 -4
- package/lib/cjs/breadcrumb/bread-context.d.ts +1 -1
- package/lib/cjs/card/cardGroup.d.ts +1 -1
- package/lib/cjs/card/index.d.ts +1 -1
- package/lib/cjs/cascader/index.d.ts +1 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +23 -11
- package/lib/cjs/collapse/index.d.ts +1 -1
- package/lib/cjs/collapse/item.d.ts +1 -1
- package/lib/cjs/collapsible/index.d.ts +1 -1
- package/lib/cjs/datePicker/dateInput.d.ts +1 -0
- package/lib/cjs/datePicker/dateInput.js +5 -3
- package/lib/cjs/datePicker/datePicker.js +9 -12
- package/lib/cjs/datePicker/monthsGrid.js +2 -1
- package/lib/cjs/descriptions/item.d.ts +1 -1
- package/lib/cjs/empty/index.d.ts +1 -1
- package/lib/cjs/form/errorMessage.d.ts +1 -1
- package/lib/cjs/form/interface.d.ts +1 -1
- package/lib/cjs/form/label.d.ts +1 -1
- package/lib/cjs/form/section.d.ts +2 -2
- package/lib/cjs/form/slot.d.ts +1 -1
- package/lib/cjs/layout/Sider.d.ts +1 -1
- package/lib/cjs/list/index.d.ts +1 -1
- package/lib/cjs/list/item.d.ts +1 -1
- package/lib/cjs/modal/Modal.d.ts +5 -5
- package/lib/cjs/modal/ModalContent.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +4 -2
- package/lib/cjs/modal/useModal/index.d.ts +16 -23
- package/lib/cjs/navigation/Footer.d.ts +1 -1
- package/lib/cjs/radio/radio.d.ts +4 -0
- package/lib/cjs/radio/radio.js +26 -12
- package/lib/cjs/radio/radioGroup.d.ts +1 -1
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/cjs/table/interface.d.ts +1 -1
- package/lib/cjs/tag/group.d.ts +3 -3
- package/lib/cjs/timeline/index.d.ts +1 -1
- package/lib/cjs/timeline/item.d.ts +1 -1
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +6 -1
- package/lib/es/anchor/link.d.ts +2 -2
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/autoComplete/index.js +1 -1
- package/lib/es/avatar/interface.d.ts +2 -2
- package/lib/es/badge/index.d.ts +1 -1
- package/lib/es/banner/index.d.ts +4 -4
- package/lib/es/breadcrumb/bread-context.d.ts +1 -1
- package/lib/es/card/cardGroup.d.ts +1 -1
- package/lib/es/card/index.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +1 -1
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +23 -11
- package/lib/es/collapse/index.d.ts +1 -1
- package/lib/es/collapse/item.d.ts +1 -1
- package/lib/es/collapsible/index.d.ts +1 -1
- package/lib/es/datePicker/dateInput.d.ts +1 -0
- package/lib/es/datePicker/dateInput.js +5 -3
- package/lib/es/datePicker/datePicker.js +9 -12
- package/lib/es/datePicker/monthsGrid.js +2 -1
- package/lib/es/descriptions/item.d.ts +1 -1
- package/lib/es/empty/index.d.ts +1 -1
- package/lib/es/form/errorMessage.d.ts +1 -1
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/form/label.d.ts +1 -1
- package/lib/es/form/section.d.ts +2 -2
- package/lib/es/form/slot.d.ts +1 -1
- package/lib/es/layout/Sider.d.ts +1 -1
- package/lib/es/list/index.d.ts +1 -1
- package/lib/es/list/item.d.ts +1 -1
- package/lib/es/modal/Modal.d.ts +5 -5
- package/lib/es/modal/ModalContent.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +4 -2
- package/lib/es/modal/confirm.js +1 -1
- package/lib/es/modal/useModal/index.d.ts +16 -23
- package/lib/es/navigation/Footer.d.ts +1 -1
- package/lib/es/radio/radio.d.ts +4 -0
- package/lib/es/radio/radio.js +26 -12
- package/lib/es/radio/radioGroup.d.ts +1 -1
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/sideSheet/SideSheetContent.d.ts +1 -1
- package/lib/es/table/interface.d.ts +1 -1
- package/lib/es/tag/group.d.ts +3 -3
- package/lib/es/timeline/index.d.ts +1 -1
- package/lib/es/timeline/item.d.ts +1 -1
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +6 -1
- package/list/index.tsx +1 -1
- package/list/item.tsx +1 -1
- package/modal/Modal.tsx +7 -7
- package/modal/ModalContent.tsx +1 -1
- package/modal/confirm.tsx +10 -11
- package/modal/useModal/index.tsx +9 -1
- package/navigation/Footer.tsx +2 -2
- package/package.json +9 -9
- package/radio/radio.tsx +17 -7
- package/radio/radioGroup.tsx +1 -1
- package/select/index.tsx +8 -8
- package/sideSheet/SideSheetContent.tsx +1 -1
- package/table/interface.ts +1 -1
- package/tag/group.tsx +4 -4
- package/timeline/index.tsx +1 -1
- package/timeline/item.tsx +1 -1
- package/tooltip/index.tsx +5 -1
- package/treeSelect/index.tsx +1 -1
package/dist/umd/semi-ui.js
CHANGED
|
@@ -26133,6 +26133,9 @@ class foundation_Tooltip extends foundation {
|
|
|
26133
26133
|
}
|
|
26134
26134
|
|
|
26135
26135
|
init() {
|
|
26136
|
+
const {
|
|
26137
|
+
wrapperId
|
|
26138
|
+
} = this.getProps();
|
|
26136
26139
|
this._mounted = true;
|
|
26137
26140
|
|
|
26138
26141
|
this._bindEvent();
|
|
@@ -26140,6 +26143,10 @@ class foundation_Tooltip extends foundation {
|
|
|
26140
26143
|
this._shouldShow();
|
|
26141
26144
|
|
|
26142
26145
|
this._initContainerPosition();
|
|
26146
|
+
|
|
26147
|
+
if (!wrapperId) {
|
|
26148
|
+
this._adapter.setId();
|
|
26149
|
+
}
|
|
26143
26150
|
}
|
|
26144
26151
|
|
|
26145
26152
|
destroy() {
|
|
@@ -29356,7 +29363,7 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
29356
29363
|
placement: props.position || 'top',
|
|
29357
29364
|
transitionStyle: {},
|
|
29358
29365
|
isPositionUpdated: false,
|
|
29359
|
-
id:
|
|
29366
|
+
id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
29360
29367
|
|
|
29361
29368
|
};
|
|
29362
29369
|
this.foundation = new foundation_Tooltip(this.adapter);
|
|
@@ -29625,6 +29632,11 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
29625
29632
|
},
|
|
29626
29633
|
notifyEscKeydown: event => {
|
|
29627
29634
|
this.props.onEscKeyDown(event);
|
|
29635
|
+
},
|
|
29636
|
+
setId: () => {
|
|
29637
|
+
this.setState({
|
|
29638
|
+
id: getUuidShort()
|
|
29639
|
+
});
|
|
29628
29640
|
}
|
|
29629
29641
|
});
|
|
29630
29642
|
}
|
|
@@ -36623,7 +36635,7 @@ class autoComplete_AutoComplete extends baseComponent_BaseComponent {
|
|
|
36623
36635
|
this.triggerRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
36624
36636
|
this.optionsRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
36625
36637
|
this.clickOutsideHandler = null;
|
|
36626
|
-
Object(warning["a" /* default */])('triggerRender' in this.props && typeof this.props.triggerRender === 'function', "[Semi AutoComplete]
|
|
36638
|
+
Object(warning["a" /* default */])('triggerRender' in this.props && typeof this.props.triggerRender === 'function', "[Semi AutoComplete]\n - If you are using the following props: 'suffix', 'prefix', 'showClear', 'validateStatus', and 'size',\n please notice that they will be removed in the next major version.\n Please use 'componentProps' to retrieve these props instead.\n - If you are using 'onBlur', 'onFocus', please try to avoid using them and look for changes in the future.");
|
|
36627
36639
|
}
|
|
36628
36640
|
|
|
36629
36641
|
get adapter() {
|
|
@@ -48234,10 +48246,24 @@ const checkbox_constants_numbers = {};
|
|
|
48234
48246
|
class checkboxFoundation_CheckboxFoundation extends foundation {
|
|
48235
48247
|
constructor(adapter) {
|
|
48236
48248
|
super(assign_default()({}, adapter));
|
|
48237
|
-
}
|
|
48249
|
+
}
|
|
48238
48250
|
|
|
48251
|
+
init() {
|
|
48252
|
+
const {
|
|
48253
|
+
children,
|
|
48254
|
+
extra,
|
|
48255
|
+
extraId,
|
|
48256
|
+
addonId
|
|
48257
|
+
} = this.getProps();
|
|
48239
48258
|
|
|
48240
|
-
|
|
48259
|
+
if (children && !addonId) {
|
|
48260
|
+
this._adapter.setAddonId();
|
|
48261
|
+
}
|
|
48262
|
+
|
|
48263
|
+
if (extra && !extraId) {
|
|
48264
|
+
this._adapter.setExtraId();
|
|
48265
|
+
}
|
|
48266
|
+
}
|
|
48241
48267
|
|
|
48242
48268
|
getEvent(checked, e) {
|
|
48243
48269
|
const props = this.getProps();
|
|
@@ -48459,15 +48485,11 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48459
48485
|
|
|
48460
48486
|
const checked = false;
|
|
48461
48487
|
this.state = {
|
|
48462
|
-
checked: props.checked || props.defaultChecked || checked
|
|
48488
|
+
checked: props.checked || props.defaultChecked || checked,
|
|
48489
|
+
addonId: props.addonId,
|
|
48490
|
+
extraId: props.extraId
|
|
48463
48491
|
};
|
|
48464
48492
|
this.checkboxEntity = null;
|
|
48465
|
-
this.addonId = getUuidShort({
|
|
48466
|
-
prefix: 'addon'
|
|
48467
|
-
});
|
|
48468
|
-
this.extraId = getUuidShort({
|
|
48469
|
-
prefix: 'extra'
|
|
48470
|
-
});
|
|
48471
48493
|
this.foundation = new checkboxFoundation(this.adapter);
|
|
48472
48494
|
}
|
|
48473
48495
|
|
|
@@ -48489,7 +48511,21 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48489
48511
|
notifyGroupChange: cbContent => {
|
|
48490
48512
|
this.context.checkboxGroup.onChange(cbContent);
|
|
48491
48513
|
},
|
|
48492
|
-
getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled
|
|
48514
|
+
getGroupDisabled: () => this.context && this.context.checkboxGroup.disabled,
|
|
48515
|
+
setAddonId: () => {
|
|
48516
|
+
this.setState({
|
|
48517
|
+
addonId: getUuidShort({
|
|
48518
|
+
prefix: 'addon'
|
|
48519
|
+
})
|
|
48520
|
+
});
|
|
48521
|
+
},
|
|
48522
|
+
setExtraId: () => {
|
|
48523
|
+
this.setState({
|
|
48524
|
+
extraId: getUuidShort({
|
|
48525
|
+
prefix: 'extra'
|
|
48526
|
+
})
|
|
48527
|
+
});
|
|
48528
|
+
}
|
|
48493
48529
|
});
|
|
48494
48530
|
}
|
|
48495
48531
|
|
|
@@ -48532,7 +48568,9 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48532
48568
|
id
|
|
48533
48569
|
} = this.props;
|
|
48534
48570
|
const {
|
|
48535
|
-
checked
|
|
48571
|
+
checked,
|
|
48572
|
+
addonId,
|
|
48573
|
+
extraId
|
|
48536
48574
|
} = this.state;
|
|
48537
48575
|
const props = {
|
|
48538
48576
|
checked,
|
|
@@ -48580,10 +48618,10 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48580
48618
|
});
|
|
48581
48619
|
|
|
48582
48620
|
const renderContent = () => /*#__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, children ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
48583
|
-
id:
|
|
48621
|
+
id: addonId,
|
|
48584
48622
|
className: "".concat(prefix, "-addon")
|
|
48585
48623
|
}, children) : null, extra ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
48586
|
-
id:
|
|
48624
|
+
id: extraId,
|
|
48587
48625
|
className: extraCls
|
|
48588
48626
|
}, extra) : null);
|
|
48589
48627
|
|
|
@@ -56142,6 +56180,27 @@ function compatibleParse(value, formatToken, baseDate, locale) {
|
|
|
56142
56180
|
|
|
56143
56181
|
return result;
|
|
56144
56182
|
}
|
|
56183
|
+
/**
|
|
56184
|
+
* whether value can be parsed with date-fns `parse`
|
|
56185
|
+
*
|
|
56186
|
+
* @example
|
|
56187
|
+
* isValueParseValid({ value: '2021-01-01', formatToken: 'yyyy-MM-dd' }); // true
|
|
56188
|
+
* isValueParseValid({ value: '2021-01-0', formatToken: 'yyyy-MM-dd' }); // false
|
|
56189
|
+
* isValueParseValid({ value: '2021-01', formatToken: 'yyyy-MM-dd' }); // false
|
|
56190
|
+
*/
|
|
56191
|
+
|
|
56192
|
+
function isValueParseValid(options) {
|
|
56193
|
+
const {
|
|
56194
|
+
value,
|
|
56195
|
+
locale,
|
|
56196
|
+
formatToken
|
|
56197
|
+
} = options;
|
|
56198
|
+
const baseDate = options.baseDate || new Date();
|
|
56199
|
+
const result = parse(value, formatToken, baseDate, {
|
|
56200
|
+
locale
|
|
56201
|
+
});
|
|
56202
|
+
return isValid(result);
|
|
56203
|
+
}
|
|
56145
56204
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/_utils/getDefaultFormatToken.ts
|
|
56146
56205
|
|
|
56147
56206
|
const defaultFormatTokens = {
|
|
@@ -56294,6 +56353,7 @@ function getInsetInputValueFromInsetInputStr(options) {
|
|
|
56294
56353
|
|
|
56295
56354
|
|
|
56296
56355
|
|
|
56356
|
+
|
|
56297
56357
|
/* eslint-disable no-nested-ternary */
|
|
56298
56358
|
|
|
56299
56359
|
/* eslint-disable max-len, max-depth, */
|
|
@@ -56412,9 +56472,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56412
56472
|
|
|
56413
56473
|
this._adapter.updateValue(result);
|
|
56414
56474
|
|
|
56415
|
-
|
|
56416
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56417
|
-
}
|
|
56475
|
+
this.resetCachedSelectedValue(result);
|
|
56418
56476
|
}
|
|
56419
56477
|
|
|
56420
56478
|
parseWithTimezone(value, timeZone, prevTimeZone) {
|
|
@@ -56555,6 +56613,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56555
56613
|
this._adapter.updateInsetInputValue(null);
|
|
56556
56614
|
}
|
|
56557
56615
|
}
|
|
56616
|
+
/**
|
|
56617
|
+
* call it when change state value or input value
|
|
56618
|
+
*/
|
|
56619
|
+
|
|
56558
56620
|
|
|
56559
56621
|
resetCachedSelectedValue(willUpdateDates) {
|
|
56560
56622
|
const {
|
|
@@ -56587,11 +56649,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56587
56649
|
let dates = arguments.length > 2 ? arguments[2] : undefined;
|
|
56588
56650
|
|
|
56589
56651
|
const {
|
|
56590
|
-
value
|
|
56591
|
-
cachedSelectedValue
|
|
56652
|
+
value
|
|
56592
56653
|
} = this._adapter.getStates();
|
|
56593
56654
|
|
|
56594
|
-
const willUpdateDates = isNullOrUndefined(dates) ?
|
|
56655
|
+
const willUpdateDates = isNullOrUndefined(dates) ? value : dates;
|
|
56595
56656
|
|
|
56596
56657
|
if (!this._isControlledComponent('open')) {
|
|
56597
56658
|
this._adapter.togglePanel(false);
|
|
@@ -56620,7 +56681,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56620
56681
|
const result = this._isMultiple() ? this.parseMultipleInput(input) : this.parseInput(input);
|
|
56621
56682
|
const {
|
|
56622
56683
|
value: stateValue
|
|
56623
|
-
} = this.getStates();
|
|
56684
|
+
} = this.getStates();
|
|
56685
|
+
|
|
56686
|
+
this._updateCachedSelectedValueFromInput(input); // Enter a valid date or empty
|
|
56687
|
+
|
|
56624
56688
|
|
|
56625
56689
|
if (result && result.length || input === '') {
|
|
56626
56690
|
// If you click the clear button
|
|
@@ -56636,10 +56700,6 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56636
56700
|
const changedDates = this._getChangedDates(result);
|
|
56637
56701
|
|
|
56638
56702
|
if (!this._someDateDisabled(changedDates)) {
|
|
56639
|
-
if (this._adapter.needConfirm()) {
|
|
56640
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56641
|
-
}
|
|
56642
|
-
|
|
56643
56703
|
if (!isEqual_default()(result, stateValue)) {
|
|
56644
56704
|
this._notifyChange(result);
|
|
56645
56705
|
}
|
|
@@ -56670,16 +56730,14 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56670
56730
|
value: stateValue
|
|
56671
56731
|
} = this.getStates();
|
|
56672
56732
|
|
|
56733
|
+
this._updateCachedSelectedValueFromInput(insetInputStr);
|
|
56734
|
+
|
|
56673
56735
|
if (result && result.length) {
|
|
56674
56736
|
const changedDates = this._getChangedDates(result);
|
|
56675
56737
|
|
|
56676
56738
|
if (!this._someDateDisabled(changedDates)) {
|
|
56677
|
-
if (this._adapter.needConfirm()) {
|
|
56678
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56679
|
-
}
|
|
56680
|
-
|
|
56681
56739
|
if (!isEqual_default()(result, stateValue)) {
|
|
56682
|
-
if (!this._isControlledComponent()) {
|
|
56740
|
+
if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
|
|
56683
56741
|
this._adapter.updateValue(result);
|
|
56684
56742
|
}
|
|
56685
56743
|
|
|
@@ -56694,6 +56752,20 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56694
56752
|
|
|
56695
56753
|
this._adapter.updateInsetInputValue(insetInputValue);
|
|
56696
56754
|
}
|
|
56755
|
+
/**
|
|
56756
|
+
* when input change we reset cached selected value
|
|
56757
|
+
*/
|
|
56758
|
+
|
|
56759
|
+
|
|
56760
|
+
_updateCachedSelectedValueFromInput(input) {
|
|
56761
|
+
const looseResult = this.getLooseDateFromInput(input);
|
|
56762
|
+
|
|
56763
|
+
const changedLooseResult = this._getChangedDates(looseResult);
|
|
56764
|
+
|
|
56765
|
+
if (!this._someDateDisabled(changedLooseResult)) {
|
|
56766
|
+
this.resetCachedSelectedValue(looseResult);
|
|
56767
|
+
}
|
|
56768
|
+
}
|
|
56697
56769
|
/**
|
|
56698
56770
|
* Input box blur
|
|
56699
56771
|
* @param {String} input
|
|
@@ -56715,6 +56787,20 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56715
56787
|
} else {
|
|
56716
56788
|
this._updateValueAndInput(stateValue);
|
|
56717
56789
|
}
|
|
56790
|
+
/**
|
|
56791
|
+
* 当不是范围类型且不需要确认时,使用 stateValue 重置 cachedSelectedValue
|
|
56792
|
+
* 这样做的目的是,在输入非法值时,使用上次选中的值作为已选值
|
|
56793
|
+
* needConfirm 或者 range type 时,我们在 close panel 时调用 resetCachedSelectedValue,这里不用重复调用
|
|
56794
|
+
*
|
|
56795
|
+
* Use stateValue to reset cachedSelectedValue when it is not a range type and does not require confirmation
|
|
56796
|
+
* The purpose of this is to use the last selected value as the selected value when an invalid value is entered
|
|
56797
|
+
* When needConfirm or range type, we call resetCachedSelectedValue when close panel, no need to call repeatedly here
|
|
56798
|
+
*/
|
|
56799
|
+
|
|
56800
|
+
|
|
56801
|
+
if (!this._adapter.needConfirm() && !this._isRangeType()) {
|
|
56802
|
+
this.resetCachedSelectedValue(stateValue);
|
|
56803
|
+
}
|
|
56718
56804
|
}
|
|
56719
56805
|
/**
|
|
56720
56806
|
* called when range type rangeEnd input tab press
|
|
@@ -56771,9 +56857,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56771
56857
|
if (!this._isControlledComponent('value')) {
|
|
56772
56858
|
this._updateValueAndInput(value, true, inputValue);
|
|
56773
56859
|
|
|
56774
|
-
|
|
56775
|
-
this._adapter.updateCachedSelectedValue(value);
|
|
56776
|
-
}
|
|
56860
|
+
this.resetCachedSelectedValue(value);
|
|
56777
56861
|
}
|
|
56778
56862
|
|
|
56779
56863
|
this._notifyChange(value);
|
|
@@ -56877,6 +56961,138 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56877
56961
|
|
|
56878
56962
|
return result;
|
|
56879
56963
|
}
|
|
56964
|
+
/**
|
|
56965
|
+
* get date which may include null from input
|
|
56966
|
+
*/
|
|
56967
|
+
|
|
56968
|
+
|
|
56969
|
+
getLooseDateFromInput(input) {
|
|
56970
|
+
const value = this._isMultiple() ? this.parseMultipleInputLoose(input) : this.parseInputLoose(input);
|
|
56971
|
+
return value;
|
|
56972
|
+
}
|
|
56973
|
+
/**
|
|
56974
|
+
* parse input into `Array<Date|null>`, loose means return value includes `null`
|
|
56975
|
+
*
|
|
56976
|
+
* @example
|
|
56977
|
+
* ```javascript
|
|
56978
|
+
* parseInputLoose('2022-03-15 ~ '); // [Date, null]
|
|
56979
|
+
* parseInputLoose(' ~ 2022-03-15 '); // [null, Date]
|
|
56980
|
+
* parseInputLoose(''); // []
|
|
56981
|
+
* parseInputLoose('2022-03- ~ 2022-0'); // [null, null]
|
|
56982
|
+
* ```
|
|
56983
|
+
*/
|
|
56984
|
+
|
|
56985
|
+
|
|
56986
|
+
parseInputLoose() {
|
|
56987
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
56988
|
+
let result = [];
|
|
56989
|
+
const {
|
|
56990
|
+
dateFnsLocale,
|
|
56991
|
+
rangeSeparator,
|
|
56992
|
+
type,
|
|
56993
|
+
format
|
|
56994
|
+
} = this.getProps();
|
|
56995
|
+
|
|
56996
|
+
if (input && input.length) {
|
|
56997
|
+
const formatToken = format || getDefaultFormatTokenByType(type);
|
|
56998
|
+
let parsedResult, formatedInput;
|
|
56999
|
+
const nowDate = new Date();
|
|
57000
|
+
|
|
57001
|
+
switch (type) {
|
|
57002
|
+
case 'date':
|
|
57003
|
+
case 'dateTime':
|
|
57004
|
+
case 'month':
|
|
57005
|
+
const _parsedResult = compatibleParse(input, formatToken, nowDate, dateFnsLocale);
|
|
57006
|
+
|
|
57007
|
+
if (isValidDate(_parsedResult)) {
|
|
57008
|
+
formatedInput = this.localeFormat(_parsedResult, formatToken);
|
|
57009
|
+
|
|
57010
|
+
if (formatedInput === input) {
|
|
57011
|
+
parsedResult = _parsedResult;
|
|
57012
|
+
}
|
|
57013
|
+
} else {
|
|
57014
|
+
parsedResult = null;
|
|
57015
|
+
}
|
|
57016
|
+
|
|
57017
|
+
result = [parsedResult];
|
|
57018
|
+
break;
|
|
57019
|
+
|
|
57020
|
+
case 'dateRange':
|
|
57021
|
+
case 'dateTimeRange':
|
|
57022
|
+
const separator = rangeSeparator;
|
|
57023
|
+
const values = input.split(separator);
|
|
57024
|
+
parsedResult = values && reduce_default()(values).call(values, (arr, cur) => {
|
|
57025
|
+
let parsedVal = null;
|
|
57026
|
+
|
|
57027
|
+
const _parsedResult = compatibleParse(cur, formatToken, nowDate, dateFnsLocale);
|
|
57028
|
+
|
|
57029
|
+
if (isValidDate(_parsedResult)) {
|
|
57030
|
+
formatedInput = this.localeFormat(_parsedResult, formatToken);
|
|
57031
|
+
|
|
57032
|
+
if (formatedInput === cur) {
|
|
57033
|
+
parsedVal = _parsedResult;
|
|
57034
|
+
}
|
|
57035
|
+
}
|
|
57036
|
+
|
|
57037
|
+
arr.push(parsedVal);
|
|
57038
|
+
return arr;
|
|
57039
|
+
}, []);
|
|
57040
|
+
|
|
57041
|
+
if (is_array_default()(parsedResult) && every_default()(parsedResult).call(parsedResult, item => isValid(item))) {
|
|
57042
|
+
sort_default()(parsedResult).call(parsedResult, (d1, d2) => d1.getTime() - d2.getTime());
|
|
57043
|
+
}
|
|
57044
|
+
|
|
57045
|
+
result = parsedResult;
|
|
57046
|
+
break;
|
|
57047
|
+
|
|
57048
|
+
default:
|
|
57049
|
+
break;
|
|
57050
|
+
}
|
|
57051
|
+
}
|
|
57052
|
+
|
|
57053
|
+
return result;
|
|
57054
|
+
}
|
|
57055
|
+
/**
|
|
57056
|
+
* parse multiple into `Array<Date|null>`, loose means return value includes `null`
|
|
57057
|
+
*
|
|
57058
|
+
* @example
|
|
57059
|
+
* ```javascript
|
|
57060
|
+
* parseMultipleInputLoose('2021-01-01,2021-10-15'); // [Date, Date];
|
|
57061
|
+
* parseMultipleInputLoose('2021-01-01,2021-10-'); // [Date, null];
|
|
57062
|
+
* parseMultipleInputLoose(''); // [];
|
|
57063
|
+
* ```
|
|
57064
|
+
*/
|
|
57065
|
+
|
|
57066
|
+
|
|
57067
|
+
parseMultipleInputLoose() {
|
|
57068
|
+
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
57069
|
+
let separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : datePicker_constants_strings.DEFAULT_SEPARATOR_MULTIPLE;
|
|
57070
|
+
let needDedupe = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
57071
|
+
const max = this.getProp('max');
|
|
57072
|
+
const inputArr = input.split(separator);
|
|
57073
|
+
const result = [];
|
|
57074
|
+
|
|
57075
|
+
for (const curInput of inputArr) {
|
|
57076
|
+
let tmpParsed = curInput && this.parseInputLoose(curInput);
|
|
57077
|
+
tmpParsed = is_array_default()(tmpParsed) ? tmpParsed : tmpParsed && [tmpParsed];
|
|
57078
|
+
|
|
57079
|
+
if (tmpParsed && tmpParsed.length) {
|
|
57080
|
+
if (needDedupe) {
|
|
57081
|
+
!filter_default()(result).call(result, r => Boolean(find_default()(tmpParsed).call(tmpParsed, tp => isSameSecond(r, tp)))) && result.push(...tmpParsed);
|
|
57082
|
+
} else {
|
|
57083
|
+
result.push(...tmpParsed);
|
|
57084
|
+
}
|
|
57085
|
+
} else {
|
|
57086
|
+
return [];
|
|
57087
|
+
}
|
|
57088
|
+
|
|
57089
|
+
if (max && max > 0 && result.length > max) {
|
|
57090
|
+
return [];
|
|
57091
|
+
}
|
|
57092
|
+
}
|
|
57093
|
+
|
|
57094
|
+
return result;
|
|
57095
|
+
}
|
|
56880
57096
|
/**
|
|
56881
57097
|
* Parses the input when multiple is true, if valid,
|
|
56882
57098
|
* returns a list of time objects, otherwise returns an array
|
|
@@ -57076,10 +57292,6 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
57076
57292
|
|
|
57077
57293
|
const needCheckFocusRecord = get_default()(options, 'needCheckFocusRecord', true);
|
|
57078
57294
|
|
|
57079
|
-
if (this._adapter.needConfirm()) {
|
|
57080
|
-
this._adapter.updateCachedSelectedValue(value);
|
|
57081
|
-
}
|
|
57082
|
-
|
|
57083
57295
|
const dates = is_array_default()(value) ? [...value] : value ? [value] : [];
|
|
57084
57296
|
|
|
57085
57297
|
const changedDates = this._getChangedDates(dates);
|
|
@@ -57087,6 +57299,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
57087
57299
|
let inputValue, insetInputValue;
|
|
57088
57300
|
|
|
57089
57301
|
if (!this._someDateDisabled(changedDates)) {
|
|
57302
|
+
this.resetCachedSelectedValue(dates);
|
|
57090
57303
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
57091
57304
|
|
|
57092
57305
|
if (insetInput) {
|
|
@@ -57623,6 +57836,134 @@ function formatDateValues(values, formatToken) {
|
|
|
57623
57836
|
|
|
57624
57837
|
return text;
|
|
57625
57838
|
}
|
|
57839
|
+
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/addMonths/index.js
|
|
57840
|
+
|
|
57841
|
+
|
|
57842
|
+
|
|
57843
|
+
/**
|
|
57844
|
+
* @name addMonths
|
|
57845
|
+
* @category Month Helpers
|
|
57846
|
+
* @summary Add the specified number of months to the given date.
|
|
57847
|
+
*
|
|
57848
|
+
* @description
|
|
57849
|
+
* Add the specified number of months to the given date.
|
|
57850
|
+
*
|
|
57851
|
+
* ### v2.0.0 breaking changes:
|
|
57852
|
+
*
|
|
57853
|
+
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
57854
|
+
*
|
|
57855
|
+
* @param {Date|Number} date - the date to be changed
|
|
57856
|
+
* @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
57857
|
+
* @returns {Date} the new date with the months added
|
|
57858
|
+
* @throws {TypeError} 2 arguments required
|
|
57859
|
+
*
|
|
57860
|
+
* @example
|
|
57861
|
+
* // Add 5 months to 1 September 2014:
|
|
57862
|
+
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
57863
|
+
* //=> Sun Feb 01 2015 00:00:00
|
|
57864
|
+
*/
|
|
57865
|
+
|
|
57866
|
+
function addMonths(dirtyDate, dirtyAmount) {
|
|
57867
|
+
requiredArgs(2, arguments);
|
|
57868
|
+
var date = toDate(dirtyDate);
|
|
57869
|
+
var amount = toInteger(dirtyAmount);
|
|
57870
|
+
|
|
57871
|
+
if (isNaN(amount)) {
|
|
57872
|
+
return new Date(NaN);
|
|
57873
|
+
}
|
|
57874
|
+
|
|
57875
|
+
if (!amount) {
|
|
57876
|
+
// If 0 months, no-op to avoid changing times in the hour before end of DST
|
|
57877
|
+
return date;
|
|
57878
|
+
}
|
|
57879
|
+
|
|
57880
|
+
var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
|
|
57881
|
+
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
|
|
57882
|
+
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
|
|
57883
|
+
// want except that dates will wrap around the end of a month, meaning that
|
|
57884
|
+
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
|
|
57885
|
+
// we'll default to the end of the desired month by adding 1 to the desired
|
|
57886
|
+
// month and using a date of 0 to back up one day to the end of the desired
|
|
57887
|
+
// month.
|
|
57888
|
+
|
|
57889
|
+
var endOfDesiredMonth = new Date(date.getTime());
|
|
57890
|
+
endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
|
|
57891
|
+
var daysInMonth = endOfDesiredMonth.getDate();
|
|
57892
|
+
|
|
57893
|
+
if (dayOfMonth >= daysInMonth) {
|
|
57894
|
+
// If we're already at the end of the month, then this is the correct date
|
|
57895
|
+
// and we're done.
|
|
57896
|
+
return endOfDesiredMonth;
|
|
57897
|
+
} else {
|
|
57898
|
+
// Otherwise, we now know that setting the original day-of-month value won't
|
|
57899
|
+
// cause an overflow, so set the desired day-of-month. Note that we can't
|
|
57900
|
+
// just set the date of `endOfDesiredMonth` because that object may have had
|
|
57901
|
+
// its time changed in the unusual case where where a DST transition was on
|
|
57902
|
+
// the last day of the month and its local time was in the hour skipped or
|
|
57903
|
+
// repeated next to a DST transition. So we use `date` instead which is
|
|
57904
|
+
// guaranteed to still have the original time.
|
|
57905
|
+
date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
|
57906
|
+
return date;
|
|
57907
|
+
}
|
|
57908
|
+
}
|
|
57909
|
+
// CONCATENATED MODULE: ../semi-foundation/datePicker/_utils/getDefaultPickerDate.ts
|
|
57910
|
+
|
|
57911
|
+
|
|
57912
|
+
|
|
57913
|
+
|
|
57914
|
+
|
|
57915
|
+
/**
|
|
57916
|
+
* get left panel picker date and right panel picker date
|
|
57917
|
+
*/
|
|
57918
|
+
|
|
57919
|
+
function getDefaultPickerDate(options) {
|
|
57920
|
+
const {
|
|
57921
|
+
defaultPickerValue,
|
|
57922
|
+
format,
|
|
57923
|
+
dateFnsLocale
|
|
57924
|
+
} = options;
|
|
57925
|
+
let nowDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[0] : defaultPickerValue;
|
|
57926
|
+
let nextDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[1] : undefined;
|
|
57927
|
+
|
|
57928
|
+
switch (true) {
|
|
57929
|
+
case isValidDate(nowDate):
|
|
57930
|
+
break;
|
|
57931
|
+
|
|
57932
|
+
case isTimestamp(nowDate):
|
|
57933
|
+
nowDate = new Date(nowDate);
|
|
57934
|
+
break;
|
|
57935
|
+
|
|
57936
|
+
case typeof nowDate === 'string':
|
|
57937
|
+
nowDate = compatibleParse(nowDate, format, undefined, dateFnsLocale);
|
|
57938
|
+
break;
|
|
57939
|
+
|
|
57940
|
+
default:
|
|
57941
|
+
nowDate = new Date();
|
|
57942
|
+
break;
|
|
57943
|
+
}
|
|
57944
|
+
|
|
57945
|
+
switch (true) {
|
|
57946
|
+
case isValidDate(nextDate):
|
|
57947
|
+
break;
|
|
57948
|
+
|
|
57949
|
+
case isTimestamp(nextDate):
|
|
57950
|
+
nextDate = new Date(nextDate);
|
|
57951
|
+
break;
|
|
57952
|
+
|
|
57953
|
+
case typeof nextDate === 'string':
|
|
57954
|
+
nextDate = compatibleParse(nextDate, format, undefined, dateFnsLocale);
|
|
57955
|
+
break;
|
|
57956
|
+
|
|
57957
|
+
default:
|
|
57958
|
+
nextDate = addMonths(nowDate, 1);
|
|
57959
|
+
break;
|
|
57960
|
+
}
|
|
57961
|
+
|
|
57962
|
+
return {
|
|
57963
|
+
nowDate: nowDate,
|
|
57964
|
+
nextDate: nextDate
|
|
57965
|
+
};
|
|
57966
|
+
}
|
|
57626
57967
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/inputFoundation.ts
|
|
57627
57968
|
|
|
57628
57969
|
|
|
@@ -57634,6 +57975,13 @@ function formatDateValues(values, formatToken) {
|
|
|
57634
57975
|
|
|
57635
57976
|
|
|
57636
57977
|
|
|
57978
|
+
|
|
57979
|
+
|
|
57980
|
+
|
|
57981
|
+
|
|
57982
|
+
|
|
57983
|
+
|
|
57984
|
+
|
|
57637
57985
|
const KEY_CODE_ENTER = 'Enter';
|
|
57638
57986
|
const KEY_CODE_TAB = 'Tab';
|
|
57639
57987
|
class inputFoundation_InputFoundation extends foundation {
|
|
@@ -57754,8 +58102,13 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
57754
58102
|
format
|
|
57755
58103
|
});
|
|
57756
58104
|
|
|
57757
|
-
|
|
58105
|
+
let newInsetInputValue = lodash_set_default()(cloneDeep_default()(insetInputValue), valuePath, value);
|
|
57758
58106
|
|
|
58107
|
+
newInsetInputValue = this._autoFillTimeToInsetInputValue({
|
|
58108
|
+
insetInputValue: newInsetInputValue,
|
|
58109
|
+
valuePath,
|
|
58110
|
+
format: insetFormatToken
|
|
58111
|
+
});
|
|
57759
58112
|
const newInputValue = this.concatInsetInputValue({
|
|
57760
58113
|
insetInputValue: newInsetInputValue
|
|
57761
58114
|
});
|
|
@@ -57766,6 +58119,74 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
57766
58119
|
insetInputStr: newInputValue
|
|
57767
58120
|
});
|
|
57768
58121
|
}
|
|
58122
|
+
|
|
58123
|
+
_autoFillTimeToInsetInputValue(options) {
|
|
58124
|
+
const {
|
|
58125
|
+
valuePath,
|
|
58126
|
+
insetInputValue,
|
|
58127
|
+
format
|
|
58128
|
+
} = options;
|
|
58129
|
+
|
|
58130
|
+
const {
|
|
58131
|
+
type,
|
|
58132
|
+
defaultPickerValue,
|
|
58133
|
+
dateFnsLocale
|
|
58134
|
+
} = this._adapter.getProps();
|
|
58135
|
+
|
|
58136
|
+
const insetInputValueWithTime = cloneDeep_default()(insetInputValue);
|
|
58137
|
+
|
|
58138
|
+
const {
|
|
58139
|
+
nowDate,
|
|
58140
|
+
nextDate
|
|
58141
|
+
} = getDefaultPickerDate({
|
|
58142
|
+
defaultPickerValue,
|
|
58143
|
+
format,
|
|
58144
|
+
dateFnsLocale
|
|
58145
|
+
});
|
|
58146
|
+
|
|
58147
|
+
if (includes_default()(type).call(type, 'Time')) {
|
|
58148
|
+
let timeStr = '';
|
|
58149
|
+
|
|
58150
|
+
const dateFormatToken = get_default()(format.split(' '), '0', datePicker_constants_strings.FORMAT_FULL_DATE);
|
|
58151
|
+
|
|
58152
|
+
const timeFormatToken = get_default()(format.split(' '), '1', datePicker_constants_strings.FORMAT_TIME_PICKER);
|
|
58153
|
+
|
|
58154
|
+
switch (valuePath) {
|
|
58155
|
+
case 'monthLeft.dateInput':
|
|
58156
|
+
const dateLeftStr = insetInputValueWithTime.monthLeft.dateInput;
|
|
58157
|
+
|
|
58158
|
+
if (!insetInputValueWithTime.monthLeft.timeInput && dateLeftStr.length === dateFormatToken.length) {
|
|
58159
|
+
const dateLeftParsed = compatibleParse(insetInputValueWithTime.monthLeft.dateInput, dateFormatToken);
|
|
58160
|
+
|
|
58161
|
+
if (isValidDate(dateLeftParsed)) {
|
|
58162
|
+
timeStr = format_format(nowDate, timeFormatToken);
|
|
58163
|
+
insetInputValueWithTime.monthLeft.timeInput = timeStr;
|
|
58164
|
+
}
|
|
58165
|
+
}
|
|
58166
|
+
|
|
58167
|
+
break;
|
|
58168
|
+
|
|
58169
|
+
case 'monthRight.dateInput':
|
|
58170
|
+
const dateRightStr = insetInputValueWithTime.monthRight.dateInput;
|
|
58171
|
+
|
|
58172
|
+
if (!insetInputValueWithTime.monthRight.timeInput && dateRightStr.length === dateFormatToken.length) {
|
|
58173
|
+
const dateRightParsed = compatibleParse(dateRightStr, dateFormatToken);
|
|
58174
|
+
|
|
58175
|
+
if (isValidDate(dateRightParsed)) {
|
|
58176
|
+
timeStr = format_format(nextDate, timeFormatToken);
|
|
58177
|
+
insetInputValueWithTime.monthRight.timeInput = timeStr;
|
|
58178
|
+
}
|
|
58179
|
+
}
|
|
58180
|
+
|
|
58181
|
+
break;
|
|
58182
|
+
|
|
58183
|
+
default:
|
|
58184
|
+
break;
|
|
58185
|
+
}
|
|
58186
|
+
}
|
|
58187
|
+
|
|
58188
|
+
return insetInputValueWithTime;
|
|
58189
|
+
}
|
|
57769
58190
|
/**
|
|
57770
58191
|
* 只有传入的 format 符合 formatReg 时,才会使用用户传入的 format
|
|
57771
58192
|
* 否则会使用默认的 format 作为 placeholder
|
|
@@ -58361,9 +58782,10 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
58361
58782
|
rangeInputFocus,
|
|
58362
58783
|
rangeSeparator,
|
|
58363
58784
|
insetInput,
|
|
58364
|
-
insetInputValue
|
|
58785
|
+
insetInputValue,
|
|
58786
|
+
defaultPickerValue
|
|
58365
58787
|
} = _a,
|
|
58366
|
-
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"]);
|
|
58788
|
+
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"]);
|
|
58367
58789
|
|
|
58368
58790
|
const dateIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCalendar, {
|
|
58369
58791
|
"aria-hidden": true
|
|
@@ -58447,7 +58869,8 @@ dateInput_DateInput.propTypes = {
|
|
|
58447
58869
|
rangeInputEndRef: prop_types_default.a.object,
|
|
58448
58870
|
rangeSeparator: prop_types_default.a.string,
|
|
58449
58871
|
insetInput: prop_types_default.a.bool,
|
|
58450
|
-
insetInputValue: prop_types_default.a.object
|
|
58872
|
+
insetInputValue: prop_types_default.a.object,
|
|
58873
|
+
defaultPickerValue: prop_types_default.a.oneOfType([prop_types_default.a.string, prop_types_default.a.number, prop_types_default.a.object, prop_types_default.a.array])
|
|
58451
58874
|
};
|
|
58452
58875
|
dateInput_DateInput.defaultProps = {
|
|
58453
58876
|
showClear: true,
|
|
@@ -58535,76 +58958,6 @@ function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
|
|
|
58535
58958
|
var dateRight = toDate(dirtyDateRight);
|
|
58536
58959
|
return dateLeft.getFullYear() - dateRight.getFullYear();
|
|
58537
58960
|
}
|
|
58538
|
-
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/addMonths/index.js
|
|
58539
|
-
|
|
58540
|
-
|
|
58541
|
-
|
|
58542
|
-
/**
|
|
58543
|
-
* @name addMonths
|
|
58544
|
-
* @category Month Helpers
|
|
58545
|
-
* @summary Add the specified number of months to the given date.
|
|
58546
|
-
*
|
|
58547
|
-
* @description
|
|
58548
|
-
* Add the specified number of months to the given date.
|
|
58549
|
-
*
|
|
58550
|
-
* ### v2.0.0 breaking changes:
|
|
58551
|
-
*
|
|
58552
|
-
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
58553
|
-
*
|
|
58554
|
-
* @param {Date|Number} date - the date to be changed
|
|
58555
|
-
* @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
|
|
58556
|
-
* @returns {Date} the new date with the months added
|
|
58557
|
-
* @throws {TypeError} 2 arguments required
|
|
58558
|
-
*
|
|
58559
|
-
* @example
|
|
58560
|
-
* // Add 5 months to 1 September 2014:
|
|
58561
|
-
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
58562
|
-
* //=> Sun Feb 01 2015 00:00:00
|
|
58563
|
-
*/
|
|
58564
|
-
|
|
58565
|
-
function addMonths(dirtyDate, dirtyAmount) {
|
|
58566
|
-
requiredArgs(2, arguments);
|
|
58567
|
-
var date = toDate(dirtyDate);
|
|
58568
|
-
var amount = toInteger(dirtyAmount);
|
|
58569
|
-
|
|
58570
|
-
if (isNaN(amount)) {
|
|
58571
|
-
return new Date(NaN);
|
|
58572
|
-
}
|
|
58573
|
-
|
|
58574
|
-
if (!amount) {
|
|
58575
|
-
// If 0 months, no-op to avoid changing times in the hour before end of DST
|
|
58576
|
-
return date;
|
|
58577
|
-
}
|
|
58578
|
-
|
|
58579
|
-
var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
|
|
58580
|
-
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
|
|
58581
|
-
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
|
|
58582
|
-
// want except that dates will wrap around the end of a month, meaning that
|
|
58583
|
-
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
|
|
58584
|
-
// we'll default to the end of the desired month by adding 1 to the desired
|
|
58585
|
-
// month and using a date of 0 to back up one day to the end of the desired
|
|
58586
|
-
// month.
|
|
58587
|
-
|
|
58588
|
-
var endOfDesiredMonth = new Date(date.getTime());
|
|
58589
|
-
endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
|
|
58590
|
-
var daysInMonth = endOfDesiredMonth.getDate();
|
|
58591
|
-
|
|
58592
|
-
if (dayOfMonth >= daysInMonth) {
|
|
58593
|
-
// If we're already at the end of the month, then this is the correct date
|
|
58594
|
-
// and we're done.
|
|
58595
|
-
return endOfDesiredMonth;
|
|
58596
|
-
} else {
|
|
58597
|
-
// Otherwise, we now know that setting the original day-of-month value won't
|
|
58598
|
-
// cause an overflow, so set the desired day-of-month. Note that we can't
|
|
58599
|
-
// just set the date of `endOfDesiredMonth` because that object may have had
|
|
58600
|
-
// its time changed in the unusual case where where a DST transition was on
|
|
58601
|
-
// the last day of the month and its local time was in the hour skipped or
|
|
58602
|
-
// repeated next to a DST transition. So we use `date` instead which is
|
|
58603
|
-
// guaranteed to still have the original time.
|
|
58604
|
-
date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
|
58605
|
-
return date;
|
|
58606
|
-
}
|
|
58607
|
-
}
|
|
58608
58961
|
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/subMonths/index.js
|
|
58609
58962
|
|
|
58610
58963
|
|
|
@@ -59143,10 +59496,10 @@ class monthsGridFoundation_MonthsGridFoundation extends foundation {
|
|
|
59143
59496
|
const newSelected = new set_default.a();
|
|
59144
59497
|
|
|
59145
59498
|
if (!this._isMultiple()) {
|
|
59146
|
-
newSelected.add(format_format(values[0], datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59499
|
+
values[0] && newSelected.add(format_format(values[0], datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59147
59500
|
} else {
|
|
59148
59501
|
for_each_default()(values).call(values, date => {
|
|
59149
|
-
newSelected.add(format_format(date, datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59502
|
+
date && newSelected.add(format_format(date, datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59150
59503
|
});
|
|
59151
59504
|
}
|
|
59152
59505
|
|
|
@@ -62762,64 +63115,6 @@ yearAndMonth_YearAndMonth.defaultProps = {
|
|
|
62762
63115
|
onSelect: noop_default.a
|
|
62763
63116
|
};
|
|
62764
63117
|
/* harmony default export */ var yearAndMonth = (yearAndMonth_YearAndMonth);
|
|
62765
|
-
// CONCATENATED MODULE: ../semi-foundation/datePicker/_utils/getDefaultPickerDate.ts
|
|
62766
|
-
|
|
62767
|
-
|
|
62768
|
-
|
|
62769
|
-
|
|
62770
|
-
|
|
62771
|
-
/**
|
|
62772
|
-
* get left panel picker date and right panel picker date
|
|
62773
|
-
*/
|
|
62774
|
-
|
|
62775
|
-
function getDefaultPickerDate(options) {
|
|
62776
|
-
const {
|
|
62777
|
-
defaultPickerValue,
|
|
62778
|
-
format,
|
|
62779
|
-
dateFnsLocale
|
|
62780
|
-
} = options;
|
|
62781
|
-
let nowDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[0] : defaultPickerValue;
|
|
62782
|
-
let nextDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[1] : undefined;
|
|
62783
|
-
|
|
62784
|
-
switch (true) {
|
|
62785
|
-
case isValidDate(nowDate):
|
|
62786
|
-
break;
|
|
62787
|
-
|
|
62788
|
-
case isTimestamp(nowDate):
|
|
62789
|
-
nowDate = new Date(nowDate);
|
|
62790
|
-
break;
|
|
62791
|
-
|
|
62792
|
-
case typeof nowDate === 'string':
|
|
62793
|
-
nowDate = compatibleParse(nowDate, format, undefined, dateFnsLocale);
|
|
62794
|
-
break;
|
|
62795
|
-
|
|
62796
|
-
default:
|
|
62797
|
-
nowDate = new Date();
|
|
62798
|
-
break;
|
|
62799
|
-
}
|
|
62800
|
-
|
|
62801
|
-
switch (true) {
|
|
62802
|
-
case isValidDate(nextDate):
|
|
62803
|
-
break;
|
|
62804
|
-
|
|
62805
|
-
case isTimestamp(nextDate):
|
|
62806
|
-
nextDate = new Date(nextDate);
|
|
62807
|
-
break;
|
|
62808
|
-
|
|
62809
|
-
case typeof nextDate === 'string':
|
|
62810
|
-
nextDate = compatibleParse(nextDate, format, undefined, dateFnsLocale);
|
|
62811
|
-
break;
|
|
62812
|
-
|
|
62813
|
-
default:
|
|
62814
|
-
nextDate = addMonths(nowDate, 1);
|
|
62815
|
-
break;
|
|
62816
|
-
}
|
|
62817
|
-
|
|
62818
|
-
return {
|
|
62819
|
-
nowDate: nowDate,
|
|
62820
|
-
nextDate: nextDate
|
|
62821
|
-
};
|
|
62822
|
-
}
|
|
62823
63118
|
// CONCATENATED MODULE: ./datePicker/monthsGrid.tsx
|
|
62824
63119
|
|
|
62825
63120
|
|
|
@@ -63053,7 +63348,8 @@ class monthsGrid_MonthsGrid extends baseComponent_BaseComponent {
|
|
|
63053
63348
|
} = this.props;
|
|
63054
63349
|
|
|
63055
63350
|
if (prevProps.defaultValue !== defaultValue) {
|
|
63056
|
-
|
|
63351
|
+
// we should always update panel state when value changes
|
|
63352
|
+
this.foundation.updateSelectedFromProps(defaultValue);
|
|
63057
63353
|
}
|
|
63058
63354
|
|
|
63059
63355
|
if (prevProps.defaultPickerValue !== defaultPickerValue) {
|
|
@@ -63756,7 +64052,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
63756
64052
|
insetInput,
|
|
63757
64053
|
type,
|
|
63758
64054
|
format,
|
|
63759
|
-
rangeSeparator
|
|
64055
|
+
rangeSeparator,
|
|
64056
|
+
defaultPickerValue
|
|
63760
64057
|
} = this.props;
|
|
63761
64058
|
const {
|
|
63762
64059
|
insetInputValue,
|
|
@@ -63778,7 +64075,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
63778
64075
|
onInsetInputChange: this.handleInsetInputChange,
|
|
63779
64076
|
rangeInputStartRef: this.rangeInputStartRef,
|
|
63780
64077
|
rangeInputEndRef: this.rangeInputEndRef,
|
|
63781
|
-
density
|
|
64078
|
+
density,
|
|
64079
|
+
defaultPickerValue
|
|
63782
64080
|
};
|
|
63783
64081
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
63784
64082
|
ref: this.panelRef,
|
|
@@ -64149,18 +64447,11 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64149
64447
|
insetInput
|
|
64150
64448
|
} = this.props;
|
|
64151
64449
|
const {
|
|
64152
|
-
value,
|
|
64153
64450
|
cachedSelectedValue,
|
|
64154
64451
|
motionEnd,
|
|
64155
64452
|
rangeInputFocus
|
|
64156
|
-
} = this.state;
|
|
64157
|
-
|
|
64158
|
-
let defaultValue = value;
|
|
64159
|
-
|
|
64160
|
-
if (this.adapter.needConfirm()) {
|
|
64161
|
-
defaultValue = cachedSelectedValue;
|
|
64162
|
-
}
|
|
64163
|
-
|
|
64453
|
+
} = this.state;
|
|
64454
|
+
const defaultValue = cachedSelectedValue;
|
|
64164
64455
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(monthsGrid_MonthsGrid, {
|
|
64165
64456
|
ref: this.monthGrid,
|
|
64166
64457
|
locale: locale,
|
|
@@ -64232,7 +64523,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64232
64523
|
size,
|
|
64233
64524
|
inputReadOnly,
|
|
64234
64525
|
rangeSeparator,
|
|
64235
|
-
insetInput
|
|
64526
|
+
insetInput,
|
|
64527
|
+
defaultPickerValue
|
|
64236
64528
|
} = this.props;
|
|
64237
64529
|
const {
|
|
64238
64530
|
value,
|
|
@@ -64258,6 +64550,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64258
64550
|
disabled: inputDisabled,
|
|
64259
64551
|
inputValue,
|
|
64260
64552
|
value: value,
|
|
64553
|
+
defaultPickerValue,
|
|
64261
64554
|
onChange: this.handleInputChange,
|
|
64262
64555
|
onEnterPress: this.handleInputComplete,
|
|
64263
64556
|
// TODO: remove in next major version
|
|
@@ -79713,6 +80006,23 @@ class radioGroupFoundation_RadioGroupFoundation extends foundation {
|
|
|
79713
80006
|
// CONCATENATED MODULE: ../semi-foundation/radio/radioFoundation.ts
|
|
79714
80007
|
|
|
79715
80008
|
class radioFoundation_RadioFoundation extends foundation {
|
|
80009
|
+
init() {
|
|
80010
|
+
const {
|
|
80011
|
+
children,
|
|
80012
|
+
extra,
|
|
80013
|
+
extraId,
|
|
80014
|
+
addonId
|
|
80015
|
+
} = this._adapter.getProps();
|
|
80016
|
+
|
|
80017
|
+
if (children && !addonId) {
|
|
80018
|
+
this._adapter.setAddonId();
|
|
80019
|
+
}
|
|
80020
|
+
|
|
80021
|
+
if (extra && !extraId) {
|
|
80022
|
+
this._adapter.setExtraId();
|
|
80023
|
+
}
|
|
80024
|
+
}
|
|
80025
|
+
|
|
79716
80026
|
setHover(hover) {
|
|
79717
80027
|
this._adapter.setHover(hover);
|
|
79718
80028
|
}
|
|
@@ -79959,16 +80269,12 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
79959
80269
|
};
|
|
79960
80270
|
|
|
79961
80271
|
this.state = {
|
|
79962
|
-
hover: false
|
|
80272
|
+
hover: false,
|
|
80273
|
+
addonId: props.addonId,
|
|
80274
|
+
extraId: props.extraId
|
|
79963
80275
|
};
|
|
79964
80276
|
this.foundation = new radioFoundation_RadioFoundation(this.adapter);
|
|
79965
80277
|
this.radioEntity = null;
|
|
79966
|
-
this.addonId = getUuidShort({
|
|
79967
|
-
prefix: 'addon'
|
|
79968
|
-
});
|
|
79969
|
-
this.extraId = getUuidShort({
|
|
79970
|
-
prefix: 'extra'
|
|
79971
|
-
});
|
|
79972
80278
|
}
|
|
79973
80279
|
|
|
79974
80280
|
get adapter() {
|
|
@@ -79977,6 +80283,20 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
79977
80283
|
this.setState({
|
|
79978
80284
|
hover
|
|
79979
80285
|
});
|
|
80286
|
+
},
|
|
80287
|
+
setAddonId: () => {
|
|
80288
|
+
this.setState({
|
|
80289
|
+
addonId: getUuidShort({
|
|
80290
|
+
prefix: 'addon'
|
|
80291
|
+
})
|
|
80292
|
+
});
|
|
80293
|
+
},
|
|
80294
|
+
setExtraId: () => {
|
|
80295
|
+
this.setState({
|
|
80296
|
+
extraId: getUuidShort({
|
|
80297
|
+
prefix: 'extra'
|
|
80298
|
+
})
|
|
80299
|
+
});
|
|
79980
80300
|
}
|
|
79981
80301
|
});
|
|
79982
80302
|
}
|
|
@@ -80013,7 +80333,11 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80013
80333
|
value: propValue
|
|
80014
80334
|
} = this.props;
|
|
80015
80335
|
let realChecked, isDisabled, realMode, isButtonRadioGroup, isCardRadioGroup, isPureCardRadioGroup, isButtonRadioComponent, buttonSize, realPrefixCls;
|
|
80016
|
-
const
|
|
80336
|
+
const {
|
|
80337
|
+
hover: isHover,
|
|
80338
|
+
addonId,
|
|
80339
|
+
extraId
|
|
80340
|
+
} = this.state;
|
|
80017
80341
|
let props = {};
|
|
80018
80342
|
|
|
80019
80343
|
if (this.isInGroup()) {
|
|
@@ -80066,10 +80390,10 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80066
80390
|
const renderContent = () => /*#__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, children ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
80067
80391
|
className: addonCls,
|
|
80068
80392
|
style: addonStyle,
|
|
80069
|
-
id:
|
|
80393
|
+
id: addonId
|
|
80070
80394
|
}, children) : null, extra && !isButtonRadio ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
80071
80395
|
className: "".concat(prefix, "-extra"),
|
|
80072
|
-
id:
|
|
80396
|
+
id: extraId
|
|
80073
80397
|
}, extra) : null);
|
|
80074
80398
|
|
|
80075
80399
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("label", {
|
|
@@ -80086,8 +80410,8 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80086
80410
|
ref: ref => {
|
|
80087
80411
|
this.radioEntity = ref;
|
|
80088
80412
|
},
|
|
80089
|
-
addonId: children &&
|
|
80090
|
-
extraId: extra &&
|
|
80413
|
+
addonId: children && addonId,
|
|
80414
|
+
extraId: extra && extraId
|
|
80091
80415
|
})), isCardRadioGroup ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
80092
80416
|
className: "".concat(prefix, "-isCardRadioGroup_content")
|
|
80093
80417
|
}, renderContent()) : renderContent());
|