knt-shared 1.10.3 → 1.10.5

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
@@ -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
- "fa001152": cardSizeValue.value
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 result;
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-47c7dc74"]]);
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) || []);
@@ -6811,6 +6817,12 @@ function useTableEdit(props, dataSource, getRowKey) {
6811
6817
  cancelEdit(record);
6812
6818
  });
6813
6819
  };
6820
+ const clearEditingRows = () => {
6821
+ Object.keys(editingStateMap).forEach((key) => delete editingStateMap[key]);
6822
+ Object.keys(editValueMap).forEach((key) => delete editValueMap[key]);
6823
+ Object.keys(originalDataMap).forEach((key) => delete originalDataMap[key]);
6824
+ Object.keys(validationErrorMap).forEach((key) => delete validationErrorMap[key]);
6825
+ };
6814
6826
  return {
6815
6827
  editingStateMap,
6816
6828
  editValueMap,
@@ -6827,6 +6839,7 @@ function useTableEdit(props, dataSource, getRowKey) {
6827
6839
  getEditingRows,
6828
6840
  saveAllEdits,
6829
6841
  cancelAllEdits,
6842
+ clearEditingRows,
6830
6843
  getChangedValues
6831
6844
  };
6832
6845
  }
@@ -7150,6 +7163,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7150
7163
  getEditingRows,
7151
7164
  saveAllEdits,
7152
7165
  cancelAllEdits,
7166
+ clearEditingRows,
7153
7167
  getChangedValues
7154
7168
  } = useTableEdit(getMergedProps, dataSource, getRowKey);
7155
7169
  const originalColumnsMap = computed(() => {
@@ -7831,6 +7845,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7831
7845
  getEditingRows,
7832
7846
  saveAllEdits,
7833
7847
  cancelAllEdits,
7848
+ clearEditingRows,
7834
7849
  isEditing,
7835
7850
  getEditValue,
7836
7851
  setEditValue,
@@ -7875,6 +7890,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
7875
7890
  getEditingRows,
7876
7891
  saveAllEdits,
7877
7892
  cancelAllEdits,
7893
+ clearEditingRows,
7878
7894
  isEditing,
7879
7895
  getEditValue,
7880
7896
  setEditValue,
@@ -8344,7 +8360,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
8344
8360
  };
8345
8361
  }
8346
8362
  });
8347
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b3a2e402"]]);
8363
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-1a0967ac"]]);
8348
8364
  function useTable(options = {}) {
8349
8365
  const tableRef = ref(null);
8350
8366
  const formRef = ref(null);
@@ -8621,6 +8637,13 @@ function useTable(options = {}) {
8621
8637
  table.cancelAllEdits();
8622
8638
  }
8623
8639
  };
8640
+ const clearEditingRows = () => {
8641
+ const table = getTable();
8642
+ if (!table) return;
8643
+ if (table.clearEditingRows) {
8644
+ table.clearEditingRows();
8645
+ }
8646
+ };
8624
8647
  const isEditing = (record, column) => {
8625
8648
  const table = getTable();
8626
8649
  if (!table) return false;
@@ -8688,6 +8711,7 @@ function useTable(options = {}) {
8688
8711
  getEditingRows,
8689
8712
  saveAllEdits,
8690
8713
  cancelAllEdits,
8714
+ clearEditingRows,
8691
8715
  isEditing,
8692
8716
  getEditValue,
8693
8717
  setEditValue,