@openremote/or-attribute-barchart 1.11.0-snapshot.20251103144513 → 1.11.0
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.
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
|
|
2
|
+
import type { OrAttributeBarChart } from "./lib/index.d.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This type can be used to create scoped tags for your components.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import type { ScopedElements } from "path/to/library/jsx-integration";
|
|
11
|
+
*
|
|
12
|
+
* declare module "my-library" {
|
|
13
|
+
* namespace JSX {
|
|
14
|
+
* interface IntrinsicElements
|
|
15
|
+
* extends ScopedElements<'test-', ''> {}
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @deprecated Runtime scoped elements result in duplicate types and can confusing for developers. It is recommended to use the `prefix` and `suffix` options to generate new types instead.
|
|
21
|
+
*/
|
|
22
|
+
export type ScopedElements<
|
|
23
|
+
Prefix extends string = "",
|
|
24
|
+
Suffix extends string = ""
|
|
25
|
+
> = {
|
|
26
|
+
[Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`]: CustomElements[Key];
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type BaseProps<T extends HTMLElement> = {
|
|
30
|
+
|
|
31
|
+
/** Content added between the opening and closing tags of the element */
|
|
32
|
+
children?: any;
|
|
33
|
+
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
|
|
34
|
+
class?: string;
|
|
35
|
+
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Takes an object where the key is the class name(s) and the value is a boolean expression. When true, the class is applied, and when false, it is removed. */
|
|
38
|
+
classList?: Record<string, boolean | undefined>;
|
|
39
|
+
/** Specifies the text direction of the element. */
|
|
40
|
+
dir?: "ltr" | "rtl";
|
|
41
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
42
|
+
exportparts?: string;
|
|
43
|
+
/** For <label> and <output>, lets you associate the label with some control. */
|
|
44
|
+
htmlFor?: string;
|
|
45
|
+
/** Specifies whether the element should be hidden. */
|
|
46
|
+
hidden?: boolean | string;
|
|
47
|
+
/** A unique identifier for the element. */
|
|
48
|
+
id?: string;
|
|
49
|
+
/** Keys tell React which array item each component corresponds to */
|
|
50
|
+
key?: string | number;
|
|
51
|
+
/** Specifies the language of the element. */
|
|
52
|
+
lang?: string;
|
|
53
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
54
|
+
part?: string;
|
|
55
|
+
/** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
|
|
56
|
+
ref?: T | ((e: T) => void);
|
|
57
|
+
/** Adds a reference for a custom element slot */
|
|
58
|
+
slot?: string;
|
|
59
|
+
/** Prop for setting inline styles */
|
|
60
|
+
style?: Record<string, string | number>;
|
|
61
|
+
/** Overrides the default Tab button behavior. Avoid using values other than -1 and 0. */
|
|
62
|
+
tabIndex?: number;
|
|
63
|
+
/** Specifies the tooltip text for the element. */
|
|
64
|
+
title?: string;
|
|
65
|
+
/** Passing 'no' excludes the element content from being translated. */
|
|
66
|
+
translate?: "yes" | "no";
|
|
67
|
+
/** The popover global attribute is used to designate an element as a popover element. */
|
|
68
|
+
popover?: "auto" | "hint" | "manual";
|
|
69
|
+
/** Turns an element element into a popover control button; takes the ID of the popover element to control as its value. */
|
|
70
|
+
popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
|
|
71
|
+
/** Specifies the action to be performed on a popover element being controlled by a control element. */
|
|
72
|
+
popovertargetaction?: "show" | "hide" | "toggle";
|
|
73
|
+
|
|
74
|
+
} ;
|
|
75
|
+
|
|
76
|
+
type BaseEvents = {
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export type OrAttributeBarChartProps = {
|
|
84
|
+
/** Asset data to display in the bar chart. This array needs to be populated.
|
|
85
|
+
Used for the chart legend, information about units, and retrieval of data points. */
|
|
86
|
+
"assets"?: OrAttributeBarChart['assets'];
|
|
87
|
+
/** List of attributes to display in the bar chart. This array needs to be populated.
|
|
88
|
+
Used for the chart legend, and the retrieval of data points.
|
|
89
|
+
Formatted as a JSON array of;
|
|
90
|
+
|
|
91
|
+
```[<index of assets>, Attribute]``` */
|
|
92
|
+
"assetAttributes"?: OrAttributeBarChart['assetAttributes'];
|
|
93
|
+
/** Realm name to associate all the chart data with. */
|
|
94
|
+
"realm"?: OrAttributeBarChart['realm'];
|
|
95
|
+
/** The list of HEX colors representing the line color for each AttributeRef.
|
|
96
|
+
Acts as an override, and will fall back to the colors attribute if not specified.
|
|
97
|
+
The AttributeRef object with Asset ID and Attribute name need to be present in the Chart to work.
|
|
98
|
+
The HEX color should be put in without '#' prefix. For example, you'd use '4d9d2a' instead of '#4d9d2a'. */
|
|
99
|
+
"attributeColors"?: OrAttributeBarChart['attributeColors'];
|
|
100
|
+
/** The attribute configuration object with, for example, a list of right-axis attributes.
|
|
101
|
+
See BarChartAttributeConfig for full documentation on the options. */
|
|
102
|
+
"attributeConfig"?: OrAttributeBarChart['attributeConfig'];
|
|
103
|
+
/** List of colors to display attributes values with inside the bar chart.
|
|
104
|
+
The array corresponds with assetAttributes, so the 1st color will be used for the 1st attribute. */
|
|
105
|
+
"colors"?: OrAttributeBarChart['colors'];
|
|
106
|
+
/** The query object to request attribute data / data points with.
|
|
107
|
+
Normally, it's of type AssetDatapointIntervalQuery, including a start- and end time. */
|
|
108
|
+
"datapointQuery"?: OrAttributeBarChart['datapointQuery'];
|
|
109
|
+
/** Selected timeframe using a [start date, end date] array format. */
|
|
110
|
+
"timeframe"?: OrAttributeBarChart['timeframe'];
|
|
111
|
+
/** Custom ECharts options object to configure the chart appearance.
|
|
112
|
+
See their documentation for more info: https://echarts.apache.org/en/option.html */
|
|
113
|
+
"chartOptions"?: OrAttributeBarChart['chartOptions'];
|
|
114
|
+
/** Shows a right-side legend with the list of visible attributes. */
|
|
115
|
+
"showLegend"?: OrAttributeBarChart['showLegend'];
|
|
116
|
+
/** Shows the right-side legend (toggled with showLegend) in a compact / dense format. */
|
|
117
|
+
"denseLegend"?: OrAttributeBarChart['denseLegend'];
|
|
118
|
+
/** Displays the bar chart in a vertically "stacked" configuration.
|
|
119
|
+
It will display a cumulative effect of all data series on top of each other. */
|
|
120
|
+
"stacked"?: OrAttributeBarChart['stacked'];
|
|
121
|
+
/** Enables time control for the user, allowing them to customize the timeframe shown.
|
|
122
|
+
Leaving this disabled/unset will show them in a "read-only" state. */
|
|
123
|
+
"timestampControls"?: OrAttributeBarChart['timestampControls'];
|
|
124
|
+
/** Number of decimals to display for attributes. */
|
|
125
|
+
"decimals"?: OrAttributeBarChart['decimals'];
|
|
126
|
+
/** A JSON array list of strings that represent the prefix options in the UI, such as "current" or "last".
|
|
127
|
+
In combination with timeWindowOptions, it provides a timeframe like "current 1 hour" to display data of. */
|
|
128
|
+
"timePrefixOptions"?: OrAttributeBarChart['timePrefixOptions'];
|
|
129
|
+
/** The selected option from timePrefixOptions, such as "current" or "last".
|
|
130
|
+
In combination with timeWindowOptions, it provides a timeframe like "current 1 hour" to display data of. */
|
|
131
|
+
"timePrefixKey"?: OrAttributeBarChart['timePrefixKey'];
|
|
132
|
+
/** A JSON object containing a list of time window options, like "1 day", "6 hours" or "52 weeks".
|
|
133
|
+
In combination with timePrefixOptions, it provides a timeframe like "last 6 hours" to display data of.
|
|
134
|
+
The input should contain a JavaScript Map, containing the following:
|
|
135
|
+
- A string with a unique key like "6hours",
|
|
136
|
+
- A combination of any moment.unitOfTime.DurationConstructor and number, like ["hours", 6]
|
|
137
|
+
|
|
138
|
+
Example input: `{"6hours": ["hours", 6], "4weeks": ["weeks", 4]}` */
|
|
139
|
+
"timeWindowOptions"?: OrAttributeBarChart['timeWindowOptions'];
|
|
140
|
+
/** The key value of the selected option from timeWindowOptions, such as "1day", "6hours" or "52weeks".
|
|
141
|
+
In combination with timePrefixOptions, it provides a timeframe like "last 6 hours" to display data of. */
|
|
142
|
+
"timeWindowKey"?: OrAttributeBarChart['timeWindowKey'];
|
|
143
|
+
/** A JSON object containing a list of interval options, like "30minutes", "hour" or "day".
|
|
144
|
+
It determines the interval to display data in sections. For example, split the data every 5 minutes of the past hour.
|
|
145
|
+
In combination with the active formula in datapointQuery, such as AVG and MIN/MAX, it will show a '5 minute' average of the past hour.
|
|
146
|
+
The input should contain a JavaScript Map, containing the following:
|
|
147
|
+
- A BarChartInterval string with a unique key like "hour" or "day",
|
|
148
|
+
- A IntervalConfig object with details on the interval, such as the display name and the unit of time.
|
|
149
|
+
|
|
150
|
+
Example input:
|
|
151
|
+
```
|
|
152
|
+
{"30minutes": {
|
|
153
|
+
displayName: "30Minutes", // translated automatically
|
|
154
|
+
steps: 30,
|
|
155
|
+
orFormat: "minute",
|
|
156
|
+
momentFormat: "minutes", // using moment.js format
|
|
157
|
+
millis: 1800000
|
|
158
|
+
}}
|
|
159
|
+
``` */
|
|
160
|
+
"intervalOptions"?: OrAttributeBarChart['intervalOptions'];
|
|
161
|
+
/** The key value of the selected option from intervalOptions, such as "30minute", "hour" or "week".
|
|
162
|
+
In combination with the active formula in datapointQuery, such as AVG and MIN/MAX, it will show a '5 minute' average of the past hour. */
|
|
163
|
+
"interval"?: OrAttributeBarChart['interval'];
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type CustomElements = {
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
*
|
|
174
|
+
* ## Attributes & Properties
|
|
175
|
+
*
|
|
176
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
177
|
+
*
|
|
178
|
+
* - `assets`: Asset data to display in the bar chart. This array needs to be populated.
|
|
179
|
+
* Used for the chart legend, information about units, and retrieval of data points.
|
|
180
|
+
* - `assetAttributes`: List of attributes to display in the bar chart. This array needs to be populated.
|
|
181
|
+
* Used for the chart legend, and the retrieval of data points.
|
|
182
|
+
* Formatted as a JSON array of;
|
|
183
|
+
*
|
|
184
|
+
* ```[<index of assets>, Attribute]```
|
|
185
|
+
* - `realm`: Realm name to associate all the chart data with.
|
|
186
|
+
* - `attributeColors`: The list of HEX colors representing the line color for each AttributeRef.
|
|
187
|
+
* Acts as an override, and will fall back to the colors attribute if not specified.
|
|
188
|
+
* The AttributeRef object with Asset ID and Attribute name need to be present in the Chart to work.
|
|
189
|
+
* The HEX color should be put in without '#' prefix. For example, you'd use '4d9d2a' instead of '#4d9d2a'.
|
|
190
|
+
* - `attributeConfig`: The attribute configuration object with, for example, a list of right-axis attributes.
|
|
191
|
+
* See BarChartAttributeConfig for full documentation on the options.
|
|
192
|
+
* - `colors`: List of colors to display attributes values with inside the bar chart.
|
|
193
|
+
* The array corresponds with assetAttributes, so the 1st color will be used for the 1st attribute.
|
|
194
|
+
* - `datapointQuery`: The query object to request attribute data / data points with.
|
|
195
|
+
* Normally, it's of type AssetDatapointIntervalQuery, including a start- and end time.
|
|
196
|
+
* - `timeframe`: Selected timeframe using a [start date, end date] array format.
|
|
197
|
+
* - `chartOptions`: Custom ECharts options object to configure the chart appearance.
|
|
198
|
+
* See their documentation for more info: https://echarts.apache.org/en/option.html
|
|
199
|
+
* - `showLegend`: Shows a right-side legend with the list of visible attributes.
|
|
200
|
+
* - `denseLegend`: Shows the right-side legend (toggled with showLegend) in a compact / dense format.
|
|
201
|
+
* - `stacked`: Displays the bar chart in a vertically "stacked" configuration.
|
|
202
|
+
* It will display a cumulative effect of all data series on top of each other.
|
|
203
|
+
* - `timestampControls`: Enables time control for the user, allowing them to customize the timeframe shown.
|
|
204
|
+
* Leaving this disabled/unset will show them in a "read-only" state.
|
|
205
|
+
* - `decimals`: Number of decimals to display for attributes.
|
|
206
|
+
* - `timePrefixOptions`: A JSON array list of strings that represent the prefix options in the UI, such as "current" or "last".
|
|
207
|
+
* In combination with timeWindowOptions, it provides a timeframe like "current 1 hour" to display data of.
|
|
208
|
+
* - `timePrefixKey`: The selected option from timePrefixOptions, such as "current" or "last".
|
|
209
|
+
* In combination with timeWindowOptions, it provides a timeframe like "current 1 hour" to display data of.
|
|
210
|
+
* - `timeWindowOptions`: A JSON object containing a list of time window options, like "1 day", "6 hours" or "52 weeks".
|
|
211
|
+
* In combination with timePrefixOptions, it provides a timeframe like "last 6 hours" to display data of.
|
|
212
|
+
* The input should contain a JavaScript Map, containing the following:
|
|
213
|
+
* - A string with a unique key like "6hours",
|
|
214
|
+
* - A combination of any moment.unitOfTime.DurationConstructor and number, like ["hours", 6]
|
|
215
|
+
*
|
|
216
|
+
* Example input: `{"6hours": ["hours", 6], "4weeks": ["weeks", 4]}`
|
|
217
|
+
* - `timeWindowKey`: The key value of the selected option from timeWindowOptions, such as "1day", "6hours" or "52weeks".
|
|
218
|
+
* In combination with timePrefixOptions, it provides a timeframe like "last 6 hours" to display data of.
|
|
219
|
+
* - `intervalOptions`: A JSON object containing a list of interval options, like "30minutes", "hour" or "day".
|
|
220
|
+
* It determines the interval to display data in sections. For example, split the data every 5 minutes of the past hour.
|
|
221
|
+
* In combination with the active formula in datapointQuery, such as AVG and MIN/MAX, it will show a '5 minute' average of the past hour.
|
|
222
|
+
* The input should contain a JavaScript Map, containing the following:
|
|
223
|
+
* - A BarChartInterval string with a unique key like "hour" or "day",
|
|
224
|
+
* - A IntervalConfig object with details on the interval, such as the display name and the unit of time.
|
|
225
|
+
*
|
|
226
|
+
* Example input:
|
|
227
|
+
* ```
|
|
228
|
+
* {"30minutes": {
|
|
229
|
+
* displayName: "30Minutes", // translated automatically
|
|
230
|
+
* steps: 30,
|
|
231
|
+
* orFormat: "minute",
|
|
232
|
+
* momentFormat: "minutes", // using moment.js format
|
|
233
|
+
* millis: 1800000
|
|
234
|
+
* }}
|
|
235
|
+
* ```
|
|
236
|
+
* - `interval`: The key value of the selected option from intervalOptions, such as "30minute", "hour" or "week".
|
|
237
|
+
* In combination with the active formula in datapointQuery, such as AVG and MIN/MAX, it will show a '5 minute' average of the past hour.
|
|
238
|
+
*
|
|
239
|
+
* ## Methods
|
|
240
|
+
*
|
|
241
|
+
* Methods that can be called to access component functionality.
|
|
242
|
+
*
|
|
243
|
+
* - `getDefaultTimePrefixOptions() => string[]`: undefined
|
|
244
|
+
* - `getDefaultTimeWindowOptions() => Map<string, [moment.unitOfTime.DurationConstructor, number]>`: undefined
|
|
245
|
+
* - `getDefaultIntervalOptions() => Map<BarChartInterval, IntervalConfig>`: undefined
|
|
246
|
+
*/
|
|
247
|
+
"or-attribute-barchart": Partial<OrAttributeBarChartProps & BaseProps<OrAttributeBarChart> & BaseEvents>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type CustomCssProperties = {
|
|
251
|
+
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
declare module 'react' {
|
|
256
|
+
namespace JSX {
|
|
257
|
+
interface IntrinsicElements extends CustomElements {}
|
|
258
|
+
}
|
|
259
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
declare module 'preact' {
|
|
263
|
+
namespace JSX {
|
|
264
|
+
interface IntrinsicElements extends CustomElements {}
|
|
265
|
+
}
|
|
266
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare module '@builder.io/qwik' {
|
|
270
|
+
namespace JSX {
|
|
271
|
+
interface IntrinsicElements extends CustomElements {}
|
|
272
|
+
}
|
|
273
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
declare module '@stencil/core' {
|
|
277
|
+
namespace JSX {
|
|
278
|
+
interface IntrinsicElements extends CustomElements {}
|
|
279
|
+
}
|
|
280
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare module 'hono/jsx' {
|
|
284
|
+
namespace JSX {
|
|
285
|
+
interface IntrinsicElements extends CustomElements {}
|
|
286
|
+
}
|
|
287
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
declare module 'react-native' {
|
|
291
|
+
namespace JSX {
|
|
292
|
+
interface IntrinsicElements extends CustomElements {}
|
|
293
|
+
}
|
|
294
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare global {
|
|
298
|
+
namespace JSX {
|
|
299
|
+
interface IntrinsicElements extends CustomElements {}
|
|
300
|
+
}
|
|
301
|
+
export interface CSSProperties extends CustomCssProperties {}
|
|
302
|
+
}
|
package/custom-elements.json
CHANGED
|
@@ -683,6 +683,9 @@
|
|
|
683
683
|
"type": {
|
|
684
684
|
"text": "string[]"
|
|
685
685
|
}
|
|
686
|
+
},
|
|
687
|
+
"type": {
|
|
688
|
+
"text": "getDefaultTimePrefixOptions() => string[]"
|
|
686
689
|
}
|
|
687
690
|
},
|
|
688
691
|
{
|
|
@@ -694,6 +697,9 @@
|
|
|
694
697
|
"type": {
|
|
695
698
|
"text": "Map<string, [moment.unitOfTime.DurationConstructor, number]>"
|
|
696
699
|
}
|
|
700
|
+
},
|
|
701
|
+
"type": {
|
|
702
|
+
"text": "getDefaultTimeWindowOptions() => Map<string, [moment.unitOfTime.DurationConstructor, number]>"
|
|
697
703
|
}
|
|
698
704
|
},
|
|
699
705
|
{
|
|
@@ -705,6 +711,9 @@
|
|
|
705
711
|
"type": {
|
|
706
712
|
"text": "Map<BarChartInterval, IntervalConfig>"
|
|
707
713
|
}
|
|
714
|
+
},
|
|
715
|
+
"type": {
|
|
716
|
+
"text": "getDefaultIntervalOptions() => Map<BarChartInterval, IntervalConfig>"
|
|
708
717
|
}
|
|
709
718
|
}
|
|
710
719
|
],
|
|
@@ -887,7 +896,9 @@
|
|
|
887
896
|
"package": "lit"
|
|
888
897
|
},
|
|
889
898
|
"tagName": "or-attribute-barchart",
|
|
890
|
-
"customElement": true
|
|
899
|
+
"customElement": true,
|
|
900
|
+
"modulePath": "src/index.ts",
|
|
901
|
+
"definitionPath": "src/index.ts"
|
|
891
902
|
}
|
|
892
903
|
],
|
|
893
904
|
"exports": [
|