myio-js-library 0.1.203 → 0.1.206

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 CHANGED
@@ -12014,6 +12014,7 @@ function renderCardComponentV5({
12014
12014
  centralName,
12015
12015
  connectionStatusTime,
12016
12016
  timeVal,
12017
+ lastDisconnectTime,
12017
12018
  customerName,
12018
12019
  waterLevel,
12019
12020
  waterPercentage,
@@ -12978,7 +12979,8 @@ function renderCardComponentV5({
12978
12979
  centralName,
12979
12980
  connectionStatusTime,
12980
12981
  timeVal,
12981
- deviceStatus
12982
+ deviceStatus,
12983
+ lastDisconnectTime
12982
12984
  }
12983
12985
  });
12984
12986
  });
@@ -25827,9 +25829,12 @@ var AnnotationsTab = class {
25827
25829
  attachEventListeners() {
25828
25830
  const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
25829
25831
  if (openModalBtn) {
25830
- openModalBtn.onclick = () => {
25832
+ openModalBtn.addEventListener("click", (e) => {
25833
+ e.preventDefault();
25834
+ e.stopPropagation();
25835
+ console.log("[AnnotationsTab] Create button clicked");
25831
25836
  this.showNewAnnotationModal();
25832
- };
25837
+ });
25833
25838
  } else {
25834
25839
  console.warn("[AnnotationsTab] Create button not found");
25835
25840
  }
@@ -42311,24 +42316,25 @@ var ContractDevicesModalView = class {
42311
42316
  <h4>Energia</h4>
42312
42317
  </div>
42313
42318
  <div class="domain-fields">
42314
- <div class="field-group">
42319
+ <div class="field-group field-total">
42315
42320
  <label for="energy_total">Total Contratado</label>
42316
- <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0">
42321
+ <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42317
42322
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.total}</small>
42323
+ <small class="field-hint">Soma automatica</small>
42318
42324
  </div>
42319
42325
  <div class="field-group">
42320
42326
  <label for="energy_entries">Entradas</label>
42321
- <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0">
42327
+ <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0" data-domain="energy">
42322
42328
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.entries}</small>
42323
42329
  </div>
42324
42330
  <div class="field-group">
42325
42331
  <label for="energy_commonArea">Area Comum</label>
42326
- <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0">
42332
+ <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0" data-domain="energy">
42327
42333
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.commonArea}</small>
42328
42334
  </div>
42329
42335
  <div class="field-group">
42330
42336
  <label for="energy_stores">Lojas</label>
42331
- <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0">
42337
+ <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0" data-domain="energy">
42332
42338
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.stores}</small>
42333
42339
  </div>
42334
42340
  </div>
@@ -42341,24 +42347,25 @@ var ContractDevicesModalView = class {
42341
42347
  <h4>Agua</h4>
42342
42348
  </div>
42343
42349
  <div class="domain-fields">
42344
- <div class="field-group">
42350
+ <div class="field-group field-total">
42345
42351
  <label for="water_total">Total Contratado</label>
42346
- <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0">
42352
+ <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42347
42353
  <small class="field-key">${DEVICE_COUNT_KEYS.water.total}</small>
42354
+ <small class="field-hint">Soma automatica</small>
42348
42355
  </div>
42349
42356
  <div class="field-group">
42350
42357
  <label for="water_entries">Entradas</label>
42351
- <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0">
42358
+ <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0" data-domain="water">
42352
42359
  <small class="field-key">${DEVICE_COUNT_KEYS.water.entries}</small>
42353
42360
  </div>
42354
42361
  <div class="field-group">
42355
42362
  <label for="water_commonArea">Area Comum</label>
42356
- <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0">
42363
+ <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0" data-domain="water">
42357
42364
  <small class="field-key">${DEVICE_COUNT_KEYS.water.commonArea}</small>
42358
42365
  </div>
42359
42366
  <div class="field-group">
42360
42367
  <label for="water_stores">Lojas</label>
42361
- <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0">
42368
+ <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0" data-domain="water">
42362
42369
  <small class="field-key">${DEVICE_COUNT_KEYS.water.stores}</small>
42363
42370
  </div>
42364
42371
  </div>
@@ -42371,19 +42378,20 @@ var ContractDevicesModalView = class {
42371
42378
  <h4>Temperatura</h4>
42372
42379
  </div>
42373
42380
  <div class="domain-fields">
42374
- <div class="field-group">
42381
+ <div class="field-group field-total">
42375
42382
  <label for="temperature_total">Total Contratado</label>
42376
- <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0">
42383
+ <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42377
42384
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.total}</small>
42385
+ <small class="field-hint">Soma automatica</small>
42378
42386
  </div>
42379
42387
  <div class="field-group">
42380
42388
  <label for="temperature_internal">Sensores Internos</label>
42381
- <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0">
42389
+ <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0" data-domain="temperature">
42382
42390
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.internal}</small>
42383
42391
  </div>
