import { ChangeDetectorRef, Component, ElementRef, Input, ViewChild } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class BadgeComponent {
    constructor(cdr) {
        this.cdr = cdr;
        this.hasContent = true;
        this.maxCount = 99;
        this.showDot = false;
        this.position = 'top-right';
    }
    /**
     * @deprecated
     * 用position替代
     */
    set badgePos(value) {
        this.position = value;
    }
    /**
     * @deprecated
     * 用offset替代
     */
    set offsetXY(value) {
        this.offset = value;
    }
    hasContentProjection() {
        const nodes = this.contentProjection?.nativeElement;
        const contents = nodes.childNodes;
        this.hasContent = contents.length ? true : false;
    }
    parseCountToNumber() {
        if (typeof (this.count) === 'number') {
            return this.count;
        }
        else {
            const parseNumber = parseInt(this.count);
            return isNaN(parseNumber) ? -1 : parseNumber;
        }
    }
    ngAfterViewInit() {
        this.hasContentProjection();
        this.cdr.detectChanges();
    }
}
BadgeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BadgeComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
BadgeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: BadgeComponent, selector: "d-badge", inputs: { count: "count", maxCount: "maxCount", showDot: "showDot", status: "status", badgePos: "badgePos", position: "position", offsetXY: "offsetXY", offset: "offset", bgColor: "bgColor", textColor: "textColor" }, viewQueries: [{ propertyName: "contentProjection", first: true, predicate: ["contentProjection"], descendants: true }], ngImport: i0, template: "<span #contentProjection><ng-content></ng-content></span>\n<span\n  *ngIf=\"!showDot && !hasContent\"\n  class=\"devui-badge-count devui-badge-count-{{ status }}\"\n  [style.background]=\"bgColor\"\n  [style.color]=\"textColor\"\n>\n  {{ count }}\n</span>\n<span *ngIf=\"showDot && !hasContent\" class=\"devui-badge-status devui-badge-status-{{ status }}\"></span>\n<span\n  *ngIf=\"hasContent\"\n  class=\"devui-badge-content devui-badge-content-{{ status }} devui-badge-content-{{ position }}\"\n  [style.background]=\"bgColor\"\n  [style.color]=\"textColor\"\n  [style.right.px]=\"offset && offset[0] ? -offset[0] : null\"\n  [style.top.px]=\"offset && offset[1] ? offset[1] : null\"\n  [ngClass]=\"{ 'devui-badge-content-count': !showDot, 'devui-badge-content-dot': showDot }\"\n>\n  <ng-container *ngIf=\"!showDot && parseCountToNumber() <= maxCount\">{{ count }}</ng-container>\n  <ng-container *ngIf=\"!showDot && parseCountToNumber() > maxCount\">{{ maxCount }}+</ng-container>\n</span>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}:host{position:relative;display:inline-block;line-height:1}.devui-badge-content{position:absolute}.devui-badge-content-count{background:#5e7ce0;background:var(--devui-brand, #5e7ce0);color:#fff;color:var(--devui-light-text, #ffffff);min-width:16px;height:16px;font-size:12px;font-size:var(--devui-font-size-sm, 12px);line-height:16px;text-align:center;padding:0 4px;border-radius:100px;border-radius:var(--devui-border-radius-full, 100px)}.devui-badge-content-dot{width:6px;height:6px;border-radius:100%;background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-content-top-left{top:0;left:0;transform:translate(-50%,-50%)}.devui-badge-content-top-right{top:0;right:0;transform:translate(50%,-50%)}.devui-badge-content-bottom-left{bottom:0;left:0;transform:translate(-50%,50%)}.devui-badge-content-bottom-right{bottom:0;right:0;transform:translate(50%,50%)}.devui-badge-content-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-content-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-content-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-content-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-content-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-content-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}.devui-badge-count{display:inline-block;position:relative;right:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0);color:#fff;color:var(--devui-light-text, #ffffff);min-width:16px;height:16px;font-size:12px;font-size:var(--devui-font-size-sm, 12px);line-height:16px;text-align:center;padding:0 4px;border-radius:100px;border-radius:var(--devui-border-radius-full, 100px)}.devui-badge-count-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-count-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-count-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-count-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-count-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-count-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}.devui-badge-status{line-height:inherit;vertical-align:baseline;position:relative;top:-1px;display:inline-block;width:6px;height:6px;border-radius:100%}.devui-badge-status-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-status-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-status-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-status-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-status-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-status-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: BadgeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'd-badge', template: "<span #contentProjection><ng-content></ng-content></span>\n<span\n  *ngIf=\"!showDot && !hasContent\"\n  class=\"devui-badge-count devui-badge-count-{{ status }}\"\n  [style.background]=\"bgColor\"\n  [style.color]=\"textColor\"\n>\n  {{ count }}\n</span>\n<span *ngIf=\"showDot && !hasContent\" class=\"devui-badge-status devui-badge-status-{{ status }}\"></span>\n<span\n  *ngIf=\"hasContent\"\n  class=\"devui-badge-content devui-badge-content-{{ status }} devui-badge-content-{{ position }}\"\n  [style.background]=\"bgColor\"\n  [style.color]=\"textColor\"\n  [style.right.px]=\"offset && offset[0] ? -offset[0] : null\"\n  [style.top.px]=\"offset && offset[1] ? offset[1] : null\"\n  [ngClass]=\"{ 'devui-badge-content-count': !showDot, 'devui-badge-content-dot': showDot }\"\n>\n  <ng-container *ngIf=\"!showDot && parseCountToNumber() <= maxCount\">{{ count }}</ng-container>\n  <ng-container *ngIf=\"!showDot && parseCountToNumber() > maxCount\">{{ maxCount }}+</ng-container>\n</span>\n", styles: [".devui-font-size-base{font-size:12px;font-size:var(--devui-font-size, 12px)}.devui-font-base{font-size:12px;font-size:var(--devui-font-size, 12px);font-weight:400;line-height:1.5}.devui-font-size-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px)}.devui-font-modal-title{font-size:18px;font-size:var(--devui-font-size-modal-title, 18px);font-weight:700;line-height:1.5}.devui-font-size-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px)}.devui-font-page-title{font-size:16px;font-size:var(--devui-font-size-page-title, 16px);font-weight:700;line-height:1.5}.devui-font-size-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px)}.devui-font-secondary-title{font-size:14px;font-size:var(--devui-font-size-card-title, 14px);font-weight:700;line-height:1.5}:host{position:relative;display:inline-block;line-height:1}.devui-badge-content{position:absolute}.devui-badge-content-count{background:#5e7ce0;background:var(--devui-brand, #5e7ce0);color:#fff;color:var(--devui-light-text, #ffffff);min-width:16px;height:16px;font-size:12px;font-size:var(--devui-font-size-sm, 12px);line-height:16px;text-align:center;padding:0 4px;border-radius:100px;border-radius:var(--devui-border-radius-full, 100px)}.devui-badge-content-dot{width:6px;height:6px;border-radius:100%;background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-content-top-left{top:0;left:0;transform:translate(-50%,-50%)}.devui-badge-content-top-right{top:0;right:0;transform:translate(50%,-50%)}.devui-badge-content-bottom-left{bottom:0;left:0;transform:translate(-50%,50%)}.devui-badge-content-bottom-right{bottom:0;right:0;transform:translate(50%,50%)}.devui-badge-content-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-content-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-content-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-content-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-content-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-content-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}.devui-badge-count{display:inline-block;position:relative;right:0;background:#5e7ce0;background:var(--devui-brand, #5e7ce0);color:#fff;color:var(--devui-light-text, #ffffff);min-width:16px;height:16px;font-size:12px;font-size:var(--devui-font-size-sm, 12px);line-height:16px;text-align:center;padding:0 4px;border-radius:100px;border-radius:var(--devui-border-radius-full, 100px)}.devui-badge-count-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-count-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-count-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-count-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-count-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-count-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}.devui-badge-status{line-height:inherit;vertical-align:baseline;position:relative;top:-1px;display:inline-block;width:6px;height:6px;border-radius:100%}.devui-badge-status-danger{background:#f66f6a;background:var(--devui-danger, #f66f6a)}.devui-badge-status-warning{background:#fac20a;background:var(--devui-warning, #fac20a)}.devui-badge-status-waiting{background:#beccfa;background:var(--devui-waiting, #beccfa)}.devui-badge-status-success{background:#50d4ab;background:var(--devui-success, #50d4ab)}.devui-badge-status-info{background:#5e7ce0;background:var(--devui-info, #5e7ce0)}.devui-badge-status-common{background:#f5f5f5;background:var(--devui-unavailable, #f5f5f5);color:#71757f;color:var(--devui-aide-text, #71757f)}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { contentProjection: [{
                type: ViewChild,
                args: ['contentProjection']
            }], count: [{
                type: Input
            }], maxCount: [{
                type: Input
            }], showDot: [{
                type: Input
            }], status: [{
                type: Input
            }], badgePos: [{
                type: Input
            }], position: [{
                type: Input
            }], offsetXY: [{
                type: Input
            }], offset: [{
                type: Input
            }], bgColor: [{
                type: Input
            }], textColor: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 