From 9f8a87ac83e60fa1026cdebc600766db21773a47 Mon Sep 17 00:00:00 2001 From: PMKuipers Date: Fri, 8 Sep 2023 12:47:29 +0200 Subject: [PATCH] Code style fixes (mostly white-space) --- Gruntfile.js | 6 +- README.md | 16 +- .../vue-functional-data-merge.min.js.map | 2 +- amd/build/cfg-grades.min.js.map | 2 +- amd/build/modedit-modal.min.js | 2 +- amd/build/modedit-modal.min.js.map | 2 +- amd/build/page-edit-plan.min.js.map | 2 +- amd/build/page-myreport.min.js.map | 2 +- amd/build/page-view-plan.min.js.map | 2 +- .../portal-vue/portal-vue.esm.min.js.map | 2 +- amd/build/report-viewer-components.min.js | 2 +- amd/build/report-viewer-components.min.js.map | 2 +- amd/build/simpleline/css-calc.min.js.map | 2 +- amd/build/simpleline/simpleline.min.js.map | 2 +- amd/build/studyplan-editor-components.min.js | 2 +- .../studyplan-editor-components.min.js.map | 2 +- amd/build/treestudyplan-components.min.js | 2 +- amd/build/treestudyplan-components.min.js.map | 2 +- .../vue-easy-dnd/vue-easy-dnd.esm.min.js.map | 2 +- amd/build/vue/dev/vue.min.js.map | 2 +- amd/build/vue/vue.min.js.map | 2 +- amd/src/bootstrap-vue/readme-moodle.txt | 2 +- .../vue-functional-data-merge.js | 6 +- amd/src/cfg-grades.js | 22 +- amd/src/modedit-modal.js | 6 +- amd/src/page-edit-plan.js | 26 +- amd/src/page-myreport.js | 8 +- amd/src/page-view-plan.js | 2 +- amd/src/portal-vue/portal-vue.esm.js | 14 +- amd/src/report-viewer-components.js | 258 ++++----- amd/src/simpleline/css-calc.js | 75 ++- amd/src/simpleline/simpleline.js | 14 +- amd/src/studyplan-editor-components.js | 492 +++++++++--------- amd/src/treestudyplan-components.js | 8 +- amd/src/vue-easy-dnd/readme-moodle.txt | 12 +- amd/src/vue-easy-dnd/vue-easy-dnd.esm.js | 70 +-- amd/src/vue/dev/vue.js | 18 +- amd/src/vue/vue.js | 18 +- build.sh | 2 +- classes/completionscanner.php | 12 +- classes/corecompletioninfo.php | 26 +- classes/courseinfo.php | 10 +- classes/courseservice.php | 3 +- .../local/aggregators/bistate_aggregator.php | 6 +- classes/local/aggregators/core_aggregator.php | 6 +- classes/period.php | 4 +- classes/studyplanservice.php | 2 +- doc.php | 2 +- doc/advanced.htm | 26 +- doc/configuration.htm | 36 +- doc/create-studyplan.htm | 46 +- doc/index.htm | 6 +- doc/teacherview-studyplan.htm | 6 +- doc/view-studyplan.htm | 20 +- edit-plan.php | 9 +- invited.php | 2 +- lib.php | 26 +- myreport-embed.php | 2 +- myreport.php | 2 +- scss/bootstraptweaking.scss | 2 +- scss/colors.scss | 2 +- scss/generic.scss | 2 +- scss/readme-moodle.txt | 6 +- scss/studyplan.scss | 22 +- settings.php | 4 +- thirdpartylibs.xml | 20 +- view-plan.php | 2 +- vuemode.sh | 4 +- 68 files changed, 720 insertions(+), 709 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fcfaf86..916548a 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -34,11 +34,11 @@ module.exports = function(grunt) { const sass = require('sass'); // Import grunt configuration for moodle base - process.chdir("../.."); // change dir to moodle base + process.chdir("../.."); // change dir to moodle base require(path.resolve(`./Gruntfile.js`))(grunt); // Run Gruntfile module from moodle base grunt.registerTask('scssplugin','Compile scss/*.sccs into styles.css and css/devstyles.css', () => { - + const devoutput = 'css/devstyles.css'; const prodoutput = 'styles.css'; @@ -93,7 +93,7 @@ module.exports = function(grunt) { // Remove gherkinlint from the startup list, since it exits with an error because of errors in moodle's own code grunt.moodleEnv.startupTasks.splice(grunt.moodleEnv.startupTasks.indexOf("gherkinlint"),1); - + // Add the 'scssplugin' task as a startup task. grunt.moodleEnv.startupTasks.push('scssplugin'); diff --git a/README.md b/README.md index f73700d..5648354 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Moodle studyplan plugin -Plugin to organize a curriculum into an easy to read graphical respresentation of courses and student progress therein. +Plugin to organize a curriculum into an easy to read graphical respresentation of courses and student progress therein. The studyplan plugin extends Moodle with the ability to show students and teachers an overview of their curriculum and results therein. By showing students an easy to read graphical overview of their progress over multiple courses, students are more in control of their own @@ -14,7 +14,7 @@ Install the plugin by adding the zip file manually to the installed plugins in y ### Dynamic Navigation links The studyplan plugin will automatically add links to the flat navigation bat used in Moodle 3.11 and below However, Moodle 4.0-4.2 use a new "primary navigation" bar, and does not yet support customizing the primary navigation bar (it is a planned feature though) - + Use the following workaround: You can add custom primary menu items in **Site administration** -> **Appearance** -> **Theme settings** That page contains an item called Custom menu items". Add the following into that area to custimize it @@ -37,13 +37,13 @@ The recommended roles below give an example of that. #### Recommended roles It is recommended to create the following new roles: -- **Studyplan Manager** (*studyplanmanager*) - Context types: *System*, *Category* +- **Studyplan Manager** (*studyplanmanager*) + Context types: *System*, *Category* *Capabilities* - **Manage studyplans** (*local/treestudyplan:editstudyplan*) -- **Studyplan Viewer** (*studyplanviewer*) - Context types: *System*, *Category* - *Capabilities* +- **Studyplan Viewer** (*studyplanviewer*) + Context types: *System*, *Category* + *Capabilities* - **View study plan of others** (*local/treestudyplan:viewuserreports*) Then assign the role **studyplanmanager** in a specific category context, or the system context to all users who should be able to create and edit studyplans in that specific context @@ -54,7 +54,7 @@ After installing the plugin you can find the main configuration in **Site admini ## Documentation / User manual After installing the plugin, the detailed user manual can be found under **Site administration** -> **Courses** -> **Studyplans** -> **Studyplan plugin documentation** -Alternatively, you can unpack this ZIP file and open the **doc/index.html** file. +Alternatively, you can unpack this ZIP file and open the **doc/index.html** file. (Note that viewing the html files directly will not five the optimal experience, since fontawesome tags and bootstrap styles will not be properly rendered) ## Development diff --git a/amd/build/bootstrap-vue/vue-functional-data-merge.min.js.map b/amd/build/bootstrap-vue/vue-functional-data-merge.min.js.map index 2e3c2a2..c0474da 100644 --- a/amd/build/bootstrap-vue/vue-functional-data-merge.min.js.map +++ b/amd/build/bootstrap-vue/vue-functional-data-merge.min.js.map @@ -1 +1 @@ -{"version":3,"file":"vue-functional-data-merge.min.js","sources":["../../src/bootstrap-vue/vue-functional-data-merge.js"],"sourcesContent":["/* eslint-disable */\n/* \nCompiled from ts into js by PMKuipers @ 2023) from source\nat https://github.com/alexsasharegan/vue-functional-data-merge \nBelow is copy of licens in original project\n*/\n/* \nThe MIT License (MIT)\n\nCopyright (c) 2017 Alex Regan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nconst pattern = {\n kebab: /-(\\w)/g,\n styleProp: /:(.*)/,\n styleList: /;(?![^(]*\\))/g,\n};\nfunction camelReplace(_substr, match) {\n return match.toUpperCase();\n}\nfunction camelCase(str) {\n return str.replace(pattern.kebab, camelReplace);\n}\nfunction parseStyle(style) {\n let styleMap = {};\n for (let s of style.split(pattern.styleList)) {\n let [key, val] = s.split(pattern.styleProp);\n key = key.trim();\n if (!key) {\n continue;\n }\n // May be undefined if the `key: value` pair is incomplete.\n val = val.trim();\n styleMap[camelCase(key)] = val;\n }\n return styleMap;\n}\nfunction mergeData() {\n let mergeTarget = {};\n let i = arguments.length;\n let prop;\n // Allow for variadic argument length.\n while (i--) {\n // Iterate through the data properties and execute merge strategies\n // Object.keys eliminates need for hasOwnProperty call\n for (prop of Object.keys(arguments[i])) {\n if (arguments[i][prop] == null) {\n continue;\n }\n switch (prop) {\n case \"class\": {\n let classes = [];\n {\n let value = mergeTarget[\"class\"];\n if (Array.isArray(value)) {\n classes = value;\n }\n }\n // Repackaging in an array allows Vue runtime\n // to merge class/style bindings regardless of type.\n mergeTarget[\"class\"] = classes.concat(arguments[i][\"class\"]);\n continue;\n }\n // merge style by concatenating arrays\n case \"style\": {\n let styles = [];\n {\n let value = mergeTarget.style;\n if (Array.isArray(value)) {\n styles = value;\n }\n }\n let thisStyle = [];\n if (Array.isArray(arguments[i].style)) {\n thisStyle = arguments[i].style;\n }\n else {\n thisStyle.push(arguments[i].style);\n }\n for (let j = 0; j < thisStyle.length; j++) {\n let s = thisStyle[j];\n if (typeof s === \"string\") {\n thisStyle[j] = parseStyle(s);\n }\n }\n mergeTarget[prop] = styles.concat(thisStyle);\n continue;\n }\n case \"id\":\n case \"key\":\n case \"ref\":\n case \"keepAlive\": {\n if (!mergeTarget[prop]) {\n mergeTarget[prop] = arguments[i][prop];\n }\n continue;\n }\n }\n if (prop.startsWith(\"on\") && prop !== \"on\") {\n // Object, the properties of which to merge via array merge strategy (array concatenation).\n // Callback merge strategy merges callbacks to the beginning of the array,\n // so that the last defined callback will be invoked first.\n // This is done since to mimic how Object.assign merging\n // uses the last given value to assign.\n // Concat function to array of functions if callback present.\n if (mergeTarget[prop] && !Array.isArray(mergeTarget[prop])) {\n // Insert current iteration data in beginning of merged array.\n mergeTarget[prop] = [mergeTarget[prop], arguments[i][prop]];\n continue;\n }\n let targetValue = mergeTarget[prop];\n let thisValue = arguments[i][prop];\n // The `else` condition falls through to a simple assignment.\n if (Array.isArray(targetValue)) {\n if (Array.isArray(thisValue)) {\n targetValue.push(...thisValue);\n }\n else {\n targetValue.push(thisValue);\n }\n continue;\n }\n }\n mergeTarget[prop] = arguments[i][prop];\n }\n }\n return mergeTarget;\n}\nexport { mergeData };\n"],"names":["prop","mergeTarget","i","arguments","length","Object","keys","classes","value","Array","isArray","concat","styles","style","thisStyle","push","j","s","parseStyle","startsWith","targetValue","thisValue","pattern","kebab","styleProp","styleList","camelReplace","_substr","match","toUpperCase","str","styleMap","split","key","val","trim","replace"],"mappings":"81CA0DQA,KAFAC,YAAc,GACdC,EAAIC,UAAUC,YAGXF,gCAGUG,OAAOC,KAAKH,UAAUD,qCAA9BF,uBACyB,MAAtBG,UAAUD,GAAGF,cAGTA,UACC,YACGO,QAAU,GAENC,MAAQP,YAAW,MACnBQ,MAAMC,QAAQF,SACdD,QAAUC,OAKlBP,YAAW,MAAYM,QAAQI,OAAOR,UAAUD,GAAV,oBAIrC,YACGU,OAAS,GAELJ,OAAQP,YAAYY,MACpBJ,MAAMC,QAAQF,UACdI,OAASJ,YAGbM,UAAY,GACZL,MAAMC,QAAQP,UAAUD,GAAGW,OAC3BC,UAAYX,UAAUD,GAAGW,MAGzBC,UAAUC,KAAKZ,UAAUD,GAAGW,WAE3B,IAAIG,EAAI,EAAGA,EAAIF,UAAUV,OAAQY,IAAK,KACnCC,EAAIH,UAAUE,GACD,iBAANC,IACPH,UAAUE,GAAKE,WAAWD,IAGlChB,YAAYD,MAAQY,OAAOD,OAAOG,wBAGjC,SACA,UACA,UACA,YACIb,YAAYD,QACbC,YAAYD,MAAQG,UAAUD,GAAGF,mBAKzCA,KAAKmB,WAAW,OAAkB,OAATnB,KAAe,IAOpCC,YAAYD,QAAUS,MAAMC,QAAQT,YAAYD,OAAQ,CAExDC,YAAYD,MAAQ,CAACC,YAAYD,MAAOG,UAAUD,GAAGF,oBAGrDoB,YAAcnB,YAAYD,MAC1BqB,UAAYlB,UAAUD,GAAGF,SAEzBS,MAAMC,QAAQU,aAAc,CACxBX,MAAMC,QAAQW,WACdD,YAAYL,WAAZK,mFAAoBC,4VAGpBD,YAAYL,KAAKM,qBAK7BpB,YAAYD,MAAQG,UAAUD,GAAGF,qBAGlCC,iBAlHLqB,QAAU,CACZC,MAAO,SACPC,UAAW,QACXC,UAAW,0BAENC,aAAaC,QAASC,cACpBA,MAAMC,uBAKRX,WAAWL,iBAHDiB,IAIXC,SAAW,+xBACDlB,MAAMmB,MAAMV,QAAQG,+DAAY,0CACvBO,MAAMV,QAAQE,cAA5BS,iBAAKC,kBACVD,IAAMA,IAAIE,UAKVD,IAAMA,IAAIC,OACVJ,UAbWD,IAaQG,IAZhBH,IAAIM,QAAQd,QAAQC,MAAOG,gBAYHQ,+DAExBH"} \ No newline at end of file +{"version":3,"file":"vue-functional-data-merge.min.js","sources":["../../src/bootstrap-vue/vue-functional-data-merge.js"],"sourcesContent":["/* eslint-disable */\n/*\nCompiled from ts into js by PMKuipers @ 2023) from source\nat https://github.com/alexsasharegan/vue-functional-data-merge\nBelow is copy of licens in original project\n*/\n/*\nThe MIT License (MIT)\n\nCopyright (c) 2017 Alex Regan\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\nconst pattern = {\n kebab: /-(\\w)/g,\n styleProp: /:(.*)/,\n styleList: /;(?![^(]*\\))/g,\n};\nfunction camelReplace(_substr, match) {\n return match.toUpperCase();\n}\nfunction camelCase(str) {\n return str.replace(pattern.kebab, camelReplace);\n}\nfunction parseStyle(style) {\n let styleMap = {};\n for (let s of style.split(pattern.styleList)) {\n let [key, val] = s.split(pattern.styleProp);\n key = key.trim();\n if (!key) {\n continue;\n }\n // May be undefined if the `key: value` pair is incomplete.\n val = val.trim();\n styleMap[camelCase(key)] = val;\n }\n return styleMap;\n}\nfunction mergeData() {\n let mergeTarget = {};\n let i = arguments.length;\n let prop;\n // Allow for variadic argument length.\n while (i--) {\n // Iterate through the data properties and execute merge strategies\n // Object.keys eliminates need for hasOwnProperty call\n for (prop of Object.keys(arguments[i])) {\n if (arguments[i][prop] == null) {\n continue;\n }\n switch (prop) {\n case \"class\": {\n let classes = [];\n {\n let value = mergeTarget[\"class\"];\n if (Array.isArray(value)) {\n classes = value;\n }\n }\n // Repackaging in an array allows Vue runtime\n // to merge class/style bindings regardless of type.\n mergeTarget[\"class\"] = classes.concat(arguments[i][\"class\"]);\n continue;\n }\n // merge style by concatenating arrays\n case \"style\": {\n let styles = [];\n {\n let value = mergeTarget.style;\n if (Array.isArray(value)) {\n styles = value;\n }\n }\n let thisStyle = [];\n if (Array.isArray(arguments[i].style)) {\n thisStyle = arguments[i].style;\n }\n else {\n thisStyle.push(arguments[i].style);\n }\n for (let j = 0; j < thisStyle.length; j++) {\n let s = thisStyle[j];\n if (typeof s === \"string\") {\n thisStyle[j] = parseStyle(s);\n }\n }\n mergeTarget[prop] = styles.concat(thisStyle);\n continue;\n }\n case \"id\":\n case \"key\":\n case \"ref\":\n case \"keepAlive\": {\n if (!mergeTarget[prop]) {\n mergeTarget[prop] = arguments[i][prop];\n }\n continue;\n }\n }\n if (prop.startsWith(\"on\") && prop !== \"on\") {\n // Object, the properties of which to merge via array merge strategy (array concatenation).\n // Callback merge strategy merges callbacks to the beginning of the array,\n // so that the last defined callback will be invoked first.\n // This is done since to mimic how Object.assign merging\n // uses the last given value to assign.\n // Concat function to array of functions if callback present.\n if (mergeTarget[prop] && !Array.isArray(mergeTarget[prop])) {\n // Insert current iteration data in beginning of merged array.\n mergeTarget[prop] = [mergeTarget[prop], arguments[i][prop]];\n continue;\n }\n let targetValue = mergeTarget[prop];\n let thisValue = arguments[i][prop];\n // The `else` condition falls through to a simple assignment.\n if (Array.isArray(targetValue)) {\n if (Array.isArray(thisValue)) {\n targetValue.push(...thisValue);\n }\n else {\n targetValue.push(thisValue);\n }\n continue;\n }\n }\n mergeTarget[prop] = arguments[i][prop];\n }\n }\n return mergeTarget;\n}\nexport { mergeData };\n"],"names":["prop","mergeTarget","i","arguments","length","Object","keys","classes","value","Array","isArray","concat","styles","style","thisStyle","push","j","s","parseStyle","startsWith","targetValue","thisValue","pattern","kebab","styleProp","styleList","camelReplace","_substr","match","toUpperCase","str","styleMap","split","key","val","trim","replace"],"mappings":"81CA0DQA,KAFAC,YAAc,GACdC,EAAIC,UAAUC,YAGXF,gCAGUG,OAAOC,KAAKH,UAAUD,qCAA9BF,uBACyB,MAAtBG,UAAUD,GAAGF,cAGTA,UACC,YACGO,QAAU,GAENC,MAAQP,YAAW,MACnBQ,MAAMC,QAAQF,SACdD,QAAUC,OAKlBP,YAAW,MAAYM,QAAQI,OAAOR,UAAUD,GAAV,oBAIrC,YACGU,OAAS,GAELJ,OAAQP,YAAYY,MACpBJ,MAAMC,QAAQF,UACdI,OAASJ,YAGbM,UAAY,GACZL,MAAMC,QAAQP,UAAUD,GAAGW,OAC3BC,UAAYX,UAAUD,GAAGW,MAGzBC,UAAUC,KAAKZ,UAAUD,GAAGW,WAE3B,IAAIG,EAAI,EAAGA,EAAIF,UAAUV,OAAQY,IAAK,KACnCC,EAAIH,UAAUE,GACD,iBAANC,IACPH,UAAUE,GAAKE,WAAWD,IAGlChB,YAAYD,MAAQY,OAAOD,OAAOG,wBAGjC,SACA,UACA,UACA,YACIb,YAAYD,QACbC,YAAYD,MAAQG,UAAUD,GAAGF,mBAKzCA,KAAKmB,WAAW,OAAkB,OAATnB,KAAe,IAOpCC,YAAYD,QAAUS,MAAMC,QAAQT,YAAYD,OAAQ,CAExDC,YAAYD,MAAQ,CAACC,YAAYD,MAAOG,UAAUD,GAAGF,oBAGrDoB,YAAcnB,YAAYD,MAC1BqB,UAAYlB,UAAUD,GAAGF,SAEzBS,MAAMC,QAAQU,aAAc,CACxBX,MAAMC,QAAQW,WACdD,YAAYL,WAAZK,mFAAoBC,4VAGpBD,YAAYL,KAAKM,qBAK7BpB,YAAYD,MAAQG,UAAUD,GAAGF,qBAGlCC,iBAlHLqB,QAAU,CACZC,MAAO,SACPC,UAAW,QACXC,UAAW,0BAENC,aAAaC,QAASC,cACpBA,MAAMC,uBAKRX,WAAWL,iBAHDiB,IAIXC,SAAW,+xBACDlB,MAAMmB,MAAMV,QAAQG,+DAAY,0CACvBO,MAAMV,QAAQE,cAA5BS,iBAAKC,kBACVD,IAAMA,IAAIE,UAKVD,IAAMA,IAAIC,OACVJ,UAbWD,IAaQG,IAZhBH,IAAIM,QAAQd,QAAQC,MAAOG,gBAYHQ,+DAExBH"} \ No newline at end of file diff --git a/amd/build/cfg-grades.min.js.map b/amd/build/cfg-grades.min.js.map index ddf5160..f166e29 100644 --- a/amd/build/cfg-grades.min.js.map +++ b/amd/build/cfg-grades.min.js.map @@ -1 +1 @@ -{"version":3,"file":"cfg-grades.min.js","sources":["../src/cfg-grades.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {get_string,get_strings} from 'core/str';\nimport {call} from 'core/ajax';\nimport Debugger from './debugger';\n\nimport {load_strings} from './string-helper';\n\nlet debug = new Debugger(\"treestudyplan-config-grades\");\n\n/*\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n*/\n\n/**\n * Initialize grade cfg page\n */\nexport function init() {\n { const\n intRx = /\\d/,\n integerChange = (event) => {\n if ( (event.key.length > 1) || intRx.test(event.key)\n ) { \n return; \n }\n event.preventDefault();\n };\n \n for (let input of document.querySelectorAll( 'input[type=\"number\"][step=\"1\"][min=\"0\"]' )){\n input.addEventListener(\"keydown\", integerChange);\n } \n \n }\n\n { const\n decimal= /^[0-9]*?\\.[0-9]*?$/,\n intRx = /\\d/,\n floatChange = (event) => {\n if ( (event.key.length > 1) || ( (event.key === \".\") && (!event.currentTarget.value.match(decimal)) )\n || intRx.test(event.key)\n ) { \n return; \n }\n event.preventDefault();\n };\n \n for (let input of document.querySelectorAll( 'input[type=\"number\"][min=\"0\"]:not([step])' )){\n input.addEventListener(\"keydown\", floatChange);\n } \n for (let input of document.querySelectorAll( 'input[type=\"text\"].float' )){\n input.addEventListener(\"keydown\", floatChange);\n } \n \n }\n\n\n}\n\n"],"names":["intRx","integerChange","event","key","length","test","preventDefault","document","querySelectorAll","addEventListener","decimal","floatChange","currentTarget","value","match"],"mappings":"kgDA6BQA,MAAQ,KACRC,cAAgB,SAACC,OACTA,MAAMC,IAAIC,OAAS,GAAMJ,MAAMK,KAAKH,MAAMC,MAIhDD,MAAMI,uDAGQC,SAASC,iBAAkB,+FAA4C,aACjFC,iBAAiB,UAAWR,6EAMlCS,QAAS,qBACTV,OAAQ,KACRW,YAAc,SAACT,OACPA,MAAMC,IAAIC,OAAS,GAAuB,MAAdF,MAAMC,MAAkBD,MAAMU,cAAcC,MAAMC,MAAMJ,UACjFV,OAAMK,KAAKH,MAAMC,MAI1BD,MAAMI,wDAGQC,SAASC,iBAAkB,oGAA8C,cACnFC,iBAAiB,UAAWE,mHAElBJ,SAASC,iBAAkB,mFAA6B,cAClEC,iBAAiB,UAAWE,oEA9C9B,yEAAa"} \ No newline at end of file +{"version":3,"file":"cfg-grades.min.js","sources":["../src/cfg-grades.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {get_string,get_strings} from 'core/str';\nimport {call} from 'core/ajax';\nimport Debugger from './debugger';\n\nimport {load_strings} from './string-helper';\n\nlet debug = new Debugger(\"treestudyplan-config-grades\");\n\n/*\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n*/\n\n/**\n * Initialize grade cfg page\n */\nexport function init() {\n { const\n intRx = /\\d/,\n integerChange = (event) => {\n if ( (event.key.length > 1) || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll( 'input[type=\"number\"][step=\"1\"][min=\"0\"]' )){\n input.addEventListener(\"keydown\", integerChange);\n }\n\n }\n\n { const\n decimal= /^[0-9]*?\\.[0-9]*?$/,\n intRx = /\\d/,\n floatChange = (event) => {\n if ( (event.key.length > 1) || ( (event.key === \".\") && (!event.currentTarget.value.match(decimal)) )\n || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll( 'input[type=\"number\"][min=\"0\"]:not([step])' )){\n input.addEventListener(\"keydown\", floatChange);\n }\n for (let input of document.querySelectorAll( 'input[type=\"text\"].float' )){\n input.addEventListener(\"keydown\", floatChange);\n }\n\n }\n\n\n}\n\n"],"names":["intRx","integerChange","event","key","length","test","preventDefault","document","querySelectorAll","addEventListener","decimal","floatChange","currentTarget","value","match"],"mappings":"kgDA6BQA,MAAQ,KACRC,cAAgB,SAACC,OACTA,MAAMC,IAAIC,OAAS,GAAMJ,MAAMK,KAAKH,MAAMC,MAIhDD,MAAMI,uDAGQC,SAASC,iBAAkB,+FAA4C,aACjFC,iBAAiB,UAAWR,6EAMlCS,QAAS,qBACTV,OAAQ,KACRW,YAAc,SAACT,OACPA,MAAMC,IAAIC,OAAS,GAAuB,MAAdF,MAAMC,MAAkBD,MAAMU,cAAcC,MAAMC,MAAMJ,UACjFV,OAAMK,KAAKH,MAAMC,MAI1BD,MAAMI,wDAGQC,SAASC,iBAAkB,oGAA8C,cACnFC,iBAAiB,UAAWE,mHAElBJ,SAASC,iBAAkB,mFAA6B,cAClEC,iBAAiB,UAAWE,oEA9C9B,yEAAa"} \ No newline at end of file diff --git a/amd/build/modedit-modal.min.js b/amd/build/modedit-modal.min.js index 11e4f5e..c26f0ed 100644 --- a/amd/build/modedit-modal.min.js +++ b/amd/build/modedit-modal.min.js @@ -1,3 +1,3 @@ -define("local_treestudyplan/modedit-modal",["exports","core/fragment","./util/string-helper","core/ajax","core/notification","core/templates"],(function(_exports,_fragment,_stringHelper,_ajax,_notification,_templates){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var _default={install:function(Vue){var strings=(0,_stringHelper.load_strings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("s-edit-mod",{props:{cmid:{type:Number},coursectxid:{type:Number},title:{type:String,default:""},genericonly:{type:Boolean,default:!1}},data:function(){return{content:"",text:strings.editmod}},computed:{},methods:{openForm:function(){this.$refs.editormodal.show()},onShown:function(){var self=this,params={cmid:this.cmid};console.info("Loading form"),(0,_fragment.loadFragment)("local_treestudyplan","mod_edit_form",this.coursectxid,params).then((function(html,js){(0,_templates.replaceNodeContents)(self.$refs.content,html,js)})).catch(_notification.default.exception)},onSave:function(){var self=this,form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));var formdata=new FormData(form),data=new URLSearchParams(formdata).toString();(0,_ajax.call)([{methodname:"local_treestudyplan_submit_cm_editform",args:{cmid:this.cmid,formdata:data}}])[0].done((function(){self.$emit("saved",formdata)})).fail(_notification.default.exception)}},template:'\n \n
\n \n '})}};return _exports.default=_default,_exports.default})); +define("local_treestudyplan/modedit-modal",["exports","core/fragment","./util/string-helper","core/ajax","core/notification","core/templates"],(function(_exports,_fragment,_stringHelper,_ajax,_notification,_templates){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var _default={install:function(Vue){var strings=(0,_stringHelper.load_strings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("s-edit-mod",{props:{cmid:{type:Number},coursectxid:{type:Number},title:{type:String,default:""},genericonly:{type:Boolean,default:!1}},data:function(){return{content:"",text:strings.editmod}},computed:{},methods:{openForm:function(){this.$refs.editormodal.show()},onShown:function(){var self=this,params={cmid:this.cmid};console.info("Loading form"),(0,_fragment.loadFragment)("local_treestudyplan","mod_edit_form",this.coursectxid,params).then((function(html,js){(0,_templates.replaceNodeContents)(self.$refs.content,html,js)})).catch(_notification.default.exception)},onSave:function(){var self=this,form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));var formdata=new FormData(form),data=new URLSearchParams(formdata).toString();(0,_ajax.call)([{methodname:"local_treestudyplan_submit_cm_editform",args:{cmid:this.cmid,formdata:data}}])[0].done((function(){self.$emit("saved",formdata)})).fail(_notification.default.exception)}},template:'\n \n
\n \n '})}};return _exports.default=_default,_exports.default})); //# sourceMappingURL=modedit-modal.min.js.map \ No newline at end of file diff --git a/amd/build/modedit-modal.min.js.map b/amd/build/modedit-modal.min.js.map index 76db4ce..8d0db07 100644 --- a/amd/build/modedit-modal.min.js.map +++ b/amd/build/modedit-modal.min.js.map @@ -1 +1 @@ -{"version":3,"file":"modedit-modal.min.js","sources":["../src/modedit-modal.js"],"sourcesContent":["/*eslint no-var: \"error\"*/\n/*eslint no-console: \"off\"*/\n/*eslint-disable no-trailing-spaces */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n\nimport {loadFragment} from 'core/fragment';\nimport {load_strings} from './util/string-helper';\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\nimport {replaceNodeContents} from 'core/templates';\n//import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only\n//import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only\n\nexport default {\n install(Vue/*,options*/){\n\n let strings = load_strings({\n editmod: {\n save$core: \"save$core\",\n cancel$core: \"cancel$core\",\n }\n });\n\n Vue.component('s-edit-mod', {\n props: {\n cmid: {\n type: Number,\n },\n coursectxid:{\n type: Number,\n },\n title: {\n type: String,\n default: \"\",\n },\n genericonly: {\n type: Boolean,\n default: false,\n }\n },\n data() {\n return {\n content: \"\",\n text: strings.editmod,\n };\n },\n computed: {\n },\n methods: {\n openForm(){\n const self = this;\n self.$refs[\"editormodal\"].show();\n },\n onShown(){\n const self = this;\n let params = {cmid: this.cmid};\n console.info(\"Loading form\");\n loadFragment('local_treestudyplan', 'mod_edit_form', this.coursectxid, params).then((html,js) =>{\n replaceNodeContents(self.$refs[\"content\"], html, js);\n }).catch(notification.exception);\n \n },\n onSave(){\n const self = this;\n let form = this.$refs[\"content\"].getElementsByTagName(\"form\")[0];\n \n // markFormSubmitted(form); // Moodle 4.00+ only\n // We call this, so other modules can update the form with the latest state.\n form.dispatchEvent(new Event(\"save-form-state\"));\n // Tell all form fields we are about to submit the form.\n // notifyFormSubmittedByJavascript(form); // Moodle 4.00+ only\n\n const formdata = new FormData(form);\n const data =new URLSearchParams(formdata).toString();\n //const formdata = new FormData(form);\n //const data = {};\n //formdata.forEach((value, key) => (data[key] = value));\n\n call([{\n methodname: 'local_treestudyplan_submit_cm_editform',\n args: {cmid: this.cmid, formdata: data}\n }])[0].done(()=>{\n self.$emit(\"saved\",formdata);\n }).fail(notification.exception);\n\n }\n },\n template: `\n \n
\n \n `,\n });\n }\n};\n\n"],"names":["install","Vue","strings","editmod","save$core","cancel$core","component","props","cmid","type","Number","coursectxid","title","String","default","genericonly","Boolean","data","content","text","computed","methods","openForm","this","$refs","show","onShown","self","params","console","info","then","html","js","catch","notification","exception","onSave","form","getElementsByTagName","dispatchEvent","Event","formdata","FormData","URLSearchParams","toString","methodname","args","done","$emit","fail","template"],"mappings":"mYAce,CACXA,iBAAQC,SAEAC,SAAU,8BAAa,CACvBC,QAAS,CACLC,UAAW,YACXC,YAAa,iBAIrBJ,IAAIK,UAAU,aAAc,CACxBC,MAAO,CACHC,KAAM,CACFC,KAAMC,QAEVC,YAAY,CACRF,KAAMC,QAEVE,MAAO,CACHH,KAAMI,OACNC,QAAS,IAEbC,YAAa,CACTN,KAAMO,QACNF,SAAS,IAGjBG,sBACW,CACHC,QAAS,GACTC,KAAMjB,QAAQC,UAGtBiB,SAAU,GAEVC,QAAS,CACLC,oBACiBC,KACRC,MAAL,YAA0BC,QAE9BC,uBACUC,KAAOJ,KACTK,OAAS,CAACpB,KAAMe,KAAKf,MACzBqB,QAAQC,KAAK,2CACA,sBAAuB,gBAAiBP,KAAKZ,YAAaiB,QAAQG,MAAK,SAACC,KAAKC,uCAClEN,KAAKH,MAAL,QAAuBQ,KAAMC,OAClDC,MAAMC,sBAAaC,YAG1BC,sBACUV,KAAOJ,KACTe,KAAOf,KAAKC,MAAL,QAAsBe,qBAAqB,QAAQ,GAI9DD,KAAKE,cAAc,IAAIC,MAAM,wBAIvBC,SAAW,IAAIC,SAASL,MACxBrB,KAAM,IAAI2B,gBAAgBF,UAAUG,0BAKrC,CAAC,CACFC,WAAY,yCACZC,KAAM,CAACvC,KAAMe,KAAKf,KAAMkC,SAAUzB,SAClC,GAAG+B,MAAK,WACRrB,KAAKsB,MAAM,QAAQP,aACpBQ,KAAKf,sBAAaC,aAI7Be"} \ No newline at end of file +{"version":3,"file":"modedit-modal.min.js","sources":["../src/modedit-modal.js"],"sourcesContent":["/*eslint no-var: \"error\"*/\n/*eslint no-console: \"off\"*/\n/*eslint-disable no-trailing-spaces */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n\nimport {loadFragment} from 'core/fragment';\nimport {load_strings} from './util/string-helper';\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\nimport {replaceNodeContents} from 'core/templates';\n//import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only\n//import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only\n\nexport default {\n install(Vue/*,options*/){\n\n let strings = load_strings({\n editmod: {\n save$core: \"save$core\",\n cancel$core: \"cancel$core\",\n }\n });\n\n Vue.component('s-edit-mod', {\n props: {\n cmid: {\n type: Number,\n },\n coursectxid:{\n type: Number,\n },\n title: {\n type: String,\n default: \"\",\n },\n genericonly: {\n type: Boolean,\n default: false,\n }\n },\n data() {\n return {\n content: \"\",\n text: strings.editmod,\n };\n },\n computed: {\n },\n methods: {\n openForm(){\n const self = this;\n self.$refs[\"editormodal\"].show();\n },\n onShown(){\n const self = this;\n let params = {cmid: this.cmid};\n console.info(\"Loading form\");\n loadFragment('local_treestudyplan', 'mod_edit_form', this.coursectxid, params).then((html,js) =>{\n replaceNodeContents(self.$refs[\"content\"], html, js);\n }).catch(notification.exception);\n\n },\n onSave(){\n const self = this;\n let form = this.$refs[\"content\"].getElementsByTagName(\"form\")[0];\n\n // markFormSubmitted(form); // Moodle 4.00+ only\n // We call this, so other modules can update the form with the latest state.\n form.dispatchEvent(new Event(\"save-form-state\"));\n // Tell all form fields we are about to submit the form.\n // notifyFormSubmittedByJavascript(form); // Moodle 4.00+ only\n\n const formdata = new FormData(form);\n const data =new URLSearchParams(formdata).toString();\n //const formdata = new FormData(form);\n //const data = {};\n //formdata.forEach((value, key) => (data[key] = value));\n\n call([{\n methodname: 'local_treestudyplan_submit_cm_editform',\n args: {cmid: this.cmid, formdata: data}\n }])[0].done(()=>{\n self.$emit(\"saved\",formdata);\n }).fail(notification.exception);\n\n }\n },\n template: `\n \n
\n \n `,\n });\n }\n};\n\n"],"names":["install","Vue","strings","editmod","save$core","cancel$core","component","props","cmid","type","Number","coursectxid","title","String","default","genericonly","Boolean","data","content","text","computed","methods","openForm","this","$refs","show","onShown","self","params","console","info","then","html","js","catch","notification","exception","onSave","form","getElementsByTagName","dispatchEvent","Event","formdata","FormData","URLSearchParams","toString","methodname","args","done","$emit","fail","template"],"mappings":"mYAce,CACXA,iBAAQC,SAEAC,SAAU,8BAAa,CACvBC,QAAS,CACLC,UAAW,YACXC,YAAa,iBAIrBJ,IAAIK,UAAU,aAAc,CACxBC,MAAO,CACHC,KAAM,CACFC,KAAMC,QAEVC,YAAY,CACRF,KAAMC,QAEVE,MAAO,CACHH,KAAMI,OACNC,QAAS,IAEbC,YAAa,CACTN,KAAMO,QACNF,SAAS,IAGjBG,sBACW,CACHC,QAAS,GACTC,KAAMjB,QAAQC,UAGtBiB,SAAU,GAEVC,QAAS,CACLC,oBACiBC,KACRC,MAAL,YAA0BC,QAE9BC,uBACUC,KAAOJ,KACTK,OAAS,CAACpB,KAAMe,KAAKf,MACzBqB,QAAQC,KAAK,2CACA,sBAAuB,gBAAiBP,KAAKZ,YAAaiB,QAAQG,MAAK,SAACC,KAAKC,uCAClEN,KAAKH,MAAL,QAAuBQ,KAAMC,OAClDC,MAAMC,sBAAaC,YAG1BC,sBACUV,KAAOJ,KACTe,KAAOf,KAAKC,MAAL,QAAsBe,qBAAqB,QAAQ,GAI9DD,KAAKE,cAAc,IAAIC,MAAM,wBAIvBC,SAAW,IAAIC,SAASL,MACxBrB,KAAM,IAAI2B,gBAAgBF,UAAUG,0BAKrC,CAAC,CACFC,WAAY,yCACZC,KAAM,CAACvC,KAAMe,KAAKf,KAAMkC,SAAUzB,SAClC,GAAG+B,MAAK,WACRrB,KAAKsB,MAAM,QAAQP,aACpBQ,KAAKf,sBAAaC,aAI7Be"} \ No newline at end of file diff --git a/amd/build/page-edit-plan.min.js.map b/amd/build/page-edit-plan.min.js.map index 763f2f9..13ea635 100644 --- a/amd/build/page-edit-plan.min.js.map +++ b/amd/build/page-edit-plan.min.js.map @@ -1 +1 @@ -{"version":3,"file":"page-edit-plan.min.js","sources":["../src/page-edit-plan.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {get_string,get_strings} from 'core/str';\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\n\nimport EditorComponents from './studyplan-editor-components';\nVue.use(EditorComponents);\n\nimport TSComponents from './treestudyplan-components';\nVue.use(TSComponents);\n\nimport ModalComponents from './modedit-modal';\nVue.use(ModalComponents);\nimport Debugger from './util/debugger';\n\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\nimport {download,upload} from './downloader';\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\nimport {Drag, Drop, DropList} from './vue-easy-dnd/vue-easy-dnd.esm';\nVue.component('drag',Drag);\nVue.component('drop',Drop);\nVue.component('drop-list',DropList);\n\nconst debug = new Debugger(\"treestudyplan\");\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid,categoryid) {\n // Make sure the id's are numeric and integer\n if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;} \n else { contextid = Number(contextid);} // ensure a numeric value instead of string\n if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}\n else { categoryid = Number(categoryid);} // ensure a numeric value instead of string\n\n const in_systemcontext = (contextid <= 1);\n\n // Setup the initial Vue app for this page\n let app = new Vue({\n el: '#root',\n data: {\n create: {\n studyplan: {\n name: '',\n shortname: '',\n description: '',\n idnumber: '',\n slots : 4,\n startdate: '2020-08-01',\n enddate: '',\n context: contextid,\n aggregation: 'bistate',\n aggregation_config: '',\n }\n },\n toolbox: {\n shown: false,\n right: true,\n },\n activestudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n frameworks: [],\n badges: [],\n courses: [],\n text: strings.studyplan,\n usedcontexts: [],\n },\n created() {\n this.$root.$on('studyplanRemoved',(studyplan)=>{\n \n if(app.activestudyplan == studyplan){\n app.activestudyplan = null;\n }\n\n // remove studyplan from index list\n let index = null;\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == studyplan.id){\n index = idx;\n break;\n }\n }\n if(index){\n app.studyplans.splice(index, 1);\n }\n\n });\n },\n mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: { context_id: contextid}\n }])[0].done(function(response){\n const timingval = { future: 0, present: 1, past: 2, };\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n let t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by start date if timing is equal\n t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();\n \n if (t == 0) {\n // sort by name if timing is equal\n t = a.name.localeCompare(b.name);\n }\n }\n return t;\n }); \n app.studyplans = response;\n\n // load studyplan from hash if applicable\n const hash = location.hash.replace('#','');\n if(hash){\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == hash){\n app.selectStudyplan(app.studyplans[idx]);\n break;\n }\n }\n }\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_badges',\n args: {}\n }])[0].done(function(response){\n app.badges = response;\n }).fail(notification.exception); \n call([{\n methodname: 'local_treestudyplan_map_categories',\n args: {root_id: categoryid}\n }])[0].done(function(response){\n app.courses = response;\n }).fail(notification.exception); \n call([{\n methodname: 'local_treestudyplan_list_used_categories',\n args: { operation: 'edit'}\n }])[0].done(function(response){\n app.usedcontexts = response;\n }).fail(notification.exception); \n\n },\n computed: {\n dropdown_title(){\n if(this.activestudyplan && this.activestudyplan.name){\n return this.activestudyplan.name;\n }\n else{\n return this.text.studyplan_select_placeholder;\n }\n },\n contextid(){\n return contextid;\n },\n filterComponentType(){\n return {\n item: false,\n component: true,\n span: 1,\n type: 'filter',\n };\n },\n },\n methods: {\n closeStudyplan() {\n app.activestudyplan = null;\n window.location.hash = '';\n }, \n movedStudyplan(plan,from,to) {\n // reload the page in the new context (needed, since a number of links are not reactive in the page)\n const params = new URLSearchParams(location.search);\n params.delete('categoryid');\n params.set(\"contextid\", to);\n window.location.search = params.toString();\n },\n onStudyPlanCreated(newstudyplan){\n app.studyplans.push(newstudyplan);\n app.selectStudyplan(newstudyplan);\n\n },\n switchContext(ctx){\n const params = new URLSearchParams(location.search);\n params.set('categoryid', ctx.id);\n window.location.search = params.toString();\n \n },\n selectStudyplan(studyplan){\n // fetch studyplan\n app.loadingstudyplan = true;\n app.activestudyplan = null;\n call([{\n methodname: 'local_treestudyplan_get_studyplan_map',\n args: { id: studyplan.id}\n }])[0].done(function(response){\n app.activestudyplan = ProcessStudyplan(response,true);\n debug.info('studyplan processed');\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id;\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n },\n import_studyplan(){\n upload((filename,content)=>{\n call([{\n methodname: 'local_treestudyplan_import_plan',\n args: {\n content: content,\n format: \"application/json\",\n context_id: contextid,\n },\n }])[0].done(function(response){\n if(response.success){\n location.reload();\n } else {\n debug.error(\"Import failed: \",response.msg);\n }\n \n }).fail(notification.exception); \n }, \"application/json\");\n },\n export_plan(plan,format){\n let self = this;\n if(format == undefined || ![\"json\",\"csv\"].includes(format)){\n format = \"json\";\n }\n call([{\n methodname: 'local_treestudyplan_export_plan',\n args: {\n studyplan_id: plan.id,\n format: format\n },\n }])[0].done(function(response){\n \n download(plan.shortname+\".json\",response.content,response.format);\n }).fail(notification.exception); \n },\n toggletoolbox(event) {\n debug.info(event);\n this.toolbox.shown = event;\n }\n },\n });\n}\n\n"],"names":["contextid","categoryid","undefined","Number","isInteger","app","Vue","el","data","create","studyplan","name","shortname","description","idnumber","slots","startdate","enddate","context","aggregation","aggregation_config","toolbox","shown","right","activestudyplan","loadingstudyplan","studyplans","frameworks","badges","courses","text","strings","usedcontexts","created","$root","$on","index","idx","id","splice","mounted","methodname","args","context_id","done","response","timingval","future","present","past","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","Date","getTime","localeCompare","hash","location","replace","selectStudyplan","fail","notification","exception","root_id","operation","computed","dropdown_title","this","studyplan_select_placeholder","filterComponentType","item","component","span","type","methods","closeStudyplan","window","movedStudyplan","plan","from","to","params","URLSearchParams","search","delete","set","toString","onStudyPlanCreated","newstudyplan","push","switchContext","ctx","debug","info","error","import_studyplan","filename","content","format","success","reload","msg","export_plan","includes","studyplan_id","toggletoolbox","event","use","EditorComponents","ModalComponents","PortalVue","BootstrapVue","Drag","Drop","DropList","Debugger"],"mappings":"guBAoDqBA,WAAUC,YAE4DD,gBAApFE,IAAcF,aAAcG,OAAOC,UAAUD,OAAOH,cAAeA,WAAY,EAAiB,EAChFG,OAAOH,YAEnBC,gBADJC,IAAcD,YAAeE,OAAOC,UAAUD,OAAOF,aACpCE,OAAOF,YADyD,MAMhFI,IAAM,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,CACFC,OAAQ,CACJC,UAAW,CACPC,KAAM,GACNC,UAAW,GACXC,YAAa,GACbC,SAAU,GACVC,MAAQ,EACRC,UAAW,aACXC,QAAS,GACTC,QAASlB,WACTmB,YAAa,UACbC,mBAAoB,KAG5BC,QAAS,CACLC,OAAO,EACPC,OAAO,GAEXC,gBAAiB,KACjBC,kBAAkB,EAClBC,WAAY,GACZC,WAAY,GACZC,OAAQ,GACRC,QAAS,GACTC,KAAMC,QAAQrB,UACdsB,aAAc,IAElBC,wBACSC,MAAMC,IAAI,oBAAmB,SAACzB,WAE5BL,IAAImB,iBAAmBd,YACtBL,IAAImB,gBAAkB,UAItBY,MAAQ,SACR,IAAIC,OAAOhC,IAAIqB,cACZrB,IAAIqB,WAAWW,KAAKC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M,CACFmE,aAAc1B,KAAK7C,GACnBiE,OAAQA,WAEZ,GAAG3D,MAAK,SAASC,mCAERsC,KAAKvE,UAAU,QAAQiC,SAASyD,QAAQzD,SAAS0D,WAC3DtC,KAAKC,sBAAaC,YAE7B2C,uBAAcC,OACVd,MAAMC,KAAKa,YACN1F,QAAQC,MAAQyF,wcA1PjCC,IAAIC,iDAGJD,IAAI1D,+CAGJ0D,IAAIE,oCAQJF,IAAIG,iCAEJH,IAAII,oCAGJxC,UAAU,OAAOyC,+BACjBzC,UAAU,OAAO0C,+BACjB1C,UAAU,YAAY2C,0BAEpBtB,MAAQ,IAAIuB,kBAAS,iBAEvBzF,SAAU,8BAAa,CACvBrB,UAAW,CACP+D,6BAA8B"} \ No newline at end of file +{"version":3,"file":"page-edit-plan.min.js","sources":["../src/page-edit-plan.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {get_string,get_strings} from 'core/str';\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\n\nimport EditorComponents from './studyplan-editor-components';\nVue.use(EditorComponents);\n\nimport TSComponents from './treestudyplan-components';\nVue.use(TSComponents);\n\nimport ModalComponents from './modedit-modal';\nVue.use(ModalComponents);\nimport Debugger from './util/debugger';\n\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\nimport {download,upload} from './downloader';\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\nimport {Drag, Drop, DropList} from './vue-easy-dnd/vue-easy-dnd.esm';\nVue.component('drag',Drag);\nVue.component('drop',Drop);\nVue.component('drop-list',DropList);\n\nconst debug = new Debugger(\"treestudyplan\");\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid,categoryid) {\n // Make sure the id's are numeric and integer\n if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;}\n else { contextid = Number(contextid);} // ensure a numeric value instead of string\n if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}\n else { categoryid = Number(categoryid);} // ensure a numeric value instead of string\n\n const in_systemcontext = (contextid <= 1);\n\n // Setup the initial Vue app for this page\n let app = new Vue({\n el: '#root',\n data: {\n create: {\n studyplan: {\n name: '',\n shortname: '',\n description: '',\n idnumber: '',\n slots : 4,\n startdate: '2020-08-01',\n enddate: '',\n context: contextid,\n aggregation: 'bistate',\n aggregation_config: '',\n }\n },\n toolbox: {\n shown: false,\n right: true,\n },\n activestudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n frameworks: [],\n badges: [],\n courses: [],\n text: strings.studyplan,\n usedcontexts: [],\n },\n created() {\n this.$root.$on('studyplanRemoved',(studyplan)=>{\n\n if(app.activestudyplan == studyplan){\n app.activestudyplan = null;\n }\n\n // remove studyplan from index list\n let index = null;\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == studyplan.id){\n index = idx;\n break;\n }\n }\n if(index){\n app.studyplans.splice(index, 1);\n }\n\n });\n },\n mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: { context_id: contextid}\n }])[0].done(function(response){\n const timingval = { future: 0, present: 1, past: 2, };\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n let t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by start date if timing is equal\n t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();\n\n if (t == 0) {\n // sort by name if timing is equal\n t = a.name.localeCompare(b.name);\n }\n }\n return t;\n });\n app.studyplans = response;\n\n // load studyplan from hash if applicable\n const hash = location.hash.replace('#','');\n if(hash){\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == hash){\n app.selectStudyplan(app.studyplans[idx]);\n break;\n }\n }\n }\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_badges',\n args: {}\n }])[0].done(function(response){\n app.badges = response;\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_map_categories',\n args: {root_id: categoryid}\n }])[0].done(function(response){\n app.courses = response;\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_used_categories',\n args: { operation: 'edit'}\n }])[0].done(function(response){\n app.usedcontexts = response;\n }).fail(notification.exception);\n\n },\n computed: {\n dropdown_title(){\n if(this.activestudyplan && this.activestudyplan.name){\n return this.activestudyplan.name;\n }\n else{\n return this.text.studyplan_select_placeholder;\n }\n },\n contextid(){\n return contextid;\n },\n filterComponentType(){\n return {\n item: false,\n component: true,\n span: 1,\n type: 'filter',\n };\n },\n },\n methods: {\n closeStudyplan() {\n app.activestudyplan = null;\n window.location.hash = '';\n },\n movedStudyplan(plan,from,to) {\n // reload the page in the new context (needed, since a number of links are not reactive in the page)\n const params = new URLSearchParams(location.search);\n params.delete('categoryid');\n params.set(\"contextid\", to);\n window.location.search = params.toString();\n },\n onStudyPlanCreated(newstudyplan){\n app.studyplans.push(newstudyplan);\n app.selectStudyplan(newstudyplan);\n\n },\n switchContext(ctx){\n const params = new URLSearchParams(location.search);\n params.set('categoryid', ctx.id);\n window.location.search = params.toString();\n\n },\n selectStudyplan(studyplan){\n // fetch studyplan\n app.loadingstudyplan = true;\n app.activestudyplan = null;\n call([{\n methodname: 'local_treestudyplan_get_studyplan_map',\n args: { id: studyplan.id}\n }])[0].done(function(response){\n app.activestudyplan = ProcessStudyplan(response,true);\n debug.info('studyplan processed');\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id;\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n },\n import_studyplan(){\n upload((filename,content)=>{\n call([{\n methodname: 'local_treestudyplan_import_plan',\n args: {\n content: content,\n format: \"application/json\",\n context_id: contextid,\n },\n }])[0].done(function(response){\n if(response.success){\n location.reload();\n } else {\n debug.error(\"Import failed: \",response.msg);\n }\n\n }).fail(notification.exception);\n }, \"application/json\");\n },\n export_plan(plan,format){\n let self = this;\n if(format == undefined || ![\"json\",\"csv\"].includes(format)){\n format = \"json\";\n }\n call([{\n methodname: 'local_treestudyplan_export_plan',\n args: {\n studyplan_id: plan.id,\n format: format\n },\n }])[0].done(function(response){\n\n download(plan.shortname+\".json\",response.content,response.format);\n }).fail(notification.exception);\n },\n toggletoolbox(event) {\n debug.info(event);\n this.toolbox.shown = event;\n }\n },\n });\n}\n\n"],"names":["contextid","categoryid","undefined","Number","isInteger","app","Vue","el","data","create","studyplan","name","shortname","description","idnumber","slots","startdate","enddate","context","aggregation","aggregation_config","toolbox","shown","right","activestudyplan","loadingstudyplan","studyplans","frameworks","badges","courses","text","strings","usedcontexts","created","$root","$on","index","idx","id","splice","mounted","methodname","args","context_id","done","response","timingval","future","present","past","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","Date","getTime","localeCompare","hash","location","replace","selectStudyplan","fail","notification","exception","root_id","operation","computed","dropdown_title","this","studyplan_select_placeholder","filterComponentType","item","component","span","type","methods","closeStudyplan","window","movedStudyplan","plan","from","to","params","URLSearchParams","search","delete","set","toString","onStudyPlanCreated","newstudyplan","push","switchContext","ctx","debug","info","error","import_studyplan","filename","content","format","success","reload","msg","export_plan","includes","studyplan_id","toggletoolbox","event","use","EditorComponents","ModalComponents","PortalVue","BootstrapVue","Drag","Drop","DropList","Debugger"],"mappings":"guBAoDqBA,WAAUC,YAE4DD,gBAApFE,IAAcF,aAAcG,OAAOC,UAAUD,OAAOH,cAAeA,WAAY,EAAiB,EAChFG,OAAOH,YAEnBC,gBADJC,IAAcD,YAAeE,O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UACjBxC,IAAImB,iBAAkB,wCAAiBqB,UAAS,GAChDoD,MAAMC,KAAK,uBACX7F,IAAIoB,kBAAmB,EACvBwD,OAAOnB,SAASD,KAAOxD,IAAImB,gBAAgBc,MAC5C2B,MAAK,SAASkC,6BACAhC,UAAUgC,OACvB9F,IAAIoB,kBAAmB,MAG/B2E,oDACW,SAACC,SAASC,wBACR,CAAC,CACF7D,WAAY,kCACZC,KAAM,CACF4D,QAASA,QACTC,OAAQ,mBACR5D,WAAY3C,eAEhB,GAAG4C,MAAK,SAASC,UACdA,SAAS2D,QACR1C,SAAS2C,SAETR,MAAME,MAAM,kBAAkBtD,SAAS6D,QAG5CzC,KAAKC,sBAAaC,aACtB,qBAEPwC,qBAAYxB,KAAKoB,QAEArG,MAAVqG,QAAwB,CAAC,OAAO,OAAOK,SAASL,UAC/CA,OAAS,uBAER,CAAC,CACE9D,WAAY,kCACZC,KAAM,CACFmE,aAAc1B,KAAK7C,GACnBiE,OAAQA,WAEZ,GAAG3D,MAAK,SAASC,mCAERsC,KAAKvE,UAAU,QAAQiC,SAASyD,QAAQzD,SAAS0D,WAC3DtC,KAAKC,sBAAaC,YAE7B2C,uBAAcC,OACVd,MAAMC,KAAKa,YACN1F,QAAQC,MAAQyF,wcA1PjCC,IAAIC,iDAGJD,IAAI1D,+CAGJ0D,IAAIE,oCAQJF,IAAIG,iCAEJH,IAAII,oCAGJxC,UAAU,OAAOyC,+BACjBzC,UAAU,OAAO0C,+BACjB1C,UAAU,YAAY2C,0BAEpBtB,MAAQ,IAAIuB,kBAAS,iBAEvBzF,SAAU,8BAAa,CACvBrB,UAAW,CACP+D,6BAA8B"} \ No newline at end of file diff --git a/amd/build/page-myreport.min.js.map b/amd/build/page-myreport.min.js.map index 32219d3..a2cb98a 100644 --- a/amd/build/page-myreport.min.js.map +++ b/amd/build/page-myreport.min.js.map @@ -1 +1 @@ -{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint no-console: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\nimport TSComponents from './treestudyplan-components';\n\nimport Debugger from './util/debugger';\n\nimport {ProcessStudyplans} from './studyplan-processor';\n\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\nlet debug = new Debugger(\"treestudyplan-report\");\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} arg Arguments passed\n */\n export function init(type=\"myreport\",arg) {\n let app = new Vue({\n el: '#root',\n data: {\n \"studyplans\": [],\n },\n mounted() {\n let call_method;\n let call_args;\n if(type == \"invited\"){\n call_method = 'local_treestudyplan_get_invited_studyplan';\n call_args = {\"invitekey\": arg};\n }\n else if(type == \"other\"){\n call_method = 'local_treestudyplan_get_user_studyplans';\n call_args = {\"userid\": arg};\n }\n else if(type == \"teaching\"){\n call_method = 'local_treestudyplan_get_teaching_studyplans';\n call_args = {};\n }\n else{\n call_method = 'local_treestudyplan_get_own_studyplan';\n call_args = {};\n }\n call([{\n methodname: call_method,\n args: call_args\n }])[0].done(function(response){\n debug.info(\"Studyplans:\",response);\n const timingval = { future: 0, present: 1, past: 2, };\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n let t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by start date if timing is equal\n t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();\n \n if (t == 0) {\n // sort by name if timing is equal\n t = a.name.localeCompare(b.name);\n }\n }\n return t;\n });\n app.studyplans = ProcessStudyplans(response);\n }).fail(notification.exception); \n \n },\n\n methods: {\n \n },\n });\n\n}\n\n"],"names":["type","arg","app","Vue","el","data","mounted","call_method","call_args","methodname","args","done","response","debug","info","timingval","future","present","past","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","Date","startdate","getTime","name","localeCompare","studyplans","fail","notification","exception","methods","use","RVComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"ikBAmCsBA,4DAAK,WAAWC,2CAC9BC,IAAM,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,YACY,IAElBC,uBACQC,YACAC,UACO,WAARR,MACCO,YAAc,4CACdC,UAAY,WAAcP,MAEd,SAARD,MACJO,YAAc,0CACdC,UAAY,QAAWP,MAEX,YAARD,MACJO,YAAc,8CACdC,UAAY,KAGZD,YAAc,wCACdC,UAAY,mBAEX,CAAC,CACFC,WAAYF,YACZG,KAAMF,aACN,GAAGG,MAAK,SAASC,UACjBC,MAAMC,KAAK,cAAcF,cACnBG,UAAY,CAAEC,OAAQ,EAAGC,QAAS,EAAGC,KAAM,GACjDN,SAASO,MAAK,SAACC,EAAEC,OACPC,QAAUC,iCAAaC,gBAAgBJ,GACvCK,QAAUF,iCAAaC,gBAAgBH,GAEzCK,EAAIX,UAAUO,SAAWP,UAAUU,gBAC/B,GAALC,GAIU,IAFTA,EAAI,IAAIC,KAAKN,EAAEO,WAAWC,UAAY,IAAIF,KAAKP,EAAEQ,WAAWC,aAIxDH,EAAIN,EAAEU,KAAKC,cAAcV,EAAES,OAG5BJ,KAEXxB,IAAI8B,YAAa,yCAAkBpB,aACpCqB,KAAKC,sBAAaC,YAIzBC,QAAS,yYAxEbC,IAAIC,8CASJD,IAAIE,iCAEJF,IAAIG,2BAEJ3B,MAAQ,IAAI4B,kBAAS"} \ No newline at end of file +{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint no-console: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\nimport TSComponents from './treestudyplan-components';\n\nimport Debugger from './util/debugger';\n\nimport {ProcessStudyplans} from './studyplan-processor';\n\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\nlet debug = new Debugger(\"treestudyplan-report\");\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} arg Arguments passed\n */\n export function init(type=\"myreport\",arg) {\n let app = new Vue({\n el: '#root',\n data: {\n \"studyplans\": [],\n },\n mounted() {\n let call_method;\n let call_args;\n if(type == \"invited\"){\n call_method = 'local_treestudyplan_get_invited_studyplan';\n call_args = {\"invitekey\": arg};\n }\n else if(type == \"other\"){\n call_method = 'local_treestudyplan_get_user_studyplans';\n call_args = {\"userid\": arg};\n }\n else if(type == \"teaching\"){\n call_method = 'local_treestudyplan_get_teaching_studyplans';\n call_args = {};\n }\n else{\n call_method = 'local_treestudyplan_get_own_studyplan';\n call_args = {};\n }\n call([{\n methodname: call_method,\n args: call_args\n }])[0].done(function(response){\n debug.info(\"Studyplans:\",response);\n const timingval = { future: 0, present: 1, past: 2, };\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n let t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by start date if timing is equal\n t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();\n\n if (t == 0) {\n // sort by name if timing is equal\n t = a.name.localeCompare(b.name);\n }\n }\n return t;\n });\n app.studyplans = ProcessStudyplans(response);\n }).fail(notification.exception);\n\n },\n\n methods: {\n\n },\n });\n\n}\n\n"],"names":["type","arg","app","Vue","el","data","mounted","call_method","call_args","methodname","args","done","response","debug","info","timingval","future","present","past","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","Date","startdate","getTime","name","localeCompare","studyplans","fail","notification","exception","methods","use","RVComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"ikBAmCsBA,4DAAK,WAAWC,2CAC9BC,IAAM,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,YACY,IAElBC,uBACQC,YACAC,UACO,WAARR,MACCO,YAAc,4CACdC,UAAY,WAAcP,MAEd,SAARD,MACJO,YAAc,0CACdC,UAAY,QAAWP,MAEX,YAARD,MACJO,YAAc,8CACdC,UAAY,KAGZD,YAAc,wCACdC,UAAY,mBAEX,CAAC,CACFC,WAAYF,YACZG,KAAMF,aACN,GAAGG,MAAK,SAASC,UACjBC,MAAMC,KAAK,cAAcF,cACnBG,UAAY,CAAEC,OAAQ,EAAGC,QAAS,EAAGC,KAAM,GACjDN,SAASO,MAAK,SAACC,EAAEC,OACPC,QAAUC,iCAAaC,gBAAgBJ,GACvCK,QAAUF,iCAAaC,gBAAgBH,GAEzCK,EAAIX,UAAUO,SAAWP,UAAUU,gBAC/B,GAALC,GAIU,IAFTA,EAAI,IAAIC,KAAKN,EAAEO,WAAWC,UAAY,IAAIF,KAAKP,EAAEQ,WAAWC,aAIxDH,EAAIN,EAAEU,KAAKC,cAAcV,EAAES,OAG5BJ,KAEXxB,IAAI8B,YAAa,yCAAkBpB,aACpCqB,KAAKC,sBAAaC,YAIzBC,QAAS,yYAxEbC,IAAIC,8CASJD,IAAIE,iCAEJF,IAAIG,2BAEJ3B,MAAQ,IAAI4B,kBAAS"} \ No newline at end of file diff --git a/amd/build/page-view-plan.min.js.map b/amd/build/page-view-plan.min.js.map index 2a98142..2be4701 100644 --- a/amd/build/page-view-plan.min.js.map +++ b/amd/build/page-view-plan.min.js.map @@ -1 +1 @@ -{"version":3,"file":"page-view-plan.min.js","sources":["../src/page-view-plan.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\nimport Debugger from './util/debugger';\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\nimport TSComponents from './treestudyplan-components';\nimport ModalComponents from './modedit-modal';\nVue.use(ModalComponents);\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\n\nlet debug = new Debugger(\"treestudyplanviewer\");\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid,categoryid) {\n // Make sure the id's are numeric and integer\n if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;} \n else { contextid = Number(contextid);} // ensure a numeric value instead of string\n if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}\n else { categoryid = Number(categoryid);} // ensure a numeric value instead of string\n\n const in_systemcontext = (contextid <= 1);\n\n let app = new Vue({\n el: '#root',\n data: {\n displayedstudyplan: null,\n activestudyplan: null,\n associatedstudents: [],\n selectedstudent: null,\n studentstudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n text: strings.studyplan,\n toolbox: {\n right: true,\n },\n usedcontexts: [],\n },\n async mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: {context_id: contextid}\n }])[0].done(function(response){\n const timingval = { present: 0, past: 1, future: 2};\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n const t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by name if timing is equal\n return a.name.localeCompare(b.name);\n }\n else {\n return t;\n }\n });\n app.studyplans = response;\n // load studyplan from hash if applicable\n const hash = window.location.hash.replace('#','');\n const parts = hash.split(\"-\");\n\n if(!!parts && parts.length > 0){\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == parts[0]){\n app.selectStudyplan(app.studyplans[idx],parts[1]);\n break;\n }\n }\n }\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_used_categories',\n args: { operation: 'view'}\n }])[0].done(function(response){\n const contexts = [];\n for(const ix in response){\n if(response[ix].studyplancount >0){\n contexts.push(response[ix]);\n }\n }\n app.usedcontexts = contexts;\n }).fail(notification.exception);\n },\n computed: {\n dropdown_title(){\n if(this.activestudyplan && this.activestudyplan.name){\n return this.activestudyplan.name;\n }\n else{\n return this.text.studyplan_select_placeholder;\n }\n },\n contextid(){\n return contextid;\n }\n },\n methods: {\n switchContext(ctx){\n const params = new URLSearchParams(location.search);\n params.set('categoryid', ctx.id);\n window.location.search = params.toString();\n\n },\n closeStudyplan() {\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.studentstudyplan = [];\n app.displayedstudyplan = null;\n window.location.hash = '';\n },\n\n selectStudyplan(studyplan,studentid){\n // fetch studyplan\n app.loadingstudyplan = true;\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.selectedstudent = null;\n app.studentstudyplan = null;\n call([{\n methodname: 'local_treestudyplan_get_studyplan_map',\n args: { id: studyplan.id}\n }])[0].done(function(response){\n app.activestudyplan = ProcessStudyplan(response,true);\n app.displayedstudyplan = app.activestudyplan;\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id;\n call([{\n methodname: 'local_treestudyplan_all_associated',\n args: { studyplan_id: studyplan.id}\n }])[0].done(function(response){\n app.associatedstudents = response;\n if(studentid){\n for(const student of app.associatedstudents){\n if(student.id == studentid){\n app.showStudentView(student);\n break;\n }\n }\n }\n }).fail(notification.exception);\n\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n },\n showStudentView(student){\n app.selectedstudent = student;\n app.studentstudyplan = null;\n app.loadingstudyplan = true;\n call([{\n methodname: 'local_treestudyplan_get_user_studyplan',\n args: { userid: student.id, studyplanid: app.activestudyplan.id}\n }])[0].done(function(response){\n app.studentstudyplan = ProcessStudyplan(response,false);\n app.displayedstudyplan = app.studentstudyplan;\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id + \"-\" + student.id;\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n\n\n },\n showOverview(){\n app.selectedstudent = null;\n app.studentstudyplan = null;\n app.displayedstudyplan = app.activestudyplan;\n window.location.hash = app.activestudyplan.id;\n }\n\n },\n });\n}\n"],"names":["contextid","categoryid","undefined","Number","isInteger","app","Vue","el","data","displayedstudyplan","activestudyplan","associatedstudents","selectedstudent","studentstudyplan","loadingstudyplan","studyplans","text","strings","studyplan","toolbox","right","usedcontexts","mounted","methodname","args","context_id","done","response","timingval","present","past","future","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","name","localeCompare","parts","window","location","hash","replace","split","length","idx","id","selectStudyplan","fail","notification","exception","operation","contexts","ix","studyplancount","push","computed","dropdown_title","this","studyplan_select_placeholder","methods","switchContext","ctx","params","URLSearchParams","search","set","toString","closeStudyplan","studentid","studyplan_id","student","showStudentView","error","userid","studyplanid","showOverview","use","RVComponents","ModalComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"m/BA0CqBA,WAAUC,YAE4DD,gBAApFE,IAAcF,aAAcG,OAAOC,UAAUD,OAAOH,cAAeA,WAAY,EAAiB,EAChFG,OAAOH,YAEnBC,gBADJC,IAAcD,YAAeE,OAAOC,UAAUD,OAAOF,aACpCE,OAAOF,YADyD,MAKhFI,IAAM,IAAIC,aAAI,CACdC,GAAI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gBwC,GAAK,IAAMyB,QAAQzB,MAC/DE,MAAK,SAASyB,6BACAvB,UAAUuB,OACvBxE,IAAIS,kBAAmB,MAK/BkE,wBACI3E,IAAIO,gBAAkB,KACtBP,IAAIQ,iBAAmB,KACvBR,IAAII,mBAAqBJ,IAAIK,gBAC7BiC,OAAOC,SAASC,KAAOxC,IAAIK,gBAAgBwC,+bArLvD+B,IAAIC,8CAGJD,IAAIE,oCAGJF,IAAIG,iCAEJH,IAAII,uBAGI,IAAIC,kBAAS,2BAErBrE,SAAU,8BAAa,CACvBC,UAAW,CACP6C,6BAA8B"} \ No newline at end of file +{"version":3,"file":"page-view-plan.min.js","sources":["../src/page-view-plan.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\nimport Vue from './vue/vue';\n\nimport Debugger from './util/debugger';\nimport {load_strings} from './util/string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\nimport TSComponents from './treestudyplan-components';\nimport ModalComponents from './modedit-modal';\nVue.use(ModalComponents);\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\n\nlet debug = new Debugger(\"treestudyplanviewer\");\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid,categoryid) {\n // Make sure the id's are numeric and integer\n if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;}\n else { contextid = Number(contextid);} // ensure a numeric value instead of string\n if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}\n else { categoryid = Number(categoryid);} // ensure a numeric value instead of string\n\n const in_systemcontext = (contextid <= 1);\n\n let app = new Vue({\n el: '#root',\n data: {\n displayedstudyplan: null,\n activestudyplan: null,\n associatedstudents: [],\n selectedstudent: null,\n studentstudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n text: strings.studyplan,\n toolbox: {\n right: true,\n },\n usedcontexts: [],\n },\n async mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: {context_id: contextid}\n }])[0].done(function(response){\n const timingval = { present: 0, past: 1, future: 2};\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n const t = timingval[timinga] - timingval[timingb];\n if(t == 0){\n // sort by name if timing is equal\n return a.name.localeCompare(b.name);\n }\n else {\n return t;\n }\n });\n app.studyplans = response;\n // load studyplan from hash if applicable\n const hash = window.location.hash.replace('#','');\n const parts = hash.split(\"-\");\n\n if(!!parts && parts.length > 0){\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == parts[0]){\n app.selectStudyplan(app.studyplans[idx],parts[1]);\n break;\n }\n }\n }\n }).fail(notification.exception);\n call([{\n methodname: 'local_treestudyplan_list_used_categories',\n args: { operation: 'view'}\n }])[0].done(function(response){\n const contexts = [];\n for(const ix in response){\n if(response[ix].studyplancount >0){\n contexts.push(response[ix]);\n }\n }\n app.usedcontexts = contexts;\n }).fail(notification.exception);\n },\n computed: {\n dropdown_title(){\n if(this.activestudyplan && this.activestudyplan.name){\n return this.activestudyplan.name;\n }\n else{\n return this.text.studyplan_select_placeholder;\n }\n },\n contextid(){\n return contextid;\n }\n },\n methods: {\n switchContext(ctx){\n const params = new URLSearchParams(location.search);\n params.set('categoryid', ctx.id);\n window.location.search = params.toString();\n\n },\n closeStudyplan() {\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.studentstudyplan = [];\n app.displayedstudyplan = null;\n window.location.hash = '';\n },\n\n selectStudyplan(studyplan,studentid){\n // fetch studyplan\n app.loadingstudyplan = true;\n app.activestudyplan = null;\n app.associatedstudents = [];\n app.selectedstudent = null;\n app.studentstudyplan = null;\n call([{\n methodname: 'local_treestudyplan_get_studyplan_map',\n args: { id: studyplan.id}\n }])[0].done(function(response){\n app.activestudyplan = ProcessStudyplan(response,true);\n app.displayedstudyplan = app.activestudyplan;\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id;\n call([{\n methodname: 'local_treestudyplan_all_associated',\n args: { studyplan_id: studyplan.id}\n }])[0].done(function(response){\n app.associatedstudents = response;\n if(studentid){\n for(const student of app.associatedstudents){\n if(student.id == studentid){\n app.showStudentView(student);\n break;\n }\n }\n }\n }).fail(notification.exception);\n\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n },\n showStudentView(student){\n app.selectedstudent = student;\n app.studentstudyplan = null;\n app.loadingstudyplan = true;\n call([{\n methodname: 'local_treestudyplan_get_user_studyplan',\n args: { userid: student.id, studyplanid: app.activestudyplan.id}\n }])[0].done(function(response){\n app.studentstudyplan = ProcessStudyplan(response,false);\n app.displayedstudyplan = app.studentstudyplan;\n app.loadingstudyplan = false;\n window.location.hash = app.activestudyplan.id + \"-\" + student.id;\n }).fail(function(error){\n notification.exception(error);\n app.loadingstudyplan = false;\n });\n\n\n },\n showOverview(){\n app.selectedstudent = null;\n app.studentstudyplan = null;\n app.displayedstudyplan = app.activestudyplan;\n window.location.hash = app.activestudyplan.id;\n }\n\n },\n });\n}\n"],"names":["contextid","categoryid","undefined","Number","isInteger","app","Vue","el","data","displayedstudyplan","activestudyplan","associatedstudents","selectedstudent","studentstudyplan","loadingstudyplan","studyplans","text","strings","studyplan","toolbox","right","usedcontexts","mounted","methodname","args","context_id","done","response","timingval","present","past","future","sort","a","b","timinga","TSComponents","studyplanTiming","timingb","t","name","localeCompare","parts","window","location","hash","replace","split","length","idx","id","selectStudyplan","fail","notification","exception","operation","contexts","ix","studyplancount","push","computed","dropdown_title","this","studyplan_select_placeholder","methods","switchContext","ctx","params","URLSearchParams","search","set","toString","closeStudyplan","studentid","studyplan_id","student","showStudentView","error","userid","studyplanid","showOverview","use","RVComponents","ModalComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"m/BA0CqBA,WAAUC,YAE4DD,gBAApFE,IAAcF,aAAcG,OAAOC,UAAUD,OAAOH,cAAeA,WAAY,EAAiB,EAChFG,OAAOH,YAEnBC,gBADJC,IAAcD,YAAeE,OAAOC,UAAUD,OAAOF,aACpCE,OAAOF,YADyD,MAKhFI,IAAM,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,CACFC,mBAAoB,KACpBC,gBAAiB,KACjBC,mBAAoB,GACpBC,gBAAiB,KACjBC,iBAAkB,KAClBC,kBAAkB,EAClBC,WAAY,GACZC,KAAMC,QAAQC,UACdC,QAAS,CACLC,OAAO,GAEXC,aAAc,IAEZC,6LACG,CAAC,CACFC,WAAY,sCACZC,KAAM,CAACC,WAAYzB,eACnB,GAAG0B,MAAK,SAASC,cACXC,UAAY,CAAEC,QAAS,EAAGC,KAAM,EAAGC,OAAQ,GACjDJ,SAASK,MAAK,SAACC,EAAEC,OACPC,QAAUC,iCAAaC,gBAAgBJ,GACvCK,QAAUF,iCAAaC,gBAAgBH,GAEvCK,EAAIX,UAAUO,SAAWP,UAAUU,gBACjC,GAALC,EAEQN,EAAEO,KAAKC,cAAcP,EAAEM,MAGvBD,KAGflC,IAAIU,WAAaY,aAGXe,MADOC,OAAOC,SAASC,KAAKC,QAAQ,IAAI,IAC3BC,MAAM,QAEpBL,OAASA,MAAMM,OAAS,MACrB,IAAIC,OAAO5C,IAAIU,cACZV,IAAIU,WAAWkC,KAAKC,IAAMR,MAAM,GAAG,CAClCrC,IAAI8C,gBAAgB9C,IAAIU,WAAWkC,KAAKP,MAAM,cAK3DU,KAAKC,sBAAaC,0BAChB,CAAC,CACF/B,W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C,sBAAaC,cAEtBF,MAAK,SAASyB,6BACAvB,UAAUuB,OACvBxE,IAAIS,kBAAmB,MAG/B8D,yBAAgBD,SACZtE,IAAIO,gBAAkB+D,QACtBtE,IAAIQ,iBAAmB,KACvBR,IAAIS,kBAAmB,iBAClB,CAAC,CACFS,WAAY,yCACZC,KAAM,CAAEsD,OAAQH,QAAQzB,GAAI6B,YAAa1E,IAAIK,gBAAgBwC,OAC7D,GAAGxB,MAAK,SAASC,UACjBtB,IAAIQ,kBAAmB,wCAAiBc,UAAS,GACjDtB,IAAII,mBAAqBJ,IAAIQ,iBAC7BR,IAAIS,kBAAmB,EACvB6B,OAAOC,SAASC,KAAOxC,IAAIK,gBAAgBwC,GAAK,IAAMyB,QAAQzB,MAC/DE,MAAK,SAASyB,6BACAvB,UAAUuB,OACvBxE,IAAIS,kBAAmB,MAK/BkE,wBACI3E,IAAIO,gBAAkB,KACtBP,IAAIQ,iBAAmB,KACvBR,IAAII,mBAAqBJ,IAAIK,gBAC7BiC,OAAOC,SAASC,KAAOxC,IAAIK,gBAAgBwC,+bArLvD+B,IAAIC,8CAGJD,IAAIE,oCAGJF,IAAIG,iCAEJH,IAAII,uBAGI,IAAIC,kBAAS,2BAErBrE,SAAU,8BAAa,CACvBC,UAAW,CACP6C,6BAA8B"} \ No newline at end of file diff --git a/amd/build/portal-vue/portal-vue.esm.min.js.map b/amd/build/portal-vue/portal-vue.esm.min.js.map index faf3ca7..99ed432 100644 --- a/amd/build/portal-vue/portal-vue.esm.min.js.map +++ b/amd/build/portal-vue/portal-vue.esm.min.js.map @@ -1 +1 @@ -{"version":3,"file":"portal-vue.esm.min.js","sources":["../../src/portal-vue/portal-vue.esm.js"],"sourcesContent":["/* eslint-disable */\n /*! \n * portal-vue © Thorsten Lünborg, 2019 \n * \n * Version: 2.1.7\n * \n * LICENCE: MIT \n * \n * https://github.com/linusborg/portal-vue\n * \n */\n\n/* Modification by PMKuipers to handle relative loading of vue */\nimport Vue from '../vue/vue';\n/* End modification */\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n}\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n}\n\nfunction _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n}\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n}\n\nvar inBrowser = typeof window !== 'undefined';\nfunction freeze(item) {\n if (Array.isArray(item) || _typeof(item) === 'object') {\n return Object.freeze(item);\n }\n\n return item;\n}\nfunction combinePassengers(transports) {\n var slotProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return transports.reduce(function (passengers, transport) {\n var temp = transport.passengers[0];\n var newPassengers = typeof temp === 'function' ? temp(slotProps) : transport.passengers;\n return passengers.concat(newPassengers);\n }, []);\n}\nfunction stableSort(array, compareFn) {\n return array.map(function (v, idx) {\n return [idx, v];\n }).sort(function (a, b) {\n return compareFn(a[1], b[1]) || a[0] - b[0];\n }).map(function (c) {\n return c[1];\n });\n}\nfunction pick(obj, keys) {\n return keys.reduce(function (acc, key) {\n if (obj.hasOwnProperty(key)) {\n acc[key] = obj[key];\n }\n\n return acc;\n }, {});\n}\n\nvar transports = {};\nvar targets = {};\nvar sources = {};\nvar Wormhole = Vue.extend({\n data: function data() {\n return {\n transports: transports,\n targets: targets,\n sources: sources,\n trackInstances: inBrowser\n };\n },\n methods: {\n open: function open(transport) {\n if (!inBrowser) return;\n var to = transport.to,\n from = transport.from,\n passengers = transport.passengers,\n _transport$order = transport.order,\n order = _transport$order === void 0 ? Infinity : _transport$order;\n if (!to || !from || !passengers) return;\n var newTransport = {\n to: to,\n from: from,\n passengers: freeze(passengers),\n order: order\n };\n var keys = Object.keys(this.transports);\n\n if (keys.indexOf(to) === -1) {\n Vue.set(this.transports, to, []);\n }\n\n var currentIndex = this.$_getTransportIndex(newTransport); // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n\n var newTransports = this.transports[to].slice(0);\n\n if (currentIndex === -1) {\n newTransports.push(newTransport);\n } else {\n newTransports[currentIndex] = newTransport;\n }\n\n this.transports[to] = stableSort(newTransports, function (a, b) {\n return a.order - b.order;\n });\n },\n close: function close(transport) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var to = transport.to,\n from = transport.from;\n if (!to || !from && force === false) return;\n\n if (!this.transports[to]) {\n return;\n }\n\n if (force) {\n this.transports[to] = [];\n } else {\n var index = this.$_getTransportIndex(transport);\n\n if (index >= 0) {\n // Copying the array here so that the PortalTarget change event will actually contain two distinct arrays\n var newTransports = this.transports[to].slice(0);\n newTransports.splice(index, 1);\n this.transports[to] = newTransports;\n }\n }\n },\n registerTarget: function registerTarget(target, vm, force) {\n if (!inBrowser) return;\n\n if (this.trackInstances && !force && this.targets[target]) {\n console.warn(\"[portal-vue]: Target \".concat(target, \" already exists\"));\n }\n\n this.$set(this.targets, target, Object.freeze([vm]));\n },\n unregisterTarget: function unregisterTarget(target) {\n this.$delete(this.targets, target);\n },\n registerSource: function registerSource(source, vm, force) {\n if (!inBrowser) return;\n\n if (this.trackInstances && !force && this.sources[source]) {\n console.warn(\"[portal-vue]: source \".concat(source, \" already exists\"));\n }\n\n this.$set(this.sources, source, Object.freeze([vm]));\n },\n unregisterSource: function unregisterSource(source) {\n this.$delete(this.sources, source);\n },\n hasTarget: function hasTarget(to) {\n return !!(this.targets[to] && this.targets[to][0]);\n },\n hasSource: function hasSource(to) {\n return !!(this.sources[to] && this.sources[to][0]);\n },\n hasContentFor: function hasContentFor(to) {\n return !!this.transports[to] && !!this.transports[to].length;\n },\n // Internal\n $_getTransportIndex: function $_getTransportIndex(_ref) {\n var to = _ref.to,\n from = _ref.from;\n\n for (var i in this.transports[to]) {\n if (this.transports[to][i].from === from) {\n return +i;\n }\n }\n\n return -1;\n }\n }\n});\nvar wormhole = new Wormhole(transports);\n\nvar _id = 1;\nvar Portal = Vue.extend({\n name: 'portal',\n props: {\n disabled: {\n type: Boolean\n },\n name: {\n type: String,\n default: function _default() {\n return String(_id++);\n }\n },\n order: {\n type: Number,\n default: 0\n },\n slim: {\n type: Boolean\n },\n slotProps: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n tag: {\n type: String,\n default: 'DIV'\n },\n to: {\n type: String,\n default: function _default() {\n return String(Math.round(Math.random() * 10000000));\n }\n }\n },\n created: function created() {\n var _this = this;\n\n this.$nextTick(function () {\n wormhole.registerSource(_this.name, _this);\n });\n },\n mounted: function mounted() {\n if (!this.disabled) {\n this.sendUpdate();\n }\n },\n updated: function updated() {\n if (this.disabled) {\n this.clear();\n } else {\n this.sendUpdate();\n }\n },\n beforeDestroy: function beforeDestroy() {\n wormhole.unregisterSource(this.name);\n this.clear();\n },\n watch: {\n to: function to(newValue, oldValue) {\n oldValue && oldValue !== newValue && this.clear(oldValue);\n this.sendUpdate();\n }\n },\n methods: {\n clear: function clear(target) {\n var closer = {\n from: this.name,\n to: target || this.to\n };\n wormhole.close(closer);\n },\n normalizeSlots: function normalizeSlots() {\n return this.$scopedSlots.default ? [this.$scopedSlots.default] : this.$slots.default;\n },\n normalizeOwnChildren: function normalizeOwnChildren(children) {\n return typeof children === 'function' ? children(this.slotProps) : children;\n },\n sendUpdate: function sendUpdate() {\n var slotContent = this.normalizeSlots();\n\n if (slotContent) {\n var transport = {\n from: this.name,\n to: this.to,\n passengers: _toConsumableArray(slotContent),\n order: this.order\n };\n wormhole.open(transport);\n } else {\n this.clear();\n }\n }\n },\n render: function render(h) {\n var children = this.$slots.default || this.$scopedSlots.default || [];\n var Tag = this.tag;\n\n if (children && this.disabled) {\n return children.length <= 1 && this.slim ? this.normalizeOwnChildren(children)[0] : h(Tag, [this.normalizeOwnChildren(children)]);\n } else {\n return this.slim ? h() : h(Tag, {\n class: {\n 'v-portal': true\n },\n style: {\n display: 'none'\n },\n key: 'v-portal-placeholder'\n });\n }\n }\n});\n\nvar PortalTarget = Vue.extend({\n name: 'portalTarget',\n props: {\n multiple: {\n type: Boolean,\n default: false\n },\n name: {\n type: String,\n required: true\n },\n slim: {\n type: Boolean,\n default: false\n },\n slotProps: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n tag: {\n type: String,\n default: 'div'\n },\n transition: {\n type: [String, Object, Function]\n }\n },\n data: function data() {\n return {\n transports: wormhole.transports,\n firstRender: true\n };\n },\n created: function created() {\n var _this = this;\n\n this.$nextTick(function () {\n wormhole.registerTarget(_this.name, _this);\n });\n },\n watch: {\n ownTransports: function ownTransports() {\n this.$emit('change', this.children().length > 0);\n },\n name: function name(newVal, oldVal) {\n /**\n * TODO\n * This should warn as well ...\n */\n wormhole.unregisterTarget(oldVal);\n wormhole.registerTarget(newVal, this);\n }\n },\n mounted: function mounted() {\n var _this2 = this;\n\n if (this.transition) {\n this.$nextTick(function () {\n // only when we have a transition, because it causes a re-render\n _this2.firstRender = false;\n });\n }\n },\n beforeDestroy: function beforeDestroy() {\n wormhole.unregisterTarget(this.name);\n },\n computed: {\n ownTransports: function ownTransports() {\n var transports = this.transports[this.name] || [];\n\n if (this.multiple) {\n return transports;\n }\n\n return transports.length === 0 ? [] : [transports[transports.length - 1]];\n },\n passengers: function passengers() {\n return combinePassengers(this.ownTransports, this.slotProps);\n }\n },\n methods: {\n // can't be a computed prop because it has to \"react\" to $slot changes.\n children: function children() {\n return this.passengers.length !== 0 ? this.passengers : this.$scopedSlots.default ? this.$scopedSlots.default(this.slotProps) : this.$slots.default || [];\n },\n // can't be a computed prop because it has to \"react\" to this.children().\n noWrapper: function noWrapper() {\n var noWrapper = this.slim && !this.transition;\n\n if (noWrapper && this.children().length > 1) {\n console.warn('[portal-vue]: PortalTarget with `slim` option received more than one child element.');\n }\n\n return noWrapper;\n }\n },\n render: function render(h) {\n var noWrapper = this.noWrapper();\n var children = this.children();\n var Tag = this.transition || this.tag;\n return noWrapper ? children[0] : this.slim && !Tag ? h() : h(Tag, {\n props: {\n // if we have a transition component, pass the tag if it exists\n tag: this.transition && this.tag ? this.tag : undefined\n },\n class: {\n 'vue-portal-target': true\n }\n }, children);\n }\n});\n\nvar _id$1 = 0;\nvar portalProps = ['disabled', 'name', 'order', 'slim', 'slotProps', 'tag', 'to'];\nvar targetProps = ['multiple', 'transition'];\nvar MountingPortal = Vue.extend({\n name: 'MountingPortal',\n inheritAttrs: false,\n props: {\n append: {\n type: [Boolean, String]\n },\n bail: {\n type: Boolean\n },\n mountTo: {\n type: String,\n required: true\n },\n // Portal\n disabled: {\n type: Boolean\n },\n // name for the portal\n name: {\n type: String,\n default: function _default() {\n return 'mounted_' + String(_id$1++);\n }\n },\n order: {\n type: Number,\n default: 0\n },\n slim: {\n type: Boolean\n },\n slotProps: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n tag: {\n type: String,\n default: 'DIV'\n },\n // name for the target\n to: {\n type: String,\n default: function _default() {\n return String(Math.round(Math.random() * 10000000));\n }\n },\n // Target\n multiple: {\n type: Boolean,\n default: false\n },\n targetSlim: {\n type: Boolean\n },\n targetSlotProps: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n targetTag: {\n type: String,\n default: 'div'\n },\n transition: {\n type: [String, Object, Function]\n }\n },\n created: function created() {\n if (typeof document === 'undefined') return;\n var el = document.querySelector(this.mountTo);\n\n if (!el) {\n console.error(\"[portal-vue]: Mount Point '\".concat(this.mountTo, \"' not found in document\"));\n return;\n }\n\n var props = this.$props; // Target already exists\n\n if (wormhole.targets[props.name]) {\n if (props.bail) {\n console.warn(\"[portal-vue]: Target \".concat(props.name, \" is already mounted.\\n Aborting because 'bail: true' is set\"));\n } else {\n this.portalTarget = wormhole.targets[props.name];\n }\n\n return;\n }\n\n var append = props.append;\n\n if (append) {\n var type = typeof append === 'string' ? append : 'DIV';\n var mountEl = document.createElement(type);\n el.appendChild(mountEl);\n el = mountEl;\n } // get props for target from $props\n // we have to rename a few of them\n\n\n var _props = pick(this.$props, targetProps);\n\n _props.slim = this.targetSlim;\n _props.tag = this.targetTag;\n _props.slotProps = this.targetSlotProps;\n _props.name = this.to;\n this.portalTarget = new PortalTarget({\n el: el,\n parent: this.$parent || this,\n propsData: _props\n });\n },\n beforeDestroy: function beforeDestroy() {\n var target = this.portalTarget;\n\n if (this.append) {\n var el = target.$el;\n el.parentNode.removeChild(el);\n }\n\n target.$destroy();\n },\n render: function render(h) {\n if (!this.portalTarget) {\n console.warn(\"[portal-vue] Target wasn't mounted\");\n return h();\n } // if there's no \"manual\" scoped slot, so we create a ourselves\n\n\n if (!this.$scopedSlots.manual) {\n var props = pick(this.$props, portalProps);\n return h(Portal, {\n props: props,\n attrs: this.$attrs,\n on: this.$listeners,\n scopedSlots: this.$scopedSlots\n }, this.$slots.default);\n } // else, we render the scoped slot\n\n\n var content = this.$scopedSlots.manual({\n to: this.to\n }); // if user used