UNPKG

yanzhen-design-vue

Version:

200 lines (199 loc) 10.5 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const vue = require("vue"); const antDesignVue = require("ant-design-vue"); const iconsVue = require("@ant-design/icons-vue"); require("../../image-viewer/src/image-viewer.vue.cjs"); require("./upload-file-preview.vue.cjs"); const upload = require("./upload.cjs"); const useUpload = require("./use-upload.cjs"); const imageViewer_vue_vue_type_script_setup_true_lang = require("../../image-viewer/src/image-viewer.vue2.cjs"); const uploadFilePreview_vue_vue_type_script_setup_true_lang = require("./upload-file-preview.vue2.cjs"); const _hoisted_1 = { style: { "display": "none" } }; const _hoisted_2 = { class: "ant-upload-drag-icon" }; const _hoisted_3 = { key: 0 }; const _hoisted_4 = { key: 3 }; const _hoisted_5 = { key: 0, class: /* @__PURE__ */ vue.normalizeClass(["anticon", "anticon-uploading"]) }; const _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: upload.uploadName }, __name: "upload", props: upload.uploadProps, emits: upload.uploadEmits, setup(__props, { expose: __expose, emit: __emit }) { const { ns } = upload.uploadOptions; const props = __props; const emit = __emit; const { _ref, slots, acceptRef, multipleRef, fileListRef, description, progressProps, propsRef, maxCountRef, handleCustomRequest, handleBeforeUpload, UploadIconRender, DefineUploadIconRender, ReusableUploadIconRender, DefineUploadPreview, ReusableUploadPreview, exposeCtx, // Preview imagePreviewRef, filePreviewRef, isImageType, handleOpenPreview } = useUpload.useUpload(props, emit); __expose(exposeCtx); return (_ctx, _cache) => { return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [ vue.createVNode(vue.unref(DefineUploadPreview), null, { default: vue.withCtx(() => [ vue.createElementVNode("div", _hoisted_1, [ vue.unref(isImageType) ? (vue.openBlock(), vue.createBlock(imageViewer_vue_vue_type_script_setup_true_lang.default, { key: 0, ref_key: "imagePreviewRef", ref: imagePreviewRef, "is-upload-viewer": true, "file-list": vue.unref(fileListRef) }, null, 8, ["file-list"])) : (vue.openBlock(), vue.createBlock(uploadFilePreview_vue_vue_type_script_setup_true_lang.default, { key: 1, ref_key: "filePreviewRef", ref: filePreviewRef, "file-list": vue.unref(fileListRef) }, null, 8, ["file-list"])) ]) ]), _: 1 }), props.styleType === "box" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.UploadDragger), vue.mergeProps({ key: 0, ref_key: "_ref", ref: _ref, "file-list": vue.unref(fileListRef), "onUpdate:fileList": _cache[0] || (_cache[0] = ($event) => vue.isRef(fileListRef) ? fileListRef.value = $event : null), class: [vue.unref(ns).b(), vue.unref(ns).b("drop")] }, vue.unref(propsRef), { multiple: vue.unref(multipleRef), accept: vue.unref(acceptRef), progress: vue.unref(progressProps), "before-upload": vue.unref(handleBeforeUpload), "custom-request": vue.unref(handleCustomRequest), onPreview: vue.unref(handleOpenPreview) }), vue.createSlots({ default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ vue.createElementVNode("p", _hoisted_2, [ vue.createVNode(vue.unref(iconsVue.InboxOutlined)) ]), vue.createElementVNode("p", { class: vue.normalizeClass(vue.unref(ns).e("txt")) }, "点击或拖拽文件到此区域上传", 2), vue.createElementVNode("p", { class: vue.normalizeClass(vue.unref(ns).e("hint")) }, "支持扩展名:" + vue.toDisplayString(vue.unref(description)), 3) ]) ]), _: 2 }, [ vue.unref(slots).itemRender ? { name: "itemRender", fn: vue.withCtx((item) => [ vue.renderSlot(_ctx.$slots, "itemRender", vue.normalizeProps(vue.guardReactiveProps(item))) ]), key: "0" } : void 0 ]), 1040, ["file-list", "class", "multiple", "accept", "progress", "before-upload", "custom-request", "onPreview"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [ vue.createVNode(vue.unref(DefineUploadIconRender), null, { default: vue.withCtx(() => _cache[2] || (_cache[2] = [ vue.createElementVNode("svg", { focusable: "false", "aria-hidden": "true", width: "1em", height: "1em", fill: "currentColor", viewBox: "0 0 1316 1024" }, [ vue.createElementVNode("path", { d: "M1050.233905 735.183238h-104.984381v52.516572h104.984381v105.033142h52.516571v-105.033142h105.033143v-52.516572h-105.033143v-105.033143h-52.516571v105.033143z m0-261.363809a286.96381 286.96381 0 0 0-102.4 28.964571c-0.195048-119.125333-0.195048-227.279238-0.195048-227.035429-44.958476-96.548571-121.61219-11.459048-136.045714 6.631619l-305.200762 345.526858-170.325333-126.098286a41.837714 41.837714 0 0 0-56.807619 6.339048l-193.097143 290.133333a42.081524 42.081524 0 0 0 31.987809 69.241905c0.24381 0 453.046857-0.195048 689.590857-0.146286 15.311238 38.863238 38.863238 73.630476 68.412953 102.107428H83.870476c-46.128762 0-83.870476-37.936762-83.870476-83.870476V80.408381C0 34.182095 37.741714 0 83.870476 0h879.079619c46.08 0 87.28381 34.182095 87.28381 80.164571v393.606096zM338.407619 119.174095a128.487619 128.487619 0 0 0-128.828952 128.097524A128.487619 128.487619 0 0 0 338.407619 375.417905a128.341333 128.341333 0 0 0 128.828952-128.097524A128.487619 128.487619 0 0 0 338.407619 119.222857z m738.157714 878.543238a236.30019 236.30019 0 1 1 0-472.649143 236.30019 236.30019 0 0 1 0 472.649143z" }) ], -1) ])), _: 1 }), vue.createVNode(vue.unref(antDesignVue.Upload), vue.mergeProps({ ref_key: "_ref", ref: _ref, "file-list": vue.unref(fileListRef), "onUpdate:fileList": _cache[1] || (_cache[1] = ($event) => vue.isRef(fileListRef) ? fileListRef.value = $event : null), class: [vue.unref(ns).b()] }, vue.unref(propsRef), { multiple: vue.unref(multipleRef), accept: vue.unref(acceptRef), progress: vue.unref(progressProps), "before-upload": vue.unref(handleBeforeUpload), "custom-request": vue.unref(handleCustomRequest), onPreview: vue.unref(handleOpenPreview) }), vue.createSlots({ default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ props.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [ vue.unref(fileListRef).length < vue.unref(maxCountRef) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, [ vue.createElementVNode("span", { class: vue.normalizeClass(vue.unref(ns).e("picture-card-icon")) }, [ vue.createVNode(vue.unref(ReusableUploadIconRender)) ], 2) ])) : vue.createCommentVNode("", true) ], 64)) : props.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Button), { key: 1, icon: vue.h(vue.unref(iconsVue.UploadOutlined)), disabled: props.disabled }, { default: vue.withCtx(() => _cache[3] || (_cache[3] = [ vue.createTextVNode("传文件 ") ])), _: 1 }, 8, ["icon", "disabled"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [ vue.createVNode(vue.unref(iconsVue.PlusOutlined)), _cache[4] || (_cache[4] = vue.createElementVNode("div", { class: "ant-upload-text" }, " 上传文件 ", -1)) ], 64)), vue.unref(description) && props.styleType === "image" ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_4, vue.toDisplayString(vue.unref(description)), 1)) : vue.unref(description) ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Tooltip), { key: 4, title: vue.unref(description) }, { default: vue.withCtx(() => [ vue.createVNode(vue.unref(iconsVue.QuestionCircleOutlined), { style: { fontSize: "18px", paddingLeft: "10px", color: "#108ee9" } }) ]), _: 1 }, 8, ["title"])) : vue.createCommentVNode("", true) ]) ]), iconRender: vue.withCtx((item) => [ vue.renderSlot(_ctx.$slots, "iconRender", vue.normalizeProps(vue.guardReactiveProps(item)), () => [ item.file.status === "uploading" && item.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, [ vue.createVNode(vue.unref(ReusableUploadIconRender)) ])) : (vue.openBlock(), vue.createBlock(vue.unref(UploadIconRender), vue.normalizeProps(vue.mergeProps({ key: 1 }, item)), null, 16)) ]) ]), _: 2 }, [ vue.unref(slots).itemRender ? { name: "itemRender", fn: vue.withCtx((item) => [ vue.renderSlot(_ctx.$slots, "itemRender", vue.normalizeProps(vue.guardReactiveProps(item))) ]), key: "0" } : void 0 ]), 1040, ["file-list", "class", "multiple", "accept", "progress", "before-upload", "custom-request", "onPreview"]) ], 64)), vue.createVNode(vue.unref(ReusableUploadPreview)) ], 64); }; } }); exports.default = _sfc_main;