@douyinfe/semi-ui 2.10.1 → 2.11.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/checkbox/checkbox.tsx +17 -9
- package/checkbox/checkboxInner.tsx +19 -14
- 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/dist/umd/semi-ui.js +570 -216
- 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/form/baseForm.tsx +0 -1
- package/lib/cjs/checkbox/checkbox.d.ts +4 -0
- package/lib/cjs/checkbox/checkbox.js +24 -13
- package/lib/cjs/checkbox/checkboxInner.js +21 -17
- 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/form/baseForm.js +0 -1
- package/lib/cjs/radio/radio.d.ts +4 -0
- package/lib/cjs/radio/radio.js +26 -12
- package/lib/cjs/table/Body/BaseRow.d.ts +1 -0
- package/lib/cjs/table/Body/BaseRow.js +22 -0
- package/lib/cjs/tag/group.d.ts +3 -3
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +6 -1
- package/lib/es/checkbox/checkbox.d.ts +4 -0
- package/lib/es/checkbox/checkbox.js +24 -13
- package/lib/es/checkbox/checkboxInner.js +20 -17
- 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/form/baseForm.js +0 -1
- package/lib/es/radio/radio.d.ts +4 -0
- package/lib/es/radio/radio.js +26 -12
- package/lib/es/table/Body/BaseRow.d.ts +1 -0
- package/lib/es/table/Body/BaseRow.js +22 -0
- package/lib/es/tag/group.d.ts +3 -3
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +6 -1
- package/package.json +9 -9
- package/radio/radio.tsx +17 -7
- package/scrollList/_story/ScrollList/index.js +1 -1
- package/select/index.tsx +7 -7
- package/table/Body/BaseRow.tsx +15 -0
- package/tag/group.tsx +4 -4
- package/tooltip/index.tsx +5 -1
- package/treeSelect/index.tsx +1 -1
- package/upload/_story/upload.stories.js +1 -0
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() {
|
|
@@ -28557,6 +28564,12 @@ class src_Animation_Animation extends external_root_React_commonjs2_react_common
|
|
|
28557
28564
|
forwardInstance
|
|
28558
28565
|
} = this.props;
|
|
28559
28566
|
|
|
28567
|
+
if (this.animation === null) {
|
|
28568
|
+
// didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.animation is correct
|
|
28569
|
+
this.initAnimation();
|
|
28570
|
+
this.bindEvents();
|
|
28571
|
+
}
|
|
28572
|
+
|
|
28560
28573
|
if (typeof forwardInstance === 'function') {
|
|
28561
28574
|
forwardInstance(this.animation);
|
|
28562
28575
|
}
|
|
@@ -29350,7 +29363,7 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
29350
29363
|
placement: props.position || 'top',
|
|
29351
29364
|
transitionStyle: {},
|
|
29352
29365
|
isPositionUpdated: false,
|
|
29353
|
-
id:
|
|
29366
|
+
id: props.wrapperId // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
|
|
29354
29367
|
|
|
29355
29368
|
};
|
|
29356
29369
|
this.foundation = new foundation_Tooltip(this.adapter);
|
|
@@ -29619,6 +29632,11 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
|
|
|
29619
29632
|
},
|
|
29620
29633
|
notifyEscKeydown: event => {
|
|
29621
29634
|
this.props.onEscKeyDown(event);
|
|
29635
|
+
},
|
|
29636
|
+
setId: () => {
|
|
29637
|
+
this.setState({
|
|
29638
|
+
id: getUuidShort()
|
|
29639
|
+
});
|
|
29622
29640
|
}
|
|
29623
29641
|
});
|
|
29624
29642
|
}
|
|
@@ -48228,10 +48246,24 @@ const checkbox_constants_numbers = {};
|
|
|
48228
48246
|
class checkboxFoundation_CheckboxFoundation extends foundation {
|
|
48229
48247
|
constructor(adapter) {
|
|
48230
48248
|
super(assign_default()({}, adapter));
|
|
48231
|
-
}
|
|
48249
|
+
}
|
|
48232
48250
|
|
|
48251
|
+
init() {
|
|
48252
|
+
const {
|
|
48253
|
+
children,
|
|
48254
|
+
extra,
|
|
48255
|
+
extraId,
|
|
48256
|
+
addonId
|
|
48257
|
+
} = this.getProps();
|
|
48233
48258
|
|
|
48234
|
-
|
|
48259
|
+
if (children && !addonId) {
|
|
48260
|
+
this._adapter.setAddonId();
|
|
48261
|
+
}
|
|
48262
|
+
|
|
48263
|
+
if (extra && !extraId) {
|
|
48264
|
+
this._adapter.setExtraId();
|
|
48265
|
+
}
|
|
48266
|
+
}
|
|
48235
48267
|
|
|
48236
48268
|
getEvent(checked, e) {
|
|
48237
48269
|
const props = this.getProps();
|
|
@@ -48332,6 +48364,7 @@ const Context = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_
|
|
|
48332
48364
|
// CONCATENATED MODULE: ./checkbox/checkboxInner.tsx
|
|
48333
48365
|
|
|
48334
48366
|
|
|
48367
|
+
|
|
48335
48368
|
/* eslint-disable no-nested-ternary */
|
|
48336
48369
|
|
|
48337
48370
|
|
|
@@ -48370,27 +48403,29 @@ class checkboxInner_CheckboxInner extends external_root_React_commonjs2_react_co
|
|
|
48370
48403
|
["".concat(prefix, "-inner-display")]: true
|
|
48371
48404
|
});
|
|
48372
48405
|
const icon = checked ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCheckboxTick, null) : indeterminate ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCheckboxIndeterminate, null) : null;
|
|
48373
|
-
|
|
48374
|
-
className: wrapper
|
|
48375
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("input", {
|
|
48406
|
+
const inputProps = {
|
|
48376
48407
|
type: "checkbox",
|
|
48377
|
-
|
|
48378
|
-
|
|
48379
|
-
|
|
48380
|
-
|
|
48381
|
-
|
|
48382
|
-
|
|
48383
|
-
|
|
48384
|
-
|
|
48385
|
-
ref: ref => {
|
|
48386
|
-
this.inputEntity = ref;
|
|
48387
|
-
},
|
|
48408
|
+
'aria-label': this.props['aria-label'],
|
|
48409
|
+
'aria-disabled': disabled,
|
|
48410
|
+
'aria-checked': checked,
|
|
48411
|
+
'aria-labelledby': addonId,
|
|
48412
|
+
'aria-describedby': extraId || this.props['aria-describedby'],
|
|
48413
|
+
'aria-invalid': this.props['aria-invalid'],
|
|
48414
|
+
'aria-errormessage': this.props['aria-errormessage'],
|
|
48415
|
+
'aria-required': this.props['aria-required'],
|
|
48388
48416
|
className: checkboxClasses.INPUT,
|
|
48389
48417
|
onChange: noop_default.a,
|
|
48390
48418
|
checked: checked,
|
|
48391
|
-
disabled: disabled
|
|
48392
|
-
|
|
48393
|
-
|
|
48419
|
+
disabled: disabled
|
|
48420
|
+
};
|
|
48421
|
+
name && (inputProps['name'] = name);
|
|
48422
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
48423
|
+
className: wrapper
|
|
48424
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("input", assign_default()({}, inputProps, {
|
|
48425
|
+
ref: ref => {
|
|
48426
|
+
this.inputEntity = ref;
|
|
48427
|
+
}
|
|
48428
|
+
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
|
|
48394
48429
|
className: inner
|
|
48395
48430
|
}, icon));
|
|
48396
48431
|
}
|
|
@@ -48450,15 +48485,11 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48450
48485
|
|
|
48451
48486
|
const checked = false;
|
|
48452
48487
|
this.state = {
|
|
48453
|
-
checked: props.checked || props.defaultChecked || checked
|
|
48488
|
+
checked: props.checked || props.defaultChecked || checked,
|
|
48489
|
+
addonId: props.addonId,
|
|
48490
|
+
extraId: props.extraId
|
|
48454
48491
|
};
|
|
48455
48492
|
this.checkboxEntity = null;
|
|
48456
|
-
this.addonId = getUuidShort({
|
|
48457
|
-
prefix: 'addon'
|
|
48458
|
-
});
|
|
48459
|
-
this.extraId = getUuidShort({
|
|
48460
|
-
prefix: 'extra'
|
|
48461
|
-
});
|
|
48462
48493
|
this.foundation = new checkboxFoundation(this.adapter);
|
|
48463
48494
|
}
|
|
48464
48495
|
|
|
@@ -48480,7 +48511,21 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48480
48511
|
notifyGroupChange: cbContent => {
|
|
48481
48512
|
this.context.checkboxGroup.onChange(cbContent);
|
|
48482
48513
|
},
|
|
48483
|
-
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
|
+
}
|
|
48484
48529
|
});
|
|
48485
48530
|
}
|
|
48486
48531
|
|
|
@@ -48523,7 +48568,9 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48523
48568
|
id
|
|
48524
48569
|
} = this.props;
|
|
48525
48570
|
const {
|
|
48526
|
-
checked
|
|
48571
|
+
checked,
|
|
48572
|
+
addonId,
|
|
48573
|
+
extraId
|
|
48527
48574
|
} = this.state;
|
|
48528
48575
|
const props = {
|
|
48529
48576
|
checked,
|
|
@@ -48550,6 +48597,7 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48550
48597
|
} = this.context.checkboxGroup;
|
|
48551
48598
|
props.isCardType = isCardType;
|
|
48552
48599
|
props.isPureCardType = isPureCardType;
|
|
48600
|
+
props['name'] = this.context.checkboxGroup.name;
|
|
48553
48601
|
}
|
|
48554
48602
|
|
|
48555
48603
|
const prefix = prefixCls || checkboxClasses.PREFIX;
|
|
@@ -48568,13 +48616,12 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48568
48616
|
const extraCls = classnames_default()("".concat(prefix, "-extra"), {
|
|
48569
48617
|
["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
|
|
48570
48618
|
});
|
|
48571
|
-
const name = inGroup && this.context.checkboxGroup.name;
|
|
48572
48619
|
|
|
48573
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", {
|
|
48574
|
-
id:
|
|
48621
|
+
id: addonId,
|
|
48575
48622
|
className: "".concat(prefix, "-addon")
|
|
48576
48623
|
}, children) : null, extra ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
48577
|
-
id:
|
|
48624
|
+
id: extraId,
|
|
48578
48625
|
className: extraCls
|
|
48579
48626
|
}, extra) : null);
|
|
48580
48627
|
|
|
@@ -48596,7 +48643,6 @@ class checkbox_Checkbox extends baseComponent_BaseComponent {
|
|
|
48596
48643
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(checkboxInner, assign_default()({}, this.props, props, {
|
|
48597
48644
|
addonId: children && this.addonId,
|
|
48598
48645
|
extraId: extra && this.extraId,
|
|
48599
|
-
name: name,
|
|
48600
48646
|
isPureCardType: props.isPureCardType,
|
|
48601
48647
|
ref: ref => {
|
|
48602
48648
|
this.checkboxEntity = ref;
|
|
@@ -56134,6 +56180,27 @@ function compatibleParse(value, formatToken, baseDate, locale) {
|
|
|
56134
56180
|
|
|
56135
56181
|
return result;
|
|
56136
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
|
+
}
|
|
56137
56204
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/_utils/getDefaultFormatToken.ts
|
|
56138
56205
|
|
|
56139
56206
|
const defaultFormatTokens = {
|
|
@@ -56286,6 +56353,7 @@ function getInsetInputValueFromInsetInputStr(options) {
|
|
|
56286
56353
|
|
|
56287
56354
|
|
|
56288
56355
|
|
|
56356
|
+
|
|
56289
56357
|
/* eslint-disable no-nested-ternary */
|
|
56290
56358
|
|
|
56291
56359
|
/* eslint-disable max-len, max-depth, */
|
|
@@ -56404,9 +56472,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56404
56472
|
|
|
56405
56473
|
this._adapter.updateValue(result);
|
|
56406
56474
|
|
|
56407
|
-
|
|
56408
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56409
|
-
}
|
|
56475
|
+
this.resetCachedSelectedValue(result);
|
|
56410
56476
|
}
|
|
56411
56477
|
|
|
56412
56478
|
parseWithTimezone(value, timeZone, prevTimeZone) {
|
|
@@ -56547,6 +56613,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56547
56613
|
this._adapter.updateInsetInputValue(null);
|
|
56548
56614
|
}
|
|
56549
56615
|
}
|
|
56616
|
+
/**
|
|
56617
|
+
* call it when change state value or input value
|
|
56618
|
+
*/
|
|
56619
|
+
|
|
56550
56620
|
|
|
56551
56621
|
resetCachedSelectedValue(willUpdateDates) {
|
|
56552
56622
|
const {
|
|
@@ -56579,11 +56649,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56579
56649
|
let dates = arguments.length > 2 ? arguments[2] : undefined;
|
|
56580
56650
|
|
|
56581
56651
|
const {
|
|
56582
|
-
value
|
|
56583
|
-
cachedSelectedValue
|
|
56652
|
+
value
|
|
56584
56653
|
} = this._adapter.getStates();
|
|
56585
56654
|
|
|
56586
|
-
const willUpdateDates = isNullOrUndefined(dates) ?
|
|
56655
|
+
const willUpdateDates = isNullOrUndefined(dates) ? value : dates;
|
|
56587
56656
|
|
|
56588
56657
|
if (!this._isControlledComponent('open')) {
|
|
56589
56658
|
this._adapter.togglePanel(false);
|
|
@@ -56612,7 +56681,10 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56612
56681
|
const result = this._isMultiple() ? this.parseMultipleInput(input) : this.parseInput(input);
|
|
56613
56682
|
const {
|
|
56614
56683
|
value: stateValue
|
|
56615
|
-
} = this.getStates();
|
|
56684
|
+
} = this.getStates();
|
|
56685
|
+
|
|
56686
|
+
this._updateCachedSelectedValueFromInput(input); // Enter a valid date or empty
|
|
56687
|
+
|
|
56616
56688
|
|
|
56617
56689
|
if (result && result.length || input === '') {
|
|
56618
56690
|
// If you click the clear button
|
|
@@ -56628,10 +56700,6 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56628
56700
|
const changedDates = this._getChangedDates(result);
|
|
56629
56701
|
|
|
56630
56702
|
if (!this._someDateDisabled(changedDates)) {
|
|
56631
|
-
if (this._adapter.needConfirm()) {
|
|
56632
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56633
|
-
}
|
|
56634
|
-
|
|
56635
56703
|
if (!isEqual_default()(result, stateValue)) {
|
|
56636
56704
|
this._notifyChange(result);
|
|
56637
56705
|
}
|
|
@@ -56662,16 +56730,14 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56662
56730
|
value: stateValue
|
|
56663
56731
|
} = this.getStates();
|
|
56664
56732
|
|
|
56733
|
+
this._updateCachedSelectedValueFromInput(insetInputStr);
|
|
56734
|
+
|
|
56665
56735
|
if (result && result.length) {
|
|
56666
56736
|
const changedDates = this._getChangedDates(result);
|
|
56667
56737
|
|
|
56668
56738
|
if (!this._someDateDisabled(changedDates)) {
|
|
56669
|
-
if (this._adapter.needConfirm()) {
|
|
56670
|
-
this._adapter.updateCachedSelectedValue(result);
|
|
56671
|
-
}
|
|
56672
|
-
|
|
56673
56739
|
if (!isEqual_default()(result, stateValue)) {
|
|
56674
|
-
if (!this._isControlledComponent()) {
|
|
56740
|
+
if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
|
|
56675
56741
|
this._adapter.updateValue(result);
|
|
56676
56742
|
}
|
|
56677
56743
|
|
|
@@ -56686,6 +56752,20 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56686
56752
|
|
|
56687
56753
|
this._adapter.updateInsetInputValue(insetInputValue);
|
|
56688
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
|
+
}
|
|
56689
56769
|
/**
|
|
56690
56770
|
* Input box blur
|
|
56691
56771
|
* @param {String} input
|
|
@@ -56707,6 +56787,20 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56707
56787
|
} else {
|
|
56708
56788
|
this._updateValueAndInput(stateValue);
|
|
56709
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
|
+
}
|
|
56710
56804
|
}
|
|
56711
56805
|
/**
|
|
56712
56806
|
* called when range type rangeEnd input tab press
|
|
@@ -56763,9 +56857,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56763
56857
|
if (!this._isControlledComponent('value')) {
|
|
56764
56858
|
this._updateValueAndInput(value, true, inputValue);
|
|
56765
56859
|
|
|
56766
|
-
|
|
56767
|
-
this._adapter.updateCachedSelectedValue(value);
|
|
56768
|
-
}
|
|
56860
|
+
this.resetCachedSelectedValue(value);
|
|
56769
56861
|
}
|
|
56770
56862
|
|
|
56771
56863
|
this._notifyChange(value);
|
|
@@ -56869,6 +56961,138 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
56869
56961
|
|
|
56870
56962
|
return result;
|
|
56871
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
|
+
}
|
|
56872
57096
|
/**
|
|
56873
57097
|
* Parses the input when multiple is true, if valid,
|
|
56874
57098
|
* returns a list of time objects, otherwise returns an array
|
|
@@ -57068,10 +57292,6 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
57068
57292
|
|
|
57069
57293
|
const needCheckFocusRecord = get_default()(options, 'needCheckFocusRecord', true);
|
|
57070
57294
|
|
|
57071
|
-
if (this._adapter.needConfirm()) {
|
|
57072
|
-
this._adapter.updateCachedSelectedValue(value);
|
|
57073
|
-
}
|
|
57074
|
-
|
|
57075
57295
|
const dates = is_array_default()(value) ? [...value] : value ? [value] : [];
|
|
57076
57296
|
|
|
57077
57297
|
const changedDates = this._getChangedDates(dates);
|
|
@@ -57079,6 +57299,7 @@ class foundation_DatePickerFoundation extends foundation {
|
|
|
57079
57299
|
let inputValue, insetInputValue;
|
|
57080
57300
|
|
|
57081
57301
|
if (!this._someDateDisabled(changedDates)) {
|
|
57302
|
+
this.resetCachedSelectedValue(dates);
|
|
57082
57303
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
57083
57304
|
|
|
57084
57305
|
if (insetInput) {
|
|
@@ -57615,6 +57836,134 @@ function formatDateValues(values, formatToken) {
|
|
|
57615
57836
|
|
|
57616
57837
|
return text;
|
|
57617
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
|
+
}
|
|
57618
57967
|
// CONCATENATED MODULE: ../semi-foundation/datePicker/inputFoundation.ts
|
|
57619
57968
|
|
|
57620
57969
|
|
|
@@ -57626,6 +57975,13 @@ function formatDateValues(values, formatToken) {
|
|
|
57626
57975
|
|
|
57627
57976
|
|
|
57628
57977
|
|
|
57978
|
+
|
|
57979
|
+
|
|
57980
|
+
|
|
57981
|
+
|
|
57982
|
+
|
|
57983
|
+
|
|
57984
|
+
|
|
57629
57985
|
const KEY_CODE_ENTER = 'Enter';
|
|
57630
57986
|
const KEY_CODE_TAB = 'Tab';
|
|
57631
57987
|
class inputFoundation_InputFoundation extends foundation {
|
|
@@ -57746,8 +58102,13 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
57746
58102
|
format
|
|
57747
58103
|
});
|
|
57748
58104
|
|
|
57749
|
-
|
|
58105
|
+
let newInsetInputValue = lodash_set_default()(cloneDeep_default()(insetInputValue), valuePath, value);
|
|
57750
58106
|
|
|
58107
|
+
newInsetInputValue = this._autoFillTimeToInsetInputValue({
|
|
58108
|
+
insetInputValue: newInsetInputValue,
|
|
58109
|
+
valuePath,
|
|
58110
|
+
format: insetFormatToken
|
|
58111
|
+
});
|
|
57751
58112
|
const newInputValue = this.concatInsetInputValue({
|
|
57752
58113
|
insetInputValue: newInsetInputValue
|
|
57753
58114
|
});
|
|
@@ -57758,6 +58119,74 @@ class inputFoundation_InputFoundation extends foundation {
|
|
|
57758
58119
|
insetInputStr: newInputValue
|
|
57759
58120
|
});
|
|
57760
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
|
+
}
|
|
57761
58190
|
/**
|
|
57762
58191
|
* 只有传入的 format 符合 formatReg 时,才会使用用户传入的 format
|
|
57763
58192
|
* 否则会使用默认的 format 作为 placeholder
|
|
@@ -58353,9 +58782,10 @@ class dateInput_DateInput extends baseComponent_BaseComponent {
|
|
|
58353
58782
|
rangeInputFocus,
|
|
58354
58783
|
rangeSeparator,
|
|
58355
58784
|
insetInput,
|
|
58356
|
-
insetInputValue
|
|
58785
|
+
insetInputValue,
|
|
58786
|
+
defaultPickerValue
|
|
58357
58787
|
} = _a,
|
|
58358
|
-
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"]);
|
|
58359
58789
|
|
|
58360
58790
|
const dateIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconCalendar, {
|
|
58361
58791
|
"aria-hidden": true
|
|
@@ -58439,7 +58869,8 @@ dateInput_DateInput.propTypes = {
|
|
|
58439
58869
|
rangeInputEndRef: prop_types_default.a.object,
|
|
58440
58870
|
rangeSeparator: prop_types_default.a.string,
|
|
58441
58871
|
insetInput: prop_types_default.a.bool,
|
|
58442
|
-
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])
|
|
58443
58874
|
};
|
|
58444
58875
|
dateInput_DateInput.defaultProps = {
|
|
58445
58876
|
showClear: true,
|
|
@@ -58527,76 +58958,6 @@ function differenceInCalendarYears(dirtyDateLeft, dirtyDateRight) {
|
|
|
58527
58958
|
var dateRight = toDate(dirtyDateRight);
|
|
58528
58959
|
return dateLeft.getFullYear() - dateRight.getFullYear();
|
|
58529
58960
|
}
|
|
58530
|
-
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/addMonths/index.js
|
|
58531
|
-
|
|
58532
|
-
|
|
58533
|
-
|
|
58534
|
-
/**
|
|
58535
|
-
* @name addMonths
|
|
58536
|
-
* @category Month Helpers
|
|
58537
|
-
* @summary Add the specified number of months to the given date.
|
|
58538
|
-
*
|
|
58539
|
-
* @description
|
|
58540
|
-
* Add the specified number of months to the given date.
|
|
58541
|
-
*
|
|
58542
|
-
* ### v2.0.0 breaking changes:
|
|
58543
|
-
*
|
|
58544
|
-
* - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
|
|
58545
|
-
*
|
|
58546
|
-
* @param {Date|Number} date - the date to be changed
|
|
58547
|
-
* @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`.
|
|
58548
|
-
* @returns {Date} the new date with the months added
|
|
58549
|
-
* @throws {TypeError} 2 arguments required
|
|
58550
|
-
*
|
|
58551
|
-
* @example
|
|
58552
|
-
* // Add 5 months to 1 September 2014:
|
|
58553
|
-
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
58554
|
-
* //=> Sun Feb 01 2015 00:00:00
|
|
58555
|
-
*/
|
|
58556
|
-
|
|
58557
|
-
function addMonths(dirtyDate, dirtyAmount) {
|
|
58558
|
-
requiredArgs(2, arguments);
|
|
58559
|
-
var date = toDate(dirtyDate);
|
|
58560
|
-
var amount = toInteger(dirtyAmount);
|
|
58561
|
-
|
|
58562
|
-
if (isNaN(amount)) {
|
|
58563
|
-
return new Date(NaN);
|
|
58564
|
-
}
|
|
58565
|
-
|
|
58566
|
-
if (!amount) {
|
|
58567
|
-
// If 0 months, no-op to avoid changing times in the hour before end of DST
|
|
58568
|
-
return date;
|
|
58569
|
-
}
|
|
58570
|
-
|
|
58571
|
-
var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
|
|
58572
|
-
// month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
|
|
58573
|
-
// new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
|
|
58574
|
-
// want except that dates will wrap around the end of a month, meaning that
|
|
58575
|
-
// new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
|
|
58576
|
-
// we'll default to the end of the desired month by adding 1 to the desired
|
|
58577
|
-
// month and using a date of 0 to back up one day to the end of the desired
|
|
58578
|
-
// month.
|
|
58579
|
-
|
|
58580
|
-
var endOfDesiredMonth = new Date(date.getTime());
|
|
58581
|
-
endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
|
|
58582
|
-
var daysInMonth = endOfDesiredMonth.getDate();
|
|
58583
|
-
|
|
58584
|
-
if (dayOfMonth >= daysInMonth) {
|
|
58585
|
-
// If we're already at the end of the month, then this is the correct date
|
|
58586
|
-
// and we're done.
|
|
58587
|
-
return endOfDesiredMonth;
|
|
58588
|
-
} else {
|
|
58589
|
-
// Otherwise, we now know that setting the original day-of-month value won't
|
|
58590
|
-
// cause an overflow, so set the desired day-of-month. Note that we can't
|
|
58591
|
-
// just set the date of `endOfDesiredMonth` because that object may have had
|
|
58592
|
-
// its time changed in the unusual case where where a DST transition was on
|
|
58593
|
-
// the last day of the month and its local time was in the hour skipped or
|
|
58594
|
-
// repeated next to a DST transition. So we use `date` instead which is
|
|
58595
|
-
// guaranteed to still have the original time.
|
|
58596
|
-
date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
|
58597
|
-
return date;
|
|
58598
|
-
}
|
|
58599
|
-
}
|
|
58600
58961
|
// CONCATENATED MODULE: /home/runner/work/semi-design/semi-design/node_modules/date-fns/esm/subMonths/index.js
|
|
58601
58962
|
|
|
58602
58963
|
|
|
@@ -59135,10 +59496,10 @@ class monthsGridFoundation_MonthsGridFoundation extends foundation {
|
|
|
59135
59496
|
const newSelected = new set_default.a();
|
|
59136
59497
|
|
|
59137
59498
|
if (!this._isMultiple()) {
|
|
59138
|
-
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));
|
|
59139
59500
|
} else {
|
|
59140
59501
|
for_each_default()(values).call(values, date => {
|
|
59141
|
-
newSelected.add(format_format(date, datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59502
|
+
date && newSelected.add(format_format(date, datePicker_constants_strings.FORMAT_FULL_DATE));
|
|
59142
59503
|
});
|
|
59143
59504
|
}
|
|
59144
59505
|
|
|
@@ -62754,64 +63115,6 @@ yearAndMonth_YearAndMonth.defaultProps = {
|
|
|
62754
63115
|
onSelect: noop_default.a
|
|
62755
63116
|
};
|
|
62756
63117
|
/* harmony default export */ var yearAndMonth = (yearAndMonth_YearAndMonth);
|
|
62757
|
-
// CONCATENATED MODULE: ../semi-foundation/datePicker/_utils/getDefaultPickerDate.ts
|
|
62758
|
-
|
|
62759
|
-
|
|
62760
|
-
|
|
62761
|
-
|
|
62762
|
-
|
|
62763
|
-
/**
|
|
62764
|
-
* get left panel picker date and right panel picker date
|
|
62765
|
-
*/
|
|
62766
|
-
|
|
62767
|
-
function getDefaultPickerDate(options) {
|
|
62768
|
-
const {
|
|
62769
|
-
defaultPickerValue,
|
|
62770
|
-
format,
|
|
62771
|
-
dateFnsLocale
|
|
62772
|
-
} = options;
|
|
62773
|
-
let nowDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[0] : defaultPickerValue;
|
|
62774
|
-
let nextDate = is_array_default()(defaultPickerValue) ? defaultPickerValue[1] : undefined;
|
|
62775
|
-
|
|
62776
|
-
switch (true) {
|
|
62777
|
-
case isValidDate(nowDate):
|
|
62778
|
-
break;
|
|
62779
|
-
|
|
62780
|
-
case isTimestamp(nowDate):
|
|
62781
|
-
nowDate = new Date(nowDate);
|
|
62782
|
-
break;
|
|
62783
|
-
|
|
62784
|
-
case typeof nowDate === 'string':
|
|
62785
|
-
nowDate = compatibleParse(nowDate, format, undefined, dateFnsLocale);
|
|
62786
|
-
break;
|
|
62787
|
-
|
|
62788
|
-
default:
|
|
62789
|
-
nowDate = new Date();
|
|
62790
|
-
break;
|
|
62791
|
-
}
|
|
62792
|
-
|
|
62793
|
-
switch (true) {
|
|
62794
|
-
case isValidDate(nextDate):
|
|
62795
|
-
break;
|
|
62796
|
-
|
|
62797
|
-
case isTimestamp(nextDate):
|
|
62798
|
-
nextDate = new Date(nextDate);
|
|
62799
|
-
break;
|
|
62800
|
-
|
|
62801
|
-
case typeof nextDate === 'string':
|
|
62802
|
-
nextDate = compatibleParse(nextDate, format, undefined, dateFnsLocale);
|
|
62803
|
-
break;
|
|
62804
|
-
|
|
62805
|
-
default:
|
|
62806
|
-
nextDate = addMonths(nowDate, 1);
|
|
62807
|
-
break;
|
|
62808
|
-
}
|
|
62809
|
-
|
|
62810
|
-
return {
|
|
62811
|
-
nowDate: nowDate,
|
|
62812
|
-
nextDate: nextDate
|
|
62813
|
-
};
|
|
62814
|
-
}
|
|
62815
63118
|
// CONCATENATED MODULE: ./datePicker/monthsGrid.tsx
|
|
62816
63119
|
|
|
62817
63120
|
|
|
@@ -63045,7 +63348,8 @@ class monthsGrid_MonthsGrid extends baseComponent_BaseComponent {
|
|
|
63045
63348
|
} = this.props;
|
|
63046
63349
|
|
|
63047
63350
|
if (prevProps.defaultValue !== defaultValue) {
|
|
63048
|
-
|
|
63351
|
+
// we should always update panel state when value changes
|
|
63352
|
+
this.foundation.updateSelectedFromProps(defaultValue);
|
|
63049
63353
|
}
|
|
63050
63354
|
|
|
63051
63355
|
if (prevProps.defaultPickerValue !== defaultPickerValue) {
|
|
@@ -63748,7 +64052,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
63748
64052
|
insetInput,
|
|
63749
64053
|
type,
|
|
63750
64054
|
format,
|
|
63751
|
-
rangeSeparator
|
|
64055
|
+
rangeSeparator,
|
|
64056
|
+
defaultPickerValue
|
|
63752
64057
|
} = this.props;
|
|
63753
64058
|
const {
|
|
63754
64059
|
insetInputValue,
|
|
@@ -63770,7 +64075,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
63770
64075
|
onInsetInputChange: this.handleInsetInputChange,
|
|
63771
64076
|
rangeInputStartRef: this.rangeInputStartRef,
|
|
63772
64077
|
rangeInputEndRef: this.rangeInputEndRef,
|
|
63773
|
-
density
|
|
64078
|
+
density,
|
|
64079
|
+
defaultPickerValue
|
|
63774
64080
|
};
|
|
63775
64081
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
63776
64082
|
ref: this.panelRef,
|
|
@@ -64141,18 +64447,11 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64141
64447
|
insetInput
|
|
64142
64448
|
} = this.props;
|
|
64143
64449
|
const {
|
|
64144
|
-
value,
|
|
64145
64450
|
cachedSelectedValue,
|
|
64146
64451
|
motionEnd,
|
|
64147
64452
|
rangeInputFocus
|
|
64148
|
-
} = this.state;
|
|
64149
|
-
|
|
64150
|
-
let defaultValue = value;
|
|
64151
|
-
|
|
64152
|
-
if (this.adapter.needConfirm()) {
|
|
64153
|
-
defaultValue = cachedSelectedValue;
|
|
64154
|
-
}
|
|
64155
|
-
|
|
64453
|
+
} = this.state;
|
|
64454
|
+
const defaultValue = cachedSelectedValue;
|
|
64156
64455
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(monthsGrid_MonthsGrid, {
|
|
64157
64456
|
ref: this.monthGrid,
|
|
64158
64457
|
locale: locale,
|
|
@@ -64224,7 +64523,8 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64224
64523
|
size,
|
|
64225
64524
|
inputReadOnly,
|
|
64226
64525
|
rangeSeparator,
|
|
64227
|
-
insetInput
|
|
64526
|
+
insetInput,
|
|
64527
|
+
defaultPickerValue
|
|
64228
64528
|
} = this.props;
|
|
64229
64529
|
const {
|
|
64230
64530
|
value,
|
|
@@ -64250,6 +64550,7 @@ class datePicker_DatePicker extends baseComponent_BaseComponent {
|
|
|
64250
64550
|
disabled: inputDisabled,
|
|
64251
64551
|
inputValue,
|
|
64252
64552
|
value: value,
|
|
64553
|
+
defaultPickerValue,
|
|
64253
64554
|
onChange: this.handleInputChange,
|
|
64254
64555
|
onEnterPress: this.handleInputComplete,
|
|
64255
64556
|
// TODO: remove in next major version
|
|
@@ -79703,6 +80004,23 @@ class radioGroupFoundation_RadioGroupFoundation extends foundation {
|
|
|
79703
80004
|
// CONCATENATED MODULE: ../semi-foundation/radio/radioFoundation.ts
|
|
79704
80005
|
|
|
79705
80006
|
class radioFoundation_RadioFoundation extends foundation {
|
|
80007
|
+
init() {
|
|
80008
|
+
const {
|
|
80009
|
+
children,
|
|
80010
|
+
extra,
|
|
80011
|
+
extraId,
|
|
80012
|
+
addonId
|
|
80013
|
+
} = this._adapter.getProps();
|
|
80014
|
+
|
|
80015
|
+
if (children && !addonId) {
|
|
80016
|
+
this._adapter.setAddonId();
|
|
80017
|
+
}
|
|
80018
|
+
|
|
80019
|
+
if (extra && !extraId) {
|
|
80020
|
+
this._adapter.setExtraId();
|
|
80021
|
+
}
|
|
80022
|
+
}
|
|
80023
|
+
|
|
79706
80024
|
setHover(hover) {
|
|
79707
80025
|
this._adapter.setHover(hover);
|
|
79708
80026
|
}
|
|
@@ -79949,16 +80267,12 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
79949
80267
|
};
|
|
79950
80268
|
|
|
79951
80269
|
this.state = {
|
|
79952
|
-
hover: false
|
|
80270
|
+
hover: false,
|
|
80271
|
+
addonId: props.addonId,
|
|
80272
|
+
extraId: props.extraId
|
|
79953
80273
|
};
|
|
79954
80274
|
this.foundation = new radioFoundation_RadioFoundation(this.adapter);
|
|
79955
80275
|
this.radioEntity = null;
|
|
79956
|
-
this.addonId = getUuidShort({
|
|
79957
|
-
prefix: 'addon'
|
|
79958
|
-
});
|
|
79959
|
-
this.extraId = getUuidShort({
|
|
79960
|
-
prefix: 'extra'
|
|
79961
|
-
});
|
|
79962
80276
|
}
|
|
79963
80277
|
|
|
79964
80278
|
get adapter() {
|
|
@@ -79967,6 +80281,20 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
79967
80281
|
this.setState({
|
|
79968
80282
|
hover
|
|
79969
80283
|
});
|
|
80284
|
+
},
|
|
80285
|
+
setAddonId: () => {
|
|
80286
|
+
this.setState({
|
|
80287
|
+
addonId: getUuidShort({
|
|
80288
|
+
prefix: 'addon'
|
|
80289
|
+
})
|
|
80290
|
+
});
|
|
80291
|
+
},
|
|
80292
|
+
setExtraId: () => {
|
|
80293
|
+
this.setState({
|
|
80294
|
+
extraId: getUuidShort({
|
|
80295
|
+
prefix: 'extra'
|
|
80296
|
+
})
|
|
80297
|
+
});
|
|
79970
80298
|
}
|
|
79971
80299
|
});
|
|
79972
80300
|
}
|
|
@@ -80003,7 +80331,11 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80003
80331
|
value: propValue
|
|
80004
80332
|
} = this.props;
|
|
80005
80333
|
let realChecked, isDisabled, realMode, isButtonRadioGroup, isCardRadioGroup, isPureCardRadioGroup, isButtonRadioComponent, buttonSize, realPrefixCls;
|
|
80006
|
-
const
|
|
80334
|
+
const {
|
|
80335
|
+
hover: isHover,
|
|
80336
|
+
addonId,
|
|
80337
|
+
extraId
|
|
80338
|
+
} = this.state;
|
|
80007
80339
|
let props = {};
|
|
80008
80340
|
|
|
80009
80341
|
if (this.isInGroup()) {
|
|
@@ -80056,10 +80388,10 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80056
80388
|
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", {
|
|
80057
80389
|
className: addonCls,
|
|
80058
80390
|
style: addonStyle,
|
|
80059
|
-
id:
|
|
80391
|
+
id: addonId
|
|
80060
80392
|
}, children) : null, extra && !isButtonRadio ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
80061
80393
|
className: "".concat(prefix, "-extra"),
|
|
80062
|
-
id:
|
|
80394
|
+
id: extraId
|
|
80063
80395
|
}, extra) : null);
|
|
80064
80396
|
|
|
80065
80397
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("label", {
|
|
@@ -80076,8 +80408,8 @@ class radio_Radio extends baseComponent_BaseComponent {
|
|
|
80076
80408
|
ref: ref => {
|
|
80077
80409
|
this.radioEntity = ref;
|
|
80078
80410
|
},
|
|
80079
|
-
addonId: children &&
|
|
80080
|
-
extraId: extra &&
|
|
80411
|
+
addonId: children && addonId,
|
|
80412
|
+
extraId: extra && extraId
|
|
80081
80413
|
})), isCardRadioGroup ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
|
|
80082
80414
|
className: "".concat(prefix, "-isCardRadioGroup_content")
|
|
80083
80415
|
}, renderContent()) : renderContent());
|
|
@@ -88226,6 +88558,28 @@ class BaseRow_TableRow extends baseComponent_BaseComponent {
|
|
|
88226
88558
|
});
|
|
88227
88559
|
}
|
|
88228
88560
|
|
|
88561
|
+
componentDidMount() {
|
|
88562
|
+
// fix #745
|
|
88563
|
+
// didmount/willUnmount may be called twice when React.StrictMode is true in React 18, we need to ensure that this.cache.customRowProps is correct
|
|
88564
|
+
const {
|
|
88565
|
+
onRow,
|
|
88566
|
+
index,
|
|
88567
|
+
record
|
|
88568
|
+
} = this.props;
|
|
88569
|
+
const customRowProps = this.adapter.getCache('customRowProps');
|
|
88570
|
+
|
|
88571
|
+
if (typeof customRowProps === 'undefined') {
|
|
88572
|
+
const _a = onRow(record, index) || {},
|
|
88573
|
+
{
|
|
88574
|
+
className: customClassName,
|
|
88575
|
+
style: customStyle
|
|
88576
|
+
} = _a,
|
|
88577
|
+
rowProps = BaseRow_rest(_a, ["className", "style"]);
|
|
88578
|
+
|
|
88579
|
+
this.adapter.setCache('customRowProps', assign_default()({}, rowProps));
|
|
88580
|
+
}
|
|
88581
|
+
}
|
|
88582
|
+
|
|
88229
88583
|
shouldComponentUpdate(nextProps) {
|
|
88230
88584
|
/**
|
|
88231
88585
|
* Shallow comparison of incoming props to simulate PureComponent
|
|
@@ -100957,6 +101311,7 @@ class foundation_UploadFoundation extends foundation {
|
|
|
100957
101311
|
if (!disabled) {
|
|
100958
101312
|
if (directory) {
|
|
100959
101313
|
this.handleDirectoryDrop(e);
|
|
101314
|
+
return;
|
|
100960
101315
|
}
|
|
100961
101316
|
|
|
100962
101317
|
const files = from_default()(e.dataTransfer.files);
|
|
@@ -107293,7 +107648,6 @@ class baseForm_Form extends baseComponent_BaseComponent {
|
|
|
107293
107648
|
|
|
107294
107649
|
componentWillUnmount() {
|
|
107295
107650
|
this.foundation.destroy();
|
|
107296
|
-
this.foundation = null;
|
|
107297
107651
|
this.formApi = null;
|
|
107298
107652
|
}
|
|
107299
107653
|
|