@arco-design/mobile-react 2.24.0 → 2.24.2

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.en-US.md +2 -2
  3. package/README.md +2 -2
  4. package/cjs/dialog/index.d.ts +2 -2
  5. package/cjs/ellipsis/components/js-ellipsis.d.ts +4 -2
  6. package/cjs/ellipsis/components/js-ellipsis.js +17 -1
  7. package/cjs/ellipsis/components/native-ellipsis.d.ts +1 -1
  8. package/cjs/ellipsis/components/native-ellipsis.js +6 -1
  9. package/cjs/ellipsis/demo/style/css/mobile.css +1 -1
  10. package/cjs/ellipsis/demo/style/mobile.less +3 -1
  11. package/cjs/ellipsis/index.js +6 -2
  12. package/cjs/ellipsis/style/css/index.css +17 -1
  13. package/cjs/ellipsis/style/index.less +19 -1
  14. package/cjs/ellipsis/type.d.ts +22 -76
  15. package/cjs/masking/index.d.ts +2 -2
  16. package/cjs/popup/index.d.ts +2 -2
  17. package/cjs/popup-swiper/index.d.ts +2 -2
  18. package/dist/index.js +28 -4
  19. package/dist/index.min.js +3 -3
  20. package/dist/style.css +17 -1
  21. package/dist/style.min.css +1 -1
  22. package/esm/dialog/index.d.ts +2 -2
  23. package/esm/ellipsis/components/js-ellipsis.d.ts +4 -2
  24. package/esm/ellipsis/components/js-ellipsis.js +17 -1
  25. package/esm/ellipsis/components/native-ellipsis.d.ts +1 -1
  26. package/esm/ellipsis/components/native-ellipsis.js +6 -1
  27. package/esm/ellipsis/demo/style/css/mobile.css +1 -1
  28. package/esm/ellipsis/demo/style/mobile.less +3 -1
  29. package/esm/ellipsis/index.js +6 -2
  30. package/esm/ellipsis/style/css/index.css +17 -1
  31. package/esm/ellipsis/style/index.less +19 -1
  32. package/esm/ellipsis/type.d.ts +22 -76
  33. package/esm/masking/index.d.ts +2 -2
  34. package/esm/popup/index.d.ts +2 -2
  35. package/esm/popup-swiper/index.d.ts +2 -2
  36. package/package.json +3 -3
  37. package/style/css/public.css +1 -0
  38. package/tokens/app/arcodesign/default/css-variables.less +2 -0
  39. package/tokens/app/arcodesign/default/index.d.ts +2 -0
  40. package/tokens/app/arcodesign/default/index.js +127 -125
  41. package/tokens/app/arcodesign/default/index.json +24 -0
  42. package/tokens/app/arcodesign/default/index.less +2 -0
  43. package/umd/dialog/index.d.ts +2 -2
  44. package/umd/ellipsis/components/js-ellipsis.d.ts +4 -2
  45. package/umd/ellipsis/components/js-ellipsis.js +17 -1
  46. package/umd/ellipsis/components/native-ellipsis.d.ts +1 -1
  47. package/umd/ellipsis/components/native-ellipsis.js +6 -1
  48. package/umd/ellipsis/demo/style/css/mobile.css +1 -1
  49. package/umd/ellipsis/demo/style/mobile.less +3 -1
  50. package/umd/ellipsis/index.js +6 -2
  51. package/umd/ellipsis/style/css/index.css +17 -1
  52. package/umd/ellipsis/style/index.less +19 -1
  53. package/umd/ellipsis/type.d.ts +22 -76
  54. package/umd/masking/index.d.ts +2 -2
  55. package/umd/popup/index.d.ts +2 -2
  56. package/umd/popup-swiper/index.d.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.24.2](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.24.1...@arco-design/mobile-react@2.24.2) (2023-01-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * `Ellipsis` innerHTML keep wrap ([#80](https://github.com/arco-design/arco-design-mobile/issues/80)) ([29afadc](https://github.com/arco-design/arco-design-mobile/commit/29afadc571bba16fd2b8641622de1f2d0fbf5ba4))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.24.1](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.24.0...@arco-design/mobile-react@2.24.1) (2023-01-04)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * `Ellipsis` support floatEllipsisNode ([#76](https://github.com/arco-design/arco-design-mobile/issues/76)) ([cc8e3d6](https://github.com/arco-design/arco-design-mobile/commit/cc8e3d6df1eec5a528a47c255c49ca94a326ca18))
23
+
24
+
25
+
26
+
27
+
6
28
  # [2.24.0](https://github.com/arco-design/arco-design-mobile/compare/@arco-design/mobile-react@2.23.0...@arco-design/mobile-react@2.24.0) (2022-12-20)
7
29
 
8
30
 
package/README.en-US.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="_b
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">Click here</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.23.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.23.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.24.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.24.1/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## Full import
package/README.md CHANGED
@@ -59,8 +59,8 @@ React & ReactDOM: **<a href="https://reactjs.org/docs/cdn-links.html" target="
59
59
  React Transition Group: **<a href="https://reactcommunity.org/react-transition-group/" target="_blank">戳这里获取</a>**
60
60
 
61
61
  ```
62
- <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.23.0/dist/style.min.css">
63
- <script src="https://unpkg.com/@arco-design/mobile-react@2.23.0/dist/index.min.js"></script>
62
+ <link ref="stylesheet" href="https://unpkg.com/@arco-design/mobile-react@2.24.1/dist/style.min.css">
63
+ <script src="https://unpkg.com/@arco-design/mobile-react@2.24.1/dist/index.min.js"></script>
64
64
  ```
65
65
 
66
66
  ## 引入全部
@@ -193,11 +193,11 @@ declare const _default: React.ForwardRefExoticComponent<DialogProps & React.RefA
193
193
  * @param {DialogProps} config Configuration
194
194
  * @returns {{ close: () => void; update: (newConfig: DialogProps) => void; }}
195
195
  */
196
- open: (config: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
196
+ open: (config: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
197
197
  key?: string | undefined;
198
198
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
199
199
  close: () => void;
200
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
200
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<DialogProps & React.RefAttributes<DialogRef>>, "platform" | "footer" | "title" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "footerType" | "renderFooter" | "footerCollapseCount" | "titleAlign" | "contentAlign" | "extra"> & {
201
201
  key?: string | undefined;
202
202
  }) => void;
203
203
  };
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
- import { JsEllipsisProps, JsEllipsisRef } from '../type';
3
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<JsEllipsisProps, "text" | "ellipsis" | "maxHeight" | "prefixCls" | "ellipsisNode" | "collapseNode" | "endExcludes" | "reflowOnResize" | "onReflow" | "onEllipsisNodeClick" | "onCollapseNodeClick" | "maxLine" | "dangerouslyUseInnerHTML"> & React.RefAttributes<JsEllipsisRef>>>;
2
+ import { JsEllipsisRef } from '../type';
3
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../type").EllipsisBaseProps & {
4
+ prefixCls: string;
5
+ } & Pick<import("../type").EllipsisProps, "maxHeight" | "endExcludes" | "reflowOnResize" | "onReflow"> & React.RefAttributes<JsEllipsisRef>>>;
4
6
  export default _default;
@@ -156,6 +156,7 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
156
156
 
157
157
  if (dangerouslyUseInnerHTML) {
158
158
  textRef.current.innerHTML = text;
159
+ textRef.current.classList.add(prefixCls + "-js-content-text-pre");
159
160
  } else {
160
161
  textRef.current.innerText = text;
161
162
  }
@@ -164,6 +165,8 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
164
165
  return;
165
166
  }
166
167
 
168
+ textRef.current.classList.remove(prefixCls + "-js-content-text-pre");
169
+
167
170
  var _domRef$current$getBo = domRef.current.getBoundingClientRect(),
168
171
  height = _domRef$current$getBo.height;
169
172
 
@@ -220,7 +223,20 @@ var JsEllipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
220
223
  }, /*#__PURE__*/_react.default.createElement("span", {
221
224
  ref: textRef,
222
225
  className: prefixCls + "-js-content"
223
- }), /*#__PURE__*/_react.default.createElement("span", {
226
+ }, dangerouslyUseInnerHTML ? /*#__PURE__*/_react.default.createElement("span", {
227
+ className: prefixCls + "-js-content-initial",
228
+ style: {
229
+ WebkitLineClamp: maxLine
230
+ },
231
+ dangerouslySetInnerHTML: {
232
+ __html: text
233
+ }
234
+ }) : /*#__PURE__*/_react.default.createElement("span", {
235
+ className: prefixCls + "-js-content-initial",
236
+ style: {
237
+ WebkitLineClamp: maxLine
238
+ }
239
+ }, text)), /*#__PURE__*/_react.default.createElement("span", {
224
240
  ref: ellipsisRef,
225
241
  className: prefixCls + "-js-content-ellipsis",
226
242
  onClick: onEllipsisNodeClick
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import { NativeEllipsisProps } from '../type';
3
- declare function NativeEllipsis({ prefixCls, ellipsis, dangerouslyUseInnerHTML, text, maxLine, collapseNode, onCollapseNodeClick, }: NativeEllipsisProps): JSX.Element;
3
+ declare function NativeEllipsis({ prefixCls, ellipsis, dangerouslyUseInnerHTML, text, maxLine, ellipsisNode, collapseNode, onEllipsisNodeClick, onCollapseNodeClick, }: NativeEllipsisProps): JSX.Element;
4
4
  declare const _default: React.MemoExoticComponent<typeof NativeEllipsis>;
5
5
  export default _default;
@@ -15,8 +15,10 @@ function NativeEllipsis(_ref) {
15
15
  dangerouslyUseInnerHTML = _ref.dangerouslyUseInnerHTML,
16
16
  text = _ref.text,
17
17
  maxLine = _ref.maxLine,
18
+ ellipsisNode = _ref.ellipsisNode,
18
19
  _ref$collapseNode = _ref.collapseNode,
19
20
  collapseNode = _ref$collapseNode === void 0 ? '' : _ref$collapseNode,
21
+ onEllipsisNodeClick = _ref.onEllipsisNodeClick,
20
22
  onCollapseNodeClick = _ref.onCollapseNodeClick;
21
23
  return /*#__PURE__*/_react.default.createElement("div", {
22
24
  className: (0, _mobileUtils.cls)(prefixCls + "-native", {
@@ -35,7 +37,10 @@ function NativeEllipsis(_ref) {
35
37
  }) : /*#__PURE__*/_react.default.createElement("span", null, text), !ellipsis && collapseNode && /*#__PURE__*/_react.default.createElement("span", {
36
38
  onClick: onCollapseNodeClick,
37
39
  className: (0, _mobileUtils.cls)(prefixCls + "-native-collapse")
38
- }, collapseNode));
40
+ }, collapseNode), ellipsis && (ellipsisNode !== '...' || onEllipsisNodeClick) ? /*#__PURE__*/_react.default.createElement("span", {
41
+ onClick: onEllipsisNodeClick,
42
+ className: (0, _mobileUtils.cls)(prefixCls + "-native-ellipsis-node")
43
+ }, ellipsisNode) : null);
39
44
  }
40
45
 
41
46
  var _default = /*#__PURE__*/_react.default.memo(NativeEllipsis);
@@ -1,4 +1,4 @@
1
- #demo-ellipsis {
1
+ #demo-ellipsis .arco-ellipsis {
2
2
  line-height: 26px;
3
3
  }
