tedir-dropzone
Advanced tools
Comparing version 0.0.1-wood-3 to 0.0.1-wood-4
@@ -1,2 +0,2 @@ | ||
import { defineComponent as g, ref as _, openBlock as f, createElementBlock as v, createElementVNode as a, unref as m, withModifiers as c, createStaticVNode as y, watch as D, normalizeClass as x, Fragment as V, withDirectives as T, vShow as B, pushScopeId as F, popScopeId as I } from "vue"; | ||
import { defineComponent as b, ref as _, openBlock as h, createElementBlock as v, createElementVNode as a, unref as m, withModifiers as c, createStaticVNode as y, normalizeClass as D, Fragment as x, withDirectives as T, vShow as B, pushScopeId as F, popScopeId as V } from "vue"; | ||
/*! ***************************************************************************** | ||
@@ -16,13 +16,13 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var w = function(e) { | ||
var Z = function(e) { | ||
e === void 0 && (e = 0); | ||
var d = "", n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", t = String(Math.abs(new Date().valueOf())); | ||
Number(e) >= 1 && (d += String(Number(e) + 1)); | ||
for (var l = 0; l < t.length; l++) | ||
d += n.charAt(Math.floor(Math.random() * n.length)), d += t.charAt(l); | ||
return d; | ||
var s = "", d = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", o = String(Math.abs(new Date().valueOf())); | ||
Number(e) >= 1 && (s += String(Number(e) + 1)); | ||
for (var l = 0; l < o.length; l++) | ||
s += d.charAt(Math.floor(Math.random() * d.length)), s += o.charAt(l); | ||
return s; | ||
}; | ||
const S = { class: "dropZone" }, z = ["id", "accept"], k = ["onDrop"], C = ["for"], L = /* @__PURE__ */ y('<svg width="10em" height="10em" viewBox="0 0 16 12" class="dropZoneImage" fill="currentColor" xmlns="http://www.w3.org/2000/svg" data-v-40def0a8><path fill-rule="evenodd" d="m 8.0274054,0.49415269 a 5.53,5.53 0 0 0 -3.594,1.34200001 c -0.766,0.66 -1.321,1.52 -1.464,2.383 -1.676,0.37 -2.94199993,1.83 -2.94199993,3.593 0,2.048 1.70799993,3.6820003 3.78099993,3.6820003 h 8.9059996 c 1.815,0 3.313,-1.43 3.313,-3.2270003 0,-1.636 -1.242,-2.969 -2.834,-3.194 -0.243,-2.58 -2.476,-4.57900001 -5.1659996,-4.57900001 z m 2.3539996,5.14600001 -1.9999996,-2 a 0.5,0.5 0 0 0 -0.708,0 l -2,2 a 0.5006316,0.5006316 0 1 0 0.708,0.708 l 1.146,-1.147 v 3.793 a 0.5,0.5 0 0 0 1,0 v -3.793 l 1.146,1.147 a 0.5006316,0.5006316 0 0 0 0.7079996,-0.708 z" data-v-40def0a8></path></svg><div class="dropZoneBody" data-v-40def0a8><p data-v-40def0a8><strong class="dropZoneTitle fg-inherit" data-v-40def0a8>Drag and drop files to upload</strong></p><p data-v-40def0a8><small class="dropZoneText" data-v-40def0a8>Your files will be added automatically</small></p><button type="button" class="button" data-v-40def0a8>or select files</button></div>', 2), M = [ | ||
L | ||
], $ = /* @__PURE__ */ g({ | ||
const I = { class: "dropZone" }, S = ["id", "accept"], z = ["onDrop"], k = ["for"], C = /* @__PURE__ */ y('<svg width="10em" height="10em" viewBox="0 0 16 12" class="dropZoneImage" fill="currentColor" xmlns="http://www.w3.org/2000/svg" data-v-40def0a8><path fill-rule="evenodd" d="m 8.0274054,0.49415269 a 5.53,5.53 0 0 0 -3.594,1.34200001 c -0.766,0.66 -1.321,1.52 -1.464,2.383 -1.676,0.37 -2.94199993,1.83 -2.94199993,3.593 0,2.048 1.70799993,3.6820003 3.78099993,3.6820003 h 8.9059996 c 1.815,0 3.313,-1.43 3.313,-3.2270003 0,-1.636 -1.242,-2.969 -2.834,-3.194 -0.243,-2.58 -2.476,-4.57900001 -5.1659996,-4.57900001 z m 2.3539996,5.14600001 -1.9999996,-2 a 0.5,0.5 0 0 0 -0.708,0 l -2,2 a 0.5006316,0.5006316 0 1 0 0.708,0.708 l 1.146,-1.147 v 3.793 a 0.5,0.5 0 0 0 1,0 v -3.793 l 1.146,1.147 a 0.5006316,0.5006316 0 0 0 0.7079996,-0.708 z" data-v-40def0a8></path></svg><div class="dropZoneBody" data-v-40def0a8><p data-v-40def0a8><strong class="dropZoneTitle fg-inherit" data-v-40def0a8>Drag and drop files to upload</strong></p><p data-v-40def0a8><small class="dropZoneText" data-v-40def0a8>Your files will be added automatically</small></p><button type="button" class="button" data-v-40def0a8>or select files</button></div>', 2), L = [ | ||
C | ||
], M = /* @__PURE__ */ b({ | ||
__name: "DropZone", | ||
@@ -35,18 +35,18 @@ props: { | ||
emits: ["update:modelValue"], | ||
setup(e, { emit: d }) { | ||
const n = e, t = _([]), l = _(null), p = w(), h = (i) => { | ||
const o = i.target.files || i.dataTransfer.files || l.value.files; | ||
for (let r = 0; r < o.length; r++) { | ||
const s = o[r]; | ||
if (n.base64) { | ||
setup(e, { emit: s }) { | ||
const d = e, o = _([]), l = _(null), p = Z(), f = (i) => { | ||
const t = i.target.files || i.dataTransfer.files || l.value.files; | ||
for (let r = 0; r < t.length; r++) { | ||
const n = t[r]; | ||
if (d.base64) { | ||
const u = new FileReader(); | ||
u.onload = () => { | ||
s.base64 = u.result, t.value.unshift(s); | ||
}, u.readAsDataURL(s); | ||
n.base64 = u.result, o.value.unshift(n); | ||
}, u.readAsDataURL(n); | ||
} else | ||
t.value.unshift(s); | ||
o.value.unshift(n); | ||
} | ||
d("update:modelValue", t.value); | ||
s("update:modelValue", o.value); | ||
}; | ||
return (i, o) => (f(), v("div", S, [ | ||
return (i, t) => (h(), v("div", I, [ | ||
a("input", { | ||
@@ -58,13 +58,13 @@ type: "file", | ||
ref: l, | ||
onChange: h, | ||
onChange: f, | ||
multiple: "", | ||
accept: e.accept | ||
}, null, 40, z), | ||
}, null, 40, S), | ||
a("div", { | ||
class: "dropZoneWrap", | ||
onDragenter: o[0] || (o[0] = c(() => { | ||
onDragenter: t[0] || (t[0] = c(() => { | ||
}, ["prevent"])), | ||
onDragover: o[1] || (o[1] = c(() => { | ||
onDragover: t[1] || (t[1] = c(() => { | ||
}, ["prevent"])), | ||
onDrop: c(h, ["prevent"]) | ||
onDrop: c(f, ["prevent"]) | ||
}, [ | ||
@@ -74,23 +74,23 @@ a("label", { | ||
class: "dropZoneLabel" | ||
}, M, 8, C) | ||
], 40, k) | ||
}, L, 8, k) | ||
], 40, z) | ||
])); | ||
} | ||
}); | ||
const Z = (e, d) => { | ||
const n = e.__vccOpts || e; | ||
for (const [t, l] of d) | ||
n[t] = l; | ||
return n; | ||
}, Q = /* @__PURE__ */ Z($, [["__scopeId", "data-v-40def0a8"]]), b = (e) => (F("data-v-ae154b52"), e = e(), I(), e), A = { class: "dropZone tedirThumbnail" }, N = ["id"], R = ["onDrop"], q = ["for"], E = ["src", "alt"], O = ["width", "height"], U = /* @__PURE__ */ b(() => /* @__PURE__ */ a("path", { d: "M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" }, null, -1)), W = /* @__PURE__ */ b(() => /* @__PURE__ */ a("path", { d: "M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z" }, null, -1)), Y = [ | ||
U, | ||
W | ||
], j = { class: "dropZoneBody" }, G = /* @__PURE__ */ b(() => /* @__PURE__ */ a("p", null, [ | ||
const w = (e, s) => { | ||
const d = e.__vccOpts || e; | ||
for (const [o, l] of s) | ||
d[o] = l; | ||
return d; | ||
}, P = /* @__PURE__ */ w(M, [["__scopeId", "data-v-40def0a8"]]), g = (e) => (F("data-v-5f2f8fa7"), e = e(), V(), e), $ = { class: "dropZone tedirThumbnail" }, A = ["id"], N = ["onDrop"], R = ["for"], q = ["src", "alt"], E = ["width", "height"], O = /* @__PURE__ */ g(() => /* @__PURE__ */ a("path", { d: "M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z" }, null, -1)), U = /* @__PURE__ */ g(() => /* @__PURE__ */ a("path", { d: "M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z" }, null, -1)), W = [ | ||
O, | ||
U | ||
], Y = { class: "dropZoneBody" }, j = /* @__PURE__ */ g(() => /* @__PURE__ */ a("p", null, [ | ||
/* @__PURE__ */ a("strong", { class: "dropZoneTitle" }, "Drag and drop thumbnail") | ||
], -1)), H = /* @__PURE__ */ b(() => /* @__PURE__ */ a("p", null, [ | ||
], -1)), G = /* @__PURE__ */ g(() => /* @__PURE__ */ a("p", null, [ | ||
/* @__PURE__ */ a("small", { class: "dropZoneText" }, "Your thumbnail will be shown here") | ||
], -1)), J = { | ||
], -1)), H = { | ||
type: "button", | ||
class: "button" | ||
}, K = /* @__PURE__ */ g({ | ||
}, J = /* @__PURE__ */ b({ | ||
__name: "ThumbBox", | ||
@@ -103,20 +103,15 @@ props: { | ||
emits: ["update:modelValue"], | ||
setup(e, { emit: d }) { | ||
const n = e, t = _(n.modelValue || {}), l = _(null), p = w(); | ||
D(() => n.modelValue, () => { | ||
t.value = n.modelValue; | ||
}); | ||
const h = (i) => { | ||
const o = i.target.files || i.dataTransfer.files || l.value.files; | ||
for (let r = 0; r < o.length; r++) { | ||
const s = o[r], u = new FileReader(); | ||
setup(e, { emit: s }) { | ||
const o = _(e.modelValue || {}), l = _(null), p = Z(), f = (i) => { | ||
const t = i.target.files || i.dataTransfer.files || l.value.files; | ||
for (let r = 0; r < t.length; r++) { | ||
const n = t[r], u = new FileReader(); | ||
u.onload = () => { | ||
s.base64 = u.result, t.value = s; | ||
}, u.readAsDataURL(s); | ||
n.base64 = u.result, o.value = n, s("update:modelValue", n); | ||
}, u.readAsDataURL(n); | ||
} | ||
d("update:modelValue", t.value); | ||
}; | ||
return (i, o) => { | ||
var r, s; | ||
return f(), v("div", A, [ | ||
return (i, t) => { | ||
var r, n; | ||
return h(), v("div", $, [ | ||
a("input", { | ||
@@ -128,24 +123,24 @@ type: "file", | ||
ref: l, | ||
onChange: h, | ||
onChange: f, | ||
accept: "image/*" | ||
}, null, 40, N), | ||
}, null, 40, A), | ||
a("div", { | ||
class: "dropZoneWrap", | ||
onDragenter: o[0] || (o[0] = c(() => { | ||
onDragenter: t[0] || (t[0] = c(() => { | ||
}, ["prevent"])), | ||
onDragover: o[1] || (o[1] = c(() => { | ||
onDragover: t[1] || (t[1] = c(() => { | ||
}, ["prevent"])), | ||
onDrop: c(h, ["prevent"]) | ||
onDrop: c(f, ["prevent"]) | ||
}, [ | ||
a("label", { | ||
for: "dropZoneThumbnail-" + m(p), | ||
class: x(["dropZoneLabel", (r = t.value) != null && r.base64 ? "tedirThumbnailLabel" : ""]) | ||
class: D(["dropZoneLabel", (r = o.value) != null && r.base64 ? "tedirThumbnailLabel" : ""]) | ||
}, [ | ||
(s = t.value) != null && s.base64 ? (f(), v("img", { | ||
(n = o.value) != null && n.base64 ? (h(), v("img", { | ||
key: 0, | ||
src: t.value.base64, | ||
src: o.value.base64, | ||
class: "tedirThumbnailImage", | ||
alt: t.value.name | ||
}, null, 8, E)) : (f(), v(V, { key: 1 }, [ | ||
(f(), v("svg", { | ||
alt: o.value.name | ||
}, null, 8, q)) : (h(), v(x, { key: 1 }, [ | ||
(h(), v("svg", { | ||
xmlns: "http://www.w3.org/2000/svg", | ||
@@ -157,7 +152,7 @@ width: e.iconSize, | ||
viewBox: "0 0 16 16" | ||
}, Y, 8, O)), | ||
a("div", j, [ | ||
}, W, 8, E)), | ||
a("div", Y, [ | ||
j, | ||
G, | ||
H, | ||
T(a("button", J, "or select thumbnail", 512), [ | ||
T(a("button", H, "or select thumbnail", 512), [ | ||
[B, e.showButton] | ||
@@ -167,4 +162,4 @@ ]) | ||
], 64)) | ||
], 10, q) | ||
], 40, R) | ||
], 10, R) | ||
], 40, N) | ||
]); | ||
@@ -174,6 +169,6 @@ }; | ||
}); | ||
const X = /* @__PURE__ */ Z(K, [["__scopeId", "data-v-ae154b52"]]); | ||
const Q = /* @__PURE__ */ w(J, [["__scopeId", "data-v-5f2f8fa7"]]); | ||
export { | ||
Q as DropZone, | ||
X as ThumbBox | ||
P as DropZone, | ||
Q as ThumbBox | ||
}; |
@@ -14,2 +14,2 @@ (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.TedirDropZone={},i.Vue))})(this,function(i,e){"use strict";/*! ***************************************************************************** | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var u=function(t){t===void 0&&(t=0);var d="",a="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",o=String(Math.abs(new Date().valueOf()));Number(t)>=1&&(d+=String(Number(t)+1));for(var l=0;l<o.length;l++)d+=a.charAt(Math.floor(Math.random()*a.length)),d+=o.charAt(l);return d};const b={class:"dropZone"},g=["id","accept"],w=["onDrop"],V=["for"],Z=[e.createStaticVNode('<svg width="10em" height="10em" viewBox="0 0 16 12" class="dropZoneImage" fill="currentColor" xmlns="http://www.w3.org/2000/svg" data-v-40def0a8><path fill-rule="evenodd" d="m 8.0274054,0.49415269 a 5.53,5.53 0 0 0 -3.594,1.34200001 c -0.766,0.66 -1.321,1.52 -1.464,2.383 -1.676,0.37 -2.94199993,1.83 -2.94199993,3.593 0,2.048 1.70799993,3.6820003 3.78099993,3.6820003 h 8.9059996 c 1.815,0 3.313,-1.43 3.313,-3.2270003 0,-1.636 -1.242,-2.969 -2.834,-3.194 -0.243,-2.58 -2.476,-4.57900001 -5.1659996,-4.57900001 z m 2.3539996,5.14600001 -1.9999996,-2 a 0.5,0.5 0 0 0 -0.708,0 l -2,2 a 0.5006316,0.5006316 0 1 0 0.708,0.708 l 1.146,-1.147 v 3.793 a 0.5,0.5 0 0 0 1,0 v -3.793 l 1.146,1.147 a 0.5006316,0.5006316 0 0 0 0.7079996,-0.708 z" data-v-40def0a8></path></svg><div class="dropZoneBody" data-v-40def0a8><p data-v-40def0a8><strong class="dropZoneTitle fg-inherit" data-v-40def0a8>Drag and drop files to upload</strong></p><p data-v-40def0a8><small class="dropZoneText" data-v-40def0a8>Your files will be added automatically</small></p><button type="button" class="button" data-v-40def0a8>or select files</button></div>',2)],v=e.defineComponent({__name:"DropZone",props:{modelValue:{default:[]},accept:{default:"*"},base64:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:d}){const a=t,o=e.ref([]),l=e.ref(null),f=u(),h=c=>{const n=c.target.files||c.dataTransfer.files||l.value.files;for(let r=0;r<n.length;r++){const s=n[r];if(a.base64){const p=new FileReader;p.onload=()=>{s.base64=p.result,o.value.unshift(s)},p.readAsDataURL(s)}else o.value.unshift(s)}d("update:modelValue",o.value)};return(c,n)=>(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("input",{type:"file",id:"dropZoneFile-"+e.unref(f),class:"dropZoneFile",ref_key:"dropZoneFile",ref:l,onChange:h,multiple:"",accept:t.accept},null,40,g),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:n[0]||(n[0]=e.withModifiers(()=>{},["prevent"])),onDragover:n[1]||(n[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(h,["prevent"])},[e.createElementVNode("label",{for:"dropZoneFile-"+e.unref(f),class:"dropZoneLabel"},Z,8,V)],40,w)]))}}),L="",_=(t,d)=>{const a=t.__vccOpts||t;for(const[o,l]of d)a[o]=l;return a},y=_(v,[["__scopeId","data-v-40def0a8"]]),m=t=>(e.pushScopeId("data-v-ae154b52"),t=t(),e.popScopeId(),t),B={class:"dropZone tedirThumbnail"},D=["id"],E=["onDrop"],T=["for"],x=["src","alt"],N=["width","height"],k=[m(()=>e.createElementVNode("path",{d:"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"},null,-1)),m(()=>e.createElementVNode("path",{d:"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"},null,-1))],F={class:"dropZoneBody"},M=m(()=>e.createElementVNode("p",null,[e.createElementVNode("strong",{class:"dropZoneTitle"},"Drag and drop thumbnail")],-1)),S=m(()=>e.createElementVNode("p",null,[e.createElementVNode("small",{class:"dropZoneText"},"Your thumbnail will be shown here")],-1)),I={type:"button",class:"button"},z=e.defineComponent({__name:"ThumbBox",props:{modelValue:{default:{}},iconSize:{default:"10em"},showButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:d}){const a=t,o=e.ref(a.modelValue||{}),l=e.ref(null),f=u();e.watch(()=>a.modelValue,()=>{o.value=a.modelValue});const h=c=>{const n=c.target.files||c.dataTransfer.files||l.value.files;for(let r=0;r<n.length;r++){const s=n[r],p=new FileReader;p.onload=()=>{s.base64=p.result,o.value=s},p.readAsDataURL(s)}d("update:modelValue",o.value)};return(c,n)=>{var r,s;return e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("input",{type:"file",id:"dropZoneThumbnail-"+e.unref(f),class:"dropZoneFile",ref_key:"dropZoneFile",ref:l,onChange:h,accept:"image/*"},null,40,D),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:n[0]||(n[0]=e.withModifiers(()=>{},["prevent"])),onDragover:n[1]||(n[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(h,["prevent"])},[e.createElementVNode("label",{for:"dropZoneThumbnail-"+e.unref(f),class:e.normalizeClass(["dropZoneLabel",(r=o.value)!=null&&r.base64?"tedirThumbnailLabel":""])},[(s=o.value)!=null&&s.base64?(e.openBlock(),e.createElementBlock("img",{key:0,src:o.value.base64,class:"tedirThumbnailImage",alt:o.value.name},null,8,x)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:t.iconSize,height:t.iconSize,fill:"currentColor",class:"dropZoneImage my-10px",viewBox:"0 0 16 16"},k,8,N)),e.createElementVNode("div",F,[M,S,e.withDirectives(e.createElementVNode("button",I,"or select thumbnail",512),[[e.vShow,t.showButton]])])],64))],10,T)],40,E)])}}}),R="",C=_(z,[["__scopeId","data-v-ae154b52"]]);i.DropZone=y,i.ThumbBox=C,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
***************************************************************************** */var u=function(t){t===void 0&&(t=0);var s="",d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",n=String(Math.abs(new Date().valueOf()));Number(t)>=1&&(s+=String(Number(t)+1));for(var l=0;l<n.length;l++)s+=d.charAt(Math.floor(Math.random()*d.length)),s+=n.charAt(l);return s};const g={class:"dropZone"},b=["id","accept"],w=["onDrop"],Z=["for"],V=[e.createStaticVNode('<svg width="10em" height="10em" viewBox="0 0 16 12" class="dropZoneImage" fill="currentColor" xmlns="http://www.w3.org/2000/svg" data-v-40def0a8><path fill-rule="evenodd" d="m 8.0274054,0.49415269 a 5.53,5.53 0 0 0 -3.594,1.34200001 c -0.766,0.66 -1.321,1.52 -1.464,2.383 -1.676,0.37 -2.94199993,1.83 -2.94199993,3.593 0,2.048 1.70799993,3.6820003 3.78099993,3.6820003 h 8.9059996 c 1.815,0 3.313,-1.43 3.313,-3.2270003 0,-1.636 -1.242,-2.969 -2.834,-3.194 -0.243,-2.58 -2.476,-4.57900001 -5.1659996,-4.57900001 z m 2.3539996,5.14600001 -1.9999996,-2 a 0.5,0.5 0 0 0 -0.708,0 l -2,2 a 0.5006316,0.5006316 0 1 0 0.708,0.708 l 1.146,-1.147 v 3.793 a 0.5,0.5 0 0 0 1,0 v -3.793 l 1.146,1.147 a 0.5006316,0.5006316 0 0 0 0.7079996,-0.708 z" data-v-40def0a8></path></svg><div class="dropZoneBody" data-v-40def0a8><p data-v-40def0a8><strong class="dropZoneTitle fg-inherit" data-v-40def0a8>Drag and drop files to upload</strong></p><p data-v-40def0a8><small class="dropZoneText" data-v-40def0a8>Your files will be added automatically</small></p><button type="button" class="button" data-v-40def0a8>or select files</button></div>',2)],y=e.defineComponent({__name:"DropZone",props:{modelValue:{default:[]},accept:{default:"*"},base64:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:s}){const d=t,n=e.ref([]),l=e.ref(null),f=u(),h=c=>{const o=c.target.files||c.dataTransfer.files||l.value.files;for(let r=0;r<o.length;r++){const a=o[r];if(d.base64){const p=new FileReader;p.onload=()=>{a.base64=p.result,n.value.unshift(a)},p.readAsDataURL(a)}else n.value.unshift(a)}s("update:modelValue",n.value)};return(c,o)=>(e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("input",{type:"file",id:"dropZoneFile-"+e.unref(f),class:"dropZoneFile",ref_key:"dropZoneFile",ref:l,onChange:h,multiple:"",accept:t.accept},null,40,b),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:o[0]||(o[0]=e.withModifiers(()=>{},["prevent"])),onDragover:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(h,["prevent"])},[e.createElementVNode("label",{for:"dropZoneFile-"+e.unref(f),class:"dropZoneLabel"},V,8,Z)],40,w)]))}}),L="",_=(t,s)=>{const d=t.__vccOpts||t;for(const[n,l]of s)d[n]=l;return d},B=_(y,[["__scopeId","data-v-40def0a8"]]),m=t=>(e.pushScopeId("data-v-5f2f8fa7"),t=t(),e.popScopeId(),t),v={class:"dropZone tedirThumbnail"},D=["id"],E=["onDrop"],T=["for"],x=["src","alt"],N=["width","height"],k=[m(()=>e.createElementVNode("path",{d:"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"},null,-1)),m(()=>e.createElementVNode("path",{d:"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"},null,-1))],F={class:"dropZoneBody"},M=m(()=>e.createElementVNode("p",null,[e.createElementVNode("strong",{class:"dropZoneTitle"},"Drag and drop thumbnail")],-1)),S=m(()=>e.createElementVNode("p",null,[e.createElementVNode("small",{class:"dropZoneText"},"Your thumbnail will be shown here")],-1)),I={type:"button",class:"button"},z=e.defineComponent({__name:"ThumbBox",props:{modelValue:{default:{}},iconSize:{default:"10em"},showButton:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{emit:s}){const d=t,n=e.ref(d.modelValue||{}),l=e.ref(null),f=u(),h=c=>{const o=c.target.files||c.dataTransfer.files||l.value.files;for(let r=0;r<o.length;r++){const a=o[r],p=new FileReader;p.onload=()=>{a.base64=p.result,n.value=a,s("update:modelValue",a)},p.readAsDataURL(a)}};return(c,o)=>{var r,a;return e.openBlock(),e.createElementBlock("div",v,[e.createElementVNode("input",{type:"file",id:"dropZoneThumbnail-"+e.unref(f),class:"dropZoneFile",ref_key:"dropZoneFile",ref:l,onChange:h,accept:"image/*"},null,40,D),e.createElementVNode("div",{class:"dropZoneWrap",onDragenter:o[0]||(o[0]=e.withModifiers(()=>{},["prevent"])),onDragover:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(h,["prevent"])},[e.createElementVNode("label",{for:"dropZoneThumbnail-"+e.unref(f),class:e.normalizeClass(["dropZoneLabel",(r=n.value)!=null&&r.base64?"tedirThumbnailLabel":""])},[(a=n.value)!=null&&a.base64?(e.openBlock(),e.createElementBlock("img",{key:0,src:n.value.base64,class:"tedirThumbnailImage",alt:n.value.name},null,8,x)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:t.iconSize,height:t.iconSize,fill:"currentColor",class:"dropZoneImage my-10px",viewBox:"0 0 16 16"},k,8,N)),e.createElementVNode("div",F,[M,S,e.withDirectives(e.createElementVNode("button",I,"or select thumbnail",512),[[e.vShow,t.showButton]])])],64))],10,T)],40,E)])}}}),R="",C=_(z,[["__scopeId","data-v-5f2f8fa7"]]);i.DropZone=B,i.ThumbBox=C,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
{ | ||
"name": "tedir-dropzone", | ||
"version": "0.0.1-wood-3", | ||
"version": "0.0.1-wood-4", | ||
"description": "Tedir DropZone is a file upload components for Vue 3 & Web Components", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue/tedir-dropzone-vue.umd.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
253586
4293