@sumaris-net/ngx-components 1.22.9 → 1.22.11-rc10

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 (42) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +752 -73
  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 +6 -0
  6. package/esm2015/public_api.js +11 -2
  7. package/esm2015/src/app/core/menu/menu.component.js +2 -2
  8. package/esm2015/src/app/shared/events.js +8 -3
  9. package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
  10. package/esm2015/src/app/social/job/testing/job-progression.testing.js +48 -0
  11. package/esm2015/src/app/social/job/testing/job-progression.testing.service.js +30 -0
  12. package/esm2015/src/app/social/job/testing/job.testing.module.js +25 -0
  13. package/esm2015/src/app/social/social.module.js +6 -1
  14. package/esm2015/src/app/social/social.testing.module.js +39 -0
  15. package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +94 -0
  16. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +131 -30
  17. package/esm2015/src/app/social/user-event/testing/user-event.testing.js +179 -0
  18. package/esm2015/src/app/social/user-event/testing/user-event.testing.module.js +25 -0
  19. package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +35 -6
  20. package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
  21. package/esm2015/src/app/social/user-event/user-event.module.js +4 -4
  22. package/esm2015/src/app/social/user-event/user-event.service.js +74 -17
  23. package/fesm2015/sumaris-net.ngx-components.js +637 -63
  24. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  25. package/package.json +1 -1
  26. package/public_api.d.ts +8 -1
  27. package/src/app/shared/events.d.ts +1 -1
  28. package/src/app/shared/services/entity-service.class.d.ts +7 -0
  29. package/src/app/social/job/testing/job-progression.testing.d.ts +11 -0
  30. package/src/app/social/job/testing/job-progression.testing.service.d.ts +10 -0
  31. package/src/app/social/job/testing/job.testing.module.d.ts +2 -0
  32. package/src/app/social/social.testing.module.d.ts +4 -0
  33. package/src/app/social/user-event/notification/{user-event-notification.component.d.ts → user-event-notification.icon.d.ts} +3 -2
  34. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +37 -12
  35. package/src/app/social/user-event/testing/user-event.testing.d.ts +23 -0
  36. package/src/app/social/user-event/testing/user-event.testing.module.d.ts +2 -0
  37. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +4 -3
  38. package/src/app/social/user-event/user-event.model.d.ts +1 -0
  39. package/src/app/social/user-event/user-event.service.d.ts +16 -12
  40. package/src/theme/_ngx-components.scss +12 -0
  41. package/sumaris-net.ngx-components.metadata.json +1 -1
  42. package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +0 -89
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.22.9",
4
+ "version": "1.22.11-rc10",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -171,7 +171,7 @@ export * from './src/app/social/user-event/user-event.module';
171
171
  export * from './src/app/social/user-event/user-event.model';
172
172
  export * from './src/app/social/user-event/user-event.fragments';
173
173
  export * from './src/app/social/user-event/user-event.service';
174
- export * from './src/app/social/user-event/notification/user-event-notification.component';
174
+ export * from './src/app/social/user-event/notification/user-event-notification.icon';
175
175
  export * from './src/app/social/job/job.module';
176
176
  export * from './src/app/social/job/job.model';
177
177
  export * from './src/app/social/job/job.service';
@@ -206,3 +206,10 @@ export * from './src/app/core/table/testing/table.testing';
206
206
  export * from './src/app/core/text-popover/testing/text-popover.testing.module';
207
207
  export * from './src/app/core/text-popover/testing/text-popover.testing';
208
208
  export { suggestFromArray } from "./src/app/shared/services";
209
+ export * from './src/app/social/social.testing.module';
210
+ export * from './src/app/social/user-event/testing/user-event.testing.module';
211
+ export * from './src/app/social/user-event/testing/user-event.testing';
212
+ export * from './src/app/social/user-event/testing/user-event.testing.service';
213
+ export * from './src/app/social/job/testing/job.testing.module';
214
+ export * from './src/app/social/job/testing/job-progression.testing';
215
+ export * from './src/app/social/job/testing/job-progression.testing.service';
@@ -24,4 +24,4 @@ export interface CompletableEvent extends Event {
24
24
  * @param element
25
25
  * @param threshold default to '15%'
26
26
  */
27
- export declare function fromScrollEndEvent(element: HTMLElement, threshold?: string): Observable<any>;
27
+ export declare function fromScrollEndEvent(element: HTMLElement, threshold?: string, dueTime?: number): Observable<any>;
@@ -38,6 +38,13 @@ export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptio
38
38
  delete(data: T, opts?: any): Promise<any>;
39
39
  listenChanges(id: ID, opts?: any): Observable<T | undefined>;
40
40
  }
