@sumaris-net/ngx-components 1.7.4 → 1.9.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 (33) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +476 -413
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/changelog.md +10 -1
  6. package/esm2015/public_api.js +2 -1
  7. package/esm2015/src/app/core/form/entity-editor.class.js +5 -1
  8. package/esm2015/src/app/core/home/home.js +2 -2
  9. package/esm2015/src/app/core/services/account.service.js +38 -27
  10. package/esm2015/src/app/core/services/base-entity-service.class.js +4 -1
  11. package/esm2015/src/app/core/services/config.service.js +11 -4
  12. package/esm2015/src/app/core/services/local-settings.service.js +18 -14
  13. package/esm2015/src/app/core/services/model/settings.model.js +1 -1
  14. package/esm2015/src/app/core/services/platform.service.js +35 -31
  15. package/esm2015/src/app/shared/directives/autofocus.directive.js +15 -24
  16. package/esm2015/src/app/shared/platforms.js +36 -0
  17. package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
  18. package/esm2015/src/app/shared/services/progress-bar.service.js +1 -1
  19. package/fesm2015/sumaris-net.ngx-components.js +414 -344
  20. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  21. package/package.json +1 -1
  22. package/public_api.d.ts +1 -0
  23. package/src/app/core/form/entity-editor.class.d.ts +1 -1
  24. package/src/app/core/services/account.service.d.ts +2 -0
  25. package/src/app/core/services/base-entity-service.class.d.ts +1 -0
  26. package/src/app/core/services/config.service.d.ts +4 -1
  27. package/src/app/core/services/local-settings.service.d.ts +0 -2
  28. package/src/app/core/services/model/settings.model.d.ts +0 -1
  29. package/src/app/core/services/platform.service.d.ts +8 -5
  30. package/src/app/shared/directives/autofocus.directive.d.ts +4 -5
  31. package/src/app/shared/platforms.d.ts +13 -0
  32. package/src/app/shared/services/entity-service.class.d.ts +1 -0
  33. package/sumaris-net.ngx-components.metadata.json +1 -1
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.4",
4
+ "version": "1.9.0",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -73,6 +73,7 @@ export * from './src/app/shared/functions';
73
73
  export * from './src/app/shared/observables';
74
74
  export * from './src/app/shared/events';
75
75
  export * from './src/app/shared/alerts';
76
+ export * from './src/app/shared/platforms';
76
77
  export * from './src/app/shared/hotkeys/shared-hotkeys.module';
77
78
  export * from './src/app/shared/hotkeys/hotkeys.service';
78
79
  export * from './src/app/shared/hotkeys/dialog/hotkeys-dialog.component';
@@ -139,12 +139,12 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
139
139
  emitEvent?: boolean;
140
140
  detailsCssClass?: string;
141
141
  }): void;
142
+ canUserWrite(data: T, opts?: any): boolean;
142
143
  protected abstract registerForms(): any;
143
144
  protected abstract computeTitle(data: T): Promise<string>;
144
145
  protected abstract setValue(data: T): Promise<void> | void;
145
146
  protected abstract get form(): FormGroup;
146
147
  protected abstract getFirstInvalidTabIndex(): number;
