@quadrel-enterprise-ui/framework 21.12.3 → 21.12.4

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.
@@ -565,7 +565,7 @@ class QdNotificationsService {
565
565
  }
566
566
  add(context, notification) {
567
567
  const id = notification.uuid || v4();
568
- const newNotification = { uuid: id, context, ...notification };
568
+ const newNotification = { ...notification, uuid: id, context };
569
569
  this.notifications.push(newNotification);
570
570
  this.updateSubject();
571
571
  this.removeNotificationAfterTimeOut(newNotification);
@@ -614,7 +614,7 @@ class QdNotificationsService {
614
614
  this.removeOsNotificationAfterTimeOutIfOverriden(notification);
615
615
  }
616
616
  getNotificationLifeTime(notification) {
617
- return notification.lifeTime || this.notificationLifeTimeDefault;
617
+ return notification.lifeTime ?? this.notificationLifeTimeDefault;
618
618
  }
619
619
  removeSnackbarNotificationAfterTimeOutIfOverriden(notification) {
620
620
  const snackbarNotificationLifeTime = notification.snackbarOptions?.lifeTime;
@@ -625,6 +625,8 @@ class QdNotificationsService {
625
625
  console.warn('Quadrel Framework | QdNotifications - The life time of the snackbar notification must be shorter than the life time of the main notification.');
626
626
  return;
627
627
  }
628
+ if (snackbarNotificationLifeTime === 0)
629
+ return;
628
630
  setTimeout(() => this.snackbarService.close(notification.uuid), snackbarNotificationLifeTime * 1000);
629
631
  }
630
632
  removeOsNotificationAfterTimeOutIfOverriden(notification) {
@@ -635,6 +637,8 @@ class QdNotificationsService {
635
637
  console.warn('Quadrel Framework | QdNotifications - The life time of the OS notification must be shorter than the life time of the main notification.');
636
638
  return;
637
639
  }
640
+ if (osNotificationLifeTime === 0)
641
+ return;
638
642
  setTimeout(() => this.osNotificationsService.close(notification.uuid), osNotificationLifeTime * 1000);
639
643
  }
640
644
  zeroToInfinity(n) {
@@ -1649,8 +1653,9 @@ class QdNotificationsHttpInterceptorService {
1649
1653
  }
1650
1654
  getErrorTranslationKeyForHttpStatus(httpStatusCode) {
1651
1655
  const httpErrorName = this.getHttpErrorName(httpStatusCode);
1652
- return this.backendErrorCodes[`HTTP_${qdConstantCase(httpErrorName)}`]
1653
- ? `Error.HTTP_${qdConstantCase(httpErrorName)}`
1656
+ const httpErrorCode = `HTTP_${qdConstantCase(httpErrorName)}`;
1657
+ return httpErrorCode in this.backendErrorCodes
1658
+ ? `ERROR.${httpErrorCode}`
1654
1659
  : `i18n.qd.notification.error.${lowerFirst(httpErrorName).replace('Error', '')}`;
1655
1660
  }
1656
1661
  getHttpErrorName(httpStatusCode) {
@@ -18002,11 +18007,17 @@ class QdNotificationsComponent {
18002
18007
  * The context can be assigned to control the positioning of the notifications.
18003
18008
  */
18004
18009
  context = 'qdPanel';
18010
+ _destroyed$ = new Subject();
18005
18011
  ngOnInit() {
18006
18012
  this.notificationService
18007
18013
  .getNotificationsForContext(this.context)
18014
+ .pipe(takeUntil(this._destroyed$))
18008
18015
  .subscribe(notifications => (this.notifications = notifications));
18009
18016
  }
18017
+ ngOnDestroy() {
18018
+ this._destroyed$.next();
18019
+ this._destroyed$.complete();
18020
+ }
18010
18021
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
18011
18022
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdNotificationsComponent, isStandalone: false, selector: "qd-notifications", inputs: { context: "context" }, ngImport: i0, template: "@for (notification of notifications; track notification) {\n<qd-notification [notification]=\"notification\"></qd-notification>\n}\n", styles: [".panel-type-control qd-notifications{display:block;width:100%;padding:1rem 1.5rem}.panel-type-info qd-notifications .qd-notification{background:#fff}qd-notifications qd-notification+qd-notification{margin-top:1rem}\n"], dependencies: [{ kind: "component", type: QdNotificationComponent, selector: "qd-notification", inputs: ["state", "notification"] }], encapsulation: i0.ViewEncapsulation.None });
18012
18023
  }
@@ -36728,6 +36739,7 @@ class QdShellNotificationComponent {
36728
36739
  return new Date(date).setHours(0, 0, 0, 0) === new Date().setHours(0, 0, 0, 0);
36729
36740
  }
36730
36741
  ngOnDestroy() {
36742
+ this._destroyed$.next();
36731
36743
  this._destroyed$.complete();
36732
36744
  }
36733
36745
  getState() {
@@ -36771,11 +36783,11 @@ class QdShellNotificationsComponent {
36771
36783
  this.notifications$ = this.notificationService.getNotificationsForContext('shell');
36772
36784
  }
36773
36785
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdShellNotificationsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36774
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdShellNotificationsComponent, isStandalone: false, selector: "qd-shell-notifications", ngImport: i0, template: "@for (notification of notifications$ | async; track notification) {\n<qd-shell-notification [notification]=\"notification\"></qd-shell-notification>\n} @if ((notifications$ | async).length === 0) {\n<span class=\"no-notifications-hint\">{{ \"i18n.qd.notification.noNotificationsAvailable\" | translate }}</span>\n}\n", styles: [":host .no-notifications-hint{display:block;color:#757575;font-size:.875rem;font-style:italic;text-align:center}\n"], dependencies: [{ kind: "component", type: QdShellNotificationComponent, selector: "qd-shell-notification", inputs: ["notification"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
36786
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdShellNotificationsComponent, isStandalone: false, selector: "qd-shell-notifications", ngImport: i0, template: "@for (notification of notifications$ | async; track notification) {\n<qd-shell-notification [notification]=\"notification\"></qd-shell-notification>\n} @empty {\n<span class=\"no-notifications-hint\">{{ \"i18n.qd.notification.noNotificationsAvailable\" | translate }}</span>\n}\n", styles: [":host .no-notifications-hint{display:block;color:#757575;font-size:.875rem;font-style:italic;text-align:center}\n"], dependencies: [{ kind: "component", type: QdShellNotificationComponent, selector: "qd-shell-notification", inputs: ["notification"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
36775
36787
  }
36776
36788
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdShellNotificationsComponent, decorators: [{
36777
36789
  type: Component,
36778
- args: [{ selector: 'qd-shell-notifications', standalone: false, template: "@for (notification of notifications$ | async; track notification) {\n<qd-shell-notification [notification]=\"notification\"></qd-shell-notification>\n} @if ((notifications$ | async).length === 0) {\n<span class=\"no-notifications-hint\">{{ \"i18n.qd.notification.noNotificationsAvailable\" | translate }}</span>\n}\n", styles: [":host .no-notifications-hint{display:block;color:#757575;font-size:.875rem;font-style:italic;text-align:center}\n"] }]
36790
+ args: [{ selector: 'qd-shell-notifications', standalone: false, template: "@for (notification of notifications$ | async; track notification) {\n<qd-shell-notification [notification]=\"notification\"></qd-shell-notification>\n} @empty {\n<span class=\"no-notifications-hint\">{{ \"i18n.qd.notification.noNotificationsAvailable\" | translate }}</span>\n}\n", styles: [":host .no-notifications-hint{display:block;color:#757575;font-size:.875rem;font-style:italic;text-align:center}\n"] }]
36779
36791
  }] });
36780
36792
 
36781
36793
  class QdShellRightToolbarComponent {
@@ -36824,6 +36836,10 @@ class QdShellRightComponent {
36824
36836
  this.isHome = isHome;
36825
36837
  });
36826
36838
  }
36839
+ ngOnDestroy() {
36840
+ this._destroyed$.next();
36841
+ this._destroyed$.complete();
36842
+ }
36827
36843
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdShellRightComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36828
36844
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdShellRightComponent, isStandalone: false, selector: "[qd-shell-right]", inputs: { config: "config" }, host: { properties: { "class.header-minimized": "this.headerMinimized", "class.has-footer": "this.hasFooter" } }, ngImport: i0, template: "<div class=\"shell-right\">\n <qd-shell-right-toolbar [config]=\"config\"></qd-shell-right-toolbar>\n <div class=\"shell-right-content\">\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [":host{position:relative;height:100%}:host .shell-right{position:fixed;z-index:1500;display:flex;overflow:auto;width:18.75rem;height:calc(100% - 5.9375rem);flex-direction:column;border-left:.0625rem solid rgb(213,213,213);background:#fff;transform:translate(-100%)}:host .shell-right-content{padding:1rem}:host:not(.header-minimized).has-footer .shell-right{height:calc(100% - 8.4375rem)}:host.header-minimized:not(.has-footer) .shell-right{height:calc(100% - 4.0625rem)}:host.header-minimized.has-footer .shell-right{height:calc(100% - 6.5625rem)}\n"], dependencies: [{ kind: "component", type: QdShellRightToolbarComponent, selector: "qd-shell-right-toolbar", inputs: ["config"] }] });
36829
36845
  }