diff --git a/packages/frontend-core/src/components/grid/lib/utils.ts b/packages/frontend-core/src/components/grid/lib/utils.ts index 14aee663b7..3dd2d1ddd5 100644 --- a/packages/frontend-core/src/components/grid/lib/utils.ts +++ b/packages/frontend-core/src/components/grid/lib/utils.ts @@ -14,7 +14,9 @@ export const getCellID = (rowId: string, fieldName: string) => { return `${rowId}${CellIDSeparator}${fieldName}` } -export const parseEventLocation = (e: MouseEvent & TouchEvent) => { +export const parseEventLocation = (event: MouseEvent | TouchEvent) => { + const e = event as MouseEvent & TouchEvent + return { x: e.clientX ?? e.touches?.[0]?.clientX, y: e.clientY ?? e.touches?.[0]?.clientY, diff --git a/packages/frontend-core/src/components/grid/stores/reorder.ts b/packages/frontend-core/src/components/grid/stores/reorder.ts index ba606626e3..8f602ab836 100644 --- a/packages/frontend-core/src/components/grid/stores/reorder.ts +++ b/packages/frontend-core/src/components/grid/stores/reorder.ts @@ -64,11 +64,11 @@ export const createActions = (context: StoreContext) => { maxScrollLeft, } = context let latestX = 0 - let autoScrollInterval: any + let autoScrollInterval: NodeJS.Timeout let isAutoScrolling: boolean // 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 $bounds = get(bounds) const $stickyWidth = get(stickyWidth) @@ -113,7 +113,7 @@ export const createActions = (context: StoreContext) => { // Callback when moving the mouse when reordering columns const onReorderMouseMove = (e: MouseEvent | TouchEvent) => { // Immediately handle the current position - const { x } = parseEventLocation(e as any) + const { x } = parseEventLocation(e) latestX = x considerReorderPosition()