- md5
- dbd0022a6428b6e1fe5329761953283e
- sha1
- 3a25da5e42d83fb3dfa8d0b5d3b14f3c6a92d9f1
- sha256
- 4f96807402529df059a1f842c33afdb619021848df91295814d6ea0e889ae668
"use strict";function _typeof(a){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)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function _iterableToArrayLimit(a,b){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 _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 _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 _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 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 _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 _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=_possibleConstructorReturn(this,_getPrototypeOf(b).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.title=a.component,a.asset="not",a.context="",a}return _inherits(b,a),_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)));
No other release has this exact content. See every version of this file.