UNPKG

primeng-extensions

Version:

[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![npm](https://img.shields.io/npm/dt/primeng-extensions.svg)]() [![Dependency Status][daviddm-image]][daviddm-url] ![Crates.io](https://img.shields.io/github/license/mashape

92 lines 4.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var core_1 = require("@angular/core"); var common_1 = require("@angular/common"); var i0 = require("@angular/core"); var i1 = require("@angular/common"); var _c0 = function (a0) { return { "background-color": a0 }; }; var _c1 = function (a2) { return { "ui-widget ui-widget-content ui-corner-all ui-badge-content": true, "fixed": true, "dot": a2 }; }; function BadgeComponent_span_2_Template(rf, ctx) { if (rf & 1) { i0.ɵɵelementStart(0, "span", 2); i0.ɵɵtext(1); i0.ɵɵelementEnd(); } if (rf & 2) { var ctx_r0 = i0.ɵɵnextContext(); i0.ɵɵclassMap(ctx_r0.badgeClass); i0.ɵɵproperty("ngStyle", i0.ɵɵpureFunction1(5, _c0, ctx_r0.backgroundColor))("ngClass", i0.ɵɵpureFunction1(7, _c1, ctx_r0.dot)); i0.ɵɵadvance(1); i0.ɵɵtextInterpolate1(" ", ctx_r0.data(), " "); } } var _c2 = ["*"]; var BadgeComponent = /** @class */ (function () { function BadgeComponent() { this.backgroundColor = ''; } BadgeComponent.prototype.data = function () { if (this.dot) { return; } if (typeof this.value === 'number' && typeof this.max === 'number') { return this.max < this.value ? this.max + "+" : this.value; } else { return this.value; } }; BadgeComponent.prototype.display = function () { return (this.data() || this.dot); }; BadgeComponent.prototype.ngOnDestroy = function () { }; BadgeComponent.prototype.ngOnInit = function () { }; BadgeComponent.ɵfac = function BadgeComponent_Factory(t) { return new (t || BadgeComponent)(); }; BadgeComponent.ɵcmp = i0.ɵɵdefineComponent({ type: BadgeComponent, selectors: [["pe-badge"]], inputs: { value: "value", max: "max", dot: "dot", backgroundColor: "backgroundColor", badgeClass: "badgeClass" }, ngContentSelectors: _c2, decls: 3, vars: 1, consts: [[1, "ui-badge", "ui-position"], [3, "class", "ngStyle", "ngClass", 4, "ngIf"], [3, "ngStyle", "ngClass"]], template: function BadgeComponent_Template(rf, ctx) { if (rf & 1) { i0.ɵɵprojectionDef(); i0.ɵɵelementStart(0, "div", 0); i0.ɵɵprojection(1); i0.ɵɵtemplate(2, BadgeComponent_span_2_Template, 2, 9, "span", 1); i0.ɵɵelementEnd(); } if (rf & 2) { i0.ɵɵadvance(2); i0.ɵɵproperty("ngIf", ctx.display()); } }, directives: [i1.NgIf, i1.NgStyle, i1.NgClass], encapsulation: 2 }); return BadgeComponent; }()); exports.BadgeComponent = BadgeComponent; /*@__PURE__*/ (function () { i0.ɵsetClassMetadata(BadgeComponent, [{ type: core_1.Component, args: [{ selector: 'pe-badge', template: "<div class=\"ui-badge ui-position\">\n <ng-content></ng-content>\n <span *ngIf=\"display()\"\n [class]=\"badgeClass\" [ngStyle]=\"{'background-color': backgroundColor}\"\n [ngClass]=\"{'ui-widget ui-widget-content ui-corner-all ui-badge-content':true,'fixed': true, 'dot': dot }\">\n {{data()}}\n </span>\n </div>", encapsulation: core_1.ViewEncapsulation.None, }] }], null, { value: [{ type: core_1.Input }], max: [{ type: core_1.Input }], dot: [{ type: core_1.Input }], backgroundColor: [{ type: core_1.Input }], badgeClass: [{ type: core_1.Input }] }); })(); var BadgeModule = /** @class */ (function () { function BadgeModule() { } BadgeModule.ɵmod = i0.ɵɵdefineNgModule({ type: BadgeModule }); BadgeModule.ɵinj = i0.ɵɵdefineInjector({ factory: function BadgeModule_Factory(t) { return new (t || BadgeModule)(); }, imports: [[common_1.CommonModule]] }); return BadgeModule; }()); exports.BadgeModule = BadgeModule; (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(BadgeModule, { declarations: [BadgeComponent], imports: [common_1.CommonModule], exports: [BadgeComponent] }); })(); /*@__PURE__*/ (function () { i0.ɵsetClassMetadata(BadgeModule, [{ type: core_1.NgModule, args: [{ imports: [common_1.CommonModule], exports: [BadgeComponent], declarations: [BadgeComponent] }] }], null, null); })(); //# sourceMappingURL=badge.js.map