@anglr/grid
Version:
Angular module displaying grid
83 lines • 4.1 kB
JavaScript
import { ChangeDetectionStrategy, Inject, Optional, Component, ElementRef } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { PERMANENT_STORAGE } from '@anglr/common';
import { isPresent } from '@jscrpt/common';
import { extend } from '@jscrpt/common/extend';
import { QueryGridInitializerComponent } from '../query/queryGridInitializer.component';
import { GRID_INITIALIZER_OPTIONS } from '../../../misc/tokens';
import * as i0 from "@angular/core";
import * as i1 from "@angular/router";
/**
* Component used for rendering query, permanent storage grid initializer
*/
export class QueryPermanentStorageGridInitializerComponent extends QueryGridInitializerComponent {
//######################### public properties - implementation of NoGridInitializer #########################
/**
* Options for grid plugin
*/
get options() {
return this.ɵoptions;
}
set options(options) {
this.ɵoptions = extend(true, this.ɵoptions, options);
}
//######################### protected properties #########################
/**
* Gets name of items per page permanent storage
*/
get itemsPerPagePermanentStorageName() {
return this.options.storageIppName;
}
//######################### constructor #########################
constructor(router, route, pluginElement, _permanentStorages, options) {
super(router, pluginElement, route, options);
this._permanentStorages = _permanentStorages;
}
//######################### public methods - implementation of NoGridInitializer #########################
/**
* @inheritdoc
*/
getItemsPerPage() {
let ipp = super.getItemsPerPage();
if (ipp) {
return ipp;
}
if (this._permanentStorages && this.itemsPerPagePermanentStorageName) {
ipp = this._permanentStorages.get(this.itemsPerPagePermanentStorageName);
if (isPresent(ipp)) {
return ipp;
}
}
return null;
}
/**
* @inheritdoc
*/
setItemsPerPage(itemsPerPage) {
if (this._permanentStorages && this.itemsPerPagePermanentStorageName) {
this._permanentStorages.set(this.itemsPerPagePermanentStorageName, itemsPerPage);
}
super.setItemsPerPage(itemsPerPage);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: QueryPermanentStorageGridInitializerComponent, deps: [{ token: i1.Router }, { token: i1.ActivatedRoute }, { token: i0.ElementRef }, { token: PERMANENT_STORAGE, optional: true }, { token: GRID_INITIALIZER_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: QueryPermanentStorageGridInitializerComponent, isStandalone: true, selector: "ng-query-permanent-storage-grid-initializer", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: QueryPermanentStorageGridInitializerComponent, decorators: [{
type: Component,
args: [{
selector: 'ng-query-permanent-storage-grid-initializer',
template: '',
changeDetection: ChangeDetectionStrategy.OnPush
}]
}], ctorParameters: () => [{ type: i1.Router }, { type: i1.ActivatedRoute }, { type: i0.ElementRef }, { type: undefined, decorators: [{
type: Inject,
args: [PERMANENT_STORAGE]
}, {
type: Optional
}] }, { type: undefined, decorators: [{
type: Inject,
args: [GRID_INITIALIZER_OPTIONS]
}, {
type: Optional
}] }] });
//# sourceMappingURL=queryPermanentStorageGridInitializer.component.js.map