ronds-metadata 1.0.48 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/api/index.d.ts CHANGED
@@ -14,5 +14,5 @@ export default class Api implements IAPI {
14
14
  GetMetadataDetailById(metadataId: string): Promise<any>;
15
15
  /** 添加元数据 */
16
16
  SaveMetadata(data: any, metadataTag: string): Promise<any>;
17
- GetMetadataObjList(data: any): Promise<any[]>;
17
+ GetMetadataObjList(data: any): Promise<any>;
18
18
  }
package/es/api/index.js CHANGED
@@ -2,6 +2,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+
6
+ /*
7
+ * @Author:wangxian
8
+ * @Date: 2021-09-18 14:15:04
9
+ * @LastEditTime: 2022-03-28 15:33:19
10
+ */
5
11
  import { HttpHelper } from '../framework/http';
6
12
  var http = new HttpHelper();
7
13
 
@@ -20,6 +26,8 @@ var Api = /*#__PURE__*/function () {
20
26
  */
21
27
  function () {
22
28
  var _GetMetadataList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(keyWords) {
29
+ var _res$data;
30
+
23
31
  var param, url, res;
24
32
  return _regeneratorRuntime.wrap(function _callee$(_context) {
25
33
  while (1) {
@@ -42,7 +50,7 @@ var Api = /*#__PURE__*/function () {
42
50
 
43
51
  case 4:
44
52
  res = _context.sent;
45
- return _context.abrupt("return", res.data);
53
+ return _context.abrupt("return", (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list);
46
54
 
47
55
  case 6:
48
56
  case "end":
@@ -139,13 +147,20 @@ var Api = /*#__PURE__*/function () {
139
147
  key: "GetMetadataObjList",
140
148
  value: function () {
141
149
  var _GetMetadataObjList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(data) {
150
+ var url, res;
142
151
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
143
152
  while (1) {
144
153
  switch (_context4.prev = _context4.next) {
145
154
  case 0:
146
- return _context4.abrupt("return", []);
155
+ url = "/dataset-web/source/{namespace}/entity/page".replace('{namespace}', data.id);
156
+ _context4.next = 3;
157
+ return http.post(encodeURI(url), data);
147
158
 
148
- case 1:
159
+ case 3:
160
+ res = _context4.sent;
161
+ return _context4.abrupt("return", res.successed ? res.data : []);
162
+
163
+ case 5:
149
164
  case "end":
150
165
  return _context4.stop();
151
166
  }
@@ -1,7 +1,6 @@
1
1
  interface IEditableActionProps {
2
2
  type: 'single' | 'multiple' | 'freedom';
3
3
  record: any;
4
- defaultValue?: any;
5
4
  }
6
5
  declare const EditableAction: (props: IEditableActionProps) => JSX.Element;
7
6
  export default EditableAction;
@@ -8,8 +8,7 @@ import { EditableContext } from '../interface';
8
8
 
9
9
  var EditableAction = function EditableAction(props) {
10
10
  var type = props.type,
11
- record = props.record,
12
- defaultValue = props.defaultValue;
11
+ record = props.record;
13
12
 
14
13
  var _ref = React.useContext(EditableContext) || undefined,
15
14
  editableStream = _ref.editableStream,
@@ -70,13 +69,7 @@ var EditableAction = function EditableAction(props) {
70
69
  title: '取消'
71
70
  }), /*#__PURE__*/React.createElement(_Divider, {
72
71
  type: "vertical"
73
- }))), /*#__PURE__*/React.createElement(_Button, {
74
- type: "link",
75
- size: "small",
76
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
77
- onClick: onDelete,
78
- title: '删除'
79
- })), type !== 'single' && defaultValue && /*#__PURE__*/React.createElement(_Button, {
72
+ })))), /*#__PURE__*/React.createElement(_Button, {
80
73
  type: "link",
81
74
  size: "small",
82
75
  icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
@@ -115,7 +115,7 @@ var EditableHeardCell = function EditableHeardCell(props) {
115
115
  };
116
116
 
117
117
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({}, restProps, {
118
- className: "ant-table-cell ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
118
+ className: "ant-table-cell font-bold ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
119
119
  }), isAddColumn && /*#__PURE__*/React.createElement(_Popover, {
120
120
  placement: "rightTop",
121
121
  content: content,
@@ -17,3 +17,6 @@
17
17
  .border-top {
18
18
  border-top: 1px solid var(--antd-wave-shadow-color) !important;
19
19
  }
20
+ .font-bold {
21
+ font-weight: bold;
22
+ }
@@ -286,12 +286,16 @@ var Editable = function Editable(props) {
286
286
  render: function render(val, record) {
287
287
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditableAction, {
288
288
  type: type,
289
- record: record,
290
- defaultValue: defaultValue
289
+ record: record
291
290
  }));
292
291
  }
293
292
  };
294
- res.push(_aciton_);
293
+
294
+ if (type === 'single') {
295
+ res.push(_aciton_);
296
+ } else if (defaultValue) {
297
+ res.push(_aciton_);
298
+ }
295
299
  }
296
300
 
297
301
  return res;
@@ -174,6 +174,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
174
174
  required: true
175
175
  }]
176
176
  }), /*#__PURE__*/React.createElement(_Select, {
177
+ showSearch: true,
177
178
  style: {
178
179
  width: '120px'
179
180
  },
@@ -187,7 +188,11 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
187
188
  fields: newData
188
189
  });
189
190
  },
190
- options: metaType || []
191
+ options: metaType || [],
192
+ filterOption: function filterOption(input, option) {
193
+ return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
194
+ },
195
+ allowClear: true
191
196
  })), /*#__PURE__*/React.createElement("div", {
192
197
  style: {
193
198
  lineHeight: '88px',
@@ -165,7 +165,12 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
165
165
  style: {
166
166
  width: '180px'
167
167
  },
168
- options: metaType || []
168
+ options: metaType || [],
169
+ showSearch: true,
170
+ filterOption: function filterOption(input, option) {
171
+ return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
172
+ },
173
+ allowClear: true
169
174
  })), /*#__PURE__*/React.createElement("div", {
170
175
  style: {
171
176
  padding: '0 10px'
@@ -1,4 +1,10 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+
3
+ /*
4
+ * @Author: wangxian
5
+ * @Date: 2021-09-18 14:15:04
6
+ * @LastEditTime: 2022-03-28 14:30:25
7
+ */
2
8
  import { MetadataService } from './../../../framework/metadata/MetadataService';
3
9
  import React from 'react';
4
10
  export var useMetaType = function useMetaType(tag) {
@@ -1,12 +1,9 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
 
3
3
  /*
4
- * @Author: your name
4
+ * @Author:wangxian
5
5
  * @Date: 2022-03-03 16:12:34
6
- * @LastEditTime: 2022-03-07 10:55:07
7
- * @LastEditors: your name
8
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
9
- * @FilePath: \MetaData\src\comps\MetadataEditV2\hooks\index.ts
6
+ * @LastEditTime: 2022-03-28 11:56:36
10
7
  */
11
8
  import { MetadataService } from './../../../framework/metadata/MetadataService';
12
9
  import React from 'react';
@@ -9,7 +9,6 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
9
9
  import "antd/es/select/style";
10
10
  import _Select from "antd/es/select";
11
11
  import React from 'react';
12
- import { useDebounce } from '../../../utils';
13
12
  import { MetadataService } from '../../../framework/metadata/MetadataService';
14
13
  import { MetadataFormContext, MetadataRefContext } from '../interface';
15
14
  import { useGetExtraInfo } from '../hooks';
@@ -52,54 +51,53 @@ function Index(props) {
52
51
  help = _React$useState8[0],
53
52
  setHelp = _React$useState8[1];
54
53
 
55
- var onSearch = useDebounce( /*#__PURE__*/function () {
56
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(value) {
57
- var param, server, res, _options, i, obj;
58
-
59
- return _regeneratorRuntime.wrap(function _callee$(_context) {
60
- while (1) {
61
- switch (_context.prev = _context.next) {
62
- case 0:
63
- param = {
64
- id: refId,
65
- filter: {
66
- keywords: value
67
- },
68
- order: []
69
- };
70
- server = new MetadataService();
71
- _context.next = 4;
72
- return server.GetMetadataObjList(param);
73
-
74
- case 4:
75
- res = _context.sent;
76
- _options = [];
77
-
78
- if (res.length > 0) {
79
- for (i = 0; i < res.length; i++) {
80
- obj = {
81
- label: res[i].name,
82
- value: res[i].namespace
83
- };
84
-
85
- _options.push(obj);
86
- }
54
+ var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
55
+ var param, server, res, _options, i, obj;
56
+
57
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
58
+ while (1) {
59
+ switch (_context.prev = _context.next) {
60
+ case 0:
61
+ param = {
62
+ id: refId,
63
+ filter: {
64
+ keywords: ''
65
+ },
66
+ order: []
67
+ };
68
+ server = new MetadataService();
69
+ _context.next = 4;
70
+ return server.GetMetadataObjList(param);
71
+
72
+ case 4:
73
+ res = _context.sent;
74
+ _options = [];
75
+
76
+ if (res.length > 0) {
77
+ for (i = 0; i < res.length; i++) {
78
+ obj = {
79
+ label: res[i].name,
80
+ value: res[i].namespace
81
+ };
82
+
83
+ _options.push(obj);
87
84
  }
85
+ }
88
86
 
89
- setOptions(!value ? [] : _options);
87
+ setOptions(_options);
90
88
 
91
- case 8:
92
- case "end":
93
- return _context.stop();
94
- }
89
+ case 8:
90
+ case "end":
91
+ return _context.stop();
95
92
  }
96
- }, _callee);
97
- }));
98
-
99
- return function (_x) {
100
- return _ref.apply(this, arguments);
101
- };
102
- }(), 500, []);
93
+ }
94
+ }, _callee);
95
+ })), []);
96
+ React.useEffect(function () {
97
+ if (refId) {
98
+ onSearch();
99
+ }
100
+ }, [refId, onSearch]);
103
101
  var formOptions = React.useMemo(function () {
104
102
  return {
105
103
  disabled: disabled,
@@ -185,20 +183,15 @@ function Index(props) {
185
183
  tooltip: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip) || help
186
184
  }, /*#__PURE__*/React.createElement(_Select, {
187
185
  showSearch: true,
188
- allowClear: true,
186
+ options: options || [],
189
187
  placeholder: extraInfo.placeholder,
190
- defaultActiveFirstOption: false,
191
- showArrow: false,
192
- filterOption: false,
193
- onSearch: onSearch,
194
188
  disabled: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
195
- notFoundContent: '没有批到到该实体数据'
196
- }, options.map(function (option) {
197
- return /*#__PURE__*/React.createElement(Option, {
198
- key: option.value,
199
- value: option.value
200
- }, option.label);
201
- }))) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
189
+ notFoundContent: '没有批到到该实体数据',
190
+ filterOption: function filterOption(input, option) {
191
+ return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
192
+ },
193
+ allowClear: true
194
+ })) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
202
195
  style: {
203
196
  flex: 1,
204
197
  paddingRight: '10px',
@@ -216,20 +209,15 @@ function Index(props) {
216
209
  style: {
217
210
  width: '100%'
218
211
  },
219
- allowClear: true,
212
+ options: options || [],
220
213
  placeholder: extraInfo.placeholder,
221
- defaultActiveFirstOption: false,
222
- showArrow: false,
223
- filterOption: false,
224
- onSearch: onSearch,
225
214
  disabled: (_extraInfo$disabled2 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled2 !== void 0 ? _extraInfo$disabled2 : disabled,
226
- notFoundContent: '没有批到到该实体数据'
227
- }, options.map(function (option) {
228
- return /*#__PURE__*/React.createElement(Option, {
229
- key: option.value,
230
- value: option.value
231
- }, option.label);
232
- })));
215
+ notFoundContent: '没有批到到该实体数据',
216
+ filterOption: function filterOption(input, option) {
217
+ return (option === null || option === void 0 ? void 0 : option.label.indexOf(input)) >= 0;
218
+ },
219
+ allowClear: true
220
+ }));
233
221
  }
234
222
 
235
223
  export default /*#__PURE__*/React.memo(Index);
@@ -102,10 +102,10 @@ httpClient.interceptors.response.use(function (response) {
102
102
  var _response$data2, _response$data3;
103
103
 
104
104
  // 如果自定义转换
105
- if (response.data && response.data.success || response.status === 204) {
105
+ if (response.data && response.data.success || response.status === 200 || response.status === 204) {
106
106
  var _response$data;
107
107
 
108
- response.data = new BaseResData((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data, true, '', response.status);
108
+ response.data = new BaseResData(((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data) || response.data, true, '', response.status);
109
109
  } //没有包装的数据
110
110
  else if (((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.data) === undefined && ((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.success) === undefined) {
111
111
  response.data = new BaseResData(response.data, true, '', response.status, null, response);
@@ -2,6 +2,12 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
4
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+
6
+ /*
7
+ * @Author: wangxian
8
+ * @Date: 2021-09-18 14:15:04
9
+ * @LastEditTime: 2022-03-28 11:52:05
10
+ */
5
11
  import Api from '../../api';
6
12
  var globalAPI = new Api();
7
13
  export var registerMetadataAPI = function registerMetadataAPI(api) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.0.48",
4
+ "version": "1.0.51",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",