') : $('');
- $nodesLayer.append($nodeCell);
- this.level = level + 1;
- that.buildHierarchy($nodeCell, this);
- });
- }
- },
- // build the child nodes of specific node
- buildChildNode: function ($appendTo, data) {
- $appendTo.find('td:first').attr('colspan', data.length * 2);
- this.buildHierarchy($appendTo, { 'children': data });
- },
- // exposed method
- addChildren: function ($node, data) {
- this.buildChildNode($node.closest('table'), data);
- if (!$node.children('.bottomEdge').length) {
- $node.append('');
- }
- if (!$node.find('.symbol').length) {
- $node.children('.title').prepend('');
- }
- if (this.isInAction($node)) {
- this.switchVerticalArrow($node.children('.bottomEdge'));
- }
- },
- // build the parent node of specific node
- buildParentNode: function ($currentRoot, data) {
- data.relationship = data.relationship || '001';
- var $table = $('')
- .append($('').append($('| ').append(this.createNode(data))))
- .append(' | | ')
- .append(' | | ');
- this.$chart.prepend($table)
- .children('table:first').append(' | ')
- .children('tr:last').children().append(this.$chart.children('table').last());
- },
- // exposed method
- addParent: function ($currentRoot, data) {
- this.buildParentNode($currentRoot, data);
- if (!$currentRoot.children('.topEdge').length) {
- $currentRoot.children('.title').after('');
- }
- if (this.isInAction($currentRoot)) {
- this.switchVerticalArrow($currentRoot.children('.topEdge'));
- }
- },
- // subsequent processing of build sibling nodes
- complementLine: function ($oneSibling, siblingCount, existingSibligCount) {
- var lines = '';
- for (var i = 0; i < existingSibligCount; i++) {
- lines += ' | | ';
- }
- $oneSibling.parent().prevAll('tr:gt(0)').children().attr('colspan', siblingCount * 2)
- .end().next().children(':first').after(lines);
- },
- // build the sibling nodes of specific node
- buildSiblingNode: function ($nodeChart, data) {
- var newSiblingCount = $.isArray(data) ? data.length : data.children.length;
- var existingSibligCount = $nodeChart.parent().is('td') ? $nodeChart.closest('tr').children().length : 1;
- var siblingCount = existingSibligCount + newSiblingCount;
- var insertPostion = (siblingCount > 1) ? Math.floor(siblingCount/2 - 1) : 0;
- // just build the sibling nodes for the specific node
- if ($nodeChart.parent().is('td')) {
- var $parent = $nodeChart.closest('tr').prevAll('tr:last');
- $nodeChart.closest('tr').prevAll('tr:lt(2)').remove();
- this.buildChildNode($nodeChart.parent().closest('table'), data);
- var $siblingTds = $nodeChart.parent().closest('table').children('tr:last').children('td');
- if (existingSibligCount > 1) {
- this.complementLine($siblingTds.eq(0).before($nodeChart.closest('td').siblings().addBack().unwrap()), siblingCount, existingSibligCount);
- } else {
- this.complementLine($siblingTds.eq(insertPostion).after($nodeChart.closest('td').unwrap()), siblingCount, 1);
- }
- } else { // build the sibling nodes and parent node for the specific ndoe
- this.buildHierarchy($nodeChart.closest('.orgchart'), data);
- this.complementLine($nodeChart.next().children('tr:last').children().eq(insertPostion).after($('').append($nodeChart)),
- siblingCount, 1);
- }
- },
- //
- addSiblings: function ($node, data) {
- this.buildSiblingNode($node.closest('table'), data);
- $node.closest('.nodes').data('siblingsLoaded', true);
- if (!$node.children('.leftEdge').length) {
- $node.children('.topEdge').after('');
- }
- if (this.isInAction($node)) {
- this.switchHorizontalArrow($node);
- $node.children('.topEdge').removeClass('fa-chevron-up').addClass('fa-chevron-down');
- }
- },
- //
- removeNodes: function ($node) {
- var $parent = $node.closest('table').parent();
- var $sibs = $parent.parent().siblings();
- if ($parent.is('td')) {
- if (this.getNodeState($node, 'siblings').exist) {
- $sibs.eq(2).children('.topLine:lt(2)').remove();
- $sibs.slice(0, 2).children().attr('colspan', $sibs.eq(2).children().length);
- $parent.remove();
- } else {
- $sibs.eq(0).children().removeAttr('colspan')
- .find('.bottomEdge').remove()
- .end().end().siblings().remove();
- }
- } else {
- $parent.add($parent.siblings()).remove();
- }
- },
- //
- export: function (exportFilename, exportFileextension) {
- var that = this;
- exportFilename = (typeof exportFilename !== 'undefined') ? exportFilename : this.options.exportFilename;
- exportFileextension = (typeof exportFileextension !== 'undefined') ? exportFileextension : this.options.exportFileextension;
- if ($(this).children('.spinner').length) {
- return false;
- }
- var $chartContainer = this.$chartContainer;
- var $mask = $chartContainer.find('.mask');
- if (!$mask.length) {
- $chartContainer.append(' ');
- } else {
- $mask.removeClass('hidden');
- }
- var sourceChart = $chartContainer.addClass('canvasContainer').find('.orgchart:not(".hidden")').get(0);
- var flag = that.options.direction === 'l2r' || that.options.direction === 'r2l';
- html2canvas(sourceChart, {
- 'width': flag ? sourceChart.clientHeight : sourceChart.clientWidth,
- 'height': flag ? sourceChart.clientWidth : sourceChart.clientHeight,
- 'onclone': function (cloneDoc) {
- $(cloneDoc).find('.canvasContainer').css('overflow', 'visible')
- .find('.orgchart:not(".hidden"):first').css('transform', '');
- },
- 'onrendered': function (canvas) {
- $chartContainer.find('.mask').addClass('hidden');
- if (exportFileextension.toLowerCase() === 'pdf') {
- var doc = {};
- var docWidth = Math.floor(canvas.width * 0.2646);
- var docHeight = Math.floor(canvas.height * 0.2646);
- if (docWidth > docHeight) {
- doc = new jsPDF('l', 'mm', [docWidth, docHeight]);
- } else {
- doc = new jsPDF('p', 'mm', [docHeight, docWidth]);
- }
- doc.addImage(canvas.toDataURL(), 'png', 0, 0);
- doc.save(exportFilename + '.pdf');
- } else {
- var isWebkit = 'WebkitAppearance' in document.documentElement.style;
- var isFf = !!window.sidebar;
- var isEdge = navigator.appName === 'Microsoft Internet Explorer' || (navigator.appName === "Netscape" && navigator.appVersion.indexOf('Edge') > -1);
-
- if ((!isWebkit && !isFf) || isEdge) {
- window.navigator.msSaveBlob(canvas.msToBlob(), exportFilename + '.png');
- } else {
- var selector = '.oc-download-btn' + (that.options.chartClass !== '' ? '.' + that.options.chartClass : '');
- if (!$chartContainer.find(selector).length) {
- $chartContainer.append('');
- }
- $chartContainer.find(selector).attr('href', canvas.toDataURL())[0].click();
- }
- }
- }
- })
- .then(function () {
- $chartContainer.removeClass('canvasContainer');
- }, function () {
- $chartContainer.removeClass('canvasContainer');
- });
- }
- };
-
- $.fn.orgchart = function (opts) {
- return new OrgChart(this, opts).init();
- };
-
-}));
diff --git a/src/main/resources/META-INF/resources/frontend/fc-orgchart-styles.css b/src/main/resources/META-INF/resources/frontend/fc-orgchart-styles.css
new file mode 100644
index 0000000..19beda9
--- /dev/null
+++ b/src/main/resources/META-INF/resources/frontend/fc-orgchart-styles.css
@@ -0,0 +1,27 @@
+/*-
+ * #%L
+ * OrgChart Add-on
+ * %%
+ * Copyright (C) 2017 - 2023 Flowing Code S.A.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+.orgchart .node {
+ width: 140px;
+}
+
+.orgchart .node .content {
+ overflow: hidden;
+}
\ No newline at end of file
diff --git a/src/main/resources/META-INF/resources/frontend/jquery.orgchart.min.css b/src/main/resources/META-INF/resources/frontend/jquery.orgchart.min.css
deleted file mode 100644
index 3b39c8a..0000000
--- a/src/main/resources/META-INF/resources/frontend/jquery.orgchart.min.css
+++ /dev/null
@@ -1 +0,0 @@
-.orgchart{box-sizing:border-box;display:inline-block;min-height:202px;min-width:202px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:linear-gradient(90deg,rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%),linear-gradient(rgba(200,0,0,.15) 10%,rgba(0,0,0,0) 10%);background-size:10px 10px;border:1px dashed transparent;padding:20px}.orgchart .hidden,.orgchart~.hidden{display:none}.orgchart.b2t{transform:rotate(180deg)}.orgchart.l2r{position:absolute;transform:rotate(-90deg) rotateY(180deg);transform-origin:left top}.orgchart .verticalNodes ul{list-style:none;margin:0;padding-left:18px;text-align:left}.orgchart .verticalNodes ul:first-child{margin-top:2px}.orgchart .verticalNodes>td::before{content:'';border:1px solid rgba(217,83,79,.8)}.orgchart .verticalNodes>td>ul>li:first-child::before{box-sizing:border-box;top:-4px;height:30px;width:calc(50% - 2px);border-width:2px 0 0 2px}.orgchart .verticalNodes ul>li{position:relative}.orgchart .verticalNodes ul>li::after,.orgchart .verticalNodes ul>li::before{box-sizing:border-box;content:'';position:absolute;left:-6px;border-color:rgba(217,83,79,.8);border-style:solid;border-width:0 0 2px 2px}.orgchart .verticalNodes ul>li::before{top:-4px;height:30px;width:11px}.orgchart .verticalNodes ul>li::after{top:1px;height:100%}.orgchart .verticalNodes ul>li:first-child::after{box-sizing:border-box;top:24px;width:11px;border-width:2px 0 0 2px}.orgchart .verticalNodes ul>li:last-child::after{box-sizing:border-box;border-width:2px 0 0}.orgchart.r2l{position:absolute;transform:rotate(90deg);transform-origin:left top}.orgchart>.spinner{font-size:100px;margin-top:30px;color:rgba(68,157,68,.8)}.orgchart table{border-spacing:0;border-collapse:separate}.orgchart>table:first-child{margin:20px auto}.orgchart td{text-align:center;vertical-align:top;padding:0}.orgchart .lines:nth-child(3) td{box-sizing:border-box;height:20px}.orgchart .lines .topLine{border-top:2px solid rgba(217,83,79,.8)}.orgchart .lines .rightLine{border-right:1px solid rgba(217,83,79,.8);float:none;border-radius:0}.orgchart .lines .leftLine{border-left:1px solid rgba(217,83,79,.8);float:none;border-radius:0}.orgchart .lines .downLine{background-color:rgba(217,83,79,.8);margin:0 auto;height:20px;width:2px;float:none}.orgchart .node{box-sizing:border-box;display:inline-block;position:relative;margin:0;padding:3px;border:2px dashed transparent;text-align:center;width:130px}.orgchart.l2r .node,.orgchart.r2l .node{width:50px;height:130px}.orgchart .node>.spinner{position:absolute;top:calc(50% - 15px);left:calc(50% - 15px);vertical-align:middle;font-size:30px;color:rgba(68,157,68,.8)}.orgchart .node:hover{background-color:rgba(238,217,54,.5);transition:.5s;cursor:default;z-index:20}.orgchart .node.focused{background-color:rgba(238,217,54,.5)}.orgchart .ghost-node{position:fixed;left:-10000px;top:-10000px}.orgchart .ghost-node rect{fill:#fff;stroke:#bf0000}.orgchart .node.allowedDrop{border-color:rgba(68,157,68,.9)}.orgchart .node .title{text-align:center;font-size:12px;font-weight:700;height:20px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:rgba(217,83,79,.8);color:#fff;border-radius:4px 4px 0 0}.orgchart.b2t .node .title{transform:rotate(-180deg);transform-origin:center bottom}.orgchart.l2r .node .title{transform:rotate(-90deg) translate(-40px,-40px) rotateY(180deg);transform-origin:bottom center;width:120px}.orgchart.r2l .node .title{transform:rotate(-90deg) translate(-40px,-40px);transform-origin:bottom center;width:120px}.orgchart .node .title .symbol{float:left;margin-top:4px;margin-left:2px}.orgchart .node .content{box-sizing:border-box;width:100%;height:20px;font-size:11px;line-height:18px;border:1px solid rgba(217,83,79,.8);border-radius:0 0 4px 4px;text-align:center;background-color:#fff;color:#333;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.orgchart.b2t .node .content{transform:rotate(180deg);transform-origin:center top}.orgchart.l2r .node .content{transform:rotate(-90deg) translate(-40px,-40px) rotateY(180deg);transform-origin:top center;width:120px}.orgchart.r2l .node .content{transform:rotate(-90deg) translate(-40px,-40px);transform-origin:top center;width:120px}.orgchart .node .edge{font-size:15px;position:absolute;color:rgba(68,157,68,.5);cursor:default;transition:.2s}.orgchart.noncollapsable .node .edge{display:none}.orgchart .edge:hover{color:#449d44;cursor:pointer}.orgchart .node .verticalEdge{width:calc(100% - 10px);width:-webkit-calc(100% - 10px);width:-moz-calc(100% - 10px);left:5px}.orgchart .node .topEdge{top:-4px}.orgchart .node .bottomEdge{bottom:-4px}.orgchart .node .horizontalEdge{width:15px;height:calc(100% - 10px);height:-webkit-calc(100% - 10px);height:-moz-calc(100% - 10px);top:5px}.orgchart .node .rightEdge{right:-4px}.orgchart .node .leftEdge{left:-4px}.orgchart .node .horizontalEdge::before{position:absolute;top:calc(50% - 7px)}.orgchart .node .rightEdge::before{right:3px}.orgchart .node .leftEdge::before{left:3px}.orgchart .node .toggleBtn{position:absolute;left:5px;bottom:-2px;color:rgba(68,157,68,.6)}.orgchart .node .toggleBtn:hover{color:rgba(68,157,68,.8)}.oc-export-btn{display:inline-block;position:absolute;right:5px;top:5px;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;touch-action:manipulation;cursor:pointer;user-select:none;color:#fff;background-color:#5cb85c;border:1px solid transparent;border-color:#4cae4c;border-radius:4px}.oc-export-btn[disabled]{cursor:not-allowed;box-shadow:none;opacity:.3}.oc-export-btn:active,.oc-export-btn:focus,.oc-export-btn:hover{background-color:#449d44;border-color:#347a34}.orgchart~.mask{position:absolute;top:0;right:0;bottom:0;left:0;z-index:999;text-align:center;background-color:rgba(0,0,0,.3)}.orgchart~.mask .spinner{position:absolute;top:calc(50% - 54px);left:calc(50% - 54px);color:rgba(255,255,255,.8);font-size:108px}.orgchart .node{transition:transform .3s,opacity .3s}.orgchart .slide-down{opacity:0;transform:translateY(40px)}.orgchart.l2r .node.slide-down,.orgchart.r2l .node.slide-down{transform:translateY(130px)}.orgchart .slide-up{opacity:0;transform:translateY(-40px)}.orgchart.l2r .node.slide-up,.orgchart.r2l .node.slide-up{transform:translateY(-130px)}.orgchart .slide-right{opacity:0;transform:translateX(130px)}.orgchart.l2r .node.slide-right,.orgchart.r2l .node.slide-right{transform:translateX(40px)}.orgchart .slide-left{opacity:0;transform:translateX(-130px)}.orgchart.l2r .node.slide-left,.orgchart.r2l .node.slide-left{transform:translateX(-40px)}
\ No newline at end of file
diff --git a/src/test/resources/META-INF/resources/frontend/styles/orgchart/demo-styles.css b/src/test/resources/META-INF/resources/frontend/styles/orgchart/demo-styles.css
index 3539c5a..dcd326d 100644
--- a/src/test/resources/META-INF/resources/frontend/styles/orgchart/demo-styles.css
+++ b/src/test/resources/META-INF/resources/frontend/styles/orgchart/demo-styles.css
@@ -36,7 +36,6 @@
.orgchart .node .content {
border-radius: 0 !important;
- border-bottom-width: 0 !important;
}
.orgchart .node .content:first-of-type {
@@ -54,15 +53,11 @@ vaadin-checkbox.smallcheckbox {
font-size: small;
}
-fc-orgchart p {
- max-width:calc(100% - 70px);
-}
-
.orgchart {
padding: 0;
}
-.image-title-demo .orgchart .title .symbol {
+.image-title-demo .orgchart .title .parentNodeSymbol {
display:none
}
diff --git a/src/test/resources/META-INF/resources/frontend/styles/orgchart/hybrid-demo-styles.css b/src/test/resources/META-INF/resources/frontend/styles/orgchart/hybrid-demo-styles.css
index d4c72c9..e2a8775 100644
--- a/src/test/resources/META-INF/resources/frontend/styles/orgchart/hybrid-demo-styles.css
+++ b/src/test/resources/META-INF/resources/frontend/styles/orgchart/hybrid-demo-styles.css
@@ -22,7 +22,8 @@
}
.hybrid-chart .orgchart .node .title {
- height: 80px !important;
+ height: 95px !important;
+ width: 210px;
text-align: left;
line-height: 18px;
font-size: 11px;
@@ -57,30 +58,22 @@
margin-right: 4px;
}
-.hybrid-chart .orgchart .title .symbol {
+.hybrid-chart .orgchart .title .parentNodeSymbol {
display: none
}
-.hybrid-chart .orgchart .lines .rightLine {
- border-right-color: var(--lumo-body-text-color);
+.hybrid-chart .orgchart .node:not(:only-child)::after{
+ background-color: var(--lumo-body-text-color);
}
-.hybrid-chart .orgchart .lines .leftLine {
- border-left-color: var(--lumo-body-text-color);
-}
-
-.hybrid-chart .orgchart .lines .topLine {
- border-top-color: var(--lumo-body-text-color);
-}
-
-.hybrid-chart .orgchart .verticalNodes>td::before {
+.hybrid-chart .orgchart .hierarchy::before {
border-color: var(--lumo-body-text-color);
}
-.hybrid-chart .orgchart .lines .downLine {
+.hybrid-chart .orgchart>ul>li>ul li>.node::before {
background-color: var(--lumo-body-text-color);
}
-.hybrid-chart .orgchart .verticalNodes ul>li::after, .hybrid-chart .orgchart .verticalNodes ul>li::before {
+.hybrid-chart .orgchart .nodes.vertical .hierarchy::after, .hybrid-chart .orgchart .nodes.vertical .hierarchy::before {
border-color: var(--lumo-body-text-color);
}
\ No newline at end of file
| |