@sumaris-net/ngx-components 1.21.0-beta2 → 1.21.0-beta22

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 (26) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +478 -156
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/esm2015/src/app/core/menu/menu.component.js +2 -9
  6. package/esm2015/src/app/social/job/job.service.js +1 -2
  7. package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +23 -31
  8. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +47 -8
  9. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +73 -0
  10. package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
  11. package/esm2015/src/app/social/user-event/user-event.module.js +6 -1
  12. package/esm2015/src/app/social/user-event/user-event.service.js +201 -63
  13. package/esm2015/sumaris-net.ngx-components.js +8 -7
  14. package/fesm2015/sumaris-net.ngx-components.js +328 -103
  15. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/app/social/user-event/notification/user-event-notification.component.d.ts +5 -8
  18. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +18 -8
  19. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +35 -0
  20. package/src/app/social/user-event/user-event.model.d.ts +1 -1
  21. package/src/app/social/user-event/user-event.service.d.ts +31 -11
  22. package/src/assets/i18n/en.json +2 -1
  23. package/src/assets/i18n/fr.json +2 -1
  24. package/src/theme/_ngx-components.scss +1 -0
  25. package/sumaris-net.ngx-components.d.ts +7 -6
  26. 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.21.0-beta2",
4
+ "version": "1.21.0-beta22",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,5 +1,5 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
- import { BehaviorSubject, Observable } from 'rxjs';
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
3
  import { PopoverController } from '@ionic/angular';
4
4
  import { IUserEventService } from '../user-event.service';
5
5
  import { IUserEvent, IUserEventFilter } from '../user-event.model';
@@ -8,18 +8,15 @@ export declare class UserEventNotificationComponent implements OnInit, OnDestroy
8
8
  userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>;
9
9
  protected accountService: AccountService;
10
10
  protected popoverController: PopoverController;
11
- protected cd: ChangeDetectorRef;
12
11
  debug: boolean;
13
12
  titleI18n: string;
14
13
  disabled: boolean;
15
- userEventsSubject: BehaviorSubject<IUserEvent<any, string, import("../user-event.model").EventLevel>[]>;
16
14
  get count(): Observable<number>;
17
- private _subscriptions;
18
15
  private _logPrefix;
19
16
  private _readEvent;
20
- constructor(userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>, accountService: AccountService, popoverController: PopoverController, cd: ChangeDetectorRef);
21
- ngOnInit(): void;
17
+ private _readEvents;
18
+ constructor(userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>, accountService: AccountService, popoverController: PopoverController);
19
+ ngOnInit(): Promise<void>;
22
20
  showList(event: UIEvent): Promise<void>;
23
- protected markForCheck(): void;
24
21
  ngOnDestroy(): void;
25
22
  }
@@ -1,20 +1,30 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
2
- import { IUserEvent, UserEventAction } from '../user-event.model';
3
- import { Observable, Subject } from 'rxjs';
1
+ import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { IUserEvent, IUserEventFilter, UserEventAction } from '../user-event.model';
3
+ import { BehaviorSubject, Subscription } from 'rxjs';
4
4
  import { PopoverController } from '@ionic/angular';
5
+ import { IUserEventService } from '../user-event.service';
5
6
  export interface UserEventNotificationListOptions {
7
+ debug?: boolean;
6
8
  titleI18n?: string;
7
- userEvents?: Observable<IUserEvent<any>[]>;
8
9
  readEvent?: EventEmitter<IUserEvent<any>>;
10
+ readEvents?: EventEmitter<IUserEvent<any>[]>;
9
11
  }
