angular2-data-table
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"name": "angular2-data-table", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "angular2-data-table is a Angular2 component for presenting large and complex data.", | ||
@@ -5,0 +5,0 @@ "main": "release/angular2-data-table.umd.js", |
@@ -0,1 +1,2 @@ | ||
import 'ts-helpers'; | ||
import { ColumnMode } from './enums/ColumnMode'; | ||
@@ -2,0 +3,0 @@ import { SortType } from './enums/SortType'; |
"use strict"; | ||
require('ts-helpers'); | ||
var core_1 = require('@angular/core'); | ||
@@ -15,4 +16,2 @@ var common_1 = require('@angular/common'); | ||
var BodyCell_1 = require('./components/body/BodyCell'); | ||
// Services | ||
var State_1 = require('./services/State'); | ||
// Directives | ||
@@ -69,5 +68,2 @@ var Visibility_1 = require('./directives/Visibility'); | ||
], | ||
providers: [ | ||
State_1.StateService | ||
], | ||
exports: [ | ||
@@ -74,0 +70,0 @@ DataTable_1.DataTable, |
@@ -1,2 +0,2 @@ | ||
"use strict";var core_1=require("@angular/core"),common_1=require("@angular/common"),DataTable_1=require("./components/DataTable"),DataTableColumn_1=require("./components/DataTableColumn"),Header_1=require("./components/header/Header"),Body_1=require("./components/body/Body"),Footer_1=require("./components/footer/Footer"),HeaderCell_1=require("./components/header/HeaderCell"),Pager_1=require("./components/footer/Pager"),BodyRow_1=require("./components/body/BodyRow"),ProgressBar_1=require("./components/body/ProgressBar"),BodyCell_1=require("./components/body/BodyCell"),State_1=require("./services/State"),Visibility_1=require("./directives/Visibility"),LongPress_1=require("./directives/LongPress"),Resizeable_1=require("./directives/Resizeable"),Orderable_1=require("./directives/Orderable"),Draggable_1=require("./directives/Draggable"),Scroller_1=require("./directives/Scroller"),TemplateWrapper_1=require("./directives/TemplateWrapper"),ColumnMode_1=require("./enums/ColumnMode");exports.ColumnMode=ColumnMode_1.ColumnMode;var SortType_1=require("./enums/SortType");exports.SortType=SortType_1.SortType;var SortDirection_1=require("./enums/SortDirection");exports.SortDirection=SortDirection_1.SortDirection;var SelectionType_1=require("./enums/SelectionType");exports.SelectionType=SelectionType_1.SelectionType;var TableOptions_1=require("./models/TableOptions");exports.TableOptions=TableOptions_1.TableOptions;var TableColumn_1=require("./models/TableColumn");exports.TableColumn=TableColumn_1.TableColumn;var Sort_1=require("./models/Sort");exports.Sort=Sort_1.Sort;var Angular2DataTableModule=function(){function e(){}return e=__decorate([core_1.NgModule({imports:[common_1.CommonModule],declarations:[Visibility_1.Visibility,Draggable_1.Draggable,Resizeable_1.Resizeable,Orderable_1.Orderable,LongPress_1.LongPress,TemplateWrapper_1.TemplateWrapper,Scroller_1.Scroller,DataTable_1.DataTable,DataTableColumn_1.DataTableColumn,Header_1.DataTableHeader,HeaderCell_1.DataTableHeaderCell,Body_1.DataTableBody,Footer_1.DataTableFooter,Pager_1.DataTablePager,ProgressBar_1.ProgressBar,BodyRow_1.DataTableBodyRow,BodyCell_1.DataTableBodyCell],providers:[State_1.StateService],exports:[DataTable_1.DataTable,DataTableColumn_1.DataTableColumn]}),__metadata("design:paramtypes",[])],e)}();exports.Angular2DataTableModule=Angular2DataTableModule; | ||
"use strict";require("ts-helpers");var core_1=require("@angular/core"),common_1=require("@angular/common"),DataTable_1=require("./components/DataTable"),DataTableColumn_1=require("./components/DataTableColumn"),Header_1=require("./components/header/Header"),Body_1=require("./components/body/Body"),Footer_1=require("./components/footer/Footer"),HeaderCell_1=require("./components/header/HeaderCell"),Pager_1=require("./components/footer/Pager"),BodyRow_1=require("./components/body/BodyRow"),ProgressBar_1=require("./components/body/ProgressBar"),BodyCell_1=require("./components/body/BodyCell"),Visibility_1=require("./directives/Visibility"),LongPress_1=require("./directives/LongPress"),Resizeable_1=require("./directives/Resizeable"),Orderable_1=require("./directives/Orderable"),Draggable_1=require("./directives/Draggable"),Scroller_1=require("./directives/Scroller"),TemplateWrapper_1=require("./directives/TemplateWrapper"),ColumnMode_1=require("./enums/ColumnMode");exports.ColumnMode=ColumnMode_1.ColumnMode;var SortType_1=require("./enums/SortType");exports.SortType=SortType_1.SortType;var SortDirection_1=require("./enums/SortDirection");exports.SortDirection=SortDirection_1.SortDirection;var SelectionType_1=require("./enums/SelectionType");exports.SelectionType=SelectionType_1.SelectionType;var TableOptions_1=require("./models/TableOptions");exports.TableOptions=TableOptions_1.TableOptions;var TableColumn_1=require("./models/TableColumn");exports.TableColumn=TableColumn_1.TableColumn;var Sort_1=require("./models/Sort");exports.Sort=Sort_1.Sort;var Angular2DataTableModule=function(){function e(){}return e=__decorate([core_1.NgModule({imports:[common_1.CommonModule],declarations:[Visibility_1.Visibility,Draggable_1.Draggable,Resizeable_1.Resizeable,Orderable_1.Orderable,LongPress_1.LongPress,TemplateWrapper_1.TemplateWrapper,Scroller_1.Scroller,DataTable_1.DataTable,DataTableColumn_1.DataTableColumn,Header_1.DataTableHeader,HeaderCell_1.DataTableHeaderCell,Body_1.DataTableBody,Footer_1.DataTableFooter,Pager_1.DataTablePager,ProgressBar_1.ProgressBar,BodyRow_1.DataTableBodyRow,BodyCell_1.DataTableBodyCell],exports:[DataTable_1.DataTable,DataTableColumn_1.DataTableColumn]}),__metadata("design:paramtypes",[])],e)}();exports.Angular2DataTableModule=Angular2DataTableModule; | ||
//# sourceMappingURL=release/angular2-data-table.js.map |
@@ -13,5 +13,5 @@ import { EventEmitter, OnInit, OnDestroy, ElementRef } from '@angular/core'; | ||
readonly selectEnabled: boolean; | ||
constructor(state: StateService, element: ElementRef); | ||
readonly bodyHeight: string; | ||
readonly bodyWidth: string; | ||
constructor(state: StateService, element: ElementRef); | ||
ngOnInit(): void; | ||
@@ -18,0 +18,0 @@ onBodyScroll(props: any): void; |
@@ -96,3 +96,8 @@ "use strict"; | ||
this.state.setPage(action); | ||
this.onPageChange.emit(action.value); | ||
this.onPageChange.emit({ | ||
page: action.value, | ||
offset: this.state.options.offset, | ||
limit: this.state.pageSize, | ||
count: this.state.rowCount | ||
}); | ||
}; | ||
@@ -208,4 +213,6 @@ DataTable.prototype.onRowSelect = function (event) { | ||
selector: 'datatable', | ||
providers: [State_1.StateService], | ||
template: "\n <div\n visibility-observer\n (onVisibilityChange)=\"adjustSizes()\">\n <datatable-header\n (onColumnChange)=\"onColumnChange.emit($event)\">\n </datatable-header>\n <datatable-body\n (onRowClick)=\"onRowClick.emit($event)\"\n (onRowSelect)=\"onRowSelect($event)\">\n </datatable-body>\n <datatable-footer\n (onPageChange)=\"onPageChanged($event)\">\n </datatable-footer>\n </div>\n " | ||
}), | ||
}), | ||
__param(0, core_1.Host()), | ||
__metadata('design:paramtypes', [State_1.StateService, core_1.ElementRef, core_1.KeyValueDiffers]) | ||
@@ -212,0 +219,0 @@ ], DataTable); |
@@ -34,5 +34,5 @@ | ||
}; | ||
setSelected(selected: any[]): this; | ||
setRows(rows: Array<any>): this; | ||
setOptions(options: TableOptions): this; | ||
setSelected(selected: any[]): StateService; | ||
setRows(rows: Array<any>): StateService; | ||
setOptions(options: TableOptions): StateService; | ||
setPage({type, value}: { | ||
@@ -39,0 +39,0 @@ type: any; |
@@ -0,1 +1,2 @@ | ||
import 'ts-helpers'; | ||
import { NgModule } from '@angular/core'; | ||
@@ -16,5 +17,2 @@ import { CommonModule } from '@angular/common'; | ||
// Services | ||
import { StateService } from './services/State'; | ||
// Directives | ||
@@ -63,5 +61,2 @@ import { Visibility } from './directives/Visibility'; | ||
], | ||
providers: [ | ||
StateService | ||
], | ||
exports: [ | ||
@@ -68,0 +63,0 @@ DataTable, |
@@ -71,6 +71,2 @@ import { | ||
constructor(public state: StateService, element: ElementRef) { | ||
element.nativeElement.classList.add('datatable-body'); | ||
} | ||
@HostBinding('style.height') | ||
@@ -94,2 +90,6 @@ get bodyHeight() { | ||
constructor(public state: StateService, element: ElementRef) { | ||
element.nativeElement.classList.add('datatable-body'); | ||
} | ||
ngOnInit(): void { | ||
@@ -96,0 +96,0 @@ this.rows = [...this.state.rows]; |
@@ -15,3 +15,4 @@ import { | ||
IterableDiffer, | ||
HostBinding | ||
HostBinding, | ||
Host | ||
} from '@angular/core'; | ||
@@ -28,2 +29,3 @@ | ||
selector: 'datatable', | ||
providers: [StateService], | ||
template: ` | ||
@@ -65,3 +67,3 @@ <div | ||
constructor( | ||
public state: StateService, | ||
@Host() public state: StateService, | ||
element: ElementRef, | ||
@@ -160,3 +162,9 @@ differs: KeyValueDiffers) { | ||
this.state.setPage(action); | ||
this.onPageChange.emit(action.value); | ||
this.onPageChange.emit({ | ||
page: action.value, | ||
offset: this.state.options.offset, | ||
limit: this.state.pageSize, | ||
count: this.state.rowCount | ||
}); | ||
} | ||
@@ -163,0 +171,0 @@ |
@@ -16,9 +16,8 @@ import { NgModule, ApplicationRef } from '@angular/core'; | ||
// import { App } from './details'; | ||
import { App } from './virtual'; | ||
// import { App } from './virtual'; | ||
// import { App } from './inline'; | ||
// import { App } from './scrolling'; | ||
// import { App } from './pinning'; | ||
// import { App } from './multiple'; | ||
import { App } from './multiple'; | ||
@NgModule({ | ||
@@ -25,0 +24,0 @@ declarations: [App], |
@@ -44,5 +44,5 @@ import { Component } from '@angular/core'; | ||
columnMode: ColumnMode.force, | ||
headerHeight: 30, | ||
headerHeight: 50, | ||
footerHeight: 0, | ||
rowHeight: 50, | ||
rowHeight: 100, | ||
columns: [ | ||
@@ -49,0 +49,0 @@ new TableColumn({ prop: 'name' }), |
import 'core-js/es6'; | ||
import 'core-js/es7/reflect'; | ||
import 'ts-helpers'; | ||
import 'zone.js/dist/zone'; | ||
@@ -5,0 +4,0 @@ |
@@ -37,3 +37,3 @@ import { Injectable, EventEmitter } from '@angular/core'; | ||
get rowCount() { | ||
get rowCount(): number { | ||
if (!this.options.externalPaging) { | ||
@@ -46,3 +46,3 @@ return this.rows.length; | ||
get pageSize() { | ||
get pageSize(): number { | ||
if (this.options.scrollbarV) { | ||
@@ -73,3 +73,3 @@ return Math.ceil(this.bodyHeight / this.options.rowHeight) + 1; | ||
setSelected(selected: any[]) { | ||
setSelected(selected: any[]): StateService { | ||
if (!this.selected) { | ||
@@ -83,6 +83,7 @@ this.selected = selected || []; | ||
this.onSelectionChange.emit(this.selected); | ||
return this; | ||
} | ||
setRows(rows: Array<any>) { | ||
setRows(rows: Array<any>): StateService { | ||
if (rows) { | ||
@@ -95,3 +96,3 @@ this.rows = [...rows]; | ||
setOptions(options: TableOptions) { | ||
setOptions(options: TableOptions): StateService { | ||
this.options = options; | ||
@@ -101,3 +102,3 @@ return this; | ||
setPage({ type, value }) { | ||
setPage({ type, value }): void { | ||
this.options.offset = value - 1; | ||
@@ -113,3 +114,3 @@ | ||
nextSort(column: TableColumn) { | ||
nextSort(column: TableColumn): void { | ||
const idx = this.options.sorts.findIndex(s => { | ||
@@ -116,0 +117,0 @@ return s.prop === column.prop; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3031084
113804