UNPKG

igniteui-webcomponents-inputs

Version:

Ignite UI Web Components inputs components.

522 lines (521 loc) 20.2 kB
import { __extends, __values } from "tslib"; import { ColorEditorPanel } from "./ColorEditorPanel"; import { ensureEnum, brushToString, stringToBrush, initializePropertiesFromCss, NamePatcher, toSpinal, enumToString, getAllPropertyNames, fromSpinal } from "igniteui-webcomponents-core"; import { FontInfo } from "igniteui-webcomponents-core"; import { WebComponentRenderer, PortalManager } from "igniteui-webcomponents-core"; import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core"; import { TypeRegistrar } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-core"; import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core"; import { BaseControlTheme_$type } from "igniteui-webcomponents-core"; import { IgcHTMLElement } from "igniteui-webcomponents-core"; import { IgcColorEditorPanelSelectedValueChangedEventArgs } from "./igc-color-editor-panel-selected-value-changed-event-args"; export var IgcColorEditorPanelComponent = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgcColorEditorPanelComponent, _super); function IgcColorEditorPanelComponent() { var _this = _super.call(this) || this; _this._disconnected = false; _this._settingAttributes = false; _this._attached = false; _this._queuedSetAttributes = []; _this._updatingFromAttribute = false; _this.__p = null; _this._hasUserValues = new Set(); _this._stylingContainer = null; _this._stylingParent = null; _this._inStyling = false; _this._valueChanged = null; _this._valueChanged_wrapped = null; _this._valueChanging = null; _this._valueChanging_wrapped = null; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._portalManager = new PortalManager("colorEditorPanelContent"); _this._renderer = new WebComponentRenderer(_this, document, true, {}, _this._portalManager); _this._container = _this._renderer.createElement("div"); _this._renderer.updateRoot(_this._container); _this._implementation = _this.createImplementation(); _this._implementation.externalObject = _this; //this._container.setStyleProperty("width", "100%"); //this._container.setStyleProperty("height", "100%"); var root; root = _this._container; if (_this._container.getNativeElement() != null) { root = _this._container.getNativeElement(); } _this._wrapper = _this._renderer; var colorEditorPanel = _this.i; _this._colorEditorPanel = colorEditorPanel; colorEditorPanel.provideContainer(_this._renderer); _this._onChildrenChanged(); //Checkbox.notifySizeChanged(); var mut = new MutationObserver(function (list) { var e_1, _b; try { for (var list_1 = __values(list), list_1_1 = list_1.next(); !list_1_1.done; list_1_1 = list_1.next()) { var mutation = list_1_1.value; if (mutation.type == 'childList') { _this._onChildrenChanged(); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (list_1_1 && !list_1_1.done && (_b = list_1.return)) _b.call(list_1); } finally { if (e_1) throw e_1.error; } } }); mut.observe(_this, { childList: true }); return _this; //this._renderer.addSizeWatcher(() => { // this._checkbox.notifySizeChanged(); //}); } IgcColorEditorPanelComponent.prototype._onChildrenChanged = function () { var children = []; for (var i = 0; i < this.childNodes.length; i++) { var child = this.childNodes[i]; if (child !== this._container.getNativeElement()) { children.push(child); } } this._portalManager.onChildrenChanged(children); }; // supports angular themes or custom properties set in CSS IgcColorEditorPanelComponent.prototype.updateStyle = function () { this._styling(this, this); }; IgcColorEditorPanelComponent.prototype.destroy = function () { this._colorEditorPanel.destroy(); this._wrapper.destroy(); }; IgcColorEditorPanelComponent.prototype.createImplementation = function () { return new ColorEditorPanel(); }; IgcColorEditorPanelComponent.prototype.disconnectedCallback = function () { this._disconnected = true; if (this.i) { this.i.onDetachedFromUI(); } }; IgcColorEditorPanelComponent.prototype.connectedCallback = function () { if (this._disconnected) { this._disconnected = false; if (this.i) { this.i.onAttachedToUI(); } return; } this.classList.add("ig-color-editor-panel"); this.classList.add("igc-color-editor-panel"); this.appendChild(this._container.getNativeElement()); this._attached = true; this.style.display = "block"; //this.style.height = this._height; //this.style.width = this._width; this._flushQueuedAttributes(); // supports themes or custom properties set in CSS this._styling(this, this); this.afterContentInit(); }; IgcColorEditorPanelComponent.prototype.afterContentInit = function () { //this.i.notifySizeChanged(); }; Object.defineProperty(IgcColorEditorPanelComponent.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; } /** * @hidden */, enumerable: false, configurable: true }); IgcColorEditorPanelComponent._createFromInternal = function (internal) { if (!internal) { return null; } if (!internal.$type) { return null; } var name = internal.$type.name; var externalName = "Igc" + name + "Component"; if (!TypeRegistrar.isRegistered(externalName)) { return null; } return TypeRegistrar.create(externalName); }; IgcColorEditorPanelComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) { this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue }); }; IgcColorEditorPanelComponent.prototype._flushQueuedAttributes = function () { this._settingAttributes = true; for (var i = 0; i < this._queuedSetAttributes.length; i++) { this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue); } this._settingAttributes = false; this._queuedSetAttributes.length = 0; }; IgcColorEditorPanelComponent.prototype._a = function (attrName, attrValue) { if (this._updatingFromAttribute) { return; } if (attrValue) { attrValue = attrValue.toString(); } this._settingAttributes = true; attrName = toSpinal(attrName); if (this._attached) { this.setAttribute(attrName, attrValue); } else { this._enqueueSetAttribute(attrName, attrValue); } this._settingAttributes = false; }; Object.defineProperty(IgcColorEditorPanelComponent, "observedAttributes", { get: function () { if (IgcColorEditorPanelComponent._observedAttributesIgcColorEditorPanelComponent == null) { var names = getAllPropertyNames(IgcColorEditorPanelComponent); for (var i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcColorEditorPanelComponent._observedAttributesIgcColorEditorPanelComponent = names; } return IgcColorEditorPanelComponent._observedAttributesIgcColorEditorPanelComponent; }, enumerable: false, configurable: true }); IgcColorEditorPanelComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) { if (this._settingAttributes) { return; } var setName = fromSpinal(name); this._updatingFromAttribute = true; this[setName] = newValue; this._updatingFromAttribute = false; }; IgcColorEditorPanelComponent.register = function () { if (!IgcColorEditorPanelComponent._isElementRegistered) { IgcColorEditorPanelComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcColorEditorPanelComponent.htmlTagName, IgcColorEditorPanelComponent); } }; Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("value", brushToString(this.i.value)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("density", enumToString(ControlDisplayDensity_$type, this.i.h)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("baseTheme", enumToString(BaseControlTheme_$type, this.i.f)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("backgroundColor", brushToString(this.i.by)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("selectedColorBorderColor", brushToString(this.i.b1)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("selectedFocusDateBackgroundColor", brushToString(this.i.b2)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("focusColorBorderColor", brushToString(this.i.bz)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("hoverBackgroundColor", brushToString(this.i.b0)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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); this._a("textColor", brushToString(this.i.b3)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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; this._a("textStyle", this.i.j != null ? this.i.j.fontString : ""); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.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; this._a("pixelScalingRatio", this.i.ae); }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.prototype, "actualPixelScalingRatio", { get: function () { return this.i.ab; }, set: function (v) { this.i.ab = +v; this._a("actualPixelScalingRatio", this.i.ab); }, enumerable: false, configurable: true }); IgcColorEditorPanelComponent.prototype.findByName = function (name) { if (this.findEphemera) { if (name && name.indexOf("@@e:") == 0) { return this.findEphemera(name); } } return null; }; Object.defineProperty(IgcColorEditorPanelComponent.prototype, "hasUserValues", { get: function () { return this._hasUserValues; }, enumerable: false, configurable: true }); IgcColorEditorPanelComponent.prototype.__m = function (propertyName) { if (!this._inStyling) { this._hasUserValues.add(propertyName); } }; IgcColorEditorPanelComponent.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(IgcColorEditorPanelComponent.prototype, "valueChanged", { /** * Called when date is selected. */ get: function () { return this._valueChanged; }, set: function (ev) { var _this = this; if (this._valueChanged_wrapped !== null) { this.i.valueChanged = delegateRemove(this.i.valueChanged, this._valueChanged_wrapped); this._valueChanged_wrapped = null; this._valueChanged = null; } this._valueChanged = ev; this._valueChanged_wrapped = function (o, e) { var outerArgs = new IgcColorEditorPanelSelectedValueChangedEventArgs(); outerArgs._provideImplementation(e); if (_this.beforeValueChanged) { _this.beforeValueChanged(_this, outerArgs); } if (_this._valueChanged) { _this._valueChanged(_this, outerArgs); } }; this.i.valueChanged = delegateCombine(this.i.valueChanged, this._valueChanged_wrapped); ; }, enumerable: false, configurable: true }); Object.defineProperty(IgcColorEditorPanelComponent.prototype, "valueChanging", { /** * Called when date is selected. */ get: function () { return this._valueChanging; }, set: function (ev) { var _this = this; if (this._valueChanging_wrapped !== null) { this.i.valueChanging = delegateRemove(this.i.valueChanging, this._valueChanging_wrapped); this._valueChanging_wrapped = null; this._valueChanging = null; } this._valueChanging = ev; this._valueChanging_wrapped = function (o, e) { var outerArgs = new IgcColorEditorPanelSelectedValueChangedEventArgs(); outerArgs._provideImplementation(e); if (_this.beforeValueChanging) { _this.beforeValueChanging(_this, outerArgs); } if (_this._valueChanging) { _this._valueChanging(_this, outerArgs); } }; this.i.valueChanging = delegateCombine(this.i.valueChanging, this._valueChanging_wrapped); ; }, enumerable: false, configurable: true }); IgcColorEditorPanelComponent._observedAttributesIgcColorEditorPanelComponent = null; IgcColorEditorPanelComponent.htmlTagName = "igc-color-editor-panel"; IgcColorEditorPanelComponent._isElementRegistered = false; return IgcColorEditorPanelComponent; }(IgcHTMLElement));