@hw-component/form 0.0.7-beta-v5 → 0.0.7-beta-v6

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.
@@ -28,7 +28,7 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
28
28
  dialogForm?: HDialogFormInstance;
29
29
  onFinish?: (values: T, params: P) => Promise<any>;
30
30
  onCancel?: VoidFunction;
31
- onOk?: (data: T, params: P) => boolean | undefined;
31
+ onOk?: (data: T, params: P) => boolean | void;
32
32
  infoRequest?: (params: P) => Promise<T>;
33
33
  }
34
34
  export {};
@@ -14,7 +14,7 @@ import type { RangePickerProps } from "antd/es/date-picker";
14
14
  import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
15
15
  import type { ForwardedRef } from "react";
16
16
  import type { DataFnProvider } from "../modal";
17
- import { ColProps } from "antd/lib/grid/col";
17
+ import type { ColProps } from "antd/lib/grid/col";
18
18
  type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
19
19
  type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any>;
20
20
  export interface HoverModal {
@@ -28,7 +28,7 @@ export interface DialogFormProps<P = any, T = any> extends Omit<RootProps, "onFi
28
28
  dialogForm?: HDialogFormInstance;
29
29
  onFinish?: (values: T, params: P) => Promise<any>;
30
30
  onCancel?: VoidFunction;
31
- onOk?: (data: T, params: P) => boolean | undefined;
31
+ onOk?: (data: T, params: P) => boolean | void;
32
32
  infoRequest?: (params: P) => Promise<T>;
33
33
  }
34
34
  export {};
@@ -14,7 +14,7 @@ import type { RangePickerProps } from "antd/es/date-picker";
14
14
  import type { PromiseFnResult, ValueCheckMapModal, ValueSwitchMapModal, DateRangePickerValueMapModal } from "../modal";
15
15
  import type { ForwardedRef } from "react";
16
16
  import type { DataFnProvider } from "../modal";
17
- import { ColProps } from "antd/lib/grid/col";
17
+ import type { ColProps } from "antd/lib/grid/col";
18
18
  type RenderFun = (props: HItemProps, node: React.ReactNode, form: FormInstance) => React.ReactNode;
19
19
  type ItemPropsType = HCheckboxProps | HInputProps | HSelectInputProps | HButtonProps | HRadioGroupProps | HSelectProps | ButtonProps | HSwitchProps | HDatePickerProps | HRangePickerProps | HTimePickerProps | TextAreaProps | IUpLoadProps | CascaderProps<any>;
20
20
  export interface HoverModal {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.7-beta-v5",
3
+ "version": "0.0.7-beta-v6",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,6 +32,6 @@ export interface DialogFormProps<P = any, T = any>
32
32
  dialogForm?: HDialogFormInstance;
33
33
  onFinish?: (values: T, params: P) => Promise<any>;
34
34
  onCancel?: VoidFunction;
35
- onOk?: (data: T, params: P) => boolean | undefined;
35
+ onOk?: (data: T, params: P) => boolean | void;
36
36
  infoRequest?: (params: P) => Promise<T>;
37
37
  }
@@ -1,5 +1,5 @@
1
1
  import Label from "../Label";
2
- import { Form, Space ,Col} from "antd";
2
+ import { Form, Space, Col } from "antd";
3
3
  import React from "react";
4
4
  import Helper from "./Helper";
5
5
  import { useClassName } from "../../hooks";
@@ -43,7 +43,7 @@ const Index: React.FC<HFormItemProps> = (props) => {
43
43
  helper,
44
44
  hide,
45
45
  render,
46
- itemSpan={span:24},
46
+ itemSpan = { span: 24 },
47
47
  ...oProps
48
48
  } = props;
49
49
  const { form } = useFormContext();
@@ -54,25 +54,25 @@ const Index: React.FC<HFormItemProps> = (props) => {
54
54
  return null;
55
55
  }
