@record-evolution/widget-gauge 1.5.21 → 1.5.22

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/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.5.21",
6
+ "version": "1.5.22",
7
7
  "type": "module",
8
8
  "main": "dist/widget-gauge.js",
9
9
  "types": "dist/src/widget-gauge.d.ts",
@@ -16,6 +16,7 @@
16
16
  "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
17
17
  "build": "rollup -c rollup.config.js --bundleConfigAsCjs",
18
18
  "watch": "rollup -w -c rollup.config.js --bundleConfigAsCjs",
19
+ "types": "cat src/definition-schema.json | json2ts > src/definition-schema.d.ts",
19
20
  "start:build": "npm run build && es-dev-server --root-dir dist --app-index index.html --compatibility none --open",
20
21
  "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
21
22
  "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
@@ -41,6 +42,7 @@
41
42
  "eslint": "^8.53.0",
42
43
  "eslint-config-prettier": "^9.0.0",
43
44
  "husky": "^8.0.3",
45
+ "json-schema-to-typescript": "^13.1.1",
44
46
  "lint-staged": "^15.0.2",
45
47
  "prettier": "^3.0.3",
46
48
  "rimraf": "^5.0.5",
@@ -1,29 +1,30 @@
1
1
  {
2
- "settings": {
3
-
4
- },
5
- "dataseries": [{
6
- "label": "Demo Gauge Temperature",
7
- "unit": "°C",
8
- "valueColor": "black",
9
- "sections": [-20, 80, 90, 120],
10
- "backgroundColors": [
11
- "#AAC8A7",
12
- "#F1C27B",
13
- "#FF9B9B"
14
- ],
15
- "averageLatest": 1,
16
- "data": [{
17
- "value": 90,
18
- "pivot": "Frankfurt"
19
- }]
20
- },{
21
- "label": "Demo Gauge Pascal",
22
- "unit": "Pa",
23
- "valueColor": "green",
24
- "averageLatest": 1,
25
- "data": [{
26
- "value": 79
27
- }]
28
- }]
29
- }
2
+ "settings": {},
3
+ "dataseries": [
4
+ {
5
+ "label": "Demo Gauge Temperature",
6
+ "unit": "°C",
7
+ "valueColor": "black",
8
+ "sections": [-20, 80, 90, 120],
9
+ "backgroundColors": ["#AAC8A7", "#F1C27B", "#FF9B9B"],
10
+ "averageLatest": 1,
11
+ "data": [
12
+ {
13
+ "value": 90,
14
+ "pivot": "Frankfurt"
15
+ }
16
+ ]
17
+ },
18
+ {
19
+ "label": "Demo Gauge Pascal",
20
+ "unit": "Pa",
21
+ "valueColor": "green",
22
+ "averageLatest": 1,
23
+ "data": [
24
+ {
25
+ "value": 79
26
+ }
27
+ ]
28
+ }
29
+ ]
30
+ }
@@ -0,0 +1,65 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * This file was automatically generated by json-schema-to-typescript.
4
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
5
+ * and run json-schema-to-typescript to regenerate this file.
6
+ */
7
+
8
+ export type Title = string;
9
+ export type Subtitle = string;
10
+ export type Label = string;
11
+ /**
12
+ * The unit of the values. e.g. °C or km/h
13
+ */
14
+ export type Unit = string;
15
+ /**
16
+ * The amount of gauge sections. Starting from the min value, ending with the max value.
17
+ */
18
+ export type Sections = number[];
19
+ /**
20
+ * Background color for each section. This Array is one shorter than the number of sections.
21
+ */
22
+ export type SectionBackgroundColors = {
23
+ [k: string]: unknown;
24
+ }[];
25
+ /**
26
+ * Calculate the average over the given number of newest values. (If pivoted, then per each of the pivot dataseries.) If not specified then the latest value is shown without modification.
27
+ */
28
+ export type AverageLatestValues = number;
29
+ export type Value = number;
30
+ /**
31
+ * You can specify a column in the input data to autogenerate dataseries for each distinct entry in this column. E.g. if you have a table with columns [city, timestamp, temperature] and specify ''city'' as pivot column, then you will get a gauge for each city.
32
+ */
33
+ export type PivotColumn = string;
34
+ /**
35
+ * The data used to draw this data series.
36
+ */
37
+ export type Data = {
38
+ value: Value;
39
+ pivot?: PivotColumn;
40
+ [k: string]: unknown;
41
+ }[];
42
+ export type Gauges = {
43
+ label: Label;
44
+ valueColor?: ValueColor;
45
+ unit?: Unit;
46
+ sections?: Sections;
47
+ backgroundColors?: SectionBackgroundColors;
48
+ averageLatest?: AverageLatestValues;
49
+ data?: Data;
50
+ [k: string]: unknown;
51
+ }[];
52
+
53
+ export interface GaugeChartConfiguration {
54
+ settings?: GlobalSettings;
55
+ dataseries?: Gauges;
56
+ [k: string]: unknown;
57
+ }
58
+ export interface GlobalSettings {
59
+ title?: Title;
60
+ subTitle?: Subtitle;
61
+ [k: string]: unknown;
62
+ }
63
+ export interface ValueColor {
64
+ [k: string]: unknown;
65
+ }
@@ -25,6 +25,7 @@
25
25
  "order": 2,
26
26
  "items": {
27
27
  "type": "object",
28
+ "required": ["label"],
28
29
  "properties": {
29
30
  "label": {
30
31
  "title": "Label",
@@ -49,7 +50,7 @@
49
50
  "type": "array",
50
51
  "order": 4,
51
52
  "items": {
52
- "type": "string"
53
+ "type": "number"
53
54
  }
54
55
  },
55
56
  "backgroundColors": {
@@ -75,6 +76,7 @@
75
76
  "buffersize": 1000,
76
77
  "items": {
77
78
  "type": "object",
79
+ "required": ["value"],
78
80
  "properties": {
79
81
  "value": {
80
82
  "title": "Value",
@@ -95,4 +97,4 @@
95
97
  }
96
98
  }
97
99
  }
98
- }
100
+ }
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@ export interface Settings {
2
2
  title: string
3
3
  subTitle: string
4
4
  columnLayout: boolean
5
- }
5
+ }
6
6
 
7
7
  export interface Data {
8
8
  value: number
@@ -17,7 +17,7 @@ export interface Dataseries {
17
17
  backgroundColors: string[]
18
18
  data: Data[]
19
19
  // not input values
20
- needleValue: number
20
+ needleValue: number
21
21
  range: number
22
22
  ranges: number[]
23
23
  }
@@ -25,4 +25,4 @@ export interface Dataseries {
25
25
  export interface InputData {
26
26
  settings: Settings
27
27
  dataseries: Dataseries[]
28
- }
28
+ }