@vyr/echarts-browser 0.0.1

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 ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@vyr/echarts-browser",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "./src/index.ts",
6
+ "author": "",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "vue": "3.5.22",
10
+ "@vyr/locale": "0.0.1",
11
+ "@vyr/runtime": "0.0.1",
12
+ "@vyr/engine": "0.0.1",
13
+ "@vyr/design": "0.0.1",
14
+ "@vyr/builtin": "0.0.1",
15
+ "@vyr/echarts": "0.0.1"
16
+ },
17
+ "files": [
18
+ "package.json",
19
+ "src/"
20
+ ],
21
+ "vyr": {
22
+ "type": "browser",
23
+ "order": 1000
24
+ }
25
+ }
@@ -0,0 +1 @@
1
+ export * from './provider'
@@ -0,0 +1,14 @@
1
+ import { provide, inject, Ref } from "vue";
2
+ import { Descriptor } from "@vyr/engine";
3
+
4
+ const providerKey = Symbol()
5
+
6
+ const providerDescriptor = (descriptor: Ref<Descriptor | null>) => {
7
+ provide(providerKey, descriptor)
8
+ }
9
+
10
+ const useDescriptor = <T extends Descriptor = Descriptor>() => {
11
+ return inject(providerKey) as Ref<T>
12
+ }
13
+
14
+ export { providerDescriptor, useDescriptor }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './locale'
2
+ export * from './common'
3
+ export * from './service'
@@ -0,0 +1,10 @@
1
+ import { Locale } from "@vyr/locale";
2
+ import { zhCnLanguageProvider, ZhCNLanguageProvider } from "./LanguageProvider";
3
+
4
+ Locale.register(zhCnLanguageProvider)
5
+
6
+ const language = Locale.getLanguage<ZhCNLanguageProvider>(zhCnLanguageProvider.name)
7
+
8
+ export {
9
+ language
10
+ }
@@ -0,0 +1,193 @@
1
+ import { LanguageProvider } from '@vyr/locale'
2
+
3
+ interface ZhCNLanguageProvider extends LanguageProvider {
4
+ 'descriptor.type.Echart': string
5
+ 'descriptor.type.BarServiceEchart': string
6
+ 'descriptor.type.LineServiceEchart': string
7
+ 'descriptor.type.PieServiceEchart': string
8
+
9
+ 'option.Echart.type.value.label': string
10
+ 'option.Echart.type.category.label': string
11
+ 'option.Echart.type.time.label': string
12
+
13
+ 'option.Echart.roseType.default.label': string
14
+ 'option.Echart.roseType.area.label': string
15
+ 'option.Echart.roseType.radius.label': string
16
+
17
+ 'option.Echart.border.solid.label': string
18
+ 'option.Echart.border.dashed.label': string
19
+ 'option.Echart.border.dotted.label': string
20
+
21
+ 'option.Echart.trigger.item.label': string
22
+ 'option.Echart.trigger.axis.label': string
23
+ 'option.Echart.trigger.none.label': string
24
+
25
+ 'inspector.Echart.modelValue': string
26
+ 'inspector.Echart.scroll.end': string
27
+
28
+ 'inspector.Echart.border.type': string
29
+ 'inspector.Echart.border.width': string
30
+ 'inspector.Echart.border.radius': string
31
+ 'inspector.Echart.border.color': string
32
+
33
+ 'inspector.Echart.xAxis': string
34
+ 'inspector.Echart.xAxis.show': string
35
+ 'inspector.Echart.xAxis.type': string
36
+ 'inspector.Echart.xAxis.line.show': string
37
+ 'inspector.Echart.xAxis.tick.show': string
38
+ 'inspector.Echart.xAxis.label.show': string
39
+ 'inspector.Echart.xAxis.font': string
40
+ 'inspector.Echart.xAxis.splitLine.show': string
41
+
42
+ 'inspector.Echart.yAxis': string
43
+ 'inspector.Echart.yAxis.show': string
44
+ 'inspector.Echart.yAxis.type': string
45
+ 'inspector.Echart.yAxis.line.show': string
46
+ 'inspector.Echart.yAxis.tick.show': string
47
+ 'inspector.Echart.yAxis.label.show': string
48
+ 'inspector.Echart.yAxis.font': string
49
+ 'inspector.Echart.yAxis.splitLine.show': string
50
+
51
+ 'inspector.Echart.grid': string
52
+ 'inspector.Echart.grid.show': string
53
+ 'inspector.Echart.grid.rect.size': string
54
+ 'inspector.Echart.grid.rect.padding.horizontal': string
55
+ 'inspector.Echart.grid.rect.padding.vertical': string
56
+
57
+ 'inspector.Echart.legend': string
58
+ 'inspector.Echart.legend.show': string
59
+ 'inspector.Echart.legend.rect.size': string
60
+ 'inspector.Echart.legend.position': string
61
+ 'inspector.Echart.legend.font': string
62
+
63
+ 'inspector.Echart.tooltip': string
64
+ 'inspector.Echart.tooltip.show': string
65
+ 'inspector.Echart.tooltip.trigger': string
66
+
67
+ 'inspector.Bar.base.modelValue': string
68
+ 'inspector.Bar.base.barWidth': string
69
+ 'inspector.Bar.base.barMaxWidth': string
70
+ 'inspector.Bar.base.label.show': string
71
+ 'inspector.Bar.base.label.position': string
72
+ 'inspector.Bar.base.label.color': string
73
+ 'inspector.Bar.base.fill': string
74
+
75
+ 'inspector.Line.base.modelValue': string
76
+ 'inspector.Line.base.line.type': string
77
+ 'inspector.Line.base.line.width': string
78
+ 'inspector.Line.base.smooth': string
79
+ 'inspector.Line.base.draw': string
80
+ 'inspector.Line.base.fill.title': string
81
+ 'inspector.Line.base.fill': string
82
+
83
+ 'inspector.Pie.base.modelValue': string
84
+ 'inspector.Pie.base.roseType': string
85
+ 'inspector.Pie.base.width': string
86
+ 'inspector.Pie.base.height': string
87
+ 'inspector.Pie.base.radius': string
88
+ 'inspector.Pie.base.center': string
89
+ 'inspector.Pie.base.label.show': string
90
+ 'inspector.Pie.base.label.padAngle': string
91
+ 'inspector.Pie.base.label.position': string
92
+ 'inspector.Pie.base.label.color': string
93
+
94
+ 'sidebar.action.addEcharts.label': string
95
+ }
96
+
97
+ const zhCnLanguageProvider: ZhCNLanguageProvider = {
98
+ id: 'zh_CN',
99
+ name: '@vyr/echarts-browser',
100
+
101
+ 'descriptor.type.Echart': '图表',
102
+ 'descriptor.type.BarServiceEchart': '柱状图',
103
+ 'descriptor.type.LineServiceEchart': '折线图',
104
+ 'descriptor.type.PieServiceEchart': '饼状图',
105
+
106
+ 'option.Echart.type.value.label': '数值轴',
107
+ 'option.Echart.type.category.label': '类目轴',
108
+ 'option.Echart.type.time.label': '时间轴',
109
+
110
+ 'option.Echart.roseType.default.label': '默认',
111
+ 'option.Echart.roseType.area.label': '南丁格尔图(面积模式)',
112
+ 'option.Echart.roseType.radius.label': '南丁格尔图(半径模式)',
113
+
114
+ 'option.Echart.border.solid.label': '实线',
115
+ 'option.Echart.border.dashed.label': '虚线',
116
+ 'option.Echart.border.dotted.label': '点线',
117
+
118
+ 'option.Echart.trigger.item.label': '鼠标在数据项时触发',
119
+ 'option.Echart.trigger.axis.label': '鼠标在坐标轴时触发',
120
+ 'option.Echart.trigger.none.label': '禁用',
121
+
122
+ 'inspector.Echart.modelValue': '类目数据',
123
+ 'inspector.Echart.scroll.end': '类目数量',
124
+
125
+ 'inspector.Echart.border.type': '边框类型',
126
+ 'inspector.Echart.border.width': '边框宽度',
127
+ 'inspector.Echart.border.radius': '边框圆角',
128
+ 'inspector.Echart.border.color': '边框颜色',
129
+
130
+ 'inspector.Echart.xAxis': 'X轴属性',
131
+ 'inspector.Echart.xAxis.show': '状态',
132
+ 'inspector.Echart.xAxis.type': '类型',
133
+ 'inspector.Echart.xAxis.line.show': '轴线',
134
+ 'inspector.Echart.xAxis.tick.show': '刻度',
135
+ 'inspector.Echart.xAxis.label.show': '标签',
136
+ 'inspector.Echart.xAxis.font': '文本设置',
137
+ 'inspector.Echart.xAxis.splitLine.show': '分隔线',
138
+ 'inspector.Echart.yAxis': 'Y轴属性',
139
+ 'inspector.Echart.yAxis.show': '状态',
140
+ 'inspector.Echart.yAxis.type': '类型',
141
+ 'inspector.Echart.yAxis.line.show': '轴线',
142
+ 'inspector.Echart.yAxis.tick.show': '刻度',
143
+ 'inspector.Echart.yAxis.label.show': '标签',
144
+ 'inspector.Echart.yAxis.font': '文本设置',
145
+ 'inspector.Echart.yAxis.splitLine.show': '分隔线',
146
+ 'inspector.Echart.grid': '网格属性',
147
+ 'inspector.Echart.grid.show': '状态',
148
+ 'inspector.Echart.grid.rect.size': '宽高',
149
+ 'inspector.Echart.grid.rect.padding.horizontal': '左右边距',
150
+ 'inspector.Echart.grid.rect.padding.vertical': '上下边距',
151
+ 'inspector.Echart.legend': '图例属性',
152
+ 'inspector.Echart.legend.show': '状态',
153
+ 'inspector.Echart.legend.rect.size': '宽高',
154
+ 'inspector.Echart.legend.position': '位置',
155
+ 'inspector.Echart.legend.font': '文本设置',
156
+ 'inspector.Echart.tooltip': '提示框属性',
157
+ 'inspector.Echart.tooltip.show': '状态',
158
+ 'inspector.Echart.tooltip.trigger': '触发',
159
+
160
+ 'inspector.Bar.base.modelValue': '数据',
161
+ 'inspector.Bar.base.barWidth': '宽度',
162
+ 'inspector.Bar.base.barMaxWidth': '最大宽度',
163
+ 'inspector.Bar.base.label.show': '标签',
164
+ 'inspector.Bar.base.label.position': '标签位置',
165
+ 'inspector.Bar.base.label.color': '标签颜色',
166
+ 'inspector.Bar.base.fill': '填充',
167
+
168
+ 'inspector.Line.base.modelValue': '数据',
169
+ 'inspector.Line.base.line.type': '类型',
170
+ 'inspector.Line.base.line.width': '宽度',
171
+ 'inspector.Line.base.smooth': '平滑',
172
+ 'inspector.Line.base.draw': '绘制',
173
+ 'inspector.Line.base.fill.title': '填充属性',
174
+ 'inspector.Line.base.fill': '填充',
175
+
176
+ 'inspector.Pie.base.modelValue': '数据',
177
+ 'inspector.Pie.base.roseType': '类型',
178
+ 'inspector.Pie.base.width': '宽度',
179
+ 'inspector.Pie.base.height': '高度',
180
+ 'inspector.Pie.base.radius': '半径',
181
+ 'inspector.Pie.base.center': '中心',
182
+ 'inspector.Pie.base.label.show': '标签',
183
+ 'inspector.Pie.base.label.padAngle': '间隔',
184
+ 'inspector.Pie.base.label.position': '标签位置',
185
+ 'inspector.Pie.base.label.color': '标签颜色',
186
+
187
+ 'sidebar.action.addEcharts.label': '新增图表',
188
+ }
189
+
190
+ export {
191
+ ZhCNLanguageProvider,
192
+ zhCnLanguageProvider,
193
+ }
@@ -0,0 +1,2 @@
1
+ export * from './LanguageProvider'
2
+ export * from './Language'
@@ -0,0 +1,32 @@
1
+ import { language } from '../locale'
2
+
3
+ const typeOptions = [
4
+ { label: language.get('option.Echart.type.value.label'), value: 'value' },
5
+ { label: language.get('option.Echart.type.category.label'), value: 'category' },
6
+ { label: language.get('option.Echart.type.time.label'), value: 'time' },
7
+ ]
8
+
9
+ const roseTypeOptions = [
10
+ { label: language.get('option.Echart.roseType.default.label'), value: '' },
11
+ { label: language.get('option.Echart.roseType.area.label'), value: 'area' },
12
+ { label: language.get('option.Echart.roseType.radius.label'), value: 'radius' },
13
+ ]
14
+
15
+ const borderTypeOptions = [
16
+ { label: language.get('option.Echart.border.solid.label'), value: 'solid' },
17
+ { label: language.get('option.Echart.border.dashed.label'), value: 'dashed' },
18
+ { label: language.get('option.Echart.border.dotted.label'), value: 'dotted' },
19
+ ]
20
+
21
+ const triggerOptions = [
22
+ { label: language.get('option.Echart.trigger.item.label'), value: 'item' },
23
+ { label: language.get('option.Echart.trigger.axis.label'), value: 'axis' },
24
+ { label: language.get('option.Echart.trigger.none.label'), value: 'none' },
25
+ ]
26
+
27
+ export {
28
+ typeOptions,
29
+ roseTypeOptions,
30
+ borderTypeOptions,
31
+ triggerOptions,
32
+ }
@@ -0,0 +1 @@
1
+ export * as Echart from './Echart'
@@ -0,0 +1,20 @@
1
+ import { runtime, ShortcutkeyService, InspectorService } from "@vyr/runtime";
2
+ import inspectorViewer from './inspector'
3
+ import sidebarAction from './sidebar/action'
4
+
5
+ const setup = async () => {
6
+ const inspectorService = runtime.get<InspectorService>('inspector')
7
+ const shortcutkeyService = runtime.get<ShortcutkeyService>('shortcutkey')
8
+
9
+ const sidebar = shortcutkeyService.get('sidebar')
10
+ for (const Action of sidebarAction) {
11
+ const action = new Action()
12
+ sidebar.add(action)
13
+ }
14
+
15
+ for (const viewer of inspectorViewer) {
16
+ inspectorService.set(viewer.type, viewer.import)
17
+ }
18
+ }
19
+
20
+ export { setup }
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <vyr-card v-if="descriptor" :title="language.get('descriptor.type.BarServiceEchart')" :scroll="true">
3
+ <base-fragment :raw="raw"></base-fragment>
4
+ <vyr-row>
5
+ <vyr-label :label="language.get('inspector.Bar.base.modelValue')">
6
+ <vyr-col>
7
+ <vyr-input v-model="descriptor.modelValue" :clearable="true" trigger="blur"></vyr-input>
8
+ </vyr-col>
9
+ </vyr-label>
10
+ </vyr-row>
11
+ <vyr-row>
12
+ <vyr-label :label="language.get('inspector.Bar.base.barWidth')">
13
+ <vyr-col>
14
+ <vyr-input v-model="descriptor.barWidth" :clearable="true" trigger="blur"></vyr-input>
15
+ </vyr-col>
16
+ </vyr-label>
17
+ </vyr-row>
18
+ <vyr-row>
19
+ <vyr-label :label="language.get('inspector.Bar.base.barMaxWidth')">
20
+ <vyr-col>
21
+ <vyr-input v-model="descriptor.barMaxWidth" :clearable="true" trigger="blur"></vyr-input>
22
+ </vyr-col>
23
+ </vyr-label>
24
+ </vyr-row>
25
+ <vyr-row>
26
+ <vyr-label :label="language.get('inspector.Bar.base.label.show')">
27
+ <vyr-col>
28
+ <vyr-select v-model="descriptor.labelShow" :data="option.stateOptions"></vyr-select>
29
+ </vyr-col>
30
+ </vyr-label>
31
+ </vyr-row>
32
+ <vyr-row>
33
+ <vyr-label :label="language.get('inspector.Bar.base.label.position')">
34
+ <vyr-col>
35
+ <vyr-input v-model="descriptor.labelPosition" :clearable="true" trigger="blur"></vyr-input>
36
+ </vyr-col>
37
+ </vyr-label>
38
+ </vyr-row>
39
+ <vyr-row>
40
+ <vyr-label :label="language.get('inspector.Bar.base.label.color')">
41
+ <vyr-col>
42
+ <vyr-color-picker v-model="descriptor.labelColor" width="all"></vyr-color-picker>
43
+ </vyr-col>
44
+ </vyr-label>
45
+ </vyr-row>
46
+ <vyr-row>
47
+ <vyr-label :label="language.get('inspector.Echart.border.type')">
48
+ <vyr-col>
49
+ <vyr-select v-model="descriptor.itemStyle.borderType" :data="Echart.borderTypeOptions"></vyr-select>
50
+ </vyr-col>
51
+ </vyr-label>
52
+ </vyr-row>
53
+ <vyr-row>
54
+ <vyr-label :label="language.get('inspector.Echart.border.width')">
55
+ <vyr-col>
56
+ <vyr-input-number v-model="descriptor.itemStyle.borderWidth"></vyr-input-number>
57
+ </vyr-col>
58
+ </vyr-label>
59
+ </vyr-row>
60
+ <vyr-row>
61
+ <vyr-label :label="language.get('inspector.Echart.border.radius')">
62
+ <vyr-col>
63
+ <vyr-input-number v-model="descriptor.itemStyle.borderRadius"></vyr-input-number>
64
+ </vyr-col>
65
+ </vyr-label>
66
+ </vyr-row>
67
+ <vyr-row>
68
+ <vyr-label :label="language.get('inspector.Echart.border.color')">
69
+ <vyr-col :span="12">
70
+ <vyr-color-picker v-model="descriptor.itemStyle.borderColor.value" width="all"></vyr-color-picker>
71
+ </vyr-col>
72
+ <vyr-col :span="12">
73
+ <vyr-input-number v-model="descriptor.itemStyle.borderColor.opacity" :min="0"
74
+ :max="1"></vyr-input-number>
75
+ </vyr-col>
76
+ </vyr-label>
77
+ </vyr-row>
78
+ <vyr-color-item v-model="descriptor.itemStyle.color"
79
+ :title="language.get('inspector.Bar.base.fill')"></vyr-color-item>
80
+ </vyr-card>
81
+ </template>
82
+
83
+
84
+ <script lang="ts" setup>
85
+ import { ref, Ref, watch } from 'vue';
86
+ import { BarServiceEchartDescriptor } from '@vyr/echarts'
87
+ import { VyrCard, VyrInput, VyrRow, VyrCol, VyrLabel, VyrSelect, VyrColorPicker, VyrInputNumber } from '@vyr/design';
88
+ import { option, VyrColorItem, BaseFragment, providerDescriptor as builtinProviderDescriptor } from '@vyr/builtin'
89
+ import { language } from '../../locale'
90
+ import { providerDescriptor } from '../../common';
91
+ import { Echart } from '../../option'
92
+
93
+ const props = defineProps<{ raw: string, uuid: string }>()
94
+
95
+ const descriptor = ref(null) as Ref<BarServiceEchartDescriptor | null>
96
+ const watchEditItem = (cur: string) => {
97
+ if (!cur) return descriptor.value = null
98
+ descriptor.value = BarServiceEchartDescriptor.get<BarServiceEchartDescriptor>(cur)
99
+ }
100
+ watch(() => props.uuid, watchEditItem, { immediate: true })
101
+ providerDescriptor(descriptor)
102
+ builtinProviderDescriptor(descriptor)
103
+ </script>
104
+
105
+ <style lang="less" scoped></style>
@@ -0,0 +1,238 @@
1
+ <template>
2
+ <template v-if="descriptor">
3
+ <vyr-card v-if="descriptor" :title="language.get('descriptor.type.Echart')" :scroll="true">
4
+ <base-fragment :raw="raw"></base-fragment>
5
+ <HTML-fragment :raw="raw"></HTML-fragment>
6
+ <vyr-row>
7
+ <vyr-divider :text="language.get('inspector.Echart.xAxis')"></vyr-divider>
8
+ </vyr-row>
9
+ <vyr-row>
10
+ <vyr-label :label="language.get('inspector.Echart.xAxis.show')">
11
+ <vyr-col>
12
+ <vyr-select v-model="descriptor.xAxisShow" :data="option.stateOptions"></vyr-select>
13
+ </vyr-col>
14
+ </vyr-label>
15
+ </vyr-row>
16
+ <vyr-row>
17
+ <vyr-label :label="language.get('inspector.Echart.xAxis.type')">
18
+ <vyr-col>
19
+ <vyr-select v-model="descriptor.xAxisType" :clearable="true"
20
+ :data="Echart.typeOptions"></vyr-select>
21
+ </vyr-col>
22
+ </vyr-label>
23
+ </vyr-row>
24
+ <vyr-row>
25
+ <vyr-label :label="language.get('inspector.Echart.xAxis.line.show')">
26
+ <vyr-col>
27
+ <vyr-select v-model="descriptor.xAxisLine.show" :data="option.stateOptions"></vyr-select>
28
+ </vyr-col>
29
+ </vyr-label>
30
+ </vyr-row>
31
+ <vyr-row>
32
+ <vyr-label :label="language.get('inspector.Echart.xAxis.tick.show')">
33
+ <vyr-col>
34
+ <vyr-select v-model="descriptor.xAxisTick.show" :data="option.stateOptions"></vyr-select>
35
+ </vyr-col>
36
+ </vyr-label>
37
+ </vyr-row>
38
+ <vyr-row>
39
+ <vyr-label :label="language.get('inspector.Echart.xAxis.label.show')">
40
+ <vyr-col>
41
+ <vyr-select v-model="descriptor.xAxisLabel.show" :data="option.stateOptions"></vyr-select>
42
+ </vyr-col>
43
+ </vyr-label>
44
+ </vyr-row>
45
+ <vyr-row>
46
+ <vyr-label :label="language.get('inspector.Echart.xAxis.splitLine.show')">
47
+ <vyr-col>
48
+ <vyr-select v-model="descriptor.xAxisSplitLine.show" :data="option.stateOptions"></vyr-select>
49
+ </vyr-col>
50
+ </vyr-label>
51
+ </vyr-row>
52
+ <vyr-row>
53
+ <vyr-label :label="language.get('inspector.Echart.xAxis.font')">
54
+ <vyr-col :span="12">
55
+ <vyr-color-picker width="all" v-model="descriptor.xAxisLabel.color"></vyr-color-picker>
56
+ </vyr-col>
57
+ <vyr-col :span="12">
58
+ <vyr-input-number v-model="descriptor.xAxisLabel.fontSize"></vyr-input-number>
59
+ </vyr-col>
60
+ </vyr-label>
61
+ </vyr-row>
62
+ <vyr-row>
63
+ <vyr-divider :text="language.get('inspector.Echart.yAxis')"></vyr-divider>
64
+ </vyr-row>
65
+ <vyr-row>
66
+ <vyr-label :label="language.get('inspector.Echart.yAxis.show')">
67
+ <vyr-col>
68
+ <vyr-select v-model="descriptor.yAxisShow" :data="option.stateOptions"></vyr-select>
69
+ </vyr-col>
70
+ </vyr-label>
71
+ </vyr-row>
72
+ <vyr-row>
73
+ <vyr-label :label="language.get('inspector.Echart.yAxis.type')">
74
+ <vyr-col>
75
+ <vyr-select v-model="descriptor.yAxisType" :clearable="true"
76
+ :data="Echart.typeOptions"></vyr-select>
77
+ </vyr-col>
78
+ </vyr-label>
79
+ </vyr-row>
80
+ <vyr-row>
81
+ <vyr-label :label="language.get('inspector.Echart.yAxis.line.show')">
82
+ <vyr-col>
83
+ <vyr-select v-model="descriptor.yAxisLine.show" :data="option.stateOptions"></vyr-select>
84
+ </vyr-col>
85
+ </vyr-label>
86
+ </vyr-row>
87
+ <vyr-row>
88
+ <vyr-label :label="language.get('inspector.Echart.yAxis.tick.show')">
89
+ <vyr-col>
90
+ <vyr-select v-model="descriptor.yAxisTick.show" :data="option.stateOptions"></vyr-select>
91
+ </vyr-col>
92
+ </vyr-label>
93
+ </vyr-row>
94
+ <vyr-row>
95
+ <vyr-label :label="language.get('inspector.Echart.yAxis.label.show')">
96
+ <vyr-col>
97
+ <vyr-select v-model="descriptor.yAxisLabel.show" :data="option.stateOptions"></vyr-select>
98
+ </vyr-col>
99
+ </vyr-label>
100
+ </vyr-row>
101
+ <vyr-row>
102
+ <vyr-label :label="language.get('inspector.Echart.yAxis.splitLine.show')">
103
+ <vyr-col>
104
+ <vyr-select v-model="descriptor.yAxisSplitLine.show" :data="option.stateOptions"></vyr-select>
105
+ </vyr-col>
106
+ </vyr-label>
107
+ </vyr-row>
108
+ <vyr-row>
109
+ <vyr-label :label="language.get('inspector.Echart.yAxis.font')">
110
+ <vyr-col :span="12">
111
+ <vyr-color-picker width="all" v-model="descriptor.yAxisLabel.color"></vyr-color-picker>
112
+ </vyr-col>
113
+ <vyr-col :span="12">
114
+ <vyr-input-number v-model="descriptor.yAxisLabel.fontSize"></vyr-input-number>
115
+ </vyr-col>
116
+ </vyr-label>
117
+ </vyr-row>
118
+ <vyr-row>
119
+ <vyr-divider :text="language.get('inspector.Echart.grid')"></vyr-divider>
120
+ </vyr-row>
121
+ <vyr-row>
122
+ <vyr-label :label="language.get('inspector.Echart.grid.show')">
123
+ <vyr-col>
124
+ <vyr-select v-model="descriptor.gridShow" :data="option.stateOptions"></vyr-select>
125
+ </vyr-col>
126
+ </vyr-label>
127
+ </vyr-row>
128
+ <vyr-row>
129
+ <vyr-label :label="language.get('inspector.Echart.grid.rect.size')">
130
+ <vyr-col :span="12">
131
+ <vyr-input v-model="descriptor.gridRect.width" trigger="blur"></vyr-input>
132
+ </vyr-col>
133
+ <vyr-col :span="12">
134
+ <vyr-input v-model="descriptor.gridRect.height" trigger="blur"></vyr-input>
135
+ </vyr-col>
136
+ </vyr-label>
137
+ </vyr-row>
138
+ <vyr-row>
139
+ <vyr-label :label="language.get('inspector.Echart.grid.rect.padding.horizontal')">
140
+ <vyr-col :span="12">
141
+ <vyr-input v-model="descriptor.gridRect.left" trigger="blur"></vyr-input>
142
+ </vyr-col>
143
+ <vyr-col :span="12">
144
+ <vyr-input v-model="descriptor.gridRect.right" trigger="blur"></vyr-input>
145
+ </vyr-col>
146
+ </vyr-label>
147
+ </vyr-row>
148
+ <vyr-row>
149
+ <vyr-label :label="language.get('inspector.Echart.grid.rect.padding.vertical')">
150
+ <vyr-col :span="12">
151
+ <vyr-input v-model="descriptor.gridRect.top" trigger="blur"></vyr-input>
152
+ </vyr-col>
153
+ <vyr-col :span="12">
154
+ <vyr-input v-model="descriptor.gridRect.bottom" trigger="blur"></vyr-input>
155
+ </vyr-col>
156
+ </vyr-label>
157
+ </vyr-row>
158
+ <vyr-row>
159
+ <vyr-divider :text="language.get('inspector.Echart.legend')"></vyr-divider>
160
+ </vyr-row>
161
+ <vyr-row>
162
+ <vyr-label :label="language.get('inspector.Echart.legend.show')">
163
+ <vyr-col>
164
+ <vyr-select v-model="descriptor.legendShow" :data="option.stateOptions"></vyr-select>
165
+ </vyr-col>
166
+ </vyr-label>
167
+ </vyr-row>
168
+ <vyr-row>
169
+ <vyr-label :label="language.get('inspector.Echart.legend.rect.size')">
170
+ <vyr-col :span="12">
171
+ <vyr-input v-model="descriptor.legendRect.width" trigger="blur"></vyr-input>
172
+ </vyr-col>
173
+ <vyr-col :span="12">
174
+ <vyr-input v-model="descriptor.legendRect.height" trigger="blur"></vyr-input>
175
+ </vyr-col>
176
+ </vyr-label>
177
+ </vyr-row>
178
+ <vyr-row>
179
+ <vyr-label :label="language.get('inspector.Echart.legend.position')">
180
+ <vyr-col :span="12">
181
+ <vyr-input v-model="descriptor.legendRect.left" trigger="blur"></vyr-input>
182
+ </vyr-col>
183
+ <vyr-col :span="12">
184
+ <vyr-input v-model="descriptor.legendRect.top" trigger="blur"></vyr-input>
185
+ </vyr-col>
186
+ </vyr-label>
187
+ </vyr-row>
188
+ <vyr-row>
189
+ <vyr-label :label="language.get('inspector.Echart.legend.font')">
190
+ <vyr-col>
191
+ <vyr-color-picker width="all" v-model="descriptor.legendTextStyle.color"></vyr-color-picker>
192
+ </vyr-col>
193
+ </vyr-label>
194
+ </vyr-row>
195
+ <vyr-row>
196
+ <vyr-divider :text="language.get('inspector.Echart.tooltip')"></vyr-divider>
197
+ </vyr-row>
198
+ <vyr-row>
199
+ <vyr-label :label="language.get('inspector.Echart.tooltip.show')">
200
+ <vyr-col>
201
+ <vyr-select v-model="descriptor.tooltipShow" :data="option.stateOptions"></vyr-select>
202
+ </vyr-col>
203
+ </vyr-label>
204
+ </vyr-row>
205
+ <vyr-row>
206
+ <vyr-label :label="language.get('inspector.Echart.tooltip.trigger')">
207
+ <vyr-col>
208
+ <vyr-select v-model="descriptor.tooltipTrigger" :data="Echart.triggerOptions"></vyr-select>
209
+ </vyr-col>
210
+ </vyr-label>
211
+ </vyr-row>
212
+ </vyr-card>
213
+ </template>
214
+ </template>
215
+
216
+
217
+ <script lang="ts" setup>
218
+ import { ref, Ref, watch } from 'vue';
219
+ import { EchartDescriptor } from '@vyr/echarts'
220
+ import { VyrCard, VyrDivider, VyrInput, VyrInputNumber, VyrRow, VyrCol, VyrLabel, VyrSelect, VyrColorPicker } from '@vyr/design'
221
+ import { option, BaseFragment, HTMLFragment, providerDescriptor as builtinProviderDescriptor } from '@vyr/builtin'
222
+ import { language } from '../../locale'
223
+ import { providerDescriptor } from '../../common'
224
+ import { Echart } from '../../option'
225
+
226
+ const props = defineProps<{ raw: string, uuid: string }>()
227
+
228
+ const descriptor = ref(null) as Ref<EchartDescriptor | null>
229
+ const watchEditItem = (cur: string) => {
230
+ if (!cur) return descriptor.value = null
231
+ descriptor.value = EchartDescriptor.get<EchartDescriptor>(cur)
232
+ }
233
+ watch(() => props.uuid, watchEditItem, { immediate: true })
234
+ providerDescriptor(descriptor)
235
+ builtinProviderDescriptor(descriptor)
236
+ </script>
237
+
238
+ <style lang="less" scoped></style>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <vyr-card v-if="descriptor" :title="language.get('descriptor.type.LineServiceEchart')" :scroll="true">
3
+ <vyr-row>
4
+ <vyr-label :label="language.get('inspector.Line.base.modelValue')">
5
+ <vyr-col>
6
+ <vyr-input v-model="descriptor.modelValue" :clearable="true" trigger="blur"></vyr-input>
7
+ </vyr-col>
8
+ </vyr-label>
9
+ </vyr-row>
10
+ <vyr-row>
11
+ <vyr-label :label="language.get('inspector.Line.base.line.type')">
12
+ <vyr-col>
13
+ <vyr-select v-model="descriptor.lineStyle.type" :data="Echart.borderTypeOptions"></vyr-select>
14
+ </vyr-col>
15
+ </vyr-label>
16
+ </vyr-row>
17
+ <vyr-row>
18
+ <vyr-label :label="language.get('inspector.Line.base.line.width')">
19
+ <vyr-col>
20
+ <vyr-input-number v-model="descriptor.lineStyle.width" trigger="blur"></vyr-input-number>
21
+ </vyr-col>
22
+ </vyr-label>
23
+ </vyr-row>
24
+ <vyr-row>
25
+ <vyr-label :label="language.get('inspector.Line.base.smooth')">
26
+ <vyr-col>
27
+ <vyr-select v-model="descriptor.smooth" :data="option.stateOptions"></vyr-select>
28
+ </vyr-col>
29
+ </vyr-label>
30
+ </vyr-row>
31
+ <vyr-color-item v-model="descriptor.itemStyleColor"
32
+ :title="language.get('inspector.Line.base.draw')"></vyr-color-item>
33
+ <vyr-color-item v-model="descriptor.areaStyleColor"
34
+ :title="language.get('inspector.Line.base.fill')"></vyr-color-item>
35
+ </vyr-card>
36
+ </template>
37
+
38
+
39
+ <script lang="ts" setup>
40
+ import { ref, Ref, watch } from 'vue';
41
+ import { LineServiceEchartDescriptor } from '@vyr/echarts'
42
+ import { VyrCard, VyrInput, VyrRow, VyrCol, VyrLabel, VyrSelect, VyrInputNumber } from '@vyr/design';
43
+ import { option, VyrColorItem, providerDescriptor as builtinProviderDescriptor } from '@vyr/builtin'
44
+ import { language } from '../../locale'
45
+ import { providerDescriptor } from '../../common';
46
+ import { Echart } from '../../option'
47
+
48
+ const props = defineProps<{ raw: string, uuid: string }>()
49
+
50
+ const descriptor = ref(null) as Ref<LineServiceEchartDescriptor | null>
51
+ const watchEditItem = (cur: string) => {
52
+ if (!cur) return descriptor.value = null
53
+ descriptor.value = LineServiceEchartDescriptor.get<LineServiceEchartDescriptor>(cur)
54
+ }
55
+ watch(() => props.uuid, watchEditItem, { immediate: true })
56
+ providerDescriptor(descriptor)
57
+ builtinProviderDescriptor(descriptor)
58
+ </script>
59
+
60
+ <style lang="less" scoped></style>
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <vyr-card v-if="descriptor" :title="language.get('descriptor.type.PieServiceEchart')" :scroll="true">
3
+ <vyr-row>
4
+ <vyr-label :label="language.get('inspector.Pie.base.modelValue')">
5
+ <vyr-col>
6
+ <vyr-input v-model="descriptor.modelValue" :clearable="true" trigger="blur"></vyr-input>
7
+ </vyr-col>
8
+ </vyr-label>
9
+ </vyr-row>
10
+ <vyr-row>
11
+ <vyr-label :label="language.get('inspector.Pie.base.roseType')">
12
+ <vyr-col>
13
+ <vyr-select v-model="descriptor.roseType" :data="Echart.roseTypeOptions"></vyr-select>
14
+ </vyr-col>
15
+ </vyr-label>
16
+ </vyr-row>
17
+ <vyr-row>
18
+ <vyr-label :label="language.get('inspector.Pie.base.width')">
19
+ <vyr-col>
20
+ <vyr-input v-model="descriptor.width" trigger="blur"></vyr-input>
21
+ </vyr-col>
22
+ </vyr-label>
23
+ </vyr-row>
24
+ <vyr-row>
25
+ <vyr-label :label="language.get('inspector.Pie.base.height')">
26
+ <vyr-col>
27
+ <vyr-input v-model="descriptor.height" trigger="blur"></vyr-input>
28
+ </vyr-col>
29
+ </vyr-label>
30
+ </vyr-row>
31
+ <vyr-row>
32
+ <vyr-label :label="language.get('inspector.Pie.base.radius')">
33
+ <vyr-col :span="12">
34
+ <vyr-input v-model="descriptor.radius.x" trigger="blur"></vyr-input>
35
+ </vyr-col>
36
+ <vyr-col :span="12">
37
+ <vyr-input v-model="descriptor.radius.y" trigger="blur"></vyr-input>
38
+ </vyr-col>
39
+ </vyr-label>
40
+ </vyr-row>
41
+ <vyr-row>
42
+ <vyr-label :label="language.get('inspector.Pie.base.center')">
43
+ <vyr-col :span="12">
44
+ <vyr-input v-model="descriptor.center.x" trigger="blur"></vyr-input>
45
+ </vyr-col>
46
+ <vyr-col :span="12">
47
+ <vyr-input v-model="descriptor.center.y" trigger="blur"></vyr-input>
48
+ </vyr-col>
49
+ </vyr-label>
50
+ </vyr-row>
51
+ <vyr-row>
52
+ <vyr-label :label="language.get('inspector.Pie.base.label.padAngle')">
53
+ <vyr-col>
54
+ <vyr-input-number v-model="descriptor.padAngle" :min="0" :max="360"></vyr-input-number>
55
+ </vyr-col>
56
+ </vyr-label>
57
+ </vyr-row>
58
+ <vyr-row>
59
+ <vyr-label :label="language.get('inspector.Pie.base.label.show')">
60
+ <vyr-col>
61
+ <vyr-select v-model="descriptor.labelShow" :data="option.stateOptions"></vyr-select>
62
+ </vyr-col>
63
+ </vyr-label>
64
+ </vyr-row>
65
+ <vyr-row>
66
+ <vyr-label :label="language.get('inspector.Pie.base.label.position')">
67
+ <vyr-col>
68
+ <vyr-input v-model="descriptor.labelPosition" :clearable="true" trigger="blur"></vyr-input>
69
+ </vyr-col>
70
+ </vyr-label>
71
+ </vyr-row>
72
+ <vyr-row>
73
+ <vyr-label :label="language.get('inspector.Pie.base.label.color')">
74
+ <vyr-col>
75
+ <vyr-color-picker v-model="descriptor.labelColor" width="all"></vyr-color-picker>
76
+ </vyr-col>
77
+ </vyr-label>
78
+ </vyr-row>
79
+ <vyr-row>
80
+ <vyr-label :label="language.get('inspector.Echart.border.type')">
81
+ <vyr-col>
82
+ <vyr-select v-model="descriptor.itemStyle.borderType" :data="Echart.borderTypeOptions"></vyr-select>
83
+ </vyr-col>
84
+ </vyr-label>
85
+ </vyr-row>
86
+ <vyr-row>
87
+ <vyr-label :label="language.get('inspector.Echart.border.width')">
88
+ <vyr-col>
89
+ <vyr-input-number v-model="descriptor.itemStyle.borderWidth"></vyr-input-number>
90
+ </vyr-col>
91
+ </vyr-label>
92
+ </vyr-row>
93
+ <vyr-row>
94
+ <vyr-label :label="language.get('inspector.Echart.border.radius')">
95
+ <vyr-col>
96
+ <vyr-input-number v-model="descriptor.itemStyle.borderRadius"></vyr-input-number>
97
+ </vyr-col>
98
+ </vyr-label>
99
+ </vyr-row>
100
+ <vyr-row>
101
+ <vyr-label :label="language.get('inspector.Echart.border.color')">
102
+ <vyr-col :span="12">
103
+ <vyr-color-picker v-model="descriptor.itemStyle.borderColor.value" width="all"></vyr-color-picker>
104
+ </vyr-col>
105
+ <vyr-col :span="12">
106
+ <vyr-input-number v-model="descriptor.itemStyle.borderColor.opacity" :min="0"
107
+ :max="1"></vyr-input-number>
108
+ </vyr-col>
109
+ </vyr-label>
110
+ </vyr-row>
111
+ <vyr-color-item v-model="descriptor.itemStyle.color"
112
+ :title="language.get('inspector.Bar.base.fill')"></vyr-color-item>
113
+ </vyr-card>
114
+ </template>
115
+
116
+
117
+ <script lang="ts" setup>
118
+ import { ref, Ref, watch } from 'vue';
119
+ import { PieServiceEchartDescriptor } from '@vyr/echarts'
120
+ import { VyrCard, VyrInput, VyrRow, VyrCol, VyrLabel, VyrSelect, VyrColorPicker, VyrInputNumber } from '@vyr/design';
121
+ import { option, VyrColorItem, providerDescriptor as builtinProviderDescriptor } from '@vyr/builtin'
122
+ import { language } from '../../locale'
123
+ import { providerDescriptor } from '../../common';
124
+ import { Echart } from '../../option'
125
+
126
+ const props = defineProps<{ raw: string, uuid: string }>()
127
+
128
+ const descriptor = ref(null) as Ref<PieServiceEchartDescriptor | null>
129
+ const watchEditItem = (cur: string) => {
130
+ if (!cur) return descriptor.value = null
131
+ descriptor.value = PieServiceEchartDescriptor.get<PieServiceEchartDescriptor>(cur)
132
+ }
133
+ watch(() => props.uuid, watchEditItem, { immediate: true })
134
+ providerDescriptor(descriptor)
135
+ builtinProviderDescriptor(descriptor)
136
+ </script>
137
+
138
+ <style lang="less" scoped></style>
@@ -0,0 +1,8 @@
1
+ import { BarServiceEchartDescriptor, EchartDescriptor, LineServiceEchartDescriptor, PieServiceEchartDescriptor } from '@vyr/echarts'
2
+
3
+ export default [
4
+ { type: EchartDescriptor.type, import: () => import('./EchartViewer.vue') },
5
+ { type: BarServiceEchartDescriptor.type, import: () => import('./BarServiceEchartViewer.vue') },
6
+ { type: LineServiceEchartDescriptor.type, import: () => import('./LineServiceEchartViewer.vue') },
7
+ { type: PieServiceEchartDescriptor.type, import: () => import('./PieServiceEchartViewer.vue') },
8
+ ]
@@ -0,0 +1,68 @@
1
+ import { Descriptor } from "@vyr/engine"
2
+ import { Action, DataService, runtime } from "@vyr/runtime"
3
+ import { language as builtinLanguage } from '@vyr/builtin'
4
+ import { BarServiceEchartDescriptor, EchartDescriptor, LineServiceEchartDescriptor, PieServiceEchartDescriptor, } from "@vyr/echarts"
5
+ import { language } from '../../../locale'
6
+
7
+ class AddEchartsAction extends Action {
8
+ static id = 'sidebar.addEcharts'
9
+ static generate = (label: string, Class: typeof Descriptor, args: any = {}) => {
10
+ class ClassAction extends Action {
11
+ static id = Class.type
12
+ label = label
13
+ update() {
14
+ this.show = true
15
+ this.disabled = false
16
+ }
17
+ validator() {
18
+ return false
19
+ }
20
+ execute() {
21
+ const dataService = runtime.get<DataService>('data')
22
+ const navigator = dataService.sidebar.get(dataService.sidebar.active)
23
+ if (navigator === null) return console.log(builtinLanguage.get('sidebar.action.active.notFound', { key: dataService.sidebar.active }))
24
+
25
+ navigator.status.modifyMode = 'add'
26
+ const echart = new EchartDescriptor({
27
+ ...args,
28
+ width: 100,
29
+ wUnit: '%',
30
+ height: 100,
31
+ hUnit: '%',
32
+ })
33
+ echart.add(new Class({ name: Class.type }))
34
+ navigator.status.modifyContent = echart
35
+ navigator.status.modifyValue = navigator.status.mouseItem
36
+ }
37
+ }
38
+ return new ClassAction()
39
+ }
40
+ label = language.get('sidebar.action.addEcharts.label')
41
+ order = 2
42
+
43
+ constructor() {
44
+ super()
45
+ this.children.push(AddEchartsAction.generate(language.get('descriptor.type.BarServiceEchart'), BarServiceEchartDescriptor))
46
+ this.children.push(AddEchartsAction.generate(language.get('descriptor.type.LineServiceEchart'), LineServiceEchartDescriptor))
47
+ this.children.push(AddEchartsAction.generate(language.get('descriptor.type.PieServiceEchart'), PieServiceEchartDescriptor, { xAxisShow: false, yAxisShow: false }))
48
+ }
49
+
50
+ update() {
51
+ const dataService = runtime.get<DataService>('data')
52
+ this.show = false
53
+ this.disabled = true
54
+
55
+ const navigator = dataService.sidebar.get(dataService.sidebar.active)
56
+ if (navigator === null) return console.log(builtinLanguage.get('sidebar.action.active.notFound', { key: dataService.sidebar.active }))
57
+ if (navigator.status.mouseItem === null) return
58
+
59
+ this.show = true
60
+ this.disabled = false
61
+ }
62
+ validator() {
63
+ return false
64
+ }
65
+ execute() { }
66
+ }
67
+
68
+ export { AddEchartsAction }
@@ -0,0 +1,5 @@
1
+ import { AddEchartsAction } from './AddEchartsAction'
2
+
3
+ export default [
4
+ AddEchartsAction,
5
+ ]
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ declare module '*.vue' {
3
+ const component: DefineComponent<{}, {}, any>
4
+ export default component
5
+ }
6
+
7
+ declare module '!!raw-loader!*' {
8
+ const v: string
9
+ export default v
10
+ }