@v-c/select 1.0.21 → 1.0.23

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.
@@ -5,9 +5,9 @@ import useLock from "../hooks/useLock.js";
5
5
  import useOpen, { macroTask } from "../hooks/useOpen.js";
6
6
  import useSelectTriggerControl, { isInside } from "../hooks/useSelectTriggerControl.js";
7
7
  import "../hooks/index.js";
8
+ import { getSeparatedContent, isValidCount } from "../utils/valueUtil.js";
8
9
  import SelectInput from "../SelectInput/index.js";
9
10
  import SelectTrigger from "../SelectTrigger.js";
10
- import { getSeparatedContent, isValidCount } from "../utils/valueUtil.js";
11
11
  import Polite from "./Polite.js";
12
12
  import { Fragment, computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, shallowRef, watch } from "vue";
13
13
  import { clsx } from "@v-c/util";
@@ -1,7 +1,7 @@
1
1
  import useBaseProps from "./hooks/useBaseProps.js";
2
2
  import TransBtn from "./TransBtn.js";
3
- import { useSelectContext } from "./SelectContext.js";
4
3
  import { isValidCount } from "./utils/valueUtil.js";
4
+ import { useSelectContext } from "./SelectContext.js";
5
5
  import { isPlatformMac } from "./utils/platformUtil.js";
6
6
  import { Fragment, computed, createVNode, defineComponent, mergeProps, shallowRef, watch } from "vue";
7
7
  import { clsx } from "@v-c/util";
package/dist/Select.js CHANGED
@@ -4,8 +4,8 @@ import useFilterOptions from "./hooks/useFilterOptions.js";
4
4
  import useOptions from "./hooks/useOptions.js";
5
5
  import useRefFunc from "./hooks/useRefFunc.js";
6
6
  import useSearchConfig from "./hooks/useSearchConfig.js";
7
- import { useSelectProvider } from "./SelectContext.js";
8
7
  import { fillFieldNames, flattenOptions, injectPropsWithOption } from "./utils/valueUtil.js";
8
+ import { useSelectProvider } from "./SelectContext.js";
9
9
  import { BaseSelect, isMultiple } from "./BaseSelect/index.js";
10
10
  import OptionList from "./OptionList.js";
11
11
  import { convertChildrenToData } from "./utils/legacyUtil.js";
@@ -2,6 +2,7 @@ import useBaseProps from "../../hooks/useBaseProps.js";
2
2
  import { getTitle } from "../../utils/commonUtil.js";
3
3
  import { useSelectInputContext } from "../context.js";
4
4
  import TransBtn from "../../TransBtn.js";
5
+ import { isValidCount } from "../../utils/valueUtil.js";
5
6
  import Input from "../Input.js";
6
7
  import Placeholder from "./Placeholder.js";
7
8
  import { computed, createTextVNode, createVNode, defineComponent, mergeProps, shallowRef } from "vue";
@@ -34,6 +35,7 @@ var MultipleContent = /* @__PURE__ */ defineComponent((props, { expose }) => {
34
35
  const maxTagPlaceholderFromContext = computed(() => baseProps.value?.maxTagPlaceholder);
35
36
  const maxTagTextLength = computed(() => baseProps.value?.maxTagTextLength);
36
37
  const maxTagCount = computed(() => baseProps.value?.maxTagCount);
38
+ const maxCount = computed(() => baseProps.value?.maxCount);
37
39
  const classNamesConfig = computed(() => baseProps.value?.classNames);
38
40
  const stylesConfig = computed(() => baseProps.value?.styles);
39
41
  const selectionItemPrefixCls = computed(() => `${prefixCls.value}-selection-item`);
@@ -41,8 +43,9 @@ var MultipleContent = /* @__PURE__ */ defineComponent((props, { expose }) => {
41
43
  if (!triggerOpen.value && mode.value === "multiple" && autoClearSearchValue.value !== false) return "";
42
44
  return searchValue.value;
43
45
  });
46
+ const reachedMaxCount = computed(() => mode.value !== "combobox" && isValidCount(maxCount.value) && displayValues.value.length >= maxCount.value);
44
47
  const inputValue = computed(() => showSearch.value ? computedSearchValue.value || "" : "");
45
- const inputEditable = computed(() => showSearch.value && !disabled.value);
48
+ const inputEditable = computed(() => showSearch.value && !disabled.value && !reachedMaxCount.value);
46
49
  const removeIcon = computed(() => removeIconFromContext.value ?? "×");
47
50
  const maxTagPlaceholder = computed(() => maxTagPlaceholderFromContext.value ?? ((omittedValues) => `+ ${omittedValues.length} ...`));
48
51
  const tagRender = computed(() => tagRenderFromContext.value);
@@ -61,7 +61,7 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
61
61
  }
62
62
  }, { immediate: true });
63
63
  return () => {
64
- const { style, autoComplete, className, value } = props;
64
+ const { style, autoComplete, className, value, readOnly } = props;
65
65
  const { prefixCls, mode, autoFocus, placeholder } = selectInputContext.value ?? {};
66
66
  const { input: InputComponent = "input" } = selectInputContext.value?.components ?? {};
67
67
  const { styles, id, classNames, open, activeDescendantId, role, disabled } = baseProps.value ?? {};
@@ -69,6 +69,7 @@ var Input = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
69
69
  const sharedInputProps = {
70
70
  id,
71
71
  "type": mode === "combobox" ? "text" : "search",
72
+ readOnly,
72
73
  ...attrs,
73
74
  "ref": inputRef,
74
75
  "style": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/select",
3
3
  "type": "module",
4
- "version": "1.0.21",
4
+ "version": "1.0.23",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "MIT",
@@ -30,9 +30,9 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@v-c/overflow": "^1.0.5",
33
- "@v-c/util": "^1.0.19",
33
+ "@v-c/virtual-list": "^1.0.7",
34
34
  "@v-c/trigger": "^1.0.14",
35
- "@v-c/virtual-list": "^1.0.7"
35
+ "@v-c/util": "^1.0.19"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "vite build",