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,163 @@
|
|
|
1
|
+
import "antd/es/empty/style";
|
|
2
|
+
import _Empty from "antd/es/empty";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
|
+
import { Line } from '@antv/g2plot';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { transXYData } from '../utils';
|
|
9
|
+
import { tr } from '../../../framework/locale';
|
|
10
|
+
var LineChart = function LineChart(props) {
|
|
11
|
+
var data = props.data,
|
|
12
|
+
theme = props.theme,
|
|
13
|
+
config = props.config;
|
|
14
|
+
var _React$useState = React.useState(false),
|
|
15
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
16
|
+
isError = _React$useState2[0],
|
|
17
|
+
setIsError = _React$useState2[1];
|
|
18
|
+
var containerRef = React.useRef();
|
|
19
|
+
var chartRef = React.useRef();
|
|
20
|
+
var renderChart = React.useCallback(function () {
|
|
21
|
+
var _config$xFieldLabel, _config$yFieldLabel;
|
|
22
|
+
var _data = transXYData(data);
|
|
23
|
+
var _ylist = _data.map(function (item) {
|
|
24
|
+
return item.y;
|
|
25
|
+
});
|
|
26
|
+
var min = Math.min.apply(Math, _toConsumableArray(_ylist));
|
|
27
|
+
var max = Math.max.apply(Math, _toConsumableArray(_ylist));
|
|
28
|
+
chartRef.current = new Line(containerRef.current, _objectSpread(_objectSpread({}, config), {}, {
|
|
29
|
+
autoFit: true,
|
|
30
|
+
theme: theme,
|
|
31
|
+
data: [],
|
|
32
|
+
padding: 'auto',
|
|
33
|
+
color: (config === null || config === void 0 ? void 0 : config.group) ? undefined : config === null || config === void 0 ? void 0 : config.color,
|
|
34
|
+
legend: config === null || config === void 0 ? void 0 : config.legend,
|
|
35
|
+
xField: 'x',
|
|
36
|
+
yField: 'y',
|
|
37
|
+
seriesField: 'name',
|
|
38
|
+
meta: {
|
|
39
|
+
x: {
|
|
40
|
+
type: (config === null || config === void 0 ? void 0 : config.isTimeAxis) ? 'time' : 'linear',
|
|
41
|
+
mask: (config === null || config === void 0 ? void 0 : config.isTimeAxis) ? 'YYYY-MM-DD HH:mm:ss' : undefined
|
|
42
|
+
},
|
|
43
|
+
y: {
|
|
44
|
+
type: 'linear'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
xAxis: {
|
|
48
|
+
title: (config === null || config === void 0 ? void 0 : config.xFieldName) && {
|
|
49
|
+
text: (_config$xFieldLabel = config === null || config === void 0 ? void 0 : config.xFieldLabel) !== null && _config$xFieldLabel !== void 0 ? _config$xFieldLabel : config === null || config === void 0 ? void 0 : config.xFieldName,
|
|
50
|
+
position: 'center'
|
|
51
|
+
},
|
|
52
|
+
type: (config === null || config === void 0 ? void 0 : config.isTimeAxis) ? 'time' : 'linear'
|
|
53
|
+
},
|
|
54
|
+
yAxis: {
|
|
55
|
+
nice: true,
|
|
56
|
+
min: min,
|
|
57
|
+
max: max,
|
|
58
|
+
title: (config === null || config === void 0 ? void 0 : config.yFieldName) && {
|
|
59
|
+
text: (_config$yFieldLabel = config === null || config === void 0 ? void 0 : config.yFieldLabel) !== null && _config$yFieldLabel !== void 0 ? _config$yFieldLabel : config === null || config === void 0 ? void 0 : config.yFieldName,
|
|
60
|
+
position: 'center'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
lineStyle: {
|
|
64
|
+
lineWidth: 1
|
|
65
|
+
},
|
|
66
|
+
interactions: [{
|
|
67
|
+
type: 'brush-x',
|
|
68
|
+
cfg: {
|
|
69
|
+
dim: 'x'
|
|
70
|
+
}
|
|
71
|
+
}, {
|
|
72
|
+
type: 'element-active'
|
|
73
|
+
}],
|
|
74
|
+
annotations: (config === null || config === void 0 ? void 0 : config.targetValue) && [{
|
|
75
|
+
type: 'line',
|
|
76
|
+
start: ['min', config === null || config === void 0 ? void 0 : config.targetValue],
|
|
77
|
+
end: ['max', config === null || config === void 0 ? void 0 : config.targetValue],
|
|
78
|
+
style: {
|
|
79
|
+
stroke: '#ff4d4f',
|
|
80
|
+
lineWidth: 2,
|
|
81
|
+
lineDash: [4, 4]
|
|
82
|
+
},
|
|
83
|
+
text: {
|
|
84
|
+
content: "\u76EE\u6807\u503C: ".concat(config === null || config === void 0 ? void 0 : config.targetValue),
|
|
85
|
+
position: 'end',
|
|
86
|
+
offsetX: -77,
|
|
87
|
+
style: {
|
|
88
|
+
fill: '#ff4d4f',
|
|
89
|
+
fontSize: 12
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}],
|
|
93
|
+
label: (config === null || config === void 0 ? void 0 : config.isShowValue) && {
|
|
94
|
+
layout: [{
|
|
95
|
+
type: 'hide-overlap'
|
|
96
|
+
}],
|
|
97
|
+
style: {
|
|
98
|
+
fill: '#666',
|
|
99
|
+
fontSize: 12,
|
|
100
|
+
textAlign: 'center',
|
|
101
|
+
textBaseline: 'bottom'
|
|
102
|
+
},
|
|
103
|
+
formatter: function formatter(item) {
|
|
104
|
+
return item.y;
|
|
105
|
+
},
|
|
106
|
+
position: 'top'
|
|
107
|
+
},
|
|
108
|
+
point: (config === null || config === void 0 ? void 0 : config.isShowValue) && {
|
|
109
|
+
size: 2,
|
|
110
|
+
shape: 'circle',
|
|
111
|
+
style: {
|
|
112
|
+
fill: '#1890ff',
|
|
113
|
+
stroke: '#1890ff',
|
|
114
|
+
lineWidth: 2
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
chartRef.current.on('brushselected', function (ev) {
|
|
119
|
+
var selectedData = ev.selected;
|
|
120
|
+
|
|
121
|
+
// 在这里处理选中的数据范围
|
|
122
|
+
});
|
|
123
|
+
chartRef.current.render();
|
|
124
|
+
}, [data, config]);
|
|
125
|
+
React.useEffect(function () {
|
|
126
|
+
if (containerRef.current) {
|
|
127
|
+
renderChart();
|
|
128
|
+
}
|
|
129
|
+
return function () {
|
|
130
|
+
if (chartRef.current) {
|
|
131
|
+
chartRef.current.destroy();
|
|
132
|
+
chartRef.current = undefined;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}, [data, config]);
|
|
136
|
+
React.useEffect(function () {
|
|
137
|
+
try {
|
|
138
|
+
var _data = transXYData(data);
|
|
139
|
+
// 如果时间轴数据按照时间顺序进行排序
|
|
140
|
+
var _value = (config === null || config === void 0 ? void 0 : config.isTimeAxis) ? _data.map(function (item) {
|
|
141
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
142
|
+
x: new Date(item === null || item === void 0 ? void 0 : item.x).getTime()
|
|
143
|
+
});
|
|
144
|
+
}).sort(function (a, b) {
|
|
145
|
+
return (a === null || a === void 0 ? void 0 : a.x) - (b === null || b === void 0 ? void 0 : b.x);
|
|
146
|
+
}) : _data;
|
|
147
|
+
chartRef.current.changeData(_value);
|
|
148
|
+
setIsError(false);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
setIsError(true);
|
|
151
|
+
}
|
|
152
|
+
}, [data]);
|
|
153
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isError ? /*#__PURE__*/React.createElement(_Empty, {
|
|
154
|
+
description: tr('参数有误')
|
|
155
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
156
|
+
ref: containerRef,
|
|
157
|
+
style: {
|
|
158
|
+
width: '100%',
|
|
159
|
+
height: '100%'
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
};
|
|
163
|
+
export default LineChart;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
/*
|
|
3
|
+
* @Author: wangxian
|
|
4
|
+
* @Date: 2025-02-12 16:17:27
|
|
5
|
+
* @LastEditTime: 2025-05-08 11:37:52
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { Pie } from '@antv/g2plot';
|
|
9
|
+
var PieChart = function PieChart(props) {
|
|
10
|
+
var data = props.data,
|
|
11
|
+
theme = props.theme,
|
|
12
|
+
config = props.config;
|
|
13
|
+
var containerRef = React.useRef(null);
|
|
14
|
+
var chartRef = React.useRef();
|
|
15
|
+
var renderChart = React.useCallback(function () {
|
|
16
|
+
chartRef.current = new Pie(containerRef.current, _objectSpread(_objectSpread({}, config), {}, {
|
|
17
|
+
theme: theme,
|
|
18
|
+
radius: 0.8,
|
|
19
|
+
data: data,
|
|
20
|
+
angleField: 'value',
|
|
21
|
+
colorField: 'type',
|
|
22
|
+
interactions: [{
|
|
23
|
+
type: 'element-selected'
|
|
24
|
+
}, {
|
|
25
|
+
type: 'element-active'
|
|
26
|
+
}],
|
|
27
|
+
label: {
|
|
28
|
+
type: 'inner',
|
|
29
|
+
position: 'bottom',
|
|
30
|
+
content: (config === null || config === void 0 ? void 0 : config.isPercentage) ? function (_ref) {
|
|
31
|
+
var type = _ref.type,
|
|
32
|
+
value = _ref.value,
|
|
33
|
+
percent = _ref.percent;
|
|
34
|
+
return "".concat((percent * 100).toFixed(2), "%");
|
|
35
|
+
} : undefined
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
chartRef.current.render();
|
|
39
|
+
}, [data, config]);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
if (containerRef.current) {
|
|
42
|
+
renderChart();
|
|
43
|
+
}
|
|
44
|
+
return function () {
|
|
45
|
+
if (chartRef.current) {
|
|
46
|
+
chartRef.current.destroy();
|
|
47
|
+
chartRef.current = undefined;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}, []);
|
|
51
|
+
React.useEffect(function () {
|
|
52
|
+
var _data = data.map(function (p) {
|
|
53
|
+
return _objectSpread(_objectSpread({}, p), {}, {
|
|
54
|
+
value: Number(p.value)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
chartRef.current.changeData(_data);
|
|
58
|
+
}, [data]);
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: containerRef,
|
|
61
|
+
style: {
|
|
62
|
+
width: '100%',
|
|
63
|
+
height: '100%'
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
export default PieChart;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Options } from '@antv/g2plot';
|
|
2
|
+
import { ChartType } from './constants';
|
|
3
|
+
export type IChartType = ChartType.LINE | ChartType.AREA | ChartType.BAR | ChartType.PIE | ChartType.DOT;
|
|
4
|
+
export type IChartData = {
|
|
5
|
+
name: string;
|
|
6
|
+
x: string[] | number[];
|
|
7
|
+
y: string[] | number[];
|
|
8
|
+
};
|
|
9
|
+
export type IChartConfig = {
|
|
10
|
+
xFieldName?: string;
|
|
11
|
+
yFieldName?: string;
|
|
12
|
+
xFieldLabel?: string;
|
|
13
|
+
yFieldLabel?: string;
|
|
14
|
+
targetValue?: number;
|
|
15
|
+
isShowValue?: boolean;
|
|
16
|
+
isTimeAxis: boolean;
|
|
17
|
+
isPercentage?: boolean;
|
|
18
|
+
group?: string;
|
|
19
|
+
} & Partial<Options>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const transXYData: (data: any[]) => any[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
export var transXYData = function transXYData(data) {
|
|
3
|
+
var res = [];
|
|
4
|
+
var _loop = function _loop(i) {
|
|
5
|
+
var _arr = data[i].x.map(function (it, idx) {
|
|
6
|
+
var _data$i$name, _data$i;
|
|
7
|
+
return {
|
|
8
|
+
x: it,
|
|
9
|
+
y: Number(data[i].y[idx]),
|
|
10
|
+
name: (_data$i$name = (_data$i = data[i]) === null || _data$i === void 0 ? void 0 : _data$i.name) !== null && _data$i$name !== void 0 ? _data$i$name : i + 1
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
res = [].concat(_toConsumableArray(res), _toConsumableArray(_arr));
|
|
14
|
+
};
|
|
15
|
+
for (var i = 0; i < data.length; i++) {
|
|
16
|
+
_loop(i);
|
|
17
|
+
}
|
|
18
|
+
return res;
|
|
19
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import 'monaco-editor/esm/vs/basic-languages/pgsql/pgsql.contribution.js';
|
|
2
3
|
import './index.less';
|
|
3
4
|
interface ICodeEditProps {
|
|
4
5
|
value?: string;
|
|
6
|
+
defaultValue?: string;
|
|
5
7
|
theme?: 'light' | 'vs-dark';
|
|
6
8
|
mode?: 'javascript' | 'python' | 'pgsql';
|
|
9
|
+
minimap?: boolean;
|
|
7
10
|
width?: string | number;
|
|
8
11
|
height?: string | number;
|
|
9
12
|
/**
|
|
@@ -16,5 +19,5 @@ interface ICodeEditProps {
|
|
|
16
19
|
onChange?: (txt: string) => void;
|
|
17
20
|
readOnly?: boolean;
|
|
18
21
|
}
|
|
19
|
-
declare const
|
|
20
|
-
export default
|
|
22
|
+
declare const _default: React.MemoExoticComponent<(props: ICodeEditProps) => JSX.Element>;
|
|
23
|
+
export default _default;
|
|
@@ -1,23 +1,24 @@
|
|
|
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
1
|
/*
|
|
5
2
|
* @Author: wangxian
|
|
6
3
|
* @Date: 2023-09-08 10:02:20
|
|
7
|
-
* @LastEditTime: 2024-09-
|
|
4
|
+
* @LastEditTime: 2024-09-27 14:42:05
|
|
8
5
|
*/
|
|
9
|
-
import Editor, {
|
|
10
|
-
import * as monaco from 'monaco-editor
|
|
6
|
+
import Editor, { loader } from '@monaco-editor/react';
|
|
7
|
+
import * as monaco from 'monaco-editor';
|
|
11
8
|
import React from 'react';
|
|
12
9
|
// 引入所需的语言库
|
|
13
10
|
import 'monaco-editor/esm/vs/basic-languages/pgsql/pgsql.contribution.js';
|
|
14
11
|
import './index.less';
|
|
12
|
+
import registerCompletionItemProvider from './utils';
|
|
15
13
|
loader.config({
|
|
16
14
|
monaco: monaco
|
|
17
15
|
});
|
|
18
16
|
var CodeEdit = function CodeEdit(props) {
|
|
19
17
|
var value = props.value,
|
|
18
|
+
defaultValue = props.defaultValue,
|
|
20
19
|
width = props.width,
|
|
20
|
+
_props$minimap = props.minimap,
|
|
21
|
+
minimap = _props$minimap === void 0 ? false : _props$minimap,
|
|
21
22
|
height = props.height,
|
|
22
23
|
_props$theme = props.theme,
|
|
23
24
|
theme = _props$theme === void 0 ? 'light' : _props$theme,
|
|
@@ -26,75 +27,13 @@ var CodeEdit = function CodeEdit(props) {
|
|
|
26
27
|
onChange = props.onChange,
|
|
27
28
|
readOnly = props.readOnly;
|
|
28
29
|
var editorRef = React.useRef(null);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// 动态导入 pgsql 模块
|
|
37
|
-
l = {};
|
|
38
|
-
if (!(mode === 'pgsql')) {
|
|
39
|
-
_context.next = 8;
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
_context.next = 4;
|
|
43
|
-
return import('monaco-editor/esm/vs/basic-languages/pgsql/pgsql.js');
|
|
44
|
-
case 4:
|
|
45
|
-
_yield$import = _context.sent;
|
|
46
|
-
conf = _yield$import.conf;
|
|
47
|
-
language = _yield$import.language;
|
|
48
|
-
l = language;
|
|
49
|
-
case 8:
|
|
50
|
-
monaco.languages.registerCompletionItemProvider(mode, {
|
|
51
|
-
provideCompletionItems: function provideCompletionItems(model, position) {
|
|
52
|
-
var _l, _l2, _l3;
|
|
53
|
-
// 获取原有的提示项
|
|
54
|
-
// const suggestions = monaco.languages.provideCompletionItems(model, position).suggestions;
|
|
55
|
-
var word = model.getWordUntilPosition(position);
|
|
56
|
-
var range = {
|
|
57
|
-
startLineNumber: position.lineNumber,
|
|
58
|
-
endLineNumber: position.lineNumber,
|
|
59
|
-
startColumn: word.startColumn,
|
|
60
|
-
endColumn: word.endColumn
|
|
61
|
-
};
|
|
62
|
-
var keyword = (((_l = l) === null || _l === void 0 ? void 0 : _l.keywords) || []).map(function (item) {
|
|
63
|
-
return {
|
|
64
|
-
insertText: item,
|
|
65
|
-
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
66
|
-
label: item,
|
|
67
|
-
range: range
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
var operator = (((_l2 = l) === null || _l2 === void 0 ? void 0 : _l2.operators) || []).map(function (item) {
|
|
71
|
-
return {
|
|
72
|
-
insertText: item,
|
|
73
|
-
kind: monaco.languages.CompletionItemKind.Method,
|
|
74
|
-
label: item,
|
|
75
|
-
range: range
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
var fnc = (((_l3 = l) === null || _l3 === void 0 ? void 0 : _l3.builtinFunctions) || []).map(function (item) {
|
|
79
|
-
return {
|
|
80
|
-
insertText: item,
|
|
81
|
-
kind: monaco.languages.CompletionItemKind.Function,
|
|
82
|
-
label: item,
|
|
83
|
-
range: range
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
return {
|
|
87
|
-
suggestions: [].concat(_toConsumableArray(keyword), _toConsumableArray(operator), _toConsumableArray(fnc))
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
triggerCharacters: ['$', '.', '=', ':'] // 触发提示的字符 可以定义多个
|
|
91
|
-
});
|
|
92
|
-
case 9:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context.stop();
|
|
95
|
-
}
|
|
96
|
-
}, _callee);
|
|
97
|
-
})), [monaco]);
|
|
30
|
+
// const [myValue, setMyValue] = React.useState<string>();
|
|
31
|
+
// React.useEffect(() => {
|
|
32
|
+
// if (editorRef.current) {
|
|
33
|
+
// debugger;
|
|
34
|
+
// editorRef.current.setValue(value);
|
|
35
|
+
// }
|
|
36
|
+
// }, [value]);
|
|
98
37
|
// const initHighlight = React.useCallback(() => {
|
|
99
38
|
// monaco.languages.setMonarchTokensProvider(mode, {
|
|
100
39
|
// ignoreCase: true,
|
|
@@ -108,31 +47,37 @@ var CodeEdit = function CodeEdit(props) {
|
|
|
108
47
|
// },
|
|
109
48
|
// });
|
|
110
49
|
// }, [monaco]);
|
|
111
|
-
React.useEffect(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (value) {}
|
|
120
|
-
}, [value]);
|
|
50
|
+
// React.useEffect(() => {
|
|
51
|
+
// if (monaco && firstLoadRef.current) {
|
|
52
|
+
// console.log('====codeEidt=====value', monaco);
|
|
53
|
+
// firstLoadRef.current = false;
|
|
54
|
+
// // initHighlight();
|
|
55
|
+
// initSuggestion();
|
|
56
|
+
// }
|
|
57
|
+
// }, [monaco, value, initSuggestion]);
|
|
121
58
|
var onEditorChange = function onEditorChange(data) {
|
|
122
|
-
// initHighlight();
|
|
123
59
|
onChange && onChange(data);
|
|
124
60
|
};
|
|
125
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
61
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
style: {
|
|
63
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%',
|
|
66
|
+
padding: '8px'
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Editor, {
|
|
126
69
|
className: "my-code-editor",
|
|
127
70
|
width: width || '100%',
|
|
128
71
|
height: height || '100%',
|
|
129
72
|
theme: theme,
|
|
73
|
+
language: mode,
|
|
130
74
|
defaultLanguage: mode,
|
|
131
75
|
value: value,
|
|
132
|
-
defaultValue:
|
|
76
|
+
defaultValue: defaultValue
|
|
133
77
|
// beforeMount={onEditorWillMount}
|
|
134
78
|
,
|
|
135
79
|
onMount: function onMount(editor) {
|
|
80
|
+
registerCompletionItemProvider(mode);
|
|
136
81
|
editorRef.current = editor;
|
|
137
82
|
},
|
|
138
83
|
options: {
|
|
@@ -140,9 +85,15 @@ var CodeEdit = function CodeEdit(props) {
|
|
|
140
85
|
automaticLayout: true,
|
|
141
86
|
wordWrap: 'on',
|
|
142
87
|
quickSuggestions: true,
|
|
143
|
-
renderWhitespace: 'all'
|
|
88
|
+
renderWhitespace: 'all',
|
|
89
|
+
// roundedSelection: true,
|
|
90
|
+
overviewRulerBorder: false,
|
|
91
|
+
folding: true,
|
|
92
|
+
minimap: {
|
|
93
|
+
enabled: minimap
|
|
94
|
+
}
|
|
144
95
|
},
|
|
145
96
|
onChange: onEditorChange
|
|
146
|
-
}));
|
|
97
|
+
})));
|
|
147
98
|
};
|
|
148
|
-
export default CodeEdit;
|
|
99
|
+
export default /*#__PURE__*/React.memo(CodeEdit);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
.my-code-editor {
|
|
2
|
-
.suggest-widget {
|
|
3
|
-
position: absolute !important;
|
|
4
|
-
z-index: 1000 !important; /* 确保它在最顶层 */
|
|
5
|
-
}
|
|
6
|
-
}
|
|
1
|
+
.my-code-editor {
|
|
2
|
+
.suggest-widget {
|
|
3
|
+
position: absolute !important;
|
|
4
|
+
z-index: 1000 !important; /* 确保它在最顶层 */
|
|
5
|
+
}
|
|
6
|
+
}
|
|
@@ -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
|
+
import * as monaco from 'monaco-editor';
|
|
5
|
+
var pgsqlProvider;
|
|
6
|
+
var registerPgSqlProvider = /*#__PURE__*/function () {
|
|
7
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
8
|
+
var l, _yield$import, conf, language;
|
|
9
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
10
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11
|
+
case 0:
|
|
12
|
+
if (pgsqlProvider) {
|
|
13
|
+
pgsqlProvider.dispose();
|
|
14
|
+
}
|
|
15
|
+
l = {};
|
|
16
|
+
_context.next = 4;
|
|
17
|
+
return import('monaco-editor/esm/vs/basic-languages/pgsql/pgsql.js');
|
|
18
|
+
case 4:
|
|
19
|
+
_yield$import = _context.sent;
|
|
20
|
+
conf = _yield$import.conf;
|
|
21
|
+
language = _yield$import.language;
|
|
22
|
+
l = language;
|
|
23
|
+
pgsqlProvider = monaco.languages.registerCompletionItemProvider('pgsql', {
|
|
24
|
+
provideCompletionItems: function provideCompletionItems(model, position) {
|
|
25
|
+
var _l2, _l3, _l4;
|
|
26
|
+
var word = model.getWordUntilPosition(position);
|
|
27
|
+
var range = {
|
|
28
|
+
startLineNumber: position.lineNumber,
|
|
29
|
+
endLineNumber: position.lineNumber,
|
|
30
|
+
startColumn: word.startColumn,
|
|
31
|
+
endColumn: word.endColumn
|
|
32
|
+
};
|
|
33
|
+
var keyword = (((_l2 = l) === null || _l2 === void 0 ? void 0 : _l2.keywords) || []).map(function (item) {
|
|
34
|
+
return {
|
|
35
|
+
insertText: item,
|
|
36
|
+
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
37
|
+
label: item,
|
|
38
|
+
range: range
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
var operator = (((_l3 = l) === null || _l3 === void 0 ? void 0 : _l3.operators) || []).map(function (item) {
|
|
42
|
+
return {
|
|
43
|
+
insertText: item,
|
|
44
|
+
kind: monaco.languages.CompletionItemKind.Method,
|
|
45
|
+
label: item,
|
|
46
|
+
range: range
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
var fnc = (((_l4 = l) === null || _l4 === void 0 ? void 0 : _l4.builtinFunctions) || []).map(function (item) {
|
|
50
|
+
return {
|
|
51
|
+
insertText: item,
|
|
52
|
+
kind: monaco.languages.CompletionItemKind.Function,
|
|
53
|
+
label: item,
|
|
54
|
+
range: range
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
suggestions: [].concat(_toConsumableArray(keyword), _toConsumableArray(operator), _toConsumableArray(fnc))
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
triggerCharacters: ['$', '.', '=', ':', ''] // 触发提示的字符 可以定义多个
|
|
62
|
+
});
|
|
63
|
+
case 9:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context.stop();
|
|
66
|
+
}
|
|
67
|
+
}, _callee);
|
|
68
|
+
}));
|
|
69
|
+
return function registerPgSqlProvider() {
|
|
70
|
+
return _ref.apply(this, arguments);
|
|
71
|
+
};
|
|
72
|
+
}();
|
|
73
|
+
var pythonProvider;
|
|
74
|
+
var registerPythonProvider = /*#__PURE__*/function () {
|
|
75
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
76
|
+
var l, _l, _yield$import2, conf, language;
|
|
77
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
78
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
if (pythonProvider) {
|
|
81
|
+
pythonProvider.dispose();
|
|
82
|
+
}
|
|
83
|
+
l = {};
|
|
84
|
+
_l = {
|
|
85
|
+
keywords: ['etl_sdk'],
|
|
86
|
+
operators: ['connect_to_sqlserver', 'connect_to_pg', 'connect_to_kafka'],
|
|
87
|
+
builtinFunctions: ['query', 'write']
|
|
88
|
+
};
|
|
89
|
+
_context2.next = 5;
|
|
90
|
+
return import('monaco-editor/esm/vs/basic-languages/python/python.js');
|
|
91
|
+
case 5:
|
|
92
|
+
_yield$import2 = _context2.sent;
|
|
93
|
+
conf = _yield$import2.conf;
|
|
94
|
+
language = _yield$import2.language;
|
|
95
|
+
l = language;
|
|
96
|
+
l.keywords = [].concat(_toConsumableArray(l.keywords), _toConsumableArray(_l.operators));
|
|
97
|
+
l.operators = _toConsumableArray(_l.operators);
|
|
98
|
+
l.builtinFunctions = _toConsumableArray(_l.builtinFunctions);
|
|
99
|
+
pythonProvider = monaco.languages.registerCompletionItemProvider('python', {
|
|
100
|
+
provideCompletionItems: function provideCompletionItems(model, position) {
|
|
101
|
+
var _l5, _l6, _l7;
|
|
102
|
+
var word = model.getWordUntilPosition(position);
|
|
103
|
+
var range = {
|
|
104
|
+
startLineNumber: position.lineNumber,
|
|
105
|
+
endLineNumber: position.lineNumber,
|
|
106
|
+
startColumn: word.startColumn,
|
|
107
|
+
endColumn: word.endColumn
|
|
108
|
+
};
|
|
109
|
+
var keyword = (((_l5 = l) === null || _l5 === void 0 ? void 0 : _l5.keywords) || []).map(function (item) {
|
|
110
|
+
return {
|
|
111
|
+
insertText: item,
|
|
112
|
+
kind: monaco.languages.CompletionItemKind.Keyword,
|
|
113
|
+
label: item,
|
|
114
|
+
range: range
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
var operator = (((_l6 = l) === null || _l6 === void 0 ? void 0 : _l6.operators) || []).map(function (item) {
|
|
118
|
+
return {
|
|
119
|
+
insertText: item,
|
|
120
|
+
kind: monaco.languages.CompletionItemKind.Method,
|
|
121
|
+
label: item,
|
|
122
|
+
range: range
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
var fnc = (((_l7 = l) === null || _l7 === void 0 ? void 0 : _l7.builtinFunctions) || []).map(function (item) {
|
|
126
|
+
return {
|
|
127
|
+
insertText: item,
|
|
128
|
+
kind: monaco.languages.CompletionItemKind.Function,
|
|
129
|
+
label: item,
|
|
130
|
+
range: range
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
suggestions: [].concat(_toConsumableArray(keyword), _toConsumableArray(operator), _toConsumableArray(fnc))
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
triggerCharacters: ['$', '.', '=', ':', ''] // 触发提示的字符 可以定义多个
|
|
138
|
+
});
|
|
139
|
+
case 13:
|
|
140
|
+
case "end":
|
|
141
|
+
return _context2.stop();
|
|
142
|
+
}
|
|
143
|
+
}, _callee2);
|
|
144
|
+
}));
|
|
145
|
+
return function registerPythonProvider() {
|
|
146
|
+
return _ref2.apply(this, arguments);
|
|
147
|
+
};
|
|
148
|
+
}();
|
|
149
|
+
var registerCompletionItemProvider = /*#__PURE__*/function () {
|
|
150
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(language, customSuggest) {
|
|
151
|
+
var l;
|
|
152
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
153
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
154
|
+
case 0:
|
|
155
|
+
// 动态导入 pgsql 模块
|
|
156
|
+
l = {};
|
|
157
|
+
if (language === 'pgsql') {
|
|
158
|
+
registerPgSqlProvider();
|
|
159
|
+
}
|
|
160
|
+
if (language === 'python') {
|
|
161
|
+
registerPythonProvider();
|
|
162
|
+
}
|
|
163
|
+
case 3:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context3.stop();
|
|
166
|
+
}
|
|
167
|
+
}, _callee3);
|
|
168
|
+
}));
|
|
169
|
+
return function registerCompletionItemProvider(_x, _x2) {
|
|
170
|
+
return _ref3.apply(this, arguments);
|
|
171
|
+
};
|
|
172
|
+
}();
|
|
173
|
+
export default registerCompletionItemProvider;
|