myio-js-library 0.1.541 → 0.1.543
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/README.md +4 -3
- package/dist/index.cjs +10 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -6
- package/dist/myio-js-library.umd.js +10 -6
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -620,13 +620,14 @@ formatWaterVolumeM3(null); // "-"
|
|
|
620
620
|
|
|
621
621
|
##### `formatTankHeadFromCm(valueCm: number, locale?: string): string`
|
|
622
622
|
|
|
623
|
-
Formats tank head from centimeters to meters of water column (
|
|
623
|
+
Formats tank head from centimeters to meters of water column (M.C.A).
|
|
624
624
|
|
|
625
625
|
```javascript
|
|
626
626
|
import { formatTankHeadFromCm } from 'myio-js-library';
|
|
627
627
|
|
|
628
|
-
formatTankHeadFromCm(178); // "1,78
|
|
629
|
-
formatTankHeadFromCm(250); // "2,50
|
|
628
|
+
formatTankHeadFromCm(178); // "1,78 M.C.A"
|
|
629
|
+
formatTankHeadFromCm(250); // "2,50 M.C.A"
|
|
630
|
+
formatTankHeadFromCm(1220.7); // "12,21 M.C.A"
|
|
630
631
|
formatTankHeadFromCm(null); // "-"
|
|
631
632
|
```
|
|
632
633
|
|
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.
|
|
894
|
+
version: "0.1.543",
|
|
895
895
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
896
896
|
license: "MIT",
|
|
897
897
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -1095,7 +1095,7 @@ function formatTankHeadFromCm(valueCm, locale = "pt-BR") {
|
|
|
1095
1095
|
minimumFractionDigits: 2,
|
|
1096
1096
|
maximumFractionDigits: 2
|
|
1097
1097
|
});
|
|
1098
|
-
return `${formattedValue}
|
|
1098
|
+
return `${formattedValue} M.C.A`;
|
|
1099
1099
|
}
|
|
1100
1100
|
function calcDeltaPercent(prev, current) {
|
|
1101
1101
|
if (prev === null || prev === void 0 || isNaN(prev) || current === null || current === void 0 || isNaN(current)) {
|
|
@@ -18790,7 +18790,14 @@ function renderCardComponentV5({
|
|
|
18790
18790
|
};
|
|
18791
18791
|
const isEnergyDevice2 = (deviceType2) => isEnergyDeviceType(deviceType2);
|
|
18792
18792
|
const isTemperatureDevice2 = (deviceType2) => isTemperatureDeviceType(deviceType2);
|
|
18793
|
+
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
18794
|
+
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
18795
|
+
const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
|
|
18796
|
+
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
18793
18797
|
const formatCardValue = (value, deviceType2) => {
|
|
18798
|
+
if (isTankDevice2) {
|
|
18799
|
+
return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
|
|
18800
|
+
}
|
|
18794
18801
|
const numValue = Number(value) || 0;
|
|
18795
18802
|
const category = getDeviceCategory(deviceType2);
|
|
18796
18803
|
if (isEnergyDevice2(deviceType2)) {
|
|
@@ -19078,11 +19085,8 @@ function renderCardComponentV5({
|
|
|
19078
19085
|
}
|
|
19079
19086
|
return getStaticDeviceImage(nameType);
|
|
19080
19087
|
};
|
|
19081
|
-
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
19082
19088
|
const isTermostatoDevice = deviceType?.toUpperCase() === "TERMOSTATO";
|
|
19083
19089
|
const isEnergyDeviceFlag = isEnergyDevice2(deviceType);
|
|
19084
|
-
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
19085
|
-
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
19086
19090
|
const calculateTempStatus2 = () => {
|
|
19087
19091
|
if (temperatureStatus) return temperatureStatus;
|
|
19088
19092
|
const currentTemp = Number(val) || 0;
|
|
@@ -19161,7 +19165,7 @@ function renderCardComponentV5({
|
|
|
19161
19165
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
19162
19166
|
</div>
|
|
19163
19167
|
</div>
|
|
19164
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
19168
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
19165
19169
|
</div>
|
|
19166
19170
|
</div>
|
|
19167
19171
|
</div>
|
package/dist/index.d.cts
CHANGED
|
@@ -59,10 +59,10 @@ declare function formatWater$1(value: number): string;
|
|
|
59
59
|
*/
|
|
60
60
|
declare function formatWaterVolumeM3(value: number, locale?: string): string;
|
|
61
61
|
/**
|
|
62
|
-
* Formats tank head from centimeters to meters of water column (
|
|
62
|
+
* Formats tank head from centimeters to meters of water column (M.C.A)
|
|
63
63
|
* @param valueCm - The tank head value in centimeters
|
|
64
64
|
* @param locale - The locale to use for formatting (defaults to 'pt-BR')
|
|
65
|
-
* @returns Formatted tank head string in
|
|
65
|
+
* @returns Formatted tank head string in M.C.A unit (e.g. "12,21 M.C.A")
|
|
66
66
|
*/
|
|
67
67
|
declare function formatTankHeadFromCm(valueCm: number, locale?: string): string;
|
|
68
68
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -59,10 +59,10 @@ declare function formatWater$1(value: number): string;
|
|
|
59
59
|
*/
|
|
60
60
|
declare function formatWaterVolumeM3(value: number, locale?: string): string;
|
|
61
61
|
/**
|
|
62
|
-
* Formats tank head from centimeters to meters of water column (
|
|
62
|
+
* Formats tank head from centimeters to meters of water column (M.C.A)
|
|
63
63
|
* @param valueCm - The tank head value in centimeters
|
|
64
64
|
* @param locale - The locale to use for formatting (defaults to 'pt-BR')
|
|
65
|
-
* @returns Formatted tank head string in
|
|
65
|
+
* @returns Formatted tank head string in M.C.A unit (e.g. "12,21 M.C.A")
|
|
66
66
|
*/
|
|
67
67
|
declare function formatTankHeadFromCm(valueCm: number, locale?: string): string;
|
|
68
68
|
/**
|
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.
|
|
13
|
+
version: "0.1.543",
|
|
14
14
|
description: "A clean, standalone JS SDK for MYIO projects",
|
|
15
15
|
license: "MIT",
|
|
16
16
|
repository: "github:gh-myio/myio-js-library",
|
|
@@ -214,7 +214,7 @@ function formatTankHeadFromCm(valueCm, locale = "pt-BR") {
|
|
|
214
214
|
minimumFractionDigits: 2,
|
|
215
215
|
maximumFractionDigits: 2
|
|
216
216
|
});
|
|
217
|
-
return `${formattedValue}
|
|
217
|
+
return `${formattedValue} M.C.A`;
|
|
218
218
|
}
|
|
219
219
|
function calcDeltaPercent(prev, current) {
|
|
220
220
|
if (prev === null || prev === void 0 || isNaN(prev) || current === null || current === void 0 || isNaN(current)) {
|
|
@@ -17184,7 +17184,14 @@ function renderCardComponentV5({
|
|
|
17184
17184
|
};
|
|
17185
17185
|
const isEnergyDevice2 = (deviceType2) => isEnergyDeviceType(deviceType2);
|
|
17186
17186
|
const isTemperatureDevice2 = (deviceType2) => isTemperatureDeviceType(deviceType2);
|
|
17187
|
+
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
17188
|
+
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
17189
|
+
const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
|
|
17190
|
+
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
17187
17191
|
const formatCardValue = (value, deviceType2) => {
|
|
17192
|
+
if (isTankDevice2) {
|
|
17193
|
+
return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
|
|
17194
|
+
}
|
|
17188
17195
|
const numValue = Number(value) || 0;
|
|
17189
17196
|
const category = getDeviceCategory(deviceType2);
|
|
17190
17197
|
if (isEnergyDevice2(deviceType2)) {
|
|
@@ -17472,11 +17479,8 @@ function renderCardComponentV5({
|
|
|
17472
17479
|
}
|
|
17473
17480
|
return getStaticDeviceImage(nameType);
|
|
17474
17481
|
};
|
|
17475
|
-
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
17476
17482
|
const isTermostatoDevice = deviceType?.toUpperCase() === "TERMOSTATO";
|
|
17477
17483
|
const isEnergyDeviceFlag = isEnergyDevice2(deviceType);
|
|
17478
|
-
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
17479
|
-
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
17480
17484
|
const calculateTempStatus2 = () => {
|
|
17481
17485
|
if (temperatureStatus) return temperatureStatus;
|
|
17482
17486
|
const currentTemp = Number(val) || 0;
|
|
@@ -17555,7 +17559,7 @@ function renderCardComponentV5({
|
|
|
17555
17559
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
17556
17560
|
</div>
|
|
17557
17561
|
</div>
|
|
17558
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
17562
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
17559
17563
|
</div>
|
|
17560
17564
|
</div>
|
|
17561
17565
|
</div>
|
|
@@ -5455,7 +5455,7 @@
|
|
|
5455
5455
|
|
|
5456
5456
|
// package.json
|
|
5457
5457
|
var package_default = {
|
|
5458
|
-
version: "0.1.
|
|
5458
|
+
version: "0.1.543"};
|
|
5459
5459
|
|
|
5460
5460
|
// src/utils/format/energy.ts
|
|
5461
5461
|
function formatPower(value, decimals = 2) {
|
|
@@ -5580,7 +5580,7 @@
|
|
|
5580
5580
|
minimumFractionDigits: 2,
|
|
5581
5581
|
maximumFractionDigits: 2
|
|
5582
5582
|
});
|
|
5583
|
-
return `${formattedValue}
|
|
5583
|
+
return `${formattedValue} M.C.A`;
|
|
5584
5584
|
}
|
|
5585
5585
|
function calcDeltaPercent(prev, current) {
|
|
5586
5586
|
if (prev === null || prev === void 0 || isNaN(prev) || current === null || current === void 0 || isNaN(current)) {
|
|
@@ -22521,7 +22521,14 @@
|
|
|
22521
22521
|
};
|
|
22522
22522
|
const isEnergyDevice2 = (deviceType2) => isEnergyDeviceType(deviceType2);
|
|
22523
22523
|
const isTemperatureDevice2 = (deviceType2) => isTemperatureDeviceType(deviceType2);
|
|
22524
|
+
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
22525
|
+
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
22526
|
+
const tankLevelCm = isTankDevice2 ? Number(waterLevel ?? val) : null;
|
|
22527
|
+
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
22524
22528
|
const formatCardValue = (value, deviceType2) => {
|
|
22529
|
+
if (isTankDevice2) {
|
|
22530
|
+
return `${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%`;
|
|
22531
|
+
}
|
|
22525
22532
|
const numValue = Number(value) || 0;
|
|
22526
22533
|
getDeviceCategory(deviceType2);
|
|
22527
22534
|
if (isEnergyDevice2(deviceType2)) {
|
|
@@ -22809,11 +22816,8 @@
|
|
|
22809
22816
|
}
|
|
22810
22817
|
return getStaticDeviceImage(nameType);
|
|
22811
22818
|
};
|
|
22812
|
-
const isTankDevice2 = deviceType === "TANK" || deviceType === "CAIXA_DAGUA";
|
|
22813
22819
|
const isTermostatoDevice = deviceType?.toUpperCase() === "TERMOSTATO";
|
|
22814
22820
|
const isEnergyDeviceFlag = isEnergyDevice2(deviceType);
|
|
22815
|
-
const percentageForDisplay = isTankDevice2 ? (waterPercentage || 0) * 100 : perc;
|
|
22816
|
-
const _pctDecimals = resolvePercentDecimals(percentDecimals);
|
|
22817
22821
|
const calculateTempStatus2 = () => {
|
|
22818
22822
|
if (temperatureStatus) return temperatureStatus;
|
|
22819
22823
|
const currentTemp = Number(val) || 0;
|
|
@@ -22892,7 +22896,7 @@
|
|
|
22892
22896
|
<span class="consumption-value">${formatCardValue(cardEntity.lastValue, deviceType)}</span>
|
|
22893
22897
|
</div>
|
|
22894
22898
|
</div>
|
|
22895
|
-
${!isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
22899
|
+
${isTankDevice2 ? `<span class="device-percentage-badge device-tank-level-badge" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important;">${formatTankHeadFromCm(tankLevelCm)}</span>` : !isTermostatoDevice ? `<span class="device-percentage-badge percentage-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; cursor: help;">${percentageForDisplay.toFixed(_pctDecimals).replace(".", ",")}%</span>` : tempDeviationPercent ? `<span class="device-percentage-badge temp-deviation-badge temp-comparison-tooltip-trigger" style="position: absolute; bottom: 12px; right: 12px; z-index: 20; background: none !important; color: ${tempDeviationPercent.isAbove ? "#ef4444" : tempDeviationPercent.isBelow ? "#3b82f6" : "#6b7280"}; font-weight: 600; cursor: help;">${tempDeviationPercent.sign}${tempDeviationPercent.value.toFixed(1)}%</span>` : ""}
|
|
22896
22900
|
</div>
|
|
22897
22901
|
</div>
|
|
22898
22902
|
</div>
|