igniteui-react-grids
Version:
Ignite UI React grid components.
288 lines (287 loc) • 8.11 kB
JavaScript
import { IgrFilteringExpressionsTree } from "./igr-filtering-expressions-tree";
import { IgrPivotConfiguration } from "./igr-pivot-configuration";
import { GridStateInfoDetail as GridStateInfoDetail_internal } from "./GridStateInfoDetail";
import { interfaceToInternal, ensureBool } from "igniteui-react-core";
import { PagingState } from "./PagingState";
import { GroupingState } from "./GroupingState";
import { PinningConfig } from "./PinningConfig";
import { IgrGridStateCollection } from "./igr-grid-state-collection";
export class IgrGridStateInfoDetail {
createImplementation() {
return new GridStateInfoDetail_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 columns() {
if (!this.i.b) {
return undefined;
}
let ret = [];
for (let i = 0; i < this.i.b.length; i++) {
let impl = this.i.b[i];
ret.push(impl.nativeElement);
}
return ret;
}
set columns(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i]);
}
this.i.b = arr;
}
get filtering() {
const r = this.i.j;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrFilteringExpressionsTree();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set filtering(v) {
v == null ? this.i.j = null : this.i.j = v.i;
}
get advancedFiltering() {
const r = this.i.i;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrFilteringExpressionsTree();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set advancedFiltering(v) {
v == null ? this.i.i = null : this.i.i = v.i;
}
get paging() {
return this.i.l.nativeElement;
}
set paging(v) {
this.i.l = interfaceToInternal(v, () => new PagingState());
}
get moving() {
return this.i.q;
}
set moving(v) {
this.i.q = ensureBool(v);
}
get sorting() {
if (!this.i.h) {
return undefined;
}
let ret = [];
for (let i = 0; i < this.i.h.length; i++) {
let impl = this.i.h[i];
ret.push(impl.nativeElement);
}
return ret;
}
set sorting(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i]);
}
this.i.h = arr;
}
get groupBy() {
return this.i.k.nativeElement;
}
set groupBy(v) {
this.i.k = interfaceToInternal(v, () => new GroupingState());
}
get cellSelection() {
if (!this.i.a) {
return undefined;
}
let ret = [];
for (let i = 0; i < this.i.a.length; i++) {
let impl = this.i.a[i];
ret.push(impl.nativeElement);
}
return ret;
}
set cellSelection(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i]);
}
this.i.a = arr;
}
get rowSelection() {
return this.i.g;
}
set rowSelection(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.g = v;
}
get columnSelection() {
return this.i.c;
}
set columnSelection(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.c = v;
}
get rowPinning() {
return this.i.f;
}
set rowPinning(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.f = v;
}
get pinningConfig() {
return this.i.m.nativeElement;
}
set pinningConfig(v) {
this.i.m = interfaceToInternal(v, () => new PinningConfig());
}
get expansion() {
return this.i.d;
}
set expansion(v) {
if (v && !Array.isArray(v) && typeof (v) == "string") {
const re = /\s*(?:,|\s|$)\s*/gm;
v = v.split(re);
}
this.i.d = v;
}
get rowIslands() {
if (!this.i.e) {
return undefined;
}
let ret = [];
for (let i = 0; i < this.i.e.length; i++) {
let impl = this.i.e[i];
if (!impl.externalObject) {
if (impl instanceof IgrGridStateCollection) {
ret.push(impl);
continue;
}
let e = new IgrGridStateCollection();
e._implementation = impl;
impl.externalObject = e;
}
ret.push(impl.externalObject);
}
return ret;
}
set rowIslands(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i].i);
}
this.i.e = arr;
}
get id() {
return this.i.t;
}
set id(v) {
this.i.t = v;
}
get pivotConfiguration() {
const r = this.i.n;
if (r == null) {
return null;
}
if (!r.externalObject) {
let e = new IgrPivotConfiguration();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
}
set pivotConfiguration(v) {
v == null ? this.i.n = null : this.i.n = v.i;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.filtering && this.filtering.name && this.filtering.name == name) {
return this.filtering;
}
if (this.advancedFiltering && this.advancedFiltering.name && this.advancedFiltering.name == name) {
return this.advancedFiltering;
}
if (this.paging && this.paging.name && this.paging.name == name) {
return this.paging;
}
if (this.groupBy && this.groupBy.name && this.groupBy.name == name) {
return this.groupBy;
}
if (this.pinningConfig && this.pinningConfig.name && this.pinningConfig.name == name) {
return this.pinningConfig;
}
if (this.pivotConfiguration && this.pivotConfiguration.name && this.pivotConfiguration.name == name) {
return this.pivotConfiguration;
}
return null;
}
setNativeElement(element) {
this.i.setNativeElement(element);
}
}