Type anys
This commit is contained in:
parent
451b4c4eea
commit
a9a2f77340
|
@ -2,11 +2,17 @@ import { get, writable, derived, Writable, Readable } from "svelte/store"
|
||||||
import { parseEventLocation } from "../lib/utils"
|
import { parseEventLocation } from "../lib/utils"
|
||||||
import { Store as StoreContext } from "."
|
import { Store as StoreContext } from "."
|
||||||
|
|
||||||
|
interface Breakpoint {
|
||||||
|
x: number
|
||||||
|
column: string
|
||||||
|
insertAfter: boolean
|
||||||
|
}
|
||||||
|
|
||||||
interface ReorderInitialStoreData {
|
interface ReorderInitialStoreData {
|
||||||
sourceColumn: any
|
sourceColumn: string | null
|
||||||
targetColumn: any
|
targetColumn: string | null
|
||||||
insertAfter?: boolean
|
insertAfter?: boolean
|
||||||
breakpoints: any[]
|
breakpoints: Breakpoint[]
|
||||||
gridLeft: number
|
gridLeft: number
|
||||||
width: number
|
width: number
|
||||||
increment?: number
|
increment?: number
|
||||||
|
@ -140,7 +146,7 @@ export const createActions = (context: StoreContext) => {
|
||||||
const $scrollLeft = get(scrollLeft)
|
const $scrollLeft = get(scrollLeft)
|
||||||
|
|
||||||
// Compute the closest breakpoint to the current position
|
// Compute the closest breakpoint to the current position
|
||||||
let breakpoint: any
|
let breakpoint: Breakpoint | undefined
|
||||||
let minDistance = Number.MAX_SAFE_INTEGER
|
let minDistance = Number.MAX_SAFE_INTEGER
|
||||||
const mouseX = latestX - $reorder.gridLeft + $scrollLeft
|
const mouseX = latestX - $reorder.gridLeft + $scrollLeft
|
||||||
$reorder.breakpoints.forEach(point => {
|
$reorder.breakpoints.forEach(point => {
|
||||||
|
@ -157,8 +163,8 @@ export const createActions = (context: StoreContext) => {
|
||||||
) {
|
) {
|
||||||
reorder.update(state => ({
|
reorder.update(state => ({
|
||||||
...state,
|
...state,
|
||||||
targetColumn: breakpoint.column,
|
targetColumn: breakpoint!.column,
|
||||||
insertAfter: breakpoint.insertAfter,
|
insertAfter: breakpoint!.insertAfter,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue