@v-c/select 0.0.1
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 -0
- package/dist/BaseSelect/Polite.cjs +37 -0
- package/dist/BaseSelect/Polite.d.ts +7 -0
- package/dist/BaseSelect/Polite.js +34 -0
- package/dist/BaseSelect/index.cjs +763 -0
- package/dist/BaseSelect/index.d.ts +133 -0
- package/dist/BaseSelect/index.js +759 -0
- package/dist/OptGroup.cjs +5 -0
- package/dist/OptGroup.d.ts +6 -0
- package/dist/OptGroup.js +4 -0
- package/dist/Option.cjs +5 -0
- package/dist/Option.d.ts +8 -0
- package/dist/Option.js +4 -0
- package/dist/OptionList.cjs +255 -0
- package/dist/OptionList.d.ts +17 -0
- package/dist/OptionList.js +249 -0
- package/dist/Select.cjs +833 -0
- package/dist/Select.d.ts +96 -0
- package/dist/Select.js +828 -0
- package/dist/SelectContext.cjs +11 -0
- package/dist/SelectContext.d.ts +32 -0
- package/dist/SelectContext.js +9 -0
- package/dist/SelectInput/Affix.cjs +16 -0
- package/dist/SelectInput/Affix.d.ts +2 -0
- package/dist/SelectInput/Affix.js +13 -0
- package/dist/SelectInput/Content/MultipleContent.cjs +142 -0
- package/dist/SelectInput/Content/MultipleContent.d.ts +3 -0
- package/dist/SelectInput/Content/MultipleContent.js +138 -0
- package/dist/SelectInput/Content/Placeholder.cjs +33 -0
- package/dist/SelectInput/Content/Placeholder.d.ts +5 -0
- package/dist/SelectInput/Content/Placeholder.js +30 -0
- package/dist/SelectInput/Content/SingleContent.cjs +80 -0
- package/dist/SelectInput/Content/SingleContent.d.ts +3 -0
- package/dist/SelectInput/Content/SingleContent.js +77 -0
- package/dist/SelectInput/Content/index.cjs +40 -0
- package/dist/SelectInput/Content/index.d.ts +6 -0
- package/dist/SelectInput/Content/index.js +36 -0
- package/dist/SelectInput/Input.cjs +176 -0
- package/dist/SelectInput/Input.d.ts +22 -0
- package/dist/SelectInput/Input.js +173 -0
- package/dist/SelectInput/context.cjs +11 -0
- package/dist/SelectInput/context.d.ts +5 -0
- package/dist/SelectInput/context.js +9 -0
- package/dist/SelectInput/index.cjs +330 -0
- package/dist/SelectInput/index.d.ts +44 -0
- package/dist/SelectInput/index.js +325 -0
- package/dist/SelectTrigger.cjs +189 -0
- package/dist/SelectTrigger.d.ts +26 -0
- package/dist/SelectTrigger.js +185 -0
- package/dist/TransBtn.cjs +69 -0
- package/dist/TransBtn.d.ts +22 -0
- package/dist/TransBtn.js +66 -0
- package/dist/_virtual/rolldown_runtime.cjs +21 -0
- package/dist/hooks/index.cjs +23 -0
- package/dist/hooks/index.d.ts +17 -0
- package/dist/hooks/index.js +12 -0
- package/dist/hooks/useAllowClear.cjs +17 -0
- package/dist/hooks/useAllowClear.d.ts +9 -0
- package/dist/hooks/useAllowClear.js +16 -0
- package/dist/hooks/useBaseProps.cjs +12 -0
- package/dist/hooks/useBaseProps.d.ts +10 -0
- package/dist/hooks/useBaseProps.js +9 -0
- package/dist/hooks/useCache.cjs +36 -0
- package/dist/hooks/useCache.d.ts +7 -0
- package/dist/hooks/useCache.js +34 -0
- package/dist/hooks/useComponents.cjs +15 -0
- package/dist/hooks/useComponents.d.ts +8 -0
- package/dist/hooks/useComponents.js +13 -0
- package/dist/hooks/useFilterOptions.cjs +39 -0
- package/dist/hooks/useFilterOptions.d.ts +3 -0
- package/dist/hooks/useFilterOptions.js +37 -0
- package/dist/hooks/useLock.cjs +26 -0
- package/dist/hooks/useLock.d.ts +1 -0
- package/dist/hooks/useLock.js +24 -0
- package/dist/hooks/useOpen.cjs +58 -0
- package/dist/hooks/useOpen.d.ts +19 -0
- package/dist/hooks/useOpen.js +56 -0
- package/dist/hooks/useOptions.cjs +38 -0
- package/dist/hooks/useOptions.d.ts +13 -0
- package/dist/hooks/useOptions.js +36 -0
- package/dist/hooks/useRefFunc.cjs +12 -0
- package/dist/hooks/useRefFunc.d.ts +6 -0
- package/dist/hooks/useRefFunc.js +10 -0
- package/dist/hooks/useSearchConfig.cjs +21 -0
- package/dist/hooks/useSearchConfig.d.ts +11 -0
- package/dist/hooks/useSearchConfig.js +19 -0
- package/dist/hooks/useSelectTriggerControl.cjs +18 -0
- package/dist/hooks/useSelectTriggerControl.d.ts +2 -0
- package/dist/hooks/useSelectTriggerControl.js +16 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +8 -0
- package/dist/interface.cjs +0 -0
- package/dist/interface.d.ts +23 -0
- package/dist/interface.js +0 -0
- package/dist/utils/commonUtil.cjs +37 -0
- package/dist/utils/commonUtil.d.ts +12 -0
- package/dist/utils/commonUtil.js +30 -0
- package/dist/utils/keyUtil.cjs +36 -0
- package/dist/utils/keyUtil.d.ts +2 -0
- package/dist/utils/keyUtil.js +34 -0
- package/dist/utils/legacyUtil.cjs +32 -0
- package/dist/utils/legacyUtil.d.ts +3 -0
- package/dist/utils/legacyUtil.js +31 -0
- package/dist/utils/platformUtil.cjs +5 -0
- package/dist/utils/platformUtil.d.ts +1 -0
- package/dist/utils/platformUtil.js +5 -0
- package/dist/utils/valueUtil.cjs +79 -0
- package/dist/utils/valueUtil.d.ts +18 -0
- package/dist/utils/valueUtil.js +75 -0
- package/package.json +43 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import useBaseProps from "../../hooks/useBaseProps.js";
|
|
2
|
+
import { useSelectInputContext } from "../context.js";
|
|
3
|
+
import MultipleContent_default from "./MultipleContent.js";
|
|
4
|
+
import SingleContent_default from "./SingleContent.js";
|
|
5
|
+
import { computed, createVNode, defineComponent, shallowRef } from "vue";
|
|
6
|
+
import pickAttrs from "@v-c/util/dist/pickAttrs";
|
|
7
|
+
var Content_default = /* @__PURE__ */ defineComponent((_, { expose }) => {
|
|
8
|
+
const selectInputContext = useSelectInputContext();
|
|
9
|
+
const baseProps = useBaseProps();
|
|
10
|
+
const inputRef = shallowRef();
|
|
11
|
+
expose({ input: computed(() => inputRef.value?.input) });
|
|
12
|
+
const multiple = computed(() => selectInputContext.value?.multiple);
|
|
13
|
+
const onInputKeyDown = computed(() => selectInputContext.value?.onInputKeyDown);
|
|
14
|
+
const showSearch = computed(() => baseProps.value?.showSearch);
|
|
15
|
+
const ariaProps = computed(() => pickAttrs(baseProps.value ?? {}, { aria: true }));
|
|
16
|
+
const sharedInputProps = computed(() => ({
|
|
17
|
+
...ariaProps.value,
|
|
18
|
+
onKeyDown: onInputKeyDown.value,
|
|
19
|
+
readonly: !showSearch.value,
|
|
20
|
+
tabindex: baseProps.value?.tabIndex
|
|
21
|
+
}));
|
|
22
|
+
return () => {
|
|
23
|
+
if (multiple.value) return createVNode(MultipleContent_default, {
|
|
24
|
+
"ref": inputRef,
|
|
25
|
+
"inputProps": sharedInputProps.value
|
|
26
|
+
}, null);
|
|
27
|
+
return createVNode(SingleContent_default, {
|
|
28
|
+
"ref": inputRef,
|
|
29
|
+
"inputProps": sharedInputProps.value
|
|
30
|
+
}, null);
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
33
|
+
name: "SelectContent",
|
|
34
|
+
inheritAttrs: false
|
|
35
|
+
});
|
|
36
|
+
export { Content_default as default };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
3
|
+
const require_useBaseProps = require("../hooks/useBaseProps.cjs");
|
|
4
|
+
const require_context = require("./context.cjs");
|
|
5
|
+
let vue = require("vue");
|
|
6
|
+
let __v_c_util = require("@v-c/util");
|
|
7
|
+
let __v_c_util_dist_KeyCode = require("@v-c/util/dist/KeyCode");
|
|
8
|
+
var Input = /* @__PURE__ */ (0, vue.defineComponent)((props, { expose, attrs }) => {
|
|
9
|
+
const selectInputContext = require_context.useSelectInputContext();
|
|
10
|
+
const baseProps = require_useBaseProps.default();
|
|
11
|
+
const compositionStatusRef = (0, vue.shallowRef)(false);
|
|
12
|
+
const pastedTextRef = (0, vue.shallowRef)(null);
|
|
13
|
+
const inputRef = (0, vue.shallowRef)();
|
|
14
|
+
expose({ input: inputRef });
|
|
15
|
+
const handleChange = (event) => {
|
|
16
|
+
const { tokenWithEnter, onSearch } = selectInputContext.value ?? {};
|
|
17
|
+
let { value: nextVal } = event.target;
|
|
18
|
+
if (tokenWithEnter && pastedTextRef.value && /[\r\n]/.test(pastedTextRef.value)) {
|
|
19
|
+
const replacedText = pastedTextRef.value.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
|
|
20
|
+
nextVal = nextVal.replace(replacedText, pastedTextRef.value);
|
|
21
|
+
}
|
|
22
|
+
pastedTextRef.value = null;
|
|
23
|
+
if (onSearch) onSearch(nextVal, true, compositionStatusRef.value);
|
|
24
|
+
props?.onChange?.(event);
|
|
25
|
+
};
|
|
26
|
+
const handleKeyDown = (event) => {
|
|
27
|
+
const { mode, onSearchSubmit } = selectInputContext.value ?? {};
|
|
28
|
+
const { key } = event;
|
|
29
|
+
const { value: nextVal } = event.currentTarget;
|
|
30
|
+
if (key === __v_c_util_dist_KeyCode.KeyCodeStr.Enter && mode === "tags" && !compositionStatusRef.value && onSearchSubmit) onSearchSubmit(nextVal);
|
|
31
|
+
props?.onKeyDown?.(event);
|
|
32
|
+
};
|
|
33
|
+
const handleBlur = (event) => {
|
|
34
|
+
const { onInputBlur } = selectInputContext.value ?? {};
|
|
35
|
+
onInputBlur?.();
|
|
36
|
+
props?.onBlur?.(event);
|
|
37
|
+
};
|
|
38
|
+
const handleCompositionStart = () => {
|
|
39
|
+
compositionStatusRef.value = true;
|
|
40
|
+
};
|
|
41
|
+
const handleCompositionEnd = (event) => {
|
|
42
|
+
const { mode, onSearch } = selectInputContext.value ?? {};
|
|
43
|
+
compositionStatusRef.value = false;
|
|
44
|
+
if (mode !== "combobox") {
|
|
45
|
+
const { value: nextVal } = event.currentTarget;
|
|
46
|
+
onSearch?.(nextVal, true, false);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const handlePaste = (event) => {
|
|
50
|
+
const { clipboardData } = event;
|
|
51
|
+
pastedTextRef.value = clipboardData?.getData?.("text") || "";
|
|
52
|
+
};
|
|
53
|
+
const widthCssVar = (0, vue.shallowRef)();
|
|
54
|
+
(0, vue.watch)([() => props.syncWidth, () => props.value], async () => {
|
|
55
|
+
await (0, vue.nextTick)();
|
|
56
|
+
const input = inputRef.value;
|
|
57
|
+
if (props.syncWidth && input) {
|
|
58
|
+
input.style.width = "0px";
|
|
59
|
+
widthCssVar.value = input.scrollWidth;
|
|
60
|
+
input.style.width = "";
|
|
61
|
+
}
|
|
62
|
+
}, { immediate: true });
|
|
63
|
+
return () => {
|
|
64
|
+
const { style, autoComplete, className, value } = props;
|
|
65
|
+
const { prefixCls, mode, autoFocus, placeholder } = selectInputContext.value ?? {};
|
|
66
|
+
const { input: InputComponent = "input" } = selectInputContext.value?.components ?? {};
|
|
67
|
+
const { styles, id, classNames, open, activeDescendantId, role, disabled } = baseProps.value ?? {};
|
|
68
|
+
const inputCls = (0, __v_c_util.clsx)(`${prefixCls}-input`, classNames?.input, className);
|
|
69
|
+
const sharedInputProps = {
|
|
70
|
+
id,
|
|
71
|
+
"type": mode === "combobox" ? "text" : "search",
|
|
72
|
+
...attrs,
|
|
73
|
+
"ref": inputRef,
|
|
74
|
+
"style": {
|
|
75
|
+
...styles?.input,
|
|
76
|
+
...style,
|
|
77
|
+
"--select-input-width": widthCssVar.value
|
|
78
|
+
},
|
|
79
|
+
autoFocus,
|
|
80
|
+
"autocomplete": autoComplete || "off",
|
|
81
|
+
"class": inputCls,
|
|
82
|
+
disabled,
|
|
83
|
+
"value": value || "",
|
|
84
|
+
"onInput": handleChange,
|
|
85
|
+
"onKeydown": handleKeyDown,
|
|
86
|
+
"onBlur": handleBlur,
|
|
87
|
+
"onPaste": handlePaste,
|
|
88
|
+
"onCompositionstart": handleCompositionStart,
|
|
89
|
+
"onCompositionend": handleCompositionEnd,
|
|
90
|
+
"role": role || "combobox",
|
|
91
|
+
"aria-expanded": open || false,
|
|
92
|
+
"aria-haspopup": "listbox",
|
|
93
|
+
"aria-owns": `${id}_list`,
|
|
94
|
+
"aria-autocomplete": "list",
|
|
95
|
+
"aria-controls": `${id}_list`,
|
|
96
|
+
"aria-activedescendant": open ? activeDescendantId : void 0
|
|
97
|
+
};
|
|
98
|
+
if ((0, vue.isVNode)(InputComponent)) return (0, vue.createVNode)(InputComponent, {
|
|
99
|
+
placeholder: props.placeholder || placeholder,
|
|
100
|
+
...sharedInputProps
|
|
101
|
+
});
|
|
102
|
+
return (0, vue.createVNode)(InputComponent, sharedInputProps, null);
|
|
103
|
+
};
|
|
104
|
+
}, {
|
|
105
|
+
props: {
|
|
106
|
+
id: {
|
|
107
|
+
type: String,
|
|
108
|
+
required: false,
|
|
109
|
+
default: void 0
|
|
110
|
+
},
|
|
111
|
+
readOnly: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
value: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: false,
|
|
119
|
+
default: void 0
|
|
120
|
+
},
|
|
121
|
+
onChange: {
|
|
122
|
+
type: Function,
|
|
123
|
+
required: false,
|
|
124
|
+
default: void 0
|
|
125
|
+
},
|
|
126
|
+
onKeyDown: {
|
|
127
|
+
type: Function,
|
|
128
|
+
required: false,
|
|
129
|
+
default: void 0
|
|
130
|
+
},
|
|
131
|
+
onFocus: {
|
|
132
|
+
type: Function,
|
|
133
|
+
required: false,
|
|
134
|
+
default: void 0
|
|
135
|
+
},
|
|
136
|
+
onBlur: {
|
|
137
|
+
type: Function,
|
|
138
|
+
required: false,
|
|
139
|
+
default: void 0
|
|
140
|
+
},
|
|
141
|
+
placeholder: {
|
|
142
|
+
type: String,
|
|
143
|
+
required: false,
|
|
144
|
+
default: void 0
|
|
145
|
+
},
|
|
146
|
+
className: {
|
|
147
|
+
type: String,
|
|
148
|
+
required: false,
|
|
149
|
+
default: void 0
|
|
150
|
+
},
|
|
151
|
+
style: {
|
|
152
|
+
type: Object,
|
|
153
|
+
required: false,
|
|
154
|
+
default: void 0
|
|
155
|
+
},
|
|
156
|
+
maxLength: {
|
|
157
|
+
type: Number,
|
|
158
|
+
required: false,
|
|
159
|
+
default: void 0
|
|
160
|
+
},
|
|
161
|
+
syncWidth: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
required: false,
|
|
164
|
+
default: void 0
|
|
165
|
+
},
|
|
166
|
+
autoComplete: {
|
|
167
|
+
type: String,
|
|
168
|
+
required: false,
|
|
169
|
+
default: void 0
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
name: "Input",
|
|
173
|
+
inheritAttrs: false
|
|
174
|
+
});
|
|
175
|
+
var Input_default = Input;
|
|
176
|
+
exports.default = Input_default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface InputProps {
|
|
2
|
+
id?: string;
|
|
3
|
+
readOnly?: boolean;
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (event: Event) => void;
|
|
6
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
7
|
+
onFocus?: (event: FocusEvent) => void;
|
|
8
|
+
onBlur?: (event: FocusEvent) => void;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: Record<string, any>;
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
/** width always match content width */
|
|
14
|
+
syncWidth?: boolean;
|
|
15
|
+
/** autoComplete for input */
|
|
16
|
+
autoComplete?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface InputRef {
|
|
19
|
+
input: HTMLInputElement;
|
|
20
|
+
}
|
|
21
|
+
declare const Input: import('vue').DefineSetupFnComponent<InputProps, {}, {}, InputProps & {}, import('vue').PublicProps>;
|
|
22
|
+
export default Input;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import useBaseProps from "../hooks/useBaseProps.js";
|
|
2
|
+
import { useSelectInputContext } from "./context.js";
|
|
3
|
+
import { createVNode, defineComponent, isVNode, nextTick, shallowRef, watch } from "vue";
|
|
4
|
+
import { clsx } from "@v-c/util";
|
|
5
|
+
import { KeyCodeStr } from "@v-c/util/dist/KeyCode";
|
|
6
|
+
var Input_default = /* @__PURE__ */ defineComponent((props, { expose, attrs }) => {
|
|
7
|
+
const selectInputContext = useSelectInputContext();
|
|
8
|
+
const baseProps = useBaseProps();
|
|
9
|
+
const compositionStatusRef = shallowRef(false);
|
|
10
|
+
const pastedTextRef = shallowRef(null);
|
|
11
|
+
const inputRef = shallowRef();
|
|
12
|
+
expose({ input: inputRef });
|
|
13
|
+
const handleChange = (event) => {
|
|
14
|
+
const { tokenWithEnter, onSearch } = selectInputContext.value ?? {};
|
|
15
|
+
let { value: nextVal } = event.target;
|
|
16
|
+
if (tokenWithEnter && pastedTextRef.value && /[\r\n]/.test(pastedTextRef.value)) {
|
|
17
|
+
const replacedText = pastedTextRef.value.replace(/[\r\n]+$/, "").replace(/\r\n/g, " ").replace(/[\r\n]/g, " ");
|
|
18
|
+
nextVal = nextVal.replace(replacedText, pastedTextRef.value);
|
|
19
|
+
}
|
|
20
|
+
pastedTextRef.value = null;
|
|
21
|
+
if (onSearch) onSearch(nextVal, true, compositionStatusRef.value);
|
|
22
|
+
props?.onChange?.(event);
|
|
23
|
+
};
|
|
24
|
+
const handleKeyDown = (event) => {
|
|
25
|
+
const { mode, onSearchSubmit } = selectInputContext.value ?? {};
|
|
26
|
+
const { key } = event;
|
|
27
|
+
const { value: nextVal } = event.currentTarget;
|
|
28
|
+
if (key === KeyCodeStr.Enter && mode === "tags" && !compositionStatusRef.value && onSearchSubmit) onSearchSubmit(nextVal);
|
|
29
|
+
props?.onKeyDown?.(event);
|
|
30
|
+
};
|
|
31
|
+
const handleBlur = (event) => {
|
|
32
|
+
const { onInputBlur } = selectInputContext.value ?? {};
|
|
33
|
+
onInputBlur?.();
|
|
34
|
+
props?.onBlur?.(event);
|
|
35
|
+
};
|
|
36
|
+
const handleCompositionStart = () => {
|
|
37
|
+
compositionStatusRef.value = true;
|
|
38
|
+
};
|
|
39
|
+
const handleCompositionEnd = (event) => {
|
|
40
|
+
const { mode, onSearch } = selectInputContext.value ?? {};
|
|
41
|
+
compositionStatusRef.value = false;
|
|
42
|
+
if (mode !== "combobox") {
|
|
43
|
+
const { value: nextVal } = event.currentTarget;
|
|
44
|
+
onSearch?.(nextVal, true, false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const handlePaste = (event) => {
|
|
48
|
+
const { clipboardData } = event;
|
|
49
|
+
pastedTextRef.value = clipboardData?.getData?.("text") || "";
|
|
50
|
+
};
|
|
51
|
+
const widthCssVar = shallowRef();
|
|
52
|
+
watch([() => props.syncWidth, () => props.value], async () => {
|
|
53
|
+
await nextTick();
|
|
54
|
+
const input = inputRef.value;
|
|
55
|
+
if (props.syncWidth && input) {
|
|
56
|
+
input.style.width = "0px";
|
|
57
|
+
widthCssVar.value = input.scrollWidth;
|
|
58
|
+
input.style.width = "";
|
|
59
|
+
}
|
|
60
|
+
}, { immediate: true });
|
|
61
|
+
return () => {
|
|
62
|
+
const { style, autoComplete, className, value } = props;
|
|
63
|
+
const { prefixCls, mode, autoFocus, placeholder } = selectInputContext.value ?? {};
|
|
64
|
+
const { input: InputComponent = "input" } = selectInputContext.value?.components ?? {};
|
|
65
|
+
const { styles, id, classNames, open, activeDescendantId, role, disabled } = baseProps.value ?? {};
|
|
66
|
+
const inputCls = clsx(`${prefixCls}-input`, classNames?.input, className);
|
|
67
|
+
const sharedInputProps = {
|
|
68
|
+
id,
|
|
69
|
+
"type": mode === "combobox" ? "text" : "search",
|
|
70
|
+
...attrs,
|
|
71
|
+
"ref": inputRef,
|
|
72
|
+
"style": {
|
|
73
|
+
...styles?.input,
|
|
74
|
+
...style,
|
|
75
|
+
"--select-input-width": widthCssVar.value
|
|
76
|
+
},
|
|
77
|
+
autoFocus,
|
|
78
|
+
"autocomplete": autoComplete || "off",
|
|
79
|
+
"class": inputCls,
|
|
80
|
+
disabled,
|
|
81
|
+
"value": value || "",
|
|
82
|
+
"onInput": handleChange,
|
|
83
|
+
"onKeydown": handleKeyDown,
|
|
84
|
+
"onBlur": handleBlur,
|
|
85
|
+
"onPaste": handlePaste,
|
|
86
|
+
"onCompositionstart": handleCompositionStart,
|
|
87
|
+
"onCompositionend": handleCompositionEnd,
|
|
88
|
+
"role": role || "combobox",
|
|
89
|
+
"aria-expanded": open || false,
|
|
90
|
+
"aria-haspopup": "listbox",
|
|
91
|
+
"aria-owns": `${id}_list`,
|
|
92
|
+
"aria-autocomplete": "list",
|
|
93
|
+
"aria-controls": `${id}_list`,
|
|
94
|
+
"aria-activedescendant": open ? activeDescendantId : void 0
|
|
95
|
+
};
|
|
96
|
+
if (isVNode(InputComponent)) return createVNode(InputComponent, {
|
|
97
|
+
placeholder: props.placeholder || placeholder,
|
|
98
|
+
...sharedInputProps
|
|
99
|
+
});
|
|
100
|
+
return createVNode(InputComponent, sharedInputProps, null);
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
props: {
|
|
104
|
+
id: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: false,
|
|
107
|
+
default: void 0
|
|
108
|
+
},
|
|
109
|
+
readOnly: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
required: false,
|
|
112
|
+
default: void 0
|
|
113
|
+
},
|
|
114
|
+
value: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: void 0
|
|
118
|
+
},
|
|
119
|
+
onChange: {
|
|
120
|
+
type: Function,
|
|
121
|
+
required: false,
|
|
122
|
+
default: void 0
|
|
123
|
+
},
|
|
124
|
+
onKeyDown: {
|
|
125
|
+
type: Function,
|
|
126
|
+
required: false,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
onFocus: {
|
|
130
|
+
type: Function,
|
|
131
|
+
required: false,
|
|
132
|
+
default: void 0
|
|
133
|
+
},
|
|
134
|
+
onBlur: {
|
|
135
|
+
type: Function,
|
|
136
|
+
required: false,
|
|
137
|
+
default: void 0
|
|
138
|
+
},
|
|
139
|
+
placeholder: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: false,
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
144
|
+
className: {
|
|
145
|
+
type: String,
|
|
146
|
+
required: false,
|
|
147
|
+
default: void 0
|
|
148
|
+
},
|
|
149
|
+
style: {
|
|
150
|
+
type: Object,
|
|
151
|
+
required: false,
|
|
152
|
+
default: void 0
|
|
153
|
+
},
|
|
154
|
+
maxLength: {
|
|
155
|
+
type: Number,
|
|
156
|
+
required: false,
|
|
157
|
+
default: void 0
|
|
158
|
+
},
|
|
159
|
+
syncWidth: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
required: false,
|
|
162
|
+
default: void 0
|
|
163
|
+
},
|
|
164
|
+
autoComplete: {
|
|
165
|
+
type: String,
|
|
166
|
+
required: false,
|
|
167
|
+
default: void 0
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
name: "Input",
|
|
171
|
+
inheritAttrs: false
|
|
172
|
+
});
|
|
173
|
+
export { Input_default as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
var SelectInputKey = Symbol("SelectInputContext");
|
|
4
|
+
function useSelectInputContext() {
|
|
5
|
+
return (0, vue.inject)(SelectInputKey, (0, vue.ref)(null));
|
|
6
|
+
}
|
|
7
|
+
function useSelectInputProvider(context) {
|
|
8
|
+
(0, vue.provide)(SelectInputKey, context);
|
|
9
|
+
}
|
|
10
|
+
exports.useSelectInputContext = useSelectInputContext;
|
|
11
|
+
exports.useSelectInputProvider = useSelectInputProvider;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { SelectInputProps } from '.';
|
|
3
|
+
export type ContentContextProps = SelectInputProps;
|
|
4
|
+
export declare function useSelectInputContext(): Ref<ContentContextProps | null>;
|
|
5
|
+
export declare function useSelectInputProvider(context: Ref<ContentContextProps>): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { inject, provide, ref } from "vue";
|
|
2
|
+
var SelectInputKey = Symbol("SelectInputContext");
|
|
3
|
+
function useSelectInputContext() {
|
|
4
|
+
return inject(SelectInputKey, ref(null));
|
|
5
|
+
}
|
|
6
|
+
function useSelectInputProvider(context) {
|
|
7
|
+
provide(SelectInputKey, context);
|
|
8
|
+
}
|
|
9
|
+
export { useSelectInputContext, useSelectInputProvider };
|