Current Path : C:/Users/Mahmood/Desktop/moodle/user/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/user/amd/build/participants.min.js |
function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("core_user/participants",["exports","core_table/dynamic","core/str","core/checkbox-toggleall","core/custom_interaction_events","core_table/local/dynamic/selectors","core/modal_events","core/notification","core/pending","jquery","core_user/local/participants/bulkactions"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=n(b);c=n(c);d=l(d);e=l(e);f=l(f);g=l(g);h=l(h);i=l(i);j=l(j);function l(a){return a&&a.__esModule?a:{default:a}}function m(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;m=function(){return a};return a}function n(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=m();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function o(a,b){return t(a)||s(a,b)||q(a,b)||p()}function p(){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 q(a,b){if(!a)return;if("string"==typeof a)return r(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return r(a,b)}function r(a,b){if(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 s(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function t(a){if(Array.isArray(a))return a}var u={bulkActionSelect:"#formactionid",bulkUserSelectedCheckBoxes:"input[data-togglegroup='participants-table'][data-toggle='slave']:checked",checkCountButton:"#checkall",showCountText:"[data-region=\"participant-count\"]",showCountToggle:"[data-action=\"showcount\"]",stateHelpIcon:"[data-region=\"state-help-icon\"]",tableForm:function tableForm(a){return"form[data-table-unique-id=\"".concat(a,"\"]")}};a.init=function init(a){var l=a.uniqueid,m=a.noteStateNames,n=void 0===m?{}:m,p=document.querySelector(u.tableForm(l)),q=function(a){return p.querySelector(f.default.main.fromRegionId(a))},r=function(){e.default.define(u.bulkActionSelect,[e.default.events.accessibleChange]);(0,j.default)(u.bulkActionSelect).on(e.default.events.accessibleChange,function(a){var b=a.target.closest("select"),c=b.value,d=q(l),e=d.querySelectorAll(u.bulkUserSelectedCheckBoxes),f=new i.default("core_user/participants:bulkActionSelect");if(-1!==c.indexOf("#")){a.preventDefault();var j=[];e.forEach(function(a){j.push(a.getAttribute("name").replace("user",""))});var m;if("#messageselect"===c){m=(0,k.showSendMessage)(j)}else if("#addgroupnote"===c){m=(0,k.showAddNote)(p.dataset.courseId,j,n,p.querySelector(u.stateHelpIcon))}if(m){var o=new i.default("core_user/participants:bulkActionSelected");m.then(function(a){a.getRoot().on(g.default.hidden,function(){b.focus()});o.resolve();return a}).catch(h.default.exception)}}else if(""!==c&&e.length){b.form.submit()}s(b);f.resolve()});p.addEventListener("click",function(a){var c=p.querySelector(u.showCountToggle),e=p.querySelector(u.checkCountButton),f=c&&c.contains(a.target),g=e&&e.contains(a.target);if(f||g){a.preventDefault();var i=q(l);b.setPageSize(i,c.dataset.targetPageSize).then(function(a){d.default.setGroupState(a,"participants-table",g);return a}).catch(h.default.exception)}});p.addEventListener(b.Events.tableContentRefreshed,function(a){var b=p.querySelector(u.showCountToggle),e=p.querySelector(u.checkCountButton),f=a.target,g=parseInt(p.dataset.tableDefaultPerPage,10),i=parseInt(f.dataset.tablePageSize,10),j=parseInt(f.dataset.tableTotalRows,10);d.default.updateSlavesFromMasterState(f,"participants-table");var k=[{key:"countparticipantsfound",component:"core_user",param:j}];if(j<=g){b.classList.add("hidden");if(e){e.classList.add("hidden")}}else if(j<=i){k.push({key:"showperpage",component:"core",param:g});k.push({key:"selectalluserswithcount",component:"core",param:g});b.classList.remove("hidden");b.dataset.targetPageSize=g;if(e){e.classList.add("hidden")}}else{k.push({key:"showall",component:"core",param:j});k.push({key:"selectalluserswithcount",component:"core",param:j});b.classList.remove("hidden");b.dataset.targetPageSize=j;if(e){e.classList.remove("hidden")}}c.get_strings(k).then(function(a){var c=o(a,3),d=c[0],f=c[1],g=c[2],h=p.querySelector(u.showCountText);h.innerHTML=d;if(f){b.innerHTML=f}if(g&&e){e.value=g}}).catch(h.default.exception)})},s=function(a){a.value=""};r()}}); //# sourceMappingURL=participants.min.js.map