I’m currently running bokeh(2.3.0.dev12), node( 14.15.5) and npm (6.14.11). i can’t figure out how to get the default value from Bokeh to pass into the component. please find below an isolated example:
from bokeh.plotting import curdoc
from bokeh.core.properties import String
from bokeh.models import HTMLBox
from bokeh.util.compiler import TypeScript
CODE = """
import {HTMLBox, HTMLBoxView} from "models/layouts/html_box"
import * as p from "core/properties"
export class AlertBoxView extends HTMLBoxView {
model: AlertBox
render(): void {
const { message } = this.model;
super.render();
console.log("@ render", message);
this.el.innerHTML = `Message is: ${message}`;
}
}
export namespace AlertBox {
export type Attrs = p.AttrsOf<Props>
export type Props = HTMLBox.Props & {
message: p.Property<string>
}
}
export interface AlertBox extends AlertBox.Attrs {}
export class AlertBox extends HTMLBox {
properties: AlertBox.Props
__view_type__: AlertBoxView
constructor(attrs?: Partial<AlertBox.Attrs>) {
console.log("@@@@ attrs are", attrs);
super(attrs)
}
static init_AlertBox(): void {
this.prototype.default_view = AlertBoxView
this.define<AlertBox.Props>(({String}) => ({
message: [String],
}));
}
}
"""
class AlertBox(HTMLBox):
__implementation__ = TypeScript(CODE)
message = String(default="passing a default value!")
# Get a reference to the document we will be creating
doc = curdoc()
# Put the column into the document
doc.add_root(AlertBox(
# message="This is a component processed"
))
The output in html is:
Message is: null
am i missing a step in configuring default values?
thanks in advance!