UNPKG

ng-tournament-tree

Version:

Tournament-Tree render components for Angular. Includes single- and double-elimination trees. You can also customize how a match is displayed by providing your own component.

2 lines 5.14 kB
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define("ng-tournament-tree",["exports","@angular/core","@angular/common"],t):t((n=n||self)["ng-tournament-tree"]={},n.ng.core,n.ng.common)}(this,(function(n,t,e){"use strict";var r=function(){function n(){}return n.prototype.ngOnChanges=function(n){this.losersBracket=this.tournament.rounds.filter((function(n){return"Loserbracket"===n.type})),this.winnersBracket=this.tournament.rounds.filter((function(n){return"Winnerbracket"===n.type})),this.final=this.tournament.rounds.filter((function(n){return"Final"===n.type})).shift()},n.decorators=[{type:t.Component,args:[{selector:"ngtt-double-elimination-tree",template:'<div class="ngtt-de__container">\r\n <div class="ngtt-de__winners-bracket-wrapper">\r\n <ng-container *ngFor="let winnersround of winnersBracket">\r\n \x3c!-- {{winnersround.round}}--\x3e\r\n <div class="ngtt-de__winners-round-wrapper">\r\n <ng-container *ngFor="let match of winnersround.matches">\r\n <div class="ngtt-de__winners-match-wrapper">\r\n <div class="ngtt-de__match-component-container">\r\n <ng-container *ngTemplateOutlet="matchTemplate; context:{$implicit: match}"></ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <div class="ngtt-de__winners-round-wrapper">\r\n <div class="ngtt-de__finale-match-wrapper">\r\n <div class="ngtt-de__match-component-container">\r\n <ng-container *ngTemplateOutlet="matchTemplate; context:{$implicit: final.matches[0]}"></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div class="ngtt-de__losers-bracket-wrapper">\r\n <ng-container *ngFor="let losersround of losersBracket">\r\n \x3c!-- {{losersround.round}}<br>--\x3e\r\n <div class="ngtt-de__losers-round-wrapper">\r\n <ng-container *ngFor="let match of losersround.matches">\r\n <div class="ngtt-de__losers-match-wrapper">\r\n <div class="ngtt-de__match-component-container">\r\n <ng-container *ngTemplateOutlet="matchTemplate; context:{$implicit: match}"></ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </div>\r\n</div>\r\n',styles:[""]}]}],n.ctorParameters=function(){return[]},n.propDecorators={matchTemplate:[{type:t.Input}],tournament:[{type:t.Input}]},n}();var o=[r],a=function(){function n(){}return n.decorators=[{type:t.NgModule,args:[{declarations:o,imports:[e.CommonModule],exports:o}]}],n}(),i=function(){function n(){}return n.prototype.ngOnInit=function(){},n.prototype.ngOnChanges=function(n){n.hasOwnProperty("tournament")&&n.tournament.currentValue&&(this.winnersBracket=this.tournament.rounds.filter((function(n){return"Winnerbracket"===n.type}))),console.log(this.winnersBracket),this.final=this.tournament.rounds.filter((function(n){return"Final"===n.type})).shift(),console.log(this.final)},n.decorators=[{type:t.Component,args:[{selector:"ngtt-single-elimination-tree",template:'<div class="ngtt-se__container">\r\n <div class="ngtt-se__bracket-wrapper">\r\n <ng-container *ngFor="let winnersround of winnersBracket; let i = index">\r\n <div class="ngtt-se__round-wrapper">\r\n <ng-container *ngFor="let match of winnersround.matches">\r\n <div class="ngtt-se__match-wrapper">\r\n <div class="ngtt-se__match-component-container">\r\n <ng-container *ngTemplateOutlet="matchTemplate; context:{$implicit: match}"></ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container>\r\n <div class="ngtt-se__round-wrapper">\r\n <div class="ngtt-se__match-wrapper">\r\n <div class="ngtt-se__finale-match-wrapper">\r\n <div class="ngtt-se__finale-component-container">\r\n <ng-container\r\n *ngTemplateOutlet="matchTemplate; context:{$implicit: final.matches[0]}"></ng-container>\r\n </div>\r\n <div class="ngtt-se__match-component-container" *ngIf="final.matches.length > 1">\r\n <ng-container *ngTemplateOutlet="matchTemplate; context:{$implicit: final.matches[1]}"></ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n</div>\r\n',styles:[""]}]}],n.ctorParameters=function(){return[]},n.propDecorators={matchTemplate:[{type:t.Input}],tournament:[{type:t.Input}]},n}();var c=[i],s=function(){function n(){}return n.decorators=[{type:t.NgModule,args:[{declarations:c,imports:[e.CommonModule],exports:c}]}],n}(),l=[s,a],d=function(){function n(){}return n.decorators=[{type:t.NgModule,args:[{declarations:[],imports:l,exports:l}]}],n}();n.NgTournamentTreeModule=d,n.ɵa=s,n.ɵb=i,n.ɵc=a,n.ɵd=r,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=ng-tournament-tree.umd.min.js.map