@hw-component/form 1.9.40 → 1.9.41
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/Input/ButtonInput.js +21 -5
- package/es/Input/modal.d.ts +1 -0
- package/lib/Input/ButtonInput.js +20 -4
- package/lib/Input/modal.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Input/ButtonInput.tsx +22 -3
- package/src/components/Input/VerificationCodeInput/index.tsx +1 -1
- package/src/components/Input/modal.ts +1 -0
- package/src/pages/Input/index.tsx +1 -0
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
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
package/package.json
CHANGED
|
@@ -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 }}
|
|
@@ -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";
|