@aloudata/ink-lineage 0.0.1-beta.40 → 0.0.1-beta.42

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 (105) hide show
  1. package/dist/assets/big/lineageIcon.d.ts +0 -1
  2. package/dist/assets/big/lineageIcon.d.ts.map +1 -1
  3. package/dist/assets/big/lineageIcon.js +0 -1
  4. package/dist/assets/big/lineageIcon.js.map +1 -1
  5. package/dist/components/Edges/DefaultEdge.d.ts +2 -2
  6. package/dist/components/Edges/DefaultEdge.d.ts.map +1 -1
  7. package/dist/components/Edges/DefaultEdge.js +2 -13
  8. package/dist/components/Edges/DefaultEdge.js.map +1 -1
  9. package/dist/components/Edges/FoldEdge.js +4 -4
  10. package/dist/components/Edges/FoldEdge.js.map +1 -1
  11. package/dist/components/Edges/LineageEdge.d.ts.map +1 -1
  12. package/dist/components/Edges/LineageEdge.js +3 -3
  13. package/dist/components/Edges/LineageEdge.js.map +1 -1
  14. package/dist/components/Nodes/AssetNode.d.ts +0 -1
  15. package/dist/components/Nodes/AssetNode.d.ts.map +1 -1
  16. package/dist/components/Nodes/AssetNode.js.map +1 -1
  17. package/dist/components/Nodes/Table/TableNode.d.ts +0 -4
  18. package/dist/components/Nodes/Table/TableNode.d.ts.map +1 -1
  19. package/dist/components/Nodes/Table/TableNode.js +1 -64
  20. package/dist/components/Nodes/Table/TableNode.js.map +1 -1
  21. package/dist/constant/nodeStyle.d.ts +0 -1
  22. package/dist/constant/nodeStyle.d.ts.map +1 -1
  23. package/dist/constant/nodeStyle.js +0 -1
  24. package/dist/constant/nodeStyle.js.map +1 -1
  25. package/dist/decorators/Table/BaseHeaderComponent.d.ts.map +1 -1
  26. package/dist/decorators/Table/BaseHeaderComponent.js +2 -16
  27. package/dist/decorators/Table/BaseHeaderComponent.js.map +1 -1
  28. package/dist/manager/FoldLineageManager.d.ts.map +1 -1
  29. package/dist/manager/FoldLineageManager.js +1 -3
  30. package/dist/manager/FoldLineageManager.js.map +1 -1
  31. package/dist/manager/LineageManager.d.ts +6 -6
  32. package/dist/manager/LineageManager.d.ts.map +1 -1
  33. package/dist/manager/LineageManager.js +47 -34
  34. package/dist/manager/LineageManager.js.map +1 -1
  35. package/dist/manager/index.d.ts +8 -8
  36. package/dist/manager/index.d.ts.map +1 -1
  37. package/dist/manager/index.js +8 -8
  38. package/dist/manager/index.js.map +1 -1
  39. package/dist/manager/nodeManager/AssetEventManager.d.ts.map +1 -1
  40. package/dist/manager/nodeManager/AssetEventManager.js +23 -63
  41. package/dist/manager/nodeManager/AssetEventManager.js.map +1 -1
  42. package/dist/manager/nodeManager/BaseEventManager.d.ts.map +1 -1
  43. package/dist/manager/nodeManager/BaseEventManager.js +3 -3
  44. package/dist/manager/nodeManager/BaseEventManager.js.map +1 -1
  45. package/dist/manager/nodeManager/ColumnEventManager.d.ts.map +1 -1
  46. package/dist/manager/nodeManager/ColumnEventManager.js +2 -7
  47. package/dist/manager/nodeManager/ColumnEventManager.js.map +1 -1
  48. package/dist/manager/nodeManager/task/TaskTableEventManager.d.ts.map +1 -1
  49. package/dist/manager/nodeManager/task/TaskTableEventManager.js +1 -1
  50. package/dist/manager/nodeManager/task/TaskTableEventManager.js.map +1 -1
  51. package/dist/types/eventEnum.d.ts +0 -4
  52. package/dist/types/eventEnum.d.ts.map +1 -1
  53. package/dist/types/eventEnum.js +0 -7
  54. package/dist/types/eventEnum.js.map +1 -1
  55. package/dist/types/manager.d.ts +0 -20
  56. package/dist/types/manager.d.ts.map +1 -1
  57. package/dist/types/manager.js +0 -14
  58. package/dist/types/manager.js.map +1 -1
  59. package/dist/types/node.d.ts +0 -2
  60. package/dist/types/node.d.ts.map +1 -1
  61. package/dist/utils/node.d.ts +0 -1
  62. package/dist/utils/node.d.ts.map +1 -1
  63. package/dist/utils/node.js +0 -9
  64. package/dist/utils/node.js.map +1 -1
  65. package/package.json +1 -1
  66. package/dist/components/Edges/ClickEdge.d.ts +0 -8
  67. package/dist/components/Edges/ClickEdge.d.ts.map +0 -1
  68. package/dist/components/Edges/ClickEdge.js +0 -46
  69. package/dist/components/Edges/ClickEdge.js.map +0 -1
  70. package/dist/manager/dataProcessor/ScheduleDataProcessor.d.ts +0 -21
  71. package/dist/manager/dataProcessor/ScheduleDataProcessor.d.ts.map +0 -1
  72. package/dist/manager/dataProcessor/ScheduleDataProcessor.js +0 -349
  73. package/dist/manager/dataProcessor/ScheduleDataProcessor.js.map +0 -1
  74. package/dist/manager/dataProcessor/TableDataProcessor.d.ts +0 -26
  75. package/dist/manager/dataProcessor/TableDataProcessor.d.ts.map +0 -1
  76. package/dist/manager/dataProcessor/TableDataProcessor.js +0 -639
  77. package/dist/manager/dataProcessor/TableDataProcessor.js.map +0 -1
  78. package/dist/manager/dataProcessor/TaskDataProcessor.d.ts +0 -82
  79. package/dist/manager/dataProcessor/TaskDataProcessor.d.ts.map +0 -1
  80. package/dist/manager/dataProcessor/TaskDataProcessor.js +0 -307
  81. package/dist/manager/dataProcessor/TaskDataProcessor.js.map +0 -1
  82. package/dist/manager/graphEventManager/BaseGraphEventManager.d.ts +0 -10
  83. package/dist/manager/graphEventManager/BaseGraphEventManager.d.ts.map +0 -1
  84. package/dist/manager/graphEventManager/BaseGraphEventManager.js +0 -81
  85. package/dist/manager/graphEventManager/BaseGraphEventManager.js.map +0 -1
  86. package/dist/manager/graphEventManager/TableGraphEventManager.d.ts +0 -6
  87. package/dist/manager/graphEventManager/TableGraphEventManager.d.ts.map +0 -1
  88. package/dist/manager/graphEventManager/TableGraphEventManager.js +0 -28
  89. package/dist/manager/graphEventManager/TableGraphEventManager.js.map +0 -1
  90. package/dist/manager/graphEventManager/TaskGraphEventManager.d.ts +0 -6
  91. package/dist/manager/graphEventManager/TaskGraphEventManager.d.ts.map +0 -1
  92. package/dist/manager/graphEventManager/TaskGraphEventManager.js +0 -22
  93. package/dist/manager/graphEventManager/TaskGraphEventManager.js.map +0 -1
  94. package/dist/manager/rightKeyMenu/BaseRightKeyMenuManager.d.ts +0 -40
  95. package/dist/manager/rightKeyMenu/BaseRightKeyMenuManager.d.ts.map +0 -1
  96. package/dist/manager/rightKeyMenu/BaseRightKeyMenuManager.js +0 -95
  97. package/dist/manager/rightKeyMenu/BaseRightKeyMenuManager.js.map +0 -1
  98. package/dist/manager/rightKeyMenu/TableRightKeyMenuManager.d.ts +0 -10
  99. package/dist/manager/rightKeyMenu/TableRightKeyMenuManager.d.ts.map +0 -1
  100. package/dist/manager/rightKeyMenu/TableRightKeyMenuManager.js +0 -29
  101. package/dist/manager/rightKeyMenu/TableRightKeyMenuManager.js.map +0 -1
  102. package/dist/manager/rightKeyMenu/TaskRightKeyMenuManager.d.ts +0 -20
  103. package/dist/manager/rightKeyMenu/TaskRightKeyMenuManager.d.ts.map +0 -1
  104. package/dist/manager/rightKeyMenu/TaskRightKeyMenuManager.js +0 -149
  105. package/dist/manager/rightKeyMenu/TaskRightKeyMenuManager.js.map +0 -1
