lew-ui 2.6.3 → 2.6.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.mjs CHANGED
@@ -4237,7 +4237,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
4237
4237
  };
4238
4238
  }
4239
4239
  });
4240
- const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__scopeId", "data-v-6acb7c29"]]);
4240
+ const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__scopeId", "data-v-82bc02e1"]]);
4241
4241
  const tagProps = {
4242
4242
  text: {
4243
4243
  type: String,
@@ -12009,6 +12009,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
12009
12009
  var _a2;
12010
12010
  return (_a2 = lewInputRef.value) == null ? void 0 : _a2.focus();
12011
12011
  };
12012
+ const toBlur = () => {
12013
+ var _a2;
12014
+ return (_a2 = lewInputRef.value) == null ? void 0 : _a2.blur();
12015
+ };
12012
12016
  const showPasswordFn = () => {
12013
12017
  _type.value = _type.value === "text" ? "password" : "text";
12014
12018
  };
@@ -12095,7 +12099,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
12095
12099
  onUnmounted(() => {
12096
12100
  if (timer) clearTimeout(timer);
12097
12101
  });
12098
- __expose2({ toFocus });
12102
+ __expose2({ toFocus, toBlur });
12099
12103
  return (_ctx, _cache) => {
12100
12104
  const _directive_tooltip = resolveDirective("tooltip");
12101
12105
  return openBlock(), createElementBlock("div", {
@@ -12281,7 +12285,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
12281
12285
  };
12282
12286
  }
12283
12287
  });
12284
- const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-349c1ed8"]]);
12288
+ const LewInput = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__scopeId", "data-v-6133fdd3"]]);
12285
12289
  const inputNumberModel = {
12286
12290
  modelValue: {
12287
12291
  type: Number,
@@ -12579,7 +12583,7 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
12579
12583
  };
12580
12584
  }
12581
12585
  });
