UNPKG

igniteui-react-core

Version:
1,461 lines (1,460 loc) 79.3 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 { ISupportsDataChangeNotifications_$type } from "./ISupportsDataChangeNotifications"; import { IDataSourceSupportsCount_$type } from "./IDataSourceSupportsCount"; import { IDataSourceDataProviderUpdateNotifier_$type } from "./IDataSourceDataProviderUpdateNotifier"; import { SortDescriptionCollection } from "./SortDescriptionCollection"; import { DataSourceSummaryScope_$type } from "./DataSourceSummaryScope"; import { Base, Type, markType, typeGetValue, PropertyChangedEventArgs, runOn, delegateCombine, typeCast, fromEnum, String_$type, delegateRemove, enumGetBox } from "./type"; import { SyncableObservableCollection$1 } from "./SyncableObservableCollection$1"; import { IDataSourceSupportsIndexedAccess_$type } from "./IDataSourceSupportsIndexedAccess"; import { DataSourceSectionHeaderDisplayMode_$type } from "./DataSourceSectionHeaderDisplayMode"; import { DataSourceSchemaChangedEventArgs } from "./DataSourceSchemaChangedEventArgs"; import { DataSourceRowExpansionChangedEventArgs } from "./DataSourceRowExpansionChangedEventArgs"; import { DataSourceRootSummariesChangedEventArgs } from "./DataSourceRootSummariesChangedEventArgs"; import { DataSourcePropertiesRequestedChangedEventArgs } from "./DataSourcePropertiesRequestedChangedEventArgs"; import { Convert } from "./Convert"; import { truncate, isNaN_ } from "./number"; import { toOADate, fromOADate } from "./dateExtended"; import { DefaultSummaryResult } from "./DefaultSummaryResult"; import { stringCompare } from "./string"; import { ArgumentNullException } from "./ArgumentNullException"; import { IEditableDataSource_$type } from "./IEditableDataSource"; import { TransactionService } from "./TransactionService"; import { TransactionKeyEqualityComparer } from "./TransactionKeyEqualityComparer"; import { Transaction } from "./Transaction"; import { DataSourceSpecialRow } from "./DataSourceSpecialRow"; import { List$1 } from "./List$1"; import { Dictionary$2 } from "./Dictionary$2"; import { DataSourceAggregatedResult } from "./DataSourceAggregatedResult"; import { DataSourceDataCommittedEventArgs } from "./DataSourceDataCommittedEventArgs"; import { Localization } from "./Localization"; import { TransactionType } from "./TransactionType"; import { stringFormat } from "./stringExtended"; /** * @hidden */ export let IDataSourceDataProvider_$type = /*@__PURE__*/ new Type(null, 'IDataSourceDataProvider', null, [ISupportsDataChangeNotifications_$type, IDataSourceSupportsCount_$type]); /** * @hidden */ export let IFilterExpression_$type = /*@__PURE__*/ new Type(null, 'IFilterExpression'); /** * @hidden */ export let FilterExpressionCollection = /*@__PURE__*/ (() => { class FilterExpressionCollection extends Base { get syncTarget() { return this.a; } set syncTarget(a) { if (a == null) { this.f.syncTarget = null; this.a = null; return; } this.a = a; this.f.syncTarget = this.a.f; } get shouldDetachOnTargetChange() { return this.f.shouldDetachOnTargetChange; } set shouldDetachOnTargetChange(a) { this.f.shouldDetachOnTargetChange = a; } constructor() { super(); this.a = null; this.f = null; this.f = new SyncableObservableCollection$1(IFilterExpression_$type); } add(a) { return this.f.add(a); } insert(a, b) { this.f.add1(a, b); } clear() { this.f.clear(); } get(a) { return this.f.get(a); } indexOf(a) { return this.f.indexOf(a); } remove(a) { return this.f.remove1(a); } removeAt(a) { return this.f.remove(a); } set(a, b) { return this.f.set(a, b); } size() { return this.f.size(); } get onChanged() { return this.f.f; } set onChanged(a) { this.f.f = a; } n(a) { this.f.addListener(a); } r(a) { this.f.removeListener(a); } o(a) { this.f.addOneWayTarget(a.f); } s(a) { this.f.removeOneWayTarget(a.f); } get k() { return this.f.all; } } FilterExpressionCollection.$t = /*@__PURE__*/ markType(FilterExpressionCollection, 'FilterExpressionCollection'); return FilterExpressionCollection; })(); /** * @hidden */ export let IDataSource_$type = /*@__PURE__*/ new Type(null, 'IDataSource', null, [ISupportsDataChangeNotifications_$type, IDataSourceSupportsIndexedAccess_$type]); /** * @hidden */ export let SummaryCalculator = /*@__PURE__*/ (() => { class SummaryCalculator extends Base { constructor() { super(...arguments); this._propertyName = null; this._propertyType = 0; this._dataSource = null; this._isSummaryDirty = false; this.b = 5; this._shouldDisplay = false; } get propertyName() { return this._propertyName; } set propertyName(a) { this._propertyName = a; } get propertyType() { return this._propertyType; } set propertyType(a) { this._propertyType = a; } get dataSource() { return this._dataSource; } set dataSource(a) { this._dataSource = a; } get isSummaryDirty() { return this._isSummaryDirty; } set isSummaryDirty(a) { this._isSummaryDirty = a; } get_operand() { return this.b; } get operand() { return this.get_operand(); } get shouldDisplay() { return this._shouldDisplay; } set shouldDisplay(a) { this._shouldDisplay = a; } beginCalculation(a, b) { this.dataSource = a; this.propertyName = b; if (this.propertyName != null) { this.propertyType = a.resolveSchemaPropertyType(this.propertyName); } this.isSummaryDirty = false; } getResults() { let a = this.endCalculation(); a.shouldDisplay = this.shouldDisplay; return a; } endCalculation() { return null; } aggregate(a) { } itemAdded(a, b, c) { return b; } itemRemoved(a, b, c) { return b; } k(a) { if (this.dataSource == null) { return NaN; } let b = this.dataSource.getItemProperty(a, this.propertyName); if (b == null) { return NaN; } return this.l(b); } l(a) { if (a == null) { return NaN; } switch (this.propertyType) { case 6: return a; case 5: return a; case 1: return typeGetValue(a); case 3: return typeGetValue(a); case 4: return typeGetValue(a); case 7: return a; case 8: return toOADate(a); case 11: try { return Convert.toDouble3(a); } catch (b) { return NaN; } } return 0; } m(a) { switch (this.propertyType) { case 6: return a; case 5: return a; case 1: return truncate(a); case 3: return truncate(a); case 4: return truncate(a); case 7: return a; case 8: return fromOADate(a); default: return a; } } } SummaryCalculator.$t = /*@__PURE__*/ markType(SummaryCalculator, 'SummaryCalculator'); return SummaryCalculator; })(); /** * @hidden */ export let SumSummaryCalculator = /*@__PURE__*/ (() => { class SumSummaryCalculator extends SummaryCalculator { constructor() { super(...arguments); this.r = 0; } get_displayName() { let a = BaseDataSource.bb("DataSource_Summary_Sum"); return a != null ? a : "Sum"; } get displayName() { return this.get_displayName(); } get_operand() { return 2; } beginCalculation(a, b) { super.beginCalculation(a, b); this.r = 0; } endCalculation() { return DefaultSummaryResult.createWithDisplay(this.propertyName, 2, this.m(this.r), this.shouldDisplay); } aggregate(a) { let b = this.k(a); if (!isNaN_(b)) { this.r += b; } } itemAdded(a, b, c) { let d = this.k(a); if (isNaN_(d)) { d = 0; } if (b == null) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 2, this.m(d), this.shouldDisplay); } let e = this.l(b.value) + d; return DefaultSummaryResult.createWithDisplay(this.propertyName, 2, this.m(e), this.shouldDisplay); } itemRemoved(a, b, c) { let d = this.k(a); if (isNaN_(d)) { d = 0; } let e = this.l(b.value) - d; return DefaultSummaryResult.createWithDisplay(this.propertyName, 2, this.m(e), this.shouldDisplay); } } SumSummaryCalculator.$t = /*@__PURE__*/ markType(SumSummaryCalculator, 'SumSummaryCalculator', SummaryCalculator.$); return SumSummaryCalculator; })(); /** * @hidden */ export let CountSummaryCalculator = /*@__PURE__*/ (() => { class CountSummaryCalculator extends SummaryCalculator { constructor() { super(...arguments); this.r = 0; } get_displayName() { let a = BaseDataSource.bb("DataSource_Summary_Count"); return a != null ? a : "Count"; } get displayName() { return this.get_displayName(); } get_operand() { return 4; } beginCalculation(a, b) { super.beginCalculation(a, b); this.propertyType = 1; this.r = 0; } endCalculation() { return DefaultSummaryResult.createWithDisplay(this.propertyName, 4, this.r, this.shouldDisplay); } aggregate(a) { this.r++; } itemAdded(a, b, c) { if (b == null) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 4, 1, this.shouldDisplay); } return DefaultSummaryResult.createWithDisplay(this.propertyName, 4, typeGetValue(b.value) + 1, this.shouldDisplay); } itemRemoved(a, b, c) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 4, typeGetValue(b.value) - 1, this.shouldDisplay); } } CountSummaryCalculator.$t = /*@__PURE__*/ markType(CountSummaryCalculator, 'CountSummaryCalculator', SummaryCalculator.$); return CountSummaryCalculator; })(); /** * @hidden */ export let AverageSummaryCalculator = /*@__PURE__*/ (() => { class AverageSummaryCalculator extends SummaryCalculator { constructor() { super(...arguments); this.r = 0; this.s = 0; } get_displayName() { let a = BaseDataSource.bb("DataSource_Summary_Avg"); return a != null ? a : "Avg"; } get displayName() { return this.get_displayName(); } get_operand() { return 3; } beginCalculation(a, b) { super.beginCalculation(a, b); this.r = 0; this.s = 0; } endCalculation() { let a = this.s > 0 ? this.r / this.s : 0; return DefaultSummaryResult.createWithDisplay(this.propertyName, 3, this.m(a), this.shouldDisplay); } aggregate(a) { let b = this.k(a); if (!isNaN_(b)) { this.r += b; this.s++; } } itemAdded(a, b, c) { let d = this.k(a); if (isNaN_(d)) { d = 0; } if (b == null) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 3, this.m(d), this.shouldDisplay); } let e = this.l(b.value) * (c - 1); let f = (e + d) / c; return DefaultSummaryResult.createWithDisplay(this.propertyName, 3, this.m(f), this.shouldDisplay); } itemRemoved(a, b, c) { let d = this.k(a); if (isNaN_(d)) { d = 0; } let e = this.l(b.value) * (c + 1); let f = (e - d) / c; return DefaultSummaryResult.createWithDisplay(this.propertyName, 3, this.m(f), this.shouldDisplay); } } AverageSummaryCalculator.$t = /*@__PURE__*/ markType(AverageSummaryCalculator, 'AverageSummaryCalculator', SummaryCalculator.$); return AverageSummaryCalculator; })(); /** * @hidden */ export let MaxSummaryCalculator = /*@__PURE__*/ (() => { class MaxSummaryCalculator extends SummaryCalculator { constructor() { super(...arguments); this.r = null; } get_displayName() { let a = BaseDataSource.bb("DataSource_Summary_Max"); return a != null ? a : "Max"; } get displayName() { return this.get_displayName(); } get_operand() { return 1; } beginCalculation(a, b) { super.beginCalculation(a, b); this.r = null; } endCalculation() { return DefaultSummaryResult.createWithDisplay(this.propertyName, 1, this.r, this.shouldDisplay); } aggregate(a) { this.r = this.s(a, this.r); } itemAdded(a, b, c) { if (b == null) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 1, this.s(a, null), this.shouldDisplay); } let d = this.s(a, b.value); return DefaultSummaryResult.createWithDisplay(this.propertyName, 1, d, this.shouldDisplay); } itemRemoved(a, b, c) { let d = this.dataSource.getItemProperty(a, this.propertyName); if (Base.equalsStatic(d, b.value)) { this.isSummaryDirty = true; } return b; } s(a, b) { let c = this.dataSource.getItemProperty(a, this.propertyName); if (b == null) { return c; } if (c == null) { return b; } switch (this.propertyType) { case 0: b = stringCompare(c, b) > 0 ? c : b; break; case 6: b = c > b ? c : b; break; case 5: b = c > b ? c : b; break; case 1: b = (typeGetValue(c)) > (typeGetValue(b)) ? c : b; break; case 3: b = (typeGetValue(c)) > (typeGetValue(b)) ? c : b; break; case 4: b = (typeGetValue(c)) > (typeGetValue(b)) ? c : b; break; case 7: b = c > b ? c : b; break; case 2: b = c ? c : b; break; case 10: b = (typeGetValue(c)) > (typeGetValue(b)) ? c : b; break; case 8: let xVal_ = c; let yVal_ = b; xVal_ = +xVal_; yVal_ = +yVal_; let d = typeGetValue(xVal_); let e = typeGetValue(yVal_); b = Base.compareSimple(d, e) > 0 ? c : b; break; } return b; } } MaxSummaryCalculator.$t = /*@__PURE__*/ markType(MaxSummaryCalculator, 'MaxSummaryCalculator', SummaryCalculator.$); return MaxSummaryCalculator; })(); /** * @hidden */ export let MinSummaryCalculator = /*@__PURE__*/ (() => { class MinSummaryCalculator extends SummaryCalculator { constructor() { super(...arguments); this.r = null; } get_displayName() { let a = BaseDataSource.bb("DataSource_Summary_Min"); return a != null ? a : "Min"; } get displayName() { return this.get_displayName(); } get_operand() { return 0; } beginCalculation(a, b) { super.beginCalculation(a, b); this.r = null; } endCalculation() { return DefaultSummaryResult.createWithDisplay(this.propertyName, 0, this.r, this.shouldDisplay); } aggregate(a) { this.r = this.s(a, this.r); } itemAdded(a, b, c) { if (b == null) { return DefaultSummaryResult.createWithDisplay(this.propertyName, 0, this.s(a, null), this.shouldDisplay); } let d = this.s(a, b.value); return DefaultSummaryResult.createWithDisplay(this.propertyName, 0, d, this.shouldDisplay); } itemRemoved(a, b, c) { let d = this.dataSource.getItemProperty(a, this.propertyName); if (Base.equalsStatic(d, b.value)) { this.isSummaryDirty = true; } return b; } s(a, b) { let c = this.dataSource.getItemProperty(a, this.propertyName); if (b == null) { return c; } if (c == null) { return b; } switch (this.propertyType) { case 0: b = stringCompare(c, b) < 0 ? c : b; break; case 6: b = c < b ? c : b; break; case 5: b = c < b ? c : b; break; case 1: b = (typeGetValue(c)) < (typeGetValue(b)) ? c : b; break; case 3: b = (typeGetValue(c)) < (typeGetValue(b)) ? c : b; break; case 4: b = (typeGetValue(c)) < (typeGetValue(b)) ? c : b; break; case 7: b = c < b ? c : b; break; case 2: b = !c ? c : b; break; case 10: b = (typeGetValue(c)) < (typeGetValue(b)) ? c : b; break; case 8: let xVal_ = c; let yVal_ = b; xVal_ = +xVal_; yVal_ = +yVal_; let d = typeGetValue(xVal_); let e = typeGetValue(yVal_); b = Base.compareSimple(d, e) < 0 ? c : b; break; } return b; } } MinSummaryCalculator.$t = /*@__PURE__*/ markType(MinSummaryCalculator, 'MinSummaryCalculator', SummaryCalculator.$); return MinSummaryCalculator; })(); /** * @hidden */ export let SummaryDescription = /*@__PURE__*/ (() => { class SummaryDescription extends Base { constructor(a, ..._rest) { super(); this.h = false; this.m = null; this.i = false; this.a = 0; this._alias = null; this.d = null; this.provideCalculator = null; a = (a == void 0) ? 0 : a; switch (a) { case 0: break; case 1: { let c = _rest[0]; this.propertyName = c; this.operand = 4; } break; case 2: { let c = _rest[0]; let d = _rest[1]; this.propertyName = c; this.operand = d; } break; } } get propertyName() { return this.m; } set propertyName(a) { this.m = a; } get shouldDisplay() { return this.i; } set shouldDisplay(a) { this.i = a; } get operand() { return this.a; } set operand(a) { this.a = a; switch (this.a) { case 0: this.calculator = new MinSummaryCalculator(); break; case 1: this.calculator = new MaxSummaryCalculator(); break; case 2: this.calculator = new SumSummaryCalculator(); break; case 3: this.calculator = new AverageSummaryCalculator(); break; case 4: this.calculator = new CountSummaryCalculator(); break; } } get alias() { return this._alias; } set alias(a) { this._alias = a; } get calculator() { return this.d; } set calculator(a) { this.d = a; } equals(a) { let b = a; if (b == null) { return super.equals(a); } return b.propertyName == this.propertyName && b.operand == this.operand; } getHashCode() { return Base.getHashCodeStatic(this.propertyName) * 17 + this.operand; } p() { this.h = true; } g() { if (this.provideCalculator != null) { let a = new ProvideCalculatorEventArgs(); this.provideCalculator(this, a); return a.a; } return null; } f() { let a = null; switch (this.a) { case 0: a = new MinSummaryCalculator(); break; case 1: a = new MaxSummaryCalculator(); break; case 2: a = new SumSummaryCalculator(); break; case 3: a = new AverageSummaryCalculator(); break; case 4: a = new CountSummaryCalculator(); break; case 5: a = this.g(); if (a == null) { throw new ArgumentNullException(2, "Calculator", "No custom calculator was provided."); } break; } if (a != null) { a.shouldDisplay = this.shouldDisplay; } return a; } } SummaryDescription.$t = /*@__PURE__*/ markType(SummaryDescription, 'SummaryDescription'); return SummaryDescription; })(); /** * @hidden */ export let SummaryDescriptionCollection = /*@__PURE__*/ (() => { class SummaryDescriptionCollection extends Base { g() { return this.f; } get syncTarget() { return this.d; } set syncTarget(a) { if (a == null) { this.f.syncTarget = null; this.d = null; return; } this.d = a; this.f.syncTarget = this.d.f; } constructor() { super(); this.d = null; this.f = null; this.f = new SyncableObservableCollection$1(SummaryDescription.$); } add(a) { return this.f.add(a); } insert(a, b) { this.f.add1(a, b); } clear() { this.f.clear(); } get(a) { return this.f.get(a); } indexOf(a) { return this.f.indexOf(a); } remove(a) { return this.f.remove1(a); } removeAt(a) { return this.f.remove(a); } set(a, b) { return this.f.set(a, b); } size() { return this.f.size(); } n(a) { this.f.addListener(a); } r(a) { this.f.removeListener(a); } o(a) { this.f.addOneWayTarget(a.f); } s(a) { this.f.removeOneWayTarget(a.f); } get onChanged() { return this.f.f; } set onChanged(a) { this.f.f = a; } get k() { return this.f.all; } } SummaryDescriptionCollection.$t = /*@__PURE__*/ markType(SummaryDescriptionCollection, 'SummaryDescriptionCollection'); return SummaryDescriptionCollection; })(); /** * @hidden */ export let ProvideCalculatorEventArgs = /*@__PURE__*/ (() => { class ProvideCalculatorEventArgs extends Base { constructor() { super(...arguments); this.a = null; } } ProvideCalculatorEventArgs.$t = /*@__PURE__*/ markType(ProvideCalculatorEventArgs, 'ProvideCalculatorEventArgs'); return ProvideCalculatorEventArgs; })(); /** * @hidden */ export let BaseDataSource = /*@__PURE__*/ (() => { class BaseDataSource extends Base { constructor() { super(); this.v = null; this._isReadOnly = false; this.aa = false; this.dataCommitted = null; this.aq = false; this.a0 = null; this._externalDataSource = null; this.t = null; this.s = null; this.j = null; this.u = null; this.k = null; this.p = null; this.au = 0; this.av = 0; this.aw = 0; this.q = null; this.propertyChanged = null; this.m = null; this.o = null; this.schemaChanged = null; this.rowExpansionChanged = null; this.rootSummariesChanged = null; this.propertiesRequestedChanged = null; this.ab = false; this.i = 0; this.y = false; this.b = null; this.a = null; this.c = null; this.e = null; this.ah = false; this.ai = false; this.w = false; this.h = 0; this.ac = true; this.ae = true; this.z = false; this.ag = false; this.af = false; this.ad = true; this.ak = true; this.aj = false; this.al = true; this.am = true; this.x = false; this.d = null; this.m = new DefaultDataSourceDataProviderUpdateNotifier(this); this.t = new SortDescriptionCollection(); this.s = new SortDescriptionCollection(); this.u = new SummaryDescriptionCollection(); this.t.n(runOn(this, this.cy)); this.s.n(runOn(this, this.bz)); this.u.n(runOn(this, this.cz)); this.j = new FilterExpressionCollection(); this.j.n(runOn(this, this.bx)); this.v = new TransactionService(runOn(this, this.b1), runOn(this, this.clone1), new TransactionKeyEqualityComparer()); let a = this.v; a.stateChanged = delegateCombine(a.stateChanged, runOn(this, this.cu)); } cu(a, b) { if (a == 0 || a == 1) { if (this.updateNotifier != null) { let c = b; let d = c.transactions._inner[0]; if (d.type == 1 || d.type == TransactionType.Delete) { let e = d.id; let f = this.indexOfKey(e); if (f > -1) { let g = this.getItemAtIndex(f); this.updateNotifier.notifySetItem(f, g, g); let h = this.getStickyRows(); if (h != null) { for (let i = 0; i < h.length; i++) { let j = h[i]; let k = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(j)); if (k != null && k.rowType == 3 && k.targetRow == g) { this.updateNotifier.notifySetItem(j, k, k); break; } } } } } else if (d.type == 0) { } } } this.ct(a, b); } ct(a, b) { } ar() { return !this.isReadOnly && this.actualPrimaryKey != null && this.actualBaseDataProvider != null && this.v != null; } b1(a, b) { if (a != null && b != null) { let c = a; let d = b; for (let e of fromEnum(d)) { if (c.containsKey(e.key)) { c.item(e.key, e.value); } else { c.addItem(e.key, e.value); } } } } clone1(a) { if (a != null) { let b = a; let c = new Dictionary$2(String_$type, Base.$, 0); for (let d of fromEnum(b)) { c.addItem(d.key, d.value); } return c; } return null; } get isReadOnly() { return this._isReadOnly; } set isReadOnly(a) { this._isReadOnly = a; } get_isBatchingEnabled() { return this.aa; } set_isBatchingEnabled(a) { this.aa = a; } get isBatchingEnabled() { return this.get_isBatchingEnabled(); } set isBatchingEnabled(a) { this.set_isBatchingEnabled(a); } get canUndo() { return this.v.k; } get canRedo() { return this.v.j; } get canCommit() { return this.v.a(-1).length > 0; } updatePropertyAtKey(a, b, c, d = false) { if (this.ar()) { let e = null; if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) { let f = a[0]; if (f.rowType == 3) { e = f; if (this.actualPrimaryKey != null) { a = new Array(this.actualPrimaryKey.length); this.getPrimaryKeyValue(e.targetRow, a); } else { a = [e.targetRow]; } } } let g = new Dictionary$2(String_$type, Base.$, 0); g.addItem(b, c); let h = new Transaction(); h.id = a; h.value = g; h.type = 1; this.v.v(h, d); if (this.isBatchingEnabled || d) { if (this.updateNotifier != null) { let i = this.indexOfKey(a); if (i > -1) { let j = this.getItemAtIndex(i); this.updateNotifier.notifySetItem(i, j, j); } if (this.isRowPinned(i)) { let k = -1; if (e != null) { k = this.indexOfItem(e); } else { let l = this.getStickyRows(); if (l != null) { for (let m = 0; m < l.length; m++) { let n = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(l[m])); if (n != null && n.rowType == 3) { e = n; k = l[m]; break; } } } } if (k > -1) { this.updateNotifier.notifySetItem(k, e, e); } } } } return h.transactionID; } return -1; } removeItemByKey(a) { if (this.ar()) { let b = null; if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) { let c = a[0]; if (c.rowType == 3) { b = c; if (this.actualPrimaryKey != null) { a = new Array(this.actualPrimaryKey.length); this.getPrimaryKeyValue(b.targetRow, a); } else { a = [b.targetRow]; } } } let d = new Transaction(); d.id = a; d.type = TransactionType.Delete; this.v.v(d, false); if (this.isBatchingEnabled) { if (this.updateNotifier != null) { let e = this.indexOfKey(a); if (e > -1) { let f = this.getItemAtIndex(e); this.updateNotifier.notifySetItem(e, f, f); } if (this.isRowPinned(e)) { let g = -1; if (b != null) { g = this.indexOfItem(b); } else { let h = this.getStickyRows(); if (h != null) { for (let i = 0; i < h.length; i++) { let j = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(h[i])); if (j != null && j.rowType == 3) { b = j; g = h[i]; break; } } } } if (g > -1) { this.updateNotifier.notifySetItem(g, b, b); } } } } } } removeItem(a) { if (this.ar()) { let b; if (typeCast(DataSourceSpecialRow.$, a) !== null) { b = [a]; } else if (this.actualPrimaryKey == null || this.actualPrimaryKey.length < 1) { b = [a]; } else { b = new Array(this.actualPrimaryKey.length); this.getPrimaryKeyValue(a, b); } this.removeItemByKey(b); } } addItem(a) { if (this.ar()) { if (typeCast(DataSourceSpecialRow.$, a) !== null) { return; } let b = new Transaction(); b.id = [a]; b.type = 0; this.v.v(b, false); } } acceptPendingTransaction(a) { if (this.ar()) { let b = this.v.d(a); if (b != null) { this.v.ap(a); } } } rejectPendingTransaction(a) { if (this.ar()) { let b = this.v.d(a); if (b != null) { this.v.x(a); if (this.updateNotifier != null) { if (b.type != 0) { let c = b.id; let d = this.indexOfKey(c); if (d > -1) { let e = this.getItemAtIndex(d); this.updateNotifier.notifySetItem(d, e, e); let f = this.getStickyRows(); if (f != null) { for (let g = 0; g < f.length; g++) { let h = typeCast(DataSourceSpecialRow.$, this.getItemAtIndex(f[g])); if (h != null && h.rowType == 3) { if (h.targetRow == e) { this.updateNotifier.notifySetItem(f[g], h, h); break; } } } } } } } } } } commitEdits(a) { if (this.ar()) { let b = this.v.c(null).length > 0; let c = this.v.s(a, this.isBatchingEnabled); if (c == -1 && b) { if (this.updateNotifier != null) { this.updateNotifier.notifyClearItems(); } } return c; } return -1; } cancelEdits() { if (this.ar()) { this.v.w(true, null); if (this.updateNotifier != null) { this.updateNotifier.notifyClearItems(); } } } acceptPendingCommit(a) { if (this.ar()) { let b = this.v.e(a); if (b != null) { this.v.u(a); if (this.updateNotifier != null) { for (let c = 0; c < b.a.length; c++) { if (b.a[c].transactionType != 0) { let d = b.a[c].id; let e = this.indexOfKey(d); if (e > -1) { let f = this.getItemAtIndex(e); this.updateNotifier.notifySetItem(e, f, f); } } } } } } } rejectPendingCommit(a) { if (this.ar()) { let b = this.v.e(a); if (b != null) { this.v.ac(a); if (this.updateNotifier != null) { for (let c = 0; c < b.a.length; c++) { if (b.a[c].transactionType != 0) { let d = b.a[c].id; let e = this.indexOfKey(d); if (e > -1) { let f = this.getItemAtIndex(e); this.updateNotifier.notifySetItem(e, f, f); } } } } } } } undo() { if (this.ar()) { this.v.ae(); } } redo() { if (this.ar()) { this.v.ab(); } } hasEdit(a, b) { if (this.ar()) { a = this.g(a); let c = this.v.g(a); if (c != null) { let d = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value); if (d != null && d.containsKey(b)) { return true; } } c = this.v.ah(a); if (c != null) { let e = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value); if (e != null && e.containsKey(b)) { return true; } } c = this.v.ag(a); if (c != null) { let f = typeCast(Dictionary$2.$.specialize(String_$type, Base.$), c.value); if (f != null && f.containsKey(b)) { return true; } } } return false; } hasDelete(a) { if (this.ar()) { a = this.g(a); let b = this.v.g(a); if (b != null && b.transactionType == TransactionType.Delete) { return true; } b = this.v.ah(a); if (b != null && b.transactionType == TransactionType.Delete) { return true; } b = this.v.ag(a); if (b != null && b.transactionType == TransactionType.Delete) { return true; } } return false; } hasAdd(a) { if (this.ar()) { let b = this.v.g(a); if (b != null && b.transactionType == 0) { return true; } b = this.v.ah(a); if (b != null && b.transactionType == 0) { return true; } } return false; } getAggregatedChanges(a) { if (this.ar()) { let b = this.v.a(a); let c = new List$1(DataSourceAggregatedResult.$, 0); for (let d = 0; d < b.length; d++) { let e = b[d].id; let f = new DataSourceAggregatedResult(); if (b[d].transactionType == 0) { f.transactionType = 0; f.item = e[0]; } else if (b[d].transactionType == TransactionType.Delete) { f.transactionType = TransactionType.Delete; let g = this.indexOfKey(e); if (g > -1) { f.item = this.getItemAtIndex(g); } else { f.item = e; } } else if (b[d].transactionType == 1) { f.transactionType = 1; let h = b[d].value; f.keys = new Array(h.count); f.values = new Array(h.count); let i = 0; for (let j of fromEnum(h)) { f.keys[i] = j.key; f.values[i] = j.value; i++; } let k = this.getItemFromKey(e); if (k != null) { f.item = k; } else { f.item = e; } } c.add(f); } return c.toArray(); } return new Array(0); } isPendingTransaction(a) { return this.v.d(a) != null; } isPendingCommit(a) { return this.v.e(a) != null; } setTransactionError(a, b) { let c = this.v.d(a); if (c != null) { c.error = b; if (this.updateNotifier != null) { let d = c.id; let e = this.indexOfKey(d); if (e > -1) { let f = this.getItemAtIndex(e); this.updateNotifier.notifySetItem(e, f, f); } } } } getTransactionErrorByKey(a, b) { a = this.g(a); let c = this.v.c(a); for (let d = 0; d < c.length; d++) { if (c[d].error != null) { if (c[d].type == 1) { let e = c[d].value; if (e.containsKey(b)) { return c[d].error; } } } } return null; } getTransactionErrorByID(a) { let b = this.v.d(a); if (b != null) { return b.error; } return null; } getTransactionID(a, b) { a = this.g(a); let c = this.v.c(a); for (let d = 0; d < c.length; d++) { if (c[d].type == 1) { let e = c[d].value; if (e.containsKey(b)) { return c[d].transactionID; } } } return -1; } g(a) { if (a.length == 1 && typeCast(DataSourceSpecialRow.$, a[0]) !== null) { let b = a[0]; if (b.rowType == 3) { if (this.actualPrimaryKey != null) { a = new Array(this.actualPrimaryKey.length); this.getPrimaryKeyValue(b.targetRow, a); } else { a = [b.targetRow]; } } } return a; } b2(a, b) { if (this.dataCommitted != null) { this.dataCommitted(this, new DataSourceDataCommittedEventArgs(a, b)); } } static bb(a) { let b = Localization.d("DataVisualization"); let c = stringFormat("DataVisualization-{0}", b); return Localization.isRegistered(c) ? Localization.getString(c, a) : null; } cy(a, b) { this.onSortDescriptionsChanged(b); } bz(a, b) { this.onGroupDescriptionsChanged(b); } cz(a, b) { this.onSummaryDescriptionsChanged(b); } bx(a, b) { this.onFilterExpressionsChanged(b); } onSortDescriptionsChanged(a) { this.queueAutoRefresh(); } onGroupDescriptionsChanged(a) { if (this.isGroupingSupported) { if (this.groupDescriptions != null && this.groupDescriptions.k.count > 0) { this.aq = true; } else { this.aq = false; } this.queueAutoRefresh(); } } onSummaryDescriptionsChanged(a) { this.queueAutoRefresh(); } onFilterExpressionsChanged(a) { this.queueAutoRefresh(); } onRowExpansionChanged(a, b, c) { if (this.rowExpansionChanged != null) { this.rowExpansionChanged(this, new DataSourceRowExpansionChangedEventArgs(a, b, c)); } } isPlaceholderItem(a) { return false; } get externalDataSource() { return this._externalDataSource; } set externalDataSource(a) { this._externalDataSource = a; } get resolvedDataProvider() { return this.actualBaseDataProvider;