@hw-component/form 1.9.90 → 1.9.91
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/InputGroup/index.js +17 -2
- package/es/index.css +11 -0
- package/lib/InputGroup/index.js +16 -1
- package/lib/index.css +11 -0
- package/package.json +1 -1
- package/src/components/Input/index.less +0 -1
- package/src/components/InputGroup/index.less +19 -0
- package/src/components/InputGroup/index.tsx +17 -2
- package/src/components/styles/local.less +1 -0
- package/src/pages/InputNumberGroup/index.tsx +1 -0
package/es/InputGroup/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import React from 'react';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
6
|
import { useClassName } from '../hooks/index.js';
|
|
7
7
|
import { Input } from 'antd';
|
|
8
8
|
|
|
@@ -42,6 +42,21 @@ var Index = function Index(_ref2) {
|
|
|
42
42
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
43
43
|
var contentClassname = useClassName(["hw-input-group"]);
|
|
44
44
|
var bodyClassname = useClassName(["hw-input-group-body"]);
|
|
45
|
+
var beforeBodyClassname = useClassName(["hw-input-group-before-body"]);
|
|
46
|
+
var beforeAfterClassname = useClassName(["hw-input-group-after-body"]);
|
|
47
|
+
var noAddonClassname = useClassName(["hw-input-group-no-addon"]);
|
|
48
|
+
var cuBodyClassName = useMemo(function () {
|
|
49
|
+
if (addonBefore && !addonAfter) {
|
|
50
|
+
return beforeBodyClassname;
|
|
51
|
+
}
|
|
52
|
+
if (addonAfter && !addonBefore) {
|
|
53
|
+
return beforeAfterClassname;
|
|
54
|
+
}
|
|
55
|
+
if (!addonBefore && !addonAfter) {
|
|
56
|
+
return noAddonClassname;
|
|
57
|
+
}
|
|
58
|
+
return "";
|
|
59
|
+
}, [addonAfter, addonBefore]);
|
|
45
60
|
return jsxs(Input.Group, {
|
|
46
61
|
compact: true,
|
|
47
62
|
className: "".concat(contentClassname, " ").concat(className),
|
|
@@ -50,7 +65,7 @@ var Index = function Index(_ref2) {
|
|
|
50
65
|
onChange: onChange,
|
|
51
66
|
children: addonBefore
|
|
52
67
|
}), jsx("div", {
|
|
53
|
-
className: bodyClassname,
|
|
68
|
+
className: "".concat(bodyClassname, " ").concat(cuBodyClassName),
|
|
54
69
|
children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
|
|
55
70
|
value: value,
|
|
56
71
|
onChange: onChange
|
package/es/index.css
CHANGED
|
@@ -302,6 +302,17 @@
|
|
|
302
302
|
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
303
303
|
border-color: #ff4d4f !important;
|
|
304
304
|
}
|
|
305
|
+
.ant-hw-input-group-before-body .ant-hw-input-group-number-body {
|
|
306
|
+
border-top-right-radius: 4px;
|
|
307
|
+
border-bottom-right-radius: 4px;
|
|
308
|
+
}
|
|
309
|
+
.ant-hw-input-group-after-body .ant-hw-input-group-number-body {
|
|
310
|
+
border-top-left-radius: 4px;
|
|
311
|
+
border-bottom-left-radius: 4px;
|
|
312
|
+
}
|
|
313
|
+
.ant-hw-input-group-no-addon .ant-hw-input-group-number-body {
|
|
314
|
+
border-radius: 4px;
|
|
315
|
+
}
|
|
305
316
|
.ant-hw-rich-editor {
|
|
306
317
|
box-sizing: border-box;
|
|
307
318
|
width: 100%;
|
package/lib/InputGroup/index.js
CHANGED
|
@@ -45,6 +45,21 @@ var Index = function Index(_ref2) {
|
|
|
45
45
|
props = _objectWithoutProperties(_ref2, _excluded);
|
|
46
46
|
var contentClassname = index.useClassName(["hw-input-group"]);
|
|
47
47
|
var bodyClassname = index.useClassName(["hw-input-group-body"]);
|
|
48
|
+
var beforeBodyClassname = index.useClassName(["hw-input-group-before-body"]);
|
|
49
|
+
var beforeAfterClassname = index.useClassName(["hw-input-group-after-body"]);
|
|
50
|
+
var noAddonClassname = index.useClassName(["hw-input-group-no-addon"]);
|
|
51
|
+
var cuBodyClassName = React.useMemo(function () {
|
|
52
|
+
if (addonBefore && !addonAfter) {
|
|
53
|
+
return beforeBodyClassname;
|
|
54
|
+
}
|
|
55
|
+
if (addonAfter && !addonBefore) {
|
|
56
|
+
return beforeAfterClassname;
|
|
57
|
+
}
|
|
58
|
+
if (!addonBefore && !addonAfter) {
|
|
59
|
+
return noAddonClassname;
|
|
60
|
+
}
|
|
61
|
+
return "";
|
|
62
|
+
}, [addonAfter, addonBefore]);
|
|
48
63
|
return jsxRuntime.jsxs(antd.Input.Group, {
|
|
49
64
|
compact: true,
|
|
50
65
|
className: "".concat(contentClassname, " ").concat(className),
|
|
@@ -53,7 +68,7 @@ var Index = function Index(_ref2) {
|
|
|
53
68
|
onChange: onChange,
|
|
54
69
|
children: addonBefore
|
|
55
70
|
}), jsxRuntime.jsx("div", {
|
|
56
|
-
className: bodyClassname,
|
|
71
|
+
className: "".concat(bodyClassname, " ").concat(cuBodyClassName),
|
|
57
72
|
children: /*#__PURE__*/React.cloneElement(children, _objectSpread({
|
|
58
73
|
value: value,
|
|
59
74
|
onChange: onChange
|
package/lib/index.css
CHANGED
|
@@ -302,6 +302,17 @@
|
|
|
302
302
|
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
303
303
|
border-color: #ff4d4f !important;
|
|
304
304
|
}
|
|
305
|
+
.ant-hw-input-group-before-body .ant-hw-input-group-number-body {
|
|
306
|
+
border-top-right-radius: 4px;
|
|
307
|
+
border-bottom-right-radius: 4px;
|
|
308
|
+
}
|
|
309
|
+
.ant-hw-input-group-after-body .ant-hw-input-group-number-body {
|
|
310
|
+
border-top-left-radius: 4px;
|
|
311
|
+
border-bottom-left-radius: 4px;
|
|
312
|
+
}
|
|
313
|
+
.ant-hw-input-group-no-addon .ant-hw-input-group-number-body {
|
|
314
|
+
border-radius: 4px;
|
|
315
|
+
}
|
|
305
316
|
.ant-hw-rich-editor {
|
|
306
317
|
box-sizing: border-box;
|
|
307
318
|
width: 100%;
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../styles/local.less";
|
|
2
|
+
|
|
2
3
|
@all-input-group: ~"@{ant-prefix}-hw-input-group";
|
|
3
4
|
|
|
4
5
|
.@{all-input-group} {
|
|
@@ -24,3 +25,21 @@
|
|
|
24
25
|
border-color: #ff4d4f !important;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
28
|
+
.@{all-input-group}-before-body{
|
|
29
|
+
.@{all-input-group}-number-body{
|
|
30
|
+
border-top-right-radius:@border-radius-base;
|
|
31
|
+
border-bottom-right-radius:@border-radius-base;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
.@{all-input-group}-after-body{
|
|
35
|
+
.@{all-input-group}-number-body{
|
|
36
|
+
border-top-left-radius:@border-radius-base;
|
|
37
|
+
border-bottom-left-radius:@border-radius-base;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.@{all-input-group}-no-addon{
|
|
42
|
+
.@{all-input-group}-number-body{
|
|
43
|
+
border-radius: @border-radius-base;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, {useMemo} from "react";
|
|
2
2
|
import { useClassName } from "../hooks";
|
|
3
3
|
import { Input } from "antd";
|
|
4
4
|
interface HInputGroupProps<T = any> {
|
|
@@ -34,13 +34,28 @@ const Index: React.FC<HInputGroupProps> = ({
|
|
|
34
34
|
}) => {
|
|
35
35
|
const contentClassname = useClassName(["hw-input-group"]);
|
|
36
36
|
const bodyClassname = useClassName(["hw-input-group-body"]);
|
|
37
|
+
const beforeBodyClassname = useClassName(["hw-input-group-before-body"]);
|
|
38
|
+
const beforeAfterClassname = useClassName(["hw-input-group-after-body"]);
|
|
39
|
+
const noAddonClassname = useClassName(["hw-input-group-no-addon"]);
|
|
37
40
|
|
|
41
|
+
const cuBodyClassName=useMemo(()=>{
|
|
42
|
+
if (addonBefore&&!addonAfter){
|
|
43
|
+
return beforeBodyClassname;
|
|
44
|
+
}
|
|
45
|
+
if (addonAfter&&!addonBefore){
|
|
46
|
+
return beforeAfterClassname;
|
|
47
|
+
}
|
|
48
|
+
if (!addonBefore&&!addonAfter){
|
|
49
|
+
return noAddonClassname;
|
|
50
|
+
}
|
|
51
|
+
return ""
|
|
52
|
+
},[addonAfter,addonBefore]);
|
|
38
53
|
return (
|
|
39
54
|
<Input.Group compact className={`${contentClassname} ${className}`}>
|
|
40
55
|
<Addon value={value} onChange={onChange}>
|
|
41
56
|
{addonBefore}
|
|
42
57
|
</Addon>
|
|
43
|
-
<div className={bodyClassname}>
|
|
58
|
+
<div className={`${bodyClassname} ${cuBodyClassName}`}>
|
|
44
59
|
{React.cloneElement(children as any, { value, onChange, ...props })}
|
|
45
60
|
</div>
|
|
46
61
|
<Addon value={value} onChange={onChange}>
|