@wfrog/vc-ui 1.11.9 → 1.11.11
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/dist/es/chunk/Bw0Rhd-r.mjs +110 -0
- package/dist/es/chunk/CqTdDZkE.mjs +31 -0
- package/dist/es/chunk/{DAnWZLYj.mjs → CzWfBa_8.mjs} +96 -2
- package/dist/es/chunk/D229kQ56.mjs +28 -0
- package/dist/es/chunk/{Cxx_YWUC.mjs → DcouM6gM.mjs} +6 -548
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/KanuIcmc.mjs +412 -0
- package/dist/es/chunk/{B71xEPfK.mjs → uuUHUjSk.mjs} +4 -35
- package/dist/es/components/backbottom/backbottom.mjs +3 -2
- package/dist/es/components/button/button.mjs +4 -5
- package/dist/es/components/choice/choice.mjs +4 -4
- package/dist/es/components/choice/index.css +1 -1
- package/dist/es/components/color-switch/color-switch.mjs +73 -1046
- package/dist/es/components/color-switch/index.css +1 -1
- package/dist/es/components/cropper/cropper.mjs +11 -117
- package/dist/es/components/cropper/index.css +1 -1
- package/dist/es/components/currency/currency.mjs +4 -5
- package/dist/es/components/daterange-picker/daterange-picker.mjs +8 -6253
- package/dist/es/components/dialog/dialog.mjs +7 -400
- package/dist/es/components/dialog/index.css +1 -1
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +10 -11
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +4 -3
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +9 -1374
- package/dist/es/components/dialog-upload-images/index.css +1 -1
- package/dist/es/components/drag-verify/drag-verify.mjs +3 -2
- package/dist/es/components/drawer/drawer.mjs +10 -352
- package/dist/es/components/drawer/index.css +1 -1
- package/dist/es/components/easy-pagination/easy-pagination.mjs +3 -2
- package/dist/es/components/explorer/explorer.mjs +3 -3
- package/dist/es/components/explorer-column-table/explorer-column-table.mjs +5 -7
- package/dist/es/components/explorer-column-table/index.css +1 -1
- package/dist/es/components/explorer-container/explorer-container.d.ts +1 -1
- package/dist/es/components/explorer-container/explorer-container.mjs +4 -3
- package/dist/es/components/explorer-filter/explorer-filter.mjs +5 -4
- package/dist/es/components/explorer-footer/explorer-footer.mjs +4 -8
- package/dist/es/components/explorer-form/explorer-form.mjs +4 -3
- package/dist/es/components/explorer-list/explorer-list.mjs +5 -4
- package/dist/es/components/explorer-modal-form/explorer-modal-form.mjs +4 -3
- package/dist/es/components/explorer-panel/explorer-panel.mjs +3 -3
- package/dist/es/components/explorer-query/explorer-query.mjs +9 -2201
- package/dist/es/components/explorer-query/index.css +1 -1
- package/dist/es/components/explorer-table/explorer-table.mjs +20 -24
- package/dist/es/components/explorer-table/index.css +16 -9
- package/dist/es/components/explorer-tools/explorer-tools.mjs +13 -264
- package/dist/es/components/explorer-tools/index.css +1 -1
- package/dist/es/components/explorer-tree/explorer-tree.mjs +4 -5
- package/dist/es/components/icon-picker/icon-picker.mjs +8 -12
- package/dist/es/components/image/image.mjs +4 -4
- package/dist/es/components/info-tooltip/info-tooltip.mjs +336 -4
- package/dist/es/components/input/input.mjs +3 -2
- package/dist/es/components/input-number/input-number.mjs +3 -3
- package/dist/es/components/pca-picker/index.css +1 -1
- package/dist/es/components/pca-picker/pca-picker.mjs +443 -601
- package/dist/es/components/screenfull/screenfull.mjs +4 -3
- package/dist/es/components/scrollbar/scrollbar.mjs +3 -2
- package/dist/es/components/select/select.mjs +3 -5
- package/dist/es/components/single-player/index.css +1 -1
- package/dist/es/components/single-player/single-player.mjs +10 -1087
- package/dist/es/components/splitter/splitter.mjs +3 -3
- package/dist/es/components/splitter-panel/splitter-panel.mjs +3 -3
- package/dist/es/components/switch/index.css +1 -1
- package/dist/es/components/switch/switch.mjs +9 -395
- package/dist/es/components/tags/tags.mjs +7 -9
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +3 -3
- package/dist/es/components/thousand-input/thousand-input.mjs +33 -1
- package/dist/es/components/tinymce/tinymce.mjs +4 -3
- package/dist/es/components/transfer/transfer.mjs +3 -4
- package/dist/es/components/transfer-panel/transfer-panel.mjs +5 -4
- package/dist/es/components/tree-picker/popover-cascader.css +1 -1
- package/dist/es/components/tree-picker/tree-picker.mjs +5 -10
- package/dist/es/index.mjs +1 -1
- package/dist/index.css +29 -49
- package/package.json +1 -1
- package/dist/es/chunk/B-rxnVJv.mjs +0 -3
- package/dist/es/chunk/B5HpgPRt.mjs +0 -69
- package/dist/es/chunk/BBhZKpIc.mjs +0 -2179
- package/dist/es/chunk/BDcsaNYa.mjs +0 -59
- package/dist/es/chunk/BTSSEFfD.mjs +0 -319
- package/dist/es/chunk/BTpNRPQW.mjs +0 -55
- package/dist/es/chunk/BVBK1U57.mjs +0 -96
- package/dist/es/chunk/Bc6yUGLs.mjs +0 -45
- package/dist/es/chunk/BjVI1XMz.mjs +0 -40
- package/dist/es/chunk/BlzQCBDu.mjs +0 -5741
- package/dist/es/chunk/BpJKnxlF.mjs +0 -476
- package/dist/es/chunk/Brp-qSBw.mjs +0 -2003
- package/dist/es/chunk/BunQI8Jb.mjs +0 -390
- package/dist/es/chunk/C0XgBrDz.mjs +0 -775
- package/dist/es/chunk/C0pTANRX.mjs +0 -109
- package/dist/es/chunk/CBMjhoFP.mjs +0 -101
- package/dist/es/chunk/CBiNtNvQ.mjs +0 -242
- package/dist/es/chunk/CBlJeNBO.mjs +0 -890
- package/dist/es/chunk/CCVL_Zj-.mjs +0 -427
- package/dist/es/chunk/CEl4MyfJ.mjs +0 -252
- package/dist/es/chunk/CJK5_jsA.mjs +0 -53
- package/dist/es/chunk/CKOcwq5V.mjs +0 -44
- package/dist/es/chunk/COs9dJZa.mjs +0 -66
- package/dist/es/chunk/CPt6MxJW.mjs +0 -375
- package/dist/es/chunk/CVqW0jzp.mjs +0 -107
- package/dist/es/chunk/CccIsEqA.mjs +0 -128
- package/dist/es/chunk/CjLR27-a.mjs +0 -582
- package/dist/es/chunk/CoGexPPD.mjs +0 -2192
- package/dist/es/chunk/CsLIbnzG.mjs +0 -64
- package/dist/es/chunk/Ct6q2FXg.mjs +0 -5
- package/dist/es/chunk/Cuq5meQh.mjs +0 -184
- package/dist/es/chunk/CvYIOfT1.mjs +0 -23
- package/dist/es/chunk/CxHJBf4l.mjs +0 -31
- package/dist/es/chunk/CzdaOBtA.mjs +0 -66
- package/dist/es/chunk/D0QTifnI.mjs +0 -54
- package/dist/es/chunk/D1QnA2iT.mjs +0 -229
- package/dist/es/chunk/D3AvJlVX.mjs +0 -188
- package/dist/es/chunk/D9Lr0Bzb.mjs +0 -1136
- package/dist/es/chunk/DCkPv0hy.mjs +0 -29
- package/dist/es/chunk/DRwwUUhy.mjs +0 -49
- package/dist/es/chunk/DX-2VRY2.mjs +0 -836
- package/dist/es/chunk/DZ2oTFad.mjs +0 -687
- package/dist/es/chunk/D_bou1py.mjs +0 -55
- package/dist/es/chunk/Da199A5L.mjs +0 -314
- package/dist/es/chunk/DbhQlaOz.mjs +0 -94
- package/dist/es/chunk/Dgu95mOy.mjs +0 -237
- package/dist/es/chunk/DhGOsWxx.mjs +0 -6
- package/dist/es/chunk/Dm_Sj5aH.mjs +0 -487
- package/dist/es/chunk/Dmi-1GRO.mjs +0 -163
- package/dist/es/chunk/DodoD9a9.mjs +0 -52
- package/dist/es/chunk/DrrVDcwm.mjs +0 -955
- package/dist/es/chunk/Du_zJ1Fz.mjs +0 -49
- package/dist/es/chunk/DxxbB5jY.mjs +0 -34
- package/dist/es/chunk/Gk1J52Yw.mjs +0 -207
- package/dist/es/chunk/NsldgdCh.mjs +0 -704
- package/dist/es/chunk/V6KjsUQN.mjs +0 -35
- package/dist/es/chunk/eEsLFV3s.mjs +0 -76
- package/dist/es/chunk/fqiLhk0V.mjs +0 -2065
- package/dist/es/chunk/nxVM7re4.mjs +0 -35
- package/dist/es/chunk/s7HLrANj.mjs +0 -215
- package/dist/es/chunk/vPhxogl3.mjs +0 -19
- package/dist/es/components/icon/icon2.mjs +0 -27
|
@@ -1,1379 +1,14 @@
|
|
|
1
1
|
import './index.css'
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { ElUpload, ElLoadingDirective, ElButton } from 'element-plus/es';
|
|
3
|
+
import 'element-plus/es/components/base/style/css';
|
|
4
|
+
import 'element-plus/es/components/loading/style/css';
|
|
5
|
+
import 'element-plus/es/components/button/style/css';
|
|
6
|
+
import 'element-plus/es/components/upload/style/css';
|
|
7
|
+
import { defineComponent, ref, computed, watch, onBeforeUnmount, createBlock, openBlock, mergeProps, unref, isRef, withCtx, createVNode, normalizeClass, withDirectives, createElementBlock, Fragment, renderList, createElementVNode, createTextVNode } from 'vue';
|
|
6
8
|
import { VueDraggable } from 'vue-draggable-plus';
|
|
7
9
|
import { C as Component$1 } from '../dialog/dialog.mjs';
|
|
8
10
|
import { C as Component$2 } from '../el-icon/el-icon.mjs';
|
|
9
|
-
import {
|
|
10
|
-
import { WarningFilled, CircleCheck, CircleClose, Check, Close, Document, ZoomIn, Delete } from '@element-plus/icons-vue';
|
|
11
|
-
import { _ as _export_sfc, w as withInstall } from '../../chunk/V6KjsUQN.mjs';
|
|
12
|
-
import { i as isNil } from '../../chunk/Bc6yUGLs.mjs';
|
|
13
|
-
import { m as mutable } from '../../chunk/B-rxnVJv.mjs';
|
|
14
|
-
import { u as useLocale } from '../../chunk/CEl4MyfJ.mjs';
|
|
15
|
-
import { a as useFormDisabled } from '../../chunk/CBMjhoFP.mjs';
|
|
16
|
-
import { f as flatten } from '../../chunk/BunQI8Jb.mjs';
|
|
17
|
-
import { e as entriesOf } from '../../chunk/Du_zJ1Fz.mjs';
|
|
18
|
-
import { c as cloneDeep } from '../../chunk/DCkPv0hy.mjs';
|
|
19
|
-
import { i as isEqual } from '../../chunk/B71xEPfK.mjs';
|
|
20
|
-
import { useVModel } from '@vueuse/core';
|
|
21
|
-
import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
|
|
22
|
-
|
|
23
|
-
const progressProps = buildProps({
|
|
24
|
-
type: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: "line",
|
|
27
|
-
values: ["line", "circle", "dashboard"]
|
|
28
|
-
},
|
|
29
|
-
percentage: {
|
|
30
|
-
type: Number,
|
|
31
|
-
default: 0,
|
|
32
|
-
validator: (val) => val >= 0 && val <= 100
|
|
33
|
-
},
|
|
34
|
-
status: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: "",
|
|
37
|
-
values: ["", "success", "exception", "warning"]
|
|
38
|
-
},
|
|
39
|
-
indeterminate: Boolean,
|
|
40
|
-
duration: {
|
|
41
|
-
type: Number,
|
|
42
|
-
default: 3
|
|
43
|
-
},
|
|
44
|
-
strokeWidth: {
|
|
45
|
-
type: Number,
|
|
46
|
-
default: 6
|
|
47
|
-
},
|
|
48
|
-
strokeLinecap: {
|
|
49
|
-
type: definePropType(String),
|
|
50
|
-
default: "round"
|
|
51
|
-
},
|
|
52
|
-
textInside: Boolean,
|
|
53
|
-
width: {
|
|
54
|
-
type: Number,
|
|
55
|
-
default: 126
|
|
56
|
-
},
|
|
57
|
-
showText: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: true
|
|
60
|
-
},
|
|
61
|
-
color: {
|
|
62
|
-
type: definePropType([
|
|
63
|
-
String,
|
|
64
|
-
Array,
|
|
65
|
-
Function
|
|
66
|
-
]),
|
|
67
|
-
default: ""
|
|
68
|
-
},
|
|
69
|
-
striped: Boolean,
|
|
70
|
-
stripedFlow: Boolean,
|
|
71
|
-
format: {
|
|
72
|
-
type: definePropType(Function),
|
|
73
|
-
default: (percentage) => `${percentage}%`
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const _hoisted_1$3 = ["aria-valuenow"];
|
|
78
|
-
const _hoisted_2$2 = { viewBox: "0 0 100 100" };
|
|
79
|
-
const _hoisted_3$1 = ["d", "stroke", "stroke-linecap", "stroke-width"];
|
|
80
|
-
const _hoisted_4$1 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
|
|
81
|
-
const _hoisted_5$1 = { key: 0 };
|
|
82
|
-
const _sfc_main$5 = defineComponent({
|
|
83
|
-
...{
|
|
84
|
-
name: "ElProgress"
|
|
85
|
-
},
|
|
86
|
-
__name: "progress",
|
|
87
|
-
props: progressProps,
|
|
88
|
-
setup(__props) {
|
|
89
|
-
const STATUS_COLOR_MAP = {
|
|
90
|
-
success: "#13ce66",
|
|
91
|
-
exception: "#ff4949",
|
|
92
|
-
warning: "#e6a23c",
|
|
93
|
-
default: "#20a0ff"
|
|
94
|
-
};
|
|
95
|
-
const props = __props;
|
|
96
|
-
const ns = useNamespace("progress");
|
|
97
|
-
const barStyle = computed(() => {
|
|
98
|
-
const barStyle2 = {
|
|
99
|
-
width: `${props.percentage}%`,
|
|
100
|
-
animationDuration: `${props.duration}s`
|
|
101
|
-
};
|
|
102
|
-
const color = getCurrentColor(props.percentage);
|
|
103
|
-
if (color.includes("gradient")) {
|
|
104
|
-
barStyle2.background = color;
|
|
105
|
-
} else {
|
|
106
|
-
barStyle2.backgroundColor = color;
|
|
107
|
-
}
|
|
108
|
-
return barStyle2;
|
|
109
|
-
});
|
|
110
|
-
const relativeStrokeWidth = computed(
|
|
111
|
-
() => (props.strokeWidth / props.width * 100).toFixed(1)
|
|
112
|
-
);
|
|
113
|
-
const radius = computed(() => {
|
|
114
|
-
if (["circle", "dashboard"].includes(props.type)) {
|
|
115
|
-
return Number.parseInt(
|
|
116
|
-
`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`,
|
|
117
|
-
10
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
return 0;
|
|
121
|
-
});
|
|
122
|
-
const trackPath = computed(() => {
|
|
123
|
-
const r = radius.value;
|
|
124
|
-
const isDashboard = props.type === "dashboard";
|
|
125
|
-
return `
|
|
126
|
-
M 50 50
|
|
127
|
-
m 0 ${isDashboard ? "" : "-"}${r}
|
|
128
|
-
a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
|
|
129
|
-
a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
|
|
130
|
-
`;
|
|
131
|
-
});
|
|
132
|
-
const perimeter = computed(() => 2 * Math.PI * radius.value);
|
|
133
|
-
const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
|
|
134
|
-
const strokeDashoffset = computed(() => {
|
|
135
|
-
const offset = -1 * perimeter.value * (1 - rate.value) / 2;
|
|
136
|
-
return `${offset}px`;
|
|
137
|
-
});
|
|
138
|
-
const trailPathStyle = computed(() => ({
|
|
139
|
-
strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
|
|
140
|
-
strokeDashoffset: strokeDashoffset.value
|
|
141
|
-
}));
|
|
142
|
-
const circlePathStyle = computed(() => ({
|
|
143
|
-
strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
|
|
144
|
-
strokeDashoffset: strokeDashoffset.value,
|
|
145
|
-
transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
|
|
146
|
-
}));
|
|
147
|
-
const stroke = computed(() => {
|
|
148
|
-
let ret;
|
|
149
|
-
if (props.color) {
|
|
150
|
-
ret = getCurrentColor(props.percentage);
|
|
151
|
-
} else {
|
|
152
|
-
ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
|
|
153
|
-
}
|
|
154
|
-
return ret;
|
|
155
|
-
});
|
|
156
|
-
const statusIcon = computed(() => {
|
|
157
|
-
if (props.status === "warning") {
|
|
158
|
-
return WarningFilled;
|
|
159
|
-
}
|
|
160
|
-
if (props.type === "line") {
|
|
161
|
-
return props.status === "success" ? CircleCheck : CircleClose;
|
|
162
|
-
} else {
|
|
163
|
-
return props.status === "success" ? Check : Close;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
const progressTextSize = computed(() => {
|
|
167
|
-
return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
|
|
168
|
-
});
|
|
169
|
-
const content = computed(() => props.format(props.percentage));
|
|
170
|
-
function getColors(color) {
|
|
171
|
-
const span = 100 / color.length;
|
|
172
|
-
const seriesColors = color.map((seriesColor, index) => {
|
|
173
|
-
if (isString(seriesColor)) {
|
|
174
|
-
return {
|
|
175
|
-
color: seriesColor,
|
|
176
|
-
percentage: (index + 1) * span
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
return seriesColor;
|
|
180
|
-
});
|
|
181
|
-
return seriesColors.sort((a, b) => a.percentage - b.percentage);
|
|
182
|
-
}
|
|
183
|
-
const getCurrentColor = (percentage) => {
|
|
184
|
-
var _a;
|
|
185
|
-
const { color } = props;
|
|
186
|
-
if (isFunction(color)) {
|
|
187
|
-
return color(percentage);
|
|
188
|
-
} else if (isString(color)) {
|
|
189
|
-
return color;
|
|
190
|
-
} else {
|
|
191
|
-
const colors = getColors(color);
|
|
192
|
-
for (const color2 of colors) {
|
|
193
|
-
if (color2.percentage > percentage)
|
|
194
|
-
return color2.color;
|
|
195
|
-
}
|
|
196
|
-
return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
return (_ctx, _cache) => {
|
|
200
|
-
return openBlock(), createElementBlock("div", {
|
|
201
|
-
class: normalizeClass([
|
|
202
|
-
unref(ns).b(),
|
|
203
|
-
unref(ns).m(_ctx.type),
|
|
204
|
-
unref(ns).is(_ctx.status),
|
|
205
|
-
{
|
|
206
|
-
[unref(ns).m("without-text")]: !_ctx.showText,
|
|
207
|
-
[unref(ns).m("text-inside")]: _ctx.textInside
|
|
208
|
-
}
|
|
209
|
-
]),
|
|
210
|
-
role: "progressbar",
|
|
211
|
-
"aria-valuenow": _ctx.percentage,
|
|
212
|
-
"aria-valuemin": "0",
|
|
213
|
-
"aria-valuemax": "100"
|
|
214
|
-
}, [
|
|
215
|
-
_ctx.type === "line" ? (openBlock(), createElementBlock(
|
|
216
|
-
"div",
|
|
217
|
-
{
|
|
218
|
-
key: 0,
|
|
219
|
-
class: normalizeClass(unref(ns).b("bar"))
|
|
220
|
-
},
|
|
221
|
-
[
|
|
222
|
-
createElementVNode(
|
|
223
|
-
"div",
|
|
224
|
-
{
|
|
225
|
-
class: normalizeClass(unref(ns).be("bar", "outer")),
|
|
226
|
-
style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
|
|
227
|
-
},
|
|
228
|
-
[
|
|
229
|
-
createElementVNode(
|
|
230
|
-
"div",
|
|
231
|
-
{
|
|
232
|
-
class: normalizeClass([
|
|
233
|
-
unref(ns).be("bar", "inner"),
|
|
234
|
-
{ [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
|
|
235
|
-
{ [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
|
|
236
|
-
{ [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
|
|
237
|
-
]),
|
|
238
|
-
style: normalizeStyle(barStyle.value)
|
|
239
|
-
},
|
|
240
|
-
[
|
|
241
|
-
(_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock(
|
|
242
|
-
"div",
|
|
243
|
-
{
|
|
244
|
-
key: 0,
|
|
245
|
-
class: normalizeClass(unref(ns).be("bar", "innerText"))
|
|
246
|
-
},
|
|
247
|
-
[
|
|
248
|
-
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
|
|
249
|
-
createElementVNode(
|
|
250
|
-
"span",
|
|
251
|
-
null,
|
|
252
|
-
toDisplayString(content.value),
|
|
253
|
-
1
|
|
254
|
-
)
|
|
255
|
-
])
|
|
256
|
-
],
|
|
257
|
-
2
|
|
258
|
-
)) : createCommentVNode("v-if", true)
|
|
259
|
-
],
|
|
260
|
-
6
|
|
261
|
-
)
|
|
262
|
-
],
|
|
263
|
-
6
|
|
264
|
-
)
|
|
265
|
-
],
|
|
266
|
-
2
|
|
267
|
-
)) : (openBlock(), createElementBlock(
|
|
268
|
-
"div",
|
|
269
|
-
{
|
|
270
|
-
key: 1,
|
|
271
|
-
class: normalizeClass(unref(ns).b("circle")),
|
|
272
|
-
style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
|
|
273
|
-
},
|
|
274
|
-
[
|
|
275
|
-
(openBlock(), createElementBlock("svg", _hoisted_2$2, [
|
|
276
|
-
createElementVNode("path", {
|
|
277
|
-
class: normalizeClass(unref(ns).be("circle", "track")),
|
|
278
|
-
d: trackPath.value,
|
|
279
|
-
stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
|
|
280
|
-
"stroke-linecap": _ctx.strokeLinecap,
|
|
281
|
-
"stroke-width": relativeStrokeWidth.value,
|
|
282
|
-
fill: "none",
|
|
283
|
-
style: normalizeStyle(trailPathStyle.value)
|
|
284
|
-
}, null, 14, _hoisted_3$1),
|
|
285
|
-
createElementVNode("path", {
|
|
286
|
-
class: normalizeClass(unref(ns).be("circle", "path")),
|
|
287
|
-
d: trackPath.value,
|
|
288
|
-
stroke: stroke.value,
|
|
289
|
-
fill: "none",
|
|
290
|
-
opacity: _ctx.percentage ? 1 : 0,
|
|
291
|
-
"stroke-linecap": _ctx.strokeLinecap,
|
|
292
|
-
"stroke-width": relativeStrokeWidth.value,
|
|
293
|
-
style: normalizeStyle(circlePathStyle.value)
|
|
294
|
-
}, null, 14, _hoisted_4$1)
|
|
295
|
-
]))
|
|
296
|
-
],
|
|
297
|
-
6
|
|
298
|
-
)),
|
|
299
|
-
(_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock(
|
|
300
|
-
"div",
|
|
301
|
-
{
|
|
302
|
-
key: 2,
|
|
303
|
-
class: normalizeClass(unref(ns).e("text")),
|
|
304
|
-
style: normalizeStyle({ fontSize: `${progressTextSize.value}px` })
|
|
305
|
-
},
|
|
306
|
-
[
|
|
307
|
-
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
|
|
308
|
-
!_ctx.status ? (openBlock(), createElementBlock(
|
|
309
|
-
"span",
|
|
310
|
-
_hoisted_5$1,
|
|
311
|
-
toDisplayString(content.value),
|
|
312
|
-
1
|
|
313
|
-
)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
314
|
-
default: withCtx(() => [
|
|
315
|
-
(openBlock(), createBlock(resolveDynamicComponent(statusIcon.value)))
|
|
316
|
-
]),
|
|
317
|
-
_: 1
|
|
318
|
-
}))
|
|
319
|
-
])
|
|
320
|
-
],
|
|
321
|
-
6
|
|
322
|
-
)) : createCommentVNode("v-if", true)
|
|
323
|
-
], 10, _hoisted_1$3);
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);
|
|
328
|
-
|
|
329
|
-
const ElProgress = withInstall(Progress);
|
|
330
|
-
|
|
331
|
-
const uploadContextKey = Symbol("uploadContextKey");
|
|
332
|
-
|
|
333
|
-
const SCOPE$1 = "ElUpload";
|
|
334
|
-
class UploadAjaxError extends Error {
|
|
335
|
-
constructor(message, status, method, url) {
|
|
336
|
-
super(message);
|
|
337
|
-
this.name = "UploadAjaxError";
|
|
338
|
-
this.status = status;
|
|
339
|
-
this.method = method;
|
|
340
|
-
this.url = url;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
function getError(action, option, xhr) {
|
|
344
|
-
let msg;
|
|
345
|
-
if (xhr.response) {
|
|
346
|
-
msg = `${xhr.response.error || xhr.response}`;
|
|
347
|
-
} else if (xhr.responseText) {
|
|
348
|
-
msg = `${xhr.responseText}`;
|
|
349
|
-
} else {
|
|
350
|
-
msg = `fail to ${option.method} ${action} ${xhr.status}`;
|
|
351
|
-
}
|
|
352
|
-
return new UploadAjaxError(msg, xhr.status, option.method, action);
|
|
353
|
-
}
|
|
354
|
-
function getBody(xhr) {
|
|
355
|
-
const text = xhr.responseText || xhr.response;
|
|
356
|
-
if (!text) {
|
|
357
|
-
return text;
|
|
358
|
-
}
|
|
359
|
-
try {
|
|
360
|
-
return JSON.parse(text);
|
|
361
|
-
} catch (e) {
|
|
362
|
-
return text;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
const ajaxUpload = (option) => {
|
|
366
|
-
if (typeof XMLHttpRequest === "undefined")
|
|
367
|
-
throwError(SCOPE$1, "XMLHttpRequest is undefined");
|
|
368
|
-
const xhr = new XMLHttpRequest();
|
|
369
|
-
const action = option.action;
|
|
370
|
-
if (xhr.upload) {
|
|
371
|
-
xhr.upload.addEventListener("progress", (evt) => {
|
|
372
|
-
const progressEvt = evt;
|
|
373
|
-
progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
|
|
374
|
-
option.onProgress(progressEvt);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
const formData = new FormData();
|
|
378
|
-
if (option.data) {
|
|
379
|
-
for (const [key, value] of Object.entries(option.data)) {
|
|
380
|
-
if (isArray(value) && value.length)
|
|
381
|
-
formData.append(key, ...value);
|
|
382
|
-
else
|
|
383
|
-
formData.append(key, value);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
formData.append(option.filename, option.file, option.file.name);
|
|
387
|
-
xhr.addEventListener("error", () => {
|
|
388
|
-
option.onError(getError(action, option, xhr));
|
|
389
|
-
});
|
|
390
|
-
xhr.addEventListener("load", () => {
|
|
391
|
-
if (xhr.status < 200 || xhr.status >= 300) {
|
|
392
|
-
return option.onError(getError(action, option, xhr));
|
|
393
|
-
}
|
|
394
|
-
option.onSuccess(getBody(xhr));
|
|
395
|
-
});
|
|
396
|
-
xhr.open(option.method, action, true);
|
|
397
|
-
if (option.withCredentials && "withCredentials" in xhr) {
|
|
398
|
-
xhr.withCredentials = true;
|
|
399
|
-
}
|
|
400
|
-
const headers = option.headers || {};
|
|
401
|
-
if (headers instanceof Headers) {
|
|
402
|
-
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
403
|
-
} else {
|
|
404
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
405
|
-
if (isNil(value))
|
|
406
|
-
continue;
|
|
407
|
-
xhr.setRequestHeader(key, String(value));
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
xhr.send(formData);
|
|
411
|
-
return xhr;
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
const uploadListTypes = ["text", "picture", "picture-card"];
|
|
415
|
-
let fileId = 1;
|
|
416
|
-
const genFileId = () => Date.now() + fileId++;
|
|
417
|
-
const uploadBaseProps = buildProps({
|
|
418
|
-
action: {
|
|
419
|
-
type: String,
|
|
420
|
-
default: "#"
|
|
421
|
-
},
|
|
422
|
-
headers: {
|
|
423
|
-
type: definePropType(Object)
|
|
424
|
-
},
|
|
425
|
-
method: {
|
|
426
|
-
type: String,
|
|
427
|
-
default: "post"
|
|
428
|
-
},
|
|
429
|
-
data: {
|
|
430
|
-
type: definePropType([Object, Function, Promise]),
|
|
431
|
-
default: () => mutable({})
|
|
432
|
-
},
|
|
433
|
-
multiple: Boolean,
|
|
434
|
-
name: {
|
|
435
|
-
type: String,
|
|
436
|
-
default: "file"
|
|
437
|
-
},
|
|
438
|
-
drag: Boolean,
|
|
439
|
-
withCredentials: Boolean,
|
|
440
|
-
showFileList: {
|
|
441
|
-
type: Boolean,
|
|
442
|
-
default: true
|
|
443
|
-
},
|
|
444
|
-
accept: {
|
|
445
|
-
type: String,
|
|
446
|
-
default: ""
|
|
447
|
-
},
|
|
448
|
-
fileList: {
|
|
449
|
-
type: definePropType(Array),
|
|
450
|
-
default: () => mutable([])
|
|
451
|
-
},
|
|
452
|
-
autoUpload: {
|
|
453
|
-
type: Boolean,
|
|
454
|
-
default: true
|
|
455
|
-
},
|
|
456
|
-
listType: {
|
|
457
|
-
type: String,
|
|
458
|
-
values: uploadListTypes,
|
|
459
|
-
default: "text"
|
|
460
|
-
},
|
|
461
|
-
httpRequest: {
|
|
462
|
-
type: definePropType(Function),
|
|
463
|
-
default: ajaxUpload
|
|
464
|
-
},
|
|
465
|
-
disabled: {
|
|
466
|
-
type: Boolean,
|
|
467
|
-
default: void 0
|
|
468
|
-
},
|
|
469
|
-
limit: Number,
|
|
470
|
-
directory: Boolean
|
|
471
|
-
});
|
|
472
|
-
const uploadProps = buildProps({
|
|
473
|
-
...uploadBaseProps,
|
|
474
|
-
beforeUpload: {
|
|
475
|
-
type: definePropType(Function),
|
|
476
|
-
default: NOOP
|
|
477
|
-
},
|
|
478
|
-
beforeRemove: {
|
|
479
|
-
type: definePropType(Function)
|
|
480
|
-
},
|
|
481
|
-
onRemove: {
|
|
482
|
-
type: definePropType(Function),
|
|
483
|
-
default: NOOP
|
|
484
|
-
},
|
|
485
|
-
onChange: {
|
|
486
|
-
type: definePropType(Function),
|
|
487
|
-
default: NOOP
|
|
488
|
-
},
|
|
489
|
-
onPreview: {
|
|
490
|
-
type: definePropType(Function),
|
|
491
|
-
default: NOOP
|
|
492
|
-
},
|
|
493
|
-
onSuccess: {
|
|
494
|
-
type: definePropType(Function),
|
|
495
|
-
default: NOOP
|
|
496
|
-
},
|
|
497
|
-
onProgress: {
|
|
498
|
-
type: definePropType(Function),
|
|
499
|
-
default: NOOP
|
|
500
|
-
},
|
|
501
|
-
onError: {
|
|
502
|
-
type: definePropType(Function),
|
|
503
|
-
default: NOOP
|
|
504
|
-
},
|
|
505
|
-
onExceed: {
|
|
506
|
-
type: definePropType(Function),
|
|
507
|
-
default: NOOP
|
|
508
|
-
},
|
|
509
|
-
crossorigin: {
|
|
510
|
-
type: definePropType(String)
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
|
|
514
|
-
const uploadListProps = buildProps({
|
|
515
|
-
files: {
|
|
516
|
-
type: definePropType(Array),
|
|
517
|
-
default: () => mutable([])
|
|
518
|
-
},
|
|
519
|
-
disabled: {
|
|
520
|
-
type: Boolean,
|
|
521
|
-
default: void 0
|
|
522
|
-
},
|
|
523
|
-
handlePreview: {
|
|
524
|
-
type: definePropType(Function),
|
|
525
|
-
default: NOOP
|
|
526
|
-
},
|
|
527
|
-
listType: {
|
|
528
|
-
type: String,
|
|
529
|
-
values: uploadListTypes,
|
|
530
|
-
default: "text"
|
|
531
|
-
},
|
|
532
|
-
crossorigin: {
|
|
533
|
-
type: definePropType(String)
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
const uploadListEmits = {
|
|
537
|
-
remove: (file) => !!file
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
const _hoisted_1$2 = ["tabindex", "aria-disabled", "onKeydown"];
|
|
541
|
-
const _hoisted_2$1 = ["src", "crossorigin"];
|
|
542
|
-
const _hoisted_3 = ["onClick"];
|
|
543
|
-
const _hoisted_4 = ["title"];
|
|
544
|
-
const _hoisted_5 = ["onClick"];
|
|
545
|
-
const _hoisted_6 = ["onClick"];
|
|
546
|
-
const _sfc_main$4 = defineComponent({
|
|
547
|
-
...{
|
|
548
|
-
name: "ElUploadList"
|
|
549
|
-
},
|
|
550
|
-
__name: "upload-list",
|
|
551
|
-
props: uploadListProps,
|
|
552
|
-
emits: uploadListEmits,
|
|
553
|
-
setup(__props, { emit: __emit }) {
|
|
554
|
-
const props = __props;
|
|
555
|
-
const emit = __emit;
|
|
556
|
-
const { t } = useLocale();
|
|
557
|
-
const nsUpload = useNamespace("upload");
|
|
558
|
-
const nsIcon = useNamespace("icon");
|
|
559
|
-
const nsList = useNamespace("list");
|
|
560
|
-
const disabled = useFormDisabled();
|
|
561
|
-
const focusing = ref(false);
|
|
562
|
-
const containerKls = computed(() => [
|
|
563
|
-
nsUpload.b("list"),
|
|
564
|
-
nsUpload.bm("list", props.listType),
|
|
565
|
-
nsUpload.is("disabled", disabled.value)
|
|
566
|
-
]);
|
|
567
|
-
const handleRemove = (file) => {
|
|
568
|
-
emit("remove", file);
|
|
569
|
-
};
|
|
570
|
-
return (_ctx, _cache) => {
|
|
571
|
-
return openBlock(), createBlock(TransitionGroup, {
|
|
572
|
-
tag: "ul",
|
|
573
|
-
class: normalizeClass(containerKls.value),
|
|
574
|
-
name: unref(nsList).b()
|
|
575
|
-
}, {
|
|
576
|
-
default: withCtx(() => [
|
|
577
|
-
(openBlock(true), createElementBlock(
|
|
578
|
-
Fragment,
|
|
579
|
-
null,
|
|
580
|
-
renderList(_ctx.files, (file, index) => {
|
|
581
|
-
return openBlock(), createElementBlock("li", {
|
|
582
|
-
key: file.uid || file.name,
|
|
583
|
-
class: normalizeClass([
|
|
584
|
-
unref(nsUpload).be("list", "item"),
|
|
585
|
-
unref(nsUpload).is(file.status),
|
|
586
|
-
{ focusing: focusing.value }
|
|
587
|
-
]),
|
|
588
|
-
tabindex: unref(disabled) ? void 0 : 0,
|
|
589
|
-
"aria-disabled": unref(disabled),
|
|
590
|
-
role: "button",
|
|
591
|
-
onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
|
|
592
|
-
onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
|
|
593
|
-
onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
|
|
594
|
-
onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
|
|
595
|
-
}, [
|
|
596
|
-
renderSlot(_ctx.$slots, "default", {
|
|
597
|
-
file,
|
|
598
|
-
index
|
|
599
|
-
}, () => [
|
|
600
|
-
_ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
|
|
601
|
-
key: 0,
|
|
602
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
|
|
603
|
-
src: file.url,
|
|
604
|
-
crossorigin: _ctx.crossorigin,
|
|
605
|
-
alt: ""
|
|
606
|
-
}, null, 10, _hoisted_2$1)) : createCommentVNode("v-if", true),
|
|
607
|
-
file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock(
|
|
608
|
-
"div",
|
|
609
|
-
{
|
|
610
|
-
key: 1,
|
|
611
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-info"))
|
|
612
|
-
},
|
|
613
|
-
[
|
|
614
|
-
createElementVNode("a", {
|
|
615
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-name")),
|
|
616
|
-
onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
|
|
617
|
-
}, [
|
|
618
|
-
createVNode(unref(ElIcon), {
|
|
619
|
-
class: normalizeClass(unref(nsIcon).m("document"))
|
|
620
|
-
}, {
|
|
621
|
-
default: withCtx(() => [
|
|
622
|
-
createVNode(unref(Document))
|
|
623
|
-
]),
|
|
624
|
-
_: 1
|
|
625
|
-
}, 8, ["class"]),
|
|
626
|
-
createElementVNode("span", {
|
|
627
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
|
|
628
|
-
title: file.name
|
|
629
|
-
}, toDisplayString(file.name), 11, _hoisted_4)
|
|
630
|
-
], 10, _hoisted_3),
|
|
631
|
-
file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
|
|
632
|
-
key: 0,
|
|
633
|
-
type: _ctx.listType === "picture-card" ? "circle" : "line",
|
|
634
|
-
"stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
|
|
635
|
-
percentage: Number(file.percentage),
|
|
636
|
-
style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
|
|
637
|
-
}, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
|
|
638
|
-
],
|
|
639
|
-
2
|
|
640
|
-
)) : createCommentVNode("v-if", true),
|
|
641
|
-
createElementVNode(
|
|
642
|
-
"label",
|
|
643
|
-
{
|
|
644
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
|
|
645
|
-
},
|
|
646
|
-
[
|
|
647
|
-
_ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
648
|
-
key: 0,
|
|
649
|
-
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
|
|
650
|
-
}, {
|
|
651
|
-
default: withCtx(() => [
|
|
652
|
-
createVNode(unref(CircleCheck))
|
|
653
|
-
]),
|
|
654
|
-
_: 1
|
|
655
|
-
}, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
656
|
-
key: 1,
|
|
657
|
-
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
|
|
658
|
-
}, {
|
|
659
|
-
default: withCtx(() => [
|
|
660
|
-
createVNode(unref(Check))
|
|
661
|
-
]),
|
|
662
|
-
_: 1
|
|
663
|
-
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
664
|
-
],
|
|
665
|
-
2
|
|
666
|
-
),
|
|
667
|
-
!unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
668
|
-
key: 2,
|
|
669
|
-
class: normalizeClass(unref(nsIcon).m("close")),
|
|
670
|
-
onClick: ($event) => handleRemove(file)
|
|
671
|
-
}, {
|
|
672
|
-
default: withCtx(() => [
|
|
673
|
-
createVNode(unref(Close))
|
|
674
|
-
]),
|
|
675
|
-
_: 1
|
|
676
|
-
}, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
|
|
677
|
-
createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
|
|
678
|
-
createCommentVNode(" This is a bug which needs to be fixed "),
|
|
679
|
-
createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
|
|
680
|
-
!unref(disabled) ? (openBlock(), createElementBlock(
|
|
681
|
-
"i",
|
|
682
|
-
{
|
|
683
|
-
key: 3,
|
|
684
|
-
class: normalizeClass(unref(nsIcon).m("close-tip"))
|
|
685
|
-
},
|
|
686
|
-
toDisplayString(unref(t)("el.upload.deleteTip")),
|
|
687
|
-
3
|
|
688
|
-
)) : createCommentVNode("v-if", true),
|
|
689
|
-
_ctx.listType === "picture-card" ? (openBlock(), createElementBlock(
|
|
690
|
-
"span",
|
|
691
|
-
{
|
|
692
|
-
key: 4,
|
|
693
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
|
|
694
|
-
},
|
|
695
|
-
[
|
|
696
|
-
createElementVNode("span", {
|
|
697
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
|
|
698
|
-
onClick: ($event) => _ctx.handlePreview(file)
|
|
699
|
-
}, [
|
|
700
|
-
createVNode(unref(ElIcon), {
|
|
701
|
-
class: normalizeClass(unref(nsIcon).m("zoom-in"))
|
|
702
|
-
}, {
|
|
703
|
-
default: withCtx(() => [
|
|
704
|
-
createVNode(unref(ZoomIn))
|
|
705
|
-
]),
|
|
706
|
-
_: 1
|
|
707
|
-
}, 8, ["class"])
|
|
708
|
-
], 10, _hoisted_5),
|
|
709
|
-
!unref(disabled) ? (openBlock(), createElementBlock("span", {
|
|
710
|
-
key: 0,
|
|
711
|
-
class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
|
|
712
|
-
onClick: ($event) => handleRemove(file)
|
|
713
|
-
}, [
|
|
714
|
-
createVNode(unref(ElIcon), {
|
|
715
|
-
class: normalizeClass(unref(nsIcon).m("delete"))
|
|
716
|
-
}, {
|
|
717
|
-
default: withCtx(() => [
|
|
718
|
-
createVNode(unref(Delete))
|
|
719
|
-
]),
|
|
720
|
-
_: 1
|
|
721
|
-
}, 8, ["class"])
|
|
722
|
-
], 10, _hoisted_6)) : createCommentVNode("v-if", true)
|
|
723
|
-
],
|
|
724
|
-
2
|
|
725
|
-
)) : createCommentVNode("v-if", true)
|
|
726
|
-
])
|
|
727
|
-
], 42, _hoisted_1$2);
|
|
728
|
-
}),
|
|
729
|
-
128
|
|
730
|
-
)),
|
|
731
|
-
renderSlot(_ctx.$slots, "append")
|
|
732
|
-
]),
|
|
733
|
-
_: 3
|
|
734
|
-
}, 8, ["class", "name"]);
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);
|
|
739
|
-
|
|
740
|
-
const uploadDraggerProps = buildProps({
|
|
741
|
-
disabled: {
|
|
742
|
-
type: Boolean,
|
|
743
|
-
default: void 0
|
|
744
|
-
},
|
|
745
|
-
directory: Boolean
|
|
746
|
-
});
|
|
747
|
-
const uploadDraggerEmits = {
|
|
748
|
-
file: (file) => isArray(file)
|
|
749
|
-
};
|
|
750
|
-
|
|
751
|
-
const COMPONENT_NAME = "ElUploadDrag";
|
|
752
|
-
const _sfc_main$3 = defineComponent({
|
|
753
|
-
...{
|
|
754
|
-
name: COMPONENT_NAME
|
|
755
|
-
},
|
|
756
|
-
__name: "upload-dragger",
|
|
757
|
-
props: uploadDraggerProps,
|
|
758
|
-
emits: uploadDraggerEmits,
|
|
759
|
-
setup(__props, { emit: __emit }) {
|
|
760
|
-
const props = __props;
|
|
761
|
-
const emit = __emit;
|
|
762
|
-
const uploaderContext = inject(uploadContextKey);
|
|
763
|
-
if (!uploaderContext) {
|
|
764
|
-
throwError(
|
|
765
|
-
COMPONENT_NAME,
|
|
766
|
-
"usage: <el-upload><el-upload-dragger /></el-upload>"
|
|
767
|
-
);
|
|
768
|
-
}
|
|
769
|
-
const ns = useNamespace("upload");
|
|
770
|
-
const dragover = ref(false);
|
|
771
|
-
const disabled = useFormDisabled();
|
|
772
|
-
const getFile = (entry) => {
|
|
773
|
-
return new Promise((resolve, reject) => entry.file(resolve, reject));
|
|
774
|
-
};
|
|
775
|
-
const getAllFiles = async (entry) => {
|
|
776
|
-
try {
|
|
777
|
-
if (entry.isFile) {
|
|
778
|
-
const file = await getFile(
|
|
779
|
-
entry
|
|
780
|
-
);
|
|
781
|
-
file.isDirectory = false;
|
|
782
|
-
return [file];
|
|
783
|
-
}
|
|
784
|
-
if (entry.isDirectory) {
|
|
785
|
-
const dirReader = entry.createReader();
|
|
786
|
-
const getEntries = () => {
|
|
787
|
-
return new Promise(
|
|
788
|
-
(resolve, reject) => dirReader.readEntries(resolve, reject)
|
|
789
|
-
);
|
|
790
|
-
};
|
|
791
|
-
const entries = [];
|
|
792
|
-
let readEntries = await getEntries();
|
|
793
|
-
while (readEntries.length > 0) {
|
|
794
|
-
entries.push(...readEntries);
|
|
795
|
-
readEntries = await getEntries();
|
|
796
|
-
}
|
|
797
|
-
const filePromises = entries.map(
|
|
798
|
-
(entry2) => getAllFiles(entry2).catch(() => [])
|
|
799
|
-
);
|
|
800
|
-
const files = await Promise.all(filePromises);
|
|
801
|
-
return flatten(files);
|
|
802
|
-
}
|
|
803
|
-
} catch (e) {
|
|
804
|
-
return [];
|
|
805
|
-
}
|
|
806
|
-
return [];
|
|
807
|
-
};
|
|
808
|
-
const onDrop = async (e) => {
|
|
809
|
-
if (disabled.value)
|
|
810
|
-
return;
|
|
811
|
-
dragover.value = false;
|
|
812
|
-
e.stopPropagation();
|
|
813
|
-
const files = Array.from(e.dataTransfer.files);
|
|
814
|
-
const items = e.dataTransfer.items || [];
|
|
815
|
-
if (props.directory) {
|
|
816
|
-
const entries = Array.from(items).map((item) => {
|
|
817
|
-
var _a;
|
|
818
|
-
return (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
|
|
819
|
-
}).filter((entry) => entry);
|
|
820
|
-
const allFiles = await Promise.all(entries.map(getAllFiles));
|
|
821
|
-
emit("file", flatten(allFiles));
|
|
822
|
-
return;
|
|
823
|
-
}
|
|
824
|
-
files.forEach((file, index) => {
|
|
825
|
-
var _a;
|
|
826
|
-
const item = items[index];
|
|
827
|
-
const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
|
|
828
|
-
if (entry) {
|
|
829
|
-
file.isDirectory = entry.isDirectory;
|
|
830
|
-
}
|
|
831
|
-
});
|
|
832
|
-
emit("file", files);
|
|
833
|
-
};
|
|
834
|
-
const onDragover = () => {
|
|
835
|
-
if (!disabled.value)
|
|
836
|
-
dragover.value = true;
|
|
837
|
-
};
|
|
838
|
-
const onDragleave = (e) => {
|
|
839
|
-
if (!e.currentTarget.contains(e.relatedTarget))
|
|
840
|
-
dragover.value = false;
|
|
841
|
-
};
|
|
842
|
-
return (_ctx, _cache) => {
|
|
843
|
-
return openBlock(), createElementBlock(
|
|
844
|
-
"div",
|
|
845
|
-
{
|
|
846
|
-
class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
|
|
847
|
-
onDrop: withModifiers(onDrop, ["prevent"]),
|
|
848
|
-
onDragover: withModifiers(onDragover, ["prevent"]),
|
|
849
|
-
onDragleave: withModifiers(onDragleave, ["prevent"])
|
|
850
|
-
},
|
|
851
|
-
[
|
|
852
|
-
renderSlot(_ctx.$slots, "default")
|
|
853
|
-
],
|
|
854
|
-
34
|
|
855
|
-
);
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);
|
|
860
|
-
|
|
861
|
-
const uploadContentProps = buildProps({
|
|
862
|
-
...uploadBaseProps,
|
|
863
|
-
beforeUpload: {
|
|
864
|
-
type: definePropType(Function),
|
|
865
|
-
default: NOOP
|
|
866
|
-
},
|
|
867
|
-
onRemove: {
|
|
868
|
-
type: definePropType(Function),
|
|
869
|
-
default: NOOP
|
|
870
|
-
},
|
|
871
|
-
onStart: {
|
|
872
|
-
type: definePropType(Function),
|
|
873
|
-
default: NOOP
|
|
874
|
-
},
|
|
875
|
-
onSuccess: {
|
|
876
|
-
type: definePropType(
|
|
877
|
-
Function
|
|
878
|
-
),
|
|
879
|
-
default: NOOP
|
|
880
|
-
},
|
|
881
|
-
onProgress: {
|
|
882
|
-
type: definePropType(Function),
|
|
883
|
-
default: NOOP
|
|
884
|
-
},
|
|
885
|
-
onError: {
|
|
886
|
-
type: definePropType(Function),
|
|
887
|
-
default: NOOP
|
|
888
|
-
},
|
|
889
|
-
onExceed: {
|
|
890
|
-
type: definePropType(Function),
|
|
891
|
-
default: NOOP
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
|
|
895
|
-
const _hoisted_1$1 = ["tabindex", "aria-disabled", "onKeydown"];
|
|
896
|
-
const _hoisted_2 = ["name", "disabled", "multiple", "accept", "webkitdirectory"];
|
|
897
|
-
const _sfc_main$2 = defineComponent({
|
|
898
|
-
...{
|
|
899
|
-
name: "ElUploadContent",
|
|
900
|
-
inheritAttrs: false
|
|
901
|
-
},
|
|
902
|
-
__name: "upload-content",
|
|
903
|
-
props: uploadContentProps,
|
|
904
|
-
setup(__props, { expose: __expose }) {
|
|
905
|
-
const props = __props;
|
|
906
|
-
const ns = useNamespace("upload");
|
|
907
|
-
const disabled = useFormDisabled();
|
|
908
|
-
const requests = shallowRef(
|
|
909
|
-
{}
|
|
910
|
-
);
|
|
911
|
-
const inputRef = shallowRef();
|
|
912
|
-
const uploadFiles = (files) => {
|
|
913
|
-
if (files.length === 0)
|
|
914
|
-
return;
|
|
915
|
-
const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
|
|
916
|
-
if (limit && fileList.length + files.length > limit) {
|
|
917
|
-
onExceed(files, fileList);
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
if (!multiple) {
|
|
921
|
-
files = files.slice(0, 1);
|
|
922
|
-
}
|
|
923
|
-
for (const file of files) {
|
|
924
|
-
const rawFile = file;
|
|
925
|
-
rawFile.uid = genFileId();
|
|
926
|
-
onStart(rawFile);
|
|
927
|
-
if (autoUpload)
|
|
928
|
-
upload(rawFile);
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
const upload = async (rawFile) => {
|
|
932
|
-
inputRef.value.value = "";
|
|
933
|
-
if (!props.beforeUpload) {
|
|
934
|
-
return doUpload(rawFile);
|
|
935
|
-
}
|
|
936
|
-
let hookResult;
|
|
937
|
-
let beforeData = {};
|
|
938
|
-
try {
|
|
939
|
-
const originData = props.data;
|
|
940
|
-
const beforeUploadPromise = props.beforeUpload(rawFile);
|
|
941
|
-
beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data;
|
|
942
|
-
hookResult = await beforeUploadPromise;
|
|
943
|
-
if (isPlainObject(props.data) && isEqual(originData, beforeData)) {
|
|
944
|
-
beforeData = cloneDeep(props.data);
|
|
945
|
-
}
|
|
946
|
-
} catch (e) {
|
|
947
|
-
hookResult = false;
|
|
948
|
-
}
|
|
949
|
-
if (hookResult === false) {
|
|
950
|
-
props.onRemove(rawFile);
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
let file = rawFile;
|
|
954
|
-
if (hookResult instanceof Blob) {
|
|
955
|
-
if (hookResult instanceof File) {
|
|
956
|
-
file = hookResult;
|
|
957
|
-
} else {
|
|
958
|
-
file = new File([hookResult], rawFile.name, {
|
|
959
|
-
type: rawFile.type
|
|
960
|
-
});
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
doUpload(
|
|
964
|
-
Object.assign(file, {
|
|
965
|
-
uid: rawFile.uid
|
|
966
|
-
}),
|
|
967
|
-
beforeData
|
|
968
|
-
);
|
|
969
|
-
};
|
|
970
|
-
const resolveData = async (data, rawFile) => {
|
|
971
|
-
if (isFunction(data)) {
|
|
972
|
-
return data(rawFile);
|
|
973
|
-
}
|
|
974
|
-
return data;
|
|
975
|
-
};
|
|
976
|
-
const doUpload = async (rawFile, beforeData) => {
|
|
977
|
-
const {
|
|
978
|
-
headers,
|
|
979
|
-
data,
|
|
980
|
-
method,
|
|
981
|
-
withCredentials,
|
|
982
|
-
name: filename,
|
|
983
|
-
action,
|
|
984
|
-
onProgress,
|
|
985
|
-
onSuccess,
|
|
986
|
-
onError,
|
|
987
|
-
httpRequest
|
|
988
|
-
} = props;
|
|
989
|
-
try {
|
|
990
|
-
beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
|
|
991
|
-
} catch (e) {
|
|
992
|
-
props.onRemove(rawFile);
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
|
-
const { uid } = rawFile;
|
|
996
|
-
const options = {
|
|
997
|
-
headers: headers || {},
|
|
998
|
-
withCredentials,
|
|
999
|
-
file: rawFile,
|
|
1000
|
-
data: beforeData,
|
|
1001
|
-
method,
|
|
1002
|
-
filename,
|
|
1003
|
-
action,
|
|
1004
|
-
onProgress: (evt) => {
|
|
1005
|
-
onProgress(evt, rawFile);
|
|
1006
|
-
},
|
|
1007
|
-
onSuccess: (res) => {
|
|
1008
|
-
onSuccess(res, rawFile);
|
|
1009
|
-
delete requests.value[uid];
|
|
1010
|
-
},
|
|
1011
|
-
onError: (err) => {
|
|
1012
|
-
onError(err, rawFile);
|
|
1013
|
-
delete requests.value[uid];
|
|
1014
|
-
}
|
|
1015
|
-
};
|
|
1016
|
-
const request = httpRequest(options);
|
|
1017
|
-
requests.value[uid] = request;
|
|
1018
|
-
if (request instanceof Promise) {
|
|
1019
|
-
request.then(options.onSuccess, options.onError);
|
|
1020
|
-
}
|
|
1021
|
-
};
|
|
1022
|
-
const handleChange = (e) => {
|
|
1023
|
-
const files = e.target.files;
|
|
1024
|
-
if (!files)
|
|
1025
|
-
return;
|
|
1026
|
-
uploadFiles(Array.from(files));
|
|
1027
|
-
};
|
|
1028
|
-
const handleClick = () => {
|
|
1029
|
-
if (!disabled.value) {
|
|
1030
|
-
inputRef.value.value = "";
|
|
1031
|
-
inputRef.value.click();
|
|
1032
|
-
}
|
|
1033
|
-
};
|
|
1034
|
-
const handleKeydown = () => {
|
|
1035
|
-
handleClick();
|
|
1036
|
-
};
|
|
1037
|
-
const abort = (file) => {
|
|
1038
|
-
const _reqs = entriesOf(requests.value).filter(
|
|
1039
|
-
file ? ([uid]) => String(file.uid) === uid : () => true
|
|
1040
|
-
);
|
|
1041
|
-
_reqs.forEach(([uid, req]) => {
|
|
1042
|
-
if (req instanceof XMLHttpRequest)
|
|
1043
|
-
req.abort();
|
|
1044
|
-
delete requests.value[uid];
|
|
1045
|
-
});
|
|
1046
|
-
};
|
|
1047
|
-
__expose({
|
|
1048
|
-
abort,
|
|
1049
|
-
upload
|
|
1050
|
-
});
|
|
1051
|
-
return (_ctx, _cache) => {
|
|
1052
|
-
return openBlock(), createElementBlock("div", {
|
|
1053
|
-
class: normalizeClass([
|
|
1054
|
-
unref(ns).b(),
|
|
1055
|
-
unref(ns).m(_ctx.listType),
|
|
1056
|
-
unref(ns).is("drag", _ctx.drag),
|
|
1057
|
-
unref(ns).is("disabled", unref(disabled))
|
|
1058
|
-
]),
|
|
1059
|
-
tabindex: unref(disabled) ? void 0 : 0,
|
|
1060
|
-
"aria-disabled": unref(disabled),
|
|
1061
|
-
role: "button",
|
|
1062
|
-
onClick: handleClick,
|
|
1063
|
-
onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
|
|
1064
|
-
}, [
|
|
1065
|
-
_ctx.drag ? (openBlock(), createBlock(UploadDragger, {
|
|
1066
|
-
key: 0,
|
|
1067
|
-
disabled: unref(disabled),
|
|
1068
|
-
directory: _ctx.directory,
|
|
1069
|
-
onFile: uploadFiles
|
|
1070
|
-
}, {
|
|
1071
|
-
default: withCtx(() => [
|
|
1072
|
-
renderSlot(_ctx.$slots, "default")
|
|
1073
|
-
]),
|
|
1074
|
-
_: 3
|
|
1075
|
-
}, 8, ["disabled", "directory"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
|
|
1076
|
-
createElementVNode("input", {
|
|
1077
|
-
ref_key: "inputRef",
|
|
1078
|
-
ref: inputRef,
|
|
1079
|
-
class: normalizeClass(unref(ns).e("input")),
|
|
1080
|
-
name: _ctx.name,
|
|
1081
|
-
disabled: unref(disabled),
|
|
1082
|
-
multiple: _ctx.multiple,
|
|
1083
|
-
accept: _ctx.accept,
|
|
1084
|
-
webkitdirectory: _ctx.directory,
|
|
1085
|
-
type: "file",
|
|
1086
|
-
onChange: handleChange,
|
|
1087
|
-
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
1088
|
-
}, ["stop"]))
|
|
1089
|
-
}, null, 42, _hoisted_2)
|
|
1090
|
-
], 42, _hoisted_1$1);
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
});
|
|
1094
|
-
var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);
|
|
1095
|
-
|
|
1096
|
-
const SCOPE = "ElUpload";
|
|
1097
|
-
const revokeFileObjectURL = (file) => {
|
|
1098
|
-
var _a;
|
|
1099
|
-
if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
|
|
1100
|
-
URL.revokeObjectURL(file.url);
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
const useHandlers = (props, uploadRef) => {
|
|
1104
|
-
const uploadFiles = useVModel(
|
|
1105
|
-
props,
|
|
1106
|
-
"fileList",
|
|
1107
|
-
void 0,
|
|
1108
|
-
{ passive: true }
|
|
1109
|
-
);
|
|
1110
|
-
const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
|
|
1111
|
-
function abort(file) {
|
|
1112
|
-
var _a;
|
|
1113
|
-
(_a = uploadRef.value) == null ? void 0 : _a.abort(file);
|
|
1114
|
-
}
|
|
1115
|
-
function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
|
|
1116
|
-
uploadFiles.value = uploadFiles.value.filter(
|
|
1117
|
-
(row) => !states.includes(row.status)
|
|
1118
|
-
);
|
|
1119
|
-
}
|
|
1120
|
-
function removeFile(file) {
|
|
1121
|
-
uploadFiles.value = uploadFiles.value.filter(
|
|
1122
|
-
(uploadFile) => uploadFile.uid !== file.uid
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
|
-
const emitChange = (file) => {
|
|
1126
|
-
nextTick(() => props.onChange(file, uploadFiles.value));
|
|
1127
|
-
};
|
|
1128
|
-
const handleError = (err, rawFile) => {
|
|
1129
|
-
const file = getFile(rawFile);
|
|
1130
|
-
if (!file)
|
|
1131
|
-
return;
|
|
1132
|
-
console.error(err);
|
|
1133
|
-
file.status = "fail";
|
|
1134
|
-
removeFile(file);
|
|
1135
|
-
props.onError(err, file, uploadFiles.value);
|
|
1136
|
-
emitChange(file);
|
|
1137
|
-
};
|
|
1138
|
-
const handleProgress = (evt, rawFile) => {
|
|
1139
|
-
const file = getFile(rawFile);
|
|
1140
|
-
if (!file)
|
|
1141
|
-
return;
|
|
1142
|
-
props.onProgress(evt, file, uploadFiles.value);
|
|
1143
|
-
file.status = "uploading";
|
|
1144
|
-
file.percentage = Math.round(evt.percent);
|
|
1145
|
-
};
|
|
1146
|
-
const handleSuccess = (response, rawFile) => {
|
|
1147
|
-
const file = getFile(rawFile);
|
|
1148
|
-
if (!file)
|
|
1149
|
-
return;
|
|
1150
|
-
file.status = "success";
|
|
1151
|
-
file.response = response;
|
|
1152
|
-
props.onSuccess(response, file, uploadFiles.value);
|
|
1153
|
-
emitChange(file);
|
|
1154
|
-
};
|
|
1155
|
-
const handleStart = (file) => {
|
|
1156
|
-
if (isNil(file.uid))
|
|
1157
|
-
file.uid = genFileId();
|
|
1158
|
-
const uploadFile = {
|
|
1159
|
-
name: file.name,
|
|
1160
|
-
percentage: 0,
|
|
1161
|
-
status: "ready",
|
|
1162
|
-
size: file.size,
|
|
1163
|
-
raw: file,
|
|
1164
|
-
uid: file.uid
|
|
1165
|
-
};
|
|
1166
|
-
if (props.listType === "picture-card" || props.listType === "picture") {
|
|
1167
|
-
try {
|
|
1168
|
-
uploadFile.url = URL.createObjectURL(file);
|
|
1169
|
-
} catch (err) {
|
|
1170
|
-
debugWarn(SCOPE, err.message);
|
|
1171
|
-
props.onError(err, uploadFile, uploadFiles.value);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
uploadFiles.value = [...uploadFiles.value, uploadFile];
|
|
1175
|
-
emitChange(uploadFile);
|
|
1176
|
-
};
|
|
1177
|
-
const handleRemove = async (file) => {
|
|
1178
|
-
const uploadFile = file instanceof File ? getFile(file) : file;
|
|
1179
|
-
if (!uploadFile)
|
|
1180
|
-
throwError(SCOPE, "file to be removed not found");
|
|
1181
|
-
const doRemove = (file2) => {
|
|
1182
|
-
abort(file2);
|
|
1183
|
-
removeFile(file2);
|
|
1184
|
-
props.onRemove(file2, uploadFiles.value);
|
|
1185
|
-
revokeFileObjectURL(file2);
|
|
1186
|
-
};
|
|
1187
|
-
if (props.beforeRemove) {
|
|
1188
|
-
const before = await props.beforeRemove(uploadFile, uploadFiles.value);
|
|
1189
|
-
if (before !== false)
|
|
1190
|
-
doRemove(uploadFile);
|
|
1191
|
-
} else {
|
|
1192
|
-
doRemove(uploadFile);
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
|
-
function submit() {
|
|
1196
|
-
uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
|
|
1197
|
-
var _a;
|
|
1198
|
-
return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
|
-
watch(
|
|
1202
|
-
() => props.listType,
|
|
1203
|
-
(val) => {
|
|
1204
|
-
if (val !== "picture-card" && val !== "picture") {
|
|
1205
|
-
return;
|
|
1206
|
-
}
|
|
1207
|
-
uploadFiles.value = uploadFiles.value.map((file) => {
|
|
1208
|
-
const { raw, url } = file;
|
|
1209
|
-
if (!url && raw) {
|
|
1210
|
-
try {
|
|
1211
|
-
file.url = URL.createObjectURL(raw);
|
|
1212
|
-
} catch (err) {
|
|
1213
|
-
props.onError(err, file, uploadFiles.value);
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
return file;
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
);
|
|
1220
|
-
watch(
|
|
1221
|
-
uploadFiles,
|
|
1222
|
-
(files) => {
|
|
1223
|
-
for (const file of files) {
|
|
1224
|
-
file.uid || (file.uid = genFileId());
|
|
1225
|
-
file.status || (file.status = "success");
|
|
1226
|
-
}
|
|
1227
|
-
},
|
|
1228
|
-
{ immediate: true, deep: true }
|
|
1229
|
-
);
|
|
1230
|
-
return {
|
|
1231
|
-
uploadFiles,
|
|
1232
|
-
abort,
|
|
1233
|
-
clearFiles,
|
|
1234
|
-
handleError,
|
|
1235
|
-
handleProgress,
|
|
1236
|
-
handleStart,
|
|
1237
|
-
handleSuccess,
|
|
1238
|
-
handleRemove,
|
|
1239
|
-
submit,
|
|
1240
|
-
revokeFileObjectURL
|
|
1241
|
-
};
|
|
1242
|
-
};
|
|
1243
|
-
|
|
1244
|
-
const _sfc_main$1 = defineComponent({
|
|
1245
|
-
...{
|
|
1246
|
-
name: "ElUpload"
|
|
1247
|
-
},
|
|
1248
|
-
__name: "upload",
|
|
1249
|
-
props: uploadProps,
|
|
1250
|
-
setup(__props, { expose: __expose }) {
|
|
1251
|
-
const props = __props;
|
|
1252
|
-
const disabled = useFormDisabled();
|
|
1253
|
-
const uploadRef = shallowRef();
|
|
1254
|
-
const {
|
|
1255
|
-
abort,
|
|
1256
|
-
submit,
|
|
1257
|
-
clearFiles,
|
|
1258
|
-
uploadFiles,
|
|
1259
|
-
handleStart,
|
|
1260
|
-
handleError,
|
|
1261
|
-
handleRemove,
|
|
1262
|
-
handleSuccess,
|
|
1263
|
-
handleProgress,
|
|
1264
|
-
revokeFileObjectURL
|
|
1265
|
-
} = useHandlers(props, uploadRef);
|
|
1266
|
-
const isPictureCard = computed(() => props.listType === "picture-card");
|
|
1267
|
-
const uploadContentProps = computed(() => ({
|
|
1268
|
-
...props,
|
|
1269
|
-
fileList: uploadFiles.value,
|
|
1270
|
-
onStart: handleStart,
|
|
1271
|
-
onProgress: handleProgress,
|
|
1272
|
-
onSuccess: handleSuccess,
|
|
1273
|
-
onError: handleError,
|
|
1274
|
-
onRemove: handleRemove
|
|
1275
|
-
}));
|
|
1276
|
-
onBeforeUnmount(() => {
|
|
1277
|
-
uploadFiles.value.forEach(revokeFileObjectURL);
|
|
1278
|
-
});
|
|
1279
|
-
provide(uploadContextKey, {
|
|
1280
|
-
accept: toRef(props, "accept")
|
|
1281
|
-
});
|
|
1282
|
-
__expose({
|
|
1283
|
-
abort,
|
|
1284
|
-
submit,
|
|
1285
|
-
clearFiles,
|
|
1286
|
-
handleStart,
|
|
1287
|
-
handleRemove
|
|
1288
|
-
});
|
|
1289
|
-
return (_ctx, _cache) => {
|
|
1290
|
-
return openBlock(), createElementBlock("div", null, [
|
|
1291
|
-
isPictureCard.value && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
|
|
1292
|
-
key: 0,
|
|
1293
|
-
disabled: unref(disabled),
|
|
1294
|
-
"list-type": _ctx.listType,
|
|
1295
|
-
files: unref(uploadFiles),
|
|
1296
|
-
crossorigin: _ctx.crossorigin,
|
|
1297
|
-
"handle-preview": _ctx.onPreview,
|
|
1298
|
-
onRemove: unref(handleRemove)
|
|
1299
|
-
}, createSlots({
|
|
1300
|
-
append: withCtx(() => [
|
|
1301
|
-
createVNode(
|
|
1302
|
-
UploadContent,
|
|
1303
|
-
mergeProps({
|
|
1304
|
-
ref_key: "uploadRef",
|
|
1305
|
-
ref: uploadRef
|
|
1306
|
-
}, uploadContentProps.value),
|
|
1307
|
-
{
|
|
1308
|
-
default: withCtx(() => [
|
|
1309
|
-
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
|
|
1310
|
-
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
|
|
1311
|
-
]),
|
|
1312
|
-
_: 3
|
|
1313
|
-
},
|
|
1314
|
-
16
|
|
1315
|
-
)
|
|
1316
|
-
]),
|
|
1317
|
-
_: 2
|
|
1318
|
-
}, [
|
|
1319
|
-
_ctx.$slots.file ? {
|
|
1320
|
-
name: "default",
|
|
1321
|
-
fn: withCtx(({ file, index }) => [
|
|
1322
|
-
renderSlot(_ctx.$slots, "file", {
|
|
1323
|
-
file,
|
|
1324
|
-
index
|
|
1325
|
-
})
|
|
1326
|
-
]),
|
|
1327
|
-
key: "0"
|
|
1328
|
-
} : void 0
|
|
1329
|
-
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
|
|
1330
|
-
!isPictureCard.value || isPictureCard.value && !_ctx.showFileList ? (openBlock(), createBlock(
|
|
1331
|
-
UploadContent,
|
|
1332
|
-
mergeProps({
|
|
1333
|
-
key: 1,
|
|
1334
|
-
ref_key: "uploadRef",
|
|
1335
|
-
ref: uploadRef
|
|
1336
|
-
}, uploadContentProps.value),
|
|
1337
|
-
{
|
|
1338
|
-
default: withCtx(() => [
|
|
1339
|
-
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
|
|
1340
|
-
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
|
|
1341
|
-
]),
|
|
1342
|
-
_: 3
|
|
1343
|
-
},
|
|
1344
|
-
16
|
|
1345
|
-
)) : createCommentVNode("v-if", true),
|
|
1346
|
-
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
|
|
1347
|
-
renderSlot(_ctx.$slots, "tip"),
|
|
1348
|
-
!isPictureCard.value && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
|
|
1349
|
-
key: 3,
|
|
1350
|
-
disabled: unref(disabled),
|
|
1351
|
-
"list-type": _ctx.listType,
|
|
1352
|
-
files: unref(uploadFiles),
|
|
1353
|
-
crossorigin: _ctx.crossorigin,
|
|
1354
|
-
"handle-preview": _ctx.onPreview,
|
|
1355
|
-
onRemove: unref(handleRemove)
|
|
1356
|
-
}, createSlots({
|
|
1357
|
-
_: 2
|
|
1358
|
-
}, [
|
|
1359
|
-
_ctx.$slots.file ? {
|
|
1360
|
-
name: "default",
|
|
1361
|
-
fn: withCtx(({ file, index }) => [
|
|
1362
|
-
renderSlot(_ctx.$slots, "file", {
|
|
1363
|
-
file,
|
|
1364
|
-
index
|
|
1365
|
-
})
|
|
1366
|
-
]),
|
|
1367
|
-
key: "0"
|
|
1368
|
-
} : void 0
|
|
1369
|
-
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
|
|
1370
|
-
]);
|
|
1371
|
-
};
|
|
1372
|
-
}
|
|
1373
|
-
});
|
|
1374
|
-
var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);
|
|
1375
|
-
|
|
1376
|
-
const ElUpload = withInstall(Upload);
|
|
11
|
+
import { _ as _export_sfc } from '../../chunk/pcqpp-6-.mjs';
|
|
1377
12
|
|
|
1378
13
|
const _hoisted_1 = ["src"];
|
|
1379
14
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -1470,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1470
105
|
return (_ctx, _cache) => {
|
|
1471
106
|
const _component_ElUpload = ElUpload;
|
|
1472
107
|
const _component_ElButton = ElButton;
|
|
1473
|
-
const _directive_loading =
|
|
108
|
+
const _directive_loading = ElLoadingDirective;
|
|
1474
109
|
return openBlock(), createBlock(Component$1, mergeProps({
|
|
1475
110
|
modelValue: unref(dialogVisible),
|
|
1476
111
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(dialogVisible) ? dialogVisible.value = $event : null),
|
|
@@ -1569,7 +204,7 @@ const style0 = {
|
|
|
1569
204
|
const cssModules = {
|
|
1570
205
|
"$style": style0
|
|
1571
206
|
};
|
|
1572
|
-
const Component = /* @__PURE__ */ _export_sfc
|
|
207
|
+
const Component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
|
|
1573
208
|
|
|
1574
209
|
const __vite_glob_0_14 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1575
210
|
__proto__: null,
|