100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
introduce "deltaplus" to determine an explicit + in delta
Vincenta91e727e199d
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.tsindex 9a66d3bc7..db3827739 100644--- a/ui/component/or-attribute-card/src/index.ts+++ b/ui/component/or-attribute-card/src/index.ts@@ -116,6 +116,8 @@ export class OrAttributeCard extends LitElement {private mainValueLastPeriod?: number;@property()private delta: {val?: number, unit?: string} = {};+ @property()+ private deltaPlus: string = "";private period: moment.unitOfTime.Base = "month";private now?: Date = new Date();@@ -197,6 +199,7 @@ export class OrAttributeCard extends LitElement {if (changedProperties.has("mainValue") || changedProperties.has("mainValueLastPeriod")) {if (this.mainValueLastPeriod && this.mainValue) {this.delta = this.getFormattedDelta(this.mainValue, this.mainValueLastPeriod);+ this.deltaPlus = (this.delta.val! > 0) ? "+" : "";}}if (changedProperties.has("mainValue")) {@@ -257,7 +260,7 @@ export class OrAttributeCard extends LitElement {<div class="chart-wrapper" style="flex: 1;"><canvas id="chart"></canvas></div>- <span class=${classMap({"delta": true, "delta-min": this.delta.val! < 0, "delta-plus": this.delta.val! > 0})}>${this.delta.val}${this.delta.unit}</span>+ <span class=${classMap({"delta": true, "delta-min": this.delta.val! < 0, "delta-plus": this.delta.val! > 0})}>${this.deltaPlus}${this.delta.val}${this.delta.unit}</span></div></div></div>