@ecodev/natural 45.0.1 → 45.1.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/utility.mjs +1 -6
- package/esm2020/lib/modules/dropdown-components/type-date/type-date.component.mjs +1 -1
- package/esm2020/lib/modules/dropdown-components/type-date-range/type-date-range.component.mjs +1 -1
- package/esm2020/lib/modules/dropdown-components/type-number/type-number.component.mjs +7 -3
- package/esm2020/lib/modules/dropdown-components/type-select/type-select.component.mjs +9 -5
- package/esm2020/lib/modules/fixed-button-detail/fixed-button-detail.component.mjs +8 -4
- package/esm2020/lib/modules/logger/error-handler.mjs +2 -4
- package/fesm2015/ecodev-natural.mjs +21 -18
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +21 -18
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/classes/utility.d.ts +2 -0
- package/lib/modules/dropdown-components/type-date/type-date.component.d.ts +1 -1
- package/lib/modules/dropdown-components/type-date-range/type-date-range.component.d.ts +1 -1
- package/lib/modules/dropdown-components/type-number/type-number.component.d.ts +2 -1
- package/lib/modules/dropdown-components/type-select/type-select.component.d.ts +7 -3
- package/lib/modules/fixed-button-detail/fixed-button-detail.component.d.ts +2 -1
- 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, createEnvironmentInjector, createComponent, PLATFORM_ID, ErrorHandler } from '@angular/core';
|
|
4
|
-
import { Subject, BehaviorSubject, of, timer, switchMap as switchMap$1, endWith, last, EMPTY, Observable, first as first$1, combineLatest, ReplaySubject, debounceTime as debounceTime$1, raceWith, take as take$1, mergeMap, shareReplay as shareReplay$1, catchError, forkJoin, map as map$1, merge as merge$1, tap as tap$1, asyncScheduler } from 'rxjs';
|
|
4
|
+
import { Subject, BehaviorSubject, of, timer, switchMap as switchMap$1, endWith, last, EMPTY, Observable, first as first$1, combineLatest, ReplaySubject, debounceTime as debounceTime$1, raceWith, take as take$1, mergeMap, shareReplay as shareReplay$1, catchError, forkJoin, map as map$1, merge as merge$1, tap as tap$1, asyncScheduler, takeUntil as takeUntil$1 } from 'rxjs';
|
|
5
5
|
import * as i3 from '@angular/forms';
|
|
6
6
|
import { FormGroup, FormArray, Validators, UntypedFormGroup, UntypedFormArray, UntypedFormControl, FormsModule, FormControl, FormControlDirective, FormControlName, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import * as i2$1 from '@angular/router';
|
|
@@ -213,11 +213,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImpor
|
|
|
213
213
|
args: ['click']
|
|
214
214
|
}] } });
|
|
215
215
|
|
|
216
|
-
/**
|
|
217
|
-
* Very basic formatting to get only date, without time and ignoring entirely the timezone
|
|
218
|
-
*
|
|
219
|
-
* So something like: "2021-09-23"
|
|
220
|
-
*/
|
|
221
216
|
function formatIsoDate(date) {
|
|
222
217
|
if (!date) {
|
|
223
218
|
return null;
|
|
@@ -5476,6 +5471,7 @@ class TypeSelectComponent extends NaturalAbstractController {
|
|
|
5476
5471
|
this.defaults = {
|
|
5477
5472
|
items: [],
|
|
5478
5473
|
multiple: true,
|
|
5474
|
+
operators: true,
|
|
5479
5475
|
};
|
|
5480
5476
|
this.configuration = { ...this.defaults, ...data.configuration };
|
|
5481
5477
|
// Immediately initValidators and everytime the operator change later
|
|
@@ -5524,7 +5520,7 @@ class TypeSelectComponent extends NaturalAbstractController {
|
|
|
5524
5520
|
this.valueCtrl.updateValueAndValidity();
|
|
5525
5521
|
}
|
|
5526
5522
|
isMultiple() {
|
|
5527
|
-
return
|
|
5523
|
+
return this.configuration.multiple;
|
|
5528
5524
|
}
|
|
5529
5525
|
getItemById(id) {
|
|
5530
5526
|
return this.items.find(item => this.getId(item) === id);
|
|
@@ -5552,7 +5548,7 @@ class TypeSelectComponent extends NaturalAbstractController {
|
|
|
5552
5548
|
this.items = items;
|
|
5553
5549
|
// Reload selection, according to possible values from configuration
|
|
5554
5550
|
const possibleIds = this.items.map(item => this.getId(item));
|
|
5555
|
-
const wantedAndPossibleIds = wantedIds.filter(id =>
|
|
5551
|
+
const wantedAndPossibleIds = wantedIds.filter(id => possibleIds.some(i => i === id));
|
|
5556
5552
|
return wantedAndPossibleIds;
|
|
5557
5553
|
}));
|
|
5558
5554
|
}
|
|
@@ -5572,6 +5568,9 @@ class TypeSelectComponent extends NaturalAbstractController {
|
|
|
5572
5568
|
return [operator.label, selection].filter(v => v).join(' ');
|
|
5573
5569
|
}
|
|
5574
5570
|
conditionToOperatorKey(condition) {
|
|
5571
|
+
if (!this.configuration.operators) {
|
|
5572
|
+
return 'is';
|
|
5573
|
+
}
|
|
5575
5574
|
if (condition.in && !condition.in.not) {
|
|
5576
5575
|
return 'is';
|
|
5577
5576
|
}
|
|
@@ -5602,10 +5601,10 @@ class TypeSelectComponent extends NaturalAbstractController {
|
|
|
5602
5601
|
}
|
|
5603
5602
|
}
|
|
5604
5603
|
TypeSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TypeSelectComponent, deps: [{ token: NATURAL_DROPDOWN_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
5605
|
-
TypeSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: TypeSelectComponent, selector: "ng-component", viewQueries: [{ propertyName: "list", first: true, predicate: MatSelectionList, descendants: true }], usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-selection-list *ngIf=\"requireValueCtrl\" [formControl]=\"valueCtrl\">\n <mat-list-option *ngFor=\"let item of items\" [value]=\"getId(item)\" checkboxPosition=\"before\">\n {{ getDisplay(item) }}\n </mat-list-option>\n </mat-selection-list>\n</form>\n", dependencies: [{ kind: "directive", type: i1$3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "component", type: i4$2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$3.MatSelectionList, selector: "mat-selection-list", inputs: ["disableRipple", "color", "compareWith", "disabled", "multiple"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i4$3.MatListOption, selector: "mat-list-option", inputs: ["disableRipple", "checkboxPosition", "color", "value", "disabled", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { kind: "component", type: i4$4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i1$7.MatOption, selector: "mat-option", exportAs: ["matOption"] }] });
|
|
5604
|
+
TypeSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: TypeSelectComponent, selector: "ng-component", viewQueries: [{ propertyName: "list", first: true, predicate: MatSelectionList, descendants: true }], usesInheritance: true, ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\" *ngIf=\"configuration.operators\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-selection-list *ngIf=\"requireValueCtrl\" [formControl]=\"valueCtrl\">\n <mat-list-option *ngFor=\"let item of items\" [value]=\"getId(item)\" checkboxPosition=\"before\">\n {{ getDisplay(item) }}\n </mat-list-option>\n </mat-selection-list>\n</form>\n", dependencies: [{ kind: "directive", type: i1$3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "component", type: i4$2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4$2.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i4$3.MatSelectionList, selector: "mat-selection-list", inputs: ["disableRipple", "color", "compareWith", "disabled", "multiple"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i4$3.MatListOption, selector: "mat-list-option", inputs: ["disableRipple", "checkboxPosition", "color", "value", "disabled", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }, { kind: "component", type: i4$4.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i1$7.MatOption, selector: "mat-option", exportAs: ["matOption"] }] });
|
|
5606
5605
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TypeSelectComponent, decorators: [{
|
|
5607
5606
|
type: Component,
|
|
5608
|
-
args: [{ template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-selection-list *ngIf=\"requireValueCtrl\" [formControl]=\"valueCtrl\">\n <mat-list-option *ngFor=\"let item of items\" [value]=\"getId(item)\" checkboxPosition=\"before\">\n {{ getDisplay(item) }}\n </mat-list-option>\n </mat-selection-list>\n</form>\n" }]
|
|
5607
|
+
args: [{ template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width: 7em; margin-right: 1em\" *ngIf=\"configuration.operators\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select [formControl]=\"operatorCtrl\" [required]=\"true\">\n <mat-option *ngFor=\"let item of operators\" [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n </mat-select>\n </mat-form-field>\n\n <mat-selection-list *ngIf=\"requireValueCtrl\" [formControl]=\"valueCtrl\">\n <mat-list-option *ngFor=\"let item of items\" [value]=\"getId(item)\" checkboxPosition=\"before\">\n {{ getDisplay(item) }}\n </mat-list-option>\n </mat-selection-list>\n</form>\n" }]
|
|
5609
5608
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
5610
5609
|
type: Inject,
|
|
5611
5610
|
args: [NATURAL_DROPDOWN_DATA]
|
|
@@ -6155,7 +6154,6 @@ class TypeNumberComponent {
|
|
|
6155
6154
|
constructor(data, dropdownRef) {
|
|
6156
6155
|
this.dropdownRef = dropdownRef;
|
|
6157
6156
|
this.renderedValue = new BehaviorSubject('');
|
|
6158
|
-
this.configuration = {};
|
|
6159
6157
|
this.operatorCtrl = new FormControl('equal', { nonNullable: true });
|
|
6160
6158
|
this.valueCtrl = new FormControl();
|
|
6161
6159
|
this.matcher = new InvalidWithValueStateMatcher$1();
|
|
@@ -6164,7 +6162,12 @@ class TypeNumberComponent {
|
|
|
6164
6162
|
value: this.valueCtrl,
|
|
6165
6163
|
});
|
|
6166
6164
|
this.operators = possibleComparableOperators;
|
|
6167
|
-
this.
|
|
6165
|
+
this.defaults = {
|
|
6166
|
+
min: null,
|
|
6167
|
+
max: null,
|
|
6168
|
+
step: null,
|
|
6169
|
+
};
|
|
6170
|
+
this.configuration = { ...this.defaults, ...data.configuration };
|
|
6168
6171
|
merge$1(this.operatorCtrl.valueChanges, this.valueCtrl.valueChanges).subscribe(() => {
|
|
6169
6172
|
const rendered = this.getRenderedValue();
|
|
6170
6173
|
this.renderedValue.next(rendered);
|
|
@@ -8798,13 +8801,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImpor
|
|
|
8798
8801
|
* Public API Surface of natural
|
|
8799
8802
|
*/
|
|
8800
8803
|
|
|
8801
|
-
class NaturalFixedButtonDetailComponent {
|
|
8804
|
+
class NaturalFixedButtonDetailComponent extends NaturalAbstractController {
|
|
8802
8805
|
constructor(route) {
|
|
8806
|
+
super();
|
|
8803
8807
|
this.canChange = true;
|
|
8804
8808
|
this.isCreation = false;
|
|
8805
8809
|
this.create = new EventEmitter();
|
|
8806
8810
|
this.delete = new EventEmitter();
|
|
8807
|
-
route.params.subscribe(() => (this.canChange = true));
|
|
8811
|
+
route.params.pipe(takeUntil$1(this.ngUnsubscribe)).subscribe(() => (this.canChange = true));
|
|
8808
8812
|
}
|
|
8809
8813
|
get model() {
|
|
8810
8814
|
return this._model;
|
|
@@ -8813,6 +8817,7 @@ class NaturalFixedButtonDetailComponent {
|
|
|
8813
8817
|
this._model = value;
|
|
8814
8818
|
if (this.canChange) {
|
|
8815
8819
|
this.isCreation = !this._model.id;
|
|
8820
|
+
this.canChange = false;
|
|
8816
8821
|
}
|
|
8817
8822
|
}
|
|
8818
8823
|
clickCreate() {
|
|
@@ -8827,7 +8832,7 @@ class NaturalFixedButtonDetailComponent {
|
|
|
8827
8832
|
}
|
|
8828
8833
|
}
|
|
8829
8834
|
NaturalFixedButtonDetailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalFixedButtonDetailComponent, deps: [{ token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
|
|
8830
|
-
NaturalFixedButtonDetailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: NaturalFixedButtonDetailComponent, selector: "natural-fixed-button-detail", inputs: { model: "model", form: "form" }, outputs: { create: "create", delete: "delete" }, ngImport: i0, template: "<natural-fixed-button\n (click)=\"clickCreate()\"\n *ngIf=\"isCreation\"\n [disabled]=\"form.disabled\"\n [color]=\"form.valid ? 'accent' : 'warn'\"\n class=\"detail-speed-dial\"\n icon=\"save\"\n></natural-fixed-button>\n\n<natural-fixed-button\n (click)=\"clickDelete()\"\n *ngIf=\"!isCreation && (!model.permissions || model.permissions.delete)\"\n [disabled]=\"form.disabled\"\n class=\"detail-speed-dial\"\n color=\"warn\"\n icon=\"delete_forever\"\n i18n-matTooltip\n matTooltip=\"Supprimer d\u00E9finitivement\"\n matTooltipPosition=\"left\"\n></natural-fixed-button>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NaturalFixedButtonComponent, selector: "natural-fixed-button", inputs: ["icon", "link", "color", "disabled"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
8835
|
+
NaturalFixedButtonDetailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: NaturalFixedButtonDetailComponent, selector: "natural-fixed-button-detail", inputs: { model: "model", form: "form" }, outputs: { create: "create", delete: "delete" }, usesInheritance: true, ngImport: i0, template: "<natural-fixed-button\n (click)=\"clickCreate()\"\n *ngIf=\"isCreation\"\n [disabled]=\"form.disabled\"\n [color]=\"form.valid ? 'accent' : 'warn'\"\n class=\"detail-speed-dial\"\n icon=\"save\"\n></natural-fixed-button>\n\n<natural-fixed-button\n (click)=\"clickDelete()\"\n *ngIf=\"!isCreation && (!model.permissions || model.permissions.delete)\"\n [disabled]=\"form.disabled\"\n class=\"detail-speed-dial\"\n color=\"warn\"\n icon=\"delete_forever\"\n i18n-matTooltip\n matTooltip=\"Supprimer d\u00E9finitivement\"\n matTooltipPosition=\"left\"\n></natural-fixed-button>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: NaturalFixedButtonComponent, selector: "natural-fixed-button", inputs: ["icon", "link", "color", "disabled"] }, { kind: "directive", type: i7.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
8831
8836
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NaturalFixedButtonDetailComponent, decorators: [{
|
|
8832
8837
|
type: Component,
|
|
8833
8838
|
args: [{ selector: 'natural-fixed-button-detail', template: "<natural-fixed-button\n (click)=\"clickCreate()\"\n *ngIf=\"isCreation\"\n [disabled]=\"form.disabled\"\n [color]=\"form.valid ? 'accent' : 'warn'\"\n class=\"detail-speed-dial\"\n icon=\"save\"\n></natural-fixed-button>\n\n<natural-fixed-button\n (click)=\"clickDelete()\"\n *ngIf=\"!isCreation && (!model.permissions || model.permissions.delete)\"\n [disabled]=\"form.disabled\"\n class=\"detail-speed-dial\"\n color=\"warn\"\n icon=\"delete_forever\"\n i18n-matTooltip\n matTooltip=\"Supprimer d\u00E9finitivement\"\n matTooltipPosition=\"left\"\n></natural-fixed-button>\n" }]
|
|
@@ -10887,9 +10892,7 @@ class NaturalErrorHandler extends ErrorHandler {
|
|
|
10887
10892
|
if (this.url) {
|
|
10888
10893
|
this.http
|
|
10889
10894
|
.post(this.url, params, { headers: new HttpHeaders().set('content-type', 'application/json') })
|
|
10890
|
-
.pipe(catchError(() =>
|
|
10891
|
-
return EMPTY;
|
|
10892
|
-
}))
|
|
10895
|
+
.pipe(catchError(() => EMPTY))
|
|
10893
10896
|
.subscribe();
|
|
10894
10897
|
}
|
|
10895
10898
|
}
|