myio-js-library 0.1.206 → 0.1.208
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/dist/index.cjs +72 -17
- package/dist/index.d.cts +5 -0
- package/dist/index.js +72 -17
- package/dist/myio-js-library.umd.js +72 -17
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1572,7 +1572,7 @@ function isDeviceOffline(deviceStatus) {
|
|
|
1572
1572
|
}
|
|
1573
1573
|
function getDeviceStatusIcon(deviceStatus, deviceType = null) {
|
|
1574
1574
|
const normalizedType = deviceType?.toUpperCase() || "";
|
|
1575
|
-
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO";
|
|
1575
|
+
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO" || normalizedType === "HIDROMETRO_AREA_COMUM" || normalizedType === "HIDROMETRO_SHOPPING" || normalizedType.startsWith("HIDROMETRO_");
|
|
1576
1576
|
const isTemperatureDevice = normalizedType === "TERMOSTATO";
|
|
1577
1577
|
let iconMap;
|
|
1578
1578
|
if (isWaterDevice) {
|
|
@@ -11947,6 +11947,14 @@ var DEVICE_TYPE_CONFIG = {
|
|
|
11947
11947
|
category: "water",
|
|
11948
11948
|
image: "https://dashboard.myio-bas.com/api/images/public/aMQYFJbGHs9gQbQkMn6XseAlUZHanBR4"
|
|
11949
11949
|
},
|
|
11950
|
+
HIDROMETRO_AREA_COMUM: {
|
|
11951
|
+
category: "water",
|
|
11952
|
+
image: "https://dashboard.myio-bas.com/api/images/public/IbEhjsvixAxwKg1ntGGZc5xZwwvGKv2t"
|
|
11953
|
+
},
|
|
11954
|
+
HIDROMETRO_SHOPPING: {
|
|
11955
|
+
category: "water",
|
|
11956
|
+
image: "https://dashboard.myio-bas.com/api/images/public/OIMmvN4ZTKYDvrpPGYY5agqMRoSaWNTI"
|
|
11957
|
+
},
|
|
11950
11958
|
CAIXA_DAGUA: {
|
|
11951
11959
|
category: "water",
|
|
11952
11960
|
image: "https://dashboard.myio-bas.com/api/images/public/3t6WVhMQJFsrKA8bSZmrngDsNPkZV7fq"
|
|
@@ -12473,7 +12481,9 @@ function renderCardComponentV5({
|
|
|
12473
12481
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
12474
12482
|
</div>
|
|
12475
12483
|
</div>
|
|
12476
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12484
|
+
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12485
|
+
1
|
|
12486
|
+
)}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
12477
12487
|
</div>
|
|
12478
12488
|
</div>
|
|
12479
12489
|
</div>
|
|
@@ -36300,14 +36310,18 @@ function injectCSS7() {
|
|
|
36300
36310
|
document.head.appendChild(style);
|
|
36301
36311
|
cssInjected7 = true;
|
|
36302
36312
|
}
|
|
36313
|
+
var HIDE_DELAY_MS = 2500;
|
|
36314
|
+
var SAFETY_TIMEOUT_MS = 15e3;
|
|
36303
36315
|
var state3 = {
|
|
36304
36316
|
hideTimer: null,
|
|
36317
|
+
safetyTimer: null,
|
|
36305
36318
|
isMouseOverTooltip: false,
|
|
36306
36319
|
isMaximized: false,
|
|
36307
36320
|
isDragging: false,
|
|
36308
36321
|
dragOffset: { x: 0, y: 0 },
|
|
36309
36322
|
savedPosition: null,
|
|
36310
|
-
pinnedCounter: 0
|
|
36323
|
+
pinnedCounter: 0,
|
|
36324
|
+
isPinned: false
|
|
36311
36325
|
};
|
|
36312
36326
|
function generateHeaderHTML3(icon, title) {
|
|
36313
36327
|
return `
|
|
@@ -36343,6 +36357,7 @@ function setupHoverListeners3(container) {
|
|
|
36343
36357
|
clearTimeout(state3.hideTimer);
|
|
36344
36358
|
state3.hideTimer = null;
|
|
36345
36359
|
}
|
|
36360
|
+
resetSafetyTimer();
|
|
36346
36361
|
};
|
|
36347
36362
|
container.onmouseleave = () => {
|
|
36348
36363
|
state3.isMouseOverTooltip = false;
|
|
@@ -36524,15 +36539,42 @@ function toggleMaximize3(container) {
|
|
|
36524
36539
|
}
|
|
36525
36540
|
}
|
|
36526
36541
|
function startDelayedHide3() {
|
|
36527
|
-
if (state3.isMouseOverTooltip) return;
|
|
36542
|
+
if (state3.isMouseOverTooltip || state3.isPinned) return;
|
|
36528
36543
|
if (state3.hideTimer) {
|
|
36529
36544
|
clearTimeout(state3.hideTimer);
|
|
36530
36545
|
}
|
|
36531
36546
|
state3.hideTimer = setTimeout(() => {
|
|
36532
36547
|
hideWithAnimation3();
|
|
36533
|
-
},
|
|
36548
|
+
}, HIDE_DELAY_MS);
|
|
36549
|
+
}
|
|
36550
|
+
function resetSafetyTimer() {
|
|
36551
|
+
if (state3.safetyTimer) {
|
|
36552
|
+
clearTimeout(state3.safetyTimer);
|
|
36553
|
+
state3.safetyTimer = null;
|
|
36554
|
+
}
|
|
36555
|
+
const container = document.getElementById("myio-info-tooltip");
|
|
36556
|
+
if (container && container.classList.contains("visible") && !state3.isPinned) {
|
|
36557
|
+
state3.safetyTimer = setTimeout(() => {
|
|
36558
|
+
console.log("[InfoTooltip] Safety timeout reached - forcing hide");
|
|
36559
|
+
InfoTooltip.destroy();
|
|
36560
|
+
}, SAFETY_TIMEOUT_MS);
|
|
36561
|
+
}
|
|
36562
|
+
}
|
|
36563
|
+
function clearAllTimers() {
|
|
36564
|
+
if (state3.hideTimer) {
|
|
36565
|
+
clearTimeout(state3.hideTimer);
|
|
36566
|
+
state3.hideTimer = null;
|
|
36567
|
+
}
|
|
36568
|
+
if (state3.safetyTimer) {
|
|
36569
|
+
clearTimeout(state3.safetyTimer);
|
|
36570
|
+
state3.safetyTimer = null;
|
|
36571
|
+
}
|
|
36534
36572
|
}
|
|
36535
36573
|
function hideWithAnimation3() {
|
|
36574
|
+
if (state3.safetyTimer) {
|
|
36575
|
+
clearTimeout(state3.safetyTimer);
|
|
36576
|
+
state3.safetyTimer = null;
|
|
36577
|
+
}
|
|
36536
36578
|
const container = document.getElementById("myio-info-tooltip");
|
|
36537
36579
|
if (container && container.classList.contains("visible")) {
|
|
36538
36580
|
container.classList.add("closing");
|
|
@@ -36577,12 +36619,10 @@ var InfoTooltip = {
|
|
|
36577
36619
|
* Show tooltip
|
|
36578
36620
|
*/
|
|
36579
36621
|
show(triggerElement, options) {
|
|
36580
|
-
|
|
36581
|
-
clearTimeout(state3.hideTimer);
|
|
36582
|
-
state3.hideTimer = null;
|
|
36583
|
-
}
|
|
36622
|
+
clearAllTimers();
|
|
36584
36623
|
const container = this.getContainer();
|
|
36585
36624
|
container.classList.remove("closing");
|
|
36625
|
+
state3.isPinned = false;
|
|
36586
36626
|
container.innerHTML = `
|
|
36587
36627
|
<div class="myio-info-tooltip__panel">
|
|
36588
36628
|
${generateHeaderHTML3(options.icon, options.title)}
|
|
@@ -36596,6 +36636,7 @@ var InfoTooltip = {
|
|
|
36596
36636
|
setupHoverListeners3(container);
|
|
36597
36637
|
setupButtonListeners3(container);
|
|
36598
36638
|
setupDragListeners3(container);
|
|
36639
|
+
resetSafetyTimer();
|
|
36599
36640
|
},
|
|
36600
36641
|
/**
|
|
36601
36642
|
* Start delayed hide
|
|
@@ -36607,10 +36648,7 @@ var InfoTooltip = {
|
|
|
36607
36648
|
* Hide immediately
|
|
36608
36649
|
*/
|
|
36609
36650
|
hide() {
|
|
36610
|
-
|
|
36611
|
-
clearTimeout(state3.hideTimer);
|
|
36612
|
-
state3.hideTimer = null;
|
|
36613
|
-
}
|
|
36651
|
+
clearAllTimers();
|
|
36614
36652
|
state3.isMouseOverTooltip = false;
|
|
36615
36653
|
const container = document.getElementById(this.containerId);
|
|
36616
36654
|
if (container) {
|
|
@@ -36621,19 +36659,36 @@ var InfoTooltip = {
|
|
|
36621
36659
|
* Close and reset all states
|
|
36622
36660
|
*/
|
|
36623
36661
|
close() {
|
|
36662
|
+
clearAllTimers();
|
|
36624
36663
|
state3.isMaximized = false;
|
|
36625
36664
|
state3.isDragging = false;
|
|
36626
36665
|
state3.savedPosition = null;
|
|
36627
|
-
if (state3.hideTimer) {
|
|
36628
|
-
clearTimeout(state3.hideTimer);
|
|
36629
|
-
state3.hideTimer = null;
|
|
36630
|
-
}
|
|
36631
36666
|
state3.isMouseOverTooltip = false;
|
|
36667
|
+
state3.isPinned = false;
|
|
36632
36668
|
const container = document.getElementById(this.containerId);
|
|
36633
36669
|
if (container) {
|
|
36634
36670
|
container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
|
|
36635
36671
|
}
|
|
36636
36672
|
},
|
|
36673
|
+
/**
|
|
36674
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
36675
|
+
* Removes from DOM and clears all timers/state
|
|
36676
|
+
*/
|
|
36677
|
+
destroy() {
|
|
36678
|
+
clearAllTimers();
|
|
36679
|
+
state3.isMaximized = false;
|
|
36680
|
+
state3.isDragging = false;
|
|
36681
|
+
state3.savedPosition = null;
|
|
36682
|
+
state3.isMouseOverTooltip = false;
|
|
36683
|
+
state3.isPinned = false;
|
|
36684
|
+
const container = document.getElementById(this.containerId);
|
|
36685
|
+
if (container) {
|
|
36686
|
+
container.remove();
|
|
36687
|
+
}
|
|
36688
|
+
const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
|
|
36689
|
+
pinnedClones.forEach((clone) => clone.remove());
|
|
36690
|
+
console.log("[InfoTooltip] Destroyed - all tooltips removed");
|
|
36691
|
+
},
|
|
36637
36692
|
/**
|
|
36638
36693
|
* Attach tooltip to trigger element with hover behavior
|
|
36639
36694
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -3522,6 +3522,11 @@ declare const InfoTooltip: {
|
|
|
3522
3522
|
* Close and reset all states
|
|
3523
3523
|
*/
|
|
3524
3524
|
close(): void;
|
|
3525
|
+
/**
|
|
3526
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
3527
|
+
* Removes from DOM and clears all timers/state
|
|
3528
|
+
*/
|
|
3529
|
+
destroy(): void;
|
|
3525
3530
|
/**
|
|
3526
3531
|
* Attach tooltip to trigger element with hover behavior
|
|
3527
3532
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1400,7 +1400,7 @@ function isDeviceOffline(deviceStatus) {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
function getDeviceStatusIcon(deviceStatus, deviceType = null) {
|
|
1402
1402
|
const normalizedType = deviceType?.toUpperCase() || "";
|
|
1403
|
-
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO";
|
|
1403
|
+
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO" || normalizedType === "HIDROMETRO_AREA_COMUM" || normalizedType === "HIDROMETRO_SHOPPING" || normalizedType.startsWith("HIDROMETRO_");
|
|
1404
1404
|
const isTemperatureDevice = normalizedType === "TERMOSTATO";
|
|
1405
1405
|
let iconMap;
|
|
1406
1406
|
if (isWaterDevice) {
|
|
@@ -11775,6 +11775,14 @@ var DEVICE_TYPE_CONFIG = {
|
|
|
11775
11775
|
category: "water",
|
|
11776
11776
|
image: "https://dashboard.myio-bas.com/api/images/public/aMQYFJbGHs9gQbQkMn6XseAlUZHanBR4"
|
|
11777
11777
|
},
|
|
11778
|
+
HIDROMETRO_AREA_COMUM: {
|
|
11779
|
+
category: "water",
|
|
11780
|
+
image: "https://dashboard.myio-bas.com/api/images/public/IbEhjsvixAxwKg1ntGGZc5xZwwvGKv2t"
|
|
11781
|
+
},
|
|
11782
|
+
HIDROMETRO_SHOPPING: {
|
|
11783
|
+
category: "water",
|
|
11784
|
+
image: "https://dashboard.myio-bas.com/api/images/public/OIMmvN4ZTKYDvrpPGYY5agqMRoSaWNTI"
|
|
11785
|
+
},
|
|
11778
11786
|
CAIXA_DAGUA: {
|
|
11779
11787
|
category: "water",
|
|
11780
11788
|
image: "https://dashboard.myio-bas.com/api/images/public/3t6WVhMQJFsrKA8bSZmrngDsNPkZV7fq"
|
|
@@ -12301,7 +12309,9 @@ function renderCardComponentV5({
|
|
|
12301
12309
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
12302
12310
|
</div>
|
|
12303
12311
|
</div>
|
|
12304
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12312
|
+
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12313
|
+
1
|
|
12314
|
+
)}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
12305
12315
|
</div>
|
|
12306
12316
|
</div>
|
|
12307
12317
|
</div>
|
|
@@ -36128,14 +36138,18 @@ function injectCSS7() {
|
|
|
36128
36138
|
document.head.appendChild(style);
|
|
36129
36139
|
cssInjected7 = true;
|
|
36130
36140
|
}
|
|
36141
|
+
var HIDE_DELAY_MS = 2500;
|
|
36142
|
+
var SAFETY_TIMEOUT_MS = 15e3;
|
|
36131
36143
|
var state3 = {
|
|
36132
36144
|
hideTimer: null,
|
|
36145
|
+
safetyTimer: null,
|
|
36133
36146
|
isMouseOverTooltip: false,
|
|
36134
36147
|
isMaximized: false,
|
|
36135
36148
|
isDragging: false,
|
|
36136
36149
|
dragOffset: { x: 0, y: 0 },
|
|
36137
36150
|
savedPosition: null,
|
|
36138
|
-
pinnedCounter: 0
|
|
36151
|
+
pinnedCounter: 0,
|
|
36152
|
+
isPinned: false
|
|
36139
36153
|
};
|
|
36140
36154
|
function generateHeaderHTML3(icon, title) {
|
|
36141
36155
|
return `
|
|
@@ -36171,6 +36185,7 @@ function setupHoverListeners3(container) {
|
|
|
36171
36185
|
clearTimeout(state3.hideTimer);
|
|
36172
36186
|
state3.hideTimer = null;
|
|
36173
36187
|
}
|
|
36188
|
+
resetSafetyTimer();
|
|
36174
36189
|
};
|
|
36175
36190
|
container.onmouseleave = () => {
|
|
36176
36191
|
state3.isMouseOverTooltip = false;
|
|
@@ -36352,15 +36367,42 @@ function toggleMaximize3(container) {
|
|
|
36352
36367
|
}
|
|
36353
36368
|
}
|
|
36354
36369
|
function startDelayedHide3() {
|
|
36355
|
-
if (state3.isMouseOverTooltip) return;
|
|
36370
|
+
if (state3.isMouseOverTooltip || state3.isPinned) return;
|
|
36356
36371
|
if (state3.hideTimer) {
|
|
36357
36372
|
clearTimeout(state3.hideTimer);
|
|
36358
36373
|
}
|
|
36359
36374
|
state3.hideTimer = setTimeout(() => {
|
|
36360
36375
|
hideWithAnimation3();
|
|
36361
|
-
},
|
|
36376
|
+
}, HIDE_DELAY_MS);
|
|
36377
|
+
}
|
|
36378
|
+
function resetSafetyTimer() {
|
|
36379
|
+
if (state3.safetyTimer) {
|
|
36380
|
+
clearTimeout(state3.safetyTimer);
|
|
36381
|
+
state3.safetyTimer = null;
|
|
36382
|
+
}
|
|
36383
|
+
const container = document.getElementById("myio-info-tooltip");
|
|
36384
|
+
if (container && container.classList.contains("visible") && !state3.isPinned) {
|
|
36385
|
+
state3.safetyTimer = setTimeout(() => {
|
|
36386
|
+
console.log("[InfoTooltip] Safety timeout reached - forcing hide");
|
|
36387
|
+
InfoTooltip.destroy();
|
|
36388
|
+
}, SAFETY_TIMEOUT_MS);
|
|
36389
|
+
}
|
|
36390
|
+
}
|
|
36391
|
+
function clearAllTimers() {
|
|
36392
|
+
if (state3.hideTimer) {
|
|
36393
|
+
clearTimeout(state3.hideTimer);
|
|
36394
|
+
state3.hideTimer = null;
|
|
36395
|
+
}
|
|
36396
|
+
if (state3.safetyTimer) {
|
|
36397
|
+
clearTimeout(state3.safetyTimer);
|
|
36398
|
+
state3.safetyTimer = null;
|
|
36399
|
+
}
|
|
36362
36400
|
}
|
|
36363
36401
|
function hideWithAnimation3() {
|
|
36402
|
+
if (state3.safetyTimer) {
|
|
36403
|
+
clearTimeout(state3.safetyTimer);
|
|
36404
|
+
state3.safetyTimer = null;
|
|
36405
|
+
}
|
|
36364
36406
|
const container = document.getElementById("myio-info-tooltip");
|
|
36365
36407
|
if (container && container.classList.contains("visible")) {
|
|
36366
36408
|
container.classList.add("closing");
|
|
@@ -36405,12 +36447,10 @@ var InfoTooltip = {
|
|
|
36405
36447
|
* Show tooltip
|
|
36406
36448
|
*/
|
|
36407
36449
|
show(triggerElement, options) {
|
|
36408
|
-
|
|
36409
|
-
clearTimeout(state3.hideTimer);
|
|
36410
|
-
state3.hideTimer = null;
|
|
36411
|
-
}
|
|
36450
|
+
clearAllTimers();
|
|
36412
36451
|
const container = this.getContainer();
|
|
36413
36452
|
container.classList.remove("closing");
|
|
36453
|
+
state3.isPinned = false;
|
|
36414
36454
|
container.innerHTML = `
|
|
36415
36455
|
<div class="myio-info-tooltip__panel">
|
|
36416
36456
|
${generateHeaderHTML3(options.icon, options.title)}
|
|
@@ -36424,6 +36464,7 @@ var InfoTooltip = {
|
|
|
36424
36464
|
setupHoverListeners3(container);
|
|
36425
36465
|
setupButtonListeners3(container);
|
|
36426
36466
|
setupDragListeners3(container);
|
|
36467
|
+
resetSafetyTimer();
|
|
36427
36468
|
},
|
|
36428
36469
|
/**
|
|
36429
36470
|
* Start delayed hide
|
|
@@ -36435,10 +36476,7 @@ var InfoTooltip = {
|
|
|
36435
36476
|
* Hide immediately
|
|
36436
36477
|
*/
|
|
36437
36478
|
hide() {
|
|
36438
|
-
|
|
36439
|
-
clearTimeout(state3.hideTimer);
|
|
36440
|
-
state3.hideTimer = null;
|
|
36441
|
-
}
|
|
36479
|
+
clearAllTimers();
|
|
36442
36480
|
state3.isMouseOverTooltip = false;
|
|
36443
36481
|
const container = document.getElementById(this.containerId);
|
|
36444
36482
|
if (container) {
|
|
@@ -36449,19 +36487,36 @@ var InfoTooltip = {
|
|
|
36449
36487
|
* Close and reset all states
|
|
36450
36488
|
*/
|
|
36451
36489
|
close() {
|
|
36490
|
+
clearAllTimers();
|
|
36452
36491
|
state3.isMaximized = false;
|
|
36453
36492
|
state3.isDragging = false;
|
|
36454
36493
|
state3.savedPosition = null;
|
|
36455
|
-
if (state3.hideTimer) {
|
|
36456
|
-
clearTimeout(state3.hideTimer);
|
|
36457
|
-
state3.hideTimer = null;
|
|
36458
|
-
}
|
|
36459
36494
|
state3.isMouseOverTooltip = false;
|
|
36495
|
+
state3.isPinned = false;
|
|
36460
36496
|
const container = document.getElementById(this.containerId);
|
|
36461
36497
|
if (container) {
|
|
36462
36498
|
container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
|
|
36463
36499
|
}
|
|
36464
36500
|
},
|
|
36501
|
+
/**
|
|
36502
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
36503
|
+
* Removes from DOM and clears all timers/state
|
|
36504
|
+
*/
|
|
36505
|
+
destroy() {
|
|
36506
|
+
clearAllTimers();
|
|
36507
|
+
state3.isMaximized = false;
|
|
36508
|
+
state3.isDragging = false;
|
|
36509
|
+
state3.savedPosition = null;
|
|
36510
|
+
state3.isMouseOverTooltip = false;
|
|
36511
|
+
state3.isPinned = false;
|
|
36512
|
+
const container = document.getElementById(this.containerId);
|
|
36513
|
+
if (container) {
|
|
36514
|
+
container.remove();
|
|
36515
|
+
}
|
|
36516
|
+
const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
|
|
36517
|
+
pinnedClones.forEach((clone) => clone.remove());
|
|
36518
|
+
console.log("[InfoTooltip] Destroyed - all tooltips removed");
|
|
36519
|
+
},
|
|
36465
36520
|
/**
|
|
36466
36521
|
* Attach tooltip to trigger element with hover behavior
|
|
36467
36522
|
*/
|
|
@@ -1406,7 +1406,7 @@
|
|
|
1406
1406
|
}
|
|
1407
1407
|
function getDeviceStatusIcon(deviceStatus, deviceType = null) {
|
|
1408
1408
|
const normalizedType = deviceType?.toUpperCase() || "";
|
|
1409
|
-
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO";
|
|
1409
|
+
const isWaterDevice = normalizedType === "TANK" || normalizedType === "CAIXA_DAGUA" || normalizedType === "HIDROMETRO" || normalizedType === "HIDROMETRO_AREA_COMUM" || normalizedType === "HIDROMETRO_SHOPPING" || normalizedType.startsWith("HIDROMETRO_");
|
|
1410
1410
|
const isTemperatureDevice = normalizedType === "TERMOSTATO";
|
|
1411
1411
|
let iconMap;
|
|
1412
1412
|
if (isWaterDevice) {
|
|
@@ -11763,6 +11763,14 @@
|
|
|
11763
11763
|
category: "water",
|
|
11764
11764
|
image: "https://dashboard.myio-bas.com/api/images/public/aMQYFJbGHs9gQbQkMn6XseAlUZHanBR4"
|
|
11765
11765
|
},
|
|
11766
|
+
HIDROMETRO_AREA_COMUM: {
|
|
11767
|
+
category: "water",
|
|
11768
|
+
image: "https://dashboard.myio-bas.com/api/images/public/IbEhjsvixAxwKg1ntGGZc5xZwwvGKv2t"
|
|
11769
|
+
},
|
|
11770
|
+
HIDROMETRO_SHOPPING: {
|
|
11771
|
+
category: "water",
|
|
11772
|
+
image: "https://dashboard.myio-bas.com/api/images/public/OIMmvN4ZTKYDvrpPGYY5agqMRoSaWNTI"
|
|
11773
|
+
},
|
|
11766
11774
|
CAIXA_DAGUA: {
|
|
11767
11775
|
category: "water",
|
|
11768
11776
|
image: "https://dashboard.myio-bas.com/api/images/public/3t6WVhMQJFsrKA8bSZmrngDsNPkZV7fq"
|
|
@@ -12289,7 +12297,9 @@
|
|
|
12289
12297
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
12290
12298
|
</div>
|
|
12291
12299
|
</div>
|
|
12292
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12300
|
+
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(
|
|
12301
|
+
1
|
|
12302
|
+
)}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
12293
12303
|
</div>
|
|
12294
12304
|
</div>
|
|
12295
12305
|
</div>
|
|
@@ -35942,14 +35952,18 @@
|
|
|
35942
35952
|
document.head.appendChild(style);
|
|
35943
35953
|
cssInjected7 = true;
|
|
35944
35954
|
}
|
|
35955
|
+
var HIDE_DELAY_MS = 2500;
|
|
35956
|
+
var SAFETY_TIMEOUT_MS = 15e3;
|
|
35945
35957
|
var state3 = {
|
|
35946
35958
|
hideTimer: null,
|
|
35959
|
+
safetyTimer: null,
|
|
35947
35960
|
isMouseOverTooltip: false,
|
|
35948
35961
|
isMaximized: false,
|
|
35949
35962
|
isDragging: false,
|
|
35950
35963
|
dragOffset: { x: 0, y: 0 },
|
|
35951
35964
|
savedPosition: null,
|
|
35952
|
-
pinnedCounter: 0
|
|
35965
|
+
pinnedCounter: 0,
|
|
35966
|
+
isPinned: false
|
|
35953
35967
|
};
|
|
35954
35968
|
function generateHeaderHTML3(icon, title) {
|
|
35955
35969
|
return `
|
|
@@ -35985,6 +35999,7 @@
|
|
|
35985
35999
|
clearTimeout(state3.hideTimer);
|
|
35986
36000
|
state3.hideTimer = null;
|
|
35987
36001
|
}
|
|
36002
|
+
resetSafetyTimer();
|
|
35988
36003
|
};
|
|
35989
36004
|
container.onmouseleave = () => {
|
|
35990
36005
|
state3.isMouseOverTooltip = false;
|
|
@@ -36166,15 +36181,42 @@
|
|
|
36166
36181
|
}
|
|
36167
36182
|
}
|
|
36168
36183
|
function startDelayedHide3() {
|
|
36169
|
-
if (state3.isMouseOverTooltip) return;
|
|
36184
|
+
if (state3.isMouseOverTooltip || state3.isPinned) return;
|
|
36170
36185
|
if (state3.hideTimer) {
|
|
36171
36186
|
clearTimeout(state3.hideTimer);
|
|
36172
36187
|
}
|
|
36173
36188
|
state3.hideTimer = setTimeout(() => {
|
|
36174
36189
|
hideWithAnimation3();
|
|
36175
|
-
},
|
|
36190
|
+
}, HIDE_DELAY_MS);
|
|
36191
|
+
}
|
|
36192
|
+
function resetSafetyTimer() {
|
|
36193
|
+
if (state3.safetyTimer) {
|
|
36194
|
+
clearTimeout(state3.safetyTimer);
|
|
36195
|
+
state3.safetyTimer = null;
|
|
36196
|
+
}
|
|
36197
|
+
const container = document.getElementById("myio-info-tooltip");
|
|
36198
|
+
if (container && container.classList.contains("visible") && !state3.isPinned) {
|
|
36199
|
+
state3.safetyTimer = setTimeout(() => {
|
|
36200
|
+
console.log("[InfoTooltip] Safety timeout reached - forcing hide");
|
|
36201
|
+
InfoTooltip.destroy();
|
|
36202
|
+
}, SAFETY_TIMEOUT_MS);
|
|
36203
|
+
}
|
|
36204
|
+
}
|
|
36205
|
+
function clearAllTimers() {
|
|
36206
|
+
if (state3.hideTimer) {
|
|
36207
|
+
clearTimeout(state3.hideTimer);
|
|
36208
|
+
state3.hideTimer = null;
|
|
36209
|
+
}
|
|
36210
|
+
if (state3.safetyTimer) {
|
|
36211
|
+
clearTimeout(state3.safetyTimer);
|
|
36212
|
+
state3.safetyTimer = null;
|
|
36213
|
+
}
|
|
36176
36214
|
}
|
|
36177
36215
|
function hideWithAnimation3() {
|
|
36216
|
+
if (state3.safetyTimer) {
|
|
36217
|
+
clearTimeout(state3.safetyTimer);
|
|
36218
|
+
state3.safetyTimer = null;
|
|
36219
|
+
}
|
|
36178
36220
|
const container = document.getElementById("myio-info-tooltip");
|
|
36179
36221
|
if (container && container.classList.contains("visible")) {
|
|
36180
36222
|
container.classList.add("closing");
|
|
@@ -36219,12 +36261,10 @@
|
|
|
36219
36261
|
* Show tooltip
|
|
36220
36262
|
*/
|
|
36221
36263
|
show(triggerElement, options) {
|
|
36222
|
-
|
|
36223
|
-
clearTimeout(state3.hideTimer);
|
|
36224
|
-
state3.hideTimer = null;
|
|
36225
|
-
}
|
|
36264
|
+
clearAllTimers();
|
|
36226
36265
|
const container = this.getContainer();
|
|
36227
36266
|
container.classList.remove("closing");
|
|
36267
|
+
state3.isPinned = false;
|
|
36228
36268
|
container.innerHTML = `
|
|
36229
36269
|
<div class="myio-info-tooltip__panel">
|
|
36230
36270
|
${generateHeaderHTML3(options.icon, options.title)}
|
|
@@ -36238,6 +36278,7 @@
|
|
|
36238
36278
|
setupHoverListeners3(container);
|
|
36239
36279
|
setupButtonListeners3(container);
|
|
36240
36280
|
setupDragListeners3(container);
|
|
36281
|
+
resetSafetyTimer();
|
|
36241
36282
|
},
|
|
36242
36283
|
/**
|
|
36243
36284
|
* Start delayed hide
|
|
@@ -36249,10 +36290,7 @@
|
|
|
36249
36290
|
* Hide immediately
|
|
36250
36291
|
*/
|
|
36251
36292
|
hide() {
|
|
36252
|
-
|
|
36253
|
-
clearTimeout(state3.hideTimer);
|
|
36254
|
-
state3.hideTimer = null;
|
|
36255
|
-
}
|
|
36293
|
+
clearAllTimers();
|
|
36256
36294
|
state3.isMouseOverTooltip = false;
|
|
36257
36295
|
const container = document.getElementById(this.containerId);
|
|
36258
36296
|
if (container) {
|
|
@@ -36263,19 +36301,36 @@
|
|
|
36263
36301
|
* Close and reset all states
|
|
36264
36302
|
*/
|
|
36265
36303
|
close() {
|
|
36304
|
+
clearAllTimers();
|
|
36266
36305
|
state3.isMaximized = false;
|
|
36267
36306
|
state3.isDragging = false;
|
|
36268
36307
|
state3.savedPosition = null;
|
|
36269
|
-
if (state3.hideTimer) {
|
|
36270
|
-
clearTimeout(state3.hideTimer);
|
|
36271
|
-
state3.hideTimer = null;
|
|
36272
|
-
}
|
|
36273
36308
|
state3.isMouseOverTooltip = false;
|
|
36309
|
+
state3.isPinned = false;
|
|
36274
36310
|
const container = document.getElementById(this.containerId);
|
|
36275
36311
|
if (container) {
|
|
36276
36312
|
container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
|
|
36277
36313
|
}
|
|
36278
36314
|
},
|
|
36315
|
+
/**
|
|
36316
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
36317
|
+
* Removes from DOM and clears all timers/state
|
|
36318
|
+
*/
|
|
36319
|
+
destroy() {
|
|
36320
|
+
clearAllTimers();
|
|
36321
|
+
state3.isMaximized = false;
|
|
36322
|
+
state3.isDragging = false;
|
|
36323
|
+
state3.savedPosition = null;
|
|
36324
|
+
state3.isMouseOverTooltip = false;
|
|
36325
|
+
state3.isPinned = false;
|
|
36326
|
+
const container = document.getElementById(this.containerId);
|
|
36327
|
+
if (container) {
|
|
36328
|
+
container.remove();
|
|
36329
|
+
}
|
|
36330
|
+
const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
|
|
36331
|
+
pinnedClones.forEach((clone) => clone.remove());
|
|
36332
|
+
console.log("[InfoTooltip] Destroyed - all tooltips removed");
|
|
36333
|
+
},
|
|
36279
36334
|
/**
|
|
36280
36335
|
* Attach tooltip to trigger element with hover behavior
|
|
36281
36336
|
*/
|