- md5
- a4c34a02237ff44cc3c863c192f8c10b
- sha1
- 696e2333b4440bef7c4a61902737061559448182
- sha256
- ec6c7293d19260e93281ede458bc454cd7c68614aafd9a5e0ebe6c5478cdef56
"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 _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(a,b){if(a){if("string"==typeof a)return _arrayLikeToArray(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);return"Object"===c&&a.constructor&&(c=a.constructor.name),"Map"===c||"Set"===c?Array.from(a):"Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,b):void 0}}function _arrayLikeToArray(a,b){(null==b||b>a.length)&&(b=a.length);for(var c=0,d=Array(b);c<b;c++)d[c]=a[c];return d}function _iterableToArrayLimit(a,b){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}function _arrayWithHoles(a){if(Array.isArray(a))return 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)}window.customElements.define("joomla-field-permissions",function(a){function b(){var a;if(_classCallCheck(this,b),a=c.call(this),!Joomla)throw new Error("Joomla API is not properly initiated");if(!a.getAttribute("data-uri"))throw new Error("No valid url for validation");return a.query=window.location.search.substring(1),a.buttons="",a.buttonDataSelector="data-onchange-task",a.onDropdownChange=a.onDropdownChange.bind(_assertThisInitialized(a)),a.getUrlParam=a.getUrlParam.bind(_assertThisInitialized(a)),a.component=a.getUrlParam("component"),a.extension=a.getUrlParam("extension"),a.option=a.getUrlParam("option"),a.view=a.getUrlParam("view"),a.asset="not",a.context="",a}_inherits(b,a);var c=_createSuper(b);return _createClass(b,[{key:"connectedCallback",value:function connectedCallback(){var a=this;this.buttons=[].slice.call(document.querySelectorAll("[".concat(this.buttonDataSelector,"]"))),this.buttons&&this.buttons.forEach(function(b){b.addEventListener("change",a.onDropdownChange)})}},{key:"disconnectedCallback",value:function disconnectedCallback(){var a=this;this.buttons&&this.buttons.forEach(function(b){b.removeEventListener("change",a.onDropdownChange)})}},{key:"onDropdownChange",value:function onDropdownChange(a){a.preventDefault();var b=a.target.getAttribute(this.buttonDataSelector);"permissions.apply"===b&&this.sendPermissions(a)}},{key:"sendPermissions",value:function sendPermissions(a){var b=a.target,c=document.getElementById("icon_".concat(b.id));c.removeAttribute("class"),c.setAttribute("class","joomla-icon joomla-field-permissions__spinner");var d=b.value;if(document.getElementById("jform_context")){this.context=document.getElementById("jform_context").value;var e=this.context.split("."),f=_slicedToArray(e,1);this.context=f[0]}"com_config"!==this.option||this.component||this.extension?this.extension||"component"!==this.view?this.context?(this.asset="group"===this.view?"".concat(this.context,".fieldgroup.").concat(this.getUrlParam("id")):"".concat(this.context,".field.{this.getUrlParam('id')}"),this.title=document.getElementById("jform_title").value):this.extension&&this.view?(this.asset="".concat(this.extension,".").concat(this.view,".").concat(this.getUrlParam("id")),this.title=document.getElementById("jform_title").value):!this.extension&&this.view&&(this.asset="".concat(this.option,".").concat(this.view,".").concat(this.getUrlParam("id")),this.title=document.getElementById("jform_title").value):this.asset=this.component:this.asset="root.1";var g=b.id.replace("jform_rules_",""),h=g.lastIndexOf("_"),i={comp:this.asset,action:g.substring(0,h),rule:g.substring(h+1),value:d,title:this.title};Joomla.removeMessages(),Joomla.request({url:this.getAttribute("data-uri"),method:"POST",data:JSON.stringify(i),perform:!0,headers:{"Content-Type":"application/json"},onSuccess:function onSuccess(a){var d;try{d=JSON.parse(a)}catch(a){console.log(a)}if(c.removeAttribute("class"),d.data&&d.data.result){c.setAttribute("class","joomla-icon joomla-field-permissions__allowed");var e=b.parentNode.parentNode.nextElementSibling.querySelector("span");e.removeAttribute("class"),e.setAttribute("class",d.data.class),e.innerHTML=d.data.text}"object"===_typeof(d.messages)&&null!==d.messages&&(Joomla.renderMessages(d.messages),d.data&&d.data.result?c.setAttribute("class","joomla-icon joomla-field-permissions__allowed"):c.setAttribute("class","joomla-icon joomla-field-permissions__denied"))},onError:function onError(a){c.removeAttribute("style"),Joomla.renderMessages(Joomla.ajaxErrorsMessages(a,a.statusText)),c.setAttribute("class","joomla-icon joomla-field-permissions__denied")}})}},{key:"getUrlParam",value:function getUrlParam(a){var b=this.query.split("&"),c=0;for(c;c<b.length;c+=1){var d=b[c].split("=");if(d[0]===a)return d[1]}return!1}}]),b}(_wrapNativeSuper(HTMLElement)));
The same content is in 4 releases, Joomla 4.0.0-beta to 4.0.0-beta4. See them all, or every version of this file.