From 5e9a6a6b0816ac975342721891b271bb38206acf Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 27 Sep 2023 18:15:42 +0530 Subject: [PATCH 1/2] Fix Angular errors --- .../component-mapper.component.ts | 15 ++++++++++++++- .../infra/reference/reference.component.ts | 1 - .../wide-narrow-page.component.ts | 1 - .../main-content/main-content.component.html | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts b/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts index 25b22ff0..57b4e6d0 100644 --- a/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts +++ b/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts @@ -17,6 +17,15 @@ export class ComponentMapperComponent implements OnInit, OnChanges { public componentRef: ComponentRef | undefined; public isInitialized: boolean = false; + private componentsRequireDisplayOnlyFAProp: Array = [ + "HybridViewContainer", + "ModalViewContainer", + "ViewContainer", + "RootContainer", + "View", + "CaseView" + ]; + @Input() name: string = ''; @Input() props: any; @Input() errorMsg: string = ''; @@ -84,7 +93,11 @@ export class ComponentMapperComponent implements OnInit, OnChanges { try { for (const propName in this.props) { if (this.props[propName] !== undefined) { - this.componentRef.setInput(propName, this.props[propName]); + // We'll set 'displayOnlyFA$' prop only to the components which really need it + // Eventual plan is to get rid of this particular prop + if(propName !== "displayOnlyFA$" || (propName === "displayOnlyFA$" && this.componentsRequireDisplayOnlyFAProp.includes(this.name))){ + this.componentRef.setInput(propName, this.props[propName]); + } } } } catch (e) { diff --git a/packages/angular-sdk-components/src/app/_components/infra/reference/reference.component.ts b/packages/angular-sdk-components/src/app/_components/infra/reference/reference.component.ts index a868f446..b687a378 100644 --- a/packages/angular-sdk-components/src/app/_components/infra/reference/reference.component.ts +++ b/packages/angular-sdk-components/src/app/_components/infra/reference/reference.component.ts @@ -14,7 +14,6 @@ import { Component, OnInit, Input } from '@angular/core'; }) export class ReferenceComponent implements OnInit { @Input() pConn$: any; - @Input() displayOnlyFA$: boolean; configProps$: Object; referencedComponent: any = null; diff --git a/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts b/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts index ef7f72b2..c4bf8de6 100644 --- a/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts +++ b/packages/angular-sdk-components/src/app/_components/template/wide-narrow-page/wide-narrow-page.component.ts @@ -14,7 +14,6 @@ import { ComponentMapperComponent } from '../../../_bridge/component-mapper/comp export class WideNarrowPageComponent implements OnInit { @Input() pConn$: any; @Input() formGroup$: FormGroup; - @Input() displayOnlyFA$; thePConnType: string = ''; diff --git a/packages/angular-sdk-components/src/app/_samples/simple-portal/main-content/main-content.component.html b/packages/angular-sdk-components/src/app/_samples/simple-portal/main-content/main-content.component.html index 1f7fafe7..f03cc14d 100644 --- a/packages/angular-sdk-components/src/app/_samples/simple-portal/main-content/main-content.component.html +++ b/packages/angular-sdk-components/src/app/_samples/simple-portal/main-content/main-content.component.html @@ -4,5 +4,5 @@
- +
From 98229963e8aa82a57951fc6bbf23c6d51bc05e6e Mon Sep 17 00:00:00 2001 From: Vishal Date: Thu, 28 Sep 2023 21:28:23 +0530 Subject: [PATCH 2/2] Make componentsRequireDisplayOnlyFAProp a separate constant --- .../component-mapper.component.ts | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts b/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts index 57b4e6d0..bd52f7a7 100644 --- a/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts +++ b/packages/angular-sdk-components/src/app/_bridge/component-mapper/component-mapper.component.ts @@ -3,6 +3,16 @@ import { CommonModule } from '@angular/common'; import { SdkComponentMap } from '../helpers/sdk_component_map'; import { ErrorBoundaryComponent } from '../../_components/infra/error-boundary/error-boundary.component'; + +const componentsRequireDisplayOnlyFAProp: Array = [ + "HybridViewContainer", + "ModalViewContainer", + "ViewContainer", + "RootContainer", + "View", + "CaseView" +]; + @Component({ selector: 'component-mapper', templateUrl: './component-mapper.component.html', @@ -17,15 +27,6 @@ export class ComponentMapperComponent implements OnInit, OnChanges { public componentRef: ComponentRef | undefined; public isInitialized: boolean = false; - private componentsRequireDisplayOnlyFAProp: Array = [ - "HybridViewContainer", - "ModalViewContainer", - "ViewContainer", - "RootContainer", - "View", - "CaseView" - ]; - @Input() name: string = ''; @Input() props: any; @Input() errorMsg: string = ''; @@ -95,9 +96,11 @@ export class ComponentMapperComponent implements OnInit, OnChanges { if (this.props[propName] !== undefined) { // We'll set 'displayOnlyFA$' prop only to the components which really need it // Eventual plan is to get rid of this particular prop - if(propName !== "displayOnlyFA$" || (propName === "displayOnlyFA$" && this.componentsRequireDisplayOnlyFAProp.includes(this.name))){ - this.componentRef.setInput(propName, this.props[propName]); + if(propName === "displayOnlyFA$" && !componentsRequireDisplayOnlyFAProp.includes(this.name)){ + // eslint-disable-next-line no-continue + continue; } + this.componentRef.setInput(propName, this.props[propName]); } } } catch (e) {