Altinn / altinn-studio

Next generation open source Altinn platform and applications.
https://docs.altinn.studio
BSD 3-Clause "New" or "Revised" License
114 stars 70 forks source link

Support actions property on CustomButton component #13765

Open nkylstad opened 1 week ago

nkylstad commented 1 week ago

Description

Setting up a CustomButton with actions is required for a subform layoutset. The action must be a closeSubform action. See reference docs.

We currently have no support for actions config for the CustomButton component. We should implement a custom config for this property.

There are 2 types of actions:

actions is an array of objects. The items in the array all have the properties

In addition, items with type "ClientAction" may also have additional properties. See the documentation for CustomButton for details.

Additional Information

One alternative we might consider in the short run is to implement a "CloseSubformButton" which is a specific implementation of the CustomButton:

"id": "<some-generated-id",
"type": "CustomButton",
"actions": [
  {
    "type": "ClientAction",
    "id": "closeSubForm",
    "validation": {
        "page": "all",
        "show": ["All"]
      }
  }
]

and make this available as a pre-configured component.

Tasks

No response

Acceptance Criterias

No response

nkylstad commented 1 week ago

Functionality-wise this is quite similar to tableColumns setting in subform. Suggest design to match.

Annikenkbrathen commented 2 days ago

I got some questions🤓

If a button is required to be added when adding a subform component, maybe it should be automatically added to the structure column, below the subform component? (Similar to what we have done with the navigation button when adding a page.)

In future iterations of the functionality, we might automatically configure the CustomButton to match the subform component it is associated with. Specifically, the idea is for the button to automatically use the same subform layoutset that is already set in the subform component.

Also, will this suggestions it be confusing if the button could be used in contexts other than in a subform? Do we have any need for a CustomButton in other cases today? And what is the difference between this and the one called "Handlingsknapp" in Studio today?

Image

wrt95 commented 2 days ago

We can add the config as a Switch at the top of a SubForm page. Let the user see a text with information about what happens when adding this button. The switch design can be similar to the PDF switch. This switch adds the component to the list, and the user must be able to define the text on this. We should also have a default text initially on the button. If button is deleted from component list, turn switch off.

Could be placed here: Image

Take this out of sprint. New issue estimation: 3

lassopicasso commented 2 days ago

Utilizing custom button for the isolated context with subform: https://github.com/Altinn/altinn-studio/issues/13836