This commit is contained in:
Adria Navarro 2024-12-27 20:41:21 +01:00
parent 4a5279dfb6
commit a7afe1b6d2
1 changed files with 4 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import { writable, get, derived, Writable, Readable } from "svelte/store"
import { MinColumnWidth, DefaultColumnWidth } from "../lib/constants" import { MinColumnWidth, DefaultColumnWidth } from "../lib/constants"
import { parseEventLocation } from "../lib/utils" import { parseEventLocation } from "../lib/utils"
import { Store as StoreContext } from "." import { Store as StoreContext } from "."
import { UIColumn } from "@budibase/types"
interface ResizeInitialStoreData { interface ResizeInitialStoreData {
initialMouseX: number | null initialMouseX: number | null
@ -9,7 +10,7 @@ interface ResizeInitialStoreData {
column: string | null column: string | null
width: number width: number
left: number left: number
related?: any related?: UIColumn["related"]
} }
const initialState: ResizeInitialStoreData = { const initialState: ResizeInitialStoreData = {
@ -40,7 +41,7 @@ export const createActions = (context: StoreContext) => {
const { resize, ui, datasource } = context const { resize, ui, datasource } = context
// Starts resizing a certain column // Starts resizing a certain column
const startResizing = (column: any, e: any) => { const startResizing = (column: UIColumn, e: MouseEvent | TouchEvent) => {
const { x } = parseEventLocation(e) const { x } = parseEventLocation(e)
// Prevent propagation to stop reordering triggering // Prevent propagation to stop reordering triggering
@ -67,7 +68,7 @@ export const createActions = (context: StoreContext) => {
} }
// Handler for moving the mouse to resize columns // Handler for moving the mouse to resize columns
const onResizeMouseMove = (e: any) => { const onResizeMouseMove = (e: MouseEvent | TouchEvent) => {
const { initialMouseX, initialWidth, width, column, related } = get(resize) const { initialMouseX, initialWidth, width, column, related } = get(resize)
const { x } = parseEventLocation(e) const { x } = parseEventLocation(e)
const dx = x - initialMouseX! const dx = x - initialMouseX!