41
+ export declare interface EntitiesServiceLoadOptions {
42
+ fetchPolicy?: FetchPolicy;
43
+ trash?: boolean;
44
+ withTotal?: boolean;
45
+ toEntity?: boolean;
46
+ [key: string]: any;
47
+ }
41
48
  export declare interface EntitiesServiceWatchOptions {
42
49
  fetchPolicy?: WatchQueryFetchPolicy;
43
50
  trash?: boolean;
@@ -0,0 +1,11 @@
1
+ import { JobProgressionComponent, JobProgressionOptions } from '../progression/job-progression.component';
2
+ import { JobProgression } from '../job.model';
3
+ export declare class JobProgressionTestingPage {
4
+ jobProgression: JobProgressionComponent;
5
+ nJob: number;
6
+ job: JobProgression;
7
+ options: JobProgressionOptions;
8
+ constructor();
9
+ incrementJob(value: number): void;
10
+ addJob(): void;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { IJobProgressionService } from '../job.service';
2
+ import { FetchPolicy } from '@apollo/client/core';
3
+ import { Observable } from 'rxjs';
4
+ import { JobProgression } from '../job.model';
5
+ export declare class JobProgressionTestService implements IJobProgressionService {
6
+ listenChanges(id: number, options?: {
7
+ interval?: number;
8
+ fetchPolicy?: FetchPolicy;
9
+ }): Observable<JobProgression>;
10
+ }
@@ -0,0 +1,2 @@
1
+ export declare class JobTestingModule {
2
+ }
@@ -0,0 +1,4 @@
1
+ import { TestingPage } from '../shared/testing/tests.page';
2
+ export declare const SOCIAL_TESTING_PAGES: TestingPage[];
3
+ export declare class SocialTestingModule {
4
+ }
@@ -4,14 +4,15 @@ import { PopoverController } from '@ionic/angular';
4
4
  import { IUserEventService } from '../user-event.service';
5
5
  import { IUserEvent, IUserEventFilter } from '../user-event.model';
6
6
  import { AccountService } from '../../../core/services/account.service';
7
- export declare class UserEventNotificationComponent implements OnInit, OnDestroy {
7
+ export declare class AppUserEventNotificationIcon implements OnInit, OnDestroy {
8
8
  userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>;
9
9
  protected accountService: AccountService;
10
10
  protected popoverController: PopoverController;
11
11
  debug: boolean;
12
12
  titleI18n: string;
13
13
  disabled: boolean;
14
- get count(): Observable<number>;
14
+ filter: any;
15
+ get countChanges(): Observable<number>;
15
16
  private _logPrefix;
16
17
  private _readEvent;
17
18
  private _readEvents;
@@ -1,30 +1,55 @@
1
- import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
1
+ import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { IUserEvent, IUserEventFilter, UserEventAction } from '../user-event.model';
3
3
  import { BehaviorSubject, Subscription } from 'rxjs';
4
- import { PopoverController } from '@ionic/angular';
4
+ import { IonContent, IonItem, PopoverController } from '@ionic/angular';
5
5
  import { IUserEventService } from '../user-event.service';
6
+ import { LocalSettingsService } from '../../../core/services/local-settings.service';
7
+ import { FetchMoreFn, LoadResult } from '../../../shared/services/entity-service.class';
8
+ import { SortDirection } from '@angular/material/sort';
6
9
  export interface UserEventNotificationListOptions {
7
10
  debug?: boolean;
8
11
  titleI18n?: string;
9
12
  readEvent?: EventEmitter<IUserEvent<any>>;
10
13
  readEvents?: EventEmitter<IUserEvent<any>[]>;
11
14
  }
12
- export declare class UserEventNotificationList implements OnInit, OnDestroy, UserEventNotificationListOptions {
15
+ export declare class UserEventNotificationList<E extends IUserEvent<any> = IUserEvent<any>> implements OnInit, OnDestroy, UserEventNotificationListOptions {
13
16
  protected cd: ChangeDetectorRef;
14
17
  protected popoverController: PopoverController;
15
- userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>;
18
+ protected settings: LocalSettingsService;
19
+ userEventService: IUserEventService<E, IUserEventFilter<any>>;
20
+ protected subscriptions: Subscription;
21
+ protected _fetchMoreFn: FetchMoreFn<LoadResult<E>>;
22
+ protected _fetchingMore: boolean;
23
+ protected _fetchMoreSubscription: Subscription;
16
24
  debug: boolean;
25
+ mobile: boolean;
17
26
  titleI18n: string;
18
- readEvent: EventEmitter<IUserEvent<any>>;
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>>);
27
+ pageSize: number;
28
+ sortBy: string;
29
+ sortDirection: SortDirection;
30
+ filter: Partial<IUserEventFilter<any>>;
31
+ enableInfiniteScroll: boolean;
32
+ readEvent: EventEmitter<E>;
33
+ readEvents: EventEmitter<E[]>;
34
+ ionContent: IonContent;
35
+ ionItems: QueryList<IonItem>;
36
+ $items: BehaviorSubject<E[]>;
37
+ $itemCount: BehaviorSubject<number>;
38
+ get canFetchMore(): boolean;
39
+ constructor(cd: ChangeDetectorRef, popoverController: PopoverController, settings: LocalSettingsService, userEventService: IUserEventService<E, IUserEventFilter<any>>);
23
40
  ngOnInit(): void;
24
41
  ngOnDestroy(): void;
25
- read(event: UIEvent, userEvent: IUserEvent<any>): void;
26
- readAll(event: UIEvent): void;
27
- executeAction(action: UserEventAction, userEvent: IUserEvent<any>): void;
42
+ click(event: UIEvent, userEvent: E): void;
43
+ isDefaultAction(action: UserEventAction): boolean;
44
+ markAsRead(event: UIEvent, userEvent: E): void;
45
+ markAllAsRead(event: UIEvent): void;
46
+ executeAction(event: UIEvent, action: UserEventAction, userEvent: IUserEvent<any>): Promise<void>;
28
47
  dismiss(): void;
48
+ fetchMore(event?: CustomEvent & {
49
+ target?: EventTarget & {
50
+ complete?: () => void;
51
+ };
52
+ }): Promise<void>;
53
+ _initInfiniteScroll(threshold?: string): Promise<void>;
29
54
  protected markForCheck(): void;
30
55
  }
@@ -0,0 +1,23 @@
1
+ import { UserEvent } from '../user-event.model';
2
+ import { Router } from '@angular/router';
3
+ import { AlertController } from '@ionic/angular';
4
+ import { TranslateService } from '@ngx-translate/core';
5
+ import { UserEventTestService } from './user-event.testing.service';
6
+ import { AppUserEventNotificationIcon } from '../notification/user-event-notification.icon';
7
+ export declare class UserEventTestingPage {
8
+ protected userEventService: UserEventTestService;
9
+ protected router: Router;
10
+ protected alertController: AlertController;
11
+ protected translateService: TranslateService;
12
+ notification: AppUserEventNotificationIcon;
13
+ constructor(userEventService: UserEventTestService, router: Router, alertController: AlertController, translateService: TranslateService);
14
+ protected customize(userEvent: UserEvent): void;
15
+ addNotification(): void;
16
+ addError(): void;
17
+ addWarning(): void;
18
+ addDebug(): void;
19
+ addNotificationWithLink(): void;
20
+ addNotificationWithAction(): void;
21
+ addNotificationWithDefaultAction(): void;
22
+ protected showMessage(text: string): Promise<void>;
23
+ }
@@ -0,0 +1,2 @@
1
+ export declare class UserEventTestingModule {
2
+ }
@@ -1,4 +1,4 @@
1
- import { AbstractUserEventService, UserEventWatchOptions } from '../user-event.service';
1
+ import { AbstractUserEventService, UserEventLoadOptions, UserEventWatchOptions } from '../user-event.service';
2
2
  import { IUserEvent, UserEvent, UserEventFilter } from '../user-event.model';
3
3
  import { Observable } from 'rxjs';
4
4
  import { GraphqlService } from '../../../core/graphql/graphql.service';
@@ -25,11 +25,12 @@ export declare class UserEventTestService extends AbstractUserEventService<UserE
25
25
  }): Promise<number>;
26
26
  delete(entity: any): Promise<any>;
27
27
  deleteAll(data: any[], opts?: any): Promise<any>;
28
- listenChanges(filter: any, options?: UserEventWatchOptions & {
28
+ listenAllChanges(filter: any, options?: UserEventWatchOptions & {
29
29
  interval?: number;
30
30
  fetchPolicy?: FetchPolicy;
31
31
  }): Observable<any[]>;
32
32
  save(entity: any, options?: EntityServiceLoadOptions): Promise<any>;
33
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>>;
34
+ watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<any>, opts?: UserEventWatchOptions): Observable<LoadResult<any>>;
35
+ loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<any>, opts?: UserEventLoadOptions): Promise<LoadResult<any>>;
35
36
  }
@@ -71,5 +71,6 @@ export interface UserEventAction {
71
71
  title?: string;
72
72
  color?: AppColors;
73
73
  iconRef?: IconRef;
74
+ default?: boolean;
74
75
  executeAction: (event: IUserEvent<any>) => any | Promise<any>;
75
76
  }
@@ -2,16 +2,19 @@ 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 { BehaviorSubject, Observable } from 'rxjs';
5
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
6
6
  import { IUserEvent, IUserEventFilter } from './user-event.model';
7
7
  import { SortDirection } from '@angular/material/sort';
8
- import { EntitiesServiceWatchOptions, EntityServiceLoadOptions, IEntitiesService, LoadResult, Page } from '../../shared/services/entity-service.class';
8
+ import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceLoadOptions, IEntitiesService, LoadResult, Page } from '../../shared/services/entity-service.class';
9
9
  import { TranslateService } from '@ngx-translate/core';
