@openremote/or-chart 1.6.0 → 1.6.3
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 +8 -7
- package/dist/umd/index.js +8 -7
- package/dist/umd/index.orbundle.js +21 -20
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +10 -10
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 Po=class extends Ct{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[mt`${pt(vo)}`,mt`${pt(go)}`,mt`${pt(bo)}`,mt`${pt(_o)}`,mt`${pt(xo)}`,mt`${pt(yo)}`,mt`${pt(wo)}`,mt`${pt(ko)}`,mt`${pt(Eo)}`,mt`${pt(Ao)}`,mt`${pt(Co)}`,mt`${pt(To)}`,mt`${pt(Io)}`,mt`${pt(Oo)}`,mt`${pt(So)}`,mt`${pt(Ro)}`,zo]}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===No.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===No.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===No.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=No.DATETIME:"boolean"==typeof this.value?this.type=No.CHECKBOX:"number"==typeof this.value?this.type=No.NUMBER:"string"==typeof this.value?this.type=No.TEXT:this.type=No.JSON),!0}focus(){this.type===No.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){var t;if(this.type){const e=!this.fullWidth&&this.label;let n=!this.fullWidth&&this.outlined,i=!!this.helperText;const r=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),o={"mdc-text-field-helper-text--persistent":!r&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":r},a=null!==this.value&&void 0!==this.value||!1===this.value;let l=e?j`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case No.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,j`
|
|
263
|
+
`;let Po=class extends Ct{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.censored=!1,this.advertised=!1,this._selectedIndex=-1,this.isUiValid=!0}static get styles(){return[mt`${pt(vo)}`,mt`${pt(go)}`,mt`${pt(bo)}`,mt`${pt(_o)}`,mt`${pt(xo)}`,mt`${pt(yo)}`,mt`${pt(wo)}`,mt`${pt(ko)}`,mt`${pt(Eo)}`,mt`${pt(Ao)}`,mt`${pt(Co)}`,mt`${pt(To)}`,mt`${pt(Io)}`,mt`${pt(Oo)}`,mt`${pt(So)}`,mt`${pt(Ro)}`,zo]}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===No.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===No.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===No.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=No.DATETIME:"boolean"==typeof this.value?this.type=No.CHECKBOX:"number"==typeof this.value?this.type=No.NUMBER:"string"==typeof this.value?this.type=No.TEXT:this.type=No.JSON),!0}focus(){this.type===No.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){var t;if(this.type){const e=!this.fullWidth&&this.label;let n=!this.fullWidth&&this.outlined,i=!!this.helperText;const r=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),o={"mdc-text-field-helper-text--persistent":!r&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":r},a=null!==this.value&&void 0!==this.value||!1===this.value;let l=e?j`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case No.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,j`
|
|
264
264
|
<div class="mdc-radio-container">
|
|
265
265
|
${e?e.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),j`
|
|
266
266
|
<div id="field" class="mdc-form-field">
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
/>
|
|
430
430
|
<label style="margin-left: 10px; cursor: pointer" for="elem">${this.label}</label>
|
|
431
431
|
</div>
|
|
432
|
-
`;case No.NUMBER:case No.RANGE:case No.DATE:case No.DATETIME:case No.TIME:case No.MONTH:case No.WEEK:case No.EMAIL:case No.PASSWORD:case No.TELEPHONE:case No.URL:case No.TEXT:case No.TEXTAREA:case No.JSON:case No.JSON_OBJECT:{let e,c=[void 0===this.value||null===this.value?void 0:this.value,this.min,this.max];if(c.some((t=>"string"!=typeof t)))if(this.type===No.JSON||this.type===No.JSON_OBJECT)if(void 0!==c[0]){if("string"!=typeof c[0]||null===c[0])try{c[0]=JSON.stringify(c[0],null,2)}catch(t){console.warn("Failed to parse JSON expression for input control"),c[0]=""}}else c[0]="";else{const e=this.format?Object.assign({},this.format):{};switch(this.type){case No.TIME:e.asDate=!0,e.hour12=!1,e.timeStyle=this.step&&this.step<60?"medium":"short";break;case No.DATE:e.asDate=!0,e.momentJsFormat="YYYY-MM-DD";break;case No.WEEK:e.asDate=!0,e.momentJsFormat="YYYY-[W]WW";break;case No.MONTH:e.asDate=!0,e.momentJsFormat="YYYY-MM";break;case No.DATETIME:e.asDate=!0,e.momentJsFormat="YYYY-MM-DDTHH:mm";break;case No.NUMBER:null!==(t=e.maximumFractionDigits)&&void 0!==t||(e.maximumFractionDigits=20)}e.useGrouping=!1,c=c.map((t=>void 0!==t?Xe.Util.getValueAsString(t,(()=>e),"en-GB"):void 0))}let s=this.label,d=this.type,p="component";if(this.type===No.RANGE&&(s=void 0,n=!1,i=!1,d=No.NUMBER,p="number"),this.type!==No.RANGE||!this.disableSliderNumberInput){const t={"mdc-text-field":!0,"mdc-text-field--invalid":!this.valid,"mdc-text-field--filled":!n,"mdc-text-field--outlined":n,"mdc-text-field--textarea":d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!n,"dense-comfortable":this.comfortable&&!(d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT),"dense-compact":!this.comfortable&&this.compact,"mdc-text-field--label-floating":a,"mdc-text-field--no-label":!this.label,"mdc-text-field--with-leading-icon":!!this.icon,"mdc-text-field--with-trailing-icon":!!this.iconTrailing,"or-mwc-input--rounded":this.rounded};e=d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT?j`
|
|
432
|
+
`;case No.NUMBER:case No.RANGE:case No.DATE:case No.DATETIME:case No.TIME:case No.MONTH:case No.WEEK:case No.EMAIL:case No.PASSWORD:case No.TELEPHONE:case No.URL:case No.TEXT:case No.TEXTAREA:case No.JSON:case No.JSON_OBJECT:{let e,c=[void 0===this.value||null===this.value?void 0:this.value,this.min,this.max];if(c.some((t=>"string"!=typeof t)))if(this.type===No.JSON||this.type===No.JSON_OBJECT)if(void 0!==c[0]){if("string"!=typeof c[0]||null===c[0])try{c[0]=JSON.stringify(c[0],null,2)}catch(t){console.warn("Failed to parse JSON expression for input control"),c[0]=""}}else c[0]="";else{const e=this.format?Object.assign({},this.format):{};switch(this.type){case No.TIME:e.asDate=!0,e.hour12=!1,e.timeStyle=this.step&&this.step<60?"medium":"short";break;case No.DATE:e.asDate=!0,e.momentJsFormat="YYYY-MM-DD";break;case No.WEEK:e.asDate=!0,e.momentJsFormat="YYYY-[W]WW";break;case No.MONTH:e.asDate=!0,e.momentJsFormat="YYYY-MM";break;case No.DATETIME:e.asDate=!0,e.momentJsFormat="YYYY-MM-DDTHH:mm";break;case No.NUMBER:null!==(t=e.maximumFractionDigits)&&void 0!==t||(e.maximumFractionDigits=20)}e.useGrouping=!1,c=c.map((t=>void 0!==t?Xe.Util.getValueAsString(t,(()=>e),"en-GB"):void 0))}let s=this.label,d=this.type,p="component";if(this.type===No.RANGE&&(s=void 0,n=!1,i=!1,d=No.NUMBER,p="number"),this.type!==No.RANGE||!this.disableSliderNumberInput){this.censored&&(d=No.PASSWORD),this.type===No.PASSWORD&&this.advertised&&(d=No.TEXT);const t={"mdc-text-field":!0,"mdc-text-field--invalid":!this.valid,"mdc-text-field--filled":!n,"mdc-text-field--outlined":n,"mdc-text-field--textarea":d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!n,"dense-comfortable":this.comfortable&&!(d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT),"dense-compact":!this.comfortable&&this.compact,"mdc-text-field--label-floating":a,"mdc-text-field--no-label":!this.label,"mdc-text-field--with-leading-icon":!!this.icon,"mdc-text-field--with-trailing-icon":!!this.iconTrailing,"or-mwc-input--rounded":this.rounded};e=d===No.TEXTAREA||d===No.JSON||d===No.JSON_OBJECT?j`
|
|
433
433
|
<textarea id="elem" class="mdc-text-field__input ${this.resizeVertical?"resize-vertical":""}" ?required="${this.required}"
|
|
434
434
|
?readonly="${this.readonly}" ?disabled="${this.disabled}" minlength="${gn(this.minLength)}"
|
|
435
435
|
maxlength="${gn(this.maxLength)}" rows="${this.rows?this.rows:5}"
|
|
@@ -451,6 +451,7 @@
|
|
|
451
451
|
${e}
|
|
452
452
|
${n?this.renderOutlined(l):l}
|
|
453
453
|
${n?"":j`<span class="mdc-line-ripple"></span>`}
|
|
454
|
+
${this.type!==No.PASSWORD||this.censored?"":j`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon=${this.advertised?"eye":"eye-off"} style="pointer-events: auto;" @click=${()=>this.advertised=!this.advertised}></or-icon>`}
|
|
454
455
|
${this.iconTrailing?j`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>`:""}
|
|
455
456
|
</label>
|
|
456
457
|
${i||r?j`
|
|
@@ -493,7 +494,7 @@
|
|
|
493
494
|
`:""}
|
|
494
495
|
<span class="mdc-notched-outline__trailing"></span>
|
|
495
496
|
</span>
|
|
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!==No.JSON&&this.type!==No.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 No.CHECKBOX:case No.SWITCH:e="on"===e;break;case No.JSON:case No.JSON_OBJECT:case No.NUMBER:case No.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==No.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Ue.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===No.JSON||this.type==No.JSON_OBJECT?Ue.i18next.t("validation.invalidJSON"):Ue.i18next.t("validation.invalidNumber")}break;case No.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Ue.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==No.CHECKBOX_LIST&&e!==a&&(this.type===No.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new Lo(this.value,a,n))),null!=this.searchProvider&&this.type===No.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!==No.CHECKBOX_LIST||Xe.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new Lo(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,Ue.i18next.t(e,{defaultValue:Xe.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(", "):""}};fo([Rt({type:Boolean})],Po.prototype,"focused",void 0),fo([Rt()],Po.prototype,"value",void 0),fo([Rt({type:String})],Po.prototype,"type",void 0),fo([Rt({type:String})],Po.prototype,"name",void 0),fo([Rt({type:Boolean})],Po.prototype,"readonly",void 0),fo([Rt({type:Boolean})],Po.prototype,"required",void 0),fo([Rt()],Po.prototype,"max",void 0),fo([Rt()],Po.prototype,"min",void 0),fo([Rt({type:Number})],Po.prototype,"step",void 0),fo([Rt({type:Boolean})],Po.prototype,"checked",void 0),fo([Rt({type:Boolean})],Po.prototype,"indeterminate",void 0),fo([Rt({type:Number})],Po.prototype,"maxLength",void 0),fo([Rt({type:Number})],Po.prototype,"minLength",void 0),fo([Rt({type:Number})],Po.prototype,"rows",void 0),fo([Rt({type:Number})],Po.prototype,"cols",void 0),fo([Rt({type:Boolean})],Po.prototype,"multiple",void 0),fo([Rt({type:String,attribute:!0,reflect:!1})],Po.prototype,"pattern",void 0),fo([Rt({type:String})],Po.prototype,"placeHolder",void 0),fo([Rt({type:Array})],Po.prototype,"options",void 0),fo([Rt({type:Boolean})],Po.prototype,"autoSelect",void 0),fo([Rt({type:Object})],Po.prototype,"searchProvider",void 0),fo([Rt({type:String})],Po.prototype,"searchLabel",void 0),fo([Rt({type:String})],Po.prototype,"icon",void 0),fo([Rt({type:String})],Po.prototype,"iconColor",void 0),fo([Rt({type:String})],Po.prototype,"iconOn",void 0),fo([Rt({type:String})],Po.prototype,"iconTrailing",void 0),fo([Rt({type:Boolean})],Po.prototype,"compact",void 0),fo([Rt({type:Boolean})],Po.prototype,"comfortable",void 0),fo([Rt({type:Boolean})],Po.prototype,"raised",void 0),fo([Rt({type:Boolean})],Po.prototype,"action",void 0),fo([Rt({type:Boolean})],Po.prototype,"unElevated",void 0),fo([Rt({type:Boolean})],Po.prototype,"outlined",void 0),fo([Rt({type:Boolean})],Po.prototype,"rounded",void 0),fo([Rt({type:Object})],Po.prototype,"format",void 0),fo([Rt({type:Boolean})],Po.prototype,"disableSliderNumberInput",void 0),fo([Rt({type:Boolean})],Po.prototype,"fullWidth",void 0),fo([Rt({type:String})],Po.prototype,"helperText",void 0),fo([Rt({type:Boolean})],Po.prototype,"helperPersistent",void 0),fo([Rt({type:String,attribute:!0})],Po.prototype,"validationMessage",void 0),fo([Rt({type:Boolean})],Po.prototype,"autoValidate",void 0),fo([Rt({type:Boolean})],Po.prototype,"charCounter",void 0),fo([Rt({type:String})],Po.prototype,"label",void 0),fo([Rt({type:Boolean})],Po.prototype,"disabled",void 0),fo([Rt({type:Boolean})],Po.prototype,"continuous",void 0),fo([Rt({type:Boolean})],Po.prototype,"resizeVertical",void 0),fo([Lt()],Po.prototype,"isUiValid",void 0),fo([Lt()],Po.prototype,"searchableValue",void 0),fo([Lt()],Po.prototype,"errorMessage",void 0),Po=fo([It("or-mwc-input")],Po);var Mo=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 $o=p(420),Fo=p(568),jo=mt`
|
|
497
|
+
`}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!==No.JSON&&this.type!==No.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 No.CHECKBOX:case No.SWITCH:e="on"===e;break;case No.JSON:case No.JSON_OBJECT:case No.NUMBER:case No.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==No.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Ue.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===No.JSON||this.type==No.JSON_OBJECT?Ue.i18next.t("validation.invalidJSON"):Ue.i18next.t("validation.invalidNumber")}break;case No.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Ue.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==No.CHECKBOX_LIST&&e!==a&&(this.type===No.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new Lo(this.value,a,n))),null!=this.searchProvider&&this.type===No.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!==No.CHECKBOX_LIST||Xe.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new Lo(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,Ue.i18next.t(e,{defaultValue:Xe.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(", "):""}};fo([Rt({type:Boolean})],Po.prototype,"focused",void 0),fo([Rt()],Po.prototype,"value",void 0),fo([Rt({type:String})],Po.prototype,"type",void 0),fo([Rt({type:String})],Po.prototype,"name",void 0),fo([Rt({type:Boolean})],Po.prototype,"readonly",void 0),fo([Rt({type:Boolean})],Po.prototype,"required",void 0),fo([Rt()],Po.prototype,"max",void 0),fo([Rt()],Po.prototype,"min",void 0),fo([Rt({type:Number})],Po.prototype,"step",void 0),fo([Rt({type:Boolean})],Po.prototype,"checked",void 0),fo([Rt({type:Boolean})],Po.prototype,"indeterminate",void 0),fo([Rt({type:Number})],Po.prototype,"maxLength",void 0),fo([Rt({type:Number})],Po.prototype,"minLength",void 0),fo([Rt({type:Number})],Po.prototype,"rows",void 0),fo([Rt({type:Number})],Po.prototype,"cols",void 0),fo([Rt({type:Boolean})],Po.prototype,"multiple",void 0),fo([Rt({type:String,attribute:!0,reflect:!1})],Po.prototype,"pattern",void 0),fo([Rt({type:String})],Po.prototype,"placeHolder",void 0),fo([Rt({type:Array})],Po.prototype,"options",void 0),fo([Rt({type:Boolean})],Po.prototype,"autoSelect",void 0),fo([Rt({type:Object})],Po.prototype,"searchProvider",void 0),fo([Rt({type:String})],Po.prototype,"searchLabel",void 0),fo([Rt({type:String})],Po.prototype,"icon",void 0),fo([Rt({type:String})],Po.prototype,"iconColor",void 0),fo([Rt({type:String})],Po.prototype,"iconOn",void 0),fo([Rt({type:String})],Po.prototype,"iconTrailing",void 0),fo([Rt({type:Boolean})],Po.prototype,"compact",void 0),fo([Rt({type:Boolean})],Po.prototype,"comfortable",void 0),fo([Rt({type:Boolean})],Po.prototype,"raised",void 0),fo([Rt({type:Boolean})],Po.prototype,"action",void 0),fo([Rt({type:Boolean})],Po.prototype,"unElevated",void 0),fo([Rt({type:Boolean})],Po.prototype,"outlined",void 0),fo([Rt({type:Boolean})],Po.prototype,"rounded",void 0),fo([Rt({type:Object})],Po.prototype,"format",void 0),fo([Rt({type:Boolean})],Po.prototype,"disableSliderNumberInput",void 0),fo([Rt({type:Boolean})],Po.prototype,"fullWidth",void 0),fo([Rt({type:String})],Po.prototype,"helperText",void 0),fo([Rt({type:Boolean})],Po.prototype,"helperPersistent",void 0),fo([Rt({type:String,attribute:!0})],Po.prototype,"validationMessage",void 0),fo([Rt({type:Boolean})],Po.prototype,"autoValidate",void 0),fo([Rt({type:Boolean})],Po.prototype,"charCounter",void 0),fo([Rt({type:String})],Po.prototype,"label",void 0),fo([Rt({type:Boolean})],Po.prototype,"disabled",void 0),fo([Rt({type:Boolean})],Po.prototype,"continuous",void 0),fo([Rt({type:Boolean})],Po.prototype,"resizeVertical",void 0),fo([Rt({type:Boolean})],Po.prototype,"censored",void 0),fo([Rt({type:Boolean,reflect:!0})],Po.prototype,"advertised",void 0),fo([Lt()],Po.prototype,"isUiValid",void 0),fo([Lt()],Po.prototype,"searchableValue",void 0),fo([Lt()],Po.prototype,"errorMessage",void 0),Po=fo([It("or-mwc-input")],Po);var Mo=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 $o=p(420),Fo=p(568),jo=mt`
|
|
497
498
|
|
|
498
499
|
:host {
|
|
499
500
|
--internal-or-panel-background-color: var(--or-panel-background-color, var(--or-app-color2, ${pt(Xe.DefaultColor2)}));
|
|
@@ -974,10 +975,10 @@
|
|
|
974
975
|
<div class="period-controls">
|
|
975
976
|
${this.timePresetOptions&&this.timePresetKey?j`
|
|
976
977
|
${this.timestampControls?j`
|
|
977
|
-
${function(t,e,n,i,r,o=!1,a=!0,l=!1,c=!1){return j`
|
|
978
|
+
${function(t,e,n,i,r,o=!1,a=!0,l=!1,c=!1,s="menu",d=!1){let p=null;return j`
|
|
978
979
|
<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="
|
|
980
|
+
<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>
|
|
981
|
+
${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
982
|
</span>
|
|
982
983
|
`}(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
984
|
<!-- Button that opens custom time selection -->
|
|
@@ -1033,7 +1034,7 @@
|
|
|
1033
1034
|
</div>
|
|
1034
1035
|
`:void 0}
|
|
1035
1036
|
</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.
|
|
1037
|
+
`}_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
1038
|
<div>
|
|
1038
1039
|
<or-mwc-input ${fn(n)} type="${No.DATETIME}" required label="${Be.t("start")}" .value="${t}"></or-mwc-input>
|
|
1039
1040
|
<or-mwc-input ${fn(i)} type="${No.DATETIME}" required label="${Be.t("ending")}" .value="${e}"></or-mwc-input>
|