ronds-metadata 1.3.89 → 1.3.91
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/README.md +25 -25
- package/es/api/index.d.ts +11 -1
- package/es/api/index.js +202 -47
- package/es/comps/Chart/bar/index.d.ts +8 -0
- package/es/comps/Chart/bar/index.js +136 -0
- package/es/comps/Chart/constants.d.ts +7 -0
- package/es/comps/Chart/constants.js +8 -0
- package/es/comps/Chart/index.d.ts +9 -0
- package/es/comps/Chart/index.js +31 -0
- package/es/comps/Chart/line/index.d.ts +8 -0
- package/es/comps/Chart/line/index.js +163 -0
- package/es/comps/Chart/pie/index.d.ts +8 -0
- package/es/comps/Chart/pie/index.js +67 -0
- package/es/comps/Chart/type.d.ts +19 -0
- package/es/comps/Chart/type.js +1 -0
- package/es/comps/Chart/utils.d.ts +1 -0
- package/es/comps/Chart/utils.js +19 -0
- package/es/comps/CodeEdit/index.d.ts +5 -2
- package/es/comps/CodeEdit/index.js +42 -91
- package/es/comps/CodeEdit/index.less +6 -6
- package/es/comps/CodeEdit/utils.d.ts +2 -0
- package/es/comps/CodeEdit/utils.js +173 -0
- package/es/comps/CodeEditor/config.d.ts +27 -0
- package/es/comps/CodeEditor/config.js +64 -0
- package/es/comps/CodeEditor/index.d.ts +42 -0
- package/es/comps/CodeEditor/index.js +320 -0
- package/es/comps/CodeEditor/index.less +3 -0
- package/es/comps/CodeEditor/suggestions/constants/cassandra.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/cassandra.js +6 -0
- package/es/comps/CodeEditor/suggestions/constants/clickhouse.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/clickhouse.js +6 -0
- package/es/comps/CodeEditor/suggestions/constants/dm.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/dm.js +6 -0
- package/es/comps/CodeEditor/suggestions/constants/index.d.ts +33 -0
- package/es/comps/CodeEditor/suggestions/constants/index.js +19 -0
- package/es/comps/CodeEditor/suggestions/constants/pgsql.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/pgsql.js +6 -0
- package/es/comps/CodeEditor/suggestions/constants/redis.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/redis.js +6 -0
- package/es/comps/CodeEditor/suggestions/constants/sqlserver.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/constants/sqlserver.js +6 -0
- package/es/comps/CodeEditor/suggestions/register/database.d.ts +8 -0
- package/es/comps/CodeEditor/suggestions/register/database.js +61 -0
- package/es/comps/CodeEditor/suggestions/register/field.d.ts +10 -0
- package/es/comps/CodeEditor/suggestions/register/field.js +144 -0
- package/es/comps/CodeEditor/suggestions/register/index.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/register/index.js +7 -0
- package/es/comps/CodeEditor/suggestions/register/keyword.d.ts +6 -0
- package/es/comps/CodeEditor/suggestions/register/keyword.js +79 -0
- package/es/comps/CodeEditor/suggestions/register/prompt.d.ts +5 -0
- package/es/comps/CodeEditor/suggestions/register/prompt.js +40 -0
- package/es/comps/CodeEditor/suggestions/register/schema.d.ts +7 -0
- package/es/comps/CodeEditor/suggestions/register/schema.js +85 -0
- package/es/comps/CodeEditor/suggestions/register/table.d.ts +14 -0
- package/es/comps/CodeEditor/suggestions/register/table.js +173 -0
- package/es/comps/CodeEditor/utils.d.ts +13 -0
- package/es/comps/CodeEditor/utils.js +69 -0
- package/es/comps/DataMine/Line.js +0 -1
- package/es/comps/DraggableDiv/index.d.ts +9 -0
- package/es/comps/DraggableDiv/index.js +139 -0
- package/es/comps/DraggableDiv/index.less +45 -0
- package/es/comps/DynamicPorts/comps/ContextMenu.less +8 -8
- package/es/comps/DynamicPorts/comps/DragNode.js +1 -1
- package/es/comps/DynamicPorts/comps/GraphHandler/index.less +39 -39
- package/es/comps/DynamicPorts/comps/NodeElementAlgo.d.ts +6 -0
- package/es/comps/DynamicPorts/comps/NodeElementAlgo.js +76 -0
- package/es/comps/DynamicPorts/comps/NodeElementConfig.d.ts +6 -0
- package/es/comps/DynamicPorts/comps/NodeElementConfig.js +73 -0
- package/es/comps/DynamicPorts/comps/NodeElementRead.d.ts +6 -0
- package/es/comps/DynamicPorts/comps/NodeElementRead.js +76 -0
- package/es/comps/DynamicPorts/comps/contextMenu/EdgeContextMenu/index.less +5 -5
- package/es/comps/DynamicPorts/comps/contextMenu/GraphContextMenu/index.less +40 -40
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.js +1 -1
- package/es/comps/DynamicPorts/comps/contextMenu/NodeContextMenu/index.less +42 -42
- package/es/comps/DynamicPorts/comps/shape/connector.js +12 -2
- package/es/comps/DynamicPorts/comps/shape/edge.d.ts +2 -0
- package/es/comps/DynamicPorts/comps/shape/edge.js +30 -3
- package/es/comps/DynamicPorts/comps/shape/edge.less +8 -8
- package/es/comps/DynamicPorts/comps/shape/node.d.ts +15 -0
- package/es/comps/DynamicPorts/comps/shape/node.js +293 -5
- package/es/comps/DynamicPorts/constant/index.d.ts +2 -0
- package/es/comps/DynamicPorts/constant/index.js +3 -1
- package/es/comps/DynamicPorts/graph.d.ts +2 -2
- package/es/comps/DynamicPorts/graph.js +63 -38
- package/es/comps/DynamicPorts/index.d.ts +1 -1
- package/es/comps/DynamicPorts/index.js +1 -1
- package/es/comps/DynamicPorts/index.less +304 -3
- package/es/comps/DynamicPorts/interface.d.ts +7 -0
- package/es/comps/DynamicPorts/interface.js +1 -1
- package/es/comps/DynamicPorts/utils.d.ts +4 -0
- package/es/comps/DynamicPorts/utils.js +13 -2
- package/es/comps/Editable/DataCell/ButtonCell.js +28 -2
- package/es/comps/Editable/comps/EditableAction.d.ts +1 -0
- package/es/comps/Editable/comps/EditableAction.js +2 -1
- package/es/comps/Editable/comps/EditableRow.js +3 -2
- package/es/comps/Editable/comps/Texty.js +1 -2
- package/es/comps/Editable/comps/Texty.less +43 -43
- package/es/comps/Editable/comps/index.less +38 -38
- package/es/comps/Editable/index.d.ts +19 -0
- package/es/comps/Editable/index.js +15 -6
- package/es/comps/Editable/index.less +97 -97
- package/es/comps/Editable/interface.d.ts +1 -0
- package/es/comps/FileView/index.js +2 -2
- package/es/comps/FormGenerator/comps/Canvas/Preview.js +2 -1
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/CassandraDs.d.ts +3 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/CassandraDs.js +258 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/KafkaDs.d.ts +3 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/KafkaDs.js +203 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/MinioDs.d.ts +3 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/MinioDs.js +203 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/PostgreSqlDs.d.ts +3 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/PostgreSqlDs.js +313 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/RedisDs.d.ts +3 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/Cell/datasource/RedisDs.js +203 -0
- package/es/comps/FormGenerator/comps/Canvas/core/RenderField/index.js +11 -1
- package/es/comps/FormGenerator/comps/Canvas/core/index.less +53 -0
- package/es/comps/FormGenerator/comps/Canvas/index.js +1 -1
- package/es/comps/FormGenerator/comps/Sidebar/index.js +3 -2
- package/es/comps/FormGenerator/comps/Sidebar/index.less +21 -21
- package/es/comps/FormGenerator/index.less +20 -20
- package/es/comps/FormGenerator/settings/index.d.ts +131 -8
- package/es/comps/FormGenerator/settings/index.js +41 -1
- package/es/comps/FormGenerator/settings/ruleConfig.d.ts +49 -0
- package/es/comps/FormGenerator/settings/ruleConfig.js +49 -0
- package/es/comps/FormGenerator/transformer.js +33 -7
- package/es/comps/JsonEdit/index.js +0 -1
- package/es/comps/JsonEdit/index.less +64 -64
- package/es/comps/JsonView/index.less +41 -41
- package/es/comps/MdEdit/index.less +6 -6
- package/es/comps/MdEditPro/index.less +166 -166
- package/es/comps/MdNavbar/index.less +1 -1
- package/es/comps/MdView/index.less +3 -3
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +5 -5
- package/es/comps/MetadataEdit/constant/index.js +0 -2
- package/es/comps/MetadataEdit/index.js +3 -3
- package/es/comps/MetadataEdit/index.less +10 -10
- package/es/comps/MetadataEdit/type.d.ts +20 -20
- package/es/comps/MetadataForm/DataCell/Array.js +14 -2
- package/es/comps/MetadataForm/DataCell/Input.js +65 -8
- package/es/comps/MetadataForm/DataCell/Ref.js +6 -6
- package/es/comps/MetadataForm/DataCell/Select.js +72 -31
- package/es/comps/MetadataForm/DataCell/business/config.d.ts +32 -36
- package/es/comps/MetadataForm/DataCell/business/config.js +74 -67
- package/es/comps/MetadataForm/DataCell/business/index.js +44 -1
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +7 -7
- package/es/comps/MetadataForm/DataCell/plugin/ButtonSelect.d.ts +12 -0
- package/es/comps/MetadataForm/DataCell/plugin/ButtonSelect.js +68 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +9 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +163 -90
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/DataLake.d.ts +20 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/DataLake.js +255 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/DatasourceType.d.ts +17 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/DatasourceType.js +133 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/ExtraAttr.d.ts +10 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/ExtraAttr.js +65 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.d.ts +11 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.js +146 -60
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Minio.d.ts +18 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Minio.js +92 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.d.ts +13 -3
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.js +206 -124
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Redis.d.ts +18 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Redis.js +92 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.d.ts +10 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.js +207 -122
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.d.ts +2 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.js +39 -16
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.js +359 -164
- package/es/comps/MetadataForm/DataCell/plugin/MappingTable.d.ts +12 -0
- package/es/comps/MetadataForm/DataCell/plugin/MappingTable.js +289 -0
- package/es/comps/MetadataForm/DataCell/plugin/RefreshSelect.js +17 -15
- package/es/comps/MetadataForm/DataCell/plugin/RunFrequency.d.ts +7 -0
- package/es/comps/MetadataForm/DataCell/plugin/RunFrequency.js +395 -0
- package/es/comps/MetadataForm/DataCell/plugin/RunStopSetting.d.ts +7 -0
- package/es/comps/MetadataForm/DataCell/plugin/RunStopSetting.js +238 -0
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.d.ts +4 -1
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +94 -78
- package/es/comps/MetadataForm/HOC/index.js +4 -4
- package/es/comps/MetadataForm/HOC/index.less +17 -6
- package/es/comps/MetadataForm/constants.d.ts +4 -0
- package/es/comps/MetadataForm/constants.js +6 -2
- package/es/comps/MetadataForm/hooks/index.js +5 -5
- package/es/comps/MetadataForm/index.d.ts +12 -0
- package/es/comps/MetadataForm/index.js +59 -3
- package/es/comps/MetadataForm/index.less +32 -29
- package/es/comps/MetadataForm/interface.d.ts +6 -0
- package/es/comps/MetadataForm/interface.js +2 -1
- package/es/comps/MetadataForm/utils.d.ts +2 -0
- package/es/comps/MetadataForm/utils.js +45 -9
- package/es/comps/Split/index.less +29 -29
- package/es/comps/VideoPlayer/index.d.ts +3 -0
- package/es/comps/VideoPlayer/index.js +14 -0
- package/es/comps/VideoPlayer/index.less +9 -0
- package/es/framework/canvas/EventBus.d.ts +21 -0
- package/es/framework/canvas/EventBus.js +66 -0
- package/es/framework/canvas/ImageLoadPool.d.ts +24 -0
- package/es/framework/canvas/ImageLoadPool.js +197 -0
- package/es/framework/canvas/index.d.ts +409 -0
- package/es/framework/canvas/index.js +2639 -0
- package/es/framework/canvas/shape/Circle.d.ts +7 -0
- package/es/framework/canvas/shape/Circle.js +35 -0
- package/es/framework/canvas/shape/Dot.d.ts +7 -0
- package/es/framework/canvas/shape/Dot.js +30 -0
- package/es/framework/canvas/shape/Grid.d.ts +12 -0
- package/es/framework/canvas/shape/Grid.js +82 -0
- package/es/framework/canvas/shape/Line.d.ts +6 -0
- package/es/framework/canvas/shape/Line.js +29 -0
- package/es/framework/canvas/shape/Polygon.d.ts +6 -0
- package/es/framework/canvas/shape/Polygon.js +24 -0
- package/es/framework/canvas/shape/Rect.d.ts +6 -0
- package/es/framework/canvas/shape/Rect.js +37 -0
- package/es/framework/canvas/shape/Shape.d.ts +42 -0
- package/es/framework/canvas/shape/Shape.js +49 -0
- package/es/framework/canvas/type.d.ts +17 -0
- package/es/framework/canvas/type.js +1 -0
- package/es/framework/graph/index.js +4 -4
- package/es/framework/graph/index.less +15 -15
- package/es/framework/http/index.js +8 -8
- package/es/framework/http/msgpack5/lib/helpers.js +0 -1
- package/es/framework/jsonQl/index.js +22 -22
- package/es/framework/libs/iconfont/iconfont.css +171 -3
- package/es/framework/libs/iconfont/iconfont.json +294 -0
- package/es/framework/libs/iconfont/iconfont.ttf +0 -0
- package/es/framework/libs/iconfont/iconfont.woff +0 -0
- package/es/framework/libs/iconfont/iconfont.woff2 +0 -0
- package/es/framework/libs/jquery.min.js +5 -5
- package/es/framework/metadata/MetadataService.d.ts +7 -0
- package/es/framework/metadata/MetadataService.js +124 -29
- package/es/framework/metadata/types.d.ts +14 -1
- package/es/framework/proto/index.d.ts +18 -0
- package/es/framework/proto/index.js +85 -1
- package/es/framework/rxjs-hooks/useMemoReplaySubject.d.ts +3 -0
- package/es/framework/rxjs-hooks/useMemoReplaySubject.js +49 -0
- package/es/framework/wave/index.d.ts +217 -0
- package/es/framework/wave/index.js +1448 -0
- package/es/framework/wave/type.d.ts +143 -0
- package/es/framework/wave/type.js +1 -0
- package/es/index.d.ts +10 -1
- package/es/index.js +13 -2
- package/es/theme.less +2 -0
- package/es/utils.js +1 -1
- package/package.json +122 -117
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.d.ts +0 -8
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +0 -297
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
/*
|
|
5
|
+
* @Author: wangxian
|
|
6
|
+
* @Date: 2024-11-11 16:36:17
|
|
7
|
+
* @LastEditTime: 2024-11-13 15:17:02
|
|
8
|
+
*/
|
|
9
|
+
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
|
10
|
+
import { tr } from '../../../../framework/locale';
|
|
11
|
+
import { compatibleDataBaseName } from '../../utils';
|
|
12
|
+
import { addSuggestField } from './field';
|
|
13
|
+
import { MetadataService } from '../../../../framework/metadata/MetadataService';
|
|
14
|
+
var tableList = {};
|
|
15
|
+
/** 当前库下的表 */
|
|
16
|
+
var suggestTable = monaco.languages.registerCompletionItemProvider('sql', {
|
|
17
|
+
provideCompletionItems: function provideCompletionItems() {
|
|
18
|
+
return {
|
|
19
|
+
suggestions: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
export var resetSuggestTable = function resetSuggestTable() {
|
|
24
|
+
suggestTable.dispose();
|
|
25
|
+
};
|
|
26
|
+
var addSuggestTable = /*#__PURE__*/function () {
|
|
27
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
|
|
28
|
+
var schemaName, namespace, server, data;
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
30
|
+
while (1) switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
schemaName = props.schemaName, namespace = props.namespace;
|
|
33
|
+
if (tableList[schemaName]) {
|
|
34
|
+
_context.next = 7;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
server = new MetadataService();
|
|
38
|
+
_context.next = 5;
|
|
39
|
+
return server.getAllTableFromSchema({
|
|
40
|
+
schemaName: schemaName,
|
|
41
|
+
namespace: namespace
|
|
42
|
+
});
|
|
43
|
+
case 5:
|
|
44
|
+
data = _context.sent;
|
|
45
|
+
tableList[schemaName] = data;
|
|
46
|
+
case 7:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}, _callee);
|
|
51
|
+
}));
|
|
52
|
+
return function addSuggestTable(_x) {
|
|
53
|
+
return _ref.apply(this, arguments);
|
|
54
|
+
};
|
|
55
|
+
}();
|
|
56
|
+
var getSubdirName = /*#__PURE__*/function () {
|
|
57
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(namespace) {
|
|
58
|
+
var server, list;
|
|
59
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
60
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
server = new MetadataService();
|
|
63
|
+
_context2.next = 3;
|
|
64
|
+
return server.getSubdirFromNs(namespace);
|
|
65
|
+
case 3:
|
|
66
|
+
list = _context2.sent;
|
|
67
|
+
return _context2.abrupt("return", list);
|
|
68
|
+
case 5:
|
|
69
|
+
case "end":
|
|
70
|
+
return _context2.stop();
|
|
71
|
+
}
|
|
72
|
+
}, _callee2);
|
|
73
|
+
}));
|
|
74
|
+
return function getSubdirName(_x2) {
|
|
75
|
+
return _ref2.apply(this, arguments);
|
|
76
|
+
};
|
|
77
|
+
}();
|
|
78
|
+
var checkTableContext = function checkTableContext(text) {
|
|
79
|
+
var normalizedText = text.trim().toUpperCase();
|
|
80
|
+
var tableKeywords = ['FROM', 'JOIN', 'INNER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'UPDATE'];
|
|
81
|
+
for (var _i = 0, _tableKeywords = tableKeywords; _i < _tableKeywords.length; _i++) {
|
|
82
|
+
var keyword = _tableKeywords[_i];
|
|
83
|
+
if (normalizedText.endsWith(keyword)) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
var handleInsertText = function handleInsertText(keyword, tableName, databaseCode) {
|
|
90
|
+
if (/^[\"\`\[]/.test(keyword)) {
|
|
91
|
+
return tableName;
|
|
92
|
+
}
|
|
93
|
+
return compatibleDataBaseName(tableName, databaseCode);
|
|
94
|
+
};
|
|
95
|
+
var registerSuggestTable = function registerSuggestTable(_tableList, databaseCode, namespace) {
|
|
96
|
+
monaco.editor.registerCommand('addFieldList', function (_) {
|
|
97
|
+
var _ref3 = arguments.length <= 1 ? undefined : arguments[1],
|
|
98
|
+
tableName = _ref3.tableName,
|
|
99
|
+
namespace = _ref3.namespace;
|
|
100
|
+
var tableNames = _tableList.map(function (it) {
|
|
101
|
+
return it.name;
|
|
102
|
+
});
|
|
103
|
+
// 过滤非public模式的表名调用
|
|
104
|
+
getSubdirName(namespace).then(function (schemas) {
|
|
105
|
+
if (schemas.includes('public') && tableNames.includes(tableName)) {
|
|
106
|
+
var props = {
|
|
107
|
+
tableName: tableName,
|
|
108
|
+
namespace: "".concat(namespace, ":public")
|
|
109
|
+
};
|
|
110
|
+
addSuggestField(props);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
tableList['public'] = _tableList;
|
|
115
|
+
resetSuggestTable();
|
|
116
|
+
suggestTable = monaco.languages.registerCompletionItemProvider('sql', {
|
|
117
|
+
triggerCharacters: ['.'],
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
provideCompletionItems: function provideCompletionItems(model, position) {
|
|
120
|
+
var lineContentUntilPosition = model.getValueInRange({
|
|
121
|
+
startLineNumber: position.lineNumber,
|
|
122
|
+
startColumn: 1,
|
|
123
|
+
endLineNumber: position.lineNumber,
|
|
124
|
+
endColumn: position.column
|
|
125
|
+
});
|
|
126
|
+
var isTableContext = checkTableContext(lineContentUntilPosition);
|
|
127
|
+
// 获取触发提示的字符
|
|
128
|
+
var match = lineContentUntilPosition.match(/\S+$/);
|
|
129
|
+
var word;
|
|
130
|
+
if (match) {
|
|
131
|
+
word = match[0];
|
|
132
|
+
}
|
|
133
|
+
if (!word) {
|
|
134
|
+
return {}; // 如果没有匹配到,直接返回
|
|
135
|
+
}
|
|
136
|
+
if (word && !tableList[word]) {
|
|
137
|
+
addSuggestTable({
|
|
138
|
+
schemaName: word,
|
|
139
|
+
namespace: namespace
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
var suggestions = Object.keys(tableList).reduce(function (acc, cur) {
|
|
143
|
+
var arr = tableList[cur].map(function (it) {
|
|
144
|
+
return {
|
|
145
|
+
label: {
|
|
146
|
+
label: it.name,
|
|
147
|
+
detail: (it === null || it === void 0 ? void 0 : it.belong) ? "(".concat(it === null || it === void 0 ? void 0 : it.belong, ")") : null,
|
|
148
|
+
description: tr('表名')
|
|
149
|
+
},
|
|
150
|
+
kind: monaco.languages.CompletionItemKind.Folder,
|
|
151
|
+
insertText: handleInsertText(word, it.name, databaseCode),
|
|
152
|
+
// range: monaco.Range.fromPositions(position),
|
|
153
|
+
// documentation: tableName?.comment,
|
|
154
|
+
sortText: isTableContext ? '01' : '08',
|
|
155
|
+
command: {
|
|
156
|
+
id: 'addFieldList',
|
|
157
|
+
title: 'addFieldList',
|
|
158
|
+
arguments: [{
|
|
159
|
+
tableName: it.name,
|
|
160
|
+
namespace: namespace
|
|
161
|
+
}]
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
return [].concat(_toConsumableArray(acc), _toConsumableArray(arr));
|
|
166
|
+
}, []);
|
|
167
|
+
return {
|
|
168
|
+
suggestions: suggestions
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
export { suggestTable, registerSuggestTable, addSuggestTable };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DatabaseTypeCode } from './config';
|
|
2
|
+
/**
|
|
3
|
+
* 格式化sql
|
|
4
|
+
*/
|
|
5
|
+
export declare function formatSql(sql: string, dbType: any): Promise<string>;
|
|
6
|
+
/**
|
|
7
|
+
* 兼容处理数据库名称
|
|
8
|
+
* @param databaseName
|
|
9
|
+
* @param databaseType
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function compatibleDataBaseName(databaseName: string, databaseType: DatabaseTypeCode): string;
|
|
13
|
+
export declare const removeDefaultActions: () => void;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { format } from 'sql-formatter';
|
|
3
|
+
import * as actions from 'monaco-editor/esm/vs/platform/actions/common/actions';
|
|
4
|
+
import { DatabaseTypeCode, removableIds } from './config';
|
|
5
|
+
/**
|
|
6
|
+
* 格式化sql
|
|
7
|
+
*/
|
|
8
|
+
export function formatSql(sql, dbType) {
|
|
9
|
+
var arr = ['bigquery', 'db2', 'hive', 'mariadb', 'mysql', 'n1ql', 'plsql', 'postgresql', 'redshift', 'spark', 'sqlite', 'sql', 'trino', 'transactsql', 'singlestoredb', 'snowflake'];
|
|
10
|
+
var language = arr.includes(dbType.toLowerCase()) ? dbType.toLowerCase() : 'sql';
|
|
11
|
+
return new Promise(function (r) {
|
|
12
|
+
var formatRes = '';
|
|
13
|
+
try {
|
|
14
|
+
formatRes = format(sql || '', {
|
|
15
|
+
language: language
|
|
16
|
+
});
|
|
17
|
+
} catch (e) {
|
|
18
|
+
r(formatRes);
|
|
19
|
+
}
|
|
20
|
+
// 如果格式化失败,直接返回原始sql
|
|
21
|
+
r(formatRes);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 兼容处理数据库名称
|
|
26
|
+
* @param databaseName
|
|
27
|
+
* @param databaseType
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export function compatibleDataBaseName(databaseName, databaseType) {
|
|
31
|
+
//"" oracele sqlite postgrsql h2 dm
|
|
32
|
+
// ` MYSQL clickhouse MariaDB
|
|
33
|
+
// [ sqlserver
|
|
34
|
+
if ([DatabaseTypeCode.ORACLE, DatabaseTypeCode.SQLITE, DatabaseTypeCode.POSTGRESQL, DatabaseTypeCode.H2, DatabaseTypeCode.DB2, DatabaseTypeCode.KINGBASE, DatabaseTypeCode.DM].includes(databaseType)) {
|
|
35
|
+
return "\"".concat(databaseName, "\"");
|
|
36
|
+
} else if ([DatabaseTypeCode.SQLSERVER].includes(databaseType)) {
|
|
37
|
+
return "[".concat(databaseName, "]");
|
|
38
|
+
} else if ([DatabaseTypeCode.MYSQL, DatabaseTypeCode.CLICKHOUSE, DatabaseTypeCode.TIMEPLUS, DatabaseTypeCode.MARIADB].includes(databaseType)) {
|
|
39
|
+
return "`".concat(databaseName, "`");
|
|
40
|
+
} else {
|
|
41
|
+
return "".concat(databaseName);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export var removeDefaultActions = function removeDefaultActions() {
|
|
45
|
+
//获取 Monaco Editor 的菜单项注册表
|
|
46
|
+
var menus = actions.MenuRegistry._menuItems;
|
|
47
|
+
//查找编辑器上下文菜单的注册条目
|
|
48
|
+
var contextMenuEntry = _toConsumableArray(menus).find(function (entry) {
|
|
49
|
+
return entry[0]._debugName == 'EditorContext' || entry[0].id == 'EditorContext';
|
|
50
|
+
});
|
|
51
|
+
// 从上下文菜单的注册条目中提取菜单项
|
|
52
|
+
var contextMenuLinks = contextMenuEntry[1];
|
|
53
|
+
// 移除菜单项的函数
|
|
54
|
+
var removeById = function removeById(list, ids) {
|
|
55
|
+
var node = list._first;
|
|
56
|
+
//// 检查当前菜单项是否应该移除
|
|
57
|
+
do {
|
|
58
|
+
var _node$element, _node$element$command, _node$element2;
|
|
59
|
+
// 注意 node.element?.command?.id || node.element?.title 的用法
|
|
60
|
+
var shouldRemove = ids.includes(((_node$element = node.element) === null || _node$element === void 0 ? void 0 : (_node$element$command = _node$element.command) === null || _node$element$command === void 0 ? void 0 : _node$element$command.id) || ((_node$element2 = node.element) === null || _node$element2 === void 0 ? void 0 : _node$element2.title));
|
|
61
|
+
// 如果应该移除,则从链表中移除当前节点
|
|
62
|
+
if (shouldRemove) {
|
|
63
|
+
list._remove(node);
|
|
64
|
+
}
|
|
65
|
+
} while (node = node.next);
|
|
66
|
+
};
|
|
67
|
+
// 通过调用 removeById 函数移除特定的菜单项
|
|
68
|
+
removeById(contextMenuLinks, removableIds);
|
|
69
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'react-grid-layout/css/styles.css';
|
|
3
|
+
import 'react-resizable/css/styles.css';
|
|
4
|
+
import './index.less';
|
|
5
|
+
interface IDraggableDivProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const DraggableDiv: (props: IDraggableDivProps) => JSX.Element;
|
|
9
|
+
export default DraggableDiv;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
|
|
4
|
+
import { Responsive, WidthProvider } from 'react-grid-layout';
|
|
5
|
+
import 'react-grid-layout/css/styles.css';
|
|
6
|
+
import 'react-resizable/css/styles.css';
|
|
7
|
+
import './index.less';
|
|
8
|
+
var ResponsiveGridLayout = WidthProvider(Responsive);
|
|
9
|
+
var DraggableDiv = function DraggableDiv(props) {
|
|
10
|
+
var children = props.children;
|
|
11
|
+
var _useState = useState(false),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
showGrid = _useState2[0],
|
|
14
|
+
setShowGrid = _useState2[1];
|
|
15
|
+
var _useState3 = useState({}),
|
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
+
backgroundStyle = _useState4[0],
|
|
18
|
+
setBackgroundStyle = _useState4[1];
|
|
19
|
+
var gridLayoutRef = useRef(null);
|
|
20
|
+
var backgroundRef = useRef(null);
|
|
21
|
+
var parentContainerRef = useRef(null);
|
|
22
|
+
var layout = useMemo(function () {
|
|
23
|
+
return [{
|
|
24
|
+
i: '1',
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
w: 2,
|
|
28
|
+
h: 2
|
|
29
|
+
}, {
|
|
30
|
+
i: '2',
|
|
31
|
+
x: 2,
|
|
32
|
+
y: 0,
|
|
33
|
+
w: 2,
|
|
34
|
+
h: 2
|
|
35
|
+
}];
|
|
36
|
+
}, []);
|
|
37
|
+
var handleDragStart = function handleDragStart() {
|
|
38
|
+
return setShowGrid(true);
|
|
39
|
+
};
|
|
40
|
+
var handleDragStop = function handleDragStop() {
|
|
41
|
+
updateBackgroundSize();
|
|
42
|
+
setShowGrid(false);
|
|
43
|
+
};
|
|
44
|
+
var handleResizeStart = function handleResizeStart() {
|
|
45
|
+
return setShowGrid(true);
|
|
46
|
+
};
|
|
47
|
+
var handleResizeStop = function handleResizeStop() {
|
|
48
|
+
updateBackgroundSize();
|
|
49
|
+
setShowGrid(false);
|
|
50
|
+
};
|
|
51
|
+
// 更新背景网格尺寸的函数
|
|
52
|
+
var updateBackgroundSize = useCallback(function () {
|
|
53
|
+
if (gridLayoutRef.current && backgroundRef.current && parentContainerRef.current) {
|
|
54
|
+
var actualGridContainer = gridLayoutRef.current.querySelector('.react-grid-layout');
|
|
55
|
+
var parentContainer = parentContainerRef.current;
|
|
56
|
+
if (actualGridContainer && parentContainer) {
|
|
57
|
+
var gridRect = actualGridContainer.getBoundingClientRect();
|
|
58
|
+
var parentRect = parentContainer.getBoundingClientRect();
|
|
59
|
+
// 计算内部网格容器的实际宽度和高度
|
|
60
|
+
var gridWidth = Math.ceil(gridRect.width);
|
|
61
|
+
var gridHeight = Math.ceil(gridRect.height);
|
|
62
|
+
// 获取父容器的宽度和高度(包含滚动条的可视区域)
|
|
63
|
+
var parentWidth = parentRect.width;
|
|
64
|
+
var parentHeight = parentRect.height;
|
|
65
|
+
// 仅在内容溢出时扩大背景网格
|
|
66
|
+
var finalWidth = '100%';
|
|
67
|
+
var finalHeight = '100%';
|
|
68
|
+
// 如果网格内容宽度 > 父容器宽度,使用内容宽度
|
|
69
|
+
if (gridWidth > parentWidth) {
|
|
70
|
+
finalWidth = "".concat(gridWidth, "px");
|
|
71
|
+
}
|
|
72
|
+
// 如果网格内容高度 > 父容器高度,使用内容高度
|
|
73
|
+
if (gridHeight > parentHeight) {
|
|
74
|
+
finalHeight = "".concat(gridHeight, "px");
|
|
75
|
+
}
|
|
76
|
+
setBackgroundStyle({
|
|
77
|
+
width: finalWidth,
|
|
78
|
+
height: finalHeight
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, []);
|
|
83
|
+
useEffect(function () {
|
|
84
|
+
updateBackgroundSize();
|
|
85
|
+
// 添加 resize 监听器,当窗口大小变化时重新计算
|
|
86
|
+
var handleResize = function handleResize() {
|
|
87
|
+
updateBackgroundSize();
|
|
88
|
+
};
|
|
89
|
+
window.addEventListener('resize', handleResize);
|
|
90
|
+
return function () {
|
|
91
|
+
return window.removeEventListener('resize', handleResize);
|
|
92
|
+
};
|
|
93
|
+
}, [updateBackgroundSize]);
|
|
94
|
+
return (
|
|
95
|
+
/*#__PURE__*/
|
|
96
|
+
// 为父容器添加 ref
|
|
97
|
+
React.createElement("div", {
|
|
98
|
+
ref: parentContainerRef,
|
|
99
|
+
className: "parent"
|
|
100
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
101
|
+
ref: gridLayoutRef
|
|
102
|
+
}, /*#__PURE__*/React.createElement(ResponsiveGridLayout, {
|
|
103
|
+
className: "layout",
|
|
104
|
+
layouts: {
|
|
105
|
+
lg: layout
|
|
106
|
+
},
|
|
107
|
+
cols: {
|
|
108
|
+
lg: 24,
|
|
109
|
+
md: 12
|
|
110
|
+
},
|
|
111
|
+
rowHeight: 40
|
|
112
|
+
// width={1200}
|
|
113
|
+
,
|
|
114
|
+
isResizable: true,
|
|
115
|
+
isDraggable: true,
|
|
116
|
+
onDragStart: handleDragStart,
|
|
117
|
+
onDragStop: handleDragStop,
|
|
118
|
+
onResizeStart: handleResizeStart,
|
|
119
|
+
onResizeStop: handleResizeStop,
|
|
120
|
+
compactType: "vertical",
|
|
121
|
+
preventCollision: false,
|
|
122
|
+
containerPadding: [0, 0],
|
|
123
|
+
style: {
|
|
124
|
+
minHeight: '100%',
|
|
125
|
+
minWidth: '100%'
|
|
126
|
+
}
|
|
127
|
+
}, React.Children.map(children, function (child, index) {
|
|
128
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
129
|
+
key: "".concat(index),
|
|
130
|
+
className: "grid-item"
|
|
131
|
+
}, child);
|
|
132
|
+
}))), showGrid && /*#__PURE__*/React.createElement("div", {
|
|
133
|
+
ref: backgroundRef,
|
|
134
|
+
className: "grid-background",
|
|
135
|
+
style: _objectSpread({}, backgroundStyle)
|
|
136
|
+
}))
|
|
137
|
+
);
|
|
138
|
+
};
|
|
139
|
+
export default DraggableDiv;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.parent {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: 600px;
|
|
4
|
+
margin: 20px auto;
|
|
5
|
+
border: 2px solid #ddd;
|
|
6
|
+
border-radius: 8px;
|
|
7
|
+
position: relative;
|
|
8
|
+
overflow: auto; // 父容器有滚动条
|
|
9
|
+
|
|
10
|
+
// 背景网格线(1px 线,20px 间距)
|
|
11
|
+
background: linear-gradient(to right, #f9f9f9 99%, #e0e0e0 99%) 0 0 / 20px 1px, linear-gradient(to bottom, #f9f9f9 99%, #e0e0e0 99%) 0 0 / 1px 20px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.grid-item {
|
|
15
|
+
background-color: rgba(255, 255, 255, 0.95);
|
|
16
|
+
border: 1px solid #ccc;
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
padding: 10px;
|
|
19
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
cursor: move;
|
|
26
|
+
user-select: none;
|
|
27
|
+
outline: 1px dashed rgba(0, 0, 0, 0.05);
|
|
28
|
+
outline-offset: -1;
|
|
29
|
+
z-index: 2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.grid-background {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
pointer-events: none; // 不阻止鼠标事件穿透
|
|
37
|
+
z-index: 1;
|
|
38
|
+
|
|
39
|
+
width: 100%;
|
|
40
|
+
height: 100%;
|
|
41
|
+
|
|
42
|
+
background-image: linear-gradient(to right, #e0e0e0 1px, transparent 1px), linear-gradient(to bottom, #e0e0e0 1px, transparent 1px);
|
|
43
|
+
background-size: 20px 20px;
|
|
44
|
+
background-position: 0 0;
|
|
45
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
.mask {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 0;
|
|
4
|
-
bottom: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
z-index: 99999;
|
|
8
|
-
}
|
|
1
|
+
.mask {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 0;
|
|
4
|
+
bottom: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
z-index: 99999;
|
|
8
|
+
}
|
|
@@ -17,7 +17,7 @@ var InnerNodeTitle = function InnerNodeTitle(props) {
|
|
|
17
17
|
var data = props.data,
|
|
18
18
|
connectDragPreview = props.connectDragPreview,
|
|
19
19
|
connectDragSource = props.connectDragSource;
|
|
20
|
-
return /*#__PURE__*/React.createElement("div", null, connectDragPreview(connectDragSource(
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", null, connectDragPreview(connectDragSource(/*#__PURE__*/React.createElement("div", {
|
|
21
21
|
className: "node-element",
|
|
22
22
|
style: {
|
|
23
23
|
width: '100%'
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
.handler {
|
|
2
|
-
position: absolute;
|
|
3
|
-
top: 61px;
|
|
4
|
-
right: 14px;
|
|
5
|
-
z-index: 99;
|
|
6
|
-
width: 32px;
|
|
7
|
-
margin: 0;
|
|
8
|
-
padding: 3px 0;
|
|
9
|
-
color: rgba(0, 0, 0, 0.45);
|
|
10
|
-
font-size: 16px;
|
|
11
|
-
list-style-type: none;
|
|
12
|
-
background-color: #fff;
|
|
13
|
-
border: 1px solid rgba(0, 0, 0, 0.04);
|
|
14
|
-
border-radius: 3px;
|
|
15
|
-
box-shadow: 0 0 20px rgba(0, 0, 0, 0.01);
|
|
16
|
-
|
|
17
|
-
.item {
|
|
18
|
-
text-align: center;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
|
|
21
|
-
&:hover {
|
|
22
|
-
color: #000;
|
|
23
|
-
background-color: #e0e0e0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.tools-selected {
|
|
28
|
-
color: #000;
|
|
29
|
-
background-color: #e0e0e0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.popover {
|
|
34
|
-
:global {
|
|
35
|
-
.ant-popover-inner-content {
|
|
36
|
-
padding: 3px 8px;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
1
|
+
.handler {
|
|
2
|
+
position: absolute;
|
|
3
|
+
top: 61px;
|
|
4
|
+
right: 14px;
|
|
5
|
+
z-index: 99;
|
|
6
|
+
width: 32px;
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 3px 0;
|
|
9
|
+
color: rgba(0, 0, 0, 0.45);
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
list-style-type: none;
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
border: 1px solid rgba(0, 0, 0, 0.04);
|
|
14
|
+
border-radius: 3px;
|
|
15
|
+
box-shadow: 0 0 20px rgba(0, 0, 0, 0.01);
|
|
16
|
+
|
|
17
|
+
.item {
|
|
18
|
+
text-align: center;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
color: #000;
|
|
23
|
+
background-color: #e0e0e0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tools-selected {
|
|
28
|
+
color: #000;
|
|
29
|
+
background-color: #e0e0e0;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.popover {
|
|
34
|
+
:global {
|
|
35
|
+
.ant-popover-inner-content {
|
|
36
|
+
padding: 3px 8px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
/*
|
|
4
|
+
* @Author: wangxian
|
|
5
|
+
* @Date: 2022-05-24 08:50:16
|
|
6
|
+
* @LastEditTime: 2025-07-02 09:11:56
|
|
7
|
+
*/
|
|
8
|
+
import { GlobalOutlined } from '@ant-design/icons';
|
|
9
|
+
import { filter } from 'rxjs/operators';
|
|
10
|
+
import '../index.less';
|
|
11
|
+
import Icon from '../../Icons';
|
|
12
|
+
import { NodeStatus } from './NodeStatus';
|
|
13
|
+
import { gDPGraph } from '../graph';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { tr } from '../../../framework/locale';
|
|
16
|
+
import Texty from '../../../comps/Editable/comps/Texty';
|
|
17
|
+
var NodeElementAlgo = function NodeElementAlgo(props) {
|
|
18
|
+
var node = props.node;
|
|
19
|
+
var data = (node === null || node === void 0 ? void 0 : node.getData()) || {};
|
|
20
|
+
var id = data.id,
|
|
21
|
+
name = data.name,
|
|
22
|
+
icon = data.icon,
|
|
23
|
+
param = data.param;
|
|
24
|
+
var _React$useState = React.useState({}),
|
|
25
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
26
|
+
nodeStatus = _React$useState2[0],
|
|
27
|
+
setNodeStatus = _React$useState2[1];
|
|
28
|
+
React.useEffect(function () {
|
|
29
|
+
var sub = gDPGraph && gDPGraph.factory$.executionStatus.pipe(filter(function (x) {
|
|
30
|
+
return !!x;
|
|
31
|
+
})).subscribe(function (v) {
|
|
32
|
+
var _status = v.statusList.find(function (it) {
|
|
33
|
+
return (it === null || it === void 0 ? void 0 : it.nodeId) === id;
|
|
34
|
+
});
|
|
35
|
+
setNodeStatus(_objectSpread(_objectSpread({}, _status), {}, {
|
|
36
|
+
debugId: v.debugId
|
|
37
|
+
}));
|
|
38
|
+
});
|
|
39
|
+
return function () {
|
|
40
|
+
sub.unsubscribe();
|
|
41
|
+
};
|
|
42
|
+
}, [gDPGraph]);
|
|
43
|
+
var onStatusClick = function onStatusClick(e) {
|
|
44
|
+
e.stopPropagation();
|
|
45
|
+
gDPGraph.factory$.statusClick.next(_objectSpread(_objectSpread({}, data), {}, {
|
|
46
|
+
status: _objectSpread({
|
|
47
|
+
nodeId: id
|
|
48
|
+
}, nodeStatus)
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
className: "node-element-algo"
|
|
53
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: "icon",
|
|
55
|
+
style: {
|
|
56
|
+
cursor: 'pointer'
|
|
57
|
+
}
|
|
58
|
+
}, icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
59
|
+
type: icon,
|
|
60
|
+
style: {
|
|
61
|
+
fontSize: '18px'
|
|
62
|
+
}
|
|
63
|
+
}) : /*#__PURE__*/React.createElement(GlobalOutlined, null)), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "notation"
|
|
65
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "name",
|
|
67
|
+
title: tr(name)
|
|
68
|
+
}, tr(name)), (param === null || param === void 0 ? void 0 : param.remark) && /*#__PURE__*/React.createElement("div", {
|
|
69
|
+
className: "remark"
|
|
70
|
+
}, /*#__PURE__*/React.createElement(Texty, null, param === null || param === void 0 ? void 0 : param.remark))), nodeStatus && (nodeStatus === null || nodeStatus === void 0 ? void 0 : nodeStatus.nodeStatus) && /*#__PURE__*/React.createElement(NodeStatus, {
|
|
71
|
+
onClick: onStatusClick,
|
|
72
|
+
className: "statusIcon",
|
|
73
|
+
status: nodeStatus.nodeStatus
|
|
74
|
+
}))));
|
|
75
|
+
};
|
|
76
|
+
export default NodeElementAlgo;
|