igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
1,300 lines (1,299 loc) • 45.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 { 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 { 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 { 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 { DataSeriesAdapterCachedProvider } from "./DataSeriesAdapterCachedProvider";
import { AggregatedDataProvider } from "./AggregatedDataProvider";
import { IDataSource_$type } from "./IDataSource";
import { FlatDataProvider } from "./FlatDataProvider";
/**
* @hidden
*/
export let IDataSeriesAdapterRule_$type = new Type(null, 'IDataSeriesAdapterRule');
/**
* @hidden
*/
export let DataSeriesAdapterRunContext = /*@__PURE__*/ (() => {
class DataSeriesAdapterRunContext extends Base {
constructor(a) {
super();
this.g = null;
this._analyzer = null;
this.h = null;
this.m = null;
this.o = null;
this.n = null;
this.b = null;
this.a = null;
this.l = null;
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.m = new Stack$1(IDataSourceLocalDataProvider_$type);
this.o = new Stack$1(String_$type);
this.n = new Stack$1(String_$type);
this.b = this.g.includedProperties;
this.a = this.g.excludedProperties;
this.l = null;
if (this.g.supportedSeriesTypes != null) {
this.l = new HashSet$1(DataSeriesType_$type, 0);
for (let b = 0; b < this.g.supportedSeriesTypes.length; b++) {
this.l.add_1(this.g.supportedSeriesTypes[b]);
}
}
}
get analyzer() {
return this._analyzer;
}
set analyzer(a) {
this._analyzer = a;
}
getSubProvider(a, b) {
let c = this.g.n(a, false);
this.pushDataSource(c);
this.pushPath(b);
return c;
}
popSubProvider() {
this.popDataSource();
this.popPath();
}
w(a, b) {
return this.g.aj(a, b);
}
recurseRules(a, b, c) {
this.g.a0(this, a, b, c);
}
get includedProperties() {
return this.b;
}
get excludedProperties() {
return this.a;
}
getCurrentDataSource() {
return this.m.d();
}
pushDataSource(a) {
this.m.h(a);
}
hasValidType(a) {
if (this.l == null) {
return true;
}
if (this.l.contains(a.suggestedSeries)) {
return true;
}
return false;
}
popDataSource() {
return this.m.e();
}
getCurrentPathSegment() {
return this.o.d();
}
getCurrentPath() {
let a = "";
let b = true;
for (let c of fromEnum(this.o)) {
if (b) {
b = false;
}
else {
a += ".";
}
a += c;
}
return a;
}
getParentTitle() {
if (this.n.f == 0) {
return null;
}
return this.n.d();
}
pushPath(a) {
this.o.h(a);
}
popPath() {
return this.o.e();
}
pushParentTitle(a) {
this.n.h(a);
}
popParentTitle() {
return this.n.e();
}
ab(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;
}
}
addDataSeries(a, b) {
this.ab(a, b);
this.h.add(a);
}
removeDataSeries(a) {
this.h.remove(a);
}
insertDataSeries(a, b, c) {
this.ab(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 = markType(DataSeriesAdapterRunContext, 'DataSeriesAdapterRunContext');
return DataSeriesAdapterRunContext;
})();
/**
* @hidden
*/
export let DataSeriesDataProviderAnalyzer = /*@__PURE__*/ (() => {
class DataSeriesDataProviderAnalyzer extends Base {
constructor(a) {
super();
this.p = null;
this.b = null;
this.a = null;
this.s = false;
this.r = false;
this.ak = new HashSet$1(String_$type, 0);
this.am = new List$1(Matcher.$, 0);
this.aj = new HashSet$1(String_$type, 0);
this.al = new List$1(Matcher.$, 0);
this.p = a;
}
get includedProperties() {
return this.b;
}
set includedProperties(a) {
this.b = a;
this.ak.clear();
if (this.b == null) {
this.s = false;
}
else {
this.s = true;
let d = this.b;
for (let c = 0; c < d.length; c++) {
let b = d[c];
if (Matcher.a(b)) {
this.am.add(new Matcher(b));
}
else {
this.ak.add_1(b);
}
}
}
}
get excludedProperties() {
return this.a;
}
set excludedProperties(a) {
this.a = a;
this.aj.clear();
if (this.a == null) {
this.r = false;
}
else {
this.r = true;
let d = this.a;
for (let c = 0; c < d.length; c++) {
let b = d[c];
if (Matcher.a(b)) {
this.al.add(new Matcher(b));
}
else {
this.aj.add_1(b);
}
}
}
}
getParentTitle() {
return this.p.getParentTitle();
}
shouldIncludeProperty(a, b) {
if (!stringIsNullOrEmpty(b)) {
a = b + "." + a;
}
if (this.s && !this.ak.contains(a) && !this.y(a)) {
return false;
}
if (this.r && (this.aj.contains(a) || this.u(a))) {
return false;
}
return true;
}
u(a) {
for (let b = 0; b < this.al.count; b++) {
if (this.al._inner[b].b(a)) {
return true;
}
}
return false;
}
y(a) {
for (let b = 0; b < this.am.count; b++) {
if (this.am._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.n((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.n(null, (b) => b == a);
}
getAllNumericProperties() {
return this.n(runOn(this, this.ae), null);
}
getAllObjectProperties() {
return this.n(runOn(this, this.af), null);
}
getAllCollectionProperties() {
let a = this.getAllObjectProperties();
if (a.length == 0) {
return new Array(0);
}
let b = this.p.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;
}
ab(a) {
if (a == 8 || a == 9) {
return true;
}
return false;
}
q(a) {
let b = this.p.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) {
return 11;
}
return c.propertyTypes[d];
}
n(a, b) {
let c = this.p.getCurrentDataSource();
let d = c.actualSchema;
if (d == null) {
return new Array(0);
}
let e = this.p.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.ai(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.ai(d.propertyDataIntents, i) && this.shouldIncludeProperty(d.propertyNames[i], e)) {
h[f] = d.propertyNames[i];
f++;
}
}
return h;
}
ai(a, b) {
if (a == null) {
return true;
}
return !this.t(a, b, "DontPlot");
}
t(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.i(a, false, false);
}
getAllPropertiesWithValuelessIntent(a) {
return this.i(a, true, false);
}
getPropertyIntentValue(a, b) {
let c = this.p.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.i(a, false, true);
}
i(a, b, c) {
let d = this.p.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.n(runOn(this, this.ab), 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;
}
ae(a) {
return a == 1 || a == 3 || a == 4 || a == 7 || a == 5 || a == 6 || a == 10;
}
af(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.an(a.getItemValue(a.getItemAtIndex(g - 1), b));
let i = this.an(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;
}
aw(a, b, c) {
let d = this.p.getCurrentDataSource();
let e = d.actualSchema;
if (e == null) {
return null;
}
let f = this.n(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.q(f[g]))) {
return f[g];
}
}
return null;
}
getFirstDistinctStringProperty(a) {
return this.aw(a, (b) => b == 0, runOn(this, this.ag));
}
getFirstDistinctNumericProperty(a) {
return this.aw(a, runOn(this, this.ae), runOn(this, this.ad));
}
getFirstDistinctMonotonicNumericProperty(a) {
let b = this.p.getCurrentDataSource();
return this.aw(a, runOn(this, this.ae), (c, d) => this.ad(c, d) && this.isMonotonic(b, c, a));
}
getFirstDistinctDateTimeProperty(a) {
return this.aw(a, runOn(this, this.ab), runOn(this, this.aa));
}
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.p.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.aq(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.aq(a, d, e);
}
}
return e;
}
aq(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.p.getCurrentDataSource();
for (let c = 0; c < b.actualCount; c++) {
let d = b.getItemValue(b.getItemAtIndex(c), a);
if (d != null) {
return d;
}
}
return null;
}
ag(a, b) {
let c = this.p.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;
}
aa(a, b) {
let c = this.p.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;
}
an(value_) {
return (+value_);
}
ad(a, b) {
let c = this.p.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.an(k);
}
if (h.contains(j)) {
return false;
}
h.add_1(j);
}
return true;
}
return false;
}
}
DataSeriesDataProviderAnalyzer.$t = 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.at(this.b);
}
notifyInsertItem(a, b) {
this.a.au(this.b, a, b);
}
notifyRemoveItem(a, b) {
this.a.av(this.b, a, b);
}
notifySetItem(a, b, c) {
this.a.aw(this.b, a, b, c);
}
}
DataSeriesAdapterUpdateNotifier.$t = 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 = markType(DataSeriesAdapterRuleCollection, 'DataSeriesAdapterRuleCollection', 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 = 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 = markType(DataSeriesAdapterRunEventArgs, 'DataSeriesAdapterRunEventArgs');
return DataSeriesAdapterRunEventArgs;
})();
/**
* @hidden
*/
export let DataSeriesAdapterImplementation = /*@__PURE__*/ (() => {
class DataSeriesAdapterImplementation extends Base {
constructor() {
super();
this.x = false;
this.w = false;
this.ac = null;
this.ae = null;
this.ab = new Dictionary$2(Base.$, DataSeriesAdapterCachedProvider.$, 0);
this.ad = null;
this.propertyChanged = null;
this.c = null;
this.b = null;
this.a = null;
this.q = null;
this.p = null;
this.o = null;
this.l = null;
this.u = null;
this._rules = null;
this._dataSeries = null;
this.y = false;
this.removingUnsupported = null;
this.removingDuplicates = null;
this.q = new SortDescriptionCollection();
this.o = new SortDescriptionCollection();
this.u = new SummaryDescriptionCollection();
this.l = new FilterExpressionCollection();
this.p = new SortDescriptionCollection();
this.q.n(runOn(this, this.al));
this.o.n(runOn(this, this.al));
this.u.n(runOn(this, this.al));
this.l.n(runOn(this, this.al));
this.p.n(runOn(this, this.al));
this.rules = new DataSeriesAdapterRuleCollection();
this.dataSeries = new DataSeriesCollection();
this.ax(this.rules);
let a = this.rules;
a.collectionChanged = delegateCombine(a.collectionChanged, runOn(this, this.a5));
}
al(a, b) {
let c = this.z;
let d = this.aa();
if (c != this.w || d != this.x) {
this.w = c;
this.x = d;
this.refresh();
}
}
aj(a, b) {
let c = stringEmpty();
if (this.ac != null) {
c = this.ac(a);
}
if (stringIsNullOrEmpty(c)) {
return b;
}
return c;
}
ax(a) {
}
a5(a, b) {
this.refresh();
}
get g() {
return this.ae;
}
get itemsSource() {
return this.ad;
}
set itemsSource(a) {
let b = this.ad;
this.ad = a;
if (b != this.ad) {
this.as("ItemsSource", b, this.ad);
}
}
get supportedSeriesTypes() {
return this.c;
}
set supportedSeriesTypes(a) {
let b = this.c;
this.c = a;
if (b != this.c) {
this.as("SupportedSeriesTypes", b, this.c);
}
}
get includedProperties() {
return this.b;
}
set includedProperties(a) {
let b = this.b;
this.b = a;
if (b != this.b) {
this.as("IncludedProperties", b, this.b);
}
}
get excludedProperties() {
return this.a;
}
set excludedProperties(a) {
let b = this.a;
this.a = a;
if (b != this.a) {
this.as("ExcludedProperties", b, this.a);
}
}
get sortDescriptions() {
return this.q;
}
get postSortDescriptions() {
return this.p;
}
get groupDescriptions() {
return this.o;
}
get filterExpressions() {
return this.l;
}
get summaryDescriptions() {
return this.u;
}
get rules() {
return this._rules;
}
set rules(a) {
this._rules = a;
}
get dataSeries() {
return this._dataSeries;
}
set dataSeries(a) {
this._dataSeries = a;
}
as(a, b, c) {
this.ay(a, b, c);
if (this.propertyChanged != null) {
this.propertyChanged(this, new PropertyChangedEventArgs(a));
}
}
ay(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.y = true;
this.a4();
let a = new DataSeriesAdapterRunContext(this);
let b = this.n(this.itemsSource, true);
this.am(this.itemsSource, b, null, false);
a.pushDataSource(b);
this.a7(a);
this.a9(a);
this.an();
this.y = false;
}
a4() {
for (let a of fromEnum(this.ab.keys)) {
let b = this.ab.item(a);
b.c = false;
}
}
an() {
let a = new List$1(Base.$, 0);
for (let b of fromEnum(this.ab.keys)) {
let c = this.ab.item(b);
if (!c.c) {
a.add1(b);
let d = c.b;
if (typeCast(AggregatedDataProvider.$, d) !== null) {
let e = d;
if (e.f != null) {
this.sortDescriptions.syncTarget = null;
this.groupDescriptions.syncTarget = null;
this.filterExpressions.syncTarget = null;
this.summaryDescriptions.syncTarget = null;
}
}
d.updateNotifier = null;
d.schemaChanged = delegateRemove(d.schemaChanged, runOn(this, this.az));
}
}
for (let f = 0; f < a.count; f++) {
let g = a._inner[f];
this.ab.removeItem(g);
}
}
a9(a) {
this.a3(a);
this.a2(a);
this.a8(a);
}
a3(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);
}
}
}
}
a8(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--;
}
}
a2(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.i();
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);
}
}
}
}
}
}
a7(a) {
for (let b = 0; b < this.rules.count; b++) {
this.a6(a, this.rules._inner[b]);
}
}
a6(a, b) {
b.evaluate(a);
}
get z() {
return this.sortDescriptions.k.count > 0 || this.groupDescriptions.k.count > 0 || this.filterExpressions.k.count > 0 || this.summaryDescriptions.k.count > 0;
}
aa() {
return this.groupDescriptions.k.count > 0 && this.postSortDescriptions.k.count > 0;
}
n(a, b) {
let c = this.aa();
let d = 0;
if (typeCast(IDataSource_$type, a) !== null || (b && this.z)) {
if (c) {
d = 2;
}
else {
d = 1;
}
}
if (a != null && this.ab.containsKey(a)) {
let e = this.ab.item(a);
e.c = true;
if (e.a != d) {
let f = e.b;
if (typeCast(AggregatedDataProvider.$, f) !== null) {
let g = f;
if (g.f != null) {
this.sortDescriptions.syncTarget = null;
this.groupDescriptions.syncTarget = null;
this.filterExpressions.syncTarget = null;
this.summaryDescriptions.syncTarget = null;
}
}
if (typeCast(FlatDataProvider.$, f) !== null) {
}
f.updateNotifier = null;
f.schemaChanged = delegateRemove(f.schemaChanged, runOn(this, this.az));
this.ab.removeItem(a);
}
else {
return e.b;
}
}
if (typeCast(IDataSourceLocalDataProvider_$type, a) !== null) {
return a;
}
if (typeCast(IDataSource_$type, a) !== null) {
let h = new AggregatedDataProvider();
h.f = a;
this.sortDescriptions.syncTarget = h.f.sortDescriptions;
this.groupDescriptions.syncTarget = h.f.groupDescriptions;
this.filterExpressions.syncTarget = h.f.filterExpressions;
this.summaryDescriptions.syncTarget = h.f.summaryDescriptions;
return h;
}
if (b && this.z) {
let i = this.g.getLocalDataSource(a);
let j = new AggregatedDataProvider();
j.f = i;
this.sortDescriptions.syncTarget = j.f.sortDescriptions;
this.groupDescriptions.syncTarget = j.f.groupDescriptions;
this.filterExpressions.syncTarget = j.f.filterExpressions;
this.summaryDescriptions.syncTarget = j.f.summaryDescriptions;
if (d == 2) {
let k = this.g.getLocalDataSource(null);
k.dataProvider = j;
let l = new FlatDataProvider();
l.e = k;
this.postSortDescriptions.syncTarget = l.e.sortDescriptions;
return l;
}
return j;
}
return this.g.getDataProvider(a);
}
a0(a, b, c, d) {
let e = this.n(b, false);
this.am(b, e, a.getCurrentDataSource(), d);
a.pushDataSource(e);
a.pushPath(c);
this.a7(a);
a.popPath();
a.popDataSource();
}
am(a, b, c, d) {
if (a != null && !this.ab.containsKey(a)) {
let e = new DataSeriesAdapterCachedProvider();
e.b = b;
e.a = 0;
if (typeCast(AggregatedDataProvider.$, b) !== null) {
e.a = 1;
}
else if (typeCast(FlatDataProvider.$, b) !== null) {
e.a = 2;
}
e.c = true;
this.ab.addItem(a, e);
b.schemaChanged = delegateCombine(b.schemaChanged, runOn(this, this.az));
if (c != null) {
let f = new DataSeriesAdapterUpdateNotifier(this, b);
c.updateNotifier = f;
}
if (d) {
let g = new DataSeriesAdapterUpdateNotifier(this, b);
b.updateNotifier = g;
}
}
}
az(a, b) {
if (!this.y) {
this.refresh();
}
}
at(a) {
this.refresh();
}
au(a, b, c) {
this.refresh();
}
av(a, b, c) {
this.refresh();
}
aw(a, b, c, d) {
this.refresh();
}
notifyClearItems(a) {
if (this.ab.containsKey(a)) {
this.ab.item(a).b.notifyClearItems();
}
}
notifyInsertItem(a, b, c) {
if (this.ab.containsKey(a)) {
this.ab.item(a).b.notifyInsertItem(b, c);
}
}
notifyRemoveItem(a, b, c) {
if (this.ab.containsKey(a)) {
this.ab.item(a).b.notifyRemoveItem(b, c);
}
}
notifySetItem(a, b, c, d) {
if (this.ab.containsKey(a)) {
this.ab.item(a).b.notifySetItem(b, c, d);
}
}
}
DataSeriesAdapterImplementation.$t = markType(DataSeriesAdapterImplementation, 'DataSeriesAdapterImplementation', Base.$, [INotifyPropertyChanged_$type]);
return DataSeriesAdapterImplementation;
})();