@v-c/select 1.1.2 → 1.1.4
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/BaseSelect/index.js +1 -1
- package/dist/Select.js +12 -4
- package/dist/SelectInput/Input.js +4 -2
- package/dist/SelectTrigger.js +2 -3
- package/package.json +9 -4
package/dist/BaseSelect/index.js
CHANGED
|
@@ -381,7 +381,7 @@ var BaseSelect = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
|
381
381
|
}, null), renderNode]);
|
|
382
382
|
};
|
|
383
383
|
}, {
|
|
384
|
-
props:
|
|
384
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
385
385
|
className: {
|
|
386
386
|
type: String,
|
|
387
387
|
required: false,
|
package/dist/Select.js
CHANGED
|
@@ -55,7 +55,7 @@ function isRawValue(value) {
|
|
|
55
55
|
return !value || typeof value !== "object";
|
|
56
56
|
}
|
|
57
57
|
var Select = /* @__PURE__ */ defineComponent({
|
|
58
|
-
props:
|
|
58
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
59
59
|
prefixCls: {
|
|
60
60
|
type: String,
|
|
61
61
|
required: false,
|
|
@@ -621,7 +621,8 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
621
621
|
internalValue.value = val;
|
|
622
622
|
};
|
|
623
623
|
const [mergedValues, getMixedOption] = useCache(computed(() => {
|
|
624
|
-
const
|
|
624
|
+
const newInternalValue = multiple.value && internalValue.value === null ? [] : internalValue.value;
|
|
625
|
+
const values = convert2LabelValues(newInternalValue);
|
|
625
626
|
if (props.mode === "combobox" && isComboNoValue(values[0]?.value)) return [];
|
|
626
627
|
return values;
|
|
627
628
|
}), valueOptions);
|
|
@@ -663,6 +664,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
663
664
|
const filledSearchOptions = computed(() => {
|
|
664
665
|
if (props.mode !== "tags" || !mergedSearchValue.value || filteredOptions.value.some((item) => item[props.optionFilterProp || "value"] === mergedSearchValue.value)) return filteredOptions.value;
|
|
665
666
|
if (filteredOptions.value.some((item) => item[mergedFieldNames.value.value] === mergedSearchValue.value)) return filteredOptions.value;
|
|
667
|
+
if (valueOptions.value.get(mergedSearchValue.value)?.disabled) return filteredOptions.value;
|
|
666
668
|
return [createTagOption(mergedSearchValue.value), ...filteredOptions.value];
|
|
667
669
|
});
|
|
668
670
|
const sorter = (inputOptions) => {
|
|
@@ -746,7 +748,12 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
746
748
|
if (info.source === "submit") {
|
|
747
749
|
const formatted = (searchText || "").trim();
|
|
748
750
|
if (formatted) {
|
|
749
|
-
|
|
751
|
+
if (valueOptions.value.get(formatted)?.disabled) {
|
|
752
|
+
setSearchValue("");
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const newRawValues = Array.from(/* @__PURE__ */ new Set([...rawValues.value, formatted]));
|
|
756
|
+
triggerChange(newRawValues);
|
|
750
757
|
triggerSelect(formatted, true);
|
|
751
758
|
setSearchValue("");
|
|
752
759
|
}
|
|
@@ -762,7 +769,8 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
762
769
|
if (props.mode !== "tags") patchValues = words.map((word) => {
|
|
763
770
|
return labelOptions.value.get(word)?.[mergedFieldNames.value.value];
|
|
764
771
|
}).filter((val) => val !== void 0);
|
|
765
|
-
|
|
772
|
+
if (props.mode === "tags") patchValues = patchValues.filter((val) => !valueOptions.value.get(val)?.disabled);
|
|
773
|
+
const newRawValues = Array.from(/* @__PURE__ */ new Set([...rawValues.value, ...patchValues]));
|
|
766
774
|
triggerChange(newRawValues);
|
|
767
775
|
newRawValues.forEach((newRawValue) => {
|
|
768
776
|
triggerSelect(newRawValue, true);
|
|
@@ -48,7 +48,8 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
|
48
48
|
};
|
|
49
49
|
const handlePaste = (event) => {
|
|
50
50
|
const { clipboardData } = event;
|
|
51
|
-
|
|
51
|
+
const pastedValue = clipboardData?.getData?.("text");
|
|
52
|
+
pastedTextRef.value = pastedValue || "";
|
|
52
53
|
};
|
|
53
54
|
const widthCssVar = shallowRef();
|
|
54
55
|
watch([() => props.syncWidth, () => props.value], async () => {
|
|
@@ -56,7 +57,8 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
|
56
57
|
const input = inputRef.value;
|
|
57
58
|
if (props.syncWidth && input) {
|
|
58
59
|
input.style.width = "0px";
|
|
59
|
-
|
|
60
|
+
const scrollWidth = input.scrollWidth;
|
|
61
|
+
widthCssVar.value = scrollWidth;
|
|
60
62
|
input.style.width = "";
|
|
61
63
|
}
|
|
62
64
|
}, { immediate: true });
|
package/dist/SelectTrigger.js
CHANGED
|
@@ -49,8 +49,7 @@ var SelectTrigger = /* @__PURE__ */ defineComponent((props, { slots, attrs, expo
|
|
|
49
49
|
});
|
|
50
50
|
const isNumberPopupWidth = computed(() => typeof props.popupMatchSelectWidth === "number");
|
|
51
51
|
const stretch = computed(() => {
|
|
52
|
-
|
|
53
|
-
return props.popupMatchSelectWidth === false ? "minWidth" : "width";
|
|
52
|
+
return props.popupMatchSelectWidth === false || isNumberPopupWidth.value ? "minWidth" : "width";
|
|
54
53
|
});
|
|
55
54
|
const triggerPopupRef = shallowRef();
|
|
56
55
|
expose({ getPopupElement: () => triggerPopupRef.value?.popupElement });
|
|
@@ -85,7 +84,7 @@ var SelectTrigger = /* @__PURE__ */ defineComponent((props, { slots, attrs, expo
|
|
|
85
84
|
}), { default: () => [slots?.default?.()] });
|
|
86
85
|
};
|
|
87
86
|
}, {
|
|
88
|
-
props:
|
|
87
|
+
props: /*@__PURE__*/ mergeDefaults({
|
|
89
88
|
prefixCls: {
|
|
90
89
|
type: String,
|
|
91
90
|
required: true
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/select",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/select",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/antdv-next/vue-components.git"
|
|
12
|
+
},
|
|
8
13
|
"publishConfig": {
|
|
9
14
|
"access": "public"
|
|
10
15
|
},
|
|
@@ -29,10 +34,10 @@
|
|
|
29
34
|
"vue": "^3.0.0"
|
|
30
35
|
},
|
|
31
36
|
"dependencies": {
|
|
37
|
+
"@v-c/trigger": "^1.0.17",
|
|
32
38
|
"@v-c/overflow": "^1.1.0",
|
|
33
|
-
"@v-c/
|
|
34
|
-
"@v-c/util": "^1.0.19"
|
|
35
|
-
"@v-c/virtual-list": "^1.0.9"
|
|
39
|
+
"@v-c/virtual-list": "^1.0.9",
|
|
40
|
+
"@v-c/util": "^1.0.19"
|
|
36
41
|
},
|
|
37
42
|
"scripts": {
|
|
38
43
|
"build": "vite build",
|