@@ -1,639 +0,0 @@
1
- import { __assign, __extends, __read, __values } from "tslib";
2
- import { EDirection, getNodeHeight, groupNodesByEdgesAndDirection, } from '@aloudata/ink-graph-new';
3
- import { EEntityType, EDashType, } from '../../types';
4
- import _ from 'lodash';
5
- import { BaseManager } from '../BaseManager';
6
- import { CLICK_EDGE, COL_HEIGHT, CUSTOM_NODE, LINEAGE_EDGE, NODE_WIDTH, TABLE_HEADER_HEIGHT, TABLE_NODE, } from '../../constant';
7
- var TableDataProcessor = /** @class */ (function (_super) {
8
- __extends(TableDataProcessor, _super);
9
- function TableDataProcessor() {
10
- return _super !== null && _super.apply(this, arguments) || this;
11
- }
12
- TableDataProcessor.parseData = function (data, startNodes) {
13
- TableDataProcessor.startNodes = startNodes;
14
- // parse data here
15
- var entities = data.entities, relations = data.relations;
16
- var nodes = TableDataProcessor.parseEntities(entities, startNodes);
17
- var edges = TableDataProcessor.parseRelations(relations);
18
- var res = {
19
- nodes: nodes,
20
- edges: edges,
21
- };
22
- return res;
23
- };
24
- TableDataProcessor.parseEntities = function (entities, startNodes) {
25
- var _this = this;
26
- var nodesId = [];
27
- var nodes = [];
28
- entities.forEach(function (entity) {
29
- if (nodesId.includes(entity.guid))
30
- return;
31
- var isStartNode = startNodes.includes(entity.guid);
32
- var node = null;
33
- switch (entity.typeCode) {
34
- case 'Table':
35
- case 'View':
36
- node = TableDataProcessor.parseTableEntity(entity, isStartNode);
37
- break;
38
- default:
39
- node = TableDataProcessor.parseCustomEntity(entity, isStartNode);
40
- break;
41
- }
42
- if (node) {
43
- nodes.push(node);
44
- nodesId.push(node.id);
45
- _this.nodesIdMap.set(node.id, node);
46
- }
47
- });
48
- return nodes;
49
- };
50
- TableDataProcessor.parseRelations = function (relations) {
51
- var _this = this;
52
- var existedEdgesMap = new Map();
53
- var edges = [];
54
- relations.forEach(function (relation) {
55
- var _a, _b, _c, _d;
56
- var edgeId = "".concat(relation.srcGuid, "___").concat(relation.dstGuid);
57
- var isIndirect = relation.relationTypeCode.includes('Indirect');
58
- var edgeType = LINEAGE_EDGE;
59
- var srcGuid = relation.srcGuid, dstGuid = relation.dstGuid;
60
- var srcNode = _this.nodesIdMap.get(srcGuid);
61
- var tgtNode = _this.nodesIdMap.get(dstGuid);
62
- if ((((_a = srcNode === null || srcNode === void 0 ? void 0 : srcNode.data) === null || _a === void 0 ? void 0 : _a.isNarrowTable) || ((_b = tgtNode === null || tgtNode === void 0 ? void 0 : tgtNode.data) === null || _b === void 0 ? void 0 : _b.isNarrowTable)) && !isIndirect) {
63
- edgeType = CLICK_EDGE;
64
- }
65
- if (existedEdgesMap.has(edgeId)) {
66
- if (existedEdgesMap.get(edgeId) !== relation.relationTypeCode) {
67
- var edge_1 = edges.find(function (e) { return e.id === edgeId; });
68
- if (edge_1) {
69
- edge_1.relationType = EDashType.ALL;
70
- edge_1.style.strokeDasharray = [0];
71
- if (((_c = srcNode === null || srcNode === void 0 ? void 0 : srcNode.data) === null || _c === void 0 ? void 0 : _c.isNarrowTable) || ((_d = tgtNode === null || tgtNode === void 0 ? void 0 : tgtNode.data) === null || _d === void 0 ? void 0 : _d.isNarrowTable)) {
72
- edge_1.type = CLICK_EDGE;
73
- }
74
- edge_1.data = __assign({}, relation);
75
- }
76
- }
77
- return;
78
- }
79
- var edge = {
80
- id: edgeId,
81
- type: edgeType,
82
- data: __assign({}, relation),
83
- source: relation.srcGuid,
84
- target: relation.dstGuid,
85
- visible: true,
86
- isActive: false,
87
- isFolded: false,
88
- canBeFold: false,
89
- relationType: isIndirect ? EDashType.INDIRECT : EDashType.DIRECT,
90
- style: {
91
- stroke: '#B1B1B1',
92
- strokeDasharray: isIndirect ? [2] : [0],
93
- lineWidth: 1,
94
- },
95
- points: [],
96
- };
97
- edges.push(edge);
98
- existedEdgesMap.set(edge.id, edge.data.relationTypeCode);
99
- });
100
- return edges;
101
- };
102
- TableDataProcessor.parseTableEntity = function (entity, isStartNode) {
103
- var _a, _b, _c, _d, _e, _f, _g;
104
- var cols = Array.isArray((_a = entity.properties) === null || _a === void 0 ? void 0 : _a.columns)
105
- ? ((_c = (_b = entity.properties) === null || _b === void 0 ? void 0 : _b.columns) === null || _c === void 0 ? void 0 : _c.map(function (col) {
106
- var _a;
107
- return TableDataProcessor.parseColumn(col, isStartNode, entity.guid, (_a = entity.properties) === null || _a === void 0 ? void 0 : _a.name);
108
- })) || []
109
- : [];
110
- // 只有起始资产的relatedCols一开始有元素
111
- var relatedCols = Array.isArray((_d = entity.properties) === null || _d === void 0 ? void 0 : _d.columns)
112
- ? ((_f = (_e = entity.properties) === null || _e === void 0 ? void 0 : _e.columns) === null || _f === void 0 ? void 0 : _f.map(function (col) {
113
- var _a;
114
- return TableDataProcessor.parseRelatedColumn(col, isStartNode, entity.guid, (_a = entity.properties) === null || _a === void 0 ? void 0 : _a.name);
115
- })) || []
116
- : [];
117
- var data = {
118
- id: entity.guid,
119
- type: TABLE_NODE,
120
- data: __assign(__assign({}, entity.properties), { type: ((_g = entity.properties) === null || _g === void 0 ? void 0 : _g.type) || EEntityType.TABLE, guid: entity.guid, typeCode: entity.typeCode }),
121
- style: {
122
- width: NODE_WIDTH + 2,
123
- height: TABLE_HEADER_HEIGHT,
124
- headerHeight: TABLE_HEADER_HEIGHT,
125
- },
126
- position: {
127
- x: 0,
128
- y: 0,
129
- },
130
- isStartNode: isStartNode,
131
- isOpen: isStartNode,
132
- visible: true,
133
- isRelated: false,
134
- isFolded: false,
135
- isExpandOutput: false,
136
- isExpandInput: false,
137
- canExpandInput: false,
138
- canExpandOutput: false,
139
- canFoldInput: false,
140
- canFoldOutput: false,
141
- hasMoreInput: true,
142
- hasMoreOutput: true,
143
- children: cols,
144
- pagination: {
145
- pageNum: 1,
146
- pageSize: 10,
147
- total: 0,
148
- totalPage: 0,
149
- },
150
- relatedColumns: relatedCols,
151
- };
152
- data.style.height = getNodeHeight(data);
153
- return data;
154
- };
155
- TableDataProcessor.parseColumn = function (column, isStartNode, tableId, tableName) {
156
- return {
157
- data: __assign({}, column),
158
- type: '',
159
- style: {
160
- width: NODE_WIDTH + 2,
161
- height: COL_HEIGHT,
162
- headerHeight: COL_HEIGHT,
163
- },
164
- position: { x: 8, y: 0 },
165
- id: column.guid,
166
- tableId: tableId,
167
- tableName: column.tableName || tableName,
168
- visible: true,
169
- isFolded: false,
170
- isStartNode: isStartNode,
171
- isRelated: false,
172
- canExpandInput: false,
173
- canExpandOutput: false,
174
- canFoldInput: false,
175
- canFoldOutput: false,
176
- hasMoreInput: true,
177
- hasMoreOutput: true,
178
- };
179
- };
180
- TableDataProcessor.parseRelatedColumn = function (column, isStartNode, tableId, tableName) {
181
- return {
182
- data: __assign({}, column),
183
- type: '',
184
- style: {
185
- width: NODE_WIDTH + 2,
186
- height: COL_HEIGHT,
187
- headerHeight: COL_HEIGHT,
188
- },
189
- position: { x: 0, y: 0 },
190
- id: column.guid,
191
- tableId: tableId,
192
- tableName: column.tableName || tableName,
193
- visible: true,
194
- isFolded: false,
195
- isStartNode: isStartNode,
196
- isRelated: true,
197
- isRelatedColumn: true,
198
- canExpandInput: false,
199
- canExpandOutput: false,
200
- canFoldInput: false,
201
- canFoldOutput: false,
202
- hasMoreInput: true,
203
- hasMoreOutput: true,
204
- };
205
- };
206
- TableDataProcessor.parseCustomEntity = function (entity, isStartNode) {
207
- var _a, _b, _c, _d;
208
- var data = {
209
- id: entity.guid,
210
- type: CUSTOM_NODE,
211
- data: __assign(__assign({}, entity.properties), { type: ((_a = entity.properties) === null || _a === void 0 ? void 0 : _a.type) || EEntityType.TABLE, guid: entity.guid, typeCode: entity.typeCode, typeCodeName: entity.typeCodeName }),
212
- style: {
213
- width: NODE_WIDTH + 2,
214
- height: TABLE_HEADER_HEIGHT,
215
- headerHeight: TABLE_HEADER_HEIGHT,
216
- },
217
- position: {
218
- x: 0,
219
- y: 0,
220
- },
221
- isStartNode: isStartNode,
222
- isOpen: isStartNode,
223
- visible: true,
224
- isRelated: false,
225
- canExpandInput: false,
226
- canExpandOutput: false,
227
- canFoldInput: false,
228
- canFoldOutput: false,
229
- hasMoreInput: true,
230
- hasMoreOutput: true,
231
- children: Array.isArray((_b = entity.properties) === null || _b === void 0 ? void 0 : _b.columns)
232
- ? ((_d = (_c = entity.properties) === null || _c === void 0 ? void 0 : _c.columns) === null || _d === void 0 ? void 0 : _d.map(function (col) {
233
- var _a;
234
- return TableDataProcessor.parseColumn(col, isStartNode, entity.guid, (_a = entity.properties) === null || _a === void 0 ? void 0 : _a.name);
235
- })) || []
236
- : [],
237
- pagination: {
238
- pageNum: 1,
239
- pageSize: 10,
240
- total: 0,
241
- totalPage: 0,
242
- },
243
- relatedColumns: [],
244
- };
245
- data.style.height = getNodeHeight(data);
246
- return data;
247
- };
248
- // 刷新相关节点和边
249
- TableDataProcessor.prototype.refreshRelatedNodesAndEdges = function (relatedNodes, relatedEdges) {
250
- var _this = this;
251
- relatedNodes.forEach(function (n) {
252
- if (!n)
253
- return;
254
- var nodeConfig = _this.lineageManager.getNodeConfigById(n.id);
255
- if (!nodeConfig)
256
- return;
257
- nodeConfig.isRelated = true;
258
- if (nodeConfig.style.zIndex < 4) {
259
- nodeConfig.style.zIndex = 3;
260
- nodeConfig.style.stroke = '#3271C9';
261
- if (!nodeConfig.isActive) {
262
- nodeConfig.style.fill = '#E4EFFF';
263
- }
264
- else {
265
- nodeConfig.style.fill = '#A9CFFB';
266
- }
267
- }
268
- });
269
- relatedEdges.forEach(function (e) {
270
- if (!e)
271
- return;
272
- var edge = _this.lineageManager.getEdgeConfigById(e.id);
273
- if (!edge)
274
- return;
275
- if ((edge.inFoldLink &&
276
- _this.lineageManager.foldLineageManager.isFoldChecked) ||
277
- edge.isExtraFoldEdge)
278
- return;
279
- edge.style.stroke = '#3271C9';
280
- });
281
- };
282
- // 更新节点和边可见性
283
- TableDataProcessor.prototype.updateNodesAndEdgesVisible = function (data, edgeDashVisible, onlyShowRelated, isFoldChecked) {
284
- this.updateEdgesVisible(data, edgeDashVisible, onlyShowRelated, isFoldChecked);
285
- // 更新节点本身、列、节点children的可见性
286
- this.updateNodesVisible(data, edgeDashVisible, onlyShowRelated, isFoldChecked);
287
- };
288
- // 获取边可见性
289
- TableDataProcessor.prototype.getEdgeVisible = function (edgeCfg, edgeDashVisible, onlyShowRelated, isFoldChecked, relatedNodes) {
290
- var _a, _b, _c;
291
- // 如果边被折叠了,那么该边就隐藏
292
- if (edgeCfg.isFolded)
293
- return false;
294
- var visible = false;
295
- // 折叠
296
- if (isFoldChecked) {
297
- var foldStatus = (_c = (_b = (_a = this.lineageManager) === null || _a === void 0 ? void 0 : _a.foldLineageManager) === null || _b === void 0 ? void 0 : _b.foldStatusMap) === null || _c === void 0 ? void 0 : _c.get(edgeCfg.foldTableId);
298
- if (foldStatus) {
299
- visible = !!edgeCfg.isExtraFoldEdge;
300
- if (!visible) {
301
- return visible;
302
- }
303
- }
304
- }
305
- // 仅相关
306
- if (onlyShowRelated) {
307
- var source = edgeCfg.source, target = edgeCfg.target;
308
- if (relatedNodes[source] && relatedNodes[target]) {
309
- visible = true;
310
- }
311
- else {
312
- return false;
313
- }
314
- }
315
- switch (edgeDashVisible) {
316
- case EDashType.DIRECT:
317
- visible =
318
- edgeCfg.relationType === EDashType.DIRECT ||
319
- edgeCfg.relationType === EDashType.ALL;
320
- break;
321
- case EDashType.INDIRECT:
322
- visible = true;
323
- break;
324
- }
325
- return visible;
326
- };
327
- // 获取相关节点可见性
328
- TableDataProcessor.prototype.getRelatedNodeVisible = function (nodeConfig, data, edgeDashVisible) {
329
- var _a, _b, _c, _d, _e, _f;
330
- // 仅相关开启的情况下,如果高亮链路是表链路,隐藏非相关的列
331
- if ((_b = (_a = this.lineageManager) === null || _a === void 0 ? void 0 : _a.rightKeyMenuManager) === null || _b === void 0 ? void 0 : _b.onlyShowRelated) {
332
- if (!((_e = (_d = (_c = this.lineageManager) === null || _c === void 0 ? void 0 : _c.activeNodes) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.tableName)) {
333
- if (!_.some((_f = this.lineageManager) === null || _f === void 0 ? void 0 : _f.relatedNodes, { id: nodeConfig.id }))
334
- return false;
335
- }
336
- }
337
- var cacheBit = this.nodeEdgeRelationCache.get(nodeConfig.id);
338
- if (!cacheBit)
339
- return false;
340
- var isAllIndirectEdges = cacheBit < 0;
341
- // 开关只有true false,直接、间接
342
- if (edgeDashVisible === EDashType.INDIRECT) {
343
- return true;
344
- }
345
- else {
346
- // 如果边都是间接边,那么该节点就隐藏
347
- if (isAllIndirectEdges)
348
- return false;
349
- return true;
350
- }
351
- };
352
- // 获取节点可见性
353
- TableDataProcessor.prototype.getNodeVisible = function (nodeConfig, data, edgeDashVisible, onlyShowRelated, isFoldChecked) {
354
- if (nodeConfig.isStartNode)
355
- return true;
356
- if (nodeConfig.isFolded)
357
- return false;
358
- // 只显示相关节点 & 该节点不是相关节点 & 该节点不是表,则该节点不可见
359
- if (onlyShowRelated && !nodeConfig.isRelated && !nodeConfig.tableId)
360
- return false;
361
- if (nodeConfig.canBeFold && isFoldChecked)
362
- return false;
363
- var cacheBit = this.nodeEdgeRelationCache.get(nodeConfig.id);
364
- if (!cacheBit)
365
- return false;
366
- var isAllIndirectEdges = cacheBit < 0;
367
- // 开关只有true false,直接、间接
368
- if (edgeDashVisible === EDashType.INDIRECT) {
369
- return true;
370
- }
371
- else {
372
- // 如果边都是间接边,那么该节点就隐藏
373
- if (isAllIndirectEdges)
374
- return false;
375
- return true;
376
- }
377
- };
378
- // 更新边可见性
379
- TableDataProcessor.prototype.updateEdgesVisible = function (data, edgeDashVisible, onlyShowRelated, isFoldChecked) {
380
- var _this = this;
381
- if (_.isNil(data))
382
- return;
383
- var relatedNodes = {};
384
- data.nodes.forEach(function (node) {
385
- var _a;
386
- if (node.isRelated) {
387
- relatedNodes[node.id] = node;
388
- (_a = node.relatedColumns) === null || _a === void 0 ? void 0 : _a.forEach(function (col) {
389
- if (col.visible) {
390
- relatedNodes[col.id] = col;
391
- }
392
- });
393
- }
394
- });
395
- data.edges.forEach(function (edge) {
396
- edge.visible = _this.getEdgeVisible(edge, edgeDashVisible, onlyShowRelated, isFoldChecked, relatedNodes);
397
- });
398
- };
399
- // 构建节点/列可见性缓存。根据关联的边类型和当前配置决定是否可见
400
- TableDataProcessor.prototype.buildVisibilityCache = function (data, isFoldChecked) {
401
- var nodeIdToNodeMap = new Map();
402
- var columnIdToTableIdMap = new Map();
403
- data.nodes.forEach(function (node) {
404
- var _a, _b;
405
- (_a = node.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
406
- columnIdToTableIdMap.set(child.id, child.tableId);
407
- });
408
- (_b = node.relatedColumns) === null || _b === void 0 ? void 0 : _b.forEach(function (col) {
409
- columnIdToTableIdMap.set(col.id, col.tableId);
410
- });
411
- nodeIdToNodeMap.set(node.id, node);
412
- });
413
- this.nodeEdgeRelationCache = new Map();
414
- var cache = this.nodeEdgeRelationCache;
415
- var updateBit = function (id, isIndirect) {
416
- if (!id)
417
- return;
418
- var bit = cache.get(id);
419
- if (!bit) {
420
- cache.set(id, isIndirect ? -1 : 1);
421
- }
422
- if (bit < 0 && !isIndirect) {
423
- cache.set(id, 1);
424
- }
425
- };
426
- data.edges.forEach(function (edge) {
427
- var srcNode = nodeIdToNodeMap.get(edge.source);
428
- var tgtNode = nodeIdToNodeMap.get(edge.target);
429
- if (!edge.visible)
430
- return;
431
- // 合并链路,折叠的边忽略
432
- if (((srcNode === null || srcNode === void 0 ? void 0 : srcNode.canBeFold) || (tgtNode === null || tgtNode === void 0 ? void 0 : tgtNode.canBeFold)) && isFoldChecked) {
433
- return;
434
- }
435
- var isIndirect = edge.relationType === EDashType.INDIRECT;
436
- updateBit(edge.source, isIndirect);
437
- updateBit(edge.target, isIndirect);
438
- // 更新列对应的表(如果是列
439
- updateBit(columnIdToTableIdMap.get(edge.source), isIndirect);
440
- updateBit(columnIdToTableIdMap.get(edge.target), isIndirect);
441
- });
442
- };
443
- // 更新节点的可见性
444
- TableDataProcessor.prototype.updateNodesVisible = function (data, edgeDashVisible, onlyShowRelated, isFoldChecked) {
445
- var _this = this;
446
- if (_.isNil(data))
447
- return;
448
- this.buildVisibilityCache(data, isFoldChecked);
449
- data.nodes.forEach(function (node) {
450
- var _a, _b;
451
- node.visible = _this.getNodeVisible(node, data, edgeDashVisible, onlyShowRelated, isFoldChecked);
452
- (_a = node.relatedColumns) === null || _a === void 0 ? void 0 : _a.forEach(function (col) {
453
- col.visible = _this.getRelatedNodeVisible(col, data, edgeDashVisible);
454
- });
455
- (_b = node.children) === null || _b === void 0 ? void 0 : _b.forEach(function (child) {
456
- child.visible = _this.getNodeVisible(child, data, edgeDashVisible, onlyShowRelated, isFoldChecked);
457
- });
458
- });
459
- };
460
- // 更新icon的可见性
461
- TableDataProcessor.prototype.updateSideIconVisible = function (data) {
462
- var e_1, _a;
463
- var _this = this;
464
- if (_.isNil(data))
465
- return;
466
- var nodesConfig = data.nodes.filter(function (cfg) { return cfg.visible; });
467
- var edgesConfig = data.edges.filter(function (cfg) { return cfg.visible; });
468
- if (!nodesConfig.length)
469
- return;
470
- var startNodeIndex = nodesConfig.findIndex(function (node) { return node.isStartNode; });
471
- if (startNodeIndex < 0)
472
- return;
473
- var startNodeCfg = nodesConfig[startNodeIndex];
474
- if (!startNodeCfg)
475
- return;
476
- var nodesConfigMap = new Map();
477
- nodesConfig.forEach(function (n) {
478
- var _a;
479
- nodesConfigMap.set(n.id, n);
480
- (_a = n.children) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
481
- nodesConfigMap.set(child.id, child);
482
- });
483
- });
484
- var inputGroupedData = groupNodesByEdgesAndDirection(startNodeCfg, nodesConfigMap, edgesConfig, EDirection.INPUT);
485
- var outputGroupedData = groupNodesByEdgesAndDirection(startNodeCfg, nodesConfigMap, edgesConfig, EDirection.OUTPUT);
486
- if (!inputGroupedData && !outputGroupedData)
487
- return;
488
- var inputGroupNodes = inputGroupedData.groupedNodes;
489
- var outputGroupNodes = outputGroupedData.groupedNodes;
490
- // 优化Map合并:直接使用inputGroupNodes作为基础,避免重复has()调用
491
- var groupedNodes = new Map(inputGroupNodes || []);
492
- if (outputGroupNodes) {
493
- try {
494
- for (var outputGroupNodes_1 = __values(outputGroupNodes), outputGroupNodes_1_1 = outputGroupNodes_1.next(); !outputGroupNodes_1_1.done; outputGroupNodes_1_1 = outputGroupNodes_1.next()) {
495
- var _b = __read(outputGroupNodes_1_1.value, 2), key = _b[0], value = _b[1];
496
- if (!groupedNodes.has(key)) {
497
- groupedNodes.set(key, value);
498
- }
499
- }
500
- }
501
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
502
- finally {
503
- try {
504
- if (outputGroupNodes_1_1 && !outputGroupNodes_1_1.done && (_a = outputGroupNodes_1.return)) _a.call(outputGroupNodes_1);
505
- }
506
- finally { if (e_1) throw e_1.error; }
507
- }
508
- }
509
- var dstNodeIdsSet = new Set();
510
- var srcNodeIdsSet = new Set();
511
- edgesConfig.forEach(function (item) {
512
- var _a, _b, _c, _d, _e, _f;
513
- var target = item.target, source = item.source;
514
- var dstNode = _this.lineageManager.getNodeConfigById(target);
515
- var srcNode = _this.lineageManager.getNodeConfigById(source);
516
- // 列
517
- if ((srcNode === null || srcNode === void 0 ? void 0 : srcNode.tableId) || (dstNode === null || dstNode === void 0 ? void 0 : dstNode.tableId)) {
518
- var parentSrcNode = _this.lineageManager.getNodeConfigById(srcNode === null || srcNode === void 0 ? void 0 : srcNode.tableId);
519
- var parentDstNode = _this.lineageManager.getNodeConfigById(dstNode === null || dstNode === void 0 ? void 0 : dstNode.tableId);
520
- // 列所在父节点正常
521
- if (((_a = parentSrcNode === null || parentSrcNode === void 0 ? void 0 : parentSrcNode.position) === null || _a === void 0 ? void 0 : _a.x) < ((_b = parentDstNode === null || parentDstNode === void 0 ? void 0 : parentDstNode.position) === null || _b === void 0 ? void 0 : _b.x)) {
522
- srcNodeIdsSet.add(source);
523
- dstNodeIdsSet.add(target);
524
- }
525
- else {
526
- if ((srcNode === null || srcNode === void 0 ? void 0 : srcNode.tableId) && source === ((_c = _this.lineageManager.activeNodes[0]) === null || _c === void 0 ? void 0 : _c.id)) {
527
- srcNodeIdsSet.add(source);
528
- }
529
- if ((dstNode === null || dstNode === void 0 ? void 0 : dstNode.tableId) && target === ((_d = _this.lineageManager.activeNodes[0]) === null || _d === void 0 ? void 0 : _d.id)) {
530
- dstNodeIdsSet.add(target);
531
- }
532
- }
533
- }
534
- else if (srcNode && dstNode && srcNode.position.x < dstNode.position.x) {
535
- srcNodeIdsSet.add(source);
536
- dstNodeIdsSet.add(target);
537
- }
538
- else {
539
- if (source === ((_e = _this.lineageManager.activeNodes[0]) === null || _e === void 0 ? void 0 : _e.id)) {
540
- srcNodeIdsSet.add(source);
541
- }
542
- if (target === ((_f = _this.lineageManager.activeNodes[0]) === null || _f === void 0 ? void 0 : _f.id)) {
543
- dstNodeIdsSet.add(target);
544
- }
545
- }
546
- });
547
- // 优化节点处理逻辑
548
- nodesConfig.forEach(function (n) {
549
- // 重置状态
550
- n.canExpandInput = false;
551
- n.canExpandOutput = false;
552
- n.canFoldInput = false;
553
- n.canFoldOutput = false;
554
- var currNodeLevel = groupedNodes.get(n.id);
555
- if (_.isNil(currNodeLevel)) {
556
- console.warn("get node level error '".concat(n.id, "'"));
557
- return;
558
- }
559
- // 优化:使用Set的has()方法进行O(1)查找
560
- var isInputLeaf = false;
561
- var isOutputLeaf = false;
562
- if (currNodeLevel === 0) {
563
- isInputLeaf = !dstNodeIdsSet.has(n.id);
564
- isOutputLeaf = !srcNodeIdsSet.has(n.id);
565
- }
566
- else if (currNodeLevel < 0) {
567
- isInputLeaf = !dstNodeIdsSet.has(n.id);
568
- }
569
- else {
570
- isOutputLeaf = !srcNodeIdsSet.has(n.id);
571
- }
572
- // input node exist & left of start node
573
- if (currNodeLevel <= 0 && !isInputLeaf) {
574
- n.canFoldInput = true;
575
- }
576
- // input node not exist & left of start node
577
- if (currNodeLevel <= 0 && isInputLeaf && n.hasMoreInput) {
578
- n.canExpandInput = true;
579
- }
580
- // output node exist & right of start node
581
- if (currNodeLevel >= 0 && !isOutputLeaf) {
582
- n.canFoldOutput = true;
583
- }
584
- // output node not exist & right of start node
585
- if (currNodeLevel >= 0 && isOutputLeaf && n.hasMoreOutput) {
586
- n.canExpandOutput = true;
587
- }
588
- // column: always true if isStartNode === true
589
- var columnRefreshList = n.isStartNode
590
- ? (n.children || []).concat(n.relatedColumns || [])
591
- : n.relatedColumns || [];
592
- // 处理列的展开/折叠状态
593
- columnRefreshList.forEach(function (col) {
594
- // 重置列状态
595
- col.canExpandInput = false;
596
- col.canExpandOutput = false;
597
- col.canFoldInput = false;
598
- col.canFoldOutput = false;
599
- if (!col.isStartNode && !col.isRelatedColumn)
600
- return;
601
- // 优化:使用Set进行O(1)查找
602
- var isInputLeaf_col = false;
603
- var isOutputLeaf_col = false;
604
- if (currNodeLevel === 0) {
605
- isInputLeaf_col = !dstNodeIdsSet.has(col.id);
606
- isOutputLeaf_col = !srcNodeIdsSet.has(col.id);
607
- }
608
- else if (currNodeLevel < 0) {
609
- isInputLeaf_col = !dstNodeIdsSet.has(col.id);
610
- }
611
- else {
612
- isOutputLeaf_col = !srcNodeIdsSet.has(col.id);
613
- }
614
- // input node exist & left of start node
615
- if (currNodeLevel <= 0 && !isInputLeaf_col) {
616
- col.canFoldInput = true;
617
- }
618
- // input node not exist & left of start node
619
- if (currNodeLevel <= 0 && isInputLeaf_col && col.hasMoreInput) {
620
- col.canExpandInput = true;
621
- }
622
- // output node exist & right of start node
623
- if (currNodeLevel >= 0 && !isOutputLeaf_col) {
624
- col.canFoldOutput = true;
625
- }
626
- // output node not exist & right of start node
627
- if (currNodeLevel >= 0 && isOutputLeaf_col && col.hasMoreOutput) {
628
- col.canExpandOutput = true;
629
- }
630
- });
631
- });
632
- };
633
- TableDataProcessor.startNodes = [];
634
- // 放在这里,是因为parseData相当于一个工具方法,可以在lineageManager没有初始化的时候,就调用
635
- TableDataProcessor.nodesIdMap = new Map();
636
- return TableDataProcessor;
637
- }(BaseManager));
638
- export { TableDataProcessor };
639
- //# sourceMappingURL=TableDataProcessor.js.map