igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
251 lines (250 loc) • 9.26 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 { __extends } from "tslib";
import { BaseVirtualDataProvider } from "./BaseVirtualDataProvider";
import { Base, Number_$type, runOn, String_$type, markType } from "./type";
import { PageRequestedEventArgs } from "./PageRequestedEventArgs";
import { FastIterationDictionary$2 } from "./FastIterationDictionary$2";
import { GenericPageResponse } from "./GenericPageResponse";
import { AsyncVirtualDataSourceProviderWorker } from "./AsyncVirtualDataSourceProviderWorker";
import { GenericVirtualDataProviderWorkerSettings } from "./GenericVirtualDataProviderWorkerSettings";
import { GenericVirtualDataProviderWorker } from "./GenericVirtualDataProviderWorker";
import { InvalidOperationException } from "./InvalidOperationException";
import { List$1 } from "./List$1";
import { Dictionary$2 } from "./Dictionary$2";
import { GenericSectionInformation } from "./GenericSectionInformation";
import { DefaultSummaryResult } from "./DefaultSummaryResult";
/**
* @hidden
*/
var GenericInternalVirtualDataProvider = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(GenericInternalVirtualDataProvider, _super);
function GenericInternalVirtualDataProvider() {
var _this = _super.call(this) || this;
_this.am = -1;
_this.al = -1;
_this.ak = new FastIterationDictionary$2(Number_$type, GenericPageResponse.$, 0);
_this.pageRequested = null;
return _this;
}
GenericInternalVirtualDataProvider.prototype.e = function () {
if (!this.q()) {
return null;
}
var a = this.c(null);
return new GenericVirtualDataProviderWorker(a);
};
GenericInternalVirtualDataProvider.prototype.c = function (a) {
var b = new GenericVirtualDataProviderWorkerSettings();
b.pageRequested = runOn(this, this.a8);
b.sortDescriptions = this.sortDescriptions;
b.groupDescriptions = this.groupDescriptions;
b.filterExpressions = this.filterExpressions;
b.summaryDescriptions = this.summaryDescriptions;
b.summaryScope = this.summaryScope;
return _super.prototype.c.call(this, b);
};
GenericInternalVirtualDataProvider.prototype.a8 = function (a, b, c, d) {
var _this = this;
this.executionContext.execute(function () {
var e = new GenericPageResponse();
e.h = a;
e.a = d;
e.i = _this.actualCount;
_this.ak.s(a, e);
if (_this.pageRequested != null) {
var f = new PageRequestedEventArgs();
f.a = b == AsyncVirtualDataSourceProviderWorker.ac;
f.e = a;
f.b = -1;
f.c = b;
f.d = c;
_this.pageRequested(_this, f);
}
});
};
GenericInternalVirtualDataProvider.prototype.ai = function () {
if (this.am == -1) {
throw new InvalidOperationException(1, "Must call FillPageStart before trying to fill a page.");
}
var a = this.ak.item(this.am);
if (a.c == null) {
a.c = new List$1(Dictionary$2.$.specialize(String_$type, Base.$), 0);
}
return a;
};
GenericInternalVirtualDataProvider.prototype.a7 = function (a) {
this.am = a;
if (!this.ak.d(this.am)) {
throw new InvalidOperationException(1, "The provided request ID is not valid.");
}
};
GenericInternalVirtualDataProvider.prototype.a6 = function () {
var a = this.ai();
if (a == null) {
return;
}
a.a.setResult(a);
this.am = -1;
};
GenericInternalVirtualDataProvider.prototype.ay = function (a) {
var b = this.ai();
if (b == null) {
return;
}
b.i = a;
};
GenericInternalVirtualDataProvider.prototype.at = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
for (var d = 0; d < b.length; d++) {
if (d >= c.c.count) {
c.c.add(new Dictionary$2(String_$type, Base.$, 0));
}
c.c._inner[d].item(a, b[d]);
}
};
GenericInternalVirtualDataProvider.prototype.aw = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
for (var d = 0; d < b.length; d++) {
if (d >= c.c.count) {
c.c.add(new Dictionary$2(String_$type, Base.$, 0));
}
c.c._inner[d].item(a, b[d]);
}
};
GenericInternalVirtualDataProvider.prototype.av = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
for (var d = 0; d < b.length; d++) {
if (d >= c.c.count) {
c.c.add(new Dictionary$2(String_$type, Base.$, 0));
}
c.c._inner[d].item(a, b[d]);
}
};
GenericInternalVirtualDataProvider.prototype.ax = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
for (var d = 0; d < b.length; d++) {
if (d >= c.c.count) {
c.c.add(new Dictionary$2(String_$type, Base.$, 0));
}
c.c._inner[d].item(a, b[d]);
}
};
GenericInternalVirtualDataProvider.prototype.au = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
for (var d = 0; d < b.length; d++) {
if (d >= c.c.count) {
c.c.add(new Dictionary$2(String_$type, Base.$, 0));
}
c.c._inner[d].item(a, b[d]);
}
};
GenericInternalVirtualDataProvider.prototype.an = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
c.e.add(a);
switch (b) {
case 0:
c.f.add(2);
break;
case 1:
c.f.add(1);
break;
case 2:
c.f.add(5);
break;
case 3:
c.f.add(8);
break;
case 4:
c.f.add(0);
break;
}
};
GenericInternalVirtualDataProvider.prototype.a0 = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
var d = new GenericSectionInformation();
d.startIndex = a;
d.endIndex = b;
c.b.add(d);
this.al = c.b.count - 1;
};
GenericInternalVirtualDataProvider.prototype.az = function () {
this.al = -1;
};
GenericInternalVirtualDataProvider.prototype.a4 = function (a, b) {
this.a1(a, b);
};
GenericInternalVirtualDataProvider.prototype.a3 = function (a, b) {
this.a1(a, b);
};
GenericInternalVirtualDataProvider.prototype.a5 = function (a, b) {
this.a1(a, b);
};
GenericInternalVirtualDataProvider.prototype.a2 = function (a, b) {
this.a1(a, b);
};
GenericInternalVirtualDataProvider.prototype.a1 = function (a, b) {
var c = this.ai();
if (c == null) {
return;
}
if (this.al == -1) {
throw new InvalidOperationException(1, "Must call FillGroupStart before trying to fill a group.");
}
var d = c.b._inner[this.al];
d.d(a, b);
};
GenericInternalVirtualDataProvider.prototype.ar = function (a, b, c) {
this.ao(a, b, c);
};
GenericInternalVirtualDataProvider.prototype.aq = function (a, b, c) {
this.ao(a, b, c);
};
GenericInternalVirtualDataProvider.prototype.as = function (a, b, c) {
this.ao(a, b, c);
};
GenericInternalVirtualDataProvider.prototype.ap = function (a, b, c) {
this.ao(a, b, c);
};
GenericInternalVirtualDataProvider.prototype.ao = function (a, b, c) {
var d = this.ai();
if (d == null) {
return;
}
if (this.al != -1) {
var e = d.b._inner[this.al];
e.e(new DefaultSummaryResult(a, b, c));
}
else {
d.g.add(new DefaultSummaryResult(a, b, c));
}
};
GenericInternalVirtualDataProvider.$t = markType(GenericInternalVirtualDataProvider, 'GenericInternalVirtualDataProvider', BaseVirtualDataProvider.$);
return GenericInternalVirtualDataProvider;
}(BaseVirtualDataProvider));
export { GenericInternalVirtualDataProvider };