ronds-metadata 1.1.60 → 1.1.61

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.
@@ -1,20 +1,21 @@
1
1
  import "antd/es/form/style";
2
2
  import _Form from "antd/es/form";
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
5
4
  import "antd/es/upload/style";
6
5
  import _Upload from "antd/es/upload";
7
6
  import "antd/es/button/style";
8
7
  import _Button from "antd/es/button";
9
8
  import "antd/es/date-picker/style";
10
9
  import _DatePicker from "antd/es/date-picker";
10
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
11
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
11
12
  import "antd/es/input/style";
12
13
  import _Input from "antd/es/input";
13
14
 
14
15
  /*
15
16
  * @Author: wangxian
16
17
  * @Date: 2021-09-18 14:15:04
17
- * @LastEditTime: 2022-10-10 11:27:15
18
+ * @LastEditTime: 2022-11-22 15:49:53
18
19
  */
19
20
  import React from 'react';
20
21
  import { UploadOutlined } from '@ant-design/icons';
@@ -33,6 +34,26 @@ function Index(props) {
33
34
  var formRefContext = React.useContext(MetadataRefContext);
34
35
  var extraInfo = useGetExtraInfo(formRefContext ? formRefContext.fields : formContext.fields, id, formContext.form, props.type);
35
36
 
37
+ var _React$useState = React.useState([]),
38
+ _React$useState2 = _slicedToArray(_React$useState, 2),
39
+ rules = _React$useState2[0],
40
+ setRules = _React$useState2[1];
41
+
42
+ React.useEffect(function () {
43
+ var _rules = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.rules;
44
+
45
+ if (_rules) {
46
+ var _ = _rules.map(function (it) {
47
+ return {
48
+ pattern: new RegExp(eval(it === null || it === void 0 ? void 0 : it.regExp), 'g'),
49
+ message: it.message
50
+ };
51
+ });
52
+
53
+ setRules(_toConsumableArray(_));
54
+ }
55
+ }, [extraInfo]);
56
+
36
57
  var processInputType = function processInputType(_type) {
37
58
  var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5;
38
59
 
@@ -92,7 +113,7 @@ function Index(props) {
92
113
  fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
93
114
  rules: [{
94
115
  required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
95
- }],
116
+ }].concat(_toConsumableArray(rules)),
96
117
  help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
97
118
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
98
119
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
@@ -108,7 +129,7 @@ function Index(props) {
108
129
  name: name,
109
130
  rules: [{
110
131
  required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
111
- }],
132
+ }].concat(_toConsumableArray(rules)),
112
133
  help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
113
134
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
114
135
  }, processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || '')) : /*#__PURE__*/React.createElement(_Form.Item, _extends({}, field, {
@@ -120,7 +141,7 @@ function Index(props) {
120
141
  fieldKey: [field === null || field === void 0 ? void 0 : field.fieldKey],
121
142
  rules: [{
122
143
  required: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.require
123
- }],
144
+ }].concat(_toConsumableArray(rules)),
124
145
  help: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.help,
125
146
  tooltip: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.tooltip
126
147
  }), processInputType((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) || ''));
@@ -4,10 +4,10 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  /*
5
5
  * @Author: wangxian
6
6
  * @Date: 2021-09-18 14:15:04
7
- * @LastEditTime: 2022-11-22 14:13:25
7
+ * @LastEditTime: 2022-11-22 15:37:46
8
8
  */
9
9
  import React from 'react';
10
- import { deepClone, guid } from '../../../utils';
10
+ import { deepClone } from '../../../utils';
11
11
  import './index.less';
12
12
  export function withAddOnAfter(WrappedComponent) {
13
13
  return function (props) {
@@ -48,7 +48,7 @@ export function withAddOnAfter(WrappedComponent) {
48
48
  key: "".concat(_name.toString(), "_div"),
49
49
  className: "with-add-on-after"
50
50
  }, /*#__PURE__*/React.createElement(WrappedComponent, _extends({
51
- key: "".concat(_name.toString(), "_Wrapped_").concat(guid())
51
+ key: "".concat(_name.toString(), "_Wrapped}")
52
52
  }, props, {
53
53
  style: {
54
54
  padding: '0px',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "ronds-metadata",
4
- "version": "1.1.60",
4
+ "version": "1.1.61",
5
5
  "scripts": {
6
6
  "start": "dumi dev",
7
7
  "docs:build": "dumi build",