UNPKG

ant-design-x-vue

Version:

Craft AI-driven interfaces effortlessly

83 lines (82 loc) 2.24 kB
import { defineComponent as D, mergeDefaults as x, computed as o, useTemplateRef as $, isVNode as c, createVNode as t, mergeProps as C } from "vue"; import { c as T } from "./Attachments2.mjs"; import { useAttachmentContextInject as A } from "./context.mjs"; import b from "../_util/hooks/use-state.mjs"; import { Flex as N, Typography as s, Upload as U } from "ant-design-vue"; const L = /* @__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 = o(() => e.placeholder || {}), u = $("upload-dragger"), d = A(), [p, n] = b(!1), f = () => { n(!0); }, m = (a) => { a.currentTarget.contains(a.relatedTarget) || n(!1); }, g = () => { n(!1); }, h = o(() => { var a; return (a = u.value) == null ? void 0 : a.$el; }); i({ nativeElement: h }); const v = (a) => Array.isArray(a) && a.every(c), y = o(() => 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: T(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, C({ showUploadList: !1 }, e.upload, { ref: "upload-dragger", style: { padding: 0, border: 0, background: "transparent" } }), { default: () => [y.value] })]); } }); export { L as default };