myio-js-library 0.1.137 → 0.1.140
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 +82 -57
- package/dist/index.d.cts +6 -0
- package/dist/index.js +82 -57
- package/dist/myio-js-library.umd.js +83 -180
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7291,6 +7291,8 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7291
7291
|
padding: 20px;
|
|
7292
7292
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
7293
7293
|
margin-bottom: 20px;
|
|
7294
|
+
max-height: 520px;
|
|
7295
|
+
overflow: hidden;
|
|
7294
7296
|
}
|
|
7295
7297
|
|
|
7296
7298
|
.myio-telemetry-chart-title {
|
|
@@ -7301,7 +7303,9 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7301
7303
|
}
|
|
7302
7304
|
|
|
7303
7305
|
.myio-telemetry-chart {
|
|
7304
|
-
height:
|
|
7306
|
+
height: 300px;
|
|
7307
|
+
max-height: 450px;
|
|
7308
|
+
width: 100%;
|
|
7305
7309
|
}
|
|
7306
7310
|
|
|
7307
7311
|
.myio-telemetry-selector {
|
|
@@ -7471,21 +7475,21 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7471
7475
|
</div>
|
|
7472
7476
|
`;
|
|
7473
7477
|
document.body.appendChild(overlay);
|
|
7474
|
-
const closeBtn =
|
|
7475
|
-
const pauseBtn =
|
|
7476
|
-
const pauseBtnIcon =
|
|
7477
|
-
const pauseBtnText =
|
|
7478
|
-
const exportBtn =
|
|
7479
|
-
const loadingState =
|
|
7480
|
-
const telemetryContent =
|
|
7481
|
-
const errorState =
|
|
7482
|
-
const telemetryCards =
|
|
7483
|
-
const chartContainer =
|
|
7484
|
-
const chartCanvas =
|
|
7485
|
-
const chartKeySelector =
|
|
7486
|
-
const statusIndicator =
|
|
7487
|
-
const statusText =
|
|
7488
|
-
const lastUpdateText =
|
|
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");
|
|
7489
7493
|
function closeModal() {
|
|
7490
7494
|
if (refreshIntervalId) {
|
|
7491
7495
|
clearInterval(refreshIntervalId);
|
|
@@ -8923,18 +8927,20 @@ var FALLBACK_PATHS = [
|
|
|
8923
8927
|
"/assets/vendor/moment.min.js",
|
|
8924
8928
|
"/assets/vendor/daterangepicker.min.js"
|
|
8925
8929
|
];
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
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
|
+
}
|
|
8938
8944
|
var CDNLoader = class {
|
|
8939
8945
|
static jQueryInstance = null;
|
|
8940
8946
|
static loadingPromise = null;
|
|
@@ -9055,14 +9061,46 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9055
9061
|
helpText.style.display = "flex";
|
|
9056
9062
|
helpText.style.alignItems = "center";
|
|
9057
9063
|
input.parentNode?.appendChild(helpText);
|
|
9064
|
+
const includeTime = opts.includeTime === true;
|
|
9065
|
+
const timePrecision = opts.timePrecision || "minute";
|
|
9066
|
+
const localeConfig = getLocaleConfig(includeTime);
|
|
9058
9067
|
const moment = window.moment;
|
|
9059
|
-
|
|
9060
|
-
|
|
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
|
+
}
|
|
9061
9097
|
$input.daterangepicker({
|
|
9062
9098
|
parentEl: opts.parentEl || document.body,
|
|
9063
|
-
timePicker:
|
|
9099
|
+
timePicker: includeTime,
|
|
9100
|
+
// RFC-0086: Conditional time picker
|
|
9064
9101
|
timePicker24Hour: true,
|
|
9065
|
-
timePickerIncrement: 1,
|
|
9102
|
+
timePickerIncrement: timePrecision === "hour" ? 60 : 1,
|
|
9103
|
+
// RFC-0086: Hour vs minute precision
|
|
9066
9104
|
autoApply: true,
|
|
9067
9105
|
autoUpdateInput: true,
|
|
9068
9106
|
linkedCalendars: true,
|
|
@@ -9073,15 +9111,12 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9073
9111
|
endDate,
|
|
9074
9112
|
opens: "right",
|
|
9075
9113
|
drops: "down",
|
|
9076
|
-
locale:
|
|
9114
|
+
locale: localeConfig,
|
|
9115
|
+
// RFC-0086: Dynamic locale format
|
|
9077
9116
|
applyButtonClasses: "btn btn-primary",
|
|
9078
9117
|
cancelClass: "btn btn-muted",
|
|
9079
|
-
ranges
|
|
9080
|
-
|
|
9081
|
-
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), moment().endOf("day")],
|
|
9082
|
-
"\xDAltimos 30 dias": [moment().subtract(29, "days").startOf("day"), moment().endOf("day")],
|
|
9083
|
-
"M\xEAs Anterior": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
|
|
9084
|
-
}
|
|
9118
|
+
ranges
|
|
9119
|
+
// RFC-0086: Dynamic ranges
|
|
9085
9120
|
});
|
|
9086
9121
|
updateInputDisplay();
|
|
9087
9122
|
$input.on("apply.daterangepicker.myio", () => {
|
|
@@ -9100,7 +9135,7 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9100
9135
|
function updateInputDisplay() {
|
|
9101
9136
|
const picker = $input.data("daterangepicker");
|
|
9102
9137
|
if (picker) {
|
|
9103
|
-
const formatted = `${picker.startDate.format(
|
|
9138
|
+
const formatted = `${picker.startDate.format(localeConfig.format)}${localeConfig.separator}${picker.endDate.format(localeConfig.format)}`;
|
|
9104
9139
|
$input.val(formatted);
|
|
9105
9140
|
}
|
|
9106
9141
|
}
|
|
@@ -9108,8 +9143,8 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9108
9143
|
const picker = $input.data("daterangepicker");
|
|
9109
9144
|
const startISO = picker.startDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9110
9145
|
const endISO = picker.endDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9111
|
-
const startLabel = picker.startDate.format(
|
|
9112
|
-
const endLabel = picker.endDate.format(
|
|
9146
|
+
const startLabel = picker.startDate.format(localeConfig.format);
|
|
9147
|
+
const endLabel = picker.endDate.format(localeConfig.format);
|
|
9113
9148
|
return { startISO, endISO, startLabel, endLabel };
|
|
9114
9149
|
}
|
|
9115
9150
|
function setDates(startISO, endISO) {
|
|
@@ -10080,10 +10115,7 @@ async function openDemandModal(params) {
|
|
|
10080
10115
|
<button class="myio-demand-modal-btn-update" type="button">
|
|
10081
10116
|
${strings.updatePeriod}
|
|
10082
10117
|
</button>
|
|
10083
|
-
|
|
10084
|
-
<span class="realtime-indicator"></span>
|
|
10085
|
-
<span class="realtime-text">REAL TIME</span>
|
|
10086
|
-
</button>
|
|
10118
|
+
<!-- RFC-0084: REAL TIME button removed - use RealTimeTelemetryModal instead -->
|
|
10087
10119
|
<div class="myio-demand-modal-period-error" style="display: none;"></div>
|
|
10088
10120
|
</div>
|
|
10089
10121
|
|
|
@@ -10131,7 +10163,6 @@ async function openDemandModal(params) {
|
|
|
10131
10163
|
const dateStartInput = overlay.querySelector(".myio-demand-modal-date-start");
|
|
10132
10164
|
const dateEndInput = overlay.querySelector(".myio-demand-modal-date-end");
|
|
10133
10165
|
const updateBtn = overlay.querySelector(".myio-demand-modal-btn-update");
|
|
10134
|
-
const realTimeToggleBtn = overlay.querySelector("#realtime-toggle-btn");
|
|
10135
10166
|
const periodErrorEl = overlay.querySelector(".myio-demand-modal-period-error");
|
|
10136
10167
|
const telemetryTypeSelect = overlay.querySelector("#telemetry-type-select");
|
|
10137
10168
|
const intervalSelect = overlay.querySelector("#demand-interval-select");
|
|
@@ -10324,7 +10355,6 @@ async function openDemandModal(params) {
|
|
|
10324
10355
|
console.error("[DemandModal] Real-time update failed:", error);
|
|
10325
10356
|
}
|
|
10326
10357
|
}, intervalMs);
|
|
10327
|
-
realTimeToggleBtn.classList.add("active");
|
|
10328
10358
|
isRealTimeMode = true;
|
|
10329
10359
|
console.log(`[DemandModal] Real-time mode started (${intervalMs}ms interval)`);
|
|
10330
10360
|
} catch (error) {
|
|
@@ -10407,7 +10437,6 @@ async function openDemandModal(params) {
|
|
|
10407
10437
|
isRealTimeMode = false;
|
|
10408
10438
|
lastFetchedTimestamp = null;
|
|
10409
10439
|
realTimeDataBuffer = [];
|
|
10410
|
-
realTimeToggleBtn.classList.remove("active");
|
|
10411
10440
|
console.log("[DemandModal] Real-time mode stopped");
|
|
10412
10441
|
}
|
|
10413
10442
|
function initializeDateInputs() {
|
|
@@ -10490,13 +10519,6 @@ async function openDemandModal(params) {
|
|
|
10490
10519
|
pdfBtn.addEventListener("click", exportPdf);
|
|
10491
10520
|
csvBtn.addEventListener("click", exportCsv);
|
|
10492
10521
|
updateBtn.addEventListener("click", updatePeriod);
|
|
10493
|
-
realTimeToggleBtn.addEventListener("click", async () => {
|
|
10494
|
-
if (isRealTimeMode) {
|
|
10495
|
-
await disableRealTimeMode();
|
|
10496
|
-
} else {
|
|
10497
|
-
await enableRealTimeMode();
|
|
10498
|
-
}
|
|
10499
|
-
});
|
|
10500
10522
|
if (telemetryTypeSelect && allowTelemetrySwitch) {
|
|
10501
10523
|
const debouncedSwitch = debounce(switchTelemetryType, 300);
|
|
10502
10524
|
telemetryTypeSelect.addEventListener("change", (e) => {
|
|
@@ -10922,8 +10944,11 @@ var EnergyModalView = class {
|
|
|
10922
10944
|
*/
|
|
10923
10945
|
reRenderChart() {
|
|
10924
10946
|
const mode = this.config.params.mode || "single";
|
|
10947
|
+
console.log("[EnergyModalView] reRenderChart called, mode:", mode, "barMode:", this.currentBarMode, "theme:", this.currentTheme);
|
|
10925
10948
|
if (mode === "comparison") {
|
|
10926
|
-
|
|
10949
|
+
console.log("[EnergyModalView] Calling renderComparisonChart...");
|
|
10950
|
+
const result = this.renderComparisonChart();
|
|
10951
|
+
console.log("[EnergyModalView] renderComparisonChart result:", result);
|
|
10927
10952
|
} else {
|
|
10928
10953
|
if (this.currentEnergyData) {
|
|
10929
10954
|
this.renderChart(this.currentEnergyData);
|
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.
|
package/dist/index.js
CHANGED
|
@@ -7195,6 +7195,8 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7195
7195
|
padding: 20px;
|
|
7196
7196
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
7197
7197
|
margin-bottom: 20px;
|
|
7198
|
+
max-height: 520px;
|
|
7199
|
+
overflow: hidden;
|
|
7198
7200
|
}
|
|
7199
7201
|
|
|
7200
7202
|
.myio-telemetry-chart-title {
|
|
@@ -7205,7 +7207,9 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7205
7207
|
}
|
|
7206
7208
|
|
|
7207
7209
|
.myio-telemetry-chart {
|
|
7208
|
-
height:
|
|
7210
|
+
height: 300px;
|
|
7211
|
+
max-height: 450px;
|
|
7212
|
+
width: 100%;
|
|
7209
7213
|
}
|
|
7210
7214
|
|
|
7211
7215
|
.myio-telemetry-selector {
|
|
@@ -7375,21 +7379,21 @@ async function openRealTimeTelemetryModal(params) {
|
|
|
7375
7379
|
</div>
|
|
7376
7380
|
`;
|
|
7377
7381
|
document.body.appendChild(overlay);
|
|
7378
|
-
const closeBtn =
|
|
7379
|
-
const pauseBtn =
|
|
7380
|
-
const pauseBtnIcon =
|
|
7381
|
-
const pauseBtnText =
|
|
7382
|
-
const exportBtn =
|
|
7383
|
-
const loadingState =
|
|
7384
|
-
const telemetryContent =
|
|
7385
|
-
const errorState =
|
|
7386
|
-
const telemetryCards =
|
|
7387
|
-
const chartContainer =
|
|
7388
|
-
const chartCanvas =
|
|
7389
|
-
const chartKeySelector =
|
|
7390
|
-
const statusIndicator =
|
|
7391
|
-
const statusText =
|
|
7392
|
-
const lastUpdateText =
|
|
7382
|
+
const closeBtn = overlay.querySelector("#close-btn");
|
|
7383
|
+
const pauseBtn = overlay.querySelector("#pause-btn");
|
|
7384
|
+
const pauseBtnIcon = overlay.querySelector("#pause-btn-icon");
|
|
7385
|
+
const pauseBtnText = overlay.querySelector("#pause-btn-text");
|
|
7386
|
+
const exportBtn = overlay.querySelector("#export-btn");
|
|
7387
|
+
const loadingState = overlay.querySelector("#loading-state");
|
|
7388
|
+
const telemetryContent = overlay.querySelector("#telemetry-content");
|
|
7389
|
+
const errorState = overlay.querySelector("#error-state");
|
|
7390
|
+
const telemetryCards = overlay.querySelector("#telemetry-cards");
|
|
7391
|
+
const chartContainer = overlay.querySelector("#chart-container");
|
|
7392
|
+
const chartCanvas = overlay.querySelector("#telemetry-chart");
|
|
7393
|
+
const chartKeySelector = overlay.querySelector("#chart-key-selector");
|
|
7394
|
+
const statusIndicator = overlay.querySelector("#status-indicator");
|
|
7395
|
+
const statusText = overlay.querySelector("#status-text");
|
|
7396
|
+
const lastUpdateText = overlay.querySelector("#last-update-text");
|
|
7393
7397
|
function closeModal() {
|
|
7394
7398
|
if (refreshIntervalId) {
|
|
7395
7399
|
clearInterval(refreshIntervalId);
|
|
@@ -8827,18 +8831,20 @@ var FALLBACK_PATHS = [
|
|
|
8827
8831
|
"/assets/vendor/moment.min.js",
|
|
8828
8832
|
"/assets/vendor/daterangepicker.min.js"
|
|
8829
8833
|
];
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8834
|
+
function getLocaleConfig(includeTime = false) {
|
|
8835
|
+
return {
|
|
8836
|
+
format: includeTime ? "DD/MM/YY HH:mm" : "DD/MM/YYYY",
|
|
8837
|
+
separator: " at\xE9 ",
|
|
8838
|
+
applyLabel: "Aplicar",
|
|
8839
|
+
cancelLabel: "Cancelar",
|
|
8840
|
+
fromLabel: "De",
|
|
8841
|
+
toLabel: "At\xE9",
|
|
8842
|
+
customRangeLabel: "Personalizado",
|
|
8843
|
+
daysOfWeek: ["Do", "Se", "Te", "Qa", "Qi", "Se", "Sa"],
|
|
8844
|
+
monthNames: ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"],
|
|
8845
|
+
firstDay: 1
|
|
8846
|
+
};
|
|
8847
|
+
}
|
|
8842
8848
|
var CDNLoader = class {
|
|
8843
8849
|
static jQueryInstance = null;
|
|
8844
8850
|
static loadingPromise = null;
|
|
@@ -8959,14 +8965,46 @@ function createDateRangePicker($2, input, opts) {
|
|
|
8959
8965
|
helpText.style.display = "flex";
|
|
8960
8966
|
helpText.style.alignItems = "center";
|
|
8961
8967
|
input.parentNode?.appendChild(helpText);
|
|
8968
|
+
const includeTime = opts.includeTime === true;
|
|
8969
|
+
const timePrecision = opts.timePrecision || "minute";
|
|
8970
|
+
const localeConfig = getLocaleConfig(includeTime);
|
|
8962
8971
|
const moment = window.moment;
|
|
8963
|
-
|
|
8964
|
-
|
|
8972
|
+
let startDate, endDate;
|
|
8973
|
+
if (includeTime) {
|
|
8974
|
+
startDate = opts.presetStart ? moment(opts.presetStart) : moment().startOf("day");
|
|
8975
|
+
endDate = opts.presetEnd ? moment(opts.presetEnd) : moment();
|
|
8976
|
+
} else {
|
|
8977
|
+
startDate = opts.presetStart ? moment(opts.presetStart).startOf("day") : moment().startOf("month");
|
|
8978
|
+
endDate = opts.presetEnd ? moment(opts.presetEnd).endOf("day") : moment().endOf("day");
|
|
8979
|
+
}
|
|
8980
|
+
let ranges;
|
|
8981
|
+
if (includeTime) {
|
|
8982
|
+
const now = moment();
|
|
8983
|
+
ranges = {
|
|
8984
|
+
"\xDAltima hora": [moment().subtract(1, "hours"), now.clone()],
|
|
8985
|
+
"\xDAltimas 6 horas": [moment().subtract(6, "hours"), now.clone()],
|
|
8986
|
+
"\xDAltimas 12 horas": [moment().subtract(12, "hours"), now.clone()],
|
|
8987
|
+
"\xDAltimas 24 horas": [moment().subtract(24, "hours"), now.clone()],
|
|
8988
|
+
"Hoje": [moment().startOf("day"), now.clone()],
|
|
8989
|
+
"Ontem": [moment().subtract(1, "day").startOf("day"), moment().subtract(1, "day").endOf("day")],
|
|
8990
|
+
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), now.clone()],
|
|
8991
|
+
"Este m\xEAs": [moment().startOf("month"), now.clone()]
|
|
8992
|
+
};
|
|
8993
|
+
} else {
|
|
8994
|
+
ranges = {
|
|
8995
|
+
"Hoje": [moment().startOf("day"), moment().endOf("day")],
|
|
8996
|
+
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), moment().endOf("day")],
|
|
8997
|
+
"\xDAltimos 30 dias": [moment().subtract(29, "days").startOf("day"), moment().endOf("day")],
|
|
8998
|
+
"M\xEAs Anterior": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
|
|
8999
|
+
};
|
|
9000
|
+
}
|
|
8965
9001
|
$input.daterangepicker({
|
|
8966
9002
|
parentEl: opts.parentEl || document.body,
|
|
8967
|
-
timePicker:
|
|
9003
|
+
timePicker: includeTime,
|
|
9004
|
+
// RFC-0086: Conditional time picker
|
|
8968
9005
|
timePicker24Hour: true,
|
|
8969
|
-
timePickerIncrement: 1,
|
|
9006
|
+
timePickerIncrement: timePrecision === "hour" ? 60 : 1,
|
|
9007
|
+
// RFC-0086: Hour vs minute precision
|
|
8970
9008
|
autoApply: true,
|
|
8971
9009
|
autoUpdateInput: true,
|
|
8972
9010
|
linkedCalendars: true,
|
|
@@ -8977,15 +9015,12 @@ function createDateRangePicker($2, input, opts) {
|
|
|
8977
9015
|
endDate,
|
|
8978
9016
|
opens: "right",
|
|
8979
9017
|
drops: "down",
|
|
8980
|
-
locale:
|
|
9018
|
+
locale: localeConfig,
|
|
9019
|
+
// RFC-0086: Dynamic locale format
|
|
8981
9020
|
applyButtonClasses: "btn btn-primary",
|
|
8982
9021
|
cancelClass: "btn btn-muted",
|
|
8983
|
-
ranges
|
|
8984
|
-
|
|
8985
|
-
"\xDAltimos 7 dias": [moment().subtract(6, "days").startOf("day"), moment().endOf("day")],
|
|
8986
|
-
"\xDAltimos 30 dias": [moment().subtract(29, "days").startOf("day"), moment().endOf("day")],
|
|
8987
|
-
"M\xEAs Anterior": [moment().subtract(1, "month").startOf("month"), moment().subtract(1, "month").endOf("month")]
|
|
8988
|
-
}
|
|
9022
|
+
ranges
|
|
9023
|
+
// RFC-0086: Dynamic ranges
|
|
8989
9024
|
});
|
|
8990
9025
|
updateInputDisplay();
|
|
8991
9026
|
$input.on("apply.daterangepicker.myio", () => {
|
|
@@ -9004,7 +9039,7 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9004
9039
|
function updateInputDisplay() {
|
|
9005
9040
|
const picker = $input.data("daterangepicker");
|
|
9006
9041
|
if (picker) {
|
|
9007
|
-
const formatted = `${picker.startDate.format(
|
|
9042
|
+
const formatted = `${picker.startDate.format(localeConfig.format)}${localeConfig.separator}${picker.endDate.format(localeConfig.format)}`;
|
|
9008
9043
|
$input.val(formatted);
|
|
9009
9044
|
}
|
|
9010
9045
|
}
|
|
@@ -9012,8 +9047,8 @@ function createDateRangePicker($2, input, opts) {
|
|
|
9012
9047
|
const picker = $input.data("daterangepicker");
|
|
9013
9048
|
const startISO = picker.startDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9014
9049
|
const endISO = picker.endDate.format("YYYY-MM-DD[T]HH:mm:ssZ");
|
|
9015
|
-
const startLabel = picker.startDate.format(
|
|
9016
|
-
const endLabel = picker.endDate.format(
|
|
9050
|
+
const startLabel = picker.startDate.format(localeConfig.format);
|
|
9051
|
+
const endLabel = picker.endDate.format(localeConfig.format);
|
|
9017
9052
|
return { startISO, endISO, startLabel, endLabel };
|
|
9018
9053
|
}
|
|
9019
9054
|
function setDates(startISO, endISO) {
|
|
@@ -9984,10 +10019,7 @@ async function openDemandModal(params) {
|
|
|
9984
10019
|
<button class="myio-demand-modal-btn-update" type="button">
|
|
9985
10020
|
${strings.updatePeriod}
|
|
9986
10021
|
</button>
|
|
9987
|
-
|
|
9988
|
-
<span class="realtime-indicator"></span>
|
|
9989
|
-
<span class="realtime-text">REAL TIME</span>
|
|
9990
|
-
</button>
|
|
10022
|
+
<!-- RFC-0084: REAL TIME button removed - use RealTimeTelemetryModal instead -->
|
|
9991
10023
|
<div class="myio-demand-modal-period-error" style="display: none;"></div>
|
|
9992
10024
|
</div>
|
|
9993
10025
|
|
|
@@ -10035,7 +10067,6 @@ async function openDemandModal(params) {
|
|
|
10035
10067
|
const dateStartInput = overlay.querySelector(".myio-demand-modal-date-start");
|
|
10036
10068
|
const dateEndInput = overlay.querySelector(".myio-demand-modal-date-end");
|
|
10037
10069
|
const updateBtn = overlay.querySelector(".myio-demand-modal-btn-update");
|
|
10038
|
-
const realTimeToggleBtn = overlay.querySelector("#realtime-toggle-btn");
|
|
10039
10070
|
const periodErrorEl = overlay.querySelector(".myio-demand-modal-period-error");
|
|
10040
10071
|
const telemetryTypeSelect = overlay.querySelector("#telemetry-type-select");
|
|
10041
10072
|
const intervalSelect = overlay.querySelector("#demand-interval-select");
|
|
@@ -10228,7 +10259,6 @@ async function openDemandModal(params) {
|
|
|
10228
10259
|
console.error("[DemandModal] Real-time update failed:", error);
|
|
10229
10260
|
}
|
|
10230
10261
|
}, intervalMs);
|
|
10231
|
-
realTimeToggleBtn.classList.add("active");
|
|
10232
10262
|
isRealTimeMode = true;
|
|
10233
10263
|
console.log(`[DemandModal] Real-time mode started (${intervalMs}ms interval)`);
|
|
10234
10264
|
} catch (error) {
|
|
@@ -10311,7 +10341,6 @@ async function openDemandModal(params) {
|
|
|
10311
10341
|
isRealTimeMode = false;
|
|
10312
10342
|
lastFetchedTimestamp = null;
|
|
10313
10343
|
realTimeDataBuffer = [];
|
|
10314
|
-
realTimeToggleBtn.classList.remove("active");
|
|
10315
10344
|
console.log("[DemandModal] Real-time mode stopped");
|
|
10316
10345
|
}
|
|
10317
10346
|
function initializeDateInputs() {
|
|
@@ -10394,13 +10423,6 @@ async function openDemandModal(params) {
|
|
|
10394
10423
|
pdfBtn.addEventListener("click", exportPdf);
|
|
10395
10424
|
csvBtn.addEventListener("click", exportCsv);
|
|
10396
10425
|
updateBtn.addEventListener("click", updatePeriod);
|
|
10397
|
-
realTimeToggleBtn.addEventListener("click", async () => {
|
|
10398
|
-
if (isRealTimeMode) {
|
|
10399
|
-
await disableRealTimeMode();
|
|
10400
|
-
} else {
|
|
10401
|
-
await enableRealTimeMode();
|
|
10402
|
-
}
|
|
10403
|
-
});
|
|
10404
10426
|
if (telemetryTypeSelect && allowTelemetrySwitch) {
|
|
10405
10427
|
const debouncedSwitch = debounce(switchTelemetryType, 300);
|
|
10406
10428
|
telemetryTypeSelect.addEventListener("change", (e) => {
|
|
@@ -10826,8 +10848,11 @@ var EnergyModalView = class {
|
|
|
10826
10848
|
*/
|
|
10827
10849
|
reRenderChart() {
|
|
10828
10850
|
const mode = this.config.params.mode || "single";
|
|
10851
|
+
console.log("[EnergyModalView] reRenderChart called, mode:", mode, "barMode:", this.currentBarMode, "theme:", this.currentTheme);
|
|
10829
10852
|
if (mode === "comparison") {
|
|
10830
|
-
|
|
10853
|
+
console.log("[EnergyModalView] Calling renderComparisonChart...");
|
|
10854
|
+
const result = this.renderComparisonChart();
|
|
10855
|
+
console.log("[EnergyModalView] renderComparisonChart result:", result);
|
|
10831
10856
|
} else {
|
|
10832
10857
|
if (this.currentEnergyData) {
|
|
10833
10858
|
this.renderChart(this.currentEnergyData);
|