@pega/angular-sdk-overrides
Advanced tools
Comparing version 0.24.5 to 0.24.6
@@ -48,4 +48,7 @@ import { Component, ElementRef, OnInit, Input, Renderer2, ChangeDetectorRef, OnChanges, SimpleChanges, OnDestroy } from '@angular/core'; | ||
// eslint-disable-next-line @angular-eslint/no-empty-lifecycle-method | ||
ngOnDestroy(): void { | ||
this.renderer.destroy(); | ||
// Ref: https://medium.com/@kamil.galek/mythical-angular-component-styles-cleanup-in-angular-17-f799a08b2abc | ||
// Commenting the below line as it is causing the Operator component's styles not getting applied. | ||
// this.renderer.destroy(); | ||
} | ||
@@ -52,0 +55,0 @@ |
@@ -171,2 +171,11 @@ import { Component, OnInit, Input, ChangeDetectorRef, forwardRef, OnDestroy } from '@angular/core'; | ||
fieldOnDateChange(event: any) { | ||
// this comes from the date pop up | ||
if (typeof event.value === 'object') { | ||
// convert date to pega "date" format | ||
event.value = event.value?.toISOString(); | ||
} | ||
this.angularPConnectData.actions?.onChange(this, { value: event.value }); | ||
} | ||
fieldOnBlur(event: any) { | ||
@@ -173,0 +182,0 @@ if (typeof event.value === 'object') { |
@@ -41,3 +41,2 @@ /* eslint-disable no-case-declarations */ | ||
bIsRefComponent = false; | ||
bInitialized = false; | ||
@@ -133,31 +132,11 @@ | ||
updateChanges() { | ||
this.bIsRefComponent = this.checkIfRefComponent(this.pConn$); | ||
// pConn$ may be a 'reference' component, so normalize it | ||
this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$); | ||
this.ngZone.run(() => { | ||
// pConn$ may be a 'reference' component, so normalize it | ||
// this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); | ||
this.newPConn$ = ReferenceComponent.normalizePConn(this.pConn$); | ||
// If 'reference' so we need to get the children of the normalized pConn | ||
if (this.bIsRefComponent) { | ||
// this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); | ||
this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren()); | ||
} | ||
}); | ||
this.createButtons(); | ||
} | ||
checkIfRefComponent(thePConn: any): boolean { | ||
let bReturn = false; | ||
if (thePConn && thePConn.getComponentName() == 'reference') { | ||
bReturn = true; | ||
if (this.arChildren$) { | ||
this.createButtons(); | ||
} | ||
return bReturn; | ||
} | ||
initComponent() { | ||
this.bIsRefComponent = this.checkIfRefComponent(this.pConn$); | ||
// pConn$ may be a 'reference' component, so normalize it | ||
@@ -167,8 +146,2 @@ // this.pConn$ = ReferenceComponent.normalizePConn(this.pConn$); | ||
// If 'reference' so we need to get the children of the normalized pConn | ||
if (this.bIsRefComponent) { | ||
// this.arChildren$ = ReferenceComponent.normalizePConnArray(this.pConn$.getChildren()); | ||
this.arChildren$ = ReferenceComponent.normalizePConnArray(this.newPConn$.getChildren()); | ||
} | ||
// prevent re-intializing with flowContainer update unless an action is taken | ||
@@ -216,3 +189,5 @@ this.bReInit = false; | ||
this.createButtons(); | ||
if (this.arChildren$) { | ||
this.createButtons(); | ||
} | ||
} | ||
@@ -219,0 +194,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { Component, OnInit, Input, ChangeDetectorRef, NgZone, forwardRef, OnDestroy } from '@angular/core'; | ||
import { Component, OnInit, Input, ChangeDetectorRef, NgZone, forwardRef, OnDestroy, Injector } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
@@ -6,3 +6,2 @@ import { FormBuilder, FormGroup } from '@angular/forms'; | ||
import { publicConstants } from '@pega/pcore-pconnect-typedefs/constants'; | ||
import { AngularPConnectData, AngularPConnectService } from '@pega/angular-sdk-components'; | ||
import { ProgressSpinnerService } from '@pega/angular-sdk-components'; | ||
@@ -13,2 +12,3 @@ import { ReferenceComponent } from '@pega/angular-sdk-components'; | ||
import { ComponentMapperComponent } from '@pega/angular-sdk-components'; | ||
import { FlowContainerBaseComponent } from '@pega/angular-sdk-components'; | ||
@@ -37,7 +37,5 @@ /** | ||
}) | ||
export class FlowContainerComponent implements OnInit, OnDestroy { | ||
export class FlowContainerComponent extends FlowContainerBaseComponent implements OnInit, OnDestroy { | ||
@Input() pConn$: typeof PConnect; | ||
// For interaction with AngularPConnect | ||
angularPConnectData: AngularPConnectData = {}; | ||
pCoreConstants: typeof publicConstants; | ||
@@ -78,4 +76,6 @@ configProps$: FlowContainerProps; | ||
pConnectOfActiveContainerItem; | ||
constructor( | ||
private angularPConnect: AngularPConnectService, | ||
injector: Injector, | ||
private cdRef: ChangeDetectorRef, | ||
@@ -87,2 +87,3 @@ private psService: ProgressSpinnerService, | ||
) { | ||
super(injector); | ||
// create the formGroup | ||
@@ -156,6 +157,10 @@ this.formGroup$ = this.fb.group({ hideRequired: false }); | ||
const pConn = this.pConnectOfActiveContainerItem || this.pConn$; | ||
const caseViewModeFromProps = this.angularPConnect.getComponentProp(this, 'caseViewMode'); | ||
const caseViewModeFromRedux = pConn.getValue('context_data.caseViewMode', ''); | ||
// ONLY call updateSelf when the component should update | ||
// AND removing the "gate" that was put there since shouldComponentUpdate | ||
// should be the real "gate" | ||
if (bUpdateSelf) { | ||
if (bUpdateSelf || caseViewModeFromProps !== caseViewModeFromRedux) { | ||
// don't want to redraw the flow container when there are page messages, because | ||
@@ -378,3 +383,5 @@ // the redraw causes us to loose the errors on the elements | ||
const caseViewMode = this.pConn$.getValue('context_data.caseViewMode'); | ||
this.pConnectOfActiveContainerItem = this.getPConnectOfActiveContainerItem(this.pConn$) || this.pConn$; | ||
const caseViewMode = this.pConnectOfActiveContainerItem.getValue('context_data.caseViewMode'); | ||
this.bShowBanner = showBanner(this.pConn$); | ||
@@ -381,0 +388,0 @@ |
@@ -9,2 +9,3 @@ import { Component, OnInit, Input, Output, EventEmitter, NgZone, forwardRef, OnDestroy } from '@angular/core'; | ||
import { getBanners } from '@pega/angular-sdk-components'; | ||
import { ReferenceComponent } from '@pega/angular-sdk-components'; | ||
@@ -204,3 +205,3 @@ /** | ||
createView(routingInfo, currentItem, latestItem, key) { | ||
const configObject = this.getConfigObject(currentItem, this.pConn$); | ||
const configObject = this.getConfigObject(currentItem, null, false); | ||
const newComp = configObject?.getPConnect(); | ||
@@ -252,4 +253,13 @@ // const newCompName = newComp.getComponentName(); | ||
); | ||
// // update children with new view's children | ||
this.arChildren$ = newComp.getChildren() as any[]; | ||
const bIsRefComponent = this.checkIfRefComponent(newComp); | ||
if (bIsRefComponent) { | ||
const newPConn = ReferenceComponent.normalizePConn(newComp); | ||
this.arChildren$ = ReferenceComponent.normalizePConnArray(newPConn.getChildren()); | ||
} else { | ||
// update children with new view's children | ||
this.arChildren$ = newComp.getChildren(); | ||
} | ||
this.bShowModal$ = true; | ||
@@ -285,6 +295,18 @@ | ||
getConfigObject(item, pConnect) { | ||
getConfigObject(item, pConnect, isReverseCoexistence = false) { | ||
let config; | ||
if (isReverseCoexistence) { | ||
config = { | ||
options: { | ||
pageReference: pConnect?.getPageReference(), | ||
hasForm: true, | ||
containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL | ||
} | ||
}; | ||
return PCore.createPConnect(config); | ||
} | ||
if (item) { | ||
const { context, view } = item; | ||
const config = { | ||
const { context, view, isBulkAction } = item; | ||
const target = PCore.getContainerUtils().getTargetFromContainerItemID(context); | ||
config = { | ||
meta: view, | ||
@@ -295,3 +317,5 @@ options: { | ||
hasForm: true, | ||
containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL | ||
...(isBulkAction && { isBulkAction }), | ||
containerName: pConnect?.getContainerName() || PCore.getConstants().MODAL, | ||
target | ||
} | ||
@@ -304,2 +328,11 @@ }; | ||
checkIfRefComponent(thePConn: any): boolean { | ||
let bReturn = false; | ||
if (thePConn && thePConn.getComponentName() == 'reference') { | ||
bReturn = true; | ||
} | ||
return bReturn; | ||
} | ||
onAlertState(bData: boolean) { | ||
@@ -306,0 +339,0 @@ this.bAlertState = bData; |
@@ -234,3 +234,3 @@ import { Component, OnInit, Input, NgZone, OnDestroy, OnChanges } from '@angular/core'; | ||
const options: any = { containerName: sTargetContainerName }; | ||
const options: any = { containerName: sTargetContainerName, channelName: '' }; | ||
@@ -237,0 +237,0 @@ if (classname === null || classname === '') { |
{ | ||
"name": "@pega/angular-sdk-overrides", | ||
"version": "0.24.5", | ||
"version": "0.24.6", | ||
"description": "Angular SDK - Code for overriding components", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
928351
518
19132