@sumaris-net/ngx-components 1.22.11-rc13 → 1.22.11-rc14
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 +154 -67
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/shared/file/file.utils.js +1 -1
- package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +3 -2
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +48 -26
- package/esm2015/src/app/social/user-event/testing/user-event.testing.js +53 -2
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +32 -25
- package/fesm2015/sumaris-net.ngx-components.js +128 -50
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +15 -11
- package/src/app/social/user-event/testing/user-event.testing.d.ts +9 -1
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +2 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -30948,17 +30948,28 @@
|
|
|
30948
30948
|
this.popoverController = popoverController;
|
|
30949
30949
|
this.settings = settings;
|
|
30950
30950
|
this.userEventService = userEventService;
|
|
30951
|
-
this.
|
|
30952
|
-
this.
|
|
30951
|
+
this._subscriptions = new rxjs.Subscription();
|
|
30952
|
+
this._$pageSize = new rxjs.BehaviorSubject(20);
|
|
30953
|
+
this.fetchingMore = false;
|
|
30954
|
+
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30955
|
+
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30953
30956
|
this.debug = false;
|
|
30954
|
-
this.pageSize = 10;
|
|
30955
30957
|
this.sortBy = 'creationDate';
|
|
30956
30958
|
this.sortDirection = 'desc';
|
|
30957
30959
|
this.enableInfiniteScroll = true;
|
|
30958
|
-
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30959
|
-
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30960
30960
|
this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
|
|
30961
30961
|
}
|
|
30962
|
+
Object.defineProperty(UserEventNotificationList.prototype, "pageSize", {
|
|
30963
|
+
get: function () {
|
|
30964
|
+
return this._$pageSize.value;
|
|
30965
|
+
},
|
|
30966
|
+
set: function (value) {
|
|
30967
|
+
if (value > 0 && value !== this._$pageSize.value)
|
|
30968
|
+
this._$pageSize.next(value);
|
|
30969
|
+
},
|
|
30970
|
+
enumerable: false,
|
|
30971
|
+
configurable: true
|
|
30972
|
+
});
|
|
30962
30973
|
Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
|
|
30963
30974
|
get: function () {
|
|
30964
30975
|
return this.enableInfiniteScroll && !!this._fetchMoreFn;
|
|
@@ -30970,29 +30981,31 @@
|
|
|
30970
30981
|
var _this = this;
|
|
30971
30982
|
// Watch all user events
|
|
30972
30983
|
if (this.userEventService) {
|
|
30973
|
-
this.
|
|
30974
|
-
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30984
|
+
this._subscriptions.add(this._$pageSize.pipe(operators.distinctUntilChanged(), operators.switchMap(function (pageSize) { return _this.userEventService.watchAll(0, pageSize, _this.sortBy, _this.sortDirection, _this.filter); }))
|
|
30975
30985
|
.subscribe(function (result) {
|
|
30976
|
-
var _a
|
|
30986
|
+
var _a;
|
|
30977
30987
|
if (_this.debug)
|
|
30978
|
-
console.debug("[user-event-notification-list]
|
|
30988
|
+
console.debug("[user-event-notification-list] Receiving " + result.total + " user events", result.data);
|
|
30979
30989
|
_this.$items.next(result.data);
|
|
30980
30990
|
_this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
30981
30991
|
_this._fetchMoreFn = result.fetchMore;
|
|
30982
|
-
_this.
|
|
30983
|
-
(_b = _this._fetchMoreSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
30992
|
+
_this.fetchingMore = false; // Allow to refetch more
|
|
30984
30993
|
_this.markForCheck();
|
|
30985
30994
|
}));
|
|
30986
30995
|
// Listen changes
|
|
30987
|
-
this.
|
|
30996
|
+
this._subscriptions.add(this.userEventService.listenAllChanges(this.filter)
|
|
30988
30997
|
.subscribe(function (data) {
|
|
30989
30998
|
if (_this.debug)
|
|
30990
|
-
console.debug("[user-event-notification-list]
|
|
30999
|
+
console.debug("[user-event-notification-list] Receiving " + data.length + " new user events (by WS)", data);
|
|
30991
31000
|
}));
|
|
31001
|
+
if (this.enableInfiniteScroll)
|
|
31002
|
+
this.initInfiniteScroll();
|
|
30992
31003
|
}
|
|
30993
31004
|
};
|
|
30994
31005
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30995
|
-
this.
|
|
31006
|
+
this._subscriptions.unsubscribe();
|
|
31007
|
+
this.$items.complete();
|
|
31008
|
+
this.$itemCount.complete();
|
|
30996
31009
|
};
|
|
30997
31010
|
UserEventNotificationList.prototype.click = function (event, userEvent) {
|
|
30998
31011
|
if (!userEvent)
|
|
@@ -31024,27 +31037,27 @@
|
|
|
31024
31037
|
UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
|
|
31025
31038
|
return __awaiter(this, void 0, void 0, function () {
|
|
31026
31039
|
var res, err_1;
|
|
31027
|
-
return __generator(this, function (
|
|
31028
|
-
switch (
|
|
31040
|
+
return __generator(this, function (_b) {
|
|
31041
|
+
switch (_b.label) {
|
|
31029
31042
|
case 0:
|
|
31030
31043
|
if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
|
|
31031
31044
|
return [2 /*return*/]; // Skip if prevented
|
|
31032
31045
|
// Disable default action (.e.g avoid to call click() function)
|
|
31033
31046
|
if (event)
|
|
31034
31047
|
event.preventDefault();
|
|
31035
|
-
|
|
31048
|
+
_b.label = 1;
|
|
31036
31049
|
case 1:
|
|
31037
|
-
|
|
31050
|
+
_b.trys.push([1, 4, , 5]);
|
|
31038
31051
|
res = action.executeAction(userEvent);
|
|
31039
31052
|
this.dismiss();
|
|
31040
31053
|
if (!(res instanceof Promise)) return [3 /*break*/, 3];
|
|
31041
31054
|
return [4 /*yield*/, res];
|
|
31042
31055
|
case 2:
|
|
31043
|
-
|
|
31044
|
-
|
|
31056
|
+
_b.sent();
|
|
31057
|
+
_b.label = 3;
|
|
31045
31058
|
case 3: return [3 /*break*/, 5];
|
|
31046
31059
|
case 4:
|
|
31047
|
-
err_1 =
|
|
31060
|
+
err_1 = _b.sent();
|
|
31048
31061
|
console.error(err_1);
|
|
31049
31062
|
return [3 /*break*/, 5];
|
|
31050
31063
|
case 5: return [2 /*return*/];
|
|
@@ -31054,65 +31067,77 @@
|
|
|
31054
31067
|
};
|
|
31055
31068
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
31056
31069
|
this.popoverController.dismiss();
|
|
31070
|
+
// Reset counter (need if event has been received while popover if open)
|
|
31071
|
+
this.userEventService.resetCount();
|
|
31057
31072
|
};
|
|
31058
31073
|
UserEventNotificationList.prototype.fetchMore = function (event) {
|
|
31059
31074
|
var _a;
|
|
31060
31075
|
return __awaiter(this, void 0, void 0, function () {
|
|
31061
|
-
var result, data, err_2;
|
|
31062
|
-
return __generator(this, function (
|
|
31063
|
-
switch (
|
|
31076
|
+
var fetchMoreFn, result, data, err_2;
|
|
31077
|
+
return __generator(this, function (_b) {
|
|
31078
|
+
switch (_b.label) {
|
|
31064
31079
|
case 0:
|
|
31065
|
-
if (!this._fetchMoreFn || this.
|
|
31080
|
+
if (!this._fetchMoreFn || this.fetchingMore)
|
|
31066
31081
|
return [2 /*return*/];
|
|
31067
31082
|
console.debug('[user-event-notification-list] Fetching more notifications...', event);
|
|
31068
|
-
this.
|
|
31069
|
-
|
|
31083
|
+
this.fetchingMore = true;
|
|
31084
|
+
fetchMoreFn = this._fetchMoreFn;
|
|
31085
|
+
_b.label = 1;
|
|
31070
31086
|
case 1:
|
|
31071
|
-
|
|
31072
|
-
return [4 /*yield*/,
|
|
31087
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
31088
|
+
return [4 /*yield*/, fetchMoreFn()];
|
|
31073
31089
|
case 2:
|
|
31074
|
-
result =
|
|
31090
|
+
result = _b.sent();
|
|
31075
31091
|
data = __spread((this.$items.value || []), result.data);
|
|
31076
31092
|
// Remove duplication (e.g. when new user event was added by subscription)
|
|
31077
31093
|
data = removeDuplicatesFromArray(data, 'id');
|
|
31094
|
+
// fetch more changes (e.g. if watchAll observable as been refreshed)
|
|
31095
|
+
if (fetchMoreFn !== this._fetchMoreFn)
|
|
31096
|
+
return [2 /*return*/]; // Skip
|
|
31078
31097
|
this.$items.next(data);
|
|
31079
31098
|
this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
31080
31099
|
this._fetchMoreFn = result.fetchMore;
|
|
31100
|
+
// Update the page size, to keep same scroll height, after the next refresh
|
|
31101
|
+
this.pageSize = Math.max(this.pageSize, data.length);
|
|
31081
31102
|
return [3 /*break*/, 5];
|
|
31082
31103
|
case 3:
|
|
31083
|
-
err_2 =
|
|
31104
|
+
err_2 = _b.sent();
|
|
31084
31105
|
console.error(err_2);
|
|
31085
|
-
this._fetchMoreFn = undefined;
|
|
31106
|
+
this._fetchMoreFn = undefined; // Forget the function
|
|
31086
31107
|
return [3 /*break*/, 5];
|
|
31087
31108
|
case 4:
|
|
31088
31109
|
this.markForCheck();
|
|
31089
|
-
this.
|
|
31110
|
+
this.fetchingMore = false;
|
|
31090
31111
|
return [7 /*endfinally*/];
|
|
31091
31112
|
case 5: return [2 /*return*/];
|
|
31092
31113
|
}
|
|
31093
31114
|
});
|
|
31094
31115
|
});
|
|
31095
31116
|
};
|
|
31096
|
-
UserEventNotificationList.prototype.
|
|
31117
|
+
UserEventNotificationList.prototype.trackByFn = function (index, item) {
|
|
31118
|
+
return item.id;
|
|
31119
|
+
};
|
|
31120
|
+
UserEventNotificationList.prototype.initInfiniteScroll = function (threshold) {
|
|
31097
31121
|
return __awaiter(this, void 0, void 0, function () {
|
|
31098
31122
|
var panel;
|
|
31099
31123
|
var _this = this;
|
|
31100
|
-
return __generator(this, function (
|
|
31101
|
-
switch (
|
|
31124
|
+
return __generator(this, function (_b) {
|
|
31125
|
+
switch (_b.label) {
|
|
31102
31126
|
case 0:
|
|
31127
|
+
console.debug('[user-event-notification-list] Init infinite loop');
|
|
31103
31128
|
if (this._fetchMoreSubscription)
|
|
31104
31129
|
this._fetchMoreSubscription.unsubscribe();
|
|
31105
31130
|
threshold = threshold || (this.mobile ? '15%' : '2%');
|
|
31106
|
-
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
|
|
31131
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; }, { dueTime: 250, timeout: 1000 })];
|
|
31107
31132
|
case 1:
|
|
31108
|
-
|
|
31133
|
+
_b.sent();
|
|
31109
31134
|
return [4 /*yield*/, this.ionContent.getScrollElement()];
|
|
31110
31135
|
case 2:
|
|
31111
|
-
panel =
|
|
31136
|
+
panel = _b.sent();
|
|
31112
31137
|
// Trigger fetch more, end end scroll reached
|
|
31113
|
-
this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
|
|
31138
|
+
this._fetchMoreSubscription = this.$items.pipe(operators.debounceTime(250), operators.filter(function () { return _this.canFetchMore; }), operators.switchMap(function () { return fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/); }))
|
|
31114
31139
|
.subscribe(function () { return _this.fetchMore(); });
|
|
31115
|
-
this.
|
|
31140
|
+
this._subscriptions.add(this._fetchMoreSubscription);
|
|
31116
31141
|
return [2 /*return*/];
|
|
31117
31142
|
}
|
|
31118
31143
|
});
|
|
@@ -31126,7 +31151,7 @@
|
|
|
31126
31151
|
UserEventNotificationList.decorators = [
|
|
31127
31152
|
{ type: i0.Component, args: [{
|
|
31128
31153
|
selector: 'app-user-event-notification-list',
|
|
31129
|
-
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\"\n [class.unread]=\"!item.readDate\"\n [class.tappable]=\"item.actions|arrayFilter:isDefaultAction|isNotEmptyArray\"\n (click)=\"click($event, item)\">\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; else generateIcon\"\n [ref]=\"item.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n <ng-template #generateIcon>\n <div class=\"avatar\" *ngIf=\"item.avatarJdenticon\">\n <svg width=\"40\" width=\"40\" [data-jdenticon-value]=\"item.avatarJdenticon\"></svg>\n </div>\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 <a *ngIf=\"!action.default\" class=\"action\" (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 <span>{{ action.name | translate }}</span>\n </a>\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 <
|
|
31154
|
+
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; trackBy: trackByFn; last as last\"\n [lines]=\"last ? 'none' : undefined\"\n [class.unread]=\"!item.readDate\"\n [class.tappable]=\"item.actions|arrayFilter:isDefaultAction|isNotEmptyArray\"\n (click)=\"click($event, item)\">\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; else generateIcon\"\n [ref]=\"item.avatarIcon\"\n height=\"40\"\n width=\"40\"\n ></app-icon>\n </ng-template>\n\n <ng-template #generateIcon>\n <div class=\"avatar\" *ngIf=\"item.avatarJdenticon\">\n <svg width=\"40\" width=\"40\" [data-jdenticon-value]=\"item.avatarJdenticon\"></svg>\n </div>\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 <a *ngIf=\"!action.default\" class=\"action\" (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 <span>{{ action.name | translate }}</span>\n </a>\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 <ng-container *ngIf=\"!($items|async); else notLoading\">\n <ng-container *ngTemplateOutlet=\"loadingItem\"></ng-container>\n </ng-container>\n\n <ng-template #notLoading>\n <!-- no result -->\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\n <!-- Fetching more -->\n <ng-container *ngIf=\"fetchingMore; else infiniteLoop\" lines=\"none\" disabled>\n <ng-container *ngTemplateOutlet=\"loadingItem\"></ng-container>\n </ng-container>\n\n <!-- Infinite loop -->\n <ng-template #infiniteLoop>\n <ng-container *ngIf=\"canFetchMore\" lines=\"none\" disabled\n [ngTemplateOutlet]=\"loadingItem\">\n </ng-container>\n </ng-template>\n </ng-template>\n\n <!-- footer -->\n <ion-row class=\"ion-list-footer column\">\n <ion-col>\n <ion-text *ngIf=\"$itemCount|async; let count\"\n 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\n<!-- loading -->\n<ng-template #loadingItem>\n <ion-item lines=\"none\" disabled>\n <ion-skeleton-text [animated]=\"true\" style=\"width: 100%\"></ion-skeleton-text>\n </ion-item>\n</ng-template>\n",
|
|
31130
31155
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
31131
31156
|
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)}ion-list ion-item.tappable{cursor:pointer}ion-list ion-item.tappable:hover{--ion-item-background:var(--ion-item-background-color-hover)}.message{font-size:.9em}.message p{margin-top:5px;margin-bottom:5px}.message p.unread{font-weight:700}.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}a.action{font-size:.9em;margin-right:10px;cursor:pointer}a.action:hover span{text-decoration:underline}a.action app-icon{vertical-align:middle}ion-avatar .avatar svg,ion-avatar img{border:1px solid rgba(var(--ion-color-secondary-rgb,.5));border-radius:50%}"]
|
|
31132
31157
|
},] }
|
|
@@ -31141,11 +31166,11 @@
|
|
|
31141
31166
|
debug: [{ type: i0.Input }],
|
|
31142
31167
|
mobile: [{ type: i0.Input }],
|
|
31143
31168
|
titleI18n: [{ type: i0.Input }],
|
|
31144
|
-
pageSize: [{ type: i0.Input }],
|
|
31145
31169
|
sortBy: [{ type: i0.Input }],
|
|
31146
31170
|
sortDirection: [{ type: i0.Input }],
|
|
31147
31171
|
filter: [{ type: i0.Input }],
|
|
31148
31172
|
enableInfiniteScroll: [{ type: i0.Input }],
|
|
31173
|
+
pageSize: [{ type: i0.Input }],
|
|
31149
31174
|
readEvent: [{ type: i0.Output }],
|
|
31150
31175
|
readEvents: [{ type: i0.Output }],
|
|
31151
31176
|
ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
|
|
@@ -31219,7 +31244,8 @@
|
|
|
31219
31244
|
debug: this.debug,
|
|
31220
31245
|
titleI18n: this.titleI18n,
|
|
31221
31246
|
readEvent: this._readEvent,
|
|
31222
|
-
readEvents: this._readEvents
|
|
31247
|
+
readEvents: this._readEvents,
|
|
31248
|
+
filter: this.filter
|
|
31223
31249
|
},
|
|
31224
31250
|
backdropDismiss: true,
|
|
31225
31251
|
keyboardClose: true,
|
|
@@ -34235,24 +34261,27 @@
|
|
|
34235
34261
|
_this.network = network;
|
|
34236
34262
|
_this.translate = translate;
|
|
34237
34263
|
_this.environment = environment;
|
|
34238
|
-
_this
|
|
34264
|
+
_this.$userEvents = new rxjs.BehaviorSubject([]);
|
|
34265
|
+
_this.$newUserEvents = new rxjs.Subject();
|
|
34239
34266
|
return _this;
|
|
34240
34267
|
}
|
|
34241
34268
|
UserEventTestService.prototype.fromObject = function (source) {
|
|
34242
34269
|
return exports.UserEvent.fromObject(source);
|
|
34243
34270
|
};
|
|
34244
34271
|
UserEventTestService.prototype.add = function (entity) {
|
|
34272
|
+
var _a;
|
|
34245
34273
|
return __awaiter(this, void 0, void 0, function () {
|
|
34246
34274
|
return __generator(this, function (_b) {
|
|
34247
34275
|
switch (_b.label) {
|
|
34248
34276
|
case 0: return [4 /*yield*/, this.processUserEvent(entity)];
|
|
34249
34277
|
case 1:
|
|
34250
34278
|
entity = _b.sent();
|
|
34251
|
-
entity.id = this
|
|
34252
|
-
this.
|
|
34279
|
+
entity.id = (((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0) + 1;
|
|
34280
|
+
this.$userEvents.next(__spread([
|
|
34253
34281
|
entity
|
|
34254
|
-
], this.
|
|
34282
|
+
], this.$userEvents.value));
|
|
34255
34283
|
this._countSubject.next((this._countSubject.value || 0) + 1);
|
|
34284
|
+
this.$newUserEvents.next([entity]);
|
|
34256
34285
|
return [2 /*return*/];
|
|
34257
34286
|
}
|
|
34258
34287
|
});
|
|
@@ -34262,7 +34291,8 @@
|
|
|
34262
34291
|
return filter;
|
|
34263
34292
|
};
|
|
34264
34293
|
UserEventTestService.prototype.count = function (filter, options) {
|
|
34265
|
-
|
|
34294
|
+
var _a;
|
|
34295
|
+
return Promise.resolve(((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
34266
34296
|
};
|
|
34267
34297
|
UserEventTestService.prototype.delete = function (entity) {
|
|
34268
34298
|
return Promise.resolve(undefined);
|
|
@@ -34271,11 +34301,11 @@
|
|
|
34271
34301
|
return Promise.resolve(undefined);
|
|
34272
34302
|
};
|
|
34273
34303
|
UserEventTestService.prototype.listenAllChanges = function (filter, options) {
|
|
34274
|
-
return
|
|
34304
|
+
return this.$newUserEvents.asObservable();
|
|
34275
34305
|
};
|
|
34276
34306
|
UserEventTestService.prototype.save = function (entity, options) {
|
|
34277
34307
|
var _a;
|
|
34278
|
-
var toSave = (_a = this.
|
|
34308
|
+
var toSave = (_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
|
|
34279
34309
|
Object.assign(toSave, entity);
|
|
34280
34310
|
return entity;
|
|
34281
34311
|
};
|
|
@@ -34310,31 +34340,33 @@
|
|
|
34310
34340
|
}
|
|
34311
34341
|
finally { if (e_1) throw e_1.error; }
|
|
34312
34342
|
return [7 /*endfinally*/];
|
|
34313
|
-
case 7: return [2 /*return*/,
|
|
34343
|
+
case 7: return [2 /*return*/, this.$userEvents.toPromise()];
|
|
34314
34344
|
}
|
|
34315
34345
|
});
|
|
34316
34346
|
});
|
|
34317
34347
|
};
|
|
34318
34348
|
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34319
34349
|
var _this = this;
|
|
34320
|
-
|
|
34321
|
-
|
|
34322
|
-
|
|
34323
|
-
|
|
34324
|
-
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34329
|
-
|
|
34330
|
-
|
|
34331
|
-
|
|
34350
|
+
return this.$userEvents.pipe(operators.map(function (userEvents) {
|
|
34351
|
+
var _a;
|
|
34352
|
+
var data = (userEvents || []).slice(offset || 0, offset + size);
|
|
34353
|
+
var total = ((_a = _this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34354
|
+
var res = { data: data, total: total };
|
|
34355
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34356
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34357
|
+
// Add fetch more
|
|
34358
|
+
var nextOffset = offset + data.length;
|
|
34359
|
+
if (nextOffset < res.total) {
|
|
34360
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34361
|
+
}
|
|
34362
|
+
return res;
|
|
34363
|
+
}));
|
|
34332
34364
|
};
|
|
34333
34365
|
UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34334
34366
|
var _this = this;
|
|
34335
34367
|
var _a;
|
|
34336
|
-
var data = (this.
|
|
34337
|
-
var total = ((_a = this.
|
|
34368
|
+
var data = (this.$userEvents.value || []).slice(offset || 0, offset + size);
|
|
34369
|
+
var total = ((_a = this.$userEvents.value) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34338
34370
|
var res = { data: data, total: total };
|
|
34339
34371
|
// Must re-order because of listenChanges result will add new event at the end
|
|
34340
34372
|
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
@@ -34378,6 +34410,16 @@
|
|
|
34378
34410
|
onRead: function (userEvent) { _this.showMessage("debug message read "); }
|
|
34379
34411
|
});
|
|
34380
34412
|
}
|
|
34413
|
+
Object.defineProperty(UserEventTestingPage.prototype, "timerStarted", {
|
|
34414
|
+
get: function () {
|
|
34415
|
+
return !!this._timerSubscription;
|
|
34416
|
+
},
|
|
34417
|
+
enumerable: false,
|
|
34418
|
+
configurable: true
|
|
34419
|
+
});
|
|
34420
|
+
UserEventTestingPage.prototype.ngOnDestroy = function () {
|
|
34421
|
+
this.stopTimer();
|
|
34422
|
+
};
|
|
34381
34423
|
UserEventTestingPage.prototype.customize = function (userEvent) {
|
|
34382
34424
|
// Choose avatarIcon
|
|
34383
34425
|
switch (userEvent.level) {
|
|
@@ -34494,6 +34536,51 @@
|
|
|
34494
34536
|
]
|
|
34495
34537
|
}));
|
|
34496
34538
|
};
|
|
34539
|
+
UserEventTestingPage.prototype.addMany = function (count) {
|
|
34540
|
+
count = count || 20;
|
|
34541
|
+
for (var i = 0; i < count; i++) {
|
|
34542
|
+
this.addRandom(i);
|
|
34543
|
+
}
|
|
34544
|
+
};
|
|
34545
|
+
UserEventTestingPage.prototype.startTimer = function (period) {
|
|
34546
|
+
var _this = this;
|
|
34547
|
+
var _a;
|
|
34548
|
+
(_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
34549
|
+
period = period || 1000;
|
|
34550
|
+
var counter = 0;
|
|
34551
|
+
this._timerSubscription = rxjs.timer(period, period)
|
|
34552
|
+
.subscribe(function () {
|
|
34553
|
+
_this.addRandom(counter);
|
|
34554
|
+
counter++;
|
|
34555
|
+
});
|
|
34556
|
+
};
|
|
34557
|
+
UserEventTestingPage.prototype.stopTimer = function () {
|
|
34558
|
+
var _a;
|
|
34559
|
+
(_a = this._timerSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
34560
|
+
this._timerSubscription = null;
|
|
34561
|
+
};
|
|
34562
|
+
UserEventTestingPage.prototype.addRandom = function (value) {
|
|
34563
|
+
switch (value % 6) {
|
|
34564
|
+
case 0:
|
|
34565
|
+
this.addNotification();
|
|
34566
|
+
break;
|
|
34567
|
+
case 1:
|
|
34568
|
+
this.addError();
|
|
34569
|
+
break;
|
|
34570
|
+
case 2:
|
|
34571
|
+
this.addDebug();
|
|
34572
|
+
break;
|
|
34573
|
+
case 3:
|
|
34574
|
+
this.addNotificationWithLink();
|
|
34575
|
+
break;
|
|
34576
|
+
case 4:
|
|
34577
|
+
this.addNotificationWithAction();
|
|
34578
|
+
break;
|
|
34579
|
+
case 5:
|
|
34580
|
+
this.addNotificationWithDefaultAction();
|
|
34581
|
+
break;
|
|
34582
|
+
}
|
|
34583
|
+
};
|
|
34497
34584
|
UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
|
|
34498
34585
|
var _this = this;
|
|
34499
34586
|
this.userEventService.add(exports.UserEvent.fromObject({
|
|
@@ -34520,7 +34607,7 @@
|
|
|
34520
34607
|
UserEventTestingPage.decorators = [
|
|
34521
34608
|
{ type: i0.Component, args: [{
|
|
34522
34609
|
selector: 'job-progression-testing',
|
|
34523
|
-
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"
|
|
34610
|
+
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 <p>\n <ion-button (click)=\"addMany()\">Add notifications (x20)</ion-button>\n </p>\n <p>\n <ion-button (click)=\"startTimer()\" *ngIf=\"!timerStarted\">Start timer</ion-button>\n <ion-button (click)=\"stopTimer()\" *ngIf=\"timerStarted\">Stop timer</ion-button>\n </p>\n</ion-content>\n"
|
|
34524
34611
|
},] }
|
|
34525
34612
|
];
|
|
34526
34613
|
UserEventTestingPage.ctorParameters = function () { return [
|