@openremote/or-attribute-picker 1.6.2 → 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/dist/umd/index.js +4 -3
- package/dist/umd/index.orbundle.js +5 -4
- package/package.json +6 -6
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 hr=class extends Rt{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[vt`${bt(Wi)}`,vt`${bt(qi)}`,vt`${bt(Ki)}`,vt`${bt(Ji)}`,vt`${bt(Qi)}`,vt`${bt(Zi)}`,vt`${bt(tr)}`,vt`${bt(er)}`,vt`${bt(nr)}`,vt`${bt(ir)}`,vt`${bt(rr)}`,vt`${bt(or)}`,vt`${bt(ar)}`,vt`${bt(dr)}`,vt`${bt(lr)}`,vt`${bt(cr)}`,ur]}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===mr.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===mr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===mr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=mr.DATETIME:"boolean"==typeof this.value?this.type=mr.CHECKBOX:"number"==typeof this.value?this.type=mr.NUMBER:"string"==typeof this.value?this.type=mr.TEXT:this.type=mr.JSON),!0}focus(){this.type===mr.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?G`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case mr.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,G`
|
|
263
|
+
`;let hr=class extends Rt{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[vt`${bt(Wi)}`,vt`${bt(qi)}`,vt`${bt(Ki)}`,vt`${bt(Ji)}`,vt`${bt(Qi)}`,vt`${bt(Zi)}`,vt`${bt(tr)}`,vt`${bt(er)}`,vt`${bt(nr)}`,vt`${bt(ir)}`,vt`${bt(rr)}`,vt`${bt(or)}`,vt`${bt(ar)}`,vt`${bt(dr)}`,vt`${bt(lr)}`,vt`${bt(cr)}`,ur]}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===mr.CHECKBOX&&(this._mdcComponent.indeterminate=this.indeterminate),t.has("disabled")&&(this._mdcComponent&&(this._mdcComponent.disabled=this.disabled),this.type===mr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.disabled=this.disabled)),t.has("readonly")&&(this._mdcComponent&&(this._mdcComponent.readonly=this.readonly),this.type===mr.RANGE&&this._mdcComponent2&&(this._mdcComponent2.readonly=this.readonly)),!this.type&&this.value&&(this.value instanceof Date?this.type=mr.DATETIME:"boolean"==typeof this.value?this.type=mr.CHECKBOX:"number"==typeof this.value?this.type=mr.NUMBER:"string"==typeof this.value?this.type=mr.TEXT:this.type=mr.JSON),!0}focus(){this.type===mr.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?G`<span class="mdc-floating-label ${a?"mdc-floating-label--float-above":""}" id="label">${this.label}</span>`:void 0;switch(this.type){case mr.RADIO:const e=this.resolveOptions(this.options);return this._selectedIndex=-1,G`
|
|
264
264
|
<div class="mdc-radio-container">
|
|
265
265
|
${e?e.map((([t,e],n)=>(this.value===t&&(this._selectedIndex=n),G`
|
|
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 mr.NUMBER:case mr.RANGE:case mr.DATE:case mr.DATETIME:case mr.TIME:case mr.MONTH:case mr.WEEK:case mr.EMAIL:case mr.PASSWORD:case mr.TELEPHONE:case mr.URL:case mr.TEXT:case mr.TEXTAREA:case mr.JSON:case mr.JSON_OBJECT:{let e,d=[void 0===this.value||null===this.value?void 0:this.value,this.min,this.max];if(d.some((t=>"string"!=typeof t)))if(this.type===mr.JSON||this.type===mr.JSON_OBJECT)if(void 0!==d[0]){if("string"!=typeof d[0]||null===d[0])try{d[0]=JSON.stringify(d[0],null,2)}catch(t){console.warn("Failed to parse JSON expression for input control"),d[0]=""}}else d[0]="";else{const e=this.format?Object.assign({},this.format):{};switch(this.type){case mr.TIME:e.asDate=!0,e.hour12=!1,e.timeStyle=this.step&&this.step<60?"medium":"short";break;case mr.DATE:e.asDate=!0,e.momentJsFormat="YYYY-MM-DD";break;case mr.WEEK:e.asDate=!0,e.momentJsFormat="YYYY-[W]WW";break;case mr.MONTH:e.asDate=!0,e.momentJsFormat="YYYY-MM";break;case mr.DATETIME:e.asDate=!0,e.momentJsFormat="YYYY-MM-DDTHH:mm";break;case mr.NUMBER:null!==(t=e.maximumFractionDigits)&&void 0!==t||(e.maximumFractionDigits=20)}e.useGrouping=!1,d=d.map((t=>void 0!==t?Li.Util.getValueAsString(t,(()=>e),"en-GB"):void 0))}let c=this.label,s=this.type,m="component";if(this.type===mr.RANGE&&(c=void 0,n=!1,i=!1,s=mr.NUMBER,m="number"),this.type!==mr.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":s===mr.TEXTAREA||s===mr.JSON||s===mr.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!n,"dense-comfortable":this.comfortable&&!(s===mr.TEXTAREA||s===mr.JSON||s===mr.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=s===mr.TEXTAREA||s===mr.JSON||s===mr.JSON_OBJECT?G`
|
|
432
|
+
`;case mr.NUMBER:case mr.RANGE:case mr.DATE:case mr.DATETIME:case mr.TIME:case mr.MONTH:case mr.WEEK:case mr.EMAIL:case mr.PASSWORD:case mr.TELEPHONE:case mr.URL:case mr.TEXT:case mr.TEXTAREA:case mr.JSON:case mr.JSON_OBJECT:{let e,d=[void 0===this.value||null===this.value?void 0:this.value,this.min,this.max];if(d.some((t=>"string"!=typeof t)))if(this.type===mr.JSON||this.type===mr.JSON_OBJECT)if(void 0!==d[0]){if("string"!=typeof d[0]||null===d[0])try{d[0]=JSON.stringify(d[0],null,2)}catch(t){console.warn("Failed to parse JSON expression for input control"),d[0]=""}}else d[0]="";else{const e=this.format?Object.assign({},this.format):{};switch(this.type){case mr.TIME:e.asDate=!0,e.hour12=!1,e.timeStyle=this.step&&this.step<60?"medium":"short";break;case mr.DATE:e.asDate=!0,e.momentJsFormat="YYYY-MM-DD";break;case mr.WEEK:e.asDate=!0,e.momentJsFormat="YYYY-[W]WW";break;case mr.MONTH:e.asDate=!0,e.momentJsFormat="YYYY-MM";break;case mr.DATETIME:e.asDate=!0,e.momentJsFormat="YYYY-MM-DDTHH:mm";break;case mr.NUMBER:null!==(t=e.maximumFractionDigits)&&void 0!==t||(e.maximumFractionDigits=20)}e.useGrouping=!1,d=d.map((t=>void 0!==t?Li.Util.getValueAsString(t,(()=>e),"en-GB"):void 0))}let c=this.label,s=this.type,m="component";if(this.type===mr.RANGE&&(c=void 0,n=!1,i=!1,s=mr.NUMBER,m="number"),this.type!==mr.RANGE||!this.disableSliderNumberInput){this.censored&&(s=mr.PASSWORD),this.type===mr.PASSWORD&&this.advertised&&(s=mr.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":s===mr.TEXTAREA||s===mr.JSON||s===mr.JSON_OBJECT,"mdc-text-field--disabled":this.disabled,"mdc-text-field--fullwidth":this.fullWidth&&!n,"dense-comfortable":this.comfortable&&!(s===mr.TEXTAREA||s===mr.JSON||s===mr.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=s===mr.TEXTAREA||s===mr.JSON||s===mr.JSON_OBJECT?G`
|
|
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="${Gt(this.minLength)}"
|
|
435
435
|
maxlength="${Gt(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?"":G`<span class="mdc-line-ripple"></span>`}
|
|
454
|
+
${this.type!==mr.PASSWORD||this.censored?"":G`<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?G`<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?G`
|
|
@@ -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!==mr.JSON&&this.type!==mr.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 mr.CHECKBOX:case mr.SWITCH:e="on"===e;break;case mr.JSON:case mr.JSON_OBJECT:case mr.NUMBER:case mr.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==mr.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Dt.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===mr.JSON||this.type==mr.JSON_OBJECT?Dt.i18next.t("validation.invalidJSON"):Dt.i18next.t("validation.invalidNumber")}break;case mr.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Dt.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==mr.CHECKBOX_LIST&&e!==a&&(this.type===mr.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new sr(this.value,a,n))),null!=this.searchProvider&&this.type===mr.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!==mr.CHECKBOX_LIST||Li.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new sr(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,Dt.i18next.t(e,{defaultValue:Li.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(", "):""}};ji([i({type:Boolean})],hr.prototype,"focused",void 0),ji([i()],hr.prototype,"value",void 0),ji([i({type:String})],hr.prototype,"type",void 0),ji([i({type:String})],hr.prototype,"name",void 0),ji([i({type:Boolean})],hr.prototype,"readonly",void 0),ji([i({type:Boolean})],hr.prototype,"required",void 0),ji([i()],hr.prototype,"max",void 0),ji([i()],hr.prototype,"min",void 0),ji([i({type:Number})],hr.prototype,"step",void 0),ji([i({type:Boolean})],hr.prototype,"checked",void 0),ji([i({type:Boolean})],hr.prototype,"indeterminate",void 0),ji([i({type:Number})],hr.prototype,"maxLength",void 0),ji([i({type:Number})],hr.prototype,"minLength",void 0),ji([i({type:Number})],hr.prototype,"rows",void 0),ji([i({type:Number})],hr.prototype,"cols",void 0),ji([i({type:Boolean})],hr.prototype,"multiple",void 0),ji([i({type:String,attribute:!0,reflect:!1})],hr.prototype,"pattern",void 0),ji([i({type:String})],hr.prototype,"placeHolder",void 0),ji([i({type:Array})],hr.prototype,"options",void 0),ji([i({type:Boolean})],hr.prototype,"autoSelect",void 0),ji([i({type:Object})],hr.prototype,"searchProvider",void 0),ji([i({type:String})],hr.prototype,"searchLabel",void 0),ji([i({type:String})],hr.prototype,"icon",void 0),ji([i({type:String})],hr.prototype,"iconColor",void 0),ji([i({type:String})],hr.prototype,"iconOn",void 0),ji([i({type:String})],hr.prototype,"iconTrailing",void 0),ji([i({type:Boolean})],hr.prototype,"compact",void 0),ji([i({type:Boolean})],hr.prototype,"comfortable",void 0),ji([i({type:Boolean})],hr.prototype,"raised",void 0),ji([i({type:Boolean})],hr.prototype,"action",void 0),ji([i({type:Boolean})],hr.prototype,"unElevated",void 0),ji([i({type:Boolean})],hr.prototype,"outlined",void 0),ji([i({type:Boolean})],hr.prototype,"rounded",void 0),ji([i({type:Object})],hr.prototype,"format",void 0),ji([i({type:Boolean})],hr.prototype,"disableSliderNumberInput",void 0),ji([i({type:Boolean})],hr.prototype,"fullWidth",void 0),ji([i({type:String})],hr.prototype,"helperText",void 0),ji([i({type:Boolean})],hr.prototype,"helperPersistent",void 0),ji([i({type:String,attribute:!0})],hr.prototype,"validationMessage",void 0),ji([i({type:Boolean})],hr.prototype,"autoValidate",void 0),ji([i({type:Boolean})],hr.prototype,"charCounter",void 0),ji([i({type:String})],hr.prototype,"label",void 0),ji([i({type:Boolean})],hr.prototype,"disabled",void 0),ji([i({type:Boolean})],hr.prototype,"continuous",void 0),ji([i({type:Boolean})],hr.prototype,"resizeVertical",void 0),ji([r()],hr.prototype,"isUiValid",void 0),ji([r()],hr.prototype,"searchableValue",void 0),ji([r()],hr.prototype,"errorMessage",void 0),hr=ji([t("or-mwc-input")],hr);var fr="mdc-dom-focus-sentinel",gr=function(){function t(t,e){void 0===e&&(e={}),this.root=t,this.options=e,this.elFocusedBeforeTrapFocus=null}return t.prototype.trapFocus=function(){var t=this.getFocusableElements(this.root);if(0===t.length)throw new Error("FocusTrap: Element must have at least one focusable child.");this.elFocusedBeforeTrapFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.wrapTabFocus(this.root,t),this.options.skipInitialFocus||this.focusInitialElement(t,this.options.initialFocusEl)},t.prototype.releaseFocus=function(){[].slice.call(this.root.querySelectorAll("."+fr)).forEach((function(t){t.parentElement.removeChild(t)})),this.elFocusedBeforeTrapFocus&&this.elFocusedBeforeTrapFocus.focus()},t.prototype.wrapTabFocus=function(t,e){var n=this.createSentinel(),i=this.createSentinel();n.addEventListener("focus",(function(){e.length>0&&e[e.length-1].focus()})),i.addEventListener("focus",(function(){e.length>0&&e[0].focus()})),t.insertBefore(n,t.children[0]),t.appendChild(i)},t.prototype.focusInitialElement=function(t,e){var n=0;e&&(n=Math.max(t.indexOf(e),0)),t[n].focus()},t.prototype.getFocusableElements=function(t){return[].slice.call(t.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button")).filter((function(t){var e="true"===t.getAttribute("aria-disabled")||null!=t.getAttribute("disabled")||null!=t.getAttribute("hidden")||"true"===t.getAttribute("aria-hidden"),n=t.tabIndex>=0&&t.getBoundingClientRect().width>0&&!t.classList.contains(fr)&&!e,i=!1;if(n){var r=getComputedStyle(t);i="none"===r.display||"hidden"===r.visibility}return n&&!i}))},t.prototype.createSentinel=function(){var t=document.createElement("div");return t.setAttribute("tabindex","0"),t.setAttribute("aria-hidden","true"),t.classList.add(fr),t},t}(),br={CLOSING:"mdc-dialog--closing",OPEN:"mdc-dialog--open",OPENING:"mdc-dialog--opening",SCROLLABLE:"mdc-dialog--scrollable",SCROLL_LOCK:"mdc-dialog-scroll-lock",STACKED:"mdc-dialog--stacked"},vr={ACTION_ATTRIBUTE:"data-mdc-dialog-action",BUTTON_DEFAULT_ATTRIBUTE:"data-mdc-dialog-button-default",BUTTON_SELECTOR:".mdc-dialog__button",CLOSED_EVENT:"MDCDialog:closed",CLOSE_ACTION:"close",CLOSING_EVENT:"MDCDialog:closing",CONTAINER_SELECTOR:".mdc-dialog__container",CONTENT_SELECTOR:".mdc-dialog__content",DESTROY_ACTION:"destroy",INITIAL_FOCUS_ATTRIBUTE:"data-mdc-dialog-initial-focus",OPENED_EVENT:"MDCDialog:opened",OPENING_EVENT:"MDCDialog:opening",SCRIM_SELECTOR:".mdc-dialog__scrim",SUPPRESS_DEFAULT_PRESS_SELECTOR:["textarea",".mdc-menu .mdc-list-item"].join(", "),SURFACE_SELECTOR:".mdc-dialog__surface"},_r={DIALOG_ANIMATION_CLOSE_TIME_MS:75,DIALOG_ANIMATION_OPEN_TIME_MS:150},xr=function(t){function e(n){var i=t.call(this,ne(ne({},e.defaultAdapter),n))||this;return i.isOpen_=!1,i.animationFrame_=0,i.animationTimer_=0,i.layoutFrame_=0,i.escapeKeyAction_=vr.CLOSE_ACTION,i.scrimClickAction_=vr.CLOSE_ACTION,i.autoStackButtons_=!0,i.areButtonsStacked_=!1,i.suppressDefaultPressSelector=vr.SUPPRESS_DEFAULT_PRESS_SELECTOR,i}return ee(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return br},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return vr},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return _r},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addBodyClass:function(){},addClass:function(){},areButtonsStacked:function(){return!1},clickDefaultButton:function(){},eventTargetMatches:function(){return!1},getActionFromEvent:function(){return""},getInitialFocusEl:function(){return null},hasClass:function(){return!1},isContentScrollable:function(){return!1},notifyClosed:function(){},notifyClosing:function(){},notifyOpened:function(){},notifyOpening:function(){},releaseFocus:function(){},removeBodyClass:function(){},removeClass:function(){},reverseButtons:function(){},trapFocus:function(){}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){this.adapter.hasClass(br.STACKED)&&this.setAutoStackButtons(!1)},e.prototype.destroy=function(){this.isOpen_&&this.close(vr.DESTROY_ACTION),this.animationTimer_&&(clearTimeout(this.animationTimer_),this.handleAnimationTimerEnd_()),this.layoutFrame_&&(cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=0)},e.prototype.open=function(){var t=this;this.isOpen_=!0,this.adapter.notifyOpening(),this.adapter.addClass(br.OPENING),this.runNextAnimationFrame_((function(){t.adapter.addClass(br.OPEN),t.adapter.addBodyClass(br.SCROLL_LOCK),t.layout(),t.animationTimer_=setTimeout((function(){t.handleAnimationTimerEnd_(),t.adapter.trapFocus(t.adapter.getInitialFocusEl()),t.adapter.notifyOpened()}),_r.DIALOG_ANIMATION_OPEN_TIME_MS)}))},e.prototype.close=function(t){var e=this;void 0===t&&(t=""),this.isOpen_&&(this.isOpen_=!1,this.adapter.notifyClosing(t),this.adapter.addClass(br.CLOSING),this.adapter.removeClass(br.OPEN),this.adapter.removeBodyClass(br.SCROLL_LOCK),cancelAnimationFrame(this.animationFrame_),this.animationFrame_=0,clearTimeout(this.animationTimer_),this.animationTimer_=setTimeout((function(){e.adapter.releaseFocus(),e.handleAnimationTimerEnd_(),e.adapter.notifyClosed(t)}),_r.DIALOG_ANIMATION_CLOSE_TIME_MS))},e.prototype.isOpen=function(){return this.isOpen_},e.prototype.getEscapeKeyAction=function(){return this.escapeKeyAction_},e.prototype.setEscapeKeyAction=function(t){this.escapeKeyAction_=t},e.prototype.getScrimClickAction=function(){return this.scrimClickAction_},e.prototype.setScrimClickAction=function(t){this.scrimClickAction_=t},e.prototype.getAutoStackButtons=function(){return this.autoStackButtons_},e.prototype.setAutoStackButtons=function(t){this.autoStackButtons_=t},e.prototype.getSuppressDefaultPressSelector=function(){return this.suppressDefaultPressSelector},e.prototype.setSuppressDefaultPressSelector=function(t){this.suppressDefaultPressSelector=t},e.prototype.layout=function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame((function(){t.layoutInternal_(),t.layoutFrame_=0}))},e.prototype.handleClick=function(t){if(this.adapter.eventTargetMatches(t.target,vr.SCRIM_SELECTOR)&&""!==this.scrimClickAction_)this.close(this.scrimClickAction_);else{var e=this.adapter.getActionFromEvent(t);e&&this.close(e)}},e.prototype.handleKeydown=function(t){var e="Enter"===t.key||13===t.keyCode;if(e&&!this.adapter.getActionFromEvent(t)){var n=t.composedPath?t.composedPath()[0]:t.target,i=!this.adapter.eventTargetMatches(n,this.suppressDefaultPressSelector);e&&i&&this.adapter.clickDefaultButton()}},e.prototype.handleDocumentKeydown=function(t){("Escape"===t.key||27===t.keyCode)&&""!==this.escapeKeyAction_&&this.close(this.escapeKeyAction_)},e.prototype.layoutInternal_=function(){this.autoStackButtons_&&this.detectStackedButtons_(),this.detectScrollableContent_()},e.prototype.handleAnimationTimerEnd_=function(){this.animationTimer_=0,this.adapter.removeClass(br.OPENING),this.adapter.removeClass(br.CLOSING)},e.prototype.runNextAnimationFrame_=function(t){var e=this;cancelAnimationFrame(this.animationFrame_),this.animationFrame_=requestAnimationFrame((function(){e.animationFrame_=0,clearTimeout(e.animationTimer_),e.animationTimer_=setTimeout(t,0)}))},e.prototype.detectStackedButtons_=function(){this.adapter.removeClass(br.STACKED);var t=this.adapter.areButtonsStacked();t&&this.adapter.addClass(br.STACKED),t!==this.areButtonsStacked_&&(this.adapter.reverseButtons(),this.areButtonsStacked_=t)},e.prototype.detectScrollableContent_=function(){this.adapter.removeClass(br.SCROLLABLE),this.adapter.isContentScrollable()&&this.adapter.addClass(br.SCROLLABLE)},e}(ae),yr=xr.strings,wr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ee(e,t),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this.foundation.isOpen()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"escapeKeyAction",{get:function(){return this.foundation.getEscapeKeyAction()},set:function(t){this.foundation.setEscapeKeyAction(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrimClickAction",{get:function(){return this.foundation.getScrimClickAction()},set:function(t){this.foundation.setScrimClickAction(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoStackButtons",{get:function(){return this.foundation.getAutoStackButtons()},set:function(t){this.foundation.setAutoStackButtons(t)},enumerable:!0,configurable:!0}),e.attachTo=function(t){return new e(t)},e.prototype.initialize=function(t){var e,n;void 0===t&&(t=function(t,e){return new gr(t,e)});var i=this.root.querySelector(yr.CONTAINER_SELECTOR);if(!i)throw new Error("Dialog component requires a "+yr.CONTAINER_SELECTOR+" container element");this.container_=i,this.content_=this.root.querySelector(yr.CONTENT_SELECTOR),this.buttons_=[].slice.call(this.root.querySelectorAll(yr.BUTTON_SELECTOR)),this.defaultButton_=this.root.querySelector("["+yr.BUTTON_DEFAULT_ATTRIBUTE+"]"),this.focusTrapFactory_=t,this.buttonRipples_=[];try{for(var r=ie(this.buttons_),o=r.next();!o.done;o=r.next()){var a=o.value;this.buttonRipples_.push(new Oe(a))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.initialSyncWithDOM=function(){var t,e=this;this.focusTrap_=(t=this.container_,(0,this.focusTrapFactory_)(t,{initialFocusEl:this.getInitialFocusEl_()||void 0})),this.handleClick_=this.foundation.handleClick.bind(this.foundation),this.handleKeydown_=this.foundation.handleKeydown.bind(this.foundation),this.handleDocumentKeydown_=this.foundation.handleDocumentKeydown.bind(this.foundation),this.handleLayout_=this.layout.bind(this);var n=["resize","orientationchange"];this.handleOpening_=function(){n.forEach((function(t){return window.addEventListener(t,e.handleLayout_)})),document.addEventListener("keydown",e.handleDocumentKeydown_)},this.handleClosing_=function(){n.forEach((function(t){return window.removeEventListener(t,e.handleLayout_)})),document.removeEventListener("keydown",e.handleDocumentKeydown_)},this.listen("click",this.handleClick_),this.listen("keydown",this.handleKeydown_),this.listen(yr.OPENING_EVENT,this.handleOpening_),this.listen(yr.CLOSING_EVENT,this.handleClosing_)},e.prototype.destroy=function(){this.unlisten("click",this.handleClick_),this.unlisten("keydown",this.handleKeydown_),this.unlisten(yr.OPENING_EVENT,this.handleOpening_),this.unlisten(yr.CLOSING_EVENT,this.handleClosing_),this.handleClosing_(),this.buttonRipples_.forEach((function(t){return t.destroy()})),t.prototype.destroy.call(this)},e.prototype.layout=function(){this.foundation.layout()},e.prototype.open=function(){this.foundation.open()},e.prototype.close=function(t){void 0===t&&(t=""),this.foundation.close(t)},e.prototype.getDefaultFoundation=function(){var t=this;return new xr({addBodyClass:function(t){return document.body.classList.add(t)},addClass:function(e){return t.root.classList.add(e)},areButtonsStacked:function(){return e=t.buttons_,n=new Set,[].forEach.call(e,(function(t){return n.add(t.offsetTop)})),n.size>1;var e,n},clickDefaultButton:function(){return t.defaultButton_&&t.defaultButton_.click()},eventTargetMatches:function(t,e){return!!t&&se(t,e)},getActionFromEvent:function(t){if(!t.target)return"";var e=ce(t.target,"["+yr.ACTION_ATTRIBUTE+"]");return e&&e.getAttribute(yr.ACTION_ATTRIBUTE)},getInitialFocusEl:function(){return t.getInitialFocusEl_()},hasClass:function(e){return t.root.classList.contains(e)},isContentScrollable:function(){return!!(e=t.content_)&&e.scrollHeight>e.offsetHeight;var e},notifyClosed:function(e){return t.emit(yr.CLOSED_EVENT,e?{action:e}:{})},notifyClosing:function(e){return t.emit(yr.CLOSING_EVENT,e?{action:e}:{})},notifyOpened:function(){return t.emit(yr.OPENED_EVENT,{})},notifyOpening:function(){return t.emit(yr.OPENING_EVENT,{})},releaseFocus:function(){return t.focusTrap_.releaseFocus()},removeBodyClass:function(t){return document.body.classList.remove(t)},removeClass:function(e){return t.root.classList.remove(e)},reverseButtons:function(){t.buttons_.reverse(),t.buttons_.forEach((function(t){t.parentElement.appendChild(t)}))},trapFocus:function(){return t.focusTrap_.trapFocus()}})},e.prototype.getInitialFocusEl_=function(){return this.root.querySelector("["+yr.INITIAL_FOCUS_ATTRIBUTE+"]")},e}(le),kr=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 Er=l(40),Ar=l(744);class Cr extends CustomEvent{constructor(){super(Cr.NAME,{bubbles:!0,composed:!0})}}Cr.NAME="or-mwc-dialog-opened";class Tr extends CustomEvent{constructor(t){super(Tr.NAME,{detail:t,bubbles:!0,composed:!0})}}Tr.NAME="or-mwc-dialog-closed";const Ir=vt`
|
|
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!==mr.JSON&&this.type!==mr.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 mr.CHECKBOX:case mr.SWITCH:e="on"===e;break;case mr.JSON:case mr.JSON_OBJECT:case mr.NUMBER:case mr.RANGE:if(""===e)e=null;else try{e=JSON.parse(e),this.type!==mr.JSON_OBJECT||"object"==typeof e&&!Array.isArray(e)||(e=this.value,o=Dt.i18next.t("validation.invalidJSON"))}catch(t){e=this.value,o=this.type===mr.JSON||this.type==mr.JSON_OBJECT?Dt.i18next.t("validation.invalidJSON"):Dt.i18next.t("validation.invalidNumber")}break;case mr.DATETIME:if(""===e)e=null;else try{e=Date.parse(e)}catch(t){e=this.value,o=Dt.i18next.t("validation.invalidDate")}}if(this.value=e,this.setCustomValidity(o),this.reportValidity(),this.type!==mr.CHECKBOX_LIST&&e!==a&&(this.type===mr.RANGE&&(this._mdcComponent.setValue(e),this._mdcComponent2&&(this._mdcComponent2.value=e)),this.dispatchEvent(new sr(this.value,a,n))),null!=this.searchProvider&&this.type===mr.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!==mr.CHECKBOX_LIST||Li.Util.objectsEqual(e,a,!0)||this.dispatchEvent(new sr(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,Dt.i18next.t(e,{defaultValue:Li.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(", "):""}};ji([i({type:Boolean})],hr.prototype,"focused",void 0),ji([i()],hr.prototype,"value",void 0),ji([i({type:String})],hr.prototype,"type",void 0),ji([i({type:String})],hr.prototype,"name",void 0),ji([i({type:Boolean})],hr.prototype,"readonly",void 0),ji([i({type:Boolean})],hr.prototype,"required",void 0),ji([i()],hr.prototype,"max",void 0),ji([i()],hr.prototype,"min",void 0),ji([i({type:Number})],hr.prototype,"step",void 0),ji([i({type:Boolean})],hr.prototype,"checked",void 0),ji([i({type:Boolean})],hr.prototype,"indeterminate",void 0),ji([i({type:Number})],hr.prototype,"maxLength",void 0),ji([i({type:Number})],hr.prototype,"minLength",void 0),ji([i({type:Number})],hr.prototype,"rows",void 0),ji([i({type:Number})],hr.prototype,"cols",void 0),ji([i({type:Boolean})],hr.prototype,"multiple",void 0),ji([i({type:String,attribute:!0,reflect:!1})],hr.prototype,"pattern",void 0),ji([i({type:String})],hr.prototype,"placeHolder",void 0),ji([i({type:Array})],hr.prototype,"options",void 0),ji([i({type:Boolean})],hr.prototype,"autoSelect",void 0),ji([i({type:Object})],hr.prototype,"searchProvider",void 0),ji([i({type:String})],hr.prototype,"searchLabel",void 0),ji([i({type:String})],hr.prototype,"icon",void 0),ji([i({type:String})],hr.prototype,"iconColor",void 0),ji([i({type:String})],hr.prototype,"iconOn",void 0),ji([i({type:String})],hr.prototype,"iconTrailing",void 0),ji([i({type:Boolean})],hr.prototype,"compact",void 0),ji([i({type:Boolean})],hr.prototype,"comfortable",void 0),ji([i({type:Boolean})],hr.prototype,"raised",void 0),ji([i({type:Boolean})],hr.prototype,"action",void 0),ji([i({type:Boolean})],hr.prototype,"unElevated",void 0),ji([i({type:Boolean})],hr.prototype,"outlined",void 0),ji([i({type:Boolean})],hr.prototype,"rounded",void 0),ji([i({type:Object})],hr.prototype,"format",void 0),ji([i({type:Boolean})],hr.prototype,"disableSliderNumberInput",void 0),ji([i({type:Boolean})],hr.prototype,"fullWidth",void 0),ji([i({type:String})],hr.prototype,"helperText",void 0),ji([i({type:Boolean})],hr.prototype,"helperPersistent",void 0),ji([i({type:String,attribute:!0})],hr.prototype,"validationMessage",void 0),ji([i({type:Boolean})],hr.prototype,"autoValidate",void 0),ji([i({type:Boolean})],hr.prototype,"charCounter",void 0),ji([i({type:String})],hr.prototype,"label",void 0),ji([i({type:Boolean})],hr.prototype,"disabled",void 0),ji([i({type:Boolean})],hr.prototype,"continuous",void 0),ji([i({type:Boolean})],hr.prototype,"resizeVertical",void 0),ji([i({type:Boolean})],hr.prototype,"censored",void 0),ji([i({type:Boolean,reflect:!0})],hr.prototype,"advertised",void 0),ji([r()],hr.prototype,"isUiValid",void 0),ji([r()],hr.prototype,"searchableValue",void 0),ji([r()],hr.prototype,"errorMessage",void 0),hr=ji([t("or-mwc-input")],hr);var fr="mdc-dom-focus-sentinel",gr=function(){function t(t,e){void 0===e&&(e={}),this.root=t,this.options=e,this.elFocusedBeforeTrapFocus=null}return t.prototype.trapFocus=function(){var t=this.getFocusableElements(this.root);if(0===t.length)throw new Error("FocusTrap: Element must have at least one focusable child.");this.elFocusedBeforeTrapFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.wrapTabFocus(this.root,t),this.options.skipInitialFocus||this.focusInitialElement(t,this.options.initialFocusEl)},t.prototype.releaseFocus=function(){[].slice.call(this.root.querySelectorAll("."+fr)).forEach((function(t){t.parentElement.removeChild(t)})),this.elFocusedBeforeTrapFocus&&this.elFocusedBeforeTrapFocus.focus()},t.prototype.wrapTabFocus=function(t,e){var n=this.createSentinel(),i=this.createSentinel();n.addEventListener("focus",(function(){e.length>0&&e[e.length-1].focus()})),i.addEventListener("focus",(function(){e.length>0&&e[0].focus()})),t.insertBefore(n,t.children[0]),t.appendChild(i)},t.prototype.focusInitialElement=function(t,e){var n=0;e&&(n=Math.max(t.indexOf(e),0)),t[n].focus()},t.prototype.getFocusableElements=function(t){return[].slice.call(t.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button")).filter((function(t){var e="true"===t.getAttribute("aria-disabled")||null!=t.getAttribute("disabled")||null!=t.getAttribute("hidden")||"true"===t.getAttribute("aria-hidden"),n=t.tabIndex>=0&&t.getBoundingClientRect().width>0&&!t.classList.contains(fr)&&!e,i=!1;if(n){var r=getComputedStyle(t);i="none"===r.display||"hidden"===r.visibility}return n&&!i}))},t.prototype.createSentinel=function(){var t=document.createElement("div");return t.setAttribute("tabindex","0"),t.setAttribute("aria-hidden","true"),t.classList.add(fr),t},t}(),br={CLOSING:"mdc-dialog--closing",OPEN:"mdc-dialog--open",OPENING:"mdc-dialog--opening",SCROLLABLE:"mdc-dialog--scrollable",SCROLL_LOCK:"mdc-dialog-scroll-lock",STACKED:"mdc-dialog--stacked"},vr={ACTION_ATTRIBUTE:"data-mdc-dialog-action",BUTTON_DEFAULT_ATTRIBUTE:"data-mdc-dialog-button-default",BUTTON_SELECTOR:".mdc-dialog__button",CLOSED_EVENT:"MDCDialog:closed",CLOSE_ACTION:"close",CLOSING_EVENT:"MDCDialog:closing",CONTAINER_SELECTOR:".mdc-dialog__container",CONTENT_SELECTOR:".mdc-dialog__content",DESTROY_ACTION:"destroy",INITIAL_FOCUS_ATTRIBUTE:"data-mdc-dialog-initial-focus",OPENED_EVENT:"MDCDialog:opened",OPENING_EVENT:"MDCDialog:opening",SCRIM_SELECTOR:".mdc-dialog__scrim",SUPPRESS_DEFAULT_PRESS_SELECTOR:["textarea",".mdc-menu .mdc-list-item"].join(", "),SURFACE_SELECTOR:".mdc-dialog__surface"},_r={DIALOG_ANIMATION_CLOSE_TIME_MS:75,DIALOG_ANIMATION_OPEN_TIME_MS:150},xr=function(t){function e(n){var i=t.call(this,ne(ne({},e.defaultAdapter),n))||this;return i.isOpen_=!1,i.animationFrame_=0,i.animationTimer_=0,i.layoutFrame_=0,i.escapeKeyAction_=vr.CLOSE_ACTION,i.scrimClickAction_=vr.CLOSE_ACTION,i.autoStackButtons_=!0,i.areButtonsStacked_=!1,i.suppressDefaultPressSelector=vr.SUPPRESS_DEFAULT_PRESS_SELECTOR,i}return ee(e,t),Object.defineProperty(e,"cssClasses",{get:function(){return br},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return vr},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return _r},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addBodyClass:function(){},addClass:function(){},areButtonsStacked:function(){return!1},clickDefaultButton:function(){},eventTargetMatches:function(){return!1},getActionFromEvent:function(){return""},getInitialFocusEl:function(){return null},hasClass:function(){return!1},isContentScrollable:function(){return!1},notifyClosed:function(){},notifyClosing:function(){},notifyOpened:function(){},notifyOpening:function(){},releaseFocus:function(){},removeBodyClass:function(){},removeClass:function(){},reverseButtons:function(){},trapFocus:function(){}}},enumerable:!0,configurable:!0}),e.prototype.init=function(){this.adapter.hasClass(br.STACKED)&&this.setAutoStackButtons(!1)},e.prototype.destroy=function(){this.isOpen_&&this.close(vr.DESTROY_ACTION),this.animationTimer_&&(clearTimeout(this.animationTimer_),this.handleAnimationTimerEnd_()),this.layoutFrame_&&(cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=0)},e.prototype.open=function(){var t=this;this.isOpen_=!0,this.adapter.notifyOpening(),this.adapter.addClass(br.OPENING),this.runNextAnimationFrame_((function(){t.adapter.addClass(br.OPEN),t.adapter.addBodyClass(br.SCROLL_LOCK),t.layout(),t.animationTimer_=setTimeout((function(){t.handleAnimationTimerEnd_(),t.adapter.trapFocus(t.adapter.getInitialFocusEl()),t.adapter.notifyOpened()}),_r.DIALOG_ANIMATION_OPEN_TIME_MS)}))},e.prototype.close=function(t){var e=this;void 0===t&&(t=""),this.isOpen_&&(this.isOpen_=!1,this.adapter.notifyClosing(t),this.adapter.addClass(br.CLOSING),this.adapter.removeClass(br.OPEN),this.adapter.removeBodyClass(br.SCROLL_LOCK),cancelAnimationFrame(this.animationFrame_),this.animationFrame_=0,clearTimeout(this.animationTimer_),this.animationTimer_=setTimeout((function(){e.adapter.releaseFocus(),e.handleAnimationTimerEnd_(),e.adapter.notifyClosed(t)}),_r.DIALOG_ANIMATION_CLOSE_TIME_MS))},e.prototype.isOpen=function(){return this.isOpen_},e.prototype.getEscapeKeyAction=function(){return this.escapeKeyAction_},e.prototype.setEscapeKeyAction=function(t){this.escapeKeyAction_=t},e.prototype.getScrimClickAction=function(){return this.scrimClickAction_},e.prototype.setScrimClickAction=function(t){this.scrimClickAction_=t},e.prototype.getAutoStackButtons=function(){return this.autoStackButtons_},e.prototype.setAutoStackButtons=function(t){this.autoStackButtons_=t},e.prototype.getSuppressDefaultPressSelector=function(){return this.suppressDefaultPressSelector},e.prototype.setSuppressDefaultPressSelector=function(t){this.suppressDefaultPressSelector=t},e.prototype.layout=function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame((function(){t.layoutInternal_(),t.layoutFrame_=0}))},e.prototype.handleClick=function(t){if(this.adapter.eventTargetMatches(t.target,vr.SCRIM_SELECTOR)&&""!==this.scrimClickAction_)this.close(this.scrimClickAction_);else{var e=this.adapter.getActionFromEvent(t);e&&this.close(e)}},e.prototype.handleKeydown=function(t){var e="Enter"===t.key||13===t.keyCode;if(e&&!this.adapter.getActionFromEvent(t)){var n=t.composedPath?t.composedPath()[0]:t.target,i=!this.adapter.eventTargetMatches(n,this.suppressDefaultPressSelector);e&&i&&this.adapter.clickDefaultButton()}},e.prototype.handleDocumentKeydown=function(t){("Escape"===t.key||27===t.keyCode)&&""!==this.escapeKeyAction_&&this.close(this.escapeKeyAction_)},e.prototype.layoutInternal_=function(){this.autoStackButtons_&&this.detectStackedButtons_(),this.detectScrollableContent_()},e.prototype.handleAnimationTimerEnd_=function(){this.animationTimer_=0,this.adapter.removeClass(br.OPENING),this.adapter.removeClass(br.CLOSING)},e.prototype.runNextAnimationFrame_=function(t){var e=this;cancelAnimationFrame(this.animationFrame_),this.animationFrame_=requestAnimationFrame((function(){e.animationFrame_=0,clearTimeout(e.animationTimer_),e.animationTimer_=setTimeout(t,0)}))},e.prototype.detectStackedButtons_=function(){this.adapter.removeClass(br.STACKED);var t=this.adapter.areButtonsStacked();t&&this.adapter.addClass(br.STACKED),t!==this.areButtonsStacked_&&(this.adapter.reverseButtons(),this.areButtonsStacked_=t)},e.prototype.detectScrollableContent_=function(){this.adapter.removeClass(br.SCROLLABLE),this.adapter.isContentScrollable()&&this.adapter.addClass(br.SCROLLABLE)},e}(ae),yr=xr.strings,wr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return ee(e,t),Object.defineProperty(e.prototype,"isOpen",{get:function(){return this.foundation.isOpen()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"escapeKeyAction",{get:function(){return this.foundation.getEscapeKeyAction()},set:function(t){this.foundation.setEscapeKeyAction(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scrimClickAction",{get:function(){return this.foundation.getScrimClickAction()},set:function(t){this.foundation.setScrimClickAction(t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoStackButtons",{get:function(){return this.foundation.getAutoStackButtons()},set:function(t){this.foundation.setAutoStackButtons(t)},enumerable:!0,configurable:!0}),e.attachTo=function(t){return new e(t)},e.prototype.initialize=function(t){var e,n;void 0===t&&(t=function(t,e){return new gr(t,e)});var i=this.root.querySelector(yr.CONTAINER_SELECTOR);if(!i)throw new Error("Dialog component requires a "+yr.CONTAINER_SELECTOR+" container element");this.container_=i,this.content_=this.root.querySelector(yr.CONTENT_SELECTOR),this.buttons_=[].slice.call(this.root.querySelectorAll(yr.BUTTON_SELECTOR)),this.defaultButton_=this.root.querySelector("["+yr.BUTTON_DEFAULT_ATTRIBUTE+"]"),this.focusTrapFactory_=t,this.buttonRipples_=[];try{for(var r=ie(this.buttons_),o=r.next();!o.done;o=r.next()){var a=o.value;this.buttonRipples_.push(new Oe(a))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.initialSyncWithDOM=function(){var t,e=this;this.focusTrap_=(t=this.container_,(0,this.focusTrapFactory_)(t,{initialFocusEl:this.getInitialFocusEl_()||void 0})),this.handleClick_=this.foundation.handleClick.bind(this.foundation),this.handleKeydown_=this.foundation.handleKeydown.bind(this.foundation),this.handleDocumentKeydown_=this.foundation.handleDocumentKeydown.bind(this.foundation),this.handleLayout_=this.layout.bind(this);var n=["resize","orientationchange"];this.handleOpening_=function(){n.forEach((function(t){return window.addEventListener(t,e.handleLayout_)})),document.addEventListener("keydown",e.handleDocumentKeydown_)},this.handleClosing_=function(){n.forEach((function(t){return window.removeEventListener(t,e.handleLayout_)})),document.removeEventListener("keydown",e.handleDocumentKeydown_)},this.listen("click",this.handleClick_),this.listen("keydown",this.handleKeydown_),this.listen(yr.OPENING_EVENT,this.handleOpening_),this.listen(yr.CLOSING_EVENT,this.handleClosing_)},e.prototype.destroy=function(){this.unlisten("click",this.handleClick_),this.unlisten("keydown",this.handleKeydown_),this.unlisten(yr.OPENING_EVENT,this.handleOpening_),this.unlisten(yr.CLOSING_EVENT,this.handleClosing_),this.handleClosing_(),this.buttonRipples_.forEach((function(t){return t.destroy()})),t.prototype.destroy.call(this)},e.prototype.layout=function(){this.foundation.layout()},e.prototype.open=function(){this.foundation.open()},e.prototype.close=function(t){void 0===t&&(t=""),this.foundation.close(t)},e.prototype.getDefaultFoundation=function(){var t=this;return new xr({addBodyClass:function(t){return document.body.classList.add(t)},addClass:function(e){return t.root.classList.add(e)},areButtonsStacked:function(){return e=t.buttons_,n=new Set,[].forEach.call(e,(function(t){return n.add(t.offsetTop)})),n.size>1;var e,n},clickDefaultButton:function(){return t.defaultButton_&&t.defaultButton_.click()},eventTargetMatches:function(t,e){return!!t&&se(t,e)},getActionFromEvent:function(t){if(!t.target)return"";var e=ce(t.target,"["+yr.ACTION_ATTRIBUTE+"]");return e&&e.getAttribute(yr.ACTION_ATTRIBUTE)},getInitialFocusEl:function(){return t.getInitialFocusEl_()},hasClass:function(e){return t.root.classList.contains(e)},isContentScrollable:function(){return!!(e=t.content_)&&e.scrollHeight>e.offsetHeight;var e},notifyClosed:function(e){return t.emit(yr.CLOSED_EVENT,e?{action:e}:{})},notifyClosing:function(e){return t.emit(yr.CLOSING_EVENT,e?{action:e}:{})},notifyOpened:function(){return t.emit(yr.OPENED_EVENT,{})},notifyOpening:function(){return t.emit(yr.OPENING_EVENT,{})},releaseFocus:function(){return t.focusTrap_.releaseFocus()},removeBodyClass:function(t){return document.body.classList.remove(t)},removeClass:function(e){return t.root.classList.remove(e)},reverseButtons:function(){t.buttons_.reverse(),t.buttons_.forEach((function(t){t.parentElement.appendChild(t)}))},trapFocus:function(){return t.focusTrap_.trapFocus()}})},e.prototype.getInitialFocusEl_=function(){return this.root.querySelector("["+yr.INITIAL_FOCUS_ATTRIBUTE+"]")},e}(le),kr=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 Er=l(40),Ar=l(744);class Cr extends CustomEvent{constructor(){super(Cr.NAME,{bubbles:!0,composed:!0})}}Cr.NAME="or-mwc-dialog-opened";class Tr extends CustomEvent{constructor(t){super(Tr.NAME,{detail:t,bubbles:!0,composed:!0})}}Tr.NAME="or-mwc-dialog-closed";const Ir=vt`
|
|
497
498
|
:host {
|
|
498
499
|
position: relative;
|
|
499
500
|
}
|