@sumaris-net/ngx-components 0.13.0 → 0.13.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "0.13.0",
4
+ "version": "0.13.4",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,4 +1,4 @@
1
- import { OnDestroy, OnInit } from '@angular/core';
1
+ import { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
2
2
  import { ActivatedRoute, Params, Router } from '@angular/router';
3
3
  import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs';
4
4
  import { AlertController, IonContent, ToastController } from '@ionic/angular';
@@ -29,7 +29,7 @@ export declare class AppTabEditorOptions {
29
29
  */
30
30
  enableSwipe?: boolean;
31
31
  }
32
- export declare abstract class AppTabEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy {
32
+ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy, AfterViewInit {
33
33
  protected route: ActivatedRoute;
34
34
  protected router: Router;
35
35
  protected alertCtrl: AlertController;
@@ -73,6 +73,7 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
73
73
  abstract get isNewData(): boolean;
74
74
  protected constructor(route: ActivatedRoute, router: Router, alertCtrl: AlertController, translate: TranslateService, options?: AppTabEditorOptions);
75
75
  ngOnInit(): void;
76
+ ngAfterViewInit(): void;
76
77
  ngOnDestroy(): void;
77
78
  abstract load(id?: ID, options?: O): Promise<void>;
78
79
  abstract save(event?: Event, options?: any): Promise<boolean>;
@@ -63,6 +63,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
63
63
  protected alertCtrl: AlertController;
64
64
  protected toastController: ToastController;
65
65
  protected _focusColumn: string;
66
+ protected previouslySavedEditedRowId: number;
66
67
  excludesColumns: string[];
67
68
  displayedColumns: string[];
68
69
  totalRowCount: number | null;
@@ -234,7 +235,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
234
235
  }): void;
235
236
  addRow(event?: Event, insertAt?: number): boolean;
236
237
  save(opts?: {
237
- keepEditing: boolean;
238
+ keepEditing?: boolean;
238
239
  }): Promise<boolean>;
239
240
  cancel(event?: Event, opts?: {
240
241
  interactive?: boolean;
@@ -268,6 +269,8 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
268
269
  protected editRow(event: Event | undefined, row: TableElement<T>, opts?: {
269
270
  focusColumn?: string;
270
271
  }): boolean;
272
+ selectRowById(id: number): void;
273
+ selectRowByData(data: T): void;
271
274
  clickRow(event: UIEvent | undefined, row: TableElement<T>): boolean;
272
275
  moveRow(id: number, direction: number): void;
273
276
  openSelectColumnsModal(event?: Event): Promise<any>;
@@ -328,6 +331,15 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
328
331
  protected setError(value: string, opts?: {
329
332
  emitEvent?: boolean;
330
333
  }): void;
334
+ /**
335
+ * Compare data equality (default by id)
336
+ * Can be overridden to add additional properties to compare
337
+ *
338
+ * @param t1
339
+ * @param t2
340
+ * @protected
341
+ */
342
+ protected dataEquals(t1: T, t2: T): boolean;
331
343
  private setLoading;
332
344
  private deleteNewRow;
333
345
  private cancelExistingRow;
@@ -460,6 +460,7 @@ ion-list {
460
460
 
461
461
  .mat-table {
462
462
  min-width: 100%;
463
+ border-collapse: separate;
463
464
  --mat-cell-vertical-padding: $app-table-cell-vertical-padding;
464
465
 
465
466
  .mat-header-cell {