@hw-component/form 1.9.49 → 1.9.51
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/config.d.ts +1 -1
- package/es/Form/config.js +24 -24
- package/es/Input/SelectInput.js +0 -1
- package/es/Text/index.js +8 -1
- package/lib/Form/config.d.ts +1 -1
- package/lib/Form/config.js +24 -24
- package/lib/Input/SelectInput.js +0 -1
- package/lib/Text/index.js +8 -1
- package/package.json +1 -1
- package/src/components/Form/config.ts +24 -24
- package/src/components/Input/SelectInput.tsx +0 -1
- package/src/components/Text/index.tsx +8 -2
- package/src/pages/Form/index.tsx +1 -0
- package/src/pages/ModalForm/index.tsx +21 -1
package/es/Form/config.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ declare const componentConfig: {
|
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
38
|
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
-
text: ({ value }: import("
|
|
39
|
+
text: ({ value, addonBefore, addonAfter, ...props }: import("../Text").HFormTextProps) => JSX.Element;
|
|
40
40
|
};
|
|
41
41
|
export default componentConfig;
|
package/es/Form/config.js
CHANGED
|
@@ -29,30 +29,30 @@ var placeholderConfig = {
|
|
|
29
29
|
selectType: ["select", "datePicker", "timePicker", "colorInput", "treeSelect"]
|
|
30
30
|
};
|
|
31
31
|
var componentConfig = {
|
|
32
|
-
select: HSelect,
|
|
33
|
-
inputNumber: HInputNumber,
|
|
34
|
-
selectInput: HSelectInput,
|
|
35
|
-
buttonInput: Index,
|
|
36
|
-
checkboxGroup: HCheckboxGroup,
|
|
37
|
-
checkBox: Index$1,
|
|
38
|
-
radioGroup: HRadioGroup,
|
|
39
|
-
switch: HSwitch,
|
|
40
|
-
datePicker: HDatePicker,
|
|
41
|
-
rangePicker: HRangePicker,
|
|
42
|
-
timePicker: HTimePicker,
|
|
43
|
-
input: HInput,
|
|
44
|
-
upload: HUpload,
|
|
45
|
-
urlUpload: HUrlUpload,
|
|
46
|
-
submit: HSubmit,
|
|
47
|
-
textArea: TextArea,
|
|
48
|
-
colorInput: ColorInput,
|
|
49
|
-
cascader: Cascader,
|
|
50
|
-
verificationCodeInput: VerificationCodeInput,
|
|
51
|
-
trimInput: TrimInput,
|
|
52
|
-
trimTextArea: TrimTextArea,
|
|
53
|
-
inputNumberGroup: HInputNumberGroup,
|
|
54
|
-
treeSelect: HTreeSelect,
|
|
55
|
-
text: HText
|
|
32
|
+
"select": HSelect,
|
|
33
|
+
"inputNumber": HInputNumber,
|
|
34
|
+
"selectInput": HSelectInput,
|
|
35
|
+
"buttonInput": Index,
|
|
36
|
+
"checkboxGroup": HCheckboxGroup,
|
|
37
|
+
"checkBox": Index$1,
|
|
38
|
+
"radioGroup": HRadioGroup,
|
|
39
|
+
"switch": HSwitch,
|
|
40
|
+
"datePicker": HDatePicker,
|
|
41
|
+
"rangePicker": HRangePicker,
|
|
42
|
+
"timePicker": HTimePicker,
|
|
43
|
+
"input": HInput,
|
|
44
|
+
"upload": HUpload,
|
|
45
|
+
"urlUpload": HUrlUpload,
|
|
46
|
+
"submit": HSubmit,
|
|
47
|
+
"textArea": TextArea,
|
|
48
|
+
"colorInput": ColorInput,
|
|
49
|
+
"cascader": Cascader,
|
|
50
|
+
"verificationCodeInput": VerificationCodeInput,
|
|
51
|
+
"trimInput": TrimInput,
|
|
52
|
+
"trimTextArea": TrimTextArea,
|
|
53
|
+
"inputNumberGroup": HInputNumberGroup,
|
|
54
|
+
"treeSelect": HTreeSelect,
|
|
55
|
+
"text": HText
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
export { componentConfig as default, placeholderConfig };
|
package/es/Input/SelectInput.js
CHANGED
|
@@ -53,7 +53,6 @@ var Index = function Index(_ref) {
|
|
|
53
53
|
Object.values(valueName).forEach(function (key) {
|
|
54
54
|
resultObj[key] = initValue[key];
|
|
55
55
|
});
|
|
56
|
-
console.log(item, valueName);
|
|
57
56
|
return _defineProperty({}, name, resultObj);
|
|
58
57
|
},
|
|
59
58
|
outputValue: function outputValue(item, _outputValue) {
|
package/es/Text/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime-corejs3/helpers/objectWithoutProperties';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import { Typography, Space } from 'antd';
|
|
6
|
+
import { useMemo } from 'react';
|
|
6
7
|
|
|
7
8
|
var _excluded = ["value", "addonBefore", "addonAfter"];
|
|
8
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -12,13 +13,19 @@ var HText = (function (_ref) {
|
|
|
12
13
|
addonBefore = _ref.addonBefore,
|
|
13
14
|
addonAfter = _ref.addonAfter,
|
|
14
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
var text = useMemo(function () {
|
|
17
|
+
if (typeof value === "undefined" || value === null) {
|
|
18
|
+
return "-";
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}, [value]);
|
|
15
22
|
return jsx(Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
|
|
16
23
|
children: jsxs(Space, {
|
|
17
24
|
size: 2,
|
|
18
25
|
children: [jsx("div", {
|
|
19
26
|
children: addonBefore
|
|
20
27
|
}), jsx("div", {
|
|
21
|
-
children:
|
|
28
|
+
children: text
|
|
22
29
|
}), jsx("div", {
|
|
23
30
|
children: addonAfter
|
|
24
31
|
})]
|
package/lib/Form/config.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ declare const componentConfig: {
|
|
|
36
36
|
placeholder: ({ label }: import("./modal").HItemProps) => string[];
|
|
37
37
|
};
|
|
38
38
|
treeSelect: ({ request, onlyCheckChild, multiple, treeCheckable, treeData, fieldNames, ...props }: import("../Select/TreeSelect").HTreeSelectProps) => JSX.Element;
|
|
39
|
-
text: ({ value }: import("
|
|
39
|
+
text: ({ value, addonBefore, addonAfter, ...props }: import("../Text").HFormTextProps) => JSX.Element;
|
|
40
40
|
};
|
|
41
41
|
export default componentConfig;
|
package/lib/Form/config.js
CHANGED
|
@@ -32,30 +32,30 @@ var placeholderConfig = {
|
|
|
32
32
|
selectType: ["select", "datePicker", "timePicker", "colorInput", "treeSelect"]
|
|
33
33
|
};
|
|
34
34
|
var componentConfig = {
|
|
35
|
-
select: index.default,
|
|
36
|
-
inputNumber: InputNumber.default,
|
|
37
|
-
selectInput: SelectInput.default,
|
|
38
|
-
buttonInput: ButtonInput.default,
|
|
39
|
-
checkboxGroup: index$1.default,
|
|
40
|
-
checkBox: index$2.default,
|
|
41
|
-
radioGroup: index$3.default,
|
|
42
|
-
switch: index$4.default,
|
|
43
|
-
datePicker: index$5.default,
|
|
44
|
-
rangePicker: RangePicker.default,
|
|
45
|
-
timePicker: TimePicker.default,
|
|
46
|
-
input: index$6.default,
|
|
47
|
-
upload: index$7.default,
|
|
48
|
-
urlUpload: index$8.default,
|
|
49
|
-
submit: index$9.default,
|
|
50
|
-
textArea: index$a.default,
|
|
51
|
-
colorInput: index$b.default,
|
|
52
|
-
cascader: index$c.default,
|
|
53
|
-
verificationCodeInput: index$d.default,
|
|
54
|
-
trimInput: TrimInput.default,
|
|
55
|
-
trimTextArea: TrimTextArea.default,
|
|
56
|
-
inputNumberGroup: InputNumberGroup.default,
|
|
57
|
-
treeSelect: TreeSelect.default,
|
|
58
|
-
text: index$e.default
|
|
35
|
+
"select": index.default,
|
|
36
|
+
"inputNumber": InputNumber.default,
|
|
37
|
+
"selectInput": SelectInput.default,
|
|
38
|
+
"buttonInput": ButtonInput.default,
|
|
39
|
+
"checkboxGroup": index$1.default,
|
|
40
|
+
"checkBox": index$2.default,
|
|
41
|
+
"radioGroup": index$3.default,
|
|
42
|
+
"switch": index$4.default,
|
|
43
|
+
"datePicker": index$5.default,
|
|
44
|
+
"rangePicker": RangePicker.default,
|
|
45
|
+
"timePicker": TimePicker.default,
|
|
46
|
+
"input": index$6.default,
|
|
47
|
+
"upload": index$7.default,
|
|
48
|
+
"urlUpload": index$8.default,
|
|
49
|
+
"submit": index$9.default,
|
|
50
|
+
"textArea": index$a.default,
|
|
51
|
+
"colorInput": index$b.default,
|
|
52
|
+
"cascader": index$c.default,
|
|
53
|
+
"verificationCodeInput": index$d.default,
|
|
54
|
+
"trimInput": TrimInput.default,
|
|
55
|
+
"trimTextArea": TrimTextArea.default,
|
|
56
|
+
"inputNumberGroup": InputNumberGroup.default,
|
|
57
|
+
"treeSelect": TreeSelect.default,
|
|
58
|
+
"text": index$e.default
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
exports.default = componentConfig;
|
package/lib/Input/SelectInput.js
CHANGED
|
@@ -56,7 +56,6 @@ var Index = function Index(_ref) {
|
|
|
56
56
|
Object.values(valueName).forEach(function (key) {
|
|
57
57
|
resultObj[key] = initValue[key];
|
|
58
58
|
});
|
|
59
|
-
console.log(item, valueName);
|
|
60
59
|
return _defineProperty({}, name, resultObj);
|
|
61
60
|
},
|
|
62
61
|
outputValue: function outputValue(item, _outputValue) {
|
package/lib/Text/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
6
6
|
var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var antd = require('antd');
|
|
9
|
+
var React = require('react');
|
|
9
10
|
|
|
10
11
|
var _excluded = ["value", "addonBefore", "addonAfter"];
|
|
11
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -15,13 +16,19 @@ var HText = (function (_ref) {
|
|
|
15
16
|
addonBefore = _ref.addonBefore,
|
|
16
17
|
addonAfter = _ref.addonAfter,
|
|
17
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
19
|
+
var text = React.useMemo(function () {
|
|
20
|
+
if (typeof value === "undefined" || value === null) {
|
|
21
|
+
return "-";
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}, [value]);
|
|
18
25
|
return jsxRuntime.jsx(antd.Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
|
|
19
26
|
children: jsxRuntime.jsxs(antd.Space, {
|
|
20
27
|
size: 2,
|
|
21
28
|
children: [jsxRuntime.jsx("div", {
|
|
22
29
|
children: addonBefore
|
|
23
30
|
}), jsxRuntime.jsx("div", {
|
|
24
|
-
children:
|
|
31
|
+
children: text
|
|
25
32
|
}), jsxRuntime.jsx("div", {
|
|
26
33
|
children: addonAfter
|
|
27
34
|
})]
|
package/package.json
CHANGED
|
@@ -42,30 +42,30 @@ export const placeholderConfig = {
|
|
|
42
42
|
],
|
|
43
43
|
};
|
|
44
44
|
const componentConfig = {
|
|
45
|
-
select: HSelect,
|
|
46
|
-
inputNumber: HInputNumber,
|
|
47
|
-
selectInput: HSelectInput,
|
|
48
|
-
buttonInput: HButtonInput,
|
|
49
|
-
checkboxGroup: HCheckboxGroup,
|
|
50
|
-
checkBox: HCheckBox,
|
|
51
|
-
radioGroup: HRadioGroup,
|
|
52
|
-
switch: HSwitch,
|
|
53
|
-
datePicker: HDatePicker,
|
|
54
|
-
rangePicker: HRangePicker,
|
|
55
|
-
timePicker: HTimePicker,
|
|
56
|
-
input: HInput,
|
|
57
|
-
upload: HUpload,
|
|
58
|
-
urlUpload: HUrlUpload,
|
|
59
|
-
submit: HSubmit,
|
|
60
|
-
textArea: TextArea,
|
|
61
|
-
colorInput: ColorInput,
|
|
62
|
-
cascader: Cascader,
|
|
63
|
-
verificationCodeInput: VerificationCodeInput,
|
|
64
|
-
trimInput: TrimInput,
|
|
65
|
-
trimTextArea: TrimTextArea,
|
|
66
|
-
inputNumberGroup: HInputNumberGroup,
|
|
67
|
-
treeSelect: HTreeSelect,
|
|
68
|
-
text: HText,
|
|
45
|
+
"select": HSelect,
|
|
46
|
+
"inputNumber": HInputNumber,
|
|
47
|
+
"selectInput": HSelectInput,
|
|
48
|
+
"buttonInput": HButtonInput,
|
|
49
|
+
"checkboxGroup": HCheckboxGroup,
|
|
50
|
+
"checkBox": HCheckBox,
|
|
51
|
+
"radioGroup": HRadioGroup,
|
|
52
|
+
"switch": HSwitch,
|
|
53
|
+
"datePicker": HDatePicker,
|
|
54
|
+
"rangePicker": HRangePicker,
|
|
55
|
+
"timePicker": HTimePicker,
|
|
56
|
+
"input": HInput,
|
|
57
|
+
"upload": HUpload,
|
|
58
|
+
"urlUpload": HUrlUpload,
|
|
59
|
+
"submit": HSubmit,
|
|
60
|
+
"textArea": TextArea,
|
|
61
|
+
"colorInput": ColorInput,
|
|
62
|
+
"cascader": Cascader,
|
|
63
|
+
"verificationCodeInput": VerificationCodeInput,
|
|
64
|
+
"trimInput": TrimInput,
|
|
65
|
+
"trimTextArea": TrimTextArea,
|
|
66
|
+
"inputNumberGroup": HInputNumberGroup,
|
|
67
|
+
"treeSelect": HTreeSelect,
|
|
68
|
+
"text": HText,
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export default componentConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Space, Typography } from "antd";
|
|
2
2
|
import { TextProps } from "antd/lib/typography/Text";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, {useMemo} from "react";
|
|
4
4
|
export interface HFormTextProps<V = any> extends TextProps {
|
|
5
5
|
value?: V;
|
|
6
6
|
addonBefore?: React.ReactNode;
|
|
@@ -12,11 +12,17 @@ export default ({
|
|
|
12
12
|
addonAfter,
|
|
13
13
|
...props
|
|
14
14
|
}: HFormTextProps) => {
|
|
15
|
+
const text=useMemo(()=>{
|
|
16
|
+
if (typeof value==="undefined"||value===null){
|
|
17
|
+
return "-"
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
},[value]);
|
|
15
21
|
return (
|
|
16
22
|
<Typography.Text {...props}>
|
|
17
23
|
<Space size={2}>
|
|
18
24
|
<div>{addonBefore}</div>
|
|
19
|
-
<div>{
|
|
25
|
+
<div>{text}</div>
|
|
20
26
|
<div>{addonAfter}</div>
|
|
21
27
|
</Space>
|
|
22
28
|
</Typography.Text>
|
package/src/pages/Form/index.tsx
CHANGED
|
@@ -112,6 +112,24 @@ const data = [
|
|
|
112
112
|
name: "urlUpload",
|
|
113
113
|
type: "urlUpload",
|
|
114
114
|
},
|
|
115
|
+
{
|
|
116
|
+
label: "文字",
|
|
117
|
+
type: "text",
|
|
118
|
+
name: "text",
|
|
119
|
+
itemProps: {
|
|
120
|
+
type:"danger",
|
|
121
|
+
addonBefore: (
|
|
122
|
+
<div style={{ height: 100, backgroundColor: "red" }}>
|
|
123
|
+
nihao
|
|
124
|
+
</div>
|
|
125
|
+
),
|
|
126
|
+
addonAfter: (
|
|
127
|
+
<div style={{ height: 200, backgroundColor: "red" }}>
|
|
128
|
+
wohao
|
|
129
|
+
</div>
|
|
130
|
+
),
|
|
131
|
+
},
|
|
132
|
+
},
|
|
115
133
|
// {
|
|
116
134
|
// label: "下拉框",
|
|
117
135
|
// name: "select",
|
|
@@ -192,7 +210,9 @@ export default () => {
|
|
|
192
210
|
configData={data}
|
|
193
211
|
labelWidth={88}
|
|
194
212
|
infoRequest={() => {
|
|
195
|
-
|
|
213
|
+
return {
|
|
214
|
+
text:"你好"
|
|
215
|
+
}
|
|
196
216
|
}}
|
|
197
217
|
labelAlign={"left"}
|
|
198
218
|
request={(values, params) => {
|