igniteui-angular-inputs
Version:
Ignite UI Angular input components for building rich data visualizations for modern web apps.
425 lines (422 loc) • 15.3 kB
JavaScript
import { TemplateRef, Component, ViewContainerRef, ViewChild, Input, ChangeDetectionStrategy, HostBinding } from '@angular/core';
import { XLabel } from "./XLabel";
import { ensureEnum, brushToString, stringToBrush, ensureBool, NamePatcher } from "igniteui-angular-core";
import { FontInfo } from "igniteui-angular-core";
import { AngularRenderer, PortalManager } from "igniteui-angular-core";
import { IgxXInputGroupItemComponent } from './igx-x-input-group-item-component';
import { ControlDisplayDensity_$type } from "igniteui-angular-core";
import { BaseControlTheme_$type } from "igniteui-angular-core";
import * as i0 from "@angular/core";
export let IgxXLabelComponent = /*@__PURE__*/ (() => {
class IgxXLabelComponent extends IgxXInputGroupItemComponent {
constructor(renderer, _elRef, ngZone, injector, componentFactoryResolver) {
super();
this.renderer = renderer;
this._elRef = _elRef;
this.ngZone = ngZone;
this.injector = injector;
this.componentFactoryResolver = componentFactoryResolver;
this._wrapper = null;
this._portalManager = null;
this._root = null;
if (this._styling) {
NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this));
}
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
if (renderer) {
this.container = renderer.createElement("div");
renderer.appendChild(_elRef.element.nativeElement, this.container);
renderer.setStyle(this.container, "display", "inline-block");
}
var root;
root = this.container;
if (this.container != null) {
root = this.container;
}
if (root && root.nativeElement) {
root = root.nativeElement;
}
this._root = root;
var label = this.i;
this._label = label;
if (renderer) {
this._portalManager = new PortalManager("labelContent", componentFactoryResolver);
var ren = new AngularRenderer(root, this.renderer, window.document, this.ngZone, true, {}, this._portalManager);
this._wrapper = ren;
label.provideContainer(ren);
}
}
// supports angular themes or custom properties set in CSS
updateStyle() {
this._styling(this._root, this);
}
ngOnDestroy() {
this._label.destroy();
this._wrapper.destroy();
}
ngAfterViewInit() {
this._portalManager.dynamicContent = this._dynamicContent;
this._portalManager.onChildContentChanged(this._childTemplateRef);
this._styling(this._root, this);
this.updateStyle();
this.i.onSizeReady();
}
createImplementation() {
return new XLabel();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Gets or sets the base built in theme to use for the label.
*/
get baseTheme() {
return this.i.p;
}
set baseTheme(v) {
this.i.p = ensureEnum(BaseControlTheme_$type, v);
}
/**
* Gets or sets the display density to use for the label.
*/
get density() {
return this.i.t;
}
set density(v) {
this.i.t = ensureEnum(ControlDisplayDensity_$type, v);
}
/**
* Gets the actual display density to use for the label.
*/
get actualDensity() {
return this.i.s;
}
set actualDensity(v) {
this.i.s = ensureEnum(ControlDisplayDensity_$type, v);
}
/**
* Gets the actual color to use for the text color.
*/
get actualTextColor() {
return brushToString(this.i.c3);
}
set actualTextColor(v) {
this.i.c3 = stringToBrush(v);
}
/**
* Gets the actual color to use for the text color.
*/
get actualHighlightTextColor() {
return brushToString(this.i.c0);
}
set actualHighlightTextColor(v) {
this.i.c0 = stringToBrush(v);
}
/**
* Gets the actual color to use for the text color when highlighted and hovered.
*/
get actualHoverHighlightTextColor() {
return brushToString(this.i.c1);
}
set actualHoverHighlightTextColor(v) {
this.i.c1 = stringToBrush(v);
}
/**
* Gets the actual hover color to use for the text.
*/
get actualHoverTextColor() {
return brushToString(this.i.c2);
}
set actualHoverTextColor(v) {
this.i.c2 = stringToBrush(v);
}
/**
* Gets or sets the color to use for the text.
*/
get textColor() {
return brushToString(this.i.dj);
}
set textColor(v) {
this.i.dj = stringToBrush(v);
}
/**
* Gets or sets the color to use for the text.
*/
get highlightTextColor() {
return brushToString(this.i.dg);
}
set highlightTextColor(v) {
this.i.dg = stringToBrush(v);
}
/**
* Gets or sets the color to use for the text.
*/
get hoverHighlightTextColor() {
return brushToString(this.i.dh);
}
set hoverHighlightTextColor(v) {
this.i.dh = stringToBrush(v);
}
/**
* Gets or sets the use for the button.
*/
get textStyle() {
if (this.i.y == null) {
return null;
}
return this.i.y.fontString;
}
set textStyle(v) {
let fi = new FontInfo();
fi.fontString = v;
this.i.y = fi;
}
/**
* Gets or sets the color to use for the hovered text of the button regardless of type.
*/
get hoverTextColor() {
return brushToString(this.i.di);
}
set hoverTextColor(v) {
this.i.di = stringToBrush(v);
}
/**
* Gets or sets the id to use for the checkbox.
*/
get id() {
return this.i.bw;
}
set id(v) {
this.i.bw = v;
}
/**
* Gets or sets the id to use for the checkbox.
*/
get display() {
return this.i.bk;
}
set display(v) {
this.i.bk = v;
}
/**
* Gets or sets the id to use for the checkbox.
*/
get flexDirection() {
return this.i.bn;
}
set flexDirection(v) {
this.i.bn = v;
}
/**
* Gets or sets the flex-grow setting for the button.
*/
get flexGrow() {
return this.i.bp;
}
set flexGrow(v) {
this.i.bp = v;
}
/**
* Gets or sets the id to use for the checkbox.
*/
get alignItems() {
return this.i.bc;
}
set alignItems(v) {
this.i.bc = v;
}
/**
* Gets or sets the id to use for the checkbox.
*/
get alignSelf() {
return this.i.be;
}
set alignSelf(v) {
this.i.be = v;
}
/**
* Gets or sets TabIndex to use for the checkbox.
*/
get tabIndex() {
return this.i.au;
}
set tabIndex(v) {
this.i.au = +v;
}
/**
* Gets or sets the for attribute to use for the label.
*/
get for() {
return this.i.br;
}
set for(v) {
this.i.br = v;
}
/**
* Gets or sets the value of the aria-label attribute.
*/
get ariaLabel() {
return this.i.bg;
}
set ariaLabel(v) {
this.i.bg = v;
}
/**
* Gets or sets the text for the label.
*/
get text() {
return this.i.text;
}
set text(v) {
this.i.text = v;
}
/**
* Gets or sets whether the label is hovered.
*/
get isHover() {
return this.i.ao;
}
set isHover(v) {
this.i.ao = ensureBool(v);
}
/**
* Gets or sets the value for the label.
*/
get value() {
return this.i.as;
}
set value(v) {
this.i.as = ensureBool(v);
}
/**
* Gets or sets whether the checkbox is disabled.
*/
get disabled() {
return this.i.disabled;
}
set disabled(v) {
this.i.disabled = ensureBool(v);
}
onDetachedFromUI() {
this.i.onDetachedFromUI();
}
onAttachedToUI() {
this.i.onAttachedToUI();
}
/**
* Exports visual information about the current state of the grid.
*/
exportVisualModel() {
let iv = this.i.aw();
return (iv);
}
/**
* Returns a serialized copy of the exported visual model
*/
exportSerializedVisualModel() {
let iv = this.i.bm();
return (iv);
}
}
IgxXLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXLabelComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
IgxXLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxXLabelComponent, selector: "igx-x-label", inputs: { baseTheme: "baseTheme", density: "density", actualDensity: "actualDensity", actualTextColor: "actualTextColor", actualHighlightTextColor: "actualHighlightTextColor", actualHoverHighlightTextColor: "actualHoverHighlightTextColor", actualHoverTextColor: "actualHoverTextColor", textColor: "textColor", highlightTextColor: "highlightTextColor", hoverHighlightTextColor: "hoverHighlightTextColor", textStyle: "textStyle", hoverTextColor: "hoverTextColor", id: "id", display: "display", flexDirection: "flexDirection", flexGrow: "flexGrow", alignItems: "alignItems", alignSelf: "alignSelf", tabIndex: ["tabindex", "tabIndex"], for: "for", ariaLabel: ["aria-label", "ariaLabel"], text: "text", isHover: "isHover", value: "value", disabled: "disabled" }, host: { properties: { "attr.id": "this.id", "style.display": "this.display", "style.flexDirection": "this.flexDirection", "style.flexGrow": "this.flexGrow", "style.alignItems": "this.alignSelf" }, classAttribute: "ig-x-label igx-x-label" }, providers: [], viewQueries: [{ propertyName: "_dynamicContent", first: true, predicate: ["dynamicContent"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "_childTemplateRef", first: true, predicate: ["childContent"], descendants: true, read: TemplateRef }], usesInheritance: true, ngImport: i0, template: `<ng-template #childContent><ng-content></ng-content></ng-template>
<ng-container #dynamicContent></ng-container>`, isInline: true, styles: ["\n\t\t:host {\n\t\t\tdisplay: inline-block; \n vertical-align: middle; \n\t\t}\n\t"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxXLabelComponent;
})();
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXLabelComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-x-label',
template: `<ng-template #childContent><ng-content></ng-content></ng-template>
<ng-container #dynamicContent></ng-container>`,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [],
host: { 'class': 'ig-x-label igx-x-label' },
styles: [`
:host {
display: inline-block;
vertical-align: middle;
}
`]
}]
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { _dynamicContent: [{
type: ViewChild,
args: ["dynamicContent", { read: ViewContainerRef, static: true }]
}], _childTemplateRef: [{
type: ViewChild,
args: ["childContent", { read: TemplateRef, static: false }]
}], baseTheme: [{
type: Input
}], density: [{
type: Input
}], actualDensity: [{
type: Input
}], actualTextColor: [{
type: Input
}], actualHighlightTextColor: [{
type: Input
}], actualHoverHighlightTextColor: [{
type: Input
}], actualHoverTextColor: [{
type: Input
}], textColor: [{
type: Input
}], highlightTextColor: [{
type: Input
}], hoverHighlightTextColor: [{
type: Input
}], textStyle: [{
type: Input
}], hoverTextColor: [{
type: Input
}], id: [{
type: HostBinding,
args: ['attr.id']
}, {
type: Input
}], display: [{
type: HostBinding,
args: ['style.display']
}, {
type: Input
}], flexDirection: [{
type: HostBinding,
args: ['style.flexDirection']
}, {
type: Input
}], flexGrow: [{
type: HostBinding,
args: ['style.flexGrow']
}, {
type: Input
}], alignItems: [{
type: HostBinding,
args: ['style.alignItems']
}, {
type: Input
}], alignSelf: [{
type: HostBinding,
args: ['style.alignItems']
}, {
type: Input
}], tabIndex: [{
type: Input,
args: ['tabindex']
}], for: [{
type: Input
}], ariaLabel: [{
type: Input,
args: ['aria-label']
}], text: [{
type: Input
}], isHover: [{
type: Input
}], value: [{
type: Input
}], disabled: [{
type: Input
}] } });