10
- export declare class UserEventNotificationList implements OnInit, UserEventNotificationListOptions {
12
+ export declare class UserEventNotificationList implements OnInit, OnDestroy, UserEventNotificationListOptions {
13
+ protected cd: ChangeDetectorRef;
11
14
  protected popoverController: PopoverController;
15
+ userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>;
16
+ debug: boolean;
12
17
  titleI18n: string;
13
- userEvents: Subject<IUserEvent<any>[]>;
14
18
  readEvent: EventEmitter<IUserEvent<any>>;
15
- constructor(popoverController: PopoverController);
19
+ readEvents: EventEmitter<IUserEvent<any>[]>;
20
+ userEvents: BehaviorSubject<IUserEvent<any, string, import("../user-event.model").EventLevel>[]>;
21
+ protected subscriptions: Subscription;
22
+ constructor(cd: ChangeDetectorRef, popoverController: PopoverController, userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>);
16
23
  ngOnInit(): void;
17
- read($event: UIEvent, userEvent: IUserEvent<any>): void;
24
+ ngOnDestroy(): void;
25
+ read(event: UIEvent, userEvent: IUserEvent<any>): void;
26
+ readAll(event: UIEvent): void;
18
27
  executeAction(action: UserEventAction, userEvent: IUserEvent<any>): void;
19
28
  dismiss(): void;
29
+ protected markForCheck(): void;
20
30
  }
@@ -0,0 +1,35 @@
1
+ import { AbstractUserEventService, UserEventWatchOptions } from '../user-event.service';
2
+ import { IUserEvent, UserEvent, UserEventFilter } from '../user-event.model';
3
+ import { Observable } from 'rxjs';
4
+ import { GraphqlService } from '../../../core/graphql/graphql.service';
5
+ import { AccountService } from '../../../core/services/account.service';
6
+ import { NetworkService } from '../../../core/services/network.service';
7
+ import { TranslateService } from '@ngx-translate/core';
8
+ import { Environment } from '../../../../environments/environment.class';
9
+ import { FetchPolicy } from '@apollo/client/core';
10
+ import { EntityServiceLoadOptions, LoadResult } from '../../../shared/services/entity-service.class';
11
+ import { SortDirection } from '@angular/material/sort';
12
+ export declare class UserEventTestService extends AbstractUserEventService<UserEvent, UserEventFilter> {
13
+ protected graphql: GraphqlService;
14
+ protected accountService: AccountService;
15
+ protected network: NetworkService;
16
+ protected translate: TranslateService;
17
+ protected environment: Environment;
18
+ private userEvents;
19
+ constructor(graphql: GraphqlService, accountService: AccountService, network: NetworkService, translate: TranslateService, environment: Environment);
20
+ fromObject(source: any): UserEvent;
21
+ add(entity: IUserEvent<any>): void;
22
+ asFilter(filter: Partial<any>): any;
23
+ count(filter: any, options?: {
24
+ fetchPolicy?: FetchPolicy;
25
+ }): Promise<number>;
26
+ delete(entity: any): Promise<any>;
27
+ deleteAll(data: any[], opts?: any): Promise<any>;
28
+ listenChanges(filter: any, options?: UserEventWatchOptions & {
29
+ interval?: number;
30
+ fetchPolicy?: FetchPolicy;
31
+ }): Observable<any[]>;
32
+ save(entity: any, options?: EntityServiceLoadOptions): Promise<any>;
33
+ saveAll(data: any[], opts?: any): Promise<any[]>;
34
+ watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<any>, options?: UserEventWatchOptions): Observable<LoadResult<any>>;
35
+ }
@@ -45,7 +45,7 @@ export declare class UserEvent extends Entity<UserEvent> implements IUserEvent<U
45
45
  asObject(opts?: EntityAsObjectOptions): any;
46
46
  fromObject(source: any): void;
47
47
  }
