@hw-component/form 1.9.45 → 1.9.47

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 (83) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogForm/DrawerForm/Footer.js +5 -4
  3. package/es/DialogForm/DrawerForm/index.js +8 -16
  4. package/es/DialogForm/hooks.d.ts +5 -4
  5. package/es/DialogForm/hooks.js +13 -3
  6. package/es/DialogForm/modal.d.ts +1 -1
  7. package/es/Form/config.d.ts +1 -1
  8. package/es/Form/modal.d.ts +1 -1
  9. package/es/Input/ButtonInput.js +5 -5
  10. package/es/Input/SelectInput.js +1 -0
  11. package/es/PageHandler/ErrorComponent.js +3 -2
  12. package/es/Select/TreeSelect.d.ts +2 -2
  13. package/es/Select/components/NotFoundContent.js +3 -2
  14. package/es/Select/index.js +3 -2
  15. package/es/Submit/components.js +3 -3
  16. package/es/Switch/index.d.ts +1 -1
  17. package/es/Text/index.d.ts +1 -1
  18. package/es/index.css +8 -8
  19. package/es/index.d.ts +1 -1
  20. package/lib/DialogForm/DrawerForm/Footer.js +4 -3
  21. package/lib/DialogForm/DrawerForm/index.js +7 -15
  22. package/lib/DialogForm/hooks.d.ts +5 -4
  23. package/lib/DialogForm/hooks.js +13 -3
  24. package/lib/DialogForm/modal.d.ts +1 -1
  25. package/lib/Form/config.d.ts +1 -1
  26. package/lib/Form/modal.d.ts +1 -1
  27. package/lib/Input/ButtonInput.js +4 -4
  28. package/lib/Input/SelectInput.js +1 -0
  29. package/lib/PageHandler/ErrorComponent.js +2 -1
  30. package/lib/Select/TreeSelect.d.ts +2 -2
  31. package/lib/Select/components/NotFoundContent.js +2 -1
  32. package/lib/Select/index.js +3 -2
  33. package/lib/Submit/components.js +3 -3
  34. package/lib/Switch/index.d.ts +1 -1
  35. package/lib/Text/index.d.ts +1 -1
  36. package/lib/index.css +8 -8
  37. package/lib/index.d.ts +1 -1
  38. package/package.json +5 -3
  39. package/src/components/CheckboxGroup/index.tsx +3 -3
  40. package/src/components/DialogForm/DrawerForm/Footer.tsx +7 -5
  41. package/src/components/DialogForm/DrawerForm/index.tsx +10 -21
  42. package/src/components/DialogForm/ModalForm.tsx +2 -2
  43. package/src/components/DialogForm/{hooks.ts → hooks.tsx} +17 -4
  44. package/src/components/DialogForm/modal.ts +1 -1
  45. package/src/components/Form/Basic.tsx +2 -2
  46. package/src/components/Form/HFormConnect.tsx +3 -3
  47. package/src/components/Form/config.ts +1 -1
  48. package/src/components/Form/hooks/index.ts +9 -9
  49. package/src/components/Form/hooks/useInitConfigData.tsx +3 -3
  50. package/src/components/Form/index.tsx +0 -1
  51. package/src/components/Form/modal.ts +6 -6
  52. package/src/components/Input/ButtonInput.tsx +27 -25
  53. package/src/components/Input/InputNumberGroup.tsx +4 -4
  54. package/src/components/Input/SelectInput.tsx +3 -2
  55. package/src/components/Input/TrimInput.tsx +3 -3
  56. package/src/components/Input/index.less +1 -1
  57. package/src/components/Input/modal.ts +1 -1
  58. package/src/components/PageHandler/ErrorComponent.tsx +4 -3
  59. package/src/components/PageHandler/index.tsx +0 -1
  60. package/src/components/PageHandler/modal.ts +1 -1
  61. package/src/components/Select/TreeSelect.tsx +51 -35
  62. package/src/components/Select/components/NotFoundContent.tsx +4 -3
  63. package/src/components/Select/index.less +18 -18
  64. package/src/components/Select/index.tsx +84 -74
  65. package/src/components/Select/modal.ts +2 -2
  66. package/src/components/Submit/components.tsx +5 -5
  67. package/src/components/Switch/index.tsx +16 -13
  68. package/src/components/TDPicker/RangePicker.tsx +2 -2
  69. package/src/components/Text/index.tsx +5 -5
  70. package/src/components/TextArea/TrimTextArea.tsx +3 -3
  71. package/src/components/Upload/MediaTypeEle/TypeEle.tsx +7 -1
  72. package/src/components/Upload/UrlUpload/index.tsx +1 -1
  73. package/src/components/Upload/index.tsx +4 -4
  74. package/src/components/index.tsx +1 -1
  75. package/src/components/styles/index.less +2 -2
  76. package/src/index.less +1 -0
  77. package/src/index.tsx +1 -0
  78. package/src/pages/DrawerForm/index.tsx +0 -3
  79. package/src/pages/Form/index.tsx +146 -77
  80. package/src/pages/Input/index.tsx +1 -1
  81. package/src/pages/ModalForm/index.tsx +3 -4
  82. package/src/pages/Switch/index.tsx +11 -11
  83. package/src/pages/Upload/index.tsx +6 -2
