Skip to content

Commit

Permalink
Allow multiple tooltip entries by cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpap committed Feb 27, 2024
1 parent 32d00b2 commit fe501ce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
14 changes: 6 additions & 8 deletions bokehjs/src/lib/models/dom/value_of.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {DOMNode, DOMNodeView} from "./dom_node"
import {DOMElement, DOMElementView} from "./dom_element"
import {HasProps} from "core/has_props"
import {empty} from "core/dom"
import {to_string} from "core/util/pretty"
import type * as p from "core/properties"

export class ValueOfView extends DOMNodeView {
export class ValueOfView extends DOMElementView {
declare model: ValueOf
declare el: HTMLElement

override connect_signals(): void {
super.connect_signals()
Expand All @@ -17,8 +15,8 @@ export class ValueOfView extends DOMNodeView {
}
}

render(): void {
empty(this.el)
override render(): void {
super.render()
this.el.style.display = "contents"

const text = (() => {
Expand All @@ -37,15 +35,15 @@ export class ValueOfView extends DOMNodeView {

export namespace ValueOf {
export type Attrs = p.AttrsOf<Props>
export type Props = DOMNode.Props & {
export type Props = DOMElement.Props & {
obj: p.Property<HasProps>
attr: p.Property<string>
}
}

export interface ValueOf extends ValueOf.Attrs {}

export class ValueOf extends DOMNode {
export class ValueOf extends DOMElement {
declare properties: ValueOf.Props
declare __view_type__: ValueOfView

Expand Down
2 changes: 1 addition & 1 deletion bokehjs/src/lib/models/tools/inspectors/hover_tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ export class HoverToolView extends InspectToolView {
const {_template_view} = this
assert(_template_view != null)
this._update_template(_template_view, ds, i, vars)
return _template_view.el
return _template_view.el.cloneNode(true)
} else if (tooltips != null) {
const template = this._template_el ?? (this._template_el = this._create_template(tooltips))
return this._render_template(template, tooltips, ds, vars)
Expand Down
2 changes: 1 addition & 1 deletion src/bokeh/models/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, *args, **kwargs) -> None:
groups = List(Instance(".models.renderers.RendererGroup"))

@abstract
class Placeholder(DOMNode):
class Placeholder(DOMElement):

# explicit __init__ to support Init signatures
def __init__(self, *args, **kwargs) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/defaults.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@
__extends__: "bokeh.models.dom.Placeholder",
},
"bokeh.models.dom.Placeholder": {
__extends__: "bokeh.models.dom.DOMNode",
__extends__: "bokeh.models.dom.DOMElement",
},
"bokeh.models.dom.Span": {
__extends__: "bokeh.models.dom.DOMElement",
Expand Down

0 comments on commit fe501ce

Please sign in to comment.