Skip to content

Commit 736ad03

Browse files
Theme: apply theme styles on time comp
1 parent 660fa27 commit 736ad03

File tree

4 files changed

+50
-27
lines changed

4 files changed

+50
-27
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const commonChildren = {
8888
suffixIcon: withDefault(IconControl, "/icon:regular/calendar"),
8989
...validationChildren,
9090
viewRef: RefControl<CommonPickerMethods>,
91-
inputFieldStyle: withDefault(styleControl(DateTimeStyle, 'inputFieldStyle'), defaultStyle),
91+
inputFieldStyle: styleControl(DateTimeStyle, 'inputFieldStyle'),
9292
};
9393
type CommonChildrenType = RecordConstructorToComp<typeof commonChildren>;
9494

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

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
} from "../../generators/withExposing";
2626
import { formDataChildren, FormDataPropertyView } from "../formComp/formDataConstants";
2727
import { styleControl } from "comps/controls/styleControl";
28-
import { DateTimeStyle, DateTimeStyleType } from "comps/controls/styleControlConstants";
28+
import { AnimationStyle, DateTimeStyle, DateTimeStyleType, InputFieldStyle, LabelStyle } from "comps/controls/styleControlConstants";
2929
import { withMethodExposing } from "../../generators/withMethodExposing";
3030
import {
3131
disabledPropertyView,
@@ -76,7 +76,13 @@ const commonChildren = {
7676
hourStep: RangeControl.closed(1, 24, 1),
7777
minuteStep: RangeControl.closed(1, 60, 1),
7878
secondStep: RangeControl.closed(1, 60, 1),
79-
style: styleControl(DateTimeStyle, 'style'),
79+
style: styleControl(InputFieldStyle, 'style'),
80+
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
81+
labelStyle: styleControl(
82+
LabelStyle.filter((style) => ['accent', 'validate'].includes(style.name) === false),
83+
'labelStyle',
84+
),
85+
inputFieldStyle: styleControl(DateTimeStyle, 'inputFieldStyle'),
8086
suffixIcon: withDefault(IconControl, "/icon:regular/clock"),
8187
viewRef: RefControl<CommonPickerMethods>,
8288
...validationChildren,
@@ -144,7 +150,7 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props, dispatch
144150
const compType = useContext(CompTypeContext);
145151
const compTheme = theme?.theme?.components?.[compType];
146152
const styleProps: Record<string, any> = {};
147-
['style'].forEach((key: string) => {
153+
['style', 'labelStyle', 'inputFieldStyle', 'animationStyle'].forEach((key: string) => {
148154
styleProps[key] = (props as any)[key];
149155
});
150156

@@ -164,10 +170,13 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props, dispatch
164170
return props.label({
165171
required: props.required,
166172
style: props.style,
173+
labelStyle: props.labelStyle,
174+
inputFieldStyle:props.inputFieldStyle,
175+
animationStyle:props.animationStyle,
167176
children: (
168177
<TimeUIView
169178
viewRef={props.viewRef}
170-
$style={props.style}
179+
$style={props.inputFieldStyle}
171180
disabled={props.disabled}
172181
value={time?.isValid() ? time : null}
173182
disabledTime={() => disabledTime(props.minTime, props.maxTime)}
@@ -234,9 +243,20 @@ export const timePickerControl = new UICompBuilder(childrenMap, (props, dispatch
234243
)}
235244

236245
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
237-
<Section name={sectionNames.style}>
238-
{children.style.getPropertyView()}
239-
</Section>
246+
<>
247+
<Section name={sectionNames.style}>
248+
{children.style.getPropertyView()}
249+
</Section>
250+
<Section name={sectionNames.labelStyle}>
251+
{children.labelStyle.getPropertyView()}
252+
</Section>
253+
<Section name={sectionNames.inputFieldStyle}>
254+
{children.inputFieldStyle.getPropertyView()}
255+
</Section>
256+
<Section name={sectionNames.animationStyle} hasTooltip={true}>
257+
{children.animationStyle.getPropertyView()}
258+
</Section>
259+
</>
240260
)}
241261
</>
242262
))
@@ -255,7 +275,7 @@ export const timeRangeControl = (function () {
255275
const compType = useContext(CompTypeContext);
256276
const compTheme = theme?.theme?.components?.[compType];
257277
const styleProps: Record<string, any> = {};
258-
['style'].forEach((key: string) => {
278+
['style', 'labelStyle', 'inputFieldStyle', 'animationStyle'].forEach((key: string) => {
259279
styleProps[key] = (props as any)[key];
260280
});
261281

@@ -280,7 +300,7 @@ export const timeRangeControl = (function () {
280300
const children = (
281301
<TimeRangeUIView
282302
viewRef={props.viewRef}
283-
$style={props.style}
303+
$style={props.inputFieldStyle}
284304
disabled={props.disabled}
285305
start={start?.isValid() ? start : null}
286306
end={end?.isValid() ? end : null}
@@ -307,6 +327,9 @@ export const timeRangeControl = (function () {
307327
return props.label({
308328
required: props.required,
309329
style: props.style,
330+
labelStyle: props.labelStyle,
331+
inputFieldStyle:props.inputFieldStyle,
332+
animationStyle:props.animationStyle,
310333
children: children,
311334
...(startResult.validateStatus !== "success"
312335
? startResult
@@ -359,9 +382,20 @@ export const timeRangeControl = (function () {
359382
)}
360383

361384
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
362-
<Section name={sectionNames.style}>
363-
{children.style.getPropertyView()}
364-
</Section>
385+
<>
386+
<Section name={sectionNames.style}>
387+
{children.style.getPropertyView()}
388+
</Section>
389+
<Section name={sectionNames.labelStyle}>
390+
{children.labelStyle.getPropertyView()}
391+
</Section>
392+
<Section name={sectionNames.inputFieldStyle}>
393+
{children.inputFieldStyle.getPropertyView()}
394+
</Section>
395+
<Section name={sectionNames.animationStyle} hasTooltip={true}>
396+
{children.animationStyle.getPropertyView()}
397+
</Section>
398+
</>
365399
)}
366400
</>
367401
))

client/packages/lowcoder/src/constants/themeConstants.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ const rating = {
5555
}
5656
}
5757

58-
const time = {
59-
style: {
60-
background: 'transparent',
61-
borderWidth:'1px'
62-
},
63-
inputFieldStyle: {
64-
borderStyle: 'solid',
65-
borderWidth: '1px',
66-
},
67-
};
68-
6958
const segmentedControl = {
7059
style: {
7160
borderWidth: '0px',
@@ -110,8 +99,8 @@ export const defaultTheme: ThemeDetail = {
11099
radio: input,
111100
date: input,
112101
dateRange: input,
113-
time,
114-
timeRange: time,
102+
time: input,
103+
timeRange: input,
115104
slider: input,
116105
rangeSlider: input,
117106
segmentedControl,

client/packages/lowcoder/src/pages/setting/theme/detail/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import { messageInstance } from "lowcoder-design/src/components/GlobalInstances"
4444
import { Card, Collapse, CollapseProps, Divider, Flex, List, Tooltip } from 'antd';
4545

4646
import { ThemeCompPanel } from "pages/setting/theme/ThemeCompPanel";
47-
import { JSONObject } from "@lowcoder-ee/index.sdk";
47+
import { JSONObject } from "@lowcoder-ee/util/jsonTypes";
4848

4949
const ThemeSettingsView = styled.div`
5050
font-size: 14px;

0 commit comments

Comments
 (0)