@hw-component/table 1.10.31 → 1.10.32

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.
@@ -21,6 +21,9 @@ interface IProps {
21
21
  extra?: React.ReactNode;
22
22
  tagStyle?: React.CSSProperties;
23
23
  }
24
- export declare const Text: React.FC;
24
+ interface TextProps {
25
+ closable?: boolean;
26
+ }
27
+ export declare const Text: React.FC<TextProps>;
25
28
  declare const TagsComponent: (props: IProps) => JSX.Element;
26
29
  export default TagsComponent;
@@ -42,11 +42,16 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
42
42
  });
43
43
  };
44
44
  var Text = function Text(_ref) {
45
- var children = _ref.children;
45
+ var children = _ref.children,
46
+ closable = _ref.closable;
47
+ var maxWidth = closable ? "calc(100% - 18px)" : "100%";
46
48
  return jsx(Typography.Text, {
47
49
  ellipsis: {
48
50
  tooltip: children
49
51
  },
52
+ style: {
53
+ maxWidth: maxWidth
54
+ },
50
55
  children: children
51
56
  });
52
57
  };
@@ -96,19 +101,19 @@ var TagsComponent = function TagsComponent(props) {
96
101
  color: color,
97
102
  icon: icon
98
103
  };
99
- var tagWidth = closable ? "calc(100% - 18px)" : "100%";
100
104
  var indexKey = index.toString();
101
105
  if (typeof tagItem === "string") {
102
106
  var _tooltipProps = getTooltipProps({
103
107
  title: tagItem
104
108
  }, tooltip);
105
109
  var _tagNode = jsx(Text, {
110
+ closable: closable,
106
111
  children: tagItem
107
112
  });
108
113
  return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
109
114
  children: jsx(Tag, _objectSpread(_objectSpread({
110
115
  style: _objectSpread({
111
- maxWidth: tagWidth
116
+ maxWidth: "100%"
112
117
  }, tagStyle)
113
118
  }, tagProps), {}, {
114
119
  onClose: function onClose(e) {
@@ -129,12 +134,13 @@ var TagsComponent = function TagsComponent(props) {
129
134
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
130
135
  var cuKey = tagValue || indexKey;
131
136
  var tagNode = jsx(Text, {
137
+ closable: closable,
132
138
  children: tagLabel
133
139
  });
134
140
  return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
135
141
  children: jsx(Tag, _objectSpread(_objectSpread({
136
142
  style: _objectSpread({
137
- maxWidth: tagWidth
143
+ maxWidth: "100%"
138
144
  }, tagStyle)
139
145
  }, cuTagProps), {}, {
140
146
  onClose: function onClose(e) {
@@ -21,6 +21,9 @@ interface IProps {
21
21
  extra?: React.ReactNode;
22
22
  tagStyle?: React.CSSProperties;
23
23
  }
24
- export declare const Text: React.FC;
24
+ interface TextProps {
25
+ closable?: boolean;
26
+ }
27
+ export declare const Text: React.FC<TextProps>;
25
28
  declare const TagsComponent: (props: IProps) => JSX.Element;
26
29
  export default TagsComponent;
@@ -45,11 +45,16 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
45
45
  });
46
46
  };
47
47
  var Text = function Text(_ref) {
48
- var children = _ref.children;
48
+ var children = _ref.children,
49
+ closable = _ref.closable;
50
+ var maxWidth = closable ? "calc(100% - 18px)" : "100%";
49
51
  return jsxRuntime.jsx(antd.Typography.Text, {
50
52
  ellipsis: {
51
53
  tooltip: children
52
54
  },
55
+ style: {
56
+ maxWidth: maxWidth
57
+ },
53
58
  children: children
54
59
  });
55
60
  };
@@ -99,19 +104,19 @@ var TagsComponent = function TagsComponent(props) {
99
104
  color: color,
100
105
  icon: icon
101
106
  };
102
- var tagWidth = closable ? "calc(100% - 18px)" : "100%";
103
107
  var indexKey = index.toString();
104
108
  if (typeof tagItem === "string") {
105
109
  var _tooltipProps = getTooltipProps({
106
110
  title: tagItem
107
111
  }, tooltip);
108
112
  var _tagNode = jsxRuntime.jsx(Text, {
113
+ closable: closable,
109
114
  children: tagItem
110
115
  });
111
116
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
112
117
  children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
113
118
  style: _objectSpread({
114
- maxWidth: tagWidth
119
+ maxWidth: "100%"
115
120
  }, tagStyle)
116
121
  }, tagProps), {}, {
117
122
  onClose: function onClose(e) {
@@ -132,12 +137,13 @@ var TagsComponent = function TagsComponent(props) {
132
137
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
133
138
  var cuKey = tagValue || indexKey;
134
139
  var tagNode = jsxRuntime.jsx(Text, {
140
+ closable: closable,
135
141
  children: tagLabel
136
142
  });
137
143
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
138
144
  children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
139
145
  style: _objectSpread({
140
- maxWidth: tagWidth
146
+ maxWidth: "100%"
141
147
  }, tagStyle)
142
148
  }, cuTagProps), {}, {
143
149
  onClose: function onClose(e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.10.31",
3
+ "version": "1.10.32",
4
4
  "description": "基于antd二次开发table组件",
5
5
  "keywords": [
6
6
  "table"
@@ -44,8 +44,12 @@ const getTooltipProps = (
44
44
  title,
45
45
  };
46
46
  };
47
- export const Text:React.FC=({children})=>{
48
- return <Typography.Text ellipsis={{tooltip:children}}>{children}</Typography.Text>
47
+ interface TextProps {
48
+ closable?: boolean;
49
+ }
50
+ export const Text:React.FC<TextProps>=({children,closable})=>{
51
+ const maxWidth=closable?`calc(100% - 18px)`:"100%";
52
+ return <Typography.Text ellipsis={{tooltip:children}} style={{maxWidth}}>{children}</Typography.Text>
49
53
  }
50
54
  const TagsComponent = (props: IProps) => {
51
55
  const {
@@ -91,13 +95,13 @@ const TagsComponent = (props: IProps) => {
91
95
  const indexKey = index.toString();
92
96
  if (typeof tagItem === "string") {
93
97
  const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
94
- const tagNode=<Text>{tagItem}</Text>
98
+ const tagNode=<Text closable={closable}>{tagItem}</Text>
95
99
  return (
96
100
  <Tooltip {...tooltipProps}>
97
101
  <Tag
98
102
  key={indexKey}
99
103
  style={{
100
- maxWidth:tagWidth,
104
+ maxWidth:"100%",
101
105
  ...tagStyle
102
106
  }}
103
107
  {...tagProps}
@@ -121,13 +125,13 @@ const TagsComponent = (props: IProps) => {
121
125
  ...itemProps,
122
126
  };
123
127
  const cuKey = tagValue || indexKey;
124
- const tagNode=<Text>{tagLabel}</Text>
128
+ const tagNode=<Text closable={closable}>{tagLabel}</Text>
125
129
  return (
126
130
  <Tooltip {...tooltipProps}>
127
131
  <Tag
128
132
  key={cuKey}
129
133
  style={{
130
- maxWidth:tagWidth,
134
+ maxWidth:"100%",
131
135
  ...tagStyle
132
136
  }}
133
137
  {...cuTagProps}