12582
- const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-0d81db44"]]);
12586
+ const LewInputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-b5bbd71d"]]);
12583
12587
  const textareaModel = {
12584
12588
  modelValue: {
12585
12589
  type: String,
@@ -12921,114 +12925,186 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
12921
12925
  var _a;
12922
12926
  const app2 = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app;
12923
12927
  if (app2 && !app2.directive("tooltip")) {
12924
- app2.use(LewMessage$1);
12928
+ try {
12929
+ app2.use(LewMessage$1);
12930
+ } catch (error2) {
12931
+ console.error("注册LewMessage失败:", error2);
12932
+ }
12925
12933
  }
12926
12934
  const emit2 = __emit2;
12927
12935
  const props2 = __props2;
12928
12936
  const modelValue2 = useModel(__props2, "modelValue");
12929
- const inputValue = ref();
12930
- const lewInputRef = ref();
12931
- const isFocus = ref(false);
12932
- let isEnter = false;
12933
- let isConfirm = ref(false);
12937
+ const inputValue = ref("");
12938
+ const lewInputRef = ref(null);
12939
+ const isInputActive = ref(false);
12940
+ const isTagMarkedForDeletion = ref(false);
12941
+ const autoWidthDelay = ref(false);
12942
+ let originalKeydownHandler = null;
12934
12943
  const openInput = () => {
12935
- if (isFocus.value) return;
12936
- if (props2.maxLength > 0 && (modelValue2.value || []).length >= props2.maxLength) {
12937
- LewMessage$1.warning(
12938
- locale.t("inputTag.maxLength", { maxLength: props2.maxLength })
12939
- );
12940
- return;
12941
- }
12942
- isFocus.value = true;
12943
- nextTick(() => {
12944
- lewInputRef.value.toFocus();
12945
- });
12946
- document.onkeydown = function(event) {
12947
- if (!inputValue.value) {
12948
- if (event.keyCode === 8 || event.keyCode === 46) {
12949
- if (modelValue2.value && modelValue2.value.length > 0 && isConfirm.value) {
12950
- modelValue2.value.splice(modelValue2.value.length - 1, 1);
12951
- emit2("change", cloneDeep(modelValue2.value));
12952
- isConfirm.value = false;
12944
+ if (isInputActive.value || props2.disabled || props2.readonly) return;
12945
+ try {
12946
+ if (props2.maxLength > 0 && Array.isArray(modelValue2.value) && modelValue2.value.length >= props2.maxLength) {
12947
+ LewMessage$1.warning(
12948
+ locale.t("inputTag.maxLength", { maxLength: props2.maxLength })
12949
+ );
12950
+ return;
12951
+ }
12952
+ isInputActive.value = true;
12953
+ nextTick(() => {
12954
+ if (lewInputRef.value && typeof lewInputRef.value.toFocus === "function") {
12955
+ lewInputRef.value.toFocus();
12956
+ }
12957
+ });
12958
+ originalKeydownHandler = document.onkeydown;
12959
+ document.onkeydown = function(event) {
12960
+ try {
12961
+ const keyCode = event.key || event.code;
12962
+ if (inputValue.value) {
12963
+ if (keyCode === "Enter" || keyCode === "NumpadEnter") {
12964
+ isTagMarkedForDeletion.value = false;
12965
+ document.onkeydown = originalKeydownHandler;
12966
+ isInputActive.value = false;
12967
+ if (inputValue.value) {
12968
+ if (props2.allowDuplicates) {
12969
+ addTag();
12970
+ } else {
12971
+ if (!Array.isArray(modelValue2.value) || !modelValue2.value.includes(inputValue.value)) {
12972
+ addTag();
12973
+ } else {
12974
+ LewMessage$1.warning(locale.t("inputTag.duplicate"));
12975
+ }
12976
+ }
12977
+ openInput();
12978
+ }
12979
+ }
12953
12980
  } else {
12954
- isConfirm.value = true;
12981
+ if (keyCode === "Backspace" || keyCode === "Delete") {
12982
+ if (Array.isArray(modelValue2.value) && modelValue2.value.length > 0 && isTagMarkedForDeletion.value) {
12983
+ try {
12984
+ const newValue = [...modelValue2.value || []];
12985
+ newValue.splice(newValue.length - 1, 1);
12986
+ modelValue2.value = newValue;
12987
+ emit2("change", cloneDeep(newValue));
12988
+ } catch (error2) {
12989
+ console.error("删除标签时出错:", error2);
12990
+ }
12991
+ isTagMarkedForDeletion.value = false;
12992
+ } else {
12993
+ isTagMarkedForDeletion.value = true;
12994
+ }
12995
+ }
12996
+ if (keyCode === "Enter" || keyCode === "NumpadEnter") {
12997
+ if (lewInputRef.value && typeof lewInputRef.value.toBlur === "function") {
12998
+ lewInputRef.value.toBlur();
12999
+ }
13000
+ }
12955
13001
  }
13002
+ } catch (error2) {
13003
+ console.error("键盘事件处理出错:", error2);
13004
+ document.onkeydown = originalKeydownHandler;
12956
13005
  }
12957
- } else if (event.keyCode === 13) {
12958
- isConfirm.value = true;
12959
- isEnter = true;
12960
- }
12961
- };
13006
+ };
13007
+ } catch (error2) {
13008
+ console.error("打开输入框时出错:", error2);
13009
+ isInputActive.value = false;
13010
+ }
12962
13011
  };
12963
- const blurFn = () => {
12964
- document.onkeydown = null;
12965
- isFocus.value = false;
12966
- isConfirm.value = false;
12967
- if (props2.allowDuplicates) {
12968
- addTag();
12969
- } else {
12970
- if (!(modelValue2.value || []).includes(inputValue.value)) {
12971
- addTag();
12972
- } else {
12973
- LewMessage$1.warning(locale.t("inputTag.duplicate"));
13012
+ onUnmounted(() => {
13013
+ try {
13014
+ if (document.onkeydown && document.onkeydown !== originalKeydownHandler) {
13015
+ document.onkeydown = originalKeydownHandler;
12974
13016
  }
13017
+ } catch (error2) {
13018
+ console.error("卸载组件时清除键盘事件处理器出错:", error2);
12975
13019
  }
12976
- if (isEnter) {
12977
- openInput();
12978
- }
12979
- isEnter = false;
12980
- };
13020
+ });
12981
13021
  const addTag = () => {
12982
- let _value = modelValue2.value || [];
12983
- if (inputValue.value) {
13022
+ try {
13023
+ let _value = Array.isArray(modelValue2.value) ? [...modelValue2.value] : [];
13024
+ if (!inputValue.value || inputValue.value.trim() === "") {
13025
+ return;
13026
+ }
12984
13027
  if (props2.maxLength > 0 && _value.length >= props2.maxLength) {
12985
13028
  inputValue.value = "";
12986
- isFocus.value = false;
13029
+ isInputActive.value = false;
13030
+ LewMessage$1.warning(
13031
+ locale.t("inputTag.maxLength", { maxLength: props2.maxLength })
13032
+ );
12987
13033
  return;
12988
13034
  }
12989
13035
  _value.push(inputValue.value);
13036
+ const addedValue = inputValue.value;
12990
13037
  inputValue.value = "";
12991
13038
  modelValue2.value = _value;
12992
- emit2("change", _value);
12993
- emit2("add", inputValue.value);
13039
+ emit2("change", cloneDeep(_value));
13040
+ emit2("add", addedValue);
13041
+ } catch (error2) {
13042
+ console.error("添加标签时出错:", error2);
12994
13043
  }
12995
13044
  };
12996
- const autoWidthDelay = ref(false);
12997
13045
  const delTag = (index2) => {
12998
- var _a2;
12999
- const removedTag = (_a2 = modelValue2.value) == null ? void 0 : _a2[index2];
13000
- modelValue2.value && modelValue2.value.splice(index2, 1);
13001
- if (modelValue2.value && modelValue2.value.length === 0) {
13002
- autoWidthDelay.value = true;
13003
- setTimeout(() => {
13004
- autoWidthDelay.value = false;
13005
- }, 550);
13046
+ try {
13047
+ if (!Array.isArray(modelValue2.value) || index2 < 0 || index2 >= modelValue2.value.length) {
13048
+ return;
13049
+ }
13050
+ const removedTag = modelValue2.value[index2];
13051
+ const newValue = [...modelValue2.value];
13052
+ newValue.splice(index2, 1);
13053
+ modelValue2.value = newValue;
13054
+ if (newValue.length === 0) {
13055
+ autoWidthDelay.value = true;
13056
+ setTimeout(() => {
13057
+ autoWidthDelay.value = false;
13058
+ }, 550);
13059
+ }
13060
+ emit2("change", cloneDeep(newValue));
13061
+ emit2("remove", removedTag);
13062
+ } catch (error2) {
13063
+ console.error("删除标签时出错:", error2);
13006
13064
  }
13007
- emit2("change", modelValue2.value);
13008
- emit2("remove", removedTag);
13009
13065
  };
13010
13066
  const getInputClassNames = computed(() => {
13011
- const { size, readonly: readonly2, disabled, clearable } = props2;
13012
- return object2class("lew-input-tag-view", {
13013
- size,
13014
- readonly: readonly2,
13015
- disabled,
13016
- clearable
13017
- });
13067
+ try {
13068
+ const { size, readonly: readonly2, disabled, clearable } = props2;
13069
+ return object2class("lew-input-tag-view", {
13070
+ size,
13071
+ readonly: readonly2,
13072
+ disabled,
13073
+ clearable
13074
+ });
13075
+ } catch (error2) {
13076
+ console.error("计算输入框类名时出错:", error2);
13077
+ return "lew-input-tag-view";
13078
+ }
13018
13079
  });
13019
13080
  const getIconSize = computed(() => {
13020
- const size = {
13021
- small: 13,
13022
- medium: 14,
13023
- large: 16
13024
- };
13025
- return size[props2.size];
13081
+ try {
13082
+ const size = {
13083
+ small: 13,
13084
+ medium: 14,
13085
+ large: 16
13086
+ };
13087
+ return size[props2.size] || 14;
13088
+ } catch (error2) {
13089
+ console.error("计算图标大小时出错:", error2);
13090
+ return 14;
13091
+ }
13026
13092
  });
13027
13093
  const clear = () => {
13028
- modelValue2.value = [];
13029
- inputValue.value = "";
13030
- emit2("change", []);
13031
- emit2("clear");
13094
+ try {
13095
+ modelValue2.value = [];
13096
+ inputValue.value = "";
13097
+ emit2("change", []);
13098
+ emit2("clear");
13099
+ } catch (error2) {
13100
+ console.error("清空标签时出错:", error2);
13101
+ }
13102
+ };
13103
+ const onBlur = () => {
13104
+ isInputActive.value = false;
13105
+ if (inputValue.value) {
13106
+ addTag();
13107
+ }
13032
13108
  };
13033
13109
  return (_ctx, _cache) => {
13034
13110
  return openBlock(), createElementBlock("div", {
@@ -13048,7 +13124,8 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
13048
13124
  type: "light",
13049
13125
  style: normalizeStyle({
13050
13126
  maxWidth: "100%",
13051
- backgroundColor: unref(isConfirm) && index2 === (modelValue2.value || []).length - 1 ? "var(--lew-color-red-light)" : ""
13127
+ backgroundColor: unref(isTagMarkedForDeletion) && index2 === (modelValue2.value || []).length - 1 ? "var(--lew-color-red-light)" : "",
13128
+ color: unref(isTagMarkedForDeletion) && index2 === (modelValue2.value || []).length - 1 ? "var(--lew-color-red-dark)" : "var(--lew-color-blue-dark)"
13052
13129
  }),
13053
13130
  size: _ctx.size,
13054
13131
  closable: !_ctx.readonly && !_ctx.disabled,
@@ -13061,7 +13138,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
13061
13138
  _: 2
13062
13139
  }, 1032, ["style", "size", "closable", "readonly", "onClose"]);
13063
13140
  }), 128)),
13064
- unref(isFocus) || (modelValue2.value || []).length === 0 ? (openBlock(), createBlock(unref(LewInput), {
13141
+ unref(isInputActive) || (modelValue2.value || []).length === 0 ? (openBlock(), createBlock(unref(LewInput), {
13065
13142
  key: 0,
13066
13143
  ref_key: "lewInputRef",
13067
13144
  ref: lewInputRef,
@@ -13070,11 +13147,10 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
13070
13147
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(inputValue) ? inputValue.value = $event : null),
13071
13148
  class: "lew-input-tag",
13072
13149
  size: _ctx.size,
13073
- readonly: !unref(isFocus),
13150
+ readonly: !unref(isInputActive),
13074
13151
  placeholder: (modelValue2.value || []).length === 0 ? unref(locale).t("inputTag.placeholder") : " ",
13075
- "ok-by-enter": "",
13076
- onInput: _cache[1] || (_cache[1] = ($event) => isRef(isConfirm) ? isConfirm.value = false : isConfirm = false),
13077
- onBlur: blurFn
13152
+ onInput: _cache[1] || (_cache[1] = ($event) => isTagMarkedForDeletion.value = false),
13153
+ onBlur
13078
13154
  }, null, 8, ["auto-width", "modelValue", "size", "readonly", "placeholder"])) : createCommentVNode("", true)
13079
13155
  ]),
13080
13156
  _: 1
@@ -13084,7 +13160,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
13084
13160
  _ctx.clearable && (modelValue2.value || []).length > 0 && !_ctx.readonly && !_ctx.disabled ? (openBlock(), createBlock(Icon, {
13085
13161
  key: 0,
13086
13162
  class: normalizeClass(["lew-form-icon-close", {
13087
- "lew-form-icon-close-focus": unref(isFocus)
13163
+ "lew-form-icon-close-focus": unref(isInputActive)
13088
13164
  }]),
13089
13165
  size: unref(getIconSize),
13090
13166
  type: "close",
@@ -13100,7 +13176,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
13100
13176
  };
13101
13177
  }
13102
13178
  });
13103
- const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-835c2532"]]);
13179
+ const LewInputTag = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-1c3ae010"]]);
13104
13180
  const checkboxModel = {
13105
13181
  modelValue: {
13106
13182
  type: Boolean,
@@ -13587,7 +13663,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
13587
13663
  };
13588
13664
  }
13589
13665
  });
13590
- const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-a3035b1f"]]);
13666
+ const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-c2a62db1"]]);
13591
13667
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
13592
13668
  __name: "LewRadioGroup",
13593
13669
  props: /* @__PURE__ */ mergeModels(radioGroupProps, {
@@ -13924,7 +14000,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
13924
14000
  };
13925
14001
  }
13926
14002
  });
