@openremote/or-gauge 1.8.0-snapshot.20250725120001 → 1.8.0-snapshot.20250725123024
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/@types/gaugeJS.d.ts +121 -121
- package/README.md +4 -4
- package/dist/umd/index.bundle.js +93 -93
- package/dist/umd/index.bundle.js.map +1 -1
- package/dist/umd/index.js +93 -93
- package/dist/umd/index.js.map +1 -1
- package/dist/umd/index.orbundle.js +151 -151
- package/dist/umd/index.orbundle.js.map +1 -1
- package/lib/index.js +83 -329
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -1,340 +1,94 @@
|
|
|
1
|
-
var __decorate = (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { css, html, LitElement } from "lit";
|
|
17
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
|
18
|
-
import { AssetModelUtil } from "@openremote/model";
|
|
19
|
-
import { Gauge } from "gaugeJS";
|
|
20
|
-
import manager, { Util } from "@openremote/core";
|
|
21
|
-
import { i18next } from "@openremote/or-translate";
|
|
22
|
-
import { debounce } from "lodash";
|
|
23
|
-
import { getAssetDescriptorIconTemplate } from "@openremote/or-icon";
|
|
24
|
-
//language=css
|
|
25
|
-
const styling = css `
|
|
26
|
-
:host {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#chart-wrapper {
|
|
33
|
-
position: relative;
|
|
34
|
-
width: 100%;
|
|
35
|
-
height: 100%;
|
|
36
|
-
flex-direction: column;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
}
|
|
40
|
-
#chart-container {
|
|
41
|
-
display: flex;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
align-items: center;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#chart {
|
|
47
|
-
width: 100%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.chart-description {
|
|
51
|
-
margin: 0 20px;
|
|
52
|
-
font-size: 16px;
|
|
53
|
-
z-index: 3;
|
|
54
|
-
}
|
|
55
|
-
.mainvalue-wrapper {
|
|
56
|
-
width: 100%;
|
|
57
|
-
display: flex;
|
|
58
|
-
flex: 0 0 60px;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: center;
|
|
61
|
-
}
|
|
62
|
-
.main-number {
|
|
63
|
-
color: var(--internal-or-asset-viewer-title-text-color);
|
|
64
|
-
font-size: 42px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.main-number-icon {
|
|
68
|
-
font-size: 24px;
|
|
69
|
-
margin-right: 10px;
|
|
70
|
-
display: flex;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.main-number-unit {
|
|
74
|
-
font-size: 42px;
|
|
75
|
-
color: var(--internal-or-asset-viewer-title-text-color);
|
|
76
|
-
font-weight: 200;
|
|
77
|
-
margin-left: 5px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.main-number.xs, .main-number-unit.xs {
|
|
81
|
-
font-size: 18px;
|
|
82
|
-
}
|
|
83
|
-
.main-number.s, .main-number-unit.s {
|
|
84
|
-
font-size: 24px;
|
|
85
|
-
}
|
|
86
|
-
.main-number.m, .main-number-unit.m {
|
|
87
|
-
font-size: 30px;
|
|
88
|
-
}
|
|
89
|
-
.main-number.l, .main-number-unit.l {
|
|
90
|
-
font-size: 36px;
|
|
91
|
-
}
|
|
92
|
-
.main-number.xl, .main-number-unit.xl {
|
|
93
|
-
font-size: 42px;
|
|
94
|
-
}
|
|
95
|
-
.main-number.unknown, .main-number-unit.unknown {
|
|
96
|
-
font-size: unset;
|
|
97
|
-
}
|
|
98
|
-
`;
|
|
99
|
-
let OrGauge = class OrGauge extends LitElement {
|
|
100
|
-
static get styles() {
|
|
101
|
-
return [styling];
|
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,a){var s,n=arguments.length,o=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,a);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(o=(n<3?s(o):n>3?s(e,i,o):s(e,i))||o);return n>3&&o&&Object.defineProperty(e,i,o),o},__awaiter=this&&this.__awaiter||function(t,e,i,a){return new(i||(i=Promise))(function(s,n){function o(t){try{h(a.next(t))}catch(t){n(t)}}function r(t){try{h(a.throw(t))}catch(t){n(t)}}function h(t){var e;t.done?s(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(o,r)}h((a=a.apply(t,e||[])).next())})};import{css as t,html as e,LitElement as i}from"lit";import{customElement as a,property as s,query as n,state as o}from"lit/decorators.js";import{AssetModelUtil as r}from"@openremote/model";import{Gauge as h}from"gaugeJS";import l,{Util as u}from"@openremote/core";import{i18next as d}from"@openremote/or-translate";import{debounce as p}from"lodash";import{getAssetDescriptorIconTemplate as g}from"@openremote/or-icon";let styling=t`
|
|
2
|
+
:host {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
flex-direction: column;
|
|
102
6
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this.updateComplete.then(() => {
|
|
112
|
-
this.resizeObserver = new ResizeObserver(debounce((entries) => {
|
|
113
|
-
const size = entries[0].contentRect;
|
|
114
|
-
this.gaugeSize = {
|
|
115
|
-
width: size.width,
|
|
116
|
-
height: size.height
|
|
117
|
-
};
|
|
118
|
-
this.updateComplete.then(() => {
|
|
119
|
-
this.setupGauge(); // recreate gauge since the library is not 100% responsive.
|
|
120
|
-
});
|
|
121
|
-
}, 200));
|
|
122
|
-
this.resizeObserver.observe(this._wrapperElem);
|
|
123
|
-
});
|
|
7
|
+
|
|
8
|
+
#chart-wrapper {
|
|
9
|
+
position: relative;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
align-items: center;
|
|
124
15
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const attributeDescriptor = AssetModelUtil.getAttributeDescriptor(attr.name, this.asset.type);
|
|
130
|
-
this.unit = Util.resolveUnits(Util.getAttributeUnits(attr, attributeDescriptor, this.asset.type));
|
|
131
|
-
this.value = attr.value != null ? attr.value : NaN;
|
|
132
|
-
}
|
|
16
|
+
#chart-container {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
133
20
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (changedProperties.has('value')) {
|
|
138
|
-
(_a = this.gauge) === null || _a === void 0 ? void 0 : _a.set(this.value != null ? this.value : NaN);
|
|
139
|
-
}
|
|
140
|
-
if (changedProperties.has('attrRef')) {
|
|
141
|
-
if (this.attrRef) {
|
|
142
|
-
this.loadData(this.attrRef);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
this.assetAttribute = undefined;
|
|
146
|
-
this.value = undefined;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Render gauge again if..
|
|
150
|
-
if (changedProperties.has('min') && this.min != null && this.gauge) {
|
|
151
|
-
this.gauge.setMinValue(this.min);
|
|
152
|
-
this.gauge.set(this.value != null ? this.value : NaN);
|
|
153
|
-
}
|
|
154
|
-
if (changedProperties.has('max') && this.max != null && this.gauge) {
|
|
155
|
-
this.gauge.maxValue = this.max;
|
|
156
|
-
this.gauge.set(this.value != null ? this.value : NaN);
|
|
157
|
-
}
|
|
158
|
-
if (changedProperties.has('thresholds') && this.thresholds) {
|
|
159
|
-
// Make staticZones out of the thresholds.
|
|
160
|
-
// If below the minimum or above the maximum, set the value according to it.
|
|
161
|
-
this.config.options.staticZones = [];
|
|
162
|
-
this.thresholds.sort((x, y) => (x[0] < y[0]) ? -1 : 1).forEach(((threshold, index) => {
|
|
163
|
-
var _a, _b, _c;
|
|
164
|
-
const min = threshold[0];
|
|
165
|
-
const max = (this.thresholds[index + 1] ? this.thresholds[index + 1][0] : this.max);
|
|
166
|
-
const zone = {
|
|
167
|
-
strokeStyle: threshold[1],
|
|
168
|
-
min: ((this.min && min && this.min > min) ? this.min : ((this.max && min && this.max < min) ? this.max : min)),
|
|
169
|
-
max: ((this.max && max && this.max < max) ? this.max : ((this.min && max && this.min > max) ? this.min : max))
|
|
170
|
-
};
|
|
171
|
-
(_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.staticZones) === null || _c === void 0 ? void 0 : _c.push(zone);
|
|
172
|
-
}));
|
|
173
|
-
// The lowest staticZone should ALWAYS have the minimum value, to prevent the graphic displaying incorrectly.
|
|
174
|
-
if (this.min && ((_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.staticZones)) {
|
|
175
|
-
this.config.options.staticZones[0].min = this.min;
|
|
176
|
-
}
|
|
177
|
-
// Applying the options we changed.
|
|
178
|
-
if (this.gauge) {
|
|
179
|
-
this.gauge.setOptions((_d = this.config) === null || _d === void 0 ? void 0 : _d.options);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
21
|
+
|
|
22
|
+
#chart {
|
|
23
|
+
width: 100%;
|
|
182
24
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
this.gauge.setMinValue(this.min ? this.min : 0);
|
|
189
|
-
this.gauge.animationSpeed = 1;
|
|
190
|
-
this.gauge.set(this.value != null ? this.value : NaN);
|
|
191
|
-
if (this.value == null && this.attrRef) {
|
|
192
|
-
this.loadData(this.attrRef);
|
|
193
|
-
}
|
|
25
|
+
|
|
26
|
+
.chart-description {
|
|
27
|
+
margin: 0 20px;
|
|
28
|
+
font-size: 16px;
|
|
29
|
+
z-index: 3;
|
|
194
30
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return Math.min(width, height) + "px";
|
|
31
|
+
.mainvalue-wrapper {
|
|
32
|
+
width: 100%;
|
|
33
|
+
display: flex;
|
|
34
|
+
flex: 0 0 60px;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
202
37
|
}
|
|
203
|
-
|
|
204
|
-
|
|
38
|
+
.main-number {
|
|
39
|
+
color: var(--internal-or-asset-viewer-title-text-color);
|
|
40
|
+
font-size: 42px;
|
|
205
41
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return "m";
|
|
212
|
-
}
|
|
213
|
-
else if (width < 320) {
|
|
214
|
-
return "l";
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
return "xl";
|
|
218
|
-
}
|
|
42
|
+
|
|
43
|
+
.main-number-icon {
|
|
44
|
+
font-size: 24px;
|
|
45
|
+
margin-right: 10px;
|
|
46
|
+
display: flex;
|
|
219
47
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return html `
|
|
227
|
-
<div style="position: relative; height: 100%; width: 100%;">
|
|
228
|
-
<div id="chart-wrapper" style="display: ${this.loading ? 'none' : 'flex'};">
|
|
229
|
-
<div id="chart-container" style="flex: 0 0 0; width: ${gaugeWidth};">
|
|
230
|
-
<canvas id="chart"></canvas>
|
|
231
|
-
</div>
|
|
232
|
-
<div id="details-container">
|
|
233
|
-
${showLabel ? html `
|
|
234
|
-
<div class="mainvalue-wrapper">
|
|
235
|
-
<span class="main-number-icon">${this.asset ? getAssetDescriptorIconTemplate(AssetModelUtil.getAssetDescriptor(this.asset.type)) : ""}</span>
|
|
236
|
-
<span class="main-number ${labelSize}">${formattedVal}</span>
|
|
237
|
-
<span class="main-number-unit ${labelSize}">${this.unit ? this.unit : ""}</span>
|
|
238
|
-
</div>
|
|
239
|
-
` : undefined}
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
</div>
|
|
243
|
-
${this.loading ? html `
|
|
244
|
-
<span>${i18next.t('loading')}</span>
|
|
245
|
-
` : undefined}
|
|
246
|
-
`;
|
|
48
|
+
|
|
49
|
+
.main-number-unit {
|
|
50
|
+
font-size: 42px;
|
|
51
|
+
color: var(--internal-or-asset-viewer-title-text-color);
|
|
52
|
+
font-weight: 200;
|
|
53
|
+
margin-left: 5px;
|
|
247
54
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
const assets = response.data;
|
|
252
|
-
const assetAttributes = [attrRef].map((attrRef) => {
|
|
253
|
-
const assetIndex = assets.findIndex((asset) => asset.id === attrRef.id);
|
|
254
|
-
const asset = assetIndex >= 0 ? assets[assetIndex] : undefined;
|
|
255
|
-
return asset && asset.attributes ? [assetIndex, asset.attributes[attrRef.name]] : undefined;
|
|
256
|
-
}).filter((indexAndAttr) => !!indexAndAttr);
|
|
257
|
-
this.asset = assets[0];
|
|
258
|
-
this.assetAttribute = assetAttributes[0];
|
|
259
|
-
});
|
|
55
|
+
|
|
56
|
+
.main-number.xs, .main-number-unit.xs {
|
|
57
|
+
font-size: 18px;
|
|
260
58
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
attributeRef: undefined,
|
|
264
|
-
options: {
|
|
265
|
-
angle: 0,
|
|
266
|
-
lineWidth: 0.4,
|
|
267
|
-
radiusScale: 1,
|
|
268
|
-
pointer: {
|
|
269
|
-
length: 0.5,
|
|
270
|
-
strokeWidth: 0.035,
|
|
271
|
-
color: "#000000",
|
|
272
|
-
},
|
|
273
|
-
staticZones: [],
|
|
274
|
-
limitMax: true,
|
|
275
|
-
limitMin: true,
|
|
276
|
-
colorStart: "#000000",
|
|
277
|
-
colorStop: "#707070",
|
|
278
|
-
strokeColor: "#ABCDEF",
|
|
279
|
-
generateGradient: false,
|
|
280
|
-
highDpiSupport: true
|
|
281
|
-
}
|
|
282
|
-
};
|
|
59
|
+
.main-number.s, .main-number-unit.s {
|
|
60
|
+
font-size: 24px;
|
|
283
61
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
],
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
], OrGauge.prototype, "realm", void 0);
|
|
318
|
-
__decorate([
|
|
319
|
-
state()
|
|
320
|
-
], OrGauge.prototype, "loading", void 0);
|
|
321
|
-
__decorate([
|
|
322
|
-
state()
|
|
323
|
-
], OrGauge.prototype, "gauge", void 0);
|
|
324
|
-
__decorate([
|
|
325
|
-
state()
|
|
326
|
-
], OrGauge.prototype, "gaugeSize", void 0);
|
|
327
|
-
__decorate([
|
|
328
|
-
query("#chart")
|
|
329
|
-
], OrGauge.prototype, "_gaugeElem", void 0);
|
|
330
|
-
__decorate([
|
|
331
|
-
query("#chart-wrapper")
|
|
332
|
-
], OrGauge.prototype, "_wrapperElem", void 0);
|
|
333
|
-
__decorate([
|
|
334
|
-
query("#details-container")
|
|
335
|
-
], OrGauge.prototype, "_detailsElem", void 0);
|
|
336
|
-
OrGauge = __decorate([
|
|
337
|
-
customElement("or-gauge")
|
|
338
|
-
], OrGauge);
|
|
339
|
-
export { OrGauge };
|
|
340
|
-
//# sourceMappingURL=index.js.map
|
|
62
|
+
.main-number.m, .main-number-unit.m {
|
|
63
|
+
font-size: 30px;
|
|
64
|
+
}
|
|
65
|
+
.main-number.l, .main-number-unit.l {
|
|
66
|
+
font-size: 36px;
|
|
67
|
+
}
|
|
68
|
+
.main-number.xl, .main-number-unit.xl {
|
|
69
|
+
font-size: 42px;
|
|
70
|
+
}
|
|
71
|
+
.main-number.unknown, .main-number-unit.unknown {
|
|
72
|
+
font-size: unset;
|
|
73
|
+
}
|
|
74
|
+
`,OrGauge=class extends i{static get styles(){return[styling]}constructor(){super(),this.decimals=0,this.loading=!1,this.config||(this.config=this.getDefaultConfig()),this.updateComplete.then(()=>{this.resizeObserver=new ResizeObserver(p(t=>{let e=t[0].contentRect;this.gaugeSize={width:e.width,height:e.height},this.updateComplete.then(()=>{this.setupGauge()})},200)),this.resizeObserver.observe(this._wrapperElem)})}willUpdate(t){if(t.has("assetAttribute")){let t=this.assetAttribute[1],e=r.getAttributeDescriptor(t.name,this.asset.type);this.unit=u.resolveUnits(u.getAttributeUnits(t,e,this.asset.type)),this.value=null!=t.value?t.value:NaN}}updated(t){var e,i,a,s;t.has("value")&&(null==(e=this.gauge)||e.set(null!=this.value?this.value:NaN)),t.has("attrRef")&&(this.attrRef?this.loadData(this.attrRef):(this.assetAttribute=void 0,this.value=void 0)),t.has("min")&&null!=this.min&&this.gauge&&(this.gauge.setMinValue(this.min),this.gauge.set(null!=this.value?this.value:NaN)),t.has("max")&&null!=this.max&&this.gauge&&(this.gauge.maxValue=this.max,this.gauge.set(null!=this.value?this.value:NaN)),t.has("thresholds")&&this.thresholds&&(this.config.options.staticZones=[],this.thresholds.sort((t,e)=>t[0]<e[0]?-1:1).forEach((t,e)=>{var i,a,s;let n=t[0],o=this.thresholds[e+1]?this.thresholds[e+1][0]:this.max,r={strokeStyle:t[1],min:this.min&&n&&this.min>n?this.min:this.max&&n&&this.max<n?this.max:n,max:this.max&&o&&this.max<o?this.max:this.min&&o&&this.min>o?this.min:o};null==(s=null==(a=null==(i=this.config)?void 0:i.options)?void 0:a.staticZones)||s.push(r)}),this.min&&(null==(a=null==(i=this.config)?void 0:i.options)?void 0:a.staticZones)&&(this.config.options.staticZones[0].min=this.min),this.gauge&&this.gauge.setOptions(null==(s=this.config)?void 0:s.options))}setupGauge(){var t;this.gauge=new h(this._gaugeElem),this.gauge.setOptions(null==(t=this.config)?void 0:t.options),this.gauge.maxValue=this.max?this.max:100,this.gauge.setMinValue(this.min?this.min:0),this.gauge.animationSpeed=1,this.gauge.set(null!=this.value?this.value:NaN),null==this.value&&this.attrRef&&this.loadData(this.attrRef)}getGaugeWidth(t,e=!0){return t?Math.min(t.width,(e?t.height-this._detailsElem.clientHeight:t.height)*1.5)+"px":"unset"}shouldShowLabel(t){return t.width>70&&t.height>100}getLabelSize(t){return t<120?"s":t<240?"m":t<320?"l":"xl"}render(){let t=null!=this.value?+this.value.toFixed(this.decimals):NaN,i=!this.gaugeSize||this.shouldShowLabel(this.gaugeSize),a=i&&this.gaugeSize?this.getLabelSize(this.gaugeSize.width):"unknown",s=this.getGaugeWidth(this.gaugeSize,i);return e`
|
|
75
|
+
<div style="position: relative; height: 100%; width: 100%;">
|
|
76
|
+
<div id="chart-wrapper" style="display: ${this.loading?"none":"flex"};">
|
|
77
|
+
<div id="chart-container" style="flex: 0 0 0; width: ${s};">
|
|
78
|
+
<canvas id="chart"></canvas>
|
|
79
|
+
</div>
|
|
80
|
+
<div id="details-container">
|
|
81
|
+
${i?e`
|
|
82
|
+
<div class="mainvalue-wrapper">
|
|
83
|
+
<span class="main-number-icon">${this.asset?g(r.getAssetDescriptor(this.asset.type)):""}</span>
|
|
84
|
+
<span class="main-number ${a}">${t}</span>
|
|
85
|
+
<span class="main-number-unit ${a}">${this.unit?this.unit:""}</span>
|
|
86
|
+
</div>
|
|
87
|
+
`:void 0}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
${this.loading?e`
|
|
92
|
+
<span>${d.t("loading")}</span>
|
|
93
|
+
`:void 0}
|
|
94
|
+
`}loadData(t){return __awaiter(this,void 0,void 0,function*(){let e=(yield l.rest.api.AssetResource.queryAssets({ids:[t.id]})).data,i=[t].map(t=>{let i=e.findIndex(e=>e.id===t.id),a=i>=0?e[i]:void 0;return a&&a.attributes?[i,a.attributes[t.name]]:void 0}).filter(t=>!!t);this.asset=e[0],this.assetAttribute=i[0]})}getDefaultConfig(){return{attributeRef:void 0,options:{angle:0,lineWidth:.4,radiusScale:1,pointer:{length:.5,strokeWidth:.035,color:"#000000"},staticZones:[],limitMax:!0,limitMin:!0,colorStart:"#000000",colorStop:"#707070",strokeColor:"#ABCDEF",generateGradient:!1,highDpiSupport:!0}}}};__decorate([s({type:Object})],OrGauge.prototype,"attrRef",void 0),__decorate([s({type:Object})],OrGauge.prototype,"asset",void 0),__decorate([s({type:Object})],OrGauge.prototype,"assetAttribute",void 0),__decorate([s()],OrGauge.prototype,"value",void 0),__decorate([s()],OrGauge.prototype,"decimals",void 0),__decorate([s()],OrGauge.prototype,"unit",void 0),__decorate([s()],OrGauge.prototype,"min",void 0),__decorate([s()],OrGauge.prototype,"max",void 0),__decorate([s()],OrGauge.prototype,"thresholds",void 0),__decorate([s()],OrGauge.prototype,"config",void 0),__decorate([s({type:String})],OrGauge.prototype,"realm",void 0),__decorate([o()],OrGauge.prototype,"loading",void 0),__decorate([o()],OrGauge.prototype,"gauge",void 0),__decorate([o()],OrGauge.prototype,"gaugeSize",void 0),__decorate([n("#chart")],OrGauge.prototype,"_gaugeElem",void 0),__decorate([n("#chart-wrapper")],OrGauge.prototype,"_wrapperElem",void 0),__decorate([n("#details-container")],OrGauge.prototype,"_detailsElem",void 0),OrGauge=__decorate([a("or-gauge")],OrGauge);export{OrGauge};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openremote/or-gauge",
|
|
3
|
-
"version": "1.8.0-snapshot.
|
|
3
|
+
"version": "1.8.0-snapshot.20250725123024",
|
|
4
4
|
"description": "OpenRemote gauge",
|
|
5
5
|
"customElements": "custom-elements.json",
|
|
6
6
|
"main": "dist/umd/index.bundle.js",
|
|
@@ -18,16 +18,16 @@
|
|
|
18
18
|
"author": "OpenRemote",
|
|
19
19
|
"license": "AGPL-3.0-or-later",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@openremote/core": "1.8.0-snapshot.
|
|
22
|
-
"@openremote/or-components": "1.8.0-snapshot.
|
|
23
|
-
"@openremote/or-icon": "1.8.0-snapshot.
|
|
24
|
-
"@openremote/or-mwc-components": "1.8.0-snapshot.
|
|
25
|
-
"@openremote/or-translate": "1.8.0-snapshot.
|
|
21
|
+
"@openremote/core": "1.8.0-snapshot.20250725123024",
|
|
22
|
+
"@openremote/or-components": "1.8.0-snapshot.20250725123024",
|
|
23
|
+
"@openremote/or-icon": "1.8.0-snapshot.20250725123024",
|
|
24
|
+
"@openremote/or-mwc-components": "1.8.0-snapshot.20250725123024",
|
|
25
|
+
"@openremote/or-translate": "1.8.0-snapshot.20250725123024",
|
|
26
26
|
"gaugeJS": "^1.3.7",
|
|
27
27
|
"lit": "^2.0.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@openremote/util": "1.8.0-snapshot.
|
|
30
|
+
"@openremote/util": "1.8.0-snapshot.20250725123024"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|