ronds-metadata 1.3.74 → 1.3.76

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 +26 -11
  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
@@ -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;
@@ -1,6 +1,8 @@
1
1
  interface IKafkaDatasourceProps {
2
2
  extraInfo?: any;
3
3
  datasource?: any;
4
+ wrapperCol: string;
5
+ labelCol: string;
4
6
  onChange?: any;
5
7
  }
6
8
  declare const KafkaDatasource: (props: IKafkaDatasourceProps) => import("react").JSX.Element;
@@ -9,14 +9,18 @@ var KafkaDatasource = function KafkaDatasource(props) {
9
9
  var _extraInfo$datasource, _extraInfo$datasource2;
10
10
  var extraInfo = props.extraInfo,
11
11
  datasource = props.datasource,
12
- onChange = props.onChange;
12
+ onChange = props.onChange,
13
+ wrapperCol = props.wrapperCol,
14
+ labelCol = props.labelCol;
13
15
  var topicOpts = useGetDatasource('Kafka', 2, datasource);
14
16
  var onTopicChange = function onTopicChange(value) {
15
- onChange && onChange(value);
17
+ onChange && onChange({
18
+ topics: value
19
+ });
16
20
  };
17
21
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
18
22
  span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
19
- 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, "%") : ''
23
+ flex: labelCol
20
24
  }, /*#__PURE__*/React.createElement("label", {
21
25
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
22
26
  }, /*#__PURE__*/React.createElement("div", {
@@ -29,7 +33,7 @@ var KafkaDatasource = function KafkaDatasource(props) {
29
33
  }, /*#__PURE__*/React.createElement("label", {
30
34
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
31
35
  }, tr('主题'))))), /*#__PURE__*/React.createElement(_Col, {
32
- flex: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && (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,
36
+ flex: wrapperCol,
33
37
  style: {
34
38
  paddingBottom: '8px'
35
39
  }
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  interface IPostgreSQLDatasourceProps {
2
3
  extraInfo?: any;
4
+ wrapperCol: string;
5
+ labelCol: string;
6
+ datasource?: any;
7
+ onChange?: any;
3
8
  }
4
- declare const PostgreSQLDatasource: (props: IPostgreSQLDatasourceProps) => import("react").JSX.Element;
9
+ declare const PostgreSQLDatasource: (props: IPostgreSQLDatasourceProps) => React.JSX.Element;
5
10
  export default PostgreSQLDatasource;
@@ -2,18 +2,53 @@ 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 React from "react";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  /*
7
7
  * @Author: wangxian
8
8
  * @Date: 2024-08-20 14:32:52
9
- * @LastEditTime: 2024-08-20 14:34:19
9
+ * @LastEditTime: 2024-08-21 10:11:43
10
10
  */
11
11
  import { tr } from '../../../../../framework/locale';
12
+ import { useGetDatasource } from './hooks';
13
+ import React from 'react';
12
14
  var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
13
- var extraInfo = props.extraInfo;
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
+ };
14
49
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
15
50
  span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
16
- 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, "%") : ''
51
+ flex: labelCol
17
52
  }, /*#__PURE__*/React.createElement("label", {
18
53
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
19
54
  }, /*#__PURE__*/React.createElement("div", {
@@ -26,16 +61,18 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
26
61
  }, /*#__PURE__*/React.createElement("label", {
27
62
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
28
63
  }, tr('数据库'))))), /*#__PURE__*/React.createElement(_Col, {
29
- flex: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && (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,
64
+ flex: wrapperCol,
30
65
  style: {
31
66
  paddingBottom: '8px'
32
67
  }
33
68
  }, /*#__PURE__*/React.createElement(_Select, {
34
- mode: "multiple",
35
- allowClear: true
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
36
73
  })), /*#__PURE__*/React.createElement(_Col, {
37
74
  span: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.labelSpan) && (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.layout) === 'vertical' && 24,
38
- 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, "%") : ''
75
+ flex: labelCol
39
76
  }, /*#__PURE__*/React.createElement("label", {
40
77
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
41
78
  }, /*#__PURE__*/React.createElement("div", {
@@ -48,13 +85,39 @@ var PostgreSQLDatasource = function PostgreSQLDatasource(props) {
48
85
  }, /*#__PURE__*/React.createElement("label", {
49
86
  className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
50
87
  }, tr('模式'))))), /*#__PURE__*/React.createElement(_Col, {
51
- flex: !(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.titleHidden) && (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,
88
+ flex: wrapperCol,
52
89
  style: {
53
90
  paddingBottom: '8px'
54
91
  }
55
92
  }, /*#__PURE__*/React.createElement(_Select, {
56
- mode: "multiple",
57
- allowClear: true
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
58
121
  })));
