moodle_local_treestudyplan/amd/build/portal-vue/portal-vue.esm.min.js

3 lines
10 KiB
JavaScript
Raw Normal View History

define("local_treestudyplan/portal-vue/portal-vue.esm",["exports","../vue/vue"],(function(_exports,_vue){var obj;function _typeof2(obj){return _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof2(obj)}function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(obj){return _typeof2(obj)}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":_typeof2(obj)},_typeof(obj)}function _toConsumableArray(arr){return function(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(arr)||function(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}(arr)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=_exports.Wormhole=_exports.PortalTarget=_exports.Portal=_exports.MountingPortal=void 0,_vue=(obj=_vue)&&obj.__esModule?obj:{default:obj};var inBrowser="undefined"!=typeof window;function pick(obj,keys){return keys.reduce((function(acc,key){return obj.hasOwnProperty(key)&&(acc[key]=obj[key]),acc}),{})}var transports={},targets={},sources={},Wormhole=_vue.default.extend({data:function(){return{transports:transports,targets:targets,sources:sources,trackInstances:inBrowser}},methods:{open:function(transport){if(inBrowser){var to=transport.to,from=transport.from,passengers=transport.passengers,_transport$order=transport.order,order=void 0===_transport$order?1/0:_transport$order;if(to&&from&&passengers){var item,newTransport={to:to,from:from,passengers:(item=passengers,Array.isArray(item)||"object"===_typeof(item)?Object.freeze(item):item),order:order};-1===Object.keys(this.transports).indexOf(to)&&_vue.default.set(this.transports,to,[]);var compareFn,currentIndex=this.$_getTransportIndex(newTransport),newTransports=this.transports[to].slice(0);-1===currentIndex?newTransports.push(newTransport):newTransports[currentIndex]=newTransport,this.transports[to]=(compareFn=function(a,b){return a.order-b.order},newTransports.map((function(v,idx){return[idx,v]})).sort((function(a,b){return compareFn(a[1],b[1])||a[0]-b[0]})).map((function(c){return c[1]})))}}},close:function(transport){var force=arguments.length>1&&void 0!==arguments[1]&&arguments[1],to=transport.to,from=transport.from;if(to&&(from||!1!==force)&&this.transports[to])if(force)this.transports[to]=[];else{var index=this.$_getTransportIndex(transport);if(index>=0){var newTransports=this.transports[to].slice(0);newTransports.splice(index,1),this.transports[to]=newTransports}}},registerTarget:function(target,vm,force){inBrowser&&(this.trackInstances&&!force&&this.targets[target]&&console.warn("[portal-vue]: Target ".concat(target," already exists")),this.$set(this.targets,target,Object.freeze([vm])))},unregisterTarget:function(target){this.$delete(this.targets,target)},registerSource:function(source,vm,force){inBrowser&&(this.trackInstances&&!force&&this.sources[source]&&console.warn("[portal-vue]: source ".concat(source," already exists")),this.$set(this.sources,source,Object.freeze([vm])))},unregisterSource:function(source){this.$delete(this.sources,source)},hasTarget:function(to){return!(!this.targets[to]||!this.targets[to][0])},hasSource:function(to){return!(!this.sources[to]||!this.sources[to][0])},hasContentFor:function(to){return!!this.transports[to]&&!!this.transports[to].length},$_getTransportIndex:function(_ref){var to=_ref.to,from=_ref.from;for(var i in this.transports[to])if(this.transports[to][i].from===from)return+i;return-1}}}),wormhole=new Wormhole(transports);_exports.Wormhole=wormhole;var _id=1,Portal=_vue.default.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(_id++)}},order:{type:Number,default:0},
2023-08-19 17:54:40 +02:00
//# sourceMappingURL=portal-vue.esm.min.js.map