@vyr/echarts 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,22 +1 @@
1
- {
2
- "name": "@vyr/echarts",
3
- "version": "0.0.1",
4
- "description": "",
5
- "main": "./src/index.ts",
6
- "author": "",
7
- "sideEffects": true,
8
- "license": "MIT",
9
- "dependencies": {
10
- "@vyr/locale": "0.0.1",
11
- "@vyr/engine": "0.0.1",
12
- "echarts": "^5.5.0"
13
- },
14
- "files": [
15
- "package.json",
16
- "src/"
17
- ],
18
- "vyr": {
19
- "type": "universal",
20
- "order": 10
21
- }
22
- }
1
+ {"name":"@vyr/echarts","version":"0.0.3","description":"","main":"./src/index.ts","author":"","sideEffects":true,"license":"MIT","dependencies":{"@vyr/locale":"0.0.3","@vyr/engine":"0.0.3","echarts":"^5.5.0"},"files":["package.json","src/"],"vyr":{"type":"universal","order":10}}
@@ -1,5 +1,5 @@
1
1
  import * as echarts from 'echarts'
2
- import { DatasetDescriptor, HTMLActor, UpdateArgs } from "@vyr/engine";
2
+ import { DatasetDescriptor, HTMLActor } from "@vyr/engine";
3
3
  import { EchartDescriptor } from "../descriptor";
4
4
  import { ServiceEchartInterpreter } from '../interpreter';
5
5
 
