myio-js-library 0.1.543 → 0.1.544

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
@@ -891,7 +891,7 @@ module.exports = __toCommonJS(src_exports);
891
891
  // package.json
892
892
  var package_default = {
893
893
  name: "myio-js-library",
894
- version: "0.1.543",
894
+ version: "0.1.544",
895
895
  description: "A clean, standalone JS SDK for MYIO projects",
896
896
  license: "MIT",
897
897
  repository: "github:gh-myio/myio-js-library",
@@ -26611,6 +26611,9 @@ function getLocaleConfig(includeTime = false) {
26611
26611
  firstDay: 1
26612
26612
  };
26613
26613
  }
26614
+ function buildMaxSpan(maxRangeDays) {
26615
+ return { days: maxRangeDays, milliseconds: -1 };
26616
+ }
26614
26617
  var CDNLoader = class {
26615
26618
  static jQueryInstance = null;
26616
26619
  static loadingPromise = null;
@@ -26773,7 +26776,7 @@ function createDateRangePicker($2, input, opts) {
26773
26776
  autoUpdateInput: true,
26774
26777
  linkedCalendars: true,
26775
26778
  showCustomRangeLabel: true,
26776
- maxSpan: { days: maxRangeDays },
26779
+ maxSpan: buildMaxSpan(maxRangeDays),
26777
26780
  maxDate: moment().endOf("day"),
26778
26781
  startDate,
26779
26782
  endDate,
@@ -35363,7 +35366,8 @@ var DeviceReportModal = class {
35363
35366
  this.dateRangePicker = await attach(input, {
35364
35367
  presetStart,
35365
35368
  presetEnd,
35366
- maxRangeDays: 31,
35369
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
35370
+ maxRangeDays: 32,
35367
35371
  includeTime: this.granularity === "1h",
35368
35372
  timePrecision: "minute",
35369
35373
  parentEl: this.modal.element,
@@ -35373,8 +35377,23 @@ var DeviceReportModal = class {
35373
35377
  }
35374
35378
  });
35375
35379
  } catch (error) {
35376
- console.warn("DateRangePicker initialization failed, using fallback:", error);
35377
- }
35380
+ console.warn("DateRangePicker initialization failed:", error);
35381
+ }
35382
+ }
35383
+ // Janela da consulta. No 1d a API recebe dias inteiros — os MESMOS dias que viram
35384
+ // linhas no zero-fill (rangeDaysInclusive): início 00:00:00 e fim 23:59:59. Um fim à
35385
+ // meia-noite (ex.: 15/09T00:00:00, exclusivo na API) não vira mais um dia "0,00" que
35386
+ // nem foi consultado. No 1h vale a hora escolhida.
35387
+ // Contrato do getDates(): hora LOCAL + offset (YYYY-MM-DDTHH:mm:ss±HH:MM) — os 10
35388
+ // primeiros caracteres são o dia exibido e os 6 últimos, o offset.
35389
+ resolveQueryWindow(range) {
35390
+ if (this.granularity === "1h" || !range.startISO || !range.endISO) return range;
35391
+ const day = (iso) => iso.slice(0, 10);
35392
+ const offset = (iso) => iso.slice(-6);
35393
+ return {
35394
+ startISO: `${day(range.startISO)}T00:00:00${offset(range.startISO)}`,
35395
+ endISO: `${day(range.endISO)}T23:59:59${offset(range.endISO)}`
35396
+ };
35378
35397
  }