10
10
  import { NetworkService } from '../../core/services/network.service';
11
11
  import { BaseGraphqlService, BaseGraphqlServiceOptions } from '../../core/services/base-graphql-service.class';
12
12
  import { Moment } from 'moment';
13
13
  import { IStartableService } from '../../shared/services/startable-service.class';
14
- export declare const USER_EVENT_SERVICE: InjectionToken<IUserEventService<any, any, UserEventWatchOptions>>;
14
+ export declare const USER_EVENT_SERVICE: InjectionToken<IUserEventService<any, any, UserEventWatchOptions, UserEventLoadOptions>>;
15
+ export declare interface UserEventLoadOptions extends EntitiesServiceLoadOptions {
16
+ withContent?: boolean;
17
+ }
15
18
  export declare interface UserEventWatchOptions extends EntitiesServiceWatchOptions {
16
19
  withContent?: boolean;
17
20
  }
@@ -26,7 +29,7 @@ export interface IUserEventMutations {
26
29
  deleteByIds: any;
27
30
  }
28
31
  export interface IUserEventSubscriptions {
29
- listenChanges: any;
32
+ listenAllChanges: any;
30
33
  listenCountChanges?: any;
31
34
  }
32
35
  export interface IUserEventListener<E extends IUserEvent<E>> {
@@ -39,8 +42,8 @@ export interface UserEventServiceOptions<Q extends IUserEventQueries = IUserEven
39
42
  mutations?: Partial<M>;
40
43
  subscriptions?: Partial<S>;
41
44
  }
