芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/media/system/js/fields/joomla-field-subform-es5.min.js
!function(){"use strict";function t(t,e){for(var r=0;r
=this.maximum)return null;(e="TBODY"===this.containerWithRows.nodeName||"TABLE"===this.containerWithRows.nodeName?document.createElement("tbody"):document.createElement("div")).innerHTML=this.template;var n=e.children[0];return t?t.parentNode.insertBefore(n,t.nextSibling):this.containerWithRows.append(n),this.buttonMove&&(n.setAttribute("draggable","false"),n.setAttribute("aria-grabbed","false"),n.setAttribute("tabindex","0")),n.setAttribute("data-new","1"),this.fixUniqueAttributes(n,r),this.dispatchEvent(new CustomEvent("subform-row-add",{detail:{row:n},bubbles:!0})),n.dispatchEvent(new CustomEvent("joomla:updated",{bubbles:!0,cancelable:!0})),n},d.removeRow=function(t){this.getRows().length<=this.minimum||(this.dispatchEvent(new CustomEvent("subform-row-remove",{detail:{row:t},bubbles:!0})),t.dispatchEvent(new CustomEvent("joomla:removed",{bubbles:!0,cancelable:!0})),t.parentNode.removeChild(t))},d.fixUniqueAttributes=function(t,e){var r=this,n=e||0,a=t.getAttribute("data-group"),o=t.getAttribute("data-base-name"),i=Math.max(this.lastRowIndex,n),u=o+i;this.lastRowIndex=i+1,t.setAttribute("data-group",u);var s=t.querySelectorAll("[name]"),l={};(s=[].slice.call(s).filter((function(t){return t.closest("joomla-field-subform")===r}))).forEach((function(e){var r=e,n=r.getAttribute("name"),o=r.getAttribute("aria-describedby"),i=n.replace(/(\[\]$)/g,"").replace(/(\]\[)/g,"__").replace(/\[/g,"_").replace(/\]/g,""),s=n.replace("["+a+"][","["+u+"]["),b=i.replace(a,u).replace(/\W/g,"_"),c=0,f=i;if("checkbox"===r.type&&n.match(/\[\]$/)){if(!(c=l[i]?l[i].length:0)){var d=r.closest("fieldset.checkboxes"),m=t.querySelector('label[for="'+i+'"]');d&&d.setAttribute("id",b),m&&(m.setAttribute("for",b),m.setAttribute("id",b+"-lbl"))}f+=c,b+=c}else if("radio"===r.type){if(!(c=l[i]?l[i].length:0)){var g=r.closest("fieldset.radio"),p=t.querySelector('label[for="'+i+'"]');g&&g.setAttribute("id",b),p&&(p.setAttribute("for",b),p.setAttribute("id",b+"-lbl"))}f+=c,b+=c}l[i]?l[i].push(!0):l[i]=[!0],r.name=s,r.id&&(r.id=b),o&&r.setAttribute("aria-describedby",s+"-desc");var h=t.querySelector('label[for="'+f+'"]');h&&(h.setAttribute("for",b),h.setAttribute("id",b+"-lbl"))}))},d.setUpDragSort=function(){var t=this,e=null,r=!1;function o(e){return!e.form&&e.matches(t.buttonMove)?e:e.closest(t.buttonMove)}function i(t,e){var r=!1;if(t.parentNode===e.parentNode)for(var n=t;n;n=n.previousSibling)if(n===e){r=!0;break}r?e.parentNode.insertBefore(t,e):e.parentNode.insertBefore(t,e.nextSibling)}Array.from(this.getRows()).forEach((function(t){t.setAttribute("draggable","false"),t.setAttribute("aria-grabbed","false"),t.setAttribute("tabindex","0")})),this.addEventListener("touchstart",(function(n){r=!0;var a=o(n.target),u=a?a.closest(t.repeatableElement):null;u&&u.closest("joomla-field-subform")===t&&(e?(u!==e&&i(e,u),e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null):(u.setAttribute("draggable","true"),u.setAttribute("aria-grabbed","true"),e=u),n.preventDefault())})),this.addEventListener("mousedown",(function(n){var a=n.target;if(!r){var i=o(a),u=i?i.closest(t.repeatableElement):null;u&&u.closest("joomla-field-subform")===t&&(u.setAttribute("draggable","true"),u.setAttribute("aria-grabbed","true"),e=u)}})),this.addEventListener("mouseup",(function(){e&&!r&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null)})),this.addEventListener("keydown",(function(r){if(!(r.keyCode!==a&&r.keyCode!==n&&r.keyCode!==u||r.target.form)&&r.target.matches(t.repeatableElement)){var o=r.target;if(o&&o.closest("joomla-field-subform")===t&&(r.keyCode===n&&function(t){return t.ctrlKey||t.metaKey||t.shiftKey}(r)&&("true"===o.getAttribute("aria-grabbed")?(o.setAttribute("draggable","false"),o.setAttribute("aria-grabbed","false"),e=null):(e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null),o.setAttribute("draggable","true"),o.setAttribute("aria-grabbed","true"),e=o),r.preventDefault()),r.keyCode===a&&e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null),r.keyCode===u&&e)){if(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),o===e)return void(e=null);i(e,o),r.preventDefault(),e=null}}})),this.addEventListener("dragstart",(function(t){var r=t.dataTransfer;e&&(r.effectAllowed="move",r.setData("text",""))})),this.addEventListener("dragover",(function(t){e&&t.preventDefault()})),this.addEventListener("dragenter",(function(r){var n=r.target;if(e&&(!t.rowsContainer||n.closest(t.rowsContainer)===t.containerWithRows)){var a=n.matches(t.repeatableElement)?n:n.closest(t.repeatableElement);a&&i(e,a)}})),this.addEventListener("dragend",(function(){e&&(e.setAttribute("draggable","false"),e.setAttribute("aria-grabbed","false"),e=null)}))},b=l,(c=[{key:"buttonAdd",get:function(){return this.getAttribute("button-add")}},{key:"buttonRemove",get:function(){return this.getAttribute("button-remove")}},{key:"buttonMove",get:function(){return this.getAttribute("button-move")}},{key:"rowsContainer",get:function(){return this.getAttribute("rows-container")}},{key:"repeatableElement",get:function(){return this.getAttribute("repeatable-element")}},{key:"minimum",get:function(){return this.getAttribute("minimum")}},{key:"maximum",get:function(){return this.getAttribute("maximum")}},{key:"name",get:function(){return this.getAttribute("name")},set:function(t){return this.template=this.template.replace(new RegExp(' name="'+this.name.replace(/[[\]]/g,"\\$&"),"g"),' name="'+t),this.setAttribute("name",t)}}])&&t(b.prototype,c),f&&t(b,f),l}(o(HTMLElement));e.define("joomla-field-subform",s)}(customElements)}();