Skip to content

Commit d2e9ac8

Browse files
committed
formating removed-66
1 parent ea63385 commit d2e9ac8

File tree

1 file changed

+64
-89
lines changed

1 file changed

+64
-89
lines changed
Lines changed: 64 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
1-
import {default as AntdSegmented} from 'antd/es/segmented';
2-
import {BoolCodeControl} from 'comps/controls/codeControl';
3-
import {stringExposingStateControl} from 'comps/controls/codeStateControl';
4-
import {ChangeEventHandlerControl} from 'comps/controls/eventHandlerControl';
5-
import {LabelControl} from 'comps/controls/labelControl';
6-
import {SelectOptionControl} from 'comps/controls/optionsControl';
7-
import {styleControl} from 'comps/controls/styleControl';
8-
import {
9-
AnimationStyle,
10-
SegmentStyle,
11-
SegmentStyleType,
12-
} from 'comps/controls/styleControlConstants';
13-
import styled, {css} from 'styled-components';
14-
import {UICompBuilder} from '../../generators';
15-
import {
16-
CommonNameConfig,
17-
NameConfig,
18-
withExposingConfigs,
19-
} from '../../generators/withExposing';
20-
import {
21-
formDataChildren,
22-
FormDataPropertyView,
23-
} from '../formComp/formDataConstants';
1+
import { default as AntdSegmented } from "antd/es/segmented";
2+
import { BoolCodeControl } from "comps/controls/codeControl";
3+
import { stringExposingStateControl } from "comps/controls/codeStateControl";
4+
import { ChangeEventHandlerControl } from "comps/controls/eventHandlerControl";
5+
import { LabelControl } from "comps/controls/labelControl";
6+
import { SelectOptionControl } from "comps/controls/optionsControl";
7+
import { styleControl } from "comps/controls/styleControl";
8+
import { AnimationStyle, SegmentStyle, SegmentStyleType } from "comps/controls/styleControlConstants";
9+
import styled, { css } from "styled-components";
10+
import { UICompBuilder } from "../../generators";
11+
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generators/withExposing";
12+
import { formDataChildren, FormDataPropertyView } from "../formComp/formDataConstants";
2413
import {
2514
selectDivRefMethods,
2615
SelectInputInvalidConfig,
2716
SelectInputValidationChildren,
2817
SelectInputValidationSection,
2918
useSelectInputValidate,
30-
} from './selectInputConstants';
31-
import {Section, sectionNames} from 'lowcoder-design';
32-
import {
33-
hiddenPropertyView,
34-
disabledPropertyView,
35-
} from 'comps/utils/propertyUtils';
36-
import {trans} from 'i18n';
37-
import {hasIcon} from 'comps/utils';
38-
import {RefControl} from 'comps/controls/refControl';
19+
} from "./selectInputConstants";
20+
import { Section, sectionNames } from "lowcoder-design";
21+
import { hiddenPropertyView, disabledPropertyView } from "comps/utils/propertyUtils";
22+
import { trans } from "i18n";
23+
import { hasIcon } from "comps/utils";
24+
import { RefControl } from "comps/controls/refControl";
25+
26+
import { useContext } from "react";
27+
import { EditorContext } from "comps/editorState";
28+
import { migrateOldData, withDefault } from "comps/generators/simpleGenerators";
29+
import { fixOldInputCompData } from "../textInputComp/textInputConstants";
3930

40-
import {useContext} from 'react';
41-
import {EditorContext} from 'comps/editorState';
42-
import {migrateOldData, withDefault} from 'comps/generators/simpleGenerators';
43-
import {fixOldInputCompData} from '../textInputComp/textInputConstants';
4431

4532
const getStyle = (style: SegmentStyleType) => {
4633
return css`
@@ -66,33 +53,32 @@ const getStyle = (style: SegmentStyleType) => {
6653
.ant-segmented-item-selected {
6754
border-radius: ${style.radius};
6855
}
69-
&.ant-segmented,
70-
.ant-segmented-item-label {
71-
font-family: ${style.fontFamily};
72-
font-style: ${style.fontStyle};
73-
font-size: ${style.textSize};
74-
font-weight: ${style.textWeight};
75-
text-transform: ${style.textTransform};
76-
text-decoration: ${style.textDecoration};
56+
&.ant-segmented, .ant-segmented-item-label {
57+
font-family:${style.fontFamily};
58+
font-style:${style.fontStyle};
59+
font-size:${style.textSize};
60+
font-weight:${style.textWeight};
61+
text-transform:${style.textTransform};
62+
text-decoration:${style.textDecoration};
7763
}
7864
`;
7965
};
8066

