@sumaris-net/ngx-components 1.21.0-beta19 → 1.21.0-beta21

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.
@@ -30182,9 +30182,9 @@
30182
30182
  _this.mutations = mutations;
30183
30183
  _this.subscriptions = subscriptions;
30184
30184
  _this.environment = environment;
30185
- _this._count$ = new rxjs.BehaviorSubject(0);
30186
- _this._subscriptions = new rxjs.Subscription();
30185
+ _this.count$ = new rxjs.BehaviorSubject(0);
30187
30186
  _this.listeners = [];
30187
+ _this._subscriptions = new rxjs.Subscription();
30188
30188
  _this._logPrefix = '[user-event-service] ';
30189
30189
  // For DEV only
30190
30190
  _this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
@@ -30192,7 +30192,7 @@
30192
30192
  }
30193
30193
  Object.defineProperty(AbstractUserEventService.prototype, "userEventCount", {
30194
30194
  get: function () {
30195
- return this._count$.asObservable();
30195
+ return this.count$.asObservable();
30196
30196
  },
30197
30197
  enumerable: false,
30198
30198
  configurable: true
@@ -30291,7 +30291,7 @@
30291
30291
  data: entity
30292
30292
  });
30293
30293
  // Update count
30294
- this._count$.next(this._count$.value + 1);
30294
+ this.count$.next(this.count$.value + 1);
30295
30295
  };
30296
30296
  AbstractUserEventService.prototype.count = function (filter, options) {
30297
30297
  var _a;
@@ -30332,6 +30332,8 @@
30332
30332
  }
30333
30333
  if (!filter)
30334
30334
  filter = this.defaultFilter();
30335
+ // Apply last reset date as start date
30336
+ filter.startDate = this.resetCountDate;
30335
30337
  filter = this.asFilter(filter);
30336
30338
  if (this._debug)
30337
30339
  console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
@@ -30348,7 +30350,7 @@
30348
30350
  if (total && _this._debug)
30349
30351
  console.debug(_this._logPrefix + "Received new user events count:", total);
30350
30352
  // update count
30351
- _this._count$.next(total);
30353
+ _this.count$.next(total);
30352
30354
  return total;
30353
30355
  }));
30354
30356
  };
@@ -30443,13 +30445,21 @@
30443
30445
  };
30444
30446
  AbstractUserEventService.prototype.save = function (entity, options) {
30445
30447
  return __awaiter(this, void 0, void 0, function () {
30446
- var isNew, json, now;
30448
+ var allData, withContent, json, now;
30447
30449
  var _this = this;
30448
30450
  return __generator(this, function (_b) {
30449
30451
  switch (_b.label) {
30450
30452
  case 0:
30453
+ if (!!this.mutations.save) return [3 /*break*/, 2];
30454
+ if (!this.mutations.saveAll)
30455
+ throw new Error('Not implemented');
30456
+ return [4 /*yield*/, this.saveAll([entity], options)];
30457
+ case 1:
30458
+ allData = _b.sent();
30459
+ return [2 /*return*/, allData === null || allData === void 0 ? void 0 : allData[0]];
30460
+ case 2:
30451
30461
  this.fillDefaultProperties(entity);
30452
- isNew = isNil(entity.id);
30462
+ withContent = !!entity.content;
30453
30463
  json = entity.asObject();
30454
30464
  now = Date.now();
30455
30465
  if (this._debug)
@@ -30469,75 +30479,167 @@
30469
30479
  console.debug(_this._logPrefix + "User event saved in " + (Date.now() - now) + "ms", entity);
30470
30480
  _this.copyIdAndUpdateDate(savedEntity, entity);
30471
30481
  // Add to cache
30472
- if (isNew) {
30473
- _this.insertIntoMutableCachedQueries(proxy, {
30474
- query: _this.queries.loadAll,
30475
- data: Object.assign(Object.assign({}, savedEntity), { content: null })
30476
- });
30482
+ if (withContent) {
30477
30483
  _this.insertIntoMutableCachedQueries(proxy, {
30478
30484
  query: _this.queries.loadAllWithContent,
30479
30485
  data: savedEntity
30480
30486
  });
30481
30487
  }
30488
+ else {
30489
+ _this.insertIntoMutableCachedQueries(proxy, {
30490
+ query: _this.queries.loadAll,
30491
+ data: Object.assign(Object.assign({}, savedEntity), { content: null })
30492
+ });
30493
+ }
30482
30494
  }
30483
30495
  }
30484
30496
  })];
30485
- case 1:
30497
+ case 3:
30486
30498
  _b.sent();
30487
30499
  return [2 /*return*/, entity];
30488
30500
  }
30489
30501
  });
