ronds-metadata 1.1.0 → 1.1.1

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.
@@ -18,10 +18,6 @@
18
18
  height: 30px;
19
19
  padding: 0px 8px !important;
20
20
  }
21
- .ronds-edit-table .ant-table-cell-fix-right {
22
- position: sticky !important;
23
- right: 0 !important;
24
- }
25
21
  .ronds-edit-table .ant-table-body {
26
22
  height: 100%;
27
23
  overflow-y: auto !important;
@@ -33,10 +33,6 @@ interface IEditableProps<R = any> {
33
33
  * 是否可以添加列
34
34
  */
35
35
  isAddColumn?: boolean;
36
- /**
37
- * 删除列白名单
38
- */
39
- whiteColumn?: string[];
40
36
  /**
41
37
  * antd自身的属性
42
38
  */
@@ -32,7 +32,6 @@ 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
- whiteColumn = props.whiteColumn,
36
35
  tableProps = props.tableProps,
37
36
  onRowConfirm = props.onRowConfirm,
38
37
  onRowDelete = props.onRowDelete,
@@ -67,16 +66,9 @@ var Editable = function Editable(props) {
67
66
  var _React$useState9 = React.useState(),
68
67
  _React$useState10 = _slicedToArray(_React$useState9, 2),
69
68
  editHeardCellKey = _React$useState10[0],
70
- setEditHeardCellkey = _React$useState10[1]; // 记录临时加的列头
69
+ setEditHeardCellkey = _React$useState10[1]; // 记录上一次发生改变的行值
71
70
 
72
71
 
73
- var _React$useState11 = React.useState([]),
74
- _React$useState12 = _slicedToArray(_React$useState11, 2),
75
- addColumns = _React$useState12[0],
76
- setAddColumns = _React$useState12[1];
77
-
78
- var addColumnsRef = React.useRef([]); // 记录上一次发生改变的行值
79
-
80
72
  var lastValueRef = React.useRef(); // 记录上一次的datasource
81
73
 
82
74
  var lastDataSourceRef = React.useRef();
@@ -127,12 +119,6 @@ var Editable = function Editable(props) {
127
119
  case 'editHeardCellKey':
128
120
  setEditHeardCellkey(data.payload);
129
121
  break;
130
- // case 'onAddColumn':
131
- // processAddColumnsData(data.payload);
132
- // break;
133
- // case 'onDeleteColumn':
134
- // processDeleteColumnsData(data.payload);
135
- // break;
136
122
 
137
123
  case 'onSingleSave':
138
124
  if (lastValueRef.current && lastValueRef.current.rowIdx === data.payload._rowKey_) {
@@ -200,36 +186,7 @@ var Editable = function Editable(props) {
200
186
  }
201
187
  }, [type]); // 集中处理数据流
202
188
 
203
- useObservable(processStreamFactory, [editableStream]); // const processAddColumnsData = (data: any) => {
204
- // const _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns;
205
- // // 判断key是否重复
206
- // if (_columns.findIndex((v) => v.key === data.key) > -1) {
207
- // // message.warning('表格的key不可以重复');
208
- // return;
209
- // }
210
- // const idx = _columns.findIndex((v: any) => v.dataIndex === data.dataIndex);
211
- // const obj = {
212
- // title: data.title,
213
- // key: data.key,
214
- // dataIndex: data.key,
215
- // };
216
- // _columns.splice(idx + 1, 0, { ..._columns[0], ...obj });
217
- // setAddColumns([..._columns]);
218
- // addColumnsRef.current = _columns;
219
- // // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
220
- // };
221
- // const processDeleteColumnsData = (data: any) => {
222
- // let _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns;
223
- // if (whiteColumn.findIndex((v) => v === data.dataIndex) > -1) {
224
- // // message.warning(`${data.dataIndex}无法删除`);
225
- // return;
226
- // }
227
- // _columns = _columns.filter((v: any) => v.dataIndex != data.dataIndex);
228
- // setAddColumns([..._columns]);
229
- // addColumnsRef.current = _columns;
230
- // // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
231
- // };
232
- // 返回stream的实例
189
+ useObservable(processStreamFactory, [editableStream]); // 返回stream的实例
233
190
 
234
191
  React.useEffect(function () {
235
192
  if (firstLoadRef && editableStream) {
@@ -272,7 +229,7 @@ var Editable = function Editable(props) {
272
229
  }, [readonly, type]); // 处理一下编辑表格的数据
273
230
 
274
231
  var _columns = React.useMemo(function () {
275
- var __columns__ = addColumns && addColumns.length > 0 ? addColumns : columns;
232
+ var __columns__ = columns;
276
233
 
277
234
  var res = __columns__.map(getEditColumn);
278
235
 
@@ -299,7 +256,7 @@ var Editable = function Editable(props) {
299
256
  }
300
257
 
301
258
  return res;
302
- }, [columns, readonly, type, addColumns]); // 主要是自己加一层rowkey
259
+ }, [columns, readonly, type]); // 主要是自己加一层rowkey
303
260
 
304
261
 
305
262
  var _dataSource = React.useMemo(function () {
@@ -362,6 +319,7 @@ var Editable = function Editable(props) {
362
319
  }
363
320
  }
364
321
  }, /*#__PURE__*/React.createElement(_Table, _extends({
322
+ key: _columns.length,
365
323
  className: "ronds-edit-table",
366
324
  bordered: true,
367
325
  scroll: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",