147
- protected abstract canUserWrite(data: T): boolean;
148
148
  /**
149
149
  * Return undefined to keep same tab
150
150
  * @protected
@@ -48,6 +48,7 @@ export declare class AccountService extends BaseGraphqlService<Account, any, num
48
48
  onChange: Subject<Account>;
49
49
  onAuthTokenChange: Subject<string>;
50
50
  onAuthBasicChange: Subject<string>;
51
+ private _stopWatching$;
51
52
  private _cache;
52
53
  private _$additionalFields;
53
54
  private _tokenType$;
@@ -109,6 +110,7 @@ export declare class AccountService extends BaseGraphqlService<Account, any, num
109
110
  isEmailExists(email: string): Promise<boolean>;
110
111
  sendConfirmationEmail(email: string, locale?: string): Promise<boolean>;
111
112
  confirmEmail(email: String, code: String): Promise<boolean>;
113
+ watch(): Observable<Account>;
112
114
  listenChanges(): Subscription;
113
115
  get additionalFields(): FormFieldDefinition[];
114
116
  get $additionalFields(): Observable<FormFieldDefinition[]>;
@@ -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
  *
@@ -33,8 +33,6 @@ export declare class LocalSettingsService extends StartableService<LocalSettings
33
33
  get usageMode(): UsageMode;
34
34
  get mobile(): boolean;
35
35
  set mobile(value: boolean);
36
- get touchUi(): boolean;
37
- set touchUi(value: boolean);
38
36
  get pageHistory(): HistoryPageReference[];
39
37
  constructor(translate: TranslateService, platform: Platform, storage: Storage, environment: any, defaultSettings: LocalSettings, defaultOptionsMap: FormFieldDefinitionMap);
40
38
  ngOnStart(): Promise<LocalSettings>;
@@ -21,7 +21,6 @@ export declare interface LocalSettings {
21
21
  locale: string;
22
22
  usageMode?: UsageMode;
23
23
  mobile?: boolean;
24
- touchUi?: boolean;
25
24
  properties?: PropertiesMap;
26
25
  pageHistory?: HistoryPageReference[];
27
26
  offlineFeatures?: (string | OfflineFeature)[];
@@ -43,17 +43,20 @@ export declare class PlatformService extends StartableService {
43
43
  private _mobile;
44
44
  private _cordova;
45
45
  private _android;
46
+ private _ios;
46
47
  private _downloadingJobs;
47
- touchUi: boolean;
48
- get mobile(): boolean;
49
48
  constructor(platform: Platform, cdkPlatform: CdkPlatform, toastController: ToastController, translate: TranslateService, dateAdapter: MomentDateAdapter, entitiesStorage: EntitiesStorage, settings: LocalSettingsService, networkService: NetworkService, accountService: AccountService, configService: ConfigService, cache: CacheService, storage: Storage, audioProvider: AudioProvider, environment: any, statusBar: StatusBar, keyboard: Keyboard, splashScreen: SplashScreen, browser: InAppBrowser, downloader: Downloader);
50
49
  is(platformName: Platforms): boolean;
50
+ get mobile(): boolean;
51
51
  /**
52
- * Say if opened has been opened from a web browser (and NOT inside an Android or iOs App).
52
+ * Say if opened has been opened inside an Android or iOs App.
53
53
  * This is used to known if there is cordova features
54
54
  */
55
- isWebOrDesktop(): boolean;
55
+ isCordova(): boolean;
56
56
  isAndroidCordova(): boolean;
57
+ isIOSCordova(): boolean;
58
+ isWeb(): boolean;
59
+ isApp(): boolean;
57
60
  get canDownload(): boolean;
58
61
  get canOpenFile(): boolean;
59
62
  width(): number;
@@ -66,7 +69,7 @@ export declare class PlatformService extends StartableService {
66
69
  filename?: string;
67
70
  } & Partial<DownloadRequest>): Observable<string>;
68
71
  openFile(filePath: string, fileMimeType: string): Promise<any>;
69
- protected configureCordovaPlugins(mobile: boolean): void;
72
+ protected configureCordovaPlugins(): void;
70
73
  protected configureTranslate(): void;
71
74
  protected configureCache(online?: boolean): void;
72
75
  protected storageReady(): Promise<LocalForage>;
@@ -1,14 +1,13 @@
1
1
  import { AfterContentInit, ElementRef, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
2
- import { Platform } from '@ionic/angular';
3
2
  import { Keyboard } from '@ionic-native/keyboard/ngx';
4
3
  export declare class AutofocusDirective implements AfterContentInit, OnChanges, OnDestroy {
5
4
  protected keyboard: Keyboard;
6
5
  shouldFocusElement: any;
7
6
  timerDelay: number;
8
- private elementRef;
9
- private timer;
10
- private touchUi;
11
- constructor(elementRef: ElementRef, platform: Platform, keyboard: Keyboard);
7
+ private readonly _elementRef;
8
+ private readonly _mobile;
9
+ private _timer;
10
+ constructor(elementRef: ElementRef, keyboard: Keyboard);
12
11
  ngAfterContentInit(): void;
13
12
  ngOnChanges(changes: SimpleChanges): void;
14
13
  ngOnDestroy(): void;
@@ -0,0 +1,13 @@
1
+ export declare const matchMedia: (win: Window, query: string) => boolean;
2
+ export declare const testUserAgent: (win: Window, expr: RegExp) => boolean;
3
+ export declare const isWindow: (win?: Window) => boolean;
4
+ /**
5
+ * Detect desktop, by fine cursor. See https://github.com/ionic-team/ionic-framework/issues/19942
6
+ * @param win
7
+ */
8
+ export declare const isDesktop: (win?: Window) => boolean;
9
+ export declare const isTouchUi: (win?: Window) => boolean;
10
+ export declare const isMobile: (win: Window) => boolean;
11
+ export declare const isIOS: (win: Window) => boolean;
12
+ export declare const isAndroid: (win: Window) => boolean;
13
+ export declare const isCordova: (win: any) => boolean;
@@ -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>;