Skip to content

Commit 8725cf7

Browse files
committed
condition added
1 parent e31ceba commit 8725cf7

File tree

6 files changed

+30
-17
lines changed

6 files changed

+30
-17
lines changed

client/packages/lowcoder/src/comps/comps/dateComp/dateComp.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export type DateCompViewProps = Pick<
156156
| "minuteStep"
157157
| "secondStep"
158158
| "viewRef"
159+
| "timeZone"
159160
> & {
160161
onFocus: () => void;
161162
onBlur: () => void;
@@ -187,6 +188,7 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
187188
onMouseDown: (e) => e.stopPropagation(),
188189
children: (
189190
<DateUIView
191+
timeZone={props.timeZone}
190192
viewRef={props.viewRef}
191193
disabledTime={() => disabledTime(props.minTime, props.maxTime)}
192194
$style={props.inputFieldStyle}
@@ -323,6 +325,7 @@ export const dateRangeControl = (function () {
323325

324326
const children = (
325327
<DateRangeUIView
328+
timeZone={props?.timeZone}
326329
viewRef={props.viewRef}
327330
$style={props.inputFieldStyle}
328331
disabled={props.disabled}

client/packages/lowcoder/src/comps/comps/dateComp/dateRangeUIView.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ export const DateRangeUIView = (props: DateRangeUIViewProps) => {
7676
minuteStep={props.minuteStep as any}
7777
secondStep={props.secondStep as any}
7878
renderExtraFooter={() => (
79-
<StyledDiv>
80-
<StyledAntdSelect
81-
placeholder="Select Time Zone"
82-
options={timeZoneOptions}
83-
onChange={()=>{console.log("handleTimeZoneChange")}}
84-
/>
85-
</StyledDiv>
79+
props.timeZone === "UserChoice" && (
80+
<StyledDiv>
81+
<StyledAntdSelect
82+
options={timeZoneOptions}
83+
placeholder="Select Time Zone"
84+
onChange={()=>{console.log("handleTimeZoneChange")}}
85+
/>
86+
</StyledDiv>
87+
)
8688
)}
8789
/>
8890
);

client/packages/lowcoder/src/comps/comps/dateComp/dateUIView.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ export const DateUIView = (props: DataUIViewProps) => {
6363
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
6464
placeholder={placeholder}
6565
renderExtraFooter={()=>(
66-
<StyledDiv>
67-
<StyledAntdSelect
68-
options={timeZoneOptions}
69-
placeholder="Select a time zone"
70-
onChange={()=>{console.log("DatePickerStyled")}}
71-
/>
66+
props.timeZone === "UserChoice" && (
67+
<StyledDiv>
68+
<StyledAntdSelect
69+
options={timeZoneOptions}
70+
placeholder="Select Time Zone"
71+
onChange={()=>{console.log("DatePickerStyled")}}
72+
/>
7273
</StyledDiv>
74+
)
7375
)}
7476
/>
7577
);

client/packages/lowcoder/src/comps/comps/dateComp/timeComp.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ export type TimeCompViewProps = Pick<
143143
disabledTime: () => ReturnType<typeof disabledTime>;
144144
suffixIcon?: ReactNode | false;
145145
placeholder?: string | [string, string];
146+
timeZone:string
146147
};
147148

148149
export const timePickerControl = new UICompBuilder(childrenMap, (props) => {
@@ -167,6 +168,7 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props) => {
167168
onMouseDown: (e) => e.stopPropagation(),
168169
children: (
169170
<TimeUIView
171+
timeZone={props?.timeZone}
170172
viewRef={props.viewRef}
171173
$style={props.inputFieldStyle}
172174
disabled={props.disabled}
@@ -186,8 +188,7 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props) => {
186188
}}
187189
onFocus={() => props.onEvent("focus")}
188190
onBlur={() => props.onEvent("blur")}
189-
suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon}
190-
/>
191+
suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon} />
191192
),
192193
...validate(props),
193194
});
@@ -290,6 +291,7 @@ export const timeRangeControl = (function () {
290291

291292
const children = (
292293
<TimeRangeUIView
294+
timeZone={props?.timeZone}
293295
viewRef={props.viewRef}
294296
$style={props.inputFieldStyle}
295297
disabled={props.disabled}

client/packages/lowcoder/src/comps/comps/dateComp/timeRangeUIView.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ export const TimeRangeUIView = (props: TimeRangeUIViewProps) => {
6666
suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon}
6767
placeholder={placeholders}
6868
renderExtraFooter={() => (
69-
<StyledAntdSelect
69+
props.timeZone === "UserChoice" && (
70+
<StyledAntdSelect
7071
placeholder="Select Time Zone"
7172
options={timeZoneOptions}
7273
onChange={()=>{console.log("handleTimeZoneChange")}}
7374
/>
74-
)}
75+
)
76+
)}
7577
/>
7678
);
7779
};

client/packages/lowcoder/src/comps/comps/dateComp/timeUIView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ export const TimeUIView = (props: TimeUIViewProps) => {
4848
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
4949
placeholder={placeholder}
5050
renderExtraFooter={()=>(
51+
props.timeZone === "UserChoice" && (
5152
<StyledAntdSelect
5253
placeholder="Select Time Zone"
5354
options={timeZoneOptions}
5455
onChange={()=>{console.log("handleTimeZoneChange")}}
5556
/>
57+
)
5658
)}
5759
/>
5860
);

0 commit comments

Comments
 (0)