@den4ik92/ng2-smart-table 1.1.0 → 2.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.
Files changed (87) hide show
  1. package/esm2020/lib/components/cell/cell-edit-mode/custom-edit.component.mjs +4 -3
  2. package/esm2020/lib/components/cell/cell-edit-mode/default-edit.component.mjs +11 -8
  3. package/esm2020/lib/components/cell/cell-edit-mode/edit-cell-default.mjs +1 -1
  4. package/esm2020/lib/components/cell/cell-edit-mode/edit-cell.component.mjs +6 -2
  5. package/esm2020/lib/components/cell/cell-editors/checkbox-editor.component.mjs +6 -5
  6. package/esm2020/lib/components/cell/cell-editors/default-editor.mjs +2 -1
  7. package/esm2020/lib/components/cell/cell-view-mode/custom-view.component.mjs +1 -6
  8. package/esm2020/lib/components/cell/cell-view-mode/view-cell.component.mjs +1 -1
  9. package/esm2020/lib/components/cell/cell.component.mjs +1 -1
  10. package/esm2020/lib/components/cell/cell.module.mjs +1 -5
  11. package/esm2020/lib/components/filter/custom-filter.component.mjs +15 -16
  12. package/esm2020/lib/components/filter/default-filter.component.mjs +7 -22
  13. package/esm2020/lib/components/filter/filter-default.mjs +6 -4
  14. package/esm2020/lib/components/filter/filter-types/default-filter.mjs +3 -1
  15. package/esm2020/lib/components/filter/filter-types/input-filter.component.mjs +2 -2
  16. package/esm2020/lib/components/filter/filter-types/select-filter.component.mjs +6 -4
  17. package/esm2020/lib/components/filter/filter.component.mjs +4 -8
  18. package/esm2020/lib/components/filter/filter.module.mjs +1 -5
  19. package/esm2020/lib/components/pager/pager.component.mjs +21 -18
  20. package/esm2020/lib/components/tbody/cells/create-cancel.component.mjs +7 -3
  21. package/esm2020/lib/components/tbody/cells/custom.component.mjs +2 -1
  22. package/esm2020/lib/components/tbody/cells/edit-delete.component.mjs +6 -2
  23. package/esm2020/lib/components/tbody/tbody.component.mjs +22 -9
  24. package/esm2020/lib/components/thead/cells/actions-title.component.mjs +2 -1
  25. package/esm2020/lib/components/thead/cells/actions.component.mjs +3 -1
  26. package/esm2020/lib/components/thead/cells/add-button.component.mjs +4 -2
  27. package/esm2020/lib/components/thead/cells/checkbox-select-all.component.mjs +2 -2
  28. package/esm2020/lib/components/thead/cells/column-title.component.mjs +2 -2
  29. package/esm2020/lib/components/thead/cells/title/title.component.mjs +6 -7
  30. package/esm2020/lib/components/thead/rows/thead-filters-row.component.mjs +7 -3
  31. package/esm2020/lib/components/thead/rows/thead-form-row.component.mjs +6 -2
  32. package/esm2020/lib/components/thead/rows/thead-titles-row.component.mjs +5 -2
  33. package/esm2020/lib/components/thead/thead.component.mjs +6 -4
  34. package/esm2020/lib/lib/data-set/column.mjs +37 -38
  35. package/esm2020/lib/lib/data-set/data-set.mjs +1 -1
  36. package/esm2020/lib/lib/data-set/row.mjs +1 -1
  37. package/esm2020/lib/lib/data-source/data-source.mjs +18 -28
  38. package/esm2020/lib/lib/data-source/local/local.data-source.mjs +53 -26
  39. package/esm2020/lib/lib/grid.mjs +19 -32
  40. package/esm2020/lib/lib/helpers.mjs +2 -2
  41. package/esm2020/lib/lib/interfaces/smart-table.models.mjs +1 -1
  42. package/esm2020/lib/ng2-smart-table.component.mjs +14 -18
  43. package/esm2020/public-api.mjs +1 -2
  44. package/fesm2015/den4ik92-ng2-smart-table.mjs +306 -482
  45. package/fesm2015/den4ik92-ng2-smart-table.mjs.map +1 -1
  46. package/fesm2020/den4ik92-ng2-smart-table.mjs +1624 -1805
  47. package/fesm2020/den4ik92-ng2-smart-table.mjs.map +1 -1
  48. package/lib/components/cell/cell-edit-mode/default-edit.component.d.ts +2 -1
  49. package/lib/components/cell/cell-edit-mode/edit-cell.component.d.ts +2 -1
  50. package/lib/components/cell/cell-view-mode/custom-view.component.d.ts +0 -1
  51. package/lib/components/cell/cell.module.d.ts +8 -9
  52. package/lib/components/filter/custom-filter.component.d.ts +1 -2
  53. package/lib/components/filter/default-filter.component.d.ts +1 -2
  54. package/lib/components/filter/filter-default.d.ts +4 -4
  55. package/lib/components/filter/filter-types/default-filter.d.ts +1 -1
  56. package/lib/components/filter/filter.component.d.ts +1 -2
  57. package/lib/components/filter/filter.module.d.ts +5 -6
  58. package/lib/components/pager/pager.component.d.ts +8 -8
  59. package/lib/components/tbody/cells/custom.component.d.ts +2 -1
  60. package/lib/components/tbody/cells/edit-delete.component.d.ts +2 -2
  61. package/lib/components/tbody/tbody.component.d.ts +5 -4
  62. package/lib/components/thead/cells/add-button.component.d.ts +2 -2
  63. package/lib/components/thead/cells/checkbox-select-all.component.d.ts +2 -2
  64. package/lib/components/thead/cells/column-title.component.d.ts +2 -2
  65. package/lib/components/thead/cells/title/title.component.d.ts +5 -4
  66. package/lib/components/thead/rows/thead-filters-row.component.d.ts +2 -2
  67. package/lib/components/thead/rows/thead-titles-row.component.d.ts +2 -2
  68. package/lib/components/thead/thead.component.d.ts +2 -2
  69. package/lib/lib/data-set/column.d.ts +16 -26
  70. package/lib/lib/data-set/data-set.d.ts +4 -4
  71. package/lib/lib/data-set/row.d.ts +3 -3
  72. package/lib/lib/data-source/data-source.d.ts +13 -13
  73. package/lib/lib/data-source/local/local.data-source.d.ts +4 -4
  74. package/lib/lib/grid.d.ts +8 -10
  75. package/lib/lib/helpers.d.ts +1 -1
  76. package/lib/lib/interfaces/smart-table.models.d.ts +26 -29
  77. package/lib/ng2-smart-table.component.d.ts +4 -4
  78. package/package.json +1 -1
  79. package/public-api.d.ts +0 -1
  80. package/esm2020/lib/components/cell/cell-editors/completer-editor.component.mjs +0 -46
  81. package/esm2020/lib/components/filter/filter-types/completer-filter.component.mjs +0 -61
  82. package/esm2020/lib/lib/data-source/server/server-source.conf.mjs +0 -20
  83. package/esm2020/lib/lib/data-source/server/server.data-source.mjs +0 -93
  84. package/lib/components/cell/cell-editors/completer-editor.component.d.ts +0 -13
  85. package/lib/components/filter/filter-types/completer-filter.component.d.ts +0 -12
  86. package/lib/lib/data-source/server/server-source.conf.d.ts +0 -27
  87. package/lib/lib/data-source/server/server.data-source.d.ts +0 -30
