lew-ui 2.7.6 → 2.7.7

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.js CHANGED
@@ -2913,7 +2913,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
2913
2913
  };
2914
2914
  }
2915
2915
  });
2916
- const LewActionBox = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-178cbf07"]]);
2916
+ const LewActionBox = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__scopeId", "data-v-50cfe389"]]);
2917
2917
  const validColors = [
2918
2918
  "blue",
2919
2919
  "gray",
@@ -3048,7 +3048,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
3048
3048
  };
3049
3049
  }
3050
3050
  });
3051
- const LewAlert = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__scopeId", "data-v-9e8d77cb"]]);
3051
+ const LewAlert = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__scopeId", "data-v-35ce2ab7"]]);
3052
3052
  function tryOnScopeDispose(fn2) {
3053
3053
  if (getCurrentScope()) {
3054
3054
  onScopeDispose(fn2);
@@ -3928,7 +3928,9 @@ const avatarProps = {
3928
3928
  validator(value) {
3929
3929
  const validStatus = ["online", "processing", "away", "offline", "busy"];
3930
3930
  if (!validStatus.includes(value)) {
3931
- console.warn(`[LewAvatar] status 必须是 ${validStatus.join(", ")} 之一`);
3931
+ console.warn(
3932
+ `[LewAvatar] status 必须是 ${validStatus.join(", ")} 之一`
3933
+ );
3932
3934
  return false;
3933
3935
  }
3934
3936
  return true;
@@ -3991,7 +3993,9 @@ const avatarProps = {
3991
3993
  ];
3992
3994
  if (!validPlacements.includes(value)) {
3993
3995
  console.warn(
3994
- `[LewAvatar] statusPlacement 必须是 ${validPlacements.join(", ")} 之一`
3996
+ `[LewAvatar] statusPlacement 必须是 ${validPlacements.join(
3997
+ ", "
3998
+ )} 之一`
3995
3999
  );
3996
4000
  return false;
3997
4001
  }
@@ -4003,7 +4007,7 @@ const _hoisted_1$K = {
4003
4007
  key: 0,
4004
4008
  class: "skeleton"
4005
4009
  };
4006
- const _hoisted_2$s = ["src", "alt"];
4010
+ const _hoisted_2$s = ["alt", "src"];
4007
4011
  const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4008
4012
  __name: "LewAvatar",
4009
4013
  props: avatarProps,
@@ -4139,8 +4143,8 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4139
4143
  _ctx.src ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4140
4144
  unref(isLoading) || _ctx.loading ? (openBlock(), createElementBlock("div", _hoisted_1$K)) : !unref(error) ? (openBlock(), createElementBlock("img", {
4141
4145
  key: 1,
4142
- src: _ctx.src,
4143
4146
  alt: _ctx.alt,
4147
+ src: _ctx.src,
4144
4148
  lazy: "",
4145
4149
  style: normalizeStyle(unref(imageStyleObject))
4146
4150
  }, null, 12, _hoisted_2$s)) : _ctx.alt ? (openBlock(), createElementBlock("div", {
@@ -4170,7 +4174,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4170
4174
  };
4171
4175
  }
4172
4176
  });
4173
- const LewAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-201a46e9"]]);
4177
+ const LewAvatar = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__scopeId", "data-v-a2aea386"]]);
4174
4178
  function useDOMCreate(nodeId) {
4175
4179
  const node = document.getElementById(nodeId);
4176
4180
  if (node) ;
@@ -4293,7 +4297,7 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
4293
4297
  };
4294
4298
  }
4295
4299
  });
4296
- const LewBackTop = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-968d77fb"]]);
4300
+ const LewBackTop = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__scopeId", "data-v-cc02482d"]]);
4297
4301
  const badgeProps = {
4298
4302
  text: {
4299
4303
  type: String,
@@ -4747,7 +4751,7 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent({
4747
4751
  };
4748
4752
  }
4749
4753
  });
4750
- const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-4a6bf481"]]);
4754
+ const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__scopeId", "data-v-b88bcc9d"]]);
4751
4755
  function vue3h(ele, props2, children) {
4752
4756
  const { attrs, on, ...rest } = props2;
4753
4757
  let event = {};
@@ -6310,7 +6314,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
6310
6314
  };
6311
6315
  }
6312
6316
  });
6313
- const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-133e0ca8"]]);
6317
+ const LewCascader = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__scopeId", "data-v-a4c29dc5"]]);
6314
6318
  const checkboxModel = {
6315
6319
  modelValue: {
6316
6320
  type: Boolean,
@@ -6528,7 +6532,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
6528
6532
  };
6529
6533
  }
6530
6534
  });
6531
- const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-066f4f68"]]);
6535
+ const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__scopeId", "data-v-759025f4"]]);
6532
6536
  const _sfc_main$X = /* @__PURE__ */ defineComponent({
6533
6537
  __name: "LewCheckboxGroup",
6534
6538
  props: /* @__PURE__ */ mergeModels(checkboxGroupProps, {
@@ -7176,7 +7180,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
7176
7180
  };
7177
7181
  }
7178
7182
  });
7179
- const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-f6f4c669"]]);
7183
+ const LewColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-7ca69933"]]);
7180
7184
  function getDefaultExportFromCjs(x2) {
7181
7185
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
7182
7186
  }
@@ -7768,7 +7772,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
7768
7772
  };
7769
7773
  }
7770
7774
  });
7771
- const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-8c634290"]]);
7775
+ const LewDate = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-6658902a"]]);
7772
7776
  const _hoisted_1$B = { class: "lew-date-picker-view" };
7773
7777
  const _hoisted_2$l = ["onClick"];
7774
7778
  const _sfc_main$R = /* @__PURE__ */ defineComponent({
@@ -7958,7 +7962,7 @@ const _sfc_main$R = /* @__PURE__ */ defineComponent({
7958
7962
  };
7959
7963
  }
7960
7964
  });
