UNPKG

ngx-flowchart

Version:

`ngx-flowchart` is an Angular component to show a flow chart. You can also grouping the flow process.

16 lines (14 loc) 6.38 kB
!function(o,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-flowchart",["exports","@angular/core","@angular/common"],n):n((o=o||self)["ngx-flowchart"]={},o.ng.core,o.ng.common)}(this,(function(o,n,r){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */function e(o,n,r,e){var t,i=arguments.length,a=i<3?n:null===e?e=Object.getOwnPropertyDescriptor(n,r):e;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(o,n,r,e);else for(var d=o.length-1;d>=0;d--)(t=o[d])&&(a=(i<3?t(a):i>3?t(n,r,a):t(n,r))||a);return i>3&&a&&Object.defineProperty(n,r,a),a}var t=function(){function o(){}return o.ɵprov=n.ɵɵdefineInjectable({factory:function(){return new o},token:o,providedIn:"root"}),o=e([n.Injectable({providedIn:"root"})],o)}(),i=function(){function o(){this.clickName=new n.EventEmitter,this.options={groupBackground:"linear-gradient(to bottom,#b9b9b9 0,#fefefe 100%)",groupShadow:"0 0.3rem 0.5rem 0 rgba(44,51,73,.5)",groupBorderRadius:"3px",groupTextColor:"#000",background:"#0e3e7d",shadow:"0 2px 4px 0 #333",borderRadius:"5px",textColor:"#fff",width:"200px"}}return o.prototype.ngOnInit=function(){},o.prototype.clickFlow=function(o){this.clickName.emit(o)},e([n.Input()],o.prototype,"data",void 0),e([n.Output()],o.prototype,"clickName",void 0),e([n.Input()],o.prototype,"options",void 0),o=e([n.Component({selector:"ngx-flowchart",template:'<div class="flow-total">\r\n <ng-container *ngFor="let item of data; let i = index">\r\n <ng-container *ngIf="i !== 0">\r\n <svg style="margin: .1rem 0 .2rem 0; width: 24px; height: 24px;" xmlns="http://www.w3.org/2000/svg"\r\n width="100%" height="100%" viewBox="0 0 24 24" fill="#222b45">\r\n <g data-name="Layer 2">\r\n <g data-name="arrow-downward">\r\n <rect width="24" height="24" opacity="0"></rect>\r\n <path\r\n d="M18.77 13.36a1 1 0 0 0-1.41-.13L13 16.86V5a1 1 0 0 0-2 0v11.86l-4.36-3.63a1 1 0 1 0-1.28 1.54l6 5 .15.09.13.07a1 1 0 0 0 .72 0l.13-.07.15-.09 6-5a1 1 0 0 0 .13-1.41z">\r\n </path>\r\n </g>\r\n </g>\r\n </svg>\r\n </ng-container>\r\n <div *ngIf="item.groupData == undefined" class="flow-operation">\r\n <span (click)="clickFlow(item)"\r\n [ngStyle]="{\'background\': options.background, \'color\': options.textColor, \r\n \'border-radius\': options.borderRadius,\'box-shadow\': options.shadow, \'min-width\': options.width}">{{item.name}}</span>\r\n </div>\r\n <div *ngIf="item.groupData !== undefined" class="flow-group" [ngStyle]="{\'background\': options.groupBackground, \'color\': options.groupTextColor, \r\n \'border-radius\': options.groupBorderRadius,\'box-shadow\': options.groupShadow}">\r\n <span (click)="clickFlow(item)" style=\'font-size: 1.2rem\'>{{item.name}}</span>\r\n <ng-container *ngFor="let d of item.groupData; let j = index">\r\n <div class="flow-operation">\r\n <span (click)="clickFlow(d)"\r\n [ngStyle]="{\'background\': options.background, \'color\': options.textColor, \r\n \'border-radius\': options.borderRadius,\'box-shadow\': options.shadow, \'min-width\': options.width}">{{d.name}}</span>\r\n <ng-container *ngIf="j !== (item.groupData.length - 1)">\r\n <svg style="margin: .3rem 0 0 0; width: 24px; height: 24px" xmlns="http://www.w3.org/2000/svg"\r\n width="100%" height="100%" viewBox="0 0 24 24" fill="#222b45">\r\n <g data-name="Layer 2">\r\n <g data-name="arrow-downward">\r\n <rect width="24" height="24" opacity="0"></rect>\r\n <path\r\n d="M18.77 13.36a1 1 0 0 0-1.41-.13L13 16.86V5a1 1 0 0 0-2 0v11.86l-4.36-3.63a1 1 0 1 0-1.28 1.54l6 5 .15.09.13.07a1 1 0 0 0 .72 0l.13-.07.15-.09 6-5a1 1 0 0 0 .13-1.41z">\r\n </path>\r\n </g>\r\n </g>\r\n </svg>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n</div>',styles:[".flow-total{text-align:center;display:flex;flex-direction:column;align-items:center}.flow-group{padding:.6rem 2rem .5rem;background:linear-gradient(to bottom,#b9b9b9 0,#fefefe 100%);color:#000;margin-bottom:.3rem;border-radius:3px;box-shadow:0 .3rem .5rem 0 rgba(44,51,73,.5);min-width:200px}.flow-operation{display:flex;margin:.3rem 0;align-items:center;justify-content:center;font-size:.89rem;flex-direction:column}.flow-operation span{background:#0e3e7d;color:#fff;padding:.5rem 2rem;border-radius:5px;box-shadow:0 2px 4px 0 #333}.flow-operation nb-icon{margin-top:.3rem;width:1.5em;height:1.5em}.flow-total span{cursor:pointer;min-width:200px}"]})],o)}(),a=function(){function o(){}return o=e([n.NgModule({declarations:[i],imports:[r.CommonModule],exports:[i]})],o)}();o.NgxFlowchartComponent=i,o.NgxFlowchartModule=a,o.NgxFlowchartService=t,Object.defineProperty(o,"__esModule",{value:!0})})); //# sourceMappingURL=ngx-flowchart.umd.min.js.map