Type rowActions templates
This commit is contained in:
parent
9bf090ccd8
commit
6400e34fd5
|
@ -3,11 +3,16 @@ import { getDatasourceForProvider } from "@/dataBinding"
|
||||||
import { rowActions, selectedScreen, componentStore } from "@/stores/builder"
|
import { rowActions, selectedScreen, componentStore } from "@/stores/builder"
|
||||||
import { Helpers } from "@budibase/bbui"
|
import { Helpers } from "@budibase/bbui"
|
||||||
import { findComponent } from "@/helpers/components"
|
import { findComponent } from "@/helpers/components"
|
||||||
|
import { Component, Screen } from "@budibase/types"
|
||||||
|
|
||||||
export const getRowActionButtonTemplates = async ({
|
export const getRowActionButtonTemplates = async ({
|
||||||
screen,
|
screen,
|
||||||
component,
|
component,
|
||||||
instance,
|
instance,
|
||||||
|
}: {
|
||||||
|
instance: Component | null
|
||||||
|
screen?: Screen
|
||||||
|
component?: { _rootId: string }
|
||||||
}) => {
|
}) => {
|
||||||
// Find root component instance if not specified
|
// Find root component instance if not specified
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
|
@ -47,7 +52,7 @@ export const getRowActionButtonTemplates = async ({
|
||||||
const enabledActions = get(rowActions)[resourceId] || []
|
const enabledActions = get(rowActions)[resourceId] || []
|
||||||
|
|
||||||
// Generate the row ID binding depending on the component
|
// Generate the row ID binding depending on the component
|
||||||
let rowIdBinding
|
let rowIdBinding: string
|
||||||
if (isGridBlock) {
|
if (isGridBlock) {
|
||||||
rowIdBinding = `{{ [${instance._id}].[_id] }}`
|
rowIdBinding = `{{ [${instance._id}].[_id] }}`
|
||||||
} else if (isFormBlock) {
|
} else if (isFormBlock) {
|
||||||
|
@ -68,7 +73,19 @@ export const getRowActionButtonTemplates = async ({
|
||||||
)
|
)
|
||||||
|
|
||||||
// Row action button action
|
// Row action button action
|
||||||
const onClick = [
|
const onClick: {
|
||||||
|
parameters:
|
||||||
|
| {
|
||||||
|
rowActionId: string
|
||||||
|
resourceId: string
|
||||||
|
rowId: string
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
componentId: string
|
||||||
|
}
|
||||||
|
"##eventHandlerType": string
|
||||||
|
id: string
|
||||||
|
}[] = [
|
||||||
{
|
{
|
||||||
parameters: {
|
parameters: {
|
||||||
rowActionId: action.id,
|
rowActionId: action.id,
|
Loading…
Reference in New Issue