UNPKG

igniteui-angular-inputs

Version:

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

436 lines (435 loc) 18 kB
import { Output, TemplateRef, EventEmitter, Component, ViewContainerRef, ViewChild, Input, ChangeDetectionStrategy } from '@angular/core'; import { ColorEditorPanel } from "./ColorEditorPanel"; import { ensureEnum, brushToString, stringToBrush, toSpinal, initializePropertiesFromCss, NamePatcher } from "igniteui-angular-core"; import { FontInfo } from "igniteui-angular-core"; import { AngularRenderer, PortalManager } from "igniteui-angular-core"; import { delegateCombine } from "igniteui-angular-core"; import { TypeRegistrar } from "igniteui-angular-core"; import { ControlDisplayDensity_$type } from "igniteui-angular-core"; import { BaseControlTheme_$type } from "igniteui-angular-core"; import { IgxColorEditorPanelSelectedValueChangedEventArgs } from "./igx-color-editor-panel-selected-value-changed-event-args"; import * as i0 from "@angular/core"; var IgxColorEditorPanelComponent = /** @class */ /*@__PURE__*/ (function () { function IgxColorEditorPanelComponent(renderer, _elRef, ngZone, injector, componentFactoryResolver) { this.renderer = renderer; this._elRef = _elRef; this.ngZone = ngZone; this.injector = injector; this.componentFactoryResolver = componentFactoryResolver; this._wrapper = null; this._portalManager = null; this._root = null; this.__p = null; this._hasUserValues = new Set(); this._stylingContainer = null; this._stylingParent = null; this._inStyling = false; this._valueChanged = null; this._valueChanging = null; 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 colorEditorPanel = this.i; this._colorEditorPanel = colorEditorPanel; if (renderer) { this._portalManager = new PortalManager("colorEditorPanelContent", componentFactoryResolver); var ren = new AngularRenderer(root, this.renderer, window.document, this.ngZone, true, {}, this._portalManager); this._wrapper = ren; colorEditorPanel.provideContainer(ren); } } // supports angular themes or custom properties set in CSS IgxColorEditorPanelComponent.prototype.updateStyle = function () { this._styling(this._root, this); }; IgxColorEditorPanelComponent.prototype.ngOnDestroy = function () { this._colorEditorPanel.destroy(); this._wrapper.destroy(); }; IgxColorEditorPanelComponent.prototype.ngAfterViewInit = function () { this._portalManager.dynamicContent = this._dynamicContent; this._portalManager.onChildContentChanged(this._childTemplateRef); this._styling(this._root, this); this.updateStyle(); }; IgxColorEditorPanelComponent.prototype.createImplementation = function () { return new ColorEditorPanel(); }; Object.defineProperty(IgxColorEditorPanelComponent.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; } /** * @hidden */, enumerable: false, configurable: true }); IgxColorEditorPanelComponent._createFromInternal = function (internal) { if (!internal) { return null; } if (!internal.$type) { return null; } var name = internal.$type.name; var externalName = "Igx" + name + "Component"; if (!TypeRegistrar.isRegistered(externalName)) { return null; } return TypeRegistrar.create(externalName); }; Object.defineProperty(IgxColorEditorPanelComponent.prototype, "value", { /** * Gets or Sets the value for the color editor panel. */ get: function () { return brushToString(this.i.value); }, set: function (v) { this.i.value = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "density", { /** * Gets or sets the display density to use for the ColorEditorPanel. */ get: function () { return this.i.h; }, set: function (v) { this.i.h = ensureEnum(ControlDisplayDensity_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "baseTheme", { /** * Gets or sets the base built in theme to use for the ColorEditorPanel. */ get: function () { return this.i.f; }, set: function (v) { this.i.f = ensureEnum(BaseControlTheme_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "backgroundColor", { /** * Gets or Sets the selected color background color */ get: function () { return brushToString(this.i.by); }, set: function (v) { this.i.by = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "selectedColorBorderColor", { /** * Gets or Sets the selected color boreder color */ get: function () { return brushToString(this.i.b1); }, set: function (v) { this.i.b1 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "selectedFocusDateBackgroundColor", { /** * Gets or Sets the selected color border color */ get: function () { return brushToString(this.i.b2); }, set: function (v) { this.i.b2 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "focusColorBorderColor", { /** * Gets or Sets the focus color border color */ get: function () { return brushToString(this.i.bz); }, set: function (v) { this.i.bz = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "hoverBackgroundColor", { /** * Gets or Sets the focus date background color */ get: function () { return brushToString(this.i.b0); }, set: function (v) { this.i.b0 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "textColor", { /** * Gets or Sets the selected date text color */ get: function () { return brushToString(this.i.b3); }, set: function (v) { this.i.b3 = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "textStyle", { /** * Gets or sets the font to use for the combobox. */ get: function () { if (this.i.j == null) { return null; } return this.i.j.fontString; }, set: function (v) { var fi = new FontInfo(); fi.fontString = v; this.i.j = fi; }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "pixelScalingRatio", { /** * Gets or sets the scaling value used to affect the pixel density of the control. * A higher scaling ratio will produce crisper visuals at the expense of memory. Lower values will cause the control * to appear blurry. */ get: function () { return this.i.ae; }, set: function (v) { this.i.ae = +v; }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "actualPixelScalingRatio", { get: function () { return this.i.ab; }, set: function (v) { this.i.ab = +v; }, enumerable: false, configurable: true }); IgxColorEditorPanelComponent.prototype.findByName = function (name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; }; Object.defineProperty(IgxColorEditorPanelComponent.prototype, "hasUserValues", { get: function () { return this._hasUserValues; }, enumerable: false, configurable: true }); IgxColorEditorPanelComponent.prototype.__m = function (propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } }; IgxColorEditorPanelComponent.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("ColorEditorPanelComponent"); 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; }; Object.defineProperty(IgxColorEditorPanelComponent.prototype, "valueChanged", { /** * Called when date is selected. */ get: function () { var _this = this; if (this._valueChanged == null) { this._valueChanged = new EventEmitter(); this.i.valueChanged = delegateCombine(this.i.valueChanged, function (o, e) { _this._runInZone(function () { var outerArgs = new IgxColorEditorPanelSelectedValueChangedEventArgs(); outerArgs._provideImplementation(e); if (_this.beforeValueChanged) { _this.beforeValueChanged(_this, outerArgs); } _this._valueChanged.emit({ sender: _this, args: outerArgs }); }); }); } return this._valueChanged; }, enumerable: false, configurable: true }); Object.defineProperty(IgxColorEditorPanelComponent.prototype, "valueChanging", { /** * Called when date is selected. */ get: function () { var _this = this; if (this._valueChanging == null) { this._valueChanging = new EventEmitter(); this.i.valueChanging = delegateCombine(this.i.valueChanging, function (o, e) { var outerArgs = new IgxColorEditorPanelSelectedValueChangedEventArgs(); outerArgs._provideImplementation(e); if (_this.beforeValueChanging) { _this.beforeValueChanging(_this, outerArgs); } _this._valueChanging.emit({ sender: _this, args: outerArgs }); }); } return this._valueChanging; }, enumerable: false, configurable: true }); IgxColorEditorPanelComponent.prototype._runInZone = function (act) { if (this._zoneRunner != null) { this._zoneRunner(act); } else { act(); } }; IgxColorEditorPanelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxColorEditorPanelComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ViewContainerRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Component }); IgxColorEditorPanelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: IgxColorEditorPanelComponent, selector: "igx-color-editor-panel", inputs: { value: "value", density: "density", baseTheme: "baseTheme", backgroundColor: "backgroundColor", selectedColorBorderColor: "selectedColorBorderColor", selectedFocusDateBackgroundColor: "selectedFocusDateBackgroundColor", focusColorBorderColor: "focusColorBorderColor", hoverBackgroundColor: "hoverBackgroundColor", textColor: "textColor", textStyle: "textStyle", pixelScalingRatio: "pixelScalingRatio", actualPixelScalingRatio: "actualPixelScalingRatio" }, outputs: { valueChanged: "valueChanged", valueChanging: "valueChanging" }, host: { classAttribute: "ig-color-editor-panel igx-color-editor-panel" }, providers: [], viewQueries: [{ propertyName: "_dynamicContent", first: true, predicate: ["dynamicContent"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "_childTemplateRef", first: true, predicate: ["childContent"], descendants: true, read: TemplateRef }], 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: block; \n\t\t}\n\t"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); return IgxColorEditorPanelComponent; }()); export { IgxColorEditorPanelComponent }; i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: IgxColorEditorPanelComponent, decorators: [{ type: Component, args: [{ selector: 'igx-color-editor-panel', template: "<ng-template #childContent><ng-content></ng-content></ng-template>\n<ng-container #dynamicContent></ng-container>", changeDetection: ChangeDetectionStrategy.OnPush, providers: [], host: { 'class': 'ig-color-editor-panel igx-color-editor-panel' }, 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: { _dynamicContent: [{ type: ViewChild, args: ["dynamicContent", { read: ViewContainerRef, static: true }] }], _childTemplateRef: [{ type: ViewChild, args: ["childContent", { read: TemplateRef, static: false }] }], value: [{ type: Input }], density: [{ type: Input }], baseTheme: [{ type: Input }], backgroundColor: [{ type: Input }], selectedColorBorderColor: [{ type: Input }], selectedFocusDateBackgroundColor: [{ type: Input }], focusColorBorderColor: [{ type: Input }], hoverBackgroundColor: [{ type: Input }], textColor: [{ type: Input }], textStyle: [{ type: Input }], pixelScalingRatio: [{ type: Input }], actualPixelScalingRatio: [{ type: Input }], valueChanged: [{ type: Output }], valueChanging: [{ type: Output }] } });