myio-js-library 0.1.179 → 0.1.181
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 +950 -12
- package/dist/index.d.cts +2 -1
- package/dist/index.js +950 -12
- package/dist/myio-js-library.umd.js +943 -12
- package/dist/myio-js-library.umd.min.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -566,7 +566,7 @@ var init_template_card = __esm({
|
|
|
566
566
|
});
|
|
567
567
|
|
|
568
568
|
// src/format/energy.ts
|
|
569
|
-
function formatEnergy(value, unit) {
|
|
569
|
+
function formatEnergy(value, unit, decimals = 3) {
|
|
570
570
|
if (value === null || value === void 0 || isNaN(value)) {
|
|
571
571
|
return "-";
|
|
572
572
|
}
|
|
@@ -584,8 +584,8 @@ function formatEnergy(value, unit) {
|
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
const formattedValue = adjustedValue.toLocaleString("pt-BR", {
|
|
587
|
-
minimumFractionDigits:
|
|
588
|
-
maximumFractionDigits:
|
|
587
|
+
minimumFractionDigits: decimals,
|
|
588
|
+
maximumFractionDigits: decimals
|
|
589
589
|
});
|
|
590
590
|
return `${formattedValue} ${adjustedUnit}`;
|
|
591
591
|
}
|
|
@@ -3977,6 +3977,14 @@ var CSS_STRING = `
|
|
|
3977
3977
|
--myio-chip-not-installed-fg: #7c3aed;
|
|
3978
3978
|
--myio-border-not-installed: rgba(124, 58, 237, 0.5);
|
|
3979
3979
|
|
|
3980
|
+
/* Temperature range colors - solid backgrounds for better visibility */
|
|
3981
|
+
--myio-temp-cold-bg: #dbeafe; /* Blue 100 - below ideal range */
|
|
3982
|
+
--myio-temp-cold-border: rgba(59, 130, 246, 0.6);
|
|
3983
|
+
--myio-temp-ok-bg: #dcfce7; /* Green 100 - within ideal range */
|
|
3984
|
+
--myio-temp-ok-border: rgba(34, 197, 94, 0.6);
|
|
3985
|
+
--myio-temp-hot-bg: #fee2e2; /* Red 100 - above ideal range */
|
|
3986
|
+
--myio-temp-hot-border: rgba(239, 68, 68, 0.6);
|
|
3987
|
+
|
|
3980
3988
|
--myio-text-1: #0f172a;
|
|
3981
3989
|
--myio-text-2: #4b5563;
|
|
3982
3990
|
--myio-muted: #94a3b8;
|
|
@@ -4080,6 +4088,25 @@ var CSS_STRING = `
|
|
|
4080
4088
|
box-shadow: 0 0 0 2px var(--myio-border-not-installed), var(--myio-card-shadow);
|
|
4081
4089
|
}
|
|
4082
4090
|
|
|
4091
|
+
/* Temperature range backgrounds (domain=temperature only) */
|
|
4092
|
+
.myio-ho-card.is-temp-cold {
|
|
4093
|
+
background: var(--myio-temp-cold-bg);
|
|
4094
|
+
border-color: var(--myio-temp-cold-border);
|
|
4095
|
+
box-shadow: 0 0 0 2px var(--myio-temp-cold-border), var(--myio-card-shadow);
|
|
4096
|
+
}
|
|
4097
|
+
|
|
4098
|
+
.myio-ho-card.is-temp-ok {
|
|
4099
|
+
background: var(--myio-temp-ok-bg);
|
|
4100
|
+
border-color: var(--myio-temp-ok-border);
|
|
4101
|
+
box-shadow: 0 0 0 2px var(--myio-temp-ok-border), var(--myio-card-shadow);
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
.myio-ho-card.is-temp-hot {
|
|
4105
|
+
background: var(--myio-temp-hot-bg);
|
|
4106
|
+
border-color: var(--myio-temp-hot-border);
|
|
4107
|
+
box-shadow: 0 0 0 2px var(--myio-temp-hot-border), var(--myio-card-shadow);
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4083
4110
|
/* Header section */
|
|
4084
4111
|
.myio-ho-card__header {
|
|
4085
4112
|
display: flex;
|
|
@@ -5003,6 +5030,504 @@ var CSS_STRING = `
|
|
|
5003
5030
|
.debug-tooltip__content::-webkit-scrollbar-thumb:hover {
|
|
5004
5031
|
background: rgba(99, 102, 241, 0.6);
|
|
5005
5032
|
}
|
|
5033
|
+
|
|
5034
|
+
/* ============================================
|
|
5035
|
+
Temperature Range Tooltip (for domain=temperature)
|
|
5036
|
+
Shows temperature ruler with current position and deviation
|
|
5037
|
+
============================================ */
|
|
5038
|
+
.temp-range-tooltip {
|
|
5039
|
+
position: fixed;
|
|
5040
|
+
z-index: 99999;
|
|
5041
|
+
pointer-events: none;
|
|
5042
|
+
opacity: 0;
|
|
5043
|
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
5044
|
+
transform: translateY(5px);
|
|
5045
|
+
}
|
|
5046
|
+
|
|
5047
|
+
.temp-range-tooltip.visible {
|
|
5048
|
+
opacity: 1;
|
|
5049
|
+
pointer-events: auto;
|
|
5050
|
+
transform: translateY(0);
|
|
5051
|
+
}
|
|
5052
|
+
|
|
5053
|
+
.temp-range-tooltip__content {
|
|
5054
|
+
background: #ffffff;
|
|
5055
|
+
border: 1px solid #e2e8f0;
|
|
5056
|
+
border-radius: 12px;
|
|
5057
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
|
|
5058
|
+
min-width: 280px;
|
|
5059
|
+
max-width: 320px;
|
|
5060
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
5061
|
+
font-size: 12px;
|
|
5062
|
+
color: #1e293b;
|
|
5063
|
+
overflow: hidden;
|
|
5064
|
+
}
|
|
5065
|
+
|
|
5066
|
+
.temp-range-tooltip__header {
|
|
5067
|
+
display: flex;
|
|
5068
|
+
align-items: center;
|
|
5069
|
+
gap: 8px;
|
|
5070
|
+
padding: 12px 16px;
|
|
5071
|
+
background: linear-gradient(90deg, #fff7ed 0%, #fed7aa 100%);
|
|
5072
|
+
border-bottom: 1px solid #fdba74;
|
|
5073
|
+
}
|
|
5074
|
+
|
|
5075
|
+
.temp-range-tooltip__icon {
|
|
5076
|
+
font-size: 18px;
|
|
5077
|
+
}
|
|
5078
|
+
|
|
5079
|
+
.temp-range-tooltip__title {
|
|
5080
|
+
font-weight: 700;
|
|
5081
|
+
font-size: 13px;
|
|
5082
|
+
color: #c2410c;
|
|
5083
|
+
}
|
|
5084
|
+
|
|
5085
|
+
.temp-range-tooltip__body {
|
|
5086
|
+
padding: 16px;
|
|
5087
|
+
}
|
|
5088
|
+
|
|
5089
|
+
/* Temperature value display */
|
|
5090
|
+
.temp-range-tooltip__value-row {
|
|
5091
|
+
display: flex;
|
|
5092
|
+
justify-content: space-between;
|
|
5093
|
+
align-items: center;
|
|
5094
|
+
margin-bottom: 16px;
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
.temp-range-tooltip__current {
|
|
5098
|
+
font-size: 28px;
|
|
5099
|
+
font-weight: 700;
|
|
5100
|
+
color: #1e293b;
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
.temp-range-tooltip__current sup {
|
|
5104
|
+
font-size: 14px;
|
|
5105
|
+
color: #64748b;
|
|
5106
|
+
}
|
|
5107
|
+
|
|
5108
|
+
.temp-range-tooltip__deviation {
|
|
5109
|
+
text-align: right;
|
|
5110
|
+
}
|
|
5111
|
+
|
|
5112
|
+
.temp-range-tooltip__deviation-value {
|
|
5113
|
+
font-size: 16px;
|
|
5114
|
+
font-weight: 700;
|
|
5115
|
+
}
|
|
5116
|
+
|
|
5117
|
+
.temp-range-tooltip__deviation-value.cold {
|
|
5118
|
+
color: #2563eb;
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
.temp-range-tooltip__deviation-value.ok {
|
|
5122
|
+
color: #16a34a;
|
|
5123
|
+
}
|
|
5124
|
+
|
|
5125
|
+
.temp-range-tooltip__deviation-value.hot {
|
|
5126
|
+
color: #dc2626;
|
|
5127
|
+
}
|
|
5128
|
+
|
|
5129
|
+
.temp-range-tooltip__deviation-label {
|
|
5130
|
+
font-size: 10px;
|
|
5131
|
+
color: #64748b;
|
|
5132
|
+
text-transform: uppercase;
|
|
5133
|
+
letter-spacing: 0.5px;
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5136
|
+
/* Temperature ruler/gauge */
|
|
5137
|
+
.temp-range-tooltip__ruler {
|
|
5138
|
+
position: relative;
|
|
5139
|
+
height: 32px;
|
|
5140
|
+
margin: 12px 0;
|
|
5141
|
+
border-radius: 8px;
|
|
5142
|
+
overflow: visible;
|
|
5143
|
+
}
|
|
5144
|
+
|
|
5145
|
+
.temp-range-tooltip__ruler-track {
|
|
5146
|
+
position: absolute;
|
|
5147
|
+
top: 12px;
|
|
5148
|
+
left: 0;
|
|
5149
|
+
right: 0;
|
|
5150
|
+
height: 8px;
|
|
5151
|
+
background: linear-gradient(90deg, #dbeafe 0%, #dcfce7 50%, #fee2e2 100%);
|
|
5152
|
+
border-radius: 4px;
|
|
5153
|
+
border: 1px solid #e2e8f0;
|
|
5154
|
+
}
|
|
5155
|
+
|
|
5156
|
+
.temp-range-tooltip__ruler-range {
|
|
5157
|
+
position: absolute;
|
|
5158
|
+
top: 12px;
|
|
5159
|
+
height: 8px;
|
|
5160
|
+
background: #22c55e;
|
|
5161
|
+
border-radius: 4px;
|
|
5162
|
+
opacity: 0.6;
|
|
5163
|
+
}
|
|
5164
|
+
|
|
5165
|
+
.temp-range-tooltip__ruler-marker {
|
|
5166
|
+
position: absolute;
|
|
5167
|
+
top: 4px;
|
|
5168
|
+
width: 4px;
|
|
5169
|
+
height: 24px;
|
|
5170
|
+
background: #1e293b;
|
|
5171
|
+
border-radius: 2px;
|
|
5172
|
+
transform: translateX(-50%);
|
|
5173
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
.temp-range-tooltip__ruler-marker::after {
|
|
5177
|
+
content: '';
|
|
5178
|
+
position: absolute;
|
|
5179
|
+
top: -4px;
|
|
5180
|
+
left: 50%;
|
|
5181
|
+
transform: translateX(-50%);
|
|
5182
|
+
width: 12px;
|
|
5183
|
+
height: 12px;
|
|
5184
|
+
background: #1e293b;
|
|
5185
|
+
border-radius: 50%;
|
|
5186
|
+
border: 2px solid #fff;
|
|
5187
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5188
|
+
}
|
|
5189
|
+
|
|
5190
|
+
.temp-range-tooltip__ruler-labels {
|
|
5191
|
+
display: flex;
|
|
5192
|
+
justify-content: space-between;
|
|
5193
|
+
margin-top: 8px;
|
|
5194
|
+
font-size: 10px;
|
|
5195
|
+
color: #64748b;
|
|
5196
|
+
}
|
|
5197
|
+
|
|
5198
|
+
.temp-range-tooltip__ruler-min,
|
|
5199
|
+
.temp-range-tooltip__ruler-max {
|
|
5200
|
+
font-weight: 600;
|
|
5201
|
+
}
|
|
5202
|
+
|
|
5203
|
+
/* Range info */
|
|
5204
|
+
.temp-range-tooltip__range-info {
|
|
5205
|
+
display: flex;
|
|
5206
|
+
justify-content: space-between;
|
|
5207
|
+
padding: 10px 12px;
|
|
5208
|
+
background: #f8fafc;
|
|
5209
|
+
border-radius: 8px;
|
|
5210
|
+
margin-top: 12px;
|
|
5211
|
+
}
|
|
5212
|
+
|
|
5213
|
+
.temp-range-tooltip__range-item {
|
|
5214
|
+
text-align: center;
|
|
5215
|
+
}
|
|
5216
|
+
|
|
5217
|
+
.temp-range-tooltip__range-label {
|
|
5218
|
+
font-size: 10px;
|
|
5219
|
+
color: #64748b;
|
|
5220
|
+
text-transform: uppercase;
|
|
5221
|
+
letter-spacing: 0.3px;
|
|
5222
|
+
margin-bottom: 2px;
|
|
5223
|
+
}
|
|
5224
|
+
|
|
5225
|
+
.temp-range-tooltip__range-value {
|
|
5226
|
+
font-size: 14px;
|
|
5227
|
+
font-weight: 600;
|
|
5228
|
+
color: #334155;
|
|
5229
|
+
}
|
|
5230
|
+
|
|
5231
|
+
/* Status badge */
|
|
5232
|
+
.temp-range-tooltip__status {
|
|
5233
|
+
display: flex;
|
|
5234
|
+
align-items: center;
|
|
5235
|
+
justify-content: center;
|
|
5236
|
+
gap: 6px;
|
|
5237
|
+
margin-top: 12px;
|
|
5238
|
+
padding: 8px 12px;
|
|
5239
|
+
border-radius: 6px;
|
|
5240
|
+
font-size: 11px;
|
|
5241
|
+
font-weight: 600;
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5244
|
+
.temp-range-tooltip__status.cold {
|
|
5245
|
+
background: #dbeafe;
|
|
5246
|
+
color: #1d4ed8;
|
|
5247
|
+
border: 1px solid #93c5fd;
|
|
5248
|
+
}
|
|
5249
|
+
|
|
5250
|
+
.temp-range-tooltip__status.ok {
|
|
5251
|
+
background: #dcfce7;
|
|
5252
|
+
color: #15803d;
|
|
5253
|
+
border: 1px solid #86efac;
|
|
5254
|
+
}
|
|
5255
|
+
|
|
5256
|
+
.temp-range-tooltip__status.hot {
|
|
5257
|
+
background: #fee2e2;
|
|
5258
|
+
color: #b91c1c;
|
|
5259
|
+
border: 1px solid #fca5a5;
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5262
|
+
.temp-range-tooltip__status.unknown {
|
|
5263
|
+
background: #f3f4f6;
|
|
5264
|
+
color: #6b7280;
|
|
5265
|
+
border: 1px solid #d1d5db;
|
|
5266
|
+
}
|
|
5267
|
+
|
|
5268
|
+
/* ============================================
|
|
5269
|
+
Energy Range Tooltip (for domain=energy)
|
|
5270
|
+
Shows power ruler with current position and status ranges
|
|
5271
|
+
============================================ */
|
|
5272
|
+
.energy-range-tooltip {
|
|
5273
|
+
position: fixed;
|
|
5274
|
+
z-index: 99999;
|
|
5275
|
+
pointer-events: none;
|
|
5276
|
+
opacity: 0;
|
|
5277
|
+
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
5278
|
+
transform: translateY(5px);
|
|
5279
|
+
}
|
|
5280
|
+
|
|
5281
|
+
.energy-range-tooltip.visible {
|
|
5282
|
+
opacity: 1;
|
|
5283
|
+
pointer-events: auto;
|
|
5284
|
+
transform: translateY(0);
|
|
5285
|
+
}
|
|
5286
|
+
|
|
5287
|
+
.energy-range-tooltip__content {
|
|
5288
|
+
background: #ffffff;
|
|
5289
|
+
border: 1px solid #e2e8f0;
|
|
5290
|
+
border-radius: 12px;
|
|
5291
|
+
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 2px 10px rgba(0, 0, 0, 0.08);
|
|
5292
|
+
min-width: 300px;
|
|
5293
|
+
max-width: 360px;
|
|
5294
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
5295
|
+
font-size: 12px;
|
|
5296
|
+
color: #1e293b;
|
|
5297
|
+
overflow: hidden;
|
|
5298
|
+
}
|
|
5299
|
+
|
|
5300
|
+
.energy-range-tooltip__header {
|
|
5301
|
+
display: flex;
|
|
5302
|
+
align-items: center;
|
|
5303
|
+
gap: 8px;
|
|
5304
|
+
padding: 12px 16px;
|
|
5305
|
+
background: linear-gradient(90deg, #ecfdf5 0%, #d1fae5 100%);
|
|
5306
|
+
border-bottom: 1px solid #6ee7b7;
|
|
5307
|
+
}
|
|
5308
|
+
|
|
5309
|
+
.energy-range-tooltip__icon {
|
|
5310
|
+
font-size: 18px;
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
.energy-range-tooltip__title {
|
|
5314
|
+
font-weight: 700;
|
|
5315
|
+
font-size: 13px;
|
|
5316
|
+
color: #047857;
|
|
5317
|
+
}
|
|
5318
|
+
|
|
5319
|
+
.energy-range-tooltip__body {
|
|
5320
|
+
padding: 16px;
|
|
5321
|
+
}
|
|
5322
|
+
|
|
5323
|
+
/* Power value display */
|
|
5324
|
+
.energy-range-tooltip__value-row {
|
|
5325
|
+
display: flex;
|
|
5326
|
+
justify-content: space-between;
|
|
5327
|
+
align-items: center;
|
|
5328
|
+
margin-bottom: 16px;
|
|
5329
|
+
}
|
|
5330
|
+
|
|
5331
|
+
.energy-range-tooltip__current {
|
|
5332
|
+
font-size: 28px;
|
|
5333
|
+
font-weight: 700;
|
|
5334
|
+
color: #1e293b;
|
|
5335
|
+
}
|
|
5336
|
+
|
|
5337
|
+
.energy-range-tooltip__current sup {
|
|
5338
|
+
font-size: 14px;
|
|
5339
|
+
color: #64748b;
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5342
|
+
.energy-range-tooltip__status-badge {
|
|
5343
|
+
text-align: right;
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
.energy-range-tooltip__status-value {
|
|
5347
|
+
font-size: 14px;
|
|
5348
|
+
font-weight: 700;
|
|
5349
|
+
padding: 4px 10px;
|
|
5350
|
+
border-radius: 6px;
|
|
5351
|
+
}
|
|
5352
|
+
|
|
5353
|
+
.energy-range-tooltip__status-value.standby {
|
|
5354
|
+
background: #dbeafe;
|
|
5355
|
+
color: #1d4ed8;
|
|
5356
|
+
}
|
|
5357
|
+
|
|
5358
|
+
.energy-range-tooltip__status-value.normal {
|
|
5359
|
+
background: #dcfce7;
|
|
5360
|
+
color: #15803d;
|
|
5361
|
+
}
|
|
5362
|
+
|
|
5363
|
+
.energy-range-tooltip__status-value.alert {
|
|
5364
|
+
background: #fef3c7;
|
|
5365
|
+
color: #b45309;
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5368
|
+
.energy-range-tooltip__status-value.failure {
|
|
5369
|
+
background: #fee2e2;
|
|
5370
|
+
color: #b91c1c;
|
|
5371
|
+
}
|
|
5372
|
+
|
|
5373
|
+
.energy-range-tooltip__status-value.offline {
|
|
5374
|
+
background: #f3f4f6;
|
|
5375
|
+
color: #6b7280;
|
|
5376
|
+
}
|
|
5377
|
+
|
|
5378
|
+
/* Power ruler/gauge */
|
|
5379
|
+
.energy-range-tooltip__ruler {
|
|
5380
|
+
position: relative;
|
|
5381
|
+
height: 40px;
|
|
5382
|
+
margin: 12px 0;
|
|
5383
|
+
border-radius: 8px;
|
|
5384
|
+
overflow: visible;
|
|
5385
|
+
}
|
|
5386
|
+
|
|
5387
|
+
.energy-range-tooltip__ruler-track {
|
|
5388
|
+
position: absolute;
|
|
5389
|
+
top: 16px;
|
|
5390
|
+
left: 0;
|
|
5391
|
+
right: 0;
|
|
5392
|
+
height: 8px;
|
|
5393
|
+
display: flex;
|
|
5394
|
+
border-radius: 4px;
|
|
5395
|
+
overflow: hidden;
|
|
5396
|
+
border: 1px solid #e2e8f0;
|
|
5397
|
+
}
|
|
5398
|
+
|
|
5399
|
+
.energy-range-tooltip__ruler-segment {
|
|
5400
|
+
height: 100%;
|
|
5401
|
+
}
|
|
5402
|
+
|
|
5403
|
+
.energy-range-tooltip__ruler-segment.standby {
|
|
5404
|
+
background: #dbeafe;
|
|
5405
|
+
}
|
|
5406
|
+
|
|
5407
|
+
.energy-range-tooltip__ruler-segment.normal {
|
|
5408
|
+
background: #dcfce7;
|
|
5409
|
+
}
|
|
5410
|
+
|
|
5411
|
+
.energy-range-tooltip__ruler-segment.alert {
|
|
5412
|
+
background: #fef3c7;
|
|
5413
|
+
}
|
|
5414
|
+
|
|
5415
|
+
.energy-range-tooltip__ruler-segment.failure {
|
|
5416
|
+
background: #fee2e2;
|
|
5417
|
+
}
|
|
5418
|
+
|
|
5419
|
+
.energy-range-tooltip__ruler-marker {
|
|
5420
|
+
position: absolute;
|
|
5421
|
+
top: 8px;
|
|
5422
|
+
width: 4px;
|
|
5423
|
+
height: 24px;
|
|
5424
|
+
background: #1e293b;
|
|
5425
|
+
border-radius: 2px;
|
|
5426
|
+
transform: translateX(-50%);
|
|
5427
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5428
|
+
}
|
|
5429
|
+
|
|
5430
|
+
.energy-range-tooltip__ruler-marker::after {
|
|
5431
|
+
content: '';
|
|
5432
|
+
position: absolute;
|
|
5433
|
+
top: -4px;
|
|
5434
|
+
left: 50%;
|
|
5435
|
+
transform: translateX(-50%);
|
|
5436
|
+
width: 12px;
|
|
5437
|
+
height: 12px;
|
|
5438
|
+
background: #1e293b;
|
|
5439
|
+
border-radius: 50%;
|
|
5440
|
+
border: 2px solid #fff;
|
|
5441
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
5442
|
+
}
|
|
5443
|
+
|
|
5444
|
+
/* Range info grid */
|
|
5445
|
+
.energy-range-tooltip__ranges {
|
|
5446
|
+
display: grid;
|
|
5447
|
+
grid-template-columns: repeat(4, 1fr);
|
|
5448
|
+
gap: 8px;
|
|
5449
|
+
margin-top: 16px;
|
|
5450
|
+
}
|
|
5451
|
+
|
|
5452
|
+
.energy-range-tooltip__range-item {
|
|
5453
|
+
text-align: center;
|
|
5454
|
+
padding: 8px 4px;
|
|
5455
|
+
border-radius: 6px;
|
|
5456
|
+
background: #f8fafc;
|
|
5457
|
+
}
|
|
5458
|
+
|
|
5459
|
+
.energy-range-tooltip__range-item.standby {
|
|
5460
|
+
border-left: 3px solid #3b82f6;
|
|
5461
|
+
}
|
|
5462
|
+
|
|
5463
|
+
.energy-range-tooltip__range-item.normal {
|
|
5464
|
+
border-left: 3px solid #22c55e;
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5467
|
+
.energy-range-tooltip__range-item.alert {
|
|
5468
|
+
border-left: 3px solid #f59e0b;
|
|
5469
|
+
}
|
|
5470
|
+
|
|
5471
|
+
.energy-range-tooltip__range-item.failure {
|
|
5472
|
+
border-left: 3px solid #ef4444;
|
|
5473
|
+
}
|
|
5474
|
+
|
|
5475
|
+
.energy-range-tooltip__range-label {
|
|
5476
|
+
font-size: 9px;
|
|
5477
|
+
color: #64748b;
|
|
5478
|
+
text-transform: uppercase;
|
|
5479
|
+
letter-spacing: 0.3px;
|
|
5480
|
+
margin-bottom: 2px;
|
|
5481
|
+
}
|
|
5482
|
+
|
|
5483
|
+
.energy-range-tooltip__range-value {
|
|
5484
|
+
font-size: 11px;
|
|
5485
|
+
font-weight: 600;
|
|
5486
|
+
color: #334155;
|
|
5487
|
+
}
|
|
5488
|
+
|
|
5489
|
+
/* Status info */
|
|
5490
|
+
.energy-range-tooltip__status-info {
|
|
5491
|
+
display: flex;
|
|
5492
|
+
align-items: center;
|
|
5493
|
+
justify-content: center;
|
|
5494
|
+
gap: 6px;
|
|
5495
|
+
margin-top: 12px;
|
|
5496
|
+
padding: 8px 12px;
|
|
5497
|
+
border-radius: 6px;
|
|
5498
|
+
font-size: 11px;
|
|
5499
|
+
font-weight: 600;
|
|
5500
|
+
}
|
|
5501
|
+
|
|
5502
|
+
.energy-range-tooltip__status-info.standby {
|
|
5503
|
+
background: #dbeafe;
|
|
5504
|
+
color: #1d4ed8;
|
|
5505
|
+
border: 1px solid #93c5fd;
|
|
5506
|
+
}
|
|
5507
|
+
|
|
5508
|
+
.energy-range-tooltip__status-info.normal {
|
|
5509
|
+
background: #dcfce7;
|
|
5510
|
+
color: #15803d;
|
|
5511
|
+
border: 1px solid #86efac;
|
|
5512
|
+
}
|
|
5513
|
+
|
|
5514
|
+
.energy-range-tooltip__status-info.alert {
|
|
5515
|
+
background: #fef3c7;
|
|
5516
|
+
color: #b45309;
|
|
5517
|
+
border: 1px solid #fcd34d;
|
|
5518
|
+
}
|
|
5519
|
+
|
|
5520
|
+
.energy-range-tooltip__status-info.failure {
|
|
5521
|
+
background: #fee2e2;
|
|
5522
|
+
color: #b91c1c;
|
|
5523
|
+
border: 1px solid #fca5a5;
|
|
5524
|
+
}
|
|
5525
|
+
|
|
5526
|
+
.energy-range-tooltip__status-info.offline {
|
|
5527
|
+
background: #f3f4f6;
|
|
5528
|
+
color: #6b7280;
|
|
5529
|
+
border: 1px solid #d1d5db;
|
|
5530
|
+
}
|
|
5006
5531
|
`;
|
|
5007
5532
|
|
|
5008
5533
|
// src/thingsboard/main-dashboard-shopping/v-4.0.0/head-office/card-head-office.icons.ts
|
|
@@ -5562,6 +6087,380 @@ function getCardStateClass(deviceStatus) {
|
|
|
5562
6087
|
return "";
|
|
5563
6088
|
}
|
|
5564
6089
|
}
|
|
6090
|
+
function getTempRangeClass(entityObject) {
|
|
6091
|
+
if (entityObject.domain !== "temperature") return "";
|
|
6092
|
+
const currentTemp = Number(entityObject.val ?? entityObject.currentTemperature ?? entityObject.temperature) || 0;
|
|
6093
|
+
const tempMin = entityObject.temperatureMin ?? entityObject.minTemperature;
|
|
6094
|
+
const tempMax = entityObject.temperatureMax ?? entityObject.maxTemperature;
|
|
6095
|
+
if (tempMin === void 0 || tempMax === void 0 || tempMin === null || tempMax === null) {
|
|
6096
|
+
return "";
|
|
6097
|
+
}
|
|
6098
|
+
if (currentTemp > tempMax) return "is-temp-hot";
|
|
6099
|
+
if (currentTemp < tempMin) return "is-temp-cold";
|
|
6100
|
+
return "is-temp-ok";
|
|
6101
|
+
}
|
|
6102
|
+
var TempRangeTooltip = {
|
|
6103
|
+
containerId: "myio-temp-range-tooltip",
|
|
6104
|
+
/**
|
|
6105
|
+
* Create or get the tooltip container
|
|
6106
|
+
*/
|
|
6107
|
+
getContainer() {
|
|
6108
|
+
let container = document.getElementById(this.containerId);
|
|
6109
|
+
if (!container) {
|
|
6110
|
+
container = document.createElement("div");
|
|
6111
|
+
container.id = this.containerId;
|
|
6112
|
+
container.className = "temp-range-tooltip";
|
|
6113
|
+
document.body.appendChild(container);
|
|
6114
|
+
}
|
|
6115
|
+
return container;
|
|
6116
|
+
},
|
|
6117
|
+
/**
|
|
6118
|
+
* Calculate temperature status and deviation
|
|
6119
|
+
*/
|
|
6120
|
+
calculateStatus(currentTemp, tempMin, tempMax) {
|
|
6121
|
+
if (tempMin == null || tempMax == null) {
|
|
6122
|
+
return { status: "unknown", deviation: null, deviationPercent: null };
|
|
6123
|
+
}
|
|
6124
|
+
const rangeSize = tempMax - tempMin;
|
|
6125
|
+
const midPoint = (tempMin + tempMax) / 2;
|
|
6126
|
+
if (currentTemp < tempMin) {
|
|
6127
|
+
const deviation = tempMin - currentTemp;
|
|
6128
|
+
const deviationPercent = rangeSize > 0 ? deviation / rangeSize * 100 : 0;
|
|
6129
|
+
return { status: "cold", deviation: -deviation, deviationPercent: -deviationPercent };
|
|
6130
|
+
} else if (currentTemp > tempMax) {
|
|
6131
|
+
const deviation = currentTemp - tempMax;
|
|
6132
|
+
const deviationPercent = rangeSize > 0 ? deviation / rangeSize * 100 : 0;
|
|
6133
|
+
return { status: "hot", deviation, deviationPercent };
|
|
6134
|
+
} else {
|
|
6135
|
+
const deviationFromMid = currentTemp - midPoint;
|
|
6136
|
+
const halfRange = rangeSize / 2;
|
|
6137
|
+
const deviationPercent = halfRange > 0 ? deviationFromMid / halfRange * 100 : 0;
|
|
6138
|
+
return { status: "ok", deviation: deviationFromMid, deviationPercent: 0 };
|
|
6139
|
+
}
|
|
6140
|
+
},
|
|
6141
|
+
/**
|
|
6142
|
+
* Calculate marker position on ruler (0-100%)
|
|
6143
|
+
*/
|
|
6144
|
+
calculateMarkerPosition(currentTemp, tempMin, tempMax) {
|
|
6145
|
+
if (tempMin == null || tempMax == null) return 50;
|
|
6146
|
+
const rangeSize = tempMax - tempMin;
|
|
6147
|
+
const extension = rangeSize * 0.3;
|
|
6148
|
+
const visibleMin = tempMin - extension;
|
|
6149
|
+
const visibleMax = tempMax + extension;
|
|
6150
|
+
const visibleRange = visibleMax - visibleMin;
|
|
6151
|
+
const clampedTemp = Math.max(visibleMin, Math.min(visibleMax, currentTemp));
|
|
6152
|
+
const position = (clampedTemp - visibleMin) / visibleRange * 100;
|
|
6153
|
+
return Math.max(2, Math.min(98, position));
|
|
6154
|
+
},
|
|
6155
|
+
/**
|
|
6156
|
+
* Show tooltip for a temperature card
|
|
6157
|
+
* @param {HTMLElement} triggerElement - The card element
|
|
6158
|
+
* @param {Object} entityObject - Entity data
|
|
6159
|
+
* @param {MouseEvent} event - Mouse event for cursor position
|
|
6160
|
+
*/
|
|
6161
|
+
show(triggerElement, entityObject, event) {
|
|
6162
|
+
const container = this.getContainer();
|
|
6163
|
+
const currentTemp = Number(entityObject.val ?? entityObject.currentTemperature ?? entityObject.temperature) || 0;
|
|
6164
|
+
const tempMin = entityObject.temperatureMin ?? entityObject.minTemperature;
|
|
6165
|
+
const tempMax = entityObject.temperatureMax ?? entityObject.maxTemperature;
|
|
6166
|
+
const hasRange = tempMin != null && tempMax != null;
|
|
6167
|
+
const { status, deviation, deviationPercent } = this.calculateStatus(currentTemp, tempMin, tempMax);
|
|
6168
|
+
const markerPos = this.calculateMarkerPosition(currentTemp, tempMin, tempMax);
|
|
6169
|
+
let rangeLeft = 0, rangeWidth = 100;
|
|
6170
|
+
if (hasRange) {
|
|
6171
|
+
const rangeSize = tempMax - tempMin;
|
|
6172
|
+
const extension = rangeSize * 0.3;
|
|
6173
|
+
const visibleMin = tempMin - extension;
|
|
6174
|
+
const visibleMax = tempMax + extension;
|
|
6175
|
+
const visibleRange = visibleMax - visibleMin;
|
|
6176
|
+
rangeLeft = (tempMin - visibleMin) / visibleRange * 100;
|
|
6177
|
+
rangeWidth = rangeSize / visibleRange * 100;
|
|
6178
|
+
}
|
|
6179
|
+
let deviationText = "";
|
|
6180
|
+
let deviationClass = status;
|
|
6181
|
+
if (status === "cold") {
|
|
6182
|
+
deviationText = `${Math.abs(deviation).toFixed(1)}\xB0C abaixo`;
|
|
6183
|
+
} else if (status === "hot") {
|
|
6184
|
+
deviationText = `+${deviation.toFixed(1)}\xB0C acima`;
|
|
6185
|
+
} else if (status === "ok") {
|
|
6186
|
+
deviationText = "Na faixa ideal";
|
|
6187
|
+
} else {
|
|
6188
|
+
deviationText = "Faixa n\xE3o configurada";
|
|
6189
|
+
}
|
|
6190
|
+
const statusLabels = {
|
|
6191
|
+
cold: "\u2744\uFE0F Abaixo da Faixa Ideal",
|
|
6192
|
+
ok: "\u2714\uFE0F Dentro da Faixa Ideal",
|
|
6193
|
+
hot: "\u{1F525} Acima da Faixa Ideal",
|
|
6194
|
+
unknown: "\u2753 Faixa N\xE3o Configurada"
|
|
6195
|
+
};
|
|
6196
|
+
container.innerHTML = `
|
|
6197
|
+
<div class="temp-range-tooltip__content">
|
|
6198
|
+
<div class="temp-range-tooltip__header">
|
|
6199
|
+
<span class="temp-range-tooltip__icon">\u{1F321}\uFE0F</span>
|
|
6200
|
+
<span class="temp-range-tooltip__title">${entityObject.labelOrName || entityObject.name || "Sensor"}</span>
|
|
6201
|
+
</div>
|
|
6202
|
+
<div class="temp-range-tooltip__body">
|
|
6203
|
+
<div class="temp-range-tooltip__value-row">
|
|
6204
|
+
<div class="temp-range-tooltip__current">
|
|
6205
|
+
${currentTemp.toFixed(1)}<sup>\xB0C</sup>
|
|
6206
|
+
</div>
|
|
6207
|
+
<div class="temp-range-tooltip__deviation">
|
|
6208
|
+
<div class="temp-range-tooltip__deviation-value ${deviationClass}">
|
|
6209
|
+
${status === "ok" ? "\u2713" : status === "cold" ? "\u2193" : status === "hot" ? "\u2191" : "?"} ${Math.abs(deviationPercent || 0).toFixed(0)}%
|
|
6210
|
+
</div>
|
|
6211
|
+
<div class="temp-range-tooltip__deviation-label">Desvio</div>
|
|
6212
|
+
</div>
|
|
6213
|
+
</div>
|
|
6214
|
+
|
|
6215
|
+
${hasRange ? `
|
|
6216
|
+
<div class="temp-range-tooltip__ruler">
|
|
6217
|
+
<div class="temp-range-tooltip__ruler-track"></div>
|
|
6218
|
+
<div class="temp-range-tooltip__ruler-range" style="left: ${rangeLeft}%; width: ${rangeWidth}%;"></div>
|
|
6219
|
+
<div class="temp-range-tooltip__ruler-marker" style="left: ${markerPos}%;"></div>
|
|
6220
|
+
</div>
|
|
6221
|
+
<div class="temp-range-tooltip__ruler-labels">
|
|
6222
|
+
<span class="temp-range-tooltip__ruler-min">${tempMin}\xB0C</span>
|
|
6223
|
+
<span style="color: #22c55e; font-weight: 600;">Faixa Ideal</span>
|
|
6224
|
+
<span class="temp-range-tooltip__ruler-max">${tempMax}\xB0C</span>
|
|
6225
|
+
</div>
|
|
6226
|
+
` : ""}
|
|
6227
|
+
|
|
6228
|
+
<div class="temp-range-tooltip__range-info">
|
|
6229
|
+
<div class="temp-range-tooltip__range-item">
|
|
6230
|
+
<div class="temp-range-tooltip__range-label">M\xEDnimo</div>
|
|
6231
|
+
<div class="temp-range-tooltip__range-value">${hasRange ? tempMin + "\xB0C" : "--"}</div>
|
|
6232
|
+
</div>
|
|
6233
|
+
<div class="temp-range-tooltip__range-item">
|
|
6234
|
+
<div class="temp-range-tooltip__range-label">Atual</div>
|
|
6235
|
+
<div class="temp-range-tooltip__range-value" style="color: ${status === "ok" ? "#16a34a" : status === "cold" ? "#2563eb" : "#dc2626"}">${currentTemp.toFixed(1)}\xB0C</div>
|
|
6236
|
+
</div>
|
|
6237
|
+
<div class="temp-range-tooltip__range-item">
|
|
6238
|
+
<div class="temp-range-tooltip__range-label">M\xE1ximo</div>
|
|
6239
|
+
<div class="temp-range-tooltip__range-value">${hasRange ? tempMax + "\xB0C" : "--"}</div>
|
|
6240
|
+
</div>
|
|
6241
|
+
</div>
|
|
6242
|
+
|
|
6243
|
+
<div class="temp-range-tooltip__status ${status}">
|
|
6244
|
+
${statusLabels[status]}
|
|
6245
|
+
</div>
|
|
6246
|
+
</div>
|
|
6247
|
+
</div>
|
|
6248
|
+
`;
|
|
6249
|
+
let left, top;
|
|
6250
|
+
if (event && event.clientX && event.clientY) {
|
|
6251
|
+
left = event.clientX + 15;
|
|
6252
|
+
top = event.clientY + 15;
|
|
6253
|
+
} else {
|
|
6254
|
+
const rect = triggerElement.getBoundingClientRect();
|
|
6255
|
+
left = rect.left + rect.width / 2 - 150;
|
|
6256
|
+
top = rect.bottom + 8;
|
|
6257
|
+
}
|
|
6258
|
+
const tooltipWidth = 300;
|
|
6259
|
+
const tooltipHeight = 350;
|
|
6260
|
+
if (left + tooltipWidth > window.innerWidth - 10) {
|
|
6261
|
+
left = (event?.clientX || left) - tooltipWidth - 15;
|
|
6262
|
+
}
|
|
6263
|
+
if (left < 10) left = 10;
|
|
6264
|
+
if (top + tooltipHeight > window.innerHeight - 10) {
|
|
6265
|
+
top = (event?.clientY || top) - tooltipHeight - 15;
|
|
6266
|
+
}
|
|
6267
|
+
if (top < 10) top = 10;
|
|
6268
|
+
container.style.left = left + "px";
|
|
6269
|
+
container.style.top = top + "px";
|
|
6270
|
+
container.classList.add("visible");
|
|
6271
|
+
},
|
|
6272
|
+
/**
|
|
6273
|
+
* Hide tooltip
|
|
6274
|
+
*/
|
|
6275
|
+
hide() {
|
|
6276
|
+
const container = document.getElementById(this.containerId);
|
|
6277
|
+
if (container) {
|
|
6278
|
+
container.classList.remove("visible");
|
|
6279
|
+
}
|
|
6280
|
+
}
|
|
6281
|
+
};
|
|
6282
|
+
var EnergyRangeTooltip = {
|
|
6283
|
+
containerId: "myio-energy-range-tooltip",
|
|
6284
|
+
/**
|
|
6285
|
+
* Create or get the tooltip container
|
|
6286
|
+
*/
|
|
6287
|
+
getContainer() {
|
|
6288
|
+
let container = document.getElementById(this.containerId);
|
|
6289
|
+
if (!container) {
|
|
6290
|
+
container = document.createElement("div");
|
|
6291
|
+
container.id = this.containerId;
|
|
6292
|
+
container.className = "energy-range-tooltip";
|
|
6293
|
+
document.body.appendChild(container);
|
|
6294
|
+
}
|
|
6295
|
+
return container;
|
|
6296
|
+
},
|
|
6297
|
+
/**
|
|
6298
|
+
* Determine status based on power value and ranges
|
|
6299
|
+
*/
|
|
6300
|
+
calculateStatus(powerValue, ranges) {
|
|
6301
|
+
if (!ranges || powerValue == null) {
|
|
6302
|
+
return { status: "offline", label: "Sem dados" };
|
|
6303
|
+
}
|
|
6304
|
+
const power = Number(powerValue) || 0;
|
|
6305
|
+
const { standbyRange, normalRange, alertRange, failureRange } = ranges;
|
|
6306
|
+
if (standbyRange && power >= standbyRange.down && power <= standbyRange.up) {
|
|
6307
|
+
return { status: "standby", label: "Standby" };
|
|
6308
|
+
}
|
|
6309
|
+
if (normalRange && power >= normalRange.down && power <= normalRange.up) {
|
|
6310
|
+
return { status: "normal", label: "Normal" };
|
|
6311
|
+
}
|
|
6312
|
+
if (alertRange && power >= alertRange.down && power <= alertRange.up) {
|
|
6313
|
+
return { status: "alert", label: "Alerta" };
|
|
6314
|
+
}
|
|
6315
|
+
if (failureRange && power >= failureRange.down && power <= failureRange.up) {
|
|
6316
|
+
return { status: "failure", label: "Falha" };
|
|
6317
|
+
}
|
|
6318
|
+
return { status: "offline", label: "Fora da faixa" };
|
|
6319
|
+
},
|
|
6320
|
+
/**
|
|
6321
|
+
* Calculate marker position on ruler (0-100%)
|
|
6322
|
+
*/
|
|
6323
|
+
calculateMarkerPosition(powerValue, ranges) {
|
|
6324
|
+
if (!ranges) return 50;
|
|
6325
|
+
const power = Number(powerValue) || 0;
|
|
6326
|
+
const maxRange = ranges.failureRange?.up || ranges.alertRange?.up || 1e3;
|
|
6327
|
+
const displayMax = Math.min(maxRange, (ranges.alertRange?.up || maxRange) * 1.2);
|
|
6328
|
+
const position = power / displayMax * 100;
|
|
6329
|
+
return Math.max(2, Math.min(98, position));
|
|
6330
|
+
},
|
|
6331
|
+
/**
|
|
6332
|
+
* Calculate segment widths for the ruler
|
|
6333
|
+
*/
|
|
6334
|
+
calculateSegmentWidths(ranges) {
|
|
6335
|
+
if (!ranges) return { standby: 25, normal: 25, alert: 25, failure: 25 };
|
|
6336
|
+
const maxValue = ranges.failureRange?.up || 1e4;
|
|
6337
|
+
const total = Math.min(maxValue, (ranges.alertRange?.up || maxValue) * 1.2);
|
|
6338
|
+
return {
|
|
6339
|
+
standby: (ranges.standbyRange?.up || 0) / total * 100,
|
|
6340
|
+
normal: ((ranges.normalRange?.up || 0) - (ranges.normalRange?.down || 0)) / total * 100,
|
|
6341
|
+
alert: ((ranges.alertRange?.up || 0) - (ranges.alertRange?.down || 0)) / total * 100,
|
|
6342
|
+
failure: Math.max(5, 100 - (ranges.alertRange?.up || 0) / total * 100)
|
|
6343
|
+
};
|
|
6344
|
+
},
|
|
6345
|
+
/**
|
|
6346
|
+
* Format power value for display
|
|
6347
|
+
*/
|
|
6348
|
+
formatPower(value) {
|
|
6349
|
+
if (value == null || isNaN(value)) return "-";
|
|
6350
|
+
const num = Number(value);
|
|
6351
|
+
if (num >= 1e3) {
|
|
6352
|
+
return `${(num / 1e3).toFixed(2)} kW`;
|
|
6353
|
+
}
|
|
6354
|
+
return `${Math.round(num)} W`;
|
|
6355
|
+
},
|
|
6356
|
+
/**
|
|
6357
|
+
* Show tooltip for an energy card
|
|
6358
|
+
*/
|
|
6359
|
+
show(triggerElement, entityObject, event) {
|
|
6360
|
+
const container = this.getContainer();
|
|
6361
|
+
const powerValue = entityObject.instantaneousPower ?? entityObject.consumption_power ?? 0;
|
|
6362
|
+
const ranges = entityObject.powerRanges || entityObject.ranges;
|
|
6363
|
+
const hasRanges = ranges && ranges.normalRange;
|
|
6364
|
+
const { status, label } = this.calculateStatus(powerValue, ranges);
|
|
6365
|
+
const markerPos = this.calculateMarkerPosition(powerValue, ranges);
|
|
6366
|
+
const segmentWidths = this.calculateSegmentWidths(ranges);
|
|
6367
|
+
const statusLabels = {
|
|
6368
|
+
standby: "\u{1F535} Standby",
|
|
6369
|
+
normal: "\u2705 Opera\xE7\xE3o Normal",
|
|
6370
|
+
alert: "\u26A0\uFE0F Alerta",
|
|
6371
|
+
failure: "\u{1F534} Falha",
|
|
6372
|
+
offline: "\u26AB Offline / Sem dados"
|
|
6373
|
+
};
|
|
6374
|
+
container.innerHTML = `
|
|
6375
|
+
<div class="energy-range-tooltip__content">
|
|
6376
|
+
<div class="energy-range-tooltip__header">
|
|
6377
|
+
<span class="energy-range-tooltip__icon">\u26A1</span>
|
|
6378
|
+
<span class="energy-range-tooltip__title">${entityObject.labelOrName || entityObject.name || "Equipamento"}</span>
|
|
6379
|
+
</div>
|
|
6380
|
+
<div class="energy-range-tooltip__body">
|
|
6381
|
+
<div class="energy-range-tooltip__value-row">
|
|
6382
|
+
<div class="energy-range-tooltip__current">
|
|
6383
|
+
${this.formatPower(powerValue)}
|
|
6384
|
+
</div>
|
|
6385
|
+
<div class="energy-range-tooltip__status-badge">
|
|
6386
|
+
<span class="energy-range-tooltip__status-value ${status}">${label}</span>
|
|
6387
|
+
</div>
|
|
6388
|
+
</div>
|
|
6389
|
+
|
|
6390
|
+
${hasRanges ? `
|
|
6391
|
+
<div class="energy-range-tooltip__ruler">
|
|
6392
|
+
<div class="energy-range-tooltip__ruler-track">
|
|
6393
|
+
<div class="energy-range-tooltip__ruler-segment standby" style="width: ${segmentWidths.standby}%"></div>
|
|
6394
|
+
<div class="energy-range-tooltip__ruler-segment normal" style="width: ${segmentWidths.normal}%"></div>
|
|
6395
|
+
<div class="energy-range-tooltip__ruler-segment alert" style="width: ${segmentWidths.alert}%"></div>
|
|
6396
|
+
<div class="energy-range-tooltip__ruler-segment failure" style="width: ${segmentWidths.failure}%"></div>
|
|
6397
|
+
</div>
|
|
6398
|
+
<div class="energy-range-tooltip__ruler-marker" style="left: ${markerPos}%;"></div>
|
|
6399
|
+
</div>
|
|
6400
|
+
|
|
6401
|
+
<div class="energy-range-tooltip__ranges">
|
|
6402
|
+
<div class="energy-range-tooltip__range-item standby">
|
|
6403
|
+
<div class="energy-range-tooltip__range-label">Standby</div>
|
|
6404
|
+
<div class="energy-range-tooltip__range-value">${ranges.standbyRange?.down || 0}-${ranges.standbyRange?.up || 0}W</div>
|
|
6405
|
+
</div>
|
|
6406
|
+
<div class="energy-range-tooltip__range-item normal">
|
|
6407
|
+
<div class="energy-range-tooltip__range-label">Normal</div>
|
|
6408
|
+
<div class="energy-range-tooltip__range-value">${ranges.normalRange?.down || 0}-${ranges.normalRange?.up || 0}W</div>
|
|
6409
|
+
</div>
|
|
6410
|
+
<div class="energy-range-tooltip__range-item alert">
|
|
6411
|
+
<div class="energy-range-tooltip__range-label">Alerta</div>
|
|
6412
|
+
<div class="energy-range-tooltip__range-value">${ranges.alertRange?.down || 0}-${ranges.alertRange?.up || 0}W</div>
|
|
6413
|
+
</div>
|
|
6414
|
+
<div class="energy-range-tooltip__range-item failure">
|
|
6415
|
+
<div class="energy-range-tooltip__range-label">Falha</div>
|
|
6416
|
+
<div class="energy-range-tooltip__range-value">>${ranges.failureRange?.down || 0}W</div>
|
|
6417
|
+
</div>
|
|
6418
|
+
</div>
|
|
6419
|
+
` : `
|
|
6420
|
+
<div style="text-align: center; padding: 16px; color: #64748b; font-size: 12px;">
|
|
6421
|
+
Ranges de pot\xEAncia n\xE3o configurados
|
|
6422
|
+
</div>
|
|
6423
|
+
`}
|
|
6424
|
+
|
|
6425
|
+
<div class="energy-range-tooltip__status-info ${status}">
|
|
6426
|
+
${statusLabels[status] || statusLabels.offline}
|
|
6427
|
+
</div>
|
|
6428
|
+
</div>
|
|
6429
|
+
</div>
|
|
6430
|
+
`;
|
|
6431
|
+
let left, top;
|
|
6432
|
+
if (event && event.clientX && event.clientY) {
|
|
6433
|
+
left = event.clientX + 15;
|
|
6434
|
+
top = event.clientY + 15;
|
|
6435
|
+
} else {
|
|
6436
|
+
const rect = triggerElement.getBoundingClientRect();
|
|
6437
|
+
left = rect.left + rect.width / 2 - 150;
|
|
6438
|
+
top = rect.bottom + 8;
|
|
6439
|
+
}
|
|
6440
|
+
const tooltipWidth = 320;
|
|
6441
|
+
const tooltipHeight = 380;
|
|
6442
|
+
if (left + tooltipWidth > window.innerWidth - 10) {
|
|
6443
|
+
left = (event?.clientX || left) - tooltipWidth - 15;
|
|
6444
|
+
}
|
|
6445
|
+
if (left < 10) left = 10;
|
|
6446
|
+
if (top + tooltipHeight > window.innerHeight - 10) {
|
|
6447
|
+
top = (event?.clientY || top) - tooltipHeight - 15;
|
|
6448
|
+
}
|
|
6449
|
+
if (top < 10) top = 10;
|
|
6450
|
+
container.style.left = left + "px";
|
|
6451
|
+
container.style.top = top + "px";
|
|
6452
|
+
container.classList.add("visible");
|
|
6453
|
+
},
|
|
6454
|
+
/**
|
|
6455
|
+
* Hide tooltip
|
|
6456
|
+
*/
|
|
6457
|
+
hide() {
|
|
6458
|
+
const container = document.getElementById(this.containerId);
|
|
6459
|
+
if (container) {
|
|
6460
|
+
container.classList.remove("visible");
|
|
6461
|
+
}
|
|
6462
|
+
}
|
|
6463
|
+
};
|
|
5565
6464
|
function getStatusDotClass(deviceStatus) {
|
|
5566
6465
|
switch (deviceStatus) {
|
|
5567
6466
|
// --- Novos Status de Temperatura ---
|
|
@@ -5954,11 +6853,16 @@ function paint(root, state) {
|
|
|
5954
6853
|
}
|
|
5955
6854
|
}
|
|
5956
6855
|
const stateClass = getCardStateClass(entityObject.deviceStatus);
|
|
5957
|
-
|
|
6856
|
+
const tempRangeClass = getTempRangeClass(entityObject);
|
|
6857
|
+
root.className = `myio-ho-card ${stateClass} ${tempRangeClass}`.trim();
|
|
5958
6858
|
const statusInfo = getStatusInfo(entityObject.deviceStatus, i18n, entityObject.domain);
|
|
5959
6859
|
const chip = root.querySelector(".chip");
|
|
5960
6860
|
chip.className = `chip ${statusInfo.chipClass}`;
|
|
5961
6861
|
chip.innerHTML = statusInfo.label;
|
|
6862
|
+
const iconContainer = root.querySelector(".myio-ho-card__icon");
|
|
6863
|
+
if (iconContainer) {
|
|
6864
|
+
iconContainer.innerHTML = getIconSvg(entityObject.deviceType, entityObject.domain);
|
|
6865
|
+
}
|
|
5962
6866
|
if (activeTooltipDebug) {
|
|
5963
6867
|
const debugInfo = buildDebugTooltipInfo(entityObject, statusInfo, stateClass, statusDecisionSource, delayTimeConnectionInMins);
|
|
5964
6868
|
attachDebugTooltip(chip, debugInfo);
|
|
@@ -5994,14 +6898,9 @@ function paint(root, state) {
|
|
|
5994
6898
|
const opTimeVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .val");
|
|
5995
6899
|
const opTimeLabel = root.querySelector(".myio-ho-card__footer .metric:nth-child(1) .label");
|
|
5996
6900
|
if (opTimeVal) {
|
|
5997
|
-
if (
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
opTimeVal.textContent = currentTemp !== null ? `${Number(currentTemp).toFixed(1)}\xB0C` : "-";
|
|
6001
|
-
} else {
|
|
6002
|
-
if (opTimeLabel) opTimeLabel.textContent = i18n.operation_time;
|
|
6003
|
-
opTimeVal.textContent = entityObject.operationHours ?? "-";
|
|
6004
|
-
}
|
|
6901
|
+
if (opTimeLabel) opTimeLabel.textContent = i18n.operation_time;
|
|
6902
|
+
const isOffline = entityObject.deviceStatus === DeviceStatusType.OFFLINE || entityObject.deviceStatus === "offline" || entityObject.deviceStatus === DeviceStatusType.NO_INFO;
|
|
6903
|
+
opTimeVal.textContent = isOffline ? "-" : entityObject.operationHours ?? "-";
|
|
6005
6904
|
}
|
|
6006
6905
|
const powerVal = root.querySelector(".myio-ho-card__footer .metric:nth-child(2) .val");
|
|
6007
6906
|
if (powerVal) {
|
|
@@ -6087,12 +6986,51 @@ function bindEvents(root, state, callbacks) {
|
|
|
6087
6986
|
MyIOSelectionStore2.on("selection:change", onSelectionChange);
|
|
6088
6987
|
root._selectionListener = onSelectionChange;
|
|
6089
6988
|
}
|
|
6989
|
+
const valueElement = root.querySelector(".myio-ho-card__value");
|
|
6990
|
+
if (entityObject.domain === "temperature" && valueElement) {
|
|
6991
|
+
const showTooltip = (e) => {
|
|
6992
|
+
TempRangeTooltip.show(root, state.entityObject, e);
|
|
6993
|
+
};
|
|
6994
|
+
const hideTooltip = () => {
|
|
6995
|
+
TempRangeTooltip.hide();
|
|
6996
|
+
};
|
|
6997
|
+
valueElement.style.cursor = "help";
|
|
6998
|
+
valueElement.addEventListener("mouseenter", showTooltip);
|
|
6999
|
+
valueElement.addEventListener("mouseleave", hideTooltip);
|
|
7000
|
+
root._tempTooltipShowFn = showTooltip;
|
|
7001
|
+
root._tempTooltipHideFn = hideTooltip;
|
|
7002
|
+
root._tooltipElement = valueElement;
|
|
7003
|
+
}
|
|
7004
|
+
if (entityObject.domain === "energy" && valueElement) {
|
|
7005
|
+
const showEnergyTooltip = (e) => {
|
|
7006
|
+
EnergyRangeTooltip.show(root, state.entityObject, e);
|
|
7007
|
+
};
|
|
7008
|
+
const hideEnergyTooltip = () => {
|
|
7009
|
+
EnergyRangeTooltip.hide();
|
|
7010
|
+
};
|
|
7011
|
+
valueElement.style.cursor = "help";
|
|
7012
|
+
valueElement.addEventListener("mouseenter", showEnergyTooltip);
|
|
7013
|
+
valueElement.addEventListener("mouseleave", hideEnergyTooltip);
|
|
7014
|
+
root._energyTooltipShowFn = showEnergyTooltip;
|
|
7015
|
+
root._energyTooltipHideFn = hideEnergyTooltip;
|
|
7016
|
+
root._tooltipElement = valueElement;
|
|
7017
|
+
}
|
|
6090
7018
|
root._cleanup = () => {
|
|
6091
7019
|
document.removeEventListener("click", closeMenu);
|
|
6092
7020
|
document.removeEventListener("keydown", closeMenu);
|
|
6093
7021
|
if (MyIOSelectionStore2 && root._selectionListener) {
|
|
6094
7022
|
MyIOSelectionStore2.off("selection:change", root._selectionListener);
|
|
6095
7023
|
}
|
|
7024
|
+
if (root._tempTooltipShowFn && root._tooltipElement) {
|
|
7025
|
+
root._tooltipElement.removeEventListener("mouseenter", root._tempTooltipShowFn);
|
|
7026
|
+
root._tooltipElement.removeEventListener("mouseleave", root._tempTooltipHideFn);
|
|
7027
|
+
TempRangeTooltip.hide();
|
|
7028
|
+
}
|
|
7029
|
+
if (root._energyTooltipShowFn && root._tooltipElement) {
|
|
7030
|
+
root._tooltipElement.removeEventListener("mouseenter", root._energyTooltipShowFn);
|
|
7031
|
+
root._tooltipElement.removeEventListener("mouseleave", root._energyTooltipHideFn);
|
|
7032
|
+
EnergyRangeTooltip.hide();
|
|
7033
|
+
}
|
|
6096
7034
|
};
|
|
6097
7035
|
const checkbox = root.querySelector('.myio-ho-card__select input[type="checkbox"]');
|
|
6098
7036
|
if (checkbox && callbacks.handleSelect) {
|