You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.3 KiB
74 lines
2.3 KiB
3 years ago
|
import { getStyle as getCheckboxStyle } from '../../checkbox/style';
|
||
2 years ago
|
import type { AliasToken, FullToken, GenerateStyle } from '../../theme/internal';
|
||
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
||
3 years ago
|
import { genTreeStyle } from '../../tree/style';
|
||
|
|
||
3 years ago
|
interface TreeSelectToken extends FullToken<'TreeSelect'> {
|
||
3 years ago
|
treePrefixCls: string;
|
||
|
}
|
||
|
|
||
|
// =============================== Base ===============================
|
||
2 years ago
|
const genBaseStyle: GenerateStyle<TreeSelectToken> = (token) => {
|
||
2 years ago
|
const { componentCls, treePrefixCls, colorBgElevated } = token;
|
||
3 years ago
|
const treeCls = `.${treePrefixCls}`;
|
||
|
|
||
|
return [
|
||
|
// ======================================================
|
||
|
// == Dropdown ==
|
||
|
// ======================================================
|
||
|
{
|
||
3 years ago
|
[`${componentCls}-dropdown`]: [
|
||
3 years ago
|
{
|
||
|
padding: `${token.paddingXS}px ${token.paddingXS / 2}px`,
|
||
|
},
|
||
|
|
||
|
// ====================== Tree ======================
|
||
2 years ago
|
genTreeStyle(
|
||
|
treePrefixCls,
|
||
2 years ago
|
mergeToken<AliasToken>(token, { colorBgContainer: colorBgElevated }),
|
||
2 years ago
|
),
|
||
3 years ago
|
{
|
||
|
[treeCls]: {
|
||
|
borderRadius: 0,
|
||
|
'&-list-holder-inner': {
|
||
|
alignItems: 'stretch',
|
||
|
|
||
|
[`${treeCls}-treenode`]: {
|
||
|
[`${treeCls}-node-content-wrapper`]: {
|
||
|
flex: 'auto',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
|
||
|
// ==================== Checkbox ====================
|
||
3 years ago
|
getCheckboxStyle(`${treePrefixCls}-checkbox`, token),
|
||
3 years ago
|
|
||
|
// ====================== RTL =======================
|
||
|
{
|
||
|
'&-rtl': {
|
||
|
direction: 'rtl',
|
||
|
|
||
|
[`${treeCls}-switcher${treeCls}-switcher_close`]: {
|
||
|
[`${treeCls}-switcher-icon svg`]: {
|
||
|
transform: 'rotate(90deg)',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
];
|
||
|
};
|
||
|
|
||
|
// ============================== Export ==============================
|
||
3 years ago
|
export default function useTreeSelectStyle(prefixCls: string, treePrefixCls: string) {
|
||
2 years ago
|
return genComponentStyleHook('TreeSelect', (token) => {
|
||
3 years ago
|
const treeSelectToken = mergeToken<TreeSelectToken>(token, {
|
||
3 years ago
|
treePrefixCls,
|
||
3 years ago
|
});
|
||
3 years ago
|
return [genBaseStyle(treeSelectToken)];
|
||
3 years ago
|
})(prefixCls);
|
||
3 years ago
|
}
|