Skip to content

Commit b320839

Browse files
committed
formating removed-73
1 parent a6a9ecb commit b320839

File tree

1 file changed

+79
-86
lines changed

1 file changed

+79
-86
lines changed
Lines changed: 79 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,72 @@
1-
import {useState, useEffect} from 'react';
1+
import { useState, useEffect } from "react";
22
import {
33
NameConfig,
44
NameConfigPlaceHolder,
55
NameConfigRequired,
66
withExposingConfigs,
7-
} from 'comps/generators/withExposing';
8-
import {Section, sectionNames} from 'lowcoder-design';
9-
import {BoolControl} from '../../controls/boolControl';
10-
import {AutoHeightControl} from '../../controls/autoHeightControl';
11-
import {UICompBuilder} from '../../generators';
12-
import {FormDataPropertyView} from '../formComp/formDataConstants';
7+
} from "comps/generators/withExposing";
8+
import { Section, sectionNames } from "lowcoder-design";
9+
import { BoolControl } from "../../controls/boolControl";
10+
import { AutoHeightControl } from "../../controls/autoHeightControl";
11+
import { UICompBuilder } from "../../generators";
12+
import { FormDataPropertyView } from "../formComp/formDataConstants";
1313
import {
1414
checkMentionListData,
1515
fixOldInputCompData,
1616
textInputChildren,
17-
} from './textInputConstants';
17+
} from "./textInputConstants";
1818
import {
1919
withMethodExposing,
2020
refMethods,
21-
} from '../../generators/withMethodExposing';
22-
import {styleControl} from 'comps/controls/styleControl';
23-
import styled from 'styled-components';
21+
} from "../../generators/withMethodExposing";
22+
import { styleControl } from "comps/controls/styleControl";
23+
import styled from "styled-components";
2424
import {
2525
AnimationStyle,
2626
InputLikeStyle,
2727
InputLikeStyleType,
28-
} from 'comps/controls/styleControlConstants';
28+
} from "comps/controls/styleControlConstants";
2929
import {
3030
disabledPropertyView,
3131
hiddenPropertyView,
3232
maxLengthPropertyView,
3333
minLengthPropertyView,
3434
readOnlyPropertyView,
3535
requiredPropertyView,
36-
} from 'comps/utils/propertyUtils';
37-
import {booleanExposingStateControl} from 'comps/controls/codeStateControl';
38-
import {trans} from 'i18n';
39-
import {RefControl} from 'comps/controls/refControl';
40-
import {TextAreaRef} from 'antd/es/input/TextArea';
41-
import {default as ConfigProvider} from 'antd/es/config-provider';
42-
import {default as Mentions, type MentionsOptionProps} from 'antd/es/mentions';
43-
import {blurMethod, focusWithOptions} from 'comps/utils/methodUtils';
44-
import {textInputValidate} from '../textInputComp/textInputConstants';
45-
import {jsonControl} from 'comps/controls/codeControl';
36+
} from "comps/utils/propertyUtils";
37+
import { booleanExposingStateControl } from "comps/controls/codeStateControl";
38+
import { trans } from "i18n";
39+
import { RefControl } from "comps/controls/refControl";
40+
import { TextAreaRef } from "antd/es/input/TextArea";
41+
import { default as ConfigProvider } from "antd/es/config-provider";
42+
import { default as Mentions, type MentionsOptionProps } from "antd/es/mentions";
43+
import { blurMethod, focusWithOptions } from "comps/utils/methodUtils";
44+
import {
45+
textInputValidate,
46+
} from "../textInputComp/textInputConstants";
47+
import { jsonControl } from "comps/controls/codeControl";
4648
import {
4749
submitEvent,
4850
eventHandlerControl,
4951
mentionEvent,
5052
focusEvent,
5153
blurEvent,
52-
changeEvent,
53-
} from 'comps/controls/eventHandlerControl';
54+
changeEvent
55+
} from "comps/controls/eventHandlerControl";
5456

55-
import React, {useContext} from 'react';
56-
import {EditorContext} from 'comps/editorState';
57-
import {migrateOldData} from 'comps/generators/simpleGenerators';
57+
import React, { useContext } from "react";
58+
import { EditorContext } from "comps/editorState";
59+
import { migrateOldData } from "comps/generators/simpleGenerators";
5860

