Skip to content

Commit 45364c1

Browse files
committed
formating removed-67
1 parent d2e9ac8 commit 45364c1

File tree

1 file changed

+40
-71
lines changed

1 file changed

+40
-71
lines changed
Lines changed: 40 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,36 @@
1-
import {default as Switch} from 'antd/es/switch';
2-
import {BoolCodeControl} from 'comps/controls/codeControl';
3-
import {booleanExposingStateControl} from 'comps/controls/codeStateControl';
4-
import {
5-
changeEvent,
6-
eventHandlerControl,
7-
} from 'comps/controls/eventHandlerControl';
8-
import {LabelControl} from 'comps/controls/labelControl';
9-
import {styleControl} from 'comps/controls/styleControl';
10-
import {
11-
SwitchStyle,
12-
SwitchStyleType,
13-
LabelStyle,
14-
InputFieldStyle,
15-
AnimationStyle,
16-
} from 'comps/controls/styleControlConstants';
17-
import {migrateOldData} from 'comps/generators/simpleGenerators';
18-
import {Section, sectionNames} from 'lowcoder-design';
19-
import styled, {css} from 'styled-components';
20-
import {UICompBuilder} from '../generators';
21-
import {
22-
CommonNameConfig,
23-
NameConfig,
24-
withExposingConfigs,
25-
} from '../generators/withExposing';
26-
import {
27-
formDataChildren,
28-
FormDataPropertyView,
29-
} from './formComp/formDataConstants';
30-
import {
31-
hiddenPropertyView,
32-
disabledPropertyView,
33-
} from 'comps/utils/propertyUtils';
34-
import {trans} from 'i18n';
35-
import {RefControl} from 'comps/controls/refControl';
36-
import {refMethods} from 'comps/generators/withMethodExposing';
37-
import {
38-
blurMethod,
39-
clickMethod,
40-
focusWithOptions,
41-
} from 'comps/utils/methodUtils';
1+
import { default as Switch } from "antd/es/switch";
2+
import { BoolCodeControl } from "comps/controls/codeControl";
3+
import { booleanExposingStateControl } from "comps/controls/codeStateControl";
4+
import { changeEvent, eventHandlerControl } from "comps/controls/eventHandlerControl";
5+
import { LabelControl } from "comps/controls/labelControl";
6+
import { styleControl } from "comps/controls/styleControl";
7+
import { SwitchStyle, SwitchStyleType, LabelStyle, InputFieldStyle, AnimationStyle } from "comps/controls/styleControlConstants";
8+
import { migrateOldData } from "comps/generators/simpleGenerators";
9+
import { Section, sectionNames } from "lowcoder-design";
10+
import styled, { css } from "styled-components";
11+
import { UICompBuilder } from "../generators";
12+
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../generators/withExposing";
13+
import { formDataChildren, FormDataPropertyView } from "./formComp/formDataConstants";
14+
import { hiddenPropertyView, disabledPropertyView } from "comps/utils/propertyUtils";
15+
import { trans } from "i18n";
16+
import { RefControl } from "comps/controls/refControl";
17+
import { refMethods } from "comps/generators/withMethodExposing";
18+
import { blurMethod, clickMethod, focusWithOptions } from "comps/utils/methodUtils";
4219

43-
import {useContext} from 'react';
44-
import {EditorContext} from 'comps/editorState';
20+
import { useContext } from "react";
21+
import { EditorContext } from "comps/editorState";
4522

4623
const EventOptions = [
4724
changeEvent,
4825
{
49-
label: trans('switchComp.open'),
50-
value: 'true',
51-
description: trans('switchComp.openDesc'),
26+
label: trans("switchComp.open"),
27+
value: "true",
28+
description: trans("switchComp.openDesc"),
5229
},
5330
{
54-
label: trans('switchComp.close'),
55-
value: 'false',
56-
description: trans('switchComp.closeDesc'),
31+
label: trans("switchComp.close"),
32+
value: "false",
33+
description: trans("switchComp.closeDesc"),
5734
},
5835
] as const;
5936

