jadq-x-vue
Version:
Craft AI-driven interfaces effortlessly
83 lines (82 loc) • 2.28 kB
JavaScript
import { defineComponent as D, mergeDefaults as x, computed as n, isVNode as c, createVNode as t, mergeProps as $ } from "vue";
import { b as C } from "../chunks/module-chunk.mjs";
import { useAttachmentContextInject as T } from "./context.mjs";
import b from "../_util/hooks/use-state.mjs";
import { useTemplateRef as A } from "../_util/useTemplateRef.mjs";
import { Flex as N, Typography as s, Upload as U } from "ant-design-vue";
const R = /* @__PURE__ */ D({
name: "AXAttachmentsPlaceholderUploader",
__name: "PlaceholderUploader",
props: x({
prefixCls: null,
placeholder: null,
upload: null,
className: null,
style: null
}, {
placeholder: () => ({})
}),
setup(e, {
expose: i
}) {
const l = `${e.prefixCls}-placeholder`, r = n(() => e.placeholder || {}), u = A("upload-dragger"), d = T(), [p, o] = b(!1), f = () => {
o(!0);
}, m = (a) => {
a.currentTarget.contains(a.relatedTarget) || o(!1);
}, g = () => {
o(!1);
}, h = n(() => {
var a;
return (a = u.value) == null ? void 0 : a.$el;
});
i({
nativeElement: h
});
const v = (a) => Array.isArray(a) && a.every(c), y = n(() => c(e.placeholder) || v(e.placeholder) ? e.placeholder : t(N, {
align: "center",
justify: "center",
vertical: !0,
class: `${l}-inner`
}, {
default: () => [t(s.Text, {
class: `${l}-icon`
}, {
default: () => [r.value.icon]
}), t(s.Title, {
class: `${l}-title`,
level: 5
}, {
default: () => [r.value.title]
}), t(s.Text, {
class: `${l}-description`,
type: "secondary"
}, {
default: () => [r.value.description]
})]
}));
return () => t("div", {
class: C(l, {
[`${l}-drag-in`]: p.value,
[`${l}-disabled`]: d.value.disabled
}, e.className),
onDragenter: f,
onDragleave: m,
onDrop: g,
"aria-hidden": d.value.disabled,
style: e.style
}, [t(U.Dragger, $(e.upload, {
showUploadList: !1,
ref: "upload-dragger",
style: {
padding: 0,
border: 0,
background: "transparent"
}
}), {
default: () => [y.value]
})]);
}
});
export {
R as default
};