myio-js-library 0.1.136 → 0.1.139
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 +197 -70
- package/dist/index.d.cts +6 -0
- package/dist/index.js +197 -70
- package/dist/myio-js-library.umd.js +198 -193
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7081,8 +7081,8 @@ var TELEMETRY_CONFIG = {
|
|
|
7081
7081
|
total_current: { label: "Corrente Total", unit: "A", icon: "\u{1F50C}", decimals: 2 },
|
|
7082
7082
|
current: { label: "Corrente", unit: "A", icon: "\u{1F50C}", decimals: 2 },
|
|
7083
7083
|
// Power and Energy
|
|
7084
|
-
consumption: { label: "
|
|
7085
|
-
power: { label: "Pot\xEAncia", unit: "
|
|
7084
|
+
consumption: { label: "Pot\xEAncia", unit: "W", icon: "\u2699\uFE0F", decimals: 0 },
|
|
7085
|
+
power: { label: "Pot\xEAncia", unit: "W", icon: "\u2699\uFE0F", decimals: 0 },
|
|
7086
7086
|
energy: { label: "Energia", unit: "kWh", icon: "\u{1F4CA}", decimals: 1 },
|
|
7087
7087
|
activePower: { label: "Pot\xEAncia Ativa", unit: "kW", icon: "\u2699\uFE0F", decimals: 2 },
|
|
7088
7088
|
reactivePower: { label: "Pot\xEAncia Reativa", unit: "kVAr", icon: "\u{1F504}", decimals: 2 },
|
|
@@ -7138,7 +7138,9 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7138
7138
|
let refreshIntervalId = null;
|
|
7139
7139
|
let isPaused = false;
|
|
7140
7140
|
let telemetryHistory = /* @__PURE__ */ new Map();
|
|
7141
|
+
let lastKnownValues = /* @__PURE__ */ new Map();
|
|
7141
7142
|
let chart = null;
|
|
7143
|
+
let selectedChartKey = "consumption";
|
|
7142
7144
|
const overlay = document.createElement("div");
|
|
7143
7145
|
overlay.className = "myio-realtime-telemetry-overlay";
|
|
7144
7146
|
overlay.innerHTML = `
|
|
@@ -7289,6 +7291,8 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7289
7291
|
padding: 20px;
|
|
7290
7292
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
7291
7293
|
margin-bottom: 20px;
|
|
7294
|
+
max-height: 520px;
|
|
7295
|
+
overflow: hidden;
|
|
7292
7296
|
}
|
|
7293
7297
|
|
|
7294
7298
|
.myio-telemetry-chart-title {
|
|
@@ -7299,7 +7303,29 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7299
7303
|
}
|
|
7300
7304
|
|
|
7301
7305
|
.myio-telemetry-chart {
|
|
7302
|
-
height:
|
|
7306
|
+
height: 300px;
|
|
7307
|
+
max-height: 450px;
|
|
7308
|
+
width: 100%;
|
|
7309
|
+
}
|
|
7310
|
+
|
|
7311
|
+
.myio-telemetry-selector {
|
|
7312
|
+
padding: 8px 12px;
|
|
7313
|
+
border: 1px solid #ddd;
|
|
7314
|
+
border-radius: 6px;
|
|
7315
|
+
font-size: 14px;
|
|
7316
|
+
background: white;
|
|
7317
|
+
cursor: pointer;
|
|
7318
|
+
transition: border-color 0.2s;
|
|
7319
|
+
}
|
|
7320
|
+
|
|
7321
|
+
.myio-telemetry-selector:hover {
|
|
7322
|
+
border-color: #667eea;
|
|
7323
|
+
}
|
|
7324
|
+
|
|
7325
|
+
.myio-telemetry-selector:focus {
|
|
7326
|
+
outline: none;
|
|
7327
|
+
border-color: #667eea;
|
|
7328
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
7303
7329
|
}
|
|
7304
7330
|
|
|
7305
7331
|
.myio-realtime-telemetry-footer {
|
|
@@ -7409,7 +7435,16 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7409
7435
|
<div class="myio-telemetry-cards-grid" id="telemetry-cards"></div>
|
|
7410
7436
|
|
|
7411
7437
|
<div class="myio-telemetry-chart-container" id="chart-container" style="display: none;">
|
|
7412
|
-
<
|
|
7438
|
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;">
|
|
7439
|
+
<h3 class="myio-telemetry-chart-title" id="chart-title" style="margin: 0;">Hist\xF3rico de Telemetria</h3>
|
|
7440
|
+
<select id="chart-key-selector" class="myio-telemetry-selector">
|
|
7441
|
+
<option value="consumption">Pot\xEAncia</option>
|
|
7442
|
+
<option value="total_current">Corrente Total</option>
|
|
7443
|
+
<option value="voltage_a">Tens\xE3o Fase A</option>
|
|
7444
|
+
<option value="voltage_b">Tens\xE3o Fase B</option>
|
|
7445
|
+
<option value="voltage_c">Tens\xE3o Fase C</option>
|
|
7446
|
+
</select>
|
|
7447
|
+
</div>
|
|
7413
7448
|
<canvas class="myio-telemetry-chart" id="telemetry-chart"></canvas>
|
|
7414
7449
|
</div>
|
|
7415
7450
|
</div>
|
|
@@ -7440,20 +7475,21 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7440
7475
|
</div>
|
|
7441
7476
|
`;
|
|
7442
7477
|
document.body.appendChild(overlay);
|
|
7443
|
-
const closeBtn =
|
|
7444
|
-
const pauseBtn =
|
|
7445
|
-
const pauseBtnIcon =
|
|
7446
|
-
const pauseBtnText =
|
|
7447
|
-
const exportBtn =
|
|
7448
|
-
const loadingState =
|
|
7449
|
-
const telemetryContent =
|
|
7450
|
-
const errorState =
|
|
7451
|
-
const telemetryCards =
|
|
7452
|
-
const chartContainer =
|
|
7453
|
-
const chartCanvas =
|
|
7454
|
-
const
|
|
7455
|
-
const
|
|
7456
|
-
const
|
|
7478
|
+
const closeBtn = overlay.querySelector("#close-btn");
|
|
7479
|
+
const pauseBtn = overlay.querySelector("#pause-btn");
|
|
7480
|
+
const pauseBtnIcon = overlay.querySelector("#pause-btn-icon");
|
|
7481
|
+
const pauseBtnText = overlay.querySelector("#pause-btn-text");
|
|
7482
|
+
const exportBtn = overlay.querySelector("#export-btn");
|
|
7483
|
+
const loadingState = overlay.querySelector("#loading-state");
|
|
7484
|
+
const telemetryContent = overlay.querySelector("#telemetry-content");
|
|
7485
|
+
const errorState = overlay.querySelector("#error-state");
|
|
7486
|
+
const telemetryCards = overlay.querySelector("#telemetry-cards");
|
|
7487
|
+
const chartContainer = overlay.querySelector("#chart-container");
|
|
7488
|
+
const chartCanvas = overlay.querySelector("#telemetry-chart");
|
|
7489
|
+
const chartKeySelector = overlay.querySelector("#chart-key-selector");
|
|
7490
|
+
const statusIndicator = overlay.querySelector("#status-indicator");
|
|
7491
|
+
const statusText = overlay.querySelector("#status-text");
|
|
7492
|
+
const lastUpdateText = overlay.querySelector("#last-update-text");
|
|
7457
7493
|
function closeModal() {
|
|
7458
7494
|
if (refreshIntervalId) {
|
|
7459
7495
|
clearInterval(refreshIntervalId);
|
|
@@ -7542,16 +7578,42 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7542
7578
|
}
|
|
7543
7579
|
const history = telemetryHistory.get(tel.key);
|
|
7544
7580
|
history.push({ x: now, y: tel.value });
|
|
7581
|
+
lastKnownValues.set(tel.key, tel.value);
|
|
7545
7582
|
if (history.length > historyPoints) {
|
|
7546
7583
|
history.shift();
|
|
7547
7584
|
}
|
|
7548
7585
|
}
|
|
7549
|
-
|
|
7550
|
-
const
|
|
7551
|
-
|
|
7586
|
+
for (const key of telemetryKeys) {
|
|
7587
|
+
const receivedKeys = values.map((v) => v.key);
|
|
7588
|
+
if (!receivedKeys.includes(key) && lastKnownValues.has(key)) {
|
|
7589
|
+
if (!telemetryHistory.has(key)) {
|
|
7590
|
+
telemetryHistory.set(key, []);
|
|
7591
|
+
}
|
|
7592
|
+
const history = telemetryHistory.get(key);
|
|
7593
|
+
const lastValue = lastKnownValues.get(key);
|
|
7594
|
+
history.push({ x: now, y: lastValue });
|
|
7595
|
+
if (history.length > historyPoints) {
|
|
7596
|
+
history.shift();
|
|
7597
|
+
}
|
|
7598
|
+
}
|
|
7599
|
+
}
|
|
7600
|
+
if (telemetryHistory.has(selectedChartKey) && chart) {
|
|
7601
|
+
const selectedHistory = telemetryHistory.get(selectedChartKey);
|
|
7602
|
+
chart.data.datasets[0].data = selectedHistory;
|
|
7552
7603
|
chart.update("none");
|
|
7553
7604
|
}
|
|
7554
7605
|
}
|
|
7606
|
+
function getFormattedValue(key, value) {
|
|
7607
|
+
const config = TELEMETRY_CONFIG[key];
|
|
7608
|
+
if (!config) return value.toFixed(2);
|
|
7609
|
+
if (key === "consumption" || key === "power") {
|
|
7610
|
+
if (value >= 1e3) {
|
|
7611
|
+
return `${(value / 1e3).toFixed(2)} kW`;
|
|
7612
|
+
}
|
|
7613
|
+
return `${value.toFixed(0)} W`;
|
|
7614
|
+
}
|
|
7615
|
+
return `${value.toFixed(config.decimals)} ${config.unit}`;
|
|
7616
|
+
}
|
|
7555
7617
|
function initializeChart() {
|
|
7556
7618
|
const Chart = window.Chart;
|
|
7557
7619
|
if (!Chart) {
|
|
@@ -7559,23 +7621,26 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7559
7621
|
return;
|
|
7560
7622
|
}
|
|
7561
7623
|
chartContainer.style.display = "block";
|
|
7624
|
+
const config = TELEMETRY_CONFIG[selectedChartKey] || { label: selectedChartKey, unit: "" };
|
|
7562
7625
|
chart = new Chart(chartCanvas, {
|
|
7563
7626
|
type: "line",
|
|
7564
7627
|
data: {
|
|
7565
7628
|
datasets: [{
|
|
7566
|
-
label:
|
|
7629
|
+
label: config.label,
|
|
7567
7630
|
data: [],
|
|
7568
7631
|
borderColor: "#667eea",
|
|
7569
7632
|
backgroundColor: "rgba(102, 126, 234, 0.1)",
|
|
7570
7633
|
borderWidth: 2,
|
|
7571
7634
|
fill: true,
|
|
7572
7635
|
tension: 0.4,
|
|
7573
|
-
pointRadius:
|
|
7636
|
+
pointRadius: 3,
|
|
7637
|
+
pointHoverRadius: 5
|
|
7574
7638
|
}]
|
|
7575
7639
|
},
|
|
7576
7640
|
options: {
|
|
7577
7641
|
responsive: true,
|
|
7578
7642
|
maintainAspectRatio: false,
|
|
7643
|
+
animation: false,
|
|
7579
7644
|
plugins: {
|
|
7580
7645
|
legend: { display: false },
|
|
7581
7646
|
tooltip: {
|
|
@@ -7583,10 +7648,18 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7583
7648
|
title: function(context) {
|
|
7584
7649
|
const timestamp = context[0].parsed.x;
|
|
7585
7650
|
const date = new Date(timestamp);
|
|
7586
|
-
return date.
|
|
7651
|
+
return date.toLocaleString(locale, {
|
|
7652
|
+
day: "2-digit",
|
|
7653
|
+
month: "2-digit",
|
|
7654
|
+
year: "numeric",
|
|
7655
|
+
hour: "2-digit",
|
|
7656
|
+
minute: "2-digit",
|
|
7657
|
+
second: "2-digit"
|
|
7658
|
+
});
|
|
7587
7659
|
},
|
|
7588
7660
|
label: function(context) {
|
|
7589
|
-
|
|
7661
|
+
const value = context.parsed.y;
|
|
7662
|
+
return getFormattedValue(selectedChartKey, value);
|
|
7590
7663
|
}
|
|
7591
7664
|
}
|
|
7592
7665
|
}
|
|
@@ -7595,23 +7668,57 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7595
7668
|
x: {
|
|
7596
7669
|
type: "linear",
|
|
7597
7670
|
ticks: {
|
|
7671
|
+
maxRotation: 45,
|
|
7672
|
+
minRotation: 0,
|
|
7598
7673
|
callback: function(value) {
|
|
7599
7674
|
const date = new Date(value);
|
|
7600
|
-
return date.toLocaleTimeString(locale, {
|
|
7675
|
+
return date.toLocaleTimeString(locale, {
|
|
7676
|
+
hour: "2-digit",
|
|
7677
|
+
minute: "2-digit",
|
|
7678
|
+
second: "2-digit"
|
|
7679
|
+
});
|
|
7601
7680
|
}
|
|
7681
|
+
},
|
|
7682
|
+
title: {
|
|
7683
|
+
display: true,
|
|
7684
|
+
text: "Hora"
|
|
7602
7685
|
}
|
|
7603
7686
|
},
|
|
7604
7687
|
y: {
|
|
7605
7688
|
beginAtZero: true,
|
|
7689
|
+
ticks: {
|
|
7690
|
+
callback: function(value) {
|
|
7691
|
+
if (selectedChartKey === "consumption" || selectedChartKey === "power") {
|
|
7692
|
+
if (value >= 1e3) {
|
|
7693
|
+
return `${(value / 1e3).toFixed(1)} kW`;
|
|
7694
|
+
}
|
|
7695
|
+
return `${value} W`;
|
|
7696
|
+
}
|
|
7697
|
+
return `${value} ${config.unit}`;
|
|
7698
|
+
}
|
|
7699
|
+
},
|
|
7606
7700
|
title: {
|
|
7607
7701
|
display: true,
|
|
7608
|
-
text: "
|
|
7702
|
+
text: selectedChartKey === "consumption" || selectedChartKey === "power" ? "W" : config.unit
|
|
7609
7703
|
}
|
|
7610
7704
|
}
|
|
7611
7705
|
}
|
|
7612
7706
|
}
|
|
7613
7707
|
});
|
|
7614
7708
|
}
|
|
7709
|
+
function updateChartKey(newKey) {
|
|
7710
|
+
selectedChartKey = newKey;
|
|
7711
|
+
if (chart) {
|
|
7712
|
+
chart.destroy();
|
|
7713
|
+
chart = null;
|
|
7714
|
+
}
|
|
7715
|
+
initializeChart();
|
|
7716
|
+
if (telemetryHistory.has(selectedChartKey)) {
|
|
7717
|
+
const selectedHistory = telemetryHistory.get(selectedChartKey);
|
|
7718
|
+
chart.data.datasets[0].data = selectedHistory;
|
|
7719
|
+
chart.update("none");
|
|
7720
|
+
}
|
|
7721
|
+
}
|
|
7615
7722
|
async function refreshData() {
|
|
7616
7723
|
try {
|
|
7617
7724
|
const data = await fetchLatestTelemetry();
|
|
@@ -7623,9 +7730,7 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7623
7730
|
if (loadingState.style.display !== "none") {
|
|
7624
7731
|
loadingState.style.display = "none";
|
|
7625
7732
|
telemetryContent.style.display = "block";
|
|
7626
|
-
|
|
7627
|
-
initializeChart();
|
|
7628
|
-
}
|
|
7733
|
+
initializeChart();
|
|
7629
7734
|
}
|
|
7630
7735
|
} catch (error) {
|
|
7631
7736
|
console.error("[RealTimeTelemetry] Error fetching data:", error);
|
|
@@ -7693,6 +7798,10 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7693
7798
|
closeBtn.addEventListener("click", closeModal);
|
|
7694
7799
|
pauseBtn.addEventListener("click", togglePause);
|
|
7695
7800
|
exportBtn.addEventListener("click", exportToCSV2);
|
|
7801
|
+
chartKeySelector.addEventListener("change", (e) => {
|
|
7802
|
+
const newKey = e.target.value;
|
|
7803
|
+
updateChartKey(newKey);
|
|
7804
|
+
});
|
|
7696
7805
|
overlay.addEventListener("click", (e) => {
|
|
7697
7806
|
if (e.target === overlay) {
|
|
7698
7807
|
closeModal();
|
|
@@ -8818,18 +8927,20 @@ var FALLBACK_PATHS = [
|
|
|
8818
8927
|
"/assets/vendor/moment.min.js",
|
|
8819
8928
|
"/assets/vendor/daterangepicker.min.js"
|
|
8820
8929
|
];
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8930
|
+
function getLocaleConfig(includeTime = false) {
|
|
8931
|
+
return {
|
|
8932
|
+
format: includeTime ? "DD/MM/YY HH:mm" : "DD/MM/YYYY",
|
|
8933
|
+
separator: " at\xE9 ",
|
|
8934
|
+
applyLabel: "Aplicar",
|
|
8935
|
+
cancelLabel: "Cancelar",
|
|
8936
|
+
fromLabel: "De",
|
|
8937
|
+
toLabel: "At\xE9",
|
|
8938
|
+
customRangeLabel: "Personalizado",
|
|
8939
|
+
daysOfWeek: ["Do", "Se", "Te", "Qa", "Qi", "Se", "Sa"],
|
|
8940
|
+
monthNames: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
|
|
8941
|
+
firstDay: 1
|
|
8942
|
+
};
|
|
8943
|
+
}
|
|
8833
8944
|
var CDNLoader = class {
|
|
8834
8945
|
static jQueryInstance = null;
|
|
8835
8946
|
static loadingPromise = null;
|
|
@@ -8950,14 +9061,46 @@ function createDateRangePicker($2, input, opts) {
|
|
|
8950
9061
|
helpText.style.display = "flex";
|
|
8951
9062
|
helpText.style.alignItems = "center";
|
|
8952
9063
|
input.parentNode?.appendChild(helpText);
|
|
9064
|
+
const includeTime = opts.includeTime === true;
|
|
9065
|
+
const timePrecision = opts.timePrecision || "minute";
|
|
9066
|
+
const localeConfig = getLocaleConfig(includeTime);
|
|
8953
9067
|
const moment = window.moment;
|
|
8954
|
-
|
|
8955
|
-
|
|
9068
|
+
let startDate, endDate;
|
|
9069
|
+
if (includeTime) {
|
|
9070
|
+
startDate = opts.presetStart ? moment(opts.presetStart) : moment().startOf("day");
|
|
9071
|
+
endDate = opts.presetEnd ? moment(opts.presetEnd) : moment();
|
|
9072
|
+
} else {
|
|
9073
|
+
startDate = opts.presetStart ? moment(opts.presetStart).startOf("day") : moment().startOf("month");
|
|
9074
|
+
endDate = opts.presetEnd ? moment(opts.presetEnd).endOf("day") : moment().endOf("day");
|
|
9075
|
+
}
|
|
9076
|
+
let ranges;
|
|
9077
|
+
if (includeTime) {
|
|
9078
|
+
const now = moment();
|
|
9079
|
+
ranges = {
|
|
9080
|
+
"\xDAltima hora": [moment().subtract(1, "hours"), now.clone()],
|
|
9081
|
+
"\xDAltimas 6 horas": [moment().subtract(6, "hours"), now.clone()],
|
|
9082
|
+
"\xDAltimas 12 horas": [moment().subtract(12, "hours"), now.clone()],
|
|
9083
|
+
"\xDAltimas 24 horas": [moment().subtract(24, "hours"), now.clone()],
|
|
9084
|
+
"Hoje": [moment().startOf("day"), now.clone()],
|
|
9085
|
+
"Ontem": [moment().subtract(1, "day").startOf("day"), moment().subtract(1, "day").endOf("day")],
|
|
9086
|
+
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), now.clone()],
|
|
9087
|
+
"Este m\xEAs": [moment().startOf("month"), now.clone()]
|
|
9088
|
+
};
|
|
9089
|
+
} else {
|
|
9090
|
+
ranges = {
|
|
9091
|
+
"Hoje": [moment().startOf("day"), moment().endOf("day")],
|
|
9092
|
+
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), moment().endOf("day")],
|
|
9093
|
+
"\xDAltimos 30 dias": [moment().subtract(29, "days").startOf("day"), moment().endOf("day")],
|
|
9094
|
+
"M\xEAs Anterior": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
|
|
9095
|
+
};
|
|
9096
|
+
}
|
|
8956
9097
|
$input.daterangepicker({
|
|
8957
9098
|
parentEl: opts.parentEl || document.body,
|
|
8958
|
-
timePicker:
|
|
9099
|
+
timePicker: includeTime,
|
|
9100
|
+
// RFC-0086: Conditional time picker
|
|
8959
9101
|
timePicker24Hour: true,
|
|
8960
|
-
timePickerIncrement: 1,
|
|
9102
|
+
timePickerIncrement: timePrecision === "hour" ? 60 : 1,
|
|
9103
|
+
// RFC-0086: Hour vs minute precision
|
|
8961
9104
|
autoApply: true,
|
|
8962
9105
|
autoUpdateInput: true,
|
|
8963
9106
|
linkedCalendars: true,
|
|
@@ -8968,15 +9111,12 @@ function createDateRangePicker($2, input, opts) {
|
|
|
8968
9111
|
endDate,
|
|
8969
9112
|
opens: "right",
|
|
8970
9113
|
drops: "down",
|
|
8971
|
-
locale:
|
|
9114
|
+
locale: localeConfig,
|
|
9115
|
+
// RFC-0086: Dynamic locale format
|
|
8972
9116
|
applyButtonClasses: "btn btn-primary",
|
|
8973
9117
|
cancelClass: "btn btn-muted",
|
|
8974
|
-
ranges
|
|
8975
|
-
|
|
8976
|
-
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), moment().endOf("day")],
|
|
8977
|
-
"\xDAltimos 30 dias": [moment().subtract(29, "days").startOf("day"), moment().endOf("day")],
|
|
8978
|
-
"M\xEAs Anterior": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
|
|
8979
|
-
}
|
|
9118
|
+
ranges
|
|
9119
|
+
// RFC-0086: Dynamic ranges
|
|
8980
9120
|
});
|
|
8981
9121
|
updateInputDisplay();
|
|
8982
9122
|
$input.on("apply.daterangepicker.myio", () => {
|
|
@@ -8995,7 +9135,7 @@ function createDateRangePicker($2, input, opts) {
|
|
|
8995
9135
|
function updateInputDisplay() {
|
|
8996
9136
|
const picker = $input.data("daterangepicker");
|
|
8997
9137
|
if (picker) {
|
|
8998
|
-
const formatted = `${picker.startDate.format(
|
|
9138
|
+
const formatted = `${picker.startDate.format(localeConfig.format)}${localeConfig.separator}${picker.endDate.format(localeConfig.format)}`;
|
|
8999
9139
|
$input.val(formatted);
|
|
9000
9140
|
}
|
|
9001
9141
|
}
|
|
@@ -9003,8 +9143,8 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9003
9143
|
const picker = $input.data("daterangepicker");
|
|
9004
9144
|
const startISO = picker.startDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9005
9145
|
const endISO = picker.endDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9006
|
-
const startLabel = picker.startDate.format(
|
|
9007
|
-
const endLabel = picker.endDate.format(
|
|
9146
|
+
const startLabel = picker.startDate.format(localeConfig.format);
|
|
9147
|
+
const endLabel = picker.endDate.format(localeConfig.format);
|
|
9008
9148
|
return { startISO, endISO, startLabel, endLabel };
|
|
9009
9149
|
}
|
|
9010
9150
|
function setDates(startISO, endISO) {
|
|
@@ -9975,10 +10115,7 @@ async function openDemandModal(params) {
|
|
|
9975
10115
|
<button class="myio-demand-modal-btn-update" type="button">
|
|
9976
10116
|
${strings.updatePeriod}
|
|
9977
10117
|
</button>
|
|
9978
|
-
|
|
9979
|
-
<span class="realtime-indicator"></span>
|
|
9980
|
-
<span class="realtime-text">REAL TIME</span>
|
|
9981
|
-
</button>
|
|
10118
|
+
<!-- RFC-0084: REAL TIME button removed - use RealTimeTelemetryModal instead -->
|
|
9982
10119
|
<div class="myio-demand-modal-period-error" style="display: none;"></div>
|
|
9983
10120
|
</div>
|
|
9984
10121
|
|
|
@@ -10026,7 +10163,6 @@ async function openDemandModal(params) {
|
|
|
10026
10163
|
const dateStartInput = overlay.querySelector(".myio-demand-modal-date-start");
|
|
10027
10164
|
const dateEndInput = overlay.querySelector(".myio-demand-modal-date-end");
|
|
10028
10165
|
const updateBtn = overlay.querySelector(".myio-demand-modal-btn-update");
|
|
10029
|
-
const realTimeToggleBtn = overlay.querySelector("#realtime-toggle-btn");
|
|
10030
10166
|
const periodErrorEl = overlay.querySelector(".myio-demand-modal-period-error");
|
|
10031
10167
|
const telemetryTypeSelect = overlay.querySelector("#telemetry-type-select");
|
|
10032
10168
|
const intervalSelect = overlay.querySelector("#demand-interval-select");
|
|
@@ -10219,7 +10355,6 @@ async function openDemandModal(params) {
|
|
|
10219
10355
|
console.error("[DemandModal] Real-time update failed:", error);
|
|
10220
10356
|
}
|
|
10221
10357
|
}, intervalMs);
|
|
10222
|
-
realTimeToggleBtn.classList.add("active");
|
|
10223
10358
|
isRealTimeMode = true;
|
|
10224
10359
|
console.log(`[DemandModal] Real-time mode started (${intervalMs}ms interval)`);
|
|
10225
10360
|
} catch (error) {
|
|
@@ -10302,7 +10437,6 @@ async function openDemandModal(params) {
|
|
|
10302
10437
|
isRealTimeMode = false;
|
|
10303
10438
|
lastFetchedTimestamp = null;
|
|
10304
10439
|
realTimeDataBuffer = [];
|
|
10305
|
-
realTimeToggleBtn.classList.remove("active");
|
|
10306
10440
|
console.log("[DemandModal] Real-time mode stopped");
|
|
10307
10441
|
}
|
|
10308
10442
|
function initializeDateInputs() {
|
|
@@ -10385,13 +10519,6 @@ async function openDemandModal(params) {
|
|
|
10385
10519
|
pdfBtn.addEventListener("click", exportPdf);
|
|
10386
10520
|
csvBtn.addEventListener("click", exportCsv);
|
|
10387
10521
|
updateBtn.addEventListener("click", updatePeriod);
|
|
10388
|
-
realTimeToggleBtn.addEventListener("click", async () => {
|
|
10389
|
-
if (isRealTimeMode) {
|
|
10390
|
-
await disableRealTimeMode();
|
|
10391
|
-
} else {
|
|
10392
|
-
await enableRealTimeMode();
|
|
10393
|
-
}
|
|
10394
|
-
});
|
|
10395
10522
|
if (telemetryTypeSelect && allowTelemetrySwitch) {
|
|
10396
10523
|
const debouncedSwitch = debounce(switchTelemetryType, 300);
|
|
10397
10524
|
telemetryTypeSelect.addEventListener("change", (e) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -1839,6 +1839,12 @@ interface CreateDateRangePickerOptions {
|
|
|
1839
1839
|
parentEl?: HTMLElement;
|
|
1840
1840
|
/** Callback when date range is applied */
|
|
1841
1841
|
onApply?: (result: DateRangeResult) => void;
|
|
1842
|
+
/** Enable time selection (default: false) */
|
|
1843
|
+
includeTime?: boolean;
|
|
1844
|
+
/** Time precision: 'minute' or 'hour' (default: 'minute') */
|
|
1845
|
+
timePrecision?: 'minute' | 'hour';
|
|
1846
|
+
/** Locale for formatting (default: 'pt-BR') */
|
|
1847
|
+
locale?: 'pt-BR' | 'en-US';
|
|
1842
1848
|
}
|
|
1843
1849
|
/**
|
|
1844
1850
|
* Creates a MyIO-styled date range picker on the specified input element.
|