Skip to content

Fix/theme styling for components #962

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c674487
WIP - Changing the Theme Detail View
May 21, 2024
b102c4a
WIP - Changing the Theme Detail View 2
May 23, 2024
e7f2cbb
WIP - Changing the Theme Detail View 3
May 23, 2024
5c6fb02
Merge branch 'dev' into feature-themes-for-components
FalkWolsky May 25, 2024
732138d
Merge branch 'dev' into feature-themes-for-components
FalkWolsky May 25, 2024
856d5ed
Merge branch 'dev' into feature-themes-for-components
FalkWolsky May 25, 2024
fa54cbd
Theme Settings extended and Components Display set up.
May 25, 2024
27f0304
Deleting an Space in tsconfig
May 27, 2024
334b5f8
Small Update
May 27, 2024
16ca707
Small Update
May 27, 2024
bfd5d71
theme: components styling
raheeliftikhar5 Jun 3, 2024
3174397
Merge branch 'dev' into feature-themes-for-components
raheeliftikhar5 Jun 5, 2024
f9eb91a
theme: fix lc-comps loading in comp styling
raheeliftikhar5 Jun 6, 2024
bf89dba
Theme: added debounce for style changes and update theme
raheeliftikhar5 Jun 7, 2024
0aeb00a
Theme: use theme style in candleChartComp
raheeliftikhar5 Jun 7, 2024
67407ba
Theme: use theme styles for comps
raheeliftikhar5 Jun 7, 2024
26cb4a3
Theme: apply theme styles in textComp
raheeliftikhar5 Jun 7, 2024
66046ec
Theme: apply theme styles in triContainerComp
raheeliftikhar5 Jun 7, 2024
7be6c1c
Merge branch 'dev' into feature-themes-for-components
MenamAfzal Jun 10, 2024
ccb4b4c
background color updated
MenamAfzal Jun 13, 2024
5353b19
color fix
MenamAfzal Jun 14, 2024
f254359
text color updated
MenamAfzal Jun 14, 2024
1f53dd8
dep removed
MenamAfzal Jun 14, 2024
47b78f6
console removed
MenamAfzal Jun 14, 2024
2b718a7
styles updated
MenamAfzal Jun 15, 2024
a8a2b33
styles from theme
MenamAfzal Jun 15, 2024
ce94ae3
theme styles for comp updated
MenamAfzal Jun 15, 2024
8163bc2
minor changes
Jun 15, 2024
0ee97a9
minor changes
Jun 15, 2024
9d8692d
latest chnages
Jun 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ CandleStickChartTmpComp = withViewFn(CandleStickChartTmpComp, (comp) => {
const option = useMemo(() => {
return getEchartsConfig(
childrenToProps(echartsConfigChildren) as ToViewReturn<typeof echartsConfigChildren>,
chartSize
chartSize,
theme?.theme?.components?.candleStickChart || {},
);
}, [chartSize, ...Object.values(echartsConfigChildren)]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { chartColorPalette, isNumeric, JSONObject, loadScript } from "lowcoder-s
import { calcXYConfig } from "comps/chartComp/chartConfigs/cartesianAxisConfig";
import Big from "big.js";
import { googleMapsApiUrl } from "../chartComp/chartConfigs/chartUrls";
import { useContext } from "react";

export function transformData(
originData: JSONObject[],
Expand Down Expand Up @@ -128,15 +129,19 @@ export function getSeriesConfig(props: EchartsConfigProps) {
}

// https://echarts.apache.org/en/option.html
export function getEchartsConfig(props: EchartsConfigProps, chartSize?: ChartSize): EChartsOptionWithMap {
export function getEchartsConfig(
props: EchartsConfigProps,
chartSize?: ChartSize,
theme?: any,
): EChartsOptionWithMap {
if (props.mode === "json") {
let opt={
"title": {
"text": props.echartsTitle,
'top': props.echartsLegendConfig.top === 'bottom' ?'top':'bottom',
"left":"center"
},
"backgroundColor": props?.style?.background,
"backgroundColor": props?.style?.background || theme.background,
"color": props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip&&{
"trigger": "axis",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ColorSelect = (props: ColorSelectProps) => {
dispatch && dispatch(changeValueAction(toHex(rgbaColor), true));
changeColor && changeColor(toHex(rgbaColor));
}, 200),
[dispatch]
[dispatch,changeColor]
);
return (
<Popover
Expand Down
63 changes: 38 additions & 25 deletions client/packages/lowcoder/src/api/commonSettingApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Api from "./api";
import { AxiosPromise } from "axios";
import { ApiResponse, GenericApiResponse } from "./apiResponses";
import { trans } from "i18n";
import { JSONObject } from "@lowcoder-ee/util/jsonTypes";

export type FetchCommonSettingPayload = {
orgId: string;
Expand Down Expand Up @@ -43,58 +44,70 @@ export interface ThemeDetail {
canvas: string; // app bg-color
primarySurface: string; // comp bg-color
borderRadius: string;
borderColor?: string;
borderWidth?: string;
borderStyle?: string;
chart?: string;
margin?: string;
padding?: string;
gridColumns?: string; //Added By Aqib Mirza
textSize?: string;
fontFamily?: string;
animation?: string;
animationDelay?: string;
animationDuration?: string;
opacity?: string;
boxShadow?: string;
boxShadowColor?: string;
animationIterationCount?: string;
background?:string;
border?:string;
accent?:string;
validate?:string;
components?: Record<string, JSONObject>;
}

export function getThemeDetailName(key: keyof ThemeDetail) {
switch (key) {
case "primary":
return trans("themeDetail.primary");
case "textDark":
return trans("themeDetail.textDark");
case "textLight":
return trans("themeDetail.textLight");
case "canvas":
return trans("themeDetail.canvas");
case "primarySurface":
return trans("themeDetail.primarySurface");
case "borderRadius":
return trans("themeDetail.borderRadius");
case "margin":
return trans("style.margin");
case "padding":
return trans("style.padding");
//Added By Aqib Mirza
case "gridColumns":
return trans("themeDetail.gridColumns");
case "textSize":
return trans("style.textSize");
case "primary": return trans("themeDetail.primary");
case "textDark": return trans("themeDetail.textDark");
case "textLight": return trans("themeDetail.textLight");
case "canvas": return trans("themeDetail.canvas");
case "primarySurface": return trans("themeDetail.primarySurface");
case "borderRadius": return trans("themeDetail.borderRadius");
case "borderColor": return trans("themeDetail.borderColor");
case "borderWidth": return trans("themeDetail.borderWidth");
case "borderStyle": return trans("themeDetail.borderStyle");
case "fontFamily": return trans("themeDetail.fontFamily");
case "margin": return trans("style.margin");
case "padding": return trans("style.padding");
case "gridColumns": return trans("themeDetail.gridColumns");
case "textSize": return trans("style.textSize");
}
return "";
}

export function isThemeColorKey(key: string) {
console.log("key", key)
switch (key as keyof ThemeDetail) {
case "primary":
case "textDark":
case "textLight":
case "canvas":
case "primarySurface":
case "margin":
case "padding":
case "gridColumns": //Added By Aqib Mirza
case "textSize":
case "accent":
case "validate":
// case "borderRadius":
case "borderColor":
// case "borderWidth":
// case "borderStyle":
// case "fontFamily":
// case "margin":
// case "padding":
// case "gridColumns":
// case "textSize":
case "background" :
case "border":
return true;
}
return false;
Expand Down
Loading
Loading