Skip to content

Commit 956e1ff

Browse files
committed
formating removed-9
1 parent 7fbe58f commit 956e1ff

File tree

1 file changed

+39
-64
lines changed
  • client/packages/lowcoder/src/comps/comps/buttonComp

1 file changed

+39
-64
lines changed

client/packages/lowcoder/src/comps/comps/buttonComp/linkComp.tsx

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,27 @@
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";
2513
import {
2614
hiddenPropertyView,
2715
disabledPropertyView,
2816
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";
3422

35-
import {EditorContext} from 'comps/editorState';
36-
import React, {useContext} from 'react';
23+
import { EditorContext } from "comps/editorState";
24+
import React, { useContext } from "react";
3725

3826
const Link = styled(Button)<{
3927
$style: LinkStyleType;
@@ -82,7 +70,7 @@ const IconWrapper = styled.span`
8270
* compatible with old data 2022-08-26
8371
*/
8472
function fixOldData(oldData: any) {
85-
if (oldData && oldData.hasOwnProperty('color')) {
73+
if (oldData && oldData.hasOwnProperty("color")) {
8674
return {
8775
text: oldData.color,
8876
};
@@ -92,20 +80,19 @@ function fixOldData(oldData: any) {
9280

9381
const LinkTmpComp = (function () {
9482
const childrenMap = {
95-
text: withDefault(StringControl, trans('link.link')),
83+
text: withDefault(StringControl, trans("link.link")),
9684
onEvent: ButtonEventHandlerControl,
9785
disabled: BoolCodeControl,
9886
loading: BoolCodeControl,
9987
style: migrateOldData(styleControl(LinkStyle), fixOldData),
100-
animationStyle: styleControl(AnimationStyle),
88+
animationStyle:styleControl(AnimationStyle),
10189
prefixIcon: IconControl,
10290
suffixIcon: IconControl,
10391
viewRef: RefControl<HTMLElement>,
10492
};
10593
return new UICompBuilder(childrenMap, (props) => {
10694
// 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);
10996
return (
11097
<ButtonCompWrapper disabled={props.disabled}>
11198
<Link
@@ -136,38 +123,26 @@ const LinkTmpComp = (function () {
136123
return (
137124
<>
138125
<Section name={sectionNames.basic}>
139-
{children.text.propertyView({label: trans('text')})}
126+
{children.text.propertyView({ label: trans("text") })}
140127
</Section>
141128

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>
151136
<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></>
160140
)}
161141

162-
{(useContext(EditorContext).editorModeStatus === 'layout' ||
163-
useContext(EditorContext).editorModeStatus === 'both') && (
142+
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
164143
<>
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>
171146
</>
172147
)}
173148
</>
@@ -178,7 +153,7 @@ const LinkTmpComp = (function () {
178153
})();
179154

180155
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")),
183158
...CommonNameConfig,
184159
]);

0 commit comments

Comments
 (0)