@@ -40,6 +40,7 @@ import { ControlItemCompBuilder } from "comps/generators/controlCompBuilder";
4040import { ColorControl } from "./colorControl" ;
4141import { StringStateControl } from "./codeStateControl" ;
4242import { reduceInContext } from "../utils/reduceContext" ;
43+ import React from "react" ;
4344
4445const OptionTypes = [
4546 {
@@ -65,10 +66,13 @@ type OptionControlParam = {
6566 title ?: string ;
6667 // The new option's label name
6768 newOptionLabel ?: string ;
69+ // Whether to use flex layout (for column options)
70+ useFlexLayout ?: boolean ;
6871} ;
6972
7073type OptionPropertyParam = {
7174 autoMap ?: boolean ;
75+ useFlexLayout ?: boolean ;
7276} ;
7377
7478interface OptionCompProperty {
@@ -176,7 +180,7 @@ export function manualOptionsControl<T extends OptionsControlType>(
176180 itemTitle = { ( comp ) => comp . children . label . getView ( ) }
177181 popoverTitle = { ( ) => trans ( "edit" ) }
178182 content = { ( comp ) => {
179- return hasPropertyView ( comp ) ? comp . propertyView ( { } ) : comp . getPropertyView ( ) ;
183+ return hasPropertyView ( comp ) ? comp . propertyView ( { useFlexLayout : param . useFlexLayout } ) : comp . getPropertyView ( ) ;
180184 } }
181185 items = { manualComp . getView ( ) }
182186 onAdd = { ( ) => {
@@ -576,7 +580,7 @@ const StyledContent = styled.div`
576580 }
577581` ;
578582
579- const ColumnOption = new MultiCompBuilder (
583+ let ColumnOption = new MultiCompBuilder (
580584 {
581585 id : valueComp < number > ( - 1 ) ,
582586 label : StringControl ,
@@ -591,48 +595,55 @@ const ColumnOption = new MultiCompBuilder(
591595 padding : withDefault ( StringControl , "" ) ,
592596 } ,
593597 ( props ) => props
594- )
595- . setPropertyViewFn ( ( children ) => (
596- < StyledContent >
597- { children . minWidth . propertyView ( {
598- label : trans ( 'responsiveLayout.minWidth' ) ,
599- preInputNode : < StyledIcon as = { WidthIcon } title = "" /> ,
600- placeholder : '3px' ,
601- } ) }
602- { children . width . propertyView ( {
603- label : trans ( 'responsiveLayout.width' ) ,
604- preInputNode : < StyledIcon as = { WidthIcon } title = "" /> ,
605- placeholder : '50%' ,
606- } ) }
607- { children . background . propertyView ( {
608- label : trans ( 'style.background' ) ,
609- } ) }
610- { children . backgroundImage . propertyView ( {
611- label : `Background Image` ,
612- // preInputNode: <StyledIcon as={ImageCompIcon} title="" />,
613- placeholder : 'https://temp.im/350x400' ,
614- } ) }
615- { children . border . propertyView ( {
616- label : trans ( 'style.border' )
617- } ) }
618- { children . radius . propertyView ( {
619- label : trans ( 'style.borderRadius' ) ,
620- preInputNode : < StyledIcon as = { IconRadius } title = "" /> ,
621- placeholder : '3px' ,
622- } ) }
623- { children . margin . propertyView ( {
624- label : trans ( 'style.margin' ) ,
625- preInputNode : < StyledIcon as = { ExpandIcon } title = "" /> ,
626- placeholder : '3px' ,
627- } ) }
628- { children . padding . propertyView ( {
629- label : trans ( 'style.padding' ) ,
630- preInputNode : < StyledIcon as = { CompressIcon } title = "" /> ,
631- placeholder : '3px' ,
632- } ) }
633- </ StyledContent >
634- ) )
635- . build ( ) ;
598+ ) . build ( ) ;
599+
600+ // Add propertyView method through class extension
601+ ColumnOption = class extends ColumnOption implements OptionCompProperty {
602+ propertyView ( param : OptionPropertyParam ) {
603+ const useFlexLayout = param ?. useFlexLayout !== undefined ? param . useFlexLayout : true ;
604+
605+ return (
606+ < StyledContent >
607+ { useFlexLayout && this . children . minWidth . propertyView ( {
608+ label : trans ( 'responsiveLayout.minWidth' ) ,
609+ preInputNode : < StyledIcon as = { WidthIcon } title = "" /> ,
610+ placeholder : '3px' ,
611+ } ) }
612+ { useFlexLayout && this . children . width . propertyView ( {
613+ label : trans ( 'responsiveLayout.width' ) ,
614+ preInputNode : < StyledIcon as = { WidthIcon } title = "" /> ,
615+ placeholder : '50%' ,
616+ } ) }
617+ { this . children . background . propertyView ( {
618+ label : trans ( 'style.background' ) ,
619+ } ) }
620+ { this . children . backgroundImage . propertyView ( {
621+ label : `Background Image` ,
622+ // preInputNode: <StyledIcon as={ImageCompIcon} title="" />,
623+ placeholder : 'https://temp.im/350x400' ,
624+ } ) }
625+ { this . children . border . propertyView ( {
626+ label : trans ( 'style.border' )
627+ } ) }
628+ { this . children . radius . propertyView ( {
629+ label : trans ( 'style.borderRadius' ) ,
630+ preInputNode : < StyledIcon as = { IconRadius } title = "" /> ,
631+ placeholder : '3px' ,
632+ } ) }
633+ { this . children . margin . propertyView ( {
634+ label : trans ( 'style.margin' ) ,
635+ preInputNode : < StyledIcon as = { ExpandIcon } title = "" /> ,
636+ placeholder : '3px' ,
637+ } ) }
638+ { this . children . padding . propertyView ( {
639+ label : trans ( 'style.padding' ) ,
640+ preInputNode : < StyledIcon as = { CompressIcon } title = "" /> ,
641+ placeholder : '3px' ,
642+ } ) }
643+ </ StyledContent >
644+ ) ;
645+ }
646+ } ;
636647
637648export const ColumnOptionControl = manualOptionsControl ( ColumnOption , {
638649 initOptions : [
0 commit comments