@vyr/echarts 0.0.32 → 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.
Files changed (65) hide show
  1. package/build/actor/EchartActor.d.ts +5 -58
  2. package/build/actor/EchartActor.js +16 -125
  3. package/build/actor/EchartActor.js.map +1 -1
  4. package/build/descriptor/Echart.d.ts +18 -0
  5. package/build/descriptor/Echart.js +22 -0
  6. package/build/descriptor/Echart.js.map +1 -0
  7. package/build/descriptor/index.d.ts +1 -5
  8. package/build/descriptor/index.js +1 -5
  9. package/build/descriptor/index.js.map +1 -1
  10. package/build/interpreter/EchartInterpreter.d.ts +5 -6
  11. package/build/interpreter/EchartInterpreter.js +4 -6
  12. package/build/interpreter/EchartInterpreter.js.map +1 -1
  13. package/build/interpreter/index.d.ts +0 -4
  14. package/build/interpreter/index.js +0 -4
  15. package/build/interpreter/index.js.map +1 -1
  16. package/build/locale/Language.d.ts +1 -2
  17. package/build/locale/Language.js +1 -2
  18. package/build/locale/Language.js.map +1 -1
  19. package/build/locale/LanguageProvider.d.ts +2 -3
  20. package/build/locale/LanguageProvider.js +1 -2
  21. package/build/locale/LanguageProvider.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/actor/EchartActor.ts +45 -171
  24. package/src/descriptor/Echart.ts +31 -0
  25. package/src/descriptor/index.ts +1 -5
  26. package/src/interpreter/EchartInterpreter.ts +8 -13
  27. package/src/interpreter/index.ts +1 -5
  28. package/src/locale/Language.ts +1 -5
  29. package/src/locale/LanguageProvider.ts +2 -7
  30. package/build/descriptor/BarServiceEchartDescriptor.d.ts +0 -13
  31. package/build/descriptor/BarServiceEchartDescriptor.js +0 -23
  32. package/build/descriptor/BarServiceEchartDescriptor.js.map +0 -1
  33. package/build/descriptor/EchartDescriptor.d.ts +0 -60
  34. package/build/descriptor/EchartDescriptor.js +0 -56
  35. package/build/descriptor/EchartDescriptor.js.map +0 -1
  36. package/build/descriptor/LineServiceEchartDescriptor.d.ts +0 -15
  37. package/build/descriptor/LineServiceEchartDescriptor.js +0 -20
  38. package/build/descriptor/LineServiceEchartDescriptor.js.map +0 -1
  39. package/build/descriptor/PieServiceEchartDescriptor.d.ts +0 -25
  40. package/build/descriptor/PieServiceEchartDescriptor.js +0 -31
  41. package/build/descriptor/PieServiceEchartDescriptor.js.map +0 -1
  42. package/build/descriptor/ServiceEchartDescriptor.d.ts +0 -16
  43. package/build/descriptor/ServiceEchartDescriptor.js +0 -23
  44. package/build/descriptor/ServiceEchartDescriptor.js.map +0 -1
  45. package/build/interpreter/BarServiceEchartInterpreter.d.ts +0 -62
  46. package/build/interpreter/BarServiceEchartInterpreter.js +0 -28
  47. package/build/interpreter/BarServiceEchartInterpreter.js.map +0 -1
  48. package/build/interpreter/LineServiceEchartInterpreter.d.ts +0 -59
  49. package/build/interpreter/LineServiceEchartInterpreter.js +0 -25
  50. package/build/interpreter/LineServiceEchartInterpreter.js.map +0 -1
  51. package/build/interpreter/PieServiceEchartInterpreter.d.ts +0 -66
  52. package/build/interpreter/PieServiceEchartInterpreter.js +0 -32
  53. package/build/interpreter/PieServiceEchartInterpreter.js.map +0 -1
  54. package/build/interpreter/ServiceEchartInterpreter.d.ts +0 -39
  55. package/build/interpreter/ServiceEchartInterpreter.js +0 -79
  56. package/build/interpreter/ServiceEchartInterpreter.js.map +0 -1
  57. package/src/descriptor/BarServiceEchartDescriptor.ts +0 -31
  58. package/src/descriptor/EchartDescriptor.ts +0 -106
  59. package/src/descriptor/LineServiceEchartDescriptor.ts +0 -30
  60. package/src/descriptor/PieServiceEchartDescriptor.ts +0 -47
  61. package/src/descriptor/ServiceEchartDescriptor.ts +0 -39
  62. package/src/interpreter/BarServiceEchartInterpreter.ts +0 -33
  63. package/src/interpreter/LineServiceEchartInterpreter.ts +0 -30
  64. package/src/interpreter/PieServiceEchartInterpreter.ts +0 -37
  65. package/src/interpreter/ServiceEchartInterpreter.ts +0 -90
