@dev-tcloud/tcloud-ui 0.1.18 → 0.1.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.
- package/esm2020/lib/_directives/tooltip/tooltip.directive.mjs +35 -32
- package/fesm2015/dev-tcloud-tcloud-ui.mjs +35 -32
- package/fesm2015/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/fesm2020/dev-tcloud-tcloud-ui.mjs +34 -31
- package/fesm2020/dev-tcloud-tcloud-ui.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -4410,38 +4410,41 @@ class TCloudUiTooltipDirective {
|
|
|
4410
4410
|
}
|
|
4411
4411
|
};
|
|
4412
4412
|
hoverOutCallback;
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
const left = `${el_position_x + (width / 2)}px`;
|
|
4428
|
-
this.renderer.setStyle(tooltip, 'top', '0px');
|
|
4429
|
-
this.renderer.setStyle(tooltip, 'left', '0px');
|
|
4430
|
-
this.renderer.setStyle(tooltip, 'opacity', '0');
|
|
4431
|
-
this.renderer.addClass(tooltip, 'tc-directive-tooltip');
|
|
4432
|
-
this.renderer.addClass(tooltip, `tc-directive-tooltip-${direction}`);
|
|
4433
|
-
const id = this.generateID();
|
|
4434
|
-
this.renderer.setAttribute(tooltip, 'id', id);
|
|
4435
|
-
const textNode = this.info_text;
|
|
4436
|
-
if (textNode !== undefined && textNode !== null && textNode !== '') {
|
|
4437
|
-
tooltip.innerHTML = textNode;
|
|
4438
|
-
this.renderer.appendChild(document.body, tooltip);
|
|
4439
|
-
this.start_tooltip(id, height, width, el_position_x, el_position_y, direction);
|
|
4440
|
-
if (tooltip) {
|
|
4441
|
-
tooltip.addEventListener('mouseenter', hoverInCallback);
|
|
4442
|
-
tooltip.addEventListener('mouseleave', hoverOutCallback);
|
|
4413
|
+
setTimeout(() => {
|
|
4414
|
+
const scrollTop = window.scrollY || window.pageYOffset;
|
|
4415
|
+
const tooltip = this.renderer.createElement('div');
|
|
4416
|
+
const rect = this.el.nativeElement?.getBoundingClientRect();
|
|
4417
|
+
// const direction = this.el.nativeElement?.attributes['ng-reflect--t-cdirection']?.value || 'top';
|
|
4418
|
+
const direction = this._direction || 'top';
|
|
4419
|
+
const el_position_x = (rect?.left) ? parseInt(rect?.left) : 0;
|
|
4420
|
+
const el_position_y = (rect?.top) ? parseInt(rect?.top + scrollTop) : 0;
|
|
4421
|
+
let width = 0;
|
|
4422
|
+
let height = 0;
|
|
4423
|
+
if (event && event.target) {
|
|
4424
|
+
const _event = event.target;
|
|
4425
|
+
height = _event.offsetHeight;
|
|
4426
|
+
width = _event.offsetWidth;
|
|
4443
4427
|
}
|
|
4444
|
-
|
|
4428
|
+
const top = `${(el_position_y - ((height / 2) + 10))}px`;
|
|
4429
|
+
const left = `${el_position_x + (width / 2)}px`;
|
|
4430
|
+
this.renderer.setStyle(tooltip, 'top', '0px');
|
|
4431
|
+
this.renderer.setStyle(tooltip, 'left', '0px');
|
|
4432
|
+
this.renderer.setStyle(tooltip, 'opacity', '0');
|
|
4433
|
+
this.renderer.addClass(tooltip, 'tc-directive-tooltip');
|
|
4434
|
+
this.renderer.addClass(tooltip, `tc-directive-tooltip-${direction}`);
|
|
4435
|
+
const id = this.generateID();
|
|
4436
|
+
this.renderer.setAttribute(tooltip, 'id', id);
|
|
4437
|
+
const textNode = this.info_text;
|
|
4438
|
+
if (textNode !== undefined && textNode !== null && textNode !== '') {
|
|
4439
|
+
tooltip.innerHTML = textNode;
|
|
4440
|
+
this.renderer.appendChild(document.body, tooltip);
|
|
4441
|
+
this.start_tooltip(id, height, width, el_position_x, el_position_y, direction);
|
|
4442
|
+
if (tooltip) {
|
|
4443
|
+
tooltip.addEventListener('mouseenter', hoverInCallback);
|
|
4444
|
+
tooltip.addEventListener('mouseleave', hoverOutCallback);
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
});
|
|
4445
4448
|
}
|
|
4446
4449
|
onMouseOut(event) {
|
|
4447
4450
|
this.remove = true;
|