Skip to content

Commit 7fa7b87

Browse files
committed
rotation added
1 parent 0c3e340 commit 7fa7b87

File tree

3 files changed

+95
-96
lines changed

3 files changed

+95
-96
lines changed

client/packages/lowcoder/src/comps/comps/autoCompleteComp/autoCompleteComp.tsx

Lines changed: 93 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import React, { useEffect, useState } from "react";
2-
import { Input, Section, sectionNames } from "lowcoder-design";
3-
import { BoolControl } from "comps/controls/boolControl";
4-
import { styleControl } from "comps/controls/styleControl";
1+
import React, {useEffect, useState} from 'react';
2+
import {Input, Section, sectionNames} from 'lowcoder-design';
3+
import {BoolControl} from 'comps/controls/boolControl';
4+
import {styleControl} from 'comps/controls/styleControl';
55
import {
66
InputFieldStyle,
77
InputLikeStyle,
88
InputLikeStyleType,
99
LabelStyle,
10-
} from "comps/controls/styleControlConstants";
10+
} from 'comps/controls/styleControlConstants';
1111
import {
1212
NameConfig,
1313
NameConfigPlaceHolder,
1414
NameConfigRequired,
1515
withExposingConfigs,
16-
} from "comps/generators/withExposing";
17-
import styled, { css } from "styled-components";
18-
import { UICompBuilder } from "../../generators";
19-
import { FormDataPropertyView } from "../formComp/formDataConstants";
20-
import { jsonControl } from "comps/controls/codeControl";
21-
import { dropdownControl } from "comps/controls/dropdownControl";
16+
} from 'comps/generators/withExposing';
17+
import styled, {css} from 'styled-components';
18+
import {UICompBuilder} from '../../generators';
19+
import {FormDataPropertyView} from '../formComp/formDataConstants';
20+
import {jsonControl} from 'comps/controls/codeControl';
21+
import {dropdownControl} from 'comps/controls/dropdownControl';
2222
import {
2323
getStyle,
2424
TextInputBasicSection,
@@ -27,23 +27,21 @@ import {
2727
TextInputInteractionSection,
2828
textInputValidate,
2929
TextInputValidationSection,
30-
} from "../textInputComp/textInputConstants";
30+
} from '../textInputComp/textInputConstants';
3131
import {
3232
allowClearPropertyView,
3333
hiddenPropertyView,
34-
} from "comps/utils/propertyUtils";
35-
import { trans } from "i18n";
36-
import { IconControl } from "comps/controls/iconControl";
37-
import { hasIcon } from "comps/utils";
38-
import { InputRef } from "antd/es/input";
39-
import { default as ConfigProvider } from "antd/es/config-provider";
40-
import { default as AutoComplete } from "antd/es/auto-complete";
41-
import { RefControl } from "comps/controls/refControl";
42-
import {
43-
booleanExposingStateControl,
44-
} from "comps/controls/codeStateControl";
34+
} from 'comps/utils/propertyUtils';
35+
import {trans} from 'i18n';
36+
import {IconControl} from 'comps/controls/iconControl';
37+
import {hasIcon} from 'comps/utils';
38+
import {InputRef} from 'antd/es/input';
39+
import {default as ConfigProvider} from 'antd/es/config-provider';
40+
import {default as AutoComplete} from 'antd/es/auto-complete';
41+
import {RefControl} from 'comps/controls/refControl';
42+
import {booleanExposingStateControl} from 'comps/controls/codeStateControl';
4543

46-
import { getDayJSLocale } from "i18n/dayjsLocale";
44+
import {getDayJSLocale} from 'i18n/dayjsLocale';
4745
import {
4846
autoCompleteDate,
4947
itemsDataTooltip,
@@ -53,51 +51,51 @@ import {
5351
autoCompleteType,
5452
autocompleteIconColor,
5553
componentSize,
56-
} from "./autoCompleteConstants";
57-
58-
54+
} from './autoCompleteConstants';
5955

