Move DropPosition
This commit is contained in:
parent
ea597c90fc
commit
12d596e7ab
|
@ -1,12 +1,7 @@
|
||||||
import { writable, get } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { findComponentParent, findComponentPath } from "@/helpers/components"
|
import { findComponentParent, findComponentPath } from "@/helpers/components"
|
||||||
import { selectedScreen, componentStore } from "@/stores/builder"
|
import { selectedScreen, componentStore } from "@/stores/builder"
|
||||||
|
import { DropPosition } from "@budibase/types"
|
||||||
export const DropPosition = {
|
|
||||||
ABOVE: "above",
|
|
||||||
BELOW: "below",
|
|
||||||
INSIDE: "inside",
|
|
||||||
}
|
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
source: null,
|
source: null,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { writable, get } from "svelte/store"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { devToolsStore } from "./devTools.js"
|
import { devToolsStore } from "./devTools.js"
|
||||||
import { eventStore } from "./events.js"
|
import { eventStore } from "./events.js"
|
||||||
import { PreviewDevice } from "@budibase/types"
|
import { DropPosition, PreviewDevice } from "@budibase/types"
|
||||||
|
|
||||||
interface BuilderStore {
|
interface BuilderStore {
|
||||||
inBuilder: boolean
|
inBuilder: boolean
|
||||||
|
@ -58,19 +58,23 @@ const createBuilderStore = () => {
|
||||||
devToolsStore.actions.setAllowSelection(false)
|
devToolsStore.actions.setAllowSelection(false)
|
||||||
eventStore.actions.dispatchEvent("select-component", { id })
|
eventStore.actions.dispatchEvent("select-component", { id })
|
||||||
},
|
},
|
||||||
updateProp: (prop, value) => {
|
updateProp: (prop: string, value: any) => {
|
||||||
eventStore.actions.dispatchEvent("update-prop", { prop, value })
|
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", {
|
await eventStore.actions.dispatchEvent("update-styles", {
|
||||||
styles,
|
styles,
|
||||||
id,
|
id,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
keyDown: (key, ctrlKey) => {
|
keyDown: (key: string, ctrlKey: boolean) => {
|
||||||
eventStore.actions.dispatchEvent("key-down", { key, ctrlKey })
|
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", {
|
eventStore.actions.dispatchEvent("duplicate-component", {
|
||||||
id,
|
id,
|
||||||
mode,
|
mode,
|
||||||
|
@ -136,7 +140,7 @@ const createBuilderStore = () => {
|
||||||
// Notify the builder so we can reload component definitions
|
// Notify the builder so we can reload component definitions
|
||||||
eventStore.actions.dispatchEvent("reload-plugin")
|
eventStore.actions.dispatchEvent("reload-plugin")
|
||||||
},
|
},
|
||||||
addParentComponent: (componentId, parentType) => {
|
addParentComponent: (componentId: any, parentType: any) => {
|
||||||
eventStore.actions.dispatchEvent("add-parent-component", {
|
eventStore.actions.dispatchEvent("add-parent-component", {
|
||||||
componentId,
|
componentId,
|
||||||
parentType,
|
parentType,
|
||||||
|
|
|
@ -1,2 +1,8 @@
|
||||||
// type purely to capture structures that the type is unknown, but maybe known later
|
// type purely to capture structures that the type is unknown, but maybe known later
|
||||||
export type UIObject = Record<string, any>
|
export type UIObject = Record<string, any>
|
||||||
|
|
||||||
|
export const enum DropPosition {
|
||||||
|
ABOVE = "above",
|
||||||
|
BELOW = "below",
|
||||||
|
INSIDE = "inside",
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue