- md5
- b0ef119f9c825e1804215d9b614f9cd5
- sha1
- ed94e0e1d3c56b1cf98e3b4ff7ad91a69def1b95
- sha256
- ee4d49a542ed1806ed6631bc3c48d0861559360fc975eedff67022e1d591c220
"use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&_setPrototypeOf(a,b)}function _createSuper(a){var b=_isNativeReflectConstruct();return function(){var c,d=_getPrototypeOf(a);if(b){var e=_getPrototypeOf(this).constructor;c=Reflect.construct(d,arguments,e)}else c=d.apply(this,arguments);return _possibleConstructorReturn(this,c)}}function _possibleConstructorReturn(a,b){return b&&("object"===_typeof(b)||"function"==typeof b)?b:_assertThisInitialized(a)}function _assertThisInitialized(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _wrapNativeSuper(a){var b="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(a){function c(){return _construct(a,arguments,_getPrototypeOf(this).constructor)}if(null===a||!_isNativeFunction(a))return a;if("function"!=typeof a)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof b){if(b.has(a))return b.get(a);b.set(a,c)}return c.prototype=Object.create(a.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}}),_setPrototypeOf(c,a)},_wrapNativeSuper(a)}function _construct(){return _construct=_isNativeReflectConstruct()?Reflect.construct:function(b,c,d){var e=[null];e.push.apply(e,c);var a=Function.bind.apply(b,e),f=new a;return d&&_setPrototypeOf(f,d.prototype),f},_construct.apply(null,arguments)}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(a){return!1}}function _isNativeFunction(a){return-1!==Function.toString.call(a).indexOf("[native code]")}function _setPrototypeOf(a,b){return _setPrototypeOf=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},_setPrototypeOf(a,b)}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}customElements.define("joomla-field-module-order",function(a){function b(){var a;return _classCallCheck(this,b),a=c.call(this),a.linkedFieldSelector="",a.linkedFieldElement="",a.originalPosition="",a.writeDynaList.bind(_assertThisInitialized(a)),a.getNewOrder.bind(_assertThisInitialized(a)),a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"connectedCallback",value:function connectedCallback(){if(this.linkedFieldSelector=this.getAttribute("data-linked-field")||"jform_position",!this.linkedFieldSelector)throw new Error("No linked field defined!");if(this.linkedFieldElement=document.getElementById(this.linkedFieldSelector),!this.linkedFieldElement)throw new Error("No linked field defined!");var a=this;this.originalPosition=this.linkedFieldElement.value,this.getNewOrder(this.originalPosition),this.linkedFieldElement.addEventListener("change",function(){a.originalPosition=a.linkedFieldElement.value,a.getNewOrder(a.linkedFieldElement.value)})}},{key:"writeDynaList",value:function writeDynaList(a,b,c,d){var e=0,f=document.createElement("select");for(var j in this.hasOwnProperty("disabled")&&f.setAttribute("disabled",""),this.getAttribute("onchange")&&f.setAttribute("onchange",this.getAttribute("onchange")),this.getAttribute("size")&&f.setAttribute("size",this.getAttribute("size")),f.classList.add(a.itemClass),f.setAttribute("name",a.name),f.id=a.id,b)if(b.hasOwnProperty(j)){var g=document.createElement("option"),h=b[j];g.value=h[1],g.innerHTML=h[2],(c&&d===h[1]||!c&&0===e)&&g.setAttribute("selected","selected"),f.appendChild(g),e++}this.innerHTML="",this.appendChild(f)}},{key:"getNewOrder",value:function getNewOrder(a){var b=this.getAttribute("data-url"),c=this.getAttribute("data-client-id"),d=this.getAttribute("data-ordering"),e=this.getAttribute("data-name"),f=this.getAttribute("data-client-attr")?this.getAttribute("data-client-attr"):"custom-select",g="".concat(this.getAttribute("data-id")),h=[],i=this;Joomla.request({url:"".concat(b,"&client_id=").concat(c,"&position=").concat(a),method:"GET",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:function onSuccess(a){if(a&&(a=JSON.parse(a),0<a.data.length)){for(var b=0;b<a.data.length;++b)h[b]=a.data[b].split(",");i.writeDynaList({name:e,id:g,itemClass:f},h,i.originalPosition,d)}"object"===_typeof(a.messages)&&null!==a.messages&&Joomla.renderMessages(a.messages)}})}}]),b}(_wrapNativeSuper(HTMLElement)));
The same content is in 2 releases, Joomla 4.0.0-beta to 4.0.0-beta2. See them all, or every version of this file.