@openremote/or-chart 1.2.0-snapshot.20241015145246 → 1.2.0-snapshot.20241218144812
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/dist/umd/index.bundle.js +23 -21
- package/dist/umd/index.js +9 -7
- package/dist/umd/index.orbundle.js +18 -16
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +9 -9
package/dist/umd/index.js
CHANGED
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
.mdc-list-item__graphic > or-icon {
|
|
261
261
|
pointer-events: none;
|
|
262
262
|
}
|
|
263
|
-
`;let xo=class extends dt{constructor(){super(...arguments),this.readonly=!1,this.required=!1,this.checked=!1,this.indeterminate=!1,this.multiple=!1,this.compact=!1,this.comfortable=!1,this.raised=!1,this.action=!1,this.unElevated=!1,this.outlined=!1,this.rounded=!1,this.disableSliderNumberInput=!1,this.fullWidth=!1,this.helperPersistent=!1,this.autoValidate=!1,this.charCounter=!1,this.disabled=!1,this.continuous=!1,this.resizeVertical=!1,this._selectedIndex=-1,this.isUiValid=!0}static get styles(){return[a`${o(eo)}`,a`${o(Qr)}`,a`${o(to)}`,a`${o(no)}`,a`${o(io)}`,a`${o(ro)}`,a`${o(oo)}`,a`${o(ao)}`,a`${o(lo)}`,a`${o(co)}`,a`${o(so)}`,a`${o(po)}`,a`${o(mo)}`,a`${o(fo)}`,a`${o(uo)}`,a`${o(ho)}`,_o]}get nativeValue(){if(this._mdcComponent)return this._mdcComponent.value}disconnectedCallback(){var t,e;super.disconnectedCallback(),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0,null===(t=this._menuObserver)||void 0===t||t.disconnect()),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0,null===(e=this._menuObserver)||void 0===e||e.disconnect())}shouldUpdate(t){return t.has("indeterminate")&&this._mdcComponent&&this.type===bo.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===bo.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===bo.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=bo.DATETIME:"boolean"==typeof this.value?this.type=bo.CHECKBOX:"number"==typeof this.value?this.type=bo.NUMBER:"string"==typeof this.value?this.type=bo.TEXT:this.type=bo.JSON),!0}focus(){this.type===bo.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const t=!this.fullWidth&&this.label;let e=!this.fullWidth&&this.outlined,n=!!this.helperText;const i=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),r={"mdc-text-field-helper-text--persistent":!i&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":i},o=null!==this.value&&void 0!==this.value||!1===this.value;let a=t?B`<span class="mdc-floating-label ${o?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case bo.RADIO:const t=this.resolveOptions(this.options);return this._selectedIndex=-1,B`
|
|
263
|
+
`;let xo=class extends dt{constructor(){super(...arguments),this.readonly=!1,this.required=!1,this.checked=!1,this.indeterminate=!1,this.multiple=!1,this.searchLabel="search",this.compact=!1,this.comfortable=!1,this.raised=!1,this.action=!1,this.unElevated=!1,this.outlined=!1,this.rounded=!1,this.disableSliderNumberInput=!1,this.fullWidth=!1,this.helperPersistent=!1,this.autoValidate=!1,this.charCounter=!1,this.disabled=!1,this.continuous=!1,this.resizeVertical=!1,this._selectedIndex=-1,this.isUiValid=!0}static get styles(){return[a`${o(eo)}`,a`${o(Qr)}`,a`${o(to)}`,a`${o(no)}`,a`${o(io)}`,a`${o(ro)}`,a`${o(oo)}`,a`${o(ao)}`,a`${o(lo)}`,a`${o(co)}`,a`${o(so)}`,a`${o(po)}`,a`${o(mo)}`,a`${o(fo)}`,a`${o(uo)}`,a`${o(ho)}`,_o]}get nativeValue(){if(this._mdcComponent)return this._mdcComponent.value}disconnectedCallback(){var t,e;super.disconnectedCallback(),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0,null===(t=this._menuObserver)||void 0===t||t.disconnect()),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0,null===(e=this._menuObserver)||void 0===e||e.disconnect())}shouldUpdate(t){return t.has("indeterminate")&&this._mdcComponent&&this.type===bo.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===bo.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===bo.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=bo.DATETIME:"boolean"==typeof this.value?this.type=bo.CHECKBOX:"number"==typeof this.value?this.type=bo.NUMBER:"string"==typeof this.value?this.type=bo.TEXT:this.type=bo.JSON),!0}focus(){this.type===bo.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const t=!this.fullWidth&&this.label;let e=!this.fullWidth&&this.outlined,n=!!this.helperText;const i=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),r={"mdc-text-field-helper-text--persistent":!i&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":i},o=null!==this.value&&void 0!==this.value||!1===this.value;let a=t?B`<span class="mdc-floating-label ${o?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case bo.RADIO:const t=this.resolveOptions(this.options);return this._selectedIndex=-1,B`
|
|
264
264
|
<div class="mdc-radio-container">
|
|
265
265
|
${t?t.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),B`
|
|
266
266
|
<div id="field" class="mdc-form-field">
|
|
@@ -345,7 +345,9 @@
|
|
|
345
345
|
<div id="mdc-select-menu" class="mdc-select__menu mdc-menu mdc-menu-surface mdc-menu-surface--fixed ${null!=this.searchProvider?"mdc-menu__searchable":void 0}" @MDCMenuSurface:closed="${u}">
|
|
346
346
|
${tn(null!=this.searchProvider,(()=>B`
|
|
347
347
|
<label id="select-searchable" class="mdc-text-field mdc-text-field--filled">
|
|
348
|
-
<span class="mdc-floating-label" style="color: rgba(0, 0, 0, 0.6); text-transform: capitalize; visibility: ${this.searchableValue?"hidden":"visible"}" id="my-label-id"
|
|
348
|
+
<span class="mdc-floating-label" style="color: rgba(0, 0, 0, 0.6); text-transform: capitalize; visibility: ${this.searchableValue?"hidden":"visible"}" id="my-label-id">
|
|
349
|
+
<or-translate .value="${this.searchLabel}"></or-translate>
|
|
350
|
+
</span>
|
|
349
351
|
<input class="mdc-text-field__input" type="text"
|
|
350
352
|
@keyup="${t=>this.searchableValue=t.target.value}"
|
|
351
353
|
/>
|
|
@@ -491,7 +493,7 @@
|
|
|
491
493
|
`:""}
|
|
492
494
|
<span class="mdc-notched-outline__trailing"></span>
|
|
493
495
|
</span>
|
|
494
|
-
`}setCustomValidity(t){this.errorMessage=t;const e=this.shadowRoot.getElementById("elem");e&&e.setCustomValidity&&e.setCustomValidity(null!=t?t:""),this.reportValidity()}checkValidity(){const t=this.shadowRoot.getElementById("elem");let e=!0;return t&&t.validity&&(e=t.validity.valid),!e||this.type!==bo.JSON&&this.type!==bo.JSON_OBJECT||void 0!==this.value&&null!==this.value&&""===this._mdcComponent.value&&(e=!1),e}reportValidity(){const t=this.checkValidity();return this.isUiValid=t,this._mdcComponent&&(this._mdcComponent.valid=t),t}onValueChange(t,e,n){var i,r;let o,a=this.value;if("undefined"===e&&(a=null,e=void 0),"null"===e&&(a=void 0,e=null),"string"==typeof e)switch(this.type){case bo.CHECKBOX:case bo.SWITCH:e="on"===e;break;case bo.JSON:case bo.JSON_OBJECT:case bo.NUMBER:case bo.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==bo.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Ie.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===bo.JSON||this.type==bo.JSON_OBJECT?Ie.i18next.t("validation.invalidJSON"):Ie.i18next.t("validation.invalidNumber")}break;case bo.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Ie.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==bo.CHECKBOX_LIST&&e!==a&&(this.type===bo.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new go(this.value,a,n))),null!=this.searchProvider&&this.type===bo.SELECT){const t=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("select-searchable"))||void 0===r?void 0:r.children[1];t&&(this.searchableValue=void 0,t.value="")}this.type!==bo.CHECKBOX_LIST||Se.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new go(e,a,n))}get valid(){const t=this.shadowRoot.getElementById("elem");return!t||!t.checkValidity||t.checkValidity()}get currentValue(){const t=this.shadowRoot.getElementById("elem");if(t&&t.value)return t.value}resolveOptions(t){let e;return t&&t.length>0&&(e=t.map((t=>{if(Array.isArray(t))return t;{const e=""+t;return[t,Ie.i18next.t(e,{defaultValue:Se.Util.camelCaseToSentenceCase(e)})]}}))),e}getSelectedTextValue(t){const e=this.value,n=Array.isArray(e)?e:null!=e?[e]:void 0;if(!n)return"";const i=t||this.resolveOptions(this.options);return i&&n?n.map((t=>i.find((([e,n],i)=>t===e)))).map((t=>t?t[1]:"")).join(", "):""}};Jr([ht({type:Boolean})],xo.prototype,"focused",void 0),Jr([ht()],xo.prototype,"value",void 0),Jr([ht({type:String})],xo.prototype,"type",void 0),Jr([ht({type:String})],xo.prototype,"name",void 0),Jr([ht({type:Boolean})],xo.prototype,"readonly",void 0),Jr([ht({type:Boolean})],xo.prototype,"required",void 0),Jr([ht()],xo.prototype,"max",void 0),Jr([ht()],xo.prototype,"min",void 0),Jr([ht({type:Number})],xo.prototype,"step",void 0),Jr([ht({type:Boolean})],xo.prototype,"checked",void 0),Jr([ht({type:Boolean})],xo.prototype,"indeterminate",void 0),Jr([ht({type:Number})],xo.prototype,"maxLength",void 0),Jr([ht({type:Number})],xo.prototype,"minLength",void 0),Jr([ht({type:Number})],xo.prototype,"rows",void 0),Jr([ht({type:Number})],xo.prototype,"cols",void 0),Jr([ht({type:Boolean})],xo.prototype,"multiple",void 0),Jr([ht({type:String,attribute:!0,reflect:!1})],xo.prototype,"pattern",void 0),Jr([ht({type:String})],xo.prototype,"placeHolder",void 0),Jr([ht({type:Array})],xo.prototype,"options",void 0),Jr([ht({type:Boolean})],xo.prototype,"autoSelect",void 0),Jr([ht({type:Object})],xo.prototype,"searchProvider",void 0),Jr([ht({type:String})],xo.prototype,"icon",void 0),Jr([ht({type:String})],xo.prototype,"iconColor",void 0),Jr([ht({type:String})],xo.prototype,"iconOn",void 0),Jr([ht({type:String})],xo.prototype,"iconTrailing",void 0),Jr([ht({type:Boolean})],xo.prototype,"compact",void 0),Jr([ht({type:Boolean})],xo.prototype,"comfortable",void 0),Jr([ht({type:Boolean})],xo.prototype,"raised",void 0),Jr([ht({type:Boolean})],xo.prototype,"action",void 0),Jr([ht({type:Boolean})],xo.prototype,"unElevated",void 0),Jr([ht({type:Boolean})],xo.prototype,"outlined",void 0),Jr([ht({type:Boolean})],xo.prototype,"rounded",void 0),Jr([ht({type:Object})],xo.prototype,"format",void 0),Jr([ht({type:Boolean})],xo.prototype,"disableSliderNumberInput",void 0),Jr([ht({type:Boolean})],xo.prototype,"fullWidth",void 0),Jr([ht({type:String})],xo.prototype,"helperText",void 0),Jr([ht({type:Boolean})],xo.prototype,"helperPersistent",void 0),Jr([ht({type:String,attribute:!0})],xo.prototype,"validationMessage",void 0),Jr([ht({type:Boolean})],xo.prototype,"autoValidate",void 0),Jr([ht({type:Boolean})],xo.prototype,"charCounter",void 0),Jr([ht({type:String})],xo.prototype,"label",void 0),Jr([ht({type:Boolean})],xo.prototype,"disabled",void 0),Jr([ht({type:Boolean})],xo.prototype,"continuous",void 0),Jr([ht({type:Boolean})],xo.prototype,"resizeVertical",void 0),Jr([gt()],xo.prototype,"isUiValid",void 0),Jr([gt()],xo.prototype,"searchableValue",void 0),Jr([gt()],xo.prototype,"errorMessage",void 0),xo=Jr([mt("or-mwc-input")],xo);var yo=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};const wo=p(420),ko=p(568),Eo=a`
|
|
496
|
+
`}setCustomValidity(t){this.errorMessage=t;const e=this.shadowRoot.getElementById("elem");e&&e.setCustomValidity&&e.setCustomValidity(null!=t?t:""),this.reportValidity()}checkValidity(){const t=this.shadowRoot.getElementById("elem");let e=!0;return t&&t.validity&&(e=t.validity.valid),!e||this.type!==bo.JSON&&this.type!==bo.JSON_OBJECT||void 0!==this.value&&null!==this.value&&""===this._mdcComponent.value&&(e=!1),e}reportValidity(){const t=this.checkValidity();return this.isUiValid=t,this._mdcComponent&&(this._mdcComponent.valid=t),t}onValueChange(t,e,n){var i,r;let o,a=this.value;if("undefined"===e&&(a=null,e=void 0),"null"===e&&(a=void 0,e=null),"string"==typeof e)switch(this.type){case bo.CHECKBOX:case bo.SWITCH:e="on"===e;break;case bo.JSON:case bo.JSON_OBJECT:case bo.NUMBER:case bo.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==bo.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Ie.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===bo.JSON||this.type==bo.JSON_OBJECT?Ie.i18next.t("validation.invalidJSON"):Ie.i18next.t("validation.invalidNumber")}break;case bo.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Ie.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==bo.CHECKBOX_LIST&&e!==a&&(this.type===bo.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new go(this.value,a,n))),null!=this.searchProvider&&this.type===bo.SELECT){const t=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("select-searchable"))||void 0===r?void 0:r.children[1];t&&(this.searchableValue=void 0,t.value="")}this.type!==bo.CHECKBOX_LIST||Se.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new go(e,a,n))}get valid(){const t=this.shadowRoot.getElementById("elem");return!t||!t.checkValidity||t.checkValidity()}get currentValue(){const t=this.shadowRoot.getElementById("elem");if(t&&t.value)return t.value}resolveOptions(t){let e;return t&&t.length>0&&(e=t.map((t=>{if(Array.isArray(t))return t;{const e=""+t;return[t,Ie.i18next.t(e,{defaultValue:Se.Util.camelCaseToSentenceCase(e)})]}}))),e}getSelectedTextValue(t){const e=this.value,n=Array.isArray(e)?e:null!=e?[e]:void 0;if(!n)return"";const i=t||this.resolveOptions(this.options);return i&&n?n.map((t=>i.find((([e,n],i)=>t===e)))).map((t=>t?t[1]:"")).join(", "):""}};Jr([ht({type:Boolean})],xo.prototype,"focused",void 0),Jr([ht()],xo.prototype,"value",void 0),Jr([ht({type:String})],xo.prototype,"type",void 0),Jr([ht({type:String})],xo.prototype,"name",void 0),Jr([ht({type:Boolean})],xo.prototype,"readonly",void 0),Jr([ht({type:Boolean})],xo.prototype,"required",void 0),Jr([ht()],xo.prototype,"max",void 0),Jr([ht()],xo.prototype,"min",void 0),Jr([ht({type:Number})],xo.prototype,"step",void 0),Jr([ht({type:Boolean})],xo.prototype,"checked",void 0),Jr([ht({type:Boolean})],xo.prototype,"indeterminate",void 0),Jr([ht({type:Number})],xo.prototype,"maxLength",void 0),Jr([ht({type:Number})],xo.prototype,"minLength",void 0),Jr([ht({type:Number})],xo.prototype,"rows",void 0),Jr([ht({type:Number})],xo.prototype,"cols",void 0),Jr([ht({type:Boolean})],xo.prototype,"multiple",void 0),Jr([ht({type:String,attribute:!0,reflect:!1})],xo.prototype,"pattern",void 0),Jr([ht({type:String})],xo.prototype,"placeHolder",void 0),Jr([ht({type:Array})],xo.prototype,"options",void 0),Jr([ht({type:Boolean})],xo.prototype,"autoSelect",void 0),Jr([ht({type:Object})],xo.prototype,"searchProvider",void 0),Jr([ht({type:String})],xo.prototype,"searchLabel",void 0),Jr([ht({type:String})],xo.prototype,"icon",void 0),Jr([ht({type:String})],xo.prototype,"iconColor",void 0),Jr([ht({type:String})],xo.prototype,"iconOn",void 0),Jr([ht({type:String})],xo.prototype,"iconTrailing",void 0),Jr([ht({type:Boolean})],xo.prototype,"compact",void 0),Jr([ht({type:Boolean})],xo.prototype,"comfortable",void 0),Jr([ht({type:Boolean})],xo.prototype,"raised",void 0),Jr([ht({type:Boolean})],xo.prototype,"action",void 0),Jr([ht({type:Boolean})],xo.prototype,"unElevated",void 0),Jr([ht({type:Boolean})],xo.prototype,"outlined",void 0),Jr([ht({type:Boolean})],xo.prototype,"rounded",void 0),Jr([ht({type:Object})],xo.prototype,"format",void 0),Jr([ht({type:Boolean})],xo.prototype,"disableSliderNumberInput",void 0),Jr([ht({type:Boolean})],xo.prototype,"fullWidth",void 0),Jr([ht({type:String})],xo.prototype,"helperText",void 0),Jr([ht({type:Boolean})],xo.prototype,"helperPersistent",void 0),Jr([ht({type:String,attribute:!0})],xo.prototype,"validationMessage",void 0),Jr([ht({type:Boolean})],xo.prototype,"autoValidate",void 0),Jr([ht({type:Boolean})],xo.prototype,"charCounter",void 0),Jr([ht({type:String})],xo.prototype,"label",void 0),Jr([ht({type:Boolean})],xo.prototype,"disabled",void 0),Jr([ht({type:Boolean})],xo.prototype,"continuous",void 0),Jr([ht({type:Boolean})],xo.prototype,"resizeVertical",void 0),Jr([gt()],xo.prototype,"isUiValid",void 0),Jr([gt()],xo.prototype,"searchableValue",void 0),Jr([gt()],xo.prototype,"errorMessage",void 0),xo=Jr([mt("or-mwc-input")],xo);var yo=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};const wo=p(420),ko=p(568),Eo=a`
|
|
495
497
|
|
|
496
498
|
:host {
|
|
497
499
|
--internal-or-panel-background-color: var(--or-panel-background-color, var(--or-app-color2, ${o(Se.DefaultColor2)}));
|
|
@@ -646,7 +648,7 @@
|
|
|
646
648
|
max-width: 1024px;
|
|
647
649
|
}
|
|
648
650
|
}
|
|
649
|
-
`;let _c=class extends dt{constructor(){super(...arguments),this._open=!1}static get styles(){return[a`${o(uc)}`,a`${o(fc)}`,vc]}get isOpen(){return!!this._mdcComponent&&this._mdcComponent.isOpen}setOpen(t){return this._open=!0,this}setHeading(t){return this.heading=t,this}setContent(t){return this.content=t,this}setActions(t){return this.actions=t,this}setDismissAction(t){return this.dismissAction=t,this}setStyles(t){return this.styles=t,this}setAvatar(t){return this.avatar=t,this}open(){this._mdcElem&&!this._mdcComponent&&(this._mdcComponent=new pc(this._mdcElem),this._mdcComponent.scrimClickAction=this.dismissAction||null===this.dismissAction?"close":""),this._mdcComponent&&this._mdcComponent.open()}close(t){this._mdcComponent&&this._mdcComponent.close(t)}disconnectedCallback(){super.disconnectedCallback(),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0)}render(){return B`
|
|
651
|
+
`;let _c=class extends dt{constructor(){super(...arguments),this._open=!1,this._popstateEventBind=t=>this._onBrowserNavigate(t)}static get styles(){return[a`${o(uc)}`,a`${o(fc)}`,vc]}get isOpen(){return!!this._mdcComponent&&this._mdcComponent.isOpen}setOpen(t){return this._open=!0,this}setHeading(t){return this.heading=t,this}setContent(t){return this.content=t,this}setActions(t){return this.actions=t,this}setDismissAction(t){return this.dismissAction=t,this}setStyles(t){return this.styles=t,this}setAvatar(t){return this.avatar=t,this}open(){this._mdcElem&&!this._mdcComponent&&(this._mdcComponent=new pc(this._mdcElem),this._mdcComponent.scrimClickAction=this.dismissAction||null===this.dismissAction?"close":""),this._mdcComponent&&this._mdcComponent.open()}close(t){this._mdcComponent&&this._mdcComponent.close(t)}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._popstateEventBind)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._popstateEventBind),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0)}render(){return B`
|
|
650
652
|
${"string"==typeof this.styles?B`<style>${this.styles}</style>`:this.styles||""}
|
|
651
653
|
|
|
652
654
|
<div id="dialog"
|
|
@@ -679,7 +681,7 @@
|
|
|
679
681
|
</div>
|
|
680
682
|
<div class="mdc-dialog__scrim"></div>
|
|
681
683
|
</div>
|
|
682
|
-
`}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}_onDialogOpened(){this.dispatchEvent(new hc)}_onDialogClosed(t){if("close"===t&&this.dismissAction&&this.dismissAction.action)this.dismissAction.action(this);else if(t&&this.actions){const e=this.actions.find((e=>e.actionName===t));e&&e.action&&e.action(this)}this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0),this.dispatchEvent(new gc(t))}};mc([ht({type:String})],_c.prototype,"heading",void 0),mc([ht({type:Object,attribute:!1})],_c.prototype,"content",void 0),mc([ht({type:Array,attribute:!1})],_c.prototype,"actions",void 0),mc([ht({type:Object,attribute:!1})],_c.prototype,"dismissAction",void 0),mc([ht({type:Boolean})],_c.prototype,"avatar",void 0),mc([ht()],_c.prototype,"styles",void 0),mc([ht({attribute:!1})],_c.prototype,"_open",void 0),mc([bt("#dialog")],_c.prototype,"_mdcElem",void 0),_c=mc([mt("or-mwc-dialog")],_c);const xc=t=>(t=>{var e;return null!=(null===(e=null==t?void 0:t._$litType$)||void 0===e?void 0:e.h)})(t)?t._$litType$.h:t.strings,yc=$e(class extends He{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){const n=Ne(this.et)?xc(this.et):null,i=Ne(e)?xc(e):null;if(null!==n&&(null===i||n!==i)){const e=Fe(t).pop();let i=this.tt.get(n);if(void 0===i){const t=document.createDocumentFragment();i=lt(U,t),i.setConnected(!1),this.tt.set(n,i)}Me(i,[e]),ze(i,void 0,e)}if(null!==i){if(null===n||n!==i){const e=this.tt.get(i);if(void 0!==e){const n=Fe(e).pop();t._$AR(),ze(t,void 0,n),Me(t,[n])}}this.et=e}else this.et=void 0;return this.render(e)}});var wc=p(944),kc=p(744),Ec=p(512),Ac=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};const Cc=p(48);class Ic extends CustomEvent{constructor(t){super(Ic.NAME,{detail:t,bubbles:!0,composed:!0})}}Ic.NAME="or-mwc-menu-changed";class Tc extends CustomEvent{constructor(){super(Tc.NAME,{bubbles:!0,composed:!0})}}Tc.NAME="or-mwc-menu-closed";const Sc=a`
|
|
684
|
+
`}updated(t){super.updated(t),t.has("_open")&&this._open&&this.open()}_onDialogOpened(){this.dispatchEvent(new hc)}_onDialogClosed(t){if("close"===t&&this.dismissAction&&this.dismissAction.action)this.dismissAction.action(this);else if(t&&this.actions){const e=this.actions.find((e=>e.actionName===t));e&&e.action&&e.action(this)}this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0),this.dispatchEvent(new gc(t))}_onBrowserNavigate(t){this.close("close")}};mc([ht({type:String})],_c.prototype,"heading",void 0),mc([ht({type:Object,attribute:!1})],_c.prototype,"content",void 0),mc([ht({type:Array,attribute:!1})],_c.prototype,"actions",void 0),mc([ht({type:Object,attribute:!1})],_c.prototype,"dismissAction",void 0),mc([ht({type:Boolean})],_c.prototype,"avatar",void 0),mc([ht()],_c.prototype,"styles",void 0),mc([ht({attribute:!1})],_c.prototype,"_open",void 0),mc([bt("#dialog")],_c.prototype,"_mdcElem",void 0),_c=mc([mt("or-mwc-dialog")],_c);const xc=t=>(t=>{var e;return null!=(null===(e=null==t?void 0:t._$litType$)||void 0===e?void 0:e.h)})(t)?t._$litType$.h:t.strings,yc=$e(class extends He{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(t,[e]){const n=Ne(this.et)?xc(this.et):null,i=Ne(e)?xc(e):null;if(null!==n&&(null===i||n!==i)){const e=Fe(t).pop();let i=this.tt.get(n);if(void 0===i){const t=document.createDocumentFragment();i=lt(U,t),i.setConnected(!1),this.tt.set(n,i)}Me(i,[e]),ze(i,void 0,e)}if(null!==i){if(null===n||n!==i){const e=this.tt.get(i);if(void 0!==e){const n=Fe(e).pop();t._$AR(),ze(t,void 0,n),Me(t,[n])}}this.et=e}else this.et=void 0;return this.render(e)}});var wc=p(944),kc=p(744),Ec=p(512),Ac=function(t,e,n,i){var r,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(r=t[l])&&(a=(o<3?r(a):o>3?r(e,n,a):r(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a};const Cc=p(48);class Ic extends CustomEvent{constructor(t){super(Ic.NAME,{detail:t,bubbles:!0,composed:!0})}}Ic.NAME="or-mwc-menu-changed";class Tc extends CustomEvent{constructor(){super(Tc.NAME,{bubbles:!0,composed:!0})}}Tc.NAME="or-mwc-menu-closed";const Sc=a`
|
|
683
685
|
:host {
|
|
684
686
|
white-space: nowrap;
|
|
685
687
|
--internal-or-mwc-input-color: var(--or-mwc-input-color, var(--or-app-color4, ${o(Se.DefaultColor4)}));
|
|
@@ -1030,9 +1032,9 @@
|
|
|
1030
1032
|
</div>
|
|
1031
1033
|
`:void 0}
|
|
1032
1034
|
</div>
|
|
1033
|
-
`}_onTreeSelectionChanged(t){return Lc(this,void 0,void 0,(function*(){if(!Oe().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Oe().events.sendEventWithReply({
|
|
1035
|
+
`}_onTreeSelectionChanged(t){return Lc(this,void 0,void 0,(function*(){if(!Oe().events)return;const e=t.detail&&t.detail.newNodes.length>0?t.detail.newNodes[0]:void 0;if(e){const t=yield Oe().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){return Lc(this,void 0,void 0,(function*(){if((null==this.assetAttributes||t)&&(this.assetAttributes=[]),this.realm||(this.realm=Oe().getRealm()),this.timePresetOptions||(this.timePresetOptions=this._getDefaultTimestampOptions()),this.timePresetKey||(this.timePresetKey=this.timePresetOptions.keys().next().value.toString()),!this.panelName)return;const e=window.location.hash,n=(yield Oe().console.retrieveData("OrChartConfig"))||[];Array.isArray(n)||Oe().console.storeData("OrChartConfig",[n]);let i=n.find((t=>t.realm===this.realm));if(!i)return;const r=i.views&&i.views[e]?i.views[e][this.panelName]:void 0;if(!r)return;if(!r.attributeRefs){delete i.views[e][this.panelName];const t=[...n.filter((t=>t.realm!==this.realm)),i];return void Oe().console.storeData("OrChartConfig",t)}const o=r.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 Oe().rest.api.AssetResource.queryAssets(t)).data||[];r.attributeRefs=r.attributeRefs.filter((t=>!!e.find((e=>e.id===t.id&&e.attributes&&e.attributes.hasOwnProperty(t.name))))),Oe().console.storeData("OrChartConfig",[...n.filter((t=>t.realm!==this.realm)),i]),this.assets=e.filter((t=>r.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=r.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 Lc(this,void 0,void 0,(function*(){if(!this.panelName)return;const t=window.location.hash,e=(yield Oe().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],Oe().console.storeData("OrChartConfig",[...e.filter((t=>t.realm!==this.realm)),n])}))}_openDialog(){bc((new ic.OrAttributePicker).setShowOnlyDatapointAttrs(!0).setMultiSelect(!0).setSelectedAttributes(this._getSelectedAttributes())).addEventListener(ic.OrAttributePickerPickedEvent.NAME,(t=>this._addAttribute(t.detail)))}_openTimeDialog(t,e){const n=qe(),i=qe();bc((new _c).setHeading(Ce.t("timeframe")).setContent((()=>B`
|
|
1034
1036
|
<div>
|
|
1035
1037
|
<or-mwc-input ${Je(n)} type="${bo.DATETIME}" required label="${Ce.t("start")}" .value="${t}"></or-mwc-input>
|
|
1036
1038
|
<or-mwc-input ${Je(i)} type="${bo.DATETIME}" required label="${Ce.t("ending")}" .value="${e}"></or-mwc-input>
|
|
1037
1039
|
</div>
|
|
1038
|
-
`)).setActions([{actionName:"cancel",content:"cancel"},{actionName:"ok",content:"ok",action:()=>{var t,e;this.timePresetOptions&&(null===(t=n.value)||void 0===t?void 0:t.value)&&(null===(e=i.value)||void 0===e?void 0:e.value)&&(this.timeframe=[new Date(n.value.value),new Date(i.value.value)])}}]))}_addAttribute(t){return Lc(this,void 0,void 0,(function*(){if(t){this.assetAttributes=[];for(const e of t){const t=yield Oe().rest.api.AssetResource.get(e.id);if(this.activeAsset=t.data,this.activeAsset){let t=this.assets.findIndex((t=>t.id===e.id));t<0&&(t=this.assets.length,this.assets=[...this.assets,this.activeAsset]),this.assetAttributes.push([t,e])}}this.assetAttributes=[...this.assetAttributes],this.saveSettings()}}))}_getSelectedAttributes(){return this.assetAttributes.map((([t,e])=>({id:this.assets[t].id,name:e.name})))}onCompleted(){return Lc(this,void 0,void 0,(function*(){yield this.updateComplete}))}_cleanup(){this._chart&&(this._chart.destroy(),this._chart=void 0,this.requestUpdate())}_deleteAttribute(t){const e=this.assetAttributes.splice(t,1)[0][0];this.assetAttributes=[...this.assetAttributes],this.assetAttributes.some((([t,n])=>t===e))||(this.assets.splice(t,1),this.assetAttributes.forEach((t=>{t[0]>=e&&(t[0]-=1)}))),this.saveSettings()}_getAttributeOptionsOld(){if(!this.activeAsset||!this.activeAsset.attributes)return;this.shadowRoot&&this.shadowRoot.getElementById("chart-attribute-picker")&&(this.shadowRoot.getElementById("chart-attribute-picker").value="");const t=Object.values(this.activeAsset.attributes);return t&&t.length>0?t.filter((t=>t.meta&&(t.meta.hasOwnProperty("storeDataPoints")?t.meta.storeDataPoints:t.meta.hasOwnProperty("agentLink")))).filter((t=>this.assetAttributes&&!this.assetAttributes.some((([e,n])=>n.name===t.name&&this.assets[e].id===this.activeAsset.id)))).map((t=>{const e=Te.AssetModelUtil.getAttributeAndValueDescriptors(this.activeAsset.type,t.name,t),n=Se.Util.getAttributeLabel(t,e[0],this.activeAsset.type,!1);return[t.name,n]})):void 0}_getAttributeOptions(){if(!this.activeAsset||!this.activeAsset.attributes)return;this.shadowRoot&&this.shadowRoot.getElementById("chart-attribute-picker")&&(this.shadowRoot.getElementById("chart-attribute-picker").value="");const t=Object.values(this.activeAsset.attributes);return t&&t.length>0?t.filter((t=>t.meta&&(t.meta.hasOwnProperty("storeDataPoints")?t.meta.storeDataPoints:t.meta.hasOwnProperty("agentLink")))).filter((t=>this.assetAttributes&&!this.assetAttributes.some((([e,n])=>n.name===t.name&&this.assets[e].id===this.activeAsset.id)))).map((t=>{const e=Te.AssetModelUtil.getAttributeAndValueDescriptors(this.activeAsset.type,t.name,t),n=Se.Util.getAttributeLabel(t,e[0],this.activeAsset.type,!1);return[t.name,n]})):void 0}_getDefaultTimestampOptions(){return new Map([["lastHour",t=>[Oo()(t).subtract(1,"hour").toDate(),t]],["last24Hours",t=>[Oo()(t).subtract(24,"hours").toDate(),t]],["last7Days",t=>[Oo()(t).subtract(7,"days").toDate(),t]],["last30Days",t=>[Oo()(t).subtract(30,"days").toDate(),t]],["last90Days",t=>[Oo()(t).subtract(90,"days").toDate(),t]],["last6Months",t=>[Oo()(t).subtract(6,"months").toDate(),t]],["lastYear",t=>[Oo()(t).subtract(1,"year").toDate(),t]]])}_getInterval(t){return t<=1?[5,"MINUTE"]:t<=3?[10,"MINUTE"]:t<=6?[30,"MINUTE"]:t<=24?[1,"HOUR"]:t<=48?[3,"HOUR"]:t<=96?[12,"HOUR"]:t<=744?[1,"DAY"]:[1,"MONTH"]}_loadData(){return Lc(this,void 0,void 0,(function*(){if(this._data||!this.assetAttributes||!this.assets||0===this.assets.length&&!this.dataProvider||0===this.assetAttributes.length&&!this.dataProvider||!this.datapointQuery)return;if(this._loading){if(!this._dataAbortController)return;this._dataAbortController.abort("Data request overridden"),delete this._dataAbortController}this._loading=!0;const
|
|
1040
|
+
`)).setActions([{actionName:"cancel",content:"cancel"},{actionName:"ok",content:"ok",action:()=>{var t,e;this.timePresetOptions&&(null===(t=n.value)||void 0===t?void 0:t.value)&&(null===(e=i.value)||void 0===e?void 0:e.value)&&(this.timeframe=[new Date(n.value.value),new Date(i.value.value)])}}]))}_addAttribute(t){return Lc(this,void 0,void 0,(function*(){if(t){this.assetAttributes=[];for(const e of t){const t=yield Oe().rest.api.AssetResource.get(e.id);if(this.activeAsset=t.data,this.activeAsset){let t=this.assets.findIndex((t=>t.id===e.id));t<0&&(t=this.assets.length,this.assets=[...this.assets,this.activeAsset]),this.assetAttributes.push([t,e])}}this.assetAttributes=[...this.assetAttributes],this.saveSettings()}}))}_getSelectedAttributes(){return this.assetAttributes.map((([t,e])=>({id:this.assets[t].id,name:e.name})))}onCompleted(){return Lc(this,void 0,void 0,(function*(){yield this.updateComplete}))}_cleanup(){this._chart&&(this._chart.destroy(),this._chart=void 0,this.requestUpdate())}_deleteAttribute(t){const e=this.assetAttributes.splice(t,1)[0][0];this.assetAttributes=[...this.assetAttributes],this.assetAttributes.some((([t,n])=>t===e))||(this.assets.splice(t,1),this.assetAttributes.forEach((t=>{t[0]>=e&&(t[0]-=1)}))),this.saveSettings()}_getAttributeOptionsOld(){if(!this.activeAsset||!this.activeAsset.attributes)return;this.shadowRoot&&this.shadowRoot.getElementById("chart-attribute-picker")&&(this.shadowRoot.getElementById("chart-attribute-picker").value="");const t=Object.values(this.activeAsset.attributes);return t&&t.length>0?t.filter((t=>t.meta&&(t.meta.hasOwnProperty("storeDataPoints")?t.meta.storeDataPoints:t.meta.hasOwnProperty("agentLink")))).filter((t=>this.assetAttributes&&!this.assetAttributes.some((([e,n])=>n.name===t.name&&this.assets[e].id===this.activeAsset.id)))).map((t=>{const e=Te.AssetModelUtil.getAttributeAndValueDescriptors(this.activeAsset.type,t.name,t),n=Se.Util.getAttributeLabel(t,e[0],this.activeAsset.type,!1);return[t.name,n]})):void 0}_getAttributeOptions(){if(!this.activeAsset||!this.activeAsset.attributes)return;this.shadowRoot&&this.shadowRoot.getElementById("chart-attribute-picker")&&(this.shadowRoot.getElementById("chart-attribute-picker").value="");const t=Object.values(this.activeAsset.attributes);return t&&t.length>0?t.filter((t=>t.meta&&(t.meta.hasOwnProperty("storeDataPoints")?t.meta.storeDataPoints:t.meta.hasOwnProperty("agentLink")))).filter((t=>this.assetAttributes&&!this.assetAttributes.some((([e,n])=>n.name===t.name&&this.assets[e].id===this.activeAsset.id)))).map((t=>{const e=Te.AssetModelUtil.getAttributeAndValueDescriptors(this.activeAsset.type,t.name,t),n=Se.Util.getAttributeLabel(t,e[0],this.activeAsset.type,!1);return[t.name,n]})):void 0}_getDefaultTimestampOptions(){return new Map([["lastHour",t=>[Oo()(t).subtract(1,"hour").toDate(),t]],["last24Hours",t=>[Oo()(t).subtract(24,"hours").toDate(),t]],["last7Days",t=>[Oo()(t).subtract(7,"days").toDate(),t]],["last30Days",t=>[Oo()(t).subtract(30,"days").toDate(),t]],["last90Days",t=>[Oo()(t).subtract(90,"days").toDate(),t]],["last6Months",t=>[Oo()(t).subtract(6,"months").toDate(),t]],["lastYear",t=>[Oo()(t).subtract(1,"year").toDate(),t]]])}_getInterval(t){return t<=1?[5,"MINUTE"]:t<=3?[10,"MINUTE"]:t<=6?[30,"MINUTE"]:t<=24?[1,"HOUR"]:t<=48?[3,"HOUR"]:t<=96?[12,"HOUR"]:t<=744?[1,"DAY"]:[1,"MONTH"]}_loadData(){var t;return Lc(this,void 0,void 0,(function*(){if(this._data||!this.assetAttributes||!this.assets||0===this.assets.length&&!this.dataProvider||0===this.assetAttributes.length&&!this.dataProvider||!this.datapointQuery)return;if(this._loading){if(!this._dataAbortController)return;this._dataAbortController.abort("Data request overridden"),delete this._dataAbortController}this._loading=!0;const e=this.timePresetOptions.get(this.timePresetKey)(new Date);this._startOfPeriod=this.timeframe?this.timeframe[0].getTime():e[0].getTime(),this._endOfPeriod=this.timeframe?this.timeframe[1].getTime():e[1].getTime();const n=(this._endOfPeriod-this._startOfPeriod)/1e3/60/60,i=this._getInterval(n),r=i[0],o=i[1],a=o.toLowerCase();this._timeUnits=a,this._stepSize=r;const l=Oo()().toDate().getTime();let c=l<this._startOfPeriod?this._startOfPeriod:l;const s=[];let d;try{this.dataProvider?yield this.dataProvider(this._startOfPeriod,this._endOfPeriod,o.toString(),r).then((t=>{t.forEach((t=>{s.push(t)}))})):(this._dataAbortController=new AbortController,d=this.assetAttributes.map((([t,e],n)=>Lc(this,void 0,void 0,(function*(){var i;const r=this.assets[t],o=!!this.rightAxisAttributes.find((t=>t.id===r.id&&t.name===e.name)),a=Te.AssetModelUtil.getAttributeAndValueDescriptors(r.type,e.name,e),l=Se.Util.getAttributeLabel(e,a[0],r.type,!1),d=Se.Util.resolveUnits(Se.Util.getAttributeUnits(e,a[0],r.type)),p=n%this.colors.length,m={signal:null===(i=this._dataAbortController)||void 0===i?void 0:i.signal};let u=yield this._loadAttributeData(r,e,this.colors[p],this._startOfPeriod,this._endOfPeriod,!1,r.name+" "+l,m);u.assetId=r.id,u.attrName=e.name,u.unit=d,u.yAxisID=o?"y1":"y",s.push(u),u=yield this._loadAttributeData(this.assets[t],e,this.colors[p],c,this._endOfPeriod,!0,r.name+" "+l+" "+Ce.t("predicted"),m),s.push(u)}))))),d&&(yield Promise.all(d)),this._data=s,this._loading=!1}catch(e){if(console.error(e),"canceled"===(null==e?void 0:e.message))return;if(this._loading=!1,(0,nc.isAxiosError)(e)){if(e.message.includes("timeout"))return void(this._latestError="noAttributeDataTimeout");if(413===(null===(t=e.response)||void 0===t?void 0:t.status))return void(this._latestError="datapointRequestTooLarge")}this._latestError="errorOccurred"}}))}_loadAttributeData(t,e,n,i,r,o,a,l){var c,s,d;return Lc(this,void 0,void 0,(function*(){const i={borderColor:n,backgroundColor:n,label:a,pointRadius:2,fill:!1,data:[],borderDash:o?[2,4]:void 0};if(t.id&&e.name&&this.datapointQuery){let n;const r=JSON.parse(JSON.stringify(this.datapointQuery));if(r.fromTimestamp=this._startOfPeriod,r.toTimestamp=this._endOfPeriod,"lttb"==r.type)r.amountOfPoints?(null===(c=this._chartElem)||void 0===c?void 0:c.clientWidth)>0&&(r.amountOfPoints=Math.min(r.amountOfPoints,null===(s=this._chartElem)||void 0===s?void 0:s.clientWidth)):(null===(d=this._chartElem)||void 0===d?void 0:d.clientWidth)>0?r.amountOfPoints=Math.round(this._chartElem.clientWidth/5):(console.warn("Could not grab width of the Chart for estimating amount of data points. Using 100 points instead."),r.amountOfPoints=100);else if("interval"===r.type&&!r.interval){const t=(this.datapointQuery.toTimestamp-this.datapointQuery.fromTimestamp)/1e3/60/60,e=this._getInterval(t);r.interval=e[0].toString()+" "+e[1].toString()}n=o?yield Oe().rest.api.AssetPredictedDatapointResource.getPredictedDatapoints(t.id,e.name,r,l):yield Oe().rest.api.AssetDatapointResource.getDatapoints(t.id,e.name,r,l),200===n.status&&(i.data=n.data.filter((t=>null!==t.y&&void 0!==t.y)))}return i}))}};Mc.DEFAULT_TIMESTAMP_FORMAT="L HH:mm:ss",Rc([ht({type:Object})],Mc.prototype,"assets",void 0),Rc([ht({type:Object})],Mc.prototype,"activeAsset",void 0),Rc([ht({type:Object})],Mc.prototype,"assetAttributes",void 0),Rc([ht({type:Array})],Mc.prototype,"rightAxisAttributes",void 0),Rc([ht()],Mc.prototype,"dataProvider",void 0),Rc([ht({type:Array})],Mc.prototype,"colors",void 0),Rc([ht({type:Object})],Mc.prototype,"datapointQuery",void 0),Rc([ht({type:Object})],Mc.prototype,"config",void 0),Rc([ht({type:Object})],Mc.prototype,"chartOptions",void 0),Rc([ht({type:String})],Mc.prototype,"realm",void 0),Rc([ht()],Mc.prototype,"panelName",void 0),Rc([ht()],Mc.prototype,"attributeControls",void 0),Rc([ht()],Mc.prototype,"timeframe",void 0),Rc([ht()],Mc.prototype,"timestampControls",void 0),Rc([ht()],Mc.prototype,"timePresetOptions",void 0),Rc([ht()],Mc.prototype,"timePresetKey",void 0),Rc([ht()],Mc.prototype,"showLegend",void 0),Rc([ht()],Mc.prototype,"denseLegend",void 0),Rc([ht()],Mc.prototype,"_loading",void 0),Rc([ht()],Mc.prototype,"_data",void 0),Rc([ht()],Mc.prototype,"_tableTemplate",void 0),Rc([bt("#chart")],Mc.prototype,"_chartElem",void 0),Mc=Rc([mt("or-chart")],Mc)})(),m})()));
|