@@ -236,36 +236,13 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
236
236
const lowcoderCompsMeta = useSelector ( ( state : AppState ) => state . npmPlugin . packageMeta [ 'lowcoder-comps' ] ) ;
237
237
const [ lowcoderCompVersions , setLowcoderCompVersions ] = useState ( [ 'latest' ] ) ;
238
238
const {
239
- themeList,
240
- defaultTheme,
241
- themeId,
242
239
title,
243
240
description,
244
241
icon,
245
242
category,
246
243
showHeaderInPublic,
247
- preventAppStylesOverwriting,
248
244
lowcoderCompVersion,
249
245
} = props ;
250
-
251
- const THEME_OPTIONS = themeList ?. map ( ( theme ) => ( {
252
- label : theme . name ,
253
- value : theme . id + "" ,
254
- } ) ) ;
255
-
256
- const themeWithDefault = (
257
- themeId . getView ( ) === DEFAULT_THEMEID ||
258
- ( ! ! themeId . getView ( ) &&
259
- THEME_OPTIONS . findIndex ( ( item ) => item . value === themeId . getView ( ) ) === - 1 )
260
- ? DEFAULT_THEMEID
261
- : themeId . getView ( )
262
- ) as string ;
263
-
264
- useEffect ( ( ) => {
265
- if ( themeWithDefault === DEFAULT_THEMEID ) {
266
- themeId . dispatchChangeValueAction ( themeWithDefault ) ;
267
- }
268
- } , [ themeWithDefault ] ) ;
269
246
270
247
useEffect ( ( ) => {
271
248
setLowcoderCompVersions ( [
@@ -274,20 +251,6 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
274
251
] )
275
252
} , [ lowcoderCompsMeta ] )
276
253
277
-
278
- const DropdownItem = ( params : { value : string } ) => {
279
- const themeItem = themeList . find ( ( theme ) => theme . id === params . value ) ;
280
- return (
281
- < ItemSpan >
282
- < TagDesc $theme = { themeItem ?. theme } >
283
- < div className = "left" />
284
- < div className = "right" />
285
- </ TagDesc >
286
- < EllipsisSpan style = { { maxWidth : "238px" } } > { themeItem ?. name } </ EllipsisSpan >
287
- { themeItem ?. id === defaultTheme && < DefaultSpan > { trans ( "appSetting.default" ) } </ DefaultSpan > }
288
- </ ItemSpan >
289
- ) ;
290
- } ;
291
254
return (
292
255
< >
293
256
< BaseSection
@@ -322,40 +285,6 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
322
285
label : trans ( "appSetting.showPublicHeader" ) ,
323
286
} ) }
324
287
</ div >
325
- < Dropdown
326
- defaultValue = {
327
- themeWithDefault === ""
328
- ? undefined
329
- : themeWithDefault === DEFAULT_THEMEID
330
- ? defaultTheme || undefined
331
- : themeWithDefault
332
- }
333
- placeholder = { trans ( "appSetting.themeSettingDefault" ) }
334
- options = { THEME_OPTIONS }
335
- label = { trans ( "appSetting.themeSetting" ) }
336
- placement = "bottom"
337
- itemNode = { ( value ) => < DropdownItem value = { value } /> }
338
- preNode = { ( ) => (
339
- < >
340
- < CreateDiv onClick = { ( ) => window . open ( THEME_SETTING ) } >
341
- < StyledAddIcon />
342
- { trans ( "appSetting.themeCreate" ) }
343
- </ CreateDiv >
344
- < DividerStyled />
345
- </ >
346
- ) }
347
- allowClear
348
- onChange = { ( value ) => {
349
- themeId . dispatchChangeValueAction (
350
- value === defaultTheme ? DEFAULT_THEMEID : value || ""
351
- ) ;
352
- } }
353
- />
354
- < div style = { { margin : '20px 0' } } >
355
- { preventAppStylesOverwriting . propertyView ( {
356
- label : trans ( "prop.preventOverwriting" ) ,
357
- } ) }
358
- </ div >
359
288
</ DivStyled >
360
289
</ BaseSection >
361
290
< BaseSection
@@ -409,6 +338,10 @@ function AppGeneralSettingsModal(props: ChildrenInstance) {
409
338
410
339
function AppCanvasSettingsModal ( props : ChildrenInstance ) {
411
340
const {
341
+ themeList,
342
+ defaultTheme,
343
+ themeId,
344
+ preventAppStylesOverwriting,
412
345
maxWidth,
413
346
gridColumns,
414
347
gridRowHeight,
@@ -423,8 +356,87 @@ function AppCanvasSettingsModal(props: ChildrenInstance) {
423
356
gridBgImageOrigin,
424
357
} = props ;
425
358
359
+ const THEME_OPTIONS = themeList ?. map ( ( theme ) => ( {
360
+ label : theme . name ,
361
+ value : theme . id + "" ,
362
+ } ) ) ;
363
+
364
+ const themeWithDefault = (
365
+ themeId . getView ( ) === DEFAULT_THEMEID ||
366
+ ( ! ! themeId . getView ( ) &&
367
+ THEME_OPTIONS . findIndex ( ( item ) => item . value === themeId . getView ( ) ) === - 1 )
368
+ ? DEFAULT_THEMEID
369
+ : themeId . getView ( )
370
+ ) as string ;
371
+
372
+ useEffect ( ( ) => {
373
+ if ( themeWithDefault === DEFAULT_THEMEID ) {
374
+ themeId . dispatchChangeValueAction ( themeWithDefault ) ;
375
+ }
376
+ } , [ themeWithDefault ] ) ;
377
+
378
+ const DropdownItem = ( params : { value : string } ) => {
379
+ const themeItem = themeList . find ( ( theme ) => theme . id === params . value ) ;
380
+ return (
381
+ < ItemSpan >
382
+ < TagDesc $theme = { themeItem ?. theme } >
383
+ < div className = "left" />
384
+ < div className = "right" />
385
+ </ TagDesc >
386
+ < EllipsisSpan style = { { maxWidth : "238px" } } > { themeItem ?. name } </ EllipsisSpan >
387
+ { themeItem ?. id === defaultTheme && < DefaultSpan > { trans ( "appSetting.default" ) } </ DefaultSpan > }
388
+ </ ItemSpan >
389
+ ) ;
390
+ } ;
391
+
426
392
return (
427
393
< >
394
+ < BaseSection
395
+ name = { "Theme Settings" }
396
+ width = { 288 }
397
+ noMargin
398
+ style = { {
399
+ borderTop : "1px solid #e1e3eb" ,
400
+ backgroundColor : "#fff" ,
401
+ } }
402
+ >
403
+ < DivStyled >
404
+ < Dropdown
405
+ defaultValue = {
406
+ themeWithDefault === ""
407
+ ? undefined
408
+ : themeWithDefault === DEFAULT_THEMEID
409
+ ? defaultTheme || undefined
410
+ : themeWithDefault
411
+ }
412
+ placeholder = { trans ( "appSetting.themeSettingDefault" ) }
413
+ options = { THEME_OPTIONS }
414
+ label = { trans ( "appSetting.themeSetting" ) }
415
+ placement = "bottom"
416
+ itemNode = { ( value ) => < DropdownItem value = { value } /> }
417
+ preNode = { ( ) => (
418
+ < >
419
+ < CreateDiv onClick = { ( ) => window . open ( THEME_SETTING ) } >
420
+ < StyledAddIcon />
421
+ { trans ( "appSetting.themeCreate" ) }
422
+ </ CreateDiv >
423
+ < DividerStyled />
424
+ </ >
425
+ ) }
426
+ allowClear
427
+ onChange = { ( value ) => {
428
+ themeId . dispatchChangeValueAction (
429
+ value === defaultTheme ? DEFAULT_THEMEID : value || ""
430
+ ) ;
431
+ } }
432
+ />
433
+ < div style = { { margin : '20px 0' } } >
434
+ { preventAppStylesOverwriting . propertyView ( {
435
+ label : trans ( "prop.preventOverwriting" ) ,
436
+ } ) }
437
+ </ div >
438
+ </ DivStyled >
439
+ </ BaseSection >
428
440
< BaseSection
429
441
name = { trans ( "appSetting.canvas" ) }
430
442
width = { 288 }
0 commit comments