@sumaris-net/ngx-components 1.21.0-beta13 → 1.21.0-beta16
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 +206 -61
- 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/core/menu/menu.component.js +2 -2
- package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +39 -29
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +36 -5
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +71 -0
- package/esm2015/src/app/social/user-event/user-event.module.js +6 -1
- package/esm2015/src/app/social/user-event/user-event.service.js +35 -14
- package/esm2015/sumaris-net.ngx-components.js +8 -7
- package/fesm2015/sumaris-net.ngx-components.js +171 -45
- 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.component.d.ts +6 -5
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +14 -7
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +37 -0
- package/src/app/social/user-event/user-event.service.d.ts +10 -0
- package/sumaris-net.ngx-components.d.ts +7 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -24749,7 +24749,7 @@
|
|
|
24749
24749
|
MenuComponent.decorators = [
|
|
24750
24750
|
{ type: i0.Component, args: [{
|
|
24751
24751
|
selector: 'app-menu',
|
|
24752
|
-
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" contentId=\"menu-content\">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf=\"isLogin; else notLogin\" class=\"ion-toolbar-top\">\n <ion-grid>\n <ion-row>\n <ion-col size=\"4\">\n <button type=\"button\" mat-flat-button\n class=\"user-avatar\" [class.primary]=\"!accountAvatar\"\n [style.background-image]=\"'url('+(accountAvatar||'./assets/img/person.png')+')'\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\n </button>\n </ion-col>\n <ion-col size=\"8\" class=\"user-logo\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"108px;\"/>\n <span *ngIf=\"!logo\" width=\"108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\n <ion-label color=\"primary\" class=\"ion-text-wrap ion-text-start\">\n <h3 class=\"no-margin username\">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n\n<!-- todo ajouter ici les 2 composants du module social -->\n\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n <!-- User not logged -->\n <ng-template #notLogin>\n <mat-toolbar class=\"ion-padding\" @fadeInAnimation\n style=\"height: unset; display: block; margin: auto; text-align: center;\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"150px;\">\n <span *ngIf=\"!logo\" style=\"width: 150px\">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]=\"isLogin\">\n\n <ion-list lines=\"none\">\n <ion-menu-toggle auto-hide=\"false\"\n [class.flex-spacer]=\"item.cssClass == 'flex-spacer'\"\n *ngFor=\"let item of $items | async\">\n\n <!-- link -->\n <ion-item *ngIf=\"!loading && item.path\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n [routerLink]=\"item.path\"\n routerDirection=\"root\"\n routerLinkActive=\"selected\"\n [routerLinkActiveOptions]=\"{exact: (item.path === '/')}\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- action -->\n <ion-item *ngIf=\"!loading && item.action\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n (click)=\"doAction(item.action, $event)\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- divider -->\n <ion-item-divider @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}}\"\n *ngIf=\"!loading && !item.path && !item.action\">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class=\"hidden-xs hidden-sm\">\n <ion-toolbar>\n\n <ion-buttons slot=\"start\">\n <ion-button mat-icon-button color=\"accent\" (click)=\"openAboutModal($event)\">\n <mat-icon slot=\"icon-only\">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)=\"openAboutModal($event)\" color=\"medium\">\n {{'MENU.FOOTER_VERSION_ABOUT'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot=\"end\">\n <button mat-icon-button color=\"accent\" (click)=\"toggleSplitPaneShow($event)\"\n class=\"hidden-xs hidden-sm hidden-md\"\n [title]=\"(splitPane.when ? 'COMMON.BTN_HIDE_MENU' : 'COMMON.BTN_SHOW_MENU') |translate\">\n <mat-icon><span>{{splitPane.when ? '«' : '»'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n",
|
|
24752
|
+
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" contentId=\"menu-content\">\n <ion-header>\n\n <ion-toolbar @fadeInAnimation *ngIf=\"isLogin; else notLogin\" class=\"ion-toolbar-top\">\n <ion-grid>\n <ion-row>\n <ion-col size=\"4\">\n <button type=\"button\" mat-flat-button\n class=\"user-avatar\" [class.primary]=\"!accountAvatar\"\n [style.background-image]=\"'url('+(accountAvatar||'./assets/img/person.png')+')'\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\n </button>\n </ion-col>\n <ion-col size=\"8\" class=\"user-logo\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"108px;\"/>\n <span *ngIf=\"!logo\" width=\"108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\">\n <ion-label color=\"primary\" class=\"ion-text-wrap ion-text-start\">\n <h3 class=\"no-margin username\">\n <b>{{accountName}}</b>\n </h3>\n <h4>{{accountEmail}}</h4>\n </ion-label>\n </button>\n\n<!-- todo ajouter ici les 2 composants du module social ??? -->\n\n </ion-row>\n </ion-grid>\n\n </ion-toolbar>\n\n <!-- User not logged -->\n <ng-template #notLogin>\n <mat-toolbar class=\"ion-padding\" @fadeInAnimation\n style=\"height: unset; display: block; margin: auto; text-align: center;\">\n <img *ngIf=\"logo\" src=\"{{logo}}\" [title]=\"'APP_NAME'|translate: {appName: appName}\" width=\"150px;\">\n <span *ngIf=\"!logo\" style=\"width: 150px\">{{appName}}</span>\n </mat-toolbar>\n </ng-template>\n </ion-header>\n\n <ion-content [class.has-user-header]=\"isLogin\">\n\n <ion-list lines=\"none\">\n <ion-menu-toggle auto-hide=\"false\"\n [class.flex-spacer]=\"item.cssClass == 'flex-spacer'\"\n *ngFor=\"let item of $items | async\">\n\n <!-- link -->\n <ion-item *ngIf=\"!loading && item.path\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n [routerLink]=\"item.path\"\n routerDirection=\"root\"\n routerLinkActive=\"selected\"\n [routerLinkActiveOptions]=\"{exact: (item.path === '/')}\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- action -->\n <ion-item *ngIf=\"!loading && item.action\"\n @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}} text-1x\"\n tappable\n (click)=\"doAction(item.action, $event)\">\n <ion-icon slot=\"start\" *ngIf=\"item.icon\" [name]=\"item.icon\"></ion-icon>\n <mat-icon slot=\"start\" *ngIf=\"item.matIcon\">{{item.matIcon}}</mat-icon>\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item>\n\n <!-- divider -->\n <ion-item-divider @fadeInAnimation\n class=\"{{item.cssClass}} {{item.color}}\"\n *ngIf=\"!loading && !item.path && !item.action\">\n <ion-label translate>{{item.title}}</ion-label>\n </ion-item-divider>\n\n </ion-menu-toggle>\n </ion-list>\n </ion-content>\n\n <ion-footer class=\"hidden-xs hidden-sm\">\n <ion-toolbar>\n\n <ion-buttons slot=\"start\">\n <ion-button mat-icon-button color=\"accent\" (click)=\"openAboutModal($event)\">\n <mat-icon slot=\"icon-only\">help_outline</mat-icon>\n </ion-button>\n </ion-buttons>\n\n <ion-title (click)=\"openAboutModal($event)\" color=\"medium\">\n {{'MENU.FOOTER_VERSION_ABOUT'| translate: {version: appVersion} }}\n </ion-title>\n\n <ion-buttons slot=\"end\">\n <button mat-icon-button color=\"accent\" (click)=\"toggleSplitPaneShow($event)\"\n class=\"hidden-xs hidden-sm hidden-md\"\n [title]=\"(splitPane.when ? 'COMMON.BTN_HIDE_MENU' : 'COMMON.BTN_SHOW_MENU') |translate\">\n <mat-icon><span>{{splitPane.when ? '«' : '»'}}</span></mat-icon>\n </button>\n </ion-buttons>\n </ion-toolbar>\n </ion-footer>\n\n </ion-menu>\n\n <ng-content></ng-content>\n\n</ion-split-pane>\n",
|
|
24753
24753
|
animations: [fadeInAnimation],
|
|
24754
24754
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
24755
24755
|
styles: ["ion-menu{--ion-item-background:transparent;--ion-item-divider-background:transparent;--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint);--ion-item-background-selected:var(--ion-color-secondary100);--ion-item-text-color-selected:var(--ion-color-primary);--ion-item-icon-color-selected:var(--ion-color-primary);--ion-item-text-color-disable:var(--ion-color-medium);--ion-item-icon-color-disable:var(--ion-color-medium)}ion-menu ion-header ion-text{color:var(--ion-color-primary)}ion-menu ion-header .user-avatar{background-size:cover;background-repeat:no-repeat;background-position:50%;background-color:var(--ion-color-secondary);border:1px solid var(--ion-color-primary);overflow:hidden!important;font-size:var(--avatar-size,60px)!important;line-height:var(--avatar-size,60px);height:var(--avatar-size,60px)!important;width:var(--avatar-size,60px)!important;border-radius:50%;display:inline-block}ion-menu ion-header .user-logo{text-align:right}ion-menu ion-header .user-logo img{max-width:120px;max-height:var(--avatar-size,60px);width:auto}ion-menu ion-header .username{padding-top:0;margin-top:0;margin-bottom:0;width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}ion-menu ion-header button[mat-button]{padding:0;text-align:start!important;width:100%}ion-menu .scroll-content{margin-top:79px!important}ion-menu .has-user-header .scroll-content{margin-top:188px!important}ion-menu ion-content.has-profile-header{--offset-top:188px}ion-menu ion-content.no-profile-header{--offset-top:79px}ion-menu ion-content ion-list{min-height:100%;display:flex;flex-direction:column;justify-content:flex-start}ion-menu ion-content ion-list ion-menu-toggle.flex-spacer{flex:1 1 auto;display:flex;flex-direction:column;justify-content:flex-end}ion-menu ion-content ion-list ion-item.primary{--ion-item-icon-color:var(--ion-color-primary-tint);--ion-item-text-color:var(--ion-color-primary-tint)}ion-menu ion-content ion-list ion-item.secondary{--ion-item-icon-color:var(--ion-color-secondary-tint);--ion-item-text-color:var(--ion-color-secondary-tint)}ion-menu ion-content ion-list ion-item.tertiary{--ion-item-icon-color:var(--ion-color-tertiary-tint);--ion-item-text-color:var(--ion-color-tertiary-tint)}ion-menu ion-content ion-list ion-item.danger{--ion-item-icon-color:var(--ion-color-danger-tint);--ion-item-text-color:var(--ion-color-danger-tint)}ion-menu ion-content ion-list ion-item.medium{--ion-item-icon-color:var(--ion-color-medium-shade);--ion-item-text-color:var(--ion-color-medium-shade)}ion-menu ion-content ion-list ion-item.dark{--ion-item-icon-color:var(--ion-color-dark-tint);--ion-item-text-color:var(--ion-color-dark-tint)}ion-menu ion-content ion-list ion-item ion-icon,ion-menu ion-content ion-list ion-item mat-icon{color:var(--ion-item-icon-color)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item ion-label,ion-menu ion-content ion-list ion-item ion-text{color:var(--ion-item-text-color)!important}ion-menu ion-content ion-list ion-item.selected{background-color:var(--ion-item-background-selected)!important;--color-hover:var(--ion-item-background-selected)!important}ion-menu ion-content ion-list ion-item.selected ion-icon,ion-menu ion-content ion-list ion-item.selected mat-icon{color:var(--ion-item-icon-color-selected)!important;fill:currentColor;stroke:currentColor}ion-menu ion-content ion-list ion-item.selected ion-label,ion-menu ion-content ion-list ion-item.selected ion-text{color:var(--ion-item-text-color-selected)!important}ion-menu ion-content ion-list ion-item.selected:hover{--color-hover:var(--ion-item-background-selected)!important;--ion-item-icon-color-selected:var(--ion-item-icon-color)!important;--ion-item-text-color-selected:var(--ion-item-text-color)!important}ion-menu ion-footer{display:block!important}ion-menu ion-footer ion-toolbar ion-title{cursor:pointer;font-size:12pt;font-weight:400;text-align:center;padding:0 8px}ion-menu ion-footer ion-toolbar ion-button{--width:40px}@media screen and (max-width:767px){ion-menu ion-footer{display:none!important;visibility:hidden!important}}@media screen and (min-width:768px){ion-menu ion-scroll{overflow-y:auto!important}ion-menu .user-avatar{font-size:var(--avatar-size,80px)!important;line-height:var(--avatar-size,80px);height:var(--avatar-size,80px)!important;width:var(--avatar-size,80px)!important}ion-menu .user-logo img{max-height:var(--avatar-size,80px)}}"]
|
|
@@ -30188,22 +30188,6 @@
|
|
|
30188
30188
|
_this._logPrefix = '[user-event-service] ';
|
|
30189
30189
|
// For DEV only
|
|
30190
30190
|
_this._debug = !(environment === null || environment === void 0 ? void 0 : environment.production);
|
|
30191
|
-
// listen login/logout
|
|
30192
|
-
_this._subscriptions.add(accountService.onLogin.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
30193
|
-
var count;
|
|
30194
|
-
return __generator(this, function (_b) {
|
|
30195
|
-
switch (_b.label) {
|
|
30196
|
-
case 0: return [4 /*yield*/, this.count(undefined)];
|
|
30197
|
-
case 1:
|
|
30198
|
-
count = _b.sent();
|
|
30199
|
-
if (count && this._debug) {
|
|
30200
|
-
console.debug(this._logPrefix + "Received " + count + " unread notifications");
|
|
30201
|
-
}
|
|
30202
|
-
this._count$.next(count);
|
|
30203
|
-
return [2 /*return*/];
|
|
30204
|
-
}
|
|
30205
|
-
});
|
|
30206
|
-
}); }));
|
|
30207
30191
|
return _this;
|
|
30208
30192
|
}
|
|
30209
30193
|
Object.defineProperty(AbstractUserEventService.prototype, "userEventCount", {
|
|
@@ -30257,13 +30241,13 @@
|
|
|
30257
30241
|
console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30258
30242
|
now = null;
|
|
30259
30243
|
}
|
|
30260
|
-
|
|
30261
|
-
|
|
30244
|
+
// const unreadCount = this.unreadEvents(data);
|
|
30245
|
+
// this._count$.next(unreadCount);
|
|
30262
30246
|
// Must re-order because of listenChanges result will add new event at the end
|
|
30263
30247
|
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30264
30248
|
return {
|
|
30265
30249
|
data: data,
|
|
30266
|
-
total: toNumber(res === null || res === void 0 ? void 0 : res.total,
|
|
30250
|
+
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30267
30251
|
};
|
|
30268
30252
|
}));
|
|
30269
30253
|
};
|
|
@@ -30282,7 +30266,7 @@
|
|
|
30282
30266
|
AbstractUserEventService.prototype.count = function (filter, options) {
|
|
30283
30267
|
var _a;
|
|
30284
30268
|
return __awaiter(this, void 0, void 0, function () {
|
|
30285
|
-
var res;
|
|
30269
|
+
var res, total;
|
|
30286
30270
|
return __generator(this, function (_b) {
|
|
30287
30271
|
switch (_b.label) {
|
|
30288
30272
|
case 0:
|
|
@@ -30305,11 +30289,42 @@
|
|
|
30305
30289
|
})];
|
|
30306
30290
|
case 1:
|
|
30307
30291
|
res = _b.sent();
|
|
30308
|
-
|
|
30292
|
+
total = res.total;
|
|
30293
|
+
// update count
|
|
30294
|
+
this._count$.next(total);
|
|
30295
|
+
return [2 /*return*/, total];
|
|
30309
30296
|
}
|
|
30310
30297
|
});
|
|
30311
30298
|
});
|
|
30312
30299
|
};
|
|
30300
|
+
AbstractUserEventService.prototype.listenCountChanges = function (filter, options) {
|
|
30301
|
+
var _this = this;
|
|
30302
|
+
if (!this.subscriptions.listenCountChanges) {
|
|
30303
|
+
console.warn(this._logPrefix + "Subscription query 'listenCountChanges' not provided, skip.");
|
|
30304
|
+
return rxjs.of();
|
|
30305
|
+
}
|
|
30306
|
+
if (!filter)
|
|
30307
|
+
filter = this.defaultFilter();
|
|
30308
|
+
filter = this.asFilter(filter);
|
|
30309
|
+
if (this._debug)
|
|
30310
|
+
console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
|
|
30311
|
+
return this.graphql.subscribe({
|
|
30312
|
+
query: this.subscriptions.listenCountChanges,
|
|
30313
|
+
fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
|
|
30314
|
+
variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
|
|
30315
|
+
error: {
|
|
30316
|
+
code: SocialErrorCodes.SUBSCRIBE_USER_EVENTS_ERROR,
|
|
30317
|
+
message: 'SOCIAL.ERROR.SUBSCRIBE_USER_EVENTS_ERROR'
|
|
30318
|
+
}
|
|
30319
|
+
}).pipe(operators.map(function (_b) {
|
|
30320
|
+
var total = _b.total;
|
|
30321
|
+
if (total && _this._debug)
|
|
30322
|
+
console.debug(_this._logPrefix + "Received new user events count:", total);
|
|
30323
|
+
// update count
|
|
30324
|
+
_this._count$.next(total);
|
|
30325
|
+
return total;
|
|
30326
|
+
}));
|
|
30327
|
+
};
|
|
30313
30328
|
AbstractUserEventService.prototype.listenChanges = function (filter, options) {
|
|
30314
30329
|
var _this = this;
|
|
30315
30330
|
var _a;
|
|
@@ -30342,7 +30357,7 @@
|
|
|
30342
30357
|
data: updatedData
|
|
30343
30358
|
});
|
|
30344
30359
|
// update count
|
|
30345
|
-
|
|
30360
|
+
// this._count$.next(this.unreadEvents(updatedData));
|
|
30346
30361
|
return updatedData;
|
|
30347
30362
|
}));
|
|
30348
30363
|
};
|
|
@@ -30932,10 +30947,34 @@
|
|
|
30932
30947
|
};
|
|
30933
30948
|
|
|
30934
30949
|
var UserEventNotificationList = /** @class */ (function () {
|
|
30935
|
-
function UserEventNotificationList(popoverController) {
|
|
30950
|
+
function UserEventNotificationList(cd, popoverController, userEventService) {
|
|
30951
|
+
this.cd = cd;
|
|
30936
30952
|
this.popoverController = popoverController;
|
|
30953
|
+
this.userEventService = userEventService;
|
|
30954
|
+
this.debug = false;
|
|
30955
|
+
this.userEvents = new rxjs.BehaviorSubject(undefined);
|
|
30956
|
+
this.subscriptions = new rxjs.Subscription();
|
|
30937
30957
|
}
|
|
30938
30958
|
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30959
|
+
var _this = this;
|
|
30960
|
+
// Watch all user events
|
|
30961
|
+
this.subscriptions.add(this.userEventService
|
|
30962
|
+
.watchAll(0, 10, 'creationDate', "desc", undefined)
|
|
30963
|
+
.subscribe(function (result) {
|
|
30964
|
+
if (_this.debug)
|
|
30965
|
+
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
30966
|
+
_this.userEvents.next(result.data);
|
|
30967
|
+
_this.markForCheck();
|
|
30968
|
+
}));
|
|
30969
|
+
// Listen changes
|
|
30970
|
+
this.subscriptions.add(this.userEventService.listenChanges(undefined)
|
|
30971
|
+
.subscribe(function (data) {
|
|
30972
|
+
if (_this.debug)
|
|
30973
|
+
console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
|
|
30974
|
+
}));
|
|
30975
|
+
};
|
|
30976
|
+
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30977
|
+
this.subscriptions.unsubscribe();
|
|
30939
30978
|
};
|
|
30940
30979
|
UserEventNotificationList.prototype.read = function ($event, userEvent) {
|
|
30941
30980
|
var _a;
|
|
@@ -30951,21 +30990,27 @@
|
|
|
30951
30990
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30952
30991
|
this.popoverController.dismiss();
|
|
30953
30992
|
};
|
|
30993
|
+
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30994
|
+
this.cd.markForCheck();
|
|
30995
|
+
};
|
|
30954
30996
|
return UserEventNotificationList;
|
|
30955
30997
|
}());
|
|
30956
30998
|
UserEventNotificationList.decorators = [
|
|
30957
30999
|
{ type: i0.Component, args: [{
|
|
30958
31000
|
selector: 'app-user-event-notification-list',
|
|
30959
31001
|
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-row>\n\n <ion-item *ngIf=\"!(userEvents | async)?.length\">\n {{'SOCIAL.USER_EVENT.NOTIFICATION.EMPTY' | translate}}\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\">\n <ion-row>\n <ion-col>\n <p [class.unread]=\"!userEvent.readDate\">\n {{userEvent.message}}\n </p>\n </ion-col>\n </ion-row>\n <ion-row *ngIf=\"userEvent.actions?.length\">\n <ion-col>\n <p>\n <span *ngFor=\"let action of userEvent.actions\">\n <a\n [style.margin-right.px]=\"8\"\n [style.cursor]=\"'pointer'\"\n (click)=\"executeAction(action, userEvent)\"\n >\n {{ '➞ ' + action.name}}\n </a>\n </span>\n </p>\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'\"\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-list>\n",
|
|
31002
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30960
31003
|
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;user-select:none}.unread{font-weight:700}"]
|
|
30961
31004
|
},] }
|
|
30962
31005
|
];
|
|
30963
31006
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30964
|
-
{ type:
|
|
31007
|
+
{ type: i0.ChangeDetectorRef },
|
|
31008
|
+
{ type: i1$5.PopoverController },
|
|
31009
|
+
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [UserEventServiceToken,] }] }
|
|
30965
31010
|
]; };
|
|
30966
31011
|
UserEventNotificationList.propDecorators = {
|
|
31012
|
+
debug: [{ type: i0.Input }],
|
|
30967
31013
|
titleI18n: [{ type: i0.Input }],
|
|
30968
|
-
userEvents: [{ type: i0.Input }],
|
|
30969
31014
|
readEvent: [{ type: i0.Output }]
|
|
30970
31015
|
};
|
|
30971
31016
|
|
|
@@ -30978,8 +31023,6 @@
|
|
|
30978
31023
|
this.debug = false;
|
|
30979
31024
|
this.titleI18n = 'SOCIAL.USER_EVENT.NOTIFICATION.TITLE';
|
|
30980
31025
|
this.disabled = false;
|
|
30981
|
-
this.userEventsSubject = new rxjs.BehaviorSubject(undefined);
|
|
30982
|
-
this._subscriptions = new rxjs.Subscription();
|
|
30983
31026
|
this._logPrefix = '[user-event-notification] ';
|
|
30984
31027
|
this._readEvent = new i0.EventEmitter();
|
|
30985
31028
|
}
|
|
@@ -30992,28 +31035,30 @@
|
|
|
30992
31035
|
configurable: true
|
|
30993
31036
|
});
|
|
30994
31037
|
UserEventNotificationComponent.prototype.ngOnInit = function () {
|
|
30995
|
-
|
|
30996
|
-
|
|
30997
|
-
|
|
30998
|
-
|
|
30999
|
-
|
|
31000
|
-
|
|
31001
|
-
|
|
31002
|
-
|
|
31003
|
-
|
|
31004
|
-
|
|
31005
|
-
|
|
31006
|
-
|
|
31007
|
-
|
|
31008
|
-
|
|
31009
|
-
|
|
31010
|
-
|
|
31011
|
-
|
|
31012
|
-
|
|
31013
|
-
|
|
31014
|
-
|
|
31015
|
-
|
|
31016
|
-
|
|
31038
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31039
|
+
var _this = this;
|
|
31040
|
+
return __generator(this, function (_b) {
|
|
31041
|
+
switch (_b.label) {
|
|
31042
|
+
case 0:
|
|
31043
|
+
if (isNil(this.userEventService)) {
|
|
31044
|
+
console.warn(this._logPrefix + "No service injected");
|
|
31045
|
+
this.disabled = true;
|
|
31046
|
+
return [2 /*return*/];
|
|
31047
|
+
}
|
|
31048
|
+
return [4 /*yield*/, this.accountService.ready()];
|
|
31049
|
+
case 1:
|
|
31050
|
+
_b.sent();
|
|
31051
|
+
// listen login/logout
|
|
31052
|
+
this.accountService.onLogin.subscribe(function () { return _this.onLogin(); });
|
|
31053
|
+
this.accountService.onLogout.subscribe(function () { return _this.onLogout(); });
|
|
31054
|
+
// Subscribe to read event
|
|
31055
|
+
this._readEvent.subscribe(function (value) {
|
|
31056
|
+
// default: mark event as read
|
|
31057
|
+
_this.userEventService.markAsRead(value);
|
|
31058
|
+
});
|
|
31059
|
+
return [2 /*return*/];
|
|
31060
|
+
}
|
|
31061
|
+
});
|
|
31017
31062
|
});
|
|
31018
31063
|
};
|
|
31019
31064
|
UserEventNotificationComponent.prototype.showList = function (event) {
|
|
@@ -31024,8 +31069,8 @@
|
|
|
31024
31069
|
case 0: return [4 /*yield*/, this.popoverController.create({
|
|
31025
31070
|
component: UserEventNotificationList,
|
|
31026
31071
|
componentProps: {
|
|
31072
|
+
debug: this.debug,
|
|
31027
31073
|
titleI18n: this.titleI18n,
|
|
31028
|
-
userEvents: this.userEventsSubject,
|
|
31029
31074
|
readEvent: this._readEvent
|
|
31030
31075
|
},
|
|
31031
31076
|
backdropDismiss: true,
|
|
@@ -31044,14 +31089,41 @@
|
|
|
31044
31089
|
});
|
|
31045
31090
|
});
|
|
31046
31091
|
};
|
|
31047
|
-
UserEventNotificationComponent.prototype.markForCheck = function () {
|
|
31048
|
-
this.cd.markForCheck();
|
|
31049
|
-
};
|
|
31050
31092
|
UserEventNotificationComponent.prototype.ngOnDestroy = function () {
|
|
31051
31093
|
if (this.debug) {
|
|
31052
31094
|
console.debug(this._logPrefix + "Destroying");
|
|
31053
31095
|
}
|
|
31054
|
-
this.
|
|
31096
|
+
this.onLogout();
|
|
31097
|
+
};
|
|
31098
|
+
UserEventNotificationComponent.prototype.onLogin = function () {
|
|
31099
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31100
|
+
var count;
|
|
31101
|
+
var _this = this;
|
|
31102
|
+
return __generator(this, function (_b) {
|
|
31103
|
+
switch (_b.label) {
|
|
31104
|
+
case 0: return [4 /*yield*/, this.userEventService.count(undefined)];
|
|
31105
|
+
case 1:
|
|
31106
|
+
count = _b.sent();
|
|
31107
|
+
if (this.debug)
|
|
31108
|
+
console.debug(this._logPrefix + "Receiving user events count", count);
|
|
31109
|
+
this.markForCheck();
|
|
31110
|
+
// Then listen changes
|
|
31111
|
+
this._listenSubscription = this.userEventService.listenCountChanges(undefined).subscribe(function (count) {
|
|
31112
|
+
if (_this.debug)
|
|
31113
|
+
console.debug(_this._logPrefix + "Receiving new user events count", count);
|
|
31114
|
+
_this.markForCheck();
|
|
31115
|
+
});
|
|
31116
|
+
return [2 /*return*/];
|
|
31117
|
+
}
|
|
31118
|
+
});
|
|
31119
|
+
});
|
|
31120
|
+
};
|
|
31121
|
+
UserEventNotificationComponent.prototype.onLogout = function () {
|
|
31122
|
+
var _a;
|
|
31123
|
+
(_a = this._listenSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
31124
|
+
};
|
|
31125
|
+
UserEventNotificationComponent.prototype.markForCheck = function () {
|
|
31126
|
+
this.cd.markForCheck();
|
|
31055
31127
|
};
|
|
31056
31128
|
return UserEventNotificationComponent;
|
|
31057
31129
|
}());
|
|
@@ -31075,6 +31147,75 @@
|
|
|
31075
31147
|
disabled: [{ type: i0.Input }]
|
|
31076
31148
|
};
|
|
31077
31149
|
|
|
31150
|
+
var UserEventTestService = /** @class */ (function (_super) {
|
|
31151
|
+
__extends(UserEventTestService, _super);
|
|
31152
|
+
function UserEventTestService(graphql, accountService, network, translate, environment) {
|
|
31153
|
+
var _this = _super.call(this, graphql, accountService, network, translate, undefined, undefined, undefined, environment) || this;
|
|
31154
|
+
_this.graphql = graphql;
|
|
31155
|
+
_this.accountService = accountService;
|
|
31156
|
+
_this.network = network;
|
|
31157
|
+
_this.translate = translate;
|
|
31158
|
+
_this.environment = environment;
|
|
31159
|
+
_this.userEvents = [];
|
|
31160
|
+
_this.count$ = new rxjs.BehaviorSubject(0);
|
|
31161
|
+
return _this;
|
|
31162
|
+
}
|
|
31163
|
+
UserEventTestService.prototype.fromObject = function (source) {
|
|
31164
|
+
return exports.UserEvent.fromObject(source);
|
|
31165
|
+
};
|
|
31166
|
+
UserEventTestService.prototype.add = function (entity) {
|
|
31167
|
+
entity = this.processUserEvent(entity);
|
|
31168
|
+
entity.id = this.userEvents.length + 1;
|
|
31169
|
+
this.userEvents.push(entity);
|
|
31170
|
+
this.count$.next(this.userEvents.length);
|
|
31171
|
+
};
|
|
31172
|
+
Object.defineProperty(UserEventTestService.prototype, "userEventCount", {
|
|
31173
|
+
get: function () {
|
|
31174
|
+
return this.count$.asObservable();
|
|
31175
|
+
},
|
|
31176
|
+
enumerable: false,
|
|
31177
|
+
configurable: true
|
|
31178
|
+
});
|
|
31179
|
+
UserEventTestService.prototype.asFilter = function (filter) {
|
|
31180
|
+
return filter;
|
|
31181
|
+
};
|
|
31182
|
+
UserEventTestService.prototype.count = function (filter, options) {
|
|
31183
|
+
return Promise.resolve(this.userEvents.length);
|
|
31184
|
+
};
|
|
31185
|
+
UserEventTestService.prototype.delete = function (entity) {
|
|
31186
|
+
return Promise.resolve(undefined);
|
|
31187
|
+
};
|
|
31188
|
+
UserEventTestService.prototype.deleteAll = function (data, opts) {
|
|
31189
|
+
return Promise.resolve(undefined);
|
|
31190
|
+
};
|
|
31191
|
+
UserEventTestService.prototype.listenChanges = function (filter, options) {
|
|
31192
|
+
return rxjs.of();
|
|
31193
|
+
};
|
|
31194
|
+
UserEventTestService.prototype.save = function (entity, options) {
|
|
31195
|
+
var _a;
|
|
31196
|
+
var toSave = (_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.find(function (value) { return value.id == (entity === null || entity === void 0 ? void 0 : entity.id); });
|
|
31197
|
+
Object.assign(toSave, entity);
|
|
31198
|
+
return entity;
|
|
31199
|
+
};
|
|
31200
|
+
UserEventTestService.prototype.saveAll = function (data, opts) {
|
|
31201
|
+
return Promise.resolve([]);
|
|
31202
|
+
};
|
|
31203
|
+
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
31204
|
+
return rxjs.of({ data: this.userEvents });
|
|
31205
|
+
};
|
|
31206
|
+
return UserEventTestService;
|
|
31207
|
+
}(AbstractUserEventService));
|
|
31208
|
+
UserEventTestService.decorators = [
|
|
31209
|
+
{ type: i0.Injectable }
|
|
31210
|
+
];
|
|
31211
|
+
UserEventTestService.ctorParameters = function () { return [
|
|
31212
|
+
{ type: GraphqlService },
|
|
31213
|
+
{ type: AccountService },
|
|
31214
|
+
{ type: NetworkService },
|
|
31215
|
+
{ type: i1$2.TranslateService },
|
|
31216
|
+
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
31217
|
+
]; };
|
|
31218
|
+
|
|
31078
31219
|
var UserEventModule = /** @class */ (function () {
|
|
31079
31220
|
function UserEventModule() {
|
|
31080
31221
|
}
|
|
@@ -31095,6 +31236,9 @@
|
|
|
31095
31236
|
exports: [
|
|
31096
31237
|
UserEventsTable,
|
|
31097
31238
|
UserEventNotificationComponent
|
|
31239
|
+
],
|
|
31240
|
+
providers: [
|
|
31241
|
+
{ provide: UserEventServiceToken, useClass: UserEventTestService }
|
|
31098
31242
|
]
|
|
31099
31243
|
},] }
|
|
31100
31244
|
];
|
|
@@ -34257,12 +34401,13 @@
|
|
|
34257
34401
|
exports.ɵi = AppUpdateOfflineModeCard;
|
|
34258
34402
|
exports.ɵj = AppIconComponent;
|
|
34259
34403
|
exports.ɵk = UserEventNotificationList;
|
|
34260
|
-
exports.ɵl =
|
|
34261
|
-
exports.ɵm =
|
|
34262
|
-
exports.ɵn =
|
|
34263
|
-
exports.ɵo =
|
|
34264
|
-
exports.ɵp =
|
|
34265
|
-
exports.ɵq =
|
|
34404
|
+
exports.ɵl = UserEventTestService;
|
|
34405
|
+
exports.ɵm = JobProgressionList;
|
|
34406
|
+
exports.ɵn = DateTestPage;
|
|
34407
|
+
exports.ɵo = NumpadTestPage;
|
|
34408
|
+
exports.ɵp = MatBadgeIconTestPage;
|
|
34409
|
+
exports.ɵq = ToastTestingModule;
|
|
34410
|
+
exports.ɵr = ToastTestingPage;
|
|
34266
34411
|
|
|
34267
34412
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
34268
34413
|
|