42
- export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEventFilter<E>, WO extends UserEventWatchOptions = UserEventWatchOptions> extends IEntitiesService<E, F, WO>, IStartableService {
43
- userEventCount: Observable<number>;
45
+ export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEventFilter<E>, WO extends UserEventWatchOptions = UserEventWatchOptions, LO extends UserEventLoadOptions = UserEventLoadOptions> extends IEntitiesService<E, F, WO>, IStartableService {
46
+ countSubject: Observable<number>;
44
47
  add(entity: E): any;
45
48
  count(filter: Partial<F>, options?: {
46
49
  fetchPolicy?: FetchPolicy;
@@ -49,7 +52,7 @@ export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEvent
49
52
  interval?: number;
50
53
  fetchPolicy?: FetchPolicy;
51
54
  }): Observable<number>;
52
- listenChanges(filter: Partial<F>, options?: WO & {
55
+ listenAllChanges(filter: Partial<F>, options?: WO & {
53
56
  interval?: number;
54
57
  fetchPolicy?: FetchPolicy;
55
58
  }): Observable<E[]>;
@@ -59,7 +62,7 @@ export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEvent
59
62
  registerListener(listener: IUserEventListener<E>): any;
60
63
  resetCount(): any;
61
64
  }
62
- export declare abstract class AbstractUserEventService<E extends IUserEvent<E, any>, F extends IUserEventFilter<E, any>, WO extends UserEventWatchOptions = UserEventWatchOptions, Q extends IUserEventQueries = IUserEventQueries, M extends IUserEventMutations = IUserEventMutations, S extends IUserEventSubscriptions = IUserEventSubscriptions> extends BaseGraphqlService<E, F> implements IUserEventService<E, F, WO>, OnDestroy {
65
+ export declare abstract class AbstractUserEventService<E extends IUserEvent<E, any>, F extends IUserEventFilter<E, any>, WO extends UserEventWatchOptions = UserEventWatchOptions, LO extends UserEventLoadOptions = UserEventLoadOptions, Q extends IUserEventQueries = IUserEventQueries, M extends IUserEventMutations = IUserEventMutations, S extends IUserEventSubscriptions = IUserEventSubscriptions> extends BaseGraphqlService<E, F> implements IUserEventService<E, F, WO, LO>, OnDestroy {
63
66
  protected graphql: GraphqlService;
64
67
  protected accountService: AccountService;
65
68
  protected network: NetworkService;
@@ -68,19 +71,20 @@ export declare abstract class AbstractUserEventService<E extends IUserEvent<E, a
68
71
  protected readonly queries: Q;
69
72
  protected readonly mutations: Partial<M>;
70
73
  protected readonly subscriptions: Partial<S>;
71
- protected count$: BehaviorSubject<number>;
74
+ protected readonly _countSubject: BehaviorSubject<number>;
72
75
  protected resetCountDate: Moment;
73
76
  protected listeners: IUserEventListener<E>[];
74
77
  private _subscriptions;
75
78
  private _listenSubscription;
76
- get userEventCount(): Observable<number>;
79
+ get countSubject(): Subject<number>;
77
80
  protected constructor(graphql: GraphqlService, accountService: AccountService, network: NetworkService, translate: TranslateService, options: UserEventServiceOptions<Q, M, S>);
78
81
  protected ngOnStart(): Promise<void>;
79
82
  ngOnDestroy(): void;
80
83
  abstract asFilter(filter: Partial<F>): F;
81
84
  abstract fromObject(source: any): E;
82
85
  watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: WO): Observable<LoadResult<E>>;
83
- watchPage(page: Page, filter?: Partial<F>, options?: WO): Observable<LoadResult<E>>;
86
+ watchPage(page: Page, filter?: Partial<F>, opts?: WO): Observable<LoadResult<E>>;
87
+ loadPage(page: Page, filter?: Partial<F>, opts?: LO): Promise<LoadResult<E>>;
84
88
  add(entity: E): void;
85
89
  count(filter: Partial<F>, options?: {
86
90
  fetchPolicy?: FetchPolicy;
@@ -89,7 +93,7 @@ export declare abstract class AbstractUserEventService<E extends IUserEvent<E, a
89
93
  interval?: number;
90
94
  fetchPolicy?: FetchPolicy;
91
95
  }): Observable<number>;
92
- listenChanges(filter: Partial<F>, options?: WO & {
96
+ listenAllChanges(filter: Partial<F>, options?: WO & {
93
97
  interval?: number;
94
98
  fetchPolicy?: FetchPolicy;
95
99
  }): Observable<E[]>;
@@ -1244,6 +1244,18 @@ ion-modal.stack-modal {
1244
1244
  --min-width: calc(min(500px, 80%));
1245
1245
  }
1246
1246
 
1247
+ .popover-notifications {
1248
+ --max-height: calc(90vh - 20px /* footer height */);
1249
+
1250
+ ion-item {
1251
+ --ion-item-background-color-hover: var(--ion-color-light);
1252
+ &.unread {
1253
+ --ion-item-background: rgba(var(--ion-color-secondary100-rgb), 0.2);
1254
+ --ion-item-background-color-hover: rgba(var(--ion-color-secondary100-rgb), 0.3);
1255
+ }
1256
+ }
1257
+ }
1258
+
1247
1259
  // --------------------------------------------------
1248
1260
  // Large button with icon floating on right
1249
1261
  // --------------------------------------------------