@openremote/or-attribute-input 1.2.0-snapshot.20241015132104 → 1.2.0-snapshot.20241209103107

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.js CHANGED
@@ -266,7 +266,7 @@
266
266
  .mdc-list-item__graphic > or-icon {
267
267
  pointer-events: none;
268
268
  }
269
- `;let ir=class extends ce{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[o`${a(zi)}`,o`${a(Li)}`,o`${a(Di)}`,o`${a(ji)}`,o`${a(Mi)}`,o`${a(Fi)}`,o`${a(Vi)}`,o`${a(Hi)}`,o`${a(Bi)}`,o`${a(Ui)}`,o`${a(Xi)}`,o`${a(qi)}`,o`${a(Yi)}`,o`${a(Wi)}`,o`${a(Gi)}`,o`${a(Ki)}`,nr]}get nativeValue(){if(this._mdcComponent)return this._mdcComponent.value}disconnectedCallback(){var e,t;super.disconnectedCallback(),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0,null===(e=this._menuObserver)||void 0===e||e.disconnect()),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0,null===(t=this._menuObserver)||void 0===t||t.disconnect())}shouldUpdate(e){return e.has("indeterminate")&&this._mdcComponent&&this.type===Zi.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),e.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Zi.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),e.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Zi.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Zi.DATETIME:"boolean"==typeof this.value?this.type=Zi.CHECKBOX:"number"==typeof this.value?this.type=Zi.NUMBER:"string"==typeof this.value?this.type=Zi.TEXT:this.type=Zi.JSON),!0}focus(){this.type===Zi.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const e=!this.fullWidth&&this.label;let t=!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},a=null!==this.value&&void 0!==this.value||!1===this.value;let o=e?H`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case Zi.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,H`
269
+ `;let ir=class extends ce{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[o`${a(zi)}`,o`${a(Li)}`,o`${a(Di)}`,o`${a(ji)}`,o`${a(Mi)}`,o`${a(Fi)}`,o`${a(Vi)}`,o`${a(Hi)}`,o`${a(Bi)}`,o`${a(Ui)}`,o`${a(Xi)}`,o`${a(qi)}`,o`${a(Yi)}`,o`${a(Wi)}`,o`${a(Gi)}`,o`${a(Ki)}`,nr]}get nativeValue(){if(this._mdcComponent)return this._mdcComponent.value}disconnectedCallback(){var e,t;super.disconnectedCallback(),this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0,null===(e=this._menuObserver)||void 0===e||e.disconnect()),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0,null===(t=this._menuObserver)||void 0===t||t.disconnect())}shouldUpdate(e){return e.has("indeterminate")&&this._mdcComponent&&this.type===Zi.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),e.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Zi.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),e.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Zi.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Zi.DATETIME:"boolean"==typeof this.value?this.type=Zi.CHECKBOX:"number"==typeof this.value?this.type=Zi.NUMBER:"string"==typeof this.value?this.type=Zi.TEXT:this.type=Zi.JSON),!0}focus(){this.type===Zi.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const e=!this.fullWidth&&this.label;let t=!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},a=null!==this.value&&void 0!==this.value||!1===this.value;let o=e?H`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case Zi.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,H`
270
270
  <div class="mdc-radio-container">
