mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Canvas: Fix canvas style regression (#87363)
This commit is contained in:
parent
1ef1cc7e3f
commit
5e4722fe2e
@ -2195,7 +2195,12 @@ exports[`better eslint`] = {
|
|||||||
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "3"]
|
[0, 0, 0, "Do not use export all (\`export * from ...\`)", "3"]
|
||||||
],
|
],
|
||||||
"public/app/features/canvas/runtime/element.tsx:5381": [
|
"public/app/features/canvas/runtime/element.tsx:5381": [
|
||||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"]
|
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "1"],
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "2"],
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "3"],
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "4"],
|
||||||
|
[0, 0, 0, "Do not use any type assertions.", "5"]
|
||||||
],
|
],
|
||||||
"public/app/features/canvas/runtime/frame.tsx:5381": [
|
"public/app/features/canvas/runtime/frame.tsx:5381": [
|
||||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||||
|
@ -191,16 +191,18 @@ export class ElementState implements LayerElement {
|
|||||||
this.sizeStyle = style;
|
this.sizeStyle = style;
|
||||||
|
|
||||||
if (this.div) {
|
if (this.div) {
|
||||||
for (const [key, value] of Object.entries(this.sizeStyle)) {
|
for (const key in this.sizeStyle) {
|
||||||
this.div.style.setProperty(key, value);
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
this.div.style[key as any] = (this.sizeStyle as any)[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is a hack, we should have a better way to handle this
|
// TODO: This is a hack, we should have a better way to handle this
|
||||||
const elementType = this.options.type;
|
const elementType = this.options.type;
|
||||||
if (!SVGElements.has(elementType)) {
|
if (!SVGElements.has(elementType)) {
|
||||||
// apply styles to div if it's not an SVG element
|
// apply styles to div if it's not an SVG element
|
||||||
for (const [key, value] of Object.entries(this.dataStyle)) {
|
for (const key in this.dataStyle) {
|
||||||
this.div.style.setProperty(key, value);
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
this.div.style[key as any] = (this.dataStyle as any)[key];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// ELEMENT IS SVG
|
// ELEMENT IS SVG
|
||||||
@ -209,7 +211,8 @@ export class ElementState implements LayerElement {
|
|||||||
// wrapper div element (this.div) doesn't re-render (has static `key` property),
|
// wrapper div element (this.div) doesn't re-render (has static `key` property),
|
||||||
// so we have to clean styles manually;
|
// so we have to clean styles manually;
|
||||||
for (const key in this.dataStyle) {
|
for (const key in this.dataStyle) {
|
||||||
this.div.style.removeProperty(key);
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
this.div.style[key as any] = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user