igniteui-react-core
Version:
Ignite UI React Core.
708 lines (707 loc) • 24.3 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, __values } from "tslib";
import { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, delegateRemove, String_$type, fromEnum, Number_$type, Array_$type, markType } from "./type";
import { IDataSourceLocalDataProvider_$type } from "./IDataSourceLocalDataProvider";
import { DataSourceLocalDataProvider } from "./DataSourceLocalDataProvider";
import { List$1 } from "./List$1";
import { SummaryDescription } from "./SummaryDescription";
import { Tuple$2 } from "./Tuple$2";
import { AggregatedDataProviderLayerMap } from "./AggregatedDataProviderLayerMap";
import { AggregatedDataProviderLayerInfo } from "./AggregatedDataProviderLayerInfo";
import { IDataSourceUpdateNotifier_$type } from "./IDataSourceUpdateNotifier";
/**
* @hidden
*/
var AggregatedDataProvider = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(AggregatedDataProvider, _super);
function AggregatedDataProvider() {
var _this = _super.call(this) || this;
_this.g = new DataSourceLocalDataProvider();
_this.c = null;
_this.r = null;
_this.j = false;
_this.q = null;
_this.i = false;
_this.schemaChanged = null;
_this.propertyChanged = null;
_this.h = false;
_this.k = true;
_this.o = new List$1(String_$type, 0);
var a = _this.g;
a.schemaChanged = delegateCombine(a.schemaChanged, runOn(_this, _this.ab));
return _this;
}
AggregatedDataProvider.prototype.clone = function () {
var a = new AggregatedDataProvider();
a.deferAutoRefresh = this.deferAutoRefresh;
a.executionContext = this.executionContext;
a.dataSource = this.dataSource;
a.propertiesRequested = this.propertiesRequested;
a.schemaHints = this.schemaHints;
a.summaryScope = this.summaryScope;
a.includeParentSummary = this.includeParentSummary;
if (this.targetDataSource != null) {
a.targetDataSource = this.targetDataSource.clone();
}
for (var b = 0; b < this.groupDescriptions.k.count; b++) {
a.groupDescriptions.add(this.groupDescriptions.k.item(b));
}
for (var c = 0; c < this.sortDescriptions.k.count; c++) {
a.sortDescriptions.add(this.sortDescriptions.k.item(c));
}
for (var d = 0; d < this.filterExpressions.k.count; d++) {
a.filterExpressions.add(this.filterExpressions.k.item(d));
}
for (var e = 0; e < this.summaryDescriptions.k.count; e++) {
a.summaryDescriptions.add(this.summaryDescriptions.k.item(e));
}
return a;
};
AggregatedDataProvider.prototype.ab = function (a, b) {
if (this.schemaChanged != null) {
this.schemaChanged(this, b);
}
};
Object.defineProperty(AggregatedDataProvider.prototype, "targetDataSource", {
get: function () {
return this.c;
},
set: function (a) {
var b = this.c;
this.c = a;
if (b != this.c) {
this.ai("TargetDataSource", b, this.c);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "schemaHints", {
get: function () {
return this.r;
},
set: function (a) {
var b = this.r;
this.r = a;
if (b != this.r) {
this.ai("SchemaHints", b, this.r);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "includeParentSummary", {
get: function () {
return this.j;
},
set: function (a) {
var b = this.j;
this.j = a;
if (b != this.j) {
this.ai("IncludeParentSummary", b, this.r);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "actualSchema", {
get: function () {
return this.g.actualSchema;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "executionContext", {
get: function () {
return this.g.executionContext;
},
set: function (a) {
this.g.executionContext = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "updateNotifier", {
get: function () {
return this.g.updateNotifier;
},
set: function (a) {
this.g.updateNotifier = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "dataSource", {
get: function () {
return this.q;
},
set: function (a) {
var b = this.q;
this.q = a;
if (b != this.q) {
this.ai("ItemsSource", b, this.q);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "deferAutoRefresh", {
get: function () {
return this.i;
},
set: function (a) {
var b = this.i;
this.i = a;
if (b != this.i) {
this.ai("DeferAutoRefresh", b, this.i);
}
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "isSortingSupported", {
get: function () {
return this.g.isSortingSupported;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "isGroupingSupported", {
get: function () {
return this.g.isGroupingSupported;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "isFilteringSupported", {
get: function () {
return this.g.isFilteringSupported;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "sortDescriptions", {
get: function () {
return this.g.sortDescriptions;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "groupDescriptions", {
get: function () {
return this.g.groupDescriptions;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "summaryDescriptions", {
get: function () {
return this.g.summaryDescriptions;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "summaryScope", {
get: function () {
return this.g.summaryScope;
},
set: function (a) {
this.g.summaryScope = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "filterExpressions", {
get: function () {
return this.g.filterExpressions;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "propertiesRequested", {
get: function () {
return this.g.propertiesRequested;
},
set: function (a) {
this.g.propertiesRequested = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "schemaIncludedProperties", {
get: function () {
return this.g.schemaIncludedProperties;
},
set: function (a) {
this.g.schemaIncludedProperties = a;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "notifyUsingSourceIndexes", {
get: function () {
return true;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "isItemIndexLookupSupported", {
get: function () {
return this.g.isItemIndexLookupSupported;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "isKeyIndexLookupSupported", {
get: function () {
return this.g.isKeyIndexLookupSupported;
},
enumerable: false,
configurable: true
});
Object.defineProperty(AggregatedDataProvider.prototype, "actualCount", {
get: function () {
return this.g.actualCount;
},
enumerable: false,
configurable: true
});
AggregatedDataProvider.prototype.ai = function (a, b, c) {
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
this.ao(a, b, c);
};
AggregatedDataProvider.prototype.ao = function (a, b, c) {
switch (a) {
case "ItemsSource":
this.g.dataSource = c;
break;
case "DeferAutoRefresh":
if (!c) {
this.queueAutoRefresh();
}
break;
case "TargetDataSource":
if (b != null) {
var d = b;
if (d.updateNotifier != null) {
if (typeCast(AggregatedDataProviderTargetDataSourceNotifier.$, d.updateNotifier) !== null) {
d.updateNotifier = d.updateNotifier.c;
}
}
d.schemaChanged = delegateRemove(d.schemaChanged, runOn(this, this.ah));
}
if (c != null) {
var e = c;
this.g.executionContext = e.executionContext;
var f = new AggregatedDataProviderTargetDataSourceNotifier(this, e.updateNotifier);
e.updateNotifier = f;
e.schemaChanged = delegateCombine(e.schemaChanged, runOn(this, this.ah));
}
this.queueAutoRefresh();
break;
}
};
AggregatedDataProvider.prototype.ah = function (a, b) {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.prototype.addItem = function (a) {
this.g.addItem(a);
};
AggregatedDataProvider.prototype.queueAutoRefresh = function () {
if (this.deferAutoRefresh) {
return;
}
if (this.h) {
return;
}
if (this.executionContext != null) {
this.h = true;
this.executionContext.enqueueAction(runOn(this, this.ae));
}
};
AggregatedDataProvider.prototype.ae = function () {
if (this.deferAutoRefresh) {
this.h = false;
return;
}
if (!this.h) {
return;
}
this.h = false;
this.ap();
};
AggregatedDataProvider.prototype.ap = function () {
this.aq();
};
AggregatedDataProvider.prototype.aq = function () {
if (this.c == null) {
return;
}
if (!this.k) {
return;
}
this.k = false;
var a = this.c.clone();
var b = this.c.clone();
a = this.d(a);
b = this.e(b);
a.flushAutoRefresh();
b.flushAutoRefresh();
this.o.clear();
var c = this.a(b, a, 0, 0);
this.t(c, this.o);
this.dataSource = c;
};
AggregatedDataProvider.prototype.t = function (a, b) {
var e_1, _a;
if (b.count == 0) {
return null;
}
for (var d = 0; d < a.length; d++) {
var c = a[d];
var e = c;
try {
for (var _b = (e_1 = void 0, __values(fromEnum(b))), _c = _b.next(); !_c.done; _c = _b.next()) {
var f = _c.value;
if (e[f] == null) {
e[f] = NaN;
}
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (_c && !_c.done && (_a = _b.return))
_a.call(_b);
}
finally {
if (e_1)
throw e_1.error;
}
}
}
return null;
};
AggregatedDataProvider.prototype.d = function (a) {
a.shouldEmitSummaryRows = false;
a.includeSummaryRowsInSection = false;
a.summaryScope = 2;
a.isSectionSummaryRowsAtBottom = true;
a.sectionHeaderDisplayMode = 0;
if (a.summaryDescriptions.k.count == 0) {
for (var b = 1; b < a.groupDescriptions.k.count; b++) {
a.summaryDescriptions.k.add(new SummaryDescription(2, a.groupDescriptions.k.item(b).propertyName, 4));
}
}
return a;
};
AggregatedDataProvider.prototype.e = function (a) {
a.shouldEmitSummaryRows = false;
a.includeSummaryRowsInSection = false;
a.summaryScope = 2;
a.isSectionSummaryRowsAtBottom = true;
a.sectionHeaderDisplayMode = 0;
while (a.groupDescriptions.k.count > 1) {
a.groupDescriptions.k.removeAt(a.groupDescriptions.k.count - 1);
}
if (a.summaryDescriptions.k.count == 0) {
for (var b = 0; b < a.groupDescriptions.k.count; b++) {
a.summaryDescriptions.k.add(new SummaryDescription(2, a.groupDescriptions.k.item(b).propertyName, 4));
}
}
return a;
};
AggregatedDataProvider.prototype.flushAutoRefresh = function () {
this.ae();
};
AggregatedDataProvider.prototype.refresh = function () {
this.ap();
};
AggregatedDataProvider.prototype.getItemAtIndex = function (a) {
return this.g.getItemAtIndex(a);
};
AggregatedDataProvider.prototype.getItemValue = function (a, b) {
return this.g.getItemValue(a, b);
};
AggregatedDataProvider.prototype.indexOfItem = function (a) {
return this.g.indexOfItem(a);
};
AggregatedDataProvider.prototype.indexOfKey = function (a) {
return this.g.indexOfKey(a);
};
AggregatedDataProvider.prototype.removeItem = function (a) {
this.g.removeItem(a);
};
AggregatedDataProvider.prototype.resolveSchemaPropertyType = function (a) {
return this.g.resolveSchemaPropertyType(a);
};
AggregatedDataProvider.prototype.setItemValue = function (a, b, c) {
this.g.setItemValue(a, b, c);
};
AggregatedDataProvider.prototype.notifyClearItems = function () {
if (this.targetDataSource != null) {
this.targetDataSource.notifyClearItems();
}
};
AggregatedDataProvider.prototype.notifyInsertItem = function (a, b) {
if (this.targetDataSource != null) {
this.targetDataSource.notifyInsertItem(a, b);
}
};
AggregatedDataProvider.prototype.notifyRemoveItem = function (a, b) {
if (this.targetDataSource != null) {
this.targetDataSource.notifyRemoveItem(a, b);
}
};
AggregatedDataProvider.prototype.notifySetItem = function (a, b, c) {
if (this.targetDataSource != null) {
this.targetDataSource.notifySetItem(a, b, c);
}
};
AggregatedDataProvider.prototype.p = function (a) {
return a.groupDescriptions.k.count;
};
AggregatedDataProvider.prototype.a = function (a, b, c, d) {
if (d == this.p(b)) {
var e = this.z(b, c, d);
return e.d;
}
if (d == 0) {
var f = new AggregatedDataProviderLayerMap();
var g = this.aa(f, a, c, d);
g = this.aa(f, b, c, d);
return g.d;
}
return new Array(0);
};
AggregatedDataProvider.prototype.aa = function (a, b, c, d) {
var e = false;
var f = 0;
var g = null;
for (var h = c; h < b.actualCount; h++) {
var i = b.getRowType(h);
if (i == 3 || i == 6) {
continue;
}
if (!e) {
if (i == 0) {
e = true;
}
if (i == 1) {
e = true;
f = 0;
g = this.b(a, b, h, d);
this.ag(a, b, g, h, d);
continue;
}
}
var j = b.getItemAtIndex(h);
if (g != null && i == 0) {
g.k.add1(j);
}
if (g != null && this.l(b, j, h)) {
if (b.getRowType(h) == 1) {
h--;
}
e = false;
g = null;
}
}
return new Tuple$2(Number_$type, Array_$type, b.actualCount, a.a(this.o));
};
AggregatedDataProvider.prototype.ag = function (a, b, c, d, e) {
var f = b.getRowType(d);
if (f == 1) {
var g = b.getItemAtIndex(d);
if (c.i.count == 1) {
this.ad(a, b, g, c);
}
else {
this.ac(b, g, c);
}
}
};
AggregatedDataProvider.prototype.af = function (a, b, c, d, e) {
var f = b.getRowType(d);
if (f == 5) {
var g = b.getItemAtIndex(d);
if (this.n(g, c)) {
if (c.i.count == 1) {
this.ad(a, b, g, c);
}
else {
this.ac(b, g, c);
}
}
}
var h = 1;
while (d + h < b.actualCount && b.getRowType(d + h) == 5) {
var i = b.getRowType(d + h);
if (i == 5) {
var j = b.getItemAtIndex(d + h);
if (c.i.count == 1) {
this.ad(a, b, j, c);
}
else {
this.ac(b, j, c);
}
}
h++;
}
};
AggregatedDataProvider.prototype.ad = function (a, b, c, d) {
var e = a.b(d.j._inner[0]);
var f = c.summaryResults;
if (e != null) {
for (var g = 0; g < f.length; g++) {
var h = f[g];
e.z(h.propertyName, b.summaryDescriptions.k.item(g).alias, h.operand, h.value);
}
}
};
AggregatedDataProvider.prototype.ac = function (a, b, c) {
var d = b.summaryResults;
for (var e = 0; e < d.length; e++) {
var f = d[e];
c.p(f.propertyName, a.summaryDescriptions.k.item(e).alias, f.operand, f.value);
}
};
AggregatedDataProvider.prototype.n = function (a, b) {
return a.level == 1;
};
AggregatedDataProvider.prototype.b = function (a, b, c, d) {
var e = b.getItemAtIndex(c);
var f = e.getSectionKeys();
var g = new List$1(String_$type, 0);
for (var h = 0; h < f.length; h++) {
g.add(f[h]);
}
var i = new List$1(Base.$, 0);
for (var j = 0; j < g.count; j++) {
i.add1(e.getSectionValue(g._inner[j]));
}
var k = new AggregatedDataProviderLayerInfo();
k.i = g;
k.j = i;
a.g(k);
return k;
};
AggregatedDataProvider.prototype.z = function (a, b, c) {
var d = new List$1(Base.$, 0);
var e = false;
for (var f = b; f < a.actualCount; f++) {
var g = a.getRowType(f);
if (g == 3 || g == 6) {
continue;
}
if (!e) {
if (g == 0) {
e = true;
}
if (g == 1) {
e = true;
continue;
}
}
var h = a.getItemAtIndex(f);
d.add1(h);
if (this.l(a, h, f)) {
return new Tuple$2(Number_$type, Array_$type, f, d.toArray());
}
}
return new Tuple$2(Number_$type, Array_$type, a.actualCount, d.toArray());
};
AggregatedDataProvider.prototype.l = function (a, b, c) {
if (a.getRowType(c) != 0) {
return true;
}
return false;
};
AggregatedDataProvider.prototype.aj = function () {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.prototype.ak = function (a, b) {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.prototype.al = function (a, b) {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.prototype.am = function (a, b, c) {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.prototype.an = function (a, b) {
this.k = true;
this.queueAutoRefresh();
};
AggregatedDataProvider.$t = markType(AggregatedDataProvider, 'AggregatedDataProvider', Base.$, [IDataSourceLocalDataProvider_$type, INotifyPropertyChanged_$type]);
return AggregatedDataProvider;
}(Base));
export { AggregatedDataProvider };
/**
* @hidden
*/
var AggregatedDataProviderTargetDataSourceNotifier = /** @class */ /*@__PURE__*/ (function (_super) {
__extends(AggregatedDataProviderTargetDataSourceNotifier, _super);
function AggregatedDataProviderTargetDataSourceNotifier(a, b) {
var _this = _super.call(this) || this;
_this.a = null;
_this.b = null;
_this.a = a;
_this.b = b;
return _this;
}
Object.defineProperty(AggregatedDataProviderTargetDataSourceNotifier.prototype, "c", {
get: function () {
return this.b;
},
enumerable: false,
configurable: true
});
AggregatedDataProviderTargetDataSourceNotifier.prototype.notifyClearItems = function () {
this.a.aj();
if (this.b != null) {
this.b.notifyClearItems();
}
};
AggregatedDataProviderTargetDataSourceNotifier.prototype.notifyInsertItem = function (a, b) {
this.a.ak(a, b);
if (this.b != null) {
this.b.notifyInsertItem(a, b);
}
};
AggregatedDataProviderTargetDataSourceNotifier.prototype.notifyRemoveItem = function (a, b) {
this.a.al(a, b);
if (this.b != null) {
this.b.notifyRemoveItem(a, b);
}
};
AggregatedDataProviderTargetDataSourceNotifier.prototype.notifySetItem = function (a, b, c) {
this.a.am(a, b, c);
if (this.b != null) {
this.b.notifySetItem(a, b, c);
}
};
AggregatedDataProviderTargetDataSourceNotifier.prototype.rangeActualized = function (a, b) {
this.a.an(a, b);
if (this.b != null) {
this.b.rangeActualized(a, b);
}
};
AggregatedDataProviderTargetDataSourceNotifier.$t = markType(AggregatedDataProviderTargetDataSourceNotifier, 'AggregatedDataProviderTargetDataSourceNotifier', Base.$, [IDataSourceUpdateNotifier_$type]);
return AggregatedDataProviderTargetDataSourceNotifier;
}(Base));
export { AggregatedDataProviderTargetDataSourceNotifier };