@hw-component/form 1.9.85 → 1.9.86

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.
Files changed (34) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogForm/hooks.d.ts +1 -1
  3. package/es/Form/hooks/useHForm.js +10 -0
  4. package/es/Form/modal.d.ts +1 -0
  5. package/lib/DialogForm/hooks.d.ts +1 -1
  6. package/lib/Form/hooks/useHForm.js +10 -0
  7. package/lib/Form/modal.d.ts +1 -0
  8. package/package.json +1 -1
  9. package/src/components/Btn.tsx +36 -36
  10. package/src/components/CheckboxGroup/index.tsx +4 -3
  11. package/src/components/DialogForm/DrawerForm/index.tsx +13 -13
  12. package/src/components/DialogForm/ModalForm.tsx +16 -16
  13. package/src/components/DialogForm/hooks.tsx +3 -3
  14. package/src/components/DialogForm/modal.ts +8 -2
  15. package/src/components/Form/HFormConnect.tsx +8 -3
  16. package/src/components/Form/InitSet.tsx +4 -4
  17. package/src/components/Form/hooks/index.ts +1 -3
  18. package/src/components/Form/hooks/useAddFormat.tsx +34 -36
  19. package/src/components/Form/hooks/useHForm.ts +14 -2
  20. package/src/components/Form/modal.ts +3 -2
  21. package/src/components/RichEditor/hooks.ts +36 -34
  22. package/src/components/RichEditor/index.tsx +31 -23
  23. package/src/components/RichEditor/modal.ts +2 -2
  24. package/src/components/TDPicker/TimePicker.tsx +1 -1
  25. package/src/components/TDPicker/hooks.ts +1 -1
  26. package/src/components/TextArea/index.tsx +2 -2
  27. package/src/components/Upload/Btn.tsx +13 -9
  28. package/src/components/Upload/hooks/customRequest.ts +1 -1
  29. package/src/components/Upload/index.tsx +8 -8
  30. package/src/components/Upload/modal.ts +5 -4
  31. package/src/pages/DrawerForm/index.tsx +17 -15
  32. package/src/pages/Form/index.tsx +44 -44
  33. package/src/pages/ModalForm/index.tsx +12 -8
  34. package/src/pages/Upload/index.tsx +2 -2
@@ -2,7 +2,8 @@ import { BraftEditorProps, EditorState } from "braft-editor";
2
2
  import { PromiseFnResult } from "../modal";
3
3
  import { addFormatItemModal } from "../Form/modal";
4
4
 
