ronds-metadata 1.1.65 → 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: {
@@ -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
@@ -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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.65",
4
+ "version": "1.1.66",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",