UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

157 lines (156 loc) 6.43 kB
/* 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 { AsyncVirtualDataSourceProviderWorker } from "./AsyncVirtualDataSourceProviderWorker"; import { Base, runOn, markType } from "./type"; import { AsyncVirtualDataTaskCompletionSource } from "./AsyncVirtualDataTaskCompletionSource"; import { AsyncVirtualDataTask } from "./AsyncVirtualDataTask"; import { AsyncDataSourcePageTaskHolder } from "./AsyncDataSourcePageTaskHolder"; import { DefaultDataSourceSchema } from "./DefaultDataSourceSchema"; import { GenericDataSourcePage } from "./GenericDataSourcePage"; /** * @hidden */ export let GenericVirtualDataProviderWorker = /*@__PURE__*/ (() => { class GenericVirtualDataProviderWorker extends AsyncVirtualDataSourceProviderWorker { constructor(a) { super(a); this.au = null; this.av = null; this.ay = null; this._sortDescriptions = null; this._groupDescriptions = null; this._summaryDescriptions = null; this._filterExpressions = null; this._summaryScope = 0; this.ay = a.pageRequested; this.executionContext.enqueueAction(runOn(this, this.doWork)); this.sortDescriptions = a.sortDescriptions; this.groupDescriptions = a.groupDescriptions; this.filterExpressions = a.filterExpressions; this.summaryDescriptions = a.summaryDescriptions; this.summaryScope = a.summaryScope; } get sortDescriptions() { return this._sortDescriptions; } set sortDescriptions(a) { this._sortDescriptions = a; } get groupDescriptions() { return this._groupDescriptions; } set groupDescriptions(a) { this._groupDescriptions = a; } get summaryDescriptions() { return this._summaryDescriptions; } set summaryDescriptions(a) { this._summaryDescriptions = a; } get filterExpressions() { return this._filterExpressions; } set filterExpressions(a) { this._filterExpressions = a; } get summaryScope() { return this._summaryScope; } set summaryScope(a) { this._summaryScope = a; } makeTaskForRequest(a, b) { let c = 0; c = this.actualPageSize; let d = a.id; let e = a.index; let f; f = new AsyncVirtualDataTask(); f.run = () => { let g = new AsyncVirtualDataTaskCompletionSource(Base.$); g.task = f; this.ay(d, e, c, g); }; a.taskHolder = new AsyncDataSourcePageTaskHolder(); a.taskHolder.task = f; this.tasks.add(a); } processCompletedTask(a, b, c, d) { let e = null; try { e = a.task.result; } catch (f) { this.retryIndex(c, b); return; } if (c == AsyncVirtualDataSourceProviderWorker.ac && e.e.count == 0) { this.retryIndex(c, b); return; } if (e.i > -1) { this.actualCount = e.i; } let g = this.actualSchema; if (g == null && e.e.count > 0) { g = new DefaultDataSourceSchema(e.e.toArray(), e.f.toArray(), e.d.toArray(), null, null); this.actualSchema = g; } if (this.au == null) { if (this.groupDescriptions.k.count > 0 && e.b.count > 0) { this.au = e.b.toArray(); } } if (this.av == null) { if (this.summaryDescriptions.k.count > 0 && e.g.count > 0) { this.av = e.g.toArray(); } } this.a2(a.task, c, g, e); } a2(a, b, c, d) { if (d != null) { let e = null; if (d.c != null) { e = new GenericDataSourcePage(d.c, c, this.au, this.av, b); if (!this.isLastPage(b) && e.count() > 0 && !this.populatedActualPageSize) { this.populatedActualPageSize = true; this.actualPageSize = e.count(); } } else { e = new GenericDataSourcePage(null, c, this.au, this.av, b); } if (this.pageLoaded != null) { if (this.executionContext != null) { if (this.executionContext == null || this.pageLoaded == null) { this.shutdown(); return; } this.executionContext.execute(() => { if (this.pageLoaded == null) { this.shutdown(); return; } this.pageLoaded(e, this.actualCount, this.actualPageSize); }); } else { if (this.pageLoaded == null) { this.shutdown(); return; } this.pageLoaded(e, this.actualCount, this.actualPageSize); } } } } } GenericVirtualDataProviderWorker.$t = markType(GenericVirtualDataProviderWorker, 'GenericVirtualDataProviderWorker', AsyncVirtualDataSourceProviderWorker.$); return GenericVirtualDataProviderWorker; })();