42384
42392
  <div class="field-group">
42385
- <label for="temperature_stores">Lojas</label>
42386
- <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0">
42393
+ <label for="temperature_stores">Sensores Externos</label>
42394
+ <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0" data-domain="temperature">
42387
42395
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.stores}</small>
42388
42396
  </div>
42389
42397
  </div>
@@ -42582,6 +42590,26 @@ var ContractDevicesModalView = class {
42582
42590
  font-family: 'Courier New', monospace;
42583
42591
  }
42584
42592
 
42593
+ .myio-contract-devices-modal .field-hint {
42594
+ font-size: 10px;
42595
+ color: #6c757d;
42596
+ font-style: italic;
42597
+ }
42598
+
42599
+ .myio-contract-devices-modal .input-readonly {
42600
+ background: #f0f0f0;
42601
+ color: #555;
42602
+ cursor: not-allowed;
42603
+ font-weight: 600;
42604
+ }
42605
+
42606
+ .myio-contract-devices-modal .field-total {
42607
+ background: #f8f9fa;
42608
+ padding: 10px;
42609
+ border-radius: 6px;
42610
+ margin-bottom: 4px;
42611
+ }
42612
+
42585
42613
  .myio-contract-devices-modal .modal-footer {
42586
42614
  padding: 16px 24px;
42587
42615
  border-top: 1px solid #e0e0e0;
@@ -42660,22 +42688,22 @@ var ContractDevicesModalView = class {
42660
42688
  }
42661
42689
  };
42662
42690
  if (data.energy) {
42663
- setValue("energy_total", data.energy.total);
42664
42691
  setValue("energy_entries", data.energy.entries);
42665
42692
  setValue("energy_commonArea", data.energy.commonArea);
42666
42693
  setValue("energy_stores", data.energy.stores);
42667
42694
  }
42668
42695
  if (data.water) {
42669
- setValue("water_total", data.water.total);
42670
42696
  setValue("water_entries", data.water.entries);
42671
42697
  setValue("water_commonArea", data.water.commonArea);
42672
42698
  setValue("water_stores", data.water.stores);
42673
42699
  }
42674
42700
  if (data.temperature) {
42675
- setValue("temperature_total", data.temperature.total);
42676
42701
  setValue("temperature_internal", data.temperature.internal);
42677
42702
  setValue("temperature_stores", data.temperature.stores);
42678
42703
  }
42704
+ this.calculateDomainTotal("energy");
42705
+ this.calculateDomainTotal("water");
42706
+ this.calculateDomainTotal("temperature");
42679
42707
  }
42680
42708
  attachEventListeners() {
42681
42709
  const closeBtn = this.modal.querySelector(".close-btn");
@@ -42707,6 +42735,50 @@ var ContractDevicesModalView = class {
42707
42735
  this.config.onClose();
42708
42736
  }
42709
42737
  });
