hy-virtual-tree 2.0.7 → 2.0.8
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 +6 -0
- package/dist/index.js +11 -31
- 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.8 */
|
|
2
2
|
import './svg_bundle.js';
|
|
3
3
|
const isString = (e) => typeof e === 'string';
|
|
4
4
|
const isNumber = (e) => typeof e === 'number';
|
|
@@ -9024,7 +9024,7 @@ const generateStats = (data, node) => {
|
|
|
9024
9024
|
};
|
|
9025
9025
|
// 自定义渲染元素
|
|
9026
9026
|
const customRender = (options) => {
|
|
9027
|
-
const { fn, node, parent, className, defaultFn
|
|
9027
|
+
const { fn, node, parent, className, defaultFn } = options || {};
|
|
9028
9028
|
let value;
|
|
9029
9029
|
// 没有传入的自定义函数则使用默认函数
|
|
9030
9030
|
if (!fn || !isFunction(fn)) {
|
|
@@ -9054,32 +9054,14 @@ const customRender = (options) => {
|
|
|
9054
9054
|
return value;
|
|
9055
9055
|
}
|
|
9056
9056
|
else if (isElement(value)) {
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
});
|
|
9062
|
-
}
|
|
9063
|
-
else {
|
|
9064
|
-
className && value.classList.add(className);
|
|
9057
|
+
return createVNode('div', (vnode) => {
|
|
9058
|
+
className && vnode.el.classList.add(className);
|
|
9059
|
+
vnode.el.appendChild(value);
|
|
9060
|
+
vnode.$destroy = value.$destroy;
|
|
9065
9061
|
if (parent) {
|
|
9066
|
-
|
|
9067
|
-
parent.el.appendChild(value);
|
|
9068
|
-
}
|
|
9069
|
-
const target = {
|
|
9070
|
-
el: value,
|
|
9071
|
-
destroy: () => {
|
|
9072
|
-
// @ts-ignore
|
|
9073
|
-
value && value.$destroy && value.$destroy();
|
|
9074
|
-
// @ts-ignore
|
|
9075
|
-
value && value.destroy && value.destroy();
|
|
9076
|
-
}
|
|
9077
|
-
};
|
|
9078
|
-
if (!parent.children)
|
|
9079
|
-
parent.children = [];
|
|
9080
|
-
parent.children.push(target);
|
|
9062
|
+
vnode.mount(parent);
|
|
9081
9063
|
}
|
|
9082
|
-
}
|
|
9064
|
+
});
|
|
9083
9065
|
}
|
|
9084
9066
|
if (isEmpty(value))
|
|
9085
9067
|
return;
|
|
@@ -9776,7 +9758,6 @@ class VirtualTree {
|
|
|
9776
9758
|
statusSlot = customRender({
|
|
9777
9759
|
fn: config.renderStatus,
|
|
9778
9760
|
node: item,
|
|
9779
|
-
inset: true,
|
|
9780
9761
|
className: 'hy-tree-node__status',
|
|
9781
9762
|
defaultFn: (data, node) => {
|
|
9782
9763
|
return useStatus(config, data);
|
|
@@ -9784,7 +9765,7 @@ class VirtualTree {
|
|
|
9784
9765
|
});
|
|
9785
9766
|
}
|
|
9786
9767
|
// 右侧内容
|
|
9787
|
-
rightSlot = customRender({ fn: config.renderRight, node: item,
|
|
9768
|
+
rightSlot = customRender({ fn: config.renderRight, node: item, className: 'hy-tree-node__right-content' });
|
|
9788
9769
|
if (!statusSlot && !rightSlot)
|
|
9789
9770
|
return;
|
|
9790
9771
|
return createVNode('div', (vnode) => {
|
|
@@ -9895,14 +9876,13 @@ class VirtualTree {
|
|
|
9895
9876
|
customRender({
|
|
9896
9877
|
fn: config.renderItem,
|
|
9897
9878
|
node: item,
|
|
9898
|
-
inset: true,
|
|
9899
9879
|
parent: contentContainer,
|
|
9900
9880
|
className: 'hy-tree-node__node-content',
|
|
9901
9881
|
defaultFn: (data, node) => {
|
|
9902
9882
|
// 图标
|
|
9903
|
-
customRender({ fn: config.renderIcon, node,
|
|
9883
|
+
customRender({ fn: config.renderIcon, node, parent: contentContainer, className: 'hy-tree-icon', defaultFn: generateIcon });
|
|
9904
9884
|
// 内容
|
|
9905
|
-
customRender({ fn: config.renderContent, node,
|
|
9885
|
+
customRender({ fn: config.renderContent, node, parent: contentContainer, className: 'hy-tree-node__content', defaultFn: useContent });
|
|
9906
9886
|
// 统计
|
|
9907
9887
|
if (isShowCount(this._props.showCount, item)) {
|
|
9908
9888
|
customRender({ fn: generateStats, node, parent: contentContainer });
|