1
- import { NameConfig , NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
1
+ import { NameConfig , NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
2
2
import { UICompBuilder , withDefault } from "comps/generators" ;
3
3
import { Section , sectionNames } from "lowcoder-design" ;
4
4
import styled from "styled-components" ;
5
- import { clickEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
5
+ import { clickEvent , eventHandlerControl } from "comps/controls/eventHandlerControl" ;
6
6
import { StringControl } from "comps/controls/codeControl" ;
7
7
import { alignWithJustifyControl } from "comps/controls/alignControl" ;
8
8
import { navListComp } from "./navItemComp" ;
@@ -37,15 +37,13 @@ const Wrapper = styled("div")<
37
37
> `
38
38
${ props => props . $animationStyle }
39
39
height: 100%;
40
- border-radius: ${ ( props ) =>
41
- props . $borderRadius ? props . $borderRadius : "2px" } ;
40
+ border-radius: ${ ( props ) => props . $borderRadius ? props . $borderRadius : '2px' } ;
42
41
box-sizing: border-box;
43
- border: ${ ( props ) => ( props . $borderWidth ? `${ props . $borderWidth } ` : "1px" ) }
44
- solid ${ ( props ) => props . $borderColor } ;
42
+ border: ${ ( props ) => props . $borderWidth ? `${ props . $borderWidth } ` : '1px' } solid ${ ( props ) => props . $borderColor } ;
45
43
background-color: ${ ( props ) => props . $bgColor } ;
46
44
` ;
47
45
48
- const NavInner = styled ( "div" ) < Pick < IProps , "$justify" > > `
46
+ const NavInner = styled ( "div" ) < Pick < IProps , "$justify" > > `
49
47
// margin: 0 -16px;
50
48
height: 100%;
51
49
display: flex;
@@ -62,23 +60,20 @@ const Item = styled.div<{
62
60
$textSize : string ;
63
61
$margin : string ;
64
62
$padding : string ;
65
- $textTransform : string ;
66
- $textDecoration : string ;
63
+ $textTransform :string ;
64
+ $textDecoration :string ;
67
65
} > `
68
66
height: 30px;
69
67
line-height: 30px;
70
- padding: ${ ( props ) => ( props . $padding ? props . $padding : " 0 16px" ) } ;
68
+ padding: ${ ( props ) => props . $padding ? props . $padding : ' 0 16px' } ;
71
69
color: ${ ( props ) => ( props . $active ? props . $activeColor : props . $color ) } ;
72
70
font-weight: ${ ( props ) => ( props . $textWeight ? props . $textWeight : 500 ) } ;
73
- font-family: ${ ( props ) =>
74
- props . $fontFamily ? props . $fontFamily : "sans-serif" } ;
75
- font-style: ${ ( props ) => ( props . $fontStyle ? props . $fontStyle : "normal" ) } ;
76
- font-size: ${ ( props ) => ( props . $textSize ? props . $textSize : "14px" ) } ;
77
- text-transform: ${ ( props ) =>
78
- props . $textTransform ? props . $textTransform : "" } ;
79
- text-decoration: ${ ( props ) =>
80
- props . $textDecoration ? props . $textDecoration : "" } ;
81
- margin: ${ ( props ) => ( props . $margin ? props . $margin : "0px" ) } ;
71
+ font-family:${ ( props ) => ( props . $fontFamily ? props . $fontFamily : 'sans-serif' ) } ;
72
+ font-style:${ ( props ) => ( props . $fontStyle ? props . $fontStyle : 'normal' ) } ;
73
+ font-size:${ ( props ) => ( props . $textSize ? props . $textSize : '14px' ) } ;
74
+ text-transform:${ ( props ) => ( props . $textTransform ? props . $textTransform : '' ) } ;
75
+ text-decoration:${ ( props ) => ( props . $textDecoration ? props . $textDecoration : '' ) } ;
76
+ margin:${ ( props ) => props . $margin ? props . $margin : '0px' } ;
82
77
83
78
&:hover {
84
79
color: ${ ( props ) => props . $activeColor } ;
@@ -101,14 +96,14 @@ const LogoWrapper = styled.div`
101
96
}
102
97
` ;
103
98
104
- const ItemList = styled . div < { $align : string } > `
99
+ const ItemList = styled . div < { $align : string } > `
105
100
flex: 1;
106
101
display: flex;
107
102
flex-direction: row;
108
103
justify-content: ${ ( props ) => props . $align } ;
109
104
` ;
110
105
111
- const StyledMenu = styled ( Menu ) < MenuProps > `
106
+ const StyledMenu = styled ( Menu ) < MenuProps > `
112
107
&.ant-dropdown-menu {
113
108
min-width: 160px;
114
109
}
@@ -137,9 +132,7 @@ function fixOldStyleData(oldData: any) {
137
132
138
133
const childrenMap = {
139
134
logoUrl : StringControl ,
140
- logoEvent : withDefault ( eventHandlerControl ( logoEventHandlers ) , [
141
- { name : "click" } ,
142
- ] ) ,
135
+ logoEvent : withDefault ( eventHandlerControl ( logoEventHandlers ) , [ { name : "click" } ] ) ,
143
136
horizontalAlignment : alignWithJustifyControl ( ) ,
144
137
style : migrateOldData ( styleControl ( NavigationStyle ) , fixOldStyleData ) ,
145
138
animationStyle : styleControl ( AnimationStyle ) ,
@@ -155,14 +148,12 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
155
148
const items = (
156
149
< >
157
150
{ data . map ( ( menuItem , idx ) => {
158
- const { hidden, label, items, active, onEvent} = menuItem . getView ( ) ;
151
+ const { hidden, label, items, active, onEvent } = menuItem . getView ( ) ;
159
152
if ( hidden ) {
160
153
return null ;
161
154
}
162
- const visibleSubItems = items . filter (
163
- ( item ) => ! item . children . hidden . getView ( )
164
- ) ;
165
- const subMenuItems : Array < { key : string ; label : string } > = [ ] ;
155
+ const visibleSubItems = items . filter ( ( item ) => ! item . children . hidden . getView ( ) ) ;
156
+ const subMenuItems : Array < { key : string ; label : string } > = [ ] ;
166
157
const subMenuSelectedKeys : Array < string > = [ ] ;
167
158
visibleSubItems . forEach ( ( subItem , index ) => {
168
159
const key = index + "" ;
@@ -196,15 +187,18 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
196
187
const subMenu = (
197
188
< StyledMenu
198
189
onClick = { ( e ) => {
199
- const { onEvent : onSubEvent } = items [ Number ( e . key ) ] ?. getView ( ) ;
190
+ const { onEvent : onSubEvent } = items [ Number ( e . key ) ] ?. getView ( ) ;
200
191
onSubEvent ( "click" ) ;
201
192
} }
202
193
selectedKeys = { subMenuSelectedKeys }
203
194
items = { subMenuItems }
204
195
/>
205
196
) ;
206
197
return (
207
- < Dropdown key = { idx } dropdownRender = { ( ) => subMenu } >
198
+ < Dropdown
199
+ key = { idx }
200
+ dropdownRender = { ( ) => subMenu }
201
+ >
208
202
{ item }
209
203
</ Dropdown >
210
204
) ;
@@ -230,11 +224,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
230
224
< img src = { props . logoUrl } alt = "LOGO" />
231
225
</ LogoWrapper >
232
226
) }
233
- { ! justify ? (
234
- < ItemList $align = { props . horizontalAlignment } > { items } </ ItemList >
235
- ) : (
236
- items
237
- ) }
227
+ { ! justify ? < ItemList $align = { props . horizontalAlignment } > { items } </ ItemList > : items }
238
228
</ NavInner >
239
229
</ Wrapper >
240
230
) ;
@@ -246,8 +236,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
246
236
{ menuPropertyView ( children . items ) }
247
237
</ Section >
248
238
249
- { ( useContext ( EditorContext ) . editorModeStatus === "logic" ||
250
- useContext ( EditorContext ) . editorModeStatus === "both" ) && (
239
+ { ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
251
240
< Section name = { sectionNames . interaction } >
252
241
{ hiddenPropertyView ( children ) }
253
242
</ Section >
@@ -264,15 +253,11 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
264
253
</ Section >
265
254
) }
266
255
267
- { ( useContext ( EditorContext ) . editorModeStatus === "logic" ||
268
- useContext ( EditorContext ) . editorModeStatus === "both" ) && (
256
+
257
+ { ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
269
258
< Section name = { sectionNames . advanced } >
270
- { children . logoUrl . propertyView ( {
271
- label : trans ( "navigation.logoURL" ) ,
272
- tooltip : trans ( "navigation.logoURLDesc" ) ,
273
- } ) }
274
- { children . logoUrl . getView ( ) &&
275
- children . logoEvent . propertyView ( { inline : true } ) }
259
+ { children . logoUrl . propertyView ( { label : trans ( "navigation.logoURL" ) , tooltip : trans ( "navigation.logoURLDesc" ) } ) }
260
+ { children . logoUrl . getView ( ) && children . logoEvent . propertyView ( { inline : true } ) }
276
261
</ Section >
277
262
) }
278
263
0 commit comments