-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refresh call not happening for calculated fields
- Loading branch information
1 parent
9776770
commit 221f0fa
Showing
7 changed files
with
182 additions
and
43 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
...src/lib/_components/infra/Containers/flow-container-base/flow-container-base.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Injector } from '@angular/core'; | ||
import { getPConnectOfActiveContainerItem } from './helper'; | ||
import { AngularPConnectData, AngularPConnectService } from 'packages/angular-sdk-components/src/public-api'; | ||
|
||
export class FlowContainerBaseComponent { | ||
// For interaction with AngularPConnect | ||
protected angularPConnectData: AngularPConnectData = {}; | ||
protected angularPConnect; | ||
|
||
constructor(injector: Injector) { | ||
this.angularPConnect = injector.get(AngularPConnectService); | ||
} | ||
|
||
getPConnectOfActiveContainerItem(parentPConnect) { | ||
const routingInfo = this.angularPConnect.getComponentProp(this, 'routingInfo'); | ||
const isAssignmentView = this.angularPConnect.getComponentProp(this, 'isAssignmentView'); | ||
return getPConnectOfActiveContainerItem(routingInfo, { | ||
isAssignmentView, | ||
parentPConnect | ||
}); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
...angular-sdk-components/src/lib/_components/infra/Containers/flow-container-base/helper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
const processRootViewDetails = (rootView, containerItem, options) => { | ||
const { | ||
config: { context: viewContext, name: viewName } | ||
} = rootView; | ||
const { context: containerContext } = containerItem; | ||
const { parentPConnect } = options; | ||
let resolvedViewName = viewName; | ||
let resolvedViewContext = viewContext; | ||
|
||
const isAnnotedViewName = PCore.getAnnotationUtils().isProperty(viewName); | ||
const isAnnotedViewContext = PCore.getAnnotationUtils().isProperty(viewContext); | ||
|
||
// resolving annoted view context | ||
if (isAnnotedViewContext) { | ||
const viewContextProperty = PCore.getAnnotationUtils().getPropertyName(viewContext); | ||
resolvedViewContext = PCore.getStoreValue( | ||
`.${viewContextProperty}`, | ||
viewContextProperty.startsWith('.') ? parentPConnect.getPageReference() : '', | ||
containerContext | ||
); | ||
} | ||
|
||
if (!resolvedViewContext) { | ||
resolvedViewContext = parentPConnect.getPageReference(); | ||
} | ||
|
||
// resolving annoted view name | ||
if (isAnnotedViewName) { | ||
const viewNameProperty = PCore.getAnnotationUtils().getPropertyName(viewName); | ||
resolvedViewName = PCore.getStoreValue(`.${viewNameProperty}`, resolvedViewContext, containerContext); | ||
} | ||
|
||
/* Special case where context and viewname are dynamic values | ||
Use case - split for each shape | ||
Ex - (caseInfo.content.SCRequestWorkQueues[1]):context --> .pyViewName:viewName | ||
*/ | ||
if (isAnnotedViewName && isAnnotedViewContext && resolvedViewName !== '') { | ||
/* Allow context processor to resolve view and context when both are dynamic */ | ||
resolvedViewName = viewName; | ||
resolvedViewContext = viewContext; | ||
} | ||
|
||
return { | ||
viewName: resolvedViewName, | ||
viewContext: resolvedViewContext | ||
}; | ||
}; | ||
|
||
export const getPConnectOfActiveContainerItem = (containerInfo, options) => { | ||
const { accessedOrder, items } = containerInfo; | ||
const { isAssignmentView = false, parentPConnect } = options; | ||
const containerName = parentPConnect.getContainerName(); | ||
const { CONTAINER_NAMES } = PCore.getContainerUtils(); | ||
const { CREATE_DETAILS_VIEW_NAME } = PCore.getConstants(); | ||
|
||
if (accessedOrder && items) { | ||
const activeContainerItemKey = accessedOrder[accessedOrder.length - 1]; | ||
|
||
if (items[activeContainerItemKey] && items[activeContainerItemKey].view && Object.keys(items[activeContainerItemKey].view).length > 0) { | ||
const activeContainerItem = items[activeContainerItemKey]; | ||
const target = activeContainerItemKey.substring(0, activeContainerItemKey.lastIndexOf('_')); | ||
|
||
const { view: rootView, context } = activeContainerItem; | ||
const { viewName, viewContext } = processRootViewDetails(rootView, activeContainerItem, { parentPConnect }); | ||
|
||
if (!viewName) return null; | ||
|
||
const config = { | ||
meta: rootView, | ||
options: { | ||
context, | ||
pageReference: viewContext || parentPConnect.getPageReference(), | ||
containerName, | ||
containerItemID: activeContainerItemKey, | ||
parentPageReference: parentPConnect.getPageReference(), | ||
hasForm: | ||
isAssignmentView || | ||
containerName === CONTAINER_NAMES.WORKAREA || | ||
containerName === CONTAINER_NAMES.MODAL || | ||
viewName === CREATE_DETAILS_VIEW_NAME, | ||
target | ||
} | ||
}; | ||
|
||
return PCore.createPConnect(config).getPConnect; | ||
} | ||
} | ||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packages/angular-sdk-components/src/lib/angular-sdk-components.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters