@sumaris-net/ngx-components 1.20.30 → 1.21.0-beta1

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 (64) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +1044 -297
  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 +0 -3
  6. package/esm2015/public_api.js +5 -3
  7. package/esm2015/src/app/core/icon/icon.component.js +5 -2
  8. package/esm2015/src/app/shared/functions.js +60 -1
  9. package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +2 -3
  10. package/esm2015/src/app/shared/material/autocomplete/testing/autocomplete.test.js +2 -3
  11. package/esm2015/src/app/shared/material/chips/material.chips.js +2 -3
  12. package/esm2015/src/app/shared/material/chips/testing/chips.test.js +2 -3
  13. package/esm2015/src/app/shared/pipes/arrays.pipe.js +1 -1
  14. package/esm2015/src/app/shared/pipes/form.pipes.js +4 -2
  15. package/esm2015/src/app/shared/pipes/highlight.pipe.js +4 -4
  16. package/esm2015/src/app/shared/pipes/string.pipes.js +18 -7
  17. package/esm2015/src/app/shared/services/memory-entity-service.class.js +1 -13
  18. package/esm2015/src/app/shared/types.js +1 -1
  19. package/esm2015/src/app/social/job/job.model.js +24 -0
  20. package/esm2015/src/app/social/job/job.module.js +25 -0
  21. package/esm2015/src/app/social/job/job.service.js +54 -0
  22. package/esm2015/src/app/social/job/progression/job-progression.component.js +171 -0
  23. package/esm2015/src/app/social/job/progression/job-progression.list.js +20 -0
  24. package/esm2015/src/app/social/message/message.module.js +25 -0
  25. package/esm2015/src/app/social/social.errors.js +5 -2
  26. package/esm2015/src/app/social/social.module.js +8 -14
  27. package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +88 -0
  28. package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +39 -0
  29. package/esm2015/src/app/social/user-event/user-event.model.js +58 -2
  30. package/esm2015/src/app/social/user-event/user-event.module.js +28 -0
  31. package/esm2015/src/app/social/user-event/user-event.service.js +294 -166
  32. package/esm2015/src/app/social/user-event/user-events.table.js +17 -12
  33. package/esm2015/sumaris-net.ngx-components.js +11 -6
  34. package/fesm2015/sumaris-net.ngx-components.js +880 -264
  35. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  36. package/package.json +1 -1
  37. package/public_api.d.ts +4 -2
  38. package/src/app/core/icon/icon.component.d.ts +4 -4
  39. package/src/app/shared/functions.d.ts +9 -0
  40. package/src/app/shared/material/badge/badge-icon.test.d.ts +1 -1
  41. package/src/app/shared/pipes/form.pipes.d.ts +2 -1
  42. package/src/app/shared/services/memory-entity-service.class.d.ts +0 -6
  43. package/src/app/shared/types.d.ts +4 -0
  44. package/src/app/social/job/job.model.d.ts +32 -0
  45. package/src/app/social/job/job.module.d.ts +2 -0
  46. package/src/app/social/job/job.service.d.ts +23 -0
  47. package/src/app/social/job/progression/job-progression.component.d.ts +34 -0
  48. package/src/app/social/job/progression/job-progression.list.d.ts +12 -0
  49. package/src/app/social/message/message.module.d.ts +2 -0
  50. package/src/app/social/social.errors.d.ts +3 -0
  51. package/src/app/social/user-event/notification/user-event-notification.component.d.ts +26 -0
  52. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +20 -0
  53. package/src/app/social/user-event/user-event.model.d.ts +51 -6
  54. package/src/app/social/user-event/user-event.module.d.ts +2 -0
  55. package/src/app/social/user-event/user-event.service.d.ts +80 -51
  56. package/src/app/social/user-event/user-events.table.d.ts +6 -6
  57. package/src/assets/i18n/en-US.json +9 -2
  58. package/src/assets/i18n/en.json +9 -2
  59. package/src/assets/i18n/fr.json +8 -1
  60. package/src/theme/_ngx-components.scss +7 -0
  61. package/sumaris-net.ngx-components.d.ts +10 -5
  62. package/sumaris-net.ngx-components.metadata.json +1 -1
  63. package/esm2015/src/app/shared/services.js +0 -61
  64. package/src/app/shared/services.d.ts +0 -9
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.20.30",
4
+ "version": "1.21.0-beta1",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
package/public_api.d.ts CHANGED
@@ -82,7 +82,6 @@ export * from './src/app/shared/validator/form-error-adapter.class';
82
82
  export * from './src/app/shared/types';
