@sumaris-net/ngx-components 1.22.11-rc2 → 1.22.11-rc5

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.
@@ -1173,7 +1173,7 @@
1173
1173
  else {
1174
1174
  throw new Error('Invalid argument \'threshold\'. Expected value unit: \'px\' or \'%\' ');
1175
1175
  }
1176
- return rxjs.fromEvent(element, 'scroll')
1176
+ return rxjs.merge(rxjs.fromEvent(element, 'scroll'), rxjs.timer(250))
1177
1177
  .pipe(operators.filter(function () { return isEnd(); }));
1178
1178
  }
1179
1179
 
@@ -30289,7 +30289,7 @@
30289
30289
  AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
30290
30290
  return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
30291
30291
  };
30292
- AbstractUserEventService.prototype.watchPage = function (page, filter, options) {
30292
+ AbstractUserEventService.prototype.watchPage = function (page, filter, opts) {
30293
30293
  var _this = this;
30294
30294
  var _a;
30295
30295
  var now = this._debug && Date.now();
@@ -30306,7 +30306,7 @@
30306
30306
  filter.recipients = [recipient];
30307
30307
  }
30308
30308
  }
30309
- var withContent = (options === null || options === void 0 ? void 0 : options.withContent) === true;
30309
+ var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30310
30310
  return this.mutableWatchQuery({
30311
30311
  queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
30312
30312
  query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
@@ -30319,7 +30319,8 @@
30319
30319
  },
30320
30320
  arrayFieldName: 'data',
30321
30321
  error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
30322
- fetchPolicy: (options === null || options === void 0 ? void 0 : options.fetchPolicy) || 'cache-first'
30322
+ fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
30323
+ insertFilterFn: filter && filter.asFilterFn()
30323
30324
  })
30324
30325
  .pipe(operators.map(function (res) {
30325
30326
  var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
@@ -30329,12 +30330,77 @@
30329
30330
  }
30330
30331
  // Must re-order because of listenChanges result will add new event at the end
30331
30332
  data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30332
- return {
30333
+ var result = {
30333
30334
  data: data,
30334
30335
  total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30335
30336
  };
30337
+ // Add fetch more capability, if total was fetched
30338
+ if (isNotNil(res.total)) {
30339
+ var nextOffset_1 = (page.offset || 0) + data.length;
30340
+ if (nextOffset_1 < result.total) {
30341
+ result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
30342
+ }
30343
+ }
30344
+ return result;
30336
30345
  }));
30337
30346
  };
30347
+ AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
30348
+ var _a;
30349
+ return __awaiter(this, void 0, void 0, function () {
30350
+ var now, recipient, withContent, res, data, result, nextOffset_2;
30351
+ var _this = this;
30352
+ return __generator(this, function (_b) {
30353
+ switch (_b.label) {
30354
+ case 0:
30355
+ now = this._debug && Date.now();
30356
+ if (!filter)
30357
+ filter = this.defaultFilter();
30358
+ console.debug(this._logPrefix + "Loading user events...", filter);
30359
+ filter = this.asFilter(filter);
30360
+ // Force recipient to current issuer, if not admin and not specified
30361
+ if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
30362
+ recipient = this.defaultRecipient();
30363
+ if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
30364
+ console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
30365
+ filter.recipients = [recipient];
30366
+ }
30367
+ }
30368
+ withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
30369
+ return [4 /*yield*/, this.graphql.query({
30370
+ query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
30371
+ variables: {
30372
+ page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
30373
+ // @ts-ignore
30374
+ sortDirection: (page.sortDirection || 'desc').toUpperCase()
30375
+ }),
30376
+ filter: filter && filter.asPodObject()
30377
+ },
30378
+ error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
30379
+ fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy
30380
+ })];
30381
+ case 1:
30382
+ res = _b.sent();
30383
+ data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
30384
+ if (now)
30385
+ console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
30386
+ // Must re-order because of listenChanges result will add new event at the end
30387
+ data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
30388
+ result = {
30389
+ data: data,
30390
+ total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
30391
+ };
30392
+ // Add fetch more capability, if total was fetched
30393
+ if (isNotNil(res.total)) {
30394
+ nextOffset_2 = (page.offset || 0) + data.length;
30395
+ if (nextOffset_2 < result.total) {
30396
+ result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_2 }), filter, opts); };
30397
+ }
30398
+ }
30399
+ return [2 /*return*/, result];
30400
+ }
30401
+ });
30402
+ });
30403
+ };
30338
30404
  AbstractUserEventService.prototype.add = function (entity) {
30339
30405
  // TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
30340
30406
  entity = this.processUserEvent(entity);
@@ -30805,24 +30871,43 @@
30805
30871
  ]; };
