@hw-component/form 1.9.41 → 1.9.43
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/es/Form/HFormConnect.js +9 -10
- package/es/Form/config.d.ts +2 -5
- package/es/Form/config.js +3 -1
- package/es/Input/InputNumberGroup.js +1 -1
- package/es/Select/TreeSelect.d.ts +2 -2
- package/es/Select/index.js +65 -48
- package/es/Select/modal.d.ts +2 -0
- package/es/Text/index.d.ts +3 -0
- package/es/Text/index.js +13 -0
- package/es/index.css +59 -24
- package/lib/Form/HFormConnect.js +9 -10
- package/lib/Form/config.d.ts +2 -5
- package/lib/Form/config.js +3 -1
- package/lib/Input/InputNumberGroup.js +1 -1
- package/lib/Select/TreeSelect.d.ts +2 -2
- package/lib/Select/index.js +64 -47
- package/lib/Select/modal.d.ts +2 -0
- package/lib/Text/index.d.ts +3 -0
- package/lib/Text/index.js +16 -0
- package/lib/index.css +59 -24
- package/package.json +1 -1
- package/src/components/CheckboxGroup/index.tsx +3 -3
- package/src/components/Form/HFormConnect.tsx +9 -10
- package/src/components/Form/config.ts +2 -0
- package/src/components/Input/InputNumberGroup.tsx +5 -5
- package/src/components/Input/SelectInput.tsx +2 -2
- package/src/components/Input/TrimInput.tsx +3 -3
- package/src/components/Input/index.less +10 -20
- package/src/components/Select/TreeSelect.tsx +2 -2
- package/src/components/Select/index.less +35 -0
- package/src/components/Select/index.tsx +76 -61
- package/src/components/Select/modal.ts +2 -0
- package/src/components/Switch/index.tsx +3 -3
- package/src/components/TDPicker/RangePicker.tsx +2 -2
- package/src/components/Text/index.tsx +6 -0
- package/src/components/TextArea/TrimTextArea.tsx +3 -3
- package/src/components/Upload/index.tsx +4 -4
- package/src/components/styles/index.less +14 -0
- package/src/pages/Form/index.tsx +67 -32
- package/src/pages/Select/index.tsx +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var antd = require('antd');
|
|
7
|
+
|
|
8
|
+
var HText = (function (_ref) {
|
|
9
|
+
var value = _ref.value;
|
|
10
|
+
return jsxRuntime.jsx(antd.Typography.Text, {
|
|
11
|
+
children: value
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
exports.default = HText;
|
|
16
|
+
// powered by h
|
package/lib/index.css
CHANGED
|
@@ -7,6 +7,41 @@
|
|
|
7
7
|
.ant-hw-all-check-box .ant-select-item-option:not( .ant-select-item-option-selected):hover {
|
|
8
8
|
background-color: #f5f5f5;
|
|
9
9
|
}
|
|
10
|
+
.ant-hw-select-box {
|
|
11
|
+
display: -webkit-box;
|
|
12
|
+
display: -webkit-flex;
|
|
13
|
+
display: -ms-flexbox;
|
|
14
|
+
display: flex;
|
|
15
|
+
-webkit-box-orient: horizontal;
|
|
16
|
+
-webkit-box-direction: normal;
|
|
17
|
+
-webkit-flex-direction: row;
|
|
18
|
+
-ms-flex-direction: row;
|
|
19
|
+
flex-direction: row;
|
|
20
|
+
}
|
|
21
|
+
.ant-hw-select-box .ant-hw-group-addon-before {
|
|
22
|
+
border-bottom-left-radius: 2px;
|
|
23
|
+
border-top-left-radius: 2px;
|
|
24
|
+
border-right: 0px;
|
|
25
|
+
}
|
|
26
|
+
.ant-hw-select-box .ant-select {
|
|
27
|
+
-webkit-box-flex: 1;
|
|
28
|
+
-webkit-flex: 1;
|
|
29
|
+
-ms-flex: 1;
|
|
30
|
+
flex: 1;
|
|
31
|
+
}
|
|
32
|
+
.ant-hw-select-box .ant-hw-group-addon-after {
|
|
33
|
+
border-bottom-right-radius: 2px;
|
|
34
|
+
border-top-right-radius: 2px;
|
|
35
|
+
border-left: 0px;
|
|
36
|
+
}
|
|
37
|
+
.ant-hw-select-box-addon-before .ant-select .ant-select-selector {
|
|
38
|
+
border-bottom-left-radius: 0px !important;
|
|
39
|
+
border-top-left-radius: 0px !important;
|
|
40
|
+
}
|
|
41
|
+
.ant-hw-select-box-addon-after .ant-select .ant-select-selector {
|
|
42
|
+
border-bottom-right-radius: 0px !important;
|
|
43
|
+
border-top-right-radius: 0px !important;
|
|
44
|
+
}
|
|
10
45
|
.ant-hw-form-item-colon:after {
|
|
11
46
|
position: relative;
|
|
12
47
|
top: -0.5px;
|
|
@@ -125,17 +160,6 @@
|
|
|
125
160
|
.ant-hw-form-form-item .ant-form-item-label {
|
|
126
161
|
overflow: visible;
|
|
127
162
|
}
|
|
128
|
-
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
129
|
-
border-color: #ff4d4f !important;
|
|
130
|
-
}
|
|
131
|
-
.ant-form-item-has-error .ant-hw-input-group-active {
|
|
132
|
-
border-color: #ff4d4f !important;
|
|
133
|
-
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
134
|
-
}
|
|
135
|
-
.ant-form-item-has-error .ant-hw-input-group-addon {
|
|
136
|
-
color: #ff4d4f;
|
|
137
|
-
border-color: #ff4d4f !important;
|
|
138
|
-
}
|
|
139
163
|
.ant-hw-input-group {
|
|
140
164
|
display: -webkit-box !important;
|
|
141
165
|
display: -webkit-flex !important;
|
|
@@ -201,19 +225,6 @@
|
|
|
201
225
|
border-color: #40a9ff;
|
|
202
226
|
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
203
227
|
}
|
|
204
|
-
.ant-hw-input-group .ant-hw-input-group-addon {
|
|
205
|
-
display: -webkit-box !important;
|
|
206
|
-
display: -webkit-flex !important;
|
|
207
|
-
display: -ms-flexbox !important;
|
|
208
|
-
display: flex !important;
|
|
209
|
-
-webkit-box-align: center;
|
|
210
|
-
-webkit-align-items: center;
|
|
211
|
-
-ms-flex-align: center;
|
|
212
|
-
align-items: center;
|
|
213
|
-
padding: 0 11px;
|
|
214
|
-
background-color: #fafafa;
|
|
215
|
-
border: 1px solid #d9d9d9;
|
|
216
|
-
}
|
|
217
228
|
.ant-hw-color-box {
|
|
218
229
|
width: 22px;
|
|
219
230
|
height: 22px;
|
|
@@ -223,6 +234,13 @@
|
|
|
223
234
|
.ant-hw-color-input-picker {
|
|
224
235
|
box-shadow: 0 0 0 0 !important;
|
|
225
236
|
}
|
|
237
|
+
.ant-form-item-has-error .ant-hw-input-group-body {
|
|
238
|
+
border-color: #ff4d4f !important;
|
|
239
|
+
}
|
|
240
|
+
.ant-form-item-has-error .ant-hw-input-group-active {
|
|
241
|
+
border-color: #ff4d4f !important;
|
|
242
|
+
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
243
|
+
}
|
|
226
244
|
.ant-hw-switch {
|
|
227
245
|
display: -webkit-box;
|
|
228
246
|
display: -webkit-flex;
|
|
@@ -244,3 +262,20 @@
|
|
|
244
262
|
.ant-hw-switch .ant-hw-switch-after {
|
|
245
263
|
margin-left: 4px;
|
|
246
264
|
}
|
|
265
|
+
.ant-hw-addon {
|
|
266
|
+
display: -webkit-box !important;
|
|
267
|
+
display: -webkit-flex !important;
|
|
268
|
+
display: -ms-flexbox !important;
|
|
269
|
+
display: flex !important;
|
|
270
|
+
-webkit-box-align: center;
|
|
271
|
+
-webkit-align-items: center;
|
|
272
|
+
-ms-flex-align: center;
|
|
273
|
+
align-items: center;
|
|
274
|
+
padding: 0 11px;
|
|
275
|
+
background-color: #fafafa;
|
|
276
|
+
border: 1px solid #d9d9d9;
|
|
277
|
+
}
|
|
278
|
+
.ant-form-item-has-error .ant-hw-addon {
|
|
279
|
+
color: #ff4d4f;
|
|
280
|
+
border-color: #ff4d4f !important;
|
|
281
|
+
}
|
package/package.json
CHANGED
|
@@ -43,15 +43,15 @@ const Index = ({
|
|
|
43
43
|
resultObj[key] = initValue[key];
|
|
44
44
|
});
|
|
45
45
|
return {
|
|
46
|
-
[name]: resultObj,
|
|
46
|
+
[(name as string)]: resultObj,
|
|
47
47
|
};
|
|
48
48
|
},
|
|
49
49
|
outputValue: (item, outputValue) => {
|
|
50
50
|
const { name = "" } = item;
|
|
51
|
-
const { [name]: itemVal = {} } = outputValue;
|
|
51
|
+
const { [(name as string)]: itemVal = {} } = outputValue;
|
|
52
52
|
if (Array.isArray(itemVal)) {
|
|
53
53
|
return {
|
|
54
|
-
[name]: itemVal,
|
|
54
|
+
[(name as string)]: itemVal,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
return {
|
|
@@ -44,27 +44,26 @@ export default (
|
|
|
44
44
|
ref
|
|
45
45
|
) => {
|
|
46
46
|
const { form, valueType = "float" } = useFormContext();
|
|
47
|
-
|
|
47
|
+
const { name } = props;
|
|
48
|
+
const relName=Array.isArray(name)?name.join("."):name;
|
|
48
49
|
useEffect(() => {
|
|
49
|
-
|
|
50
|
-
if (!name) {
|
|
50
|
+
if (!relName) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
form?.addFormat(
|
|
53
|
+
form?.addFormat(relName, formatMaker(props, format[valueType]));
|
|
54
54
|
}, [valueType, props]);
|
|
55
55
|
const addFormat = (aFormat: Record<string, addFormatItemModal>) => {
|
|
56
|
-
|
|
57
|
-
if (!name) {
|
|
56
|
+
if (!relName) {
|
|
58
57
|
return;
|
|
59
58
|
}
|
|
60
|
-
form?.addFormat(
|
|
59
|
+
form?.addFormat(relName, formatMaker(props, aFormat[valueType]));
|
|
61
60
|
};
|
|
62
61
|
const addDispatchListener = (key: string, fn: argsFn) => {
|
|
63
|
-
const {
|
|
64
|
-
if (!
|
|
62
|
+
const {dispatch } = props;
|
|
63
|
+
if (!relName) {
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
|
-
form?.addDispatchListener({ key, name, dispatch }, fn);
|
|
66
|
+
form?.addDispatchListener({ key, name:relName, dispatch }, fn);
|
|
68
67
|
};
|
|
69
68
|
const Component = component as React.ForwardRefRenderFunction<
|
|
70
69
|
any,
|
|
@@ -21,6 +21,7 @@ import VerificationCodeInput from "../Input/VerificationCodeInput";
|
|
|
21
21
|
import TrimInput from "../Input/TrimInput";
|
|
22
22
|
import TrimTextArea from "../TextArea/TrimTextArea";
|
|
23
23
|
import HInputNumberGroup from "../Input/InputNumberGroup";
|
|
24
|
+
import HText from '../Text'
|
|
24
25
|
export const placeholderConfig = {
|
|
25
26
|
inputType: [
|
|
26
27
|
"input",
|
|
@@ -64,6 +65,7 @@ const componentConfig = {
|
|
|
64
65
|
trimTextArea: TrimTextArea,
|
|
65
66
|
inputNumberGroup: HInputNumberGroup,
|
|
66
67
|
treeSelect: HTreeSelect,
|
|
68
|
+
text: HText,
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
export default componentConfig;
|
|
@@ -32,7 +32,7 @@ const useArrayProps = (props: any) => {
|
|
|
32
32
|
}, [props]);
|
|
33
33
|
};
|
|
34
34
|
const Addon: React.FC<IProps> = ({ children, value, onChange }) => {
|
|
35
|
-
const addonClassname = useClassName(["hw-
|
|
35
|
+
const addonClassname = useClassName(["hw-addon"]);
|
|
36
36
|
if (!children) {
|
|
37
37
|
return <></>;
|
|
38
38
|
}
|
|
@@ -80,11 +80,11 @@ const InputNumberGroup = ({
|
|
|
80
80
|
inputValue: (item, initValue) => {
|
|
81
81
|
const { name: valueName = "" } = item;
|
|
82
82
|
const { min: minKey, max: maxKey } = valueMap;
|
|
83
|
-
const cuValue = initValue[valueName];
|
|
83
|
+
const cuValue = initValue[(valueName as string)];
|
|
84
84
|
const minInitVal = initValue[minKey];
|
|
85
85
|
const maxInitVal = initValue[maxKey];
|
|
86
86
|
return {
|
|
87
|
-
[valueName]: {
|
|
87
|
+
[(valueName as string)]: {
|
|
88
88
|
[min]: minInitVal,
|
|
89
89
|
[max]: maxInitVal,
|
|
90
90
|
...cuValue,
|
|
@@ -93,7 +93,7 @@ const InputNumberGroup = ({
|
|
|
93
93
|
},
|
|
94
94
|
outputValue: (item, outputValue) => {
|
|
95
95
|
const { name: valueName = "" } = item;
|
|
96
|
-
const { [valueName]: itemVal = {} } = outputValue;
|
|
96
|
+
const { [(valueName as string)]: itemVal = {} } = outputValue;
|
|
97
97
|
const { min: minKey, max: maxKey } = valueMap;
|
|
98
98
|
const {
|
|
99
99
|
[minKey]: minSubVal,
|
|
@@ -103,7 +103,7 @@ const InputNumberGroup = ({
|
|
|
103
103
|
return {
|
|
104
104
|
[maxKey]: maxSubVal,
|
|
105
105
|
[minKey]: minSubVal,
|
|
106
|
-
[valueName]: oItemVal,
|
|
106
|
+
[(valueName as string)]: oItemVal,
|
|
107
107
|
};
|
|
108
108
|
},
|
|
109
109
|
},
|
|
@@ -38,12 +38,12 @@ export const Index = ({
|
|
|
38
38
|
resultObj[key] = initValue[key];
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
[name]: resultObj,
|
|
41
|
+
[(name as string)]: resultObj,
|
|
42
42
|
};
|
|
43
43
|
},
|
|
44
44
|
outputValue: (item, outputValue) => {
|
|
45
45
|
const { name = "" } = item;
|
|
46
|
-
const { [name]: itemVal = {} } = outputValue;
|
|
46
|
+
const { [(name as string)]: itemVal = {} } = outputValue;
|
|
47
47
|
const newItemVal = { [itemVal[select]]: itemVal[input] };
|
|
48
48
|
return {
|
|
49
49
|
...newItemVal,
|
|
@@ -8,14 +8,14 @@ const Index = ({ addFormat, ...props }: HInputProps) => {
|
|
|
8
8
|
inputValue: (item, initValue) => {
|
|
9
9
|
const { name: valueName = "" } = item;
|
|
10
10
|
return {
|
|
11
|
-
[valueName]: initValue[valueName],
|
|
11
|
+
[(valueName as string)]: initValue[(valueName as string)],
|
|
12
12
|
};
|
|
13
13
|
},
|
|
14
14
|
outputValue: (item, outputValue) => {
|
|
15
15
|
const { name = "" } = item;
|
|
16
|
-
const { [name]: itemVal } = outputValue;
|
|
16
|
+
const { [(name as string)]: itemVal } = outputValue;
|
|
17
17
|
return {
|
|
18
|
-
[name]: itemVal?.trim(),
|
|
18
|
+
[(name as string)]: itemVal?.trim(),
|
|
19
19
|
};
|
|
20
20
|
},
|
|
21
21
|
},
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
@import "../styles/local.less";
|
|
2
2
|
@all-input-group: ~"@{ant-prefix}-hw-input-group";
|
|
3
|
-
|
|
4
|
-
.@{all-input-group}-body {
|
|
5
|
-
border-color: #ff4d4f !important;
|
|
6
|
-
}
|
|
7
|
-
.@{all-input-group}-active {
|
|
8
|
-
border-color: #ff4d4f !important;
|
|
9
|
-
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
10
|
-
}
|
|
11
|
-
.@{all-input-group}-addon {
|
|
12
|
-
color: #ff4d4f;
|
|
13
|
-
border-color: #ff4d4f !important;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
3
|
+
|
|
16
4
|
.@{all-input-group} {
|
|
17
5
|
display: flex !important;
|
|
18
6
|
width: 100%;
|
|
@@ -63,13 +51,6 @@
|
|
|
63
51
|
border-color: #40a9ff;
|
|
64
52
|
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
|
|
65
53
|
}
|
|
66
|
-
.@{all-input-group}-addon {
|
|
67
|
-
display: flex !important;
|
|
68
|
-
align-items: center;
|
|
69
|
-
padding: 0 11px;
|
|
70
|
-
background-color: #fafafa;
|
|
71
|
-
border: 1px solid #d9d9d9;
|
|
72
|
-
}
|
|
73
54
|
}
|
|
74
55
|
|
|
75
56
|
.@{ant-prefix}-hw-color-box {
|
|
@@ -81,3 +62,12 @@
|
|
|
81
62
|
.@{ant-prefix}-hw-color-input-picker {
|
|
82
63
|
box-shadow: 0 0 0 0 !important;
|
|
83
64
|
}
|
|
65
|
+
.@{ant-prefix}-form-item-has-error {
|
|
66
|
+
.@{all-input-group}-body {
|
|
67
|
+
border-color: #ff4d4f !important;
|
|
68
|
+
}
|
|
69
|
+
.@{all-input-group}-active {
|
|
70
|
+
border-color: #ff4d4f !important;
|
|
71
|
+
box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.2) !important;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -2,7 +2,7 @@ import { TreeSelect } from "antd";
|
|
|
2
2
|
import { TreeSelectProps } from "antd/lib/tree-select";
|
|
3
3
|
import { PromiseFnResult } from "../modal";
|
|
4
4
|
import { useRequest } from "ahooks";
|
|
5
|
-
interface
|
|
5
|
+
export interface HTreeSelectProps extends TreeSelectProps {
|
|
6
6
|
request?: PromiseFnResult;
|
|
7
7
|
onlyCheckChild?:boolean;
|
|
8
8
|
}
|
|
@@ -29,7 +29,7 @@ const opMk=({options,onlyCheckChild=false,fieldNames}:OpMkParamsModal)=>{
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
}
|
|
32
|
-
export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }:
|
|
32
|
+
export default ({ request,onlyCheckChild,multiple,treeCheckable,treeData,fieldNames, ...props }: HTreeSelectProps) => {
|
|
33
33
|
const { loading, data } = useRequest(async () => {
|
|
34
34
|
let options=treeData;
|
|
35
35
|
if (request) {
|
|
@@ -20,3 +20,38 @@
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
.@{ant-prefix}-hw-select-box{
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: row;
|
|
26
|
+
|
|
27
|
+
.@{ant-prefix}-hw-group-addon-before{
|
|
28
|
+
border-bottom-left-radius: 2px;
|
|
29
|
+
border-top-left-radius: 2px;
|
|
30
|
+
border-right: 0px;
|
|
31
|
+
}
|
|
32
|
+
.@{ant-prefix}-select{
|
|
33
|
+
flex: 1;
|
|
34
|
+
}
|
|
35
|
+
.@{ant-prefix}-hw-group-addon-after{
|
|
36
|
+
border-bottom-right-radius: 2px;
|
|
37
|
+
border-top-right-radius: 2px;
|
|
38
|
+
border-left: 0px;
|
|
39
|
+
}
|
|
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;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
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;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Select
|
|
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 {
|
|
9
|
+
import {useChangeOptions, useClassName, useMatchConfigProps} from "../hooks";
|
|
10
10
|
import HFormConnect from "../Form/HFormConnect";
|
|
11
11
|
const { Option } = Select;
|
|
12
12
|
|
|
@@ -35,7 +35,8 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
35
35
|
dispatch,
|
|
36
36
|
isList,
|
|
37
37
|
onPopupScroll: propsOnPopupScroll,
|
|
38
|
-
|
|
38
|
+
addonBefore,
|
|
39
|
+
addonAfter,
|
|
39
40
|
...props
|
|
40
41
|
}) => {
|
|
41
42
|
const { icon, render } = modeConfig?.[mode || ""] || {};
|
|
@@ -63,6 +64,13 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
63
64
|
}); //options
|
|
64
65
|
|
|
65
66
|
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");
|
|
72
|
+
const addonClassname = useClassName(["hw-addon"]);
|
|
73
|
+
|
|
66
74
|
const { val, change } = useValueChange({
|
|
67
75
|
labelInValue,
|
|
68
76
|
onChange,
|
|
@@ -74,65 +82,72 @@ const Index: React.FC<HSelectProps> = ({
|
|
|
74
82
|
});
|
|
75
83
|
addDispatchListener?.("reload", reload);
|
|
76
84
|
return (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
onSearch={onSearch}
|
|
83
|
-
onChange={change}
|
|
84
|
-
dropdownRender={(node) => {
|
|
85
|
-
return (
|
|
86
|
-
<DropdownComponent
|
|
87
|
-
loading={loading}
|
|
88
|
-
reload={run}
|
|
89
|
-
error={error}
|
|
90
|
-
options={data}
|
|
91
|
-
>
|
|
92
|
-
<AllSelect
|
|
93
|
-
allSelect={allSelect}
|
|
94
|
-
options={data}
|
|
95
|
-
mode={mode}
|
|
96
|
-
value={val}
|
|
97
|
-
onChange={change}
|
|
98
|
-
fieldNames={fieldNames}
|
|
99
|
-
>
|
|
100
|
-
{node}
|
|
101
|
-
</AllSelect>
|
|
102
|
-
</DropdownComponent> //全选
|
|
103
|
-
);
|
|
104
|
-
}}
|
|
105
|
-
optionLabelProp={optionLabelProp}
|
|
106
|
-
menuItemSelectedIcon={icon}
|
|
107
|
-
optionFilterProp={optionFilterProp}
|
|
108
|
-
filterOption={selfFilterOption}
|
|
109
|
-
showSearch={mathShowSearch}
|
|
110
|
-
labelInValue={true}
|
|
111
|
-
onPopupScroll={propsOnPopupScroll || onPopupScroll}
|
|
112
|
-
{...props}
|
|
113
|
-
>
|
|
114
|
-
{data?.map((item) => {
|
|
115
|
-
const { value: optionValue, label, ...oItem } = item;
|
|
116
|
-
const filterKey = filterProvider || "label";
|
|
117
|
-
const result =
|
|
118
|
-
typeof filterProvider === "function"
|
|
119
|
-
? filterProvider?.(item)
|
|
120
|
-
: item[filterKey as string];
|
|
121
|
-
const filter = { [optionFilterProp]: result };
|
|
122
|
-
return (
|
|
123
|
-
<Option
|
|
124
|
-
{...oItem}
|
|
125
|
-
value={optionValue}
|
|
126
|
-
key={optionValue}
|
|
127
|
-
label={label}
|
|
85
|
+
<div className={`${boxClassName} ${addonBefore?addonBeforeBoxClassName:""} ${addonAfter?addonAfterBoxClassName:""}`} style={style}>
|
|
86
|
+
{addonBefore&& <div className={`${addonClassname} ${addonBeforeClassName}`}>
|
|
87
|
+
{addonBefore}
|
|
88
|
+
</div>}
|
|
89
|
+
<Select
|
|
128
90
|
mode={mode}
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
{
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
91
|
+
loading={loading}
|
|
92
|
+
value={val}
|
|
93
|
+
onSearch={onSearch}
|
|
94
|
+
onChange={change}
|
|
95
|
+
dropdownRender={(node) => {
|
|
96
|
+
return (
|
|
97
|
+
<DropdownComponent
|
|
98
|
+
loading={loading}
|
|
99
|
+
reload={run}
|
|
100
|
+
error={error}
|
|
101
|
+
options={data}
|
|
102
|
+
>
|
|
103
|
+
<AllSelect
|
|
104
|
+
allSelect={allSelect}
|
|
105
|
+
options={data}
|
|
106
|
+
mode={mode}
|
|
107
|
+
value={val}
|
|
108
|
+
onChange={change}
|
|
109
|
+
fieldNames={fieldNames}
|
|
110
|
+
>
|
|
111
|
+
{node}
|
|
112
|
+
</AllSelect>
|
|
113
|
+
</DropdownComponent> //全选
|
|
114
|
+
);
|
|
115
|
+
}}
|
|
116
|
+
optionLabelProp={optionLabelProp}
|
|
117
|
+
menuItemSelectedIcon={icon}
|
|
118
|
+
optionFilterProp={optionFilterProp}
|
|
119
|
+
filterOption={selfFilterOption}
|
|
120
|
+
showSearch={mathShowSearch}
|
|
121
|
+
labelInValue={true}
|
|
122
|
+
onPopupScroll={propsOnPopupScroll || onPopupScroll}
|
|
123
|
+
{...props}
|
|
124
|
+
>
|
|
125
|
+
{data?.map((item) => {
|
|
126
|
+
const { value: optionValue, label, ...oItem } = item;
|
|
127
|
+
const filterKey = filterProvider || "label";
|
|
128
|
+
const result =
|
|
129
|
+
typeof filterProvider === "function"
|
|
130
|
+
? filterProvider?.(item)
|
|
131
|
+
: item[filterKey as string];
|
|
132
|
+
const filter = { [optionFilterProp]: result };
|
|
133
|
+
return (
|
|
134
|
+
<Option
|
|
135
|
+
{...oItem}
|
|
136
|
+
value={optionValue}
|
|
137
|
+
key={optionValue}
|
|
138
|
+
label={label}
|
|
139
|
+
mode={mode}
|
|
140
|
+
{...filter}
|
|
141
|
+
>
|
|
142
|
+
{render ? render(item, val) : label}
|
|
143
|
+
</Option>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
|
+
</Select>
|
|
147
|
+
{addonAfter&&<div className={`${addonClassname} ${addonAfterClassName}`}>
|
|
148
|
+
{addonAfter}
|
|
149
|
+
</div>}
|
|
150
|
+
</div>
|
|
136
151
|
);
|
|
137
152
|
};
|
|
138
153
|
export default HFormConnect(Index);
|
|
@@ -56,18 +56,18 @@ const Index: React.FC<HSwitchProps> = ({
|
|
|
56
56
|
inputValue: (item, initValue) => {
|
|
57
57
|
const { close } = valueSwitchMap;
|
|
58
58
|
const { name: valueName = "" } = item;
|
|
59
|
-
let val = initValue[valueName];
|
|
59
|
+
let val = initValue[(valueName as string)];
|
|
60
60
|
if (typeof val === "undefined" || val === null) {
|
|
61
61
|
val = close;
|
|
62
62
|
}
|
|
63
63
|
return {
|
|
64
|
-
[valueName]: val,
|
|
64
|
+
[(valueName as string)]: val,
|
|
65
65
|
};
|
|
66
66
|
},
|
|
67
67
|
outputValue: (item, outputValue) => {
|
|
68
68
|
const { name = "" } = item;
|
|
69
69
|
return {
|
|
70
|
-
[name]: outputValue[name],
|
|
70
|
+
[(name as string)]: outputValue[(name as string)],
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
},
|
|
@@ -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]: 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]: itemVal = {} } = outputValue;
|
|
70
|
+
const { [(valueName as string)]: itemVal = {} } = outputValue;
|
|
71
71
|
return {
|
|
72
72
|
...itemVal,
|
|
73
73
|
};
|
|
@@ -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]: initValue[valueName],
|
|
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]: itemVal } = outputValue;
|
|
20
|
+
const { [(name as string)]: itemVal } = outputValue;
|
|
21
21
|
return {
|
|
22
|
-
[name]: itemVal?.trim(),
|
|
22
|
+
[(name as string)]: itemVal?.trim(),
|
|
23
23
|
};
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -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] || [];
|
|
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]: fileList,
|
|
84
|
+
[(name as string)]: fileList,
|
|
85
85
|
};
|
|
86
86
|
},
|
|
87
87
|
outputValue: (item, outputValue) => {
|
|
88
88
|
const { name: valueName = "" } = item;
|
|
89
|
-
const { [valueName]: 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]: maxCount === 1 ? urls[0] : urls,
|
|
94
|
+
[(valueName as string)]: maxCount === 1 ? urls[0] : urls,
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
97
|
},
|