vxe-pc-ui 4.21.0 → 4.21.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.
Files changed (78) hide show
  1. package/dist/all.esm.js +442 -98
  2. package/dist/all.esm.min.js +3 -3
  3. package/dist/style.css +137 -29
  4. package/dist/style.mini.css +1 -1
  5. package/es/esm.index.d.ts +7 -0
  6. package/es/esm.index.js +8 -0
  7. package/es/icon/style.css +43 -4
  8. package/es/icon/style.mini.css +1 -1
  9. package/es/style.css +137 -29
  10. package/es/style.mini.css +1 -1
  11. package/es/tree/index.d.ts +14 -6
  12. package/es/tree/src/tree.d.ts +3 -1
  13. package/es/tree/src/tree.js +111 -48
  14. package/es/tree/src/util.d.ts +5 -0
  15. package/es/tree/src/util.js +97 -2
  16. package/es/tree/style.css +92 -23
  17. package/es/tree/style.mini.css +1 -1
  18. package/es/tree-select/src/tree-select.js +0 -4
  19. package/es/ui/index.js +15 -12
  20. package/es/ui/src/log.js +1 -1
  21. package/es/vxe-icon/style.css +43 -4
  22. package/es/vxe-icon/style.mini.css +1 -1
  23. package/es/vxe-tree/style.css +92 -23
  24. package/es/vxe-tree/style.mini.css +1 -1
  25. package/lib/esm.index.d.ts +7 -0
  26. package/lib/esm.index.js +39 -0
  27. package/lib/icon/style/style.css +43 -4
  28. package/lib/icon/style/style.mini.css +1 -1
  29. package/lib/index.umd.js +221 -97
  30. package/lib/index.umd.min.js +3 -3
  31. package/lib/style.css +137 -29
  32. package/lib/style.mini.css +1 -1
  33. package/lib/tree/index.d.ts +14 -6
  34. package/lib/tree/src/tree.d.ts +3 -1
  35. package/lib/tree/src/tree.js +110 -47
  36. package/lib/tree/src/util.d.ts +5 -0
  37. package/lib/tree/src/util.js +97 -2
  38. package/lib/tree/style/style.css +92 -23
  39. package/lib/tree/style/style.mini.css +1 -1
  40. package/lib/tree-select/src/tree-select.js +0 -4
  41. package/lib/ui/index.js +15 -12
  42. package/lib/ui/src/log.js +1 -1
  43. package/lib/vxe-icon/style/style.css +43 -4
  44. package/lib/vxe-icon/style/style.mini.css +1 -1
  45. package/lib/vxe-tree/style/style.css +92 -23
  46. package/lib/vxe-tree/style/style.mini.css +1 -1
  47. package/package.json +1 -1
  48. package/packages/esm.index.ts +10 -0
  49. package/packages/tree/src/tree.ts +129 -48
  50. package/packages/tree/src/util.ts +113 -1
  51. package/packages/tree-select/src/tree-select.ts +4 -4
  52. package/packages/ui/index.ts +14 -11
  53. package/styles/components/icon.scss +11 -3
  54. package/styles/components/tree.scss +138 -14
  55. package/styles/theme/base.scss +2 -2
  56. package/types/components/table.d.ts +1 -0
  57. package/types/components/tree.d.ts +34 -0
  58. /package/dist/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  59. /package/dist/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  60. /package/dist/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  61. /package/es/icon/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  62. /package/es/icon/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  63. /package/es/icon/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  64. /package/es/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  65. /package/es/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  66. /package/es/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  67. /package/es/vxe-icon/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  68. /package/es/vxe-icon/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  69. /package/es/vxe-icon/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  70. /package/lib/icon/style/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  71. /package/lib/icon/style/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  72. /package/lib/icon/style/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  73. /package/lib/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  74. /package/lib/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  75. /package/lib/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
  76. /package/lib/vxe-icon/style/{iconfont.1794558186564.ttf → iconfont.1794628246781.ttf} +0 -0
  77. /package/lib/vxe-icon/style/{iconfont.1794558186564.woff → iconfont.1794628246781.woff} +0 -0
  78. /package/lib/vxe-icon/style/{iconfont.1794558186564.woff2 → iconfont.1794628246781.woff2} +0 -0
