@hw-component/form 1.9.25 → 1.9.26
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/Switch/index.js
CHANGED
|
@@ -29,7 +29,8 @@ var Index = function Index(_ref) {
|
|
|
29
29
|
_useMatchConfigProps$ = _useMatchConfigProps.valueSwitchMap,
|
|
30
30
|
valueSwitchMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
31
31
|
var switchClassName = useClassName("hw-switch");
|
|
32
|
-
var
|
|
32
|
+
var switchBefore = useClassName("hw-switch-before");
|
|
33
|
+
var switchAfter = useClassName("hw-switch-after");
|
|
33
34
|
var swChecked = useMemo(function () {
|
|
34
35
|
var open = valueSwitchMap.open;
|
|
35
36
|
return value === open;
|
|
@@ -63,15 +64,16 @@ var Index = function Index(_ref) {
|
|
|
63
64
|
return jsxs("div", {
|
|
64
65
|
style: style,
|
|
65
66
|
className: switchClassName,
|
|
66
|
-
children: [jsx("span", {
|
|
67
|
+
children: [beforeText && jsx("span", {
|
|
68
|
+
className: switchBefore,
|
|
67
69
|
children: beforeText
|
|
68
70
|
}), jsx(Switch, _objectSpread({
|
|
69
71
|
checked: swChecked,
|
|
70
72
|
checkedChildren: checkedChildren,
|
|
71
73
|
unCheckedChildren: unCheckedChildren,
|
|
72
|
-
className: switchBody,
|
|
73
74
|
onChange: change
|
|
74
|
-
}, props)), jsx("span", {
|
|
75
|
+
}, props)), children && jsx("span", {
|
|
76
|
+
className: switchAfter,
|
|
75
77
|
children: children
|
|
76
78
|
})]
|
|
77
79
|
});
|
package/es/index.css
CHANGED
|
@@ -227,7 +227,9 @@
|
|
|
227
227
|
-ms-flex-align: center;
|
|
228
228
|
align-items: center;
|
|
229
229
|
}
|
|
230
|
-
.ant-hw-switch .ant-hw-switch-
|
|
231
|
-
margin-left: 4px;
|
|
230
|
+
.ant-hw-switch .ant-hw-switch-before {
|
|
232
231
|
margin-right: 4px;
|
|
233
232
|
}
|
|
233
|
+
.ant-hw-switch .ant-hw-switch-after {
|
|
234
|
+
margin-left: 4px;
|
|
235
|
+
}
|
package/lib/Switch/index.js
CHANGED
|
@@ -32,7 +32,8 @@ var Index = function Index(_ref) {
|
|
|
32
32
|
_useMatchConfigProps$ = _useMatchConfigProps.valueSwitchMap,
|
|
33
33
|
valueSwitchMap = _useMatchConfigProps$ === void 0 ? {} : _useMatchConfigProps$;
|
|
34
34
|
var switchClassName = index.useClassName("hw-switch");
|
|
35
|
-
var
|
|
35
|
+
var switchBefore = index.useClassName("hw-switch-before");
|
|
36
|
+
var switchAfter = index.useClassName("hw-switch-after");
|
|
36
37
|
var swChecked = React.useMemo(function () {
|
|
37
38
|
var open = valueSwitchMap.open;
|
|
38
39
|
return value === open;
|
|
@@ -66,15 +67,16 @@ var Index = function Index(_ref) {
|
|
|
66
67
|
return jsxRuntime.jsxs("div", {
|
|
67
68
|
style: style,
|
|
68
69
|
className: switchClassName,
|
|
69
|
-
children: [jsxRuntime.jsx("span", {
|
|
70
|
+
children: [beforeText && jsxRuntime.jsx("span", {
|
|
71
|
+
className: switchBefore,
|
|
70
72
|
children: beforeText
|
|
71
73
|
}), jsxRuntime.jsx(antd.Switch, _objectSpread({
|
|
72
74
|
checked: swChecked,
|
|
73
75
|
checkedChildren: checkedChildren,
|
|
74
76
|
unCheckedChildren: unCheckedChildren,
|
|
75
|
-
className: switchBody,
|
|
76
77
|
onChange: change
|
|
77
|
-
}, props)), jsxRuntime.jsx("span", {
|
|
78
|
+
}, props)), children && jsxRuntime.jsx("span", {
|
|
79
|
+
className: switchAfter,
|
|
78
80
|
children: children
|
|
79
81
|
})]
|
|
80
82
|
});
|
package/lib/index.css
CHANGED
|
@@ -227,7 +227,9 @@
|
|
|
227
227
|
-ms-flex-align: center;
|
|
228
228
|
align-items: center;
|
|
229
229
|
}
|
|
230
|
-
.ant-hw-switch .ant-hw-switch-
|
|
231
|
-
margin-left: 4px;
|
|
230
|
+
.ant-hw-switch .ant-hw-switch-before {
|
|
232
231
|
margin-right: 4px;
|
|
233
232
|
}
|
|
233
|
+
.ant-hw-switch .ant-hw-switch-after {
|
|
234
|
+
margin-left: 4px;
|
|
235
|
+
}
|
package/package.json
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: row;
|
|
6
6
|
align-items: center;
|
|
7
|
-
.@{ant-prefix}-hw-switch-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
.@{ant-prefix}-hw-switch-before{
|
|
8
|
+
margin-right: 4px;
|
|
9
|
+
}
|
|
10
|
+
.@{ant-prefix}-hw-switch-after{
|
|
11
|
+
margin-left: 4px;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SwitchProps } from "antd";
|
|
2
|
-
import {
|
|
2
|
+
import {Switch } from "antd";
|
|
3
3
|
import React, { useMemo } from "react";
|
|
4
4
|
import {useClassName, useMatchConfigProps} from "../hooks";
|
|
5
5
|
import type { ValueSwitchMapModal } from "../modal";
|
|
@@ -29,7 +29,9 @@ const Index: React.FC<HSwitchProps> = ({
|
|
|
29
29
|
valueSwitchMap: propsValueSwitchMap,
|
|
30
30
|
});
|
|
31
31
|
const switchClassName=useClassName("hw-switch");
|
|
32
|
-
const
|
|
32
|
+
const switchBefore=useClassName("hw-switch-before");
|
|
33
|
+
const switchAfter=useClassName("hw-switch-after")
|
|
34
|
+
|
|
33
35
|
const swChecked = useMemo(() => {
|
|
34
36
|
const { open } = valueSwitchMap;
|
|
35
37
|
return value === open;
|
|
@@ -64,18 +66,17 @@ const Index: React.FC<HSwitchProps> = ({
|
|
|
64
66
|
});
|
|
65
67
|
return (
|
|
66
68
|
<div style={style} className={switchClassName}>
|
|
67
|
-
|
|
69
|
+
{beforeText&&<span className={switchBefore}>
|
|
68
70
|
{beforeText}
|
|
69
|
-
</span>
|
|
71
|
+
</span>}
|
|
70
72
|
<Switch
|
|
71
73
|
checked={swChecked}
|
|
72
74
|
checkedChildren={checkedChildren}
|
|
73
75
|
unCheckedChildren={unCheckedChildren}
|
|
74
|
-
className={switchBody}
|
|
75
76
|
onChange={change}
|
|
76
77
|
{...props}
|
|
77
78
|
/>
|
|
78
|
-
<span >{children}</span>
|
|
79
|
+
{children&& <span className={switchAfter}>{children}</span>}
|
|
79
80
|
</div>
|
|
80
81
|
);
|
|
81
82
|
};
|