fix: datepicker client test (#6064)

This commit is contained in:
Katherine 2025-01-15 11:10:21 +08:00 committed by GitHub
parent 86b354d7de
commit 8ba098faeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 13 deletions

View File

@ -54,9 +54,9 @@ export const DatePicker: ComposedDatePicker = (props: any) => {
const value = Array.isArray(props.value) ? props.value[0] : props.value; const value = Array.isArray(props.value) ? props.value[0] : props.value;
const newProps = { const newProps = {
utc, utc,
inputReadOnly: true,
...props, ...props,
showTime: props.showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false, showTime: props.showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false,
inputReadOnly: true,
}; };
return <InternalDatePicker {...newProps} value={value} />; return <InternalDatePicker {...newProps} value={value} />;
}; };
@ -99,11 +99,11 @@ DatePicker.RangePicker = function RangePicker(props: any) {
const newProps: any = { const newProps: any = {
utc, utc,
presets, presets,
inputReadOnly: true,
...props, ...props,
format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat), format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat),
picker: targetPicker, picker: targetPicker,
showTime: showTime ? { defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')] } : false, showTime: showTime ? { defaultValue: [dayjs('00:00:00', 'HH:mm:ss'), dayjs('23:59:59', 'HH:mm:ss')] } : false,
inputReadOnly: true,
}; };
const [stateProps, setStateProps] = useState(newProps); const [stateProps, setStateProps] = useState(newProps);
if (isFilterAction) { if (isFilterAction) {
@ -171,12 +171,12 @@ DatePicker.FilterWithPicker = function FilterWithPicker(props: any) {
const targetDateFormat = getPickerFormat(targetPicker) || format; const targetDateFormat = getPickerFormat(targetPicker) || format;
const newProps = { const newProps = {
utc, utc,
inputReadOnly: true,
...props, ...props,
underFilter: true, underFilter: true,
showTime: showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false, showTime: showTime ? { defaultValue: dayjs('00:00:00', 'HH:mm:ss') } : false,
format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat), format: getDateTimeFormat(targetPicker, targetDateFormat, showTime, timeFormat),
picker: targetPicker, picker: targetPicker,
inputReadOnly: true,
onChange: (val) => { onChange: (val) => {
props.onChange(undefined); props.onChange(undefined);
setTimeout(() => { setTimeout(() => {

View File

@ -1,5 +1,3 @@
/** /**
* title: DatePicker * title: DatePicker
*/ */
@ -18,6 +16,7 @@ const schema = {
'x-component-props': { 'x-component-props': {
dateFormat: 'YYYY/MM/DD', dateFormat: 'YYYY/MM/DD',
showTime: true, showTime: true,
inputReadOnly: false,
}, },
'x-reactions': { 'x-reactions': {
target: '*(read1,read2)', target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/** /**
* title: DatePicker (GMT) * title: DatePicker (GMT)
*/ */
@ -19,6 +17,7 @@ const schema = {
dateFormat: 'YYYY/MM/DD', dateFormat: 'YYYY/MM/DD',
showTime: true, showTime: true,
gmt: true, gmt: true,
inputReadOnly: false,
}, },
default: '2022-06-04T15:00:00.000Z', default: '2022-06-04T15:00:00.000Z',
'x-reactions': { 'x-reactions': {

View File

@ -1,5 +1,3 @@
/** /**
* title: DatePicker * title: DatePicker
*/ */
@ -19,6 +17,7 @@ const schema = {
dateFormat: 'YYYY/MM/DD', dateFormat: 'YYYY/MM/DD',
showTime: false, showTime: false,
utc: false, utc: false,
inputReadOnly: false,
}, },
'x-reactions': { 'x-reactions': {
target: '*(read1,read2)', target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/** /**
* title: DatePicker * title: DatePicker
*/ */
@ -20,6 +18,7 @@ const schema = {
showTime: false, showTime: false,
gmt: true, gmt: true,
utc: true, utc: true,
inputReadOnly: false,
}, },
'x-reactions': { 'x-reactions': {
target: '*(read1,read2)', target: '*(read1,read2)',

View File

@ -1,5 +1,3 @@
/** /**
* title: DatePicker * title: DatePicker
*/ */
@ -20,6 +18,7 @@ const schema = {
showTime: false, showTime: false,
gmt: false, gmt: false,
utc: true, utc: true,
inputReadOnly: false,
}, },
'x-reactions': { 'x-reactions': {
target: '*(read1,read2)', target: '*(read1,read2)',