@autobest-ui/components 2.13.12 → 2.14.0

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 (111) hide show
  1. package/esm/affix/index.d.ts +0 -10
  2. package/esm/affix/index.js +9 -50
  3. package/esm/carousel/index.d.ts +4 -0
  4. package/esm/carousel/index.js +10 -1
  5. package/esm/checkbox/Checkbox.js +3 -19
  6. package/esm/checkbox/style/index.css +1 -1
  7. package/esm/confirm/style/index.css +1 -1
  8. package/esm/index.d.ts +6 -0
  9. package/esm/index.js +4 -1
  10. package/esm/input/Adorn.d.ts +4 -0
  11. package/esm/input/Adorn.js +7 -3
  12. package/esm/input/Input.d.ts +1 -0
  13. package/esm/input/Input.js +5 -1
  14. package/esm/input/TextArea.d.ts +1 -0
  15. package/esm/input/TextArea.js +4 -1
  16. package/esm/input-number/index.d.ts +1 -0
  17. package/esm/input-number/index.js +5 -1
  18. package/esm/input-phone/index.d.ts +1 -0
  19. package/esm/input-phone/index.js +1 -0
  20. package/esm/lazy-image/index.d.ts +10 -30
  21. package/esm/lazy-image/index.js +30 -51
  22. package/esm/lazy-image/style/index.css +1 -1
  23. package/esm/loading-container/index.d.ts +1 -19
  24. package/esm/loading-container/index.js +16 -122
  25. package/esm/loading-icon/index.d.ts +1 -1
  26. package/esm/loading-icon/index.js +3 -21
  27. package/esm/modal/Affix.d.ts +4 -0
  28. package/esm/modal/Affix.js +7 -0
  29. package/esm/modal/index.d.ts +5 -19
  30. package/esm/modal/index.js +17 -18
  31. package/esm/modal/style/index.css +1 -1
  32. package/esm/move/index.d.ts +10 -0
  33. package/esm/move/index.js +12 -7
  34. package/esm/radio/Radio.js +10 -7
  35. package/esm/radio/RadioGroup.js +3 -6
  36. package/esm/radio/style/index.css +1 -1
  37. package/esm/radio/type.d.ts +0 -2
  38. package/esm/read-more/index.d.ts +92 -0
  39. package/esm/read-more/index.js +377 -0
  40. package/esm/read-more/style/index.css +1 -0
  41. package/esm/read-more-html/index.d.ts +89 -0
  42. package/esm/read-more-html/index.js +362 -0
  43. package/esm/read-more-html/style/index.css +1 -0
  44. package/esm/select/index.d.ts +0 -3
  45. package/esm/select/index.js +4 -25
  46. package/esm/select/style/index.css +1 -1
  47. package/esm/show-more/index.d.ts +27 -12
  48. package/esm/show-more/index.js +87 -41
  49. package/esm/show-more/style/index.css +1 -1
  50. package/esm/style.css +1 -1
  51. package/esm/table/style/index.css +1 -1
  52. package/esm/trigger/index.d.ts +3 -10
  53. package/esm/trigger/index.js +19 -39
  54. package/lib/affix/index.d.ts +0 -10
  55. package/lib/affix/index.js +8 -49
  56. package/lib/carousel/index.d.ts +4 -0
  57. package/lib/carousel/index.js +10 -1
  58. package/lib/checkbox/Checkbox.js +3 -19
  59. package/lib/checkbox/style/index.css +1 -1
  60. package/lib/confirm/style/index.css +1 -1
  61. package/lib/index.d.ts +6 -0
  62. package/lib/index.js +20 -0
  63. package/lib/input/Adorn.d.ts +4 -0
  64. package/lib/input/Adorn.js +7 -3
  65. package/lib/input/Input.d.ts +1 -0
  66. package/lib/input/Input.js +5 -1
  67. package/lib/input/TextArea.d.ts +1 -0
  68. package/lib/input/TextArea.js +4 -1
  69. package/lib/input-number/index.d.ts +1 -0
  70. package/lib/input-number/index.js +5 -1
  71. package/lib/input-phone/index.d.ts +1 -0
  72. package/lib/input-phone/index.js +1 -0
  73. package/lib/lazy-image/index.d.ts +10 -30
  74. package/lib/lazy-image/index.js +30 -51
  75. package/lib/lazy-image/style/index.css +1 -1
  76. package/lib/loading-container/index.d.ts +1 -19
  77. package/lib/loading-container/index.js +16 -125
  78. package/lib/loading-icon/index.d.ts +1 -1
  79. package/lib/loading-icon/index.js +3 -21
  80. package/lib/modal/Affix.d.ts +4 -0
  81. package/lib/modal/Affix.js +14 -0
  82. package/lib/modal/index.d.ts +5 -19
  83. package/lib/modal/index.js +17 -18
  84. package/lib/modal/style/index.css +1 -1
  85. package/lib/move/index.d.ts +10 -0
  86. package/lib/move/index.js +12 -7
  87. package/lib/radio/Radio.js +10 -7
  88. package/lib/radio/RadioGroup.js +3 -6
  89. package/lib/radio/style/index.css +1 -1
  90. package/lib/radio/type.d.ts +0 -2
  91. package/lib/read-more/index.d.ts +92 -0
  92. package/lib/read-more/index.js +388 -0
  93. package/lib/read-more/style/index.css +1 -0
  94. package/lib/read-more-html/index.d.ts +89 -0
  95. package/lib/read-more-html/index.js +373 -0
  96. package/lib/read-more-html/style/index.css +1 -0
  97. package/lib/select/index.d.ts +0 -3
  98. package/lib/select/index.js +4 -25
  99. package/lib/select/style/index.css +1 -1
  100. package/lib/show-more/index.d.ts +27 -12
  101. package/lib/show-more/index.js +86 -40
  102. package/lib/show-more/style/index.css +1 -1
  103. package/lib/style.css +1 -1
  104. package/lib/table/style/index.css +1 -1
  105. package/lib/trigger/index.d.ts +3 -10
  106. package/lib/trigger/index.js +19 -39
  107. package/package.json +3 -3
  108. package/esm/affix/observe.d.ts +0 -8
  109. package/esm/affix/observe.js +0 -6
  110. package/lib/affix/observe.d.ts +0 -8
  111. package/lib/affix/observe.js +0 -12
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _utils = require("@autobest-ui/utils");
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ var __extends = void 0 && (void 0).__extends || function () {
15
+ var _extendStatics = function extendStatics(d, b) {
16
+ _extendStatics = Object.setPrototypeOf || {
17
+ __proto__: []
18
+ } instanceof Array && function (d, b) {
19
+ d.__proto__ = b;
20
+ } || function (d, b) {
21
+ for (var p in b) {
22
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
23
+ }
24
+ };
25
+ return _extendStatics(d, b);
26
+ };
27
+ return function (d, b) {
28
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
29
+ _extendStatics(d, b);
30
+ function __() {
31
+ this.constructor = d;
32
+ }
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ };
35
+ }();
36
+ var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) {
38
+ return value instanceof P ? value : new P(function (resolve) {
39
+ resolve(value);
40
+ });
41
+ }
42
+ return new (P || (P = Promise))(function (resolve, reject) {
43
+ function fulfilled(value) {
44
+ try {
45
+ step(generator.next(value));
46
+ } catch (e) {
47
+ reject(e);
48
+ }
49
+ }
50
+ function rejected(value) {
51
+ try {
52
+ step(generator["throw"](value));
53
+ } catch (e) {
54
+ reject(e);
55
+ }
56
+ }
57
+ function step(result) {
58
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
59
+ }
60
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
61
+ });
62
+ };
63
+ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
64
+ var _ = {
65
+ label: 0,
66
+ sent: function sent() {
67
+ if (t[0] & 1) throw t[1];
68
+ return t[1];
69
+ },
70
+ trys: [],
71
+ ops: []
72
+ },
73
+ f,
74
+ y,
75
+ t,
76
+ g;
77
+ return g = {
78
+ next: verb(0),
79
+ "throw": verb(1),
80
+ "return": verb(2)
81
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
82
+ return this;
83
+ }), g;
84
+ function verb(n) {
85
+ return function (v) {
86
+ return step([n, v]);
87
+ };
88
+ }
89
+ function step(op) {
90
+ if (f) throw new TypeError("Generator is already executing.");
91
+ while (_) {
92
+ try {
93
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
94
+ if (y = 0, t) op = [op[0] & 2, t.value];
95
+ switch (op[0]) {
96
+ case 0:
97
+ case 1:
98
+ t = op;
99
+ break;
100
+ case 4:
101
+ _.label++;
102
+ return {
103
+ value: op[1],
104
+ done: false
105
+ };
106
+ case 5:
107
+ _.label++;
108
+ y = op[1];
109
+ op = [0];
110
+ continue;
111
+ case 7:
112
+ op = _.ops.pop();
113
+ _.trys.pop();
114
+ continue;
115
+ default:
116
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
117
+ _ = 0;
118
+ continue;
119
+ }
120
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
121
+ _.label = op[1];
122
+ break;
123
+ }
124
+ if (op[0] === 6 && _.label < t[1]) {
125
+ _.label = t[1];
126
+ t = op;
127
+ break;
128
+ }
129
+ if (t && _.label < t[2]) {
130
+ _.label = t[2];
131
+ _.ops.push(op);
132
+ break;
133
+ }
134
+ if (t[2]) _.ops.pop();
135
+ _.trys.pop();
136
+ continue;
137
+ }
138
+ op = body.call(thisArg, _);
139
+ } catch (e) {
140
+ op = [6, e];
141
+ y = 0;
142
+ } finally {
143
+ f = t = 0;
144
+ }
145
+ }
146
+ if (op[0] & 5) throw op[1];
147
+ return {
148
+ value: op[0] ? op[1] : void 0,
149
+ done: true
150
+ };
151
+ }
152
+ };
153
+ var ReadMore = /** @class */function (_super) {
154
+ __extends(ReadMore, _super);
155
+ function ReadMore(props) {
156
+ var _this = _super.call(this, props) || this;
157
+ _this.wrapRef = /*#__PURE__*/_react.default.createRef();
158
+ _this.prefixCls = 'ab-read-more';
159
+ /**
160
+ * 创建Show More/Show Less 按钮
161
+ */
162
+ _this.getButtonElement = function (wrapElement, isCollapsed) {
163
+ var cls = _this.prefixCls;
164
+ var _a = _this.props,
165
+ collapseText = _a.collapseText,
166
+ expandText = _a.expandText;
167
+ var btn = document.createElement('span');
168
+ btn.setAttribute('data-collapse', collapseText);
169
+ btn.setAttribute('data-expand', expandText);
170
+ _this.isCollapsed = isCollapsed;
171
+ btn.className = "".concat(cls, "-btn ").concat(isCollapsed ? "".concat(cls, "-collapse") : "".concat(cls, "-expand"));
172
+ var self = _this;
173
+ btn.onclick = function () {
174
+ return __awaiter(_this, void 0, void 0, function () {
175
+ var _a;
176
+ return __generator(this, function (_b) {
177
+ switch (_b.label) {
178
+ case 0:
179
+ _a = self.props.onBeforeChange;
180
+ if (!_a) return [3 /*break*/, 2];
181
+ return [4 /*yield*/, self.props.onBeforeChange(!self.isCollapsed)];
182
+ case 1:
183
+ _a = !_b.sent();
184
+ _b.label = 2;
185
+ case 2:
186
+ if (_a) {
187
+ return [2 /*return*/];
188
+ }
189
+
190
+ if (self.isCollapsed) {
191
+ self.isCollapsed = false;
192
+ btn.className = "".concat(cls, "-btn ").concat(cls, "-expand");
193
+ wrapElement.innerHTML = self.originalContent;
194
+ wrapElement.appendChild(btn);
195
+ } else {
196
+ self.isCollapsed = true;
197
+ wrapElement.innerHTML = self.originalContent;
198
+ self.delayCalculate();
199
+ }
200
+ if (self.props.onAfterChange) {
201
+ self.props.onAfterChange(self.isCollapsed);
202
+ }
203
+ return [2 /*return*/];
204
+ }
205
+ });
206
+ });
207
+ };
208
+
209
+ return btn;
210
+ };
211
+ _this.applyToggle = function (wrapElement, node, index) {
212
+ // 1. 将文本节点在 index 处切分为两个
213
+ var remainingTextNode = node.splitText(index);
214
+ // 2. 创建一个“隐藏层”容器
215
+ var hiddenWrapper = document.createElement('div');
216
+ hiddenWrapper.className = "".concat(_this.prefixCls, "-hidden");
217
+ // 3. 将截断点之后的所有兄弟节点(不限于文本,包括 HTML 标签)移入隐藏层
218
+ var nextSibling = remainingTextNode;
219
+ while (nextSibling) {
220
+ var current = nextSibling;
221
+ nextSibling = nextSibling.nextSibling;
222
+ hiddenWrapper.appendChild(current);
223
+ // appendChild 会将节点从原位置移动到 hiddenWrapper 中,而不销毁
224
+ }
225
+ // 同样需要递归移入父级元素之后的所有兄弟节点,确保彻底隐藏
226
+ var parent = node.parentNode;
227
+ while (parent && parent !== wrapElement) {
228
+ var sib = parent.nextSibling;
229
+ while (sib) {
230
+ var currentSib = sib;
231
+ sib = sib.nextSibling;
232
+ hiddenWrapper.appendChild(currentSib);
233
+ }
234
+ parent = parent.parentNode;
235
+ }
236
+ var buttonElement = _this.getButtonElement(wrapElement, true);
237
+ node.parentNode.insertBefore(buttonElement, node.nextSibling);
238
+ wrapElement.appendChild(hiddenWrapper);
239
+ _this.setState({
240
+ wrapStyle: {
241
+ maxHeight: 'none'
242
+ }
243
+ });
244
+ };
245
+ _this.onResizeObserver = function () {
246
+ var debounceCalculate = (0, _utils.debounce)(function (newWidth) {
247
+ if (newWidth !== _this.cacheWrapWidth) {
248
+ _this.cacheWrapWidth = newWidth;
249
+ _this.delayCalculate();
250
+ }
251
+ });
252
+ _this.resizeObserver = new ResizeObserver(function (entries) {
253
+ debounceCalculate(entries[0].contentRect.width);
254
+ });
255
+ _this.resizeObserver.observe(_this.wrapRef.current);
256
+ };
257
+ _this.isCollapsed = props.lines >= 1 && props.defaultCollapsed;
258
+ _this.state = {
259
+ wrapStyle: {
260
+ maxHeight: props.defaultWrapMaxHeight
261
+ }
262
+ };
263
+ return _this;
264
+ }
265
+ ReadMore.prototype.componentDidMount = function () {
266
+ var wrapElement = this.wrapRef.current;
267
+ if (!wrapElement) {
268
+ return;
269
+ }
270
+ this.originalContent = wrapElement.innerHTML;
271
+ if (!this.isCollapsed) {
272
+ var buttonElement = this.getButtonElement(wrapElement, false);
273
+ wrapElement.appendChild(buttonElement);
274
+ this.setState({
275
+ wrapStyle: {
276
+ maxHeight: 'none'
277
+ }
278
+ });
279
+ }
280
+ this.delayCalculate();
281
+ if (this.props.isResizeObserver) {
282
+ this.onResizeObserver();
283
+ }
284
+ };
285
+ ReadMore.prototype.componentDidUpdate = function (prevProps) {
286
+ if (this.props.children !== prevProps.children || this.props.lines !== prevProps.lines) {
287
+ this.originalContent = this.wrapRef.current ? this.wrapRef.current.innerHTML : '';
288
+ // 执行render,并且跳过shouldComponentUpdate
289
+ this.delayCalculate();
290
+ }
291
+ };
292
+ ReadMore.prototype.componentWillUnmount = function () {
293
+ if (this.resizeObserver && this.wrapRef.current) {
294
+ this.resizeObserver.unobserve(this.wrapRef.current);
295
+ }
296
+ };
297
+ /**
298
+ * 计算高度并设置样式
299
+ */
300
+ ReadMore.prototype.delayCalculate = function () {
301
+ var wrapElement = this.wrapRef.current;
302
+ if (!this.isCollapsed || this.props.lines < 1 || !wrapElement || !document.createTreeWalker) {
303
+ this.setState({
304
+ wrapStyle: {
305
+ maxHeight: 'none'
306
+ }
307
+ });
308
+ return;
309
+ }
310
+ var wrapRect = wrapElement.getBoundingClientRect();
311
+ this.cacheWrapWidth = wrapRect.width;
312
+ var _a = this.props,
313
+ ignoreClassList = _a.ignoreClassList,
314
+ lineThreshold = _a.lineThreshold,
315
+ lines = _a.lines,
316
+ buttonWidth = _a.buttonWidth;
317
+ // 将数组转换为选择器字符串: ".ignore-text1, .ignore-text2"
318
+ var ignoreSelector = (ignoreClassList || []).map(function (cls) {
319
+ return ".".concat(cls);
320
+ }).join(', ');
321
+ var range = document.createRange();
322
+ var treeWalker = document.createTreeWalker(wrapElement, NodeFilter.SHOW_TEXT, {
323
+ acceptNode: function acceptNode(node) {
324
+ // 如果 ignoreClassList 为空,或者当前节点不属于任何忽略名单,则接受
325
+ if (ignoreSelector && node.parentElement.closest(ignoreSelector)) {
326
+ return NodeFilter.FILTER_REJECT;
327
+ }
328
+ return NodeFilter.FILTER_ACCEPT;
329
+ }
330
+ });
331
+ var lineCount = 0;
332
+ var lastTop = -1;
333
+ var targetNode = null;
334
+ var splitIndex = 0;
335
+ // 1. 寻找第 targetLine 行的末尾空格位置
336
+ var node = null;
337
+ while (node = treeWalker.nextNode()) {
338
+ var text = node.textContent;
339
+ for (var i = 0; i < text.length; i++) {
340
+ range.setStart(node, i);
341
+ range.setEnd(node, i + 1);
342
+ var rect = range.getBoundingClientRect();
343
+ if (rect.height > 0) {
344
+ if (lastTop === -1 || Math.abs(rect.top - lastTop) > lineThreshold) {
345
+ lineCount++;
346
+ lastTop = rect.top;
347
+ }
348
+ // 仅在目标行寻找合适的截断点(空格且留够按钮位)
349
+ if (lineCount === lines) {
350
+ if ((text[i] === ' ' || text[i] === '\n') && wrapRect.right - rect.right > buttonWidth) {
351
+ targetNode = node;
352
+ splitIndex = i;
353
+ }
354
+ } else if (lineCount > lines) break;
355
+ }
356
+ }
357
+ if (lineCount > lines) break;
358
+ }
359
+ if (targetNode) {
360
+ this.applyToggle(wrapElement, targetNode, splitIndex);
361
+ }
362
+ };
363
+ ReadMore.prototype.render = function () {
364
+ var cls = this.prefixCls;
365
+ var _a = this.props,
366
+ className = _a.className,
367
+ children = _a.children;
368
+ var wrapStyle = this.state.wrapStyle;
369
+ return /*#__PURE__*/_react.default.createElement("div", {
370
+ ref: this.wrapRef,
371
+ style: wrapStyle,
372
+ className: (0, _classnames.default)(cls, className)
373
+ }, children);
374
+ };
375
+ ReadMore.defaultProps = {
376
+ onAfterChange: function onAfterChange() {},
377
+ isResizeObserver: true,
378
+ defaultCollapsed: true,
379
+ expandText: 'Show Less',
380
+ buttonWidth: 75,
381
+ collapseText: '...Show More',
382
+ lineThreshold: 10,
383
+ lines: 2
384
+ };
385
+ return ReadMore;
386
+ }(_react.Component);
387
+ var _default = ReadMore;
388
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ .ab-read-more{overflow:hidden}.ab-read-more-hidden{display:none}.ab-read-more-collapse,.ab-read-more-expand{user-select:none}.ab-read-more-collapse::after,.ab-read-more-expand::after{color:#4068b0;cursor:pointer}.ab-read-more-collapse::after{content:" " attr(data-collapse)}.ab-read-more-expand::after{content:" " attr(data-expand)}
@@ -0,0 +1,89 @@
1
+ import React, { Component } from 'react';
2
+ export interface ReadMoreHtmlProps {
3
+ /**
4
+ * 需要显示的内容
5
+ */
6
+ children: React.ReactChild[] | React.ReactChild;
7
+ /**
8
+ * 整体样式
9
+ */
10
+ className?: string;
11
+ /**
12
+ * 需要忽略的类名数组,例如 ['mc_title']
13
+ */
14
+ ignoreClassList?: string[];
15
+ /**
16
+ * 展开文本
17
+ */
18
+ expandText?: string;
19
+ /**
20
+ * 折叠文本, 展开后点击收起的文字
21
+ */
22
+ collapseText?: string;
23
+ /**
24
+ * 初始时,显示的行数
25
+ */
26
+ lines?: number;
27
+ /**
28
+ * 是否执行resizeObserver监听宽度变化
29
+ */
30
+ isResizeObserver?: boolean;
31
+ /**
32
+ * 垂直方向触发换行的判定阈值 (默认 1px), 当一行中有字体,大小不同时,需要根据情况动态触发换行
33
+ */
34
+ lineThreshold?: number;
35
+ /**
36
+ * [不推荐]设置Wrap容器高度, 用于解决初始化时页面抖动问题,建议通过屏幕大小动态设置className
37
+ */
38
+ defaultWrapHeight?: number;
39
+ /**
40
+ * [不推荐]设置Content最大高度, 用于解决初始化时页面抖动问题,建议通过屏幕大小动态设置className
41
+ */
42
+ defaultContentMaxHeight?: number;
43
+ /**
44
+ * 默认是否折叠
45
+ */
46
+ defaultCollapsed?: boolean;
47
+ /**
48
+ * 点击展开/收起前的回调函数,返回false时阻止change
49
+ */
50
+ onBeforeChange?: (isCollapsed: boolean) => Promise<boolean>;
51
+ /**
52
+ * 点击展开/收起后的回调函数
53
+ */
54
+ onAfterChange?: (isCollapsed: boolean) => void;
55
+ }
56
+ interface ReadMoreHtmlState {
57
+ isCollapsed: boolean;
58
+ isShowBtn: boolean;
59
+ wrapStyle: React.CSSProperties;
60
+ contentStyle: React.CSSProperties;
61
+ }
62
+ declare class ReadMoreHtml extends Component<ReadMoreHtmlProps, ReadMoreHtmlState> {
63
+ static defaultProps: {
64
+ onAfterChange: () => void;
65
+ isResizeObserver: boolean;
66
+ defaultCollapsed: boolean;
67
+ expandText: string;
68
+ collapseText: string;
69
+ lineThreshold: number;
70
+ lines: number;
71
+ };
72
+ cacheWrapWidth: number;
73
+ resizeObserver: ResizeObserver;
74
+ wrapRef: React.RefObject<HTMLDivElement>;
75
+ contentRef: React.RefObject<HTMLDivElement>;
76
+ prefixCls: string;
77
+ constructor(props: ReadMoreHtmlProps);
78
+ componentDidMount(): void;
79
+ componentDidUpdate(prevProps: ReadMoreHtmlProps): void;
80
+ componentWillUnmount(): void;
81
+ /**
82
+ * 计算高度并设置样式
83
+ */
84
+ delayCalculate(): void;
85
+ onResizeObserver: () => void;
86
+ onChange: () => Promise<void>;
87
+ render(): JSX.Element;
88
+ }
89
+ export default ReadMoreHtml;