Skip to content

[WIP] Add/time zone #1144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
timeZone values added in modals
  • Loading branch information
MenamAfzal committed Sep 4, 2024
commit e31ceba495eee6052adf542eac415375b8bed8c9
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { default as DatePicker } from "antd/es/date-picker";
import { hasIcon } from "comps/utils";
import { omit } from "lodash";
import { DateParser } from "@lowcoder-ee/util/dateTimeUtils";
import { default as AntdSelect } from "antd/es/select";
import { timeZoneOptions } from "./timeZone";

const { RangePicker } = DatePicker;

Expand All @@ -21,6 +23,17 @@ const RangePickerStyled = styled(RangePicker)<{$style: DateTimeStyleType}>`
${(props) => props.$style && getStyle(props.$style)}
`;

const StyledAntdSelect = styled(AntdSelect)`
width: 400px;
margin: 10px 0px;
.ant-select-selector {
font-size: 14px;
line-height: 1.5;
}
`;
const StyledDiv = styled.div`
text-align: center;
`;
const DateRangeMobileUIView = React.lazy(() =>
import("./dateMobileUIView").then((m) => ({ default: m.DateRangeMobileUIView }))
);
Expand All @@ -44,7 +57,6 @@ export const DateRangeUIView = (props: DateRangeUIViewProps) => {
// Use the same placeholder for both start and end if it's a single string
placeholders = [props.placeholder || 'Start Date', props.placeholder || 'End Date'];
}

return useUIView(
<DateRangeMobileUIView {...props} />,
<RangePickerStyled
Expand All @@ -63,6 +75,15 @@ export const DateRangeUIView = (props: DateRangeUIViewProps) => {
hourStep={props.hourStep as any}
minuteStep={props.minuteStep as any}
secondStep={props.secondStep as any}
renderExtraFooter={() => (
<StyledDiv>
<StyledAntdSelect
placeholder="Select Time Zone"
options={timeZoneOptions}
onChange={()=>{console.log("handleTimeZoneChange")}}
/>
</StyledDiv>
)}
/>
);
};
23 changes: 23 additions & 0 deletions client/packages/lowcoder/src/comps/comps/dateComp/dateUIView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,27 @@ import { default as DatePicker } from "antd/es/date-picker";
import type { DatePickerProps } from "antd/es/date-picker";
import type { Dayjs } from 'dayjs';
import { DateParser } from "@lowcoder-ee/util/dateTimeUtils";
import { timeZoneOptions } from "./timeZone";
import { default as AntdSelect } from "antd/es/select";

const DatePickerStyled = styled(DatePicker<Dayjs>)<{ $style: DateTimeStyleType }>`
width: 100%;
box-shadow: ${props=>`${props.$style.boxShadow} ${props.$style.boxShadowColor}`};
${(props) => props.$style && getStyle(props.$style)}
`;

const StyledDiv = styled.div`
width: 100%;
margin: 10px 0px;
`;

const StyledAntdSelect = styled(AntdSelect)`
width: 100%;
.ant-select-selector {
font-size: 14px;
line-height: 1.5;
}
`;

export interface DataUIViewProps extends DateCompViewProps {
value?: DatePickerProps<Dayjs>['value'];
Expand Down Expand Up @@ -48,6 +62,15 @@ export const DateUIView = (props: DataUIViewProps) => {
picker={"date"}
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
placeholder={placeholder}
renderExtraFooter={()=>(
<StyledDiv>
<StyledAntdSelect
options={timeZoneOptions}
placeholder="Select a time zone"
onChange={()=>{console.log("DatePickerStyled")}}
/>
</StyledDiv>
)}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { EditorContext } from "../../editorState";
import dayjs from "dayjs";
import { hasIcon } from "comps/utils";
import { omit } from "lodash";
import { timeZoneOptions } from "./timeZone";
import { default as AntdSelect } from "antd/es/select";

const { RangePicker } = TimePicker;

Expand All @@ -18,6 +20,15 @@ const RangePickerStyled = styled((props: any) => <RangePicker {...props} />)<{ $
${(props) => props.$style && getStyle(props.$style)}
`;

const StyledAntdSelect = styled(AntdSelect)`
width: 100%;
margin: 10px 0px;
.ant-select-selector {
font-size: 14px;
line-height: 1.5;
}
`;

const TimeRangeMobileUIView = React.lazy(() =>
import("./timeMobileUIView").then((m) => ({ default: m.TimeRangeMobileUIView }))
);
Expand Down Expand Up @@ -54,6 +65,13 @@ export const TimeRangeUIView = (props: TimeRangeUIViewProps) => {
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon}
placeholder={placeholders}
renderExtraFooter={() => (
<StyledAntdSelect
placeholder="Select Time Zone"
options={timeZoneOptions}
onChange={()=>{console.log("handleTimeZoneChange")}}
/>
)}
/>
);
};
20 changes: 19 additions & 1 deletion client/packages/lowcoder/src/comps/comps/dateComp/timeUIView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import React, { useContext } from "react";
import type { TimeCompViewProps } from "./timeComp";
import { EditorContext } from "../../editorState";
import dayjs from "dayjs"
import { default as AntdSelect } from "antd/es/select";
import { timeZoneOptions } from "./timeZone";

const TimePickerStyled = styled(TimePicker)<{ $style: DateTimeStyleType }>`
width: 100%;
Expand All @@ -17,6 +19,15 @@ const TimePickerStyled = styled(TimePicker)<{ $style: DateTimeStyleType }>`
const TimeMobileUIView = React.lazy(() =>
import("./timeMobileUIView").then((m) => ({ default: m.TimeMobileUIView }))
);

const StyledAntdSelect = styled(AntdSelect)`
width: 100%;
margin: 10px 0;
.ant-select-selector {
font-size: 14px;
padding: 8px;
}
`;

export interface TimeUIViewProps extends TimeCompViewProps {
value: dayjs.Dayjs | null;
Expand All @@ -36,6 +47,13 @@ export const TimeUIView = (props: TimeUIViewProps) => {
hideDisabledOptions
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
placeholder={placeholder}
/>
renderExtraFooter={()=>(
<StyledAntdSelect
placeholder="Select Time Zone"
options={timeZoneOptions}
onChange={()=>{console.log("handleTimeZoneChange")}}
/>
)}
/>
);
};