moodle/course/amd/build/local/courseeditor/courseeditor.min.js
Ferran Recio e6779782dc MDL-71134 course: new course editor reactive module
The new course editor for Moodle 4.0 is the first AMD
module that will use the new reactive library. This
commit creates creates the initial structure of the
new course editor frontend.
2021-06-10 16:08:39 +02:00

2 lines
5.3 KiB
JavaScript

define ("core_course/local/courseeditor/courseeditor",["exports","core/reactive","core/notification","core/log","core/ajax"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;c=f(c);d=f(d);e=f(e);function f(a){return a&&a.__esModule?a:{default:a}}function g(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){g=function(a){return typeof a}}else{g=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return g(a)}function h(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);if(b)d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable});c.push.apply(c,d)}return c}function i(a){for(var b=1,c;b<arguments.length;b++){c=null!=arguments[b]?arguments[b]:{};if(b%2){h(Object(c),!0).forEach(function(b){j(a,b,c[b])})}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(a,Object.getOwnPropertyDescriptors(c))}else{h(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}}return a}function j(a,b,c){if(b in a){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0})}else{a[b]=c}return a}function k(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function l(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){k(h,d,e,f,g,"next",a)}function g(a){k(h,d,e,f,g,"throw",a)}f(void 0)})}}function m(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}function n(a,b){for(var c=0,d;c<b.length;c++){d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;if("value"in d)d.writable=!0;Object.defineProperty(a,d.key,d)}}function o(a,b,c){if(b)n(a.prototype,b);if(c)n(a,c);return a}function p(a,b,c){if("undefined"!=typeof Reflect&&Reflect.get){p=Reflect.get}else{p=function(a,b,c){var d=q(a,b);if(!d)return;var e=Object.getOwnPropertyDescriptor(d,b);if(e.get){return e.get.call(c)}return e.value}}return p(a,b,c||a)}function q(a,b){while(!Object.prototype.hasOwnProperty.call(a,b)){a=x(a);if(null===a)break}return a}function r(a,b){if("function"!=typeof b&&null!==b){throw new TypeError("Super expression must either be null or a function")}a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}});if(b)s(a,b)}function s(a,b){s=Object.setPrototypeOf||function(a,b){a.__proto__=b;return a};return s(a,b)}function t(a){return function(){var b=x(a),c;if(w()){var d=x(this).constructor;c=Reflect.construct(b,arguments,d)}else{c=b.apply(this,arguments)}return u(this,c)}}function u(a,b){if(b&&("object"===g(b)||"function"==typeof b)){return b}return v(a)}function v(a){if(void 0===a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return a}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{Date.prototype.toString.call(Reflect.construct(Date,[],function(){}));return!0}catch(a){return!1}}function x(a){x=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)};return x(a)}var y=function(a){r(b,a);var f=t(b);function b(){m(this,b);return f.apply(this,arguments)}o(b,[{key:"loadCourse",value:function(){var a=l(regeneratorRuntime.mark(function a(b){var c,e;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:if(!this.courseId){a.next=2;break}throw new Error("Cannot load ".concat(b,", course already loaded with id ").concat(this.courseId));case 2:this.courseId=b;a.prev=3;a.next=6;return this.getServerCourseState();case 6:e=a.sent;a.next=14;break;case 9:a.prev=9;a.t0=a["catch"](3);d.default.error("EXCEPTION RAISED WHILE INIT COURSE EDITOR");d.default.error(a.t0);return a.abrupt("return");case 14:this._editing=null!==(c=e.course.editmode)&&void 0!==c?c:!1;this.setInitialState(e);case 16:case"end":return a.stop();}}},a,this,[[3,9]])}));return function loadCourse(){return a.apply(this,arguments)}}()},{key:"getServerCourseState",value:function(){var a=l(regeneratorRuntime.mark(function a(){var b,c;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:a.next=2;return e.default.call([{methodname:"core_course_get_state",args:{courseid:this.courseId}}])[0];case 2:b=a.sent;c=JSON.parse(b);return a.abrupt("return",i({course:{},section:[],cm:[]},c));case 5:case"end":return a.stop();}}},a,this)}));return function getServerCourseState(){return a.apply(this,arguments)}}()},{key:"dispatch",value:function(){var a=l(regeneratorRuntime.mark(function a(){var d,e,f,g,h=arguments;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:a.prev=0;for(e=h.length,f=Array(e),g=0;g<e;g++){f[g]=h[g]}a.next=4;return(d=p(x(b.prototype),"dispatch",this)).call.apply(d,[this].concat(f));case 4:a.next=9;break;case 6:a.prev=6;a.t0=a["catch"](0);c.default.exception(a.t0);case 9:case"end":return a.stop();}}},a,this,[[0,6]])}));return function dispatch(){return a.apply(this,arguments)}}()},{key:"isEditing",get:function get(){var a;return null!==(a=this._editing)&&void 0!==a?a:!1}}]);return b}(b.Reactive);a.default=y;return a.default});
//# sourceMappingURL=courseeditor.min.js.map