knt-shared 1.2.1 → 1.2.2

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/index.esm.js CHANGED
@@ -703,9 +703,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
703
703
  autoUpload: { type: Boolean, default: true },
704
704
  resultType: { default: "fileList" },
705
705
  uploadButtonText: {},
706
- uploadButtonType: { default: "primary" }
706
+ uploadButtonType: { default: "primary" },
707
+ responseUrlKey: { type: [String, Function], default: void 0 }
707
708
  },
708
- emits: ["register", "update:modelValue", "change", "success", "error", "progress", "remove", "preview", "exceed"],
709
+ emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
709
710
  setup(__props, { expose: __expose, emit: __emit }) {
710
711
  const props = __props;
711
712
  const emit = __emit;
@@ -713,7 +714,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
713
714
  const fileListRef = ref([]);
714
715
  const propsRef = ref({});
715
716
  const hasShownActionError = ref(false);
716
- const isInternalUpdate = ref(false);
717
717
  const processedFiles = ref(/* @__PURE__ */ new Map());
718
718
  const getProps = computed(() => {
719
719
  return { ...props, ...unref(propsRef) };
@@ -930,7 +930,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
930
930
  };
931
931
  };
932
932
  const handleChange = (fileList, currentFile) => {
933
- if (isInternalUpdate.value) return;
934
933
  const oldLength = fileListRef.value.length;
935
934
  const newLength = fileList.length;
936
935
  fileListRef.value = fileList;
@@ -940,11 +939,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
940
939
  const lastStatus = processedFiles.value.get(fileKey);
941
940
  if (currentFile.status === "done" && lastStatus !== "done" && !isRemove) {
942
941
  processedFiles.value.set(fileKey, "done");
943
- emit("success", currentFile.response, currentFile);
942
+ emit("handleSuccess", currentFile.response, currentFile);
944
943
  } else if (currentFile.status === "error" && lastStatus !== "error") {
945
944
  processedFiles.value.set(fileKey, "error");
946
945
  const error = new Error("上传失败");
947
- emit("error", error, currentFile);
946
+ emit("handlError", error, currentFile);
948
947
  }
949
948
  if (isRemove) {
950
949
  const fileUids = new Set(fileList.map((f) => f.uid));
@@ -970,7 +969,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
970
969
  const updateModelValue = (fileList) => {
971
970
  var _a;
972
971
  const propsData = unref(getProps);
973
- isInternalUpdate.value = true;
974
972
  switch (propsData.resultType) {
975
973
  case "fileList":
976
974
  emit("update:modelValue", fileList);
@@ -991,11 +989,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
991
989
  default:
992
990
  emit("update:modelValue", fileList);
993
991
  }
994
- nextTick(() => {
995
- setTimeout(() => {
996
- isInternalUpdate.value = false;
997
- }, 50);
998
- });
999
992
  };
1000
993
  const parseModelValue = (value) => {
1001
994
  if (!value) return [];
@@ -1081,8 +1074,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1081
1074
  });
1082
1075
  watch(
1083
1076
  () => props.modelValue,
1084
- (val, oldVal) => {
1085
- if (isInternalUpdate.value) return;
1077
+ (val) => {
1086
1078
  fileListRef.value = parseModelValue(val);
1087
1079
  },
1088
1080
  { immediate: true }
@@ -1183,7 +1175,7 @@ const _export_sfc = (sfc, props) => {
1183
1175
  }
1184
1176
  return target;
1185
1177
  };
1186
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-10587859"]]);
1178
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1a5a7ff7"]]);
1187
1179
  const componentMap = {
1188
1180
  Input,
1189
1181
  InputNumber,