Tidy up
This commit is contained in:
parent
b9c2b07f3e
commit
e71e8ff6b6
|
@ -124,7 +124,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const startDraggingPlaceholder = () => {
|
const startDraggingPlaceholder = () => {
|
||||||
console.log("START PLACEHOLDER")
|
|
||||||
const mode = GridDragModes.Move
|
const mode = GridDragModes.Move
|
||||||
const id = DNDPlaceholderID
|
const id = DNDPlaceholderID
|
||||||
|
|
||||||
|
@ -160,7 +159,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add event handler to clear all drag state when dragging ends
|
// Add event handler to clear all drag state when dragging ends
|
||||||
console.log("add up listener")
|
|
||||||
document.addEventListener("mouseup", stopDragging)
|
document.addEventListener("mouseup", stopDragging)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,6 @@ import * as internal from "svelte/internal"
|
||||||
window.svelte_internal = internal
|
window.svelte_internal = internal
|
||||||
window.svelte = svelte
|
window.svelte = svelte
|
||||||
|
|
||||||
console.log("NEW CLIENT")
|
|
||||||
|
|
||||||
// Initialise spectrum icons
|
// Initialise spectrum icons
|
||||||
// eslint-disable-next-line local-rules/no-budibase-imports
|
// eslint-disable-next-line local-rules/no-budibase-imports
|
||||||
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-vite.js"
|
import loadSpectrumIcons from "@budibase/bbui/spectrum-icons-vite.js"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { writable, get } from "svelte/store"
|
import { writable, get } from "svelte/store"
|
||||||
import { derivedMemo } from "@budibase/frontend-core"
|
import { derivedMemo } from "@budibase/frontend-core"
|
||||||
import { screenStore } from "@/stores"
|
import { screenStore, isGridScreen } from "@/stores"
|
||||||
import { ScreenslotID } from "@/constants"
|
import { ScreenslotID } from "@/constants"
|
||||||
|
|
||||||
const createDndStore = () => {
|
const createDndStore = () => {
|
||||||
|
@ -33,15 +33,11 @@ const createDndStore = () => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On grid screens, we already know exactly where to insert the component
|
||||||
let target, drop
|
let target, drop
|
||||||
const screen = get(screenStore)?.activeScreen
|
const screen = get(screenStore)?.activeScreen
|
||||||
const isGridScreen = screen?.props?.layout === "grid"
|
if (get(isGridScreen)) {
|
||||||
if (isGridScreen) {
|
|
||||||
const id = screen?.props?._id
|
const id = screen?.props?._id
|
||||||
drop = {
|
|
||||||
parent: id,
|
|
||||||
index: screen?.props?._children?.length,
|
|
||||||
}
|
|
||||||
target = {
|
target = {
|
||||||
id,
|
id,
|
||||||
parent: ScreenslotID,
|
parent: ScreenslotID,
|
||||||
|
@ -49,6 +45,10 @@ const createDndStore = () => {
|
||||||
empty: false,
|
empty: false,
|
||||||
acceptsChildren: true,
|
acceptsChildren: true,
|
||||||
}
|
}
|
||||||
|
drop = {
|
||||||
|
parent: id,
|
||||||
|
index: screen?.props?._children?.length,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get size of new component so we can show a properly sized placeholder
|
// Get size of new component so we can show a properly sized placeholder
|
||||||
|
@ -57,7 +57,6 @@ const createDndStore = () => {
|
||||||
|
|
||||||
store.set({
|
store.set({
|
||||||
...initialState,
|
...initialState,
|
||||||
isGridScreen,
|
|
||||||
source: {
|
source: {
|
||||||
id: null,
|
id: null,
|
||||||
parent: null,
|
parent: null,
|
||||||
|
@ -73,7 +72,6 @@ const createDndStore = () => {
|
||||||
const updateTarget = ({ id, parent, node, empty, acceptsChildren }) => {
|
const updateTarget = ({ id, parent, node, empty, acceptsChildren }) => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.target = { id, parent, node, empty, acceptsChildren }
|
state.target = { id, parent, node, empty, acceptsChildren }
|
||||||
console.log("TARGET", state.target)
|
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -81,7 +79,6 @@ const createDndStore = () => {
|
||||||
const updateDrop = ({ parent, index }) => {
|
const updateDrop = ({ parent, index }) => {
|
||||||
store.update(state => {
|
store.update(state => {
|
||||||
state.drop = { parent, index }
|
state.drop = { parent, index }
|
||||||
console.log("DROP", state.drop)
|
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -127,7 +124,3 @@ export const dndIsNewComponent = derivedMemo(
|
||||||
dndStore,
|
dndStore,
|
||||||
x => x.source?.newComponentType != null
|
x => x.source?.newComponentType != null
|
||||||
)
|
)
|
||||||
export const dndNewComponentProps = derivedMemo(
|
|
||||||
dndStore,
|
|
||||||
x => x.meta?.newComponentProps
|
|
||||||
)
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ export {
|
||||||
dndBounds,
|
dndBounds,
|
||||||
dndIsNewComponent,
|
dndIsNewComponent,
|
||||||
dndIsDragging,
|
dndIsDragging,
|
||||||
dndNewComponentProps,
|
|
||||||
} from "./dnd"
|
} from "./dnd"
|
||||||
export { sidePanelStore } from "./sidePanel"
|
export { sidePanelStore } from "./sidePanel"
|
||||||
export { modalStore } from "./modal"
|
export { modalStore } from "./modal"
|
||||||
|
|
Loading…
Reference in New Issue