mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 19:49:59 +08:00
feat: Tree add indentSize token (#51010)
This commit is contained in:
parent
c20c70d905
commit
4303e5e28a
@ -48,6 +48,7 @@ const App: React.FC = () => {
|
||||
Tree: {
|
||||
nodeHoverBg: '#fff2f0',
|
||||
nodeSelectedBg: '#ffa39e',
|
||||
indentSize: 80,
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
@ -13,6 +13,11 @@ export interface TreeSharedToken {
|
||||
* @descEN Node title height
|
||||
*/
|
||||
titleHeight: number;
|
||||
/**
|
||||
* @desc 缩进宽度
|
||||
* @descEN Indent width of tree
|
||||
*/
|
||||
indentSize?: number;
|
||||
/**
|
||||
* @desc 节点悬浮态背景色
|
||||
* @descEN Background color of hovered node
|
||||
@ -94,7 +99,15 @@ type TreeToken = FullToken<'Tree'> & {
|
||||
};
|
||||
|
||||
export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject => {
|
||||
const { treeCls, treeNodeCls, treeNodePadding, titleHeight, nodeSelectedBg, nodeHoverBg } = token;
|
||||
const {
|
||||
treeCls,
|
||||
treeNodeCls,
|
||||
treeNodePadding,
|
||||
titleHeight,
|
||||
indentSize,
|
||||
nodeSelectedBg,
|
||||
nodeHoverBg,
|
||||
} = token;
|
||||
const treeCheckBoxMarginHorizontal = token.paddingXS;
|
||||
|
||||
return {
|
||||
@ -223,7 +236,7 @@ export const genBaseStyle = (prefixCls: string, token: TreeToken): CSSObject =>
|
||||
userSelect: 'none',
|
||||
'&-unit': {
|
||||
display: 'inline-block',
|
||||
width: titleHeight,
|
||||
width: indentSize,
|
||||
},
|
||||
},
|
||||
|
||||
@ -534,12 +547,14 @@ export const genTreeStyle = (
|
||||
};
|
||||
|
||||
export const initComponentToken = (token: AliasToken): TreeSharedToken => {
|
||||
const { controlHeightSM } = token;
|
||||
const { controlHeightSM, controlItemBgHover, controlItemBgActive } = token;
|
||||
const titleHeight = controlHeightSM;
|
||||
|
||||
return {
|
||||
titleHeight: controlHeightSM,
|
||||
nodeHoverBg: token.controlItemBgHover,
|
||||
nodeSelectedBg: token.controlItemBgActive,
|
||||
titleHeight,
|
||||
indentSize: titleHeight,
|
||||
nodeHoverBg: controlItemBgHover,
|
||||
nodeSelectedBg: controlItemBgActive,
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user