igniteui-react-grids
Version:
Ignite UI React grid components.
126 lines (125 loc) • 3.98 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { IgrFormatGroupTextEventArgs } from "./igr-format-group-text-event-args";
import { IgrColumnSortDescription } from "./igr-column-sort-description";
import { ColumnGroupDescription as ColumnGroupDescription_internal } from "./ColumnGroupDescription";
import { arrayFindByName } from "igniteui-react-core";
/**
* Represents an element in the current grouping applied to a data source or provider. Changes to this object are not observed or expected after it is initially assigned to a collection.
*/
export class IgrColumnGroupDescription extends IgrColumnSortDescription {
createImplementation() {
return new ColumnGroupDescription_internal(0);
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
constructor() {
super();
this._formatText = null;
this._formatText_wrapped = null;
}
/**
* Gets or sets the format string for the group value.
*/
get valueFormat() {
return this.i.x;
}
set valueFormat(v) {
this.i.x = v;
}
/**
* Gets or sets the format specifiers to use with the ValueFormat string.
*/
get valueFormatSpecifiers() {
return this.i.j;
}
set valueFormatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.j = v;
}
/**
* Gets or sets the display format for the group text in the group header.
*/
get displayFormat() {
return this.i.u;
}
set displayFormat(v) {
this.i.u = v;
}
/**
* Gets or sets the format specifiers to use with the DisplayFormat string.
*/
get displayFormatSpecifiers() {
return this.i.i;
}
set displayFormatSpecifiers(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.i = v;
}
/**
* Gets or sets an INTL.DateTimeFormat or INTL.NumericFormat to use to format the value.
*/
get formatOverride() {
return this.i.q;
}
set formatOverride(v) {
this.i.q = v;
}
/**
* Gets or sets the display text for the group name.
*/
get displayName() {
return this.i.v;
}
set displayName(v) {
this.i.v = v;
}
findByName(name) {
var baseResult = super.findByName(name);
if (baseResult) {
return baseResult;
}
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;
}
/**
* Called when the value is being formatted.
*/
get formatText() {
return this._formatText;
}
set formatText(ev) {
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 = (o, e) => {
let outerArgs = new IgrFormatGroupTextEventArgs();
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);
;
}
}