moodle_local_treestudyplan/amd/build/vue-easy-dnd/vue-easy-dnd.esm.min.js.map

1 line
85 KiB
Plaintext
Raw Normal View History

2023-08-21 22:04:51 +02:00
{"version":3,"file":"vue-easy-dnd.esm.min.js","sources":["../../src/vue-easy-dnd/vue-easy-dnd.esm.js"],"sourcesContent":["import { reactive, openBlock, createBlock, resolveDynamicComponent, normalizeClass, createSlots, withCtx, renderSlot, normalizeProps, guardReactiveProps, createElementBlock, createCommentVNode, renderList, TransitionGroup, h, nextTick } from 'vue';\n\nfunction mitt(n){return {all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e]);},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]));},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e);}),(i=n.get(\"*\"))&&i.slice().map(function(n){n(t,e);});}}}\n\n/**\r\n * This is the class of the global object that holds the state of the drag and drop during its progress. It emits events\r\n * reporting its state evolution during the progress of the drag and drop. Its data is reactive and listeners can be\r\n * attached to it using the method on.\r\n */\r\nclass DnD {\r\n\r\n inProgress = false;\r\n type = null;\r\n data = null;\r\n source = null;\r\n top = null;\r\n position = null;\r\n eventBus = mitt();\r\n success = null;\r\n\r\n startDrag (source, event, x, y, type, data) {\r\n this.type = type;\r\n this.data = data;\r\n this.source = source;\r\n this.position = { x, y };\r\n this.top = null;\r\n this.inProgress = true;\r\n this.emit(event, 'dragstart');\r\n this.emit(event, 'dragtopchanged', { previousTop: null });\r\n }\r\n\r\n resetVariables () {\r\n this.inProgress = false;\r\n this.data = null;\r\n this.source = null;\r\n this.position = null;\r\n this.success = null;\r\n }\r\n\r\n stopDrag (event) {\r\n this.success = this.top !== null && this.top['compatibleMode'] && this.top['dropAllowed'];\r\n if (this.top !== null) {\r\n this.emit(event, 'drop');\r\n }\r\n this.emit(event, 'dragend');\r\n this.resetVariables();\r\n }\r\n\r\n cancelDrag (event) {\r\n this.success = false;\r\n this.emit(event, 'dragend');\r\n this.resetVariables();\r\n }\r\n\r\n mouseMove (event, comp) {\r\n if (this.inProgress) {\r\n let prevent = false;\r\n const previousTop = this.top;\r\n if (comp === null) {\r\n // The mouse move event reached the top of the document without hitting a drop component.\r\n this.top = null;\r\n prevent = true;\r\n }\r\n else if (comp['isDropMask']) {\r\n // The mouse move event bubbled until it reached a drop mask.\r\n this.top = null;\r\n prevent = true;\r\n }\r\n else if (comp['candidate'](this.type, this.data, this.source)) {\r\n // The mouse move event bubbled until it reached a drop component that participates in the current drag operation.\r\n this.top = comp;\r\n prevent = true;\r\n }\r\n\r\n if (prevent) {\r\n // We prevent the mouse move event from bubbling further up the tree because it reached the foremost drop component and that component is all that matters.\r\n event.stopPropagation();\r\n }\r\n if (this.top !== previousTop) {\r\n this.emit(event.detail.native, 'dragtopchanged', { previousTop: previousTop });\r\n }\r\n this.position = {\r\n x: event.detail.x,\r\n y: event.detail.y\r\n };\r\n this.emit(event.detail.native, 'dragpositionchanged');\r\n }\r\n }\r\n\r\n emit (native, event, data = {}) {\r\n this.eventBus.emit(event, {\r\n type: this.type,\r\n data: this.data,\r\n top: this.top,\r\n source: this.source,\r\n position: this.position,\r\n success: this.success,\r\n native,\r\n ...data\r\n });\r\n }\r\n\r\n on (event, callback) {\r\n this.eventBus.on(event, callback);\r\n }\r\n\r\n off (event, callback) {\r\n this.eventBus.off(event, callback);\r\n }\r\n}\r\n\r\nconst dnd =