feat: add VirtualScroll tree

pull/4577/head
tangjinzhou 2021-08-25 22:31:46 +08:00
parent 18295ea0d7
commit 9785531e54
4 changed files with 9 additions and 14 deletions

View File

@ -199,6 +199,7 @@ export default defineComponent({
selectable,
fieldNames = props.replaceFields,
motion = props.openAnimation,
itemHeight = 20,
} = props;
const newProps = {
...attrs,
@ -207,13 +208,13 @@ export default defineComponent({
dropIndicatorRender,
fieldNames,
icon,
itemHeight,
};
return (
<VcTree
itemHeight={20}
virtual={virtual.value}
{...newProps}
virtual={virtual.value}
motion={motion}
ref={treeRef}
prefixCls={prefixCls.value}

View File

@ -561,9 +561,10 @@ export default defineComponent({
}
// [Legacy] Not found related usage in doc or upper libs
const keyEntitiesValue = keyEntities.value;
const selectedNodes = newSelectedKeys
.map(selectedKey => {
const entity = keyEntities.value[selectedKey];
const entity = keyEntitiesValue[selectedKey];
if (!entity) return null;
return entity.node;
@ -605,8 +606,9 @@ export default defineComponent({
const newHalfCheckedKeys = arrDel(halfCheckedKeys.value, key);
checkedObj = { checked: newCheckedKeys, halfChecked: newHalfCheckedKeys };
const keyEntitiesValue = keyEntities.value;
eventObj.checkedNodes = newCheckedKeys
.map(checkedKey => keyEntities.value[checkedKey])
.map(checkedKey => keyEntitiesValue[checkedKey])
.filter(entity => entity)
.map(entity => entity.node);
@ -829,14 +831,6 @@ export default defineComponent({
}
};
// const getActiveItem = () => {
// if (activeKey.value === null) {
// return null;
// }
// return flattenNodes.value.find(({ data: { key } }) => key === activeKey.value) || null;
// };
const activeItem = computed<FlattenNode>(() => {
if (activeKey.value === null) {
return null;

View File

@ -36,7 +36,7 @@ export default function useHeights<T>(
const origin = instance.get(key);
if (ins) {
instance.set(key, ins);
instance.set(key, (ins as any).$el || ins);
collectHeight();
} else {
instance.delete(key);

2
v2-doc

@ -1 +1 @@
Subproject commit bf82708b6f320f1e9b185c6eba58b4ce08593fc3
Subproject commit e7db31900631a7da14f40b7f2ab0e3f266a26e00