UNPKG

igniteui-webcomponents-grids

Version:

Ignite UI Web Components grid components.

523 lines (522 loc) 18.7 kB
import { IgcHTMLElement } from "igniteui-webcomponents-core"; import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core"; import { DataSourceSchemaPropertyType_$type } from "igniteui-webcomponents-core"; import { IgcOperatorSelectorValueChangedEventArgs } from "./igc-operator-selector-value-changed-event-args"; import { IgcOperatorSelectorOpeningEventArgs } from "./igc-operator-selector-opening-event-args"; import { IgcOperatorSelectorClosingEventArgs } from "./igc-operator-selector-closing-event-args"; import { ComparisonOperatorSelector } from "./ComparisonOperatorSelector"; import { TypeRegistrar } from "igniteui-webcomponents-core"; import { NamePatcher, getAllPropertyNames, fromSpinal, toSpinal, ensureEnum, enumToString, brushToString, stringToBrush, initializePropertiesFromCss } from "igniteui-webcomponents-core"; import { RegisterElementHelper } from "igniteui-webcomponents-core"; /** * A dropdown selector for choosing which comparison operator to use. */ export let IgcDataGridComparisonOperatorSelectorComponent = /*@__PURE__*/ (() => { class IgcDataGridComparisonOperatorSelectorComponent extends IgcHTMLElement { createImplementation() { return new ComparisonOperatorSelector(); } /** * @hidden */ get i() { return this._implementation; } /** * @hidden */ static _createFromInternal(internal) { if (!internal) { return null; } if (!internal.$type) { return null; } let name = internal.$type.name; let externalName = "Igc" + name + "Component"; if (!TypeRegistrar.isRegistered(externalName)) { return null; } return TypeRegistrar.create(externalName); } onImplementationCreated() { } constructor() { super(); 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._opening = null; this._opening_wrapped = null; this._opened = null; this._opened_wrapped = null; this._closing = null; this._closing_wrapped = null; if (this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(this)); } this._implementation = this.createImplementation(); this._implementation.externalObject = this; this.onImplementationCreated(); if (this._initializeAdapters) { this._initializeAdapters(); } } _enqueueSetAttribute(attrName, attrValue) { this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue }); } _flushQueuedAttributes() { this._settingAttributes = true; for (let i = 0; i < this._queuedSetAttributes.length; i++) { this.setAttribute(this._queuedSetAttributes[i].attrName, this._queuedSetAttributes[i].attrValue); } this._settingAttributes = false; this._queuedSetAttributes.length = 0; } _a(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; } connectedCallback() { if (super["connectedCallback"]) { super["connectedCallback"](); } if (this.i.connectedCallback) { this.i.connectedCallback(); } if (!this._attached) { this._attached = true; this._flushQueuedAttributes(); } } disconnectedCallback() { if (super["disconnectedCallback"]) { super["disconnectedCallback"](); } if (this.i.disconnectedCallback) { this.i.disconnectedCallback(); } if (this._attached) { this._attached = false; } } static get observedAttributes() { if (IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent == null) { let names = getAllPropertyNames(IgcDataGridComparisonOperatorSelectorComponent); for (let i = 0; i < names.length; i++) { names[i] = toSpinal(names[i]); } IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent = names; } return IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent; } attributeChangedCallback(name, oldValue, newValue) { if (this._settingAttributes) { return; } let setName = fromSpinal(name); this._updatingFromAttribute = true; this[setName] = newValue; this._updatingFromAttribute = false; } static register() { if (!IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered) { IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered = true; RegisterElementHelper.registerElement(IgcDataGridComparisonOperatorSelectorComponent.htmlTagName, IgcDataGridComparisonOperatorSelectorComponent); } } /** * Gets or sets the value of the selector. */ get value() { return this.i.b; } set value(v) { this.i.b = v; } /** * Gets the ID for the custom filter that is selected. Value must be 'Custom' for this property to be valid. */ get customFilterID() { return this.i.ae; } set customFilterID(v) { this.i.ae = v; } /** * Gets the index for the custom filter that is selected. Value must be 'Custom' for this property to be valid. */ get customFilterIndex() { return this.i.x; } set customFilterIndex(v) { this.i.x = +v; this._a("customFilterIndex", this.i.x); } /** * Gets or sets the data type. Used to determine what operators are available. */ get dataType() { return this.i.d; } set dataType(v) { this.i.d = ensureEnum(DataSourceSchemaPropertyType_$type, v); this._a("dataType", enumToString(DataSourceSchemaPropertyType_$type, this.i.d)); } get maxHeight() { return this.i.z; } set maxHeight(v) { this.i.z = +v; this._a("maxHeight", this.i.z); } /** * Gets or sets the text color. */ get textColor() { return brushToString(this.i.eq); } set textColor(v) { this.i.eq = stringToBrush(v); this._a("textColor", brushToString(this.i.eq)); } /** * Gets or sets the background color. */ get background() { return brushToString(this.i.ep); } set background(v) { this.i.ep = stringToBrush(v); this._a("background", brushToString(this.i.ep)); } get operatorCaptionTrue() { return this.i.dd; } get operatorCaptionFalse() { return this.i.ck; } get operatorCaptionEquals() { return this.i.cj; } get operatorCaptionNotEquals() { return this.i.cz; } get operatorCaptionLessThan() { return this.i.cr; } get operatorCaptionLessThanOrEqual() { return this.i.cs; } get operatorCaptionGreaterThan() { return this.i.cl; } get operatorCaptionGreaterThanOrEqual() { return this.i.cm; } get operatorCaptionTop() { return this.i.db; } get operatorCaptionBottom() { return this.i.cb; } get operatorCaptionTopPercentile() { return this.i.dc; } get operatorCaptionBottomPercentile() { return this.i.cc; } get operatorCaptionToday() { return this.i.c9; } get operatorCaptionTomorrow() { return this.i.da; } get operatorCaptionYesterday() { return this.i.dg; } get operatorCaptionThisWeek() { return this.i.c7; } get operatorCaptionNextWeek() { return this.i.cw; } get operatorCaptionLastWeek() { return this.i.cp; } get operatorCaptionThisMonth() { return this.i.c5; } get operatorCaptionNextMonth() { return this.i.cu; } get operatorCaptionLastMonth() { return this.i.cn; } get operatorCaptionThisQuarter() { return this.i.c6; } get operatorCaptionNextQuarter() { return this.i.cv; } get operatorCaptionLastQuarter() { return this.i.co; } get operatorCaptionThisYear() { return this.i.c8; } get operatorCaptionNextYear() { return this.i.cx; } get operatorCaptionLastYear() { return this.i.cq; } get operatorCaptionYearToDate() { return this.i.df; } get operatorCaptionQ1() { return this.i.c0; } get operatorCaptionQ2() { return this.i.c1; } get operatorCaptionQ3() { return this.i.c2; } get operatorCaptionQ4() { return this.i.c3; } get operatorCaptionMonth() { return this.i.ct; } get operatorCaptionYear() { return this.i.de; } get operatorCaptionStartsWith() { return this.i.c4; } get operatorCaptionDoesNotStartWith() { return this.i.cg; } get operatorCaptionEndsWith() { return this.i.ci; } get operatorCaptionDoesNotEndWith() { return this.i.cf; } get operatorCaptionContains() { return this.i.cd; } get operatorCaptionDoesNotContain() { return this.i.ce; } get operatorCaptionEmpty() { return this.i.ch; } get operatorCaptionNotEmpty() { return this.i.cy; } 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("DataGridComparisonOperatorSelectorComponent"); 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; } provideContainer(container) { this.i.ej(container); } dispose() { this.i.ea(); } getDropdownHeight() { let iv = this.i.y(); return (iv); } toggle() { this.i.em(); } close() { this.i.d8(); } addCustomOperator(name, icon, id, index) { this.i.d1(name, icon, id, index); } clearCustomOperators() { this.i.d7(); } selectCustomFilter(id, index) { this.i.ek(id, index); } get valueChanged() { return this._valueChanged; } set valueChanged(ev) { 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 = (o, e) => { let outerArgs = new IgcOperatorSelectorValueChangedEventArgs(); 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); ; } get opening() { return this._opening; } set opening(ev) { if (this._opening_wrapped !== null) { this.i.opening = delegateRemove(this.i.opening, this._opening_wrapped); this._opening_wrapped = null; this._opening = null; } this._opening = ev; this._opening_wrapped = (o, e) => { let outerArgs = new IgcOperatorSelectorOpeningEventArgs(); outerArgs._provideImplementation(e); if (this.beforeOpening) { this.beforeOpening(this, outerArgs); } if (this._opening) { this._opening(this, outerArgs); } }; this.i.opening = delegateCombine(this.i.opening, this._opening_wrapped); ; } get opened() { return this._opened; } set opened(ev) { if (this._opened_wrapped !== null) { this.i.opened = delegateRemove(this.i.opened, this._opened_wrapped); this._opened_wrapped = null; this._opened = null; } this._opened = ev; this._opened_wrapped = (o, e) => { let outerArgs = new IgcOperatorSelectorOpeningEventArgs(); outerArgs._provideImplementation(e); if (this.beforeOpened) { this.beforeOpened(this, outerArgs); } if (this._opened) { this._opened(this, outerArgs); } }; this.i.opened = delegateCombine(this.i.opened, this._opened_wrapped); ; } get closing() { return this._closing; } set closing(ev) { if (this._closing_wrapped !== null) { this.i.closing = delegateRemove(this.i.closing, this._closing_wrapped); this._closing_wrapped = null; this._closing = null; } this._closing = ev; this._closing_wrapped = (o, e) => { let outerArgs = new IgcOperatorSelectorClosingEventArgs(); outerArgs._provideImplementation(e); if (this.beforeClosing) { this.beforeClosing(this, outerArgs); } if (this._closing) { this._closing(this, outerArgs); } }; this.i.closing = delegateCombine(this.i.closing, this._closing_wrapped); ; } } IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent = null; IgcDataGridComparisonOperatorSelectorComponent.htmlTagName = "igc-data-grid-comparison-operator-selector"; IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered = false; return IgcDataGridComparisonOperatorSelectorComponent; })();