@hw-component/table 1.10.28 → 1.10.29

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.
@@ -20,5 +20,6 @@ interface IProps {
20
20
  contentItemRender?: (item: any) => React.ReactNode;
21
21
  extra?: React.ReactNode;
22
22
  }
23
+ export declare const Text: React.FC;
23
24
  declare const TagsComponent: (props: IProps) => JSX.Element;
24
25
  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,
@@ -91,13 +100,20 @@ var TagsComponent = function TagsComponent(props) {
91
100
  var _tooltipProps = getTooltipProps({
92
101
  title: tagItem
93
102
  }, tooltip);
103
+ var _tagNode = jsx(Text, {
104
+ children: tagItem
105
+ });
94
106
  return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
95
- children: jsx(Tag, _objectSpread(_objectSpread({}, tagProps), {}, {
107
+ children: jsx(Tag, _objectSpread(_objectSpread({
108
+ style: {
109
+ maxWidth: "100%"
110
+ }
111
+ }, tagProps), {}, {
96
112
  onClose: function onClose(e) {
97
113
  e.preventDefault();
98
114
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
99
115
  },
100
- children: contentItemRender ? contentItemRender(tagItem) : tagItem
116
+ children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
101
117
  }), indexKey)
102
118
  }));
103
119
  }
@@ -110,13 +126,20 @@ var TagsComponent = function TagsComponent(props) {
110
126
  }, itemProps), tooltip);
111
127
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
112
128
  var cuKey = tagValue || indexKey;
129
+ var tagNode = jsx(Text, {
130
+ children: tagLabel
131
+ });
113
132
  return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
114
- children: jsx(Tag, _objectSpread(_objectSpread({}, cuTagProps), {}, {
133
+ children: jsx(Tag, _objectSpread(_objectSpread({
134
+ style: {
135
+ maxWidth: "100%"
136
+ }
137
+ }, cuTagProps), {}, {
115
138
  onClose: function onClose(e) {
116
139
  e.preventDefault();
117
140
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
118
141
  },
119
- children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
142
+ children: contentItemRender ? tagNode : tagNode
120
143
  }), cuKey)
121
144
  }));
122
145
  }), !moreLen ? null : jsx(Popover, {
@@ -134,5 +157,5 @@ var TagsComponent = function TagsComponent(props) {
134
157
  });
135
158
  };
136
159
 
137
- export { TagsComponent as default };
160
+ export { Text, TagsComponent as default };
138
161
  // powered by hdj
@@ -20,5 +20,6 @@ interface IProps {
20
20
  contentItemRender?: (item: any) => React.ReactNode;
21
21
  extra?: React.ReactNode;
22
22
  }
23
+ export declare const Text: React.FC;
23
24
  declare const TagsComponent: (props: IProps) => JSX.Element;
24
25
  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,
@@ -94,13 +103,20 @@ var TagsComponent = function TagsComponent(props) {
94
103
  var _tooltipProps = getTooltipProps({
95
104
  title: tagItem
96
105
  }, tooltip);
106
+ var _tagNode = jsxRuntime.jsx(Text, {
107
+ children: tagItem
108
+ });
97
109
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
98
- children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({}, tagProps), {}, {
110
+ children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
111
+ style: {
112
+ maxWidth: "100%"
113
+ }
114
+ }, tagProps), {}, {
99
115
  onClose: function onClose(e) {
100
116
  e.preventDefault();
101
117
  _onClose === null || _onClose === void 0 || _onClose(indexKey, tableInstance);
102
118
  },
103
- children: contentItemRender ? contentItemRender(tagItem) : tagItem
119
+ children: contentItemRender ? contentItemRender(_tagNode) : _tagNode
104
120
  }), indexKey)
105
121
  }));
106
122
  }
@@ -113,13 +129,20 @@ var TagsComponent = function TagsComponent(props) {
113
129
  }, itemProps), tooltip);
114
130
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
115
131
  var cuKey = tagValue || indexKey;
132
+ var tagNode = jsxRuntime.jsx(Text, {
133
+ children: tagLabel
134
+ });
116
135
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
117
- children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({}, cuTagProps), {}, {
136
+ children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
137
+ style: {
138
+ maxWidth: "100%"
139
+ }
140
+ }, cuTagProps), {}, {
118
141
  onClose: function onClose(e) {
119
142
  e.preventDefault();
120
143
  cuTagProps === null || cuTagProps === void 0 || cuTagProps.onClose(cuKey, tableInstance);
121
144
  },
122
- children: contentItemRender ? contentItemRender(tagLabel) : tagLabel
145
+ children: contentItemRender ? tagNode : tagNode
123
146
  }), cuKey)
124
147
  }));
125
148
  }), !moreLen ? null : jsxRuntime.jsx(antd.Popover, {
@@ -137,5 +160,6 @@ var TagsComponent = function TagsComponent(props) {
137
160
  });
138
161
  };
139
162
 
163
+ exports.Text = Text;
140
164
  exports.default = TagsComponent;
141
165
  // powered by h
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.10.28",
3
+ "version": "1.10.29",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -1,4 +1,4 @@
1
- import { Row, Tag, Tooltip, Popover } from "antd";
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";
@@ -43,6 +43,9 @@ const getTooltipProps = (
43
43
  title,
44
44
  };
45
45
  };
46
+ export const Text:React.FC=({children})=>{
47
+ return <Typography.Text ellipsis={{tooltip:children}}>{children}</Typography.Text>
48
+ }
46
49
  const TagsComponent = (props: IProps) => {
47
50
  const {
48
51
  data,
@@ -85,17 +88,21 @@ const TagsComponent = (props: IProps) => {
85
88
  const indexKey = index.toString();
86
89
  if (typeof tagItem === "string") {
87
90
  const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
91
+ const tagNode=<Text>{tagItem}</Text>
88
92
  return (
89
93
  <Tooltip {...tooltipProps}>
90
94
  <Tag
91
95
  key={indexKey}
96
+ style={{
97
+ maxWidth: "100%",
98
+ }}
92
99
  {...tagProps}
93
100
  onClose={(e) => {
94
101
  e.preventDefault();
95
102
  onClose?.(indexKey, tableInstance);
96
103
  }}
97
104
  >
98
- {contentItemRender ? contentItemRender(tagItem) : tagItem}
105
+ {contentItemRender ? contentItemRender(tagNode) : tagNode}
99
106
  </Tag>
100
107
  </Tooltip>
101
108
  );
@@ -110,17 +117,21 @@ const TagsComponent = (props: IProps) => {
110
117
  ...itemProps,
111
118
  };
112
119
  const cuKey = tagValue || indexKey;
120
+ const tagNode=<Text>{tagLabel}</Text>
113
121
  return (
114
122
  <Tooltip {...tooltipProps}>
115
123
  <Tag
116
124
  key={cuKey}
125
+ style={{
126
+ maxWidth: "100%",
127
+ }}
117
128
  {...cuTagProps}
118
129
  onClose={(e) => {
119
130
  e.preventDefault();
120
131
  cuTagProps?.onClose(cuKey, tableInstance);
121
132
  }}
122
133
  >
123
- {contentItemRender ? contentItemRender(tagLabel) : tagLabel}
134
+ {contentItemRender ? tagNode : tagNode}
124
135
  </Tag>
125
136
  </Tooltip>
126
137
  );