@vyr/echarts 0.0.33 → 0.0.34
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/build/actor/EchartActor.d.ts +5 -58
- package/build/actor/EchartActor.js +16 -125
- package/build/actor/EchartActor.js.map +1 -1
- package/build/descriptor/Echart.d.ts +18 -0
- package/build/descriptor/Echart.js +22 -0
- package/build/descriptor/Echart.js.map +1 -0
- package/build/descriptor/index.d.ts +1 -5
- package/build/descriptor/index.js +1 -5
- package/build/descriptor/index.js.map +1 -1
- package/build/interpreter/EchartInterpreter.d.ts +5 -6
- package/build/interpreter/EchartInterpreter.js +4 -6
- package/build/interpreter/EchartInterpreter.js.map +1 -1
- package/build/interpreter/index.d.ts +0 -4
- package/build/interpreter/index.js +0 -4
- package/build/interpreter/index.js.map +1 -1
- package/build/locale/Language.d.ts +1 -2
- package/build/locale/Language.js +1 -2
- package/build/locale/Language.js.map +1 -1
- package/build/locale/LanguageProvider.d.ts +2 -3
- package/build/locale/LanguageProvider.js +1 -2
- package/build/locale/LanguageProvider.js.map +1 -1
- package/package.json +1 -1
- package/src/actor/EchartActor.ts +45 -171
- package/src/descriptor/Echart.ts +31 -0
- package/src/descriptor/index.ts +1 -5
- package/src/interpreter/EchartInterpreter.ts +8 -13
- package/src/interpreter/index.ts +1 -5
- package/src/locale/Language.ts +1 -5
- package/src/locale/LanguageProvider.ts +2 -7
- package/build/descriptor/BarServiceEchartDescriptor.d.ts +0 -13
- package/build/descriptor/BarServiceEchartDescriptor.js +0 -23
- package/build/descriptor/BarServiceEchartDescriptor.js.map +0 -1
- package/build/descriptor/EchartDescriptor.d.ts +0 -60
- package/build/descriptor/EchartDescriptor.js +0 -56
- package/build/descriptor/EchartDescriptor.js.map +0 -1
- package/build/descriptor/LineServiceEchartDescriptor.d.ts +0 -15
- package/build/descriptor/LineServiceEchartDescriptor.js +0 -20
- package/build/descriptor/LineServiceEchartDescriptor.js.map +0 -1
- package/build/descriptor/PieServiceEchartDescriptor.d.ts +0 -25
- package/build/descriptor/PieServiceEchartDescriptor.js +0 -31
- package/build/descriptor/PieServiceEchartDescriptor.js.map +0 -1
- package/build/descriptor/ServiceEchartDescriptor.d.ts +0 -16
- package/build/descriptor/ServiceEchartDescriptor.js +0 -23
- package/build/descriptor/ServiceEchartDescriptor.js.map +0 -1
- package/build/interpreter/BarServiceEchartInterpreter.d.ts +0 -62
- package/build/interpreter/BarServiceEchartInterpreter.js +0 -28
- package/build/interpreter/BarServiceEchartInterpreter.js.map +0 -1
- package/build/interpreter/LineServiceEchartInterpreter.d.ts +0 -59
- package/build/interpreter/LineServiceEchartInterpreter.js +0 -25
- package/build/interpreter/LineServiceEchartInterpreter.js.map +0 -1
- package/build/interpreter/PieServiceEchartInterpreter.d.ts +0 -66
- package/build/interpreter/PieServiceEchartInterpreter.js +0 -32
- package/build/interpreter/PieServiceEchartInterpreter.js.map +0 -1
- package/build/interpreter/ServiceEchartInterpreter.d.ts +0 -39
- package/build/interpreter/ServiceEchartInterpreter.js +0 -79
- package/build/interpreter/ServiceEchartInterpreter.js.map +0 -1
- package/src/descriptor/BarServiceEchartDescriptor.ts +0 -31
- package/src/descriptor/EchartDescriptor.ts +0 -106
- package/src/descriptor/LineServiceEchartDescriptor.ts +0 -30
- package/src/descriptor/PieServiceEchartDescriptor.ts +0 -47
- package/src/descriptor/ServiceEchartDescriptor.ts +0 -39
- package/src/interpreter/BarServiceEchartInterpreter.ts +0 -33
- package/src/interpreter/LineServiceEchartInterpreter.ts +0 -30
- package/src/interpreter/PieServiceEchartInterpreter.ts +0 -37
- package/src/interpreter/ServiceEchartInterpreter.ts +0 -90
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { DefaultStyleColor, Descriptor, DeserializationObject, StyleColor } from '@vyr/engine'
|
|
2
|
-
|
|
3
|
-
interface EchartItemStyle {
|
|
4
|
-
color: StyleColor
|
|
5
|
-
borderColor: DefaultStyleColor
|
|
6
|
-
borderWidth: number
|
|
7
|
-
borderType: string
|
|
8
|
-
borderRadius: number
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
class ServiceEchartDescriptor extends Descriptor {
|
|
12
|
-
static type = 'ServiceEchart'
|
|
13
|
-
|
|
14
|
-
static getDefaultItemStyle() {
|
|
15
|
-
const itemStyle: EchartItemStyle = {
|
|
16
|
-
color: new DefaultStyleColor({ value: '#5470c6' }),
|
|
17
|
-
borderColor: new DefaultStyleColor({ opacity: 0 }),
|
|
18
|
-
borderWidth: 0,
|
|
19
|
-
borderType: 'solid',
|
|
20
|
-
borderRadius: 0
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return itemStyle
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
echart: string
|
|
27
|
-
modelValue: string
|
|
28
|
-
|
|
29
|
-
constructor(descriptor: Partial<DeserializationObject<ServiceEchartDescriptor>> = {}) {
|
|
30
|
-
super(descriptor)
|
|
31
|
-
this.echart = descriptor.echart ?? ''
|
|
32
|
-
this.modelValue = descriptor.modelValue ?? ''
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export {
|
|
37
|
-
EchartItemStyle,
|
|
38
|
-
ServiceEchartDescriptor
|
|
39
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { BarServiceEchartDescriptor } from "../descriptor";
|
|
2
|
-
import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
|
|
3
|
-
|
|
4
|
-
class BarServiceEchartInterpreter extends ServiceEchartInterpreter {
|
|
5
|
-
static type = BarServiceEchartDescriptor.type
|
|
6
|
-
|
|
7
|
-
getService(descriptor: BarServiceEchartDescriptor) {
|
|
8
|
-
const service = super.getService(descriptor)
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
...service,
|
|
12
|
-
barWidth: descriptor.barWidth,
|
|
13
|
-
barMaxWidth: descriptor.barMaxWidth,
|
|
14
|
-
label: {
|
|
15
|
-
show: descriptor.labelShow,
|
|
16
|
-
color: descriptor.labelColor,
|
|
17
|
-
position: descriptor.labelPosition,
|
|
18
|
-
},
|
|
19
|
-
itemStyle: {
|
|
20
|
-
color: this.getStyleColor(descriptor.itemStyle.color),
|
|
21
|
-
borderType: descriptor.itemStyle.borderType,
|
|
22
|
-
borderWidth: descriptor.itemStyle.borderWidth,
|
|
23
|
-
borderColor: this.getStyleColor(descriptor.itemStyle.borderColor),
|
|
24
|
-
borderRadius: descriptor.itemStyle.borderRadius,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
ServiceEchartInterpreter.register(BarServiceEchartInterpreter)
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
BarServiceEchartInterpreter
|
|
33
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { LineServiceEchartDescriptor } from "../descriptor";
|
|
2
|
-
import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
|
|
3
|
-
|
|
4
|
-
class LineServiceEchartInterpreter extends ServiceEchartInterpreter {
|
|
5
|
-
static type = LineServiceEchartDescriptor.type
|
|
6
|
-
|
|
7
|
-
getService(descriptor: LineServiceEchartDescriptor) {
|
|
8
|
-
const service = super.getService(descriptor)
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
...service,
|
|
12
|
-
smooth: descriptor.smooth,
|
|
13
|
-
lineStyle: {
|
|
14
|
-
type: descriptor.lineStyle.type,
|
|
15
|
-
width: descriptor.lineStyle.width,
|
|
16
|
-
},
|
|
17
|
-
itemStyle: {
|
|
18
|
-
color: this.getStyleColor(descriptor.itemStyleColor),
|
|
19
|
-
},
|
|
20
|
-
areaStyle: {
|
|
21
|
-
color: this.getStyleColor(descriptor.areaStyleColor),
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
ServiceEchartInterpreter.register(LineServiceEchartInterpreter)
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
LineServiceEchartInterpreter
|
|
30
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { PieServiceEchartDescriptor } from "../descriptor";
|
|
2
|
-
import { ServiceEchartInterpreter } from "./ServiceEchartInterpreter";
|
|
3
|
-
|
|
4
|
-
class PieServiceEchartInterpreter extends ServiceEchartInterpreter {
|
|
5
|
-
static type = PieServiceEchartDescriptor.type
|
|
6
|
-
|
|
7
|
-
getService(descriptor: PieServiceEchartDescriptor) {
|
|
8
|
-
const service = super.getService(descriptor)
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
...service,
|
|
12
|
-
roseType: descriptor.roseType,
|
|
13
|
-
width: descriptor.width,
|
|
14
|
-
height: descriptor.height,
|
|
15
|
-
radius: [descriptor.radius.x, descriptor.radius.y],
|
|
16
|
-
center: [descriptor.center.x, descriptor.center.y],
|
|
17
|
-
padAngle: descriptor.padAngle,
|
|
18
|
-
label: {
|
|
19
|
-
show: descriptor.labelShow,
|
|
20
|
-
color: descriptor.labelColor,
|
|
21
|
-
position: descriptor.labelPosition,
|
|
22
|
-
},
|
|
23
|
-
itemStyle: {
|
|
24
|
-
color: this.getStyleColor(descriptor.itemStyle.color),
|
|
25
|
-
borderType: descriptor.itemStyle.borderType,
|
|
26
|
-
borderWidth: descriptor.itemStyle.borderWidth,
|
|
27
|
-
borderColor: this.getStyleColor(descriptor.itemStyle.borderColor),
|
|
28
|
-
borderRadius: descriptor.itemStyle.borderRadius,
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
ServiceEchartInterpreter.register(PieServiceEchartInterpreter)
|
|
34
|
-
|
|
35
|
-
export {
|
|
36
|
-
PieServiceEchartInterpreter
|
|
37
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import * as echarts from 'echarts'
|
|
2
|
-
import { Descriptor, StyleColor, Interpreter, Queue } from "@vyr/engine";
|
|
3
|
-
import { EchartDescriptor, ServiceEchartDescriptor } from "../descriptor";
|
|
4
|
-
import { EchartActor } from '../actor';
|
|
5
|
-
|
|
6
|
-
class ServiceEchartInterpreter extends Interpreter {
|
|
7
|
-
static type = ServiceEchartDescriptor.type
|
|
8
|
-
|
|
9
|
-
getLinearXYByAngle(angle: number) {
|
|
10
|
-
const radian = (angle * Math.PI) / 180
|
|
11
|
-
const x = Math.cos(radian)
|
|
12
|
-
const y = Math.sin(radian)
|
|
13
|
-
const x2 = Math.cos(radian + Math.PI)
|
|
14
|
-
const y2 = Math.sin(radian + Math.PI)
|
|
15
|
-
|
|
16
|
-
return { x, y, x2, y2 }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
getStyleColor(color: StyleColor) {
|
|
20
|
-
if (color.type == 'linear') {
|
|
21
|
-
const { x, y, x2, y2 } = this.getLinearXYByAngle(color.angle)
|
|
22
|
-
|
|
23
|
-
const colorStops = []
|
|
24
|
-
for (const item of color.value) {
|
|
25
|
-
colorStops.push({ offset: item.ratio, color: echarts.color.modifyAlpha(item.value, item.opacity) })
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const style = {
|
|
29
|
-
type: color.type,
|
|
30
|
-
x, y, x2, y2,
|
|
31
|
-
colorStops
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return style
|
|
35
|
-
} else if (color.type === 'radial') {
|
|
36
|
-
const colorStops = []
|
|
37
|
-
for (const item of color.value) {
|
|
38
|
-
colorStops.push({ offset: item.ratio, color: echarts.color.modifyAlpha(item.value, item.opacity) })
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const style = {
|
|
42
|
-
type: color.type,
|
|
43
|
-
r: color.radius,
|
|
44
|
-
x: color.center.x,
|
|
45
|
-
y: color.center.y,
|
|
46
|
-
colorStops
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return style
|
|
50
|
-
} else {
|
|
51
|
-
return echarts.color.modifyAlpha(color.value, color.opacity)
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getService(descriptor: ServiceEchartDescriptor) {
|
|
56
|
-
return { type: descriptor.echart, name: descriptor.name }
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
update(descriptor: ServiceEchartDescriptor) {
|
|
60
|
-
super.update(descriptor)
|
|
61
|
-
const unit = this.graphics.getUnit(descriptor.uuid)
|
|
62
|
-
const parentDescriptor = Descriptor.get(unit.parent)
|
|
63
|
-
if (parentDescriptor instanceof EchartDescriptor) {
|
|
64
|
-
const actor = this.graphics.getActor<EchartActor>(parentDescriptor)
|
|
65
|
-
if (actor === null) return
|
|
66
|
-
actor.setOptions(parentDescriptor)
|
|
67
|
-
actor.instance.setOption(actor.options)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
mount(descriptor: EchartDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
72
|
-
super.mount(descriptor, parentInterpreter, parentDescriptor)
|
|
73
|
-
if (parentDescriptor instanceof EchartDescriptor) {
|
|
74
|
-
const unit = this.graphics.getUnit(parentDescriptor.uuid)
|
|
75
|
-
if (unit) unit.trigger(Queue.Update)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
unmount(descriptor: Descriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
|
|
80
|
-
if (parentDescriptor instanceof EchartDescriptor) {
|
|
81
|
-
const unit = this.graphics.getUnit(parentDescriptor.uuid)
|
|
82
|
-
if (unit) unit.trigger(Queue.Update)
|
|
83
|
-
}
|
|
84
|
-
super.unmount(descriptor, parentInterpreter, parentDescriptor)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export {
|
|
89
|
-
ServiceEchartInterpreter
|
|
90
|
-
}
|