@easyv/config 1.1.6 → 1.1.9

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/src/axes.js CHANGED
@@ -1,162 +1,162 @@
1
- import { gridLine, tickLine, axisLine, unit, font } from '.';
2
- import { axisLabel, valueAsixLabel } from './label';
3
- const defaultFont = font();
4
- const defaultFontAxisY = font({
5
- color: 'rgba(230, 247, 255, 1)',
6
- });
7
- const defaultCategoryAxis = {
8
- on: true,
9
- label: {
10
- show: true,
11
- format: { type: 'date', showType: 'MM月' },
12
- appearance: { count: 3, angle: 0, wordBreak: 'keep-all' },
13
- translate: { x: 0, y: 0 },
14
- font: defaultFontAxisY,
15
- },
16
- axisLine: { show: true, color: '#BAE7FF', lineWidth: 1 },
17
- tickLine: {
18
- show: false,
19
- color: 'rgba(186,231,255,1)',
20
- lineWidth: 1,
21
- tickSize: 6,
22
- },
23
- gridLine: {
24
- show: true,
25
- strokeDasharray: '3,3',
26
- color: 'rgba(230, 247, 255, 0.2)',
27
- lineWidth: 1,
28
- },
29
- };
30
-
31
- export const categoryAxis = ({
32
- on = defaultCategoryAxis.on,
33
- label = defaultCategoryAxis.label,
34
- axisLine: axisLine_ = defaultCategoryAxis.axisLine,
35
- tickLine: tickLine_ = defaultCategoryAxis.tickLine,
36
- gridLine: gridLine_ = defaultCategoryAxis.gridLine,
37
- } = defaultCategoryAxis) => [
38
- {
39
- name: 'on',
40
- displayName: '启用',
41
- value: on,
42
- type: 'boolean',
43
- },
44
- {
45
- rule: [['on', '$eq', true]],
46
- ...axisLabel(label),
47
- },
48
- {
49
- rule: [['on', '$eq', true]],
50
- ...axisLine(axisLine_),
51
- },
52
- {
53
- rule: [['on', '$eq', true]],
54
- ...tickLine(tickLine_),
55
- },
56
- {
57
- rule: [['on', '$eq', true]],
58
- ...gridLine(gridLine_),
59
- },
60
- ];
61
-
62
- const defaultValueAxis = {
63
- on: true,
64
- label: {
65
- show: true,
66
- extent: { min: '0', max: '' },
67
- auto: false,
68
- mode: 'count',
69
- count: 3,
70
- step: 100,
71
- decimal: 0,
72
- suffix: '',
73
- translate: { x: 6, y: 0 },
74
- font: defaultFont,
75
- },
76
- unit: {
77
- show: false,
78
- text: '单位',
79
- font: defaultFont,
80
- translate: { x: 0, y: 0 },
81
- },
82
- axisLine: { show: true, color: '#BAE7FF', lineWidth: 1 },
83
- tickLine: {
84
- show: true,
85
- color: 'rgba(186,231,255,1)',
86
- lineWidth: 1,
87
- tickSize: 6,
88
- },
89
- gridLine: {
90
- show: true,
91
- strokeDasharray: '3,3',
92
- color: 'rgba(230, 247, 255, 0.2)',
93
- lineWidth: 1,
94
- },
95
- };
96
-
97
- export const valueAxis = ({
98
- on = defaultValueAxis.on,
99
- label = defaultValueAxis.label,
100
- unit: unit_ = defaultValueAxis.unit,
101
- axisLine: axisLine_ = defaultValueAxis.axisLine,
102
- tickLine: tickLine_ = defaultValueAxis.tickLine,
103
- gridLine: gridLine_ = defaultValueAxis.gridLine,
104
- } = defaultValueAxis) => [
105
- {
106
- name: 'on',
107
- displayName: '启用',
108
- value: on,
109
- type: 'boolean',
110
- },
111
- {
112
- rule: [['on', '$eq', true]],
113
- ...valueAsixLabel(label),
114
- },
115
- {
116
- rule: [['on', '$eq', true]],
117
- ...unit(unit_),
118
- },
119
- {
120
- rule: [['on', '$eq', true]],
121
- ...axisLine(axisLine_),
122
- },
123
- {
124
- rule: [['on', '$eq', true]],
125
- ...tickLine(tickLine_),
126
- },
127
- {
128
- rule: [['on', '$eq', true]],
129
- ...gridLine(gridLine_),
130
- },
131
- ];
132
-
133
- export default (
134
- { xAxis = defaultCategoryAxis, yAxis = defaultValueAxis, zAxis } = {
135
- xAxis: defaultCategoryAxis,
136
- yAxis: defaultValueAxis,
137
- }
138
- ) => ({
139
- name: 'axes',
140
- displayName: '坐标轴',
141
- value: [
142
- {
143
- name: 'xAxis',
144
- displayName: 'X轴',
145
- value: categoryAxis(xAxis),
146
- },
147
- {
148
- name: 'yAxis',
149
- displayName: 'Y轴',
150
- value: valueAxis(yAxis),
151
- },
152
- zAxis && {
153
- name: 'zAxis',
154
- displayName: 'Z轴',
155
- value: valueAxis(zAxis),
156
- },
157
- ].filter((item) => !!item),
158
- config: {
159
- layout: 'horizontal',
160
- },
161
- type: 'menu',
162
- });
1
+ import { gridLine, tickLine, axisLine, unit, font } from '.';
2
+ import { axisLabel, valueAsixLabel } from './label';
3
+ const defaultFont = font();
4
+ const defaultFontAxisY = font({
5
+ color: 'rgba(230, 247, 255, 1)',
6
+ });
7
+ const defaultCategoryAxis = {
8
+ on: true,
9
+ label: {
10
+ show: true,
11
+ format: { type: 'date', showType: 'MM月' },
12
+ appearance: { count: 3, angle: 0, wordBreak: 'keep-all' },
13
+ translate: { x: 0, y: 0 },
14
+ font: defaultFontAxisY,
15
+ },
16
+ axisLine: { show: true, color: '#BAE7FF', lineWidth: 1 },
17
+ tickLine: {
18
+ show: false,
19
+ color: 'rgba(186,231,255,1)',
20
+ lineWidth: 1,
21
+ tickSize: 6,
22
+ },
23
+ gridLine: {
24
+ show: true,
25
+ strokeDasharray: '3,3',
26
+ color: 'rgba(230, 247, 255, 0.2)',
27
+ lineWidth: 1,
28
+ },
29
+ };
30
+
31
+ export const categoryAxis = ({
32
+ on = defaultCategoryAxis.on,
33
+ label = defaultCategoryAxis.label,
34
+ axisLine: axisLine_ = defaultCategoryAxis.axisLine,
35
+ tickLine: tickLine_ = defaultCategoryAxis.tickLine,
36
+ gridLine: gridLine_ = defaultCategoryAxis.gridLine,
37
+ } = defaultCategoryAxis) => [
38
+ {
39
+ name: 'on',
40
+ displayName: '启用',
41
+ value: on,
42
+ type: 'boolean',
43
+ },
44
+ {
45
+ rule: [['on', '$eq', true]],
46
+ ...axisLabel(label),
47
+ },
48
+ {
49
+ rule: [['on', '$eq', true]],
50
+ ...axisLine(axisLine_),
51
+ },
52
+ {
53
+ rule: [['on', '$eq', true]],
54
+ ...tickLine(tickLine_),
55
+ },
56
+ {
57
+ rule: [['on', '$eq', true]],
58
+ ...gridLine(gridLine_),
59
+ },
60
+ ];
61
+
62
+ const defaultValueAxis = {
63
+ on: true,
64
+ label: {
65
+ show: true,
66
+ extent: { min: '0', max: '' },
67
+ auto: false,
68
+ mode: 'count',
69
+ count: 3,
70
+ step: 100,
71
+ decimal: 0,
72
+ suffix: '',
73
+ translate: { x: 6, y: 0 },
74
+ font: defaultFont,
75
+ },
76
+ unit: {
77
+ show: false,
78
+ text: '单位',
79
+ font: defaultFont,
80
+ translate: { x: 0, y: 0 },
81
+ },
82
+ axisLine: { show: true, color: '#BAE7FF', lineWidth: 1 },
83
+ tickLine: {
84
+ show: true,
85
+ color: 'rgba(186,231,255,1)',
86
+ lineWidth: 1,
87
+ tickSize: 6,
88
+ },
89
+ gridLine: {
90
+ show: true,
91
+ strokeDasharray: '3,3',
92
+ color: 'rgba(230, 247, 255, 0.2)',
93
+ lineWidth: 1,
94
+ },
95
+ };
96
+
97
+ export const valueAxis = ({
98
+ on = defaultValueAxis.on,
99
+ label = defaultValueAxis.label,
100
+ unit: unit_ = defaultValueAxis.unit,
101
+ axisLine: axisLine_ = defaultValueAxis.axisLine,
102
+ tickLine: tickLine_ = defaultValueAxis.tickLine,
103
+ gridLine: gridLine_ = defaultValueAxis.gridLine,
104
+ } = defaultValueAxis) => [
105
+ {
106
+ name: 'on',
107
+ displayName: '启用',
108
+ value: on,
109
+ type: 'boolean',
110
+ },
111
+ {
112
+ rule: [['on', '$eq', true]],
113
+ ...valueAsixLabel(label),
114
+ },
115
+ {
116
+ rule: [['on', '$eq', true]],
117
+ ...unit(unit_),
118
+ },
119
+ {
120
+ rule: [['on', '$eq', true]],
121
+ ...axisLine(axisLine_),
122
+ },
123
+ {
124
+ rule: [['on', '$eq', true]],
125
+ ...tickLine(tickLine_),
126
+ },
127
+ {
128
+ rule: [['on', '$eq', true]],
129
+ ...gridLine(gridLine_),
130
+ },
131
+ ];
132
+
133
+ export default (
134
+ { xAxis = defaultCategoryAxis, yAxis = defaultValueAxis, zAxis } = {
135
+ xAxis: defaultCategoryAxis,
136
+ yAxis: defaultValueAxis,
137
+ }
138
+ ) => ({
139
+ name: 'axes',
140
+ displayName: '坐标轴',
141
+ value: [
142
+ {
143
+ name: 'xAxis',
144
+ displayName: 'X轴',
145
+ value: categoryAxis(xAxis),
146
+ },
147
+ {
148
+ name: 'yAxis',
149
+ displayName: 'Y轴',
150
+ value: valueAxis(yAxis),
151
+ },
152
+ zAxis && {
153
+ name: 'zAxis',
154
+ displayName: 'Z轴',
155
+ value: valueAxis(zAxis),
156
+ },
157
+ ].filter((item) => !!item),
158
+ config: {
159
+ layout: 'horizontal',
160
+ },
161
+ type: 'menu',
162
+ });
package/src/axisLine.js CHANGED
@@ -1,39 +1,39 @@
1
- const axisLine = {
2
- show: true,
3
- color: '#BAE7FF',
4
- lineWidth: 1,
5
- };
6
- export default ({
7
- show = axisLine.show,
8
- color = axisLine.color,
9
- lineWidth = axisLine.lineWidth,
10
- } = axisLine) => ({
11
- name: 'axisLine',
12
- displayName: '轴线',
13
- value: [
14
- {
15
- name: 'show',
16
- displayName: '显示',
17
- value: show,
18
- type: 'boolean',
19
- },
20
- {
21
- rule: [['show', '$eq', true]],
22
- name: 'color',
23
- displayName: '颜色',
24
- value: color,
25
- type: 'color',
26
- markColorType: 'assistColor',
27
- },
28
- {
29
- rule: [['show', '$eq', true]],
30
- name: 'lineWidth',
31
- displayName: '粗细',
32
- value: lineWidth,
33
- type: 'number',
34
- config: {
35
- suffix: 'px',
36
- },
37
- },
38
- ],
39
- });
1
+ const axisLine = {
2
+ show: true,
3
+ color: '#BAE7FF',
4
+ lineWidth: 1,
5
+ };
6
+ export default ({
7
+ show = axisLine.show,
8
+ color = axisLine.color,
9
+ lineWidth = axisLine.lineWidth,
10
+ } = axisLine) => ({
11
+ name: 'axisLine',
12
+ displayName: '轴线',
13
+ value: [
14
+ {
15
+ name: 'show',
16
+ displayName: '显示',
17
+ value: show,
18
+ type: 'boolean',
19
+ },
20
+ {
21
+ rule: [['show', '$eq', true]],
22
+ name: 'color',
23
+ displayName: '颜色',
24
+ value: color,
25
+ type: 'color',
26
+ markColorType: 'assistColor',
27
+ },
28
+ {
29
+ rule: [['show', '$eq', true]],
30
+ name: 'lineWidth',
31
+ displayName: '粗细',
32
+ value: lineWidth,
33
+ type: 'number',
34
+ config: {
35
+ suffix: 'px',
36
+ },
37
+ },
38
+ ],
39
+ });
@@ -0,0 +1,216 @@
1
+ //@ts-check
2
+ import { font, translate } from '.';
3
+ const defaultBaseLine = {
4
+ line: {
5
+ yOrZ: 'y',
6
+ margin: {
7
+ marginLeft: 0,
8
+ marginRight: 100
9
+ },
10
+ lineType: 'dash',
11
+ color: '#FF781E',
12
+ lineWidth: 1,
13
+ strokeDasharray: '3,4'
14
+ },
15
+ dataStyle: {
16
+ label: {
17
+ show: true,
18
+ text: '平均值',
19
+ font: font({
20
+ color: 'rgba(255, 120, 30, 0.7)',
21
+ fontFamily: 'Mircosoft Yahei',
22
+ fontSize: 12,
23
+ bold: false,
24
+ italic: false,
25
+ letterSpacing: 0,
26
+ }),
27
+ translate: { x: 4, y: 1 },
28
+ },
29
+ data: {
30
+ show: false,
31
+ font: font(),
32
+ translate: { x: 0, y: 0 },
33
+ }
34
+ }
35
+ };
36
+ export default ({
37
+ line: {
38
+ yOrZ = defaultBaseLine.line.yOrZ,
39
+ margin: {
40
+ marginLeft = defaultBaseLine.line.margin.marginLeft,
41
+ marginRight = defaultBaseLine.line.margin.marginRight,
42
+ } = defaultBaseLine.line.margin,
43
+ lineType = defaultBaseLine.line.lineType,
44
+ color = defaultBaseLine.line.color,
45
+ lineWidth = defaultBaseLine.line.lineWidth,
46
+ strokeDasharray = defaultBaseLine.line.strokeDasharray
47
+ } = defaultBaseLine.line,
48
+ dataStyle: {
49
+ label: {
50
+ showLabel = defaultBaseLine.dataStyle.label.show,
51
+ text = defaultBaseLine.dataStyle.label.text,
52
+ textStyle = defaultBaseLine.dataStyle.label.font,
53
+ translate: { x, y } = defaultBaseLine.dataStyle.label.translate,
54
+ },
55
+ data: {
56
+ showData = defaultBaseLine.dataStyle.data.show,
57
+ dataStyle = defaultBaseLine.dataStyle.data.dataStyle,
58
+ dataTranslate: {
59
+ x: dataTranslateX = defaultBaseLine.dataStyle.data.translate.x,
60
+ y: dataTranslateY = defaultBaseLine.dataStyle.data.translate.y
61
+ } = defaultBaseLine.dataStyle.data.translate
62
+ } = defaultBaseLine.dataStyle.data,
63
+ } = defaultBaseLine.dataStyle
64
+
65
+ } = defaultBaseLine) => [
66
+ {
67
+ name: 'line',
68
+ displayName: '线样式',
69
+ config: {
70
+ layout: 'horizontal'
71
+ },
72
+ value: [
73
+ {
74
+ name: 'yOrZ',
75
+ displayName: '纵轴选择',
76
+ value: yOrZ,
77
+ type: 'select',
78
+ config: {
79
+ options: [
80
+ { name: 'Y轴', value: 'y' },
81
+ { name: 'Z轴', value: 'z' },
82
+ ],
83
+ },
84
+ },
85
+ {
86
+ name: 'margin',
87
+ displayName: '边距',
88
+ type: 'group',
89
+ value: [
90
+ {
91
+ type: 'number',
92
+ name: 'marginLeft',
93
+ displayName: '左',
94
+ value: marginLeft,
95
+ config: {
96
+ span: 12,
97
+ showStep: false,
98
+ },
99
+ },
100
+ {
101
+ type: 'number',
102
+ name: 'marginRight',
103
+ displayName: '右',
104
+ value: marginRight,
105
+ config: {
106
+ span: 12,
107
+ showStep: false,
108
+ },
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ name: 'lineType',
114
+ displayName: '线样式',
115
+ value: lineType,
116
+ type: 'select',
117
+ config: {
118
+ options: [{
119
+ name: '实线',
120
+ value: 'solid'
121
+ }, {
122
+ name: '虚线',
123
+ value: 'dash'
124
+ }]
125
+ },
126
+ },
127
+ {
128
+ name: 'color',
129
+ displayName: '颜色',
130
+ value: color,
131
+ type: 'color',
132
+ markColorType: 'assistColor',
133
+ },
134
+ {
135
+ name: 'lineWidth',
136
+ displayName: '粗细',
137
+ value: lineWidth,
138
+ type: 'number',
139
+ config: {
140
+ data: 'px',
141
+ },
142
+ },
143
+ {
144
+ rule: [['lineType', '$eq', 'dash']],
145
+ name: 'strokeDasharray',
146
+ displayName: '虚线样式',
147
+ value: strokeDasharray,
148
+ type: 'input',
149
+ tip: '格式使用半角字符,如3,3',
150
+ },
151
+ ],
152
+ },
153
+ {
154
+ name: 'dataStyle',
155
+ displayName: '数据样式',
156
+ value: [
157
+ {
158
+ name: 'label',
159
+ displayName: '标签',
160
+ config: {
161
+ defaultOpen: true
162
+ },
163
+ value: [
164
+ {
165
+ name: 'show',
166
+ displayName: '显示',
167
+ value: showLabel,
168
+ type: 'boolean',
169
+ },
170
+ {
171
+ rule: [['show', '$eq', true]],
172
+ name: "label",
173
+ displayName: "标签内容",
174
+ type: 'input',
175
+ value: text,
176
+ },
177
+ {
178
+ rule: [['show', '$eq', true]],
179
+ name: 'textStyle',
180
+ displayName: '文本样式',
181
+ value: font(textStyle),
182
+ type: 'textStyle',
183
+ markColorType: 'textColor',
184
+ },
185
+ {
186
+ rule: [['show', '$eq', true]],
187
+ ...translate(x, y)
188
+ }]
189
+ },
190
+ {
191
+ name: 'data',
192
+ displayName: '数值',
193
+ value: [
194
+ {
195
+ name: 'show',
196
+ displayName: '显示',
197
+ value: showData,
198
+ type: 'boolean',
199
+ },
200
+ {
201
+ rule: [['show', '$eq', true]],
202
+ name: 'dataStyle',
203
+ displayName: '文本样式',
204
+ value: font(dataStyle),
205
+ type: 'textStyle',
206
+ markColorType: 'textColor',
207
+ },
208
+ {
209
+ rule: [['show', '$eq', true]],
210
+ ...translate(dataTranslateX, dataTranslateY)
211
+ }
212
+ ]
213
+ }
214
+ ]
215
+ }
216
+ ];