@@ -62,6 +62,7 @@ export declare const VxeTree: {
62
62
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
63
63
  default: () => boolean | undefined;
64
64
  };
65
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
65
66
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
66
67
  indent: {
67
68
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -214,6 +215,7 @@ export declare const VxeTree: {
214
215
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
215
216
  default: () => boolean | undefined;
216
217
  };
218
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
217
219
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
218
220
  indent: {
219
221
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -314,7 +316,6 @@ export declare const VxeTree: {
314
316
  autoResize: boolean;
315
317
  showOverflow: boolean;
316
318
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
317
- indent: number;
318
319
  showRadio: boolean;
319
320
  showCheckbox: boolean;
320
321
  accordion: boolean;
@@ -328,6 +329,7 @@ export declare const VxeTree: {
328
329
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
329
330
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
330
331
  showLine: boolean;
332
+ indent: number;
331
333
  iconOpen: string;
332
334
  iconClose: string;
333
335
  iconLoaded: string;
@@ -400,6 +402,7 @@ export declare const VxeTree: {
400
402
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
401
403
  default: () => boolean | undefined;
402
404
  };
405
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
403
406
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
404
407
  indent: {
405
408
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -500,7 +503,6 @@ export declare const VxeTree: {
500
503
  autoResize: boolean;
501
504
  showOverflow: boolean;
502
505
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
503
- indent: number;
504
506
  showRadio: boolean;
505
507
  showCheckbox: boolean;
506
508
  accordion: boolean;
@@ -514,6 +516,7 @@ export declare const VxeTree: {
514
516
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
515
517
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
516
518
  showLine: boolean;
519
+ indent: number;
517
520
  iconOpen: string;
518
521
  iconClose: string;
519
522
  iconLoaded: string;
@@ -583,6 +586,7 @@ export declare const VxeTree: {
583
586
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
584
587
  default: () => boolean | undefined;
585
588
  };
589
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
586
590
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
587
591
  indent: {
588
592
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -683,7 +687,6 @@ export declare const VxeTree: {
683
687
  autoResize: boolean;
684
688
  showOverflow: boolean;
685
689
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
686
- indent: number;
687
690
  showRadio: boolean;
688
691
  showCheckbox: boolean;
689
692
  accordion: boolean;
@@ -697,6 +700,7 @@ export declare const VxeTree: {
697
700
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
698
701
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
699
702
  showLine: boolean;
703
+ indent: number;
700
704
  iconOpen: string;
701
705
  iconClose: string;
702
706
  iconLoaded: string;
@@ -766,6 +770,7 @@ export declare const Tree: {
766
770
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
767
771
  default: () => boolean | undefined;
768
772
  };
773
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
769
774
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
770
775
  indent: {
771
776
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -918,6 +923,7 @@ export declare const Tree: {
918
923
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
919
924
  default: () => boolean | undefined;
920
925
  };
926
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
921
927
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
922
928
  indent: {
923
929
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -1018,7 +1024,6 @@ export declare const Tree: {
1018
1024
  autoResize: boolean;
1019
1025
  showOverflow: boolean;
1020
1026
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
1021
- indent: number;
1022
1027
  showRadio: boolean;
1023
1028
  showCheckbox: boolean;
1024
1029
  accordion: boolean;
@@ -1032,6 +1037,7 @@ export declare const Tree: {
1032
1037
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
1033
1038
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
1034
1039
  showLine: boolean;
1040
+ indent: number;
1035
1041
  iconOpen: string;
1036
1042
  iconClose: string;
1037
1043
  iconLoaded: string;
@@ -1104,6 +1110,7 @@ export declare const Tree: {
1104
1110
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
1105
1111
  default: () => boolean | undefined;
1106
1112
  };
1113
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
1107
1114
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
1108
1115
  indent: {
1109
1116
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -1204,7 +1211,6 @@ export declare const Tree: {
1204
1211
  autoResize: boolean;
1205
1212
  showOverflow: boolean;
1206
1213
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
1207
- indent: number;
1208
1214
  showRadio: boolean;
1209
1215
  showCheckbox: boolean;
1210
1216
  accordion: boolean;
@@ -1218,6 +1224,7 @@ export declare const Tree: {
1218
1224
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
1219
1225
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
1220
1226
  showLine: boolean;
1227
+ indent: number;
1221
1228
  iconOpen: string;
1222
1229
  iconClose: string;
1223
1230
  iconLoaded: string;
@@ -1287,6 +1294,7 @@ export declare const Tree: {
1287
1294
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.ShowLine>;
1288
1295
  default: () => boolean | undefined;
1289
1296
  };
1297
+ lineConfig: import("vue").PropType<import("../../types").VxeTreePropTypes.LineConfig>;
1290
1298
  trigger: import("vue").PropType<import("../../types").VxeTreePropTypes.Trigger>;
1291
1299
  indent: {
1292
1300
  type: import("vue").PropType<import("../../types").VxeTreePropTypes.Indent>;
@@ -1387,7 +1395,6 @@ export declare const Tree: {
1387
1395
  autoResize: boolean;
1388
1396
  showOverflow: boolean;
1389
1397
  emptyText: import("../../types").VxeTreePropTypes.EmptyText;
1390
- indent: number;
1391
1398
  showRadio: boolean;
1392
1399
  showCheckbox: boolean;
1393
1400
  accordion: boolean;
@@ -1401,6 +1408,7 @@ export declare const Tree: {
1401
1408
  rootParentValue: import("../../types").VxeTreePropTypes.RootParentValue;
1402
1409
  rootValues: import("../../types").VxeTreePropTypes.RootValues;
1403
1410
  showLine: boolean;
1411
+ indent: number;
1404
1412
  iconOpen: string;
1405
1413
  iconClose: string;
1406
1414
  iconLoaded: string;
@@ -70,6 +70,7 @@ declare const _default: import("vue").DefineComponent<{
70
70
  type: PropType<VxeTreePropTypes.ShowLine>;
71
71
  default: () => boolean | undefined;
72
72
  };
73
+ lineConfig: PropType<VxeTreePropTypes.LineConfig>;
73
74
  trigger: PropType<VxeTreePropTypes.Trigger>;
74
75
  indent: {
75
76
  type: PropType<VxeTreePropTypes.Indent>;
@@ -210,6 +211,7 @@ declare const _default: import("vue").DefineComponent<{
210
211
  type: PropType<VxeTreePropTypes.ShowLine>;
211
212
  default: () => boolean | undefined;
212
213
  };
214
+ lineConfig: PropType<VxeTreePropTypes.LineConfig>;
213
215
  trigger: PropType<VxeTreePropTypes.Trigger>;
214
216
  indent: {
215
217
  type: PropType<VxeTreePropTypes.Indent>;
@@ -310,7 +312,6 @@ declare const _default: import("vue").DefineComponent<{
310
312
  autoResize: boolean;
311
313
  showOverflow: boolean;
312
314
  emptyText: VxeTreePropTypes.EmptyText;
313
- indent: number;
314
315
  showRadio: boolean;
315
316
  showCheckbox: boolean;
316
317
  accordion: boolean;
@@ -324,6 +325,7 @@ declare const _default: import("vue").DefineComponent<{
324
325
  rootParentValue: VxeTreePropTypes.RootParentValue;
325
326
  rootValues: VxeTreePropTypes.RootValues;
326
327
  showLine: boolean;
328
+ indent: number;
327
329
  iconOpen: string;
328
330
  iconClose: string;
329
331
  iconLoaded: string;
@@ -1,7 +1,7 @@
1
1
  import { ref, h, reactive, computed, watch, onBeforeUnmount, nextTick, onMounted, provide } from "vue";
2
2
  import { defineVxeComponent } from "../../ui/src/comp";
3
3
  import { VxeUI } from "@vxe-ui/core";
4
- import { calcTreeLine, getItemCacheObj } from "./util";
4
+ import { getTreeNodeLines, getItemCacheObj } from "./util";
5
5
  import { createComponentLog } from "../../ui/src/log";
6
6
  import { getCrossTreeDragNodeInfo } from "./store";
7
7
  import XEUtils from "xe-utils";
@@ -157,6 +157,7 @@ var tree_default = (
157
157
  type: Boolean,
158
158
  default: () => getConfig().tree.showLine
159
159
  },
160
+ lineConfig: Object,
160
161
  trigger: String,
161
162
  indent: {
162
163
  type: Number,
@@ -310,6 +311,13 @@ var tree_default = (
310
311
  }
311
312
  return props.isHover;
312
313
  });
314
+ const computeLineOpts = computed(() => {
315
+ return Object.assign({}, getConfig().tree.lineConfig, props.lineConfig);
316
+ });
317
+ const computeShowTreeRootLine = computed(() => {
318
+ const lineOpts = computeLineOpts.value;
319
+ return lineOpts.showRootLine;
320
+ });
313
321
  const computeRadioOpts = computed(() => {
314
322
  return Object.assign({ showIcon: true }, getConfig().tree.radioConfig, props.radioConfig);
315
323
  });
@@ -351,6 +359,8 @@ var tree_default = (
351
359
  const computeTreeStyle = computed(() => {
352
360
  const { indent } = props;
353
361
  const { customHeight, customMinHeight, customMaxHeight } = reactData;
362
+ const lineOpts = computeLineOpts.value;
363
+ const { lineWidth, lineColor } = lineOpts;
354
364
  const checkboxOpts = computeCheckboxOpts.value;
355
365
  const { nodeStyle } = checkboxOpts;
356
366
  const stys = {};
@@ -366,6 +376,12 @@ var tree_default = (
366
376
  if (indent) {
367
377
  stys["--vxe-ui-tree-node-indent"] = toCssUnit(indent);
368
378
  }
379
+ if (lineWidth) {
380
+ stys["--vxe-ui-tree-node-line-width"] = toCssUnit(lineWidth);
381
+ }
382
+ if (lineColor) {
383
+ stys["--vxe-ui-tree-node-line-color"] = toCssUnit(lineColor);
384
+ }
369
385
  if (nodeStyle) {
370
386
  const { indeterminateColor, checkedColor } = nodeStyle;
371
387
  if (indeterminateColor) {
@@ -647,7 +663,8 @@ var tree_default = (
647
663
  level: nodes.length - 1,
648
664
  treeIndex: index,
649
665
  lineCount: 0,
650
- treeLoaded: false
666
+ treeLoaded: false,
667
+ linesMask: 0
651
668
  };
652
669
  },
653
670
  { children: childrenField }
@@ -655,40 +672,69 @@ var tree_default = (
655
672
  internalData.nodeMaps = keyMaps;
656
673
  };
657
674
  const updateAfterDataIndex = () => {
658
- const { transform } = props;
675
+ const { lazy, showLine, transform } = props;
659
676
  const { afterTreeList, nodeMaps } = internalData;
660
677
  const childrenField = computeChildrenField.value;
661
678
  const mapChildrenField = computeMapChildrenField.value;
679
+ const hasChildField = computeHasChildField.value;
680
+ const showTreeRootLine = computeShowTreeRootLine.value;
681
+ const treeFullSize = afterTreeList.length;
662
682
  let vtIndex = 0;
663
- XEUtils.eachTree(
664
- afterTreeList,
665
- (item, index, items, path, parenItem, nodes) => {
666
- const nodeid = getNodeId(item);
667
- const nodeItem = nodeMaps[nodeid];
668
- if (nodeItem) {
669
- nodeItem.items = items;
670
- nodeItem.treeIndex = index;
671
- nodeItem._index = vtIndex;
672
- } else {
673
- const rest = {
674
- item,
675
- index,
676
- $index: -1,
677
- _index: vtIndex,
678
- items,
679
- parent: parenItem,
680
- nodes,
681
- level: nodes.length - 1,
682
- treeIndex: index,
683
- lineCount: 0,
684
- treeLoaded: false
685
- };
686
- nodeMaps[nodeid] = rest;
683
+ function handleTreeDFS(item, index, items, parenItem, depth, isFirstRow, isLastRow, isLastChild, stackMask, seq) {
684
+ const nodeid = getNodeId(item);
685
+ let nodeItem = nodeMaps[nodeid];
686
+ const nodeChilds = item[transform ? mapChildrenField : childrenField];
687
+ const childList = XEUtils.get(item, childrenField);
688
+ const isExistChild = childList && childList.length > 0;
689
+ if (nodeItem) {
690
+ nodeItem.items = items;
691
+ nodeItem.treeIndex = index;
692
+ nodeItem._index = vtIndex;
693
+ } else {
694
+ nodeItem = {
695
+ item,
696
+ index,
697
+ $index: -1,
698
+ _index: vtIndex,
699
+ items,
700
+ parent: parenItem,
701
+ nodes: [],
702
+ level: 0,
703
+ treeIndex: index,
704
+ lineCount: 0,
705
+ treeLoaded: false,
706
+ linesMask: 0
707
+ };
708
+ nodeMaps[nodeid] = nodeItem;
709
+ }
710
+ let linesMask = stackMask >> 1;
711
+ if (!isLastChild) {
712
+ linesMask |= 1 << depth - 1;
713
+ }
714
+ nodeItem.level = depth - 1;
715
+ nodeItem.linesMask = linesMask;
716
+ let hasLazyChilds = false;
717
+ let isLazyLoaded = false;
718
+ if (lazy) {
719
+ hasLazyChilds = item[hasChildField];
720
+ isLazyLoaded = !!nodeItem.treeLoaded;
721
+ }
722
+ const isExpandable = lazy ? isLazyLoaded ? isExistChild : hasLazyChilds : isExistChild;
723
+ nodeItem.treeLines = showLine && treeFullSize > 1 ? getTreeNodeLines(isExpandable, depth, linesMask, isFirstRow, isLastRow, showTreeRootLine) : [];
724
+ let nextStackMask = stackMask;
725
+ if (!isLastChild) {
726
+ nextStackMask |= 1 << depth;
727
+ }
728
+ vtIndex++;
729
+ if (nodeChilds) {
730
+ for (let i = 0; i < nodeChilds.length; i++) {
731
+ handleTreeDFS(nodeChilds[i], i, nodeChilds, item, depth + 1, false, false, i === nodeChilds.length - 1, nextStackMask, `${seq}.${i + 1}`);
687
732
  }
688
- vtIndex++;
689
- },
690
- { children: transform ? mapChildrenField : childrenField }
691
- );
733
+ }
734
+ }
735
+ for (let i = 0; i < treeFullSize; i++) {
736
+ handleTreeDFS(afterTreeList[i], i, afterTreeList, null, 1, !i, i === treeFullSize - 1, i === treeFullSize - 1, 0, "" + i);
737
+ }
692
738
  };
693
739
  const updateAfterFullData = () => {
694
740
  const { transform, filterValue } = props;
@@ -2078,7 +2124,8 @@ var tree_default = (
2078
2124
  level: parentLevel + nodes.length,
2079
2125
  treeIndex: -1,
2080
2126
  lineCount: 0,
2081
- treeLoaded: false
2127
+ treeLoaded: false,
2128
+ linesMask: 0
2082
2129
  };
2083
2130
  },
2084
2131
  { children: childrenField }
@@ -3112,10 +3159,28 @@ var tree_default = (
3112
3159
  }
3113
3160
  return renderEmptyElement($xeTree);
3114
3161
  };
3162
+ const renderLine = (nodeItem) => {
3163
+ const treeLines = nodeItem.treeLines;
3164
+ const lineVNs = [];
3165
+ if (treeLines) {
3166
+ const lineOpts = computeLineOpts.value;
3167
+ const { lineType } = lineOpts;
3168
+ treeLines.forEach((item, i) => {
3169
+ lineVNs.push(
3170
+ h("span", {
3171
+ key: "le" + i,
3172
+ class: ["vxe-tree--node-line", `type--${lineType || "solid"}`, item.type],
3173
+ style: item.style
3174
+ })
3175
+ );
3176
+ });
3177
+ }
3178
+ return lineVNs;
3179
+ };
3115
3180
  const renderNode = (node, nodeid) => {
3116
3181
  const { lazy, drag, transform, showRadio, showCheckbox, showLine, visibleMethod, iconOpen, iconClose, iconLoaded, showIcon } = props;
3117
3182
  const { currentNode, selectRadioKey, updateExpandedFlag } = reactData;
3118
- const { afterTreeList, nodeMaps, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
3183
+ const { nodeMaps, treeExpandedMaps, treeExpandLazyLoadedMaps } = internalData;
3119
3184
  const tooltipOpts = computeTooltipOpts.value;
3120
3185
  const { mode: tipMode } = tooltipOpts;
3121
3186
  const radioOpts = computeRadioOpts.value;
@@ -3154,7 +3219,6 @@ var tree_default = (
3154
3219
  hasLazyChilds = node[hasChildField];
3155
3220
  isLazyLoaded = !!nodeItem.treeLoaded;
3156
3221
  }
3157
- const prevNode = nodeItem.items[nodeItem.treeIndex - 1];
3158
3222
  const nParams = { node, isExpand, $tree: $xeTree };
3159
3223
  const itemOns = {
3160
3224
  onMousedown(evnt) {
@@ -3208,20 +3272,9 @@ var tree_default = (
3208
3272
  ]
3209
3273
  },
3210
3274
  [
3211
- showLine ? h(
3212
- "div",
3213
- {
3214
- class: "vxe-tree--node-line-wrapper"
3215
- },
3216
- [
3217
- h("div", {
3218
- class: "vxe-tree--node-line",
3219
- style: {
3220
- height: `${getNodeId(afterTreeList[0]) === nodeid ? 1 : calcTreeLine($xeTree, node, prevNode)}px`
3221
- }
3222
- })
3223
- ]
3224
- ) : renderEmptyElement($xeTree),
3275
+ showLine ? h("div", {
3276
+ class: "vxe-tree--node-line-wrapper"
3277
+ }, renderLine(nodeItem)) : renderEmptyElement($xeTree),
3225
3278
  h(
3226
3279
  "div",
3227
3280
  {
@@ -3693,6 +3746,16 @@ var tree_default = (
3693
3746
  recalculate();
3694
3747
  });
3695
3748
  });
3749
+ const lineFlag = ref(0);
3750
+ watch(() => props.showLine, () => {
3751
+ lineFlag.value++;
3752
+ });
3753
+ watch(computeShowTreeRootLine, () => {
3754
+ lineFlag.value++;
3755
+ });
3756
+ watch(lineFlag, () => {
3757
+ updateAfterDataIndex();
3758
+ });
3696
3759
  watch(reScrollFlag, () => {
3697
3760
  updateScrollbar().then(() => {
3698
3761
  updateScrollbar();
@@ -1,3 +1,8 @@
1
1
  import type { VxeTreeConstructor, VxeTreeDefines } from '../../../types';
2
2
  export declare function calcTreeLine($xeTree: VxeTreeConstructor, node: any, prevNode: any): number;
3
3
  export declare function getItemCacheObj(item: any): VxeTreeDefines.NodeCacheItem;
4
+ /**
5
+ * 分配树节点的连接线
6
+ * 类名(cut-full / cut-top / cut-bottom)
7
+ */
8
+ export declare function getTreeNodeLines(isExpandable: boolean, depth: number, linesMask: number, isFirstRow: boolean, isLastRow: boolean, showRootLine: boolean | undefined): VxeTreeDefines.NodeCacheTreeLineData[];
@@ -42,10 +42,105 @@ function getItemCacheObj(item) {
42
42
  level: 0,
43
43
  treeIndex: -1,
44
44
  lineCount: 0,
45
- treeLoaded: false
45
+ treeLoaded: false,
46
+ linesMask: 0
46
47
  };
47
48
  }
49
+ function getTreeNodeLines(isExpandable, depth, linesMask, isFirstRow, isLastRow, showRootLine) {
50
+ const lines = [];
51
+ for (let col = 1; col <= depth; col++) {
52
+ const leftVal = `var(--vxe-ui-tree-node-padding) + var(--vxe-ui-tree-node-btn-width) / 2 + var(--vxe-ui-tree-node-indent) * ${col - 1}`;
53
+ const through = (linesMask & 1 << col - 1) !== 0;
54
+ if (col === 1 && !showRootLine) {
55
+ continue;
56
+ }
57
+ if (col < depth) {
58
+ if (through) {
59
+ let top = "0";
60
+ let height = "100%";
61
+ if (isFirstRow) {
62
+ top = "50%";
63
+ height = "50%";
64
+ } else if (isLastRow) {
65
+ top = "0";
66
+ height = "50%";
67
+ }
68
+ lines.push({
69
+ type: "v",
70
+ style: {
71
+ left: `calc(${leftVal})`,
72
+ top,
73
+ height
74
+ }
75
+ });
76
+ }
77
+ } else {
78
+ let vTop = "0";
79
+ let vHeight = through ? "100%" : "50%";
80
+ if (isFirstRow && isLastRow) {
81
+ vTop = "50%";
82
+ vHeight = "0px";
83
+ } else if (isFirstRow) {
84
+ vTop = "50%";
85
+ vHeight = "50%";
86
+ } else if (isLastRow) {
87
+ vTop = "0";
88
+ vHeight = "50%";
89
+ }
90
+ if (isExpandable && vHeight !== "0px") {
91
+ let cutType = "v cut";
92
+ if (vTop === "0" && vHeight === "50%") {
93
+ cutType = "v cut-top";
94
+ } else if (vTop === "50%" && vHeight === "50%") {
95
+ cutType = "v cut-bottom";
96
+ } else if (vHeight === "100%") {
97
+ cutType = "v cut-full";
98
+ }
99
+ lines.push({
100
+ type: cutType,
101
+ style: {
102
+ left: `calc(${leftVal})`,
103
+ top: vTop,
104
+ height: vHeight
105
+ }
106
+ });
107
+ } else {
108
+ if (vHeight !== "0px") {
109
+ lines.push({
110
+ type: "v",
111
+ style: {
112
+ left: `calc(${leftVal})`,
113
+ top: vTop,
114
+ height: vHeight
115
+ }
116
+ });
117
+ }
118
+ }
119
+ if (isExpandable) {
120
+ lines.push({
121
+ type: "h",
122
+ style: {
123
+ left: `calc(${leftVal} + var(--vxe-ui-tree-node-btn-width) / 2)`,
124
+ top: "50%",
125
+ width: "calc(var(--vxe-ui-tree-node-indent) - var(--vxe-ui-tree-node-btn-width) - 0.2em)"
126
+ }
127
+ });
128
+ } else {
129
+ lines.push({
130
+ type: "h",
131
+ style: {
132
+ left: `calc(${leftVal})`,
133
+ top: "50%",
134
+ width: "calc(var(--vxe-ui-tree-node-indent) - var(--vxe-ui-tree-node-btn-width) / 2 - 0.1em)"
135
+ }
136
+ });
137
+ }
138
+ }
139
+ }
140
+ return lines;
141
+ }
48
142
  export {
49
143
  calcTreeLine,
50
- getItemCacheObj
144
+ getItemCacheObj,
145
+ getTreeNodeLines
51
146
  };