@hw-component/table 1.10.30 → 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
  };
@@ -102,6 +107,7 @@ var TagsComponent = function TagsComponent(props) {
102
107
  title: tagItem
103
108
  }, tooltip);
104
109
  var _tagNode = jsx(Text, {
110
+ closable: closable,
105
111
  children: tagItem
106
112
  });
107
113
  return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
@@ -128,6 +134,7 @@ var TagsComponent = function TagsComponent(props) {
128
134
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
129
135
  var cuKey = tagValue || indexKey;
130
136
  var tagNode = jsx(Text, {
137
+ closable: closable,
131
138
  children: tagLabel
132
139
  });
133
140
  return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
@@ -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
  };
@@ -105,6 +110,7 @@ var TagsComponent = function TagsComponent(props) {
105
110
  title: tagItem
106
111
  }, tooltip);
107
112
  var _tagNode = jsxRuntime.jsx(Text, {
113
+ closable: closable,
108
114
  children: tagItem
109
115
  });
110
116
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
@@ -131,6 +137,7 @@ var TagsComponent = function TagsComponent(props) {
131
137
  var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
132
138
  var cuKey = tagValue || indexKey;
133
139
  var tagNode = jsxRuntime.jsx(Text, {
140
+ closable: closable,
134
141
  children: tagLabel
135
142
  });
136
143
  return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/table",
3
- "version": "1.10.30",
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 {
@@ -87,16 +91,17 @@ const TagsComponent = (props: IProps) => {
87
91
  color,
88
92
  icon,
89
93
  };
94
+ const tagWidth=closable?`calc(100% - 18px)`:"100%";
90
95
  const indexKey = index.toString();
91
96
  if (typeof tagItem === "string") {
92
97
  const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
93
- const tagNode=<Text>{tagItem}</Text>
98
+ const tagNode=<Text closable={closable}>{tagItem}</Text>
94
99
  return (
95
100
  <Tooltip {...tooltipProps}>
96
101
  <Tag
97
102
  key={indexKey}
98
103
  style={{
99
- maxWidth: "100%",
104
+ maxWidth:"100%",
100
105
  ...tagStyle
101
106
  }}
102
107
  {...tagProps}
@@ -120,13 +125,13 @@ const TagsComponent = (props: IProps) => {
120
125
  ...itemProps,
121
126
  };
122
127
  const cuKey = tagValue || indexKey;
123
- const tagNode=<Text>{tagLabel}</Text>
128
+ const tagNode=<Text closable={closable}>{tagLabel}</Text>
124
129
  return (
125
130
  <Tooltip {...tooltipProps}>
126
131
  <Tag
127
132
  key={cuKey}
128
133
  style={{
129
- maxWidth: "100%",
134
+ maxWidth:"100%",
130
135
  ...tagStyle
131
136
  }}
132
137
  {...cuTagProps}