30806
30872
 
30807
30873
  var UserEventNotificationList = /** @class */ (function () {
30808
- function UserEventNotificationList(cd, popoverController, userEventService) {
30874
+ function UserEventNotificationList(cd, popoverController, settings, userEventService) {
30875
+ var _a;
30809
30876
  this.cd = cd;
30810
30877
  this.popoverController = popoverController;
30878
+ this.settings = settings;
30811
30879
  this.userEventService = userEventService;
30812
- this.debug = false;
30813
- this.userEvents = new rxjs.BehaviorSubject(undefined);
30814
30880
  this.subscriptions = new rxjs.Subscription();
30881
+ this._fetchingMore = false;
30882
+ this.debug = false;
30883
+ this.pageSize = 10;
30884
+ this.sortBy = 'creationDate';
30885
+ this.sortDirection = 'desc';
30886
+ this.enableInfiniteScroll = true;
30887
+ this.$items = new rxjs.BehaviorSubject(undefined);
30888
+ this.$itemCount = new rxjs.BehaviorSubject(undefined);
30889
+ this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
30815
30890
  }
30891
+ Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
30892
+ get: function () {
30893
+ return !!this._fetchMoreFn;
30894
+ },
30895
+ enumerable: false,
30896
+ configurable: true
30897
+ });
30816
30898
  UserEventNotificationList.prototype.ngOnInit = function () {
30817
30899
  var _this = this;
30818
30900
  // Watch all user events
30819
30901
  if (this.userEventService) {
30820
30902
  this.subscriptions.add(this.userEventService
30821
- .watchAll(0, 10, 'creationDate', 'desc', undefined)
30903
+ .watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
30822
30904
  .subscribe(function (result) {
30905
+ var _a;
30823
30906
  if (_this.debug)
30824
30907
  console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
30825
- _this.userEvents.next(result.data);
30908
+ _this.$items.next(result.data);
30909
+ _this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
30910
+ _this._fetchMoreFn = result.fetchMore;
30826
30911
  _this.markForCheck();
30827
30912
  }));
30828
30913
  // Listen changes
@@ -30836,27 +30921,127 @@
30836
30921
  UserEventNotificationList.prototype.ngOnDestroy = function () {
30837
30922
  this.subscriptions.unsubscribe();
30838
30923
  };
30839
- UserEventNotificationList.prototype.read = function (event, userEvent) {
30924
+ UserEventNotificationList.prototype.click = function (event, userEvent) {
30925
+ if (!userEvent)
30926
+ return; // Skip
30927
+ // MarkAsRead
30928
+ this.markAsRead(event, userEvent);
30929
+ var action = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.name === 'click' || a.name === 'default'; });
30930
+ if (action) {
30931
+ this.executeAction(event, action, userEvent);
30932
+ }
30933
+ };
30934
+ UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
30840
30935
  var _a;
30841
30936
  if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
30842
30937
  return;
30843
30938
  (_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
30844
30939
  };
30845
- UserEventNotificationList.prototype.readAll = function (event) {
30940
+ UserEventNotificationList.prototype.markAllAsRead = function (event) {
30846
30941
  var _a;
30847
- var unreadUserEvents = (this.userEvents.value || []).filter(function (value) { return !value.readDate; });
30942
+ var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
30848
30943
  if (!unreadUserEvents.length)
30849
30944
  return;
30850
30945
  (_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
30851
30946
  };
30852
- UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
30853
- // Execute then close popover
30854
- action.executeAction(userEvent);
30855
- this.dismiss();
30947
+ UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
30948
+ return __awaiter(this, void 0, void 0, function () {
30949
+ var res, err_1;
30950
+ return __generator(this, function (_b) {
30951
+ switch (_b.label) {
30952
+ case 0:
30953
+ if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
30954
+ return [2 /*return*/]; // Skip if prevented
30955
+ // Disable default action (.e.g avoid to call click() function)
30956
+ if (event)
30957
+ event.preventDefault();
30958
+ _b.label = 1;
30959
+ case 1:
30960
+ _b.trys.push([1, 4, , 5]);
30961
+ res = action.executeAction(userEvent);
30962
+ this.dismiss();
30963
+ if (!(res instanceof Promise)) return [3 /*break*/, 3];
30964
+ return [4 /*yield*/, res];
30965
+ case 2:
30966
+ _b.sent();
30967
+ _b.label = 3;
30968
+ case 3: return [3 /*break*/, 5];
30969
+ case 4:
30970
+ err_1 = _b.sent();
30971
+ console.error(err_1);
30972
+ return [3 /*break*/, 5];
30973
+ case 5: return [2 /*return*/];
30974
+ }
30975
+ });
30976
+ });
30856
30977
  };
30857
30978
  UserEventNotificationList.prototype.dismiss = function () {
30858
30979
  this.popoverController.dismiss();
30859
30980
  };
30981
+ UserEventNotificationList.prototype.fetchMore = function (event) {
30982
+ var _a;
30983
+ return __awaiter(this, void 0, void 0, function () {
30984
+ var result, data, err_2;
30985
+ return __generator(this, function (_b) {
30986
+ switch (_b.label) {
30987
+ case 0:
30988
+ if (!this._fetchMoreFn || this._fetchingMore)
30989
+ return [2 /*return*/];
30990
+ console.debug('[user-event-notification-list] Fetching more notifications...', event);
30991
+ this._fetchingMore = true;
30992
+ _b.label = 1;
30993
+ case 1:
30994
+ _b.trys.push([1, 3, 4, 5]);
30995
+ return [4 /*yield*/, this._fetchMoreFn()];
30996
+ case 2:
30997
+ result = _b.sent();
30998
+ data = __spread((this.$items.value || []), result.data);
30999
+ // Remove duplication (e.g. when new user event was added by subscription)
31000
+ data = removeDuplicatesFromArray(data, 'id');
31001
+ this.$items.next(data);
31002
+ this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
31003
+ this._fetchMoreFn = result.fetchMore;
31004
+ return [3 /*break*/, 5];
31005
+ case 3:
31006
+ err_2 = _b.sent();
31007
+ console.error(err_2);
31008
+ this._fetchMoreFn = undefined;
31009
+ return [3 /*break*/, 5];
31010
+ case 4:
31011
+ this.markForCheck();
31012
+ this._fetchingMore = false;
31013
+ return [7 /*endfinally*/];
31014
+ case 5: return [2 /*return*/];
31015
+ }
31016
+ });
31017
+ });
31018
+ };
31019
+ UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
31020
+ return __awaiter(this, void 0, void 0, function () {
31021
+ var panel, scrollEnd$;
31022
+ var _this = this;
31023
+ return __generator(this, function (_b) {
31024
+ switch (_b.label) {
31025
+ case 0:
31026
+ if (this._fetchMoreSubscription)
31027
+ this._fetchMoreSubscription.unsubscribe();
31028
+ threshold = threshold || (this.mobile ? '15%' : '2%');
31029
+ return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
31030
+ case 1:
31031
+ _b.sent();
31032
+ return [4 /*yield*/, this.ionContent.getScrollElement()];
31033
+ case 2:
31034
+ panel = _b.sent();
31035
+ scrollEnd$ = fromScrollEndEvent(panel, threshold);
31036
+ // Trigger fetch more, end end scroll reached
31037
+ this._fetchMoreSubscription = scrollEnd$
31038
+ .subscribe(function () { return _this.fetchMore(); });
31039
+ this.subscriptions.add(this._fetchMoreSubscription);
31040
+ return [2 /*return*/];
31041
+ }
31042
+ });
31043
+ });
31044
+ };
30860
31045
  UserEventNotificationList.prototype.markForCheck = function () {
30861
31046
  this.cd.markForCheck();
30862
31047
  };
@@ -30865,21 +31050,30 @@
30865
31050
  UserEventNotificationList.decorators = [
30866
31051
  { type: i0.Component, args: [{
30867
31052
  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",
31053
+ template: "<ion-content>\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=\"$items|async|isNotEmptyArray\">\n <ion-text color=\"primary\">\n <a (click)=\"markAllAsRead($event)\">{{'SOCIAL.USER_EVENT.NOTIFICATION.READ_ALL' | translate}}</a>\n </ion-text>\n </ion-col>\n </ion-row>\n\n <ion-item\n *ngFor=\"let userEvent of $items | async; last as last\"\n [lines]=\"last ? 'none' : undefined\"\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 <!-- loading -->\n <ion-item *ngIf=\"!($items|async); else noResult\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n <!-- no result -->\n <ng-template #noResult>\n <ion-item *ngIf=\"$items|async|isEmptyArray\" lines=\"none\">\n <ion-text color=\"dark\" class=\"text-italic\">{{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}</ion-text>\n </ion-item>\n </ng-template>\n\n <!-- More item -->\n <ion-item *ngIf=\"canFetchMore\" (ngInit)=\"_initInfiniteScroll()\" lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n\n<!-- <ion-infinite-scroll #infiniteScroll-->\n<!-- [disabled]=\"!canFetchMore\"-->\n<!-- [threshold]=\"mobile ? '10%' : '2%'\" position=\"bottom\"-->\n<!-- (ionInfinite)=\"loadMore($event)\">-->\n<!-- <ion-infinite-scroll-content-->\n<!-- loadingSpinner=\"circles\"-->\n<!-- [loadingText]=\"'COMMON.LOADING_DOTS'|translate\">-->\n<!-- </ion-infinite-scroll-content>-->\n<!-- </ion-infinite-scroll>-->\n\n <!-- footer -->\n <ion-row *ngIf=\"$itemCount|async; let count\"\n class=\"ion-list-footer column\">\n <ion-col>\n <ion-text class=\"ion-float-end ion-padding-end\"><i>{{'COMMON.RESULT_COUNT'|translate: {count: count} }}</i></ion-text>\n </ion-col>\n </ion-row>\n\n </ion-list>\n</ion-content>\n",
30869
31054
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
30870
- 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}"]
31055
+ styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;max-height:calc(90vh - 20px)}.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
31056
  },] }
30872
31057
  ];
