hy-virtual-tree 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +13 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hy-virtual-tree v2.0.
|
|
1
|
+
/* hy-virtual-tree v2.0.1 */
|
|
2
2
|
import './svg_bundle.js';
|
|
3
3
|
const isString = (e) => typeof e === 'string';
|
|
4
4
|
const isNumber = (e) => typeof e === 'number';
|
|
@@ -6708,8 +6708,8 @@ const setElementFocus = (config) => {
|
|
|
6708
6708
|
const getElement = (vnode) => {
|
|
6709
6709
|
return vnode.el;
|
|
6710
6710
|
};
|
|
6711
|
-
const createVNode = (
|
|
6712
|
-
const el = document.createElement(
|
|
6711
|
+
const createVNode = (arg, render) => {
|
|
6712
|
+
const el = isString(arg) ? document.createElement(arg) : arg;
|
|
6713
6713
|
let target = {
|
|
6714
6714
|
el,
|
|
6715
6715
|
children: [],
|
|
@@ -9020,6 +9020,12 @@ const customRender = (options) => {
|
|
|
9020
9020
|
value = fn(node.data, node);
|
|
9021
9021
|
}
|
|
9022
9022
|
if (isObject(value) && value.el) {
|
|
9023
|
+
// 处理从外部传入的节点
|
|
9024
|
+
if (!value.mount) {
|
|
9025
|
+
value = createVNode(value.el, (vnode) => {
|
|
9026
|
+
vnode.$destroy = value.$destroy;
|
|
9027
|
+
});
|
|
9028
|
+
}
|
|
9023
9029
|
className && value.el.classList.add(className);
|
|
9024
9030
|
parent && value.mount(parent);
|
|
9025
9031
|
return value;
|
|
@@ -9761,10 +9767,10 @@ class VirtualTree {
|
|
|
9761
9767
|
rightSlot = customRender({ fn: config.renderRight, node: item, inset: true, className: 'hy-tree-node__right-content' });
|
|
9762
9768
|
if (!statusSlot && !rightSlot)
|
|
9763
9769
|
return;
|
|
9764
|
-
return createVNode('div', (
|
|
9765
|
-
|
|
9766
|
-
statusSlot && statusSlot.mount(
|
|
9767
|
-
rightSlot && rightSlot.mount(
|
|
9770
|
+
return createVNode('div', (vnode) => {
|
|
9771
|
+
vnode.el.classList.add('hy-tree-node__right');
|
|
9772
|
+
statusSlot && statusSlot.mount(vnode);
|
|
9773
|
+
rightSlot && rightSlot.mount(vnode);
|
|
9768
9774
|
});
|
|
9769
9775
|
};
|
|
9770
9776
|
/** 设置节点class */
|