@unicom-cloud/ui 0.8.57 → 0.8.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Affix.js +15 -15
- package/Alert.js +5 -5
- package/Anchor.js +1 -1
- package/AutoComplete.js +28 -28
- package/Avatar.js +11 -11
- package/BackTop.js +28 -28
- package/Badge.js +10 -10
- package/Breadcrumb.js +6 -6
- package/Button.js +11 -10
- package/Calendar.js +8 -8
- package/Card.js +3 -3
- package/Carousel.js +7 -7
- package/Cascader.js +1 -1
- package/Checkbox.js +1 -1
- package/Collapse.js +1 -1
- package/ColorPicker.js +582 -11
- package/Comment.js +7 -7
- package/ConfigProvider.js +2 -2
- package/Copy.js +6 -6
- package/DatePicker.js +14 -12
- package/Descriptions.js +3 -3
- package/Divider.js +3 -3
- package/Draggable.js +12 -12
- package/Drawer.js +1 -1
- package/Dropdown.js +5 -5
- package/Empty.js +3 -3
- package/Form.js +1410 -10
- package/Grid.js +14 -14
- package/Icon.js +2 -2
- package/IconHover.js +2 -2
- package/Image.js +1 -1
- package/Input.js +2 -2
- package/InputNumber.js +8 -8
- package/InputTag.js +1 -1
- package/Layout.js +8 -8
- package/Link.js +13 -13
- package/List.js +21 -21
- package/Mentions.js +30 -30
- package/Menu.js +1 -1
- package/Message.js +3 -3
- package/Modal.js +1 -1
- package/Notice.js +3 -3
- package/Notification.js +4 -4
- package/OverflowEllipsis.js +9 -9
- package/PageHeader.js +10 -10
- package/Pagination.js +1 -1
- package/Picker.js +1 -1
- package/Popconfirm.js +5 -5
- package/Popover.js +7 -7
- package/Portal.js +1 -1
- package/Progress.js +15 -15
- package/Radio.js +2 -2
- package/Rate.js +10 -10
- package/ResizeBox.js +10 -11
- package/Result.js +11 -11
- package/Select.js +1 -1
- package/SelectView.js +40 -41
- package/Skeleton.js +4 -4
- package/Slider.js +9 -9
- package/Space.js +12 -12
- package/SpeechSynthesis.js +1 -1
- package/Spin.js +11 -11
- package/Statistic.js +43 -43
- package/Steps.js +5 -5
- package/Switch.js +15 -16
- package/Table.js +17 -17
- package/Tabs.js +1 -1
- package/Tag.js +5 -5
- package/TimePicker.js +38 -38
- package/Timeline.js +1 -1
- package/Tooltip.js +9 -9
- package/Transfer.js +26 -26
- package/Tree.js +1 -1
- package/TreeSelect.js +1 -1
- package/Trigger.js +11 -11
- package/Typography.js +1 -1
- package/Upload.js +4 -1
- package/VerificationCode.js +1 -1
- package/Version.js +1 -1
- package/VirtualList.js +1 -1
- package/Watermark.js +1 -1
- package/chunk/{m_kOQCiU.js → -LZOUh53.js} +1 -1
- package/chunk/{CXNW5Y2a.js → -jdfq71f.js} +1 -1
- package/chunk/{CkAOsst1.js → 4-gvEY5y.js} +30 -30
- package/chunk/{DQXq1QT0.js → B0GOLsj_.js} +1 -1
- package/chunk/{BMvZCjSU.js → B16KHtX-.js} +16 -16
- package/chunk/{CggcswbO.js → B2vORJQ8.js} +19 -15
- package/chunk/{BCk8e9fj.js → B7Zsp3gO.js} +1 -1
- package/chunk/B8QV6E2b.js +34 -0
- package/chunk/{BeM2hfks.js → BBVjSFnw.js} +27 -23
- package/chunk/{1mEO29GP.js → BDjXkzNj.js} +1 -1
- package/chunk/{BuEC_zcc.js → BEDYCG-I.js} +31 -31
- package/chunk/{B45v5S9k.js → BHn4xgbv.js} +1 -1
- package/chunk/{CF3Telny.js → BJ_7JTqC.js} +3 -3
- package/chunk/{BM6dpkeM.js → BLSiP_gg.js} +1 -1
- package/chunk/{9Gh1afjL.js → BMJfSSLX.js} +1 -1
- package/chunk/{DBJ8d0o0.js → BNHrEI0Y.js} +31 -31
- package/chunk/{BP7xX86Q.js → BPZ-6HKJ.js} +131 -134
- package/chunk/{DxNRWF67.js → BVLwPZis.js} +11 -11
- package/chunk/{BpwDupra.js → BYhtrDV3.js} +9 -9
- package/chunk/{D6mVoX-C.js → B_nfMl0e.js} +1 -1
- package/chunk/{BWx1cVT_.js → BcS17Pzy.js} +1 -1
- package/chunk/Bdh4XVuf.js +1487 -0
- package/chunk/{BkHxm4sv.js → BdiEwtQO.js} +1 -1
- package/chunk/{DDda6s72.js → BjSHZA0m.js} +6 -6
- package/chunk/{C7Okdv4u.js → Bpug_KxP.js} +1 -1
- package/chunk/BzPkh4Zv.js +11 -0
- package/chunk/{CwXmtKib.js → C1D7T29r.js} +35 -35
- package/chunk/{DYZzQ2uT.js → C1u_ckwU.js} +1 -1
- package/chunk/C1xMmQIZ.js +468 -0
- package/chunk/C2lIz2F9.js +60 -0
- package/chunk/{Be7oeWU8.js → C43Hv2Bl.js} +1 -1
- package/chunk/{CR4u270n.js → C5AQWbC4.js} +79 -79
- package/chunk/{fqgc8r6C.js → C9vsih_D.js} +1 -1
- package/chunk/CANaGbGR.js +154 -0
- package/chunk/{BA02BFUV.js → CAfR2wLq.js} +1 -1
- package/chunk/{CcX2pBUh.js → CAfecMDF.js} +1 -1
- package/chunk/{BHK9zpXn.js → CKp4rZnD.js} +1 -1
- package/chunk/CTxjmYmx.js +19 -0
- package/chunk/{BqxwlITu.js → CV2Aqv9q.js} +1 -1
- package/chunk/{bsawGxt8.js → CYdarMv9.js} +1 -1
- package/chunk/{DafaH1Qt.js → C_S5Mdvd.js} +43 -44
- package/chunk/{DkIjpuBZ.js → Cbd50gx8.js} +11 -11
- package/chunk/{D5p8q9Pa.js → CbiWdbr_.js} +12 -12
- package/chunk/{cUuQh7L_.js → CmB-TL7C.js} +1 -1
- package/chunk/{BbYzi8M0.js → CuOl4X0X.js} +4 -4
- package/chunk/{BHLTzWzi.js → D-ER56Sf.js} +1 -1
- package/chunk/{BK1FKNAX.js → D-aYnb6u.js} +1 -1
- package/chunk/{DalIRWr7.js → D2HkyI6A.js} +9 -9
- package/chunk/D3NFxdmG.js +518 -0
- package/chunk/{C2fspJbE.js → D3xQFJcO.js} +1 -1
- package/chunk/{Lk60-jkf.js → DApXtulb.js} +4 -0
- package/chunk/{sl8s35SK.js → DJcEys80.js} +1 -1
- package/chunk/{B1S1OEw6.js → DLIm6rRJ.js} +1 -1
- package/chunk/{C95ipQ6b.js → DOWEHtqM.js} +1 -1
- package/chunk/{aM2ePYrq.js → DSGRHf-1.js} +132 -132
- package/chunk/{D9TqtOhq.js → DT37l12z.js} +1 -1
- package/chunk/{B6fn5y_s.js → DW-B7npC.js} +1 -1
- package/chunk/D_-UD4vO.js +119 -0
- package/chunk/{Dtnux4qL.js → D_MTFBb0.js} +1 -1
- package/chunk/{WkB0MERB.js → DhBo0pPJ.js} +27 -27
- package/chunk/DmUhn9ib.js +961 -0
- package/chunk/{Bny52uiG.js → DpfUGhi4.js} +10 -10
- package/chunk/{DhLbnw3R.js → Dx_5J4fO.js} +1 -1
- package/chunk/{B9PsJar0.js → Dy487FZ1.js} +1 -1
- package/chunk/{D6RTBH4C.js → IooeSKJJ.js} +10 -10
- package/chunk/Kbr6FzOG.js +745 -0
- package/chunk/{CwjaGytU.js → RMBPs_Ry.js} +32 -32
- package/chunk/Uz-rNulO.js +98 -0
- package/chunk/V6euPXVB.js +1025 -0
- package/chunk/{Bv8ZRDFt.js → YIlBPVAs.js} +14 -14
- package/chunk/{DPvnQJ-H.js → cDZI_t6o.js} +1 -1
- package/chunk/{C-w9pFY-.js → cZiP8FvM.js} +3 -3
- package/chunk/{DJmWXheU.js → eK7lxdak.js} +8 -8
- package/chunk/{Dg2DmtzA.js → gIbzjQ-X.js} +5 -6
- package/chunk/{CPl52AZh.js → sScV-J56.js} +1 -1
- package/chunk/{BbI3gqVr.js → wI2I1qb0.js} +1 -1
- package/hooks/index.js +32 -32
- package/hooks/use-verification-code.js +23 -22
- package/hooks/use-watermark.js +2 -1
- package/hooks/useComputedState.js +2 -1
- package/hooks/useCreate.js +2 -1
- package/hooks/useForceUpdate.js +2 -1
- package/hooks/useId.js +2 -1
- package/hooks/useInView.js +5 -4
- package/hooks/useIntersectionObserver.js +11 -11
- package/hooks/useIsFirstRender.js +2 -1
- package/hooks/useIsomorphicLayoutEffect.js +2 -1
- package/hooks/useKeyboardEvent.js +3 -2
- package/hooks/useMedia.js +2 -1
- package/hooks/useMergeProps.js +2 -1
- package/hooks/useMergeValue.js +4 -3
- package/hooks/useOverflowHidden.js +2 -1
- package/hooks/useOverrideRef.js +2 -1
- package/hooks/usePersistCallback.js +2 -1
- package/hooks/usePrevious.js +2 -1
- package/hooks/useRefs.js +2 -1
- package/hooks/useResizeObserver.js +2 -1
- package/hooks/useStateCallback.js +2 -1
- package/hooks/useStateWithPromise.js +2 -1
- package/hooks/useUpdateEffect.js +2 -1
- package/hooks/useWatch.js +3 -2
- package/hooks/useWindowSize.js +2 -1
- package/icons.js +35 -35
- package/index.js +484 -376
- package/locale/en-US.js +3 -11
- package/locale/tr-TR.js +3 -11
- package/package.json +1 -1
- package/types/anchor/Anchor.d.ts +1 -1
- package/types/button/index.d.ts +3 -2
- package/types/color-picker/hooks/useColorPicker.d.ts +1 -1
- package/types/color-picker/hooks/useControlBlock.d.ts +1 -1
- package/types/config-provider/interface.d.ts +1 -0
- package/types/date-picker/PickerRange.d.ts +1 -1
- package/types/hooks/use-verification-code/index.d.ts +2 -1
- package/types/hooks/use-watermark/index.d.ts +2 -1
- package/types/hooks/useComputedState.d.ts +2 -2
- package/types/hooks/useCreate.d.ts +2 -1
- package/types/hooks/useForceUpdate.d.ts +2 -1
- package/types/hooks/useId.d.ts +2 -1
- package/types/hooks/useInView.d.ts +1 -1
- package/types/hooks/useIntersectionObserver.d.ts +1 -1
- package/types/hooks/useIsFirstRender.d.ts +2 -1
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/types/hooks/useKeyboardEvent.d.ts +2 -2
- package/types/hooks/useMedia.d.ts +1 -1
- package/types/hooks/useMergeProps.d.ts +2 -1
- package/types/hooks/useMergeValue.d.ts +2 -1
- package/types/hooks/useOverflowHidden.d.ts +2 -2
- package/types/hooks/useOverrideRef.d.ts +2 -1
- package/types/hooks/usePersistCallback.d.ts +2 -1
- package/types/hooks/usePrevious.d.ts +2 -1
- package/types/hooks/useRefs.d.ts +2 -1
- package/types/hooks/useResizeObserver.d.ts +2 -1
- package/types/hooks/useStateCallback.d.ts +1 -1
- package/types/hooks/useStateWithPromise.d.ts +1 -1
- package/types/hooks/useUpdateEffect.d.ts +2 -1
- package/types/hooks/useWatch.d.ts +2 -1
- package/types/hooks/useWindowSize.d.ts +1 -1
- package/types/image/interface.d.ts +1 -1
- package/types/index.d.ts +13 -22
- package/types/table/interface.d.ts +3 -1
- package/types/upload/Upload.d.ts +2 -1
- package/types/upload/index.d.ts +3 -1
- package/types/upload/request_.d.ts +3 -0
- package/types/utils/caseName.d.ts +2 -0
- package/types/utils/fileToURL.d.ts +2 -0
- package/types/utils/fillNBSP.d.ts +1 -1
- package/types/utils/index.d.ts +37 -0
- package/types/utils/is.d.ts +2 -2
- package/types/utils/lodash.d.ts +4 -0
- package/types/utils/scrollIntoView.d.ts +2 -1
- package/types/version/index.d.ts +1 -1
- package/ui.css +1 -0
- package/utils/CSSTransition.js +1 -1
- package/utils/caseName.js +20 -0
- package/utils/className.js +1 -1
- package/utils/contextHolder.js +1 -1
- package/utils/fileToURL.js +4 -0
- package/utils/index.js +219 -0
- package/utils/is.js +95 -93
- package/utils/keyCode.js +10 -46
- package/utils/lodash.js +8 -0
- package/utils/mergedToString.js +11 -10
- package/utils/reactDOM.js +1 -1
- package/utils/saveAs.js +1 -1
- package/utils/scrollIntoView.js +8 -7
- package/chunk/5pZ3ayqs.js +0 -29
- package/chunk/Bl-ODC57.js +0 -945
- package/chunk/BlKc_pDZ.js +0 -678
- package/chunk/CiEln_Q1.js +0 -517
- package/chunk/CiZVOdJ3.js +0 -122
- package/chunk/DMWMrXg1.js +0 -964
- package/chunk/DUxWiN2U.js +0 -1465
- package/chunk/Dbk4DVhB.js +0 -855
- package/chunk/Do1aMgY3.js +0 -12
- package/chunk/HlP8inLK.js +0 -1796
- package/chunk/V_IcWDFx.js +0 -49
- package/style.css +0 -1
- /package/types/utils/{mergeProp.d.ts → mergeProps.d.ts} +0 -0
- /package/utils/{mergeProp.js → mergeProps.js} +0 -0
|
@@ -0,0 +1,1025 @@
|
|
|
1
|
+
import { jsxs as F, Fragment as M, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import k from "lodash/isFunction";
|
|
3
|
+
import me from "lodash/isNumber";
|
|
4
|
+
import te, { useContext as z, forwardRef as Q, useState as A, useEffect as G, isValidElement as Ie, useRef as ie, useImperativeHandle as fe } from "react";
|
|
5
|
+
import { d as W, I as Ue } from "./Bdh4XVuf.js";
|
|
6
|
+
import { useMergeProps as xe } from "../hooks/useMergeProps.js";
|
|
7
|
+
import { y as X } from "./BzPkh4Zv.js";
|
|
8
|
+
import $e from "../utils/omit.js";
|
|
9
|
+
import ce from "../utils/warning.js";
|
|
10
|
+
import { _ as we, P as ne } from "./BPZ-6HKJ.js";
|
|
11
|
+
import { a as Pe } from "./C1D7T29r.js";
|
|
12
|
+
import { I as ge } from "./DJcEys80.js";
|
|
13
|
+
import { I as Ce } from "./Bpug_KxP.js";
|
|
14
|
+
import { I as Ne } from "./sScV-J56.js";
|
|
15
|
+
import { I as ae, a as Fe, b as Ee, c as he, d as Le, e as Re, f as De } from "./CKp4rZnD.js";
|
|
16
|
+
import { l as be } from "./CTxjmYmx.js";
|
|
17
|
+
import { useKeyboardEvent as Y } from "../hooks/useKeyboardEvent.js";
|
|
18
|
+
import "../utils/is.js";
|
|
19
|
+
import { I as Te } from "./-jdfq71f.js";
|
|
20
|
+
import Oe from "../Progress.js";
|
|
21
|
+
import re from "../Tooltip.js";
|
|
22
|
+
import _ from "lodash/isPlainObject";
|
|
23
|
+
import { b as ke } from "./BHn4xgbv.js";
|
|
24
|
+
import { I as Se } from "./C1u_ckwU.js";
|
|
25
|
+
import { H as qe } from "./BBVjSFnw.js";
|
|
26
|
+
import { I as de } from "./DW-B7npC.js";
|
|
27
|
+
import je from "../Button.js";
|
|
28
|
+
import Ae from "lodash/isArray";
|
|
29
|
+
import { NOOP as p } from "../utils/constant.js";
|
|
30
|
+
const $ = {
|
|
31
|
+
init: "init",
|
|
32
|
+
uploading: "uploading",
|
|
33
|
+
success: "done",
|
|
34
|
+
fail: "error"
|
|
35
|
+
}, ve = (e) => {
|
|
36
|
+
var w, f, l, c, g, b;
|
|
37
|
+
const u = Y(), { file: m, prefixCls: s, progressProps: t, progressRender: r } = e, { locale: i } = z(W), { status: o, percent: h = 0 } = m, v = `${s}-list`, I = t && t.width ? { width: t.width } : {}, U = /* @__PURE__ */ F(M, { children: [
|
|
38
|
+
o === $.fail && e.reuploadIcon !== null && /* @__PURE__ */ n(
|
|
39
|
+
"span",
|
|
40
|
+
{
|
|
41
|
+
className: `${s}-list-reupload-icon`,
|
|
42
|
+
onClick: () => {
|
|
43
|
+
var a;
|
|
44
|
+
(a = e.onReupload) == null || a.call(e, m);
|
|
45
|
+
},
|
|
46
|
+
tabIndex: 0,
|
|
47
|
+
role: "button",
|
|
48
|
+
"aria-label": (w = i == null ? void 0 : i.Upload) == null ? void 0 : w.reupload,
|
|
49
|
+
...u({
|
|
50
|
+
onPressEnter: () => {
|
|
51
|
+
var a;
|
|
52
|
+
(a = e.onReupload) == null || a.call(e, m);
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
children: e.reuploadIcon || (e.listType === "picture-card" ? /* @__PURE__ */ n(ae, {}) : (f = i == null ? void 0 : i.Upload) == null ? void 0 : f.reupload)
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
o === $.success && e.successIcon !== null && /* @__PURE__ */ n("span", { className: `${s}-list-success-icon`, children: e.successIcon || /* @__PURE__ */ n(Te, {}) }),
|
|
59
|
+
o !== $.success && /* @__PURE__ */ F("div", { className: `${v}-status`, style: I, children: [
|
|
60
|
+
/* @__PURE__ */ n(
|
|
61
|
+
Oe,
|
|
62
|
+
{
|
|
63
|
+
showText: !1,
|
|
64
|
+
className: `${v}-progress`,
|
|
65
|
+
type: "circle",
|
|
66
|
+
status: o === $.fail ? "error" : o === $.success ? "success" : "normal",
|
|
67
|
+
percent: h,
|
|
68
|
+
size: "mini",
|
|
69
|
+
...t
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
o === $.init && e.startIcon !== null && /* @__PURE__ */ n(
|
|
73
|
+
"span",
|
|
74
|
+
{
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
role: "button",
|
|
77
|
+
"aria-label": (l = i == null ? void 0 : i.Upload) == null ? void 0 : l.start,
|
|
78
|
+
className: `${s}-list-start-icon`,
|
|
79
|
+
onClick: () => {
|
|
80
|
+
var a;
|
|
81
|
+
(a = e.onUpload) == null || a.call(e, m);
|
|
82
|
+
},
|
|
83
|
+
...u({
|
|
84
|
+
onPressEnter: () => {
|
|
85
|
+
var a;
|
|
86
|
+
(a = e.onUpload) == null || a.call(e, m);
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
children: e.startIcon || /* @__PURE__ */ n(re, { content: (c = i == null ? void 0 : i.Upload) == null ? void 0 : c.start, children: /* @__PURE__ */ n(Fe, {}) })
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
o === $.uploading && e.cancelIcon !== null && /* @__PURE__ */ n(
|
|
93
|
+
"span",
|
|
94
|
+
{
|
|
95
|
+
className: `${e.prefixCls}-list-cancel-icon`,
|
|
96
|
+
onClick: () => {
|
|
97
|
+
var a;
|
|
98
|
+
(a = e.onAbort) == null || a.call(e, m);
|
|
99
|
+
},
|
|
100
|
+
tabIndex: 0,
|
|
101
|
+
"aria-label": (g = i == null ? void 0 : i.Upload) == null ? void 0 : g.cancel,
|
|
102
|
+
...u({
|
|
103
|
+
onPressEnter: () => {
|
|
104
|
+
var a;
|
|
105
|
+
(a = e.onAbort) == null || a.call(e, m);
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
children: e.cancelIcon || /* @__PURE__ */ n(re, { content: (b = i == null ? void 0 : i.Upload) == null ? void 0 : b.cancel, children: /* @__PURE__ */ n(Ee, {}) })
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] })
|
|
112
|
+
] });
|
|
113
|
+
return k(r) ? r(m, U) : U;
|
|
114
|
+
}, He = (e, u) => {
|
|
115
|
+
const { disabled: m, prefixCls: s, file: t, showUploadList: r, locale: i } = e, o = Y(), h = `${s}-list-item-picture`, { status: v, originFile: I } = t, [U, w] = A(t.url), f = _(r) ? r : {};
|
|
116
|
+
return G(() => {
|
|
117
|
+
if (t.url !== void 0)
|
|
118
|
+
w(t.url);
|
|
119
|
+
else {
|
|
120
|
+
const l = t.originFile;
|
|
121
|
+
l && be(l).then((c) => {
|
|
122
|
+
w(c);
|
|
123
|
+
}).catch((c) => {
|
|
124
|
+
console.error(c);
|
|
125
|
+
}).finally(() => {
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return () => {
|
|
129
|
+
};
|
|
130
|
+
}, [t.url, t.originFile]), G(() => {
|
|
131
|
+
var l;
|
|
132
|
+
return (l = e.onChange) == null || l.call(e, { type: "url", data: U }), () => {
|
|
133
|
+
var c;
|
|
134
|
+
(c = e.onChange) == null || c.call(e, { type: "url", data: void 0 });
|
|
135
|
+
};
|
|
136
|
+
}, [U]), /* @__PURE__ */ n("div", { className: h, ref: u, children: v === $.uploading ? /* @__PURE__ */ n(
|
|
137
|
+
ve,
|
|
138
|
+
{
|
|
139
|
+
onReupload: e.onReupload,
|
|
140
|
+
onUpload: e.onUpload,
|
|
141
|
+
onAbort: e.onAbort,
|
|
142
|
+
listType: "picture-card",
|
|
143
|
+
file: t,
|
|
144
|
+
prefixCls: s,
|
|
145
|
+
progressProps: e.progressProps,
|
|
146
|
+
...f
|
|
147
|
+
}
|
|
148
|
+
) : /* @__PURE__ */ F(M, { children: [
|
|
149
|
+
k(f.imageRender) ? f.imageRender(t) : /* @__PURE__ */ n("img", { src: U, alt: t.name }),
|
|
150
|
+
/* @__PURE__ */ F("div", { className: `${h}-mask`, role: "radiogroup", children: [
|
|
151
|
+
t.status === $.fail && /* @__PURE__ */ n("div", { className: `${h}-error-tip`, children: f.errorIcon !== null && /* @__PURE__ */ n("span", { className: `${s}-list-error-icon`, children: f.errorIcon || /* @__PURE__ */ n(Ne, {}) }) }),
|
|
152
|
+
/* @__PURE__ */ F("div", { className: `${h}-operation`, children: [
|
|
153
|
+
t.status !== $.fail && f.previewIcon !== null && /* @__PURE__ */ n(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
className: `${s}-list-preview-icon`,
|
|
157
|
+
tabIndex: 0,
|
|
158
|
+
role: "button",
|
|
159
|
+
"aria-label": i.Upload.preview,
|
|
160
|
+
...o({
|
|
161
|
+
onPressEnter: () => {
|
|
162
|
+
var l;
|
|
163
|
+
(l = e.onPreview) == null || l.call(e, t);
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
onClick: () => {
|
|
167
|
+
var l;
|
|
168
|
+
(l = e.onPreview) == null || l.call(e, t);
|
|
169
|
+
},
|
|
170
|
+
children: f.previewIcon || /* @__PURE__ */ n(Ce, {})
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
t.status === $.fail && f.reuploadIcon !== null && /* @__PURE__ */ n(
|
|
174
|
+
"span",
|
|
175
|
+
{
|
|
176
|
+
className: `${e.prefixCls}-list-reupload-icon`,
|
|
177
|
+
onClick: () => {
|
|
178
|
+
var l;
|
|
179
|
+
(l = e.onReupload) == null || l.call(e, t);
|
|
180
|
+
},
|
|
181
|
+
tabIndex: 0,
|
|
182
|
+
role: "button",
|
|
183
|
+
"aria-label": i.Upload.reupload,
|
|
184
|
+
...o({
|
|
185
|
+
onPressEnter: () => {
|
|
186
|
+
var l;
|
|
187
|
+
(l = e.onReupload) == null || l.call(e, t);
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
children: f.reuploadIcon || /* @__PURE__ */ n(ae, {})
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
!m && f.removeIcon !== null && /* @__PURE__ */ n(
|
|
194
|
+
"span",
|
|
195
|
+
{
|
|
196
|
+
className: `${s}-list-remove-icon`,
|
|
197
|
+
onClick: () => {
|
|
198
|
+
var l;
|
|
199
|
+
(l = e.onRemove) == null || l.call(e, t);
|
|
200
|
+
},
|
|
201
|
+
role: "button",
|
|
202
|
+
"aria-label": i.Upload.delete,
|
|
203
|
+
tabIndex: 0,
|
|
204
|
+
...o({
|
|
205
|
+
onPressEnter: () => {
|
|
206
|
+
var l;
|
|
207
|
+
(l = e.onRemove) == null || l.call(e, t);
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
children: f.removeIcon || /* @__PURE__ */ n(ge, {})
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] })
|
|
214
|
+
] })
|
|
215
|
+
] }) });
|
|
216
|
+
}, Ve = Q(He), Ge = (e) => {
|
|
217
|
+
let u = "";
|
|
218
|
+
if (e.originFile && e.originFile.type)
|
|
219
|
+
u = e.originFile.type;
|
|
220
|
+
else {
|
|
221
|
+
const s = (e.name || "").split(".").pop() || "";
|
|
222
|
+
u = s, ["png", "jpg", "jpeg", "bmp", "gif"].indexOf(s) > -1 ? u = "image" : ["mp4", "m2v", "mkv"].indexOf(s) > -1 ? u = "video" : ["mp3", "wav", "wmv"].indexOf(s) > -1 && (u = "audio");
|
|
223
|
+
}
|
|
224
|
+
return u.indexOf("image") > -1 ? he : u.indexOf("pdf") > -1 ? Le : u.indexOf("audio") > -1 ? Re : u.indexOf("video") > -1 ? De : Se;
|
|
225
|
+
}, _e = (e, u) => {
|
|
226
|
+
const { prefixCls: m, disabled: s, file: t, locale: r } = e, i = `${m}-list-item-text`, o = Y(), h = Ge(t), v = _(e.showUploadList) ? e.showUploadList : {}, I = _(v) ? v : {}, U = t.name || t.originFile && t.originFile.name, [w, f] = A(t.url);
|
|
227
|
+
let l = {};
|
|
228
|
+
return t.status !== $.fail && (l = {
|
|
229
|
+
popupVisible: !1
|
|
230
|
+
}), G(() => {
|
|
231
|
+
if (t.url !== void 0)
|
|
232
|
+
f(t.url);
|
|
233
|
+
else {
|
|
234
|
+
const c = t.originFile;
|
|
235
|
+
c && be(c).then((g) => {
|
|
236
|
+
f(g);
|
|
237
|
+
}).catch((g) => {
|
|
238
|
+
console.error(g);
|
|
239
|
+
}).finally(() => {
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
return () => {
|
|
243
|
+
};
|
|
244
|
+
}, [t.url, t.originFile]), G(() => {
|
|
245
|
+
var c;
|
|
246
|
+
return (c = e.onChange) == null || c.call(e, { type: "url", data: w }), () => {
|
|
247
|
+
var g;
|
|
248
|
+
(g = e.onChange) == null || g.call(e, { type: "url", data: void 0 });
|
|
249
|
+
};
|
|
250
|
+
}, [w]), /* @__PURE__ */ F(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
className: `${m}-list-item ${m}-list-item-${t.status}`,
|
|
254
|
+
ref: u,
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ F("div", { className: i, children: [
|
|
257
|
+
e.listType === "picture-list" && /* @__PURE__ */ n("div", { className: `${i}-thumbnail`, children: k(v.imageRender) ? v.imageRender(t) : /* @__PURE__ */ n("img", { src: w }) }),
|
|
258
|
+
/* @__PURE__ */ F("div", { className: `${i}-content`, children: [
|
|
259
|
+
/* @__PURE__ */ F("div", { className: `${i}-name`, children: [
|
|
260
|
+
e.listType === "text" && I.fileIcon !== null && /* @__PURE__ */ n("span", { className: `${m}-list-file-icon`, children: I.fileIcon || /* @__PURE__ */ n(h, {}) }),
|
|
261
|
+
k(v.fileName) ? /* @__PURE__ */ n("span", { className: `${i}-name-text`, children: v.fileName(t) }) : t.url ? /* @__PURE__ */ n(
|
|
262
|
+
"a",
|
|
263
|
+
{
|
|
264
|
+
href: t.url,
|
|
265
|
+
target: "_blank",
|
|
266
|
+
rel: "noreferrer",
|
|
267
|
+
className: `${i}-name-link`,
|
|
268
|
+
children: U
|
|
269
|
+
}
|
|
270
|
+
) : /* @__PURE__ */ n("span", { className: `${i}-name-text`, children: U }),
|
|
271
|
+
t.status === $.fail && I.errorIcon !== null && /* @__PURE__ */ n(
|
|
272
|
+
re,
|
|
273
|
+
{
|
|
274
|
+
content: (typeof t.response == "object" ? Ie(t.response) && t.response : t.response) || r.Upload.error,
|
|
275
|
+
...l,
|
|
276
|
+
disabled: t.status !== $.fail,
|
|
277
|
+
children: /* @__PURE__ */ n("span", { className: `${e.prefixCls}-list-error-icon`, children: I.errorIcon || (e.listType === "picture-card" ? /* @__PURE__ */ n(he, {}) : /* @__PURE__ */ n(ke, {})) })
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
] }),
|
|
281
|
+
/* @__PURE__ */ n(
|
|
282
|
+
ve,
|
|
283
|
+
{
|
|
284
|
+
file: t,
|
|
285
|
+
prefixCls: m,
|
|
286
|
+
progressProps: e.progressProps,
|
|
287
|
+
onReupload: e.onReupload,
|
|
288
|
+
onUpload: e.onUpload,
|
|
289
|
+
onAbort: e.onAbort,
|
|
290
|
+
...I
|
|
291
|
+
}
|
|
292
|
+
)
|
|
293
|
+
] })
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ n("div", { className: `${m}-list-item-operation`, children: !s && I.removeIcon !== null && /* @__PURE__ */ n(
|
|
296
|
+
Ue,
|
|
297
|
+
{
|
|
298
|
+
className: `${m}-list-remove-icon-hover`,
|
|
299
|
+
onClick: () => {
|
|
300
|
+
var c;
|
|
301
|
+
(c = e.onRemove) == null || c.call(e, t);
|
|
302
|
+
},
|
|
303
|
+
tabIndex: 0,
|
|
304
|
+
"aria-label": r.Upload.delete,
|
|
305
|
+
...o({
|
|
306
|
+
onPressEnter: () => {
|
|
307
|
+
var c;
|
|
308
|
+
(c = e.onRemove) == null || c.call(e, t);
|
|
309
|
+
}
|
|
310
|
+
}),
|
|
311
|
+
children: /* @__PURE__ */ n("span", { className: `${m}-list-remove-icon`, children: I.removeIcon || /* @__PURE__ */ n(ge, {}) })
|
|
312
|
+
}
|
|
313
|
+
) })
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}, Be = Q(_e), ye = (e) => {
|
|
318
|
+
const { locale: u, rtl: m } = z(W), {
|
|
319
|
+
listType: s,
|
|
320
|
+
fileList: t,
|
|
321
|
+
renderUploadList: r,
|
|
322
|
+
renderUploadItem: i,
|
|
323
|
+
prefixCls: o,
|
|
324
|
+
...h
|
|
325
|
+
} = e, [v, I] = A(-1), [U, w] = A([]);
|
|
326
|
+
if (k(r))
|
|
327
|
+
return /* @__PURE__ */ n("div", { className: `${o}-list`, children: r(t, h) });
|
|
328
|
+
const f = (c) => {
|
|
329
|
+
e.imagePreview && I(c);
|
|
330
|
+
};
|
|
331
|
+
function l(c, g, b) {
|
|
332
|
+
(c == null ? void 0 : c.type) === "url" && [$.init, $.success].indexOf(b.status) > -1 && w((a) => {
|
|
333
|
+
const E = [...a];
|
|
334
|
+
return E[g] = c.data, E.filter(Boolean);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return G(() => () => {
|
|
338
|
+
}, []), /* @__PURE__ */ F(M, { children: [
|
|
339
|
+
/* @__PURE__ */ n(
|
|
340
|
+
we,
|
|
341
|
+
{
|
|
342
|
+
className: X(
|
|
343
|
+
`${o}-list`,
|
|
344
|
+
`${o}-list-type-${s}`,
|
|
345
|
+
{
|
|
346
|
+
[`${o}-list-rtl`]: m
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
children: t.map((c, g) => {
|
|
350
|
+
let b = s === "picture-card" ? /* @__PURE__ */ n(
|
|
351
|
+
"div",
|
|
352
|
+
{
|
|
353
|
+
className: `${o}-list-item ${o}-list-item-${c.status}`,
|
|
354
|
+
children: /* @__PURE__ */ n(
|
|
355
|
+
Ve,
|
|
356
|
+
{
|
|
357
|
+
...e,
|
|
358
|
+
onPreview: (a) => {
|
|
359
|
+
var E;
|
|
360
|
+
f(g), (E = e.onPreview) == null || E.call(e, a);
|
|
361
|
+
},
|
|
362
|
+
file: c,
|
|
363
|
+
locale: u,
|
|
364
|
+
onChange: (a) => {
|
|
365
|
+
l(a, g, c);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
) : /* @__PURE__ */ n(
|
|
371
|
+
Be,
|
|
372
|
+
{
|
|
373
|
+
...e,
|
|
374
|
+
file: c,
|
|
375
|
+
locale: u,
|
|
376
|
+
onChange: (a) => {
|
|
377
|
+
l(a, g, c);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
return k(i) && (b = i(b, c, t)), s === "picture-card" ? /* @__PURE__ */ n(
|
|
382
|
+
ne,
|
|
383
|
+
{
|
|
384
|
+
timeout: { enter: 200, exit: 400 },
|
|
385
|
+
classNames: `${o}-slide-inline`,
|
|
386
|
+
onEntered: (a) => {
|
|
387
|
+
a && (a.style.width = "");
|
|
388
|
+
},
|
|
389
|
+
onExit: (a) => {
|
|
390
|
+
a && (a.style.width = `${a.scrollWidth}px`);
|
|
391
|
+
},
|
|
392
|
+
onExiting: (a) => {
|
|
393
|
+
a && (a.style.width = 0);
|
|
394
|
+
},
|
|
395
|
+
onExited: (a) => {
|
|
396
|
+
a && (a.style.width = 0);
|
|
397
|
+
},
|
|
398
|
+
children: b
|
|
399
|
+
},
|
|
400
|
+
c.uid
|
|
401
|
+
) : /* @__PURE__ */ n(
|
|
402
|
+
ne,
|
|
403
|
+
{
|
|
404
|
+
timeout: { enter: 200, exit: 400 },
|
|
405
|
+
classNames: `${o}-slide-up`,
|
|
406
|
+
onExit: (a) => {
|
|
407
|
+
a && (a.style.height = `${a.scrollHeight}px`);
|
|
408
|
+
},
|
|
409
|
+
onExiting: (a) => {
|
|
410
|
+
a && (a.style.height = 0);
|
|
411
|
+
},
|
|
412
|
+
onExited: (a) => {
|
|
413
|
+
a && (a.style.height = 0);
|
|
414
|
+
},
|
|
415
|
+
children: b
|
|
416
|
+
},
|
|
417
|
+
c.uid
|
|
418
|
+
);
|
|
419
|
+
})
|
|
420
|
+
}
|
|
421
|
+
),
|
|
422
|
+
s === "picture-card" && e.imagePreview && /* @__PURE__ */ n(
|
|
423
|
+
Pe,
|
|
424
|
+
{
|
|
425
|
+
srcList: U,
|
|
426
|
+
visible: v !== -1,
|
|
427
|
+
current: v,
|
|
428
|
+
onChange: f,
|
|
429
|
+
onVisibleChange: (c) => {
|
|
430
|
+
f(c ? v : -1);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
] });
|
|
435
|
+
};
|
|
436
|
+
ye.displayName = "FileList";
|
|
437
|
+
const le = (e, u) => {
|
|
438
|
+
const m = _(u) ? u == null ? void 0 : u.type : u;
|
|
439
|
+
if (!(_(u) && u.strict === !1) && m && e) {
|
|
440
|
+
const t = Ae(m) ? m : m.split(",").map((i) => i.trim()).filter((i) => i), r = (e.name.indexOf(".") > -1 ? `.${e.name.split(".").pop()}` : "").toLowerCase();
|
|
441
|
+
return t.some((i) => {
|
|
442
|
+
const o = i && i.toLowerCase(), h = (e.type || "").toLowerCase(), v = h.split("/")[0];
|
|
443
|
+
if (o === h || `${v}${r.replace(".", "/")}` === o || /^\*(\/\*)?$/.test(o))
|
|
444
|
+
return !0;
|
|
445
|
+
if (/\/\*/.test(o))
|
|
446
|
+
return h.replace(/\/.*$/, "") === o.replace(/\/.*$/, "");
|
|
447
|
+
if (/\..*/.test(o)) {
|
|
448
|
+
let I = [o];
|
|
449
|
+
return (o === ".jpg" || o === ".jpeg") && (I = [".jpg", ".jpeg"]), I.indexOf(r) > -1;
|
|
450
|
+
}
|
|
451
|
+
return !1;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
return !!e;
|
|
455
|
+
}, Ke = (e, u) => {
|
|
456
|
+
if (!e)
|
|
457
|
+
return;
|
|
458
|
+
let m = [].slice.call(e);
|
|
459
|
+
return u && (m = m.filter((s) => le(s, u))), m;
|
|
460
|
+
}, Me = (e, u, m) => {
|
|
461
|
+
const s = [];
|
|
462
|
+
let t = 0;
|
|
463
|
+
const r = () => {
|
|
464
|
+
!t && m(s);
|
|
465
|
+
}, i = (h) => {
|
|
466
|
+
if (t += 1, h != null && h.isFile) {
|
|
467
|
+
h.file((v) => {
|
|
468
|
+
t -= 1, le(v, u) && (Object.defineProperty(v, "webkitRelativePath", {
|
|
469
|
+
value: h.fullPath.replace(/^\//, "")
|
|
470
|
+
}), s.push(v)), r();
|
|
471
|
+
});
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
if (h != null && h.isDirectory) {
|
|
475
|
+
const v = h.createReader();
|
|
476
|
+
let I = !1;
|
|
477
|
+
const U = () => {
|
|
478
|
+
v.readEntries((w) => {
|
|
479
|
+
I || (t -= 1, I = !0), w.length === 0 ? r() : (U(), w.forEach(i));
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
U();
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
t -= 1, r();
|
|
486
|
+
};
|
|
487
|
+
[].slice.call(e).forEach((h) => {
|
|
488
|
+
h.webkitGetAsEntry && i(h.webkitGetAsEntry());
|
|
489
|
+
});
|
|
490
|
+
}, ze = (e, u) => {
|
|
491
|
+
const m = Y(), { locale: s } = z(W), [t, r] = A(!1), [i, o] = A(0), {
|
|
492
|
+
tip: h,
|
|
493
|
+
children: v,
|
|
494
|
+
disabled: I,
|
|
495
|
+
drag: U,
|
|
496
|
+
listType: w,
|
|
497
|
+
prefixCls: f,
|
|
498
|
+
accept: l,
|
|
499
|
+
multiple: c
|
|
500
|
+
} = e, g = {
|
|
501
|
+
disabled: I
|
|
502
|
+
};
|
|
503
|
+
return G(() => {
|
|
504
|
+
o(0);
|
|
505
|
+
}, [t]), v === null ? null : /* @__PURE__ */ n(
|
|
506
|
+
"div",
|
|
507
|
+
{
|
|
508
|
+
className: `${f}-trigger`,
|
|
509
|
+
onClick: I ? void 0 : e.onClick,
|
|
510
|
+
...m({
|
|
511
|
+
onPressEnter: () => {
|
|
512
|
+
var b;
|
|
513
|
+
!I && ((b = e.onClick) == null || b.call(e));
|
|
514
|
+
}
|
|
515
|
+
}),
|
|
516
|
+
ref: u,
|
|
517
|
+
onDragEnter: () => {
|
|
518
|
+
o(i + 1);
|
|
519
|
+
},
|
|
520
|
+
onDragLeave: (b) => {
|
|
521
|
+
var a;
|
|
522
|
+
b.preventDefault(), i === 0 ? (r(!1), !I && ((a = e.onDragLeave) == null || a.call(e, b))) : o(i - 1);
|
|
523
|
+
},
|
|
524
|
+
onDrop: (b) => {
|
|
525
|
+
var a, E;
|
|
526
|
+
if (b.preventDefault(), !I && e.drag !== !1) {
|
|
527
|
+
if (r(!1), e.directory)
|
|
528
|
+
Me(b.dataTransfer.items, l, (S) => {
|
|
529
|
+
var T;
|
|
530
|
+
(T = e.onDragFiles) == null || T.call(e, S);
|
|
531
|
+
});
|
|
532
|
+
else {
|
|
533
|
+
const S = [].slice.call(b.dataTransfer.items || []).reduce((H, j, B) => {
|
|
534
|
+
if (j.webkitGetAsEntry) {
|
|
535
|
+
const d = j.webkitGetAsEntry();
|
|
536
|
+
return d != null && d.isDirectory ? [...H, B] : H;
|
|
537
|
+
}
|
|
538
|
+
}, []), T = [].slice.call(b.dataTransfer.files || []).filter((H, j) => !S.includes(j)), q = Ke(T, l);
|
|
539
|
+
q.length > 0 && ((a = e.onDragFiles) == null || a.call(e, c ? q : q.slice(0, 1)));
|
|
540
|
+
}
|
|
541
|
+
(E = e.onDrop) == null || E.call(e, b);
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
onDragOver: (b) => {
|
|
545
|
+
var a;
|
|
546
|
+
b.preventDefault(), !I && !t && (r(!0), (a = e.onDragOver) == null || a.call(e, b));
|
|
547
|
+
},
|
|
548
|
+
children: te.isValidElement(v) ? /* @__PURE__ */ n(
|
|
549
|
+
"div",
|
|
550
|
+
{
|
|
551
|
+
className: X({ [`${f}-trigger-custom-active`]: t }),
|
|
552
|
+
children: te.cloneElement(v, g)
|
|
553
|
+
}
|
|
554
|
+
) : w === "picture-card" ? /* @__PURE__ */ n("div", { className: `${f}-trigger-picture-wrapper`, children: /* @__PURE__ */ n(
|
|
555
|
+
"div",
|
|
556
|
+
{
|
|
557
|
+
className: `${f}-trigger-picture`,
|
|
558
|
+
tabIndex: 0,
|
|
559
|
+
"aria-label": s.Upload.upload,
|
|
560
|
+
children: /* @__PURE__ */ n("div", { className: `${f}-trigger-picture-text`, children: e.triggerPictureIcon ?? /* @__PURE__ */ n(de, {}) })
|
|
561
|
+
}
|
|
562
|
+
) }) : U ? /* @__PURE__ */ F(
|
|
563
|
+
"div",
|
|
564
|
+
{
|
|
565
|
+
className: X(`${f}-trigger-drag`, {
|
|
566
|
+
[`${f}-trigger-drag-active`]: t
|
|
567
|
+
}),
|
|
568
|
+
tabIndex: 0,
|
|
569
|
+
"aria-label": s.Upload.drag,
|
|
570
|
+
children: [
|
|
571
|
+
e.triggerPictureIcon ?? /* @__PURE__ */ n(de, {}),
|
|
572
|
+
/* @__PURE__ */ n("p", { className: `${f}-trigger-drag-text`, children: t ? s.Upload.dragHover : s.Upload.drag }),
|
|
573
|
+
h && /* @__PURE__ */ n("div", { className: `${f}-trigger-tip`, children: h })
|
|
574
|
+
]
|
|
575
|
+
}
|
|
576
|
+
) : /* @__PURE__ */ F(
|
|
577
|
+
je,
|
|
578
|
+
{
|
|
579
|
+
...g,
|
|
580
|
+
"aria-label": s.Upload.upload,
|
|
581
|
+
type: "primary",
|
|
582
|
+
className: `${f}-trigger-with-icon`,
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ n(ae, {}),
|
|
585
|
+
s.Upload.upload
|
|
586
|
+
]
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
}
|
|
590
|
+
);
|
|
591
|
+
}, We = Q(
|
|
592
|
+
ze
|
|
593
|
+
);
|
|
594
|
+
function ue(e) {
|
|
595
|
+
const u = e.responseText || e.response;
|
|
596
|
+
if (!u)
|
|
597
|
+
return u;
|
|
598
|
+
try {
|
|
599
|
+
return JSON.parse(u);
|
|
600
|
+
} catch {
|
|
601
|
+
return u;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
const Je = function(e) {
|
|
605
|
+
const {
|
|
606
|
+
onProgress: u = p,
|
|
607
|
+
onError: m = p,
|
|
608
|
+
onSuccess: s = p,
|
|
609
|
+
action: t,
|
|
610
|
+
method: r,
|
|
611
|
+
headers: i = {},
|
|
612
|
+
name: o,
|
|
613
|
+
file: h,
|
|
614
|
+
data: v = {},
|
|
615
|
+
withCredentials: I = !1
|
|
616
|
+
} = e;
|
|
617
|
+
function U(g) {
|
|
618
|
+
return typeof g == "function" ? g(h) : g;
|
|
619
|
+
}
|
|
620
|
+
const w = U(o), f = U(v), l = new XMLHttpRequest();
|
|
621
|
+
u && l.upload && (l.upload.onprogress = function(g) {
|
|
622
|
+
let b;
|
|
623
|
+
g.total > 0 && (b = g.loaded / g.total * 100), u(parseInt(b, 10), g);
|
|
624
|
+
}), l.onerror = function(b) {
|
|
625
|
+
m(b);
|
|
626
|
+
}, l.onload = function() {
|
|
627
|
+
if (l.status < 200 || l.status >= 300)
|
|
628
|
+
return m(ue(l));
|
|
629
|
+
s(ue(l));
|
|
630
|
+
};
|
|
631
|
+
const c = new FormData();
|
|
632
|
+
f && Object.keys(f).map((g) => c.append(g, f[g])), c.append(w || "file", h), l.open(r, t, !0), I && "withCredentials" in l && (l.withCredentials = !0);
|
|
633
|
+
for (const g in i)
|
|
634
|
+
Object.prototype.hasOwnProperty.call(i, g) && i[g] !== null && l.setRequestHeader(g, i[g]);
|
|
635
|
+
return l.send(c), {
|
|
636
|
+
abort() {
|
|
637
|
+
l.abort();
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
};
|
|
641
|
+
function Xe(e, u) {
|
|
642
|
+
z(W);
|
|
643
|
+
const m = ie(null), [s, t] = A({ uploadRequests: {} });
|
|
644
|
+
function r(d) {
|
|
645
|
+
U(d);
|
|
646
|
+
}
|
|
647
|
+
function i(d) {
|
|
648
|
+
var N;
|
|
649
|
+
const x = s.uploadRequests[d.uid];
|
|
650
|
+
x && ((N = x.abort) == null || N.call(x), v({
|
|
651
|
+
...d,
|
|
652
|
+
status: $.fail
|
|
653
|
+
}), h(d.uid));
|
|
654
|
+
}
|
|
655
|
+
function o(d) {
|
|
656
|
+
U({
|
|
657
|
+
...d,
|
|
658
|
+
percent: 0,
|
|
659
|
+
status: $.uploading
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
function h(d) {
|
|
663
|
+
const x = { ...s.uploadRequests };
|
|
664
|
+
delete x[d], t({
|
|
665
|
+
uploadRequests: x
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
fe(u, () => ({
|
|
669
|
+
// 提供 ref 调用
|
|
670
|
+
upload: r,
|
|
671
|
+
abort: i,
|
|
672
|
+
reupload: o,
|
|
673
|
+
// 删除上传(手动上传时,文件会出现在上传列表,但属于init状态)
|
|
674
|
+
delete: h
|
|
675
|
+
}));
|
|
676
|
+
function v(d, x = e.fileList) {
|
|
677
|
+
const { onFileStatusChange: N } = e, L = "uid" in d ? "uid" : "name";
|
|
678
|
+
N == null || N(
|
|
679
|
+
x.map((y) => y[L] === d[L] ? d : y),
|
|
680
|
+
d
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
function I(d) {
|
|
684
|
+
const x = "uid" in d ? "uid" : "name";
|
|
685
|
+
return e.fileList.find((L) => L[x] === d[x]);
|
|
686
|
+
}
|
|
687
|
+
async function U(d) {
|
|
688
|
+
const {
|
|
689
|
+
action: x,
|
|
690
|
+
headers: N,
|
|
691
|
+
name: L,
|
|
692
|
+
data: y,
|
|
693
|
+
withCredentials: C,
|
|
694
|
+
customRequest: P,
|
|
695
|
+
method: R
|
|
696
|
+
} = e, oe = {
|
|
697
|
+
onProgress: (K, D) => {
|
|
698
|
+
var se;
|
|
699
|
+
const J = I(d);
|
|
700
|
+
J && (J.status = $.uploading, J.percent = K, (se = e == null ? void 0 : e.onProgress) == null || se.call(e, J, D));
|
|
701
|
+
},
|
|
702
|
+
onSuccess: (K) => {
|
|
703
|
+
const D = I(d);
|
|
704
|
+
D && (D.status = $.success, D.response = K, v(D)), h(d.uid);
|
|
705
|
+
},
|
|
706
|
+
onError: (K) => {
|
|
707
|
+
const D = I(d);
|
|
708
|
+
D && (D.status = $.fail, D.response = K, v(D)), h(d.uid);
|
|
709
|
+
},
|
|
710
|
+
headers: N,
|
|
711
|
+
name: L,
|
|
712
|
+
file: d.originFile,
|
|
713
|
+
data: y,
|
|
714
|
+
withCredentials: C
|
|
715
|
+
};
|
|
716
|
+
v(d);
|
|
717
|
+
let Z;
|
|
718
|
+
P ? Z = await P(oe) : x && (Z = Je({ ...oe, action: x, method: R })), t({
|
|
719
|
+
uploadRequests: {
|
|
720
|
+
...s.uploadRequests,
|
|
721
|
+
[d.uid]: Z
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
function w(d) {
|
|
726
|
+
const { limit: x, fileList: N, onExceedLimit: L, autoUpload: y } = e;
|
|
727
|
+
if (me(x) && x < N.length + d.length)
|
|
728
|
+
return L == null ? void 0 : L(d, N);
|
|
729
|
+
const C = (P, R) => {
|
|
730
|
+
const O = e.fileList || [], V = {
|
|
731
|
+
uid: `${String(+/* @__PURE__ */ new Date())}${R}`,
|
|
732
|
+
originFile: P,
|
|
733
|
+
percent: 0,
|
|
734
|
+
status: $.init,
|
|
735
|
+
name: P.name
|
|
736
|
+
};
|
|
737
|
+
v(V), O.push(V), v(V, O), y && setTimeout(() => {
|
|
738
|
+
U({
|
|
739
|
+
...V,
|
|
740
|
+
status: $.uploading
|
|
741
|
+
});
|
|
742
|
+
}, 0);
|
|
743
|
+
};
|
|
744
|
+
d.forEach((P, R) => {
|
|
745
|
+
le(P, e.accept) && (k(e.beforeUpload) ? Promise.resolve(e.beforeUpload(P, d)).then((O) => {
|
|
746
|
+
if (O !== !1) {
|
|
747
|
+
const V = qe(O) ? O : P;
|
|
748
|
+
C(V, R);
|
|
749
|
+
}
|
|
750
|
+
}).catch((O) => {
|
|
751
|
+
console.error(O);
|
|
752
|
+
}) : C(P, R));
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
const {
|
|
756
|
+
accept: f,
|
|
757
|
+
multiple: l,
|
|
758
|
+
children: c,
|
|
759
|
+
prefixCls: g,
|
|
760
|
+
tip: b,
|
|
761
|
+
disabled: a,
|
|
762
|
+
drag: E,
|
|
763
|
+
listType: S,
|
|
764
|
+
hide: T,
|
|
765
|
+
directory: q,
|
|
766
|
+
onDrop: H,
|
|
767
|
+
onDragOver: j,
|
|
768
|
+
onDragLeave: B
|
|
769
|
+
} = e;
|
|
770
|
+
return /* @__PURE__ */ F(M, { children: [
|
|
771
|
+
/* @__PURE__ */ n(
|
|
772
|
+
"input",
|
|
773
|
+
{
|
|
774
|
+
ref: m,
|
|
775
|
+
style: {
|
|
776
|
+
visibility: "hidden",
|
|
777
|
+
opacity: 0,
|
|
778
|
+
position: "fixed",
|
|
779
|
+
top: "-227px",
|
|
780
|
+
left: "-227px",
|
|
781
|
+
zIndex: -999999
|
|
782
|
+
},
|
|
783
|
+
type: "file",
|
|
784
|
+
accept: _(f) ? f == null ? void 0 : f.type : f,
|
|
785
|
+
multiple: l,
|
|
786
|
+
...q ? { webkitdirectory: "true" } : {},
|
|
787
|
+
onChange: (d) => {
|
|
788
|
+
const x = d.target.files;
|
|
789
|
+
x && (w([].slice.call(x)), m.current.value = "");
|
|
790
|
+
},
|
|
791
|
+
onClick: (d) => {
|
|
792
|
+
d.stopPropagation();
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
"trigger-input"
|
|
796
|
+
),
|
|
797
|
+
/* @__PURE__ */ n(
|
|
798
|
+
ne,
|
|
799
|
+
{
|
|
800
|
+
in: !T,
|
|
801
|
+
timeout: 100,
|
|
802
|
+
unmountOnExit: !0,
|
|
803
|
+
classNames: "fadeIn",
|
|
804
|
+
children: /* @__PURE__ */ n(
|
|
805
|
+
We,
|
|
806
|
+
{
|
|
807
|
+
directory: q,
|
|
808
|
+
tip: b,
|
|
809
|
+
multiple: l,
|
|
810
|
+
accept: f,
|
|
811
|
+
disabled: a,
|
|
812
|
+
drag: E,
|
|
813
|
+
listType: S,
|
|
814
|
+
triggerPictureIcon: e.triggerPictureIcon,
|
|
815
|
+
onDrop: H,
|
|
816
|
+
onDragOver: j,
|
|
817
|
+
onDragLeave: B,
|
|
818
|
+
onDragFiles: w,
|
|
819
|
+
onClick: () => {
|
|
820
|
+
var d, x;
|
|
821
|
+
!a && ((x = (d = m.current) == null ? void 0 : d.click) == null || x.call(d));
|
|
822
|
+
},
|
|
823
|
+
prefixCls: g,
|
|
824
|
+
children: k(c) ? c({ fileList: e.fileList }) : c
|
|
825
|
+
}
|
|
826
|
+
)
|
|
827
|
+
},
|
|
828
|
+
"trigger-node"
|
|
829
|
+
),
|
|
830
|
+
b && S !== "picture-card" && !E ? /* @__PURE__ */ n("div", { className: `${g}-trigger-tip`, children: b }, "trigger-tip") : null
|
|
831
|
+
] });
|
|
832
|
+
}
|
|
833
|
+
const Qe = te.forwardRef(Xe), ee = function(e) {
|
|
834
|
+
const u = [].concat(e || []).filter(Boolean);
|
|
835
|
+
return u.reduce((m, s, t) => {
|
|
836
|
+
if (s.uid) {
|
|
837
|
+
const r = u.findIndex(
|
|
838
|
+
(o) => s.uid === o.uid && s !== o
|
|
839
|
+
);
|
|
840
|
+
ce(r !== -1, "[Upload]: duplicate uid");
|
|
841
|
+
const i = {
|
|
842
|
+
status: $.success,
|
|
843
|
+
percent: 100,
|
|
844
|
+
...s
|
|
845
|
+
};
|
|
846
|
+
r === -1 ? m.push(i) : m.splice(r, 1, i);
|
|
847
|
+
} else {
|
|
848
|
+
ce(!0, "[Upload]: uid is required");
|
|
849
|
+
const r = `${String(+/* @__PURE__ */ new Date())}${t}`;
|
|
850
|
+
m.push({
|
|
851
|
+
uid: r,
|
|
852
|
+
status: $.success,
|
|
853
|
+
percent: 100,
|
|
854
|
+
...s
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
return m;
|
|
858
|
+
}, []);
|
|
859
|
+
}, Ye = {
|
|
860
|
+
listType: "text",
|
|
861
|
+
autoUpload: !0,
|
|
862
|
+
showUploadList: !0,
|
|
863
|
+
beforeUpload: () => !0,
|
|
864
|
+
method: "post"
|
|
865
|
+
}, Ze = (e, u) => {
|
|
866
|
+
const { getPrefixCls: m, componentConfig: s, rtl: t } = z(W), r = xe(
|
|
867
|
+
e,
|
|
868
|
+
Ye,
|
|
869
|
+
s == null ? void 0 : s.Upload
|
|
870
|
+
), i = m("upload"), o = ie(), h = ie(), [v, I] = A(() => "fileList" in r ? ee(r.fileList) : "defaultFileList" in r ? ee(r.defaultFileList) : []), U = "fileList" in r ? ee(r.fileList) : v, w = (y, C) => {
|
|
871
|
+
var P;
|
|
872
|
+
"fileList" in r || I(y), (P = r.onChange) == null || P.call(r, y, C);
|
|
873
|
+
}, f = (y) => {
|
|
874
|
+
y && setTimeout(() => {
|
|
875
|
+
o.current && o.current.upload(y);
|
|
876
|
+
}, 0);
|
|
877
|
+
}, l = (y) => {
|
|
878
|
+
var C;
|
|
879
|
+
o.current && o.current.reupload(y), (C = r.onReupload) == null || C.call(r, y);
|
|
880
|
+
}, c = (y) => {
|
|
881
|
+
if (y) {
|
|
882
|
+
const { onRemove: C } = r;
|
|
883
|
+
Promise.resolve(
|
|
884
|
+
k(C) ? C(y, U) : C
|
|
885
|
+
).then((P) => {
|
|
886
|
+
P !== !1 && (o.current && o.current.abort(y), w(
|
|
887
|
+
U.filter((R) => R.uid !== y.uid),
|
|
888
|
+
y
|
|
889
|
+
));
|
|
890
|
+
}).catch((P) => {
|
|
891
|
+
console.error(P);
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
}, g = (y) => {
|
|
895
|
+
y && o.current && o.current.abort(y);
|
|
896
|
+
};
|
|
897
|
+
fe(u, () => ({
|
|
898
|
+
submit: (y) => {
|
|
899
|
+
let C = [];
|
|
900
|
+
y ? C = [y] : C = U.filter((P) => P.status === $.init), C.forEach((P) => {
|
|
901
|
+
f(P);
|
|
902
|
+
});
|
|
903
|
+
},
|
|
904
|
+
// file: fileList中的file对象
|
|
905
|
+
abort: (y) => {
|
|
906
|
+
g(y);
|
|
907
|
+
},
|
|
908
|
+
// file: fileList中的file对象
|
|
909
|
+
reupload: (y) => {
|
|
910
|
+
l(y);
|
|
911
|
+
},
|
|
912
|
+
getRootDOMNode: () => h.current
|
|
913
|
+
}));
|
|
914
|
+
const {
|
|
915
|
+
listType: b,
|
|
916
|
+
className: a,
|
|
917
|
+
style: E,
|
|
918
|
+
renderUploadItem: S,
|
|
919
|
+
showUploadList: T,
|
|
920
|
+
renderUploadList: q,
|
|
921
|
+
progressProps: H,
|
|
922
|
+
imagePreview: j,
|
|
923
|
+
...B
|
|
924
|
+
} = r, d = me(r.limit) ? { hideOnExceedLimit: !0, maxCount: r.limit } : { hideOnExceedLimit: !0, ...r.limit }, x = d.maxCount && d.maxCount <= U.length, N = "disabled" in r ? r.disabled : !d.hideOnExceedLimit && x, L = /* @__PURE__ */ n(
|
|
925
|
+
"div",
|
|
926
|
+
{
|
|
927
|
+
...$e(B, [
|
|
928
|
+
"disabled",
|
|
929
|
+
"directory",
|
|
930
|
+
"onReupload",
|
|
931
|
+
"defaultFileList",
|
|
932
|
+
"fileList",
|
|
933
|
+
"autoUpload",
|
|
934
|
+
"error",
|
|
935
|
+
"action",
|
|
936
|
+
"method",
|
|
937
|
+
"multiple",
|
|
938
|
+
"name",
|
|
939
|
+
"accept",
|
|
940
|
+
"customRequest",
|
|
941
|
+
"children",
|
|
942
|
+
"autoUpload",
|
|
943
|
+
"limit",
|
|
944
|
+
"drag",
|
|
945
|
+
"tip",
|
|
946
|
+
"headers",
|
|
947
|
+
"data",
|
|
948
|
+
"withCredentials",
|
|
949
|
+
"onChange",
|
|
950
|
+
"onPreview",
|
|
951
|
+
"onRemove",
|
|
952
|
+
"onProgress",
|
|
953
|
+
"onExceedLimit",
|
|
954
|
+
"beforeUpload",
|
|
955
|
+
"onDrop",
|
|
956
|
+
"onDragOver",
|
|
957
|
+
"onDragLeave"
|
|
958
|
+
]),
|
|
959
|
+
className: X(
|
|
960
|
+
i,
|
|
961
|
+
{
|
|
962
|
+
[`${i}-type-${b}`]: b,
|
|
963
|
+
[`${i}-drag`]: r.drag,
|
|
964
|
+
[`${i}-disabled`]: N,
|
|
965
|
+
[`${i}-hide`]: d.hideOnExceedLimit && x,
|
|
966
|
+
[`${i}-rtl`]: t
|
|
967
|
+
},
|
|
968
|
+
a
|
|
969
|
+
),
|
|
970
|
+
style: E,
|
|
971
|
+
ref: h,
|
|
972
|
+
children: /* @__PURE__ */ n(
|
|
973
|
+
Qe,
|
|
974
|
+
{
|
|
975
|
+
ref: o,
|
|
976
|
+
...r,
|
|
977
|
+
limit: d.maxCount,
|
|
978
|
+
hide: d.hideOnExceedLimit && x,
|
|
979
|
+
disabled: N,
|
|
980
|
+
prefixCls: i,
|
|
981
|
+
fileList: U,
|
|
982
|
+
onProgress: (y, C) => {
|
|
983
|
+
var P;
|
|
984
|
+
y && ("fileList" in r || I(
|
|
985
|
+
U.map((R) => R.uid === y.uid ? y : R)
|
|
986
|
+
), (P = r.onProgress) == null || P.call(r, y, C));
|
|
987
|
+
},
|
|
988
|
+
onFileStatusChange: w
|
|
989
|
+
}
|
|
990
|
+
)
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
return /* @__PURE__ */ F(M, { children: [
|
|
994
|
+
b !== "picture-card" && L,
|
|
995
|
+
T && /* @__PURE__ */ n(
|
|
996
|
+
ye,
|
|
997
|
+
{
|
|
998
|
+
imagePreview: j,
|
|
999
|
+
progressProps: H,
|
|
1000
|
+
showUploadList: T,
|
|
1001
|
+
disabled: r.disabled,
|
|
1002
|
+
listType: b,
|
|
1003
|
+
fileList: U,
|
|
1004
|
+
renderUploadItem: S,
|
|
1005
|
+
renderUploadList: q,
|
|
1006
|
+
onUpload: f,
|
|
1007
|
+
onAbort: g,
|
|
1008
|
+
onRemove: c,
|
|
1009
|
+
onReupload: l,
|
|
1010
|
+
onPreview: r.onPreview,
|
|
1011
|
+
prefixCls: i
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
1014
|
+
b === "picture-card" && L,
|
|
1015
|
+
r.tip && b === "picture-card" && /* @__PURE__ */ n("div", { className: `${i}-trigger-tip`, children: r.tip })
|
|
1016
|
+
] });
|
|
1017
|
+
}, pe = Q(
|
|
1018
|
+
Ze
|
|
1019
|
+
);
|
|
1020
|
+
pe.displayName = "Upload";
|
|
1021
|
+
export {
|
|
1022
|
+
ye as F,
|
|
1023
|
+
$ as S,
|
|
1024
|
+
pe as U
|
|
1025
|
+
};
|