81-
const Segmented = styled(AntdSegmented)<{$style: SegmentStyleType}>`
67+
const Segmented = styled(AntdSegmented)<{ $style: SegmentStyleType }>`
8268
width: 100%;
8369
min-height: 24px; // keep the height unchanged when there are no options
8470
${(props) => props.$style && getStyle(props.$style)}
8571
`;
8672

8773
const SegmentChildrenMap = {
88-
defaultValue: stringExposingStateControl('value'),
89-
value: stringExposingStateControl('value'),
74+
defaultValue: stringExposingStateControl("value"),
75+
value: stringExposingStateControl("value"),
9076
label: LabelControl,
9177
disabled: BoolCodeControl,
9278
onEvent: ChangeEventHandlerControl,
9379
options: SelectOptionControl,
94-
style: withDefault(styleControl(SegmentStyle), {borderWidth: '1px'}),
95-
animationStyle: styleControl(AnimationStyle),
80+
style: withDefault(styleControl(SegmentStyle), { borderWidth: '1px' }),
81+
animationStyle:styleControl(AnimationStyle),
9682
viewRef: RefControl<HTMLDivElement>,
9783

9884
...SelectInputValidationChildren,
@@ -101,7 +87,10 @@ const SegmentChildrenMap = {
10187

10288
let SegmentedControlBasicComp = (function () {
10389
return new UICompBuilder(SegmentChildrenMap, (props) => {
104-
const [validateState, handleChange] = useSelectInputValidate(props);
90+
const [
91+
validateState,
92+
handleChange,
93+
] = useSelectInputValidate(props);
10594
return props.label({
10695
required: props.required,
10796
style: props.style,
@@ -133,57 +122,43 @@ let SegmentedControlBasicComp = (function () {
133122
<>
134123
<Section name={sectionNames.basic}>
135124
{children.options.propertyView({})}
136-
{children.defaultValue.propertyView({
137-
label: trans('prop.defaultValue'),
138-
})}
125+
{children.defaultValue.propertyView({ label: trans("prop.defaultValue") })}
139126
</Section>
140127

141-
{['logic', 'both'].includes(
142-
useContext(EditorContext).editorModeStatus
143-
) && (
144-
<>
145-
<SelectInputValidationSection {...children} />
146-
<FormDataPropertyView {...children} />
147-
<Section name={sectionNames.interaction}>
148-
{children.onEvent.getPropertyView()}
149-
{disabledPropertyView(children)}
150-
{hiddenPropertyView(children)}
151-
</Section>
152-
</>
128+
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
129+
<><SelectInputValidationSection {...children} />
130+
<FormDataPropertyView {...children} />
131+
<Section name={sectionNames.interaction}>
132+
{children.onEvent.getPropertyView()}
133+
{disabledPropertyView(children)}
134+
{hiddenPropertyView(children)}
135+
</Section></>
153136
)}
154137

155-
{['layout', 'both'].includes(
156-
useContext(EditorContext).editorModeStatus
157-
) && children.label.getPropertyView()}
138+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
139+
children.label.getPropertyView()
140+
)}
158141

159-
{['layout', 'both'].includes(
160-
useContext(EditorContext).editorModeStatus
161-
) && (
142+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
162143
<>
163-
<Section name={sectionNames.style}>
164-
{children.style.getPropertyView()}
144+
<Section name={sectionNames.style}>
145+
{children.style.getPropertyView()}
146+
</Section>
147+
<Section name={sectionNames.animationStyle}>
148+
{children.animationStyle.getPropertyView()}
165149
</Section>
166-
<Section name={sectionNames.animationStyle}>
167-
{children.animationStyle.getPropertyView()}
168-
</Section>
169-
</>
150+
</>
170151
)}
171152
</>
172153
))
173154
.setExposeMethodConfigs(selectDivRefMethods)
174155
.build();
175156
})();
176157

177-
SegmentedControlBasicComp = migrateOldData(
178-
SegmentedControlBasicComp,
179-
fixOldInputCompData
180-
);
158+
SegmentedControlBasicComp = migrateOldData(SegmentedControlBasicComp, fixOldInputCompData);
181159

182-
export const SegmentedControlComp = withExposingConfigs(
183-
SegmentedControlBasicComp,
184-
[
185-
new NameConfig('value', trans('selectInput.valueDesc')),
186-
SelectInputInvalidConfig,
187-
...CommonNameConfig,
188-
]
189-
);
160+
export const SegmentedControlComp = withExposingConfigs(SegmentedControlBasicComp, [
161+
new NameConfig("value", trans("selectInput.valueDesc")),
162+
SelectInputInvalidConfig,
163+
...CommonNameConfig,
164+
]);

0 commit comments

Comments
 (0)