myio-js-library 0.1.293 → 0.1.296

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
@@ -10575,7 +10575,7 @@ function renderCardComponentHeadOffice(containerEl, params) {
10575
10575
  ensureCss();
10576
10576
  const state6 = normalizeParams(params);
10577
10577
  const root = buildDOM(state6);
10578
- state6.isSelected = params.isSelected || false;
10578
+ state6.isSelected = typeof params.isSelected === "function" ? params.isSelected() : params.isSelected || false;
10579
10579
  containerEl.appendChild(root);
10580
10580
  bindEvents(root, state6, state6.callbacks);
10581
10581
  paint(root, state6);
@@ -59702,6 +59702,7 @@ var MenuView = class {
59702
59702
  availableShoppings = [];
59703
59703
  /**
59704
59704
  * Update available shoppings
59705
+ * RFC-0126: Dispatches myio:customers-ready event for MAIN orchestrator
59705
59706
  */
59706
59707
  updateShoppings(shoppings) {
59707
59708
  this.availableShoppings = shoppings;
@@ -59709,6 +59710,17 @@ var MenuView = class {
59709
59710
  shoppings.forEach((s) => this.filterSelection.add(s.value));
59710
59711
  }
59711
59712
  this.renderFilterList();
59713
+ window.dispatchEvent(
59714
+ new CustomEvent("myio:customers-ready", {
59715
+ detail: {
59716
+ count: shoppings.length,
59717
+ customers: shoppings
59718
+ }
59719
+ })
59720
+ );
59721
+ if (this.configTemplate.enableDebugMode) {
59722
+ console.log("[MenuView] myio:customers-ready dispatched:", shoppings.length, "customers");
59723
+ }
59712
59724
  }
59713
59725
  /**
59714
59726
  * Get selected shoppings
@@ -60049,9 +60061,22 @@ var MenuView = class {
60049
60061
  }
60050
60062
  /**
60051
60063
  * Handle filter apply
60064
+ * RFC-0126: Dispatches myio:filter-applied event for MAIN orchestrator
60052
60065
  */
60053
60066
  handleFilterApply() {
60054
60067
  const selected = this.getSelectedShoppings();
60068
+ window.custumersSelected = selected;
60069
+ window.dispatchEvent(
60070
+ new CustomEvent("myio:filter-applied", {
60071
+ detail: {
60072
+ selection: selected,
60073
+ ts: Date.now()
60074
+ }
60075
+ })
60076
+ );
60077
+ if (this.configTemplate.enableDebugMode) {
60078
+ console.log("[MenuView] myio:filter-applied dispatched:", selected.length, "selected");
60079
+ }
60055
60080
  this.emit("filter-apply", selected);
60056
60081
  this.closeFilterModal();
60057
60082
  }
@@ -61846,6 +61871,8 @@ var TelemetryGridView = class {
61846
61871
  container: headerContainer,
61847
61872
  domain: this.controller.getDomain(),
61848
61873
  idPrefix: contextConfig.idPrefix,
61874
+ themeMode: this.controller.getThemeMode(),
61875
+ // RFC-0125: Pass theme from controller
61849
61876
  labels: {
61850
61877
  total: contextConfig.headerLabel,
61851
61878
  consumption: `${domainConfig.headerLabel} ${contextConfig.headerLabel}`
@@ -62074,24 +62101,27 @@ var TelemetryGridView = class {
62074
62101
  modalClass: "telemetry-modal",
62075
62102
  primaryColor: this.getCSSVariableValue("--telemetry-primary") || "#f59e0b",
62076
62103
  itemIdAttr: "data-device-id",
62077
- getItems: () => this.controller.getDevices(),
62078
- getItemStatus: (item) => item.deviceStatus || this.controller.calculateDeviceStatus(item),
62104
+ themeMode: this.controller.getThemeMode(),
62105
+ // RFC-0125: Pass theme from controller
62079
62106
  filterTabs: [
62080
62107
  { id: "all", label: "Todos", filter: () => true },
62081
62108
  {
62082
62109
  id: "online",
62083
62110
  label: "Online",
62084
- filter: (d) => d.deviceStatus === "power_on"
62111
+ filter: (d) => {
62112
+ const status = (d.deviceStatus || "").toLowerCase();
62113
+ return status === "power_on" || status === "normal" || status === "standby" || status === "alert";
62114
+ }
62085
62115
  },
62086
62116
  {
62087
62117
  id: "offline",
62088
62118
  label: "Offline",
62089
- filter: (d) => d.deviceStatus === "offline"
62119
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "offline"
62090
62120
  },
62091
62121
  {
62092
62122
  id: "notInstalled",
62093
62123
  label: "Nao Instalado",
62094
- filter: (d) => d.deviceStatus === "not_installed"
62124
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "not_installed"
62095
62125
  },
62096
62126
  {
62097
62127
  id: "withConsumption",
@@ -62110,20 +62140,23 @@ var TelemetryGridView = class {
62110
62140
  }
62111
62141
  }
62112
62142
  ],
62113
- sortOptions: [
62114
- { id: "cons_desc", label: `${domainConfig.headerLabel} (maior)`, icon: "\u2193" },
62115
- { id: "cons_asc", label: `${domainConfig.headerLabel} (menor)`, icon: "\u2191" },
62116
- { id: "alpha_asc", label: "Nome (A-Z)", icon: "A" },
62117
- { id: "alpha_desc", label: "Nome (Z-A)", icon: "Z" },
62118
- { id: "shopping_asc", label: "Shopping (A-Z)", icon: "\u{1F3E2}" },
62119
- { id: "shopping_desc", label: "Shopping (Z-A)", icon: "\u{1F3E2}" }
62120
- ],
62121
- onFilterChange: (selectedIds) => {
62122
- this.controller.setDeviceFilter(selectedIds);
62143
+ getItemId: (d) => d.entityId || "",
62144
+ getItemLabel: (d) => d.labelOrName || d.deviceIdentifier || "",
62145
+ getItemValue: (d) => Number(d.val) || Number(d.value) || 0,
62146
+ getItemSubLabel: (d) => d.deviceStatus || "",
62147
+ formatValue: (val) => domainConfig.formatValue ? domainConfig.formatValue(val) : `${val.toFixed(2)}`,
62148
+ onApply: (filters) => {
62149
+ this.log("Filter applied:", filters);
62150
+ if (filters.selectedIds !== void 0) {
62151
+ this.controller.setDeviceFilter(filters.selectedIds);
62152
+ }
62153
+ if (filters.sortMode) {
62154
+ this.controller.setSortMode(filters.sortMode);
62155
+ this.emit("sort-change", filters.sortMode);
62156
+ }
62123
62157
  },
62124
- onSortChange: (sortMode) => {
62125
- this.controller.setSortMode(sortMode);
62126
- this.emit("sort-change", sortMode);
62158
+ onClose: () => {
62159
+ this.log("Filter modal closed");
62127
62160
  }
62128
62161
  });
62129
62162
  }
package/dist/index.d.cts CHANGED
@@ -8582,6 +8582,7 @@ declare class MenuView {
8582
8582
  private availableShoppings;
8583
8583
  /**
8584
8584
  * Update available shoppings
8585
+ * RFC-0126: Dispatches myio:customers-ready event for MAIN orchestrator
8585
8586
  */
8586
8587
  updateShoppings(shoppings: Shopping$1[]): void;
8587
8588
  /**
@@ -8618,6 +8619,7 @@ declare class MenuView {
8618
8619
  private buildFilterTooltipData;
8619
8620
  /**
8620
8621
  * Handle filter apply
8622
+ * RFC-0126: Dispatches myio:filter-applied event for MAIN orchestrator
8621
8623
  */
8622
8624
  private handleFilterApply;
8623
8625
  /**
@@ -8966,6 +8968,7 @@ interface HeaderGridConfig {
8966
8968
  container: string | HTMLElement;
8967
8969
  domain: TelemetryDomain;
8968
8970
  idPrefix: string;
8971
+ themeMode?: ThemeMode;
8969
8972
  labels: {
8970
8973
  total: string;
8971
8974
  consumption: string;
@@ -8985,10 +8988,11 @@ interface FilterTab$1 {
8985
8988
  label: string;
8986
8989
  filter: (device: TelemetryDevice) => boolean;
8987
8990
  }
8988
- interface SortOption {
8989
- id: SortMode$1;
8990
- label: string;
8991
- icon: string;
8991
+ interface AppliedFilters$1 {
8992
+ selectedIds: Set<string> | null;
8993
+ sortMode: SortMode$1;
8994
+ statusFilter?: string;
8995
+ consumptionFilter?: string;
8992
8996
  }
8993
8997
  interface FilterModalConfig {
8994
8998
  widgetName: string;
@@ -8996,12 +9000,15 @@ interface FilterModalConfig {
8996
9000
  modalClass: string;
8997
9001
  primaryColor: string;
8998
9002
  itemIdAttr: string;
8999
- getItems: () => TelemetryDevice[];
9000
- getItemStatus: (item: TelemetryDevice) => string;
9003
+ themeMode?: ThemeMode;
9001
9004
  filterTabs: FilterTab$1[];
9002
- sortOptions: SortOption[];
9003
- onFilterChange: (selectedIds: Set<string> | null) => void;
9004
- onSortChange: (sortMode: SortMode$1) => void;
9005
+ getItemId?: (item: TelemetryDevice) => string;
9006
+ getItemLabel?: (item: TelemetryDevice) => string;
9007
+ getItemValue?: (item: TelemetryDevice) => number;
9008
+ getItemSubLabel?: (item: TelemetryDevice) => string;
9009
+ formatValue?: (val: number) => string;
9010
+ onApply?: (filters: AppliedFilters$1) => void;
9011
+ onClose?: () => void;
9005
9012
  }
9006
9013
  interface FilterModalController$1 {
9007
9014
  open: (devices: TelemetryDevice[]) => void;
package/dist/index.js CHANGED
@@ -10324,7 +10324,7 @@ function renderCardComponentHeadOffice(containerEl, params) {
10324
10324
  ensureCss();
10325
10325
  const state6 = normalizeParams(params);
10326
10326
  const root = buildDOM(state6);
10327
- state6.isSelected = params.isSelected || false;
10327
+ state6.isSelected = typeof params.isSelected === "function" ? params.isSelected() : params.isSelected || false;
10328
10328
  containerEl.appendChild(root);
10329
10329
  bindEvents(root, state6, state6.callbacks);
10330
10330
  paint(root, state6);
@@ -59451,6 +59451,7 @@ var MenuView = class {
59451
59451
  availableShoppings = [];
59452
59452
  /**
59453
59453
  * Update available shoppings
59454
+ * RFC-0126: Dispatches myio:customers-ready event for MAIN orchestrator
59454
59455
  */
59455
59456
  updateShoppings(shoppings) {
59456
59457
  this.availableShoppings = shoppings;
@@ -59458,6 +59459,17 @@ var MenuView = class {
59458
59459
  shoppings.forEach((s) => this.filterSelection.add(s.value));
59459
59460
  }
59460
59461
  this.renderFilterList();
59462
+ window.dispatchEvent(
59463
+ new CustomEvent("myio:customers-ready", {
59464
+ detail: {
59465
+ count: shoppings.length,
59466
+ customers: shoppings
59467
+ }
59468
+ })
59469
+ );
59470
+ if (this.configTemplate.enableDebugMode) {
59471
+ console.log("[MenuView] myio:customers-ready dispatched:", shoppings.length, "customers");
59472
+ }
59461
59473
  }
59462
59474
  /**
59463
59475
  * Get selected shoppings
@@ -59798,9 +59810,22 @@ var MenuView = class {
59798
59810
  }
59799
59811
  /**
59800
59812
  * Handle filter apply
59813
+ * RFC-0126: Dispatches myio:filter-applied event for MAIN orchestrator
59801
59814
  */
59802
59815
  handleFilterApply() {
59803
59816
  const selected = this.getSelectedShoppings();
59817
+ window.custumersSelected = selected;
59818
+ window.dispatchEvent(
59819
+ new CustomEvent("myio:filter-applied", {
59820
+ detail: {
59821
+ selection: selected,
59822
+ ts: Date.now()
59823
+ }
59824
+ })
59825
+ );
59826
+ if (this.configTemplate.enableDebugMode) {
59827
+ console.log("[MenuView] myio:filter-applied dispatched:", selected.length, "selected");
59828
+ }
59804
59829
  this.emit("filter-apply", selected);
59805
59830
  this.closeFilterModal();
59806
59831
  }
@@ -61595,6 +61620,8 @@ var TelemetryGridView = class {
61595
61620
  container: headerContainer,
61596
61621
  domain: this.controller.getDomain(),
61597
61622
  idPrefix: contextConfig.idPrefix,
61623
+ themeMode: this.controller.getThemeMode(),
61624
+ // RFC-0125: Pass theme from controller
61598
61625
  labels: {
61599
61626
  total: contextConfig.headerLabel,
61600
61627
  consumption: `${domainConfig.headerLabel} ${contextConfig.headerLabel}`
@@ -61823,24 +61850,27 @@ var TelemetryGridView = class {
61823
61850
  modalClass: "telemetry-modal",
61824
61851
  primaryColor: this.getCSSVariableValue("--telemetry-primary") || "#f59e0b",
61825
61852
  itemIdAttr: "data-device-id",
61826
- getItems: () => this.controller.getDevices(),
61827
- getItemStatus: (item) => item.deviceStatus || this.controller.calculateDeviceStatus(item),
61853
+ themeMode: this.controller.getThemeMode(),
61854
+ // RFC-0125: Pass theme from controller
61828
61855
  filterTabs: [
61829
61856
  { id: "all", label: "Todos", filter: () => true },
61830
61857
  {
61831
61858
  id: "online",
61832
61859
  label: "Online",
61833
- filter: (d) => d.deviceStatus === "power_on"
61860
+ filter: (d) => {
61861
+ const status = (d.deviceStatus || "").toLowerCase();
61862
+ return status === "power_on" || status === "normal" || status === "standby" || status === "alert";
61863
+ }
61834
61864
  },
61835
61865
  {
61836
61866
  id: "offline",
61837
61867
  label: "Offline",
61838
- filter: (d) => d.deviceStatus === "offline"
61868
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "offline"
61839
61869
  },
61840
61870
  {
61841
61871
  id: "notInstalled",
61842
61872
  label: "Nao Instalado",
61843
- filter: (d) => d.deviceStatus === "not_installed"
61873
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "not_installed"
61844
61874
  },
61845
61875
  {
61846
61876
  id: "withConsumption",
@@ -61859,20 +61889,23 @@ var TelemetryGridView = class {
61859
61889
  }
61860
61890
  }
61861
61891
  ],
61862
- sortOptions: [
61863
- { id: "cons_desc", label: `${domainConfig.headerLabel} (maior)`, icon: "\u2193" },
61864
- { id: "cons_asc", label: `${domainConfig.headerLabel} (menor)`, icon: "\u2191" },
61865
- { id: "alpha_asc", label: "Nome (A-Z)", icon: "A" },
61866
- { id: "alpha_desc", label: "Nome (Z-A)", icon: "Z" },
61867
- { id: "shopping_asc", label: "Shopping (A-Z)", icon: "\u{1F3E2}" },
61868
- { id: "shopping_desc", label: "Shopping (Z-A)", icon: "\u{1F3E2}" }
61869
- ],
61870
- onFilterChange: (selectedIds) => {
61871
- this.controller.setDeviceFilter(selectedIds);
61892
+ getItemId: (d) => d.entityId || "",
61893
+ getItemLabel: (d) => d.labelOrName || d.deviceIdentifier || "",
61894
+ getItemValue: (d) => Number(d.val) || Number(d.value) || 0,
61895
+ getItemSubLabel: (d) => d.deviceStatus || "",
61896
+ formatValue: (val) => domainConfig.formatValue ? domainConfig.formatValue(val) : `${val.toFixed(2)}`,
61897
+ onApply: (filters) => {
61898
+ this.log("Filter applied:", filters);
61899
+ if (filters.selectedIds !== void 0) {
61900
+ this.controller.setDeviceFilter(filters.selectedIds);
61901
+ }
61902
+ if (filters.sortMode) {
61903
+ this.controller.setSortMode(filters.sortMode);
61904
+ this.emit("sort-change", filters.sortMode);
61905
+ }
61872
61906
  },
61873
- onSortChange: (sortMode) => {
61874
- this.controller.setSortMode(sortMode);
61875
- this.emit("sort-change", sortMode);
61907
+ onClose: () => {
61908
+ this.log("Filter modal closed");
61876
61909
  }
61877
61910
  });
61878
61911
  }
@@ -10311,7 +10311,7 @@
10311
10311
  ensureCss();
10312
10312
  const state6 = normalizeParams(params);
10313
10313
  const root = buildDOM(state6);
10314
- state6.isSelected = params.isSelected || false;
10314
+ state6.isSelected = typeof params.isSelected === "function" ? params.isSelected() : params.isSelected || false;
10315
10315
  containerEl.appendChild(root);
10316
10316
  bindEvents(root, state6, state6.callbacks);
10317
10317
  paint(root, state6);
@@ -59257,6 +59257,7 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
59257
59257
  availableShoppings = [];
59258
59258
  /**
59259
59259
  * Update available shoppings
59260
+ * RFC-0126: Dispatches myio:customers-ready event for MAIN orchestrator
59260
59261
  */
59261
59262
  updateShoppings(shoppings) {
59262
59263
  this.availableShoppings = shoppings;
@@ -59264,6 +59265,17 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
59264
59265
  shoppings.forEach((s) => this.filterSelection.add(s.value));
59265
59266
  }
59266
59267
  this.renderFilterList();
59268
+ window.dispatchEvent(
59269
+ new CustomEvent("myio:customers-ready", {
59270
+ detail: {
59271
+ count: shoppings.length,
59272
+ customers: shoppings
59273
+ }
59274
+ })
59275
+ );
59276
+ if (this.configTemplate.enableDebugMode) {
59277
+ console.log("[MenuView] myio:customers-ready dispatched:", shoppings.length, "customers");
59278
+ }
59267
59279
  }
59268
59280
  /**
59269
59281
  * Get selected shoppings
@@ -59604,9 +59616,22 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
59604
59616
  }
59605
59617
  /**
59606
59618
  * Handle filter apply
59619
+ * RFC-0126: Dispatches myio:filter-applied event for MAIN orchestrator
59607
59620
  */
59608
59621
  handleFilterApply() {
59609
59622
  const selected = this.getSelectedShoppings();
59623
+ window.custumersSelected = selected;
59624
+ window.dispatchEvent(
59625
+ new CustomEvent("myio:filter-applied", {
59626
+ detail: {
59627
+ selection: selected,
59628
+ ts: Date.now()
59629
+ }
59630
+ })
59631
+ );
59632
+ if (this.configTemplate.enableDebugMode) {
59633
+ console.log("[MenuView] myio:filter-applied dispatched:", selected.length, "selected");
59634
+ }
59610
59635
  this.emit("filter-apply", selected);
59611
59636
  this.closeFilterModal();
59612
59637
  }
@@ -61401,6 +61426,8 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
61401
61426
  container: headerContainer,
61402
61427
  domain: this.controller.getDomain(),
61403
61428
  idPrefix: contextConfig.idPrefix,
61429
+ themeMode: this.controller.getThemeMode(),
61430
+ // RFC-0125: Pass theme from controller
61404
61431
  labels: {
61405
61432
  total: contextConfig.headerLabel,
61406
61433
  consumption: `${domainConfig.headerLabel} ${contextConfig.headerLabel}`
@@ -61629,24 +61656,27 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
61629
61656
  modalClass: "telemetry-modal",
61630
61657
  primaryColor: this.getCSSVariableValue("--telemetry-primary") || "#f59e0b",
61631
61658
  itemIdAttr: "data-device-id",
61632
- getItems: () => this.controller.getDevices(),
61633
- getItemStatus: (item) => item.deviceStatus || this.controller.calculateDeviceStatus(item),
61659
+ themeMode: this.controller.getThemeMode(),
61660
+ // RFC-0125: Pass theme from controller
61634
61661
  filterTabs: [
61635
61662
  { id: "all", label: "Todos", filter: () => true },
61636
61663
  {
61637
61664
  id: "online",
61638
61665
  label: "Online",
61639
- filter: (d) => d.deviceStatus === "power_on"
61666
+ filter: (d) => {
61667
+ const status = (d.deviceStatus || "").toLowerCase();
61668
+ return status === "power_on" || status === "normal" || status === "standby" || status === "alert";
61669
+ }
61640
61670
  },
61641
61671
  {
61642
61672
  id: "offline",
61643
61673
  label: "Offline",
61644
- filter: (d) => d.deviceStatus === "offline"
61674
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "offline"
61645
61675
  },
61646
61676
  {
61647
61677
  id: "notInstalled",
61648
61678
  label: "Nao Instalado",
61649
- filter: (d) => d.deviceStatus === "not_installed"
61679
+ filter: (d) => (d.deviceStatus || "").toLowerCase() === "not_installed"
61650
61680
  },
61651
61681
  {
61652
61682
  id: "withConsumption",
@@ -61665,20 +61695,23 @@ ${errors.slice(0, 5).join("\n")}` + (errors.length > 5 ? `
61665
61695
  }
61666
61696
  }
61667
61697
  ],
61668
- sortOptions: [
61669
- { id: "cons_desc", label: `${domainConfig.headerLabel} (maior)`, icon: "\u2193" },
61670
- { id: "cons_asc", label: `${domainConfig.headerLabel} (menor)`, icon: "\u2191" },
61671
- { id: "alpha_asc", label: "Nome (A-Z)", icon: "A" },
61672
- { id: "alpha_desc", label: "Nome (Z-A)", icon: "Z" },
61673
- { id: "shopping_asc", label: "Shopping (A-Z)", icon: "\u{1F3E2}" },
61674
- { id: "shopping_desc", label: "Shopping (Z-A)", icon: "\u{1F3E2}" }
61675
- ],
61676
- onFilterChange: (selectedIds) => {
61677
- this.controller.setDeviceFilter(selectedIds);
61698
+ getItemId: (d) => d.entityId || "",
61699
+ getItemLabel: (d) => d.labelOrName || d.deviceIdentifier || "",
61700
+ getItemValue: (d) => Number(d.val) || Number(d.value) || 0,
61701
+ getItemSubLabel: (d) => d.deviceStatus || "",
61702
+ formatValue: (val) => domainConfig.formatValue ? domainConfig.formatValue(val) : `${val.toFixed(2)}`,
61703
+ onApply: (filters) => {
61704
+ this.log("Filter applied:", filters);
61705
+ if (filters.selectedIds !== void 0) {
61706
+ this.controller.setDeviceFilter(filters.selectedIds);
61707
+ }
61708
+ if (filters.sortMode) {
61709
+ this.controller.setSortMode(filters.sortMode);
61710
+ this.emit("sort-change", filters.sortMode);
61711
+ }
61678
61712
  },
61679
- onSortChange: (sortMode) => {
61680
- this.controller.setSortMode(sortMode);
61681
- this.emit("sort-change", sortMode);
61713
+ onClose: () => {
61714
+ this.log("Filter modal closed");
61682
61715
  }
61683
61716
  });
61684
61717
  }