5961
const Wrapper = styled.div<{
6062
$style: InputLikeStyleType;
6163
}>`
62-
box-sizing: border-box;
64+
box-sizing:border-box;
6365
.rc-textarea {
64-
background-color: ${(props) => props.$style.background};
65-
padding: ${(props) => props.$style.padding};
66-
text-transform: ${(props) => props.$style.textTransform};
67-
text-decoration: ${(props) => props.$style.textDecoration};
66+
background-color:${(props) => props.$style.background};
67+
padding:${(props) => props.$style.padding};
68+
text-transform:${(props)=>props.$style.textTransform};
69+
text-decoration:${(props)=>props.$style.textDecoration};
6870
margin: 0px 3px 0px 3px !important;
6971
}
7072
@@ -105,42 +107,42 @@ let MentionTmpComp = (function () {
105107
};
106108

107109
return new UICompBuilder(childrenMap, (props) => {
108-
const {mentionList} = props;
110+
const { mentionList } = props;
109111
const [validateState, setvalidateState] = useState({});
110112
const [activationFlag, setActivationFlag] = useState(false);
111-
const [prefix, setPrefix] = useState<PrefixType>('@');
112-
type PrefixType = '@' | keyof typeof mentionList;
113+
const [prefix, setPrefix] = useState<PrefixType>("@");
114+
type PrefixType = "@" | keyof typeof mentionList;
113115

114116
const onSearch = (_: string, newPrefix: PrefixType) => {
115117
setPrefix(newPrefix);
116118
};
117119
const onChange = (value: string) => {
118120
props.value.onChange(value);
119-
props.onEvent('change');
121+
props.onEvent("change");
120122
};
121123

122124
const onPressEnter = (e: any) => {
123125
if (e.shiftKey) {
124126
e.preventDefault();
125-
props.onEvent('submit');
127+
props.onEvent("submit");
126128
}
127129
};
128130

129131
const onSelect = (option: MentionsOptionProps) => {
130-
props.onEvent('mention');
132+
props.onEvent("mention");
131133
};
132-
const getValidate = (value: any): '' | 'warning' | 'error' | undefined => {
134+
const getValidate = (value: any): "" | "warning" | "error" | undefined => {
133135
if (
134-
value.hasOwnProperty('validateStatus') &&
135-
value['validateStatus'] === 'error'
136+
value.hasOwnProperty("validateStatus") &&
137+
value["validateStatus"] === "error"
136138
)
137-
return 'error';
138-
return '';
139+
return "error";
140+
return "";
139141
};
140142

141143
const getTextInputValidate = () => {
142144
return {
143-
value: {value: props.value.value},
145+
value: { value: props.value.value },
144146
required: props.required,
145147
minLength: props?.minLength ?? 0,
146148
maxLength: props?.maxLength ?? 0,
@@ -154,7 +156,7 @@ let MentionTmpComp = (function () {
154156
if (activationFlag) {
155157
const temp = textInputValidate(getTextInputValidate());
156158
setvalidateState(temp);
157-
props.invalid.onChange(temp.validateStatus !== '');
159+
props.invalid.onChange(temp.validateStatus !== "");
158160
}
159161
}, [
160162
props.value.value,
@@ -184,9 +186,9 @@ let MentionTmpComp = (function () {
184186
prefix={Object.keys(mentionList)}
185187
onFocus={() => {
186188
setActivationFlag(true);
187-
props.onEvent('focus');
189+
props.onEvent("focus");
188190
}}
189-
onBlur={() => props.onEvent('blur')}
191+
onBlur={() => props.onEvent("blur")}
190192
onPressEnter={onPressEnter}
191193
onSearch={onSearch}
192194
onChange={onChange}
@@ -202,15 +204,15 @@ let MentionTmpComp = (function () {
202204
}))}
203205
autoSize={props.autoHeight}
204206
style={{
205-
height: '100%',
206-
maxHeight: '100%',
207-
resize: 'none',
207+
height: "100%",
208+
maxHeight: "100%",
209+
resize: "none",
208210
// padding: props.style.padding,
209211
fontStyle: props.style.fontStyle,
210212
fontFamily: props.style.fontFamily,
211213
borderWidth: props.style.borderWidth,
212214
fontWeight: props.style.textWeight,
213-
fontSize: props.style.textSize,
215+
fontSize: props.style.textSize
214216
}}
215217
readOnly={props.readOnly}
216218
/>
@@ -225,58 +227,48 @@ let MentionTmpComp = (function () {
225227
.setPropertyViewFn((children) => (
226228
<>
227229
<Section name={sectionNames.basic}>
228-
{children.value.propertyView({label: trans('prop.defaultValue')})}
230+
{children.value.propertyView({ label: trans("prop.defaultValue") })}
229231
{children.placeholder.propertyView({
230-
label: trans('prop.placeholder'),
232+
label: trans("prop.placeholder"),
231233
})}
232-
{['logic', 'both'].includes(
233-
useContext(EditorContext).editorModeStatus
234-
) &&
234+
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
235235
children.mentionList.propertyView({
236-
label: trans('mention.mentionList'),
237-
})}
236+
label: trans("mention.mentionList"),
237+
})
238+
)}
238239
</Section>
239240
<FormDataPropertyView {...children} />
240241

241-
{['layout', 'both'].includes(
242-
useContext(EditorContext).editorModeStatus
243-
) && children.label.getPropertyView()}
242+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
243+
children.label.getPropertyView()
244+
)}
244245

245-
{['logic', 'both'].includes(
246-
useContext(EditorContext).editorModeStatus
247-
) && (
248-
<>
249-
<Section name={sectionNames.interaction}>
250-
{children.onEvent.getPropertyView()}
251-
{disabledPropertyView(children)}
252-
</Section>
253-
<Section name={sectionNames.layout}>
254-
{hiddenPropertyView(children)}
255-
</Section>
246+
{["logic", "both"].includes(useContext(EditorContext).editorModeStatus) && (
247+
<><Section name={sectionNames.interaction}>
248+
{children.onEvent.getPropertyView()}
249+
{disabledPropertyView(children)}
250+
</Section>
251+
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
256252
<Section name={sectionNames.advanced}>
257253
{readOnlyPropertyView(children)}
258-
</Section>
259-
<Section name={sectionNames.validation}>
254+
</Section><Section name={sectionNames.validation}>
260255
{requiredPropertyView(children)}
261256
{children.validationType.propertyView({
262-
label: trans('prop.textType'),
257+
label: trans("prop.textType"),
263258
})}
264259
{minLengthPropertyView(children)}
265260
{maxLengthPropertyView(children)}
266261
{children.customRule.propertyView({})}
267-
</Section>
268-
</>
262+
</Section></>
269263
)}
270264

271-
{['layout', 'both'].includes(
272-
useContext(EditorContext).editorModeStatus
273-
) && (
265+
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
274266
<>
275267
<Section name={sectionNames.style}>
276-
{children.style.getPropertyView()}
268+
{children.style.getPropertyView()}
277269
</Section>
278270
<Section name={sectionNames.animationStyle}>
279-
{children.animationStyle.getPropertyView()}
271+
{children.animationStyle.getPropertyView()}
280272
</Section>
281273
</>
282274
)}
@@ -285,6 +277,7 @@ let MentionTmpComp = (function () {
285277
.build();
286278
})();
287279

280+
288281
MentionTmpComp = class extends MentionTmpComp {
289282
override autoHeight(): boolean {
290283
return this.children.autoHeight.getView();
@@ -299,10 +292,10 @@ const TextareaTmp2Comp = withMethodExposing(
299292
);
300293

301294
export const MentionComp = withExposingConfigs(TextareaTmp2Comp, [
302-
new NameConfig('value', trans('export.inputValueDesc')),
295+
new NameConfig("value", trans("export.inputValueDesc")),
303296
NameConfigPlaceHolder,
304297
NameConfigRequired,
305-
new NameConfig('invalid', trans('export.invalidDesc')),
306-
new NameConfig('hidden', trans('export.hiddenDesc')),
307-
new NameConfig('disabled', trans('export.disabledDesc')),
298+
new NameConfig("invalid", trans("export.invalidDesc")),
299+
new NameConfig("hidden", trans("export.hiddenDesc")),
300+
new NameConfig("disabled", trans("export.disabledDesc")),
308301
]);

0 commit comments

Comments
 (0)