@@ -1,50 +1,66 @@
1
1
  import { TreeSelect } from "antd";
2
- import { TreeSelectProps } from "antd/lib/tree-select";
3
- import { PromiseFnResult } from "../modal";
2
+ import type { TreeSelectProps } from "antd/lib/tree-select";
3
+ import type { PromiseFnResult } from "../modal";
4
4
  import { useRequest } from "ahooks";
5
5
  export interface HTreeSelectProps extends TreeSelectProps {
6
6
  request?: PromiseFnResult;
7
- onlyCheckChild?:boolean;
7
+ onlyCheckChild?: boolean;
8
8
  }
9
9
  interface OpMkParamsModal {
10
- options?:any[];
11
- onlyCheckChild?:boolean;
12
- fieldNames?:TreeSelectProps["fieldNames"]
10
+ options?: any[];
11
+ onlyCheckChild?: boolean;
12
+ fieldNames?: TreeSelectProps["fieldNames"];
13
13
  }
14
- const opMk=({options,onlyCheckChild=false,fieldNames}:OpMkParamsModal)=>{
15
- const {children="children"}=fieldNames||{}
16
- return options?.map((item)=>{
17
- const {[children]:child}=item;
18
- const len=child?.length;
19
- if (!len){
20
- return {
21
- ...item
22
- };
23
- }
24
- const newChild=opMk({options:child,onlyCheckChild,fieldNames});
25
- return {
26
- ...item,
27
- selectable:!onlyCheckChild,
28
- [children]:newChild
29
- }
30
- })
31
- }
32
- export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }: HTreeSelectProps) => {
14
+ const opMk = ({
15
+ options,
16
+ onlyCheckChild = false,
17
+ fieldNames,
18
+ }: OpMkParamsModal) => {
19
+ const { children = "children" } = fieldNames || {};
20
+ return options?.map((item) => {
21
+ const { [children]: child } = item;
22
+ const len = child?.length;
23
+ if (!len) {
24
+ return {
25
+ ...item,
26
+ };
27
+ }
28
+ const newChild = opMk({ options: child, onlyCheckChild, fieldNames });
29
+ return {
30
+ ...item,
31
+ selectable: !onlyCheckChild,
32
+ [children]: newChild,
33
+ };
34
+ });
35
+ };
36
+ export default ({
37
+ request,
38
+ onlyCheckChild,
39
+ multiple,
40
+ treeCheckable,
41
+ treeData,
42
+ fieldNames,
43
+ ...props
44
+ }: HTreeSelectProps) => {
33
45
  const { loading, data } = useRequest(async () => {
34
- let options=treeData;
46
+ let options = treeData;
35
47
  if (request) {
36
- options=await request({});
48
+ options = await request({});
37
49
  }
38
50
  return opMk({
39
51
  options,
40
- onlyCheckChild:onlyCheckChild,
41
- fieldNames
52
+ onlyCheckChild: onlyCheckChild,
53
+ fieldNames,
42
54
  });
43
55
  });
44
- return <TreeSelect treeData={data}
45
- loading={loading}
46
- fieldNames={fieldNames}
47
- treeCheckable={treeCheckable}
48
- multiple={multiple}
49
- {...props}/>;
56
+ return (
57
+ <TreeSelect
58
+ treeData={data}
59
+ loading={loading}
60
+ fieldNames={fieldNames}
61
+ treeCheckable={treeCheckable}
62
+ multiple={multiple}
63
+ {...props}
64
+ />
65
+ );
50
66
  };
@@ -1,5 +1,6 @@
1
- import { Empty, Row, Space, Typography, Button } from "antd";
1
+ import { Empty, Row, Space, Typography } from "antd";
2
2
  import { ExclamationCircleOutlined } from "@ant-design/icons";
3
+ import {HJBtn} from "@hw-component/hj";
3
4
  const { Text } = Typography;
4
5
  interface IProps {
5
6
  error?: Error;
@@ -14,9 +15,9 @@ export default ({ error, reload }: IProps) => {
14
15
  <ExclamationCircleOutlined size={24} />
15
16
  </Text>
16
17
  <Text type={"danger"}>{error.message}</Text>
17
- <Button type="primary" size={"small"} onClick={reload}>
18
+ <HJBtn type="primary" size={"small"} onClick={reload}>
18
19
  重新加载
19
- </Button>
20
+ </HJBtn>
20
21
  </Space>
21
22
  </Row>
22
23
  );
@@ -20,38 +20,38 @@
20
20
  }
21
21
  }
