UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

485 lines (484 loc) 16.6 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 { Base, INotifyPropertyChanged_$type, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, delegateRemove, markType } from "./type"; import { IDataSourceLocalDataProvider_$type } from "./IDataSourceLocalDataProvider"; import { DataSourceLocalDataProvider } from "./DataSourceLocalDataProvider"; import { VirtualDataSource } from "./VirtualDataSource"; import { List$1 } from "./List$1"; import { IDataSourceUpdateNotifier_$type } from "./IDataSourceUpdateNotifier"; /** * @hidden */ var FlatDataProvider = /** @class */ /*@__PURE__*/ (function (_super) { __extends(FlatDataProvider, _super); function FlatDataProvider() { var _this = _super.call(this) || this; _this.f = new DataSourceLocalDataProvider(); _this.d = null; _this.l = null; _this.k = null; _this.h = false; _this.schemaChanged = null; _this.propertyChanged = null; _this.g = false; _this.a = null; _this.i = true; var a = _this.f; a.schemaChanged = delegateCombine(a.schemaChanged, runOn(_this, _this.r)); _this.f.sortDescriptions.n(runOn(_this, _this.y)); _this.f.groupDescriptions.n(runOn(_this, _this.w)); _this.f.summaryDescriptions.n(runOn(_this, _this.z)); _this.f.filterExpressions.n(runOn(_this, _this.v)); return _this; } FlatDataProvider.prototype.v = function (a, b) { this.i = true; }; FlatDataProvider.prototype.z = function (a, b) { this.i = true; }; FlatDataProvider.prototype.w = function (a, b) { this.i = true; }; FlatDataProvider.prototype.y = function (a, b) { this.i = true; }; FlatDataProvider.prototype.r = function (a, b) { if (this.schemaChanged != null) { this.schemaChanged(this, b); } }; Object.defineProperty(FlatDataProvider.prototype, "e", { get: function () { return this.d; }, set: function (a) { var b = this.d; this.d = a; if (b != this.d) { this.x("TargetDataSource", b, this.d); } }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "o", { get: function () { return this.l; }, set: function (a) { var b = this.l; this.l = a; if (b != this.l) { this.x("SchemaHints", b, this.l); } }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "actualSchema", { get: function () { return this.f.actualSchema; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "executionContext", { get: function () { return this.f.executionContext; }, set: function (a) { this.f.executionContext = a; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "updateNotifier", { get: function () { return this.f.updateNotifier; }, set: function (a) { this.f.updateNotifier = a; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "dataSource", { get: function () { return this.k; }, set: function (a) { var b = this.k; this.k = a; if (b != this.k) { this.x("ItemsSource", b, this.k); } }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "deferAutoRefresh", { get: function () { return this.h; }, set: function (a) { var b = this.h; this.h = a; if (b != this.h) { this.x("DeferAutoRefresh", b, this.h); } }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "isSortingSupported", { get: function () { return this.f.isSortingSupported; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "isGroupingSupported", { get: function () { return this.f.isGroupingSupported; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "isFilteringSupported", { get: function () { return this.f.isFilteringSupported; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "sortDescriptions", { get: function () { return this.f.sortDescriptions; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "groupDescriptions", { get: function () { return this.f.groupDescriptions; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "summaryDescriptions", { get: function () { return this.f.summaryDescriptions; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "summaryScope", { get: function () { return this.f.summaryScope; }, set: function (a) { this.f.summaryScope = a; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "filterExpressions", { get: function () { return this.f.filterExpressions; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "propertiesRequested", { get: function () { return this.f.propertiesRequested; }, set: function (a) { this.f.propertiesRequested = a; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "notifyUsingSourceIndexes", { get: function () { return true; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "isItemIndexLookupSupported", { get: function () { return this.f.isItemIndexLookupSupported; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "isKeyIndexLookupSupported", { get: function () { return this.f.isKeyIndexLookupSupported; }, enumerable: false, configurable: true }); Object.defineProperty(FlatDataProvider.prototype, "actualCount", { get: function () { return this.f.actualCount; }, enumerable: false, configurable: true }); FlatDataProvider.prototype.x = function (a, b, c) { if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } this.af(a, b, c); }; FlatDataProvider.prototype.af = function (a, b, c) { switch (a) { case "ItemsSource": this.f.dataSource = c; break; case "DeferAutoRefresh": if (!c) { this.queueAutoRefresh(); } break; case "TargetDataSource": if (b != null) { var d = b; if (d.updateNotifier != null) { if (typeCast(FlatDataProviderTargetDataSourceNotifier.$, d.updateNotifier) !== null) { d.updateNotifier = d.updateNotifier.c; } } d.schemaChanged = delegateRemove(d.schemaChanged, runOn(this, this.u)); } if (c != null) { var e = c; this.f.executionContext = e.executionContext; var f = new FlatDataProviderTargetDataSourceNotifier(this, e.updateNotifier); e.updateNotifier = f; e.schemaChanged = delegateCombine(e.schemaChanged, runOn(this, this.u)); } this.queueAutoRefresh(); break; } }; FlatDataProvider.prototype.u = function (a, b) { this.i = true; this.queueAutoRefresh(); }; FlatDataProvider.prototype.addItem = function (a) { this.f.addItem(a); }; FlatDataProvider.prototype.queueAutoRefresh = function () { if (this.deferAutoRefresh) { return; } if (this.g) { return; } if (this.executionContext != null) { this.g = true; this.executionContext.enqueueAction(runOn(this, this.s)); } }; FlatDataProvider.prototype.s = function () { if (this.deferAutoRefresh) { this.g = false; return; } if (!this.g) { return; } this.g = false; this.ag(); }; FlatDataProvider.prototype.ag = function () { this.ah(); }; FlatDataProvider.prototype.ah = function () { if (this.d == null) { return; } if (!this.i) { return; } this.d.flushAutoRefresh(); var a = this.d.isVirtual; if (a) { var b = 50; if (typeCast(VirtualDataSource.$, this.d) !== null) { b = this.d.actualPageSize; } this.d.firstVisibleIndexRequested = 0; this.d.lastVisibleIndexRequested = b; } var c = this.b(this.d); this.dataSource = c; }; FlatDataProvider.prototype.flushAutoRefresh = function () { this.s(); }; FlatDataProvider.prototype.refresh = function () { this.ag(); }; FlatDataProvider.prototype.getItemAtIndex = function (a) { return this.f.getItemAtIndex(a); }; FlatDataProvider.prototype.getItemValue = function (a, b) { return this.f.getItemValue(a, b); }; FlatDataProvider.prototype.indexOfItem = function (a) { return this.f.indexOfItem(a); }; FlatDataProvider.prototype.indexOfKey = function (a) { return this.f.indexOfKey(a); }; FlatDataProvider.prototype.removeItem = function (a) { this.f.removeItem(a); }; FlatDataProvider.prototype.resolveSchemaPropertyType = function (a) { return this.f.resolveSchemaPropertyType(a); }; FlatDataProvider.prototype.setItemValue = function (a, b, c) { this.f.setItemValue(a, b, c); }; FlatDataProvider.prototype.notifyClearItems = function () { if (this.e != null) { this.e.notifyClearItems(); } }; FlatDataProvider.prototype.notifyInsertItem = function (a, b) { if (this.e != null) { this.e.notifyInsertItem(a, b); } }; FlatDataProvider.prototype.notifyRemoveItem = function (a, b) { if (this.e != null) { this.e.notifyRemoveItem(a, b); } }; FlatDataProvider.prototype.notifySetItem = function (a, b, c) { if (this.e != null) { this.e.notifySetItem(a, b, c); } }; FlatDataProvider.prototype.j = function (a) { return a.groupDescriptions.k.count; }; FlatDataProvider.prototype.b = function (a) { var b = this.c(a); return b; }; FlatDataProvider.prototype.t = function (a, b) { var c = this.d; if (this.a != null) { for (var d = 0; d < c.actualCount; d++) { var e = c.getRowType(d); { var f = c.getItemAtIndex(d); this.a[d] = f; } } } this.f.notifyClearItems(); }; FlatDataProvider.prototype.c = function (a) { var b = new List$1(Base.$, 0); for (var c = 0; c < a.actualCount; c++) { var d = a.getRowType(c); var e = a.getItemAtIndex(c); b.add1(e); } this.a = b.toArray(); return this.a; }; FlatDataProvider.prototype.aa = function () { this.i = true; this.queueAutoRefresh(); }; FlatDataProvider.prototype.ab = function (a, b) { this.i = true; this.queueAutoRefresh(); }; FlatDataProvider.prototype.ac = function (a, b) { this.i = true; this.queueAutoRefresh(); }; FlatDataProvider.prototype.ad = function (a, b, c) { this.i = true; this.queueAutoRefresh(); }; FlatDataProvider.prototype.ae = function (a, b) { this.t(a, b); if (this.d.lastVisibleIndexRequested < this.d.actualCount) { var c = this.d.lastVisibleIndexRequested - this.d.firstVisibleIndexRequested; this.d.lastVisibleIndexRequested += c; this.d.firstVisibleIndexRequested += c; } }; FlatDataProvider.$t = markType(FlatDataProvider, 'FlatDataProvider', Base.$, [IDataSourceLocalDataProvider_$type, INotifyPropertyChanged_$type]); return FlatDataProvider; }(Base)); export { FlatDataProvider }; /** * @hidden */ var FlatDataProviderTargetDataSourceNotifier = /** @class */ /*@__PURE__*/ (function (_super) { __extends(FlatDataProviderTargetDataSourceNotifier, _super); function FlatDataProviderTargetDataSourceNotifier(a, b) { var _this = _super.call(this) || this; _this.a = null; _this.b = null; _this.a = a; _this.b = b; return _this; } Object.defineProperty(FlatDataProviderTargetDataSourceNotifier.prototype, "c", { get: function () { return this.b; }, enumerable: false, configurable: true }); FlatDataProviderTargetDataSourceNotifier.prototype.notifyClearItems = function () { this.a.aa(); if (this.b != null) { this.b.notifyClearItems(); } }; FlatDataProviderTargetDataSourceNotifier.prototype.notifyInsertItem = function (a, b) { this.a.ab(a, b); if (this.b != null) { this.b.notifyInsertItem(a, b); } }; FlatDataProviderTargetDataSourceNotifier.prototype.notifyRemoveItem = function (a, b) { this.a.ac(a, b); if (this.b != null) { this.b.notifyRemoveItem(a, b); } }; FlatDataProviderTargetDataSourceNotifier.prototype.notifySetItem = function (a, b, c) { this.a.ad(a, b, c); if (this.b != null) { this.b.notifySetItem(a, b, c); } }; FlatDataProviderTargetDataSourceNotifier.prototype.rangeActualized = function (a, b) { this.a.ae(a, b); if (this.b != null) { this.b.rangeActualized(a, b); } }; FlatDataProviderTargetDataSourceNotifier.$t = markType(FlatDataProviderTargetDataSourceNotifier, 'FlatDataProviderTargetDataSourceNotifier', Base.$, [IDataSourceUpdateNotifier_$type]); return FlatDataProviderTargetDataSourceNotifier; }(Base)); export { FlatDataProviderTargetDataSourceNotifier };