Closed mickaelgudin closed 2 years ago
@mickaelgudin thanks again for the new addon, I do have some queries,
prop "list action button" :
But I think you're making a point, this addon should allow apex calls from the component itself
[
{ label : "delete all", variant: "destructive", needSelectedRows: true, callApex: true },
{ label : "another action button", variant : "brand", needSelectedRows: false, callApex: false }
]
Therefore two methods would be defined in javascript controller (called based on callApex value) :
I think it's the best solution, because a centralised apex method(for buttons that want to call apex method directly without firing event to parent) might not meet all uses cases.
The callApexFromButton method would enable developers to add custom logic(call desired apex method) based on labels.
@mickaelgudin ok sounds good, let me know once you implement it, will review it.
@mickaelgudin , just review the code. looks good. I have merged to 'dev' branch. just figuring out to run 'CI', hating so-called GitHub actions, as it is not running on forking PR.will figure it out, Appreciate your contribution to new addons.
@mickaelgudin Just check i believe actionButtonsList
property was missed in metafile for design attribute. can you add this property to the design attribute? if actionButtonsList != null , set showcheckbox = true
and update the config table in read.me section
callApex should be renamed type
You're making a point for buttons with logic defined in related list component :
Dividing buttons based on their action(fire an event, or call related list logic) complexifies the buttons display order(adding a new prop to order...).
I think a new object should define available buttons calling logic in related list component (javascript/apex) :
{
'delete-everything' : { label : "delete all", variant: "destructive", needSelectedRows: true },
'delete-selected' : { label : "delete selected", variant : "brand", needSelectedRows: false }
}
actionButtonsList design property would be a string(referencing only the buttons defined in the object, the ones with logic in the component itself) like : delete-everything, delete-selected
The new format for buttons configuration (from parent component) would be :
[
{ type :"event", label : "button firing an event to parent", variant: "destructive", needSelectedRows: true },
{ type :"action", label: "delete-everything" }
]
The format is clearer, buttons would call callApexFromButton or fireEventFromButton based on type attribute
I'm okay with this rule if actionButtonsList != null , set showcheckbox = true
You can implement the changes, either the ones that you suggested or mine.
And thank you for taking the time to review my changes/suggestion, and to set up CI
@mickaelgudin can we just add only actionButtonList ( only for apexaction, just simple JS function, because this component is standalone I understand your use case and you can change as per your business requirement.) can we skip 'eventButtons` .
This component is production ready, The component should be less customized via code. the component can be customized via design attributes. Generally, people use this component as a standarlone. We are targeting Admins/Business Users as well. As I am extending some common features in the future some of the below examples.
I'm okay with defining only actions for list, I'll make a PR very soon.
Could make a release after merging my PR ? Here's the sum up of my contributions :
Your future features are great.
I think callApexFromButton recalled callButtonAction is enough to throw an event
@mickaelgudin I have published a new Release with all recent changes. v1.2
thank you, I think we can close this issue since the provided changes should be suited for admins and developers.
This feature would be useful if the component is a child of another component and the parent needs to listen to the fired events.
Description of the implementation of the new prop "list action button" and events :
Json would be :
Here's the label of the button from the json and their action names "delete all" : action1 "another action button" : action2
Selected rows would be send to the event only if the button has needSelectedRows property set to true