Skip to content

Commit 643e286

Browse files
committed
More cleanup
1 parent ff89495 commit 643e286

File tree

3 files changed

+50
-198
lines changed

3 files changed

+50
-198
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
withMethodExposing
1111
} from "lowcoder-sdk";
1212
import { baseSelectRefMethods, TourChildrenMap, TourPropertyView } from "./tourCompConstants";
13-
import { TourInputCommonConfig, TourInputInvalidConfig } from "./tourInputConstants";
13+
import { TourInputCommonConfig } from "./tourInputConstants";
1414
import { Tour, TourProps } from "antd";
1515

1616
/**
@@ -21,7 +21,7 @@ let TourBasicComp = (function () {
2121
...TourChildrenMap,
2222
defaultValue: stringExposingStateControl("defaultValue"),
2323
value: stringExposingStateControl("value"),
24-
style: styleControl(SelectStyle),
24+
// style: styleControl(SelectStyle),
2525
};
2626
return new UICompBuilder(childrenMap, (props, dispatch) => {
2727

@@ -60,7 +60,6 @@ TourBasicComp = withMethodExposing(TourBasicComp, [
6060
export const TourComp = withExposingConfigs(TourBasicComp, [
6161
new NameConfig("value", trans("selectInput.valueDesc")),
6262
new NameConfig("inputValue", trans("select.inputValueDesc")),
63-
TourInputInvalidConfig,
6463
...TourInputCommonConfig,
6564
...CommonNameConfig,
6665
]);

client/packages/lowcoder/src/comps/comps/tourComp/tourCompConstants.tsx

Lines changed: 14 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,52 @@
1-
import {
2-
changeChildAction,
3-
DispatchType,
4-
RecordConstructorToComp,
5-
RecordConstructorToView,
6-
} from "lowcoder-core";
1+
import { RecordConstructorToComp } from "lowcoder-core";
72
import { BoolControl } from "../../controls/boolControl";
83
import { LabelControl } from "../../controls/labelControl";
94
import { BoolCodeControl, StringControl } from "../../controls/codeControl";
10-
import { PaddingControl } from "../../controls/paddingControl";
11-
import { MarginControl } from "../../controls/marginControl";
12-
import {
13-
ControlNode,
14-
isDarkColor,
15-
lightenColor,
16-
MultiselectTagIcon,
17-
Section,
18-
sectionNames,
19-
} from "lowcoder-design";
20-
import { SelectOptionControl } from "../../controls/optionsControl";
5+
import { ControlNode, Section, sectionNames } from "lowcoder-design";
216
import { SelectEventHandlerControl } from "../../controls/eventHandlerControl";
22-
import { default as AntdSelect } from "antd/es/select";
23-
import { ControlParams } from "../../controls/controlParams";
24-
import { ReactNode } from "react";
25-
import styled, { css } from "styled-components";
26-
import {
27-
SelectInputValidationChildren,
28-
SelectInputValidationSection,
29-
} from "./tourInputConstants";
30-
import {
31-
formDataChildren,
32-
FormDataPropertyView,
33-
} from "../formComp/formDataConstants";
34-
import {
35-
CascaderStyleType,
36-
MultiSelectStyleType,
37-
SelectStyleType,
38-
TreeSelectStyleType,
39-
widthCalculator,
40-
heightCalculator,
41-
} from "comps/controls/styleControlConstants";
42-
import { stateComp, withDefault } from "../../generators";
43-
import {
44-
allowClearPropertyView,
45-
disabledPropertyView,
46-
hiddenPropertyView,
47-
placeholderPropertyView,
48-
showSearchPropertyView,
49-
} from "comps/utils/propertyUtils";
50-
import { trans } from "i18n";
51-
import { hasIcon } from "comps/utils";
7+
import { useContext } from "react";
8+
import { stateComp } from "../../generators";
529
import { RefControl } from "comps/controls/refControl";
5310
import { BaseSelectRef } from "rc-select";
5411
import { refMethods } from "comps/generators/withMethodExposing";
5512
import { blurMethod, focusMethod } from "comps/utils/methodUtils";
56-
57-
import { useContext } from "react";
5813
import { EditorContext } from "comps/editorState";
5914
import { TourStepControl } from "@lowcoder-ee/comps/controls/tourStepControl";
6015
import { booleanExposingStateControl } from "lowcoder-sdk";
6116

62-
export const getStyle = (
63-
style:
64-
| SelectStyleType
65-
| MultiSelectStyleType
66-
| CascaderStyleType
67-
| TreeSelectStyleType
68-
) => {
69-
return css`
70-
&.ant-select .ant-select-selector,
71-
&.ant-select-multiple .ant-select-selection-item {
72-
border-radius: ${style.radius};
73-
padding: ${style.padding};
74-
height: auto;
75-
}
76-
.ant-select-selection-search {
77-
padding: ${style.padding};
78-
}
79-
.ant-select-selection-search-input {
80-
font-family:${(style as SelectStyleType).fontFamily} !important;
81-
text-transform:${(style as SelectStyleType).textTransform} !important;
82-
text-decoration:${(style as SelectStyleType).textDecoration} !important;
83-
font-size:${(style as SelectStyleType).textSize} !important;
84-
font-weight:${(style as SelectStyleType).textWeight};
85-
color:${(style as SelectStyleType).text} !important;
86-
font-style:${(style as SelectStyleType).fontStyle};
87-
}
88-
.ant-select-selector::after,
89-
.ant-select-selection-placeholder,
90-
.ant-select-selection-item {
91-
line-height: 1.5715 !important;
92-
}
93-
94-
&.ant-select:not(.ant-select-disabled) {
95-
color: ${style.text};
96-
.ant-select-selection-placeholder,
97-
.ant-select-selection-item {
98-
line-height: 1.5715 !important;
99-
}
100-
.ant-select-selection-placeholder,
101-
&.ant-select-single.ant-select-open .ant-select-selection-item {
102-
color: ${style.text};
103-
opacity: 0.4;
104-
width: 100%;
105-
}
106-
107-
.ant-select-selector {
108-
background-color: ${style.background};
109-
border-color: ${style.border};
110-
border-width:${(style as SelectStyleType).borderWidth};
111-
}
112-
113-
&.ant-select-focused,
114-
&:hover {
115-
.ant-select-selector {
116-
border-color: ${style.accent};
117-
}
118-
}
119-
120-
.ant-select-arrow,
121-
.ant-select-clear {
122-
background-color: ${style.background};
123-
color: ${style.text === "#222222"
124-
? "#8B8FA3"
125-
: isDarkColor(style.text)
126-
? lightenColor(style.text, 0.2)
127-
: style.text};
128-
}
129-
130-
.ant-select-clear:hover {
131-
color: ${style.text === "#222222"
132-
? "#8B8FA3"
133-
: isDarkColor(style.text)
134-
? lightenColor(style.text, 0.1)
135-
: style.text};
136-
}
137-
138-
&.ant-select-multiple .ant-select-selection-item {
139-
border: none;
140-
background-color: ${(style as MultiSelectStyleType).tags};
141-
color: ${(style as MultiSelectStyleType).tagsText};
142-
border-radius: ${style.radius};
143-
144-
.ant-select-selection-item-remove {
145-
color: ${(style as MultiSelectStyleType).tagsText};
146-
opacity: 0.5;
147-
}
148-
}
149-
}
150-
`;
151-
};
152-
15317
export const TourChildrenMap = {
15418
label: LabelControl,
15519
placeholder: StringControl,
15620
disabled: BoolCodeControl,
15721
open: booleanExposingStateControl("open"),
15822
onEvent: SelectEventHandlerControl,
15923
options: TourStepControl,
160-
allowClear: BoolControl,
16124
inputValue: stateComp<string>(""), // user's input value when search
16225
showSearch: BoolControl.DEFAULT_TRUE,
16326
viewRef: RefControl<BaseSelectRef>,
164-
margin: MarginControl,
165-
padding: PaddingControl,
166-
...SelectInputValidationChildren,
167-
...formDataChildren,
16827
};
16928

17029
export const TourPropertyView = (
17130
children: RecordConstructorToComp<
17231
typeof TourChildrenMap & {
17332
hidden: typeof BoolCodeControl;
17433
}
175-
> & {
176-
defaultValue: { propertyView: (params: ControlParams) => ControlNode };
177-
value: { propertyView: (params: ControlParams) => ControlNode };
178-
style: { getPropertyView: () => ControlNode };
179-
}
34+
> //& {
35+
// style: { getPropertyView: () => ControlNode };
36+
// }
18037
) => (
18138
<>
18239
<Section name={sectionNames.basic}>
18340
{children.options.propertyView({})}
184-
{children.defaultValue.propertyView({
185-
label: trans("prop.defaultValue"),
186-
})}
187-
{placeholderPropertyView(children)}
18841
</Section>
18942

190-
{["layout", "both"].includes(
191-
useContext(EditorContext).editorModeStatus
192-
) && (
193-
<Section name={sectionNames.style}>
194-
{children.style.getPropertyView()}
195-
</Section>
196-
)}
43+
{/*{["layout", "both"].includes(*/}
44+
{/* useContext(EditorContext).editorModeStatus*/}
45+
{/*) && (*/}
46+
{/* <Section name={sectionNames.style}>*/}
47+
{/* {children.style.getPropertyView()}*/}
48+
{/* </Section>*/}
49+
{/*)}*/}
19750
</>
19851
);
19952

