igniteui-angular-inputs
Version:
Ignite UI Angular input components for building rich data visualizations for modern web apps.
524 lines (521 loc) • 19 kB
JavaScript
import { __extends } from "tslib";
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";
var IgxXLabelComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgxXLabelComponent, _super);
function IgxXLabelComponent(renderer, _elRef, ngZone, injector, componentFactoryResolver) {
var _this = _super.call(this) || this;
_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);
}
return _this;
}
// supports angular themes or custom properties set in CSS
IgxXLabelComponent.prototype.updateStyle = function () {
this._styling(this._root, this);
};
IgxXLabelComponent.prototype.ngOnDestroy = function () {
this._label.destroy();
this._wrapper.destroy();
};
IgxXLabelComponent.prototype.ngAfterViewInit = function () {
this._portalManager.dynamicContent = this._dynamicContent;
this._portalManager.onChildContentChanged(this._childTemplateRef);
this._styling(this._root, this);
this.updateStyle();
this.i.onSizeReady();
};
IgxXLabelComponent.prototype.createImplementation = function () {
return new XLabel();
};
Object.defineProperty(IgxXLabelComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "baseTheme", {
/**
* Gets or sets the base built in theme to use for the label.
*/
get: function () {
return this.i.p;
},
set: function (v) {
this.i.p = ensureEnum(BaseControlTheme_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "density", {
/**
* Gets or sets the display density to use for the label.
*/
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "actualDensity", {
/**
* Gets the actual display density to use for the label.
*/
get: function () {
return this.i.s;
},
set: function (v) {
this.i.s = ensureEnum(ControlDisplayDensity_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "actualTextColor", {
/**
* Gets the actual color to use for the text color.
*/
get: function () {
return brushToString(this.i.c3);
},
set: function (v) {
this.i.c3 = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "actualHighlightTextColor", {
/**
* Gets the actual color to use for the text color.
*/
get: function () {
return brushToString(this.i.c0);
},
set: function (v) {
this.i.c0 = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "actualHoverHighlightTextColor", {
/**
* Gets the actual color to use for the text color when highlighted and hovered.
*/
get: function () {
return brushToString(this.i.c1);
},
set: function (v) {
this.i.c1 = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "actualHoverTextColor", {
/**
* Gets the actual hover color to use for the text.
*/
get: function () {
return brushToString(this.i.c2);
},
set: function (v) {
this.i.c2 = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "textColor", {
/**
* Gets or sets the color to use for the text.
*/
get: function () {
return brushToString(this.i.dj);
},
set: function (v) {
this.i.dj = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "highlightTextColor", {
/**
* Gets or sets the color to use for the text.
*/
get: function () {
return brushToString(this.i.dg);
},
set: function (v) {
this.i.dg = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "hoverHighlightTextColor", {
/**
* Gets or sets the color to use for the text.
*/
get: function () {
return brushToString(this.i.dh);
},
set: function (v) {
this.i.dh = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "textStyle", {
/**
* Gets or sets the use for the button.
*/
get: function () {
if (this.i.y == null) {
return null;
}
return this.i.y.fontString;
},
set: function (v) {
var fi = new FontInfo();
fi.fontString = v;
this.i.y = fi;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "hoverTextColor", {
/**
* Gets or sets the color to use for the hovered text of the button regardless of type.
*/
get: function () {
return brushToString(this.i.di);
},
set: function (v) {
this.i.di = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "id", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.bw;
},
set: function (v) {
this.i.bw = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "display", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.bk;
},
set: function (v) {
this.i.bk = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "flexDirection", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.bn;
},
set: function (v) {
this.i.bn = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "flexGrow", {
/**
* Gets or sets the flex-grow setting for the button.
*/
get: function () {
return this.i.bp;
},
set: function (v) {
this.i.bp = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "alignItems", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.bc;
},
set: function (v) {
this.i.bc = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "alignSelf", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.be;
},
set: function (v) {
this.i.be = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "tabIndex", {
/**
* Gets or sets TabIndex to use for the checkbox.
*/
get: function () {
return this.i.au;
},
set: function (v) {
this.i.au = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "for", {
/**
* Gets or sets the for attribute to use for the label.
*/
get: function () {
return this.i.br;
},
set: function (v) {
this.i.br = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "ariaLabel", {
/**
* Gets or sets the value of the aria-label attribute.
*/
get: function () {
return this.i.bg;
},
set: function (v) {
this.i.bg = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "text", {
/**
* Gets or sets the text for the label.
*/
get: function () {
return this.i.text;
},
set: function (v) {
this.i.text = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "isHover", {
/**
* Gets or sets whether the label is hovered.
*/
get: function () {
return this.i.ao;
},
set: function (v) {
this.i.ao = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "value", {
/**
* Gets or sets the value for the label.
*/
get: function () {
return this.i.as;
},
set: function (v) {
this.i.as = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXLabelComponent.prototype, "disabled", {
/**
* Gets or sets whether the checkbox is disabled.
*/
get: function () {
return this.i.disabled;
},
set: function (v) {
this.i.disabled = ensureBool(v);
},
enumerable: false,
configurable: true
});
IgxXLabelComponent.prototype.onDetachedFromUI = function () {
this.i.onDetachedFromUI();
};
IgxXLabelComponent.prototype.onAttachedToUI = function () {
this.i.onAttachedToUI();
};
/**
* Exports visual information about the current state of the grid.
*/
IgxXLabelComponent.prototype.exportVisualModel = function () {
var iv = this.i.aw();
return (iv);
};
/**
* Returns a serialized copy of the exported visual model
*/
IgxXLabelComponent.prototype.exportSerializedVisualModel = function () {
var 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>\n<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;
}(IgxXInputGroupItemComponent));
export { 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>\n<ng-container #dynamicContent></ng-container>",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [],
host: { 'class': 'ig-x-label igx-x-label' },
styles: ["\n\t\t:host {\n\t\t\tdisplay: inline-block; \n vertical-align: middle; \n\t\t}\n\t"]
}]
}], 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
}] } });