@hw-component/form 1.9.60 → 1.9.62
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/Form/config.d.ts +1 -1
- package/es/Form/modal.d.ts +1 -1
- package/es/Input/InputNumberGroup.js +72 -104
- package/es/InputGroup/index.d.ts +10 -0
- package/es/InputGroup/index.js +67 -0
- package/es/Text/index.d.ts +1 -1
- package/es/TextArea/index.d.ts +1 -1
- package/es/hooks/index.js +1 -1
- package/es/index.css +23 -25
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -0
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Input/InputNumberGroup.js +76 -108
- package/lib/InputGroup/index.d.ts +10 -0
- package/lib/InputGroup/index.js +70 -0
- package/lib/Text/index.d.ts +1 -1
- package/lib/TextArea/index.d.ts +1 -1
- package/lib/index.css +23 -25
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -4
- package/package.json +1 -1
- package/src/components/DialogForm/DrawerForm/index.tsx +6 -6
- package/src/components/DialogForm/hooks.tsx +3 -3
- package/src/components/Form/hooks/useHForm.ts +2 -2
- package/src/components/Form/modal.ts +2 -2
- package/src/components/Input/InputNumberGroup.tsx +57 -73
- package/src/components/Input/index.less +4 -17
- package/src/components/InputGroup/index.less +26 -0
- package/src/components/InputGroup/index.tsx +53 -0
- 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/components/index.tsx +1 -0
- package/src/components/styles/index.less +1 -14
- package/src/pages/DrawerForm/index.tsx +9 -3
- package/src/pages/Form/index.tsx +10 -126
- package/src/pages/Input/index.tsx +2 -2
- package/src/pages/InputNumberGroup/index.tsx +7 -1
- package/src/pages/ModalForm/index.tsx +22 -11
|
@@ -10,8 +10,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
10
10
|
var antd = require('antd');
|
|
11
11
|
var icons = require('@ant-design/icons');
|
|
12
12
|
var React = require('react');
|
|
13
|
-
var index = require('../hooks/index.js');
|
|
13
|
+
var index$1 = require('../hooks/index.js');
|
|
14
14
|
var HFormConnect = require('../Form/HFormConnect.js');
|
|
15
|
+
var index = require('../InputGroup/index.js');
|
|
15
16
|
|
|
16
17
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
18
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -25,49 +26,27 @@ var useArrayProps = function useArrayProps(props) {
|
|
|
25
26
|
return [props, props];
|
|
26
27
|
}, [props]);
|
|
27
28
|
};
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
value = _ref
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!children) {
|
|
34
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
35
|
-
}
|
|
36
|
-
if (/*#__PURE__*/React.isValidElement(children)) {
|
|
37
|
-
return jsxRuntime.jsx("div", {
|
|
38
|
-
className: addonClassname,
|
|
39
|
-
children: /*#__PURE__*/React.cloneElement(children, {
|
|
40
|
-
value: value,
|
|
41
|
-
onChange: onChange
|
|
42
|
-
})
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return jsxRuntime.jsx("div", {
|
|
46
|
-
className: addonClassname,
|
|
47
|
-
children: children
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
var InputNumberGroup = function InputNumberGroup(_ref2) {
|
|
51
|
-
var _ref2$value = _ref2.value,
|
|
52
|
-
value = _ref2$value === void 0 ? {} : _ref2$value,
|
|
53
|
-
_ref2$valueMap = _ref2.valueMap,
|
|
54
|
-
valueMap = _ref2$valueMap === void 0 ? {
|
|
29
|
+
var Content = function Content(_ref) {
|
|
30
|
+
var _ref$value = _ref.value,
|
|
31
|
+
value = _ref$value === void 0 ? {} : _ref$value,
|
|
32
|
+
_ref$valueMap = _ref.valueMap,
|
|
33
|
+
valueMap = _ref$valueMap === void 0 ? {
|
|
55
34
|
min: "min",
|
|
56
35
|
max: "max"
|
|
57
|
-
} :
|
|
58
|
-
onChange =
|
|
59
|
-
|
|
60
|
-
placeholder =
|
|
61
|
-
|
|
62
|
-
inputNumberProps =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
noHandlerWrap =
|
|
66
|
-
addFormat =
|
|
67
|
-
disabled =
|
|
68
|
-
|
|
69
|
-
minValMk =
|
|
70
|
-
maxValMk =
|
|
36
|
+
} : _ref$valueMap,
|
|
37
|
+
onChange = _ref.onChange,
|
|
38
|
+
_ref$placeholder = _ref.placeholder,
|
|
39
|
+
placeholder = _ref$placeholder === void 0 ? ["请输入", "请输入"] : _ref$placeholder,
|
|
40
|
+
_ref$inputNumberProps = _ref.inputNumberProps,
|
|
41
|
+
inputNumberProps = _ref$inputNumberProps === void 0 ? {} : _ref$inputNumberProps;
|
|
42
|
+
_ref.addonAfter;
|
|
43
|
+
var _ref$noHandlerWrap = _ref.noHandlerWrap,
|
|
44
|
+
noHandlerWrap = _ref$noHandlerWrap === void 0 ? true : _ref$noHandlerWrap,
|
|
45
|
+
addFormat = _ref.addFormat,
|
|
46
|
+
disabled = _ref.disabled;
|
|
47
|
+
_ref.addonBefore;
|
|
48
|
+
var minValMk = _ref.minValMk,
|
|
49
|
+
maxValMk = _ref.maxValMk;
|
|
71
50
|
var min = valueMap.min,
|
|
72
51
|
max = valueMap.max;
|
|
73
52
|
var minVal = value[min],
|
|
@@ -84,15 +63,13 @@ var InputNumberGroup = function InputNumberGroup(_ref2) {
|
|
|
84
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
85
64
|
focus = _useState2[0],
|
|
86
65
|
setFocus = _useState2[1];
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var
|
|
94
|
-
var notDisabledClassname = index.useClassName(["hw-input-group-not-disabled"]);
|
|
95
|
-
var noHandlerWrapClassname = index.useClassName(["hw-input-group-no-handler-wrap"]);
|
|
66
|
+
var bodyClassname = index$1.useClassName(["hw-input-group-number-body"]);
|
|
67
|
+
var activeClassname = index$1.useClassName(["hw-input-group-active"]);
|
|
68
|
+
var oneClassname = index$1.useClassName(["hw-input-group-one"]);
|
|
69
|
+
var iconClassname = index$1.useClassName(["hw-input-group-icon"]);
|
|
70
|
+
var disabledClassname = index$1.useClassName(["hw-input-group-disabled"]);
|
|
71
|
+
var notDisabledClassname = index$1.useClassName(["hw-input-group-not-disabled"]);
|
|
72
|
+
var noHandlerWrapClassname = index$1.useClassName(["hw-input-group-no-handler-wrap"]);
|
|
96
73
|
addFormat === null || addFormat === void 0 || addFormat({
|
|
97
74
|
float: {
|
|
98
75
|
inputValue: function inputValue(item, initValue) {
|
|
@@ -124,68 +101,59 @@ var InputNumberGroup = function InputNumberGroup(_ref2) {
|
|
|
124
101
|
newVal[key] = val;
|
|
125
102
|
onChange === null || onChange === void 0 || onChange(newVal);
|
|
126
103
|
};
|
|
127
|
-
return jsxRuntime.jsxs(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
value:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
min
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
onBlur: function onBlur() {
|
|
169
|
-
setFocus(false);
|
|
170
|
-
},
|
|
171
|
-
onChange: function onChange(val) {
|
|
172
|
-
change(max, val);
|
|
173
|
-
}
|
|
174
|
-
}, edProps), {}, {
|
|
175
|
-
disabled: disabled
|
|
176
|
-
}))]
|
|
177
|
-
}), jsxRuntime.jsx(Addon, {
|
|
178
|
-
value: value,
|
|
179
|
-
onChange: onChange,
|
|
180
|
-
children: addonAfter
|
|
181
|
-
})]
|
|
104
|
+
return jsxRuntime.jsxs("div", {
|
|
105
|
+
className: "".concat(bodyClassname, " \n ").concat(focus ? activeClassname : "", " \n ").concat(noHandlerWrap ? noHandlerWrapClassname : "", "\n ").concat(disabled ? disabledClassname : notDisabledClassname, "\n "),
|
|
106
|
+
children: [jsxRuntime.jsx(antd.InputNumber, _objectSpread(_objectSpread({
|
|
107
|
+
bordered: false,
|
|
108
|
+
value: minVal,
|
|
109
|
+
max: maxValMk ? maxValMk(maxVal) : maxVal,
|
|
110
|
+
min: 0,
|
|
111
|
+
className: oneClassname,
|
|
112
|
+
onFocus: function onFocus() {
|
|
113
|
+
setFocus(true);
|
|
114
|
+
},
|
|
115
|
+
onBlur: function onBlur() {
|
|
116
|
+
setFocus(false);
|
|
117
|
+
},
|
|
118
|
+
onChange: function onChange(val) {
|
|
119
|
+
change(min, val);
|
|
120
|
+
},
|
|
121
|
+
placeholder: fsPlaceholder
|
|
122
|
+
}, fsProps), {}, {
|
|
123
|
+
disabled: disabled
|
|
124
|
+
})), jsxRuntime.jsx("div", {
|
|
125
|
+
className: iconClassname,
|
|
126
|
+
children: jsxRuntime.jsx(icons.SwapRightOutlined, {})
|
|
127
|
+
}), jsxRuntime.jsx(antd.InputNumber, _objectSpread(_objectSpread({
|
|
128
|
+
bordered: false,
|
|
129
|
+
value: maxVal,
|
|
130
|
+
className: oneClassname,
|
|
131
|
+
placeholder: edPlaceholder,
|
|
132
|
+
min: minValMk ? minValMk(minVal) : minVal,
|
|
133
|
+
onFocus: function onFocus() {
|
|
134
|
+
setFocus(true);
|
|
135
|
+
},
|
|
136
|
+
onBlur: function onBlur() {
|
|
137
|
+
setFocus(false);
|
|
138
|
+
},
|
|
139
|
+
onChange: function onChange(val) {
|
|
140
|
+
change(max, val);
|
|
141
|
+
}
|
|
142
|
+
}, edProps), {}, {
|
|
143
|
+
disabled: disabled
|
|
144
|
+
}))]
|
|
182
145
|
});
|
|
183
146
|
};
|
|
147
|
+
var InputNumberGroup = function InputNumberGroup(props) {
|
|
148
|
+
return jsxRuntime.jsx(index.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
149
|
+
children: jsxRuntime.jsx(Content, {})
|
|
150
|
+
}));
|
|
151
|
+
};
|
|
184
152
|
var Index = HFormConnect.default(InputNumberGroup);
|
|
185
153
|
var HInputNumberGroup = {
|
|
186
154
|
Component: Index,
|
|
187
|
-
placeholder: function placeholder(
|
|
188
|
-
var label =
|
|
155
|
+
placeholder: function placeholder(_ref4) {
|
|
156
|
+
var label = _ref4.label;
|
|
189
157
|
return ["\u8BF7\u8F93\u5165".concat(label, "\u6700\u5C0F\u503C"), "\u8BF7\u8F93\u5165".concat(label, "\u6700\u5927\u503C")];
|
|
190
158
|
}
|
|
191
159
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface HInputGroupProps<T = any> {
|
|
3
|
+
addonAfter?: React.ReactNode;
|
|
4
|
+
value?: T;
|
|
5
|
+
onChange?: (value: T) => void;
|
|
6
|
+
addonBefore?: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Index: React.FC<HInputGroupProps>;
|
|
10
|
+
export default Index;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
6
|
+
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var index = require('../hooks/index.js');
|
|
10
|
+
var antd = require('antd');
|
|
11
|
+
|
|
12
|
+
var _excluded = ["addonAfter", "addonBefore", "children", "value", "className", "onChange"];
|
|
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
|
+
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
|
+
var Addon = function Addon(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
value = _ref.value,
|
|
18
|
+
onChange = _ref.onChange;
|
|
19
|
+
var addonClassname = index.useClassName(["hw-addon"]);
|
|
20
|
+
if (!children) {
|
|
21
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
22
|
+
}
|
|
23
|
+
if (/*#__PURE__*/React.isValidElement(children)) {
|
|
24
|
+
return jsxRuntime.jsx("div", {
|
|
25
|
+
className: addonClassname,
|
|
26
|
+
children: /*#__PURE__*/React.cloneElement(children, {
|
|
27
|
+
value: value,
|
|
28
|
+
onChange: onChange
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return jsxRuntime.jsx("div", {
|
|
33
|
+
className: addonClassname,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var Index = function Index(_ref2) {
|
|
38
|
+
var addonAfter = _ref2.addonAfter,
|
|
39
|
+
addonBefore = _ref2.addonBefore,
|
|
40
|
+
children = _ref2.children,
|
|
41
|
+
value = _ref2.value,
|
|
42
|
+
_ref2$className = _ref2.className,
|
|
43
|
+
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
44
|
+
onChange = _ref2.onChange,
|
|
45
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
46
|
+
var contentClassname = index.useClassName(["hw-input-group"]);
|
|
47
|
+
var bodyClassname = index.useClassName(["hw-input-group-body"]);
|
|
48
|
+
return jsxRuntime.jsxs(antd.Input.Group, {
|
|
49
|
+
compact: true,
|
|
50
|
+
className: "".concat(contentClassname, " ").concat(className),
|
|
51
|
+
children: [jsxRuntime.jsx(Addon, {
|
|
52
|
+
value: value,
|
|
53
|
+
onChange: onChange,
|
|
54
|
+
children: addonBefore
|
|
55
|
+
}), jsxRuntime.jsx("div", {
|
|
56
|
+
className: bodyClassname,
|
|
57
|
+
children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
|
|
58
|
+
value: value,
|
|
59
|
+
onChange: onChange
|
|
60
|
+
}, props))
|
|
61
|
+
}), jsxRuntime.jsx(Addon, {
|
|
62
|
+
value: value,
|
|
63
|
+
onChange: onChange,
|
|
64
|
+
children: addonAfter
|
|
65
|
+
})]
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.default = Index;
|
|
70
|
+
// powered by h
|
package/lib/Text/index.d.ts
CHANGED
package/lib/TextArea/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TextAreaProps } from "antd/es/input";
|
|
2
|
-
interface HTextAreaProps extends TextAreaProps {
|
|
2
|
+
export interface HTextAreaProps extends TextAreaProps {
|
|
3
3
|
bordered?: boolean;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: ({ autoSize, bordered, className, ...props }: HTextAreaProps) => JSX.Element;
|
package/lib/index.css
CHANGED
|
@@ -160,27 +160,15 @@
|
|
|
160
160
|
.ant-hw-form-form-item .ant-form-item-label {
|
|
161
161
|
overflow: visible;
|
|
162
162
|
}
|
|
163
|
-
.ant-hw-input-group {
|
|
164
|
-
display: -webkit-box !important;
|
|
165
|
-
display: -webkit-flex !important;
|
|
166
|
-
display: -ms-flexbox !important;
|
|
167
|
-
display: flex !important;
|
|
168
|
-
width: 100%;
|
|
169
|
-
color: rgba(0, 0, 0, 0.25);
|
|
170
|
-
}
|
|
171
163
|
.ant-hw-input-group .ant-hw-input-group-disabled {
|
|
172
164
|
background-color: #f5f5f5;
|
|
173
165
|
}
|
|
174
|
-
.ant-hw-input-group .ant-hw-input-group-body {
|
|
175
|
-
position: relative;
|
|
166
|
+
.ant-hw-input-group .ant-hw-input-group-number-body {
|
|
176
167
|
display: -webkit-box !important;
|
|
177
168
|
display: -webkit-flex !important;
|
|
178
169
|
display: -ms-flexbox !important;
|
|
179
170
|
display: flex !important;
|
|
180
|
-
|
|
181
|
-
-webkit-flex: 1;
|
|
182
|
-
-ms-flex: 1;
|
|
183
|
-
flex: 1;
|
|
171
|
+
width: 100%;
|
|
184
172
|
border: 1px solid #d9d9d9;
|
|
185
173
|
}
|
|
186
174
|
.ant-hw-input-group .ant-hw-input-group-not-disabled:hover {
|
|
@@ -195,14 +183,6 @@
|
|
|
195
183
|
.ant-hw-input-group .ant-hw-input-group-no-handler-wrap .ant-input-number-handler-wrap {
|
|
196
184
|
display: none;
|
|
197
185
|
}
|
|
198
|
-
.ant-hw-input-group .ant-hw-input-group-border {
|
|
199
|
-
position: absolute;
|
|
200
|
-
left: -1px;
|
|
201
|
-
display: none;
|
|
202
|
-
width: 1px;
|
|
203
|
-
height: 100%;
|
|
204
|
-
background-color: #40a9ff;
|
|
205
|
-
}
|
|
206
186
|
.ant-hw-input-group .ant-hw-input-group-icon {
|
|
207
187
|
display: -webkit-box;
|
|
208
188
|
display: -webkit-flex;
|
|
@@ -234,7 +214,7 @@
|
|
|
234
214
|
.ant-hw-color-input-picker {
|
|
235
215
|
box-shadow: 0 0 0 0 !important;
|
|
236
216
|
}
|
|
237
|
-
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
217
|
+
.ant-form-item-has-error .ant-hw-input-group-number-body {
|
|
238
218
|
border-color: #ff4d4f !important;
|
|
239
219
|
}
|
|
240
220
|
.ant-form-item-has-error .ant-hw-input-group-active {
|
|
@@ -268,6 +248,25 @@
|
|
|
268
248
|
.ant-hw-text-area-no-border:focus {
|
|
269
249
|
box-shadow: none !important;
|
|
270
250
|
}
|
|
251
|
+
.ant-hw-input-group {
|
|
252
|
+
display: -webkit-box !important;
|
|
253
|
+
display: -webkit-flex !important;
|
|
254
|
+
display: -ms-flexbox !important;
|
|
255
|
+
display: flex !important;
|
|
256
|
+
width: 100%;
|
|
257
|
+
color: rgba(0, 0, 0, 0.25);
|
|
258
|
+
}
|
|
259
|
+
.ant-hw-input-group .ant-hw-input-group-body {
|
|
260
|
+
position: relative;
|
|
261
|
+
display: -webkit-box !important;
|
|
262
|
+
display: -webkit-flex !important;
|
|
263
|
+
display: -ms-flexbox !important;
|
|
264
|
+
display: flex !important;
|
|
265
|
+
-webkit-box-flex: 1;
|
|
266
|
+
-webkit-flex: 1;
|
|
267
|
+
-ms-flex: 1;
|
|
268
|
+
flex: 1;
|
|
269
|
+
}
|
|
271
270
|
.ant-hw-addon {
|
|
272
271
|
display: -webkit-box !important;
|
|
273
272
|
display: -webkit-flex !important;
|
|
@@ -281,7 +280,6 @@
|
|
|
281
280
|
background-color: #fafafa;
|
|
282
281
|
border: 1px solid #d9d9d9;
|
|
283
282
|
}
|
|
284
|
-
.ant-form-item-has-error .ant-hw-
|
|
285
|
-
color: #ff4d4f;
|
|
283
|
+
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
286
284
|
border-color: #ff4d4f !important;
|
|
287
285
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { useHDialogForm } from "@/components/DialogForm/hooks";
|
|
|
5
5
|
export { default as HFormConnect } from "./Form/HFormConnect";
|
|
6
6
|
export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
|
|
7
7
|
export { default as HBasicForm } from "./Form/Basic";
|
|
8
|
+
export { default as HInputGroup } from "./InputGroup";
|
|
8
9
|
export declare const HSelect: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
9
10
|
export declare const HInput: ({ copy: copyProps, value, addonAfter, ...props }: import("./Input/modal").HInputProps) => JSX.Element;
|
|
10
11
|
export declare const HSelectInput: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
@@ -20,7 +21,7 @@ export declare const HRadioGroup: ({ value, options, onChange, fieldNames: props
|
|
|
20
21
|
export declare const HTimePicker: import("react").ForwardRefExoticComponent<import("./Form/modal").HFormItemProps & import("react").RefAttributes<any>>;
|
|
21
22
|
export declare const HInputNumber: ({ style, ...props }: import("antd").InputNumberProps) => JSX.Element;
|
|
22
23
|
export declare const HPageHandler: import("react").FC<import("./PageHandler/modal").IHPageHandler<any>>;
|
|
23
|
-
export declare const HTextArea: ({ autoSize, ...props }: import("
|
|
24
|
+
export declare const HTextArea: ({ autoSize, bordered, className, ...props }: import("./TextArea").HTextAreaProps) => JSX.Element;
|
|
24
25
|
export declare const HColorInput: ({ value, onChange, defaultColor, ...props }: import("./Input/modal").HInputProps) => JSX.Element;
|
|
25
26
|
export declare const HModalForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
|
|
26
27
|
export declare const HDrawerForm: import("react").FC<import("./DialogForm/modal").DialogFormProps<any, any>>;
|
package/lib/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var config = require('./Form/config.js');
|
|
4
|
-
var index$
|
|
4
|
+
var index$2 = require('./PageHandler/index.js');
|
|
5
5
|
var index = require('./Form/index.js');
|
|
6
6
|
var useHForm = require('./Form/hooks/useHForm.js');
|
|
7
7
|
var hooks = require('./DialogForm/hooks.js');
|
|
8
8
|
var HFormConnect = require('./Form/HFormConnect.js');
|
|
9
9
|
var FormConfigProvider = require('./Form/Context/FormConfigProvider.js');
|
|
10
10
|
var Basic = require('./Form/Basic.js');
|
|
11
|
+
var index$1 = require('./InputGroup/index.js');
|
|
11
12
|
var ModalForm = require('./DialogForm/ModalForm.js');
|
|
12
|
-
var index$
|
|
13
|
+
var index$3 = require('./DialogForm/DrawerForm/index.js');
|
|
13
14
|
|
|
14
15
|
var HSelect = config.default.select;
|
|
15
16
|
var HInput = config.default.input;
|
|
@@ -25,11 +26,11 @@ var HRangePicker = config.default.rangePicker.Component;
|
|
|
25
26
|
var HRadioGroup = config.default.radioGroup;
|
|
26
27
|
var HTimePicker = config.default.timePicker;
|
|
27
28
|
var HInputNumber = config.default.inputNumber;
|
|
28
|
-
var HPageHandler = index$
|
|
29
|
+
var HPageHandler = index$2.default;
|
|
29
30
|
var HTextArea = config.default.textArea;
|
|
30
31
|
var HColorInput = config.default.colorInput;
|
|
31
32
|
var HModalForm = ModalForm.default;
|
|
32
|
-
var HDrawerForm = index$
|
|
33
|
+
var HDrawerForm = index$3.default;
|
|
33
34
|
var HCascader = config.default.cascader;
|
|
34
35
|
var HVerificationCodeInput = config.default.verificationCodeInput;
|
|
35
36
|
var HTrimInput = config.default.trimInput;
|
|
@@ -42,6 +43,7 @@ exports.useHDialogForm = hooks.useHDialogForm;
|
|
|
42
43
|
exports.HFormConnect = HFormConnect.default;
|
|
43
44
|
exports.HFormConfigProvider = FormConfigProvider.default;
|
|
44
45
|
exports.HBasicForm = Basic.default;
|
|
46
|
+
exports.HInputGroup = index$1.default;
|
|
45
47
|
exports.HButtonInput = HButtonInput;
|
|
46
48
|
exports.HCascader = HCascader;
|
|
47
49
|
exports.HCheckBox = HCheckBox;
|
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]);
|
|
@@ -81,7 +81,7 @@ export const useModifyProps = ({
|
|
|
81
81
|
setInitValue,
|
|
82
82
|
formParams,
|
|
83
83
|
title: modalTitle,
|
|
84
|
-
saveOldParams
|
|
84
|
+
saveOldParams,
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
export const useHDialogForm = () => {
|
|
@@ -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
|
|