Type anys
This commit is contained in:
parent
a9a2f77340
commit
2afa104c39
|
@ -14,7 +14,9 @@ export const getCellID = (rowId: string, fieldName: string) => {
|
||||||
return `${rowId}${CellIDSeparator}${fieldName}`
|
return `${rowId}${CellIDSeparator}${fieldName}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const parseEventLocation = (e: MouseEvent & TouchEvent) => {
|
export const parseEventLocation = (event: MouseEvent | TouchEvent) => {
|
||||||
|
const e = event as MouseEvent & TouchEvent
|
||||||
|
|
||||||
return {
|
return {
|
||||||
x: e.clientX ?? e.touches?.[0]?.clientX,
|
x: e.clientX ?? e.touches?.[0]?.clientX,
|
||||||
y: e.clientY ?? e.touches?.[0]?.clientY,
|
y: e.clientY ?? e.touches?.[0]?.clientY,
|
||||||
|
|
|
@ -64,11 +64,11 @@ export const createActions = (context: StoreContext) => {
|
||||||
maxScrollLeft,
|
maxScrollLeft,
|
||||||
} = context
|
} = context
|
||||||
let latestX = 0
|
let latestX = 0
|
||||||
let autoScrollInterval: any
|
let autoScrollInterval: NodeJS.Timeout
|
||||||
let isAutoScrolling: boolean
|
let isAutoScrolling: boolean
|
||||||
|
|
||||||
// Callback when dragging on a colum header and starting reordering
|
// Callback when dragging on a colum header and starting reordering
|
||||||
const startReordering = (column: any, e: any) => {
|
const startReordering = (column: string, e: MouseEvent | TouchEvent) => {
|
||||||
const $scrollableColumns = get(scrollableColumns)
|
const $scrollableColumns = get(scrollableColumns)
|
||||||
const $bounds = get(bounds)
|
const $bounds = get(bounds)
|
||||||
const $stickyWidth = get(stickyWidth)
|
const $stickyWidth = get(stickyWidth)
|
||||||
|
@ -113,7 +113,7 @@ export const createActions = (context: StoreContext) => {
|
||||||
// Callback when moving the mouse when reordering columns
|
// Callback when moving the mouse when reordering columns
|
||||||
const onReorderMouseMove = (e: MouseEvent | TouchEvent) => {
|
const onReorderMouseMove = (e: MouseEvent | TouchEvent) => {
|
||||||
// Immediately handle the current position
|
// Immediately handle the current position
|
||||||
const { x } = parseEventLocation(e as any)
|
const { x } = parseEventLocation(e)
|
||||||
latestX = x
|
latestX = x
|
||||||
considerReorderPosition()
|
considerReorderPosition()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue