@openremote/or-map 1.4.0-snapshot.20250314091541 → 1.4.0-snapshot.20250314134031
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 +42 -42
- package/dist/umd/index.js +42 -42
- package/dist/umd/index.orbundle.js +43 -43
- package/package.json +8 -8
package/dist/umd/index.bundle.js
CHANGED
|
@@ -558,9 +558,9 @@
|
|
|
558
558
|
.mdc-list-item__graphic > or-icon {
|
|
559
559
|
pointer-events: none;
|
|
560
560
|
}
|
|
561
|
-
`;let Ur=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[k`${w(kr)}`,k`${w(xr)}`,k`${w(wr)}`,k`${w(Er)}`,k`${w(Cr)}`,k`${w(Ar)}`,k`${w(Tr)}`,k`${w(Ir)}`,k`${w(Sr)}`,k`${w(zr)}`,k`${w(Lr)}`,k`${w(Mr)}`,k`${w(Rr)}`,k`${w(Dr)}`,k`${w(Pr)}`,k`${w(Or)}`,Vr]}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===Fr.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Fr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Fr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Fr.DATETIME:"boolean"==typeof this.value?this.type=Fr.CHECKBOX:"number"==typeof this.value?this.type=Fr.NUMBER:"string"==typeof this.value?this.type=Fr.TEXT:this.type=Fr.JSON),!0}focus(){this.type===Fr.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const
|
|
561
|
+
`;let Ur=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[k`${w(kr)}`,k`${w(xr)}`,k`${w(wr)}`,k`${w(Er)}`,k`${w(Cr)}`,k`${w(Ar)}`,k`${w(Tr)}`,k`${w(Ir)}`,k`${w(Sr)}`,k`${w(zr)}`,k`${w(Lr)}`,k`${w(Mr)}`,k`${w(Rr)}`,k`${w(Dr)}`,k`${w(Pr)}`,k`${w(Or)}`,Vr]}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===Fr.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Fr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Fr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Fr.DATETIME:"boolean"==typeof this.value?this.type=Fr.CHECKBOX:"number"==typeof this.value?this.type=Fr.NUMBER:"string"==typeof this.value?this.type=Fr.TEXT:this.type=Fr.JSON),!0}focus(){this.type===Fr.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){var t;if(this.type){const n=!this.fullWidth&&this.label;let i=!this.fullWidth&&this.outlined,r=!!this.helperText;const o=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),a={"mdc-text-field-helper-text--persistent":!o&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":o},s=null!==this.value&&void 0!==this.value||!1===this.value;let l=n?rt`<span class="mdc-floating-label ${s?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case Fr.RADIO:const n=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
562
562
|
<div class="mdc-radio-container">
|
|
563
|
-
${
|
|
563
|
+
${n?n.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`
|
|
564
564
|
<div id="field" class="mdc-form-field">
|
|
565
565
|
<div class="mdc-radio">
|
|
566
566
|
<input type="radio"
|
|
@@ -583,10 +583,10 @@
|
|
|
583
583
|
|
|
584
584
|
`))):""}
|
|
585
585
|
</div>
|
|
586
|
-
`;case Fr.SWITCH:const
|
|
586
|
+
`;case Fr.SWITCH:const c={"mdc-switch--disabled":this.disabled||this.readonly,"mdc-switch--full-width":this.fullWidth,"mdc-switch--checked":this.value};return rt`
|
|
587
587
|
<span id="wrapper">
|
|
588
588
|
${this.label?rt`<label for="elem" class="${this.disabled?"mdc-switch--disabled":""}">${this.label}</label>`:""}
|
|
589
|
-
<div id="component" class="mdc-switch ${ye(
|
|
589
|
+
<div id="component" class="mdc-switch ${ye(c)}">
|
|
590
590
|
<div class="mdc-switch__track"></div>
|
|
591
591
|
<div class="mdc-switch__thumb-underlay">
|
|
592
592
|
<div class="mdc-switch__thumb">
|
|
@@ -600,23 +600,23 @@
|
|
|
600
600
|
</div>
|
|
601
601
|
</div>
|
|
602
602
|
</span>
|
|
603
|
-
`;case Fr.LIST:const
|
|
604
|
-
<div id="component" class="mdc-list mdc-select ${ye(
|
|
603
|
+
`;case Fr.LIST:const d={"mdc-select--outlined":i,"mdc-select--disabled":this.disabled,"mdc-select--required":this.required,"mdc-select--dense":!1,"mdc-select--no-label":!this.label,"mdc-select--with-leading-icon":!!this.icon},u=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
604
|
+
<div id="component" class="mdc-list mdc-select ${ye(d)}" @MDCList:action="${t=>this.onValueChange(void 0,-1===t.detail.index?void 0:Array.isArray(this.options[t.detail.index])?this.options[t.detail.index][0]:this.options[t.detail.index])}">
|
|
605
605
|
<ul class="mdc-list">
|
|
606
|
-
${
|
|
606
|
+
${u?u.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`<li class="${ye({"mdc-list-item":!0,"mdc-list-item--selected":this.value===t})}" role="option" data-value="${t}"><or-translate value="${e}"></or-translate></li>`))):""}
|
|
607
607
|
</ul>
|
|
608
608
|
</div>
|
|
609
|
-
`;case Fr.SELECT:const
|
|
609
|
+
`;case Fr.SELECT:const h={"mdc-select--outlined":i,"mdc-select--filled":!i,"mdc-select--disabled":this.disabled||this.readonly,"mdc-select--required":this.required,"mdc-select--dense":!1,"dense-comfortable":this.comfortable,"mdc-select--no-label":!this.label,"mdc-select--with-leading-icon":!!this.icon,"or-mwc-input--rounded":this.rounded};let p;p=null!=this.searchProvider?this.searchProvider(this.searchableValue):this.resolveOptions(this.options);const m=(t,e)=>{var n;const i=e.value;if(this.multiple){t.stopPropagation();const e=null!==(n=this._tempValue)&&void 0!==n?n:Array.isArray(this.value)?[...this.value]:void 0!==this.value?[this.value]:[],r=e.findIndex((t=>t===i));r>=0?e.splice(r,1):e.push(i);const o=t.composedPath()[0].closest("li"),a=o.getElementsByTagName("or-icon")[0];o&&(r>=0?o.classList.remove("mdc-list-item--selected"):o.classList.add("mdc-list-item--selected")),a&&(a.icon=r>=0?"checkbox-blank-outline":"checkbox-marked"),this._tempValue=e}else null==this.searchProvider&&Array.isArray(p)||this.onValueChange(void 0,e.value)},f=()=>{var t;const e=null!==(t=this._tempValue)&&void 0!==t?t:this.value;if(window.setTimeout((()=>{this._mdcComponent&&this._mdcComponent.foundation.adapter.floatLabel(e&&(!Array.isArray(e)||e.length>0))})),!this._tempValue)return;const n=[...this._tempValue];this._tempValue=void 0,this.onValueChange(void 0,n)},g=t=>null==this.searchProvider||t&&0!=t.length?fr(this.multiple?pr.MULTI_TICK:pr.SELECT,rt`${null==t?void 0:t.map((([t,e],n)=>gr({text:e,value:t},n,Array.isArray(this.value)?this.value:this.value?[this.value]:[],this.multiple?pr.MULTI_TICK:pr.SELECT,!1,m)))}`,!1,void 0):rt`<span class="mdc-text-field-helper-line" style="margin: 8px 8px 8px 0;">${lr.i18next.t("noResults")}</span>`;return rt`
|
|
610
610
|
<div id="component"
|
|
611
|
-
class="mdc-select ${ye(
|
|
612
|
-
@MDCSelect:change="${t=>yr(this,void 0,void 0,(function*(){const e=Array.isArray(
|
|
611
|
+
class="mdc-select ${ye(h)}"
|
|
612
|
+
@MDCSelect:change="${t=>yr(this,void 0,void 0,(function*(){const e=Array.isArray(p)?p:yield p;this.onValueChange(void 0,-1===t.detail.index?void 0:Array.isArray(e[t.detail.index])?e[t.detail.index][0]:e[t.detail.index])}))}">
|
|
613
613
|
<div class="mdc-select__anchor" role="button"
|
|
614
614
|
aria-haspopup="listbox"
|
|
615
615
|
aria-expanded="false"
|
|
616
616
|
aria-disabled="${""+(this.disabled||this.readonly)}"
|
|
617
617
|
aria-labelledby="label selected-text">
|
|
618
|
-
${
|
|
619
|
-
${
|
|
618
|
+
${i?void 0:rt`<span class="mdc-select__ripple"></span>`}
|
|
619
|
+
${i?this.renderOutlined(l):l}
|
|
620
620
|
<span class="mdc-select__selected-text-container">
|
|
621
621
|
<span id="selected-text" class="mdc-select__selected-text"></span>
|
|
622
622
|
</span>
|
|
@@ -638,9 +638,9 @@
|
|
|
638
638
|
</polygon>
|
|
639
639
|
</svg>
|
|
640
640
|
</span>
|
|
641
|
-
${
|
|
641
|
+
${i?"":rt`<div class="mdc-line-ripple"></div>`}
|
|
642
642
|
</div>
|
|
643
|
-
<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="${
|
|
643
|
+
<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="${f}">
|
|
644
644
|
${we(null!=this.searchProvider,(()=>rt`
|
|
645
645
|
<label id="select-searchable" class="mdc-text-field mdc-text-field--filled">
|
|
646
646
|
<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">
|
|
@@ -651,11 +651,11 @@
|
|
|
651
651
|
/>
|
|
652
652
|
</label>
|
|
653
653
|
`))}
|
|
654
|
-
${we(Array.isArray(
|
|
654
|
+
${we(Array.isArray(p),(()=>g(p)),(()=>Te(new Promise((t=>yr(this,void 0,void 0,(function*(){t(g(yield p))})))),rt`<span class="mdc-text-field-helper-line" style="margin: 8px 8px 8px 0;">${lr.i18next.t("loading")}</span>`)))}
|
|
655
655
|
</div>
|
|
656
|
-
${
|
|
657
|
-
<p id="component-helper-text" class="mdc-select-helper-text ${ye(
|
|
658
|
-
${
|
|
656
|
+
${r||o?rt`
|
|
657
|
+
<p id="component-helper-text" class="mdc-select-helper-text ${ye(a)}" aria-hidden="true">
|
|
658
|
+
${o?this.errorMessage||this.validationMessage:this.helperText}
|
|
659
659
|
</p>`:""}
|
|
660
660
|
</div>
|
|
661
661
|
`;case Fr.BUTTON_TOGGLE:return rt`
|
|
@@ -677,9 +677,9 @@
|
|
|
677
677
|
${this.label?rt`<span class="${this.action?"mdc-fab__label":"mdc-button__label"}"><or-translate .value="${this.label}"></or-translate></span>`:""}
|
|
678
678
|
${!r&&this.iconTrailing?rt`<or-icon class="${this.action?"mdc-fab__icon":"mdc-button__icon"}" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>`:""}
|
|
679
679
|
</button>
|
|
680
|
-
`}case Fr.CHECKBOX_LIST:Array.isArray(this.value)||(null===this.value||void 0===this.value?this.value=[]:this.value=[this.value]);const
|
|
680
|
+
`}case Fr.CHECKBOX_LIST:Array.isArray(this.value)||(null===this.value||void 0===this.value?this.value=[]:this.value=[this.value]);const _=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
681
681
|
<div class="mdc-checkbox-list">
|
|
682
|
-
${
|
|
682
|
+
${_?_.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`
|
|
683
683
|
<div id="field" class="mdc-form-field">
|
|
684
684
|
<div id="component" class="mdc-checkbox">
|
|
685
685
|
<input type="checkbox"
|
|
@@ -697,9 +697,9 @@
|
|
|
697
697
|
|
|
698
698
|
`))):""}
|
|
699
699
|
</div>
|
|
700
|
-
`;case Fr.CHECKBOX:let
|
|
700
|
+
`;case Fr.CHECKBOX:let b={"mdc-checkbox":!0,"mdc-checkbox--disabled":this.disabled||this.readonly};return rt`
|
|
701
701
|
<div id="field" class="mdc-form-field">
|
|
702
|
-
<div id="component" class="${ye(
|
|
702
|
+
<div id="component" class="${ye(b)}">
|
|
703
703
|
<input type="checkbox"
|
|
704
704
|
id="elem"
|
|
705
705
|
data-indeterminate="${this.indeterminate}"
|
|
@@ -727,41 +727,41 @@
|
|
|
727
727
|
/>
|
|
728
728
|
<label style="margin-left: 10px; cursor: pointer" for="elem">${this.label}</label>
|
|
729
729
|
</div>
|
|
730
|
-
`;case Fr.NUMBER:case Fr.RANGE:case Fr.DATE:case Fr.DATETIME:case Fr.TIME:case Fr.MONTH:case Fr.WEEK:case Fr.EMAIL:case Fr.PASSWORD:case Fr.TELEPHONE:case Fr.URL:case Fr.TEXT:case Fr.TEXTAREA:case Fr.JSON:case Fr.JSON_OBJECT:{let
|
|
730
|
+
`;case Fr.NUMBER:case Fr.RANGE:case Fr.DATE:case Fr.DATETIME:case Fr.TIME:case Fr.MONTH:case Fr.WEEK:case Fr.EMAIL:case Fr.PASSWORD:case Fr.TELEPHONE:case Fr.URL:case Fr.TEXT:case Fr.TEXTAREA:case Fr.JSON:case Fr.JSON_OBJECT:{let n,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===Fr.JSON||this.type===Fr.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 n=this.format?Object.assign({},this.format):{};switch(this.type){case Fr.TIME:n.asDate=!0,n.hour12=!1,n.timeStyle=this.step&&this.step<60?"medium":"short";break;case Fr.DATE:n.asDate=!0,n.momentJsFormat="YYYY-MM-DD";break;case Fr.WEEK:n.asDate=!0,n.momentJsFormat="YYYY-[W]WW";break;case Fr.MONTH:n.asDate=!0,n.momentJsFormat="YYYY-MM";break;case Fr.DATETIME:n.asDate=!0,n.momentJsFormat="YYYY-MM-DDTHH:mm";break;case Fr.NUMBER:null!==(t=n.maximumFractionDigits)&&void 0!==t||(n.maximumFractionDigits=20)}n.useGrouping=!1,c=c.map((t=>void 0!==t?e.Util.getValueAsString(t,(()=>n),"en-GB"):void 0))}let d=this.label,u=this.type,h="component";if(this.type===Fr.RANGE&&(d=void 0,i=!1,r=!1,u=Fr.NUMBER,h="number"),this.type!==Fr.RANGE||!this.disableSliderNumberInput){const t={"mdc-text-field":!0,"mdc-text-field--invalid":!this.valid,"mdc-text-field--filled":!i,"mdc-text-field--outlined":i,"mdc-text-field--textarea":u===Fr.TEXTAREA||u===Fr.JSON||u===Fr.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!i,"dense-comfortable":this.comfortable&&!(u===Fr.TEXTAREA||u===Fr.JSON||u===Fr.JSON_OBJECT),"dense-compact":!this.comfortable&&this.compact,"mdc-text-field--label-floating":s,"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};n=u===Fr.TEXTAREA||u===Fr.JSON||u===Fr.JSON_OBJECT?rt`
|
|
731
731
|
<textarea id="elem" class="mdc-text-field__input ${this.resizeVertical?"resize-vertical":""}" ?required="${this.required}"
|
|
732
732
|
?readonly="${this.readonly}" ?disabled="${this.disabled}" minlength="${xe(this.minLength)}"
|
|
733
733
|
maxlength="${xe(this.maxLength)}" rows="${this.rows?this.rows:5}"
|
|
734
|
-
cols="${xe(this.cols)}" aria-label="${xe(
|
|
735
|
-
aria-labelledby="${xe(
|
|
736
|
-
@change="${t=>this.onValueChange(t.target,t.target.value)}">${
|
|
737
|
-
<input type="${
|
|
734
|
+
cols="${xe(this.cols)}" aria-label="${xe(d)}"
|
|
735
|
+
aria-labelledby="${xe(d?"label":void 0)}"
|
|
736
|
+
@change="${t=>this.onValueChange(t.target,t.target.value)}">${c[0]?c[0]:""}</textarea>`:rt`
|
|
737
|
+
<input type="${u}" id="elem" aria-labelledby="${xe(d?"label":void 0)}"
|
|
738
738
|
class="mdc-text-field__input" ?required="${this.required}" ?readonly="${this.readonly}"
|
|
739
|
-
?disabled="${this.disabled}" min="${xe(
|
|
739
|
+
?disabled="${this.disabled}" min="${xe(c[1])}" max="${xe(c[2])}"
|
|
740
740
|
step="${this.step?this.step:"any"}" minlength="${xe(this.minLength)}" pattern="${xe(this.pattern)}"
|
|
741
741
|
maxlength="${xe(this.maxLength)}" placeholder="${xe(this.placeHolder)}"
|
|
742
|
-
.value="${null!==
|
|
742
|
+
.value="${null!==c[0]&&void 0!==c[0]?c[0]:""}"
|
|
743
743
|
@keydown="${t=>{"Enter"!==t.code&&"NumpadEnter"!==t.code||this.onValueChange(t.target,t.target.value,!0)}}"
|
|
744
744
|
@blur="${t=>{""===t.target.value&&this.reportValidity()}}"
|
|
745
|
-
@change="${t=>this.onValueChange(t.target,t.target.value)}" />`,
|
|
746
|
-
<label id="${
|
|
745
|
+
@change="${t=>this.onValueChange(t.target,t.target.value)}" />`,n=rt`
|
|
746
|
+
<label id="${h}" class="${ye(t)}">
|
|
747
747
|
${this.icon?rt`<or-icon class="mdc-text-field__icon mdc-text-field__icon--leading" style="color: ${this.iconColor?"#"+this.iconColor:"unset"}" aria-hidden="true" icon="${this.icon}"></or-icon>`:""}
|
|
748
|
-
${
|
|
749
|
-
${
|
|
750
|
-
${
|
|
751
|
-
${
|
|
748
|
+
${i?"":rt`<span class="mdc-text-field__ripple"></span>`}
|
|
749
|
+
${n}
|
|
750
|
+
${i?this.renderOutlined(l):l}
|
|
751
|
+
${i?"":rt`<span class="mdc-line-ripple"></span>`}
|
|
752
752
|
${this.iconTrailing?rt`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>`:""}
|
|
753
753
|
</label>
|
|
754
|
-
${
|
|
754
|
+
${r||o?rt`
|
|
755
755
|
<div class="mdc-text-field-helper-line">
|
|
756
|
-
<div class="mdc-text-field-helper-text ${ye(
|
|
756
|
+
<div class="mdc-text-field-helper-text ${ye(a)}">${o?this.errorMessage||this.validationMessage:this.helperText}</div>
|
|
757
757
|
${this.charCounter&&!this.readonly?rt`<div class="mdc-text-field-character-counter"></div>`:""}
|
|
758
758
|
</div>
|
|
759
759
|
`:""}
|
|
760
|
-
`}if(this.type===Fr.RANGE){const
|
|
760
|
+
`}if(this.type===Fr.RANGE){const t={"mdc-slider":!0,"mdc-slider--range":this.continuous,"mdc-slider--discreet":!this.continuous,"mdc-slider--disabled":this.disabled||this.readonly};n=rt`
|
|
761
761
|
<span id="wrapper">
|
|
762
762
|
${this.label?rt`<label for="component" class="${this.disabled?"mdc-switch--disabled":""}">${this.label}</label>`:""}
|
|
763
|
-
<div id="component" class="${ye(
|
|
764
|
-
<input id="elem" class="mdc-slider__input" type="range" min="${xe(
|
|
763
|
+
<div id="component" class="${ye(t)}" @MDCSlider:change="${t=>this.onValueChange(void 0,t.detail.value)}">
|
|
764
|
+
<input id="elem" class="mdc-slider__input" type="range" min="${xe(c[1])}" max="${xe(c[2])}" value="${c[0]||c[1]||0}" name="slider" step="${this.step||1}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" aria-label="${xe(this.label)}" />
|
|
765
765
|
<div class="mdc-slider__track">
|
|
766
766
|
<div class="mdc-slider__track--inactive"></div>
|
|
767
767
|
<div class="mdc-slider__track--active">
|
|
@@ -779,9 +779,9 @@
|
|
|
779
779
|
<div class="mdc-slider__thumb-knob"></div>
|
|
780
780
|
</div>
|
|
781
781
|
</div>
|
|
782
|
-
${
|
|
782
|
+
${n?rt`<div style="min-width: 70px; width: 70px;">${n}</div>`:""}
|
|
783
783
|
</span>
|
|
784
|
-
`}return
|
|
784
|
+
`}return n}}}return rt`<span>INPUT TYPE NOT IMPLEMENTED</span>`}_getFormat(){if(this.format)return this.format}update(t){if(t.has("autoValidate")&&this._mdcComponent){const t=this._mdcComponent;t.foundation&&t.foundation.setValidateOnValueChange&&t.foundation.setValidateOnValueChange(this.autoValidate)}super.update(t)}firstUpdated(t){super.firstUpdated(t),this.autoValidate&&this.reportValidity()}updated(t){var e,n;if(super.updated(t),t.has("type")){const t=this.shadowRoot.getElementById("component");if(this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0),t&&this.type){switch(this.type){case Fr.LIST:const e=new Si(t);this._mdcComponent=e,e.selectedIndex=this._selectedIndex;break;case Fr.SELECT:const n=new Wi(t);this._mdcComponent=n,null!==this.value&&void 0!==this.value||(n.selectedIndex=-1),this.multiple&&(this._mdcComponent.foundation.adapter.getSelectedIndex=()=>{if(!Array.isArray(this.value)||0===this.value.length)return-1;const t=this.value[0];return this._mdcComponent.foundation.adapter.getMenuItemValues().indexOf(t)}),n.useDefaultValidation=!this.multiple,n.valid=!this.required||!this.multiple&&n.valid||this.multiple&&Array.isArray(this.value)&&this.value.length>0;const i=this.getSelectedTextValue();this._mdcComponent.foundation.adapter.setSelectedText(i),this._mdcComponent.foundation.adapter.floatLabel(!!i),this._menuObserver||(this._menuObserver=new IntersectionObserver(((t,e)=>{var n,i;t[0].target.style.minWidth!=(null===(n=t[0].target.parentElement)||void 0===n?void 0:n.clientWidth)+"px"&&(t[0].target.style.minWidth=(null===(i=t[0].target.parentElement)||void 0===i?void 0:i.clientWidth)+"px")})),this._menuObserver.observe(this.shadowRoot.getElementById("mdc-select-menu")));const r=void 0!==this.searchProvider,o=this.multiple;n.menu.menuSurface_.foundation.handleBodyClick=function(t){const e=t.composedPath()[0];if(this.adapter.isElementInContainer(e)){if(!r)return;if(e instanceof Element&&!e.className.includes("mdc-list-item"))return;if(o)return}n.menu.menuSurface_.close()};break;case Fr.RADIO:case Fr.CHECKBOX_LIST:case Fr.COLOUR:break;case Fr.BUTTON:case Fr.BUTTON_MOMENTARY:const a=!this.action&&!this.label,s=new on(t);a&&(s.unbounded=!0),this._mdcComponent=s;break;case Fr.BUTTON_TOGGLE:this._mdcComponent=new rr(t);break;case Fr.CHECKBOX:this._mdcComponent=new Fn(t);const l=this.shadowRoot.getElementById("field");if(l){const t=new Qi(l);t.input=this._mdcComponent,this._mdcComponent2=t}break;case Fr.SWITCH:this._mdcComponent=new jn(t);break;case Fr.RANGE:this._mdcComponent=new li(t);const c=this.shadowRoot.getElementById("number");if(c){const t=new Tn(c);t.useNativeValidation=!1,this._mdcComponent2=t}break;default:const d=new Tn(t);d.useNativeValidation=!1,this._mdcComponent=d}this._mdcComponent&&this.focused&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}}else{if(this.type===Fr.SELECT&&this._mdcComponent){t.has("options")&&this._mdcComponent.layoutOptions(),this._mdcComponent.disabled=!(!this.disabled&&!this.readonly),this._mdcComponent.useDefaultValidation=!this.multiple,this._mdcComponent.valid=!this.required||!this.multiple&&this._mdcComponent.valid||this.multiple&&Array.isArray(this.value)&&this.value.length>0;const e=this.getSelectedTextValue();this._mdcComponent.foundation.adapter.setSelectedText(e),this._mdcComponent.foundation.adapter.floatLabel(!!e)}else if(this.type===Fr.RANGE&&this._mdcComponent){const t=this._mdcComponent;t.setDisabled(this.disabled||this.readonly),t.setValue(this.value)}else if(this.type===Fr.SWITCH&&this._mdcComponent)this._mdcComponent.checked=this.value;else if(this.type===Fr.CHECKBOX&&this._mdcComponent){const t=this._mdcComponent;t.checked=!!this.value,t.disabled=!(!this.disabled&&!this.readonly)}this._mdcComponent&&(this._mdcComponent.required=!!this.required)}t.has("label")&&(null===(n=null===(e=this._mdcComponent)||void 0===e?void 0:e.layout)||void 0===n||n.call(e)),this.autoValidate&&this.reportValidity()}renderOutlined(t){return rt`
|
|
785
785
|
<span class="mdc-notched-outline">
|
|
786
786
|
<span class="mdc-notched-outline__leading"></span>
|
|
787
787
|
${t?rt`
|
package/dist/umd/index.js
CHANGED
|
@@ -558,9 +558,9 @@
|
|
|
558
558
|
.mdc-list-item__graphic > or-icon {
|
|
559
559
|
pointer-events: none;
|
|
560
560
|
}
|
|
561
|
-
`;let Vr=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[k`${w(kr)}`,k`${w(yr)}`,k`${w(wr)}`,k`${w(Er)}`,k`${w(Cr)}`,k`${w(Ar)}`,k`${w(Ir)}`,k`${w(Tr)}`,k`${w(Sr)}`,k`${w(Lr)}`,k`${w(Or)}`,k`${w(zr)}`,k`${w(Rr)}`,k`${w(Mr)}`,k`${w(Nr)}`,k`${w(Dr)}`,Hr]}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===Br.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Br.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Br.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Br.DATETIME:"boolean"==typeof this.value?this.type=Br.CHECKBOX:"number"==typeof this.value?this.type=Br.NUMBER:"string"==typeof this.value?this.type=Br.TEXT:this.type=Br.JSON),!0}focus(){this.type===Br.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){if(this.type){const
|
|
561
|
+
`;let Vr=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[k`${w(kr)}`,k`${w(yr)}`,k`${w(wr)}`,k`${w(Er)}`,k`${w(Cr)}`,k`${w(Ar)}`,k`${w(Ir)}`,k`${w(Tr)}`,k`${w(Sr)}`,k`${w(Lr)}`,k`${w(Or)}`,k`${w(zr)}`,k`${w(Rr)}`,k`${w(Mr)}`,k`${w(Nr)}`,k`${w(Dr)}`,Hr]}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===Br.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===Br.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===Br.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=Br.DATETIME:"boolean"==typeof this.value?this.type=Br.CHECKBOX:"number"==typeof this.value?this.type=Br.NUMBER:"string"==typeof this.value?this.type=Br.TEXT:this.type=Br.JSON),!0}focus(){this.type===Br.RANGE&&this._mdcComponent2?this._mdcComponent2.focus():this._mdcComponent&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}render(){var t;if(this.type){const n=!this.fullWidth&&this.label;let i=!this.fullWidth&&this.outlined,r=!!this.helperText;const o=!(this.isUiValid||!this.errorMessage&&!this.validationMessage),a={"mdc-text-field-helper-text--persistent":!o&&this.helperPersistent,"mdc-text-field-helper-text--validation-msg":o},l=null!==this.value&&void 0!==this.value||!1===this.value;let c=n?rt`<span class="mdc-floating-label ${l?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case Br.RADIO:const n=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
562
562
|
<div class="mdc-radio-container">
|
|
563
|
-
${
|
|
563
|
+
${n?n.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`
|
|
564
564
|
<div id="field" class="mdc-form-field">
|
|
565
565
|
<div class="mdc-radio">
|
|
566
566
|
<input type="radio"
|
|
@@ -583,10 +583,10 @@
|
|
|
583
583
|
|
|
584
584
|
`))):""}
|
|
585
585
|
</div>
|
|
586
|
-
`;case Br.SWITCH:const
|
|
586
|
+
`;case Br.SWITCH:const s={"mdc-switch--disabled":this.disabled||this.readonly,"mdc-switch--full-width":this.fullWidth,"mdc-switch--checked":this.value};return rt`
|
|
587
587
|
<span id="wrapper">
|
|
588
588
|
${this.label?rt`<label for="elem" class="${this.disabled?"mdc-switch--disabled":""}">${this.label}</label>`:""}
|
|
589
|
-
<div id="component" class="mdc-switch ${xe(
|
|
589
|
+
<div id="component" class="mdc-switch ${xe(s)}">
|
|
590
590
|
<div class="mdc-switch__track"></div>
|
|
591
591
|
<div class="mdc-switch__thumb-underlay">
|
|
592
592
|
<div class="mdc-switch__thumb">
|
|
@@ -600,23 +600,23 @@
|
|
|
600
600
|
</div>
|
|
601
601
|
</div>
|
|
602
602
|
</span>
|
|
603
|
-
`;case Br.LIST:const
|
|
604
|
-
<div id="component" class="mdc-list mdc-select ${xe(
|
|
603
|
+
`;case Br.LIST:const d={"mdc-select--outlined":i,"mdc-select--disabled":this.disabled,"mdc-select--required":this.required,"mdc-select--dense":!1,"mdc-select--no-label":!this.label,"mdc-select--with-leading-icon":!!this.icon},p=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
604
|
+
<div id="component" class="mdc-list mdc-select ${xe(d)}" @MDCList:action="${t=>this.onValueChange(void 0,-1===t.detail.index?void 0:Array.isArray(this.options[t.detail.index])?this.options[t.detail.index][0]:this.options[t.detail.index])}">
|
|
605
605
|
<ul class="mdc-list">
|
|
606
|
-
${
|
|
606
|
+
${p?p.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`<li class="${xe({"mdc-list-item":!0,"mdc-list-item--selected":this.value===t})}" role="option" data-value="${t}"><or-translate value="${e}"></or-translate></li>`))):""}
|
|
607
607
|
</ul>
|
|
608
608
|
</div>
|
|
609
|
-
`;case Br.SELECT:const
|
|
609
|
+
`;case Br.SELECT:const m={"mdc-select--outlined":i,"mdc-select--filled":!i,"mdc-select--disabled":this.disabled||this.readonly,"mdc-select--required":this.required,"mdc-select--dense":!1,"dense-comfortable":this.comfortable,"mdc-select--no-label":!this.label,"mdc-select--with-leading-icon":!!this.icon,"or-mwc-input--rounded":this.rounded};let u;u=null!=this.searchProvider?this.searchProvider(this.searchableValue):this.resolveOptions(this.options);const h=(t,e)=>{var n;const i=e.value;if(this.multiple){t.stopPropagation();const e=null!==(n=this._tempValue)&&void 0!==n?n:Array.isArray(this.value)?[...this.value]:void 0!==this.value?[this.value]:[],r=e.findIndex((t=>t===i));r>=0?e.splice(r,1):e.push(i);const o=t.composedPath()[0].closest("li"),a=o.getElementsByTagName("or-icon")[0];o&&(r>=0?o.classList.remove("mdc-list-item--selected"):o.classList.add("mdc-list-item--selected")),a&&(a.icon=r>=0?"checkbox-blank-outline":"checkbox-marked"),this._tempValue=e}else null==this.searchProvider&&Array.isArray(u)||this.onValueChange(void 0,e.value)},f=()=>{var t;const e=null!==(t=this._tempValue)&&void 0!==t?t:this.value;if(window.setTimeout((()=>{this._mdcComponent&&this._mdcComponent.foundation.adapter.floatLabel(e&&(!Array.isArray(e)||e.length>0))})),!this._tempValue)return;const n=[...this._tempValue];this._tempValue=void 0,this.onValueChange(void 0,n)},g=t=>null==this.searchProvider||t&&0!=t.length?fr(this.multiple?ur.MULTI_TICK:ur.SELECT,rt`${null==t?void 0:t.map((([t,e],n)=>gr({text:e,value:t},n,Array.isArray(this.value)?this.value:this.value?[this.value]:[],this.multiple?ur.MULTI_TICK:ur.SELECT,!1,h)))}`,!1,void 0):rt`<span class="mdc-text-field-helper-line" style="margin: 8px 8px 8px 0;">${cr.i18next.t("noResults")}</span>`;return rt`
|
|
610
610
|
<div id="component"
|
|
611
|
-
class="mdc-select ${xe(
|
|
612
|
-
@MDCSelect:change="${t=>xr(this,void 0,void 0,(function*(){const e=Array.isArray(
|
|
611
|
+
class="mdc-select ${xe(m)}"
|
|
612
|
+
@MDCSelect:change="${t=>xr(this,void 0,void 0,(function*(){const e=Array.isArray(u)?u:yield u;this.onValueChange(void 0,-1===t.detail.index?void 0:Array.isArray(e[t.detail.index])?e[t.detail.index][0]:e[t.detail.index])}))}">
|
|
613
613
|
<div class="mdc-select__anchor" role="button"
|
|
614
614
|
aria-haspopup="listbox"
|
|
615
615
|
aria-expanded="false"
|
|
616
616
|
aria-disabled="${""+(this.disabled||this.readonly)}"
|
|
617
617
|
aria-labelledby="label selected-text">
|
|
618
|
-
${
|
|
619
|
-
${
|
|
618
|
+
${i?void 0:rt`<span class="mdc-select__ripple"></span>`}
|
|
619
|
+
${i?this.renderOutlined(c):c}
|
|
620
620
|
<span class="mdc-select__selected-text-container">
|
|
621
621
|
<span id="selected-text" class="mdc-select__selected-text"></span>
|
|
622
622
|
</span>
|
|
@@ -638,9 +638,9 @@
|
|
|
638
638
|
</polygon>
|
|
639
639
|
</svg>
|
|
640
640
|
</span>
|
|
641
|
-
${
|
|
641
|
+
${i?"":rt`<div class="mdc-line-ripple"></div>`}
|
|
642
642
|
</div>
|
|
643
|
-
<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="${
|
|
643
|
+
<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="${f}">
|
|
644
644
|
${we(null!=this.searchProvider,(()=>rt`
|
|
645
645
|
<label id="select-searchable" class="mdc-text-field mdc-text-field--filled">
|
|
646
646
|
<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">
|
|
@@ -651,11 +651,11 @@
|
|
|
651
651
|
/>
|
|
652
652
|
</label>
|
|
653
653
|
`))}
|
|
654
|
-
${we(Array.isArray(
|
|
654
|
+
${we(Array.isArray(u),(()=>g(u)),(()=>Ie(new Promise((t=>xr(this,void 0,void 0,(function*(){t(g(yield u))})))),rt`<span class="mdc-text-field-helper-line" style="margin: 8px 8px 8px 0;">${cr.i18next.t("loading")}</span>`)))}
|
|
655
655
|
</div>
|
|
656
|
-
${
|
|
657
|
-
<p id="component-helper-text" class="mdc-select-helper-text ${xe(
|
|
658
|
-
${
|
|
656
|
+
${r||o?rt`
|
|
657
|
+
<p id="component-helper-text" class="mdc-select-helper-text ${xe(a)}" aria-hidden="true">
|
|
658
|
+
${o?this.errorMessage||this.validationMessage:this.helperText}
|
|
659
659
|
</p>`:""}
|
|
660
660
|
</div>
|
|
661
661
|
`;case Br.BUTTON_TOGGLE:return rt`
|
|
@@ -677,9 +677,9 @@
|
|
|
677
677
|
${this.label?rt`<span class="${this.action?"mdc-fab__label":"mdc-button__label"}"><or-translate .value="${this.label}"></or-translate></span>`:""}
|
|
678
678
|
${!r&&this.iconTrailing?rt`<or-icon class="${this.action?"mdc-fab__icon":"mdc-button__icon"}" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>`:""}
|
|
679
679
|
</button>
|
|
680
|
-
`}case Br.CHECKBOX_LIST:Array.isArray(this.value)||(null===this.value||void 0===this.value?this.value=[]:this.value=[this.value]);const
|
|
680
|
+
`}case Br.CHECKBOX_LIST:Array.isArray(this.value)||(null===this.value||void 0===this.value?this.value=[]:this.value=[this.value]);const b=this.resolveOptions(this.options);return this._selectedIndex=-1,rt`
|
|
681
681
|
<div class="mdc-checkbox-list">
|
|
682
|
-
${
|
|
682
|
+
${b?b.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),rt`
|
|
683
683
|
<div id="field" class="mdc-form-field">
|
|
684
684
|
<div id="component" class="mdc-checkbox">
|
|
685
685
|
<input type="checkbox"
|
|
@@ -697,9 +697,9 @@
|
|
|
697
697
|
|
|
698
698
|
`))):""}
|
|
699
699
|
</div>
|
|
700
|
-
`;case Br.CHECKBOX:let
|
|
700
|
+
`;case Br.CHECKBOX:let v={"mdc-checkbox":!0,"mdc-checkbox--disabled":this.disabled||this.readonly};return rt`
|
|
701
701
|
<div id="field" class="mdc-form-field">
|
|
702
|
-
<div id="component" class="${xe(
|
|
702
|
+
<div id="component" class="${xe(v)}">
|
|
703
703
|
<input type="checkbox"
|
|
704
704
|
id="elem"
|
|
705
705
|
data-indeterminate="${this.indeterminate}"
|
|
@@ -727,41 +727,41 @@
|
|
|
727
727
|
/>
|
|
728
728
|
<label style="margin-left: 10px; cursor: pointer" for="elem">${this.label}</label>
|
|
729
729
|
</div>
|
|
730
|
-
`;case Br.NUMBER:case Br.RANGE:case Br.DATE:case Br.DATETIME:case Br.TIME:case Br.MONTH:case Br.WEEK:case Br.EMAIL:case Br.PASSWORD:case Br.TELEPHONE:case Br.URL:case Br.TEXT:case Br.TEXTAREA:case Br.JSON:case Br.JSON_OBJECT:{let
|
|
730
|
+
`;case Br.NUMBER:case Br.RANGE:case Br.DATE:case Br.DATETIME:case Br.TIME:case Br.MONTH:case Br.WEEK:case Br.EMAIL:case Br.PASSWORD:case Br.TELEPHONE:case Br.URL:case Br.TEXT:case Br.TEXTAREA:case Br.JSON:case Br.JSON_OBJECT:{let n,s=[void 0===this.value||null===this.value?void 0:this.value,this.min,this.max];if(s.some((t=>"string"!=typeof t)))if(this.type===Br.JSON||this.type===Br.JSON_OBJECT)if(void 0!==s[0]){if("string"!=typeof s[0]||null===s[0])try{s[0]=JSON.stringify(s[0],null,2)}catch(t){console.warn("Failed to parse JSON expression for input control"),s[0]=""}}else s[0]="";else{const n=this.format?Object.assign({},this.format):{};switch(this.type){case Br.TIME:n.asDate=!0,n.hour12=!1,n.timeStyle=this.step&&this.step<60?"medium":"short";break;case Br.DATE:n.asDate=!0,n.momentJsFormat="YYYY-MM-DD";break;case Br.WEEK:n.asDate=!0,n.momentJsFormat="YYYY-[W]WW";break;case Br.MONTH:n.asDate=!0,n.momentJsFormat="YYYY-MM";break;case Br.DATETIME:n.asDate=!0,n.momentJsFormat="YYYY-MM-DDTHH:mm";break;case Br.NUMBER:null!==(t=n.maximumFractionDigits)&&void 0!==t||(n.maximumFractionDigits=20)}n.useGrouping=!1,s=s.map((t=>void 0!==t?e.Util.getValueAsString(t,(()=>n),"en-GB"):void 0))}let d=this.label,p=this.type,m="component";if(this.type===Br.RANGE&&(d=void 0,i=!1,r=!1,p=Br.NUMBER,m="number"),this.type!==Br.RANGE||!this.disableSliderNumberInput){const t={"mdc-text-field":!0,"mdc-text-field--invalid":!this.valid,"mdc-text-field--filled":!i,"mdc-text-field--outlined":i,"mdc-text-field--textarea":p===Br.TEXTAREA||p===Br.JSON||p===Br.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!i,"dense-comfortable":this.comfortable&&!(p===Br.TEXTAREA||p===Br.JSON||p===Br.JSON_OBJECT),"dense-compact":!this.comfortable&&this.compact,"mdc-text-field--label-floating":l,"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};n=p===Br.TEXTAREA||p===Br.JSON||p===Br.JSON_OBJECT?rt`
|
|
731
731
|
<textarea id="elem" class="mdc-text-field__input ${this.resizeVertical?"resize-vertical":""}" ?required="${this.required}"
|
|
732
732
|
?readonly="${this.readonly}" ?disabled="${this.disabled}" minlength="${ye(this.minLength)}"
|
|
733
733
|
maxlength="${ye(this.maxLength)}" rows="${this.rows?this.rows:5}"
|
|
734
|
-
cols="${ye(this.cols)}" aria-label="${ye(
|
|
735
|
-
aria-labelledby="${ye(
|
|
736
|
-
@change="${t=>this.onValueChange(t.target,t.target.value)}">${
|
|
737
|
-
<input type="${
|
|
734
|
+
cols="${ye(this.cols)}" aria-label="${ye(d)}"
|
|
735
|
+
aria-labelledby="${ye(d?"label":void 0)}"
|
|
736
|
+
@change="${t=>this.onValueChange(t.target,t.target.value)}">${s[0]?s[0]:""}</textarea>`:rt`
|
|
737
|
+
<input type="${p}" id="elem" aria-labelledby="${ye(d?"label":void 0)}"
|
|
738
738
|
class="mdc-text-field__input" ?required="${this.required}" ?readonly="${this.readonly}"
|
|
739
|
-
?disabled="${this.disabled}" min="${ye(
|
|
739
|
+
?disabled="${this.disabled}" min="${ye(s[1])}" max="${ye(s[2])}"
|
|
740
740
|
step="${this.step?this.step:"any"}" minlength="${ye(this.minLength)}" pattern="${ye(this.pattern)}"
|
|
741
741
|
maxlength="${ye(this.maxLength)}" placeholder="${ye(this.placeHolder)}"
|
|
742
|
-
.value="${null!==
|
|
742
|
+
.value="${null!==s[0]&&void 0!==s[0]?s[0]:""}"
|
|
743
743
|
@keydown="${t=>{"Enter"!==t.code&&"NumpadEnter"!==t.code||this.onValueChange(t.target,t.target.value,!0)}}"
|
|
744
744
|
@blur="${t=>{""===t.target.value&&this.reportValidity()}}"
|
|
745
|
-
@change="${t=>this.onValueChange(t.target,t.target.value)}" />`,
|
|
746
|
-
<label id="${
|
|
745
|
+
@change="${t=>this.onValueChange(t.target,t.target.value)}" />`,n=rt`
|
|
746
|
+
<label id="${m}" class="${xe(t)}">
|
|
747
747
|
${this.icon?rt`<or-icon class="mdc-text-field__icon mdc-text-field__icon--leading" style="color: ${this.iconColor?"#"+this.iconColor:"unset"}" aria-hidden="true" icon="${this.icon}"></or-icon>`:""}
|
|
748
|
-
${
|
|
749
|
-
${
|
|
750
|
-
${
|
|
751
|
-
${
|
|
748
|
+
${i?"":rt`<span class="mdc-text-field__ripple"></span>`}
|
|
749
|
+
${n}
|
|
750
|
+
${i?this.renderOutlined(c):c}
|
|
751
|
+
${i?"":rt`<span class="mdc-line-ripple"></span>`}
|
|
752
752
|
${this.iconTrailing?rt`<or-icon class="mdc-text-field__icon mdc-text-field__icon--trailing" aria-hidden="true" icon="${this.iconTrailing}"></or-icon>`:""}
|
|
753
753
|
</label>
|
|
754
|
-
${
|
|
754
|
+
${r||o?rt`
|
|
755
755
|
<div class="mdc-text-field-helper-line">
|
|
756
|
-
<div class="mdc-text-field-helper-text ${xe(
|
|
756
|
+
<div class="mdc-text-field-helper-text ${xe(a)}">${o?this.errorMessage||this.validationMessage:this.helperText}</div>
|
|
757
757
|
${this.charCounter&&!this.readonly?rt`<div class="mdc-text-field-character-counter"></div>`:""}
|
|
758
758
|
</div>
|
|
759
759
|
`:""}
|
|
760
|
-
`}if(this.type===Br.RANGE){const
|
|
760
|
+
`}if(this.type===Br.RANGE){const t={"mdc-slider":!0,"mdc-slider--range":this.continuous,"mdc-slider--discreet":!this.continuous,"mdc-slider--disabled":this.disabled||this.readonly};n=rt`
|
|
761
761
|
<span id="wrapper">
|
|
762
762
|
${this.label?rt`<label for="component" class="${this.disabled?"mdc-switch--disabled":""}">${this.label}</label>`:""}
|
|
763
|
-
<div id="component" class="${xe(
|
|
764
|
-
<input id="elem" class="mdc-slider__input" type="range" min="${ye(
|
|
763
|
+
<div id="component" class="${xe(t)}" @MDCSlider:change="${t=>this.onValueChange(void 0,t.detail.value)}">
|
|
764
|
+
<input id="elem" class="mdc-slider__input" type="range" min="${ye(s[1])}" max="${ye(s[2])}" value="${s[0]||s[1]||0}" name="slider" step="${this.step||1}" ?readonly="${this.readonly}" ?disabled="${this.disabled}" aria-label="${ye(this.label)}" />
|
|
765
765
|
<div class="mdc-slider__track">
|
|
766
766
|
<div class="mdc-slider__track--inactive"></div>
|
|
767
767
|
<div class="mdc-slider__track--active">
|
|
@@ -779,9 +779,9 @@
|
|
|
779
779
|
<div class="mdc-slider__thumb-knob"></div>
|
|
780
780
|
</div>
|
|
781
781
|
</div>
|
|
782
|
-
${
|
|
782
|
+
${n?rt`<div style="min-width: 70px; width: 70px;">${n}</div>`:""}
|
|
783
783
|
</span>
|
|
784
|
-
`}return
|
|
784
|
+
`}return n}}}return rt`<span>INPUT TYPE NOT IMPLEMENTED</span>`}_getFormat(){if(this.format)return this.format}update(t){if(t.has("autoValidate")&&this._mdcComponent){const t=this._mdcComponent;t.foundation&&t.foundation.setValidateOnValueChange&&t.foundation.setValidateOnValueChange(this.autoValidate)}super.update(t)}firstUpdated(t){super.firstUpdated(t),this.autoValidate&&this.reportValidity()}updated(t){var e,n;if(super.updated(t),t.has("type")){const t=this.shadowRoot.getElementById("component");if(this._mdcComponent&&(this._mdcComponent.destroy(),this._mdcComponent=void 0),this._mdcComponent2&&(this._mdcComponent2.destroy(),this._mdcComponent2=void 0),t&&this.type){switch(this.type){case Br.LIST:const e=new Si(t);this._mdcComponent=e,e.selectedIndex=this._selectedIndex;break;case Br.SELECT:const n=new Ki(t);this._mdcComponent=n,null!==this.value&&void 0!==this.value||(n.selectedIndex=-1),this.multiple&&(this._mdcComponent.foundation.adapter.getSelectedIndex=()=>{if(!Array.isArray(this.value)||0===this.value.length)return-1;const t=this.value[0];return this._mdcComponent.foundation.adapter.getMenuItemValues().indexOf(t)}),n.useDefaultValidation=!this.multiple,n.valid=!this.required||!this.multiple&&n.valid||this.multiple&&Array.isArray(this.value)&&this.value.length>0;const i=this.getSelectedTextValue();this._mdcComponent.foundation.adapter.setSelectedText(i),this._mdcComponent.foundation.adapter.floatLabel(!!i),this._menuObserver||(this._menuObserver=new IntersectionObserver(((t,e)=>{var n,i;t[0].target.style.minWidth!=(null===(n=t[0].target.parentElement)||void 0===n?void 0:n.clientWidth)+"px"&&(t[0].target.style.minWidth=(null===(i=t[0].target.parentElement)||void 0===i?void 0:i.clientWidth)+"px")})),this._menuObserver.observe(this.shadowRoot.getElementById("mdc-select-menu")));const r=void 0!==this.searchProvider,o=this.multiple;n.menu.menuSurface_.foundation.handleBodyClick=function(t){const e=t.composedPath()[0];if(this.adapter.isElementInContainer(e)){if(!r)return;if(e instanceof Element&&!e.className.includes("mdc-list-item"))return;if(o)return}n.menu.menuSurface_.close()};break;case Br.RADIO:case Br.CHECKBOX_LIST:case Br.COLOUR:break;case Br.BUTTON:case Br.BUTTON_MOMENTARY:const a=!this.action&&!this.label,l=new on(t);a&&(l.unbounded=!0),this._mdcComponent=l;break;case Br.BUTTON_TOGGLE:this._mdcComponent=new rr(t);break;case Br.CHECKBOX:this._mdcComponent=new Bn(t);const c=this.shadowRoot.getElementById("field");if(c){const t=new Qi(c);t.input=this._mdcComponent,this._mdcComponent2=t}break;case Br.SWITCH:this._mdcComponent=new Xn(t);break;case Br.RANGE:this._mdcComponent=new ci(t);const s=this.shadowRoot.getElementById("number");if(s){const t=new In(s);t.useNativeValidation=!1,this._mdcComponent2=t}break;default:const d=new In(t);d.useNativeValidation=!1,this._mdcComponent=d}this._mdcComponent&&this.focused&&"function"==typeof this._mdcComponent.focus&&this._mdcComponent.focus()}}else{if(this.type===Br.SELECT&&this._mdcComponent){t.has("options")&&this._mdcComponent.layoutOptions(),this._mdcComponent.disabled=!(!this.disabled&&!this.readonly),this._mdcComponent.useDefaultValidation=!this.multiple,this._mdcComponent.valid=!this.required||!this.multiple&&this._mdcComponent.valid||this.multiple&&Array.isArray(this.value)&&this.value.length>0;const e=this.getSelectedTextValue();this._mdcComponent.foundation.adapter.setSelectedText(e),this._mdcComponent.foundation.adapter.floatLabel(!!e)}else if(this.type===Br.RANGE&&this._mdcComponent){const t=this._mdcComponent;t.setDisabled(this.disabled||this.readonly),t.setValue(this.value)}else if(this.type===Br.SWITCH&&this._mdcComponent)this._mdcComponent.checked=this.value;else if(this.type===Br.CHECKBOX&&this._mdcComponent){const t=this._mdcComponent;t.checked=!!this.value,t.disabled=!(!this.disabled&&!this.readonly)}this._mdcComponent&&(this._mdcComponent.required=!!this.required)}t.has("label")&&(null===(n=null===(e=this._mdcComponent)||void 0===e?void 0:e.layout)||void 0===n||n.call(e)),this.autoValidate&&this.reportValidity()}renderOutlined(t){return rt`
|
|
785
785
|
<span class="mdc-notched-outline">
|
|
786
786
|
<span class="mdc-notched-outline__leading"></span>
|
|
787
787
|
${t?rt`
|