271
271
  ${e?e.map((([e,t],n)=>(this.value===e&&(this._selectedIndex=n),H`
272
272
  <div id="field" class="mdc-form-field">
@@ -351,7 +351,9 @@
351
351
  <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}">
352
352
  ${Be(null!=this.searchProvider,(()=>H`
353
353
  <label id="select-searchable" class="mdc-text-field mdc-text-field--filled">
354
- <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">${je.i18next.t("search")}</span>
354
+ <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">
355
+ <or-translate .value="${this.searchLabel}"></or-translate>
356
+ </span>
355
357
  <input class="mdc-text-field__input" type="text"
356
358
  @keyup="${e=>this.searchableValue=e.target.value}"
357
359
  />
@@ -497,7 +499,7 @@
497
499
  `:""}
498
500
  <span class="mdc-notched-outline__trailing"></span>
499
501
  </span>
500
- `}setCustomValidity(e){this.errorMessage=e;const t=this.shadowRoot.getElementById("elem");t&&t.setCustomValidity&&t.setCustomValidity(null!=e?e:""),this.reportValidity()}checkValidity(){const e=this.shadowRoot.getElementById("elem");let t=!0;return e&&e.validity&&(t=e.validity.valid),!t||this.type!==Zi.JSON&&this.type!==Zi.JSON_OBJECT||void 0!==this.value&&null!==this.value&&""===this._mdcComponent.value&&(t=!1),t}reportValidity(){const e=this.checkValidity();return this.isUiValid=e,this._mdcComponent&&(this._mdcComponent.valid=e),e}onValueChange(e,t,n){var i,r;let a,o=this.value;if("undefined"===t&&(o=null,t=void 0),"null"===t&&(o=void 0,t=null),"string"==typeof t)switch(this.type){case Zi.CHECKBOX:case Zi.SWITCH:t="on"===t;break;case Zi.JSON:case Zi.JSON_OBJECT:case Zi.NUMBER:case Zi.RANGE:if(""===t)t=null;else try{t=JSON.parse(t),this.type!==Zi.JSON_OBJECT||"object"==typeof t&&!Array.isArray(t)||(t=this.value,a=je.i18next.t("validation.invalidJSON"))}catch(e){t=this.value,a=this.type===Zi.JSON||this.type==Zi.JSON_OBJECT?je.i18next.t("validation.invalidJSON"):je.i18next.t("validation.invalidNumber")}break;case Zi.DATETIME:if(""===t)t=null;else try{t=Date.parse(t)}catch(e){t=this.value,a=je.i18next.t("validation.invalidDate")}}if(this.value=t,this.setCustomValidity(a),this.reportValidity(),this.type!==Zi.CHECKBOX_LIST&&t!==o&&(this.type===Zi.RANGE&&(this._mdcComponent.setValue(t),this._mdcComponent2&&(this._mdcComponent2.value=t)),this.dispatchEvent(new Ji(this.value,o,n))),null!=this.searchProvider&&this.type===Zi.SELECT){const e=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("select-searchable"))||void 0===r?void 0:r.children[1];e&&(this.searchableValue=void 0,e.value="")}this.type!==Zi.CHECKBOX_LIST||Fe.Util.objectsEqual(t,o,!0)||this.dispatchEvent(new Ji(t,o,n))}get valid(){const e=this.shadowRoot.getElementById("elem");return!e||!e.checkValidity||e.checkValidity()}get currentValue(){const e=this.shadowRoot.getElementById("elem");if(e&&e.value)return e.value}resolveOptions(e){let t;return e&&e.length>0&&(t=e.map((e=>{if(Array.isArray(e))return e;{const t=""+e;return[e,je.i18next.t(t,{defaultValue:Fe.Util.camelCaseToSentenceCase(t)})]}}))),t}getSelectedTextValue(e){const t=this.value,n=Array.isArray(t)?t:null!=t?[t]:void 0;if(!n)return"";const i=e||this.resolveOptions(this.options);return i&&n?n.map((e=>i.find((([t,n],i)=>e===t)))).map((e=>e?e[1]:"")).join(", "):""}};Pi([fe({type:Boolean})],ir.prototype,"focused",void 0),Pi([fe()],ir.prototype,"value",void 0),Pi([fe({type:String})],ir.prototype,"type",void 0),Pi([fe({type:String})],ir.prototype,"name",void 0),Pi([fe({type:Boolean})],ir.prototype,"readonly",void 0),Pi([fe({type:Boolean})],ir.prototype,"required",void 0),Pi([fe()],ir.prototype,"max",void 0),Pi([fe()],ir.prototype,"min",void 0),Pi([fe({type:Number})],ir.prototype,"step",void 0),Pi([fe({type:Boolean})],ir.prototype,"checked",void 0),Pi([fe({type:Boolean})],ir.prototype,"indeterminate",void 0),Pi([fe({type:Number})],ir.prototype,"maxLength",void 0),Pi([fe({type:Number})],ir.prototype,"minLength",void 0),Pi([fe({type:Number})],ir.prototype,"rows",void 0),Pi([fe({type:Number})],ir.prototype,"cols",void 0),Pi([fe({type:Boolean})],ir.prototype,"multiple",void 0),Pi([fe({type:String,attribute:!0,reflect:!1})],ir.prototype,"pattern",void 0),Pi([fe({type:String})],ir.prototype,"placeHolder",void 0),Pi([fe({type:Array})],ir.prototype,"options",void 0),Pi([fe({type:Boolean})],ir.prototype,"autoSelect",void 0),Pi([fe({type:Object})],ir.prototype,"searchProvider",void 0),Pi([fe({type:String})],ir.prototype,"icon",void 0),Pi([fe({type:String})],ir.prototype,"iconColor",void 0),Pi([fe({type:String})],ir.prototype,"iconOn",void 0),Pi([fe({type:String})],ir.prototype,"iconTrailing",void 0),Pi([fe({type:Boolean})],ir.prototype,"compact",void 0),Pi([fe({type:Boolean})],ir.prototype,"comfortable",void 0),Pi([fe({type:Boolean})],ir.prototype,"raised",void 0),Pi([fe({type:Boolean})],ir.prototype,"action",void 0),Pi([fe({type:Boolean})],ir.prototype,"unElevated",void 0),Pi([fe({type:Boolean})],ir.prototype,"outlined",void 0),Pi([fe({type:Boolean})],ir.prototype,"rounded",void 0),Pi([fe({type:Object})],ir.prototype,"format",void 0),Pi([fe({type:Boolean})],ir.prototype,"disableSliderNumberInput",void 0),Pi([fe({type:Boolean})],ir.prototype,"fullWidth",void 0),Pi([fe({type:String})],ir.prototype,"helperText",void 0),Pi([fe({type:Boolean})],ir.prototype,"helperPersistent",void 0),Pi([fe({type:String,attribute:!0})],ir.prototype,"validationMessage",void 0),Pi([fe({type:Boolean})],ir.prototype,"autoValidate",void 0),Pi([fe({type:Boolean})],ir.prototype,"charCounter",void 0),Pi([fe({type:String})],ir.prototype,"label",void 0),Pi([fe({type:Boolean})],ir.prototype,"disabled",void 0),Pi([fe({type:Boolean})],ir.prototype,"continuous",void 0),Pi([fe({type:Boolean})],ir.prototype,"resizeVertical",void 0),Pi([he()],ir.prototype,"isUiValid",void 0),Pi([he()],ir.prototype,"searchableValue",void 0),Pi([he()],ir.prototype,"errorMessage",void 0),ir=Pi([pe("or-mwc-input")],ir);const rr=o`
502
+ `}setCustomValidity(e){this.errorMessage=e;const t=this.shadowRoot.getElementById("elem");t&&t.setCustomValidity&&t.setCustomValidity(null!=e?e:""),this.reportValidity()}checkValidity(){const e=this.shadowRoot.getElementById("elem");let t=!0;return e&&e.validity&&(t=e.validity.valid),!t||this.type!==Zi.JSON&&this.type!==Zi.JSON_OBJECT||void 0!==this.value&&null!==this.value&&""===this._mdcComponent.value&&(t=!1),t}reportValidity(){const e=this.checkValidity();return this.isUiValid=e,this._mdcComponent&&(this._mdcComponent.valid=e),e}onValueChange(e,t,n){var i,r;let a,o=this.value;if("undefined"===t&&(o=null,t=void 0),"null"===t&&(o=void 0,t=null),"string"==typeof t)switch(this.type){case Zi.CHECKBOX:case Zi.SWITCH:t="on"===t;break;case Zi.JSON:case Zi.JSON_OBJECT:case Zi.NUMBER:case Zi.RANGE:if(""===t)t=null;else try{t=JSON.parse(t),this.type!==Zi.JSON_OBJECT||"object"==typeof t&&!Array.isArray(t)||(t=this.value,a=je.i18next.t("validation.invalidJSON"))}catch(e){t=this.value,a=this.type===Zi.JSON||this.type==Zi.JSON_OBJECT?je.i18next.t("validation.invalidJSON"):je.i18next.t("validation.invalidNumber")}break;case Zi.DATETIME:if(""===t)t=null;else try{t=Date.parse(t)}catch(e){t=this.value,a=je.i18next.t("validation.invalidDate")}}if(this.value=t,this.setCustomValidity(a),this.reportValidity(),this.type!==Zi.CHECKBOX_LIST&&t!==o&&(this.type===Zi.RANGE&&(this._mdcComponent.setValue(t),this._mdcComponent2&&(this._mdcComponent2.value=t)),this.dispatchEvent(new Ji(this.value,o,n))),null!=this.searchProvider&&this.type===Zi.SELECT){const e=null===(r=null===(i=this.shadowRoot)||void 0===i?void 0:i.getElementById("select-searchable"))||void 0===r?void 0:r.children[1];e&&(this.searchableValue=void 0,e.value="")}this.type!==Zi.CHECKBOX_LIST||Fe.Util.objectsEqual(t,o,!0)||this.dispatchEvent(new Ji(t,o,n))}get valid(){const e=this.shadowRoot.getElementById("elem");return!e||!e.checkValidity||e.checkValidity()}get currentValue(){const e=this.shadowRoot.getElementById("elem");if(e&&e.value)return e.value}resolveOptions(e){let t;return e&&e.length>0&&(t=e.map((e=>{if(Array.isArray(e))return e;{const t=""+e;return[e,je.i18next.t(t,{defaultValue:Fe.Util.camelCaseToSentenceCase(t)})]}}))),t}getSelectedTextValue(e){const t=this.value,n=Array.isArray(t)?t:null!=t?[t]:void 0;if(!n)return"";const i=e||this.resolveOptions(this.options);return i&&n?n.map((e=>i.find((([t,n],i)=>e===t)))).map((e=>e?e[1]:"")).join(", "):""}};Pi([fe({type:Boolean})],ir.prototype,"focused",void 0),Pi([fe()],ir.prototype,"value",void 0),Pi([fe({type:String})],ir.prototype,"type",void 0),Pi([fe({type:String})],ir.prototype,"name",void 0),Pi([fe({type:Boolean})],ir.prototype,"readonly",void 0),Pi([fe({type:Boolean})],ir.prototype,"required",void 0),Pi([fe()],ir.prototype,"max",void 0),Pi([fe()],ir.prototype,"min",void 0),Pi([fe({type:Number})],ir.prototype,"step",void 0),Pi([fe({type:Boolean})],ir.prototype,"checked",void 0),Pi([fe({type:Boolean})],ir.prototype,"indeterminate",void 0),Pi([fe({type:Number})],ir.prototype,"maxLength",void 0),Pi([fe({type:Number})],ir.prototype,"minLength",void 0),Pi([fe({type:Number})],ir.prototype,"rows",void 0),Pi([fe({type:Number})],ir.prototype,"cols",void 0),Pi([fe({type:Boolean})],ir.prototype,"multiple",void 0),Pi([fe({type:String,attribute:!0,reflect:!1})],ir.prototype,"pattern",void 0),Pi([fe({type:String})],ir.prototype,"placeHolder",void 0),Pi([fe({type:Array})],ir.prototype,"options",void 0),Pi([fe({type:Boolean})],ir.prototype,"autoSelect",void 0),Pi([fe({type:Object})],ir.prototype,"searchProvider",void 0),Pi([fe({type:String})],ir.prototype,"searchLabel",void 0),Pi([fe({type:String})],ir.prototype,"icon",void 0),Pi([fe({type:String})],ir.prototype,"iconColor",void 0),Pi([fe({type:String})],ir.prototype,"iconOn",void 0),Pi([fe({type:String})],ir.prototype,"iconTrailing",void 0),Pi([fe({type:Boolean})],ir.prototype,"compact",void 0),Pi([fe({type:Boolean})],ir.prototype,"comfortable",void 0),Pi([fe({type:Boolean})],ir.prototype,"raised",void 0),Pi([fe({type:Boolean})],ir.prototype,"action",void 0),Pi([fe({type:Boolean})],ir.prototype,"unElevated",void 0),Pi([fe({type:Boolean})],ir.prototype,"outlined",void 0),Pi([fe({type:Boolean})],ir.prototype,"rounded",void 0),Pi([fe({type:Object})],ir.prototype,"format",void 0),Pi([fe({type:Boolean})],ir.prototype,"disableSliderNumberInput",void 0),Pi([fe({type:Boolean})],ir.prototype,"fullWidth",void 0),Pi([fe({type:String})],ir.prototype,"helperText",void 0),Pi([fe({type:Boolean})],ir.prototype,"helperPersistent",void 0),Pi([fe({type:String,attribute:!0})],ir.prototype,"validationMessage",void 0),Pi([fe({type:Boolean})],ir.prototype,"autoValidate",void 0),Pi([fe({type:Boolean})],ir.prototype,"charCounter",void 0),Pi([fe({type:String})],ir.prototype,"label",void 0),Pi([fe({type:Boolean})],ir.prototype,"disabled",void 0),Pi([fe({type:Boolean})],ir.prototype,"continuous",void 0),Pi([fe({type:Boolean})],ir.prototype,"resizeVertical",void 0),Pi([he()],ir.prototype,"isUiValid",void 0),Pi([he()],ir.prototype,"searchableValue",void 0),Pi([he()],ir.prototype,"errorMessage",void 0),ir=Pi([pe("or-mwc-input")],ir);const rr=o`
501
503
 
502
504
  /* https://codepen.io/finnhvman/pen/bmNdNr */
503
505
  .pure-material-progress-circular {