| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168 |
- var tt = Object.defineProperty;
- var je = Object.getOwnPropertySymbols;
- var nt = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable;
- var Be = (e, t, o) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, pe = (e, t) => {
- for (var o in t || (t = {}))
- nt.call(t, o) && Be(e, o, t[o]);
- if (je)
- for (var o of je(t))
- ot.call(t, o) && Be(e, o, t[o]);
- return e;
- };
- import { defineComponent as ce, ref as V, onMounted as xe, onBeforeUnmount as Ve, createVNode as f, shallowRef as ge, watch as Ae, computed as ne, Transition as lt, withDirectives as he, vShow as we, watchEffect as at, triggerRef as it, TransitionGroup as rt, toRef as st, resolveComponent as ct, openBlock as Y, createBlock as oe, withCtx as K, createElementVNode as L, toDisplayString as E, createTextVNode as ee, createCommentVNode as ie, createElementBlock as $e, Fragment as Me, renderList as dt } from "vue";
- import { aJ as ut, aH as pt, aY as ft, D as mt, _ as A, cL as vt, i as Le, bn as I, bq as fe, e as ae, bo as J, bp as se, l as Ce, d as R, u as Ee, bb as gt, ao as ht, an as wt, am as yt, y as $t, b9 as bt, ba as It, cM as St, cN as Ct, a2 as Ne, cO as xt, E as _t, B as Ue, bc as Ft, cP as We, t as Ge, cy as Ke, cf as Rt, g as Dt, m as Pt, b8 as Ot, r as Tt, V as Ut, Z as At, L as Lt, h as Fe, b4 as Et, b6 as jt, c as me, bP as Bt, n as Mt, a7 as Nt, I as zt } from "./index2.js";
- import { P as Ht, _ as Xt, S as kt } from "./index12.js";
- import { b as qt } from "./index5.js";
- import { _ as Vt } from "./index15.js";
- function Wt(e, t, o, n) {
- for (var a = -1, i = e == null ? 0 : e.length; ++a < i; ) {
- var l = e[a];
- t(n, l, o(l), e);
- }
- return n;
- }
- function Gt(e) {
- return function(t, o, n) {
- for (var a = -1, i = Object(t), l = n(t), c = l.length; c--; ) {
- var w = l[++a];
- if (o(i[w], w, i) === !1)
- break;
- }
- return t;
- };
- }
- var Kt = Gt();
- function Jt(e, t) {
- return e && Kt(e, t, ut);
- }
- function Yt(e, t) {
- return function(o, n) {
- if (o == null)
- return o;
- if (!pt(o))
- return e(o, n);
- for (var a = o.length, i = -1, l = Object(o); ++i < a && n(l[i], i, l) !== !1; )
- ;
- return o;
- };
- }
- var Zt = Yt(Jt);
- function Qt(e, t, o, n) {
- return Zt(e, function(a, i, l) {
- t(n, a, o(a), l);
- }), n;
- }
- function en(e, t) {
- return function(o, n) {
- var a = ft(o) ? Wt : Qt, i = t ? t() : {};
- return a(o, e, qt(n), i);
- };
- }
- var tn = en(function(e, t, o) {
- e[o ? 0 : 1].push(t);
- }, function() {
- return [[], []];
- });
- function nn(e, t) {
- const o = `cannot ${e.method} ${e.action} ${t.status}'`, n = new Error(o);
- return n.status = t.status, n.method = e.method, n.url = e.action, n;
- }
- function ze(e) {
- const t = e.responseText || e.response;
- if (!t)
- return t;
- try {
- return JSON.parse(t);
- } catch (o) {
- return t;
- }
- }
- function on(e) {
- const t = new XMLHttpRequest();
- e.onProgress && t.upload && (t.upload.onprogress = function(i) {
- i.total > 0 && (i.percent = i.loaded / i.total * 100), e.onProgress(i);
- });
- const o = new FormData();
- e.data && Object.keys(e.data).forEach((a) => {
- const i = e.data[a];
- if (Array.isArray(i)) {
- i.forEach((l) => {
- o.append(`${a}[]`, l);
- });
- return;
- }
- o.append(a, i);
- }), e.file instanceof Blob ? o.append(e.filename, e.file, e.file.name) : o.append(e.filename, e.file), t.onerror = function(i) {
- e.onError(i);
- }, t.onload = function() {
- return t.status < 200 || t.status >= 300 ? e.onError(nn(e, t), ze(t)) : e.onSuccess(ze(t), t);
- }, t.open(e.method, e.action, !0), e.withCredentials && "withCredentials" in t && (t.withCredentials = !0);
- const n = e.headers || {};
- return n["X-Requested-With"] !== null && t.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(n).forEach((a) => {
- n[a] !== null && t.setRequestHeader(a, n[a]);
- }), t.send(o), {
- abort() {
- t.abort();
- }
- };
- }
- const ln = +/* @__PURE__ */ new Date();
- let an = 0;
- function Re() {
- return `vc-upload-${ln}-${++an}`;
- }
- const De = (e, t) => {
- if (e && t) {
- const o = Array.isArray(t) ? t : t.split(","), n = e.name || "", a = e.type || "", i = a.replace(/\/.*$/, "");
- return o.some((l) => {
- const c = l.trim();
- if (/^\*(\/\*)?$/.test(l))
- return !0;
- if (c.charAt(0) === ".") {
- const w = n.toLowerCase(), F = c.toLowerCase();
- let g = [F];
- return (F === ".jpg" || F === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((D) => w.endsWith(D));
- }
- return /\/\*$/.test(c) ? i === c.replace(/\/.*$/, "") : a === c ? !0 : /^\w+$/.test(c) ? (mt(!1, `Upload takes an invalidate 'accept' type '${c}'.Skip for check.`), !0) : !1;
- });
- }
- return !0;
- };
- function rn(e, t) {
- const o = e.createReader();
- let n = [];
- function a() {
- o.readEntries((i) => {
- const l = Array.prototype.slice.apply(i);
- n = n.concat(l), !l.length ? t(n) : a();
- });
- }
- a();
- }
- const sn = (e, t, o) => {
- const n = (a, i) => {
- a.path = i || "", a.isFile ? a.file((l) => {
- o(l) && (a.fullPath && !l.webkitRelativePath && (Object.defineProperties(l, {
- webkitRelativePath: {
- writable: !0
- }
- }), l.webkitRelativePath = a.fullPath.replace(/^\//, ""), Object.defineProperties(l, {
- webkitRelativePath: {
- writable: !1
- }
- })), t([l]));
- }) : a.isDirectory && rn(a, (l) => {
- l.forEach((c) => {
- n(c, `${i}${a.name}/`);
- });
- });
- };
- e.forEach((a) => {
- n(a.webkitGetAsEntry());
- });
- }, Je = () => ({
- capture: [Boolean, String],
- multipart: {
- type: Boolean,
- default: void 0
- },
- name: String,
- disabled: {
- type: Boolean,
- default: void 0
- },
- componentTag: String,
- action: [String, Function],
- method: String,
- directory: {
- type: Boolean,
- default: void 0
- },
- data: [Object, Function],
- headers: Object,
- accept: String,
- multiple: {
- type: Boolean,
- default: void 0
- },
- onBatchStart: Function,
- onReject: Function,
- onStart: Function,
- onError: Function,
- onSuccess: Function,
- onProgress: Function,
- beforeUpload: Function,
- customRequest: Function,
- withCredentials: {
- type: Boolean,
- default: void 0
- },
- openFileDialogOnClick: {
- type: Boolean,
- default: void 0
- },
- prefixCls: String,
- id: String,
- onMouseenter: Function,
- onMouseleave: Function,
- onClick: Function
- });
- var cn = function(e, t, o, n) {
- function a(i) {
- return i instanceof o ? i : new o(function(l) {
- l(i);
- });
- }
- return new (o || (o = Promise))(function(i, l) {
- function c(g) {
- try {
- F(n.next(g));
- } catch (D) {
- l(D);
- }
- }
- function w(g) {
- try {
- F(n.throw(g));
- } catch (D) {
- l(D);
- }
- }
- function F(g) {
- g.done ? i(g.value) : a(g.value).then(c, w);
- }
- F((n = n.apply(e, t || [])).next());
- });
- }, dn = function(e, t) {
- var o = {};
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
- return o;
- };
- const un = ce({
- compatConfig: {
- MODE: 3
- },
- name: "AjaxUploader",
- inheritAttrs: !1,
- props: Je(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: a
- } = t;
- const i = V(Re()), l = {}, c = V();
- let w = !1;
- const F = (p, y) => cn(this, void 0, void 0, function* () {
- const {
- beforeUpload: C
- } = e;
- let b = p;
- if (C) {
- try {
- b = yield C(p, y);
- } catch (v) {
- b = !1;
- }
- if (b === !1)
- return {
- origin: p,
- parsedFile: null,
- action: null,
- data: null
- };
- }
- const {
- action: T
- } = e;
- let U;
- typeof T == "function" ? U = yield T(p) : U = T;
- const {
- data: H
- } = e;
- let B;
- typeof H == "function" ? B = yield H(p) : B = H;
- const k = (
- // string type is from legacy `transformFile`.
- // Not sure if this will work since no related test case works with it
- (typeof b == "object" || typeof b == "string") && b ? b : p
- );
- let u;
- k instanceof File ? u = k : u = new File([k], p.name, {
- type: p.type
- });
- const m = u;
- return m.uid = p.uid, {
- origin: p,
- data: B,
- parsedFile: m,
- action: U
- };
- }), g = (p) => {
- let {
- data: y,
- origin: C,
- action: b,
- parsedFile: T
- } = p;
- if (!w)
- return;
- const {
- onStart: U,
- customRequest: H,
- name: B,
- headers: k,
- withCredentials: u,
- method: m
- } = e, {
- uid: v
- } = C, h = H || on, $ = {
- action: b,
- filename: B,
- data: y,
- file: T,
- headers: k,
- withCredentials: u,
- method: m || "post",
- onProgress: (x) => {
- const {
- onProgress: P
- } = e;
- P == null || P(x, T);
- },
- onSuccess: (x, P) => {
- const {
- onSuccess: r
- } = e;
- r == null || r(x, T, P), delete l[v];
- },
- onError: (x, P) => {
- const {
- onError: r
- } = e;
- r == null || r(x, P, T), delete l[v];
- }
- };
- U(C), l[v] = h($);
- }, D = () => {
- i.value = Re();
- }, _ = (p) => {
- if (p) {
- const y = p.uid ? p.uid : p;
- l[y] && l[y].abort && l[y].abort(), delete l[y];
- } else
- Object.keys(l).forEach((y) => {
- l[y] && l[y].abort && l[y].abort(), delete l[y];
- });
- };
- xe(() => {
- w = !0;
- }), Ve(() => {
- w = !1, _();
- });
- const O = (p) => {
- const y = [...p], C = y.map((b) => (b.uid = Re(), F(b, y)));
- Promise.all(C).then((b) => {
- const {
- onBatchStart: T
- } = e;
- T == null || T(b.map((U) => {
- let {
- origin: H,
- parsedFile: B
- } = U;
- return {
- file: H,
- parsedFile: B
- };
- })), b.filter((U) => U.parsedFile !== null).forEach((U) => {
- g(U);
- });
- });
- }, j = (p) => {
- const {
- accept: y,
- directory: C
- } = e, {
- files: b
- } = p.target, T = [...b].filter((U) => !C || De(U, y));
- O(T), D();
- }, s = (p) => {
- const y = c.value;
- if (!y)
- return;
- const {
- onClick: C
- } = e;
- y.click(), C && C(p);
- }, S = (p) => {
- p.key === "Enter" && s(p);
- }, N = (p) => {
- const {
- multiple: y
- } = e;
- if (p.preventDefault(), p.type !== "dragover")
- if (e.directory)
- sn(Array.prototype.slice.call(p.dataTransfer.items), O, (C) => De(C, e.accept));
- else {
- const C = tn(Array.prototype.slice.call(p.dataTransfer.files), (U) => De(U, e.accept));
- let b = C[0];
- const T = C[1];
- y === !1 && (b = b.slice(0, 1)), O(b), T.length && e.onReject && e.onReject(T);
- }
- };
- return a({
- abort: _
- }), () => {
- var p;
- const {
- componentTag: y,
- prefixCls: C,
- disabled: b,
- id: T,
- multiple: U,
- accept: H,
- capture: B,
- directory: k,
- openFileDialogOnClick: u,
- onMouseenter: m,
- onMouseleave: v
- } = e, h = dn(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), $ = {
- [C]: !0,
- [`${C}-disabled`]: b,
- [n.class]: !!n.class
- }, x = k ? {
- directory: "directory",
- webkitdirectory: "webkitdirectory"
- } : {};
- return f(y, A(A({}, b ? {} : {
- onClick: u ? s : () => {
- },
- onKeydown: u ? S : () => {
- },
- onMouseenter: m,
- onMouseleave: v,
- onDrop: N,
- onDragover: N,
- tabindex: "0"
- }), {}, {
- class: $,
- role: "button",
- style: n.style
- }), {
- default: () => [f("input", A(A(A({}, vt(h, {
- aria: !0,
- data: !0
- })), {}, {
- id: T,
- type: "file",
- ref: c,
- onClick: (r) => r.stopPropagation(),
- onCancel: (r) => r.stopPropagation(),
- key: i.value,
- style: {
- display: "none"
- },
- accept: H
- }, x), {}, {
- multiple: U,
- onChange: j
- }, B != null ? {
- capture: B
- } : {}), null), (p = o.default) === null || p === void 0 ? void 0 : p.call(o)]
- });
- };
- }
- });
- function Pe() {
- }
- const He = ce({
- compatConfig: {
- MODE: 3
- },
- name: "Upload",
- inheritAttrs: !1,
- props: Le(Je(), {
- componentTag: "span",
- prefixCls: "rc-upload",
- data: {},
- headers: {},
- name: "file",
- multipart: !1,
- onStart: Pe,
- onError: Pe,
- onSuccess: Pe,
- multiple: !1,
- beforeUpload: null,
- customRequest: null,
- withCredentials: !1,
- openFileDialogOnClick: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: a
- } = t;
- const i = V();
- return a({
- abort: (c) => {
- var w;
- (w = i.value) === null || w === void 0 || w.abort(c);
- }
- }), () => f(un, A(A(A({}, e), n), {}, {
- ref: i
- }), o);
- }
- });
- function Ye() {
- return {
- capture: fe([Boolean, String]),
- type: se(),
- name: String,
- defaultFileList: Ce(),
- fileList: Ce(),
- action: fe([String, Function]),
- directory: J(),
- data: fe([Object, Function]),
- method: se(),
- headers: ae(),
- showUploadList: fe([Boolean, Object]),
- multiple: J(),
- accept: String,
- beforeUpload: I(),
- onChange: I(),
- "onUpdate:fileList": I(),
- onDrop: I(),
- listType: se(),
- onPreview: I(),
- onDownload: I(),
- onReject: I(),
- onRemove: I(),
- /** @deprecated Please use `onRemove` directly */
- remove: I(),
- supportServerRender: J(),
- disabled: J(),
- prefixCls: String,
- customRequest: I(),
- withCredentials: J(),
- openFileDialogOnClick: J(),
- locale: ae(),
- id: String,
- previewFile: I(),
- /** @deprecated Please use `beforeUpload` directly */
- transformFile: I(),
- iconRender: I(),
- isImageUrl: I(),
- progress: ae(),
- itemRender: I(),
- /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
- maxCount: Number,
- height: fe([Number, String]),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I()
- };
- }
- function pn() {
- return {
- listType: se(),
- onPreview: I(),
- onDownload: I(),
- onRemove: I(),
- items: Ce(),
- progress: ae(),
- prefixCls: se(),
- showRemoveIcon: J(),
- showDownloadIcon: J(),
- showPreviewIcon: J(),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I(),
- locale: ae(void 0),
- previewFile: I(),
- iconRender: I(),
- isImageUrl: I(),
- appendAction: I(),
- appendActionVisible: J(),
- itemRender: I()
- };
- }
- function be(e) {
- return R(R({}, e), {
- lastModified: e.lastModified,
- lastModifiedDate: e.lastModifiedDate,
- name: e.name,
- size: e.size,
- type: e.type,
- uid: e.uid,
- percent: 0,
- originFileObj: e
- });
- }
- function Ie(e, t) {
- const o = [...t], n = o.findIndex((a) => {
- let {
- uid: i
- } = a;
- return i === e.uid;
- });
- return n === -1 ? o.push(e) : o[n] = e, o;
- }
- function Oe(e, t) {
- const o = e.uid !== void 0 ? "uid" : "name";
- return t.filter((n) => n[o] === e[o])[0];
- }
- function fn(e, t) {
- const o = e.uid !== void 0 ? "uid" : "name", n = t.filter((a) => a[o] !== e[o]);
- return n.length === t.length ? null : n;
- }
- const mn = function() {
- const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), n = t[t.length - 1].split(/#|\?/)[0];
- return (/\.[^./\\]*$/.exec(n) || [""])[0];
- }, Ze = (e) => e.indexOf("image/") === 0, vn = (e) => {
- if (e.type && !e.thumbUrl)
- return Ze(e.type);
- const t = e.thumbUrl || e.url || "", o = mn(t);
- return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(o) ? !0 : !(/^data:/.test(t) || o);
- }, le = 200;
- function gn(e) {
- return new Promise((t) => {
- if (!e.type || !Ze(e.type)) {
- t("");
- return;
- }
- const o = document.createElement("canvas");
- o.width = le, o.height = le, o.style.cssText = `position: fixed; left: 0; top: 0; width: ${le}px; height: ${le}px; z-index: 9999; display: none;`, document.body.appendChild(o);
- const n = o.getContext("2d"), a = new Image();
- if (a.onload = () => {
- const {
- width: i,
- height: l
- } = a;
- let c = le, w = le, F = 0, g = 0;
- i > l ? (w = l * (le / i), g = -(w - c) / 2) : (c = i * (le / l), F = -(c - w) / 2), n.drawImage(a, F, g, c, w);
- const D = o.toDataURL();
- document.body.removeChild(o), t(D);
- }, a.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
- const i = new FileReader();
- i.addEventListener("load", () => {
- i.result && (a.src = i.result);
- }), i.readAsDataURL(e);
- } else
- a.src = window.URL.createObjectURL(e);
- });
- }
- const hn = () => ({
- prefixCls: String,
- locale: ae(void 0),
- file: ae(),
- items: Ce(),
- listType: se(),
- isImgUrl: I(),
- showRemoveIcon: J(),
- showDownloadIcon: J(),
- showPreviewIcon: J(),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I(),
- iconRender: I(),
- actionIconRender: I(),
- itemRender: I(),
- onPreview: I(),
- onClose: I(),
- onDownload: I(),
- progress: ae()
- }), wn = ce({
- compatConfig: {
- MODE: 3
- },
- name: "ListItem",
- inheritAttrs: !1,
- props: hn(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- var a;
- const i = ge(!1), l = ge();
- xe(() => {
- l.value = setTimeout(() => {
- i.value = !0;
- }, 300);
- }), Ve(() => {
- clearTimeout(l.value);
- });
- const c = ge((a = e.file) === null || a === void 0 ? void 0 : a.status);
- Ae(() => {
- var g;
- return (g = e.file) === null || g === void 0 ? void 0 : g.status;
- }, (g) => {
- g !== "removed" && (c.value = g);
- });
- const {
- rootPrefixCls: w
- } = Ee("upload", e), F = ne(() => gt(`${w.value}-fade`));
- return () => {
- var g, D;
- const {
- prefixCls: _,
- locale: O,
- listType: j,
- file: s,
- items: S,
- progress: N,
- iconRender: p = o.iconRender,
- actionIconRender: y = o.actionIconRender,
- itemRender: C = o.itemRender,
- isImgUrl: b,
- showPreviewIcon: T,
- showRemoveIcon: U,
- showDownloadIcon: H,
- previewIcon: B = o.previewIcon,
- removeIcon: k = o.removeIcon,
- downloadIcon: u = o.downloadIcon,
- onPreview: m,
- onDownload: v,
- onClose: h
- } = e, {
- class: $,
- style: x
- } = n, P = p({
- file: s
- });
- let r = f("div", {
- class: `${_}-text-icon`
- }, [P]);
- if (j === "picture" || j === "picture-card")
- if (c.value === "uploading" || !s.thumbUrl && !s.url) {
- const Q = {
- [`${_}-list-item-thumbnail`]: !0,
- [`${_}-list-item-file`]: c.value !== "uploading"
- };
- r = f("div", {
- class: Q
- }, [P]);
- } else {
- const Q = b != null && b(s) ? f("img", {
- src: s.thumbUrl || s.url,
- alt: s.name,
- class: `${_}-list-item-image`,
- crossorigin: s.crossOrigin
- }, null) : P, Qe = {
- [`${_}-list-item-thumbnail`]: !0,
- [`${_}-list-item-file`]: b && !b(s)
- };
- r = f("a", {
- class: Qe,
- onClick: (et) => m(s, et),
- href: s.url || s.thumbUrl,
- target: "_blank",
- rel: "noopener noreferrer"
- }, [Q]);
- }
- const d = {
- [`${_}-list-item`]: !0,
- [`${_}-list-item-${c.value}`]: !0
- }, M = typeof s.linkProps == "string" ? JSON.parse(s.linkProps) : s.linkProps, Z = U ? y({
- customIcon: k ? k({
- file: s
- }) : f(ht, null, null),
- callback: () => h(s),
- prefixCls: _,
- title: O.removeFile
- }) : null, z = H && c.value === "done" ? y({
- customIcon: u ? u({
- file: s
- }) : f(wt, null, null),
- callback: () => v(s),
- prefixCls: _,
- title: O.downloadFile
- }) : null, W = j !== "picture-card" && f("span", {
- key: "download-delete",
- class: [`${_}-list-item-actions`, {
- picture: j === "picture"
- }]
- }, [z, Z]), X = `${_}-list-item-name`, G = s.url ? [f("a", A(A({
- key: "view",
- target: "_blank",
- rel: "noopener noreferrer",
- class: X,
- title: s.name
- }, M), {}, {
- href: s.url,
- onClick: (Q) => m(s, Q)
- }), [s.name]), W] : [f("span", {
- key: "view",
- class: X,
- onClick: (Q) => m(s, Q),
- title: s.name
- }, [s.name]), W], te = {
- pointerEvents: "none",
- opacity: 0.5
- }, re = T ? f("a", {
- href: s.url || s.thumbUrl,
- target: "_blank",
- rel: "noopener noreferrer",
- style: s.url || s.thumbUrl ? void 0 : te,
- onClick: (Q) => m(s, Q),
- title: O.previewFile
- }, [B ? B({
- file: s
- }) : f(yt, null, null)]) : null, q = j === "picture-card" && c.value !== "uploading" && f("span", {
- class: `${_}-list-item-actions`
- }, [re, c.value === "done" && z, Z]), de = f("div", {
- class: d
- }, [r, G, q, i.value && f(lt, F.value, {
- default: () => [he(f("div", {
- class: `${_}-list-item-progress`
- }, ["percent" in s ? f(Ht, A(A({}, N), {}, {
- type: "line",
- percent: s.percent
- }), null) : null]), [[we, c.value === "uploading"]])]
- })]), _e = {
- [`${_}-list-item-container`]: !0,
- [`${$}`]: !!$
- }, ue = s.response && typeof s.response == "string" ? s.response : ((g = s.error) === null || g === void 0 ? void 0 : g.statusText) || ((D = s.error) === null || D === void 0 ? void 0 : D.message) || O.uploadError, ye = c.value === "error" ? f($t, {
- title: ue,
- getPopupContainer: (Q) => Q.parentNode
- }, {
- default: () => [de]
- }) : de;
- return f("div", {
- class: _e,
- style: x
- }, [C ? C({
- originNode: ye,
- file: s,
- fileList: S,
- actions: {
- download: v.bind(null, s),
- preview: m.bind(null, s),
- remove: h.bind(null, s)
- }
- }) : ye]);
- };
- }
- }), yn = (e, t) => {
- let {
- slots: o
- } = t;
- var n;
- return Ft((n = o.default) === null || n === void 0 ? void 0 : n.call(o))[0];
- }, $n = ce({
- compatConfig: {
- MODE: 3
- },
- name: "AUploadList",
- props: Le(pn(), {
- listType: "text",
- progress: {
- strokeWidth: 2,
- showInfo: !1
- },
- showRemoveIcon: !0,
- showDownloadIcon: !1,
- showPreviewIcon: !0,
- previewFile: gn,
- isImageUrl: vn,
- items: [],
- appendActionVisible: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- expose: n
- } = t;
- const a = ge(!1);
- xe(() => {
- a.value == !0;
- });
- const i = ge([]);
- Ae(() => e.items, function() {
- let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
- i.value = s.slice();
- }, {
- immediate: !0,
- deep: !0
- }), at(() => {
- if (e.listType !== "picture" && e.listType !== "picture-card")
- return;
- let s = !1;
- (e.items || []).forEach((S, N) => {
- typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(S.originFileObj instanceof File || S.originFileObj instanceof Blob) || S.thumbUrl !== void 0 || (S.thumbUrl = "", e.previewFile && e.previewFile(S.originFileObj).then((p) => {
- const y = p || "";
- y !== S.thumbUrl && (i.value[N].thumbUrl = y, s = !0);
- }));
- }), s && it(i);
- });
- const l = (s, S) => {
- if (e.onPreview)
- return S == null || S.preventDefault(), e.onPreview(s);
- }, c = (s) => {
- typeof e.onDownload == "function" ? e.onDownload(s) : s.url && window.open(s.url);
- }, w = (s) => {
- var S;
- (S = e.onRemove) === null || S === void 0 || S.call(e, s);
- }, F = (s) => {
- let {
- file: S
- } = s;
- const N = e.iconRender || o.iconRender;
- if (N)
- return N({
- file: S,
- listType: e.listType
- });
- const p = S.status === "uploading", y = e.isImageUrl && e.isImageUrl(S) ? f(St, null, null) : f(Ct, null, null);
- let C = p ? f(Ne, null, null) : f(xt, null, null);
- return e.listType === "picture" ? C = p ? f(Ne, null, null) : y : e.listType === "picture-card" && (C = p ? e.locale.uploading : y), C;
- }, g = (s) => {
- const {
- customIcon: S,
- callback: N,
- prefixCls: p,
- title: y
- } = s, C = {
- type: "text",
- size: "small",
- title: y,
- onClick: () => {
- N();
- },
- class: `${p}-list-item-action`
- };
- return _t(S) ? f(Ue, C, {
- icon: () => S
- }) : f(Ue, C, {
- default: () => [f("span", null, [S])]
- });
- };
- n({
- handlePreview: l,
- handleDownload: c
- });
- const {
- prefixCls: D,
- rootPrefixCls: _
- } = Ee("upload", e), O = ne(() => ({
- [`${D.value}-list`]: !0,
- [`${D.value}-list-${e.listType}`]: !0
- })), j = ne(() => {
- const s = R({}, bt(`${_.value}-motion-collapse`));
- delete s.onAfterAppear, delete s.onAfterEnter, delete s.onAfterLeave;
- const S = R(R({}, It(`${D.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
- class: O.value,
- appear: a.value
- });
- return e.listType !== "picture-card" ? R(R({}, s), S) : S;
- });
- return () => {
- const {
- listType: s,
- locale: S,
- isImageUrl: N,
- showPreviewIcon: p,
- showRemoveIcon: y,
- showDownloadIcon: C,
- removeIcon: b,
- previewIcon: T,
- downloadIcon: U,
- progress: H,
- appendAction: B,
- itemRender: k,
- appendActionVisible: u
- } = e, m = B == null ? void 0 : B(), v = i.value;
- return f(rt, A(A({}, j.value), {}, {
- tag: "div"
- }), {
- default: () => [v.map((h) => {
- const {
- uid: $
- } = h;
- return f(wn, {
- key: $,
- locale: S,
- prefixCls: D.value,
- file: h,
- items: v,
- progress: H,
- listType: s,
- isImgUrl: N,
- showPreviewIcon: p,
- showRemoveIcon: y,
- showDownloadIcon: C,
- onPreview: l,
- onDownload: c,
- onClose: w,
- removeIcon: b,
- previewIcon: T,
- downloadIcon: U,
- itemRender: k
- }, R(R({}, o), {
- iconRender: F,
- actionIconRender: g
- }));
- }), B ? he(f(yn, {
- key: "__ant_upload_appendAction"
- }, {
- default: () => m
- }), [[we, !!u]]) : null]
- });
- };
- }
- }), bn = (e) => {
- const {
- componentCls: t,
- iconCls: o
- } = e;
- return {
- [`${t}-wrapper`]: {
- [`${t}-drag`]: {
- position: "relative",
- width: "100%",
- height: "100%",
- textAlign: "center",
- background: e.colorFillAlter,
- border: `${e.lineWidth}px dashed ${e.colorBorder}`,
- borderRadius: e.borderRadiusLG,
- cursor: "pointer",
- transition: `border-color ${e.motionDurationSlow}`,
- [t]: {
- padding: `${e.padding}px 0`
- },
- [`${t}-btn`]: {
- display: "table",
- width: "100%",
- height: "100%",
- outline: "none"
- },
- [`${t}-drag-container`]: {
- display: "table-cell",
- verticalAlign: "middle"
- },
- [`&:not(${t}-disabled):hover`]: {
- borderColor: e.colorPrimaryHover
- },
- [`p${t}-drag-icon`]: {
- marginBottom: e.margin,
- [o]: {
- color: e.colorPrimary,
- fontSize: e.uploadThumbnailSize
- }
- },
- [`p${t}-text`]: {
- margin: `0 0 ${e.marginXXS}px`,
- color: e.colorTextHeading,
- fontSize: e.fontSizeLG
- },
- [`p${t}-hint`]: {
- color: e.colorTextDescription,
- fontSize: e.fontSize
- },
- // ===================== Disabled =====================
- [`&${t}-disabled`]: {
- cursor: "not-allowed",
- [`p${t}-drag-icon ${o},
- p${t}-text,
- p${t}-hint
- `]: {
- color: e.colorTextDisabled
- }
- }
- }
- }
- };
- }, In = (e) => {
- const {
- componentCls: t,
- antCls: o,
- iconCls: n,
- fontSize: a,
- lineHeight: i
- } = e, l = `${t}-list-item`, c = `${l}-actions`, w = `${l}-action`, F = Math.round(a * i);
- return {
- [`${t}-wrapper`]: {
- [`${t}-list`]: R(R({}, We()), {
- lineHeight: e.lineHeight,
- [l]: {
- position: "relative",
- height: e.lineHeight * a,
- marginTop: e.marginXS,
- fontSize: a,
- display: "flex",
- alignItems: "center",
- transition: `background-color ${e.motionDurationSlow}`,
- "&:hover": {
- backgroundColor: e.controlItemBgHover
- },
- [`${l}-name`]: R(R({}, Ge), {
- padding: `0 ${e.paddingXS}px`,
- lineHeight: i,
- flex: "auto",
- transition: `all ${e.motionDurationSlow}`
- }),
- [c]: {
- [w]: {
- opacity: 0
- },
- [`${w}${o}-btn-sm`]: {
- height: F,
- border: 0,
- lineHeight: 1,
- // FIXME: should not override small button
- "> span": {
- transform: "scale(1)"
- }
- },
- [`
- ${w}:focus,
- &.picture ${w}
- `]: {
- opacity: 1
- },
- [n]: {
- color: e.colorTextDescription,
- transition: `all ${e.motionDurationSlow}`
- },
- [`&:hover ${n}`]: {
- color: e.colorText
- }
- },
- [`${t}-icon ${n}`]: {
- color: e.colorTextDescription,
- fontSize: a
- },
- [`${l}-progress`]: {
- position: "absolute",
- bottom: -e.uploadProgressOffset,
- width: "100%",
- paddingInlineStart: a + e.paddingXS,
- fontSize: a,
- lineHeight: 0,
- pointerEvents: "none",
- "> div": {
- margin: 0
- }
- }
- },
- [`${l}:hover ${w}`]: {
- opacity: 1,
- color: e.colorText
- },
- [`${l}-error`]: {
- color: e.colorError,
- [`${l}-name, ${t}-icon ${n}`]: {
- color: e.colorError
- },
- [c]: {
- [`${n}, ${n}:hover`]: {
- color: e.colorError
- },
- [w]: {
- opacity: 1
- }
- }
- },
- [`${t}-list-item-container`]: {
- transition: `opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
- // For smooth removing animation
- "&::before": {
- display: "table",
- width: 0,
- height: 0,
- content: '""'
- }
- }
- })
- }
- };
- }, Xe = new Ke("uploadAnimateInlineIn", {
- from: {
- width: 0,
- height: 0,
- margin: 0,
- padding: 0,
- opacity: 0
- }
- }), ke = new Ke("uploadAnimateInlineOut", {
- to: {
- width: 0,
- height: 0,
- margin: 0,
- padding: 0,
- opacity: 0
- }
- }), Sn = (e) => {
- const {
- componentCls: t
- } = e, o = `${t}-animate-inline`;
- return [{
- [`${t}-wrapper`]: {
- [`${o}-appear, ${o}-enter, ${o}-leave`]: {
- animationDuration: e.motionDurationSlow,
- animationTimingFunction: e.motionEaseInOutCirc,
- animationFillMode: "forwards"
- },
- [`${o}-appear, ${o}-enter`]: {
- animationName: Xe
- },
- [`${o}-leave`]: {
- animationName: ke
- }
- }
- }, Xe, ke];
- }, Cn = (e) => {
- const {
- componentCls: t,
- iconCls: o,
- uploadThumbnailSize: n,
- uploadProgressOffset: a
- } = e, i = `${t}-list`, l = `${i}-item`;
- return {
- [`${t}-wrapper`]: {
- // ${listCls} 增加优先级
- [`${i}${i}-picture, ${i}${i}-picture-card`]: {
- [l]: {
- position: "relative",
- height: n + e.lineWidth * 2 + e.paddingXS * 2,
- padding: e.paddingXS,
- border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
- borderRadius: e.borderRadiusLG,
- "&:hover": {
- background: "transparent"
- },
- [`${l}-thumbnail`]: R(R({}, Ge), {
- width: n,
- height: n,
- lineHeight: `${n + e.paddingSM}px`,
- textAlign: "center",
- flex: "none",
- [o]: {
- fontSize: e.fontSizeHeading2,
- color: e.colorPrimary
- },
- img: {
- display: "block",
- width: "100%",
- height: "100%",
- overflow: "hidden"
- }
- }),
- [`${l}-progress`]: {
- bottom: a,
- width: `calc(100% - ${e.paddingSM * 2}px)`,
- marginTop: 0,
- paddingInlineStart: n + e.paddingXS
- }
- },
- [`${l}-error`]: {
- borderColor: e.colorError,
- // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
- [`${l}-thumbnail ${o}`]: {
- "svg path[fill='#e6f7ff']": {
- fill: e.colorErrorBg
- },
- "svg path[fill='#1890ff']": {
- fill: e.colorError
- }
- }
- },
- [`${l}-uploading`]: {
- borderStyle: "dashed",
- [`${l}-name`]: {
- marginBottom: a
- }
- }
- }
- }
- };
- }, xn = (e) => {
- const {
- componentCls: t,
- iconCls: o,
- fontSizeLG: n,
- colorTextLightSolid: a
- } = e, i = `${t}-list`, l = `${i}-item`, c = e.uploadPicCardSize;
- return {
- [`${t}-wrapper${t}-picture-card-wrapper`]: R(R({}, We()), {
- display: "inline-block",
- width: "100%",
- [`${t}${t}-select`]: {
- width: c,
- height: c,
- marginInlineEnd: e.marginXS,
- marginBottom: e.marginXS,
- textAlign: "center",
- verticalAlign: "top",
- backgroundColor: e.colorFillAlter,
- border: `${e.lineWidth}px dashed ${e.colorBorder}`,
- borderRadius: e.borderRadiusLG,
- cursor: "pointer",
- transition: `border-color ${e.motionDurationSlow}`,
- [`> ${t}`]: {
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- height: "100%",
- textAlign: "center"
- },
- [`&:not(${t}-disabled):hover`]: {
- borderColor: e.colorPrimary
- }
- },
- // list
- [`${i}${i}-picture-card`]: {
- [`${i}-item-container`]: {
- display: "inline-block",
- width: c,
- height: c,
- marginBlock: `0 ${e.marginXS}px`,
- marginInline: `0 ${e.marginXS}px`,
- verticalAlign: "top"
- },
- "&::after": {
- display: "none"
- },
- [l]: {
- height: "100%",
- margin: 0,
- "&::before": {
- position: "absolute",
- zIndex: 1,
- width: `calc(100% - ${e.paddingXS * 2}px)`,
- height: `calc(100% - ${e.paddingXS * 2}px)`,
- backgroundColor: e.colorBgMask,
- opacity: 0,
- transition: `all ${e.motionDurationSlow}`,
- content: '" "'
- }
- },
- [`${l}:hover`]: {
- [`&::before, ${l}-actions`]: {
- opacity: 1
- }
- },
- [`${l}-actions`]: {
- position: "absolute",
- insetInlineStart: 0,
- zIndex: 10,
- width: "100%",
- whiteSpace: "nowrap",
- textAlign: "center",
- opacity: 0,
- transition: `all ${e.motionDurationSlow}`,
- [`${o}-eye, ${o}-download, ${o}-delete`]: {
- zIndex: 10,
- width: n,
- margin: `0 ${e.marginXXS}px`,
- fontSize: n,
- cursor: "pointer",
- transition: `all ${e.motionDurationSlow}`
- }
- },
- [`${l}-actions, ${l}-actions:hover`]: {
- [`${o}-eye, ${o}-download, ${o}-delete`]: {
- color: new Rt(a).setAlpha(0.65).toRgbString(),
- "&:hover": {
- color: a
- }
- }
- },
- [`${l}-thumbnail, ${l}-thumbnail img`]: {
- position: "static",
- display: "block",
- width: "100%",
- height: "100%",
- objectFit: "contain"
- },
- [`${l}-name`]: {
- display: "none",
- textAlign: "center"
- },
- [`${l}-file + ${l}-name`]: {
- position: "absolute",
- bottom: e.margin,
- display: "block",
- width: `calc(100% - ${e.paddingXS * 2}px)`
- },
- [`${l}-uploading`]: {
- [`&${l}`]: {
- backgroundColor: e.colorFillAlter
- },
- [`&::before, ${o}-eye, ${o}-download, ${o}-delete`]: {
- display: "none"
- }
- },
- [`${l}-progress`]: {
- bottom: e.marginXL,
- width: `calc(100% - ${e.paddingXS * 2}px)`,
- paddingInlineStart: 0
- }
- }
- })
- };
- }, _n = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- [`${t}-rtl`]: {
- direction: "rtl"
- }
- };
- }, Fn = (e) => {
- const {
- componentCls: t,
- colorTextDisabled: o
- } = e;
- return {
- [`${t}-wrapper`]: R(R({}, Tt(e)), {
- [t]: {
- outline: 0,
- "input[type='file']": {
- cursor: "pointer"
- }
- },
- [`${t}-select`]: {
- display: "inline-block"
- },
- [`${t}-disabled`]: {
- color: o,
- cursor: "not-allowed"
- }
- })
- };
- }, Rn = Dt("Upload", (e) => {
- const {
- fontSizeHeading3: t,
- fontSize: o,
- lineHeight: n,
- lineWidth: a,
- controlHeightLG: i
- } = e, l = Math.round(o * n), c = Pt(e, {
- uploadThumbnailSize: t * 2,
- uploadProgressOffset: l / 2 + a,
- uploadPicCardSize: i * 2.55
- });
- return [Fn(c), bn(c), Cn(c), xn(c), In(c), Sn(c), _n(c), Ot(c)];
- });
- var Dn = function(e, t, o, n) {
- function a(i) {
- return i instanceof o ? i : new o(function(l) {
- l(i);
- });
- }
- return new (o || (o = Promise))(function(i, l) {
- function c(g) {
- try {
- F(n.next(g));
- } catch (D) {
- l(D);
- }
- }
- function w(g) {
- try {
- F(n.throw(g));
- } catch (D) {
- l(D);
- }
- }
- function F(g) {
- g.done ? i(g.value) : a(g.value).then(c, w);
- }
- F((n = n.apply(e, t || [])).next());
- });
- }, Pn = function(e, t) {
- var o = {};
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
- return o;
- };
- const ve = `__LIST_IGNORE_${Date.now()}__`, Se = ce({
- compatConfig: {
- MODE: 3
- },
- name: "AUpload",
- inheritAttrs: !1,
- props: Le(Ye(), {
- type: "select",
- multiple: !1,
- action: "",
- data: {},
- accept: "",
- showUploadList: !0,
- listType: "text",
- supportServerRender: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: a
- } = t;
- const i = Ut(), {
- prefixCls: l,
- direction: c,
- disabled: w
- } = Ee("upload", e), [F, g] = Rn(l), D = At(), _ = ne(() => {
- var u;
- return (u = w.value) !== null && u !== void 0 ? u : D.value;
- }), [O, j] = Lt(e.defaultFileList || [], {
- value: st(e, "fileList"),
- postState: (u) => {
- const m = Date.now();
- return (u != null ? u : []).map((v, h) => (!v.uid && !Object.isFrozen(v) && (v.uid = `__AUTO__${m}_${h}__`), v));
- }
- }), s = V("drop"), S = V(null);
- xe(() => {
- Fe(e.fileList !== void 0 || n.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), Fe(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), Fe(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event.");
- });
- const N = (u, m, v) => {
- var h, $;
- let x = [...m];
- e.maxCount === 1 ? x = x.slice(-1) : e.maxCount && (x = x.slice(0, e.maxCount)), j(x);
- const P = {
- file: u,
- fileList: x
- };
- v && (P.event = v), (h = e["onUpdate:fileList"]) === null || h === void 0 || h.call(e, P.fileList), ($ = e.onChange) === null || $ === void 0 || $.call(e, P), i.onFieldChange();
- }, p = (u, m) => Dn(this, void 0, void 0, function* () {
- const {
- beforeUpload: v,
- transformFile: h
- } = e;
- let $ = u;
- if (v) {
- const x = yield v(u, m);
- if (x === !1)
- return !1;
- if (delete u[ve], x === ve)
- return Object.defineProperty(u, ve, {
- value: !0,
- configurable: !0
- }), !1;
- typeof x == "object" && x && ($ = x);
- }
- return h && ($ = yield h($)), $;
- }), y = (u) => {
- const m = u.filter(($) => !$.file[ve]);
- if (!m.length)
- return;
- const v = m.map(($) => be($.file));
- let h = [...O.value];
- v.forEach(($) => {
- h = Ie($, h);
- }), v.forEach(($, x) => {
- let P = $;
- if (m[x].parsedFile)
- $.status = "uploading";
- else {
- const {
- originFileObj: r
- } = $;
- let d;
- try {
- d = new File([r], r.name, {
- type: r.type
- });
- } catch (M) {
- d = new Blob([r], {
- type: r.type
- }), d.name = r.name, d.lastModifiedDate = /* @__PURE__ */ new Date(), d.lastModified = (/* @__PURE__ */ new Date()).getTime();
- }
- d.uid = $.uid, P = d;
- }
- N(P, h);
- });
- }, C = (u, m, v) => {
- try {
- typeof u == "string" && (u = JSON.parse(u));
- } catch (x) {
- }
- if (!Oe(m, O.value))
- return;
- const h = be(m);
- h.status = "done", h.percent = 100, h.response = u, h.xhr = v;
- const $ = Ie(h, O.value);
- N(h, $);
- }, b = (u, m) => {
- if (!Oe(m, O.value))
- return;
- const v = be(m);
- v.status = "uploading", v.percent = u.percent;
- const h = Ie(v, O.value);
- N(v, h, u);
- }, T = (u, m, v) => {
- if (!Oe(v, O.value))
- return;
- const h = be(v);
- h.error = u, h.response = m, h.status = "error";
- const $ = Ie(h, O.value);
- N(h, $);
- }, U = (u) => {
- let m;
- const v = e.onRemove || e.remove;
- Promise.resolve(typeof v == "function" ? v(u) : v).then((h) => {
- var $, x;
- if (h === !1)
- return;
- const P = fn(u, O.value);
- P && (m = R(R({}, u), {
- status: "removed"
- }), ($ = O.value) === null || $ === void 0 || $.forEach((r) => {
- const d = m.uid !== void 0 ? "uid" : "name";
- r[d] === m[d] && !Object.isFrozen(r) && (r.status = "removed");
- }), (x = S.value) === null || x === void 0 || x.abort(m), N(m, P));
- });
- }, H = (u) => {
- var m;
- s.value = u.type, u.type === "drop" && ((m = e.onDrop) === null || m === void 0 || m.call(e, u));
- };
- a({
- onBatchStart: y,
- onSuccess: C,
- onProgress: b,
- onError: T,
- fileList: O,
- upload: S
- });
- const [B] = Et("Upload", jt.Upload, ne(() => e.locale)), k = (u, m) => {
- const {
- removeIcon: v,
- previewIcon: h,
- downloadIcon: $,
- previewFile: x,
- onPreview: P,
- onDownload: r,
- isImageUrl: d,
- progress: M,
- itemRender: Z,
- iconRender: z,
- showUploadList: W
- } = e, {
- showDownloadIcon: X,
- showPreviewIcon: G,
- showRemoveIcon: te
- } = typeof W == "boolean" ? {} : W;
- return W ? f($n, {
- prefixCls: l.value,
- listType: e.listType,
- items: O.value,
- previewFile: x,
- onPreview: P,
- onDownload: r,
- onRemove: U,
- showRemoveIcon: !_.value && te,
- showPreviewIcon: G,
- showDownloadIcon: X,
- removeIcon: v,
- previewIcon: h,
- downloadIcon: $,
- iconRender: z,
- locale: B.value,
- isImageUrl: d,
- progress: M,
- itemRender: Z,
- appendActionVisible: m,
- appendAction: u
- }, R({}, o)) : u == null ? void 0 : u();
- };
- return () => {
- var u, m, v;
- const {
- listType: h,
- type: $
- } = e, {
- class: x,
- style: P
- } = n, r = Pn(n, ["class", "style"]), d = R(R(R({
- onBatchStart: y,
- onError: T,
- onProgress: b,
- onSuccess: C
- }, r), e), {
- id: (u = e.id) !== null && u !== void 0 ? u : i.id.value,
- prefixCls: l.value,
- beforeUpload: p,
- onChange: void 0,
- disabled: _.value
- });
- delete d.remove, (!o.default || _.value) && delete d.id;
- const M = {
- [`${l.value}-rtl`]: c.value === "rtl"
- };
- if ($ === "drag") {
- const X = me(l.value, {
- [`${l.value}-drag`]: !0,
- [`${l.value}-drag-uploading`]: O.value.some((G) => G.status === "uploading"),
- [`${l.value}-drag-hover`]: s.value === "dragover",
- [`${l.value}-disabled`]: _.value,
- [`${l.value}-rtl`]: c.value === "rtl"
- }, n.class, g.value);
- return F(f("span", A(A({}, n), {}, {
- class: me(`${l.value}-wrapper`, M, x, g.value)
- }), [f("div", {
- class: X,
- onDrop: H,
- onDragover: H,
- onDragleave: H,
- style: n.style
- }, [f(He, A(A({}, d), {}, {
- ref: S,
- class: `${l.value}-btn`
- }), A({
- default: () => [f("div", {
- class: `${l.value}-drag-container`
- }, [(m = o.default) === null || m === void 0 ? void 0 : m.call(o)])]
- }, o))]), k()]));
- }
- const Z = me(l.value, {
- [`${l.value}-select`]: !0,
- [`${l.value}-select-${h}`]: !0,
- [`${l.value}-disabled`]: _.value,
- [`${l.value}-rtl`]: c.value === "rtl"
- }), z = Bt((v = o.default) === null || v === void 0 ? void 0 : v.call(o)), W = (X) => f("div", {
- class: Z,
- style: X
- }, [f(He, A(A({}, d), {}, {
- ref: S
- }), o)]);
- return F(h === "picture-card" ? f("span", A(A({}, n), {}, {
- class: me(`${l.value}-wrapper`, `${l.value}-picture-card-wrapper`, M, n.class, g.value)
- }), [k(W, !!(z && z.length))]) : f("span", A(A({}, n), {}, {
- class: me(`${l.value}-wrapper`, M, n.class, g.value)
- }), [W(z && z.length ? void 0 : {
- display: "none"
- }), k()]));
- };
- }
- });
- var qe = function(e, t) {
- var o = {};
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && t.indexOf(n) < 0 && (o[n] = e[n]);
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var a = 0, n = Object.getOwnPropertySymbols(e); a < n.length; a++)
- t.indexOf(n[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[a]) && (o[n[a]] = e[n[a]]);
- return o;
- };
- const Te = ce({
- compatConfig: {
- MODE: 3
- },
- name: "AUploadDragger",
- inheritAttrs: !1,
- props: Ye(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- return () => {
- const {
- height: a
- } = e, i = qe(e, ["height"]), {
- style: l
- } = n, c = qe(n, ["style"]), w = R(R(R({}, i), c), {
- type: "drag",
- style: R(R({}, l), {
- height: typeof a == "number" ? `${a}px` : a
- })
- });
- return f(Se, w, o);
- };
- }
- }), On = R(Se, {
- Dragger: Te,
- LIST_IGNORE: ve,
- install(e) {
- return e.component(Se.name, Se), e.component(Te.name, Te), e;
- }
- }), Tn = { class: "header-steps" }, Un = { class: "import-main" }, An = { class: "upload" }, Ln = { class: "up_right" }, En = { class: "title" }, jn = { class: "tip" }, Bn = { class: "upload" }, Mn = { class: "up_right" }, Nn = { class: "title" }, zn = { class: "tip" }, Hn = { class: "extra-select-wrapper" }, Xn = { class: "import-main" }, kn = { class: "import-main" }, qn = {
- key: 0,
- class: "success"
- }, Vn = { class: "success-title" }, Wn = { class: "success-tip" }, Gn = {
- key: 1,
- class: "unsuccess"
- }, Kn = { class: "upload error-show" }, Jn = { class: "up_right" }, Yn = { class: "tip success-tip" }, Zn = { class: "tip error-tip" }, Qn = { class: "conTips" }, eo = /* @__PURE__ */ Object.assign({ name: "SImportModal" }, {
- __name: "SImportModal",
- props: {
- value: { type: Boolean, default: !1 },
- title: { type: String, default: () => window.$l("批量导入") },
- width: { type: [String, Number], default: 1e3 },
- // 文件上传地址(完整网关地址,如 /monitor/DeviceInfo/Uploader)
- uploadUrl: { type: String, default: "" },
- // 预览/结果表格列:[{ title, dataIndex, width }],作为默认列,接口返回 headerRow 后以接口为准
- columns: { type: Array, default: () => [] },
- // 四个导入接口方法:{ templateDownload, importPreview, importData, exportExceptionData }
- apis: {
- type: Object,
- default: () => ({})
- },
- // 可选的业务参数下拉(如设备分类):{ options: [{ label, value }], value, placeholder, loading }
- // 选中值会以 { extraKey: value } 的形式随各接口一起提交
- typeSelect: { type: Object, default: null },
- // typeSelect 选中值提交时的字段名
- extraKey: { type: String, default: "deviceTypeId" }
- },
- emits: ["update:value", "reload"],
- setup(e, { expose: t, emit: o }) {
- const n = e, a = o, i = V(0), l = V(""), c = V([]), w = V(!1), F = V(!1), g = V([]), D = V([]), _ = V({}), O = V([]), j = V(void 0), s = ne({
- get: () => n.value,
- set: (r) => a("update:value", r)
- }), S = ne(() => [
- { width: 50, title: window.$l("序号"), align: "center", customRender: ({ index: r }) => r + 1 },
- ...D.value,
- { title: window.$l("操作"), dataIndex: "action", key: "action", width: 50, fixed: "right" }
- ]), N = ne(() => [
- { width: 50, title: window.$l("序号"), align: "center", customRender: ({ index: r }) => r + 1 },
- ...D.value,
- { title: window.$l("异常原因"), dataIndex: "errorsInfo", width: 150, fixed: "right" }
- ]), p = ne(() => n.typeSelect ? j.value ? { [n.extraKey]: j.value } : {} : {});
- Ae(
- () => {
- var r;
- return (r = n.typeSelect) == null ? void 0 : r.options;
- },
- (r) => {
- r && r.length && (r.some((M) => M.value === j.value) || (j.value = r[0].value));
- },
- { immediate: !0, deep: !0 }
- );
- const y = () => {
- var r;
- i.value = 0, l.value = "", c.value = [], w.value = !1, g.value = [], D.value = [], _.value = {}, O.value = [], n.typeSelect && (j.value = (r = n.typeSelect.options) != null && r.length ? n.typeSelect.options[0].value : void 0);
- }, C = () => {
- s.value = !0, y();
- }, b = (r) => r && Object.prototype.hasOwnProperty.call(r, "data") ? r.data : r, T = (r) => (r || []).map((d) => ({
- title: d.fullName || "",
- dataIndex: d.id || "",
- key: d.id || ""
- })), U = ({ file: r, onSuccess: d, onError: M }) => {
- var W;
- const Z = (W = window.$utils) == null ? void 0 : W.http;
- if (!Z) {
- window.$message.error(window.$l("未获取到请求工具,无法上传")), M && M(new Error("http not found"));
- return;
- }
- const z = new FormData();
- return z.append("file", r), Z({
- url: n.uploadUrl,
- method: "post",
- data: z,
- headers: { "Content-Type": "multipart/form-data" }
- }).then((X) => {
- var re, q;
- const G = b(X) || {}, te = (q = (re = G == null ? void 0 : G.name) != null ? re : G == null ? void 0 : G.fileName) != null ? q : "";
- if (!te) throw new Error(window.$l("上传返回文件名无效"));
- l.value = te, d && d(X);
- }).catch((X) => {
- window.$message.error(typeof (X == null ? void 0 : X.msg) == "string" ? X.msg : window.$l("上传失败")), M && M(X);
- });
- }, H = (r) => {
- const d = r.name.replace(/.+\./, "");
- return ["xls", "xlsx"].indexOf(d.toLowerCase()) !== -1 ? r.size / 1024 >= 500 ? (window.$message.error(window.$l("文件大小超过500KB")), !1) : !0 : (window.$message.error(window.$l("文件格式不正确")), !1);
- }, B = (r) => new Promise((d, M) => {
- window.$modal.confirm({
- title: window.$l("提示"),
- content: `${window.$l("确定移除")}${r.name}?`,
- onOk: () => {
- l.value = "", d();
- },
- onCancel: () => M()
- });
- }), k = () => {
- (c.value.length || l.value) && y();
- }, u = () => {
- i.value != 0 && (i.value -= 1);
- }, m = () => {
- if (i.value == 0) {
- if (!c.value.length || !l.value) {
- window.$message.warning(window.$l("请先上传文件"));
- return;
- }
- if (n.typeSelect && !j.value) {
- window.$message.warning(
- n.typeSelect.placeholder ? `${window.$l("请先")}${n.typeSelect.placeholder}` : window.$l("请先选择业务参数")
- );
- return;
- }
- w.value = !0, n.apis.importPreview(pe({ fileName: l.value }, p.value)).then((r) => {
- const d = b(r) || {};
- g.value = d.dataRow || [], D.value = T(d.headerRow), w.value = !1, i.value += 1;
- }).catch(() => {
- w.value = !1;
- });
- return;
- }
- if (i.value == 1) {
- if (!g.value.length) {
- window.$message.warning(window.$l("导入数据为空"));
- return;
- }
- w.value = !0, n.apis.importData(pe({ list: g.value }, p.value)).then((r) => {
- const d = b(r) || {};
- _.value = d, O.value = d.failResult || [], w.value = !1, i.value += 1, a("reload");
- }).catch(() => {
- w.value = !1;
- });
- }
- }, v = (r) => {
- if (!r) {
- window.$message.error(window.$l("未获取到下载地址"));
- return;
- }
- const d = document.createElement("a");
- d.href = r, d.download = "", document.body.appendChild(d), d.click(), document.body.removeChild(d);
- }, h = () => {
- if (n.typeSelect && !j.value) {
- window.$message.warning(
- n.typeSelect.placeholder ? `${window.$l("请先")}${window.$l(n.typeSelect.placeholder)}` : window.$l("请先选择业务参数")
- );
- return;
- }
- F.value = !0, n.apis.templateDownload(pe({}, p.value)).then((r) => {
- const d = b(r) || {};
- v(d == null ? void 0 : d.url);
- }).catch(() => window.$message.error(window.$l("模板下载失败"))).finally(() => {
- F.value = !1;
- });
- }, $ = () => {
- F.value = !0, n.apis.exportExceptionData(pe({ list: O.value }, p.value)).then((r) => {
- const d = b(r) || {};
- v(d == null ? void 0 : d.url);
- }).catch(() => window.$message.error(window.$l("异常数据导出失败"))).finally(() => {
- F.value = !1;
- });
- }, x = (r) => {
- g.value.splice(r, 1);
- }, P = (r = !1) => {
- s.value = !1, r && a("reload");
- };
- return t({ show: C, resetState: y }), (r, d) => {
- const M = kt, Z = Xt, z = Ue, W = On, X = Nt, G = zt, te = Vt, re = ct("s-modal");
- return Y(), oe(re, {
- value: s.value,
- "onUpdate:value": d[4] || (d[4] = (q) => s.value = q),
- title: r.$l(e.title),
- width: e.width,
- "mask-closable": !1,
- "show-full-screen": !1,
- onHandCancel: P
- }, {
- footer: K(() => [
- i.value == 0 ? (Y(), oe(z, {
- key: 0,
- onClick: P
- }, {
- default: K(() => [
- ee(E(r.$l("取消")), 1)
- ]),
- _: 1
- })) : ie("", !0),
- i.value === 1 ? (Y(), oe(z, {
- key: 1,
- onClick: u
- }, {
- default: K(() => [
- ee(E(r.$l("上一步")), 1)
- ]),
- _: 1
- })) : ie("", !0),
- i.value < 2 ? (Y(), oe(z, {
- key: 2,
- type: "primary",
- loading: w.value,
- disabled: i.value === 0 && (!l.value || e.typeSelect && !j.value),
- onClick: m
- }, {
- default: K(() => [
- ee(E(r.$l("下一步")), 1)
- ]),
- _: 1
- }, 8, ["loading", "disabled"])) : (Y(), oe(z, {
- key: 3,
- type: "primary",
- onClick: d[3] || (d[3] = (q) => P(!0))
- }, {
- default: K(() => [
- ee(E(r.$l("关闭")), 1)
- ]),
- _: 1
- }))
- ]),
- default: K(() => [
- L("div", Tn, [
- f(Z, {
- current: i.value,
- "onUpdate:current": d[0] || (d[0] = (q) => i.value = q),
- type: "navigation",
- size: "small"
- }, {
- default: K(() => [
- f(M, {
- title: r.$l("上传文件"),
- disabled: !0
- }, null, 8, ["title"]),
- f(M, {
- title: r.$l("数据预览"),
- disabled: !0
- }, null, 8, ["title"]),
- f(M, {
- title: r.$l("导入数据"),
- disabled: !0
- }, null, 8, ["title"])
- ]),
- _: 1
- }, 8, ["current"])
- ]),
- he(L("div", Un, [
- L("div", An, [
- L("div", Ln, [
- L("p", En, E(r.$l("上传填好的数据表")), 1),
- L("p", jn, E(r.$l("文件后缀名必须是xls或xlsx,文件大小不超过500KB,最多支持导入1000条数据")), 1),
- f(W, {
- "file-list": c.value,
- "onUpdate:fileList": d[1] || (d[1] = (q) => c.value = q),
- class: "upload-area",
- accept: ".xls,.xlsx",
- "max-count": 1,
- "custom-request": U,
- "before-upload": H,
- onRemove: B
- }, {
- default: K(() => [
- f(z, { type: "link" }, {
- default: K(() => [
- ee(E(r.$l("上传文件")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["file-list"])
- ])
- ]),
- L("div", Bn, [
- L("div", Mn, [
- L("p", Nn, E(r.$l("填写导入数据信息")), 1),
- L("p", zn, E(r.$l("请按照数据模板的格式准备导入数据,模板中的表头名称不可更改,表头行不能删除")), 1),
- L("div", Hn, [
- e.typeSelect ? (Y(), oe(X, {
- key: 0,
- value: j.value,
- "onUpdate:value": d[2] || (d[2] = (q) => j.value = q),
- options: e.typeSelect.options,
- loading: e.typeSelect.loading,
- placeholder: e.typeSelect.placeholder || r.$l("请选择"),
- style: { width: "200px", "margin-right": "12px" },
- onChange: k
- }, null, 8, ["value", "options", "loading", "placeholder"])) : ie("", !0),
- f(z, {
- type: "link",
- loading: F.value,
- onClick: h
- }, {
- default: K(() => [
- ee(E(r.$l("下载模板")), 1)
- ]),
- _: 1
- }, 8, ["loading"])
- ])
- ])
- ])
- ], 512), [
- [we, i.value == 0]
- ]),
- he(L("div", Xn, [
- f(te, {
- "data-source": g.value,
- columns: S.value,
- size: "small",
- pagination: !1,
- scroll: { x: "max-content", y: "420px" },
- class: "import-preview-table"
- }, {
- bodyCell: K(({ column: q, record: de, index: _e }) => [
- (Y(!0), $e(Me, null, dt(D.value, (ue) => (Y(), $e(Me, {
- key: ue.dataIndex
- }, [
- q.dataIndex === ue.dataIndex ? (Y(), oe(G, {
- key: 0,
- value: de[q.dataIndex],
- "onUpdate:value": (ye) => de[q.dataIndex] = ye
- }, null, 8, ["value", "onUpdate:value"])) : ie("", !0)
- ], 64))), 128)),
- q.dataIndex === "action" ? (Y(), oe(z, {
- key: 0,
- class: "action-btn",
- type: "link",
- danger: "",
- onClick: (ue) => x(_e),
- size: "small"
- }, {
- default: K(() => [
- ee(E(r.$l("删除")), 1)
- ]),
- _: 1
- }, 8, ["onClick"])) : ie("", !0)
- ]),
- _: 1
- }, 8, ["data-source", "columns"])
- ], 512), [
- [we, i.value == 1]
- ]),
- he(L("div", kn, [
- _.value.resultType ? ie("", !0) : (Y(), $e("div", qn, [
- L("p", Vn, E(r.$l("批量导入成功")), 1),
- L("p", Wn, E(r.$l("您已成功导入")) + E(_.value.snum) + E(r.$l("条数据")), 1)
- ])),
- _.value.resultType ? (Y(), $e("div", Gn, [
- L("div", Kn, [
- L("div", Jn, [
- L("p", Yn, [
- ee(E(r.$l("正常数据条数")) + ":", 1),
- L("span", null, E(_.value.snum) + E(r.$l("条")), 1)
- ]),
- L("p", Zn, [
- ee(E(r.$l("异常数据条数")) + ":", 1),
- L("span", null, E(_.value.fnum) + E(r.$l("条")), 1)
- ])
- ])
- ]),
- L("div", Qn, [
- L("p", null, E(r.$l("以下文件数据为导入异常数据")), 1),
- f(z, {
- type: "link",
- loading: F.value,
- onClick: $
- }, {
- default: K(() => [
- ee(E(r.$l("导出异常数据")), 1)
- ]),
- _: 1
- }, 8, ["loading"])
- ]),
- f(te, {
- "data-source": O.value,
- columns: N.value,
- size: "small",
- pagination: !1,
- scroll: { x: "max-content", y: "205px" }
- }, null, 8, ["data-source", "columns"])
- ])) : ie("", !0)
- ], 512), [
- [we, i.value == 2]
- ])
- ]),
- _: 1
- }, 8, ["value", "title", "width"]);
- };
- }
- }), ro = /* @__PURE__ */ Mt(eo, [["__scopeId", "data-v-3cd9b589"]]);
- export {
- ro as default
- };
|