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-04-11 16:04:00 +08:00
|
|
|
import { GenerateStyle, genComponentStyleHook, FullToken, 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-03-11 14:29:29 +08:00
|
|
|
const genBaseStyle: GenerateStyle<TreeSelectToken> = (token, hashId) => {
|
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-03-11 14:29:29 +08:00
|
|
|
genTreeStyle(treePrefixCls, token, hashId!),
|
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-03-11 14:29:29 +08:00
|
|
|
getCheckboxStyle(`${treePrefixCls}-checkbox`, token, hashId!),
|
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) {
|
|
|
|
return genComponentStyleHook('TreeSelect', (token, { hashId }) => {
|
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-07 12:20:34 +08:00
|
|
|
return [genBaseStyle(treeSelectToken, hashId)];
|
|
|
|
})(prefixCls);
|
2022-03-09 15:33:39 +08:00
|
|
|
}
|