myio-js-library 0.1.188 → 0.1.190

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
@@ -24307,6 +24307,9 @@ var ANNOTATIONS_STYLES = `
24307
24307
  transition: all 0.2s ease;
24308
24308
  font-weight: 600;
24309
24309
  font-size: 13px;
24310
+ position: relative;
24311
+ z-index: 10;
24312
+ pointer-events: auto;
24310
24313
  }
24311
24314
 
24312
24315
  .annotations-create-btn:hover {
@@ -24314,15 +24317,22 @@ var ANNOTATIONS_STYLES = `
24314
24317
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
24315
24318
  }
24316
24319
 
24320
+ .annotations-create-btn:active {
24321
+ transform: translateY(0);
24322
+ box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
24323
+ }
24324
+
24317
24325
  .annotations-create-btn__icon {
24318
24326
  font-size: 28px;
24319
24327
  line-height: 1;
24328
+ pointer-events: none;
24320
24329
  }
24321
24330
 
24322
24331
  .annotations-create-btn__text {
24323
24332
  font-size: 11px;
24324
24333
  text-transform: uppercase;
24325
24334
  letter-spacing: 0.5px;
24335
+ pointer-events: none;
24326
24336
  }
24327
24337
 
24328
24338
  /* New Annotation Modal Overlay */
@@ -25651,18 +25661,29 @@ var AnnotationsTab = class {
25651
25661
  }
25652
25662
  isOverdue(annotation) {
25653
25663
  if (!annotation.dueDate || annotation.status === "archived") return false;
25654
- return new Date(annotation.dueDate) < /* @__PURE__ */ new Date();
25664
+ try {
25665
+ const dueDate = new Date(annotation.dueDate);
25666
+ if (isNaN(dueDate.getTime())) return false;
25667
+ return dueDate < /* @__PURE__ */ new Date();
25668
+ } catch (e) {
25669
+ return false;
25670
+ }
25655
25671
  }
25656
25672
  formatDate(isoString) {
25657
25673
  if (!isoString) return "-";
25658
- const date = new Date(isoString);
25659
- return date.toLocaleDateString("pt-BR", {
25660
- day: "2-digit",
25661
- month: "2-digit",
25662
- year: "numeric",
25663
- hour: "2-digit",
25664
- minute: "2-digit"
25665
- });
25674
+ try {
25675
+ const date = new Date(isoString);
25676
+ if (isNaN(date.getTime())) return "-";
25677
+ return date.toLocaleDateString("pt-BR", {
25678
+ day: "2-digit",
25679
+ month: "2-digit",
25680
+ year: "numeric",
25681
+ hour: "2-digit",
25682
+ minute: "2-digit"
25683
+ });
25684
+ } catch (e) {
25685
+ return "-";
25686
+ }
25666
25687
  }
25667
25688
  renderCard(annotation) {
25668
25689
  const canModify = canModifyAnnotation(annotation, this.permissions);
@@ -25723,7 +25744,7 @@ var AnnotationsTab = class {
25723
25744
  const typeColor = ANNOTATION_TYPE_COLORS[annotation.type];
25724
25745
  const importanceColor = IMPORTANCE_COLORS[annotation.importance];
25725
25746
  const statusColor = STATUS_COLORS[annotation.status];
25726
- const date = new Date(annotation.createdAt).toLocaleString("pt-BR");
25747
+ const date = this.formatDate(annotation.createdAt);
25727
25748
  const truncatedText = annotation.text.length > 50 ? annotation.text.substring(0, 50) + "..." : annotation.text;
25728
25749
  return `
25729
25750
  <div class="annotation-row ${annotation.status === "archived" ? "annotation-row--archived" : ""}" data-id="${annotation.id}">
@@ -25785,9 +25806,13 @@ var AnnotationsTab = class {
25785
25806
  // ============================================
25786
25807
  attachEventListeners() {
25787
25808
  const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
25788
- openModalBtn?.addEventListener("click", () => {
25789
- this.showNewAnnotationModal();
25790
- });
25809
+ if (openModalBtn) {
25810
+ openModalBtn.onclick = () => {
25811
+ this.showNewAnnotationModal();
25812
+ };
25813
+ } else {
25814
+ console.warn("[AnnotationsTab] Create button not found");
25815
+ }
25791
25816
  this.setupMultiselectDropdown("filter-status", (values) => {
25792
25817
  if (values.includes("all") || values.length === 0) {
25793
25818
  this.filters.statusList = void 0;
@@ -26025,16 +26050,14 @@ var AnnotationsTab = class {
26025
26050
  </div>
26026
26051
  </div>
26027
26052
 
26028
- <!-- Due Date Range -->
26053
+ <!-- Due Date -->
26029
26054
  <div class="annotations-form__field" style="margin-bottom: 16px;">
26030
26055
  <label class="annotations-form__label">Data Limite (opcional)</label>
26031
26056
  <input
26032
- type="text"
26057
+ type="datetime-local"
26033
26058
  class="annotations-form__input"
26034
26059
  id="new-annotation-due-date"
26035
- placeholder="Selecione a data limite..."
26036
- readonly
26037
- style="cursor: pointer;"
26060
+ style="cursor: text;"
26038
26061
  >
26039
26062
  </div>
26040
26063
  </div>
@@ -26083,24 +26106,6 @@ var AnnotationsTab = class {
26083
26106
  });
26084
26107
  }
26085
26108
  const dueDateInput = overlay.querySelector("#new-annotation-due-date");
26086
- if (dueDateInput) {
26087
- try {
26088
- this.modalDateRangePicker = await createDateRangePicker2(dueDateInput, {
26089
- includeTime: true,
26090
- timePrecision: "minute",
26091
- locale: "pt-BR",
26092
- parentEl: overlay.querySelector(".annotations-modal"),
26093
- onApply: (result) => {
26094
- dueDateInput.setAttribute("data-due-date", result.startISO);
26095
- }
26096
- });
26097
- } catch (error) {
26098
- console.warn("[AnnotationsTab] Modal DateRangePicker initialization failed:", error);
26099
- dueDateInput.type = "datetime-local";
26100
- dueDateInput.removeAttribute("readonly");
26101
- dueDateInput.style.cursor = "text";
26102
- }
26103
- }
26104
26109
  const closeModal = () => {
26105
26110
  this.modalDateRangePicker?.destroy?.();
26106
26111
  this.modalDateRangePicker = null;
@@ -26118,11 +26123,15 @@ var AnnotationsTab = class {
26118
26123
  const selectedImportance = overlay.querySelector(".importance-option.selected");
26119
26124
  const importance = parseInt(selectedImportance?.dataset.importance || "3");
26120
26125
  let dueDate;
26121
- const storedDueDate = dueDateInput?.getAttribute("data-due-date");
26122
- if (storedDueDate) {
26123
- dueDate = storedDueDate;
26124
- } else if (dueDateInput?.value) {
26125
- dueDate = new Date(dueDateInput.value).toISOString();
26126
+ if (dueDateInput?.value) {
26127
+ try {
26128
+ const dateValue = new Date(dueDateInput.value);
26129
+ if (!isNaN(dateValue.getTime())) {
26130
+ dueDate = dateValue.toISOString();
26131
+ }
26132
+ } catch (e) {
26133
+ console.warn("[AnnotationsTab] Invalid due date value:", dueDateInput.value);
26134
+ }
26126
26135
  }
26127
26136
  const text = textArea.value.trim();
26128
26137
  if (text) {
@@ -26369,12 +26378,12 @@ var AnnotationsTab = class {
26369
26378
  </div>
26370
26379
  <div class="annotation-detail__field">
26371
26380
  <div class="annotation-detail__label">Data de Cria\xE7\xE3o</div>
26372
- <div class="annotation-detail__value">${new Date(annotation.createdAt).toLocaleString("pt-BR")}</div>
26381
+ <div class="annotation-detail__value">${this.formatDate(annotation.createdAt)}</div>
26373
26382
  </div>
26374
26383
  ${annotation.dueDate ? `
26375
26384
  <div class="annotation-detail__field">
26376
26385
  <div class="annotation-detail__label">Data Limite</div>
26377
- <div class="annotation-detail__value">${new Date(annotation.dueDate).toLocaleDateString("pt-BR")}</div>
26386
+ <div class="annotation-detail__value">${this.formatDate(annotation.dueDate)}</div>
26378
26387
  </div>
26379
26388
  ` : ""}
26380
26389
  <div class="annotation-detail__field">
@@ -26385,7 +26394,7 @@ var AnnotationsTab = class {
26385
26394
  <div class="annotation-detail__field">
26386
26395
  <div class="annotation-detail__label">Reconhecido por</div>
26387
26396
  <div class="annotation-detail__value">
26388
- ${annotation.acknowledgedBy?.name} em ${new Date(annotation.acknowledgedAt || "").toLocaleString("pt-BR")}
26397
+ ${annotation.acknowledgedBy?.name} em ${this.formatDate(annotation.acknowledgedAt || "")}
26389
26398
  </div>
26390
26399
  </div>
26391
26400
  ` : ""}
@@ -26393,7 +26402,7 @@ var AnnotationsTab = class {
26393
26402
  <div class="annotation-detail__history-title">Hist\xF3rico (${annotation.history.length} eventos)</div>
26394
26403
  ${annotation.history.map((h) => `
26395
26404
  <div class="annotation-detail__history-item">
26396
- <strong>${h.action}</strong> por ${h.userName} em ${new Date(h.timestamp).toLocaleString("pt-BR")}
26405
+ <strong>${h.action}</strong> por ${h.userName} em ${this.formatDate(h.timestamp)}
26397
26406
  </div>
26398
26407
  `).join("")}
26399
26408
  </div>
@@ -34404,35 +34413,53 @@ var EnergySummaryTooltip = {
34404
34413
  summary.byCategory = [entrada, lojas, areaComum];
34405
34414
  summary.totalDevices = entrada.deviceCount + lojas.deviceCount + areaComumDeviceCount;
34406
34415
  summary.totalConsumption = state5.grandTotal || entrada.consumption;
34407
- const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
34408
- if (statusAggregation.hasData) {
34409
- summary.byStatus = statusAggregation.byStatus;
34416
+ const widgetAggregation = receivedData?.deviceStatusAggregation;
34417
+ if (widgetAggregation && widgetAggregation.hasData) {
34418
+ summary.byStatus = {
34419
+ normal: widgetAggregation.normal || 0,
34420
+ alert: widgetAggregation.alert || 0,
34421
+ failure: widgetAggregation.failure || 0,
34422
+ standby: widgetAggregation.standby || 0,
34423
+ offline: widgetAggregation.offline || 0,
34424
+ noConsumption: widgetAggregation.noConsumption || 0,
34425
+ normalDevices: widgetAggregation.normalDevices || [],
34426
+ alertDevices: widgetAggregation.alertDevices || [],
34427
+ failureDevices: widgetAggregation.failureDevices || [],
34428
+ standbyDevices: widgetAggregation.standbyDevices || [],
34429
+ offlineDevices: widgetAggregation.offlineDevices || [],
34430
+ noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
34431
+ };
34410
34432
  } else {
34411
- const totalDevices = summary.totalDevices;
34412
- const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
34413
- if (statusData && typeof statusData === "object") {
34414
- summary.byStatus = {
34415
- normal: statusData.normal || 0,
34416
- alert: statusData.alert || 0,
34417
- failure: statusData.failure || 0,
34418
- standby: statusData.standby || 0,
34419
- offline: statusData.offline || 0,
34420
- noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
34421
- };
34433
+ const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
34434
+ if (statusAggregation.hasData) {
34435
+ summary.byStatus = statusAggregation.byStatus;
34422
34436
  } else {
34423
- summary.byStatus = {
34424
- normal: Math.floor(totalDevices * 0.75),
34425
- alert: Math.floor(totalDevices * 0.06),
34426
- failure: Math.floor(totalDevices * 0.02),
34427
- standby: Math.floor(totalDevices * 0.02),
34428
- offline: Math.floor(totalDevices * 0.03),
34429
- noConsumption: Math.floor(totalDevices * 0.12)
34430
- };
34431
- const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
34432
- return typeof b === "number" ? a + b : a;
34433
- }, 0);
34434
- if (statusSum !== totalDevices && totalDevices > 0) {
34435
- summary.byStatus.normal += totalDevices - statusSum;
34437
+ const totalDevices = summary.totalDevices;
34438
+ const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
34439
+ if (statusData && typeof statusData === "object") {
34440
+ summary.byStatus = {
34441
+ normal: statusData.normal || 0,
34442
+ alert: statusData.alert || 0,
34443
+ failure: statusData.failure || 0,
34444
+ standby: statusData.standby || 0,
34445
+ offline: statusData.offline || 0,
34446
+ noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
34447
+ };
34448
+ } else {
34449
+ summary.byStatus = {
34450
+ normal: Math.floor(totalDevices * 0.75),
34451
+ alert: Math.floor(totalDevices * 0.06),
34452
+ failure: Math.floor(totalDevices * 0.02),
34453
+ standby: Math.floor(totalDevices * 0.02),
34454
+ offline: Math.floor(totalDevices * 0.03),
34455
+ noConsumption: Math.floor(totalDevices * 0.12)
34456
+ };
34457
+ const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
34458
+ return typeof b === "number" ? a + b : a;
34459
+ }, 0);
34460
+ if (statusSum !== totalDevices && totalDevices > 0) {
34461
+ summary.byStatus.normal += totalDevices - statusSum;
34462
+ }
34436
34463
  }
34437
34464
  }
34438
34465
  }
@@ -35740,35 +35767,53 @@ var WaterSummaryTooltip = {
35740
35767
  }
35741
35768
  summary.totalDevices = summary.byCategory.reduce((sum, cat) => sum + cat.deviceCount, 0);
35742
35769
  summary.totalConsumption = state5.entrada?.total || 0;
35743
- const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
35744
- if (statusAggregation.hasData) {
35745
- summary.byStatus = statusAggregation.byStatus;
35770
+ const widgetAggregation = receivedData?.deviceStatusAggregation;
35771
+ if (widgetAggregation && widgetAggregation.hasData) {
35772
+ summary.byStatus = {
35773
+ normal: widgetAggregation.normal || 0,
35774
+ alert: widgetAggregation.alert || 0,
35775
+ failure: widgetAggregation.failure || 0,
35776
+ standby: widgetAggregation.standby || 0,
35777
+ offline: widgetAggregation.offline || 0,
35778
+ noConsumption: widgetAggregation.noConsumption || 0,
35779
+ normalDevices: widgetAggregation.normalDevices || [],
35780
+ alertDevices: widgetAggregation.alertDevices || [],
35781
+ failureDevices: widgetAggregation.failureDevices || [],
35782
+ standbyDevices: widgetAggregation.standbyDevices || [],
35783
+ offlineDevices: widgetAggregation.offlineDevices || [],
35784
+ noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
35785
+ };
35746
35786
  } else {
35747
- const totalDevices = summary.totalDevices;
35748
- const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
35749
- if (statusData && typeof statusData === "object") {
35750
- summary.byStatus = {
35751
- normal: statusData.normal || 0,
35752
- alert: statusData.alert || 0,
35753
- failure: statusData.failure || 0,
35754
- standby: statusData.standby || 0,
35755
- offline: statusData.offline || 0,
35756
- noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
35757
- };
35787
+ const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
35788
+ if (statusAggregation.hasData) {
35789
+ summary.byStatus = statusAggregation.byStatus;
35758
35790
  } else {
35759
- summary.byStatus = {
35760
- normal: Math.floor(totalDevices * 0.8),
35761
- alert: Math.floor(totalDevices * 0.05),
35762
- failure: Math.floor(totalDevices * 0.02),
35763
- standby: Math.floor(totalDevices * 0.02),
35764
- offline: Math.floor(totalDevices * 0.03),
35765
- noConsumption: Math.floor(totalDevices * 0.08)
35766
- };
35767
- const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
35768
- return typeof b === "number" ? a + b : a;
35769
- }, 0);
35770
- if (statusSum !== totalDevices && totalDevices > 0) {
35771
- summary.byStatus.normal += totalDevices - statusSum;
35791
+ const totalDevices = summary.totalDevices;
35792
+ const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
35793
+ if (statusData && typeof statusData === "object") {
35794
+ summary.byStatus = {
35795
+ normal: statusData.normal || 0,
35796
+ alert: statusData.alert || 0,
35797
+ failure: statusData.failure || 0,
35798
+ standby: statusData.standby || 0,
35799
+ offline: statusData.offline || 0,
35800
+ noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
35801
+ };
35802
+ } else {
35803
+ summary.byStatus = {
35804
+ normal: Math.floor(totalDevices * 0.8),
35805
+ alert: Math.floor(totalDevices * 0.05),
35806
+ failure: Math.floor(totalDevices * 0.02),
35807
+ standby: Math.floor(totalDevices * 0.02),
35808
+ offline: Math.floor(totalDevices * 0.03),
35809
+ noConsumption: Math.floor(totalDevices * 0.08)
35810
+ };
35811
+ const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
35812
+ return typeof b === "number" ? a + b : a;
35813
+ }, 0);
35814
+ if (statusSum !== totalDevices && totalDevices > 0) {
35815
+ summary.byStatus.normal += totalDevices - statusSum;
35816
+ }
35772
35817
  }
35773
35818
  }
35774
35819
  }