42738
+ this.setupAutoCalculation();
42739
+ }
42740
+ setupAutoCalculation() {
42741
+ const energyFields = ["energy_entries", "energy_commonArea", "energy_stores"];
42742
+ energyFields.forEach((fieldName) => {
42743
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42744
+ if (input) {
42745
+ input.addEventListener("input", () => this.calculateDomainTotal("energy"));
42746
+ }
42747
+ });
42748
+ const waterFields = ["water_entries", "water_commonArea", "water_stores"];
42749
+ waterFields.forEach((fieldName) => {
42750
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42751
+ if (input) {
42752
+ input.addEventListener("input", () => this.calculateDomainTotal("water"));
42753
+ }
42754
+ });
42755
+ const temperatureFields = ["temperature_internal", "temperature_stores"];
42756
+ temperatureFields.forEach((fieldName) => {
42757
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42758
+ if (input) {
42759
+ input.addEventListener("input", () => this.calculateDomainTotal("temperature"));
42760
+ }
42761
+ });
42762
+ }
42763
+ calculateDomainTotal(domain) {
42764
+ const getValue = (name) => {
42765
+ const input = this.form.querySelector(`[name="${name}"]`);
42766
+ if (!input || input.value === "") return 0;
42767
+ const num = parseInt(input.value, 10);
42768
+ return isNaN(num) ? 0 : num;
42769
+ };
42770
+ let total = 0;
42771
+ if (domain === "energy") {
42772
+ total = getValue("energy_entries") + getValue("energy_commonArea") + getValue("energy_stores");
42773
+ } else if (domain === "water") {
42774
+ total = getValue("water_entries") + getValue("water_commonArea") + getValue("water_stores");
42775
+ } else if (domain === "temperature") {
42776
+ total = getValue("temperature_internal") + getValue("temperature_stores");
42777
+ }
42778
+ const totalInput = this.form.querySelector(`[name="${domain}_total"]`);
42779
+ if (totalInput) {
42780
+ totalInput.value = String(total);
42781
+ }
42710
42782
  }
42711
42783
  setupAccessibility() {
42712
42784
  const firstInput = this.modal.querySelector("input");
package/dist/index.js CHANGED
@@ -11842,6 +11842,7 @@ function renderCardComponentV5({
11842
11842
  centralName,
11843
11843
  connectionStatusTime,
11844
11844
  timeVal,
11845
+ lastDisconnectTime,
11845
11846
  customerName,
11846
11847
  waterLevel,
11847
11848
  waterPercentage,
@@ -12806,7 +12807,8 @@ function renderCardComponentV5({
12806
12807
  centralName,
12807
12808
  connectionStatusTime,
12808
12809
  timeVal,
12809
- deviceStatus
12810
+ deviceStatus,
12811
+ lastDisconnectTime
12810
12812
  }
12811
12813
  });
12812
12814
  });
@@ -25655,9 +25657,12 @@ var AnnotationsTab = class {
25655
25657
  attachEventListeners() {
25656
25658
  const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
25657
25659
  if (openModalBtn) {
25658
- openModalBtn.onclick = () => {
25660
+ openModalBtn.addEventListener("click", (e) => {
25661
+ e.preventDefault();
25662
+ e.stopPropagation();
25663
+ console.log("[AnnotationsTab] Create button clicked");
25659
25664
  this.showNewAnnotationModal();
25660
- };
25665
+ });
25661
25666
  } else {
25662
25667
  console.warn("[AnnotationsTab] Create button not found");
25663
25668
  }
@@ -42139,24 +42144,25 @@ var ContractDevicesModalView = class {
42139
42144
  <h4>Energia</h4>
42140
42145
  </div>
42141
42146
  <div class="domain-fields">
42142
- <div class="field-group">
42147
+ <div class="field-group field-total">
42143
42148
  <label for="energy_total">Total Contratado</label>
42144
- <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0">
42149
+ <input type="number" id="energy_total" name="energy_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42145
42150
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.total}</small>
42151
+ <small class="field-hint">Soma automatica</small>
42146
42152
  </div>
42147
42153
  <div class="field-group">
42148
42154
  <label for="energy_entries">Entradas</label>
42149
- <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0">
42155
+ <input type="number" id="energy_entries" name="energy_entries" min="0" step="1" placeholder="0" data-domain="energy">
42150
42156
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.entries}</small>
42151
42157
  </div>
42152
42158
  <div class="field-group">
42153
42159
  <label for="energy_commonArea">Area Comum</label>
42154
- <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0">
42160
+ <input type="number" id="energy_commonArea" name="energy_commonArea" min="0" step="1" placeholder="0" data-domain="energy">
42155
42161
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.commonArea}</small>
42156
42162
  </div>
42157
42163
  <div class="field-group">
