@hw-component/form 1.9.22 → 1.9.24

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.
@@ -1,3 +1,3 @@
1
1
  import type { HFormProps } from "@/components/Form/modal";
2
- declare const _default: ({ configData, gutter, dismissOnPressEnter, itemSpan, }: HFormProps) => JSX.Element;
2
+ declare const _default: ({ configData, gutter, dismissOnPressEnter, itemSpan, labelWidth, }: HFormProps) => JSX.Element;
3
3
  export default _default;
package/es/Form/Basic.js CHANGED
@@ -14,7 +14,8 @@ var Basic = (function (_ref) {
14
14
  gutter = _ref.gutter,
15
15
  _ref$dismissOnPressEn = _ref.dismissOnPressEnter,
16
16
  dismissOnPressEnter = _ref$dismissOnPressEn === void 0 ? true : _ref$dismissOnPressEn,
17
- itemSpan = _ref.itemSpan;
17
+ itemSpan = _ref.itemSpan,
18
+ labelWidth = _ref.labelWidth;
18
19
  var _useFormContext = useFormContext(),
19
20
  form = _useFormContext.form,
20
21
  formItemProps = _useFormContext.itemProps,
@@ -39,7 +40,8 @@ var Basic = (function (_ref) {
39
40
  width: "100%"
40
41
  },
41
42
  children: newConfigData.map(function (itemData, index) {
42
- var itemLabelWidth = itemData.labelWidth,
43
+ var _itemData$labelWidth = itemData.labelWidth,
44
+ itemLabelWidth = _itemData$labelWidth === void 0 ? labelWidth : _itemData$labelWidth,
43
45
  hideLabel = itemData.hideLabel,
44
46
  labelAlign = itemData.labelAlign,
45
47
  name = itemData.name,
@@ -65,15 +65,13 @@ var Index = function Index(_ref) {
65
65
  className: switchClassName,
66
66
  children: [jsx("span", {
67
67
  children: beforeText
68
- }), jsx("div", {
68
+ }), jsx(Switch, _objectSpread({
69
+ checked: swChecked,
70
+ checkedChildren: checkedChildren,
71
+ unCheckedChildren: unCheckedChildren,
69
72
  className: switchBody,
70
- children: jsx(Switch, _objectSpread({
71
- checked: swChecked,
72
- checkedChildren: checkedChildren,
73
- unCheckedChildren: unCheckedChildren,
74
- onChange: change
75
- }, props))
76
- }), jsx("span", {
73
+ onChange: change
74
+ }, props)), jsx("span", {
77
75
  children: children
78
76
  })]
79
77
  });
@@ -1,3 +1,3 @@
1
1
  import type { HFormProps } from "@/components/Form/modal";
2
- declare const _default: ({ configData, gutter, dismissOnPressEnter, itemSpan, }: HFormProps) => JSX.Element;
2
+ declare const _default: ({ configData, gutter, dismissOnPressEnter, itemSpan, labelWidth, }: HFormProps) => JSX.Element;
3
3
  export default _default;
package/lib/Form/Basic.js CHANGED
@@ -17,7 +17,8 @@ var Basic = (function (_ref) {
17
17
  gutter = _ref.gutter,
18
18
  _ref$dismissOnPressEn = _ref.dismissOnPressEnter,
19
19
  dismissOnPressEnter = _ref$dismissOnPressEn === void 0 ? true : _ref$dismissOnPressEn,
20
- itemSpan = _ref.itemSpan;
20
+ itemSpan = _ref.itemSpan,
21
+ labelWidth = _ref.labelWidth;
21
22
  var _useFormContext = index.useFormContext(),
22
23
  form = _useFormContext.form,
23
24
  formItemProps = _useFormContext.itemProps,
@@ -42,7 +43,8 @@ var Basic = (function (_ref) {
42
43
  width: "100%"
43
44
  },
44
45
  children: newConfigData.map(function (itemData, index) {
45
- var itemLabelWidth = itemData.labelWidth,
46
+ var _itemData$labelWidth = itemData.labelWidth,
47
+ itemLabelWidth = _itemData$labelWidth === void 0 ? labelWidth : _itemData$labelWidth,
46
48
  hideLabel = itemData.hideLabel,
47
49
  labelAlign = itemData.labelAlign,
48
50
  name = itemData.name,
@@ -68,15 +68,13 @@ var Index = function Index(_ref) {
68
68
  className: switchClassName,
69
69
  children: [jsxRuntime.jsx("span", {
70
70
  children: beforeText
71
- }), jsxRuntime.jsx("div", {
71
+ }), jsxRuntime.jsx(antd.Switch, _objectSpread({
72
+ checked: swChecked,
73
+ checkedChildren: checkedChildren,
74
+ unCheckedChildren: unCheckedChildren,
72
75
  className: switchBody,
73
- children: jsxRuntime.jsx(antd.Switch, _objectSpread({
74
- checked: swChecked,
75
- checkedChildren: checkedChildren,
76
- unCheckedChildren: unCheckedChildren,
77
- onChange: change
78
- }, props))
79
- }), jsxRuntime.jsx("span", {
76
+ onChange: change
77
+ }, props)), jsxRuntime.jsx("span", {
80
78
  children: children
81
79
  })]
82
80
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.22",
3
+ "version": "1.9.24",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,6 +14,7 @@ export default ({
14
14
  gutter,
15
15
  dismissOnPressEnter = true,
16
16
  itemSpan,
17
+ labelWidth,
17
18
  }: HFormProps) => {
18
19
  const {
19
20
  form,
@@ -36,7 +37,7 @@ export default ({
36
37
  <Row gutter={gutter} style={{ width: "100%" }}>
37
38
  {newConfigData.map((itemData: HItemProps, index) => {
38
39
  const {
39
- labelWidth: itemLabelWidth,
40
+ labelWidth: itemLabelWidth=labelWidth,
40
41
  hideLabel,
41
42
  labelAlign,
42
43
  name,
@@ -67,16 +67,15 @@ const Index: React.FC<HSwitchProps> = ({
67
67
  <span>
68
68
  {beforeText}
69
69
  </span>
70
- <div className={switchBody}>
71
- <Switch
72
- checked={swChecked}
73
- checkedChildren={checkedChildren}
74
- unCheckedChildren={unCheckedChildren}
75
- onChange={change}
76
- {...props}
77
- />
78
- </div>
79
- <span>{children}</span>
70
+ <Switch
71
+ checked={swChecked}
72
+ checkedChildren={checkedChildren}
73
+ unCheckedChildren={unCheckedChildren}
74
+ className={switchBody}
75
+ onChange={change}
76
+ {...props}
77
+ />
78
+ <span >{children}</span>
80
79
  </div>
81
80
  );
82
81
  };
@@ -6,6 +6,7 @@ export default () => {
6
6
  <HSwitch
7
7
  value={1}
8
8
  beforeText="开关"
9
+ size="small"
9
10
  valueMap={{ open: 1, close: 0 }}
10
11
  onChange={(val) => {
11
12
  console.log(val);