Angular 19 migration (#10795)

This commit is contained in:
dominikiwanekhyland
2025-07-03 12:09:53 +02:00
committed by GitHub
parent c7f28d54d6
commit 951b22e098
561 changed files with 9574 additions and 17354 deletions

View File

@@ -20,7 +20,6 @@ import { FlagsComponent } from './flags/flags.component';
@Component({
selector: 'adf-feature-flags-wrapper',
standalone: true,
imports: [FlagsComponent],
template: `
<div class="adf-feature-flags-wrapper">

View File

@@ -22,7 +22,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'adf-feature-flags-override-indicator',
standalone: true,
imports: [CommonModule],
styles: [
`

View File

@@ -41,7 +41,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Component({
selector: 'adf-feature-flags-overrides',
standalone: true,
imports: [
FlagsOverrideComponent,
CommonModule,

View File

@@ -27,7 +27,8 @@ import { UnitTestingUtils } from '../../../../src/lib/testing/unit-testing-utils
<div>
<div id="underFeatureFlag" *adfForFeatures="features"></div>
</div>
`
`,
standalone: false
})
class TestWithEnabledFlagComponent {
features = 'feature1';
@@ -37,7 +38,8 @@ class TestWithEnabledFlagComponent {
<div>
<div id="underFeatureFlag" *adfForFeatures="features"></div>
</div>
`
`,
standalone: false
})
class TestWithDisabledFlagComponent {
features = ['feature1', 'feature2'];

View File

@@ -22,13 +22,12 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
/* eslint-disable-next-line @angular-eslint/directive-selector */
selector: '[adfForFeatures]',
standalone: true
selector: '[adfForFeatures]'
})
export class FeaturesDirective {
private hasView = false;
private inputUpdate$ = new BehaviorSubject([] as string[]);
@Input()
set adfForFeatures(feature: string[] | string) {
this.inputUpdate$.next(Array.isArray(feature) ? feature : [feature]);

View File

@@ -27,7 +27,8 @@ import { UnitTestingUtils } from '../../../../src/lib/testing/unit-testing-utils
<div>
<div id="underFeatureFlag" *adfNotForFeatures="features"></div>
</div>
`
`,
standalone: false
})
class TestWithEnabledFlagComponent {
features = ['feature1', 'feature3'];
@@ -38,7 +39,8 @@ class TestWithEnabledFlagComponent {
<div>
<div id="underFeatureFlag" *adfNotForFeatures="features"></div>
</div>
`
`,
standalone: false
})
class TestWithDisabledFlagComponent {
features = 'feature2';

View File

@@ -22,8 +22,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@Directive({
/* eslint-disable-next-line @angular-eslint/directive-selector */
selector: '[adfNotForFeatures]',
standalone: true
selector: '[adfNotForFeatures]'
})
export class NotFeaturesDirective {
private hasView = false;

View File

@@ -15,14 +15,15 @@
* limitations under the License.
*/
import { APP_INITIALIZER } from '@angular/core';
import { inject, provideAppInitializer } from '@angular/core';
import {
FlagsOverrideToken,
FeaturesServiceToken,
QaFeaturesHelperConfig,
WritableFeaturesServiceConfig,
WritableFeaturesServiceConfigToken,
WritableFeaturesServiceToken
WritableFeaturesServiceToken,
IFeaturesService
} from '../interfaces/features.interface';
import { StorageFeaturesService } from '../services/storage-features.service';
import { DebugFeaturesService } from '../services/debug-features.service';
@@ -41,19 +42,18 @@ export function provideDebugFeatureFlags(config: WritableFeaturesServiceConfig &
{ provide: WritableFeaturesServiceConfigToken, useValue: config },
{ provide: WritableFeaturesServiceToken, useClass: StorageFeaturesService },
{ provide: QaFeaturesHelper, useClass: QaFeaturesHelper },
{
provide: APP_INITIALIZER,
useFactory: (featuresService: StorageFeaturesService) => () => featuresService.init(),
deps: [WritableFeaturesServiceToken],
multi: true
},
{
provide: APP_INITIALIZER,
useFactory: (qaFeaturesHelper: QaFeaturesHelper, document: Document & { [key: string]: QaFeaturesHelper }) => () => {
provideAppInitializer(() => {
const initializerFn = (
(featuresService: IFeaturesService) => () =>
featuresService.init()
)(inject(WritableFeaturesServiceToken));
return initializerFn();
}),
provideAppInitializer(() => {
const initializerFn = ((qaFeaturesHelper: QaFeaturesHelper, document: Document) => () => {
document[config.helperExposeKeyOnDocument ?? 'featureOverrides'] = qaFeaturesHelper;
},
deps: [QaFeaturesHelper, DOCUMENT],
multi: true
}
})(inject(QaFeaturesHelper), inject(DOCUMENT));
return initializerFn();
})
];
}