果冻橙
2 years ago
committed by
GitHub
6 changed files with 157 additions and 130 deletions
@ -1,57 +0,0 @@
|
||||
@import '../../style/themes/index'; |
||||
@import '../../style/mixins/index'; |
||||
@import '../../tree/style/mixin'; |
||||
@import '../../checkbox/style/mixin'; |
||||
|
||||
@tree-select-prefix-cls: ~'@{ant-prefix}-tree-select'; |
||||
@select-tree-prefix-cls: ~'@{ant-prefix}-select-tree'; |
||||
|
||||
.antCheckboxFn(@checkbox-prefix-cls: ~'@{select-tree-prefix-cls}-checkbox'); |
||||
|
||||
.@{tree-select-prefix-cls} { |
||||
// ======================= Dropdown ======================= |
||||
&-dropdown { |
||||
padding: @padding-xs (@padding-xs / 2); |
||||
|
||||
&-rtl { |
||||
direction: rtl; |
||||
} |
||||
// ======================== Tree ======================== |
||||
.@{select-tree-prefix-cls} { |
||||
border-radius: 0; |
||||
|
||||
&-list-holder-inner { |
||||
align-items: stretch; |
||||
|
||||
.@{select-tree-prefix-cls}-treenode { |
||||
.@{select-tree-prefix-cls}-node-content-wrapper { |
||||
flex: auto; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.@{select-tree-prefix-cls} { |
||||
.antTreeFn(@select-tree-prefix-cls); |
||||
|
||||
// change switcher icon rotation in rtl direction |
||||
& &-switcher { |
||||
&_close { |
||||
.@{select-tree-prefix-cls}-switcher-icon { |
||||
svg { |
||||
.@{tree-select-prefix-cls}-dropdown-rtl & { |
||||
transform: rotate(90deg); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
&-loading-icon { |
||||
.@{tree-select-prefix-cls}-dropdown-rtl & { |
||||
transform: scaleY(-1); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,7 +1,74 @@
|
||||
import '../../style/index.less'; |
||||
import './index.less'; |
||||
import type { Ref } from 'vue'; |
||||
import { getStyle as getCheckboxStyle } from '../../checkbox/style'; |
||||
import type { AliasToken, FullToken, GenerateStyle } from '../../theme/internal'; |
||||
import { genComponentStyleHook, mergeToken } from '../../theme/internal'; |
||||
import { genTreeStyle } from '../../tree/style'; |
||||
|
||||
// style dependencies |
||||
// deps-lint-skip: tree, form |
||||
import '../../select/style'; |
||||
import '../../empty/style'; |
||||
interface TreeSelectToken extends FullToken<'TreeSelect'> { |
||||
treePrefixCls: string; |
||||
} |
||||
|
||||
// =============================== Base =============================== |
||||
const genBaseStyle: GenerateStyle<TreeSelectToken> = token => { |
||||
const { componentCls, treePrefixCls, colorBgElevated } = token; |
||||
const treeCls = `.${treePrefixCls}`; |
||||
|
||||
return [ |
||||
// ====================================================== |
||||
// == Dropdown == |
||||
// ====================================================== |
||||
{ |
||||
[`${componentCls}-dropdown`]: [ |
||||
{ |
||||
padding: `${token.paddingXS}px ${token.paddingXS / 2}px`, |
||||
}, |
||||
|
||||
// ====================== Tree ====================== |
||||
genTreeStyle( |
||||
treePrefixCls, |
||||
mergeToken<AliasToken>(token, { colorBgContainer: colorBgElevated }), |
||||
), |
||||
{ |
||||
[treeCls]: { |
||||
borderRadius: 0, |
||||
'&-list-holder-inner': { |
||||
alignItems: 'stretch', |
||||
|
||||
[`${treeCls}-treenode`]: { |
||||
[`${treeCls}-node-content-wrapper`]: { |
||||
flex: 'auto', |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
|
||||
// ==================== Checkbox ==================== |
||||
getCheckboxStyle(`${treePrefixCls}-checkbox`, token), |
||||
|
||||
// ====================== RTL ======================= |
||||
{ |
||||
'&-rtl': { |
||||
direction: 'rtl', |
||||
|
||||
[`${treeCls}-switcher${treeCls}-switcher_close`]: { |
||||
[`${treeCls}-switcher-icon svg`]: { |
||||
transform: 'rotate(90deg)', |
||||
}, |
||||
}, |
||||
}, |
||||
}, |
||||
], |
||||
}, |
||||
]; |
||||
}; |
||||
|
||||
// ============================== Export ============================== |
||||
export default function useTreeSelectStyle(prefixCls: Ref<string>, treePrefixCls: Ref<string>) { |
||||
return genComponentStyleHook('TreeSelect', token => { |
||||
const treeSelectToken = mergeToken<TreeSelectToken>(token, { |
||||
treePrefixCls: treePrefixCls.value, |
||||
}); |
||||
return [genBaseStyle(treeSelectToken)]; |
||||
})(prefixCls); |
||||
} |
||||
|
Loading…
Reference in new issue