@@ -1,8 +1,9 @@
1
1
  import { EditCellDefault } from './edit-cell-default';
2
+ import { SmartTableEditorAndFilterTypes } from '../../../lib/interfaces/smart-table.models';
2
3
  import * as i0 from "@angular/core";
3
4
  export declare class DefaultEditComponent extends EditCellDefault {
4
5
  constructor();
5
- getEditorType(): string;
6
+ getEditorType(): SmartTableEditorAndFilterTypes;
6
7
  static ɵfac: i0.ɵɵFactoryDeclaration<DefaultEditComponent, never>;
7
8
  static ɵcmp: i0.ɵɵComponentDeclaration<DefaultEditComponent, "table-cell-default-editor", never, {}, {}, never, never, false, never>;
8
9
  }
@@ -1,12 +1,13 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { Cell } from '../../../lib/data-set/cell';
3
+ import { SmartTableEditorAndFilterTypes } from '../../../lib/interfaces/smart-table.models';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class EditCellComponent {
5
6
  cell: Cell;
6
7
  inputClass: string;
7
8
  edited: EventEmitter<any>;
8
9
  onEdited(event: any): boolean;
9
- getEditorType(): string;
10
+ getEditorType(): SmartTableEditorAndFilterTypes;
10
11
  static ɵfac: i0.ɵɵFactoryDeclaration<EditCellComponent, never>;
11
12
  static ɵcmp: i0.ɵɵComponentDeclaration<EditCellComponent, "table-cell-edit-mode", never, { "cell": "cell"; "inputClass": "inputClass"; }, { "edited": "edited"; }, never, never, false, never>;
12
13
  }
