X7ROOT File Manager
Current Path:
/home/cbholdings/pasukulu/grade/amd/build/searchwidget
home
/
cbholdings
/
pasukulu
/
grade
/
amd
/
build
/
searchwidget
/
📁
..
📄
basewidget.min.js
(5.86 KB)
📄
basewidget.min.js.map
(14.03 KB)
📄
group.min.js
(4.38 KB)
📄
group.min.js.map
(8.26 KB)
📄
initials.min.js
(4.59 KB)
📄
initials.min.js.map
(9.16 KB)
📄
repository.min.js
(1.07 KB)
📄
repository.min.js.map
(2.99 KB)
📄
selectors.min.js
(839 B)
📄
selectors.min.js.map
(2.15 KB)
Editing: group.min.js.map
{"version":3,"file":"group.min.js","sources":["../../src/searchwidget/group.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * A widget to search groups within the gradebook.\n *\n * @module core_grades/searchwidget/group\n * @copyright 2022 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport * as FocusLockManager from 'core/local/aria/focuslock';\nimport Pending from 'core/pending';\nimport * as Templates from 'core/templates';\nimport * as Repository from 'core_grades/searchwidget/repository';\nimport * as WidgetBase from 'core_grades/searchwidget/basewidget';\nimport $ from 'jquery';\nimport * as Selectors from 'core_grades/searchwidget/selectors';\n\n/**\n * Whether this module is already initialised.\n *\n * @type {boolean}\n */\nlet initialised = false;\n\n/**\n * Our entry point into starting to build the group search widget.\n *\n * It'll eventually, based upon the listeners, open the search widget and allow filtering.\n *\n * @method init\n */\nexport const init = () => {\n if (!initialised && document.querySelector(Selectors.elements.getSearchWidgetSelector('group'))) {\n const pendingPromise = new Pending();\n registerListenerEvents();\n pendingPromise.resolve();\n }\n initialised = true;\n};\n\n/**\n * Register event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n let {bodyPromiseResolver, bodyPromise} = WidgetBase.promisesAndResolvers();\n const dropdownMenuContainer = document.querySelector(Selectors.elements.getSearchWidgetDropdownSelector('group'));\n const menuContainer = document.querySelector(Selectors.elements.getSearchWidgetSelector('group'));\n const inputElement = menuContainer.querySelector('input[name=\"group\"]');\n\n // Handle the 'shown.bs.dropdown' event (Fired when the dropdown menu is fully displayed).\n $(menuContainer).on('show.bs.dropdown', async(e) => {\n const courseID = e.relatedTarget.dataset.courseid;\n // Display a loading icon in the dropdown menu container until the body promise is resolved.\n await WidgetBase.showLoader(dropdownMenuContainer);\n\n // If an error occurs while fetching the data, display the error within the dropdown menu.\n const data = await Repository.groupFetch(courseID).catch(async(e) => {\n const errorTemplateData = {\n 'errormessage': e.message\n };\n bodyPromiseResolver(\n await Templates.render('core_grades/searchwidget/error', errorTemplateData)\n );\n });\n // Early return if there is no module data.\n if (data === []) {\n return;\n }\n await WidgetBase.init(\n dropdownMenuContainer,\n bodyPromise,\n data.groups,\n searchGroups(),\n null,\n afterSelect\n );\n\n // Lock tab control. It has to be locked because the dropdown's role is dialog.\n FocusLockManager.trapFocus(dropdownMenuContainer);\n });\n\n // Resolvers for passed functions in the dropdown creation.\n bodyPromiseResolver(Templates.render(\n 'core_grades/searchwidget/group/groupsearch_body',\n []\n ));\n\n // Handle the 'hide.bs.dropdown' event (Fired when the dropdown menu is being closed).\n $(menuContainer).on('hide.bs.dropdown', () => {\n FocusLockManager.untrapFocus();\n });\n\n inputElement.addEventListener('change', e => {\n const toggle = menuContainer.querySelector('.dropdown-toggle');\n const courseId = toggle.dataset.courseid;\n const actionUrl = toggle.dataset.actionBaseUrl ?\n new URL(toggle.dataset.actionBaseUrl.replace(/&/g, \"&\")) :\n new URL(location.href);\n actionUrl.searchParams.set('id', courseId);\n actionUrl.searchParams.set('group', e.target.value);\n actionUrl.searchParams.delete('page');\n\n location.href = actionUrl.href;\n\n e.stopPropagation();\n });\n};\n\n/**\n * Define how we want to search and filter groups when the user decides to input a search value.\n *\n * @method searchGroups\n * @returns {function(): function(*, *): (*)}\n */\nconst searchGroups = () => {\n return () => {\n return (groups, searchTerm) => {\n if (searchTerm === '') {\n return groups;\n }\n searchTerm = searchTerm.toLowerCase();\n const searchResults = [];\n groups.forEach((group) => {\n const groupName = group.name.toLowerCase();\n if (groupName.includes(searchTerm)) {\n searchResults.push(group);\n }\n });\n return searchResults;\n };\n };\n};\n\n/**\n * Define the action to be performed when an item is selected by the search widget.\n *\n * @param {String} selected The selected item's value.\n */\nconst afterSelect = (selected) => {\n const menuContainer = document.querySelector(Selectors.elements.getSearchWidgetSelector('group'));\n const inputElement = menuContainer.querySelector('input[name=\"group\"]');\n\n $(menuContainer).dropdown('hide'); // Otherwise the dropdown stays open when user choose an option using keyboard.\n\n if (inputElement.value != selected) {\n inputElement.value = selected;\n inputElement.dispatchEvent(new Event('change', {bubbles: true}));\n }\n};\n"],"names":["initialised","document","querySelector","Selectors","elements","getSearchWidgetSelector","pendingPromise","Pending","registerListenerEvents","resolve","bodyPromiseResolver","bodyPromise","WidgetBase","promisesAndResolvers","dropdownMenuContainer","getSearchWidgetDropdownSelector","menuContainer","inputElement","on","async","courseID","e","relatedTarget","dataset","courseid","showLoader","data","Repository","groupFetch","catch","errorTemplateData","message","Templates","render","init","groups","searchGroups","afterSelect","FocusLockManager","trapFocus","untrapFocus","addEventListener","toggle","courseId","actionUrl","actionBaseUrl","URL","replace","location","href","searchParams","set","target","value","delete","stopPropagation","searchTerm","toLowerCase","searchResults","forEach","group","name","includes","push","selected","dropdown","dispatchEvent","Event","bubbles"],"mappings":";;;;;;;2ZAoCIA,aAAc,gBASE,SACXA,aAAeC,SAASC,cAAcC,UAAUC,SAASC,wBAAwB,UAAW,OACvFC,eAAiB,IA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