42158
42164
  <label for="energy_stores">Lojas</label>
42159
- <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0">
42165
+ <input type="number" id="energy_stores" name="energy_stores" min="0" step="1" placeholder="0" data-domain="energy">
42160
42166
  <small class="field-key">${DEVICE_COUNT_KEYS.energy.stores}</small>
42161
42167
  </div>
42162
42168
  </div>
@@ -42169,24 +42175,25 @@ var ContractDevicesModalView = class {
42169
42175
  <h4>Agua</h4>
42170
42176
  </div>
42171
42177
  <div class="domain-fields">
42172
- <div class="field-group">
42178
+ <div class="field-group field-total">
42173
42179
  <label for="water_total">Total Contratado</label>
42174
- <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0">
42180
+ <input type="number" id="water_total" name="water_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42175
42181
  <small class="field-key">${DEVICE_COUNT_KEYS.water.total}</small>
42182
+ <small class="field-hint">Soma automatica</small>
42176
42183
  </div>
42177
42184
  <div class="field-group">
42178
42185
  <label for="water_entries">Entradas</label>
42179
- <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0">
42186
+ <input type="number" id="water_entries" name="water_entries" min="0" step="1" placeholder="0" data-domain="water">
42180
42187
  <small class="field-key">${DEVICE_COUNT_KEYS.water.entries}</small>
42181
42188
  </div>
42182
42189
  <div class="field-group">
42183
42190
  <label for="water_commonArea">Area Comum</label>
42184
- <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0">
42191
+ <input type="number" id="water_commonArea" name="water_commonArea" min="0" step="1" placeholder="0" data-domain="water">
42185
42192
  <small class="field-key">${DEVICE_COUNT_KEYS.water.commonArea}</small>
42186
42193
  </div>
42187
42194
  <div class="field-group">
42188
42195
  <label for="water_stores">Lojas</label>
42189
- <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0">
42196
+ <input type="number" id="water_stores" name="water_stores" min="0" step="1" placeholder="0" data-domain="water">
42190
42197
  <small class="field-key">${DEVICE_COUNT_KEYS.water.stores}</small>
42191
42198
  </div>
42192
42199
  </div>
@@ -42199,19 +42206,20 @@ var ContractDevicesModalView = class {
42199
42206
  <h4>Temperatura</h4>
42200
42207
  </div>
42201
42208
  <div class="domain-fields">
42202
- <div class="field-group">
42209
+ <div class="field-group field-total">
42203
42210
  <label for="temperature_total">Total Contratado</label>
42204
- <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0">
42211
+ <input type="number" id="temperature_total" name="temperature_total" min="0" step="1" placeholder="0" readonly class="input-readonly">
42205
42212
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.total}</small>
42213
+ <small class="field-hint">Soma automatica</small>
42206
42214
  </div>
42207
42215
  <div class="field-group">
42208
42216
  <label for="temperature_internal">Sensores Internos</label>
42209
- <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0">
42217
+ <input type="number" id="temperature_internal" name="temperature_internal" min="0" step="1" placeholder="0" data-domain="temperature">
42210
42218
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.internal}</small>
42211
42219
  </div>
42212
42220
  <div class="field-group">
42213
- <label for="temperature_stores">Lojas</label>
42214
- <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0">
42221
+ <label for="temperature_stores">Sensores Externos</label>
42222
+ <input type="number" id="temperature_stores" name="temperature_stores" min="0" step="1" placeholder="0" data-domain="temperature">
42215
42223
  <small class="field-key">${DEVICE_COUNT_KEYS.temperature.stores}</small>
42216
42224
  </div>
42217
42225
  </div>
@@ -42410,6 +42418,26 @@ var ContractDevicesModalView = class {
42410
42418
  font-family: 'Courier New', monospace;
42411
42419
  }
42412
42420
 
