@riil-frontend/component-topology 0.3.1 → 0.3.2
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/1.js +1 -1
- package/build/index.css +1 -1
- package/build/index.html +1 -1
- package/build/index.js +14 -14
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221/src/AppInstallTopo.jsx +66 -30
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221/src/DataStreamTopo.jsx +4 -9
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221/src/data/dataStream/data1.json +2 -1
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221//345/272/224/347/224/250/351/203/250/347/275/262/346/213/223/346/211/221.md +2 -1
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221//346/225/260/346/215/256/346/265/201/346/213/223/346/211/221.md +1 -0
- package/demo/3/344/270/232/345/212/241/347/233/221/346/216/247/346/213/223/346/211/221//346/226/260/345/273/272.md +1 -0
- package/demo/API/API.md +68 -5
- package/es/components/TopoView/settings/GroupNodeList/GroupNodeList.js +18 -0
- package/es/components/TopoView/settings/{ResourceList.js → GroupNodeList/ResourceList.js} +2 -52
- package/es/components/TopoView/settings/{ResourceList.module.scss → GroupNodeList/ResourceList.module.scss} +0 -0
- package/es/components/TopoView/settings/{SelectResource → GroupNodeList/SelectResource}/index.js +0 -0
- package/es/components/TopoView/settings/{SelectResource → GroupNodeList/SelectResource}/index.module.scss +0 -0
- package/es/components/TopoView/settings/LayerSettingsForm.js +8 -3
- package/es/components/TopoView/settings/Settings.js +1 -0
- package/es/components/TopoView/toolbar/index.js +2 -1
- package/es/core/models/TopoApp.js +136 -68
- package/es/core/models/common/TopoClient.js +9 -1
- package/es/icons/icons.js +1 -0
- package/es/utils/htElementUtils.js +53 -0
- package/es/utils/topoData.js +1 -1
- package/lib/components/TopoView/settings/GroupNodeList/GroupNodeList.js +33 -0
- package/lib/components/TopoView/settings/{ResourceList.js → GroupNodeList/ResourceList.js} +2 -52
- package/lib/components/TopoView/settings/{ResourceList.module.scss → GroupNodeList/ResourceList.module.scss} +0 -0
- package/lib/components/TopoView/settings/{SelectResource → GroupNodeList/SelectResource}/index.js +0 -0
- package/lib/components/TopoView/settings/{SelectResource → GroupNodeList/SelectResource}/index.module.scss +0 -0
- package/lib/components/TopoView/settings/LayerSettingsForm.js +9 -3
- package/lib/components/TopoView/settings/Settings.js +1 -0
- package/lib/components/TopoView/toolbar/index.js +5 -1
- package/lib/core/models/TopoApp.js +137 -68
- package/lib/core/models/common/TopoClient.js +9 -1
- package/lib/icons/icons.js +3 -0
- package/lib/utils/htElementUtils.js +66 -0
- package/lib/utils/topoData.js +1 -1
- package/package.json +4 -3
|
@@ -29,6 +29,8 @@ var _buildProvider = _interopRequireDefault(require("../components/buildProvider
|
|
|
29
29
|
|
|
30
30
|
var _format = require("../../utils/format");
|
|
31
31
|
|
|
32
|
+
var _htElementUtils = require("../../utils/htElementUtils");
|
|
33
|
+
|
|
32
34
|
var _Test = _interopRequireDefault(require("../test/Test"));
|
|
33
35
|
|
|
34
36
|
var topoDebug = {};
|
|
@@ -119,7 +121,8 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
119
121
|
|
|
120
122
|
_proto.load = /*#__PURE__*/function () {
|
|
121
123
|
var _load = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(data, options) {
|
|
122
|
-
var topoDispatchers;
|
|
124
|
+
var _data$groups, groups, _data$nodes, nodes, links, lines, topoDispatchers;
|
|
125
|
+
|
|
123
126
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
124
127
|
while (1) {
|
|
125
128
|
switch (_context2.prev = _context2.next) {
|
|
@@ -128,13 +131,18 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
128
131
|
options = {};
|
|
129
132
|
}
|
|
130
133
|
|
|
134
|
+
_data$groups = data.groups, groups = _data$groups === void 0 ? [] : _data$groups, _data$nodes = data.nodes, nodes = _data$nodes === void 0 ? [] : _data$nodes, links = data.links, lines = data.lines;
|
|
131
135
|
topoDispatchers = this.store.getModelDispatchers('topoMod');
|
|
132
|
-
_context2.next =
|
|
136
|
+
_context2.next = 5;
|
|
133
137
|
return topoDispatchers.openTopoPage((0, _extends2["default"])({
|
|
134
|
-
data: data
|
|
138
|
+
data: (0, _extends2["default"])({}, data, {
|
|
139
|
+
groups: groups,
|
|
140
|
+
nodes: nodes,
|
|
141
|
+
links: links || lines || []
|
|
142
|
+
})
|
|
135
143
|
}, options));
|
|
136
144
|
|
|
137
|
-
case
|
|
145
|
+
case 5:
|
|
138
146
|
case "end":
|
|
139
147
|
return _context2.stop();
|
|
140
148
|
}
|
|
@@ -167,14 +175,78 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
167
175
|
}
|
|
168
176
|
|
|
169
177
|
return clear;
|
|
170
|
-
}()
|
|
178
|
+
}()
|
|
179
|
+
/**
|
|
180
|
+
* 全量更新数据
|
|
181
|
+
*
|
|
182
|
+
* @param data {{groups: [], nodes: [], lines: []}}
|
|
183
|
+
*/
|
|
184
|
+
;
|
|
185
|
+
|
|
186
|
+
_proto.updateData =
|
|
187
|
+
/*#__PURE__*/
|
|
188
|
+
function () {
|
|
189
|
+
var _updateData = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(data) {
|
|
190
|
+
var _data$groups2, groups, _data$nodes2, nodes, links, lines;
|
|
171
191
|
|
|
172
|
-
_proto.open = /*#__PURE__*/function () {
|
|
173
|
-
var _open = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(id, mode) {
|
|
174
|
-
var lastId;
|
|
175
192
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
176
193
|
while (1) {
|
|
177
194
|
switch (_context4.prev = _context4.next) {
|
|
195
|
+
case 0:
|
|
196
|
+
_data$groups2 = data.groups, groups = _data$groups2 === void 0 ? [] : _data$groups2, _data$nodes2 = data.nodes, nodes = _data$nodes2 === void 0 ? [] : _data$nodes2, links = data.links, lines = data.lines;
|
|
197
|
+
this.view.topoClient.updateElements({
|
|
198
|
+
groups: groups,
|
|
199
|
+
nodes: nodes,
|
|
200
|
+
links: links || lines || []
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
case 2:
|
|
204
|
+
case "end":
|
|
205
|
+
return _context4.stop();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, _callee4, this);
|
|
209
|
+
}));
|
|
210
|
+
|
|
211
|
+
function updateData(_x3) {
|
|
212
|
+
return _updateData.apply(this, arguments);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return updateData;
|
|
216
|
+
}()
|
|
217
|
+
/**
|
|
218
|
+
* 获取数据
|
|
219
|
+
* @return {{nodes: [], lines: [], customNodes: [], customLines: []}}
|
|
220
|
+
*/
|
|
221
|
+
;
|
|
222
|
+
|
|
223
|
+
_proto.getData = function getData() {
|
|
224
|
+
return {
|
|
225
|
+
nodes: this.getNodes(),
|
|
226
|
+
lines: this.getLines(),
|
|
227
|
+
customNodes: [],
|
|
228
|
+
customLines: []
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
_proto.getNodes = function getNodes() {
|
|
233
|
+
return (0, _htElementUtils.getNodes)(this.getDataModel());
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
_proto.getLines = function getLines() {
|
|
237
|
+
return this.getEdges();
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
_proto.getEdges = function getEdges() {
|
|
241
|
+
return (0, _htElementUtils.getEdges)(this.getDataModel());
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
_proto.open = /*#__PURE__*/function () {
|
|
245
|
+
var _open = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(id, mode) {
|
|
246
|
+
var lastId;
|
|
247
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
248
|
+
while (1) {
|
|
249
|
+
switch (_context5.prev = _context5.next) {
|
|
178
250
|
case 0:
|
|
179
251
|
_rlog["default"].info('TopoApp.open 打开拓扑图', id); // 如果是切换拓扑图,注销原拓扑图
|
|
180
252
|
|
|
@@ -189,13 +261,13 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
189
261
|
|
|
190
262
|
case 4:
|
|
191
263
|
case "end":
|
|
192
|
-
return
|
|
264
|
+
return _context5.stop();
|
|
193
265
|
}
|
|
194
266
|
}
|
|
195
|
-
},
|
|
267
|
+
}, _callee5, this);
|
|
196
268
|
}));
|
|
197
269
|
|
|
198
|
-
function open(
|
|
270
|
+
function open(_x4, _x5) {
|
|
199
271
|
return _open.apply(this, arguments);
|
|
200
272
|
}
|
|
201
273
|
|
|
@@ -203,19 +275,19 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
203
275
|
}();
|
|
204
276
|
|
|
205
277
|
_proto.close = /*#__PURE__*/function () {
|
|
206
|
-
var _close = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
207
|
-
return _regenerator["default"].wrap(function
|
|
278
|
+
var _close = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
279
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
208
280
|
while (1) {
|
|
209
|
-
switch (
|
|
281
|
+
switch (_context6.prev = _context6.next) {
|
|
210
282
|
case 0:
|
|
211
283
|
_rlog["default"].info('关闭拓扑图', this.id);
|
|
212
284
|
|
|
213
285
|
if (this.id) {
|
|
214
|
-
|
|
286
|
+
_context6.next = 3;
|
|
215
287
|
break;
|
|
216
288
|
}
|
|
217
289
|
|
|
218
|
-
return
|
|
290
|
+
return _context6.abrupt("return");
|
|
219
291
|
|
|
220
292
|
case 3:
|
|
221
293
|
this.alarm.close();
|
|
@@ -223,10 +295,10 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
223
295
|
|
|
224
296
|
case 5:
|
|
225
297
|
case "end":
|
|
226
|
-
return
|
|
298
|
+
return _context6.stop();
|
|
227
299
|
}
|
|
228
300
|
}
|
|
229
|
-
},
|
|
301
|
+
}, _callee6, this);
|
|
230
302
|
}));
|
|
231
303
|
|
|
232
304
|
function close() {
|
|
@@ -237,16 +309,16 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
237
309
|
}();
|
|
238
310
|
|
|
239
311
|
_proto.refresh = /*#__PURE__*/function () {
|
|
240
|
-
var _refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
241
|
-
return _regenerator["default"].wrap(function
|
|
312
|
+
var _refresh = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
313
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
242
314
|
while (1) {
|
|
243
|
-
switch (
|
|
315
|
+
switch (_context7.prev = _context7.next) {
|
|
244
316
|
case 0:
|
|
245
317
|
case "end":
|
|
246
|
-
return
|
|
318
|
+
return _context7.stop();
|
|
247
319
|
}
|
|
248
320
|
}
|
|
249
|
-
},
|
|
321
|
+
}, _callee7);
|
|
250
322
|
}));
|
|
251
323
|
|
|
252
324
|
function refresh() {
|
|
@@ -257,10 +329,7 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
257
329
|
}();
|
|
258
330
|
|
|
259
331
|
_proto.getDataModel = function getDataModel() {
|
|
260
|
-
return this.view.topoClient.
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
_proto.updateData = function updateData() {// TODO
|
|
332
|
+
return this.view.topoClient.getDataModel();
|
|
264
333
|
};
|
|
265
334
|
|
|
266
335
|
_proto.getSelectionModel = function getSelectionModel() {
|
|
@@ -281,19 +350,19 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
281
350
|
};
|
|
282
351
|
|
|
283
352
|
_proto.openViewMode = /*#__PURE__*/function () {
|
|
284
|
-
var _openViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
285
|
-
return _regenerator["default"].wrap(function
|
|
353
|
+
var _openViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(id) {
|
|
354
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
286
355
|
while (1) {
|
|
287
|
-
switch (
|
|
356
|
+
switch (_context8.prev = _context8.next) {
|
|
288
357
|
case 0:
|
|
289
358
|
case "end":
|
|
290
|
-
return
|
|
359
|
+
return _context8.stop();
|
|
291
360
|
}
|
|
292
361
|
}
|
|
293
|
-
},
|
|
362
|
+
}, _callee8);
|
|
294
363
|
}));
|
|
295
364
|
|
|
296
|
-
function openViewMode(
|
|
365
|
+
function openViewMode(_x6) {
|
|
297
366
|
return _openViewMode.apply(this, arguments);
|
|
298
367
|
}
|
|
299
368
|
|
|
@@ -307,11 +376,11 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
307
376
|
_proto.enterEditMode =
|
|
308
377
|
/*#__PURE__*/
|
|
309
378
|
function () {
|
|
310
|
-
var _enterEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
379
|
+
var _enterEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
311
380
|
var topoDispatchers, editDispatchers, ciSetDoc, linkDynamicStyleDispatcher, iconManageDispatchers, topoTreeData;
|
|
312
|
-
return _regenerator["default"].wrap(function
|
|
381
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
313
382
|
while (1) {
|
|
314
|
-
switch (
|
|
383
|
+
switch (_context9.prev = _context9.next) {
|
|
315
384
|
case 0:
|
|
316
385
|
this.view.topoClient.enterEditMode();
|
|
317
386
|
topoDispatchers = this.store.getModelDispatchers('topoMod');
|
|
@@ -342,10 +411,10 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
342
411
|
|
|
343
412
|
case 14:
|
|
344
413
|
case "end":
|
|
345
|
-
return
|
|
414
|
+
return _context9.stop();
|
|
346
415
|
}
|
|
347
416
|
}
|
|
348
|
-
},
|
|
417
|
+
}, _callee9, this);
|
|
349
418
|
}));
|
|
350
419
|
|
|
351
420
|
function enterEditMode() {
|
|
@@ -356,11 +425,11 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
356
425
|
}();
|
|
357
426
|
|
|
358
427
|
_proto.exitEditMode = /*#__PURE__*/function () {
|
|
359
|
-
var _exitEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
428
|
+
var _exitEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
360
429
|
var editDispatchers;
|
|
361
|
-
return _regenerator["default"].wrap(function
|
|
430
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
362
431
|
while (1) {
|
|
363
|
-
switch (
|
|
432
|
+
switch (_context10.prev = _context10.next) {
|
|
364
433
|
case 0:
|
|
365
434
|
this.view.topoClient.exitEditMode();
|
|
366
435
|
editDispatchers = this.store.getModelDispatchers('topoCreateMod');
|
|
@@ -372,10 +441,10 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
372
441
|
|
|
373
442
|
case 4:
|
|
374
443
|
case "end":
|
|
375
|
-
return
|
|
444
|
+
return _context10.stop();
|
|
376
445
|
}
|
|
377
446
|
}
|
|
378
|
-
},
|
|
447
|
+
}, _callee10, this);
|
|
379
448
|
}));
|
|
380
449
|
|
|
381
450
|
function exitEditMode() {
|
|
@@ -386,19 +455,19 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
386
455
|
}();
|
|
387
456
|
|
|
388
457
|
_proto.triggerSaveEvent = /*#__PURE__*/function () {
|
|
389
|
-
var _triggerSaveEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
390
|
-
return _regenerator["default"].wrap(function
|
|
458
|
+
var _triggerSaveEvent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
459
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
391
460
|
while (1) {
|
|
392
|
-
switch (
|
|
461
|
+
switch (_context11.prev = _context11.next) {
|
|
393
462
|
case 0:
|
|
394
463
|
this.view.topoClient.saveExternal();
|
|
395
464
|
|
|
396
465
|
case 1:
|
|
397
466
|
case "end":
|
|
398
|
-
return
|
|
467
|
+
return _context11.stop();
|
|
399
468
|
}
|
|
400
469
|
}
|
|
401
|
-
},
|
|
470
|
+
}, _callee11, this);
|
|
402
471
|
}));
|
|
403
472
|
|
|
404
473
|
function triggerSaveEvent() {
|
|
@@ -409,19 +478,19 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
409
478
|
}();
|
|
410
479
|
|
|
411
480
|
_proto.save = /*#__PURE__*/function () {
|
|
412
|
-
var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
413
|
-
return _regenerator["default"].wrap(function
|
|
481
|
+
var _save = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
482
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
414
483
|
while (1) {
|
|
415
|
-
switch (
|
|
484
|
+
switch (_context12.prev = _context12.next) {
|
|
416
485
|
case 0:
|
|
417
486
|
this.triggerSaveEvent();
|
|
418
487
|
|
|
419
488
|
case 1:
|
|
420
489
|
case "end":
|
|
421
|
-
return
|
|
490
|
+
return _context12.stop();
|
|
422
491
|
}
|
|
423
492
|
}
|
|
424
|
-
},
|
|
493
|
+
}, _callee12, this);
|
|
425
494
|
}));
|
|
426
495
|
|
|
427
496
|
function save() {
|
|
@@ -432,19 +501,19 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
432
501
|
}();
|
|
433
502
|
|
|
434
503
|
_proto.exportImage = /*#__PURE__*/function () {
|
|
435
|
-
var _exportImage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
436
|
-
return _regenerator["default"].wrap(function
|
|
504
|
+
var _exportImage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
505
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
437
506
|
while (1) {
|
|
438
|
-
switch (
|
|
507
|
+
switch (_context13.prev = _context13.next) {
|
|
439
508
|
case 0:
|
|
440
509
|
this.view.topoClient.exportImage();
|
|
441
510
|
|
|
442
511
|
case 1:
|
|
443
512
|
case "end":
|
|
444
|
-
return
|
|
513
|
+
return _context13.stop();
|
|
445
514
|
}
|
|
446
515
|
}
|
|
447
|
-
},
|
|
516
|
+
}, _callee13, this);
|
|
448
517
|
}));
|
|
449
518
|
|
|
450
519
|
function exportImage() {
|
|
@@ -455,16 +524,16 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
455
524
|
}();
|
|
456
525
|
|
|
457
526
|
_proto.switchToViewMode = /*#__PURE__*/function () {
|
|
458
|
-
var _switchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
459
|
-
return _regenerator["default"].wrap(function
|
|
527
|
+
var _switchToViewMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
|
|
528
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
460
529
|
while (1) {
|
|
461
|
-
switch (
|
|
530
|
+
switch (_context14.prev = _context14.next) {
|
|
462
531
|
case 0:
|
|
463
532
|
case "end":
|
|
464
|
-
return
|
|
533
|
+
return _context14.stop();
|
|
465
534
|
}
|
|
466
535
|
}
|
|
467
|
-
},
|
|
536
|
+
}, _callee14);
|
|
468
537
|
}));
|
|
469
538
|
|
|
470
539
|
function switchToViewMode() {
|
|
@@ -475,16 +544,16 @@ var TopoApp = /*#__PURE__*/function () {
|
|
|
475
544
|
}();
|
|
476
545
|
|
|
477
546
|
_proto.switchToEditMode = /*#__PURE__*/function () {
|
|
478
|
-
var _switchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
479
|
-
return _regenerator["default"].wrap(function
|
|
547
|
+
var _switchToEditMode = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() {
|
|
548
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
480
549
|
while (1) {
|
|
481
|
-
switch (
|
|
550
|
+
switch (_context15.prev = _context15.next) {
|
|
482
551
|
case 0:
|
|
483
552
|
case "end":
|
|
484
|
-
return
|
|
553
|
+
return _context15.stop();
|
|
485
554
|
}
|
|
486
555
|
}
|
|
487
|
-
},
|
|
556
|
+
}, _callee15);
|
|
488
557
|
}));
|
|
489
558
|
|
|
490
559
|
function switchToEditMode() {
|
|
@@ -53,7 +53,15 @@ var TopoClient = /*#__PURE__*/function () {
|
|
|
53
53
|
this.emitEvent('', null);
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
_proto.clear = function clear() {}
|
|
56
|
+
_proto.clear = function clear() {};
|
|
57
|
+
|
|
58
|
+
_proto.getDataModel = function getDataModel() {
|
|
59
|
+
return this.htTopoClient._mainView._graphView.getDataModel();
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
_proto.updateElements = function updateElements(elements) {
|
|
63
|
+
this.emitEvent('topo_update_elements', elements);
|
|
64
|
+
}
|
|
57
65
|
/**
|
|
58
66
|
* 搜索元素
|
|
59
67
|
*
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.getElements = getElements;
|
|
7
|
+
exports.getNodes = getNodes;
|
|
8
|
+
exports.getEdges = getEdges;
|
|
9
|
+
exports.getGroupNodes = getGroupNodes;
|
|
10
|
+
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
+
|
|
13
|
+
function getElementData(element) {
|
|
14
|
+
var className = element.getClassName();
|
|
15
|
+
var commonData = {
|
|
16
|
+
className: className,
|
|
17
|
+
id: element.getId(),
|
|
18
|
+
tag: element.getTag(),
|
|
19
|
+
// 业务id
|
|
20
|
+
name: element.getName(),
|
|
21
|
+
attrObject: element.getAttrObject(),
|
|
22
|
+
styleMap: element.getStyleMap()
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (className === 'ht.Edge') {
|
|
26
|
+
return (0, _extends2["default"])({}, commonData);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (0, _extends2["default"])({}, commonData, {
|
|
30
|
+
position: element.getPosition()
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getElements(dataModel) {
|
|
35
|
+
console.error(111, dataModel.getDatas().getArray());
|
|
36
|
+
return dataModel.getDatas().getArray();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function getNodes(dataModel) {
|
|
40
|
+
return getElements(dataModel).filter(function (element) {
|
|
41
|
+
return element.getClassName() === 'ht.Node';
|
|
42
|
+
}).map(function (element) {
|
|
43
|
+
var host = element.getHost();
|
|
44
|
+
return (0, _extends2["default"])({}, element.getAttrObject(), {
|
|
45
|
+
tag: element.getId(),
|
|
46
|
+
image: element.getImage(),
|
|
47
|
+
groupTag: host ? host.getId() : undefined
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getEdges(dataModel) {
|
|
53
|
+
return getElements(dataModel).filter(function (element) {
|
|
54
|
+
return element.getClassName() === 'ht.Edge';
|
|
55
|
+
}).map(function (element) {
|
|
56
|
+
return (0, _extends2["default"])({}, element.getAttrObject(), {
|
|
57
|
+
tag: element.getId()
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getGroupNodes(dataModel, groupIdOrTag) {
|
|
63
|
+
return getNodes(dataModel).filter(function (element) {
|
|
64
|
+
return element.groupId === groupIdOrTag || element.groupTag === groupIdOrTag;
|
|
65
|
+
});
|
|
66
|
+
}
|
package/lib/utils/topoData.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riil-frontend/component-topology",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "拓扑",
|
|
5
5
|
"files": [
|
|
6
6
|
"demo/",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"stylePath": "style.js",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "build-scripts start",
|
|
16
|
+
"start:warch": "build-scripts start --watch",
|
|
16
17
|
"build": "build-scripts build --config build.config.js",
|
|
17
18
|
"test": "build-scripts test",
|
|
18
19
|
"prepublishOnly": "npm run build",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"@riil-frontend/component-riil-rule-tree": "^1.0.4",
|
|
49
50
|
"@riil-frontend/component-table-filter-tags": "latest",
|
|
50
51
|
"@riil-frontend/component-table-layout": "^1.0.0-a.16",
|
|
51
|
-
"@riil-frontend/component-topology-graph": "^0.5.
|
|
52
|
+
"@riil-frontend/component-topology-graph": "^0.5.5",
|
|
52
53
|
"@riil-frontend/component-topology-utils": "^1.0.1",
|
|
53
54
|
"@riil-frontend/css": "^1.0.10",
|
|
54
55
|
"@riil-frontend/hooks": "latest",
|
|
@@ -87,5 +88,5 @@
|
|
|
87
88
|
"access": "public"
|
|
88
89
|
},
|
|
89
90
|
"license": "MIT",
|
|
90
|
-
"homepage": "https://unpkg.com/@riil-frontend/component-topology@0.3.
|
|
91
|
+
"homepage": "https://unpkg.com/@riil-frontend/component-topology@0.3.2/build/index.html"
|
|
91
92
|
}
|