hy-virtual-tree 1.1.63 → 1.1.65
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.
- package/CHANGELOG.md +15 -0
- package/dist/index.css +5 -0
- package/dist/index.js +51 -19
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.1.65
|
|
4
|
+
|
|
5
|
+
_2026-01-23_
|
|
6
|
+
|
|
7
|
+
- 扩展[VirtualTree] 功能
|
|
8
|
+
(1)修复树形节点内容添加溢出省略时,移入显示tooltip后,在节点刷新时出现问题
|
|
9
|
+
(2)优化 Tooltip 交互效果
|
|
10
|
+
|
|
11
|
+
### 1.1.64
|
|
12
|
+
|
|
13
|
+
_2026-01-23_
|
|
14
|
+
|
|
15
|
+
- 扩展[VirtualTree] 功能
|
|
16
|
+
(1)优化树形,节点内容添加溢出省略时,移入显示tooltip
|
|
17
|
+
|
|
3
18
|
### 1.1.63
|
|
4
19
|
|
|
5
20
|
_2026-01-16_
|
package/dist/index.css
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
background: var(--hy-tooltip-bg);
|
|
15
15
|
border: 1px solid #375C86;
|
|
16
16
|
transform: translateX(-50%) translateY(calc(-100% - 10px));
|
|
17
|
+
opacity: 0;
|
|
18
|
+
transition: opacity 0.2s linear;
|
|
19
|
+
}
|
|
20
|
+
.hy-tooltip.hy-tooltip-show {
|
|
21
|
+
opacity: 1;
|
|
17
22
|
}
|
|
18
23
|
.hy-tooltip.top .hy-popper__arrow {
|
|
19
24
|
left: 50%;
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const isBoolean = (e) => typeof e === 'boolean';
|
|
|
8
8
|
const isUndefined = (e) => e === undefined;
|
|
9
9
|
const isNull = (e) => e === null;
|
|
10
10
|
const isEmpty = (e) => isUndefined(e) || isNull(e) || (!isNumber(e) && !e);
|
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NTEsMTUuNDM0MDEzNiAxMS41NzQxNjY0LDE0Ljg5NTY1NjEgQzExLjkyNjIwNzgsMTQuMzU3Mjk4NyAxMS45NTE0NzUxLDEzLjY4MDA1MDQgMTEuNjQwNDUwMywxMy4xMTkwMjQgQzExLjMyOTQyNTUsMTIuNTU3OTk3NyAxMC43MjkzNjA3LDEyLjE5ODQyNjYgMTAuMDY2Mjk0NSwxMi4xNzU3NTc3IFogTTEzLjgwNTU1NTMsNC4xOTA5NTkwNyBMNi4zMzA0NTEyLDQuMTkwNDc2MTkgQzUuODMwNDY1LDQuMTkwNDc2MTkgNS40MjUxNDYxLDQuNDA2NjY3MzUgNS40MjUxNDYxLDQuNjczMzUyNjUgTDUuNDI1MTQ2MSw5Ljg5ODA3NTkyIEM1LjQyNTE0NjEsMTAuMTY0NzYxMiA1LjgzMDQ2NSwxMC4zODA5NTI0IDYuMzMwNDUxMiwxMC4zODA5NTI0IEwxMy44MDU1NTUzLDEwLjM4MDk1MjQgQzE0LjMwNTU0MTUsMTAuMzgwOTUyNCAxNC43MTA4NjA0LDEwLjE2NDc2MTIgMTQuNzEwODYwNCw5Ljg5ODA3NTkyIEwxNC43MTA4NjA0LDQuNjczODM1NTIgQzE0LjcxMDg2MDQsNC40MDcxNTAyMyAxNC4zMDU1NDE1LDQuMTkwOTU5MDggMTMuODA1NTU1Myw0LjE5MDk1OTA3IFoiIGlkPSIy5aSH5Lu9LTIiIGZpbGw9IiNGRkZGRkYiIGZpbGwtcnVsZT0ibm9uemVybyI+PC9wYXRoPgogICAgPC9nPgo8L3N2Zz4=';
|
|
13
14
|
|
|
@@ -169,6 +170,7 @@ class Tooltip {
|
|
|
169
170
|
_config;
|
|
170
171
|
_focus;
|
|
171
172
|
_timer;
|
|
173
|
+
_openTimer;
|
|
172
174
|
constructor(props) {
|
|
173
175
|
if (!props.bind || !isElement(props.bind))
|
|
174
176
|
throw Error('【bind参数错误】:请传入元素节点');
|
|
@@ -180,11 +182,14 @@ class Tooltip {
|
|
|
180
182
|
placement: "top",
|
|
181
183
|
offset: 0,
|
|
182
184
|
trigger: "hover",
|
|
185
|
+
openDelay: 200,
|
|
183
186
|
autoClose: 0,
|
|
184
187
|
...config
|
|
185
188
|
};
|
|
186
189
|
}
|
|
187
190
|
_render() {
|
|
191
|
+
if (!this._config)
|
|
192
|
+
return;
|
|
188
193
|
const { bind, content } = this._config;
|
|
189
194
|
const el = document.createElement('div');
|
|
190
195
|
el.classList.add('hy-tooltip');
|
|
@@ -200,20 +205,32 @@ class Tooltip {
|
|
|
200
205
|
this._el = el;
|
|
201
206
|
this._focus = setElementFocus({
|
|
202
207
|
container: bind,
|
|
203
|
-
trigger: this._config.trigger,
|
|
208
|
+
trigger: this._config.trigger === 'click' ? 'click' : 'hover',
|
|
204
209
|
onFocus: () => {
|
|
205
210
|
closeActiveTooltip && closeActiveTooltip();
|
|
206
|
-
if (!this._el)
|
|
211
|
+
if (!this._el || !this._config)
|
|
207
212
|
return;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
this.
|
|
211
|
-
|
|
212
|
-
this.
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if (this._config?.trigger === 'hover-overflow' && !isOverflowing(this._config.bind))
|
|
214
|
+
return;
|
|
215
|
+
this._openTimer && clearTimeout(this._openTimer);
|
|
216
|
+
this._openTimer = setTimeout(() => {
|
|
217
|
+
if (!this._config || !this._el)
|
|
218
|
+
return;
|
|
219
|
+
const container = getContainer$1();
|
|
220
|
+
container.appendChild(this._el);
|
|
221
|
+
setTimeout(() => {
|
|
222
|
+
if (!this._el)
|
|
223
|
+
return;
|
|
224
|
+
this._el.classList.add('hy-tooltip-show');
|
|
225
|
+
});
|
|
226
|
+
this.setPopper();
|
|
227
|
+
if (this._config?.autoClose && isNumber(this._config.autoClose)) {
|
|
228
|
+
this._timer && clearTimeout(this._timer);
|
|
229
|
+
this._timer = setTimeout(() => {
|
|
230
|
+
this._focus && this._focus.blur();
|
|
231
|
+
}, this._config?.autoClose);
|
|
232
|
+
}
|
|
233
|
+
}, this._config.openDelay || 0);
|
|
217
234
|
},
|
|
218
235
|
onBlur: () => {
|
|
219
236
|
this._timer && clearTimeout(this._timer);
|
|
@@ -248,11 +265,13 @@ class Tooltip {
|
|
|
248
265
|
closeActiveTooltip = this.hide.bind(this);
|
|
249
266
|
}
|
|
250
267
|
hide() {
|
|
268
|
+
this._openTimer && clearTimeout(this._openTimer);
|
|
251
269
|
if (!this._el || !this._el.parentElement)
|
|
252
270
|
return;
|
|
253
271
|
this._el.style.setProperty('top', '-10000px');
|
|
254
272
|
this._el.style.setProperty('left', '-10000px');
|
|
255
273
|
this._el.parentElement.removeChild(this._el);
|
|
274
|
+
this._el.classList.remove('hy-tooltip-show');
|
|
256
275
|
}
|
|
257
276
|
destroy() {
|
|
258
277
|
this._timer && clearTimeout(this._timer);
|
|
@@ -1952,6 +1971,25 @@ const useIcon = (config, data, node) => {
|
|
|
1952
1971
|
return new Icon({ svgName: 'menu_acquisitionStation_svg' });
|
|
1953
1972
|
}
|
|
1954
1973
|
};
|
|
1974
|
+
// 生成内容节点
|
|
1975
|
+
const useContent = (data, node) => {
|
|
1976
|
+
const el = document.createElement('div');
|
|
1977
|
+
el.innerHTML = node.label || '';
|
|
1978
|
+
if (node.label) {
|
|
1979
|
+
new Tooltip({
|
|
1980
|
+
bind: el,
|
|
1981
|
+
content: node.label,
|
|
1982
|
+
placement: 'top',
|
|
1983
|
+
trigger: 'hover-overflow'
|
|
1984
|
+
});
|
|
1985
|
+
// // @ts-ignore
|
|
1986
|
+
// el.$destroy = () => {
|
|
1987
|
+
// tooltip.hide()
|
|
1988
|
+
// tooltip && tooltip.destroy()
|
|
1989
|
+
// }
|
|
1990
|
+
}
|
|
1991
|
+
return el;
|
|
1992
|
+
};
|
|
1955
1993
|
|
|
1956
1994
|
function decodeBase64(base64, enableUnicode) {
|
|
1957
1995
|
var binaryString = atob(base64);
|
|
@@ -9267,12 +9305,6 @@ class VirtualTree {
|
|
|
9267
9305
|
return;
|
|
9268
9306
|
return icon._el;
|
|
9269
9307
|
};
|
|
9270
|
-
/** 生成内容 */
|
|
9271
|
-
const generateContent = (data, item) => {
|
|
9272
|
-
const el = document.createElement('div');
|
|
9273
|
-
el.innerHTML = item.label || '';
|
|
9274
|
-
return el;
|
|
9275
|
-
};
|
|
9276
9308
|
/** 生成统计 */
|
|
9277
9309
|
const generateStats = (data, item) => {
|
|
9278
9310
|
if (!isShowCount(this._props.showCount, item))
|
|
@@ -9403,7 +9435,7 @@ class VirtualTree {
|
|
|
9403
9435
|
// 图标
|
|
9404
9436
|
this._customRender(config.renderIcon, node, { inset: true, parent: content, className: 'hy-tree-icon', defaultFn: generateIcon });
|
|
9405
9437
|
// 内容
|
|
9406
|
-
this._customRender(config.renderContent, node, { inset: true, parent: content, className: 'hy-tree-node__content', defaultFn:
|
|
9438
|
+
this._customRender(config.renderContent, node, { inset: true, parent: content, className: 'hy-tree-node__content', defaultFn: useContent });
|
|
9407
9439
|
// 统计
|
|
9408
9440
|
this._customRender(generateStats, node, { parent: content });
|
|
9409
9441
|
// 右侧内容
|
|
@@ -9864,4 +9896,4 @@ class VirtualTree {
|
|
|
9864
9896
|
};
|
|
9865
9897
|
}
|
|
9866
9898
|
|
|
9867
|
-
export { Business, DataType, DeviceStatus, VirtualScroll, VirtualTree, getGlobalDeviceStatus, isArray, isBoolean, isElement, isEmpty, isFunction, isNull, isNumber, isObject, isString, isUndefined, setGlobalDeviceStatus };
|
|
9899
|
+
export { Business, DataType, DeviceStatus, VirtualScroll, VirtualTree, getGlobalDeviceStatus, isArray, isBoolean, isElement, isEmpty, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isUndefined, setGlobalDeviceStatus };
|