igniteui-react-grids
Version:
Ignite UI React grid components.
503 lines (502 loc) • 17.3 kB
JavaScript
import { __extends, __values } from "tslib";
import * as React from 'react';
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { GridConditionalStylePropertyStylingType_$type } from "./GridConditionalStylePropertyStylingType";
import { GridConditionalStyleBoundType_$type } from "./GridConditionalStyleBoundType";
import { IgrGridConditionFilterStringErrorsParsingEventArgs } from "./igr-grid-condition-filter-string-errors-parsing-event-args";
import { GridConditionalStyleProperty } from "./GridConditionalStyleProperty";
import { TypeRegistrar } from "igniteui-react-core";
import { NamePatcher, getModifiedProps, isValidProp, ensureEnum, ensureBool, brushToString, stringToBrush, toBrushCollection, fromBrushCollection, toSpinal, initializePropertiesFromCss } from "igniteui-react-core";
var IgrGridConditionalStyleProperty = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(IgrGridConditionalStyleProperty, _super);
function IgrGridConditionalStyleProperty(props) {
var _this = _super.call(this, props) || this;
_this.mounted = 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;
}
IgrGridConditionalStyleProperty.prototype.createImplementation = function () {
return new GridConditionalStyleProperty();
};
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "nativeElement", {
get: function () {
return this._implementation.nativeElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgrGridConditionalStyleProperty._createFromInternal = function (internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
var name = internal.$type.name;
var externalName = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
};
IgrGridConditionalStyleProperty.prototype.onImplementationCreated = function () {
};
IgrGridConditionalStyleProperty.prototype.componentDidMount = function () {
var e_1, _a;
this.mounted = true;
try {
for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
};
IgrGridConditionalStyleProperty.prototype.shouldComponentUpdate = function (nextProps, nextState) {
var e_2, _a;
var mod = getModifiedProps(this.props, nextProps);
try {
for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) {
var p = _c.value;
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
}
catch (e_2_1) {
e_2 = { error: e_2_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_2)
throw e_2.error;
}
}
return true;
};
IgrGridConditionalStyleProperty.prototype.render = function () {
return null;
};
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "stylingType", {
get: function () {
return this.i.aj;
},
set: function (v) {
this.i.aj = ensureEnum(GridConditionalStylePropertyStylingType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "minimumType", {
get: function () {
return this.i.ah;
},
set: function (v) {
this.i.ah = ensureEnum(GridConditionalStyleBoundType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "maximumType", {
get: function () {
return this.i.ag;
},
set: function (v) {
this.i.ag = ensureEnum(GridConditionalStyleBoundType_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "propertyName", {
get: function () {
return this.i.b9;
},
set: function (v) {
this.i.b9 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "inputValueExpression", {
get: function () {
return this.i.w;
},
set: function (v) {
this.i.w = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "inputValueExpressionString", {
get: function () {
return this.i.bo;
},
set: function (v) {
this.i.bo = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "actualInputValueExpression", {
get: function () {
return this.i.s;
},
set: function (v) {
this.i.s = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "minimumInputValueExpression", {
get: function () {
return this.i.y;
},
set: function (v) {
this.i.y = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "minimumInputValueExpressionString", {
get: function () {
return this.i.b5;
},
set: function (v) {
this.i.b5 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "actualMinimumInputValueExpression", {
get: function () {
return this.i.u;
},
set: function (v) {
this.i.u = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "maximumInputValueExpression", {
get: function () {
return this.i.x;
},
set: function (v) {
this.i.x = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "maximumInputValueExpressionString", {
get: function () {
return this.i.bz;
},
set: function (v) {
this.i.bz = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "actualMaximumInputValueExpression", {
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "sumInputValueExpression", {
get: function () {
return this.i.ad;
},
set: function (v) {
this.i.ad = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "sumInputValueExpressionString", {
get: function () {
return this.i.ce;
},
set: function (v) {
this.i.ce = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "actualSumInputValueExpression", {
get: function () {
return this.i.v;
},
set: function (v) {
this.i.v = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "value", {
get: function () {
return this.i.bc;
},
set: function (v) {
this.i.bc = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "shouldSetValue", {
get: function () {
return this.i.as;
},
set: function (v) {
this.i.as = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "minimumColor", {
get: function () {
return brushToString(this.i.co);
},
set: function (v) {
this.i.co = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "maximumColor", {
get: function () {
return brushToString(this.i.cn);
},
set: function (v) {
this.i.cn = stringToBrush(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "minimumInputValue", {
get: function () {
return this.i.ba;
},
set: function (v) {
this.i.ba = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "maximumInputValue", {
get: function () {
return this.i.a9;
},
set: function (v) {
this.i.a9 = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "sumInputValue", {
get: function () {
return this.i.bb;
},
set: function (v) {
this.i.bb = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "colorCollection", {
get: function () {
return fromBrushCollection(this.i.f);
},
set: function (v) {
this.i.f = toBrushCollection(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.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(IgrGridConditionalStyleProperty.prototype, "requiresGlobalValues", {
get: function () {
return this.i.ar;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "needsGlobalMinimum", {
get: function () {
return this.i.ap;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "needsGlobalMaximum", {
get: function () {
return this.i.ao;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "needsGlobalSum", {
get: function () {
return this.i.aq;
},
enumerable: false,
configurable: true
});
IgrGridConditionalStyleProperty.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
Object.defineProperty(IgrGridConditionalStyleProperty.prototype, "hasUserValues", {
get: function () {
return this._hasUserValues;
},
enumerable: false,
configurable: true
});
IgrGridConditionalStyleProperty.prototype.__m = function (propertyName) {
if (!this._inStyling) {
this._hasUserValues.add(propertyName);
}
};
IgrGridConditionalStyleProperty.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("GridConditionalStyleProperty");
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(IgrGridConditionalStyleProperty.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 IgrGridConditionFilterStringErrorsParsingEventArgs();
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
});
return IgrGridConditionalStyleProperty;
}(React.Component));
export { IgrGridConditionalStyleProperty };