1
- import { default as Button } from 'antd/es/button' ;
2
- import {
3
- ButtonCompWrapper ,
4
- buttonRefMethods ,
5
- } from 'comps/comps/buttonComp/buttonCompConstants' ;
6
- import { BoolCodeControl , StringControl } from 'comps/controls/codeControl' ;
7
- import { ButtonEventHandlerControl } from 'comps/controls/eventHandlerControl' ;
8
- import { styleControl } from 'comps/controls/styleControl' ;
9
- import {
10
- AnimationStyle ,
11
- AnimationStyleType ,
12
- LinkStyle ,
13
- LinkStyleType ,
14
- } from 'comps/controls/styleControlConstants' ;
15
- import { withDefault } from 'comps/generators' ;
16
- import { migrateOldData } from 'comps/generators/simpleGenerators' ;
17
- import { UICompBuilder } from 'comps/generators/uiCompBuilder' ;
18
- import { Section , sectionNames } from 'lowcoder-design' ;
19
- import styled from 'styled-components' ;
20
- import {
21
- CommonNameConfig ,
22
- NameConfig ,
23
- withExposingConfigs ,
24
- } from '../../generators/withExposing' ;
1
+ import { default as Button } from "antd/es/button" ;
2
+ import { ButtonCompWrapper , buttonRefMethods } from "comps/comps/buttonComp/buttonCompConstants" ;
3
+ import { BoolCodeControl , StringControl } from "comps/controls/codeControl" ;
4
+ import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl" ;
5
+ import { styleControl } from "comps/controls/styleControl" ;
6
+ import { AnimationStyle , AnimationStyleType , LinkStyle , LinkStyleType } from "comps/controls/styleControlConstants" ;
7
+ import { withDefault } from "comps/generators" ;
8
+ import { migrateOldData } from "comps/generators/simpleGenerators" ;
9
+ import { UICompBuilder } from "comps/generators/uiCompBuilder" ;
10
+ import { Section , sectionNames } from "lowcoder-design" ;
11
+ import styled from "styled-components" ;
12
+ import { CommonNameConfig , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
25
13
import {
26
14
hiddenPropertyView ,
27
15
disabledPropertyView ,
28
16
loadingPropertyView ,
29
- } from ' comps/utils/propertyUtils' ;
30
- import { trans } from ' i18n' ;
31
- import { IconControl } from ' comps/controls/iconControl' ;
32
- import { hasIcon } from ' comps/utils' ;
33
- import { RefControl } from ' comps/controls/refControl' ;
17
+ } from " comps/utils/propertyUtils" ;
18
+ import { trans } from " i18n" ;
19
+ import { IconControl } from " comps/controls/iconControl" ;
20
+ import { hasIcon } from " comps/utils" ;
21
+ import { RefControl } from " comps/controls/refControl" ;
34
22
35
- import { EditorContext } from ' comps/editorState' ;
36
- import React , { useContext } from ' react' ;
23
+ import { EditorContext } from " comps/editorState" ;
24
+ import React , { useContext } from " react" ;
37
25
38
26
const Link = styled ( Button ) < {
39
27
$style : LinkStyleType ;
@@ -82,7 +70,7 @@ const IconWrapper = styled.span`
82
70
* compatible with old data 2022-08-26
83
71
*/
84
72
function fixOldData ( oldData : any ) {
85
- if ( oldData && oldData . hasOwnProperty ( ' color' ) ) {
73
+ if ( oldData && oldData . hasOwnProperty ( " color" ) ) {
86
74
return {
87
75
text : oldData . color ,
88
76
} ;
@@ -92,20 +80,19 @@ function fixOldData(oldData: any) {
92
80
93
81
const LinkTmpComp = ( function ( ) {
94
82
const childrenMap = {
95
- text : withDefault ( StringControl , trans ( ' link.link' ) ) ,
83
+ text : withDefault ( StringControl , trans ( " link.link" ) ) ,
96
84
onEvent : ButtonEventHandlerControl ,
97
85
disabled : BoolCodeControl ,
98
86
loading : BoolCodeControl ,
99
87
style : migrateOldData ( styleControl ( LinkStyle ) , fixOldData ) ,
100
- animationStyle : styleControl ( AnimationStyle ) ,
88
+ animationStyle :styleControl ( AnimationStyle ) ,
101
89
prefixIcon : IconControl ,
102
90
suffixIcon : IconControl ,
103
91
viewRef : RefControl < HTMLElement > ,
104
92
} ;
105
93
return new UICompBuilder ( childrenMap , ( props ) => {
106
94
// chrome86 bug: button children should not contain only empty span
107
- const hasChildren =
108
- hasIcon ( props . prefixIcon ) || ! ! props . text || hasIcon ( props . suffixIcon ) ;
95
+ const hasChildren = hasIcon ( props . prefixIcon ) || ! ! props . text || hasIcon ( props . suffixIcon ) ;
109
96
return (
110
97
< ButtonCompWrapper disabled = { props . disabled } >
111
98
< Link
@@ -136,38 +123,26 @@ const LinkTmpComp = (function () {
136
123
return (
137
124
< >
138
125
< Section name = { sectionNames . basic } >
139
- { children . text . propertyView ( { label : trans ( ' text' ) } ) }
126
+ { children . text . propertyView ( { label : trans ( " text" ) } ) }
140
127
</ Section >
141
128
142
- { ( useContext ( EditorContext ) . editorModeStatus === 'logic' ||
143
- useContext ( EditorContext ) . editorModeStatus === 'both' ) && (
144
- < >
145
- < Section name = { sectionNames . interaction } >
146
- { children . onEvent . getPropertyView ( ) }
147
- { disabledPropertyView ( children ) }
148
- { hiddenPropertyView ( children ) }
149
- { loadingPropertyView ( children ) }
150
- </ Section >
129
+ { ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
130
+ < > < Section name = { sectionNames . interaction } >
131
+ { children . onEvent . getPropertyView ( ) }
132
+ { disabledPropertyView ( children ) }
133
+ { hiddenPropertyView ( children ) }
134
+ { loadingPropertyView ( children ) }
135
+ </ Section >
151
136
< Section name = { sectionNames . advanced } >
152
- { children . prefixIcon . propertyView ( {
153
- label : trans ( 'button.prefixIcon' ) ,
154
- } ) }
155
- { children . suffixIcon . propertyView ( {
156
- label : trans ( 'button.suffixIcon' ) ,
157
- } ) }
158
- </ Section >
159
- </ >
137
+ { children . prefixIcon . propertyView ( { label : trans ( "button.prefixIcon" ) } ) }
138
+ { children . suffixIcon . propertyView ( { label : trans ( "button.suffixIcon" ) } ) }
139
+ </ Section > </ >
160
140
) }
161
141
162
- { ( useContext ( EditorContext ) . editorModeStatus === 'layout' ||
163
- useContext ( EditorContext ) . editorModeStatus === 'both' ) && (
142
+ { ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
164
143
< >
165
- < Section name = { sectionNames . style } >
166
- { children . style . getPropertyView ( ) }
167
- </ Section >
168
- < Section name = { sectionNames . animationStyle } >
169
- { children . animationStyle . getPropertyView ( ) }
170
- </ Section >
144
+ < Section name = { sectionNames . style } > { children . style . getPropertyView ( ) } </ Section >
145
+ < Section name = { sectionNames . animationStyle } > { children . animationStyle . getPropertyView ( ) } </ Section >
171
146
</ >
172
147
) }
173
148
</ >
@@ -178,7 +153,7 @@ const LinkTmpComp = (function () {
178
153
} ) ( ) ;
179
154
180
155
export const LinkComp = withExposingConfigs ( LinkTmpComp , [
181
- new NameConfig ( ' text' , trans ( ' link.textDesc' ) ) ,
182
- new NameConfig ( ' loading' , trans ( ' link.loadingDesc' ) ) ,
156
+ new NameConfig ( " text" , trans ( " link.textDesc" ) ) ,
157
+ new NameConfig ( " loading" , trans ( " link.loadingDesc" ) ) ,
183
158
...CommonNameConfig ,
184
159
] ) ;
0 commit comments