igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
120 lines (115 loc) • 4.18 kB
JavaScript
import { EventEmitter } from '@angular/core';
import { delegateCombine } from './type';
import { IgxPageRequestedEventArgs } from "./igx-page-requested-event-args";
import { GenericDataSourceSchemaPropertyType_$type } from "./GenericDataSourceSchemaPropertyType";
import { DataSourceSummaryOperand_$type } from "./DataSourceSummaryOperand";
import { IgxBaseGenericDataSource } from "./igx-base-generic-data-source";
import { GenericVirtualDataSource as GenericVirtualDataSource_internal } from "./GenericVirtualDataSource";
import { ensureEnum } from "./componentUtil";
export class IgxGenericVirtualDataSource extends IgxBaseGenericDataSource {
constructor() {
super();
this._pageRequested = null;
}
createImplementation() {
return new GenericVirtualDataSource_internal();
}
/**
* @hidden
*/
get i() {
return this._implementation;
}
/**
* Starts filling a page for the specified request. Must later be followed by FillPageEnd to complete the request.
* @param requestId * The ID of the requested page.
*/
fillPageStart(requestId) {
this.i.a0(requestId);
}
/**
* Ends the current page. Must be called after FillPageStart.
*/
fillPageEnd() {
this.i.az();
}
/**
* Provides the row count for the datasource. The datasource obtains this from the page request so be must be called
* after FillPageStart.
* @param count * The row count.
*/
fillCount(count) {
this.i.as(count);
}
fillColumnBool(column, values) {
this.i.an(column, values);
}
fillColumnInt(column, values) {
this.i.aq(column, values);
}
fillColumnDouble(column, values) {
this.i.ap(column, values);
}
fillColumnString(column, values) {
this.i.ar(column, values);
}
fillColumnDate(column, values) {
this.i.ao(column, values);
}
addSchemaProperty(propertyName, propertyType) {
this.i.ai(propertyName, ensureEnum(GenericDataSourceSchemaPropertyType_$type, propertyType));
}
fillGroupStart(startIndex, endIndex) {
this.i.au(startIndex, endIndex);
}
/**
* Ends the current group.
*/
fillGroupEnd() {
this.i.at();
}
fillGroupValueInt(propertyName, value) {
this.i.ax(propertyName, value);
}
fillGroupValueDouble(propertyName, value) {
this.i.aw(propertyName, value);
}
fillGroupValueString(propertyName, value) {
this.i.ay(propertyName, value);
}
fillGroupValueDate(propertyName, value) {
this.i.av(propertyName, value);
}
addSummaryInt(propertyName, operand, value) {
this.i.al(propertyName, ensureEnum(DataSourceSummaryOperand_$type, operand), value);
}
addSummaryDouble(propertyName, operand, value) {
this.i.ak(propertyName, ensureEnum(DataSourceSummaryOperand_$type, operand), value);
}
addSummaryString(propertyName, operand, value) {
this.i.am(propertyName, ensureEnum(DataSourceSummaryOperand_$type, operand), value);
}
addSummaryDate(propertyName, operand, value) {
this.i.aj(propertyName, ensureEnum(DataSourceSummaryOperand_$type, operand), value);
}
/**
* Raised when the datasource requests page data.
*/
get pageRequested() {
if (this._pageRequested == null) {
this._pageRequested = new EventEmitter();
this.i.pageRequested = delegateCombine(this.i.pageRequested, (o, e) => {
let outerArgs = new IgxPageRequestedEventArgs();
outerArgs._provideImplementation(e);
if (this.beforePageRequested) {
this.beforePageRequested(this, outerArgs);
}
this._pageRequested.emit({
sender: this,
args: outerArgs
});
});
}
return this._pageRequested;
}
}