@sumaris-net/ngx-components 1.22.11-rc3 → 1.22.11-rc4

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.
@@ -30836,7 +30836,17 @@
30836
30836
  UserEventNotificationList.prototype.ngOnDestroy = function () {
30837
30837
  this.subscriptions.unsubscribe();
30838
30838
  };
30839
- UserEventNotificationList.prototype.read = function (event, userEvent) {
30839
+ UserEventNotificationList.prototype.click = function (event, userEvent) {
30840
+ if (!userEvent)
30841
+ return; // Skip
30842
+ // MarkAsRead
30843
+ this.markAsRead(event, userEvent);
30844
+ var action = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.name === 'click' || a.name === 'default'; });
30845
+ if (action) {
30846
+ this.executeAction(event, action, userEvent);
30847
+ }
30848
+ };
30849
+ UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
30840
30850
  var _a;
30841
30851
  if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
30842
30852
  return;
@@ -30849,10 +30859,36 @@
30849
30859
  return;
30850
30860
  (_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
30851
30861
  };
30852
- UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
30853
- // Execute then close popover
30854
- action.executeAction(userEvent);
30855
- this.dismiss();
30862
+ UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
30863
+ return __awaiter(this, void 0, void 0, function () {
30864
+ var res, err_1;
30865
+ return __generator(this, function (_b) {
30866
+ switch (_b.label) {
30867
+ case 0:
30868
+ if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
30869
+ return [2 /*return*/]; // Skip if prevented
30870
+ // Disable default action (.e.g avoid to call click() function)
30871
+ if (event)
30872
+ event.preventDefault();
30873
+ _b.label = 1;
30874
+ case 1:
30875
+ _b.trys.push([1, 4, , 5]);
30876
+ res = action.executeAction(userEvent);
30877
+ this.dismiss();
30878
+ if (!(res instanceof Promise)) return [3 /*break*/, 3];
30879
+ return [4 /*yield*/, res];
30880
+ case 2:
30881
+ _b.sent();
30882
+ _b.label = 3;
30883
+ case 3: return [3 /*break*/, 5];
30884
+ case 4:
30885
+ err_1 = _b.sent();
30886
+ console.error(err_1);
30887
+ return [3 /*break*/, 5];
30888
+ case 5: return [2 /*return*/];
30889
+ }
30890
+ });
30891
+ });
30856
30892
  };
30857
30893
  UserEventNotificationList.prototype.dismiss = function () {
30858
30894
  this.popoverController.dismiss();
@@ -30865,7 +30901,7 @@
30865
30901
  UserEventNotificationList.decorators = [
30866
30902
  { type: i0.Component, args: [{
30867
30903
  selector: 'app-user-event-notification-list',
30868
- 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-col class=\"top-action\" *ngIf=\"userEvents|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"readAll($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"userEvents|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\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 message\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\" [innerHTML]=\"userEvent.message\"></p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <span *ngFor=\"let action of userEvent.actions\" class=\"action\">\n <a (click)=\"executeAction(action, userEvent)\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n {{ action.name }}\n </a>\n </span>\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; margin-right: 3px\"\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-row>\n\n</ion-list>\n",
30904
+ 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-col class=\"top-action\" *ngIf=\"userEvents|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"readAll($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item *ngIf=\"userEvents|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\n </ion-item>\n <ion-item\n *ngFor=\"let userEvent of userEvents | async\"\n (click)=\"click($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 message\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\" [innerHTML]=\"userEvent.message\"></p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <span *ngFor=\"let action of userEvent.actions\" class=\"action\">\n <a (click)=\"executeAction($event, action, userEvent)\" [title]=\"action.title|translate\">\n <app-icon *ngIf=\"action.iconRef\" slot=\"start\" height=\"20\" width=\"20\" [ref]=\"action.iconRef\"></app-icon>\n {{ action.name | translate }}\n </a>\n </span>\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; margin-right: 3px\"\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-row>\n\n</ion-list>\n",
30869
30905
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
30870
30906
  styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.unread{font-weight:700}.message{font-size:.9em}.message p{margin-top:5px;margin-bottom:5px}.top-action{text-align:end;margin-right:8px}.top-action a{cursor:pointer;color:var(--ion-color-contrast)}.top-action a:hover{text-decoration:underline}.action a{margin-right:10px;cursor:pointer}.action app-icon{vertical-align:middle}"]
30871
30907
  },] }