@@ -1,172 +1,46 @@
1
- import * as echarts from 'echarts'
2
- import { DatasetDescriptor, HTMLActor } from "@vyr/engine";
3
- import { EchartDescriptor } from "../descriptor";
4
- import { ServiceEchartInterpreter } from '../interpreter';
5
-
6
- interface EchartServiceOption {
7
- [k: string]: any
8
- }
9
- interface AxisOption {
10
- [k: string]: any
11
- }
12
-
13
- class EchartActor extends HTMLActor {
14
- private _wrapper: HTMLElement | null = null
15
- readonly DOM: HTMLElement
16
- readonly instance
17
- options: { [k: string]: any } = {}
18
-
19
- constructor(uuid: string) {
20
- super(uuid)
21
- this.DOM = this.createDOM()
22
- const wrapper = this.getWrapper()
23
- wrapper.appendChild(this.DOM)
24
- this.instance = echarts.init(this.DOM)
25
- }
26
-
27
- protected createWrapper() {
28
- const wrapper = document.createElement('div')
29
- wrapper.setAttribute('class', HTMLActor.className)
30
- wrapper.setAttribute(HTMLActor.uuidKey, this.uuid)
31
- return wrapper
32
- }
33
-
34
- getWrapper() {
35
- if (this._wrapper === null) {
36
- this._wrapper = this.createWrapper()
37
- }
38
-
39
- return this._wrapper
40
- }
41
-
42
- add() { }
43
-
44
- remove() { }
45
-
46
- getXAxis(descriptor: EchartDescriptor) {
47
- const xAxis: AxisOption = {
48
- show: descriptor.xAxisShow,
49
- axisLine: descriptor.xAxisLine,
50
- axisTick: descriptor.xAxisTick,
51
- axisLabel: descriptor.xAxisLabel,
52
- splitLine: descriptor.xAxisSplitLine,
53
- }
54
- if (descriptor.xAxisType) xAxis.type = descriptor.xAxisType
55
- return xAxis
56
- }
57
- getYAxis(descriptor: EchartDescriptor) {
58
- const yAxis: AxisOption = {
59
- show: descriptor.yAxisShow,
60
- axisLine: descriptor.yAxisLine,
61
- axisTick: descriptor.yAxisTick,
62
- axisLabel: descriptor.yAxisLabel,
63
- splitLine: descriptor.yAxisSplitLine,
64
- }
65
- if (descriptor.yAxisType) yAxis.type = descriptor.yAxisType
66
- return yAxis
67
- }
68
- getGrid(descriptor: EchartDescriptor) {
69
- const grid = {
70
- show: descriptor.gridShow,
71
- ...descriptor.gridRect,
72
- }
73
-
74
- return grid
75
- }
76
- getLegend(descriptor: EchartDescriptor) {
77
- const legend = {
78
- show: descriptor.legendShow,
79
- type: descriptor.legendType || undefined,
80
- left: descriptor.legendRect.left,
81
- top: descriptor.legendRect.top,
82
- textStyle: {
83
- color: descriptor.legendTextStyle.color,
84
- }
85
- }
86
- return legend
87
- }
88
- getTooltip(descriptor: EchartDescriptor) {
89
- const tooltip = {
90
- show: descriptor.tooltipShow,
91
- trigger: descriptor.tooltipTrigger,
92
- }
93
-
94
- return tooltip
95
- }
96
-
97
- getDataZoom(descriptor: EchartDescriptor) {
98
- const dataZoom = [
99
- {
100
- // 设置滚动条的隐藏或显示
101
- show: false,
102
- // 设置类型
103
- type: "slider",
104
- // 数据窗口范围的起始数值
105
- startValue: 0,
106
- // 数据窗口范围的结束数值(一页显示多少条数据)
107
- endValue: descriptor.scroll.end - 1,
108
- // 控制哪个轴,如果是number表示控制一个轴,
109
- // 如果是Array表示控制多个轴。此处控制第二根轴
110
- yAxisIndex: [0, 1],
111
- // empty:当前数据窗口外的数据,被设置为空。
112
- // 即不会影响其他轴的数据范围
113
- filterMode: "empty",
114
- },
115
- {
116
- // 没有下面这块的话,只能拖动滚动条,
117
- // 鼠标滚轮在区域内不能控制外部滚动条
118
- type: "inside",
119
- // 控制哪个轴,如果是number表示控制一个轴,
120
- // 如果是Array表示控制多个轴。此处控制第二根轴
121
- yAxisIndex: [0, 1],
122
- // 滚轮是否触发缩放
123
- zoomOnMouseWheel: false,
124
- // 鼠标移动能否触发平移
125
- moveOnMouseMove: true,
126
- // 鼠标滚轮能否触发平移
127
- moveOnMouseWheel: true,
128
- },
129
- ]
130
-
131
- return dataZoom
132
- }
133
-
134
- setOptions(descriptor: EchartDescriptor) {
135
- const dimensions: string[] = [descriptor.xAxisModelValue]
136
- const children: EchartServiceOption[] = []
137
- const graphics = HTMLActor.getGraphics(this)
138
- for (const serie of descriptor.children) {
139
- dimensions.push(serie.modelValue)
140
- const interpreter = graphics.getInterpreter<ServiceEchartInterpreter>(serie)
141
- children.push(interpreter.getService(serie))
142
- }
143
-
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
- const dataset = { dimensions, source: DatasetDescriptor.getCollection(descriptor.dataset) }
151
-
152
- this.options = { xAxis, yAxis, grid, legend, tooltip, dataset, dataZoom, series: children }
153
- }
154
-
155
- update(descriptor: EchartDescriptor) {
156
- const wrapper = this.getWrapper()
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
- this.instance.clear()
163
- this.instance.setOption(this.options)
164
- const rect = wrapper.getBoundingClientRect()
165
- this.instance.resize({ width: rect.width, height: rect.height, })
166
- }
167
- }
168
-
169
- export {
170
- EchartServiceOption,
171
- EchartActor,
1
+ import * as echarts from 'echarts'
2
+ import { createHTMLDOM, HTMLActor } from "@vyr/engine";
3
+ import { Echart } from "../descriptor";
4
+
5
+ export class EchartActor extends HTMLActor {
6
+ private _wrapper: HTMLElement | null = null
7
+ readonly instance
8
+ options: { [k: string]: any } = {}
9
+
10
+ constructor(uuid: string) {
11
+ super(uuid)
12
+ const DOM = this.getDOM()
13
+ this.instance = echarts.init(DOM)
14
+ }
15
+
16
+ protected createWrapper() {
17
+ const DOM = createHTMLDOM(this.uuid)
18
+ return DOM
19
+ }
20
+
21
+ getDOM() {
22
+ if (this._wrapper === null) {
23
+ this._wrapper = this.createWrapper()
24
+ }
25
+
26
+ return this._wrapper
27
+ }
28
+
29
+ resize = () => {
30
+ const rect = this.getDOM().getBoundingClientRect()
31
+ this.instance.resize({ width: rect.width, height: rect.height, })
32
+ }
33
+
34
+ add() { }
35
+
36
+ remove() { }
37
+
38
+ update(descriptor: Echart) {
39
+ this.instance.clear()
40
+ const DOM = this.getDOM()
41
+ this.setHtmlAttributes(DOM, descriptor)
42
+ this.setHTMLInteraction(DOM, descriptor)
43
+ this.instance.setOption(descriptor.options)
44
+ requestAnimationFrame(this.resize)
45
+ }
172
46
  }
@@ -0,0 +1,31 @@
1
+ import { Descriptor, DeserializationObject, HTML, HtmlAttributes, HtmlAttributesSchema } from '@vyr/engine'
2
+
3
+ export interface EchartOptions {
4
+ [k: string]: any
5
+ }
6
+
7
+ export class Echart extends Descriptor implements HTML {
8
+ static type = 'Echart'
9
+
10
+ readonly isHTML = true
11
+
12
+ visible: boolean
13
+
14
+ htmlAttributes: HtmlAttributes
15
+
16
+ /**
17
+ * ECharts图表配置对象
18
+ * 包含图表类型、数据、样式、交互等完整的ECharts配置选项
19
+ * 类型:EchartOptions (ECharts官方配置类型)
20
+ * 用途:用于初始化、更新或控制ECharts图表实例的显示和行为
21
+ */
22
+ options: EchartOptions
23
+
24
+ constructor(descriptor: Partial<DeserializationObject<Echart>> = {}) {
25
+ super(descriptor)
26
+ this.visible = descriptor.visible ?? true
27
+ this.htmlAttributes = HtmlAttributesSchema.parse(descriptor.htmlAttributes)
28
+ this.options = descriptor.options ? Descriptor.deepClone(descriptor.options) : {}
29
+ }
30
+ }
31
+ Descriptor.register(Echart)
@@ -1,5 +1 @@
1
- export * from './EchartDescriptor'
2
- export * from './ServiceEchartDescriptor'
3
- export * from './BarServiceEchartDescriptor'
4
- export * from './LineServiceEchartDescriptor'
5
- export * from './PieServiceEchartDescriptor'
1
+ export * from './Echart'
@@ -1,22 +1,22 @@
1
1
  import { Descriptor, HTMLActor, Interpreter, PickupObject } from "@vyr/engine";
2
- import { EchartDescriptor } from "../descriptor";
2
+ import { Echart } from "../descriptor";
3
3
  import { EchartActor } from "../actor";
4
4
 
5
- class EchartInterpreter extends Interpreter {
6
- static type = EchartDescriptor.type
5
+ export class EchartInterpreter extends Interpreter {
6
+ static type = Echart.type
7
7
 
8
- protected createActor(descriptor: EchartDescriptor) {
8
+ protected createActor(descriptor: Echart) {
9
9
  return new EchartActor(descriptor.uuid)
10
10
  }
11
11
 
12
- update(descriptor: EchartDescriptor) {
12
+ update(descriptor: Echart) {
13
13
  super.update(descriptor)
14
14
 
15
15
  const actor = this.getActor<EchartActor>(descriptor)
16
16
  actor.update(descriptor)
17
17
  }
18
18
 
19
- mount(descriptor: EchartDescriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
19
+ mount(descriptor: Echart, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
20
20
  super.mount(descriptor, parentInterpreter, parentDescriptor)
21
21
  const actor = this.getActor<EchartActor>(descriptor)
22
22
 
@@ -26,7 +26,6 @@ class EchartInterpreter extends Interpreter {
26
26
 
27
27
  unmount(descriptor: Descriptor, parentInterpreter: Interpreter, parentDescriptor: Descriptor) {
28
28
  const actor = this.getActor<EchartActor>(descriptor)
29
- actor.clearStyleClass(actor.DOM)
30
29
  actor.cleanInteraction()
31
30
 
32
31
  const parenActor = parentInterpreter.getActor<HTMLActor>(parentDescriptor)
@@ -36,11 +35,7 @@ class EchartInterpreter extends Interpreter {
36
35
  }
37
36
 
38
37
  pickup(descriptor: Descriptor, result: PickupObject[]) {
39
- result.push({ uuid: descriptor.uuid, generatedBy: descriptor.generatedBy })
38
+ result.push({ uuid: descriptor.uuid })
40
39
  }
41
40
  }
42
- Interpreter.register(EchartInterpreter)
43
-
44
- export {
45
- EchartInterpreter
46
- }
41
+ Interpreter.register(EchartInterpreter)
@@ -1,5 +1 @@
1
- export * from './EchartInterpreter'
2
- export * from './ServiceEchartInterpreter'
3
- export * from './BarServiceEchartInterpreter'
4
- export * from './LineServiceEchartInterpreter'
5
- export * from './PieServiceEchartInterpreter'
1
+ export * from './EchartInterpreter'
@@ -3,8 +3,4 @@ import { zhCnLanguageProvider, ZhCNLanguageProvider } from "./LanguageProvider";
3
3
 
4
4
  Locale.register(zhCnLanguageProvider)
5
5
 
6
- const language = Locale.getLanguage<ZhCNLanguageProvider>(zhCnLanguageProvider.name)
7
-
8
- export {
9
- language
10
- }
6
+ export const language = Locale.getLanguage<ZhCNLanguageProvider>(zhCnLanguageProvider.name)
@@ -1,15 +1,10 @@
1
1
  import { LanguageProvider } from '@vyr/locale'
2
2
 
3
- interface ZhCNLanguageProvider extends LanguageProvider {
3
+ export interface ZhCNLanguageProvider extends LanguageProvider {
4
4
 
5
5
  }
6
6
 
7
- const zhCnLanguageProvider: ZhCNLanguageProvider = {
7
+ export const zhCnLanguageProvider: ZhCNLanguageProvider = {
8
8
  id: 'zh_CN',
9
9
  name: '@vyr/echarts',
10
- }
11
-
12
- export {
13
- ZhCNLanguageProvider,
14
- zhCnLanguageProvider,
15
10
  }
@@ -1,13 +0,0 @@
1
- import { DeserializationObject } from '@vyr/engine';
2
- import { EchartItemStyle, ServiceEchartDescriptor } from './ServiceEchartDescriptor';
3
- declare class BarServiceEchartDescriptor extends ServiceEchartDescriptor {
4
- static type: string;
5
- barWidth: string;
6
- barMaxWidth: string;
7
- labelShow: boolean;
8
- labelColor: string;
9
- labelPosition: string;
10
- itemStyle: EchartItemStyle;
11
- constructor(descriptor?: Partial<DeserializationObject<BarServiceEchartDescriptor>>);
12
- }
13
- export { BarServiceEchartDescriptor };
@@ -1,23 +0,0 @@
1
- import { ServiceEchartDescriptor } from './ServiceEchartDescriptor';
2
- class BarServiceEchartDescriptor extends ServiceEchartDescriptor {
3
- static type = 'BarServiceEchart';
4
- barWidth;
5
- barMaxWidth;
6
- labelShow;
7
- labelColor;
8
- labelPosition;
9
- itemStyle;
10
- constructor(descriptor = {}) {
11
- super(descriptor);
12
- this.echart = descriptor.echart ?? 'bar';
13
- this.barWidth = descriptor.barWidth ?? '';
14
- this.barMaxWidth = descriptor.barMaxWidth ?? '';
15
- this.labelShow = descriptor.labelShow ?? false;
16
- this.labelColor = descriptor.labelColor ?? '';
17
- this.labelPosition = descriptor.labelPosition ?? 'inside';
18
- this.itemStyle = descriptor.itemStyle ? ServiceEchartDescriptor.deepClone(descriptor.itemStyle) : ServiceEchartDescriptor.getDefaultItemStyle();
19
- }
20
- }
21
- ServiceEchartDescriptor.register(BarServiceEchartDescriptor);
22
- export { BarServiceEchartDescriptor };
23
- //# sourceMappingURL=BarServiceEchartDescriptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BarServiceEchartDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/BarServiceEchartDescriptor.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEpF,MAAM,0BAA2B,SAAQ,uBAAuB;IAC5D,MAAM,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAEhC,QAAQ,CAAQ;IAChB,WAAW,CAAQ;IACnB,SAAS,CAAS;IAClB,UAAU,CAAQ;IAClB,aAAa,CAAQ;IAErB,SAAS,CAAiB;IAE1B,YAAY,aAAyE,EAAE;QACnF,KAAK,CAAC,UAAU,CAAC,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,KAAK,CAAA;QACxC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAA;QACzC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,EAAE,CAAA;QAC/C,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,KAAK,CAAA;QAC9C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAA;QAC7C,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,aAAa,IAAI,QAAQ,CAAA;QAEzD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,mBAAmB,EAAE,CAAA;IACnJ,CAAC;;AAEL,uBAAuB,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAA;AAE5D,OAAO,EACH,0BAA0B,EAC7B,CAAA"}
@@ -1,60 +0,0 @@
1
- import { DeserializationObject, HTMLDescriptor } from '@vyr/engine';
2
- import { ServiceEchartDescriptor } from './ServiceEchartDescriptor';
3
- interface EchartRect {
4
- left: string;
5
- top: string;
6
- width: string;
7
- height: string;
8
- }
9
- interface EchartGridRect extends EchartRect {
10
- right: string;
11
- bottom: string;
12
- }
13
- interface EchartAxisLine {
14
- show: boolean;
15
- }
16
- interface EchartAxisTick {
17
- show: boolean;
18
- }
19
- interface EchartAxisLabel {
20
- show: boolean;
21
- color: string;
22
- fontSize: number;
23
- }
24
- interface EchartSplitLine {
25
- show: boolean;
26
- }
27
- interface EchartTextStyle {
28
- color: string;
29
- }
30
- interface EchartScroll {
31
- end: number;
32
- }
33
- declare class EchartDescriptor extends HTMLDescriptor {
34
- static type: string;
35
- children: ServiceEchartDescriptor[];
36
- xAxisShow: boolean;
37
- xAxisType: string;
38
- xAxisModelValue: string;
39
- xAxisLine: EchartAxisLine;
40
- xAxisTick: EchartAxisTick;
41
- xAxisLabel: EchartAxisLabel;
42
- xAxisSplitLine: EchartSplitLine;
43
- yAxisShow: boolean;
44
- yAxisType: string;
45
- yAxisLine: EchartAxisLine;
46
- yAxisTick: EchartAxisTick;
47
- yAxisLabel: EchartAxisLabel;
48
- yAxisSplitLine: EchartSplitLine;
49
- gridShow: boolean;
50
- gridRect: EchartGridRect;
51
- legendType: string;
52
- legendShow: boolean;
53
- legendRect: EchartRect;
54
- legendTextStyle: EchartTextStyle;
55
- tooltipShow: boolean;
56
- tooltipTrigger: string;
57
- scroll: EchartScroll;
58
- constructor(descriptor?: Partial<DeserializationObject<EchartDescriptor>>);
59
- }
60
- export { EchartDescriptor };
@@ -1,56 +0,0 @@
1
- import { HTMLDescriptor } from '@vyr/engine';
2
- class EchartDescriptor extends HTMLDescriptor {
3
- static type = 'Echart';
4
- xAxisShow;
5
- xAxisType;
6
- xAxisModelValue;
7
- xAxisLine;
8
- xAxisTick;
9
- xAxisLabel;
10
- xAxisSplitLine;
11
- yAxisShow;
12
- yAxisType;
13
- yAxisLine;
14
- yAxisTick;
15
- yAxisLabel;
16
- yAxisSplitLine;
17
- gridShow;
18
- gridRect;
19
- legendType;
20
- legendShow;
21
- legendRect;
22
- legendTextStyle;
23
- tooltipShow;
24
- tooltipTrigger;
25
- scroll;
26
- constructor(descriptor = {}) {
27
- super(descriptor);
28
- this.width = descriptor.width ?? 400;
29
- this.height = descriptor.height ?? 400;
30
- this.xAxisShow = descriptor.xAxisShow ?? true;
31
- this.xAxisType = descriptor.xAxisType ?? 'category';
32
- this.xAxisModelValue = descriptor.xAxisModelValue ?? '';
33
- this.xAxisLine = descriptor.xAxisLine ? HTMLDescriptor.deepClone(descriptor.xAxisLine) : { show: true };
34
- this.xAxisTick = descriptor.xAxisTick ? HTMLDescriptor.deepClone(descriptor.xAxisTick) : { show: true };
35
- this.xAxisLabel = descriptor.xAxisLabel ? HTMLDescriptor.deepClone(descriptor.xAxisLabel) : { show: true, color: '', fontSize: 12 };
36
- this.xAxisSplitLine = descriptor.xAxisSplitLine ? HTMLDescriptor.deepClone(descriptor.xAxisSplitLine) : { show: false };
37
- this.yAxisType = descriptor.yAxisType ?? '';
38
- this.yAxisShow = descriptor.yAxisShow ?? true;
39
- this.yAxisLine = descriptor.yAxisLine ? HTMLDescriptor.deepClone(descriptor.yAxisLine) : { show: true };
40
- this.yAxisTick = descriptor.yAxisTick ? HTMLDescriptor.deepClone(descriptor.yAxisTick) : { show: true, };
41
- this.yAxisLabel = descriptor.yAxisLabel ? HTMLDescriptor.deepClone(descriptor.yAxisLabel) : { show: true, color: '', fontSize: 12 };
42
- this.yAxisSplitLine = descriptor.yAxisSplitLine ? HTMLDescriptor.deepClone(descriptor.yAxisSplitLine) : { show: false };
43
- this.gridShow = descriptor.gridShow ?? false;
44
- this.gridRect = descriptor.gridRect ? HTMLDescriptor.deepClone(descriptor.gridRect) : { top: '60', left: '10%', right: '10%', bottom: '60', width: 'auto', height: 'auto', };
45
- this.legendType = descriptor.legendType ?? 'plain';
46
- this.legendShow = descriptor.legendShow ?? true;
47
- this.legendRect = descriptor.legendRect ? HTMLDescriptor.deepClone(descriptor.legendRect) : { top: 'top', left: 'center', width: '', height: '', };
48
- this.legendTextStyle = descriptor.legendTextStyle ? HTMLDescriptor.deepClone(descriptor.legendTextStyle) : { color: '#333' };
49
- this.tooltipShow = descriptor.tooltipShow ?? true;
50
- this.tooltipTrigger = descriptor.tooltipTrigger ?? 'item';
51
- this.scroll = descriptor.scroll ? HTMLDescriptor.deepClone(descriptor.scroll) : { end: -1 };
52
- }
53
- }
54
- HTMLDescriptor.register(EchartDescriptor);
55
- export { EchartDescriptor };
56
- //# sourceMappingURL=EchartDescriptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EchartDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/EchartDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,cAAc,EAAE,MAAM,aAAa,CAAA;AAmCnE,MAAM,gBAAiB,SAAQ,cAAc;IACzC,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAA;IAItB,SAAS,CAAS;IAClB,SAAS,CAAQ;IACjB,eAAe,CAAQ;IACvB,SAAS,CAAgB;IACzB,SAAS,CAAgB;IACzB,UAAU,CAAiB;IAC3B,cAAc,CAAiB;IAE/B,SAAS,CAAS;IAClB,SAAS,CAAQ;IACjB,SAAS,CAAgB;IACzB,SAAS,CAAgB;IACzB,UAAU,CAAiB;IAC3B,cAAc,CAAiB;IAE/B,QAAQ,CAAS;IACjB,QAAQ,CAAgB;IAExB,UAAU,CAAQ;IAClB,UAAU,CAAS;IACnB,UAAU,CAAY;IACtB,eAAe,CAAiB;IAEhC,WAAW,CAAS;IACpB,cAAc,CAAQ;IAEtB,MAAM,CAAc;IAEpB,YAAY,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/C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,CAAA;QAClJ,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA;QAE5H,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,IAAI,CAAA;QACjD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,IAAI,MAAM,CAAA;QAEzD,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAA;IAC/F,CAAC;;AAEL,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;AAEzC,OAAO,EACH,gBAAgB,EACnB,CAAA"}
@@ -1,15 +0,0 @@
1
- import { DeserializationObject, StyleColor } from '@vyr/engine';
2
- import { ServiceEchartDescriptor } from './ServiceEchartDescriptor';
3
- interface EchartLineStyle {
4
- width: number;
5
- type: string;
6
- }
7
- declare class LineServiceEchartDescriptor extends ServiceEchartDescriptor {
8
- static type: string;
9
- smooth: boolean;
10
- lineStyle: EchartLineStyle;
11
- itemStyleColor: StyleColor;
12
- areaStyleColor: StyleColor;
13
- constructor(descriptor?: Partial<DeserializationObject<LineServiceEchartDescriptor>>);
14
- }
15
- export { LineServiceEchartDescriptor };
@@ -1,20 +0,0 @@
1
- import { DefaultStyleColor } from '@vyr/engine';
2
- import { ServiceEchartDescriptor } from './ServiceEchartDescriptor';
3
- class LineServiceEchartDescriptor extends ServiceEchartDescriptor {
4
- static type = 'LineServiceEchart';
5
- smooth;
6
- lineStyle;
7
- itemStyleColor;
8
- areaStyleColor;
9
- constructor(descriptor = {}) {
10
- super(descriptor);
11
- this.echart = descriptor.echart ?? 'line';
12
- this.smooth = descriptor.smooth ?? false;
13
- this.lineStyle = descriptor.lineStyle ? ServiceEchartDescriptor.deepClone(descriptor.lineStyle) : { width: 0, type: 'solid', };
14
- this.itemStyleColor = descriptor.itemStyleColor ? DefaultStyleColor.create(descriptor.itemStyleColor) : new DefaultStyleColor({ value: '#5470c6' });
15
- this.areaStyleColor = descriptor.areaStyleColor ? DefaultStyleColor.create(descriptor.areaStyleColor) : new DefaultStyleColor({ value: '#849ae7' });
16
- }
17
- }
18
- ServiceEchartDescriptor.register(LineServiceEchartDescriptor);
19
- export { LineServiceEchartDescriptor };
20
- //# sourceMappingURL=LineServiceEchartDescriptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LineServiceEchartDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/LineServiceEchartDescriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqC,MAAM,aAAa,CAAA;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAOnE,MAAM,2BAA4B,SAAQ,uBAAuB;IAC7D,MAAM,CAAC,IAAI,GAAG,mBAAmB,CAAA;IAEjC,MAAM,CAAS;IACf,SAAS,CAAiB;IAC1B,cAAc,CAAY;IAC1B,cAAc,CAAY;IAE1B,YAAY,aAA0E,EAAE;QACpF,KAAK,CAAC,UAAU,CAAC,CAAA;QACjB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,MAAM,CAAA;QACzC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,KAAK,CAAA;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,CAAA;QAC9H,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;QACnJ,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;IACvJ,CAAC;;AAEL,uBAAuB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAE7D,OAAO,EACH,2BAA2B,EAC9B,CAAA"}
@@ -1,25 +0,0 @@
1
- import { DeserializationObject } from '@vyr/engine';
2
- import { EchartItemStyle, ServiceEchartDescriptor } from './ServiceEchartDescriptor';
3
- interface EchartCenter {
4
- x: string;
5
- y: string;
6
- }
7
- interface EchartRadius {
8
- x: string;
9
- y: string;
10
- }
11
- declare class PieServiceEchartDescriptor extends ServiceEchartDescriptor {
12
- static type: string;
13
- roseType: string;
14
- width: string;
15
- height: string;
16
- radius: EchartRadius;
17
- center: EchartCenter;
18
- padAngle: number;
19
- labelShow: boolean;
20
- labelColor: string;
21
- labelPosition: string;
22
- itemStyle: EchartItemStyle;
23
- constructor(descriptor?: Partial<DeserializationObject<PieServiceEchartDescriptor>>);
24
- }
25
- export { PieServiceEchartDescriptor };
@@ -1,31 +0,0 @@
1
- import { ServiceEchartDescriptor } from './ServiceEchartDescriptor';
2
- class PieServiceEchartDescriptor extends ServiceEchartDescriptor {
3
- static type = 'PieServiceEchart';
4
- roseType;
5
- width;
6
- height;
7
- radius;
8
- center;
9
- padAngle;
10
- labelShow;
11
- labelColor;
12
- labelPosition;
13
- itemStyle;
14
- constructor(descriptor = {}) {
15
- super(descriptor);
16
- this.echart = descriptor.echart ?? 'pie';
17
- this.roseType = descriptor.roseType ?? 'area';
18
- this.width = descriptor.width ?? 'auto';
19
- this.height = descriptor.height ?? 'auto';
20
- this.radius = descriptor.radius ? ServiceEchartDescriptor.deepClone(descriptor.radius) : { x: '0', y: '75%' };
21
- this.center = descriptor.center ? ServiceEchartDescriptor.deepClone(descriptor.center) : { x: '50%', y: '50%' };
22
- this.padAngle = descriptor.padAngle ?? 4;
23
- this.labelShow = descriptor.labelShow ?? false;
24
- this.labelColor = descriptor.labelColor ?? '';
25
- this.labelPosition = descriptor.labelPosition ?? 'outside';
26
- this.itemStyle = descriptor.itemStyle ? ServiceEchartDescriptor.deepClone(descriptor.itemStyle) : ServiceEchartDescriptor.getDefaultItemStyle();
27
- }
28
- }
29
- ServiceEchartDescriptor.register(PieServiceEchartDescriptor);
30
- export { PieServiceEchartDescriptor };
31
- //# sourceMappingURL=PieServiceEchartDescriptor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PieServiceEchartDescriptor.js","sourceRoot":"","sources":["../../src/descriptor/PieServiceEchartDescriptor.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAYpF,MAAM,0BAA2B,SAAQ,uBAAuB;IAC5D,MAAM,CAAC,IAAI,GAAG,kBAAkB,CAAA;IAEhC,QAAQ,CAAQ;IAChB,KAAK,CAAQ;IACb,MAAM,CAAQ;IACd,MAAM,CAAc;IACpB,MAAM,CAAc;IACpB,QAAQ,CAAQ;IAChB,SAAS,CAAS;IAClB,UAAU,CAAQ;IAClB,aAAa,CAAQ;IACrB,SAAS,CAAiB;IAE1B,YAAY,aAAyE,EAAE;QACnF,KAAK,CAAC,UAAU,CAAC,CAAA;QACjB,I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aultStyleColor, Descriptor, DeserializationObject, StyleColor } from '@vyr/engine';
2
- interface EchartItemStyle {
3
- color: StyleColor;
4
- borderColor: DefaultStyleColor;
5
- borderWidth: number;
6
- borderType: string;
7
- borderRadius: number;
8
- }
9
- declare class ServiceEchartDescriptor extends Descriptor {
10
- static type: string;
11
- static getDefaultItemStyle(): EchartItemStyle;
12
- echart: string;
13
- modelValue: string;
14
- constructor(descriptor?: Partial<DeserializationObject<ServiceEchartDescriptor>>);
15
- }
16
- export { EchartItemStyle, ServiceEchartDescriptor };