mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-23 18:50:06 +08:00
feat: Tree add indentWidth token (#50989)
This commit is contained in:
parent
a172d070c9
commit
9c3478ed77
@ -48,6 +48,7 @@ const App: React.FC = () => {
|
||||
Tree: {
|
||||
nodeHoverBg: '#fff2f0',
|
||||
nodeSelectedBg: '#ffa39e',
|
||||
indentWidth: 80,
|
||||
},
|
||||
},
|
||||
}}
|
||||
|
@ -13,6 +13,11 @@ export interface TreeSharedToken {
|
||||
* @descEN Node title height
|
||||
*/
|
||||
titleHeight: number;
|
||||
/**
|
||||
* @desc 缩进宽度
|
||||
* @descEN Indent width of tree
|
||||
*/
|
||||
indentWidth?: 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,
|
||||
indentWidth,
|
||||
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: indentWidth,
|
||||
},
|
||||
},
|
||||
|
||||
@ -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,
|
||||
indentWidth: titleHeight,
|
||||
nodeHoverBg: controlItemBgHover,
|
||||
nodeSelectedBg: controlItemBgActive,
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user