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 +144 -99
- package/dist/index.js +144 -99
- package/dist/myio-js-library.umd.js +144 -99
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24138,6 +24138,9 @@ var ANNOTATIONS_STYLES = `
|
|
|
24138
24138
|
transition: all 0.2s ease;
|
|
24139
24139
|
font-weight: 600;
|
|
24140
24140
|
font-size: 13px;
|
|
24141
|
+
position: relative;
|
|
24142
|
+
z-index: 10;
|
|
24143
|
+
pointer-events: auto;
|
|
24141
24144
|
}
|
|
24142
24145
|
|
|
24143
24146
|
.annotations-create-btn:hover {
|
|
@@ -24145,15 +24148,22 @@ var ANNOTATIONS_STYLES = `
|
|
|
24145
24148
|
box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
|
|
24146
24149
|
}
|
|
24147
24150
|
|
|
24151
|
+
.annotations-create-btn:active {
|
|
24152
|
+
transform: translateY(0);
|
|
24153
|
+
box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
|
|
24154
|
+
}
|
|
24155
|
+
|
|
24148
24156
|
.annotations-create-btn__icon {
|
|
24149
24157
|
font-size: 28px;
|
|
24150
24158
|
line-height: 1;
|
|
24159
|
+
pointer-events: none;
|
|
24151
24160
|
}
|
|
24152
24161
|
|
|
24153
24162
|
.annotations-create-btn__text {
|
|
24154
24163
|
font-size: 11px;
|
|
24155
24164
|
text-transform: uppercase;
|
|
24156
24165
|
letter-spacing: 0.5px;
|
|
24166
|
+
pointer-events: none;
|
|
24157
24167
|
}
|
|
24158
24168
|
|
|
24159
24169
|
/* New Annotation Modal Overlay */
|
|
@@ -25482,18 +25492,29 @@ var AnnotationsTab = class {
|
|
|
25482
25492
|
}
|
|
25483
25493
|
isOverdue(annotation) {
|
|
25484
25494
|
if (!annotation.dueDate || annotation.status === "archived") return false;
|
|
25485
|
-
|
|
25495
|
+
try {
|
|
25496
|
+
const dueDate = new Date(annotation.dueDate);
|
|
25497
|
+
if (isNaN(dueDate.getTime())) return false;
|
|
25498
|
+
return dueDate < /* @__PURE__ */ new Date();
|
|
25499
|
+
} catch (e) {
|
|
25500
|
+
return false;
|
|
25501
|
+
}
|
|
25486
25502
|
}
|
|
25487
25503
|
formatDate(isoString) {
|
|
25488
25504
|
if (!isoString) return "-";
|
|
25489
|
-
|
|
25490
|
-
|
|
25491
|
-
|
|
25492
|
-
|
|
25493
|
-
|
|
25494
|
-
|
|
25495
|
-
|
|
25496
|
-
|
|
25505
|
+
try {
|
|
25506
|
+
const date = new Date(isoString);
|
|
25507
|
+
if (isNaN(date.getTime())) return "-";
|
|
25508
|
+
return date.toLocaleDateString("pt-BR", {
|
|
25509
|
+
day: "2-digit",
|
|
25510
|
+
month: "2-digit",
|
|
25511
|
+
year: "numeric",
|
|
25512
|
+
hour: "2-digit",
|
|
25513
|
+
minute: "2-digit"
|
|
25514
|
+
});
|
|
25515
|
+
} catch (e) {
|
|
25516
|
+
return "-";
|
|
25517
|
+
}
|
|
25497
25518
|
}
|
|
25498
25519
|
renderCard(annotation) {
|
|
25499
25520
|
const canModify = canModifyAnnotation(annotation, this.permissions);
|
|
@@ -25554,7 +25575,7 @@ var AnnotationsTab = class {
|
|
|
25554
25575
|
const typeColor = ANNOTATION_TYPE_COLORS[annotation.type];
|
|
25555
25576
|
const importanceColor = IMPORTANCE_COLORS[annotation.importance];
|
|
25556
25577
|
const statusColor = STATUS_COLORS[annotation.status];
|
|
25557
|
-
const date =
|
|
25578
|
+
const date = this.formatDate(annotation.createdAt);
|
|
25558
25579
|
const truncatedText = annotation.text.length > 50 ? annotation.text.substring(0, 50) + "..." : annotation.text;
|
|
25559
25580
|
return `
|
|
25560
25581
|
<div class="annotation-row ${annotation.status === "archived" ? "annotation-row--archived" : ""}" data-id="${annotation.id}">
|
|
@@ -25616,9 +25637,13 @@ var AnnotationsTab = class {
|
|
|
25616
25637
|
// ============================================
|
|
25617
25638
|
attachEventListeners() {
|
|
25618
25639
|
const openModalBtn = this.container.querySelector("#open-new-annotation-modal");
|
|
25619
|
-
|
|
25620
|
-
|
|
25621
|
-
|
|
25640
|
+
if (openModalBtn) {
|
|
25641
|
+
openModalBtn.onclick = () => {
|
|
25642
|
+
this.showNewAnnotationModal();
|
|
25643
|
+
};
|
|
25644
|
+
} else {
|
|
25645
|
+
console.warn("[AnnotationsTab] Create button not found");
|
|
25646
|
+
}
|
|
25622
25647
|
this.setupMultiselectDropdown("filter-status", (values) => {
|
|
25623
25648
|
if (values.includes("all") || values.length === 0) {
|
|
25624
25649
|
this.filters.statusList = void 0;
|
|
@@ -25856,16 +25881,14 @@ var AnnotationsTab = class {
|
|
|
25856
25881
|
</div>
|
|
25857
25882
|
</div>
|
|
25858
25883
|
|
|
25859
|
-
<!-- Due Date
|
|
25884
|
+
<!-- Due Date -->
|
|
25860
25885
|
<div class="annotations-form__field" style="margin-bottom: 16px;">
|
|
25861
25886
|
<label class="annotations-form__label">Data Limite (opcional)</label>
|
|
25862
25887
|
<input
|
|
25863
|
-
type="
|
|
25888
|
+
type="datetime-local"
|
|
25864
25889
|
class="annotations-form__input"
|
|
25865
25890
|
id="new-annotation-due-date"
|
|
25866
|
-
|
|
25867
|
-
readonly
|
|
25868
|
-
style="cursor: pointer;"
|
|
25891
|
+
style="cursor: text;"
|
|
25869
25892
|
>
|
|
25870
25893
|
</div>
|
|
25871
25894
|
</div>
|
|
@@ -25914,24 +25937,6 @@ var AnnotationsTab = class {
|
|
|
25914
25937
|
});
|
|
25915
25938
|
}
|
|
25916
25939
|
const dueDateInput = overlay.querySelector("#new-annotation-due-date");
|
|
25917
|
-
if (dueDateInput) {
|
|
25918
|
-
try {
|
|
25919
|
-
this.modalDateRangePicker = await createDateRangePicker2(dueDateInput, {
|
|
25920
|
-
includeTime: true,
|
|
25921
|
-
timePrecision: "minute",
|
|
25922
|
-
locale: "pt-BR",
|
|
25923
|
-
parentEl: overlay.querySelector(".annotations-modal"),
|
|
25924
|
-
onApply: (result) => {
|
|
25925
|
-
dueDateInput.setAttribute("data-due-date", result.startISO);
|
|
25926
|
-
}
|
|
25927
|
-
});
|
|
25928
|
-
} catch (error) {
|
|
25929
|
-
console.warn("[AnnotationsTab] Modal DateRangePicker initialization failed:", error);
|
|
25930
|
-
dueDateInput.type = "datetime-local";
|
|
25931
|
-
dueDateInput.removeAttribute("readonly");
|
|
25932
|
-
dueDateInput.style.cursor = "text";
|
|
25933
|
-
}
|
|
25934
|
-
}
|
|
25935
25940
|
const closeModal = () => {
|
|
25936
25941
|
this.modalDateRangePicker?.destroy?.();
|
|
25937
25942
|
this.modalDateRangePicker = null;
|
|
@@ -25949,11 +25954,15 @@ var AnnotationsTab = class {
|
|
|
25949
25954
|
const selectedImportance = overlay.querySelector(".importance-option.selected");
|
|
25950
25955
|
const importance = parseInt(selectedImportance?.dataset.importance || "3");
|
|
25951
25956
|
let dueDate;
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
|
|
25955
|
-
|
|
25956
|
-
|
|
25957
|
+
if (dueDateInput?.value) {
|
|
25958
|
+
try {
|
|
25959
|
+
const dateValue = new Date(dueDateInput.value);
|
|
25960
|
+
if (!isNaN(dateValue.getTime())) {
|
|
25961
|
+
dueDate = dateValue.toISOString();
|
|
25962
|
+
}
|
|
25963
|
+
} catch (e) {
|
|
25964
|
+
console.warn("[AnnotationsTab] Invalid due date value:", dueDateInput.value);
|
|
25965
|
+
}
|
|
25957
25966
|
}
|
|
25958
25967
|
const text = textArea.value.trim();
|
|
25959
25968
|
if (text) {
|
|
@@ -26200,12 +26209,12 @@ var AnnotationsTab = class {
|
|
|
26200
26209
|
</div>
|
|
26201
26210
|
<div class="annotation-detail__field">
|
|
26202
26211
|
<div class="annotation-detail__label">Data de Cria\xE7\xE3o</div>
|
|
26203
|
-
<div class="annotation-detail__value">${
|
|
26212
|
+
<div class="annotation-detail__value">${this.formatDate(annotation.createdAt)}</div>
|
|
26204
26213
|
</div>
|
|
26205
26214
|
${annotation.dueDate ? `
|
|
26206
26215
|
<div class="annotation-detail__field">
|
|
26207
26216
|
<div class="annotation-detail__label">Data Limite</div>
|
|
26208
|
-
<div class="annotation-detail__value">${
|
|
26217
|
+
<div class="annotation-detail__value">${this.formatDate(annotation.dueDate)}</div>
|
|
26209
26218
|
</div>
|
|
26210
26219
|
` : ""}
|
|
26211
26220
|
<div class="annotation-detail__field">
|
|
@@ -26216,7 +26225,7 @@ var AnnotationsTab = class {
|
|
|
26216
26225
|
<div class="annotation-detail__field">
|
|
26217
26226
|
<div class="annotation-detail__label">Reconhecido por</div>
|
|
26218
26227
|
<div class="annotation-detail__value">
|
|
26219
|
-
${annotation.acknowledgedBy?.name} em ${
|
|
26228
|
+
${annotation.acknowledgedBy?.name} em ${this.formatDate(annotation.acknowledgedAt || "")}
|
|
26220
26229
|
</div>
|
|
26221
26230
|
</div>
|
|
26222
26231
|
` : ""}
|
|
@@ -26224,7 +26233,7 @@ var AnnotationsTab = class {
|
|
|
26224
26233
|
<div class="annotation-detail__history-title">Hist\xF3rico (${annotation.history.length} eventos)</div>
|
|
26225
26234
|
${annotation.history.map((h) => `
|
|
26226
26235
|
<div class="annotation-detail__history-item">
|
|
26227
|
-
<strong>${h.action}</strong> por ${h.userName} em ${
|
|
26236
|
+
<strong>${h.action}</strong> por ${h.userName} em ${this.formatDate(h.timestamp)}
|
|
26228
26237
|
</div>
|
|
26229
26238
|
`).join("")}
|
|
26230
26239
|
</div>
|
|
@@ -34235,35 +34244,53 @@ var EnergySummaryTooltip = {
|
|
|
34235
34244
|
summary.byCategory = [entrada, lojas, areaComum];
|
|
34236
34245
|
summary.totalDevices = entrada.deviceCount + lojas.deviceCount + areaComumDeviceCount;
|
|
34237
34246
|
summary.totalConsumption = state5.grandTotal || entrada.consumption;
|
|
34238
|
-
const
|
|
34239
|
-
if (
|
|
34240
|
-
summary.byStatus =
|
|
34247
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
34248
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
34249
|
+
summary.byStatus = {
|
|
34250
|
+
normal: widgetAggregation.normal || 0,
|
|
34251
|
+
alert: widgetAggregation.alert || 0,
|
|
34252
|
+
failure: widgetAggregation.failure || 0,
|
|
34253
|
+
standby: widgetAggregation.standby || 0,
|
|
34254
|
+
offline: widgetAggregation.offline || 0,
|
|
34255
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
34256
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
34257
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
34258
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
34259
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
34260
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
34261
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
34262
|
+
};
|
|
34241
34263
|
} else {
|
|
34242
|
-
const
|
|
34243
|
-
|
|
34244
|
-
|
|
34245
|
-
summary.byStatus = {
|
|
34246
|
-
normal: statusData.normal || 0,
|
|
34247
|
-
alert: statusData.alert || 0,
|
|
34248
|
-
failure: statusData.failure || 0,
|
|
34249
|
-
standby: statusData.standby || 0,
|
|
34250
|
-
offline: statusData.offline || 0,
|
|
34251
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34252
|
-
};
|
|
34264
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
34265
|
+
if (statusAggregation.hasData) {
|
|
34266
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
34253
34267
|
} else {
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
|
|
34261
|
-
|
|
34262
|
-
|
|
34263
|
-
|
|
34264
|
-
|
|
34265
|
-
|
|
34266
|
-
summary.byStatus
|
|
34268
|
+
const totalDevices = summary.totalDevices;
|
|
34269
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
34270
|
+
if (statusData && typeof statusData === "object") {
|
|
34271
|
+
summary.byStatus = {
|
|
34272
|
+
normal: statusData.normal || 0,
|
|
34273
|
+
alert: statusData.alert || 0,
|
|
34274
|
+
failure: statusData.failure || 0,
|
|
34275
|
+
standby: statusData.standby || 0,
|
|
34276
|
+
offline: statusData.offline || 0,
|
|
34277
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
34278
|
+
};
|
|
34279
|
+
} else {
|
|
34280
|
+
summary.byStatus = {
|
|
34281
|
+
normal: Math.floor(totalDevices * 0.75),
|
|
34282
|
+
alert: Math.floor(totalDevices * 0.06),
|
|
34283
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
34284
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
34285
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
34286
|
+
noConsumption: Math.floor(totalDevices * 0.12)
|
|
34287
|
+
};
|
|
34288
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
34289
|
+
return typeof b === "number" ? a + b : a;
|
|
34290
|
+
}, 0);
|
|
34291
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
34292
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
34293
|
+
}
|
|
34267
34294
|
}
|
|
34268
34295
|
}
|
|
34269
34296
|
}
|
|
@@ -35571,35 +35598,53 @@ var WaterSummaryTooltip = {
|
|
|
35571
35598
|
}
|
|
35572
35599
|
summary.totalDevices = summary.byCategory.reduce((sum, cat) => sum + cat.deviceCount, 0);
|
|
35573
35600
|
summary.totalConsumption = state5.entrada?.total || 0;
|
|
35574
|
-
const
|
|
35575
|
-
if (
|
|
35576
|
-
summary.byStatus =
|
|
35601
|
+
const widgetAggregation = receivedData?.deviceStatusAggregation;
|
|
35602
|
+
if (widgetAggregation && widgetAggregation.hasData) {
|
|
35603
|
+
summary.byStatus = {
|
|
35604
|
+
normal: widgetAggregation.normal || 0,
|
|
35605
|
+
alert: widgetAggregation.alert || 0,
|
|
35606
|
+
failure: widgetAggregation.failure || 0,
|
|
35607
|
+
standby: widgetAggregation.standby || 0,
|
|
35608
|
+
offline: widgetAggregation.offline || 0,
|
|
35609
|
+
noConsumption: widgetAggregation.noConsumption || 0,
|
|
35610
|
+
normalDevices: widgetAggregation.normalDevices || [],
|
|
35611
|
+
alertDevices: widgetAggregation.alertDevices || [],
|
|
35612
|
+
failureDevices: widgetAggregation.failureDevices || [],
|
|
35613
|
+
standbyDevices: widgetAggregation.standbyDevices || [],
|
|
35614
|
+
offlineDevices: widgetAggregation.offlineDevices || [],
|
|
35615
|
+
noConsumptionDevices: widgetAggregation.noConsumptionDevices || []
|
|
35616
|
+
};
|
|
35577
35617
|
} else {
|
|
35578
|
-
const
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
summary.byStatus = {
|
|
35582
|
-
normal: statusData.normal || 0,
|
|
35583
|
-
alert: statusData.alert || 0,
|
|
35584
|
-
failure: statusData.failure || 0,
|
|
35585
|
-
standby: statusData.standby || 0,
|
|
35586
|
-
offline: statusData.offline || 0,
|
|
35587
|
-
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35588
|
-
};
|
|
35618
|
+
const statusAggregation = this._aggregateDeviceStatusFromOrchestrator(domain);
|
|
35619
|
+
if (statusAggregation.hasData) {
|
|
35620
|
+
summary.byStatus = statusAggregation.byStatus;
|
|
35589
35621
|
} else {
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35593
|
-
|
|
35594
|
-
|
|
35595
|
-
|
|
35596
|
-
|
|
35597
|
-
|
|
35598
|
-
|
|
35599
|
-
|
|
35600
|
-
|
|
35601
|
-
|
|
35602
|
-
summary.byStatus
|
|
35622
|
+
const totalDevices = summary.totalDevices;
|
|
35623
|
+
const statusData = receivedData?.statusCounts || receivedData?.deviceStatus || null;
|
|
35624
|
+
if (statusData && typeof statusData === "object") {
|
|
35625
|
+
summary.byStatus = {
|
|
35626
|
+
normal: statusData.normal || 0,
|
|
35627
|
+
alert: statusData.alert || 0,
|
|
35628
|
+
failure: statusData.failure || 0,
|
|
35629
|
+
standby: statusData.standby || 0,
|
|
35630
|
+
offline: statusData.offline || 0,
|
|
35631
|
+
noConsumption: statusData.noConsumption || statusData.zeroConsumption || 0
|
|
35632
|
+
};
|
|
35633
|
+
} else {
|
|
35634
|
+
summary.byStatus = {
|
|
35635
|
+
normal: Math.floor(totalDevices * 0.8),
|
|
35636
|
+
alert: Math.floor(totalDevices * 0.05),
|
|
35637
|
+
failure: Math.floor(totalDevices * 0.02),
|
|
35638
|
+
standby: Math.floor(totalDevices * 0.02),
|
|
35639
|
+
offline: Math.floor(totalDevices * 0.03),
|
|
35640
|
+
noConsumption: Math.floor(totalDevices * 0.08)
|
|
35641
|
+
};
|
|
35642
|
+
const statusSum = Object.values(summary.byStatus).reduce((a, b) => {
|
|
35643
|
+
return typeof b === "number" ? a + b : a;
|
|
35644
|
+
}, 0);
|
|
35645
|
+
if (statusSum !== totalDevices && totalDevices > 0) {
|
|
35646
|
+
summary.byStatus.normal += totalDevices - statusSum;
|
|
35647
|
+
}
|
|
35603
35648
|
}
|
|
35604
35649
|
}
|
|
35605
35650
|
}
|