@sumaris-net/ngx-components 1.22.10 → 1.22.11-rc11
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 +763 -82
- 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/doc/changelog.md +3 -0
- package/esm2015/public_api.js +11 -2
- package/esm2015/src/app/core/form/entity-editor-modal.class.js +3 -2
- package/esm2015/src/app/core/form/entity-editor.class.js +5 -4
- package/esm2015/src/app/core/menu/menu.component.js +2 -2
- 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/job/testing/job-progression.testing.js +48 -0
- package/esm2015/src/app/social/job/testing/job-progression.testing.service.js +30 -0
- package/esm2015/src/app/social/job/testing/job.testing.module.js +25 -0
- package/esm2015/src/app/social/social.module.js +6 -1
- package/esm2015/src/app/social/social.testing.module.js +39 -0
- package/esm2015/src/app/social/user-event/notification/user-event-notification.icon.js +94 -0
- package/esm2015/src/app/social/user-event/notification/user-event-notification.list.js +131 -30
- package/esm2015/src/app/social/user-event/testing/user-event.testing.js +179 -0
- package/esm2015/src/app/social/user-event/testing/user-event.testing.module.js +25 -0
- package/esm2015/src/app/social/user-event/testing/user-event.testing.service.js +35 -6
- package/esm2015/src/app/social/user-event/user-event.model.js +1 -1
- package/esm2015/src/app/social/user-event/user-event.module.js +4 -4
- package/esm2015/src/app/social/user-event/user-event.service.js +75 -18
- package/fesm2015/sumaris-net.ngx-components.js +648 -72
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +8 -1
- package/src/app/core/form/entity-editor.class.d.ts +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/job/testing/job-progression.testing.d.ts +11 -0
- package/src/app/social/job/testing/job-progression.testing.service.d.ts +10 -0
- package/src/app/social/job/testing/job.testing.module.d.ts +2 -0
- package/src/app/social/social.testing.module.d.ts +4 -0
- package/src/app/social/user-event/notification/{user-event-notification.component.d.ts → user-event-notification.icon.d.ts} +3 -2
- package/src/app/social/user-event/notification/user-event-notification.list.d.ts +37 -12
- package/src/app/social/user-event/testing/user-event.testing.d.ts +23 -0
- package/src/app/social/user-event/testing/user-event.testing.module.d.ts +2 -0
- package/src/app/social/user-event/testing/user-event.testing.service.d.ts +4 -3
- package/src/app/social/user-event/user-event.model.d.ts +1 -0
- package/src/app/social/user-event/user-event.service.d.ts +18 -14
- package/src/theme/_ngx-components.scss +12 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
- package/esm2015/src/app/social/user-event/notification/user-event-notification.component.js +0 -89
|
@@ -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
|
}
|
|
@@ -24829,7 +24834,7 @@
|
|
|
24829
24834
|
MenuComponent.decorators = [
|
|
24830
24835
|
{ type: i0.Component, args: [{
|
|
24831
24836
|
selector: 'app-menu',
|
|
24832
|
-
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" [contentId]=\"contentId\">\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 [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\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\" style=\"width: 108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\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 </ion-col>\n\n <!-- Insertion headerBottomRight -->\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"headerBottomRight\"></ng-container>\n </ion-col>\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
|
|
24837
|
+
template: "<ion-split-pane #splitPane [contentId]=\"contentId\" (swiperight)=\"onSwipeRight($event)\">\n\n <ion-menu [id]=\"id\" [menuId]=\"menuId\" [contentId]=\"contentId\">\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 [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\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\" style=\"width: 108px;\">{{appName}}</span>\n </ion-col>\n </ion-row>\n <ion-row class=\"ion-no-padding\">\n <ion-col>\n <button mat-button type=\"button\"\n [routerLink]=\"['/account']\"\n routerDirection=\"root\"\n routerLinkActive=\"ion-color-primary\"\n (click)=\"close()\"\n [title]=\"'MENU.BTN_MY_ACCOUNT'|translate\">\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 </ion-col>\n\n <!-- Insertion headerBottomRight -->\n <ion-col size=\"auto\">\n <ng-container *ngTemplateOutlet=\"headerBottomRight\"></ng-container>\n </ion-col>\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\n<ng-template #headerBottomRight>\n <ng-content select=\"[headerBottomRight]\"></ng-content>\n</ng-template>\n",
|
|
24833
24838
|
animations: [fadeInAnimation],
|
|
24834
24839
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
24835
24840
|
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-avatar:hover{background-color:var(--ion-color-secondary-shade);border:2px solid var(--ion-color-primary-shade)}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)}}"]
|
|
@@ -28791,10 +28796,10 @@
|
|
|
28791
28796
|
_this.savingSubject = new rxjs.BehaviorSubject(false);
|
|
28792
28797
|
_this.$title = new rxjs.Subject();
|
|
28793
28798
|
_this.onUpdateView = new i0.EventEmitter();
|
|
28794
|
-
_this.
|
|
28799
|
+
_this.environment = injector.get(ENVIRONMENT);
|
|
28795
28800
|
options = Object.assign({
|
|
28796
28801
|
// Default options
|
|
28797
|
-
enableListenChanges: ((_a = _this.
|
|
28802
|
+
enableListenChanges: ((_a = _this.environment.entityEditor) === null || _a === void 0 ? void 0 : _a.enableListenChanges) || false, listenIntervalInSeconds: toNumber((_b = _this.environment.entityEditor) === null || _b === void 0 ? void 0 : _b.listenIntervalInSeconds, 0), pathIdAttribute: 'id', autoLoad: true, autoUpdateRoute: true, i18nPrefix: ''
|
|
28798
28803
|
}, options);
|
|
28799
28804
|
_this.settings = injector.get(LocalSettingsService);
|
|
28800
28805
|
_this.errorTranslator = injector.get(FormErrorTranslator);
|
|
@@ -29093,13 +29098,14 @@
|
|
|
29093
29098
|
* Enable or disable state
|
|
29094
29099
|
*/
|
|
29095
29100
|
AppEntityEditor.prototype.updateViewState = function (data, opts) {
|
|
29101
|
+
var _a;
|
|
29096
29102
|
if (this.isNewData || this.canUserWrite(data)) {
|
|
29097
29103
|
this.enable(opts);
|
|
29098
29104
|
}
|
|
29099
29105
|
else {
|
|
29100
29106
|
this.disable(opts);
|
|
29101
29107
|
// Allow to sort table
|
|
29102
|
-
this.tables.forEach(function (t) { return t.enableSort(); });
|
|
29108
|
+
(_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
|
|
29103
29109
|
}
|
|
29104
29110
|
};
|
|
29105
29111
|
/**
|
|
@@ -29833,13 +29839,14 @@
|
|
|
29833
29839
|
* Enable or disable state
|
|
29834
29840
|
*/
|
|
29835
29841
|
AppEntityEditorModal.prototype.updateViewState = function (data, opts) {
|
|
29842
|
+
var _a;
|
|
29836
29843
|
if (this.isNewData || this.enabled) {
|
|
29837
29844
|
this.enable(opts);
|
|
29838
29845
|
}
|
|
29839
29846
|
else {
|
|
29840
29847
|
this.disable(opts);
|
|
29841
29848
|
// Allow to sort table
|
|
29842
|
-
this.tables.forEach(function (t) { return t.enableSort(); });
|
|
29849
|
+
(_a = this.tables) === null || _a === void 0 ? void 0 : _a.forEach(function (t) { return t.enableSort(); });
|
|
29843
29850
|
}
|
|
29844
29851
|
};
|
|
29845
29852
|
AppEntityEditorModal.prototype.saveAndClose = function (event) {
|
|
@@ -30245,7 +30252,7 @@
|
|
|
30245
30252
|
_this.network = network;
|
|
30246
30253
|
_this.translate = translate;
|
|
30247
30254
|
_this.options = options;
|
|
30248
|
-
_this.
|
|
30255
|
+
_this._countSubject = new rxjs.BehaviorSubject(0);
|
|
30249
30256
|
_this.listeners = [];
|
|
30250
30257
|
_this._subscriptions = new rxjs.Subscription();
|
|
30251
30258
|
_this.queries = options.queries;
|
|
@@ -30254,9 +30261,9 @@
|
|
|
30254
30261
|
_this._logPrefix = '[user-event-service] ';
|
|
30255
30262
|
return _this;
|
|
30256
30263
|
}
|
|
30257
|
-
Object.defineProperty(AbstractUserEventService.prototype, "
|
|
30264
|
+
Object.defineProperty(AbstractUserEventService.prototype, "countSubject", {
|
|
30258
30265
|
get: function () {
|
|
30259
|
-
return this.
|
|
30266
|
+
return this._countSubject;
|
|
30260
30267
|
},
|
|
30261
30268
|
enumerable: false,
|
|
30262
30269
|
configurable: true
|
|
@@ -30289,7 +30296,7 @@
|
|
|
30289
30296
|
AbstractUserEventService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, options) {
|
|
30290
30297
|
return this.watchPage({ offset: offset, size: size, sortBy: sortBy, sortDirection: sortDirection }, filter, options);
|
|
30291
30298
|
};
|
|
30292
|
-
AbstractUserEventService.prototype.watchPage = function (page, filter,
|
|
30299
|
+
AbstractUserEventService.prototype.watchPage = function (page, filter, opts) {
|
|
30293
30300
|
var _this = this;
|
|
30294
30301
|
var _a;
|
|
30295
30302
|
var now = this._debug && Date.now();
|
|
@@ -30306,7 +30313,7 @@
|
|
|
30306
30313
|
filter.recipients = [recipient];
|
|
30307
30314
|
}
|
|
30308
30315
|
}
|
|
30309
|
-
var withContent = (
|
|
30316
|
+
var withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30310
30317
|
return this.mutableWatchQuery({
|
|
30311
30318
|
queryName: withContent ? 'LoadAllWithContent' : 'LoadAll',
|
|
30312
30319
|
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
@@ -30319,7 +30326,8 @@
|
|
|
30319
30326
|
},
|
|
30320
30327
|
arrayFieldName: 'data',
|
|
30321
30328
|
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30322
|
-
fetchPolicy: (
|
|
30329
|
+
fetchPolicy: (opts === null || opts === void 0 ? void 0 : opts.fetchPolicy) || 'cache-first',
|
|
30330
|
+
insertFilterFn: filter && filter.asFilterFn()
|
|
30323
30331
|
})
|
|
30324
30332
|
.pipe(operators.map(function (res) {
|
|
30325
30333
|
var data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
@@ -30327,14 +30335,79 @@
|
|
|
30327
30335
|
console.debug("" + _this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30328
30336
|
now = null;
|
|
30329
30337
|
}
|
|
30330
|
-
// Must re-order because of
|
|
30338
|
+
// Must re-order because of listenAllChanges result will add new event at the end
|
|
30331
30339
|
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30332
|
-
|
|
30340
|
+
var result = {
|
|
30333
30341
|
data: data,
|
|
30334
30342
|
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30335
30343
|
};
|
|
30344
|
+
// Add fetch more capability, if total was fetched
|
|
30345
|
+
if (isNotNil(res.total)) {
|
|
30346
|
+
var nextOffset_1 = (page.offset || 0) + data.length;
|
|
30347
|
+
if (nextOffset_1 < result.total) {
|
|
30348
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_1 }), filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
30349
|
+
}
|
|
30350
|
+
}
|
|
30351
|
+
return result;
|
|
30336
30352
|
}));
|
|
30337
30353
|
};
|
|
30354
|
+
AbstractUserEventService.prototype.loadPage = function (page, filter, opts) {
|
|
30355
|
+
var _a;
|
|
30356
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30357
|
+
var now, recipient, withContent, res, data, result, nextOffset_2;
|
|
30358
|
+
var _this = this;
|
|
30359
|
+
return __generator(this, function (_b) {
|
|
30360
|
+
switch (_b.label) {
|
|
30361
|
+
case 0:
|
|
30362
|
+
now = this._debug && Date.now();
|
|
30363
|
+
if (!filter)
|
|
30364
|
+
filter = this.defaultFilter();
|
|
30365
|
+
console.debug(this._logPrefix + "Loading user events...", filter);
|
|
30366
|
+
filter = this.asFilter(filter);
|
|
30367
|
+
// Force recipient to current issuer, if not admin and not specified
|
|
30368
|
+
if (isEmptyArray(filter === null || filter === void 0 ? void 0 : filter.recipients) || !this.accountService.isAdmin()) {
|
|
30369
|
+
recipient = this.defaultRecipient();
|
|
30370
|
+
if (!((_a = filter === null || filter === void 0 ? void 0 : filter.recipients) === null || _a === void 0 ? void 0 : _a.includes(recipient))) {
|
|
30371
|
+
console.warn('[user-events-service] Force user event filter.recipient=' + recipient);
|
|
30372
|
+
filter.recipients = [recipient];
|
|
30373
|
+
}
|
|
30374
|
+
}
|
|
30375
|
+
withContent = (opts === null || opts === void 0 ? void 0 : opts.withContent) === true;
|
|
30376
|
+
return [4 /*yield*/, this.graphql.query({
|
|
30377
|
+
query: withContent ? this.queries.loadAllWithContent : this.queries.loadAll,
|
|
30378
|
+
variables: {
|
|
30379
|
+
page: Object.assign(Object.assign({ sortBy: 'creationDate' }, page), {
|
|
30380
|
+
// @ts-ignore
|
|
30381
|
+
sortDirection: (page.sortDirection || 'desc').toUpperCase()
|
|
30382
|
+
}),
|
|
30383
|
+
filter: filter && filter.asPodObject()
|
|
30384
|
+
},
|
|
30385
|
+
error: { code: SocialErrorCodes.LOAD_USER_EVENTS_ERROR, message: 'SOCIAL.ERROR.LOAD_USER_EVENTS_ERROR' },
|
|
30386
|
+
fetchPolicy: opts === null || opts === void 0 ? void 0 : opts.fetchPolicy
|
|
30387
|
+
})];
|
|
30388
|
+
case 1:
|
|
30389
|
+
res = _b.sent();
|
|
30390
|
+
data = ((res === null || res === void 0 ? void 0 : res.data) || []).map(function (value) { return _this.processUserEvent(value, _this); });
|
|
30391
|
+
if (now)
|
|
30392
|
+
console.debug("" + this._logPrefix + data.length + " user events loaded in " + (Date.now() - now) + "ms");
|
|
30393
|
+
// Must re-order because of listenAllChanges result will add new event at the end
|
|
30394
|
+
data = EntityUtils.sort(data, page.sortBy, page.sortDirection);
|
|
30395
|
+
result = {
|
|
30396
|
+
data: data,
|
|
30397
|
+
total: toNumber(res === null || res === void 0 ? void 0 : res.total, data.length)
|
|
30398
|
+
};
|
|
30399
|
+
// Add fetch more capability, if total was fetched
|
|
30400
|
+
if (isNotNil(res.total)) {
|
|
30401
|
+
nextOffset_2 = (page.offset || 0) + data.length;
|
|
30402
|
+
if (nextOffset_2 < result.total) {
|
|
30403
|
+
result.fetchMore = function (_) { return _this.loadPage(Object.assign(Object.assign({}, page), { offset: nextOffset_2 }), filter, opts); };
|
|
30404
|
+
}
|
|
30405
|
+
}
|
|
30406
|
+
return [2 /*return*/, result];
|
|
30407
|
+
}
|
|
30408
|
+
});
|
|
30409
|
+
});
|
|
30410
|
+
};
|
|
30338
30411
|
AbstractUserEventService.prototype.add = function (entity) {
|
|
30339
30412
|
// TODO set an id !!!!!!!!!!!!!!!!!!!!!!!!!
|
|
30340
30413
|
entity = this.processUserEvent(entity);
|
|
@@ -30345,7 +30418,7 @@
|
|
|
30345
30418
|
data: entity
|
|
30346
30419
|
});
|
|
30347
30420
|
// Update count
|
|
30348
|
-
this.
|
|
30421
|
+
this._countSubject.next(this._countSubject.value + 1);
|
|
30349
30422
|
};
|
|
30350
30423
|
AbstractUserEventService.prototype.count = function (filter, options) {
|
|
30351
30424
|
var _a;
|
|
@@ -30391,6 +30464,7 @@
|
|
|
30391
30464
|
filter = this.defaultFilter();
|
|
30392
30465
|
// Apply last reset date as start date
|
|
30393
30466
|
filter.startDate = this.resetCountDate;
|
|
30467
|
+
filter.excludeRead = true;
|
|
30394
30468
|
filter = this.asFilter(filter);
|
|
30395
30469
|
if (this._debug)
|
|
30396
30470
|
console.debug(this._logPrefix + "[WS] Listening count changes for user events with filter:", filter);
|
|
@@ -30407,15 +30481,15 @@
|
|
|
30407
30481
|
if (total && _this._debug)
|
|
30408
30482
|
console.debug(_this._logPrefix + "Received new user events count:", total);
|
|
30409
30483
|
// update count
|
|
30410
|
-
_this.
|
|
30484
|
+
_this._countSubject.next(total);
|
|
30411
30485
|
return total;
|
|
30412
30486
|
}));
|
|
30413
30487
|
};
|
|
30414
|
-
AbstractUserEventService.prototype.
|
|
30488
|
+
AbstractUserEventService.prototype.listenAllChanges = function (filter, options) {
|
|
30415
30489
|
var _this = this;
|
|
30416
30490
|
var _a;
|
|
30417
|
-
if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.
|
|
30418
|
-
console.warn(this._logPrefix + "Subscription query '
|
|
30491
|
+
if (!((_a = this.subscriptions) === null || _a === void 0 ? void 0 : _a.listenAllChanges)) {
|
|
30492
|
+
console.warn(this._logPrefix + "Subscription query 'listenAllChanges' not provided, skip.");
|
|
30419
30493
|
return rxjs.of();
|
|
30420
30494
|
}
|
|
30421
30495
|
if (!filter)
|
|
@@ -30425,7 +30499,7 @@
|
|
|
30425
30499
|
if (this._debug)
|
|
30426
30500
|
console.debug(this._logPrefix + "[WS] Listening changes for user events with filter:", filter);
|
|
30427
30501
|
return this.graphql.subscribe({
|
|
30428
|
-
query: this.subscriptions.
|
|
30502
|
+
query: this.subscriptions.listenAllChanges,
|
|
30429
30503
|
fetchPolicy: options === null || options === void 0 ? void 0 : options.fetchPolicy,
|
|
30430
30504
|
variables: { filter: filter.asPodObject(), interval: toNumber(options === null || options === void 0 ? void 0 : options.interval, 10) },
|
|
30431
30505
|
error: {
|
|
@@ -30559,7 +30633,7 @@
|
|
|
30559
30633
|
});
|
|
30560
30634
|
});
|
|
30561
30635
|
};
|
|
30562
|
-
AbstractUserEventService.prototype.
|
|
30636
|
+
AbstractUserEventService.prototype.markAllAsRead = function (entities) {
|
|
30563
30637
|
return __awaiter(this, void 0, void 0, function () {
|
|
30564
30638
|
var userEventWithoutReadListeners, _loop_1, this_1, _b, _c, entity, e_1_1;
|
|
30565
30639
|
var e_1, _d;
|
|
@@ -30654,7 +30728,7 @@
|
|
|
30654
30728
|
this.listeners.push(listener);
|
|
30655
30729
|
};
|
|
30656
30730
|
AbstractUserEventService.prototype.resetCount = function () {
|
|
30657
|
-
this.
|
|
30731
|
+
this._countSubject.next(undefined);
|
|
30658
30732
|
this.resetCountDate = moment$6();
|
|
30659
30733
|
// restart listening count changes
|
|
30660
30734
|
this.startListenCountChanges();
|
|
@@ -30671,7 +30745,7 @@
|
|
|
30671
30745
|
if (this._debug)
|
|
30672
30746
|
console.debug(this._logPrefix + "Receiving user events count", count);
|
|
30673
30747
|
// Update count
|
|
30674
|
-
this.
|
|
30748
|
+
this._countSubject.next(count);
|
|
30675
30749
|
// Then listen changes
|
|
30676
30750
|
this.startListenCountChanges();
|
|
30677
30751
|
return [2 /*return*/];
|
|
@@ -30805,56 +30879,180 @@
|
|
|
30805
30879
|
]; };
|
|
30806
30880
|
|
|
30807
30881
|
var UserEventNotificationList = /** @class */ (function () {
|
|
30808
|
-
function UserEventNotificationList(cd, popoverController, userEventService) {
|
|
30882
|
+
function UserEventNotificationList(cd, popoverController, settings, userEventService) {
|
|
30883
|
+
var _a;
|
|
30809
30884
|
this.cd = cd;
|
|
30810
30885
|
this.popoverController = popoverController;
|
|
30886
|
+
this.settings = settings;
|
|
30811
30887
|
this.userEventService = userEventService;
|
|
30812
|
-
this.debug = false;
|
|
30813
|
-
this.userEvents = new rxjs.BehaviorSubject(undefined);
|
|
30814
30888
|
this.subscriptions = new rxjs.Subscription();
|
|
30889
|
+
this._fetchingMore = false;
|
|
30890
|
+
this.debug = false;
|
|
30891
|
+
this.pageSize = 10;
|
|
30892
|
+
this.sortBy = 'creationDate';
|
|
30893
|
+
this.sortDirection = 'desc';
|
|
30894
|
+
this.enableInfiniteScroll = true;
|
|
30895
|
+
this.$items = new rxjs.BehaviorSubject(undefined);
|
|
30896
|
+
this.$itemCount = new rxjs.BehaviorSubject(undefined);
|
|
30897
|
+
this.mobile = ((_a = this.settings) === null || _a === void 0 ? void 0 : _a.mobile) || false;
|
|
30815
30898
|
}
|
|
30899
|
+
Object.defineProperty(UserEventNotificationList.prototype, "canFetchMore", {
|
|
30900
|
+
get: function () {
|
|
30901
|
+
return this.enableInfiniteScroll && !!this._fetchMoreFn;
|
|
30902
|
+
},
|
|
30903
|
+
enumerable: false,
|
|
30904
|
+
configurable: true
|
|
30905
|
+
});
|
|
30816
30906
|
UserEventNotificationList.prototype.ngOnInit = function () {
|
|
30817
30907
|
var _this = this;
|
|
30818
30908
|
// Watch all user events
|
|
30819
|
-
|
|
30820
|
-
.
|
|
30821
|
-
|
|
30822
|
-
|
|
30823
|
-
|
|
30824
|
-
|
|
30825
|
-
|
|
30826
|
-
|
|
30827
|
-
|
|
30828
|
-
|
|
30829
|
-
|
|
30830
|
-
|
|
30831
|
-
|
|
30832
|
-
|
|
30909
|
+
if (this.userEventService) {
|
|
30910
|
+
this.subscriptions.add(this.userEventService
|
|
30911
|
+
.watchAll(0, this.pageSize, this.sortBy, this.sortDirection, this.filter)
|
|
30912
|
+
.subscribe(function (result) {
|
|
30913
|
+
var _a;
|
|
30914
|
+
if (_this.debug)
|
|
30915
|
+
console.debug("[user-event-notification-list] receiving " + result.total + " user events", result.data);
|
|
30916
|
+
_this.$items.next(result.data);
|
|
30917
|
+
_this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
30918
|
+
_this._fetchMoreFn = result.fetchMore;
|
|
30919
|
+
_this.markForCheck();
|
|
30920
|
+
}));
|
|
30921
|
+
// Listen changes
|
|
30922
|
+
this.subscriptions.add(this.userEventService.listenAllChanges(undefined)
|
|
30923
|
+
.subscribe(function (data) {
|
|
30924
|
+
if (_this.debug)
|
|
30925
|
+
console.debug("[user-event-notification-list] receiving " + data.length + " new user events", data);
|
|
30926
|
+
}));
|
|
30927
|
+
}
|
|
30833
30928
|
};
|
|
30834
30929
|
UserEventNotificationList.prototype.ngOnDestroy = function () {
|
|
30835
30930
|
this.subscriptions.unsubscribe();
|
|
30836
30931
|
};
|
|
30837
|
-
UserEventNotificationList.prototype.
|
|
30932
|
+
UserEventNotificationList.prototype.click = function (event, userEvent) {
|
|
30933
|
+
if (!userEvent)
|
|
30934
|
+
return; // Skip
|
|
30935
|
+
// MarkAsRead
|
|
30936
|
+
this.markAsRead(event, userEvent);
|
|
30937
|
+
// Get the default action (if any)
|
|
30938
|
+
var defaultAction = ((userEvent === null || userEvent === void 0 ? void 0 : userEvent.actions) || []).find(function (a) { return a.default; });
|
|
30939
|
+
if (defaultAction) {
|
|
30940
|
+
this.executeAction(event, defaultAction, userEvent);
|
|
30941
|
+
}
|
|
30942
|
+
};
|
|
30943
|
+
UserEventNotificationList.prototype.isDefaultAction = function (action) {
|
|
30944
|
+
return action && action.default || false;
|
|
30945
|
+
};
|
|
30946
|
+
UserEventNotificationList.prototype.markAsRead = function (event, userEvent) {
|
|
30838
30947
|
var _a;
|
|
30839
30948
|
if (userEvent === null || userEvent === void 0 ? void 0 : userEvent.readDate)
|
|
30840
30949
|
return;
|
|
30841
30950
|
(_a = this.readEvent) === null || _a === void 0 ? void 0 : _a.emit(userEvent);
|
|
30842
30951
|
};
|
|
30843
|
-
UserEventNotificationList.prototype.
|
|
30952
|
+
UserEventNotificationList.prototype.markAllAsRead = function (event) {
|
|
30844
30953
|
var _a;
|
|
30845
|
-
var unreadUserEvents = (this.
|
|
30954
|
+
var unreadUserEvents = (this.$items.value || []).filter(function (value) { return !value.readDate; });
|
|
30846
30955
|
if (!unreadUserEvents.length)
|
|
30847
30956
|
return;
|
|
30848
30957
|
(_a = this.readEvents) === null || _a === void 0 ? void 0 : _a.emit(unreadUserEvents);
|
|
30849
30958
|
};
|
|
30850
|
-
UserEventNotificationList.prototype.executeAction = function (action, userEvent) {
|
|
30851
|
-
|
|
30852
|
-
|
|
30853
|
-
|
|
30959
|
+
UserEventNotificationList.prototype.executeAction = function (event, action, userEvent) {
|
|
30960
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30961
|
+
var res, err_1;
|
|
30962
|
+
return __generator(this, function (_b) {
|
|
30963
|
+
switch (_b.label) {
|
|
30964
|
+
case 0:
|
|
30965
|
+
if (event === null || event === void 0 ? void 0 : event.defaultPrevented)
|
|
30966
|
+
return [2 /*return*/]; // Skip if prevented
|
|
30967
|
+
// Disable default action (.e.g avoid to call click() function)
|
|
30968
|
+
if (event)
|
|
30969
|
+
event.preventDefault();
|
|
30970
|
+
_b.label = 1;
|
|
30971
|
+
case 1:
|
|
30972
|
+
_b.trys.push([1, 4, , 5]);
|
|
30973
|
+
res = action.executeAction(userEvent);
|
|
30974
|
+
this.dismiss();
|
|
30975
|
+
if (!(res instanceof Promise)) return [3 /*break*/, 3];
|
|
30976
|
+
return [4 /*yield*/, res];
|
|
30977
|
+
case 2:
|
|
30978
|
+
_b.sent();
|
|
30979
|
+
_b.label = 3;
|
|
30980
|
+
case 3: return [3 /*break*/, 5];
|
|
30981
|
+
case 4:
|
|
30982
|
+
err_1 = _b.sent();
|
|
30983
|
+
console.error(err_1);
|
|
30984
|
+
return [3 /*break*/, 5];
|
|
30985
|
+
case 5: return [2 /*return*/];
|
|
30986
|
+
}
|
|
30987
|
+
});
|
|
30988
|
+
});
|
|
30854
30989
|
};
|
|
30855
30990
|
UserEventNotificationList.prototype.dismiss = function () {
|
|
30856
30991
|
this.popoverController.dismiss();
|
|
30857
30992
|
};
|
|
30993
|
+
UserEventNotificationList.prototype.fetchMore = function (event) {
|
|
30994
|
+
var _a;
|
|
30995
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
30996
|
+
var result, data, err_2;
|
|
30997
|
+
return __generator(this, function (_b) {
|
|
30998
|
+
switch (_b.label) {
|
|
30999
|
+
case 0:
|
|
31000
|
+
if (!this._fetchMoreFn || this._fetchingMore)
|
|
31001
|
+
return [2 /*return*/];
|
|
31002
|
+
console.debug('[user-event-notification-list] Fetching more notifications...', event);
|
|
31003
|
+
this._fetchingMore = true;
|
|
31004
|
+
_b.label = 1;
|
|
31005
|
+
case 1:
|
|
31006
|
+
_b.trys.push([1, 3, 4, 5]);
|
|
31007
|
+
return [4 /*yield*/, this._fetchMoreFn()];
|
|
31008
|
+
case 2:
|
|
31009
|
+
result = _b.sent();
|
|
31010
|
+
data = __spread((this.$items.value || []), result.data);
|
|
31011
|
+
// Remove duplication (e.g. when new user event was added by subscription)
|
|
31012
|
+
data = removeDuplicatesFromArray(data, 'id');
|
|
31013
|
+
this.$items.next(data);
|
|
31014
|
+
this.$itemCount.next(result.total || ((_a = result.data) === null || _a === void 0 ? void 0 : _a.length) || 0);
|
|
31015
|
+
this._fetchMoreFn = result.fetchMore;
|
|
31016
|
+
return [3 /*break*/, 5];
|
|
31017
|
+
case 3:
|
|
31018
|
+
err_2 = _b.sent();
|
|
31019
|
+
console.error(err_2);
|
|
31020
|
+
this._fetchMoreFn = undefined;
|
|
31021
|
+
return [3 /*break*/, 5];
|
|
31022
|
+
case 4:
|
|
31023
|
+
this.markForCheck();
|
|
31024
|
+
this._fetchingMore = false;
|
|
31025
|
+
return [7 /*endfinally*/];
|
|
31026
|
+
case 5: return [2 /*return*/];
|
|
31027
|
+
}
|
|
31028
|
+
});
|
|
31029
|
+
});
|
|
31030
|
+
};
|
|
31031
|
+
UserEventNotificationList.prototype._initInfiniteScroll = function (threshold) {
|
|
31032
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
31033
|
+
var panel;
|
|
31034
|
+
var _this = this;
|
|
31035
|
+
return __generator(this, function (_b) {
|
|
31036
|
+
switch (_b.label) {
|
|
31037
|
+
case 0:
|
|
31038
|
+
if (this._fetchMoreSubscription)
|
|
31039
|
+
this._fetchMoreSubscription.unsubscribe();
|
|
31040
|
+
threshold = threshold || (this.mobile ? '15%' : '2%');
|
|
31041
|
+
return [4 /*yield*/, waitFor(function () { return !!_this.ionContent; })];
|
|
31042
|
+
case 1:
|
|
31043
|
+
_b.sent();
|
|
31044
|
+
return [4 /*yield*/, this.ionContent.getScrollElement()];
|
|
31045
|
+
case 2:
|
|
31046
|
+
panel = _b.sent();
|
|
31047
|
+
// Trigger fetch more, end end scroll reached
|
|
31048
|
+
this._fetchMoreSubscription = fromScrollEndEvent(panel, threshold, 250 /*force to check when no scrollbar - e.g. in large screen*/)
|
|
31049
|
+
.subscribe(function () { return _this.fetchMore(); });
|
|
31050
|
+
this.subscriptions.add(this._fetchMoreSubscription);
|
|
31051
|
+
return [2 /*return*/];
|
|
31052
|
+
}
|
|
31053
|
+
});
|
|
31054
|
+
});
|
|
31055
|
+
};
|
|
30858
31056
|
UserEventNotificationList.prototype.markForCheck = function () {
|
|
30859
31057
|
this.cd.markForCheck();
|
|
30860
31058
|
};
|
|
@@ -30863,48 +31061,61 @@
|
|
|
30863
31061
|
UserEventNotificationList.decorators = [
|
|
30864
31062
|
{ type: i0.Component, args: [{
|
|
30865
31063
|
selector: 'app-user-event-notification-list',
|
|
30866
|
-
template: "
|
|
31064
|
+
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\"\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 <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 <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",
|
|
30867
31065
|
changeDetection: i0.ChangeDetectionStrategy.OnPush,
|
|
30868
|
-
styles: [":host(.popover-viewport){overflow-y:auto;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.
|
|
31066
|
+
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}"]
|
|
30869
31067
|
},] }
|
|
30870
31068
|
];
|
|
30871
31069
|
UserEventNotificationList.ctorParameters = function () { return [
|
|
30872
31070
|
{ type: i0.ChangeDetectorRef },
|
|
30873
31071
|
{ type: i1$5.PopoverController },
|
|
31072
|
+
{ type: LocalSettingsService, decorators: [{ type: i0.Optional }] },
|
|
30874
31073
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] }
|
|
30875
31074
|
]; };
|
|
30876
31075
|
UserEventNotificationList.propDecorators = {
|
|
30877
31076
|
debug: [{ type: i0.Input }],
|
|
31077
|
+
mobile: [{ type: i0.Input }],
|
|
30878
31078
|
titleI18n: [{ type: i0.Input }],
|
|
31079
|
+
pageSize: [{ type: i0.Input }],
|
|
31080
|
+
sortBy: [{ type: i0.Input }],
|
|
31081
|
+
sortDirection: [{ type: i0.Input }],
|
|
31082
|
+
filter: [{ type: i0.Input }],
|
|
31083
|
+
enableInfiniteScroll: [{ type: i0.Input }],
|
|
30879
31084
|
readEvent: [{ type: i0.Output }],
|
|
30880
|
-
readEvents: [{ type: i0.Output }]
|
|
31085
|
+
readEvents: [{ type: i0.Output }],
|
|
31086
|
+
ionContent: [{ type: i0.ViewChild, args: [i1$5.IonContent,] }],
|
|
31087
|
+
ionItems: [{ type: i0.ViewChildren, args: [i1$5.IonItem,] }]
|
|
30881
31088
|
};
|
|
30882
31089
|
|
|
30883
|
-
var
|
|
30884
|
-
function
|
|
31090
|
+
var AppUserEventNotificationIcon = /** @class */ (function () {
|
|
31091
|
+
function AppUserEventNotificationIcon(userEventService, accountService, popoverController) {
|
|
30885
31092
|
this.userEventService = userEventService;
|
|
30886
31093
|
this.accountService = accountService;
|
|
30887
31094
|
this.popoverController = popoverController;
|
|
30888
31095
|
this.debug = false;
|
|
30889
31096
|
this.titleI18n = 'SOCIAL.USER_EVENT.NOTIFICATION.TITLE';
|
|
30890
31097
|
this.disabled = false;
|
|
31098
|
+
this.filter = null;
|
|
30891
31099
|
this._logPrefix = '[user-event-notification] ';
|
|
30892
31100
|
this._readEvent = new i0.EventEmitter();
|
|
30893
31101
|
this._readEvents = new i0.EventEmitter();
|
|
30894
31102
|
}
|
|
30895
|
-
Object.defineProperty(
|
|
31103
|
+
Object.defineProperty(AppUserEventNotificationIcon.prototype, "countChanges", {
|
|
30896
31104
|
get: function () {
|
|
30897
|
-
|
|
30898
|
-
|
|
31105
|
+
if (!this.userEventService)
|
|
31106
|
+
return rxjs.of();
|
|
31107
|
+
return this.userEventService
|
|
31108
|
+
.countSubject
|
|
31109
|
+
.pipe(operators.map(function (value) { return value === 0 ? undefined : value; }));
|
|
30899
31110
|
},
|
|
30900
31111
|
enumerable: false,
|
|
30901
31112
|
configurable: true
|
|
30902
31113
|
});
|
|
30903
|
-
|
|
31114
|
+
AppUserEventNotificationIcon.prototype.ngOnInit = function () {
|
|
30904
31115
|
return __awaiter(this, void 0, void 0, function () {
|
|
30905
31116
|
var _this = this;
|
|
30906
|
-
return __generator(this, function (
|
|
30907
|
-
switch (
|
|
31117
|
+
return __generator(this, function (_a) {
|
|
31118
|
+
switch (_a.label) {
|
|
30908
31119
|
case 0:
|
|
30909
31120
|
if (isNil(this.userEventService)) {
|
|
30910
31121
|
console.warn(this._logPrefix + "No service injected");
|
|
@@ -30915,25 +31126,25 @@
|
|
|
30915
31126
|
return [4 /*yield*/, this.userEventService.ready()];
|
|
30916
31127
|
case 1:
|
|
30917
31128
|
// Wait service
|
|
30918
|
-
|
|
31129
|
+
_a.sent();
|
|
30919
31130
|
// Subscribe to read event
|
|
30920
|
-
this._readEvent.subscribe(function (
|
|
31131
|
+
this._readEvent.subscribe(function (item) {
|
|
30921
31132
|
// default: mark event as read
|
|
30922
|
-
_this.userEventService.
|
|
31133
|
+
_this.userEventService.markAllAsRead([item]);
|
|
30923
31134
|
});
|
|
30924
|
-
this._readEvents.subscribe(function (
|
|
30925
|
-
_this.userEventService.
|
|
31135
|
+
this._readEvents.subscribe(function (items) {
|
|
31136
|
+
_this.userEventService.markAllAsRead(items);
|
|
30926
31137
|
});
|
|
30927
31138
|
return [2 /*return*/];
|
|
30928
31139
|
}
|
|
30929
31140
|
});
|
|
30930
31141
|
});
|
|
30931
31142
|
};
|
|
30932
|
-
|
|
31143
|
+
AppUserEventNotificationIcon.prototype.showList = function (event) {
|
|
30933
31144
|
return __awaiter(this, void 0, void 0, function () {
|
|
30934
31145
|
var popover;
|
|
30935
|
-
return __generator(this, function (
|
|
30936
|
-
switch (
|
|
31146
|
+
return __generator(this, function (_a) {
|
|
31147
|
+
switch (_a.label) {
|
|
30937
31148
|
case 0:
|
|
30938
31149
|
// Reset count
|
|
30939
31150
|
this.userEventService.resetCount();
|
|
@@ -30949,42 +31160,42 @@
|
|
|
30949
31160
|
keyboardClose: true,
|
|
30950
31161
|
event: event,
|
|
30951
31162
|
translucent: true,
|
|
30952
|
-
cssClass: 'popover-large'
|
|
31163
|
+
cssClass: 'popover-large popover-notifications'
|
|
30953
31164
|
})];
|
|
30954
31165
|
case 1:
|
|
30955
|
-
popover =
|
|
31166
|
+
popover = _a.sent();
|
|
30956
31167
|
return [4 /*yield*/, popover.present()];
|
|
30957
31168
|
case 2:
|
|
30958
|
-
|
|
31169
|
+
_a.sent();
|
|
30959
31170
|
return [2 /*return*/];
|
|
30960
31171
|
}
|
|
30961
31172
|
});
|
|
30962
31173
|
});
|
|
30963
31174
|
};
|
|
30964
|
-
|
|
31175
|
+
AppUserEventNotificationIcon.prototype.ngOnDestroy = function () {
|
|
30965
31176
|
if (this.debug) {
|
|
30966
31177
|
console.debug(this._logPrefix + "Destroying");
|
|
30967
31178
|
}
|
|
30968
31179
|
};
|
|
30969
|
-
return
|
|
31180
|
+
return AppUserEventNotificationIcon;
|
|
30970
31181
|
}());
|
|
30971
|
-
|
|
31182
|
+
AppUserEventNotificationIcon.decorators = [
|
|
30972
31183
|
{ type: i0.Component, args: [{
|
|
30973
|
-
selector: 'app-user-event-notification-
|
|
30974
|
-
template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"
|
|
30975
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
30976
|
-
styles: [""]
|
|
31184
|
+
selector: 'app-user-event-notification-icon',
|
|
31185
|
+
template: "<button\n #button\n mat-icon-button\n [title]=\"titleI18n | translate\"\n [disabled]=\"disabled\"\n (click)=\"showList($event)\"\n>\n <mat-icon\n [matBadge]=\"countChanges | async\"\n matBadgeColor=\"accent\"\n matBadgeSize=\"small\"\n matBadgePosition=\"above after\"\n >notifications\n </mat-icon>\n</button>\n\n",
|
|
31186
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
30977
31187
|
},] }
|
|
30978
31188
|
];
|
|
30979
|
-
|
|
31189
|
+
AppUserEventNotificationIcon.ctorParameters = function () { return [
|
|
30980
31190
|
{ type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
|
|
30981
31191
|
{ type: AccountService },
|
|
30982
31192
|
{ type: i1$5.PopoverController }
|
|
30983
31193
|
]; };
|
|
30984
|
-
|
|
31194
|
+
AppUserEventNotificationIcon.propDecorators = {
|
|
30985
31195
|
debug: [{ type: i0.Input }],
|
|
30986
31196
|
titleI18n: [{ type: i0.Input }],
|
|
30987
|
-
disabled: [{ type: i0.Input }]
|
|
31197
|
+
disabled: [{ type: i0.Input }],
|
|
31198
|
+
filter: [{ type: i0.Input }]
|
|
30988
31199
|
};
|
|
30989
31200
|
|
|
30990
31201
|
var UserEventModule = /** @class */ (function () {
|
|
@@ -31000,11 +31211,11 @@
|
|
|
31000
31211
|
AppIconModule
|
|
31001
31212
|
],
|
|
31002
31213
|
declarations: [
|
|
31003
|
-
|
|
31214
|
+
AppUserEventNotificationIcon,
|
|
31004
31215
|
UserEventNotificationList
|
|
31005
31216
|
],
|
|
31006
31217
|
exports: [
|
|
31007
|
-
|
|
31218
|
+
AppUserEventNotificationIcon
|
|
31008
31219
|
]
|
|
31009
31220
|
},] }
|
|
31010
31221
|
];
|
|
@@ -31603,6 +31814,11 @@
|
|
|
31603
31814
|
JobModule,
|
|
31604
31815
|
MessageModule
|
|
31605
31816
|
],
|
|
31817
|
+
exports: [
|
|
31818
|
+
UserEventModule,
|
|
31819
|
+
JobModule,
|
|
31820
|
+
MessageModule
|
|
31821
|
+
]
|
|
31606
31822
|
},] }
|
|
31607
31823
|
];
|
|
31608
31824
|
|
|
@@ -33842,6 +34058,463 @@
|
|
|
33842
34058
|
},] }
|
|
33843
34059
|
];
|
|
33844
34060
|
|
|
34061
|
+
var JobProgressionTestService = /** @class */ (function () {
|
|
34062
|
+
function JobProgressionTestService() {
|
|
34063
|
+
}
|
|
34064
|
+
JobProgressionTestService.prototype.listenChanges = function (id, options) {
|
|
34065
|
+
return rxjs.interval(100).pipe(operators.take(111), operators.map(function (value) {
|
|
34066
|
+
if (value <= 10) {
|
|
34067
|
+
return {
|
|
34068
|
+
id: id,
|
|
34069
|
+
name: "Job #" + id,
|
|
34070
|
+
current: 0,
|
|
34071
|
+
total: 0,
|
|
34072
|
+
message: "Progression pending"
|
|
34073
|
+
};
|
|
34074
|
+
}
|
|
34075
|
+
value = value - 10;
|
|
34076
|
+
return {
|
|
34077
|
+
id: id,
|
|
34078
|
+
name: "Job #" + id,
|
|
34079
|
+
current: value,
|
|
34080
|
+
total: 100,
|
|
34081
|
+
message: "Progression " + value + "/100"
|
|
34082
|
+
};
|
|
34083
|
+
}));
|
|
34084
|
+
};
|
|
34085
|
+
return JobProgressionTestService;
|
|
34086
|
+
}());
|
|
34087
|
+
JobProgressionTestService.decorators = [
|
|
34088
|
+
{ type: i0.Injectable }
|
|
34089
|
+
];
|
|
34090
|
+
|
|
34091
|
+
var JobProgressionTestingPage = /** @class */ (function () {
|
|
34092
|
+
function JobProgressionTestingPage() {
|
|
34093
|
+
this.nJob = 0;
|
|
34094
|
+
this.options = {
|
|
34095
|
+
autoHide: true
|
|
34096
|
+
};
|
|
34097
|
+
this.job = new exports.JobProgression();
|
|
34098
|
+
this.job.id = 0;
|
|
34099
|
+
this.job.name = 'test';
|
|
34100
|
+
this.job.current = 0;
|
|
34101
|
+
this.job.total = 100;
|
|
34102
|
+
}
|
|
34103
|
+
JobProgressionTestingPage.prototype.incrementJob = function (value) {
|
|
34104
|
+
this.job.current = Math.max(0, this.job.current + value);
|
|
34105
|
+
this.job.message = "Fake progression (very long message very long message very long message very long message) " + this.job.current + "/100";
|
|
34106
|
+
if (this.job.current > this.job.total) {
|
|
34107
|
+
this.jobProgression.removeJob(0);
|
|
34108
|
+
this.job.current = 0;
|
|
34109
|
+
}
|
|
34110
|
+
else if (!this.jobProgression.getProgression(0)) {
|
|
34111
|
+
this.jobProgression.jobProgressions.push(this.job);
|
|
34112
|
+
}
|
|
34113
|
+
this.jobProgression.updateValue();
|
|
34114
|
+
};
|
|
34115
|
+
JobProgressionTestingPage.prototype.addJob = function () {
|
|
34116
|
+
// Add fake job
|
|
34117
|
+
this.nJob++;
|
|
34118
|
+
this.jobProgression.addJob(this.nJob);
|
|
34119
|
+
};
|
|
34120
|
+
return JobProgressionTestingPage;
|
|
34121
|
+
}());
|
|
34122
|
+
JobProgressionTestingPage.decorators = [
|
|
34123
|
+
{ type: i0.Component, args: [{
|
|
34124
|
+
selector: 'job-progression-testing',
|
|
34125
|
+
template: "<ion-toolbar color=\"primary\">\n <ion-title>Job progression</ion-title>\n</ion-toolbar>\n\n<ion-content class=\"ion-padding\">\n\n <app-job-progression #jobProgression [debug]=\"true\" [options]=\"options\" ></app-job-progression>\n\n <p>\n <ion-button (click)=\"incrementJob(10)\">\n +10\n </ion-button>\n <ion-button (click)=\"incrementJob(-10)\">\n -10\n </ion-button>\n </p>\n <p>\n <ion-button (click)=\"addJob()\">Add Job</ion-button>\n </p>\n</ion-content>\n",
|
|
34126
|
+
providers: [
|
|
34127
|
+
{ provide: JobProgressionServiceToken, useClass: JobProgressionTestService }
|
|
34128
|
+
]
|
|
34129
|
+
},] }
|
|
34130
|
+
];
|
|
34131
|
+
JobProgressionTestingPage.ctorParameters = function () { return []; };
|
|
34132
|
+
JobProgressionTestingPage.propDecorators = {
|
|
34133
|
+
jobProgression: [{ type: i0.ViewChild, args: ['jobProgression',] }]
|
|
34134
|
+
};
|
|
34135
|
+
|
|
34136
|
+
var JobTestingModule = /** @class */ (function () {
|
|
34137
|
+
function JobTestingModule() {
|
|
34138
|
+
}
|
|
34139
|
+
return JobTestingModule;
|
|
34140
|
+
}());
|
|
34141
|
+
JobTestingModule.decorators = [
|
|
34142
|
+
{ type: i0.NgModule, args: [{
|
|
34143
|
+
imports: [
|
|
34144
|
+
i1$4.CommonModule,
|
|
34145
|
+
i1$2.TranslateModule.forChild(),
|
|
34146
|
+
SharedModule,
|
|
34147
|
+
JobModule
|
|
34148
|
+
],
|
|
34149
|
+
declarations: [
|
|
34150
|
+
JobProgressionTestingPage
|
|
34151
|
+
],
|
|
34152
|
+
exports: [
|
|
34153
|
+
JobProgressionTestingPage
|
|
34154
|
+
]
|
|
34155
|
+
},] }
|
|
34156
|
+
];
|
|
34157
|
+
|
|
34158
|
+
var UserEventTestService = /** @class */ (function (_super) {
|
|
34159
|
+
__extends(UserEventTestService, _super);
|
|
34160
|
+
function UserEventTestService(graphql, accountService, network, translate, environment) {
|
|
34161
|
+
var _this = _super.call(this, graphql, accountService, network, translate, {
|
|
34162
|
+
queries: {
|
|
34163
|
+
loadAll: null,
|
|
34164
|
+
loadAllWithContent: null
|
|
34165
|
+
},
|
|
34166
|
+
production: environment === null || environment === void 0 ? void 0 : environment.production
|
|
34167
|
+
}) || this;
|
|
34168
|
+
_this.graphql = graphql;
|
|
34169
|
+
_this.accountService = accountService;
|
|
34170
|
+
_this.network = network;
|
|
34171
|
+
_this.translate = translate;
|
|
34172
|
+
_this.environment = environment;
|
|
34173
|
+
_this.userEvents = [];
|
|
34174
|
+
return _this;
|
|
34175
|
+
}
|
|
34176
|
+
UserEventTestService.prototype.fromObject = function (source) {
|
|
34177
|
+
return exports.UserEvent.fromObject(source);
|
|
34178
|
+
};
|
|
34179
|
+
UserEventTestService.prototype.add = function (entity) {
|
|
34180
|
+
entity = this.processUserEvent(entity);
|
|
34181
|
+
entity.id = this.userEvents.length + 1;
|
|
34182
|
+
this.userEvents = __spread([
|
|
34183
|
+
entity
|
|
34184
|
+
], this.userEvents);
|
|
34185
|
+
this._countSubject.next((this._countSubject.value || 0) + 1);
|
|
34186
|
+
};
|
|
34187
|
+
UserEventTestService.prototype.asFilter = function (filter) {
|
|
34188
|
+
return filter;
|
|
34189
|
+
};
|
|
34190
|
+
UserEventTestService.prototype.count = function (filter, options) {
|
|
34191
|
+
return Promise.resolve(this.userEvents.length);
|
|
34192
|
+
};
|
|
34193
|
+
UserEventTestService.prototype.delete = function (entity) {
|
|
34194
|
+
return Promise.resolve(undefined);
|
|
34195
|
+
};
|
|
34196
|
+
UserEventTestService.prototype.deleteAll = function (data, opts) {
|
|
34197
|
+
return Promise.resolve(undefined);
|
|
34198
|
+
};
|
|
34199
|
+
UserEventTestService.prototype.listenAllChanges = function (filter, options) {
|
|
34200
|
+
return rxjs.of();
|
|
34201
|
+
};
|
|
34202
|
+
UserEventTestService.prototype.save = function (entity, options) {
|
|
34203
|
+
var _a;
|
|
34204
|
+
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); });
|
|
34205
|
+
Object.assign(toSave, entity);
|
|
34206
|
+
return entity;
|
|
34207
|
+
};
|
|
34208
|
+
UserEventTestService.prototype.saveAll = function (data, opts) {
|
|
34209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
34210
|
+
var _b, _c, entity, e_1_1;
|
|
34211
|
+
var e_1, _d;
|
|
34212
|
+
return __generator(this, function (_e) {
|
|
34213
|
+
switch (_e.label) {
|
|
34214
|
+
case 0:
|
|
34215
|
+
_e.trys.push([0, 5, 6, 7]);
|
|
34216
|
+
_b = __values((data || [])), _c = _b.next();
|
|
34217
|
+
_e.label = 1;
|
|
34218
|
+
case 1:
|
|
34219
|
+
if (!!_c.done) return [3 /*break*/, 4];
|
|
34220
|
+
entity = _c.value;
|
|
34221
|
+
return [4 /*yield*/, this.save(entity)];
|
|
34222
|
+
case 2:
|
|
34223
|
+
_e.sent();
|
|
34224
|
+
_e.label = 3;
|
|
34225
|
+
case 3:
|
|
34226
|
+
_c = _b.next();
|
|
34227
|
+
return [3 /*break*/, 1];
|
|
34228
|
+
case 4: return [3 /*break*/, 7];
|
|
34229
|
+
case 5:
|
|
34230
|
+
e_1_1 = _e.sent();
|
|
34231
|
+
e_1 = { error: e_1_1 };
|
|
34232
|
+
return [3 /*break*/, 7];
|
|
34233
|
+
case 6:
|
|
34234
|
+
try {
|
|
34235
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
34236
|
+
}
|
|
34237
|
+
finally { if (e_1) throw e_1.error; }
|
|
34238
|
+
return [7 /*endfinally*/];
|
|
34239
|
+
case 7: return [2 /*return*/, Promise.resolve(this.userEvents)];
|
|
34240
|
+
}
|
|
34241
|
+
});
|
|
34242
|
+
});
|
|
34243
|
+
};
|
|
34244
|
+
UserEventTestService.prototype.watchAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34245
|
+
var _this = this;
|
|
34246
|
+
var _a;
|
|
34247
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34248
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34249
|
+
var res = { data: data, total: total };
|
|
34250
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34251
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34252
|
+
// Add fetch more
|
|
34253
|
+
var nextOffset = offset + data.length;
|
|
34254
|
+
if (nextOffset < res.total) {
|
|
34255
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34256
|
+
}
|
|
34257
|
+
return rxjs.of(res);
|
|
34258
|
+
};
|
|
34259
|
+
UserEventTestService.prototype.loadAll = function (offset, size, sortBy, sortDirection, filter, opts) {
|
|
34260
|
+
var _this = this;
|
|
34261
|
+
var _a;
|
|
34262
|
+
var data = (this.userEvents || []).slice(offset || 0, offset + size);
|
|
34263
|
+
var total = ((_a = this.userEvents) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
34264
|
+
var res = { data: data, total: total };
|
|
34265
|
+
// Must re-order because of listenChanges result will add new event at the end
|
|
34266
|
+
data = EntityUtils.sort(data, sortBy, sortDirection);
|
|
34267
|
+
// Add fetch more
|
|
34268
|
+
var nextOffset = offset + data.length;
|
|
34269
|
+
if (nextOffset < res.total) {
|
|
34270
|
+
res.fetchMore = function (_) { return _this.loadAll(nextOffset, size, sortBy, sortDirection, filter, Object.assign(Object.assign({}, opts), { fetchPolicy: 'no-cache' })); };
|
|
34271
|
+
}
|
|
34272
|
+
return Promise.resolve(res);
|
|
34273
|
+
};
|
|
34274
|
+
return UserEventTestService;
|
|
34275
|
+
}(AbstractUserEventService));
|
|
34276
|
+
UserEventTestService.decorators = [
|
|
34277
|
+
{ type: i0.Injectable }
|
|
34278
|
+
];
|
|
34279
|
+
UserEventTestService.ctorParameters = function () { return [
|
|
34280
|
+
{ type: GraphqlService },
|
|
34281
|
+
{ type: AccountService },
|
|
34282
|
+
{ type: NetworkService },
|
|
34283
|
+
{ type: i1$2.TranslateService },
|
|
34284
|
+
{ type: Environment, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [ENVIRONMENT,] }] }
|
|
34285
|
+
]; };
|
|
34286
|
+
|
|
34287
|
+
var moment$a = momentImported__namespace;
|
|
34288
|
+
var UserEventTestingPage = /** @class */ (function () {
|
|
34289
|
+
function UserEventTestingPage(userEventService, router, alertController, translateService) {
|
|
34290
|
+
var _this = this;
|
|
34291
|
+
this.userEventService = userEventService;
|
|
34292
|
+
this.router = router;
|
|
34293
|
+
this.alertController = alertController;
|
|
34294
|
+
this.translateService = translateService;
|
|
34295
|
+
userEventService.registerListener({
|
|
34296
|
+
accept: function (userEvent) { return true; },
|
|
34297
|
+
onReceived: function (userEvent) {
|
|
34298
|
+
_this.customize(userEvent);
|
|
34299
|
+
return userEvent;
|
|
34300
|
+
}
|
|
34301
|
+
});
|
|
34302
|
+
userEventService.registerListener({
|
|
34303
|
+
accept: function (userEvent) { return userEvent.level == "DEBUG"; },
|
|
34304
|
+
onRead: function (userEvent) { _this.showMessage("debug message read "); }
|
|
34305
|
+
});
|
|
34306
|
+
}
|
|
34307
|
+
UserEventTestingPage.prototype.customize = function (userEvent) {
|
|
34308
|
+
// Choose avatarIcon
|
|
34309
|
+
switch (userEvent.level) {
|
|
34310
|
+
case 'ERROR':
|
|
34311
|
+
userEvent.avatarIcon = { icon: 'close-outline', color: 'danger' };
|
|
34312
|
+
break;
|
|
34313
|
+
case 'WARNING':
|
|
34314
|
+
userEvent.avatarIcon = { icon: 'warning-outline', color: 'warning' };
|
|
34315
|
+
break;
|
|
34316
|
+
case 'INFO':
|
|
34317
|
+
userEvent.avatarIcon = { icon: 'information-circle-outline' };
|
|
34318
|
+
break;
|
|
34319
|
+
case 'DEBUG':
|
|
34320
|
+
userEvent.avatarIcon = { icon: 'cog', color: "medium" };
|
|
34321
|
+
break;
|
|
34322
|
+
}
|
|
34323
|
+
// Choose icon
|
|
34324
|
+
switch (userEvent.type) {
|
|
34325
|
+
case 'message':
|
|
34326
|
+
userEvent.icon = { matIcon: 'inbox', color: 'accent' };
|
|
34327
|
+
break;
|
|
34328
|
+
case 'upload':
|
|
34329
|
+
userEvent.icon = { matIcon: 'file_upload' };
|
|
34330
|
+
break;
|
|
34331
|
+
case 'download':
|
|
34332
|
+
userEvent.icon = { matIcon: 'file_download' };
|
|
34333
|
+
break;
|
|
34334
|
+
}
|
|
34335
|
+
};
|
|
34336
|
+
UserEventTestingPage.prototype.addNotification = function () {
|
|
34337
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34338
|
+
issuer: 'system',
|
|
34339
|
+
recipient: 'me',
|
|
34340
|
+
type: 'message',
|
|
34341
|
+
level: 'INFO',
|
|
34342
|
+
message: 'message test message test message test message test message test message test message test message test',
|
|
34343
|
+
creationDate: moment$a(),
|
|
34344
|
+
}));
|
|
34345
|
+
};
|
|
34346
|
+
UserEventTestingPage.prototype.addError = function () {
|
|
34347
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34348
|
+
issuer: 'system',
|
|
34349
|
+
recipient: 'me',
|
|
34350
|
+
type: 'upload',
|
|
34351
|
+
level: 'ERROR',
|
|
34352
|
+
message: 'message error',
|
|
34353
|
+
creationDate: moment$a(),
|
|
34354
|
+
}));
|
|
34355
|
+
};
|
|
34356
|
+
UserEventTestingPage.prototype.addWarning = function () {
|
|
34357
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34358
|
+
issuer: 'system',
|
|
34359
|
+
recipient: 'me',
|
|
34360
|
+
type: 'download',
|
|
34361
|
+
level: 'WARNING',
|
|
34362
|
+
message: 'message warning',
|
|
34363
|
+
creationDate: moment$a(),
|
|
34364
|
+
}));
|
|
34365
|
+
};
|
|
34366
|
+
UserEventTestingPage.prototype.addDebug = function () {
|
|
34367
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34368
|
+
issuer: 'system',
|
|
34369
|
+
recipient: 'me',
|
|
34370
|
+
type: 'debug',
|
|
34371
|
+
level: 'DEBUG',
|
|
34372
|
+
message: 'message DEBUG',
|
|
34373
|
+
creationDate: moment$a(),
|
|
34374
|
+
}));
|
|
34375
|
+
};
|
|
34376
|
+
UserEventTestingPage.prototype.addNotificationWithLink = function () {
|
|
34377
|
+
var _this = this;
|
|
34378
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34379
|
+
issuer: 'system',
|
|
34380
|
+
recipient: 'me',
|
|
34381
|
+
type: 'message',
|
|
34382
|
+
level: 'INFO',
|
|
34383
|
+
message: 'message with link',
|
|
34384
|
+
creationDate: moment$a(),
|
|
34385
|
+
actions: [{
|
|
34386
|
+
name: 'click here',
|
|
34387
|
+
iconRef: {
|
|
34388
|
+
icon: 'arrow-forward-outline'
|
|
34389
|
+
},
|
|
34390
|
+
executeAction: function (event) { _this.router.navigateByUrl('/'); }
|
|
34391
|
+
}]
|
|
34392
|
+
}));
|
|
34393
|
+
};
|
|
34394
|
+
UserEventTestingPage.prototype.addNotificationWithAction = function () {
|
|
34395
|
+
var _this = this;
|
|
34396
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34397
|
+
issuer: 'system',
|
|
34398
|
+
recipient: 'me',
|
|
34399
|
+
type: 'message',
|
|
34400
|
+
level: 'INFO',
|
|
34401
|
+
message: 'message with action',
|
|
34402
|
+
creationDate: moment$a(),
|
|
34403
|
+
actions: [
|
|
34404
|
+
{
|
|
34405
|
+
name: 'click here',
|
|
34406
|
+
iconRef: {
|
|
34407
|
+
icon: 'arrow-forward-outline',
|
|
34408
|
+
color: 'warning'
|
|
34409
|
+
},
|
|
34410
|
+
executeAction: function (event) { _this.showMessage('action 1'); }
|
|
34411
|
+
},
|
|
34412
|
+
{
|
|
34413
|
+
name: 'click here 2',
|
|
34414
|
+
iconRef: {
|
|
34415
|
+
matIcon: 'settings_applications',
|
|
34416
|
+
color: 'secondary'
|
|
34417
|
+
},
|
|
34418
|
+
executeAction: function (event) { _this.showMessage('action 2'); }
|
|
34419
|
+
}
|
|
34420
|
+
]
|
|
34421
|
+
}));
|
|
34422
|
+
};
|
|
34423
|
+
UserEventTestingPage.prototype.addNotificationWithDefaultAction = function () {
|
|
34424
|
+
var _this = this;
|
|
34425
|
+
this.userEventService.add(exports.UserEvent.fromObject({
|
|
34426
|
+
issuer: 'system',
|
|
34427
|
+
recipient: 'me',
|
|
34428
|
+
type: 'message',
|
|
34429
|
+
level: 'INFO',
|
|
34430
|
+
message: 'message with action',
|
|
34431
|
+
creationDate: moment$a(),
|
|
34432
|
+
actions: [
|
|
34433
|
+
{
|
|
34434
|
+
default: true,
|
|
34435
|
+
name: 'default',
|
|
34436
|
+
executeAction: function (event) { _this.showMessage('default action'); }
|
|
34437
|
+
}
|
|
34438
|
+
]
|
|
34439
|
+
}));
|
|
34440
|
+
};
|
|
34441
|
+
UserEventTestingPage.prototype.showMessage = function (text) {
|
|
34442
|
+
return Alerts.showError(text, this.alertController, this.translateService);
|
|
34443
|
+
};
|
|
34444
|
+
return UserEventTestingPage;
|
|
34445
|
+
}());
|
|
34446
|
+
UserEventTestingPage.decorators = [
|
|
34447
|
+
{ type: i0.Component, args: [{
|
|
34448
|
+
selector: 'job-progression-testing',
|
|
34449
|
+
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"
|
|
34450
|
+
},] }
|
|
34451
|
+
];
|
|
34452
|
+
UserEventTestingPage.ctorParameters = function () { return [
|
|
34453
|
+
{ type: UserEventTestService, decorators: [{ type: i0.Inject, args: [USER_EVENT_SERVICE,] }] },
|
|
34454
|
+
{ type: i3.Router },
|
|
34455
|
+
{ type: i1$5.AlertController },
|
|
34456
|
+
{ type: i1$2.TranslateService }
|
|
34457
|
+
]; };
|
|
34458
|
+
UserEventTestingPage.propDecorators = {
|
|
34459
|
+
notification: [{ type: i0.ViewChild, args: ['notification',] }]
|
|
34460
|
+
};
|
|
34461
|
+
|
|
34462
|
+
var UserEventTestingModule = /** @class */ (function () {
|
|
34463
|
+
function UserEventTestingModule() {
|
|
34464
|
+
}
|
|
34465
|
+
return UserEventTestingModule;
|
|
34466
|
+
}());
|
|
34467
|
+
UserEventTestingModule.decorators = [
|
|
34468
|
+
{ type: i0.NgModule, args: [{
|
|
34469
|
+
imports: [
|
|
34470
|
+
i1$4.CommonModule,
|
|
34471
|
+
i1$2.TranslateModule.forChild(),
|
|
34472
|
+
SharedModule,
|
|
34473
|
+
UserEventModule
|
|
34474
|
+
],
|
|
34475
|
+
declarations: [
|
|
34476
|
+
UserEventTestingPage
|
|
34477
|
+
],
|
|
34478
|
+
exports: [
|
|
34479
|
+
UserEventTestingPage
|
|
34480
|
+
]
|
|
34481
|
+
},] }
|
|
34482
|
+
];
|
|
34483
|
+
|
|
34484
|
+
var SOCIAL_TESTING_PAGES = [
|
|
34485
|
+
{ label: 'Social components', divider: true },
|
|
34486
|
+
{ label: 'User event', page: '/testing/social/user-event' },
|
|
34487
|
+
{ label: 'Job progression', page: '/testing/social/job-progression' }
|
|
34488
|
+
];
|
|
34489
|
+
var routes$6 = [
|
|
34490
|
+
{
|
|
34491
|
+
path: 'job-progression',
|
|
34492
|
+
pathMatch: 'full',
|
|
34493
|
+
component: JobProgressionTestingPage
|
|
34494
|
+
},
|
|
34495
|
+
{
|
|
34496
|
+
path: 'user-event',
|
|
34497
|
+
pathMatch: 'full',
|
|
34498
|
+
component: UserEventTestingPage
|
|
34499
|
+
},
|
|
34500
|
+
];
|
|
34501
|
+
var SocialTestingModule = /** @class */ (function () {
|
|
34502
|
+
function SocialTestingModule() {
|
|
34503
|
+
}
|
|
34504
|
+
return SocialTestingModule;
|
|
34505
|
+
}());
|
|
34506
|
+
SocialTestingModule.decorators = [
|
|
34507
|
+
{ type: i0.NgModule, args: [{
|
|
34508
|
+
imports: [
|
|
34509
|
+
i1$4.CommonModule,
|
|
34510
|
+
i1$2.TranslateModule.forChild(),
|
|
34511
|
+
i3.RouterModule.forChild(routes$6),
|
|
34512
|
+
JobTestingModule,
|
|
34513
|
+
UserEventTestingModule
|
|
34514
|
+
],
|
|
34515
|
+
},] }
|
|
34516
|
+
];
|
|
34517
|
+
|
|
33845
34518
|
// Environment
|
|
33846
34519
|
|
|
33847
34520
|
/**
|
|
@@ -33897,6 +34570,7 @@
|
|
|
33897
34570
|
exports.AppTable = AppTable;
|
|
33898
34571
|
exports.AppTableDataSourceOptions = AppTableDataSourceOptions;
|
|
33899
34572
|
exports.AppTableUtils = AppTableUtils;
|
|
34573
|
+
exports.AppUserEventNotificationIcon = AppUserEventNotificationIcon;
|
|
33900
34574
|
exports.AppValidatorService = AppValidatorService;
|
|
33901
34575
|
exports.AppendToInputDirective = AppendToInputDirective;
|
|
33902
34576
|
exports.ArrayFilterPipe = ArrayFilterPipe;
|
|
@@ -33996,6 +34670,9 @@
|
|
|
33996
34670
|
exports.JobProgressionComponent = JobProgressionComponent;
|
|
33997
34671
|
exports.JobProgressionService = JobProgressionService;
|
|
33998
34672
|
exports.JobProgressionServiceToken = JobProgressionServiceToken;
|
|
34673
|
+
exports.JobProgressionTestService = JobProgressionTestService;
|
|
34674
|
+
exports.JobProgressionTestingPage = JobProgressionTestingPage;
|
|
34675
|
+
exports.JobTestingModule = JobTestingModule;
|
|
33999
34676
|
exports.JobUtils = JobUtils;
|
|
34000
34677
|
exports.KEYBOARD_HIDE_DELAY_MS = KEYBOARD_HIDE_DELAY_MS;
|
|
34001
34678
|
exports.LAT_LONG_DEFAULT_MAX_DECIMALS = LAT_LONG_DEFAULT_MAX_DECIMALS;
|
|
@@ -34075,6 +34752,7 @@
|
|
|
34075
34752
|
exports.SETTINGS_TRANSIENT_PROPERTIES = SETTINGS_TRANSIENT_PROPERTIES;
|
|
34076
34753
|
exports.SHARED_MATERIAL_TESTING_PAGES = SHARED_MATERIAL_TESTING_PAGES;
|
|
34077
34754
|
exports.SHARED_TESTING_PAGES = SHARED_TESTING_PAGES;
|
|
34755
|
+
exports.SOCIAL_TESTING_PAGES = SOCIAL_TESTING_PAGES;
|
|
34078
34756
|
exports.SPACE_PLACEHOLDER_CHAR = SPACE_PLACEHOLDER_CHAR;
|
|
34079
34757
|
exports.SelectPeerModal = SelectPeerModal;
|
|
34080
34758
|
exports.ServerErrorCodes = ServerErrorCodes;
|
|
@@ -34103,6 +34781,7 @@
|
|
|
34103
34781
|
exports.SocialErrorCodes = SocialErrorCodes;
|
|
34104
34782
|
exports.SocialModule = SocialModule;
|
|
34105
34783
|
exports.SocialModuleOptionsToken = SocialModuleOptionsToken;
|
|
34784
|
+
exports.SocialTestingModule = SocialTestingModule;
|
|
34106
34785
|
exports.StartableService = StartableService;
|
|
34107
34786
|
exports.StatusById = StatusById;
|
|
34108
34787
|
exports.StatusIds = StatusIds;
|
|
@@ -34133,7 +34812,9 @@
|
|
|
34133
34812
|
exports.UriUtils = UriUtils;
|
|
34134
34813
|
exports.UserEventFragments = UserEventFragments;
|
|
34135
34814
|
exports.UserEventModule = UserEventModule;
|
|
34136
|
-
exports.
|
|
34815
|
+
exports.UserEventTestService = UserEventTestService;
|
|
34816
|
+
exports.UserEventTestingModule = UserEventTestingModule;
|
|
34817
|
+
exports.UserEventTestingPage = UserEventTestingPage;
|
|
34137
34818
|
exports.UserEventTypes = UserEventTypes;
|
|
34138
34819
|
exports.UsersPage = UsersPage;
|
|
34139
34820
|
exports.accountToString = accountToString;
|