@ccs-ui/rc-pro 2.3.6-beta-17 → 2.3.6-beta-18

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.
@@ -4,14 +4,17 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import { CopyOutlined } from '@ant-design/icons';
7
8
  import CcsUtils from '@ccs-ui/utils';
8
- import { Tooltip } from 'antd';
9
+ import { Button, Popover } from 'antd';
9
10
  import React from 'react';
11
+ import CcsDialog from "../dialog";
10
12
  import "./index.less";
11
13
  import useMeasure from "./useMeasure";
12
14
  import { useResizeEffect } from "./useResizeEffect";
13
15
  import { withStopPropagation } from "./withStopPropagation";
14
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
18
  var classPrefix = "ccs-ellipsis";
16
19
  var defaultProps = {
17
20
  direction: 'end',
@@ -40,7 +43,7 @@ var CcsEllipsis = function CcsEllipsis(p) {
40
43
  onContentClick = props.onContentClick,
41
44
  defaultExpanded = props.defaultExpanded,
42
45
  showTooltip = props.showTooltip;
43
- var content = props.content === null ? '' : props.content.toString();
46
+ var _content = props.content === null ? '' : props.content.toString();
44
47
 
45
48
  // ============================ Refs ============================
46
49
  var rootRef = React.useRef(null);
@@ -64,10 +67,11 @@ var CcsEllipsis = function CcsEllipsis(p) {
64
67
  })) : null;
65
68
 
66
69
  // ========================== Ellipsis ==========================
67
- var _useMeasure = useMeasure(content, rows, direction, expanded, expandNode, collapseNode),
68
- _useMeasure2 = _slicedToArray(_useMeasure, 2),
70
+ var _useMeasure = useMeasure(_content, rows, direction, expanded, expandNode, collapseNode),
71
+ _useMeasure2 = _slicedToArray(_useMeasure, 3),
69
72
  measureNodes = _useMeasure2[0],
70
- forceResize = _useMeasure2[1];
73
+ status = _useMeasure2[1],
74
+ forceResize = _useMeasure2[2];
71
75
  useResizeEffect(forceResize, rootRef);
72
76
 
73
77
  // =========================== Render ===========================
@@ -81,15 +85,41 @@ var CcsEllipsis = function CcsEllipsis(p) {
81
85
  },
82
86
  children: measureNodes
83
87
  });
84
- return showTooltip ? /*#__PURE__*/_jsx(Tooltip, {
85
- zIndex: 9999,
86
- title: content,
87
- placement: "bottomLeft",
88
- destroyTooltipOnHide: true,
89
- overlayInnerStyle: {
90
- whiteSpace: 'normal'
91
- },
92
- children: renderNode
93
- }) : renderNode;
88
+ if (status === 100 || !showTooltip) {
89
+ return renderNode;
90
+ }
91
+ if (showTooltip) {
92
+ return /*#__PURE__*/_jsx(Popover, {
93
+ zIndex: 9999,
94
+ content: function content() {
95
+ return /*#__PURE__*/_jsxs("div", {
96
+ style: {
97
+ maxWidth: 300
98
+ },
99
+ children: [_content, /*#__PURE__*/_jsx("div", {
100
+ style: {
101
+ textAlign: 'right'
102
+ },
103
+ children: /*#__PURE__*/_jsx(Button, {
104
+ icon: /*#__PURE__*/_jsx(CopyOutlined, {}),
105
+ size: "small",
106
+ type: "link",
107
+ onClick: function onClick() {
108
+ var _CcsDialog$message;
109
+ CcsUtils.copy(_content);
110
+ (_CcsDialog$message = CcsDialog.message) === null || _CcsDialog$message === void 0 || _CcsDialog$message.info('复制成功');
111
+ }
112
+ })
113
+ })]
114
+ });
115
+ },
116
+ placement: "bottomLeft",
117
+ destroyTooltipOnHide: true,
118
+ overlayInnerStyle: {
119
+ whiteSpace: 'normal'
120
+ },
121
+ children: renderNode
122
+ });
123
+ }
94
124
  };
95
125
  export default CcsEllipsis;
@@ -1,2 +1,9 @@
1
1
  import React from 'react';
2
- export default function useMeasure(content: string, rows: number, direction: 'start' | 'end' | 'middle', expanded: boolean, expandNode: React.ReactElement | null, collapseNode: React.ReactElement | null): readonly [import("react/jsx-runtime").JSX.Element, () => void];
2
+ declare const enum MEASURE_STATUS {
3
+ PREPARE = 1,
4
+ MEASURE_WALKING = 2,
5
+ STABLE_ELLIPSIS = 99,
6
+ STABLE_NO_ELLIPSIS = 100
7
+ }
8
+ export default function useMeasure(content: string, rows: number, direction: 'start' | 'end' | 'middle', expanded: boolean, expandNode: React.ReactElement | null, collapseNode: React.ReactElement | null): readonly [import("react/jsx-runtime").JSX.Element, MEASURE_STATUS, () => void];
9
+ export {};
@@ -138,5 +138,5 @@ export default function useMeasure(content, rows, direction, expanded, expandNod
138
138
  children: renderContent(midIndex)
139
139
  }, "walking-mid"), finalContent]
140
140
  });
141
- return [allNodes, startMeasure];
141
+ return [allNodes, status, startMeasure];
142
142
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.6-beta-17",
3
+ "version": "2.3.6-beta-18",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {