igniteui-react-grids
Version:
Ignite UI React grid components.
133 lines (132 loc) • 3.38 kB
JavaScript
import { TreeGridRecord as TreeGridRecord_internal } from "./TreeGridRecord";
import { ensureBool } from "igniteui-react-core";
export class IgrTreeGridRecord {
createImplementation() {
let impl = new TreeGridRecord_internal();
if (impl.setNativeElement) {
impl.setNativeElement({});
}
return impl;
}
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 key() {
return this.i.j;
}
set key(v) {
this.i.j = v;
}
get data() {
return this.i.i;
}
set data(v) {
this.i.i = v;
}
get children() {
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 IgrTreeGridRecord) {
ret.push(impl);
continue;
}
let e = new IgrTreeGridRecord();
e._implementation = impl;
impl.externalObject = e;
}
ret.push(impl.externalObject);
}
return ret;
}
set children(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i].i);
}
this.i.a = arr;
}
get parent() {
const r = this.i.b;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrTreeGridRecord();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set parent(v) {
v == null ? this.i.b = null : this.i.b = v.i;
}
get level() {
return this.i.g;
}
set level(v) {
this.i.g = +v;
}
get isFilteredOutParent() {
return this.i.f;
}
set isFilteredOutParent(v) {
this.i.f = ensureBool(v);
}
get expanded() {
return this.i.e;
}
set expanded(v) {
this.i.e = ensureBool(v);
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.parent && this.parent.name && this.parent.name == name) {
return this.parent;
}
return null;
}
setNativeElement(element) {
this.i.setNativeElement(element);
}
}