Skip to content

Commit 43d142a

Browse files
fixing issues
1 parent 1a8f662 commit 43d142a

File tree

5 files changed

+46
-81
lines changed

5 files changed

+46
-81
lines changed

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

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
} from "comps/utils/propertyUtils";
3838
import { trans } from "i18n";
3939
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";
4141
import { IconControl } from "comps/controls/iconControl";
4242
import { hasIcon } from "comps/utils";
4343
import { Section, sectionNames } from "components/Section";
@@ -46,18 +46,9 @@ import { DateUIView } from "./dateUIView";
4646
import { useIsMobile } from "util/hooks";
4747
import { RefControl } from "comps/controls/refControl";
4848
// import { CommonPickerMethods } from "antd/es/date-picker/generatePicker/interface";
49-
import type { PickerPropsWithMultiple } from "antd/es/date-picker/generatePicker/interface";
5049
import { DateRangeUIView } from "comps/comps/dateComp/dateRangeUIView";
5150
import { EditorContext } from "comps/editorState";
5251
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-
}
6152

6253
const EventOptions = [changeEvent, focusEvent, blurEvent] as const;
6354

@@ -173,8 +164,7 @@ export type DateCompViewProps = Pick<
173164
};
174165

175166
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);
178168

179169
let time = null;
180170
if (props.value.value !== '') {
@@ -188,48 +178,32 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props, dispatch
188178
inputFieldStyle:props.inputFieldStyle,
189179
animationStyle:props.animationStyle,
190180
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+
);
228200
}}
229-
onOpenChange={(open) => {
230-
console.log('opne change', open);
201+
onPanelChange={() => {
202+
handleDateChange("", props.value.onChange, noop);
231203
}}
232-
// onOk={onOk}
204+
onFocus={() => props.onEvent("focus")}
205+
onBlur={() => props.onEvent("blur")}
206+
suffixIcon={hasIcon(props.suffixIcon) && props.suffixIcon}
233207
/>
234208
),
235209
...validate(props),
@@ -574,7 +548,7 @@ export let DateRangeComp = withExposingConfigs(dateRangeControl, [
574548
]);
575549

576550
DateRangeComp = withMethodExposing(DateRangeComp, [
577-
// ...dateRefMethods,
551+
...dateRefMethods,
578552
{
579553
method: {
580554
name: "clearAll",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const handleClick = async (
2222
DateCompViewProps,
2323
"showTime" | "minDate" | "maxDate" | "disabledTime" | "onFocus" | "onBlur"
2424
> & {
25-
value: dayjs.Dayjs | null;
25+
value?: dayjs.Dayjs | null;
2626
// onChange: (value: dayjs.Dayjs | null) => void;
2727
onChange: DatePickerProps<Dayjs>['onChange'];
2828
}

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

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,31 +34,21 @@ export const DateUIView = (props: DataUIViewProps) => {
3434
const editorState = useContext(EditorContext);
3535

3636
const placeholder = Array.isArray(props.placeholder) ? props.placeholder[0] : props.placeholder;
37-
console.log('props', props);
3837
return useUIView(
3938
<DateMobileUIView {...props} />,
40-
<DatePicker
41-
showTime
42-
onChange={(value, dateString) => {
43-
console.log('Selected Time: ', value);
44-
console.log('Formatted Selected Time: ', dateString);
45-
}}
46-
// onOk={onOk}
39+
<DatePickerStyled
40+
{...props}
41+
multiple={false}
42+
ref={props.viewRef as any}
43+
minDate={props.minDate ? dayjs(props.minDate, DateParser) : undefined}
44+
maxDate={props.maxDate ? dayjs(props.maxDate, DateParser) : undefined}
45+
hourStep={props.hourStep as any}
46+
minuteStep={props.minuteStep as any}
47+
secondStep={props.secondStep as any}
48+
disabledDate={(current) => disabledDate(current, props.minDate, props.maxDate)}
49+
picker={"date"}
50+
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
51+
placeholder={placeholder}
4752
/>
48-
// <DatePickerStyled
49-
// {...props}
50-
// multiple={false}
51-
// ref={props.viewRef as any}
52-
// minDate={props.minDate ? dayjs(props.minDate, DateParser) : undefined}
53-
// maxDate={props.maxDate ? dayjs(props.maxDate, DateParser) : undefined}
54-
// hourStep={props.hourStep as any}
55-
// minuteStep={props.minuteStep as any}
56-
// secondStep={props.secondStep as any}
57-
// disabledDate={(current) => disabledDate(current, props.minDate, props.maxDate)}
58-
// picker={"date"}
59-
// inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
60-
// placeholder={placeholder}
61-
// />
62-
6353
);
6454
};

client/packages/lowcoder/src/comps/comps/mediaComp/colorPickerComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { jsonObjectExposingStateControl, stringExposingStateControl } from "comp
1717
import { dropdownControl } from "comps/controls/dropdownControl";
1818
import { ArrayOrJSONObjectControl } from "comps/controls/codeControl";
1919
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
20+
import { JSONObject } from "@lowcoder-ee/util/jsonTypes";
2021

2122
export function getStyle(style: ColorPickerStyleType) {
2223
return css`
@@ -88,7 +89,7 @@ export const ColorPickerComp = new UICompBuilder(childrenMap, (props, dispatch)
8889
props.color.onChange({
8990
hex: value.toHexString().toUpperCase(),
9091
hsb: value.toHsb(),
91-
rgb: value.toRgb(),
92+
rgb: value.toRgb() as any,
9293
})
9394
props.onEvent('change')
9495
}}

client/packages/lowcoder/src/comps/controls/labelControl.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function getStyle(style: any) {
4545
`;
4646
}
4747

48-
const LabelViewWrapper = styled.div<{ $style: any, inputFieldStyle: any,$animationStyle:any }>`
48+
const LabelViewWrapper = styled.div<{ $style: any, $inputFieldStyle: any,$animationStyle:any }>`
4949
${(props) => {
5050
return (
5151
props.$style && {
@@ -56,7 +56,7 @@ const LabelViewWrapper = styled.div<{ $style: any, inputFieldStyle: any,$animati
5656
}
5757
);
5858
}}
59-
${(props) => props.inputFieldStyle && getStyle(props.inputFieldStyle)}
59+
${(props) => props.$inputFieldStyle && getStyle(props.$inputFieldStyle)}
6060
${(props) => props.$animationStyle && props.$animationStyle}
6161
display: flex;
6262
flex-direction: column;
@@ -177,7 +177,7 @@ export const LabelControl = (function () {
177177

178178
return new MultiCompBuilder(childrenMap, (props) => (args: LabelViewProps) =>
179179
{
180-
return <LabelViewWrapper $style={args.style} inputFieldStyle={args.inputFieldStyle} $animationStyle={args.animationStyle}>
180+
return <LabelViewWrapper $style={args.style} $inputFieldStyle={args.inputFieldStyle} $animationStyle={args.animationStyle}>
181181
<MainWrapper
182182
$position={props.position}
183183
$hasLabel={!!props.text}

0 commit comments

Comments
 (0)