From 5bea7eebd49798233477928f347ea0feaf00a5cc Mon Sep 17 00:00:00 2001 From: glitch4347 Date: Sun, 10 Mar 2024 13:12:30 +0100 Subject: [PATCH 1/4] extract to vue folder --- src/index.ts | 34 +--------------------------------- vue/VueChartwerkLinePod.ts | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 vue/VueChartwerkLinePod.ts diff --git a/src/index.ts b/src/index.ts index 925b516..3a30753 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { ChartwerkPod, VueChartwerkPodMixin, TimeFormat, CrosshairOrientation, BrushOrientation, yAxisOrientation } from '@chartwerk/core'; +import { ChartwerkPod, TimeFormat, CrosshairOrientation, BrushOrientation, yAxisOrientation } from '@chartwerk/core'; import { LineTimeSerie, LineOptions, MouseObj } from './types'; import { Markers } from './components/markers'; import { Segments } from './components/segments'; @@ -447,36 +447,4 @@ class LinePod extends ChartwerkPod { } } -// TODO: it should be moved to VUE folder -// it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod) -export const VueChartwerkLinePod = { - // alternative to `template: '
'` - render(createElement) { - return createElement( - 'div', - { - class: { 'chartwerk-line-pod': true }, - attrs: { id: this.id } - } - ); - }, - mixins: [VueChartwerkPodMixin], - methods: { - render() { - if(this.pod === undefined) { - this.pod = new LinePod(document.getElementById(this.id), this.series, this.options); - this.pod.render(); - } else { - this.pod.updateData(this.series, this.options); - } - }, - renderSharedCrosshair(values) { - this.pod.renderSharedCrosshair(values); - }, - hideSharedCrosshair() { - this.pod.hideSharedCrosshair(); - } - } -}; - export { LineTimeSerie, LineOptions, TimeFormat, LinePod }; diff --git a/vue/VueChartwerkLinePod.ts b/vue/VueChartwerkLinePod.ts new file mode 100644 index 0000000..25f2e9a --- /dev/null +++ b/vue/VueChartwerkLinePod.ts @@ -0,0 +1,33 @@ +import { LinePod } from '@chartwerk/line-pod'; +import { VueChartwerkPodMixin } from '@chartwerk/core'; + +// it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod) +export const VueChartwerkLinePod = { + // alternative to `template: '
'` + render(createElement) { + return createElement( + 'div', + { + class: { 'chartwerk-line-pod': true }, + attrs: { id: this.id } + } + ); + }, + mixins: [VueChartwerkPodMixin], + methods: { + render() { + if(this.pod === undefined) { + this.pod = new LinePod(document.getElementById(this.id), this.series, this.options); + this.pod.render(); + } else { + this.pod.updateData(this.series, this.options); + } + }, + renderSharedCrosshair(values) { + this.pod.renderSharedCrosshair(values); + }, + hideSharedCrosshair() { + this.pod.hideSharedCrosshair(); + } + } +}; -- 2.34.1 From fbc412fee4429f2e585dbd1002d6db6da68ad31b Mon Sep 17 00:00:00 2001 From: glitch4347 Date: Mon, 11 Mar 2024 09:10:43 +0100 Subject: [PATCH 2/4] poty vue folder --- build/webpack.base.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index 305a3d5..f37f9fa 100755 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -13,6 +13,7 @@ module.exports = { new CopyPlugin({ patterns: [ { from: "../react", to: "react" }, + { from: "../vue", to: "vue" }, ], }) ], -- 2.34.1 From e901f51c1643e173512f3b87848c4a8e8ef1b070 Mon Sep 17 00:00:00 2001 From: glitch4347 Date: Mon, 11 Mar 2024 09:12:18 +0100 Subject: [PATCH 3/4] import line-pod from .. --- vue/VueChartwerkLinePod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue/VueChartwerkLinePod.ts b/vue/VueChartwerkLinePod.ts index 25f2e9a..0a7eea9 100644 --- a/vue/VueChartwerkLinePod.ts +++ b/vue/VueChartwerkLinePod.ts @@ -1,4 +1,4 @@ -import { LinePod } from '@chartwerk/line-pod'; +import { LinePod } from '..'; import { VueChartwerkPodMixin } from '@chartwerk/core'; // it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod) -- 2.34.1 From 328b6f7b1f66431c57bf0a07fdd7a95cbbb52b66 Mon Sep 17 00:00:00 2001 From: glitch4347 Date: Mon, 11 Mar 2024 09:15:40 +0100 Subject: [PATCH 4/4] rename --- vue/VueChartwerkLinePod.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vue/VueChartwerkLinePod.ts b/vue/VueChartwerkLinePod.ts index 0a7eea9..534e7d0 100644 --- a/vue/VueChartwerkLinePod.ts +++ b/vue/VueChartwerkLinePod.ts @@ -2,7 +2,7 @@ import { LinePod } from '..'; import { VueChartwerkPodMixin } from '@chartwerk/core'; // it is used with Vue.component, e.g.: Vue.component('chartwerk-line-pod', VueChartwerkLinePod) -export const VueChartwerkLinePod = { +export const ChartwerkLinePod = { // alternative to `template: '
'` render(createElement) { return createElement( -- 2.34.1