Type screenTemplating inline

This commit is contained in:
Adria Navarro 2025-05-05 16:20:41 +02:00
parent 81a37c2e7d
commit c608243c40
5 changed files with 26 additions and 14 deletions

View File

@ -3,7 +3,7 @@ import { cloneDeep } from "lodash/fp"
export class BaseStructure<T extends Document> { export class BaseStructure<T extends Document> {
private _isScreen: boolean private _isScreen: boolean
private _children: Component[] private _children: (Component | BaseStructure<any>)[]
_json: T _json: T
constructor(isScreen: boolean, initialDoc: T) { constructor(isScreen: boolean, initialDoc: T) {
@ -12,7 +12,7 @@ export class BaseStructure<T extends Document> {
this._json = initialDoc this._json = initialDoc
} }
addChild(child: Component) { addChild(child: Component | BaseStructure<any>) {
this._children.push(child) this._children.push(child)
return this return this
} }

View File

@ -1,7 +1,7 @@
import { componentStore } from "@/stores/builder" import { componentStore } from "@/stores/builder"
import { getRowActionButtonTemplates } from "@/templates/rowActions" import { getRowActionButtonTemplates } from "@/templates/rowActions"
import { Helpers } from "@budibase/bbui" import { Helpers } from "@budibase/bbui"
import { Screen as ScreenDoc } from "@budibase/types" import { Screen as ScreenDoc, UIPermissions } from "@budibase/types"
import { Component } from "../Component" import { Component } from "../Component"
import getValidRoute from "./getValidRoute" import getValidRoute from "./getValidRoute"
import { Screen } from "./Screen" import { Screen } from "./Screen"
@ -24,10 +24,7 @@ export const getTypeSpecificRoute = (
} }
} }
const getRole = ( const getRole = (permissions: UIPermissions, type: FormType) => {
permissions: { read: string; write: string },
type: FormType
) => {
if (type === "view") { if (type === "view") {
return permissions.read return permissions.read
} }

View File

@ -1,10 +1,20 @@
import { Screen } from "../Screen"
import { Component } from "../../Component"
import { capitalise } from "@/helpers" import { capitalise } from "@/helpers"
import getValidRoute from "../getValidRoute" import { SourceOption } from "@/pages/builder/app/[application]/design/_components/NewScreen/utils"
import { getRowActionButtonTemplates } from "@/templates/rowActions" import { getRowActionButtonTemplates } from "@/templates/rowActions"
import { Screen as ScreenDoc, UIPermissions } from "@budibase/types"
import { Component } from "../../Component"
import getValidRoute from "../getValidRoute"
import { Screen } from "../Screen"
const inline = async ({ tableOrView, permissions, screens }) => { const inline = async ({
tableOrView,
permissions,
screens,
}: {
tableOrView: SourceOption
permissions: UIPermissions
screens: ScreenDoc[]
}) => {
const heading = new Component("@budibase/standard-components/textv2") const heading = new Component("@budibase/standard-components/textv2")
.instanceName("Table heading") .instanceName("Table heading")
.customProps({ .customProps({

View File

@ -1,8 +1,9 @@
export * from "./stores"
export * from "./bindings" export * from "./bindings"
export * from "./BudibaseApp"
export * from "./common"
export * from "./components" export * from "./components"
export * from "./dataFetch" export * from "./dataFetch"
export * from "./datasource" export * from "./datasource"
export * from "./common"
export * from "./BudibaseApp"
export * from "./fields" export * from "./fields"
export * from "./permissions"
export * from "./stores"

View File

@ -0,0 +1,4 @@
export interface UIPermissions {
read: string
write: string
}