@hw-component/form 1.9.40 → 1.9.42
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.
- package/es/Form/HFormConnect.js +9 -10
- package/es/Form/config.d.ts +2 -5
- package/es/Form/config.js +3 -1
- package/es/Input/ButtonInput.js +21 -5
- package/es/Input/modal.d.ts +1 -0
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Text/index.d.ts +3 -0
- package/es/Text/index.js +13 -0
- package/lib/Form/HFormConnect.js +9 -10
- package/lib/Form/config.d.ts +2 -5
- package/lib/Form/config.js +3 -1
- package/lib/Input/ButtonInput.js +20 -4
- package/lib/Input/modal.d.ts +1 -0
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Text/index.d.ts +3 -0
- package/lib/Text/index.js +16 -0
- package/package.json +1 -1
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/Form/HFormConnect.tsx +9 -10
- package/src/components/Form/config.ts +2 -0
- package/src/components/Input/ButtonInput.tsx +22 -3
- package/src/components/Input/InputNumberGroup.tsx +4 -4
- package/src/components/Input/SelectInput.tsx +2 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/VerificationCodeInput/index.tsx +1 -1
- package/src/components/Input/modal.ts +1 -0
- package/src/components/Select/TreeSelect.tsx +2 -2
- package/src/components/Switch/index.tsx +3 -3
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +6 -0
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/index.tsx +4 -4
- package/src/pages/Input/index.tsx +1 -0
package/es/Form/HFormConnect.js
CHANGED
|
@@ -37,29 +37,28 @@ var HFormConnect = (function (component) {
|
|
|
37
37
|
form = _useFormContext.form,
|
|
38
38
|
_useFormContext$value = _useFormContext.valueType,
|
|
39
39
|
valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
|
|
40
|
+
var name = props.name;
|
|
41
|
+
var relName = Array.isArray(name) ? name.join(".") : name;
|
|
40
42
|
useEffect(function () {
|
|
41
|
-
|
|
42
|
-
if (!name) {
|
|
43
|
+
if (!relName) {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
form === null || form === void 0 || form.addFormat(
|
|
46
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
|
|
46
47
|
}, [valueType, props]);
|
|
47
48
|
var addFormat = function addFormat(aFormat) {
|
|
48
|
-
|
|
49
|
-
if (!name) {
|
|
49
|
+
if (!relName) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
form === null || form === void 0 || form.addFormat(
|
|
52
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
53
53
|
};
|
|
54
54
|
var addDispatchListener = function addDispatchListener(key, fn) {
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
if (!name) {
|
|
55
|
+
var dispatch = props.dispatch;
|
|
56
|
+
if (!relName) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
59
|
form === null || form === void 0 || form.addDispatchListener({
|
|
61
60
|
key: key,
|
|
62
|
-
name:
|
|
61
|
+
name: relName,
|
|
63
62
|
dispatch: dispatch
|
|
64
63
|
}, fn);
|
|
65
64
|
};
|
package/es/Form/config.d.ts
CHANGED
|
@@ -35,10 +35,7 @@ declare const componentConfig: {
|
|
|
35
35
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
|
-
treeSelect: ({ request,
|
|
39
|
-
|
|
40
|
-
request: any;
|
|
41
|
-
options: any;
|
|
42
|
-
}) => JSX.Element;
|
|
38
|
+
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
+
text: ({ value }: import("antd").FormItemProps) => JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export default componentConfig;
|
package/es/Form/config.js
CHANGED
|
@@ -22,6 +22,7 @@ import VerificationCodeInput from '../Input/VerificationCodeInput/index.js';
|
|
|
22
22
|
import TrimInput from '../Input/TrimInput.js';
|
|
23
23
|
import TrimTextArea from '../TextArea/TrimTextArea.js';
|
|
24
24
|
import HInputNumberGroup from '../Input/InputNumberGroup.js';
|
|
25
|
+
import HText from '../Text/index.js';
|
|
25
26
|
|
|
26
27
|
var placeholderConfig = {
|
|
27
28
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
|
|
@@ -50,7 +51,8 @@ var componentConfig = {
|
|
|
50
51
|
trimInput: TrimInput,
|
|
51
52
|
trimTextArea: TrimTextArea,
|
|
52
53
|
inputNumberGroup: HInputNumberGroup,
|
|
53
|
-
treeSelect: HTreeSelect
|
|
54
|
+
treeSelect: HTreeSelect,
|
|
55
|
+
text: HText
|
|
54
56
|
};
|
|
55
57
|
|
|
56
58
|
export { componentConfig as default, placeholderConfig };
|
package/es/Input/ButtonInput.js
CHANGED
|
@@ -3,11 +3,11 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
|
3
3
|
import _asyncToGenerator from '@babel/runtime-corejs3/helpers/asyncToGenerator';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
5
5
|
import _regeneratorRuntime from '@babel/runtime-corejs3/regenerator';
|
|
6
|
-
import {
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
7
|
import { Input, Button } from 'antd';
|
|
8
8
|
import { useRequest } from 'ahooks';
|
|
9
9
|
|
|
10
|
-
var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
|
|
10
|
+
var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
|
|
11
11
|
_excluded2 = ["onClick", "type", "ghost", "loading"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -18,14 +18,17 @@ var Index = function Index(_ref) {
|
|
|
18
18
|
onChange = _ref.onChange,
|
|
19
19
|
children = _ref.children,
|
|
20
20
|
request = _ref.request,
|
|
21
|
+
_ref$layType = _ref.layType,
|
|
22
|
+
layType = _ref$layType === void 0 ? "group" : _ref$layType,
|
|
21
23
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
22
24
|
var onClick = buttonProps.onClick,
|
|
23
|
-
|
|
24
|
-
type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
|
|
25
|
+
type = buttonProps.type,
|
|
25
26
|
_buttonProps$ghost = buttonProps.ghost,
|
|
26
27
|
ghost = _buttonProps$ghost === void 0 ? true : _buttonProps$ghost,
|
|
27
28
|
btnLoading = buttonProps.loading,
|
|
28
29
|
oProps = _objectWithoutProperties(buttonProps, _excluded2);
|
|
30
|
+
var defaultBtnType = layType === "group" ? "primary" : "link";
|
|
31
|
+
var btnType = type || defaultBtnType;
|
|
29
32
|
var _useRequest = useRequest(function (val) {
|
|
30
33
|
return request === null || request === void 0 ? void 0 : request(val);
|
|
31
34
|
}, {
|
|
@@ -63,6 +66,19 @@ var Index = function Index(_ref) {
|
|
|
63
66
|
return _ref2.apply(this, arguments);
|
|
64
67
|
};
|
|
65
68
|
}();
|
|
69
|
+
if (layType === "text") {
|
|
70
|
+
return jsx(Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
71
|
+
suffix: jsx(Button, _objectSpread(_objectSpread({
|
|
72
|
+
type: btnType,
|
|
73
|
+
onClick: click,
|
|
74
|
+
size: "small",
|
|
75
|
+
loading: loading || btnLoading,
|
|
76
|
+
ghost: ghost
|
|
77
|
+
}, oProps), {}, {
|
|
78
|
+
children: children
|
|
79
|
+
}))
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
66
82
|
return jsxs(Input.Group, {
|
|
67
83
|
compact: true,
|
|
68
84
|
style: {
|
|
@@ -75,7 +91,7 @@ var Index = function Index(_ref) {
|
|
|
75
91
|
value: value,
|
|
76
92
|
onChange: change
|
|
77
93
|
})), jsx(Button, _objectSpread(_objectSpread({
|
|
78
|
-
type:
|
|
94
|
+
type: btnType,
|
|
79
95
|
onClick: click,
|
|
80
96
|
loading: loading || btnLoading,
|
|
81
97
|
style: {
|
package/es/Input/modal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
2
|
import { PromiseFnResult } from "../modal";
|
|
3
|
-
interface
|
|
3
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }:
|
|
7
|
+
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
package/es/Text/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// welcome to hoo hoo hoo
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Typography } from 'antd';
|
|
4
|
+
|
|
5
|
+
var HText = (function (_ref) {
|
|
6
|
+
var value = _ref.value;
|
|
7
|
+
return jsx(Typography.Text, {
|
|
8
|
+
children: value
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { HText as default };
|
|
13
|
+
// powered by hdj
|
package/lib/Form/HFormConnect.js
CHANGED
|
@@ -40,29 +40,28 @@ var HFormConnect = (function (component) {
|
|
|
40
40
|
form = _useFormContext.form,
|
|
41
41
|
_useFormContext$value = _useFormContext.valueType,
|
|
42
42
|
valueType = _useFormContext$value === void 0 ? "float" : _useFormContext$value;
|
|
43
|
+
var name = props.name;
|
|
44
|
+
var relName = Array.isArray(name) ? name.join(".") : name;
|
|
43
45
|
React.useEffect(function () {
|
|
44
|
-
|
|
45
|
-
if (!name) {
|
|
46
|
+
if (!relName) {
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
|
-
form === null || form === void 0 || form.addFormat(
|
|
49
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, format[valueType]));
|
|
49
50
|
}, [valueType, props]);
|
|
50
51
|
var addFormat = function addFormat(aFormat) {
|
|
51
|
-
|
|
52
|
-
if (!name) {
|
|
52
|
+
if (!relName) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
form === null || form === void 0 || form.addFormat(
|
|
55
|
+
form === null || form === void 0 || form.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
56
56
|
};
|
|
57
57
|
var addDispatchListener = function addDispatchListener(key, fn) {
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
if (!name) {
|
|
58
|
+
var dispatch = props.dispatch;
|
|
59
|
+
if (!relName) {
|
|
61
60
|
return;
|
|
62
61
|
}
|
|
63
62
|
form === null || form === void 0 || form.addDispatchListener({
|
|
64
63
|
key: key,
|
|
65
|
-
name:
|
|
64
|
+
name: relName,
|
|
66
65
|
dispatch: dispatch
|
|
67
66
|
}, fn);
|
|
68
67
|
};
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -35,10 +35,7 @@ declare const componentConfig: {
|
|
|
35
35
|
Component: import("react").ForwardRefExoticComponent<import("./modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
|
-
treeSelect: ({ request,
|
|
39
|
-
|
|
40
|
-
request: any;
|
|
41
|
-
options: any;
|
|
42
|
-
}) => JSX.Element;
|
|
38
|
+
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
+
text: ({ value }: import("antd").FormItemProps) => JSX.Element;
|
|
43
40
|
};
|
|
44
41
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -25,6 +25,7 @@ var index$d = require('../Input/VerificationCodeInput/index.js');
|
|
|
25
25
|
var TrimInput = require('../Input/TrimInput.js');
|
|
26
26
|
var TrimTextArea = require('../TextArea/TrimTextArea.js');
|
|
27
27
|
var InputNumberGroup = require('../Input/InputNumberGroup.js');
|
|
28
|
+
var index$e = require('../Text/index.js');
|
|
28
29
|
|
|
29
30
|
var placeholderConfig = {
|
|
30
31
|
inputType: ["input", "inputNumber", "selectInput", "buttonInput", "verificationCodeInput", "trimInput", "urlUpload", "textArea"],
|
|
@@ -53,7 +54,8 @@ var componentConfig = {
|
|
|
53
54
|
trimInput: TrimInput.default,
|
|
54
55
|
trimTextArea: TrimTextArea.default,
|
|
55
56
|
inputNumberGroup: InputNumberGroup.default,
|
|
56
|
-
treeSelect: TreeSelect.default
|
|
57
|
+
treeSelect: TreeSelect.default,
|
|
58
|
+
text: index$e.default
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
exports.default = componentConfig;
|
package/lib/Input/ButtonInput.js
CHANGED
|
@@ -10,7 +10,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
10
10
|
var antd = require('antd');
|
|
11
11
|
var ahooks = require('ahooks');
|
|
12
12
|
|
|
13
|
-
var _excluded = ["buttonProps", "value", "onChange", "children", "request"],
|
|
13
|
+
var _excluded = ["buttonProps", "value", "onChange", "children", "request", "layType"],
|
|
14
14
|
_excluded2 = ["onClick", "type", "ghost", "loading"];
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -21,14 +21,17 @@ var Index = function Index(_ref) {
|
|
|
21
21
|
onChange = _ref.onChange,
|
|
22
22
|
children = _ref.children,
|
|
23
23
|
request = _ref.request,
|
|
24
|
+
_ref$layType = _ref.layType,
|
|
25
|
+
layType = _ref$layType === void 0 ? "group" : _ref$layType,
|
|
24
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var onClick = buttonProps.onClick,
|
|
26
|
-
|
|
27
|
-
type = _buttonProps$type === void 0 ? "primary" : _buttonProps$type,
|
|
28
|
+
type = buttonProps.type,
|
|
28
29
|
_buttonProps$ghost = buttonProps.ghost,
|
|
29
30
|
ghost = _buttonProps$ghost === void 0 ? true : _buttonProps$ghost,
|
|
30
31
|
btnLoading = buttonProps.loading,
|
|
31
32
|
oProps = _objectWithoutProperties(buttonProps, _excluded2);
|
|
33
|
+
var defaultBtnType = layType === "group" ? "primary" : "link";
|
|
34
|
+
var btnType = type || defaultBtnType;
|
|
32
35
|
var _useRequest = ahooks.useRequest(function (val) {
|
|
33
36
|
return request === null || request === void 0 ? void 0 : request(val);
|
|
34
37
|
}, {
|
|
@@ -66,6 +69,19 @@ var Index = function Index(_ref) {
|
|
|
66
69
|
return _ref2.apply(this, arguments);
|
|
67
70
|
};
|
|
68
71
|
}();
|
|
72
|
+
if (layType === "text") {
|
|
73
|
+
return jsxRuntime.jsx(antd.Input, _objectSpread(_objectSpread({}, props), {}, {
|
|
74
|
+
suffix: jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({
|
|
75
|
+
type: btnType,
|
|
76
|
+
onClick: click,
|
|
77
|
+
size: "small",
|
|
78
|
+
loading: loading || btnLoading,
|
|
79
|
+
ghost: ghost
|
|
80
|
+
}, oProps), {}, {
|
|
81
|
+
children: children
|
|
82
|
+
}))
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
69
85
|
return jsxRuntime.jsxs(antd.Input.Group, {
|
|
70
86
|
compact: true,
|
|
71
87
|
style: {
|
|
@@ -78,7 +94,7 @@ var Index = function Index(_ref) {
|
|
|
78
94
|
value: value,
|
|
79
95
|
onChange: change
|
|
80
96
|
})), jsxRuntime.jsx(antd.Button, _objectSpread(_objectSpread({
|
|
81
|
-
type:
|
|
97
|
+
type: btnType,
|
|
82
98
|
onClick: click,
|
|
83
99
|
loading: loading || btnLoading,
|
|
84
100
|
style: {
|
package/lib/Input/modal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
2
2
|
import { PromiseFnResult } from "../modal";
|
|
3
|
-
interface
|
|
3
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
4
4
|
request?: PromiseFnResult;
|
|
5
5
|
onlyCheckChild?: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }:
|
|
7
|
+
declare const _default: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: HTreeSelectProps) => JSX.Element;
|
|
8
8
|
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
|
|
8
|
+
var HText = (function (_ref) {
|
|
9
|
+
var value = _ref.value;
|
|
10
|
+
return jsxRuntime.jsx(antd.Typography.Text, {
|
|
11
|
+
children: value
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.default = HText;
|
|
16
|
+
// powered by h
|
package/package.json
CHANGED
|
@@ -43,15 +43,15 @@ const Index = ({
|
|
|
43
43
|
resultObj[key] = initValue[key];
|
|
44
44
|
});
|
|
45
45
|
return {
|
|
46
|
-
[name]: resultObj,
|
|
46
|
+
[(name as string)]: resultObj,
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
49
|
outputValue: (item, outputValue) => {
|
|
50
50
|
const { name = "" } = item;
|
|
51
|
-
const { [name]: itemVal = {} } = outputValue;
|
|
51
|
+
const { [(name as string)]: itemVal = {} } = outputValue;
|
|
52
52
|
if (Array.isArray(itemVal)) {
|
|
53
53
|
return {
|
|
54
|
-
[name]: itemVal,
|
|
54
|
+
[(name as string)]: itemVal,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
@@ -44,27 +44,26 @@ export default (
|
|
|
44
44
|
ref
|
|
45
45
|
) => {
|
|
46
46
|
const { form, valueType = "float" } = useFormContext();
|
|
47
|
-
|
|
47
|
+
const { name } = props;
|
|
48
|
+
const relName=Array.isArray(name)?name.join("."):name;
|
|
48
49
|
useEffect(() => {
|
|
49
|
-
|
|
50
|
-
if (!name) {
|
|
50
|
+
if (!relName) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
form?.addFormat(
|
|
53
|
+
form?.addFormat(relName, formatMaker(props, format[valueType]));
|
|
54
54
|
}, [valueType, props]);
|
|
55
55
|
const addFormat = (aFormat: Record<string, addFormatItemModal>) => {
|
|
56
|
-
|
|
57
|
-
if (!name) {
|
|
56
|
+
if (!relName) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
form?.addFormat(
|
|
59
|
+
form?.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
61
60
|
};
|
|
62
61
|
const addDispatchListener = (key: string, fn: argsFn) => {
|
|
63
|
-
const {
|
|
64
|
-
if (!
|
|
62
|
+
const {dispatch } = props;
|
|
63
|
+
if (!relName) {
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
|
-
form?.addDispatchListener({ key, name, dispatch }, fn);
|
|
66
|
+
form?.addDispatchListener({ key, name:relName, dispatch }, fn);
|
|
68
67
|
};
|
|
69
68
|
const Component = component as React.ForwardRefRenderFunction<
|
|
70
69
|
any,
|
|
@@ -21,6 +21,7 @@ import VerificationCodeInput from "../Input/VerificationCodeInput";
|
|
|
21
21
|
import TrimInput from "../Input/TrimInput";
|
|
22
22
|
import TrimTextArea from "../TextArea/TrimTextArea";
|
|
23
23
|
import HInputNumberGroup from "../Input/InputNumberGroup";
|
|
24
|
+
import HText from '../Text'
|
|
24
25
|
export const placeholderConfig = {
|
|
25
26
|
inputType: [
|
|
26
27
|
"input",
|
|
@@ -64,6 +65,7 @@ const componentConfig = {
|
|
|
64
65
|
trimTextArea: TrimTextArea,
|
|
65
66
|
inputNumberGroup: HInputNumberGroup,
|
|
66
67
|
treeSelect: HTreeSelect,
|
|
68
|
+
text: HText,
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
export default componentConfig;
|
|
@@ -9,15 +9,18 @@ const Index: React.FC<HButtonInputProps> = ({
|
|
|
9
9
|
onChange,
|
|
10
10
|
children,
|
|
11
11
|
request,
|
|
12
|
+
layType="group",
|
|
12
13
|
...props
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
15
16
|
onClick,
|
|
16
|
-
type
|
|
17
|
+
type ,
|
|
17
18
|
ghost = true,
|
|
18
19
|
loading: btnLoading,
|
|
19
20
|
...oProps
|
|
20
21
|
} = buttonProps;
|
|
22
|
+
const defaultBtnType=layType==="group"?"primary":"link"
|
|
23
|
+
const btnType=type||defaultBtnType
|
|
21
24
|
const { run, loading } = useRequest(
|
|
22
25
|
(val) => {
|
|
23
26
|
return request?.(val);
|
|
@@ -34,12 +37,28 @@ const Index: React.FC<HButtonInputProps> = ({
|
|
|
34
37
|
}
|
|
35
38
|
onClick?.(result, onChange);
|
|
36
39
|
};
|
|
37
|
-
|
|
40
|
+
if (layType==="text"){
|
|
41
|
+
return <Input
|
|
42
|
+
{...props}
|
|
43
|
+
suffix={
|
|
44
|
+
<Button
|
|
45
|
+
type={btnType}
|
|
46
|
+
onClick={click}
|
|
47
|
+
size={"small"}
|
|
48
|
+
loading={loading || btnLoading}
|
|
49
|
+
ghost={ghost}
|
|
50
|
+
{...oProps}
|
|
51
|
+
>
|
|
52
|
+
{children}
|
|
53
|
+
</Button>
|
|
54
|
+
}
|
|
55
|
+
/>
|
|
56
|
+
}
|
|
38
57
|
return (
|
|
39
58
|
<Input.Group compact style={{ display: "flex" }}>
|
|
40
59
|
<Input {...props} style={{ flex: 1 }} value={value} onChange={change} />
|
|
41
60
|
<Button
|
|
42
|
-
type={
|
|
61
|
+
type={btnType}
|
|
43
62
|
onClick={click}
|
|
44
63
|
loading={loading || btnLoading}
|
|
45
64
|
style={{ marginLeft: 8, borderRadius: 4 }}
|
|
@@ -80,11 +80,11 @@ const InputNumberGroup = ({
|
|
|
80
80
|
inputValue: (item, initValue) => {
|
|
81
81
|
const { name: valueName = "" } = item;
|
|
82
82
|
const { min: minKey, max: maxKey } = valueMap;
|
|
83
|
-
const cuValue = initValue[valueName];
|
|
83
|
+
const cuValue = initValue[(valueName as string)];
|
|
84
84
|
const minInitVal = initValue[minKey];
|
|
85
85
|
const maxInitVal = initValue[maxKey];
|
|
86
86
|
return {
|
|
87
|
-
[valueName]: {
|
|
87
|
+
[(valueName as string)]: {
|
|
88
88
|
[min]: minInitVal,
|
|
89
89
|
[max]: maxInitVal,
|
|
90
90
|
...cuValue,
|
|
@@ -93,7 +93,7 @@ const InputNumberGroup = ({
|
|
|
93
93
|
},
|
|
94
94
|
outputValue: (item, outputValue) => {
|
|
95
95
|
const { name: valueName = "" } = item;
|
|
96
|
-
const { [valueName]: itemVal = {} } = outputValue;
|
|
96
|
+
const { [(valueName as string)]: itemVal = {} } = outputValue;
|
|
97
97
|
const { min: minKey, max: maxKey } = valueMap;
|
|
98
98
|
const {
|
|
99
99
|
[minKey]: minSubVal,
|
|
@@ -103,7 +103,7 @@ const InputNumberGroup = ({
|
|
|
103
103
|
return {
|
|
104
104
|
[maxKey]: maxSubVal,
|
|
105
105
|
[minKey]: minSubVal,
|
|
106
|
-
[valueName]: oItemVal,
|
|
106
|
+
[(valueName as string)]: oItemVal,
|
|
107
107
|
};
|
|
108
108
|
},
|
|
109
109
|
},
|
|
@@ -38,12 +38,12 @@ export const Index = ({
|
|
|
38
38
|
resultObj[key] = initValue[key];
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
[name]: resultObj,
|
|
41
|
+
[(name as string)]: resultObj,
|
|
42
42
|
};
|
|
43
43
|
},
|
|
44
44
|
outputValue: (item, outputValue) => {
|
|
45
45
|
const { name = "" } = item;
|
|
46
|
-
const { [name]: itemVal = {} } = outputValue;
|
|
46
|
+
const { [(name as string)]: itemVal = {} } = outputValue;
|
|
47
47
|
const newItemVal = { [itemVal[select]]: itemVal[input] };
|
|
48
48
|
return {
|
|
49
49
|
...newItemVal,
|
|
@@ -8,14 +8,14 @@ const Index = ({ addFormat, ...props }: HInputProps) => {
|
|
|
8
8
|
inputValue: (item, initValue) => {
|
|
9
9
|
const { name: valueName = "" } = item;
|
|
10
10
|
return {
|
|
11
|
-
[valueName]: initValue[valueName],
|
|
11
|
+
[(valueName as string)]: initValue[(valueName as string)],
|
|
12
12
|
};
|
|
13
13
|
},
|
|
14
14
|
outputValue: (item, outputValue) => {
|
|
15
15
|
const { name = "" } = item;
|
|
16
|
-
const { [name]: itemVal } = outputValue;
|
|
16
|
+
const { [(name as string)]: itemVal } = outputValue;
|
|
17
17
|
return {
|
|
18
|
-
[name]: itemVal?.trim(),
|
|
18
|
+
[(name as string)]: itemVal?.trim(),
|
|
19
19
|
};
|
|
20
20
|
},
|
|
21
21
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useMemo
|
|
1
|
+
import React, { useCallback, useEffect, useMemo } from "react";
|
|
2
2
|
import ButtonInput from "../ButtonInput";
|
|
3
3
|
import { useRequest } from "ahooks";
|
|
4
4
|
import type { HFormInstance } from "../../Form/modal";
|
|
@@ -2,7 +2,7 @@ import { TreeSelect } from "antd";
|
|
|
2
2
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
3
3
|
import { PromiseFnResult } from "../modal";
|
|
4
4
|
import { useRequest } from "ahooks";
|
|
5
|
-
interface
|
|
5
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
6
6
|
request?: PromiseFnResult;
|
|
7
7
|
onlyCheckChild?:boolean;
|
|
8
8
|
}
|
|
@@ -29,7 +29,7 @@ const opMk=({options,onlyCheckChild=false,fieldNames}:OpMkParamsModal)=>{
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
}
|
|
32
|
-
export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }:
|
|
32
|
+
export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }: HTreeSelectProps) => {
|
|
33
33
|
const { loading, data } = useRequest(async () => {
|
|
34
34
|
let options=treeData;
|
|
35
35
|
if (request) {
|
|
@@ -56,18 +56,18 @@ const Index: React.FC<HSwitchProps> = ({
|
|
|
56
56
|
inputValue: (item, initValue) => {
|
|
57
57
|
const { close } = valueSwitchMap;
|
|
58
58
|
const { name: valueName = "" } = item;
|
|
59
|
-
let val = initValue[valueName];
|
|
59
|
+
let val = initValue[(valueName as string)];
|
|
60
60
|
if (typeof val === "undefined" || val === null) {
|
|
61
61
|
val = close;
|
|
62
62
|
}
|
|
63
63
|
return {
|
|
64
|
-
[valueName]: val,
|
|
64
|
+
[(valueName as string)]: val,
|
|
65
65
|
};
|
|
66
66
|
},
|
|
67
67
|
outputValue: (item, outputValue) => {
|
|
68
68
|
const { name = "" } = item;
|
|
69
69
|
return {
|
|
70
|
-
[name]: outputValue[name],
|
|
70
|
+
[(name as string)]: outputValue[(name as string)],
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
},
|
|
@@ -62,12 +62,12 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
|
|
|
62
62
|
});
|
|
63
63
|
const hasKeys = Object.keys(resultObj).length !== 0;
|
|
64
64
|
return {
|
|
65
|
-
[valueName]: hasKeys ? resultObj : null,
|
|
65
|
+
[(valueName as string)]: hasKeys ? resultObj : null,
|
|
66
66
|
};
|
|
67
67
|
},
|
|
68
68
|
outputValue: (item, outputValue) => {
|
|
69
69
|
const { name: valueName = "" } = item;
|
|
70
|
-
const { [valueName]: itemVal = {} } = outputValue;
|
|
70
|
+
const { [(valueName as string)]: itemVal = {} } = outputValue;
|
|
71
71
|
return {
|
|
72
72
|
...itemVal,
|
|
73
73
|
};
|
|
@@ -12,14 +12,14 @@ const Index = ({ addFormat, ...props }: TrimTextAreaProps) => {
|
|
|
12
12
|
inputValue: (item, initValue) => {
|
|
13
13
|
const { name: valueName = "" } = item;
|
|
14
14
|
return {
|
|
15
|
-
[valueName]: initValue[valueName],
|
|
15
|
+
[(valueName as string)]: initValue[(valueName as string)],
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
18
|
outputValue: (item, outputValue) => {
|
|
19
19
|
const { name = "" } = item;
|
|
20
|
-
const { [name]: itemVal } = outputValue;
|
|
20
|
+
const { [(name as string)]: itemVal } = outputValue;
|
|
21
21
|
return {
|
|
22
|
-
[name]: itemVal?.trim(),
|
|
22
|
+
[(name as string)]: itemVal?.trim(),
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -63,7 +63,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
63
63
|
float: {
|
|
64
64
|
inputValue: (item, initValue) => {
|
|
65
65
|
const { name = "" } = item;
|
|
66
|
-
const initFileList = initValue[name] || [];
|
|
66
|
+
const initFileList = initValue[(name as string)] || [];
|
|
67
67
|
const relInitFileList =
|
|
68
68
|
typeof initFileList === "string" ? [initFileList] : initFileList;
|
|
69
69
|
const fileList = relInitFileList.map((itemData, index) => {
|
|
@@ -81,17 +81,17 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
81
81
|
return { ...itemData };
|
|
82
82
|
});
|
|
83
83
|
return {
|
|
84
|
-
[name]: fileList,
|
|
84
|
+
[(name as string)]: fileList,
|
|
85
85
|
};
|
|
86
86
|
},
|
|
87
87
|
outputValue: (item, outputValue) => {
|
|
88
88
|
const { name: valueName = "" } = item;
|
|
89
|
-
const { [valueName]: itemVal = [] } = outputValue;
|
|
89
|
+
const { [(valueName as string)]: itemVal = [] } = outputValue;
|
|
90
90
|
const urls = itemVal.map((fileItem) => {
|
|
91
91
|
return fileItem.response.url;
|
|
92
92
|
});
|
|
93
93
|
return {
|
|
94
|
-
[valueName]: maxCount === 1 ? urls[0] : urls,
|
|
94
|
+
[(valueName as string)]: maxCount === 1 ? urls[0] : urls,
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
97
|
},
|