Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/renderless/src/dialog-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ const getTreeRadio = (vm) => {
const currentRadio = vm.$refs.multiTree.state.currentRadio
const plainNode = find(plainNodes, (plainNode) => plainNode.node.id === currentRadio.value)

return [plainNode.node.data]
return plainNode?.node ? [plainNode.node.data] : []
}

export const multiTreeCheck =
Expand Down
28 changes: 22 additions & 6 deletions packages/renderless/src/tree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,27 @@ export const dragEnd =
dragState.showDropIndicator = false
}

const afterLoadHandler =
({ state, emit, props, api }) =>
(params) => {
const { lazy, afterLoad, showRadio } = props
state.loaded = true
if (lazy) {
if (state.root) {
state.root.childNodes = [...state.root.childNodes]
}

if (showRadio) {
api.setCurrentRadio()
}
}
emit('load-data', params)

if (typeof afterLoad === 'function') {
afterLoad(params)
}
}

export const initTreeStore =
({ api, props, state, emit }) =>
() => {
Expand All @@ -280,12 +301,7 @@ export const initTreeStore =
lazy,
props: props.props,
load,
afterLoad(params) {
!state.loaded && (state.loaded = true)
lazy && state.root && (state.root.childNodes = [...state.root.childNodes])
emit('load-data', params)
afterLoad && afterLoad(params)
},
afterLoad: afterLoadHandler({ api, emit, props, state }),
currentNodeKey,
checkStrictly,
checkDescendants,
Expand Down
2 changes: 1 addition & 1 deletion packages/theme/src/tree-menu/vars.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
// 节点序号字号
--tree-menu-node-number-font-size: var(--ti-common-font-size-base);
// 活跃节点竖线与文本的间距
--tree-menu-node-vertical-line-margin-right: var(--ti-common-size-5x);
--tree-menu-node-vertical-line-margin-right: var(--ti-common-size-4x);
}
9 changes: 1 addition & 8 deletions packages/theme/src/tree/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,6 @@
}
}

&.is-root {
.@{tree-node-prefix-cls}__content-box {
padding-left: 0;
}
}

&.is-leaf:not(.is-root) {
.@{tree-node-prefix-cls}__content {
Expand Down Expand Up @@ -354,7 +349,7 @@
}
}

& label.@{css-prefix}checkbox {
& label.@{css-prefix}checkbox, .@{css-prefix}radio {
margin: 0 calc(var(--ti-tree-node-label-margin-left) / 2);
}

Expand Down Expand Up @@ -478,8 +473,6 @@
}

.@{radio-prefix-cls} {
margin-right: 0;

.@{radio-prefix-cls}__label {
display: none;
}
Expand Down