2022-03-09 15:33:39 +08:00
|
|
|
// import '../../style/index.less';
|
|
|
|
// import './index.less';
|
2016-04-27 20:44:36 +08:00
|
|
|
|
2022-03-09 15:33:39 +08:00
|
|
|
// // style dependencies
|
|
|
|
// // deps-lint-skip: tree, form
|
|
|
|
// import '../../select/style';
|
|
|
|
// import '../../empty/style';
|
|
|
|
|
|
|
|
// deps-lint-skip-all
|
2022-05-09 22:20:07 +08:00
|
|
|
import type { GenerateStyle, FullToken } from '../../_util/theme';
|
|
|
|
import { genComponentStyleHook, mergeToken } from '../../_util/theme';
|
2022-03-09 15:33:39 +08:00
|
|
|
import { getStyle as getCheckboxStyle } from '../../checkbox/style';
|
|
|
|
import { genTreeStyle } from '../../tree/style';
|
|
|
|
|
2022-04-07 12:20:34 +08:00
|
|
|
interface TreeSelectToken extends FullToken<'TreeSelect'> {
|
2022-03-09 15:33:39 +08:00
|
|
|
treePrefixCls: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// =============================== Base ===============================
|
2022-04-21 02:06:22 +08:00
|
|
|
const genBaseStyle: GenerateStyle<TreeSelectToken> = token => {
|
2022-04-07 12:20:34 +08:00
|
|
|
const { componentCls, treePrefixCls } = token;
|
2022-03-09 15:33:39 +08:00
|
|
|
const treeCls = `.${treePrefixCls}`;
|
|
|
|
|
|
|
|
return [
|
|
|
|
// ======================================================
|
|
|
|
// == Dropdown ==
|
|
|
|
// ======================================================
|
|
|
|
{
|
2022-04-07 12:20:34 +08:00
|
|
|
[`${componentCls}-dropdown`]: [
|
2022-03-09 15:33:39 +08:00
|
|
|
{
|
|
|
|
padding: `${token.paddingXS}px ${token.paddingXS / 2}px`,
|
|
|
|
},
|
|
|
|
|
|
|
|
// ====================== Tree ======================
|
2022-04-21 02:06:22 +08:00
|
|
|
genTreeStyle(treePrefixCls, token),
|
2022-03-09 15:33:39 +08:00
|
|
|
{
|
|
|
|
[treeCls]: {
|
|
|
|
borderRadius: 0,
|
|
|
|
'&-list-holder-inner': {
|
|
|
|
alignItems: 'stretch',
|
|
|
|
|
|
|
|
[`${treeCls}-treenode`]: {
|
|
|
|
[`${treeCls}-node-content-wrapper`]: {
|
|
|
|
flex: 'auto',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// ==================== Checkbox ====================
|
2022-04-21 02:06:22 +08:00
|
|
|
getCheckboxStyle(`${treePrefixCls}-checkbox`, token),
|
2022-03-09 15:33:39 +08:00
|
|
|
|
|
|
|
// ====================== RTL =======================
|
|
|
|
{
|
|
|
|
'&-rtl': {
|
|
|
|
direction: 'rtl',
|
|
|
|
|
|
|
|
[`${treeCls}-switcher${treeCls}-switcher_close`]: {
|
|
|
|
[`${treeCls}-switcher-icon svg`]: {
|
|
|
|
transform: 'rotate(90deg)',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
// ============================== Export ==============================
|
2022-04-07 12:20:34 +08:00
|
|
|
export default function useTreeSelectStyle(prefixCls: string, treePrefixCls: string) {
|
2022-04-21 02:06:22 +08:00
|
|
|
return genComponentStyleHook('TreeSelect', token => {
|
2022-04-11 16:04:00 +08:00
|
|
|
const treeSelectToken = mergeToken<TreeSelectToken>(token, {
|
2022-04-07 12:20:34 +08:00
|
|
|
treePrefixCls,
|
2022-04-11 16:04:00 +08:00
|
|
|
});
|
2022-04-21 02:06:22 +08:00
|
|
|
return [genBaseStyle(treeSelectToken)];
|
2022-04-07 12:20:34 +08:00
|
|
|
})(prefixCls);
|
2022-03-09 15:33:39 +08:00
|
|
|
}
|