@hw-component/form 1.9.50 → 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/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,14 +13,19 @@ var HText = (function (_ref) {
|
|
|
12
13
|
addonBefore = _ref.addonBefore,
|
|
13
14
|
addonAfter = _ref.addonAfter,
|
|
14
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
|
|
16
|
+
var text = useMemo(function () {
|
|
17
|
+
if (typeof value === "undefined" || value === null) {
|
|
18
|
+
return "-";
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}, [value]);
|
|
16
22
|
return jsx(Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
|
|
17
23
|
children: jsxs(Space, {
|
|
18
24
|
size: 2,
|
|
19
25
|
children: [jsx("div", {
|
|
20
26
|
children: addonBefore
|
|
21
27
|
}), jsx("div", {
|
|
22
|
-
children:
|
|
28
|
+
children: text
|
|
23
29
|
}), jsx("div", {
|
|
24
30
|
children: addonAfter
|
|
25
31
|
})]
|
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,14 +16,19 @@ var HText = (function (_ref) {
|
|
|
15
16
|
addonBefore = _ref.addonBefore,
|
|
16
17
|
addonAfter = _ref.addonAfter,
|
|
17
18
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
|
|
19
|
+
var text = React.useMemo(function () {
|
|
20
|
+
if (typeof value === "undefined" || value === null) {
|
|
21
|
+
return "-";
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}, [value]);
|
|
19
25
|
return jsxRuntime.jsx(antd.Typography.Text, _objectSpread(_objectSpread({}, props), {}, {
|
|
20
26
|
children: jsxRuntime.jsxs(antd.Space, {
|
|
21
27
|
size: 2,
|
|
22
28
|
children: [jsxRuntime.jsx("div", {
|
|
23
29
|
children: addonBefore
|
|
24
30
|
}), jsxRuntime.jsx("div", {
|
|
25
|
-
children:
|
|
31
|
+
children: text
|
|
26
32
|
}), jsxRuntime.jsx("div", {
|
|
27
33
|
children: addonAfter
|
|
28
34
|
})]
|
package/package.json
CHANGED
|
@@ -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,12 +12,17 @@ export default ({
|
|
|
12
12
|
addonAfter,
|
|
13
13
|
...props
|
|
14
14
|
}: HFormTextProps) => {
|
|
15
|
-
|
|
15
|
+
const text=useMemo(()=>{
|
|
16
|
+
if (typeof value==="undefined"||value===null){
|
|
17
|
+
return "-"
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
},[value]);
|
|
16
21
|
return (
|
|
17
22
|
<Typography.Text {...props}>
|
|
18
23
|
<Space size={2}>
|
|
19
24
|
<div>{addonBefore}</div>
|
|
20
|
-
<div>{
|
|
25
|
+
<div>{text}</div>
|
|
21
26
|
<div>{addonAfter}</div>
|
|
22
27
|
</Space>
|
|
23
28
|
</Typography.Text>
|