igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
753 lines (752 loc) • 29 kB
JavaScript
import { __extends } from "tslib";
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.
*/
var IgcDataGridComparisonOperatorSelectorComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcDataGridComparisonOperatorSelectorComponent, _super);
function IgcDataGridComparisonOperatorSelectorComponent() {
var _this = _super.call(this) || this;
_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();
}
return _this;
}
IgcDataGridComparisonOperatorSelectorComponent.prototype.createImplementation = function () {
return new ComparisonOperatorSelector();
};
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgcDataGridComparisonOperatorSelectorComponent._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);
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.onImplementationCreated = function () {
};
IgcDataGridComparisonOperatorSelectorComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
};
IgcDataGridComparisonOperatorSelectorComponent.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;
};
IgcDataGridComparisonOperatorSelectorComponent.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;
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.connectedCallback = function () {
if (_super.prototype["connectedCallback"]) {
_super.prototype["connectedCallback"].call(this);
}
if (this.i.connectedCallback) {
this.i.connectedCallback();
}
if (!this._attached) {
this._attached = true;
this._flushQueuedAttributes();
}
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.disconnectedCallback = function () {
if (_super.prototype["disconnectedCallback"]) {
_super.prototype["disconnectedCallback"].call(this);
}
if (this.i.disconnectedCallback) {
this.i.disconnectedCallback();
}
if (this._attached) {
this._attached = false;
}
};
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent, "observedAttributes", {
get: function () {
if (IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent == null) {
var names = getAllPropertyNames(IgcDataGridComparisonOperatorSelectorComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent = names;
}
return IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent;
},
enumerable: false,
configurable: true
});
IgcDataGridComparisonOperatorSelectorComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
var setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
};
IgcDataGridComparisonOperatorSelectorComponent.register = function () {
if (!IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered) {
IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcDataGridComparisonOperatorSelectorComponent.htmlTagName, IgcDataGridComparisonOperatorSelectorComponent);
}
};
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "value", {
/**
* Gets or sets the value of the selector.
*/
get: function () {
return this.i.b;
},
set: function (v) {
this.i.b = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "customFilterID", {
/**
* Gets the ID for the custom filter that is selected. Value must be 'Custom' for this property to be valid.
*/
get: function () {
return this.i.ae;
},
set: function (v) {
this.i.ae = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "customFilterIndex", {
/**
* Gets the index for the custom filter that is selected. Value must be 'Custom' for this property to be valid.
*/
get: function () {
return this.i.x;
},
set: function (v) {
this.i.x = +v;
this._a("customFilterIndex", this.i.x);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "dataType", {
/**
* Gets or sets the data type. Used to determine what operators are available.
*/
get: function () {
return this.i.d;
},
set: function (v) {
this.i.d = ensureEnum(DataSourceSchemaPropertyType_$type, v);
this._a("dataType", enumToString(DataSourceSchemaPropertyType_$type, this.i.d));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "maxHeight", {
get: function () {
return this.i.z;
},
set: function (v) {
this.i.z = +v;
this._a("maxHeight", this.i.z);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "textColor", {
/**
* Gets or sets the text color.
*/
get: function () {
return brushToString(this.i.eq);
},
set: function (v) {
this.i.eq = stringToBrush(v);
this._a("textColor", brushToString(this.i.eq));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "background", {
/**
* Gets or sets the background color.
*/
get: function () {
return brushToString(this.i.ep);
},
set: function (v) {
this.i.ep = stringToBrush(v);
this._a("background", brushToString(this.i.ep));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionTrue", {
get: function () {
return this.i.dd;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionFalse", {
get: function () {
return this.i.ck;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionEquals", {
get: function () {
return this.i.cj;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNotEquals", {
get: function () {
return this.i.cz;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLessThan", {
get: function () {
return this.i.cr;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLessThanOrEqual", {
get: function () {
return this.i.cs;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionGreaterThan", {
get: function () {
return this.i.cl;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionGreaterThanOrEqual", {
get: function () {
return this.i.cm;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionTop", {
get: function () {
return this.i.db;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionBottom", {
get: function () {
return this.i.cb;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionTopPercentile", {
get: function () {
return this.i.dc;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionBottomPercentile", {
get: function () {
return this.i.cc;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionToday", {
get: function () {
return this.i.c9;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionTomorrow", {
get: function () {
return this.i.da;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionYesterday", {
get: function () {
return this.i.dg;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionThisWeek", {
get: function () {
return this.i.c7;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNextWeek", {
get: function () {
return this.i.cw;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLastWeek", {
get: function () {
return this.i.cp;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionThisMonth", {
get: function () {
return this.i.c5;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNextMonth", {
get: function () {
return this.i.cu;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLastMonth", {
get: function () {
return this.i.cn;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionThisQuarter", {
get: function () {
return this.i.c6;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNextQuarter", {
get: function () {
return this.i.cv;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLastQuarter", {
get: function () {
return this.i.co;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionThisYear", {
get: function () {
return this.i.c8;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNextYear", {
get: function () {
return this.i.cx;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionLastYear", {
get: function () {
return this.i.cq;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionYearToDate", {
get: function () {
return this.i.df;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionQ1", {
get: function () {
return this.i.c0;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionQ2", {
get: function () {
return this.i.c1;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionQ3", {
get: function () {
return this.i.c2;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionQ4", {
get: function () {
return this.i.c3;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionMonth", {
get: function () {
return this.i.ct;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionYear", {
get: function () {
return this.i.de;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionStartsWith", {
get: function () {
return this.i.c4;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionDoesNotStartWith", {
get: function () {
return this.i.cg;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionEndsWith", {
get: function () {
return this.i.ci;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionDoesNotEndWith", {
get: function () {
return this.i.cf;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionContains", {
get: function () {
return this.i.cd;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionDoesNotContain", {
get: function () {
return this.i.ce;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionEmpty", {
get: function () {
return this.i.ch;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "operatorCaptionNotEmpty", {
get: function () {
return this.i.cy;
},
enumerable: false,
configurable: true
});
IgcDataGridComparisonOperatorSelectorComponent.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgcDataGridComparisonOperatorSelectorComponent.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgcDataGridComparisonOperatorSelectorComponent.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("DataGridComparisonOperatorSelectorComponent");
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;
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.provideContainer = function (container) {
this.i.ej(container);
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.dispose = function () {
this.i.ea();
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.getDropdownHeight = function () {
var iv = this.i.y();
return (iv);
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.toggle = function () {
this.i.em();
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.close = function () {
this.i.d8();
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.addCustomOperator = function (name, icon, id, index) {
this.i.d1(name, icon, id, index);
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.clearCustomOperators = function () {
this.i.d7();
};
IgcDataGridComparisonOperatorSelectorComponent.prototype.selectCustomFilter = function (id, index) {
this.i.ek(id, index);
};
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "valueChanged", {
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 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "opening", {
get: function () {
return this._opening;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "opened", {
get: function () {
return this._opened;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcDataGridComparisonOperatorSelectorComponent.prototype, "closing", {
get: function () {
return this._closing;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
IgcDataGridComparisonOperatorSelectorComponent._observedAttributesIgcDataGridComparisonOperatorSelectorComponent = null;
IgcDataGridComparisonOperatorSelectorComponent.htmlTagName = "igc-data-grid-comparison-operator-selector";
IgcDataGridComparisonOperatorSelectorComponent._isElementRegistered = false;
return IgcDataGridComparisonOperatorSelectorComponent;
}(IgcHTMLElement));
export { IgcDataGridComparisonOperatorSelectorComponent };