ronds-metadata 1.0.87 → 1.0.90
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/DataCell/Input.js +2 -1
- package/es/comps/Editable/DataCell/Number.js +1 -0
- package/es/comps/Editable/DataCell/Select.js +2 -1
- package/es/comps/Editable/DataCell/Switch.js +2 -1
- package/es/comps/Editable/comps/EditableCell.js +6 -5
- package/es/comps/Editable/comps/EditableHeardCell.js +3 -2
- package/es/comps/Editable/index.css +31 -0
- package/es/comps/Editable/index.js +3 -4
- package/es/comps/MetadataEdit/components/MetaFieldsEdit.js +3 -2
- package/es/comps/MetadataEdit/components/MetaPropsEdit.js +4 -1
- package/es/comps/MetadataForm/DataCell/Array.js +10 -3
- package/es/comps/MetadataForm/DataCell/Input.js +6 -1
- package/es/comps/MetadataForm/DataCell/Number.js +5 -0
- package/es/comps/MetadataForm/DataCell/Ref.js +43 -20
- package/es/comps/MetadataForm/DataCell/Select.js +6 -1
- package/es/comps/MetadataForm/DataCell/Switch.js +6 -1
- package/es/comps/MetadataForm/DataCell/layout/TableArray.d.ts +9 -0
- package/es/comps/MetadataForm/DataCell/layout/TableArray.js +144 -0
- package/es/comps/MetadataForm/hooks/index.js +7 -2
- package/es/comps/MetadataForm/index.d.ts +4 -0
- package/es/comps/MetadataForm/index.js +8 -4
- package/es/comps/MetadataForm/interface.d.ts +1 -0
- package/es/comps/MetadataForm/interface.js +1 -1
- package/es/comps/locales/en-US.d.ts +1 -0
- package/es/comps/locales/en-US.js +1 -0
- package/es/comps/locales/zh-CN.d.ts +1 -0
- package/es/comps/locales/zh-CN.js +1 -0
- package/package.json +1 -1
@@ -6,7 +6,7 @@ import _Input from "antd/es/input";
|
|
6
6
|
/*
|
7
7
|
* @Author: wangxian
|
8
8
|
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-
|
9
|
+
* @LastEditTime: 2022-05-12 11:06:36
|
10
10
|
*/
|
11
11
|
import React from 'react';
|
12
12
|
import { EditableContext } from '../interface';
|
@@ -46,6 +46,7 @@ function Index(props) {
|
|
46
46
|
}
|
47
47
|
}, /*#__PURE__*/React.createElement(_Input, {
|
48
48
|
ref: inputRef,
|
49
|
+
size: "small",
|
49
50
|
disabled: editConfig.type === 'edit' ? disabled : false
|
50
51
|
}));
|
51
52
|
}
|
@@ -8,7 +8,7 @@ var _excluded = ["dataIndex", "disabled"];
|
|
8
8
|
/*
|
9
9
|
* @Author: wangxian
|
10
10
|
* @Date: 2022-03-04 14:53:50
|
11
|
-
* @LastEditTime: 2022-
|
11
|
+
* @LastEditTime: 2022-05-12 11:07:04
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { EditableContext } from '../interface';
|
@@ -28,6 +28,7 @@ function Index(props) {
|
|
28
28
|
}
|
29
29
|
}, /*#__PURE__*/React.createElement(_Select, {
|
30
30
|
disabled: editConfig.type === 'edit' ? disabled : false,
|
31
|
+
size: "small",
|
31
32
|
style: {
|
32
33
|
width: '100%'
|
33
34
|
},
|
@@ -6,7 +6,7 @@ import _Switch from "antd/es/switch";
|
|
6
6
|
/*
|
7
7
|
* @Author: wangxian
|
8
8
|
* @Date: 2022-03-04 14:53:50
|
9
|
-
* @LastEditTime: 2022-
|
9
|
+
* @LastEditTime: 2022-05-12 11:07:09
|
10
10
|
*/
|
11
11
|
import React from 'react';
|
12
12
|
import { EditableContext } from '../interface';
|
@@ -25,6 +25,7 @@ function Index(props) {
|
|
25
25
|
margin: 0
|
26
26
|
}
|
27
27
|
}, /*#__PURE__*/React.createElement(_Switch, {
|
28
|
+
size: "small",
|
28
29
|
disabled: editConfig.type === 'edit' ? disabled : false
|
29
30
|
}));
|
30
31
|
}
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import "antd/es/message/style";
|
3
3
|
import _message from "antd/es/message";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
var _excluded = ["title", "isAddColumn", "editable", "record", "editableType", "dataIndex", "rowIndex", "children"];
|
5
|
+
var _excluded = ["title", "isAddColumn", "editable", "record", "editableType", "dataIndex", "rowIndex", "children", "className"];
|
6
6
|
import React from 'react';
|
7
7
|
import { EditableContext } from '../interface';
|
8
8
|
import { getDataCell, isFreeEditCell, isFreeEditRow } from '../utils';
|
@@ -19,6 +19,7 @@ var EditableCell = function EditableCell(props) {
|
|
19
19
|
dataIndex = props.dataIndex,
|
20
20
|
rowIndex = props.rowIndex,
|
21
21
|
children = props.children,
|
22
|
+
className = props.className,
|
22
23
|
restProps = _objectWithoutProperties(props, _excluded);
|
23
24
|
|
24
25
|
var _ref = React.useContext(EditableContext) || undefined,
|
@@ -62,7 +63,7 @@ var EditableCell = function EditableCell(props) {
|
|
62
63
|
|
63
64
|
if (restProps === null || restProps === void 0 ? void 0 : restProps.colSpan) {
|
64
65
|
return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
|
65
|
-
className: "
|
66
|
+
className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " "),
|
66
67
|
style: {
|
67
68
|
border: 0
|
68
69
|
}
|
@@ -71,7 +72,7 @@ var EditableCell = function EditableCell(props) {
|
|
71
72
|
|
72
73
|
if (editableType === 'single') {
|
73
74
|
return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
|
74
|
-
className: "
|
75
|
+
className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
|
75
76
|
}), editable && editConfig.curRow === rowIndex ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
|
76
77
|
tooltipStyle: {
|
77
78
|
wordWrap: 'break-word'
|
@@ -85,7 +86,7 @@ var EditableCell = function EditableCell(props) {
|
|
85
86
|
onDoubleClick: onCellDoubleClick,
|
86
87
|
onClick: onCellClick
|
87
88
|
}, restProps, {
|
88
|
-
className: "
|
89
|
+
className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
|
89
90
|
}), editable && (isFreeEditRow(editConfig.curRow, rowIndex) || isFreeEditCell(editConfig.editCellKey, dataIndex, rowIndex)) ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
|
90
91
|
tooltipStyle: {
|
91
92
|
wordWrap: 'break-word'
|
@@ -95,7 +96,7 @@ var EditableCell = function EditableCell(props) {
|
|
95
96
|
}
|
96
97
|
|
97
98
|
return /*#__PURE__*/React.createElement("td", _extends({}, restProps, {
|
98
|
-
className: "
|
99
|
+
className: "".concat(className, " ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right' : '', " ")
|
99
100
|
}), editable ? getDataCell(props) : /*#__PURE__*/React.createElement(Texty, {
|
100
101
|
tooltipStyle: {
|
101
102
|
wordWrap: 'break-word'
|
@@ -10,7 +10,7 @@ import _Input from "antd/es/input";
|
|
10
10
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
11
11
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
12
12
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
13
|
-
var _excluded = ["title", "dataIndex", "isAddColumn", "children"];
|
13
|
+
var _excluded = ["title", "dataIndex", "isAddColumn", "children", "className"];
|
14
14
|
import { PlusSquareOutlined, DeleteOutlined } from '@ant-design/icons';
|
15
15
|
import React from 'react';
|
16
16
|
import { EditableContext } from '../interface';
|
@@ -23,6 +23,7 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
23
23
|
dataIndex = props.dataIndex,
|
24
24
|
isAddColumn = props.isAddColumn,
|
25
25
|
children = props.children,
|
26
|
+
className = props.className,
|
26
27
|
restProps = _objectWithoutProperties(props, _excluded);
|
27
28
|
|
28
29
|
var _ref = React.useContext(EditableContext) || undefined,
|
@@ -129,7 +130,7 @@ var EditableHeardCell = function EditableHeardCell(props) {
|
|
129
130
|
};
|
130
131
|
|
131
132
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("th", _extends({}, restProps, {
|
132
|
-
className: "ant-table-th font-bold ".concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
|
133
|
+
className: "".concat(className, " ant-table-th font-bold ").concat(isAddColumn && editConfig.editHeardCellKey === dataIndex ? 'border-right ' : '', " ")
|
133
134
|
}), isAddColumn && /*#__PURE__*/React.createElement(_Popover, {
|
134
135
|
placement: "rightTop",
|
135
136
|
content: content,
|
@@ -2,6 +2,9 @@
|
|
2
2
|
width: 100%;
|
3
3
|
height: 100%;
|
4
4
|
}
|
5
|
+
.ronds-edit-table table {
|
6
|
+
border-collapse: collapse !important;
|
7
|
+
}
|
5
8
|
.ronds-edit-table .ant-spin-nested-loading,
|
6
9
|
.ronds-edit-table .ant-spin-container,
|
7
10
|
.ronds-edit-table .ant-table,
|
@@ -15,7 +18,12 @@
|
|
15
18
|
height: 30px;
|
16
19
|
padding: 0px 8px !important;
|
17
20
|
}
|
21
|
+
.ronds-edit-table .ant-table-cell-fix-right {
|
22
|
+
position: sticky !important;
|
23
|
+
right: 0 !important;
|
24
|
+
}
|
18
25
|
.ronds-edit-table .ant-table-body {
|
26
|
+
height: 100%;
|
19
27
|
overflow-y: auto !important;
|
20
28
|
}
|
21
29
|
.ronds-edit-table .ant-table.ant-table-small .ant-table-thead > tr > th {
|
@@ -37,3 +45,26 @@
|
|
37
45
|
padding: 0% !important;
|
38
46
|
margin: 0% !important;
|
39
47
|
}
|
48
|
+
.ronds-edit-table .ant-table.ant-table-bordered > .ant-table-container > .ant-table-body > table > tbody > tr > td > .ant-table-expanded-row-fixed::after {
|
49
|
+
border-right: 0 !important;
|
50
|
+
}
|
51
|
+
.ronds-metadata-normal .ant-table {
|
52
|
+
border-right: 1px solid #f0f0f0 !important;
|
53
|
+
}
|
54
|
+
.ronds-metadata-normal .ant-table .ant-table-row--odd {
|
55
|
+
background-color: #ebebeb !important;
|
56
|
+
}
|
57
|
+
.ronds-metadata-normal .ant-table .ant-table-row--odd .ant-table-cell {
|
58
|
+
background-color: #ebebeb !important;
|
59
|
+
}
|
60
|
+
.ronds-metadata-normal .ant-table .ant-table-expanded-row-fixed::after {
|
61
|
+
border: 0 !important;
|
62
|
+
}
|
63
|
+
.ronds-metadata-normal .ant-table .ant-table-placeholder {
|
64
|
+
pointer-events: none;
|
65
|
+
background-color: #fff !important;
|
66
|
+
}
|
67
|
+
.ronds-metadata-normal .ant-table .ant-table-placeholder .ant-table-cell {
|
68
|
+
padding: 0 !important;
|
69
|
+
background-color: #fff !important;
|
70
|
+
}
|
@@ -169,6 +169,7 @@ var Editable = function Editable(props) {
|
|
169
169
|
|
170
170
|
setRecords(_toConsumableArray(_records3));
|
171
171
|
recordsRef.current = _records3;
|
172
|
+
onMulChange && onMulChange(_records3);
|
172
173
|
}
|
173
174
|
|
174
175
|
if (type === 'freedom') {
|
@@ -276,9 +277,7 @@ var Editable = function Editable(props) {
|
|
276
277
|
rowIndex: rowIndex
|
277
278
|
});
|
278
279
|
};
|
279
|
-
}
|
280
280
|
|
281
|
-
if (isAddColumn) {
|
282
281
|
_column.onHeaderCell = function (col) {
|
283
282
|
return _objectSpread({
|
284
283
|
width: col.width,
|
@@ -299,9 +298,9 @@ var Editable = function Editable(props) {
|
|
299
298
|
var _aciton_ = {
|
300
299
|
dataKey: '_aciton_',
|
301
300
|
title: tr('操作'),
|
302
|
-
width:
|
301
|
+
width: type === 'multiple' ? 50 : 100,
|
303
302
|
ellipsis: true,
|
304
|
-
fixed: '
|
303
|
+
fixed: 'right',
|
305
304
|
render: function render(val, record) {
|
306
305
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditableAction, {
|
307
306
|
type: type,
|
@@ -288,7 +288,7 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
288
288
|
var _defaultValues$index;
|
289
289
|
|
290
290
|
return /*#__PURE__*/React.createElement("div", {
|
291
|
-
key: field.key
|
291
|
+
key: "".concat(field.key)
|
292
292
|
}, /*#__PURE__*/React.createElement("div", {
|
293
293
|
style: {
|
294
294
|
display: 'flex',
|
@@ -388,13 +388,14 @@ var MetaFieldsEdit = function MetaFieldsEdit(props) {
|
|
388
388
|
}
|
389
389
|
}))), (refIds[index] || refSchema[index]) && /*#__PURE__*/React.createElement("div", {
|
390
390
|
style: {
|
391
|
-
border: 'var(--ronds-metadata-color-border-1)',
|
391
|
+
border: '1px solid var(--ronds-metadata-color-border-1)',
|
392
392
|
padding: '10px',
|
393
393
|
marginBottom: '10px'
|
394
394
|
}
|
395
395
|
}, /*#__PURE__*/React.createElement(MetadataForm, {
|
396
396
|
initialValues: defaultValues && defaultValues.length > 0 && ((_defaultValues$index = defaultValues[index]) === null || _defaultValues$index === void 0 ? void 0 : _defaultValues$index.value),
|
397
397
|
refId: refIds[index],
|
398
|
+
isFoldForm: true,
|
398
399
|
schema: refSchema[index],
|
399
400
|
onValuesChange: function onValuesChange(values, allValues) {
|
400
401
|
onRefRulesValuesChange(allValues, index);
|
@@ -62,6 +62,7 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
62
62
|
alignItems: 'flex-end'
|
63
63
|
}
|
64
64
|
}, /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
65
|
+
key: field.key,
|
65
66
|
className: "pr-10"
|
66
67
|
}, field, {
|
67
68
|
label: "\u5C5E\u6027\u540D\u79F0",
|
@@ -70,7 +71,9 @@ var MetaPropsEdit = function MetaPropsEdit(props) {
|
|
70
71
|
rules: [{
|
71
72
|
required: true
|
72
73
|
}]
|
73
|
-
}), /*#__PURE__*/React.createElement(_Input, null)), /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
74
|
+
}), /*#__PURE__*/React.createElement(_Input, null)), /*#__PURE__*/React.createElement(_Form.Item, _extends({
|
75
|
+
key: field.key
|
76
|
+
}, field, {
|
74
77
|
label: "\u5C5E\u6027\u7C7B\u578B",
|
75
78
|
name: [field.name, 'type'],
|
76
79
|
fieldKey: [field.fieldKey, 'type'],
|
@@ -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-05-
|
11
|
+
* @LastEditTime: 2022-05-14 08:29:16
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
@@ -16,6 +16,8 @@ import { MetadataFormContext } from '../interface';
|
|
16
16
|
import { useGetExtraInfo } from '../hooks';
|
17
17
|
import { getDataCell } from '../utils';
|
18
18
|
import { deepClone } from '../../../utils';
|
19
|
+
import { tr } from '../../../framework/locale';
|
20
|
+
import TableArray from './layout/TableArray';
|
19
21
|
|
20
22
|
function Index(props) {
|
21
23
|
var _fieldRule$, _fieldRule$$value;
|
@@ -70,7 +72,12 @@ function Index(props) {
|
|
70
72
|
top: '19px',
|
71
73
|
background: '#fff'
|
72
74
|
}
|
73
|
-
}, help || (items === null || items === void 0 ? void 0 : items.type))), /*#__PURE__*/React.createElement(
|
75
|
+
}, help || (items === null || items === void 0 ? void 0 : items.type))), extraInfo.layout === 'table' && items.type === 'ref' ? /*#__PURE__*/React.createElement(TableArray, {
|
76
|
+
initValue: formContext.initialValues,
|
77
|
+
refId: items.refId,
|
78
|
+
form: formContext.form,
|
79
|
+
name: id
|
80
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
74
81
|
style: {
|
75
82
|
padding: '10px',
|
76
83
|
border: '1px solid var(--ronds-metadata-color-border-1)',
|
@@ -116,7 +123,7 @@ function Index(props) {
|
|
116
123
|
return add();
|
117
124
|
},
|
118
125
|
icon: /*#__PURE__*/React.createElement(PlusOutlined, null)
|
119
|
-
},
|
126
|
+
}, tr('添加'))));
|
120
127
|
})));
|
121
128
|
}
|
122
129
|
|
@@ -18,7 +18,7 @@ import _Input from "antd/es/input";
|
|
18
18
|
/*
|
19
19
|
* @Author: wangxian
|
20
20
|
* @Date: 2021-09-18 14:15:04
|
21
|
-
* @LastEditTime: 2022-05-
|
21
|
+
* @LastEditTime: 2022-05-11 16:39:26
|
22
22
|
*/
|
23
23
|
import React from 'react';
|
24
24
|
import { BgColorsOutlined } from '@ant-design/icons';
|
@@ -136,6 +136,11 @@ function Index(props) {
|
|
136
136
|
}
|
137
137
|
|
138
138
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
139
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
140
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
141
|
+
style: {
|
142
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
143
|
+
},
|
139
144
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
140
145
|
name: name,
|
141
146
|
rules: [{
|
@@ -44,6 +44,11 @@ function Index(props) {
|
|
44
44
|
}
|
45
45
|
|
46
46
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
47
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
48
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
49
|
+
style: {
|
50
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
51
|
+
},
|
47
52
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
48
53
|
name: name,
|
49
54
|
rules: [{
|
@@ -3,12 +3,15 @@ import "antd/es/form/style";
|
|
3
3
|
import _Form from "antd/es/form";
|
4
4
|
import "antd/es/select/style";
|
5
5
|
import _Select from "antd/es/select";
|
6
|
+
import "antd/es/button/style";
|
7
|
+
import _Button from "antd/es/button";
|
6
8
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
7
9
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
8
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
9
11
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
10
12
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
11
13
|
import React from 'react';
|
14
|
+
import { CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons';
|
12
15
|
import { MetadataService } from '../../../framework/metadata/MetadataService';
|
13
16
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
14
17
|
import { useGetExtraInfo } from '../hooks';
|
@@ -26,32 +29,34 @@ function Index(props) {
|
|
26
29
|
field = props.field,
|
27
30
|
name = props.name;
|
28
31
|
var formContext = React.useContext(MetadataFormContext) || {};
|
29
|
-
var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type);
|
32
|
+
var extraInfo = useGetExtraInfo(formContext.fields, id, formContext.form, props.type); // 是否折叠
|
30
33
|
|
31
|
-
var _React$useState = React.useState(
|
34
|
+
var _React$useState = React.useState(true),
|
32
35
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
33
|
-
|
34
|
-
|
36
|
+
isFold = _React$useState2[0],
|
37
|
+
setIsFold = _React$useState2[1];
|
35
38
|
|
36
|
-
var _React$useState3 = React.useState(
|
39
|
+
var _React$useState3 = React.useState([]),
|
37
40
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
38
|
-
|
39
|
-
|
41
|
+
schema = _React$useState4[0],
|
42
|
+
setSchema = _React$useState4[1];
|
40
43
|
|
41
|
-
var
|
42
|
-
|
43
|
-
var _React$useState5 = React.useState([]),
|
44
|
+
var _React$useState5 = React.useState({}),
|
44
45
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
45
|
-
|
46
|
-
|
46
|
+
refFields = _React$useState6[0],
|
47
|
+
setRefFields = _React$useState6[1];
|
47
48
|
|
48
|
-
var
|
49
|
+
var refFieldsRef = React.useRef(refFields);
|
50
|
+
|
51
|
+
var _React$useState7 = React.useState([]),
|
49
52
|
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
50
|
-
|
51
|
-
|
52
|
-
// debugger;
|
53
|
-
// }
|
53
|
+
options = _React$useState8[0],
|
54
|
+
setOptions = _React$useState8[1];
|
54
55
|
|
56
|
+
var _React$useState9 = React.useState(''),
|
57
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
58
|
+
help = _React$useState10[0],
|
59
|
+
setHelp = _React$useState10[1];
|
55
60
|
|
56
61
|
var onSearch = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
57
62
|
var param, server, res, _options, i, obj;
|
@@ -151,19 +156,32 @@ function Index(props) {
|
|
151
156
|
|
152
157
|
if (isRefForm && !field && schema.length > 0) {
|
153
158
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
159
|
+
style: {
|
160
|
+
display: 'flex',
|
161
|
+
alignItems: 'center'
|
162
|
+
}
|
163
|
+
}, /*#__PURE__*/React.createElement("div", {
|
154
164
|
className: "ant-form-item-label",
|
155
165
|
style: {
|
156
166
|
width: '100%',
|
157
|
-
textAlign: 'left'
|
167
|
+
textAlign: 'left',
|
168
|
+
flex: '1'
|
158
169
|
}
|
159
170
|
}, /*#__PURE__*/React.createElement("label", {
|
160
171
|
className: "".concat((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require) && 'ant-form-item-required')
|
161
|
-
}, extraInfo.label || id)), /*#__PURE__*/React.createElement("div", {
|
172
|
+
}, extraInfo.label || id)), formContext.isFoldForm && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Button, {
|
173
|
+
type: "link",
|
174
|
+
onClick: function onClick() {
|
175
|
+
setIsFold(!isFold);
|
176
|
+
},
|
177
|
+
icon: isFold ? /*#__PURE__*/React.createElement(CaretDownOutlined, null) : /*#__PURE__*/React.createElement(CaretUpOutlined, null)
|
178
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
162
179
|
style: {
|
163
180
|
padding: '10px',
|
164
181
|
border: '1px solid var(--ronds-metadata-color-border-1)',
|
165
182
|
width: '100%',
|
166
|
-
borderRadius: '4px'
|
183
|
+
borderRadius: '4px',
|
184
|
+
display: "".concat(isFold ? 'none' : 'block')
|
167
185
|
}
|
168
186
|
}, /*#__PURE__*/React.createElement(MetadataRefContext.Provider, {
|
169
187
|
value: {
|
@@ -188,7 +206,12 @@ function Index(props) {
|
|
188
206
|
}
|
189
207
|
|
190
208
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
209
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
191
210
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
211
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
212
|
+
style: {
|
213
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
214
|
+
},
|
192
215
|
name: id,
|
193
216
|
rules: [{
|
194
217
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
/*
|
10
10
|
* @Author:wangxian
|
11
11
|
* @Date: 2021-09-18 14:15:04
|
12
|
-
* @LastEditTime: 2022-05-
|
12
|
+
* @LastEditTime: 2022-05-11 16:41:22
|
13
13
|
*/
|
14
14
|
import React from 'react';
|
15
15
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -93,6 +93,11 @@ function Index(props) {
|
|
93
93
|
}
|
94
94
|
|
95
95
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
96
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
97
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
98
|
+
style: {
|
99
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
100
|
+
},
|
96
101
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
97
102
|
name: name,
|
98
103
|
rules: [{
|
@@ -8,7 +8,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
8
8
|
/*
|
9
9
|
* @Author: wangxian
|
10
10
|
* @Date: 2021-09-18 14:15:04
|
11
|
-
* @LastEditTime: 2022-05-
|
11
|
+
* @LastEditTime: 2022-05-11 16:41:29
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -53,6 +53,11 @@ function Index(props) {
|
|
53
53
|
|
54
54
|
return !field ? /*#__PURE__*/React.createElement(_Form.Item, {
|
55
55
|
label: (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id,
|
56
|
+
key: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
57
|
+
initialValue: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.defaultValue,
|
58
|
+
style: {
|
59
|
+
display: "".concat(extraInfo.hidden ? 'none' : 'block')
|
60
|
+
},
|
56
61
|
name: name,
|
57
62
|
valuePropName: "checked",
|
58
63
|
rules: [{
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import "antd/es/form/style";
|
2
|
+
import _Form from "antd/es/form";
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
4
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
7
|
+
import React, { useRef } from 'react';
|
8
|
+
import { MetadataService } from '../../../../framework/metadata/MetadataService';
|
9
|
+
import { JsonMetadataProvider } from '../../../../framework/metadata';
|
10
|
+
import Editable from '../../../../comps/Editable';
|
11
|
+
|
12
|
+
var TableArray = function TableArray(props) {
|
13
|
+
var initValue = props.initValue,
|
14
|
+
name = props.name,
|
15
|
+
form = props.form,
|
16
|
+
refId = props.refId;
|
17
|
+
|
18
|
+
var _React$useState = React.useState([]),
|
19
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
20
|
+
schema = _React$useState2[0],
|
21
|
+
setSchema = _React$useState2[1];
|
22
|
+
|
23
|
+
var _React$useState3 = React.useState({}),
|
24
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
25
|
+
defaultValue = _React$useState4[0],
|
26
|
+
setDefaultValue = _React$useState4[1];
|
27
|
+
|
28
|
+
var _React$useState5 = React.useState({}),
|
29
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
30
|
+
refFields = _React$useState6[0],
|
31
|
+
setRefFields = _React$useState6[1];
|
32
|
+
|
33
|
+
var refFieldsRef = React.useRef(refFields);
|
34
|
+
var firstLoadRef = useRef(true);
|
35
|
+
|
36
|
+
var _React$useState7 = React.useState([]),
|
37
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
38
|
+
list = _React$useState8[0],
|
39
|
+
setList = _React$useState8[1];
|
40
|
+
|
41
|
+
React.useEffect(function () {
|
42
|
+
if (refId) {
|
43
|
+
var server = new MetadataService();
|
44
|
+
server.GetMetadataDetailById(refId).then(function (res) {
|
45
|
+
var provider = new JsonMetadataProvider();
|
46
|
+
|
47
|
+
if (res === null || res === void 0 ? void 0 : res.schema) {
|
48
|
+
var mySchema = JSON.parse(res.schema);
|
49
|
+
provider.add_types(mySchema);
|
50
|
+
var FormCls = provider.get_type(mySchema[0].id);
|
51
|
+
var formCls = new FormCls();
|
52
|
+
var _fields = formCls.__type__.__fields__;
|
53
|
+
refFieldsRef.current = _fields;
|
54
|
+
setRefFields(_objectSpread({}, _fields));
|
55
|
+
setSchema(_toConsumableArray(mySchema));
|
56
|
+
setDefaultValue(_objectSpread({}, JSON.parse(JSON.stringify(formCls))));
|
57
|
+
return function () {
|
58
|
+
provider = null;
|
59
|
+
};
|
60
|
+
}
|
61
|
+
|
62
|
+
return function () {
|
63
|
+
provider = null;
|
64
|
+
};
|
65
|
+
});
|
66
|
+
return function () {
|
67
|
+
server = null;
|
68
|
+
};
|
69
|
+
}
|
70
|
+
|
71
|
+
return function () {};
|
72
|
+
}, [refId]);
|
73
|
+
React.useEffect(function () {
|
74
|
+
if (initValue && firstLoadRef.current) {
|
75
|
+
setList(_toConsumableArray(initValue[name]));
|
76
|
+
firstLoadRef.current = false;
|
77
|
+
}
|
78
|
+
}, [initValue, form]);
|
79
|
+
var processSchemaToColumns = React.useCallback(function (_properties) {
|
80
|
+
var _columns = [];
|
81
|
+
|
82
|
+
for (var i = 0; i < _properties.length; i++) {
|
83
|
+
var _it$fields$0$value, _it$fields$0$value$co, _it$fields$0$value2;
|
84
|
+
|
85
|
+
var it = _properties[i];
|
86
|
+
var obj = {
|
87
|
+
title: (it === null || it === void 0 ? void 0 : (_it$fields$0$value = it.fields[0].value) === null || _it$fields$0$value === void 0 ? void 0 : (_it$fields$0$value$co = _it$fields$0$value.common) === null || _it$fields$0$value$co === void 0 ? void 0 : _it$fields$0$value$co.label) || (it === null || it === void 0 ? void 0 : (_it$fields$0$value2 = it.fields[0].value) === null || _it$fields$0$value2 === void 0 ? void 0 : _it$fields$0$value2.label) || it.id,
|
88
|
+
key: it.id,
|
89
|
+
dataIndex: it.id,
|
90
|
+
width: 100,
|
91
|
+
editable: true,
|
92
|
+
type: it.type
|
93
|
+
}; // 留一列不设宽度以适应弹性布局
|
94
|
+
|
95
|
+
if (i === 0) {
|
96
|
+
delete obj.width;
|
97
|
+
}
|
98
|
+
|
99
|
+
_columns.push(obj);
|
100
|
+
}
|
101
|
+
|
102
|
+
return _columns;
|
103
|
+
}, []);
|
104
|
+
var columns = React.useMemo(function () {
|
105
|
+
var _columns = [];
|
106
|
+
|
107
|
+
if (schema.length > 0) {
|
108
|
+
_columns = processSchemaToColumns(schema[0].properties);
|
109
|
+
}
|
110
|
+
|
111
|
+
return _columns;
|
112
|
+
}, [schema, processSchemaToColumns]);
|
113
|
+
|
114
|
+
var onTableChange = function onTableChange(values) {
|
115
|
+
form.setFieldsValue(_objectSpread({}, _defineProperty({}, "".concat(name), values)));
|
116
|
+
};
|
117
|
+
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
119
|
+
style: {
|
120
|
+
width: '100%',
|
121
|
+
height: '340px'
|
122
|
+
}
|
123
|
+
}, /*#__PURE__*/React.createElement(_Form.Item, {
|
124
|
+
name: name,
|
125
|
+
style: {
|
126
|
+
margin: 0
|
127
|
+
}
|
128
|
+
}, /*#__PURE__*/React.createElement(Editable, {
|
129
|
+
type: "multiple",
|
130
|
+
defaultValue: defaultValue,
|
131
|
+
addPosition: "bottom",
|
132
|
+
columns: columns,
|
133
|
+
dataSource: list,
|
134
|
+
onMulChange: onTableChange,
|
135
|
+
tableProps: {
|
136
|
+
scroll: {
|
137
|
+
x: '100%',
|
138
|
+
y: '300px'
|
139
|
+
}
|
140
|
+
}
|
141
|
+
})));
|
142
|
+
};
|
143
|
+
|
144
|
+
export default TableArray;
|
@@ -5,7 +5,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
/*
|
6
6
|
* @Author: your name
|
7
7
|
* @Date: 2021-09-18 14:15:04
|
8
|
-
* @LastEditTime: 2022-05-11
|
8
|
+
* @LastEditTime: 2022-05-11 16:07:30
|
9
9
|
* @LastEditors: Please set LastEditors
|
10
10
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
11
11
|
* @FilePath: \ronds.metadata\src\comps\MetadataForm\hooks\index.tsx
|
@@ -37,7 +37,12 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form, type) {
|
|
37
37
|
}
|
38
38
|
|
39
39
|
// 兼容 common公共的属性
|
40
|
-
|
40
|
+
if (_extraInfo['common-en-US']) {
|
41
|
+
_extraInfo = _objectSpread(_objectSpread(_objectSpread({}, _extraInfo), _extraInfo[languageMap[getLocale()]]), _extraInfo[type]);
|
42
|
+
} else {
|
43
|
+
_extraInfo = _objectSpread(_objectSpread(_objectSpread({}, _extraInfo), _extraInfo.common), _extraInfo[type]);
|
44
|
+
}
|
45
|
+
|
41
46
|
delete _extraInfo.common;
|
42
47
|
delete _extraInfo['common-en-US'];
|
43
48
|
delete _extraInfo[type];
|
@@ -24,6 +24,8 @@ var MetadataForm = function MetadataForm(props) {
|
|
24
24
|
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
25
25
|
_props$isRefForm = props.isRefForm,
|
26
26
|
isRefForm = _props$isRefForm === void 0 ? true : _props$isRefForm,
|
27
|
+
_props$isFoldForm = props.isFoldForm,
|
28
|
+
isFoldForm = _props$isFoldForm === void 0 ? false : _props$isFoldForm,
|
27
29
|
_props$isShowTypeInfo = props.isShowTypeInfo,
|
28
30
|
isShowTypeInfo = _props$isShowTypeInfo === void 0 ? false : _props$isShowTypeInfo,
|
29
31
|
initEnumValue = props.initEnumValue,
|
@@ -42,6 +44,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
42
44
|
fields = _React$useState4[0],
|
43
45
|
setFields = _React$useState4[1];
|
44
46
|
|
47
|
+
var firstLoadRef = React.useRef(true);
|
45
48
|
var stream$ = useMemoSubject();
|
46
49
|
useObservable(function (p) {
|
47
50
|
if ((p === null || p === void 0 ? void 0 : p.type) === 'onSelectChange') {
|
@@ -98,9 +101,10 @@ var MetadataForm = function MetadataForm(props) {
|
|
98
101
|
return function () {};
|
99
102
|
}, [mySchma]);
|
100
103
|
React.useEffect(function () {
|
101
|
-
if (initialValues) {
|
104
|
+
if (initialValues && firstLoadRef.current) {
|
102
105
|
setTimeout(function () {
|
103
106
|
form.setFieldsValue(_objectSpread({}, initialValues));
|
107
|
+
firstLoadRef.current = false;
|
104
108
|
}, 500);
|
105
109
|
}
|
106
110
|
}, [initialValues]);
|
@@ -110,7 +114,8 @@ var MetadataForm = function MetadataForm(props) {
|
|
110
114
|
form: form,
|
111
115
|
stream$: stream$,
|
112
116
|
initialValues: initialValues,
|
113
|
-
isShowTypeInfo: isShowTypeInfo
|
117
|
+
isShowTypeInfo: isShowTypeInfo,
|
118
|
+
isFoldForm: isFoldForm
|
114
119
|
}
|
115
120
|
}, /*#__PURE__*/React.createElement(_Form, {
|
116
121
|
className: "metadata-form",
|
@@ -120,8 +125,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
120
125
|
},
|
121
126
|
layout: "horizontal",
|
122
127
|
form: form,
|
123
|
-
name: "control-hooks"
|
124
|
-
,
|
128
|
+
name: "control-hooks",
|
125
129
|
onFinish: onFinish,
|
126
130
|
onValuesChange: onValuesChange
|
127
131
|
}, renderForm(mySchma, options, stream$))));
|
@@ -6,6 +6,7 @@ export interface IMetadataFormContextProps {
|
|
6
6
|
stream$: any;
|
7
7
|
initialValues: any;
|
8
8
|
isShowTypeInfo: boolean;
|
9
|
+
isFoldForm: boolean;
|
9
10
|
}
|
10
11
|
export declare const MetadataFormContext: React.Context<IMetadataFormContextProps>;
|
11
12
|
export interface IMetadataRefContextProps {
|