igniteui-react-grids
Version:
Ignite UI React grid components.
129 lines (125 loc) • 3.5 kB
JavaScript
import { IgcFilteringOperand } from "./../../grids/combined";
import { FilteringOperand as FilteringOperand_internal } from "./FilteringOperand";
import { interfaceToInternal } from "igniteui-react-core";
import { FilteringOperation } from "./FilteringOperation";
/**
* Provides base filtering operations
* Implementations should be Singleton
* @export
*/
export class IgrFilteringOperand {
createImplementation() {
let impl = new FilteringOperand_internal();
if (impl.setNativeElement) {
impl.setNativeElement(new IgcFilteringOperand());
}
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 operations() {
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 operations(v) {
let arr = [];
for (let i = 0; i < v.length; i++) {
arr.push(v[i]);
}
this.i.b = arr;
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
setNativeElement(element) {
this.i.setNativeElement(element);
}
instance() {
let iv = this.i.c();
let ret = null;
if (iv && iv.externalObject) {
ret = iv.externalObject;
}
else {
if (iv) {
let e = new IgrFilteringOperand();
e._implementation = iv;
iv.externalObject = e;
ret = e;
}
}
return ret;
}
/**
* Returns an array of names of the conditions which are visible in the UI
*/
conditionList() {
let iv = this.i.a();
return (iv);
}
/**
* Returns an instance of the condition with the specified name.
* name The name of the condition.
* @param name * The name of the condition.
*/
condition(name) {
let iv = this.i.d(name);
let ret = null;
if (iv && iv.externalObject) {
ret = iv.externalObject;
}
else {
if (iv) {
ret = iv.nativeElement;
delete ret.externalObject;
}
}
return ret;
}
/**
* Adds a new condition to the filtering operations.
* operation The filtering operation.
* @param operation * The filtering operation.
*/
append(operation) {
this.i.i((operation == null ? null : interfaceToInternal(operation, () => new FilteringOperation())));
}
}