UNPKG

igniteui-webcomponents-inputs

Version:

Ignite UI Web Components inputs components.

539 lines (536 loc) 18.1 kB
import { __extends, __values } from "tslib"; import { XLabel } from "./XLabel"; import { ensureEnum, brushToString, stringToBrush, ensureBool, NamePatcher, toSpinal, enumToString, getAllPropertyNames } from "igniteui-webcomponents-core"; import { FontInfo } from "igniteui-webcomponents-core"; import { WebComponentRenderer, PortalManager } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-core"; import { IgcXInputGroupItemComponent } from './igc-x-input-group-item-component'; import { ControlDisplayDensity_$type } from "igniteui-webcomponents-core"; import { BaseControlTheme_$type } from "igniteui-webcomponents-core"; export var IgcXLabelComponent = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgcXLabelComponent, _super); function IgcXLabelComponent() { var _this = _super.call(this) || this; _this._disconnected = false; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._portalManager = new PortalManager("labelContent"); _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 label = _this.i; _this._label = label; label.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(); //}); } IgcXLabelComponent.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 IgcXLabelComponent.prototype.updateStyle = function () { this._styling(this, this); }; IgcXLabelComponent.prototype.destroy = function () { this._label.destroy(); this._wrapper.destroy(); }; IgcXLabelComponent.prototype.createImplementation = function () { return new XLabel(); }; IgcXLabelComponent.prototype.disconnectedCallback = function () { this._disconnected = true; if (this.i) { this.i.onDetachedFromUI(); } }; IgcXLabelComponent.prototype.connectedCallback = function () { if (this._disconnected) { this._disconnected = false; if (this.i) { this.i.onAttachedToUI(); } return; } this.classList.add("ig-label"); this.classList.add("igc-label"); this.appendChild(this._container.getNativeElement()); this._attached = true; this.style.display = "inline-block"; this.style.verticalAlign = "middle"; //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(); }; IgcXLabelComponent.prototype.afterContentInit = function () { this.i.onSizeReady(); //this.i.notifySizeChanged(); }; IgcXLabelComponent.prototype._onDisplayChanged = function () { this.style.display = this.display; }; IgcXLabelComponent.prototype._onFlexDirectionChanged = function () { this.style.flexDirection = this.flexDirection; }; IgcXLabelComponent.prototype._onFlexGrowChanged = function () { this.style.flexGrow = this.flexGrow; }; IgcXLabelComponent.prototype._onAlignItemsChanged = function () { this.style.alignItems = this.alignItems; }; IgcXLabelComponent.prototype._onAlignSelfChanged = function () { this.style.alignSelf = this.alignSelf; }; Object.defineProperty(IgcXLabelComponent.prototype, "i", { /** * @hidden */ get: function () { return this._implementation; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent, "observedAttributes", { get: function () { if (IgcXLabelComponent._observedAttributesIgcXLabelComponent == null) { var names = getAllPropertyNames(IgcXLabelComponent); for (var i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcXLabelComponent._observedAttributesIgcXLabelComponent = names; } return IgcXLabelComponent._observedAttributesIgcXLabelComponent; }, enumerable: false, configurable: true }); IgcXLabelComponent.register = function () { if (!IgcXLabelComponent._isElementRegistered) { IgcXLabelComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcXLabelComponent.htmlTagName, IgcXLabelComponent); } }; Object.defineProperty(IgcXLabelComponent.prototype, "baseTheme", { /** * Gets or sets the base built in theme to use for the label. */ get: function () { return this.i.p; }, set: function (v) { this.i.p = ensureEnum(BaseControlTheme_$type, v); this._a("baseTheme", enumToString(BaseControlTheme_$type, this.i.p)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "density", { /** * Gets or sets the display density to use for the label. */ get: function () { return this.i.t; }, set: function (v) { this.i.t = ensureEnum(ControlDisplayDensity_$type, v); this._a("density", enumToString(ControlDisplayDensity_$type, this.i.t)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "actualDensity", { /** * Gets the actual display density to use for the label. */ get: function () { return this.i.s; }, set: function (v) { this.i.s = ensureEnum(ControlDisplayDensity_$type, v); this._a("actualDensity", enumToString(ControlDisplayDensity_$type, this.i.s)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "actualTextColor", { /** * Gets the actual color to use for the text color. */ get: function () { return brushToString(this.i.c3); }, set: function (v) { this.i.c3 = stringToBrush(v); this._a("actualTextColor", brushToString(this.i.c3)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "actualHighlightTextColor", { /** * Gets the actual color to use for the text color. */ get: function () { return brushToString(this.i.c0); }, set: function (v) { this.i.c0 = stringToBrush(v); this._a("actualHighlightTextColor", brushToString(this.i.c0)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "actualHoverHighlightTextColor", { /** * Gets the actual color to use for the text color when highlighted and hovered. */ get: function () { return brushToString(this.i.c1); }, set: function (v) { this.i.c1 = stringToBrush(v); this._a("actualHoverHighlightTextColor", brushToString(this.i.c1)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "actualHoverTextColor", { /** * Gets the actual hover color to use for the text. */ get: function () { return brushToString(this.i.c2); }, set: function (v) { this.i.c2 = stringToBrush(v); this._a("actualHoverTextColor", brushToString(this.i.c2)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "textColor", { /** * Gets or sets the color to use for the text. */ get: function () { return brushToString(this.i.dj); }, set: function (v) { this.i.dj = stringToBrush(v); this._a("textColor", brushToString(this.i.dj)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "highlightTextColor", { /** * Gets or sets the color to use for the text. */ get: function () { return brushToString(this.i.dg); }, set: function (v) { this.i.dg = stringToBrush(v); this._a("highlightTextColor", brushToString(this.i.dg)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "hoverHighlightTextColor", { /** * Gets or sets the color to use for the text. */ get: function () { return brushToString(this.i.dh); }, set: function (v) { this.i.dh = stringToBrush(v); this._a("hoverHighlightTextColor", brushToString(this.i.dh)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "textStyle", { /** * Gets or sets the use for the button. */ get: function () { if (this.i.y == null) { return null; } return this.i.y.fontString; }, set: function (v) { var fi = new FontInfo(); fi.fontString = v; this.i.y = fi; this._a("textStyle", this.i.y != null ? this.i.y.fontString : ""); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "hoverTextColor", { /** * Gets or sets the color to use for the hovered text of the button regardless of type. */ get: function () { return brushToString(this.i.di); }, set: function (v) { this.i.di = stringToBrush(v); this._a("hoverTextColor", brushToString(this.i.di)); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "id", { /** * Gets or sets the id to use for the checkbox. */ get: function () { return this.i.bw; }, set: function (v) { this.i.bw = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "display", { /** * Gets or sets the id to use for the checkbox. */ get: function () { return this.i.bk; }, set: function (v) { this.i.bk = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "flexDirection", { /** * Gets or sets the id to use for the checkbox. */ get: function () { return this.i.bn; }, set: function (v) { this.i.bn = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "flexGrow", { /** * Gets or sets the flex-grow setting for the button. */ get: function () { return this.i.bp; }, set: function (v) { this.i.bp = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "alignItems", { /** * Gets or sets the id to use for the checkbox. */ get: function () { return this.i.bc; }, set: function (v) { this.i.bc = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "alignSelf", { /** * Gets or sets the id to use for the checkbox. */ get: function () { return this.i.be; }, set: function (v) { this.i.be = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "tabIndex", { /** * Gets or sets TabIndex to use for the checkbox. */ get: function () { return this.i.au; }, set: function (v) { this.i.au = +v; this._a("tabIndex", this.i.au); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "for", { /** * Gets or sets the for attribute to use for the label. */ get: function () { return this.i.br; }, set: function (v) { this.i.br = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "ariaLabel", { /** * Gets or sets the value of the aria-label attribute. */ get: function () { return this.i.bg; }, set: function (v) { this.i.bg = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "text", { /** * Gets or sets the text for the label. */ get: function () { return this.i.text; }, set: function (v) { this.i.text = v; }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "isHover", { /** * Gets or sets whether the label is hovered. */ get: function () { return this.i.ao; }, set: function (v) { this.i.ao = ensureBool(v); this._a("isHover", this.i.ao); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "value", { /** * Gets or sets the value for the label. */ get: function () { return this.i.as; }, set: function (v) { this.i.as = ensureBool(v); this._a("value", this.i.as); }, enumerable: false, configurable: true }); Object.defineProperty(IgcXLabelComponent.prototype, "disabled", { /** * Gets or sets whether the checkbox is disabled. */ get: function () { return this.i.disabled; }, set: function (v) { this.i.disabled = ensureBool(v); this._a("disabled", this.i.disabled); }, enumerable: false, configurable: true }); IgcXLabelComponent.prototype.onDetachedFromUI = function () { this.i.onDetachedFromUI(); }; IgcXLabelComponent.prototype.onAttachedToUI = function () { this.i.onAttachedToUI(); }; /** * Exports visual information about the current state of the grid. */ IgcXLabelComponent.prototype.exportVisualModel = function () { var iv = this.i.aw(); return (iv); }; /** * Returns a serialized copy of the exported visual model */ IgcXLabelComponent.prototype.exportSerializedVisualModel = function () { var iv = this.i.bm(); return (iv); }; IgcXLabelComponent._observedAttributesIgcXLabelComponent = null; IgcXLabelComponent.htmlTagName = "igc-x-label"; IgcXLabelComponent._isElementRegistered = false; return IgcXLabelComponent; }(IgcXInputGroupItemComponent));