myio-js-library 0.1.204 → 0.1.207
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 +150 -35
- package/dist/index.d.cts +5 -0
- package/dist/index.js +150 -35
- package/dist/myio-js-library.umd.js +150 -35
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25829,9 +25829,12 @@ var AnnotationsTab = class {
|
|
|
25829
25829
|
attachEventListeners() {
|
|
25830
25830
|
const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
|
|
25831
25831
|
if (openModalBtn) {
|
|
25832
|
-
openModalBtn.
|
|
25832
|
+
openModalBtn.addEventListener("click", (e) => {
|
|
25833
|
+
e.preventDefault();
|
|
25834
|
+
e.stopPropagation();
|
|
25835
|
+
console.log("[AnnotationsTab] Create button clicked");
|
|
25833
25836
|
this.showNewAnnotationModal();
|
|
25834
|
-
};
|
|
25837
|
+
});
|
|
25835
25838
|
} else {
|
|
25836
25839
|
console.warn("[AnnotationsTab] Create button not found");
|
|
25837
25840
|
}
|
|
@@ -36297,14 +36300,18 @@ function injectCSS7() {
|
|
|
36297
36300
|
document.head.appendChild(style);
|
|
36298
36301
|
cssInjected7 = true;
|
|
36299
36302
|
}
|
|
36303
|
+
var HIDE_DELAY_MS = 2500;
|
|
36304
|
+
var SAFETY_TIMEOUT_MS = 15e3;
|
|
36300
36305
|
var state3 = {
|
|
36301
36306
|
hideTimer: null,
|
|
36307
|
+
safetyTimer: null,
|
|
36302
36308
|
isMouseOverTooltip: false,
|
|
36303
36309
|
isMaximized: false,
|
|
36304
36310
|
isDragging: false,
|
|
36305
36311
|
dragOffset: { x: 0, y: 0 },
|
|
36306
36312
|
savedPosition: null,
|
|
36307
|
-
pinnedCounter: 0
|
|
36313
|
+
pinnedCounter: 0,
|
|
36314
|
+
isPinned: false
|
|
36308
36315
|
};
|
|
36309
36316
|
function generateHeaderHTML3(icon, title) {
|
|
36310
36317
|
return `
|
|
@@ -36340,6 +36347,7 @@ function setupHoverListeners3(container) {
|
|
|
36340
36347
|
clearTimeout(state3.hideTimer);
|
|
36341
36348
|
state3.hideTimer = null;
|
|
36342
36349
|
}
|
|
36350
|
+
resetSafetyTimer();
|
|
36343
36351
|
};
|
|
36344
36352
|
container.onmouseleave = () => {
|
|
36345
36353
|
state3.isMouseOverTooltip = false;
|
|
@@ -36521,15 +36529,42 @@ function toggleMaximize3(container) {
|
|
|
36521
36529
|
}
|
|
36522
36530
|
}
|
|
36523
36531
|
function startDelayedHide3() {
|
|
36524
|
-
if (state3.isMouseOverTooltip) return;
|
|
36532
|
+
if (state3.isMouseOverTooltip || state3.isPinned) return;
|
|
36525
36533
|
if (state3.hideTimer) {
|
|
36526
36534
|
clearTimeout(state3.hideTimer);
|
|
36527
36535
|
}
|
|
36528
36536
|
state3.hideTimer = setTimeout(() => {
|
|
36529
36537
|
hideWithAnimation3();
|
|
36530
|
-
},
|
|
36538
|
+
}, HIDE_DELAY_MS);
|
|
36539
|
+
}
|
|
36540
|
+
function resetSafetyTimer() {
|
|
36541
|
+
if (state3.safetyTimer) {
|
|
36542
|
+
clearTimeout(state3.safetyTimer);
|
|
36543
|
+
state3.safetyTimer = null;
|
|
36544
|
+
}
|
|
36545
|
+
const container = document.getElementById("myio-info-tooltip");
|
|
36546
|
+
if (container && container.classList.contains("visible") && !state3.isPinned) {
|
|
36547
|
+
state3.safetyTimer = setTimeout(() => {
|
|
36548
|
+
console.log("[InfoTooltip] Safety timeout reached - forcing hide");
|
|
36549
|
+
InfoTooltip.destroy();
|
|
36550
|
+
}, SAFETY_TIMEOUT_MS);
|
|
36551
|
+
}
|
|
36552
|
+
}
|
|
36553
|
+
function clearAllTimers() {
|
|
36554
|
+
if (state3.hideTimer) {
|
|
36555
|
+
clearTimeout(state3.hideTimer);
|
|
36556
|
+
state3.hideTimer = null;
|
|
36557
|
+
}
|
|
36558
|
+
if (state3.safetyTimer) {
|
|
36559
|
+
clearTimeout(state3.safetyTimer);
|
|
36560
|
+
state3.safetyTimer = null;
|
|
36561
|
+
}
|
|
36531
36562
|
}
|
|
36532
36563
|
function hideWithAnimation3() {
|
|
36564
|
+
if (state3.safetyTimer) {
|
|
36565
|
+
clearTimeout(state3.safetyTimer);
|
|
36566
|
+
state3.safetyTimer = null;
|
|
36567
|
+
}
|
|
36533
36568
|
const container = document.getElementById("myio-info-tooltip");
|
|
36534
36569
|
if (container && container.classList.contains("visible")) {
|
|
36535
36570
|
container.classList.add("closing");
|
|
@@ -36574,12 +36609,10 @@ var InfoTooltip = {
|
|
|
36574
36609
|
* Show tooltip
|
|
36575
36610
|
*/
|
|
36576
36611
|
show(triggerElement, options) {
|
|
36577
|
-
|
|
36578
|
-
clearTimeout(state3.hideTimer);
|
|
36579
|
-
state3.hideTimer = null;
|
|
36580
|
-
}
|
|
36612
|
+
clearAllTimers();
|
|
36581
36613
|
const container = this.getContainer();
|
|
36582
36614
|
container.classList.remove("closing");
|
|
36615
|
+
state3.isPinned = false;
|
|
36583
36616
|
container.innerHTML = `
|
|
36584
36617
|
<div class="myio-info-tooltip__panel">
|
|
36585
36618
|
${generateHeaderHTML3(options.icon, options.title)}
|
|
@@ -36593,6 +36626,7 @@ var InfoTooltip = {
|
|
|
36593
36626
|
setupHoverListeners3(container);
|
|
36594
36627
|
setupButtonListeners3(container);
|
|
36595
36628
|
setupDragListeners3(container);
|
|
36629
|
+
resetSafetyTimer();
|
|
36596
36630
|
},
|
|
36597
36631
|
/**
|
|
36598
36632
|
* Start delayed hide
|
|
@@ -36604,10 +36638,7 @@ var InfoTooltip = {
|
|
|
36604
36638
|
* Hide immediately
|
|
36605
36639
|
*/
|
|
36606
36640
|
hide() {
|
|
36607
|
-
|
|
36608
|
-
clearTimeout(state3.hideTimer);
|
|
36609
|
-
state3.hideTimer = null;
|
|
36610
|
-
}
|
|
36641
|
+
clearAllTimers();
|
|
36611
36642
|
state3.isMouseOverTooltip = false;
|
|
36612
36643
|
const container = document.getElementById(this.containerId);
|
|
36613
36644
|
if (container) {
|
|
@@ -36618,19 +36649,36 @@ var InfoTooltip = {
|
|
|
36618
36649
|
* Close and reset all states
|
|
36619
36650
|
*/
|
|
36620
36651
|
close() {
|
|
36652
|
+
clearAllTimers();
|
|
36621
36653
|
state3.isMaximized = false;
|
|
36622
36654
|
state3.isDragging = false;
|
|
36623
36655
|
state3.savedPosition = null;
|
|
36624
|
-
if (state3.hideTimer) {
|
|
36625
|
-
clearTimeout(state3.hideTimer);
|
|
36626
|
-
state3.hideTimer = null;
|
|
36627
|
-
}
|
|
36628
36656
|
state3.isMouseOverTooltip = false;
|
|
36657
|
+
state3.isPinned = false;
|
|
36629
36658
|
const container = document.getElementById(this.containerId);
|
|
36630
36659
|
if (container) {
|
|
36631
36660
|
container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
|
|
36632
36661
|
}
|
|
36633
36662
|
},
|
|
36663
|
+
/**
|
|
36664
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
36665
|
+
* Removes from DOM and clears all timers/state
|
|
36666
|
+
*/
|
|
36667
|
+
destroy() {
|
|
36668
|
+
clearAllTimers();
|
|
36669
|
+
state3.isMaximized = false;
|
|
36670
|
+
state3.isDragging = false;
|
|
36671
|
+
state3.savedPosition = null;
|
|
36672
|
+
state3.isMouseOverTooltip = false;
|
|
36673
|
+
state3.isPinned = false;
|
|
36674
|
+
const container = document.getElementById(this.containerId);
|
|
36675
|
+
if (container) {
|
|
36676
|
+
container.remove();
|
|
36677
|
+
}
|
|
36678
|
+
const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
|
|
36679
|
+
pinnedClones.forEach((clone) => clone.remove());
|
|
36680
|
+
console.log("[InfoTooltip] Destroyed - all tooltips removed");
|
|
36681
|
+
},
|
|
36634
36682
|
/**
|
|
36635
36683
|
* Attach tooltip to trigger element with hover behavior
|
|
36636
36684
|
*/
|
|
@@ -42313,24 +42361,25 @@ var ContractDevicesModalView = class {
|
|
|
42313
42361
|
<h4>Energia</h4>
|
|
42314
42362
|
</div>
|
|
42315
42363
|
<div class="domain-fields">
|
|
42316
|
-
<div class="field-group">
|
|
42364
|
+
<div class="field-group field-total">
|
|
42317
42365
|
<label for="energy_total">Total Contratado</label>
|
|
42318
|
-
<input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0">
|
|
42366
|
+
<input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
42319
42367
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.total}</small>
|
|
42368
|
+
<small class="field-hint">Soma automatica</small>
|
|
42320
42369
|
</div>
|
|
42321
42370
|
<div class="field-group">
|
|
42322
42371
|
<label for="energy_entries">Entradas</label>
|
|
42323
|
-
<input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0">
|
|
42372
|
+
<input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0" data-domain="energy">
|
|
42324
42373
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.entries}</small>
|
|
42325
42374
|
</div>
|
|
42326
42375
|
<div class="field-group">
|
|
42327
42376
|
<label for="energy_commonArea">Area Comum</label>
|
|
42328
|
-
<input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0">
|
|
42377
|
+
<input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0" data-domain="energy">
|
|
42329
42378
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.commonArea}</small>
|
|
42330
42379
|
</div>
|
|
42331
42380
|
<div class="field-group">
|
|
42332
42381
|
<label for="energy_stores">Lojas</label>
|
|
42333
|
-
<input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0">
|
|
42382
|
+
<input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0" data-domain="energy">
|
|
42334
42383
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.stores}</small>
|
|
42335
42384
|
</div>
|
|
42336
42385
|
</div>
|
|
@@ -42343,24 +42392,25 @@ var ContractDevicesModalView = class {
|
|
|
42343
42392
|
<h4>Agua</h4>
|
|
42344
42393
|
</div>
|
|
42345
42394
|
<div class="domain-fields">
|
|
42346
|
-
<div class="field-group">
|
|
42395
|
+
<div class="field-group field-total">
|
|
42347
42396
|
<label for="water_total">Total Contratado</label>
|
|
42348
|
-
<input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0">
|
|
42397
|
+
<input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
42349
42398
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.total}</small>
|
|
42399
|
+
<small class="field-hint">Soma automatica</small>
|
|
42350
42400
|
</div>
|
|
42351
42401
|
<div class="field-group">
|
|
42352
42402
|
<label for="water_entries">Entradas</label>
|
|
42353
|
-
<input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0">
|
|
42403
|
+
<input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0" data-domain="water">
|
|
42354
42404
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.entries}</small>
|
|
42355
42405
|
</div>
|
|
42356
42406
|
<div class="field-group">
|
|
42357
42407
|
<label for="water_commonArea">Area Comum</label>
|
|
42358
|
-
<input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0">
|
|
42408
|
+
<input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0" data-domain="water">
|
|
42359
42409
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.commonArea}</small>
|
|
42360
42410
|
</div>
|
|
42361
42411
|
<div class="field-group">
|
|
42362
42412
|
<label for="water_stores">Lojas</label>
|
|
42363
|
-
<input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0">
|
|
42413
|
+
<input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0" data-domain="water">
|
|
42364
42414
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.stores}</small>
|
|
42365
42415
|
</div>
|
|
42366
42416
|
</div>
|
|
@@ -42373,19 +42423,20 @@ var ContractDevicesModalView = class {
|
|
|
42373
42423
|
<h4>Temperatura</h4>
|
|
42374
42424
|
</div>
|
|
42375
42425
|
<div class="domain-fields">
|
|
42376
|
-
<div class="field-group">
|
|
42426
|
+
<div class="field-group field-total">
|
|
42377
42427
|
<label for="temperature_total">Total Contratado</label>
|
|
42378
|
-
<input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0">
|
|
42428
|
+
<input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
42379
42429
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.total}</small>
|
|
42430
|
+
<small class="field-hint">Soma automatica</small>
|
|
42380
42431
|
</div>
|
|
42381
42432
|
<div class="field-group">
|
|
42382
42433
|
<label for="temperature_internal">Sensores Internos</label>
|
|
42383
|
-
<input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0">
|
|
42434
|
+
<input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0" data-domain="temperature">
|
|
42384
42435
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.internal}</small>
|
|
42385
42436
|
</div>
|
|
42386
42437
|
<div class="field-group">
|
|
42387
|
-
<label for="temperature_stores">
|
|
42388
|
-
<input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0">
|
|
42438
|
+
<label for="temperature_stores">Sensores Externos</label>
|
|
42439
|
+
<input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0" data-domain="temperature">
|
|
42389
42440
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.stores}</small>
|
|
42390
42441
|
</div>
|
|
42391
42442
|
</div>
|
|
@@ -42584,6 +42635,26 @@ var ContractDevicesModalView = class {
|
|
|
42584
42635
|
font-family: 'Courier New', monospace;
|
|
42585
42636
|
}
|
|
42586
42637
|
|
|
42638
|
+
.myio-contract-devices-modal .field-hint {
|
|
42639
|
+
font-size: 10px;
|
|
42640
|
+
color: #6c757d;
|
|
42641
|
+
font-style: italic;
|
|
42642
|
+
}
|
|
42643
|
+
|
|
42644
|
+
.myio-contract-devices-modal .input-readonly {
|
|
42645
|
+
background: #f0f0f0;
|
|
42646
|
+
color: #555;
|
|
42647
|
+
cursor: not-allowed;
|
|
42648
|
+
font-weight: 600;
|
|
42649
|
+
}
|
|
42650
|
+
|
|
42651
|
+
.myio-contract-devices-modal .field-total {
|
|
42652
|
+
background: #f8f9fa;
|
|
42653
|
+
padding: 10px;
|
|
42654
|
+
border-radius: 6px;
|
|
42655
|
+
margin-bottom: 4px;
|
|
42656
|
+
}
|
|
42657
|
+
|
|
42587
42658
|
.myio-contract-devices-modal .modal-footer {
|
|
42588
42659
|
padding: 16px 24px;
|
|
42589
42660
|
border-top: 1px solid #e0e0e0;
|
|
@@ -42662,22 +42733,22 @@ var ContractDevicesModalView = class {
|
|
|
42662
42733
|
}
|
|
42663
42734
|
};
|
|
42664
42735
|
if (data.energy) {
|
|
42665
|
-
setValue("energy_total", data.energy.total);
|
|
42666
42736
|
setValue("energy_entries", data.energy.entries);
|
|
42667
42737
|
setValue("energy_commonArea", data.energy.commonArea);
|
|
42668
42738
|
setValue("energy_stores", data.energy.stores);
|
|
42669
42739
|
}
|
|
42670
42740
|
if (data.water) {
|
|
42671
|
-
setValue("water_total", data.water.total);
|
|
42672
42741
|
setValue("water_entries", data.water.entries);
|
|
42673
42742
|
setValue("water_commonArea", data.water.commonArea);
|
|
42674
42743
|
setValue("water_stores", data.water.stores);
|
|
42675
42744
|
}
|
|
42676
42745
|
if (data.temperature) {
|
|
42677
|
-
setValue("temperature_total", data.temperature.total);
|
|
42678
42746
|
setValue("temperature_internal", data.temperature.internal);
|
|
42679
42747
|
setValue("temperature_stores", data.temperature.stores);
|
|
42680
42748
|
}
|
|
42749
|
+
this.calculateDomainTotal("energy");
|
|
42750
|
+
this.calculateDomainTotal("water");
|
|
42751
|
+
this.calculateDomainTotal("temperature");
|
|
42681
42752
|
}
|
|
42682
42753
|
attachEventListeners() {
|
|
42683
42754
|
const closeBtn = this.modal.querySelector(".close-btn");
|
|
@@ -42709,6 +42780,50 @@ var ContractDevicesModalView = class {
|
|
|
42709
42780
|
this.config.onClose();
|
|
42710
42781
|
}
|
|
42711
42782
|
});
|
|
42783
|
+
this.setupAutoCalculation();
|
|
42784
|
+
}
|
|
42785
|
+
setupAutoCalculation() {
|
|
42786
|
+
const energyFields = ["energy_entries", "energy_commonArea", "energy_stores"];
|
|
42787
|
+
energyFields.forEach((fieldName) => {
|
|
42788
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42789
|
+
if (input) {
|
|
42790
|
+
input.addEventListener("input", () => this.calculateDomainTotal("energy"));
|
|
42791
|
+
}
|
|
42792
|
+
});
|
|
42793
|
+
const waterFields = ["water_entries", "water_commonArea", "water_stores"];
|
|
42794
|
+
waterFields.forEach((fieldName) => {
|
|
42795
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42796
|
+
if (input) {
|
|
42797
|
+
input.addEventListener("input", () => this.calculateDomainTotal("water"));
|
|
42798
|
+
}
|
|
42799
|
+
});
|
|
42800
|
+
const temperatureFields = ["temperature_internal", "temperature_stores"];
|
|
42801
|
+
temperatureFields.forEach((fieldName) => {
|
|
42802
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42803
|
+
if (input) {
|
|
42804
|
+
input.addEventListener("input", () => this.calculateDomainTotal("temperature"));
|
|
42805
|
+
}
|
|
42806
|
+
});
|
|
42807
|
+
}
|
|
42808
|
+
calculateDomainTotal(domain) {
|
|
42809
|
+
const getValue = (name) => {
|
|
42810
|
+
const input = this.form.querySelector(`[name="${name}"]`);
|
|
42811
|
+
if (!input || input.value === "") return 0;
|
|
42812
|
+
const num = parseInt(input.value, 10);
|
|
42813
|
+
return isNaN(num) ? 0 : num;
|
|
42814
|
+
};
|
|
42815
|
+
let total = 0;
|
|
42816
|
+
if (domain === "energy") {
|
|
42817
|
+
total = getValue("energy_entries") + getValue("energy_commonArea") + getValue("energy_stores");
|
|
42818
|
+
} else if (domain === "water") {
|
|
42819
|
+
total = getValue("water_entries") + getValue("water_commonArea") + getValue("water_stores");
|
|
42820
|
+
} else if (domain === "temperature") {
|
|
42821
|
+
total = getValue("temperature_internal") + getValue("temperature_stores");
|
|
42822
|
+
}
|
|
42823
|
+
const totalInput = this.form.querySelector(`[name="${domain}_total"]`);
|
|
42824
|
+
if (totalInput) {
|
|
42825
|
+
totalInput.value = String(total);
|
|
42826
|
+
}
|
|
42712
42827
|
}
|
|
42713
42828
|
setupAccessibility() {
|
|
42714
42829
|
const firstInput = this.modal.querySelector("input");
|
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
|
*/
|