42421
+ .myio-contract-devices-modal .field-hint {
42422
+ font-size: 10px;
42423
+ color: #6c757d;
42424
+ font-style: italic;
42425
+ }
42426
+
42427
+ .myio-contract-devices-modal .input-readonly {
42428
+ background: #f0f0f0;
42429
+ color: #555;
42430
+ cursor: not-allowed;
42431
+ font-weight: 600;
42432
+ }
42433
+
42434
+ .myio-contract-devices-modal .field-total {
42435
+ background: #f8f9fa;
42436
+ padding: 10px;
42437
+ border-radius: 6px;
42438
+ margin-bottom: 4px;
42439
+ }
42440
+
42413
42441
  .myio-contract-devices-modal .modal-footer {
42414
42442
  padding: 16px 24px;
42415
42443
  border-top: 1px solid #e0e0e0;
@@ -42488,22 +42516,22 @@ var ContractDevicesModalView = class {
42488
42516
  }
42489
42517
  };
42490
42518
  if (data.energy) {
42491
- setValue("energy_total", data.energy.total);
42492
42519
  setValue("energy_entries", data.energy.entries);
42493
42520
  setValue("energy_commonArea", data.energy.commonArea);
42494
42521
  setValue("energy_stores", data.energy.stores);
42495
42522
  }
42496
42523
  if (data.water) {
42497
- setValue("water_total", data.water.total);
42498
42524
  setValue("water_entries", data.water.entries);
42499
42525
  setValue("water_commonArea", data.water.commonArea);
42500
42526
  setValue("water_stores", data.water.stores);
42501
42527
  }
42502
42528
  if (data.temperature) {
42503
- setValue("temperature_total", data.temperature.total);
42504
42529
  setValue("temperature_internal", data.temperature.internal);
42505
42530
  setValue("temperature_stores", data.temperature.stores);
42506
42531
  }
42532
+ this.calculateDomainTotal("energy");
42533
+ this.calculateDomainTotal("water");
42534
+ this.calculateDomainTotal("temperature");
42507
42535
  }
42508
42536
  attachEventListeners() {
42509
42537
  const closeBtn = this.modal.querySelector(".close-btn");
@@ -42535,6 +42563,50 @@ var ContractDevicesModalView = class {
42535
42563
  this.config.onClose();
42536
42564
  }
42537
42565
  });
42566
+ this.setupAutoCalculation();
42567
+ }
42568
+ setupAutoCalculation() {
42569
+ const energyFields = ["energy_entries", "energy_commonArea", "energy_stores"];
42570
+ energyFields.forEach((fieldName) => {
42571
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42572
+ if (input) {
42573
+ input.addEventListener("input", () => this.calculateDomainTotal("energy"));
42574
+ }
42575
+ });
42576
+ const waterFields = ["water_entries", "water_commonArea", "water_stores"];
42577
+ waterFields.forEach((fieldName) => {
42578
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42579
+ if (input) {
42580
+ input.addEventListener("input", () => this.calculateDomainTotal("water"));
42581
+ }
42582
+ });
42583
+ const temperatureFields = ["temperature_internal", "temperature_stores"];
42584
+ temperatureFields.forEach((fieldName) => {
42585
+ const input = this.form.querySelector(`[name="${fieldName}"]`);
42586
+ if (input) {
42587
+ input.addEventListener("input", () => this.calculateDomainTotal("temperature"));
42588
+ }
42589
+ });
42590
+ }
42591
+ calculateDomainTotal(domain) {
42592
+ const getValue = (name) => {
42593
+ const input = this.form.querySelector(`[name="${name}"]`);
42594
+ if (!input || input.value === "") return 0;
42595
+ const num = parseInt(input.value, 10);
42596
+ return isNaN(num) ? 0 : num;
42597
+ };
42598
+ let total = 0;
42599
+ if (domain === "energy") {
42600
+ total = getValue("energy_entries") + getValue("energy_commonArea") + getValue("energy_stores");
42601
+ } else if (domain === "water") {
42602
+ total = getValue("water_entries") + getValue("water_commonArea") + getValue("water_stores");
42603
+ } else if (domain === "temperature") {
42604
+ total = getValue("temperature_internal") + getValue("temperature_stores");
42605
+ }
42606
+ const totalInput = this.form.querySelector(`[name="${domain}_total"]`);
42607
+ if (totalInput) {
42608
+ totalInput.value = String(total);
42609
+ }
42538
42610
  }
42539
42611
  setupAccessibility() {
42540
42612
  const firstInput = this.modal.querySelector("input");