@record-evolution/widget-gauge 1.6.10 → 1.7.1
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 +3 -1
- package/dist/src/widget-gauge.d.ts +9 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-gauge.js +34904 -527
- package/dist/widget-gauge.js.map +1 -1
- package/package.json +21 -27
- package/src/default-data.json +3 -3
- package/src/definition-schema.d.ts +30 -25
- package/src/definition-schema.json +8 -1
- package/src/widget-gauge.ts +158 -87
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "REWidget widget-gauge",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "widget-gauge",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.7.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/widget-gauge.js",
|
|
9
9
|
"types": "dist/src/widget-gauge.d.ts",
|
|
@@ -13,43 +13,37 @@
|
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
15
|
"analyze": "cem analyze --litelement",
|
|
16
|
-
"start": "
|
|
16
|
+
"start": "concurrently -k -r \"npm run watch\" \"wds\"",
|
|
17
17
|
"build": "rollup -c rollup.config.js",
|
|
18
18
|
"watch": "rollup -w -c rollup.config.js",
|
|
19
|
-
"link": "npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-gauge",
|
|
19
|
+
"link": "npm run build && npm link && cd ../RESWARM/frontend && npm link @record-evolution/widget-gauge",
|
|
20
20
|
"unlink": "npm unlink --global && cd ../RESWARM/frontend && npm unlink @record-evolution/widget-gauge && npm i @record-evolution/widget-gauge",
|
|
21
|
-
"types": "cat src/definition-schema.json | json2ts > src/definition-schema.d.ts",
|
|
21
|
+
"types": "cat src/definition-schema.json | json2ts --style.tabWidth=4 > src/definition-schema.d.ts",
|
|
22
22
|
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
|
23
23
|
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
|
24
|
-
"release": "npm version patch --tag-version-prefix='' && git push && git push --tag"
|
|
24
|
+
"release": "npm run build && npm run types && npm version patch --tag-version-prefix='' && git push && git push --tag"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"echarts": "
|
|
28
|
-
"lit": "^3.
|
|
27
|
+
"echarts": "5.6.0",
|
|
28
|
+
"lit": "^3.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@custom-elements-manifest/analyzer": "^0.10.
|
|
31
|
+
"@custom-elements-manifest/analyzer": "^0.10.4",
|
|
32
32
|
"@rollup/plugin-babel": "^6.0.4",
|
|
33
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
34
|
-
"@rollup/plugin-node-resolve": "^
|
|
35
|
-
"@rollup/plugin-replace": "^6.0.
|
|
36
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
38
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
34
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
35
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
36
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^8.34.0",
|
|
38
|
+
"@typescript-eslint/parser": "^8.34.0",
|
|
39
39
|
"@web/dev-server": "^0.4.6",
|
|
40
|
-
"concurrently": "^9.
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"lint-staged": "^15.2.10",
|
|
48
|
-
"prettier": "^3.3.3",
|
|
49
|
-
"rimraf": "^6.0.1",
|
|
50
|
-
"rollup": "^4.24.0",
|
|
51
|
-
"tslib": "^2.7.0",
|
|
52
|
-
"typescript": "5.3.2"
|
|
40
|
+
"concurrently": "^9.1.2",
|
|
41
|
+
"eslint": "^9.29.0",
|
|
42
|
+
"eslint-config-prettier": "^10.1.5",
|
|
43
|
+
"json-schema-to-typescript": "^15.0.4",
|
|
44
|
+
"prettier": "^3.5.3",
|
|
45
|
+
"rollup": "^4.43.0",
|
|
46
|
+
"typescript": "5.8.3"
|
|
53
47
|
},
|
|
54
48
|
"repository": {
|
|
55
49
|
"type": "git",
|
package/src/default-data.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"title": "Demo Gauge",
|
|
3
|
+
"subTitle": "A simple gauge demo",
|
|
3
4
|
"dataseries": [
|
|
4
5
|
{
|
|
5
6
|
"label": "Demo Gauge Temperature",
|
|
6
7
|
"unit": "°C",
|
|
7
|
-
"
|
|
8
|
+
"precision": 1,
|
|
8
9
|
"data": [
|
|
9
10
|
{
|
|
10
11
|
"value": 90
|
|
@@ -21,7 +22,6 @@
|
|
|
21
22
|
{
|
|
22
23
|
"label": "Demo Gauge Pascal",
|
|
23
24
|
"unit": "Pa",
|
|
24
|
-
"valueColor": "green",
|
|
25
25
|
"data": [
|
|
26
26
|
{
|
|
27
27
|
"value": 79
|
|
@@ -12,6 +12,10 @@ export type Label = string;
|
|
|
12
12
|
* The unit of the values. e.g. °C or km/h
|
|
13
13
|
*/
|
|
14
14
|
export type Unit = string;
|
|
15
|
+
/**
|
|
16
|
+
* The number of decimal places to show in the value. If not specified, precision is 0.
|
|
17
|
+
*/
|
|
18
|
+
export type Precision = number;
|
|
15
19
|
/**
|
|
16
20
|
* This should be an ISO String date like 2023-11-04T22:47:52.351152+00:00. Will only be used to detect data age of data.
|
|
17
21
|
*/
|
|
@@ -22,13 +26,13 @@ export type Value = number;
|
|
|
22
26
|
*/
|
|
23
27
|
export type SplitDataBy = string;
|
|
24
28
|
/**
|
|
25
|
-
*
|
|
29
|
+
* Provide a list of values. Only the latest value is shown in the gauge unless you configure "Advanced Settings" below or use split data.
|
|
26
30
|
*/
|
|
27
31
|
export type Data = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
tsp?: Timestamp;
|
|
33
|
+
value?: Value;
|
|
34
|
+
pivot?: SplitDataBy;
|
|
35
|
+
[k: string]: unknown;
|
|
32
36
|
}[];
|
|
33
37
|
/**
|
|
34
38
|
* The limits of the gauge sections. Starting from the min value, ending with the max value.
|
|
@@ -38,7 +42,7 @@ export type SectionLimits = number[];
|
|
|
38
42
|
* Background color for each section. This Array is one shorter than the number of sections.
|
|
39
43
|
*/
|
|
40
44
|
export type SectionBackgroundColors = {
|
|
41
|
-
|
|
45
|
+
[k: string]: unknown;
|
|
42
46
|
}[];
|
|
43
47
|
/**
|
|
44
48
|
* Calculate the average over the given number of newest values. (If you use 'split by', then per each of the split dataseries.) If not specified then the latest value is shown without modification.
|
|
@@ -47,33 +51,34 @@ export type AverageLatestValues = number;
|
|
|
47
51
|
/**
|
|
48
52
|
* If you provide timestamp data, the delivered value is only shown in the gauge when the age of the data is not older than the given maximum Latency in seconds.
|
|
49
53
|
*/
|
|
50
|
-
export type
|
|
54
|
+
export type MaximumLatencyInSeconds = number;
|
|
51
55
|
export type Gauges = {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
label?: Label;
|
|
57
|
+
valueColor?: ValueColor;
|
|
58
|
+
unit?: Unit;
|
|
59
|
+
precision?: Precision;
|
|
60
|
+
data?: Data;
|
|
61
|
+
sections?: GaugeColorSections;
|
|
62
|
+
advanced?: AdvancedConfiguration;
|
|
63
|
+
[k: string]: unknown;
|
|
59
64
|
}[];
|
|
60
65
|
|
|
61
66
|
export interface GaugeChartConfiguration {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
title?: Title;
|
|
68
|
+
subTitle?: Subtitle;
|
|
69
|
+
dataseries?: Gauges;
|
|
70
|
+
[k: string]: unknown;
|
|
66
71
|
}
|
|
67
72
|
export interface ValueColor {
|
|
68
|
-
|
|
73
|
+
[k: string]: unknown;
|
|
69
74
|
}
|
|
70
75
|
export interface GaugeColorSections {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
sectionLimits?: SectionLimits;
|
|
77
|
+
backgroundColors?: SectionBackgroundColors;
|
|
78
|
+
[k: string]: unknown;
|
|
74
79
|
}
|
|
75
80
|
export interface AdvancedConfiguration {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
averageLatest?: AverageLatestValues;
|
|
82
|
+
maxLatency?: MaximumLatencyInSeconds;
|
|
83
|
+
[k: string]: unknown;
|
|
79
84
|
}
|
|
@@ -38,6 +38,13 @@
|
|
|
38
38
|
"dataDrivenDisabled": false,
|
|
39
39
|
"order": 3
|
|
40
40
|
},
|
|
41
|
+
"precision": {
|
|
42
|
+
"title": "Precision",
|
|
43
|
+
"description": "The number of decimal places to show in the value. If not specified, precision is 0.",
|
|
44
|
+
"type": "number",
|
|
45
|
+
"dataDrivenDisabled": false,
|
|
46
|
+
"order": 4
|
|
47
|
+
},
|
|
41
48
|
"data": {
|
|
42
49
|
"title": "Data",
|
|
43
50
|
"description": "Provide a list of values. Only the latest value is shown in the gauge unless you configure \"Advanced Settings\" below or use split data.",
|
|
@@ -111,7 +118,7 @@
|
|
|
111
118
|
"order": 6
|
|
112
119
|
},
|
|
113
120
|
"maxLatency": {
|
|
114
|
-
"title": "Maximum Latency",
|
|
121
|
+
"title": "Maximum Latency in seconds",
|
|
115
122
|
"description": "If you provide timestamp data, the delivered value is only shown in the gauge when the age of the data is not older than the given maximum Latency in seconds.",
|
|
116
123
|
"type": "number",
|
|
117
124
|
"dataDrivenDisabled": true,
|