Fix typings

This commit is contained in:
Adria Navarro 2025-03-10 12:00:46 +01:00
parent 035bb54cb3
commit dd6320ec0f
5 changed files with 10 additions and 10 deletions

View File

@ -6,7 +6,7 @@
import { findComponentById } from "@/utils/components.js"
import { isGridEvent } from "@/utils/grid"
import { DNDPlaceholderID } from "@/constants"
import type { Component } from "@budibase/types"
import { Component, DropPosition } from "@budibase/types"
type ChildCoords = {
placeholder: boolean
@ -287,7 +287,7 @@
}
// Convert parent + index into target + mode
let legacyDropTarget, legacyDropMode
let legacyDropTarget, legacyDropMode: DropPosition
const parent: Component | null = findComponentById(
get(screenStore).activeScreen?.props,
drop.parent
@ -309,16 +309,16 @@
// Use inside if no existing children
if (!children?.length) {
legacyDropTarget = parent._id
legacyDropMode = "inside"
legacyDropMode = DropPosition.INSIDE
} else if (drop.index === 0) {
legacyDropTarget = children[0]?._id
legacyDropMode = "above"
legacyDropMode = DropPosition.ABOVE
} else {
legacyDropTarget = children[drop.index - 1]?._id
legacyDropMode = "below"
legacyDropMode = DropPosition.BELOW
}
if (legacyDropTarget && legacyDropMode) {
if (legacyDropTarget && legacyDropMode && source.id) {
dropping = true
await builderStore.actions.moveComponent(
source.id,

View File

@ -17,6 +17,7 @@
Devices,
GridDragMode,
} from "@/utils/grid"
import { DropPosition } from "@budibase/types"
type GridDragSide =
| "top"
@ -222,7 +223,7 @@
// If holding ctrl/cmd then leave behind a duplicate of this component
if (mode === GridDragMode.Move && (e.ctrlKey || e.metaKey)) {
builderStore.actions.duplicateComponent(id, "above", false)
builderStore.actions.duplicateComponent(id, DropPosition.ABOVE, false)
}
// Find grid parent and read from DOM

View File

@ -115,7 +115,7 @@ const createBuilderStore = () => {
component: string,
parent: string,
index: number,
props: Record<string, any>
props?: Record<string, any>
) => {
eventStore.actions.dispatchEvent("drop-new-component", {
component,

View File

@ -1,6 +1,5 @@
{
"compilerOptions": {
"verbatimModuleSyntax": true,
"allowJs": true,
"strict": true,
"outDir": "dist",

View File

@ -1,6 +1,6 @@
export { createAPIClient } from "./api"
export type { APIClient } from "./api"
export { fetchData, DataFetchMap } from "./fetch"
export { fetchData, DataFetchMap, type DataFetchType } from "./fetch"
export * as Constants from "./constants"
export * from "./stores"
export * from "./utils"