From 6400e34fd56c63eb6ed5a652875b79ecac9a92e5 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 5 May 2025 15:43:58 +0200 Subject: [PATCH] Type rowActions templates --- .../{rowActions.js => rowActions.ts} | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) rename packages/builder/src/templates/{rowActions.js => rowActions.ts} (85%) diff --git a/packages/builder/src/templates/rowActions.js b/packages/builder/src/templates/rowActions.ts similarity index 85% rename from packages/builder/src/templates/rowActions.js rename to packages/builder/src/templates/rowActions.ts index 356c20e68a..15d39516af 100644 --- a/packages/builder/src/templates/rowActions.js +++ b/packages/builder/src/templates/rowActions.ts @@ -3,11 +3,16 @@ import { getDatasourceForProvider } from "@/dataBinding" import { rowActions, selectedScreen, componentStore } from "@/stores/builder" import { Helpers } from "@budibase/bbui" import { findComponent } from "@/helpers/components" +import { Component, Screen } from "@budibase/types" export const getRowActionButtonTemplates = async ({ screen, component, instance, +}: { + instance: Component | null + screen?: Screen + component?: { _rootId: string } }) => { // Find root component instance if not specified if (!instance) { @@ -47,7 +52,7 @@ export const getRowActionButtonTemplates = async ({ const enabledActions = get(rowActions)[resourceId] || [] // Generate the row ID binding depending on the component - let rowIdBinding + let rowIdBinding: string if (isGridBlock) { rowIdBinding = `{{ [${instance._id}].[_id] }}` } else if (isFormBlock) { @@ -68,7 +73,19 @@ export const getRowActionButtonTemplates = async ({ ) // Row action button action - const onClick = [ + const onClick: { + parameters: + | { + rowActionId: string + resourceId: string + rowId: string + } + | { + componentId: string + } + "##eventHandlerType": string + id: string + }[] = [ { parameters: { rowActionId: action.id,