@hw-component/table 1.10.28 → 1.10.30
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.
|
@@ -19,6 +19,8 @@ interface IProps {
|
|
|
19
19
|
popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
20
20
|
contentItemRender?: (item: any) => React.ReactNode;
|
|
21
21
|
extra?: React.ReactNode;
|
|
22
|
+
tagStyle?: React.CSSProperties;
|
|
22
23
|
}
|
|
24
|
+
export declare const Text: React.FC;
|
|
23
25
|
declare const TagsComponent: (props: IProps) => JSX.Element;
|
|
24
26
|
export default TagsComponent;
|
|
@@ -14,7 +14,7 @@ import _defineProperty from '@babel/runtime-corejs3/helpers/defineProperty';
|
|
|
14
14
|
import _sliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/slice';
|
|
15
15
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
16
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
|
-
import { Row, Tooltip, Tag, Popover } from 'antd';
|
|
17
|
+
import { Row, Tooltip, Tag, Popover, Typography } from 'antd';
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
19
|
|
|
20
20
|
var _excluded = ["contentItemRender"];
|
|
@@ -41,6 +41,15 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
|
|
|
41
41
|
title: title
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
var Text = function Text(_ref) {
|
|
45
|
+
var children = _ref.children;
|
|
46
|
+
return jsx(Typography.Text, {
|
|
47
|
+
ellipsis: {
|
|
48
|
+
tooltip: children
|
|
49
|
+
},
|
|
50
|
+
children: children
|
|
51
|
+
});
|
|
52
|
+
};
|
|
44
53
|
var TagsComponent = function TagsComponent(props) {
|
|
45
54
|
var data = props.data,
|
|
46
55
|
closable = props.closable,
|
|
@@ -53,7 +62,8 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
53
62
|
tableInstance = props.tableInstance,
|
|
54
63
|
maxLen = props.maxLen,
|
|
55
64
|
popoverContentRender = props.popoverContentRender,
|
|
56
|
-
extra = props.extra
|
|
65
|
+
extra = props.extra,
|
|
66
|
+
tagStyle = props.tagStyle;
|
|
57
67
|
var _fieldNames$label = fieldNames.label,
|
|
58
68
|
label = _fieldNames$label === void 0 ? "label" : _fieldNames$label,
|
|
59
69
|
_fieldNames$value = fieldNames.value,
|
|
@@ -91,13 +101,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
91
101
|
var _tooltipProps = getTooltipProps({
|
|
92
102
|
title: tagItem
|
|
93
103
|
}, tooltip);
|
|
104
|
+
var _tagNode = jsx(Text, {
|
|
105
|
+
children: tagItem
|
|
106
|
+
});
|
|
94
107
|
return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
|
|
95
|
-
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
108
|
+
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
109
|
+
style: _objectSpread({
|
|
110
|
+
maxWidth: "100%"
|
|
111
|
+
}, tagStyle)
|
|
112
|
+
}, tagProps), {}, {
|
|
96
113
|
onClose: function onClose(e) {
|
|
97
114
|
e.preventDefault();
|
|
98
115
|
_onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
|
|
99
116
|
},
|
|
100
|
-
children: contentItemRender ? contentItemRender(
|
|
117
|
+
children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
|
|
101
118
|
}), indexKey)
|
|
102
119
|
}));
|
|
103
120
|
}
|
|
@@ -110,13 +127,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
110
127
|
}, itemProps), tooltip);
|
|
111
128
|
var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
|
|
112
129
|
var cuKey = tagValue || indexKey;
|
|
130
|
+
var tagNode = jsx(Text, {
|
|
131
|
+
children: tagLabel
|
|
132
|
+
});
|
|
113
133
|
return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
114
|
-
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
134
|
+
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
135
|
+
style: _objectSpread({
|
|
136
|
+
maxWidth: "100%"
|
|
137
|
+
}, tagStyle)
|
|
138
|
+
}, cuTagProps), {}, {
|
|
115
139
|
onClose: function onClose(e) {
|
|
116
140
|
e.preventDefault();
|
|
117
141
|
cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
|
|
118
142
|
},
|
|
119
|
-
children: contentItemRender ?
|
|
143
|
+
children: contentItemRender ? tagNode : tagNode
|
|
120
144
|
}), cuKey)
|
|
121
145
|
}));
|
|
122
146
|
}), !moreLen ? null : jsx(Popover, {
|
|
@@ -134,5 +158,5 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
134
158
|
});
|
|
135
159
|
};
|
|
136
160
|
|
|
137
|
-
export { TagsComponent as default };
|
|
161
|
+
export { Text, TagsComponent as default };
|
|
138
162
|
// powered by hdj
|
|
@@ -19,6 +19,8 @@ interface IProps {
|
|
|
19
19
|
popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
20
20
|
contentItemRender?: (item: any) => React.ReactNode;
|
|
21
21
|
extra?: React.ReactNode;
|
|
22
|
+
tagStyle?: React.CSSProperties;
|
|
22
23
|
}
|
|
24
|
+
export declare const Text: React.FC;
|
|
23
25
|
declare const TagsComponent: (props: IProps) => JSX.Element;
|
|
24
26
|
export default TagsComponent;
|
|
@@ -44,6 +44,15 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
|
|
|
44
44
|
title: title
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
+
var Text = function Text(_ref) {
|
|
48
|
+
var children = _ref.children;
|
|
49
|
+
return jsxRuntime.jsx(antd.Typography.Text, {
|
|
50
|
+
ellipsis: {
|
|
51
|
+
tooltip: children
|
|
52
|
+
},
|
|
53
|
+
children: children
|
|
54
|
+
});
|
|
55
|
+
};
|
|
47
56
|
var TagsComponent = function TagsComponent(props) {
|
|
48
57
|
var data = props.data,
|
|
49
58
|
closable = props.closable,
|
|
@@ -56,7 +65,8 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
56
65
|
tableInstance = props.tableInstance,
|
|
57
66
|
maxLen = props.maxLen,
|
|
58
67
|
popoverContentRender = props.popoverContentRender,
|
|
59
|
-
extra = props.extra
|
|
68
|
+
extra = props.extra,
|
|
69
|
+
tagStyle = props.tagStyle;
|
|
60
70
|
var _fieldNames$label = fieldNames.label,
|
|
61
71
|
label = _fieldNames$label === void 0 ? "label" : _fieldNames$label,
|
|
62
72
|
_fieldNames$value = fieldNames.value,
|
|
@@ -94,13 +104,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
94
104
|
var _tooltipProps = getTooltipProps({
|
|
95
105
|
title: tagItem
|
|
96
106
|
}, tooltip);
|
|
107
|
+
var _tagNode = jsxRuntime.jsx(Text, {
|
|
108
|
+
children: tagItem
|
|
109
|
+
});
|
|
97
110
|
return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
|
|
98
|
-
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
111
|
+
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
112
|
+
style: _objectSpread({
|
|
113
|
+
maxWidth: "100%"
|
|
114
|
+
}, tagStyle)
|
|
115
|
+
}, tagProps), {}, {
|
|
99
116
|
onClose: function onClose(e) {
|
|
100
117
|
e.preventDefault();
|
|
101
118
|
_onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
|
|
102
119
|
},
|
|
103
|
-
children: contentItemRender ? contentItemRender(
|
|
120
|
+
children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
|
|
104
121
|
}), indexKey)
|
|
105
122
|
}));
|
|
106
123
|
}
|
|
@@ -113,13 +130,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
113
130
|
}, itemProps), tooltip);
|
|
114
131
|
var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
|
|
115
132
|
var cuKey = tagValue || indexKey;
|
|
133
|
+
var tagNode = jsxRuntime.jsx(Text, {
|
|
134
|
+
children: tagLabel
|
|
135
|
+
});
|
|
116
136
|
return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
117
|
-
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
137
|
+
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
138
|
+
style: _objectSpread({
|
|
139
|
+
maxWidth: "100%"
|
|
140
|
+
}, tagStyle)
|
|
141
|
+
}, cuTagProps), {}, {
|
|
118
142
|
onClose: function onClose(e) {
|
|
119
143
|
e.preventDefault();
|
|
120
144
|
cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
|
|
121
145
|
},
|
|
122
|
-
children: contentItemRender ?
|
|
146
|
+
children: contentItemRender ? tagNode : tagNode
|
|
123
147
|
}), cuKey)
|
|
124
148
|
}));
|
|
125
149
|
}), !moreLen ? null : jsxRuntime.jsx(antd.Popover, {
|
|
@@ -137,5 +161,6 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
137
161
|
});
|
|
138
162
|
};
|
|
139
163
|
|
|
164
|
+
exports.Text = Text;
|
|
140
165
|
exports.default = TagsComponent;
|
|
141
166
|
// powered by h
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Row, Tag, Tooltip, Popover, Typography} from "antd";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
import type { TooltipProps } from "antd/lib/tooltip";
|
|
4
4
|
import type { HTableInstance } from "../modal";
|
|
@@ -19,6 +19,7 @@ interface IProps {
|
|
|
19
19
|
popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
20
20
|
contentItemRender?: (item: any) => React.ReactNode;
|
|
21
21
|
extra?: React.ReactNode;
|
|
22
|
+
tagStyle?: React.CSSProperties;
|
|
22
23
|
}
|
|
23
24
|
const getTooltipProps = (
|
|
24
25
|
item: any,
|
|
@@ -43,6 +44,9 @@ const getTooltipProps = (
|
|
|
43
44
|
title,
|
|
44
45
|
};
|
|
45
46
|
};
|
|
47
|
+
export const Text:React.FC=({children})=>{
|
|
48
|
+
return <Typography.Text ellipsis={{tooltip:children}}>{children}</Typography.Text>
|
|
49
|
+
}
|
|
46
50
|
const TagsComponent = (props: IProps) => {
|
|
47
51
|
const {
|
|
48
52
|
data,
|
|
@@ -56,6 +60,7 @@ const TagsComponent = (props: IProps) => {
|
|
|
56
60
|
maxLen,
|
|
57
61
|
popoverContentRender,
|
|
58
62
|
extra,
|
|
63
|
+
tagStyle
|
|
59
64
|
} = props;
|
|
60
65
|
const { label = "label", value = "value" } = fieldNames;
|
|
61
66
|
const { tagData, moreTag } = useMemo(() => {
|
|
@@ -85,17 +90,22 @@ const TagsComponent = (props: IProps) => {
|
|
|
85
90
|
const indexKey = index.toString();
|
|
86
91
|
if (typeof tagItem === "string") {
|
|
87
92
|
const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
|
|
93
|
+
const tagNode=<Text>{tagItem}</Text>
|
|
88
94
|
return (
|
|
89
95
|
<Tooltip {...tooltipProps}>
|
|
90
96
|
<Tag
|
|
91
97
|
key={indexKey}
|
|
98
|
+
style={{
|
|
99
|
+
maxWidth: "100%",
|
|
100
|
+
...tagStyle
|
|
101
|
+
}}
|
|
92
102
|
{...tagProps}
|
|
93
103
|
onClose={(e) => {
|
|
94
104
|
e.preventDefault();
|
|
95
105
|
onClose?.(indexKey, tableInstance);
|
|
96
106
|
}}
|
|
97
107
|
>
|
|
98
|
-
{contentItemRender ? contentItemRender(
|
|
108
|
+
{contentItemRender ? contentItemRender(tagNode) : tagNode}
|
|
99
109
|
</Tag>
|
|
100
110
|
</Tooltip>
|
|
101
111
|
);
|
|
@@ -110,17 +120,22 @@ const TagsComponent = (props: IProps) => {
|
|
|
110
120
|
...itemProps,
|
|
111
121
|
};
|
|
112
122
|
const cuKey = tagValue || indexKey;
|
|
123
|
+
const tagNode=<Text>{tagLabel}</Text>
|
|
113
124
|
return (
|
|
114
125
|
<Tooltip {...tooltipProps}>
|
|
115
126
|
<Tag
|
|
116
127
|
key={cuKey}
|
|
128
|
+
style={{
|
|
129
|
+
maxWidth: "100%",
|
|
130
|
+
...tagStyle
|
|
131
|
+
}}
|
|
117
132
|
{...cuTagProps}
|
|
118
133
|
onClose={(e) => {
|
|
119
134
|
e.preventDefault();
|
|
120
135
|
cuTagProps?.onClose(cuKey, tableInstance);
|
|
121
136
|
}}
|
|
122
137
|
>
|
|
123
|
-
{contentItemRender ?
|
|
138
|
+
{contentItemRender ? tagNode : tagNode}
|
|
124
139
|
</Tag>
|
|
125
140
|
</Tooltip>
|
|
126
141
|
);
|