@project-trans/suggestion-box
Advanced tools
Comparing version 0.4.1 to 0.4.2
import { defineComponent as B, ref as u, watch as U, openBlock as s, createElementBlock as o, withModifiers as S, createElementVNode as t, withDirectives as y, vModelText as k, toDisplayString as p, Fragment as h, renderList as P, createCommentVNode as F, normalizeClass as I, createVNode as L, Transition as R, withCtx as V } from "vue"; | ||
const D = ["placeholder"], E = { class: "inline-grid items-stretch sb-auto-height" }, A = ["placeholder"], N = { class: "m-2" }, O = { key: 0 }, $ = { class: "cursor-pointer appearance-none m-0!" }, H = { class: "flex overflow-x-scroll space-x-4" }, M = ["onClick"], q = ["src"], G = { | ||
const D = { class: "inline-grid items-stretch sb-auto-height" }, E = ["placeholder"], A = ["placeholder"], N = { class: "m-2" }, O = { key: 0 }, $ = { class: "cursor-pointer appearance-none m-0!" }, H = { class: "flex overflow-x-scroll space-x-4" }, M = ["onClick"], q = ["src"], G = { | ||
class: "flex justify-around gap-2 rounded-b-md p-2 !<sm:flex-col", | ||
@@ -20,3 +20,3 @@ bg: "zinc-50 dark:zinc-900" | ||
"space-x-1": "" | ||
}, ne = { text: "sm" }, le = { text: "sm" }, se = /* @__PURE__ */ B({ | ||
}, ne = { text: "sm" }, ae = { text: "sm" }, se = /* @__PURE__ */ B({ | ||
__name: "App", | ||
@@ -30,11 +30,11 @@ props: { | ||
targetUrl: { default: "" }, | ||
textContentPlaceholder: { default: "输入内容" }, | ||
textContentPlaceholder: { default: "留下您的建议内容,以便我们进行改进" }, | ||
contactContentPlaceholder: { default: "(可选)留下您的联系方式,方便我们直接与您联系" } | ||
}, | ||
setup(z) { | ||
const i = z, f = u(), v = u(""), x = u(""), l = u([]), m = u([]), d = u(!1), r = u(!1), c = u(!1), _ = (n) => { | ||
const i = z, f = u(), v = u(""), x = u(""), a = u([]), m = u([]), d = u(!1), r = u(!1), c = u(!1), _ = (n) => { | ||
n.style.height = "auto", n.style.height = `${n.scrollHeight}px`; | ||
}; | ||
U( | ||
l, | ||
a, | ||
(n) => { | ||
@@ -49,8 +49,8 @@ m.value.forEach((e) => URL.revokeObjectURL(e)), m.value = n.map((e) => URL.createObjectURL(e)); | ||
const e = Array.from(n.target.files ?? []); | ||
if (l.value.length === 0) { | ||
l.value = e; | ||
if (a.value.length === 0) { | ||
a.value = e; | ||
return; | ||
} | ||
e.forEach((a) => { | ||
l.value.find((b) => b.name === a.name) || l.value.push(a); | ||
e.forEach((l) => { | ||
a.value.find((g) => g.name === l.name) || a.value.push(l); | ||
}); | ||
@@ -62,3 +62,3 @@ } | ||
function T(n) { | ||
m.value.splice(n, 1), l.value.splice(n, 1); | ||
m.value.splice(n, 1), a.value.splice(n, 1); | ||
} | ||
@@ -69,5 +69,5 @@ async function j() { | ||
const n = new FormData(); | ||
if (n.append("textContent", v.value), n.append("referrer", window.location.href), x.value && n.append("contactContent", x.value), l.value) | ||
for (let e = 0; e < l.value.length; e += 1) | ||
n.append("images", l.value[e]); | ||
if (n.append("textContent", v.value), n.append("referrer", window.location.href), x.value && n.append("contactContent", x.value), a.value) | ||
for (let e = 0; e < a.value.length; e += 1) | ||
n.append("images", a.value[e]); | ||
try { | ||
@@ -102,24 +102,25 @@ d.value = !0, await fetch(i.targetUrl || "", { | ||
[ | ||
t("label", D, [ | ||
y(t("textarea", { | ||
"onUpdate:modelValue": e[0] || (e[0] = (l) => v.value = l), | ||
class: "min-h-0 resize-none rounded-t-md border-none p-2 text-inherit outline-none", | ||
bg: "$vp-c-bg", | ||
text: "base", | ||
placeholder: n.textContentPlaceholder | ||
}, null, 8, E), [ | ||
[k, v.value], | ||
[_] | ||
]) | ||
]), | ||
t("label", null, [ | ||
y(t("input", { | ||
"onUpdate:modelValue": e[0] || (e[0] = (a) => x.value = a), | ||
class: "min-h-0 w-full resize-none rounded-t-md border-none p-2 text-inherit outline-none", | ||
"onUpdate:modelValue": e[1] || (e[1] = (l) => x.value = l), | ||
class: "min-h-0 w-full resize-none border-none p-2 text-inherit outline-none", | ||
bg: "zinc-100 dark:zinc-900", | ||
text: "sm", | ||
placeholder: n.contactContentPlaceholder | ||
}, null, 8, D), [ | ||
}, null, 8, A), [ | ||
[k, x.value] | ||
]) | ||
]), | ||
t("label", E, [ | ||
y(t("textarea", { | ||
"onUpdate:modelValue": e[1] || (e[1] = (a) => v.value = a), | ||
class: "min-h-0 resize-none rounded-t-md border-none p-2 text-inherit outline-none", | ||
bg: "$vp-c-bg", | ||
placeholder: n.textContentPlaceholder | ||
}, null, 8, A), [ | ||
[k, v.value], | ||
[_] | ||
]) | ||
]), | ||
t("div", N, [ | ||
@@ -140,4 +141,4 @@ m.value.length !== 0 ? (s(), o("details", O, [ | ||
null, | ||
P(m.value, (a, g) => (s(), o("div", { | ||
key: a, | ||
P(m.value, (l, b) => (s(), o("div", { | ||
key: l, | ||
class: "relative" | ||
@@ -150,3 +151,3 @@ }, [ | ||
text: "zinc-100", | ||
onClick: (b) => T(g) | ||
onClick: (g) => T(b) | ||
}, e[2] || (e[2] = [ | ||
@@ -165,3 +166,3 @@ t( | ||
t("img", { | ||
src: a, | ||
src: l, | ||
class: "block aspect-video h-full max-h-40 min-h-40 min-w-60 w-full overflow-hidden rounded-md object-cover", | ||
@@ -300,3 +301,3 @@ alt: "图片" | ||
"span", | ||
le, | ||
ae, | ||
p(i.sendingButtonText), | ||
@@ -303,0 +304,0 @@ 1 |
{ | ||
"name": "@project-trans/suggestion-box", | ||
"type": "module", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Suggestion box for Project Trans", | ||
@@ -6,0 +6,0 @@ "author": { |
Sorry, the diff of this file is too big to display
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
356370
6640