pegros / PEG_LIST

Set of configurable/actionable LWC list components for Salesforce Lightning UX
MIT License
20 stars 8 forks source link

[feat] sfpegMessageListCmp - Make visible SfpegActionBar #43

Closed ismailsalam closed 1 year ago

ismailsalam commented 1 year ago

We use the SfpegActionBar component to display action buttons related to the current record, we want to display error messages in the event that the button cannot be displayed.

SfpegMessageListCmp will meet our need well if the "sfpegactionbar" component includes in is possible to make it visible

can we have parent-context param in sfpegactionBar included in SfpegMessageListCmp

image

pegros commented 1 year ago

Actually, after further thinking, I would rather let you implement a wrapping component including both a MessageList and an ActionBar, the hidden ActionBar included in the MessageList remaining unchanged. Adding parentContext property on all components is under way: already works on most of them.

pegros commented 1 year ago

parent-context variable has been added on sfpegListCmp, sfpegMessageListCmp, sfpegCardCmp, sfpegCardListCmp, sfpegKpiListCmp, sfpegProfileCmp and sfpegRecordDisplayCmp in addition to sfpegActionBarCmp.

In addition, the ondone() handler has been added to these components to enable parent components to receive done actions triggered from the children sfpegActionBarCmp components and implement custom LWC logic.

At last, a doRefresh() method has been added at the API of the sfpegKpiListCmp, sfpegRecordDisplayCmp, and sfpegCardListCmp components to let custom parent component trigger the corresponding operation (same logic as their standard refresh icon button).

pegros commented 1 year ago

For the requested layout, the solution would be to implement a parent component fetching and injecting a parent context in both a sfpegMessageListcmp and sfpegActionBarCmp. E.g. in an Aura component, it requires a context variable to be defined in object type and pushed to the different embedded components via the parentContext property (as well as recordId, sObjectName and userId).

<aura:attribute name="userId" type="String"/>
<aura:attribute name="context" type="Object"/>
<c:sfpegMessageListCmp  configName="tstLwcMessages"
                                recordId="{!v.recordId}"
                                objectApiName="{!v.sObjectName}"
                            userId="{!v.userId}"
                                ondone="{!c.handleMsgAction}"
                                parentContext="{!v.context}" 
                        isDebug="true"
                            isDebugFine="true"/>
<c:sfpegActionBarCmp          barClass="slds-m-top_xx-small  slds-align_absolute-center"
                                configName="tstLwcActions"
                            recordId="{!v.recordId}"
                            objectApiName="{!v.sObjectName}"
                            userId="{!v.userId}"
                            ondone="{!c.handleAction}"
                        parentContext="{!v.context}"
                            isDebug="true"
                            isDebugFine="true"/>

The ondone handler is optional and enables to handle any done action triggered from the embedded action bars.

pegros commented 1 year ago

Implemented in build baff2ad

pegros commented 1 year ago

Documentation to be updated soon...