igniteui-react-grids
Version:
Ignite UI React grid components.
116 lines (115 loc) • 3.25 kB
JavaScript
import { ensureBool } from "igniteui-react-core";
import { IgrColumnSortDescription } from "./igr-column-sort-description";
import { ColumnSortDescriptionCollection as ColumnSortDescriptionCollection_internal } from "./ColumnSortDescriptionCollection";
/**
* Represents a collection of sort elements that are applied to a data source or provider.
*/
export class IgrColumnSortDescriptionCollection {
createImplementation() {
return new ColumnSortDescriptionCollection_internal();
}
get i() {
return this._implementation;
}
onImplementationCreated() {
}
constructor() {
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
}
_provideImplementation(i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
}
item(index, value) {
let int = null;
if (value !== undefined) {
int = this.i.set(index, value == null ? null : value.i);
}
else {
int = this.i.get(index);
}
let ext = null;
if (int != null) {
ext = int.externalObject;
if (!ext) {
ext = new IgrColumnSortDescription();
ext._implementation = int;
int.externalObject = ext;
}
}
return ext;
}
get count() {
return this.i.size();
}
toArray() {
let arr = [];
for (let i = 0; i < this.count; i++) {
arr[i] = this.item(i);
}
return arr;
}
*[Symbol.iterator]() {
for (let i = 0; i < this.count; i++) {
let item = this.item(i);
if (item.externalObject) {
item = item.externalObject;
}
yield item;
}
}
/**
* Gets or sets whether this collection should detach the sync when the target collection changes.
*/
get shouldDetachOnTargetChange() {
return this.i.i;
}
set shouldDetachOnTargetChange(v) {
this.i.i = ensureBool(v);
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
add(item) {
let iv = this.i.g((item == null ? null : item.i));
return (iv);
}
insert(index, item) {
this.i.o(index, (item == null ? null : item.i));
}
clear() {
this.i.n();
}
indexOf(item) {
let iv = this.i.k((item == null ? null : item.i));
return (iv);
}
remove(item) {
let iv = this.i.h((item == null ? null : item.i));
return (iv);
}
removeAt(index) {
let iv = this.i.d(index);
let ret = null;
if (iv && iv.externalObject) {
ret = iv.externalObject;
}
else {
if (iv) {
let e = new IgrColumnSortDescription();
e._implementation = iv;
iv.externalObject = e;
ret = e;
}
}
return ret;
}
}