Skip to content

Commit 9ab8650

Browse files
authored
Merge pull request #1038 from lowcoder-org/dev
Dev -> Main for 2.4.4
2 parents 77a30e6 + d3e6771 commit 9ab8650

File tree

15 files changed

+200
-139
lines changed

15 files changed

+200
-139
lines changed

client/packages/lowcoder/src/comps/comps/buttonComp/buttonCompConstants.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { refMethods } from "comps/generators/withMethodExposing";
88
import { blurMethod, clickMethod, focusWithOptions } from "comps/utils/methodUtils";
99

1010
export function getButtonStyle(buttonStyle: ButtonStyleType) {
11-
const hoverColor = genHoverColor(buttonStyle.background);
12-
const activeColor = genActiveColor(buttonStyle.background);
11+
const hoverColor = buttonStyle.background && genHoverColor(buttonStyle.background);
12+
const activeColor = buttonStyle.background && genActiveColor(buttonStyle.background);
1313
return css`
1414
&&& {
1515
border-radius: ${buttonStyle.radius};

client/packages/lowcoder/src/comps/comps/buttonComp/linkComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const Link = styled(Button)<{
3636
padding: ${props.$style.padding};
3737
font-size: ${props.$style.textSize};
3838
font-style:${props.$style.fontStyle};
39-
font-family:${props.$style.fontFamily};
39+
${props.$style.fontFamily && `font-family: ${props.$style.fontFamily}`};
4040
font-weight:${props.$style.textWeight};
4141
border: ${props.$style.borderWidth} ${props.$style.borderStyle} ${props.$style.border};
4242
border-radius:${props.$style.radius ? props.$style.radius:'0px'};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { AutoHeightControl } from "comps/controls/autoHeightControl";
1717

1818
import { useContext } from "react";
1919
import { EditorContext } from "comps/editorState";
20-
import { useMergeCompStyles } from "@lowcoder-ee/index.sdk";
20+
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
2121

2222
type IProps = DividerProps & {
2323
$style: DividerStyleType;

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { trans } from "i18n";
2222

2323
import { useContext } from "react";
2424
import { EditorContext } from "comps/editorState";
25+
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
2526

2627
type IProps = {
2728
$justify: boolean;
@@ -135,16 +136,18 @@ const childrenMap = {
135136
logoUrl: StringControl,
136137
logoEvent: withDefault(eventHandlerControl(logoEventHandlers), [{ name: "click" }]),
137138
horizontalAlignment: alignWithJustifyControl(),
138-
style: migrateOldData(styleControl(NavigationStyle), fixOldStyleData),
139-
animationStyle: styleControl(AnimationStyle),
139+
style: migrateOldData(styleControl(NavigationStyle, 'style'), fixOldStyleData),
140+
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
140141
items: withDefault(navListComp(), [
141142
{
142143
label: trans("menuItem") + " 1",
143144
},
144145
]),
145146
};
146147

147-
const NavCompBase = new UICompBuilder(childrenMap, (props) => {
148+
const NavCompBase = new UICompBuilder(childrenMap, (props, dispatch) => {
149+
useMergeCompStyles(props, dispatch);
150+
148151
const data = props.items;
149152
const items = (
150153
<>

client/packages/lowcoder/src/comps/comps/numberInputComp/rangeSliderComp.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generat
66
import { SliderChildren, SliderPropertyView, SliderStyled, SliderWrapper } from "./sliderCompConstants";
77
import { hasIcon } from "comps/utils";
88
import { BoolControl } from "comps/controls/boolControl";
9+
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks";
910

1011
const RangeSliderBasicComp = (function () {
1112
const childrenMap = {
@@ -14,7 +15,8 @@ const RangeSliderBasicComp = (function () {
1415
end: numberExposingStateControl("end", 60),
1516
vertical: BoolControl,
1617
};
17-
return new UICompBuilder(childrenMap, (props) => {
18+
return new UICompBuilder(childrenMap, (props, dispatch) => {
19+
useMergeCompStyles(props as Record<string, any>, dispatch);
1820
return props.label({
1921
style: props.style,
2022
labelStyle: props.labelStyle,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function RootView(props: RootViewProps) {
7373
localDefaultTheme;
7474

7575
const themeId = selectedTheme ? selectedTheme.id : (
76-
previewTheme ? "" : 'default-theme-id'
76+
previewTheme ? "preview-theme" : 'default-theme-id'
7777
);
7878

7979
useEffect(() => {

client/packages/lowcoder/src/comps/comps/selectInputComp/checkboxComp.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,10 @@ export const getStyle = (style: CheckboxStyleType) => {
7575
&:hover .ant-checkbox-inner,
7676
.ant-checkbox:hover .ant-checkbox-inner,
7777
.ant-checkbox-input + ant-checkbox-inner {
78-
background-color:${style.hoverBackground ? style.hoverBackground : '#fff'};
78+
${style.hoverBackground && `background-color: ${style.hoverBackground}`};
7979
}
8080
81-
&:hover .ant-checkbox-checked .ant-checkbox-inner,
82-
.ant-checkbox:hover .ant-checkbox-inner,
83-
.ant-checkbox-input + ant-checkbox-inner {
84-
background-color:${style.hoverBackground ? style.hoverBackground : '#ffff'};
85-
}
81+
8682
8783
&:hover .ant-checkbox-inner,
8884
.ant-checkbox:hover .ant-checkbox-inner,

client/packages/lowcoder/src/comps/comps/selectInputComp/multiSelectComp.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ let MultiSelectBasicComp = (function () {
2525
defaultValue: arrayStringExposingStateControl("defaultValue", ["1", "2"]),
2626
value: arrayStringExposingStateControl("value"),
2727
style: styleControl(InputFieldStyle , 'style'),
28-
labelStyle:styleControl(LabelStyle , 'labelStyle'),
29-
inputFieldStyle:styleControl(MultiSelectStyle , 'inputFieldStyle'),
30-
childrenInputFieldStyle:styleControl(ChildrenMultiSelectStyle),
28+
labelStyle: styleControl(LabelStyle , 'labelStyle'),
29+
inputFieldStyle: styleControl(MultiSelectStyle , 'inputFieldStyle'),
30+
childrenInputFieldStyle: styleControl(ChildrenMultiSelectStyle, 'childrenInputFieldStyle'),
3131
margin: MarginControl,
3232
padding: PaddingControl,
3333
};

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,17 +863,23 @@ export function styleControl<T extends readonly SingleColorConfig[]>(
863863
const {comp, compType} = useContext(CompContext);
864864
const theme = useContext(ThemeContext);
865865
const bgColor = useContext(BackgroundColorContext);
866+
const { themeId } = theme || {};
867+
const isPreviewTheme = themeId === 'preview-theme';
868+
const isDefaultTheme = themeId === 'default-theme-id';
869+
866870

867871
const appSettingsComp = editorState?.getAppSettingsComp();
868872
const preventAppStylesOverwriting = appSettingsComp?.getView()?.preventAppStylesOverwriting;
869-
const { themeId } = theme || {};
870873
const { appliedThemeId, preventStyleOverwriting } = comp?.comp?.container || comp?.comp || {};
871-
const appTheme = !preventStyleOverwriting && !preventAppStylesOverwriting
874+
const appTheme = isPreviewTheme || isDefaultTheme || (!preventStyleOverwriting && !preventAppStylesOverwriting)
872875
? theme?.theme
873876
: undefined;
874-
const compTheme = compType && !preventStyleOverwriting && !preventAppStylesOverwriting
877+
const compTheme = isPreviewTheme || isDefaultTheme || (compType && !preventStyleOverwriting && !preventAppStylesOverwriting)
875878
? {
876-
...(theme?.theme?.components?.[compType]?.[styleKey] || {}) as unknown as Record<string, string>
879+
...(
880+
theme?.theme?.components?.[compType]?.[styleKey]
881+
|| defaultTheme.components?.[compType]?.[styleKey]
882+
) as unknown as Record<string, string>
877883
}
878884
: undefined;
879885
const styleProps = (!comp && !compType) || preventStyleOverwriting || preventAppStylesOverwriting || appliedThemeId === themeId

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,8 @@ export const TableHeaderStyle = [
14591459
FONT_FAMILY,
14601460
FONT_STYLE,
14611461
TEXT,
1462-
getStaticBackground(SURFACE_COLOR),
1463-
getBackground("primarySurface"),
1462+
// getStaticBackground(SURFACE_COLOR),
1463+
// getBackground("primarySurface"),
14641464
{
14651465
name: "headerBackground",
14661466
label: trans("style.tableHeaderBackground"),

0 commit comments

Comments
 (0)