Skip to content

Commit 1fb7633

Browse files
committed
formating removed-57
1 parent bcb94be commit 1fb7633

File tree

1 file changed

+42
-68
lines changed

1 file changed

+42
-68
lines changed
Lines changed: 42 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,30 @@
1-
import {default as Rate} from 'antd/es/rate';
2-
import styled, {css} from 'styled-components';
3-
import {Section, sectionNames} from 'lowcoder-design';
4-
import {NumberControl, BoolCodeControl} from '../controls/codeControl';
5-
import {BoolControl} from '../controls/boolControl';
6-
import {
7-
changeEvent,
8-
eventHandlerControl,
9-
} from '../controls/eventHandlerControl';
10-
import {LabelControl} from '../controls/labelControl';
11-
import {numberExposingStateControl} from '../controls/codeStateControl';
12-
import {UICompBuilder, withDefault} from '../generators';
13-
import {
14-
CommonNameConfig,
15-
NameConfig,
16-
withExposingConfigs,
17-
} from '../generators/withExposing';
18-
import {
19-
formDataChildren,
20-
FormDataPropertyView,
21-
} from './formComp/formDataConstants';
22-
import {styleControl} from 'comps/controls/styleControl';
23-
import {
24-
AnimationStyle,
25-
InputFieldStyle,
26-
LabelStyle,
27-
RatingStyle,
28-
RatingStyleType,
29-
} from 'comps/controls/styleControlConstants';
30-
import {migrateOldData} from 'comps/generators/simpleGenerators';
31-
import {
32-
disabledPropertyView,
33-
hiddenPropertyView,
34-
} from 'comps/utils/propertyUtils';
35-
import {trans} from 'i18n';
36-
37-
import {useContext, useEffect, useRef} from 'react';
38-
import {EditorContext} from 'comps/editorState';
1+
import { default as Rate } from "antd/es/rate";
2+
import styled, { css } from "styled-components";
3+
import { Section, sectionNames } from "lowcoder-design";
4+
import { NumberControl, BoolCodeControl } from "../controls/codeControl";
5+
import { BoolControl } from "../controls/boolControl";
6+
import { changeEvent, eventHandlerControl } from "../controls/eventHandlerControl";
7+
import { LabelControl } from "../controls/labelControl";
8+
import { numberExposingStateControl } from "../controls/codeStateControl";
9+
import { UICompBuilder, withDefault } from "../generators";
10+
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../generators/withExposing";
11+
import { formDataChildren, FormDataPropertyView } from "./formComp/formDataConstants";
12+
import { styleControl } from "comps/controls/styleControl";
13+
import { AnimationStyle, InputFieldStyle, LabelStyle, RatingStyle, RatingStyleType } from "comps/controls/styleControlConstants";
14+
import { migrateOldData } from "comps/generators/simpleGenerators";
15+
import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUtils";
16+
import { trans } from "i18n";
17+
18+
import { useContext, useEffect, useRef } from "react";
19+
import { EditorContext } from "comps/editorState";
3920

4021
const EventOptions = [changeEvent] as const;
4122

4223
/**
4324
* Compatible with old data 2022-08-23
4425
*/
4526
function fixOldData(oldData: any) {
46-
if (oldData && oldData.hasOwnProperty('unChecked')) {
27+
if (oldData && oldData.hasOwnProperty("unChecked")) {
4728
return {
4829
label: oldData.label,
4930
checked: oldData.checked,
@@ -73,9 +54,9 @@ const RatingBasicComp = (function () {
7354
...formDataChildren,
7455
};
7556
return new UICompBuilder(childrenMap, (props) => {
76-
const defaultValue = {...props.defaultValue}.value;
77-
const value = {...props.value}.value;
78-
const changeRef = useRef(false);
57+
const defaultValue = { ...props.defaultValue }.value;
58+
const value = { ...props.value }.value;
59+
const changeRef = useRef(false)
7960

8061
useEffect(() => {
8162
props.value.onChange(defaultValue);
@@ -84,15 +65,15 @@ const RatingBasicComp = (function () {
8465
useEffect(() => {
8566
if (!changeRef.current) return;
8667

87-
props.onEvent('change');
68+
props.onEvent("change");
8869
changeRef.current = false;
8970
}, [value]);
9071

9172
return props.label({
9273
style: props.style,
9374
labelStyle: props.labelStyle,
94-
inputFieldStyle: props.inputFieldStyle,
95-
animationStyle: props.animationStyle,
75+
inputFieldStyle:props.inputFieldStyle,
76+
animationStyle:props.animationStyle,
9677
children: (
9778
<RateStyled
9879
count={props.max}
@@ -112,40 +93,33 @@ const RatingBasicComp = (function () {
11293
return (
11394
<>
11495
<Section name={sectionNames.basic}>
115-
{children.defaultValue.propertyView({
116-
label: trans('prop.defaultValue'),
117-
})}
96+
{children.defaultValue.propertyView({ label: trans("prop.defaultValue") })}
11897
{children.max.propertyView({
119-
label: trans('rating.max'),
98+
label: trans("rating.max"),
12099
})}
121100
</Section>
122101

123102
<FormDataPropertyView {...children} />
124103

125-
{['logic', 'both'].includes(
126-
useContext(EditorContext).editorModeStatus
127-
) && (
128-
<>
129-
<Section name={sectionNames.interaction}>
130-
{children.onEvent.getPropertyView()}
131-
{disabledPropertyView(children)}
132-
{hiddenPropertyView(children)}
133-
</Section>
104+
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
105+
<><Section name={sectionNames.interaction}>
106+
{children.onEvent.getPropertyView()}
107+
{disabledPropertyView(children)}
108+
{hiddenPropertyView(children)}
109+
</Section>
134110
<Section name={sectionNames.advanced}>
135111
{children.allowHalf.propertyView({
136-
label: trans('rating.allowHalf'),
112+
label: trans("rating.allowHalf"),
137113
})}
138114
</Section>
139115
</>
140116
)}
141117

142-
{['layout', 'both'].includes(
143-
useContext(EditorContext).editorModeStatus
144-
) && children.label.getPropertyView()}
118+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
119+
children.label.getPropertyView()
120+
)}
145121

146-
{['layout', 'both'].includes(
147-
useContext(EditorContext).editorModeStatus
148-
) && (
122+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
149123
<>
150124
<Section name={sectionNames.style}>
151125
{children.style.getPropertyView()}
@@ -168,8 +142,8 @@ const RatingBasicComp = (function () {
168142
})();
169143

170144
export const RatingComp = withExposingConfigs(RatingBasicComp, [
171-
new NameConfig('value', trans('export.ratingValueDesc')),
172-
new NameConfig('max', trans('export.ratingMaxDesc')),
145+
new NameConfig("value", trans("export.ratingValueDesc")),
146+
new NameConfig("max", trans("export.ratingMaxDesc")),
173147
...CommonNameConfig,
174148
]);
175149

@@ -191,6 +165,6 @@ const getStyle = (style: RatingStyleType) => {
191165
`;
192166
};
193167

194-
export const RateStyled = styled(Rate)<{$style: RatingStyleType}>`
168+
export const RateStyled = styled(Rate) <{ $style: RatingStyleType }>`
195169
${(props) => props.$style && getStyle(props.$style)}
196170
`;

0 commit comments

Comments
 (0)