Skip to content

Feature - Themes for Components #907

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

Merged
merged 57 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
1e2d2bf
WIP - Changing the Theme Detail View
May 21, 2024
c29cdbb
WIP - Changing the Theme Detail View 2
May 23, 2024
3a94509
WIP - Changing the Theme Detail View 3
May 23, 2024
b19b824
Theme Settings extended and Components Display set up.
May 25, 2024
e747613
Deleting an Space in tsconfig
May 27, 2024
2ee0cf1
Small Update
May 27, 2024
117a277
Small Update
May 27, 2024
b2d5862
theme: components styling
raheeliftikhar5 Jun 3, 2024
8529fec
theme: fix lc-comps loading in comp styling
raheeliftikhar5 Jun 6, 2024
61e3963
Theme: added debounce for style changes and update theme
raheeliftikhar5 Jun 7, 2024
bbb7f7a
Theme: use theme style in candleChartComp
raheeliftikhar5 Jun 7, 2024
e819e35
Theme: use theme styles for comps
raheeliftikhar5 Jun 7, 2024
8c17c04
Theme: apply theme styles in textComp
raheeliftikhar5 Jun 7, 2024
29bff58
Theme: apply theme styles in triContainerComp
raheeliftikhar5 Jun 7, 2024
2e12374
Theme: moved defaultTheme to separate constant file
raheeliftikhar5 Jun 16, 2024
ee603b0
Theme: applied theme styles in input comp
raheeliftikhar5 Jun 16, 2024
e4b5ddc
Theme: update styleControls to handle comp theme styles
raheeliftikhar5 Jun 16, 2024
04848ba
Theme: apply theme styles on table comp
raheeliftikhar5 Jun 16, 2024
b8d44e5
Theme: apply theme styles in list/grid view
raheeliftikhar5 Jun 16, 2024
5c413c0
Theme: apply theme styles on link comp
raheeliftikhar5 Jun 16, 2024
e659877
Theme: apply theme styles in rating comp
raheeliftikhar5 Jun 16, 2024
5bf8a7b
fixed imported dependencies path
raheeliftikhar5 Jun 16, 2024
106e8ed
Theme: apply theme styles in timeline comp
raheeliftikhar5 Jun 16, 2024
ea58eae
Update for Mobile Navigation Items Display
Jun 15, 2024
7fc9182
remove duplicate dependecies
raheeliftikhar5 Jun 16, 2024
5d20a89
Theme: config updates
raheeliftikhar5 Jun 16, 2024
660fa27
Theme: apply theme on data collection comps
raheeliftikhar5 Jun 17, 2024
736ad03
Theme: apply theme styles on time comp
raheeliftikhar5 Jun 17, 2024
727630a
responsiveLayout component
Jun 17, 2024
9cc5c45
card component
Jun 17, 2024
9ee311e
column layout component
Jun 17, 2024
a5ec696
tabbed container component
Jun 17, 2024
22ae427
step control
Jun 17, 2024
11abdfa
cascader
Jun 17, 2024
1587f0b
float component
Jun 17, 2024
3ed4344
treeSelect Component
Jun 17, 2024
98e48ec
pageLayout component
Jun 17, 2024
df63d5f
themeConstants
Jun 17, 2024
400c25f
Fixes in Style Properties Display in Theme Settings
Jun 17, 2024
33ec791
Integration & Extension component
Jun 17, 2024
7c01f10
Multimedia & Animation
Jun 17, 2024
9cb0240
Item & Signature
Jun 17, 2024
ad6d03a
Theme: allow overwrite theme styles
raheeliftikhar5 Jun 17, 2024
391bb05
Fixes in Style Properties Display in Theme Settings 2
Jun 17, 2024
d05691a
Doc & File
Jun 22, 2024
0d883a6
Meeting & Colaboration
Jun 22, 2024
b4cd202
Theme: created a hook to merge styles initially
raheeliftikhar5 Jun 26, 2024
3cc6189
Theme: replacing code with custom hook
raheeliftikhar5 Jun 26, 2024
de35ab7
Theme: added preventStyleOverwriting switches in app and component se…
raheeliftikhar5 Jun 26, 2024
d58be23
Theme: remove overwriteStyles switch
raheeliftikhar5 Jun 26, 2024
be6c861
Theme: added comp theme styling in candleStickChart
raheeliftikhar5 Jun 26, 2024
13fbb07
custom hook used
MenamAfzal Jun 28, 2024
05f89e1
theme for chart components
MenamAfzal Jul 1, 2024
b466297
Theme: fixed chart themes
raheeliftikhar5 Jul 2, 2024
65f6ec6
Theme: removed unused dependencies + apply themes in charts
raheeliftikhar5 Jul 2, 2024
086334c
fixed imports
raheeliftikhar5 Jul 3, 2024
f107746
small fix
raheeliftikhar5 Jul 3, 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
48 changes: 24 additions & 24 deletions client/packages/lowcoder-comps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,6 @@
"lowcoder": {
"description": "",
"comps": {
"meetingController": {
"name": "Agora Meeting Controller",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 1,
"h": 1
}
},
"meetingSharing": {
"name": "Agora Meeting Sharing",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 6,
"h": 40
}
},
"meetingStream": {
"name": "Video Stream",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 6,
"h": 40
}
},
"calendar": {
"name": "Calendar",
"icon": "./icons/icon-comp-calendar.svg",
Expand Down Expand Up @@ -193,6 +169,30 @@
"w": 19,
"h": 60
}
},
"meetingController": {
"name": "Agora Meeting Controller",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 1,
"h": 1
}
},
"meetingSharing": {
"name": "Agora Meeting Sharing",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 6,
"h": 40
}
},
"meetingStream": {
"name": "Video Stream",
"icon": "./icons/icon-comp-calendar.svg",
"layoutInfo": {
"w": 6,
"h": 40
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
ThemeContext,
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand Down Expand Up @@ -73,6 +74,8 @@ BasicChartTmpComp = withViewFn(BasicChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down Expand Up @@ -123,7 +126,8 @@ BasicChartTmpComp = withViewFn(BasicChartTmpComp, (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 @@ -251,11 +251,11 @@ export const chartUiModeChildren = {

const chartJsonModeChildren = {
echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),
echartsTitle: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsTitle: withDefault(StringControl, trans("echarts.defaultTitle")),
echartsLegendConfig: EchartsLegendConfig,
echartsLabelConfig: EchartsLabelConfig,
echartsConfig: EchartsOptionComp,
style: styleControl(EchartsStyle),
style: styleControl(EchartsStyle, 'style'),
tooltip: withDefault(BoolControl, true),
legendVisibility: withDefault(BoolControl, true),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,21 @@ 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,
"color": props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip&&{
"backgroundColor": props?.style?.background || theme?.style?.background,
"color": props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip && {
"trigger": "item",
"formatter": "{a} <br/>{b} : {c}%"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import {
CustomModal,
jsonValueExposingStateControl,
CalendarDeleteIcon,
Tooltip
Tooltip,
useMergeCompStyles,
} from "lowcoder-sdk";

import {
Expand Down Expand Up @@ -87,7 +88,7 @@ const childrenMap = {
firstDay: dropdownControl(FirstDayOptions, "1"),
dayMaxEvents: withDefault(NumberControl, 2),
eventMaxStack: withDefault(NumberControl, 0),
style: styleControl(CalendarStyle),
style: styleControl(CalendarStyle, 'style'),
licenseKey: withDefault( StringControl, "" ),
currentFreeView: dropdownControl(DefaultWithFreeViewOptions, "timeGridWeek"),
currentPremiumView: dropdownControl(DefaultWithPremiumViewOptions, "resourceTimelineDay"),
Expand All @@ -114,7 +115,7 @@ let CalendarBasicComp = (function () {
licensed?: boolean;
currentFreeView?: string;
currentPremiumView?: string;
}) => {
}, dispatch: any) => {

const theme = useContext(ThemeContext);
const ref = createRef<HTMLDivElement>();
Expand All @@ -123,15 +124,15 @@ let CalendarBasicComp = (function () {
const [left, setLeft] = useState<number | undefined>(undefined);
const [licensed, setLicensed] = useState<boolean>(props.licenseKey !== "");

useMergeCompStyles(props, dispatch);

useEffect(() => {
setLicensed(props.licenseKey !== "");
}, [props.licenseKey]);

let currentView = licensed ? props.currentPremiumView : props.currentFreeView;
let currentEvents = currentView == "resourceTimelineDay" || currentView == "resourceTimeGridDay" ? props.resourcesEvents : props.events;

console.log("currentEvents", currentEvents);

// we use one central stack of events for all views
let events = Array.isArray(currentEvents.value) ? currentEvents.value.map((item: EventType) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
ThemeContext,
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand Down Expand Up @@ -63,14 +64,15 @@ CandleStickChartTmpComp = withViewFn(CandleStickChartTmpComp, (comp) => {
color: chartColorPalette,
backgroundColor: "#fff",
};

let themeConfig = defaultChartTheme;
try {
themeConfig = theme?.theme.chart ? JSON.parse(theme?.theme.chart) : defaultChartTheme;
} catch (error) {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down Expand Up @@ -144,7 +146,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 @@ -253,7 +253,7 @@ const chartJsonModeChildren = {
echartsLegendConfig: EchartsLegendConfig,
echartsLabelConfig: EchartsLabelConfig,
echartsConfig: EchartsOptionComp,
style: styleControl(EchartsStyle),
style: styleControl(EchartsStyle, 'style'),
tooltip: withDefault(BoolControl, true),
legendVisibility: withDefault(BoolControl, true),
}
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?.style?.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 @@ -128,7 +128,11 @@ 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") {
return props.echartsOption ? props.echartsOption : {};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
ThemeContext,
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/basicChartComp/chartConfigs/lineChartConfig";
Expand Down Expand Up @@ -82,6 +83,8 @@ MapTmpComp = withViewFn(MapTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down Expand Up @@ -119,7 +122,8 @@ MapTmpComp = withViewFn(MapTmpComp, (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 @@ -24,7 +24,8 @@ import {
ThemeContext,
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl
dropdownControl,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand Down Expand Up @@ -71,6 +72,8 @@ FunnelChartTmpComp = withViewFn(FunnelChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down Expand Up @@ -144,7 +147,8 @@ FunnelChartTmpComp = withViewFn(FunnelChartTmpComp, (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 @@ -255,7 +255,7 @@ const chartJsonModeChildren = {
echartsLabelConfig: EchartsLabelConfig,
echartsConfig: EchartsOptionComp,
echartsTitleConfig:EchartsTitleConfig,
style: styleControl(EchartsStyle),
style: styleControl(EchartsStyle, 'style'),
tooltip: withDefault(BoolControl, true),
label: withDefault(BoolControl, true),
legendVisibility: withDefault(BoolControl, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,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":props.echartsTitleConfig.top
},
"backgroundColor": props?.style?.background,
"backgroundColor": props?.style?.background || theme?.style?.background,
"color": props.echartsOption.data?.map(data => data.color),
"tooltip": props.tooltip&&{
"trigger": "item",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import {
chartColorPalette,
getPromiseAfterDispatch,
dropdownControl,
JSONObject
JSONObject,
useMergeCompStyles,
} from "lowcoder-sdk";
import { getEchartsLocale, trans } from "i18n/comps";
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
Expand Down Expand Up @@ -72,6 +73,8 @@ GaugeChartTmpComp = withViewFn(GaugeChartTmpComp, (comp) => {
log.error('theme chart error: ', error);
}

useMergeCompStyles(childrenToProps(comp.children), comp.dispatch);

const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
await getPromiseAfterDispatch(
dispatch,
Expand Down Expand Up @@ -145,7 +148,8 @@ GaugeChartTmpComp = withViewFn(GaugeChartTmpComp, (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 @@ -255,7 +255,7 @@ const chartJsonModeChildren = {
echartsLabelConfig: EchartsLabelConfig,
echartsConfig: EchartsOptionComp,
echartsTitleConfig:EchartsTitleConfig,
style: styleControl(EchartsStyle),
style: styleControl(EchartsStyle, 'style'),
tooltip: withDefault(BoolControl, true),
legendVisibility: withDefault(BoolControl, true),
label: withDefault(BoolControl, true),
Expand Down
Loading
Loading