igniteui-react-grids
Version:
Ignite UI React grid components.
129 lines (128 loc) • 3.73 kB
JavaScript
import { delegateCombine, delegateRemove } from "igniteui-react-core";
import { EditorType_$type } from "./EditorType";
import { IgrGridCustomFilterRequestedEventArgs } from "./igr-grid-custom-filter-requested-event-args";
import { FilterOperand as FilterOperand_internal } from "./FilterOperand";
import { ensureBool, ensureEnum } from "igniteui-react-core";
/**
* A filter operand.
*/
export class IgrFilterOperand {
createImplementation() {
return new FilterOperand_internal();
}
get nativeElement() {
return this._implementation.nativeElement;
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
onImplementationCreated() {
}
constructor() {
this.mounted = false;
this._filterRequested = null;
this._filterRequested_wrapped = null;
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();
}
}
/**
* Gets the FilterFactory to assists in building filters.
*/
get filterFactory() {
return this.i.a;
}
/**
* Gets or sets the ID of the filter. Must be unique from other filters in the column.
*/
get iD() {
return this.i.g;
}
set iD(v) {
this.i.g = v;
}
/**
* Gets or sets the name for display of this custom filter.
*/
get displayName() {
return this.i.e;
}
set displayName(v) {
this.i.e = v;
}
/**
* Gets or sets the SVG path to use for the operand icon in the filter cell.
*/
get icon() {
return this.i.f;
}
set icon(v) {
this.i.f = v;
}
/**
* Gets or sets whether this filter requires input.
*/
get isInputRequired() {
return this.i.d;
}
set isInputRequired(v) {
this.i.d = ensureBool(v);
}
/**
* The type of editor to use in the filter cell. Combo is not currently supported.
*/
get editorType() {
return this.i.b;
}
set editorType(v) {
this.i.b = ensureEnum(EditorType_$type, v);
}
findByName(name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
}
/**
* Gets or sets a function that returns a filter expression to use.
*/
get filterRequested() {
return this._filterRequested;
}
set filterRequested(ev) {
if (this._filterRequested_wrapped !== null) {
this.i.filterRequested = delegateRemove(this.i.filterRequested, this._filterRequested_wrapped);
this._filterRequested_wrapped = null;
this._filterRequested = null;
}
this._filterRequested = ev;
this._filterRequested_wrapped = (o, e) => {
let outerArgs = new IgrGridCustomFilterRequestedEventArgs();
outerArgs._provideImplementation(e);
if (this.beforeFilterRequested) {
this.beforeFilterRequested(this, outerArgs);
}
if (this._filterRequested) {
this._filterRequested(this, outerArgs);
}
};
this.i.filterRequested = delegateCombine(this.i.filterRequested, this._filterRequested_wrapped);
;
}
}