Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
54
web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.esm.js
Executable file
54
web_widget_bokeh_chart/static/src/js/web_widget_bokeh_chart.esm.js
Executable file
@@ -0,0 +1,54 @@
|
||||
import {markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||
import {CharField, charField} from "@web/views/fields/char/char_field";
|
||||
import {loadJS} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
export async function loadBokehLibraries() {
|
||||
const scripts = [
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.6.3.min.js",
|
||||
];
|
||||
|
||||
for (const script of scripts) {
|
||||
await loadJS(script);
|
||||
}
|
||||
}
|
||||
export default class BokehChartWidget extends CharField {
|
||||
setup() {
|
||||
this.widget = useRef("widget");
|
||||
onPatched(() => {
|
||||
var script = document.createElement("script");
|
||||
script.text = this.json_value.script;
|
||||
this.widget.el.append(script);
|
||||
});
|
||||
onMounted(() => {
|
||||
var script = document.createElement("script");
|
||||
script.text = this.json_value.script;
|
||||
this.widget.el.append(script);
|
||||
});
|
||||
super.setup();
|
||||
onWillStart(() => loadBokehLibraries());
|
||||
}
|
||||
get json_value() {
|
||||
var value = false;
|
||||
if (this.props.record.data[this.props.name]) {
|
||||
value = JSON.parse(this.props.record.data[this.props.name]);
|
||||
if (value) {
|
||||
value.div = markup(value.div.trim());
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
BokehChartWidget.template = "web_widget_bokeh_chart.BokehChartField";
|
||||
|
||||
export const bokehChartWidget = {
|
||||
...charField,
|
||||
component: BokehChartWidget,
|
||||
};
|
||||
|
||||
registry.category("fields").add("bokeh_chart", bokehChartWidget);
|
||||
47
web_widget_bokeh_chart/static/src/js/web_widget_bokeh_json_chart.esm.js
Executable file
47
web_widget_bokeh_chart/static/src/js/web_widget_bokeh_json_chart.esm.js
Executable file
@@ -0,0 +1,47 @@
|
||||
import {Component, markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||
import {loadJS} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
|
||||
export async function loadBokehLibraries() {
|
||||
const scripts = [
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.6.3.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.6.3.min.js",
|
||||
];
|
||||
|
||||
for (const script of scripts) {
|
||||
await loadJS(script);
|
||||
}
|
||||
}
|
||||
|
||||
export default class BokehChartJsonWidget extends Component {
|
||||
setup() {
|
||||
this.widget = useRef("widget");
|
||||
onPatched(() => {
|
||||
var script = document.createElement("script");
|
||||
script.text = this.props.record.data[this.props.name].script;
|
||||
this.widget.el.append(script);
|
||||
});
|
||||
onMounted(() => {
|
||||
var script = document.createElement("script");
|
||||
script.text = this.props.record.data[this.props.name].script;
|
||||
this.widget.el.append(script);
|
||||
});
|
||||
onWillStart(() => loadBokehLibraries());
|
||||
}
|
||||
markup(value) {
|
||||
console.log("Marking up...");
|
||||
return markup(value);
|
||||
}
|
||||
}
|
||||
|
||||
BokehChartJsonWidget.template = "web_widget_bokeh_chart.BokehChartlJsonField";
|
||||
|
||||
export const bokehChartJsonWidget = {
|
||||
component: BokehChartJsonWidget,
|
||||
};
|
||||
|
||||
registry.category("fields").add("bokeh_chart_json", bokehChartJsonWidget);
|
||||
728
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.6.3.min.js
vendored
Executable file
728
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
61
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.6.3.min.js
vendored
Executable file
61
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
81
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.6.3.min.js
vendored
Executable file
81
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
330
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.6.3.min.js
vendored
Executable file
330
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
119
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.6.3.min.js
vendored
Executable file
119
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
141
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.6.3.min.js
vendored
Executable file
141
web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.6.3.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
9
web_widget_bokeh_chart/static/src/xml/bokeh.xml
Executable file
9
web_widget_bokeh_chart/static/src/xml/bokeh.xml
Executable file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartField">
|
||||
<t t-out="json_value.div" />
|
||||
</div>
|
||||
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartlJsonField">
|
||||
<t t-out="markup(this.props.record.data[this.props.name].div)" />
|
||||
</div>
|
||||
</templates>
|
||||
Reference in New Issue
Block a user