@@ -8,16 +8,21 @@ import { trans } from "i18n";
8
8
import _ from "lodash" ;
9
9
import {
10
10
controlItem ,
11
- IconRadius ,
12
11
IconReset ,
13
12
ExpandIcon ,
14
13
CompressIcon ,
15
14
TextSizeIcon ,
15
+ TextTransformationIcon ,
16
16
FontFamilyIcon ,
17
17
TextWeightIcon ,
18
18
ShowBorderIcon ,
19
19
BorderWidthIcon ,
20
20
ImageCompIconSmall ,
21
+ RotationIcon ,
22
+ TextDecorationIcon ,
23
+ BorderStyleIcon ,
24
+ BorderRadiusIcon ,
25
+ TextStyleIcon ,
21
26
} from "lowcoder-design" ;
22
27
import { useContext } from "react" ;
23
28
import styled from "styled-components" ;
@@ -38,6 +43,7 @@ import {
38
43
FontFamilyConfig ,
39
44
FontStyleConfig ,
40
45
BorderWidthConfig ,
46
+ RotationConfig ,
41
47
BackgroundImageConfig ,
42
48
BackgroundImageRepeatConfig ,
43
49
BackgroundImageSizeConfig ,
@@ -78,6 +84,10 @@ function isBorderWidthConfig(config: SingleColorConfig): config is BorderWidthCo
78
84
return config . hasOwnProperty ( "borderWidth" ) ;
79
85
}
80
86
87
+ function isRotationConfig ( config : SingleColorConfig ) : config is RotationConfig {
88
+ return config . hasOwnProperty ( "rotation" ) ;
89
+ }
90
+
81
91
function isBackgroundImageConfig ( config : SingleColorConfig ) : config is BackgroundImageConfig {
82
92
return config . hasOwnProperty ( "backgroundImage" ) ;
83
93
}
@@ -176,6 +186,9 @@ function isEmptyRadius(radius: string) {
176
186
function isEmptyBorderWidth ( borderWidth : string ) {
177
187
return _ . isEmpty ( borderWidth ) ;
178
188
}
189
+ function isEmptyRotation ( rotation : string ) {
190
+ return _ . isEmpty ( rotation ) ;
191
+ }
179
192
function isEmptyBackgroundImageConfig ( backgroundImage : string ) {
180
193
return _ . isEmpty ( backgroundImage ) ;
181
194
}
@@ -273,6 +286,11 @@ function calcColors<ColorMap extends Record<string, string>>(
273
286
res [ name ] = props [ name ] ;
274
287
return ;
275
288
}
289
+ if ( ! isEmptyRotation ( props [ name ] ) && isRotationConfig ( config ) ) {
290
+ res [ name ] = props [ name ] ;
291
+ return ;
292
+ }
293
+
276
294
if ( ! isEmptyBackgroundImageConfig ( props [ name ] ) && isBackgroundImageConfig ( config ) ) {
277
295
res [ name ] = props [ name ] ;
278
296
return ;
@@ -386,6 +404,9 @@ function calcColors<ColorMap extends Record<string, string>>(
386
404
if ( isBorderWidthConfig ( config ) ) {
387
405
res [ name ] = '0px' ;
388
406
}
407
+ if ( isRotationConfig ( config ) ) {
408
+ res [ name ] = '0deg' ;
409
+ }
389
410
if ( isBackgroundImageConfig ( config ) ) {
390
411
res [ name ] = '' ;
391
412
}
@@ -563,14 +584,22 @@ const StyleContent = styled.div`
563
584
}
564
585
` ;
565
586
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
+
574
603
575
604
const ResetIcon = styled ( IconReset ) `
576
605
&:hover g g {
@@ -586,6 +615,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
586
615
if (
587
616
name === "radius" ||
588
617
name === "borderWidth" ||
618
+ name === "rotation" ||
589
619
name === "cardRadius" ||
590
620
name === "textSize" ||
591
621
name === "textWeight" ||
@@ -663,6 +693,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
663
693
name === "containerFooterPadding" ||
664
694
name === "containerBodyPadding" ||
665
695
name === "borderWidth" ||
696
+ name === "rotation" ||
666
697
name === "backgroundImage" ||
667
698
name === "backgroundImageRepeat" ||
668
699
name === "backgroundImageSize" ||
@@ -723,22 +754,22 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
723
754
children [ name ] as InstanceType < typeof StringControl >
724
755
) . propertyView ( {
725
756
label : config . label ,
726
- preInputNode : < RadiusIcon title = "Radius" /> ,
757
+ preInputNode : < RadiusPropIcon title = "Radius" /> ,
727
758
placeholder : props [ name ] ,
728
759
} )
729
760
: name === "borderWidth"
730
761
? (
731
762
children [ name ] as InstanceType < typeof StringControl >
732
763
) . propertyView ( {
733
764
label : config . label ,
734
- preInputNode : < BorderIcon title = "Border-Width" /> ,
765
+ preInputNode : < BorderPropIcon title = "Border-Width" /> ,
735
766
placeholder : props [ name ] ,
736
767
} ) : name === "borderStyle"
737
768
? (
738
769
children [ name ] as InstanceType < typeof StringControl >
739
770
) . propertyView ( {
740
771
label : config . label ,
741
- preInputNode : < BorderIcon title = "Border-Style" /> ,
772
+ preInputNode : < BorderStylePropIcon title = "Border-Style" /> ,
742
773
placeholder : props [ name ] ,
743
774
} )
744
775
: name === "margin"
@@ -749,8 +780,7 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
749
780
preInputNode : < MarginIcon title = "Margin" /> ,
750
781
placeholder : props [ name ] ,
751
782
} )
752
- : name === "textSize" ||
753
- name === "padding" ||
783
+ : name === "padding" ||
754
784
name === "containerHeaderPadding" ||
755
785
name === "containerSiderPadding" ||
756
786
name === "containerFooterPadding" ||
@@ -790,22 +820,22 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
790
820
children [ name ] as InstanceType < typeof StringControl >
791
821
) . propertyView ( {
792
822
label : config . label ,
793
- preInputNode : < StyledFontFamilyIcon title = "Text Decoration" /> ,
823
+ preInputNode : < StyledTextDecorationPropIcon title = "Text Decoration" /> ,
794
824
placeholder : props [ name ] ,
795
825
} ) : name === "textTransform"
796
826
? (
797
827
children [ name ] as InstanceType < typeof StringControl >
798
828
) . propertyView ( {
799
829
label : config . label ,
800
- preInputNode : < StyledFontFamilyIcon title = "Text Transform" /> ,
830
+ preInputNode : < StyledTextTransformIcon title = "Text Transform" /> ,
801
831
placeholder : props [ name ] ,
802
832
} )
803
833
: name === "fontStyle"
804
834
? (
805
835
children [ name ] as InstanceType < typeof StringControl >
806
836
) . propertyView ( {
807
837
label : config . label ,
808
- preInputNode : < StyledFontFamilyIcon title = "Font Style" /> ,
838
+ preInputNode : < StyledTextStyleIcon title = "Font Style" /> ,
809
839
placeholder : props [ name ] ,
810
840
} )
811
841
: name === "backgroundImage" || name === "headerBackgroundImage" || name === "footerBackgroundImage"
@@ -824,13 +854,21 @@ export function styleControl<T extends readonly SingleColorConfig[]>(colorConfig
824
854
preInputNode : < StyledBackgroundImageIcon title = "Background Image Repeat" /> ,
825
855
placeholder : props [ name ] ,
826
856
} )
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
+ } )
834
872
835
873
}
836
874
</ div >
0 commit comments