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

3 lines
10 KiB
JavaScript
Raw Normal View History

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)}var global,factory;global=window,factory=function(exports,Vue){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")}()}Vue=Vue&&Vue.hasOwnProperty("default")?Vue.default:Vue;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.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.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),_id=1,Portal=Vue.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(_id++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},created:function(){var _this=this;this.$nextTick((function(){wormhole.regis
//# sourceMappingURL=portal-vue.min.js.map