CoreFiles by mySites.guru
joomla-field-user.min.js1 lines, 2,972 bytes, from Joomla_4.0.0-alpha7-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha6
md5
5498037601abb999f8fb8f07c6355dc6
sha1
352cfbccd24b5528456c7ae2897ace6d604c9123
sha256
6fd66f48a398c0a772023459b83d7b8cac360becf43dfe957afd2bd101919e08
"use strict";(()=>{class a extends HTMLElement{constructor(){super(),this.onUserSelect="",this.onchangeStr="",this.buttonClick=this.buttonClick.bind(this),this.iframeLoad=this.iframeLoad.bind(this)}static get observedAttributes(){return["url","modal-class","modal-width","modal-height","input","input-name","button-select"]}get url(){return this.getAttribute("url")}set url(a){this.setAttribute("url",a)}get modalClass(){return this.getAttribute("modal")}set modalClass(a){this.setAttribute("modal",a)}get modalWidth(){return this.getAttribute("modal-width")}set modalWidth(a){this.setAttribute("modal-width",a)}get modalHeight(){return this.getAttribute("modal-height")}set modalHeight(a){this.setAttribute("modal-height",a)}get inputId(){return this.getAttribute("input")}set inputId(a){this.setAttribute("input",a)}get inputNameClass(){return this.getAttribute("input-name")}set inputNameClass(a){this.setAttribute("input-name",a)}get buttonSelectClass(){return this.getAttribute("button-select")}set buttonSelectClass(a){this.setAttribute("button-select",a)}connectedCallback(){this.modal=this.querySelector(this.modalClass),this.modalBody=this.querySelector(".modal-body"),this.input=this.querySelector(this.inputId),this.inputName=this.querySelector(this.inputNameClass),this.buttonSelect=this.querySelector(this.buttonSelectClass),this.modalClose=this.modalClose.bind(this),this.setValue=this.setValue.bind(this),this.buttonSelect&&(this.buttonSelect.addEventListener("click",this.modalOpen.bind(this)),this.modal.addEventListener("hide",this.removeIframe.bind(this)),this.onchangeStr=this.input.getAttribute("data-onchange"),this.onchangeStr&&(this.onUserSelect=new Function(this.onchangeStr),this.input.addEventListener("change",this.onUserSelect)))}disconnectedCallback(){this.onchangeStr&&this.input&&this.input.removeEventListener("change",this.onUserSelect),this.buttonSelect&&this.buttonSelect.removeEventListener("click",this),this.modal.removeEventListener("hide",this)}buttonClick(a){this.setValue(a.target.getAttribute("data-user-value"),a.target.getAttribute("data-user-name")),this.modalClose()}iframeLoad(){const a=this.iframeEl.contentWindow.document,b=[].slice.call(a.querySelectorAll(".button-select"));b.forEach(a=>{a.addEventListener("click",this.buttonClick)})}modalOpen(){this.removeIframe();const a=document.createElement("iframe");a.setAttribute("name","field-user-modal"),a.src=this.url.replace("{field-user-id}",this.input.getAttribute("id")),a.setAttribute("width",this.modalWidth),a.setAttribute("height",this.modalHeight),this.modalBody.appendChild(a),this.modal.open(),this.iframeEl=this.modalBody.querySelector("iframe"),this.iframeEl.addEventListener("load",this.iframeLoad)}modalClose(){Joomla.Modal.getCurrent().close(),this.modalBody.innerHTML=""}removeIframe(){this.modalBody.innerHTML=""}setValue(a,b){this.input.setAttribute("value",a),this.inputName.setAttribute("value",b||a)}}customElements.define("joomla-field-user",a)})();

The same content is in 2 releases, Joomla 4.0.0-alpha7 to 4.0.0-alpha8. See them all, or every version of this file.