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.
68 lines • 6.8 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
import { Component, Input, TemplateRef } from '@angular/core';
var DoubleEliminationTreeComponent = /** @class */ (function () {
function DoubleEliminationTreeComponent() {
}
/**
* @param {?} changes
* @return {?}
*/
DoubleEliminationTreeComponent.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
this.losersBracket = this.tournament.rounds.filter((/**
* @param {?} round
* @return {?}
*/
function (round) {
return round.type === 'Loserbracket';
}));
this.winnersBracket = this.tournament.rounds.filter((/**
* @param {?} round
* @return {?}
*/
function (round) {
return round.type === 'Winnerbracket';
}));
this.final = this.tournament.rounds.filter((/**
* @param {?} round
* @return {?}
*/
function (round) {
return round.type === 'Final';
})).shift();
};
DoubleEliminationTreeComponent.decorators = [
{ type: 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 <!-- {{winnersround.round}}-->\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 <!-- {{losersround.round}}<br>-->\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: [""]
}] }
];
/** @nocollapse */
DoubleEliminationTreeComponent.ctorParameters = function () { return []; };
DoubleEliminationTreeComponent.propDecorators = {
matchTemplate: [{ type: Input }],
tournament: [{ type: Input }]
};
return DoubleEliminationTreeComponent;
}());
export { DoubleEliminationTreeComponent };
if (false) {
/** @type {?} */
DoubleEliminationTreeComponent.prototype.matchTemplate;
/** @type {?} */
DoubleEliminationTreeComponent.prototype.tournament;
/** @type {?} */
DoubleEliminationTreeComponent.prototype.losersBracket;
/** @type {?} */
DoubleEliminationTreeComponent.prototype.winnersBracket;
/** @type {?} */
DoubleEliminationTreeComponent.prototype.final;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZG91YmxlLWVsaW1pbmF0aW9uLXRyZWUuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctdG91cm5hbWVudC10cmVlLyIsInNvdXJjZXMiOlsibGliL2RvdWJsZS1lbGltaW5hdGlvbi10cmVlL2RvdWJsZS1lbGltaW5hdGlvbi10cmVlLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsT0FBTyxFQUFDLFNBQVMsRUFBRSxLQUFLLEVBQTRCLFdBQVcsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUd0RjtJQWFFO0lBQ0EsQ0FBQzs7Ozs7SUFFRCxvREFB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