UNPKG

igniteui-react-core

Version:
1,454 lines 58.2 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 { Type, Base, String_$type, fromEnum, markType, IEnumerable_$type, typeCast, Array_$type, runOn, EnumUtil, Number_$type, typeGetValue, INotifyPropertyChanged_$type, PropertyChangedEventArgs, delegateCombine, delegateRemove } from "./type"; import { DataSeriesCollection } from "./DataSeriesCollection"; import { Stack$1 } from "./Stack$1"; import { IDataSourceLocalDataProvider_$type } from "./IDataSourceLocalDataProvider"; import { HashSet$1 } from "./HashSet$1"; import { DataSeriesType_$type } from "./DataSeriesType"; import { DataSeriesAdapterProviderInfo } from "./DataSeriesAdapterProviderInfo"; import { DataSeries } from "./DataSeries"; import { List$1 } from "./List$1"; import { Matcher } from "./Matcher"; import { DataSeriesIntent_$type } from "./DataSeriesIntent"; import { stringIsNullOrEmpty, stringReplace, stringEmpty } from "./string"; import { dateMinValue } from "./date"; import { isNaN_ } from "./number"; import { IDataSourceDataProviderUpdateNotifier_$type } from "./IDataSourceDataProviderUpdateNotifier"; import { ObservableCollection$1 } from "./ObservableCollection$1"; import { SortDescriptionCollection } from "./SortDescriptionCollection"; import { FilterExpressionCollection } from "./FilterExpressionCollection"; import { SummaryDescriptionCollection } from "./SummaryDescriptionCollection"; import { Dictionary$2 } from "./Dictionary$2"; import { Tuple$2 } from "./Tuple$2"; import { IDataSource_$type } from "./IDataSource"; import { AggregatedDataProvider } from "./AggregatedDataProvider"; import { FlatDataProvider } from "./FlatDataProvider"; /** * @hidden */ export let IDataSeriesAdapterRule_$type = /*@__PURE__*/ new Type(null, 'IDataSeriesAdapterRule'); /** * @hidden */ export let DataSeriesAdapterRunContext = /*@__PURE__*/ (() => { class DataSeriesAdapterRunContext extends Base { get analyzer() { return this._analyzer; } set analyzer(a) { this._analyzer = a; } constructor(a) { super(); this.g = null; this._analyzer = null; this.h = null; this.p = null; this.q = null; this.s = null; this.r = null; this.b = null; this.a = null; this.o = null; this.l = false; this.g = a; this.analyzer = new DataSeriesDataProviderAnalyzer(this); this.analyzer.includedProperties = this.g.includedProperties; this.analyzer.excludedProperties = this.g.excludedProperties; this.h = new DataSeriesCollection(); this.p = new Stack$1(IDataSourceLocalDataProvider_$type); this.q = new Stack$1(IDataSourceLocalDataProvider_$type); this.s = new Stack$1(String_$type); this.r = new Stack$1(String_$type); this.b = this.g.includedProperties; this.a = this.g.excludedProperties; this.o = null; this.l = this.g.adjustPrioritiesBasedOnFitness; if (this.g.supportedSeriesTypes != null) { this.o = new HashSet$1(DataSeriesType_$type, 0); for (let b = 0; b < this.g.supportedSeriesTypes.length; b++) { this.o.add_1(this.g.supportedSeriesTypes[b]); } } } getSubProvider(a, b) { let c = this.g.h(a, false); this.pushDataSource(c.c); if (c.b != null) { this.pushHighlightingDataSource(c.b); } else { this.pushHighlightingDataSource(null); } this.pushPath(b); return c.c; } popSubProvider() { this.popDataSource(); this.popHighlightingDataSource(); this.popPath(); } ab(a, b) { return this.g.aq(a, b); } recurseRules(a, b, c) { this.g.bc(this, a, b, c); } get adjustPrioritiesBasedOnFitness() { return this.l; } get includedProperties() { return this.b; } get excludedProperties() { return this.a; } getCurrentDataSource() { return this.p.d(); } getCurrentHighlightingDataSource() { return this.q.d(); } pushDataSource(a) { this.p.h(a); } pushHighlightingDataSource(a) { this.q.h(a); } hasValidType(a) { if (this.o == null) { return true; } if (this.o.contains(a.suggestedSeries)) { return true; } return false; } popDataSource() { return this.p.e(); } popHighlightingDataSource() { return this.q.e(); } getCurrentPathSegment() { return this.s.d(); } getCurrentPath() { let a = ""; let b = true; for (let c of fromEnum(this.s)) { if (b) { b = false; } else { a += "."; } a += c; } return a; } getParentTitle() { if (this.r.f == 0) { return null; } return this.r.d(); } pushPath(a) { this.s.h(a); } popPath() { return this.s.e(); } pushParentTitle(a) { this.r.h(a); } popParentTitle() { return this.r.e(); } ag(a, b) { if (a.priority == -1) { a.priority = b.priority; } if (a.dataPath == null) { a.dataPath = this.getCurrentPath(); } if (a.data == null) { a.data = this.getCurrentDataSource().dataSource; } if (a.highlightedData == null) { let c = this.getCurrentHighlightingDataSource(); if (c != null) { a.highlightedData = c.dataSource; } } } addDataSeries(a, b) { this.ag(a, b); this.h.add(a); } removeDataSeries(a) { this.h.remove(a); } insertDataSeries(a, b, c) { this.ag(b, c); this.h.insert(a, b); } clearDataSeries() { this.h.clear(); } getDataSeriesCount() { return this.h.count; } getDataSeriesAt(a) { return this.h._inner[a]; } } DataSeriesAdapterRunContext.$t = /*@__PURE__*/ markType(DataSeriesAdapterRunContext, 'DataSeriesAdapterRunContext'); return DataSeriesAdapterRunContext; })(); /** * @hidden */ export let DataSeriesDataProviderAnalyzer = /*@__PURE__*/ (() => { class DataSeriesDataProviderAnalyzer extends Base { constructor(a) { super(); this.u = null; this.b = null; this.a = null; this.x = false; this.w = false; this.at = new HashSet$1(String_$type, 0); this.av = new List$1(Matcher.$, 0); this.as = new HashSet$1(String_$type, 0); this.au = new List$1(Matcher.$, 0); this.u = a; } get includedProperties() { return this.b; } set includedProperties(a) { this.b = a; this.at.clear(); if (this.b == null) { this.x = false; } else { this.x = true; let d = this.b; for (let c = 0; c < d.length; c++) { let b = d[c]; if (Matcher.a(b)) { this.av.add(new Matcher(b)); } else { this.at.add_1(b); } } } } get excludedProperties() { return this.a; } set excludedProperties(a) { this.a = a; this.as.clear(); if (this.a == null) { this.w = false; } else { this.w = true; let d = this.a; for (let c = 0; c < d.length; c++) { let b = d[c]; if (Matcher.a(b)) { this.au.add(new Matcher(b)); } else { this.as.add_1(b); } } } } getParentTitle() { return this.u.getParentTitle(); } shouldIncludeProperty(a, b) { if (!stringIsNullOrEmpty(b)) { a = b + "." + a; } if (this.x && !this.at.contains(a) && !this.ad(a)) { return false; } if (this.w && (this.as.contains(a) || this.z(a))) { return false; } return true; } z(a) { for (let b = 0; b < this.au.count; b++) { if (this.au._inner[b].b(a)) { return true; } } return false; } ad(a) { for (let b = 0; b < this.av.count; b++) { if (this.av._inner[b].b(a)) { return true; } } return false; } expandCamelCasedWords(a) { if (a == null) { return null; } a = stringReplace(stringReplace(a, "[", ""), "]", ""); let b = new List$1(String_$type, 0); let c = 0; for (let d = 0; d < a.length; d++) { let e = a.charAt(d); let f = e.toUpperCase(); let g = e.toLowerCase(); if (d == 0) { e = f; } let h = (c == 0 && b.count > 0); let i = (c > 1); if (f == e) { if (h) { b.add(' '); } c++; } else if (g == e) { if (i) { b.insert(b.count - 1, ' '); } c = 0; } else { c = 0; } b.add(e); } let j = stringEmpty(); for (let k = 0; k < b.count; k++) { j += b._inner[k]; } return j; } hasStringProperties() { return this.getAllStringProperties().length > 0; } getAllStringProperties() { return this.s((a) => a == 0, null); } getAllExcludedStringProperties() { return this.r((a) => a == 0, null); } isCollection(a) { if (typeCast(IEnumerable_$type, a) !== null || typeCast(Array_$type, a) !== null) { return true; } return false; } getAllPropertiesWithName(a) { return this.s(null, (b) => b == a); } getAllNumericProperties() { return this.s(runOn(this, this.ak), null); } getAllObjectProperties() { return this.s(runOn(this, this.al), null); } getAllCollectionProperties() { let a = this.getAllObjectProperties(); if (a.length == 0) { return new Array(0); } let b = this.u.getCurrentDataSource(); let c = new List$1(String_$type, 0); for (let d = 0; d < b.actualCount; d++) { if (this.isCollection(b.getItemAtIndex(d))) { c.add(b.actualSchema.propertyNames[d]); } } return c.toArray(); } getFirstNumericProperty() { let a = this.getAllNumericProperties(); if (a.length == 0) { return null; } return a[0]; } hasNumericProperties() { return this.getAllNumericProperties().length > 0; } ag(a) { if (a == 8 || a == 9) { return true; } return false; } v(a) { let b = this.u.getCurrentDataSource(); if (b == null) { return 11; } let c = b.actualSchema; if (c == null) { return 11; } let d = -1; for (let e = 0; e < c.propertyNames.length; e++) { if (Base.equalsStatic(c.propertyNames[e], a)) { d = e; break; } } if (d == -1) { if (b.actualCount > 0) { return b.resolveSchemaPropertyType(a); } return 11; } return c.propertyTypes[d]; } s(a, b) { let c = this.u.getCurrentDataSource(); let d = c.actualSchema; if (d == null) { return new Array(0); } let e = this.u.getCurrentPath(); let f = 0; for (let g = 0; g < d.propertyTypes.length; g++) { if ((a == null || a(d.propertyTypes[g])) && (b == null || b(d.propertyNames[g])) && this.aq(d.propertyDataIntents, g) && this.shouldIncludeProperty(d.propertyNames[g], e)) { f++; } } let h = new Array(f); f = 0; for (let i = 0; i < d.propertyTypes.length; i++) { if ((a == null || a(d.propertyTypes[i])) && (b == null || b(d.propertyNames[i])) && this.aq(d.propertyDataIntents, i) && this.shouldIncludeProperty(d.propertyNames[i], e)) { h[f] = d.propertyNames[i]; f++; } } return h; } r(a, b) { let c = this.u.getCurrentDataSource(); let d = c.actualSchema; if (d == null) { return new Array(0); } let e = this.u.getCurrentPath(); let f = 0; for (let g = 0; g < d.propertyTypes.length; g++) { if ((a == null || a(d.propertyTypes[g])) && (b == null || b(d.propertyNames[g])) && this.aq(d.propertyDataIntents, g) && !this.shouldIncludeProperty(d.propertyNames[g], e)) { f++; } } let h = new Array(f); f = 0; for (let i = 0; i < d.propertyTypes.length; i++) { if ((a == null || a(d.propertyTypes[i])) && (b == null || b(d.propertyNames[i])) && this.aq(d.propertyDataIntents, i) && !this.shouldIncludeProperty(d.propertyNames[i], e)) { h[f] = d.propertyNames[i]; f++; } } return h; } aq(a, b) { if (a == null) { return true; } return !this.y(a, b, "DontPlot"); } y(a, b, c) { if (a == null) { return false; } for (let d = 0; d < a[b].length; d++) { let e = a[b][d]; if (Base.equalsStatic(e.toLowerCase(), c.toLowerCase())) { return true; } } return false; } getAllPropertiesWithIntent(a) { return this.m(a, false, false); } getAllPropertiesWithValuelessIntent(a) { return this.m(a, true, false); } getPropertyIntentValue(a, b) { let c = this.u.getCurrentDataSource(); if (c == null) { return null; } let d = c.actualSchema; if (d == null) { return null; } let e = d.propertyDataIntents; if (e == null || d.propertyNames == null) { return null; } for (let f = 0; f < d.propertyNames.length; f++) { if (d.propertyNames[f] != null && Base.equalsStatic(d.propertyNames[f], b)) { for (let g = 0; g < e[f].length; g++) { let h = e[f][g]; let i = h.split('/'); if (i.length == 2 && i[0] != null && Base.equalsStatic(i[0], a)) { return i[1]; } } } } return null; } getAllPropertiesWithValuedIntent(a) { return this.m(a, false, true); } m(a, b, c) { let d = this.u.getCurrentDataSource(); if (d == null) { return new Array(0); } let e = d.actualSchema; if (e == null) { return new Array(0); } let f = e.propertyDataIntents; if (f == null || e.propertyNames == null) { return new Array(0); } let g = 0; for (let h = 0; h < e.propertyNames.length; h++) { for (let i = 0; i < f[h].length; i++) { let j = f[h][i]; let k = j.split('/'); if (b && k.length > 1) { continue; } if (c && k.length < 2) { continue; } if (Base.equalsStatic(a.toLowerCase(), k[0].toLowerCase())) { g++; } } } let l = new Array(g); g = 0; for (let m = 0; m < e.propertyNames.length; m++) { for (let n = 0; n < f[m].length; n++) { let o = f[m][n]; let p = o.split('/'); if (b && p.length > 1) { continue; } if (c && p.length < 2) { continue; } if (Base.equalsStatic(a.toLowerCase(), o.toLowerCase())) { l[g] = e.propertyNames[m]; g++; } } } return l; } getAllDateTimeProperties() { return this.s(runOn(this, this.ag), null); } getAllExcludedDateTimeProperties() { return this.r(runOn(this, this.ag), null); } getFirstDateTimeProperty() { let a = this.getAllDateTimeProperties(); if (a.length == 0) { return null; } return a[0]; } getFirstStringProperty() { let a = this.getAllStringProperties(); if (a.length == 0) { return null; } return a[0]; } hasDateTimeProperties() { return this.getAllDateTimeProperties().length > 0; } ak(a) { return a == 1 || a == 3 || a == 4 || a == 7 || a == 5 || a == 6 || a == 10; } al(a) { return a == 11; } isMonotonic(a, b, c) { if (a == null) { return false; } let d = false; let e = false; let f = a.actualCount; for (let g = 0; g < Math.min(f, c); g++) { if (g == 0) { continue; } let h = this.coerceToDouble(a.getItemValue(a.getItemAtIndex(g - 1), b)); let i = this.coerceToDouble(a.getItemValue(a.getItemAtIndex(g), b)); if (!e && h != i) { d = i > h; e = true; } if (h == i) { continue; } if (e) { let j = i > h; if (j != d) { return false; } } } return true; } isEvenlySpaced(a, b, c) { if (a == null) { return false; } let d = false; let e = 0; let f = a.actualCount; for (let g = 0; g < Math.min(f, c); g++) { if (g == 0) { continue; } let h = this.coerceToDouble(a.getItemValue(a.getItemAtIndex(g - 1), b)); let i = this.coerceToDouble(a.getItemValue(a.getItemAtIndex(g), b)); if (!d && h != i) { let j = Math.abs(i - h); e = j; d = true; continue; } if (d) { let k = Math.abs(i - h); if (Math.abs(k - e) > 1E-06) { return false; } } } return true; } a6(a, b, c) { let d = this.u.getCurrentDataSource(); let e = d.actualSchema; if (e == null) { return null; } let f = this.s(b, null); if (f.length == 0) { return null; } if (d.actualCount > a) { return null; } for (let g = 0; g < f.length; g++) { if (c(f[g], this.v(f[g]))) { return f[g]; } } return null; } getFirstDistinctStringProperty(a) { return this.a6(a, (b) => b == 0, runOn(this, this.am)); } getFirstDistinctNumericProperty(a) { return this.a6(a, runOn(this, this.ak), runOn(this, this.aj)); } getFirstDistinctMonotonicNumericProperty(a) { let b = this.u.getCurrentDataSource(); return this.a6(a, runOn(this, this.ak), (c, d) => this.aj(c, d) && this.isMonotonic(b, c, a)); } getFirstDistinctMonotonicNumericPropertyWithEvenSpacing(a) { let b = this.u.getCurrentDataSource(); return this.a6(a, runOn(this, this.ak), (c, d) => this.aj(c, d) && this.isMonotonic(b, c, a) && this.isEvenlySpaced(b, c, a)); } getAllDistinctMonotonicNumericProperties(a) { let b = this.u.getCurrentDataSource(); return this.s(runOn(this, this.ak), (c) => this.aj(c, this.v(c)) && this.isMonotonic(b, c, a)); } getAllExcludedDistinctMonotonicNumericProperties(a) { let b = this.u.getCurrentDataSource(); return this.r(runOn(this, this.ak), (c) => this.aj(c, this.v(c)) && this.isMonotonic(b, c, a)); } getFirstDistinctDateTimeProperty(a) { return this.a6(a, runOn(this, this.ag), runOn(this, this.af)); } getFirstStringPropertyPreferringDistinct(a) { let b = this.getFirstDistinctStringProperty(a); if (b != null) { return b; } let c = this.getAllStringProperties(); if (c.length == 0) { return null; } return c[0]; } getTitleString(a, b) { return this.getTitleStringWithSeparator(a, b, " - "); } getTitleStringWithSeparator(a, b, c) { let d = this.u.getCurrentDataSource(); let e = null; if (e == null && b != null) { let f = null; for (let g = 0; g < b.length; g++) { let h = this.getPropertyIntentValue(EnumUtil.getName(DataSeriesIntent_$type, (10)), b[g]); if (e == null) { e = h; f = h; } else { if (h != null) { if (h.trim().length > 0 && h != f) { e += c + h; } f = h; } } } } if (e == null) { let i = this.getAllPropertiesWithValuelessIntent(EnumUtil.getName(DataSeriesIntent_$type, (10))); if (i != null && i.length > 0) { e = i[0]; e = this.az(a, d, e); } } if (e == null) { if (this.getParentTitle() != null) { e = this.getParentTitle(); } } if (e == null && a != null) { let j = this.getAllStringProperties(); for (let l = 0; l < j.length; l++) { let k = j[l]; if (k != null && (Base.equalsStatic(k.toLowerCase(), "label") || Base.equalsStatic(k.toLowerCase(), "title"))) { e = k; } } if (e != null) { e = this.az(a, d, e); } } return e; } az(a, b, c) { if (a != null) { let d = b.getItemValue(a, c); if (d != null) { c = d.toString(); } } else { c = this.getNonNullPropertyValue(c).toString(); } return c; } getNonNullPropertyValue(a) { let b = this.u.getCurrentDataSource(); for (let c = 0; c < b.actualCount; c++) { let d = b.getItemValue(b.getItemAtIndex(c), a); if (d != null) { return d; } } return null; } am(a, b) { let c = this.u.getCurrentDataSource(); let d = new HashSet$1(String_$type, 0); for (let e = 0; e < c.actualCount; e++) { let f = c.getItemValue(c.getItemAtIndex(e), a); let g = f; if (d.contains(g)) { return false; } d.add_1(g); } return true; } af(a, b) { let c = this.u.getCurrentDataSource(); let d = new HashSet$1(Number_$type, 0); for (let e = 0; e < c.actualCount; e++) { let f; let g = c.getItemValue(c.getItemAtIndex(e), a); if (g == null) { f = dateMinValue(); } else { f = g; } if (d.contains(f.getTime())) { return false; } d.add_1(f.getTime()); } return true; } coerceToDouble(value_) { return (+value_); } aj(a, b) { let c = this.u.getCurrentDataSource(); if (b == 4 || b == 1 || b == 3) { let d = new HashSet$1(Number_$type, 0); for (let e = 0; e < c.actualCount; e++) { let f; let g = c.getItemValue(c.getItemAtIndex(e), a); if (g == null) { f = -9.2233720368547758E+18; } else { f = typeGetValue(g); } if (d.contains(f)) { return false; } d.add_1(f); } return true; } if (b == 7 || b == 5 || b == 6) { let h = new HashSet$1(Number_$type, 0); for (let i = 0; i < c.actualCount; i++) { let j; let k = c.getItemValue(c.getItemAtIndex(i), a); if (k == null) { j = NaN; } else { j = this.coerceToDouble(k); } if (h.contains(j)) { return false; } h.add_1(j); } return true; } return false; } numericColumnHasDiverseValues(a) { let b = this.u.getCurrentDataSource(); let c = this.v(a); let d = a; let e = new List$1(Number_$type, 0); if (c == 4 || c == 1 || c == 3) { for (let f = 0; f < b.actualCount; f++) { let g; let h = b.getItemValue(b.getItemAtIndex(f), d); if (h == null) { g = -9.2233720368547758E+18; } else { g = typeGetValue(h); } e.add(g); } } if (c == 7 || c == 5 || c == 6) { for (let i = 0; i < b.actualCount; i++) { let j; let k = b.getItemValue(b.getItemAtIndex(i), d); if (k == null) { j = NaN; } else { j = this.coerceToDouble(k); } e.add(j); } } e.y(); for (let l = 1; l < e.count; l++) { let m = e._inner[l - 1]; let n = e._inner[l]; if (Math.abs(n - m) / n < 0.05) { return false; } } return true; } numericColumnHasNoRange(a, b, c) { let d = this.v(b); let e = b; let f = new List$1(Number_$type, 0); if (d == 4 || d == 1 || d == 3) { for (let g = 0; g < a.actualCount; g++) { let h; let i = a.getItemValue(a.getItemAtIndex(g), e); if (i == null) { h = -9.2233720368547758E+18; } else { h = typeGetValue(i); } f.add(h); } } if (d == 7 || d == 5 || d == 6) { for (let j = 0; j < a.actualCount; j++) { let k; let l = a.getItemValue(a.getItemAtIndex(j), e); if (l == null) { k = NaN; } else { k = this.coerceToDouble(l); } f.add(k); } } let m = 1.7976931348623157E+308; let n = -1.7976931348623157E+308; for (let o = 0; o < Math.min(f.count, c); o++) { let p = f._inner[o]; if (isNaN_(p)) { continue; } m = Math.min(p, m); n = Math.max(p, n); if (n - m > 1E-07) { return false; } } if (n - m < 1E-07) { return true; } return false; } shouldUseLogarithmicScale(a, b) { return true; } } DataSeriesDataProviderAnalyzer.$t = /*@__PURE__*/ markType(DataSeriesDataProviderAnalyzer, 'DataSeriesDataProviderAnalyzer'); return DataSeriesDataProviderAnalyzer; })(); /** * @hidden */ export let DataSeriesAdapterUpdateNotifier = /*@__PURE__*/ (() => { class DataSeriesAdapterUpdateNotifier extends Base { constructor(a, b) { super(); this.a = null; this.b = null; this.a = a; this.b = b; } notifyClearItems() { this.a.a5(this.b); } notifyInsertItem(a, b) { this.a.a6(this.b, a, b); } notifyRemoveItem(a, b) { this.a.a7(this.b, a, b); } notifySetItem(a, b, c) { this.a.a8(this.b, a, b, c); } } DataSeriesAdapterUpdateNotifier.$t = /*@__PURE__*/ markType(DataSeriesAdapterUpdateNotifier, 'DataSeriesAdapterUpdateNotifier', Base.$, [IDataSourceDataProviderUpdateNotifier_$type]); return DataSeriesAdapterUpdateNotifier; })(); /** * @hidden */ export let DataSeriesAdapterRuleCollection = /*@__PURE__*/ (() => { class DataSeriesAdapterRuleCollection extends ObservableCollection$1 { constructor() { super(IDataSeriesAdapterRule_$type, 0); } } DataSeriesAdapterRuleCollection.$t = /*@__PURE__*/ markType(DataSeriesAdapterRuleCollection, 'DataSeriesAdapterRuleCollection', /*@__PURE__*/ ObservableCollection$1.$.specialize(IDataSeriesAdapterRule_$type)); return DataSeriesAdapterRuleCollection; })(); /** * @hidden */ export let DataSeriesAdapterRemovingDuplicatesEventArgs = /*@__PURE__*/ (() => { class DataSeriesAdapterRemovingDuplicatesEventArgs extends Base { constructor() { super(...arguments); this.b = null; this.d = null; this.e = null; this.a = null; this.c = false; } } DataSeriesAdapterRemovingDuplicatesEventArgs.$t = /*@__PURE__*/ markType(DataSeriesAdapterRemovingDuplicatesEventArgs, 'DataSeriesAdapterRemovingDuplicatesEventArgs'); return DataSeriesAdapterRemovingDuplicatesEventArgs; })(); /** * @hidden */ export let DataSeriesAdapterRunEventArgs = /*@__PURE__*/ (() => { class DataSeriesAdapterRunEventArgs extends Base { constructor() { super(...arguments); this.a = null; this.b = false; } } DataSeriesAdapterRunEventArgs.$t = /*@__PURE__*/ markType(DataSeriesAdapterRunEventArgs, 'DataSeriesAdapterRunEventArgs'); return DataSeriesAdapterRunEventArgs; })(); /** * @hidden */ export let DataSeriesAdapterImplementation = /*@__PURE__*/ (() => { class DataSeriesAdapterImplementation extends Base { constructor() { super(); this.ab = false; this.z = false; this.aa = false; this.aj = null; this.al = null; this.ai = new Dictionary$2(Base.$, DataSeriesAdapterProviderInfo.$, 0); this.ah = new Dictionary$2(Base.$, DataSeriesAdapterProviderInfo.$, 0); this.ak = null; this.propertyChanged = null; this.c = null; this.b = null; this.a = null; this.t = null; this.s = null; this.r = null; this.m = null; this.n = null; this.x = null; this._rules = null; this._dataSeries = null; this.ac = false; this.removingUnsupported = null; this.removingDuplicates = null; this._adjustPrioritiesBasedOnFitness = false; this.t = new SortDescriptionCollection(); this.r = new SortDescriptionCollection(); this.x = new SummaryDescriptionCollection(); this.m = new FilterExpressionCollection(); this.n = new FilterExpressionCollection(); this.s = new SortDescriptionCollection(); this.t.n(runOn(this, this.at)); this.r.n(runOn(this, this.at)); this.x.n(runOn(this, this.at)); this.m.n(runOn(this, this.at)); this.n.n(runOn(this, this.at)); this.s.n(runOn(this, this.at)); this.rules = new DataSeriesAdapterRuleCollection(); this.dataSeries = new DataSeriesCollection(); this.a9(this.rules); let a = this.rules; a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.bh)); } at(a, b) { let c = this.ae; let d = this.ag(); let e = this.af(); if (c != this.z || d != this.ab || e != this.aa) { this.z = c; this.ab = d; this.aa = e; this.refresh(); } } aq(a, b) { let c = stringEmpty(); if (this.aj != null) { c = this.aj(a); } if (stringIsNullOrEmpty(c)) { return b; } return c; } a9(a) { } bh(a, b) { this.refresh(); } get g() { return this.al; } get itemsSource() { return this.ak; } set itemsSource(a) { let b = this.ak; this.ak = a; if (b != this.ak) { this.a4("ItemsSource", b, this.ak); } } get supportedSeriesTypes() { return this.c; } set supportedSeriesTypes(a) { let b = this.c; this.c = a; if (b != this.c) { this.a4("SupportedSeriesTypes", b, this.c); } } get includedProperties() { return this.b; } set includedProperties(a) { let b = this.b; this.b = a; if (b != this.b) { this.a4("IncludedProperties", b, this.b); } } get excludedProperties() { return this.a; } set excludedProperties(a) { let b = this.a; this.a = a; if (b != this.a) { this.a4("ExcludedProperties", b, this.a); } } get sortDescriptions() { return this.t; } get postSortDescriptions() { return this.s; } get groupDescriptions() { return this.r; } get filterExpressions() { return this.m; } get highlightFilterExpressions() { return this.n; } get summaryDescriptions() { return this.x; } get rules() { return this._rules; } set rules(a) { this._rules = a; } get dataSeries() { return this._dataSeries; } set dataSeries(a) { this._dataSeries = a; } a4(a, b, c) { this.ba(a, b, c); if (this.propertyChanged != null) { this.propertyChanged(this, new PropertyChangedEventArgs(a)); } } ba(a, b, c) { switch (a) { case "ItemsSource": this.refresh(); break; case "SupportedSeriesTypes": this.refresh(); break; case "IncludedProperties": this.refresh(); break; case "ExcludedProperties": this.refresh(); break; } } refresh() { this.ac = true; this.bg(); let a = new DataSeriesAdapterRunContext(this); let b = this.h(this.itemsSource, true); this.au(this.itemsSource, b, null, false); a.pushDataSource(b.c); if (b.b != null) { a.pushHighlightingDataSource(b.b); } else { a.pushHighlightingDataSource(null); } this.bj(a); this.bl(a); this.av(); this.ac = false; } az(a, b) { let c = new DataSeriesAdapterRunContext(this); let d = this.h(this.itemsSource, true); c.pushDataSource(d.c); a.clear(); let e = new HashSet$1(String_$type, 0); b.clear(); for (let f = 0; f < this.rules.count; f++) { let g = this.rules._inner[f]; let h = g.getPrimaryAxisLabelsStrings(c); if (h != null) { for (let j = 0; j < h.length; j++) { let i = h[j]; if (i == null) { continue; } e.add_1(i); a.add_1(new Tuple$2(String_$type, String_$type, i, c.analyzer.expandCamelCasedWords(i))); } } } for (let k = 0; k < this.rules.count; k++) { let l = this.rules._inner[k]; let m = l.getAdditionalValuePropertyStrings(c); if (m != null) { for (let o = 0; o < m.length; o++) { let n = m[o]; if (n == null) { continue; } if (e.contains(n)) { continue; } b.add_1(new Tuple$2(String_$type, String_$type, n, c.analyzer.expandCamelCasedWords(n))); } } } if (d.c.actualSchema != null) { let p = d.c.actualSchema.propertyNames; for (let r = 0; r < p.length; r++) { let q = p[r]; if (e.contains(q) && p.length > 1) { continue; } b.add_1(new Tuple$2(String_$type, String_$type, q, c.analyzer.expandCamelCasedWords(q))); } } } bg() { for (let a of fromEnum(this.ai.keys)) { let b = this.ai.item(a); b.d = false; } } av() { let a = new List$1(Base.$, 0); for (let b of fromEnum(this.ai.keys)) { let c = this.ai.item(b); if (!c.d) { a.add1(b); this.aw(c); } } for (let d = 0; d < a.count; d++) { let e = a._inner[d]; this.ai.removeItem(e); } } bl(a) { this.bf(a); this.be(a); this.bk(a); } bf(a) { let b = true; if (this.removingUnsupported != null) { let c = ((() => { let $ret = new DataSeriesAdapterRunEventArgs(); $ret.a = a; return $ret; })()); this.removingUnsupported(this, c); b = !c.b; } if (b) { if (this.supportedSeriesTypes == null) { return; } let d = new HashSet$1(DataSeriesType_$type, 0); for (let e = 0; e < this.supportedSeriesTypes.length; e++) { d.add_1(this.supportedSeriesTypes[e]); } for (let f = a.getDataSeriesCount() - 1; f >= 0; f--) { let g = a.getDataSeriesAt(f); if (!d.contains(g.suggestedSeries)) { a.removeDataSeries(g); } } } } bk(a) { let b = 0; for (; b < Math.min(this.dataSeries.count, a.getDataSeriesCount()); b++) { if (!this.dataSeries._inner[b].equals(a.getDataSeriesAt(b))) { this.dataSeries.removeAt(b); b--; } } for (; b < a.getDataSeriesCount(); b++) { this.dataSeries.insert(b, a.getDataSeriesAt(b)); } for (; b < this.dataSeries.count; b++) { this.dataSeries.removeAt(b); b--; } } be(a) { let b = new Dictionary$2(String_$type, List$1.$.specialize(DataSeries.$), 0); for (let c = 0; c < a.getDataSeriesCount(); c++) { let d = a.getDataSeriesAt(c); let e = d.l(); for (let f = 0; f < e.count; f++) { if (e.item(f).intent == 16 || e.item(f).intent == 17) { continue; } let g = (d.dataPath != null ? (d.dataPath + ".") : "") + e.item(f).path; if (e.item(f).intent == 25) { g = e.item(f).path; } if (!b.containsKey(g)) { b.item(g, new List$1(DataSeries.$, 0)); } b.item(g).add(d); } } for (let h of fromEnum(b.keys)) { if (b.item(h).count > 1) { let i = new Array(b.item(h).count); let j = b.item(h); let k = j.count; for (let l = 0; l < k; l++) { i[l] = j._inner[l]; } let m = true; if (this.removingDuplicates != null) { let n = ((() => { let $ret = new DataSeriesAdapterRemovingDuplicatesEventArgs(); $ret.e = h; $ret.b = a; $ret.a = i; return $ret; })()); m = !n.c; } if (m) { let o = -1; let p = null; j = b.item(h); k = j.count; for (let q = 0; q < k; q++) { let r = j._inner[q]; if (r.priority > o) { o = r.priority; p = r; } } for (let s = 0; s < k; s++) { let t = j._inner[s]; if (t != p) { a.removeDataSeries(t); } } } } } } bj(a) { for (let b = 0; b < this.rules.count; b++) { this.bi(a, this.rules._inner[b]); } } bi(a, b) { b.evaluate(a); } get ae() { return this.sortDescriptions.k.count > 0 || this.groupDescriptions.k.count > 0 || this.filterExpressions.k.count > 0 || this.highlightFilterExpressions.k.count > 0 || this.summaryDescriptions.k.count > 0; } get adjustPrioritiesBasedOnFitness() { return this._adjustPrioritiesBasedOnFitness; } set adjustPrioritiesBasedOnFitness(a) { this._adjustPrioritiesBasedOnFitness = a; } ag() { return this.groupDescriptions.k.count > 0 && this.postSortDescriptions.k.count > 0; } af() { return this.highlightFilterExpressions.k.count > 0; } h(a, b) { let c = new DataSeriesAdapterProviderInfo(); let d = this.ag(); let e = this.af(); let f = 0; if (typeCast(IDataSource_$type, a) !== null || (b && this.ae)) { if (d || e) { f = 2; } else { f = 1; } } if (a != null && this.ai.containsKey(a)) { let g = this.ai.item(a); g.d = true; if (g.a != f) { this.ax(this.ai, a, g); } else { return g; } } if (typeCast(IDataSourceLocalDataProvider_$type, a) !== null) { c.c = a; return c; } if (typeCast(IDataSource_$type, a) !== null) { let h = new AggregatedDataProvider(); h.targetDataSource = a; this.sortDescriptions.o(h.targetDataSource.sortDescriptions); this.groupDescriptions.o(h.targetDataSource.groupDescriptions); this.filterExpressions.o(h.targetDataSource.filterExpressions); this.summaryDescriptions.o(h.targetDataSource.summaryDescriptions); c.e.add(() => { this.sortDescriptions.s(h.targetDataSource.sortDescriptions); this.groupDescriptions.s(h.targetDataSource.groupDescriptions); this.filterExpressions.s(h.targetDataSource.filterExpressions)