@hw-component/table 1.9.69 → 1.9.70
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.
|
@@ -16,6 +16,7 @@ interface IProps {
|
|
|
16
16
|
tableInstance?: HTableInstance;
|
|
17
17
|
maxLen?: number | null;
|
|
18
18
|
popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
19
|
+
contentItemRender?: (item: any) => React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
declare const TagsComponent: (props: IProps) => JSX.Element;
|
|
21
22
|
export default TagsComponent;
|
|
@@ -17,6 +17,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
17
17
|
import { Row, Tooltip, Tag, Popover } from 'antd';
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
19
|
|
|
20
|
+
var _excluded = ["contentItemRender"];
|
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
21
22
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[_Symbol$toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
22
23
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -68,6 +69,8 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
68
69
|
tagData = _useMemo.tagData,
|
|
69
70
|
moreTag = _useMemo.moreTag;
|
|
70
71
|
var moreLen = moreTag === null || moreTag === void 0 ? void 0 : moreTag.length;
|
|
72
|
+
var contentItemRender = props.contentItemRender,
|
|
73
|
+
childProps = _objectWithoutProperties(props, _excluded);
|
|
71
74
|
return jsxs(Row, {
|
|
72
75
|
gutter: [0, 8],
|
|
73
76
|
children: [tagData === null || tagData === void 0 ? void 0 : _mapInstanceProperty(tagData).call(tagData, function (tagItem, index) {
|
|
@@ -87,7 +90,7 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
87
90
|
e.preventDefault();
|
|
88
91
|
_onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
|
|
89
92
|
},
|
|
90
|
-
children: tagItem
|
|
93
|
+
children: contentItemRender ? contentItemRender(tagItem) : tagItem
|
|
91
94
|
}), indexKey)
|
|
92
95
|
}));
|
|
93
96
|
}
|
|
@@ -103,13 +106,13 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
103
106
|
e.preventDefault();
|
|
104
107
|
cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
|
|
105
108
|
},
|
|
106
|
-
children: tagLabel
|
|
109
|
+
children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
|
|
107
110
|
}), cuKey)
|
|
108
111
|
}));
|
|
109
112
|
}), !moreLen ? null : jsx(Popover, {
|
|
110
|
-
content: popoverContentRender ? popoverContentRender(jsx(TagsComponent, _objectSpread(_objectSpread({},
|
|
113
|
+
content: popoverContentRender ? popoverContentRender(jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
111
114
|
maxLen: null
|
|
112
|
-
}))) : jsx(TagsComponent, _objectSpread(_objectSpread({},
|
|
115
|
+
}))) : jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
113
116
|
maxLen: null
|
|
114
117
|
})),
|
|
115
118
|
children: jsxs(Tag, {
|
|
@@ -16,6 +16,7 @@ interface IProps {
|
|
|
16
16
|
tableInstance?: HTableInstance;
|
|
17
17
|
maxLen?: number | null;
|
|
18
18
|
popoverContentRender?: (node: React.ReactNode) => React.ReactNode;
|
|
19
|
+
contentItemRender?: (item: any) => React.ReactNode;
|
|
19
20
|
}
|
|
20
21
|
declare const TagsComponent: (props: IProps) => JSX.Element;
|
|
21
22
|
export default TagsComponent;
|
|
@@ -20,6 +20,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
20
20
|
var antd = require('antd');
|
|
21
21
|
var React = require('react');
|
|
22
22
|
|
|
23
|
+
var _excluded = ["contentItemRender"];
|
|
23
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
25
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[_Symbol$toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
25
26
|
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -71,6 +72,8 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
71
72
|
tagData = _useMemo.tagData,
|
|
72
73
|
moreTag = _useMemo.moreTag;
|
|
73
74
|
var moreLen = moreTag === null || moreTag === void 0 ? void 0 : moreTag.length;
|
|
75
|
+
var contentItemRender = props.contentItemRender,
|
|
76
|
+
childProps = _objectWithoutProperties(props, _excluded);
|
|
74
77
|
return jsxRuntime.jsxs(antd.Row, {
|
|
75
78
|
gutter: [0, 8],
|
|
76
79
|
children: [tagData === null || tagData === void 0 ? void 0 : _mapInstanceProperty(tagData).call(tagData, function (tagItem, index) {
|
|
@@ -90,7 +93,7 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
90
93
|
e.preventDefault();
|
|
91
94
|
_onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
|
|
92
95
|
},
|
|
93
|
-
children: tagItem
|
|
96
|
+
children: contentItemRender ? contentItemRender(tagItem) : tagItem
|
|
94
97
|
}), indexKey)
|
|
95
98
|
}));
|
|
96
99
|
}
|
|
@@ -106,13 +109,13 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
106
109
|
e.preventDefault();
|
|
107
110
|
cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
|
|
108
111
|
},
|
|
109
|
-
children: tagLabel
|
|
112
|
+
children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
|
|
110
113
|
}), cuKey)
|
|
111
114
|
}));
|
|
112
115
|
}), !moreLen ? null : jsxRuntime.jsx(antd.Popover, {
|
|
113
|
-
content: popoverContentRender ? popoverContentRender(jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({},
|
|
116
|
+
content: popoverContentRender ? popoverContentRender(jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
114
117
|
maxLen: null
|
|
115
|
-
}))) : jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({},
|
|
118
|
+
}))) : jsxRuntime.jsx(TagsComponent, _objectSpread(_objectSpread({}, childProps), {}, {
|
|
116
119
|
maxLen: null
|
|
117
120
|
})),
|
|
118
121
|
children: jsxRuntime.jsxs(antd.Tag, {
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ interface IProps {
|
|
|
14
14
|
tableInstance?: HTableInstance;
|
|
15
15
|
maxLen?: number | null;
|
|
16
16
|
popoverContentRender?:(node:React.ReactNode)=>React.ReactNode;
|
|
17
|
+
contentItemRender?:(item:any)=>React.ReactNode;
|
|
17
18
|
}
|
|
18
19
|
const getTooltipProps = (
|
|
19
20
|
title: string,
|
|
@@ -62,7 +63,7 @@ const TagsComponent = (props: IProps) => {
|
|
|
62
63
|
};
|
|
63
64
|
}, [data, maxLen]);
|
|
64
65
|
const moreLen = moreTag?.length;
|
|
65
|
-
|
|
66
|
+
const {contentItemRender,...childProps}=props;
|
|
66
67
|
return (
|
|
67
68
|
<Row gutter={[0, 8]}>
|
|
68
69
|
{tagData?.map((tagItem, index) => {
|
|
@@ -85,7 +86,7 @@ const TagsComponent = (props: IProps) => {
|
|
|
85
86
|
onClose?.(indexKey, tableInstance);
|
|
86
87
|
}}
|
|
87
88
|
>
|
|
88
|
-
{tagItem}
|
|
89
|
+
{contentItemRender?contentItemRender(tagItem):tagItem}
|
|
89
90
|
</Tag>
|
|
90
91
|
</Tooltip>
|
|
91
92
|
);
|
|
@@ -107,13 +108,13 @@ const TagsComponent = (props: IProps) => {
|
|
|
107
108
|
cuTagProps?.onClose(cuKey, tableInstance);
|
|
108
109
|
}}
|
|
109
110
|
>
|
|
110
|
-
{tagLabel}
|
|
111
|
+
{contentItemRender?contentItemRender(tagLabel):tagLabel}
|
|
111
112
|
</Tag>
|
|
112
113
|
</Tooltip>
|
|
113
114
|
);
|
|
114
115
|
})}
|
|
115
116
|
{!moreLen ? null : (
|
|
116
|
-
<Popover content={popoverContentRender?popoverContentRender(<TagsComponent {...
|
|
117
|
+
<Popover content={popoverContentRender?popoverContentRender(<TagsComponent {...childProps} maxLen={null} />):<TagsComponent {...childProps} maxLen={null} />}>
|
|
117
118
|
<Tag>...等{data.length}个</Tag>
|
|
118
119
|
</Popover>
|
|
119
120
|
)}
|