UNPKG

@bokeh/bokehjs

Version:

Interactive, novel data visualization

55 lines 2.03 kB
import { ActionTool, ActionToolView } from "./action_tool"; import * as icons from "../../../styles/icons.css"; import { Dialog } from "../../ui/dialog"; import { Examiner } from "../../ui/examiner"; import { ValuePrinter } from "../../ui/printers"; import { HTML } from "../../dom/html"; import { build_view } from "../../../core/build_views"; import { div } from "../../../core/dom"; import pretty_css from "../../../styles/pretty.css"; import { render } from "preact"; export class ExamineToolView extends ActionToolView { static __name__ = "ExamineToolView"; dialog; children_views() { return [...super.children_views(), this.dialog]; } async lazy_initialize() { await super.lazy_initialize(); const target = this.parent.model; const printer = new ValuePrinter(); const title_el = div(); render(printer.to_html(target), title_el); // NOTE because preact prepends during render // TODO add support for VNode to HTML model title_el.prepend("Examine "); const dialog = new Dialog({ stylesheets: [pretty_css], title: new HTML({ html: title_el }), content: new Examiner({ target, stylesheets: [":host { width: 100%; height: 100%; }"] }), visible: false, close_action: "hide", }); this.dialog = await build_view(dialog, { parent: this.parent }); } connect_signals() { super.connect_signals(); this.dialog.displayed.connect((visible) => this.model.active = visible); } doit() { this.dialog.toggle(); } } export class ExamineTool extends ActionTool { static __name__ = "ExamineTool"; constructor(attrs) { super(attrs); } static { this.prototype.default_view = ExamineToolView; this.register_alias("examine", () => new ExamineTool()); } tool_name = "Examine"; tool_icon = icons.tool_icon_settings; // TODO: better icon } //# sourceMappingURL=examine_tool.js.map