ronds-metadata 1.2.57 → 1.2.58
Sign up to get free protection for your applications and to get access to all the features.
- package/es/comps/FormGenerator/comps/Settings/index.js +3 -5
- package/es/comps/MetadataForm/DataCell/Input.js +4 -1
- package/es/comps/MetadataForm/DataCell/plugin/NumberRange.d.ts +13 -0
- package/es/comps/MetadataForm/DataCell/plugin/NumberRange.js +112 -0
- package/es/comps/MetadataForm/index.less +1 -1
- package/package.json +1 -1
@@ -6,8 +6,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
/*
|
7
7
|
* @Author: uloveits 719310130@qq.com
|
8
8
|
* @Date: 2023-02-04 16:35:15
|
9
|
-
* @LastEditors:
|
10
|
-
* @LastEditTime: 2023-
|
9
|
+
* @LastEditors: Please set LastEditors
|
10
|
+
* @LastEditTime: 2023-05-30 15:19:23
|
11
11
|
*/
|
12
12
|
import React from 'react';
|
13
13
|
import { FGCtx } from '../../Provider';
|
@@ -115,8 +115,7 @@ var Settings = function Settings() {
|
|
115
115
|
getFormInstance: function getFormInstance(form) {
|
116
116
|
compFormRef.current = form;
|
117
117
|
},
|
118
|
-
|
119
|
-
labelSpan: 8,
|
118
|
+
layout: "vertical",
|
120
119
|
onValuesChange: function onValuesChange(val, allVals) {
|
121
120
|
_onValuesChange(curNode.id, val, allVals);
|
122
121
|
}
|
@@ -129,7 +128,6 @@ var Settings = function Settings() {
|
|
129
128
|
getFormInstance: function getFormInstance(form) {
|
130
129
|
formRef.current = form;
|
131
130
|
},
|
132
|
-
colSpan: 24,
|
133
131
|
layout: "vertical",
|
134
132
|
onValuesChange: function onValuesChange(val, allVals) {
|
135
133
|
_onValuesChange(formSetting.id, val, allVals);
|
@@ -16,13 +16,14 @@ import _Input from "antd/es/input";
|
|
16
16
|
/*
|
17
17
|
* @Author: wangxian
|
18
18
|
* @Date: 2021-09-18 14:15:04
|
19
|
-
* @LastEditTime: 2023-05-
|
19
|
+
* @LastEditTime: 2023-05-30 14:21:59
|
20
20
|
*/
|
21
21
|
import React from 'react';
|
22
22
|
import { UploadOutlined } from '@ant-design/icons';
|
23
23
|
import { MetadataFormContext, MetadataRefContext } from '../interface';
|
24
24
|
import { useGetExtraInfo } from '../hooks';
|
25
25
|
import useObservable from '../../../framework/rxjs-hooks/useObservable';
|
26
|
+
import NumberRange from './plugin/NumberRange';
|
26
27
|
var TextArea = _Input.TextArea;
|
27
28
|
function Index(props) {
|
28
29
|
var _extraInfo$addonAfter7;
|
@@ -117,6 +118,8 @@ function Index(props) {
|
|
117
118
|
disabled: (_extraInfo$disabled5 = extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.disabled) !== null && _extraInfo$disabled5 !== void 0 ? _extraInfo$disabled5 : disabled,
|
118
119
|
icon: /*#__PURE__*/React.createElement(UploadOutlined, null)
|
119
120
|
}, "\u4E0A\u4F20"));
|
121
|
+
case 'numberRange':
|
122
|
+
return /*#__PURE__*/React.createElement(NumberRange, extraInfo === null || extraInfo === void 0 ? void 0 : extraInfo.numberRange);
|
120
123
|
default:
|
121
124
|
return /*#__PURE__*/React.createElement(_Input, {
|
122
125
|
addonAfter: ((_extraInfo$addonAfter2 = extraInfo.addonAfter) === null || _extraInfo$addonAfter2 === void 0 ? void 0 : _extraInfo$addonAfter2.key) ? /*#__PURE__*/React.createElement(_Form.Item, {
|
@@ -0,0 +1,13 @@
|
|
1
|
+
interface INumberRangeProps {
|
2
|
+
startKey?: string;
|
3
|
+
endKey?: string;
|
4
|
+
addonBefore?: {
|
5
|
+
key: string;
|
6
|
+
defaultValue: string;
|
7
|
+
value: string[];
|
8
|
+
};
|
9
|
+
value?: any;
|
10
|
+
onChange?: (value: any) => void;
|
11
|
+
}
|
12
|
+
declare const NumberRange: (props: INumberRangeProps) => JSX.Element;
|
13
|
+
export default NumberRange;
|
@@ -0,0 +1,112 @@
|
|
1
|
+
import "antd/es/input/style";
|
2
|
+
import _Input from "antd/es/input";
|
3
|
+
import "antd/es/input-number/style";
|
4
|
+
import _InputNumber from "antd/es/input-number";
|
5
|
+
import "antd/es/select/style";
|
6
|
+
import _Select from "antd/es/select";
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
8
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
9
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
10
|
+
/*
|
11
|
+
* @Author: wangxian
|
12
|
+
* @Date: 2023-05-30 13:36:05
|
13
|
+
* @LastEditTime: 2023-05-30 15:04:46
|
14
|
+
*/
|
15
|
+
import React from 'react';
|
16
|
+
var NumberRange = function NumberRange(props) {
|
17
|
+
var startKey = props.startKey,
|
18
|
+
value = props.value,
|
19
|
+
endKey = props.endKey,
|
20
|
+
addonBefore = props.addonBefore,
|
21
|
+
onChange = props.onChange;
|
22
|
+
var _React$useState = React.useState(),
|
23
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
24
|
+
min = _React$useState2[0],
|
25
|
+
setMin = _React$useState2[1];
|
26
|
+
var _React$useState3 = React.useState(),
|
27
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
28
|
+
max = _React$useState4[0],
|
29
|
+
setMax = _React$useState4[1];
|
30
|
+
var _React$useState5 = React.useState(),
|
31
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
32
|
+
before = _React$useState6[0],
|
33
|
+
setBefore = _React$useState6[1];
|
34
|
+
React.useEffect(function () {
|
35
|
+
if (addonBefore.defaultValue) {
|
36
|
+
setBefore(addonBefore.defaultValue);
|
37
|
+
}
|
38
|
+
}, [addonBefore]);
|
39
|
+
React.useEffect(function () {
|
40
|
+
if (value) {
|
41
|
+
if (value[startKey || 'min']) {
|
42
|
+
setMin(value[startKey || 'min']);
|
43
|
+
}
|
44
|
+
if (value[endKey || 'max']) {
|
45
|
+
setMax(value[endKey || 'max']);
|
46
|
+
}
|
47
|
+
if (addonBefore.key && value[addonBefore.key]) {
|
48
|
+
setBefore(value[addonBefore.key]);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}, [value]);
|
52
|
+
var triggerChange = function triggerChange(changedValue) {
|
53
|
+
var _objectSpread2;
|
54
|
+
onChange && onChange(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, addonBefore.key, before), _defineProperty(_objectSpread2, startKey || 'min', min), _defineProperty(_objectSpread2, endKey || 'max', max), _objectSpread2), changedValue));
|
55
|
+
};
|
56
|
+
var onStartChange = function onStartChange(v) {
|
57
|
+
setMin(v);
|
58
|
+
triggerChange(_defineProperty({}, startKey || 'min', v));
|
59
|
+
};
|
60
|
+
var onEndChange = function onEndChange(v) {
|
61
|
+
setMax(v);
|
62
|
+
triggerChange(_defineProperty({}, endKey || 'max', v));
|
63
|
+
};
|
64
|
+
var onBeforeChange = function onBeforeChange(v) {
|
65
|
+
setBefore(v);
|
66
|
+
triggerChange(_defineProperty({}, addonBefore.key, v));
|
67
|
+
};
|
68
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input.Group, {
|
69
|
+
compact: true
|
70
|
+
}, addonBefore && /*#__PURE__*/React.createElement(_Select, {
|
71
|
+
style: {
|
72
|
+
width: '60px'
|
73
|
+
},
|
74
|
+
defaultValue: addonBefore.defaultValue,
|
75
|
+
value: before,
|
76
|
+
options: addonBefore.value.map(function (it) {
|
77
|
+
return {
|
78
|
+
label: it,
|
79
|
+
value: it
|
80
|
+
};
|
81
|
+
}),
|
82
|
+
onChange: onBeforeChange
|
83
|
+
}), /*#__PURE__*/React.createElement(_InputNumber, {
|
84
|
+
value: min,
|
85
|
+
style: {
|
86
|
+
width: addonBefore ? 'calc(50% - 44px)' : 'calc(50% - 14px)',
|
87
|
+
textAlign: 'center'
|
88
|
+
},
|
89
|
+
onChange: onStartChange
|
90
|
+
}), /*#__PURE__*/React.createElement(_Input, {
|
91
|
+
className: "site-input-split",
|
92
|
+
style: {
|
93
|
+
width: 30,
|
94
|
+
borderLeft: 0,
|
95
|
+
borderRight: 0,
|
96
|
+
pointerEvents: 'none'
|
97
|
+
},
|
98
|
+
placeholder: "~",
|
99
|
+
disabled: true
|
100
|
+
}), /*#__PURE__*/React.createElement(_InputNumber, {
|
101
|
+
value: max,
|
102
|
+
className: "site-input-right",
|
103
|
+
style: {
|
104
|
+
width: addonBefore ? 'calc(50% - 44px)' : 'calc(50% - 14px)',
|
105
|
+
textAlign: 'center'
|
106
|
+
}
|
107
|
+
// placeholder="Max"
|
108
|
+
,
|
109
|
+
onChange: onEndChange
|
110
|
+
})));
|
111
|
+
};
|
112
|
+
export default NumberRange;
|