hy-virtual-tree 2.0.11 → 2.0.13

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Changelog
2
2
 
3
+ ### 2.0.13
4
+
5
+ _2026-05-07_
6
+
7
+ (1)新增 showExpand 参数,用来控制是否显示展开图标
8
+
9
+ ### 2.0.12
10
+
11
+ _2026-04-20_
12
+
13
+ (1)修复树形customRender函数,处理从外部传入的没有挂载方法的节点的问题
14
+
3
15
  ### 2.0.11
4
16
 
5
17
  _2026-03-25_
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* hy-virtual-tree v2.0.11 */
1
+ /* hy-virtual-tree v2.0.13 */
2
2
  import './svg_bundle.js';
3
3
  const isString = (e) => typeof e === 'string';
4
4
  const isNumber = (e) => typeof e === 'number';
@@ -6709,7 +6709,7 @@ const getElement = (vnode) => {
6709
6709
  return vnode.el;
6710
6710
  };
6711
6711
  const createVNode = (arg, render) => {
6712
- const el = isString(arg) ? document.createElement(arg) : arg;
6712
+ const el = isElement(arg) ? arg : document.createElement(arg);
6713
6713
  let target = {
6714
6714
  el,
6715
6715
  children: [],
@@ -7968,6 +7968,7 @@ const useConfig = (config) => {
7968
7968
  // checkOnClickLeaf: true,
7969
7969
  // checkOnDblclickParentNode: true,
7970
7970
  // indent: 16,
7971
+ showExpand: true,
7971
7972
  ...getGlobalVirtualTreeConfig(),
7972
7973
  ...config,
7973
7974
  props,
@@ -8259,7 +8260,6 @@ function useCheck(props, instance) {
8259
8260
  if (instance._hiddenNodeKeySet.has(node.key) || (tree.hiddenNodeKeySet.has(node.key) && nodeClick))
8260
8261
  return;
8261
8262
  }
8262
- console.log('???', checked);
8263
8263
  checkedKeySet[checked ? 'add' : 'delete'](node.key);
8264
8264
  const children = node.children;
8265
8265
  if ((!checkStrictly || checkOnDbclick) && children) {
@@ -9041,7 +9041,8 @@ const customRender = (options) => {
9041
9041
  if (isObject(value) && value.el) {
9042
9042
  // 处理从外部传入的没有挂载方法的节点
9043
9043
  if (!value.mount) {
9044
- value = createVNode(value.el, (vnode) => {
9044
+ value = createVNode('div', (vnode) => {
9045
+ vnode.el.appendChild(value.el);
9045
9046
  vnode.$destroy = value.$destroy;
9046
9047
  });
9047
9048
  }
@@ -9461,6 +9462,7 @@ class VirtualTree {
9461
9462
  hiddenNodeKeySet: new Set()
9462
9463
  };
9463
9464
  _rowSelection = {};
9465
+ _showExpand = true;
9464
9466
  _business;
9465
9467
  _expandedKeySet = new Set(); // 展开的key
9466
9468
  _hiddenExpandIconKeySet = new Set(); // 隐藏展开图标
@@ -9503,6 +9505,7 @@ class VirtualTree {
9503
9505
  this._getKey = getKey;
9504
9506
  this._businessConfig = config.businessConfig;
9505
9507
  this._rowSelection = config.rowSelection;
9508
+ this._showExpand = isBoolean(config.showExpand) ? config.showExpand : true;
9506
9509
  this._render(config);
9507
9510
  }
9508
9511
  /** 创建树数据 */
@@ -9873,7 +9876,10 @@ class VirtualTree {
9873
9876
  && item.data.deviceStatus === 0) {
9874
9877
  contentContainer.el.style.color = config.placeholderColor;
9875
9878
  }
9876
- contentContainer.el.appendChild(generateExpandIcon(item));
9879
+ if (this._showExpand) {
9880
+ const expandIcon = generateExpandIcon(item);
9881
+ contentContainer.el.appendChild(expandIcon);
9882
+ }
9877
9883
  // 多选框/单选框
9878
9884
  generateCheckbox(contentContainer, item);
9879
9885
  // 整个节点内容
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",