@@ -72,7 +49,7 @@ const getStyle = (style: SwitchStyleType) => {
7249
`;
7350
};
7451

75-
const SwitchWrapper = styled.div<{disabled: boolean; $style: SwitchStyleType}>`
52+
const SwitchWrapper = styled.div<{ disabled: boolean; $style: SwitchStyleType }>`
7653
min-height: 32px;
7754
display: flex;
7855
align-items: center;
@@ -92,7 +69,7 @@ const SwitchWrapper = styled.div<{disabled: boolean; $style: SwitchStyleType}>`
9269
* compatible with old data 2022-08-23
9370
*/
9471
function fixOldData(oldData: any) {
95-
if (oldData && oldData.hasOwnProperty('unChecked')) {
72+
if (oldData && oldData.hasOwnProperty("unChecked")) {
9673
return {
9774
label: oldData.label,
9875
handle: oldData.handle,
@@ -127,8 +104,8 @@ let SwitchTmpComp = (function () {
127104
return props.label({
128105
style: props.style,
129106
labelStyle: props.labelStyle,
130-
inputFieldStyle: props.inputFieldStyle,
131-
animationStyle: props.animationStyle,
107+
inputFieldStyle:props.inputFieldStyle,
108+
animationStyle:props.animationStyle,
132109
children: (
133110
<SwitchWrapper disabled={props.disabled} $style={props.inputFieldStyle}>
134111
<Switch
@@ -137,8 +114,8 @@ let SwitchTmpComp = (function () {
137114
ref={props.viewRef}
138115
onChange={(checked) => {
139116
props.value.onChange(checked);
140-
props.onEvent('change');
141-
props.onEvent(checked ? 'true' : 'false');
117+
props.onEvent("change");
118+
props.onEvent(checked ? "true" : "false");
142119
}}
143120
/>
144121
</SwitchWrapper>
@@ -149,30 +126,24 @@ let SwitchTmpComp = (function () {
149126
return (
150127
<>
151128
<Section name={sectionNames.basic}>
152-
{children.value.propertyView({
153-
label: trans('switchComp.defaultValue'),
154-
})}
129+
{children.value.propertyView({ label: trans("switchComp.defaultValue") })}
155130
</Section>
156131

157132
<FormDataPropertyView {...children} />
158133

159-
{['logic', 'both'].includes(
160-
useContext(EditorContext).editorModeStatus
161-
) && (
134+
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
162135
<Section name={sectionNames.interaction}>
163136
{children.onEvent.getPropertyView()}
164137
{disabledPropertyView(children)}
165138
{hiddenPropertyView(children)}
166139
</Section>
167140
)}
168141

169-
{['layout', 'both'].includes(
170-
useContext(EditorContext).editorModeStatus
171-
) && children.label.getPropertyView()}
142+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
143+
children.label.getPropertyView()
144+
)}
172145

173-
{['layout', 'both'].includes(
174-
useContext(EditorContext).editorModeStatus
175-
) && (
146+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
176147
<>
177148
<Section name={sectionNames.style}>
178149
{children.style.getPropertyView()}
@@ -191,13 +162,11 @@ let SwitchTmpComp = (function () {
191162
</>
192163
);
193164
})
194-
.setExposeMethodConfigs(
195-
refMethods([focusWithOptions, blurMethod, clickMethod])
196-
)
165+
.setExposeMethodConfigs(refMethods([focusWithOptions, blurMethod, clickMethod]))
197166
.build();
198167
})();
199168

200169
export const SwitchComp = withExposingConfigs(SwitchTmpComp, [
201-
new NameConfig('value', trans('switchComp.valueDesc')),
170+
new NameConfig("value", trans("switchComp.valueDesc")),
202171
...CommonNameConfig,
203172
]);

0 commit comments

Comments
 (0)