83
83
  export * from './src/app/shared/dates';
84
84
  export * from './src/app/shared/functions';
85
- export * from './src/app/shared/services';
86
85
  export * from './src/app/shared/forms';
87
86
  export * from './src/app/shared/observables';
88
87
  export * from './src/app/shared/events';
@@ -169,6 +168,10 @@ export * from './src/app/social/user-event/user-event.model';
169
168
  export * from './src/app/social/user-event/user-event.fragments';
170
169
  export * from './src/app/social/user-event/user-event.service';
171
170
  export * from './src/app/social/user-event/user-events.table';
171
+ export * from './src/app/social/user-event/notification/user-event-notification.component';
172
+ export * from './src/app/social/job/job.service';
173
+ export * from './src/app/social/job/job.model';
174
+ export * from './src/app/social/job/progression/job-progression.component';
172
175
  export * from './src/app/social/message/message.model';
173
176
  export * from './src/app/social/message/message.service';
174
177
  export * from './src/app/social/message/message.form';
@@ -197,4 +200,3 @@ export * from './src/app/core/table/testing/table.testing.module';
197
200
  export * from './src/app/core/table/testing/table.testing';
198
201
  export * from './src/app/core/text-popover/testing/text-popover.testing.module';
199
202
  export * from './src/app/core/text-popover/testing/text-popover.testing';
200
- export { suggestFromArray } from "./src/app/shared/services";
@@ -1,10 +1,10 @@
1
- import { IconRef } from '../../shared/types';
2
- import { PredefinedColors } from '@ionic/core';
3
- import { ThemePalette } from '@angular/material/core';
1
+ import { AppColors, IconRef } from '../../shared/types';
4
2
  export declare class AppIconComponent {
5
3
  icon: string;
6
4
  matIcon: string;
7
5
  matSvgIcon: string;
8
- color: PredefinedColors | ThemePalette;
6
+ color: AppColors;
7
+ height: number;
8
+ width: number;
9
9
  set ref(value: IconRef);
10
10
  }
@@ -1,3 +1,4 @@
1
+ import { LoadResult } from './services/entity-service.class';
1
2
  import { KeysEnum, KeyValueType } from './types';
2
3
  export declare function isNil<T>(obj: T | null | undefined): boolean;
3
4
  export declare function isNilOrBlank<T>(obj: T | null | undefined): boolean;
@@ -45,6 +46,14 @@ export declare function removeEnd(value: string, end: string): string;
45
46
  */
46
47
  export declare function changeCaseToUnderscore(value: string): string;
47
48
  export declare function removeDiacritics(text: string): string;