@@ -11,7 +11,6 @@ export declare class CustomViewComponent implements OnInit, OnDestroy {
11
11
  ngOnInit(): void;
12
12
  ngOnDestroy(): void;
13
13
  protected createCustomComponent(): void;
14
- protected callOnComponentInit(): void;
15
14
  protected patchInstance(): void;
16
15
  protected getPatch(): ViewCell;
17
16
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomViewComponent, never>;
@@ -6,16 +6,15 @@ import * as i4 from "./cell-edit-mode/custom-edit.component";
6
6
  import * as i5 from "./cell-edit-mode/default-edit.component";
7
7
  import * as i6 from "./cell-edit-mode/edit-cell.component";
8
8
  import * as i7 from "./cell-editors/checkbox-editor.component";
9
- import * as i8 from "./cell-editors/completer-editor.component";
10
- import * as i9 from "./cell-editors/input-editor.component";
11
- import * as i10 from "./cell-editors/select-editor.component";
12
- import * as i11 from "./cell-editors/textarea-editor.component";
13
- import * as i12 from "./cell-view-mode/custom-view.component";
14
- import * as i13 from "./cell-view-mode/view-cell.component";
15
- import * as i14 from "@angular/common";
16
- import * as i15 from "@angular/forms";
9
+ import * as i8 from "./cell-editors/input-editor.component";
10
+ import * as i9 from "./cell-editors/select-editor.component";
11
+ import * as i10 from "./cell-editors/textarea-editor.component";
12
+ import * as i11 from "./cell-view-mode/custom-view.component";
13
+ import * as i12 from "./cell-view-mode/view-cell.component";
14
+ import * as i13 from "@angular/common";
15
+ import * as i14 from "@angular/forms";
17
16
  export declare class CellModule {
18
17
  static ɵfac: i0.ɵɵFactoryDeclaration<CellModule, never>;
19
- static ɵmod: i0.ɵɵNgModuleDeclaration<CellModule, [typeof i1.CellComponent, typeof i2.EditCellDefault, typeof i3.DefaultEditor, typeof i4.CustomEditComponent, typeof i5.DefaultEditComponent, typeof i6.EditCellComponent, typeof i7.CheckboxEditorComponent, typeof i8.CompleterEditorComponent, typeof i9.InputEditorComponent, typeof i10.SelectEditorComponent, typeof i11.TextareaEditorComponent, typeof i12.CustomViewComponent, typeof i13.ViewCellComponent], [typeof i14.CommonModule, typeof i15.FormsModule], [typeof i1.CellComponent, typeof i2.EditCellDefault, typeof i3.DefaultEditor, typeof i4.CustomEditComponent, typeof i5.DefaultEditComponent, typeof i6.EditCellComponent, typeof i7.CheckboxEditorComponent, typeof i8.CompleterEditorComponent, typeof i9.InputEditorComponent, typeof i10.SelectEditorComponent, typeof i11.TextareaEditorComponent, typeof i12.CustomViewComponent, typeof i13.ViewCellComponent]>;
18
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CellModule, [typeof i1.CellComponent, typeof i2.EditCellDefault, typeof i3.DefaultEditor, typeof i4.CustomEditComponent, typeof i5.DefaultEditComponent, typeof i6.EditCellComponent, typeof i7.CheckboxEditorComponent, typeof i8.InputEditorComponent, typeof i9.SelectEditorComponent, typeof i10.TextareaEditorComponent, typeof i11.CustomViewComponent, typeof i12.ViewCellComponent], [typeof i13.CommonModule, typeof i14.FormsModule], [typeof i1.CellComponent, typeof i2.EditCellDefault, typeof i3.DefaultEditor, typeof i4.CustomEditComponent, typeof i5.DefaultEditComponent, typeof i6.EditCellComponent, typeof i7.CheckboxEditorComponent, typeof i8.InputEditorComponent, typeof i9.SelectEditorComponent, typeof i10.TextareaEditorComponent, typeof i11.CustomViewComponent, typeof i12.ViewCellComponent]>;
20
19
  static ɵinj: i0.ɵɵInjectorDeclaration<CellModule>;
21
20
  }
@@ -3,12 +3,11 @@ import { FilterDefault } from './filter-default';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CustomFilterComponent extends FilterDefault implements OnChanges, OnDestroy {
5
5
  private resolver;
6
- query: string;
7
6
  customComponent: any;
8
7
  dynamicTarget: any;
9
8
  constructor(resolver: ComponentFactoryResolver);
10
9
  ngOnChanges(changes: SimpleChanges): void;
11
10
  ngOnDestroy(): void;
12
11
  static ɵfac: i0.ɵɵFactoryDeclaration<CustomFilterComponent, never>;
13
- static ɵcmp: i0.ɵɵComponentDeclaration<CustomFilterComponent, "custom-table-filter", never, { "query": "query"; }, {}, never, never, false, never>;
12
+ static ɵcmp: i0.ɵɵComponentDeclaration<CustomFilterComponent, "custom-table-filter", never, {}, {}, never, never, false, never>;
14
13
  }
@@ -1,7 +1,6 @@
1
1
  import { FilterDefault } from "./filter-default";
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class DefaultFilterComponent extends FilterDefault {
4
- query: string;
5
4
  static ɵfac: i0.ɵɵFactoryDeclaration<DefaultFilterComponent, never>;
6
- static ɵcmp: i0.ɵɵComponentDeclaration<DefaultFilterComponent, "default-table-filter", never, { "query": "query"; }, {}, never, never, false, never>;
5
+ static ɵcmp: i0.ɵɵComponentDeclaration<DefaultFilterComponent, "default-table-filter", never, {}, {}, never, never, false, never>;
7
6
  }
@@ -1,14 +1,14 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { Column } from '../../lib/data-set/column';
3
- import { DataSource } from '../../lib/data-source/data-source';
3
+ import { LocalDataSource } from '../../lib/data-source/local/local.data-source';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class FilterDefault {
6
6
  column: Column;
7
- source: DataSource;
7
+ source: LocalDataSource;
8
8
  inputClass: string;
9
- filter: EventEmitter<any>;
10
9
  query: string;
10
+ filter: EventEmitter<any>;
11
11
  onFilter(query: string): void;
12
12
  static ɵfac: i0.ɵɵFactoryDeclaration<FilterDefault, never>;
13
- static ɵcmp: i0.ɵɵComponentDeclaration<FilterDefault, "ng-component", never, { "column": "column"; "source": "source"; "inputClass": "inputClass"; }, { "filter": "filter"; }, never, never, false, never>;
13
+ static ɵcmp: i0.ɵɵComponentDeclaration<FilterDefault, "ng-component", never, { "column": "column"; "source": "source"; "inputClass": "inputClass"; "query": "query"; }, { "filter": "filter"; }, never, never, false, never>;
14
14
  }
@@ -4,7 +4,7 @@ import { Column } from '../../../lib/data-set/column';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class DefaultFilter implements Filter, OnDestroy {
6
6
  delay: number;
7
- changesSubscription: Subscription;
7
+ changesSubscription?: Subscription;
8
8
  query: string;
9
9
  inputClass: string;
10
10
  column: Column;
@@ -3,8 +3,7 @@ import { FilterDefault } from './filter-default';
3
3
  import { Subscription } from 'rxjs';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class FilterComponent extends FilterDefault implements OnChanges {
6
- query: string;
7
- protected dataChangedSub: Subscription;
6
+ protected dataChangedSub?: Subscription;
8
7
  ngOnChanges(changes: SimpleChanges): void;
9
8
  static ɵfac: i0.ɵɵFactoryDeclaration<FilterComponent, never>;
10
9
  static ɵcmp: i0.ɵɵComponentDeclaration<FilterComponent, "ng2-smart-table-filter", never, {}, {}, never, never, false, never>;
@@ -5,13 +5,12 @@ import * as i3 from "./filter.component";
5
5
  import * as i4 from "./default-filter.component";
6
6
  import * as i5 from "./custom-filter.component";
7
7
  import * as i6 from "./filter-types/checkbox-filter.component";
8
- import * as i7 from "./filter-types/completer-filter.component";
9
- import * as i8 from "./filter-types/input-filter.component";
10
- import * as i9 from "./filter-types/select-filter.component";
11
- import * as i10 from "@angular/common";
12
- import * as i11 from "@angular/forms";
8
+ import * as i7 from "./filter-types/input-filter.component";
9
+ import * as i8 from "./filter-types/select-filter.component";
10
+ import * as i9 from "@angular/common";
11
+ import * as i10 from "@angular/forms";
13
12
  export declare class FilterModule {
14
13
  static ɵfac: i0.ɵɵFactoryDeclaration<FilterModule, never>;
15
- static ɵmod: i0.ɵɵNgModuleDeclaration<FilterModule, [typeof i1.FilterDefault, typeof i2.DefaultFilter, typeof i3.FilterComponent, typeof i4.DefaultFilterComponent, typeof i5.CustomFilterComponent, typeof i6.CheckboxFilterComponent, typeof i7.CompleterFilterComponent, typeof i8.InputFilterComponent, typeof i9.SelectFilterComponent], [typeof i10.CommonModule, typeof i11.FormsModule, typeof i11.ReactiveFormsModule], [typeof i1.FilterDefault, typeof i2.DefaultFilter, typeof i3.FilterComponent, typeof i4.DefaultFilterComponent, typeof i5.CustomFilterComponent, typeof i6.CheckboxFilterComponent, typeof i7.CompleterFilterComponent, typeof i8.InputFilterComponent, typeof i9.SelectFilterComponent]>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FilterModule, [typeof i1.FilterDefault, typeof i2.DefaultFilter, typeof i3.FilterComponent, typeof i4.DefaultFilterComponent, typeof i5.CustomFilterComponent, typeof i6.CheckboxFilterComponent, typeof i7.InputFilterComponent, typeof i8.SelectFilterComponent], [typeof i9.CommonModule, typeof i10.FormsModule, typeof i10.ReactiveFormsModule], [typeof i1.FilterDefault, typeof i2.DefaultFilter, typeof i3.FilterComponent, typeof i4.DefaultFilterComponent, typeof i5.CustomFilterComponent, typeof i6.CheckboxFilterComponent, typeof i7.InputFilterComponent, typeof i8.SelectFilterComponent]>;
16
15
  static ɵinj: i0.ɵɵInjectorDeclaration<FilterModule>;
17
16
  }
@@ -1,17 +1,17 @@
1
1
  import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { Subscription } from 'rxjs';
3
- import { DataSource } from '../../lib/data-source/data-source';
3
+ import { LocalDataSource } from '../../lib/data-source/local/local.data-source';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class PagerComponent implements OnChanges {
6
- source: DataSource;
7
- perPageSelect: any[];
6
+ source: LocalDataSource;
7
+ perPageSelect: number[];
8
8
  changePage: EventEmitter<any>;
9
- currentPerPage: any;
10
- protected pages: Array<any>;
9
+ currentPerPage: number;
10
+ protected pages: number[];
11
11
  protected page: number;
12
12
  protected count: number;
13
13
  protected perPage: number;
14
- protected dataChangedSub: Subscription;
14
+ protected dataChangedSub: Subscription | undefined;
15
15
  ngOnChanges(changes: SimpleChanges): void;
16
16
  /**
17
17
  * We change the page here depending on the action performed against data source
@@ -25,11 +25,11 @@ export declare class PagerComponent implements OnChanges {
25
25
  next(): boolean;
26
26
  prev(): boolean;
27
27
  getPage(): number;
28
- getPages(): Array<any>;
28
+ getPages(): number[];
29
29
  getLast(): number;
30
30
  isPageOutOfBounce(): boolean;
31
31
  initPages(): void;
32
- onChangePerPage(event: any): void;
32
+ onChangePerPage(): void;
33
33
  static ɵfac: i0.ɵɵFactoryDeclaration<PagerComponent, never>;
34
34
  static ɵcmp: i0.ɵɵComponentDeclaration<PagerComponent, "ng2-smart-table-pager", never, { "source": "source"; "perPageSelect": "perPageSelect"; }, { "changePage": "changePage"; }, never, never, false, never>;
35
35
  }
@@ -1,3 +1,4 @@
1
+ import { LocalDataSource } from './../../../lib/data-source/local/local.data-source';
1
2
  import { EventEmitter } from '@angular/core';
2
3
  import { Row } from '../../../lib/data-set/row';
3
4
  import { Grid } from '../../../lib/grid';
@@ -5,7 +6,7 @@ import * as i0 from "@angular/core";
5
6
  export declare class TbodyCustomComponent {
6
7
  grid: Grid;
7
8
  row: Row;
8
- source: any;
9
+ source: LocalDataSource;
9
10
  custom: EventEmitter<any>;
10
11
  onCustom(action: any, event: any): void;
11
12
  static ɵfac: i0.ɵɵFactoryDeclaration<TbodyCustomComponent, never>;
@@ -1,12 +1,12 @@
1
1
  import { EventEmitter, OnChanges } from '@angular/core';
2
2
  import { Grid } from '../../../lib/grid';
3
3
  import { Row } from '../../../lib/data-set/row';
4
- import { DataSource } from '../../../lib/data-source/data-source';
4
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class TbodyEditDeleteComponent implements OnChanges {
7
7
  grid: Grid;
8
8
  row: Row;
9
- source: DataSource;
9
+ source: LocalDataSource;
10
10
  deleteConfirm: EventEmitter<any>;
11
11
  editConfirm: EventEmitter<any>;
12
12
  edit: EventEmitter<any>;
@@ -1,11 +1,11 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { Grid } from '../../lib/grid';
3
- import { DataSource } from '../../lib/data-source/data-source';
4
3
  import { Cell } from '../../lib/data-set/cell';
4
+ import { LocalDataSource } from '../../lib/data-source/local/local.data-source';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class Ng2SmartTableTbodyComponent {
7
7
  grid: Grid;
8
- source: DataSource;
8
+ source: LocalDataSource;
9
9
  deleteConfirm: EventEmitter<any>;
10
10
  editConfirm: EventEmitter<any>;
11
11
  rowClassFunction: Function;
@@ -23,7 +23,7 @@ export declare class Ng2SmartTableTbodyComponent {
23
23
  isMultiSelectVisible: boolean;
24
24
  showActionColumnLeft: boolean;
25
25
  showActionColumnRight: boolean;
26
- mode: string;
26
+ mode: 'inline' | 'external' | 'click-to-edit';
27
27
  editInputClass: string;
28
28
  isActionAdd: boolean;
29
29
  isActionEdit: boolean;
@@ -31,7 +31,8 @@ export declare class Ng2SmartTableTbodyComponent {
31
31
  noDataMessage: boolean;
32
32
  get tableColumnsCount(): number;
33
33
  ngOnChanges(): void;
34
- getVisibleCells(cells: Array<Cell>): Array<Cell>;
34
+ getVisibleCells(cells: Cell[]): Cell[];
35
+ protected trackByIdOrIndex(index: number, item: any): string | number;
35
36
  static ɵfac: i0.ɵɵFactoryDeclaration<Ng2SmartTableTbodyComponent, never>;
36
37
  static ɵcmp: i0.ɵɵComponentDeclaration<Ng2SmartTableTbodyComponent, "[ng2-st-tbody]", never, { "grid": "grid"; "source": "source"; "deleteConfirm": "deleteConfirm"; "editConfirm": "editConfirm"; "rowClassFunction": "rowClassFunction"; }, { "save": "save"; "cancel": "cancel"; "edit": "edit"; "editCancel": "editCancel"; "delete": "delete"; "custom": "custom"; "edited": "edited"; "userSelectRow": "userSelectRow"; "userClickedRow": "userClickedRow"; "editRowSelect": "editRowSelect"; "multipleSelectRow": "multipleSelectRow"; }, never, never, false, never>;
37
38
  }
@@ -1,11 +1,11 @@
1
1
  import { EventEmitter, AfterViewInit, ElementRef, OnChanges } from '@angular/core';
2
2
  import { Grid } from '../../../lib/grid';
3
- import { DataSource } from '../../../lib/data-source/data-source';
3
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class AddButtonComponent implements AfterViewInit, OnChanges {
6
6
  private ref;
7
7
  grid: Grid;
8
- source: DataSource;
8
+ source: LocalDataSource;
9
9
  create: EventEmitter<any>;
10
10
  isActionAdd: boolean;
11
11
  addNewButtonContent: string;
@@ -1,9 +1,9 @@
1
1
  import { Grid } from '../../../lib/grid';
2
- import { DataSource } from '../../../lib/data-source/data-source';
2
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CheckboxSelectAllComponent {
5
5
  grid: Grid;
6
- source: DataSource;
6
+ source: LocalDataSource;
7
7
  static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxSelectAllComponent, never>;
8
8
  static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxSelectAllComponent, "[ng2-st-checkbox-select-all]", never, { "grid": "grid"; "source": "source"; }, {}, never, never, false, never>;
9
9
  }
@@ -1,10 +1,10 @@
1
1
  import { EventEmitter } from '@angular/core';
2
2
  import { Column } from '../../../lib/data-set/column';
3
- import { DataSource } from '../../../lib/data-source/data-source';
3
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class ColumnTitleComponent {
6
6
  column: Column;
7
- source: DataSource;
7
+ source: LocalDataSource;
8
8
  sort: EventEmitter<any>;
9
9
  static ɵfac: i0.ɵɵFactoryDeclaration<ColumnTitleComponent, never>;
10
10
  static ɵcmp: i0.ɵɵComponentDeclaration<ColumnTitleComponent, "ng2-st-column-title", never, { "column": "column"; "source": "source"; }, { "sort": "sort"; }, never, never, false, never>;
@@ -1,14 +1,15 @@
1
+ import { SmartTableSortDirection } from './../../../../lib/interfaces/smart-table.models';
2
+ import { LocalDataSource } from './../../../../lib/data-source/local/local.data-source';
1
3
  import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
4
  import { Subscription } from 'rxjs';
3
- import { DataSource } from '../../../../lib/data-source/data-source';
4
5
  import { Column } from '../../../../lib/data-set/column';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class TitleComponent implements OnChanges {
7
- currentDirection: string;
8
+ currentDirection: SmartTableSortDirection | '';
8
9
  column: Column;
9
- source: DataSource;
10
+ source: LocalDataSource;
10
11
  sort: EventEmitter<any>;
11
- protected dataChangedSub: Subscription;
12
+ protected dataChangedSub: Subscription | false;
12
13
  ngOnChanges(changes: SimpleChanges): void;
13
14
  _sort(event: any): void;
14
15
  changeSortDirection(): string;
@@ -1,11 +1,11 @@
1
1
  import { EventEmitter, OnChanges } from '@angular/core';
2
2
  import { Grid } from '../../../lib/grid';
3
- import { DataSource } from '../../../lib/data-source/data-source';
4
3
  import { Column } from "../../../lib/data-set/column";
4
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class TheadFitlersRowComponent implements OnChanges {
7
7
  grid: Grid;
8
- source: DataSource;
8
+ source: LocalDataSource;
9
9
  create: EventEmitter<any>;
10
10
  filter: EventEmitter<any>;
11
11
  isMultiSelectVisible: boolean;
@@ -1,11 +1,11 @@
1
1
  import { EventEmitter, OnChanges } from '@angular/core';
2
2
  import { Grid } from '../../../lib/grid';
3
- import { DataSource } from '../../../lib/data-source/data-source';
4
3
  import { Column } from "../../../lib/data-set/column";
4
+ import { LocalDataSource } from '../../../lib/data-source/local/local.data-source';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class TheadTitlesRowComponent implements OnChanges {
7
7
  grid: Grid;
8
- source: DataSource;
8
+ source: LocalDataSource;
9
9
  sort: EventEmitter<any>;
10
10
  selectAllRows: EventEmitter<any>;
11
11
  isMultiSelectVisible: boolean;
@@ -1,10 +1,10 @@
1
+ import { LocalDataSource } from './../../lib/data-source/local/local.data-source';
1
2
  import { EventEmitter, OnChanges } from '@angular/core';
2
3
  import { Grid } from '../../lib/grid';
3
- import { DataSource } from '../../lib/data-source/data-source';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class Ng2SmartTableTheadComponent implements OnChanges {
6
6
  grid: Grid;
7
- source: DataSource;
7
+ source: LocalDataSource;
8
8
  createConfirm: EventEmitter<any>;
9
9
  sort: EventEmitter<any>;
10
10
  selectAllRows: EventEmitter<any>;
@@ -1,10 +1,12 @@
1
+ import { SmartTableColumnSettings, SmartTableColumnSettingsTypes, SmartTableSortDirection } from './../interfaces/smart-table.models';
2
+ import { SmartTableEditorAndFilter } from '../interfaces/smart-table.models';
1
3
  import { DataSet } from './data-set';
2
4
  export declare class Column {
3
5
  id: string;
4
- protected settings: any;
6
+ protected settings: SmartTableColumnSettings;
5
7
  protected dataSet: DataSet;
6
8
  title: string;
7
- type: string;
9
+ type: SmartTableColumnSettingsTypes;
8
10
  class: string;
9
11
  width: string;
10
12
  hide: boolean;
@@ -12,33 +14,21 @@ export declare class Column {
12
14
  isEditable: boolean;
13
15
  isAddable: boolean;
14
16
  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
- };
17
+ sortDirection: SmartTableSortDirection;
18
+ defaultSortDirection: SmartTableSortDirection | false;
19
+ editor: SmartTableEditorAndFilter | false;
20
+ filter: SmartTableEditorAndFilter | false;
27
21
  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;
22
+ compareFunction: Function | undefined;
23
+ valuePrepareFunction: Function | undefined;
24
+ filterFunction: Function | undefined;
25
+ constructor(id: string, settings: SmartTableColumnSettings, dataSet: DataSet);
26
+ getCompareFunction(): Function | undefined;
27
+ getValuePrepareFunction(): Function | undefined;
28
+ getFilterFunction(): Function | undefined;
37
29
  getConfig(): any;
38
30
  getFilterType(): any;
39
31
  getFilterConfig(): any;
40
32
  protected process(): void;
41
- prepareType(): string;
42
- prepareSortDirection(): string;
43
- determineType(): string;
33
+ prepareSortDirection(): SmartTableSortDirection;
44
34
  }
@@ -1,20 +1,20 @@
1
1
  import { Row } from './row';
2
2
  import { Column } from './column';
3
+ import { SmartTableColumnSettings } from '../interfaces/smart-table.models';
3
4
  export declare class DataSet {
4
- protected columnSettings: Object;
5
+ protected columnSettings: SmartTableColumnSettings;
5
6
  newRow: Row;
6
7
  protected data: Array<any>;
7
8
  protected columns: Array<Column>;
8
9
  protected rows: Array<Row>;
9
10
  protected selectedRows: Set<Row>;
10
- protected willSelect: string;
11
- constructor(data: Array<any>, columnSettings: Object);
11
+ constructor(data: any[] | undefined, columnSettings: SmartTableColumnSettings);
12
12
  setData(data: Array<any>): void;
13
13
  getColumns(): Array<Column>;
14
14
  getRows(): Array<Row>;
15
15
  getFirstRow(): Row;
16
16
  getLastRow(): Row;
17
- findRowByData(data: any): Row;
17
+ findRowByData(data: any): Row | undefined;
18
18
  setSelectAll(state: boolean): void;
19
19
  deselectAll(): void;
20
20
  selectRow(row: Row, state: boolean): void;
@@ -7,14 +7,14 @@ export declare class Row {
7
7
  protected _dataSet: DataSet;
8
8
  isSelected: boolean;
9
9
  isInEditing: boolean;
10
- cells: Array<Cell>;
10
+ cells: Cell[];
11
11
  constructor(index: number, data: any, _dataSet: DataSet);
12
- getCell(column: Column): Cell;
12
+ getCell(column: Column): Cell | undefined;
13
13
  getCells(): Cell[];
14
14
  getData(): any;
15
15
  getIsSelected(): boolean;
16
16
  getNewData(): any;
17
- setData(data: any): any;
17
+ setData<T = any>(data: T): void;
18
18
  process(): void;
19
19
  createCell(column: Column): Cell;
20
20
  }
@@ -10,25 +10,25 @@ export declare abstract class DataSource<T = any> {
10
10
  abstract getElements(): Promise<T[]>;
11
11
  abstract getSort(): SmartTableSortItem[];
12
12
  abstract getFilter(): SmartTableFilterConf;
13
- abstract getPaging(): SmartTablePagingItem;
13
+ abstract getPaging(): SmartTablePagingItem | false;
14
14
  abstract count(): number;
15
15
  refresh(): void;
16
- load<T>(data: Array<T>): Promise<true>;
16
+ loadEmit<T>(): Promise<true>;
17
17
  onChanged(): Observable<SmartTableOnChangedEvent>;
18
18
  onAdded(): Observable<any>;
19
19
  onUpdated(): Observable<any>;
20
20
  onRemoved(): Observable<any>;
21
- prepend(element: T): Promise<true>;
22
- append(element: T): Promise<true>;
23
- add(element: T): Promise<true>;
24
- remove(element: T): Promise<true>;
25
- update(element: T, values: any): Promise<true>;
26
- empty(): Promise<true>;
27
- setSort(conf: Array<any>, doEmit?: boolean): void;
28
- setFilter(conf: Array<any>, andOperator?: boolean, doEmit?: boolean): void;
29
- addFilter(fieldConf: {}, andOperator?: boolean, doEmit?: boolean): void;
30
- setPaging(page: number, perPage: number, doEmit?: boolean): void;
31
- setPage(page: number, doEmit?: boolean): void;
21
+ prependEmit(element: T): Promise<true>;
22
+ appendEmit(element: T): Promise<true>;
23
+ addEmit(element: T): Promise<true>;
24
+ removeEmit(element: T): Promise<true>;
25
+ updateEmit(element: T): Promise<true>;
26
+ emptyEmit(): Promise<true>;
27
+ setSortEmit(): void;
28
+ setFilterEmit(): void;
29
+ addFilterEmit(): void;
30
+ setPagingEmit(): void;
31
+ setPageEmit(): void;
32
32
  protected emitOnRemoved(element: T): void;
33
33
  protected emitOnUpdated(element: T): void;
34
34
  protected emitOnAdded(element: T): void;
@@ -5,7 +5,7 @@ export declare class LocalDataSource<T = any> extends DataSource<T> {
5
5
  protected filteredAndSorted: T[];
6
6
  protected sortConf: SmartTableSortItem[];
7
7
  protected filterConf: SmartTableFilterConf;
8
- protected pagingConf: SmartTablePagingItem;
8
+ protected pagingConf: SmartTablePagingItem | false;
9
9
  constructor(data?: T[]);
10
10
  load(data: any): Promise<true>;
11
11
  prepend(element: T): Promise<true>;
@@ -44,11 +44,11 @@ export declare class LocalDataSource<T = any> extends DataSource<T> {
44
44
  */
45
45
  setFilter(conf: SmartTableFilterItem[], andOperator?: boolean, doEmit?: boolean): LocalDataSource;
46
46
  addFilter(fieldConf: SmartTableFilterItem, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
47
- setPaging(page: number, perPage: number, doEmit?: boolean): LocalDataSource;
48
- setPage(page: number, doEmit?: boolean): LocalDataSource;
47
+ setPaging(page: number | undefined, perPage: number, doEmit?: boolean): void;
48
+ setPage(page: number, doEmit?: boolean): void;
49
49
  getSort(): SmartTableSortItem[];
50
50
  getFilter(): SmartTableFilterConf;
51
- getPaging(): SmartTablePagingItem;
51
+ getPaging(): SmartTablePagingItem | false;
52
52
  protected prepareData(data: T[]): T[];
53
53
  protected sort(data: T[]): T[];
54
54
  protected filter(data: T[]): T[];
package/lib/lib/grid.d.ts CHANGED
@@ -1,21 +1,21 @@
1
+ import { LocalDataSource } from './data-source/local/local.data-source';
1
2
  import { Subject } from 'rxjs';
2
3
  import { Observable } from 'rxjs';
3
4
  import { EventEmitter } from '@angular/core';
4
5
  import { Column } from './data-set/column';
5
6
  import { Row } from './data-set/row';
6
7
  import { DataSet } from './data-set/data-set';
7
- import { DataSource } from './data-source/data-source';
8
- import { SmartTableSettings } from './interfaces/smart-table.models';
8
+ import { SmartTableSettings, SmartTableSortItem } from './interfaces/smart-table.models';
9
9
  export declare class Grid {
10
10
  createFormShown: boolean;
11
- source: DataSource;
11
+ source: LocalDataSource;
12
12
  settings: SmartTableSettings;
13
13
  dataSet: DataSet;
14
14
  onSelectRowSource: Subject<any>;
15
15
  onDeselectRowSource: Subject<any>;
16
16
  private sourceOnChangedSubscription;
17
17
  private sourceOnUpdatedSubscription;
18
- constructor(source: DataSource, settings: SmartTableSettings);
18
+ constructor(source: LocalDataSource, settings: SmartTableSettings);
19
19
  detach(): void;
20
20
  showActionColumn(position: string): boolean;
21
21
  isCurrentActionsPosition(position: string): boolean;
@@ -24,8 +24,8 @@ export declare class Grid {
24
24
  getNewRow(): Row;
25
25
  setSettings(settings: SmartTableSettings): void;
26
26
  getDataSet(): DataSet;
27
- setSource(source: DataSource): void;
28
- getSetting(name: string, defaultValue?: any): any;
27
+ setSource(source: LocalDataSource): void;
28
+ getSetting<T>(name: string, defaultValue?: any): T;
29
29
  getColumns(): Array<Column>;
30
30
  getRows(): Array<Row>;
31
31
  selectRow(row: Row, state: boolean): void;
@@ -38,12 +38,10 @@ export declare class Grid {
38
38
  delete(row: Row, confirmEmitter: EventEmitter<any>): void;
39
39
  processDataChange(changes: any): void;
40
40
  shouldProcessChange(changes: any): boolean;
41
- prepareSource(source: any): DataSource;
42
- getInitialSort(): any;
41
+ prepareSource(source: LocalDataSource): LocalDataSource;
42
+ getInitialSort(): SmartTableSortItem | false;
43
43
  getSelectedRowsData(): Array<any>;
44
44
  selectAllRows(status: boolean): void;
45
45
  getFirstRow(): Row;
46
46
  getLastRow(): Row;
47
- private getSelectionInfo;
48
- private getPageToSelect;
49
47
  }
@@ -14,5 +14,5 @@ export declare class Deferred {
14
14
  reject: any;
15
15
  constructor();
16
16
  }
17
- export declare function getDeepFromObject(object: {}, name: string, defaultValue?: any): any;
17
+ export declare function getDeepFromObject(object: {} | undefined, name: string, defaultValue?: any): any;
18
18
  export declare function getPageForRowIndex(index: number, perPage: number): number;