index8.js 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779
  1. import { G as He, H as qe, I as We, l as Ge, _ as O, J as Ve, i as ve, M as w, N as Q, e as V, O as B, Q as J, h as se, d as S, u as he, S as Ke, T as Je, U as Ye, V as Ze, W as Qe, X as ke, Y as et, Z as tt, $ as nt, A as be, a0 as ot, n as rt, D as $e, a1 as it, a2 as Re, t as De, a3 as Pe, a4 as at, g as lt, m as st, a5 as ct, r as dt, y as ut, j as ue, a6 as pt, a7 as ft, c as k, a8 as mt } from "./index2.js";
  2. import { defineComponent as Y, ref as ne, onMounted as ce, onBeforeUnmount as Oe, createVNode as m, shallowRef as te, watch as Te, computed as oe, Transition as gt, withDirectives as _e, vShow as Ue, watchEffect as vt, triggerRef as ht, TransitionGroup as wt, toRef as yt } from "vue";
  3. import { b as bt } from "./FormItem.js";
  4. import { P as $t } from "./index10.js";
  5. import { u as It } from "./useMergedState.js";
  6. import "./index5.js";
  7. import { u as Ct } from "./FormItemContext.js";
  8. function St(e, t, n, o) {
  9. for (var i = -1, a = e == null ? 0 : e.length; ++i < a; ) {
  10. var r = e[i];
  11. t(o, r, n(r), e);
  12. }
  13. return o;
  14. }
  15. function xt(e) {
  16. return function(t, n, o) {
  17. for (var i = -1, a = Object(t), r = o(t), s = r.length; s--; ) {
  18. var y = r[++i];
  19. if (n(a[y], y, a) === !1)
  20. break;
  21. }
  22. return t;
  23. };
  24. }
  25. var Ft = xt();
  26. function Rt(e, t) {
  27. return e && Ft(e, t, He);
  28. }
  29. function Dt(e, t) {
  30. return function(n, o) {
  31. if (n == null)
  32. return n;
  33. if (!qe(n))
  34. return e(n, o);
  35. for (var i = n.length, a = -1, r = Object(n); ++a < i && o(r[a], a, r) !== !1; )
  36. ;
  37. return n;
  38. };
  39. }
  40. var Pt = Dt(Rt);
  41. function Ot(e, t, n, o) {
  42. return Pt(e, function(i, a, r) {
  43. t(o, i, n(i), r);
  44. }), o;
  45. }
  46. function Tt(e, t) {
  47. return function(n, o) {
  48. var i = We(n) ? St : Ot, a = t ? t() : {};
  49. return i(n, e, bt(o), a);
  50. };
  51. }
  52. var _t = Tt(function(e, t, n) {
  53. e[n ? 0 : 1].push(t);
  54. }, function() {
  55. return [[], []];
  56. });
  57. function Ut(e, t) {
  58. const n = `cannot ${e.method} ${e.action} ${t.status}'`, o = new Error(n);
  59. return o.status = t.status, o.method = e.method, o.url = e.action, o;
  60. }
  61. function Ie(e) {
  62. const t = e.responseText || e.response;
  63. if (!t)
  64. return t;
  65. try {
  66. return JSON.parse(t);
  67. } catch (n) {
  68. return t;
  69. }
  70. }
  71. function At(e) {
  72. const t = new XMLHttpRequest();
  73. e.onProgress && t.upload && (t.upload.onprogress = function(a) {
  74. a.total > 0 && (a.percent = a.loaded / a.total * 100), e.onProgress(a);
  75. });
  76. const n = new FormData();
  77. e.data && Object.keys(e.data).forEach((i) => {
  78. const a = e.data[i];
  79. if (Array.isArray(a)) {
  80. a.forEach((r) => {
  81. n.append(`${i}[]`, r);
  82. });
  83. return;
  84. }
  85. n.append(i, a);
  86. }), e.file instanceof Blob ? n.append(e.filename, e.file, e.file.name) : n.append(e.filename, e.file), t.onerror = function(a) {
  87. e.onError(a);
  88. }, t.onload = function() {
  89. return t.status < 200 || t.status >= 300 ? e.onError(Ut(e, t), Ie(t)) : e.onSuccess(Ie(t), t);
  90. }, t.open(e.method, e.action, !0), e.withCredentials && "withCredentials" in t && (t.withCredentials = !0);
  91. const o = e.headers || {};
  92. return o["X-Requested-With"] !== null && t.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(o).forEach((i) => {
  93. o[i] !== null && t.setRequestHeader(i, o[i]);
  94. }), t.send(n), {
  95. abort() {
  96. t.abort();
  97. }
  98. };
  99. }
  100. const Lt = +/* @__PURE__ */ new Date();
  101. let Et = 0;
  102. function pe() {
  103. return `vc-upload-${Lt}-${++Et}`;
  104. }
  105. const fe = (e, t) => {
  106. if (e && t) {
  107. const n = Array.isArray(t) ? t : t.split(","), o = e.name || "", i = e.type || "", a = i.replace(/\/.*$/, "");
  108. return n.some((r) => {
  109. const s = r.trim();
  110. if (/^\*(\/\*)?$/.test(r))
  111. return !0;
  112. if (s.charAt(0) === ".") {
  113. const y = o.toLowerCase(), F = s.toLowerCase();
  114. let g = [F];
  115. return (F === ".jpg" || F === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((T) => y.endsWith(T));
  116. }
  117. return /\/\*$/.test(s) ? a === s.replace(/\/.*$/, "") : i === s ? !0 : /^\w+$/.test(s) ? (Ge(!1, `Upload takes an invalidate 'accept' type '${s}'.Skip for check.`), !0) : !1;
  118. });
  119. }
  120. return !0;
  121. };
  122. function jt(e, t) {
  123. const n = e.createReader();
  124. let o = [];
  125. function i() {
  126. n.readEntries((a) => {
  127. const r = Array.prototype.slice.apply(a);
  128. o = o.concat(r), !r.length ? t(o) : i();
  129. });
  130. }
  131. i();
  132. }
  133. const Mt = (e, t, n) => {
  134. const o = (i, a) => {
  135. i.path = a || "", i.isFile ? i.file((r) => {
  136. n(r) && (i.fullPath && !r.webkitRelativePath && (Object.defineProperties(r, {
  137. webkitRelativePath: {
  138. writable: !0
  139. }
  140. }), r.webkitRelativePath = i.fullPath.replace(/^\//, ""), Object.defineProperties(r, {
  141. webkitRelativePath: {
  142. writable: !1
  143. }
  144. })), t([r]));
  145. }) : i.isDirectory && jt(i, (r) => {
  146. r.forEach((s) => {
  147. o(s, `${a}${i.name}/`);
  148. });
  149. });
  150. };
  151. e.forEach((i) => {
  152. o(i.webkitGetAsEntry());
  153. });
  154. }, Ae = () => ({
  155. capture: [Boolean, String],
  156. multipart: {
  157. type: Boolean,
  158. default: void 0
  159. },
  160. name: String,
  161. disabled: {
  162. type: Boolean,
  163. default: void 0
  164. },
  165. componentTag: String,
  166. action: [String, Function],
  167. method: String,
  168. directory: {
  169. type: Boolean,
  170. default: void 0
  171. },
  172. data: [Object, Function],
  173. headers: Object,
  174. accept: String,
  175. multiple: {
  176. type: Boolean,
  177. default: void 0
  178. },
  179. onBatchStart: Function,
  180. onReject: Function,
  181. onStart: Function,
  182. onError: Function,
  183. onSuccess: Function,
  184. onProgress: Function,
  185. beforeUpload: Function,
  186. customRequest: Function,
  187. withCredentials: {
  188. type: Boolean,
  189. default: void 0
  190. },
  191. openFileDialogOnClick: {
  192. type: Boolean,
  193. default: void 0
  194. },
  195. prefixCls: String,
  196. id: String,
  197. onMouseenter: Function,
  198. onMouseleave: Function,
  199. onClick: Function
  200. });
  201. var Bt = function(e, t, n, o) {
  202. function i(a) {
  203. return a instanceof n ? a : new n(function(r) {
  204. r(a);
  205. });
  206. }
  207. return new (n || (n = Promise))(function(a, r) {
  208. function s(g) {
  209. try {
  210. F(o.next(g));
  211. } catch (T) {
  212. r(T);
  213. }
  214. }
  215. function y(g) {
  216. try {
  217. F(o.throw(g));
  218. } catch (T) {
  219. r(T);
  220. }
  221. }
  222. function F(g) {
  223. g.done ? a(g.value) : i(g.value).then(s, y);
  224. }
  225. F((o = o.apply(e, t || [])).next());
  226. });
  227. }, zt = function(e, t) {
  228. var n = {};
  229. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  230. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  231. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  232. return n;
  233. };
  234. const Nt = Y({
  235. compatConfig: {
  236. MODE: 3
  237. },
  238. name: "AjaxUploader",
  239. inheritAttrs: !1,
  240. props: Ae(),
  241. setup(e, t) {
  242. let {
  243. slots: n,
  244. attrs: o,
  245. expose: i
  246. } = t;
  247. const a = ne(pe()), r = {}, s = ne();
  248. let y = !1;
  249. const F = (d, v) => Bt(this, void 0, void 0, function* () {
  250. const {
  251. beforeUpload: $
  252. } = e;
  253. let I = d;
  254. if ($) {
  255. try {
  256. I = yield $(d, v);
  257. } catch (p) {
  258. I = !1;
  259. }
  260. if (I === !1)
  261. return {
  262. origin: d,
  263. parsedFile: null,
  264. action: null,
  265. data: null
  266. };
  267. }
  268. const {
  269. action: D
  270. } = e;
  271. let U;
  272. typeof D == "function" ? U = yield D(d) : U = D;
  273. const {
  274. data: j
  275. } = e;
  276. let A;
  277. typeof j == "function" ? A = yield j(d) : A = j;
  278. const M = (
  279. // string type is from legacy `transformFile`.
  280. // Not sure if this will work since no related test case works with it
  281. (typeof I == "object" || typeof I == "string") && I ? I : d
  282. );
  283. let c;
  284. M instanceof File ? c = M : c = new File([M], d.name, {
  285. type: d.type
  286. });
  287. const u = c;
  288. return u.uid = d.uid, {
  289. origin: d,
  290. data: A,
  291. parsedFile: u,
  292. action: U
  293. };
  294. }), g = (d) => {
  295. let {
  296. data: v,
  297. origin: $,
  298. action: I,
  299. parsedFile: D
  300. } = d;
  301. if (!y)
  302. return;
  303. const {
  304. onStart: U,
  305. customRequest: j,
  306. name: A,
  307. headers: M,
  308. withCredentials: c,
  309. method: u
  310. } = e, {
  311. uid: p
  312. } = $, f = j || At, h = {
  313. action: I,
  314. filename: A,
  315. data: v,
  316. file: D,
  317. headers: M,
  318. withCredentials: c,
  319. method: u || "post",
  320. onProgress: (C) => {
  321. const {
  322. onProgress: P
  323. } = e;
  324. P == null || P(C, D);
  325. },
  326. onSuccess: (C, P) => {
  327. const {
  328. onSuccess: x
  329. } = e;
  330. x == null || x(C, D, P), delete r[p];
  331. },
  332. onError: (C, P) => {
  333. const {
  334. onError: x
  335. } = e;
  336. x == null || x(C, P, D), delete r[p];
  337. }
  338. };
  339. U($), r[p] = f(h);
  340. }, T = () => {
  341. a.value = pe();
  342. }, R = (d) => {
  343. if (d) {
  344. const v = d.uid ? d.uid : d;
  345. r[v] && r[v].abort && r[v].abort(), delete r[v];
  346. } else
  347. Object.keys(r).forEach((v) => {
  348. r[v] && r[v].abort && r[v].abort(), delete r[v];
  349. });
  350. };
  351. ce(() => {
  352. y = !0;
  353. }), Oe(() => {
  354. y = !1, R();
  355. });
  356. const _ = (d) => {
  357. const v = [...d], $ = v.map((I) => (I.uid = pe(), F(I, v)));
  358. Promise.all($).then((I) => {
  359. const {
  360. onBatchStart: D
  361. } = e;
  362. D == null || D(I.map((U) => {
  363. let {
  364. origin: j,
  365. parsedFile: A
  366. } = U;
  367. return {
  368. file: j,
  369. parsedFile: A
  370. };
  371. })), I.filter((U) => U.parsedFile !== null).forEach((U) => {
  372. g(U);
  373. });
  374. });
  375. }, z = (d) => {
  376. const {
  377. accept: v,
  378. directory: $
  379. } = e, {
  380. files: I
  381. } = d.target, D = [...I].filter((U) => !$ || fe(U, v));
  382. _(D), T();
  383. }, l = (d) => {
  384. const v = s.value;
  385. if (!v)
  386. return;
  387. const {
  388. onClick: $
  389. } = e;
  390. v.click(), $ && $(d);
  391. }, b = (d) => {
  392. d.key === "Enter" && l(d);
  393. }, L = (d) => {
  394. const {
  395. multiple: v
  396. } = e;
  397. if (d.preventDefault(), d.type !== "dragover")
  398. if (e.directory)
  399. Mt(Array.prototype.slice.call(d.dataTransfer.items), _, ($) => fe($, e.accept));
  400. else {
  401. const $ = _t(Array.prototype.slice.call(d.dataTransfer.files), (U) => fe(U, e.accept));
  402. let I = $[0];
  403. const D = $[1];
  404. v === !1 && (I = I.slice(0, 1)), _(I), D.length && e.onReject && e.onReject(D);
  405. }
  406. };
  407. return i({
  408. abort: R
  409. }), () => {
  410. var d;
  411. const {
  412. componentTag: v,
  413. prefixCls: $,
  414. disabled: I,
  415. id: D,
  416. multiple: U,
  417. accept: j,
  418. capture: A,
  419. directory: M,
  420. openFileDialogOnClick: c,
  421. onMouseenter: u,
  422. onMouseleave: p
  423. } = e, f = zt(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), h = {
  424. [$]: !0,
  425. [`${$}-disabled`]: I,
  426. [o.class]: !!o.class
  427. }, C = M ? {
  428. directory: "directory",
  429. webkitdirectory: "webkitdirectory"
  430. } : {};
  431. return m(v, O(O({}, I ? {} : {
  432. onClick: c ? l : () => {
  433. },
  434. onKeydown: c ? b : () => {
  435. },
  436. onMouseenter: u,
  437. onMouseleave: p,
  438. onDrop: L,
  439. onDragover: L,
  440. tabindex: "0"
  441. }), {}, {
  442. class: h,
  443. role: "button",
  444. style: o.style
  445. }), {
  446. default: () => [m("input", O(O(O({}, Ve(f, {
  447. aria: !0,
  448. data: !0
  449. })), {}, {
  450. id: D,
  451. type: "file",
  452. ref: s,
  453. onClick: (x) => x.stopPropagation(),
  454. onCancel: (x) => x.stopPropagation(),
  455. key: a.value,
  456. style: {
  457. display: "none"
  458. },
  459. accept: j
  460. }, C), {}, {
  461. multiple: U,
  462. onChange: z
  463. }, A != null ? {
  464. capture: A
  465. } : {}), null), (d = n.default) === null || d === void 0 ? void 0 : d.call(n)]
  466. });
  467. };
  468. }
  469. });
  470. function me() {
  471. }
  472. const Ce = Y({
  473. compatConfig: {
  474. MODE: 3
  475. },
  476. name: "Upload",
  477. inheritAttrs: !1,
  478. props: ve(Ae(), {
  479. componentTag: "span",
  480. prefixCls: "rc-upload",
  481. data: {},
  482. headers: {},
  483. name: "file",
  484. multipart: !1,
  485. onStart: me,
  486. onError: me,
  487. onSuccess: me,
  488. multiple: !1,
  489. beforeUpload: null,
  490. customRequest: null,
  491. withCredentials: !1,
  492. openFileDialogOnClick: !0
  493. }),
  494. setup(e, t) {
  495. let {
  496. slots: n,
  497. attrs: o,
  498. expose: i
  499. } = t;
  500. const a = ne();
  501. return i({
  502. abort: (s) => {
  503. var y;
  504. (y = a.value) === null || y === void 0 || y.abort(s);
  505. }
  506. }), () => m(Nt, O(O(O({}, e), o), {}, {
  507. ref: a
  508. }), n);
  509. }
  510. });
  511. function Le() {
  512. return {
  513. capture: Q([Boolean, String]),
  514. type: J(),
  515. name: String,
  516. defaultFileList: se(),
  517. fileList: se(),
  518. action: Q([String, Function]),
  519. directory: B(),
  520. data: Q([Object, Function]),
  521. method: J(),
  522. headers: V(),
  523. showUploadList: Q([Boolean, Object]),
  524. multiple: B(),
  525. accept: String,
  526. beforeUpload: w(),
  527. onChange: w(),
  528. "onUpdate:fileList": w(),
  529. onDrop: w(),
  530. listType: J(),
  531. onPreview: w(),
  532. onDownload: w(),
  533. onReject: w(),
  534. onRemove: w(),
  535. /** @deprecated Please use `onRemove` directly */
  536. remove: w(),
  537. supportServerRender: B(),
  538. disabled: B(),
  539. prefixCls: String,
  540. customRequest: w(),
  541. withCredentials: B(),
  542. openFileDialogOnClick: B(),
  543. locale: V(),
  544. id: String,
  545. previewFile: w(),
  546. /** @deprecated Please use `beforeUpload` directly */
  547. transformFile: w(),
  548. iconRender: w(),
  549. isImageUrl: w(),
  550. progress: V(),
  551. itemRender: w(),
  552. /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
  553. maxCount: Number,
  554. height: Q([Number, String]),
  555. removeIcon: w(),
  556. downloadIcon: w(),
  557. previewIcon: w()
  558. };
  559. }
  560. function Xt() {
  561. return {
  562. listType: J(),
  563. onPreview: w(),
  564. onDownload: w(),
  565. onRemove: w(),
  566. items: se(),
  567. progress: V(),
  568. prefixCls: J(),
  569. showRemoveIcon: B(),
  570. showDownloadIcon: B(),
  571. showPreviewIcon: B(),
  572. removeIcon: w(),
  573. downloadIcon: w(),
  574. previewIcon: w(),
  575. locale: V(void 0),
  576. previewFile: w(),
  577. iconRender: w(),
  578. isImageUrl: w(),
  579. appendAction: w(),
  580. appendActionVisible: B(),
  581. itemRender: w()
  582. };
  583. }
  584. function re(e) {
  585. return S(S({}, e), {
  586. lastModified: e.lastModified,
  587. lastModifiedDate: e.lastModifiedDate,
  588. name: e.name,
  589. size: e.size,
  590. type: e.type,
  591. uid: e.uid,
  592. percent: 0,
  593. originFileObj: e
  594. });
  595. }
  596. function ie(e, t) {
  597. const n = [...t], o = n.findIndex((i) => {
  598. let {
  599. uid: a
  600. } = i;
  601. return a === e.uid;
  602. });
  603. return o === -1 ? n.push(e) : n[o] = e, n;
  604. }
  605. function ge(e, t) {
  606. const n = e.uid !== void 0 ? "uid" : "name";
  607. return t.filter((o) => o[n] === e[n])[0];
  608. }
  609. function Ht(e, t) {
  610. const n = e.uid !== void 0 ? "uid" : "name", o = t.filter((i) => i[n] !== e[n]);
  611. return o.length === t.length ? null : o;
  612. }
  613. const qt = function() {
  614. const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), o = t[t.length - 1].split(/#|\?/)[0];
  615. return (/\.[^./\\]*$/.exec(o) || [""])[0];
  616. }, Ee = (e) => e.indexOf("image/") === 0, Wt = (e) => {
  617. if (e.type && !e.thumbUrl)
  618. return Ee(e.type);
  619. const t = e.thumbUrl || e.url || "", n = qt(t);
  620. return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n) ? !0 : !(/^data:/.test(t) || n);
  621. }, G = 200;
  622. function Gt(e) {
  623. return new Promise((t) => {
  624. if (!e.type || !Ee(e.type)) {
  625. t("");
  626. return;
  627. }
  628. const n = document.createElement("canvas");
  629. n.width = G, n.height = G, n.style.cssText = `position: fixed; left: 0; top: 0; width: ${G}px; height: ${G}px; z-index: 9999; display: none;`, document.body.appendChild(n);
  630. const o = n.getContext("2d"), i = new Image();
  631. if (i.onload = () => {
  632. const {
  633. width: a,
  634. height: r
  635. } = i;
  636. let s = G, y = G, F = 0, g = 0;
  637. a > r ? (y = r * (G / a), g = -(y - s) / 2) : (s = a * (G / r), F = -(s - y) / 2), o.drawImage(i, F, g, s, y);
  638. const T = n.toDataURL();
  639. document.body.removeChild(n), t(T);
  640. }, i.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
  641. const a = new FileReader();
  642. a.addEventListener("load", () => {
  643. a.result && (i.src = a.result);
  644. }), a.readAsDataURL(e);
  645. } else
  646. i.src = window.URL.createObjectURL(e);
  647. });
  648. }
  649. const Vt = () => ({
  650. prefixCls: String,
  651. locale: V(void 0),
  652. file: V(),
  653. items: se(),
  654. listType: J(),
  655. isImgUrl: w(),
  656. showRemoveIcon: B(),
  657. showDownloadIcon: B(),
  658. showPreviewIcon: B(),
  659. removeIcon: w(),
  660. downloadIcon: w(),
  661. previewIcon: w(),
  662. iconRender: w(),
  663. actionIconRender: w(),
  664. itemRender: w(),
  665. onPreview: w(),
  666. onClose: w(),
  667. onDownload: w(),
  668. progress: V()
  669. }), Kt = Y({
  670. compatConfig: {
  671. MODE: 3
  672. },
  673. name: "ListItem",
  674. inheritAttrs: !1,
  675. props: Vt(),
  676. setup(e, t) {
  677. let {
  678. slots: n,
  679. attrs: o
  680. } = t;
  681. var i;
  682. const a = te(!1), r = te();
  683. ce(() => {
  684. r.value = setTimeout(() => {
  685. a.value = !0;
  686. }, 300);
  687. }), Oe(() => {
  688. clearTimeout(r.value);
  689. });
  690. const s = te((i = e.file) === null || i === void 0 ? void 0 : i.status);
  691. Te(() => {
  692. var g;
  693. return (g = e.file) === null || g === void 0 ? void 0 : g.status;
  694. }, (g) => {
  695. g !== "removed" && (s.value = g);
  696. });
  697. const {
  698. rootPrefixCls: y
  699. } = he("upload", e), F = oe(() => Ke(`${y.value}-fade`));
  700. return () => {
  701. var g, T;
  702. const {
  703. prefixCls: R,
  704. locale: _,
  705. listType: z,
  706. file: l,
  707. items: b,
  708. progress: L,
  709. iconRender: d = n.iconRender,
  710. actionIconRender: v = n.actionIconRender,
  711. itemRender: $ = n.itemRender,
  712. isImgUrl: I,
  713. showPreviewIcon: D,
  714. showRemoveIcon: U,
  715. showDownloadIcon: j,
  716. previewIcon: A = n.previewIcon,
  717. removeIcon: M = n.removeIcon,
  718. downloadIcon: c = n.downloadIcon,
  719. onPreview: u,
  720. onDownload: p,
  721. onClose: f
  722. } = e, {
  723. class: h,
  724. style: C
  725. } = o, P = d({
  726. file: l
  727. });
  728. let x = m("div", {
  729. class: `${R}-text-icon`
  730. }, [P]);
  731. if (z === "picture" || z === "picture-card")
  732. if (s.value === "uploading" || !l.thumbUrl && !l.url) {
  733. const N = {
  734. [`${R}-list-item-thumbnail`]: !0,
  735. [`${R}-list-item-file`]: s.value !== "uploading"
  736. };
  737. x = m("div", {
  738. class: N
  739. }, [P]);
  740. } else {
  741. const N = I != null && I(l) ? m("img", {
  742. src: l.thumbUrl || l.url,
  743. alt: l.name,
  744. class: `${R}-list-item-image`,
  745. crossorigin: l.crossOrigin
  746. }, null) : P, Ne = {
  747. [`${R}-list-item-thumbnail`]: !0,
  748. [`${R}-list-item-file`]: I && !I(l)
  749. };
  750. x = m("a", {
  751. class: Ne,
  752. onClick: (Xe) => u(l, Xe),
  753. href: l.url || l.thumbUrl,
  754. target: "_blank",
  755. rel: "noopener noreferrer"
  756. }, [N]);
  757. }
  758. const E = {
  759. [`${R}-list-item`]: !0,
  760. [`${R}-list-item-${s.value}`]: !0
  761. }, q = typeof l.linkProps == "string" ? JSON.parse(l.linkProps) : l.linkProps, K = U ? v({
  762. customIcon: M ? M({
  763. file: l
  764. }) : m(Je, null, null),
  765. callback: () => f(l),
  766. prefixCls: R,
  767. title: _.removeFile
  768. }) : null, X = j && s.value === "done" ? v({
  769. customIcon: c ? c({
  770. file: l
  771. }) : m(Ye, null, null),
  772. callback: () => p(l),
  773. prefixCls: R,
  774. title: _.downloadFile
  775. }) : null, H = z !== "picture-card" && m("span", {
  776. key: "download-delete",
  777. class: [`${R}-list-item-actions`, {
  778. picture: z === "picture"
  779. }]
  780. }, [X, K]), W = `${R}-list-item-name`, Z = l.url ? [m("a", O(O({
  781. key: "view",
  782. target: "_blank",
  783. rel: "noopener noreferrer",
  784. class: W,
  785. title: l.name
  786. }, q), {}, {
  787. href: l.url,
  788. onClick: (N) => u(l, N)
  789. }), [l.name]), H] : [m("span", {
  790. key: "view",
  791. class: W,
  792. onClick: (N) => u(l, N),
  793. title: l.name
  794. }, [l.name]), H], de = {
  795. pointerEvents: "none",
  796. opacity: 0.5
  797. }, je = D ? m("a", {
  798. href: l.url || l.thumbUrl,
  799. target: "_blank",
  800. rel: "noopener noreferrer",
  801. style: l.url || l.thumbUrl ? void 0 : de,
  802. onClick: (N) => u(l, N),
  803. title: _.previewFile
  804. }, [A ? A({
  805. file: l
  806. }) : m(Ze, null, null)]) : null, Me = z === "picture-card" && s.value !== "uploading" && m("span", {
  807. class: `${R}-list-item-actions`
  808. }, [je, s.value === "done" && X, K]), we = m("div", {
  809. class: E
  810. }, [x, Z, Me, a.value && m(gt, F.value, {
  811. default: () => [_e(m("div", {
  812. class: `${R}-list-item-progress`
  813. }, ["percent" in l ? m($t, O(O({}, L), {}, {
  814. type: "line",
  815. percent: l.percent
  816. }), null) : null]), [[Ue, s.value === "uploading"]])]
  817. })]), Be = {
  818. [`${R}-list-item-container`]: !0,
  819. [`${h}`]: !!h
  820. }, ze = l.response && typeof l.response == "string" ? l.response : ((g = l.error) === null || g === void 0 ? void 0 : g.statusText) || ((T = l.error) === null || T === void 0 ? void 0 : T.message) || _.uploadError, ye = s.value === "error" ? m(Qe, {
  821. title: ze,
  822. getPopupContainer: (N) => N.parentNode
  823. }, {
  824. default: () => [we]
  825. }) : we;
  826. return m("div", {
  827. class: Be,
  828. style: C
  829. }, [$ ? $({
  830. originNode: ye,
  831. file: l,
  832. fileList: b,
  833. actions: {
  834. download: p.bind(null, l),
  835. preview: u.bind(null, l),
  836. remove: f.bind(null, l)
  837. }
  838. }) : ye]);
  839. };
  840. }
  841. }), Jt = (e, t) => {
  842. let {
  843. slots: n
  844. } = t;
  845. var o;
  846. return it((o = n.default) === null || o === void 0 ? void 0 : o.call(n))[0];
  847. }, Yt = Y({
  848. compatConfig: {
  849. MODE: 3
  850. },
  851. name: "AUploadList",
  852. props: ve(Xt(), {
  853. listType: "text",
  854. progress: {
  855. strokeWidth: 2,
  856. showInfo: !1
  857. },
  858. showRemoveIcon: !0,
  859. showDownloadIcon: !1,
  860. showPreviewIcon: !0,
  861. previewFile: Gt,
  862. isImageUrl: Wt,
  863. items: [],
  864. appendActionVisible: !0
  865. }),
  866. setup(e, t) {
  867. let {
  868. slots: n,
  869. expose: o
  870. } = t;
  871. const i = te(!1);
  872. ce(() => {
  873. i.value == !0;
  874. });
  875. const a = te([]);
  876. Te(() => e.items, function() {
  877. let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
  878. a.value = l.slice();
  879. }, {
  880. immediate: !0,
  881. deep: !0
  882. }), vt(() => {
  883. if (e.listType !== "picture" && e.listType !== "picture-card")
  884. return;
  885. let l = !1;
  886. (e.items || []).forEach((b, L) => {
  887. typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(b.originFileObj instanceof File || b.originFileObj instanceof Blob) || b.thumbUrl !== void 0 || (b.thumbUrl = "", e.previewFile && e.previewFile(b.originFileObj).then((d) => {
  888. const v = d || "";
  889. v !== b.thumbUrl && (a.value[L].thumbUrl = v, l = !0);
  890. }));
  891. }), l && ht(a);
  892. });
  893. const r = (l, b) => {
  894. if (e.onPreview)
  895. return b == null || b.preventDefault(), e.onPreview(l);
  896. }, s = (l) => {
  897. typeof e.onDownload == "function" ? e.onDownload(l) : l.url && window.open(l.url);
  898. }, y = (l) => {
  899. var b;
  900. (b = e.onRemove) === null || b === void 0 || b.call(e, l);
  901. }, F = (l) => {
  902. let {
  903. file: b
  904. } = l;
  905. const L = e.iconRender || n.iconRender;
  906. if (L)
  907. return L({
  908. file: b,
  909. listType: e.listType
  910. });
  911. const d = b.status === "uploading", v = e.isImageUrl && e.isImageUrl(b) ? m(tt, null, null) : m(nt, null, null);
  912. let $ = d ? m(be, null, null) : m(ot, null, null);
  913. return e.listType === "picture" ? $ = d ? m(be, null, null) : v : e.listType === "picture-card" && ($ = d ? e.locale.uploading : v), $;
  914. }, g = (l) => {
  915. const {
  916. customIcon: b,
  917. callback: L,
  918. prefixCls: d,
  919. title: v
  920. } = l, $ = {
  921. type: "text",
  922. size: "small",
  923. title: v,
  924. onClick: () => {
  925. L();
  926. },
  927. class: `${d}-list-item-action`
  928. };
  929. return rt(b) ? m($e, $, {
  930. icon: () => b
  931. }) : m($e, $, {
  932. default: () => [m("span", null, [b])]
  933. });
  934. };
  935. o({
  936. handlePreview: r,
  937. handleDownload: s
  938. });
  939. const {
  940. prefixCls: T,
  941. rootPrefixCls: R
  942. } = he("upload", e), _ = oe(() => ({
  943. [`${T.value}-list`]: !0,
  944. [`${T.value}-list-${e.listType}`]: !0
  945. })), z = oe(() => {
  946. const l = S({}, ke(`${R.value}-motion-collapse`));
  947. delete l.onAfterAppear, delete l.onAfterEnter, delete l.onAfterLeave;
  948. const b = S(S({}, et(`${T.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
  949. class: _.value,
  950. appear: i.value
  951. });
  952. return e.listType !== "picture-card" ? S(S({}, l), b) : b;
  953. });
  954. return () => {
  955. const {
  956. listType: l,
  957. locale: b,
  958. isImageUrl: L,
  959. showPreviewIcon: d,
  960. showRemoveIcon: v,
  961. showDownloadIcon: $,
  962. removeIcon: I,
  963. previewIcon: D,
  964. downloadIcon: U,
  965. progress: j,
  966. appendAction: A,
  967. itemRender: M,
  968. appendActionVisible: c
  969. } = e, u = A == null ? void 0 : A(), p = a.value;
  970. return m(wt, O(O({}, z.value), {}, {
  971. tag: "div"
  972. }), {
  973. default: () => [p.map((f) => {
  974. const {
  975. uid: h
  976. } = f;
  977. return m(Kt, {
  978. key: h,
  979. locale: b,
  980. prefixCls: T.value,
  981. file: f,
  982. items: p,
  983. progress: j,
  984. listType: l,
  985. isImgUrl: L,
  986. showPreviewIcon: d,
  987. showRemoveIcon: v,
  988. showDownloadIcon: $,
  989. onPreview: r,
  990. onDownload: s,
  991. onClose: y,
  992. removeIcon: I,
  993. previewIcon: D,
  994. downloadIcon: U,
  995. itemRender: M
  996. }, S(S({}, n), {
  997. iconRender: F,
  998. actionIconRender: g
  999. }));
  1000. }), A ? _e(m(Jt, {
  1001. key: "__ant_upload_appendAction"
  1002. }, {
  1003. default: () => u
  1004. }), [[Ue, !!c]]) : null]
  1005. });
  1006. };
  1007. }
  1008. }), Zt = (e) => {
  1009. const {
  1010. componentCls: t,
  1011. iconCls: n
  1012. } = e;
  1013. return {
  1014. [`${t}-wrapper`]: {
  1015. [`${t}-drag`]: {
  1016. position: "relative",
  1017. width: "100%",
  1018. height: "100%",
  1019. textAlign: "center",
  1020. background: e.colorFillAlter,
  1021. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1022. borderRadius: e.borderRadiusLG,
  1023. cursor: "pointer",
  1024. transition: `border-color ${e.motionDurationSlow}`,
  1025. [t]: {
  1026. padding: `${e.padding}px 0`
  1027. },
  1028. [`${t}-btn`]: {
  1029. display: "table",
  1030. width: "100%",
  1031. height: "100%",
  1032. outline: "none"
  1033. },
  1034. [`${t}-drag-container`]: {
  1035. display: "table-cell",
  1036. verticalAlign: "middle"
  1037. },
  1038. [`&:not(${t}-disabled):hover`]: {
  1039. borderColor: e.colorPrimaryHover
  1040. },
  1041. [`p${t}-drag-icon`]: {
  1042. marginBottom: e.margin,
  1043. [n]: {
  1044. color: e.colorPrimary,
  1045. fontSize: e.uploadThumbnailSize
  1046. }
  1047. },
  1048. [`p${t}-text`]: {
  1049. margin: `0 0 ${e.marginXXS}px`,
  1050. color: e.colorTextHeading,
  1051. fontSize: e.fontSizeLG
  1052. },
  1053. [`p${t}-hint`]: {
  1054. color: e.colorTextDescription,
  1055. fontSize: e.fontSize
  1056. },
  1057. // ===================== Disabled =====================
  1058. [`&${t}-disabled`]: {
  1059. cursor: "not-allowed",
  1060. [`p${t}-drag-icon ${n},
  1061. p${t}-text,
  1062. p${t}-hint
  1063. `]: {
  1064. color: e.colorTextDisabled
  1065. }
  1066. }
  1067. }
  1068. }
  1069. };
  1070. }, Qt = (e) => {
  1071. const {
  1072. componentCls: t,
  1073. antCls: n,
  1074. iconCls: o,
  1075. fontSize: i,
  1076. lineHeight: a
  1077. } = e, r = `${t}-list-item`, s = `${r}-actions`, y = `${r}-action`, F = Math.round(i * a);
  1078. return {
  1079. [`${t}-wrapper`]: {
  1080. [`${t}-list`]: S(S({}, Re()), {
  1081. lineHeight: e.lineHeight,
  1082. [r]: {
  1083. position: "relative",
  1084. height: e.lineHeight * i,
  1085. marginTop: e.marginXS,
  1086. fontSize: i,
  1087. display: "flex",
  1088. alignItems: "center",
  1089. transition: `background-color ${e.motionDurationSlow}`,
  1090. "&:hover": {
  1091. backgroundColor: e.controlItemBgHover
  1092. },
  1093. [`${r}-name`]: S(S({}, De), {
  1094. padding: `0 ${e.paddingXS}px`,
  1095. lineHeight: a,
  1096. flex: "auto",
  1097. transition: `all ${e.motionDurationSlow}`
  1098. }),
  1099. [s]: {
  1100. [y]: {
  1101. opacity: 0
  1102. },
  1103. [`${y}${n}-btn-sm`]: {
  1104. height: F,
  1105. border: 0,
  1106. lineHeight: 1,
  1107. // FIXME: should not override small button
  1108. "> span": {
  1109. transform: "scale(1)"
  1110. }
  1111. },
  1112. [`
  1113. ${y}:focus,
  1114. &.picture ${y}
  1115. `]: {
  1116. opacity: 1
  1117. },
  1118. [o]: {
  1119. color: e.colorTextDescription,
  1120. transition: `all ${e.motionDurationSlow}`
  1121. },
  1122. [`&:hover ${o}`]: {
  1123. color: e.colorText
  1124. }
  1125. },
  1126. [`${t}-icon ${o}`]: {
  1127. color: e.colorTextDescription,
  1128. fontSize: i
  1129. },
  1130. [`${r}-progress`]: {
  1131. position: "absolute",
  1132. bottom: -e.uploadProgressOffset,
  1133. width: "100%",
  1134. paddingInlineStart: i + e.paddingXS,
  1135. fontSize: i,
  1136. lineHeight: 0,
  1137. pointerEvents: "none",
  1138. "> div": {
  1139. margin: 0
  1140. }
  1141. }
  1142. },
  1143. [`${r}:hover ${y}`]: {
  1144. opacity: 1,
  1145. color: e.colorText
  1146. },
  1147. [`${r}-error`]: {
  1148. color: e.colorError,
  1149. [`${r}-name, ${t}-icon ${o}`]: {
  1150. color: e.colorError
  1151. },
  1152. [s]: {
  1153. [`${o}, ${o}:hover`]: {
  1154. color: e.colorError
  1155. },
  1156. [y]: {
  1157. opacity: 1
  1158. }
  1159. }
  1160. },
  1161. [`${t}-list-item-container`]: {
  1162. transition: `opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`,
  1163. // For smooth removing animation
  1164. "&::before": {
  1165. display: "table",
  1166. width: 0,
  1167. height: 0,
  1168. content: '""'
  1169. }
  1170. }
  1171. })
  1172. }
  1173. };
  1174. }, Se = new Pe("uploadAnimateInlineIn", {
  1175. from: {
  1176. width: 0,
  1177. height: 0,
  1178. margin: 0,
  1179. padding: 0,
  1180. opacity: 0
  1181. }
  1182. }), xe = new Pe("uploadAnimateInlineOut", {
  1183. to: {
  1184. width: 0,
  1185. height: 0,
  1186. margin: 0,
  1187. padding: 0,
  1188. opacity: 0
  1189. }
  1190. }), kt = (e) => {
  1191. const {
  1192. componentCls: t
  1193. } = e, n = `${t}-animate-inline`;
  1194. return [{
  1195. [`${t}-wrapper`]: {
  1196. [`${n}-appear, ${n}-enter, ${n}-leave`]: {
  1197. animationDuration: e.motionDurationSlow,
  1198. animationTimingFunction: e.motionEaseInOutCirc,
  1199. animationFillMode: "forwards"
  1200. },
  1201. [`${n}-appear, ${n}-enter`]: {
  1202. animationName: Se
  1203. },
  1204. [`${n}-leave`]: {
  1205. animationName: xe
  1206. }
  1207. }
  1208. }, Se, xe];
  1209. }, en = (e) => {
  1210. const {
  1211. componentCls: t,
  1212. iconCls: n,
  1213. uploadThumbnailSize: o,
  1214. uploadProgressOffset: i
  1215. } = e, a = `${t}-list`, r = `${a}-item`;
  1216. return {
  1217. [`${t}-wrapper`]: {
  1218. // ${listCls} 增加优先级
  1219. [`${a}${a}-picture, ${a}${a}-picture-card`]: {
  1220. [r]: {
  1221. position: "relative",
  1222. height: o + e.lineWidth * 2 + e.paddingXS * 2,
  1223. padding: e.paddingXS,
  1224. border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,
  1225. borderRadius: e.borderRadiusLG,
  1226. "&:hover": {
  1227. background: "transparent"
  1228. },
  1229. [`${r}-thumbnail`]: S(S({}, De), {
  1230. width: o,
  1231. height: o,
  1232. lineHeight: `${o + e.paddingSM}px`,
  1233. textAlign: "center",
  1234. flex: "none",
  1235. [n]: {
  1236. fontSize: e.fontSizeHeading2,
  1237. color: e.colorPrimary
  1238. },
  1239. img: {
  1240. display: "block",
  1241. width: "100%",
  1242. height: "100%",
  1243. overflow: "hidden"
  1244. }
  1245. }),
  1246. [`${r}-progress`]: {
  1247. bottom: i,
  1248. width: `calc(100% - ${e.paddingSM * 2}px)`,
  1249. marginTop: 0,
  1250. paddingInlineStart: o + e.paddingXS
  1251. }
  1252. },
  1253. [`${r}-error`]: {
  1254. borderColor: e.colorError,
  1255. // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
  1256. [`${r}-thumbnail ${n}`]: {
  1257. "svg path[fill='#e6f7ff']": {
  1258. fill: e.colorErrorBg
  1259. },
  1260. "svg path[fill='#1890ff']": {
  1261. fill: e.colorError
  1262. }
  1263. }
  1264. },
  1265. [`${r}-uploading`]: {
  1266. borderStyle: "dashed",
  1267. [`${r}-name`]: {
  1268. marginBottom: i
  1269. }
  1270. }
  1271. }
  1272. }
  1273. };
  1274. }, tn = (e) => {
  1275. const {
  1276. componentCls: t,
  1277. iconCls: n,
  1278. fontSizeLG: o,
  1279. colorTextLightSolid: i
  1280. } = e, a = `${t}-list`, r = `${a}-item`, s = e.uploadPicCardSize;
  1281. return {
  1282. [`${t}-wrapper${t}-picture-card-wrapper`]: S(S({}, Re()), {
  1283. display: "inline-block",
  1284. width: "100%",
  1285. [`${t}${t}-select`]: {
  1286. width: s,
  1287. height: s,
  1288. marginInlineEnd: e.marginXS,
  1289. marginBottom: e.marginXS,
  1290. textAlign: "center",
  1291. verticalAlign: "top",
  1292. backgroundColor: e.colorFillAlter,
  1293. border: `${e.lineWidth}px dashed ${e.colorBorder}`,
  1294. borderRadius: e.borderRadiusLG,
  1295. cursor: "pointer",
  1296. transition: `border-color ${e.motionDurationSlow}`,
  1297. [`> ${t}`]: {
  1298. display: "flex",
  1299. alignItems: "center",
  1300. justifyContent: "center",
  1301. height: "100%",
  1302. textAlign: "center"
  1303. },
  1304. [`&:not(${t}-disabled):hover`]: {
  1305. borderColor: e.colorPrimary
  1306. }
  1307. },
  1308. // list
  1309. [`${a}${a}-picture-card`]: {
  1310. [`${a}-item-container`]: {
  1311. display: "inline-block",
  1312. width: s,
  1313. height: s,
  1314. marginBlock: `0 ${e.marginXS}px`,
  1315. marginInline: `0 ${e.marginXS}px`,
  1316. verticalAlign: "top"
  1317. },
  1318. "&::after": {
  1319. display: "none"
  1320. },
  1321. [r]: {
  1322. height: "100%",
  1323. margin: 0,
  1324. "&::before": {
  1325. position: "absolute",
  1326. zIndex: 1,
  1327. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1328. height: `calc(100% - ${e.paddingXS * 2}px)`,
  1329. backgroundColor: e.colorBgMask,
  1330. opacity: 0,
  1331. transition: `all ${e.motionDurationSlow}`,
  1332. content: '" "'
  1333. }
  1334. },
  1335. [`${r}:hover`]: {
  1336. [`&::before, ${r}-actions`]: {
  1337. opacity: 1
  1338. }
  1339. },
  1340. [`${r}-actions`]: {
  1341. position: "absolute",
  1342. insetInlineStart: 0,
  1343. zIndex: 10,
  1344. width: "100%",
  1345. whiteSpace: "nowrap",
  1346. textAlign: "center",
  1347. opacity: 0,
  1348. transition: `all ${e.motionDurationSlow}`,
  1349. [`${n}-eye, ${n}-download, ${n}-delete`]: {
  1350. zIndex: 10,
  1351. width: o,
  1352. margin: `0 ${e.marginXXS}px`,
  1353. fontSize: o,
  1354. cursor: "pointer",
  1355. transition: `all ${e.motionDurationSlow}`
  1356. }
  1357. },
  1358. [`${r}-actions, ${r}-actions:hover`]: {
  1359. [`${n}-eye, ${n}-download, ${n}-delete`]: {
  1360. color: new at(i).setAlpha(0.65).toRgbString(),
  1361. "&:hover": {
  1362. color: i
  1363. }
  1364. }
  1365. },
  1366. [`${r}-thumbnail, ${r}-thumbnail img`]: {
  1367. position: "static",
  1368. display: "block",
  1369. width: "100%",
  1370. height: "100%",
  1371. objectFit: "contain"
  1372. },
  1373. [`${r}-name`]: {
  1374. display: "none",
  1375. textAlign: "center"
  1376. },
  1377. [`${r}-file + ${r}-name`]: {
  1378. position: "absolute",
  1379. bottom: e.margin,
  1380. display: "block",
  1381. width: `calc(100% - ${e.paddingXS * 2}px)`
  1382. },
  1383. [`${r}-uploading`]: {
  1384. [`&${r}`]: {
  1385. backgroundColor: e.colorFillAlter
  1386. },
  1387. [`&::before, ${n}-eye, ${n}-download, ${n}-delete`]: {
  1388. display: "none"
  1389. }
  1390. },
  1391. [`${r}-progress`]: {
  1392. bottom: e.marginXL,
  1393. width: `calc(100% - ${e.paddingXS * 2}px)`,
  1394. paddingInlineStart: 0
  1395. }
  1396. }
  1397. })
  1398. };
  1399. }, nn = (e) => {
  1400. const {
  1401. componentCls: t
  1402. } = e;
  1403. return {
  1404. [`${t}-rtl`]: {
  1405. direction: "rtl"
  1406. }
  1407. };
  1408. }, on = (e) => {
  1409. const {
  1410. componentCls: t,
  1411. colorTextDisabled: n
  1412. } = e;
  1413. return {
  1414. [`${t}-wrapper`]: S(S({}, dt(e)), {
  1415. [t]: {
  1416. outline: 0,
  1417. "input[type='file']": {
  1418. cursor: "pointer"
  1419. }
  1420. },
  1421. [`${t}-select`]: {
  1422. display: "inline-block"
  1423. },
  1424. [`${t}-disabled`]: {
  1425. color: n,
  1426. cursor: "not-allowed"
  1427. }
  1428. })
  1429. };
  1430. }, rn = lt("Upload", (e) => {
  1431. const {
  1432. fontSizeHeading3: t,
  1433. fontSize: n,
  1434. lineHeight: o,
  1435. lineWidth: i,
  1436. controlHeightLG: a
  1437. } = e, r = Math.round(n * o), s = st(e, {
  1438. uploadThumbnailSize: t * 2,
  1439. uploadProgressOffset: r / 2 + i,
  1440. uploadPicCardSize: a * 2.55
  1441. });
  1442. return [on(s), Zt(s), en(s), tn(s), Qt(s), kt(s), nn(s), ct(s)];
  1443. });
  1444. var an = function(e, t, n, o) {
  1445. function i(a) {
  1446. return a instanceof n ? a : new n(function(r) {
  1447. r(a);
  1448. });
  1449. }
  1450. return new (n || (n = Promise))(function(a, r) {
  1451. function s(g) {
  1452. try {
  1453. F(o.next(g));
  1454. } catch (T) {
  1455. r(T);
  1456. }
  1457. }
  1458. function y(g) {
  1459. try {
  1460. F(o.throw(g));
  1461. } catch (T) {
  1462. r(T);
  1463. }
  1464. }
  1465. function F(g) {
  1466. g.done ? a(g.value) : i(g.value).then(s, y);
  1467. }
  1468. F((o = o.apply(e, t || [])).next());
  1469. });
  1470. }, ln = function(e, t) {
  1471. var n = {};
  1472. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1473. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  1474. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  1475. return n;
  1476. };
  1477. const ee = `__LIST_IGNORE_${Date.now()}__`, ae = Y({
  1478. compatConfig: {
  1479. MODE: 3
  1480. },
  1481. name: "AUpload",
  1482. inheritAttrs: !1,
  1483. props: ve(Le(), {
  1484. type: "select",
  1485. multiple: !1,
  1486. action: "",
  1487. data: {},
  1488. accept: "",
  1489. showUploadList: !0,
  1490. listType: "text",
  1491. supportServerRender: !0
  1492. }),
  1493. setup(e, t) {
  1494. let {
  1495. slots: n,
  1496. attrs: o,
  1497. expose: i
  1498. } = t;
  1499. const a = Ct(), {
  1500. prefixCls: r,
  1501. direction: s,
  1502. disabled: y
  1503. } = he("upload", e), [F, g] = rn(r), T = ut(), R = oe(() => {
  1504. var c;
  1505. return (c = y.value) !== null && c !== void 0 ? c : T.value;
  1506. }), [_, z] = It(e.defaultFileList || [], {
  1507. value: yt(e, "fileList"),
  1508. postState: (c) => {
  1509. const u = Date.now();
  1510. return (c != null ? c : []).map((p, f) => (!p.uid && !Object.isFrozen(p) && (p.uid = `__AUTO__${u}_${f}__`), p));
  1511. }
  1512. }), l = ne("drop"), b = ne(null);
  1513. ce(() => {
  1514. ue(e.fileList !== void 0 || o.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), ue(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), ue(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event.");
  1515. });
  1516. const L = (c, u, p) => {
  1517. var f, h;
  1518. let C = [...u];
  1519. e.maxCount === 1 ? C = C.slice(-1) : e.maxCount && (C = C.slice(0, e.maxCount)), z(C);
  1520. const P = {
  1521. file: c,
  1522. fileList: C
  1523. };
  1524. p && (P.event = p), (f = e["onUpdate:fileList"]) === null || f === void 0 || f.call(e, P.fileList), (h = e.onChange) === null || h === void 0 || h.call(e, P), a.onFieldChange();
  1525. }, d = (c, u) => an(this, void 0, void 0, function* () {
  1526. const {
  1527. beforeUpload: p,
  1528. transformFile: f
  1529. } = e;
  1530. let h = c;
  1531. if (p) {
  1532. const C = yield p(c, u);
  1533. if (C === !1)
  1534. return !1;
  1535. if (delete c[ee], C === ee)
  1536. return Object.defineProperty(c, ee, {
  1537. value: !0,
  1538. configurable: !0
  1539. }), !1;
  1540. typeof C == "object" && C && (h = C);
  1541. }
  1542. return f && (h = yield f(h)), h;
  1543. }), v = (c) => {
  1544. const u = c.filter((h) => !h.file[ee]);
  1545. if (!u.length)
  1546. return;
  1547. const p = u.map((h) => re(h.file));
  1548. let f = [..._.value];
  1549. p.forEach((h) => {
  1550. f = ie(h, f);
  1551. }), p.forEach((h, C) => {
  1552. let P = h;
  1553. if (u[C].parsedFile)
  1554. h.status = "uploading";
  1555. else {
  1556. const {
  1557. originFileObj: x
  1558. } = h;
  1559. let E;
  1560. try {
  1561. E = new File([x], x.name, {
  1562. type: x.type
  1563. });
  1564. } catch (q) {
  1565. E = new Blob([x], {
  1566. type: x.type
  1567. }), E.name = x.name, E.lastModifiedDate = /* @__PURE__ */ new Date(), E.lastModified = (/* @__PURE__ */ new Date()).getTime();
  1568. }
  1569. E.uid = h.uid, P = E;
  1570. }
  1571. L(P, f);
  1572. });
  1573. }, $ = (c, u, p) => {
  1574. try {
  1575. typeof c == "string" && (c = JSON.parse(c));
  1576. } catch (C) {
  1577. }
  1578. if (!ge(u, _.value))
  1579. return;
  1580. const f = re(u);
  1581. f.status = "done", f.percent = 100, f.response = c, f.xhr = p;
  1582. const h = ie(f, _.value);
  1583. L(f, h);
  1584. }, I = (c, u) => {
  1585. if (!ge(u, _.value))
  1586. return;
  1587. const p = re(u);
  1588. p.status = "uploading", p.percent = c.percent;
  1589. const f = ie(p, _.value);
  1590. L(p, f, c);
  1591. }, D = (c, u, p) => {
  1592. if (!ge(p, _.value))
  1593. return;
  1594. const f = re(p);
  1595. f.error = c, f.response = u, f.status = "error";
  1596. const h = ie(f, _.value);
  1597. L(f, h);
  1598. }, U = (c) => {
  1599. let u;
  1600. const p = e.onRemove || e.remove;
  1601. Promise.resolve(typeof p == "function" ? p(c) : p).then((f) => {
  1602. var h, C;
  1603. if (f === !1)
  1604. return;
  1605. const P = Ht(c, _.value);
  1606. P && (u = S(S({}, c), {
  1607. status: "removed"
  1608. }), (h = _.value) === null || h === void 0 || h.forEach((x) => {
  1609. const E = u.uid !== void 0 ? "uid" : "name";
  1610. x[E] === u[E] && !Object.isFrozen(x) && (x.status = "removed");
  1611. }), (C = b.value) === null || C === void 0 || C.abort(u), L(u, P));
  1612. });
  1613. }, j = (c) => {
  1614. var u;
  1615. l.value = c.type, c.type === "drop" && ((u = e.onDrop) === null || u === void 0 || u.call(e, c));
  1616. };
  1617. i({
  1618. onBatchStart: v,
  1619. onSuccess: $,
  1620. onProgress: I,
  1621. onError: D,
  1622. fileList: _,
  1623. upload: b
  1624. });
  1625. const [A] = pt("Upload", ft.Upload, oe(() => e.locale)), M = (c, u) => {
  1626. const {
  1627. removeIcon: p,
  1628. previewIcon: f,
  1629. downloadIcon: h,
  1630. previewFile: C,
  1631. onPreview: P,
  1632. onDownload: x,
  1633. isImageUrl: E,
  1634. progress: q,
  1635. itemRender: K,
  1636. iconRender: X,
  1637. showUploadList: H
  1638. } = e, {
  1639. showDownloadIcon: W,
  1640. showPreviewIcon: Z,
  1641. showRemoveIcon: de
  1642. } = typeof H == "boolean" ? {} : H;
  1643. return H ? m(Yt, {
  1644. prefixCls: r.value,
  1645. listType: e.listType,
  1646. items: _.value,
  1647. previewFile: C,
  1648. onPreview: P,
  1649. onDownload: x,
  1650. onRemove: U,
  1651. showRemoveIcon: !R.value && de,
  1652. showPreviewIcon: Z,
  1653. showDownloadIcon: W,
  1654. removeIcon: p,
  1655. previewIcon: f,
  1656. downloadIcon: h,
  1657. iconRender: X,
  1658. locale: A.value,
  1659. isImageUrl: E,
  1660. progress: q,
  1661. itemRender: K,
  1662. appendActionVisible: u,
  1663. appendAction: c
  1664. }, S({}, n)) : c == null ? void 0 : c();
  1665. };
  1666. return () => {
  1667. var c, u, p;
  1668. const {
  1669. listType: f,
  1670. type: h
  1671. } = e, {
  1672. class: C,
  1673. style: P
  1674. } = o, x = ln(o, ["class", "style"]), E = S(S(S({
  1675. onBatchStart: v,
  1676. onError: D,
  1677. onProgress: I,
  1678. onSuccess: $
  1679. }, x), e), {
  1680. id: (c = e.id) !== null && c !== void 0 ? c : a.id.value,
  1681. prefixCls: r.value,
  1682. beforeUpload: d,
  1683. onChange: void 0,
  1684. disabled: R.value
  1685. });
  1686. delete E.remove, (!n.default || R.value) && delete E.id;
  1687. const q = {
  1688. [`${r.value}-rtl`]: s.value === "rtl"
  1689. };
  1690. if (h === "drag") {
  1691. const W = k(r.value, {
  1692. [`${r.value}-drag`]: !0,
  1693. [`${r.value}-drag-uploading`]: _.value.some((Z) => Z.status === "uploading"),
  1694. [`${r.value}-drag-hover`]: l.value === "dragover",
  1695. [`${r.value}-disabled`]: R.value,
  1696. [`${r.value}-rtl`]: s.value === "rtl"
  1697. }, o.class, g.value);
  1698. return F(m("span", O(O({}, o), {}, {
  1699. class: k(`${r.value}-wrapper`, q, C, g.value)
  1700. }), [m("div", {
  1701. class: W,
  1702. onDrop: j,
  1703. onDragover: j,
  1704. onDragleave: j,
  1705. style: o.style
  1706. }, [m(Ce, O(O({}, E), {}, {
  1707. ref: b,
  1708. class: `${r.value}-btn`
  1709. }), O({
  1710. default: () => [m("div", {
  1711. class: `${r.value}-drag-container`
  1712. }, [(u = n.default) === null || u === void 0 ? void 0 : u.call(n)])]
  1713. }, n))]), M()]));
  1714. }
  1715. const K = k(r.value, {
  1716. [`${r.value}-select`]: !0,
  1717. [`${r.value}-select-${f}`]: !0,
  1718. [`${r.value}-disabled`]: R.value,
  1719. [`${r.value}-rtl`]: s.value === "rtl"
  1720. }), X = mt((p = n.default) === null || p === void 0 ? void 0 : p.call(n)), H = (W) => m("div", {
  1721. class: K,
  1722. style: W
  1723. }, [m(Ce, O(O({}, E), {}, {
  1724. ref: b
  1725. }), n)]);
  1726. return F(f === "picture-card" ? m("span", O(O({}, o), {}, {
  1727. class: k(`${r.value}-wrapper`, `${r.value}-picture-card-wrapper`, q, o.class, g.value)
  1728. }), [M(H, !!(X && X.length))]) : m("span", O(O({}, o), {}, {
  1729. class: k(`${r.value}-wrapper`, q, o.class, g.value)
  1730. }), [H(X && X.length ? void 0 : {
  1731. display: "none"
  1732. }), M()]));
  1733. };
  1734. }
  1735. });
  1736. var Fe = function(e, t) {
  1737. var n = {};
  1738. for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
  1739. if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++)
  1740. t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]);
  1741. return n;
  1742. };
  1743. const le = Y({
  1744. compatConfig: {
  1745. MODE: 3
  1746. },
  1747. name: "AUploadDragger",
  1748. inheritAttrs: !1,
  1749. props: Le(),
  1750. setup(e, t) {
  1751. let {
  1752. slots: n,
  1753. attrs: o
  1754. } = t;
  1755. return () => {
  1756. const {
  1757. height: i
  1758. } = e, a = Fe(e, ["height"]), {
  1759. style: r
  1760. } = o, s = Fe(o, ["style"]), y = S(S(S({}, a), s), {
  1761. type: "drag",
  1762. style: S(S({}, r), {
  1763. height: typeof i == "number" ? `${i}px` : i
  1764. })
  1765. });
  1766. return m(ae, y, n);
  1767. };
  1768. }
  1769. }), gn = le, vn = S(ae, {
  1770. Dragger: le,
  1771. LIST_IGNORE: ee,
  1772. install(e) {
  1773. return e.component(ae.name, ae), e.component(le.name, le), e;
  1774. }
  1775. });
  1776. export {
  1777. gn as U,
  1778. vn as _
  1779. };