knt-shared 1.10.3 → 1.10.4
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/components/Upload/BasicUpload.vue.d.ts.map +1 -1
- package/dist/index.cjs.js +10 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/style.css +32 -32
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2956,7 +2956,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2956
2956
|
emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed", "sortChange"],
|
|
2957
2957
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2958
2958
|
useCssVars((_ctx) => ({
|
|
2959
|
-
"
|
|
2959
|
+
"v74ec8601": cardSizeValue.value
|
|
2960
2960
|
}));
|
|
2961
2961
|
const MAX_SIZE_UNIT_BYTES = {
|
|
2962
2962
|
B: 1,
|
|
@@ -2971,6 +2971,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
2971
2971
|
const propsRef = ref({});
|
|
2972
2972
|
const hasShownActionError = ref(false);
|
|
2973
2973
|
const processedFiles = ref(/* @__PURE__ */ new Map());
|
|
2974
|
+
const pendingCount = ref(0);
|
|
2974
2975
|
const previewVisible = ref(false);
|
|
2975
2976
|
const previewImageUrl = ref("");
|
|
2976
2977
|
const previewVideoUrl = ref("");
|
|
@@ -3083,7 +3084,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3083
3084
|
if (!validateFileType(file)) {
|
|
3084
3085
|
return false;
|
|
3085
3086
|
}
|
|
3086
|
-
if (propsData.maxCount && fileListRef.value.length >= propsData.maxCount) {
|
|
3087
|
+
if (propsData.maxCount && fileListRef.value.length + pendingCount.value >= propsData.maxCount) {
|
|
3087
3088
|
Message.error(`最多只能上传 ${propsData.maxCount} 个文件`);
|
|
3088
3089
|
emit("exceed", [file], fileListRef.value);
|
|
3089
3090
|
return false;
|
|
@@ -3091,12 +3092,13 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3091
3092
|
if (propsData.beforeUpload) {
|
|
3092
3093
|
try {
|
|
3093
3094
|
const result = await propsData.beforeUpload(file);
|
|
3094
|
-
return
|
|
3095
|
+
if (!result) return false;
|
|
3095
3096
|
} catch (error) {
|
|
3096
3097
|
console.error("beforeUpload error:", error);
|
|
3097
3098
|
return false;
|
|
3098
3099
|
}
|
|
3099
3100
|
}
|
|
3101
|
+
pendingCount.value++;
|
|
3100
3102
|
return true;
|
|
3101
3103
|
};
|
|
3102
3104
|
const handleCustomRequest = (options) => {
|
|
@@ -3263,6 +3265,10 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3263
3265
|
const handleChange = (fileList, currentFile) => {
|
|
3264
3266
|
const oldLength = fileListRef.value.length;
|
|
3265
3267
|
const newLength = fileList.length;
|
|
3268
|
+
if (newLength > oldLength) {
|
|
3269
|
+
const added = newLength - oldLength;
|
|
3270
|
+
pendingCount.value = Math.max(0, pendingCount.value - added);
|
|
3271
|
+
}
|
|
3266
3272
|
fileListRef.value = fileList;
|
|
3267
3273
|
addVideoFileClass();
|
|
3268
3274
|
emit("change", fileList);
|
|
@@ -3611,7 +3617,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3611
3617
|
};
|
|
3612
3618
|
}
|
|
3613
3619
|
});
|
|
3614
|
-
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-
|
|
3620
|
+
const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-d316e747"]]);
|
|
3615
3621
|
function useUpload(props) {
|
|
3616
3622
|
const uploadRef = ref(null);
|
|
3617
3623
|
const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
|