@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
@@ -200,6 +200,16 @@ var useHForm = (function () {
200
200
  });
201
201
  form.setFieldsValue(_objectSpread(_objectSpread(_objectSpread({}, newVale), initSaveValue), values));
202
202
  },
203
+ resetFieldsValues: function resetFieldsValues() {
204
+ var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
205
+ var oldValue = form.getFieldsValue(true);
206
+ var keys = Object.keys(oldValue);
207
+ var newVale = {};
208
+ keys.forEach(function (key) {
209
+ newVale[key] = undefined;
210
+ });
211
+ form.setFieldsValue(_objectSpread(_objectSpread({}, newVale), values));
212
+ },
203
213
  clear: function clear() {
204
214
  form.resetFields();
205
215
  isLoading = false;
@@ -149,6 +149,7 @@ export interface HFormInstance extends FormInstance {
149
149
  reload: PromiseFnResult;
150
150
  clear: VoidFunction;
151
151
  resetFieldsInitValue: (values?: Record<string, any>) => void;
152
+ resetFieldsValues: (values?: Record<string, any>) => void;
152
153
  clearFormat: (name: string) => void;
153
154
  inited: boolean;
154
155
  resetFormStatus: VoidFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.85",
3
+ "version": "1.9.86",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,41 +4,41 @@ import React from "react";
4
4
  import { useRequest } from "ahooks";
5
5
 
6
6
  export interface BtnProps<R = any> extends ButtonProps {
7
- request?: () => Promise<any>;
8
- onSuccess?: (data: R) => void;
7
+ request?: () => Promise<any>;
8
+ onSuccess?: (data: R) => void;
9
9
  }
10
10
  export default ({
11
- loading,
12
- request,
13
- children,
14
- onClick,
15
- style,
16
- type,
17
- onSuccess,
18
- ...props
19
- }:BtnProps) => {
20
- const { run, loading: reqLoading } = useRequest(
21
- () => {
22
- return request?.();
23
- },
24
- { manual: true, onSuccess }
25
- );
26
- const click = (e) => {
27
- if (request) {
28
- run();
29
- return;
30
- }
31
- onClick?.(e);
32
- };
33
- return (
34
- <Button
35
- {...props}
36
- type={type}
37
- style={{ borderRadius: 4, ...style }}
38
- onClick={click}
39
- loading={loading || reqLoading}
40
- >
41
- {children}
42
- </Button>
43
- );
44
- };
11
+ loading,
12
+ request,
13
+ children,
14
+ onClick,
15
+ style,
16
+ type,
17
+ onSuccess,
18
+ ...props
19
+ }: BtnProps) => {
20
+ const { run, loading: reqLoading } = useRequest(
21
+ () => {
22
+ return request?.();
23
+ },
24
+ { manual: true, onSuccess }
25
+ );
26
+ const click = (e) => {
27
+ if (request) {
28
+ run();
29
+ return;
30
+ }
31
+ onClick?.(e);
32
+ };
33
+ return (
34
+ <Button
35
+ {...props}
36
+ type={type}
37
+ style={{ borderRadius: 4, ...style }}
38
+ onClick={click}
39
+ loading={loading || reqLoading}
40
+ >
41
+ {children}
42
+ </Button>
43
+ );
44
+ };
@@ -20,7 +20,7 @@ const Index = ({
20
20
  }: HCheckboxProps) => {
21
21
  const { valueCheckMap: resultValueCheckMap, fieldNames: resultFieldNames } =
22
22
  useMatchConfigProps({ fieldNames, valueCheckMap: valueMap }); //匹配全局
23
- const checkOptions:Record<string, any>[]|undefined = useChangeOptions({
23
+ const checkOptions: Record<string, any>[] | undefined = useChangeOptions({
24
24
  options,
25
25
  fieldNames: resultFieldNames,
26
26
  });
@@ -63,9 +63,10 @@ const Index = ({
63
63
  return (
64
64
  <Space direction={direction} wrap={wrap}>
65
65
  {checkOptions?.map((item) => {
66
- const { label, value: itemVal ,disabled:itemDisabled} = item;
66
+ const { label, value: itemVal, disabled: itemDisabled } = item;
67
67
  const checked = val[itemVal];
68
- const nDis=typeof itemDisabled==="undefined"?disabled:itemDisabled;
68
+ const nDis =
69
+ typeof itemDisabled === "undefined" ? disabled : itemDisabled;
69
70
  return (
70
71
  <Checkbox
71
72
  value={checked}
@@ -35,7 +35,7 @@ const Index: React.FC<DialogFormProps> = ({
35
35
  autoClear = true,
36
36
  contentRender,
37
37
  children,
38
- destroyOnClose=true,
38
+ destroyOnClose = true,
39
39
  ...props
40
40
  }: DialogFormProps) => {
41
41
  const currentForm = useCurrentForm(dialogForm);
@@ -67,29 +67,29 @@ const Index: React.FC<DialogFormProps> = ({
67
67
  setModalVisible(false);
68
68
  };
69
69
  const { loading, run } = useSub({ request, onFinish });
70
- const finish=async (values, subParams) => {
70
+ const finish = async (values, subParams) => {
71
71
  const result = await run(values, subParams);
72
72
  const close = onOk?.(result, subParams);
73
73
  if (close === false) {
74
74
  return;
75
75
  }
76
76
  cancel();
77
- }
78
- const footerOnOk=()=>{
79
- if (modalFormData){
77
+ };
78
+ const footerOnOk = () => {
79
+ if (modalFormData) {
80
80
  dialogForm?.submit();
81
81
  return;
82
82
  }
83
- finish({},formParams);
84
- }
83
+ finish({}, formParams);
84
+ };
85
85
  const defaultFooter = useFooterRender({
86
86
  dialogForm,
87
87
  footer,
88
88
  confirmLoading: loading,
89
89
  params: formParams,
90
- onOk :footerOnOk
90
+ onOk: footerOnOk,
91
91
  });
92
- const node = modalFormData&&(
92
+ const node = modalFormData && (
93
93
  <HForm
94
94
  configData={modalFormData}
95
95
  initialValues={initValue}
@@ -102,13 +102,13 @@ const Index: React.FC<DialogFormProps> = ({
102
102
  labelWidth={labelWidth}
103
103
  />
104
104
  );
105
- const selfAfterClose=()=>{
106
- if (autoClear){
105
+ const selfAfterClose = () => {
106
+ if (autoClear) {
107
107
  dialogForm?.clear();
108
108
  return;
109
109
  }
110
110
  dialogForm?.resetFormStatus();
111
- }
111
+ };
112
112
  return (
113
113
  <Drawer
114
114
  visible={modalVisible}
@@ -116,7 +116,7 @@ const Index: React.FC<DialogFormProps> = ({
116
116
  {...props}
117
117
  onClose={cancel}
118
118
  afterVisibleChange={(changeVisible) => {
119
- if (changeVisible){
119
+ if (changeVisible) {
120
120
  return;
121
121
  }
122
122
  selfAfterClose();
@@ -30,7 +30,7 @@ const Index: React.FC<DialogFormProps> = ({
30
30
  contentRender,
31
31
  footer,
32
32
  children,
33
- destroyOnClose=true,
33
+ destroyOnClose = true,
34
34
  ...props
35
35
  }) => {
36
36
  const currentForm = useCurrentForm(dialogForm);
@@ -52,7 +52,7 @@ const Index: React.FC<DialogFormProps> = ({
52
52
  params,
53
53
  title,
54
54
  onCancel,
55
- autoClear
55
+ autoClear,
56
56
  });
57
57
  const cancel = () => {
58
58
  saveOldParams();
@@ -62,22 +62,22 @@ const Index: React.FC<DialogFormProps> = ({
62
62
  setModalVisible(false);
63
63
  };
64
64
  const { loading, run } = useSub({ request, onFinish });
65
- const finish=async (values, outParams)=>{
65
+ const finish = async (values, outParams) => {
66
66
  const result = await run(values, outParams);
67
67
  const close = onOk?.(result, outParams);
68
68
  if (close === false) {
69
69
  return;
70
70
  }
71
71
  cancel();
72
- }
73
- const footerOnOk=()=>{
74
- if (modalFormData){
75
- dialogForm?.submit();
76
- return;
77
- }
78
- finish({},formParams);
79
- }
80
- const node = modalFormData&&(
72
+ };
73
+ const footerOnOk = () => {
74
+ if (modalFormData) {
75
+ dialogForm?.submit();
76
+ return;
77
+ }
78
+ finish({}, formParams);
79
+ };
80
+ const node = modalFormData && (
81
81
  <HForm
82
82
  configData={modalFormData}
83
83
  initialValues={initValue}
@@ -94,15 +94,15 @@ const Index: React.FC<DialogFormProps> = ({
94
94
  footer,
95
95
  confirmLoading: loading,
96
96
  params: formParams,
97
- onOk:footerOnOk
97
+ onOk: footerOnOk,
98
98
  });
99
- const selfAfterClose=()=>{
100
- if (autoClear){
99
+ const selfAfterClose = () => {
100
+ if (autoClear) {
101
101
  dialogForm?.clear();
102
102
  return;
103
103
  }
104
104
  dialogForm?.resetFormStatus();
105
- }
105
+ };
106
106
  return (
107
107
  <Modal
108
108
  title={modalTitle}
@@ -119,8 +119,8 @@ export const useSub = ({ request, onFinish }: Partial<DialogFormProps>) => {
119
119
  { manual: true }
120
120
  );
121
121
  };
122
- interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData">{
123
- onOk:VoidFunction;
122
+ interface FooterRenderParamsModal extends Omit<DialogFormProps, "configData"> {
123
+ onOk: VoidFunction;
124
124
  }
125
125
 
126
126
  export const useFooterRender = ({
@@ -128,7 +128,7 @@ export const useFooterRender = ({
128
128
  confirmLoading,
129
129
  dialogForm,
130
130
  params,
131
- onOk
131
+ onOk,
132
132
  }: FooterRenderParamsModal) => {
133
133
  if (footer === null) {
134
134
  return null;
@@ -38,10 +38,16 @@ export type FooterRender = (
38
38
  export interface DialogFormProps<P = any, T = any>
39
39
  extends Omit<
40
40
  RootProps,
41
- "onFinish" | "onCancel" | "onOk" | "infoRequest" | "title" | "footer"|"configData"
41
+ | "onFinish"
42
+ | "onCancel"
43
+ | "onOk"
44
+ | "infoRequest"
45
+ | "title"
46
+ | "footer"
47
+ | "configData"
42
48
  > {
43
49
  dialogForm?: HDialogFormInstance;
44
- configData?:HFormProps["configData"];
50
+ configData?: HFormProps["configData"];
45
51
  onFinish?: (values: T, params: P) => Promise<any>;
46
52
  onCancel?: VoidFunction;
47
53
  onOk?: (data: T, params: P) => boolean | void;
@@ -1,13 +1,18 @@
1
1
  import { useFormContext } from "./Context";
2
2
  import React from "react";
3
- import type { addFormatItemModal ,HFormItemProps,ConnectResultProps,argsFn} from "./modal";
4
- import {formatMaker} from "./hooks/useAddFormat";
3
+ import type {
4
+ addFormatItemModal,
5
+ HFormItemProps,
6
+ ConnectResultProps,
7
+ argsFn,
8
+ } from "./modal";
9
+ import { formatMaker } from "./hooks/useAddFormat";
5
10
 
6
11
  export default (
7
12
  component:
8
13
  | React.FunctionComponent
9
14
  | React.ComponentClass
10
- | React.ForwardRefRenderFunction<any, any>,
15
+ | React.ForwardRefRenderFunction<any, any>
11
16
  ) => {
12
17
  const Index: React.ForwardRefRenderFunction<any, HFormItemProps> = (
13
18
  props: HFormItemProps,
@@ -5,10 +5,10 @@ export default () => {
5
5
  const { form } = useFormContext();
6
6
  useEffect(() => {
7
7
  form.initValues();
8
- form.inited=true;
9
- return ()=>{
10
- form.inited=false;
11
- }
8
+ form.inited = true;
9
+ return () => {
10
+ form.inited = false;
11
+ };
12
12
  }, []);
13
13
  return <></>;
14
14
  };
@@ -129,6 +129,4 @@ export const useValuesChange = ({
129
129
  };
130
130
  };
131
131
 
132
- export const useAddFormat=()=>{
133
-
134
- }
132
+ export const useAddFormat = () => {};
@@ -1,44 +1,42 @@
1
- import {addFormatItemModal, HFormItemProps} from "../modal";
2
- import {useFormContext} from "@/components/Form/Context";
3
- import {useEffect} from "react";
1
+ import { addFormatItemModal, HFormItemProps } from "../modal";
2
+ import { useFormContext } from "@/components/Form/Context";
3
+ import { useEffect } from "react";
4
4
 
5
5
  interface ResultModal {
6
- inputValue?: (value: Record<string, any>) => Record<string, any>;
7
- outputValue?: (value: Record<string, any>) => Record<string, any>;
6
+ inputValue?: (value: Record<string, any>) => Record<string, any>;
7
+ outputValue?: (value: Record<string, any>) => Record<string, any>;
8
8
  }
9
9
 
10
10
  export const formatMaker = (
11
- itemProps: HFormItemProps,
12
- formats?: addFormatItemModal
11
+ itemProps: HFormItemProps,
12
+ formats?: addFormatItemModal
13
13
  ) => {
14
- const { inputValue, outputValue } = formats || {};
15
- const { initValueProvider = inputValue, subProvider = outputValue } =
16
- itemProps;
17
- const resultObj: ResultModal = {};
18
- if (initValueProvider) {
19
- resultObj.inputValue = (value) => {
20
- return initValueProvider(itemProps, value);
21
- };
22
- }
23
- if (subProvider) {
24
- resultObj.outputValue = (value) => {
25
- return subProvider(itemProps, value);
26
- };
27
- }
28
- const keysLen = Object.keys(resultObj).length;
29
- return keysLen === 0 ? undefined : resultObj;
14
+ const { inputValue, outputValue } = formats || {};
15
+ const { initValueProvider = inputValue, subProvider = outputValue } =
16
+ itemProps;
17
+ const resultObj: ResultModal = {};
18
+ if (initValueProvider) {
19
+ resultObj.inputValue = (value) => {
20
+ return initValueProvider(itemProps, value);
21
+ };
22
+ }
23
+ if (subProvider) {
24
+ resultObj.outputValue = (value) => {
25
+ return subProvider(itemProps, value);
26
+ };
27
+ }
28
+ const keysLen = Object.keys(resultObj).length;
29
+ return keysLen === 0 ? undefined : resultObj;
30
30
  };
31
31
 
32
-
33
-
34
- export default (props:HFormItemProps)=>{
35
- const {name,itemProps}=props;
36
- const { form, valueType = "float" } = useFormContext();
37
- const relName = Array.isArray(name) ? name.join(".") : name;
38
- useEffect(() => {
39
- if (!relName||!itemProps) {
40
- return;
41
- }
42
- form?.addFormat(relName, formatMaker((itemProps as HFormItemProps)));
43
- }, [valueType, props]);
44
- }
32
+ export default (props: HFormItemProps) => {
33
+ const { name, itemProps } = props;
34
+ const { form, valueType = "float" } = useFormContext();
35
+ const relName = Array.isArray(name) ? name.join(".") : name;
36
+ useEffect(() => {
37
+ if (!relName || !itemProps) {
38
+ return;
39
+ }
40
+ form?.addFormat(relName, formatMaker(itemProps as HFormItemProps));
41
+ }, [valueType, props]);
42
+ };
@@ -186,14 +186,26 @@ export default () => {
186
186
  ...values,
187
187
  });
188
188
  },
189
+ resetFieldsValues: (values = {}) => {
190
+ const oldValue = form.getFieldsValue(true);
191
+ const keys = Object.keys(oldValue);
192
+ const newVale = {};
193
+ keys.forEach((key) => {
194
+ newVale[key] = undefined;
195
+ });
196
+ form.setFieldsValue({
197
+ ...newVale,
198
+ ...values,
199
+ });
200
+ },
189
201
  clear: () => {
190
202
  form.resetFields();
191
203
  isLoading = false;
192
204
  },
193
- resetFormStatus:()=>{
205
+ resetFormStatus: () => {
194
206
  isLoading = false;
195
207
  },
196
- inited:false
208
+ inited: false,
197
209
  };
198
210
  }, []);
199
211
  };
@@ -208,9 +208,10 @@ export interface HFormInstance extends FormInstance {
208
208
  reload: PromiseFnResult;
209
209
  clear: VoidFunction;
210
210
  resetFieldsInitValue: (values?: Record<string, any>) => void;
211
+ resetFieldsValues: (values?: Record<string, any>) => void;
211
212
  clearFormat: (name: string) => void;
212
- inited:boolean;
213
- resetFormStatus:VoidFunction
213
+ inited: boolean;
214
+ resetFormStatus: VoidFunction;
214
215
  }
215
216
 
216
217
  export interface ConnectConfigModal {
@@ -3,7 +3,7 @@ import { baseConfig } from "../config";
3
3
  import { IHRichEditorProps } from "src/components/RichEditor/modal";
4
4
  import { useClassName } from "../hooks";
5
5
  import { useEffect, useMemo, useRef, useState } from "react";
6
- import BraftEditor, {EditorState} from "braft-editor";
6
+ import BraftEditor, { EditorState } from "braft-editor";
7
7
 
8
8
  export const useProps = ({ fileRequest, valueType }: IHRichEditorProps) => {
9
9
  const {
@@ -46,38 +46,40 @@ export const useFocusClassname = ({
46
46
  };
47
47
  };
48
48
 
49
- export const useVC=({value,onChange,valueType}:IHRichEditorProps)=>{
50
- const richValue: EditorState | undefined = valueType === "html" ? BraftEditor.createEditorState(value) : (value as EditorState);
51
- const change = (editorState) => {
52
- const changeVal = valueType === "html" ? editorState.toHTML() : editorState;
53
- const isEmpty = !!richValue ? richValue.isEmpty() : true;
54
- if (isEmpty && editorState.isEmpty()) {
55
- return;
56
- }
57
- onChange?.(changeVal);
58
- };
59
- return {
60
- richValue,
61
- change
49
+ export const useVC = ({ value, onChange, valueType }: IHRichEditorProps) => {
50
+ const richValue: EditorState | undefined =
51
+ valueType === "html"
52
+ ? BraftEditor.createEditorState(value)
53
+ : (value as EditorState);
54
+ const change = (editorState) => {
55
+ const changeVal = valueType === "html" ? editorState.toHTML() : editorState;
56
+ const isEmpty = !!richValue ? richValue.isEmpty() : true;
57
+ if (isEmpty && editorState.isEmpty()) {
58
+ return;
62
59
  }
63
- }
64
-
60
+ onChange?.(changeVal);
61
+ };
62
+ return {
63
+ richValue,
64
+ change,
65
+ };
66
+ };
65
67
 
66
- export const useUploadFn=({fileRequest}:IHRichEditorProps)=>{
67
- return async (params)=>{
68
- const { file, id } = params;
69
- const { url } = await fileRequest?.(file, params);
70
- params.success({
71
- url,
72
- meta: {
73
- id,
74
- title: file.name,
75
- alt: "媒体资源",
76
- loop: false,
77
- autoPlay: false,
78
- controls: true,
79
- poster: url,
80
- },
81
- });
82
- }
83
- }
68
+ export const useUploadFn = ({ fileRequest }: IHRichEditorProps) => {
69
+ return async (params) => {
70
+ const { file, id } = params;
71
+ const { url } = await fileRequest?.(file, params);
72
+ params.success({
73
+ url,
74
+ meta: {
75
+ id,
76
+ title: file.name,
77
+ alt: "媒体资源",
78
+ loop: false,
79
+ autoPlay: false,
80
+ controls: true,
81
+ poster: url,
82
+ },
83
+ });
84
+ };
85
+ };
@@ -1,7 +1,7 @@
1
1
  import BraftEditor, { EditorState } from "braft-editor";
2
2
  import "braft-editor/dist/index.css";
3
3
  import { IHRichEditorProps } from "./modal";
4
- import {useFocusClassname, useProps, useUploadFn, useVC} from "./hooks";
4
+ import { useFocusClassname, useProps, useUploadFn, useVC } from "./hooks";
5
5
  import { useClassName } from "../hooks";
6
6
  import React from "react";
7
7
  import HFormConnect from "../Form/HFormConnect";
@@ -19,8 +19,8 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
19
19
  media,
20
20
  contentStyle = defaultContentStyle,
21
21
  bordered = true,
22
- onBlur,
23
- onFocus,
22
+ onBlur,
23
+ onFocus,
24
24
  addFormat,
25
25
  ...props
26
26
  },
@@ -30,37 +30,45 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
30
30
  fileRequest,
31
31
  valueType,
32
32
  });
33
- const { focusClassname, onFocus:selfFocus, onBlur:selfBlur } = useFocusClassname({
33
+ const {
34
+ focusClassname,
35
+ onFocus: selfFocus,
36
+ onBlur: selfBlur,
37
+ } = useFocusClassname({
34
38
  bordered,
35
39
  onBlur,
36
- onFocus
40
+ onFocus,
37
41
  });
38
- const {richValue,change}=useVC({value,onChange,valueType:vType});
39
- const uploadFn = useUploadFn({fileRequest:fileReq});
42
+ const { richValue, change } = useVC({ value, onChange, valueType: vType });
43
+ const uploadFn = useUploadFn({ fileRequest: fileReq });
40
44
  const bodyClassName = useClassName("hw-rich-editor");
41
45
  const borderClassName = useClassName("hw-rich-editor-border");
42
46
  addFormat?.({
43
- float:{
44
- inputValue:(item, initValue)=>{
47
+ float: {
48
+ inputValue: (item, initValue) => {
45
49
  const { name = "" } = item;
46
- const keyName=(name as string);
47
- const itemVal=initValue[keyName];
48
- const initVal=typeof itemVal==="string"?BraftEditor.createEditorState(itemVal):itemVal;
50
+ const keyName = name as string;
51
+ const itemVal = initValue[keyName];
52
+ const initVal =
53
+ typeof itemVal === "string"
54
+ ? BraftEditor.createEditorState(itemVal)
55
+ : itemVal;
49
56
  return {
50
- [keyName]:initVal
57
+ [keyName]: initVal,
51
58
  };
52
59
  },
53
- outputValue:(item, outputValue)=>{
60
+ outputValue: (item, outputValue) => {
54
61
  const { name = "" } = item;
55
- const keyName=(name as string);
56
- const itemVal=outputValue[keyName];
57
- const outputVal=typeof itemVal==="string"?itemVal:itemVal?.toHTML();
62
+ const keyName = name as string;
63
+ const itemVal = outputValue[keyName];
64
+ const outputVal =
65
+ typeof itemVal === "string" ? itemVal : itemVal?.toHTML();
58
66
  return {
59
- [keyName]:outputVal
60
- }
61
- }
62
- }
63
- })
67
+ [keyName]: outputVal,
68
+ };
69
+ },
70
+ },
71
+ });
64
72
  return (
65
73
  <div
66
74
  className={`${bodyClassName} ${
@@ -81,4 +89,4 @@ const Index: React.ForwardRefRenderFunction<any, IHRichEditorProps> = (
81
89
  );
82
90
  };
83
91
 
84
- export default HFormConnect((React.forwardRef(Index) as any));
92
+ export default HFormConnect(React.forwardRef(Index) as any);