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.
Files changed (26) hide show
  1. package/es/api/index.js +2 -2
  2. package/es/comps/MetadataForm/DataCell/Input.js +33 -9
  3. package/es/comps/MetadataForm/DataCell/business/config.d.ts +286 -0
  4. package/es/comps/MetadataForm/DataCell/business/config.js +322 -0
  5. package/es/comps/MetadataForm/DataCell/business/index.d.ts +9 -0
  6. package/es/comps/MetadataForm/DataCell/business/index.js +31 -0
  7. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.d.ts +10 -0
  8. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Cassandra.js +103 -0
  9. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.d.ts +9 -0
  10. package/es/comps/MetadataForm/DataCell/plugin/Datasource/Kafka.js +47 -0
  11. package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.d.ts +10 -0
  12. package/es/comps/MetadataForm/DataCell/plugin/Datasource/PostgreSQL.js +123 -0
  13. package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.d.ts +10 -0
  14. package/es/comps/MetadataForm/DataCell/plugin/Datasource/SqlServer.js +118 -0
  15. package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.d.ts +3 -0
  16. package/es/comps/MetadataForm/DataCell/plugin/Datasource/hooks.js +129 -0
  17. package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.d.ts +9 -0
  18. package/es/comps/MetadataForm/DataCell/plugin/Datasource/index.js +155 -0
  19. package/es/comps/MetadataForm/DataCell/plugin/MapTable.d.ts +1 -0
  20. package/es/comps/MetadataForm/DataCell/plugin/MapTable.js +30 -22
  21. package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.d.ts +1 -2
  22. package/es/comps/MetadataForm/DataCell/plugin/SparkSqlTable.js +20 -3
  23. package/es/comps/MetadataForm/HOC/index.js +1 -1
  24. package/es/comps/MetadataForm/hooks/index.js +6 -1
  25. package/es/comps/MetadataForm/index.less +29 -26
  26. package/package.json +1 -1
