Skip to content

Commit 47aa4d9

Browse files
Theme: applied theme styles in input comp
1 parent 34d90cf commit 47aa4d9

File tree

6 files changed

+36
-12
lines changed

6 files changed

+36
-12
lines changed

client/packages/lowcoder/src/comps/comps/layout/mobileTabLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ import { hiddenPropertyView } from "comps/utils/propertyUtils";
2020
import { dropdownControl } from "@lowcoder-ee/comps/controls/dropdownControl";
2121
import { DataOption, DataOptionType, ModeOptions, menuItemStyleOptions, mobileNavJsonMenuItems } from "./navLayoutConstants";
2222
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl";
23-
import { NavLayoutItemActiveStyle, NavLayoutItemActiveStyleType, NavLayoutItemHoverStyle, NavLayoutItemHoverStyleType, NavLayoutItemStyle, NavLayoutItemStyleType, NavLayoutStyle, NavLayoutStyleType, defaultTheme } from "@lowcoder-ee/comps/controls/styleControlConstants";
23+
import { NavLayoutItemActiveStyle, NavLayoutItemActiveStyleType, NavLayoutItemHoverStyle, NavLayoutItemHoverStyleType, NavLayoutItemStyle, NavLayoutItemStyleType, NavLayoutStyle, NavLayoutStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants";
2424
import Segmented from "antd/es/segmented";
2525
import { controlItem } from "components/control";
2626
import { check } from "@lowcoder-ee/util/convertUtils";
2727
import { JSONObject } from "@lowcoder-ee/util/jsonTypes";
2828
import { isEmpty } from "lodash";
2929
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
30+
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
3031

3132
const TabBar = React.lazy(() => import("antd-mobile/es/components/tab-bar"));
3233
const TabBarItem = React.lazy(() =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { TransformerListComp } from "./transformerListComp";
1717
import UIComp from "./uiComp";
1818
import { ThemeContext } from "comps/utils/themeContext";
1919
import { ModuleLayoutCompName } from "constants/compConstants";
20-
import { defaultTheme as localDefaultTheme } from "comps/controls/styleControlConstants";
20+
import { defaultTheme as localDefaultTheme } from "constants/themeConstants";
2121
import { ModuleLoading } from "components/ModuleLoading";
2222
import EditorSkeletonView from "pages/editor/editorSkeletonView";
2323
import { getGlobalSettings } from "comps/utils/globalSettings";

client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
supportChildrenTree,
1414
} from "comps/comps/tableComp/tableUtils";
1515
import {
16-
defaultTheme,
1716
handleToHoverRow,
1817
handleToSelectedRow,
1918
TableColumnLinkStyleType,
@@ -41,6 +40,7 @@ import { EmptyContent } from "pages/common/styledComponent";
4140
import { messageInstance } from "lowcoder-design/src/components/GlobalInstances";
4241
import { ReactRef, ResizeHandleAxis } from "layout/gridLayoutPropTypes";
4342
import { CellColorViewType } from "./column/tableColumnComp";
43+
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
4444

4545

4646
function genLinerGradient(color: string) {

client/packages/lowcoder/src/comps/comps/tableComp/tableToolbarComp.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { TableOnEventView } from "comps/comps/tableComp/tableTypes";
77
import { BoolControl } from "comps/controls/boolControl";
88
import { StringControl } from "comps/controls/codeControl";
99
import { dropdownControl } from "comps/controls/dropdownControl";
10-
import { defaultTheme, TableToolbarStyleType } from "comps/controls/styleControlConstants";
10+
import { TableToolbarStyleType } from "comps/controls/styleControlConstants";
1111
import { stateComp } from "comps/generators";
1212
import { genRandomKey } from "comps/utils/idGenerator";
1313
import { ThemeContext } from "comps/utils/themeContext";
@@ -38,6 +38,7 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
3838
import styled, { css } from "styled-components";
3939
import { JSONValue } from "util/jsonTypes";
4040
import { ControlNodeCompBuilder } from "comps/generators/controlCompBuilder";
41+
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
4142

4243
const SaveChangeButtons = styled.div`
4344
display: flex;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ let TextTmpComp = (function () {
134134
horizontalAlignment: alignWithJustifyControl(),
135135
verticalAlignment: dropdownControl(VerticalAlignmentOptions, "center"),
136136
style: styleControl(TextStyle, 'style'),
137-
animationStyle: styleControl(AnimationStyle),
137+
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
138138
margin: MarginControl,
139139
padding: PaddingControl,
140140
};
@@ -143,8 +143,9 @@ let TextTmpComp = (function () {
143143
const theme = useContext(ThemeContext);
144144
const compType = useContext(CompTypeContext);
145145
const compTheme = theme?.theme?.components?.[compType];
146+
146147
const styleProps: Record<string, any> = {};
147-
['style'].forEach((key: string) => {
148+
['style', 'animationStyle'].forEach((key: string) => {
148149
styleProps[key] = (props as any)[key];
149150
});
150151

client/packages/lowcoder/src/comps/comps/textInputComp/inputComp.tsx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ import { InputRef } from "antd/es/input";
3333
import { RefControl } from "comps/controls/refControl";
3434
import { migrateOldData, withDefault } from "comps/generators/simpleGenerators";
3535

36-
import React, { useContext } from "react";
36+
import React, { useContext, useEffect } from "react";
3737
import { EditorContext } from "comps/editorState";
38+
import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext";
39+
import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext";
40+
import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil";
3841

3942
/**
4043
* Input Comp
@@ -51,16 +54,34 @@ const childrenMap = {
5154
viewRef: RefControl<InputRef>,
5255
showCount: BoolControl,
5356
allowClear: BoolControl,
54-
style: withDefault(styleControl(InputFieldStyle),{background:'transparent'}) ,
55-
labelStyle:styleControl(LabelStyle),
57+
style: styleControl(InputFieldStyle, 'style'),
58+
labelStyle:styleControl(LabelStyle, 'labelStyle'),
5659
prefixIcon: IconControl,
5760
suffixIcon: IconControl,
58-
inputFieldStyle:withDefault(styleControl(InputLikeStyle),{borderWidth: '1px'}) ,
59-
animationStyle: styleControl(AnimationStyle),
61+
inputFieldStyle: styleControl(InputLikeStyle, 'inputFieldStyle') ,
62+
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
6063
};
6164

62-
let InputBasicComp = new UICompBuilder(childrenMap, (props) => {
65+
let InputBasicComp = new UICompBuilder(childrenMap, (props, dispatch) => {
6366
const [inputProps, validateState] = useTextInputProps(props);
67+
68+
const theme = useContext(ThemeContext);
69+
const compType = useContext(CompTypeContext);
70+
const compTheme = theme?.theme?.components?.[compType];
71+
72+
const styleProps: Record<string, any> = {};
73+
['style', 'labelStyle', 'inputFieldStyle', 'animationStyle'].forEach((key: string) => {
74+
styleProps[key] = (props as any)[key];
75+
});
76+
77+
useEffect(() => {
78+
setInitialCompStyles({
79+
dispatch,
80+
compTheme,
81+
styleProps,
82+
});
83+
}, []);
84+
6485
return props.label({
6586
required: props.required,
6687
children: (

0 commit comments

Comments
 (0)