@ecodev/natural 42.4.0 → 42.4.1
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/esm2020/lib/classes/rxjs.mjs +2 -1
- package/esm2020/lib/modules/logger/error-handler.mjs +26 -11
- package/esm2020/lib/modules/logger/public-api.mjs +3 -3
- package/esm2020/lib/modules/search/dropdown-container/dropdown-container.component.mjs +3 -3
- package/fesm2015/ecodev-natural.mjs +29 -13
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +28 -12
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/modules/logger/error-handler.d.ts +19 -3
- package/lib/modules/logger/public-api.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@angular/localize/init';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Directive, Component, Inject, Injectable, HostBinding, HostListener, InjectionToken, Input, NgModule, EventEmitter, ChangeDetectionStrategy, Output, ContentChildren, Pipe, TemplateRef, ViewEncapsulation, ViewChild, Injector, Optional, Self, ContentChild, PLATFORM_ID, ErrorHandler } from '@angular/core';
|
|
4
|
-
import { Subject, BehaviorSubject, of, timer, EMPTY, Observable, ReplaySubject, forkJoin, merge as merge$1, asyncScheduler, catchError } from 'rxjs';
|
|
4
|
+
import { Subject, BehaviorSubject, of, timer, EMPTY, Observable, ReplaySubject, forkJoin, merge as merge$1, asyncScheduler, catchError, first as first$1 } from 'rxjs';
|
|
5
5
|
import * as i5 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormArray, Validators, FormControl, FormsModule, FormControlDirective, FormControlName, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i2$1 from '@angular/router';
|
|
@@ -3554,6 +3554,7 @@ function cancellableTimeout(canceller, milliSeconds = 0) {
|
|
|
3554
3554
|
*/
|
|
3555
3555
|
function debug(debugName) {
|
|
3556
3556
|
return tap({
|
|
3557
|
+
subscribe: () => console.log('SUBSCRIBE', debugName),
|
|
3557
3558
|
next: value => console.log('NEXT', debugName, value),
|
|
3558
3559
|
error: error => console.log('ERROR', debugName, error),
|
|
3559
3560
|
complete: () => console.log('COMPLETE', debugName),
|
|
@@ -5190,10 +5191,10 @@ class NaturalDropdownContainerComponent extends BasePortalOutlet {
|
|
|
5190
5191
|
}
|
|
5191
5192
|
}
|
|
5192
5193
|
NaturalDropdownContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalDropdownContainerComponent, deps: [{ token: i0.ElementRef }, { token: i1$6.ConfigurableFocusTrapFactory }, { token: NATURAL_DROPDOWN_CONTAINER_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
5193
|
-
NaturalDropdownContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: NaturalDropdownContainerComponent, selector: "ng-component", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n (@transformMenu.done)=\"onAnimationDone($event)\"\n [@transformMenu]=\"panelAnimationState\"\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div *ngIf=\"data.showValidateButton\" class=\"natural-dropdown-validate-button\">\n <button (click)=\"close()\" color=\"primary\" mat-raised-button>Valider</button>\n </div>\n</div>\n", styles: [".natural-dropdown-container{display:flex;flex-direction:column;border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{flex:none;display:flex;flex-direction:row;justify-content:flex-end;margin:5px}\n"], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [naturalDropdownAnimations.transformMenu, naturalDropdownAnimations.fadeInItems], encapsulation: i0.ViewEncapsulation.None });
|
|
5194
|
+
NaturalDropdownContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: NaturalDropdownContainerComponent, selector: "ng-component", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div\n (@transformMenu.done)=\"onAnimationDone($event)\"\n [@transformMenu]=\"panelAnimationState\"\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div *ngIf=\"data.showValidateButton\" class=\"natural-dropdown-validate-button\">\n <button (click)=\"close()\" color=\"primary\" mat-raised-button i18n>Valider</button>\n </div>\n</div>\n", styles: [".natural-dropdown-container{display:flex;flex-direction:column;border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{flex:none;display:flex;flex-direction:row;justify-content:flex-end;margin:5px}\n"], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], animations: [naturalDropdownAnimations.transformMenu, naturalDropdownAnimations.fadeInItems], encapsulation: i0.ViewEncapsulation.None });
|
|
5194
5195
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalDropdownContainerComponent, decorators: [{
|
|
5195
5196
|
type: Component,
|
|
5196
|
-
args: [{ encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, animations: [naturalDropdownAnimations.transformMenu, naturalDropdownAnimations.fadeInItems], template: "<div\n (@transformMenu.done)=\"onAnimationDone($event)\"\n [@transformMenu]=\"panelAnimationState\"\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div *ngIf=\"data.showValidateButton\" class=\"natural-dropdown-validate-button\">\n <button (click)=\"close()\" color=\"primary\" mat-raised-button>Valider</button>\n </div>\n</div>\n", styles: [".natural-dropdown-container{display:flex;flex-direction:column;border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{flex:none;display:flex;flex-direction:row;justify-content:flex-end;margin:5px}\n"] }]
|
|
5197
|
+
args: [{ encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, animations: [naturalDropdownAnimations.transformMenu, naturalDropdownAnimations.fadeInItems], template: "<div\n (@transformMenu.done)=\"onAnimationDone($event)\"\n [@transformMenu]=\"panelAnimationState\"\n class=\"natural-dropdown-container mat-elevation-z2\"\n role=\"menu\"\n tabindex=\"-1\"\n>\n <div class=\"natural-dropdown-container-content\">\n <ng-template cdkPortalOutlet></ng-template>\n </div>\n\n <div *ngIf=\"data.showValidateButton\" class=\"natural-dropdown-validate-button\">\n <button (click)=\"close()\" color=\"primary\" mat-raised-button i18n>Valider</button>\n </div>\n</div>\n", styles: [".natural-dropdown-container{display:flex;flex-direction:column;border-radius:2px;height:100%}.natural-dropdown-container-content{flex:1;padding:5px;overflow:auto}.natural-dropdown-container .natural-dropdown-validate-button{flex:none;display:flex;flex-direction:row;justify-content:flex-end;margin:5px}\n"] }]
|
|
5197
5198
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1$6.ConfigurableFocusTrapFactory }, { type: undefined, decorators: [{
|
|
5198
5199
|
type: Inject,
|
|
5199
5200
|
args: [NATURAL_DROPDOWN_CONTAINER_DATA]
|
|
@@ -10487,8 +10488,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
10487
10488
|
* Public API Surface of natural
|
|
10488
10489
|
*/
|
|
10489
10490
|
|
|
10490
|
-
const NaturalLoggerConfigUrl = new InjectionToken('
|
|
10491
|
-
const NaturalLoggerConfigExtra = new InjectionToken('
|
|
10491
|
+
const NaturalLoggerConfigUrl = new InjectionToken('Absolute URL of the log server');
|
|
10492
|
+
const NaturalLoggerConfigExtra = new InjectionToken('Class that may provide extra data to log');
|
|
10493
|
+
/**
|
|
10494
|
+
* Replace Angular's error handler to also send the log to a remote server via HTTP POST.
|
|
10495
|
+
*
|
|
10496
|
+
* Usage is automatic as soon we import the module via:
|
|
10497
|
+
*
|
|
10498
|
+
* ```ts
|
|
10499
|
+
* NaturalErrorModule.forRoot('http://example.com', ExtraService),
|
|
10500
|
+
* ```
|
|
10501
|
+
*/
|
|
10492
10502
|
class NaturalErrorHandler extends ErrorHandler {
|
|
10493
10503
|
constructor(http, document, url, loggerExtra) {
|
|
10494
10504
|
super();
|
|
@@ -10500,18 +10510,13 @@ class NaturalErrorHandler extends ErrorHandler {
|
|
|
10500
10510
|
handleError(error) {
|
|
10501
10511
|
console.error(error);
|
|
10502
10512
|
const params = {
|
|
10513
|
+
message: this.toMessage(error),
|
|
10503
10514
|
href: this.document.defaultView?.window.location.href,
|
|
10504
10515
|
host: this.document.defaultView?.window.location.hostname,
|
|
10505
10516
|
path: this.document.defaultView?.window.location.pathname,
|
|
10506
10517
|
agent: this.document.defaultView?.window.navigator.userAgent,
|
|
10507
10518
|
level: 'error',
|
|
10508
10519
|
};
|
|
10509
|
-
if (error?.message) {
|
|
10510
|
-
params.message = error.message;
|
|
10511
|
-
}
|
|
10512
|
-
else {
|
|
10513
|
-
params.message = error;
|
|
10514
|
-
}
|
|
10515
10520
|
if (error?.stack) {
|
|
10516
10521
|
params.stacktrace = error.stack;
|
|
10517
10522
|
}
|
|
@@ -10525,7 +10530,10 @@ class NaturalErrorHandler extends ErrorHandler {
|
|
|
10525
10530
|
params.url = error.url;
|
|
10526
10531
|
}
|
|
10527
10532
|
if (this.loggerExtra) {
|
|
10528
|
-
this.loggerExtra
|
|
10533
|
+
this.loggerExtra
|
|
10534
|
+
.getExtras(error)
|
|
10535
|
+
.pipe(catchError(e => of({ getExtrasErrorMessage: this.toMessage(e) })), first$1())
|
|
10536
|
+
.subscribe(result => {
|
|
10529
10537
|
this.postLog(Object.assign(params, result));
|
|
10530
10538
|
});
|
|
10531
10539
|
}
|
|
@@ -10533,6 +10541,14 @@ class NaturalErrorHandler extends ErrorHandler {
|
|
|
10533
10541
|
this.postLog(params);
|
|
10534
10542
|
}
|
|
10535
10543
|
}
|
|
10544
|
+
toMessage(error) {
|
|
10545
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
10546
|
+
return '' + error.message;
|
|
10547
|
+
}
|
|
10548
|
+
else {
|
|
10549
|
+
return '' + error;
|
|
10550
|
+
}
|
|
10551
|
+
}
|
|
10536
10552
|
/**
|
|
10537
10553
|
* Send parameters to remote log
|
|
10538
10554
|
*/
|