igniteui-webcomponents-grids
Version:
Ignite UI Web Components grid components.
536 lines (535 loc) • 20.5 kB
JavaScript
import { __extends } from "tslib";
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";
var IgcGridConditionalStylePropertyComponent = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgcGridConditionalStylePropertyComponent, _super);
function IgcGridConditionalStylePropertyComponent() {
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._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();
}
return _this;
}
IgcGridConditionalStylePropertyComponent.prototype.createImplementation = function () {
return new GridConditionalStyleProperty();
};
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgcGridConditionalStylePropertyComponent._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);
};
IgcGridConditionalStylePropertyComponent.prototype.onImplementationCreated = function () {
};
IgcGridConditionalStylePropertyComponent.prototype._enqueueSetAttribute = function (attrName, attrValue) {
this._queuedSetAttributes.push({ attrName: attrName, attrValue: attrValue });
};
IgcGridConditionalStylePropertyComponent.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;
};
IgcGridConditionalStylePropertyComponent.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;
};
IgcGridConditionalStylePropertyComponent.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();
}
};
IgcGridConditionalStylePropertyComponent.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(IgcGridConditionalStylePropertyComponent, "observedAttributes", {
get: function () {
if (IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent == null) {
var names = getAllPropertyNames(IgcGridConditionalStylePropertyComponent);
for (var i = 0; i < names.length; i++) {
names[i] = toSpinal(names[i]);
}
IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent = names;
}
return IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent;
},
enumerable: false,
configurable: true
});
IgcGridConditionalStylePropertyComponent.prototype.attributeChangedCallback = function (name, oldValue, newValue) {
if (this._settingAttributes) {
return;
}
var setName = fromSpinal(name);
this._updatingFromAttribute = true;
this[setName] = newValue;
this._updatingFromAttribute = false;
};
IgcGridConditionalStylePropertyComponent.register = function () {
if (!IgcGridConditionalStylePropertyComponent._isElementRegistered) {
IgcGridConditionalStylePropertyComponent._isElementRegistered = true;
RegisterElementHelper.registerElement(IgcGridConditionalStylePropertyComponent.htmlTagName, IgcGridConditionalStylePropertyComponent);
}
};
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "stylingType", {
get: function () {
return this.i.aj;
},
set: function (v) {
this.i.aj = ensureEnum(GridConditionalStylePropertyStylingType_$type, v);
this._a("stylingType", enumToString(GridConditionalStylePropertyStylingType_$type, this.i.aj));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "minimumType", {
get: function () {
return this.i.ah;
},
set: function (v) {
this.i.ah = ensureEnum(GridConditionalStyleBoundType_$type, v);
this._a("minimumType", enumToString(GridConditionalStyleBoundType_$type, this.i.ah));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "maximumType", {
get: function () {
return this.i.ag;
},
set: function (v) {
this.i.ag = ensureEnum(GridConditionalStyleBoundType_$type, v);
this._a("maximumType", enumToString(GridConditionalStyleBoundType_$type, this.i.ag));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "propertyName", {
get: function () {
return this.i.b9;
},
set: function (v) {
this.i.b9 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "inputValueExpression", {
get: function () {
return this.i.w;
},
set: function (v) {
this.i.w = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "inputValueExpressionString", {
get: function () {
return this.i.bo;
},
set: function (v) {
this.i.bo = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "actualInputValueExpression", {
get: function () {
return this.i.s;
},
set: function (v) {
this.i.s = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "minimumInputValueExpression", {
get: function () {
return this.i.y;
},
set: function (v) {
this.i.y = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "minimumInputValueExpressionString", {
get: function () {
return this.i.b5;
},
set: function (v) {
this.i.b5 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "actualMinimumInputValueExpression", {
get: function () {
return this.i.u;
},
set: function (v) {
this.i.u = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "maximumInputValueExpression", {
get: function () {
return this.i.x;
},
set: function (v) {
this.i.x = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "maximumInputValueExpressionString", {
get: function () {
return this.i.bz;
},
set: function (v) {
this.i.bz = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "actualMaximumInputValueExpression", {
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "sumInputValueExpression", {
get: function () {
return this.i.ad;
},
set: function (v) {
this.i.ad = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "sumInputValueExpressionString", {
get: function () {
return this.i.ce;
},
set: function (v) {
this.i.ce = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "actualSumInputValueExpression", {
get: function () {
return this.i.v;
},
set: function (v) {
this.i.v = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "value", {
get: function () {
return this.i.bc;
},
set: function (v) {
this.i.bc = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "shouldSetValue", {
get: function () {
return this.i.as;
},
set: function (v) {
this.i.as = ensureBool(v);
this._a("shouldSetValue", this.i.as);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "minimumColor", {
get: function () {
return brushToString(this.i.co);
},
set: function (v) {
this.i.co = stringToBrush(v);
this._a("minimumColor", brushToString(this.i.co));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "maximumColor", {
get: function () {
return brushToString(this.i.cn);
},
set: function (v) {
this.i.cn = stringToBrush(v);
this._a("maximumColor", brushToString(this.i.cn));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "minimumInputValue", {
get: function () {
return this.i.ba;
},
set: function (v) {
this.i.ba = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "maximumInputValue", {
get: function () {
return this.i.a9;
},
set: function (v) {
this.i.a9 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "sumInputValue", {
get: function () {
return this.i.bb;
},
set: function (v) {
this.i.bb = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "colorCollection", {
get: function () {
return fromBrushCollection(this.i.f);
},
set: function (v) {
this.i.f = toBrushCollection(v);
this._a("colorCollection", brushCollectionToString(this.i.f));
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "valueCollection", {
get: function () {
return this.i.d;
},
set: function (v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
var re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.d = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "requiresGlobalValues", {
get: function () {
return this.i.ar;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "needsGlobalMinimum", {
get: function () {
return this.i.ap;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "needsGlobalMaximum", {
get: function () {
return this.i.ao;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "needsGlobalSum", {
get: function () {
return this.i.aq;
},
enumerable: false,
configurable: true
});
IgcGridConditionalStylePropertyComponent.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
Object.defineProperty(IgcGridConditionalStylePropertyComponent.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgcGridConditionalStylePropertyComponent.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgcGridConditionalStylePropertyComponent.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("GridConditionalStylePropertyComponent");
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(IgcGridConditionalStylePropertyComponent.prototype, "filterStringErrorsParsing", {
get: function () {
return this._filterStringErrorsParsing;
},
set: function (ev) {
var _this = this;
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 = function (o, e) {
var 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);
;
},
enumerable: false,
configurable: true
});
IgcGridConditionalStylePropertyComponent._observedAttributesIgcGridConditionalStylePropertyComponent = null;
IgcGridConditionalStylePropertyComponent.htmlTagName = "igc-grid-conditional-style-property";
IgcGridConditionalStylePropertyComponent._isElementRegistered = false;
return IgcGridConditionalStylePropertyComponent;
}(IgcHTMLElement));
export { IgcGridConditionalStylePropertyComponent };