forked from Techsystech/web
parent
258923c78a
commit
cef27bcd68
|
@ -1,3 +1,3 @@
|
|||
# generated from manifests external_dependencies
|
||||
bokeh==3.1.1
|
||||
bokeh==3.4.1
|
||||
plotly==5.22.0
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
"category": "Hidden",
|
||||
"summary": "This widget allows to display charts using Bokeh library.",
|
||||
"author": "ForgeFlow, " "Odoo Community Association (OCA), " "Creu Blanca",
|
||||
"version": "16.0.1.1.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"maintainers": ["LoisRForgeFlow", "ChrisOForgeFlow"],
|
||||
"development_status": "Production/Stable",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": ["web"],
|
||||
"data": [],
|
||||
"external_dependencies": {"python": ["bokeh==3.1.1"]},
|
||||
"external_dependencies": {"python": ["bokeh==3.4.1"]},
|
||||
"auto_install": False,
|
||||
"license": "LGPL-3",
|
||||
"assets": {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||
import {CharField} from "@web/views/fields/char/char_field";
|
||||
import {loadBundle} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
const {onWillStart, markup, onMounted, onPatched, useRef} = owl;
|
||||
|
||||
export default class BokehChartWidget extends CharField {
|
||||
setup() {
|
||||
|
@ -22,23 +22,32 @@ export default class BokehChartWidget extends CharField {
|
|||
onWillStart(() =>
|
||||
loadBundle({
|
||||
jsLibs: [
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.4.1.min.js",
|
||||
],
|
||||
})
|
||||
);
|
||||
}
|
||||
get json_value() {
|
||||
var value = JSON.parse(this.props.value);
|
||||
if (value) {
|
||||
value.div = markup(value.div.trim());
|
||||
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";
|
||||
registry.category("fields").add("bokeh_chart", BokehChartWidget);
|
||||
|
||||
export const bokehChartWidget = {
|
||||
...CharField,
|
||||
component: BokehChartWidget,
|
||||
};
|
||||
|
||||
registry.category("fields").add("bokeh_chart", bokehChartWidget);
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import {Component, markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||
import {loadBundle} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
const {onWillStart, markup, Component, onMounted, onPatched, useRef} = owl;
|
||||
|
||||
export default class BokehChartJsonWidget extends Component {
|
||||
setup() {
|
||||
this.widget = useRef("widget");
|
||||
onPatched(() => {
|
||||
var script = document.createElement("script");
|
||||
script.text = this.props.value.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.value.script;
|
||||
script.text = this.props.record.data[this.props.name].script;
|
||||
this.widget.el.append(script);
|
||||
});
|
||||
onWillStart(() =>
|
||||
loadBundle({
|
||||
jsLibs: [
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.1.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-3.4.1.min.js",
|
||||
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-3.4.1.min.js",
|
||||
],
|
||||
})
|
||||
);
|
||||
|
@ -37,4 +37,9 @@ export default class BokehChartJsonWidget extends Component {
|
|||
}
|
||||
|
||||
BokehChartJsonWidget.template = "web_widget_bokeh_chart.BokehChartlJsonField";
|
||||
registry.category("fields").add("bokeh_chart_json", BokehChartJsonWidget);
|
||||
|
||||
export const bokehChartJsonWidget = {
|
||||
component: BokehChartJsonWidget,
|
||||
};
|
||||
|
||||
registry.category("fields").add("bokeh_chart_json", bokehChartJsonWidget);
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<div t-ref="widget" t-name="web_widget_bokeh_chart.BokehChartField" owl="1">
|
||||
<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" owl="1">
|
||||
<t t-out="markup(props.value.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>
|
||||
|
|
Loading…
Reference in New Issue