Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing grid resize store #15272

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Type any
  • Loading branch information
adrinr committed Dec 31, 2024
commit 3483e06e3c7415940f79a1b0392b618d5d8ce249
7 changes: 4 additions & 3 deletions packages/frontend-core/src/components/grid/stores/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { writable, get, derived, Writable, Readable } from "svelte/store"
import { MinColumnWidth, DefaultColumnWidth } from "../lib/constants"
import { parseEventLocation } from "../lib/utils"
import { Store as StoreContext } from "."
import { UIColumn } from "@budibase/types"

interface ResizeInitialStoreData {
initialMouseX: number | null
initialWidth: number | null
column: string | null
width: number
left: number
related?: any
related?: UIColumn["related"]
}

const initialState: ResizeInitialStoreData = {
Expand Down Expand Up @@ -40,7 +41,7 @@ export const createActions = (context: StoreContext) => {
const { resize, ui, datasource } = context

// Starts resizing a certain column
const startResizing = (column: any, e: any) => {
const startResizing = (column: UIColumn, e: MouseEvent | TouchEvent) => {
const { x } = parseEventLocation(e)

// Prevent propagation to stop reordering triggering
Expand All @@ -67,7 +68,7 @@ export const createActions = (context: StoreContext) => {
}

// 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 { x } = parseEventLocation(e)
const dx = x - initialMouseX!
Expand Down
Loading