ronds-metadata 1.3.74 → 1.3.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. package/es/api/index.js +1 -1
  2. package/es/comps/MetadataForm/DataCell/Input.js +7 -41
  3. package/es/comps/MetadataForm/DataCell/business/config.d.ts +203 -3
  4. package/es/comps/MetadataForm/DataCell/business/config.js +239 -9
  5. package/es/comps/MetadataForm/DataCell/business/index.js +9 -1
  6. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +10 -0
  7. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +103 -0
  8. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.d.ts +2 -0
  9. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.js +8 -4
  10. package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.d.ts +6 -1
  11. package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.js +74 -11
  12. package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.d.ts +10 -0
  13. package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.js +118 -0
  14. package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.d.ts +3 -1
  15. package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.js +73 -13
  16. package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.js +35 -8
  17. package/es/comps/MetadataForm/DataCell/plugin/MapTable.d.ts +1 -0
  18. package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +23 -8
  19. package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.d.ts +1 -2
  20. package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +20 -3
  21. package/es/comps/MetadataForm/HOC/index.js +1 -1
  22. package/es/comps/MetadataForm/index.less +29 -26
  23. package/package.json +1 -1
@@ -17,7 +17,9 @@ import React from 'react';
17
17
  import KafkaDatasource from './Kafka';
18
18
  import { LinkOutlined } from '@ant-design/icons';
19
19
  import PostgreSQLDatasource from './PostgreSQL';
20
- import { useGetDatasource } from './hooks';
20
+ import { useGetDatasource, useGetLabelCol, useGetWrapperCol } from './hooks';
21
+ import CassandraDatasource from './Cassandra';
22
+ import SqlServerDatasource from './SqlServer';
21
23
  var DataSource = function DataSource(props) {
22
24
  var _extraInfo$datasource2;
23
25
  var extraInfo = props.extraInfo,
@@ -34,6 +36,8 @@ var DataSource = function DataSource(props) {
34
36
  setDatasource = _React$useState4[1];
35
37
  var valueRef = React.useRef({});
36
38
  var datasourceOpts = useGetDatasource(dsType);
39
+ var labelCol = useGetLabelCol(extraInfo);
40
+ var wrapperCol = useGetWrapperCol(extraInfo);
37
41
  var datasourceTypeOpts = React.useMemo(function () {
38
42
  var _extraInfo$datasource;
39
43
  var typeEnum = (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$datasource = extraInfo.datasource) === null || _extraInfo$datasource === void 0 ? void 0 : _extraInfo$datasource.type) || [];
@@ -50,6 +54,7 @@ var DataSource = function DataSource(props) {
50
54
  };
51
55
  var onDatasourceTypeChange = function onDatasourceTypeChange(value) {
52
56
  setDsType(value);
57
+ setDatasource('');
53
58
  triggerChange({
54
59
  dsType: value
55
60
  });
@@ -61,9 +66,11 @@ var DataSource = function DataSource(props) {
61
66
  }, JSON.parse(value)));
62
67
  };
63
68
  var onKafkaChange = function onKafkaChange(value) {
64
- triggerChange({
65
- topics: value
66
- });
69
+ triggerChange(_objectSpread({}, value));
70
+ };
71
+ var onPgSqlChange = function onPgSqlChange(value) {};
72
+ var onCassandraChange = function onCassandraChange(value) {
73
+ triggerChange(_objectSpread({}, value));
67
74
  };
68
75
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
69
76
  style: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.borderHidden) ? {
@@ -79,7 +86,7 @@ var DataSource = function DataSource(props) {
79
86
  }
80
87
  }, /*#__PURE__*/React.createElement(_Col, {
81
88
  span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
82
- flex: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? "0 0 ".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) * 100 / 24, "%") : ''
89
+ flex: labelCol
83
90
  }, /*#__PURE__*/React.createElement("div", {
84
91
  className: "ant-form-item-label",
85
92
  style: {
@@ -90,7 +97,7 @@ var DataSource = function DataSource(props) {
90
97
  }, /*#__PURE__*/React.createElement("label", {
91
98
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
92
99
  }, tr('数据源')))), /*#__PURE__*/React.createElement(_Col, {
93
- flex: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? "0 0 ".concat((24 - (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan)) * 100 / 24, "%") : 1,
100
+ flex: wrapperCol,
94
101
  style: {
95
102
  paddingBottom: '8px'
96
103
  }
@@ -101,6 +108,7 @@ var DataSource = function DataSource(props) {
101
108
  style: {
102
109
  width: '30%'
103
110
  },
111
+ value: dsType,
104
112
  options: datasourceTypeOpts,
105
113
  onChange: onDatasourceTypeChange
106
114
  }), /*#__PURE__*/React.createElement(_Select, {
@@ -108,6 +116,7 @@ var DataSource = function DataSource(props) {
108
116
  style: {
109
117
  width: 'calc(70% - 32px)'
110
118
  },
119
+ value: datasource,
111
120
  options: datasourceOpts,
112
121
  onChange: onDatasourceChange
113
122
  }), /*#__PURE__*/React.createElement(_Tooltip, {
@@ -118,11 +127,29 @@ var DataSource = function DataSource(props) {
118
127
  }, /*#__PURE__*/React.createElement(_Button, {
119
128
  icon: /*#__PURE__*/React.createElement(LinkOutlined, null)
120
129
  })))), dsType === 'Kafka' && /*#__PURE__*/React.createElement(KafkaDatasource, {
130
+ wrapperCol: wrapperCol,
131
+ labelCol: labelCol,
121
132
  extraInfo: extraInfo,
122
133
  datasource: datasource,
123
134
  onChange: onKafkaChange
124
- }), dsType === 'PgSql' && /*#__PURE__*/React.createElement(PostgreSQLDatasource, {
125
- extraInfo: extraInfo
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
126
153
  }))));
