ronds-metadata 1.1.64 → 1.1.66

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.
@@ -33,6 +33,14 @@ interface IEditableProps<R = any> {
33
33
  * 是否可以添加列
34
34
  */
35
35
  isAddColumn?: boolean;
36
+ /**
37
+ * 是否显示操作栏
38
+ */
39
+ isAction?: boolean;
40
+ /**
41
+ * 是否有添加列
42
+ */
43
+ isAddRow?: boolean;
36
44
  /**
37
45
  * antd自身的属性
38
46
  */
@@ -32,6 +32,10 @@ var Editable = function Editable(props) {
32
32
  addPosition = _props$addPosition === void 0 ? 'bottom' : _props$addPosition,
33
33
  _props$isAddColumn = props.isAddColumn,
34
34
  isAddColumn = _props$isAddColumn === void 0 ? false : _props$isAddColumn,
35
+ _props$isAddRow = props.isAddRow,
36
+ isAddRow = _props$isAddRow === void 0 ? true : _props$isAddRow,
37
+ _props$isAction = props.isAction,
38
+ isAction = _props$isAction === void 0 ? true : _props$isAction,
35
39
  tableProps = props.tableProps,
36
40
  onRowClick = props.onRowClick,
37
41
  onButtonCellClick = props.onButtonCellClick,
@@ -243,7 +247,7 @@ var Editable = function Editable(props) {
243
247
 
244
248
  var res = __columns__.map(getEditColumn);
245
249
 
246
- if (!readonly) {
250
+ if (!readonly && isAction) {
247
251
  var _aciton_ = {
248
252
  dataKey: '_aciton_',
249
253
  title: tr('操作'),
@@ -357,7 +361,7 @@ var Editable = function Editable(props) {
357
361
  index: index
358
362
  };
359
363
  }
360
- })), (type === 'multiple' || type === 'freedom') && !readonly && defaultValue && /*#__PURE__*/React.createElement(_Button, {
364
+ })), (type === 'multiple' || type === 'freedom') && !readonly && isAddRow && defaultValue && /*#__PURE__*/React.createElement(_Button, {
361
365
  block: true,
362
366
  type: "dashed",
363
367
  style: {
@@ -0,0 +1,2 @@
1
+ declare const FileView: () => JSX.Element;
2
+ export default FileView;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+
3
+ /*
4
+ * @Author: wangxian
5
+ * @Date: 2022-11-25 14:14:50
6
+ * @LastEditTime: 2022-11-25 14:30:35
7
+ */
8
+ import FileViewer from 'react-file-viewer';
9
+
10
+ var FileView = function FileView() {
11
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FileViewer, {
12
+ fileType: "xslx" //文件类型
13
+ ,
14
+ filePath: 'http://192.168.1.186:9006/experiment//1fc9b9e3-51a3-79c0-de28-5ddff261d8fd/%E8%A1%A8%E6%A0%BC/%E6%B5%8B%E8%AF%95/test.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20221125%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221125T061952Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=97b63c66f7d2e9181d3b1486e360bdd7000e3104fc486a1d8fafd8db3d0623b4' //文件地址(后台给返的二进制流也可以)
15
+
16
+ }));
17
+ };
18
+
19
+ export default FileView;
@@ -8,7 +8,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
8
8
  /*
9
9
  * @Author: wangxian
10
10
  * @Date: 2021-09-18 14:15:04
11
- * @LastEditTime: 2022-11-03 11:14:58
11
+ * @LastEditTime: 2022-12-05 09:45:03
12
12
  */
13
13
  import React from 'react';
14
14
  import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
@@ -75,6 +75,8 @@ function Index(props) {
75
75
  }, help || (items === null || items === void 0 ? void 0 : items.type))), extraInfo.layout === 'table' && items.type === 'ref' ? /*#__PURE__*/React.createElement(TableArray, {
76
76
  initValue: formContext.initialValues,
77
77
  readonly: (_extraInfo$disabled = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : disabled,
78
+ addButtonHidden: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.addButtonHidden,
79
+ rowNumber: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rowNumber) || 10,
78
80
  refId: items.refId,
79
81
  form: formContext.form,
80
82
  name: id
@@ -26,7 +26,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
26
26
  /*
27
27
  * @Author:wangxian
28
28
  * @Date: 2021-09-18 14:15:04
29
- * @LastEditTime: 2022-11-22 16:10:55
29
+ * @LastEditTime: 2022-11-28 16:28:25
30
30
  */
31
31
  import React from 'react';
32
32
  import { MetadataFormContext, MetadataRefContext } from '../interface';
@@ -116,10 +116,18 @@ function Index(props) {
116
116
  totalRef.current = res === null || res === void 0 ? void 0 : res.total;
117
117
 
118
118
  if (!(_res && _res.length > 0)) {
119
- _context.next = 13;
119
+ _context.next = 15;
120
120
  break;
121
121
  }
122
122
 
123
+ if (!((http === null || http === void 0 ? void 0 : http.isCascader) && http.url.indexOf('{pid}') === -1)) {
124
+ _context.next = 12;
125
+ break;
126
+ }
127
+
128
+ return _context.abrupt("return", _res);
129
+
130
+ case 12:
123
131
  return _context.abrupt("return", _res.map(function (it) {
124
132
  if (http === null || http === void 0 ? void 0 : http.isCascader) {
125
133
  return {
@@ -135,11 +143,11 @@ function Index(props) {
135
143
  }
136
144
  }));
137
145
 
138
- case 13:
146
+ case 15:
139
147
  console.warn("".concat(_url, " is not return success result"));
140
148
  return _context.abrupt("return", []);
141
149
 
142
- case 15:
150
+ case 17:
143
151
  case "end":
144
152
  return _context.stop();
145
153
  }
@@ -219,6 +227,8 @@ function Index(props) {
219
227
 
220
228
  var loadData = /*#__PURE__*/function () {
221
229
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(selectedOptions) {
230
+ var _targetOption$childre;
231
+
222
232
  var targetOption, _children;
223
233
 
224
234
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
@@ -227,10 +237,16 @@ function Index(props) {
227
237
  case 0:
228
238
  targetOption = selectedOptions[selectedOptions.length - 1];
229
239
  targetOption.loading = true;
230
- _context3.next = 4;
240
+
241
+ if (!(!targetOption.isLeaf && (!(targetOption === null || targetOption === void 0 ? void 0 : targetOption.children) || ((_targetOption$childre = targetOption.children) === null || _targetOption$childre === void 0 ? void 0 : _targetOption$childre.length) === 0))) {
242
+ _context3.next = 7;
243
+ break;
244
+ }
245
+
246
+ _context3.next = 5;
231
247
  return getEnumDataByUrl(extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.http, targetOption.value);
232
248
 
233
- case 4:
249
+ case 5:
234
250
  _children = _context3.sent;
235
251
  setTimeout(function () {
236
252
  targetOption.loading = false;
@@ -238,7 +254,7 @@ function Index(props) {
238
254
  setCascaderOption(_toConsumableArray(cascaderOption));
239
255
  }, 500);
240
256
 
241
- case 6:
257
+ case 7:
242
258
  case "end":
243
259
  return _context3.stop();
244
260
  }
@@ -4,6 +4,8 @@ interface ITableArrayProps {
4
4
  form: FormInstance;
5
5
  refId: string;
6
6
  readonly?: boolean;
7
+ rowNumber: number;
8
+ addButtonHidden?: boolean;
7
9
  initValue: any;
8
10
  }
9
11
  declare const TableArray: (props: ITableArrayProps) => JSX.Element;
@@ -18,6 +18,8 @@ import { deepClone } from '../../../../utils';
18
18
  var TableArray = function TableArray(props) {
19
19
  var initValue = props.initValue,
20
20
  readonly = props.readonly,
21
+ rowNumber = props.rowNumber,
22
+ addButtonHidden = props.addButtonHidden,
21
23
  name = props.name,
22
24
  form = props.form,
23
25
  refId = props.refId;
@@ -52,7 +54,7 @@ var TableArray = function TableArray(props) {
52
54
  setList = _React$useState10[1];
53
55
 
54
56
  useObservable(function (p) {
55
- if ((p === null || p === void 0 ? void 0 : p.type) === 'setFieldsValue') {
57
+ if ((p === null || p === void 0 ? void 0 : p.type) === 'setFieldsValue' && p.payload[name]) {
56
58
  setList(_toConsumableArray(p.payload[name]));
57
59
  }
58
60
  }, [formContext.stream$]);
@@ -183,7 +185,7 @@ var TableArray = function TableArray(props) {
183
185
  var _columns = [];
184
186
 
185
187
  for (var i = 0; i < _properties.length; i++) {
186
- var _extraInfo$disabled;
188
+ var _extraInfo$common;
187
189
 
188
190
  var it = _properties[i];
189
191
  var extraInfo = refFieldsRef.current.get(it.id);
@@ -192,7 +194,7 @@ var TableArray = function TableArray(props) {
192
194
  key: it.id,
193
195
  dataIndex: it.id,
194
196
  width: processColumnType(it, extraInfo) === 'buttonCell' ? 60 : 100,
195
- editable: (_extraInfo$disabled = !extraInfo.disabled) !== null && _extraInfo$disabled !== void 0 ? _extraInfo$disabled : true,
197
+ editable: !((_extraInfo$common = extraInfo.common) === null || _extraInfo$common === void 0 ? void 0 : _extraInfo$common.disabled),
196
198
  type: processColumnType(it, extraInfo),
197
199
  enum: it.type === 'enum' ? processEnumData(it, extraInfo) : undefined
198
200
  };
@@ -230,7 +232,7 @@ var TableArray = function TableArray(props) {
230
232
  return /*#__PURE__*/React.createElement("div", {
231
233
  style: {
232
234
  width: '100%',
233
- height: '340px'
235
+ height: "".concat(rowNumber * 40 + 40, "px")
234
236
  }
235
237
  }, /*#__PURE__*/React.createElement(_Form.Item, {
236
238
  name: name,
@@ -242,6 +244,8 @@ var TableArray = function TableArray(props) {
242
244
  readonly: readonly,
243
245
  defaultValue: defaultValue,
244
246
  addPosition: "bottom",
247
+ isAddRow: !addButtonHidden,
248
+ isAction: !addButtonHidden,
245
249
  columns: columns,
246
250
  dataSource: list,
247
251
  onMulChange: onTableChange,
@@ -252,7 +256,7 @@ var TableArray = function TableArray(props) {
252
256
  tableProps: {
253
257
  scroll: {
254
258
  x: '100%',
255
- y: '300px'
259
+ y: "".concat(rowNumber * 40, "px")
256
260
  }
257
261
  }
258
262
  })));
package/es/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { default as JsonView } from './comps/JsonView';
7
7
  export { default as JsonEdit } from './comps/JsonEdit';
8
8
  export { default as MdEditor } from './comps/MdEdit';
9
9
  export { default as MdView } from './comps/MdView';
10
+ export { default as FileView } from './comps/FileView';
10
11
  export { default as Editable } from './comps/Editable';
11
12
  export { default as DynamicPorts } from './comps/DynamicPorts';
12
13
  export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
package/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * @Author:wangxian
3
3
  * @Date: 2021-09-18 14:15:04
4
- * @LastEditTime: 2022-09-02 16:19:21
4
+ * @LastEditTime: 2022-11-25 14:17:34
5
5
  */
6
6
  import './theme.less';
7
7
  export { default as MetadataEdit } from './comps/MetadataEdit';
@@ -12,6 +12,7 @@ export { default as JsonView } from './comps/JsonView';
12
12
  export { default as JsonEdit } from './comps/JsonEdit';
13
13
  export { default as MdEditor } from './comps/MdEdit';
14
14
  export { default as MdView } from './comps/MdView';
15
+ export { default as FileView } from './comps/FileView';
15
16
  export { default as Editable } from './comps/Editable';
16
17
  export { default as DynamicPorts } from './comps/DynamicPorts';
17
18
  export { default as DragNode } from './comps/DynamicPorts/comps/DragNode';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.64",
4
+ "version": "1.1.66",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",
@@ -52,6 +52,7 @@
52
52
  "react": "^17.0.2",
53
53
  "react-dnd": "^11.1.3",
54
54
  "react-dnd-html5-backend": "^11.1.3",
55
+ "react-file-viewer": "^1.2.1",
55
56
  "react-markdown": "^8.0.3",
56
57
  "react-markdown-editor-lite": "^1.3.2",
57
58
  "react-popper": "^2.2.3",