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

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,18 @@ 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, Tooltip } 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 { Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
19
  var classPrefix = "ccs-ellipsis";
16
20
  var defaultProps = {
17
21
  direction: 'end',
@@ -65,9 +69,10 @@ var CcsEllipsis = function CcsEllipsis(p) {
65
69
 
66
70
  // ========================== Ellipsis ==========================
67
71
  var _useMeasure = useMeasure(content, rows, direction, expanded, expandNode, collapseNode),
68
- _useMeasure2 = _slicedToArray(_useMeasure, 2),
72
+ _useMeasure2 = _slicedToArray(_useMeasure, 3),
69
73
  measureNodes = _useMeasure2[0],
70
- forceResize = _useMeasure2[1];
74
+ status = _useMeasure2[1],
75
+ forceResize = _useMeasure2[2];
71
76
  useResizeEffect(forceResize, rootRef);
72
77
 
73
78
  // =========================== Render ===========================
@@ -81,15 +86,38 @@ var CcsEllipsis = function CcsEllipsis(p) {
81
86
  },
82
87
  children: measureNodes
83
88
  });
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;
89
+ if (status === 100 || !showTooltip) {
90
+ return renderNode;
91
+ }
92
+ if (showTooltip) {
93
+ return /*#__PURE__*/_jsx(Tooltip, {
94
+ zIndex: 9999,
95
+ title: function title() {
96
+ return /*#__PURE__*/_jsxs(_Fragment, {
97
+ children: [content, /*#__PURE__*/_jsx("div", {
98
+ style: {
99
+ textAlign: 'right'
100
+ },
101
+ children: /*#__PURE__*/_jsx(Button, {
102
+ icon: /*#__PURE__*/_jsx(CopyOutlined, {}),
103
+ size: "small",
104
+ type: "link",
105
+ onClick: function onClick() {
106
+ var _CcsDialog$message;
107
+ CcsUtils.copy(content);
108
+ (_CcsDialog$message = CcsDialog.message) === null || _CcsDialog$message === void 0 || _CcsDialog$message.info('复制成功');
109
+ }
110
+ })
111
+ })]
112
+ });
113
+ },
114
+ placement: "bottomLeft",
115
+ destroyTooltipOnHide: true,
116
+ overlayInnerStyle: {
117
+ whiteSpace: 'normal'
118
+ },
119
+ children: renderNode
120
+ });
121
+ }
94
122
  };
95
123
  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-19",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {