Skip to content

Commit 7d41fee

Browse files
committed
radio btn and select option setting adjusted
1 parent 8e672cb commit 7d41fee

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

client/packages/lowcoder/src/comps/comps/selectInputComp/radioComp.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,53 +14,53 @@ import { trans } from "i18n";
1414
import { fixOldInputCompData } from "../textInputComp/textInputConstants";
1515
import { migrateOldData } from "comps/generators/simpleGenerators";
1616

17-
const getStyle = (style: RadioStyleType) => {
17+
const getStyle = (style: RadioStyleType, inputFieldStyle?:RadioStyleType ) => {
1818
return css`
1919
.ant-radio-wrapper:not(.ant-radio-wrapper-disabled) {
20-
color: ${style.staticText};
20+
color: ${inputFieldStyle?.staticText};
2121
// height: 22px;
2222
max-width: calc(100% - 8px);
23-
padding: ${style.padding};
23+
padding: ${inputFieldStyle?.padding};
2424
span:not(.ant-radio) {
2525
${EllipsisTextCss};
26-
font-family:${style.fontFamily};
27-
font-size:${style.textSize};
28-
font-weight:${style.textWeight};
29-
font-style:${style.fontStyle};
30-
text-transform:${style.textTransform};
31-
text-decoration:${style.textDecoration};
26+
font-family:${inputFieldStyle?.fontFamily};
27+
font-size:${inputFieldStyle?.textSize};
28+
font-weight:${inputFieldStyle?.textWeight};
29+
font-style:${inputFieldStyle?.fontStyle};
30+
text-transform:${inputFieldStyle?.textTransform};
31+
text-decoration:${inputFieldStyle?.textDecoration};
3232
}
3333
3434
.ant-radio-checked {
3535
.ant-radio-inner {
36-
background-color: ${style.checkedBackground};
37-
border-color: ${style.checkedBackground};
36+
background-color: ${inputFieldStyle?.checkedBackground};
37+
border-color: ${inputFieldStyle?.uncheckedBorder};
3838
}
3939
4040
&::after {
41-
border-color: ${style.checkedBackground};
41+
border-color: ${inputFieldStyle?.uncheckedBorder};
4242
}
4343
}
4444
4545
.ant-radio-inner {
46-
background-color: ${style.uncheckedBackground};
47-
border-color: ${style.uncheckedBorder};
48-
border-width:${style.borderWidth};
46+
background-color: ${inputFieldStyle?.uncheckedBackground};
47+
border-color: ${inputFieldStyle?.uncheckedBorder};
48+
border-width:${inputFieldStyle?.borderWidth};
4949
&::after {
50-
background-color: ${style.checked};
50+
background-color: ${inputFieldStyle?.checked};
5151
}
5252
}
5353
5454
&:hover .ant-radio-inner,
5555
.ant-radio:hover .ant-radio-inner,
5656
.ant-radio-input + ant-radio-inner {
57-
background-color:${style.hoverBackground ? style.hoverBackground:'#ffff'};
57+
background-color:${inputFieldStyle?.hoverBackground ? inputFieldStyle?.hoverBackground:'#ffff'};
5858
}
5959
6060
&:hover .ant-radio-inner,
6161
.ant-radio:hover .ant-radio-inner,
6262
.ant-radio-input:focus + .ant-radio-inner {
63-
border-color: ${style.checkedBackground};
63+
border-color: ${inputFieldStyle?.uncheckedBorder};
6464
}
6565
}
6666
`;
@@ -69,11 +69,12 @@ const getStyle = (style: RadioStyleType) => {
6969
const Radio = styled(AntdRadioGroup)<{
7070
$style: RadioStyleType;
7171
$layout: ValueFromOption<typeof RadioLayoutOptions>;
72+
$inputFieldStyle:RadioStyleType
7273
}>`
7374
width: 100%;
7475
min-height: 32px;
7576
76-
${(props) => props.$style && getStyle(props.$style)}
77+
${(props) => props.$style && getStyle(props.$style, props.$inputFieldStyle)}
7778
${(props) => {
7879
if (props.$layout === "horizontal") {
7980
return css`
@@ -112,6 +113,7 @@ let RadioBasicComp = (function () {
112113
disabled={props.disabled}
113114
value={props.value.value}
114115
$style={props.style}
116+
$inputFieldStyle={props.inputFieldStyle}
115117
$layout={props.layout}
116118
onChange={(e) => {
117119
handleChange(e.target.value);

client/packages/lowcoder/src/comps/comps/selectInputComp/radioCompConstants.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { RefControl } from "comps/controls/refControl";
2222

2323
import { useContext } from "react";
2424
import { EditorContext } from "comps/editorState";
25+
import { withDefault } from "@lowcoder-ee/index.sdk";
2526

2627
export const RadioLayoutOptions = [
2728
{ label: trans("radio.horizontal"), value: "horizontal" },
@@ -40,7 +41,7 @@ export const RadioChildrenMap = {
4041
labelStyle:styleControl(LabelStyle),
4142
layout: dropdownControl(RadioLayoutOptions, "horizontal"),
4243
viewRef: RefControl<HTMLDivElement>,
43-
inputFieldStyle:styleControl(RadioStyle),
44+
inputFieldStyle:withDefault(styleControl(RadioStyle),{borderWidth: '1px'}),
4445
...SelectInputValidationChildren,
4546
...formDataChildren,
4647
};

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ const TEXT_WEIGHT = {
389389
const HOVER_BACKGROUND_COLOR = {
390390
name: "hoverBackground",
391391
label: trans("style.hoverBackground"),
392-
hoverBackground: "hoverBackground"
392+
hoverBackground: "hoverBackground",
393+
color: SECOND_SURFACE_COLOR,
393394
}
394395

395396
const FONT_FAMILY = {
@@ -980,7 +981,7 @@ export const MultiSelectStyle = [
980981

981982
export const ChildrenMultiSelectStyle = [
982983
...STYLING_FIELDS_SEQUENCE,
983-
getStaticBackground(SURFACE_COLOR)
984+
getBackground()
984985
] as const;
985986

986987
export const TabContainerStyle = [
@@ -1033,6 +1034,7 @@ function checkAndUncheck() {
10331034
name: "uncheckedBorder",
10341035
label: trans("style.uncheckedBorder"),
10351036
depName: "uncheckedBackground",
1037+
color:SECOND_SURFACE_COLOR,
10361038
transformer: backgroundToBorder,
10371039
},
10381040
] as const;

0 commit comments

Comments
 (0)