| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577 |
- import { x as rt, y as it, z as lt, A as B, C as I, D as W, E as Se, e as q, F as Z, d as J, G as Ce, _ as P, a as D, b as ne, H as ke, g as Me, I as Ne, J as We, M as xe, j as fe, N as st, O as at, Q as ct, S as ut, h as dt, w as pt, T as de, U as ft, V as gt, W as mt, X as vt, Y as ht, Z as yt, $ as bt, a0 as wt, a1 as $t, n as Oe, a2 as Ct, i as St, B as De, a3 as Be, t as Xe, a4 as xt, a5 as It, l as Pt, a6 as Ot, a7 as Dt, m as re, a8 as Ft } from "./index2.js";
- import { ref as Q, onBeforeUpdate as Rt, defineComponent as z, computed as _, createVNode as d, Fragment as ze, onUpdated as _t, onMounted as ge, onBeforeUnmount as He, shallowRef as le, watch as Ge, Transition as At, withDirectives as qe, vShow as Ve, watchEffect as Tt, triggerRef as Et, TransitionGroup as Lt, toRef as jt } from "vue";
- import { p as Ut } from "./pickAttrs.js";
- import { b as kt } from "./index5.js";
- import { u as Mt } from "./useMergedState.js";
- import { u as Nt } from "./FormItemContext.js";
- function Wt(e, t, o, n) {
- for (var r = -1, l = e == null ? 0 : e.length; ++r < l; ) {
- var i = e[r];
- t(n, i, o(i), e);
- }
- return n;
- }
- function Bt(e) {
- return function(t, o, n) {
- for (var r = -1, l = Object(t), i = n(t), a = i.length; a--; ) {
- var c = i[++r];
- if (o(l[c], c, l) === !1)
- break;
- }
- return t;
- };
- }
- var Xt = Bt();
- function zt(e, t) {
- return e && Xt(e, t, rt);
- }
- function Ht(e, t) {
- return function(o, n) {
- if (o == null)
- return o;
- if (!it(o))
- return e(o, n);
- for (var r = o.length, l = -1, i = Object(o); ++l < r && n(i[l], l, i) !== !1; )
- ;
- return o;
- };
- }
- var Gt = Ht(zt);
- function qt(e, t, o, n) {
- return Gt(e, function(r, l, i) {
- t(n, r, o(r), i);
- }), n;
- }
- function Vt(e, t) {
- return function(o, n) {
- var r = lt(o) ? Wt : qt, l = t ? t() : {};
- return r(o, e, kt(n), l);
- };
- }
- var Kt = Vt(function(e, t, o) {
- e[o ? 0 : 1].push(t);
- }, function() {
- return [[], []];
- });
- const Yt = () => {
- const e = Q(/* @__PURE__ */ new Map()), t = (o) => (n) => {
- e.value.set(o, n);
- };
- return Rt(() => {
- e.value = /* @__PURE__ */ new Map();
- }), [t, e];
- }, Jt = ["normal", "exception", "active", "success"], me = () => ({
- prefixCls: String,
- type: B(),
- percent: Number,
- format: I(),
- status: B(),
- showInfo: W(),
- strokeWidth: Number,
- strokeLinecap: B(),
- strokeColor: Se(),
- trailColor: String,
- /** @deprecated Use `size` instead */
- width: Number,
- success: q(),
- gapDegree: Number,
- gapPosition: B(),
- size: Z([String, Number, Array]),
- steps: Number,
- /** @deprecated Use `success` instead */
- successPercent: Number,
- title: String,
- progressStatus: B()
- });
- function ee(e) {
- return !e || e < 0 ? 0 : e > 100 ? 100 : e;
- }
- function pe(e) {
- let {
- success: t,
- successPercent: o
- } = e, n = o;
- return t && "progress" in t && (J(!1, "Progress", "`success.progress` is deprecated. Please use `success.percent` instead."), n = t.progress), t && "percent" in t && (n = t.percent), n;
- }
- function Qt(e) {
- let {
- percent: t,
- success: o,
- successPercent: n
- } = e;
- const r = ee(pe({
- success: o,
- successPercent: n
- }));
- return [r, ee(ee(t) - r)];
- }
- function Zt(e) {
- let {
- success: t = {},
- strokeColor: o
- } = e;
- const {
- strokeColor: n
- } = t;
- return [n || Ce.green, o || null];
- }
- const ve = (e, t, o) => {
- var n, r, l, i;
- let a = -1, c = -1;
- if (t === "step") {
- const b = o.steps, u = o.strokeWidth;
- typeof e == "string" || typeof e == "undefined" ? (a = e === "small" ? 2 : 14, c = u != null ? u : 8) : typeof e == "number" ? [a, c] = [e, e] : [a = 14, c = 8] = e, a *= b;
- } else if (t === "line") {
- const b = o == null ? void 0 : o.strokeWidth;
- typeof e == "string" || typeof e == "undefined" ? c = b || (e === "small" ? 6 : 8) : typeof e == "number" ? [a, c] = [e, e] : [a = -1, c = 8] = e;
- } else (t === "circle" || t === "dashboard") && (typeof e == "string" || typeof e == "undefined" ? [a, c] = e === "small" ? [60, 60] : [120, 120] : typeof e == "number" ? [a, c] = [e, e] : (process.env.NODE_ENV !== "production" && J(!1, "Progress", 'Type "circle" and "dashboard" do not accept array as `size`, please use number or preset size instead.'), a = (r = (n = e[0]) !== null && n !== void 0 ? n : e[1]) !== null && r !== void 0 ? r : 120, c = (i = (l = e[0]) !== null && l !== void 0 ? l : e[1]) !== null && i !== void 0 ? i : 120));
- return {
- width: a,
- height: c
- };
- };
- var en = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- const tn = () => P(P({}, me()), {
- strokeColor: Se(),
- direction: B()
- }), nn = (e) => {
- let t = [];
- return Object.keys(e).forEach((o) => {
- const n = parseFloat(o.replace(/%/g, ""));
- isNaN(n) || t.push({
- key: n,
- value: e[o]
- });
- }), t = t.sort((o, n) => o.key - n.key), t.map((o) => {
- let {
- key: n,
- value: r
- } = o;
- return `${r} ${n}%`;
- }).join(", ");
- }, on = (e, t) => {
- const {
- from: o = Ce.blue,
- to: n = Ce.blue,
- direction: r = t === "rtl" ? "to left" : "to right"
- } = e, l = en(e, ["from", "to", "direction"]);
- if (Object.keys(l).length !== 0) {
- const i = nn(l);
- return {
- backgroundImage: `linear-gradient(${r}, ${i})`
- };
- }
- return {
- backgroundImage: `linear-gradient(${r}, ${o}, ${n})`
- };
- }, rn = z({
- compatConfig: {
- MODE: 3
- },
- name: "ProgressLine",
- inheritAttrs: !1,
- props: tn(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- const r = _(() => {
- const {
- strokeColor: g,
- direction: F
- } = e;
- return g && typeof g != "string" ? on(g, F) : {
- backgroundColor: g
- };
- }), l = _(() => e.strokeLinecap === "square" || e.strokeLinecap === "butt" ? 0 : void 0), i = _(() => e.trailColor ? {
- backgroundColor: e.trailColor
- } : void 0), a = _(() => {
- var g;
- return (g = e.size) !== null && g !== void 0 ? g : [-1, e.strokeWidth || (e.size === "small" ? 6 : 8)];
- }), c = _(() => ve(a.value, "line", {
- strokeWidth: e.strokeWidth
- }));
- process.env.NODE_ENV !== "production" && J("strokeWidth" in e, "Progress", "`strokeWidth` is deprecated. Please use `size` instead.");
- const b = _(() => {
- const {
- percent: g
- } = e;
- return P({
- width: `${ee(g)}%`,
- height: `${c.value.height}px`,
- borderRadius: l.value
- }, r.value);
- }), u = _(() => pe(e)), O = _(() => {
- const {
- success: g
- } = e;
- return {
- width: `${ee(u.value)}%`,
- height: `${c.value.height}px`,
- borderRadius: l.value,
- backgroundColor: g == null ? void 0 : g.strokeColor
- };
- }), y = {
- width: c.value.width < 0 ? "100%" : c.value.width,
- height: `${c.value.height}px`
- };
- return () => {
- var g;
- return d(ze, null, [d("div", D(D({}, n), {}, {
- class: [`${e.prefixCls}-outer`, n.class],
- style: [n.style, y]
- }), [d("div", {
- class: `${e.prefixCls}-inner`,
- style: i.value
- }, [d("div", {
- class: `${e.prefixCls}-bg`,
- style: b.value
- }, null), u.value !== void 0 ? d("div", {
- class: `${e.prefixCls}-success-bg`,
- style: O.value
- }, null) : null])]), (g = o.default) === null || g === void 0 ? void 0 : g.call(o)]);
- };
- }
- }), ln = {
- percent: 0,
- prefixCls: "vc-progress",
- strokeColor: "#2db7f5",
- strokeLinecap: "round",
- strokeWidth: 1,
- trailColor: "#D9D9D9",
- trailWidth: 1
- }, sn = (e) => {
- const t = Q(null);
- return _t(() => {
- const o = Date.now();
- let n = !1;
- e.value.forEach((r) => {
- const l = (r == null ? void 0 : r.$el) || r;
- if (!l)
- return;
- n = !0;
- const i = l.style;
- i.transitionDuration = ".3s, .3s, .3s, .06s", t.value && o - t.value < 100 && (i.transitionDuration = "0s, 0s");
- }), n && (t.value = Date.now());
- }), e;
- }, an = {
- gapDegree: Number,
- gapPosition: {
- type: String
- },
- percent: {
- type: [Array, Number]
- },
- prefixCls: String,
- strokeColor: {
- type: [Object, String, Array]
- },
- strokeLinecap: {
- type: String
- },
- strokeWidth: Number,
- trailColor: String,
- trailWidth: Number,
- transition: String
- };
- var cn = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- let Fe = 0;
- function Re(e) {
- return +e.replace("%", "");
- }
- function _e(e) {
- return Array.isArray(e) ? e : [e];
- }
- function Ae(e, t, o, n) {
- let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0, l = arguments.length > 5 ? arguments[5] : void 0;
- const i = 50 - n / 2;
- let a = 0, c = -i, b = 0, u = -2 * i;
- switch (l) {
- case "left":
- a = -i, c = 0, b = 2 * i, u = 0;
- break;
- case "right":
- a = i, c = 0, b = -2 * i, u = 0;
- break;
- case "bottom":
- c = i, u = 2 * i;
- break;
- }
- const O = `M 50,50 m ${a},${c}
- a ${i},${i} 0 1 1 ${b},${-u}
- a ${i},${i} 0 1 1 ${-b},${u}`, y = Math.PI * 2 * i, g = {
- stroke: o,
- strokeDasharray: `${t / 100 * (y - r)}px ${y}px`,
- strokeDashoffset: `-${r / 2 + e / 100 * (y - r)}px`,
- transition: "stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s"
- // eslint-disable-line
- };
- return {
- pathString: O,
- pathStyle: g
- };
- }
- const un = z({
- compatConfig: {
- MODE: 3
- },
- name: "VCCircle",
- props: ne(an, ln),
- setup(e) {
- Fe += 1;
- const t = Q(Fe), o = _(() => _e(e.percent)), n = _(() => _e(e.strokeColor)), [r, l] = Yt();
- sn(l);
- const i = () => {
- const {
- prefixCls: a,
- strokeWidth: c,
- strokeLinecap: b,
- gapDegree: u,
- gapPosition: O
- } = e;
- let y = 0;
- return o.value.map((g, F) => {
- const s = n.value[F] || n.value[n.value.length - 1], v = Object.prototype.toString.call(s) === "[object Object]" ? `url(#${a}-gradient-${t.value})` : "", {
- pathString: R,
- pathStyle: p
- } = Ae(y, g, s, c, u, O);
- y += g;
- const h = {
- key: F,
- d: R,
- stroke: v,
- "stroke-linecap": b,
- "stroke-width": c,
- opacity: g === 0 ? 0 : 1,
- "fill-opacity": "0",
- class: `${a}-circle-path`,
- style: p
- };
- return d("path", D({
- ref: r(F)
- }, h), null);
- });
- };
- return () => {
- const {
- prefixCls: a,
- strokeWidth: c,
- trailWidth: b,
- gapDegree: u,
- gapPosition: O,
- trailColor: y,
- strokeLinecap: g,
- strokeColor: F
- } = e, s = cn(e, ["prefixCls", "strokeWidth", "trailWidth", "gapDegree", "gapPosition", "trailColor", "strokeLinecap", "strokeColor"]), {
- pathString: v,
- pathStyle: R
- } = Ae(0, 100, y, c, u, O);
- delete s.percent;
- const p = n.value.find((m) => Object.prototype.toString.call(m) === "[object Object]"), h = {
- d: v,
- stroke: y,
- "stroke-linecap": g,
- "stroke-width": b || c,
- "fill-opacity": "0",
- class: `${a}-circle-trail`,
- style: R
- };
- return d("svg", D({
- class: `${a}-circle`,
- viewBox: "0 0 100 100"
- }, s), [p && d("defs", null, [d("linearGradient", {
- id: `${a}-gradient-${t.value}`,
- x1: "100%",
- y1: "0%",
- x2: "0%",
- y2: "0%"
- }, [Object.keys(p).sort((m, S) => Re(m) - Re(S)).map((m, S) => d("stop", {
- key: S,
- offset: m,
- "stop-color": p[m]
- }, null))])]), d("path", h, null), i().reverse()]);
- };
- }
- }), dn = () => P(P({}, me()), {
- strokeColor: Se()
- }), pn = 3, fn = (e) => pn / e * 100, gn = z({
- compatConfig: {
- MODE: 3
- },
- name: "ProgressCircle",
- inheritAttrs: !1,
- props: ne(dn(), {
- trailColor: null
- }),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- const r = _(() => {
- var s;
- return (s = e.width) !== null && s !== void 0 ? s : 120;
- }), l = _(() => {
- var s;
- return (s = e.size) !== null && s !== void 0 ? s : [r.value, r.value];
- }), i = _(() => ve(l.value, "circle")), a = _(() => {
- if (e.gapDegree || e.gapDegree === 0)
- return e.gapDegree;
- if (e.type === "dashboard")
- return 75;
- }), c = _(() => ({
- width: `${i.value.width}px`,
- height: `${i.value.height}px`,
- fontSize: `${i.value.width * 0.15 + 6}px`
- })), b = _(() => {
- var s;
- return (s = e.strokeWidth) !== null && s !== void 0 ? s : Math.max(fn(i.value.width), 6);
- }), u = _(() => e.gapPosition || e.type === "dashboard" && "bottom" || void 0), O = _(() => Qt(e)), y = _(() => Object.prototype.toString.call(e.strokeColor) === "[object Object]"), g = _(() => Zt({
- success: e.success,
- strokeColor: e.strokeColor
- })), F = _(() => ({
- [`${e.prefixCls}-inner`]: !0,
- [`${e.prefixCls}-circle-gradient`]: y.value
- }));
- return () => {
- var s;
- const v = d(un, {
- percent: O.value,
- strokeWidth: b.value,
- trailWidth: b.value,
- strokeColor: g.value,
- strokeLinecap: e.strokeLinecap,
- trailColor: e.trailColor,
- prefixCls: e.prefixCls,
- gapDegree: a.value,
- gapPosition: u.value
- }, null);
- return d("div", D(D({}, n), {}, {
- class: [F.value, n.class],
- style: [n.style, c.value]
- }), [i.value.width <= 20 ? d(ke, null, {
- default: () => [d("span", null, [v])],
- title: o.default
- }) : d(ze, null, [v, (s = o.default) === null || s === void 0 ? void 0 : s.call(o)])]);
- };
- }
- }), mn = () => P(P({}, me()), {
- steps: Number,
- strokeColor: Z(),
- trailColor: String
- }), vn = z({
- compatConfig: {
- MODE: 3
- },
- name: "Steps",
- props: mn(),
- setup(e, t) {
- let {
- slots: o
- } = t;
- const n = _(() => Math.round(e.steps * ((e.percent || 0) / 100))), r = _(() => {
- var a;
- return (a = e.size) !== null && a !== void 0 ? a : [e.size === "small" ? 2 : 14, e.strokeWidth || 8];
- }), l = _(() => ve(r.value, "step", {
- steps: e.steps,
- strokeWidth: e.strokeWidth || 8
- })), i = _(() => {
- const {
- steps: a,
- strokeColor: c,
- trailColor: b,
- prefixCls: u
- } = e, O = [];
- for (let y = 0; y < a; y += 1) {
- const g = Array.isArray(c) ? c[y] : c, F = {
- [`${u}-steps-item`]: !0,
- [`${u}-steps-item-active`]: y <= n.value - 1
- };
- O.push(d("div", {
- key: y,
- class: F,
- style: {
- backgroundColor: y <= n.value - 1 ? g : b,
- width: `${l.value.width / a}px`,
- height: `${l.value.height}px`
- }
- }, null));
- }
- return O;
- });
- return () => {
- var a;
- return d("div", {
- class: `${e.prefixCls}-steps-outer`
- }, [i.value, (a = o.default) === null || a === void 0 ? void 0 : a.call(o)]);
- };
- }
- }), hn = new xe("antProgressActive", {
- "0%": {
- transform: "translateX(-100%) scaleX(0)",
- opacity: 0.1
- },
- "20%": {
- transform: "translateX(-100%) scaleX(0)",
- opacity: 0.5
- },
- to: {
- transform: "translateX(0) scaleX(1)",
- opacity: 0
- }
- }), yn = (e) => {
- const {
- componentCls: t,
- iconCls: o
- } = e;
- return {
- [t]: P(P({}, We(e)), {
- display: "inline-block",
- "&-rtl": {
- direction: "rtl"
- },
- "&-line": {
- position: "relative",
- width: "100%",
- fontSize: e.fontSize,
- marginInlineEnd: e.marginXS,
- marginBottom: e.marginXS
- },
- [`${t}-outer`]: {
- display: "inline-block",
- width: "100%"
- },
- [`&${t}-show-info`]: {
- [`${t}-outer`]: {
- marginInlineEnd: `calc(-2em - ${e.marginXS}px)`,
- paddingInlineEnd: `calc(2em + ${e.paddingXS}px)`
- }
- },
- [`${t}-inner`]: {
- position: "relative",
- display: "inline-block",
- width: "100%",
- overflow: "hidden",
- verticalAlign: "middle",
- backgroundColor: e.progressRemainingColor,
- borderRadius: e.progressLineRadius
- },
- [`${t}-inner:not(${t}-circle-gradient)`]: {
- [`${t}-circle-path`]: {
- stroke: e.colorInfo
- }
- },
- [`${t}-success-bg, ${t}-bg`]: {
- position: "relative",
- backgroundColor: e.colorInfo,
- borderRadius: e.progressLineRadius,
- transition: `all ${e.motionDurationSlow} ${e.motionEaseInOutCirc}`
- },
- [`${t}-success-bg`]: {
- position: "absolute",
- insetBlockStart: 0,
- insetInlineStart: 0,
- backgroundColor: e.colorSuccess
- },
- [`${t}-text`]: {
- display: "inline-block",
- width: "2em",
- marginInlineStart: e.marginXS,
- color: e.progressInfoTextColor,
- lineHeight: 1,
- whiteSpace: "nowrap",
- textAlign: "start",
- verticalAlign: "middle",
- wordBreak: "normal",
- [o]: {
- fontSize: e.fontSize
- }
- },
- [`&${t}-status-active`]: {
- [`${t}-bg::before`]: {
- position: "absolute",
- inset: 0,
- backgroundColor: e.colorBgContainer,
- borderRadius: e.progressLineRadius,
- opacity: 0,
- animationName: hn,
- animationDuration: e.progressActiveMotionDuration,
- animationTimingFunction: e.motionEaseOutQuint,
- animationIterationCount: "infinite",
- content: '""'
- }
- },
- [`&${t}-status-exception`]: {
- [`${t}-bg`]: {
- backgroundColor: e.colorError
- },
- [`${t}-text`]: {
- color: e.colorError
- }
- },
- [`&${t}-status-exception ${t}-inner:not(${t}-circle-gradient)`]: {
- [`${t}-circle-path`]: {
- stroke: e.colorError
- }
- },
- [`&${t}-status-success`]: {
- [`${t}-bg`]: {
- backgroundColor: e.colorSuccess
- },
- [`${t}-text`]: {
- color: e.colorSuccess
- }
- },
- [`&${t}-status-success ${t}-inner:not(${t}-circle-gradient)`]: {
- [`${t}-circle-path`]: {
- stroke: e.colorSuccess
- }
- }
- })
- };
- }, bn = (e) => {
- const {
- componentCls: t,
- iconCls: o
- } = e;
- return {
- [t]: {
- [`${t}-circle-trail`]: {
- stroke: e.progressRemainingColor
- },
- [`&${t}-circle ${t}-inner`]: {
- position: "relative",
- lineHeight: 1,
- backgroundColor: "transparent"
- },
- [`&${t}-circle ${t}-text`]: {
- position: "absolute",
- insetBlockStart: "50%",
- insetInlineStart: 0,
- width: "100%",
- margin: 0,
- padding: 0,
- color: e.colorText,
- lineHeight: 1,
- whiteSpace: "normal",
- textAlign: "center",
- transform: "translateY(-50%)",
- [o]: {
- fontSize: `${e.fontSize / e.fontSizeSM}em`
- }
- },
- [`${t}-circle&-status-exception`]: {
- [`${t}-text`]: {
- color: e.colorError
- }
- },
- [`${t}-circle&-status-success`]: {
- [`${t}-text`]: {
- color: e.colorSuccess
- }
- }
- },
- [`${t}-inline-circle`]: {
- lineHeight: 1,
- [`${t}-inner`]: {
- verticalAlign: "bottom"
- }
- }
- };
- }, wn = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- [t]: {
- [`${t}-steps`]: {
- display: "inline-block",
- "&-outer": {
- display: "flex",
- flexDirection: "row",
- alignItems: "center"
- },
- "&-item": {
- flexShrink: 0,
- minWidth: e.progressStepMinWidth,
- marginInlineEnd: e.progressStepMarginInlineEnd,
- backgroundColor: e.progressRemainingColor,
- transition: `all ${e.motionDurationSlow}`,
- "&-active": {
- backgroundColor: e.colorInfo
- }
- }
- }
- }
- };
- }, $n = (e) => {
- const {
- componentCls: t,
- iconCls: o
- } = e;
- return {
- [t]: {
- [`${t}-small&-line, ${t}-small&-line ${t}-text ${o}`]: {
- fontSize: e.fontSizeSM
- }
- }
- };
- }, Cn = Me("Progress", (e) => {
- const t = e.marginXXS / 2, o = Ne(e, {
- progressLineRadius: 100,
- progressInfoTextColor: e.colorText,
- progressDefaultColor: e.colorInfo,
- progressRemainingColor: e.colorFillSecondary,
- progressStepMarginInlineEnd: t,
- progressStepMinWidth: t,
- progressActiveMotionDuration: "2.4s"
- });
- return [yn(o), bn(o), wn(o), $n(o)];
- });
- var Sn = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- const xn = z({
- compatConfig: {
- MODE: 3
- },
- name: "AProgress",
- inheritAttrs: !1,
- props: ne(me(), {
- type: "line",
- percent: 0,
- showInfo: !0,
- // null for different theme definition
- trailColor: null,
- size: "default",
- strokeLinecap: "round"
- }),
- slots: Object,
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- const {
- prefixCls: r,
- direction: l
- } = fe("progress", e), [i, a] = Cn(r);
- process.env.NODE_ENV !== "production" && (J("successPercent" in e, "Progress", "`successPercent` is deprecated. Please use `success.percent` instead."), J("width" in e, "Progress", "`width` is deprecated. Please use `size` instead."));
- const c = _(() => Array.isArray(e.strokeColor) ? e.strokeColor[0] : e.strokeColor), b = _(() => {
- const {
- percent: F = 0
- } = e, s = pe(e);
- return parseInt(s !== void 0 ? s.toString() : F.toString(), 10);
- }), u = _(() => {
- const {
- status: F
- } = e;
- return !Jt.includes(F) && b.value >= 100 ? "success" : F || "normal";
- }), O = _(() => {
- const {
- type: F,
- showInfo: s,
- size: v
- } = e, R = r.value;
- return {
- [R]: !0,
- [`${R}-inline-circle`]: F === "circle" && ve(v, "circle").width <= 20,
- [`${R}-${F === "dashboard" && "circle" || F}`]: !0,
- [`${R}-status-${u.value}`]: !0,
- [`${R}-show-info`]: s,
- [`${R}-${v}`]: v,
- [`${R}-rtl`]: l.value === "rtl",
- [a.value]: !0
- };
- }), y = _(() => typeof e.strokeColor == "string" || Array.isArray(e.strokeColor) ? e.strokeColor : void 0), g = () => {
- const {
- showInfo: F,
- format: s,
- type: v,
- percent: R,
- title: p
- } = e, h = pe(e);
- if (!F) return null;
- let m;
- const S = s || (o == null ? void 0 : o.format) || ((L) => `${L}%`), E = v === "line";
- return s || o != null && o.format || u.value !== "exception" && u.value !== "success" ? m = S(ee(R), ee(h)) : u.value === "exception" ? m = E ? d(st, null, null) : d(at, null, null) : u.value === "success" && (m = E ? d(ct, null, null) : d(ut, null, null)), d("span", {
- class: `${r.value}-text`,
- title: p === void 0 && typeof m == "string" ? m : void 0
- }, [m]);
- };
- return () => {
- const {
- type: F,
- steps: s,
- title: v
- } = e, {
- class: R
- } = n, p = Sn(n, ["class"]), h = g();
- let m;
- return F === "line" ? m = s ? d(vn, D(D({}, e), {}, {
- strokeColor: y.value,
- prefixCls: r.value,
- steps: s
- }), {
- default: () => [h]
- }) : d(rn, D(D({}, e), {}, {
- strokeColor: c.value,
- prefixCls: r.value,
- direction: l.value
- }), {
- default: () => [h]
- }) : (F === "circle" || F === "dashboard") && (m = d(gn, D(D({}, e), {}, {
- prefixCls: r.value,
- strokeColor: c.value,
- progressStatus: u.value
- }), {
- default: () => [h]
- })), i(d("div", D(D({
- role: "progressbar"
- }, p), {}, {
- class: [O.value, R],
- title: v
- }), [m]));
- };
- }
- }), In = dt(xn);
- function Pn(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 Te(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(l) {
- l.total > 0 && (l.percent = l.loaded / l.total * 100), e.onProgress(l);
- });
- const o = new FormData();
- e.data && Object.keys(e.data).forEach((r) => {
- const l = e.data[r];
- if (Array.isArray(l)) {
- l.forEach((i) => {
- o.append(`${r}[]`, i);
- });
- return;
- }
- o.append(r, l);
- }), e.file instanceof Blob ? o.append(e.filename, e.file, e.file.name) : o.append(e.filename, e.file), t.onerror = function(l) {
- e.onError(l);
- }, t.onload = function() {
- return t.status < 200 || t.status >= 300 ? e.onError(Pn(e, t), Te(t)) : e.onSuccess(Te(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((r) => {
- n[r] !== null && t.setRequestHeader(r, n[r]);
- }), t.send(o), {
- abort() {
- t.abort();
- }
- };
- }
- const Dn = +/* @__PURE__ */ new Date();
- let Fn = 0;
- function ye() {
- return `vc-upload-${Dn}-${++Fn}`;
- }
- const be = (e, t) => {
- if (e && t) {
- const o = Array.isArray(t) ? t : t.split(","), n = e.name || "", r = e.type || "", l = r.replace(/\/.*$/, "");
- return o.some((i) => {
- const a = i.trim();
- if (/^\*(\/\*)?$/.test(i))
- return !0;
- if (a.charAt(0) === ".") {
- const c = n.toLowerCase(), b = a.toLowerCase();
- let u = [b];
- return (b === ".jpg" || b === ".jpeg") && (u = [".jpg", ".jpeg"]), u.some((O) => c.endsWith(O));
- }
- return /\/\*$/.test(a) ? l === a.replace(/\/.*$/, "") : r === a ? !0 : /^\w+$/.test(a) ? (pt(!1, `Upload takes an invalidate 'accept' type '${a}'.Skip for check.`), !0) : !1;
- });
- }
- return !0;
- };
- function Rn(e, t) {
- const o = e.createReader();
- let n = [];
- function r() {
- o.readEntries((l) => {
- const i = Array.prototype.slice.apply(l);
- n = n.concat(i), !i.length ? t(n) : r();
- });
- }
- r();
- }
- const _n = (e, t, o) => {
- const n = (r, l) => {
- r.path = l || "", r.isFile ? r.file((i) => {
- o(i) && (r.fullPath && !i.webkitRelativePath && (Object.defineProperties(i, {
- webkitRelativePath: {
- writable: !0
- }
- }), i.webkitRelativePath = r.fullPath.replace(/^\//, ""), Object.defineProperties(i, {
- webkitRelativePath: {
- writable: !1
- }
- })), t([i]));
- }) : r.isDirectory && Rn(r, (i) => {
- i.forEach((a) => {
- n(a, `${l}${r.name}/`);
- });
- });
- };
- e.forEach((r) => {
- n(r.webkitGetAsEntry());
- });
- }, Ke = () => ({
- 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 An = function(e, t, o, n) {
- function r(l) {
- return l instanceof o ? l : new o(function(i) {
- i(l);
- });
- }
- return new (o || (o = Promise))(function(l, i) {
- function a(u) {
- try {
- b(n.next(u));
- } catch (O) {
- i(O);
- }
- }
- function c(u) {
- try {
- b(n.throw(u));
- } catch (O) {
- i(O);
- }
- }
- function b(u) {
- u.done ? l(u.value) : r(u.value).then(a, c);
- }
- b((n = n.apply(e, t || [])).next());
- });
- }, Tn = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- const En = z({
- compatConfig: {
- MODE: 3
- },
- name: "AjaxUploader",
- inheritAttrs: !1,
- props: Ke(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: r
- } = t;
- const l = Q(ye()), i = {}, a = Q();
- let c = !1;
- const b = (p, h) => An(this, void 0, void 0, function* () {
- const {
- beforeUpload: m
- } = e;
- let S = p;
- if (m) {
- try {
- S = yield m(p, h);
- } catch ($) {
- S = !1;
- }
- if (S === !1)
- return {
- origin: p,
- parsedFile: null,
- action: null,
- data: null
- };
- }
- const {
- action: E
- } = e;
- let L;
- typeof E == "function" ? L = yield E(p) : L = E;
- const {
- data: M
- } = e;
- let U;
- typeof M == "function" ? U = yield M(p) : U = M;
- const N = (
- // string type is from legacy `transformFile`.
- // Not sure if this will work since no related test case works with it
- (typeof S == "object" || typeof S == "string") && S ? S : p
- );
- let f;
- N instanceof File ? f = N : f = new File([N], p.name, {
- type: p.type
- });
- const w = f;
- return w.uid = p.uid, {
- origin: p,
- data: U,
- parsedFile: w,
- action: L
- };
- }), u = (p) => {
- let {
- data: h,
- origin: m,
- action: S,
- parsedFile: E
- } = p;
- if (!c)
- return;
- const {
- onStart: L,
- customRequest: M,
- name: U,
- headers: N,
- withCredentials: f,
- method: w
- } = e, {
- uid: $
- } = m, C = M || On, x = {
- action: S,
- filename: U,
- data: h,
- file: E,
- headers: N,
- withCredentials: f,
- method: w || "post",
- onProgress: (A) => {
- const {
- onProgress: j
- } = e;
- j == null || j(A, E);
- },
- onSuccess: (A, j) => {
- const {
- onSuccess: T
- } = e;
- T == null || T(A, E, j), delete i[$];
- },
- onError: (A, j) => {
- const {
- onError: T
- } = e;
- T == null || T(A, j, E), delete i[$];
- }
- };
- L(m), i[$] = C(x);
- }, O = () => {
- l.value = ye();
- }, y = (p) => {
- if (p) {
- const h = p.uid ? p.uid : p;
- i[h] && i[h].abort && i[h].abort(), delete i[h];
- } else
- Object.keys(i).forEach((h) => {
- i[h] && i[h].abort && i[h].abort(), delete i[h];
- });
- };
- ge(() => {
- c = !0;
- }), He(() => {
- c = !1, y();
- });
- const g = (p) => {
- const h = [...p], m = h.map((S) => (S.uid = ye(), b(S, h)));
- Promise.all(m).then((S) => {
- const {
- onBatchStart: E
- } = e;
- E == null || E(S.map((L) => {
- let {
- origin: M,
- parsedFile: U
- } = L;
- return {
- file: M,
- parsedFile: U
- };
- })), S.filter((L) => L.parsedFile !== null).forEach((L) => {
- u(L);
- });
- });
- }, F = (p) => {
- const {
- accept: h,
- directory: m
- } = e, {
- files: S
- } = p.target, E = [...S].filter((L) => !m || be(L, h));
- g(E), O();
- }, s = (p) => {
- const h = a.value;
- if (!h)
- return;
- const {
- onClick: m
- } = e;
- h.click(), m && m(p);
- }, v = (p) => {
- p.key === "Enter" && s(p);
- }, R = (p) => {
- const {
- multiple: h
- } = e;
- if (p.preventDefault(), p.type !== "dragover")
- if (e.directory)
- _n(Array.prototype.slice.call(p.dataTransfer.items), g, (m) => be(m, e.accept));
- else {
- const m = Kt(Array.prototype.slice.call(p.dataTransfer.files), (L) => be(L, e.accept));
- let S = m[0];
- const E = m[1];
- h === !1 && (S = S.slice(0, 1)), g(S), E.length && e.onReject && e.onReject(E);
- }
- };
- return r({
- abort: y
- }), () => {
- var p;
- const {
- componentTag: h,
- prefixCls: m,
- disabled: S,
- id: E,
- multiple: L,
- accept: M,
- capture: U,
- directory: N,
- openFileDialogOnClick: f,
- onMouseenter: w,
- onMouseleave: $
- } = e, C = Tn(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), x = {
- [m]: !0,
- [`${m}-disabled`]: S,
- [n.class]: !!n.class
- }, A = N ? {
- directory: "directory",
- webkitdirectory: "webkitdirectory"
- } : {};
- return d(h, D(D({}, S ? {} : {
- onClick: f ? s : () => {
- },
- onKeydown: f ? v : () => {
- },
- onMouseenter: w,
- onMouseleave: $,
- onDrop: R,
- onDragover: R,
- tabindex: "0"
- }), {}, {
- class: x,
- role: "button",
- style: n.style
- }), {
- default: () => [d("input", D(D(D({}, Ut(C, {
- aria: !0,
- data: !0
- })), {}, {
- id: E,
- type: "file",
- ref: a,
- onClick: (T) => T.stopPropagation(),
- onCancel: (T) => T.stopPropagation(),
- key: l.value,
- style: {
- display: "none"
- },
- accept: M
- }, A), {}, {
- multiple: L,
- onChange: F
- }, U != null ? {
- capture: U
- } : {}), null), (p = o.default) === null || p === void 0 ? void 0 : p.call(o)]
- });
- };
- }
- });
- function we() {
- }
- const Ee = z({
- compatConfig: {
- MODE: 3
- },
- name: "Upload",
- inheritAttrs: !1,
- props: ne(Ke(), {
- componentTag: "span",
- prefixCls: "rc-upload",
- data: {},
- headers: {},
- name: "file",
- multipart: !1,
- onStart: we,
- onError: we,
- onSuccess: we,
- multiple: !1,
- beforeUpload: null,
- customRequest: null,
- withCredentials: !1,
- openFileDialogOnClick: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: r
- } = t;
- const l = Q();
- return r({
- abort: (a) => {
- var c;
- (c = l.value) === null || c === void 0 || c.abort(a);
- }
- }), () => d(En, D(D(D({}, e), n), {}, {
- ref: l
- }), o);
- }
- });
- function Ye() {
- return {
- capture: Z([Boolean, String]),
- type: B(),
- name: String,
- defaultFileList: de(),
- fileList: de(),
- action: Z([String, Function]),
- directory: W(),
- data: Z([Object, Function]),
- method: B(),
- headers: q(),
- showUploadList: Z([Boolean, Object]),
- multiple: W(),
- accept: String,
- beforeUpload: I(),
- onChange: I(),
- "onUpdate:fileList": I(),
- onDrop: I(),
- listType: B(),
- onPreview: I(),
- onDownload: I(),
- onReject: I(),
- onRemove: I(),
- /** @deprecated Please use `onRemove` directly */
- remove: I(),
- supportServerRender: W(),
- disabled: W(),
- prefixCls: String,
- customRequest: I(),
- withCredentials: W(),
- openFileDialogOnClick: W(),
- locale: q(),
- id: String,
- previewFile: I(),
- /** @deprecated Please use `beforeUpload` directly */
- transformFile: I(),
- iconRender: I(),
- isImageUrl: I(),
- progress: q(),
- itemRender: I(),
- /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */
- maxCount: Number,
- height: Z([Number, String]),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I()
- };
- }
- function Ln() {
- return {
- listType: B(),
- onPreview: I(),
- onDownload: I(),
- onRemove: I(),
- items: de(),
- progress: q(),
- prefixCls: B(),
- showRemoveIcon: W(),
- showDownloadIcon: W(),
- showPreviewIcon: W(),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I(),
- locale: q(void 0),
- previewFile: I(),
- iconRender: I(),
- isImageUrl: I(),
- appendAction: I(),
- appendActionVisible: W(),
- itemRender: I()
- };
- }
- function se(e) {
- return P(P({}, e), {
- lastModified: e.lastModified,
- lastModifiedDate: e.lastModifiedDate,
- name: e.name,
- size: e.size,
- type: e.type,
- uid: e.uid,
- percent: 0,
- originFileObj: e
- });
- }
- function ae(e, t) {
- const o = [...t], n = o.findIndex((r) => {
- let {
- uid: l
- } = r;
- return l === e.uid;
- });
- return n === -1 ? o.push(e) : o[n] = e, o;
- }
- function $e(e, t) {
- const o = e.uid !== void 0 ? "uid" : "name";
- return t.filter((n) => n[o] === e[o])[0];
- }
- function jn(e, t) {
- const o = e.uid !== void 0 ? "uid" : "name", n = t.filter((r) => r[o] !== e[o]);
- return n.length === t.length ? null : n;
- }
- const Un = function() {
- const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), n = t[t.length - 1].split(/#|\?/)[0];
- return (/\.[^./\\]*$/.exec(n) || [""])[0];
- }, Je = (e) => e.indexOf("image/") === 0, kn = (e) => {
- if (e.type && !e.thumbUrl)
- return Je(e.type);
- const t = e.thumbUrl || e.url || "", o = Un(t);
- return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(o) ? !0 : !(/^data:/.test(t) || o);
- }, Y = 200;
- function Mn(e) {
- return new Promise((t) => {
- if (!e.type || !Je(e.type)) {
- t("");
- return;
- }
- const o = document.createElement("canvas");
- o.width = Y, o.height = Y, o.style.cssText = `position: fixed; left: 0; top: 0; width: ${Y}px; height: ${Y}px; z-index: 9999; display: none;`, document.body.appendChild(o);
- const n = o.getContext("2d"), r = new Image();
- if (r.onload = () => {
- const {
- width: l,
- height: i
- } = r;
- let a = Y, c = Y, b = 0, u = 0;
- l > i ? (c = i * (Y / l), u = -(c - a) / 2) : (a = l * (Y / i), b = -(a - c) / 2), n.drawImage(r, b, u, a, c);
- const O = o.toDataURL();
- document.body.removeChild(o), t(O);
- }, r.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) {
- const l = new FileReader();
- l.addEventListener("load", () => {
- l.result && (r.src = l.result);
- }), l.readAsDataURL(e);
- } else
- r.src = window.URL.createObjectURL(e);
- });
- }
- const Nn = () => ({
- prefixCls: String,
- locale: q(void 0),
- file: q(),
- items: de(),
- listType: B(),
- isImgUrl: I(),
- showRemoveIcon: W(),
- showDownloadIcon: W(),
- showPreviewIcon: W(),
- removeIcon: I(),
- downloadIcon: I(),
- previewIcon: I(),
- iconRender: I(),
- actionIconRender: I(),
- itemRender: I(),
- onPreview: I(),
- onClose: I(),
- onDownload: I(),
- progress: q()
- }), Wn = z({
- compatConfig: {
- MODE: 3
- },
- name: "ListItem",
- inheritAttrs: !1,
- props: Nn(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- var r;
- const l = le(!1), i = le();
- ge(() => {
- i.value = setTimeout(() => {
- l.value = !0;
- }, 300);
- }), He(() => {
- clearTimeout(i.value);
- });
- const a = le((r = e.file) === null || r === void 0 ? void 0 : r.status);
- Ge(() => {
- var u;
- return (u = e.file) === null || u === void 0 ? void 0 : u.status;
- }, (u) => {
- u !== "removed" && (a.value = u);
- });
- const {
- rootPrefixCls: c
- } = fe("upload", e), b = _(() => ft(`${c.value}-fade`));
- return () => {
- var u, O;
- const {
- prefixCls: y,
- locale: g,
- listType: F,
- file: s,
- items: v,
- progress: R,
- iconRender: p = o.iconRender,
- actionIconRender: h = o.actionIconRender,
- itemRender: m = o.itemRender,
- isImgUrl: S,
- showPreviewIcon: E,
- showRemoveIcon: L,
- showDownloadIcon: M,
- previewIcon: U = o.previewIcon,
- removeIcon: N = o.removeIcon,
- downloadIcon: f = o.downloadIcon,
- onPreview: w,
- onDownload: $,
- onClose: C
- } = e, {
- class: x,
- style: A
- } = n, j = p({
- file: s
- });
- let T = d("div", {
- class: `${y}-text-icon`
- }, [j]);
- if (F === "picture" || F === "picture-card")
- if (a.value === "uploading" || !s.thumbUrl && !s.url) {
- const X = {
- [`${y}-list-item-thumbnail`]: !0,
- [`${y}-list-item-file`]: a.value !== "uploading"
- };
- T = d("div", {
- class: X
- }, [j]);
- } else {
- const X = S != null && S(s) ? d("img", {
- src: s.thumbUrl || s.url,
- alt: s.name,
- class: `${y}-list-item-image`,
- crossorigin: s.crossOrigin
- }, null) : j, nt = {
- [`${y}-list-item-thumbnail`]: !0,
- [`${y}-list-item-file`]: S && !S(s)
- };
- T = d("a", {
- class: nt,
- onClick: (ot) => w(s, ot),
- href: s.url || s.thumbUrl,
- target: "_blank",
- rel: "noopener noreferrer"
- }, [X]);
- }
- const k = {
- [`${y}-list-item`]: !0,
- [`${y}-list-item-${a.value}`]: !0
- }, V = typeof s.linkProps == "string" ? JSON.parse(s.linkProps) : s.linkProps, te = L ? h({
- customIcon: N ? N({
- file: s
- }) : d(gt, null, null),
- callback: () => C(s),
- prefixCls: y,
- title: g.removeFile
- }) : null, H = M && a.value === "done" ? h({
- customIcon: f ? f({
- file: s
- }) : d(mt, null, null),
- callback: () => $(s),
- prefixCls: y,
- title: g.downloadFile
- }) : null, G = F !== "picture-card" && d("span", {
- key: "download-delete",
- class: [`${y}-list-item-actions`, {
- picture: F === "picture"
- }]
- }, [H, te]), K = `${y}-list-item-name`, oe = s.url ? [d("a", D(D({
- key: "view",
- target: "_blank",
- rel: "noopener noreferrer",
- class: K,
- title: s.name
- }, V), {}, {
- href: s.url,
- onClick: (X) => w(s, X)
- }), [s.name]), G] : [d("span", {
- key: "view",
- class: K,
- onClick: (X) => w(s, X),
- title: s.name
- }, [s.name]), G], he = {
- pointerEvents: "none",
- opacity: 0.5
- }, Qe = E ? d("a", {
- href: s.url || s.thumbUrl,
- target: "_blank",
- rel: "noopener noreferrer",
- style: s.url || s.thumbUrl ? void 0 : he,
- onClick: (X) => w(s, X),
- title: g.previewFile
- }, [U ? U({
- file: s
- }) : d(vt, null, null)]) : null, Ze = F === "picture-card" && a.value !== "uploading" && d("span", {
- class: `${y}-list-item-actions`
- }, [Qe, a.value === "done" && H, te]), Ie = d("div", {
- class: k
- }, [T, oe, Ze, l.value && d(At, b.value, {
- default: () => [qe(d("div", {
- class: `${y}-list-item-progress`
- }, ["percent" in s ? d(In, D(D({}, R), {}, {
- type: "line",
- percent: s.percent
- }), null) : null]), [[Ve, a.value === "uploading"]])]
- })]), et = {
- [`${y}-list-item-container`]: !0,
- [`${x}`]: !!x
- }, tt = s.response && typeof s.response == "string" ? s.response : ((u = s.error) === null || u === void 0 ? void 0 : u.statusText) || ((O = s.error) === null || O === void 0 ? void 0 : O.message) || g.uploadError, Pe = a.value === "error" ? d(ke, {
- title: tt,
- getPopupContainer: (X) => X.parentNode
- }, {
- default: () => [Ie]
- }) : Ie;
- return d("div", {
- class: et,
- style: A
- }, [m ? m({
- originNode: Pe,
- file: s,
- fileList: v,
- actions: {
- download: $.bind(null, s),
- preview: w.bind(null, s),
- remove: C.bind(null, s)
- }
- }) : Pe]);
- };
- }
- }), Bn = (e, t) => {
- let {
- slots: o
- } = t;
- var n;
- return bt((n = o.default) === null || n === void 0 ? void 0 : n.call(o))[0];
- }, Xn = z({
- compatConfig: {
- MODE: 3
- },
- name: "AUploadList",
- props: ne(Ln(), {
- listType: "text",
- progress: {
- strokeWidth: 2,
- showInfo: !1
- },
- showRemoveIcon: !0,
- showDownloadIcon: !1,
- showPreviewIcon: !0,
- previewFile: Mn,
- isImageUrl: kn,
- items: [],
- appendActionVisible: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- expose: n
- } = t;
- const r = le(!1);
- ge(() => {
- r.value == !0;
- });
- const l = le([]);
- Ge(() => e.items, function() {
- let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
- l.value = s.slice();
- }, {
- immediate: !0,
- deep: !0
- }), Tt(() => {
- if (e.listType !== "picture" && e.listType !== "picture-card")
- return;
- let s = !1;
- (e.items || []).forEach((v, R) => {
- typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(v.originFileObj instanceof File || v.originFileObj instanceof Blob) || v.thumbUrl !== void 0 || (v.thumbUrl = "", e.previewFile && e.previewFile(v.originFileObj).then((p) => {
- const h = p || "";
- h !== v.thumbUrl && (l.value[R].thumbUrl = h, s = !0);
- }));
- }), s && Et(l);
- });
- const i = (s, v) => {
- if (e.onPreview)
- return v == null || v.preventDefault(), e.onPreview(s);
- }, a = (s) => {
- typeof e.onDownload == "function" ? e.onDownload(s) : s.url && window.open(s.url);
- }, c = (s) => {
- var v;
- (v = e.onRemove) === null || v === void 0 || v.call(e, s);
- }, b = (s) => {
- let {
- file: v
- } = s;
- const R = e.iconRender || o.iconRender;
- if (R)
- return R({
- file: v,
- listType: e.listType
- });
- const p = v.status === "uploading", h = e.isImageUrl && e.isImageUrl(v) ? d(wt, null, null) : d($t, null, null);
- let m = p ? d(Oe, null, null) : d(Ct, null, null);
- return e.listType === "picture" ? m = p ? d(Oe, null, null) : h : e.listType === "picture-card" && (m = p ? e.locale.uploading : h), m;
- }, u = (s) => {
- const {
- customIcon: v,
- callback: R,
- prefixCls: p,
- title: h
- } = s, m = {
- type: "text",
- size: "small",
- title: h,
- onClick: () => {
- R();
- },
- class: `${p}-list-item-action`
- };
- return St(v) ? d(De, m, {
- icon: () => v
- }) : d(De, m, {
- default: () => [d("span", null, [v])]
- });
- };
- n({
- handlePreview: i,
- handleDownload: a
- });
- const {
- prefixCls: O,
- rootPrefixCls: y
- } = fe("upload", e), g = _(() => ({
- [`${O.value}-list`]: !0,
- [`${O.value}-list-${e.listType}`]: !0
- })), F = _(() => {
- const s = P({}, ht(`${y.value}-motion-collapse`));
- delete s.onAfterAppear, delete s.onAfterEnter, delete s.onAfterLeave;
- const v = P(P({}, yt(`${O.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), {
- class: g.value,
- appear: r.value
- });
- return e.listType !== "picture-card" ? P(P({}, s), v) : v;
- });
- return () => {
- const {
- listType: s,
- locale: v,
- isImageUrl: R,
- showPreviewIcon: p,
- showRemoveIcon: h,
- showDownloadIcon: m,
- removeIcon: S,
- previewIcon: E,
- downloadIcon: L,
- progress: M,
- appendAction: U,
- itemRender: N,
- appendActionVisible: f
- } = e, w = U == null ? void 0 : U(), $ = l.value;
- return d(Lt, D(D({}, F.value), {}, {
- tag: "div"
- }), {
- default: () => [$.map((C) => {
- const {
- uid: x
- } = C;
- return d(Wn, {
- key: x,
- locale: v,
- prefixCls: O.value,
- file: C,
- items: $,
- progress: M,
- listType: s,
- isImgUrl: R,
- showPreviewIcon: p,
- showRemoveIcon: h,
- showDownloadIcon: m,
- onPreview: i,
- onDownload: a,
- onClose: c,
- removeIcon: S,
- previewIcon: E,
- downloadIcon: L,
- itemRender: N
- }, P(P({}, o), {
- iconRender: b,
- actionIconRender: u
- }));
- }), U ? qe(d(Bn, {
- key: "__ant_upload_appendAction"
- }, {
- default: () => w
- }), [[Ve, !!f]]) : null]
- });
- };
- }
- }), zn = (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
- }
- }
- }
- }
- };
- }, Hn = (e) => {
- const {
- componentCls: t,
- antCls: o,
- iconCls: n,
- fontSize: r,
- lineHeight: l
- } = e, i = `${t}-list-item`, a = `${i}-actions`, c = `${i}-action`, b = Math.round(r * l);
- return {
- [`${t}-wrapper`]: {
- [`${t}-list`]: P(P({}, Be()), {
- lineHeight: e.lineHeight,
- [i]: {
- position: "relative",
- height: e.lineHeight * r,
- marginTop: e.marginXS,
- fontSize: r,
- display: "flex",
- alignItems: "center",
- transition: `background-color ${e.motionDurationSlow}`,
- "&:hover": {
- backgroundColor: e.controlItemBgHover
- },
- [`${i}-name`]: P(P({}, Xe), {
- padding: `0 ${e.paddingXS}px`,
- lineHeight: l,
- flex: "auto",
- transition: `all ${e.motionDurationSlow}`
- }),
- [a]: {
- [c]: {
- opacity: 0
- },
- [`${c}${o}-btn-sm`]: {
- height: b,
- border: 0,
- lineHeight: 1,
- // FIXME: should not override small button
- "> span": {
- transform: "scale(1)"
- }
- },
- [`
- ${c}:focus,
- &.picture ${c}
- `]: {
- opacity: 1
- },
- [n]: {
- color: e.colorTextDescription,
- transition: `all ${e.motionDurationSlow}`
- },
- [`&:hover ${n}`]: {
- color: e.colorText
- }
- },
- [`${t}-icon ${n}`]: {
- color: e.colorTextDescription,
- fontSize: r
- },
- [`${i}-progress`]: {
- position: "absolute",
- bottom: -e.uploadProgressOffset,
- width: "100%",
- paddingInlineStart: r + e.paddingXS,
- fontSize: r,
- lineHeight: 0,
- pointerEvents: "none",
- "> div": {
- margin: 0
- }
- }
- },
- [`${i}:hover ${c}`]: {
- opacity: 1,
- color: e.colorText
- },
- [`${i}-error`]: {
- color: e.colorError,
- [`${i}-name, ${t}-icon ${n}`]: {
- color: e.colorError
- },
- [a]: {
- [`${n}, ${n}:hover`]: {
- color: e.colorError
- },
- [c]: {
- 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: '""'
- }
- }
- })
- }
- };
- }, Le = new xe("uploadAnimateInlineIn", {
- from: {
- width: 0,
- height: 0,
- margin: 0,
- padding: 0,
- opacity: 0
- }
- }), je = new xe("uploadAnimateInlineOut", {
- to: {
- width: 0,
- height: 0,
- margin: 0,
- padding: 0,
- opacity: 0
- }
- }), Gn = (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: Le
- },
- [`${o}-leave`]: {
- animationName: je
- }
- }
- }, Le, je];
- }, qn = (e) => {
- const {
- componentCls: t,
- iconCls: o,
- uploadThumbnailSize: n,
- uploadProgressOffset: r
- } = e, l = `${t}-list`, i = `${l}-item`;
- return {
- [`${t}-wrapper`]: {
- // ${listCls} 增加优先级
- [`${l}${l}-picture, ${l}${l}-picture-card`]: {
- [i]: {
- 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"
- },
- [`${i}-thumbnail`]: P(P({}, Xe), {
- 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"
- }
- }),
- [`${i}-progress`]: {
- bottom: r,
- width: `calc(100% - ${e.paddingSM * 2}px)`,
- marginTop: 0,
- paddingInlineStart: n + e.paddingXS
- }
- },
- [`${i}-error`]: {
- borderColor: e.colorError,
- // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160
- [`${i}-thumbnail ${o}`]: {
- "svg path[fill='#e6f7ff']": {
- fill: e.colorErrorBg
- },
- "svg path[fill='#1890ff']": {
- fill: e.colorError
- }
- }
- },
- [`${i}-uploading`]: {
- borderStyle: "dashed",
- [`${i}-name`]: {
- marginBottom: r
- }
- }
- }
- }
- };
- }, Vn = (e) => {
- const {
- componentCls: t,
- iconCls: o,
- fontSizeLG: n,
- colorTextLightSolid: r
- } = e, l = `${t}-list`, i = `${l}-item`, a = e.uploadPicCardSize;
- return {
- [`${t}-wrapper${t}-picture-card-wrapper`]: P(P({}, Be()), {
- display: "inline-block",
- width: "100%",
- [`${t}${t}-select`]: {
- width: a,
- height: a,
- 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
- [`${l}${l}-picture-card`]: {
- [`${l}-item-container`]: {
- display: "inline-block",
- width: a,
- height: a,
- marginBlock: `0 ${e.marginXS}px`,
- marginInline: `0 ${e.marginXS}px`,
- verticalAlign: "top"
- },
- "&::after": {
- display: "none"
- },
- [i]: {
- 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: '" "'
- }
- },
- [`${i}:hover`]: {
- [`&::before, ${i}-actions`]: {
- opacity: 1
- }
- },
- [`${i}-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}`
- }
- },
- [`${i}-actions, ${i}-actions:hover`]: {
- [`${o}-eye, ${o}-download, ${o}-delete`]: {
- color: new xt(r).setAlpha(0.65).toRgbString(),
- "&:hover": {
- color: r
- }
- }
- },
- [`${i}-thumbnail, ${i}-thumbnail img`]: {
- position: "static",
- display: "block",
- width: "100%",
- height: "100%",
- objectFit: "contain"
- },
- [`${i}-name`]: {
- display: "none",
- textAlign: "center"
- },
- [`${i}-file + ${i}-name`]: {
- position: "absolute",
- bottom: e.margin,
- display: "block",
- width: `calc(100% - ${e.paddingXS * 2}px)`
- },
- [`${i}-uploading`]: {
- [`&${i}`]: {
- backgroundColor: e.colorFillAlter
- },
- [`&::before, ${o}-eye, ${o}-download, ${o}-delete`]: {
- display: "none"
- }
- },
- [`${i}-progress`]: {
- bottom: e.marginXL,
- width: `calc(100% - ${e.paddingXS * 2}px)`,
- paddingInlineStart: 0
- }
- }
- })
- };
- }, Kn = (e) => {
- const {
- componentCls: t
- } = e;
- return {
- [`${t}-rtl`]: {
- direction: "rtl"
- }
- };
- }, Yn = (e) => {
- const {
- componentCls: t,
- colorTextDisabled: o
- } = e;
- return {
- [`${t}-wrapper`]: P(P({}, We(e)), {
- [t]: {
- outline: 0,
- "input[type='file']": {
- cursor: "pointer"
- }
- },
- [`${t}-select`]: {
- display: "inline-block"
- },
- [`${t}-disabled`]: {
- color: o,
- cursor: "not-allowed"
- }
- })
- };
- }, Jn = Me("Upload", (e) => {
- const {
- fontSizeHeading3: t,
- fontSize: o,
- lineHeight: n,
- lineWidth: r,
- controlHeightLG: l
- } = e, i = Math.round(o * n), a = Ne(e, {
- uploadThumbnailSize: t * 2,
- uploadProgressOffset: i / 2 + r,
- uploadPicCardSize: l * 2.55
- });
- return [Yn(a), zn(a), qn(a), Vn(a), Hn(a), Gn(a), Kn(a), It(a)];
- });
- var Qn = function(e, t, o, n) {
- function r(l) {
- return l instanceof o ? l : new o(function(i) {
- i(l);
- });
- }
- return new (o || (o = Promise))(function(l, i) {
- function a(u) {
- try {
- b(n.next(u));
- } catch (O) {
- i(O);
- }
- }
- function c(u) {
- try {
- b(n.throw(u));
- } catch (O) {
- i(O);
- }
- }
- function b(u) {
- u.done ? l(u.value) : r(u.value).then(a, c);
- }
- b((n = n.apply(e, t || [])).next());
- });
- }, Zn = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- const ie = `__LIST_IGNORE_${Date.now()}__`, ce = z({
- compatConfig: {
- MODE: 3
- },
- name: "AUpload",
- inheritAttrs: !1,
- props: ne(Ye(), {
- type: "select",
- multiple: !1,
- action: "",
- data: {},
- accept: "",
- showUploadList: !0,
- listType: "text",
- supportServerRender: !0
- }),
- setup(e, t) {
- let {
- slots: o,
- attrs: n,
- expose: r
- } = t;
- const l = Nt(), {
- prefixCls: i,
- direction: a,
- disabled: c
- } = fe("upload", e), [b, u] = Jn(i), O = Pt(), y = _(() => {
- var f;
- return (f = c.value) !== null && f !== void 0 ? f : O.value;
- }), [g, F] = Mt(e.defaultFileList || [], {
- value: jt(e, "fileList"),
- postState: (f) => {
- const w = Date.now();
- return (f != null ? f : []).map(($, C) => (!$.uid && !Object.isFrozen($) && ($.uid = `__AUTO__${w}_${C}__`), $));
- }
- }), s = Q("drop"), v = Q(null);
- ge(() => {
- J(e.fileList !== void 0 || n.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), J(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), J(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event.");
- });
- const R = (f, w, $) => {
- var C, x;
- let A = [...w];
- e.maxCount === 1 ? A = A.slice(-1) : e.maxCount && (A = A.slice(0, e.maxCount)), F(A);
- const j = {
- file: f,
- fileList: A
- };
- $ && (j.event = $), (C = e["onUpdate:fileList"]) === null || C === void 0 || C.call(e, j.fileList), (x = e.onChange) === null || x === void 0 || x.call(e, j), l.onFieldChange();
- }, p = (f, w) => Qn(this, void 0, void 0, function* () {
- const {
- beforeUpload: $,
- transformFile: C
- } = e;
- let x = f;
- if ($) {
- const A = yield $(f, w);
- if (A === !1)
- return !1;
- if (delete f[ie], A === ie)
- return Object.defineProperty(f, ie, {
- value: !0,
- configurable: !0
- }), !1;
- typeof A == "object" && A && (x = A);
- }
- return C && (x = yield C(x)), x;
- }), h = (f) => {
- const w = f.filter((x) => !x.file[ie]);
- if (!w.length)
- return;
- const $ = w.map((x) => se(x.file));
- let C = [...g.value];
- $.forEach((x) => {
- C = ae(x, C);
- }), $.forEach((x, A) => {
- let j = x;
- if (w[A].parsedFile)
- x.status = "uploading";
- else {
- const {
- originFileObj: T
- } = x;
- let k;
- try {
- k = new File([T], T.name, {
- type: T.type
- });
- } catch (V) {
- k = new Blob([T], {
- type: T.type
- }), k.name = T.name, k.lastModifiedDate = /* @__PURE__ */ new Date(), k.lastModified = (/* @__PURE__ */ new Date()).getTime();
- }
- k.uid = x.uid, j = k;
- }
- R(j, C);
- });
- }, m = (f, w, $) => {
- try {
- typeof f == "string" && (f = JSON.parse(f));
- } catch (A) {
- }
- if (!$e(w, g.value))
- return;
- const C = se(w);
- C.status = "done", C.percent = 100, C.response = f, C.xhr = $;
- const x = ae(C, g.value);
- R(C, x);
- }, S = (f, w) => {
- if (!$e(w, g.value))
- return;
- const $ = se(w);
- $.status = "uploading", $.percent = f.percent;
- const C = ae($, g.value);
- R($, C, f);
- }, E = (f, w, $) => {
- if (!$e($, g.value))
- return;
- const C = se($);
- C.error = f, C.response = w, C.status = "error";
- const x = ae(C, g.value);
- R(C, x);
- }, L = (f) => {
- let w;
- const $ = e.onRemove || e.remove;
- Promise.resolve(typeof $ == "function" ? $(f) : $).then((C) => {
- var x, A;
- if (C === !1)
- return;
- const j = jn(f, g.value);
- j && (w = P(P({}, f), {
- status: "removed"
- }), (x = g.value) === null || x === void 0 || x.forEach((T) => {
- const k = w.uid !== void 0 ? "uid" : "name";
- T[k] === w[k] && !Object.isFrozen(T) && (T.status = "removed");
- }), (A = v.value) === null || A === void 0 || A.abort(w), R(w, j));
- });
- }, M = (f) => {
- var w;
- s.value = f.type, f.type === "drop" && ((w = e.onDrop) === null || w === void 0 || w.call(e, f));
- };
- r({
- onBatchStart: h,
- onSuccess: m,
- onProgress: S,
- onError: E,
- fileList: g,
- upload: v
- });
- const [U] = Ot("Upload", Dt.Upload, _(() => e.locale)), N = (f, w) => {
- const {
- removeIcon: $,
- previewIcon: C,
- downloadIcon: x,
- previewFile: A,
- onPreview: j,
- onDownload: T,
- isImageUrl: k,
- progress: V,
- itemRender: te,
- iconRender: H,
- showUploadList: G
- } = e, {
- showDownloadIcon: K,
- showPreviewIcon: oe,
- showRemoveIcon: he
- } = typeof G == "boolean" ? {} : G;
- return G ? d(Xn, {
- prefixCls: i.value,
- listType: e.listType,
- items: g.value,
- previewFile: A,
- onPreview: j,
- onDownload: T,
- onRemove: L,
- showRemoveIcon: !y.value && he,
- showPreviewIcon: oe,
- showDownloadIcon: K,
- removeIcon: $,
- previewIcon: C,
- downloadIcon: x,
- iconRender: H,
- locale: U.value,
- isImageUrl: k,
- progress: V,
- itemRender: te,
- appendActionVisible: w,
- appendAction: f
- }, P({}, o)) : f == null ? void 0 : f();
- };
- return () => {
- var f, w, $;
- const {
- listType: C,
- type: x
- } = e, {
- class: A,
- style: j
- } = n, T = Zn(n, ["class", "style"]), k = P(P(P({
- onBatchStart: h,
- onError: E,
- onProgress: S,
- onSuccess: m
- }, T), e), {
- id: (f = e.id) !== null && f !== void 0 ? f : l.id.value,
- prefixCls: i.value,
- beforeUpload: p,
- onChange: void 0,
- disabled: y.value
- });
- delete k.remove, (!o.default || y.value) && delete k.id;
- const V = {
- [`${i.value}-rtl`]: a.value === "rtl"
- };
- if (x === "drag") {
- const K = re(i.value, {
- [`${i.value}-drag`]: !0,
- [`${i.value}-drag-uploading`]: g.value.some((oe) => oe.status === "uploading"),
- [`${i.value}-drag-hover`]: s.value === "dragover",
- [`${i.value}-disabled`]: y.value,
- [`${i.value}-rtl`]: a.value === "rtl"
- }, n.class, u.value);
- return b(d("span", D(D({}, n), {}, {
- class: re(`${i.value}-wrapper`, V, A, u.value)
- }), [d("div", {
- class: K,
- onDrop: M,
- onDragover: M,
- onDragleave: M,
- style: n.style
- }, [d(Ee, D(D({}, k), {}, {
- ref: v,
- class: `${i.value}-btn`
- }), D({
- default: () => [d("div", {
- class: `${i.value}-drag-container`
- }, [(w = o.default) === null || w === void 0 ? void 0 : w.call(o)])]
- }, o))]), N()]));
- }
- const te = re(i.value, {
- [`${i.value}-select`]: !0,
- [`${i.value}-select-${C}`]: !0,
- [`${i.value}-disabled`]: y.value,
- [`${i.value}-rtl`]: a.value === "rtl"
- }), H = Ft(($ = o.default) === null || $ === void 0 ? void 0 : $.call(o)), G = (K) => d("div", {
- class: te,
- style: K
- }, [d(Ee, D(D({}, k), {}, {
- ref: v
- }), o)]);
- return b(C === "picture-card" ? d("span", D(D({}, n), {}, {
- class: re(`${i.value}-wrapper`, `${i.value}-picture-card-wrapper`, V, n.class, u.value)
- }), [N(G, !!(H && H.length))]) : d("span", D(D({}, n), {}, {
- class: re(`${i.value}-wrapper`, V, n.class, u.value)
- }), [G(H && H.length ? void 0 : {
- display: "none"
- }), N()]));
- };
- }
- });
- var Ue = 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 r = 0, n = Object.getOwnPropertySymbols(e); r < n.length; r++)
- t.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[r]) && (o[n[r]] = e[n[r]]);
- return o;
- };
- const ue = z({
- compatConfig: {
- MODE: 3
- },
- name: "AUploadDragger",
- inheritAttrs: !1,
- props: Ye(),
- setup(e, t) {
- let {
- slots: o,
- attrs: n
- } = t;
- return () => {
- const {
- height: r
- } = e, l = Ue(e, ["height"]), {
- style: i
- } = n, a = Ue(n, ["style"]), c = P(P(P({}, l), a), {
- type: "drag",
- style: P(P({}, i), {
- height: typeof r == "number" ? `${r}px` : r
- })
- });
- return d(ce, c, o);
- };
- }
- }), lo = ue, so = P(ce, {
- Dragger: ue,
- LIST_IGNORE: ie,
- install(e) {
- return e.component(ce.name, ce), e.component(ue.name, ue), e;
- }
- });
- export {
- lo as U,
- so as _
- };
|