@@ -37,7 +37,7 @@ import {
37
37
} from "comps/utils/propertyUtils" ;
38
38
import { trans } from "i18n" ;
39
39
import { DATE_FORMAT , DATE_TIME_FORMAT , DateParser , PickerMode } from "util/dateTimeUtils" ;
40
- import React , { ReactNode , useContext , useEffect , useRef } from "react" ;
40
+ import React , { ReactNode , useContext , useEffect } from "react" ;
41
41
import { IconControl } from "comps/controls/iconControl" ;
42
42
import { hasIcon } from "comps/utils" ;
43
43
import { Section , sectionNames } from "components/Section" ;
@@ -46,18 +46,9 @@ import { DateUIView } from "./dateUIView";
46
46
import { useIsMobile } from "util/hooks" ;
47
47
import { RefControl } from "comps/controls/refControl" ;
48
48
// import { CommonPickerMethods } from "antd/es/date-picker/generatePicker/interface";
49
- import type { PickerPropsWithMultiple } from "antd/es/date-picker/generatePicker/interface" ;
50
49
import { DateRangeUIView } from "comps/comps/dateComp/dateRangeUIView" ;
51
50
import { EditorContext } from "comps/editorState" ;
52
51
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks" ;
53
- import { DatePicker } from "antd" ;
54
- // import type { PickerRef } from "";
55
-
56
-
57
- const defaultStyle = {
58
- borderStyle : 'solid' ,
59
- borderWidth : '1px' ,
60
- }
61
52
62
53
const EventOptions = [ changeEvent , focusEvent , blurEvent ] as const ;
63
54
@@ -173,8 +164,7 @@ export type DateCompViewProps = Pick<
173
164
} ;
174
165
175
166
export const datePickerControl = new UICompBuilder ( childrenMap , ( props , dispatch ) => {
176
- useMergeCompStyles ( props as Record < string , any > , dispatch ) ;
177
- const pickerRef = useRef < any > ( ) ;
167
+ useMergeCompStyles ( props as Record < string , any > , dispatch ) ;
178
168
179
169
let time = null ;
180
170
if ( props . value . value !== '' ) {
@@ -188,48 +178,32 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props, dispatch
188
178
inputFieldStyle :props . inputFieldStyle ,
189
179
animationStyle :props . animationStyle ,
190
180
children : (
191
- // <DateUIView
192
- // viewRef={props.viewRef}
193
- // disabledTime={() => disabledTime(props.minTime, props.maxTime)}
194
- // $style={props.inputFieldStyle}
195
- // disabled={props.disabled}
196
- // {...datePickerProps(props)}
197
- // hourStep={props.hourStep}
198
- // minDate={props.minDate}
199
- // maxDate={props.maxDate}
200
- // placeholder={props.placeholder}
201
- // // value={time?.isValid() ? time : null}
202
- // defaultValue={time?.isValid() ? time : null}
203
- // onChange={(time) => {
204
- // console.log('onchange');
205
- // handleDateChange(
206
- // time && time.isValid()
207
- // ? time.format(props.showTime ? DATE_TIME_FORMAT : DATE_FORMAT)
208
- // : "",
209
- // props.value.onChange,
210
- // props.onEvent
211
- // );
212
- // }}
213
- // onPanelChange={() => {
214
- // console.log('onPanelChange');
215
- // handleDateChange("", props.value.onChange, noop);
216
- // }}
217
- // onFocus={() => props.onEvent("focus")}
218
- // onBlur={() => props.onEvent("blur")}
219
- // suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon}
220
- // />
221
- < DatePicker
222
- ref = { pickerRef }
223
- showTime
224
- needConfirm
225
- onChange = { ( value , dateString ) => {
226
- console . log ( 'Selected Time: ' , value ) ;
227
- console . log ( 'Formatted Selected Time: ' , dateString ) ;
181
+ < DateUIView
182
+ viewRef = { props . viewRef }
183
+ disabledTime = { ( ) => disabledTime ( props . minTime , props . maxTime ) }
184
+ $style = { props . inputFieldStyle }
185
+ disabled = { props . disabled }
186
+ { ...datePickerProps ( props ) }
187
+ hourStep = { props . hourStep }
188
+ minDate = { props . minDate }
189
+ maxDate = { props . maxDate }
190
+ placeholder = { props . placeholder }
191
+ // value={time?.isValid() ? time : null}
192
+ onChange = { ( time ) => {
193
+ handleDateChange (
194
+ time && time . isValid ( )
195
+ ? time . format ( props . showTime ? DATE_TIME_FORMAT : DATE_FORMAT )
196
+ : "" ,
197
+ props . value . onChange ,
198
+ props . onEvent
199
+ ) ;
228
200
} }
229
- onOpenChange = { ( open ) => {
230
- console . log ( 'opne change' , open ) ;
201
+ onPanelChange = { ( ) => {
202
+ handleDateChange ( "" , props . value . onChange , noop ) ;
231
203
} }
232
- // onOk={onOk}
204
+ onFocus = { ( ) => props . onEvent ( "focus" ) }
205
+ onBlur = { ( ) => props . onEvent ( "blur" ) }
206
+ suffixIcon = { hasIcon ( props . suffixIcon ) && props . suffixIcon }
233
207
/>
234
208
) ,
235
209
...validate ( props ) ,
@@ -574,7 +548,7 @@ export let DateRangeComp = withExposingConfigs(dateRangeControl, [
574
548
] ) ;
575
549
576
550
DateRangeComp = withMethodExposing ( DateRangeComp , [
577
- // ...dateRefMethods,
551
+ ...dateRefMethods ,
578
552
{
579
553
method : {
580
554
name : "clearAll" ,
0 commit comments