igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
401 lines (400 loc) • 15.1 kB
JavaScript
import { IgcHTMLElement } from "igniteui-webcomponents-core";
import { delegateCombine, delegateRemove } from "igniteui-webcomponents-core";
import { GridConditionalStylePropertyStylingType_$type } from "./GridConditionalStylePropertyStylingType";
import { GridConditionalStyleBoundType_$type } from "./GridConditionalStyleBoundType";
import { IgcGridConditionFilterStringErrorsParsingEventArgs } from "./igc-grid-condition-filter-string-errors-parsing-event-args";
import { GridConditionalStyleProperty } from "./GridConditionalStyleProperty";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { NamePatcher, getAllPropertyNames, fromSpinal, toSpinal, ensureEnum, enumToString, ensureBool, brushToString, stringToBrush, toBrushCollection, fromBrushCollection, brushCollectionToString, initializePropertiesFromCss } from "igniteui-webcomponents-core";
import { RegisterElementHelper } from "igniteui-webcomponents-core";
export let IgcGridConditionalStylePropertyComponent = /*@__PURE__*/ (() => {
class IgcGridConditionalStylePropertyComponent extends IgcHTMLElement {
createImplementation() {
return new GridConditionalStyleProperty();
}
/**
* @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._filterStringErrorsParsing = null;
this._filterStringErrorsParsing_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 (IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent == null) {
let names = getAllPropertyNames(IgcGridConditionalStylePropertyComponent);
for (let i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent = names;
}
return IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent;
}
attributeChangedCallback(name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
let setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
}
static register() {
if (!IgcGridConditionalStylePropertyComponent._isElementRegistered) {
IgcGridConditionalStylePropertyComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcGridConditionalStylePropertyComponent.htmlTagName, IgcGridConditionalStylePropertyComponent);
}
}
get stylingType() {
return this.i.aj;
}
set stylingType(v) {
this.i.aj = ensureEnum(GridConditionalStylePropertyStylingType_$type, v);
this._a("stylingType", enumToString(GridConditionalStylePropertyStylingType_$type, this.i.aj));
}
get minimumType() {
return this.i.ah;
}
set minimumType(v) {
this.i.ah = ensureEnum(GridConditionalStyleBoundType_$type, v);
this._a("minimumType", enumToString(GridConditionalStyleBoundType_$type, this.i.ah));
}
get maximumType() {
return this.i.ag;
}
set maximumType(v) {
this.i.ag = ensureEnum(GridConditionalStyleBoundType_$type, v);
this._a("maximumType", enumToString(GridConditionalStyleBoundType_$type, this.i.ag));
}
get propertyName() {
return this.i.b9;
}
set propertyName(v) {
this.i.b9 = v;
}
get inputValueExpression() {
return this.i.w;
}
set inputValueExpression(v) {
this.i.w = v;
}
get inputValueExpressionString() {
return this.i.bo;
}
set inputValueExpressionString(v) {
this.i.bo = v;
}
get actualInputValueExpression() {
return this.i.s;
}
set actualInputValueExpression(v) {
this.i.s = v;
}
get minimumInputValueExpression() {
return this.i.y;
}
set minimumInputValueExpression(v) {
this.i.y = v;
}
get minimumInputValueExpressionString() {
return this.i.b5;
}
set minimumInputValueExpressionString(v) {
this.i.b5 = v;
}
get actualMinimumInputValueExpression() {
return this.i.u;
}
set actualMinimumInputValueExpression(v) {
this.i.u = v;
}
get maximumInputValueExpression() {
return this.i.x;
}
set maximumInputValueExpression(v) {
this.i.x = v;
}
get maximumInputValueExpressionString() {
return this.i.bz;
}
set maximumInputValueExpressionString(v) {
this.i.bz = v;
}
get actualMaximumInputValueExpression() {
return this.i.t;
}
set actualMaximumInputValueExpression(v) {
this.i.t = v;
}
get sumInputValueExpression() {
return this.i.ad;
}
set sumInputValueExpression(v) {
this.i.ad = v;
}
get sumInputValueExpressionString() {
return this.i.ce;
}
set sumInputValueExpressionString(v) {
this.i.ce = v;
}
get actualSumInputValueExpression() {
return this.i.v;
}
set actualSumInputValueExpression(v) {
this.i.v = v;
}
get value() {
return this.i.bc;
}
set value(v) {
this.i.bc = v;
}
get shouldSetValue() {
return this.i.as;
}
set shouldSetValue(v) {
this.i.as = ensureBool(v);
this._a("shouldSetValue", this.i.as);
}
get minimumColor() {
return brushToString(this.i.co);
}
set minimumColor(v) {
this.i.co = stringToBrush(v);
this._a("minimumColor", brushToString(this.i.co));
}
get maximumColor() {
return brushToString(this.i.cn);
}
set maximumColor(v) {
this.i.cn = stringToBrush(v);
this._a("maximumColor", brushToString(this.i.cn));
}
get minimumInputValue() {
return this.i.ba;
}
set minimumInputValue(v) {
this.i.ba = v;
}
get maximumInputValue() {
return this.i.a9;
}
set maximumInputValue(v) {
this.i.a9 = v;
}
get sumInputValue() {
return this.i.bb;
}
set sumInputValue(v) {
this.i.bb = v;
}
get colorCollection() {
return fromBrushCollection(this.i.f);
}
set colorCollection(v) {
this.i.f = toBrushCollection(v);
this._a("colorCollection", brushCollectionToString(this.i.f));
}
get valueCollection() {
return this.i.d;
}
set valueCollection(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.d = v;
}
get requiresGlobalValues() {
return this.i.ar;
}
get needsGlobalMinimum() {
return this.i.ap;
}
get needsGlobalMaximum() {
return this.i.ao;
}
get needsGlobalSum() {
return this.i.aq;
}
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("GridConditionalStylePropertyComponent");
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;
}
get filterStringErrorsParsing() {
return this._filterStringErrorsParsing;
}
set filterStringErrorsParsing(ev) {
if (this._filterStringErrorsParsing_wrapped !== null) {
this.i.filterStringErrorsParsing = delegateRemove(this.i.filterStringErrorsParsing, this._filterStringErrorsParsing_wrapped);
this._filterStringErrorsParsing_wrapped = null;
this._filterStringErrorsParsing = null;
}
this._filterStringErrorsParsing = ev;
this._filterStringErrorsParsing_wrapped = (o, e) => {
let outerArgs = new IgcGridConditionFilterStringErrorsParsingEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeFilterStringErrorsParsing) {
this.beforeFilterStringErrorsParsing(this, outerArgs);
}
if (this._filterStringErrorsParsing) {
this._filterStringErrorsParsing(this, outerArgs);
}
};
this.i.filterStringErrorsParsing = delegateCombine(this.i.filterStringErrorsParsing, this._filterStringErrorsParsing_wrapped);
;
}
}
IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent = null;
IgcGridConditionalStylePropertyComponent.htmlTagName = "igc-grid-conditional-style-property";
IgcGridConditionalStylePropertyComponent._isElementRegistered = false;
return IgcGridConditionalStylePropertyComponent;
})();