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