igniteui-react-core
Version:
Ignite UI React Core.
212 lines (210 loc) • 7.46 kB
JavaScript
import { IgrDataSourceSortDescriptionCollection } from "./igr-data-source-sort-description-collection";
import { IgrDataSourceGroupDescriptionCollection } from "./igr-data-source-group-description-collection";
import { IgrDataSourceSummaryDescriptionCollection } from "./igr-data-source-summary-description-collection";
import { IgrFilterExpressionCollection } from "./igr-filter-expression-collection";
import { TypeRegistrar } from "./type";
/**
* The base class for generic data sources.
*/
var IgrBaseGenericDataSource = /** @class */ /*@__PURE__*/ (function () {
function IgrBaseGenericDataSource() {
this.mounted = false;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
}
IgrBaseGenericDataSource.prototype.createImplementation = function () {
return null;
};
Object.defineProperty(IgrBaseGenericDataSource.prototype, "nativeElement", {
get: function () {
return this._implementation.nativeElement;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrBaseGenericDataSource.prototype, "i", {
/**
* @hidden
*/
get: function () {
return this._implementation;
} /**
* @hidden
*/,
enumerable: false,
configurable: true
});
IgrBaseGenericDataSource._createFromInternal = function (internal) {
if (!internal) {
return null;
}
if (!internal.$type) {
return null;
}
var name = internal.$type.name;
var externalName = "Igr" + name;
if (!TypeRegistrar.isRegistered(externalName)) {
return null;
}
return TypeRegistrar.create(externalName);
};
IgrBaseGenericDataSource.prototype.onImplementationCreated = function () {
};
IgrBaseGenericDataSource.prototype._provideImplementation = function (i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
if (this._initializeAdapters) {
this._initializeAdapters();
}
};
Object.defineProperty(IgrBaseGenericDataSource.prototype, "executionContext", {
/**
* Gets or sets the execution context that the data source should synchronize asynchronous actions with, or use to defer delayed actions.
*/
get: function () {
return this.i.t;
},
set: function (v) {
this.i.t = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrBaseGenericDataSource.prototype, "sortDescriptions", {
/**
* Gets the current sort that is applied to the data source.
*/
get: function () {
var r = this.i.m;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = new IgrDataSourceSortDescriptionCollection();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrBaseGenericDataSource.prototype, "groupDescriptions", {
/**
* Gets the current grouping that is applied to the data source.
*/
get: function () {
var r = this.i.k;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = new IgrDataSourceGroupDescriptionCollection();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrBaseGenericDataSource.prototype, "summaryDescriptions", {
/**
* Gets the current summaries that are applied to the data source.
*/
get: function () {
var r = this.i.o;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = new IgrDataSourceSummaryDescriptionCollection();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrBaseGenericDataSource.prototype, "filterExpressions", {
/**
* Gets the current filter that is applied to the data source.
*/
get: function () {
var r = this.i.q;
if (r == null) {
return null;
}
if (!r.externalObject) {
var e = new IgrFilterExpressionCollection();
if (r.$type) {
e._implementation = r;
}
else {
if (e.i.setNativeElement) {
e.i.setNativeElement(r);
}
}
r.externalObject = e;
}
return r.externalObject;
},
enumerable: false,
configurable: true
});
IgrBaseGenericDataSource.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
if (this.sortDescriptions != null && this.sortDescriptions.findByName && this.sortDescriptions.findByName(name)) {
return this.sortDescriptions.findByName(name);
}
if (this.groupDescriptions != null && this.groupDescriptions.findByName && this.groupDescriptions.findByName(name)) {
return this.groupDescriptions.findByName(name);
}
if (this.summaryDescriptions != null && this.summaryDescriptions.findByName && this.summaryDescriptions.findByName(name)) {
return this.summaryDescriptions.findByName(name);
}
if (this.filterExpressions != null && this.filterExpressions.findByName && this.filterExpressions.findByName(name)) {
return this.filterExpressions.findByName(name);
}
return null;
};
/**
* Called to manually queue a refresh of the data source.
*/
IgrBaseGenericDataSource.prototype.queueAutoRefresh = function () {
this.i.z();
};
return IgrBaseGenericDataSource;
}());
export { IgrBaseGenericDataSource };