ronds-metadata 1.2.11 → 1.2.12
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/transformer.js +6 -6
- package/es/comps/MetadataForm/DataCell/Input.js +5 -4
- package/es/comps/MetadataForm/DataCell/Number.js +5 -4
- package/es/comps/MetadataForm/DataCell/Select.js +5 -4
- package/es/comps/MetadataForm/DataCell/Switch.js +5 -4
- package/es/comps/MetadataForm/HOC/index.js +5 -4
- package/es/comps/MetadataForm/hooks/index.js +13 -2
- package/es/comps/MetadataForm/interface.d.ts +2 -1
- package/es/comps/MetadataForm/interface.js +1 -1
- package/package.json +1 -1
@@ -4,7 +4,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
/*
|
5
5
|
* @Author: wangxian
|
6
6
|
* @Date: 2023-02-08 14:45:46
|
7
|
-
* @LastEditTime: 2023-02-
|
7
|
+
* @LastEditTime: 2023-02-28 09:22:50
|
8
8
|
*/
|
9
9
|
import { deepClone } from '../../utils';
|
10
10
|
import { basicComps, complexComps, layoutComps } from './settings';
|
@@ -205,25 +205,25 @@ var getTypeJson = function getTypeJson(id, type, field) {
|
|
205
205
|
|
206
206
|
|
207
207
|
if (type === 'enum') {
|
208
|
-
var _field$enum, _field$enum2, _field$enum3, _field$enum4;
|
208
|
+
var _field$enum, _field$enum2, _field$enum3, _field$enum4, _field$enum5, _field$enum6, _field$enum7, _field$enum8;
|
209
209
|
|
210
210
|
// select
|
211
|
-
if ((field === null || field === void 0 ? void 0 : (_field$enum = field.enum) === null || _field$enum === void 0 ? void 0 : _field$enum.type) !== 'checkbox' && !field.enum.isMutiple) {
|
211
|
+
if ((field === null || field === void 0 ? void 0 : (_field$enum = field.enum) === null || _field$enum === void 0 ? void 0 : _field$enum.type) !== 'checkbox' && !((_field$enum2 = field.enum) === null || _field$enum2 === void 0 ? void 0 : _field$enum2.isMutiple)) {
|
212
212
|
res = renderJson(basicComps, 'select', id, field);
|
213
213
|
} // mutiSelect
|
214
214
|
|
215
215
|
|
216
|
-
if ((field === null || field === void 0 ? void 0 : (_field$
|
216
|
+
if ((field === null || field === void 0 ? void 0 : (_field$enum3 = field.enum) === null || _field$enum3 === void 0 ? void 0 : _field$enum3.type) !== 'checkbox' && ((_field$enum4 = field.enum) === null || _field$enum4 === void 0 ? void 0 : _field$enum4.isMutiple)) {
|
217
217
|
res = renderJson(basicComps, 'mutiSelect', id, field);
|
218
218
|
} // checkbox
|
219
219
|
|
220
220
|
|
221
|
-
if ((field === null || field === void 0 ? void 0 : (_field$
|
221
|
+
if ((field === null || field === void 0 ? void 0 : (_field$enum5 = field.enum) === null || _field$enum5 === void 0 ? void 0 : _field$enum5.type) === 'checkbox' && ((_field$enum6 = field.enum) === null || _field$enum6 === void 0 ? void 0 : _field$enum6.isMutiple)) {
|
222
222
|
res = renderJson(complexComps, 'checkbox', id, field);
|
223
223
|
} // radio
|
224
224
|
|
225
225
|
|
226
|
-
if ((field === null || field === void 0 ? void 0 : (_field$
|
226
|
+
if ((field === null || field === void 0 ? void 0 : (_field$enum7 = field.enum) === null || _field$enum7 === void 0 ? void 0 : _field$enum7.type) === 'checkbox' && !((_field$enum8 = field.enum) === null || _field$enum8 === void 0 ? void 0 : _field$enum8.isMutiple)) {
|
227
227
|
res = renderJson(complexComps, 'radio', id, field);
|
228
228
|
}
|
229
229
|
} // obj
|
@@ -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-28 10:18:07
|
21
21
|
*/
|
22
22
|
import React from 'react';
|
23
23
|
import { UploadOutlined } from '@ant-design/icons';
|
@@ -31,6 +31,7 @@ function Index(props) {
|
|
31
31
|
var id = props.id,
|
32
32
|
isRefForm = props.isRefForm,
|
33
33
|
disabled = props.disabled,
|
34
|
+
notRequire = props.notRequire,
|
34
35
|
field = props.field,
|
35
36
|
labelSpan = props.labelSpan,
|
36
37
|
name = props.name,
|
@@ -145,7 +146,7 @@ function Index(props) {
|
|
145
146
|
} : undefined,
|
146
147
|
name: (extraInfo === null || extraInfo === void 0 ? void 0 : (_extraInfo$addonAfter5 = extraInfo.addonAfter) === null || _extraInfo$addonAfter5 === void 0 ? void 0 : _extraInfo$addonAfter5.key) ? [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name), ['value']) : [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
147
148
|
rules: [{
|
148
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
149
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
149
150
|
}].concat(_toConsumableArray(rules)),
|
150
151
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
151
152
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -176,7 +177,7 @@ function Index(props) {
|
|
176
177
|
} : undefined,
|
177
178
|
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,
|
178
179
|
rules: [{
|
179
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
180
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
180
181
|
}].concat(_toConsumableArray(rules)),
|
181
182
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
182
183
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -187,7 +188,7 @@ function Index(props) {
|
|
187
188
|
},
|
188
189
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
189
190
|
rules: [{
|
190
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
191
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
191
192
|
}].concat(_toConsumableArray(rules)),
|
192
193
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
193
194
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -9,7 +9,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
/*
|
10
10
|
* @Author: wangxian
|
11
11
|
* @Date: 2021-09-18 14:15:04
|
12
|
-
* @LastEditTime: 2023-02-
|
12
|
+
* @LastEditTime: 2023-02-28 10:19:20
|
13
13
|
*/
|
14
14
|
import React from 'react';
|
15
15
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -22,6 +22,7 @@ function Index(props) {
|
|
22
22
|
name = props.name,
|
23
23
|
isRefForm = props.isRefForm,
|
24
24
|
disabled = props.disabled,
|
25
|
+
notRequire = props.notRequire,
|
25
26
|
labelSpan = props.labelSpan,
|
26
27
|
field = props.field,
|
27
28
|
isObj = props.isObj;
|
@@ -72,7 +73,7 @@ function Index(props) {
|
|
72
73
|
offset: 0
|
73
74
|
} : undefined,
|
74
75
|
rules: [{
|
75
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
76
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
76
77
|
}].concat(_toConsumableArray(rules)),
|
77
78
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
78
79
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -103,7 +104,7 @@ function Index(props) {
|
|
103
104
|
} : undefined,
|
104
105
|
name: name,
|
105
106
|
rules: [{
|
106
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
107
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
107
108
|
}].concat(_toConsumableArray(rules)),
|
108
109
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
109
110
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -117,7 +118,7 @@ function Index(props) {
|
|
117
118
|
},
|
118
119
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
119
120
|
rules: [{
|
120
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
121
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
121
122
|
}].concat(_toConsumableArray(rules)),
|
122
123
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
123
124
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -32,7 +32,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
32
32
|
/*
|
33
33
|
* @Author:wangxian
|
34
34
|
* @Date: 2021-09-18 14:15:04
|
35
|
-
* @LastEditTime: 2023-02-28
|
35
|
+
* @LastEditTime: 2023-02-28 10:19:57
|
36
36
|
*/
|
37
37
|
import React from 'react';
|
38
38
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -54,6 +54,7 @@ function Index(props) {
|
|
54
54
|
initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
|
55
55
|
disabled = props.disabled,
|
56
56
|
field = props.field,
|
57
|
+
notRequire = props.notRequire,
|
57
58
|
labelSpan = props.labelSpan,
|
58
59
|
isObj = props.isObj,
|
59
60
|
_props$enum = props.enum,
|
@@ -508,7 +509,7 @@ function Index(props) {
|
|
508
509
|
} : undefined,
|
509
510
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
510
511
|
rules: [{
|
511
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
512
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
512
513
|
}],
|
513
514
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
514
515
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -536,7 +537,7 @@ function Index(props) {
|
|
536
537
|
} : undefined,
|
537
538
|
name: name,
|
538
539
|
rules: [{
|
539
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
540
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
540
541
|
}],
|
541
542
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
542
543
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -547,7 +548,7 @@ function Index(props) {
|
|
547
548
|
},
|
548
549
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
549
550
|
rules: [{
|
550
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
551
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
551
552
|
}],
|
552
553
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
553
554
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -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: 2023-02-
|
11
|
+
* @LastEditTime: 2023-02-28 10:01:17
|
12
12
|
*/
|
13
13
|
import React from 'react';
|
14
14
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
@@ -21,6 +21,7 @@ function Index(props) {
|
|
21
21
|
name = props.name,
|
22
22
|
isRefForm = props.isRefForm,
|
23
23
|
disabled = props.disabled,
|
24
|
+
notRequire = props.notRequire,
|
24
25
|
labelSpan = props.labelSpan,
|
25
26
|
field = props.field,
|
26
27
|
isObj = props.isObj;
|
@@ -52,7 +53,7 @@ function Index(props) {
|
|
52
53
|
name: [field === null || field === void 0 ? void 0 : field.name].concat(_toConsumableArray(name)),
|
53
54
|
valuePropName: "checked",
|
54
55
|
rules: [{
|
55
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
56
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
56
57
|
}],
|
57
58
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
58
59
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -85,7 +86,7 @@ function Index(props) {
|
|
85
86
|
name: name,
|
86
87
|
valuePropName: "checked",
|
87
88
|
rules: [{
|
88
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
89
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
89
90
|
}],
|
90
91
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
91
92
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -101,7 +102,7 @@ function Index(props) {
|
|
101
102
|
name: [field === null || field === void 0 ? void 0 : field.name],
|
102
103
|
valuePropName: "checked",
|
103
104
|
rules: [{
|
104
|
-
required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
105
|
+
required: notRequire ? !notRequire : extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
|
105
106
|
}],
|
106
107
|
help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
|
107
108
|
tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
|
@@ -9,7 +9,7 @@ import { MetadataFormContext } from '../interface';
|
|
9
9
|
import './index.less';
|
10
10
|
export function withAddOnAfter(WrappedComponent) {
|
11
11
|
return function (props) {
|
12
|
-
var _fields$, _fields$$value, _fields$$value$common, _fields$4, _fields$4$value, _fields$4$value$commo, _fields$4$value$commo2;
|
12
|
+
var _fields$, _fields$$value, _fields$$value$common, _fields$4, _fields$4$value, _fields$4$value$commo, _fields$4$value$commo2, _fields$5, _fields$5$value, _fields$5$value$commo;
|
13
13
|
|
14
14
|
var type = props.type,
|
15
15
|
refId = props.refId,
|
@@ -102,7 +102,7 @@ export function withAddOnAfter(WrappedComponent) {
|
|
102
102
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
103
103
|
}
|
104
104
|
|
105
|
-
return /*#__PURE__*/React.createElement(_Col, {
|
105
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Col, {
|
106
106
|
key: id,
|
107
107
|
span: cellColSpan
|
108
108
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -117,9 +117,10 @@ export function withAddOnAfter(WrappedComponent) {
|
|
117
117
|
},
|
118
118
|
name: _name,
|
119
119
|
labelSpan: labelSpan,
|
120
|
-
isObj: isObj
|
120
|
+
isObj: isObj,
|
121
|
+
notRequire: depend === null || depend === void 0 ? void 0 : depend.notRequire
|
121
122
|
})), isShowTypeInfo && !field && type !== 'number' && type !== 'bool' && /*#__PURE__*/React.createElement("div", {
|
122
123
|
className: "with-add-on-after-extra"
|
123
|
-
}, help !== null && help !== void 0 ? help : type)));
|
124
|
+
}, help !== null && help !== void 0 ? help : type))), ((_fields$5 = fields[0]) === null || _fields$5 === void 0 ? void 0 : (_fields$5$value = _fields$5.value) === null || _fields$5$value === void 0 ? void 0 : (_fields$5$value$commo = _fields$5$value.common) === null || _fields$5$value$commo === void 0 ? void 0 : _fields$5$value$commo.br) && /*#__PURE__*/React.createElement(_Col, null));
|
124
125
|
};
|
125
126
|
}
|
@@ -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: 2023-02-
|
8
|
+
* @LastEditTime: 2023-02-28 11:03:50
|
9
9
|
*/
|
10
10
|
import { getLocale } from '../../../framework/locale';
|
11
11
|
import moment from 'moment';
|
@@ -89,6 +89,17 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
|
|
89
89
|
setDepends(_objectSpread({}, _dr2));
|
90
90
|
dependsRef.current = _dr2;
|
91
91
|
}
|
92
|
+
|
93
|
+
if (_depends === null || _depends === void 0 ? void 0 : _depends.notRequire) {
|
94
|
+
var _p$payload3;
|
95
|
+
|
96
|
+
var _show2 = processDependHiddenOrShow(_depends === null || _depends === void 0 ? void 0 : _depends.notRequire, p === null || p === void 0 ? void 0 : (_p$payload3 = p.payload) === null || _p$payload3 === void 0 ? void 0 : _p$payload3.allVals, stream$);
|
97
|
+
|
98
|
+
var _dr3 = dependsRef.current;
|
99
|
+
_dr3.notRequire = _show2;
|
100
|
+
setDepends(_objectSpread({}, _dr3));
|
101
|
+
dependsRef.current = _dr3;
|
102
|
+
}
|
92
103
|
}
|
93
104
|
});
|
94
105
|
}
|
@@ -99,7 +110,7 @@ export var useWatchDepend = function useWatchDepend(_depends, stream$) {
|
|
99
110
|
var processDependHiddenOrShow = function processDependHiddenOrShow(depend, changeData, stream$) {
|
100
111
|
try {
|
101
112
|
// const regex = /\w+(\.\w+)?[=<>!]{1}/g;
|
102
|
-
var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('
|
113
|
+
var regex = /\w+(\.\w+)?[=<>!]{1}|\w+(\.\w+)?(\.indexOf\('.+'\)[=<>!]{1})/g;
|
103
114
|
var keys = depend.trim().match(regex);
|
104
115
|
|
105
116
|
if (!keys) {
|
@@ -31,7 +31,7 @@ export interface IMetaFormProps {
|
|
31
31
|
id: string;
|
32
32
|
idx?: number;
|
33
33
|
type: string;
|
34
|
-
|
34
|
+
notRequire?: boolean;
|
35
35
|
disabled?: boolean;
|
36
36
|
isRefForm?: boolean;
|
37
37
|
initEnumValue?: any;
|
@@ -53,6 +53,7 @@ export interface IMetaFormProps {
|
|
53
53
|
export declare type IFiledDepend = {
|
54
54
|
hidden: string;
|
55
55
|
show: string;
|
56
|
+
notRequire: string;
|
56
57
|
};
|
57
58
|
export declare type IStreamEventType = 'onSelectChange' | 'onButtonCellClick' | 'onValuesChange' | 'onWatchDepend' | string;
|
58
59
|
export declare type IStreamEvent = {
|