13927
- const LewTabs = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-0d554416"]]);
14003
+ const LewTabs = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-b0af215e"]]);
13928
14004
  function vue3h(ele, props2, children) {
13929
14005
  const { attrs, on, ...rest } = props2;
13930
14006
  let event = {};
@@ -14858,9 +14934,19 @@ const selectProps = {
14858
14934
  },
14859
14935
  width: {
14860
14936
  type: [String, Number],
14861
- default: "300px",
14937
+ default: "240px",
14862
14938
  description: "选择器宽度,支持数字(单位:像素)或带单位的字符串"
14863
14939
  },
14940
+ popoverWidth: {
14941
+ type: [String, Number],
14942
+ default: "240px",
14943
+ description: "下拉菜单宽度,支持数字(单位:像素)或带单位的字符串"
14944
+ },
14945
+ autoWidth: {
14946
+ type: Boolean,
14947
+ default: false,
14948
+ description: "是否自动调整宽度"
14949
+ },
14864
14950
  trigger: {
14865
14951
  type: String,
14866
14952
  default: "click",
@@ -14990,6 +15076,7 @@ const _hoisted_3$d = {
14990
15076
  class: "lew-result-count"
14991
15077
  };
14992
15078
  const _hoisted_4$a = ["onClick"];
15079
+ const SELECT_WIDTH_TOLERANCE = 26;
14993
15080
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
14994
15081
  __name: "LewSelect",
14995
15082
  props: /* @__PURE__ */ mergeModels(selectProps, {
@@ -15028,14 +15115,15 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15028
15115
  );
15029
15116
  const virtListRef = ref();
15030
15117
  const state = reactive({
15031
- selectWidth: 0,
15032
15118
  visible: false,
15033
15119
  loading: false,
15034
15120
  options: flattenOptions(props2.options),
15035
15121
  hideBySelect: false,
15036
15122
  // 记录是否通过选择隐藏
15037
15123
  keyword: props2.defaultValue || selectValue.value,
15038
- keywordBackup: props2.defaultValue
15124
+ keywordBackup: props2.defaultValue,
15125
+ autoWidth: 0
15126
+ // 新增自动宽度
15039
15127
  });
15040
15128
  watch(
15041
15129
  () => props2.defaultValue,
@@ -15043,10 +15131,48 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15043
15131
  state.keyword = props2.defaultValue;
15044
15132
  }
15045
15133
  );
15046
- const getSelectWidth = () => {
15047
- var _a;
15048
- state.selectWidth = ((_a = lewSelectRef.value) == null ? void 0 : _a.clientWidth) - 12;
15134
+ const computedWidth = computed(() => {
15135
+ if (props2.autoWidth && state.autoWidth > 0) {
15136
+ return Number(state.autoWidth);
15137
+ }
15138
+ return Number(props2.width);
15139
+ });
15140
+ onMounted(() => {
15141
+ if (props2.autoWidth) {
15142
+ calculateAutoWidth();
15143
+ }
15144
+ });
15145
+ const calculateAutoWidth = () => {
15146
+ if (!props2.autoWidth) return;
15147
+ const tempDiv = document.createElement("div");
15148
+ tempDiv.style.position = "absolute";
15149
+ tempDiv.style.visibility = "hidden";
15150
+ tempDiv.style.whiteSpace = "nowrap";
15151
+ tempDiv.style.fontSize = getComputedStyle(document.body).fontSize;
15152
+ if (inputRef.value) {
15153
+ tempDiv.style.fontSize = getComputedStyle(inputRef.value).fontSize;
15154
+ tempDiv.style.padding = getComputedStyle(inputRef.value).padding;
15155
+ tempDiv.style.fontFamily = getComputedStyle(inputRef.value).fontFamily;
15156
+ tempDiv.style.fontWeight = getComputedStyle(inputRef.value).fontWeight;
15157
+ }
15158
+ let textContent = state.keyword;
15159
+ if (!textContent || textContent.trim() === "") {
15160
+ textContent = props2.placeholder || locale.t("select.placeholder");
15161
+ }
15162
+ tempDiv.innerText = textContent;
15163
+ document.body.appendChild(tempDiv);
15164
+ const textWidth = tempDiv.clientWidth;
15165
+ state.autoWidth = textWidth + SELECT_WIDTH_TOLERANCE;
15166
+ document.body.removeChild(tempDiv);
15049
15167
  };
15168
+ watch(
15169
+ () => state.keyword,
15170
+ () => {
15171
+ if (props2.autoWidth) {
15172
+ calculateAutoWidth();
15173
+ }
15174
+ }
15175
+ );
15050
15176
  const show = () => {
15051
15177
  lewPopoverRef.value.show();
15052
15178
  };
@@ -15152,12 +15278,14 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15152
15278
  const showHandle = () => {
15153
15279
  state.visible = true;
15154
15280
  state.keywordBackup = cloneDeep(state.keyword);
15281
+ if (props2.searchable) {
15282
+ inputRef.value.focus();
15283
+ }
15155
15284
  emit2("focus");
15156
15285
  if (props2.searchable) {
15157
15286
  state.keyword = "";
15158
15287
  }
15159
15288
  state.hideBySelect = false;
15160
- getSelectWidth();
15161
15289
  if (props2.searchable) {
15162
15290
  search({ target: { value: "" } });
15163
15291
  }
@@ -15190,6 +15318,9 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15190
15318
  () => selectValue.value,
15191
15319
  () => {
15192
15320
  findKeyword();
15321
+ if (props2.autoWidth) {
15322
+ calculateAutoWidth();
15323
+ }
15193
15324
  }
15194
15325
  );
15195
15326
  watch(
@@ -15211,10 +15342,10 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15211
15342
  ref: lewPopoverRef,
15212
15343
  popoverBodyClassName: "lew-select-popover-body",
15213
15344
  class: "lew-select-view",
15345
+ style: normalizeStyle({ width: _ctx.autoWidth ? "auto" : unref(any2px)(_ctx.width) }),
15214
15346
  trigger: _ctx.trigger,
15215
15347
  disabled: _ctx.disabled || _ctx.readonly,
15216
15348
  placement: "bottom-start",
15217
- style: normalizeStyle({ width: unref(any2px)(_ctx.width) }),
15218
15349
  loading: unref(state).loading,
15219
15350
  onShow: showHandle,
15220
15351
  onHide: hideHandle
@@ -15223,7 +15354,8 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15223
15354
  createElementVNode("div", {
15224
15355
  ref_key: "lewSelectRef",
15225
15356
  ref: lewSelectRef,
15226
- class: normalizeClass(["lew-select", unref(getSelectClassName)])
15357
+ class: normalizeClass(["lew-select", unref(getSelectClassName)]),
15358
+ style: normalizeStyle({ width: unref(any2px)(unref(computedWidth)) })
15227
15359
  }, [
15228
15360
  createVNode(Icon, {
15229
15361
  size: unref(getIconSize),
@@ -15257,12 +15389,12 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15257
15389
  }, null, 44, _hoisted_1$u), [
15258
15390
  [vModelText, unref(state).keyword]
15259
15391
  ])
15260
- ], 2)
15392
+ ], 6)
15261
15393
  ]),
