ronds-metadata 1.3.76 → 1.3.78
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/CodeEdit/index.d.ts +1 -0
- package/es/comps/CodeEdit/index.js +29 -29
- package/es/comps/CodeEdit/index.less +6 -0
- package/es/comps/MetadataForm/DataCell/business/config.d.ts +0 -2
- package/es/comps/MetadataForm/DataCell/business/config.js +2 -4
- package/es/comps/MetadataForm/DataCell/business/index.js +7 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +1 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +15 -2
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.d.ts +3 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.js +15 -2
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.d.ts +1 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.js +17 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.d.ts +1 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.js +17 -1
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.js +56 -6
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +44 -27
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +61 -70
- package/es/comps/MetadataForm/hooks/index.js +1 -1
- package/es/comps/MetadataForm/utils.d.ts +1 -0
- package/es/comps/MetadataForm/utils.js +43 -1
- package/es/config.js +9 -6
- package/package.json +2 -2
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfig.d.ts +0 -6
- package/es/comps/MetadataForm/DataCell/plugin/SourceConfig.js +0 -821
@@ -4,12 +4,13 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
/*
|
5
5
|
* @Author: wangxian
|
6
6
|
* @Date: 2023-09-08 10:02:20
|
7
|
-
* @LastEditTime:
|
7
|
+
* @LastEditTime: 2024-08-22 16:37:50
|
8
8
|
*/
|
9
9
|
import Editor, { useMonaco } from '@monaco-editor/react';
|
10
10
|
import React from 'react';
|
11
11
|
// 引入所需的语言库
|
12
12
|
import 'monaco-editor/esm/vs/basic-languages/pgsql/pgsql.contribution.js';
|
13
|
+
import './index.less';
|
13
14
|
var CodeEdit = function CodeEdit(props) {
|
14
15
|
var value = props.value,
|
15
16
|
width = props.width,
|
@@ -20,6 +21,7 @@ var CodeEdit = function CodeEdit(props) {
|
|
20
21
|
mode = _props$mode === void 0 ? 'javascript' : _props$mode,
|
21
22
|
onChange = props.onChange;
|
22
23
|
var editorRef = React.useRef(null);
|
24
|
+
var firstLoadRef = React.useRef(true);
|
23
25
|
var monaco = useMonaco();
|
24
26
|
var initSuggestion = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
25
27
|
var l, _yield$import, conf, language;
|
@@ -40,13 +42,6 @@ var CodeEdit = function CodeEdit(props) {
|
|
40
42
|
language = _yield$import.language;
|
41
43
|
l = language;
|
42
44
|
case 8:
|
43
|
-
if (mode === 'python') {
|
44
|
-
l = {
|
45
|
-
keywords: ['signal'],
|
46
|
-
operators: ['add'],
|
47
|
-
builtinFunctions: ['alarm', 'plot']
|
48
|
-
};
|
49
|
-
}
|
50
45
|
monaco.languages.registerCompletionItemProvider(mode, {
|
51
46
|
provideCompletionItems: function provideCompletionItems(model, position) {
|
52
47
|
var _l, _l2, _l3;
|
@@ -89,43 +84,46 @@ var CodeEdit = function CodeEdit(props) {
|
|
89
84
|
},
|
90
85
|
triggerCharacters: ['$', '.', '=', ':'] // 触发提示的字符 可以定义多个
|
91
86
|
});
|
92
|
-
case
|
87
|
+
case 9:
|
93
88
|
case "end":
|
94
89
|
return _context.stop();
|
95
90
|
}
|
96
91
|
}, _callee);
|
97
92
|
})), [monaco]);
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
}
|
112
|
-
});
|
113
|
-
}, [monaco]);
|
93
|
+
// const initHighlight = React.useCallback(() => {
|
94
|
+
// monaco.languages.setMonarchTokensProvider(mode, {
|
95
|
+
// ignoreCase: true,
|
96
|
+
// tokenizer: {
|
97
|
+
// root: [
|
98
|
+
// [/plot/, { token: 'keyword' }],
|
99
|
+
// [/alarm/, { token: 'keyword' }],
|
100
|
+
// [/add/, { token: 'keyword' }],
|
101
|
+
// [/signal/, { token: 'string.escape' }],
|
102
|
+
// ],
|
103
|
+
// },
|
104
|
+
// });
|
105
|
+
// }, [monaco]);
|
114
106
|
React.useEffect(function () {
|
115
|
-
if (monaco) {
|
116
|
-
|
107
|
+
if (monaco && firstLoadRef.current) {
|
108
|
+
firstLoadRef.current = false;
|
109
|
+
// initHighlight();
|
117
110
|
initSuggestion();
|
118
111
|
}
|
119
112
|
}, [monaco, value, initSuggestion]);
|
113
|
+
React.useEffect(function () {
|
114
|
+
if (value) {}
|
115
|
+
}, [value]);
|
120
116
|
var onEditorChange = function onEditorChange(data) {
|
121
|
-
initHighlight();
|
117
|
+
// initHighlight();
|
122
118
|
onChange && onChange(data);
|
123
119
|
};
|
124
120
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Editor, {
|
121
|
+
className: "my-code-editor",
|
125
122
|
width: width || '100%',
|
126
123
|
height: height || '100%',
|
127
124
|
theme: theme,
|
128
125
|
defaultLanguage: mode,
|
126
|
+
value: value,
|
129
127
|
defaultValue: value
|
130
128
|
// beforeMount={onEditorWillMount}
|
131
129
|
,
|
@@ -135,7 +133,9 @@ var CodeEdit = function CodeEdit(props) {
|
|
135
133
|
options: {
|
136
134
|
readOnly: false,
|
137
135
|
automaticLayout: true,
|
138
|
-
wordWrap: 'on'
|
136
|
+
wordWrap: 'on',
|
137
|
+
quickSuggestions: true,
|
138
|
+
renderWhitespace: 'all'
|
139
139
|
},
|
140
140
|
onChange: onEditorChange
|
141
141
|
}));
|
@@ -153,7 +153,6 @@ export declare const BusinessSchema: {
|
|
153
153
|
common: {
|
154
154
|
label: string;
|
155
155
|
colSpan: number;
|
156
|
-
labelSpan: number;
|
157
156
|
require: boolean;
|
158
157
|
};
|
159
158
|
'common-en-US': {};
|
@@ -262,7 +261,6 @@ export declare const BusinessSchema: {
|
|
262
261
|
common: {
|
263
262
|
label: string;
|
264
263
|
colSpan: number;
|
265
|
-
labelSpan: number;
|
266
264
|
};
|
267
265
|
'common-en-US': {};
|
268
266
|
text: {
|
@@ -86,7 +86,7 @@ var ETL_SOURCE_SCHEMA = [{
|
|
86
86
|
refId: 'com.ronds.schema.default.Rule.Form',
|
87
87
|
value: {
|
88
88
|
common: {
|
89
|
-
label: '
|
89
|
+
label: '获取尺寸',
|
90
90
|
require: true,
|
91
91
|
labelSpan: 4,
|
92
92
|
depend: {
|
@@ -171,7 +171,6 @@ var ETL_SOURCE_SCHEMA = [{
|
|
171
171
|
common: {
|
172
172
|
label: 'Spark Sql',
|
173
173
|
colSpan: 2,
|
174
|
-
labelSpan: 4,
|
175
174
|
require: true
|
176
175
|
},
|
177
176
|
'common-en-US': {},
|
@@ -294,8 +293,7 @@ var ETL_DIRECTION_SCHEMA = [{
|
|
294
293
|
value: {
|
295
294
|
common: {
|
296
295
|
label: '字段映射',
|
297
|
-
colSpan: 2
|
298
|
-
labelSpan: 4
|
296
|
+
colSpan: 2
|
299
297
|
},
|
300
298
|
'common-en-US': {},
|
301
299
|
text: {
|
@@ -8,11 +8,17 @@ var BusinessForm = function BusinessForm(props) {
|
|
8
8
|
disabled = props.disabled,
|
9
9
|
value = props.value,
|
10
10
|
onChange = props.onChange;
|
11
|
+
var formRef = React.useRef();
|
11
12
|
var schema = React.useMemo(function () {
|
12
13
|
var _extraInfo$bussiness;
|
13
14
|
return BusinessSchema[extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$bussiness = extraInfo.bussiness) === null || _extraInfo$bussiness === void 0 ? void 0 : _extraInfo$bussiness.type];
|
14
15
|
}, [extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$bussiness2 = extraInfo.bussiness) === null || _extraInfo$bussiness2 === void 0 ? void 0 : _extraInfo$bussiness2.type]);
|
15
16
|
var valueRef = React.useRef({});
|
17
|
+
React.useEffect(function () {
|
18
|
+
if (value) {
|
19
|
+
formRef.current.setFieldsValue(_objectSpread({}, value));
|
20
|
+
}
|
21
|
+
}, [value]);
|
16
22
|
var triggerChange = function triggerChange(changedValue) {
|
17
23
|
valueRef.current = _objectSpread(_objectSpread({}, valueRef.current), changedValue);
|
18
24
|
onChange && onChange(valueRef.current);
|
@@ -23,7 +29,7 @@ var BusinessForm = function BusinessForm(props) {
|
|
23
29
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MetadataForm, {
|
24
30
|
schema: schema,
|
25
31
|
getFormInstance: function getFormInstance(form) {
|
26
|
-
|
32
|
+
formRef.current = form;
|
27
33
|
},
|
28
34
|
onValuesChange: onValuesChange
|
29
35
|
}));
|
@@ -19,25 +19,36 @@ var CassandraDatasource = function CassandraDatasource(props) {
|
|
19
19
|
datasource = props.datasource,
|
20
20
|
onChange = props.onChange,
|
21
21
|
wrapperCol = props.wrapperCol,
|
22
|
-
labelCol = props.labelCol
|
22
|
+
labelCol = props.labelCol,
|
23
|
+
initialValue = props.initialValue;
|
23
24
|
var _React$useState = React.useState(),
|
24
25
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
25
26
|
keySpace = _React$useState2[0],
|
26
27
|
setKeySpace = _React$useState2[1];
|
28
|
+
var _React$useState3 = React.useState(),
|
29
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
30
|
+
dataTable = _React$useState4[0],
|
31
|
+
setDataTable = _React$useState4[1];
|
27
32
|
var keySpaceOpts = useGetDatasource('Cassandra', 2, datasource);
|
28
33
|
var dataTableOpts = useGetDatasource('Cassandra', 3, datasource, keySpace ? JSON.parse(keySpace).name : undefined);
|
29
34
|
var onKeySpaceChange = function onKeySpaceChange(value) {
|
30
|
-
debugger;
|
31
35
|
setKeySpace(value);
|
32
36
|
onChange && onChange({
|
33
37
|
keyspace: value
|
34
38
|
});
|
35
39
|
};
|
36
40
|
var onDataTableChange = function onDataTableChange(value) {
|
41
|
+
setDataTable(value);
|
37
42
|
onChange && onChange({
|
38
43
|
dt: value
|
39
44
|
});
|
40
45
|
};
|
46
|
+
React.useEffect(function () {
|
47
|
+
if (initialValue) {
|
48
|
+
onKeySpaceChange(initialValue.keyspace);
|
49
|
+
onDataTableChange(initialValue.dt);
|
50
|
+
}
|
51
|
+
}, [initialValue]);
|
41
52
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
42
53
|
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
43
54
|
flex: labelCol
|
@@ -60,6 +71,7 @@ var CassandraDatasource = function CassandraDatasource(props) {
|
|
60
71
|
}, /*#__PURE__*/React.createElement(_Select, {
|
61
72
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : (_extraInfo$datasource2 = _extraInfo$datasource.cassandra) === null || _extraInfo$datasource2 === void 0 ? void 0 : _extraInfo$datasource2.isMutiple) ? 'multiple' : undefined,
|
62
73
|
allowClear: true,
|
74
|
+
value: keySpace,
|
63
75
|
options: keySpaceOpts,
|
64
76
|
onChange: onKeySpaceChange
|
65
77
|
})), /*#__PURE__*/React.createElement(_Col, {
|
@@ -86,6 +98,7 @@ var CassandraDatasource = function CassandraDatasource(props) {
|
|
86
98
|
}, /*#__PURE__*/React.createElement(_Select, {
|
87
99
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource3 = extraInfo.datasource) === null || _extraInfo$datasource3 === void 0 ? void 0 : (_extraInfo$datasource4 = _extraInfo$datasource3.cassandra) === null || _extraInfo$datasource4 === void 0 ? void 0 : _extraInfo$datasource4.isMutiple) ? 'multiple' : undefined,
|
88
100
|
allowClear: true,
|
101
|
+
value: dataTable,
|
89
102
|
options: dataTableOpts,
|
90
103
|
onChange: onDataTableChange,
|
91
104
|
style: {
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import React from 'react';
|
1
2
|
interface IKafkaDatasourceProps {
|
2
3
|
extraInfo?: any;
|
3
4
|
datasource?: any;
|
4
5
|
wrapperCol: string;
|
5
6
|
labelCol: string;
|
6
7
|
onChange?: any;
|
8
|
+
initialValue?: any;
|
7
9
|
}
|
8
|
-
declare const KafkaDatasource: (props: IKafkaDatasourceProps) =>
|
10
|
+
declare const KafkaDatasource: (props: IKafkaDatasourceProps) => React.JSX.Element;
|
9
11
|
export default KafkaDatasource;
|
@@ -2,22 +2,34 @@ import "antd/es/select/style";
|
|
2
2
|
import _Select from "antd/es/select";
|
3
3
|
import "antd/es/col/style";
|
4
4
|
import _Col from "antd/es/col";
|
5
|
-
import
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
6
|
import { tr } from '../../../../../framework/locale';
|
7
7
|
import { useGetDatasource } from './hooks';
|
8
|
+
import React from 'react';
|
8
9
|
var KafkaDatasource = function KafkaDatasource(props) {
|
9
10
|
var _extraInfo$datasource, _extraInfo$datasource2;
|
10
11
|
var extraInfo = props.extraInfo,
|
11
12
|
datasource = props.datasource,
|
12
13
|
onChange = props.onChange,
|
13
14
|
wrapperCol = props.wrapperCol,
|
14
|
-
labelCol = props.labelCol
|
15
|
+
labelCol = props.labelCol,
|
16
|
+
initialValue = props.initialValue;
|
17
|
+
var _React$useState = React.useState(),
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
19
|
+
topic = _React$useState2[0],
|
20
|
+
setTopic = _React$useState2[1];
|
15
21
|
var topicOpts = useGetDatasource('Kafka', 2, datasource);
|
16
22
|
var onTopicChange = function onTopicChange(value) {
|
23
|
+
setTopic(value);
|
17
24
|
onChange && onChange({
|
18
25
|
topics: value
|
19
26
|
});
|
20
27
|
};
|
28
|
+
React.useEffect(function () {
|
29
|
+
if (initialValue) {
|
30
|
+
onTopicChange(initialValue.topics);
|
31
|
+
}
|
32
|
+
}, [initialValue]);
|
21
33
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
22
34
|
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
23
35
|
flex: labelCol
|
@@ -39,6 +51,7 @@ var KafkaDatasource = function KafkaDatasource(props) {
|
|
39
51
|
}
|
40
52
|
}, /*#__PURE__*/React.createElement(_Select, {
|
41
53
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : (_extraInfo$datasource2 = _extraInfo$datasource.kafka) === null || _extraInfo$datasource2 === void 0 ? void 0 : _extraInfo$datasource2.isMutiple) ? 'multiple' : undefined,
|
54
|
+
value: topic,
|
42
55
|
allowClear: true,
|
43
56
|
options: topicOpts,
|
44
57
|
onChange: onTopicChange
|
@@ -17,7 +17,8 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
17
17
|
wrapperCol = props.wrapperCol,
|
18
18
|
labelCol = props.labelCol,
|
19
19
|
datasource = props.datasource,
|
20
|
-
onChange = props.onChange
|
20
|
+
onChange = props.onChange,
|
21
|
+
initialValue = props.initialValue;
|
21
22
|
var _React$useState = React.useState(),
|
22
23
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
24
|
dataBase = _React$useState2[0],
|
@@ -26,6 +27,10 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
26
27
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
27
28
|
schema = _React$useState4[0],
|
28
29
|
setSchema = _React$useState4[1];
|
30
|
+
var _React$useState5 = React.useState(),
|
31
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
32
|
+
dataTable = _React$useState6[0],
|
33
|
+
setDataTable = _React$useState6[1];
|
29
34
|
var dataBaseOpts = useGetDatasource('PostgreSql', 2, datasource);
|
30
35
|
var schemaOpts = useGetDatasource('PostgreSql', 3, datasource, dataBase ? JSON.parse(dataBase).name : undefined);
|
31
36
|
var dataTableOpts = useGetDatasource('PostgreSql', 4, datasource, dataBase ? JSON.parse(dataBase).name : undefined, schema ? JSON.parse(schema).name : undefined);
|
@@ -42,10 +47,18 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
42
47
|
});
|
43
48
|
};
|
44
49
|
var onDataTableChange = function onDataTableChange(value) {
|
50
|
+
setDataTable(value);
|
45
51
|
onChange && onChange({
|
46
52
|
dt: value
|
47
53
|
});
|
48
54
|
};
|
55
|
+
React.useEffect(function () {
|
56
|
+
if (initialValue) {
|
57
|
+
onDataBaseChange(initialValue.db);
|
58
|
+
onSchemaChange(initialValue.schema);
|
59
|
+
onDataTableChange(initialValue.dt);
|
60
|
+
}
|
61
|
+
}, [initialValue]);
|
49
62
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
50
63
|
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
51
64
|
flex: labelCol
|
@@ -68,6 +81,7 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
68
81
|
}, /*#__PURE__*/React.createElement(_Select, {
|
69
82
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : (_extraInfo$datasource2 = _extraInfo$datasource.postgreSql) === null || _extraInfo$datasource2 === void 0 ? void 0 : _extraInfo$datasource2.isMutiple) ? 'multiple' : undefined,
|
70
83
|
allowClear: true,
|
84
|
+
value: dataBase,
|
71
85
|
options: dataBaseOpts,
|
72
86
|
onChange: onDataBaseChange
|
73
87
|
})), /*#__PURE__*/React.createElement(_Col, {
|
@@ -92,6 +106,7 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
92
106
|
}, /*#__PURE__*/React.createElement(_Select, {
|
93
107
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource3 = extraInfo.datasource) === null || _extraInfo$datasource3 === void 0 ? void 0 : (_extraInfo$datasource4 = _extraInfo$datasource3.postgreSql) === null || _extraInfo$datasource4 === void 0 ? void 0 : _extraInfo$datasource4.isMutiple) ? 'multiple' : undefined,
|
94
108
|
allowClear: true,
|
109
|
+
value: schema,
|
95
110
|
options: schemaOpts,
|
96
111
|
onChange: onSchemaChange
|
97
112
|
})), /*#__PURE__*/React.createElement(_Col, {
|
@@ -116,6 +131,7 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
|
|
116
131
|
}, /*#__PURE__*/React.createElement(_Select, {
|
117
132
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource5 = extraInfo.datasource) === null || _extraInfo$datasource5 === void 0 ? void 0 : (_extraInfo$datasource6 = _extraInfo$datasource5.postgreSql) === null || _extraInfo$datasource6 === void 0 ? void 0 : _extraInfo$datasource6.isMutiple) ? 'multiple' : undefined,
|
118
133
|
allowClear: true,
|
134
|
+
value: dataTable,
|
119
135
|
options: dataTableOpts,
|
120
136
|
onChange: onDataTableChange
|
121
137
|
})));
|
@@ -12,7 +12,8 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
12
12
|
datasource = props.datasource,
|
13
13
|
wrapperCol = props.wrapperCol,
|
14
14
|
labelCol = props.labelCol,
|
15
|
-
onChange = props.onChange
|
15
|
+
onChange = props.onChange,
|
16
|
+
initialValue = props.initialValue;
|
16
17
|
var _React$useState = React.useState(),
|
17
18
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
18
19
|
dataBase = _React$useState2[0],
|
@@ -21,6 +22,10 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
21
22
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
22
23
|
schema = _React$useState4[0],
|
23
24
|
setSchema = _React$useState4[1];
|
25
|
+
var _React$useState5 = React.useState(),
|
26
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
27
|
+
dataTable = _React$useState6[0],
|
28
|
+
setDataTable = _React$useState6[1];
|
24
29
|
var dataBaseOpts = useGetDatasource('SqlServer', 2, datasource);
|
25
30
|
var schemaOpts = useGetDatasource('SqlServer', 3, datasource, dataBase ? JSON.parse(dataBase).name : undefined);
|
26
31
|
var dataTableOpts = useGetDatasource('SqlServer', 4, datasource, dataBase ? JSON.parse(dataBase).name : undefined, schema ? JSON.parse(schema).name : undefined);
|
@@ -37,10 +42,18 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
37
42
|
});
|
38
43
|
};
|
39
44
|
var onDataTableChange = function onDataTableChange(value) {
|
45
|
+
setDataTable(value);
|
40
46
|
onChange && onChange({
|
41
47
|
dt: value
|
42
48
|
});
|
43
49
|
};
|
50
|
+
React.useEffect(function () {
|
51
|
+
if (initialValue) {
|
52
|
+
onDataBaseChange(initialValue.db);
|
53
|
+
onSchemaChange(initialValue.schema);
|
54
|
+
onDataTableChange(initialValue.dt);
|
55
|
+
}
|
56
|
+
}, [initialValue]);
|
44
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
45
58
|
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
46
59
|
flex: labelCol
|
@@ -63,6 +76,7 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
63
76
|
}, /*#__PURE__*/React.createElement(_Select, {
|
64
77
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : (_extraInfo$datasource2 = _extraInfo$datasource.sqlServer) === null || _extraInfo$datasource2 === void 0 ? void 0 : _extraInfo$datasource2.isMutiple) ? 'multiple' : undefined,
|
65
78
|
allowClear: true,
|
79
|
+
value: dataBase,
|
66
80
|
options: dataBaseOpts,
|
67
81
|
onChange: onDataBaseChange
|
68
82
|
})), /*#__PURE__*/React.createElement(_Col, {
|
@@ -87,6 +101,7 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
87
101
|
}, /*#__PURE__*/React.createElement(_Select, {
|
88
102
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource3 = extraInfo.datasource) === null || _extraInfo$datasource3 === void 0 ? void 0 : (_extraInfo$datasource4 = _extraInfo$datasource3.sqlServer) === null || _extraInfo$datasource4 === void 0 ? void 0 : _extraInfo$datasource4.isMutiple) ? 'multiple' : undefined,
|
89
103
|
allowClear: true,
|
104
|
+
value: schema,
|
90
105
|
options: schemaOpts,
|
91
106
|
onChange: onSchemaChange
|
92
107
|
})), /*#__PURE__*/React.createElement(_Col, {
|
@@ -111,6 +126,7 @@ var SqlServerDatasource = function SqlServerDatasource(props) {
|
|
111
126
|
}, /*#__PURE__*/React.createElement(_Select, {
|
112
127
|
mode: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource5 = extraInfo.datasource) === null || _extraInfo$datasource5 === void 0 ? void 0 : (_extraInfo$datasource6 = _extraInfo$datasource5.sqlServer) === null || _extraInfo$datasource6 === void 0 ? void 0 : _extraInfo$datasource6.isMutiple) ? 'multiple' : undefined,
|
113
128
|
allowClear: true,
|
129
|
+
value: dataTable,
|
114
130
|
options: dataTableOpts,
|
115
131
|
onChange: onDataTableChange
|
116
132
|
})));
|
@@ -34,6 +34,22 @@ var DataSource = function DataSource(props) {
|
|
34
34
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
35
35
|
datasource = _React$useState4[0],
|
36
36
|
setDatasource = _React$useState4[1];
|
37
|
+
var _React$useState5 = React.useState(),
|
38
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
39
|
+
kafkaInitValue = _React$useState6[0],
|
40
|
+
setKafkaInitValue = _React$useState6[1];
|
41
|
+
var _React$useState7 = React.useState(),
|
42
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
43
|
+
postgreSQLInitValue = _React$useState8[0],
|
44
|
+
setPostgreSQLInitValue = _React$useState8[1];
|
45
|
+
var _React$useState9 = React.useState(),
|
46
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
47
|
+
cassandraInitValue = _React$useState10[0],
|
48
|
+
setCassandraInitValue = _React$useState10[1];
|
49
|
+
var _React$useState11 = React.useState(),
|
50
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
51
|
+
sqlServerInitValue = _React$useState12[0],
|
52
|
+
setSqlServerInitValue = _React$useState12[1];
|
37
53
|
var valueRef = React.useRef({});
|
38
54
|
var datasourceOpts = useGetDatasource(dsType);
|
39
55
|
var labelCol = useGetLabelCol(extraInfo);
|
@@ -56,7 +72,8 @@ var DataSource = function DataSource(props) {
|
|
56
72
|
setDsType(value);
|
57
73
|
setDatasource('');
|
58
74
|
triggerChange({
|
59
|
-
dsType: value
|
75
|
+
dsType: value,
|
76
|
+
datasource: ''
|
60
77
|
});
|
61
78
|
};
|
62
79
|
var onDatasourceChange = function onDatasourceChange(value) {
|
@@ -68,10 +85,39 @@ var DataSource = function DataSource(props) {
|
|
68
85
|
var onKafkaChange = function onKafkaChange(value) {
|
69
86
|
triggerChange(_objectSpread({}, value));
|
70
87
|
};
|
71
|
-
var onPgSqlChange = function onPgSqlChange(value) {
|
88
|
+
var onPgSqlChange = function onPgSqlChange(value) {
|
89
|
+
triggerChange(_objectSpread({}, value));
|
90
|
+
};
|
72
91
|
var onCassandraChange = function onCassandraChange(value) {
|
73
92
|
triggerChange(_objectSpread({}, value));
|
74
93
|
};
|
94
|
+
var onSqlServerChange = function onSqlServerChange(value) {
|
95
|
+
triggerChange(_objectSpread({}, value));
|
96
|
+
};
|
97
|
+
React.useEffect(function () {
|
98
|
+
if (value) {
|
99
|
+
if (value.dsType) {
|
100
|
+
setDsType(value.dsType);
|
101
|
+
}
|
102
|
+
if (value.datasource) {
|
103
|
+
setDatasource(value.datasource);
|
104
|
+
}
|
105
|
+
switch (value === null || value === void 0 ? void 0 : value.dsType) {
|
106
|
+
case 'Kafka':
|
107
|
+
setKafkaInitValue(value);
|
108
|
+
break;
|
109
|
+
case 'PostgreSql':
|
110
|
+
setPostgreSQLInitValue(value);
|
111
|
+
break;
|
112
|
+
case 'Cassandra':
|
113
|
+
setCassandraInitValue(value);
|
114
|
+
break;
|
115
|
+
case 'SqlServer':
|
116
|
+
setSqlServerInitValue(value);
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}, [value]);
|
75
121
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
76
122
|
style: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) ? {
|
77
123
|
padding: '10px 10px 10px 10px',
|
@@ -131,25 +177,29 @@ var DataSource = function DataSource(props) {
|
|
131
177
|
labelCol: labelCol,
|
132
178
|
extraInfo: extraInfo,
|
133
179
|
datasource: datasource,
|
134
|
-
onChange: onKafkaChange
|
180
|
+
onChange: onKafkaChange,
|
181
|
+
initialValue: kafkaInitValue
|
135
182
|
}), dsType === 'PostgreSql' && /*#__PURE__*/React.createElement(PostgreSQLDatasource, {
|
136
183
|
wrapperCol: wrapperCol,
|
137
184
|
labelCol: labelCol,
|
138
185
|
extraInfo: extraInfo,
|
139
186
|
datasource: datasource,
|
140
|
-
onChange: onPgSqlChange
|
187
|
+
onChange: onPgSqlChange,
|
188
|
+
initialValue: postgreSQLInitValue
|
141
189
|
}), dsType === 'Cassandra' && /*#__PURE__*/React.createElement(CassandraDatasource, {
|
142
190
|
wrapperCol: wrapperCol,
|
143
191
|
labelCol: labelCol,
|
144
192
|
extraInfo: extraInfo,
|
145
193
|
datasource: datasource,
|
146
|
-
onChange: onCassandraChange
|
194
|
+
onChange: onCassandraChange,
|
195
|
+
initialValue: cassandraInitValue
|
147
196
|
}), dsType === 'SqlServer' && /*#__PURE__*/React.createElement(SqlServerDatasource, {
|
148
197
|
wrapperCol: wrapperCol,
|
149
198
|
labelCol: labelCol,
|
150
199
|
extraInfo: extraInfo,
|
151
200
|
datasource: datasource,
|
152
|
-
onChange:
|
201
|
+
onChange: onSqlServerChange,
|
202
|
+
initialValue: sqlServerInitValue
|
153
203
|
}))));
|
154
204
|
};
|
155
205
|
export default DataSource;
|