56
56
  return (
57
- <Col {...itemSpan}>
58
- <Form.Item
59
- label={
60
- <Label
61
- hover={hover}
62
- labelWidth={labelWidth}
63
- required={required}
64
- colon={colon}
65
- >
66
- {label}
67
- </Label>
68
- }
69
- {...oProps}
70
- colon={false}
71
- required={false}
72
- >
73
- <Content helper={helper}>{defaultRender(form)}</Content>
74
- </Form.Item>
75
- </Col>
57
+ <Col {...itemSpan}>
58
+ <Form.Item
59
+ label={
60
+ <Label
61
+ hover={hover}
62
+ labelWidth={labelWidth}
63
+ required={required}
64
+ colon={colon}
65
+ >
66
+ {label}
67
+ </Label>
68
+ }
69
+ {...oProps}
70
+ colon={false}
71
+ required={false}
72
+ >
73
+ <Content helper={helper}>{defaultRender(form)}</Content>
74
+ </Form.Item>
75
+ </Col>
76
76
  );
77
77
  };
78
78
 
@@ -2,6 +2,12 @@ import BasicItem from "./BasicItem";
2
2
  import type { HItemProps } from "../modal";
3
3
 
4
4
  export default (props: HItemProps) => {
5
- const { type, colon,itemSpan} = props;
6
- return <BasicItem {...props} itemSpan={itemSpan} colon={type === "submit" ? false : colon} />;
5
+ const { type, colon, itemSpan } = props;
6
+ return (
7
+ <BasicItem
8
+ {...props}
9
+ itemSpan={itemSpan}
10
+ colon={type === "submit" ? false : colon}
11
+ />
12
+ );
7
13
  };
@@ -7,7 +7,7 @@ export default ({
7
7
  shouldUpdate,
8
8
  dependencies,
9
9
  hide,
10
- itemSpan,
10
+ itemSpan,
11
11
  ...props
12
12
  }: HFormItemProps) => {
13
13
  const resultShouldUpdate = useShouldUpdate({ shouldUpdate, hide });
@@ -1,4 +1,4 @@
1
- import { Form ,Row} from "antd";
1
+ import { Form, Row } from "antd";
2
2
  import type { HFormProps, HItemProps } from "./modal";
3
3
  import Item from "./FormItem";
4
4
  import { useCurrentForm, useInfoReq, useValuesChange } from "./hooks";
@@ -72,12 +72,12 @@ export default ({
72
72
  {newConfigData.map((itemData: HItemProps, index) => {
73
73
  const { labelWidth: itemLabelWidth } = itemData;
74
74
  return (
75
- <Item
76
- {...itemData}
77
- key={index}
78
- itemSpan={itemSpan}
79
- labelWidth={itemLabelWidth || labelWidth}
80
- />
75
+ <Item
76
+ {...itemData}
77
+ key={index}
78
+ itemSpan={itemSpan}
79
+ labelWidth={itemLabelWidth || labelWidth}
80
+ />
81
81
  );
82
82
  })}
83
83
  </Row>
@@ -32,7 +32,7 @@ import type {
32
32
  } from "../modal";
33
33
  import type { ForwardedRef } from "react";
34
34
  import type { DataFnProvider } from "../modal";
35
- import {ColProps} from "antd/lib/grid/col";
35
+ import type { ColProps } from "antd/lib/grid/col";
36
36
 
37
37
  type RenderFun = (
38
38
  props: HItemProps,
@@ -87,7 +87,7 @@ export interface HItemProps extends Omit<FormItemProps, "name"> {
87
87
  // formatKeys?: string[];
88
88
  name?: string;
89
89
  dispatch?: DispatchModal;
90
- itemSpan?:ColProps
90
+ itemSpan?: ColProps;
91
91
  }
92
92
 
93
93
  export interface HFormProps<T = any, R = any>
@@ -100,13 +100,13 @@ export interface HFormProps<T = any, R = any>
100
100
  form?: HFormInstance;
101
101
  params?: any;
102
102
  onFinish?: (values: T, params?: any) => void;
103
- itemSpan?:ColProps
103
+ itemSpan?: ColProps;
104
104
  }
105
105
  export interface HFormItemProps extends HItemProps {
106
106
  required?: boolean;
107
107
  value?: any;
108
108
  onChange?: (val: any, item: any) => void;
109
- itemSpan?:ColProps
109
+ itemSpan?: ColProps;
110
110
  }
111
111
  export type argsFn = (...args: any[]) => void;
112
112
  export interface FormContextProps {
@@ -169,7 +169,7 @@ export default () => {
169
169
  initialValues={{
170
170
  name: "fff",
171
171
  }}
172
- itemSpan={{span:12}}
172
+ itemSpan={{ span: 12 }}
173
173
  onFinish={(value) => {
174
174
  console.log(value);
175
175
  }}