15262
15394
  "popover-body": withCtx(() => [
15263
15395
  createElementVNode("div", {
15264
15396
  class: normalizeClass(["lew-select-body", unref(getBodyClassName)]),
15265
- style: normalizeStyle(`width:${unref(state).selectWidth}px`)
15397
+ style: normalizeStyle({ width: `calc(${unref(any2px)(_ctx.popoverWidth)} - 14px)` })
15266
15398
  }, [
15267
15399
  renderSlot(_ctx.$slots, "header", {}, void 0, true),
15268
15400
  createElementVNode("div", _hoisted_2$h, [
@@ -15336,11 +15468,11 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
15336
15468
  ], 6)
15337
15469
  ]),
15338
15470
  _: 3
15339
- }, 8, ["trigger", "disabled", "style", "loading"]);
15471
+ }, 8, ["style", "trigger", "disabled", "loading"]);
15340
15472
  };
15341
15473
  }
15342
15474
  });
15343
- const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-499efdf9"]]);
15475
+ const LewSelect = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__scopeId", "data-v-08008d58"]]);
15344
15476
  const selectMultipleModel = {
15345
15477
  modelValue: {
15346
15478
  type: Array,
@@ -17431,7 +17563,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
17431
17563
  };
17432
17564
  }
17433
17565
  });
