ronds-metadata 1.0.97 → 1.1.0
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/comps/Editable/index.js +43 -60
- package/es/comps/MetadataEdit/index.d.ts +5 -0
- package/es/comps/MetadataEdit/index.js +11 -1
- package/es/comps/locales/en-US.d.ts +1 -0
- package/es/comps/locales/en-US.js +2 -1
- package/es/comps/locales/zh-CN.d.ts +1 -0
- package/es/comps/locales/zh-CN.js +2 -1
- package/package.json +1 -1
@@ -127,25 +127,24 @@ var Editable = function Editable(props) {
|
|
127
127
|
case 'editHeardCellKey':
|
128
128
|
setEditHeardCellkey(data.payload);
|
129
129
|
break;
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
processDeleteColumnsData(data.payload);
|
137
|
-
break;
|
130
|
+
// case 'onAddColumn':
|
131
|
+
// processAddColumnsData(data.payload);
|
132
|
+
// break;
|
133
|
+
// case 'onDeleteColumn':
|
134
|
+
// processDeleteColumnsData(data.payload);
|
135
|
+
// break;
|
138
136
|
|
139
137
|
case 'onSingleSave':
|
140
|
-
onRowConfirm && onRowConfirm({
|
141
|
-
rowIdx: lastValueRef.current.rowIdx,
|
142
|
-
values: lastValueRef.current.values,
|
143
|
-
allValues: _objectSpread(_objectSpread({}, recordsRef.current[lastValueRef.current.rowIdx]), lastValueRef.current.allValues)
|
144
|
-
});
|
145
|
-
|
146
138
|
if (lastValueRef.current && lastValueRef.current.rowIdx === data.payload._rowKey_) {
|
139
|
+
onRowConfirm && onRowConfirm({
|
140
|
+
rowIdx: lastValueRef.current.rowIdx,
|
141
|
+
values: lastValueRef.current.values,
|
142
|
+
allValues: _objectSpread(_objectSpread({}, recordsRef.current[lastValueRef.current.rowIdx]), lastValueRef.current.allValues)
|
143
|
+
});
|
147
144
|
editRowKeyRef.current = undefined;
|
148
145
|
setEditRowkey(undefined);
|
146
|
+
} else {
|
147
|
+
_message.warn(tr('当前值无修改'));
|
149
148
|
}
|
150
149
|
|
151
150
|
break;
|
@@ -201,52 +200,36 @@ var Editable = function Editable(props) {
|
|
201
200
|
}
|
202
201
|
}, [type]); // 集中处理数据流
|
203
202
|
|
204
|
-
useObservable(processStreamFactory, [editableStream]);
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
};
|
232
|
-
|
233
|
-
|
234
|
-
var _columns = addColumnsRef.current.length > 0 ? addColumnsRef.current : columns;
|
235
|
-
|
236
|
-
if (whiteColumn.findIndex(function (v) {
|
237
|
-
return v === data.dataIndex;
|
238
|
-
}) > -1) {
|
239
|
-
// message.warning(`${data.dataIndex}无法删除`);
|
240
|
-
return;
|
241
|
-
}
|
242
|
-
|
243
|
-
_columns = _columns.filter(function (v) {
|
244
|
-
return v.dataIndex != data.dataIndex;
|
245
|
-
});
|
246
|
-
setAddColumns(_toConsumableArray(_columns));
|
247
|
-
addColumnsRef.current = _columns; // editableStream.next({ type: 'editHeardCellKey', payload: undefined });
|
248
|
-
}; // 返回stream的实例
|
249
|
-
|
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的实例
|
250
233
|
|
251
234
|
React.useEffect(function () {
|
252
235
|
if (firstLoadRef && editableStream) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { FormInstance } from 'antd';
|
1
2
|
import './index.less';
|
2
3
|
interface IMetadataEditProps {
|
3
4
|
/**
|
@@ -20,6 +21,10 @@ interface IMetadataEditProps {
|
|
20
21
|
* 添加新的引用类型点击事件
|
21
22
|
*/
|
22
23
|
onNewRefClick?: () => void;
|
24
|
+
/**
|
25
|
+
* 获取表单的实例
|
26
|
+
*/
|
27
|
+
getFormInstance?: (form: FormInstance) => void;
|
23
28
|
}
|
24
29
|
declare const MetadataEdit: (props: IMetadataEditProps) => JSX.Element;
|
25
30
|
export default MetadataEdit;
|
@@ -23,7 +23,8 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
23
23
|
isNameDisabled = props.isNameDisabled,
|
24
24
|
metadataTag = props.metadataTag,
|
25
25
|
onFinish = props.onFinish,
|
26
|
-
onNewRefClick = props.onNewRefClick
|
26
|
+
onNewRefClick = props.onNewRefClick,
|
27
|
+
getFormInstance = props.getFormInstance;
|
27
28
|
|
28
29
|
var _Form$useForm = _Form.useForm(),
|
29
30
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
@@ -62,7 +63,16 @@ var MetadataEdit = function MetadataEdit(props) {
|
|
62
63
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
63
64
|
curFields = _React$useState10[0],
|
64
65
|
setCurFields = _React$useState10[1];
|
66
|
+
/**
|
67
|
+
* 获取form的实例
|
68
|
+
*/
|
65
69
|
|
70
|
+
|
71
|
+
React.useEffect(function () {
|
72
|
+
if (form) {
|
73
|
+
getFormInstance && getFormInstance(form);
|
74
|
+
}
|
75
|
+
}, [form]);
|
66
76
|
React.useEffect(function () {
|
67
77
|
form.setFieldsValue({
|
68
78
|
id: 'Test'
|
@@ -10,5 +10,6 @@ export default {
|
|
10
10
|
请先保存正在编辑的行: 'Please save the line being edited first',
|
11
11
|
请输入key: 'Please enter key',
|
12
12
|
请输入title: 'Please enter title',
|
13
|
-
确认会删除该列: 'Confirm will delete the column?'
|
13
|
+
确认会删除该列: 'Confirm will delete the column?',
|
14
|
+
当前值无修改: 'No change to current value'
|
14
15
|
};
|