@ecodev/natural 65.0.2 → 65.0.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.
- package/fesm2022/ecodev-natural.mjs +107 -54
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/index.d.ts +25 -11
- package/package.json +1 -1
|
@@ -8,9 +8,9 @@ import * as i1 from '@angular/material/dialog';
|
|
|
8
8
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialog, MatDialogRef } from '@angular/material/dialog';
|
|
9
9
|
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
|
10
10
|
import { MatButton, MatIconButton, MatFabButton } from '@angular/material/button';
|
|
11
|
-
import { Observable, switchMap, take, BehaviorSubject, of, timer, tap, endWith, last, EMPTY, finalize, Subject, merge as merge$1, first as first$1, takeUntil as takeUntil$1, map as map$1, ReplaySubject, debounceTime, raceWith, mergeMap, shareReplay, catchError, forkJoin, combineLatest, from, filter as filter$1,
|
|
11
|
+
import { Observable, switchMap, take, BehaviorSubject, of, timer, tap, endWith, last, EMPTY, finalize, Subject, merge as merge$1, startWith, first as first$1, takeUntil as takeUntil$1, map as map$1, ReplaySubject, debounceTime, raceWith, mergeMap, shareReplay, catchError, forkJoin, combineLatest, from, filter as filter$1, asyncScheduler, throwError } from 'rxjs';
|
|
12
12
|
import { takeUntilDestroyed, outputFromObservable } from '@angular/core/rxjs-interop';
|
|
13
|
-
import { filter, switchMap as switchMap$1, first, map, takeUntil, takeWhile, debounceTime as debounceTime$1, tap as tap$1, shareReplay as shareReplay$1, startWith, distinctUntilChanged, finalize as finalize$1, throttleTime } from 'rxjs/operators';
|
|
13
|
+
import { filter, switchMap as switchMap$1, first, map, takeUntil, takeWhile, debounceTime as debounceTime$1, tap as tap$1, shareReplay as shareReplay$1, startWith as startWith$1, distinctUntilChanged, finalize as finalize$1, throttleTime } from 'rxjs/operators';
|
|
14
14
|
import { mergeWith, defaultsDeep, pick, defaults, isEmpty, isEqual as isEqual$1 } from 'es-toolkit/compat';
|
|
15
15
|
import { MatTableDataSource, MatTable, MatHeaderCellDef, MatHeaderRowDef, MatColumnDef, MatCellDef, MatRowDef, MatHeaderCell, MatCell, MatHeaderRow, MatRow } from '@angular/material/table';
|
|
16
16
|
import { DataSource, SelectionModel } from '@angular/cdk/collections';
|
|
@@ -3006,6 +3006,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
3006
3006
|
}]
|
|
3007
3007
|
}] });
|
|
3008
3008
|
|
|
3009
|
+
const possibleNullableOperators = [
|
|
3010
|
+
{
|
|
3011
|
+
key: 'any',
|
|
3012
|
+
label: $localize `avec`,
|
|
3013
|
+
},
|
|
3014
|
+
{
|
|
3015
|
+
key: 'none',
|
|
3016
|
+
label: $localize `sans`,
|
|
3017
|
+
},
|
|
3018
|
+
];
|
|
3009
3019
|
const possibleComparableOperators = [
|
|
3010
3020
|
{
|
|
3011
3021
|
key: 'less',
|
|
@@ -3028,6 +3038,10 @@ const possibleComparableOperators = [
|
|
|
3028
3038
|
label: '>',
|
|
3029
3039
|
},
|
|
3030
3040
|
];
|
|
3041
|
+
const possibleNullComparableOperators = [
|
|
3042
|
+
...possibleComparableOperators,
|
|
3043
|
+
...possibleNullableOperators,
|
|
3044
|
+
];
|
|
3031
3045
|
const possibleDiscreteOperators = [
|
|
3032
3046
|
{
|
|
3033
3047
|
key: 'is',
|
|
@@ -3037,14 +3051,7 @@ const possibleDiscreteOperators = [
|
|
|
3037
3051
|
key: 'isnot',
|
|
3038
3052
|
label: $localize `n'est pas`,
|
|
3039
3053
|
},
|
|
3040
|
-
|
|
3041
|
-
key: 'any',
|
|
3042
|
-
label: $localize `avec`,
|
|
3043
|
-
},
|
|
3044
|
-
{
|
|
3045
|
-
key: 'none',
|
|
3046
|
-
label: $localize `sans`,
|
|
3047
|
-
},
|
|
3054
|
+
...possibleNullableOperators,
|
|
3048
3055
|
];
|
|
3049
3056
|
|
|
3050
3057
|
/**
|
|
@@ -3090,7 +3097,8 @@ class TypeDateComponent {
|
|
|
3090
3097
|
operatorCtrl = new FormControl('equal', { nonNullable: true });
|
|
3091
3098
|
valueCtrl = new FormControl(null);
|
|
3092
3099
|
todayCtrl = new FormControl(false);
|
|
3093
|
-
|
|
3100
|
+
requireValueCtrl = false;
|
|
3101
|
+
operators;
|
|
3094
3102
|
form = new FormGroup({
|
|
3095
3103
|
operator: this.operatorCtrl,
|
|
3096
3104
|
value: this.valueCtrl,
|
|
@@ -3099,10 +3107,12 @@ class TypeDateComponent {
|
|
|
3099
3107
|
defaults = {
|
|
3100
3108
|
min: null,
|
|
3101
3109
|
max: null,
|
|
3110
|
+
nullable: false,
|
|
3102
3111
|
};
|
|
3103
3112
|
constructor() {
|
|
3104
3113
|
const data = inject(NATURAL_DROPDOWN_DATA);
|
|
3105
3114
|
this.configuration = { ...this.defaults, ...data.configuration };
|
|
3115
|
+
this.operators = this.configuration.nullable ? possibleNullComparableOperators : possibleComparableOperators;
|
|
3106
3116
|
this.todayCtrl.valueChanges.pipe(takeUntilDestroyed()).subscribe(isToday => {
|
|
3107
3117
|
if (isToday) {
|
|
3108
3118
|
this.valueCtrl.setValue(this.dateAdapter.today());
|
|
@@ -3115,15 +3125,21 @@ class TypeDateComponent {
|
|
|
3115
3125
|
merge$1(this.operatorCtrl.valueChanges, this.valueCtrl.valueChanges, this.todayCtrl.valueChanges)
|
|
3116
3126
|
.pipe(takeUntilDestroyed())
|
|
3117
3127
|
.subscribe(() => this.renderedValue.next(this.getRenderedValue()));
|
|
3118
|
-
|
|
3128
|
+
// Immediately initValidators and everytime the operator change later
|
|
3129
|
+
this.operatorCtrl.valueChanges.pipe(startWith(null)).subscribe(() => this.initValidators());
|
|
3119
3130
|
this.reloadCondition(data.condition);
|
|
3120
3131
|
}
|
|
3121
3132
|
getCondition() {
|
|
3122
|
-
|
|
3133
|
+
let operator = this.operatorCtrl.value;
|
|
3134
|
+
if (operator === 'any') {
|
|
3135
|
+
return { null: { not: true } };
|
|
3136
|
+
}
|
|
3137
|
+
else if (operator === 'none') {
|
|
3138
|
+
return { null: { not: false } };
|
|
3139
|
+
}
|
|
3140
|
+
else if (!this.valueCtrl.value) {
|
|
3123
3141
|
return {};
|
|
3124
3142
|
}
|
|
3125
|
-
const condition = {};
|
|
3126
|
-
let operator = this.operatorCtrl.value;
|
|
3127
3143
|
let date;
|
|
3128
3144
|
let dayAfter;
|
|
3129
3145
|
if (this.todayCtrl.value) {
|
|
@@ -3135,8 +3151,10 @@ class TypeDateComponent {
|
|
|
3135
3151
|
dayAfter = serialize(this.dateAdapter, this.getDayAfter(this.valueCtrl.value));
|
|
3136
3152
|
}
|
|
3137
3153
|
if (operator === 'equal') {
|
|
3138
|
-
|
|
3139
|
-
|
|
3154
|
+
return {
|
|
3155
|
+
greaterOrEqual: { value: date },
|
|
3156
|
+
less: { value: dayAfter },
|
|
3157
|
+
};
|
|
3140
3158
|
}
|
|
3141
3159
|
else {
|
|
3142
3160
|
// Transparently adapt exclusive/inclusive ranges
|
|
@@ -3150,9 +3168,8 @@ class TypeDateComponent {
|
|
|
3150
3168
|
date = dayAfter;
|
|
3151
3169
|
}
|
|
3152
3170
|
}
|
|
3153
|
-
|
|
3171
|
+
return { [operator]: { value: date } };
|
|
3154
3172
|
}
|
|
3155
|
-
return condition;
|
|
3156
3173
|
}
|
|
3157
3174
|
isValid() {
|
|
3158
3175
|
return this.form.valid;
|
|
@@ -3170,12 +3187,19 @@ class TypeDateComponent {
|
|
|
3170
3187
|
this.setTodayOrDate(condition.greaterOrEqual.value);
|
|
3171
3188
|
return;
|
|
3172
3189
|
}
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3190
|
+
const operatorKey = this.conditionToOperatorKey(condition);
|
|
3191
|
+
this.operatorCtrl.setValue(operatorKey);
|
|
3192
|
+
this.setTodayOrDate(condition[operatorKey]?.value);
|
|
3193
|
+
}
|
|
3194
|
+
conditionToOperatorKey(condition) {
|
|
3195
|
+
if (condition.null?.not) {
|
|
3196
|
+
return 'any';
|
|
3197
|
+
}
|
|
3198
|
+
else if (condition.null && !condition.null.not) {
|
|
3199
|
+
return 'none';
|
|
3200
|
+
}
|
|
3201
|
+
else {
|
|
3202
|
+
return this.operators.find(operator => condition[operator.key])?.key ?? 'equal';
|
|
3179
3203
|
}
|
|
3180
3204
|
}
|
|
3181
3205
|
setTodayOrDate(value) {
|
|
@@ -3189,7 +3213,9 @@ class TypeDateComponent {
|
|
|
3189
3213
|
}
|
|
3190
3214
|
}
|
|
3191
3215
|
initValidators() {
|
|
3192
|
-
const
|
|
3216
|
+
const blacklist = ['any', 'none'];
|
|
3217
|
+
this.requireValueCtrl = !blacklist.includes(this.operatorCtrl.value);
|
|
3218
|
+
const validators = this.requireValueCtrl ? [Validators.required] : [];
|
|
3193
3219
|
if (this.configuration.min) {
|
|
3194
3220
|
validators.push(dateMin(this.dateAdapter, this.configuration.min));
|
|
3195
3221
|
}
|
|
@@ -3197,6 +3223,7 @@ class TypeDateComponent {
|
|
|
3197
3223
|
validators.push(dateMax(this.dateAdapter, this.configuration.max));
|
|
3198
3224
|
}
|
|
3199
3225
|
this.valueCtrl.setValidators(validators);
|
|
3226
|
+
this.valueCtrl.updateValueAndValidity();
|
|
3200
3227
|
}
|
|
3201
3228
|
getDayAfter(date) {
|
|
3202
3229
|
return this.dateAdapter.addCalendarDays(this.dateAdapter.clone(date), 1);
|
|
@@ -3210,7 +3237,10 @@ class TypeDateComponent {
|
|
|
3210
3237
|
else if (this.valueCtrl.value) {
|
|
3211
3238
|
value = this.dateAdapter.format(this.valueCtrl.value, this.dateFormats.display.dateInput);
|
|
3212
3239
|
}
|
|
3213
|
-
if (operator &&
|
|
3240
|
+
if (operator && ['any', 'none'].includes(operator.key)) {
|
|
3241
|
+
return operator.label;
|
|
3242
|
+
}
|
|
3243
|
+
else if (operator && value) {
|
|
3214
3244
|
return operator.label + ' ' + value;
|
|
3215
3245
|
}
|
|
3216
3246
|
else {
|
|
@@ -3218,7 +3248,7 @@ class TypeDateComponent {
|
|
|
3218
3248
|
}
|
|
3219
3249
|
}
|
|
3220
3250
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeDateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3221
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeDateComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n
|
|
3251
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeDateComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<form [formGroup]=\"form\" [class.nullable]=\"configuration.nullable\">\n <mat-form-field>\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (requireValueCtrl) {\n <mat-form-field>\n <mat-label i18n>Date</mat-label>\n <input\n matInput\n [formControl]=\"valueCtrl\"\n [matDatepicker]=\"value\"\n [max]=\"configuration.max\"\n [min]=\"configuration.min\"\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"value\" />\n <mat-datepicker #value />\n @if (valueCtrl.hasError('min')) {\n <mat-error>< {{ configuration.min }}</mat-error>\n }\n @if (valueCtrl.hasError('max')) {\n <mat-error>> {{ configuration.max }}</mat-error>\n }\n @if (valueCtrl.hasError('required')) {\n <mat-error>*</mat-error>\n }\n </mat-form-field>\n\n <mat-checkbox i18n [formControl]=\"todayCtrl\">Aujourd'hui</mat-checkbox>\n }\n</form>\n", styles: ["form{display:grid;grid:auto auto/4em auto;grid-gap:0 1em}form.nullable{grid:auto auto/6em auto}form>mat-checkbox{grid-column-start:2;margin-bottom:.3em}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }] });
|
|
3222
3252
|
}
|
|
3223
3253
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeDateComponent, decorators: [{
|
|
3224
3254
|
type: Component,
|
|
@@ -3236,7 +3266,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
|
|
|
3236
3266
|
MatDatepickerInput,
|
|
3237
3267
|
MatDatepickerToggle,
|
|
3238
3268
|
MatCheckbox,
|
|
3239
|
-
], template: "<form [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n <mat-form-field>\n
|
|
3269
|
+
], template: "<form [formGroup]=\"form\" [class.nullable]=\"configuration.nullable\">\n <mat-form-field>\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (requireValueCtrl) {\n <mat-form-field>\n <mat-label i18n>Date</mat-label>\n <input\n matInput\n [formControl]=\"valueCtrl\"\n [matDatepicker]=\"value\"\n [max]=\"configuration.max\"\n [min]=\"configuration.min\"\n />\n <mat-datepicker-toggle matIconSuffix [for]=\"value\" />\n <mat-datepicker #value />\n @if (valueCtrl.hasError('min')) {\n <mat-error>< {{ configuration.min }}</mat-error>\n }\n @if (valueCtrl.hasError('max')) {\n <mat-error>> {{ configuration.max }}</mat-error>\n }\n @if (valueCtrl.hasError('required')) {\n <mat-error>*</mat-error>\n }\n </mat-form-field>\n\n <mat-checkbox i18n [formControl]=\"todayCtrl\">Aujourd'hui</mat-checkbox>\n }\n</form>\n", styles: ["form{display:grid;grid:auto auto/4em auto;grid-gap:0 1em}form.nullable{grid:auto auto/6em auto}form>mat-checkbox{grid-column-start:2;margin-bottom:.3em}\n"] }]
|
|
3240
3270
|
}], ctorParameters: () => [] });
|
|
3241
3271
|
|
|
3242
3272
|
function toGraphQLDoctrineFilter(facets, selections) {
|
|
@@ -4925,7 +4955,7 @@ class NaturalAbstractModelService {
|
|
|
4925
4955
|
// available. To fix that, we can rely on RxJS, which is able to emit synchronously the value we just
|
|
4926
4956
|
// got from server. Once Apollo Client moves to RxJS (https://github.com/apollographql/apollo-feature-requests/issues/375),
|
|
4927
4957
|
// we could try to remove `startWith()`.
|
|
4928
|
-
return onlyNetwork.pipe(map(firstValue => onlyCache.pipe(startWith(firstValue))));
|
|
4958
|
+
return onlyNetwork.pipe(map(firstValue => onlyCache.pipe(startWith$1(firstValue))));
|
|
4929
4959
|
}
|
|
4930
4960
|
else {
|
|
4931
4961
|
return of(of(this.getDefaultForServer()));
|
|
@@ -6186,7 +6216,7 @@ class NaturalSeoService {
|
|
|
6186
6216
|
constructor() {
|
|
6187
6217
|
const configToken = inject(NATURAL_SEO_CONFIG);
|
|
6188
6218
|
combineLatest({
|
|
6189
|
-
config: configToken instanceof Observable ? configToken.pipe(startWith
|
|
6219
|
+
config: configToken instanceof Observable ? configToken.pipe(startWith(this.config)) : of(configToken),
|
|
6190
6220
|
navigationEnd: this.router.events.pipe(filter$1(event => event instanceof NavigationEnd)),
|
|
6191
6221
|
})
|
|
6192
6222
|
.pipe(takeUntilDestroyed(), switchMap(({ config }) => {
|
|
@@ -6492,7 +6522,7 @@ class TypeSelectComponent {
|
|
|
6492
6522
|
const data = inject(NATURAL_DROPDOWN_DATA);
|
|
6493
6523
|
this.configuration = { ...this.defaults, ...data.configuration };
|
|
6494
6524
|
// Immediately initValidators and everytime the operator change later
|
|
6495
|
-
this.operatorCtrl.valueChanges.pipe(startWith(null)).subscribe(() => this.initValidators());
|
|
6525
|
+
this.operatorCtrl.valueChanges.pipe(startWith$1(null)).subscribe(() => this.initValidators());
|
|
6496
6526
|
merge$1(this.operatorCtrl.valueChanges, this.valueCtrl.valueChanges).subscribe(() => {
|
|
6497
6527
|
const rendered = this.getRenderedValue();
|
|
6498
6528
|
this.renderedValue.next(rendered);
|
|
@@ -6649,7 +6679,7 @@ class AbstractAssociationSelectComponent {
|
|
|
6649
6679
|
const data = inject(NATURAL_DROPDOWN_DATA);
|
|
6650
6680
|
this.configuration = data.configuration;
|
|
6651
6681
|
// Immediately initValidators and everytime the operator change later
|
|
6652
|
-
this.operatorCtrl.valueChanges.pipe(startWith(null)).subscribe(() => this.initValidators());
|
|
6682
|
+
this.operatorCtrl.valueChanges.pipe(startWith$1(null)).subscribe(() => this.initValidators());
|
|
6653
6683
|
merge$1(this.operatorCtrl.valueChanges, this.valueCtrl.valueChanges).subscribe(() => {
|
|
6654
6684
|
const rendered = this.getRenderedValue();
|
|
6655
6685
|
this.renderedValue.next(rendered);
|
|
@@ -7301,34 +7331,44 @@ class TypeNumberComponent {
|
|
|
7301
7331
|
renderedValue = new BehaviorSubject('');
|
|
7302
7332
|
configuration;
|
|
7303
7333
|
operatorCtrl = new FormControl('equal', { nonNullable: true });
|
|
7304
|
-
valueCtrl = new FormControl();
|
|
7334
|
+
valueCtrl = new FormControl(null);
|
|
7305
7335
|
matcher = new InvalidWithValueStateMatcher$1();
|
|
7306
7336
|
form = new FormGroup({
|
|
7307
7337
|
operator: this.operatorCtrl,
|
|
7308
7338
|
value: this.valueCtrl,
|
|
7309
7339
|
});
|
|
7310
|
-
|
|
7340
|
+
requireValueCtrl = false;
|
|
7341
|
+
operators;
|
|
7311
7342
|
defaults = {
|
|
7312
7343
|
min: null,
|
|
7313
7344
|
max: null,
|
|
7314
7345
|
step: null,
|
|
7346
|
+
nullable: false,
|
|
7315
7347
|
};
|
|
7316
7348
|
constructor() {
|
|
7317
7349
|
const data = inject(NATURAL_DROPDOWN_DATA);
|
|
7318
7350
|
this.configuration = { ...this.defaults, ...data.configuration };
|
|
7351
|
+
this.operators = this.configuration.nullable ? possibleNullComparableOperators : possibleComparableOperators;
|
|
7319
7352
|
merge$1(this.operatorCtrl.valueChanges, this.valueCtrl.valueChanges).subscribe(() => {
|
|
7320
7353
|
const rendered = this.getRenderedValue();
|
|
7321
7354
|
this.renderedValue.next(rendered);
|
|
7322
7355
|
});
|
|
7323
|
-
|
|
7356
|
+
// Immediately initValidators and everytime the operator change later
|
|
7357
|
+
this.operatorCtrl.valueChanges.pipe(startWith$1(null)).subscribe(() => this.initValidators());
|
|
7324
7358
|
this.reloadCondition(data.condition);
|
|
7325
7359
|
}
|
|
7326
7360
|
getCondition() {
|
|
7327
|
-
const
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7361
|
+
const key = this.operatorCtrl.value;
|
|
7362
|
+
const value = this.valueCtrl.value;
|
|
7363
|
+
switch (key) {
|
|
7364
|
+
case 'any':
|
|
7365
|
+
return { null: { not: true } };
|
|
7366
|
+
case 'none':
|
|
7367
|
+
return { null: { not: false } };
|
|
7368
|
+
default: {
|
|
7369
|
+
return { [key]: { value: value } };
|
|
7370
|
+
}
|
|
7371
|
+
}
|
|
7332
7372
|
}
|
|
7333
7373
|
isValid() {
|
|
7334
7374
|
return this.form.valid;
|
|
@@ -7345,7 +7385,9 @@ class TypeNumberComponent {
|
|
|
7345
7385
|
}
|
|
7346
7386
|
}
|
|
7347
7387
|
initValidators() {
|
|
7348
|
-
const
|
|
7388
|
+
const blacklist = ['any', 'none'];
|
|
7389
|
+
this.requireValueCtrl = !blacklist.includes(this.operatorCtrl.value);
|
|
7390
|
+
const validators = this.requireValueCtrl ? [Validators.required] : [];
|
|
7349
7391
|
if (typeof this.configuration.min === 'number') {
|
|
7350
7392
|
validators.push(Validators.min(this.configuration.min));
|
|
7351
7393
|
}
|
|
@@ -7358,34 +7400,45 @@ class TypeNumberComponent {
|
|
|
7358
7400
|
validators.push(decimal(decimalCount));
|
|
7359
7401
|
}
|
|
7360
7402
|
this.valueCtrl.setValidators(validators);
|
|
7403
|
+
this.valueCtrl.updateValueAndValidity();
|
|
7361
7404
|
}
|
|
7362
7405
|
reloadCondition(condition) {
|
|
7363
7406
|
if (!condition) {
|
|
7364
7407
|
return;
|
|
7365
7408
|
}
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
this.operatorCtrl.setValue(operator.key);
|
|
7370
|
-
this.valueCtrl.setValue(reloadedCondition.value);
|
|
7371
|
-
}
|
|
7372
|
-
}
|
|
7409
|
+
const operatorKey = this.conditionToOperatorKey(condition);
|
|
7410
|
+
this.operatorCtrl.setValue(operatorKey);
|
|
7411
|
+
this.valueCtrl.setValue(condition[operatorKey]?.value);
|
|
7373
7412
|
}
|
|
7374
7413
|
getRenderedValue() {
|
|
7375
7414
|
const operator = this.operators.find(v => v.key === this.operatorCtrl.value);
|
|
7376
|
-
if (
|
|
7415
|
+
if (operator && ['any', 'none'].includes(operator.key)) {
|
|
7416
|
+
return operator.label;
|
|
7417
|
+
}
|
|
7418
|
+
else if (operator && this.valueCtrl.value !== null) {
|
|
7419
|
+
return operator.label + ' ' + this.valueCtrl.value;
|
|
7420
|
+
}
|
|
7421
|
+
else {
|
|
7377
7422
|
return '';
|
|
7378
7423
|
}
|
|
7424
|
+
}
|
|
7425
|
+
conditionToOperatorKey(condition) {
|
|
7426
|
+
if (condition.null?.not) {
|
|
7427
|
+
return 'any';
|
|
7428
|
+
}
|
|
7429
|
+
else if (condition.null && !condition.null.not) {
|
|
7430
|
+
return 'none';
|
|
7431
|
+
}
|
|
7379
7432
|
else {
|
|
7380
|
-
return operator.
|
|
7433
|
+
return this.operators.find(operator => condition[operator.key])?.key ?? 'equal';
|
|
7381
7434
|
}
|
|
7382
7435
|
}
|
|
7383
7436
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeNumberComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7384
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeNumberComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width
|
|
7437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.7", type: TypeNumberComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"margin-right: 1em\" [style.max-width]=\"configuration.nullable ? '6em' : '4em'\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (requireValueCtrl) {\n <mat-form-field>\n <mat-label i18n>Valeur</mat-label>\n <input\n matInput\n type=\"number\"\n [errorStateMatcher]=\"matcher\"\n [formControl]=\"valueCtrl\"\n [attr.max]=\"configuration.max\"\n [attr.min]=\"configuration.min\"\n [required]=\"true\"\n [step]=\"configuration.step\"\n (keydown.enter)=\"close()\"\n />\n @if (valueCtrl.hasError('min')) {\n <mat-error>< {{ configuration.min }}</mat-error>\n }\n @if (valueCtrl.hasError('max')) {\n <mat-error>> {{ configuration.max }}</mat-error>\n }\n </mat-form-field>\n }\n</form>\n", styles: [":host input::-webkit-outer-spin-button,:host input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "directive", type: MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }] });
|
|
7385
7438
|
}
|
|
7386
7439
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImport: i0, type: TypeNumberComponent, decorators: [{
|
|
7387
7440
|
type: Component,
|
|
7388
|
-
args: [{ imports: [FormsModule, ReactiveFormsModule, MatFormField, MatLabel, MatError, MatSelect, MatOption, MatInput], template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"max-width
|
|
7441
|
+
args: [{ imports: [FormsModule, ReactiveFormsModule, MatFormField, MatLabel, MatError, MatSelect, MatOption, MatInput], template: "<form [formGroup]=\"form\">\n <mat-form-field style=\"margin-right: 1em\" [style.max-width]=\"configuration.nullable ? '6em' : '4em'\">\n <mat-label i18n=\"Mathematical operator < > =\">Op\u00E9rateur</mat-label>\n <mat-select panelWidth=\"\" [formControl]=\"operatorCtrl\" [required]=\"true\">\n @for (item of operators; track item) {\n <mat-option [value]=\"item.key\">\n {{ item.label }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n\n @if (requireValueCtrl) {\n <mat-form-field>\n <mat-label i18n>Valeur</mat-label>\n <input\n matInput\n type=\"number\"\n [errorStateMatcher]=\"matcher\"\n [formControl]=\"valueCtrl\"\n [attr.max]=\"configuration.max\"\n [attr.min]=\"configuration.min\"\n [required]=\"true\"\n [step]=\"configuration.step\"\n (keydown.enter)=\"close()\"\n />\n @if (valueCtrl.hasError('min')) {\n <mat-error>< {{ configuration.min }}</mat-error>\n }\n @if (valueCtrl.hasError('max')) {\n <mat-error>> {{ configuration.max }}</mat-error>\n }\n </mat-form-field>\n }\n</form>\n", styles: [":host input::-webkit-outer-spin-button,:host input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}\n"] }]
|
|
7389
7442
|
}], ctorParameters: () => [] });
|
|
7390
7443
|
|
|
7391
7444
|
class FacetSelectorComponent {
|
|
@@ -11353,5 +11406,5 @@ function graphqlQuerySigner(key) {
|
|
|
11353
11406
|
* Generated bundle index. Do not edit.
|
|
11354
11407
|
*/
|
|
11355
11408
|
|
|
11356
|
-
export { AvatarService, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColumnsPickerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorMessagePipe, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, greaterThan, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, nfcCardHex, onHistoryEvent, possibleComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, time, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, url, urlPattern, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
|
|
11409
|
+
export { AvatarService, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColumnsPickerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalErrorMessagePipe, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, commonImageMimeTypes, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, greaterThan, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, nfcCardHex, onHistoryEvent, possibleComparableOperators, possibleNullComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, time, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, url, urlPattern, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
|
|
11357
11410
|
//# sourceMappingURL=ecodev-natural.mjs.map
|