Fiddle types
This commit is contained in:
parent
075c53df79
commit
11f8fa9403
|
@ -1,9 +1,9 @@
|
|||
import { Document } from "@budibase/types"
|
||||
import { Document, Component } from "@budibase/types"
|
||||
import { cloneDeep } from "lodash/fp"
|
||||
|
||||
export class BaseStructure<T extends Document> {
|
||||
private _isScreen: boolean
|
||||
private _children: BaseStructure<any>[]
|
||||
private _children: Component[]
|
||||
_json: T
|
||||
|
||||
constructor(isScreen: boolean, initialDoc: T) {
|
||||
|
@ -12,7 +12,7 @@ export class BaseStructure<T extends Document> {
|
|||
this._json = initialDoc
|
||||
}
|
||||
|
||||
addChild(child: BaseStructure<any>) {
|
||||
addChild(child: Component) {
|
||||
this._children.push(child)
|
||||
return this
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { Screen } from "./Screen"
|
||||
import { componentStore } from "@/stores/builder"
|
||||
import { getRowActionButtonTemplates } from "@/templates/rowActions"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import { Screen as ScreenDoc } from "@budibase/types"
|
||||
import { Component } from "../Component"
|
||||
import getValidRoute from "./getValidRoute"
|
||||
import { componentStore } from "@/stores/builder"
|
||||
import { Helpers } from "@budibase/bbui"
|
||||
import { getRowActionButtonTemplates } from "@/templates/rowActions"
|
||||
import { Screen } from "./Screen"
|
||||
import { utils } from "@budibase/shared-core"
|
||||
|
||||
type FormType = "create" | "update" | "view"
|
||||
|
||||
|
@ -17,6 +19,8 @@ export const getTypeSpecificRoute = (
|
|||
return `/${tableOrView.name}/edit/:id`
|
||||
} else if (type === "view") {
|
||||
return `/${tableOrView.name}/view/:id`
|
||||
} else {
|
||||
throw utils.unreachable(type)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +56,17 @@ const getTitle = (type: FormType) => {
|
|||
return "Row details"
|
||||
}
|
||||
|
||||
const form = async ({ tableOrView, type, permissions, screens }) => {
|
||||
const form = async ({
|
||||
tableOrView,
|
||||
type,
|
||||
permissions,
|
||||
screens,
|
||||
}: {
|
||||
tableOrView: any
|
||||
type: any
|
||||
permissions: any
|
||||
screens: ScreenDoc[]
|
||||
}) => {
|
||||
const id = Helpers.uuid()
|
||||
const typeSpecificRoute = getTypeSpecificRoute(tableOrView, type)
|
||||
const role = getRole(permissions, type)
|
||||
|
|
Loading…
Reference in New Issue