igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
399 lines (398 loc) • 12.1 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { Base, Number_$type, runOn, markType } from "./type";
import { IDataSourceVirtualDataProvider_$type } from "./IDataSourceVirtualDataProvider";
import { SortDescriptionCollection } from "./SortDescriptionCollection";
import { SummaryDescriptionCollection } from "./SummaryDescriptionCollection";
import { FilterExpressionCollection } from "./FilterExpressionCollection";
import { LinkedList$1 } from "./LinkedList$1";
import { AsyncVirtualDataSourceProviderWorker } from "./AsyncVirtualDataSourceProviderWorker";
import { DataSourceDataProviderSchemaChangedEventArgs } from "./DataSourceDataProviderSchemaChangedEventArgs";
import { stringContains } from "./string";
/**
* @hidden
*/
export let BaseVirtualDataProvider = /*@__PURE__*/ (() => {
class BaseVirtualDataProvider extends Base {
constructor() {
super();
this.d = null;
this.r = new LinkedList$1(Number_$type);
this.f = null;
this.l = null;
this.k = null;
this.h = null;
this.m = null;
this.s = 0;
this.j = null;
this.g = null;
this.t = 50;
this.schemaChanged = null;
this.i = null;
this._updateNotifier = null;
this.o = false;
this.a = null;
this.b = null;
this._summaryScope = 0;
this.p = false;
this.n = false;
this._batchCompleted = null;
this.l = new SortDescriptionCollection();
this.l.n(runOn(this, this.w));
this.k = new SortDescriptionCollection();
this.k.n(runOn(this, this.v));
this.h = new FilterExpressionCollection();
this.h.n(runOn(this, this.u));
this.m = new SummaryDescriptionCollection();
this.m.n(runOn(this, this.x));
}
x(a, b) {
this.queueAutoRefresh();
}
u(a, b) {
this.queueAutoRefresh();
}
v(a, b) {
this.queueAutoRefresh();
}
w(a, b) {
this.queueAutoRefresh();
}
addPageRequest(a, b) {
if (this.deferAutoRefresh) {
return;
}
if (this.d != null && this.d.isShutdown) {
this.d = null;
this.f = null;
}
if (this.d == null) {
this.f = runOn(this, this.ad);
this.d = this.e();
}
if (b == 2) {
this.r.e(a);
}
else {
this.r.f(a);
}
if (!this.d.addPageRequest(a, b)) {
this.d = null;
this.f = null;
this.addPageRequest(a, b);
}
}
c(a) {
if (a != null) {
a.pageSizeRequested = this.t;
a.pageLoaded = this.f;
a.executionContext = this.i;
}
return a;
}
ab() {
if (!this.q()) {
return;
}
this.f = runOn(this, this.ad);
let a = this.c(null);
this.d = this.e();
}
q() {
return true;
}
removePageRequest(a) {
let b = this.r.c;
while (b != null) {
if (b.c == a) {
this.r.h(b);
}
b = b.a;
}
if (this.d == null) {
return;
}
this.d.removePageRequest(a);
}
removeAllPageRequests() {
this.r.g();
if (this.d == null) {
return;
}
this.d.removeAllPageRequests();
}
close() {
if (this.d != null) {
this.d.shutdown();
this.d = null;
this.f = null;
}
}
get pageLoaded() {
return this.g;
}
set pageLoaded(a) {
this.g = a;
this.queueAutoRefresh();
}
ad(a, b, c) {
if (this.pageLoaded != null) {
this.s = b;
if (this.j == null) {
let d = null;
if (a != null) {
d = a.schema();
}
this.j = d;
if (this.schemaChanged != null) {
this.schemaChanged(this, new DataSourceDataProviderSchemaChangedEventArgs(this.j, this.s));
}
}
if (a.pageIndex() != AsyncVirtualDataSourceProviderWorker.ac) {
this.pageLoaded(a, b, c);
}
}
}
get pageSizeRequested() {
return this.t;
}
set pageSizeRequested(a) {
this.t = a;
this.queueAutoRefresh();
}
getItemValue(a, b) {
let c = a;
if (c.containsKey(b)) {
return c.item(b);
}
return null;
}
get actualCount() {
return this.s;
}
get actualSchema() {
return this.j;
}
get executionContext() {
return this.i;
}
set executionContext(a) {
this.i = a;
this.queueAutoRefresh();
}
get updateNotifier() {
return this._updateNotifier;
}
set updateNotifier(a) {
this._updateNotifier = a;
}
get deferAutoRefresh() {
return this.o;
}
set deferAutoRefresh(a) {
this.o = a;
if (!this.o) {
this.queueAutoRefresh();
}
if (this.o && this.q() && this.j == null) {
this.queueAutoRefresh();
}
}
get_isSortingSupported() {
return true;
}
get isSortingSupported() {
return this.get_isSortingSupported();
}
get_isGroupingSupported() {
return true;
}
get isGroupingSupported() {
return this.get_isGroupingSupported();
}
get_isFilteringSupported() {
return true;
}
get isFilteringSupported() {
return this.get_isFilteringSupported();
}
get sortDescriptions() {
return this.l;
}
get groupDescriptions() {
return this.k;
}
get summaryDescriptions() {
return this.m;
}
get filterExpressions() {
return this.h;
}
get propertiesRequested() {
return this.a;
}
set propertiesRequested(a) {
this.a = a;
this.queueAutoRefresh();
}
get schemaIncludedProperties() {
return this.b;
}
set schemaIncludedProperties(a) {
this.b = a;
this.queueAutoRefresh();
}
get summaryScope() {
return this._summaryScope;
}
set summaryScope(a) {
this._summaryScope = a;
}
get notifyUsingSourceIndexes() {
return true;
}
get isItemIndexLookupSupported() {
return false;
}
get isKeyIndexLookupSupported() {
return false;
}
notifyClearItems() {
if (this.updateNotifier != null) {
this.updateNotifier.notifyClearItems();
}
}
notifyInsertItem(a, b) {
if (this.updateNotifier != null) {
this.updateNotifier.notifyInsertItem(a, b);
}
}
notifyRemoveItem(a, b) {
if (this.updateNotifier != null) {
this.updateNotifier.notifyRemoveItem(a, b);
}
}
notifySetItem(a, b, c) {
if (this.updateNotifier != null) {
this.updateNotifier.notifySetItem(a, b, c);
}
}
ac() {
if (this.p) {
return;
}
if (this.executionContext != null) {
this.p = true;
this.executionContext.enqueueAction(runOn(this, this.aa));
}
}
aa() {
if (!this.p) {
return;
}
this.p = false;
this.ag();
}
ag() {
this.ah();
}
ah() {
this.removeAllPageRequests();
this.close();
this.ab();
this.y();
}
y() {
if (this.d != null) {
this.d.addPageRequest(AsyncVirtualDataSourceProviderWorker.ac, 2);
}
}
queueAutoRefresh() {
if (this.deferAutoRefresh) {
return;
}
if (this.n) {
return;
}
if (this.executionContext != null) {
this.n = true;
this.executionContext.enqueueAction(runOn(this, this.z));
}
}
z() {
if (this.deferAutoRefresh) {
this.n = false;
return;
}
if (!this.n) {
return;
}
this.n = false;
this.ae();
}
ae() {
this.af();
}
af() {
this.removeAllPageRequests();
this.close();
this.ab();
if (this.actualSchema == null) {
this.d.addPageRequest(AsyncVirtualDataSourceProviderWorker.ac, 2);
}
else {
this.d.addPageRequest(0, 1);
}
}
flushAutoRefresh() {
this.z();
}
refresh() {
this.ae();
}
indexOfItem(a) {
return -1;
}
indexOfKey(a) {
return -1;
}
resolveSchemaPropertyType(a) {
if (this.actualSchema == null) {
return 11;
}
if (stringContains(a, ".")) {
return 11;
}
for (let b = 0; b < this.actualSchema.propertyNames.length; b++) {
let c = this.actualSchema.propertyNames[b];
if (c == a) {
return this.actualSchema.propertyTypes[b];
}
}
return 11;
}
setItemValue(a, b, c) {
}
removeItem(a) {
}
addItem(a) {
}
createBatchRequest(a) {
if (this.d != null) {
this.d.createBatchRequest(a);
}
}
get batchCompleted() {
return this._batchCompleted;
}
set batchCompleted(a) {
this._batchCompleted = a;
}
}
BaseVirtualDataProvider.$t = markType(BaseVirtualDataProvider, 'BaseVirtualDataProvider', Base.$, [IDataSourceVirtualDataProvider_$type]);
return BaseVirtualDataProvider;
})();