@hw-component/form 1.9.24 → 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/Form/Basic.js +4 -2
- package/es/Switch/index.js +6 -4
- package/es/index.css +4 -2
- package/lib/Form/Basic.js +4 -2
- package/lib/Switch/index.js +6 -4
- package/lib/index.css +4 -2
- package/package.json +1 -1
- package/src/components/Form/Basic.tsx +3 -1
- package/src/components/Switch/index.less +5 -3
- package/src/components/Switch/index.tsx +7 -6
- package/src/pages/Form/index.tsx +3 -0
package/es/Form/Basic.js
CHANGED
|
@@ -34,6 +34,7 @@ var Basic = (function (_ref) {
|
|
|
34
34
|
var defaultOnPressEnter = function defaultOnPressEnter() {
|
|
35
35
|
form.submit();
|
|
36
36
|
};
|
|
37
|
+
var globalItemSpan = itemSpan || formItemSpan;
|
|
37
38
|
return jsx(Row, {
|
|
38
39
|
gutter: gutter,
|
|
39
40
|
style: {
|
|
@@ -48,7 +49,8 @@ var Basic = (function (_ref) {
|
|
|
48
49
|
style = itemData.style,
|
|
49
50
|
_itemData$itemProps = itemData.itemProps,
|
|
50
51
|
itemProps = _itemData$itemProps === void 0 ? {} : _itemData$itemProps,
|
|
51
|
-
itemColon = itemData.colon
|
|
52
|
+
itemColon = itemData.colon,
|
|
53
|
+
configItemSpan = itemData.itemSpan;
|
|
52
54
|
var defaultItemProps = _objectSpread(_objectSpread({
|
|
53
55
|
onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter
|
|
54
56
|
}, formItemProps), itemProps);
|
|
@@ -58,7 +60,7 @@ var Basic = (function (_ref) {
|
|
|
58
60
|
style: style,
|
|
59
61
|
itemProps: defaultItemProps,
|
|
60
62
|
hideLabel: hideLabel,
|
|
61
|
-
itemSpan:
|
|
63
|
+
itemSpan: configItemSpan || globalItemSpan,
|
|
62
64
|
labelWidth: itemLabelWidth,
|
|
63
65
|
colon: typeof itemColon === "undefined" ? formColon : itemColon
|
|
64
66
|
}));
|
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/Form/Basic.js
CHANGED
|
@@ -37,6 +37,7 @@ var Basic = (function (_ref) {
|
|
|
37
37
|
var defaultOnPressEnter = function defaultOnPressEnter() {
|
|
38
38
|
form.submit();
|
|
39
39
|
};
|
|
40
|
+
var globalItemSpan = itemSpan || formItemSpan;
|
|
40
41
|
return jsxRuntime.jsx(antd.Row, {
|
|
41
42
|
gutter: gutter,
|
|
42
43
|
style: {
|
|
@@ -51,7 +52,8 @@ var Basic = (function (_ref) {
|
|
|
51
52
|
style = itemData.style,
|
|
52
53
|
_itemData$itemProps = itemData.itemProps,
|
|
53
54
|
itemProps = _itemData$itemProps === void 0 ? {} : _itemData$itemProps,
|
|
54
|
-
itemColon = itemData.colon
|
|
55
|
+
itemColon = itemData.colon,
|
|
56
|
+
configItemSpan = itemData.itemSpan;
|
|
55
57
|
var defaultItemProps = _objectSpread(_objectSpread({
|
|
56
58
|
onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter
|
|
57
59
|
}, formItemProps), itemProps);
|
|
@@ -61,7 +63,7 @@ var Basic = (function (_ref) {
|
|
|
61
63
|
style: style,
|
|
62
64
|
itemProps: defaultItemProps,
|
|
63
65
|
hideLabel: hideLabel,
|
|
64
|
-
itemSpan:
|
|
66
|
+
itemSpan: configItemSpan || globalItemSpan,
|
|
65
67
|
labelWidth: itemLabelWidth,
|
|
66
68
|
colon: typeof itemColon === "undefined" ? formColon : itemColon
|
|
67
69
|
}));
|
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
|
@@ -33,6 +33,7 @@ export default ({
|
|
|
33
33
|
const defaultOnPressEnter = () => {
|
|
34
34
|
form.submit();
|
|
35
35
|
};
|
|
36
|
+
const globalItemSpan=itemSpan||formItemSpan;
|
|
36
37
|
return (
|
|
37
38
|
<Row gutter={gutter} style={{ width: "100%" }}>
|
|
38
39
|
{newConfigData.map((itemData: HItemProps, index) => {
|
|
@@ -44,6 +45,7 @@ export default ({
|
|
|
44
45
|
style,
|
|
45
46
|
itemProps = {},
|
|
46
47
|
colon: itemColon,
|
|
48
|
+
itemSpan:configItemSpan,
|
|
47
49
|
} = itemData;
|
|
48
50
|
const defaultItemProps = {
|
|
49
51
|
onPressEnter: dismissOnPressEnter ? undefined : defaultOnPressEnter,
|
|
@@ -59,7 +61,7 @@ export default ({
|
|
|
59
61
|
style={style}
|
|
60
62
|
itemProps={defaultItemProps as ItemPropsType}
|
|
61
63
|
hideLabel={hideLabel}
|
|
62
|
-
itemSpan={
|
|
64
|
+
itemSpan={configItemSpan||globalItemSpan}
|
|
63
65
|
labelWidth={itemLabelWidth}
|
|
64
66
|
colon={typeof itemColon === "undefined" ? formColon : itemColon}
|
|
65
67
|
/>
|
|
@@ -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
|
};
|