From b7d7123a2493dbd157c706e715417b84b0d99a62 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Mon, 16 Oct 2023 18:13:42 +0900 Subject: [PATCH] Keep things as readonly as possible #9604 --- projects/natural/src/lib/modules/panels/panels.service.ts | 2 +- .../search/dropdown-container/dropdown-container.component.ts | 2 +- .../modules/search/facet-selector/facet-selector.component.ts | 2 +- .../natural/src/lib/modules/select/select/select.component.ts | 2 +- src/app/AbstractSelect.ts | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/projects/natural/src/lib/modules/panels/panels.service.ts b/projects/natural/src/lib/modules/panels/panels.service.ts index 68fb0cc8..7ab4f9b6 100644 --- a/projects/natural/src/lib/modules/panels/panels.service.ts +++ b/projects/natural/src/lib/modules/panels/panels.service.ts @@ -45,7 +45,7 @@ export class NaturalPanelsService { /** * Stream that emits when all open dialog have finished closing */ - public afterAllClosed = new Subject(); + public readonly afterAllClosed = new Subject(); /** * Cache for panels counter. Works more like an ID. * Is used to give an unique identifier to multiple similar panels configurations diff --git a/projects/natural/src/lib/modules/search/dropdown-container/dropdown-container.component.ts b/projects/natural/src/lib/modules/search/dropdown-container/dropdown-container.component.ts index 1597f7ed..0f5bc2b0 100644 --- a/projects/natural/src/lib/modules/search/dropdown-container/dropdown-container.component.ts +++ b/projects/natural/src/lib/modules/search/dropdown-container/dropdown-container.component.ts @@ -49,7 +49,7 @@ export class NaturalDropdownContainerComponent extends BasePortalOutlet implemen public panelAnimationState: 'void' | 'enter' = 'void'; /** Emits whenever an animation on the menu completes. */ - private animationDone = new Subject(); + private readonly animationDone = new Subject(); private focusTrap: FocusTrap | null = null; private elementFocusedBeforeDialogWasOpened: HTMLElement | null = null; diff --git a/projects/natural/src/lib/modules/search/facet-selector/facet-selector.component.ts b/projects/natural/src/lib/modules/search/facet-selector/facet-selector.component.ts index b569ff6e..bb0fa49b 100644 --- a/projects/natural/src/lib/modules/search/facet-selector/facet-selector.component.ts +++ b/projects/natural/src/lib/modules/search/facet-selector/facet-selector.component.ts @@ -23,7 +23,7 @@ export interface FacetSelectorConfiguration { }) export class FacetSelectorComponent implements DropdownComponent { // Never has a real value - public renderedValue = new BehaviorSubject(''); + public readonly renderedValue = new BehaviorSubject(''); public facets: NaturalSearchFacets; public selection: Facet | null = null; diff --git a/projects/natural/src/lib/modules/select/select/select.component.ts b/projects/natural/src/lib/modules/select/select/select.component.ts index a60ba6d1..dcfc37f1 100644 --- a/projects/natural/src/lib/modules/select/select/select.component.ts +++ b/projects/natural/src/lib/modules/select/select/select.component.ts @@ -153,7 +153,7 @@ export class NaturalSelectComponent< /** * Init search options */ - private variablesManager = new NaturalQueryVariablesManager(); + private readonly variablesManager = new NaturalQueryVariablesManager(); /** * Whether the value can be changed diff --git a/src/app/AbstractSelect.ts b/src/app/AbstractSelect.ts index 2ec86260..da4f787b 100644 --- a/src/app/AbstractSelect.ts +++ b/src/app/AbstractSelect.ts @@ -7,7 +7,7 @@ import {ErrorService} from '../../projects/natural/src/lib/testing/error.service export class AbstractSelect { public required = true; - public formControl = new FormControl(null, this.getRequiredAtStart()); + public readonly formControl = new FormControl(null, this.getRequiredAtStart()); /** * Form control for new instance testing @@ -17,7 +17,7 @@ export class AbstractSelect { /** * Form group for testing update on formContr11olName directives */ - public formGroup = new FormGroup({ + public readonly formGroup = new FormGroup({ amazingField: new FormControl(null, this.getRequiredAtStart()), });