sortablejs-vue3
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -58,3 +58,5 @@ import { defineComponent, ref, computed, watch, onUnmounted, openBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, createElementBlock, Fragment, renderList, renderSlot, unref } from "vue"; | ||
if (options && sortable?.value) { | ||
sortable.value.options = { ...sortable.value.options, ...options }; | ||
for (const property in options) { | ||
sortable.value.option(property, options[property]); | ||
} | ||
} | ||
@@ -61,0 +63,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("vue"),require("sortablejs")):"function"==typeof define&&define.amd?define(["exports","vue","sortablejs"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["SortableJS-Vue3"]={},e.Vue,e.Sortable)}(this,(function(e,o,t){"use strict";const n=(e=>e&&"object"==typeof e&&"default"in e?e:{default:e})(t),l=o.defineComponent({__name:"Sortable",props:{options:{type:Object,default:null,required:!1},list:{type:Array,default:[],required:!0},itemKey:{type:[String,Function],default:"",required:!0},tag:{type:String,default:"div",required:!1}},emits:["choose","unchoose","start","end","add","update","sort","remove","filter","move","clone","change"],setup(e,{emit:t}){const l=e,r=o.ref(null),a=o.ref(null),s=o.computed((()=>"string"==typeof l.itemKey?e=>e[l.itemKey]:l.itemKey));return o.watch(r,(e=>{e&&(a.value=new n.default(e,{...l.options,onChoose:e=>t("choose",e),onUnchoose:e=>t("unchoose",e),onStart:e=>t("start",e),onEnd:e=>t("end",e),onAdd:e=>t("add",e),onUpdate:e=>t("update",e),onSort:e=>t("sort",e),onRemove:e=>t("remove",e),onFilter:e=>t("filter",e),onMove:(e,o)=>t("move",e,o),onClone:e=>t("clone",e),onChange:e=>t("change",e)}))})),o.watch((()=>l.options),(e=>{e&&a?.value&&(a.value.options={...a.value.options,...e})})),o.onUnmounted((()=>{a.value&&(a.value.destroy(),r.value=null,a.value=null)})),(t,n)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(t.$props.tag),{ref_key:"containerRef",ref:r,class:o.normalizeClass(t.$props.class)},{default:o.withCtx((()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.list,((e,n)=>o.renderSlot(t.$slots,"item",{key:o.unref(s)(e),element:e,index:n}))),128))])),_:3},8,["class"]))}});e.Sortable=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports,require("vue"),require("sortablejs")):"function"==typeof define&&define.amd?define(["exports","vue","sortablejs"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self)["SortableJS-Vue3"]={},e.Vue,e.Sortable)}(this,(function(e,o,t){"use strict";const n=(e=>e&&"object"==typeof e&&"default"in e?e:{default:e})(t),l=o.defineComponent({__name:"Sortable",props:{options:{type:Object,default:null,required:!1},list:{type:Array,default:[],required:!0},itemKey:{type:[String,Function],default:"",required:!0},tag:{type:String,default:"div",required:!1}},emits:["choose","unchoose","start","end","add","update","sort","remove","filter","move","clone","change"],setup(e,{emit:t}){const l=e,r=o.ref(null),a=o.ref(null),i=o.computed((()=>"string"==typeof l.itemKey?e=>e[l.itemKey]:l.itemKey));return o.watch(r,(e=>{e&&(a.value=new n.default(e,{...l.options,onChoose:e=>t("choose",e),onUnchoose:e=>t("unchoose",e),onStart:e=>t("start",e),onEnd:e=>t("end",e),onAdd:e=>t("add",e),onUpdate:e=>t("update",e),onSort:e=>t("sort",e),onRemove:e=>t("remove",e),onFilter:e=>t("filter",e),onMove:(e,o)=>t("move",e,o),onClone:e=>t("clone",e),onChange:e=>t("change",e)}))})),o.watch((()=>l.options),(e=>{if(e&&a?.value)for(const o in e)a.value.option(o,e[o])})),o.onUnmounted((()=>{a.value&&(a.value.destroy(),r.value=null,a.value=null)})),(t,n)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(t.$props.tag),{ref_key:"containerRef",ref:r,class:o.normalizeClass(t.$props.class)},{default:o.withCtx((()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.list,((e,n)=>o.renderSlot(t.$slots,"item",{key:o.unref(i)(e),element:e,index:n}))),128))])),_:3},8,["class"]))}});e.Sortable=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); |
{ | ||
"name": "sortablejs-vue3", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"author": { | ||
@@ -20,3 +20,3 @@ "email": "maxwell.leiter@gmail.com", | ||
"dev": "vite", | ||
"build": "vite build && vue-tsc --emitDeclarationOnly --project tsconfig.dist.json && mv dist/lib dist/types && rm -rf favicon.ico", | ||
"build": "vite build && vue-tsc --emitDeclarationOnly --project tsconfig.dist.json && mv dist/lib dist/types && rm -rf dist/favicon.ico", | ||
"build:site": "vue-tsc --noEmit --project tsconfig.site.json && vite --config vite.site.config.ts build", | ||
@@ -49,9 +49,9 @@ "preview": "vite preview", | ||
"@types/sortablejs": "1.13.0", | ||
"@vitejs/plugin-vue": "2.3.3", | ||
"@vitejs/plugin-vue": "3.0.1", | ||
"prettier": "2.7.1", | ||
"terser": "^5.14.2", | ||
"terser": "5.14.2", | ||
"typescript": "4.7.4", | ||
"vite": "3.0.0", | ||
"vue-tsc": "0.38.5" | ||
"vite": "3.0.4", | ||
"vue-tsc": "0.39.2" | ||
} | ||
} |
@@ -93,3 +93,3 @@ # SortableJS-vue3 | ||
No changes are necessary to work with Vuex. Just pass `store.state.item` as your list. To modify your data you need to manually listen to the events and calculate the new position with `event.oldIndex` and `event.newIndex` with something like the following: | ||
No changes are necessary to work with Vuex. Just pass `store.state.items` as your list. To modify your data you need to manually listen to the events and calculate the new position with `event.oldIndex` and `event.newIndex` with something like the following: | ||
@@ -96,0 +96,0 @@ ```typescript |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
377
0
587203
9