From 1bb3c55fc2604f592942b5429c2e938a30d23b54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Mon, 2 Dec 2024 16:27:39 +0100 Subject: [PATCH] Use model sizes for dialog_content --- panel/models/modal.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/panel/models/modal.ts b/panel/models/modal.ts index 21ec9227ef..05c8a7a7eb 100644 --- a/panel/models/modal.ts +++ b/panel/models/modal.ts @@ -4,6 +4,7 @@ import {div, button} from "@bokehjs/core/dom" import {ModelEvent, server_event} from "@bokehjs/core/bokeh_events" import type {Attrs} from "@bokehjs/core/types" import {UIElementView} from "@bokehjs/models/ui/ui_element" +import {isNumber} from "@bokehjs/core/util/types" import {LayoutDOMView} from "@bokehjs/models/layouts/layout_dom" type A11yDialogView = { @@ -73,11 +74,21 @@ export class ModalView extends BkColumnView { dialog_overlay.setAttribute("data-a11y-dialog-hide", "") } - // TODO: Add width and height here + const {height, width, min_height, min_width, max_height, max_width} = this.model + const convert_fn = (size: any) => { return isNumber(size) ? `${size}px` : size } const content = div({ id: "pnx_dialog_content", class: "dialog-content", role: "document", + style: { + height: convert_fn(height), + width: convert_fn(width), + min_height: convert_fn(min_height), + min_width: convert_fn(min_width), + max_height: convert_fn(max_height), + max_width: convert_fn(max_width), + overflow: "auto", + }, } as any) for (const child_view of this.child_views) { const target = child_view.rendering_target() ?? content