35379
35398
  async loadData() {
35380
35399
  if (this.isLoading) return;
@@ -35394,7 +35413,7 @@ var DeviceReportModal = class {
35394
35413
  if (xlsBtn) xlsBtn.disabled = true;
35395
35414
  spinner.style.display = "inline-block";
35396
35415
  try {
35397
- const { startISO, endISO } = this.dateRangePicker.getDates();
35416
+ const { startISO, endISO } = this.resolveQueryWindow(this.dateRangePicker.getDates());
35398
35417
  this.exportPeriod = { startISO, endISO };
35399
35418
  if (!startISO || !endISO) {
35400
35419
  this.showError("Selecione um per\xEDodo v\xE1lido");
@@ -37957,7 +37976,8 @@ var AllReportModal = class {
37957
37976
  this.dateRangePicker = await attach(dateRangeInput, {
37958
37977
  presetStart: this.getDefaultStartDate(),
37959
37978
  presetEnd: this.getDefaultEndDate(),
37960
- maxRangeDays: 31,
37979
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
37980
+ maxRangeDays: 32,
37961
37981
  parentEl: this.modal.element,
37962
37982
  onApply: ({ startISO, endISO }) => {
37963
37983
  this.hideError();
@@ -37965,7 +37985,7 @@ var AllReportModal = class {
37965
37985
  }
37966
37986
  });
37967
37987
  } catch (error) {
37968
- this.debugLog("DateRangePicker initialization failed, using fallback:", error);
37988
+ this.debugLog("DateRangePicker initialization failed:", error);
37969
37989
  }
37970
37990
  }
37971
37991
  async loadData() {
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  // package.json
11
11
  var package_default = {
12
12
  name: "myio-js-library",
13
- version: "0.1.543",
13
+ version: "0.1.544",
14
14
  description: "A clean, standalone JS SDK for MYIO projects",
15
15
  license: "MIT",
16
16
  repository: "github:gh-myio/myio-js-library",
@@ -25005,6 +25005,9 @@ function getLocaleConfig(includeTime = false) {
25005
25005
  firstDay: 1
25006
25006
  };
25007
25007
  }
25008
+ function buildMaxSpan(maxRangeDays) {
25009
+ return { days: maxRangeDays, milliseconds: -1 };
25010
+ }
25008
25011
  var CDNLoader = class {
25009
25012
  static jQueryInstance = null;
25010
25013
  static loadingPromise = null;
@@ -25167,7 +25170,7 @@ function createDateRangePicker($2, input, opts) {
25167
25170
  autoUpdateInput: true,
25168
25171
  linkedCalendars: true,
25169
25172
  showCustomRangeLabel: true,
25170
- maxSpan: { days: maxRangeDays },
25173
+ maxSpan: buildMaxSpan(maxRangeDays),
25171
25174
  maxDate: moment().endOf("day"),
25172
25175
  startDate,
25173
25176
  endDate,
@@ -33757,7 +33760,8 @@ var DeviceReportModal = class {
33757
33760
  this.dateRangePicker = await attach(input, {
33758
33761
  presetStart,
33759
33762
  presetEnd,
33760
- maxRangeDays: 31,
33763
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
33764
+ maxRangeDays: 32,
33761
33765
  includeTime: this.granularity === "1h",
33762
33766
  timePrecision: "minute",
33763
33767
  parentEl: this.modal.element,
@@ -33767,8 +33771,23 @@ var DeviceReportModal = class {
33767
33771
  }
33768
33772
  });
33769
33773
  } catch (error) {
33770
- console.warn("DateRangePicker initialization failed, using fallback:", error);
33771
- }
33774
+ console.warn("DateRangePicker initialization failed:", error);
33775
+ }
33776
+ }
33777
+ // Janela da consulta. No 1d a API recebe dias inteiros — os MESMOS dias que viram
33778
+ // linhas no zero-fill (rangeDaysInclusive): início 00:00:00 e fim 23:59:59. Um fim à
33779
+ // meia-noite (ex.: 15/09T00:00:00, exclusivo na API) não vira mais um dia "0,00" que
33780
+ // nem foi consultado. No 1h vale a hora escolhida.
33781
+ // Contrato do getDates(): hora LOCAL + offset (YYYY-MM-DDTHH:mm:ss±HH:MM) — os 10
33782
+ // primeiros caracteres são o dia exibido e os 6 últimos, o offset.
33783
+ resolveQueryWindow(range) {
33784
+ if (this.granularity === "1h" || !range.startISO || !range.endISO) return range;
33785
+ const day = (iso) => iso.slice(0, 10);
33786
+ const offset = (iso) => iso.slice(-6);
33787
+ return {
33788
+ startISO: `${day(range.startISO)}T00:00:00${offset(range.startISO)}`,
33789
+ endISO: `${day(range.endISO)}T23:59:59${offset(range.endISO)}`
33790
+ };
33772
33791
  }
33773
33792
  async loadData() {
33774
33793
  if (this.isLoading) return;
@@ -33788,7 +33807,7 @@ var DeviceReportModal = class {
33788
33807
  if (xlsBtn) xlsBtn.disabled = true;
33789
33808
  spinner.style.display = "inline-block";
33790
33809
  try {
33791
- const { startISO, endISO } = this.dateRangePicker.getDates();
33810
+ const { startISO, endISO } = this.resolveQueryWindow(this.dateRangePicker.getDates());
33792
33811
  this.exportPeriod = { startISO, endISO };
33793
33812
  if (!startISO || !endISO) {
33794
33813
  this.showError("Selecione um per\xEDodo v\xE1lido");
@@ -36351,7 +36370,8 @@ var AllReportModal = class {
36351
36370
  this.dateRangePicker = await attach(dateRangeInput, {
36352
36371
  presetStart: this.getDefaultStartDate(),
36353
36372
  presetEnd: this.getDefaultEndDate(),
36354
- maxRangeDays: 31,
36373
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
36374
+ maxRangeDays: 32,
36355
36375
  parentEl: this.modal.element,
36356
36376
  onApply: ({ startISO, endISO }) => {
36357
36377
  this.hideError();
@@ -36359,7 +36379,7 @@ var AllReportModal = class {
36359
36379
  }
36360
36380
  });
36361
36381
  } catch (error) {
36362
- this.debugLog("DateRangePicker initialization failed, using fallback:", error);
36382
+ this.debugLog("DateRangePicker initialization failed:", error);
36363
36383
  }
36364
36384
  }
36365
36385
  async loadData() {
@@ -5455,7 +5455,7 @@
5455
5455
 
5456
5456
  // package.json
5457
5457
  var package_default = {
5458
- version: "0.1.543"};
5458
+ version: "0.1.544"};
5459
5459
 
5460
5460
  // src/utils/format/energy.ts
5461
5461
  function formatPower(value, decimals = 2) {
@@ -30334,6 +30334,9 @@
30334
30334
  firstDay: 1
30335
30335
  };
30336
30336
  }
30337
+ function buildMaxSpan(maxRangeDays) {
30338
+ return { days: maxRangeDays, milliseconds: -1 };
30339
+ }
30337
30340
  var CDNLoader = class {
30338
30341
  static jQueryInstance = null;
30339
30342
  static loadingPromise = null;
@@ -30496,7 +30499,7 @@
30496
30499
  autoUpdateInput: true,
30497
30500
  linkedCalendars: true,
30498
30501
  showCustomRangeLabel: true,
30499
- maxSpan: { days: maxRangeDays },
30502
+ maxSpan: buildMaxSpan(maxRangeDays),
30500
30503
  maxDate: moment().endOf("day"),
30501
30504
  startDate,
30502
30505
  endDate,
@@ -39080,7 +39083,8 @@
39080
39083
  this.dateRangePicker = await attach(input, {
39081
39084
  presetStart,
39082
39085
  presetEnd,
39083
- maxRangeDays: 31,
39086
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
39087
+ maxRangeDays: 32,
39084
39088
  includeTime: this.granularity === "1h",
39085
39089
  timePrecision: "minute",
39086
39090
  parentEl: this.modal.element,
@@ -39090,8 +39094,23 @@
39090
39094
  }
39091
39095
  });
39092
39096
  } catch (error) {
39093
- console.warn("DateRangePicker initialization failed, using fallback:", error);
39094
- }
39097
+ console.warn("DateRangePicker initialization failed:", error);
39098
+ }
39099
+ }
39100
+ // Janela da consulta. No 1d a API recebe dias inteiros — os MESMOS dias que viram
39101
+ // linhas no zero-fill (rangeDaysInclusive): início 00:00:00 e fim 23:59:59. Um fim à
39102
+ // meia-noite (ex.: 15/09T00:00:00, exclusivo na API) não vira mais um dia "0,00" que
39103
+ // nem foi consultado. No 1h vale a hora escolhida.
39104
+ // Contrato do getDates(): hora LOCAL + offset (YYYY-MM-DDTHH:mm:ss±HH:MM) — os 10
39105
+ // primeiros caracteres são o dia exibido e os 6 últimos, o offset.
39106
+ resolveQueryWindow(range) {
39107
+ if (this.granularity === "1h" || !range.startISO || !range.endISO) return range;
39108
+ const day = (iso) => iso.slice(0, 10);
39109
+ const offset = (iso) => iso.slice(-6);
39110
+ return {
39111
+ startISO: `${day(range.startISO)}T00:00:00${offset(range.startISO)}`,
39112
+ endISO: `${day(range.endISO)}T23:59:59${offset(range.endISO)}`
39113
+ };
39095
39114
  }
39096
39115
  async loadData() {
39097
39116
  if (this.isLoading) return;
@@ -39111,7 +39130,7 @@
39111
39130
  if (xlsBtn) xlsBtn.disabled = true;
39112
39131
  spinner.style.display = "inline-block";
39113
39132
  try {
39114
- const { startISO, endISO } = this.dateRangePicker.getDates();
39133
+ const { startISO, endISO } = this.resolveQueryWindow(this.dateRangePicker.getDates());
39115
39134
  this.exportPeriod = { startISO, endISO };
39116
39135
  if (!startISO || !endISO) {
39117
39136
  this.showError("Selecione um per\xEDodo v\xE1lido");
@@ -41674,7 +41693,8 @@
41674
41693
  this.dateRangePicker = await attach(dateRangeInput, {
41675
41694
  presetStart: this.getDefaultStartDate(),
41676
41695
  presetEnd: this.getDefaultEndDate(),
41677
- maxRangeDays: 31,
41696
+ // Ciclo de rateio (dia D → dia D do mês seguinte) tem até 32 dias corridos (ex.: 15/08→15/09)
41697
+ maxRangeDays: 32,
41678
41698
  parentEl: this.modal.element,
41679
41699
  onApply: ({ startISO, endISO }) => {
41680
41700
  this.hideError();
@@ -41682,7 +41702,7 @@
41682
41702
  }
41683
41703
  });
41684
41704
  } catch (error) {
41685
- this.debugLog("DateRangePicker initialization failed, using fallback:", error);
41705
+ this.debugLog("DateRangePicker initialization failed:", error);
41686
41706
  }
41687
41707
  }
41688
41708
  async loadData() {