mirror of https://github.com/OCA/web.git
[MIG] web_widget_mpld3_chart: Migration to 17.0
parent
e75cfb6cf6
commit
c4a5ac7509
|
@ -6,11 +6,11 @@
|
|||
"category": "Hidden",
|
||||
"summary": "This widget allows to display charts using MPLD3 library.",
|
||||
"author": "ForgeFlow, Odoo Community Association (OCA)",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"website": "https://github.com/OCA/web",
|
||||
"depends": ["web"],
|
||||
"data": [],
|
||||
"external_dependencies": {"python": ["mpld3==0.5.9", "beautifulsoup4"]},
|
||||
"external_dependencies": {"python": ["mpld3==0.5.10", "beautifulsoup4"]},
|
||||
"auto_install": False,
|
||||
"development_status": "Beta",
|
||||
"maintainers": ["JordiBForgeFlow", "ChrisOForgeFlow"],
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
|
||||
import {loadBundle} from "@web/core/assets";
|
||||
import {registry} from "@web/core/registry";
|
||||
const {onWillStart, markup, Component, onMounted, onPatched, useRef} = owl;
|
||||
import {Component, markup, onMounted, onPatched, onWillStart, useRef} from "@odoo/owl";
|
||||
|
||||
class Mpld3ChartJsonWidget extends Component {
|
||||
export default class Mpld3ChartJsonWidget 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_mpld3_chart/static/src/lib/d3/d3.v5.js",
|
||||
"/web_widget_mpld3_chart/static/src/lib/mpld3/mpld3.v0.5.9.js",
|
||||
"/web_widget_mpld3_chart/static/src/lib/mpld3/mpld3.v0.5.10.js",
|
||||
],
|
||||
})
|
||||
);
|
||||
|
@ -31,7 +31,11 @@ class Mpld3ChartJsonWidget extends Component {
|
|||
return markup(value);
|
||||
}
|
||||
}
|
||||
Mpld3ChartJsonWidget.template = "web_widget_mpld3_chart.Mpld3ChartJsonWidget";
|
||||
registry.category("fields").add("mpld3_chart", Mpld3ChartJsonWidget);
|
||||
|
||||
export default Mpld3ChartJsonWidget;
|
||||
Mpld3ChartJsonWidget.template = "web_widget_mpld3_chart.Mpld3ChartJsonWidget";
|
||||
|
||||
export const mpld3ChartJsonWidget = {
|
||||
component: Mpld3ChartJsonWidget,
|
||||
};
|
||||
|
||||
registry.category("fields").add("mpld3_chart", mpld3ChartJsonWidget);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates xml:space="preserve">
|
||||
<div t-ref="widget" t-name="web_widget_mpld3_chart.Mpld3ChartJsonWidget" owl="1">
|
||||
<t t-if="props.value.div" t-out="markup(props.value.div)" />
|
||||
<div t-ref="widget" t-name="web_widget_mpld3_chart.Mpld3ChartJsonWidget">
|
||||
<t
|
||||
t-if="this.props.record.data[this.props.name].div"
|
||||
t-out="markup(this.props.record.data[this.props.name].div)"
|
||||
/>
|
||||
</div>
|
||||
</templates>
|
||||
|
|
Loading…
Reference in New Issue