@v-c/select 1.2.4 → 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.
@@ -69,6 +69,7 @@ export interface BaseSelectProps extends BaseSelectPrivateProps {
69
69
  tagRender?: (props: CustomTagProps) => any;
70
70
  direction?: 'ltr' | 'rtl';
71
71
  autoFocus?: boolean;
72
+ autoComplete?: string;
72
73
  placeholder?: VueNode;
73
74
  maxCount?: number;
74
75
  title?: string;
@@ -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 !== void 0 && mergedSuffixIcon !== null,
319
+ [`${prefixCls}-show-arrow`]: isNonNullable(mergedSuffixIcon),
320
320
  [`${prefixCls}-disabled`]: disabled.value,
321
321
  [`${prefixCls}-loading`]: loading,
322
322
  [`${prefixCls}-open`]: mergedOpen.value,
@@ -430,6 +430,11 @@ var BaseSelect = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
430
430
  required: false,
431
431
  default: void 0
432
432
  },
433
+ autoComplete: {
434
+ type: String,
435
+ required: false,
436
+ default: void 0
437
+ },
433
438
  placeholder: {
434
439
  type: [
435
440
  Object,
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 { hasValue, isComboNoValue, toArray } from "./utils/commonUtil.js";
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";
@@ -248,6 +249,11 @@ var Select = /* @__PURE__ */ defineComponent({
248
249
  required: false,
249
250
  default: void 0
250
251
  },
252
+ autoComplete: {
253
+ type: String,
254
+ required: false,
255
+ default: void 0
256
+ },
251
257
  placeholder: {
252
258
  type: [
253
259
  Object,
@@ -649,7 +655,7 @@ var Select = /* @__PURE__ */ defineComponent({
649
655
  watch(mergedValues, () => {
650
656
  if (props.mode === "combobox") {
651
657
  const strValue = mergedValues.value[0]?.value;
652
- setSearchValue(hasValue(strValue) ? String(strValue) : "");
658
+ setSearchValue(isNonNullable(strValue) ? String(strValue) : "");
653
659
  }
654
660
  });
655
661
  const createTagOption = useRefFunc((val, label) => {
@@ -64,7 +64,7 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
64
64
  }, { immediate: true });
65
65
  return () => {
66
66
  const { style, autoComplete, className, value, readOnly } = props;
67
- const { prefixCls, autoFocus, placeholder } = selectInputContext.value ?? {};
67
+ const { prefixCls, autoFocus, autoComplete: contextAutoComplete, placeholder } = selectInputContext.value ?? {};
68
68
  const { input: InputComponent = "input" } = selectInputContext.value?.components ?? {};
69
69
  const { styles, id, classNames, open, activeDescendantId, role, disabled } = baseProps.value ?? {};
70
70
  const inputCls = clsx(`${prefixCls}-input`, classNames?.input, className);
@@ -80,7 +80,7 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
80
80
  "--select-input-width": widthCssVar.value
81
81
  },
82
82
  autoFocus,
83
- "autocomplete": autoComplete || "new-password",
83
+ "autocomplete": autoComplete ?? contextAutoComplete ?? "new-password",
84
84
  "class": inputCls,
85
85
  disabled,
86
86
  "value": value || "",
@@ -29,6 +29,7 @@ export interface SelectInputProps {
29
29
  onSelectorRemove?: (value: DisplayValueType) => void;
30
30
  maxLength?: number;
31
31
  autoFocus?: boolean;
32
+ autoComplete?: string;
32
33
  /** Check if `tokenSeparators` contains `\n` or `\r\n` */
33
34
  tokenWithEnter?: boolean;
34
35
  className?: string;
@@ -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";
@@ -22,6 +22,7 @@ var DEFAULT_OMIT_PROPS = [
22
22
  "onPopupScroll",
23
23
  "tabIndex",
24
24
  "activeValue",
25
+ "autoComplete",
25
26
  "onSelectorRemove",
26
27
  "focused"
27
28
  ];
@@ -156,7 +157,7 @@ var SelectInput = /* @__PURE__ */ defineComponent((props, { attrs, expose, slots
156
157
  "class": clsx(`${prefixCls.value}-suffix`, { [`${prefixCls.value}-suffix-loading`]: loading.value }, classNamesConfig.value?.suffix),
157
158
  "style": stylesConfig.value?.suffix
158
159
  }, { default: () => [suffix.value] }),
159
- clearIcon.value && createVNode("button", {
160
+ isVueRenderable(clearIcon.value) && createVNode("button", {
160
161
  "type": "button",
161
162
  "aria-label": clearLabel.value,
162
163
  "class": clsx(`${prefixCls.value}-clear`, classNamesConfig.value?.clear),
@@ -316,6 +317,11 @@ var SelectInput = /* @__PURE__ */ defineComponent((props, { attrs, expose, slots
316
317
  required: false,
317
318
  default: void 0
318
319
  },
320
+ autoComplete: {
321
+ type: String,
322
+ required: false,
323
+ default: void 0
324
+ },
319
325
  tokenWithEnter: {
320
326
  type: Boolean,
321
327
  required: false,
@@ -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 || clearIcon?.value || "×" : null,
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;
@@ -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, hasValue, injectPropsWithOption, isBrowserClient, isClient, isComboNoValue, toArray, toVueNode };
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",
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.1",
38
- "@v-c/trigger": "^1.1.0",
39
- "@v-c/util": "^1.1.0",
40
- "@v-c/virtual-list": "^1.1.1"
37
+ "@v-c/overflow": "^1.1.2",
38
+ "@v-c/trigger": "^1.1.1",
39
+ "@v-c/virtual-list": "^1.1.1",
40
+ "@v-c/util": "^1.2.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "vite build",