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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
export { createAPIClient } from "./api" export { createAPIClient } from "./api"
export type { APIClient } 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 * as Constants from "./constants"
export * from "./stores" export * from "./stores"
export * from "./utils" export * from "./utils"