igniteui-angular-inputs
Version:
Ignite UI Angular input components for building rich data visualizations for modern web apps.
181 lines (178 loc) • 8.12 kB
JavaScript
import { __extends } from "tslib";
import { TemplateRef, Component, ViewContainerRef, ViewChild, Input, ChangeDetectionStrategy, HostBinding } from '@angular/core';
import { XSuffix } from "./XSuffix";
import { ensureBool, NamePatcher } from "igniteui-angular-core";
import { AngularRenderer, PortalManager } from "igniteui-angular-core";
import { IgxXInputGroupItemComponent } from './igx-x-input-group-item-component';
import * as i0 from "@angular/core";
var IgxXSuffixComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgxXSuffixComponent, _super);
function IgxXSuffixComponent(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 suffix = _this.i;
_this._suffix = suffix;
if (renderer) {
_this._portalManager = new PortalManager("suffixContent", componentFactoryResolver);
var ren = new AngularRenderer(root, _this.renderer, window.document, _this.ngZone, true, {}, _this._portalManager);
_this._wrapper = ren;
suffix.provideContainer(ren);
}
return _this;
}
// supports angular themes or custom properties set in CSS
IgxXSuffixComponent.prototype.updateStyle = function () {
this._styling(this._root, this);
};
IgxXSuffixComponent.prototype.ngOnDestroy = function () {
this._suffix.destroy();
this._wrapper.destroy();
};
IgxXSuffixComponent.prototype.ngAfterViewInit = function () {
this._portalManager.dynamicContent = this._dynamicContent;
this._portalManager.onChildContentChanged(this._childTemplateRef);
this._styling(this._root, this);
this.updateStyle();
};
IgxXSuffixComponent.prototype.createImplementation = function () {
return new XSuffix();
};
Object.defineProperty(IgxXSuffixComponent.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXSuffixComponent.prototype, "id", {
/**
* Gets or sets the id to use for the checkbox.
*/
get: function () {
return this.i.z;
},
set: function (v) {
this.i.z = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXSuffixComponent.prototype, "ariaLabel", {
/**
* Gets or sets the value of the aria-label attribute.
*/
get: function () {
return this.i.w;
},
set: function (v) {
this.i.w = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXSuffixComponent.prototype, "isHover", {
/**
* Gets or sets whether the suffix is hovered.
*/
get: function () {
return this.i.q;
},
set: function (v) {
this.i.q = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXSuffixComponent.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
});
IgxXSuffixComponent.prototype.onDetachedFromUI = function () {
this.i.onDetachedFromUI();
};
IgxXSuffixComponent.prototype.onAttachedToUI = function () {
this.i.onAttachedToUI();
};
/**
* Exports visual information about the current state of the grid.
*/
IgxXSuffixComponent.prototype.exportVisualModel = function () {
var iv = this.i.t();
return (iv);
};
/**
* Returns a serialized copy of the exported visual model
*/
IgxXSuffixComponent.prototype.exportSerializedVisualModel = function () {
var iv = this.i.y();
return (iv);
};
IgxXSuffixComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXSuffixComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
IgxXSuffixComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxXSuffixComponent, selector: "igx-x-suffix", inputs: { id: "id", ariaLabel: ["aria-label", "ariaLabel"], isHover: "isHover", disabled: "disabled" }, host: { properties: { "attr.id": "this.id" }, classAttribute: "ig-x-suffix igx-x-suffix" }, 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 IgxXSuffixComponent;
}(IgxXInputGroupItemComponent));
export { IgxXSuffixComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXSuffixComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-x-suffix',
template: "<ng-template #childContent><ng-content></ng-content></ng-template>\n<ng-container #dynamicContent></ng-container>",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [],
host: { 'class': 'ig-x-suffix igx-x-suffix' },
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 }]
}], id: [{
type: HostBinding,
args: ['attr.id']
}, {
type: Input
}], ariaLabel: [{
type: Input,
args: ['aria-label']
}], isHover: [{
type: Input
}], disabled: [{
type: Input
}] } });