@@ -22,14 +22,13 @@ import { useMergeCompStyles } from "@lowcoder-ee/index.sdk";
22
22
type IProps = DividerProps & {
23
23
$style : DividerStyleType ;
24
24
$animationStyle :AnimationStyleType ;
25
+ type ?: 'vertical' | 'horizontal' ;
25
26
} ;
26
27
27
- // TODO: enable type "vertical" https://ant.design/components/divider
28
-
29
28
const StyledDivider = styled ( Divider ) < IProps > `
29
+
30
30
margin-top: 3.5px;
31
- rotate: ${ ( props ) => props . $style . rotation } ;
32
-
31
+ rotate: ${ ( props ) => props . type === 'vertical' ? '0deg' : props . $style . rotation } ;
33
32
.ant-divider-inner-text {
34
33
height: 32px;
35
34
display: flex;
@@ -76,14 +75,22 @@ const StyledDivider = styled(Divider)<IProps>`
76
75
${ ( props ) => props . $style . borderStyle }
77
76
${ ( props ) => props . $style . border } ;
78
77
}
78
+ &.ant-divider-vertical {
79
+ height: ${ ( props ) => props . type === 'vertical' && '200px' } ;
80
+ border-left: ${ ( props ) => props . $style . borderWidth && props . $style . borderWidth !== "0px" ? props . $style . borderWidth : "1px" }
81
+ ${ ( props ) => props . $style . borderStyle }
82
+ ${ ( props ) => props . $style . border } ;
83
+ border-top: none;
84
+ }
79
85
` ;
80
86
81
87
const childrenMap = {
82
88
title : StringControl ,
83
89
align : alignControl ( ) ,
84
- autoHeight : withDefault ( AutoHeightControl , "fixed" ) ,
90
+ type : BoolControl ,
91
+ autoHeight : withDefault ( AutoHeightControl , "auto" ) ,
85
92
style : styleControl ( DividerStyle , 'style' ) ,
86
- animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
93
+ animationStyle : styleControl ( AnimationStyle , 'animationStyle' ) ,
87
94
} ;
88
95
89
96
function fixOldStyleData ( oldData : any ) {
@@ -102,27 +109,30 @@ function fixOldStyleData(oldData: any) {
102
109
103
110
104
111
// Compatible with historical style data 2022-8-26
105
- export const DividerComp = migrateOldData (
112
+ const DividerTempComp = migrateOldData (
106
113
new UICompBuilder ( childrenMap , ( props , dispatch ) => {
107
114
useMergeCompStyles ( props as Record < string , any > , dispatch ) ;
115
+ const dividerType = props . type ? 'vertical' : 'horizontal' ;
108
116
109
117
return (
110
118
< StyledDivider
111
119
orientation = { props . align }
120
+ type = { dividerType }
112
121
$style = { props . style }
113
122
$animationStyle = { props . animationStyle }
114
123
>
115
- { props . title }
124
+ { dividerType === 'horizontal' && props . title }
116
125
</ StyledDivider >
117
126
) ;
118
127
} )
119
128
. setPropertyViewFn ( ( children ) => {
120
129
return (
121
130
< >
122
- < Section name = { sectionNames . basic } >
123
- { children . title . propertyView ( { label : trans ( "divider.title" ) } ) }
124
- </ Section >
125
-
131
+ { ! children ?. type ?. getView ( ) &&
132
+ < Section name = { sectionNames . basic } >
133
+ { children . title . propertyView ( { label : trans ( "divider.title" ) } ) }
134
+ </ Section > }
135
+
126
136
{ [ "logic" , "both" ] . includes ( useContext ( EditorContext ) . editorModeStatus ) && (
127
137
< Section name = { sectionNames . interaction } >
128
138
{ hiddenPropertyView ( children ) }
@@ -137,9 +147,10 @@ export const DividerComp = migrateOldData(
137
147
label : trans ( "divider.align" ) ,
138
148
radioButton : true ,
139
149
} ) }
140
- { /* { children.autoHeight.getPropertyView()} */ }
150
+ { children . autoHeight . getPropertyView ( ) }
141
151
</ Section >
142
152
< Section name = { sectionNames . style } >
153
+ { children . type . propertyView ( { label : trans ( "divider.type" ) } ) }
143
154
{ children . style . getPropertyView ( ) }
144
155
</ Section >
145
156
< Section name = { sectionNames . animationStyle } hasTooltip = { true } >
@@ -159,9 +170,8 @@ export const DividerComp = migrateOldData(
159
170
fixOldStyleData
160
171
) ;
161
172
162
- // export const DividerComp
163
- // = class extends DividerTempComp {
164
- // override autoHeight(): boolean {
165
- // return this.children.autoHeight.getView();
166
- // }
167
- // };
173
+ export const DividerComp = class extends DividerTempComp {
174
+ override autoHeight ( ) : boolean {
175
+ return this . children . autoHeight . getView ( ) ;
176
+ }
177
+ } ;
0 commit comments