@sumaris-net/ngx-components 1.7.2 → 1.8.1

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": "1.7.2",
4
+ "version": "1.8.1",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -5,6 +5,7 @@ import { Entity } from '../services/model/entity.model';
5
5
  import { UsageMode } from '../services/model/settings.model';
6
6
  import { FormGroup } from '@angular/forms';
7
7
  import { AppTabEditor, AppTabEditorOptions } from './editor.class';
8
+ import { FormErrors } from './form.utils';
8
9
  import { EntityServiceLoadOptions, IEntityService } from '../../shared/services/entity-service.class';
9
10
  import { DateFormatPipe } from '../../shared/pipes/date-format.pipe';
10
11
  import { HistoryPageReference } from '../services/model/history.model';
@@ -25,6 +26,15 @@ export declare class AppEditorOptions extends AppTabEditorOptions {
25
26
  autoOpenNextTab?: boolean;
26
27
  i18nPrefix?: string;
27
28
  }
29
+ export interface AppError {
30
+ code?: number;
31
+ message?: string;
32
+ }
33
+ export interface AppErrorWithDetails extends AppError {
34
+ details?: AppError & {
35
+ errors?: FormErrors;
36
+ };
37
+ }
28
38
  export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends IEntityService<T, ID> = IEntityService<T, any>, ID = number> extends AppTabEditor<T, ID, EntityServiceLoadOptions> implements OnInit, OnDestroy, AfterViewInit {
29
39
  protected dataType: new () => T;
30
40
  protected dataService?: S;
@@ -122,13 +132,19 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
122
132
  delete(event?: UIEvent): Promise<boolean>;
123
133
  reload(): Promise<void>;
124
134
  goBack(event?: Event): Promise<void | boolean>;
125
- setError(err: any): void;
135
+ resetError(opts?: {
136
+ emitEvent?: boolean;
137
+ }): void;
138
+ setError(err: string | AppErrorWithDetails, opts?: {
139
+ emitEvent?: boolean;
140
+ detailsCssClass?: string;
141
+ }): void;
142
+ canUserWrite(data: T, opts?: any): boolean;
126
143
  protected abstract registerForms(): any;
127
144
  protected abstract computeTitle(data: T): Promise<string>;
128
145
  protected abstract setValue(data: T): Promise<void> | void;
129
146
  protected abstract get form(): FormGroup;
130
147
  protected abstract getFirstInvalidTabIndex(): number;
131
- protected abstract canUserWrite(data: T): boolean;
132
148
  /**
133
149
  * Return undefined to keep same tab
134
150
  * @protected
@@ -75,6 +75,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
75
75
  withTotal?: boolean;
76
76
  }): Promise<LoadResult<T>>;
77
77
  countAll(filter?: Partial<F>, opts?: LO): Promise<number>;
78
+ canUserWrite(data: T, opts?: any): boolean;
78
79
  saveAll(entities: T[], opts?: EntitySaveOptions): Promise<T[]>;
79
80
  /**
80
81
  * Save a referential entity
@@ -12,6 +12,7 @@ import { TranslateService } from '@ngx-translate/core';
12
12
  import { EntityServiceLoadOptions, IEntityService } from '../../shared/services/entity-service.class';
13
13
  import { BaseGraphqlService } from './base-graphql-service.class';
14
14
  import { IStartableService } from '../../shared/services/startable-service.class';
15
+ import { AccountService } from './account.service';
15
16
  export declare const Fragments: {
16
17
  config: import("graphql/language/ast").DocumentNode;
17
18
  };
@@ -24,16 +25,18 @@ export declare class ConfigService extends BaseGraphqlService<Configuration, any
24
25
  protected file: FileService;
25
26
  protected toastController: ToastController;
26
27
  protected translate: TranslateService;
28
+ protected accountService: AccountService;
27
29
  protected environment: any;
28
30
  private _optionDefs;
29
31
  private $data;
30
32
  get config(): Observable<Configuration>;
31
- constructor(platform: Platform, graphql: GraphqlService, storage: Storage, network: NetworkService, file: FileService, toastController: ToastController, translate: TranslateService, environment: any, defaultOptionsMap: FormFieldDefinitionMap);
33
+ constructor(platform: Platform, graphql: GraphqlService, storage: Storage, network: NetworkService, file: FileService, toastController: ToastController, translate: TranslateService, accountService: AccountService, environment: any, defaultOptionsMap: FormFieldDefinitionMap);
32
34
  protected ngOnStart(): Promise<Configuration>;
33
35
  loadDefault(opts?: EntityServiceLoadOptions): Promise<Configuration>;
34
36
  load(id: number, opts?: EntityServiceLoadOptions & {
35
37
  query?: any;
36
38
  }): Promise<Configuration>;
39
+ canUserWrite(data: Configuration, opts?: any): boolean;
37
40
  /**
38
41
  * Save a configuration
39
42
  *
@@ -30,6 +30,7 @@ export declare interface EntityServiceLoadOptions {
30
30
  }
31
31
  export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptions> {
32
32
  load(id: ID, opts?: LO): Promise<T>;
33
+ canUserWrite(data: T, opts?: any): boolean;
33
34
  save(data: T, opts?: any): Promise<T>;
34
35
  delete(data: T, opts?: any): Promise<any>;
35
36
  listenChanges(id: ID, opts?: any): Observable<T | undefined>;