@@ -45,6 +45,7 @@ import { Card, Divider, Flex, List, Tooltip } from 'antd';
4545import { ThemeCompPanel } from "pages/setting/theme/ThemeCompPanel" ;
4646import { JSONObject } from "@lowcoder-ee/util/jsonTypes" ;
4747import { exportThemeAsJSONFile } from "../themeImportExport" ;
48+ import _ from "lodash" ;
4849
4950const ThemeSettingsView = styled . div `
5051 font-size: 14px;
@@ -130,7 +131,7 @@ class ThemeDetailPage extends React.Component<ThemeDetailPageProps, ThemeDetailP
130131 }
131132
132133 componentDidUpdate ( prevProps : ThemeDetailPageProps , prevState : ThemeDetailPageState ) {
133- if ( prevProps . themeList ?. length !== this . props . themeList ?. length ) {
134+ if ( prevProps . themeList !== this . props . themeList && prevProps . themeList ?. length !== this . props . themeList ?. length ) {
134135 this . findCurrentTheme ( ) ;
135136 }
136137 }
@@ -170,10 +171,17 @@ class ThemeDetailPage extends React.Component<ThemeDetailPageProps, ThemeDetailP
170171 configChange ( params : configChangeParams ) {
171172 if ( ! this . state . theme ) return ;
172173
174+ const { themeSettingKey, ...rest } = params ;
175+ const value = _ . find ( _ . values ( rest ) , ( v ) => v !== undefined ) ;
176+
177+ if ( _ . isEqual ( this . state . theme [ themeSettingKey as keyof typeof this . state . theme ] , value ) ) {
178+ return ;
179+ }
180+
173181 this . setState ( {
174182 theme : {
175183 ...this . state . theme ,
176- [ params . themeSettingKey ] : params . color || params . radius || params . chart || params . margin || params . padding || params . borderWidth || params . borderStyle || params . fontFamily || params . showComponentLoadingIndicators || params . showDataLoadingIndicators || params . dataLoadingIndicator || params . gridColumns || params . gridRowHeight || params . gridRowCount || params . gridPaddingX || params . gridPaddingY || params . gridBgImage || params . gridBgImageRepeat || params . gridBgImageSize || params . gridBgImagePosition || params . gridBgImageOrigin ,
184+ [ themeSettingKey ] : value ,
177185 } ,
178186 } ) ;
179187 }
@@ -904,17 +912,20 @@ class ThemeDetailPage extends React.Component<ThemeDetailPageProps, ThemeDetailP
904912 >
905913 { trans ( "reset" ) }
906914 </ ResetButton >
907- < ResetButton onClick = { this . handleExport } disabled = { ! this . state . name || ! this . state . theme } >
908- { trans ( "theme.exportTheme" ) }
909- </ ResetButton >
910915 < SaveButton
911916 type = "primary"
912917 disabled = { this . isThemeNotChange ( ) || ! this . state . name }
913918 onClick = { ( ) => this . handleSave ( ) }
914- style = { { marginLeft : "auto" } }
915919 >
916920 { trans ( "theme.saveBtn" ) }
917921 </ SaveButton >
922+ < ResetButton
923+ onClick = { this . handleExport }
924+ disabled = { ! this . state . name || ! this . state . theme }
925+ style = { { marginLeft : "auto" } }
926+ >
927+ { trans ( "theme.exportTheme" ) }
928+ </ ResetButton >
918929 </ Footer >
919930 </ DetailContainer >
920931 </ >
0 commit comments