Skip to content

Commit 451a0f6

Browse files
committed
Fixed an issue that the theme is not applied because some properties are not defined
1 parent c7d4c9c commit 451a0f6

File tree

4 files changed

+18
-55
lines changed

4 files changed

+18
-55
lines changed

client/packages/lowcoder-comps/src/comps/funnelChartComp/funnelChartUtils.ts

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Big from "big.js";
1414
import { googleMapsApiUrl } from "../chartComp/chartConfigs/chartUrls";
1515
import opacityToHex from "../../util/opacityToHex";
1616
import parseBackground from "../../util/gradientBackgroundColor";
17+
import {chartStyleWrapper, styleWrapper} from "../../util/styleWrapper";
1718

1819
export function transformData(
1920
originData: JSONObject[],
@@ -143,15 +144,7 @@ export function getEchartsConfig(
143144
"top": props.echartsTitleVerticalConfig.top,
144145
"left":props.echartsTitleConfig.top,
145146
"textStyle": {
146-
"fontFamily": props?.titleStyle?.chartFontFamily || theme?.titleStyle?.fontFamily,
147-
"fontSize": props?.titleStyle?.chartTextSize || theme?.titleStyle?.fontSize || '18',
148-
"fontWeight": props?.titleStyle?.chartTextWeight || theme?.titleStyle?.fontWeight,
149-
"color": props?.titleStyle?.chartTextColor || theme?.titleStyle?.fontColor || "#000000",
150-
"fontStyle": props?.titleStyle?.chartFontStyle || theme?.titleStyle?.fontStyle,
151-
"textShadowColor": props?.titleStyle?.chartShadowColor || theme?.titleStyle?.shadowColor,
152-
"textShadowBlur": props?.titleStyle?.chartBoxShadow?.split('px')[0] || theme?.titleStyle?.boxShadow?.split('px')[0],
153-
"textShadowOffsetX": props?.titleStyle?.chartBoxShadow?.split('px')[1] || theme?.titleStyle?.boxShadow?.split('px')[1],
154-
"textShadowOffsetY": props?.titleStyle?.chartBoxShadow?.split('px')[2] || theme?.titleStyle?.boxShadow?.split('px')[2]
147+
...styleWrapper(props?.titleStyle, theme?.titleStyle)
155148
}
156149
},
157150
"backgroundColor": parseBackground( props?.chartStyle?.background || theme?.chartStyle?.backgroundColor || "#FFFFFF"),
@@ -166,15 +159,7 @@ export function getEchartsConfig(
166159
"left": props.echartsLegendAlignConfig.left,
167160
"orient": props.echartsLegendOrientConfig.orient,
168161
"textStyle": {
169-
"fontFamily": props?.legendStyle?.chartFontFamily || theme?.legendStyle?.fontFamily,
170-
"fontSize": props?.legendStyle?.chartTextSize || theme?.legendStyle?.fontSize,
171-
"fontWeight": props?.legendStyle?.chartTextWeight || theme?.legendStyle?.fontWeight,
172-
"color": props?.legendStyle?.chartTextColor || theme?.legendStyle?.fontColor || "#000000",
173-
"fontStyle": props?.legendStyle?.chartFontStyle || theme?.legendStyle?.fontStyle,
174-
"textShadowColor": props?.legendStyle?.chartShadowColor || theme?.legendStyle?.shadowColor,
175-
"textShadowBlur": props?.legendStyle?.chartBoxShadow?.split('px')[0] || theme?.legendStyle?.boxShadow?.split('px')[0],
176-
"textShadowOffsetX": props?.legendStyle?.chartBoxShadow?.split('px')[1] || theme?.legendStyle?.boxShadow?.split('px')[1],
177-
"textShadowOffsetY": props?.legendStyle?.chartBoxShadow?.split('px')[2] || theme?.legendStyle?.boxShadow?.split('px')[2]
162+
...styleWrapper(props?.legendStyle, theme?.legendStyle)
178163
}
179164
},
180165
"series": [
@@ -192,27 +177,12 @@ export function getEchartsConfig(
192177
"sort": props.echartsSortingConfig.sort,
193178
"itemStyle": {
194179
"opacity": props.opacity,
195-
"borderColor": props?.chartStyle?.chartBorderColor || theme?.chartStyle?.borderColor,
196-
"borderWidth": props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
197-
"borderType": props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
198-
"borderRadius": Number(props?.chartStyle?.chartBorderRadius || theme?.chartStyle?.borderRadius),
199-
"shadowColor": props?.chartStyle?.chartShadowColor || theme?.chartStyle?.shadowColor,
200-
"shadowBlur": props?.chartStyle?.chartBoxShadow?.split('px')[0] || theme?.chartStyle?.boxShadow?.split('px')[0],
201-
"shadowOffsetX": props?.chartStyle?.chartBoxShadow?.split('px')[1] || theme?.chartStyle?.boxShadow?.split('px')[1],
202-
"shadowOffsetY": props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
180+
...chartStyleWrapper(props?.chartStyle,theme?.chartStyle),
203181
},
204182
"label": {
205183
"show": props.label,
206184
"position": props.echartsLabelConfig.top,
207-
"fontFamily": props?.labelStyle?.chartFontFamily || theme?.labelStyle?.fontFamily,
208-
"fontSize": props?.labelStyle?.chartTextSize || theme?.labelStyle?.fontSize,
209-
"fontWeight": props?.labelStyle?.chartTextWeight || theme?.labelStyle?.fontWeight,
210-
"color": props?.labelStyle?.chartTextColor || theme?.labelStyle?.fontColor || "#000000",
211-
"fontStyle": props?.labelStyle?.chartFontStyle || theme?.labelStyle?.fontStyle,
212-
"textShadowColor": props?.labelStyle?.chartShadowColor || theme?.labelStyle?.shadowColor,
213-
"textShadowBlur": props?.labelStyle?.chartBoxShadow?.split('px')[0] || theme?.labelStyle?.boxShadow?.split('px')[0],
214-
"textShadowOffsetX": props?.labelStyle?.chartBoxShadow?.split('px')[1] || theme?.labelStyle?.boxShadow?.split('px')[1],
215-
"textShadowOffsetY": props?.labelStyle?.chartBoxShadow?.split('px')[2] || theme?.labelStyle?.boxShadow?.split('px')[2]
185+
...styleWrapper(props?.labelStyle,theme?.labelStyle),
216186
},
217187
"data": props.echartsOption.data
218188
}

client/packages/lowcoder-comps/src/comps/gaugeChartComp/gaugeChartUtils.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { googleMapsApiUrl } from "../chartComp/chartConfigs/chartUrls";
1515
import opacityToHex from "../../util/opacityToHex";
1616
import parseBackground from "../../util/gradientBackgroundColor";
1717
import {ba} from "@fullcalendar/core/internal-common";
18-
import {styleWrapper} from "../../util/styleWrapper";
18+
import {chartStyleWrapper, styleWrapper} from "../../util/styleWrapper";
1919

2020
export function transformData(
2121
originData: JSONObject[],
@@ -195,14 +195,7 @@ export function getEchartsConfig(
195195
},
196196
"itemStyle": {
197197
"opacity": props?.opacity,
198-
"borderColor": props?.chartStyle?.chartBorderColor || theme?.chartStyle?.borderColor,
199-
"borderWidth": props?.chartStyle?.chartBorderWidth || theme?.chartStyle?.borderWidth,
200-
"borderType": props?.chartStyle?.chartBorderStyle || theme?.chartStyle?.borderType,
201-
"borderRadius": Number(props?.chartStyle?.chartBorderRadius || theme?.chartStyle?.borderRadius),
202-
"shadowColor": props?.chartStyle?.chartShadowColor || theme?.chartStyle?.shadowColor,
203-
"shadowBlur": props?.chartStyle?.chartBoxShadow?.split('px')[0] || theme?.chartStyle?.boxShadow?.split('px')[0],
204-
"shadowOffsetX": props?.chartStyle?.chartBoxShadow?.split('px')[1] || theme?.chartStyle?.boxShadow?.split('px')[1],
205-
"shadowOffsetY": props?.chartStyle?.chartBoxShadow?.split('px')[2] || theme?.chartStyle?.boxShadow?.split('px')[2]
198+
...chartStyleWrapper(props?.chartStyle,theme?.chartStyle),
206199
},
207200
"progress": {
208201
"roundCap": props.roundCap,

client/packages/lowcoder-comps/src/util/styleWrapper.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ export const styleWrapper = (styleContainer: any, themeContainer: any, defaultFo
77
"color": styleContainer?.chartTextColor || themeContainer?.fontColor || defaultFontColor,
88
"fontStyle": styleContainer?.chartFontStyle || themeContainer?.fontStyle,
99
"textShadowColor": styleContainer?.chartShadowColor || themeContainer?.shadowColor,
10-
"textShadowBlur": styleContainer?.chartBoxShadow?.split('px')[0] || themeContainer?.boxShadow?.split('px')[0],
11-
"textShadowOffsetX": styleContainer?.chartBoxShadow?.split('px')[1] || themeContainer?.boxShadow?.split('px')[1],
12-
"textShadowOffsetY": styleContainer?.chartBoxShadow?.split('px')[2] || themeContainer?.boxShadow?.split('px')[2],
10+
"textShadowBlur": styleContainer?.chartBoxShadow?.split('px')[0] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[0],
11+
"textShadowOffsetX": styleContainer?.chartBoxShadow?.split('px')[1] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[1],
12+
"textShadowOffsetY": styleContainer?.chartBoxShadow?.split('px')[2] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[2],
1313
"borderColor": styleContainer?.chartBorderColor || themeContainer?.borderColor || 'inherit',
1414
"borderWidth": styleContainer?.chartBorderWidth || themeContainer?.borderWidth || detailBorderWidth,
1515
"borderType": styleContainer?.chartBorderStyle || themeContainer?.borderType,
1616
"borderRadius": Number(styleContainer?.chartBorderRadius || themeContainer?.borderRadius),
1717
"backgroundColor": styleContainer?.chartBackgroundColor || themeContainer?.backgroundColor || defaultBackgroundColor,
18-
"width": styleContainer?.detailSize?.split('px')[0] || themeContainer?.detailSize.split('px')[0],
19-
"height": styleContainer?.detailSize?.split('px')[1] || themeContainer?.detailSize.split('px')[1],
20-
"padding": styleContainer?.padding?.split('px').filter(Boolean).map(Number) || themeContainer?.padding?.split('px').filter(Boolean).map(Number) || [0,0,0,0]
18+
"width": styleContainer?.detailSize?.split('px')[0] || themeContainer?.detailSize && themeContainer?.detailSize.split('px')[0],
19+
"height": styleContainer?.detailSize?.split('px')[1] || themeContainer?.detailSize && themeContainer?.detailSize.split('px')[1],
20+
"padding": styleContainer?.padding?.split('px').filter(Boolean).map(Number) || themeContainer?.padding && themeContainer?.padding?.split('px').filter(Boolean).map(Number) || [0,0,0,0]
2121
}
2222
}
2323

2424
export const chartStyleWrapper = (styleContainer: any, themeContainer: any, detailBorderWidth = 0) => {
2525

2626
return {
2727
"shadowColor": styleContainer?.chartShadowColor || themeContainer?.shadowColor,
28-
"shadowBlur": styleContainer?.chartBoxShadow?.split('px')[0] || themeContainer?.boxShadow?.split('px')[0],
29-
"shadowOffsetX": styleContainer?.chartBoxShadow?.split('px')[1] || themeContainer?.boxShadow?.split('px')[1],
30-
"shadowOffsetY": styleContainer?.chartBoxShadow?.split('px')[2] || themeContainer?.boxShadow?.split('px')[2],
28+
"shadowBlur": styleContainer?.chartBoxShadow?.split('px')[0] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[0],
29+
"shadowOffsetX": styleContainer?.chartBoxShadow?.split('px')[1] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[1],
30+
"shadowOffsetY": styleContainer?.chartBoxShadow?.split('px')[2] || themeContainer?.boxShadow && themeContainer?.boxShadow?.split('px')[2],
3131
"borderColor": styleContainer?.chartBorderColor || themeContainer?.borderColor || 'inherit',
3232
"borderWidth": styleContainer?.chartBorderWidth || themeContainer?.borderWidth || detailBorderWidth,
3333
"borderType": styleContainer?.chartBorderStyle || themeContainer?.borderType,

client/packages/lowcoder/src/comps/comps/remoteComp/loaders.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ async function npmLoader(
2626

2727
const applicationId = (!appId || appId && appId === PUBLIC_APP_ID) ? 'none' : appId;
2828

29-
const entry = `${pluginBaseUrl}/${applicationId}/${packageName}@${localPackageVersion}/index.js`;
30-
29+
// const entry = `${pluginBaseUrl}/${applicationId}/${packageName}@${localPackageVersion}/index.js`;
30+
const entry = '../../../../../public/package/index.js';
3131
try {
3232
const module = await import(
3333
/* @vite-ignore */

0 commit comments

Comments
 (0)