ronds-metadata 1.0.21 → 1.0.25
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.
@@ -2,6 +2,8 @@ import "antd/es/form/style";
|
|
2
2
|
import _Form from "antd/es/form";
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
5
|
+
import "antd/es/date-picker/style";
|
6
|
+
import _DatePicker from "antd/es/date-picker";
|
5
7
|
import "antd/es/popover/style";
|
6
8
|
import _Popover from "antd/es/popover";
|
7
9
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
@@ -31,11 +33,16 @@ function Index(props) {
|
|
31
33
|
color = _React$useState2[0],
|
32
34
|
setColor = _React$useState2[1];
|
33
35
|
|
36
|
+
var _React$useState3 = React.useState(null),
|
37
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
38
|
+
date = _React$useState4[0],
|
39
|
+
setDate = _React$useState4[1];
|
40
|
+
|
34
41
|
React.useEffect(function () {
|
35
42
|
if ((extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type) === 'colorPicker') {
|
36
43
|
setColor(formContext.form.getFieldValue(id));
|
37
44
|
}
|
38
|
-
}, [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type]);
|
45
|
+
}, [extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.type, formContext.form]);
|
39
46
|
|
40
47
|
var onColorChange = function onColorChange(e) {
|
41
48
|
formContext.form.setFieldsValue(_defineProperty({}, id, e.hex));
|
@@ -48,7 +55,7 @@ function Index(props) {
|
|
48
55
|
});
|
49
56
|
|
50
57
|
var processInputType = function processInputType(_type) {
|
51
|
-
var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4;
|
58
|
+
var _extraInfo$disabled, _extraInfo$disabled2, _extraInfo$disabled3, _extraInfo$disabled4, _extraInfo$disabled5;
|
52
59
|
|
53
60
|
switch (_type) {
|
54
61
|
case 'password':
|
@@ -82,9 +89,16 @@ function Index(props) {
|
|
82
89
|
content: colorPicker
|
83
90
|
}, /*#__PURE__*/React.createElement(BgColorsOutlined, null))));
|
84
91
|
|
92
|
+
case 'datePicker':
|
93
|
+
return /*#__PURE__*/React.createElement(_DatePicker, {
|
94
|
+
showTime: true,
|
95
|
+
disabled: (_extraInfo$disabled4 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled4 !== void 0 ? _extraInfo$disabled4 : disabled,
|
96
|
+
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder
|
97
|
+
});
|
98
|
+
|
85
99
|
default:
|
86
100
|
return /*#__PURE__*/React.createElement(_Input, {
|
87
|
-
disabled: (_extraInfo$
|
101
|
+
disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
|
88
102
|
placeholder: extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.placeholder,
|
89
103
|
allowClear: true
|
90
104
|
});
|
@@ -14,7 +14,8 @@ function Index(props) {
|
|
14
14
|
var id = props.id,
|
15
15
|
name = props.name,
|
16
16
|
isRefForm = props.isRefForm,
|
17
|
-
initEnumValue = props.initEnumValue,
|
17
|
+
_props$initEnumValue = props.initEnumValue,
|
18
|
+
initEnumValue = _props$initEnumValue === void 0 ? {} : _props$initEnumValue,
|
18
19
|
disabled = props.disabled,
|
19
20
|
field = props.field,
|
20
21
|
isObj = props.isObj;
|
@@ -1,5 +1,16 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
|
+
|
5
|
+
/*
|
6
|
+
* @Author: your name
|
7
|
+
* @Date: 2021-09-18 14:15:04
|
8
|
+
* @LastEditTime: 2021-12-03 16:00:13
|
9
|
+
* @LastEditors: Please set LastEditors
|
10
|
+
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
11
|
+
* @FilePath: \ronds.metadata\src\comps\MetadataForm\hooks\index.tsx
|
12
|
+
*/
|
13
|
+
import moment from 'moment';
|
3
14
|
import React from 'react';
|
4
15
|
export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
|
5
16
|
var _React$useState = React.useState({}),
|
@@ -17,6 +28,11 @@ export var useGetExtraInfo = function useGetExtraInfo(fields, id, form) {
|
|
17
28
|
|
18
29
|
for (var k in extraInfo) {
|
19
30
|
_extraInfo[k] = extraInfo[k];
|
31
|
+
}
|
32
|
+
|
33
|
+
// 时间格式转化
|
34
|
+
if (_extraInfo.type === 'datePicker' && form.getFieldValue(id)) {
|
35
|
+
form.setFieldsValue(_defineProperty({}, id, moment(form.getFieldValue(id), 'YYYY-MM-DD HH:mm:ss')));
|
20
36
|
} // 暂时注释加载默认值
|
21
37
|
// if (_extraInfo?.defaultValue) {
|
22
38
|
// form.setFieldsValue({ [id]: _extraInfo?.defaultValue });
|