[15.0][MIG] web_widget_bokeh_chart

This commit is contained in:
Christopher Ormaza
2021-12-10 11:44:07 -05:00
committed by OriolMForgeFlow
parent 859757c10e
commit efba9c080d
17 changed files with 1355 additions and 822 deletions

View File

@@ -0,0 +1,32 @@
/** @odoo-module **/
import basicFields from "web.basic_fields";
import fieldRegistry from "web.field_registry";
const BokehChartWidget = basicFields.FieldChar.extend({
jsLibs: [
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-api-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-widgets-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-tables-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-mathjax-2.4.2.min.js",
"/web_widget_bokeh_chart/static/src/lib/bokeh/bokeh-gl-2.4.2.min.js",
],
_renderReadonly: function () {
try {
const val = JSON.parse(this.value);
this.$el.html(val.div);
const script = document.createElement("script");
script.setAttribute("type", "text/javascript");
if ("textContent" in script) script.textContent = val.script;
else script.text = val.script;
$("head").append(script);
} catch (error) {
return this._super(...arguments);
}
},
});
fieldRegistry.add("bokeh_chart", BokehChartWidget);
export default BokehChartWidget;

View File

@@ -1,17 +0,0 @@
odoo.define("web_widget_bokeh_chart", function (require) {
"use strict";
var fieldRegistry = require("web.field_registry");
var AbstractField = require("web.AbstractField");
var BokehChartWidget = AbstractField.extend({
_renderReadonly: function () {
var val = this.value;
this.$el.html(val);
},
});
fieldRegistry.add("bokeh_chart", BokehChartWidget);
return {
BokehChartWidget: BokehChartWidget,
};
});

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