@@ -43,7 +43,7 @@ class EchartActor extends HTMLActor {
43
43
 
44
44
  remove() { }
45
45
 
46
- getXAxis(descriptor: EchartDescriptor, args: UpdateArgs) {
46
+ getXAxis(descriptor: EchartDescriptor) {
47
47
  const xAxis: AxisOption = {
48
48
  show: descriptor.xAxisShow,
49
49
  axisLine: descriptor.xAxisLine,
@@ -54,7 +54,7 @@ class EchartActor extends HTMLActor {
54
54
  if (descriptor.xAxisType) xAxis.type = descriptor.xAxisType
55
55
  return xAxis
56
56
  }
57
- getYAxis(descriptor: EchartDescriptor, args: UpdateArgs) {
57
+ getYAxis(descriptor: EchartDescriptor) {
58
58
  const yAxis: AxisOption = {
59
59
  show: descriptor.yAxisShow,
60
60
  axisLine: descriptor.yAxisLine,
@@ -65,7 +65,7 @@ class EchartActor extends HTMLActor {
65
65
  if (descriptor.yAxisType) yAxis.type = descriptor.yAxisType
66
66
  return yAxis
67
67
  }
68
- getGrid(descriptor: EchartDescriptor, args: UpdateArgs) {
68
+ getGrid(descriptor: EchartDescriptor) {
69
69
  const grid = {
70
70
  show: descriptor.gridShow,
71
71
  ...descriptor.gridRect,
@@ -73,7 +73,7 @@ class EchartActor extends HTMLActor {
73
73
 
74
74
  return grid
75
75
  }
76
- getLegend(descriptor: EchartDescriptor, args: UpdateArgs) {
76
+ getLegend(descriptor: EchartDescriptor) {
77
77
  const legend = {
78
78
  show: descriptor.legendShow,
79
79
  type: descriptor.legendType || undefined,
@@ -85,7 +85,7 @@ class EchartActor extends HTMLActor {
85
85
  }
86
86
  return legend
87
87
  }
88
- getTooltip(descriptor: EchartDescriptor, args: UpdateArgs) {
88
+ getTooltip(descriptor: EchartDescriptor) {
89
89
  const tooltip = {
90
90
  show: descriptor.tooltipShow,
91
91
  trigger: descriptor.tooltipTrigger,
@@ -94,7 +94,7 @@ class EchartActor extends HTMLActor {
94
94
  return tooltip
95
95
  }
96
96
 
97
- getDataZoom(descriptor: EchartDescriptor, args: UpdateArgs) {
97
+ getDataZoom(descriptor: EchartDescriptor) {
98
98
  const dataZoom = [
99
99
  {
100
100
  // 设置滚动条的隐藏或显示
@@ -131,34 +131,34 @@ class EchartActor extends HTMLActor {
131
131
  return dataZoom
132
132
  }
133
133
 
134
- setOptions(descriptor: EchartDescriptor, args: UpdateArgs) {
134
+ setOptions(descriptor: EchartDescriptor) {
135
135
  const dimensions: string[] = [descriptor.xAxisModelValue]
136
136
  const children: EchartServiceOption[] = []
137
137
  const graphics = HTMLActor.getGraphics(this)
138
138
  for (const serie of descriptor.children) {
139
139
  dimensions.push(serie.modelValue)
140
140
  const interpreter = graphics.getInterpreter<ServiceEchartInterpreter>(serie)
141
- children.push(interpreter.getService(serie, args))
141
+ children.push(interpreter.getService(serie))
142
142
  }
143
143
 
144
- const xAxis = this.getXAxis(descriptor, args)
145
- const yAxis = this.getYAxis(descriptor, args)
146
- const grid = this.getGrid(descriptor, args)
147
- const legend = this.getLegend(descriptor, args)
148
- const tooltip = this.getTooltip(descriptor, args)
149
- const dataZoom = descriptor.scroll.end <= 0 ? undefined : this.getDataZoom(descriptor, args)
144
+ const xAxis = this.getXAxis(descriptor)
145
+ const yAxis = this.getYAxis(descriptor)
146
+ const grid = this.getGrid(descriptor)
147
+ const legend = this.getLegend(descriptor)
148
+ const tooltip = this.getTooltip(descriptor)
149
+ const dataZoom = descriptor.scroll.end <= 0 ? undefined : this.getDataZoom(descriptor)
150
150
  const dataset = { dimensions, source: DatasetDescriptor.getCollection(descriptor.dataset) }
151
151
 
152
152
  this.options = { xAxis, yAxis, grid, legend, tooltip, dataset, dataZoom, series: children }
153
153
  }
154
154
 
155
- update(descriptor: EchartDescriptor, args: UpdateArgs) {
155
+ update(descriptor: EchartDescriptor) {
156
156
  const wrapper = this.getWrapper()
157
- this.setHTMLStyle(wrapper, this.getWrapperStyle(descriptor, args))
158
- this.setHTMLInteraction(wrapper, descriptor, args)
159
- this.setHTMLStyle(this.DOM, this.getLayoutStyle(descriptor, args))
160
- this.setStyleClass(this.DOM, this.getStyleClass(descriptor, args))
161
- this.setOptions(descriptor, args)
157
+ this.setHTMLStyle(wrapper, this.getWrapperStyle(descriptor))
158
+ this.setHTMLInteraction(wrapper, descriptor)
159
+ this.setHTMLStyle(this.DOM, this.getLayoutStyle(descriptor))
160
+ this.setStyleClass(this.DOM, this.getStyleClass(descriptor))
161
+ this.setOptions(descriptor)
162
162
  this.instance.clear()
163
163
  this.instance.setOption(this.options)
164
164
  const rect = wrapper.getBoundingClientRect()
@@ -1,12 +1,11 @@
1
- import { UpdateArgs } from "@vyr/engine";
2
1
  import { BarServiceEchartDescriptor } from "../descriptor";
3
2
  import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
4
3
 
5
4
  class BarServiceEchartInterpreter extends ServiceEchartInterpreter {
6
5
  static type = BarServiceEchartDescriptor.type
7
6
 
8
- getService(descriptor: BarServiceEchartDescriptor, args: UpdateArgs) {
9
- const service = super.getService(descriptor, args)
7
+ getService(descriptor: BarServiceEchartDescriptor) {
8
+ const service = super.getService(descriptor)
10
9
 
11
10
  return {
12
11
  ...service,
@@ -1,41 +1,41 @@
1
- import { Descriptor, HTMLActor, Interpreter, PickupObject, UpdateArgs } from "@vyr/engine";
1
+ import { Descriptor, HTMLActor, Interpreter, PickupObject } from "@vyr/engine";
2
2
  import { EchartDescriptor } from "../descriptor";
3
3
  import { EchartActor } from "../actor";
4
4
 
5
5
  class EchartInterpreter extends Interpreter {
6
6
  static type = EchartDescriptor.type
7
7
 
8
- protected createActor(descriptor: EchartDescriptor, args: UpdateArgs) {
8
+ protected createActor(descriptor: EchartDescriptor) {
9
9
  return new EchartActor(descriptor.uuid)
10
10
  }
11
11
 
12
- update(descriptor: EchartDescriptor, args: UpdateArgs) {
13
- super.update(descriptor, args)
14
-
15
- const actor = this.getActor<EchartActor>(descriptor, args)
16
- actor.update(descriptor, args)
12
+ update(descriptor: EchartDescriptor) {
13
+ super.update(descriptor)
14
+
15
+ const actor = this.getActor<EchartActor>(descriptor)
16
+ actor.update(descriptor)
17
17
  }
18
18
 
19
- mount(descriptor: EchartDescriptor, args: UpdateArgs, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
20
- super.mount(descriptor, args, parentInterpreter, parentDescriptor)
21
- const actor = this.getActor<EchartActor>(descriptor, args)
19
+ mount(descriptor: EchartDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
20
+ super.mount(descriptor, parentInterpreter, parentDescriptor)
21
+ const actor = this.getActor<EchartActor>(descriptor)
22
22
 
23
- const parenActor = parentInterpreter.getActor<HTMLActor>(parentDescriptor, args)
23
+ const parenActor = parentInterpreter.getActor<HTMLActor>(parentDescriptor)
24
24
  parenActor.add(actor)
25
25
  }
26
26
 
27
- unmount(descriptor: Descriptor, args: UpdateArgs, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
28
- const actor = this.getActor<EchartActor>(descriptor, args)
27
+ unmount(descriptor: Descriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
28
+ const actor = this.getActor<EchartActor>(descriptor)
29
29
  actor.clearStyleClass(actor.DOM)
30
30
  actor.cleanInteraction()
31
31
 
32
- const parenActor = parentInterpreter.getActor<HTMLActor>(parentDescriptor, args)
32
+ const parenActor = parentInterpreter.getActor<HTMLActor>(parentDescriptor)
33
33
  parenActor.remove(actor)
34
34
 
35
- super.unmount(descriptor, args, parentInterpreter, parentDescriptor)
35
+ super.unmount(descriptor, parentInterpreter, parentDescriptor)
36
36
  }
37
37
 
38
- pickup(descriptor: Descriptor, args: UpdateArgs, result: PickupObject[]) {
38
+ pickup(descriptor: Descriptor, result: PickupObject[]) {
39
39
  result.push({ uuid: descriptor.uuid, generatedBy: descriptor.generatedBy })
40
40
  }
41
41
  }
@@ -1,12 +1,11 @@
1
- import { UpdateArgs } from "@vyr/engine";
2
1
  import { LineServiceEchartDescriptor } from "../descriptor";
3
2
  import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
4
3
 
5
4
  class LineServiceEchartInterpreter extends ServiceEchartInterpreter {
6
5
  static type = LineServiceEchartDescriptor.type
7
6
 
8
- getService(descriptor: LineServiceEchartDescriptor, args: UpdateArgs) {
9
- const service = super.getService(descriptor, args)
7
+ getService(descriptor: LineServiceEchartDescriptor) {
8
+ const service = super.getService(descriptor)
10
9
 
11
10
  return {
12
11
  ...service,
@@ -1,12 +1,11 @@
1
- import { UpdateArgs } from "@vyr/engine";
2
1
  import { PieServiceEchartDescriptor } from "../descriptor";
3
2
  import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
4
3
 
5
4
  class PieServiceEchartInterpreter extends ServiceEchartInterpreter {
6
5
  static type = PieServiceEchartDescriptor.type
7
6
 
8
- getService(descriptor: PieServiceEchartDescriptor, args: UpdateArgs) {
9
- const service = super.getService(descriptor, args)
7
+ getService(descriptor: PieServiceEchartDescriptor) {
8
+ const service = super.getService(descriptor)
10
9
 
11
10
  return {
12
11
  ...service,
@@ -1,5 +1,5 @@
1
1
  import * as echarts from 'echarts'
2
- import { Descriptor, StyleColor, Interpreter, Queue, UpdateArgs } from "@vyr/engine";
2
+ import { Descriptor, StyleColor, Interpreter, Queue } from "@vyr/engine";
3
3
  import { EchartDescriptor, ServiceEchartDescriptor } from "../descriptor";
4
4
  import { EchartActor } from '../actor';
5
5
 
@@ -52,36 +52,36 @@ class ServiceEchartInterpreter extends Interpreter {
52
52
  }
53
53
  }
54
54
 
55
- getService(descriptor: ServiceEchartDescriptor, args: UpdateArgs) {
55
+ getService(descriptor: ServiceEchartDescriptor) {
56
56
  return { type: descriptor.echart, name: descriptor.name }
57
57
  }
58
58
 
59
- update(descriptor: ServiceEchartDescriptor, args: UpdateArgs) {
60
- super.update(descriptor, args)
59
+ update(descriptor: ServiceEchartDescriptor) {
60
+ super.update(descriptor)
61
61
  const unit = this.graphics.getUnit(descriptor.uuid)
62
62
  const parentDescriptor = Descriptor.get(unit.parent)
63
63
  if (parentDescriptor instanceof EchartDescriptor) {
64
- const actor = this.graphics.getActor<EchartActor>(parentDescriptor, args)
64
+ const actor = this.graphics.getActor<EchartActor>(parentDescriptor)
65
65
  if (actor === null) return
66
- actor.setOptions(parentDescriptor, args)
66
+ actor.setOptions(parentDescriptor)
67
67
  actor.instance.setOption(actor.options)
68
68
  }
69
69
  }
70
70
 
71
- mount(descriptor: EchartDescriptor, args: UpdateArgs, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
72
- super.mount(descriptor, args, parentInterpreter, parentDescriptor)
71
+ mount(descriptor: EchartDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
72
+ super.mount(descriptor, parentInterpreter, parentDescriptor)
73
73
  if (parentDescriptor instanceof EchartDescriptor) {
74
74
  const unit = this.graphics.getUnit(parentDescriptor.uuid)
75
75
  if (unit) unit.trigger(Queue.Update)
76
76
  }
77
77
  }
78
78
 
79
- unmount(descriptor: Descriptor, args: UpdateArgs, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
79
+ unmount(descriptor: Descriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
80
80
  if (parentDescriptor instanceof EchartDescriptor) {
81
81
  const unit = this.graphics.getUnit(parentDescriptor.uuid)
82
82
  if (unit) unit.trigger(Queue.Update)
83
83
  }
84
- super.unmount(descriptor, args, parentInterpreter, parentDescriptor)
84
+ super.unmount(descriptor, parentInterpreter, parentDescriptor)
85
85
  }
86
86
  }
87
87