UNPKG

igniteui-angular-inputs

Version:

Ignite UI Angular input components for building rich data visualizations for modern web apps.

323 lines (320 loc) 11.9 kB
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"; export let IgxXRippleComponent = /*@__PURE__*/ (() => { class IgxXRippleComponent { constructor(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); } } set height(value) { this._height = value; this._wrapper.rootWrapper.setStyleProperty("height", value); } get height() { return this._height; } set width(value) { this._width = value; this._wrapper.rootWrapper.setStyleProperty("width", value); } get width() { return this._width; } set top(value) { this._top = value; this._wrapper.rootWrapper.setStyleProperty("top", value); } get top() { return this._top; } set left(value) { this._left = value; this._wrapper.rootWrapper.setStyleProperty("left", value); } get left() { return this._left; } set position(value) { this._position = value; this._wrapper.rootWrapper.setStyleProperty("position", value); } get position() { return this._position; } // supports angular themes or custom properties set in CSS updateStyle() { this._styling(this._root, this); } ngOnDestroy() { this._ripple.destroy(); this._wrapper.destroy(); } ngAfterContentInit() { this._styling(this._root, this); this.updateStyle(); } createImplementation() { return new XRipple(); } get i() { return this._implementation; } /** * Gets or sets the target element to inject ripples into. */ get eventSource() { return this.i.q; } set eventSource(v) { this.i.q = v; } /** * Gets or sets the color to use for the background when the checkbox is unchecked. */ get rippleColor() { return brushToString(this.i.ax); } set rippleColor(v) { this.i.ax = stringToBrush(v); } /** * Gets or sets the color to use for the background when the ripple is hovered. */ get hoverColor() { return brushToString(this.i.aw); } set hoverColor(v) { this.i.aw = stringToBrush(v); } /** * Gets or sets the actual color to use for the background when the ripple is hovered. */ get actualHoverColor() { return brushToString(this.i.as); } set actualHoverColor(v) { this.i.as = stringToBrush(v); } /** * Gets or sets the color to use for the actual background when the checkbox is unchecked. */ get actualRippleColor() { return brushToString(this.i.at); } set actualRippleColor(v) { this.i.at = stringToBrush(v); } /** * Gets or sets the duration to use for the ripple animation. */ get rippleDuration() { return this.i.o; } set rippleDuration(v) { this.i.o = +v; } /** * Gets or sets if the ripple is disabled. */ get isDisabled() { return this.i.i; } set isDisabled(v) { this.i.i = ensureBool(v); } /** * Gets or sets if the ripple is centered. */ get isCentered() { return this.i.h; } set isCentered(v) { this.i.h = ensureBool(v); } /** * Gets or sets if the ripple is centered. */ get isHoverEnabled() { return this.i.k; } set isHoverEnabled(v) { this.i.k = ensureBool(v); } findByName(name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; } get hasUserValues() { return this._hasUserValues; } __m(propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } } _styling(container, component, parent) { if (this._inStyling) { return; } this._inStyling = true; this._stylingContainer = container; this._stylingParent = component; let genericPrefix = ""; let typeName = this.i.$type.name; if (typeName.indexOf("Xam") === 0) { typeName = typeName.substring(3); } genericPrefix = toSpinal("XRippleComponent"); let additionalPrefixes = []; let prefix = toSpinal(typeName); additionalPrefixes.push(prefix + "-"); let 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); } let basePrefix = toSpinal(typeName); additionalPrefixes.push(basePrefix + "-"); b = b.baseType; } if (parent) { let parentTypeName = parent.i.$type.name; if (parentTypeName.indexOf("Xam") === 0) { parentTypeName = parentTypeName.substring(3); } let 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; } onDetachedFromUI() { this.i.onDetachedFromUI(); } onAttachedToUI() { this.i.onAttachedToUI(); } /** * Exports visual information about the current state of the grid. */ exportVisualModel() { let iv = this.i.r(); return (iv); } /** * Returns a serialized copy of the exported visual model */ exportSerializedVisualModel() { let iv = this.i.v(); return (iv); } _runInZone(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; })(); 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: [` :host { display: block; } `] }] }], 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 }] } });