UNPKG

igniteui-angular-core

Version:

Ignite UI Angular Core logic used in multiple UI components.

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