48
- export interface IUserEventFilter<E extends IUserEvent<E>, U = string, L = EventLevel> extends IEntityFilter<any, E> {
48
+ export interface IUserEventFilter<E extends IUserEvent<E, U, L>, U = string, L = EventLevel> extends IEntityFilter<any, E> {
49
49
  types: string[];
50
50
  levels: L[];
51
51
  issuers: U[];
@@ -2,7 +2,7 @@ import { InjectionToken, OnDestroy } from '@angular/core';
2
2
  import { FetchPolicy } from '@apollo/client/core';
3
3
  import { AccountService } from '../../core/services/account.service';
4
4
  import { GraphqlService } from '../../core/graphql/graphql.service';
5
- import { Observable, Subscription } from 'rxjs';
5
+ import { BehaviorSubject, Observable } from 'rxjs';
6
6
  import { IUserEvent, IUserEventFilter, UserEvent, UserEventFilter } from './user-event.model';
7
7
  import { SortDirection } from '@angular/material/sort';
8
8
  import { EntitiesServiceWatchOptions, EntityServiceLoadOptions, IEntitiesService, LoadResult, Page } from '../../shared/services/entity-service.class';
@@ -13,6 +13,7 @@ import { TranslateService } from '@ngx-translate/core';
13
13
  import { NetworkService } from '../../core/services/network.service';
14
14
  import { BaseGraphqlService } from '../../core/services/base-graphql-service.class';
15
15
  import { Environment } from '../../../environments/environment.class';
16
+ import { Moment } from 'moment';
16
17
  export declare const UserEventServiceToken: InjectionToken<IUserEventService<any, any, UserEventWatchOptions>>;
17
18
  export declare interface UserEventWatchOptions extends EntitiesServiceWatchOptions {
18
19
  withContent?: boolean;
@@ -24,10 +25,12 @@ export interface IUserEventQueries {
24
25
  }
25
26
  export interface IUserEventMutations {
26
27
  save: any;
28
+ saveAll?: any;
27
29
  deleteByIds: any;
28
30
  }
29
31
  export interface IUserEventSubscriptions {
30
32
  listenChanges: any;
33
+ listenCountChanges?: any;
31
34
  }
32
35
  export interface IUserEventListener<E extends IUserEvent<E>> {
33
36
  accept: (E: any) => boolean;
@@ -40,29 +43,37 @@ export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEvent
40
43
  count(filter: Partial<F>, options?: {
41
44
  fetchPolicy?: FetchPolicy;
42
45
  }): Promise<number>;
46
+ listenCountChanges(filter: Partial<F>, options?: WO & {
47
+ interval?: number;
48
+ fetchPolicy?: FetchPolicy;
49
+ }): Observable<number>;
43
50
  listenChanges(filter: Partial<F>, options?: WO & {
44
51
  interval?: number;
45
52
  fetchPolicy?: FetchPolicy;
46
53
  }): Observable<E[]>;
47
54
  save(entity: E, options?: EntityServiceLoadOptions): Promise<E>;
48
55
  delete(entity: E): Promise<any>;
49
- markAsRead(entity: E): any;
56
+ markAsRead(entities: E[]): any;
57
+ registerListener(listener: IUserEventListener<E>): any;
58
+ resetCount(): any;
50
59
  }
51
- export declare abstract class AbstractUserEventService<E extends IUserEvent<E>, F extends IUserEventFilter<E>, WO extends UserEventWatchOptions = UserEventWatchOptions> extends BaseGraphqlService<E, F> implements IUserEventService<E, F, WO>, OnDestroy {
60
+ export declare abstract class AbstractUserEventService<E extends IUserEvent<E, any>, F extends IUserEventFilter<E, any>, WO extends UserEventWatchOptions = UserEventWatchOptions> extends BaseGraphqlService<E, F> implements IUserEventService<E, F, WO>, OnDestroy {
52
61
  protected graphql: GraphqlService;
53
62
  protected accountService: AccountService;
54
63
  protected network: NetworkService;
55
64
  protected translate: TranslateService;
56
- protected toastController: ToastController;
57
65
  protected queries: IUserEventQueries;
58
66
  protected mutations: IUserEventMutations;
59
67
  protected subscriptions: IUserEventSubscriptions;
60
68
  protected environment: Environment;
61
- private _count$;
62
- protected _subscriptions: Subscription;
69
+ protected count$: BehaviorSubject<number>;
70
+ protected resetCountDate: Moment;
63
71
  protected listeners: IUserEventListener<E>[];
72
+ private _subscriptions;
73
+ private _listenSubscription;
64
74
  get userEventCount(): Observable<number>;
65
- protected constructor(graphql: GraphqlService, accountService: AccountService, network: NetworkService, translate: TranslateService, toastController: ToastController, queries: IUserEventQueries, mutations: IUserEventMutations, subscriptions: IUserEventSubscriptions, environment: Environment);
75
+ protected constructor(graphql: GraphqlService, accountService: AccountService, network: NetworkService, translate: TranslateService, queries: IUserEventQueries, mutations: IUserEventMutations, subscriptions: IUserEventSubscriptions, environment: Environment);
76
+ protected ngOnStart(): Promise<void>;
66
77
  ngOnDestroy(): void;
67
78
  abstract asFilter(filter: Partial<F>): F;
68
79
  abstract fromObject(source: any): E;
@@ -72,6 +83,10 @@ export declare abstract class AbstractUserEventService<E extends IUserEvent<E>,
72
83
  count(filter: Partial<F>, options?: {
73
84
  fetchPolicy?: FetchPolicy;
74
85
  }): Promise<number>;
86
+ listenCountChanges(filter: Partial<F>, options?: WO & {
87
+ interval?: number;
88
+ fetchPolicy?: FetchPolicy;
89
+ }): Observable<number>;
75
90
  listenChanges(filter: Partial<F>, options?: WO & {
76
91
  interval?: number;
77
92
  fetchPolicy?: FetchPolicy;
@@ -79,11 +94,16 @@ export declare abstract class AbstractUserEventService<E extends IUserEvent<E>,
79
94
  delete(entity: E): Promise<any>;
80
95
  deleteAll(entities: E[], opts?: any): Promise<any>;
81
96
  save(entity: E, options?: EntityServiceLoadOptions): Promise<E>;
82
- saveAll(data: E[], opts?: any): Promise<E[]>;
83
- markAsRead(entity: E): Promise<void>;
97
+ saveAll(entities: E[], opts?: any): Promise<E[]>;
98
+ markAsRead(entities: E[]): Promise<void>;
84
99
  registerListener(listener: IUserEventListener<E>): void;
85
- protected processUserEvent(source: any): E;
86
- protected defaultMarkAsRead(userEvent: E): Promise<void>;
100
+ resetCount(): void;
101
+ protected onLogin(): Promise<void>;
102
+ protected onLogout(): void;
103
+ protected startListenCountChanges(): void;
104
+ protected stopListenCountChanges(): void;
105
+ protected processUserEvent(source: any, that?: AbstractUserEventService<E, F>): E;
106
+ protected defaultMarkAsRead(userEvents: E[]): Promise<void>;
87
107
  protected defaultFilter(): F;
88
108
  protected defaultRecipient(): any;
89
109
  protected fillDefaultProperties(entity: E): void;
@@ -389,7 +389,8 @@
389
389
  "USER_EVENT": {
390
390
  "NOTIFICATION": {
391
391
  "TITLE": "Notifications",
392
- "EMPTY": "No notification"
392
+ "EMPTY": "No notification",
393
+ "READ_ALL": "Mark all as read"
393
394
  },
394
395
  "EVENT_TYPE": "Type",
395
396
  "CREATION_DATE": "Date/Time",
@@ -392,7 +392,8 @@
392
392
  "USER_EVENT": {
393
393
  "NOTIFICATION": {
394
394
  "TITLE": "Notifications",
395
- "EMPTY": "Aucune notification"
395
+ "EMPTY": "Aucune notification",
396
+ "READ_ALL": "Marquer tout comme lu"
396
397
  },
397
398
  "EVENT_TYPE": "Type",
398
399
  "CREATION_DATE": "Date/Heure",
@@ -402,6 +402,7 @@ ion-list,
402
402
 
403
403
  }
404
404
 
405
+ ion-row.ion-list-footer,
405
406
  ion-row.mat-select-footer,
406
407
  ion-row.mat-menu-footer,
407
408
  ion-row.mat-autocomplete-footer,
@@ -10,12 +10,13 @@ export { AccountValidatorService as ɵe } from './src/app/core/services/validato
10
10
  export { LocalSettingsValidatorService as ɵh } from './src/app/core/services/validator/local-settings.validator';
11
11
  export { UserSettingsValidatorService as ɵg } from './src/app/core/services/validator/user-settings.validator';
12
12
  export { isFocusableElement as ɵc } from './src/app/shared/focusable';
13
- export { MatBadgeIconTestPage as ɵo } from './src/app/shared/material/badge/badge-icon.test';
14
- export { DateTestPage as ɵm } from './src/app/shared/material/datetime/testing/mat-date.test';
13
+ export { MatBadgeIconTestPage as ɵp } from './src/app/shared/material/badge/badge-icon.test';
14
+ export { DateTestPage as ɵn } from './src/app/shared/material/datetime/testing/mat-date.test';
15
15
  export { MatNumpadDomService as ɵb } from './src/app/shared/material/numpad/numpad.dom-service';
16
- export { NumpadTestPage as ɵn } from './src/app/shared/material/numpad/testing/numpad.test';
16
+ export { NumpadTestPage as ɵo } from './src/app/shared/material/numpad/testing/numpad.test';
17
17
  export { CustomReuseStrategy as ɵa } from './src/app/shared/shared-routing.module';
18
- export { ToastTestingPage as ɵq } from './src/app/shared/toast/toast.testing';
19
- export { ToastTestingModule as ɵp } from './src/app/shared/toast/toast.testing.module';
20
- export { JobProgressionList as ɵl } from './src/app/social/job/progression/job-progression.list';
18
+ export { ToastTestingPage as ɵr } from './src/app/shared/toast/toast.testing';
19
+ export { ToastTestingModule as ɵq } from './src/app/shared/toast/toast.testing.module';
20
+ export { JobProgressionList as ɵm } from './src/app/social/job/progression/job-progression.list';
21
21
  export { UserEventNotificationList as ɵk } from './src/app/social/user-event/notification/user-event-notification.list';
22
+ export { UserEventTestService as ɵl } from './src/app/social/user-event/testing/user-event.testing.service';