fbki-vue3-nestable
Advanced tools
Comparing version 3.0.10 to 3.0.11
@@ -20,3 +20,3 @@ var __defProp = Object.defineProperty; | ||
var __spreadProps = (a2, b) => __defProps(a2, __getOwnPropDescs(b)); | ||
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, Fragment, renderList, createBlock, withCtx, normalizeProps, guardReactiveProps, createCommentVNode, normalizeStyle, createVNode, createTextVNode } from "vue"; | ||
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, Fragment, renderList, createBlock, withCtx, normalizeProps, guardReactiveProps, createCommentVNode, normalizeStyle, createVNode, createTextVNode } from "vue"; | ||
const store = {}; | ||
@@ -182,5 +182,5 @@ var groupsObserver = { | ||
class: "nestable-item-content", | ||
onMouseenter: _cache[0] || (_cache[0] = withModifiers((...args) => $options.onMouseEnter && $options.onMouseEnter(...args), ["prevent"])), | ||
onMouseleave: _cache[1] || (_cache[1] = withModifiers((...args) => $options.onMouseLeave && $options.onMouseLeave(...args), ["prevent"])), | ||
onMousemove: _cache[2] || (_cache[2] = withModifiers((...args) => $options.onMouseMove && $options.onMouseMove(...args), ["prevent"])) | ||
onMouseenter: _cache[0] || (_cache[0] = (...args) => $options.onMouseEnter && $options.onMouseEnter(...args)), | ||
onMouseleave: _cache[1] || (_cache[1] = (...args) => $options.onMouseLeave && $options.onMouseLeave(...args)), | ||
onMousemove: _cache[2] || (_cache[2] = (...args) => $options.onMouseMove && $options.onMouseMove(...args)) | ||
}, [ | ||
@@ -1024,6 +1024,6 @@ renderSlot(_ctx.$slots, "default", { | ||
class: "nestable-handle", | ||
onDragstart: _cache[0] || (_cache[0] = withModifiers((...args) => $options.dragstart && $options.dragstart(...args), ["prevent"])), | ||
onTouchstart: _cache[1] || (_cache[1] = withModifiers((...args) => $options.dragstart && $options.dragstart(...args), ["prevent"])), | ||
onTouchend: _cache[2] || (_cache[2] = withModifiers((...args) => $options.touchend && $options.touchend(...args), ["prevent"])), | ||
onTouchmove: _cache[3] || (_cache[3] = withModifiers((...args) => $options.touchmove && $options.touchmove(...args), ["prevent"])) | ||
onDragstart: _cache[0] || (_cache[0] = (...args) => $options.dragstart && $options.dragstart(...args)), | ||
onTouchstart: _cache[1] || (_cache[1] = (...args) => $options.dragstart && $options.dragstart(...args)), | ||
onTouchend: _cache[2] || (_cache[2] = (...args) => $options.touchend && $options.touchend(...args)), | ||
onTouchmove: _cache[3] || (_cache[3] = (...args) => $options.touchmove && $options.touchmove(...args)) | ||
}, [ | ||
@@ -1030,0 +1030,0 @@ renderSlot(_ctx.$slots, "default") |
@@ -1,1 +0,1 @@ | ||
(function(g,s){typeof exports=="object"&&typeof module!="undefined"?s(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],s):(g=typeof globalThis!="undefined"?globalThis:g||self,s(g.VueNestable={},g.Vue))})(this,function(g,s){"use strict";var mt=Object.defineProperty,gt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var x=(g,s,P)=>s in g?mt(g,s,{enumerable:!0,configurable:!0,writable:!0,value:P}):g[s]=P,k=(g,s)=>{for(var P in s||(s={}))Pt.call(s,P)&&x(g,P,s[P]);if(V)for(var P of V(s))Et.call(s,P)&&x(g,P,s[P]);return g},G=(g,s)=>gt(g,yt(s));const P={};var S={methods:{registerNestable(t){const e=this._getByGroup(t.group);e.onDragStartListeners.push(t.onDragStart),e.onMouseEnterListeners.push(t.onMouseEnter),e.onMouseMoveListeners.push(t.onMouseMove)},notifyDragStart(t,e,o){const u=this._getByGroup(t);for(const i of u.onDragStartListeners)i(e,o)},notifyMouseEnter(t,e,o,u){const i=this._getByGroup(t);for(const l of i.onMouseEnterListeners)l(e,o,u)},notifyMouseMove(t,e){const o=this._getByGroup(t);for(const u of o.onMouseMoveListeners)u(e)},_getByGroup(t){return P[t]||(P[t]={onDragStartListeners:[],onMouseEnterListeners:[],onMouseMoveListeners:[],onDragStart:[],dragItem:null}),P[t]}}},C=(t,e)=>{const o=t.__vccOpts||t;for(const[u,i]of e)o[u]=i;return o};const Y={name:"NestableItem",mixins:[S],props:{item:{type:Object,required:!0,default:()=>({})},index:{type:Number,required:!1,default:null},isChild:{type:Boolean,required:!1,default:!1},isCopy:{type:Boolean,required:!1,default:!1},options:{type:Object,required:!0,default:()=>({})}},inject:["listId","group","keyProp"],data(){return{breakPoint:null,moveDown:!1}},computed:{isDragging(){const t=this.options.dragItem;return!this.isCopy&&t&&t[this.options.keyProp]===this.item[this.options.keyProp]},hasChildren(){return this.item[this.options.childrenProp]&&this.item[this.options.childrenProp].length>0},hasHandle(){return!!this.$scopedSlots.handler},normalizedClassProp(){const t=this.item[this.options.classProp];return t?Array.isArray(t)?t:typeof a=="object"?[t]:[t]:[]},itemClasses(){const t=this.isDragging?["is-dragging"]:[];return[`nestable-item${this.isCopy?"-copy":""}`,`nestable-item${this.isCopy?"-copy":""}-${this.item[this.options.keyProp]}`,...t,...this.normalizedClassProp]}},methods:{onMouseEnter(t){if(!!this.options.dragItem){if(!t.movementY)return this.sendNotification(t);this.moveDown=t.movementY>0,this.breakPoint=t.target.getBoundingClientRect().height/2}},onMouseLeave(){this.breakPoint=null},onMouseMove(t){if(!this.breakPoint)return;const e=t.offsetY-this.breakPoint;this.moveDown&&e<this.breakPoint/4||!this.moveDown&&e>-this.breakPoint/4||this.sendNotification(t)},sendNotification(t){this.breakPoint=null;const e=this.item||this.$parent.item;this.notifyMouseEnter(this.group,t,this.listId,e)}}},O={key:0,class:"nestable-list"};function z(t,e,o,u,i,l){const h=s.resolveComponent("NestableItem",!0);return s.openBlock(),s.createElementBlock("li",{class:s.normalizeClass(l.itemClasses)},[s.createElementVNode("div",{class:"nestable-item-content",onMouseenter:e[0]||(e[0]=s.withModifiers((...m)=>l.onMouseEnter&&l.onMouseEnter(...m),["prevent"])),onMouseleave:e[1]||(e[1]=s.withModifiers((...m)=>l.onMouseLeave&&l.onMouseLeave(...m),["prevent"])),onMousemove:e[2]||(e[2]=s.withModifiers((...m)=>l.onMouseMove&&l.onMouseMove(...m),["prevent"]))},[s.renderSlot(t.$slots,"default",{index:o.index,item:o.item,isChild:o.isChild})],32),l.hasChildren?(s.openBlock(),s.createElementBlock("ol",O,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.item[o.options.childrenProp],(m,f)=>(s.openBlock(),s.createBlock(h,{key:m[l.keyProp],item:m,index:f,options:o.options,"is-copy":o.isCopy,"is-child":""},{default:s.withCtx(E=>[s.renderSlot(t.$slots,"default",s.normalizeProps(s.guardReactiveProps(E)))]),_:2},1032,["item","index","options","is-copy"]))),128))])):s.createCommentVNode("",!0)],2)}var H=C(Y,[["render",z]]);const X={name:"Placeholder",mixins:[S],props:{index:{type:Number,required:!1,default:null},options:{type:Object,required:!1,default:()=>({})}},inject:["listId","group"],computed:{isDragging(){return this.options.dragItem}},methods:{onMouseEnter(t){!this.options.dragItem||this.notifyMouseEnter(this.group,t,this.listId,null)}}};function F(t,e,o,u,i,l){return s.openBlock(),s.createElementBlock("li",null,[s.createElementVNode("div",{class:"nestable-list-empty",onMouseenter:e[0]||(e[0]=(...h)=>l.onMouseEnter&&l.onMouseEnter(...h))},[s.renderSlot(t.$slots,"default")],32)])}var W=C(X,[["render",F]]),K={methods:{getPathById(t,e=this.value){let o=[];return e.every((u,i)=>{if(u[this.keyProp]===t)o.push(i);else if(u[this.childrenProp]){const l=this.getPathById(t,u[this.childrenProp]);l.length&&(o=o.concat(i).concat(l))}return o.length===0}),o},getItemByPath(t,e=this.value){let o=null;return t.forEach(u=>{o=(o&&o[this.childrenProp]?o[this.childrenProp]:e)[u]}),o},getItemDepth(t){let e=1;if(t[this.childrenProp]&&t[this.childrenProp].length>0){const o=t[this.childrenProp].map(this.getItemDepth);e+=Math.max(...o)}return e},getSplicePath(t,e={}){const o={},u=e.numToRemove||0,i=e.itemsToInsert||[],l=t.length-1;let h=o;return t.forEach((m,f)=>{if(f===l)h.$splice=[[m,u,...i]];else{const E={};h[m]={[e.childrenProp]:E},h=E}}),o},getRealNextPath(t,e){const o=t.length-1,u=e.length-1;if(t.length<e.length){let i=!1;return e.map((l,h)=>i?h===u?l+1:l:typeof t[h]!="number"?l:e[h]>t[h]&&h===o?(i=!0,l-1):l)}else if(t.length===e.length&&e[u]>t[u]){const i=this.getItemByPath(e);if(i[this.childrenProp]&&i[this.childrenProp].length&&!this.isCollapsed(i))return e.slice(0,-1).concat(e[u]-1).concat(0)}return e}}},U={methods:{hook(t,e){if(!this.hooks[t])return!0;const o=this.hooks[t](e);return o||o===void 0}}};function J(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var B={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});function o(r){return typeof r=="object"&&!("toString"in r)?Object.prototype.toString.call(r).slice(8,-1):r}var u=typeof process=="object"&&!0;function i(r,n){if(!r)throw u?new Error("Invariant failed"):new Error(n())}e.invariant=i;var l=Object.prototype.hasOwnProperty,h=Array.prototype.splice,m=Object.prototype.toString;function f(r){return m.call(r).slice(8,-1)}var E=Object.assign||function(r,n){return v(n).forEach(function(d){l.call(n,d)&&(r[d]=n[d])}),r},v=typeof Object.getOwnPropertySymbols=="function"?function(r){return Object.keys(r).concat(Object.getOwnPropertySymbols(r))}:function(r){return Object.keys(r)};function D(r){return Array.isArray(r)?E(r.constructor(r.length),r):f(r)==="Map"?new Map(r):f(r)==="Set"?new Set(r):r&&typeof r=="object"?E(Object.create(Object.getPrototypeOf(r)),r):r}var L=function(){function r(){this.commands=E({},lt),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(n,d){return n===d},this.update.newContext=function(){return new r().update}}return Object.defineProperty(r.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(n){this.update.isEquals=n},enumerable:!0,configurable:!0}),r.prototype.extend=function(n,d){this.commands[n]=d},r.prototype.update=function(n,d){var p=this,c=typeof d=="function"?{$apply:d}:d;Array.isArray(n)&&Array.isArray(c)||i(!Array.isArray(c),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),i(typeof c=="object"&&c!==null,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(p.commands).join(", ")+".")});var y=n;return v(c).forEach(function(M){if(l.call(p.commands,M)){var pt=n===y;y=p.commands[M](c[M],y,c,n),pt&&p.isEquals(y,n)&&(y=n)}else{var w=f(n)==="Map"?p.update(n.get(M),c[M]):p.update(n[M],c[M]),ft=f(y)==="Map"?y.get(M):y[M];(!p.isEquals(w,ft)||typeof w=="undefined"&&!l.call(n,M))&&(y===n&&(y=D(n)),f(y)==="Map"?y.set(M,w):y[M]=w)}}),y},r}();e.Context=L;var lt={$push:function(r,n,d){return q(n,d,"$push"),r.length?n.concat(r):n},$unshift:function(r,n,d){return q(n,d,"$unshift"),r.length?r.concat(n):n},$splice:function(r,n,d,p){return ut(n,d),r.forEach(function(c){A(c),n===p&&c.length&&(n=D(p)),h.apply(n,c)}),n},$set:function(r,n,d){return dt(d),r},$toggle:function(r,n){I(r,"$toggle");var d=r.length?D(n):n;return r.forEach(function(p){d[p]=!n[p]}),d},$unset:function(r,n,d,p){return I(r,"$unset"),r.forEach(function(c){Object.hasOwnProperty.call(n,c)&&(n===p&&(n=D(p)),delete n[c])}),n},$add:function(r,n,d,p){return R(n,"$add"),I(r,"$add"),f(n)==="Map"?r.forEach(function(c){var y=c[0],M=c[1];n===p&&n.get(y)!==M&&(n=D(p)),n.set(y,M)}):r.forEach(function(c){n===p&&!n.has(c)&&(n=D(p)),n.add(c)}),n},$remove:function(r,n,d,p){return R(n,"$remove"),I(r,"$remove"),r.forEach(function(c){n===p&&n.has(c)&&(n=D(p)),n.delete(c)}),n},$merge:function(r,n,d,p){return ct(n,r),v(r).forEach(function(c){r[c]!==n[c]&&(n===p&&(n=D(p)),n[c]=r[c])}),n},$apply:function(r,n){return ht(r),r(n)}},b=new L;e.isEquals=b.update.isEquals,e.extend=b.extend,e.default=b.update,e.default.default=t.exports=E(e.default,e);function q(r,n,d){i(Array.isArray(r),function(){return"update(): expected target of "+o(d)+" to be an array; got "+o(r)+"."}),I(n[d],d)}function I(r,n){i(Array.isArray(r),function(){return"update(): expected spec of "+o(n)+" to be an array; got "+o(r)+". Did you forget to wrap your parameter in an array?"})}function ut(r,n){i(Array.isArray(r),function(){return"Expected $splice target to be an array; got "+o(r)}),A(n.$splice)}function A(r){i(Array.isArray(r),function(){return"update(): expected spec of $splice to be an array of arrays; got "+o(r)+". Did you forget to wrap your parameters in an array?"})}function ht(r){i(typeof r=="function",function(){return"update(): expected spec of $apply to be a function; got "+o(r)+"."})}function dt(r){i(Object.keys(r).length===1,function(){return"Cannot have more than one key in an object with $set"})}function ct(r,n){i(n&&typeof n=="object",function(){return"update(): $merge expects a spec of type 'object'; got "+o(n)}),i(r&&typeof r=="object",function(){return"update(): $merge expects a target of type 'object'; got "+o(r)})}function R(r,n){var d=f(r);i(d==="Map"||d==="Set",function(){return"update(): "+o(n)+" expects a target of type Set or Map; got "+o(d)})}})(B,B.exports);var _=J(B.exports);const Q=(t,e)=>t.closest(e),Z=t=>{var e=t.getBoundingClientRect();return{top:Math.round(e.top),left:Math.round(e.left)}},j=(t,e)=>({transform:"translate("+t+"px, "+e+"px)"}),N=(t,e)=>t.map(o=>G(k({},o),{[e]:o[e]?N(o[e],e):[]})),tt={name:"VueNestable",components:{NestableItem:H,Placeholder:W},mixins:[K,S,U],props:{value:{type:Array,required:!0,default:()=>[]},threshold:{type:Number,required:!1,default:30},maxDepth:{type:Number,required:!1,default:10},keyProp:{type:String,required:!1,default:"id"},classProp:{type:String,required:!1,default:null},group:{type:[String,Number],required:!1,default:()=>Math.random().toString(36).slice(2)},childrenProp:{type:String,required:!1,default:"children"},collapsed:{type:Boolean,required:!1,default:!1},hooks:{type:Object,required:!1,default:()=>({})},rtl:{type:Boolean,required:!1,default:!1}},provide(){return{listId:this.listId,group:this.group,keyProp:this.keyProp,onDragEnd:this.onDragEnd}},data(){return{itemsOld:null,dragItem:null,mouse:{last:{x:0},shift:{x:0}},el:null,elCopyStyles:null,isDirty:!1,collapsedGroups:[],listId:Math.random().toString(36).slice(2)}},computed:{listIsEmpty(){return this.value.length===0},itemOptions(){return{dragItem:this.dragItem,keyProp:this.keyProp,classProp:this.classProp,childrenProp:this.childrenProp}},listStyles(){const t=document.querySelector(".nestable-"+this.group+" .nestable-item-"+this.dragItem[this.keyProp]);let e={};return t&&(e.width=`${t.clientWidth}px`),this.elCopyStyles&&(e=k(k({},e),this.elCopyStyles)),e}},created(){const t=N(this.value,this.childrenProp);this.$emit("input",t),this.isDirty=!1,this.registerNestable(this)},beforeDestroy(){this.stopTrackMouse()},methods:{startTrackMouse(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onDragEnd),document.addEventListener("touchend",this.onDragEnd),document.addEventListener("touchcancel",this.onDragEnd),document.addEventListener("keydown",this.onKeyDown)},stopTrackMouse(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onDragEnd),document.removeEventListener("touchend",this.onDragEnd),document.removeEventListener("touchcancel",this.onDragEnd),document.removeEventListener("keydown",this.onKeyDown),this.elCopyStyles=null},onDragStart(t,e){t&&(t.preventDefault(),t.stopPropagation()),this.el=Q(t.target,".nestable-item"),this.startTrackMouse(),this.dragItem=e,this.itemsOld=this.value,this.$nextTick(()=>{this.onMouseMove(t)})},onDragEnd(t,e){t&&t.preventDefault(),this.stopTrackMouse(),this.el=null,e?this.dragRevert():this.dragApply()},onKeyDown(t){t.which===27&&this.onDragEnd(null,!0)},getXandYFromEvent(t){let{clientX:e,clientY:o}=t;const{targetTouches:u}=t;if(u){const i=u[0];e=i.clientX,o=i.clientY;const l=new Event("mouseenter"),h=document.elementFromPoint(e,o),m=h&&(h.closest(".nestable-item-content")||h.closest(".nestable-list-empty"));m&&m.dispatchEvent(l)}return{clientX:e,clientY:o}},onMouseMove(t){t&&t.preventDefault();const{clientX:e,clientY:o}=this.getXandYFromEvent(t);this.mouse.last.x===0&&(this.mouse.last.x=e);const u=j(e,o),i=document.querySelector(".nestable-"+this.group+" .nestable-drag-layer");if(!i)return;const{top:l,left:h}=i.getBoundingClientRect(),m=document.querySelector(".nestable-"+this.group+" .nestable-drag-layer > .nestable-list");if(this.elCopyStyles){if(this.elCopyStyles=k(k({},this.elCopyStyles),u),m)for(const E in u)Object.prototype.hasOwnProperty.call(u,E)&&(m.style[E]=u[E]);const f=this.rtl?this.mouse.last.x-e:e-this.mouse.last.x;f>=0&&this.mouse.shift.x>=0||f<=0&&this.mouse.shift.x<=0?this.mouse.shift.x+=f:this.mouse.shift.x=0,this.mouse.last.x=e,Math.abs(this.mouse.shift.x)>this.threshold&&(this.mouse.shift.x>0?this.tryIncreaseDepth(this.dragItem):this.tryDecreaseDepth(this.dragItem),this.mouse.shift.x=0)}else{const f=Z(this.el);this.elCopyStyles=k({marginTop:`${f.top-o-l}px`,marginLeft:`${f.left-e-h}px`},u)}},moveItem({dragItem:t,pathFrom:e,pathTo:o}){const u=this.getRealNextPath(e,o),i=this.getSplicePath(e,{numToRemove:1,childrenProp:this.childrenProp}),l=this.getSplicePath(u,{numToRemove:0,itemsToInsert:[t],childrenProp:this.childrenProp});if(!this.hook("beforeMove",{dragItem:t,pathFrom:e,pathTo:u}))return;let h=this.value;h=_(h,i),h=_(h,l),this.isDirty=!0,this.pathTo=u,this.$emit("input",h)},tryIncreaseDepth(t){const e=this.getPathById(t[this.keyProp]),o=e[e.length-1],u=e.length+this.getItemDepth(t);if(o>0&&u<=this.maxDepth){const i=this.getItemByPath(e.slice(0,-1).concat(o-1));if(i[this.childrenProp]&&(!i[this.childrenProp].length||!this.isCollapsed(i))){const l=e.slice(0,-1).concat(o-1).concat(i[this.childrenProp].length);this.moveItem({dragItem:t,pathFrom:e,pathTo:l})}}},tryDecreaseDepth(t){const e=this.getPathById(t[this.keyProp]),o=e[e.length-1];if(e.length>1){const u=this.getItemByPath(e.slice(0,-1));if(o+1===u[this.childrenProp].length){const i=e.slice(0,-1);i[i.length-1]+=1,this.moveItem({dragItem:t,pathFrom:e,pathTo:i})}}},onMouseEnter(t,e,o){t&&(t.preventDefault(),t.stopPropagation());const u=this.dragItem;if(!u||o!==null&&u[this.keyProp]===o[this.keyProp])return;const i=this.getPathById(u[this.keyProp]);if(e!==this.listId&&i.length===0)return;let l;if(o===null?l=i.length>0?[]:[0]:l=this.getPathById(o[this.keyProp]),this.getRealNextPath(i,l).length+(this.getItemDepth(u)-1)>this.maxDepth)return;let m={};if(this.collapsed&&i.length>1){const f=this.getItemByPath(i.slice(0,-1));f[this.childrenProp].length===1&&(m=this.onToggleCollapse(f,!0))}this.moveItem({dragItem:u,pathFrom:i,pathTo:l},m)},isCollapsed(t){return!!(this.collapsedGroups.indexOf(t[this.keyProp])>-1^this.collapsed)},dragApply(){this.$emit("change",this.dragItem,{items:this.value,pathTo:this.pathTo}),this.pathTo=null,this.itemsOld=null,this.dragItem=null,this.isDirty=!1},dragRevert(){this.$emit("input",this.itemsOld),this.pathTo=null,this.itemsOld=null,this.dragItem=null,this.isDirty=!1}}},et={class:"nestable-list nestable-group"},rt=s.createTextVNode(" No content "),nt={key:0,class:"nestable-drag-layer"};function st(t,e,o,u,i,l){const h=s.resolveComponent("Placeholder"),m=s.resolveComponent("NestableItem");return s.openBlock(),s.createElementBlock("div",{class:s.normalizeClass(["nestable",`nestable-${o.group}`,o.rtl?"nestable-rtl":""])},[s.createElementVNode("ol",et,[l.listIsEmpty?(s.openBlock(),s.createBlock(h,{key:0,options:l.itemOptions},{default:s.withCtx(()=>[s.renderSlot(t.$slots,"placeholder",{},()=>[rt])]),_:3},8,["options"])):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,(f,E)=>(s.openBlock(),s.createBlock(m,{key:f[o.keyProp],index:E,item:f,options:l.itemOptions},{default:s.withCtx(v=>[s.renderSlot(t.$slots,"default",s.normalizeProps(s.guardReactiveProps(v)))]),_:2},1032,["index","item","options"]))),128))]),i.dragItem?(s.openBlock(),s.createElementBlock("div",nt,[s.createElementVNode("ol",{style:s.normalizeStyle(l.listStyles),class:"nestable-list"},[s.createVNode(m,{item:i.dragItem,options:l.itemOptions,"is-copy":!0},{default:s.withCtx(f=>[s.renderSlot(t.$slots,"default",s.normalizeProps(s.guardReactiveProps(f)))]),_:3},8,["item","options"])],4)])):s.createCommentVNode("",!0)],2)}var T=C(tt,[["render",st]]);const ot={name:"VueNestableHandle",mixins:[S],props:{item:{type:Object,required:!1,default:()=>({})}},inject:["group","onDragEnd"],methods:{isEmpty(t){if(t==null)return!0;if(t.length>0)return!1;if(t.length===0)return!0;for(var e in t)if(hasOwnProperty.call(t,e))return!1;return!0},dragstart(t){const e=this.isEmpty(this.item)?this.$parent.item:this.item;this.notifyDragStart(this.group,t,e)},touchend(t){console.log(t),this.onDragEnd(t)},touchmove(t){console.log(t),this.notifyMouseMove(this.group,t)}}};function it(t,e,o,u,i,l){return s.openBlock(),s.createElementBlock("div",{draggable:"true",class:"nestable-handle",onDragstart:e[0]||(e[0]=s.withModifiers((...h)=>l.dragstart&&l.dragstart(...h),["prevent"])),onTouchstart:e[1]||(e[1]=s.withModifiers((...h)=>l.dragstart&&l.dragstart(...h),["prevent"])),onTouchend:e[2]||(e[2]=s.withModifiers((...h)=>l.touchend&&l.touchend(...h),["prevent"])),onTouchmove:e[3]||(e[3]=s.withModifiers((...h)=>l.touchmove&&l.touchmove(...h),["prevent"]))},[s.renderSlot(t.$slots,"default")],32)}var $=C(ot,[["render",it]]),at={install:function(t){t.component("VueNestable",T),t.component("VueNestableHandle",$)}};g.VueNestable=T,g.VueNestableHandle=$,g.default=at,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(g,o){typeof exports=="object"&&typeof module!="undefined"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(g=typeof globalThis!="undefined"?globalThis:g||self,o(g.VueNestable={},g.Vue))})(this,function(g,o){"use strict";var mt=Object.defineProperty,gt=Object.defineProperties;var yt=Object.getOwnPropertyDescriptors;var V=Object.getOwnPropertySymbols;var Pt=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable;var x=(g,o,P)=>o in g?mt(g,o,{enumerable:!0,configurable:!0,writable:!0,value:P}):g[o]=P,k=(g,o)=>{for(var P in o||(o={}))Pt.call(o,P)&&x(g,P,o[P]);if(V)for(var P of V(o))Et.call(o,P)&&x(g,P,o[P]);return g},G=(g,o)=>gt(g,yt(o));const P={};var S={methods:{registerNestable(t){const e=this._getByGroup(t.group);e.onDragStartListeners.push(t.onDragStart),e.onMouseEnterListeners.push(t.onMouseEnter),e.onMouseMoveListeners.push(t.onMouseMove)},notifyDragStart(t,e,s){const u=this._getByGroup(t);for(const i of u.onDragStartListeners)i(e,s)},notifyMouseEnter(t,e,s,u){const i=this._getByGroup(t);for(const l of i.onMouseEnterListeners)l(e,s,u)},notifyMouseMove(t,e){const s=this._getByGroup(t);for(const u of s.onMouseMoveListeners)u(e)},_getByGroup(t){return P[t]||(P[t]={onDragStartListeners:[],onMouseEnterListeners:[],onMouseMoveListeners:[],onDragStart:[],dragItem:null}),P[t]}}},C=(t,e)=>{const s=t.__vccOpts||t;for(const[u,i]of e)s[u]=i;return s};const Y={name:"NestableItem",mixins:[S],props:{item:{type:Object,required:!0,default:()=>({})},index:{type:Number,required:!1,default:null},isChild:{type:Boolean,required:!1,default:!1},isCopy:{type:Boolean,required:!1,default:!1},options:{type:Object,required:!0,default:()=>({})}},inject:["listId","group","keyProp"],data(){return{breakPoint:null,moveDown:!1}},computed:{isDragging(){const t=this.options.dragItem;return!this.isCopy&&t&&t[this.options.keyProp]===this.item[this.options.keyProp]},hasChildren(){return this.item[this.options.childrenProp]&&this.item[this.options.childrenProp].length>0},hasHandle(){return!!this.$scopedSlots.handler},normalizedClassProp(){const t=this.item[this.options.classProp];return t?Array.isArray(t)?t:typeof a=="object"?[t]:[t]:[]},itemClasses(){const t=this.isDragging?["is-dragging"]:[];return[`nestable-item${this.isCopy?"-copy":""}`,`nestable-item${this.isCopy?"-copy":""}-${this.item[this.options.keyProp]}`,...t,...this.normalizedClassProp]}},methods:{onMouseEnter(t){if(!!this.options.dragItem){if(!t.movementY)return this.sendNotification(t);this.moveDown=t.movementY>0,this.breakPoint=t.target.getBoundingClientRect().height/2}},onMouseLeave(){this.breakPoint=null},onMouseMove(t){if(!this.breakPoint)return;const e=t.offsetY-this.breakPoint;this.moveDown&&e<this.breakPoint/4||!this.moveDown&&e>-this.breakPoint/4||this.sendNotification(t)},sendNotification(t){this.breakPoint=null;const e=this.item||this.$parent.item;this.notifyMouseEnter(this.group,t,this.listId,e)}}},O={key:0,class:"nestable-list"};function z(t,e,s,u,i,l){const h=o.resolveComponent("NestableItem",!0);return o.openBlock(),o.createElementBlock("li",{class:o.normalizeClass(l.itemClasses)},[o.createElementVNode("div",{class:"nestable-item-content",onMouseenter:e[0]||(e[0]=(...m)=>l.onMouseEnter&&l.onMouseEnter(...m)),onMouseleave:e[1]||(e[1]=(...m)=>l.onMouseLeave&&l.onMouseLeave(...m)),onMousemove:e[2]||(e[2]=(...m)=>l.onMouseMove&&l.onMouseMove(...m))},[o.renderSlot(t.$slots,"default",{index:s.index,item:s.item,isChild:s.isChild})],32),l.hasChildren?(o.openBlock(),o.createElementBlock("ol",O,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.item[s.options.childrenProp],(m,f)=>(o.openBlock(),o.createBlock(h,{key:m[l.keyProp],item:m,index:f,options:s.options,"is-copy":s.isCopy,"is-child":""},{default:o.withCtx(E=>[o.renderSlot(t.$slots,"default",o.normalizeProps(o.guardReactiveProps(E)))]),_:2},1032,["item","index","options","is-copy"]))),128))])):o.createCommentVNode("",!0)],2)}var H=C(Y,[["render",z]]);const X={name:"Placeholder",mixins:[S],props:{index:{type:Number,required:!1,default:null},options:{type:Object,required:!1,default:()=>({})}},inject:["listId","group"],computed:{isDragging(){return this.options.dragItem}},methods:{onMouseEnter(t){!this.options.dragItem||this.notifyMouseEnter(this.group,t,this.listId,null)}}};function F(t,e,s,u,i,l){return o.openBlock(),o.createElementBlock("li",null,[o.createElementVNode("div",{class:"nestable-list-empty",onMouseenter:e[0]||(e[0]=(...h)=>l.onMouseEnter&&l.onMouseEnter(...h))},[o.renderSlot(t.$slots,"default")],32)])}var W=C(X,[["render",F]]),K={methods:{getPathById(t,e=this.value){let s=[];return e.every((u,i)=>{if(u[this.keyProp]===t)s.push(i);else if(u[this.childrenProp]){const l=this.getPathById(t,u[this.childrenProp]);l.length&&(s=s.concat(i).concat(l))}return s.length===0}),s},getItemByPath(t,e=this.value){let s=null;return t.forEach(u=>{s=(s&&s[this.childrenProp]?s[this.childrenProp]:e)[u]}),s},getItemDepth(t){let e=1;if(t[this.childrenProp]&&t[this.childrenProp].length>0){const s=t[this.childrenProp].map(this.getItemDepth);e+=Math.max(...s)}return e},getSplicePath(t,e={}){const s={},u=e.numToRemove||0,i=e.itemsToInsert||[],l=t.length-1;let h=s;return t.forEach((m,f)=>{if(f===l)h.$splice=[[m,u,...i]];else{const E={};h[m]={[e.childrenProp]:E},h=E}}),s},getRealNextPath(t,e){const s=t.length-1,u=e.length-1;if(t.length<e.length){let i=!1;return e.map((l,h)=>i?h===u?l+1:l:typeof t[h]!="number"?l:e[h]>t[h]&&h===s?(i=!0,l-1):l)}else if(t.length===e.length&&e[u]>t[u]){const i=this.getItemByPath(e);if(i[this.childrenProp]&&i[this.childrenProp].length&&!this.isCollapsed(i))return e.slice(0,-1).concat(e[u]-1).concat(0)}return e}}},U={methods:{hook(t,e){if(!this.hooks[t])return!0;const s=this.hooks[t](e);return s||s===void 0}}};function J(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w={exports:{}};(function(t,e){Object.defineProperty(e,"__esModule",{value:!0});function s(n){return typeof n=="object"&&!("toString"in n)?Object.prototype.toString.call(n).slice(8,-1):n}var u=typeof process=="object"&&!0;function i(n,r){if(!n)throw u?new Error("Invariant failed"):new Error(r())}e.invariant=i;var l=Object.prototype.hasOwnProperty,h=Array.prototype.splice,m=Object.prototype.toString;function f(n){return m.call(n).slice(8,-1)}var E=Object.assign||function(n,r){return v(r).forEach(function(c){l.call(r,c)&&(n[c]=r[c])}),n},v=typeof Object.getOwnPropertySymbols=="function"?function(n){return Object.keys(n).concat(Object.getOwnPropertySymbols(n))}:function(n){return Object.keys(n)};function D(n){return Array.isArray(n)?E(n.constructor(n.length),n):f(n)==="Map"?new Map(n):f(n)==="Set"?new Set(n):n&&typeof n=="object"?E(Object.create(Object.getPrototypeOf(n)),n):n}var L=function(){function n(){this.commands=E({},lt),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(r,c){return r===c},this.update.newContext=function(){return new n().update}}return Object.defineProperty(n.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(r){this.update.isEquals=r},enumerable:!0,configurable:!0}),n.prototype.extend=function(r,c){this.commands[r]=c},n.prototype.update=function(r,c){var p=this,d=typeof c=="function"?{$apply:c}:c;Array.isArray(r)&&Array.isArray(d)||i(!Array.isArray(d),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),i(typeof d=="object"&&d!==null,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(p.commands).join(", ")+".")});var y=r;return v(d).forEach(function(M){if(l.call(p.commands,M)){var pt=r===y;y=p.commands[M](d[M],y,d,r),pt&&p.isEquals(y,r)&&(y=r)}else{var B=f(r)==="Map"?p.update(r.get(M),d[M]):p.update(r[M],d[M]),ft=f(y)==="Map"?y.get(M):y[M];(!p.isEquals(B,ft)||typeof B=="undefined"&&!l.call(r,M))&&(y===r&&(y=D(r)),f(y)==="Map"?y.set(M,B):y[M]=B)}}),y},n}();e.Context=L;var lt={$push:function(n,r,c){return q(r,c,"$push"),n.length?r.concat(n):r},$unshift:function(n,r,c){return q(r,c,"$unshift"),n.length?n.concat(r):r},$splice:function(n,r,c,p){return ut(r,c),n.forEach(function(d){A(d),r===p&&d.length&&(r=D(p)),h.apply(r,d)}),r},$set:function(n,r,c){return ct(c),n},$toggle:function(n,r){I(n,"$toggle");var c=n.length?D(r):r;return n.forEach(function(p){c[p]=!r[p]}),c},$unset:function(n,r,c,p){return I(n,"$unset"),n.forEach(function(d){Object.hasOwnProperty.call(r,d)&&(r===p&&(r=D(p)),delete r[d])}),r},$add:function(n,r,c,p){return R(r,"$add"),I(n,"$add"),f(r)==="Map"?n.forEach(function(d){var y=d[0],M=d[1];r===p&&r.get(y)!==M&&(r=D(p)),r.set(y,M)}):n.forEach(function(d){r===p&&!r.has(d)&&(r=D(p)),r.add(d)}),r},$remove:function(n,r,c,p){return R(r,"$remove"),I(n,"$remove"),n.forEach(function(d){r===p&&r.has(d)&&(r=D(p)),r.delete(d)}),r},$merge:function(n,r,c,p){return dt(r,n),v(n).forEach(function(d){n[d]!==r[d]&&(r===p&&(r=D(p)),r[d]=n[d])}),r},$apply:function(n,r){return ht(n),n(r)}},b=new L;e.isEquals=b.update.isEquals,e.extend=b.extend,e.default=b.update,e.default.default=t.exports=E(e.default,e);function q(n,r,c){i(Array.isArray(n),function(){return"update(): expected target of "+s(c)+" to be an array; got "+s(n)+"."}),I(r[c],c)}function I(n,r){i(Array.isArray(n),function(){return"update(): expected spec of "+s(r)+" to be an array; got "+s(n)+". Did you forget to wrap your parameter in an array?"})}function ut(n,r){i(Array.isArray(n),function(){return"Expected $splice target to be an array; got "+s(n)}),A(r.$splice)}function A(n){i(Array.isArray(n),function(){return"update(): expected spec of $splice to be an array of arrays; got "+s(n)+". Did you forget to wrap your parameters in an array?"})}function ht(n){i(typeof n=="function",function(){return"update(): expected spec of $apply to be a function; got "+s(n)+"."})}function ct(n){i(Object.keys(n).length===1,function(){return"Cannot have more than one key in an object with $set"})}function dt(n,r){i(r&&typeof r=="object",function(){return"update(): $merge expects a spec of type 'object'; got "+s(r)}),i(n&&typeof n=="object",function(){return"update(): $merge expects a target of type 'object'; got "+s(n)})}function R(n,r){var c=f(n);i(c==="Map"||c==="Set",function(){return"update(): "+s(r)+" expects a target of type Set or Map; got "+s(c)})}})(w,w.exports);var _=J(w.exports);const Q=(t,e)=>t.closest(e),Z=t=>{var e=t.getBoundingClientRect();return{top:Math.round(e.top),left:Math.round(e.left)}},j=(t,e)=>({transform:"translate("+t+"px, "+e+"px)"}),N=(t,e)=>t.map(s=>G(k({},s),{[e]:s[e]?N(s[e],e):[]})),tt={name:"VueNestable",components:{NestableItem:H,Placeholder:W},mixins:[K,S,U],props:{value:{type:Array,required:!0,default:()=>[]},threshold:{type:Number,required:!1,default:30},maxDepth:{type:Number,required:!1,default:10},keyProp:{type:String,required:!1,default:"id"},classProp:{type:String,required:!1,default:null},group:{type:[String,Number],required:!1,default:()=>Math.random().toString(36).slice(2)},childrenProp:{type:String,required:!1,default:"children"},collapsed:{type:Boolean,required:!1,default:!1},hooks:{type:Object,required:!1,default:()=>({})},rtl:{type:Boolean,required:!1,default:!1}},provide(){return{listId:this.listId,group:this.group,keyProp:this.keyProp,onDragEnd:this.onDragEnd}},data(){return{itemsOld:null,dragItem:null,mouse:{last:{x:0},shift:{x:0}},el:null,elCopyStyles:null,isDirty:!1,collapsedGroups:[],listId:Math.random().toString(36).slice(2)}},computed:{listIsEmpty(){return this.value.length===0},itemOptions(){return{dragItem:this.dragItem,keyProp:this.keyProp,classProp:this.classProp,childrenProp:this.childrenProp}},listStyles(){const t=document.querySelector(".nestable-"+this.group+" .nestable-item-"+this.dragItem[this.keyProp]);let e={};return t&&(e.width=`${t.clientWidth}px`),this.elCopyStyles&&(e=k(k({},e),this.elCopyStyles)),e}},created(){const t=N(this.value,this.childrenProp);this.$emit("input",t),this.isDirty=!1,this.registerNestable(this)},beforeDestroy(){this.stopTrackMouse()},methods:{startTrackMouse(){document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onDragEnd),document.addEventListener("touchend",this.onDragEnd),document.addEventListener("touchcancel",this.onDragEnd),document.addEventListener("keydown",this.onKeyDown)},stopTrackMouse(){document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onDragEnd),document.removeEventListener("touchend",this.onDragEnd),document.removeEventListener("touchcancel",this.onDragEnd),document.removeEventListener("keydown",this.onKeyDown),this.elCopyStyles=null},onDragStart(t,e){t&&(t.preventDefault(),t.stopPropagation()),this.el=Q(t.target,".nestable-item"),this.startTrackMouse(),this.dragItem=e,this.itemsOld=this.value,this.$nextTick(()=>{this.onMouseMove(t)})},onDragEnd(t,e){t&&t.preventDefault(),this.stopTrackMouse(),this.el=null,e?this.dragRevert():this.dragApply()},onKeyDown(t){t.which===27&&this.onDragEnd(null,!0)},getXandYFromEvent(t){let{clientX:e,clientY:s}=t;const{targetTouches:u}=t;if(u){const i=u[0];e=i.clientX,s=i.clientY;const l=new Event("mouseenter"),h=document.elementFromPoint(e,s),m=h&&(h.closest(".nestable-item-content")||h.closest(".nestable-list-empty"));m&&m.dispatchEvent(l)}return{clientX:e,clientY:s}},onMouseMove(t){t&&t.preventDefault();const{clientX:e,clientY:s}=this.getXandYFromEvent(t);this.mouse.last.x===0&&(this.mouse.last.x=e);const u=j(e,s),i=document.querySelector(".nestable-"+this.group+" .nestable-drag-layer");if(!i)return;const{top:l,left:h}=i.getBoundingClientRect(),m=document.querySelector(".nestable-"+this.group+" .nestable-drag-layer > .nestable-list");if(this.elCopyStyles){if(this.elCopyStyles=k(k({},this.elCopyStyles),u),m)for(const E in u)Object.prototype.hasOwnProperty.call(u,E)&&(m.style[E]=u[E]);const f=this.rtl?this.mouse.last.x-e:e-this.mouse.last.x;f>=0&&this.mouse.shift.x>=0||f<=0&&this.mouse.shift.x<=0?this.mouse.shift.x+=f:this.mouse.shift.x=0,this.mouse.last.x=e,Math.abs(this.mouse.shift.x)>this.threshold&&(this.mouse.shift.x>0?this.tryIncreaseDepth(this.dragItem):this.tryDecreaseDepth(this.dragItem),this.mouse.shift.x=0)}else{const f=Z(this.el);this.elCopyStyles=k({marginTop:`${f.top-s-l}px`,marginLeft:`${f.left-e-h}px`},u)}},moveItem({dragItem:t,pathFrom:e,pathTo:s}){const u=this.getRealNextPath(e,s),i=this.getSplicePath(e,{numToRemove:1,childrenProp:this.childrenProp}),l=this.getSplicePath(u,{numToRemove:0,itemsToInsert:[t],childrenProp:this.childrenProp});if(!this.hook("beforeMove",{dragItem:t,pathFrom:e,pathTo:u}))return;let h=this.value;h=_(h,i),h=_(h,l),this.isDirty=!0,this.pathTo=u,this.$emit("input",h)},tryIncreaseDepth(t){const e=this.getPathById(t[this.keyProp]),s=e[e.length-1],u=e.length+this.getItemDepth(t);if(s>0&&u<=this.maxDepth){const i=this.getItemByPath(e.slice(0,-1).concat(s-1));if(i[this.childrenProp]&&(!i[this.childrenProp].length||!this.isCollapsed(i))){const l=e.slice(0,-1).concat(s-1).concat(i[this.childrenProp].length);this.moveItem({dragItem:t,pathFrom:e,pathTo:l})}}},tryDecreaseDepth(t){const e=this.getPathById(t[this.keyProp]),s=e[e.length-1];if(e.length>1){const u=this.getItemByPath(e.slice(0,-1));if(s+1===u[this.childrenProp].length){const i=e.slice(0,-1);i[i.length-1]+=1,this.moveItem({dragItem:t,pathFrom:e,pathTo:i})}}},onMouseEnter(t,e,s){t&&(t.preventDefault(),t.stopPropagation());const u=this.dragItem;if(!u||s!==null&&u[this.keyProp]===s[this.keyProp])return;const i=this.getPathById(u[this.keyProp]);if(e!==this.listId&&i.length===0)return;let l;if(s===null?l=i.length>0?[]:[0]:l=this.getPathById(s[this.keyProp]),this.getRealNextPath(i,l).length+(this.getItemDepth(u)-1)>this.maxDepth)return;let m={};if(this.collapsed&&i.length>1){const f=this.getItemByPath(i.slice(0,-1));f[this.childrenProp].length===1&&(m=this.onToggleCollapse(f,!0))}this.moveItem({dragItem:u,pathFrom:i,pathTo:l},m)},isCollapsed(t){return!!(this.collapsedGroups.indexOf(t[this.keyProp])>-1^this.collapsed)},dragApply(){this.$emit("change",this.dragItem,{items:this.value,pathTo:this.pathTo}),this.pathTo=null,this.itemsOld=null,this.dragItem=null,this.isDirty=!1},dragRevert(){this.$emit("input",this.itemsOld),this.pathTo=null,this.itemsOld=null,this.dragItem=null,this.isDirty=!1}}},et={class:"nestable-list nestable-group"},nt=o.createTextVNode(" No content "),rt={key:0,class:"nestable-drag-layer"};function st(t,e,s,u,i,l){const h=o.resolveComponent("Placeholder"),m=o.resolveComponent("NestableItem");return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["nestable",`nestable-${s.group}`,s.rtl?"nestable-rtl":""])},[o.createElementVNode("ol",et,[l.listIsEmpty?(o.openBlock(),o.createBlock(h,{key:0,options:l.itemOptions},{default:o.withCtx(()=>[o.renderSlot(t.$slots,"placeholder",{},()=>[nt])]),_:3},8,["options"])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,(f,E)=>(o.openBlock(),o.createBlock(m,{key:f[s.keyProp],index:E,item:f,options:l.itemOptions},{default:o.withCtx(v=>[o.renderSlot(t.$slots,"default",o.normalizeProps(o.guardReactiveProps(v)))]),_:2},1032,["index","item","options"]))),128))]),i.dragItem?(o.openBlock(),o.createElementBlock("div",rt,[o.createElementVNode("ol",{style:o.normalizeStyle(l.listStyles),class:"nestable-list"},[o.createVNode(m,{item:i.dragItem,options:l.itemOptions,"is-copy":!0},{default:o.withCtx(f=>[o.renderSlot(t.$slots,"default",o.normalizeProps(o.guardReactiveProps(f)))]),_:3},8,["item","options"])],4)])):o.createCommentVNode("",!0)],2)}var T=C(tt,[["render",st]]);const ot={name:"VueNestableHandle",mixins:[S],props:{item:{type:Object,required:!1,default:()=>({})}},inject:["group","onDragEnd"],methods:{isEmpty(t){if(t==null)return!0;if(t.length>0)return!1;if(t.length===0)return!0;for(var e in t)if(hasOwnProperty.call(t,e))return!1;return!0},dragstart(t){const e=this.isEmpty(this.item)?this.$parent.item:this.item;this.notifyDragStart(this.group,t,e)},touchend(t){console.log(t),this.onDragEnd(t)},touchmove(t){console.log(t),this.notifyMouseMove(this.group,t)}}};function it(t,e,s,u,i,l){return o.openBlock(),o.createElementBlock("div",{draggable:"true",class:"nestable-handle",onDragstart:e[0]||(e[0]=(...h)=>l.dragstart&&l.dragstart(...h)),onTouchstart:e[1]||(e[1]=(...h)=>l.dragstart&&l.dragstart(...h)),onTouchend:e[2]||(e[2]=(...h)=>l.touchend&&l.touchend(...h)),onTouchmove:e[3]||(e[3]=(...h)=>l.touchmove&&l.touchmove(...h))},[o.renderSlot(t.$slots,"default")],32)}var $=C(ot,[["render",it]]),at={install:function(t){t.component("VueNestable",T),t.component("VueNestableHandle",$)}};g.VueNestable=T,g.VueNestableHandle=$,g.default=at,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "fbki-vue3-nestable", | ||
"version": "3.0.10", | ||
"version": "3.0.11", | ||
"description": "A simple drag & drop hierarchical list made as a vue component.", | ||
@@ -5,0 +5,0 @@ "author": "Maxim Manchakkay <mxmaster1203@live.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141096
1590