Skip to content

Commit

Permalink
Merge pull request #3292 from illacloud/merge/fix/builder-bug-wtf
Browse files Browse the repository at this point in the history
Merge/fix/builder bug wtf
  • Loading branch information
Wangtaofeng authored Oct 27, 2023
2 parents 00e07e3 + 8d245df commit e08df9e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ const ChartKeysDynamicSelectSetter: FC<ChartDataSourceSetterProps> = (
})

const isDynamic = useMemo(() => {
const dataSourceMode = get(targetComponentProps, "keySelectMode", "select")
const dataSourceMode = get(
targetComponentProps,
`${widgetDisplayName}.${attrName}JS`,
"select",
)
return dataSourceMode === "dynamic"
}, [targetComponentProps])
}, [attrName, targetComponentProps, widgetDisplayName])

const finalValue = useMemo(() => {
return get(panelConfig, attrName, "")
Expand All @@ -137,19 +141,26 @@ const ChartKeysDynamicSelectSetter: FC<ChartDataSourceSetterProps> = (
const handleClickFxButton = useCallback(() => {
const isInOption = selectedOptions.some((value) => value === finalValue)
if (isDynamic) {
handleUpdateDsl("keySelectMode", "select")
handleUpdateDsl(`${widgetDisplayName}.${attrName}JS`, "select")
if (!isInOption) {
handleUpdateDsl(attrName, "")
} else {
handleUpdateDsl(attrName, finalValue)
}
} else {
handleUpdateDsl("keySelectMode", "dynamic")
handleUpdateDsl(`${widgetDisplayName}.${attrName}JS`, "dynamic")
if (isInOption) {
handleUpdateDsl(attrName, finalValue)
}
}
}, [selectedOptions, isDynamic, finalValue, handleUpdateDsl, attrName])
}, [
selectedOptions,
isDynamic,
finalValue,
handleUpdateDsl,
widgetDisplayName,
attrName,
])

const handleChangeSelect = useCallback(
(value: string) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/builder/src/widgetLibrary/ChartWidget/panelConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export const CHART_PANEL_CONFIG: PanelConfig[] = [
attrName: "shadow",
setterType: "SHADOW_SELECT_SETTER",
useCustomLayout: true,
defaultValue: "small",
defaultValue: "none",
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ export function initChartWidgetDefaultProps() {
dateFormat: "YYYY-MM-DD",
radius: "4px",
backgroundColor: "#ffffffff",
shadow: "small",
shadow: "none",
}
}

0 comments on commit e08df9e

Please sign in to comment.