@sumaris-net/ngx-components 1.22.5 → 1.22.8

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.
@@ -30328,6 +30328,10 @@
30328
30328
  }
30329
30329
  return filterFns;
30330
30330
  };
30331
+ UserEventFilter.prototype.asObject = function (opts) {
30332
+ var target = _super.prototype.asObject.call(this, opts);
30333
+ return target;
30334
+ };
30331
30335
  return UserEventFilter;
30332
30336
  }(EntityFilter));
30333
30337
  exports.UserEventFilter = __decorate([
@@ -30341,7 +30345,7 @@
30341
30345
  var templateObject_1$2, templateObject_2$2;
30342
30346
 
30343
30347
  var moment$6 = momentImported__namespace;
30344
- var UserEventServiceToken = new i0.InjectionToken('UserEventService');
30348
+ var USER_EVENT_SERVICE = new i0.InjectionToken('UserEventService');
30345
30349
  var AbstractUserEventService = /** @class */ (function (_super) {
30346
30350
  __extends(AbstractUserEventService, _super);
30347
30351
  function AbstractUserEventService(graphql, accountService, network, translate, options) {
@@ -30929,7 +30933,7 @@
30929
30933
  };
30930
30934
  var UserEventService = /** @class */ (function (_super) {
30931
30935
  __extends(UserEventService, _super);
30932
- function UserEventService(graphql, accountService, network, translate, toastController, environment) {
30936
+ function UserEventService(graphql, accountService, network, translate, environment) {
30933
30937
  var _this = _super.call(this, graphql, accountService, network, translate, {
30934
30938
  queries: userEventQueries,
30935
30939
  mutations: userEventMutations,
@@ -30939,89 +30943,9 @@
30939
30943
  _this.accountService = accountService;
30940
30944
  _this.network = network;
30941
30945
  _this.translate = translate;
30942
- _this.toastController = toastController;
30943
30946
  _this.environment = environment;
30944
30947
  return _this;
30945
30948
  }
30946
- UserEventService.prototype.showToastErrorWithContext = function (opts) {
30947
- return __awaiter(this, void 0, void 0, function () {
30948
- var message, res, context, userEvent, err_1;
30949
- return __generator(this, function (_b) {
30950
- switch (_b.label) {
30951
- case 0:
30952
- message = opts.message || (opts.error && opts.error.message || opts.error);
30953
- // Make sure message a string
30954
- if (!message || typeof message !== 'string') {
30955
- message = 'ERROR.UNKNOWN_TECHNICAL_ERROR';
30956
- }
30957
- // If offline, display a simple alert
30958
- if (this.network.offline) {
30959
- this.showToast({ message: message, type: 'error' });
30960
- return [2 /*return*/];
30961
- }
30962
- // Translate the message (to be able to extract details content)
30963
- message = this.translate.instant(message);
30964
- // Clean details parts
30965
- if (message && message.indexOf('<small>') !== -1) {
30966
- message = message.substr(0, message.indexOf('<small>') - 1);
30967
- }
30968
- return [4 /*yield*/, this.showToast({
30969
- type: 'error',
30970
- duration: 15000,
30971
- message: message + '<br/><br/><b>' + this.translate.instant('CONFIRM.SEND_DEBUG_DATA') + '</b>',
30972
- buttons: [{
30973
- icon: 'bug',
30974
- text: this.translate.instant('COMMON.BTN_SEND'),
30975
- role: 'send'
30976
- }]
30977
- })];
30978
- case 1:
30979
- res = _b.sent();
30980
- if (!res || res.role !== 'send')
30981
- return [2 /*return*/];
30982
- _b.label = 2;
30983
- case 2:
30984
- _b.trys.push([2, 6, , 7]);
30985
- if (this._debug)
30986
- console.debug('Sending debug data...');
30987
- context = opts && opts.context;
30988
- if (typeof context === 'function') {
30989
- context = context();
30990
- }
30991
- if (!(context instanceof Promise)) return [3 /*break*/, 4];
30992
- return [4 /*yield*/, context];
30993
- case 3:
30994
- context = _b.sent();
30995
- _b.label = 4;
30996
- case 4: return [4 /*yield*/, this.sendDataForDebug({
30997
- message: message,
30998
- error: opts.error || undefined,
30999
- context: this.convertObjectToString(context)
31000
- })];
31001
- case 5:
31002
- userEvent = _b.sent();
31003
- console.info('Debug data successfully sent to admin', userEvent);
31004
- this.showToast({
31005
- type: 'info',
31006
- message: 'INFO.DEBUG_DATA_SEND',
31007
- showCloseButton: true
31008
- });
31009
- return [3 /*break*/, 7];
31010
- case 6:
31011
- err_1 = _b.sent();
31012
- console.error('Error while sending debug data:', err_1);
31013
- return [3 /*break*/, 7];
31014
- case 7: return [2 /*return*/];
31015
- }
31016
- });
31017
- });
31018
- };
31019
- UserEventService.prototype.sendDataForDebug = function (data) {
31020
- var userEvent = new exports.UserEvent();
31021
- userEvent.type = UserEventTypes.DEBUG_DATA;
31022
- userEvent.content = this.convertObjectToString(data);
31023
- return this.save(userEvent);
31024
- };
31025
30949
  UserEventService.prototype.asFilter = function (filter) {
31026
30950
  return exports.UserEventFilter.fromObject(filter);
31027
30951
  };
@@ -31029,33 +30953,6 @@
31029
30953
  return exports.UserEvent.fromObject(source);
31030
30954
  };
31031
30955
  /* -- protected methods -- */
31032
- UserEventService.prototype.convertObjectToString = function (data) {
31033
- if (typeof data === 'string') {
31034
- return data;
31035
- }
31036
- // Serialize content into string
31037
- else if (typeof data === 'object') {
31038
- if (data instanceof Entity) {
31039
- return JSON.stringify(data.asObject({ keepTypename: true, keepLocalId: true, minify: false }));
31040
- }
31041
- else {
31042
- return JSON.stringify(data);
31043
- }
31044
- }
31045
- };
31046
- UserEventService.prototype.showToast = function (opts) {
31047
- return __awaiter(this, void 0, void 0, function () {
31048
- return __generator(this, function (_b) {
31049
- switch (_b.label) {
31050
- case 0:
31051
- if (!this.toastController)
31052
- throw new Error('Missing toastController in component\'s constructor');
31053
- return [4 /*yield*/, Toasts.show(this.toastController, this.translate, opts)];
31054
- case 1: return [2 /*return*/, _b.sent()];
31055
- }
31056
- });
31057
- });
31058
- };
31059
30956
  UserEventService.prototype.fillDefaultProperties = function (entity) {
31060
30957
  entity.issuer = this.accountService.account.pubkey;
31061
30958
  // TODO: compute hash (using cryptoService)
@@ -31072,7 +30969,6 @@
31072
30969
  { type: AccountService },
31073
30970
  { type: NetworkService },
31074
30971
  { type: i1$2.TranslateService },
31075
- { type: i1$5.ToastController },
31076
30972
  { type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
31077
30973
  ]; };
31078
30974
  var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$2;
@@ -31081,29 +30977,6 @@
31081
30977
  DEBUG_DATA: { matIcon: 'bug_report' },
31082
30978
  INBOX_MESSAGE: { matIcon: 'mail' }
31083
30979
  };
31084
- // TODO: refactor with a registration done by data service:
31085
- // - userEventService.registerEventAction({__typename: 'TripVO', ...})
31086
- // - userEventService.getActionsFor(__typename): UserEventDetailAction
31087
- /*const DETAILS_MAP: {[key: string]: UserEventAction<RootDataEntity<any>>} = {
31088
- "TripVO": {
31089
- icon: null,
31090
- matIcon: "content_copy",
31091
- action: 'copyToLocal',
31092
- actionTitle: 'SOCIAL.USER_EVENT.BTN_COPY_TO_LOCAL',
31093
- actionColor: 'primary',
31094
- fromObject: Trip.fromObject,
31095
- childrenFields: ['operation', 'landing']
31096
- },
31097
- "ObservedLocationVO": {
31098
- icon: null,
31099
- matIcon: "content_copy",
31100
- action: 'copyToLocal',
31101
- actionTitle: 'SOCIAL.USER_EVENT.BTN_COPY_TO_LOCAL',
31102
- actionColor: 'primary',
31103
- fromObject: ObservedLocation.fromObject,
31104
- childrenFields: ['landings']
31105
- }
31106
- }*/
31107
30980
  var UserEventsTable = /** @class */ (function (_super) {
31108
30981
  __extends(UserEventsTable, _super);
31109
30982
  function UserEventsTable(injector, accountService, service, entities, cd, environment) {
@@ -31233,18 +31106,13 @@
31233
31106
  selector: 'app-user-events-table',
31234
31107
  template: "\n<!-- Type = options menu -->\n<mat-menu #optionsMenu=\"matMenu\" xPosition=\"after\">\n\n <!-- display columns -->\n <button mat-menu-item\n (click)=\"openSelectColumnsModal($event)\">\n <mat-icon>view_column</mat-icon>\n <ion-label translate>COMMON.DISPLAYED_COLUMNS_DOTS</ion-label>\n </button>\n\n</mat-menu>\n\n<!-- top header -->\n<mat-toolbar>\n\n <ng-container *ngIf=\"!selection.hasValue(); else hasSelection\">\n\n <button mat-icon-button [title]=\"'COMMON.BTN_REFRESH'|translate\" (click)=\"onRefresh.emit()\">\n <mat-icon>refresh</mat-icon>\n </button>\n\n </ng-container>\n\n <!-- if row selection -->\n <ng-template #hasSelection>\n\n <!-- delete -->\n <button mat-icon-button class=\"hidden-xs hidden-sm\" *ngIf=\"canDelete\"\n [title]=\"'COMMON.BTN_DELETE'|translate\" (click)=\"deleteSelection($event)\">\n <mat-icon>delete</mat-icon>\n </button>\n </ng-template>\n\n <!-- error -->\n <ion-item *ngIf=\"error\" hidden-xs hidden-sm hidden-mobile lines=\"none\">\n <ion-icon color=\"danger\" slot=\"start\" name=\"alert-circle\"></ion-icon>\n <ion-label color=\"danger\" class=\"error\" [innerHTML]=\"error|translate\"></ion-label>\n </ion-item>\n\n <div class=\"toolbar-spacer\"></div>\n\n <button mat-icon-button\n [title]=\"'COMMON.BTN_OPTIONS'|translate\"\n [matMenuTriggerFor]=\"optionsMenu\">\n <mat-icon>more_vert</mat-icon>\n </button>\n</mat-toolbar>\n\n\n<mat-table [dataSource]=\"dataSource\" matSort\n [matSortActive]=\"defaultSortBy\"\n [matSortDirection]=\"defaultSortDirection\"\n matSortDisableClear [trackBy]=\"trackByFn\">\n\n <!-- select -->\n <ng-container matColumnDef=\"select\">\n <mat-header-cell *matHeaderCellDef [class.cdk-visually-hidden]=\"!canEdit\">\n <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\">\n </mat-checkbox>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\" [class.cdk-visually-hidden]=\"!canEdit\">\n <mat-checkbox (click)=\"$event.stopPropagation()\" (change)=\"$event ? selection.toggle(row) : null\" [checked]=\"selection.isSelected(row)\">\n </mat-checkbox>\n </mat-cell>\n </ng-container>\n\n <!-- id -->\n <ng-container matColumnDef=\"id\">\n <mat-header-cell *matHeaderCellDef mat-sort-header [class.cdk-visually-hidden]=\"!isAdmin\">\n <app-loading-spinner [loading]=\"loadingSubject|async\"><ion-label>#</ion-label></app-loading-spinner>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\" [class.cdk-visually-hidden]=\"!isAdmin\">{{ row.currentData.id | mathAbs }}</mat-cell>\n </ng-container>\n\n <!-- creationDate -->\n <ng-container matColumnDef=\"creationDate\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.CREATION_DATE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <ion-text>\n {{row.currentData.creationDate | dateFromNow }}<br/>\n <ion-text color=\"medium\"><small>{{row.currentData.creationDate | dateFormat: {time: true} }}</small></ion-text>\n </ion-text>\n </mat-cell>\n </ng-container>\n\n <!-- icon -->\n <ng-container matColumnDef=\"icon\">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <ng-container *ngIf=\"getIcon(row.currentData); let details\">\n <ion-icon slot=\"start\" *ngIf=\"details.icon\" [name]=\"details.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"details.matIcon\">{{details.matIcon}}</mat-icon>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <!-- event type -->\n <ng-container matColumnDef=\"eventType\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>\n <ion-label translate>SOCIAL.USER_EVENT.EVENT_TYPE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <span>{{'SOCIAL.USER_EVENT.TYPE_ENUM.' + row.currentData.eventType | translate}}</span>\n </mat-cell>\n </ng-container>\n\n <!-- message -->\n <ng-container matColumnDef=\"message\">\n <mat-header-cell *matHeaderCellDef>\n <ion-label translate>SOCIAL.USER_EVENT.MESSAGE</ion-label>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row;\">\n <ng-container *ngIf=\"getDetail(row.currentData); let details\">\n <ion-text [innerHTML]=\"details.title|translate\">\n </ion-text>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <!-- Actions buttons column -->\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef>\n </mat-header-cell>\n <mat-cell *matCellDef=\"let row\">\n <ng-container *ngIf=\"getDetail(row.currentData); let details\">\n <button mat-icon-button color=\"light\"\n *ngFor=\"let action of details.actions\"\n [title]=\"action.title |translate\"\n [color]=\"action.color\"\n (click)=\"doAction(action, row)\">\n <app-icon slot=\"start\" *ngIf=\"action.iconRef\" [ref]=\"action.iconRef\"></app-icon>\n </button>\n </ng-container>\n </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns;\"\n class=\"mat-row-disabled\"\n (click)=\"clickRow($event, row)\"></mat-row>\n\n</mat-table>\n\n<ion-row class=\"ion-no-padding\">\n <ion-col></ion-col>\n <ion-col class=\"ion-no-padding\" size=\"auto\">\n <mat-paginator [length]=\"totalRowCount\" [pageSize]=\"defaultPageSize\" [pageSizeOptions]=\"defaultPageSizeOptions\" showFirstLastButtons>\n </mat-paginator>\n </ion-col>\n</ion-row>\n",
31235
31108
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
31236
- providers: [
31237
- {
31238
- provide: UserEventServiceToken, useClass: UserEventService
31239
- }
31240
- ],
31241
31109
  styles: [".mat-header-row .mat-column-icon,.mat-row .mat-column-icon{max-width:40px;padding-left:0}.mat-header-row .mat-column-icon ion-icon,.mat-header-row .mat-column-icon mat-icon,.mat-row .mat-column-icon ion-icon,.mat-row .mat-column-icon mat-icon{font-size:1.2em;height:1.2em;width:1.2em}.mat-header-row .mat-column-creationDate,.mat-row .mat-column-creationDate{min-width:100px;max-width:120px}"]
31242
31110
  },] }
31243
31111
  ];
31244
31112
  UserEventsTable.ctorParameters = function () { return [
31245
31113
  { type: i0.Injector },
31246
31114
  { type: AccountService },
31247
- { type: undefined, decorators: [{ type: i0.Inject, args: [UserEventServiceToken,] }] },
31115
+ { type: undefined, decorators: [{ type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
31248
31116
  { type: EntitiesStorage },
31249
31117
  { type: i0.ChangeDetectorRef },
31250
31118
  { type: undefined, decorators: [{ type: i0.Inject, args: [ENVIRONMENT,] }] }
@@ -31323,7 +31191,7 @@
31323
31191
  UserEventNotificationList.ctorParameters = function () { return [
31324
31192
  { type: i0.ChangeDetectorRef },
31325
31193
  { type: i1$5.PopoverController },
31326
- { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [UserEventServiceToken,] }] }
31194
+ { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
31327
31195
  ]; };
31328
31196
  UserEventNotificationList.propDecorators = {
31329
31197
  debug: [{ type: i0.Input }],
@@ -31429,7 +31297,7 @@
31429
31297
  },] }
31430
31298
  ];
31431
31299
  UserEventNotificationComponent.ctorParameters = function () { return [
31432
- { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [UserEventServiceToken,] }] },
31300
+ { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
31433
31301
  { type: AccountService },
31434
31302
  { type: i1$5.PopoverController }
31435
31303
  ]; };
@@ -31561,7 +31429,7 @@
31561
31429
  UserEventNotificationComponent
31562
31430
  ],
31563
31431
  providers: [
31564
- { provide: UserEventServiceToken, useClass: UserEventTestService }
31432
+ { provide: USER_EVENT_SERVICE, useClass: UserEventTestService }
31565
31433
  ]
31566
31434
  },] }
31567
31435
  ];
@@ -34571,6 +34439,7 @@
34571
34439
  exports.TranslatablePipe = TranslatablePipe;
34572
34440
  exports.TranslateContextPipe = TranslateContextPipe;
34573
34441
  exports.TranslateContextService = TranslateContextService;
34442
+ exports.USER_EVENT_SERVICE = USER_EVENT_SERVICE;
34574
34443
  exports.UploadFile = UploadFile;
34575
34444
  exports.UploadFileComponent = UploadFileComponent;
34576
34445
  exports.UploadFilePopover = UploadFilePopover;
@@ -34581,7 +34450,6 @@
34581
34450
  exports.UserEventModule = UserEventModule;
34582
34451
  exports.UserEventNotificationComponent = UserEventNotificationComponent;
34583
34452
  exports.UserEventService = UserEventService;
34584
- exports.UserEventServiceToken = UserEventServiceToken;
34585
34453
  exports.UserEventTypes = UserEventTypes;
34586
34454
  exports.UserEventsTable = UserEventsTable;
34587
34455
  exports.UsersPage = UsersPage;