orgchart 3.7.0 → 3.8.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/README.md +39 -3
- package/demo/custom-icons.html +1 -1
- package/demo/data-prop-compact.html +82 -0
- package/demo/{isHybrid.html → data-prop-hybrid.html} +1 -1
- package/demo/index.html +2 -1
- package/dist/css/jquery.orgchart.css +189 -0
- package/dist/css/jquery.orgchart.min.css +1 -1
- package/dist/js/jquery.orgchart.js +80 -14
- package/dist/js/jquery.orgchart.min.js +4 -1
- package/dist/js/jquery.orgchart.min.js.map +1 -1
- package/gulpfile.js +1 -1
- package/package.json +2 -2
- package/src/css/jquery.orgchart.css +189 -0
- package/src/js/jquery.orgchart.js +80 -14
package/gulpfile.js
CHANGED
|
@@ -71,7 +71,7 @@ gulp.task('e2e-tests', gulp.series('addAssets', function () {
|
|
|
71
71
|
});
|
|
72
72
|
}));
|
|
73
73
|
|
|
74
|
-
gulp.task('test', gulp.series('e2e-tests'
|
|
74
|
+
gulp.task('test', gulp.series('e2e-tests'));
|
|
75
75
|
|
|
76
76
|
gulp.task('cleanupJS', function() {
|
|
77
77
|
return del([paths.distJSFolder + '/**']);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orgchart",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"description": "Simple and direct organization chart(tree-like hierarchy) plugin based on pure DOM and jQuery.",
|
|
5
5
|
"main": "./dist/js/jquery.orgchart.min.js",
|
|
6
6
|
"style": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"browser-sync": "^2.26.7",
|
|
48
48
|
"chai": "^4.2.0",
|
|
49
|
-
"cypress": "^
|
|
49
|
+
"cypress": "^13.2.0",
|
|
50
50
|
"del": "^3.0.0",
|
|
51
51
|
"gulp": "^4.0.2",
|
|
52
52
|
"gulp-clean-css": "^3.10.0",
|
|
@@ -273,6 +273,7 @@
|
|
|
273
273
|
|
|
274
274
|
.orgchart .node .content {
|
|
275
275
|
box-sizing: border-box;
|
|
276
|
+
width: 130px;
|
|
276
277
|
height: 20px;
|
|
277
278
|
line-height: 20px;
|
|
278
279
|
font-size: 10px;
|
|
@@ -533,6 +534,157 @@
|
|
|
533
534
|
border-width: 2px 0 0 0;
|
|
534
535
|
}
|
|
535
536
|
|
|
537
|
+
/* styles for compact nodes */
|
|
538
|
+
.orgchart .hierarchy > .node.compact {
|
|
539
|
+
position: static;
|
|
540
|
+
display: grid;
|
|
541
|
+
width: 140px;
|
|
542
|
+
height: 50px;
|
|
543
|
+
overflow: hidden;
|
|
544
|
+
background-color: #eee;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.orgchart .node.compact.even,
|
|
548
|
+
.orgchart .node.compact.even:hover {
|
|
549
|
+
background-color: #eee;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.orgchart .node.compact.odd,
|
|
553
|
+
.orgchart .node.compact.odd:hover {
|
|
554
|
+
background-color: #fff;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.orgchart .node.compact.even > .node:hover,
|
|
558
|
+
.orgchart .node.compact.even > .node.focused,
|
|
559
|
+
.orgchart .node.compact.even > .node.selected {
|
|
560
|
+
background-color: #fff;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.orgchart .node.compact.odd > .node:hover,
|
|
564
|
+
.orgchart .node.compact.odd > .node.focused,
|
|
565
|
+
.orgchart .node.compact.odd > .node.selected {
|
|
566
|
+
background-color: #eee;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.orgchart .hierarchy > .node.compact.looseMode {
|
|
570
|
+
display: grid;
|
|
571
|
+
width: unset;
|
|
572
|
+
height: unset;
|
|
573
|
+
overflow: unset;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.orgchart .hierarchy > .node.compact::before {
|
|
577
|
+
top: var(--top-cross-point, -10px);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.orgchart .node.compact > .node.compact {
|
|
581
|
+
position: relative;
|
|
582
|
+
display: grid;
|
|
583
|
+
width: 140px;
|
|
584
|
+
height: 50px;
|
|
585
|
+
overflow: hidden;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.orgchart .node.compact .node.compact.looseMode {
|
|
589
|
+
width: unset;
|
|
590
|
+
height: unset;
|
|
591
|
+
overflow: unset;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.orgchart .hierarchy > .node.compact > .content {
|
|
595
|
+
position: absolute;
|
|
596
|
+
top: 25px;
|
|
597
|
+
left: 5px;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
.orgchart .hierarchy > .node.compact.looseMode > .title {
|
|
601
|
+
margin-top: 5px;
|
|
602
|
+
margin-left: 5px;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.orgchart .hierarchy > .node.compact.looseMode > .content {
|
|
606
|
+
top: 30px;
|
|
607
|
+
left: 10px;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.orgchart .node.compact > .node.compact.looseMode > .title {
|
|
611
|
+
margin-top: 5px;
|
|
612
|
+
margin-left: 5px;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.orgchart .node.compact > .node.compact > .content {
|
|
616
|
+
position: absolute;
|
|
617
|
+
top: 23px;
|
|
618
|
+
left: 3px;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.orgchart .node.compact > .node.compact.looseMode > .content {
|
|
622
|
+
top: 28px;
|
|
623
|
+
left: 8px;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.orgchart .node.compact .node {
|
|
627
|
+
margin-bottom: 0;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
.orgchart .node.compact .node:not(:only-child)::after {
|
|
631
|
+
content: unset;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.orgchart .backToCompactSymbol, .orgchart .backToLooseSymbol {
|
|
635
|
+
cursor: pointer;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.orgchart .hierarchy > .node.compact > .backToCompactSymbol {
|
|
639
|
+
position: absolute;
|
|
640
|
+
top: 5px;
|
|
641
|
+
left: 5px;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.orgchart .hierarchy > .node.compact.looseMode > .backToCompactSymbol {
|
|
645
|
+
top: 10px;
|
|
646
|
+
left: 10px;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.orgchart .node.compact > .node.compact.looseMode > .backToCompactSymbol {
|
|
650
|
+
top: 8px;
|
|
651
|
+
left: 8px;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.orgchart .node.compact > .node.compact > .backToCompactSymbol {
|
|
655
|
+
position: absolute;
|
|
656
|
+
top: 3px;
|
|
657
|
+
left: 3px;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
.orgchart .hierarchy > .node.compact > .backToLooseSymbol {
|
|
661
|
+
position: absolute;
|
|
662
|
+
top: 25px;
|
|
663
|
+
right: 5px;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
.orgchart .node.compact > .node.compact > .backToLooseSymbol {
|
|
667
|
+
position: absolute;
|
|
668
|
+
top: 23px;
|
|
669
|
+
right: 3px;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.orgchart .node.compact .backToCompactSymbol::before {
|
|
673
|
+
border-top-color: rgba(68, 157, 68, 0.6);
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
.orgchart .node.compact .backToLooseSymbol::before {
|
|
677
|
+
border-bottom-color: rgba(68, 157, 68, 0.6);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.orgchart .node.compact .backToCompactSymbol:hover::before {
|
|
681
|
+
border-top-color: #449d44;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
.orgchart .node.compact .backToLooseSymbol:hover::before {
|
|
685
|
+
border-bottom-color: #449d44;
|
|
686
|
+
}
|
|
687
|
+
|
|
536
688
|
/* custom icons for orgchart */
|
|
537
689
|
.oci {
|
|
538
690
|
display: inline-block;
|
|
@@ -600,6 +752,43 @@
|
|
|
600
752
|
border-bottom: unset;
|
|
601
753
|
}
|
|
602
754
|
|
|
755
|
+
.oci-corner-top-left::before {
|
|
756
|
+
content: "";
|
|
757
|
+
display: inline-block;
|
|
758
|
+
border-top: 20px solid #000;
|
|
759
|
+
border-right: 20px solid transparent;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
.oci-corner-top-right::before {
|
|
763
|
+
content: "";
|
|
764
|
+
display: inline-block;
|
|
765
|
+
box-sizing: border-box;
|
|
766
|
+
width: 0;
|
|
767
|
+
height: 0;
|
|
768
|
+
border-top: 20px solid #000;
|
|
769
|
+
border-left: 20px solid transparent;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.oci-corner-bottom-right::before {
|
|
773
|
+
content: "";
|
|
774
|
+
display: inline-block;
|
|
775
|
+
box-sizing: border-box;
|
|
776
|
+
width: 0;
|
|
777
|
+
height: 0;
|
|
778
|
+
border-bottom: 20px solid #000;
|
|
779
|
+
border-left: 20px solid transparent;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
.oci-corner-bottom-left::before {
|
|
783
|
+
content: "";
|
|
784
|
+
display: inline-block;
|
|
785
|
+
box-sizing: border-box;
|
|
786
|
+
width: 0;
|
|
787
|
+
height: 0;
|
|
788
|
+
border-bottom: 20px solid #000;
|
|
789
|
+
border-right: 20px solid transparent;
|
|
790
|
+
}
|
|
791
|
+
|
|
603
792
|
.oci-plus-square::before {
|
|
604
793
|
content: "﹢";
|
|
605
794
|
display: inline-block;
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
'collapseToDown': 'oci-chevron-down',
|
|
29
29
|
'collapseToLeft': 'oci-chevron-left',
|
|
30
30
|
'expandToRight': 'oci-chevron-right',
|
|
31
|
+
'backToCompact': 'oci-corner-top-left',
|
|
32
|
+
'backToLoose': 'oci-corner-bottom-right',
|
|
31
33
|
'collapsed': 'oci-plus-square',
|
|
32
34
|
'expanded': 'oci-minus-square',
|
|
33
35
|
'spinner': 'oci-spinner'
|
|
@@ -113,6 +115,20 @@
|
|
|
113
115
|
|
|
114
116
|
return this;
|
|
115
117
|
},
|
|
118
|
+
handleCompactNodes: function () {
|
|
119
|
+
// caculate the compact nodes' level which is used to add different styles
|
|
120
|
+
this.$chart.find('.node.compact')
|
|
121
|
+
.each((index, node) => {
|
|
122
|
+
$(node).addClass($(node).parents('.compact').length % 2 === 0 ? 'even' : 'odd');
|
|
123
|
+
}); // the following code snippets is used to add direction arrows for the most top compact node, however the styles is not adjusted correctly
|
|
124
|
+
// .filter((index, node) => !$(node).parent().is('.compact'))
|
|
125
|
+
// .each((index, node) => {
|
|
126
|
+
// $(node).append(`<i class="edge verticalEdge topEdge ${this.options.icons.theme}"></i>`);
|
|
127
|
+
// if (this.getSiblings($(node)).length) {
|
|
128
|
+
// $(node).append(`<i class="edge horizontalEdge rightEdge ${this.options.icons.theme}"></i><i class="edge horizontalEdge leftEdge ${this.options.icons.theme}"></i>`);
|
|
129
|
+
// }
|
|
130
|
+
// });
|
|
131
|
+
},
|
|
116
132
|
//
|
|
117
133
|
triggerInitEvent: function () {
|
|
118
134
|
var that = this;
|
|
@@ -122,6 +138,7 @@
|
|
|
122
138
|
for (var i = 0; i < mutations.length; i++) {
|
|
123
139
|
for (var j = 0; j < mutations[i].addedNodes.length; j++) {
|
|
124
140
|
if (mutations[i].addedNodes[j].classList.contains('orgchart')) {
|
|
141
|
+
that.handleCompactNodes();
|
|
125
142
|
if (that.options.initCompleted && typeof that.options.initCompleted === 'function') {
|
|
126
143
|
that.options.initCompleted(that.$chart);
|
|
127
144
|
}
|
|
@@ -377,14 +394,21 @@
|
|
|
377
394
|
});
|
|
378
395
|
return subObj;
|
|
379
396
|
},
|
|
380
|
-
//
|
|
397
|
+
// process datasource and add necessary information
|
|
381
398
|
attachRel: function (data, flags) {
|
|
382
399
|
var that = this;
|
|
383
400
|
data.relationship = flags + (data.children && data.children.length > 0 ? 1 : 0);
|
|
401
|
+
if (this.options?.compact?.constructor === Function && this.options.compact(data)) {
|
|
402
|
+
data.compact = true;
|
|
403
|
+
}
|
|
384
404
|
if (data.children) {
|
|
385
405
|
data.children.forEach(function(item) {
|
|
386
|
-
if (data.
|
|
387
|
-
item.
|
|
406
|
+
if (data.hybrid || data.vertical) { // identify all the descendant nodes except the root node of hybrid structure
|
|
407
|
+
item.vertical = true;
|
|
408
|
+
} else if (data.compact && item.children) { // identify all the compact ancestor nodes
|
|
409
|
+
item.compact = true;
|
|
410
|
+
} else if (data.compact && !item.children) { // identify all the compact descendant nodes
|
|
411
|
+
item.associatedCompact = true;
|
|
388
412
|
}
|
|
389
413
|
that.attachRel(item, '1' + (data.children.length > 1 ? 1 : 0));
|
|
390
414
|
});
|
|
@@ -610,13 +634,21 @@
|
|
|
610
634
|
},
|
|
611
635
|
//
|
|
612
636
|
hideSiblingsEnd: function (event) {
|
|
637
|
+
var that = this;
|
|
613
638
|
var $node = event.data.node;
|
|
614
639
|
var $nodeContainer = event.data.nodeContainer;
|
|
615
640
|
var direction = event.data.direction;
|
|
616
641
|
var $siblings = direction ? (direction === 'left' ? $nodeContainer.prevAll(':not(.hidden)') : $nodeContainer.nextAll(':not(.hidden)')) : $nodeContainer.siblings();
|
|
617
642
|
event.data.animatedNodes.removeClass('sliding');
|
|
618
643
|
$siblings.find('.node:gt(0)').filter(this.isVisibleNode.bind(this))
|
|
619
|
-
.removeClass('slide-left slide-right')
|
|
644
|
+
.removeClass('slide-left slide-right')
|
|
645
|
+
.addClass(function() {
|
|
646
|
+
if (that.options.compact) {
|
|
647
|
+
return '';
|
|
648
|
+
} else {
|
|
649
|
+
return 'slide-up';
|
|
650
|
+
}
|
|
651
|
+
});
|
|
620
652
|
$siblings.find('.nodes, .vertical').addClass('hidden')
|
|
621
653
|
.end().addClass('hidden');
|
|
622
654
|
|
|
@@ -954,6 +986,19 @@
|
|
|
954
986
|
}
|
|
955
987
|
}
|
|
956
988
|
},
|
|
989
|
+
// show the compact node's children in the compact mode
|
|
990
|
+
backToCompactHandler: function (event) {
|
|
991
|
+
$(event.delegateTarget).removeClass('looseMode')
|
|
992
|
+
.children('.backToCompactSymbol').addClass('hidden').end()
|
|
993
|
+
.children('.backToLooseSymbol').removeClass('hidden');
|
|
994
|
+
},
|
|
995
|
+
// show the compact node's children in the loose mode
|
|
996
|
+
backToLooseHandler: function (event) {
|
|
997
|
+
$(event.delegateTarget)
|
|
998
|
+
.addClass('looseMode')
|
|
999
|
+
.children('.backToLooseSymbol').addClass('hidden').end()
|
|
1000
|
+
.children('.backToCompactSymbol').removeClass('hidden');
|
|
1001
|
+
},
|
|
957
1002
|
//
|
|
958
1003
|
expandVNodesEnd: function (event) {
|
|
959
1004
|
event.data.vNodes.removeClass('sliding');
|
|
@@ -1137,7 +1182,7 @@
|
|
|
1137
1182
|
// special process for hybrid chart
|
|
1138
1183
|
var datasource = this.$chart.data('options').data;
|
|
1139
1184
|
var digger = new JSONDigger(datasource, this.$chart.data('options').nodeId, 'children');
|
|
1140
|
-
const hybridNode = digger.findOneNode({ '
|
|
1185
|
+
const hybridNode = digger.findOneNode({ 'hybrid': true });
|
|
1141
1186
|
if (this.$chart.data('options').verticalLevel > 1 || hybridNode) {
|
|
1142
1187
|
var draggedNode = digger.findNodeById($dragged.data('nodeData').id);
|
|
1143
1188
|
var copy = Object.assign({}, draggedNode);
|
|
@@ -1359,18 +1404,29 @@
|
|
|
1359
1404
|
var nodeData = $.extend({}, data);
|
|
1360
1405
|
delete nodeData.children;
|
|
1361
1406
|
$nodeDiv.data('nodeData', nodeData);
|
|
1362
|
-
// append 4 direction arrows or expand/collapse buttons
|
|
1407
|
+
// append 4 direction arrows or expand/collapse buttons or reset buttons
|
|
1363
1408
|
var flags = data.relationship || '';
|
|
1364
|
-
if ((opts.verticalLevel && level >= opts.verticalLevel) || data.
|
|
1409
|
+
if ((opts.verticalLevel && level >= opts.verticalLevel) || data.vertical) {
|
|
1365
1410
|
if (Number(flags.substr(2,1))) {
|
|
1366
1411
|
$nodeDiv.append(`<i class="toggleBtn ${opts.icons.theme}"></i>`)
|
|
1367
1412
|
.children('.title').prepend(`<i class="${opts.icons.theme} ${opts.icons.parentNode} parentNodeSymbol"></i>`);
|
|
1368
1413
|
}
|
|
1369
|
-
} else if (data.
|
|
1414
|
+
} else if (data.hybrid) {
|
|
1370
1415
|
if (Number(flags.substr(2,1))) {
|
|
1371
1416
|
$nodeDiv.append(`<i class="edge verticalEdge bottomEdge ${opts.icons.theme}"></i>`)
|
|
1372
1417
|
.children('.title').prepend(`<i class="${opts.icons.theme} ${opts.icons.parentNode} parentNodeSymbol"></i>`);
|
|
1373
1418
|
}
|
|
1419
|
+
} else if (data.compact) {
|
|
1420
|
+
$nodeDiv.css('grid-template-columns', `repeat(${Math.floor(Math.sqrt(data.children.length + 1))}, auto)`);
|
|
1421
|
+
if (Number(flags.substr(2,1))) {
|
|
1422
|
+
$nodeDiv.append(`
|
|
1423
|
+
<i class="${opts.icons.theme} ${opts.icons.backToCompact} backToCompactSymbol hidden"></i>
|
|
1424
|
+
<i class="${opts.icons.theme} ${opts.icons.backToLoose} backToLooseSymbol"></i>
|
|
1425
|
+
`)
|
|
1426
|
+
.children('.title').prepend(`<i class="${opts.icons.theme} ${opts.icons.parentNode} parentNodeSymbol"></i>`);
|
|
1427
|
+
}
|
|
1428
|
+
} else if (data.associatedCompact) {
|
|
1429
|
+
|
|
1374
1430
|
} else {
|
|
1375
1431
|
if (Number(flags.substr(0,1))) {
|
|
1376
1432
|
$nodeDiv.append(`<i class="edge verticalEdge topEdge ${opts.icons.theme}"></i>`);
|
|
@@ -1390,6 +1446,8 @@
|
|
|
1390
1446
|
$nodeDiv.on('click', '.bottomEdge', this.bottomEdgeClickHandler.bind(this));
|
|
1391
1447
|
$nodeDiv.on('click', '.leftEdge, .rightEdge', this.hEdgeClickHandler.bind(this));
|
|
1392
1448
|
$nodeDiv.on('click', '.toggleBtn', this.toggleVNodes.bind(this));
|
|
1449
|
+
$nodeDiv.on('click', '> .backToCompactSymbol',this.backToCompactHandler.bind(this));
|
|
1450
|
+
$nodeDiv.on('click', '> .backToLooseSymbol',this.backToLooseHandler.bind(this));
|
|
1393
1451
|
|
|
1394
1452
|
if (opts.draggable) {
|
|
1395
1453
|
this.bindDragDrop($nodeDiv);
|
|
@@ -1409,6 +1467,7 @@
|
|
|
1409
1467
|
var that = this;
|
|
1410
1468
|
var opts = this.options;
|
|
1411
1469
|
var level = 0;
|
|
1470
|
+
var $nodeDiv;
|
|
1412
1471
|
if (data.level) {
|
|
1413
1472
|
level = data.level;
|
|
1414
1473
|
} else {
|
|
@@ -1416,23 +1475,26 @@
|
|
|
1416
1475
|
}
|
|
1417
1476
|
// Construct the node
|
|
1418
1477
|
if (Object.keys(data).length > 2) {
|
|
1419
|
-
$
|
|
1478
|
+
$nodeDiv = this.createNode(data);
|
|
1479
|
+
$appendTo.append($nodeDiv);
|
|
1420
1480
|
}
|
|
1421
1481
|
// Construct the "inferior nodes"
|
|
1422
1482
|
if (data.children && data.children.length) {
|
|
1423
1483
|
var isHidden = level + 1 > opts.visibleLevel || (data.collapsed !== undefined && data.collapsed);
|
|
1424
1484
|
var $nodesLayer;
|
|
1425
|
-
if ((opts.verticalLevel && (level + 1) >= opts.verticalLevel) || data.
|
|
1485
|
+
if ((opts.verticalLevel && (level + 1) >= opts.verticalLevel) || data.hybrid) {
|
|
1426
1486
|
$nodesLayer = $('<ul class="nodes">');
|
|
1427
1487
|
if (isHidden && (opts.verticalLevel && (level + 1) >= opts.verticalLevel)) {
|
|
1428
1488
|
$nodesLayer.addClass('hidden');
|
|
1429
1489
|
}
|
|
1430
|
-
if (((opts.verticalLevel && level + 1 === opts.verticalLevel) || data.
|
|
1490
|
+
if (((opts.verticalLevel && level + 1 === opts.verticalLevel) || data.hybrid)
|
|
1431
1491
|
&& !$appendTo.closest('.vertical').length) {
|
|
1432
1492
|
$appendTo.append($nodesLayer.addClass('vertical'));
|
|
1433
1493
|
} else {
|
|
1434
1494
|
$appendTo.append($nodesLayer);
|
|
1435
1495
|
}
|
|
1496
|
+
} else if (data.compact) {
|
|
1497
|
+
$nodeDiv.addClass('compact');
|
|
1436
1498
|
} else {
|
|
1437
1499
|
$nodesLayer = $('<ul class="nodes' + (isHidden ? ' hidden' : '') + '">');
|
|
1438
1500
|
if (Object.keys(data).length === 2) {
|
|
@@ -1446,10 +1508,14 @@
|
|
|
1446
1508
|
}
|
|
1447
1509
|
// recurse through children nodes
|
|
1448
1510
|
$.each(data.children, function () {
|
|
1449
|
-
var $nodeCell = $('<li class="hierarchy">');
|
|
1450
|
-
$nodesLayer.append($nodeCell);
|
|
1451
1511
|
this.level = level + 1;
|
|
1452
|
-
|
|
1512
|
+
if (data.compact) {
|
|
1513
|
+
that.buildHierarchy($nodeDiv, this);
|
|
1514
|
+
} else {
|
|
1515
|
+
var $nodeCell = $('<li class="hierarchy">');
|
|
1516
|
+
$nodesLayer.append($nodeCell);
|
|
1517
|
+
that.buildHierarchy($nodeCell, this);
|
|
1518
|
+
}
|
|
1453
1519
|
});
|
|
1454
1520
|
}
|
|
1455
1521
|
},
|