UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

181 lines (180 loc) 7.21 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 { __extends } from "tslib"; 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 */ var GenericVirtualDataProviderWorker = /** @class */ /*@__PURE__*/ (function (_super) { __extends(GenericVirtualDataProviderWorker, _super); function GenericVirtualDataProviderWorker(a) { var _this = _super.call(this, a) || this; _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; return _this; } Object.defineProperty(GenericVirtualDataProviderWorker.prototype, "sortDescriptions", { get: function () { return this._sortDescriptions; }, set: function (a) { this._sortDescriptions = a; }, enumerable: false, configurable: true }); Object.defineProperty(GenericVirtualDataProviderWorker.prototype, "groupDescriptions", { get: function () { return this._groupDescriptions; }, set: function (a) { this._groupDescriptions = a; }, enumerable: false, configurable: true }); Object.defineProperty(GenericVirtualDataProviderWorker.prototype, "summaryDescriptions", { get: function () { return this._summaryDescriptions; }, set: function (a) { this._summaryDescriptions = a; }, enumerable: false, configurable: true }); Object.defineProperty(GenericVirtualDataProviderWorker.prototype, "filterExpressions", { get: function () { return this._filterExpressions; }, set: function (a) { this._filterExpressions = a; }, enumerable: false, configurable: true }); Object.defineProperty(GenericVirtualDataProviderWorker.prototype, "summaryScope", { get: function () { return this._summaryScope; }, set: function (a) { this._summaryScope = a; }, enumerable: false, configurable: true }); GenericVirtualDataProviderWorker.prototype.makeTaskForRequest = function (a, b) { var _this = this; var c = 0; c = this.actualPageSize; var d = a.id; var e = a.index; var f; f = new AsyncVirtualDataTask(); f.run = function () { var 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); }; GenericVirtualDataProviderWorker.prototype.processCompletedTask = function (a, b, c, d) { var 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; } var 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); }; GenericVirtualDataProviderWorker.prototype.a2 = function (a, b, c, d) { var _this = this; if (d != null) { var e_1 = null; if (d.c != null) { e_1 = new GenericDataSourcePage(d.c, c, this.au, this.av, b); if (!this.isLastPage(b) && e_1.count() > 0 && !this.populatedActualPageSize) { this.populatedActualPageSize = true; this.actualPageSize = e_1.count(); } } else { e_1 = 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(function () { if (_this.pageLoaded == null) { _this.shutdown(); return; } _this.pageLoaded(e_1, _this.actualCount, _this.actualPageSize); }); } else { if (this.pageLoaded == null) { this.shutdown(); return; } this.pageLoaded(e_1, this.actualCount, this.actualPageSize); } } } }; GenericVirtualDataProviderWorker.$t = markType(GenericVirtualDataProviderWorker, 'GenericVirtualDataProviderWorker', AsyncVirtualDataSourceProviderWorker.$); return GenericVirtualDataProviderWorker; }(AsyncVirtualDataSourceProviderWorker)); export { GenericVirtualDataProviderWorker };