dcim-topology2d 2.0.5 → 2.0.7
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/chart-diagram/src/echarts/index.js +21 -13
- package/chart-diagram/src/utils/changeOptions.js +7 -1
- package/chart-diagram/src/utils/conversion.d.ts +1 -0
- package/chart-diagram/src/utils/conversion.js +117 -23
- package/chart-diagram/src/utils/formatter.d.ts +1 -0
- package/chart-diagram/src/utils/formatter.js +129 -0
- package/chart-diagram/src/utils/index.d.ts +1 -0
- package/chart-diagram/src/utils/index.js +1 -0
- package/chart-diagram/src/utils/render.d.ts +3 -1
- package/chart-diagram/src/utils/render.js +83 -8
- package/core/src/common.js +53 -18
- package/core/src/core.js +25 -0
- package/core/src/divLayer.js +1 -1
- package/core/src/element/common.js +4 -2
- package/core/src/element/select.js +29 -0
- package/core/src/element/tab.js +5 -1
- package/core/src/healps/changeData.js +1 -1
- package/core/src/middles/nodes/formoverflow.js +61 -0
- package/core/src/middles/nodes/formselect.js +16 -8
- package/core/src/middles/nodes/index.d.ts +2 -1
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.js +7 -0
- package/core/src/options.d.ts +1 -1
- package/core/src/preview.js +28 -1
- package/core/src/store/data.d.ts +7 -0
- package/core/src/store/data.js +17 -1
- package/core/src/utils/assignment.js +2 -2
- package/core/src/utils/construction.d.ts +2 -0
- package/core/src/utils/construction.js +1 -0
- package/core/src/utils/conversion.d.ts +2 -1
- package/core/src/utils/conversion.js +52 -0
- package/core/src/utils/params.js +3 -0
- package/myShape-diagram/index.js +155 -152
- package/package.json +1 -1
- package/static/echartsDefaultData.js +11 -3
package/core/src/utils/params.js
CHANGED
@@ -6,6 +6,9 @@ export function getParams(id, data) {
|
|
6
6
|
if (item.children && item.children.length) {
|
7
7
|
getParams(id, item.children);
|
8
8
|
}
|
9
|
+
if (item.formData && item.formData.detailPageData && item.formData.detailPageData.pens && item.formData.detailPageData.pens.length) {
|
10
|
+
getParams(id, item.formData.detailPageData.pens);
|
11
|
+
}
|
9
12
|
});
|
10
13
|
}
|
11
14
|
// 过滤出参数
|
package/myShape-diagram/index.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
// 源码版写法
|
2
2
|
import { registerNode } from '../core'
|
3
|
+
import { formOverflow } from '../core/src/middles/nodes/formoverflow'
|
4
|
+
|
3
5
|
|
4
6
|
// 组件版写法和bundle一致
|
5
7
|
// window.Le5leTopology.registerNode
|
@@ -7,87 +9,87 @@ import { registerNode } from '../core'
|
|
7
9
|
// 画骨架
|
8
10
|
|
9
11
|
function drawOuterLine(ctx, node) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
12
|
+
const R = Math.floor((node.rect.width - 6) / 2);
|
13
|
+
const r = Math.round((R * 1) / 2);
|
14
|
+
|
15
|
+
ctx.beginPath();
|
16
|
+
// 上半个圆形
|
17
|
+
ctx.arc(node.rect.x + R, node.rect.y + r, r, 0, Math.PI, true);
|
18
|
+
// 下半个圆形
|
19
|
+
const theta = Math.acos((r * 1.0) / R);
|
20
|
+
ctx.arc(
|
21
|
+
node.rect.x + R,
|
22
|
+
node.rect.y + node.rect.height - R,
|
23
|
+
R,
|
24
|
+
theta + Math.PI,
|
25
|
+
-theta,
|
26
|
+
true
|
27
|
+
); // 逆时针
|
28
|
+
ctx.closePath();
|
29
|
+
ctx.stroke();
|
28
30
|
}
|
29
31
|
|
30
32
|
// 画底色
|
31
33
|
function drawBasic(ctx, node) {
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
34
|
+
const lingrad = ctx.createLinearGradient(
|
35
|
+
node.rect.x,
|
36
|
+
node.rect.y,
|
37
|
+
node.rect.width,
|
38
|
+
node.rect.height
|
39
|
+
);
|
40
|
+
lingrad.addColorStop(0, 'mediumvioletred');
|
41
|
+
lingrad.addColorStop(0.2, 'darkorange');
|
42
|
+
lingrad.addColorStop(0.4, 'gold');
|
43
|
+
lingrad.addColorStop(0.6, 'limegreen');
|
44
|
+
lingrad.addColorStop(0.8, 'navy');
|
45
|
+
lingrad.addColorStop(1, 'purple');
|
46
|
+
ctx.fillStyle = lingrad;
|
47
|
+
ctx.fill('evenodd');
|
46
48
|
}
|
47
49
|
|
48
50
|
function getYByValue(node, i) {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
const R = Math.floor((node.rect.width - 6) / 2);
|
52
|
+
const r = Math.round((R * 1) / 2);
|
53
|
+
|
54
|
+
const min = 0;
|
55
|
+
const max = 40;
|
56
|
+
|
57
|
+
// 刻度线总高度
|
58
|
+
const scale_height = node.rect.height - 2 * R - 2 * r;
|
59
|
+
// 0刻度线所在位置
|
60
|
+
const zero_scale_y = node.rect.height - 2 * R;
|
61
|
+
const dy_dtem = scale_height / (max - min);
|
62
|
+
return zero_scale_y - dy_dtem * node.value;
|
61
63
|
}
|
62
64
|
|
63
65
|
// 画刻度线
|
64
66
|
function drawScale(ctx, node) {
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
}
|
67
|
+
const min = 0;
|
68
|
+
const max = 40;
|
69
|
+
const R = Math.floor((node.rect.width - 6) / 2);
|
70
|
+
const r = Math.round((R * 1) / 2);
|
71
|
+
|
72
|
+
for (let i = min; i <= max; i++) {
|
73
|
+
// 画刻度线
|
74
|
+
const y = getYByValue(node, i);
|
75
|
+
ctx.beginPath();
|
76
|
+
ctx.moveTo(R + r, y);
|
77
|
+
if (i % 10 == 0) {
|
78
|
+
ctx.lineWidth = 2;
|
79
|
+
ctx.lineTo(R + r - (r * 2) / 3, y);
|
80
|
+
// ctx.font = "15px bold";
|
81
|
+
ctx.fillText(i + '', R + r, y + 6);
|
82
|
+
ctx.stroke();
|
83
|
+
} else {
|
84
|
+
ctx.lineWidth = 1;
|
85
|
+
if (i % 5 == 0) {
|
86
|
+
ctx.lineTo(R + r - r / 2, y);
|
87
|
+
} else {
|
88
|
+
ctx.lineTo(R + r - r / 3, y);
|
89
|
+
}
|
90
|
+
ctx.stroke();
|
90
91
|
}
|
92
|
+
}
|
91
93
|
}
|
92
94
|
|
93
95
|
/////////////////////
|
@@ -96,101 +98,102 @@ function drawScale(ctx, node) {
|
|
96
98
|
|
97
99
|
// 自定义图形库绘画函数
|
98
100
|
export function thermometer(ctx, node) {
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
101
|
+
ctx.beginPath();
|
102
|
+
|
103
|
+
drawOuterLine(ctx, node);
|
104
|
+
drawBasic(ctx, node);
|
105
|
+
ctx.clearRect(
|
106
|
+
node.rect.x,
|
107
|
+
node.rect.y,
|
108
|
+
node.rect.width,
|
109
|
+
getYByValue(node, node.value)
|
110
|
+
);
|
111
|
+
drawOuterLine(ctx, node);
|
112
|
+
drawScale(ctx, node);
|
111
113
|
}
|
112
114
|
|
113
115
|
// 自定义图形库绘画函数
|
114
116
|
export function pool(ctx, node) {
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
117
|
+
var wr = node.borderRadius;
|
118
|
+
var hr = node.borderRadius;
|
119
|
+
if (node.borderRadius < 1) {
|
120
|
+
wr = node.rect.width * node.borderRadius;
|
121
|
+
hr = node.rect.height * node.borderRadius;
|
122
|
+
}
|
123
|
+
var r = wr < hr ? wr : hr;
|
124
|
+
if (node.rect.width < 2 * r) {
|
125
|
+
r = node.rect.width / 2;
|
126
|
+
}
|
127
|
+
if (node.rect.height < 2 * r) {
|
128
|
+
r = node.rect.height / 2;
|
129
|
+
}
|
130
|
+
ctx.beginPath();
|
131
|
+
ctx.strokeStyle = "rgba(0,0,0,.0)"
|
132
|
+
var value = (1-node.value) * (node.rect.height - node.lineWidth/2)
|
133
|
+
ctx.moveTo(node.rect.x + node.lineWidth/2, node.rect.y + value);
|
134
|
+
ctx.lineTo(node.rect.ex - node.lineWidth/2, node.rect.y + value);
|
135
|
+
ctx.arcTo(node.rect.ex - node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, node.rect.x + node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, r);
|
136
|
+
ctx.arcTo(node.rect.x + node.lineWidth/2, node.rect.y + node.rect.height - node.lineWidth/2, node.rect.x + node.lineWidth/2, node.rect.y, r);
|
137
|
+
ctx.lineTo(node.rect.x + node.lineWidth/2, node.rect.y + value);
|
138
|
+
ctx.closePath();
|
139
|
+
(node.fillStyle || node.bkType) && ctx.fill();
|
140
|
+
ctx.stroke();
|
141
|
+
|
142
|
+
ctx.beginPath();
|
143
|
+
ctx.strokeStyle = node.strokeStyle
|
144
|
+
ctx.lineWidth = node.lineWidth
|
145
|
+
ctx.moveTo(node.rect.x + node.rect.width, node.rect.y);
|
146
|
+
ctx.arcTo(node.rect.x + node.rect.width, node.rect.y + node.rect.height, node.rect.x, node.rect.y + node.rect.height, r);
|
147
|
+
ctx.arcTo(node.rect.x, node.rect.y + node.rect.height, node.rect.x, node.rect.y, r);
|
148
|
+
ctx.arcTo(node.rect.x, node.rect.y, node.rect.x + node.rect.width, node.rect.y, r);
|
149
|
+
// ctx.closePath();
|
150
|
+
(node.fillStyle || node.bkType);
|
151
|
+
ctx.stroke();
|
150
152
|
}
|
151
153
|
|
152
154
|
// 自定义图形库绘画函数
|
153
155
|
export function electricFan(ctx, node) {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
156
|
+
var wwr = node.rect.width / 2;
|
157
|
+
var hwr = node.rect.height / 2;
|
158
|
+
var hwr = node.rect.height / 2;
|
159
|
+
var x0 = node.rect.x + node.rect.width /2
|
160
|
+
var y0 = node.rect.y + node.rect.height / 2
|
161
|
+
var withinRadius = wwr < hwr ? wwr : hwr;
|
162
|
+
ctx.beginPath();
|
163
|
+
ctx.lineWidth = node.lineWidth
|
164
|
+
ctx.arc(x0,y0,withinRadius,0,2*Math.PI);
|
165
|
+
ctx.closePath();
|
166
|
+
ctx.stroke();
|
167
|
+
ctx.beginPath();
|
168
|
+
ctx.lineWidth = 1;
|
169
|
+
var fanCount = node.fanCount;
|
170
|
+
for(var i = 0; i < fanCount; i++){
|
171
|
+
var fanAngle = 2 * Math.PI / fanCount * i;
|
172
|
+
var x1 = x0 - withinRadius*Math.sin(fanAngle);
|
173
|
+
var y1 = y0 - withinRadius*Math.cos(fanAngle);
|
174
|
+
var xr = x0 - withinRadius*Math.sin(fanAngle)/2;
|
175
|
+
var yr = y0 - withinRadius*Math.cos(fanAngle)/2;
|
176
|
+
ctx.moveTo(x0, y0);
|
177
|
+
ctx.lineTo(x1, y1);
|
178
|
+
ctx.arc(xr, yr, withinRadius/2, Math.PI / 2 - fanAngle,3 * Math.PI / 2 - fanAngle);
|
179
|
+
}
|
180
|
+
ctx.closePath();
|
181
|
+
(node.fillStyle || node.bkType) && ctx.fill();
|
182
|
+
ctx.stroke();
|
183
|
+
ctx.beginPath();
|
184
|
+
ctx.lineWidth = 3;
|
185
|
+
ctx.arc(x0,y0,withinRadius/5,0,2*Math.PI);
|
186
|
+
ctx.closePath();
|
187
|
+
(node.fillStyle || node.bkType) && ctx.fill();
|
188
|
+
ctx.stroke();
|
187
189
|
}
|
188
190
|
|
189
191
|
// 注册自定义图形库
|
190
192
|
export function registerMyShape() {
|
191
|
-
|
192
|
-
|
193
|
-
|
193
|
+
registerNode('electricFan', electricFan);
|
194
|
+
registerNode('pool', pool);
|
195
|
+
registerNode('thermometer', thermometer);
|
196
|
+
registerNode('formOverflow', formOverflow);
|
194
197
|
}
|
195
198
|
|
196
199
|
// src\views\data.ts 里面加载到工具栏,第一个就是此自定义图形库
|
package/package.json
CHANGED
@@ -3,7 +3,7 @@ export const echartsLegendDefaultData = {
|
|
3
3
|
icon: 'rect', // 图标类型:'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow', 'none'
|
4
4
|
itemWidth: 12, // 图标宽
|
5
5
|
itemHeight: 12, // 图标高
|
6
|
-
itemGap: 8, // 图例之间的间隔
|
6
|
+
itemGap: 8, // 图例之间的间隔
|
7
7
|
top: '0%', // 图例距离容器上边位置
|
8
8
|
right: 'auto', // 图例距离容器右边位置
|
9
9
|
bottom: 'auto', // 图例距离容器下边位置
|
@@ -155,5 +155,13 @@ export const echartsColorData = [
|
|
155
155
|
'rgb(68, 237, 146)',
|
156
156
|
'rgb(251, 94, 45)',
|
157
157
|
'rgb(18, 255, 113)',
|
158
|
-
'rgb(18, 255, 113)']
|
159
|
-
|
158
|
+
'rgb(18, 255, 113)'];
|
159
|
+
// TOP排行榜默认颜色
|
160
|
+
export const rankingTopColorList = [
|
161
|
+
'rgba(239, 120, 66, .6)',
|
162
|
+
'rgba(255, 225, 65, .5)',
|
163
|
+
'rgba(55, 240, 151, .5)',
|
164
|
+
'rgba(72, 211, 255, .6)',
|
165
|
+
'rgba(67, 153, 255, .5)'
|
166
|
+
];
|
167
|
+
export const rankingTopImageName = ['orange', 'yellow', 'ching', 'lightBlue', 'blue'];
|