@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/checkbox/checkbox.tsx
CHANGED
|
@@ -29,9 +29,13 @@ export interface CheckboxProps extends BaseCheckboxProps {
|
|
|
29
29
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
30
30
|
role?: React.HTMLAttributes<HTMLSpanElement>['role']; // a11y: wrapper role
|
|
31
31
|
tabIndex?: number; // a11y: wrapper tabIndex
|
|
32
|
+
addonId?: string;
|
|
33
|
+
extraId?: string;
|
|
32
34
|
}
|
|
33
35
|
interface CheckboxState {
|
|
34
36
|
checked: boolean;
|
|
37
|
+
addonId?: string;
|
|
38
|
+
extraId?: string;
|
|
35
39
|
}
|
|
36
40
|
class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
37
41
|
static contextType = Context;
|
|
@@ -89,7 +93,13 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
89
93
|
notifyGroupChange: cbContent => {
|
|
90
94
|
this.context.checkboxGroup.onChange(cbContent);
|
|
91
95
|
},
|
|
92
|
-
getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled)
|
|
96
|
+
getGroupDisabled: () => (this.context && this.context.checkboxGroup.disabled),
|
|
97
|
+
setAddonId: () => {
|
|
98
|
+
this.setState({ addonId: getUuidShort({ prefix: 'addon' }) });
|
|
99
|
+
},
|
|
100
|
+
setExtraId: () => {
|
|
101
|
+
this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
|
|
102
|
+
}
|
|
93
103
|
};
|
|
94
104
|
}
|
|
95
105
|
|
|
@@ -103,11 +113,11 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
103
113
|
|
|
104
114
|
this.state = {
|
|
105
115
|
checked: props.checked || props.defaultChecked || checked,
|
|
116
|
+
addonId: props.addonId,
|
|
117
|
+
extraId: props.extraId,
|
|
106
118
|
};
|
|
107
119
|
|
|
108
120
|
this.checkboxEntity = null;
|
|
109
|
-
this.addonId = getUuidShort({ prefix: 'addon' });
|
|
110
|
-
this.extraId = getUuidShort({ prefix: 'extra' });
|
|
111
121
|
this.foundation = new CheckboxFoundation(this.adapter);
|
|
112
122
|
}
|
|
113
123
|
|
|
@@ -153,7 +163,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
153
163
|
tabIndex,
|
|
154
164
|
id
|
|
155
165
|
} = this.props;
|
|
156
|
-
const { checked } = this.state;
|
|
166
|
+
const { checked, addonId, extraId } = this.state;
|
|
157
167
|
const props: Record<string, any> = {
|
|
158
168
|
checked,
|
|
159
169
|
disabled,
|
|
@@ -171,6 +181,7 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
171
181
|
const { isCardType, isPureCardType } = this.context.checkboxGroup;
|
|
172
182
|
props.isCardType = isCardType;
|
|
173
183
|
props.isPureCardType = isPureCardType;
|
|
184
|
+
props['name'] = this.context.checkboxGroup.name;
|
|
174
185
|
}
|
|
175
186
|
|
|
176
187
|
const prefix = prefixCls || css.PREFIX;
|
|
@@ -192,12 +203,10 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
192
203
|
[`${prefix}-cardType_extra_noChildren`]: props.isCardType && !children,
|
|
193
204
|
});
|
|
194
205
|
|
|
195
|
-
const name = inGroup && this.context.checkboxGroup.name;
|
|
196
|
-
|
|
197
206
|
const renderContent = () => (
|
|
198
207
|
<>
|
|
199
|
-
{children ? <span id={
|
|
200
|
-
{extra ? <div id={
|
|
208
|
+
{children ? <span id={addonId} className={`${prefix}-addon`}>{children}</span> : null}
|
|
209
|
+
{extra ? <div id={extraId} className={extraCls}>{extra}</div> : null}
|
|
201
210
|
</>
|
|
202
211
|
);
|
|
203
212
|
return (
|
|
@@ -220,7 +229,6 @@ class Checkbox extends BaseComponent<CheckboxProps, CheckboxState> {
|
|
|
220
229
|
{...props}
|
|
221
230
|
addonId={children && this.addonId}
|
|
222
231
|
extraId={extra && this.extraId}
|
|
223
|
-
name={name}
|
|
224
232
|
isPureCardType={props.isPureCardType}
|
|
225
233
|
ref={ref => {
|
|
226
234
|
this.checkboxEntity = ref;
|
|
@@ -81,26 +81,31 @@ class CheckboxInner extends PureComponent<CheckboxInnerProps> {
|
|
|
81
81
|
<IconCheckboxIndeterminate />
|
|
82
82
|
) : null;
|
|
83
83
|
|
|
84
|
+
const inputProps: React.InputHTMLAttributes<HTMLInputElement> = {
|
|
85
|
+
type: "checkbox",
|
|
86
|
+
'aria-label': this.props['aria-label'],
|
|
87
|
+
'aria-disabled': disabled,
|
|
88
|
+
'aria-checked': checked,
|
|
89
|
+
'aria-labelledby': addonId,
|
|
90
|
+
'aria-describedby':extraId || this.props['aria-describedby'],
|
|
91
|
+
'aria-invalid': this.props['aria-invalid'],
|
|
92
|
+
'aria-errormessage': this.props['aria-errormessage'],
|
|
93
|
+
'aria-required': this.props['aria-required'],
|
|
94
|
+
className: css.INPUT,
|
|
95
|
+
onChange: noop,
|
|
96
|
+
checked: checked,
|
|
97
|
+
disabled: disabled,
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
name && (inputProps['name'] = name);
|
|
101
|
+
|
|
84
102
|
return (
|
|
85
103
|
<span className={wrapper}>
|
|
86
104
|
<input
|
|
87
|
-
|
|
88
|
-
aria-label={this.props['aria-label']}
|
|
89
|
-
aria-disabled={disabled}
|
|
90
|
-
aria-checked={checked}
|
|
91
|
-
aria-labelledby={addonId}
|
|
92
|
-
aria-describedby={extraId || this.props['aria-describedby']}
|
|
93
|
-
aria-invalid={this.props['aria-invalid']}
|
|
94
|
-
aria-errormessage={this.props['aria-errormessage']}
|
|
95
|
-
aria-required={this.props['aria-required']}
|
|
105
|
+
{...inputProps}
|
|
96
106
|
ref={ref => {
|
|
97
107
|
this.inputEntity = ref;
|
|
98
108
|
}}
|
|
99
|
-
className={css.INPUT}
|
|
100
|
-
onChange={noop}
|
|
101
|
-
checked={checked}
|
|
102
|
-
disabled={disabled}
|
|
103
|
-
name={name}
|
|
104
109
|
/>
|
|
105
110
|
<span className={inner}>{icon}</span>
|
|
106
111
|
</span>
|
|
@@ -849,5 +849,52 @@ export const A11yKeyboardDemo = () => {
|
|
|
849
849
|
);
|
|
850
850
|
};
|
|
851
851
|
|
|
852
|
-
A11yKeyboardDemo.storyName = "a11y keyboard demo"
|
|
852
|
+
A11yKeyboardDemo.storyName = "a11y keyboard demo";
|
|
853
853
|
|
|
854
|
+
/**
|
|
855
|
+
* test with cypress
|
|
856
|
+
*/
|
|
857
|
+
export const NeedConfirmDelete = () => {
|
|
858
|
+
return (
|
|
859
|
+
<div data-cy="dateTimeRange">
|
|
860
|
+
<DatePicker
|
|
861
|
+
value={[new Date('2022-08-08 00:00'), new Date('2022-08-09 12:00')]}
|
|
862
|
+
type="dateTimeRange"
|
|
863
|
+
needConfirm
|
|
864
|
+
/>
|
|
865
|
+
</div>
|
|
866
|
+
);
|
|
867
|
+
};
|
|
868
|
+
NeedConfirmDelete.storyName = "cashedSelectedValue return to last selected when needConfirm & input invalid";
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* test with cypress
|
|
872
|
+
*/
|
|
873
|
+
export const CashedSelectedValue = () => {
|
|
874
|
+
return (
|
|
875
|
+
<Space>
|
|
876
|
+
<div data-cy="date">
|
|
877
|
+
<DatePicker
|
|
878
|
+
defaultValue={new Date('2022-08-08')}
|
|
879
|
+
type="date"
|
|
880
|
+
motion={false}
|
|
881
|
+
/>
|
|
882
|
+
</div>
|
|
883
|
+
<div data-cy="dateTime">
|
|
884
|
+
<DatePicker
|
|
885
|
+
defaultValue={new Date('2022-08-08 19:11:00')}
|
|
886
|
+
type="dateTime"
|
|
887
|
+
motion={false}
|
|
888
|
+
/>
|
|
889
|
+
</div>
|
|
890
|
+
<div data-cy="dateRange">
|
|
891
|
+
<DatePicker
|
|
892
|
+
defaultValue={[new Date('2022-08-08'), new Date('2022-08-09')]}
|
|
893
|
+
type="dateRange"
|
|
894
|
+
motion={false}
|
|
895
|
+
/>
|
|
896
|
+
</div>
|
|
897
|
+
</Space>
|
|
898
|
+
);
|
|
899
|
+
};
|
|
900
|
+
CashedSelectedValue.storyName = "cashedSelectedValue";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker, Space, Button } from '../../../index';
|
|
3
|
+
|
|
4
|
+
AutoFillTime.storyName = '自动填充时间';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 输入开始日期后,自动填充一个时间
|
|
8
|
+
*/
|
|
9
|
+
export default function AutoFillTime() {
|
|
10
|
+
const format = 'yyyy-MM-dd HH:mm';
|
|
11
|
+
const defaultPickerValue = '2021-03-15 14:00';
|
|
12
|
+
const defaultPickerValue2 = ['2021-01-10 00:01', '2021-03-15 23:59'];
|
|
13
|
+
|
|
14
|
+
const handleChange = (...args) => {
|
|
15
|
+
console.log('change', ...args);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const props = {
|
|
19
|
+
format,
|
|
20
|
+
insetInput: true,
|
|
21
|
+
onChange: handleChange,
|
|
22
|
+
motion: false,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div data-cy="container">
|
|
27
|
+
<Space>
|
|
28
|
+
<div data-cy="dateTime">
|
|
29
|
+
<DatePicker {...props} type="dateTime" defaultPickerValue={defaultPickerValue} />
|
|
30
|
+
</div>
|
|
31
|
+
<div data-cy="dateTimeRange">
|
|
32
|
+
<DatePicker {...props} type="dateTimeRange" defaultPickerValue={defaultPickerValue2} />
|
|
33
|
+
</div>
|
|
34
|
+
</Space>
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker, Space, Button } from '../../../index';
|
|
3
|
+
|
|
4
|
+
InputFormat.storyName = '输入部分日期,回显在面板上';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 优化 input format
|
|
8
|
+
*/
|
|
9
|
+
export default function InputFormat() {
|
|
10
|
+
const handleChange = (...args) => {
|
|
11
|
+
console.log('change', ...args);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div data-cy="container">
|
|
16
|
+
<Space>
|
|
17
|
+
<div data-cy="date">
|
|
18
|
+
<DatePicker onChange={handleChange} />
|
|
19
|
+
</div>
|
|
20
|
+
<div data-cy="dateRange">
|
|
21
|
+
<DatePicker onChange={handleChange} type="dateRange" />
|
|
22
|
+
</div>
|
|
23
|
+
<div data-cy="dateTime">
|
|
24
|
+
<DatePicker onChange={handleChange} type="dateTime" />
|
|
25
|
+
</div>
|
|
26
|
+
</Space>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker, Space, Button } from '../../../index';
|
|
3
|
+
|
|
4
|
+
InputFormatConfirm.storyName = '输入时间 + needConfirm';
|
|
5
|
+
|
|
6
|
+
export default function InputFormatConfirm() {
|
|
7
|
+
const [insetInput, setInputInput] = React.useState(false);
|
|
8
|
+
const format = 'yyyy-MM-dd HH:mm';
|
|
9
|
+
const defaultPickerValue = '2021-03-15 14:00';
|
|
10
|
+
const defaultPickerValue2 = ['2021-01-10 00:01', '2021-03-15 23:59'];
|
|
11
|
+
|
|
12
|
+
const handleChange = (...args) => {
|
|
13
|
+
console.log('change', ...args);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const handleConfirm = (...args) => {
|
|
17
|
+
console.log('confirm', ...args);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const props = {
|
|
21
|
+
format,
|
|
22
|
+
onChange: handleChange,
|
|
23
|
+
onConfirm: handleConfirm,
|
|
24
|
+
motion: false,
|
|
25
|
+
needConfirm: true,
|
|
26
|
+
insetInput
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div data-cy="container">
|
|
31
|
+
<Space>
|
|
32
|
+
<Button data-cy="inset-switch" onClick={() => setInputInput(!insetInput)}>{`insetInput=${insetInput}`}</Button>
|
|
33
|
+
<Space>
|
|
34
|
+
<div data-cy="dateTime">
|
|
35
|
+
<DatePicker {...props} type="dateTime" defaultPickerValue={defaultPickerValue} />
|
|
36
|
+
</div>
|
|
37
|
+
<div data-cy="dateTimeRange">
|
|
38
|
+
<DatePicker {...props} type="dateTimeRange" defaultPickerValue={defaultPickerValue2} />
|
|
39
|
+
</div>
|
|
40
|
+
</Space>
|
|
41
|
+
</Space>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DatePicker, Space, Button } from '../../../index';
|
|
3
|
+
|
|
4
|
+
InputFormatDisabled.storyName = '输入禁用日期,不回显在面板上';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 优化 input format
|
|
8
|
+
*/
|
|
9
|
+
export default function InputFormatDisabled() {
|
|
10
|
+
const handleChange = (...args) => {
|
|
11
|
+
console.log('change', ...args);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const disabledDate = (date) => {
|
|
15
|
+
return date.getDate() === 15;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<div data-cy="container">
|
|
20
|
+
<Space>
|
|
21
|
+
<div data-cy="date">
|
|
22
|
+
<DatePicker disabledDate={disabledDate} onChange={handleChange} />
|
|
23
|
+
</div>
|
|
24
|
+
</Space>
|
|
25
|
+
</div>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -4,3 +4,7 @@ export { default as FixInputRangeFocus } from './FixInputRangeFocus';
|
|
|
4
4
|
export { default as InsetInput } from './InsetInput';
|
|
5
5
|
export { default as InsetInputE2E } from './InsetInputE2E';
|
|
6
6
|
export { default as FixDefaultPickerValue } from './FixDefaultPickerValue';
|
|
7
|
+
export { default as InputFormat } from './InputFormat';
|
|
8
|
+
export { default as InputFormatDisabled } from './InputFormatDisabled';
|
|
9
|
+
export { default as AutoFillTime } from './AutoFillTime';
|
|
10
|
+
export { default as InputFormatConfirm } from './InputFormatConfirm';
|
package/datePicker/dateInput.tsx
CHANGED
|
@@ -64,6 +64,12 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
64
64
|
rangeSeparator: PropTypes.string,
|
|
65
65
|
insetInput: PropTypes.bool,
|
|
66
66
|
insetInputValue: PropTypes.object,
|
|
67
|
+
defaultPickerValue: PropTypes.oneOfType([
|
|
68
|
+
PropTypes.string,
|
|
69
|
+
PropTypes.number,
|
|
70
|
+
PropTypes.object,
|
|
71
|
+
PropTypes.array,
|
|
72
|
+
]),
|
|
67
73
|
};
|
|
68
74
|
|
|
69
75
|
static defaultProps = {
|
|
@@ -392,6 +398,7 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
|
|
|
392
398
|
rangeSeparator,
|
|
393
399
|
insetInput,
|
|
394
400
|
insetInputValue,
|
|
401
|
+
defaultPickerValue,
|
|
395
402
|
...rest
|
|
396
403
|
} = this.props;
|
|
397
404
|
const dateIcon = <IconCalendar aria-hidden />;
|
|
@@ -184,7 +184,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
184
184
|
isRange: false,
|
|
185
185
|
inputValue: null, // Staging input values
|
|
186
186
|
value: [], // The currently selected date, each date is a Date object
|
|
187
|
-
cachedSelectedValue: null, // Save last selected date
|
|
187
|
+
cachedSelectedValue: null, // Save last selected date, maybe include null
|
|
188
188
|
prevTimeZone: null,
|
|
189
189
|
motionEnd: false, // Monitor if popover animation ends
|
|
190
190
|
rangeInputFocus: undefined, // Optional'rangeStart ',' rangeEnd ', false
|
|
@@ -415,16 +415,9 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
415
415
|
triggerRender,
|
|
416
416
|
insetInput
|
|
417
417
|
} = this.props;
|
|
418
|
-
const {
|
|
419
|
-
|
|
420
|
-
// const cachedSelectedValue = this.adapter.getCache('cachedSelectedValue');
|
|
421
|
-
|
|
422
|
-
let defaultValue = value;
|
|
423
|
-
|
|
424
|
-
if (this.adapter.needConfirm()) {
|
|
425
|
-
defaultValue = cachedSelectedValue;
|
|
426
|
-
}
|
|
418
|
+
const { cachedSelectedValue, motionEnd, rangeInputFocus } = this.state;
|
|
427
419
|
|
|
420
|
+
const defaultValue = cachedSelectedValue;
|
|
428
421
|
return (
|
|
429
422
|
<MonthsGrid
|
|
430
423
|
ref={this.monthGrid}
|
|
@@ -535,6 +528,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
535
528
|
inputReadOnly,
|
|
536
529
|
rangeSeparator,
|
|
537
530
|
insetInput,
|
|
531
|
+
defaultPickerValue
|
|
538
532
|
} = this.props;
|
|
539
533
|
const { value, inputValue, rangeInputFocus, triggerDisabled } = this.state;
|
|
540
534
|
// This class is not needed when triggerRender is function
|
|
@@ -555,6 +549,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
555
549
|
disabled: inputDisabled,
|
|
556
550
|
inputValue,
|
|
557
551
|
value: value as Date[],
|
|
552
|
+
defaultPickerValue,
|
|
558
553
|
onChange: this.handleInputChange,
|
|
559
554
|
onEnterPress: this.handleInputComplete,
|
|
560
555
|
// TODO: remove in next major version
|
|
@@ -629,7 +624,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
629
624
|
};
|
|
630
625
|
|
|
631
626
|
renderPanel = (locale: Locale['DatePicker'], localeCode: string, dateFnsLocale: Locale['dateFnsLocale']) => {
|
|
632
|
-
const { dropdownClassName, dropdownStyle, density, topSlot, bottomSlot, insetInput, type, format, rangeSeparator } = this.props;
|
|
627
|
+
const { dropdownClassName, dropdownStyle, density, topSlot, bottomSlot, insetInput, type, format, rangeSeparator, defaultPickerValue } = this.props;
|
|
633
628
|
const { insetInputValue, value } = this.state;
|
|
634
629
|
const wrapCls = classnames(
|
|
635
630
|
cssClasses.PREFIX,
|
|
@@ -653,6 +648,7 @@ export default class DatePicker extends BaseComponent<DatePickerProps, DatePicke
|
|
|
653
648
|
rangeInputStartRef: this.rangeInputStartRef,
|
|
654
649
|
rangeInputEndRef: this.rangeInputEndRef,
|
|
655
650
|
density,
|
|
651
|
+
defaultPickerValue
|
|
656
652
|
};
|
|
657
653
|
|
|
658
654
|
return (
|
|
@@ -168,7 +168,8 @@ export default class MonthsGrid extends BaseComponent<MonthsGridProps, MonthsGri
|
|
|
168
168
|
componentDidUpdate(prevProps: MonthsGridProps, prevState: MonthsGridState) {
|
|
169
169
|
const { defaultValue, defaultPickerValue, motionEnd } = this.props;
|
|
170
170
|
if (prevProps.defaultValue !== defaultValue) {
|
|
171
|
-
|
|
171
|
+
// we should always update panel state when value changes
|
|
172
|
+
this.foundation.updateSelectedFromProps(defaultValue);
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
if (prevProps.defaultPickerValue !== defaultPickerValue) {
|