17434
- const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-2df69772"]]);
17566
+ const LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__scopeId", "data-v-f92cbfbb"]]);
17435
17567
  const cascaderModel = {
17436
17568
  modelValue: {
17437
17569
  type: [String, Number],
@@ -19177,7 +19309,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
19177
19309
  };
19178
19310
  }
19179
19311
  });
19180
- const LewSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-5c9f9ee3"]]);
19312
+ const LewSwitch = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-98eecdc4"]]);
19181
19313
  const sliderModel = {
19182
19314
  modelValue: {
19183
19315
  type: [Number, void 0],
@@ -21054,7 +21186,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
21054
21186
  };
21055
21187
  }
21056
21188
  });
21057
- const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-f27730be"]]);
21189
+ const LewUpload = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-fe60ab42"]]);
21058
21190
  const rateModel = {
21059
21191
  modelValue: {
21060
21192
  type: Number,
@@ -21227,7 +21359,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
21227
21359
  };
21228
21360
  }
21229
21361
  });
21230
- const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-9d59e2d2"]]);
21362
+ const LewRate = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__scopeId", "data-v-478c6caf"]]);
21231
21363
  const tableModel = {
21232
21364
  selectedKeys: {
21233
21365
  type: [Array, String, Number, void 0],
@@ -22237,19 +22369,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22237
22369
  size
22238
22370
  });
