@@ -8,16 +8,21 @@ import { trans } from "i18n";
88import _ from "lodash" ;
99import {
1010 controlItem ,
11- IconRadius ,
1211 IconReset ,
1312 ExpandIcon ,
1413 CompressIcon ,
1514 TextSizeIcon ,
15+ TextTransformationIcon ,
1616 FontFamilyIcon ,
1717 TextWeightIcon ,
1818 ShowBorderIcon ,
1919 BorderWidthIcon ,
2020 ImageCompIconSmall ,
21+ RotationIcon ,
22+ TextDecorationIcon ,
23+ BorderStyleIcon ,
24+ BorderRadiusIcon ,
25+ TextStyleIcon ,
2126} from "lowcoder-design" ;
2227import { useContext } from "react" ;
2328import styled from "styled-components" ;
@@ -38,6 +43,7 @@ import {
3843 FontFamilyConfig ,
3944 FontStyleConfig ,
4045 BorderWidthConfig ,
46+ RotationConfig ,
4147 BackgroundImageConfig ,
4248 BackgroundImageRepeatConfig ,
4349 BackgroundImageSizeConfig ,
@@ -78,6 +84,10 @@ function isBorderWidthConfig(config: SingleColorConfig): config is BorderWidthCo
7884 return config . hasOwnProperty ( "borderWidth" ) ;
7985}
8086
87+ function isRotationConfig ( config : SingleColorConfig ) : config is RotationConfig {
88+ return config . hasOwnProperty ( "rotation" ) ;
89+ }
90+
8191function isBackgroundImageConfig ( config : SingleColorConfig ) : config is BackgroundImageConfig {
8292 return config . hasOwnProperty ( "backgroundImage" ) ;
8393}
@@ -176,6 +186,9 @@ function isEmptyRadius(radius: string) {
176186function isEmptyBorderWidth ( borderWidth : string ) {
177187 return _ . isEmpty ( borderWidth ) ;
178188}
189+ function isEmptyRotation ( rotation : string ) {
190+ return _ . isEmpty ( rotation ) ;
191+ }
179192function isEmptyBackgroundImageConfig ( backgroundImage : string ) {
180193 return _ . isEmpty ( backgroundImage ) ;
181194}
@@ -273,6 +286,11 @@ function calcColors<ColorMap extends Record<string, string>>(
273286 res [ name ] = props [ name ] ;
274287 return ;
275288 }
289+ if ( ! isEmptyRotation ( props [ name ] ) && isRotationConfig ( config ) ) {
290+ res [ name ] = props [ name ] ;
291+ return ;
292+ }
293+
276294 if ( ! isEmptyBackgroundImageConfig ( props [ name ] ) && isBackgroundImageConfig ( config ) ) {
277295 res [ name ] = props [ name ] ;
278296 return ;
@@ -386,6 +404,9 @@ function calcColors<ColorMap extends Record<string, string>>(
386404 if ( isBorderWidthConfig ( config ) ) {
387405 res [ name ] = '0px' ;
388406 }
407+ if ( isRotationConfig ( config ) ) {
408+ res [ name ] = '0deg' ;
409+ }
389410 if ( isBackgroundImageConfig ( config ) ) {
390411 res [ name ] = '' ;
391412 }
@@ -563,14 +584,22 @@ const StyleContent = styled.div`
563584 }
564585` ;
565586
566- const RadiusIcon = styled ( IconRadius ) ` margin: 0 8px 0 -2px;` ;
567- const BorderIcon = styled ( BorderWidthIcon ) ` margin: 0 8px 0 -3px; padding: 3px;` ;
568- const MarginIcon = styled ( ExpandIcon ) ` margin: 0 8px 0 2px;` ;
569- const PaddingIcon = styled ( CompressIcon ) ` margin: 0 8px 0 2px;` ;
570- const StyledTextSizeIcon = styled ( TextSizeIcon ) ` margin: 0 8px 0 -3px; padding: 3px;` ;
571- const StyledFontFamilyIcon = styled ( FontFamilyIcon ) ` margin: 0 8px 0 -3px; padding: 3px;` ;
572- const StyledTextWeightIcon = styled ( TextWeightIcon ) ` margin: 0 8px 0 -3px; padding: 3px;` ;
573- const StyledBackgroundImageIcon = styled ( ImageCompIconSmall ) ` margin: 0 0px 0 -12px;` ;
587+ const MarginIcon = styled ( ExpandIcon ) ` margin: 0 8px 0 2px; color: #888` ;
588+ const PaddingIcon = styled ( CompressIcon ) ` margin: 0 8px 0 2px; color: #888` ;
589+ const RadiusPropIcon = styled ( BorderRadiusIcon ) ` width: 24px; margin: 0 11px 0 0px; color: #888` ;
590+ const BorderPropIcon = styled ( BorderWidthIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
591+ const BorderStylePropIcon = styled ( BorderStyleIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
592+
593+ const StyledBackgroundImageIcon = styled ( ImageCompIconSmall ) ` margin: 0 6px 0 0; padding: 2px; color: #888` ;
594+ const RotationPropIcon = styled ( RotationIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
595+
596+ const StyledTextSizeIcon = styled ( TextSizeIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
597+ const StyledTextTransformIcon = styled ( TextTransformationIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
598+ const StyledFontFamilyIcon = styled ( FontFamilyIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
599+ const StyledTextWeightIcon = styled ( TextWeightIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
600+ const StyledTextStyleIcon = styled ( TextStyleIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
601+ const StyledTextDecorationPropIcon = styled ( TextDecorationIcon ) ` margin: 0 8px 0 -3px; padding: 3px; color: #888` ;
602+
574603
575604const ResetIcon = styled ( IconReset ) `
576605 &:hover g g {
@@ -586,6 +615,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
586615 if (
587616 name === "radius" ||
588617 name === "borderWidth" ||
618+ name === "rotation" ||
589619 name === "cardRadius" ||
590620 name === "textSize" ||
591621 name === "textWeight" ||
@@ -663,6 +693,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
663693 name === "containerFooterPadding" ||
664694 name === "containerBodyPadding" ||
665695 name === "borderWidth" ||
696+ name === "rotation" ||
666697 name === "backgroundImage" ||
667698 name === "backgroundImageRepeat" ||
668699 name === "backgroundImageSize" ||
@@ -723,22 +754,22 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
723754 children [ name ] as InstanceType < typeof StringControl >
724755 ) . propertyView ( {
725756 label : config . label ,
726- preInputNode : < RadiusIcon title = "Radius" /> ,
757+ preInputNode : < RadiusPropIcon title = "Radius" /> ,
727758 placeholder : props [ name ] ,
728759 } )
729760 : name === "borderWidth"
730761 ? (
731762 children [ name ] as InstanceType < typeof StringControl >
732763 ) . propertyView ( {
733764 label : config . label ,
734- preInputNode : < BorderIcon title = "Border-Width" /> ,
765+ preInputNode : < BorderPropIcon title = "Border-Width" /> ,
735766 placeholder : props [ name ] ,
736767 } ) : name === "borderStyle"
737768 ? (
738769 children [ name ] as InstanceType < typeof StringControl >
739770 ) . propertyView ( {
740771 label : config . label ,
741- preInputNode : < BorderIcon title = "Border-Style" /> ,
772+ preInputNode : < BorderStylePropIcon title = "Border-Style" /> ,
742773 placeholder : props [ name ] ,
743774 } )
744775 : name === "margin"
@@ -749,8 +780,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
749780 preInputNode : < MarginIcon title = "Margin" /> ,
750781 placeholder : props [ name ] ,
751782 } )
752- : name === "textSize" ||
753- name === "padding" ||
783+ : name === "padding" ||
754784 name === "containerHeaderPadding" ||
755785 name === "containerSiderPadding" ||
756786 name === "containerFooterPadding" ||
@@ -790,22 +820,22 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
790820 children [ name ] as InstanceType < typeof StringControl >
791821 ) . propertyView ( {
792822 label : config . label ,
793- preInputNode : < StyledFontFamilyIcon title = "Text Decoration" /> ,
823+ preInputNode : < StyledTextDecorationPropIcon title = "Text Decoration" /> ,
794824 placeholder : props [ name ] ,
795825 } ) : name === "textTransform"
796826 ? (
797827 children [ name ] as InstanceType < typeof StringControl >
798828 ) . propertyView ( {
799829 label : config . label ,
800- preInputNode : < StyledFontFamilyIcon title = "Text Transform" /> ,
830+ preInputNode : < StyledTextTransformIcon title = "Text Transform" /> ,
801831 placeholder : props [ name ] ,
802832 } )
803833 : name === "fontStyle"
804834 ? (
805835 children [ name ] as InstanceType < typeof StringControl >
806836 ) . propertyView ( {
807837 label : config . label ,
808- preInputNode : < StyledFontFamilyIcon title = "Font Style" /> ,
838+ preInputNode : < StyledTextStyleIcon title = "Font Style" /> ,
809839 placeholder : props [ name ] ,
810840 } )
811841 : name === "backgroundImage" || name === "headerBackgroundImage" || name === "footerBackgroundImage"
@@ -824,13 +854,21 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
824854 preInputNode : < StyledBackgroundImageIcon title = "Background Image Repeat" /> ,
825855 placeholder : props [ name ] ,
826856 } )
827- : children [ name ] . propertyView ( {
828- label : config . label ,
829- panelDefaultColor : props [ name ] ,
830- // isDep: isDepColorConfig(config),
831- isDep : true ,
832- depMsg : depMsg ,
833- } )
857+ : name === "rotation"
858+ ? (
859+ children [ name ] as InstanceType < typeof StringControl >
860+ ) . propertyView ( {
861+ label : config . label ,
862+ preInputNode : < RotationPropIcon title = "Rotation" /> ,
863+ placeholder : props [ name ] ,
864+ } )
865+ : children [ name ] . propertyView ( {
866+ label : config . label ,
867+ panelDefaultColor : props [ name ] ,
868+ // isDep: isDepColorConfig(config),
869+ isDep : true ,
870+ depMsg : depMsg ,
871+ } )
834872
835873 }
836874 </ div >
0 commit comments