4
4
  #demo-ellipsis .demo-link,
@@ -1,7 +1,9 @@
1
1
  @import '../../../../style/mixin.less';
2
2
 
3
3
  #demo-ellipsis {
4
- line-height: 26px;
4
+ .@{prefix}-ellipsis {
5
+ line-height: 26px;
6
+ }
5
7
  .demo-link,
6
8
  .demo-link-line {
7
9
  .use-var(color, primary-color);
@@ -52,15 +52,17 @@ var Ellipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
52
52
  ellipsisNode = _props$ellipsisNode === void 0 ? '...' : _props$ellipsisNode,
53
53
  _props$collapseNode = props.collapseNode,
54
54
  collapseNode = _props$collapseNode === void 0 ? '' : _props$collapseNode,
55
- onCollapseNodeClick = props.onCollapseNodeClick,
56
55
  endExcludes = props.endExcludes,
57
56
  _props$reflowOnResize = props.reflowOnResize,
58
57
  reflowOnResize = _props$reflowOnResize === void 0 ? false : _props$reflowOnResize,
58
+ _props$floatEllipsisN = props.floatEllipsisNode,
59
+ floatEllipsisNode = _props$floatEllipsisN === void 0 ? false : _props$floatEllipsisN,
59
60
  onReflow = props.onReflow,
61
+ onCollapseNodeClick = props.onCollapseNodeClick,
60
62
  onEllipsisNodeClick = props.onEllipsisNodeClick;
61
63
  var domRef = (0, _react.useRef)(null);
62
64
  var jsEllipsisRef = (0, _react.useRef)(null);
63
- var useNativeEllipsis = (0, _is.isSupportWebkitLineClamp)() && maxHeight === void 0 && ellipsisNode === '...' && (!endExcludes || endExcludes.length === 0) && !onReflow && !onEllipsisNodeClick;
65
+ var useNativeEllipsis = (0, _is.isSupportWebkitLineClamp)() && maxHeight === void 0 && (!endExcludes || endExcludes.length === 0) && !onReflow && (floatEllipsisNode || ellipsisNode === '...' && !onEllipsisNodeClick);
64
66
  (0, _react.useImperativeHandle)(ref, function () {
65
67
  var _jsEllipsisRef$curren;
66
68
 
@@ -80,7 +82,9 @@ var Ellipsis = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
80
82
  dangerouslyUseInnerHTML: dangerouslyUseInnerHTML,
81
83
  text: text,
82
84
  maxLine: maxLine,
85
+ ellipsisNode: ellipsisNode,
83
86
  collapseNode: collapseNode,
87
+ onEllipsisNodeClick: onEllipsisNodeClick,
84
88
  onCollapseNodeClick: onCollapseNodeClick
85
89
  }) : /*#__PURE__*/_react.default.createElement(_jsEllipsis.default, {
86
90
  ref: jsEllipsisRef,
@@ -1,10 +1,26 @@
1
1
  .arco-ellipsis {
2
2
  font-size: 0.32rem ;
3
3
  }
4
- .arco-ellipsis-native.ellipsis {
4
+ .arco-ellipsis-native.ellipsis,
5
+ .arco-ellipsis-js-content-initial {
5
6
  display: -webkit-box;
6
7
  overflow: hidden;
7
8
  text-overflow: ellipsis;
8
9
  word-break: break-word;
9
10
  -webkit-box-orient: vertical;
11
+ position: relative;
12
+ }
13
+ .arco-ellipsis-native-ellipsis-node {
14
+ position: absolute;
15
+ right: 0;
16
+ bottom: 0;
17
+ background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0), #ffffff 20PX, #ffffff) ;
18
+ background: linear-gradient(90deg, rgba(255, 255, 255, 0), #ffffff 20PX, #ffffff) ;
19
+ padding-left: 20PX ;
20
+ }
21
+ .arco-ellipsis-js-content-text-pre {
22
+ white-space: pre-line;
23
+ }
24
+ .arco-ellipsis-js-content-ellipsis {
25
+ display: none;
10
26
  }
@@ -3,11 +3,29 @@
3
3
  .@{prefix}-ellipsis {
4
4
  .use-var(font-size, ellipsis-default-text-size);
5
5
 
6
- &-native.ellipsis {
6
+ &-native.ellipsis,
7
+ &-js-content-initial {
7
8
  display: -webkit-box;
8
9
  overflow: hidden;
9
10
  text-overflow: ellipsis;
10
11
  word-break: break-word;
11
12
  -webkit-box-orient: vertical;
13
+ position: relative;
14
+ }
15
+
16
+ &-native-ellipsis-node {
17
+ position: absolute;
18
+ right: 0;
19
+ bottom: 0;
20
+ .use-var(background, ellipsis-float-ellipsis-node-background);
21
+ .use-var(padding-left, ellipsis-float-ellipsis-node-padding-left);
22
+ }
23
+
24
+ &-js-content-text-pre {
25
+ white-space: pre-line;
26
+ }
27
+
28
+ &-js-content-ellipsis {
29
+ display: none;
12
30
  }
13
31
  }
@@ -1,5 +1,5 @@
1
- import { ReactNode, Ref } from 'react';
2
- interface BaseProps {
1
+ import { ReactNode } from 'react';
2
+ export interface EllipsisBaseProps {
3
3
  /**
4
4
  * 需要缩略的文本内容
5
5
  * @en Text content to be omitted
@@ -23,68 +23,17 @@ interface BaseProps {
23
23
  * @default false
24
24
  */
25
25
  dangerouslyUseInnerHTML?: boolean;
26
- }
27
- export interface NativeEllipsisProps extends BaseProps {
28
- /**
29
- * className 前缀
30
- * @en Prefix classname
31
- */
32
- prefixCls: string;
33
- /**
34
- * 自定义收起节点,不为空时文本展开插入文本尾部
35
- * @en Customize the collapsed node, when the text is not empty, the text expand Text expand content inserts the end of the text
36
- */
37
- collapseNode?: ReactNode;
38
- /**
39
- * 收起节点点击事件
40
- * @en Collapse node click event
41
- */
42
- onCollapseNodeClick?: () => void;
43
- }
44
- export interface JsEllipsisRef {
45
- dom: HTMLDivElement | null;
46
- reflow: () => void;
47
- }
48
- export interface JsEllipsisProps extends BaseProps {
49
- ref: Ref<HTMLDivElement | null>;
50
- /**
51
- * className 前缀
52
- * @en Prefix classname
53
- */
54
- prefixCls: string;
55
- /**
56
- * 最大显示高度,单位 px,优先级高于 maxLine
57
- * @en Maximum display height, unit px, priority higher than maxLine
58
- */
59
- maxHeight?: number;
60
26
  /**
61
27
  * 自定义缩略符节点,文本缩略时插入文本尾部
62
- * @en Customize the ellipsis node, insert the end of the text when the text is omitted
28
+ * @en Customize the ellipsis node, insert at the end of the text when the text is omitted
63
29
  * @default "..."
64
30
  */
65
31
  ellipsisNode?: ReactNode;
66
32
  /**
67
33
  * 自定义收起符节点,不为空且文本展开时插入文本尾部
68
- * @en Customize the collapse node, if the value is not empty, it will be inserted in the end of the text when the text is expanded
34
+ * @en Customize the collapse node, when the value is not empty and the text is expanded, the node is inserted at the end of the text
69
35
  */
70
36
  collapseNode?: ReactNode;
71
- /**
72
- * 文本结尾处(缩略符之前)需要过滤掉的字符
73
- * @en Characters that need to be filtered out at the end of the text (before abbreviations)
74
- * @default []
75
- */
76
- endExcludes?: string[];
77
- /**
78
- * 容器大小变化时是否自适应,使用原生缩略时默认为 true
79
- * @en Whether to adapt when the container size changes, the default is true when using native ellipsis
80
- * @default false
81
- */
82
- reflowOnResize?: boolean;
83
- /**
84
- * 文本缩略处理的完成回调
85
- * @en Callback when text omission processing is complete
86
- */
87
- onReflow?: (ellipsis: boolean, text: string) => void;
88
37
  /**
89
38
  * 缩略节点点击事件
90
39
  * @en Ellipsis node click event
@@ -108,7 +57,7 @@ export interface EllipsisRef {
108
57
  */
109
58
  reflow: (() => void) | undefined;
110
59
  }
111
- export interface EllipsisProps extends BaseProps {
60
+ export interface EllipsisProps extends EllipsisBaseProps {
112
61
  /**
113
62
  * 自定义类名
114
63
  * @en Custom classname
@@ -119,17 +68,6 @@ export interface EllipsisProps extends BaseProps {
119
68
  * @en Maximum display height(unit: px), priority higher than maxLine
120
69
  */
121
70
  maxHeight?: number;
122
- /**
123
- * 自定义缩略符节点,文本缩略时插入文本尾部
124
- * @en Customize the ellipsis node, insert at the end of the text when the text is omitted
125
- * @default "..."
126
- */
127
- ellipsisNode?: ReactNode;
128
- /**
129
- * 自定义收起符节点,不为空且文本展开时插入文本尾部
130
- * @en Customize the collapse node, when the value is not empty and the text is expanded, the node is inserted at the end of the text
131
- */
132
- collapseNode?: ReactNode;
133
71
  /**
134
72
  * 文本结尾处(缩略符之前)需要过滤掉的字符
135
73
  * @en Characters to filter out at the end of the text (before the ellipsis)
@@ -142,20 +80,28 @@ export interface EllipsisProps extends BaseProps {
142
80
  * @default false
143
81
  */
144
82
  reflowOnResize?: boolean;
83
+ /**
84
+ * 文本缩略时,缩略符节点是否浮在文本右下角(默认加渐变色背景)
85
+ * @en Whether the abbreviation node is floating in the lower right corner of the text (with a gradient background by default)
86
+ * @default false
87
+ */
88
+ floatEllipsisNode?: boolean;
145
89
  /**
146
90
  * 文本缩略处理的完成回调
147
91
  * @en Callback when text omission processing is complete
148
92
  */
149
93
  onReflow?: (ellipsis: boolean, text: string) => void;
94
+ }
95
+ export declare type EllipsisCommonProps = EllipsisBaseProps & {
150
96
  /**
151
- * 缩略节点点击事件
152
- * @en Ellipsis node click event
153
- */
154
- onEllipsisNodeClick?: () => void;
155
- /**
156
- * 收起节点点击事件
157
- * @en Collapse node click event
97
+ * className 前缀
98
+ * @en Prefix classname
158
99
  */
159
- onCollapseNodeClick?: () => void;
100
+ prefixCls: string;
101
+ };
102
+ export declare type NativeEllipsisProps = EllipsisCommonProps;
103
+ export interface JsEllipsisRef {
104
+ dom: HTMLDivElement | null;
105
+ reflow: () => void;
160
106
  }
161
- export {};
107
+ export declare type JsEllipsisProps = EllipsisCommonProps & Pick<EllipsisProps, 'maxHeight' | 'endExcludes' | 'reflowOnResize' | 'onReflow'>;
@@ -205,11 +205,11 @@ declare const _default: React.ForwardRefExoticComponent<MaskingProps & React.Ref
205
205
  * @param {MaskingProps} config Configuration
206
206
  * @returns {{ close: () => void; update: (newConfig: MaskingProps) => void; }}
207
207
  */
208
- open: (config: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
208
+ open: (config: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
209
209
  key?: string | undefined;
210
210
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
211
211
  close: () => void;
212
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
212
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<MaskingProps & React.RefAttributes<MaskingRef>>, "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "contentAtCenter" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer"> & {
213
213
  key?: string | undefined;
214
214
  }) => void;
215
215
  };
@@ -66,11 +66,11 @@ declare const _default: React.ForwardRefExoticComponent<PopupProps & React.RefAt
66
66
  * @param {PopupProps} config Configuration
67
67
  * @returns {{ close: () => void; update: (newConfig: PopupProps) => void; }}
68
68
  */
69
- open: (config: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
69
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
70
70
  key?: string | undefined;
71
71
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
72
72
  close: () => void;
73
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
73
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupProps & React.RefAttributes<PopupRef>>, "direction" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ"> & {
74
74
  key?: string | undefined;
75
75
  }) => void;
76
76
  };
@@ -76,11 +76,11 @@ declare const _default: React.ForwardRefExoticComponent<PopupSwiperProps & React
76
76
  * @param {string | PopupSwiperProps} config Configuration
77
77
  * @returns {{ close: () => void; update: (newConfig: PopupSwiperProps) => void; }}
78
78
  */
79
- open: (config: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
79
+ open: (config: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
80
80
  key?: string | undefined;
81
81
  }, context?: import("../context-provider").GlobalContextParams | undefined) => {
82
82
  close: () => void;
83
- update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "ref" | "children" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
83
+ update: (newConfig: Pick<import("../context-provider").WithGlobalContext<PopupSwiperProps & React.RefAttributes<PopupSwiperRef>>, "direction" | "children" | "ref" | "key" | "context" | "getContainer" | "mountOnEnter" | "unmountOnExit" | "className" | "onClose" | "maskClass" | "maskStyle" | "contentClass" | "contentStyle" | "maskTransitionType" | "contentTransitionType" | "maskTransitionTimeout" | "contentTransitionTimeout" | "maskClosable" | "animatingClosable" | "orientationDirection" | "preventBodyScroll" | "initialBodyOverflow" | "gestureOutOfControl" | "onOpen" | "onMaskClick" | "onTouchMove" | "onPreventTouchMove" | "getScrollContainer" | "needBottomOffset" | "translateZ" | "onTouchEnd" | "onTouchStart" | "percentToClose" | "distanceToClose" | "speedToClose" | "allowSwipeDirections" | "exitDirection"> & {
84
84
  key?: string | undefined;
85
85
  }) => void; /**
86
86
  * 内容面板 touchstart 事件,返回true时表示阻止本组件内部处理事件
package/dist/index.js CHANGED
@@ -12308,6 +12308,7 @@
12308
12308
 
12309
12309
  if (dangerouslyUseInnerHTML) {
12310
12310
  textRef.current.innerHTML = text;
12311
+ textRef.current.classList.add(prefixCls + "-js-content-text-pre");
12311
12312
  } else {
12312
12313
  textRef.current.innerText = text;
12313
12314
  }
@@ -12316,6 +12317,7 @@
12316
12317
  return;
12317
12318
  }
12318
12319
 
12320
+ textRef.current.classList.remove(prefixCls + "-js-content-text-pre");
12319
12321
  var height = domRef.current.getBoundingClientRect().height;
12320
12322
  var max = isNaN(Number(maxHeight)) ? lineHeightRef.current * maxLine : Number(maxHeight);
12321
12323
 
@@ -12370,7 +12372,20 @@
12370
12372
  }, /*#__PURE__*/React__default["default"].createElement("span", {
12371
12373
  ref: textRef,
12372
12374
  className: prefixCls + "-js-content"
12373
- }), /*#__PURE__*/React__default["default"].createElement("span", {
12375
+ }, dangerouslyUseInnerHTML ? /*#__PURE__*/React__default["default"].createElement("span", {
12376
+ className: prefixCls + "-js-content-initial",
12377
+ style: {
12378
+ WebkitLineClamp: maxLine
12379
+ },
12380
+ dangerouslySetInnerHTML: {
12381
+ __html: text
12382
+ }
12383
+ }) : /*#__PURE__*/React__default["default"].createElement("span", {
12384
+ className: prefixCls + "-js-content-initial",
12385
+ style: {
12386
+ WebkitLineClamp: maxLine
12387
+ }
12388
+ }, text)), /*#__PURE__*/React__default["default"].createElement("span", {
12374
12389
  ref: ellipsisRef,
12375
12390
  className: prefixCls + "-js-content-ellipsis",
12376
12391
  onClick: onEllipsisNodeClick
@@ -12387,8 +12402,10 @@
12387
12402
  dangerouslyUseInnerHTML = _a.dangerouslyUseInnerHTML,
12388
12403
  text = _a.text,
12389
12404
  maxLine = _a.maxLine,
12405
+ ellipsisNode = _a.ellipsisNode,
12390
12406
  _b = _a.collapseNode,
12391
12407
  collapseNode = _b === void 0 ? '' : _b,
12408
+ onEllipsisNodeClick = _a.onEllipsisNodeClick,
12392
12409
  onCollapseNodeClick = _a.onCollapseNodeClick;
12393
12410
  return /*#__PURE__*/React__default["default"].createElement("div", {
12394
12411
  className: cls(prefixCls + "-native", {
@@ -12407,7 +12424,10 @@
12407
12424
  }) : /*#__PURE__*/React__default["default"].createElement("span", null, text), !ellipsis && collapseNode && /*#__PURE__*/React__default["default"].createElement("span", {
12408
12425
  onClick: onCollapseNodeClick,
12409
12426
  className: cls(prefixCls + "-native-collapse")
12410
- }, collapseNode));
12427
+ }, collapseNode), ellipsis && (ellipsisNode !== '...' || onEllipsisNodeClick) ? /*#__PURE__*/React__default["default"].createElement("span", {
12428
+ onClick: onEllipsisNodeClick,
12429
+ className: cls(prefixCls + "-native-ellipsis-node")
12430
+ }, ellipsisNode) : null);
12411
12431
  }
12412
12432
 
12413
12433
  var NativeEllipsis$1 = /*#__PURE__*/React__default["default"].memo(NativeEllipsis);
@@ -12434,15 +12454,17 @@
12434
12454
  ellipsisNode = _c === void 0 ? '...' : _c,
12435
12455
  _d = props.collapseNode,
12436
12456
  collapseNode = _d === void 0 ? '' : _d,
12437
- onCollapseNodeClick = props.onCollapseNodeClick,
12438
12457
  endExcludes = props.endExcludes,
12439
12458
  _e = props.reflowOnResize,
12440
12459
  reflowOnResize = _e === void 0 ? false : _e,
12460
+ _f = props.floatEllipsisNode,
12461
+ floatEllipsisNode = _f === void 0 ? false : _f,
12441
12462
  onReflow = props.onReflow,
12463
+ onCollapseNodeClick = props.onCollapseNodeClick,
12442
12464
  onEllipsisNodeClick = props.onEllipsisNodeClick;
12443
12465
  var domRef = React.useRef(null);
12444
12466
  var jsEllipsisRef = React.useRef(null);
12445
- var useNativeEllipsis = isSupportWebkitLineClamp() && maxHeight === void 0 && ellipsisNode === '...' && (!endExcludes || endExcludes.length === 0) && !onReflow && !onEllipsisNodeClick;
12467
+ var useNativeEllipsis = isSupportWebkitLineClamp() && maxHeight === void 0 && (!endExcludes || endExcludes.length === 0) && !onReflow && (floatEllipsisNode || ellipsisNode === '...' && !onEllipsisNodeClick);
12446
12468
  React.useImperativeHandle(ref, function () {
12447
12469
  var _a;
12448
12470
 
@@ -12462,7 +12484,9 @@
12462
12484
  dangerouslyUseInnerHTML: dangerouslyUseInnerHTML,
12463
12485
  text: text,
12464
12486
  maxLine: maxLine,
12487
+ ellipsisNode: ellipsisNode,
12465
12488
  collapseNode: collapseNode,
12489
+ onEllipsisNodeClick: onEllipsisNodeClick,
12466
12490
  onCollapseNodeClick: onCollapseNodeClick
12467
12491
  }) : /*#__PURE__*/React__default["default"].createElement(JsEllipsis$1, {
12468
12492
  ref: jsEllipsisRef,