59
122
  };
60
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;
@@ -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;
@@ -1 +1,3 @@
1
- export declare const useGetDatasource: (type: string, level?: number, source?: string) => any[];
1
+ export declare const useGetDatasource: (type: string, level?: number, source?: string, levelTwo?: string, levelThree?: string) => any[];
2
+ export declare const useGetLabelCol: (extraInfo: any) => string;
3
+ export declare const useGetWrapperCol: (extraInfo: any) => string;
@@ -7,11 +7,13 @@ import React from 'react';
7
7
  /*
8
8
  * @Author: wangxian
9
9
  * @Date: 2024-08-20 14:38:09
10
- * @LastEditTime: 2024-08-20 18:24:10
10
+ * @LastEditTime: 2024-08-21 09:31:11
11
11
  */
12
12
  export var useGetDatasource = function useGetDatasource(type) {
13
13
  var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
14
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;
15
17
  var _React$useState = React.useState([]),
16
18
  _React$useState2 = _slicedToArray(_React$useState, 2),
17
19
  list = _React$useState2[0],
@@ -19,17 +21,35 @@ export var useGetDatasource = function useGetDatasource(type) {
19
21
  var server = new MetadataService();
20
22
  var getHttpResult = React.useCallback( /*#__PURE__*/function () {
21
23
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_type, _level) {
22
- var res, _config, _list;
24
+ var param, res, _config, _list;
23
25
  return _regeneratorRuntime.wrap(function _callee$(_context) {
24
26
  while (1) switch (_context.prev = _context.next) {
25
27
  case 0:
26
- _context.next = 2;
27
- return server.GetEnumDataByUrl(DATASOURCE_HTTP_URL, 'post', {
28
- type: _type,
29
- level: _level,
30
- source: source
31
- });
32
- case 2:
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:
33
53
  res = _context.sent;
34
54
  _config = RESULT_MAP[_level];
35
55
  _list = res.map(function (it) {
@@ -39,7 +59,7 @@ export var useGetDatasource = function useGetDatasource(type) {
39
59
  };
40
60
  });
41
61
  setList(_toConsumableArray(_list));
42
- case 6:
62
+ case 7:
43
63
  case "end":
44
64
  return _context.stop();
45
65
  }
@@ -48,14 +68,46 @@ export var useGetDatasource = function useGetDatasource(type) {
48
68
  return function (_x, _x2) {
49
69
  return _ref.apply(this, arguments);
50
70
  };
51
- }(), [source]);
71
+ }(), [source, levelTwo, levelThree]);
52
72
  React.useEffect(function () {
53
73
  if (type && level) {
54
74
  getHttpResult(type, level);
55
75
  }
56
- }, [type, level, source, getHttpResult]);
76
+ }, [type, level, source, levelTwo, levelThree, getHttpResult]);
57
77
  return list;
58
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
+ };
59
111
  var DATASOURCE_HTTP_URL = '/dataset-web/source/cascade/data/v2';
60
112
  var RESULT_MAP = {
61
113
  1: {
@@ -63,7 +115,15 @@ var RESULT_MAP = {
63
115
  value: 'name'
64
116
  },
65
117
  2: {
66
- key: 'name',
118
+ key: 'config',
119
+ value: 'name'
120
+ },
121
+ 3: {
122
+ key: 'config',
123
+ value: 'name'
124
+ },
125
+ 4: {
126
+ key: 'config',
67
127
  value: 'name'
68
128
  }
69
129
  };