@@ -0,0 +1,322 @@
1
+ /*
2
+ * @Author: wangxian
3
+ * @Date: 2024-08-20 19:43:42
4
+ * @LastEditTime: 2024-08-21 09:07:58
5
+ */
6
+ var ETL_SOURCE_SCHEMA = [{
7
+ id: 'FormGenerator',
8
+ type: 'object',
9
+ properties: [{
10
+ id: 'datasource',
11
+ type: 'text',
12
+ fields: [{
13
+ id: 'Rule.Form',
14
+ type: 'ref',
15
+ refId: 'com.ronds.schema.default.Rule.Form',
16
+ value: {
17
+ common: {
18
+ label: '数据源配置',
19
+ require: true,
20
+ titleHidden: true,
21
+ borderHidden: true,
22
+ // labelSpan: 2,
23
+ colSpan: 2
24
+ },
25
+ 'common-en-US': {},
26
+ text: {
27
+ type: 'datasource',
28
+ datasource: {
29
+ type: ['Kafka', 'PostgreSql', 'Minio', 'SqlServer'],
30
+ kafka: {
31
+ isMutiple: true
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }]
37
+ }, {
38
+ id: 'autoOffsetReset',
39
+ type: 'enum',
40
+ enum: [{
41
+ value: 'earliest'
42
+ }, {
43
+ value: 'latest'
44
+ }],
45
+ fields: [{
46
+ id: 'Rule.Form',
47
+ type: 'ref',
48
+ refId: 'com.ronds.schema.default.Rule.Form',
49
+ value: {
50
+ common: {
51
+ label: '消费策略',
52
+ require: true,
53
+ // labelSpan: 4,
54
+ depend: {
55
+ show: 'datasource.dsType=="Kafka"'
56
+ }
57
+ },
58
+ 'common-en-US': {}
59
+ }
60
+ }]
61
+ }, {
62
+ id: 'batchDuration',
63
+ type: 'number',
64
+ fields: [{
65
+ id: 'Rule.Form',
66
+ type: 'ref',
67
+ refId: 'com.ronds.schema.default.Rule.Form',
68
+ value: {
69
+ common: {
70
+ label: '批间隔',
71
+ require: true,
72
+ // labelSpan: 4,
73
+ depend: {
74
+ show: 'datasource.dsType=="Kafka"'
75
+ }
76
+ },
77
+ 'common-en-US': {}
78
+ }
79
+ }]
80
+ }, {
81
+ id: 'fetchsize',
82
+ type: 'number',
83
+ fields: [{
84
+ id: 'Rule.Form',
85
+ type: 'ref',
86
+ refId: 'com.ronds.schema.default.Rule.Form',
87
+ value: {
88
+ common: {
89
+ label: '获取尺寸',
90
+ require: true,
91
+ labelSpan: 4,
92
+ depend: {
93
+ show: 'datasource.dsType=="PostgreSql" || datasource.dsType=="SqlServer"'
94
+ }
95
+ },
96
+ 'common-en-US': {}
97
+ }
98
+ }]
99
+ }, {
100
+ id: 'sql',
101
+ type: 'text',
102
+ fields: [{
103
+ id: 'Rule.Form',
104
+ type: 'ref',
105
+ refId: 'com.ronds.schema.default.Rule.Form',
106
+ value: {
107
+ common: {
108
+ label: 'SQL',
109
+ require: true,
110
+ labelSpan: 4,
111
+ depend: {
112
+ show: 'datasource.dsType=="PostgreSql" || datasource.dsType=="SqlServer"'
113
+ }
114
+ },
115
+ 'common-en-US': {}
116
+ }
117
+ }]
118
+ }, {
119
+ id: 'filepath',
120
+ type: 'text',
121
+ fields: [{
122
+ id: 'com.ronds.schema.default.Rule.Form',
123
+ type: 'ref',
124
+ refId: 'com.ronds.schema.default.Rule.Form',
125
+ value: {
126
+ common: {
127
+ id: 'filepath',
128
+ label: '文件上传',
129
+ depend: {
130
+ show: 'datasource.dsType=="Minio"'
131
+ }
132
+ },
133
+ text: {
134
+ type: 'upload'
135
+ }
136
+ }
137
+ }]
138
+ }, {
139
+ id: 'headers',
140
+ type: 'array',
141
+ fields: [{
142
+ id: 'com.ronds.schema.default.Rule.Form',
143
+ type: 'ref',
144
+ refId: 'com.ronds.schema.default.Rule.Form',
145
+ value: {
146
+ common: {
147
+ id: 'headers',
148
+ label: '文件信息',
149
+ colSpan: 2,
150
+ depend: {
151
+ show: 'datasource.dsType=="Minio"'
152
+ }
153
+ },
154
+ array: {
155
+ layout: 'table'
156
+ }
157
+ }
158
+ }],
159
+ items: {
160
+ type: 'ref',
161
+ refId: 'headers_ref'
162
+ }
163
+ }, {
164
+ id: 'sparkSql',
165
+ type: 'text',
166
+ fields: [{
167
+ id: 'Rule.Form',
168
+ type: 'ref',
169
+ refId: 'com.ronds.schema.default.Rule.Form',
170
+ value: {
171
+ common: {
172
+ label: 'Spark Sql',
173
+ colSpan: 2,
174
+ labelSpan: 4,
175
+ require: true
176
+ },
177
+ 'common-en-US': {},
178
+ text: {
179
+ type: 'sparkSqlTable',
180
+ sparkSqlTable: {
181
+ extraDico: [],
182
+ initSql: 'select * from raw.ChannerlLog'
183
+ }
184
+ }
185
+ }
186
+ }]
187
+ }],
188
+ fields: [{
189
+ id: 'com.ronds.schema.default.Rule.Form',
190
+ type: 'ref',
191
+ refId: 'com.ronds.schema.default.Rule.Form',
192
+ value: {
193
+ colSpan: 12,
194
+ labelSpan: 4,
195
+ layout: 'horizontal'
196
+ }
197
+ }],
198
+ types: [{
199
+ id: 'headers_ref',
200
+ type: 'object',
201
+ properties: [{
202
+ id: 'input_fc05',
203
+ type: 'text',
204
+ fields: [{
205
+ id: 'com.ronds.schema.default.Rule.Form',
206
+ type: 'ref',
207
+ refId: 'com.ronds.schema.default.Rule.Form',
208
+ value: {
209
+ common: {
210
+ id: 'sheetname',
211
+ label: '页名',
212
+ depend: {}
213
+ },
214
+ text: {}
215
+ }
216
+ }]
217
+ }, {
218
+ id: 'input_ae91',
219
+ type: 'number',
220
+ fields: [{
221
+ id: 'com.ronds.schema.default.Rule.Form',
222
+ type: 'ref',
223
+ refId: 'com.ronds.schema.default.Rule.Form',
224
+ value: {
225
+ common: {
226
+ id: 'header',
227
+ label: '表头位置',
228
+ depend: {}
229
+ },
230
+ text: {}
231
+ }
232
+ }]
233
+ }]
234
+ }]
235
+ }];
236
+ var ETL_DIRECTION_SCHEMA = [{
237
+ id: 'FormGenerator',
238
+ type: 'object',
239
+ properties: [{
240
+ id: 'datasource',
241
+ type: 'text',
242
+ fields: [{
243
+ id: 'Rule.Form',
244
+ type: 'ref',
245
+ refId: 'com.ronds.schema.default.Rule.Form',
246
+ value: {
247
+ common: {
248
+ label: '数据源配置',
249
+ require: true,
250
+ titleHidden: true,
251
+ borderHidden: true,
252
+ // labelSpan: 2,
253
+ colSpan: 2
254
+ },
255
+ 'common-en-US': {},
256
+ text: {
257
+ type: 'datasource',
258
+ datasource: {
259
+ type: ['Cassandra', 'PostgreSql', 'Minio', 'SqlServer'],
260
+ kafka: {
261
+ isMutiple: true
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }]
267
+ }, {
268
+ id: 'filepath',
269
+ type: 'text',
270
+ fields: [{
271
+ id: 'Rule.Form',
272
+ type: 'ref',
273
+ refId: 'com.ronds.schema.default.Rule.Form',
274
+ value: {
275
+ common: {
276
+ label: '文件路径',
277
+ require: true,
278
+ labelSpan: 4,
279
+ colSpan: 2,
280
+ depend: {
281
+ show: 'datasource.dsType=="Minio"'
282
+ }
283
+ },
284
+ 'common-en-US': {}
285
+ }
286
+ }]
287
+ }, {
288
+ id: 'mapTable',
289
+ type: 'text',
290
+ fields: [{
291
+ id: 'Rule.Form',
292
+ type: 'ref',
293
+ refId: 'com.ronds.schema.default.Rule.Form',
294
+ value: {
295
+ common: {
296
+ label: '字段映射',
297
+ colSpan: 2,
298
+ labelSpan: 4
299
+ },
300
+ 'common-en-US': {},
301
+ text: {
302
+ type: 'mapTable',
303
+ mapTable: {}
304
+ }
305
+ }
306
+ }]
307
+ }],
308
+ fields: [{
309
+ id: 'com.ronds.schema.default.Rule.Form',
310
+ type: 'ref',
311
+ refId: 'com.ronds.schema.default.Rule.Form',
312
+ value: {
313
+ colSpan: 12,
314
+ labelSpan: 4,
315
+ layout: 'horizontal'
316
+ }
317
+ }]
318
+ }];
319
+ export var BusinessSchema = {
320
+ etl_source: ETL_SOURCE_SCHEMA,
321
+ etl_direction: ETL_DIRECTION_SCHEMA
322
+ };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface IBusinessFormProps {
3
+ extraInfo?: any;
4
+ disabled?: boolean;
5
+ value?: any;
6
+ onChange?: (value: any) => void;
7
+ }
8
+ declare const BusinessForm: (props: IBusinessFormProps) => React.JSX.Element;
9
+ export default BusinessForm;
@@ -0,0 +1,31 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import MetadataForm from '../..';
3
+ import { BusinessSchema } from './config';
4
+ import React from 'react';
5
+ var BusinessForm = function BusinessForm(props) {
6
+ var _extraInfo$bussiness2;
7
+ var extraInfo = props.extraInfo,
8
+ disabled = props.disabled,
9
+ value = props.value,
10
+ onChange = props.onChange;
11
+ var schema = React.useMemo(function () {
12
+ var _extraInfo$bussiness;
13
+ return BusinessSchema[extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$bussiness = extraInfo.bussiness) === null || _extraInfo$bussiness === void 0 ? void 0 : _extraInfo$bussiness.type];
14
+ }, [extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$bussiness2 = extraInfo.bussiness) === null || _extraInfo$bussiness2 === void 0 ? void 0 : _extraInfo$bussiness2.type]);
15
+ var valueRef = React.useRef({});
16
+ var triggerChange = function triggerChange(changedValue) {
17
+ valueRef.current = _objectSpread(_objectSpread({}, valueRef.current), changedValue);
18
+ onChange && onChange(valueRef.current);
19
+ };
20
+ var onValuesChange = function onValuesChange(values, allVals) {
21
+ triggerChange(values);
22
+ };
23
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(MetadataForm, {
24
+ schema: schema,
25
+ getFormInstance: function getFormInstance(form) {
26
+ // formRef.current = form;
27
+ },
28
+ onValuesChange: onValuesChange
29
+ }));
30
+ };
31
+ export default BusinessForm;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface ICassandraDatasourceProps {
3
+ extraInfo?: any;
4
+ datasource?: any;
5
+ wrapperCol: string;
6
+ labelCol: string;
7
+ onChange?: any;
8
+ }
9
+ declare const CassandraDatasource: (props: ICassandraDatasourceProps) => React.JSX.Element;
10
+ export default CassandraDatasource;
@@ -0,0 +1,103 @@
1
+ import "antd/es/input/style";
2
+ import _Input from "antd/es/input";
3
+ import "antd/es/tooltip/style";
4
+ import _Tooltip from "antd/es/tooltip";
5
+ import "antd/es/button/style";
6
+ import _Button from "antd/es/button";
7
+ import "antd/es/select/style";
8
+ import _Select from "antd/es/select";
9
+ import "antd/es/col/style";
10
+ import _Col from "antd/es/col";
11
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
12
+ import { tr } from '@/framework/locale';
13
+ import React from 'react';
14
+ import { useGetDatasource } from './hooks';
15
+ import { PlusOutlined } from '@ant-design/icons';
16
+ var CassandraDatasource = function CassandraDatasource(props) {
17
+ var _extraInfo$datasource, _extraInfo$datasource2, _extraInfo$datasource3, _extraInfo$datasource4;
18
+ var extraInfo = props.extraInfo,
19
+ datasource = props.datasource,
20
+ onChange = props.onChange,
21
+ wrapperCol = props.wrapperCol,
22
+ labelCol = props.labelCol;
23
+ var _React$useState = React.useState(),
24
+ _React$useState2 = _slicedToArray(_React$useState, 2),
25
+ keySpace = _React$useState2[0],
26
+ setKeySpace = _React$useState2[1];
27
+ var keySpaceOpts = useGetDatasource('Cassandra', 2, datasource);
28
+ var dataTableOpts = useGetDatasource('Cassandra', 3, datasource, keySpace ? JSON.parse(keySpace).name : undefined);
29
+ var onKeySpaceChange = function onKeySpaceChange(value) {
30
+ debugger;
31
+ setKeySpace(value);
32
+ onChange && onChange({
33
+ keyspace: value
34
+ });
35
+ };
36
+ var onDataTableChange = function onDataTableChange(value) {
37
+ onChange && onChange({
38
+ dt: value
39
+ });
40
+ };
41
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
42
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
43
+ flex: labelCol
44
+ }, /*#__PURE__*/React.createElement("label", {
45
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
46
+ }, /*#__PURE__*/React.createElement("div", {
47
+ className: "ant-form-item-label",
48
+ style: {
49
+ width: '100%',
50
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
51
+ flex: '1'
52
+ }
53
+ }, /*#__PURE__*/React.createElement("label", {
54
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
55
+ }, tr('键空间'))))), /*#__PURE__*/React.createElement(_Col, {
56
+ flex: wrapperCol,
57
+ style: {
58
+ paddingBottom: '8px'
59
+ }
60
+ }, /*#__PURE__*/React.createElement(_Select, {
61
+ 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
+ allowClear: true,
63
+ options: keySpaceOpts,
64
+ onChange: onKeySpaceChange
65
+ })), /*#__PURE__*/React.createElement(_Col, {
66
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
67
+ flex: labelCol
68
+ }, /*#__PURE__*/React.createElement("label", {
69
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
70
+ }, /*#__PURE__*/React.createElement("div", {
71
+ className: "ant-form-item-label",
72
+ style: {
73
+ width: '100%',
74
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
75
+ flex: '1'
76
+ }
77
+ }, /*#__PURE__*/React.createElement("label", {
78
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
79
+ }, tr('数据表'))))), /*#__PURE__*/React.createElement(_Col, {
80
+ flex: wrapperCol,
81
+ style: {
82
+ paddingBottom: '8px'
83
+ }
84
+ }, /*#__PURE__*/React.createElement(_Input.Group, {
85
+ compact: true
86
+ }, /*#__PURE__*/React.createElement(_Select, {
87
+ 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
+ allowClear: true,
89
+ options: dataTableOpts,
90
+ onChange: onDataTableChange,
91
+ style: {
92
+ width: 'calc(100% - 32px)'
93
+ }
94
+ }), /*#__PURE__*/React.createElement(_Tooltip, {
95
+ title: tr('手动建表'),
96
+ style: {
97
+ width: '32px'
98
+ }
99
+ }, /*#__PURE__*/React.createElement(_Button, {
100
+ icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
101
+ })))));
102
+ };
103
+ export default CassandraDatasource;
@@ -0,0 +1,9 @@
1
+ interface IKafkaDatasourceProps {
2
+ extraInfo?: any;
3
+ datasource?: any;
4
+ wrapperCol: string;
5
+ labelCol: string;
6
+ onChange?: any;
7
+ }
8
+ declare const KafkaDatasource: (props: IKafkaDatasourceProps) => import("react").JSX.Element;
9
+ export default KafkaDatasource;
@@ -0,0 +1,47 @@
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 React from "react";
6
+ import { tr } from '../../../../../framework/locale';
7
+ import { useGetDatasource } from './hooks';
8
+ var KafkaDatasource = function KafkaDatasource(props) {
9
+ var _extraInfo$datasource, _extraInfo$datasource2;
10
+ var extraInfo = props.extraInfo,
11
+ datasource = props.datasource,
12
+ onChange = props.onChange,
13
+ wrapperCol = props.wrapperCol,
14
+ labelCol = props.labelCol;
15
+ var topicOpts = useGetDatasource('Kafka', 2, datasource);
16
+ var onTopicChange = function onTopicChange(value) {
17
+ onChange && onChange({
18
+ topics: value
19
+ });
20
+ };
21
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
22
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
23
+ flex: labelCol
24
+ }, /*#__PURE__*/React.createElement("label", {
25
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "ant-form-item-label",
28
+ style: {
29
+ width: '100%',
30
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
31
+ flex: '1'
32
+ }
33
+ }, /*#__PURE__*/React.createElement("label", {
34
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
35
+ }, tr('主题'))))), /*#__PURE__*/React.createElement(_Col, {
36
+ flex: wrapperCol,
37
+ style: {
38
+ paddingBottom: '8px'
39
+ }
40
+ }, /*#__PURE__*/React.createElement(_Select, {
41
+ 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,
42
+ allowClear: true,
43
+ options: topicOpts,
44
+ onChange: onTopicChange
45
+ })));
46
+ };
47
+ export default KafkaDatasource;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface IPostgreSQLDatasourceProps {
3
+ extraInfo?: any;
4
+ wrapperCol: string;
5
+ labelCol: string;
6
+ datasource?: any;
7
+ onChange?: any;
8
+ }
9
+ declare const PostgreSQLDatasource: (props: IPostgreSQLDatasourceProps) => React.JSX.Element;
10
+ export default PostgreSQLDatasource;
@@ -0,0 +1,123 @@
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
+ /*
7
+ * @Author: wangxian
8
+ * @Date: 2024-08-20 14:32:52
9
+ * @LastEditTime: 2024-08-21 10:11:43
10
+ */
11
+ import { tr } from '../../../../../framework/locale';
12
+ import { useGetDatasource } from './hooks';
13
+ import React from 'react';
14
+ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
15
+ var _extraInfo$datasource, _extraInfo$datasource2, _extraInfo$datasource3, _extraInfo$datasource4, _extraInfo$datasource5, _extraInfo$datasource6;
16
+ var extraInfo = props.extraInfo,
17
+ wrapperCol = props.wrapperCol,
18
+ labelCol = props.labelCol,
19
+ datasource = props.datasource,
20
+ onChange = props.onChange;
21
+ var _React$useState = React.useState(),
22
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23
+ dataBase = _React$useState2[0],
24
+ setDataBase = _React$useState2[1];
25
+ var _React$useState3 = React.useState(),
26
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
27
+ schema = _React$useState4[0],
28
+ setSchema = _React$useState4[1];
29
+ var dataBaseOpts = useGetDatasource('PostgreSql', 2, datasource);
30
+ var schemaOpts = useGetDatasource('PostgreSql', 3, datasource, dataBase ? JSON.parse(dataBase).name : undefined);
31
+ var dataTableOpts = useGetDatasource('PostgreSql', 4, datasource, dataBase ? JSON.parse(dataBase).name : undefined, schema ? JSON.parse(schema).name : undefined);
32
+ var onDataBaseChange = function onDataBaseChange(value) {
33
+ setDataBase(value);
34
+ onChange && onChange({
35
+ db: value
36
+ });
37
+ };
38
+ var onSchemaChange = function onSchemaChange(value) {
39
+ setSchema(value);
40
+ onChange && onChange({
41
+ schema: value
42
+ });
43
+ };
44
+ var onDataTableChange = function onDataTableChange(value) {
45
+ onChange && onChange({
46
+ dt: value
47
+ });
48
+ };
49
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
50
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
51
+ flex: labelCol
52
+ }, /*#__PURE__*/React.createElement("label", {
53
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
54
+ }, /*#__PURE__*/React.createElement("div", {
55
+ className: "ant-form-item-label",
56
+ style: {
57
+ width: '100%',
58
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
59
+ flex: '1'
60
+ }
61
+ }, /*#__PURE__*/React.createElement("label", {
62
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
63
+ }, tr('数据库'))))), /*#__PURE__*/React.createElement(_Col, {
64
+ flex: wrapperCol,
65
+ style: {
66
+ paddingBottom: '8px'
67
+ }
68
+ }, /*#__PURE__*/React.createElement(_Select, {
69
+ 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
+ allowClear: true,
71
+ options: dataBaseOpts,
72
+ onChange: onDataBaseChange
73
+ })), /*#__PURE__*/React.createElement(_Col, {
74
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
75
+ flex: labelCol
76
+ }, /*#__PURE__*/React.createElement("label", {
77
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
78
+ }, /*#__PURE__*/React.createElement("div", {
79
+ className: "ant-form-item-label",
80
+ style: {
81
+ width: '100%',
82
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
83
+ flex: '1'
84
+ }
85
+ }, /*#__PURE__*/React.createElement("label", {
86
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
87
+ }, tr('模式'))))), /*#__PURE__*/React.createElement(_Col, {
88
+ flex: wrapperCol,
89
+ style: {
90
+ paddingBottom: '8px'
91
+ }
92
+ }, /*#__PURE__*/React.createElement(_Select, {
93
+ 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
+ allowClear: true,
95
+ options: schemaOpts,
96
+ onChange: onSchemaChange
97
+ })), /*#__PURE__*/React.createElement(_Col, {
98
+ span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
99
+ flex: labelCol
100
+ }, /*#__PURE__*/React.createElement("label", {
101
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ className: "ant-form-item-label",
104
+ style: {
105
+ width: '100%',
106
+ textAlign: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'horizontal' ? 'right' : 'left'),
107
+ flex: '1'
108
+ }
109
+ }, /*#__PURE__*/React.createElement("label", {
110
+ className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
111
+ }, tr('数据表'))))), /*#__PURE__*/React.createElement(_Col, {
112
+ flex: wrapperCol,
113
+ style: {
114
+ paddingBottom: '8px'
115
+ }
116
+ }, /*#__PURE__*/React.createElement(_Select, {
117
+ 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
+ allowClear: true,
119
+ options: dataTableOpts,
120
+ onChange: onDataTableChange
121
+ })));
122
+ };
123
+ export default PostgreSQLDatasource;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface ISqlServerDatasourceProps {
3
+ extraInfo?: any;
4
+ datasource?: any;
5
+ wrapperCol: string;
6
+ labelCol: string;
7
+ onChange?: any;
8
+ }
9
+ declare const SqlServerDatasource: (props: ISqlServerDatasourceProps) => React.JSX.Element;
10
+ export default SqlServerDatasource;