@hw-component/form 1.9.46 → 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.
- package/.eslintcache +1 -1
- package/es/DialogForm/DrawerForm/Footer.js +5 -4
- package/es/DialogForm/DrawerForm/index.js +8 -16
- package/es/DialogForm/hooks.d.ts +5 -4
- package/es/DialogForm/hooks.js +13 -3
- package/es/DialogForm/modal.d.ts +1 -1
- package/es/Form/config.d.ts +1 -1
- package/es/Form/modal.d.ts +1 -1
- package/es/Input/ButtonInput.js +5 -5
- package/es/Input/SelectInput.js +1 -0
- package/es/PageHandler/ErrorComponent.js +3 -2
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Select/components/NotFoundContent.js +3 -2
- package/es/Submit/components.js +3 -3
- package/es/Switch/index.d.ts +1 -1
- package/es/Text/index.d.ts +1 -1
- package/es/index.css +8 -8
- package/es/index.d.ts +1 -1
- package/lib/DialogForm/DrawerForm/Footer.js +4 -3
- package/lib/DialogForm/DrawerForm/index.js +7 -15
- package/lib/DialogForm/hooks.d.ts +5 -4
- package/lib/DialogForm/hooks.js +13 -3
- package/lib/DialogForm/modal.d.ts +1 -1
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/modal.d.ts +1 -1
- package/lib/Input/ButtonInput.js +4 -4
- package/lib/Input/SelectInput.js +1 -0
- package/lib/PageHandler/ErrorComponent.js +2 -1
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Select/components/NotFoundContent.js +2 -1
- package/lib/Submit/components.js +3 -3
- package/lib/Switch/index.d.ts +1 -1
- package/lib/Text/index.d.ts +1 -1
- package/lib/index.css +8 -8
- package/lib/index.d.ts +1 -1
- package/package.json +5 -3
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/DialogForm/DrawerForm/Footer.tsx +7 -5
- package/src/components/DialogForm/DrawerForm/index.tsx +10 -21
- package/src/components/DialogForm/ModalForm.tsx +2 -2
- package/src/components/DialogForm/{hooks.ts → hooks.tsx} +17 -4
- package/src/components/DialogForm/modal.ts +1 -1
- package/src/components/Form/Basic.tsx +2 -2
- package/src/components/Form/HFormConnect.tsx +3 -3
- package/src/components/Form/config.ts +1 -1
- package/src/components/Form/hooks/index.ts +9 -9
- package/src/components/Form/hooks/useInitConfigData.tsx +3 -3
- package/src/components/Form/index.tsx +0 -1
- package/src/components/Form/modal.ts +6 -6
- package/src/components/Input/ButtonInput.tsx +27 -25
- package/src/components/Input/InputNumberGroup.tsx +4 -4
- package/src/components/Input/SelectInput.tsx +3 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/index.less +1 -1
- package/src/components/Input/modal.ts +1 -1
- package/src/components/PageHandler/ErrorComponent.tsx +4 -3
- package/src/components/PageHandler/index.tsx +0 -1
- package/src/components/PageHandler/modal.ts +1 -1
- package/src/components/Select/TreeSelect.tsx +51 -35
- package/src/components/Select/components/NotFoundContent.tsx +4 -3
- package/src/components/Select/index.less +18 -18
- package/src/components/Select/index.tsx +84 -75
- package/src/components/Select/modal.ts +2 -2
- package/src/components/Submit/components.tsx +5 -5
- package/src/components/Switch/index.tsx +16 -13
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +5 -5
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/MediaTypeEle/TypeEle.tsx +7 -1
- package/src/components/Upload/UrlUpload/index.tsx +1 -1
- package/src/components/Upload/index.tsx +4 -4
- package/src/components/index.tsx +1 -1
- package/src/components/styles/index.less +2 -2
- package/src/index.less +1 -0
- package/src/index.tsx +1 -0
- package/src/pages/DrawerForm/index.tsx +0 -3
- package/src/pages/Form/index.tsx +146 -77
- package/src/pages/Input/index.tsx +1 -1
- package/src/pages/ModalForm/index.tsx +3 -4
- package/src/pages/Switch/index.tsx +11 -11
- package/src/pages/Upload/index.tsx +6 -2
|
@@ -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-
|
|
27
|
+
.@{ant-prefix}-hw-group-addon-before {
|
|
28
|
+
border-right: 0;
|
|
29
29
|
border-top-left-radius: 2px;
|
|
30
|
-
border-
|
|
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-
|
|
35
|
+
.@{ant-prefix}-hw-group-addon-after {
|
|
36
|
+
border-left: 0;
|
|
37
37
|
border-top-right-radius: 2px;
|
|
38
|
-
border-
|
|
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-
|
|
45
|
-
border-
|
|
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-
|
|
54
|
-
border-
|
|
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,9 +35,9 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
35
35
|
dispatch,
|
|
36
36
|
isList,
|
|
37
37
|
onPopupScroll: propsOnPopupScroll,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
addonBefore,
|
|
39
|
+
addonAfter,
|
|
40
|
+
className,
|
|
41
41
|
...props
|
|
42
42
|
}) => {
|
|
43
43
|
const { icon, render } = modeConfig?.[mode || ""] || {};
|
|
@@ -65,11 +65,11 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
65
65
|
}); //options
|
|
66
66
|
|
|
67
67
|
const data = useChangeOptions({ options: resultData, fieldNames });
|
|
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");
|
|
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");
|
|
73
73
|
const addonClassname = useClassName(["hw-addon"]);
|
|
74
74
|
|
|
75
75
|
const { val, change } = useValueChange({
|
|
@@ -83,73 +83,82 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
83
83
|
});
|
|
84
84
|
addDispatchListener?.("reload", reload);
|
|
85
85
|
return (
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
<div
|
|
87
|
+
className={`${boxClassName} ${
|
|
88
|
+
addonBefore ? addonBeforeBoxClassName : ""
|
|
89
|
+
} ${addonAfter ? addonAfterBoxClassName : ""} ${className}`}
|
|
90
|
+
style={style}
|
|
91
|
+
>
|
|
92
|
+
{addonBefore && (
|
|
93
|
+
<div className={`${addonClassname} ${addonBeforeClassName}`}>
|
|
88
94
|
{addonBefore}
|
|
89
|
-
</div>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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}`}>
|
|
150
158
|
{addonAfter}
|
|
151
|
-
</div>
|
|
152
|
-
|
|
159
|
+
</div>
|
|
160
|
+
)}
|
|
161
|
+
</div>
|
|
153
162
|
);
|
|
154
163
|
};
|
|
155
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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
|
-
|
|
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(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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[
|
|
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
|
-
[
|
|
67
|
+
[valueName as string]: val,
|
|
65
68
|
};
|
|
66
69
|
},
|
|
67
70
|
outputValue: (item, outputValue) => {
|
|
68
71
|
const { name = "" } = item;
|
|
69
72
|
return {
|
|
70
|
-
[
|
|
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
|
-
[
|
|
65
|
+
[valueName as string]: hasKeys ? resultObj : null,
|
|
66
66
|
};
|
|
67
67
|
},
|
|
68
68
|
outputValue: (item, outputValue) => {
|
|
69
69
|
const { name: valueName = "" } = item;
|
|
70
|
-
const { [
|
|
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
|
-
|
|
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
|
-
[
|
|
15
|
+
[valueName as string]: initValue[valueName as string],
|
|
16
16
|
};
|
|
17
17
|
},
|
|
18
18
|
outputValue: (item, outputValue) => {
|
|
19
19
|
const { name = "" } = item;
|
|
20
|
-
const { [
|
|
20
|
+
const { [name as string]: itemVal } = outputValue;
|
|
21
21
|
return {
|
|
22
|
-
[
|
|
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
|
|
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[
|
|
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
|
-
[
|
|
84
|
+
[name as string]: fileList,
|
|
85
85
|
};
|
|
86
86
|
},
|
|
87
87
|
outputValue: (item, outputValue) => {
|
|
88
88
|
const { name: valueName = "" } = item;
|
|
89
|
-
const { [
|
|
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
|
-
[
|
|
94
|
+
[valueName as string]: maxCount === 1 ? urls[0] : urls,
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
97
|
},
|
package/src/components/index.tsx
CHANGED
|
@@ -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 "
|
|
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
package/src/index.tsx
CHANGED