ronds-metadata 1.3.77 → 1.3.79
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.js +2 -2
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +1 -0
- package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +15 -1
- 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 +48 -4
- package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +16 -4
- package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +51 -63
- 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
@@ -12,12 +12,12 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
12
12
|
import { tr } from '../../../../framework/locale';
|
13
13
|
import React from 'react';
|
14
14
|
import { EyeOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import {
|
15
|
+
import { useGetWrapperCol } from './Datasource/hooks';
|
16
|
+
import CodeEdit from '../../../../comps/CodeEdit';
|
17
|
+
import { getConfig } from '../../../../config';
|
18
|
+
import { modifyComment } from '../../utils';
|
18
19
|
var SparkSqlTable = function SparkSqlTable(props) {
|
19
|
-
var
|
20
|
-
value = props.value,
|
20
|
+
var value = props.value,
|
21
21
|
extraInfo = props.extraInfo,
|
22
22
|
onChange = props.onChange;
|
23
23
|
var _React$useState = React.useState('orgin'),
|
@@ -32,15 +32,17 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
32
32
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
33
33
|
list = _React$useState6[0],
|
34
34
|
setList = _React$useState6[1];
|
35
|
-
var
|
35
|
+
var listRef = React.useRef([]);
|
36
36
|
var wrapperCol = useGetWrapperCol(extraInfo);
|
37
37
|
var handleAddItem = function handleAddItem() {
|
38
|
-
var
|
39
|
-
alias:
|
40
|
-
outputView:
|
41
|
-
sqlEdit:
|
42
|
-
}
|
43
|
-
|
38
|
+
var item = {
|
39
|
+
alias: "tbl".concat(listRef.current.length + 1),
|
40
|
+
outputView: '',
|
41
|
+
sqlEdit: "/*+ name(tbl".concat(listRef.current.length + 1, ")*/")
|
42
|
+
};
|
43
|
+
var _list = [].concat(_toConsumableArray(listRef.current), [item]);
|
44
|
+
setList(_toConsumableArray(_list));
|
45
|
+
listRef.current = _list;
|
44
46
|
triggerChange({
|
45
47
|
list: _list
|
46
48
|
});
|
@@ -50,6 +52,7 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
50
52
|
return idx !== index;
|
51
53
|
});
|
52
54
|
setList(_list);
|
55
|
+
listRef.current = _list;
|
53
56
|
triggerChange({
|
54
57
|
list: _list
|
55
58
|
});
|
@@ -74,23 +77,27 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
74
77
|
});
|
75
78
|
};
|
76
79
|
var onListChange = function onListChange(v, index, key) {
|
77
|
-
var _list =
|
78
|
-
|
79
|
-
|
80
|
+
var _list = listRef.current;
|
81
|
+
if (key === 'alias' || key === 'outputView') {
|
82
|
+
_list[index]['sqlEdit'] = modifyComment(listRef.current[index].sqlEdit, v, key);
|
83
|
+
}
|
84
|
+
_list[index][key] = v;
|
85
|
+
listRef.current = _list;
|
86
|
+
setList(_toConsumableArray(_list));
|
80
87
|
triggerChange({
|
81
88
|
list: _list
|
82
89
|
});
|
83
90
|
};
|
84
91
|
React.useEffect(function () {
|
85
92
|
if (value) {
|
86
|
-
if (value
|
87
|
-
setView(value
|
93
|
+
if (value.view) {
|
94
|
+
setView(value.view);
|
88
95
|
}
|
89
|
-
if (value
|
90
|
-
setSelected(value
|
96
|
+
if (value.selected) {
|
97
|
+
setSelected(value.selected);
|
91
98
|
}
|
92
|
-
if (value
|
93
|
-
setList(value
|
99
|
+
if (value.list) {
|
100
|
+
setList(value.list);
|
94
101
|
}
|
95
102
|
}
|
96
103
|
}, [value]);
|
@@ -106,21 +113,16 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
106
113
|
}
|
107
114
|
}, /*#__PURE__*/React.createElement("div", {
|
108
115
|
style: {
|
109
|
-
border: '
|
116
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
110
117
|
height: '500px',
|
111
118
|
width: '100%'
|
112
119
|
}
|
113
|
-
}, /*#__PURE__*/React.createElement(Split, {
|
114
|
-
gutterSize: 2,
|
115
|
-
sizes: [7, 93],
|
116
|
-
direction: "vertical"
|
117
120
|
}, /*#__PURE__*/React.createElement("div", {
|
118
121
|
style: {
|
119
122
|
display: 'flex',
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
marginBottom: '6px'
|
123
|
+
zIndex: -1,
|
124
|
+
padding: '4px 8px',
|
125
|
+
borderBottom: '1px solid var(--ronds-metadata-color-border-1)'
|
124
126
|
}
|
125
127
|
}, /*#__PURE__*/React.createElement("span", {
|
126
128
|
style: {
|
@@ -158,12 +160,12 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
158
160
|
}))), /*#__PURE__*/React.createElement("div", {
|
159
161
|
style: {
|
160
162
|
padding: '8px',
|
161
|
-
height: '100%',
|
163
|
+
height: 'calc(100% - 40px)',
|
162
164
|
overflowY: 'auto',
|
163
165
|
width: '100%'
|
164
166
|
}
|
165
167
|
}, list.map(function (item, idx) {
|
166
|
-
var
|
168
|
+
var _getConfig;
|
167
169
|
return /*#__PURE__*/React.createElement("div", {
|
168
170
|
key: idx,
|
169
171
|
style: {
|
@@ -177,17 +179,11 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
177
179
|
border: '1px solid var(--ronds-metadata-color-border-1)',
|
178
180
|
width: '100%'
|
179
181
|
}
|
180
|
-
}, /*#__PURE__*/React.createElement(Split, {
|
181
|
-
gutterSize: 1,
|
182
|
-
sizes: [20, 80],
|
183
|
-
direction: "vertical"
|
184
182
|
}, /*#__PURE__*/React.createElement("div", {
|
185
183
|
style: {
|
186
184
|
display: 'flex',
|
187
|
-
|
188
|
-
|
189
|
-
marginRight: '10px',
|
190
|
-
marginBottom: '6px'
|
185
|
+
padding: '4px 8px',
|
186
|
+
borderBottom: '1px solid var(--ronds-metadata-color-border-1)'
|
191
187
|
}
|
192
188
|
}, /*#__PURE__*/React.createElement("span", null, tr('别名'), ' ', /*#__PURE__*/React.createElement(_Input, {
|
193
189
|
style: {
|
@@ -195,9 +191,9 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
195
191
|
marginLeft: '5px',
|
196
192
|
marginRight: '8px'
|
197
193
|
},
|
198
|
-
value:
|
194
|
+
value: item.alias,
|
199
195
|
onChange: function onChange(val) {
|
200
|
-
onListChange(val, idx, 'alias');
|
196
|
+
onListChange(val.target.value, idx, 'alias');
|
201
197
|
}
|
202
198
|
})), /*#__PURE__*/React.createElement("span", null, tr('输出视图'), ' ', /*#__PURE__*/React.createElement(_Input, {
|
203
199
|
style: {
|
@@ -207,24 +203,23 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
207
203
|
placeholder: '请输入',
|
208
204
|
value: item.outputView,
|
209
205
|
onChange: function onChange(val) {
|
210
|
-
return onListChange(val, idx, 'outputView');
|
206
|
+
return onListChange(val.target.value, idx, 'outputView');
|
211
207
|
}
|
212
208
|
}))), /*#__PURE__*/React.createElement("div", {
|
213
209
|
style: {
|
214
|
-
|
215
|
-
|
216
|
-
overflowY: 'auto'
|
210
|
+
padding: '4px',
|
211
|
+
zIndex: 99999
|
217
212
|
}
|
218
|
-
}, /*#__PURE__*/React.createElement(
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
213
|
+
}, /*#__PURE__*/React.createElement(CodeEdit, {
|
214
|
+
key: idx,
|
215
|
+
value: item.sqlEdit,
|
216
|
+
height: '100px',
|
217
|
+
mode: "pgsql",
|
218
|
+
theme: ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : _getConfig.theme) === 'normal' ? 'light' : 'vs-dark',
|
223
219
|
onChange: function onChange(val) {
|
224
220
|
return onListChange(val, idx, 'sqlEdit');
|
225
|
-
}
|
226
|
-
|
227
|
-
})))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
221
|
+
}
|
222
|
+
}))), /*#__PURE__*/React.createElement(MinusCircleOutlined, {
|
228
223
|
style: {
|
229
224
|
marginLeft: 'auto'
|
230
225
|
},
|
@@ -234,15 +229,8 @@ var SparkSqlTable = function SparkSqlTable(props) {
|
|
234
229
|
}));
|
235
230
|
}), /*#__PURE__*/React.createElement(_Button, {
|
236
231
|
type: "dashed",
|
237
|
-
onClick:
|
238
|
-
handleAddItem();
|
239
|
-
setList([].concat(_toConsumableArray(list), [{
|
240
|
-
alias: undefined,
|
241
|
-
outputView: undefined,
|
242
|
-
sqlEdit: undefined
|
243
|
-
}]));
|
244
|
-
},
|
232
|
+
onClick: handleAddItem,
|
245
233
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
246
|
-
}, tr('添加SQL语句')))))))
|
234
|
+
}, tr('添加SQL语句')))))));
|
247
235
|
};
|
248
236
|
export default SparkSqlTable;
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
4
|
/*
|
5
|
-
* @Author:
|
5
|
+
* @Author: wangxian
|
6
6
|
* @Date: 2021-09-18 14:15:04
|
7
7
|
* @LastEditTime: 2024-08-20 19:38:44
|
8
8
|
*/
|
@@ -19,3 +19,4 @@ export declare function assignReplace(pathArr: string[], val: any, obj: any): vo
|
|
19
19
|
export declare function flattenTreeData(treeData: any[]): any;
|
20
20
|
export declare function findTopParent(treeData: any[], value: string): any;
|
21
21
|
export declare const findTopParentIndex: (treeData: any[], key: string) => number;
|
22
|
+
export declare const modifyComment: (text: string, newOutput: string, type: string) => string;
|
@@ -11,7 +11,7 @@ var _excluded = ["children"];
|
|
11
11
|
/*
|
12
12
|
* @Author: wangxian
|
13
13
|
* @Date: 2021-09-18 14:15:04
|
14
|
-
* @LastEditTime:
|
14
|
+
* @LastEditTime: 2024-08-22 18:55:25
|
15
15
|
*/
|
16
16
|
import React from 'react';
|
17
17
|
import Input from './DataCell/Input';
|
@@ -178,4 +178,46 @@ export var findTopParentIndex = function findTopParentIndex(treeData, key) {
|
|
178
178
|
return traverse(node, [index]);
|
179
179
|
});
|
180
180
|
return topNodeIndex;
|
181
|
+
};
|
182
|
+
export var modifyComment = function modifyComment(text, newOutput, type) {
|
183
|
+
// 正则表达式匹配 /*+ 和 */ 之间的内容
|
184
|
+
var regex = /\/\*\+(.*?)\*\//;
|
185
|
+
// 查找匹配的内容
|
186
|
+
var match = text.match(regex);
|
187
|
+
if (match && match[1]) {
|
188
|
+
// 提取注释中的内容
|
189
|
+
var content = match[1].trim();
|
190
|
+
if (type === 'outputView') {
|
191
|
+
// 正则表达式匹配 output(...) 的内容
|
192
|
+
var outputRegex = /output\((.*?)\)/;
|
193
|
+
var outputMatch = content.match(outputRegex);
|
194
|
+
if (outputMatch) {
|
195
|
+
// 如果已经存在 output(...),则替换括号内的内容
|
196
|
+
content = content.replace(outputRegex, "output(".concat(newOutput, ")"));
|
197
|
+
} else {
|
198
|
+
// 如果不存在 output(...),则追加新的 output(...)
|
199
|
+
content += " output(".concat(newOutput, ")");
|
200
|
+
}
|
201
|
+
// 替换原始文本中的注释内容
|
202
|
+
var newText = text.replace(regex, "/*+ ".concat(content, " */"));
|
203
|
+
return newText;
|
204
|
+
}
|
205
|
+
if (type === 'alias') {
|
206
|
+
// 正则表达式匹配 output(...) 的内容
|
207
|
+
var aliasRegex = /name\((.*?)\)/;
|
208
|
+
var aliastMatch = content.match(aliasRegex);
|
209
|
+
if (aliastMatch) {
|
210
|
+
// 如果已经存在 output(...),则替换括号内的内容
|
211
|
+
content = content.replace(aliasRegex, "name(".concat(newOutput, ")"));
|
212
|
+
} else {
|
213
|
+
// 如果不存在 output(...),则追加新的 output(...)
|
214
|
+
content += " name(".concat(newOutput, ")");
|
215
|
+
}
|
216
|
+
// 替换原始文本中的注释内容
|
217
|
+
var _newText = text.replace(regex, "/*+ ".concat(content, " */"));
|
218
|
+
return _newText;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
// 如果没有匹配到,返回原始文本
|
222
|
+
return text;
|
181
223
|
};
|
package/es/config.js
CHANGED
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
/*
|
3
3
|
* @Author: wangxian
|
4
4
|
* @Date: 2021-09-18 14:15:04
|
5
|
-
* @LastEditTime: 2024-
|
5
|
+
* @LastEditTime: 2024-08-22 15:37:06
|
6
6
|
*/
|
7
7
|
import { BehaviorSubject, map, distinctUntilChanged } from 'rxjs';
|
8
8
|
import { setLocale } from './comps/locales/index';
|
@@ -41,6 +41,11 @@ globalSettingStream.pipe(map(function (p) {
|
|
41
41
|
'ru-RU': _objectSpread(_objectSpread({}, ruRU), p['ru-RU'])
|
42
42
|
});
|
43
43
|
});
|
44
|
+
var config = defaultConfig;
|
45
|
+
/** 设置配置 */
|
46
|
+
export var setConfig = function setConfig(opts) {
|
47
|
+
config = _objectSpread(_objectSpread({}, config), opts);
|
48
|
+
};
|
44
49
|
globalSettingStream.pipe(map(function (p) {
|
45
50
|
return p.theme;
|
46
51
|
}), distinctUntilChanged()).subscribe(function (p) {
|
@@ -48,12 +53,10 @@ globalSettingStream.pipe(map(function (p) {
|
|
48
53
|
window.jQuery('body').removeClass("".concat(cssPrefix, "-normal"));
|
49
54
|
window.jQuery('body').addClass("".concat(cssPrefix, "-").concat(p));
|
50
55
|
window.jQuery('html').removeAttr('data-prefers-color');
|
56
|
+
setConfig({
|
57
|
+
theme: p
|
58
|
+
});
|
51
59
|
});
|
52
|
-
var config = defaultConfig;
|
53
|
-
/** 设置配置 */
|
54
|
-
export var setConfig = function setConfig(opts) {
|
55
|
-
config = _objectSpread(_objectSpread({}, config), opts);
|
56
|
-
};
|
57
60
|
/** 获取单个配置 */
|
58
61
|
export function getConfigByKey(key) {
|
59
62
|
return config[key];
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"public": true,
|
3
3
|
"name": "ronds-metadata",
|
4
|
-
"version": "1.3.
|
4
|
+
"version": "1.3.79",
|
5
5
|
"scripts": {
|
6
6
|
"start": "dumi dev",
|
7
7
|
"docs:build": "dumi build",
|
@@ -44,7 +44,7 @@
|
|
44
44
|
"@milkdown/react": "^7.3.0",
|
45
45
|
"@milkdown/theme-nord": "^7.3.0",
|
46
46
|
"@milkdown/transformer": "^7.3.0",
|
47
|
-
"@monaco-editor/react": "
|
47
|
+
"@monaco-editor/react": "4.4.6",
|
48
48
|
"@popperjs/core": "^2.4.4",
|
49
49
|
"@types/file-saver": "^2.0.5",
|
50
50
|
"@types/markdown-it": "^12.2.3",
|