@aplus-frontend/ui
Version:
140 lines (139 loc) • 3.96 kB
JavaScript
import { genComponentStyleHook as o } from "../../utils/cssinjs/index.mjs";
const l = (n) => {
const { componentCls: e, namespace: t, antdv: i } = n, r = `${e}--disabled`, a = n.calc(n.controlHeight).sub(n.calc(n.lineWidth).mul(2)).equal();
return {
[e]: {
// bordered
"&--bordered": {
boxSizing: "border-box",
border: `${n.lineWidth} ${n.lineType} ${n.borderColorBase}`,
borderRadius: n.borderRadius,
paddingInline: n.space,
".ant-input-affix-wrapper": {
padding: 0
},
[`&:has(.${t}-batch-input-group):has(.ant-select)`]: {
".ant-input-affix-wrapper": {
paddingInlineEnd: n.space
}
},
"&:has(textarea.ant-input)": {
paddingInlineEnd: 0,
".ant-input": {
paddingInlineStart: 0
}
},
[`&:has(div.${t}-batch-input-group .ant-input)`]: {
paddingInlineEnd: n.space,
".ant-input": {
paddingInlineStart: 0
}
},
".ant-picker": {
padding: 0
},
".ant-form-item-control-input-content": {
"& > .ant-input-group": {
"& > .ant-picker-range:nth-child(1)": {
".ant-picker-clear": {
insetInlineEnd: 0
}
}
}
},
".ant-space-compact-block": {
".ant-input": {
paddingInlineStart: n.space
}
},
".ant-select-selector": {
borderWidth: "0 !important",
boxShadow: "none !important",
background: "unset !important"
},
".ant-select-single .ant-select-selector": {
height: `${a} !important`
},
"input.ant-input-number-input": {
paddingInlineStart: 0
},
"&:has(.ant-input-number)": {
paddingInlineEnd: 0
},
"&:has(.ant-select)": {
paddingInlineEnd: 0,
".ant-form-item-label > label": {
paddingInlineEnd: n.spaceXS
}
},
"div.ant-form-item-control": {
flex: "1 1 0",
minWidth: 0
},
".ant-form-item-label > label": {
paddingRight: n.spaceLG,
height: a,
"&::after": {
margin: 0
}
},
".ant-form-item-control-input": {
minHeight: a,
".ant-select-single": {
height: "unset"
}
},
[`&:hover:not(${r})`]: {
borderColor: n.hoverColorBase
},
"&:focus": {
borderColor: n.activeColorBase,
boxShadow: `0 0 0 2px ${n.calc(i.controlOutline).colorMix(10)}`
},
[`.${t}-batch-input-group-popover-input__popover`]: {
width: "calc(100% + 12px)"
}
},
// disabled
"&--disabled": {
cursor: "not-allowed",
backgroundColor: n.colorBgDisabled,
".ant-select-selector": {
backgroundColor: "transparent !important"
}
},
// focus
"&--focused": {
borderColor: n.activeColorBase,
boxShadow: `0 0 0 2px ${n.calc(i.controlOutline).colorMix(10)}`
},
// other
".ant-form-show-help": {
".ant-form-item-explain-error": {
fontSize: n.fontSize,
lineHeight: n.lineHeightSM
}
},
".ant-col .ant-form-item-extra": {
lineHeight: n.lineHeightLG,
minHeight: "unset",
marginBlockStart: n.spaceXS,
marginBlockEnd: n.spaceLG
},
".ant-input-group": {
".ant-picker:only-child": {
width: "100%"
},
// tips: 针对包含时区切换的日期选择器
".ant-select + .ant-picker": {
paddingInline: n.space,
flex: 1
}
}
}
};
}, d = o("ApForm", (n) => [l(n)]);
export {
d as default,
l as genApFormItemStyle
};