igniteui-angular-inputs
Version:
Ignite UI Angular input components for building rich data visualizations for modern web apps.
382 lines (379 loc) • 14 kB
JavaScript
import { Component, Input, ChangeDetectionStrategy } from '@angular/core';
import { XRipple } from "./XRipple";
import { brushToString, stringToBrush, ensureBool, toSpinal, initializePropertiesFromCss, NamePatcher } from "igniteui-angular-core";
import { AngularRenderer } from "igniteui-angular-core";
import * as i0 from "@angular/core";
var IgxXRippleComponent = /** @class */ /*@__PURE__*/ (function () {
function IgxXRippleComponent(renderer, _elRef, ngZone, injector, componentFactoryResolver) {
this.renderer = renderer;
this._elRef = _elRef;
this.ngZone = ngZone;
this.injector = injector;
this.componentFactoryResolver = componentFactoryResolver;
this._wrapper = null;
this._root = null;
this._implementation = null;
this.__p = null;
this._hasUserValues = new Set();
this._stylingContainer = null;
this._stylingParent = null;
this._inStyling = false;
this._zoneRunner = 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", "block");
}
var root;
root = this.container;
if (this.container != null) {
root = this.container;
}
if (root && root.nativeElement) {
root = root.nativeElement;
}
this._root = root;
var ripple = this.i;
this._ripple = ripple;
if (renderer) {
var ren = new AngularRenderer(root, this.renderer, window.document, this.ngZone, true, {});
this._wrapper = ren;
ripple.provideContainer(ren);
}
}
Object.defineProperty(IgxXRippleComponent.prototype, "height", {
get: function () {
return this._height;
},
set: function (value) {
this._height = value;
this._wrapper.rootWrapper.setStyleProperty("height", value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "width", {
get: function () {
return this._width;
},
set: function (value) {
this._width = value;
this._wrapper.rootWrapper.setStyleProperty("width", value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "top", {
get: function () {
return this._top;
},
set: function (value) {
this._top = value;
this._wrapper.rootWrapper.setStyleProperty("top", value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "left", {
get: function () {
return this._left;
},
set: function (value) {
this._left = value;
this._wrapper.rootWrapper.setStyleProperty("left", value);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "position", {
get: function () {
return this._position;
},
set: function (value) {
this._position = value;
this._wrapper.rootWrapper.setStyleProperty("position", value);
},
enumerable: false,
configurable: true
});
// supports angular themes or custom properties set in CSS
IgxXRippleComponent.prototype.updateStyle = function () {
this._styling(this._root, this);
};
IgxXRippleComponent.prototype.ngOnDestroy = function () {
this._ripple.destroy();
this._wrapper.destroy();
};
IgxXRippleComponent.prototype.ngAfterContentInit = function () {
this._styling(this._root, this);
this.updateStyle();
};
IgxXRippleComponent.prototype.createImplementation = function () {
return new XRipple();
};
Object.defineProperty(IgxXRippleComponent.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "eventSource", {
/**
* Gets or sets the target element to inject ripples into.
*/
get: function () {
return this.i.q;
},
set: function (v) {
this.i.q = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "rippleColor", {
/**
* Gets or sets the color to use for the background when the checkbox is unchecked.
*/
get: function () {
return brushToString(this.i.ax);
},
set: function (v) {
this.i.ax = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "hoverColor", {
/**
* Gets or sets the color to use for the background when the ripple is hovered.
*/
get: function () {
return brushToString(this.i.aw);
},
set: function (v) {
this.i.aw = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "actualHoverColor", {
/**
* Gets or sets the actual color to use for the background when the ripple is hovered.
*/
get: function () {
return brushToString(this.i.as);
},
set: function (v) {
this.i.as = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "actualRippleColor", {
/**
* Gets or sets the color to use for the actual background when the checkbox is unchecked.
*/
get: function () {
return brushToString(this.i.at);
},
set: function (v) {
this.i.at = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "rippleDuration", {
/**
* Gets or sets the duration to use for the ripple animation.
*/
get: function () {
return this.i.o;
},
set: function (v) {
this.i.o = +v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "isDisabled", {
/**
* Gets or sets if the ripple is disabled.
*/
get: function () {
return this.i.i;
},
set: function (v) {
this.i.i = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "isCentered", {
/**
* Gets or sets if the ripple is centered.
*/
get: function () {
return this.i.h;
},
set: function (v) {
this.i.h = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxXRippleComponent.prototype, "isHoverEnabled", {
/**
* Gets or sets if the ripple is centered.
*/
get: function () {
return this.i.k;
},
set: function (v) {
this.i.k = ensureBool(v);
},
enumerable: false,
configurable: true
});
IgxXRippleComponent.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
Object.defineProperty(IgxXRippleComponent.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgxXRippleComponent.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgxXRippleComponent.prototype._styling = function (container, component, parent) {
if (this._inStyling) {
return;
}
this._inStyling = true;
this._stylingContainer = container;
this._stylingParent = component;
var genericPrefix = "";
var typeName = this.i.$type.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
genericPrefix = toSpinal("XRippleComponent");
var additionalPrefixes = [];
var prefix = toSpinal(typeName);
additionalPrefixes.push(prefix + "-");
var b = this.i.$type.baseType;
while (b && b.name != "Object" &&
b.name != "Base" &&
b.name != "Control" &&
b.Name != "DependencyObject" &&
b.Name != "FrameworkElement") {
typeName = b.name;
if (typeName.indexOf("Xam") === 0) {
typeName = typeName.substring(3);
}
var basePrefix = toSpinal(typeName);
additionalPrefixes.push(basePrefix + "-");
b = b.baseType;
}
if (parent) {
var parentTypeName = parent.i.$type.name;
if (parentTypeName.indexOf("Xam") === 0) {
parentTypeName = parentTypeName.substring(3);
}
var parentPrefix = toSpinal(parentTypeName);
additionalPrefixes.push(parentPrefix + "-" + genericPrefix + "-");
additionalPrefixes.push(parentPrefix + "-" + prefix + "-");
}
initializePropertiesFromCss(container, this, genericPrefix + "-", this.hasUserValues, false, additionalPrefixes);
if (this._otherStyling) {
this._otherStyling(container, component, parent);
}
this._inStyling = false;
};
IgxXRippleComponent.prototype.onDetachedFromUI = function () {
this.i.onDetachedFromUI();
};
IgxXRippleComponent.prototype.onAttachedToUI = function () {
this.i.onAttachedToUI();
};
/**
* Exports visual information about the current state of the grid.
*/
IgxXRippleComponent.prototype.exportVisualModel = function () {
var iv = this.i.r();
return (iv);
};
/**
* Returns a serialized copy of the exported visual model
*/
IgxXRippleComponent.prototype.exportSerializedVisualModel = function () {
var iv = this.i.v();
return (iv);
};
IgxXRippleComponent.prototype._runInZone = function (act) {
if (this._zoneRunner != null) {
this._zoneRunner(act);
}
else {
act();
}
};
IgxXRippleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXRippleComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component });
IgxXRippleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxXRippleComponent, selector: "igx-x-ripple", inputs: { height: "height", width: "width", top: "top", left: "left", position: "position", eventSource: "eventSource", rippleColor: "rippleColor", hoverColor: "hoverColor", actualHoverColor: "actualHoverColor", actualRippleColor: "actualRippleColor", rippleDuration: "rippleDuration", isDisabled: "isDisabled", isCentered: "isCentered", isHoverEnabled: "isHoverEnabled" }, host: { classAttribute: "ig-x-ripple igx-x-ripple" }, providers: [], ngImport: i0, template: "", isInline: true, styles: ["\n\t\t:host {\n\t\t\tdisplay: block; \n\t\t}\n\t"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
return IgxXRippleComponent;
}());
export { IgxXRippleComponent };
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxXRippleComponent, decorators: [{
type: Component,
args: [{
selector: 'igx-x-ripple',
template: "",
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [],
host: { 'class': 'ig-x-ripple igx-x-ripple' },
styles: ["\n\t\t:host {\n\t\t\tdisplay: block; \n\t\t}\n\t"]
}]
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ViewContainerRef }, { type: i0.NgZone }, { type: i0.Injector }, { type: i0.ComponentFactoryResolver }]; }, propDecorators: { height: [{
type: Input
}], width: [{
type: Input
}], top: [{
type: Input
}], left: [{
type: Input
}], position: [{
type: Input
}], eventSource: [{
type: Input
}], rippleColor: [{
type: Input
}], hoverColor: [{
type: Input
}], actualHoverColor: [{
type: Input
}], actualRippleColor: [{
type: Input
}], rippleDuration: [{
type: Input
}], isDisabled: [{
type: Input
}], isCentered: [{
type: Input
}], isHoverEnabled: [{
type: Input
}] } });