@openremote/or-chart 1.7.0-snapshot.20250522152736 → 1.7.0-snapshot.20250527153909

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.
@@ -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.OrAttributePicker).setShowOnlyDatapointAttrs(!0).setMultiSelect(!0).setSelectedAttributes(this._getSelectedAttributes())).addEventListener(Jh.OrAttributePickerPickedEvent.NAME,(t=>this._addAttribute(t.detail)))}_openTimeDialog(t,e){const n=un(),i=un();up((new hp).setHeading(We.t("timeframe")).setContent((()=>N`
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
@@ -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.OrAttributePicker).setShowOnlyDatapointAttrs(!0).setMultiSelect(!0).setSelectedAttributes(this._getSelectedAttributes())).addEventListener(_c.OrAttributePickerPickedEvent.NAME,(t=>this._addAttribute(t.detail)))}_openTimeDialog(t,e){const n=pn(),i=pn();Nc((new zc).setHeading(Be.t("timeframe")).setContent((()=>j`
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>