1
- import { NameConfig , NameConfigHidden , withExposingConfigs } from ' comps/generators/withExposing' ;
2
- import { UICompBuilder , withDefault } from ' comps/generators' ;
3
- import { Section , sectionNames } from ' lowcoder-design' ;
4
- import styled from ' styled-components' ;
5
- import { clickEvent , eventHandlerControl } from ' comps/controls/eventHandlerControl' ;
6
- import { StringControl } from ' comps/controls/codeControl' ;
7
- import { alignWithJustifyControl } from ' comps/controls/alignControl' ;
8
- import { navListComp } from ' ./navItemComp' ;
9
- import { menuPropertyView } from ' ./components/MenuItemList' ;
10
- import { default as DownOutlined } from ' @ant-design/icons/DownOutlined' ;
11
- import { default as Dropdown } from ' antd/es/dropdown' ;
12
- import { default as Menu , MenuProps } from ' antd/es/menu' ;
13
- import { migrateOldData } from ' comps/generators/simpleGenerators' ;
14
- import { styleControl } from ' comps/controls/styleControl' ;
1
+ import { NameConfig , NameConfigHidden , withExposingConfigs } from " comps/generators/withExposing" ;
2
+ import { UICompBuilder , withDefault } from " comps/generators" ;
3
+ import { Section , sectionNames } from " lowcoder-design" ;
4
+ import styled from " styled-components" ;
5
+ import { clickEvent , eventHandlerControl } from " comps/controls/eventHandlerControl" ;
6
+ import { StringControl } from " comps/controls/codeControl" ;
7
+ import { alignWithJustifyControl } from " comps/controls/alignControl" ;
8
+ import { navListComp } from " ./navItemComp" ;
9
+ import { menuPropertyView } from " ./components/MenuItemList" ;
10
+ import { default as DownOutlined } from " @ant-design/icons/DownOutlined" ;
11
+ import { default as Dropdown } from " antd/es/dropdown" ;
12
+ import { default as Menu , MenuProps } from " antd/es/menu" ;
13
+ import { migrateOldData } from " comps/generators/simpleGenerators" ;
14
+ import { styleControl } from " comps/controls/styleControl" ;
15
15
import {
16
16
AnimationStyle ,
17
17
AnimationStyleType ,
18
18
NavigationStyle ,
19
- } from ' comps/controls/styleControlConstants' ;
20
- import { hiddenPropertyView } from ' comps/utils/propertyUtils' ;
21
- import { trans } from ' i18n' ;
19
+ } from " comps/controls/styleControlConstants" ;
20
+ import { hiddenPropertyView } from " comps/utils/propertyUtils" ;
21
+ import { trans } from " i18n" ;
22
22
23
- import { useContext } from ' react' ;
24
- import { EditorContext } from ' comps/editorState' ;
23
+ import { useContext } from " react" ;
24
+ import { EditorContext } from " comps/editorState" ;
25
25
26
26
type IProps = {
27
27
$justify : boolean ;
@@ -32,24 +32,24 @@ type IProps = {
32
32
$animationStyle :AnimationStyleType ;
33
33
} ;
34
34
35
- const Wrapper = styled ( ' div' ) <
36
- Pick < IProps , ' $bgColor' | ' $borderColor' | ' $borderWidth' | ' $borderRadius' | ' $animationStyle' >
35
+ const Wrapper = styled ( " div" ) <
36
+ Pick < IProps , " $bgColor" | " $borderColor" | " $borderWidth" | " $borderRadius" | " $animationStyle" >
37
37
> `
38
38
${ props => props . $animationStyle }
39
39
height: 100%;
40
40
border-radius: ${ ( props ) =>
41
- props . $borderRadius ? props . $borderRadius : ' 2px' } ;
41
+ props . $borderRadius ? props . $borderRadius : " 2px" } ;
42
42
box-sizing: border-box;
43
- border: ${ ( props ) => ( props . $borderWidth ? `${ props . $borderWidth } ` : ' 1px' ) }
43
+ border: ${ ( props ) => ( props . $borderWidth ? `${ props . $borderWidth } ` : " 1px" ) }
44
44
solid ${ ( props ) => props . $borderColor } ;
45
45
background-color: ${ ( props ) => props . $bgColor } ;
46
46
` ;
47
47
48
- const NavInner = styled ( ' div' ) < Pick < IProps , ' $justify' > > `
48
+ const NavInner = styled ( " div" ) < Pick < IProps , " $justify" > > `
49
49
// margin: 0 -16px;
50
50
height: 100%;
51
51
display: flex;
52
- justify-content: ${ ( props ) => ( props . $justify ? ' space-between' : ' left' ) } ;
52
+ justify-content: ${ ( props ) => ( props . $justify ? " space-between" : " left" ) } ;
53
53
` ;
54
54
55
55
const Item = styled . div < {
@@ -67,18 +67,18 @@ const Item = styled.div<{
67
67
} > `
68
68
height: 30px;
69
69
line-height: 30px;
70
- padding: ${ ( props ) => ( props . $padding ? props . $padding : ' 0 16px' ) } ;
70
+ padding: ${ ( props ) => ( props . $padding ? props . $padding : " 0 16px" ) } ;
71
71
color: ${ ( props ) => ( props . $active ? props . $activeColor : props . $color ) } ;
72
72
font-weight: ${ ( props ) => ( props . $textWeight ? props . $textWeight : 500 ) } ;
73
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' ) } ;
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
77
text-transform: ${ ( props ) =>
78
- props . $textTransform ? props . $textTransform : '' } ;
78
+ props . $textTransform ? props . $textTransform : "" } ;
79
79
text-decoration: ${ ( props ) =>
80
- props . $textDecoration ? props . $textDecoration : '' } ;
81
- margin: ${ ( props ) => ( props . $margin ? props . $margin : ' 0px' ) } ;
80
+ props . $textDecoration ? props . $textDecoration : "" } ;
81
+ margin: ${ ( props ) => ( props . $margin ? props . $margin : " 0px" ) } ;
82
82
83
83
&:hover {
84
84
color: ${ ( props ) => props . $activeColor } ;
@@ -120,10 +120,10 @@ const logoEventHandlers = [clickEvent];
120
120
function fixOldStyleData ( oldData : any ) {
121
121
if (
122
122
oldData &&
123
- ( oldData . hasOwnProperty ( ' accentColor' ) ||
124
- oldData . hasOwnProperty ( ' backgroundColor' ) ||
125
- oldData . hasOwnProperty ( ' borderColor' ) ||
126
- oldData . hasOwnProperty ( ' color' ) )
123
+ ( oldData . hasOwnProperty ( " accentColor" ) ||
124
+ oldData . hasOwnProperty ( " backgroundColor" ) ||
125
+ oldData . hasOwnProperty ( " borderColor" ) ||
126
+ oldData . hasOwnProperty ( " color" ) )
127
127
) {
128
128
return {
129
129
text : oldData . color ,
@@ -138,14 +138,14 @@ function fixOldStyleData(oldData: any) {
138
138
const childrenMap = {
139
139
logoUrl : StringControl ,
140
140
logoEvent : withDefault ( eventHandlerControl ( logoEventHandlers ) , [
141
- { name : ' click' } ,
141
+ { name : " click" } ,
142
142
] ) ,
143
143
horizontalAlignment : alignWithJustifyControl ( ) ,
144
144
style : migrateOldData ( styleControl ( NavigationStyle ) , fixOldStyleData ) ,
145
145
animationStyle : styleControl ( AnimationStyle ) ,
146
146
items : withDefault ( navListComp ( ) , [
147
147
{
148
- label : trans ( ' menuItem' ) + ' 1' ,
148
+ label : trans ( " menuItem" ) + " 1" ,
149
149
} ,
150
150
] ) ,
151
151
} ;
@@ -165,7 +165,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
165
165
const subMenuItems : Array < { key : string ; label : string } > = [ ] ;
166
166
const subMenuSelectedKeys : Array < string > = [ ] ;
167
167
visibleSubItems . forEach ( ( subItem , index ) => {
168
- const key = index + '' ;
168
+ const key = index + "" ;
169
169
subItem . children . active . getView ( ) && subMenuSelectedKeys . push ( key ) ;
170
170
subMenuItems . push ( {
171
171
key : key ,
@@ -186,7 +186,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
186
186
$textTransform = { props . style . textTransform }
187
187
$textDecoration = { props . style . textDecoration }
188
188
$margin = { props . style . margin }
189
- onClick = { ( ) => onEvent ( ' click' ) }
189
+ onClick = { ( ) => onEvent ( " click" ) }
190
190
>
191
191
{ label }
192
192
{ items . length > 0 && < DownOutlined /> }
@@ -197,7 +197,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
197
197
< StyledMenu
198
198
onClick = { ( e ) => {
199
199
const { onEvent : onSubEvent } = items [ Number ( e . key ) ] ?. getView ( ) ;
200
- onSubEvent ( ' click' ) ;
200
+ onSubEvent ( " click" ) ;
201
201
} }
202
202
selectedKeys = { subMenuSelectedKeys }
203
203
items = { subMenuItems }
@@ -214,7 +214,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
214
214
</ >
215
215
) ;
216
216
217
- const justify = props . horizontalAlignment === ' justify' ;
217
+ const justify = props . horizontalAlignment === " justify" ;
218
218
219
219
return (
220
220
< Wrapper
@@ -226,7 +226,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
226
226
>
227
227
< NavInner $justify = { justify } >
228
228
{ props . logoUrl && (
229
- < LogoWrapper onClick = { ( ) => props . logoEvent ( ' click' ) } >
229
+ < LogoWrapper onClick = { ( ) => props . logoEvent ( " click" ) } >
230
230
< img src = { props . logoUrl } alt = "LOGO" />
231
231
</ LogoWrapper >
232
232
) }
@@ -246,38 +246,38 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
246
246
{ menuPropertyView ( children . items ) }
247
247
</ Section >
248
248
249
- { ( useContext ( EditorContext ) . editorModeStatus === ' logic' ||
250
- useContext ( EditorContext ) . editorModeStatus === ' both' ) && (
249
+ { ( useContext ( EditorContext ) . editorModeStatus === " logic" ||
250
+ useContext ( EditorContext ) . editorModeStatus === " both" ) && (
251
251
< Section name = { sectionNames . interaction } >
252
252
{ hiddenPropertyView ( children ) }
253
253
</ Section >
254
254
) }
255
255
256
- { ( useContext ( EditorContext ) . editorModeStatus === ' layout' ||
257
- useContext ( EditorContext ) . editorModeStatus === ' both' ) && (
256
+ { ( useContext ( EditorContext ) . editorModeStatus === " layout" ||
257
+ useContext ( EditorContext ) . editorModeStatus === " both" ) && (
258
258
< Section name = { sectionNames . layout } >
259
259
{ children . horizontalAlignment . propertyView ( {
260
- label : trans ( ' navigation.horizontalAlignment' ) ,
260
+ label : trans ( " navigation.horizontalAlignment" ) ,
261
261
radioButton : true ,
262
262
} ) }
263
263
{ hiddenPropertyView ( children ) }
264
264
</ Section >
265
265
) }
266
266
267
- { ( useContext ( EditorContext ) . editorModeStatus === ' logic' ||
268
- useContext ( EditorContext ) . editorModeStatus === ' both' ) && (
267
+ { ( useContext ( EditorContext ) . editorModeStatus === " logic" ||
268
+ useContext ( EditorContext ) . editorModeStatus === " both" ) && (
269
269
< Section name = { sectionNames . advanced } >
270
270
{ children . logoUrl . propertyView ( {
271
- label : trans ( ' navigation.logoURL' ) ,
272
- tooltip : trans ( ' navigation.logoURLDesc' ) ,
271
+ label : trans ( " navigation.logoURL" ) ,
272
+ tooltip : trans ( " navigation.logoURLDesc" ) ,
273
273
} ) }
274
274
{ children . logoUrl . getView ( ) &&
275
275
children . logoEvent . propertyView ( { inline : true } ) }
276
276
</ Section >
277
277
) }
278
278
279
- { ( useContext ( EditorContext ) . editorModeStatus === ' layout' ||
280
- useContext ( EditorContext ) . editorModeStatus === ' both' ) && (
279
+ { ( useContext ( EditorContext ) . editorModeStatus === " layout" ||
280
+ useContext ( EditorContext ) . editorModeStatus === " both" ) && (
281
281
< >
282
282
< Section name = { sectionNames . style } >
283
283
{ children . style . getPropertyView ( ) }
@@ -293,7 +293,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
293
293
. build ( ) ;
294
294
295
295
export const NavComp = withExposingConfigs ( NavCompBase , [
296
- new NameConfig ( ' logoUrl' , trans ( ' navigation.logoURLDesc' ) ) ,
296
+ new NameConfig ( " logoUrl" , trans ( " navigation.logoURLDesc" ) ) ,
297
297
NameConfigHidden ,
298
- new NameConfig ( ' items' , trans ( ' navigation.itemsDesc' ) ) ,
298
+ new NameConfig ( " items" , trans ( " navigation.itemsDesc" ) ) ,
299
299
] ) ;
0 commit comments