@hsu-react/ui 0.0.15 → 0.0.16
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.
|
@@ -107,6 +107,8 @@ var TextEllipsis = function TextEllipsis(_ref) {
|
|
|
107
107
|
};
|
|
108
108
|
var textContent = getTextContent(children);
|
|
109
109
|
var update = function update() {
|
|
110
|
+
// Detached nodes measure 0/0 — never let them overwrite a live measurement
|
|
111
|
+
if (!element.isConnected) return;
|
|
110
112
|
var isTextOverflow = element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;
|
|
111
113
|
setIsOverflow(isTextOverflow);
|
|
112
114
|
setMeasuredWidth(element.clientWidth);
|
|
@@ -179,24 +181,24 @@ var TextEllipsis = function TextEllipsis(_ref) {
|
|
|
179
181
|
})]
|
|
180
182
|
});
|
|
181
183
|
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
|
|
184
|
+
// Always keep the Tooltip wrapper mounted and toggle via title:
|
|
185
|
+
// conditionally wrapping remounts the text DOM when isOverflow flips, which detaches
|
|
186
|
+
// the node the measurement effect's ResizeObserver holds — its final callback then
|
|
187
|
+
// reads 0/0 from the detached node and resets isOverflow, so the Tooltip never shows.
|
|
188
|
+
return /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({
|
|
189
|
+
arrow: false,
|
|
190
|
+
placement: "bottomLeft"
|
|
191
|
+
}, restTooltipConfig), {}, {
|
|
192
|
+
title: isOverflow && !disabled ? tooltipTitle : undefined,
|
|
193
|
+
styles: _objectSpread({
|
|
194
|
+
body: {
|
|
195
|
+
width: tooltipWidth,
|
|
196
|
+
overflow: "auto",
|
|
197
|
+
maxHeight: "300px",
|
|
198
|
+
whiteSpace: "pre-wrap"
|
|
199
|
+
}
|
|
200
|
+
}, styles),
|
|
201
|
+
children: content
|
|
202
|
+
}));
|
|
201
203
|
};
|
|
202
204
|
export default TextEllipsis;
|
|
@@ -87,6 +87,8 @@ const TextEllipsis = ({
|
|
|
87
87
|
};
|
|
88
88
|
const textContent = getTextContent(children);
|
|
89
89
|
const update = () => {
|
|
90
|
+
// Detached nodes measure 0/0 — never let them overwrite a live measurement
|
|
91
|
+
if (!element.isConnected) return;
|
|
90
92
|
const isTextOverflow = element.scrollWidth > element.clientWidth || element.scrollHeight > element.clientHeight;
|
|
91
93
|
setIsOverflow(isTextOverflow);
|
|
92
94
|
setMeasuredWidth(element.clientWidth);
|
|
@@ -157,25 +159,25 @@ const TextEllipsis = ({
|
|
|
157
159
|
})]
|
|
158
160
|
});
|
|
159
161
|
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
162
|
+
// Always keep the Tooltip wrapper mounted and toggle via title:
|
|
163
|
+
// conditionally wrapping remounts the text DOM when isOverflow flips, which detaches
|
|
164
|
+
// the node the measurement effect's ResizeObserver holds — its final callback then
|
|
165
|
+
// reads 0/0 from the detached node and resets isOverflow, so the Tooltip never shows.
|
|
166
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
167
|
+
arrow: false,
|
|
168
|
+
placement: "bottomLeft",
|
|
169
|
+
...restTooltipConfig,
|
|
170
|
+
title: isOverflow && !disabled ? tooltipTitle : undefined,
|
|
171
|
+
styles: {
|
|
172
|
+
body: {
|
|
173
|
+
width: tooltipWidth,
|
|
174
|
+
overflow: "auto",
|
|
175
|
+
maxHeight: "300px",
|
|
176
|
+
whiteSpace: "pre-wrap"
|
|
175
177
|
},
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
...styles
|
|
179
|
+
},
|
|
180
|
+
children: content
|
|
181
|
+
});
|
|
180
182
|
};
|
|
181
183
|
var _default = exports.default = TextEllipsis;
|
package/package.json
CHANGED
|
@@ -109,6 +109,8 @@ const TextEllipsis: React.FC<TextEllipsisProps> = ({
|
|
|
109
109
|
const textContent = getTextContent(children);
|
|
110
110
|
|
|
111
111
|
const update = () => {
|
|
112
|
+
// Detached nodes measure 0/0 — never let them overwrite a live measurement
|
|
113
|
+
if (!element.isConnected) return;
|
|
112
114
|
const isTextOverflow =
|
|
113
115
|
element.scrollWidth > element.clientWidth ||
|
|
114
116
|
element.scrollHeight > element.clientHeight;
|
|
@@ -189,30 +191,29 @@ const TextEllipsis: React.FC<TextEllipsisProps> = ({
|
|
|
189
191
|
</span>
|
|
190
192
|
);
|
|
191
193
|
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return content;
|
|
194
|
+
// Always keep the Tooltip wrapper mounted and toggle via title:
|
|
195
|
+
// conditionally wrapping remounts the text DOM when isOverflow flips, which detaches
|
|
196
|
+
// the node the measurement effect's ResizeObserver holds — its final callback then
|
|
197
|
+
// reads 0/0 from the detached node and resets isOverflow, so the Tooltip never shows.
|
|
198
|
+
return (
|
|
199
|
+
<Tooltip
|
|
200
|
+
arrow={false}
|
|
201
|
+
placement="bottomLeft"
|
|
202
|
+
{...restTooltipConfig}
|
|
203
|
+
title={isOverflow && !disabled ? tooltipTitle : undefined}
|
|
204
|
+
styles={{
|
|
205
|
+
body: {
|
|
206
|
+
width: tooltipWidth,
|
|
207
|
+
overflow: "auto",
|
|
208
|
+
maxHeight: "300px",
|
|
209
|
+
whiteSpace: "pre-wrap",
|
|
210
|
+
},
|
|
211
|
+
...styles,
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
{content}
|
|
215
|
+
</Tooltip>
|
|
216
|
+
);
|
|
216
217
|
};
|
|
217
218
|
|
|
218
219
|
export default TextEllipsis;
|