Move DropPosition

This commit is contained in:
Adria Navarro 2025-02-13 10:52:22 +01:00
parent ea597c90fc
commit 12d596e7ab
3 changed files with 17 additions and 12 deletions

View File

@ -1,12 +1,7 @@
import { writable, get } from "svelte/store"
import { findComponentParent, findComponentPath } from "@/helpers/components"
import { selectedScreen, componentStore } from "@/stores/builder"
export const DropPosition = {
ABOVE: "above",
BELOW: "below",
INSIDE: "inside",
}
import { DropPosition } from "@budibase/types"
const initialState = {
source: null,

View File

@ -2,7 +2,7 @@ import { writable, get } from "svelte/store"
import { API } from "api"
import { devToolsStore } from "./devTools.js"
import { eventStore } from "./events.js"
import { PreviewDevice } from "@budibase/types"
import { DropPosition, PreviewDevice } from "@budibase/types"
interface BuilderStore {
inBuilder: boolean
@ -58,19 +58,23 @@ const createBuilderStore = () => {
devToolsStore.actions.setAllowSelection(false)
eventStore.actions.dispatchEvent("select-component", { id })
},
updateProp: (prop, value) => {
updateProp: (prop: string, value: any) => {
eventStore.actions.dispatchEvent("update-prop", { prop, value })
},
updateStyles: async (styles, id) => {
updateStyles: async (styles: Record<string, any>, id: string) => {
await eventStore.actions.dispatchEvent("update-styles", {
styles,
id,
})
},
keyDown: (key, ctrlKey) => {
keyDown: (key: string, ctrlKey: boolean) => {
eventStore.actions.dispatchEvent("key-down", { key, ctrlKey })
},
duplicateComponent: (id, mode = "below", selectComponent = true) => {
duplicateComponent: (
id: string,
mode = DropPosition.BELOW,
selectComponent = true
) => {
eventStore.actions.dispatchEvent("duplicate-component", {
id,
mode,
@ -136,7 +140,7 @@ const createBuilderStore = () => {
// Notify the builder so we can reload component definitions
eventStore.actions.dispatchEvent("reload-plugin")
},
addParentComponent: (componentId, parentType) => {
addParentComponent: (componentId: any, parentType: any) => {
eventStore.actions.dispatchEvent("add-parent-component", {
componentId,
parentType,

View File

@ -1,2 +1,8 @@
// type purely to capture structures that the type is unknown, but maybe known later
export type UIObject = Record<string, any>
export const enum DropPosition {
ABOVE = "above",
BELOW = "below",
INSIDE = "inside",
}