5
- export interface IHRichEditorProps extends Omit<BraftEditorProps, "value"|"onChange"> {
5
+ export interface IHRichEditorProps
6
+ extends Omit<BraftEditorProps, "value" | "onChange"> {
6
7
  value?: string | EditorState;
7
8
  onChange?: (value: string | EditorState) => void;
8
9
  fileRequest?: PromiseFnResult;
@@ -10,4 +11,3 @@ export interface IHRichEditorProps extends Omit<BraftEditorProps, "value"|"onCha
10
11
  bordered?: boolean;
11
12
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
12
13
  }
13
-
@@ -23,7 +23,7 @@ const Index = ({
23
23
  return !!disabledDate?.(currentDate, timeVal);
24
24
  }}
25
25
  style={{
26
- width:"100%"
26
+ width: "100%",
27
27
  }}
28
28
  {...props}
29
29
  />
@@ -88,7 +88,7 @@ export const useTimePickerValue = ({
88
88
  format,
89
89
  }: UseTimePickerValParams) => {
90
90
  return useMemo(() => {
91
- const valStr=value?.toString()
91
+ const valStr = value?.toString();
92
92
  if (!valStr || !format) {
93
93
  return value;
94
94
  }
@@ -9,7 +9,7 @@ export default ({
9
9
  autoSize = { minRows: 4, maxRows: 4 },
10
10
  bordered = true,
11
11
  className,
12
- style={},
12
+ style = {},
13
13
  ...props
14
14
  }: HTextAreaProps) => {
15
15
  const noBorderClassName = useClassName("hw-text-area-no-border");
@@ -17,7 +17,7 @@ export default ({
17
17
  return (
18
18
  <Input.TextArea
19
19
  autoSize={autoSize}
20
- style={{width:"100%",...style}}
20
+ style={{ width: "100%", ...style }}
21
21
  {...props}
22
22
  className={`${borderClassName} ${className}`}
23
23
  />
@@ -3,7 +3,7 @@ import type { IUpLoadProps } from "./modal";
3
3
  import React, { useMemo } from "react";
4
4
  import { Button } from "antd";
5
5
 
6
- export default ({ value, maxCount = 1, listType ,children}: IUpLoadProps) => {
6
+ export default ({ value, maxCount = 1, listType, children }: IUpLoadProps) => {
7
7
  const len = value?.length || 0;
8
8
  const text = useMemo(() => {
9
9
  if (len === maxCount) {
@@ -19,13 +19,17 @@ export default ({ value, maxCount = 1, listType ,children}: IUpLoadProps) => {
19
19
  </div>
20
20
  );
21
21
  }
22
- const loading=useMemo(()=>{
23
- return value?.some(({status})=>{
24
- return status==="uploading";
25
- })
26
- },[value]);
27
- if (children){
28
- return React.cloneElement<any>((children as any),{loading});
22
+ const loading = useMemo(() => {
23
+ return value?.some(({ status }) => {
24
+ return status === "uploading";
25
+ });
26
+ }, [value]);
27
+ if (children) {
28
+ return React.cloneElement<any>(children as any, { loading });
29
29
  }
30
- return <Button icon={<UploadOutlined />} loading={loading}>{text}</Button>;
30
+ return (
31
+ <Button icon={<UploadOutlined />} loading={loading}>
32
+ {text}
33
+ </Button>
34
+ );
31
35
  };
@@ -4,7 +4,7 @@ import type { RcFile } from "antd/lib/upload";
4
4
  import { useEffect, useMemo } from "react";
5
5
  import type { UploadFileStatus } from "antd/es/upload/interface";
6
6
  import { message } from "antd";
7
- import {useRequest} from "ahooks";
7
+ import { useRequest } from "ahooks";
8
8
 
9
9
  interface SubReqParamsModal {
10
10
  request?: IUpLoadProps["request"];
@@ -22,7 +22,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
22
22
  addFormat,
23
23
  thumbUrl,
24
24
  hideAddBtn,
25
- children,
25
+ children,
26
26
  ...props
27
27
  },
28
28
  ref
@@ -49,9 +49,9 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
49
49
  }, [maxRowNum, listType]);
50
50
 
51
51
  const preview = (file) => {
52
- if (onPreview===null){
53
- return;
54
- }
52
+ if (onPreview === null) {
53
+ return;
54
+ }
55
55
  if (onPreview) {
56
56
  onPreview(file);
57
57
  return;
@@ -101,7 +101,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
101
101
  },
102
102
  });
103
103
  const relVal = Array.isArray(value) ? value : [];
104
- const upListType=listType===null?undefined:listType;
104
+ const upListType = listType === null ? undefined : listType;
105
105
  return (
106
106
  <div style={contentStyle}>
107
107
  <Upload
@@ -116,9 +116,9 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
116
116
  {...props}
117
117
  >
118
118
  {hideAddBtn ? null : (
119
- <Btn value={relVal} maxCount={maxCount} listType={upListType} >
120
- {children}
121
- </Btn>
119
+ <Btn value={relVal} maxCount={maxCount} listType={upListType}>
120
+ {children}
121
+ </Btn>
122
122
  )}
123
123
  </Upload>
124
124
  <Preview
@@ -5,9 +5,10 @@ import type { UploadChangeParam } from "antd/lib/upload/interface";
5
5
  import type { MediaTypeEnum } from "@/components/Upload/enums";
6
6
  import type { addFormatItemModal } from "@/components/Form/modal";
7
7
  import type React from "react";
8
- import {UploadListType} from "antd/lib/upload/interface";
8
+ import { UploadListType } from "antd/lib/upload/interface";
9
9
 
10
- export interface IUpLoadProps extends Omit<UploadProps, "onChange"|"listType"|"onPreview"> {
10
+ export interface IUpLoadProps
11
+ extends Omit<UploadProps, "onChange" | "listType" | "onPreview"> {
11
12
  exFiles?: string[] | null;
12
13
  request?: (
13
14
  file: Exclude<BeforeUploadFileType, File | boolean> | RcFile
@@ -20,8 +21,8 @@ export interface IUpLoadProps extends Omit<UploadProps, "onChange"|"listType"|"o
20
21
  addFormat?: (config: Record<string, addFormatItemModal>) => void;
21
22
  thumbUrl?: string;
22
23
  hideAddBtn?: boolean;
23
- listType?:UploadListType|null;
24
- onPreview?:UploadProps["onPreview"]|null
24
+ listType?: UploadListType | null;
25
+ onPreview?: UploadProps["onPreview"] | null;
25
26
  }
26
27
  export interface IMediaTypeEleProps {
27
28
  file?: UploadFile;
@@ -13,17 +13,19 @@ const data = [
13
13
  return <Test />;
14
14
  },
15
15
  },
16
- {
17
- type:'select',
18
- label:"下啦",
19
- name:"select",
20
- itemProps:{
21
- options:[{
22
- value:"123",
23
- key:1
24
- }]
25
- }
16
+ {
17
+ type: "select",
18
+ label: "下啦",
19
+ name: "select",
20
+ itemProps: {
21
+ options: [
22
+ {
23
+ value: "123",
24
+ key: 1,
25
+ },
26
+ ],
26
27
  },
28
+ },
27
29
  ];
28
30
  let num = 0;
29
31
  const Test1 = ({ formNode, dialogForm, params }) => {
@@ -65,11 +67,11 @@ export default () => {
65
67
  </Button>
66
68
  <Button
67
69
  onClick={() => {
68
- modalForm.show({
69
- initialValues:{
70
- "input":"12312"
71
- }
72
- });
70
+ modalForm.show({
71
+ initialValues: {
72
+ input: "12312",
73
+ },
74
+ });
73
75
  }}
74
76
  >
75
77
  打开
@@ -75,34 +75,34 @@ export default () => {
75
75
  <div style={{ width: 1000 }}>
76
76
  <HForm
77
77
  configData={[
78
- {
79
- label:"文字",
80
- name:"wz"
81
- },
82
- {
83
- label:"文字1",
84
- name:"wz1"
85
- },
86
- {
87
- label: "inputSelect",
88
- type: "richEditor",
89
- name: "richEditor",
90
- rules: [
91
- {
92
- validator: (rule, value, callback) => {
93
- console.log(value);
94
- return Promise.resolve();
95
- },
96
- },
97
- ],
98
- },
78
+ {
79
+ label: "文字",
80
+ name: "wz",
81
+ },
82
+ {
83
+ label: "文字1",
84
+ name: "wz1",
85
+ },
86
+ {
87
+ label: "inputSelect",
88
+ type: "richEditor",
89
+ name: "richEditor",
90
+ rules: [
91
+ {
92
+ validator: (rule, value, callback) => {
93
+ console.log(value);
94
+ return Promise.resolve();
95
+ },
96
+ },
97
+ ],
98
+ },
99
99
  {
100
100
  label: "富文本",
101
101
  type: "timePicker",
102
102
  name: "textArea",
103
- itemProps:{
104
- showCount:true,
105
- maxLength:100
103
+ itemProps: {
104
+ showCount: true,
105
+ maxLength: 100,
106
106
  },
107
107
  rules: [
108
108
  {
@@ -191,10 +191,10 @@ export default () => {
191
191
  label: "文字",
192
192
  type: "text",
193
193
  name: "text",
194
- render:()=>{
195
- return <div>fff</div>
196
- },
197
- itemProps: {
194
+ render: () => {
195
+ return <div>fff</div>;
196
+ },
197
+ itemProps: {
198
198
  type: "danger",
199
199
  addonBefore: (
200
200
  <div style={{ height: 100, backgroundColor: "red" }}>
@@ -206,12 +206,12 @@ export default () => {
206
206
  wohao
207
207
  </div>
208
208
  ),
209
- initValueProvider:(...data)=>{
210
- console.log("initValueProvider")
211
- return {
212
- text:"你好"
213
- }
214
- },
209
+ initValueProvider: (...data) => {
210
+ console.log("initValueProvider");
211
+ return {
212
+ text: "你好",
213
+ };
214
+ },
215
215
  },
216
216
  },
217
217
  ]}
@@ -219,7 +219,7 @@ export default () => {
219
219
  labelWidth={88}
220
220
  form={form}
221
221
  initialValues={{
222
- richEditor:"1312312"
222
+ richEditor: "1312312",
223
223
  }}
224
224
  labelAlign={"left"}
225
225
  onFinish={(value) => {
@@ -246,15 +246,15 @@ export default () => {
246
246
  >
247
247
  点我
248
248
  </div>
249
- <div
250
- onClick={() => {
251
- form.setFieldsValue({
252
- wz:"你好"
253
- })
254
- }}
255
- >
256
- 设置
257
- </div>
249
+ <div
250
+ onClick={() => {
251
+ form.setFieldsValue({
252
+ wz: "你好",
253
+ });
254
+ }}
255
+ >
256
+ 设置
257
+ </div>
258
258
  <div
259
259
  onClick={() => {
260
260
  form.submit();
@@ -1,4 +1,4 @@
1
- import {Button, Input} from "antd";
1
+ import { Button, Input } from "antd";
2
2
  import {
3
3
  HModalForm,
4
4
  useHDialogForm,
@@ -11,12 +11,16 @@ import { ShowParamsModal } from "@/components/DialogForm/modal";
11
11
  const Test = (props) => {
12
12
  return <HUrlUpload {...props} />;
13
13
  };
14
- const ITest=()=>{
15
- return <Input onPressEnter={(e)=>{
14
+ const ITest = () => {
15
+ return (
16
+ <Input
17
+ onPressEnter={(e) => {
16
18
  e.preventDefault();
17
- console.log("ITest")
18
- }}/>
19
- }
19
+ console.log("ITest");
20
+ }}
21
+ />
22
+ );
23
+ };
20
24
  const data = [
21
25
  {
22
26
  label: "输入框",
@@ -207,12 +211,12 @@ export default () => {
207
211
  destroyOnClose={false}
208
212
  autoClear={false}
209
213
  onOk={() => {
210
- console.log("fff")
214
+ console.log("fff");
211
215
  return false;
212
216
  }}
213
217
  labelAlign={"left"}
214
218
  request={(values, params) => {
215
- console.log(values,params)
219
+ console.log(values, params);
216
220
  return Promise.resolve();
217
221
  }}
218
222
  dialogForm={modalForm}
@@ -1,4 +1,4 @@
1
- import {Button, Space} from "antd";
1
+ import { Button, Space } from "antd";
2
2
  import { HUpload, HUrlUpload } from "../../components";
3
3
  import React, { useState } from "react";
4
4
  import { MediaTypeEnum } from "../../components/Upload/enums";
@@ -33,7 +33,7 @@ export default () => {
33
33
  }}
34
34
  onChange={setFiles1}
35
35
  >
36
- <Button>按钮</Button>
36
+ <Button>按钮</Button>
37
37
  </HUpload>
38
38
  <HUrlUpload
39
39
  inputHelper="测试"