60-
const InputStyle = styled(Input)<{ $style: InputLikeStyleType }>`
61-
${(props) => css`
62-
${getStyle(props.$style)}
63-
input {
64-
padding: ${props.style?.padding};
65-
}
66-
.ant-select-single {
67-
width: 100% !important;
68-
}
69-
`}
56+
const InputStyle = styled(Input)<{$style: InputLikeStyleType}>`
57+
${(props) => {
58+
return css`
59+
${getStyle(props.$style)}
60+
input {
61+
padding: ${props.style?.padding};
62+
rotate: ${props?.$style?.rotation};
63+
}
64+
.ant-select-single {
65+
width: 100% !important;
66+
}
67+
`;
68+
}}
7069
`;
7170

72-
7371
const childrenMap = {
7472
...textInputChildren,
7573
viewRef: RefControl<InputRef>,
7674
allowClear: BoolControl.DEFAULT_TRUE,
7775
style: styleControl(InputFieldStyle),
78-
labelStyle:styleControl(LabelStyle),
76+
labelStyle: styleControl(LabelStyle),
7977
prefixIcon: IconControl,
8078
suffixIcon: IconControl,
8179
items: jsonControl(convertAutoCompleteData, autoCompleteDate),
8280
ignoreCase: BoolControl.DEFAULT_TRUE,
8381
searchFirstPY: BoolControl.DEFAULT_TRUE,
8482
searchCompletePY: BoolControl,
8583
searchLabelOnly: BoolControl.DEFAULT_TRUE,
86-
valueOrLabel: dropdownControl(valueOrLabelOption, "label"),
87-
autoCompleteType: dropdownControl(autoCompleteType, "normal"),
88-
autocompleteIconColor: dropdownControl(autocompleteIconColor, "blue"),
89-
componentSize: dropdownControl(componentSize, "small"),
90-
valueInItems: booleanExposingStateControl("valueInItems"),
84+
valueOrLabel: dropdownControl(valueOrLabelOption, 'label'),
85+
autoCompleteType: dropdownControl(autoCompleteType, 'normal'),
86+
autocompleteIconColor: dropdownControl(autocompleteIconColor, 'blue'),
87+
componentSize: dropdownControl(componentSize, 'small'),
88+
valueInItems: booleanExposingStateControl('valueInItems'),
9189
inputFieldStyle: styleControl(InputLikeStyle),
9290
};
9391

94-
const getValidate = (value: any): "" | "warning" | "error" | undefined => {
92+
const getValidate = (value: any): '' | 'warning' | 'error' | undefined => {
9593
if (
96-
value.hasOwnProperty("validateStatus") &&
97-
value["validateStatus"] === "error"
94+
value.hasOwnProperty('validateStatus') &&
95+
value['validateStatus'] === 'error'
9896
)
99-
return "error";
100-
return "";
97+
return 'error';
98+
return '';
10199
};
102100

103101
let AutoCompleteCompBase = (function () {
@@ -115,11 +113,10 @@ let AutoCompleteCompBase = (function () {
115113
autocompleteIconColor,
116114
componentSize,
117115
} = props;
118-
119116

120117
const getTextInputValidate = () => {
121118
return {
122-
value: { value: props.value.value },
119+
value: {value: props.value.value},
123120
required: props.required,
124121
minLength: props?.minLength ?? 0,
125122
maxLength: props?.maxLength ?? 0,
@@ -134,7 +131,7 @@ let AutoCompleteCompBase = (function () {
134131
const [validateState, setvalidateState] = useState({});
135132

136133
// 是否中文环境
137-
const [chineseEnv, setChineseEnv] = useState(getDayJSLocale() === "zh-cn");
134+
const [chineseEnv, setChineseEnv] = useState(getDayJSLocale() === 'zh-cn');
138135

139136
useEffect(() => {
140137
setsearchtext(props.value.value);
@@ -162,32 +159,32 @@ let AutoCompleteCompBase = (function () {
162159
borderRadius: parseInt(props.inputFieldStyle.radius),
163160
colorText: props.inputFieldStyle.text,
164161
colorPrimary: props.inputFieldStyle.accent,
165-
controlHeight: componentSize === "small" ? 30 : 38,
162+
controlHeight: componentSize === 'small' ? 30 : 38,
166163
},
167164
}}
168165
>
169-
<AutoComplete
166+
<AutoComplete
170167
disabled={props.disabled}
171168
value={searchtext}
172-
options={items}
173-
style={{ width: "100%" }}
169+
options={items}
170+
style={{width: '100%'}}
174171
onChange={(value: string, option) => {
175172
props.valueInItems.onChange(false);
176173
setvalidateState(textInputValidate(getTextInputValidate()));
177174
setsearchtext(value);
178-
props.value.onChange(value);
179-
props.onEvent("change")
180-
}}
175+
props.value.onChange(value);
176+
props.onEvent('change');
177+
}}
181178
onFocus={() => {
182-
setActivationFlag(true)
183-
props.onEvent("focus")
179+
setActivationFlag(true);
180+
props.onEvent('focus');
184181
}}
185-
onBlur={() => props.onEvent("blur")}
182+
onBlur={() => props.onEvent('blur')}
186183
onSelect={(data: string, option) => {
187184
setsearchtext(option[valueOrLabel]);
188185
props.valueInItems.onChange(true);
189186
props.value.onChange(option[valueOrLabel]);
190-
props.onEvent("submit");
187+
props.onEvent('submit');
191188
}}
192189
filterOption={(inputValue: string, option) => {
193190
if (ignoreCase) {
@@ -207,7 +204,7 @@ let AutoCompleteCompBase = (function () {
207204
searchFirstPY &&
208205
option?.label &&
209206
option.label
210-
.spell("first")
207+
.spell('first')
211208
.toString()
212209
.toLowerCase()
213210
.indexOf(inputValue.toLowerCase()) >= 0
@@ -245,7 +242,7 @@ let AutoCompleteCompBase = (function () {
245242
searchFirstPY &&
246243
option?.value &&
247244
option.value
248-
.spell("first")
245+
.spell('first')
249246
.toString()
250247
.toLowerCase()
251248
.indexOf(inputValue.toLowerCase()) >= 0
@@ -266,62 +263,62 @@ let AutoCompleteCompBase = (function () {
266263
return false;
267264
}}
268265
>
269-
<InputStyle
270-
ref={props.viewRef}
271-
placeholder={placeholder}
272-
allowClear={props.allowClear}
273-
$style={props.inputFieldStyle}
274-
prefix={hasIcon(props.prefixIcon) && props.prefixIcon}
275-
suffix={hasIcon(props.suffixIcon) && props.suffixIcon}
276-
status={getValidate(validateState)}
277-
onPressEnter={undefined}
278-
/>
266+
<InputStyle
267+
ref={props.viewRef}
268+
placeholder={placeholder}
269+
allowClear={props.allowClear}
270+
$style={props.inputFieldStyle}
271+
prefix={hasIcon(props.prefixIcon) && props.prefixIcon}
272+
suffix={hasIcon(props.suffixIcon) && props.suffixIcon}
273+
status={getValidate(validateState)}
274+
onPressEnter={undefined}
275+
/>
279276
</AutoComplete>
280277
</ConfigProvider>
281278
</>
282279
),
283280
style: props.style,
284281
labelStyle: props.labelStyle,
285-
inputFieldStyle:props.inputFieldStyle,
282+
inputFieldStyle: props.inputFieldStyle,
286283
...validateState,
287284
});
288285
})
289286
.setPropertyViewFn((children) => {
290287
return (
291288
<>
292289
<Section>
293-
{children.autoCompleteType.getView() === "normal" &&
290+
{children.autoCompleteType.getView() === 'normal' &&
294291
children.prefixIcon.propertyView({
295-
label: trans("button.prefixIcon"),
292+
label: trans('button.prefixIcon'),
296293
})}
297-
{children.autoCompleteType.getView() === "normal" &&
294+
{children.autoCompleteType.getView() === 'normal' &&
298295
children.suffixIcon.propertyView({
299-
label: trans("button.suffixIcon"),
296+
label: trans('button.suffixIcon'),
300297
})}
301-
{allowClearPropertyView(children)}
298+
{allowClearPropertyView(children)}
302299
</Section>
303-
<Section name={trans("autoComplete.SectionDataName")}>
300+
<Section name={trans('autoComplete.SectionDataName')}>
304301
{children.items.propertyView({
305-
label: trans("autoComplete.value"),
302+
label: trans('autoComplete.value'),
306303
tooltip: itemsDataTooltip,
307-
placeholder: "[]",
304+
placeholder: '[]',
308305
})}
309-
{getDayJSLocale() === "zh-cn" &&
306+
{getDayJSLocale() === 'zh-cn' &&
310307
children.searchFirstPY.propertyView({
311-
label: trans("autoComplete.searchFirstPY"),
308+
label: trans('autoComplete.searchFirstPY'),
312309
})}
313-
{getDayJSLocale() === "zh-cn" &&
310+
{getDayJSLocale() === 'zh-cn' &&
314311
children.searchCompletePY.propertyView({
315-
label: trans("autoComplete.searchCompletePY"),
312+
label: trans('autoComplete.searchCompletePY'),
316313
})}
317314
{children.searchLabelOnly.propertyView({
318-
label: trans("autoComplete.searchLabelOnly"),
315+
label: trans('autoComplete.searchLabelOnly'),
319316
})}
320317
{children.ignoreCase.propertyView({
321-
label: trans("autoComplete.ignoreCase"),
318+
label: trans('autoComplete.ignoreCase'),
322319
})}
323320
{children.valueOrLabel.propertyView({
324-
label: trans("autoComplete.checkedValueFrom"),
321+
label: trans('autoComplete.checkedValueFrom'),
325322
radioButton: true,
326323
})}
327324
</Section>
@@ -352,8 +349,8 @@ let AutoCompleteCompBase = (function () {
352349
})
353350
.setExposeMethodConfigs(autoCompleteRefMethods)
354351
.setExposeStateConfigs([
355-
new NameConfig("value", trans("export.inputValueDesc")),
356-
new NameConfig("valueInItems", trans("autoComplete.valueInItems")),
352+
new NameConfig('value', trans('export.inputValueDesc')),
353+
new NameConfig('valueInItems', trans('autoComplete.valueInItems')),
357354
NameConfigPlaceHolder,
358355
NameConfigRequired,
359356
...TextInputConfigs,
@@ -368,9 +365,9 @@ AutoCompleteCompBase = class extends AutoCompleteCompBase {
368365
};
369366

370367
export const AutoCompleteComp = withExposingConfigs(AutoCompleteCompBase, [
371-
new NameConfig("value", trans("export.inputValueDesc")),
372-
new NameConfig("valueInItems", trans("autoComplete.valueInItems")),
368+
new NameConfig('value', trans('export.inputValueDesc')),
369+
new NameConfig('valueInItems', trans('autoComplete.valueInItems')),
373370
NameConfigPlaceHolder,
374-
NameConfigRequired,
371+
NameConfigRequired,
375372
...TextInputConfigs,
376373
]);

client/packages/lowcoder/src/comps/controls/labelControl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const LabelViewWrapper = styled.div<{$style: any; inputFieldStyle: any}>`
5757
props.$style && {
5858
...props.$style,
5959
borderRadius: props.$style.radius,
60+
rotate: props.$style.rotation,
6061
boxShadow: `${props.$style.boxShadow} ${props.$style.boxShadowColor}`,
6162
}
6263
);

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,7 @@ const STYLING_FIELDS_CONTAINER_SEQUENCE = [
679679
BOXSHADOW,
680680
BOXSHADOWCOLOR,
681681
ANIMATIONITERATIONCOUNT,
682+
ROTATION,
682683
];
683684

684685
const FILL = {

0 commit comments

Comments
 (0)