@sumaris-net/ngx-components 1.22.11-rc3 → 1.22.11-rc6
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 +248 -26
- 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 +113 -18
- package/esm2015/src/app/social/user-event/testing/user-event.testing.js +2 -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.service.js +61 -5
- package/fesm2015/sumaris-net.ngx-components.js +200 -27
- 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.service.d.ts +3 -2
- 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);
|
|
@@ -30805,24 +30876,43 @@
|
|
|
30805
30876
|
]; };
|
|
30806
30877
|
|
|
30807
30878
|
var UserEventNotificationList = /** @class */ (function () {
|
|
30808
|
-
function UserEventNotificationList(cd, popoverController, userEventService) {
|
|
30879
|
+
function UserEventNotificationList(cd, popoverController, settings, userEventService) {
|
|
30880
|
+
var _a;
|
|
30809
30881
|
this.cd = cd;
|
|
30810
30882
|
this.popoverController = popoverController;
|
|
30883
|
+
this.settings = settings;
|
|
30811
30884
|
this.userEventService = userEventService;
|
|
30812
|
-
this.debug = false;
|
|
30813
|
-
this.userEvents = new rxjs.BehaviorSubject(undefined);
|
|
30814
30885
|
this.subscriptions = new rxjs.Subscription();
|
|
30886
|
+
this._fetchingMore = false;
|
|
30887
|
+
this.debug = false;
|
|
30888
|
+
this.pageSize = 10;
|
|
30889
|
+
this.sortBy = 'creationDate';
|
|
30890
|
+
this.sortDirection = 'desc';
|
|
30891
|
+
this.enableInfiniteScroll = true;
|
|
30892
|
+
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30893
|
+
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30894
|
+
this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
|
|
30815
30895
|
}
|
|
30896
|
+
Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
|
|
30897
|
+
get: function () {
|
|
30898
|
+
return !!this._fetchMoreFn;
|
|
30899
|
+
},
|
|
30900
|
+
enumerable: false,
|
|
30901
|
+
configurable: true
|
|
30902
|
+
});
|
|
30816
30903
|
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30817
30904
|
var _this = this;
|
|
30818
30905
|
// Watch all user events
|
|
30819
30906
|
if (this.userEventService) {
|
|
30820
30907
|
this.subscriptions.add(this.userEventService
|
|
30821
|
-
.watchAll(0,
|
|
30908
|
+
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30822
30909
|
.subscribe(function (result) {
|
|
30910
|
+
var _a;
|
|
30823
30911
|
if (_this.debug)
|
|
30824
30912
|
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
30825
|
-
_this.
|
|
30913
|
+
_this.$items.next(result.data);
|
|
30914
|
+
_this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
30915
|
+
_this._fetchMoreFn = result.fetchMore;
|
|
30826
30916
|
_this.markForCheck();
|
|
30827
30917
|
}));
|
|
30828
30918
|
// Listen changes
|
|
@@ -30836,27 +30926,126 @@
|
|
|
30836
30926
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30837
30927
|
this.subscriptions.unsubscribe();
|
|
30838
30928
|
};
|
|
30839
|
-
UserEventNotificationList.prototype.
|
|
30929
|
+
UserEventNotificationList.prototype.click = function (event, userEvent) {
|
|
30930
|
+
if (!userEvent)
|
|
30931
|
+
return; // Skip
|
|
30932
|
+
// MarkAsRead
|
|
30933
|
+
this.markAsRead(event, userEvent);
|
|
30934
|
+
var action = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.name === 'click' || a.name === 'default'; });
|
|
30935
|
+
if (action) {
|
|
30936
|
+
this.executeAction(event, action, userEvent);
|
|
30937
|
+
}
|
|
30938
|
+
};
|
|
30939
|
+
UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
|
|
30840
30940
|
var _a;
|
|
30841
30941
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30842
30942
|
return;
|
|
30843
30943
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30844
30944
|
};
|
|
30845
|
-
UserEventNotificationList.prototype.
|
|
30945
|
+
UserEventNotificationList.prototype.markAllAsRead = function (event) {
|
|
30846
30946
|
var _a;
|
|
30847
|
-
var unreadUserEvents = (this.
|
|
30947
|
+
var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
|
|
30848
30948
|
if (!unreadUserEvents.length)
|
|
30849
30949
|
return;
|
|
30850
30950
|
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
30851
30951
|
};
|
|
30852
|
-
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
30853
|
-
|
|
30854
|
-
|
|
30855
|
-
|
|
30952
|
+
UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
|
|
30953
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30954
|
+
var res, err_1;
|
|
30955
|
+
return __generator(this, function (_b) {
|
|
30956
|
+
switch (_b.label) {
|
|
30957
|
+
case 0:
|
|
30958
|
+
if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
|
|
30959
|
+
return [2 /*return*/]; // Skip if prevented
|
|
30960
|
+
// Disable default action (.e.g avoid to call click() function)
|
|
30961
|
+
if (event)
|
|
30962
|
+
event.preventDefault();
|
|
30963
|
+
_b.label = 1;
|
|
30964
|
+
case 1:
|
|
30965
|
+
_b.trys.push([1, 4, , 5]);
|
|
30966
|
+
res = action.executeAction(userEvent);
|
|
30967
|
+
this.dismiss();
|
|
30968
|
+
if (!(res instanceof Promise)) return [3 /*break*/, 3];
|
|
30969
|
+
return [4 /*yield*/, res];
|
|
30970
|
+
case 2:
|
|
30971
|
+
_b.sent();
|
|
30972
|
+
_b.label = 3;
|
|
30973
|
+
case 3: return [3 /*break*/, 5];
|
|
30974
|
+
case 4:
|
|
30975
|
+
err_1 = _b.sent();
|
|
30976
|
+
console.error(err_1);
|
|
30977
|
+
return [3 /*break*/, 5];
|
|
30978
|
+
case 5: return [2 /*return*/];
|
|
30979
|
+
}
|
|
30980
|
+
});
|
|
30981
|
+
});
|
|
30856
30982
|
};
|
|
30857
30983
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30858
30984
|
this.popoverController.dismiss();
|
|
30859
30985
|
};
|
|
30986
|
+
UserEventNotificationList.prototype.fetchMore = function (event) {
|
|
30987
|
+
var _a;
|
|
30988
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30989
|
+
var result, data, err_2;
|
|
30990
|
+
return __generator(this, function (_b) {
|
|
30991
|
+
switch (_b.label) {
|
|
30992
|
+
case 0:
|
|
30993
|
+
if (!this._fetchMoreFn || this._fetchingMore)
|
|
30994
|
+
return [2 /*return*/];
|
|
30995
|
+
console.debug('[user-event-notification-list] Fetching more notifications...', event);
|
|
30996
|
+
this._fetchingMore = true;
|
|
30997
|
+
_b.label = 1;
|
|
30998
|
+
case 1:
|
|
30999
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
31000
|
+
return [4 /*yield*/, this._fetchMoreFn()];
|
|
31001
|
+
case 2:
|
|
31002
|
+
result = _b.sent();
|
|
31003
|
+
data = __spread((this.$items.value || []), result.data);
|
|
31004
|
+
// Remove duplication (e.g. when new user event was added by subscription)
|
|
31005
|
+
data = removeDuplicatesFromArray(data, 'id');
|
|
31006
|
+
this.$items.next(data);
|
|
31007
|
+
this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
31008
|
+
this._fetchMoreFn = result.fetchMore;
|
|
31009
|
+
return [3 /*break*/, 5];
|
|
31010
|
+
case 3:
|
|
31011
|
+
err_2 = _b.sent();
|
|
31012
|
+
console.error(err_2);
|
|
31013
|
+
this._fetchMoreFn = undefined;
|
|
31014
|
+
return [3 /*break*/, 5];
|
|
31015
|
+
case 4:
|
|
31016
|
+
this.markForCheck();
|
|
31017
|
+
this._fetchingMore = false;
|
|
31018
|
+
return [7 /*endfinally*/];
|
|
31019
|
+
case 5: return [2 /*return*/];
|
|
31020
|
+
}
|
|
31021
|
+
});
|
|
31022
|
+
});
|
|
31023
|
+
};
|
|
31024
|
+
UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
|
|
31025
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31026
|
+
var panel;
|
|
31027
|
+
var _this = this;
|
|
31028
|
+
return __generator(this, function (_b) {
|
|
31029
|
+
switch (_b.label) {
|
|
31030
|
+
case 0:
|
|
31031
|
+
if (this._fetchMoreSubscription)
|
|
31032
|
+
this._fetchMoreSubscription.unsubscribe();
|
|
31033
|
+
threshold = threshold || (this.mobile ? '15%' : '2%');
|
|
31034
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
|
|
31035
|
+
case 1:
|
|
31036
|
+
_b.sent();
|
|
31037
|
+
return [4 /*yield*/, this.ionContent.getScrollElement()];
|
|
31038
|
+
case 2:
|
|
31039
|
+
panel = _b.sent();
|
|
31040
|
+
// Trigger fetch more, end end scroll reached
|
|
31041
|
+
this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
|
|
31042
|
+
.subscribe(function () { return _this.fetchMore(); });
|
|
31043
|
+
this.subscriptions.add(this._fetchMoreSubscription);
|
|
31044
|
+
return [2 /*return*/];
|
|
31045
|
+
}
|
|
31046
|
+
});
|
|
31047
|
+
});
|
|
31048
|
+
};
|
|
30860
31049
|
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30861
31050
|
this.cd.markForCheck();
|
|
30862
31051
|
};
|
|
@@ -30865,21 +31054,30 @@
|
|
|
30865
31054
|
UserEventNotificationList.decorators = [
|
|
30866
31055
|
{ type: i0.Component, args: [{
|
|
30867
31056
|
selector: 'app-user-event-notification-list',
|
|
30868
|
-
template: "
|
|
31057
|
+
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 <!-- 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",
|
|
30869
31058
|
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}"]
|
|
31059
|
+
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
31060
|
},] }
|
|
30872
31061
|
];
|
|
30873
31062
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30874
31063
|
{ type: i0.ChangeDetectorRef },
|
|
30875
31064
|
{ type: i1$5.PopoverController },
|
|
31065
|
+
{ type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
|
|
30876
31066
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
|
|
30877
31067
|
]; };
|
|
30878
31068
|
UserEventNotificationList.propDecorators = {
|
|
30879
31069
|
debug: [{ type: i0.Input }],
|
|
31070
|
+
mobile: [{ type: i0.Input }],
|
|
30880
31071
|
titleI18n: [{ type: i0.Input }],
|
|
31072
|
+
pageSize: [{ type: i0.Input }],
|
|
31073
|
+
sortBy: [{ type: i0.Input }],
|
|
31074
|
+
sortDirection: [{ type: i0.Input }],
|
|
31075
|
+
filter: [{ type: i0.Input }],
|
|
31076
|
+
enableInfiniteScroll: [{ type: i0.Input }],
|
|
30881
31077
|
readEvent: [{ type: i0.Output }],
|
|
30882
|
-
readEvents: [{ type: i0.Output }]
|
|
31078
|
+
readEvents: [{ type: i0.Output }],
|
|
31079
|
+
ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
|
|
31080
|
+
ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
|
|
30883
31081
|
};
|
|
30884
31082
|
|
|
30885
31083
|
var AppUserEventNotificationIcon = /** @class */ (function () {
|
|
@@ -34036,8 +34234,35 @@
|
|
|
34036
34234
|
});
|
|
34037
34235
|
});
|
|
34038
34236
|
};
|
|
34039
|
-
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter,
|
|
34040
|
-
|
|
34237
|
+
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34238
|
+
var _this = this;
|
|
34239
|
+
var _a;
|
|
34240
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34241
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34242
|
+
var res = { data: data, total: total };
|
|
34243
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34244
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34245
|
+
// Add fetch more
|
|
34246
|
+
var nextOffset = offset + data.length;
|
|
34247
|
+
if (nextOffset < res.total) {
|
|
34248
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34249
|
+
}
|
|
34250
|
+
return rxjs.of(res);
|
|
34251
|
+
};
|
|
34252
|
+
UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34253
|
+
var _this = this;
|
|
34254
|
+
var _a;
|
|
34255
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34256
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34257
|
+
var res = { data: data, total: total };
|
|
34258
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34259
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34260
|
+
// Add fetch more
|
|
34261
|
+
var nextOffset = offset + data.length;
|
|
34262
|
+
if (nextOffset < res.total) {
|
|
34263
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34264
|
+
}
|
|
34265
|
+
return Promise.resolve(res);
|
|
34041
34266
|
};
|
|
34042
34267
|
return UserEventTestService;
|
|
34043
34268
|
}(AbstractUserEventService));
|
|
@@ -34196,10 +34421,7 @@
|
|
|
34196
34421
|
UserEventTestingPage.decorators = [
|
|
34197
34422
|
{ type: i0.Component, args: [{
|
|
34198
34423
|
selector: 'job-progression-testing',
|
|
34199
|
-
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"
|
|
34200
|
-
providers: [
|
|
34201
|
-
{ provide: USER_EVENT_SERVICE, useClass: UserEventTestService }
|
|
34202
|
-
]
|
|
34424
|
+
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"
|
|
34203
34425
|
},] }
|
|
34204
34426
|
];
|
|
34205
34427
|
UserEventTestingPage.ctorParameters = function () { return [
|