@ux-aspects/ux-aspects
Version:
Open source user interface framework for building modern, responsive, mobile big data applications
72 lines (71 loc) • 3.06 kB
TypeScript
import { AfterViewInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
import * as i0 from "@angular/core";
export type BadgeVerticalPosition = 'above' | 'below';
export type BadgeHorizontalPosition = 'before' | 'after';
export type BadgeSize = 'small' | 'medium' | 'large';
export declare class BadgeDirective implements AfterViewInit, OnChanges, OnDestroy {
private readonly _element;
private readonly _renderer;
private readonly _colorService;
private readonly _contrastService;
private readonly _className;
private readonly _darkColor;
private readonly _lightColor;
private _badgeElement;
private _isNumber;
/**
* Directive parameter that sets the content of the badge
*/
private _badgeDisplayContent;
get badgeContent(): string | number;
set badgeContent(badge: string | number);
private _badgeContent;
/**
* Define the badge background color
*/
get badgeColor(): string;
set badgeColor(color: string);
private _badgeColor;
/**
* Define the badge border color - if unset there is no border
*/
get badgeBorderColor(): string;
set badgeBorderColor(color: string);
private _badgeBorderColor;
/**
* Set the badge vertical position in relation to the parent element
*/
badgeVerticalPosition: BadgeVerticalPosition;
/**
* Set the badge horizontal position in relation to the parent element
*/
badgeHorizontalPosition: BadgeHorizontalPosition;
/**
* Set if the badge overlaps parent content or flows after parent
*/
badgeOverlap: boolean;
/**
* Max value that can be displayed - if string measures no. of characters,
* if number checks against exact number not no. of characters
*/
badgeMaxValue: number;
/**
* Badge size (based on CSS styles)
*/
badgeSize: BadgeSize;
/**
* Hide badge from view
*/
badgeHidden: boolean;
ngAfterViewInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
private setContent;
private setBadgeColor;
private setBadgeBorderColor;
private setBadgeSize;
private determineContentTextColor;
private parseThemeColor;
static ɵfac: i0.ɵɵFactoryDeclaration<BadgeDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<BadgeDirective, "[uxBadge]", ["ux-badge"], { "badgeContent": { "alias": "uxBadge"; "required": false; }; "badgeColor": { "alias": "badgeColor"; "required": false; }; "badgeBorderColor": { "alias": "badgeBorderColor"; "required": false; }; "badgeVerticalPosition": { "alias": "badgeVerticalPosition"; "required": false; }; "badgeHorizontalPosition": { "alias": "badgeHorizontalPosition"; "required": false; }; "badgeOverlap": { "alias": "badgeOverlap"; "required": false; }; "badgeMaxValue": { "alias": "badgeMaxValue"; "required": false; }; "badgeSize": { "alias": "badgeSize"; "required": false; }; "badgeHidden": { "alias": "badgeHidden"; "required": false; }; }, {}, never, never, false, never>;
}