igniteui-react-grids
Version:
Ignite UI React grid components.
282 lines (281 loc) • 10 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { DataSourceSummaryOperand_$type } from "igniteui-react-core";
import { IgrFormatSummaryTextEventArgs } from "./igr-format-summary-text-event-args";
import { IgrProvideCalculatorEventArgs } from "igniteui-react-core";
import { ColumnSummaryDescription as ColumnSummaryDescription_internal } from "./ColumnSummaryDescription";
import { ensureEnum, ensureBool, arrayFindByName } from "igniteui-react-core";
/**
* Represents a summary that is applied to a datasource. Changes to this object are not observed or expected after it is initially assigned to a collection.
*/
var IgrColumnSummaryDescription = /** @class */ /*@__PURE__*/ (function () {
function IgrColumnSummaryDescription() {
this.mounted = false;
this._formatText = null;
this._formatText_wrapped = null;
this._provideCalculator = null;
this._provideCalculator_wrapped = null;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
IgrColumnSummaryDescription.prototype.createImplementation = function () {
return new ColumnSummaryDescription_internal(0);
};
Object.defineProperty(IgrColumnSummaryDescription.prototype, "nativeElement", {
get: function () {
return this._implementation.nativeElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgrColumnSummaryDescription.prototype.onImplementationCreated = function () {
};
IgrColumnSummaryDescription.prototype._provideImplementation = function (i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
};
Object.defineProperty(IgrColumnSummaryDescription.prototype, "field", {
get: function () {
return this.i.ah;
},
set: function (v) {
this.i.ah = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "operand", {
get: function () {
return this.i.i;
},
set: function (v) {
this.i.i = ensureEnum(DataSourceSummaryOperand_$type, v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "calculatorDisplayName", {
/**
* Gets or sets the name to use when displaying the calculator name.
*/
get: function () {
return this.i.ae;
},
set: function (v) {
this.i.ae = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "displayName", {
/**
* Gets or sets the display name for the summary.
*/
get: function () {
return this.i.ag;
},
set: function (v) {
this.i.ag = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "valueFormat", {
/**
* Gets or sets the format string for the summary value.
*/
get: function () {
return this.i.ai;
},
set: function (v) {
this.i.ai = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "shouldDisplay", {
/**
* Gets or sets whether the summary value should be displayed.
*/
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "valueFormatSpecifiers", {
/**
* Gets or sets the format specifiers to use with the ValueFormat string.
*/
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(IgrColumnSummaryDescription.prototype, "displayFormat", {
/**
* Gets or sets the display format for the summary when in list display mode.
*/
get: function () {
return this.i.af;
},
set: function (v) {
this.i.af = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "displayFormatSpecifiers", {
/**
* Gets or sets the format specifiers to use with the DisplayFormat string.
*/
get: function () {
return this.i.c;
},
set: function (v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
var re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.c = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "formatOverride", {
/**
* Gets or sets an INTL.DateTimeFormat or INTL.NumericFormat to use to format the value.
*/
get: function () {
return this.i.y;
},
set: function (v) {
this.i.y = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "maxFractionDigits", {
/**
* Gets or sets the maximum fraction digits. If a format is specificied this value is ignored.
*/
get: function () {
return this.i.w;
},
set: function (v) {
this.i.w = +v;
},
enumerable: false,
configurable: true
});
IgrColumnSummaryDescription.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.valueFormatSpecifiers != null && arrayFindByName(this.valueFormatSpecifiers, name)) {
return arrayFindByName(this.valueFormatSpecifiers, name);
}
if (this.displayFormatSpecifiers != null && arrayFindByName(this.displayFormatSpecifiers, name)) {
return arrayFindByName(this.displayFormatSpecifiers, name);
}
return null;
};
IgrColumnSummaryDescription.prototype.equals = function (other) {
var iv = this.i.equals(other);
return (iv);
};
Object.defineProperty(IgrColumnSummaryDescription.prototype, "formatText", {
/**
* Called when the value is being formatted.
*/
get: function () {
return this._formatText;
},
set: function (ev) {
var _this = this;
if (this._formatText_wrapped !== null) {
this.i.formatText = delegateRemove(this.i.formatText, this._formatText_wrapped);
this._formatText_wrapped = null;
this._formatText = null;
}
this._formatText = ev;
this._formatText_wrapped = function (o, e) {
var outerArgs = new IgrFormatSummaryTextEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeFormatText) {
_this.beforeFormatText(_this, outerArgs);
}
if (_this._formatText) {
_this._formatText(_this, outerArgs);
}
};
this.i.formatText = delegateCombine(this.i.formatText, this._formatText_wrapped);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrColumnSummaryDescription.prototype, "provideCalculator", {
/**
* Called when the summary calculator is required.
*/
get: function () {
return this._provideCalculator;
},
set: function (ev) {
var _this = this;
if (this._provideCalculator_wrapped !== null) {
this.i.provideCalculator = delegateRemove(this.i.provideCalculator, this._provideCalculator_wrapped);
this._provideCalculator_wrapped = null;
this._provideCalculator = null;
}
this._provideCalculator = ev;
this._provideCalculator_wrapped = function (o, e) {
var outerArgs = new IgrProvideCalculatorEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeProvideCalculator) {
_this.beforeProvideCalculator(_this, outerArgs);
}
if (_this._provideCalculator) {
_this._provideCalculator(_this, outerArgs);
}
};
this.i.provideCalculator = delegateCombine(this.i.provideCalculator, this._provideCalculator_wrapped);
;
},
enumerable: false,
configurable: true
});
return IgrColumnSummaryDescription;
}());
export { IgrColumnSummaryDescription };