@hw-component/form 1.6.8 → 1.6.9

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.
@@ -84,6 +84,9 @@ var Index = function Index(_ref) {
84
84
  if (footer === null) {
85
85
  return null;
86
86
  }
87
+ if (typeof footer === "function") {
88
+ return footer(dialogForm, loading, formParams);
89
+ }
87
90
  return footer || jsx(Footer, {
88
91
  onCancel: cancel,
89
92
  onOk: currentForm.submit,
@@ -22,6 +22,7 @@ var Item = (function (props) {
22
22
  _props$labelAlign = props.labelAlign,
23
23
  labelAlign = _props$labelAlign === void 0 ? formLabelAlign : _props$labelAlign;
24
24
  var Component = useFormItemDomControl(props);
25
+ console.log(formLabelWidth, "formLabelWidth");
25
26
  return jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
26
27
  labelAlign: labelAlign,
27
28
  labelWidth: labelWidth
@@ -87,6 +87,9 @@ var Index = function Index(_ref) {
87
87
  if (footer === null) {
88
88
  return null;
89
89
  }
90
+ if (typeof footer === "function") {
91
+ return footer(dialogForm, loading, formParams);
92
+ }
90
93
  return footer || jsxRuntime.jsx(Footer.default, {
91
94
  onCancel: cancel,
92
95
  onOk: currentForm.submit,
@@ -25,6 +25,7 @@ var Item = (function (props) {
25
25
  _props$labelAlign = props.labelAlign,
26
26
  labelAlign = _props$labelAlign === void 0 ? formLabelAlign : _props$labelAlign;
27
27
  var Component = hooks.useFormItemDomControl(props);
28
+ console.log(formLabelWidth, "formLabelWidth");
28
29
  return jsxRuntime.jsx(Component, _objectSpread(_objectSpread({}, props), {}, {
29
30
  labelAlign: labelAlign,
30
31
  labelWidth: labelWidth
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -66,6 +66,9 @@ const Index:React.FC<DialogFormProps>=({
66
66
  if (footer === null) {
67
67
  return null;
68
68
  }
69
+ if (typeof footer==="function"){
70
+ return footer(dialogForm,loading,formParams)
71
+ }
69
72
  return (
70
73
  footer || (
71
74
  <Footer
@@ -7,5 +7,6 @@ export default (props: HItemProps) => {
7
7
  const {labelWidth:formLabelWidth,labelAlign:formLabelAlign}=useFormContext();
8
8
  const {labelWidth=formLabelWidth,labelAlign=formLabelAlign}=props;
9
9
  const Component = useFormItemDomControl(props);
10
+ console.log(formLabelWidth,"formLabelWidth")
10
11
  return <Component {...props} labelAlign={labelAlign} labelWidth={labelWidth}/>;
11
12
  };
@@ -1,60 +1,18 @@
1
1
  import { Button } from "antd";
2
2
  import { HDrawerForm, useHDialogForm } from "../../components";
3
3
  import { MediaTypeEnum } from "../../components/Upload/enums";
4
+ import FormItem from '../../components/Form/FormItem'
4
5
  import {useEffect} from "react";
6
+ const Test=()=>{
7
+ return <FormItem name="123" label="你好"/>
8
+ }
5
9
  const data = [
6
10
  {
7
- label: "选择",
8
- name: "checkboxGroup",
9
- type: "radioGroup",
10
- rules: [{ required: true }],
11
- helper: "帮助我",
12
- options: [
13
- { label: "选择1", value: 0 },
14
- { label: "选择2", value: 1 },
15
- ],
16
- },
17
- {
18
- label: "选择",
19
- name: "select",
20
- type: "select",
21
- helper: "select",
22
- itemProps: {
23
- mode: "tags",
24
- options: [
25
- { label: "选择1", value: 0 },
26
- { label: "选择2", value: 1 },
27
- ],
28
- },
29
- },
30
- {
31
- label: "地址文件",
32
- name: "urlUpload",
33
- type: "urlUpload",
34
- rules: [{ required: true }],
35
- hide: (form) => {
36
- const check = form.getFieldValue("checkboxGroup");
37
- return check !== 0;
38
- },
39
- itemProps: {
40
- style: { width: 368 },
41
- placeholder: "粘贴图片地址鼠标移出输入框自动保存",
42
- maxSize: 1024 * 1024 * 10,
43
- thumbUrl:
44
- "http://gips3.baidu.com/it/u=3886271102,3123389489&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960",
45
- mediaType: MediaTypeEnum.video,
46
- },
47
- },
48
- {
49
- label: "验证码",
50
- type: "verificationCodeInput",
51
- name: "verificationCodeInput",
52
- itemProps: {
53
- request: () => {
54
- return Promise.resolve({ code: 200 });
55
- },
56
- },
57
- },
11
+ hideLabel:true,
12
+ render:()=>{
13
+ return <Test/>
14
+ }
15
+ }
58
16
  ];
59
17
  let num = 0;
60
18
  const Test1=({formNode,dialogForm,params})=>{
@@ -108,6 +66,9 @@ export default () => {
108
66
  labelWidth={88}
109
67
  labelAlign={"left"}
110
68
  dialogForm={modalForm}
69
+ footer={()=>{
70
+ return <div>ff</div>
71
+ }}
111
72
  request={(values)=>{
112
73
  console.log(values)
113
74
  }}