@hw-component/table 1.10.31 → 1.10.33
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.
- package/es/index.css +11 -0
- package/es/render/TagsComponent.d.ts +4 -1
- package/es/render/TagsComponent.js +16 -5
- package/lib/index.css +11 -0
- package/lib/render/TagsComponent.d.ts +4 -1
- package/lib/render/TagsComponent.js +16 -5
- package/package.json +1 -1
- package/src/components/index.less +10 -0
- package/src/components/render/TagsComponent.tsx +12 -7
- package/src/pages/Table/index.tsx +5 -0
package/es/index.css
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
.ant-hw-table-render-tag {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.ant-hw-table-render-tag .ant-tag-close-icon {
|
|
5
|
+
position: absolute;
|
|
6
|
+
right: 7px;
|
|
7
|
+
top: 50%;
|
|
8
|
+
-webkit-transform: translateY(-50%);
|
|
9
|
+
-ms-transform: translateY(-50%);
|
|
10
|
+
transform: translateY(-50%);
|
|
11
|
+
}
|
|
1
12
|
.ant-hw-table-content .ant-hw-table-body {
|
|
2
13
|
padding-top: 0;
|
|
3
14
|
border-top-left-radius: 0;
|
|
@@ -21,6 +21,9 @@ interface IProps {
|
|
|
21
21
|
extra?: React.ReactNode;
|
|
22
22
|
tagStyle?: React.CSSProperties;
|
|
23
23
|
}
|
|
24
|
-
|
|
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;
|
|
@@ -16,6 +16,7 @@ import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance
|
|
|
16
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
17
17
|
import { Row, Tooltip, Tag, Popover, Typography } from 'antd';
|
|
18
18
|
import { useMemo } from 'react';
|
|
19
|
+
import { useClassName } from '../hooks/index.js';
|
|
19
20
|
|
|
20
21
|
var _excluded = ["contentItemRender"];
|
|
21
22
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
@@ -42,10 +43,17 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
|
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
45
|
var Text = function Text(_ref) {
|
|
45
|
-
var children = _ref.children
|
|
46
|
+
var children = _ref.children,
|
|
47
|
+
closable = _ref.closable;
|
|
46
48
|
return jsx(Typography.Text, {
|
|
47
49
|
ellipsis: {
|
|
48
|
-
tooltip:
|
|
50
|
+
tooltip: {
|
|
51
|
+
title: children,
|
|
52
|
+
placement: "topLeft"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
style: {
|
|
56
|
+
paddingRight: closable ? 17 : 0
|
|
49
57
|
},
|
|
50
58
|
children: children
|
|
51
59
|
});
|
|
@@ -64,6 +72,7 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
64
72
|
popoverContentRender = props.popoverContentRender,
|
|
65
73
|
extra = props.extra,
|
|
66
74
|
tagStyle = props.tagStyle;
|
|
75
|
+
var tagClassName = useClassName("hw-table-render-tag");
|
|
67
76
|
var _fieldNames$label = fieldNames.label,
|
|
68
77
|
label = _fieldNames$label === void 0 ? "label" : _fieldNames$label,
|
|
69
78
|
_fieldNames$value = fieldNames.value,
|
|
@@ -96,19 +105,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
96
105
|
color: color,
|
|
97
106
|
icon: icon
|
|
98
107
|
};
|
|
99
|
-
var tagWidth = closable ? "calc(100% - 18px)" : "100%";
|
|
100
108
|
var indexKey = index.toString();
|
|
101
109
|
if (typeof tagItem === "string") {
|
|
102
110
|
var _tooltipProps = getTooltipProps({
|
|
103
111
|
title: tagItem
|
|
104
112
|
}, tooltip);
|
|
105
113
|
var _tagNode = jsx(Text, {
|
|
114
|
+
closable: closable,
|
|
106
115
|
children: tagItem
|
|
107
116
|
});
|
|
108
117
|
return jsx(Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
|
|
109
118
|
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
119
|
+
className: tagClassName,
|
|
110
120
|
style: _objectSpread({
|
|
111
|
-
maxWidth:
|
|
121
|
+
maxWidth: "100%"
|
|
112
122
|
}, tagStyle)
|
|
113
123
|
}, tagProps), {}, {
|
|
114
124
|
onClose: function onClose(e) {
|
|
@@ -129,12 +139,13 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
129
139
|
var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
|
|
130
140
|
var cuKey = tagValue || indexKey;
|
|
131
141
|
var tagNode = jsx(Text, {
|
|
142
|
+
closable: closable,
|
|
132
143
|
children: tagLabel
|
|
133
144
|
});
|
|
134
145
|
return jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
135
146
|
children: jsx(Tag, _objectSpread(_objectSpread({
|
|
136
147
|
style: _objectSpread({
|
|
137
|
-
maxWidth:
|
|
148
|
+
maxWidth: "100%"
|
|
138
149
|
}, tagStyle)
|
|
139
150
|
}, cuTagProps), {}, {
|
|
140
151
|
onClose: function onClose(e) {
|
package/lib/index.css
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
.ant-hw-table-render-tag {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.ant-hw-table-render-tag .ant-tag-close-icon {
|
|
5
|
+
position: absolute;
|
|
6
|
+
right: 7px;
|
|
7
|
+
top: 50%;
|
|
8
|
+
-webkit-transform: translateY(-50%);
|
|
9
|
+
-ms-transform: translateY(-50%);
|
|
10
|
+
transform: translateY(-50%);
|
|
11
|
+
}
|
|
1
12
|
.ant-hw-table-content .ant-hw-table-body {
|
|
2
13
|
padding-top: 0;
|
|
3
14
|
border-top-left-radius: 0;
|
|
@@ -21,6 +21,9 @@ interface IProps {
|
|
|
21
21
|
extra?: React.ReactNode;
|
|
22
22
|
tagStyle?: React.CSSProperties;
|
|
23
23
|
}
|
|
24
|
-
|
|
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;
|
|
@@ -19,6 +19,7 @@ var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instan
|
|
|
19
19
|
var jsxRuntime = require('react/jsx-runtime');
|
|
20
20
|
var antd = require('antd');
|
|
21
21
|
var React = require('react');
|
|
22
|
+
var index = require('../hooks/index.js');
|
|
22
23
|
|
|
23
24
|
var _excluded = ["contentItemRender"];
|
|
24
25
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
@@ -45,10 +46,17 @@ var getTooltipProps = function getTooltipProps(item, tooltip) {
|
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
var Text = function Text(_ref) {
|
|
48
|
-
var children = _ref.children
|
|
49
|
+
var children = _ref.children,
|
|
50
|
+
closable = _ref.closable;
|
|
49
51
|
return jsxRuntime.jsx(antd.Typography.Text, {
|
|
50
52
|
ellipsis: {
|
|
51
|
-
tooltip:
|
|
53
|
+
tooltip: {
|
|
54
|
+
title: children,
|
|
55
|
+
placement: "topLeft"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
style: {
|
|
59
|
+
paddingRight: closable ? 17 : 0
|
|
52
60
|
},
|
|
53
61
|
children: children
|
|
54
62
|
});
|
|
@@ -67,6 +75,7 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
67
75
|
popoverContentRender = props.popoverContentRender,
|
|
68
76
|
extra = props.extra,
|
|
69
77
|
tagStyle = props.tagStyle;
|
|
78
|
+
var tagClassName = index.useClassName("hw-table-render-tag");
|
|
70
79
|
var _fieldNames$label = fieldNames.label,
|
|
71
80
|
label = _fieldNames$label === void 0 ? "label" : _fieldNames$label,
|
|
72
81
|
_fieldNames$value = fieldNames.value,
|
|
@@ -99,19 +108,20 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
99
108
|
color: color,
|
|
100
109
|
icon: icon
|
|
101
110
|
};
|
|
102
|
-
var tagWidth = closable ? "calc(100% - 18px)" : "100%";
|
|
103
111
|
var indexKey = index.toString();
|
|
104
112
|
if (typeof tagItem === "string") {
|
|
105
113
|
var _tooltipProps = getTooltipProps({
|
|
106
114
|
title: tagItem
|
|
107
115
|
}, tooltip);
|
|
108
116
|
var _tagNode = jsxRuntime.jsx(Text, {
|
|
117
|
+
closable: closable,
|
|
109
118
|
children: tagItem
|
|
110
119
|
});
|
|
111
120
|
return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, _tooltipProps), {}, {
|
|
112
121
|
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
122
|
+
className: tagClassName,
|
|
113
123
|
style: _objectSpread({
|
|
114
|
-
maxWidth:
|
|
124
|
+
maxWidth: "100%"
|
|
115
125
|
}, tagStyle)
|
|
116
126
|
}, tagProps), {}, {
|
|
117
127
|
onClose: function onClose(e) {
|
|
@@ -132,12 +142,13 @@ var TagsComponent = function TagsComponent(props) {
|
|
|
132
142
|
var cuTagProps = _objectSpread(_objectSpread({}, tagProps), itemProps);
|
|
133
143
|
var cuKey = tagValue || indexKey;
|
|
134
144
|
var tagNode = jsxRuntime.jsx(Text, {
|
|
145
|
+
closable: closable,
|
|
135
146
|
children: tagLabel
|
|
136
147
|
});
|
|
137
148
|
return jsxRuntime.jsx(antd.Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
138
149
|
children: jsxRuntime.jsx(antd.Tag, _objectSpread(_objectSpread({
|
|
139
150
|
style: _objectSpread({
|
|
140
|
-
maxWidth:
|
|
151
|
+
maxWidth: "100%"
|
|
141
152
|
}, tagStyle)
|
|
142
153
|
}, cuTagProps), {}, {
|
|
143
154
|
onClose: function onClose(e) {
|
package/package.json
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
@import "./styles/local.less";
|
|
2
|
+
|
|
3
|
+
.@{ant-prefix}-hw-table-render-tag {
|
|
4
|
+
position: relative;
|
|
5
|
+
.@{ant-prefix}-tag-close-icon{
|
|
6
|
+
position: absolute;
|
|
7
|
+
right: 7px;
|
|
8
|
+
top: 50%;
|
|
9
|
+
transform: translateY(-50%);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
2
12
|
.@{ant-prefix}-hw-table-content {
|
|
3
13
|
.@{ant-prefix}-hw-table-body {
|
|
4
14
|
padding-top: 0;
|
|
@@ -2,6 +2,7 @@ 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";
|
|
5
|
+
import {useClassName} from "../hooks";
|
|
5
6
|
|
|
6
7
|
type CloseFn = (key: string, tableInstance?: HTableInstance) => void;
|
|
7
8
|
type TooltipRender = (item: any) => TooltipProps;
|
|
@@ -44,8 +45,11 @@ const getTooltipProps = (
|
|
|
44
45
|
title,
|
|
45
46
|
};
|
|
46
47
|
};
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
interface TextProps {
|
|
49
|
+
closable?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export const Text:React.FC<TextProps>=({children,closable})=>{
|
|
52
|
+
return <Typography.Text ellipsis={{tooltip:{title:children,placement:"topLeft"}}} style={{paddingRight:closable?17:0}}>{children}</Typography.Text>
|
|
49
53
|
}
|
|
50
54
|
const TagsComponent = (props: IProps) => {
|
|
51
55
|
const {
|
|
@@ -62,6 +66,7 @@ const TagsComponent = (props: IProps) => {
|
|
|
62
66
|
extra,
|
|
63
67
|
tagStyle
|
|
64
68
|
} = props;
|
|
69
|
+
const tagClassName=useClassName("hw-table-render-tag");
|
|
65
70
|
const { label = "label", value = "value" } = fieldNames;
|
|
66
71
|
const { tagData, moreTag } = useMemo(() => {
|
|
67
72
|
if (!maxLen || !data) {
|
|
@@ -87,17 +92,17 @@ const TagsComponent = (props: IProps) => {
|
|
|
87
92
|
color,
|
|
88
93
|
icon,
|
|
89
94
|
};
|
|
90
|
-
const tagWidth=closable?`calc(100% - 18px)`:"100%";
|
|
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}
|
|
103
|
+
className={tagClassName}
|
|
99
104
|
style={{
|
|
100
|
-
maxWidth:
|
|
105
|
+
maxWidth:"100%",
|
|
101
106
|
...tagStyle
|
|
102
107
|
}}
|
|
103
108
|
{...tagProps}
|
|
@@ -121,13 +126,13 @@ const TagsComponent = (props: IProps) => {
|
|
|
121
126
|
...itemProps,
|
|
122
127
|
};
|
|
123
128
|
const cuKey = tagValue || indexKey;
|
|
124
|
-
const tagNode=<Text>{tagLabel}</Text>
|
|
129
|
+
const tagNode=<Text closable={closable}>{tagLabel}</Text>
|
|
125
130
|
return (
|
|
126
131
|
<Tooltip {...tooltipProps}>
|
|
127
132
|
<Tag
|
|
128
133
|
key={cuKey}
|
|
129
134
|
style={{
|
|
130
|
-
maxWidth:
|
|
135
|
+
maxWidth:"100%",
|
|
131
136
|
...tagStyle
|
|
132
137
|
}}
|
|
133
138
|
{...cuTagProps}
|
|
@@ -97,6 +97,7 @@ const listReq = (params) => {
|
|
|
97
97
|
records.push({
|
|
98
98
|
id: `${current}-${i}`,
|
|
99
99
|
lastPullGroupTime: 1760420231,
|
|
100
|
+
op3:["1231231232132131231321321312331231331321","2222"]
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
resolve({
|
|
@@ -163,6 +164,10 @@ export default () => {
|
|
|
163
164
|
dataIndex: "op3",
|
|
164
165
|
width: 120,
|
|
165
166
|
fixed: "right",
|
|
167
|
+
valueType:"tags",
|
|
168
|
+
valueTypeProps: {
|
|
169
|
+
closable: true,
|
|
170
|
+
}
|
|
166
171
|
},
|
|
167
172
|
]);
|
|
168
173
|
return (
|