Update form block autoscreens to render buttons at bottom and include quiet row action buttons

This commit is contained in:
Andrew Kingston 2024-09-09 11:35:43 +01:00
parent 902112d5a7
commit 028dc40a0d
No known key found for this signature in database
4 changed files with 9 additions and 2 deletions

View File

@ -63,6 +63,7 @@ export const getRowActionButtonTemplates = async ({
_instanceName: Helpers.uuid(), _instanceName: Helpers.uuid(),
text: action.name, text: action.name,
type: "primary", type: "primary",
quiet: true,
} }
) )

View File

@ -55,6 +55,7 @@ const form = async ({ tableOrView, type, permissions, screens }) => {
actionType: getActionType(type), actionType: getActionType(type),
title: getTitle(type), title: getTitle(type),
rowId: type === "new" ? undefined : `{{ url.id }}`, rowId: type === "new" ? undefined : `{{ url.id }}`,
buttonPosition: "bottom",
}) })
.instanceName(`${tableOrView.name} - Form block`) .instanceName(`${tableOrView.name} - Form block`)
.json() .json()
@ -69,6 +70,11 @@ const form = async ({ tableOrView, type, permissions, screens }) => {
}) })
if (rowActionButtons.length) { if (rowActionButtons.length) {
formBlock.buttons = [...(formBlock.buttons || []), ...rowActionButtons] formBlock.buttons = [...(formBlock.buttons || []), ...rowActionButtons]
// Collapse buttons if more than 3 row actions
if (rowActionButtons.length > 3) {
formBlock.buttonsCollapsed = true
}
} }
} }

View File

@ -113,7 +113,7 @@
}} }}
styles={{ styles={{
normal: { normal: {
"margin-top": "16", "margin-top": "24",
}, },
}} }}
order={1} order={1}

View File

@ -240,7 +240,7 @@ export const buildFormBlockButtonConfig = props => {
_component: "@budibase/standard-components/button", _component: "@budibase/standard-components/button",
onClick: onDelete, onClick: onDelete,
quiet: true, quiet: true,
type: "secondary", type: "warning",
}) })
} }