@rxap/data-source
Version:
Provides a set of classes and decorators for creating and managing data sources in Angular applications, including base classes, static data sources, observable data sources, and method data sources. It also includes a component for displaying data source
88 lines (83 loc) • 4.16 kB
JavaScript
import * as i0 from '@angular/core';
import { Directive, Input } from '@angular/core';
import { AbstractTableDataSource, RxapTableDataSourceError, DynamicTableDataSource } from '@rxap/data-source/table';
import { DataSourceCollectionDirective } from '@rxap/data-source/directive';
import 'rxjs';
class TableDataSourceDirective extends DataSourceCollectionDirective {
constructor() {
super(...arguments);
this.viewer = { id: '[rxapTableDataSource]' };
}
loadDataSource() {
const dataSource = super.loadDataSource();
if (dataSource) {
if (!(dataSource instanceof AbstractTableDataSource)) {
throw new RxapTableDataSourceError('The data source is not a AbstractTableDataSource', '');
}
if (this.viewer.id && dataSource instanceof DynamicTableDataSource) {
dataSource.setPaginator(this.paginator, this.viewer.id);
dataSource.setSort(this.sort, this.viewer.id);
dataSource.setFilter(this.filter, this.viewer.id);
dataSource.setParameters(this.parameters, this.viewer.id);
}
else {
if (dataSource.paginator !== this.paginator) {
dataSource.paginator = this.paginator;
}
if (dataSource.sort !== this.sort) {
dataSource.sort = this.sort;
}
if (dataSource.filter !== this.filter) {
dataSource.filter = this.filter;
}
if (dataSource.parameters !== this.parameters) {
dataSource.parameters = this.parameters;
}
}
}
return dataSource;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TableDataSourceDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.1", type: TableDataSourceDirective, isStandalone: true, selector: "[rxapTableDataSource]", inputs: { paginator: ["rxapTableDataSourcePaginator", "paginator"], sort: ["rxapTableDataSourceSort", "sort"], parameters: ["rxapTableDataSourceParameters", "parameters"], filter: ["rxapTableDataSourceFilter", "filter"], dataSourceOrIdOrToken: ["rxapTableDataSourceFrom", "dataSourceOrIdOrToken"], viewer: ["rxapTableDataSourceViewer", "viewer"], emptyTemplate: ["rxapTableDataSourceEmpty", "emptyTemplate"], errorTemplate: ["rxapTableDataSourceErrorTemplate", "errorTemplate"] }, usesInheritance: true, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.1", ngImport: i0, type: TableDataSourceDirective, decorators: [{
type: Directive,
args: [{
selector: '[rxapTableDataSource]',
standalone: true,
}]
}], propDecorators: { paginator: [{
type: Input,
args: ['rxapTableDataSourcePaginator']
}], sort: [{
type: Input,
args: ['rxapTableDataSourceSort']
}], parameters: [{
type: Input,
args: ['rxapTableDataSourceParameters']
}], filter: [{
type: Input,
args: ['rxapTableDataSourceFilter']
}], dataSourceOrIdOrToken: [{
type: Input,
args: [{
required: true,
alias: 'rxapTableDataSourceFrom',
}]
}], viewer: [{
type: Input,
args: ['rxapTableDataSourceViewer']
}], emptyTemplate: [{
type: Input,
args: ['rxapTableDataSourceEmpty']
}], errorTemplate: [{
type: Input,
args: ['rxapTableDataSourceErrorTemplate']
}] } });
// region
// endregion
/**
* Generated bundle index. Do not edit.
*/
export { TableDataSourceDirective };
//# sourceMappingURL=rxap-data-source-table-directives.mjs.map