127
154
  };
128
155
  export default DataSource;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  interface IMapTableProps {
3
+ extraInfo?: any;
3
4
  value?: any;
4
5
  onChange?: (value: any) => void;
5
6
  }
@@ -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],
@@ -42,6 +48,7 @@ var MapTable = function MapTable(props) {
42
48
  var targetEditableStreamRef = React.useRef();
43
49
  var _React$useContext = React.useContext(MetadataFormContext),
44
50
  form = _React$useContext.form;
51
+ var labelCol = useGetLabelCol(extraInfo);
45
52
  var triggerChange = function triggerChange(changedValue) {
46
53
  onChange && onChange(_objectSpread({
47
54
  mapping: mapping,
@@ -107,16 +114,24 @@ var MapTable = function MapTable(props) {
107
114
  }, [disableArray]);
108
115
  React.useEffect(function () {
109
116
  var values = form.getFieldsValue().mapTable;
110
- values.dataSource && setTableDataSource(values.dataSource);
111
- values.dataTarget && setTableDataTarget(values.dataTarget);
112
- values.options && setOptions(values.options);
113
- if (!disableArray && values.dataSource && values.dataTarget) {
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)) {
114
121
  var _values$dataSource, _values$dataTarget;
115
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);
116
123
  setDisableArray(valueArray);
117
124
  }
118
125
  }, [form.getFieldsValue()]);
119
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
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", {
120
135
  style: {
121
136
  width: '100%',
122
137
  height: '100%'
@@ -138,7 +153,7 @@ var MapTable = function MapTable(props) {
138
153
  width: '100%',
139
154
  height: '100%'
140
155
  }
141
- }, /*#__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", {
142
157
  style: {
143
158
  width: '40%'
144
159
  }
@@ -190,7 +205,7 @@ var MapTable = function MapTable(props) {
190
205
  },
191
206
  onRowClick: function onRowClick(record) {},
192
207
  onMove: onTargetMove
193
- })))));
208
+ }))))))));
194
209
  };
195
210
  export default MapTable;
196
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
- onSearch?: (data: any) => void;
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: 2024-08-20 18:59:44
8
+ * @LastEditTime: 2024-08-21 09:26:31
9
9
  */
10
10
  import React from 'react';
11
11
  import { deepClone } from '../../../utils';
@@ -1,26 +1,29 @@
1
- .metadata-form {
2
- // .ant-row {
3
- // display: flex !important;
4
- // }
5
- .ant-form-item {
6
- margin: 0 !important;
7
- // flex-wrap: nowrap !important;
8
- }
9
- .ant-form-item-label > label .ant-form-item-tooltip {
10
- margin-left: 5px;
11
- }
12
- .ant-form-item-label {
13
- padding: 0 0 2px !important;
14
- }
15
-
16
- // .ant-select-selection-overflow {
17
- // flex-wrap: nowrap;
18
- // overflow: hidden !important;
19
- // min-height: 26px;
20
- // }
21
-
22
- .ant-input-number,
23
- .ant-picker {
24
- width: 100%;
25
- }
26
- }
1
+ .metadata-form {
2
+ // .ant-row {
3
+ // display: flex !important;
4
+ // }
5
+ .ant-form-item {
6
+ margin: 0 !important;
7
+ // flex-wrap: nowrap !important;
8
+ }
9
+ .ant-form-item-label > label .ant-form-item-tooltip {
10
+ margin-left: 5px;
11
+ }
12
+ .ant-form-item-label {
13
+ padding: 0 0 2px !important;
14
+ }
15
+
16
+ // .ant-select-selection-overflow {
17
+ // flex-wrap: nowrap;
18
+ // overflow: hidden !important;
19
+ // min-height: 26px;
20
+ // }
21
+
22
+ .ant-input-number,
23
+ .ant-picker {
24
+ width: 100%;
25
+ }
26
+ .ant-form-item-no-colon {
27
+ width: 0 !important;
28
+ }
29
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.3.74",
4
+ "version": "1.3.75",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",