igniteui-react-grids
Version:
Ignite UI React grid components.
331 lines (330 loc) • 10.1 kB
JavaScript
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";
export class IgrGridConditionalStyleProperty extends React.Component {
createImplementation() {
return new GridConditionalStyleProperty();
}
get nativeElement() {
return this._implementation.nativeElement;
}
/**
* @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 = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
}
onImplementationCreated() {
}
constructor(props) {
super(props);
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();
}
}
componentDidMount() {
this.mounted = true;
for (const p of Object.keys(this.props)) {
if (isValidProp(this, p)) {
this[p] = this.props[p];
}
}
}
shouldComponentUpdate(nextProps, nextState) {
const mod = getModifiedProps(this.props, nextProps);
for (const p of Object.keys(mod)) {
if (isValidProp(this, p)) {
this[p] = mod[p];
}
}
return true;
}
render() {
return null;
}
get stylingType() {
return this.i.aj;
}
set stylingType(v) {
this.i.aj = ensureEnum(GridConditionalStylePropertyStylingType_$type, v);
}
get minimumType() {
return this.i.ah;
}
set minimumType(v) {
this.i.ah = ensureEnum(GridConditionalStyleBoundType_$type, v);
}
get maximumType() {
return this.i.ag;
}
set maximumType(v) {
this.i.ag = ensureEnum(GridConditionalStyleBoundType_$type, v);
}
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);
}
get minimumColor() {
return brushToString(this.i.co);
}
set minimumColor(v) {
this.i.co = stringToBrush(v);
}
get maximumColor() {
return brushToString(this.i.cn);
}
set maximumColor(v) {
this.i.cn = stringToBrush(v);
}
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);
}
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("GridConditionalStyleProperty");
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 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);
;
}
}