22
22
  }
23
- .@{ant-prefix}-hw-select-box{
23
+ .@{ant-prefix}-hw-select-box {
24
24
  display: flex;
25
25
  flex-direction: row;
26
26
 
27
- .@{ant-prefix}-hw-group-addon-before{
28
- border-bottom-left-radius: 2px;
27
+ .@{ant-prefix}-hw-group-addon-before {
28
+ border-right: 0;
29
29
  border-top-left-radius: 2px;
30
- border-right: 0px;
30
+ border-bottom-left-radius: 2px;
31
31
  }
32
- .@{ant-prefix}-select{
32
+ .@{ant-prefix}-select {
33
33
  flex: 1;
34
34
  }
35
- .@{ant-prefix}-hw-group-addon-after{
36
- border-bottom-right-radius: 2px;
35
+ .@{ant-prefix}-hw-group-addon-after {
36
+ border-left: 0;
37
37
  border-top-right-radius: 2px;
38
- border-left: 0px;
38
+ border-bottom-right-radius: 2px;
39
39
  }
40
40
  }
41
- .@{ant-prefix}-hw-select-box-addon-before{
42
- .@{ant-prefix}-select{
43
- .@{ant-prefix}-select-selector{
44
- border-bottom-left-radius: 0px !important;
45
- border-top-left-radius: 0px !important;
41
+ .@{ant-prefix}-hw-select-box-addon-before {
42
+ .@{ant-prefix}-select {
43
+ .@{ant-prefix}-select-selector {
44
+ border-top-left-radius: 0 !important;
45
+ border-bottom-left-radius: 0 !important;
46
46
  }
47
47
  }
48
48
  }
49
49
 
50
- .@{ant-prefix}-hw-select-box-addon-after{
51
- .@{ant-prefix}-select{
52
- .@{ant-prefix}-select-selector{
53
- border-bottom-right-radius: 0px !important;
54
- border-top-right-radius: 0px !important;
50
+ .@{ant-prefix}-hw-select-box-addon-after {
51
+ .@{ant-prefix}-select {
52
+ .@{ant-prefix}-select-selector {
53
+ border-top-right-radius: 0 !important;
54
+ border-bottom-right-radius: 0 !important;
55
55
  }
56
56
  }
57
57
  }
@@ -1,4 +1,4 @@
1
- import { Select} from "antd";
1
+ import { Select } from "antd";
2
2
  import React from "react";
3
3
  import { useFilterOption, useSelectReq } from "./hooks/norHooks";
4
4
  import { useValueChange } from "./hooks/changeHooks";
@@ -6,7 +6,7 @@ import type { HSelectProps } from "./modal";
6
6
  import { defaultModeConfig, defaultSelectConfig } from "./defaultConfig";
7
7
  import DropdownComponent from "./components/DropdownComponent";
8
8
  import AllSelect from "./components/AllSelect";
9
- import {useChangeOptions, useClassName, useMatchConfigProps} from "../hooks";
9
+ import { useChangeOptions, useClassName, useMatchConfigProps } from "../hooks";
10
10
  import HFormConnect from "../Form/HFormConnect";
11
11
  const { Option } = Select;
12
12
 
@@ -35,8 +35,9 @@ const Index: React.FC<HSelectProps> = ({
35
35
  dispatch,
36
36
  isList,
37
37
  onPopupScroll: propsOnPopupScroll,
38
- addonBefore,
39
- addonAfter,
38
+ addonBefore,
39
+ addonAfter,
40
+ className,
40
41
  ...props
41
42
  }) => {
42
43
  const { icon, render } = modeConfig?.[mode || ""] || {};
@@ -64,11 +65,11 @@ const Index: React.FC<HSelectProps> = ({
64
65
  }); //options
65
66
 
66
67
  const data = useChangeOptions({ options: resultData, fieldNames });
67
- const boxClassName=useClassName("hw-select-box");
68
- const addonBeforeClassName=useClassName("hw-group-addon-before");
69
- const addonBeforeBoxClassName=useClassName("hw-select-box-addon-before");
70
- const addonAfterClassName=useClassName("hw-group-addon-after");
71
- const addonAfterBoxClassName=useClassName("hw-select-box-addon-after");
68
+ const boxClassName = useClassName("hw-select-box");
69
+ const addonBeforeClassName = useClassName("hw-group-addon-before");
70
+ const addonBeforeBoxClassName = useClassName("hw-select-box-addon-before");
71
+ const addonAfterClassName = useClassName("hw-group-addon-after");
72
+ const addonAfterBoxClassName = useClassName("hw-select-box-addon-after");
72
73
  const addonClassname = useClassName(["hw-addon"]);
73
74
 
74
75
  const { val, change } = useValueChange({
@@ -82,73 +83,82 @@ const Index: React.FC<HSelectProps> = ({
82
83
  });
83
84
  addDispatchListener?.("reload", reload);
84
85
  return (
85
- <div className={`${boxClassName} ${addonBefore?addonBeforeBoxClassName:""} ${addonAfter?addonAfterBoxClassName:""}`} style={style}>
86
- {addonBefore&& <div className={`${addonClassname} ${addonBeforeClassName}`}>
86
+ <div
87
+ className={`${boxClassName} ${
88
+ addonBefore ? addonBeforeBoxClassName : ""
89
+ } ${addonAfter ? addonAfterBoxClassName : ""} ${className}`}
90
+ style={style}
91
+ >
92
+ {addonBefore && (
93
+ <div className={`${addonClassname} ${addonBeforeClassName}`}>
87
94
  {addonBefore}
88
- </div>}
89
- <Select
90
- mode={mode}
91
- loading={loading}
92
- value={val}
93
- style={{width:"100%"}}
94
- onSearch={onSearch}
95
- onChange={change}
96
- dropdownRender={(node) => {
97
- return (
98
- <DropdownComponent
99
- loading={loading}
100
- reload={run}
101
- error={error}
102
- options={data}
103
- >
104
- <AllSelect
105
- allSelect={allSelect}
106
- options={data}
107
- mode={mode}
108
- value={val}
109
- onChange={change}
110
- fieldNames={fieldNames}
111
- >
112
- {node}
113
- </AllSelect>
114
- </DropdownComponent> //全选
115
- );
116
- }}
117
- optionLabelProp={optionLabelProp}
118
- menuItemSelectedIcon={icon}
119
- optionFilterProp={optionFilterProp}
120
- filterOption={selfFilterOption}
121
- showSearch={mathShowSearch}
122
- labelInValue={true}
123
- onPopupScroll={propsOnPopupScroll || onPopupScroll}
124
- {...props}
125
- >
126
- {data?.map((item) => {
127
- const { value: optionValue, label, ...oItem } = item;
128
- const filterKey = filterProvider || "label";
129
- const result =
130
- typeof filterProvider === "function"
131
- ? filterProvider?.(item)
132
- : item[filterKey as string];
133
- const filter = { [optionFilterProp]: result };
134
- return (
135
- <Option
136
- {...oItem}
137
- value={optionValue}
138
- key={optionValue}
139
- label={label}
140
- mode={mode}
141
- {...filter}
142
- >
143
- {render ? render(item, val) : label}
144
- </Option>
145
- );
146
- })}
147
- </Select>
148
- {addonAfter&&<div className={`${addonClassname} ${addonAfterClassName}`}>
95
+ </div>
96
+ )}
97
+ <Select
98
+ mode={mode}
99
+ loading={loading}
100
+ value={val}
101
+ style={{ width: "100%" }}
102
+ onSearch={onSearch}
103
+ onChange={change}
104
+ dropdownRender={(node) => {
105
+ return (
106
+ <DropdownComponent
107
+ loading={loading}
108
+ reload={run}
109
+ error={error}
110
+ options={data}
111
+ >
112
+ <AllSelect
113
+ allSelect={allSelect}
114
+ options={data}
115
+ mode={mode}
116
+ value={val}
117
+ onChange={change}
118
+ fieldNames={fieldNames}
119
+ >
120
+ {node}
121
+ </AllSelect>
122
+ </DropdownComponent> //全选
123
+ );
124
+ }}
125
+ optionLabelProp={optionLabelProp}
126
+ menuItemSelectedIcon={icon}
127
+ optionFilterProp={optionFilterProp}
128
+ filterOption={selfFilterOption}
129
+ showSearch={mathShowSearch}
130
+ labelInValue={true}
131
+ onPopupScroll={propsOnPopupScroll || onPopupScroll}
132
+ {...props}
133
+ >
134
+ {data?.map((item) => {
135
+ const { value: optionValue, label, ...oItem } = item;
136
+ const filterKey = filterProvider || "label";
137
+ const result =
138
+ typeof filterProvider === "function"
139
+ ? filterProvider?.(item)
140
+ : item[filterKey as string];
141
+ const filter = { [optionFilterProp]: result };
142
+ return (
143
+ <Option
144
+ {...oItem}
145
+ value={optionValue}
146
+ key={optionValue}
147
+ label={label}
148
+ mode={mode}
149
+ {...filter}
150
+ >
151
+ {render ? render(item, val) : label}
152
+ </Option>
153
+ );
154
+ })}
155
+ </Select>
156
+ {addonAfter && (
157
+ <div className={`${addonClassname} ${addonAfterClassName}`}>
149
158
  {addonAfter}
150
- </div>}
151
- </div>
159
+ </div>
160
+ )}
161
+ </div>
152
162
  );
153
163
  };
154
164
  export default HFormConnect(Index);
@@ -39,8 +39,8 @@ export interface HSelectProps
39
39
  placeholder?: string;
40
40
  dispatch?: DispatchModal;
41
41
  isList?: boolean;
42
- addonBefore?:React.ReactNode;
43
- addonAfter?:React.ReactNode;
42
+ addonBefore?: React.ReactNode;
43
+ addonAfter?: React.ReactNode;
44
44
  }
45
45
  export interface FilterDataModal {
46
46
  value: any;
@@ -1,10 +1,10 @@
1
- import { Button } from "antd";
2
1
  import { useFormContext } from "../Form/Context";
3
2
  import React from "react";
4
3
  import type {
5
4
  ISubmitProps,
6
5
  SubmitBarExtraType,
7
6
  } from "@/components/Submit/index";
7
+ import {HJBtn} from "@hw-component/hj";
8
8
  interface ControlFooterProps extends ISubmitProps {
9
9
  action: SubmitBarExtraType;
10
10
  style?: React.CSSProperties;
@@ -15,7 +15,7 @@ function ResetBtn({
15
15
  ...props
16
16
  }: Omit<ControlFooterProps, "action">) {
17
17
  return (
18
- <Button
18
+ <HJBtn
19
19
  {...props}
20
20
  style={style}
21
21
  onClick={() => {
@@ -23,7 +23,7 @@ function ResetBtn({
23
23
  }}
24
24
  >
25
25
  重置
26
- </Button>
26
+ </HJBtn>
27
27
  );
28
28
  }
29
29
 
@@ -38,7 +38,7 @@ function SubBtn({
38
38
  const { loading: formSubLoading = loading } = useFormContext();
39
39
 
40
40
  return (
41
- <Button
41
+ <HJBtn
42
42
  {...props}
43
43
  type={type as any}
44
44
  onClick={form.submit}
@@ -46,7 +46,7 @@ function SubBtn({
46
46
  style={style}
47
47
  >
48
48
  {text}
49
- </Button>
49
+ </HJBtn>
50
50
  );
51
51
  }
52
52
 
@@ -5,8 +5,8 @@ import { useClassName, useMatchConfigProps } from "../hooks";
5
5
  import type { ValueSwitchMapModal } from "../modal";
6
6
  import type { addFormatItemModal } from "../Form/modal";
7
7
  import HFormConnect from "../Form/HFormConnect";
8
- import {PromiseFnResult} from "../modal";
9
- import {useRequest} from "ahooks";
8
+ import type { PromiseFnResult } from "../modal";
9
+ import { useRequest } from "ahooks";
10
10
 
11
11
  export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
12
12
  valueMap?: ValueSwitchMapModal;
@@ -14,7 +14,7 @@ export interface HSwitchProps extends Omit<SwitchProps, "onChange"> {
14
14
  onChange?: (val: any) => void;
15
15
  beforeText?: React.ReactNode;
16
16
  addFormat?: (format: Record<string, addFormatItemModal>) => void;
17
- request?:PromiseFnResult
17
+ request?: PromiseFnResult;
18
18
  }
19
19
  const Index: React.FC<HSwitchProps> = ({
20
20
  value,
@@ -26,7 +26,7 @@ const Index: React.FC<HSwitchProps> = ({
26
26
  beforeText,
27
27
  addFormat,
28
28
  style,
29
- request,
29
+ request,
30
30
  ...props
31
31
  }) => {
32
32
  const { valueSwitchMap = {} } = useMatchConfigProps({
@@ -35,17 +35,20 @@ const Index: React.FC<HSwitchProps> = ({
35
35
  const switchClassName = useClassName("hw-switch");
36
36
  const switchBefore = useClassName("hw-switch-before");
37
37
  const switchAfter = useClassName("hw-switch-after");
38
- const {run,loading}=useRequest(async (val)=>{
39
- await request?.(val);
40
- onChange?.(val);
41
- },{manual:true});
38
+ const { run, loading } = useRequest(
39
+ async (val) => {
40
+ await request?.(val);
41
+ onChange?.(val);
42
+ },
43
+ { manual: true }
44
+ );
42
45
  const swChecked = useMemo(() => {
43
46
  const { open } = valueSwitchMap;
44
47
  return value === open;
45
48
  }, [value]);
46
49
  const change = (checked) => {
47
- const subVal = checked?valueSwitchMap.open:valueSwitchMap.close;
48
- if (request){
50
+ const subVal = checked ? valueSwitchMap.open : valueSwitchMap.close;
51
+ if (request) {
49
52
  run(subVal);
50
53
  return;
51
54
  }
@@ -56,18 +59,18 @@ const Index: React.FC<HSwitchProps> = ({
56
59
  inputValue: (item, initValue) => {
57
60
  const { close } = valueSwitchMap;
58
61
  const { name: valueName = "" } = item;
59
- let val = initValue[(valueName as string)];
62
+ let val = initValue[valueName as string];
60
63
  if (typeof val === "undefined" || val === null) {
61
64
  val = close;
62
65
  }
63
66
  return {
64
- [(valueName as string)]: val,
67
+ [valueName as string]: val,
65
68
  };
66
69
  },
67
70
  outputValue: (item, outputValue) => {
68
71
  const { name = "" } = item;
69
72
  return {
70
- [(name as string)]: outputValue[(name as string)],
73
+ [name as string]: outputValue[name as string],
71
74
  };
72
75
  },
73
76
  },
@@ -62,12 +62,12 @@ const HRangePicker: React.FC<HRangePickerProps> = ({
62
62
  });
63
63
  const hasKeys = Object.keys(resultObj).length !== 0;
64
64
  return {
65
- [(valueName as string)]: hasKeys ? resultObj : null,
65
+ [valueName as string]: hasKeys ? resultObj : null,
66
66
  };
67
67
  },
68
68
  outputValue: (item, outputValue) => {
69
69
  const { name: valueName = "" } = item;
70
- const { [(valueName as string)]: itemVal = {} } = outputValue;
70
+ const { [valueName as string]: itemVal = {} } = outputValue;
71
71
  return {
72
72
  ...itemVal,
73
73
  };
@@ -1,6 +1,6 @@
1
- import {Typography} from "antd";
2
- import {HFormItemProps} from "../Form/modal";
1
+ import { Typography } from "antd";
2
+ import type { HFormItemProps } from "../Form/modal";
3
3
 
4
- export default ({value}:HFormItemProps)=>{
5
- return <Typography.Text>{value}</Typography.Text>
6
- }
4
+ export default ({ value }: HFormItemProps) => {
5
+ return <Typography.Text>{value}</Typography.Text>;
6
+ };
@@ -12,14 +12,14 @@ const Index = ({ addFormat, ...props }: TrimTextAreaProps) => {
12
12
  inputValue: (item, initValue) => {
13
13
  const { name: valueName = "" } = item;
14
14
  return {
15
- [(valueName as string)]: initValue[(valueName as string)],
15
+ [valueName as string]: initValue[valueName as string],
16
16
  };
17
17
  },
18
18
  outputValue: (item, outputValue) => {
19
19
  const { name = "" } = item;
20
- const { [(name as string)]: itemVal } = outputValue;
20
+ const { [name as string]: itemVal } = outputValue;
21
21
  return {
22
- [(name as string)]: itemVal?.trim(),
22
+ [name as string]: itemVal?.trim(),
23
23
  };
24
24
  },
25
25
  },
@@ -24,7 +24,13 @@ export default ({ mediaType, url, onReady, onError }: TypeEleProps) => {
24
24
 
25
25
  if (mediaType === MediaTypeEnum.audio) {
26
26
  return (
27
- <audio autoPlay controls style={{width:"100%"}} onPlay={onReady} onError={onError}>
27
+ <audio
28
+ autoPlay
29
+ controls
30
+ style={{ width: "100%" }}
31
+ onPlay={onReady}
32
+ onError={onError}
33
+ >
28
34
  <source src={url} />
29
35
  </audio>
30
36
  );
@@ -103,7 +103,7 @@ const Index = ({
103
103
  }}
104
104
  />
105
105
  {inputHelper && <Text type={"secondary"}>{inputHelper}</Text>}
106
- <Upload {...upProps} ref={ref} value={value} onChange={onChange}/>
106
+ <Upload {...upProps} ref={ref} value={value} onChange={onChange} />
107
107
  {load && (
108
108
  <div style={{ display: "none" }}>
109
109
  <TypeEle
@@ -63,7 +63,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
63
63
  float: {
64
64
  inputValue: (item, initValue) => {
65
65
  const { name = "" } = item;
66
- const initFileList = initValue[(name as string)] || [];
66
+ const initFileList = initValue[name as string] || [];
67
67
  const relInitFileList =
68
68
  typeof initFileList === "string" ? [initFileList] : initFileList;
69
69
  const fileList = relInitFileList.map((itemData, index) => {
@@ -81,17 +81,17 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
81
81
  return { ...itemData };
82
82
  });
83
83
  return {
84
- [(name as string)]: fileList,
84
+ [name as string]: fileList,
85
85
  };
86
86
  },
87
87
  outputValue: (item, outputValue) => {
88
88
  const { name: valueName = "" } = item;
89
- const { [(valueName as string)]: itemVal = [] } = outputValue;
89
+ const { [valueName as string]: itemVal = [] } = outputValue;
90
90
  const urls = itemVal.map((fileItem) => {
91
91
  return fileItem.response.url;
92
92
  });
93
93
  return {
94
- [(valueName as string)]: maxCount === 1 ? urls[0] : urls,
94
+ [valueName as string]: maxCount === 1 ? urls[0] : urls,
95
95
  };
96
96
  },
97
97
  },
@@ -3,7 +3,7 @@ import FormConfig from "./Form/config";
3
3
  import PageHandler from "./PageHandler";
4
4
  export { default as HForm } from "./Form";
5
5
  export { default as useHForm } from "./Form/hooks/useHForm";
6
- export { useHDialogForm } from "./DialogForm/hooks";
6
+ export { useHDialogForm } from "@/components/DialogForm/hooks";
7
7
  export { default as HFormConnect } from "./Form/HFormConnect";
8
8
  export { default as HFormConfigProvider } from "./Form/Context/FormConfigProvider";
9
9
  export { default as HBasicForm } from "./Form/Basic";
@@ -3,7 +3,7 @@
3
3
  @import "../Input/index.less";
4
4
  @import "../Switch/index.less";
5
5
 
6
- .@{ant-prefix}-hw-addon{
6
+ .@{ant-prefix}-hw-addon {
7
7
  display: flex !important;
8
8
  align-items: center;
9
9
  padding: 0 11px;
@@ -15,4 +15,4 @@
15
15
  color: #ff4d4f;
16
16
  border-color: #ff4d4f !important;
17
17
  }
18
- }
18
+ }
package/src/index.less CHANGED
@@ -1,3 +1,4 @@
1
+ @import '~@hw-component/hj/src/components/styles/index.less';
1
2
  .layout {
2
3
  position: fixed;
3
4
  top: 0;
package/src/index.tsx CHANGED
@@ -4,6 +4,7 @@ import React from "react";
4
4
  import "antd/dist/antd.css";
5
5
  import zhCN from "antd/es/locale/zh_CN";
6
6
  import { ConfigProvider } from "antd";
7
+
7
8
  render(
8
9
  <ConfigProvider locale={zhCN}>
9
10
  <App />