fantasia-ui 0.2.58 → 0.2.60
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/fantasia-ui.css +63 -38
- package/dist/fantasia-ui.es.js +143 -55
- package/dist/fantasia-ui.umd.js +142 -54
- package/dist/types/packages/components/modules/FUpload.vue.d.ts +26 -14
- package/dist/types/packages/index.d.ts +1 -3
- package/dist/types/packages/types/components/modules/f-upload.d.ts +27 -10
- package/package.json +1 -1
package/dist/fantasia-ui.css
CHANGED
|
@@ -6696,74 +6696,99 @@ to {
|
|
|
6696
6696
|
color: #94a3b8;
|
|
6697
6697
|
font-weight: 700;
|
|
6698
6698
|
background: rgba(248, 250, 252, 0.5);
|
|
6699
|
-
}.f-upload[data-v-
|
|
6699
|
+
}.f-upload[data-v-ab699abf] {
|
|
6700
6700
|
display: flex;
|
|
6701
6701
|
flex-direction: column;
|
|
6702
|
-
gap:
|
|
6702
|
+
gap: 12px;
|
|
6703
6703
|
}
|
|
6704
|
-
.f-upload__trigger[data-v-
|
|
6704
|
+
.f-upload__trigger[data-v-ab699abf] {
|
|
6705
6705
|
display: inline-block;
|
|
6706
6706
|
cursor: pointer;
|
|
6707
6707
|
}
|
|
6708
|
-
.f-upload__zone[data-v-
|
|
6709
|
-
height:
|
|
6708
|
+
.f-upload__zone[data-v-ab699abf] {
|
|
6709
|
+
height: 180px;
|
|
6710
6710
|
width: 100%;
|
|
6711
|
-
border: 2px dashed #
|
|
6712
|
-
border-radius:
|
|
6711
|
+
border: 2px dashed #dcdfe6;
|
|
6712
|
+
border-radius: 4px;
|
|
6713
6713
|
display: flex;
|
|
6714
6714
|
flex-direction: column;
|
|
6715
6715
|
align-items: center;
|
|
6716
6716
|
justify-content: center;
|
|
6717
|
-
padding:
|
|
6717
|
+
padding: 20px;
|
|
6718
6718
|
text-align: center;
|
|
6719
|
-
transition: all 0.2s
|
|
6719
|
+
transition: all 0.2s;
|
|
6720
6720
|
}
|
|
6721
|
-
.f-upload__zone[data-v-
|
|
6722
|
-
border-color: #
|
|
6723
|
-
background: rgba(
|
|
6721
|
+
.f-upload__zone[data-v-ab699abf]:hover {
|
|
6722
|
+
border-color: #409eff;
|
|
6723
|
+
background: rgba(236, 245, 255, 0.3);
|
|
6724
6724
|
}
|
|
6725
|
-
.f-upload--drag .f-upload__zone[data-v-
|
|
6726
|
-
border-color: #
|
|
6727
|
-
background: rgba(
|
|
6725
|
+
.f-upload--drag .f-upload__zone[data-v-ab699abf] {
|
|
6726
|
+
border-color: #409eff;
|
|
6727
|
+
background: rgba(236, 245, 255, 0.5);
|
|
6728
6728
|
}
|
|
6729
|
-
.f-upload__input[data-v-
|
|
6729
|
+
.f-upload__input[data-v-ab699abf] {
|
|
6730
6730
|
display: none;
|
|
6731
6731
|
}
|
|
6732
|
-
.f-upload__title[data-v-
|
|
6733
|
-
font-size:
|
|
6734
|
-
font-weight:
|
|
6735
|
-
color: #
|
|
6732
|
+
.f-upload__title[data-v-ab699abf] {
|
|
6733
|
+
font-size: 14px;
|
|
6734
|
+
font-weight: 600;
|
|
6735
|
+
color: #606266;
|
|
6736
|
+
margin-top: 8px;
|
|
6736
6737
|
}
|
|
6737
|
-
.f-upload__hint[data-v-
|
|
6738
|
-
font-size:
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6738
|
+
.f-upload__hint[data-v-ab699abf] {
|
|
6739
|
+
font-size: 12px;
|
|
6740
|
+
color: #909399;
|
|
6741
|
+
margin-top: 4px;
|
|
6742
|
+
line-height: 1.5;
|
|
6743
|
+
}
|
|
6744
|
+
.f-upload__list[data-v-ab699abf] {
|
|
6745
|
+
display: flex;
|
|
6746
|
+
flex-direction: column;
|
|
6747
|
+
gap: 8px;
|
|
6743
6748
|
}
|
|
6744
|
-
.f-upload__file-item[data-v-
|
|
6749
|
+
.f-upload__file-item[data-v-ab699abf] {
|
|
6745
6750
|
display: flex;
|
|
6746
6751
|
align-items: center;
|
|
6747
|
-
gap:
|
|
6748
|
-
padding:
|
|
6749
|
-
background:
|
|
6750
|
-
border: 1px solid #
|
|
6751
|
-
border-radius:
|
|
6752
|
-
font-size:
|
|
6753
|
-
color: #
|
|
6752
|
+
gap: 8px;
|
|
6753
|
+
padding: 8px 12px;
|
|
6754
|
+
background: #ecf5ff;
|
|
6755
|
+
border: 1px solid #d9ecff;
|
|
6756
|
+
border-radius: 4px;
|
|
6757
|
+
font-size: 14px;
|
|
6758
|
+
color: #409eff;
|
|
6759
|
+
transition: all 0.2s;
|
|
6760
|
+
}
|
|
6761
|
+
.f-upload__file-item--uploading[data-v-ab699abf] {
|
|
6762
|
+
background: #ecf5ff;
|
|
6763
|
+
border-color: #d9ecff;
|
|
6764
|
+
color: #409eff;
|
|
6754
6765
|
}
|
|
6755
|
-
.f-upload__file-
|
|
6766
|
+
.f-upload__file-item--error[data-v-ab699abf] {
|
|
6767
|
+
background: #fef0f0;
|
|
6768
|
+
border-color: #fde2e2;
|
|
6769
|
+
color: #f56c6c;
|
|
6770
|
+
}
|
|
6771
|
+
.f-upload__file-item--success[data-v-ab699abf] {
|
|
6772
|
+
background: #f0f9ff;
|
|
6773
|
+
border-color: #e1f3d8;
|
|
6774
|
+
color: #67c23a;
|
|
6775
|
+
}
|
|
6776
|
+
.f-upload__file-info[data-v-ab699abf] {
|
|
6756
6777
|
display: flex;
|
|
6757
6778
|
flex-direction: column;
|
|
6758
|
-
gap:
|
|
6779
|
+
gap: 4px;
|
|
6759
6780
|
flex: 1;
|
|
6760
6781
|
min-width: 0;
|
|
6761
6782
|
}
|
|
6762
|
-
.f-upload__file-name[data-v-
|
|
6763
|
-
font-weight:
|
|
6783
|
+
.f-upload__file-name[data-v-ab699abf] {
|
|
6784
|
+
font-weight: 500;
|
|
6764
6785
|
overflow: hidden;
|
|
6765
6786
|
text-overflow: ellipsis;
|
|
6766
6787
|
white-space: nowrap;
|
|
6788
|
+
}
|
|
6789
|
+
.f-upload__file-error[data-v-ab699abf] {
|
|
6790
|
+
font-size: 12px;
|
|
6791
|
+
color: #f56c6c;
|
|
6767
6792
|
}.f-button-group[data-v-62561657] {
|
|
6768
6793
|
display: inline-flex;
|
|
6769
6794
|
vertical-align: middle;
|
package/dist/fantasia-ui.es.js
CHANGED
|
@@ -38,7 +38,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
import { defineComponent, computed, createElementBlock, openBlock, normalizeStyle, unref, renderSlot, normalizeClass, createCommentVNode, Fragment, renderList, createElementVNode, toDisplayString, ref, watch, createVNode, withDirectives, Transition, withCtx, vShow, mergeModels, useModel, inject, createBlock, resolveDynamicComponent, nextTick, onUnmounted, Teleport, withModifiers, withKeys, isRef, vModelText, createTextVNode, TransitionGroup, useSlots, provide, onMounted, readonly, onBeforeUnmount, reactive, toRefs, createStaticVNode, h, render } from "vue";
|
|
41
|
-
import { CloseCircleOutline, EyeOutline, EyeOffOutline, StarOutline, StarHalf, Star, ChevronDownOutline, ChevronBackOutline, EllipsisHorizontal, ChevronForwardOutline, CloseCircle, Close, Person, InformationCircleOutline, WarningOutline, AlertCircleOutline, CheckmarkCircleOutline, CloudUpload, DocumentOutline, RemoveOutline, AddOutline, ChevronUpOutline, InformationCircle,
|
|
41
|
+
import { CloseCircleOutline, EyeOutline, EyeOffOutline, StarOutline, StarHalf, Star, ChevronDownOutline, ChevronBackOutline, EllipsisHorizontal, ChevronForwardOutline, CloseCircle, Close, Person, InformationCircleOutline, WarningOutline, AlertCircleOutline, CheckmarkCircleOutline, CloudUpload, CheckmarkCircle, AlertCircle, DocumentOutline, Reload, RemoveOutline, AddOutline, ChevronUpOutline, InformationCircle, CloseOutline, Warning } from "@vicons/ionicons5";
|
|
42
42
|
import { useEventListener } from "@vueuse/core";
|
|
43
43
|
const _sfc_main$R = /* @__PURE__ */ defineComponent({
|
|
44
44
|
__name: "FIcon",
|
|
@@ -721,7 +721,7 @@ const _hoisted_7$5 = {
|
|
|
721
721
|
key: 0,
|
|
722
722
|
class: "page-btn ellipsis"
|
|
723
723
|
};
|
|
724
|
-
const _hoisted_8$
|
|
724
|
+
const _hoisted_8$4 = ["onClick"];
|
|
725
725
|
const _hoisted_9$3 = {
|
|
726
726
|
key: 5,
|
|
727
727
|
class: "f-pagination__jump"
|
|
@@ -817,7 +817,7 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
|
|
|
817
817
|
key: 1,
|
|
818
818
|
class: normalizeClass(["page-btn", { active: currentPage.value === page }]),
|
|
819
819
|
onClick: ($event) => go(page)
|
|
820
|
-
}, toDisplayString(page), 11, _hoisted_8$
|
|
820
|
+
}, toDisplayString(page), 11, _hoisted_8$4))
|
|
821
821
|
], 64);
|
|
822
822
|
}), 128))
|
|
823
823
|
])) : item === "next" ? (openBlock(), createElementBlock("button", {
|
|
@@ -881,7 +881,7 @@ const _hoisted_7$4 = {
|
|
|
881
881
|
key: 0,
|
|
882
882
|
class: "f-card__header-extra"
|
|
883
883
|
};
|
|
884
|
-
const _hoisted_8$
|
|
884
|
+
const _hoisted_8$3 = {
|
|
885
885
|
key: 1,
|
|
886
886
|
class: "f-card__cover"
|
|
887
887
|
};
|
|
@@ -928,7 +928,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
928
928
|
renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)
|
|
929
929
|
])) : createCommentVNode("", true)
|
|
930
930
|
])) : createCommentVNode("", true),
|
|
931
|
-
_ctx.$slots.cover ? (openBlock(), createElementBlock("div", _hoisted_8$
|
|
931
|
+
_ctx.$slots.cover ? (openBlock(), createElementBlock("div", _hoisted_8$3, [
|
|
932
932
|
renderSlot(_ctx.$slots, "cover", {}, void 0, true)
|
|
933
933
|
])) : createCommentVNode("", true),
|
|
934
934
|
createElementVNode("div", _hoisted_9$2, [
|
|
@@ -2382,7 +2382,7 @@ const _hoisted_4$a = ["onClick"];
|
|
|
2382
2382
|
const _hoisted_5$7 = { class: "f-transfer__actions" };
|
|
2383
2383
|
const _hoisted_6$6 = ["disabled"];
|
|
2384
2384
|
const _hoisted_7$3 = ["disabled"];
|
|
2385
|
-
const _hoisted_8$
|
|
2385
|
+
const _hoisted_8$2 = { class: "f-transfer__panel" };
|
|
2386
2386
|
const _hoisted_9$1 = { class: "f-transfer__header" };
|
|
2387
2387
|
const _hoisted_10$1 = { class: "f-transfer__list" };
|
|
2388
2388
|
const _hoisted_11$1 = ["onClick"];
|
|
@@ -2468,7 +2468,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2468
2468
|
onClick: _cache[1] || (_cache[1] = ($event) => moveSelected("left"))
|
|
2469
2469
|
}, " ← ", 8, _hoisted_7$3)
|
|
2470
2470
|
]),
|
|
2471
|
-
createElementVNode("div", _hoisted_8$
|
|
2471
|
+
createElementVNode("div", _hoisted_8$2, [
|
|
2472
2472
|
createElementVNode("div", _hoisted_9$1, toDisplayString(_ctx.rightTitle), 1),
|
|
2473
2473
|
createElementVNode("ul", _hoisted_10$1, [
|
|
2474
2474
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rightList), (item) => {
|
|
@@ -2805,7 +2805,7 @@ const _hoisted_6$4 = {
|
|
|
2805
2805
|
class: "f-table__th f-table__th--index"
|
|
2806
2806
|
};
|
|
2807
2807
|
const _hoisted_7$2 = { class: "f-table__th-inner" };
|
|
2808
|
-
const _hoisted_8 = { class: "f-table__body" };
|
|
2808
|
+
const _hoisted_8$1 = { class: "f-table__body" };
|
|
2809
2809
|
const _hoisted_9 = {
|
|
2810
2810
|
key: 0,
|
|
2811
2811
|
class: "f-table__spacer"
|
|
@@ -2928,7 +2928,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2928
2928
|
}), 128))
|
|
2929
2929
|
])
|
|
2930
2930
|
]),
|
|
2931
|
-
createElementVNode("tbody", _hoisted_8, [
|
|
2931
|
+
createElementVNode("tbody", _hoisted_8$1, [
|
|
2932
2932
|
unref(offsetTop) > 0 ? (openBlock(), createElementBlock("tr", _hoisted_9, [
|
|
2933
2933
|
createElementVNode("td", {
|
|
2934
2934
|
colspan: unref(colSpan),
|
|
@@ -2995,34 +2995,96 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
2995
2995
|
});
|
|
2996
2996
|
const FTable = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-01724962"]]);
|
|
2997
2997
|
const _hoisted_1$c = { class: "f-upload" };
|
|
2998
|
-
const _hoisted_2$a = ["accept"];
|
|
2998
|
+
const _hoisted_2$a = ["accept", "multiple"];
|
|
2999
2999
|
const _hoisted_3$a = { class: "f-upload__zone" };
|
|
3000
3000
|
const _hoisted_4$7 = { class: "f-upload__hint" };
|
|
3001
3001
|
const _hoisted_5$4 = {
|
|
3002
3002
|
key: 0,
|
|
3003
|
-
class: "f-
|
|
3003
|
+
class: "f-upload__list"
|
|
3004
3004
|
};
|
|
3005
3005
|
const _hoisted_6$3 = { class: "f-upload__file-info" };
|
|
3006
3006
|
const _hoisted_7$1 = { class: "f-upload__file-name" };
|
|
3007
|
+
const _hoisted_8 = {
|
|
3008
|
+
key: 1,
|
|
3009
|
+
class: "f-upload__file-error"
|
|
3010
|
+
};
|
|
3007
3011
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
3008
3012
|
__name: "FUpload",
|
|
3009
3013
|
props: /* @__PURE__ */ mergeModels({
|
|
3010
3014
|
accept: {},
|
|
3015
|
+
hint: { default: "支持 .xlsx .xls .json .txt" },
|
|
3011
3016
|
limit: {},
|
|
3012
|
-
|
|
3013
|
-
|
|
3017
|
+
autoUpload: { type: Boolean, default: true },
|
|
3018
|
+
beforeUpload: {},
|
|
3019
|
+
httpRequest: {}
|
|
3014
3020
|
}, {
|
|
3015
|
-
"
|
|
3016
|
-
"
|
|
3021
|
+
"fileList": { default: () => [] },
|
|
3022
|
+
"fileListModifiers": {}
|
|
3017
3023
|
}),
|
|
3018
|
-
emits: /* @__PURE__ */ mergeModels(["change", "exceed"], ["update:
|
|
3019
|
-
setup(__props, { emit: __emit }) {
|
|
3020
|
-
const
|
|
3024
|
+
emits: /* @__PURE__ */ mergeModels(["change", "progress", "success", "error", "remove", "exceed"], ["update:fileList"]),
|
|
3025
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3026
|
+
const fileList = useModel(__props, "fileList");
|
|
3027
|
+
const props = __props;
|
|
3021
3028
|
const emit = __emit;
|
|
3022
3029
|
const dragActive = ref(false);
|
|
3023
|
-
const
|
|
3024
|
-
const
|
|
3025
|
-
|
|
3030
|
+
const hoveredUid = ref(null);
|
|
3031
|
+
const genUid = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
3032
|
+
const findItem = (uid) => fileList.value.find((f) => f.uid === uid);
|
|
3033
|
+
const updateItem = (uid, patch) => {
|
|
3034
|
+
const item = findItem(uid);
|
|
3035
|
+
if (item) Object.assign(item, patch);
|
|
3036
|
+
return item;
|
|
3037
|
+
};
|
|
3038
|
+
const submitUpload = (item) => __async(null, null, function* () {
|
|
3039
|
+
if (!props.httpRequest) return;
|
|
3040
|
+
updateItem(item.uid, { status: "uploading", percentage: 0 });
|
|
3041
|
+
try {
|
|
3042
|
+
const response = yield props.httpRequest(item.raw, (percent) => {
|
|
3043
|
+
const current = updateItem(item.uid, { percentage: percent });
|
|
3044
|
+
if (current) emit("progress", current);
|
|
3045
|
+
});
|
|
3046
|
+
const done = updateItem(item.uid, { status: "success", percentage: 100, response });
|
|
3047
|
+
if (done) emit("success", done, response);
|
|
3048
|
+
} catch (err) {
|
|
3049
|
+
const failed = updateItem(item.uid, { status: "error", errorMessage: (err == null ? void 0 : err.message) || "上传失败" });
|
|
3050
|
+
if (failed) emit("error", failed, err);
|
|
3051
|
+
}
|
|
3052
|
+
});
|
|
3053
|
+
const addFiles = (files) => __async(null, null, function* () {
|
|
3054
|
+
if (!files.length) return;
|
|
3055
|
+
const remaining = props.limit != null ? props.limit - fileList.value.length : Infinity;
|
|
3056
|
+
if (remaining <= 0) {
|
|
3057
|
+
emit("exceed", files);
|
|
3058
|
+
return;
|
|
3059
|
+
}
|
|
3060
|
+
const accepted = files.slice(0, remaining);
|
|
3061
|
+
const rejected = files.slice(remaining);
|
|
3062
|
+
if (rejected.length) emit("exceed", rejected);
|
|
3063
|
+
for (const raw of accepted) {
|
|
3064
|
+
if (props.beforeUpload) {
|
|
3065
|
+
const ok = yield props.beforeUpload(raw);
|
|
3066
|
+
if (!ok) continue;
|
|
3067
|
+
}
|
|
3068
|
+
const item = {
|
|
3069
|
+
uid: genUid(),
|
|
3070
|
+
name: raw.name,
|
|
3071
|
+
status: "ready",
|
|
3072
|
+
percentage: 0,
|
|
3073
|
+
raw
|
|
3074
|
+
};
|
|
3075
|
+
fileList.value = [...fileList.value, item];
|
|
3076
|
+
emit("change", item);
|
|
3077
|
+
if (props.autoUpload) submitUpload(item);
|
|
3078
|
+
}
|
|
3079
|
+
});
|
|
3080
|
+
const retryUpload = (uid) => {
|
|
3081
|
+
const item = findItem(uid);
|
|
3082
|
+
if (item) submitUpload(item);
|
|
3083
|
+
};
|
|
3084
|
+
const removeFile = (uid) => {
|
|
3085
|
+
const item = findItem(uid);
|
|
3086
|
+
fileList.value = fileList.value.filter((f) => f.uid !== uid);
|
|
3087
|
+
if (item) emit("remove", item);
|
|
3026
3088
|
};
|
|
3027
3089
|
const onDragOver = (e) => {
|
|
3028
3090
|
e.preventDefault();
|
|
@@ -3036,18 +3098,26 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3036
3098
|
var _a, _b;
|
|
3037
3099
|
e.preventDefault();
|
|
3038
3100
|
dragActive.value = false;
|
|
3039
|
-
const
|
|
3040
|
-
|
|
3041
|
-
emit("change", f);
|
|
3101
|
+
const files = Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.files) != null ? _b : []);
|
|
3102
|
+
addFiles(files);
|
|
3042
3103
|
};
|
|
3043
3104
|
const onFileChange = (e) => {
|
|
3044
3105
|
var _a;
|
|
3045
3106
|
const input = e.target;
|
|
3046
|
-
const
|
|
3047
|
-
if (!f) return;
|
|
3048
|
-
emit("change", f);
|
|
3107
|
+
const files = Array.from((_a = input.files) != null ? _a : []);
|
|
3049
3108
|
input.value = "";
|
|
3109
|
+
addFiles(files);
|
|
3050
3110
|
};
|
|
3111
|
+
__expose({
|
|
3112
|
+
/** 重试上传单个失败的文件 */
|
|
3113
|
+
retryUpload,
|
|
3114
|
+
/** 移除文件 */
|
|
3115
|
+
removeFile,
|
|
3116
|
+
/** 批量上传所有 ready 状态的文件 */
|
|
3117
|
+
submitAll: () => {
|
|
3118
|
+
fileList.value.filter((f) => f.status === "ready").forEach((item) => submitUpload(item));
|
|
3119
|
+
}
|
|
3120
|
+
});
|
|
3051
3121
|
return (_ctx, _cache) => {
|
|
3052
3122
|
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
3053
3123
|
createElementVNode("label", {
|
|
@@ -3059,6 +3129,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3059
3129
|
createElementVNode("input", {
|
|
3060
3130
|
type: "file",
|
|
3061
3131
|
accept: _ctx.accept,
|
|
3132
|
+
multiple: _ctx.limit == null || _ctx.limit > 1,
|
|
3062
3133
|
class: "f-upload__input",
|
|
3063
3134
|
onChange: onFileChange
|
|
3064
3135
|
}, null, 40, _hoisted_2$a),
|
|
@@ -3070,43 +3141,60 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3070
3141
|
]),
|
|
3071
3142
|
_: 1
|
|
3072
3143
|
}),
|
|
3073
|
-
_cache[
|
|
3144
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "f-upload__title" }, "点击或拖拽文件至此处", -1)),
|
|
3074
3145
|
createElementVNode("span", _hoisted_4$7, toDisplayString(_ctx.hint), 1)
|
|
3075
3146
|
])
|
|
3076
3147
|
], true)
|
|
3077
3148
|
], 34),
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
"
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3149
|
+
fileList.value.length ? (openBlock(), createElementBlock("div", _hoisted_5$4, [
|
|
3150
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(fileList.value, (item) => {
|
|
3151
|
+
return openBlock(), createElementBlock("div", {
|
|
3152
|
+
key: item.uid,
|
|
3153
|
+
class: normalizeClass(["f-upload__file-item", `f-upload__file-item--${item.status}`])
|
|
3154
|
+
}, [
|
|
3155
|
+
createVNode(FIcon, null, {
|
|
3156
|
+
default: withCtx(() => [
|
|
3157
|
+
(openBlock(), createBlock(resolveDynamicComponent(item.status === "success" ? unref(CheckmarkCircle) : item.status === "error" ? unref(AlertCircle) : unref(DocumentOutline))))
|
|
3158
|
+
]),
|
|
3159
|
+
_: 2
|
|
3160
|
+
}, 1024),
|
|
3161
|
+
createElementVNode("div", _hoisted_6$3, [
|
|
3162
|
+
createElementVNode("span", _hoisted_7$1, toDisplayString(item.name), 1),
|
|
3163
|
+
item.status === "uploading" ? (openBlock(), createBlock(FProgress, {
|
|
3164
|
+
key: 0,
|
|
3165
|
+
percent: item.percentage,
|
|
3166
|
+
"show-text": ""
|
|
3167
|
+
}, null, 8, ["percent"])) : item.status === "error" ? (openBlock(), createElementBlock("span", _hoisted_8, toDisplayString(item.errorMessage), 1)) : createCommentVNode("", true)
|
|
3168
|
+
]),
|
|
3169
|
+
item.status === "error" ? (openBlock(), createBlock(FIcon, {
|
|
3170
|
+
key: 0,
|
|
3171
|
+
onClick: withModifiers(($event) => retryUpload(item.uid), ["stop"]),
|
|
3172
|
+
style: { "cursor": "pointer" }
|
|
3173
|
+
}, {
|
|
3174
|
+
default: withCtx(() => [
|
|
3175
|
+
createVNode(unref(Reload))
|
|
3176
|
+
]),
|
|
3177
|
+
_: 2
|
|
3178
|
+
}, 1032, ["onClick"])) : createCommentVNode("", true),
|
|
3179
|
+
createVNode(FIcon, {
|
|
3180
|
+
onClick: withModifiers(($event) => removeFile(item.uid), ["stop"]),
|
|
3181
|
+
onMouseenter: ($event) => hoveredUid.value = item.uid,
|
|
3182
|
+
onMouseleave: _cache[0] || (_cache[0] = ($event) => hoveredUid.value = null),
|
|
3183
|
+
style: { "cursor": "pointer", "transition": "color 0.2s" }
|
|
3184
|
+
}, {
|
|
3185
|
+
default: withCtx(() => [
|
|
3186
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(hoveredUid) === item.uid ? unref(CloseCircle) : unref(Close))))
|
|
3187
|
+
]),
|
|
3188
|
+
_: 2
|
|
3189
|
+
}, 1032, ["onClick", "onMouseenter"])
|
|
3190
|
+
], 2);
|
|
3191
|
+
}), 128))
|
|
3104
3192
|
])) : createCommentVNode("", true)
|
|
3105
3193
|
]);
|
|
3106
3194
|
};
|
|
3107
3195
|
}
|
|
3108
3196
|
});
|
|
3109
|
-
const FUpload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-
|
|
3197
|
+
const FUpload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-ab699abf"]]);
|
|
3110
3198
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
3111
3199
|
__name: "FButtonGroup",
|
|
3112
3200
|
props: {
|
package/dist/fantasia-ui.umd.js
CHANGED
|
@@ -722,7 +722,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
722
722
|
key: 0,
|
|
723
723
|
class: "page-btn ellipsis"
|
|
724
724
|
};
|
|
725
|
-
const _hoisted_8$
|
|
725
|
+
const _hoisted_8$4 = ["onClick"];
|
|
726
726
|
const _hoisted_9$3 = {
|
|
727
727
|
key: 5,
|
|
728
728
|
class: "f-pagination__jump"
|
|
@@ -818,7 +818,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
818
818
|
key: 1,
|
|
819
819
|
class: vue.normalizeClass(["page-btn", { active: currentPage.value === page }]),
|
|
820
820
|
onClick: ($event) => go(page)
|
|
821
|
-
}, vue.toDisplayString(page), 11, _hoisted_8$
|
|
821
|
+
}, vue.toDisplayString(page), 11, _hoisted_8$4))
|
|
822
822
|
], 64);
|
|
823
823
|
}), 128))
|
|
824
824
|
])) : item === "next" ? (vue.openBlock(), vue.createElementBlock("button", {
|
|
@@ -882,7 +882,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
882
882
|
key: 0,
|
|
883
883
|
class: "f-card__header-extra"
|
|
884
884
|
};
|
|
885
|
-
const _hoisted_8$
|
|
885
|
+
const _hoisted_8$3 = {
|
|
886
886
|
key: 1,
|
|
887
887
|
class: "f-card__cover"
|
|
888
888
|
};
|
|
@@ -929,7 +929,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
929
929
|
vue.renderSlot(_ctx.$slots, "header-extra", {}, void 0, true)
|
|
930
930
|
])) : vue.createCommentVNode("", true)
|
|
931
931
|
])) : vue.createCommentVNode("", true),
|
|
932
|
-
_ctx.$slots.cover ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$
|
|
932
|
+
_ctx.$slots.cover ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_8$3, [
|
|
933
933
|
vue.renderSlot(_ctx.$slots, "cover", {}, void 0, true)
|
|
934
934
|
])) : vue.createCommentVNode("", true),
|
|
935
935
|
vue.createElementVNode("div", _hoisted_9$2, [
|
|
@@ -2383,7 +2383,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2383
2383
|
const _hoisted_5$7 = { class: "f-transfer__actions" };
|
|
2384
2384
|
const _hoisted_6$6 = ["disabled"];
|
|
2385
2385
|
const _hoisted_7$3 = ["disabled"];
|
|
2386
|
-
const _hoisted_8$
|
|
2386
|
+
const _hoisted_8$2 = { class: "f-transfer__panel" };
|
|
2387
2387
|
const _hoisted_9$1 = { class: "f-transfer__header" };
|
|
2388
2388
|
const _hoisted_10$1 = { class: "f-transfer__list" };
|
|
2389
2389
|
const _hoisted_11$1 = ["onClick"];
|
|
@@ -2469,7 +2469,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2469
2469
|
onClick: _cache[1] || (_cache[1] = ($event) => moveSelected("left"))
|
|
2470
2470
|
}, " ← ", 8, _hoisted_7$3)
|
|
2471
2471
|
]),
|
|
2472
|
-
vue.createElementVNode("div", _hoisted_8$
|
|
2472
|
+
vue.createElementVNode("div", _hoisted_8$2, [
|
|
2473
2473
|
vue.createElementVNode("div", _hoisted_9$1, vue.toDisplayString(_ctx.rightTitle), 1),
|
|
2474
2474
|
vue.createElementVNode("ul", _hoisted_10$1, [
|
|
2475
2475
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rightList), (item) => {
|
|
@@ -2806,7 +2806,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2806
2806
|
class: "f-table__th f-table__th--index"
|
|
2807
2807
|
};
|
|
2808
2808
|
const _hoisted_7$2 = { class: "f-table__th-inner" };
|
|
2809
|
-
const _hoisted_8 = { class: "f-table__body" };
|
|
2809
|
+
const _hoisted_8$1 = { class: "f-table__body" };
|
|
2810
2810
|
const _hoisted_9 = {
|
|
2811
2811
|
key: 0,
|
|
2812
2812
|
class: "f-table__spacer"
|
|
@@ -2929,7 +2929,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2929
2929
|
}), 128))
|
|
2930
2930
|
])
|
|
2931
2931
|
]),
|
|
2932
|
-
vue.createElementVNode("tbody", _hoisted_8, [
|
|
2932
|
+
vue.createElementVNode("tbody", _hoisted_8$1, [
|
|
2933
2933
|
vue.unref(offsetTop) > 0 ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_9, [
|
|
2934
2934
|
vue.createElementVNode("td", {
|
|
2935
2935
|
colspan: vue.unref(colSpan),
|
|
@@ -2996,34 +2996,96 @@ var __async = (__this, __arguments, generator) => {
|
|
|
2996
2996
|
});
|
|
2997
2997
|
const FTable = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-01724962"]]);
|
|
2998
2998
|
const _hoisted_1$c = { class: "f-upload" };
|
|
2999
|
-
const _hoisted_2$a = ["accept"];
|
|
2999
|
+
const _hoisted_2$a = ["accept", "multiple"];
|
|
3000
3000
|
const _hoisted_3$a = { class: "f-upload__zone" };
|
|
3001
3001
|
const _hoisted_4$7 = { class: "f-upload__hint" };
|
|
3002
3002
|
const _hoisted_5$4 = {
|
|
3003
3003
|
key: 0,
|
|
3004
|
-
class: "f-
|
|
3004
|
+
class: "f-upload__list"
|
|
3005
3005
|
};
|
|
3006
3006
|
const _hoisted_6$3 = { class: "f-upload__file-info" };
|
|
3007
3007
|
const _hoisted_7$1 = { class: "f-upload__file-name" };
|
|
3008
|
+
const _hoisted_8 = {
|
|
3009
|
+
key: 1,
|
|
3010
|
+
class: "f-upload__file-error"
|
|
3011
|
+
};
|
|
3008
3012
|
const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
|
|
3009
3013
|
__name: "FUpload",
|
|
3010
3014
|
props: /* @__PURE__ */ vue.mergeModels({
|
|
3011
3015
|
accept: {},
|
|
3016
|
+
hint: { default: "支持 .xlsx .xls .json .txt" },
|
|
3012
3017
|
limit: {},
|
|
3013
|
-
|
|
3014
|
-
|
|
3018
|
+
autoUpload: { type: Boolean, default: true },
|
|
3019
|
+
beforeUpload: {},
|
|
3020
|
+
httpRequest: {}
|
|
3015
3021
|
}, {
|
|
3016
|
-
"
|
|
3017
|
-
"
|
|
3022
|
+
"fileList": { default: () => [] },
|
|
3023
|
+
"fileListModifiers": {}
|
|
3018
3024
|
}),
|
|
3019
|
-
emits: /* @__PURE__ */ vue.mergeModels(["change", "exceed"], ["update:
|
|
3020
|
-
setup(__props, { emit: __emit }) {
|
|
3021
|
-
const
|
|
3025
|
+
emits: /* @__PURE__ */ vue.mergeModels(["change", "progress", "success", "error", "remove", "exceed"], ["update:fileList"]),
|
|
3026
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
3027
|
+
const fileList = vue.useModel(__props, "fileList");
|
|
3028
|
+
const props = __props;
|
|
3022
3029
|
const emit = __emit;
|
|
3023
3030
|
const dragActive = vue.ref(false);
|
|
3024
|
-
const
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3031
|
+
const hoveredUid = vue.ref(null);
|
|
3032
|
+
const genUid = () => `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
3033
|
+
const findItem = (uid) => fileList.value.find((f) => f.uid === uid);
|
|
3034
|
+
const updateItem = (uid, patch) => {
|
|
3035
|
+
const item = findItem(uid);
|
|
3036
|
+
if (item) Object.assign(item, patch);
|
|
3037
|
+
return item;
|
|
3038
|
+
};
|
|
3039
|
+
const submitUpload = (item) => __async(null, null, function* () {
|
|
3040
|
+
if (!props.httpRequest) return;
|
|
3041
|
+
updateItem(item.uid, { status: "uploading", percentage: 0 });
|
|
3042
|
+
try {
|
|
3043
|
+
const response = yield props.httpRequest(item.raw, (percent) => {
|
|
3044
|
+
const current = updateItem(item.uid, { percentage: percent });
|
|
3045
|
+
if (current) emit("progress", current);
|
|
3046
|
+
});
|
|
3047
|
+
const done = updateItem(item.uid, { status: "success", percentage: 100, response });
|
|
3048
|
+
if (done) emit("success", done, response);
|
|
3049
|
+
} catch (err) {
|
|
3050
|
+
const failed = updateItem(item.uid, { status: "error", errorMessage: (err == null ? void 0 : err.message) || "上传失败" });
|
|
3051
|
+
if (failed) emit("error", failed, err);
|
|
3052
|
+
}
|
|
3053
|
+
});
|
|
3054
|
+
const addFiles = (files) => __async(null, null, function* () {
|
|
3055
|
+
if (!files.length) return;
|
|
3056
|
+
const remaining = props.limit != null ? props.limit - fileList.value.length : Infinity;
|
|
3057
|
+
if (remaining <= 0) {
|
|
3058
|
+
emit("exceed", files);
|
|
3059
|
+
return;
|
|
3060
|
+
}
|
|
3061
|
+
const accepted = files.slice(0, remaining);
|
|
3062
|
+
const rejected = files.slice(remaining);
|
|
3063
|
+
if (rejected.length) emit("exceed", rejected);
|
|
3064
|
+
for (const raw of accepted) {
|
|
3065
|
+
if (props.beforeUpload) {
|
|
3066
|
+
const ok = yield props.beforeUpload(raw);
|
|
3067
|
+
if (!ok) continue;
|
|
3068
|
+
}
|
|
3069
|
+
const item = {
|
|
3070
|
+
uid: genUid(),
|
|
3071
|
+
name: raw.name,
|
|
3072
|
+
status: "ready",
|
|
3073
|
+
percentage: 0,
|
|
3074
|
+
raw
|
|
3075
|
+
};
|
|
3076
|
+
fileList.value = [...fileList.value, item];
|
|
3077
|
+
emit("change", item);
|
|
3078
|
+
if (props.autoUpload) submitUpload(item);
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
|
+
const retryUpload = (uid) => {
|
|
3082
|
+
const item = findItem(uid);
|
|
3083
|
+
if (item) submitUpload(item);
|
|
3084
|
+
};
|
|
3085
|
+
const removeFile = (uid) => {
|
|
3086
|
+
const item = findItem(uid);
|
|
3087
|
+
fileList.value = fileList.value.filter((f) => f.uid !== uid);
|
|
3088
|
+
if (item) emit("remove", item);
|
|
3027
3089
|
};
|
|
3028
3090
|
const onDragOver = (e) => {
|
|
3029
3091
|
e.preventDefault();
|
|
@@ -3037,18 +3099,26 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3037
3099
|
var _a, _b;
|
|
3038
3100
|
e.preventDefault();
|
|
3039
3101
|
dragActive.value = false;
|
|
3040
|
-
const
|
|
3041
|
-
|
|
3042
|
-
emit("change", f);
|
|
3102
|
+
const files = Array.from((_b = (_a = e.dataTransfer) == null ? void 0 : _a.files) != null ? _b : []);
|
|
3103
|
+
addFiles(files);
|
|
3043
3104
|
};
|
|
3044
3105
|
const onFileChange = (e) => {
|
|
3045
3106
|
var _a;
|
|
3046
3107
|
const input = e.target;
|
|
3047
|
-
const
|
|
3048
|
-
if (!f) return;
|
|
3049
|
-
emit("change", f);
|
|
3108
|
+
const files = Array.from((_a = input.files) != null ? _a : []);
|
|
3050
3109
|
input.value = "";
|
|
3110
|
+
addFiles(files);
|
|
3051
3111
|
};
|
|
3112
|
+
__expose({
|
|
3113
|
+
/** 重试上传单个失败的文件 */
|
|
3114
|
+
retryUpload,
|
|
3115
|
+
/** 移除文件 */
|
|
3116
|
+
removeFile,
|
|
3117
|
+
/** 批量上传所有 ready 状态的文件 */
|
|
3118
|
+
submitAll: () => {
|
|
3119
|
+
fileList.value.filter((f) => f.status === "ready").forEach((item) => submitUpload(item));
|
|
3120
|
+
}
|
|
3121
|
+
});
|
|
3052
3122
|
return (_ctx, _cache) => {
|
|
3053
3123
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
|
|
3054
3124
|
vue.createElementVNode("label", {
|
|
@@ -3060,6 +3130,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3060
3130
|
vue.createElementVNode("input", {
|
|
3061
3131
|
type: "file",
|
|
3062
3132
|
accept: _ctx.accept,
|
|
3133
|
+
multiple: _ctx.limit == null || _ctx.limit > 1,
|
|
3063
3134
|
class: "f-upload__input",
|
|
3064
3135
|
onChange: onFileChange
|
|
3065
3136
|
}, null, 40, _hoisted_2$a),
|
|
@@ -3071,43 +3142,60 @@ var __async = (__this, __arguments, generator) => {
|
|
|
3071
3142
|
]),
|
|
3072
3143
|
_: 1
|
|
3073
3144
|
}),
|
|
3074
|
-
_cache[
|
|
3145
|
+
_cache[1] || (_cache[1] = vue.createElementVNode("span", { class: "f-upload__title" }, "点击或拖拽文件至此处", -1)),
|
|
3075
3146
|
vue.createElementVNode("span", _hoisted_4$7, vue.toDisplayString(_ctx.hint), 1)
|
|
3076
3147
|
])
|
|
3077
3148
|
], true)
|
|
3078
3149
|
], 34),
|
|
3079
|
-
|
|
3080
|
-
vue.
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
"
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3150
|
+
fileList.value.length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
|
|
3151
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(fileList.value, (item) => {
|
|
3152
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3153
|
+
key: item.uid,
|
|
3154
|
+
class: vue.normalizeClass(["f-upload__file-item", `f-upload__file-item--${item.status}`])
|
|
3155
|
+
}, [
|
|
3156
|
+
vue.createVNode(FIcon, null, {
|
|
3157
|
+
default: vue.withCtx(() => [
|
|
3158
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(item.status === "success" ? vue.unref(ionicons5.CheckmarkCircle) : item.status === "error" ? vue.unref(ionicons5.AlertCircle) : vue.unref(ionicons5.DocumentOutline))))
|
|
3159
|
+
]),
|
|
3160
|
+
_: 2
|
|
3161
|
+
}, 1024),
|
|
3162
|
+
vue.createElementVNode("div", _hoisted_6$3, [
|
|
3163
|
+
vue.createElementVNode("span", _hoisted_7$1, vue.toDisplayString(item.name), 1),
|
|
3164
|
+
item.status === "uploading" ? (vue.openBlock(), vue.createBlock(FProgress, {
|
|
3165
|
+
key: 0,
|
|
3166
|
+
percent: item.percentage,
|
|
3167
|
+
"show-text": ""
|
|
3168
|
+
}, null, 8, ["percent"])) : item.status === "error" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_8, vue.toDisplayString(item.errorMessage), 1)) : vue.createCommentVNode("", true)
|
|
3169
|
+
]),
|
|
3170
|
+
item.status === "error" ? (vue.openBlock(), vue.createBlock(FIcon, {
|
|
3171
|
+
key: 0,
|
|
3172
|
+
onClick: vue.withModifiers(($event) => retryUpload(item.uid), ["stop"]),
|
|
3173
|
+
style: { "cursor": "pointer" }
|
|
3174
|
+
}, {
|
|
3175
|
+
default: vue.withCtx(() => [
|
|
3176
|
+
vue.createVNode(vue.unref(ionicons5.Reload))
|
|
3177
|
+
]),
|
|
3178
|
+
_: 2
|
|
3179
|
+
}, 1032, ["onClick"])) : vue.createCommentVNode("", true),
|
|
3180
|
+
vue.createVNode(FIcon, {
|
|
3181
|
+
onClick: vue.withModifiers(($event) => removeFile(item.uid), ["stop"]),
|
|
3182
|
+
onMouseenter: ($event) => hoveredUid.value = item.uid,
|
|
3183
|
+
onMouseleave: _cache[0] || (_cache[0] = ($event) => hoveredUid.value = null),
|
|
3184
|
+
style: { "cursor": "pointer", "transition": "color 0.2s" }
|
|
3185
|
+
}, {
|
|
3186
|
+
default: vue.withCtx(() => [
|
|
3187
|
+
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(hoveredUid) === item.uid ? vue.unref(ionicons5.CloseCircle) : vue.unref(ionicons5.Close))))
|
|
3188
|
+
]),
|
|
3189
|
+
_: 2
|
|
3190
|
+
}, 1032, ["onClick", "onMouseenter"])
|
|
3191
|
+
], 2);
|
|
3192
|
+
}), 128))
|
|
3105
3193
|
])) : vue.createCommentVNode("", true)
|
|
3106
3194
|
]);
|
|
3107
3195
|
};
|
|
3108
3196
|
}
|
|
3109
3197
|
});
|
|
3110
|
-
const FUpload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-
|
|
3198
|
+
const FUpload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-ab699abf"]]);
|
|
3111
3199
|
const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
|
|
3112
3200
|
__name: "FButtonGroup",
|
|
3113
3201
|
props: {
|
|
@@ -1,26 +1,38 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
limit?: number;
|
|
4
|
-
progress?: number | null;
|
|
5
|
-
hint?: string;
|
|
6
|
-
};
|
|
1
|
+
import type { FUploadProps, UploadFileItem } from '../../types';
|
|
2
|
+
type __VLS_Props = FUploadProps;
|
|
7
3
|
type __VLS_PublicProps = __VLS_Props & {
|
|
8
|
-
'
|
|
4
|
+
'fileList'?: UploadFileItem[];
|
|
9
5
|
};
|
|
10
6
|
declare var __VLS_1: {};
|
|
11
7
|
type __VLS_Slots = {} & {
|
|
12
8
|
default?: (props: typeof __VLS_1) => any;
|
|
13
9
|
};
|
|
14
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
11
|
+
/** 重试上传单个失败的文件 */
|
|
12
|
+
retryUpload: (uid: string) => void;
|
|
13
|
+
/** 移除文件 */
|
|
14
|
+
removeFile: (uid: string) => void;
|
|
15
|
+
/** 批量上传所有 ready 状态的文件 */
|
|
16
|
+
submitAll: () => void;
|
|
17
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
success: (file: UploadFileItem, response: string) => any;
|
|
19
|
+
error: (file: UploadFileItem, error: unknown) => any;
|
|
20
|
+
progress: (file: UploadFileItem) => any;
|
|
21
|
+
change: (file: UploadFileItem) => any;
|
|
22
|
+
remove: (file: UploadFileItem) => any;
|
|
23
|
+
exceed: (files: File[]) => any;
|
|
24
|
+
"update:fileList": (value: UploadFileItem[]) => any;
|
|
18
25
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
onSuccess?: (file: UploadFileItem, response: string) => any;
|
|
27
|
+
onError?: (file: UploadFileItem, error: unknown) => any;
|
|
28
|
+
onProgress?: (file: UploadFileItem) => any;
|
|
29
|
+
onChange?: (file: UploadFileItem) => any;
|
|
30
|
+
onRemove?: (file: UploadFileItem) => any;
|
|
31
|
+
onExceed?: (files: File[]) => any;
|
|
32
|
+
"onUpdate:fileList"?: (value: UploadFileItem[]) => any;
|
|
22
33
|
}>, {
|
|
23
34
|
hint: string;
|
|
35
|
+
autoUpload: boolean;
|
|
24
36
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
37
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
26
38
|
export default _default;
|
|
@@ -4,6 +4,4 @@ declare const install: Plugin;
|
|
|
4
4
|
export default install;
|
|
5
5
|
export * from './components';
|
|
6
6
|
export * from './composables';
|
|
7
|
-
export type { FDialogFn, FDialogOptions } from './types/components';
|
|
8
|
-
export type { FMessageFn, FMessageOptions, FMessageInstance } from './types/components';
|
|
9
|
-
export type { FNotificationFn, FNotificationOptions, FNotificationInstance } from './types/components';
|
|
7
|
+
export type { FDialogFn, FDialogOptions, FMessageFn, FMessageOptions, FMessageInstance, FNotificationFn, FNotificationOptions, FNotificationInstance, UploadFileItem } from './types/components';
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
interface FUploadProps {
|
|
2
|
+
accept?: string;
|
|
3
|
+
hint?: string;
|
|
4
|
+
/** 最多允许存在的文件数(数量限制,不是字节大小) */
|
|
5
|
+
limit?: number;
|
|
6
|
+
/** 选中后是否立即自动上传,默认 true */
|
|
7
|
+
autoUpload?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* 校验/拦截钩子:返回 false 或 reject 则该文件不会进入列表也不会上传。
|
|
10
|
+
* 用来做文件大小、类型等前置校验,替代过去分散在各业务组件里的校验代码。
|
|
11
|
+
*/
|
|
12
|
+
beforeUpload?: (file: File) => boolean | Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* 实际上传逻辑,由调用方注入——组件本身不关心用的是 fetch/axios/dispatcher,
|
|
15
|
+
* 只负责在合适的时机调用它,并把 onProgress 回调交给它在上传过程中调用。
|
|
16
|
+
*/
|
|
17
|
+
httpRequest?: (file: File, onProgress: (percent: number) => void) => Promise<string>;
|
|
10
18
|
}
|
|
11
|
-
|
|
19
|
+
interface UploadFileItem {
|
|
20
|
+
uid: string;
|
|
21
|
+
name: string;
|
|
22
|
+
status: 'ready' | 'uploading' | 'success' | 'error';
|
|
23
|
+
percentage: number;
|
|
24
|
+
raw: File;
|
|
25
|
+
response?: string;
|
|
26
|
+
errorMessage?: string;
|
|
27
|
+
}
|
|
28
|
+
export type { FUploadProps, UploadFileItem };
|