Design Proposal: Extensible Dropdown Service #5250
ek68794998
started this conversation in
Feature Requests
Replies: 1 comment 1 reply
-
I think this is great! Everything looks great, just a few notes below:
My only other conern would be that if we have the onClick callbacks in the service files, I'm not sure how accessible it will be to interact with data from hooks / redux actions. This might not be an issue for your usecase though. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Goal
To allow the dropdown menus in the designer to have host-specific menu items.
Proposal: Overview
Today, there are two different types of dropdown menu: 1) the user right-clicks a node ([1], [2], [3]), or 2) the user clicks a (+) button in the designer ([1]). As these are built into the designer with a predefined set of available actions, hosts implementing the LAUX designer are not capable of adding their own actions to these dropdowns.
Being proposed here is the implementation of a new service that can be implemented at the host level, which provides a list of menu configurations (represented by a flexible interface allowing customization of the item) and render them as menu items. Both options are discussed at a technical level in the section below.
For dropdowns specifically, there would be some limitations in place:
<MenuItem>
standard control. A callback must be attached.<MenuItem>
, or a custom control provided via render callback.Proposal: Technical design
A new service, perhaps
IDesignerUiInteractionsService
, would be introduced. This service would provide the following approximate interface:A host service could then implement the interface; for example, something like a "lock action" feature would work like this:
Another example may be an action to add a note to the workflow:
These would then get rendered as additional actions in the dropdown menu:
Use of a custom renderer would look something like this:
Which would produce this type of menu:
The only remaining implementation would be in the files called out in the lead of this proposal, to convert the provided
DropdownMenuOption
items into<MenuItem>
and submenu<Menu>
components in the node & dropdown files ([1], [2], [3], [4]). The work for this is not strictly defined here as it is not of high technical complexity.With the above in place, existing menus would be converted to
DropdownMenuOption
objects so that they could be generically defined the same way as the new custom ones. Something like this:As shown in the snippet diff above, one additional implementation detail is that the
priority
field could be used on top-level menu items to sort the actions as desired. Default actions would have their own priorities assigned (for example, "Delete" = 1000, "Copy action" = 2000, "Pin action" = 3000), and then apriority
value of 2500 would go between the copy & pin menu items.Callouts
Beta Was this translation helpful? Give feedback.
All reactions