49
+ export declare function suggestFromArray<T = any>(items: T[], value: any, opts?: {
50
+ offset?: number;
51
+ size?: number;
52
+ searchAttribute?: string;
53
+ searchAttributes?: string[];
54
+ excludedIds?: number[];
55
+ skipSort?: boolean;
56
+ }): LoadResult<T>;
48
57
  export declare function suggestFromStringArray(values: string[], value: any, options?: {
49
58
  searchAttribute?: string;
50
59
  searchAttributes?: string[];
@@ -5,5 +5,5 @@ export declare class MatBadgeIconTestPage {
5
5
  $icon: BehaviorSubject<string>;
6
6
  $size: BehaviorSubject<MatBadgeSize>;
7
7
  $fill: BehaviorSubject<MatBadgeFill>;
8
- $color: BehaviorSubject<"primary" | "accent" | "warn" | "light" | "tertiary" | "secondary" | "success" | "warning" | "danger" | "medium" | "dark">;
8
+ $color: BehaviorSubject<"primary" | "secondary" | "tertiary" | "success" | "warning" | "danger" | "light" | "medium" | "dark" | "accent" | "warn">;
9
9
  }
@@ -30,13 +30,14 @@ export declare class FormGetGroupPipe implements PipeTransform {
30
30
  transform(form: AbstractControl, path?: Array<string | number> | string): FormGroup;
31
31
  }
32
32
  export declare class FormGetValuePipe implements PipeTransform, OnDestroy {
33
+ private adapter;
33
34
  private _ref;
34
35
  value: any;
35
36
  private _lastControl;
36
37
  private _lastPath;
37
38
  private _onControlValueChanges;
38
39
  private _onControlStatusChanges;
39
- constructor(_ref: ChangeDetectorRef);
40
+ constructor(adapter: FormErrorTranslator, _ref: ChangeDetectorRef);
40
41
  transform(form: AbstractControl, path?: Array<string | number> | string, listenStatusChanges?: boolean): any;
41
42
  ngOnDestroy(): void;
42
43
  /**
@@ -43,12 +43,6 @@ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any,
43
43
  asFilter(source: Partial<F>): F;
44
44
  addSortByReplacement(source: string, target: string): void;
45
45
  equals(d1: T, d2: T): boolean;
46
- /**
47
- * Count data stored by the service (without hidden data).
48
- * @param opts
49
- */
50
- get count(): number;
51
- get hiddenCount(): number;
52
46
  protected filter(data: T[], _filter: F, hiddenData: T[]): T[];
53
47
  protected connect(): Observable<LoadResult<T>>;
54
48
  protected markAsSaving(): void;
@@ -1,3 +1,5 @@
1
+ import { ThemePalette } from '@angular/material/core';
2
+ import { PredefinedColors } from '@ionic/core';
1
3
  export declare type KeyType = string | number;
2
4
  export declare type KeyValueType<T> = {
3
5
  [key in KeyType]: T;
@@ -15,8 +17,10 @@ export declare interface ObjectMapEntry<O = any> {
15
17
  export declare type PropertiesMap = ObjectMap<string>;
16
18
  export declare type Property = ObjectMapEntry<string>;
17
19
  export declare type PropertiesArray = Property[];
20
+ export declare type AppColors = PredefinedColors | ThemePalette | string;
18
21
  export declare interface IconRef {
19
22
  icon?: string;
20
23
  matIcon?: string;
21
24
  matSvgIcon?: string;
25
+ color?: AppColors;
22
26
  }
@@ -0,0 +1,32 @@
1
+ import { Moment } from 'moment';
2
+ import { Entity } from '../../core/services/model/entity.model';
3
+ export declare type JobStatus = 'PENDING' | 'RUNNING' | 'SUCCESS' | 'ERROR' | 'FAILED' | 'WARNING' | 'CANCELLED';
4
+ export interface IJob {
5
+ id: number;
6
+ name: string;
7
+ type: string;
8
+ status: JobStatus;
9
+ startDate: Moment;
10
+ endDate: Moment;
11
+ configuration: string;
12
+ report: string;
13
+ }
14
+ export declare class Job implements IJob {
15
+ id: number;
16
+ name: string;
17
+ type: string;
18
+ status: JobStatus;
19
+ startDate: Moment;
20
+ endDate: Moment;
21
+ configuration: string;
22
+ report: string;
23
+ }
24
+ export declare class JobProgression extends Entity<JobProgression> {
25
+ static fromObject: (source: any, opts?: any) => JobProgression;
26
+ id: number;
27
+ message: string;
28
+ current: number;
29
+ total: number;
30
+ constructor();
31
+ fromObject(source: any): void;
32
+ }
@@ -0,0 +1,2 @@
1
+ export declare class JobModule {
2
+ }
@@ -0,0 +1,23 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { JobProgression } from './job.model';
3
+ import { BaseGraphqlService } from '../../core/services/base-graphql-service.class';
4
+ import { GraphqlService } from '../../core/graphql/graphql.service';
5
+ import { Environment } from '../../../environments/environment.class';
6
+ import { Observable } from 'rxjs';
7
+ import { FetchPolicy } from '@apollo/client/core';
8
+ export declare const JobProgressionServiceToken: InjectionToken<JobProgressionService>;
9
+ export interface IJobProgressionService {
10
+ listenChanges(id: number, options?: {
11
+ interval?: number;
12
+ fetchPolicy?: FetchPolicy;
13
+ }): Observable<JobProgression>;
14
+ }
15
+ export declare class JobProgressionService extends BaseGraphqlService<JobProgression> implements IJobProgressionService {
16
+ protected graphql: GraphqlService;
17
+ protected environment: Environment;
18
+ constructor(graphql: GraphqlService, environment: Environment);
19
+ listenChanges(id: number, options?: {
20
+ interval?: number;
21
+ fetchPolicy?: FetchPolicy;
22
+ }): Observable<JobProgression>;
23
+ }
@@ -0,0 +1,34 @@
1
+ import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { ThemePalette } from '@angular/material/core';
3
+ import { ProgressSpinnerMode } from '@angular/material/progress-spinner';
4
+ import { IJobProgressionService } from '../job.service';
5
+ import { JobProgression } from '../job.model';
6
+ import { PopoverController } from '@ionic/angular';
7
+ export declare class JobProgressionComponent implements OnInit, OnDestroy {
8
+ protected jobProgressionService: IJobProgressionService;
9
+ protected popoverController: PopoverController;
10
+ protected cd: ChangeDetectorRef;
11
+ debug: boolean;
12
+ titleI18n: string;
13
+ autoRemove: boolean;
14
+ autoHide: boolean;
15
+ autoHideDelay: number;
16
+ jobFinished: EventEmitter<number>;
17
+ disabled: boolean;
18
+ color: ThemePalette;
19
+ mode: ProgressSpinnerMode;
20
+ value: number;
21
+ jobProgressions: JobProgression[];
22
+ private _subscriptions;
23
+ private _subscriptionsById;
24
+ private _logPrefix;
25
+ constructor(jobProgressionService: IJobProgressionService, popoverController: PopoverController, cd: ChangeDetectorRef);
26
+ ngOnInit(): void;
27
+ addJob(id: number): void;
28
+ removeJob(id: number): void;
29
+ getProgression(id: number): JobProgression | undefined;
30
+ updateValue(): void;
31
+ showList(event: UIEvent): Promise<void>;
32
+ protected markForCheck(): void;
33
+ ngOnDestroy(): void;
34
+ }
@@ -0,0 +1,12 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { JobProgression } from '../job.model';
3
+ export interface JobProgressionListOptions {
4
+ titleI18n?: string;
5
+ jobProgressions?: JobProgression[];
6
+ }
7
+ export declare class JobProgressionList implements OnInit, JobProgressionListOptions {
8
+ titleI18n: string;
9
+ jobProgressions: JobProgression[];
10
+ constructor();
11
+ ngOnInit(): void;
12
+ }
@@ -0,0 +1,2 @@
1
+ export declare class MessageModule {
2
+ }
@@ -1,5 +1,8 @@
1
1
  export declare const SocialErrorCodes: {
2
2
  LOAD_USER_EVENTS_ERROR: number;
3
3
  SAVE_USER_EVENT_ERROR: number;
4
+ COUNT_USER_EVENT_ERROR: number;
4
5
  SEND_MESSAGE_ERROR: number;
6
+ SUBSCRIBE_USER_EVENTS_ERROR: number;
7
+ SUBSCRIBE_JOB_PROGRESSION_ERROR: number;
5
8
  };
@@ -0,0 +1,26 @@
1
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
+ import { BehaviorSubject, Observable } from 'rxjs';
3
+ import { PopoverController } from '@ionic/angular';
4
+ import { IUserEventService } from '../user-event.service';
5
+ import { IUserEvent, IUserEventFilter } from '../user-event.model';
6
+ import { AccountService } from '../../../core/services/account.service';
7
+ export declare class UserEventNotificationComponent implements OnInit, OnDestroy {
8
+ userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>;
9
+ protected accountService: AccountService;
10
+ protected popoverController: PopoverController;
11
+ protected cd: ChangeDetectorRef;
12
+ debug: boolean;
13
+ titleI18n: string;
14
+ disabled: boolean;
15
+ userEventsSubject: BehaviorSubject<IUserEvent<any, string, import("../user-event.model").EventLevel>[]>;
16
+ get count(): Observable<number>;
17
+ private _subscriptions;
18
+ private _subscription;
19
+ private _logPrefix;
20
+ private _readEvent;
21
+ constructor(userEventService: IUserEventService<IUserEvent<any>, IUserEventFilter<any>>, accountService: AccountService, popoverController: PopoverController, cd: ChangeDetectorRef);
22
+ ngOnInit(): void;
23
+ showList(event: UIEvent): Promise<void>;
24
+ protected markForCheck(): void;
25
+ ngOnDestroy(): void;
26
+ }
@@ -0,0 +1,20 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { IUserEvent, UserEventAction } from '../user-event.model';
3
+ import { Observable, Subject } from 'rxjs';
4
+ import { PopoverController } from '@ionic/angular';
5
+ export interface UserEventNotificationListOptions {
6
+ titleI18n?: string;
7
+ userEvents?: Observable<IUserEvent<any>[]>;
8
+ readEvent?: EventEmitter<IUserEvent<any>>;
9
+ }
10
+ export declare class UserEventNotificationList implements OnInit, UserEventNotificationListOptions {
11
+ protected popoverController: PopoverController;
12
+ titleI18n: string;
13
+ userEvents: Subject<IUserEvent<any>[]>;
14
+ readEvent: EventEmitter<IUserEvent<any>>;
15
+ constructor(popoverController: PopoverController);
16
+ ngOnInit(): void;
17
+ read($event: UIEvent, userEvent: IUserEvent<any>): void;
18
+ executeAction(action: UserEventAction, userEvent: IUserEvent<any>): void;
19
+ dismiss(): void;
20
+ }
@@ -1,29 +1,74 @@
1
1
  import { Moment } from 'moment';
2
2
  import { Entity, EntityAsObjectOptions, IEntity } from '../../core/services/model/entity.model';
3
- import { PredefinedColors } from '@ionic/core';
3
+ import { EntityFilter, IEntityFilter } from '../../core/services/model/filter.model';
4
+ import { FilterFn } from '../../shared/services/entity-service.class';
5
+ import { AppColors, IconRef } from '../../shared/types';
4
6
  export declare const UserEventTypes: {
5
7
  DEBUG_DATA: string;
6
8
  INBOX_MESSAGE: string;
7
9
  };
8
- export declare class UserEvent extends Entity<UserEvent> {
10
+ export declare type EventLevel = 'ERROR' | 'WARNING' | 'INFO' | 'DEBUG';
11
+ export interface IUserEvent<E extends Entity<E>, U = string, L = EventLevel> extends IEntity<E> {
12
+ issuer: U;
13
+ recipient: U;
14
+ type: string;
15
+ level: L;
16
+ updateDate: Moment;
17
+ creationDate: Moment;
18
+ readDate?: Moment;
19
+ message?: string;
20
+ content?: string | any;
21
+ avatar?: string;
22
+ avatarIcon?: IconRef;
23
+ icon?: IconRef;
24
+ actions?: UserEventAction[];
25
+ }
26
+ export declare class UserEvent extends Entity<UserEvent> implements IUserEvent<UserEvent> {
9
27
  static fromObject: (source: any, opts?: any) => UserEvent;
10
- eventType: string;
28
+ type: string;
29
+ level: EventLevel;
11
30
  issuer: string;
12
31
  recipient: string;
13
32
  updateDate: Moment;
14
33
  creationDate: Moment;
34
+ readDate: Moment;
35
+ message: string | undefined;
15
36
  content: string | any;
37
+ hash: string;
16
38
  signature: string;
17
39
  readSignature: string;
40
+ avatar?: string;
41
+ avatarIcon?: IconRef;
42
+ icon?: IconRef;
43
+ actions?: UserEventAction[];
18
44
  constructor();
19
45
  asObject(opts?: EntityAsObjectOptions): any;
20
46
  fromObject(source: any): void;
21
47
  }
22
- export interface UserEventAction<T extends IEntity<T>> {
48
+ export interface IUserEventFilter<E extends IUserEvent<E>, U = string, L = EventLevel> extends IEntityFilter<any, E> {
49
+ types: string[];
50
+ levels: L[];
51
+ issuers: U[];
52
+ recipients: U[];
53
+ startDate: Moment;
54
+ excludeRead: boolean;
55
+ }
56
+ export declare class UserEventFilter extends EntityFilter<UserEventFilter, UserEvent> implements IUserEventFilter<UserEvent> {
57
+ static fromObject: (source: any, opts?: any) => UserEventFilter;
58
+ types: string[];
59
+ levels: EventLevel[];
60
+ issuers: string[];
61
+ recipients: string[];
62
+ startDate: Moment;
63
+ excludeRead: boolean;
64
+ fromObject(source: any, opts?: any): void;
65
+ protected buildFilter(): FilterFn<UserEvent>[];
66
+ }
67
+ export interface UserEventAction {
23
68
  name: string | any;
24
69
  title?: string;
25
70
  icon?: string;
26
71
  matIcon?: string;
27
- color?: PredefinedColors;
28
- executeAction: (event: UserEvent, context?: T) => any | Promise<any>;
72
+ color?: AppColors;
73
+ executeAction: (event: IUserEvent<any>) => any | Promise<any>;
29
74
  }
@@ -0,0 +1,2 @@
1
+ export declare class UserEventModule {
2
+ }
@@ -1,9 +1,11 @@
1
+ import { InjectionToken, OnDestroy } from '@angular/core';
2
+ import { FetchPolicy } from '@apollo/client/core';
1
3
  import { AccountService } from '../../core/services/account.service';
2
4
  import { GraphqlService } from '../../core/graphql/graphql.service';
3
- import { Observable } from 'rxjs';
4
- import { UserEvent, UserEventAction } from './user-event.model';
5
+ import { Observable, Subscription } from 'rxjs';
6
+ import { IUserEvent, IUserEventFilter, UserEvent, UserEventFilter } from './user-event.model';
5
7
  import { SortDirection } from '@angular/material/sort';
6
- import { EntitiesServiceWatchOptions, EntityServiceLoadOptions, FilterFn, IEntitiesService, LoadResult, Page } from '../../shared/services/entity-service.class';
8
+ import { EntitiesServiceWatchOptions, EntityServiceLoadOptions, IEntitiesService, LoadResult, Page } from '../../shared/services/entity-service.class';
7
9
  import { ShowToastOptions } from '../../shared/toast/toasts';
8
10
  import { OverlayEventDetail } from '@ionic/core';
9
11
  import { ToastController } from '@ionic/angular';
@@ -11,64 +13,91 @@ import { TranslateService } from '@ngx-translate/core';
11
13
  import { NetworkService } from '../../core/services/network.service';
12
14
  import { BaseGraphqlService } from '../../core/services/base-graphql-service.class';
13
15
  import { Environment } from '../../../environments/environment.class';
14
- import { EntityFilter } from '../../core/services/model/filter.model';
15
- export declare class UserEventFilter extends EntityFilter<UserEventFilter, UserEvent> {
16
- static fromObject: (source: any, opts?: any) => UserEventFilter;
17
- issuer: string;
18
- recipient: string;
19
- fromObject(source: any, opts?: any): void;
20
- protected buildFilter(): FilterFn<UserEvent>[];
21
- }
16
+ export declare const UserEventServiceToken: InjectionToken<IUserEventService<any, any, UserEventWatchOptions>>;
22
17
  export declare interface UserEventWatchOptions extends EntitiesServiceWatchOptions {
23
18
  withContent?: boolean;
24
19
  }
25
- export interface UserEventActionDefinition extends UserEventAction<any> {
26
- __typename: string;
20
+ export interface IUserEventQueries {
21
+ loadAll: any;
22
+ loadAllWithContent: any;
23
+ count?: any;
24
+ }
25
+ export interface IUserEventMutations {
26
+ save: any;
27
+ deleteByIds: any;
28
+ }
29
+ export interface IUserEventSubscriptions {
30
+ listenChanges: any;
31
+ }
32
+ export interface IUserEventListener<E extends IUserEvent<E>> {
33
+ accept: (E: any) => boolean;
34
+ onReceived?: (E: any) => E | undefined;
35
+ onRead?: (E: any) => Promise<void> | void;
36
+ }
37
+ export interface IUserEventService<E extends IUserEvent<E>, F extends IUserEventFilter<E>, WO extends UserEventWatchOptions = UserEventWatchOptions> extends IEntitiesService<E, F, WO> {
38
+ userEventCount: Observable<number>;
39
+ add(entity: E): any;
40
+ count(filter: Partial<F>, options?: {
41
+ fetchPolicy?: FetchPolicy;
42
+ }): Promise<number>;
43
+ listenChanges(filter: Partial<F>, options?: WO & {
44
+ interval?: number;
45
+ fetchPolicy?: FetchPolicy;
46
+ }): Observable<E[]>;
47
+ save(entity: E, options?: EntityServiceLoadOptions): Promise<E>;
48
+ delete(entity: E): Promise<any>;
49
+ markAsRead(entity: E): any;
50
+ }
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 {
52
+ protected graphql: GraphqlService;
53
+ protected accountService: AccountService;
54
+ protected network: NetworkService;
55
+ protected translate: TranslateService;
56
+ protected toastController: ToastController;
57
+ protected queries: IUserEventQueries;
58
+ protected mutations: IUserEventMutations;
59
+ protected subscriptions: IUserEventSubscriptions;
60
+ protected environment: Environment;
61
+ private _count$;
62
+ protected _subscriptions: Subscription;
63
+ protected listeners: IUserEventListener<E>[];
64
+ 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);
66
+ ngOnDestroy(): void;
67
+ abstract asFilter(filter: Partial<F>): F;
68
+ abstract fromObject(source: any): E;
69
+ watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: WO): Observable<LoadResult<E>>;
70
+ watchPage(page: Page, filter?: Partial<F>, options?: WO): Observable<LoadResult<E>>;
71
+ add(entity: E): void;
72
+ count(filter: Partial<F>, options?: {
73
+ fetchPolicy?: FetchPolicy;
74
+ }): Promise<number>;
75
+ listenChanges(filter: Partial<F>, options?: WO & {
76
+ interval?: number;
77
+ fetchPolicy?: FetchPolicy;
78
+ }): Observable<E[]>;
79
+ delete(entity: E): Promise<any>;
80
+ deleteAll(entities: E[], opts?: any): Promise<any>;
81
+ save(entity: E, options?: EntityServiceLoadOptions): Promise<E>;
82
+ saveAll(data: E[], opts?: any): Promise<E[]>;
83
+ markAsRead(entity: E): Promise<void>;
84
+ registerListener(listener: IUserEventListener<E>): void;
85
+ protected processUserEvent(source: any): E;
86
+ protected defaultMarkAsRead(userEvent: E): Promise<void>;
87
+ protected defaultFilter(): F;
88
+ protected defaultRecipient(): any;
89
+ protected fillDefaultProperties(entity: E): void;
90
+ protected unreadEvents(events: E[]): number;
91
+ protected copyIdAndUpdateDate(source: E, target: E): void;
27
92
  }
28
- export declare class UserEventService extends BaseGraphqlService<UserEvent, UserEventFilter> implements IEntitiesService<UserEvent, UserEventFilter, UserEventWatchOptions> {
93
+ export declare class UserEventService extends AbstractUserEventService<UserEvent, UserEventFilter> {
29
94
  protected graphql: GraphqlService;
30
95
  protected accountService: AccountService;
31
96
  protected network: NetworkService;
32
97
  protected translate: TranslateService;
33
98
  protected toastController: ToastController;
34
99
  protected environment: Environment;
35
- private _userEventActions;
36
100
  constructor(graphql: GraphqlService, accountService: AccountService, network: NetworkService, translate: TranslateService, toastController: ToastController, environment: Environment);
37
- /**
38
- *
39
- * @param offset
40
- * @param size
41
- * @param sortBy
42
- * @param sortDirection
43
- * @param filter
44
- * @param options
45
- * @deprecated use watchPage() instead
46
- */
47
- watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: UserEventFilter, options?: UserEventWatchOptions): Observable<LoadResult<UserEvent>>;
48
- watchPage(page: Page, filter?: Partial<UserEventFilter>, options?: UserEventWatchOptions): Observable<LoadResult<UserEvent>>;
49
- saveAll(data: UserEvent[], options?: any): Promise<UserEvent[]>;
50
- /**
51
- * Save a userEvent entity
52
- *
53
- * @param entity
54
- */
55
- save(entity: UserEvent, options?: EntityServiceLoadOptions): Promise<UserEvent>;
56
- /**
57
- * Save many trips
58
- *
59
- * @param entities
60
- * @param opts
61
- */
62
- deleteAll(entities: UserEvent[], opts?: {
63
- trash?: boolean;
64
- }): Promise<any>;
65
- /**
66
- * Delete userEvent entities
67
- */
68
- delete(data: UserEvent): Promise<any>;
69
- listenChanges(id: number, options?: any): Observable<UserEvent | undefined>;
70
- registerAction(definition: UserEventActionDefinition): void;
71
- getActionsByTypename(typename: string): UserEventAction<any>[];
72
101
  showToastErrorWithContext(opts: {
73
102
  error?: any;
74
103
  message?: string;
@@ -76,8 +105,8 @@ export declare class UserEventService extends BaseGraphqlService<UserEvent, User
76
105
  }): Promise<void>;
77
106
  sendDataForDebug(data: any): Promise<UserEvent>;
78
107
  asFilter(filter: Partial<UserEventFilter>): UserEventFilter;
108
+ fromObject(source: any): UserEvent;
79
109
  protected convertObjectToString(data: any): string;
80
110
  protected showToast<T = any>(opts: ShowToastOptions): Promise<OverlayEventDetail<T>>;
81
111
  protected fillDefaultProperties(entity: UserEvent): void;
82
- protected copyIdAndUpdateDate(source: UserEvent, target: UserEvent): void;
83
112
  }
@@ -1,8 +1,8 @@
1
1
  import { ChangeDetectorRef, Injector, OnInit } from '@angular/core';
2
2
  import { TableElement } from '@e-is/ngx-material-table';
3
- import { UserEventFilter, UserEventService } from './user-event.service';
3
+ import { IUserEventService } from './user-event.service';
4
4
  import { AccountService } from '../../core/services/account.service';
5
- import { UserEvent, UserEventAction } from './user-event.model';
5
+ import { UserEvent, UserEventAction, UserEventFilter } from './user-event.model';
6
6
  import { Moment } from 'moment';
7
7
  import { AppTable } from '../../core/table/table.class';
8
8
  import { SortDirection } from '@angular/material/sort';
@@ -35,7 +35,7 @@ export interface UserEventIcon {
35
35
  }
36
36
  export declare class UserEventsTable extends AppTable<UserEvent, UserEventFilter> implements OnInit {
37
37
  protected accountService: AccountService;
38
- protected service: UserEventService;
38
+ protected service: IUserEventService<UserEvent, UserEventFilter>;
39
39
  protected entities: EntitiesStorage;
40
40
  protected cd: ChangeDetectorRef;
41
41
  protected environment: any;
@@ -47,12 +47,12 @@ export declare class UserEventsTable extends AppTable<UserEvent, UserEventFilter
47
47
  withContent: boolean;
48
48
  defaultSortBy: string;
49
49
  defaultSortDirection: SortDirection;
50
- constructor(injector: Injector, accountService: AccountService, service: UserEventService, entities: EntitiesStorage, cd: ChangeDetectorRef, environment: any);
50
+ constructor(injector: Injector, accountService: AccountService, service: IUserEventService<UserEvent, UserEventFilter>, entities: EntitiesStorage, cd: ChangeDetectorRef, environment: any);
51
51
  ngOnInit(): void;
52
52
  start(): Promise<void>;
53
53
  getIcon(source: UserEvent): UserEventIcon;
54
54
  getDetail(source: UserEvent): Partial<UserEventDetail<IEntity<any>> & {
55
- actions: UserEventAction<any>[];
55
+ actions: UserEventAction[];
56
56
  }>;
57
- doAction(action: UserEventAction<any>, row: TableElement<UserEvent>): Promise<void>;
57
+ doAction(action: UserEventAction, row: TableElement<UserEvent>): Promise<void>;
58
58
  }
@@ -387,6 +387,7 @@
387
387
  },
388
388
  "SOCIAL": {
389
389
  "USER_EVENT": {
390
+ "TITLE": "Notifications",
390
391
  "EVENT_TYPE": "Type",
391
392
  "CREATION_DATE": "Date/Time",
392
393
  "MESSAGE": "Message",
@@ -400,6 +401,9 @@
400
401
  "FEED": "Feed"
401
402
  }
402
403
  },
404
+ "JOB_PROGRESSION": {
405
+ "TITLE": "Running tasks"
406
+ },
403
407
  "MESSAGE": {
404
408
  "TYPE": "Message type",
405
409
  "RECIPIENTS": "Recipients",
@@ -416,8 +420,11 @@
416
420
  },
417
421
  "ERROR": {
418
422
  "LOAD_USER_EVENTS_ERROR": "Error while loading notifications",
423
+ "COUNT_USER_EVENT_ERROR": "Error while counting notifications",
419
424
  "SAVE_USER_EVENT_ERROR": "Error while saving user notification",
420
- "SEND_MESSAGE_ERROR": "Error while sending message"
425
+ "SUBSCRIBE_USER_EVENTS_ERROR": "Error while listening user events changes",
426
+ "SEND_MESSAGE_ERROR": "Error while sending message",
427
+ "SUBSCRIBE_JOB_PROGRESSION_ERROR": "Error while listening job progression changes"
421
428
  },
422
429
  "INFO": {
423
430
  "MESSAGE_SENT": "Message <b>sent</b>"
@@ -506,7 +513,7 @@
506
513
  "SAVE_ENTITY_ERROR": "Error while saving",
507
514
  "SAVE_ENTITIES_ERROR": "Error while saving the list",
508
515
  "DELETE_ENTITY_ERROR": "Error while deleting. <small><br/>If the problem persists, please contact your administrator.</small>",
509
- "SUBSCRIBE_ENTITY_ERROR": "Error while subscribing to remte changes",
516
+ "SUBSCRIBE_ENTITY_ERROR": "Error while subscribing to remote changes",
510
517
  "CONTROL_ENTITY_ERROR": "Error while checking data validity",
511
518
  "TERMINATE_ENTITY_ERROR": "Cannot terminate entry. <small><br/>If the problem persists, please contact your administrator.</small>",
512
519
  "VALIDATE_ENTITY_ERROR": "Error when validating data",