|
1 | | -import { |
2 | | - changeChildAction, |
3 | | - DispatchType, |
4 | | - RecordConstructorToComp, |
5 | | - RecordConstructorToView, |
6 | | -} from "lowcoder-core"; |
| 1 | +import { RecordConstructorToComp } from "lowcoder-core"; |
7 | 2 | import { BoolControl } from "../../controls/boolControl";
|
8 | 3 | import { LabelControl } from "../../controls/labelControl";
|
9 | 4 | 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"; |
21 | 6 | 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"; |
52 | 9 | import { RefControl } from "comps/controls/refControl";
|
53 | 10 | import { BaseSelectRef } from "rc-select";
|
54 | 11 | import { refMethods } from "comps/generators/withMethodExposing";
|
55 | 12 | import { blurMethod, focusMethod } from "comps/utils/methodUtils";
|
56 | | - |
57 | | -import { useContext } from "react"; |
58 | 13 | import { EditorContext } from "comps/editorState";
|
59 | 14 | import { TourStepControl } from "@lowcoder-ee/comps/controls/tourStepControl";
|
60 | 15 | import { booleanExposingStateControl } from "lowcoder-sdk";
|
61 | 16 |
|
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 | | - |
153 | 17 | export const TourChildrenMap = {
|
154 | 18 | label: LabelControl,
|
155 | 19 | placeholder: StringControl,
|
156 | 20 | disabled: BoolCodeControl,
|
157 | 21 | open: booleanExposingStateControl("open"),
|
158 | 22 | onEvent: SelectEventHandlerControl,
|
159 | 23 | options: TourStepControl,
|
160 | | - allowClear: BoolControl, |
161 | 24 | inputValue: stateComp<string>(""), // user's input value when search
|
162 | 25 | showSearch: BoolControl.DEFAULT_TRUE,
|
163 | 26 | viewRef: RefControl<BaseSelectRef>,
|
164 | | - margin: MarginControl, |
165 | | - padding: PaddingControl, |
166 | | - ...SelectInputValidationChildren, |
167 | | - ...formDataChildren, |
168 | 27 | };
|
169 | 28 |
|
170 | 29 | export const TourPropertyView = (
|
171 | 30 | children: RecordConstructorToComp<
|
172 | 31 | typeof TourChildrenMap & {
|
173 | 32 | hidden: typeof BoolCodeControl;
|
174 | 33 | }
|
175 | | - > & { |
176 | | - defaultValue: { propertyView: (params: ControlParams) => ControlNode }; |
177 | | - value: { propertyView: (params: ControlParams) => ControlNode }; |
178 | | - style: { getPropertyView: () => ControlNode }; |
179 | | - } |
| 34 | + > //& { |
| 35 | + // style: { getPropertyView: () => ControlNode }; |
| 36 | + // } |
180 | 37 | ) => (
|
181 | 38 | <>
|
182 | 39 | <Section name={sectionNames.basic}>
|
183 | 40 | {children.options.propertyView({})}
|
184 | | - {children.defaultValue.propertyView({ |
185 | | - label: trans("prop.defaultValue"), |
186 | | - })} |
187 | | - {placeholderPropertyView(children)} |
188 | 41 | </Section>
|
189 | 42 |
|
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 | + {/*)}*/} |
197 | 50 | </>
|
198 | 51 | );
|
199 | 52 |
|
|
0 commit comments