ronds-metadata 1.3.73 → 1.3.75
Sign up to get free protection for your applications and to get access to all the features.
- package/es/api/index.js +2 -2
- package/es/comps/MetadataForm/DataCell/Input.js +33 -9
- package/es/comps/MetadataForm/DataCell/business/config.d.ts +286 -0
- package/es/comps/MetadataForm/DataCell/business/config.js +322 -0
- package/es/comps/MetadataForm/DataCell/business/index.d.ts +9 -0
- package/es/comps/MetadataForm/DataCell/business/index.js +31 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +10 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +103 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.d.ts +9 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.js +47 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.d.ts +10 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.js +123 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.d.ts +10 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.js +118 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.d.ts +3 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.js +129 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.d.ts +9 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.js +155 -0
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.d.ts +1 -0
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +30 -22
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.d.ts +1 -2
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +20 -3
- package/es/comps/MetadataForm/HOC/index.js +1 -1
- package/es/comps/MetadataForm/hooks/index.js +6 -1
- package/es/comps/MetadataForm/index.less +29 -26
- package/package.json +1 -1
@@ -0,0 +1,118 @@
|
|
1
|
+
import "antd/es/select/style";
|
2
|
+
import _Select from "antd/es/select";
|
3
|
+
import "antd/es/col/style";
|
4
|
+
import _Col from "antd/es/col";
|
5
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
6
|
+
import { tr } from '../../../../../framework/locale';
|
7
|
+
import { useGetDatasource } from './hooks';
|
8
|
+
import React from 'react';
|
9
|
+
var SqlServerDatasource = function SqlServerDatasource(props) {
|
10
|
+
var _extraInfo$datasource, _extraInfo$datasource2, _extraInfo$datasource3, _extraInfo$datasource4, _extraInfo$datasource5, _extraInfo$datasource6;
|
11
|
+
var extraInfo = props.extraInfo,
|
12
|
+
datasource = props.datasource,
|
13
|
+
wrapperCol = props.wrapperCol,
|
14
|
+
labelCol = props.labelCol,
|
15
|
+
onChange = props.onChange;
|
16
|
+
var _React$useState = React.useState(),
|
17
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
18
|
+
dataBase = _React$useState2[0],
|
19
|
+
setDataBase = _React$useState2[1];
|
20
|
+
var _React$useState3 = React.useState(),
|
21
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
22
|
+
schema = _React$useState4[0],
|
23
|
+
setSchema = _React$useState4[1];
|
24
|
+
var dataBaseOpts = useGetDatasource('SqlServer', 2, datasource);
|
25
|
+
var schemaOpts = useGetDatasource('SqlServer', 3, datasource, dataBase ? JSON.parse(dataBase).name : undefined);
|
26
|
+
var dataTableOpts = useGetDatasource('SqlServer', 4, datasource, dataBase ? JSON.parse(dataBase).name : undefined, schema ? JSON.parse(schema).name : undefined);
|
27
|
+
var onDataBaseChange = function onDataBaseChange(value) {
|
28
|
+
setDataBase(value);
|
29
|
+
onChange && onChange({
|
30
|
+
db: value
|
31
|
+
});
|
32
|
+
};
|
33
|
+
var onSchemaChange = function onSchemaChange(value) {
|
34
|
+
setSchema(value);
|
35
|
+
onChange && onChange({
|
36
|
+
schema: value
|
37
|
+
});
|
38
|
+
};
|
39
|
+
var onDataTableChange = function onDataTableChange(value) {
|
40
|
+
onChange && onChange({
|
41
|
+
dt: value
|
42
|
+
});
|
43
|
+
};
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
45
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
46
|
+
flex: labelCol
|
47
|
+
}, /*#__PURE__*/React.createElement("label", {
|
48
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
49
|
+
}, /*#__PURE__*/React.createElement("div", {
|
50
|
+
className: "ant-form-item-label",
|
51
|
+
style: {
|
52
|
+
width: '100%',
|
53
|
+
textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
|
54
|
+
flex: '1'
|
55
|
+
}
|
56
|
+
}, /*#__PURE__*/React.createElement("label", {
|
57
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
58
|
+
}, tr('数据库'))))), /*#__PURE__*/React.createElement(_Col, {
|
59
|
+
flex: wrapperCol,
|
60
|
+
style: {
|
61
|
+
paddingBottom: '8px'
|
62
|
+
}
|
63
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
64
|
+
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
|
+
allowClear: true,
|
66
|
+
options: dataBaseOpts,
|
67
|
+
onChange: onDataBaseChange
|
68
|
+
})), /*#__PURE__*/React.createElement(_Col, {
|
69
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
70
|
+
flex: labelCol
|
71
|
+
}, /*#__PURE__*/React.createElement("label", {
|
72
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
73
|
+
}, /*#__PURE__*/React.createElement("div", {
|
74
|
+
className: "ant-form-item-label",
|
75
|
+
style: {
|
76
|
+
width: '100%',
|
77
|
+
textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
|
78
|
+
flex: '1'
|
79
|
+
}
|
80
|
+
}, /*#__PURE__*/React.createElement("label", {
|
81
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
82
|
+
}, tr('模式'))))), /*#__PURE__*/React.createElement(_Col, {
|
83
|
+
flex: wrapperCol,
|
84
|
+
style: {
|
85
|
+
paddingBottom: '8px'
|
86
|
+
}
|
87
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
88
|
+
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
|
+
allowClear: true,
|
90
|
+
options: schemaOpts,
|
91
|
+
onChange: onSchemaChange
|
92
|
+
})), /*#__PURE__*/React.createElement(_Col, {
|
93
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
94
|
+
flex: labelCol
|
95
|
+
}, /*#__PURE__*/React.createElement("label", {
|
96
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
97
|
+
}, /*#__PURE__*/React.createElement("div", {
|
98
|
+
className: "ant-form-item-label",
|
99
|
+
style: {
|
100
|
+
width: '100%',
|
101
|
+
textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
|
102
|
+
flex: '1'
|
103
|
+
}
|
104
|
+
}, /*#__PURE__*/React.createElement("label", {
|
105
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
106
|
+
}, tr('数据表'))))), /*#__PURE__*/React.createElement(_Col, {
|
107
|
+
flex: wrapperCol,
|
108
|
+
style: {
|
109
|
+
paddingBottom: '8px'
|
110
|
+
}
|
111
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
112
|
+
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
|
+
allowClear: true,
|
114
|
+
options: dataTableOpts,
|
115
|
+
onChange: onDataTableChange
|
116
|
+
})));
|
117
|
+
};
|
118
|
+
export default SqlServerDatasource;
|
@@ -0,0 +1,129 @@
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
5
|
+
import { MetadataService } from '../../../../../framework/metadata/MetadataService';
|
6
|
+
import React from 'react';
|
7
|
+
/*
|
8
|
+
* @Author: wangxian
|
9
|
+
* @Date: 2024-08-20 14:38:09
|
10
|
+
* @LastEditTime: 2024-08-21 09:31:11
|
11
|
+
*/
|
12
|
+
export var useGetDatasource = function useGetDatasource(type) {
|
13
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
14
|
+
var source = arguments.length > 2 ? arguments[2] : undefined;
|
15
|
+
var levelTwo = arguments.length > 3 ? arguments[3] : undefined;
|
16
|
+
var levelThree = arguments.length > 4 ? arguments[4] : undefined;
|
17
|
+
var _React$useState = React.useState([]),
|
18
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
19
|
+
list = _React$useState2[0],
|
20
|
+
setList = _React$useState2[1];
|
21
|
+
var server = new MetadataService();
|
22
|
+
var getHttpResult = React.useCallback( /*#__PURE__*/function () {
|
23
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_type, _level) {
|
24
|
+
var param, res, _config, _list;
|
25
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
26
|
+
while (1) switch (_context.prev = _context.next) {
|
27
|
+
case 0:
|
28
|
+
if (levelThree) {
|
29
|
+
param = {
|
30
|
+
type: _type,
|
31
|
+
level: _level,
|
32
|
+
source: source,
|
33
|
+
levelTwo: levelTwo,
|
34
|
+
levelThree: levelThree
|
35
|
+
};
|
36
|
+
} else if (levelTwo) {
|
37
|
+
param = {
|
38
|
+
type: _type,
|
39
|
+
level: _level,
|
40
|
+
source: source,
|
41
|
+
levelTwo: levelTwo
|
42
|
+
};
|
43
|
+
} else {
|
44
|
+
param = {
|
45
|
+
type: _type,
|
46
|
+
level: _level,
|
47
|
+
source: source
|
48
|
+
};
|
49
|
+
}
|
50
|
+
_context.next = 3;
|
51
|
+
return server.GetEnumDataByUrl(DATASOURCE_HTTP_URL, 'post', param);
|
52
|
+
case 3:
|
53
|
+
res = _context.sent;
|
54
|
+
_config = RESULT_MAP[_level];
|
55
|
+
_list = res.map(function (it) {
|
56
|
+
return {
|
57
|
+
value: it[_config.key],
|
58
|
+
label: it[_config.value]
|
59
|
+
};
|
60
|
+
});
|
61
|
+
setList(_toConsumableArray(_list));
|
62
|
+
case 7:
|
63
|
+
case "end":
|
64
|
+
return _context.stop();
|
65
|
+
}
|
66
|
+
}, _callee);
|
67
|
+
}));
|
68
|
+
return function (_x, _x2) {
|
69
|
+
return _ref.apply(this, arguments);
|
70
|
+
};
|
71
|
+
}(), [source, levelTwo, levelThree]);
|
72
|
+
React.useEffect(function () {
|
73
|
+
if (type && level) {
|
74
|
+
getHttpResult(type, level);
|
75
|
+
}
|
76
|
+
}, [type, level, source, levelTwo, levelThree, getHttpResult]);
|
77
|
+
return list;
|
78
|
+
};
|
79
|
+
export var useGetLabelCol = function useGetLabelCol(extraInfo) {
|
80
|
+
var _React$useState3 = React.useState(''),
|
81
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
82
|
+
flex = _React$useState4[0],
|
83
|
+
setFlex = _React$useState4[1];
|
84
|
+
React.useEffect(function () {
|
85
|
+
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal') {
|
86
|
+
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.colSpan)) {
|
87
|
+
setFlex("0 0 ".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) * 100 / (24 * (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.colSpan)), "%"));
|
88
|
+
} else {
|
89
|
+
setFlex("0 0 ".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) * 100 / 24, "%"));
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}, [extraInfo]);
|
93
|
+
return flex;
|
94
|
+
};
|
95
|
+
export var useGetWrapperCol = function useGetWrapperCol(extraInfo) {
|
96
|
+
var _React$useState5 = React.useState('1'),
|
97
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
98
|
+
flex = _React$useState6[0],
|
99
|
+
setFlex = _React$useState6[1];
|
100
|
+
React.useEffect(function () {
|
101
|
+
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal') {
|
102
|
+
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.colSpan)) {
|
103
|
+
setFlex("0 0 ".concat(100 - (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) * 100 / (24 * (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.colSpan)), "%"));
|
104
|
+
} else {
|
105
|
+
setFlex("0 0 ".concat((24 - (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan)) * 100 / 24, "%"));
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}, [extraInfo]);
|
109
|
+
return flex;
|
110
|
+
};
|
111
|
+
var DATASOURCE_HTTP_URL = '/dataset-web/source/cascade/data/v2';
|
112
|
+
var RESULT_MAP = {
|
113
|
+
1: {
|
114
|
+
key: 'config',
|
115
|
+
value: 'name'
|
116
|
+
},
|
117
|
+
2: {
|
118
|
+
key: 'config',
|
119
|
+
value: 'name'
|
120
|
+
},
|
121
|
+
3: {
|
122
|
+
key: 'config',
|
123
|
+
value: 'name'
|
124
|
+
},
|
125
|
+
4: {
|
126
|
+
key: 'config',
|
127
|
+
value: 'name'
|
128
|
+
}
|
129
|
+
};
|
@@ -0,0 +1,155 @@
|
|
1
|
+
import "antd/es/row/style";
|
2
|
+
import _Row from "antd/es/row";
|
3
|
+
import "antd/es/input/style";
|
4
|
+
import _Input from "antd/es/input";
|
5
|
+
import "antd/es/tooltip/style";
|
6
|
+
import _Tooltip from "antd/es/tooltip";
|
7
|
+
import "antd/es/button/style";
|
8
|
+
import _Button from "antd/es/button";
|
9
|
+
import "antd/es/select/style";
|
10
|
+
import _Select from "antd/es/select";
|
11
|
+
import "antd/es/col/style";
|
12
|
+
import _Col from "antd/es/col";
|
13
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
14
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
15
|
+
import { tr } from '../../../../../framework/locale';
|
16
|
+
import React from 'react';
|
17
|
+
import KafkaDatasource from './Kafka';
|
18
|
+
import { LinkOutlined } from '@ant-design/icons';
|
19
|
+
import PostgreSQLDatasource from './PostgreSQL';
|
20
|
+
import { useGetDatasource, useGetLabelCol, useGetWrapperCol } from './hooks';
|
21
|
+
import CassandraDatasource from './Cassandra';
|
22
|
+
import SqlServerDatasource from './SqlServer';
|
23
|
+
var DataSource = function DataSource(props) {
|
24
|
+
var _extraInfo$datasource2;
|
25
|
+
var extraInfo = props.extraInfo,
|
26
|
+
disabled = props.disabled,
|
27
|
+
value = props.value,
|
28
|
+
onChange = props.onChange;
|
29
|
+
var _React$useState = React.useState(''),
|
30
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
31
|
+
dsType = _React$useState2[0],
|
32
|
+
setDsType = _React$useState2[1];
|
33
|
+
var _React$useState3 = React.useState(''),
|
34
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
35
|
+
datasource = _React$useState4[0],
|
36
|
+
setDatasource = _React$useState4[1];
|
37
|
+
var valueRef = React.useRef({});
|
38
|
+
var datasourceOpts = useGetDatasource(dsType);
|
39
|
+
var labelCol = useGetLabelCol(extraInfo);
|
40
|
+
var wrapperCol = useGetWrapperCol(extraInfo);
|
41
|
+
var datasourceTypeOpts = React.useMemo(function () {
|
42
|
+
var _extraInfo$datasource;
|
43
|
+
var typeEnum = (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : _extraInfo$datasource.type) || [];
|
44
|
+
return typeEnum.map(function (it) {
|
45
|
+
return {
|
46
|
+
value: it,
|
47
|
+
label: it
|
48
|
+
};
|
49
|
+
});
|
50
|
+
}, [extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource2 = extraInfo.datasource) === null || _extraInfo$datasource2 === void 0 ? void 0 : _extraInfo$datasource2.type]);
|
51
|
+
var triggerChange = function triggerChange(changedValue) {
|
52
|
+
valueRef.current = _objectSpread(_objectSpread({}, valueRef.current), changedValue);
|
53
|
+
onChange && onChange(valueRef.current);
|
54
|
+
};
|
55
|
+
var onDatasourceTypeChange = function onDatasourceTypeChange(value) {
|
56
|
+
setDsType(value);
|
57
|
+
setDatasource('');
|
58
|
+
triggerChange({
|
59
|
+
dsType: value
|
60
|
+
});
|
61
|
+
};
|
62
|
+
var onDatasourceChange = function onDatasourceChange(value) {
|
63
|
+
setDatasource(value);
|
64
|
+
triggerChange(_objectSpread({
|
65
|
+
datasource: value
|
66
|
+
}, JSON.parse(value)));
|
67
|
+
};
|
68
|
+
var onKafkaChange = function onKafkaChange(value) {
|
69
|
+
triggerChange(_objectSpread({}, value));
|
70
|
+
};
|
71
|
+
var onPgSqlChange = function onPgSqlChange(value) {};
|
72
|
+
var onCassandraChange = function onCassandraChange(value) {
|
73
|
+
triggerChange(_objectSpread({}, value));
|
74
|
+
};
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
76
|
+
style: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) ? {
|
77
|
+
padding: '10px 10px 10px 10px',
|
78
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
79
|
+
width: '100%',
|
80
|
+
borderRadius: '4px'
|
81
|
+
} : {}
|
82
|
+
}, /*#__PURE__*/React.createElement(_Row, {
|
83
|
+
className: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) && 'ant-form-item',
|
84
|
+
style: {
|
85
|
+
alignItems: 'center'
|
86
|
+
}
|
87
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
88
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
89
|
+
flex: labelCol
|
90
|
+
}, /*#__PURE__*/React.createElement("div", {
|
91
|
+
className: "ant-form-item-label",
|
92
|
+
style: {
|
93
|
+
width: '100%',
|
94
|
+
textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
|
95
|
+
flex: '1'
|
96
|
+
}
|
97
|
+
}, /*#__PURE__*/React.createElement("label", {
|
98
|
+
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
99
|
+
}, tr('数据源')))), /*#__PURE__*/React.createElement(_Col, {
|
100
|
+
flex: wrapperCol,
|
101
|
+
style: {
|
102
|
+
paddingBottom: '8px'
|
103
|
+
}
|
104
|
+
}, /*#__PURE__*/React.createElement(_Input.Group, {
|
105
|
+
compact: true
|
106
|
+
}, /*#__PURE__*/React.createElement(_Select, {
|
107
|
+
id: 'datasourceType',
|
108
|
+
style: {
|
109
|
+
width: '30%'
|
110
|
+
},
|
111
|
+
value: dsType,
|
112
|
+
options: datasourceTypeOpts,
|
113
|
+
onChange: onDatasourceTypeChange
|
114
|
+
}), /*#__PURE__*/React.createElement(_Select, {
|
115
|
+
id: 'datasource',
|
116
|
+
style: {
|
117
|
+
width: 'calc(70% - 32px)'
|
118
|
+
},
|
119
|
+
value: datasource,
|
120
|
+
options: datasourceOpts,
|
121
|
+
onChange: onDatasourceChange
|
122
|
+
}), /*#__PURE__*/React.createElement(_Tooltip, {
|
123
|
+
title: tr('测试链接'),
|
124
|
+
style: {
|
125
|
+
width: '32px'
|
126
|
+
}
|
127
|
+
}, /*#__PURE__*/React.createElement(_Button, {
|
128
|
+
icon: /*#__PURE__*/React.createElement(LinkOutlined, null)
|
129
|
+
})))), dsType === 'Kafka' && /*#__PURE__*/React.createElement(KafkaDatasource, {
|
130
|
+
wrapperCol: wrapperCol,
|
131
|
+
labelCol: labelCol,
|
132
|
+
extraInfo: extraInfo,
|
133
|
+
datasource: datasource,
|
134
|
+
onChange: onKafkaChange
|
135
|
+
}), dsType === 'PostgreSql' && /*#__PURE__*/React.createElement(PostgreSQLDatasource, {
|
136
|
+
wrapperCol: wrapperCol,
|
137
|
+
labelCol: labelCol,
|
138
|
+
extraInfo: extraInfo,
|
139
|
+
datasource: datasource,
|
140
|
+
onChange: onPgSqlChange
|
141
|
+
}), dsType === 'Cassandra' && /*#__PURE__*/React.createElement(CassandraDatasource, {
|
142
|
+
wrapperCol: wrapperCol,
|
143
|
+
labelCol: labelCol,
|
144
|
+
extraInfo: extraInfo,
|
145
|
+
datasource: datasource,
|
146
|
+
onChange: onCassandraChange
|
147
|
+
}), dsType === 'SqlServer' && /*#__PURE__*/React.createElement(SqlServerDatasource, {
|
148
|
+
wrapperCol: wrapperCol,
|
149
|
+
labelCol: labelCol,
|
150
|
+
extraInfo: extraInfo,
|
151
|
+
datasource: datasource,
|
152
|
+
onChange: onCassandraChange
|
153
|
+
}))));
|
154
|
+
};
|
155
|
+
export default DataSource;
|
@@ -1,5 +1,9 @@
|
|
1
1
|
import "antd/es/checkbox/style";
|
2
2
|
import _Checkbox from "antd/es/checkbox";
|
3
|
+
import "antd/es/row/style";
|
4
|
+
import _Row from "antd/es/row";
|
5
|
+
import "antd/es/col/style";
|
6
|
+
import _Col from "antd/es/col";
|
3
7
|
import "antd/es/button/style";
|
4
8
|
import _Button from "antd/es/button";
|
5
9
|
import "antd/es/select/style";
|
@@ -11,9 +15,11 @@ import { CloseCircleFilled, ArrowRightOutlined } from '@ant-design/icons';
|
|
11
15
|
import React from 'react';
|
12
16
|
import Editable from '../../../../comps/Editable';
|
13
17
|
import { MetadataFormContext } from '../../interface';
|
18
|
+
import { useGetLabelCol } from './Datasource/hooks';
|
14
19
|
var MapTable = function MapTable(props) {
|
15
20
|
var value = props.value,
|
16
|
-
onChange = props.onChange
|
21
|
+
onChange = props.onChange,
|
22
|
+
extraInfo = props.extraInfo;
|
17
23
|
var _React$useState = React.useState([]),
|
18
24
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
19
25
|
tableDataSource = _React$useState2[0],
|
@@ -34,18 +40,15 @@ var MapTable = function MapTable(props) {
|
|
34
40
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
35
41
|
output = _React$useState10[0],
|
36
42
|
setOutput = _React$useState10[1];
|
37
|
-
var _React$useState11 = React.useState(
|
43
|
+
var _React$useState11 = React.useState(),
|
38
44
|
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
39
|
-
|
40
|
-
|
41
|
-
var _React$useState13 = React.useState(),
|
42
|
-
_React$useState14 = _slicedToArray(_React$useState13, 2),
|
43
|
-
disableArray = _React$useState14[0],
|
44
|
-
setDisableArray = _React$useState14[1];
|
45
|
+
disableArray = _React$useState12[0],
|
46
|
+
setDisableArray = _React$useState12[1];
|
45
47
|
var sourceEditableStreamRef = React.useRef();
|
46
48
|
var targetEditableStreamRef = React.useRef();
|
47
49
|
var _React$useContext = React.useContext(MetadataFormContext),
|
48
50
|
form = _React$useContext.form;
|
51
|
+
var labelCol = useGetLabelCol(extraInfo);
|
49
52
|
var triggerChange = function triggerChange(changedValue) {
|
50
53
|
onChange && onChange(_objectSpread({
|
51
54
|
mapping: mapping,
|
@@ -110,20 +113,25 @@ var MapTable = function MapTable(props) {
|
|
110
113
|
}
|
111
114
|
}, [disableArray]);
|
112
115
|
React.useEffect(function () {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
setDisableArray(valueArray);
|
122
|
-
}
|
123
|
-
setIsDataCome(true);
|
116
|
+
var values = form.getFieldsValue().mapTable;
|
117
|
+
(values === null || values === void 0 ? void 0 : values.dataSource) && setTableDataSource(values.dataSource);
|
118
|
+
(values === null || values === void 0 ? void 0 : values.dataTarget) && setTableDataTarget(values.dataTarget);
|
119
|
+
(values === null || values === void 0 ? void 0 : values.options) && setOptions(values.options);
|
120
|
+
if (!disableArray && (values === null || values === void 0 ? void 0 : values.dataSource) && (values === null || values === void 0 ? void 0 : values.dataTarget)) {
|
121
|
+
var _values$dataSource, _values$dataTarget;
|
122
|
+
var valueArray = new Array(Math.min((_values$dataSource = values.dataSource) === null || _values$dataSource === void 0 ? void 0 : _values$dataSource.length, (_values$dataTarget = values.dataTarget) === null || _values$dataTarget === void 0 ? void 0 : _values$dataTarget.length)).fill(true);
|
123
|
+
setDisableArray(valueArray);
|
124
124
|
}
|
125
125
|
}, [form.getFieldsValue()]);
|
126
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
126
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Row, {
|
127
|
+
className: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) && 'ant-form-item',
|
128
|
+
style: {
|
129
|
+
alignItems: 'center'
|
130
|
+
}
|
131
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
132
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
133
|
+
flex: labelCol
|
134
|
+
}, /*#__PURE__*/React.createElement("div", {
|
127
135
|
style: {
|
128
136
|
width: '100%',
|
129
137
|
height: '100%'
|
@@ -145,7 +153,7 @@ var MapTable = function MapTable(props) {
|
|
145
153
|
width: '100%',
|
146
154
|
height: '100%'
|
147
155
|
}
|
148
|
-
}, /*#__PURE__*/React.createElement("div", {
|
156
|
+
}, (tableDataSource === null || tableDataSource === void 0 ? void 0 : tableDataSource.length) > 0 && (tableDataTarget === null || tableDataTarget === void 0 ? void 0 : tableDataTarget.length) > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
149
157
|
style: {
|
150
158
|
width: '40%'
|
151
159
|
}
|
@@ -197,7 +205,7 @@ var MapTable = function MapTable(props) {
|
|
197
205
|
},
|
198
206
|
onRowClick: function onRowClick(record) {},
|
199
207
|
onMove: onTargetMove
|
200
|
-
})))));
|
208
|
+
}))))))));
|
201
209
|
};
|
202
210
|
export default MapTable;
|
203
211
|
var columnSource = [{
|
@@ -2,9 +2,8 @@ import React from 'react';
|
|
2
2
|
interface ISparkSqlTableProps {
|
3
3
|
extraDico?: any[];
|
4
4
|
initSql?: string;
|
5
|
-
dataSource?: any[];
|
6
5
|
value?: any;
|
7
|
-
|
6
|
+
extraInfo?: any;
|
8
7
|
onChange?: (value: any) => void;
|
9
8
|
}
|
10
9
|
declare const SparkSqlTable: (props: ISparkSqlTableProps) => React.JSX.Element;
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import "antd/es/row/style";
|
2
|
+
import _Row from "antd/es/row";
|
3
|
+
import "antd/es/col/style";
|
4
|
+
import _Col from "antd/es/col";
|
1
5
|
import "antd/es/button/style";
|
2
6
|
import _Button from "antd/es/button";
|
3
7
|
import "antd/es/input/style";
|
@@ -10,9 +14,11 @@ import React from 'react';
|
|
10
14
|
import { EyeOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
11
15
|
import Split from '../../../Split';
|
12
16
|
import SqlEdit from '../../../JsonEdit';
|
17
|
+
import { useGetLabelCol } from './Datasource/hooks';
|
13
18
|
var SparkSqlTable = function SparkSqlTable(props) {
|
14
19
|
var extraDico = props.extraDico,
|
15
20
|
value = props.value,
|
21
|
+
extraInfo = props.extraInfo,
|
16
22
|
onChange = props.onChange;
|
17
23
|
var _React$useState = React.useState('orgin'),
|
18
24
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
@@ -26,6 +32,7 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
26
32
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
27
33
|
list = _React$useState6[0],
|
28
34
|
setList = _React$useState6[1];
|
35
|
+
var labelCol = useGetLabelCol(extraInfo);
|
29
36
|
var handleAddItem = function handleAddItem() {
|
30
37
|
var _list = [].concat(_toConsumableArray(list), [{
|
31
38
|
alias: undefined,
|
@@ -86,10 +93,20 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
86
93
|
}
|
87
94
|
}
|
88
95
|
}, [value]);
|
89
|
-
return /*#__PURE__*/React.createElement("div", {
|
96
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Row, {
|
97
|
+
className: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) && 'ant-form-item',
|
98
|
+
style: {
|
99
|
+
alignItems: 'center'
|
100
|
+
}
|
101
|
+
}, /*#__PURE__*/React.createElement(_Col, {
|
102
|
+
span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
|
103
|
+
flex: labelCol
|
104
|
+
}, /*#__PURE__*/React.createElement("div", {
|
90
105
|
style: {
|
91
106
|
border: '2px solid #bebebe',
|
92
|
-
height: '500px'
|
107
|
+
height: '500px',
|
108
|
+
margin: '6px',
|
109
|
+
width: '1135px'
|
93
110
|
}
|
94
111
|
}, /*#__PURE__*/React.createElement(Split, {
|
95
112
|
gutterSize: 2,
|
@@ -223,6 +240,6 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
223
240
|
}]));
|
224
241
|
},
|
225
242
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
226
|
-
}, tr('添加SQL语句')))));
|
243
|
+
}, tr('添加SQL语句'))))))));
|
227
244
|
};
|
228
245
|
export default SparkSqlTable;
|
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
/*
|
6
6
|
* @Author: wangxian
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime:
|
8
|
+
* @LastEditTime: 2024-08-21 09:26:31
|
9
9
|
*/
|
10
10
|
import React from 'react';
|
11
11
|
import { deepClone } from '../../../utils';
|
@@ -4,7 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
/*
|
5
5
|
* @Author: your name
|
6
6
|
* @Date: 2021-09-18 14:15:04
|
7
|
-
* @LastEditTime:
|
7
|
+
* @LastEditTime: 2024-08-20 19:38:44
|
8
8
|
*/
|
9
9
|
import { getLocale } from '../../../framework/locale';
|
10
10
|
import moment from 'moment';
|
@@ -99,6 +99,9 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$, name) {
|
|
99
99
|
};
|
100
100
|
var processDependHiddenOrShow = function processDependHiddenOrShow(depend, changeData, stream$, name) {
|
101
101
|
try {
|
102
|
+
// if (depend === 'datasource.dsType =="Kafka"') {
|
103
|
+
// debugger;
|
104
|
+
// }
|
102
105
|
// const regex = /\w+(\.\w+)?[=<>!]{1}/g;
|
103
106
|
var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('.+'\)[=<>!]{1})/g;
|
104
107
|
var keys = depend.trim().replace(/\s/g, '').match(regex);
|
@@ -127,6 +130,8 @@ var processDependHiddenOrShow = function processDependHiddenOrShow(depend, chang
|
|
127
130
|
}
|
128
131
|
if (_changeData || _changeData === 0) {
|
129
132
|
var r = key === _key[0] ? "'".concat(_changeData, "'") : eval("_changeData.".concat(_key[1]));
|
133
|
+
// 判断 r 是否是字符串
|
134
|
+
r = typeof r === 'string' ? "\"".concat(r, "\"") : r;
|
130
135
|
expression = expression.replace(key, r);
|
131
136
|
} else {
|
132
137
|
expression = expression.replace(key, undefined);
|