This commit is contained in:
Adria Navarro 2025-01-10 11:57:06 +01:00
parent 558b7c88a7
commit ec0de61cf7
2 changed files with 5 additions and 3 deletions

View File

@ -39,7 +39,7 @@
getActionContextKey, getActionContextKey,
getActionDependentContextKeys, getActionDependentContextKeys,
} from "../utils/buttonActions.js" } from "../utils/buttonActions.js"
import { gridLayout } from "utils/grid.js" import { gridLayout } from "utils/grid"
export let instance = {} export let instance = {}
export let parent = null export let parent = null

View File

@ -48,11 +48,13 @@ export const getGridVar = (device: string, param: string) =>
`--grid-${device}-${param}` `--grid-${device}-${param}`
// Determines whether a JS event originated from immediately within a grid // Determines whether a JS event originated from immediately within a grid
export const isGridEvent = (e: any) => { export const isGridEvent = (e: Event & { target: HTMLElement }): boolean => {
return ( return (
e.target.dataset?.indicator === "true" || e.target.dataset?.indicator === "true" ||
// @ts-expect-error: api is not properly typed
e.target e.target
.closest?.(".component") .closest?.(".component")
// @ts-expect-error
?.parentNode.closest(".component") ?.parentNode.closest(".component")
?.childNodes[0]?.classList?.contains("grid") ?.childNodes[0]?.classList?.contains("grid")
) )
@ -101,7 +103,7 @@ export const gridLayout = (node: HTMLDivElement, metadata: any) => {
} }
width += 2 * GridSpacing width += 2 * GridSpacing
height += 2 * GridSpacing height += 2 * GridSpacing
let vars: any = { const vars: Record<string, string> = {
"--default-width": width, "--default-width": width,
"--default-height": height, "--default-height": height,
} }