30490
30502
  });
30491
30503
  };
30492
- AbstractUserEventService.prototype.saveAll = function (data, opts) {
30493
- var _this = this;
30494
- return Promise.all(data
30495
- .map(function (entity) { return _this.save(entity, opts); }));
30504
+ AbstractUserEventService.prototype.saveAll = function (entities, opts) {
30505
+ return __awaiter(this, void 0, void 0, function () {
30506
+ var json, now;
30507
+ var _this = this;
30508
+ return __generator(this, function (_b) {
30509
+ switch (_b.label) {
30510
+ case 0:
30511
+ if (isEmptyArray(entities))
30512
+ return [2 /*return*/, entities];
30513
+ if (!this.mutations.saveAll) {
30514
+ if (!this.mutations.save)
30515
+ throw new Error('Not implemented');
30516
+ // Save one by one
30517
+ return [2 /*return*/, chainPromises(entities.map(function (entity) { return function () { return _this.save(entity, opts); }; }))];
30518
+ }
30519
+ json = entities.map(function (entity) {
30520
+ _this.fillDefaultProperties(entity);
30521
+ return entity.asObject();
30522
+ });
30523
+ now = Date.now();
30524
+ if (this._debug)
30525
+ console.debug(this._logPrefix + "Saving user events...", json);
30526
+ return [4 /*yield*/, this.graphql.mutate({
30527
+ mutation: this.mutations.saveAll,
30528
+ variables: {
30529
+ data: json
30530
+ },
30531
+ error: { code: SocialErrorCodes.SAVE_USER_EVENT_ERROR, message: 'SOCIAL.ERROR.SAVE_USER_EVENT_ERROR' },
30532
+ update: function (proxy, _b) {
30533
+ var data = _b.data;
30534
+ // Update entity
30535
+ var savedEntities = (data === null || data === void 0 ? void 0 : data.data) || [];
30536
+ if (savedEntities.length) {
30537
+ if (_this._debug)
30538
+ console.debug(_this._logPrefix + "User events saved in " + (Date.now() - now) + "ms", savedEntities);
30539
+ entities.forEach(function (entity) {
30540
+ var savedEntity = savedEntities.find(function (e) { return EntityUtils.equals(e, entity, 'id'); });
30541
+ _this.copyIdAndUpdateDate(savedEntity, entity);
30542
+ });
30543
+ // Add to cache (assuming all with content)
30544
+ _this.insertIntoMutableCachedQueries(proxy, {
30545
+ query: _this.queries.loadAllWithContent,
30546
+ data: savedEntities
30547
+ });
30548
+ }
30549
+ }
30550
+ })];
30551
+ case 1:
30552
+ _b.sent();
30553
+ return [2 /*return*/, entities];
30554
+ }
30555
+ });
30556
+ });
30496
30557
  };
30497
- AbstractUserEventService.prototype.markAsRead = function (entity) {
30558
+ AbstractUserEventService.prototype.markAsRead = function (entities) {
30498
30559
  return __awaiter(this, void 0, void 0, function () {
30499
- var onReadListeners, onReadListeners_1, onReadListeners_1_1, listener, e_1_1;
30500
- var e_1, _b;
30501
- return __generator(this, function (_c) {
30502
- switch (_c.label) {
30560
+ var userEventWithoutReadListeners, _loop_1, this_1, _b, _c, entity, e_1_1;
30561
+ var e_1, _d;
30562
+ return __generator(this, function (_e) {
30563
+ switch (_e.label) {
30503
30564
  case 0:
30504
- onReadListeners = (this.listeners || []).filter(function (listener) { return !!listener.onRead; }).filter(function (listener) { return listener.accept(entity); });
30505
- if (!onReadListeners.length) return [3 /*break*/, 9];
30506
- _c.label = 1;
30565
+ userEventWithoutReadListeners = [];
30566
+ _loop_1 = function (entity) {
30567
+ var onReadListeners, onReadListeners_1, onReadListeners_1_1, listener, e_2_1;
30568
+ var e_2, _b;
30569
+ return __generator(this, function (_c) {
30570
+ switch (_c.label) {
30571
+ case 0:
30572
+ onReadListeners = (this_1.listeners || []).filter(function (listener) { return !!listener.onRead; }).filter(function (listener) { return listener.accept(entity); });
30573
+ if (!onReadListeners.length) return [3 /*break*/, 9];
30574
+ _c.label = 1;
30575
+ case 1:
30576
+ _c.trys.push([1, 6, 7, 8]);
30577
+ onReadListeners_1 = (e_2 = void 0, __values(onReadListeners)), onReadListeners_1_1 = onReadListeners_1.next();
30578
+ _c.label = 2;
30579
+ case 2:
30580
+ if (!!onReadListeners_1_1.done) return [3 /*break*/, 5];
30581
+ listener = onReadListeners_1_1.value;
30582
+ return [4 /*yield*/, listener.onRead(entity)];
30583
+ case 3:
30584
+ _c.sent();
30585
+ _c.label = 4;
30586
+ case 4:
30587
+ onReadListeners_1_1 = onReadListeners_1.next();
30588
+ return [3 /*break*/, 2];
30589
+ case 5: return [3 /*break*/, 8];
30590
+ case 6:
30591
+ e_2_1 = _c.sent();
30592
+ e_2 = { error: e_2_1 };
30593
+ return [3 /*break*/, 8];
30594
+ case 7:
30595
+ try {
30596
+ if (onReadListeners_1_1 && !onReadListeners_1_1.done && (_b = onReadListeners_1.return)) _b.call(onReadListeners_1);
30597
+ }
30598
+ finally { if (e_2) throw e_2.error; }
30599
+ return [7 /*endfinally*/];
30600
+ case 8: return [3 /*break*/, 10];
30601
+ case 9:
30602
+ // Add to this list for default operation
30603
+ userEventWithoutReadListeners.push(entity);
30604
+ _c.label = 10;
30605
+ case 10: return [2 /*return*/];
30606
+ }
30607
+ });
30608
+ };
30609
+ this_1 = this;
30610
+ _e.label = 1;
30507
30611
  case 1:
30508
- _c.trys.push([1, 6, 7, 8]);
30509
- onReadListeners_1 = __values(onReadListeners), onReadListeners_1_1 = onReadListeners_1.next();
30510
- _c.label = 2;
30612
+ _e.trys.push([1, 6, 7, 8]);
30613
+ _b = __values((entities || [])), _c = _b.next();
30614
+ _e.label = 2;
30511
30615
  case 2:
30512
- if (!!onReadListeners_1_1.done) return [3 /*break*/, 5];
30513
- listener = onReadListeners_1_1.value;
30514
- return [4 /*yield*/, listener.onRead(entity)];
30616
+ if (!!_c.done) return [3 /*break*/, 5];
30617
+ entity = _c.value;
30618
+ return [5 /*yield**/, _loop_1(entity)];
30515
30619
  case 3:
30516
- _c.sent();
30517
- _c.label = 4;
30620
+ _e.sent();
30621
+ _e.label = 4;
30518
30622
  case 4:
30519
- onReadListeners_1_1 = onReadListeners_1.next();
30623
+ _c = _b.next();
30520
30624
  return [3 /*break*/, 2];
30521
30625
  case 5: return [3 /*break*/, 8];
30522
30626
  case 6:
30523
- e_1_1 = _c.sent();
30627
+ e_1_1 = _e.sent();
30524
30628
  e_1 = { error: e_1_1 };
30525
30629
  return [3 /*break*/, 8];
30526
30630
  case 7:
30527
30631
  try {
30528
- if (onReadListeners_1_1 && !onReadListeners_1_1.done && (_b = onReadListeners_1.return)) _b.call(onReadListeners_1);
30632
+ if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
30529
30633
  }
30530
30634
  finally { if (e_1) throw e_1.error; }
30531
30635
  return [7 /*endfinally*/];
30532
- case 8: return [3 /*break*/, 11];
30533
- case 9:
30636
+ case 8:
30534
30637
  // Use default
30535
- return [4 /*yield*/, this.defaultMarkAsRead(entity)];
30536
- case 10:
30638
+ return [4 /*yield*/, this.defaultMarkAsRead(userEventWithoutReadListeners)];
30639
+ case 9:
30537
30640
  // Use default
30538
- _c.sent();
30539
- _c.label = 11;
30540
- case 11: return [2 /*return*/];
30641
+ _e.sent();
30642
+ return [2 /*return*/];
30541
30643
  }
30542
30644
  });
30543
30645
  });
@@ -30548,13 +30650,13 @@
30548
30650
  this.listeners.push(listener);
30549
30651
  };
30550
30652
  AbstractUserEventService.prototype.resetCount = function () {
30551
- this._count$.next(undefined);
30653
+ this.count$.next(undefined);
30654
+ this.resetCountDate = moment$6();
30552
30655
  };
30553
30656
  /* -- protected methods -- */
30554
30657
  AbstractUserEventService.prototype.onLogin = function () {
30555
30658
  return __awaiter(this, void 0, void 0, function () {
30556
30659
  var count;
30557
- var _this = this;
30558
30660
  return __generator(this, function (_b) {
30559
30661
  switch (_b.label) {
30560
30662
  case 0: return [4 /*yield*/, this.count(undefined)];
@@ -30563,12 +30665,9 @@
30563
30665
  if (this._debug)
30564
30666
  console.debug(this._logPrefix + "Receiving user events count", count);
30565
30667
  // Update count
30566
- this._count$.next(count);
30668
+ this.count$.next(count);
30567
30669
  // Then listen changes
30568
- this._listenSubscription = this.listenCountChanges(undefined).subscribe(function (count) {
30569
- if (_this._debug)
30570
- console.debug(_this._logPrefix + "Receiving new user events count", count);
30571
- });
30670
+ this._listenSubscription = this.listenCountChanges(undefined).subscribe();
30572
30671
  return [2 /*return*/];
30573
30672
  }
30574
30673
  });
@@ -30579,7 +30678,7 @@
30579
30678
  (_a = this._listenSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
30580
30679
  };
30581
30680
  AbstractUserEventService.prototype.processUserEvent = function (source, that) {
30582
- var e_2, _b;
30681
+ var e_3, _b;
30583
30682
  that = that || this;
30584
30683
  // Convert json source to IUserEvent
30585
30684
  var target = that.fromObject(source);
@@ -30598,33 +30697,41 @@
30598
30697
  }
30599
30698
  }
30600
30699
  }
30601
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
30700
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
30602
30701
  finally {
30603
30702
  try {
30604
30703
  if (listeners_1_1 && !listeners_1_1.done && (_b = listeners_1.return)) _b.call(listeners_1);
30605
30704
  }
30606
- finally { if (e_2) throw e_2.error; }
30705
+ finally { if (e_3) throw e_3.error; }
30607
30706
  }
30608
30707
  return target;
30609
30708
  };
30610
- AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvent) {
30709
+ AbstractUserEventService.prototype.defaultMarkAsRead = function (userEvents) {
30611
30710
  return __awaiter(this, void 0, void 0, function () {
30711
+ var localEntities, remoteEntities;
30612
30712
  return __generator(this, function (_b) {
30613
30713
  switch (_b.label) {
30614
30714
  case 0:
30615
- if (!userEvent)
30715
+ if (!userEvents)
30616
30716
  throw new Error(this._logPrefix + "Invalid event to save");
30717
+ if (!userEvents.length)
30718
+ return [2 /*return*/];
30617
30719
  // set read date
30618
- userEvent.readDate = moment$6();
30619
- if (!(!userEvent.id || userEvent.id < 0)) return [3 /*break*/, 1];
30620
- if (this._debug)
30621
- console.debug(this._logPrefix + "Save local user event");
30622
- return [3 /*break*/, 3];
30623
- case 1: return [4 /*yield*/, this.save(userEvent)];
30624
- case 2:
30720
+ userEvents.forEach(function (userEvent) { return userEvent.readDate = moment$6(); });
30721
+ localEntities = userEvents.filter(function (userEvent) { return !userEvent.id || userEvent.id < 0; });
30722
+ remoteEntities = userEvents.filter(function (userEvent) { return userEvent.id > 0; });
30723
+ // save local entities
30724
+ if (localEntities.length) {
30725
+ if (this._debug)
30726
+ console.debug(this._logPrefix + "Save local user event");
30727
+ // TODO !!!!!!!!!!!!!
30728
+ }
30729
+ if (!remoteEntities.length) return [3 /*break*/, 2];
30730
+ return [4 /*yield*/, this.saveAll(remoteEntities)];
30731
+ case 1:
30625
30732
  _b.sent();
30626
- _b.label = 3;
30627
- case 3: return [2 /*return*/];
30733
+ _b.label = 2;
30734
+ case 2: return [2 /*return*/];
30628
30735
  }
30629
30736
  });
30630
30737
  });
@@ -31031,12 +31138,19 @@
31031
31138
  UserEventNotificationList.prototype.ngOnDestroy = function () {
31032
31139
  this.subscriptions.unsubscribe();
31033
31140
  };
31034
- UserEventNotificationList.prototype.read = function ($event, userEvent) {
31141
+ UserEventNotificationList.prototype.read = function (event, userEvent) {
31035
31142
  var _a;
31036
31143
  if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
31037
31144
  return;
31038
31145
  (_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
31039
31146
  };
31147
+ UserEventNotificationList.prototype.readAll = function (event) {
31148
+ var _a;
31149
+ var unreadUserEvents = (this.userEvents.value || []).filter(function (value) { return !value.readDate; });
31150
+ if (!unreadUserEvents.length)
31151
+ return;
31152
+ (_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
31153
+ };
31040
31154
  UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
31041
31155
  // Execute then close popover
31042
31156
  action.executeAction(userEvent);
@@ -31053,7 +31167,7 @@
31053
31167
  UserEventNotificationList.decorators = [
31054
31168
  { type: i0.Component, args: [{
31055
31169
  selector: 'app-user-event-notification-list',
31056
- template: "\n<ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '&#10142;&nbsp;' + action.name}}\n </a>\n </span>\n </p>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <app-icon\n *ngIf=\"userEvent.icon\"\n [ref]=\"userEvent.icon\"\n height=\"16\"\n width=\"16\"\n [style.vertical-align]=\"'sub'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n</ion-list>\n",
31170
+ template: "\n<ion-list class=\"ion-list-popover\">\n\n <ion-row class=\"ion-list-header column\">\n <ion-col>\n <ion-label>{{titleI18n | translate}}</ion-label>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"read($event, userEvent)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"userEvent.avatar; else avatarIcon\" src=\"{{ userEvent.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"userEvent.avatarIcon\"\n [ref]=\"userEvent.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n </ion-avatar>\n\n <ion-grid class=\"ion-no-margin ion-no-padding\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '&#10142;&nbsp;' + action.name}}\n </a>\n </span>\n </p>\n </ion-col>\n </ion-row>\n <ion-row>\n <ion-col>\n <app-icon\n *ngIf=\"userEvent.icon\"\n [ref]=\"userEvent.icon\"\n height=\"16\"\n width=\"16\"\n [style.vertical-align]=\"'sub'\"\n ></app-icon>\n <small>\n <span>{{userEvent.creationDate|dateFromNow}}</span>\n <span [style.color]=\"'gray'\">{{ ' | ' + (userEvent.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n </ion-grid>\n </ion-item>\n\n <ion-row class=\"ion-list-footer column\">\n <ion-col>\n <a style=\"cursor: pointer\" (click)=\"readAll($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-col>\n </ion-row>\n\n</ion-list>\n",
31057
31171
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
31058
31172
  styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.unread{font-weight:700}"]
31059
31173
  },] }
@@ -31066,7 +31180,8 @@
31066
31180
  UserEventNotificationList.propDecorators = {
31067
31181
  debug: [{ type: i0.Input }],
31068
31182
  titleI18n: [{ type: i0.Input }],
31069
- readEvent: [{ type: i0.Output }]
31183
+ readEvent: [{ type: i0.Output }],
31184
+ readEvents: [{ type: i0.Output }]
31070
31185
  };
31071
31186
 
31072
31187
  var UserEventNotificationComponent = /** @class */ (function () {
@@ -31079,6 +31194,7 @@
31079
31194
  this.disabled = false;
31080
31195
  this._logPrefix = '[user-event-notification] ';
31081
31196
  this._readEvent = new i0.EventEmitter();
31197
+ this._readEvents = new i0.EventEmitter();
31082
31198
  }
31083
31199
  Object.defineProperty(UserEventNotificationComponent.prototype, "count", {
31084
31200
  get: function () {
@@ -31100,6 +31216,9 @@
31100
31216
  // Subscribe to read event
31101
31217
  this._readEvent.subscribe(function (value) {
31102
31218
  // default: mark event as read
31219
+ _this.userEventService.markAsRead([value]);
31220
+ });
31221
+ this._readEvents.subscribe(function (value) {
31103
31222
  _this.userEventService.markAsRead(value);
31104
31223
  });
31105
31224
  return [2 /*return*/];
@@ -31119,7 +31238,8 @@
31119
31238
  componentProps: {
31120
31239
  debug: this.debug,
31121
31240
  titleI18n: this.titleI18n,
31122
- readEvent: this._readEvent
31241
+ readEvent: this._readEvent,
31242
+ readEvents: this._readEvents
31123
31243
  },
31124
31244
  backdropDismiss: true,
31125
31245
  keyboardClose: true,
@@ -31182,7 +31302,7 @@
31182
31302
  entity = this.processUserEvent(entity);
31183
31303
  entity.id = this.userEvents.length + 1;
31184
31304
  this.userEvents.push(entity);
31185
- this._count$.next(this.userEvents.length);
31305
+ this.count$.next(this.userEvents.length);
31186
31306
  };
31187
31307
  UserEventTestService.prototype.asFilter = function (filter) {
31188
31308
  return filter;
@@ -31206,7 +31326,40 @@
31206
31326
  return entity;
31207
31327
  };
31208
31328
  UserEventTestService.prototype.saveAll = function (data, opts) {
31209
- return Promise.resolve([]);
31329
+ return __awaiter(this, void 0, void 0, function () {
31330
+ var _b, _c, entity, e_1_1;
31331
+ var e_1, _d;
31332
+ return __generator(this, function (_e) {
31333
+ switch (_e.label) {
31334
+ case 0:
31335
+ _e.trys.push([0, 5, 6, 7]);
31336
+ _b = __values((data || [])), _c = _b.next();
31337
+ _e.label = 1;
31338
+ case 1:
31339
+ if (!!_c.done) return [3 /*break*/, 4];
31340
+ entity = _c.value;
31341
+ return [4 /*yield*/, this.save(entity)];
31342
+ case 2:
31343
+ _e.sent();
31344
+ _e.label = 3;
31345
+ case 3:
31346
+ _c = _b.next();
31347
+ return [3 /*break*/, 1];
31348
+ case 4: return [3 /*break*/, 7];
31349
+ case 5:
31350
+ e_1_1 = _e.sent();
31351
+ e_1 = { error: e_1_1 };
31352
+ return [3 /*break*/, 7];
31353
+ case 6:
31354
+ try {
31355
+ if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
31356
+ }
31357
+ finally { if (e_1) throw e_1.error; }
31358
+ return [7 /*endfinally*/];
31359
+ case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
31360
+ }
31361
+ });
31362
+ });
31210
31363
  };
31211
31364
  UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
31212
31365
  return rxjs.of({ data: this.userEvents });