myio-js-library 0.1.340 → 0.1.341
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 +22 -8
- package/dist/index.js +22 -8
- package/dist/myio-js-library.umd.js +23 -9
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -971,7 +971,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
971
971
|
// package.json
|
|
972
972
|
var package_default = {
|
|
973
973
|
name: "myio-js-library",
|
|
974
|
-
version: "0.1.
|
|
974
|
+
version: "0.1.341",
|
|
975
975
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
976
976
|
license: "MIT",
|
|
977
977
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -3078,11 +3078,11 @@ function updateStats(config, items, context) {
|
|
|
3078
3078
|
}
|
|
3079
3079
|
});
|
|
3080
3080
|
const connectivityPercentage = total > 0 ? (onlineCount / total * 100).toFixed(1) : "0.0";
|
|
3081
|
-
if (context?.headerController?.
|
|
3082
|
-
context.headerController.
|
|
3083
|
-
|
|
3081
|
+
if (context?.headerController?.updateStats) {
|
|
3082
|
+
context.headerController.updateStats({
|
|
3083
|
+
online: onlineCount,
|
|
3084
3084
|
total,
|
|
3085
|
-
consumption:
|
|
3085
|
+
consumption: totalConsumption,
|
|
3086
3086
|
zeroCount: zeroConsumptionCount
|
|
3087
3087
|
});
|
|
3088
3088
|
}
|
|
@@ -3251,7 +3251,9 @@ function createWidgetController(config) {
|
|
|
3251
3251
|
updateStats(config, visible, context);
|
|
3252
3252
|
await renderList(config, STATE, visible, context);
|
|
3253
3253
|
}
|
|
3254
|
+
let busyModalRef = null;
|
|
3254
3255
|
function registerEventHandlers(busyModal) {
|
|
3256
|
+
busyModalRef = busyModal;
|
|
3255
3257
|
const dataReadyHandler = () => {
|
|
3256
3258
|
const items = getCachedData(config);
|
|
3257
3259
|
if (items && items.length > 0) {
|
|
@@ -3274,7 +3276,7 @@ function createWidgetController(config) {
|
|
|
3274
3276
|
};
|
|
3275
3277
|
const summaryReadyHandler = () => {
|
|
3276
3278
|
const items = getCachedData(config);
|
|
3277
|
-
if (items && items.length > 0
|
|
3279
|
+
if (items && items.length > 0) {
|
|
3278
3280
|
LogHelper2.log(`[${config.widgetName}] Summary ready, loading from cache: ${items.length} items`);
|
|
3279
3281
|
STATE.itemsBase = items;
|
|
3280
3282
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -3290,7 +3292,7 @@ function createWidgetController(config) {
|
|
|
3290
3292
|
const { domain, items } = ev.detail || {};
|
|
3291
3293
|
if (domain !== config.domain) return;
|
|
3292
3294
|
const filteredItems = config.deviceFilter ? items.filter(config.deviceFilter) : items;
|
|
3293
|
-
if (filteredItems && filteredItems.length > 0
|
|
3295
|
+
if (filteredItems && filteredItems.length > 0) {
|
|
3294
3296
|
LogHelper2.log(`[${config.widgetName}] Provide-data event: ${filteredItems.length} items (from ${items?.length || 0})`);
|
|
3295
3297
|
STATE.itemsBase = filteredItems;
|
|
3296
3298
|
STATE.itemsEnriched = filteredItems.map((item) => ({
|
|
@@ -3313,7 +3315,7 @@ function createWidgetController(config) {
|
|
|
3313
3315
|
} else if (config.context === "entrada") {
|
|
3314
3316
|
items = waterClassified.entrada?.items;
|
|
3315
3317
|
}
|
|
3316
|
-
if (items && items.length > 0
|
|
3318
|
+
if (items && items.length > 0) {
|
|
3317
3319
|
LogHelper2.log(`[${config.widgetName}] water-tb-data-ready event: ${items.length} items for context ${config.context}`);
|
|
3318
3320
|
STATE.itemsBase = items;
|
|
3319
3321
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -3403,6 +3405,18 @@ function createWidgetController(config) {
|
|
|
3403
3405
|
}
|
|
3404
3406
|
},
|
|
3405
3407
|
onDataUpdated: function() {
|
|
3408
|
+
const items = getCachedData(config);
|
|
3409
|
+
if (items && items.length > 0) {
|
|
3410
|
+
LogHelper2.log(`[${config.widgetName}] onDataUpdated: refreshing from cache with ${items.length} items`);
|
|
3411
|
+
STATE.itemsBase = items;
|
|
3412
|
+
STATE.itemsEnriched = items.map((item) => ({
|
|
3413
|
+
...item,
|
|
3414
|
+
value: Number(item.value || item.consumption || item.pulses || 0)
|
|
3415
|
+
}));
|
|
3416
|
+
STATE.dataFromMain = true;
|
|
3417
|
+
if (busyModalRef) busyModalRef.hideBusy();
|
|
3418
|
+
reflow();
|
|
3419
|
+
}
|
|
3406
3420
|
},
|
|
3407
3421
|
onDestroy: function() {
|
|
3408
3422
|
LogHelper2.log(`[${config.widgetName}] RFC-0143 Factory Controller - onDestroy`);
|
package/dist/index.js
CHANGED
|
@@ -546,7 +546,7 @@ var init_template_card = __esm({
|
|
|
546
546
|
// package.json
|
|
547
547
|
var package_default = {
|
|
548
548
|
name: "myio-js-library",
|
|
549
|
-
version: "0.1.
|
|
549
|
+
version: "0.1.341",
|
|
550
550
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
551
551
|
license: "MIT",
|
|
552
552
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -2653,11 +2653,11 @@ function updateStats(config, items, context) {
|
|
|
2653
2653
|
}
|
|
2654
2654
|
});
|
|
2655
2655
|
const connectivityPercentage = total > 0 ? (onlineCount / total * 100).toFixed(1) : "0.0";
|
|
2656
|
-
if (context?.headerController?.
|
|
2657
|
-
context.headerController.
|
|
2658
|
-
|
|
2656
|
+
if (context?.headerController?.updateStats) {
|
|
2657
|
+
context.headerController.updateStats({
|
|
2658
|
+
online: onlineCount,
|
|
2659
2659
|
total,
|
|
2660
|
-
consumption:
|
|
2660
|
+
consumption: totalConsumption,
|
|
2661
2661
|
zeroCount: zeroConsumptionCount
|
|
2662
2662
|
});
|
|
2663
2663
|
}
|
|
@@ -2826,7 +2826,9 @@ function createWidgetController(config) {
|
|
|
2826
2826
|
updateStats(config, visible, context);
|
|
2827
2827
|
await renderList(config, STATE, visible, context);
|
|
2828
2828
|
}
|
|
2829
|
+
let busyModalRef = null;
|
|
2829
2830
|
function registerEventHandlers(busyModal) {
|
|
2831
|
+
busyModalRef = busyModal;
|
|
2830
2832
|
const dataReadyHandler = () => {
|
|
2831
2833
|
const items = getCachedData(config);
|
|
2832
2834
|
if (items && items.length > 0) {
|
|
@@ -2849,7 +2851,7 @@ function createWidgetController(config) {
|
|
|
2849
2851
|
};
|
|
2850
2852
|
const summaryReadyHandler = () => {
|
|
2851
2853
|
const items = getCachedData(config);
|
|
2852
|
-
if (items && items.length > 0
|
|
2854
|
+
if (items && items.length > 0) {
|
|
2853
2855
|
LogHelper2.log(`[${config.widgetName}] Summary ready, loading from cache: ${items.length} items`);
|
|
2854
2856
|
STATE.itemsBase = items;
|
|
2855
2857
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -2865,7 +2867,7 @@ function createWidgetController(config) {
|
|
|
2865
2867
|
const { domain, items } = ev.detail || {};
|
|
2866
2868
|
if (domain !== config.domain) return;
|
|
2867
2869
|
const filteredItems = config.deviceFilter ? items.filter(config.deviceFilter) : items;
|
|
2868
|
-
if (filteredItems && filteredItems.length > 0
|
|
2870
|
+
if (filteredItems && filteredItems.length > 0) {
|
|
2869
2871
|
LogHelper2.log(`[${config.widgetName}] Provide-data event: ${filteredItems.length} items (from ${items?.length || 0})`);
|
|
2870
2872
|
STATE.itemsBase = filteredItems;
|
|
2871
2873
|
STATE.itemsEnriched = filteredItems.map((item) => ({
|
|
@@ -2888,7 +2890,7 @@ function createWidgetController(config) {
|
|
|
2888
2890
|
} else if (config.context === "entrada") {
|
|
2889
2891
|
items = waterClassified.entrada?.items;
|
|
2890
2892
|
}
|
|
2891
|
-
if (items && items.length > 0
|
|
2893
|
+
if (items && items.length > 0) {
|
|
2892
2894
|
LogHelper2.log(`[${config.widgetName}] water-tb-data-ready event: ${items.length} items for context ${config.context}`);
|
|
2893
2895
|
STATE.itemsBase = items;
|
|
2894
2896
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -2978,6 +2980,18 @@ function createWidgetController(config) {
|
|
|
2978
2980
|
}
|
|
2979
2981
|
},
|
|
2980
2982
|
onDataUpdated: function() {
|
|
2983
|
+
const items = getCachedData(config);
|
|
2984
|
+
if (items && items.length > 0) {
|
|
2985
|
+
LogHelper2.log(`[${config.widgetName}] onDataUpdated: refreshing from cache with ${items.length} items`);
|
|
2986
|
+
STATE.itemsBase = items;
|
|
2987
|
+
STATE.itemsEnriched = items.map((item) => ({
|
|
2988
|
+
...item,
|
|
2989
|
+
value: Number(item.value || item.consumption || item.pulses || 0)
|
|
2990
|
+
}));
|
|
2991
|
+
STATE.dataFromMain = true;
|
|
2992
|
+
if (busyModalRef) busyModalRef.hideBusy();
|
|
2993
|
+
reflow();
|
|
2994
|
+
}
|
|
2981
2995
|
},
|
|
2982
2996
|
onDestroy: function() {
|
|
2983
2997
|
LogHelper2.log(`[${config.widgetName}] RFC-0143 Factory Controller - onDestroy`);
|
|
@@ -551,7 +551,7 @@
|
|
|
551
551
|
|
|
552
552
|
// package.json
|
|
553
553
|
var package_default = {
|
|
554
|
-
version: "0.1.
|
|
554
|
+
version: "0.1.341"};
|
|
555
555
|
|
|
556
556
|
// src/format/energy.ts
|
|
557
557
|
function formatEnergy(value, unit, decimals = 3) {
|
|
@@ -2599,12 +2599,12 @@
|
|
|
2599
2599
|
zeroConsumptionCount++;
|
|
2600
2600
|
}
|
|
2601
2601
|
});
|
|
2602
|
-
|
|
2603
|
-
if (context?.headerController?.
|
|
2604
|
-
context.headerController.
|
|
2605
|
-
|
|
2602
|
+
total > 0 ? (onlineCount / total * 100).toFixed(1) : "0.0";
|
|
2603
|
+
if (context?.headerController?.updateStats) {
|
|
2604
|
+
context.headerController.updateStats({
|
|
2605
|
+
online: onlineCount,
|
|
2606
2606
|
total,
|
|
2607
|
-
consumption:
|
|
2607
|
+
consumption: totalConsumption,
|
|
2608
2608
|
zeroCount: zeroConsumptionCount
|
|
2609
2609
|
});
|
|
2610
2610
|
}
|
|
@@ -2773,7 +2773,9 @@
|
|
|
2773
2773
|
updateStats(config, visible, context);
|
|
2774
2774
|
await renderList(config, STATE, visible, context);
|
|
2775
2775
|
}
|
|
2776
|
+
let busyModalRef = null;
|
|
2776
2777
|
function registerEventHandlers(busyModal) {
|
|
2778
|
+
busyModalRef = busyModal;
|
|
2777
2779
|
const dataReadyHandler = () => {
|
|
2778
2780
|
const items = getCachedData(config);
|
|
2779
2781
|
if (items && items.length > 0) {
|
|
@@ -2796,7 +2798,7 @@
|
|
|
2796
2798
|
};
|
|
2797
2799
|
const summaryReadyHandler = () => {
|
|
2798
2800
|
const items = getCachedData(config);
|
|
2799
|
-
if (items && items.length > 0
|
|
2801
|
+
if (items && items.length > 0) {
|
|
2800
2802
|
LogHelper2.log(`[${config.widgetName}] Summary ready, loading from cache: ${items.length} items`);
|
|
2801
2803
|
STATE.itemsBase = items;
|
|
2802
2804
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -2812,7 +2814,7 @@
|
|
|
2812
2814
|
const { domain, items } = ev.detail || {};
|
|
2813
2815
|
if (domain !== config.domain) return;
|
|
2814
2816
|
const filteredItems = config.deviceFilter ? items.filter(config.deviceFilter) : items;
|
|
2815
|
-
if (filteredItems && filteredItems.length > 0
|
|
2817
|
+
if (filteredItems && filteredItems.length > 0) {
|
|
2816
2818
|
LogHelper2.log(`[${config.widgetName}] Provide-data event: ${filteredItems.length} items (from ${items?.length || 0})`);
|
|
2817
2819
|
STATE.itemsBase = filteredItems;
|
|
2818
2820
|
STATE.itemsEnriched = filteredItems.map((item) => ({
|
|
@@ -2835,7 +2837,7 @@
|
|
|
2835
2837
|
} else if (config.context === "entrada") {
|
|
2836
2838
|
items = waterClassified.entrada?.items;
|
|
2837
2839
|
}
|
|
2838
|
-
if (items && items.length > 0
|
|
2840
|
+
if (items && items.length > 0) {
|
|
2839
2841
|
LogHelper2.log(`[${config.widgetName}] water-tb-data-ready event: ${items.length} items for context ${config.context}`);
|
|
2840
2842
|
STATE.itemsBase = items;
|
|
2841
2843
|
STATE.itemsEnriched = items.map((item) => ({
|
|
@@ -2925,6 +2927,18 @@
|
|
|
2925
2927
|
}
|
|
2926
2928
|
},
|
|
2927
2929
|
onDataUpdated: function() {
|
|
2930
|
+
const items = getCachedData(config);
|
|
2931
|
+
if (items && items.length > 0) {
|
|
2932
|
+
LogHelper2.log(`[${config.widgetName}] onDataUpdated: refreshing from cache with ${items.length} items`);
|
|
2933
|
+
STATE.itemsBase = items;
|
|
2934
|
+
STATE.itemsEnriched = items.map((item) => ({
|
|
2935
|
+
...item,
|
|
2936
|
+
value: Number(item.value || item.consumption || item.pulses || 0)
|
|
2937
|
+
}));
|
|
2938
|
+
STATE.dataFromMain = true;
|
|
2939
|
+
if (busyModalRef) busyModalRef.hideBusy();
|
|
2940
|
+
reflow();
|
|
2941
|
+
}
|
|
2928
2942
|
},
|
|
2929
2943
|
onDestroy: function() {
|
|
2930
2944
|
LogHelper2.log(`[${config.widgetName}] RFC-0143 Factory Controller - onDestroy`);
|