@hw-component/form 1.9.61 → 1.9.63
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/.eslintcache +1 -1
- package/es/DialogForm/hooks.js +7 -1
- package/es/DialogForm/modal.d.ts +1 -0
- package/es/Form/modal.d.ts +1 -1
- package/es/Input/InputNumberGroup.js +4 -6
- package/es/InputGroup/index.d.ts +1 -0
- package/es/InputGroup/index.js +4 -2
- package/es/Text/index.d.ts +1 -1
- package/es/index.css +2 -2
- package/lib/DialogForm/hooks.js +7 -1
- package/lib/DialogForm/modal.d.ts +1 -0
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Input/InputNumberGroup.js +4 -6
- package/lib/InputGroup/index.d.ts +1 -0
- package/lib/InputGroup/index.js +4 -2
- package/lib/Text/index.d.ts +1 -1
- package/lib/index.css +2 -2
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +6 -6
- package/src/components/DialogForm/hooks.tsx +9 -3
- package/src/components/DialogForm/modal.ts +1 -0
- package/src/components/Form/hooks/useHForm.ts +2 -2
- package/src/components/Form/modal.ts +2 -2
- package/src/components/Input/InputNumberGroup.tsx +20 -20
- package/src/components/Input/index.less +2 -2
- package/src/components/InputGroup/index.less +1 -1
- package/src/components/InputGroup/index.tsx +45 -34
- package/src/components/Text/index.tsx +9 -7
- package/src/components/TextArea/index.less +6 -6
- package/src/components/TextArea/index.tsx +14 -8
- package/src/pages/DrawerForm/index.tsx +9 -3
- package/src/pages/Form/index.tsx +9 -8
- package/src/pages/Input/index.tsx +2 -2
- package/src/pages/InputNumberGroup/index.tsx +7 -3
- package/src/pages/ModalForm/index.tsx +22 -11
package/es/InputGroup/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import { useClassName } from '../hooks/index.js';
|
|
7
7
|
import { Input } from 'antd';
|
|
8
8
|
|
|
9
|
-
var _excluded = ["addonAfter", "addonBefore", "children", "value", "onChange"];
|
|
9
|
+
var _excluded = ["addonAfter", "addonBefore", "children", "value", "className", "onChange"];
|
|
10
10
|
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; }
|
|
11
11
|
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; }
|
|
12
12
|
var Addon = function Addon(_ref) {
|
|
@@ -36,13 +36,15 @@ var Index = function Index(_ref2) {
|
|
|
36
36
|
addonBefore = _ref2.addonBefore,
|
|
37
37
|
children = _ref2.children,
|
|
38
38
|
value = _ref2.value,
|
|
39
|
+
_ref2$className = _ref2.className,
|
|
40
|
+
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
39
41
|
onChange = _ref2.onChange,
|
|
40
42
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
41
43
|
var contentClassname = useClassName(["hw-input-group"]);
|
|
42
44
|
var bodyClassname = useClassName(["hw-input-group-body"]);
|
|
43
45
|
return jsxs(Input.Group, {
|
|
44
46
|
compact: true,
|
|
45
|
-
className: contentClassname,
|
|
47
|
+
className: "".concat(contentClassname, " ").concat(className),
|
|
46
48
|
children: [jsx(Addon, {
|
|
47
49
|
value: value,
|
|
48
50
|
onChange: onChange,
|
package/es/Text/index.d.ts
CHANGED
package/es/index.css
CHANGED
|
@@ -164,12 +164,12 @@
|
|
|
164
164
|
background-color: #f5f5f5;
|
|
165
165
|
}
|
|
166
166
|
.ant-hw-input-group .ant-hw-input-group-number-body {
|
|
167
|
-
width: 100%;
|
|
168
|
-
border: 1px solid #d9d9d9;
|
|
169
167
|
display: -webkit-box !important;
|
|
170
168
|
display: -webkit-flex !important;
|
|
171
169
|
display: -ms-flexbox !important;
|
|
172
170
|
display: flex !important;
|
|
171
|
+
width: 100%;
|
|
172
|
+
border: 1px solid #d9d9d9;
|
|
173
173
|
}
|
|
174
174
|
.ant-hw-input-group .ant-hw-input-group-not-disabled:hover {
|
|
175
175
|
border-color: #40a9ff;
|
package/lib/DialogForm/hooks.js
CHANGED
|
@@ -88,6 +88,9 @@ var useModifyProps = function useModifyProps(_ref) {
|
|
|
88
88
|
setModalVisible(false);
|
|
89
89
|
};
|
|
90
90
|
}, [afterClose, autoClear]);
|
|
91
|
+
dialogForm.getParams = function () {
|
|
92
|
+
return formParams || {};
|
|
93
|
+
};
|
|
91
94
|
return {
|
|
92
95
|
modalFormData: modalFormData,
|
|
93
96
|
modalVisible: modalVisible,
|
|
@@ -105,7 +108,10 @@ var useHDialogForm = function useHDialogForm() {
|
|
|
105
108
|
return React.useMemo(function () {
|
|
106
109
|
return _objectSpread(_objectSpread({}, hForm), {}, {
|
|
107
110
|
show: function show(params) {},
|
|
108
|
-
hide: function hide() {}
|
|
111
|
+
hide: function hide() {},
|
|
112
|
+
getParams: function getParams() {
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
109
115
|
});
|
|
110
116
|
}, []);
|
|
111
117
|
};
|
|
@@ -25,6 +25,7 @@ export interface ShowParamsModal<P = any, T = any> {
|
|
|
25
25
|
export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
26
26
|
show: (data?: ShowParamsModal<P, T>) => void;
|
|
27
27
|
hide: VoidFunction;
|
|
28
|
+
getParams: () => Record<string, any>;
|
|
28
29
|
}
|
|
29
30
|
export type FooterRender = (dialogForm?: HDialogFormInstance, loading?: boolean, params?: Record<string, any>) => React.ReactNode;
|
|
30
31
|
export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFinish" | "onCancel" | "onOk" | "infoRequest" | "title" | "footer"> {
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import type { ColProps } from "antd/lib/grid/col";
|
|
|
18
18
|
import type { Gutter } from "antd/lib/grid/row";
|
|
19
19
|
import type { IUrlUploadProps } from "../Upload/modal";
|
|
20
20
|
import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
21
|
-
import { HFormTextProps } from "../Text";
|
|
21
|
+
import type { HFormTextProps } from "../Text";
|
|
22
22
|
type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
|
|
23
23
|
export type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any> | IUrlUploadProps | HFormTextProps;
|
|
24
24
|
export interface HoverModal {
|
|
@@ -38,14 +38,12 @@ var Content = function Content(_ref) {
|
|
|
38
38
|
_ref$placeholder = _ref.placeholder,
|
|
39
39
|
placeholder = _ref$placeholder === void 0 ? ["请输入", "请输入"] : _ref$placeholder,
|
|
40
40
|
_ref$inputNumberProps = _ref.inputNumberProps,
|
|
41
|
-
inputNumberProps = _ref$inputNumberProps === void 0 ? {} : _ref$inputNumberProps
|
|
42
|
-
_ref.
|
|
43
|
-
var _ref$noHandlerWrap = _ref.noHandlerWrap,
|
|
41
|
+
inputNumberProps = _ref$inputNumberProps === void 0 ? {} : _ref$inputNumberProps,
|
|
42
|
+
_ref$noHandlerWrap = _ref.noHandlerWrap,
|
|
44
43
|
noHandlerWrap = _ref$noHandlerWrap === void 0 ? true : _ref$noHandlerWrap,
|
|
45
44
|
addFormat = _ref.addFormat,
|
|
46
|
-
disabled = _ref.disabled
|
|
47
|
-
_ref.
|
|
48
|
-
var minValMk = _ref.minValMk,
|
|
45
|
+
disabled = _ref.disabled,
|
|
46
|
+
minValMk = _ref.minValMk,
|
|
49
47
|
maxValMk = _ref.maxValMk;
|
|
50
48
|
var min = valueMap.min,
|
|
51
49
|
max = valueMap.max;
|
package/lib/InputGroup/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var React = require('react');
|
|
|
9
9
|
var index = require('../hooks/index.js');
|
|
10
10
|
var antd = require('antd');
|
|
11
11
|
|
|
12
|
-
var _excluded = ["addonAfter", "addonBefore", "children", "value", "onChange"];
|
|
12
|
+
var _excluded = ["addonAfter", "addonBefore", "children", "value", "className", "onChange"];
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
15
|
var Addon = function Addon(_ref) {
|
|
@@ -39,13 +39,15 @@ var Index = function Index(_ref2) {
|
|
|
39
39
|
addonBefore = _ref2.addonBefore,
|
|
40
40
|
children = _ref2.children,
|
|
41
41
|
value = _ref2.value,
|
|
42
|
+
_ref2$className = _ref2.className,
|
|
43
|
+
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
42
44
|
onChange = _ref2.onChange,
|
|
43
45
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
44
46
|
var contentClassname = index.useClassName(["hw-input-group"]);
|
|
45
47
|
var bodyClassname = index.useClassName(["hw-input-group-body"]);
|
|
46
48
|
return jsxRuntime.jsxs(antd.Input.Group, {
|
|
47
49
|
compact: true,
|
|
48
|
-
className: contentClassname,
|
|
50
|
+
className: "".concat(contentClassname, " ").concat(className),
|
|
49
51
|
children: [jsxRuntime.jsx(Addon, {
|
|
50
52
|
value: value,
|
|
51
53
|
onChange: onChange,
|
package/lib/Text/index.d.ts
CHANGED
package/lib/index.css
CHANGED
|
@@ -164,12 +164,12 @@
|
|
|
164
164
|
background-color: #f5f5f5;
|
|
165
165
|
}
|
|
166
166
|
.ant-hw-input-group .ant-hw-input-group-number-body {
|
|
167
|
-
width: 100%;
|
|
168
|
-
border: 1px solid #d9d9d9;
|
|
169
167
|
display: -webkit-box !important;
|
|
170
168
|
display: -webkit-flex !important;
|
|
171
169
|
display: -ms-flexbox !important;
|
|
172
170
|
display: flex !important;
|
|
171
|
+
width: 100%;
|
|
172
|
+
border: 1px solid #d9d9d9;
|
|
173
173
|
}
|
|
174
174
|
.ant-hw-input-group .ant-hw-input-group-not-disabled:hover {
|
|
175
175
|
border-color: #40a9ff;
|
package/package.json
CHANGED
|
@@ -46,7 +46,7 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
46
46
|
initValue,
|
|
47
47
|
formParams,
|
|
48
48
|
title: modalTitle,
|
|
49
|
-
|
|
49
|
+
saveOldParams,
|
|
50
50
|
} = useModifyProps({
|
|
51
51
|
configData,
|
|
52
52
|
visible,
|
|
@@ -99,11 +99,11 @@ const Index: React.FC<DialogFormProps> = ({
|
|
|
99
99
|
title={<Title title={modalTitle} closable={closable} onCancel={cancel} />}
|
|
100
100
|
{...props}
|
|
101
101
|
onClose={cancel}
|
|
102
|
-
afterVisibleChange={(changeVisible)=>{
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
afterVisibleChange={(changeVisible) => {
|
|
103
|
+
if (!changeVisible) {
|
|
104
|
+
dialogForm?.clear();
|
|
105
|
+
afterClose?.();
|
|
106
|
+
}
|
|
107
107
|
}}
|
|
108
108
|
closable={false}
|
|
109
109
|
destroyOnClose
|
|
@@ -28,9 +28,9 @@ export const useModifyProps = ({
|
|
|
28
28
|
old: {},
|
|
29
29
|
};
|
|
30
30
|
}, []);
|
|
31
|
-
const saveOldParams=()=>{
|
|
31
|
+
const saveOldParams = () => {
|
|
32
32
|
saveOldParamsObj.old = dialogForm.outputValues();
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
setModalVisible(visible);
|
|
36
36
|
}, [visible]);
|
|
@@ -72,6 +72,9 @@ export const useModifyProps = ({
|
|
|
72
72
|
setModalVisible(false);
|
|
73
73
|
};
|
|
74
74
|
}, [afterClose, autoClear]);
|
|
75
|
+
dialogForm.getParams=()=>{
|
|
76
|
+
return (formParams as Record<string, any>)||{};
|
|
77
|
+
}
|
|
75
78
|
return {
|
|
76
79
|
modalFormData,
|
|
77
80
|
modalVisible,
|
|
@@ -81,7 +84,7 @@ export const useModifyProps = ({
|
|
|
81
84
|
setInitValue,
|
|
82
85
|
formParams,
|
|
83
86
|
title: modalTitle,
|
|
84
|
-
saveOldParams
|
|
87
|
+
saveOldParams,
|
|
85
88
|
};
|
|
86
89
|
};
|
|
87
90
|
export const useHDialogForm = () => {
|
|
@@ -91,6 +94,9 @@ export const useHDialogForm = () => {
|
|
|
91
94
|
...hForm,
|
|
92
95
|
show: (params) => {},
|
|
93
96
|
hide: () => {},
|
|
97
|
+
getParams:()=>{
|
|
98
|
+
return {}
|
|
99
|
+
}
|
|
94
100
|
};
|
|
95
101
|
}, []);
|
|
96
102
|
};
|
|
@@ -28,6 +28,7 @@ export interface ShowParamsModal<P = any, T = any> {
|
|
|
28
28
|
export interface HDialogFormInstance<P = any, T = any> extends HFormInstance {
|
|
29
29
|
show: (data?: ShowParamsModal<P, T>) => void;
|
|
30
30
|
hide: VoidFunction;
|
|
31
|
+
getParams:()=>Record<string, any>;
|
|
31
32
|
}
|
|
32
33
|
export type FooterRender = (
|
|
33
34
|
dialogForm?: HDialogFormInstance,
|
|
@@ -173,7 +173,7 @@ export default () => {
|
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
175
|
},
|
|
176
|
-
resetFieldsInitValue: (values={}) => {
|
|
176
|
+
resetFieldsInitValue: (values = {}) => {
|
|
177
177
|
const oldValue = form.getFieldsValue();
|
|
178
178
|
const keys = Object.keys(oldValue);
|
|
179
179
|
const newVale = {};
|
|
@@ -183,7 +183,7 @@ export default () => {
|
|
|
183
183
|
form.setFieldsValue({
|
|
184
184
|
...newVale,
|
|
185
185
|
...initSaveValue,
|
|
186
|
-
...values
|
|
186
|
+
...values,
|
|
187
187
|
});
|
|
188
188
|
},
|
|
189
189
|
clear: () => {
|
|
@@ -36,7 +36,7 @@ import type { ColProps } from "antd/lib/grid/col";
|
|
|
36
36
|
import type { Gutter } from "antd/lib/grid/row";
|
|
37
37
|
import type { IUrlUploadProps } from "../Upload/modal";
|
|
38
38
|
import type { BaseOptions } from "@ahooksjs/use-request/lib/types";
|
|
39
|
-
import { HFormTextProps } from "../Text";
|
|
39
|
+
import type { HFormTextProps } from "../Text";
|
|
40
40
|
|
|
41
41
|
type RenderFun = (
|
|
42
42
|
props: HItemProps,
|
|
@@ -199,7 +199,7 @@ export interface HFormInstance extends FormInstance {
|
|
|
199
199
|
removeDispatchListener: (action?: ActionModal, fn?: argsFn) => void;
|
|
200
200
|
reload: PromiseFnResult;
|
|
201
201
|
clear: VoidFunction;
|
|
202
|
-
resetFieldsInitValue:(
|
|
202
|
+
resetFieldsInitValue: (values?: Record<string, any>) => void;
|
|
203
203
|
clearFormat: (name: string) => void;
|
|
204
204
|
}
|
|
205
205
|
|
|
@@ -5,7 +5,7 @@ import type { InputNumberProps } from "antd/lib/input-number";
|
|
|
5
5
|
import { useClassName } from "../hooks";
|
|
6
6
|
import type { addFormatItemModal, HItemProps } from "@/components/Form/modal";
|
|
7
7
|
import HFormConnect from "../Form/HFormConnect";
|
|
8
|
-
import InputGroup from
|
|
8
|
+
import InputGroup from "../InputGroup";
|
|
9
9
|
interface IProps<T = any> {
|
|
10
10
|
placeholder?: [string, string] | string;
|
|
11
11
|
addonAfter?: React.ReactNode;
|
|
@@ -32,18 +32,15 @@ const useArrayProps = (props: any) => {
|
|
|
32
32
|
}, [props]);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
36
35
|
const Content = ({
|
|
37
36
|
value = {},
|
|
38
37
|
valueMap = { min: "min", max: "max" },
|
|
39
38
|
onChange,
|
|
40
39
|
placeholder = ["请输入", "请输入"],
|
|
41
40
|
inputNumberProps = {},
|
|
42
|
-
addonAfter,
|
|
43
41
|
noHandlerWrap = true,
|
|
44
42
|
addFormat,
|
|
45
43
|
disabled,
|
|
46
|
-
addonBefore,
|
|
47
44
|
minValMk,
|
|
48
45
|
maxValMk,
|
|
49
46
|
}: IProps) => {
|
|
@@ -99,14 +96,15 @@ const Content = ({
|
|
|
99
96
|
newVal[key] = val;
|
|
100
97
|
onChange?.(newVal);
|
|
101
98
|
};
|
|
102
|
-
return
|
|
99
|
+
return (
|
|
100
|
+
<div
|
|
103
101
|
className={`${bodyClassname}
|
|
104
102
|
${focus ? activeClassname : ""}
|
|
105
103
|
${noHandlerWrap ? noHandlerWrapClassname : ""}
|
|
106
104
|
${disabled ? disabledClassname : notDisabledClassname}
|
|
107
105
|
`}
|
|
108
|
-
|
|
109
|
-
|
|
106
|
+
>
|
|
107
|
+
<InputNumber<number>
|
|
110
108
|
bordered={false}
|
|
111
109
|
value={minVal}
|
|
112
110
|
max={maxValMk ? maxValMk(maxVal) : maxVal}
|
|
@@ -124,11 +122,11 @@ const Content = ({
|
|
|
124
122
|
placeholder={fsPlaceholder}
|
|
125
123
|
{...fsProps}
|
|
126
124
|
disabled={disabled}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
/>
|
|
126
|
+
<div className={iconClassname}>
|
|
127
|
+
<SwapRightOutlined />
|
|
128
|
+
</div>
|
|
129
|
+
<InputNumber<number>
|
|
132
130
|
bordered={false}
|
|
133
131
|
value={maxVal}
|
|
134
132
|
className={oneClassname}
|
|
@@ -145,15 +143,17 @@ const Content = ({
|
|
|
145
143
|
}}
|
|
146
144
|
{...edProps}
|
|
147
145
|
disabled={disabled}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
const InputNumberGroup = (props) => {
|
|
151
|
+
return (
|
|
152
|
+
<InputGroup {...props}>
|
|
153
|
+
<Content />
|
|
154
|
+
</InputGroup>
|
|
155
|
+
);
|
|
151
156
|
};
|
|
152
|
-
const InputNumberGroup=(props)=>{
|
|
153
|
-
return <InputGroup {...props}>
|
|
154
|
-
<Content/>
|
|
155
|
-
</InputGroup>
|
|
156
|
-
}
|
|
157
157
|
|
|
158
158
|
const Index = HFormConnect(InputNumberGroup);
|
|
159
159
|
export default {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
.@{all-input-group}-disabled {
|
|
5
5
|
background-color: #f5f5f5;
|
|
6
6
|
}
|
|
7
|
-
.@{all-input-group}-number-body{
|
|
7
|
+
.@{all-input-group}-number-body {
|
|
8
|
+
display: flex !important;
|
|
8
9
|
width: 100%;
|
|
9
10
|
border: 1px solid #d9d9d9;
|
|
10
|
-
display: flex !important;
|
|
11
11
|
}
|
|
12
12
|
.@{all-input-group}-not-disabled {
|
|
13
13
|
&:hover {
|
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {useClassName} from "../hooks";
|
|
3
|
-
import {Input} from "antd"
|
|
4
|
-
interface HInputGroupProps<T=any> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useClassName } from "../hooks";
|
|
3
|
+
import { Input } from "antd";
|
|
4
|
+
interface HInputGroupProps<T = any> {
|
|
5
|
+
addonAfter?: React.ReactNode;
|
|
6
|
+
value?: T;
|
|
7
|
+
onChange?: (value: T) => void;
|
|
8
|
+
addonBefore?: React.ReactNode;
|
|
9
|
+
className?:string;
|
|
9
10
|
}
|
|
10
11
|
const Addon: React.FC<HInputGroupProps> = ({ children, value, onChange }) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const addonClassname = useClassName(["hw-addon"]);
|
|
13
|
+
if (!children) {
|
|
14
|
+
return <></>;
|
|
15
|
+
}
|
|
16
|
+
if (React.isValidElement(children)) {
|
|
17
|
+
return (
|
|
18
|
+
<div className={addonClassname}>
|
|
19
|
+
{React.cloneElement(children as any, { value, onChange })}
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return <div className={addonClassname}>{children}</div>;
|
|
23
24
|
};
|
|
24
25
|
|
|
25
|
-
const Index:React.FC<HInputGroupProps
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const Index: React.FC<HInputGroupProps> = ({
|
|
27
|
+
addonAfter,
|
|
28
|
+
addonBefore,
|
|
29
|
+
children,
|
|
30
|
+
value,
|
|
31
|
+
className="",
|
|
32
|
+
onChange,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
const contentClassname = useClassName(["hw-input-group"]);
|
|
36
|
+
const bodyClassname = useClassName(["hw-input-group-body"]);
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
return (
|
|
39
|
+
<Input.Group compact className={`${contentClassname} ${className}`}>
|
|
40
|
+
<Addon value={value} onChange={onChange}>
|
|
41
|
+
{addonBefore}
|
|
42
|
+
</Addon>
|
|
43
|
+
<div className={bodyClassname}>
|
|
44
|
+
{React.cloneElement(children as any, { value, onChange, ...props })}
|
|
45
|
+
</div>
|
|
46
|
+
<Addon value={value} onChange={onChange}>
|
|
47
|
+
{addonAfter}
|
|
48
|
+
</Addon>
|
|
39
49
|
</Input.Group>
|
|
40
|
-
|
|
50
|
+
);
|
|
51
|
+
};
|
|
41
52
|
|
|
42
|
-
export default Index;
|
|
53
|
+
export default Index;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Space, Typography } from "antd";
|
|
2
|
-
import { TextProps } from "antd/lib/typography/Text";
|
|
2
|
+
import type { TextProps } from "antd/lib/typography/Text";
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
|
-
const {Text}=Typography;
|
|
4
|
+
const { Text } = Typography;
|
|
5
5
|
export interface HFormTextProps<V = any> extends TextProps {
|
|
6
6
|
value?: V;
|
|
7
7
|
addonBefore?: React.ReactNode;
|
|
@@ -21,9 +21,11 @@ export default ({
|
|
|
21
21
|
}
|
|
22
22
|
return value;
|
|
23
23
|
}, [value]);
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
return (
|
|
25
|
+
<Space size={size} align={"center"}>
|
|
26
|
+
<Text {...props}>{addonBefore}</Text>
|
|
27
|
+
<Text {...props}>{text}</Text>
|
|
28
|
+
<Text {...props}>{addonAfter}</Text>
|
|
29
|
+
</Space>
|
|
30
|
+
);
|
|
29
31
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
@import "../styles/local.less";
|
|
2
2
|
|
|
3
|
-
.@{ant-prefix}-hw-text-area-no-border{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
3
|
+
.@{ant-prefix}-hw-text-area-no-border {
|
|
4
|
+
border: none !important;
|
|
5
|
+
&:focus {
|
|
6
|
+
box-shadow: none !important;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { Input } from "antd";
|
|
2
2
|
import type { TextAreaProps } from "antd/es/input";
|
|
3
|
-
import {useClassName} from "../hooks";
|
|
4
|
-
export interface HTextAreaProps extends TextAreaProps{
|
|
5
|
-
|
|
3
|
+
import { useClassName } from "../hooks";
|
|
4
|
+
export interface HTextAreaProps extends TextAreaProps {
|
|
5
|
+
bordered?: boolean;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default ({
|
|
9
9
|
autoSize = { minRows: 4, maxRows: 4 },
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
bordered = true,
|
|
11
|
+
className = "",
|
|
12
12
|
...props
|
|
13
13
|
}: HTextAreaProps) => {
|
|
14
|
-
const noBorderClassName=useClassName("hw-text-area-no-border")
|
|
15
|
-
const borderClassName
|
|
16
|
-
return
|
|
14
|
+
const noBorderClassName = useClassName("hw-text-area-no-border");
|
|
15
|
+
const borderClassName = !bordered ? noBorderClassName : "";
|
|
16
|
+
return (
|
|
17
|
+
<Input.TextArea
|
|
18
|
+
autoSize={autoSize}
|
|
19
|
+
{...props}
|
|
20
|
+
className={`${borderClassName} ${className}`}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
17
23
|
};
|
|
@@ -78,9 +78,15 @@ export default () => {
|
|
|
78
78
|
console.log("contentRender");
|
|
79
79
|
return <div>{node}</div>;
|
|
80
80
|
}}
|
|
81
|
-
title={
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
title={
|
|
82
|
+
<div
|
|
83
|
+
onClick={() => {
|
|
84
|
+
modalForm.hide();
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
关闭
|
|
88
|
+
</div>
|
|
89
|
+
}
|
|
84
90
|
>
|
|
85
91
|
<Test1 />
|
|
86
92
|
</HDrawerForm>
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -117,7 +117,7 @@ export default () => {
|
|
|
117
117
|
height: "100%",
|
|
118
118
|
}}
|
|
119
119
|
>
|
|
120
|
-
<div style={{ height: 200 }}
|
|
120
|
+
<div style={{ height: 200 }} />
|
|
121
121
|
</div>
|
|
122
122
|
);
|
|
123
123
|
},
|
|
@@ -133,14 +133,15 @@ export default () => {
|
|
|
133
133
|
backgroundColor: "black",
|
|
134
134
|
height: "100%",
|
|
135
135
|
}}
|
|
136
|
-
|
|
136
|
+
/>
|
|
137
137
|
);
|
|
138
138
|
},
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: "数字输入框",
|
|
142
|
+
name: "yyy",
|
|
143
|
+
type: "inputNumberGroup",
|
|
144
|
+
rules: [{ required: true }],
|
|
144
145
|
},
|
|
145
146
|
{
|
|
146
147
|
label: "文字",
|
|
@@ -163,7 +164,7 @@ export default () => {
|
|
|
163
164
|
]}
|
|
164
165
|
dismissOnPressEnter={false}
|
|
165
166
|
formItemStyle={{
|
|
166
|
-
marginBottom:100
|
|
167
|
+
marginBottom: 100,
|
|
167
168
|
}}
|
|
168
169
|
labelWidth={88}
|
|
169
170
|
form={form}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
HColorInput,
|
|
7
7
|
HVerificationCodeInput,
|
|
8
8
|
HInputNumberGroup,
|
|
9
|
-
|
|
9
|
+
HTextArea,
|
|
10
10
|
} from "../../components";
|
|
11
11
|
import { Space } from "antd";
|
|
12
12
|
import { useState } from "react";
|
|
@@ -37,7 +37,7 @@ export default () => {
|
|
|
37
37
|
},
|
|
38
38
|
]}
|
|
39
39
|
/>
|
|
40
|
-
|
|
40
|
+
<HTextArea />
|
|
41
41
|
</Space>
|
|
42
42
|
);
|
|
43
43
|
};
|