@den4ik92/ng2-smart-table 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/den4ik92-ng2-smart-table.mjs +5 -0
- package/esm2020/lib/components/cell/cell-edit-mode/custom-edit.component.mjs +50 -0
- package/esm2020/lib/components/cell/cell-edit-mode/default-edit.component.mjs +84 -0
- package/esm2020/lib/components/cell/cell-edit-mode/edit-cell-default.mjs +35 -0
- package/esm2020/lib/components/cell/cell-edit-mode/edit-cell.component.mjs +75 -0
- package/esm2020/lib/components/cell/cell-editors/checkbox-editor.component.mjs +37 -0
- package/esm2020/lib/components/cell/cell-editors/completer-editor.component.mjs +38 -0
- package/esm2020/lib/components/cell/cell-editors/default-editor.mjs +29 -0
- package/esm2020/lib/components/cell/cell-editors/input-editor.component.mjs +33 -0
- package/esm2020/lib/components/cell/cell-editors/select-editor.component.mjs +55 -0
- package/esm2020/lib/components/cell/cell-editors/textarea-editor.component.mjs +35 -0
- package/esm2020/lib/components/cell/cell-view-mode/custom-view.component.mjs +63 -0
- package/esm2020/lib/components/cell/cell-view-mode/view-cell.component.mjs +59 -0
- package/esm2020/lib/components/cell/cell-view-mode/view-cell.mjs +2 -0
- package/esm2020/lib/components/cell/cell.component.mjs +82 -0
- package/esm2020/lib/components/cell/cell.module.mjs +80 -0
- package/esm2020/lib/components/filter/custom-filter.component.mjs +53 -0
- package/esm2020/lib/components/filter/default-filter.component.mjs +100 -0
- package/esm2020/lib/components/filter/filter-default.mjs +35 -0
- package/esm2020/lib/components/filter/filter-types/checkbox-filter.component.mjs +65 -0
- package/esm2020/lib/components/filter/filter-types/completer-filter.component.mjs +52 -0
- package/esm2020/lib/components/filter/filter-types/default-filter.mjs +34 -0
- package/esm2020/lib/components/filter/filter-types/input-filter.component.mjs +51 -0
- package/esm2020/lib/components/filter/filter-types/select-filter.component.mjs +71 -0
- package/esm2020/lib/components/filter/filter.component.mjs +91 -0
- package/esm2020/lib/components/filter/filter.module.mjs +67 -0
- package/esm2020/lib/components/pager/pager.component.mjs +284 -0
- package/esm2020/lib/components/pager/pager.module.mjs +29 -0
- package/esm2020/lib/components/tbody/cells/create-cancel.component.mjs +52 -0
- package/esm2020/lib/components/tbody/cells/custom.component.mjs +56 -0
- package/esm2020/lib/components/tbody/cells/edit-delete.component.mjs +103 -0
- package/esm2020/lib/components/tbody/tbody.component.mjs +206 -0
- package/esm2020/lib/components/tbody/tbody.module.mjs +48 -0
- package/esm2020/lib/components/thead/cells/actions-title.component.mjs +36 -0
- package/esm2020/lib/components/thead/cells/actions.component.mjs +44 -0
- package/esm2020/lib/components/thead/cells/add-button.component.mjs +63 -0
- package/esm2020/lib/components/thead/cells/checkbox-select-all.component.mjs +28 -0
- package/esm2020/lib/components/thead/cells/column-title.component.mjs +37 -0
- package/esm2020/lib/components/thead/cells/title/title.component.mjs +100 -0
- package/esm2020/lib/components/thead/rows/thead-filters-row.component.mjs +105 -0
- package/esm2020/lib/components/thead/rows/thead-form-row.component.mjs +108 -0
- package/esm2020/lib/components/thead/rows/thead-titles-row.component.mjs +103 -0
- package/esm2020/lib/components/thead/thead.component.mjs +76 -0
- package/esm2020/lib/components/thead/thead.module.mjs +76 -0
- package/esm2020/lib/lib/data-set/cell.mjs +41 -0
- package/esm2020/lib/lib/data-set/column.mjs +75 -0
- package/esm2020/lib/lib/data-set/data-set.mjs +98 -0
- package/esm2020/lib/lib/data-set/row.mjs +46 -0
- package/esm2020/lib/lib/data-source/data-source.mjs +101 -0
- package/esm2020/lib/lib/data-source/local/local.data-source.mjs +228 -0
- package/esm2020/lib/lib/data-source/local/local.filter.mjs +13 -0
- package/esm2020/lib/lib/data-source/local/local.pager.mjs +6 -0
- package/esm2020/lib/lib/data-source/local/local.sorter.mjs +19 -0
- package/esm2020/lib/lib/data-source/server/server-source.conf.mjs +20 -0
- package/esm2020/lib/lib/data-source/server/server.data-source.mjs +93 -0
- package/esm2020/lib/lib/grid.mjs +220 -0
- package/esm2020/lib/lib/helpers.mjs +84 -0
- package/esm2020/lib/lib/interfaces/smart-table.models.mjs +2 -0
- package/esm2020/lib/ng2-smart-table.component.mjs +203 -0
- package/esm2020/lib/ng2-smart-table.module.mjs +52 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/den4ik92-ng2-smart-table.mjs +4329 -0
- package/fesm2015/den4ik92-ng2-smart-table.mjs.map +1 -0
- package/fesm2020/den4ik92-ng2-smart-table.mjs +3949 -0
- package/fesm2020/den4ik92-ng2-smart-table.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/cell/cell-edit-mode/custom-edit.component.d.ts +13 -0
- package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +8 -0
- package/lib/components/cell/cell-edit-mode/edit-cell-default.d.ts +13 -0
- package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +12 -0
- package/lib/components/cell/cell-editors/checkbox-editor.component.d.ts +8 -0
- package/lib/components/cell/cell-editors/completer-editor.component.d.ts +13 -0
- package/lib/components/cell/cell-editors/default-editor.d.ts +19 -0
- package/lib/components/cell/cell-editors/input-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-editors/select-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-editors/textarea-editor.component.d.ts +7 -0
- package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +19 -0
- package/lib/components/cell/cell-view-mode/view-cell.component.d.ts +7 -0
- package/lib/components/cell/cell-view-mode/view-cell.d.ts +4 -0
- package/lib/components/cell/cell.component.d.ts +20 -0
- package/lib/components/cell/cell.module.d.ts +21 -0
- package/lib/components/filter/custom-filter.component.d.ts +14 -0
- package/lib/components/filter/default-filter.component.d.ts +7 -0
- package/lib/components/filter/filter-default.d.ts +14 -0
- package/lib/components/filter/filter-types/checkbox-filter.component.d.ts +13 -0
- package/lib/components/filter/filter-types/completer-filter.component.d.ts +12 -0
- package/lib/components/filter/filter-types/default-filter.d.ts +24 -0
- package/lib/components/filter/filter-types/input-filter.component.d.ts +12 -0
- package/lib/components/filter/filter-types/select-filter.component.d.ts +11 -0
- package/lib/components/filter/filter.component.d.ts +11 -0
- package/lib/components/filter/filter.module.d.ts +17 -0
- package/lib/components/pager/pager.component.d.ts +35 -0
- package/lib/components/pager/pager.module.d.ts +9 -0
- package/lib/components/tbody/cells/create-cancel.component.d.ts +16 -0
- package/lib/components/tbody/cells/custom.component.d.ts +13 -0
- package/lib/components/tbody/cells/edit-delete.component.d.ts +24 -0
- package/lib/components/tbody/tbody.component.d.ts +37 -0
- package/lib/components/tbody/tbody.module.d.ts +13 -0
- package/lib/components/thead/cells/actions-title.component.d.ts +13 -0
- package/lib/components/thead/cells/actions.component.d.ts +12 -0
- package/lib/components/thead/cells/add-button.component.d.ts +18 -0
- package/lib/components/thead/cells/checkbox-select-all.component.d.ts +9 -0
- package/lib/components/thead/cells/column-title.component.d.ts +11 -0
- package/lib/components/thead/cells/title/title.component.d.ts +17 -0
- package/lib/components/thead/rows/thead-filters-row.component.d.ts +19 -0
- package/lib/components/thead/rows/thead-form-row.component.d.ts +20 -0
- package/lib/components/thead/rows/thead-titles-row.component.d.ts +18 -0
- package/lib/components/thead/thead.component.d.ts +18 -0
- package/lib/components/thead/thead.module.d.ts +20 -0
- package/lib/lib/data-set/cell.d.ts +20 -0
- package/lib/lib/data-set/column.d.ts +44 -0
- package/lib/lib/data-set/data-set.d.ts +37 -0
- package/lib/lib/data-set/row.d.ts +20 -0
- package/lib/lib/data-source/data-source.d.ts +35 -0
- package/lib/lib/data-source/local/local.data-source.d.ts +55 -0
- package/lib/lib/data-source/local/local.filter.d.ts +4 -0
- package/lib/lib/data-source/local/local.pager.d.ts +3 -0
- package/lib/lib/data-source/local/local.sorter.d.ts +4 -0
- package/lib/lib/data-source/server/server-source.conf.d.ts +27 -0
- package/lib/lib/data-source/server/server.data-source.d.ts +30 -0
- package/lib/lib/grid.d.ts +49 -0
- package/lib/lib/helpers.d.ts +18 -0
- package/lib/lib/interfaces/smart-table.models.d.ts +148 -0
- package/lib/ng2-smart-table.component.d.ts +43 -0
- package/lib/ng2-smart-table.module.d.ts +14 -0
- package/package.json +35 -0
- package/public-api.d.ts +8 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { Grid } from '../../../lib/grid';
|
|
3
|
+
import { DataSource } from '../../../lib/data-source/data-source';
|
|
4
|
+
import { Column } from "../../../lib/data-set/column";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class TheadFitlersRowComponent implements OnChanges {
|
|
7
|
+
grid: Grid;
|
|
8
|
+
source: DataSource;
|
|
9
|
+
create: EventEmitter<any>;
|
|
10
|
+
filter: EventEmitter<any>;
|
|
11
|
+
isMultiSelectVisible: boolean;
|
|
12
|
+
showActionColumnLeft: boolean;
|
|
13
|
+
showActionColumnRight: boolean;
|
|
14
|
+
filterInputClass: string;
|
|
15
|
+
ngOnChanges(): void;
|
|
16
|
+
getVisibleColumns(columns: Array<Column>): Array<Column>;
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TheadFitlersRowComponent, never>;
|
|
18
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TheadFitlersRowComponent, "[ng2-st-thead-filters-row]", never, { "grid": "grid"; "source": "source"; }, { "create": "create"; "filter": "filter"; }, never, never, false, never>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { Grid } from '../../../lib/grid';
|
|
3
|
+
import { Row } from '../../../lib/data-set/row';
|
|
4
|
+
import { Cell } from '../../../lib/data-set/cell';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class TheadFormRowComponent implements OnChanges {
|
|
7
|
+
grid: Grid;
|
|
8
|
+
row: Row;
|
|
9
|
+
createConfirm: EventEmitter<any>;
|
|
10
|
+
create: EventEmitter<any>;
|
|
11
|
+
isMultiSelectVisible: boolean;
|
|
12
|
+
showActionColumnLeft: boolean;
|
|
13
|
+
showActionColumnRight: boolean;
|
|
14
|
+
addInputClass: string;
|
|
15
|
+
onCreate(event: any): void;
|
|
16
|
+
ngOnChanges(): void;
|
|
17
|
+
getVisibleCells(cells: Array<Cell>): Array<Cell>;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TheadFormRowComponent, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TheadFormRowComponent, "[ng2-st-thead-form-row]", never, { "grid": "grid"; "row": "row"; "createConfirm": "createConfirm"; }, { "create": "create"; }, never, never, false, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { Grid } from '../../../lib/grid';
|
|
3
|
+
import { DataSource } from '../../../lib/data-source/data-source';
|
|
4
|
+
import { Column } from "../../../lib/data-set/column";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class TheadTitlesRowComponent implements OnChanges {
|
|
7
|
+
grid: Grid;
|
|
8
|
+
source: DataSource;
|
|
9
|
+
sort: EventEmitter<any>;
|
|
10
|
+
selectAllRows: EventEmitter<any>;
|
|
11
|
+
isMultiSelectVisible: boolean;
|
|
12
|
+
showActionColumnLeft: boolean;
|
|
13
|
+
showActionColumnRight: boolean;
|
|
14
|
+
ngOnChanges(): void;
|
|
15
|
+
getVisibleColumns(columns: Array<Column>): Array<Column>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TheadTitlesRowComponent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TheadTitlesRowComponent, "[ng2-st-thead-titles-row]", never, { "grid": "grid"; "source": "source"; }, { "sort": "sort"; "selectAllRows": "selectAllRows"; }, never, never, false, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { Grid } from '../../lib/grid';
|
|
3
|
+
import { DataSource } from '../../lib/data-source/data-source';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class Ng2SmartTableTheadComponent implements OnChanges {
|
|
6
|
+
grid: Grid;
|
|
7
|
+
source: DataSource;
|
|
8
|
+
createConfirm: EventEmitter<any>;
|
|
9
|
+
sort: EventEmitter<any>;
|
|
10
|
+
selectAllRows: EventEmitter<any>;
|
|
11
|
+
create: EventEmitter<any>;
|
|
12
|
+
filter: EventEmitter<any>;
|
|
13
|
+
isHideHeader: boolean;
|
|
14
|
+
isHideSubHeader: boolean;
|
|
15
|
+
ngOnChanges(): void;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Ng2SmartTableTheadComponent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Ng2SmartTableTheadComponent, "[ng2-st-thead]", never, { "grid": "grid"; "source": "source"; "createConfirm": "createConfirm"; }, { "sort": "sort"; "selectAllRows": "selectAllRows"; "create": "create"; "filter": "filter"; }, never, never, false, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./cells/actions.component";
|
|
3
|
+
import * as i2 from "./cells/actions-title.component";
|
|
4
|
+
import * as i3 from "./cells/add-button.component";
|
|
5
|
+
import * as i4 from "./cells/checkbox-select-all.component";
|
|
6
|
+
import * as i5 from "./cells/column-title.component";
|
|
7
|
+
import * as i6 from "./cells/title/title.component";
|
|
8
|
+
import * as i7 from "./rows/thead-filters-row.component";
|
|
9
|
+
import * as i8 from "./rows/thead-form-row.component";
|
|
10
|
+
import * as i9 from "./rows/thead-titles-row.component";
|
|
11
|
+
import * as i10 from "./thead.component";
|
|
12
|
+
import * as i11 from "@angular/common";
|
|
13
|
+
import * as i12 from "@angular/forms";
|
|
14
|
+
import * as i13 from "../filter/filter.module";
|
|
15
|
+
import * as i14 from "../cell/cell.module";
|
|
16
|
+
export declare class THeadModule {
|
|
17
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<THeadModule, never>;
|
|
18
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<THeadModule, [typeof i1.ActionsComponent, typeof i2.ActionsTitleComponent, typeof i3.AddButtonComponent, typeof i4.CheckboxSelectAllComponent, typeof i5.ColumnTitleComponent, typeof i6.TitleComponent, typeof i7.TheadFitlersRowComponent, typeof i8.TheadFormRowComponent, typeof i9.TheadTitlesRowComponent, typeof i10.Ng2SmartTableTheadComponent], [typeof i11.CommonModule, typeof i12.FormsModule, typeof i13.FilterModule, typeof i14.CellModule], [typeof i1.ActionsComponent, typeof i2.ActionsTitleComponent, typeof i3.AddButtonComponent, typeof i4.CheckboxSelectAllComponent, typeof i5.ColumnTitleComponent, typeof i6.TitleComponent, typeof i7.TheadFitlersRowComponent, typeof i8.TheadFormRowComponent, typeof i9.TheadTitlesRowComponent, typeof i10.Ng2SmartTableTheadComponent]>;
|
|
19
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<THeadModule>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Column } from './column';
|
|
2
|
+
import { DataSet } from './data-set';
|
|
3
|
+
import { Row } from './row';
|
|
4
|
+
export declare function prepareValue(value: any): any;
|
|
5
|
+
export declare class Cell {
|
|
6
|
+
protected value: any;
|
|
7
|
+
protected row: Row;
|
|
8
|
+
protected column: any;
|
|
9
|
+
protected dataSet: DataSet;
|
|
10
|
+
newValue: any;
|
|
11
|
+
protected static PREPARE: typeof prepareValue;
|
|
12
|
+
constructor(value: any, row: Row, column: any, dataSet: DataSet);
|
|
13
|
+
getColumn(): Column;
|
|
14
|
+
getRow(): Row;
|
|
15
|
+
getValue(): any;
|
|
16
|
+
setValue(value: any): any;
|
|
17
|
+
getId(): string;
|
|
18
|
+
getTitle(): string;
|
|
19
|
+
isEditable(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DataSet } from './data-set';
|
|
2
|
+
export declare class Column {
|
|
3
|
+
id: string;
|
|
4
|
+
protected settings: any;
|
|
5
|
+
protected dataSet: DataSet;
|
|
6
|
+
title: string;
|
|
7
|
+
type: string;
|
|
8
|
+
class: string;
|
|
9
|
+
width: string;
|
|
10
|
+
hide: boolean;
|
|
11
|
+
isSortable: boolean;
|
|
12
|
+
isEditable: boolean;
|
|
13
|
+
isAddable: boolean;
|
|
14
|
+
isFilterable: boolean;
|
|
15
|
+
sortDirection: string;
|
|
16
|
+
defaultSortDirection: string;
|
|
17
|
+
editor: {
|
|
18
|
+
type: string;
|
|
19
|
+
config: any;
|
|
20
|
+
component: any;
|
|
21
|
+
};
|
|
22
|
+
filter: {
|
|
23
|
+
type: string;
|
|
24
|
+
config: any;
|
|
25
|
+
component: any;
|
|
26
|
+
};
|
|
27
|
+
renderComponent: any;
|
|
28
|
+
compareFunction: Function;
|
|
29
|
+
valuePrepareFunction: Function;
|
|
30
|
+
filterFunction: Function;
|
|
31
|
+
onComponentInitFunction: Function;
|
|
32
|
+
constructor(id: string, settings: any, dataSet: DataSet);
|
|
33
|
+
getOnComponentInitFunction(): Function;
|
|
34
|
+
getCompareFunction(): Function;
|
|
35
|
+
getValuePrepareFunction(): Function;
|
|
36
|
+
getFilterFunction(): Function;
|
|
37
|
+
getConfig(): any;
|
|
38
|
+
getFilterType(): any;
|
|
39
|
+
getFilterConfig(): any;
|
|
40
|
+
protected process(): void;
|
|
41
|
+
prepareType(): string;
|
|
42
|
+
prepareSortDirection(): string;
|
|
43
|
+
determineType(): string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Row } from './row';
|
|
2
|
+
import { Column } from './column';
|
|
3
|
+
export declare class DataSet {
|
|
4
|
+
protected columnSettings: Object;
|
|
5
|
+
newRow: Row;
|
|
6
|
+
protected data: Array<any>;
|
|
7
|
+
protected columns: Array<Column>;
|
|
8
|
+
protected rows: Array<Row>;
|
|
9
|
+
protected selectedRows: Set<Row>;
|
|
10
|
+
protected willSelect: string;
|
|
11
|
+
constructor(data: Array<any>, columnSettings: Object);
|
|
12
|
+
setData(data: Array<any>): void;
|
|
13
|
+
getColumns(): Array<Column>;
|
|
14
|
+
getRows(): Array<Row>;
|
|
15
|
+
getFirstRow(): Row;
|
|
16
|
+
getLastRow(): Row;
|
|
17
|
+
findRowByData(data: any): Row;
|
|
18
|
+
setSelectAll(state: boolean): void;
|
|
19
|
+
deselectAll(): void;
|
|
20
|
+
selectRow(row: Row, state: boolean): void;
|
|
21
|
+
multipleSelectRow(row: Row): Row;
|
|
22
|
+
getSelectedRowsData(): Array<any>;
|
|
23
|
+
createNewRow(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Create columns by mapping from the settings
|
|
26
|
+
* @param settings
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
createColumns(settings: any): void;
|
|
30
|
+
/**
|
|
31
|
+
* Create rows based on current data prepared in data source
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
createRows(): void;
|
|
35
|
+
get isAllSelected(): boolean;
|
|
36
|
+
private storeSelectedRow;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Cell } from './cell';
|
|
2
|
+
import { Column } from './column';
|
|
3
|
+
import { DataSet } from './data-set';
|
|
4
|
+
export declare class Row {
|
|
5
|
+
index: number;
|
|
6
|
+
protected data: any;
|
|
7
|
+
protected _dataSet: DataSet;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
isInEditing: boolean;
|
|
10
|
+
cells: Array<Cell>;
|
|
11
|
+
constructor(index: number, data: any, _dataSet: DataSet);
|
|
12
|
+
getCell(column: Column): Cell;
|
|
13
|
+
getCells(): Cell[];
|
|
14
|
+
getData(): any;
|
|
15
|
+
getIsSelected(): boolean;
|
|
16
|
+
getNewData(): any;
|
|
17
|
+
setData(data: any): any;
|
|
18
|
+
process(): void;
|
|
19
|
+
createCell(column: Column): Cell;
|
|
20
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export declare abstract class DataSource {
|
|
4
|
+
protected onChangedSource: Subject<any>;
|
|
5
|
+
protected onAddedSource: Subject<any>;
|
|
6
|
+
protected onUpdatedSource: Subject<any>;
|
|
7
|
+
protected onRemovedSource: Subject<any>;
|
|
8
|
+
abstract getAll(): Promise<any>;
|
|
9
|
+
abstract getElements(): Promise<any>;
|
|
10
|
+
abstract getSort(): any;
|
|
11
|
+
abstract getFilter(): any;
|
|
12
|
+
abstract getPaging(): any;
|
|
13
|
+
abstract count(): number;
|
|
14
|
+
refresh(): void;
|
|
15
|
+
load(data: Array<any>): Promise<any>;
|
|
16
|
+
onChanged(): Observable<any>;
|
|
17
|
+
onAdded(): Observable<any>;
|
|
18
|
+
onUpdated(): Observable<any>;
|
|
19
|
+
onRemoved(): Observable<any>;
|
|
20
|
+
prepend(element: any): Promise<any>;
|
|
21
|
+
append(element: any): Promise<any>;
|
|
22
|
+
add(element: any): Promise<any>;
|
|
23
|
+
remove(element: any): Promise<any>;
|
|
24
|
+
update(element: any, values: any): Promise<any>;
|
|
25
|
+
empty(): Promise<any>;
|
|
26
|
+
setSort(conf: Array<any>, doEmit?: boolean): void;
|
|
27
|
+
setFilter(conf: Array<any>, andOperator?: boolean, doEmit?: boolean): void;
|
|
28
|
+
addFilter(fieldConf: {}, andOperator?: boolean, doEmit?: boolean): void;
|
|
29
|
+
setPaging(page: number, perPage: number, doEmit?: boolean): void;
|
|
30
|
+
setPage(page: number, doEmit?: boolean): void;
|
|
31
|
+
protected emitOnRemoved(element: any): void;
|
|
32
|
+
protected emitOnUpdated(element: any): void;
|
|
33
|
+
protected emitOnAdded(element: any): void;
|
|
34
|
+
protected emitOnChanged(action: string): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DataSource } from '../data-source';
|
|
2
|
+
export declare class LocalDataSource extends DataSource {
|
|
3
|
+
protected data: Array<any>;
|
|
4
|
+
protected filteredAndSorted: Array<any>;
|
|
5
|
+
protected sortConf: Array<any>;
|
|
6
|
+
protected filterConf: any;
|
|
7
|
+
protected pagingConf: any;
|
|
8
|
+
constructor(data?: Array<any>);
|
|
9
|
+
load(data: Array<any>): Promise<any>;
|
|
10
|
+
prepend(element: any): Promise<any>;
|
|
11
|
+
append(element: any): Promise<any>;
|
|
12
|
+
add(element: any): Promise<any>;
|
|
13
|
+
remove(element: any): Promise<any>;
|
|
14
|
+
update(element: any, values: any): Promise<any>;
|
|
15
|
+
find(element: any): Promise<any>;
|
|
16
|
+
getElements(): Promise<any>;
|
|
17
|
+
getFilteredAndSorted(): Promise<any>;
|
|
18
|
+
getAll(): Promise<any>;
|
|
19
|
+
reset(silent?: boolean): void;
|
|
20
|
+
empty(): Promise<any>;
|
|
21
|
+
count(): number;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* Array of conf objects
|
|
25
|
+
* [
|
|
26
|
+
* {field: string, direction: asc|desc|null, compare: Function|null},
|
|
27
|
+
* ]
|
|
28
|
+
* @param conf
|
|
29
|
+
* @param doEmit
|
|
30
|
+
* @returns {LocalDataSource}
|
|
31
|
+
*/
|
|
32
|
+
setSort(conf: Array<any>, doEmit?: boolean): LocalDataSource;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* Array of conf objects
|
|
36
|
+
* [
|
|
37
|
+
* {field: string, search: string, filter: Function|null},
|
|
38
|
+
* ]
|
|
39
|
+
* @param conf
|
|
40
|
+
* @param andOperator
|
|
41
|
+
* @param doEmit
|
|
42
|
+
* @returns {LocalDataSource}
|
|
43
|
+
*/
|
|
44
|
+
setFilter(conf: Array<any>, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
|
|
45
|
+
addFilter(fieldConf: any, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
|
|
46
|
+
setPaging(page: number, perPage: number, doEmit?: boolean): LocalDataSource;
|
|
47
|
+
setPage(page: number, doEmit?: boolean): LocalDataSource;
|
|
48
|
+
getSort(): any;
|
|
49
|
+
getFilter(): any;
|
|
50
|
+
getPaging(): any;
|
|
51
|
+
protected prepareData(data: Array<any>): Array<any>;
|
|
52
|
+
protected sort(data: Array<any>): Array<any>;
|
|
53
|
+
protected filter(data: Array<any>): Array<any>;
|
|
54
|
+
protected paginate(data: Array<any>): Array<any>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare class ServerSourceConf {
|
|
2
|
+
protected static readonly SORT_FIELD_KEY = "_sort";
|
|
3
|
+
protected static readonly SORT_DIR_KEY = "_order";
|
|
4
|
+
protected static readonly PAGER_PAGE_KEY = "_page";
|
|
5
|
+
protected static readonly PAGER_LIMIT_KEY = "_limit";
|
|
6
|
+
protected static readonly FILTER_FIELD_KEY = "#field#_like";
|
|
7
|
+
protected static readonly TOTAL_KEY = "x-total-count";
|
|
8
|
+
protected static readonly DATA_KEY = "";
|
|
9
|
+
endPoint: string;
|
|
10
|
+
sortFieldKey: string;
|
|
11
|
+
sortDirKey: string;
|
|
12
|
+
pagerPageKey: string;
|
|
13
|
+
pagerLimitKey: string;
|
|
14
|
+
filterFieldKey: string;
|
|
15
|
+
totalKey: string;
|
|
16
|
+
dataKey: string;
|
|
17
|
+
constructor({ endPoint, sortFieldKey, sortDirKey, pagerPageKey, pagerLimitKey, filterFieldKey, totalKey, dataKey }?: {
|
|
18
|
+
endPoint?: string;
|
|
19
|
+
sortFieldKey?: string;
|
|
20
|
+
sortDirKey?: string;
|
|
21
|
+
pagerPageKey?: string;
|
|
22
|
+
pagerLimitKey?: string;
|
|
23
|
+
filterFieldKey?: string;
|
|
24
|
+
totalKey?: string;
|
|
25
|
+
dataKey?: string;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { LocalDataSource } from '../local/local.data-source';
|
|
4
|
+
import { ServerSourceConf } from './server-source.conf';
|
|
5
|
+
export declare class ServerDataSource extends LocalDataSource {
|
|
6
|
+
protected http: HttpClient;
|
|
7
|
+
protected conf: ServerSourceConf;
|
|
8
|
+
protected lastRequestCount: number;
|
|
9
|
+
constructor(http: HttpClient, conf?: ServerSourceConf | {});
|
|
10
|
+
count(): number;
|
|
11
|
+
getElements(): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts array of data from server response
|
|
14
|
+
* @param res
|
|
15
|
+
* @returns {any}
|
|
16
|
+
*/
|
|
17
|
+
protected extractDataFromResponse(res: any): Array<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Extracts total rows count from the server response
|
|
20
|
+
* Looks for the count in the heders first, then in the response body
|
|
21
|
+
* @param res
|
|
22
|
+
* @returns {any}
|
|
23
|
+
*/
|
|
24
|
+
protected extractTotalFromResponse(res: any): number;
|
|
25
|
+
protected requestElements(): Observable<any>;
|
|
26
|
+
protected createRequesParams(): HttpParams;
|
|
27
|
+
protected addSortRequestParams(httpParams: HttpParams): HttpParams;
|
|
28
|
+
protected addFilterRequestParams(httpParams: HttpParams): HttpParams;
|
|
29
|
+
protected addPagerRequestParams(httpParams: HttpParams): HttpParams;
|
|
30
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Subject } from 'rxjs';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { EventEmitter } from '@angular/core';
|
|
4
|
+
import { Column } from './data-set/column';
|
|
5
|
+
import { Row } from './data-set/row';
|
|
6
|
+
import { DataSet } from './data-set/data-set';
|
|
7
|
+
import { DataSource } from './data-source/data-source';
|
|
8
|
+
import { SmartTableSettings } from './interfaces/smart-table.models';
|
|
9
|
+
export declare class Grid {
|
|
10
|
+
createFormShown: boolean;
|
|
11
|
+
source: DataSource;
|
|
12
|
+
settings: SmartTableSettings;
|
|
13
|
+
dataSet: DataSet;
|
|
14
|
+
onSelectRowSource: Subject<any>;
|
|
15
|
+
onDeselectRowSource: Subject<any>;
|
|
16
|
+
private sourceOnChangedSubscription;
|
|
17
|
+
private sourceOnUpdatedSubscription;
|
|
18
|
+
constructor(source: DataSource, settings: SmartTableSettings);
|
|
19
|
+
detach(): void;
|
|
20
|
+
showActionColumn(position: string): boolean;
|
|
21
|
+
isCurrentActionsPosition(position: string): boolean;
|
|
22
|
+
isActionsVisible(): boolean;
|
|
23
|
+
isMultiSelectVisible(): boolean;
|
|
24
|
+
getNewRow(): Row;
|
|
25
|
+
setSettings(settings: SmartTableSettings): void;
|
|
26
|
+
getDataSet(): DataSet;
|
|
27
|
+
setSource(source: DataSource): void;
|
|
28
|
+
getSetting(name: string, defaultValue?: any): any;
|
|
29
|
+
getColumns(): Array<Column>;
|
|
30
|
+
getRows(): Array<Row>;
|
|
31
|
+
selectRow(row: Row, state: boolean): void;
|
|
32
|
+
multipleSelectRow(row: Row): void;
|
|
33
|
+
onSelectRow(): Observable<any>;
|
|
34
|
+
onDeselectRow(): Observable<any>;
|
|
35
|
+
edit(row: Row): void;
|
|
36
|
+
create(row: Row, confirmEmitter: EventEmitter<any>): void;
|
|
37
|
+
save(row: Row, confirmEmitter: EventEmitter<any>): void;
|
|
38
|
+
delete(row: Row, confirmEmitter: EventEmitter<any>): void;
|
|
39
|
+
processDataChange(changes: any): void;
|
|
40
|
+
shouldProcessChange(changes: any): boolean;
|
|
41
|
+
prepareSource(source: any): DataSource;
|
|
42
|
+
getInitialSort(): any;
|
|
43
|
+
getSelectedRowsData(): Array<any>;
|
|
44
|
+
selectAllRows(status: boolean): void;
|
|
45
|
+
getFirstRow(): Row;
|
|
46
|
+
getLastRow(): Row;
|
|
47
|
+
private getSelectionInfo;
|
|
48
|
+
private getPageToSelect;
|
|
49
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extending object that entered in first argument.
|
|
3
|
+
*
|
|
4
|
+
* Returns extended object or false if have no target object or incorrect type.
|
|
5
|
+
*
|
|
6
|
+
* If you wish to clone source object (without modify it), just use empty new
|
|
7
|
+
* object as first argument, like this:
|
|
8
|
+
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
9
|
+
*/
|
|
10
|
+
export declare const deepExtend: (...objects: Array<any>) => any;
|
|
11
|
+
export declare class Deferred {
|
|
12
|
+
promise: Promise<any>;
|
|
13
|
+
resolve: any;
|
|
14
|
+
reject: any;
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
export declare function getDeepFromObject(object: {}, name: string, defaultValue?: any): any;
|
|
18
|
+
export declare function getPageForRowIndex(index: number, perPage: number): number;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { DataSource } from "../data-source/data-source";
|
|
2
|
+
import { Deferred } from "../helpers";
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
title: string;
|
|
5
|
+
value: number | string;
|
|
6
|
+
}
|
|
7
|
+
export interface SmartTableSettings<T = any> {
|
|
8
|
+
mode?: 'inline' | 'external' | 'click-to-edit';
|
|
9
|
+
selectMode?: 'single' | 'multi';
|
|
10
|
+
selectedRowIndex?: number;
|
|
11
|
+
switchPageToSelectedRowPage?: boolean;
|
|
12
|
+
hideHeader?: boolean;
|
|
13
|
+
hideSubHeader?: boolean;
|
|
14
|
+
actions?: SmartTableAction | false;
|
|
15
|
+
filter?: {
|
|
16
|
+
inputClass: string;
|
|
17
|
+
};
|
|
18
|
+
edit?: {
|
|
19
|
+
inputClass?: string;
|
|
20
|
+
editButtonContent?: string;
|
|
21
|
+
saveButtonContent?: string;
|
|
22
|
+
cancelButtonContent?: string;
|
|
23
|
+
confirmSave?: boolean;
|
|
24
|
+
} | false;
|
|
25
|
+
add?: {
|
|
26
|
+
inputClass?: string;
|
|
27
|
+
addButtonContent?: string;
|
|
28
|
+
createButtonContent?: string;
|
|
29
|
+
cancelButtonContent?: string;
|
|
30
|
+
confirmCreate?: boolean;
|
|
31
|
+
} | false;
|
|
32
|
+
delete?: {
|
|
33
|
+
deleteButtonContent?: string;
|
|
34
|
+
confirmDelete?: boolean;
|
|
35
|
+
} | false;
|
|
36
|
+
attr?: {
|
|
37
|
+
id?: string;
|
|
38
|
+
class?: string;
|
|
39
|
+
};
|
|
40
|
+
noDataMessage?: string;
|
|
41
|
+
columns: {
|
|
42
|
+
[key: string]: SmartTableColumn<T>;
|
|
43
|
+
};
|
|
44
|
+
pager?: {
|
|
45
|
+
display: boolean;
|
|
46
|
+
page?: number;
|
|
47
|
+
perPage: number;
|
|
48
|
+
} | false;
|
|
49
|
+
rowClassFunction?: (row: {
|
|
50
|
+
data: T;
|
|
51
|
+
}) => string;
|
|
52
|
+
}
|
|
53
|
+
export interface SmartTableAction {
|
|
54
|
+
columnTitle?: string;
|
|
55
|
+
add?: boolean;
|
|
56
|
+
edit?: boolean;
|
|
57
|
+
delete?: boolean;
|
|
58
|
+
custom?: SmartTableCustomAction[];
|
|
59
|
+
position?: 'left' | 'right';
|
|
60
|
+
}
|
|
61
|
+
export interface SmartTableCustomAction {
|
|
62
|
+
name: string;
|
|
63
|
+
title: string;
|
|
64
|
+
}
|
|
65
|
+
export type SmartTableColumn<T> = SmartTableTextHtmlColumn<T> | SmartTableCustomColumn<T>;
|
|
66
|
+
interface SmartTableDefaultColumn<T> {
|
|
67
|
+
title: string;
|
|
68
|
+
width?: string;
|
|
69
|
+
class?: string;
|
|
70
|
+
editable?: boolean;
|
|
71
|
+
hide?: boolean;
|
|
72
|
+
sort?: boolean;
|
|
73
|
+
sortDirection?: 'desc' | 'asc' | false;
|
|
74
|
+
editor?: SmartTableEditorAndFilter;
|
|
75
|
+
filter?: SmartTableEditorAndFilter | false;
|
|
76
|
+
compareFunction?: (itemA: T, itemB: T) => number;
|
|
77
|
+
valuePrepareFunction?: (columnData: any, rowData: T) => any;
|
|
78
|
+
filterFunction?: (columnData: any, search: string) => boolean;
|
|
79
|
+
}
|
|
80
|
+
interface SmartTableTextHtmlColumn<T> extends SmartTableDefaultColumn<T> {
|
|
81
|
+
type: 'text' | 'html';
|
|
82
|
+
}
|
|
83
|
+
interface SmartTableCustomColumn<T> extends SmartTableDefaultColumn<T> {
|
|
84
|
+
type: 'custom';
|
|
85
|
+
renderComponent: any;
|
|
86
|
+
}
|
|
87
|
+
export type SmartTableEditorAndFilter = {
|
|
88
|
+
type: 'text' | 'textarea';
|
|
89
|
+
} | SmartTableEditorList | SmartTableEditorCompleter | SmartTableEditorCheckbox | SmartTableEditorCustom;
|
|
90
|
+
interface SmartTableEditorList {
|
|
91
|
+
type: 'list';
|
|
92
|
+
config: {
|
|
93
|
+
selectText?: string;
|
|
94
|
+
list: SelectOption[];
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
interface SmartTableEditorCompleter {
|
|
98
|
+
type: 'completer';
|
|
99
|
+
config: {
|
|
100
|
+
completer: {
|
|
101
|
+
data: any[];
|
|
102
|
+
searchFields: string;
|
|
103
|
+
titleField: string;
|
|
104
|
+
descriptionField?: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
interface SmartTableEditorCustom {
|
|
109
|
+
type: 'custom';
|
|
110
|
+
component: any;
|
|
111
|
+
config?: any;
|
|
112
|
+
}
|
|
113
|
+
export interface SmartTableEditorCheckbox {
|
|
114
|
+
type: 'checkbox';
|
|
115
|
+
config?: {
|
|
116
|
+
true: string;
|
|
117
|
+
false: string;
|
|
118
|
+
resetText?: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export interface SmartTableFilterItem {
|
|
122
|
+
field: string;
|
|
123
|
+
search: string;
|
|
124
|
+
}
|
|
125
|
+
interface SmartTableDefaultEvent<T> {
|
|
126
|
+
confirm: Deferred;
|
|
127
|
+
data: T;
|
|
128
|
+
source: DataSource;
|
|
129
|
+
}
|
|
130
|
+
export type SmartTableConfirmDeleteEvent<T = any> = SmartTableDefaultEvent<T>;
|
|
131
|
+
export type SmartTableRowClickedEvent<T = any> = Omit<SmartTableDefaultEvent<T>, "confirm">;
|
|
132
|
+
export interface SmartTableCustomEvent<T = any> extends Omit<SmartTableDefaultEvent<T>, "confirm"> {
|
|
133
|
+
action: string;
|
|
134
|
+
}
|
|
135
|
+
export interface SmartTableRowSelectEvent<T = any> extends Omit<SmartTableDefaultEvent<T>, "confirm"> {
|
|
136
|
+
isSelected: boolean;
|
|
137
|
+
selected: T[];
|
|
138
|
+
}
|
|
139
|
+
export interface SmartTableConfirmEditEvent<T = any> extends SmartTableDefaultEvent<T> {
|
|
140
|
+
newData: T;
|
|
141
|
+
}
|
|
142
|
+
export interface SmartTableCreateConfirm<T = any> extends Omit<SmartTableDefaultEvent<T>, "data"> {
|
|
143
|
+
newData: T;
|
|
144
|
+
}
|
|
145
|
+
export interface ObjectStringString {
|
|
146
|
+
[key: string]: string;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SimpleChange, EventEmitter, OnChanges } from '@angular/core';
|
|
2
|
+
import { Grid } from './lib/grid';
|
|
3
|
+
import { DataSource } from './lib/data-source/data-source';
|
|
4
|
+
import { Row } from './lib/data-set/row';
|
|
5
|
+
import { SmartTableConfirmDeleteEvent, SmartTableConfirmEditEvent, SmartTableCreateConfirm, SmartTableCustomEvent, SmartTableRowClickedEvent, SmartTableRowSelectEvent, SmartTableSettings } from './lib/interfaces/smart-table.models';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class Ng2SmartTableComponent implements OnChanges {
|
|
8
|
+
source: DataSource;
|
|
9
|
+
settings: SmartTableSettings;
|
|
10
|
+
multiRowSelect: EventEmitter<SmartTableRowSelectEvent<any>>;
|
|
11
|
+
rowClicked: EventEmitter<SmartTableRowClickedEvent<any>>;
|
|
12
|
+
delete: EventEmitter<any>;
|
|
13
|
+
edit: EventEmitter<any>;
|
|
14
|
+
create: EventEmitter<any>;
|
|
15
|
+
custom: EventEmitter<SmartTableCustomEvent<any>>;
|
|
16
|
+
deleteConfirm: EventEmitter<SmartTableConfirmDeleteEvent<any>>;
|
|
17
|
+
editConfirm: EventEmitter<SmartTableConfirmEditEvent<any>>;
|
|
18
|
+
createConfirm: EventEmitter<SmartTableCreateConfirm<any>>;
|
|
19
|
+
rowHover: EventEmitter<any>;
|
|
20
|
+
tableClass: string;
|
|
21
|
+
tableId: string;
|
|
22
|
+
perPageSelect: any;
|
|
23
|
+
isHideHeader: boolean;
|
|
24
|
+
isHideSubHeader: boolean;
|
|
25
|
+
isPagerDisplay: boolean;
|
|
26
|
+
rowClassFunction: Function;
|
|
27
|
+
grid: Grid;
|
|
28
|
+
defaultSettings: SmartTableSettings;
|
|
29
|
+
ngOnChanges(changes: {
|
|
30
|
+
[propertyName: string]: SimpleChange;
|
|
31
|
+
}): void;
|
|
32
|
+
onRowHover(row: Row): void;
|
|
33
|
+
multipleSelectRow(row: Row): void;
|
|
34
|
+
onSelectAllRows(): void;
|
|
35
|
+
onSelectRow(row: Row, state: boolean): void;
|
|
36
|
+
initGrid(): void;
|
|
37
|
+
prepareSource(): DataSource;
|
|
38
|
+
prepareSettings(): SmartTableSettings;
|
|
39
|
+
private emitUserSelectRow;
|
|
40
|
+
emitUserRowClicked(row: Row): void;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Ng2SmartTableComponent, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<Ng2SmartTableComponent, "ng2-smart-table", never, { "source": "source"; "settings": "settings"; }, { "multiRowSelect": "multiRowSelect"; "rowClicked": "rowClicked"; "delete": "delete"; "edit": "edit"; "create": "create"; "custom": "custom"; "deleteConfirm": "deleteConfirm"; "editConfirm": "editConfirm"; "createConfirm": "createConfirm"; "rowHover": "rowHover"; }, never, never, false, never>;
|
|
43
|
+
}
|