primeng
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primeng) [{"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("primeng/utils"),require("primeng/api"),require("primeng/paginator")):"function"==typeof define&&define.amd?define("primeng/dataview",["exports","@angular/core","@angular/common","primeng/utils","primeng/api","primeng/paginator"],e):e(((t=t||self).primeng=t.primeng||{},t.primeng.dataview={}),t.ng.core,t.ng.common,t.primeng.utils,t.primeng.api,t.primeng.paginator)}(this,(function(t,e,o,i,a,n){"use strict";var r=this&&this.__decorate||function(t,e,o,i){var a,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,o,i);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(r=(n<3?a(r):n>3?a(e,o,r):a(e,o))||r);return n>3&&r&&Object.defineProperty(e,o,r),r},s=function(){function t(t){this.el=t,this.layout="list",this.pageLinks=5,this.paginatorPosition="bottom",this.alwaysShowPaginator=!0,this.paginatorDropdownScrollHeight="200px",this.currentPageReportTemplate="{currentPage} of {totalPages}",this.emptyMessage="No records found",this.onLazyLoad=new e.EventEmitter,this.trackBy=function(t,e){return e},this.loadingIcon="pi pi-spinner",this.first=0,this.onPage=new e.EventEmitter,this.onSort=new e.EventEmitter,this.onChangeLayout=new e.EventEmitter}return t.prototype.ngOnInit=function(){this.lazy&&this.onLazyLoad.emit(this.createLazyLoadMetadata()),this.initialized=!0},t.prototype.ngOnChanges=function(t){t.value&&(this._value=t.value.currentValue,this.updateTotalRecords(),!this.lazy&&this.hasFilter()&&this.filter(this.filterValue)),(t.sortField||t.sortOrder)&&(this.lazy&&!this.initialized||this.sort())},t.prototype.ngAfterContentInit=function(){var t=this;this.templates.forEach((function(e){switch(e.getType()){case"listItem":t.listItemTemplate=e.template;break;case"gridItem":t.gridItemTemplate=e.template;break;case"paginatorleft":t.paginatorLeftTemplate=e.template;break;case"paginatorright":t.paginatorRightTemplate=e.template}})),this.updateItemTemplate()},t.prototype.updateItemTemplate=function(){switch(this.layout){case"list":this.itemTemplate=this.listItemTemplate;break;case"grid":this.itemTemplate=this.gridItemTemplate}},t.prototype.changeLayout=function(t){this.layout=t,this.onChangeLayout.emit({layout:this.layout}),this.updateItemTemplate()},t.prototype.updateTotalRecords=function(){this.totalRecords=this.lazy?this.totalRecords:this._value?this._value.length:0},t.prototype.paginate=function(t){this.first=t.first,this.rows=t.rows,this.lazy&&this.onLazyLoad.emit(this.createLazyLoadMetadata()),this.onPage.emit({first:this.first,rows:this.rows})},t.prototype.sort=function(){var t=this;this.first=0,this.lazy?this.onLazyLoad.emit(this.createLazyLoadMetadata()):this.value&&(this.value.sort((function(e,o){var a=i.ObjectUtils.resolveFieldData(e,t.sortField),n=i.ObjectUtils.resolveFieldData(o,t.sortField),r=null;return r=null==a&&null!=n?-1:null!=a&&null==n?1:null==a&&null==n?0:"string"==typeof a&&"string"==typeof n?a.localeCompare(n):a<n?-1:a>n?1:0,t.sortOrder*r})),this.hasFilter()&&this.filter(this.filterValue)),this.onSort.emit({sortField:this.sortField,sortOrder:this.sortOrder})},t.prototype.isEmpty=function(){var t=this.filteredValue||this.value;return null==t||0==t.length},t.prototype.createLazyLoadMetadata=function(){return{first:this.first,rows:this.rows,sortField:this.sortField,sortOrder:this.sortOrder}},t.prototype.getBlockableElement=function(){return this.el.nativeElement.children[0]},t.prototype.filter=function(t,e){if(void 0===e&&(e="contains"),this.filterValue=t,this.value&&this.value.length){var o=this.filterBy.split(",");this.filteredValue=i.FilterUtils.filter(this.value,o,t,e),this.filteredValue.length===this.value.length&&(this.filteredValue=null),this.paginator&&(this.first=0,this.totalRecords=this.filteredValue?this.filteredValue.length:this.value?this.value.length:0)}},t.prototype.hasFilter=function(){return this.filterValue&&this.filterValue.trim().length>0},t.ctorParameters=function(){return[{type:e.ElementRef}]},r([e.Input()],t.prototype,"layout",void 0),r([e.Input()],t.prototype,"paginator",void 0),r([e.Input()],t.prototype,"rows",void 0),r([e.Input()],t.prototype,"totalRecords",void 0),r([e.Input()],t.prototype,"pageLinks",void 0),r([e.Input()],t.prototype,"rowsPerPageOptions",void 0),r([e.Input()],t.prototype,"paginatorPosition",void 0),r([e.Input()],t.prototype,"alwaysShowPaginator",void 0),r([e.Input()],t.prototype,"paginatorDropdownAppendTo",void 0),r([e.Input()],t.prototype,"paginatorDropdownScrollHeight",void 0),r([e.Input()],t.prototype,"currentPageReportTemplate",void 0),r([e.Input()],t.prototype,"showCurrentPageReport",void 0),r([e.Input()],t.prototype,"lazy",void 0),r([e.Input()],t.prototype,"emptyMessage",void 0),r([e.Output()],t.prototype,"onLazyLoad",void 0),r([e.Input()],t.prototype,"style",void 0),r([e.Input()],t.prototype,"styleClass",void 0),r([e.Input()],t.prototype,"trackBy",void 0),r([e.Input()],t.prototype,"filterBy",void 0),r([e.Input()],t.prototype,"loading",void 0),r([e.Input()],t.prototype,"loadingIcon",void 0),r([e.Input()],t.prototype,"first",void 0),r([e.Input()],t.prototype,"sortField",void 0),r([e.Input()],t.prototype,"sortOrder",void 0),r([e.Input()],t.prototype,"value",void 0),r([e.Output()],t.prototype,"onPage",void 0),r([e.Output()],t.prototype,"onSort",void 0),r([e.Output()],t.prototype,"onChangeLayout",void 0),r([e.ContentChild(a.Header)],t.prototype,"header",void 0),r([e.ContentChild(a.Footer)],t.prototype,"footer",void 0),r([e.ContentChildren(a.PrimeTemplate)],t.prototype,"templates",void 0),t=r([e.Component({selector:"p-dataView",template:'\n <div [ngClass]="{\'ui-dataview ui-widget\': true, \'ui-dataview-list\': (layout === \'list\'), \'ui-dataview-grid\': (layout === \'grid\')}" [ngStyle]="style" [class]="styleClass">\n <div class="ui-dataview-loading ui-widget-overlay" *ngIf="loading"></div>\n <div class="ui-dataview-loading-content" *ngIf="loading">\n <i [class]="\'ui-dataview-loading-icon pi-spin \' + loadingIcon"></i>\n </div>\n <div class="ui-dataview-header ui-widget-header ui-corner-top">\n <ng-content select="p-header"></ng-content>\n </div>\n <p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" [alwaysShow]="alwaysShowPaginator"\n (onPageChange)="paginate($event)" styleClass="ui-paginator-top" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && (paginatorPosition === \'top\' || paginatorPosition ==\'both\')"\n [dropdownAppendTo]="paginatorDropdownAppendTo" [dropdownScrollHeight]="paginatorDropdownScrollHeight" [templateLeft]="paginatorLeftTemplate" [templateRight]="paginatorRightTemplate"\n [currentPageReportTemplate]="currentPageReportTemplate" [showCurrentPageReport]="showCurrentPageReport"></p-paginator>\n <div class="ui-dataview-content ui-widget-content">\n <div class="ui-g">\n <ng-template ngFor let-rowData let-rowIndex="index" [ngForOf]="paginator ? ((filteredValue||value) | slice:(lazy ? 0 : first):((lazy ? 0 : first) + rows)) : (filteredValue||value)" [ngForTrackBy]="trackBy">\n <ng-container *ngTemplateOutlet="itemTemplate; context: {$implicit: rowData, rowIndex: rowIndex}"></ng-container>\n </ng-template>\n <div *ngIf="isEmpty()" class="ui-g-12 ui-dataview-emptymessage">{{emptyMessage}}</div>\n </div>\n </div>\n <p-paginator [rows]="rows" [first]="first" [totalRecords]="totalRecords" [pageLinkSize]="pageLinks" [alwaysShow]="alwaysShowPaginator"\n (onPageChange)="paginate($event)" styleClass="ui-paginator-bottom" [rowsPerPageOptions]="rowsPerPageOptions" *ngIf="paginator && (paginatorPosition === \'bottom\' || paginatorPosition ==\'both\')"\n [dropdownAppendTo]="paginatorDropdownAppendTo" [dropdownScrollHeight]="paginatorDropdownScrollHeight" [templateLeft]="paginatorLeftTemplate" [templateRight]="paginatorRightTemplate"\n [currentPageReportTemplate]="currentPageReportTemplate" [showCurrentPageReport]="showCurrentPageReport"></p-paginator>\n <div class="ui-dataview-footer ui-widget-header ui-corner-bottom" *ngIf="footer">\n <ng-content select="p-footer"></ng-content>\n </div>\n </div>\n ',changeDetection:e.ChangeDetectionStrategy.Default})],t)}(),p=function(){function t(t){this.dv=t}return t.prototype.changeLayout=function(t,e){this.dv.changeLayout(e),t.preventDefault()},t.ctorParameters=function(){return[{type:s}]},r([e.Input()],t.prototype,"style",void 0),r([e.Input()],t.prototype,"styleClass",void 0),t=r([e.Component({selector:"p-dataViewLayoutOptions",template:'\n <div [ngClass]="\'ui-dataview-layout-options ui-selectbutton ui-buttonset\'" [ngStyle]="style" [class]="styleClass">\n <a tabindex="0" class="ui-button ui-button-icon-only ui-state-default" (click)="changeLayout($event, \'list\')" (keydown.enter)="changeLayout($event, \'list\')"\n [ngClass]="{\'ui-state-active\': dv.layout === \'list\'}">\n <i class="pi pi-bars ui-button-icon-left"></i>\n <span class="ui-button-text ui-clickable">ui-btn</span>\n </a><a tabindex="0" class="ui-button ui-button-icon-only ui-state-default" (click)="changeLayout($event, \'grid\')" (keydown.enter)="changeLayout($event, \'grid\')"\n [ngClass]="{\'ui-state-active\': dv.layout === \'grid\'}">\n <i class="pi pi-th-large ui-button-icon-left"></i>\n <span class="ui-button-text ui-clickable">ui-btn</span>\n </a>\n </div>\n '})],t)}(),l=function(){function t(){}return t=r([e.NgModule({imports:[o.CommonModule,a.SharedModule,n.PaginatorModule],exports:[s,a.SharedModule,p],declarations:[s,p]})],t)}();t.DataView=s,t.DataViewLayoutOptions=p,t.DataViewModule=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=primeng-dataview.umd.min.js.map