7961
- const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-a649a225"]]);
7965
+ const LewDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__scopeId", "data-v-9540a9e6"]]);
7962
7966
  const dateRangePickerModel = {
7963
7967
  modelValue: {
7964
7968
  type: Object,
@@ -8545,7 +8549,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
8545
8549
  };
8546
8550
  }
8547
8551
  });
8548
- const LewDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-ed20f198"]]);
8552
+ const LewDateRange = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__scopeId", "data-v-7c6faeec"]]);
8549
8553
  const _hoisted_1$z = { class: "lew-date-range-picker-view" };
8550
8554
  const _hoisted_2$j = {
8551
8555
  key: 0,
@@ -8714,7 +8718,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
8714
8718
  };
8715
8719
  }
8716
8720
  });
8717
- const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-acc24350"]]);
8721
+ const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-0e0aa66f"]]);
8718
8722
  const formProps = {
8719
8723
  options: {
8720
8724
  type: Array,
@@ -8762,11 +8766,11 @@ const formProps = {
8762
8766
  columns: {
8763
8767
  type: [Number, String],
8764
8768
  default: 1,
8765
- description: "每行显示的表单项数量,最大值为4",
8769
+ description: "每行显示的表单项数量,必须是正整数",
8766
8770
  validator(value) {
8767
8771
  const numValue = Number(value);
8768
- if (Number.isNaN(numValue) || numValue < 1 || numValue > 4) {
8769
- console.warn("[LewForm] columns 必须是 1 到 4 之间的数字");
8772
+ if (Number.isNaN(numValue) || numValue < 1 || !Number.isInteger(numValue)) {
8773
+ console.warn("[LewForm] columns 必须是大于等于1的整数");
8770
8774
  return false;
8771
8775
  }
8772
8776
  return true;
@@ -9155,11 +9159,11 @@ const descProps = {
9155
9159
  columns: {
9156
9160
  type: [Number, String],
9157
9161
  default: 1,
9158
- description: "每行显示的描述项数量,范围为1到4",
9162
+ description: "每行显示的描述项数量,必须是正整数",
9159
9163
  validator(value) {
9160
9164
  const numValue = Number(value);
9161
- if (Number.isNaN(numValue) || numValue < 1 || numValue > 4) {
9162
- console.warn("[LewDesc] columns 必须是 1 到 4 之间的数字");
9165
+ if (Number.isNaN(numValue) || numValue < 1 || !Number.isInteger(numValue)) {
9166
+ console.warn("[LewDesc] columns 必须是大于等于1的整数");
9163
9167
  return false;
9164
9168
  }
9165
9169
  return true;
@@ -9384,9 +9388,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
9384
9388
  });
9385
9389
  const getPadding = computed(() => {
9386
9390
  const { bordered, size } = props2;
9387
- return bordered ? `${any2px(lewDescSizePaddingMap[size] - 10)} ${any2px(
9388
- lewDescSizePaddingMap[size]
9389
- )}` : 0;
9391
+ return bordered ? `${any2px(lewDescSizePaddingMap[size] - 10)} ${any2px(lewDescSizePaddingMap[size])}` : 0;
9390
9392
  });
9391
9393
  const getDescItemStyle = computed(() => {
9392
9394
  const { bordered, gridArea } = props2;
@@ -9405,9 +9407,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
9405
9407
  const getDescItemMainStyle = computed(() => {
9406
9408
  const { direction, labelWidth, valueX } = props2;
9407
9409
  return {
9408
- "width": direction === "x" ? `calc(${descItemRef.value?.offsetWidth}px - ${any2px(
9409
- labelWidth
9410
- )} - 10px)` : "100%",
9410
+ "width": direction === "x" ? `calc(${descItemRef.value?.offsetWidth}px - ${any2px(labelWidth)} - 10px)` : "100%",
9411
9411
  "justify-content": valueX === "center" ? valueX : `flex-${valueX}`,
9412
9412
  "padding": getPadding.value
9413
9413
  };
@@ -9455,7 +9455,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
9455
9455
  };
9456
9456
  }
9457
9457
  });
9458
- const LewDescItem = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-5989e624"]]);
9458
+ const LewDescItem = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__scopeId", "data-v-f6b87bb1"]]);
9459
9459
  const _sfc_main$L = /* @__PURE__ */ defineComponent({
9460
9460
  __name: "LewDesc",
9461
9461
  props: descProps,
@@ -9467,8 +9467,8 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
9467
9467
  const autoLabelWidth = ref(0);
9468
9468
  const componentOptions = cloneDeep(props2.options) || [];
9469
9469
  const getDescClassNames = computed(() => {
9470
- const { columns, bordered } = props2;
9471
- return object2class("lew-desc", { columns, bordered });
9470
+ const { bordered } = props2;
9471
+ return object2class("lew-desc", { bordered });
9472
9472
  });
9473
9473
  onMounted(() => {
9474
9474
  autoLabelWidth.value = descLabelRef.value?.getWidth() + (props2.bordered ? lewDescSizePaddingMap[props2.size] * 2 : 0);
@@ -9483,11 +9483,13 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
9483
9483
  }
9484
9484
  );
9485
9485
  const getDescStyle = computed(() => {
9486
- const { width, gap, bordered } = props2;
9486
+ const { width, gap, bordered, columns } = props2;
9487
+ const columnsCount = Number(columns);
9487
9488
  return {
9488
9489
  width: any2px(width),
9489
9490
  minWidth: 320,
9490
- gap: bordered ? 0 : any2px(gap)
9491
+ gap: bordered ? 0 : any2px(gap),
9492
+ gridTemplateColumns: `repeat(${columnsCount}, minmax(0, 1fr))`
9491
9493
  };
9492
9494
  });
9493
9495
  const getBind = computed(() => (item) => {
@@ -9524,7 +9526,7 @@ const _sfc_main$L = /* @__PURE__ */ defineComponent({
9524
9526
  };
9525
9527
  }
9526
9528
  });
9527
- const LewDesc = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-4daada40"]]);
9529
+ const LewDesc = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__scopeId", "data-v-c7fde351"]]);
9528
9530
  const drawerModel = {
9529
9531
  visible: {
9530
9532
  type: Boolean,
@@ -12775,8 +12777,13 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
12775
12777
  const componentOptions = cloneDeep(props2.options) || [];
12776
12778
  const formItemRefMap = ref({});
12777
12779
  const getFormClassNames = computed(() => {
12778
- const { columns } = cloneDeep(props2);
12779
- return object2class("lew-form", { columns });
12780
+ return object2class("lew-form", {});
12781
+ });
12782
+ const getDynamicGridStyle = computed(() => {
12783
+ const columns = Number(props2.columns);
12784
+ return {
12785
+ gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))`
12786
+ };
12780
12787
  });
12781
12788
  function getForm() {
12782
12789
  const formData = formatFormByMap(
@@ -12860,7 +12867,8 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
12860
12867
  return {
12861
12868
  width: any2px(props2.width),
12862
12869
  minWidth: 320,
12863
- gap: gapMap[props2.size]
12870
+ gap: gapMap[props2.size],
12871
+ ...getDynamicGridStyle.value
12864
12872
  };
12865
12873
  });
12866
12874
  __expose2({ getForm, setForm, resetError, validate: validate2 });
@@ -12899,7 +12907,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
12899
12907
  };
12900
12908
  }
12901
12909
  });
12902
- const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-fae83525"]]);
12910
+ const LewForm = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__scopeId", "data-v-557a6f3e"]]);
12903
12911
  const _imports_0 = "data:image/svg+xml,%3csvg%20t='1726823972943'%20class='icon'%20viewBox='0%200%201024%201024'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20p-id='6153'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20width='200'%20height='200'%3e%3cpath%20d='M692.712%20172.458h-43.443l-21.561%2037.727-120.367%20210.648%20170.073%20170.092-118.896%20222.89-20.127%2037.727H926.996V172.458H692.712z%20m-21.561%2037.727h218.118v312.869L758.998%20392.783l-129.346%2097.015-75.265-75.265%20116.764-204.348z%20m218.118%20603.63h-287.97l122.575-229.832-67.267-67.267%2098.863-74.133L889.269%20576.4v237.415z'%20fill='%23DBDBDB'%20p-id='6154'%3e%3c/path%3e%3cpath%20d='M441.206%20414.533L557.97%20210.185l21.561-37.727H97.004v679.083H467.991l20.127-37.727%20122.575-229.832-169.487-169.449zM134.731%20210.185h379.796L394.16%20420.833l170.073%20170.092-12.488%2023.409L282.47%20528.92%20134.731%20632.33V210.185z%20m310.624%20603.63H134.731V678.394l154.077-107.861%20244.866%2077.661-88.319%20165.621z'%20fill='%23DBDBDB'%20p-id='6155'%3e%3c/path%3e%3cpath%20d='M361.093%20370.524c0-36.463-29.559-66.022-66.022-66.022s-66.022%2029.559-66.022%2066.022%2029.559%2066.022%2066.022%2066.022%2066.022-29.559%2066.022-66.022z%20m-94.318%200c0-15.6%2012.695-28.295%2028.295-28.295%2015.6%200%2028.295%2012.695%2028.295%2028.295%200%2015.6-12.695%2028.295-28.295%2028.295-15.6%200-28.295-12.695-28.295-28.295z'%20fill='%23DBDBDB'%20p-id='6156'%3e%3c/path%3e%3c/svg%3e";
12904
12912
  const imageProps = {
12905
12913
  src: {
@@ -13034,26 +13042,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
13034
13042
  height: any2px(height)
13035
13043
  };
13036
13044
  });
13037
- const _loading = ref();
13038
- const _error = ref();
13039
- function init() {
13040
- const { isLoading, error } = useImage({
13041
- src: props2.src
13042
- });
13043
- _loading.value = isLoading;
13044
- _error.value = error;
13045
- }
13046
- init();
13047
- watch(
13048
- () => props2.src,
13049
- () => {
13050
- const { isLoading, error } = useImage({
13051
- src: props2.src
13052
- });
13053
- _loading.value = isLoading;
13054
- _error.value = error;
13055
- }
13056
- );
13045
+ const { isLoading, error } = useImage({
13046
+ src: props2.src
13047
+ });
13057
13048
  return (_ctx, _cache) => {
13058
13049
  const _directive_tooltip = resolveDirective("tooltip");
13059
13050
  return openBlock(), createBlock(unref(LewFlex), {
@@ -13064,7 +13055,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
13064
13055
  style: normalizeStyle(unref(imageStyleObject))
13065
13056
  }, {
13066
13057
  default: withCtx(() => [
13067
- unref(_loading) || _ctx.loading || !_ctx.src ? (openBlock(), createElementBlock("div", _hoisted_1$u)) : unref(_error) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
13058
+ unref(isLoading) || _ctx.loading || !_ctx.src ? (openBlock(), createElementBlock("div", _hoisted_1$u)) : unref(error) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
13068
13059
  _ctx.$slots.error ? renderSlot(_ctx.$slots, "error", { key: 0 }, void 0, true) : withDirectives((openBlock(), createElementBlock("img", {
13069
13060
  key: 1,
13070
13061
  class: "lew-image-fail-icon",
@@ -13094,7 +13085,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
13094
13085
  };
13095
13086
  }
13096
13087
  });
13097
- const LewImage = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-8caa6dcc"]]);
13088
+ const LewImage = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-00b1ee42"]]);
13098
13089
  const inputModel = {
13099
13090
  modelValue: {
13100
13091
  type: [String, Number],
@@ -13391,9 +13382,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
13391
13382
  width: `calc(100% - ${clearable ? 20 + countWidth + (showCount ? 12 : 0) : 0}px)`
13392
13383
  };
13393
13384
  });
13394
- const getType = computed(
13395
- () => props2.type === "password" ? _type.value : props2.type
13396
- );
13385
+ const getType = computed(() => props2.type === "password" ? _type.value : props2.type);
13397
13386
  const getInputClassNames = computed(() => {
13398
13387
  const { size, readonly, disabled, align, autoWidth } = props2;
13399
13388
  return object2class("lew-input-view", {
@@ -13651,7 +13640,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
13651
13640
  };
13652
13641
  }
13653
13642
  });
13654
- const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-5ce17f51"]]);
13643
+ const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__scopeId", "data-v-13368ebd"]]);
13655
13644
  const inputNumberModel = {
13656
13645
  modelValue: {
13657
13646
  type: Number,
@@ -13970,28 +13959,29 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
13970
13959
  const visible = ref(false);
13971
13960
  const formRef = ref();
13972
13961
  const form = ref({});
13973
- const editIndex = ref(-1);
13974
- const id = ref("");
13975
- function open({ row = {}, index: index2 = -1 }) {
13962
+ const isEditing = ref(false);
13963
+ const originalRowId = ref("");
13964
+ function open({ row = {} }) {
13976
13965
  visible.value = true;
13977
- editIndex.value = index2;
13978
- id.value = row.id;
13966
+ isEditing.value = !!row.id;
13967
+ originalRowId.value = row.id || "";
13979
13968
  form.value = cloneDeep(row);
13980
13969
  }
13981
13970
  function ok() {
13982
13971
  formRef.value.validate().then((res) => {
13983
13972
  if (res) {
13984
- if (editIndex.value >= 0) {
13973
+ const formData = formRef.value.getForm();
13974
+ if (isEditing.value) {
13985
13975
  emit2("editSuccess", {
13986
- row: { ...formRef.value.getForm(), id: id.value },
13987
- index: editIndex.value
13976
+ row: { ...formData, id: originalRowId.value }
13988
13977
  });
13989
13978
  } else {
13990
- const _form = formRef.value.getForm();
13991
- if (!props2.checkUniqueFieldFn(_form)) {
13979
+ if (!props2.checkUniqueFieldFn(formData)) {
13992
13980
  return;
13993
13981
  }
13994
- emit2("addSuccess", { row: { ..._form, id: id.value } });
13982
+ emit2("addSuccess", {
13983
+ row: { ...formData, id: originalRowId.value }
13984
+ });
13995
13985
  }
13996
13986
  visible.value = false;
13997
13987
  } else {
@@ -14015,7 +14005,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
14015
14005
  "ok-button-props": {
14016
14006
  request: ok
14017
14007
  },
14018
- title: `${unref(editIndex) >= 0 ? unref(locale).t("inputTable.editTitle") : unref(locale).t("inputTable.modelTitle")}`
14008
+ title: `${unref(isEditing) ? unref(locale).t("inputTable.editTitle") : unref(locale).t("inputTable.modelTitle")}`
14019
14009
  }, {
14020
14010
  default: withCtx(() => [
14021
14011
  createElementVNode("div", _hoisted_1$r, [
@@ -14034,7 +14024,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
14034
14024
  };
14035
14025
  }
14036
14026
  });
14037
- const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-2ad3d100"]]);
14027
+ const FormModal = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-8657b930"]]);
14038
14028
  const inputTableModel = {
14039
14029
  modelValue: {
14040
14030
  type: Array,
@@ -14198,36 +14188,63 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14198
14188
  setUseId();
14199
14189
  });
14200
14190
  const inputTableColumns = computed(() => {
14201
- return [
14202
- ...props2.columns,
14203
- ...props2.deletable || props2.addable ? [
14204
- {
14205
- title: "操作",
14206
- width: 90,
14207
- field: "action",
14208
- x: "center",
14209
- fixed: "right"
14210
- }
14211
- ] : []
14212
- ];
14191
+ const actionColumn = props2.deletable || props2.addable ? [
14192
+ {
14193
+ title: "操作",
14194
+ width: 90,
14195
+ field: "action",
14196
+ x: "center",
14197
+ fixed: "right"
14198
+ }
14199
+ ] : [];
14200
+ return [...props2.columns, ...actionColumn];
14213
14201
  });
14214
14202
  const formOptions = computed(() => {
14215
- return (props2.columns || []).map((e) => {
14216
- const { as: as2, title, field, props: props22, required: required2 } = e;
14203
+ return props2.columns.map((column) => {
14204
+ const { as: as2, title, field, props: columnProps, required: required2 } = column;
14217
14205
  return {
14218
14206
  label: title,
14219
14207
  field,
14220
14208
  as: as2 || "input",
14221
14209
  required: required2,
14222
- props: props22
14210
+ props: columnProps
14223
14211
  };
14224
14212
  });
14225
14213
  });
14214
+ const styleConfig = computed(() => {
14215
+ const { size } = props2;
14216
+ const paddingMap = {
14217
+ small: "8px",
14218
+ medium: "10px",
14219
+ large: "12px"
14220
+ };
14221
+ const fontSizeMap = {
14222
+ small: 13,
14223
+ medium: 14,
14224
+ large: 16
14225
+ };
14226
+ const iconSizeMap = {
14227
+ small: "24px",
14228
+ medium: "26px",
14229
+ large: "28px"
14230
+ };
14231
+ return {
14232
+ addButtonStyle: {
14233
+ padding: paddingMap[size],
14234
+ fontSize: `${fontSizeMap[size]}px`
14235
+ },
14236
+ iconStyle: {
14237
+ width: iconSizeMap[size],
14238
+ height: iconSizeMap[size]
14239
+ },
14240
+ iconSize: fontSizeMap[size]
14241
+ };
14242
+ });
14226
14243
  const formModalRef = ref();
14227
- function edit({ row, index: index2 }) {
14228
- formModalRef.value.open({ row, index: index2 });
14244
+ function edit({ row }) {
14245
+ formModalRef.value.open({ row });
14229
14246
  }
14230
- function del({ index: index2 }) {
14247
+ function del({ row }) {
14231
14248
  if ((modelValue2.value || []).length <= props2.minRows) {
14232
14249
  LewMessage.warning(locale.t("inputTable.minRows"));
14233
14250
  return;
@@ -14240,7 +14257,13 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14240
14257
  closeOnClickOverlay: true,
14241
14258
  closeByEsc: true,
14242
14259
  ok: () => {
14243
- modelValue2.value.splice(index2, 1);
14260
+ const rowId = row[props2.rowKey];
14261
+ const actualIndex = modelValue2.value.findIndex(
14262
+ (item) => item[props2.rowKey] === rowId
14263
+ );
14264
+ if (actualIndex !== -1) {
14265
+ modelValue2.value.splice(actualIndex, 1);
14266
+ }
14244
14267
  return true;
14245
14268
  }
14246
14269
  });
@@ -14263,65 +14286,40 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14263
14286
  modelValue2.value.push(row);
14264
14287
  }
14265
14288
  }
14266
- function editSuccess({ row, index: index2 }) {
14267
- modelValue2.value.splice(index2, 1, row);
14289
+ function editSuccess({ row }) {
14290
+ const rowId = row[props2.rowKey];
14291
+ const actualIndex = modelValue2.value.findIndex((item) => item[props2.rowKey] === rowId);
14292
+ if (actualIndex !== -1) {
14293
+ modelValue2.value.splice(actualIndex, 1, row);
14294
+ }
14268
14295
  }
14269
14296
  const selectedKeys = ref([]);
14297
+ function dragSort(sortedDataSource) {
14298
+ const cleanedData = sortedDataSource.map((item) => {
14299
+ const { _lew_table_tr_id, ...cleanItem } = item;
14300
+ return cleanItem;
14301
+ });
14302
+ modelValue2.value = cleanedData;
14303
+ }
14270
14304
  function checkUniqueFieldFn(form) {
14271
14305
  if (!props2.uniqueField) {
14272
14306
  return true;
14273
14307
  }
14274
14308
  const fieldValue = form[props2.uniqueField];
14275
- const vail = !modelValue2.value.some(
14276
- (item) => item[props2.uniqueField] === fieldValue
14309
+ const currentRowId = form[props2.rowKey];
14310
+ const isDuplicate = modelValue2.value.some(
14311
+ (item) => item[props2.uniqueField] === fieldValue && item[props2.rowKey] !== currentRowId
14277
14312
  );
14278
- if (!vail) {
14313
+ if (isDuplicate) {
14279
14314
  const label = formOptions.value.find(
14280
- (e) => e.field === props2.uniqueField
14315
+ (option) => option.field === props2.uniqueField
14281
14316
  )?.label;
14282
14317
  LewMessage.warning(locale.t("inputTable.uniqueFieldExist", { label }));
14283
14318
  return false;
14284
14319
  }
14285
14320
  return true;
14286
14321
  }
14287
- const isMaxRowsReached = computed(
14288
- () => (modelValue2.value || []).length >= props2.maxRows
14289
- );
14290
- const getAddButtonStyle = computed(() => {
14291
- const paddingMap = {
14292
- small: "8px",
14293
- medium: "10px",
14294
- large: "12px"
14295
- };
14296
- const fontSizeMap = {
14297
- small: 13,
14298
- medium: 14,
14299
- large: 16
14300
- };
14301
- return {
14302
- padding: paddingMap[props2.size],
14303
- fontSize: `${fontSizeMap[props2.size]}px`
14304
- };
14305
- });
14306
- const getIconStyle = computed(() => {
14307
- const sizeMap = {
14308
- small: "24px",
14309
- medium: "26px",
14310
- large: "28px"
14311
- };
14312
- return {
14313
- width: sizeMap[props2.size],
14314
- height: sizeMap[props2.size]
14315
- };
14316
- });
14317
- const getIconSize = computed(() => {
14318
- const sizeMap = {
14319
- small: 13,
14320
- medium: 14,
14321
- large: 16
14322
- };
14323
- return sizeMap[props2.size];
14324
- });
14322
+ const isMaxRowsReached = computed(() => (modelValue2.value || []).length >= props2.maxRows);
14325
14323
  return (_ctx, _cache) => {
14326
14324
  return openBlock(), createBlock(unref(LewFlex), {
14327
14325
  x: "start",
@@ -14341,7 +14339,8 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14341
14339
  "sort-tooltip-custom-render": _ctx.sortTooltipCustomRender,
14342
14340
  multiple: "",
14343
14341
  columns: unref(inputTableColumns),
14344
- "data-source": modelValue2.value
14342
+ "data-source": modelValue2.value,
14343
+ onDragSort: dragSort
14345
14344
  }, {
14346
14345
  "table-header": withCtx(() => [
14347
14346
  renderSlot(_ctx.$slots, "table-header", {}, void 0, true)
@@ -14358,12 +14357,12 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14358
14357
  x: "center",
14359
14358
  y: "center",
14360
14359
  class: normalizeClass(["add-btn", { disabled: unref(isMaxRowsReached) }]),
14361
- style: normalizeStyle(unref(getAddButtonStyle)),
14360
+ style: normalizeStyle(unref(styleConfig).addButtonStyle),
14362
14361
  onClick: add
14363
14362
  }, {
14364
14363
  default: withCtx(() => [
14365
14364
  createVNode(Icon, {
14366
- size: unref(getIconSize),
14365
+ size: unref(styleConfig).iconSize,
14367
14366
  type: "plus"
14368
14367
  }, null, 8, ["size"]),
14369
14368
  createTextVNode(" " + toDisplayString$1(unref(locale).t("inputTable.addText")), 1)
@@ -14384,15 +14383,15 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14384
14383
  key: 0,
14385
14384
  type: "text",
14386
14385
  color: "gray",
14387
- style: normalizeStyle(unref(getIconStyle)),
14386
+ style: normalizeStyle(unref(styleConfig).iconStyle),
14388
14387
  size: "small",
14389
14388
  "single-icon": "",
14390
14389
  round: "",
14391
- onClick: ($event) => edit({ row, index: index2 })
14390
+ onClick: ($event) => edit({ row })
14392
14391
  }, {
14393
14392
  default: withCtx(() => [
14394
14393
  createVNode(Icon, {
14395
- size: unref(getIconSize),
14394
+ size: unref(styleConfig).iconSize,
14396
14395
  type: "edit-2"
14397
14396
  }, null, 8, ["size"])
14398
14397
  ]),
@@ -14403,14 +14402,14 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14403
14402
  type: "text",
14404
14403
  color: "red",
14405
14404
  size: "small",
14406
- style: normalizeStyle(unref(getIconStyle)),
14405
+ style: normalizeStyle(unref(styleConfig).iconStyle),
14407
14406
  round: "",
14408
14407
  "single-icon": "",
14409
- onClick: ($event) => del({ index: index2 })
14408
+ onClick: ($event) => del({ row })
14410
14409
  }, {
14411
14410
  default: withCtx(() => [
14412
14411
  createVNode(Icon, {
14413
- size: unref(getIconSize),
14412
+ size: unref(styleConfig).iconSize,
14414
14413
  type: "trash"
14415
14414
  }, null, 8, ["size"])
14416
14415
  ]),
@@ -14438,7 +14437,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
14438
14437
  };
14439
14438
  }
14440
14439
  });
14441
- const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-a79ac0d9"]]);
14440
+ const LewInputTable = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__scopeId", "data-v-7397eb94"]]);
14442
14441
  const inputTagModel = {
14443
14442
  modelValue: {
14444
14443
  type: Array,
@@ -14750,7 +14749,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
14750
14749
  };
14751
14750
  }
14752
14751
  });
14753
- const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-a19603bf"]]);
14752
+ const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__scopeId", "data-v-0ce7d40a"]]);
14754
14753
  const markProps = {
14755
14754
  color: {
14756
14755
  type: String,
@@ -19135,7 +19134,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
19135
19134
  };
19136
19135
  }
19137
19136
  });
19138
- const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-e635856c"]]);
19137
+ const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-8015e612"]]);
19139
19138
  const _sfc_main$o = /* @__PURE__ */ defineComponent({
19140
19139
  __name: "LewRadioGroup",
19141
19140
  props: /* @__PURE__ */ mergeModels(radioGroupProps, {
@@ -20000,7 +19999,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
20000
19999
  };
20001
20000
  }
20002
20001
  });
20003
- const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-81d99496"]]);
20002
+ const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-43ea41b5"]]);
20004
20003
  const selectMultipleModel = {
20005
20004
  modelValue: {
20006
20005
  type: Array,
@@ -20638,7 +20637,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
20638
20637
  };
20639
20638
  }
20640
20639
  });
20641
- const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-6894fad8"]]);
20640
+ const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-d89bb4d7"]]);
20642
20641
  const sliderModel = {
20643
20642
  modelValue: {
20644
20643
  type: [Number, void 0],
@@ -21191,7 +21190,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
21191
21190
  };
21192
21191
  }
21193
21192
  });
21194
- const LewSlider = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-a148844c"]]);
21193
+ const LewSlider = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-c392ea9e"]]);
21195
21194
  const sliderRangeModel = {
21196
21195
  modelValue: {
21197
21196
  type: Array,
@@ -21615,7 +21614,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
21615
21614
  };
21616
21615
  }
21617
21616
  });
21618
- const LewSliderRange = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-66640e8d"]]);
21617
+ const LewSliderRange = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-d9cf8896"]]);
21619
21618
  const stepsModel = {
21620
21619
  modelValue: {
21621
21620
  type: [String, Number],
@@ -22122,7 +22121,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22122
22121
  "sortValue": { default: {} },
22123
22122
  "sortValueModifiers": {}
22124
22123
  }),
22125
- emits: /* @__PURE__ */ mergeModels(["sortChange", "selectChange", "sortOrderChange"], ["update:selectedKeys", "update:sortValue"]),
22124
+ emits: /* @__PURE__ */ mergeModels(["sortChange", "selectChange", "dragSort"], ["update:selectedKeys", "update:sortValue"]),
22126
22125
  setup(__props2, { emit: __emit2 }) {
22127
22126
  const props2 = __props2;
22128
22127
  const emit2 = __emit2;
@@ -22747,7 +22746,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
22747
22746
  const [movedItem] = newDataSource.splice(dragIndex, 1);
22748
22747
  newDataSource.splice(actualTargetPosition, 0, movedItem);
22749
22748
  state.dataSource = newDataSource;
22750
- emit2("sortOrderChange", newDataSource);
22749
+ emit2("dragSort", newDataSource);
22751
22750
  }
22752
22751
  }
22753
22752
  }
@@ -24373,7 +24372,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
24373
24372
  };
24374
24373
  }
24375
24374
  });
24376
- const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-53e65839"]]);
24375
+ const LewTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-a52cc1aa"]]);
24377
24376
  const titleProps = {
24378
24377
  text: {
24379
24378
  type: String,
@@ -24992,7 +24991,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
24992
24991
  };
24993
24992
  }
24994
24993
  });
24995
- const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-c863d660"]]);
24994
+ const LewTreeItem = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-f8a8bf85"]]);
24996
24995
  const _hoisted_1$7 = {
24997
24996
  key: 0,
24998
24997
  class: "lew-result-count"
@@ -25636,7 +25635,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
25636
25635
  };
25637
25636
  }
25638
25637
  });
25639
- const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-5d38aae3"]]);
25638
+ const LewTreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-c414308d"]]);
25640
25639
  const uploadProps = {
25641
25640
  accept: {
25642
25641
  type: String,
@@ -25740,6 +25739,18 @@ const uploadProps = {
25740
25739
  }
25741
25740
  return true;
25742
25741
  }
25742
+ },
25743
+ beforeDelete: {
25744
+ type: Function,
25745
+ default: void 0,
25746
+ description: "删除文件前的回调函数,返回 Promise<boolean> 或 boolean,true 表示继续删除",
25747
+ validator: (value) => {
25748
+ if (value !== void 0 && typeof value !== "function") {
25749
+ console.warn("[LewUpload] beforeDelete 必须是一个函数");
25750
+ return false;
25751
+ }
25752
+ return true;
25753
+ }
25743
25754
  }
25744
25755
  };
25745
25756
  const uploadByListProps = {
@@ -25770,15 +25781,6 @@ const uploadByCardProps = {
25770
25781
  }
25771
25782
  }
25772
25783
  };
25773
- const statusConfig = {
25774
- pending: { text: "待上传", color: "gray" },
25775
- success: { text: "上传成功", color: "green" },
25776
- fail: { text: "上传失败", color: "red" },
25777
- uploading: { text: "上传中", color: "blue" },
25778
- complete: { text: "已上传", color: "gray" },
25779
- wrong_type: { text: "非法格式", color: "red" },
25780
- wrong_size: { text: "文件大小超出限制", color: "red" }
25781
- };
25782
25784
  const _hoisted_1$5 = ["src"];
25783
25785
  const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25784
25786
  __name: "LewUploadByCard",
@@ -25819,9 +25821,18 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25819
25821
  medium: 80,
25820
25822
  large: 88
25821
25823
  };
25822
- const getStatus = computed(() => (item) => {
25823
- return statusConfig[item.status || "complete"];
25824
- });
25824
+ const getStatusText = computed(() => (item) => {
25825
+ return locale.t(`upload.${item.status || "complete"}`);
25826
+ });
25827
+ const statusColorMap = {
25828
+ success: "green",
25829
+ fail: "red",
25830
+ uploading: "blue",
25831
+ complete: "gray",
25832
+ wrong_type: "red",
25833
+ wrong_size: "red",
25834
+ pending: "gray"
25835
+ };
25825
25836
  const modelValue2 = useModel(__props2, "modelValue");
25826
25837
  return (_ctx, _cache) => {
25827
25838
  const _directive_tooltip = resolveDirective("tooltip");
@@ -25881,13 +25892,13 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25881
25892
  createVNode(Icon, {
25882
25893
  size: rightTopBtnIconSizeMap[_ctx.size],
25883
25894
  type: "tips",
25884
- color: unref(getStatus)(item).color
25895
+ color: statusColorMap[item.status || "complete"]
25885
25896
  }, null, 8, ["size", "color"])
25886
25897
  ]),
25887
25898
  _: 2
25888
25899
  }, 1032, ["style"])), [
25889
25900
  [_directive_tooltip, {
25890
- content: unref(getStatus)(item).text,
25901
+ content: unref(getStatusText)(item),
25891
25902
  trigger: "mouseenter"
25892
25903
  }]
25893
25904
  ]) : createCommentVNode("", true),
@@ -25981,7 +25992,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
25981
25992
  };
25982
25993
  }
25983
25994
  });
25984
- const LewUploadByCard = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-c567e993"]]);
25995
+ const LewUploadByCard = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-268f2176"]]);
25985
25996
  const _hoisted_1$4 = ["src"];
25986
25997
  const _hoisted_2$3 = { key: 1 };
25987
25998
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
@@ -25993,6 +26004,15 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
25993
26004
  emits: /* @__PURE__ */ mergeModels(["reUpload", "deleteFile"], ["update:modelValue"]),
25994
26005
  setup(__props2, { emit: __emit2 }) {
25995
26006
  const emit2 = __emit2;
26007
+ const statusColorMap = {
26008
+ success: "green",
26009
+ fail: "red",
26010
+ uploading: "blue",
26011
+ complete: "gray",
26012
+ wrong_type: "red",
26013
+ wrong_size: "red",
26014
+ pending: "gray"
26015
+ };
25996
26016
  const app2 = getCurrentInstance()?.appContext.app;
25997
26017
  if (app2 && !app2.directive("tooltip")) {
25998
26018
  app2.use(LewTooltip);
@@ -26041,8 +26061,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
26041
26061
  const urlParts = url.split("/");
26042
26062
  return urlParts[urlParts.length - 1];
26043
26063
  }
26044
- const getStatus = computed(() => (item) => {
26045
- return statusConfig[item.status || "complete"];
26064
+ const getStatusText = computed(() => (item) => {
26065
+ return locale.t(`upload.${item.status || "complete"}`);
26046
26066
  });
26047
26067
  return (_ctx, _cache) => {
26048
26068
  return withDirectives((openBlock(), createBlock(unref(LewFlex), {
@@ -26211,7 +26231,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
26211
26231
  key: item.status,
26212
26232
  type: "light",
26213
26233
  size: "small",
26214
- color: unref(getStatus)(item).color
26234
+ color: statusColorMap[item.status || "complete"]
26215
26235
  }, {
26216
26236
  left: withCtx(() => [
26217
26237
  createVNode(Icon, {
@@ -26222,7 +26242,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
26222
26242
  }, null, 8, ["type", "loading"])
26223
26243
  ]),
26224
26244
  default: withCtx(() => [
26225
- createTextVNode(" " + toDisplayString$1(unref(getStatus)(item).text), 1)
26245
+ createTextVNode(" " + toDisplayString$1(unref(getStatusText)(item)), 1)
26226
26246
  ]),
26227
26247
  _: 2
26228
26248
  }, 1032, ["color"])) : createCommentVNode("", true)
@@ -26250,7 +26270,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
26250
26270
  };
26251
26271
  }
26252
26272
  });
26253
- const LewUploadByList = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-fb7f01db"]]);
26273
+ const LewUploadByList = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c0e4ec79"]]);
26254
26274
  const _hoisted_1$3 = ["multiple", "accept"];
26255
26275
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26256
26276
  __name: "LewUpload",
@@ -26277,15 +26297,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26277
26297
  medium: 12,
26278
26298
  large: 14
26279
26299
  };
26280
- const uploadIconFontSizeMap = computed(
26281
- () => {
26282
- return {
26283
- small: props2.viewMode === "list" ? 28 : 22,
26284
- medium: props2.viewMode === "list" ? 30 : 24,
26285
- large: props2.viewMode === "list" ? 32 : 26
26286
- };
26287
- }
26288
- );
26300
+ const uploadIconFontSizeMap = computed(() => {
26301
+ return {
26302
+ small: props2.viewMode === "list" ? 28 : 22,
26303
+ medium: props2.viewMode === "list" ? 30 : 24,
26304
+ large: props2.viewMode === "list" ? 32 : 26
26305
+ };
26306
+ });
26289
26307
  const uploadPaddingMap = computed(() => {
26290
26308
  return {
26291
26309
  small: props2.viewMode === "list" ? "10px 8px" : "14px",
@@ -26355,29 +26373,32 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26355
26373
  });
26356
26374
  }
26357
26375
  }
26358
- function deleteFile(key) {
26376
+ async function deleteFile(key) {
26359
26377
  const fileList = cloneDeep(modelValue2.value) || [];
26360
26378
  const index2 = (fileList || []).findIndex((e) => e.key === key);
26361
26379
  if (index2 >= 0) {
26362
26380
  const { status } = fileList[index2];
26381
+ const fileItem = fileList[index2];
26363
26382
  if (["wrong_type", "wrong_size", "pending"].includes(status || "")) {
26364
26383
  fileList.splice(index2, 1);
26365
26384
  modelValue2.value = fileList;
26366
- } else {
26367
- LewDialog.error({
26368
- title: "移除文件",
26369
- okText: "移除",
26370
- content: "你是否要移除该文件,此操作会立即生效,请谨慎操作!",
26371
- closeOnClickOverlay: true,
26372
- closeByEsc: true,
26373
- ok: () => {
26374
- fileList.splice(index2, 1);
26375
- modelValue2.value = fileList;
26376
- emit2("delete", key);
26377
- return true;
26385
+ emit2("delete", key);
26386
+ return;
26387
+ }
26388
+ if (props2.beforeDelete && isFunction$1(props2.beforeDelete)) {
26389
+ try {
26390
+ const shouldDelete = await props2.beforeDelete(fileItem);
26391
+ if (!shouldDelete) {
26392
+ return;
26378
26393
  }
26379
- });
26394
+ } catch (error) {
26395
+ console.error("[LewUpload] beforeDelete callback error:", error);
26396
+ return;
26397
+ }
26380
26398
  }
26399
+ fileList.splice(index2, 1);
26400
+ modelValue2.value = fileList;
26401
+ emit2("delete", key);
26381
26402
  }
26382
26403
  }
26383
26404
  function reUpload(key) {
@@ -26555,9 +26576,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26555
26576
  fontSize: `${unref(any2px)(tipFontSizeMap[_ctx.size])}`
26556
26577
  }),
26557
26578
  class: "lew-upload-tip"
26558
- }, toDisplayString$1(unref(dropActive) ? unref(locale).t("upload.dropActive") : `${unref(locale).t("upload.click")}${unref(isSupported) && unref(isFocus) ? unref(locale).t("upload.paste") : ""}${unref(locale).t(
26559
- "upload.drag"
26560
- )}`), 5)) : createCommentVNode("", true),
26579
+ }, toDisplayString$1(unref(dropActive) ? unref(locale).t("upload.dropActive") : `${unref(locale).t("upload.click")}${unref(isSupported) && unref(isFocus) ? unref(locale).t("upload.paste") : ""}${unref(locale).t("upload.drag")}`), 5)) : createCommentVNode("", true),
26561
26580
  _ctx.viewMode === "list" ? (openBlock(), createElementBlock("div", {
26562
26581
  key: 1,
26563
26582
  style: normalizeStyle({
@@ -26603,7 +26622,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26603
26622
  };
26604
26623
  }
26605
26624
  });
26606
- const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-66b739fb"]]);
26625
+ const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-215d9352"]]);
26607
26626
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
26608
26627
  __proto__: null,
26609
26628
  LewActionBox,
@@ -26736,7 +26755,6 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
26736
26755
  sliderProps,
26737
26756
  sliderRangeModel,
26738
26757
  sliderRangeProps,
26739
- statusConfig,
26740
26758
  stepsModel,
26741
26759
  stepsProps,
26742
26760
  switchModel,
@@ -34207,7 +34225,14 @@ const zh = {
34207
34225
  drag: "或将文件拖到这里",
34208
34226
  accept: "支持上传 {accept}",
34209
34227
  limit: "最多可上传 {limit} 个文件",
34210
- maxFileSize: "单个文件不超过 {maxFileSize}"
34228
+ maxFileSize: "单个文件不超过 {maxFileSize}",
34229
+ pending: "待上传",
34230
+ success: "上传成功",
34231
+ fail: "上传失败",
34232
+ uploading: "上传中",
34233
+ complete: "已上传",
34234
+ wrong_type: "非法格式",
34235
+ wrong_size: "文件大小超出限制"
34211
34236
  },
34212
34237
  pagination: {
34213
34238
  pageSize: "{pageSize} 条/页",
@@ -34454,7 +34479,6 @@ export {
34454
34479
  sliderProps,
34455
34480
  sliderRangeModel,
34456
34481
  sliderRangeProps,
34457
- statusConfig,
34458
34482
  stepsModel,
34459
34483
  stepsProps,
34460
34484
  switchModel,