@openremote/or-chart 1.6.0-snapshot.20250519123755 → 1.6.2
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/custom-elements.json +211 -47
- package/dist/umd/index.bundle.js +4 -4
- package/dist/umd/index.js +4 -4
- package/dist/umd/index.orbundle.js +16 -16
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +10 -10
package/custom-elements.json
CHANGED
|
@@ -43,12 +43,6 @@
|
|
|
43
43
|
"static": true,
|
|
44
44
|
"default": "\"L HH:mm:ss\""
|
|
45
45
|
},
|
|
46
|
-
{
|
|
47
|
-
"kind": "field",
|
|
48
|
-
"name": "styles",
|
|
49
|
-
"static": true,
|
|
50
|
-
"readonly": true
|
|
51
|
-
},
|
|
52
46
|
{
|
|
53
47
|
"kind": "field",
|
|
54
48
|
"name": "assets",
|
|
@@ -56,7 +50,8 @@
|
|
|
56
50
|
"text": "Asset[]"
|
|
57
51
|
},
|
|
58
52
|
"privacy": "public",
|
|
59
|
-
"default": "[]"
|
|
53
|
+
"default": "[]",
|
|
54
|
+
"attribute": "assets"
|
|
60
55
|
},
|
|
61
56
|
{
|
|
62
57
|
"kind": "field",
|
|
@@ -64,7 +59,8 @@
|
|
|
64
59
|
"type": {
|
|
65
60
|
"text": "Asset | undefined"
|
|
66
61
|
},
|
|
67
|
-
"privacy": "private"
|
|
62
|
+
"privacy": "private",
|
|
63
|
+
"attribute": "activeAsset"
|
|
68
64
|
},
|
|
69
65
|
{
|
|
70
66
|
"kind": "field",
|
|
@@ -73,7 +69,8 @@
|
|
|
73
69
|
"text": "[number, Attribute<any>][]"
|
|
74
70
|
},
|
|
75
71
|
"privacy": "public",
|
|
76
|
-
"default": "[]"
|
|
72
|
+
"default": "[]",
|
|
73
|
+
"attribute": "assetAttributes"
|
|
77
74
|
},
|
|
78
75
|
{
|
|
79
76
|
"kind": "field",
|
|
@@ -82,7 +79,8 @@
|
|
|
82
79
|
"text": "AttributeRef[]"
|
|
83
80
|
},
|
|
84
81
|
"privacy": "public",
|
|
85
|
-
"default": "[]"
|
|
82
|
+
"default": "[]",
|
|
83
|
+
"attribute": "rightAxisAttributes"
|
|
86
84
|
},
|
|
87
85
|
{
|
|
88
86
|
"kind": "field",
|
|
@@ -90,7 +88,8 @@
|
|
|
90
88
|
"type": {
|
|
91
89
|
"text": "(startOfPeriod: number, endOfPeriod: number, timeUnits: TimeUnit, stepSize: number) => Promise<ChartDataset<\"line\", ScatterDataPoint[]>[]> | undefined"
|
|
92
90
|
},
|
|
93
|
-
"privacy": "public"
|
|
91
|
+
"privacy": "public",
|
|
92
|
+
"attribute": "dataProvider"
|
|
94
93
|
},
|
|
95
94
|
{
|
|
96
95
|
"kind": "field",
|
|
@@ -99,7 +98,8 @@
|
|
|
99
98
|
"text": "string[]"
|
|
100
99
|
},
|
|
101
100
|
"privacy": "public",
|
|
102
|
-
"default": "[\"#3869B1\", \"#DA7E30\", \"#3F9852\", \"#CC2428\", \"#6B4C9A\", \"#922427\", \"#958C3D\", \"#535055\"]"
|
|
101
|
+
"default": "[\"#3869B1\", \"#DA7E30\", \"#3F9852\", \"#CC2428\", \"#6B4C9A\", \"#922427\", \"#958C3D\", \"#535055\"]",
|
|
102
|
+
"attribute": "colors"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
"kind": "field",
|
|
@@ -108,7 +108,8 @@
|
|
|
108
108
|
"text": "AssetDatapointQueryUnion"
|
|
109
109
|
},
|
|
110
110
|
"privacy": "public",
|
|
111
|
-
"readonly": true
|
|
111
|
+
"readonly": true,
|
|
112
|
+
"attribute": "datapointQuery"
|
|
112
113
|
},
|
|
113
114
|
{
|
|
114
115
|
"kind": "field",
|
|
@@ -116,7 +117,8 @@
|
|
|
116
117
|
"type": {
|
|
117
118
|
"text": "OrChartConfig | undefined"
|
|
118
119
|
},
|
|
119
|
-
"privacy": "public"
|
|
120
|
+
"privacy": "public",
|
|
121
|
+
"attribute": "config"
|
|
120
122
|
},
|
|
121
123
|
{
|
|
122
124
|
"kind": "field",
|
|
@@ -124,7 +126,8 @@
|
|
|
124
126
|
"type": {
|
|
125
127
|
"text": "any | undefined"
|
|
126
128
|
},
|
|
127
|
-
"privacy": "public"
|
|
129
|
+
"privacy": "public",
|
|
130
|
+
"attribute": "chartOptions"
|
|
128
131
|
},
|
|
129
132
|
{
|
|
130
133
|
"kind": "field",
|
|
@@ -132,7 +135,8 @@
|
|
|
132
135
|
"type": {
|
|
133
136
|
"text": "string | undefined"
|
|
134
137
|
},
|
|
135
|
-
"privacy": "public"
|
|
138
|
+
"privacy": "public",
|
|
139
|
+
"attribute": "realm"
|
|
136
140
|
},
|
|
137
141
|
{
|
|
138
142
|
"kind": "field",
|
|
@@ -140,7 +144,8 @@
|
|
|
140
144
|
"type": {
|
|
141
145
|
"text": "string | undefined"
|
|
142
146
|
},
|
|
143
|
-
"privacy": "public"
|
|
147
|
+
"privacy": "public",
|
|
148
|
+
"attribute": "panelName"
|
|
144
149
|
},
|
|
145
150
|
{
|
|
146
151
|
"kind": "field",
|
|
@@ -149,7 +154,8 @@
|
|
|
149
154
|
"text": "boolean"
|
|
150
155
|
},
|
|
151
156
|
"privacy": "public",
|
|
152
|
-
"default": "true"
|
|
157
|
+
"default": "true",
|
|
158
|
+
"attribute": "attributeControls"
|
|
153
159
|
},
|
|
154
160
|
{
|
|
155
161
|
"kind": "field",
|
|
@@ -157,7 +163,8 @@
|
|
|
157
163
|
"type": {
|
|
158
164
|
"text": "[Date, Date] | undefined"
|
|
159
165
|
},
|
|
160
|
-
"privacy": "public"
|
|
166
|
+
"privacy": "public",
|
|
167
|
+
"attribute": "timeframe"
|
|
161
168
|
},
|
|
162
169
|
{
|
|
163
170
|
"kind": "field",
|
|
@@ -166,7 +173,8 @@
|
|
|
166
173
|
"text": "boolean"
|
|
167
174
|
},
|
|
168
175
|
"privacy": "public",
|
|
169
|
-
"default": "true"
|
|
176
|
+
"default": "true",
|
|
177
|
+
"attribute": "timestampControls"
|
|
170
178
|
},
|
|
171
179
|
{
|
|
172
180
|
"kind": "field",
|
|
@@ -174,7 +182,8 @@
|
|
|
174
182
|
"type": {
|
|
175
183
|
"text": "Map<string, TimePresetCallback> | undefined"
|
|
176
184
|
},
|
|
177
|
-
"privacy": "public"
|
|
185
|
+
"privacy": "public",
|
|
186
|
+
"attribute": "timePresetOptions"
|
|
178
187
|
},
|
|
179
188
|
{
|
|
180
189
|
"kind": "field",
|
|
@@ -182,7 +191,8 @@
|
|
|
182
191
|
"type": {
|
|
183
192
|
"text": "string | undefined"
|
|
184
193
|
},
|
|
185
|
-
"privacy": "public"
|
|
194
|
+
"privacy": "public",
|
|
195
|
+
"attribute": "timePresetKey"
|
|
186
196
|
},
|
|
187
197
|
{
|
|
188
198
|
"kind": "field",
|
|
@@ -191,7 +201,8 @@
|
|
|
191
201
|
"text": "boolean"
|
|
192
202
|
},
|
|
193
203
|
"privacy": "public",
|
|
194
|
-
"default": "true"
|
|
204
|
+
"default": "true",
|
|
205
|
+
"attribute": "showLegend"
|
|
195
206
|
},
|
|
196
207
|
{
|
|
197
208
|
"kind": "field",
|
|
@@ -200,7 +211,8 @@
|
|
|
200
211
|
"text": "boolean"
|
|
201
212
|
},
|
|
202
213
|
"privacy": "public",
|
|
203
|
-
"default": "false"
|
|
214
|
+
"default": "false",
|
|
215
|
+
"attribute": "denseLegend"
|
|
204
216
|
},
|
|
205
217
|
{
|
|
206
218
|
"kind": "field",
|
|
@@ -209,7 +221,8 @@
|
|
|
209
221
|
"text": "boolean"
|
|
210
222
|
},
|
|
211
223
|
"privacy": "protected",
|
|
212
|
-
"default": "false"
|
|
224
|
+
"default": "false",
|
|
225
|
+
"attribute": "_loading"
|
|
213
226
|
},
|
|
214
227
|
{
|
|
215
228
|
"kind": "field",
|
|
@@ -218,7 +231,8 @@
|
|
|
218
231
|
"text": "ChartDataset<\"line\", ScatterDataPoint[]>[] | undefined"
|
|
219
232
|
},
|
|
220
233
|
"privacy": "protected",
|
|
221
|
-
"default": "undefined"
|
|
234
|
+
"default": "undefined",
|
|
235
|
+
"attribute": "_data"
|
|
222
236
|
},
|
|
223
237
|
{
|
|
224
238
|
"kind": "field",
|
|
@@ -226,7 +240,8 @@
|
|
|
226
240
|
"type": {
|
|
227
241
|
"text": "TemplateResult | undefined"
|
|
228
242
|
},
|
|
229
|
-
"privacy": "protected"
|
|
243
|
+
"privacy": "protected",
|
|
244
|
+
"attribute": "_tableTemplate"
|
|
230
245
|
},
|
|
231
246
|
{
|
|
232
247
|
"kind": "field",
|
|
@@ -300,22 +315,6 @@
|
|
|
300
315
|
},
|
|
301
316
|
"privacy": "protected"
|
|
302
317
|
},
|
|
303
|
-
{
|
|
304
|
-
"kind": "method",
|
|
305
|
-
"name": "firstUpdated"
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"kind": "method",
|
|
309
|
-
"name": "updated",
|
|
310
|
-
"parameters": [
|
|
311
|
-
{
|
|
312
|
-
"name": "changedProperties",
|
|
313
|
-
"type": {
|
|
314
|
-
"text": "PropertyValues"
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
]
|
|
318
|
-
},
|
|
319
318
|
{
|
|
320
319
|
"kind": "method",
|
|
321
320
|
"name": "applyChartResponsiveness",
|
|
@@ -325,10 +324,6 @@
|
|
|
325
324
|
}
|
|
326
325
|
}
|
|
327
326
|
},
|
|
328
|
-
{
|
|
329
|
-
"kind": "method",
|
|
330
|
-
"name": "render"
|
|
331
|
-
},
|
|
332
327
|
{
|
|
333
328
|
"kind": "method",
|
|
334
329
|
"name": "_onTreeSelectionChanged",
|
|
@@ -587,6 +582,166 @@
|
|
|
587
582
|
}
|
|
588
583
|
}
|
|
589
584
|
],
|
|
585
|
+
"attributes": [
|
|
586
|
+
{
|
|
587
|
+
"name": "assets",
|
|
588
|
+
"type": {
|
|
589
|
+
"text": "Asset[]"
|
|
590
|
+
},
|
|
591
|
+
"default": "[]",
|
|
592
|
+
"fieldName": "assets"
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
"name": "activeAsset",
|
|
596
|
+
"type": {
|
|
597
|
+
"text": "Asset | undefined"
|
|
598
|
+
},
|
|
599
|
+
"fieldName": "activeAsset"
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"name": "assetAttributes",
|
|
603
|
+
"type": {
|
|
604
|
+
"text": "[number, Attribute<any>][]"
|
|
605
|
+
},
|
|
606
|
+
"default": "[]",
|
|
607
|
+
"fieldName": "assetAttributes"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
"name": "rightAxisAttributes",
|
|
611
|
+
"type": {
|
|
612
|
+
"text": "AttributeRef[]"
|
|
613
|
+
},
|
|
614
|
+
"default": "[]",
|
|
615
|
+
"fieldName": "rightAxisAttributes"
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "dataProvider",
|
|
619
|
+
"type": {
|
|
620
|
+
"text": "(startOfPeriod: number, endOfPeriod: number, timeUnits: TimeUnit, stepSize: number) => Promise<ChartDataset<\"line\", ScatterDataPoint[]>[]> | undefined"
|
|
621
|
+
},
|
|
622
|
+
"fieldName": "dataProvider"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
"name": "colors",
|
|
626
|
+
"type": {
|
|
627
|
+
"text": "string[]"
|
|
628
|
+
},
|
|
629
|
+
"default": "[\"#3869B1\", \"#DA7E30\", \"#3F9852\", \"#CC2428\", \"#6B4C9A\", \"#922427\", \"#958C3D\", \"#535055\"]",
|
|
630
|
+
"fieldName": "colors"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "datapointQuery",
|
|
634
|
+
"type": {
|
|
635
|
+
"text": "AssetDatapointQueryUnion"
|
|
636
|
+
},
|
|
637
|
+
"readonly": true,
|
|
638
|
+
"fieldName": "datapointQuery"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"name": "config",
|
|
642
|
+
"type": {
|
|
643
|
+
"text": "OrChartConfig | undefined"
|
|
644
|
+
},
|
|
645
|
+
"fieldName": "config"
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
"name": "chartOptions",
|
|
649
|
+
"type": {
|
|
650
|
+
"text": "any | undefined"
|
|
651
|
+
},
|
|
652
|
+
"fieldName": "chartOptions"
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
"name": "realm",
|
|
656
|
+
"type": {
|
|
657
|
+
"text": "string | undefined"
|
|
658
|
+
},
|
|
659
|
+
"fieldName": "realm"
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
"name": "panelName",
|
|
663
|
+
"type": {
|
|
664
|
+
"text": "string | undefined"
|
|
665
|
+
},
|
|
666
|
+
"fieldName": "panelName"
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
"name": "attributeControls",
|
|
670
|
+
"type": {
|
|
671
|
+
"text": "boolean"
|
|
672
|
+
},
|
|
673
|
+
"default": "true",
|
|
674
|
+
"fieldName": "attributeControls"
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
"name": "timeframe",
|
|
678
|
+
"type": {
|
|
679
|
+
"text": "[Date, Date] | undefined"
|
|
680
|
+
},
|
|
681
|
+
"fieldName": "timeframe"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"name": "timestampControls",
|
|
685
|
+
"type": {
|
|
686
|
+
"text": "boolean"
|
|
687
|
+
},
|
|
688
|
+
"default": "true",
|
|
689
|
+
"fieldName": "timestampControls"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"name": "timePresetOptions",
|
|
693
|
+
"type": {
|
|
694
|
+
"text": "Map<string, TimePresetCallback> | undefined"
|
|
695
|
+
},
|
|
696
|
+
"fieldName": "timePresetOptions"
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
"name": "timePresetKey",
|
|
700
|
+
"type": {
|
|
701
|
+
"text": "string | undefined"
|
|
702
|
+
},
|
|
703
|
+
"fieldName": "timePresetKey"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
"name": "showLegend",
|
|
707
|
+
"type": {
|
|
708
|
+
"text": "boolean"
|
|
709
|
+
},
|
|
710
|
+
"default": "true",
|
|
711
|
+
"fieldName": "showLegend"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
"name": "denseLegend",
|
|
715
|
+
"type": {
|
|
716
|
+
"text": "boolean"
|
|
717
|
+
},
|
|
718
|
+
"default": "false",
|
|
719
|
+
"fieldName": "denseLegend"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"name": "_loading",
|
|
723
|
+
"type": {
|
|
724
|
+
"text": "boolean"
|
|
725
|
+
},
|
|
726
|
+
"default": "false",
|
|
727
|
+
"fieldName": "_loading"
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"name": "_data",
|
|
731
|
+
"type": {
|
|
732
|
+
"text": "ChartDataset<\"line\", ScatterDataPoint[]>[] | undefined"
|
|
733
|
+
},
|
|
734
|
+
"default": "undefined",
|
|
735
|
+
"fieldName": "_data"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"name": "_tableTemplate",
|
|
739
|
+
"type": {
|
|
740
|
+
"text": "TemplateResult | undefined"
|
|
741
|
+
},
|
|
742
|
+
"fieldName": "_tableTemplate"
|
|
743
|
+
}
|
|
744
|
+
],
|
|
590
745
|
"mixins": [
|
|
591
746
|
{
|
|
592
747
|
"name": "translate(i18next)",
|
|
@@ -597,6 +752,7 @@
|
|
|
597
752
|
"name": "LitElement",
|
|
598
753
|
"package": "lit"
|
|
599
754
|
},
|
|
755
|
+
"tagName": "or-chart",
|
|
600
756
|
"customElement": true
|
|
601
757
|
}
|
|
602
758
|
],
|
|
@@ -616,6 +772,14 @@
|
|
|
616
772
|
"name": "OrChart",
|
|
617
773
|
"module": "src/index.ts"
|
|
618
774
|
}
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
"kind": "custom-element-definition",
|
|
778
|
+
"name": "or-chart",
|
|
779
|
+
"declaration": {
|
|
780
|
+
"name": "OrChart",
|
|
781
|
+
"module": "src/index.ts"
|
|
782
|
+
}
|
|
619
783
|
}
|
|
620
784
|
]
|
|
621
785
|
}
|
package/dist/umd/index.bundle.js
CHANGED
|
@@ -974,10 +974,10 @@
|
|
|
974
974
|
<div class="period-controls">
|
|
975
975
|
${this.timePresetOptions&&this.timePresetKey?N`
|
|
976
976
|
${this.timestampControls?N`
|
|
977
|
-
${function(t,e,n,i,r,a=!1,o=!0,s=!1,l=!1){return N`
|
|
977
|
+
${function(t,e,n,i,r,a=!1,o=!0,s=!1,l=!1,d="menu",c=!1){let u=null;return N`
|
|
978
978
|
<span>
|
|
979
|
-
<span @click="${t=>{e&&t.currentTarget.parentElement.lastElementChild.open()}}">${t}</span>
|
|
980
|
-
${e?N`<or-mwc-menu ?multiselect="${a}" @or-mwc-menu-closed="${()=>{r&&r()}}" @or-mwc-menu-changed="${t=>{i&&i(t.detail)}}" .translateValues="${o}" .values="${n}" .menuItems="${e}" .midHeight="${s}" .fullWidth="${l}" id="
|
|
979
|
+
<span @click="${t=>{if(e){if(c&&u){const e=t.currentTarget;!function(t,e){e||(e=document.body);const n=e.getBoundingClientRect();Object.assign(t.style,{position:"fixed",top:`${n.bottom}px`,left:`${n.left}px`,zIndex:"1000",display:"block"})}(u,e)}t.currentTarget.parentElement.lastElementChild.open()}}}">${t}</span>
|
|
980
|
+
${e?N`<or-mwc-menu ?multiselect="${a}" @or-mwc-menu-closed="${()=>{r&&r()}}" @or-mwc-menu-changed="${t=>{i&&i(t.detail)}}" .translateValues="${o}" .values="${n}" .menuItems="${e}" .midHeight="${s}" .fullWidth="${l}" id="${d}" ${pn((t=>u=t))}></or-mwc-menu>`:""}
|
|
981
981
|
</span>
|
|
982
982
|
`}(N`<or-mwc-input .type="${Ca.BUTTON}" label="${this.timeframe?"dashboard.customTimeSpan":this.timePresetKey}"></or-mwc-input>`,Array.from(this.timePresetOptions.keys()).map((t=>({value:t}))),this.timePresetKey,(t=>{this.timeframe=void 0,this.timePresetKey=t.toString()}),void 0,void 0,void 0,!0)}
|
|
983
983
|
<!-- Button that opens custom time selection -->
|
|
@@ -1033,7 +1033,7 @@
|
|
|
1033
1033
|
</div>
|
|
1034
1034
|
`:void 0}
|
|
1035
1035
|
</div>
|
|
1036
|
-
`}_onTreeSelectionChanged(t){return Tp(this,void 0,void 0,(function*(){if(!Ue().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Ue().events.sendEventWithReply({eventType:"read-asset",assetId:e.asset.id});this.activeAsset=t.asset}else this.activeAsset=void 0}))}removeDatasetHighlight(t){this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((t,e)=>{t.borderColor&&"string"==typeof t.borderColor&&9===t.borderColor.length&&(t.borderColor=t.borderColor.slice(0,-2),t.backgroundColor=t.borderColor)})),this._chart.update())}addDatasetHighlight(t,e){t&&e&&this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((n,i)=>{n.assetId===t&&n.attrName===e||(n.borderColor=n.borderColor+"36",n.backgroundColor=n.borderColor)})),this._chart.update())}loadSettings(t){var e;return Tp(this,void 0,void 0,(function*(){if((null==this.assetAttributes||t)&&(this.assetAttributes=[]),this.realm||(this.realm=Ue().getRealm()),this.timePresetOptions||(this.timePresetOptions=this._getDefaultTimestampOptions()),this.timePresetKey||(this.timePresetKey=null===(e=this.timePresetOptions.keys().next().value)||void 0===e?void 0:e.toString()),!this.panelName)return;const n=window.location.hash,i=(yield Ue().console.retrieveData("OrChartConfig"))||[];Array.isArray(i)||Ue().console.storeData("OrChartConfig",[i]);let r=i.find((t=>t.realm===this.realm));if(!r)return;const a=r.views&&r.views[n]?r.views[n][this.panelName]:void 0;if(!a)return;if(!a.attributeRefs){delete r.views[n][this.panelName];const t=[...i.filter((t=>t.realm!==this.realm)),r];return void Ue().console.storeData("OrChartConfig",t)}const o=a.attributeRefs.map((t=>t.id));if(0!==o.length&&(this._loading=!0,!o.every((t=>!!this.assets.find((e=>e.id===t)))))){const t={ids:o};try{const e=(yield Ue().rest.api.AssetResource.queryAssets(t)).data||[];a.attributeRefs=a.attributeRefs.filter((t=>!!e.find((e=>e.id===t.id&&e.attributes&&e.attributes.hasOwnProperty(t.name))))),Ue().console.storeData("OrChartConfig",[...i.filter((t=>t.realm!==this.realm)),r]),this.assets=e.filter((t=>a.attributeRefs.find((e=>e.id===t.id))))}catch(t){console.error("Failed to get assets requested in settings",t)}this._loading=!1,this.assets&&this.assets.length>0&&(this.assetAttributes=a.attributeRefs.map((t=>{const e=this.assets.findIndex((e=>e.id===t.id)),n=e>=0?this.assets[e]:void 0;return n&&n.attributes?[e,n.attributes[t.name]]:void 0})).filter((t=>!!t)))}}))}saveSettings(){return Tp(this,void 0,void 0,(function*(){if(!this.panelName)return;const t=window.location.hash,e=(yield Ue().console.retrieveData("OrChartConfig"))||[];let n=e.find((t=>t.realm===this.realm));n||(n={realm:this.realm,views:{}}),n.views[t]||(n.views[t]={}),this.assets&&this.assetAttributes&&0!==this.assets.length&&0!==this.assetAttributes.length?(n.realm=this.realm,n.views[t][this.panelName]={attributeRefs:this.assetAttributes.map((([t,e])=>{const n=this.assets[t];return n?{id:n.id,name:e.name}:void 0})).filter((t=>!!t))}):delete n.views[t][this.panelName],Ue().console.storeData("OrChartConfig",[...e.filter((t=>t.realm!==this.realm)),n])}))}_openDialog(){up((new Jh.
|
|
1036
|
+
`}_onTreeSelectionChanged(t){return Tp(this,void 0,void 0,(function*(){if(!Ue().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Ue().events.sendEventWithReply({eventType:"read-asset",assetId:e.asset.id});this.activeAsset=t.asset}else this.activeAsset=void 0}))}removeDatasetHighlight(t){this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((t,e)=>{t.borderColor&&"string"==typeof t.borderColor&&9===t.borderColor.length&&(t.borderColor=t.borderColor.slice(0,-2),t.backgroundColor=t.borderColor)})),this._chart.update())}addDatasetHighlight(t,e){t&&e&&this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((n,i)=>{n.assetId===t&&n.attrName===e||(n.borderColor=n.borderColor+"36",n.backgroundColor=n.borderColor)})),this._chart.update())}loadSettings(t){var e;return Tp(this,void 0,void 0,(function*(){if((null==this.assetAttributes||t)&&(this.assetAttributes=[]),this.realm||(this.realm=Ue().getRealm()),this.timePresetOptions||(this.timePresetOptions=this._getDefaultTimestampOptions()),this.timePresetKey||(this.timePresetKey=null===(e=this.timePresetOptions.keys().next().value)||void 0===e?void 0:e.toString()),!this.panelName)return;const n=window.location.hash,i=(yield Ue().console.retrieveData("OrChartConfig"))||[];Array.isArray(i)||Ue().console.storeData("OrChartConfig",[i]);let r=i.find((t=>t.realm===this.realm));if(!r)return;const a=r.views&&r.views[n]?r.views[n][this.panelName]:void 0;if(!a)return;if(!a.attributeRefs){delete r.views[n][this.panelName];const t=[...i.filter((t=>t.realm!==this.realm)),r];return void Ue().console.storeData("OrChartConfig",t)}const o=a.attributeRefs.map((t=>t.id));if(0!==o.length&&(this._loading=!0,!o.every((t=>!!this.assets.find((e=>e.id===t)))))){const t={ids:o};try{const e=(yield Ue().rest.api.AssetResource.queryAssets(t)).data||[];a.attributeRefs=a.attributeRefs.filter((t=>!!e.find((e=>e.id===t.id&&e.attributes&&e.attributes.hasOwnProperty(t.name))))),Ue().console.storeData("OrChartConfig",[...i.filter((t=>t.realm!==this.realm)),r]),this.assets=e.filter((t=>a.attributeRefs.find((e=>e.id===t.id))))}catch(t){console.error("Failed to get assets requested in settings",t)}this._loading=!1,this.assets&&this.assets.length>0&&(this.assetAttributes=a.attributeRefs.map((t=>{const e=this.assets.findIndex((e=>e.id===t.id)),n=e>=0?this.assets[e]:void 0;return n&&n.attributes?[e,n.attributes[t.name]]:void 0})).filter((t=>!!t)))}}))}saveSettings(){return Tp(this,void 0,void 0,(function*(){if(!this.panelName)return;const t=window.location.hash,e=(yield Ue().console.retrieveData("OrChartConfig"))||[];let n=e.find((t=>t.realm===this.realm));n||(n={realm:this.realm,views:{}}),n.views[t]||(n.views[t]={}),this.assets&&this.assetAttributes&&0!==this.assets.length&&0!==this.assetAttributes.length?(n.realm=this.realm,n.views[t][this.panelName]={attributeRefs:this.assetAttributes.map((([t,e])=>{const n=this.assets[t];return n?{id:n.id,name:e.name}:void 0})).filter((t=>!!t))}):delete n.views[t][this.panelName],Ue().console.storeData("OrChartConfig",[...e.filter((t=>t.realm!==this.realm)),n])}))}_openDialog(){up((new Jh.OrAssetAttributePicker).setShowOnlyDatapointAttrs(!0).setMultiSelect(!0).setSelectedAttributes(this._getSelectedAttributes())).addEventListener(Jh.OrAssetAttributePickerPickedEvent.NAME,(t=>this._addAttribute(t.detail)))}_openTimeDialog(t,e){const n=un(),i=un();up((new hp).setHeading(We.t("timeframe")).setContent((()=>N`
|
|
1037
1037
|
<div>
|
|
1038
1038
|
<or-mwc-input ${pn(n)} type="${Ca.DATETIME}" required label="${We.t("start")}" .value="${t}"></or-mwc-input>
|
|
1039
1039
|
<or-mwc-input ${pn(i)} type="${Ca.DATETIME}" required label="${We.t("ending")}" .value="${e}"></or-mwc-input>
|
package/dist/umd/index.js
CHANGED
|
@@ -974,10 +974,10 @@
|
|
|
974
974
|
<div class="period-controls">
|
|
975
975
|
${this.timePresetOptions&&this.timePresetKey?j`
|
|
976
976
|
${this.timestampControls?j`
|
|
977
|
-
${function(t,e,n,i,r,o=!1,a=!0,l=!1,c=!1){return j`
|
|
977
|
+
${function(t,e,n,i,r,o=!1,a=!0,l=!1,c=!1,s="menu",d=!1){let p=null;return j`
|
|
978
978
|
<span>
|
|
979
|
-
<span @click="${t=>{e&&t.currentTarget.parentElement.lastElementChild.open()}}">${t}</span>
|
|
980
|
-
${e?j`<or-mwc-menu ?multiselect="${o}" @or-mwc-menu-closed="${()=>{r&&r()}}" @or-mwc-menu-changed="${t=>{i&&i(t.detail)}}" .translateValues="${a}" .values="${n}" .menuItems="${e}" .midHeight="${l}" .fullWidth="${c}" id="
|
|
979
|
+
<span @click="${t=>{if(e){if(d&&p){const e=t.currentTarget;!function(t,e){e||(e=document.body);const n=e.getBoundingClientRect();Object.assign(t.style,{position:"fixed",top:`${n.bottom}px`,left:`${n.left}px`,zIndex:"1000",display:"block"})}(p,e)}t.currentTarget.parentElement.lastElementChild.open()}}}">${t}</span>
|
|
980
|
+
${e?j`<or-mwc-menu ?multiselect="${o}" @or-mwc-menu-closed="${()=>{r&&r()}}" @or-mwc-menu-changed="${t=>{i&&i(t.detail)}}" .translateValues="${a}" .values="${n}" .menuItems="${e}" .midHeight="${l}" .fullWidth="${c}" id="${s}" ${fn((t=>p=t))}></or-mwc-menu>`:""}
|
|
981
981
|
</span>
|
|
982
982
|
`}(j`<or-mwc-input .type="${No.BUTTON}" label="${this.timeframe?"dashboard.customTimeSpan":this.timePresetKey}"></or-mwc-input>`,Array.from(this.timePresetOptions.keys()).map((t=>({value:t}))),this.timePresetKey,(t=>{this.timeframe=void 0,this.timePresetKey=t.toString()}),void 0,void 0,void 0,!0)}
|
|
983
983
|
<!-- Button that opens custom time selection -->
|
|
@@ -1033,7 +1033,7 @@
|
|
|
1033
1033
|
</div>
|
|
1034
1034
|
`:void 0}
|
|
1035
1035
|
</div>
|
|
1036
|
-
`}_onTreeSelectionChanged(t){return qc(this,void 0,void 0,(function*(){if(!Ye().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Ye().events.sendEventWithReply({eventType:"read-asset",assetId:e.asset.id});this.activeAsset=t.asset}else this.activeAsset=void 0}))}removeDatasetHighlight(t){this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((t,e)=>{t.borderColor&&"string"==typeof t.borderColor&&9===t.borderColor.length&&(t.borderColor=t.borderColor.slice(0,-2),t.backgroundColor=t.borderColor)})),this._chart.update())}addDatasetHighlight(t,e){t&&e&&this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((n,i)=>{n.assetId===t&&n.attrName===e||(n.borderColor=n.borderColor+"36",n.backgroundColor=n.borderColor)})),this._chart.update())}loadSettings(t){var e;return qc(this,void 0,void 0,(function*(){if((null==this.assetAttributes||t)&&(this.assetAttributes=[]),this.realm||(this.realm=Ye().getRealm()),this.timePresetOptions||(this.timePresetOptions=this._getDefaultTimestampOptions()),this.timePresetKey||(this.timePresetKey=null===(e=this.timePresetOptions.keys().next().value)||void 0===e?void 0:e.toString()),!this.panelName)return;const n=window.location.hash,i=(yield Ye().console.retrieveData("OrChartConfig"))||[];Array.isArray(i)||Ye().console.storeData("OrChartConfig",[i]);let r=i.find((t=>t.realm===this.realm));if(!r)return;const o=r.views&&r.views[n]?r.views[n][this.panelName]:void 0;if(!o)return;if(!o.attributeRefs){delete r.views[n][this.panelName];const t=[...i.filter((t=>t.realm!==this.realm)),r];return void Ye().console.storeData("OrChartConfig",t)}const a=o.attributeRefs.map((t=>t.id));if(0!==a.length&&(this._loading=!0,!a.every((t=>!!this.assets.find((e=>e.id===t)))))){const t={ids:a};try{const e=(yield Ye().rest.api.AssetResource.queryAssets(t)).data||[];o.attributeRefs=o.attributeRefs.filter((t=>!!e.find((e=>e.id===t.id&&e.attributes&&e.attributes.hasOwnProperty(t.name))))),Ye().console.storeData("OrChartConfig",[...i.filter((t=>t.realm!==this.realm)),r]),this.assets=e.filter((t=>o.attributeRefs.find((e=>e.id===t.id))))}catch(t){console.error("Failed to get assets requested in settings",t)}this._loading=!1,this.assets&&this.assets.length>0&&(this.assetAttributes=o.attributeRefs.map((t=>{const e=this.assets.findIndex((e=>e.id===t.id)),n=e>=0?this.assets[e]:void 0;return n&&n.attributes?[e,n.attributes[t.name]]:void 0})).filter((t=>!!t)))}}))}saveSettings(){return qc(this,void 0,void 0,(function*(){if(!this.panelName)return;const t=window.location.hash,e=(yield Ye().console.retrieveData("OrChartConfig"))||[];let n=e.find((t=>t.realm===this.realm));n||(n={realm:this.realm,views:{}}),n.views[t]||(n.views[t]={}),this.assets&&this.assetAttributes&&0!==this.assets.length&&0!==this.assetAttributes.length?(n.realm=this.realm,n.views[t][this.panelName]={attributeRefs:this.assetAttributes.map((([t,e])=>{const n=this.assets[t];return n?{id:n.id,name:e.name}:void 0})).filter((t=>!!t))}):delete n.views[t][this.panelName],Ye().console.storeData("OrChartConfig",[...e.filter((t=>t.realm!==this.realm)),n])}))}_openDialog(){Nc((new _c.
|
|
1036
|
+
`}_onTreeSelectionChanged(t){return qc(this,void 0,void 0,(function*(){if(!Ye().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Ye().events.sendEventWithReply({eventType:"read-asset",assetId:e.asset.id});this.activeAsset=t.asset}else this.activeAsset=void 0}))}removeDatasetHighlight(t){this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((t,e)=>{t.borderColor&&"string"==typeof t.borderColor&&9===t.borderColor.length&&(t.borderColor=t.borderColor.slice(0,-2),t.backgroundColor=t.borderColor)})),this._chart.update())}addDatasetHighlight(t,e){t&&e&&this._chart&&this._chart.data&&this._chart.data.datasets&&(this._chart.data.datasets.map(((n,i)=>{n.assetId===t&&n.attrName===e||(n.borderColor=n.borderColor+"36",n.backgroundColor=n.borderColor)})),this._chart.update())}loadSettings(t){var e;return qc(this,void 0,void 0,(function*(){if((null==this.assetAttributes||t)&&(this.assetAttributes=[]),this.realm||(this.realm=Ye().getRealm()),this.timePresetOptions||(this.timePresetOptions=this._getDefaultTimestampOptions()),this.timePresetKey||(this.timePresetKey=null===(e=this.timePresetOptions.keys().next().value)||void 0===e?void 0:e.toString()),!this.panelName)return;const n=window.location.hash,i=(yield Ye().console.retrieveData("OrChartConfig"))||[];Array.isArray(i)||Ye().console.storeData("OrChartConfig",[i]);let r=i.find((t=>t.realm===this.realm));if(!r)return;const o=r.views&&r.views[n]?r.views[n][this.panelName]:void 0;if(!o)return;if(!o.attributeRefs){delete r.views[n][this.panelName];const t=[...i.filter((t=>t.realm!==this.realm)),r];return void Ye().console.storeData("OrChartConfig",t)}const a=o.attributeRefs.map((t=>t.id));if(0!==a.length&&(this._loading=!0,!a.every((t=>!!this.assets.find((e=>e.id===t)))))){const t={ids:a};try{const e=(yield Ye().rest.api.AssetResource.queryAssets(t)).data||[];o.attributeRefs=o.attributeRefs.filter((t=>!!e.find((e=>e.id===t.id&&e.attributes&&e.attributes.hasOwnProperty(t.name))))),Ye().console.storeData("OrChartConfig",[...i.filter((t=>t.realm!==this.realm)),r]),this.assets=e.filter((t=>o.attributeRefs.find((e=>e.id===t.id))))}catch(t){console.error("Failed to get assets requested in settings",t)}this._loading=!1,this.assets&&this.assets.length>0&&(this.assetAttributes=o.attributeRefs.map((t=>{const e=this.assets.findIndex((e=>e.id===t.id)),n=e>=0?this.assets[e]:void 0;return n&&n.attributes?[e,n.attributes[t.name]]:void 0})).filter((t=>!!t)))}}))}saveSettings(){return qc(this,void 0,void 0,(function*(){if(!this.panelName)return;const t=window.location.hash,e=(yield Ye().console.retrieveData("OrChartConfig"))||[];let n=e.find((t=>t.realm===this.realm));n||(n={realm:this.realm,views:{}}),n.views[t]||(n.views[t]={}),this.assets&&this.assetAttributes&&0!==this.assets.length&&0!==this.assetAttributes.length?(n.realm=this.realm,n.views[t][this.panelName]={attributeRefs:this.assetAttributes.map((([t,e])=>{const n=this.assets[t];return n?{id:n.id,name:e.name}:void 0})).filter((t=>!!t))}):delete n.views[t][this.panelName],Ye().console.storeData("OrChartConfig",[...e.filter((t=>t.realm!==this.realm)),n])}))}_openDialog(){Nc((new _c.OrAssetAttributePicker).setShowOnlyDatapointAttrs(!0).setMultiSelect(!0).setSelectedAttributes(this._getSelectedAttributes())).addEventListener(_c.OrAssetAttributePickerPickedEvent.NAME,(t=>this._addAttribute(t.detail)))}_openTimeDialog(t,e){const n=pn(),i=pn();Nc((new zc).setHeading(Be.t("timeframe")).setContent((()=>j`
|
|
1037
1037
|
<div>
|
|
1038
1038
|
<or-mwc-input ${fn(n)} type="${No.DATETIME}" required label="${Be.t("start")}" .value="${t}"></or-mwc-input>
|
|
1039
1039
|
<or-mwc-input ${fn(i)} type="${No.DATETIME}" required label="${Be.t("ending")}" .value="${e}"></or-mwc-input>
|