knt-shared 1.9.1 → 1.9.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
@@ -2932,12 +2932,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2932
2932
  preload: "metadata"
2933
2933
  }) },
2934
2934
  emptyText: { default: "-" },
2935
- showEmptyState: { type: Boolean, default: true }
2935
+ showEmptyState: { type: Boolean, default: true },
2936
+ showErrorMessage: { type: Boolean, default: true },
2937
+ showSuccessMessage: { type: Boolean, default: true }
2936
2938
  },
2937
2939
  emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed", "sortChange"],
2938
2940
  setup(__props, { expose: __expose, emit: __emit }) {
2939
2941
  useCssVars((_ctx) => ({
2940
- "f72d42ee": cardSizeValue.value
2942
+ "fa001152": cardSizeValue.value
2941
2943
  }));
2942
2944
  const MAX_SIZE_UNIT_BYTES = {
2943
2945
  B: 1,
@@ -3171,7 +3173,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3171
3173
  if (code !== 200) {
3172
3174
  const errorMsg = message ? `上传失败: ${message}` : "上传失败";
3173
3175
  onError(new Error(errorMsg));
3174
- Message.error(errorMsg);
3176
+ if (propsData.showErrorMessage) Message.error(errorMsg);
3175
3177
  return;
3176
3178
  }
3177
3179
  const extractedUrl = extractUrlFromResponse(response);
@@ -3179,14 +3181,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3179
3181
  if (!extractedUrl) {
3180
3182
  logger.warn("响应中未找到 URL 字段,可能导致上传状态异常");
3181
3183
  }
3182
- Message.success(`${fileItem.name} 上传成功`);
3184
+ if (propsData.showSuccessMessage) Message.success(`${fileItem.name} 上传成功`);
3183
3185
  onSuccess(normalizedResponse);
3184
3186
  } catch (error) {
3185
3187
  onSuccess({ data: xhr.responseText });
3186
3188
  }
3187
3189
  } else {
3188
3190
  const errorMsg = `上传失败: HTTP ${xhr.status}`;
3189
- Message.error(errorMsg);
3191
+ if (propsData.showErrorMessage) Message.error(errorMsg);
3190
3192
  onError(new Error(errorMsg));
3191
3193
  }
3192
3194
  });
@@ -3592,7 +3594,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3592
3594
  };
3593
3595
  }
3594
3596
  });
3595
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-13e8439f"]]);
3597
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-47c7dc74"]]);
3596
3598
  function useUpload(props) {
3597
3599
  const uploadRef = ref(null);
3598
3600
  const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);