client/packages/lowcoder/src/comps/comps/tourComp/tourInputConstants.tsx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ import { SelectInputOptionControl } from "../../controls/optionsControl";
1616
import { refMethods } from "comps/generators/withMethodExposing";
1717
import { blurMethod, focusWithOptions } from "comps/utils/methodUtils";
1818
import { TourStepControl } from "@lowcoder-ee/comps/controls/tourStepControl";
19-
20-
export const SelectInputValidationChildren = {
21-
required: BoolControl,
22-
customRule: CustomRuleControl,
23-
};
24-
type ValidationComp = RecordConstructorToComp<typeof SelectInputValidationChildren>;
19+
//
20+
// export const SelectInputValidationChildren = {
21+
// required: BoolControl,
22+
// customRule: CustomRuleControl,
23+
// };
24+
// type ValidationComp = RecordConstructorToComp<typeof SelectInputValidationChildren>;
2525

2626
type SelectValue = string | (string | number)[];
2727
type ValidationParams = {
@@ -97,35 +97,35 @@ export const useSelectInputValidate = (props: ValidationParams) => {
9797
] as const;
9898
};
9999

100-
type ValidationCompWithValue = ValidationComp & {
101-
value: ConstructorToComp<
102-
ReturnType<
103-
| typeof stringExposingStateControl
104-
| typeof arrayStringExposingStateControl
105-
| typeof jsonExposingStateControl<(string | number)[]>
106-
>
107-
>;
108-
};
109-
export const TourInputInvalidConfig = depsConfig<
110-
ValidationCompWithValue,
111-
ChildrenTypeToDepsKeys<ValidationCompWithValue>
112-
>({
113-
name: "invalid",
114-
desc: trans("export.invalidDesc"),
115-
depKeys: ["value", "required", "customRule"],
116-
func: (input) =>
117-
selectInputValidate({
118-
...input,
119-
value: { value: input.value },
120-
}).validateStatus !== "success",
121-
});
100+
// type ValidationCompWithValue = ValidationComp & {
101+
// value: ConstructorToComp<
102+
// ReturnType<
103+
// | typeof stringExposingStateControl
104+
// | typeof arrayStringExposingStateControl
105+
// | typeof jsonExposingStateControl<(string | number)[]>
106+
// >
107+
// >;
108+
// };
109+
// export const TourInputInvalidConfig = depsConfig<
110+
// ValidationCompWithValue,
111+
// ChildrenTypeToDepsKeys<ValidationCompWithValue>
112+
// >({
113+
// name: "invalid",
114+
// desc: trans("export.invalidDesc"),
115+
// depKeys: ["value", "required", "customRule"],
116+
// func: (input) =>
117+
// selectInputValidate({
118+
// ...input,
119+
// value: { value: input.value },
120+
// }).validateStatus !== "success",
121+
// });
122122

123-
export const SelectInputValidationSection = (children: ValidationComp) => (
124-
<Section name={sectionNames.validation}>
125-
{requiredPropertyView(children)}
126-
{children.customRule.propertyView({})}
127-
</Section>
128-
);
123+
// export const SelectInputValidationSection = (children: ValidationComp) => (
124+
// <Section name={sectionNames.validation}>
125+
// {requiredPropertyView(children)}
126+
// {children.customRule.propertyView({})}
127+
// </Section>
128+
// );
129129

130130
type ChildrenType = RecordConstructorToComp<{
131131
value: ReturnType<typeof stringExposingStateControl>;

0 commit comments

Comments
 (0)