22239
22371
  });
22240
- const getSelectWidth = computed(() => {
22241
- const { size } = props2;
22242
- switch (size) {
22243
- case "small":
22244
- return "120px";
22245
- case "medium":
22246
- return "140px";
22247
- case "large":
22248
- return "160px";
22249
- default:
22250
- return "140px";
22251
- }
22252
- });
22253
22372
  const getIconSize = computed(() => {
22254
22373
  const { size } = props2;
22255
22374
  switch (size) {
@@ -22296,7 +22415,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22296
22415
  key: 0,
22297
22416
  class: "lew-pagination-page-btn",
22298
22417
  onClick: _cache[1] || (_cache[1] = ($event) => changePage(1))
22299
- }, " 1 ")) : createCommentVNode("", true),
22418
+ }, "1")) : createCommentVNode("", true),
22300
22419
  unref(startEllipsis) ? (openBlock(), createElementBlock("div", {
22301
22420
  key: 1,
22302
22421
  class: "lew-pagination-page-btn",
@@ -22359,14 +22478,13 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22359
22478
  createVNode(unref(LewSelect), {
22360
22479
  modelValue: unref(state).pageSize,
22361
22480
  "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(state).pageSize = $event),
22362
- style: normalizeStyle({
22363
- width: unref(getSelectWidth)
22364
- }),
22481
+ "auto-width": "",
22482
+ "popover-width": 150,
22365
22483
  size: _ctx.size,
22366
22484
  showCheckIcon: false,
22367
22485
  options: unref(getPageSizeOptions),
22368
22486
  onChange: checkPageSize
22369
- }, null, 8, ["modelValue", "style", "size", "options"]),
22487
+ }, null, 8, ["modelValue", "size", "options"]),
22370
22488
  createVNode(unref(LewInput), {
22371
22489
  modelValue: unref(state).toPage,
22372
22490
  "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(state).toPage = $event),
@@ -22384,7 +22502,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
22384
22502
  };
22385
22503
  }
22386
22504
  });
22387
- const LewPagination = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-27faebf9"]]);
22505
+ const LewPagination = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__scopeId", "data-v-2b643fcc"]]);
22388
22506
  const treeModel = {
22389
22507
  modelValue: {
22390
22508
  type: [Array, String],
@@ -23102,7 +23220,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
23102
23220
  };
23103
23221
  }
23104
23222
  });
23105
- const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-11fe5966"]]);
23223
+ const LewTree = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-61065050"]]);
23106
23224
  const collapseModel = {
23107
23225
  modelValue: {
23108
23226
  type: [Array, String],
@@ -24066,7 +24184,7 @@ const modalProps = {
24066
24184
  },
24067
24185
  top: {
24068
24186
  type: [String, Number],
24069
- default: 250,
24187
+ default: 120,
24070
24188
  description: '模态框距离顶部的距离,可以是数字(单位:像素)或字符串(如 "50%")'
24071
24189
  },
24072
24190
  hideFooter: {
@@ -24269,7 +24387,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
24269
24387
  };
24270
24388
  }
24271
24389
  });
24272
- const LewModal = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-ec329249"]]);
24390
+ const LewModal = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7f01f624"]]);
24273
24391
  const popokProps = {
24274
24392
  type: {
24275
24393
  type: String,