@v-c/select 1.2.5 → 1.2.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/dist/BaseSelect/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import SelectInput from "../SelectInput/index.js";
|
|
|
10
10
|
import SelectTrigger from "../SelectTrigger.js";
|
|
11
11
|
import Polite from "./Polite.js";
|
|
12
12
|
import { Fragment, computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
|
|
13
|
-
import { clsx } from "@v-c/util";
|
|
13
|
+
import { clsx, isNonNullable } from "@v-c/util";
|
|
14
14
|
import { KeyCodeStr } from "@v-c/util/dist/KeyCode";
|
|
15
15
|
import omit from "@v-c/util/dist/omit";
|
|
16
16
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
@@ -316,7 +316,7 @@ var BaseSelect = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
|
316
316
|
[`${prefixCls}-multiple`]: multiple.value,
|
|
317
317
|
[`${prefixCls}-single`]: !multiple.value,
|
|
318
318
|
[`${prefixCls}-allow-clear`]: mergedAllowClear,
|
|
319
|
-
[`${prefixCls}-show-arrow`]: mergedSuffixIcon
|
|
319
|
+
[`${prefixCls}-show-arrow`]: isNonNullable(mergedSuffixIcon),
|
|
320
320
|
[`${prefixCls}-disabled`]: disabled.value,
|
|
321
321
|
[`${prefixCls}-loading`]: loading,
|
|
322
322
|
[`${prefixCls}-open`]: mergedOpen.value,
|
package/dist/Select.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useSelectProvider } from "./SelectContext.js";
|
|
|
2
2
|
import { fillFieldNames, flattenOptions, injectPropsWithOption } from "./utils/valueUtil.js";
|
|
3
3
|
import OptionList from "./OptionList.js";
|
|
4
4
|
import useCache from "./hooks/useCache.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isComboNoValue, toArray } from "./utils/commonUtil.js";
|
|
6
6
|
import useFilterOptions from "./hooks/useFilterOptions.js";
|
|
7
7
|
import useOptions from "./hooks/useOptions.js";
|
|
8
8
|
import useRefFunc from "./hooks/useRefFunc.js";
|
|
@@ -10,6 +10,7 @@ import useSearchConfig from "./hooks/useSearchConfig.js";
|
|
|
10
10
|
import { BaseSelect, isMultiple } from "./BaseSelect/index.js";
|
|
11
11
|
import { convertChildrenToData } from "./utils/legacyUtil.js";
|
|
12
12
|
import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef, toRef, watch } from "vue";
|
|
13
|
+
import { isNonNullable } from "@v-c/util";
|
|
13
14
|
import useId from "@v-c/util/dist/hooks/useId";
|
|
14
15
|
import omit from "@v-c/util/dist/omit";
|
|
15
16
|
import { filterEmpty } from "@v-c/util/dist/props-util";
|
|
@@ -654,7 +655,7 @@ var Select = /* @__PURE__ */ defineComponent({
|
|
|
654
655
|
watch(mergedValues, () => {
|
|
655
656
|
if (props.mode === "combobox") {
|
|
656
657
|
const strValue = mergedValues.value[0]?.value;
|
|
657
|
-
setSearchValue(
|
|
658
|
+
setSearchValue(isNonNullable(strValue) ? String(strValue) : "");
|
|
658
659
|
}
|
|
659
660
|
});
|
|
660
661
|
const createTagOption = useRefFunc((val, label) => {
|
|
@@ -4,7 +4,7 @@ import Affix from "./Affix.js";
|
|
|
4
4
|
import { useSelectInputProvider } from "./context.js";
|
|
5
5
|
import SelectContent from "./Content/index.js";
|
|
6
6
|
import { cloneVNode, computed, createVNode, defineComponent, isVNode, mergeProps, shallowRef } from "vue";
|
|
7
|
-
import { clsx } from "@v-c/util";
|
|
7
|
+
import { clsx, isVueRenderable } from "@v-c/util";
|
|
8
8
|
import KeyCode, { KeyCodeStr } from "@v-c/util/dist/KeyCode";
|
|
9
9
|
import omit from "@v-c/util/dist/omit";
|
|
10
10
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
@@ -157,7 +157,7 @@ var SelectInput = /* @__PURE__ */ defineComponent((props, { attrs, expose, slots
|
|
|
157
157
|
"class": clsx(`${prefixCls.value}-suffix`, { [`${prefixCls.value}-suffix-loading`]: loading.value }, classNamesConfig.value?.suffix),
|
|
158
158
|
"style": stylesConfig.value?.suffix
|
|
159
159
|
}, { default: () => [suffix.value] }),
|
|
160
|
-
clearIcon.value && createVNode("button", {
|
|
160
|
+
isVueRenderable(clearIcon.value) && createVNode("button", {
|
|
161
161
|
"type": "button",
|
|
162
162
|
"aria-label": clearLabel.value,
|
|
163
163
|
"class": clsx(`${prefixCls.value}-clear`, classNamesConfig.value?.clear),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
|
+
import { isVueRenderable } from "@v-c/util";
|
|
2
3
|
//#region src/hooks/useAllowClear.tsx
|
|
3
4
|
function useAllowClear(_prefixCls, displayValues, allowClear, clearIcon, disabled, mergedSearchValue, mode) {
|
|
4
5
|
const allowClearConfig = computed(() => {
|
|
@@ -10,7 +11,7 @@ function useAllowClear(_prefixCls, displayValues, allowClear, clearIcon, disable
|
|
|
10
11
|
const mergedAllowClear = !disabled?.value && allowClearConfig.value?.allowClear !== false && (displayValues.value.length || mergedSearchValue?.value) && !(mode?.value === "combobox" && mergedSearchValue?.value === "");
|
|
11
12
|
return {
|
|
12
13
|
allowClear: !!mergedAllowClear,
|
|
13
|
-
clearIcon: mergedAllowClear ? allowClearConfig.value.clearIcon
|
|
14
|
+
clearIcon: mergedAllowClear ? isVueRenderable(allowClearConfig.value.clearIcon) ? allowClearConfig.value.clearIcon : isVueRenderable(clearIcon?.value) ? clearIcon.value : "×" : null,
|
|
14
15
|
label: mergedAllowClear ? allowClearConfig.value.label ?? "Clear" : ""
|
|
15
16
|
};
|
|
16
17
|
});
|
|
@@ -7,6 +7,5 @@ export declare function getTitle(item: DisplayValueType): string | undefined;
|
|
|
7
7
|
export declare const isClient: false | HTMLElement;
|
|
8
8
|
/** Is client side and not jsdom */
|
|
9
9
|
export declare const isBrowserClient: false | HTMLElement;
|
|
10
|
-
export declare function hasValue(value: any): boolean;
|
|
11
10
|
/** combo mode no value judgment function */
|
|
12
11
|
export declare function isComboNoValue(value: any): boolean;
|
package/dist/utils/commonUtil.js
CHANGED
|
@@ -23,12 +23,9 @@ function getTitle(item) {
|
|
|
23
23
|
var isClient = typeof window !== "undefined" && window.document && window.document.documentElement;
|
|
24
24
|
/** Is client side and not jsdom */
|
|
25
25
|
var isBrowserClient = typeof process !== "undefined" && process.env.NODE_ENV !== "test" && isClient;
|
|
26
|
-
function hasValue(value) {
|
|
27
|
-
return value !== void 0 && value !== null;
|
|
28
|
-
}
|
|
29
26
|
/** combo mode no value judgment function */
|
|
30
27
|
function isComboNoValue(value) {
|
|
31
28
|
return !value && value !== 0;
|
|
32
29
|
}
|
|
33
30
|
//#endregion
|
|
34
|
-
export { getTitle,
|
|
31
|
+
export { getTitle, injectPropsWithOption, isBrowserClient, isClient, isComboNoValue, toArray, toVueNode };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/select",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.6",
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"vue": "^3.0.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@v-c/overflow": "^1.1.
|
|
37
|
+
"@v-c/overflow": "^1.1.2",
|
|
38
38
|
"@v-c/trigger": "^1.1.1",
|
|
39
39
|
"@v-c/virtual-list": "^1.1.1",
|
|
40
|
-
"@v-c/util": "^1.
|
|
40
|
+
"@v-c/util": "^1.2.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "vite build",
|