@sumaris-net/ngx-components 1.22.11-rc4 → 1.22.11-rc7
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.
- package/bundles/sumaris-net.ngx-components.umd.js +234 -24
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/shared/events.js +8 -3
- package/esm2015/src/app/shared/services/entity-service.class.js +1 -1
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +91 -16
- package/esm2015/src/app/social/user-event/testing/user-event.testing.js +19 -5
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +29 -3
- package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
- package/esm2015/src/app/social/user-event/user-event.service.js +62 -5
- package/fesm2015/sumaris-net.ngx-components.js +197 -25
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/events.d.ts +1 -1
- package/src/app/shared/services/entity-service.class.d.ts +7 -0
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +36 -12
- package/src/app/social/user-event/testing/user-event.testing.d.ts +1 -0
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +3 -2
- package/src/app/social/user-event/user-event.model.d.ts +1 -0
- package/src/app/social/user-event/user-event.service.d.ts +9 -5
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -1151,7 +1151,7 @@
|
|
|
1151
1151
|
* @param element
|
|
1152
1152
|
* @param threshold default to '15%'
|
|
1153
1153
|
*/
|
|
1154
|
-
function fromScrollEndEvent(element, threshold) {
|
|
1154
|
+
function fromScrollEndEvent(element, threshold, dueTime) {
|
|
1155
1155
|
threshold = threshold || '15%';
|
|
1156
1156
|
var isEnd;
|
|
1157
1157
|
// Listen using percentage
|
|
@@ -1173,6 +1173,11 @@
|
|
|
1173
1173
|
else {
|
|
1174
1174
|
throw new Error('Invalid argument \'threshold\'. Expected value unit: \'px\' or \'%\' ');
|
|
1175
1175
|
}
|
|
1176
|
+
// Check bottom reach, even if NO scroll event (e.g. when already reach the bottom)
|
|
1177
|
+
if (dueTime > 0) {
|
|
1178
|
+
return rxjs.merge(rxjs.fromEvent(element, 'scroll'), rxjs.timer(dueTime))
|
|
1179
|
+
.pipe(operators.filter(function () { return isEnd(); }));
|
|
1180
|
+
}
|
|
1176
1181
|
return rxjs.fromEvent(element, 'scroll')
|
|
1177
1182
|
.pipe(operators.filter(function () { return isEnd(); }));
|
|
1178
1183
|
}
|
|
@@ -30289,7 +30294,7 @@
|
|
|
30289
30294
|
AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
30290
30295
|
return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
|
|
30291
30296
|
};
|
|
30292
|
-
AbstractUserEventService.prototype.watchPage = function (page, filter,
|
|
30297
|
+
AbstractUserEventService.prototype.watchPage = function (page, filter, opts) {
|
|
30293
30298
|
var _this = this;
|
|
30294
30299
|
var _a;
|
|
30295
30300
|
var now = this._debug && Date.now();
|
|
@@ -30306,7 +30311,7 @@
|
|
|
30306
30311
|
filter.recipients = [recipient];
|
|
30307
30312
|
}
|
|
30308
30313
|
}
|
|
30309
|
-
var withContent = (
|
|
30314
|
+
var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30310
30315
|
return this.mutableWatchQuery({
|
|
30311
30316
|
queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
|
|
30312
30317
|
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
@@ -30319,7 +30324,8 @@
|
|
|
30319
30324
|
},
|
|
30320
30325
|
arrayFieldName: 'data',
|
|
30321
30326
|
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30322
|
-
fetchPolicy: (
|
|
30327
|
+
fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
|
|
30328
|
+
insertFilterFn: filter && filter.asFilterFn()
|
|
30323
30329
|
})
|
|
30324
30330
|
.pipe(operators.map(function (res) {
|
|
30325
30331
|
var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
@@ -30329,12 +30335,77 @@
|
|
|
30329
30335
|
}
|
|
30330
30336
|
// Must re-order because of listenChanges result will add new event at the end
|
|
30331
30337
|
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30332
|
-
|
|
30338
|
+
var result = {
|
|
30333
30339
|
data: data,
|
|
30334
30340
|
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30335
30341
|
};
|
|
30342
|
+
// Add fetch more capability, if total was fetched
|
|
30343
|
+
if (isNotNil(res.total)) {
|
|
30344
|
+
var nextOffset_1 = (page.offset || 0) + data.length;
|
|
30345
|
+
if (nextOffset_1 < result.total) {
|
|
30346
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
30347
|
+
}
|
|
30348
|
+
}
|
|
30349
|
+
return result;
|
|
30336
30350
|
}));
|
|
30337
30351
|
};
|
|
30352
|
+
AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
|
|
30353
|
+
var _a;
|
|
30354
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30355
|
+
var now, recipient, withContent, res, data, result, nextOffset_2;
|
|
30356
|
+
var _this = this;
|
|
30357
|
+
return __generator(this, function (_b) {
|
|
30358
|
+
switch (_b.label) {
|
|
30359
|
+
case 0:
|
|
30360
|
+
now = this._debug && Date.now();
|
|
30361
|
+
if (!filter)
|
|
30362
|
+
filter = this.defaultFilter();
|
|
30363
|
+
console.debug(this._logPrefix + "Loading user events...", filter);
|
|
30364
|
+
filter = this.asFilter(filter);
|
|
30365
|
+
// Force recipient to current issuer, if not admin and not specified
|
|
30366
|
+
if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
|
|
30367
|
+
recipient = this.defaultRecipient();
|
|
30368
|
+
if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
|
|
30369
|
+
console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
|
|
30370
|
+
filter.recipients = [recipient];
|
|
30371
|
+
}
|
|
30372
|
+
}
|
|
30373
|
+
withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30374
|
+
return [4 /*yield*/, this.graphql.query({
|
|
30375
|
+
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
30376
|
+
variables: {
|
|
30377
|
+
page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
|
|
30378
|
+
// @ts-ignore
|
|
30379
|
+
sortDirection: (page.sortDirection || 'desc').toUpperCase()
|
|
30380
|
+
}),
|
|
30381
|
+
filter: filter && filter.asPodObject()
|
|
30382
|
+
},
|
|
30383
|
+
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30384
|
+
fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy
|
|
30385
|
+
})];
|
|
30386
|
+
case 1:
|
|
30387
|
+
res = _b.sent();
|
|
30388
|
+
data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
30389
|
+
if (now)
|
|
30390
|
+
console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30391
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
30392
|
+
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30393
|
+
result = {
|
|
30394
|
+
data: data,
|
|
30395
|
+
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30396
|
+
};
|
|
30397
|
+
// Add fetch more capability, if total was fetched
|
|
30398
|
+
if (isNotNil(res.total)) {
|
|
30399
|
+
nextOffset_2 = (page.offset || 0) + data.length;
|
|
30400
|
+
if (nextOffset_2 < result.total) {
|
|
30401
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_2 }), filter, opts); };
|
|
30402
|
+
}
|
|
30403
|
+
}
|
|
30404
|
+
return [2 /*return*/, result];
|
|
30405
|
+
}
|
|
30406
|
+
});
|
|
30407
|
+
});
|
|
30408
|
+
};
|
|
30338
30409
|
AbstractUserEventService.prototype.add = function (entity) {
|
|
30339
30410
|
// TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30340
30411
|
entity = this.processUserEvent(entity);
|
|
@@ -30391,6 +30462,7 @@
|
|
|
30391
30462
|
filter = this.defaultFilter();
|
|
30392
30463
|
// Apply last reset date as start date
|
|
30393
30464
|
filter.startDate = this.resetCountDate;
|
|
30465
|
+
filter.excludeRead = true;
|
|
30394
30466
|
filter = this.asFilter(filter);
|
|
30395
30467
|
if (this._debug)
|
|
30396
30468
|
console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
|
|
@@ -30805,24 +30877,43 @@
|
|
|
30805
30877
|
]; };
|
|
30806
30878
|
|
|
30807
30879
|
var UserEventNotificationList = /** @class */ (function () {
|
|
30808
|
-
function UserEventNotificationList(cd, popoverController, userEventService) {
|
|
30880
|
+
function UserEventNotificationList(cd, popoverController, settings, userEventService) {
|
|
30881
|
+
var _a;
|
|
30809
30882
|
this.cd = cd;
|
|
30810
30883
|
this.popoverController = popoverController;
|
|
30884
|
+
this.settings = settings;
|
|
30811
30885
|
this.userEventService = userEventService;
|
|
30812
|
-
this.debug = false;
|
|
30813
|
-
this.userEvents = new rxjs.BehaviorSubject(undefined);
|
|
30814
30886
|
this.subscriptions = new rxjs.Subscription();
|
|
30887
|
+
this._fetchingMore = false;
|
|
30888
|
+
this.debug = false;
|
|
30889
|
+
this.pageSize = 10;
|
|
30890
|
+
this.sortBy = 'creationDate';
|
|
30891
|
+
this.sortDirection = 'desc';
|
|
30892
|
+
this.enableInfiniteScroll = true;
|
|
30893
|
+
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30894
|
+
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30895
|
+
this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
|
|
30815
30896
|
}
|
|
30897
|
+
Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
|
|
30898
|
+
get: function () {
|
|
30899
|
+
return this.enableInfiniteScroll && !!this._fetchMoreFn;
|
|
30900
|
+
},
|
|
30901
|
+
enumerable: false,
|
|
30902
|
+
configurable: true
|
|
30903
|
+
});
|
|
30816
30904
|
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30817
30905
|
var _this = this;
|
|
30818
30906
|
// Watch all user events
|
|
30819
30907
|
if (this.userEventService) {
|
|
30820
30908
|
this.subscriptions.add(this.userEventService
|
|
30821
|
-
.watchAll(0,
|
|
30909
|
+
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30822
30910
|
.subscribe(function (result) {
|
|
30911
|
+
var _a;
|
|
30823
30912
|
if (_this.debug)
|
|
30824
30913
|
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
30825
|
-
_this.
|
|
30914
|
+
_this.$items.next(result.data);
|
|
30915
|
+
_this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
30916
|
+
_this._fetchMoreFn = result.fetchMore;
|
|
30826
30917
|
_this.markForCheck();
|
|
30827
30918
|
}));
|
|
30828
30919
|
// Listen changes
|
|
@@ -30841,20 +30932,24 @@
|
|
|
30841
30932
|
return; // Skip
|
|
30842
30933
|
// MarkAsRead
|
|
30843
30934
|
this.markAsRead(event, userEvent);
|
|
30844
|
-
|
|
30845
|
-
|
|
30846
|
-
|
|
30935
|
+
// Get the default action (if any)
|
|
30936
|
+
var defaultAction = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.default; });
|
|
30937
|
+
if (defaultAction) {
|
|
30938
|
+
this.executeAction(event, defaultAction, userEvent);
|
|
30847
30939
|
}
|
|
30848
30940
|
};
|
|
30941
|
+
UserEventNotificationList.prototype.isDefaultAction = function (action) {
|
|
30942
|
+
return action && action.default || false;
|
|
30943
|
+
};
|
|
30849
30944
|
UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
|
|
30850
30945
|
var _a;
|
|
30851
30946
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30852
30947
|
return;
|
|
30853
30948
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30854
30949
|
};
|
|
30855
|
-
UserEventNotificationList.prototype.
|
|
30950
|
+
UserEventNotificationList.prototype.markAllAsRead = function (event) {
|
|
30856
30951
|
var _a;
|
|
30857
|
-
var unreadUserEvents = (this.
|
|
30952
|
+
var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
|
|
30858
30953
|
if (!unreadUserEvents.length)
|
|
30859
30954
|
return;
|
|
30860
30955
|
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
@@ -30893,6 +30988,69 @@
|
|
|
30893
30988
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30894
30989
|
this.popoverController.dismiss();
|
|
30895
30990
|
};
|
|
30991
|
+
UserEventNotificationList.prototype.fetchMore = function (event) {
|
|
30992
|
+
var _a;
|
|
30993
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30994
|
+
var result, data, err_2;
|
|
30995
|
+
return __generator(this, function (_b) {
|
|
30996
|
+
switch (_b.label) {
|
|
30997
|
+
case 0:
|
|
30998
|
+
if (!this._fetchMoreFn || this._fetchingMore)
|
|
30999
|
+
return [2 /*return*/];
|
|
31000
|
+
console.debug('[user-event-notification-list] Fetching more notifications...', event);
|
|
31001
|
+
this._fetchingMore = true;
|
|
31002
|
+
_b.label = 1;
|
|
31003
|
+
case 1:
|
|
31004
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
31005
|
+
return [4 /*yield*/, this._fetchMoreFn()];
|
|
31006
|
+
case 2:
|
|
31007
|
+
result = _b.sent();
|
|
31008
|
+
data = __spread((this.$items.value || []), result.data);
|
|
31009
|
+
// Remove duplication (e.g. when new user event was added by subscription)
|
|
31010
|
+
data = removeDuplicatesFromArray(data, 'id');
|
|
31011
|
+
this.$items.next(data);
|
|
31012
|
+
this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
31013
|
+
this._fetchMoreFn = result.fetchMore;
|
|
31014
|
+
return [3 /*break*/, 5];
|
|
31015
|
+
case 3:
|
|
31016
|
+
err_2 = _b.sent();
|
|
31017
|
+
console.error(err_2);
|
|
31018
|
+
this._fetchMoreFn = undefined;
|
|
31019
|
+
return [3 /*break*/, 5];
|
|
31020
|
+
case 4:
|
|
31021
|
+
this.markForCheck();
|
|
31022
|
+
this._fetchingMore = false;
|
|
31023
|
+
return [7 /*endfinally*/];
|
|
31024
|
+
case 5: return [2 /*return*/];
|
|
31025
|
+
}
|
|
31026
|
+
});
|
|
31027
|
+
});
|
|
31028
|
+
};
|
|
31029
|
+
UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
|
|
31030
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31031
|
+
var panel;
|
|
31032
|
+
var _this = this;
|
|
31033
|
+
return __generator(this, function (_b) {
|
|
31034
|
+
switch (_b.label) {
|
|
31035
|
+
case 0:
|
|
31036
|
+
if (this._fetchMoreSubscription)
|
|
31037
|
+
this._fetchMoreSubscription.unsubscribe();
|
|
31038
|
+
threshold = threshold || (this.mobile ? '15%' : '2%');
|
|
31039
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
|
|
31040
|
+
case 1:
|
|
31041
|
+
_b.sent();
|
|
31042
|
+
return [4 /*yield*/, this.ionContent.getScrollElement()];
|
|
31043
|
+
case 2:
|
|
31044
|
+
panel = _b.sent();
|
|
31045
|
+
// Trigger fetch more, end end scroll reached
|
|
31046
|
+
this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
|
|
31047
|
+
.subscribe(function () { return _this.fetchMore(); });
|
|
31048
|
+
this.subscriptions.add(this._fetchMoreSubscription);
|
|
31049
|
+
return [2 /*return*/];
|
|
31050
|
+
}
|
|
31051
|
+
});
|
|
31052
|
+
});
|
|
31053
|
+
};
|
|
30896
31054
|
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30897
31055
|
this.cd.markForCheck();
|
|
30898
31056
|
};
|
|
@@ -30901,21 +31059,31 @@
|
|
|
30901
31059
|
UserEventNotificationList.decorators = [
|
|
30902
31060
|
{ type: i0.Component, args: [{
|
|
30903
31061
|
selector: 'app-user-event-notification-list',
|
|
30904
|
-
template: "
|
|
31062
|
+
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 item of $items | async; last as last\"\n [lines]=\"last ? 'none' : undefined\" tappable\n [class.ion-item-selected]=\"!item.readDate\"\n (click)=\"click($event, item)\"\n >\n\n <ion-avatar slot=\"start\">\n\n <img *ngIf=\"item.avatar; else avatarIcon\" src=\"{{ item.avatar }}\">\n\n <ng-template #avatarIcon>\n <app-icon\n *ngIf=\"item.avatarIcon\"\n [ref]=\"item.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 size=\"12\">\n <p [class.unread]=\"!item.readDate\" [innerHTML]=\"item.message\"></p>\n </ion-col>\n </ion-row>\n\n <!-- date -->\n <ion-row>\n <ion-col size=\"12\">\n <app-icon\n *ngIf=\"item.icon\"\n [ref]=\"item.icon\"\n height=\"16\"\n width=\"16\"\n style=\"vertical-align: sub; margin-right: 3px\"\n ></app-icon>\n <small>\n <span>{{item.creationDate|dateFromNow}}</span>\n <span style=\"color: gray\">{{ ' | ' + (item.creationDate|dateFormat:{time:true}) }}</span>\n </small>\n </ion-col>\n </ion-row>\n\n <!-- actions -->\n <ion-row *ngIf=\"item.actions|isNotEmptyArray\">\n <ion-col></ion-col>\n <ion-col size=\"auto\">\n <ng-container *ngFor=\"let action of item.actions\">\n <span *ngIf=\"!action.default\" class=\"action\">\n <a (click)=\"executeAction($event, action, item)\" [title]=\"(action.title || action.name) |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 </ng-container>\n </ion-col>\n </ion-row>\n\n </ion-grid>\n\n <mat-icon slot=\"end\" *ngIf=\"item.actions|arrayFilter: isDefaultAction|isNotEmptyArray\">chevron_right</mat-icon>\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 <!-- Loading more spinner -->\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 <!-- 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",
|
|
30905
31063
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30906
|
-
|
|
31064
|
+
encapsulation: i0.ViewEncapsulation.None,
|
|
31065
|
+
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}"]
|
|
30907
31066
|
},] }
|
|
30908
31067
|
];
|
|
30909
31068
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30910
31069
|
{ type: i0.ChangeDetectorRef },
|
|
30911
31070
|
{ type: i1$5.PopoverController },
|
|
31071
|
+
{ type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
|
|
30912
31072
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
|
|
30913
31073
|
]; };
|
|
30914
31074
|
UserEventNotificationList.propDecorators = {
|
|
30915
31075
|
debug: [{ type: i0.Input }],
|
|
31076
|
+
mobile: [{ type: i0.Input }],
|
|
30916
31077
|
titleI18n: [{ type: i0.Input }],
|
|
31078
|
+
pageSize: [{ type: i0.Input }],
|
|
31079
|
+
sortBy: [{ type: i0.Input }],
|
|
31080
|
+
sortDirection: [{ type: i0.Input }],
|
|
31081
|
+
filter: [{ type: i0.Input }],
|
|
31082
|
+
enableInfiniteScroll: [{ type: i0.Input }],
|
|
30917
31083
|
readEvent: [{ type: i0.Output }],
|
|
30918
|
-
readEvents: [{ type: i0.Output }]
|
|
31084
|
+
readEvents: [{ type: i0.Output }],
|
|
31085
|
+
ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
|
|
31086
|
+
ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
|
|
30919
31087
|
};
|
|
30920
31088
|
|
|
30921
31089
|
var AppUserEventNotificationIcon = /** @class */ (function () {
|
|
@@ -34072,8 +34240,35 @@
|
|
|
34072
34240
|
});
|
|
34073
34241
|
});
|
|
34074
34242
|
};
|
|
34075
|
-
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter,
|
|
34076
|
-
|
|
34243
|
+
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34244
|
+
var _this = this;
|
|
34245
|
+
var _a;
|
|
34246
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34247
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34248
|
+
var res = { data: data, total: total };
|
|
34249
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34250
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34251
|
+
// Add fetch more
|
|
34252
|
+
var nextOffset = offset + data.length;
|
|
34253
|
+
if (nextOffset < res.total) {
|
|
34254
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34255
|
+
}
|
|
34256
|
+
return rxjs.of(res);
|
|
34257
|
+
};
|
|
34258
|
+
UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34259
|
+
var _this = this;
|
|
34260
|
+
var _a;
|
|
34261
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34262
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34263
|
+
var res = { data: data, total: total };
|
|
34264
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34265
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34266
|
+
// Add fetch more
|
|
34267
|
+
var nextOffset = offset + data.length;
|
|
34268
|
+
if (nextOffset < res.total) {
|
|
34269
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34270
|
+
}
|
|
34271
|
+
return Promise.resolve(res);
|
|
34077
34272
|
};
|
|
34078
34273
|
return UserEventTestService;
|
|
34079
34274
|
}(AbstractUserEventService));
|
|
@@ -34224,6 +34419,24 @@
|
|
|
34224
34419
|
]
|
|
34225
34420
|
}));
|
|
34226
34421
|
};
|
|
34422
|
+
UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
|
|
34423
|
+
var _this = this;
|
|
34424
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34425
|
+
issuer: 'system',
|
|
34426
|
+
recipient: 'me',
|
|
34427
|
+
type: 'message',
|
|
34428
|
+
level: 'INFO',
|
|
34429
|
+
message: 'message with action',
|
|
34430
|
+
creationDate: moment$a(),
|
|
34431
|
+
actions: [
|
|
34432
|
+
{
|
|
34433
|
+
default: true,
|
|
34434
|
+
name: 'default',
|
|
34435
|
+
executeAction: function (event) { _this.showMessage('default action'); }
|
|
34436
|
+
}
|
|
34437
|
+
]
|
|
34438
|
+
}));
|
|
34439
|
+
};
|
|
34227
34440
|
UserEventTestingPage.prototype.showMessage = function (text) {
|
|
34228
34441
|
return Alerts.showError(text, this.alertController, this.translateService);
|
|
34229
34442
|
};
|
|
@@ -34232,10 +34445,7 @@
|
|
|
34232
34445
|
UserEventTestingPage.decorators = [
|
|
34233
34446
|
{ type: i0.Component, args: [{
|
|
34234
34447
|
selector: 'job-progression-testing',
|
|
34235
|
-
template: "<ion-toolbar color=\"primary\">\n <ion-title>User events</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-user-event-notification-icon #notification [debug]=\"true\"></app-user-event-notification-icon>\n\n <p>\n <ion-button (click)=\"addNotification()\">Add notification</ion-button>\n <ion-button (click)=\"addError()\">Add error</ion-button>\n <ion-button (click)=\"addWarning()\">Add warning</ion-button>\n <ion-button (click)=\"addDebug()\">Add debug</ion-button>\n </p>\n <p>\n <ion-button (click)=\"addNotificationWithLink()\">Add notification with link</ion-button>\n <ion-button (click)=\"addNotificationWithAction()\">Add notification with action</ion-button>\n </p>\n</ion-content>\n"
|
|
34236
|
-
providers: [
|
|
34237
|
-
{ provide: USER_EVENT_SERVICE, useClass: UserEventTestService }
|
|
34238
|
-
]
|
|
34448
|
+
template: "<ion-toolbar color=\"primary\">\n <ion-title>User events</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-user-event-notification-icon #notification [debug]=\"true\"></app-user-event-notification-icon>\n\n <p>\n <ion-button (click)=\"addNotification()\">Add notification</ion-button>\n <ion-button (click)=\"addError()\">Add error</ion-button>\n <ion-button (click)=\"addWarning()\">Add warning</ion-button>\n <ion-button (click)=\"addDebug()\">Add debug</ion-button>\n </p>\n <p>\n <ion-button (click)=\"addNotificationWithLink()\">Add notification with link</ion-button>\n <ion-button (click)=\"addNotificationWithAction()\">Add notification with action</ion-button>\n <ion-button (click)=\"addNotificationWithDefaultAction()\">Add notification with default action</ion-button>\n </p>\n</ion-content>\n"
|
|
34239
34449
|
},] }
|
|
34240
34450
|
];
|
|
34241
34451
|
UserEventTestingPage.ctorParameters = function () { return [
|