ronds-metadata 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ import _Input from "antd/es/input";
|
|
17
17
|
/*
|
18
18
|
* @Author: wangxian
|
19
19
|
* @Date: 2021-09-18 14:15:04
|
20
|
-
* @LastEditTime: 2023-02-
|
20
|
+
* @LastEditTime: 2023-02-22 15:51:51
|
21
21
|
*/
|
22
22
|
import React from 'react';
|
23
23
|
import { UploadOutlined } from '@ant-design/icons';
|
@@ -32,6 +32,7 @@ function Index(props) {
|
|
32
32
|
isRefForm = props.isRefForm,
|
33
33
|
disabled = props.disabled,
|
34
34
|
field = props.field,
|
35
|
+
labelSpan = props.labelSpan,
|
35
36
|
name = props.name,
|
36
37
|
isObj = props.isObj;
|
37
38
|
var formContext = React.useContext(MetadataFormContext) || {};
|
@@ -156,6 +157,14 @@ function Index(props) {
|
|
156
157
|
color: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.color
|
157
158
|
} : {}
|
158
159
|
}, (extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.label) || id),
|
160
|
+
labelCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
161
|
+
span: labelSpan,
|
162
|
+
offset: 0
|
163
|
+
} : undefined,
|
164
|
+
wrapperCol: labelSpan && (formContext === null || formContext === void 0 ? void 0 : formContext.layout) === 'horizontal' ? {
|
165
|
+
span: 24 - labelSpan,
|
166
|
+
offset: 0
|
167
|
+
} : undefined,
|
159
168
|
name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter6 = extraInfo.addonAfter) === null || _extraInfo$addonAfter6 === void 0 ? void 0 : _extraInfo$addonAfter6.key) ? [].concat(_toConsumableArray(name), ['value']) : name,
|
160
169
|
rules: [{
|
161
170
|
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
@@ -34,6 +34,21 @@ export function withAddOnAfter(WrappedComponent) {
|
|
34
34
|
cellColSpan = _React$useState4[0],
|
35
35
|
setCellColSpan = _React$useState4[1];
|
36
36
|
|
37
|
+
var labelSpan = React.useMemo(function () {
|
38
|
+
var _fields$0$value, _fields$0$value$commo;
|
39
|
+
|
40
|
+
var _labelSpan = undefined;
|
41
|
+
|
42
|
+
var _colSpan = fields && ((_fields$0$value = fields[0].value) === null || _fields$0$value === void 0 ? void 0 : (_fields$0$value$commo = _fields$0$value.common) === null || _fields$0$value$commo === void 0 ? void 0 : _fields$0$value$commo.colSpan);
|
43
|
+
|
44
|
+
var _formLabelSpan = formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan;
|
45
|
+
|
46
|
+
if (_colSpan && _formLabelSpan) {
|
47
|
+
_labelSpan = _formLabelSpan / _colSpan;
|
48
|
+
}
|
49
|
+
|
50
|
+
return _labelSpan;
|
51
|
+
}, [fields, formContext === null || formContext === void 0 ? void 0 : formContext.colSpan, formContext === null || formContext === void 0 ? void 0 : formContext.labelSpan]);
|
37
52
|
React.useEffect(function () {
|
38
53
|
if (refId) {
|
39
54
|
var arr = refId.split(':');
|
@@ -87,6 +102,7 @@ export function withAddOnAfter(WrappedComponent) {
|
|
87
102
|
display: 'flex !important'
|
88
103
|
},
|
89
104
|
name: _name,
|
105
|
+
labelSpan: labelSpan,
|
90
106
|
isObj: isObj
|
91
107
|
})), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
92
108
|
className: "with-add-on-after-extra"
|
@@ -236,7 +236,7 @@ var MetadataForm = function MetadataForm(props) {
|
|
236
236
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MetadataFormContext.Provider, {
|
237
237
|
value: {
|
238
238
|
fields: fields,
|
239
|
-
colSpan: colSpan,
|
239
|
+
colSpan: (formFieldValue === null || formFieldValue === void 0 ? void 0 : formFieldValue.colSpan) || colSpan,
|
240
240
|
labelSpan: myLabelSpan,
|
241
241
|
layout: myLayout,
|
242
242
|
form: form,
|