@dsivd/prestations-ng 19.0.2-beta.1 → 19.0.2-beta.3
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.
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, inject, model, input, viewChildren, viewChild, forwardRef, output, computed, linkedSignal, DestroyRef, effect, Directive, ChangeDetectorRef, Pipe, Component, contentChildren, InjectionToken, signal, ElementRef, makeEnvironmentProviders, ErrorHandler, provideAppInitializer, importProvidersFrom, NgZone, untracked, contentChild, TemplateRef } from '@angular/core';
|
|
2
|
+
import { Injectable, inject, model, input, viewChildren, viewChild, forwardRef, output, computed, linkedSignal, DestroyRef, effect, Directive, ChangeDetectorRef, Pipe, Component, contentChildren, InjectionToken, EnvironmentInjector, runInInjectionContext, signal, ElementRef, makeEnvironmentProviders, ErrorHandler, provideAppInitializer, importProvidersFrom, NgZone, untracked, contentChild, TemplateRef } from '@angular/core';
|
|
3
3
|
import { takeUntilDestroyed, toObservable, outputToObservable } from '@angular/core/rxjs-interop';
|
|
4
4
|
import { Router, ActivatedRoute, RouterLink, NavigationStart, NavigationEnd } from '@angular/router';
|
|
5
5
|
import { Subject, BehaviorSubject, combineLatest, of, filter as filter$1, tap as tap$1, throwError, switchMap as switchMap$1, forkJoin, from, concatMap, toArray, EMPTY, startWith, merge, interval, withLatestFrom, map as map$1, concat } from 'rxjs';
|
|
@@ -2496,6 +2496,7 @@ class FoehnNavigationService {
|
|
|
2496
2496
|
this.location = inject(Location);
|
|
2497
2497
|
this.demandeTransmitInterceptor = inject(DemandeTransmitInterceptor);
|
|
2498
2498
|
this.eventsLoggerService = inject(SdkEventsLoggerService);
|
|
2499
|
+
this.injector = inject(EnvironmentInjector);
|
|
2499
2500
|
this.isInit = false;
|
|
2500
2501
|
this.initializedAndRouteActivated = new BehaviorSubject(false);
|
|
2501
2502
|
this.linearRouting = true;
|
|
@@ -2740,7 +2741,7 @@ class FoehnNavigationService {
|
|
|
2740
2741
|
return !canActivate.some((guardFn) => !this.evaluateGuard(guardFn));
|
|
2741
2742
|
}
|
|
2742
2743
|
evaluateGuard(guardFn) {
|
|
2743
|
-
const guardResult = guardFn(this.route.snapshot, null);
|
|
2744
|
+
const guardResult = runInInjectionContext(this.injector, () => guardFn(this.route.snapshot, null));
|
|
2744
2745
|
if (typeof guardResult !== 'boolean') {
|
|
2745
2746
|
throw new Error('Not implemented: Dynamic routing guards only support boolean results');
|
|
2746
2747
|
}
|
|
@@ -5840,6 +5841,7 @@ class FoehnCheckableGroupComponent extends FoehnInputComponent {
|
|
|
5840
5841
|
this.multiple = signal(false, ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
5841
5842
|
this.ngZone = inject(NgZone);
|
|
5842
5843
|
this._onInitSubject = new Subject();
|
|
5844
|
+
this.disabledByElements = false;
|
|
5843
5845
|
effect(() => {
|
|
5844
5846
|
if (!this.elementsUrl()?.length) {
|
|
5845
5847
|
this.onElementsRetrieved();
|
|
@@ -5914,13 +5916,16 @@ class FoehnCheckableGroupComponent extends FoehnInputComponent {
|
|
|
5914
5916
|
if (this.disabled()) {
|
|
5915
5917
|
return true;
|
|
5916
5918
|
}
|
|
5919
|
+
return this.getElementDisabled(element);
|
|
5920
|
+
}
|
|
5921
|
+
getElementDisabled(element) {
|
|
5917
5922
|
const elementDisabled = this.elementDisabled();
|
|
5918
5923
|
const disabledValue = typeof elementDisabled === 'string'
|
|
5919
5924
|
? ObjectHelper.getNestedProperty(element, elementDisabled)
|
|
5920
5925
|
: elementDisabled(element);
|
|
5921
5926
|
if (typeof disabledValue === 'string') {
|
|
5922
5927
|
const normalizedValue = disabledValue.trim().toLowerCase();
|
|
5923
|
-
return normalizedValue.length
|
|
5928
|
+
return !!normalizedValue.length && normalizedValue === 'true';
|
|
5924
5929
|
}
|
|
5925
5930
|
return !!disabledValue;
|
|
5926
5931
|
}
|
|
@@ -5993,10 +5998,22 @@ class FoehnCheckableGroupComponent extends FoehnInputComponent {
|
|
|
5993
5998
|
this.updateNgModel(this.model_);
|
|
5994
5999
|
});
|
|
5995
6000
|
}
|
|
5996
|
-
//
|
|
6001
|
+
// Sync component disabled state only when it was auto-derived from elements.
|
|
5997
6002
|
const elements = this.elements();
|
|
5998
|
-
if (elements?.length
|
|
5999
|
-
|
|
6003
|
+
if (elements?.length) {
|
|
6004
|
+
const allElementsDisabled = elements.every((elem) => this.getElementDisabled(elem));
|
|
6005
|
+
if (allElementsDisabled && !this.disabled()) {
|
|
6006
|
+
this.disabledByElements = true;
|
|
6007
|
+
this.disabled.set(true);
|
|
6008
|
+
}
|
|
6009
|
+
else if (!allElementsDisabled && this.disabledByElements) {
|
|
6010
|
+
this.disabledByElements = false;
|
|
6011
|
+
this.disabled.set(false);
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
else if (this.disabledByElements) {
|
|
6015
|
+
this.disabledByElements = false;
|
|
6016
|
+
this.disabled.set(false);
|
|
6000
6017
|
}
|
|
6001
6018
|
this.groupedElements = this.getGroupedElements();
|
|
6002
6019
|
this.onInitSubject.next();
|
|
@@ -9009,6 +9026,9 @@ class FoehnRadioComponent extends FoehnCheckableGroupComponent {
|
|
|
9009
9026
|
this.inputValue = this.getValueOrObject(value);
|
|
9010
9027
|
super.onModelChange(value);
|
|
9011
9028
|
}
|
|
9029
|
+
ngAfterViewChecked() {
|
|
9030
|
+
this.syncDisabledState();
|
|
9031
|
+
}
|
|
9012
9032
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9013
9033
|
getValueOrObject(element) {
|
|
9014
9034
|
if (typeof element === 'undefined') {
|
|
@@ -9030,6 +9050,30 @@ class FoehnRadioComponent extends FoehnCheckableGroupComponent {
|
|
|
9030
9050
|
}
|
|
9031
9051
|
return this.getValue(element);
|
|
9032
9052
|
}
|
|
9053
|
+
syncDisabledState() {
|
|
9054
|
+
if (!this.groupedElements?.length) {
|
|
9055
|
+
return;
|
|
9056
|
+
}
|
|
9057
|
+
for (const [groupIndex, elementsGroup,] of this.groupedElements.entries()) {
|
|
9058
|
+
for (const [elementIndex, element,] of elementsGroup.elements.entries()) {
|
|
9059
|
+
const inputId = `${this.buildChildId()}${groupIndex}_${elementIndex}`;
|
|
9060
|
+
const input = document.getElementById(inputId);
|
|
9061
|
+
if (!input) {
|
|
9062
|
+
continue;
|
|
9063
|
+
}
|
|
9064
|
+
const shouldBeDisabled = this.getDisabled(element);
|
|
9065
|
+
if (input.disabled !== shouldBeDisabled) {
|
|
9066
|
+
input.disabled = shouldBeDisabled;
|
|
9067
|
+
}
|
|
9068
|
+
if (shouldBeDisabled) {
|
|
9069
|
+
input.setAttribute('disabled', 'disabled');
|
|
9070
|
+
}
|
|
9071
|
+
else {
|
|
9072
|
+
input.removeAttribute('disabled');
|
|
9073
|
+
}
|
|
9074
|
+
}
|
|
9075
|
+
}
|
|
9076
|
+
}
|
|
9033
9077
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: FoehnRadioComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
9034
9078
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: FoehnRadioComponent, isStandalone: true, selector: "foehn-radio", providers: [
|
|
9035
9079
|
{
|