igniteui-react-grids
Version:
Ignite UI React grid components.
158 lines (157 loc) • 4.26 kB
JavaScript
import { IgrColumn } from "./igr-column";
import { GroupByRecord as GroupByRecord_internal } from "./GroupByRecord";
import { interfaceToInternal } from "igniteui-react-core";
import { SortingExpression } from "./SortingExpression";
export class IgrGroupByRecord {
createImplementation() {
return new GroupByRecord_internal();
}
get nativeElement() {
return this._implementation.nativeElement;
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
onImplementationCreated() {
}
constructor() {
this.mounted = false;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
_provideImplementation(i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
get expression() {
return this.i.e.nativeElement;
}
set expression(v) {
this.i.e = interfaceToInternal(v, () => new SortingExpression());
}
get level() {
return this.i.i;
}
set level(v) {
this.i.i = +v;
}
get records() {
return this.i.b;
}
set records(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.b = v;
}
get value() {
return this.i.l;
}
set value(v) {
this.i.l = v;
}
get groupParent() {
const r = this.i.d;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrGroupByRecord();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set groupParent(v) {
v == null ? this.i.d = null : this.i.d = v.i;
}
get groups() {
if (!this.i.a) {
return undefined;
}
let ret = [];
for (let i = 0; i < this.i.a.length; i++) {
let impl = this.i.a[i];
if (!impl.externalObject) {
if (impl instanceof IgrGroupByRecord) {
ret.push(impl);
continue;
}
let e = new IgrGroupByRecord();
e._implementation = impl;
impl.externalObject = e;
}
ret.push(impl.externalObject);
}
return ret;
}
set groups(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i].i);
}
this.i.a = arr;
}
get height() {
return this.i.h;
}
set height(v) {
this.i.h = +v;
}
get column() {
const r = this.i.c;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = IgrColumn._createFromInternal(r);
if (e) {
e._implementation = r;
}
r.externalObject = e;
}
return r.externalObject;
}
set column(v) {
v == null ? this.i.c = null : this.i.c = v.i;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.expression && this.expression.name && this.expression.name == name) {
return this.expression;
}
if (this.groupParent && this.groupParent.name && this.groupParent.name == name) {
return this.groupParent;
}
if (this.column && this.column.name && this.column.name == name) {
return this.column;
}
return null;
}
setNativeElement(element) {
this.i.setNativeElement(element);
}
}