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
|
@@ -25471,9 +25471,12 @@
|
|
|
25471
25471
|
attachEventListeners() {
|
|
25472
25472
|
const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
|
|
25473
25473
|
if (openModalBtn) {
|
|
25474
|
-
openModalBtn.
|
|
25474
|
+
openModalBtn.addEventListener("click", (e) => {
|
|
25475
|
+
e.preventDefault();
|
|
25476
|
+
e.stopPropagation();
|
|
25477
|
+
console.log("[AnnotationsTab] Create button clicked");
|
|
25475
25478
|
this.showNewAnnotationModal();
|
|
25476
|
-
};
|
|
25479
|
+
});
|
|
25477
25480
|
} else {
|
|
25478
25481
|
console.warn("[AnnotationsTab] Create button not found");
|
|
25479
25482
|
}
|
|
@@ -35939,14 +35942,18 @@
|
|
|
35939
35942
|
document.head.appendChild(style);
|
|
35940
35943
|
cssInjected7 = true;
|
|
35941
35944
|
}
|
|
35945
|
+
var HIDE_DELAY_MS = 2500;
|
|
35946
|
+
var SAFETY_TIMEOUT_MS = 15e3;
|
|
35942
35947
|
var state3 = {
|
|
35943
35948
|
hideTimer: null,
|
|
35949
|
+
safetyTimer: null,
|
|
35944
35950
|
isMouseOverTooltip: false,
|
|
35945
35951
|
isMaximized: false,
|
|
35946
35952
|
isDragging: false,
|
|
35947
35953
|
dragOffset: { x: 0, y: 0 },
|
|
35948
35954
|
savedPosition: null,
|
|
35949
|
-
pinnedCounter: 0
|
|
35955
|
+
pinnedCounter: 0,
|
|
35956
|
+
isPinned: false
|
|
35950
35957
|
};
|
|
35951
35958
|
function generateHeaderHTML3(icon, title) {
|
|
35952
35959
|
return `
|
|
@@ -35982,6 +35989,7 @@
|
|
|
35982
35989
|
clearTimeout(state3.hideTimer);
|
|
35983
35990
|
state3.hideTimer = null;
|
|
35984
35991
|
}
|
|
35992
|
+
resetSafetyTimer();
|
|
35985
35993
|
};
|
|
35986
35994
|
container.onmouseleave = () => {
|
|
35987
35995
|
state3.isMouseOverTooltip = false;
|
|
@@ -36163,15 +36171,42 @@
|
|
|
36163
36171
|
}
|
|
36164
36172
|
}
|
|
36165
36173
|
function startDelayedHide3() {
|
|
36166
|
-
if (state3.isMouseOverTooltip) return;
|
|
36174
|
+
if (state3.isMouseOverTooltip || state3.isPinned) return;
|
|
36167
36175
|
if (state3.hideTimer) {
|
|
36168
36176
|
clearTimeout(state3.hideTimer);
|
|
36169
36177
|
}
|
|
36170
36178
|
state3.hideTimer = setTimeout(() => {
|
|
36171
36179
|
hideWithAnimation3();
|
|
36172
|
-
},
|
|
36180
|
+
}, HIDE_DELAY_MS);
|
|
36181
|
+
}
|
|
36182
|
+
function resetSafetyTimer() {
|
|
36183
|
+
if (state3.safetyTimer) {
|
|
36184
|
+
clearTimeout(state3.safetyTimer);
|
|
36185
|
+
state3.safetyTimer = null;
|
|
36186
|
+
}
|
|
36187
|
+
const container = document.getElementById("myio-info-tooltip");
|
|
36188
|
+
if (container && container.classList.contains("visible") && !state3.isPinned) {
|
|
36189
|
+
state3.safetyTimer = setTimeout(() => {
|
|
36190
|
+
console.log("[InfoTooltip] Safety timeout reached - forcing hide");
|
|
36191
|
+
InfoTooltip.destroy();
|
|
36192
|
+
}, SAFETY_TIMEOUT_MS);
|
|
36193
|
+
}
|
|
36194
|
+
}
|
|
36195
|
+
function clearAllTimers() {
|
|
36196
|
+
if (state3.hideTimer) {
|
|
36197
|
+
clearTimeout(state3.hideTimer);
|
|
36198
|
+
state3.hideTimer = null;
|
|
36199
|
+
}
|
|
36200
|
+
if (state3.safetyTimer) {
|
|
36201
|
+
clearTimeout(state3.safetyTimer);
|
|
36202
|
+
state3.safetyTimer = null;
|
|
36203
|
+
}
|
|
36173
36204
|
}
|
|
36174
36205
|
function hideWithAnimation3() {
|
|
36206
|
+
if (state3.safetyTimer) {
|
|
36207
|
+
clearTimeout(state3.safetyTimer);
|
|
36208
|
+
state3.safetyTimer = null;
|
|
36209
|
+
}
|
|
36175
36210
|
const container = document.getElementById("myio-info-tooltip");
|
|
36176
36211
|
if (container && container.classList.contains("visible")) {
|
|
36177
36212
|
container.classList.add("closing");
|
|
@@ -36216,12 +36251,10 @@
|
|
|
36216
36251
|
* Show tooltip
|
|
36217
36252
|
*/
|
|
36218
36253
|
show(triggerElement, options) {
|
|
36219
|
-
|
|
36220
|
-
clearTimeout(state3.hideTimer);
|
|
36221
|
-
state3.hideTimer = null;
|
|
36222
|
-
}
|
|
36254
|
+
clearAllTimers();
|
|
36223
36255
|
const container = this.getContainer();
|
|
36224
36256
|
container.classList.remove("closing");
|
|
36257
|
+
state3.isPinned = false;
|
|
36225
36258
|
container.innerHTML = `
|
|
36226
36259
|
<div class="myio-info-tooltip__panel">
|
|
36227
36260
|
${generateHeaderHTML3(options.icon, options.title)}
|
|
@@ -36235,6 +36268,7 @@
|
|
|
36235
36268
|
setupHoverListeners3(container);
|
|
36236
36269
|
setupButtonListeners3(container);
|
|
36237
36270
|
setupDragListeners3(container);
|
|
36271
|
+
resetSafetyTimer();
|
|
36238
36272
|
},
|
|
36239
36273
|
/**
|
|
36240
36274
|
* Start delayed hide
|
|
@@ -36246,10 +36280,7 @@
|
|
|
36246
36280
|
* Hide immediately
|
|
36247
36281
|
*/
|
|
36248
36282
|
hide() {
|
|
36249
|
-
|
|
36250
|
-
clearTimeout(state3.hideTimer);
|
|
36251
|
-
state3.hideTimer = null;
|
|
36252
|
-
}
|
|
36283
|
+
clearAllTimers();
|
|
36253
36284
|
state3.isMouseOverTooltip = false;
|
|
36254
36285
|
const container = document.getElementById(this.containerId);
|
|
36255
36286
|
if (container) {
|
|
@@ -36260,19 +36291,36 @@
|
|
|
36260
36291
|
* Close and reset all states
|
|
36261
36292
|
*/
|
|
36262
36293
|
close() {
|
|
36294
|
+
clearAllTimers();
|
|
36263
36295
|
state3.isMaximized = false;
|
|
36264
36296
|
state3.isDragging = false;
|
|
36265
36297
|
state3.savedPosition = null;
|
|
36266
|
-
if (state3.hideTimer) {
|
|
36267
|
-
clearTimeout(state3.hideTimer);
|
|
36268
|
-
state3.hideTimer = null;
|
|
36269
|
-
}
|
|
36270
36298
|
state3.isMouseOverTooltip = false;
|
|
36299
|
+
state3.isPinned = false;
|
|
36271
36300
|
const container = document.getElementById(this.containerId);
|
|
36272
36301
|
if (container) {
|
|
36273
36302
|
container.classList.remove("visible", "pinned", "maximized", "dragging", "closing");
|
|
36274
36303
|
}
|
|
36275
36304
|
},
|
|
36305
|
+
/**
|
|
36306
|
+
* Destroy tooltip completely - guaranteed cleanup
|
|
36307
|
+
* Removes from DOM and clears all timers/state
|
|
36308
|
+
*/
|
|
36309
|
+
destroy() {
|
|
36310
|
+
clearAllTimers();
|
|
36311
|
+
state3.isMaximized = false;
|
|
36312
|
+
state3.isDragging = false;
|
|
36313
|
+
state3.savedPosition = null;
|
|
36314
|
+
state3.isMouseOverTooltip = false;
|
|
36315
|
+
state3.isPinned = false;
|
|
36316
|
+
const container = document.getElementById(this.containerId);
|
|
36317
|
+
if (container) {
|
|
36318
|
+
container.remove();
|
|
36319
|
+
}
|
|
36320
|
+
const pinnedClones = document.querySelectorAll('[id^="myio-info-tooltip-pinned-"]');
|
|
36321
|
+
pinnedClones.forEach((clone) => clone.remove());
|
|
36322
|
+
console.log("[InfoTooltip] Destroyed - all tooltips removed");
|
|
36323
|
+
},
|
|
36276
36324
|
/**
|
|
36277
36325
|
* Attach tooltip to trigger element with hover behavior
|
|
36278
36326
|
*/
|
|
@@ -41950,24 +41998,25 @@
|
|
|
41950
41998
|
<h4>Energia</h4>
|
|
41951
41999
|
</div>
|
|
41952
42000
|
<div class="domain-fields">
|
|
41953
|
-
<div class="field-group">
|
|
42001
|
+
<div class="field-group field-total">
|
|
41954
42002
|
<label for="energy_total">Total Contratado</label>
|
|
41955
|
-
<input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0">
|
|
42003
|
+
<input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
41956
42004
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.total}</small>
|
|
42005
|
+
<small class="field-hint">Soma automatica</small>
|
|
41957
42006
|
</div>
|
|
41958
42007
|
<div class="field-group">
|
|
41959
42008
|
<label for="energy_entries">Entradas</label>
|
|
41960
|
-
<input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0">
|
|
42009
|
+
<input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0" data-domain="energy">
|
|
41961
42010
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.entries}</small>
|
|
41962
42011
|
</div>
|
|
41963
42012
|
<div class="field-group">
|
|
41964
42013
|
<label for="energy_commonArea">Area Comum</label>
|
|
41965
|
-
<input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0">
|
|
42014
|
+
<input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0" data-domain="energy">
|
|
41966
42015
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.commonArea}</small>
|
|
41967
42016
|
</div>
|
|
41968
42017
|
<div class="field-group">
|
|
41969
42018
|
<label for="energy_stores">Lojas</label>
|
|
41970
|
-
<input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0">
|
|
42019
|
+
<input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0" data-domain="energy">
|
|
41971
42020
|
<small class="field-key">${DEVICE_COUNT_KEYS.energy.stores}</small>
|
|
41972
42021
|
</div>
|
|
41973
42022
|
</div>
|
|
@@ -41980,24 +42029,25 @@
|
|
|
41980
42029
|
<h4>Agua</h4>
|
|
41981
42030
|
</div>
|
|
41982
42031
|
<div class="domain-fields">
|
|
41983
|
-
<div class="field-group">
|
|
42032
|
+
<div class="field-group field-total">
|
|
41984
42033
|
<label for="water_total">Total Contratado</label>
|
|
41985
|
-
<input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0">
|
|
42034
|
+
<input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
41986
42035
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.total}</small>
|
|
42036
|
+
<small class="field-hint">Soma automatica</small>
|
|
41987
42037
|
</div>
|
|
41988
42038
|
<div class="field-group">
|
|
41989
42039
|
<label for="water_entries">Entradas</label>
|
|
41990
|
-
<input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0">
|
|
42040
|
+
<input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0" data-domain="water">
|
|
41991
42041
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.entries}</small>
|
|
41992
42042
|
</div>
|
|
41993
42043
|
<div class="field-group">
|
|
41994
42044
|
<label for="water_commonArea">Area Comum</label>
|
|
41995
|
-
<input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0">
|
|
42045
|
+
<input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0" data-domain="water">
|
|
41996
42046
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.commonArea}</small>
|
|
41997
42047
|
</div>
|
|
41998
42048
|
<div class="field-group">
|
|
41999
42049
|
<label for="water_stores">Lojas</label>
|
|
42000
|
-
<input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0">
|
|
42050
|
+
<input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0" data-domain="water">
|
|
42001
42051
|
<small class="field-key">${DEVICE_COUNT_KEYS.water.stores}</small>
|
|
42002
42052
|
</div>
|
|
42003
42053
|
</div>
|
|
@@ -42010,19 +42060,20 @@
|
|
|
42010
42060
|
<h4>Temperatura</h4>
|
|
42011
42061
|
</div>
|
|
42012
42062
|
<div class="domain-fields">
|
|
42013
|
-
<div class="field-group">
|
|
42063
|
+
<div class="field-group field-total">
|
|
42014
42064
|
<label for="temperature_total">Total Contratado</label>
|
|
42015
|
-
<input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0">
|
|
42065
|
+
<input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
|
|
42016
42066
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.total}</small>
|
|
42067
|
+
<small class="field-hint">Soma automatica</small>
|
|
42017
42068
|
</div>
|
|
42018
42069
|
<div class="field-group">
|
|
42019
42070
|
<label for="temperature_internal">Sensores Internos</label>
|
|
42020
|
-
<input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0">
|
|
42071
|
+
<input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0" data-domain="temperature">
|
|
42021
42072
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.internal}</small>
|
|
42022
42073
|
</div>
|
|
42023
42074
|
<div class="field-group">
|
|
42024
|
-
<label for="temperature_stores">
|
|
42025
|
-
<input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0">
|
|
42075
|
+
<label for="temperature_stores">Sensores Externos</label>
|
|
42076
|
+
<input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0" data-domain="temperature">
|
|
42026
42077
|
<small class="field-key">${DEVICE_COUNT_KEYS.temperature.stores}</small>
|
|
42027
42078
|
</div>
|
|
42028
42079
|
</div>
|
|
@@ -42221,6 +42272,26 @@
|
|
|
42221
42272
|
font-family: 'Courier New', monospace;
|
|
42222
42273
|
}
|
|
42223
42274
|
|
|
42275
|
+
.myio-contract-devices-modal .field-hint {
|
|
42276
|
+
font-size: 10px;
|
|
42277
|
+
color: #6c757d;
|
|
42278
|
+
font-style: italic;
|
|
42279
|
+
}
|
|
42280
|
+
|
|
42281
|
+
.myio-contract-devices-modal .input-readonly {
|
|
42282
|
+
background: #f0f0f0;
|
|
42283
|
+
color: #555;
|
|
42284
|
+
cursor: not-allowed;
|
|
42285
|
+
font-weight: 600;
|
|
42286
|
+
}
|
|
42287
|
+
|
|
42288
|
+
.myio-contract-devices-modal .field-total {
|
|
42289
|
+
background: #f8f9fa;
|
|
42290
|
+
padding: 10px;
|
|
42291
|
+
border-radius: 6px;
|
|
42292
|
+
margin-bottom: 4px;
|
|
42293
|
+
}
|
|
42294
|
+
|
|
42224
42295
|
.myio-contract-devices-modal .modal-footer {
|
|
42225
42296
|
padding: 16px 24px;
|
|
42226
42297
|
border-top: 1px solid #e0e0e0;
|
|
@@ -42299,22 +42370,22 @@
|
|
|
42299
42370
|
}
|
|
42300
42371
|
};
|
|
42301
42372
|
if (data.energy) {
|
|
42302
|
-
setValue("energy_total", data.energy.total);
|
|
42303
42373
|
setValue("energy_entries", data.energy.entries);
|
|
42304
42374
|
setValue("energy_commonArea", data.energy.commonArea);
|
|
42305
42375
|
setValue("energy_stores", data.energy.stores);
|
|
42306
42376
|
}
|
|
42307
42377
|
if (data.water) {
|
|
42308
|
-
setValue("water_total", data.water.total);
|
|
42309
42378
|
setValue("water_entries", data.water.entries);
|
|
42310
42379
|
setValue("water_commonArea", data.water.commonArea);
|
|
42311
42380
|
setValue("water_stores", data.water.stores);
|
|
42312
42381
|
}
|
|
42313
42382
|
if (data.temperature) {
|
|
42314
|
-
setValue("temperature_total", data.temperature.total);
|
|
42315
42383
|
setValue("temperature_internal", data.temperature.internal);
|
|
42316
42384
|
setValue("temperature_stores", data.temperature.stores);
|
|
42317
42385
|
}
|
|
42386
|
+
this.calculateDomainTotal("energy");
|
|
42387
|
+
this.calculateDomainTotal("water");
|
|
42388
|
+
this.calculateDomainTotal("temperature");
|
|
42318
42389
|
}
|
|
42319
42390
|
attachEventListeners() {
|
|
42320
42391
|
const closeBtn = this.modal.querySelector(".close-btn");
|
|
@@ -42346,6 +42417,50 @@
|
|
|
42346
42417
|
this.config.onClose();
|
|
42347
42418
|
}
|
|
42348
42419
|
});
|
|
42420
|
+
this.setupAutoCalculation();
|
|
42421
|
+
}
|
|
42422
|
+
setupAutoCalculation() {
|
|
42423
|
+
const energyFields = ["energy_entries", "energy_commonArea", "energy_stores"];
|
|
42424
|
+
energyFields.forEach((fieldName) => {
|
|
42425
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42426
|
+
if (input) {
|
|
42427
|
+
input.addEventListener("input", () => this.calculateDomainTotal("energy"));
|
|
42428
|
+
}
|
|
42429
|
+
});
|
|
42430
|
+
const waterFields = ["water_entries", "water_commonArea", "water_stores"];
|
|
42431
|
+
waterFields.forEach((fieldName) => {
|
|
42432
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42433
|
+
if (input) {
|
|
42434
|
+
input.addEventListener("input", () => this.calculateDomainTotal("water"));
|
|
42435
|
+
}
|
|
42436
|
+
});
|
|
42437
|
+
const temperatureFields = ["temperature_internal", "temperature_stores"];
|
|
42438
|
+
temperatureFields.forEach((fieldName) => {
|
|
42439
|
+
const input = this.form.querySelector(`[name="${fieldName}"]`);
|
|
42440
|
+
if (input) {
|
|
42441
|
+
input.addEventListener("input", () => this.calculateDomainTotal("temperature"));
|
|
42442
|
+
}
|
|
42443
|
+
});
|
|
42444
|
+
}
|
|
42445
|
+
calculateDomainTotal(domain) {
|
|
42446
|
+
const getValue = (name) => {
|
|
42447
|
+
const input = this.form.querySelector(`[name="${name}"]`);
|
|
42448
|
+
if (!input || input.value === "") return 0;
|
|
42449
|
+
const num = parseInt(input.value, 10);
|
|
42450
|
+
return isNaN(num) ? 0 : num;
|
|
42451
|
+
};
|
|
42452
|
+
let total = 0;
|
|
42453
|
+
if (domain === "energy") {
|
|
42454
|
+
total = getValue("energy_entries") + getValue("energy_commonArea") + getValue("energy_stores");
|
|
42455
|
+
} else if (domain === "water") {
|
|
42456
|
+
total = getValue("water_entries") + getValue("water_commonArea") + getValue("water_stores");
|
|
42457
|
+
} else if (domain === "temperature") {
|
|
42458
|
+
total = getValue("temperature_internal") + getValue("temperature_stores");
|
|
42459
|
+
}
|
|
42460
|
+
const totalInput = this.form.querySelector(`[name="${domain}_total"]`);
|
|
42461
|
+
if (totalInput) {
|
|
42462
|
+
totalInput.value = String(total);
|
|
42463
|
+
}
|
|
42349
42464
|
}
|
|
42350
42465
|
setupAccessibility() {
|
|
42351
42466
|
const firstInput = this.modal.querySelector("input");
|