30873
31058
  UserEventNotificationList.ctorParameters = function () { return [
30874
31059
  { type: i0.ChangeDetectorRef },
30875
31060
  { type: i1$5.PopoverController },
31061
+ { type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
30876
31062
  { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
30877
31063
  ]; };
30878
31064
  UserEventNotificationList.propDecorators = {
30879
31065
  debug: [{ type: i0.Input }],
31066
+ mobile: [{ type: i0.Input }],
30880
31067
  titleI18n: [{ type: i0.Input }],
31068
+ pageSize: [{ type: i0.Input }],
31069
+ sortBy: [{ type: i0.Input }],
31070
+ sortDirection: [{ type: i0.Input }],
31071
+ filter: [{ type: i0.Input }],
31072
+ enableInfiniteScroll: [{ type: i0.Input }],
30881
31073
  readEvent: [{ type: i0.Output }],
30882
- readEvents: [{ type: i0.Output }]
31074
+ readEvents: [{ type: i0.Output }],
31075
+ ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
31076
+ ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
30883
31077
  };
30884
31078
 
30885
31079
  var AppUserEventNotificationIcon = /** @class */ (function () {
@@ -34036,8 +34230,35 @@
34036
34230
  });
34037
34231
  });
34038
34232
  };
34039
- UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
34040
- return rxjs.of({ data: this.userEvents });
34233
+ UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34234
+ var _this = this;
34235
+ var _a;
34236
+ var data = (this.userEvents || []).slice(offset || 0, offset + size);
34237
+ var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34238
+ var res = { data: data, total: total };
34239
+ // Must re-order because of listenChanges result will add new event at the end
34240
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34241
+ // Add fetch more
34242
+ var nextOffset = offset + data.length;
34243
+ if (nextOffset < res.total) {
34244
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34245
+ }
34246
+ return rxjs.of(res);
34247
+ };
34248
+ UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
34249
+ var _this = this;
34250
+ var _a;
34251
+ var data = (this.userEvents || []).slice(offset || 0, offset + size);
34252
+ var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
34253
+ var res = { data: data, total: total };
34254
+ // Must re-order because of listenChanges result will add new event at the end
34255
+ data = EntityUtils.sort(data, sortBy, sortDirection);
34256
+ // Add fetch more
34257
+ var nextOffset = offset + data.length;
34258
+ if (nextOffset < res.total) {
34259
+ res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
34260
+ }
34261
+ return Promise.resolve(res);
34041
34262
  };
34042
34263
  return UserEventTestService;
34043
34264
  }(AbstractUserEventService));