@hw-component/form 1.9.60 → 1.9.61

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.
@@ -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 Addon = function Addon(_ref) {
29
- var children = _ref.children,
30
- value = _ref.value,
31
- onChange = _ref.onChange;
32
- var addonClassname = index.useClassName(["hw-addon"]);
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
- } : _ref2$valueMap,
58
- onChange = _ref2.onChange,
59
- _ref2$placeholder = _ref2.placeholder,
60
- placeholder = _ref2$placeholder === void 0 ? ["请输入", "请输入"] : _ref2$placeholder,
61
- _ref2$inputNumberProp = _ref2.inputNumberProps,
62
- inputNumberProps = _ref2$inputNumberProp === void 0 ? {} : _ref2$inputNumberProp,
63
- addonAfter = _ref2.addonAfter,
64
- _ref2$noHandlerWrap = _ref2.noHandlerWrap,
65
- noHandlerWrap = _ref2$noHandlerWrap === void 0 ? true : _ref2$noHandlerWrap,
66
- addFormat = _ref2.addFormat,
67
- disabled = _ref2.disabled,
68
- addonBefore = _ref2.addonBefore,
69
- minValMk = _ref2.minValMk,
70
- maxValMk = _ref2.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 contentClassname = index.useClassName(["hw-input-group"]);
88
- var bodyClassname = index.useClassName(["hw-input-group-body"]);
89
- var activeClassname = index.useClassName(["hw-input-group-active"]);
90
- var borderClassname = index.useClassName(["hw-input-group-border"]);
91
- var oneClassname = index.useClassName(["hw-input-group-one"]);
92
- var iconClassname = index.useClassName(["hw-input-group-icon"]);
93
- var disabledClassname = index.useClassName(["hw-input-group-disabled"]);
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(antd.Input.Group, {
128
- compact: true,
129
- className: contentClassname,
130
- children: [jsxRuntime.jsx(Addon, {
131
- value: value,
132
- onChange: onChange,
133
- children: addonBefore
134
- }), jsxRuntime.jsxs("div", {
135
- className: "".concat(bodyClassname, " \n ").concat(focus ? activeClassname : "", " \n ").concat(noHandlerWrap ? noHandlerWrapClassname : "", "\n ").concat(disabled ? disabledClassname : notDisabledClassname, "\n "),
136
- children: [jsxRuntime.jsx("span", {
137
- className: borderClassname
138
- }), jsxRuntime.jsx(antd.InputNumber, _objectSpread(_objectSpread({
139
- bordered: false,
140
- value: minVal,
141
- max: maxValMk ? maxValMk(maxVal) : maxVal,
142
- min: 0,
143
- className: oneClassname,
144
- onFocus: function onFocus() {
145
- setFocus(true);
146
- },
147
- onBlur: function onBlur() {
148
- setFocus(false);
149
- },
150
- onChange: function onChange(val) {
151
- change(min, val);
152
- },
153
- placeholder: fsPlaceholder
154
- }, fsProps), {}, {
155
- disabled: disabled
156
- })), jsxRuntime.jsx("div", {
157
- className: iconClassname,
158
- children: jsxRuntime.jsx(icons.SwapRightOutlined, {})
159
- }), jsxRuntime.jsx(antd.InputNumber, _objectSpread(_objectSpread({
160
- bordered: false,
161
- value: maxVal,
162
- className: oneClassname,
163
- placeholder: edPlaceholder,
164
- min: minValMk ? minValMk(minVal) : minVal,
165
- onFocus: function onFocus() {
166
- setFocus(true);
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(_ref5) {
188
- var label = _ref5.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,9 @@
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
+ }
8
+ declare const Index: React.FC<HInputGroupProps>;
9
+ export default Index;
@@ -0,0 +1,68 @@
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", "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
+ onChange = _ref2.onChange,
43
+ props = _objectWithoutProperties(_ref2, _excluded);
44
+ var contentClassname = index.useClassName(["hw-input-group"]);
45
+ var bodyClassname = index.useClassName(["hw-input-group-body"]);
46
+ return jsxRuntime.jsxs(antd.Input.Group, {
47
+ compact: true,
48
+ className: contentClassname,
49
+ children: [jsxRuntime.jsx(Addon, {
50
+ value: value,
51
+ onChange: onChange,
52
+ children: addonBefore
53
+ }), jsxRuntime.jsx("div", {
54
+ className: bodyClassname,
55
+ children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
56
+ value: value,
57
+ onChange: onChange
58
+ }, props))
59
+ }), jsxRuntime.jsx(Addon, {
60
+ value: value,
61
+ onChange: onChange,
62
+ children: addonAfter
63
+ })]
64
+ });
65
+ };
66
+
67
+ exports.default = Index;
68
+ // powered by h
@@ -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,28 +160,16 @@
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 {
167
+ width: 100%;
168
+ border: 1px solid #d9d9d9;
176
169
  display: -webkit-box !important;
177
170
  display: -webkit-flex !important;
178
171
  display: -ms-flexbox !important;
179
172
  display: flex !important;
180
- -webkit-box-flex: 1;
181
- -webkit-flex: 1;
182
- -ms-flex: 1;
183
- flex: 1;
184
- border: 1px solid #d9d9d9;
185
173
  }
186
174
  .ant-hw-input-group .ant-hw-input-group-not-disabled:hover {
187
175
  border-color: #40a9ff;
@@ -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-addon {
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("antd/es/input").TextAreaProps) => JSX.Element;
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$1 = require('./PageHandler/index.js');
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$2 = require('./DialogForm/DrawerForm/index.js');
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$1.default;
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$2.default;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.60",
3
+ "version": "1.9.61",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,11 +1,11 @@
1
- import { InputNumber, Input } from "antd";
1
+ import { InputNumber } from "antd";
2
2
  import { SwapRightOutlined } from "@ant-design/icons";
3
3
  import React, { useMemo, useState } from "react";
4
4
  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
-
8
+ import InputGroup from '../InputGroup'
9
9
  interface IProps<T = any> {
10
10
  placeholder?: [string, string] | string;
11
11
  addonAfter?: React.ReactNode;
@@ -15,7 +15,7 @@ interface IProps<T = any> {
15
15
  };
16
16
  inputNumberProps?: [InputNumberProps, InputNumberProps] | InputNumberProps;
17
17
  value?: T;
18
- onChange: (value: T) => void;
18
+ onChange?: (value: T) => void;
19
19
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
20
20
  noHandlerWrap?: boolean;
21
21
  disabled?: boolean;
@@ -31,21 +31,9 @@ const useArrayProps = (props: any) => {
31
31
  return [props, props];
32
32
  }, [props]);
33
33
  };
34
- const Addon: React.FC<IProps> = ({ children, value, onChange }) => {
35
- const addonClassname = useClassName(["hw-addon"]);
36
- if (!children) {
37
- return <></>;
38
- }
39
- if (React.isValidElement(children)) {
40
- return (
41
- <div className={addonClassname}>
42
- {React.cloneElement(children as any, { value, onChange })}
43
- </div>
44
- );
45
- }
46
- return <div className={addonClassname}>{children}</div>;
47
- };
48
- const InputNumberGroup = ({
34
+
35
+
36
+ const Content = ({
49
37
  value = {},
50
38
  valueMap = { min: "min", max: "max" },
51
39
  onChange,
@@ -64,10 +52,8 @@ const InputNumberGroup = ({
64
52
  const [fsPlaceholder, edPlaceholder] = useArrayProps(placeholder);
65
53
  const [fsProps, edProps] = useArrayProps(inputNumberProps);
66
54
  const [focus, setFocus] = useState(false);
67
- const contentClassname = useClassName(["hw-input-group"]);
68
- const bodyClassname = useClassName(["hw-input-group-body"]);
55
+ const bodyClassname = useClassName(["hw-input-group-number-body"]);
69
56
  const activeClassname = useClassName(["hw-input-group-active"]);
70
- const borderClassname = useClassName(["hw-input-group-border"]);
71
57
  const oneClassname = useClassName(["hw-input-group-one"]);
72
58
  const iconClassname = useClassName(["hw-input-group-icon"]);
73
59
  const disabledClassname = useClassName(["hw-input-group-disabled"]);
@@ -113,66 +99,62 @@ const InputNumberGroup = ({
113
99
  newVal[key] = val;
114
100
  onChange?.(newVal);
115
101
  };
116
- return (
117
- <Input.Group compact className={contentClassname}>
118
- <Addon value={value} onChange={onChange}>
119
- {addonBefore}
120
- </Addon>
121
- <div
122
- className={`${bodyClassname}
102
+ return <div
103
+ className={`${bodyClassname}
123
104
  ${focus ? activeClassname : ""}
124
105
  ${noHandlerWrap ? noHandlerWrapClassname : ""}
125
106
  ${disabled ? disabledClassname : notDisabledClassname}
126
107
  `}
127
- >
128
- <span className={borderClassname} />
129
- <InputNumber<number>
130
- bordered={false}
131
- value={minVal}
132
- max={maxValMk ? maxValMk(maxVal) : maxVal}
133
- min={0}
134
- className={oneClassname}
135
- onFocus={() => {
136
- setFocus(true);
137
- }}
138
- onBlur={() => {
139
- setFocus(false);
140
- }}
141
- onChange={(val) => {
142
- change(min, val);
143
- }}
144
- placeholder={fsPlaceholder}
145
- {...fsProps}
146
- disabled={disabled}
147
- />
148
- <div className={iconClassname}>
149
- <SwapRightOutlined />
150
- </div>
151
- <InputNumber<number>
152
- bordered={false}
153
- value={maxVal}
154
- className={oneClassname}
155
- placeholder={edPlaceholder}
156
- min={minValMk ? minValMk(minVal) : minVal}
157
- onFocus={() => {
158
- setFocus(true);
159
- }}
160
- onBlur={() => {
161
- setFocus(false);
162
- }}
163
- onChange={(val) => {
164
- change(max, val);
165
- }}
166
- {...edProps}
167
- disabled={disabled}
168
- />
169
- </div>
170
- <Addon value={value} onChange={onChange}>
171
- {addonAfter}
172
- </Addon>
173
- </Input.Group>
174
- );
108
+ >
109
+ <InputNumber<number>
110
+ bordered={false}
111
+ value={minVal}
112
+ max={maxValMk ? maxValMk(maxVal) : maxVal}
113
+ min={0}
114
+ className={oneClassname}
115
+ onFocus={() => {
116
+ setFocus(true);
117
+ }}
118
+ onBlur={() => {
119
+ setFocus(false);
120
+ }}
121
+ onChange={(val) => {
122
+ change(min, val);
123
+ }}
124
+ placeholder={fsPlaceholder}
125
+ {...fsProps}
126
+ disabled={disabled}
127
+ />
128
+ <div className={iconClassname}>
129
+ <SwapRightOutlined />
130
+ </div>
131
+ <InputNumber<number>
132
+ bordered={false}
133
+ value={maxVal}
134
+ className={oneClassname}
135
+ placeholder={edPlaceholder}
136
+ min={minValMk ? minValMk(minVal) : minVal}
137
+ onFocus={() => {
138
+ setFocus(true);
139
+ }}
140
+ onBlur={() => {
141
+ setFocus(false);
142
+ }}
143
+ onChange={(val) => {
144
+ change(max, val);
145
+ }}
146
+ {...edProps}
147
+ disabled={disabled}
148
+ />
149
+ </div>
150
+
175
151
  };
152
+ const InputNumberGroup=(props)=>{
153
+ return <InputGroup {...props}>
154
+ <Content/>
155
+ </InputGroup>
156
+ }
157
+
176
158
  const Index = HFormConnect(InputNumberGroup);
177
159
  export default {
178
160
  Component: Index,