@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,189 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let __v_c_util = require("@v-c/util");
|
|
5
|
+
let __v_c_trigger = require("@v-c/trigger");
|
|
6
|
+
__v_c_trigger = require_rolldown_runtime.__toESM(__v_c_trigger);
|
|
7
|
+
function getBuiltInPlacements(popupMatchSelectWidth) {
|
|
8
|
+
const adjustX = popupMatchSelectWidth === true ? 0 : 1;
|
|
9
|
+
return {
|
|
10
|
+
bottomLeft: {
|
|
11
|
+
points: ["tl", "bl"],
|
|
12
|
+
offset: [0, 4],
|
|
13
|
+
overflow: {
|
|
14
|
+
adjustX,
|
|
15
|
+
adjustY: 1
|
|
16
|
+
},
|
|
17
|
+
htmlRegion: "scroll"
|
|
18
|
+
},
|
|
19
|
+
bottomRight: {
|
|
20
|
+
points: ["tr", "br"],
|
|
21
|
+
offset: [0, 4],
|
|
22
|
+
overflow: {
|
|
23
|
+
adjustX,
|
|
24
|
+
adjustY: 1
|
|
25
|
+
},
|
|
26
|
+
htmlRegion: "scroll"
|
|
27
|
+
},
|
|
28
|
+
topLeft: {
|
|
29
|
+
points: ["bl", "tl"],
|
|
30
|
+
offset: [0, -4],
|
|
31
|
+
overflow: {
|
|
32
|
+
adjustX,
|
|
33
|
+
adjustY: 1
|
|
34
|
+
},
|
|
35
|
+
htmlRegion: "scroll"
|
|
36
|
+
},
|
|
37
|
+
topRight: {
|
|
38
|
+
points: ["br", "tr"],
|
|
39
|
+
offset: [0, -4],
|
|
40
|
+
overflow: {
|
|
41
|
+
adjustX,
|
|
42
|
+
adjustY: 1
|
|
43
|
+
},
|
|
44
|
+
htmlRegion: "scroll"
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var SelectTrigger = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots, attrs, expose }) => {
|
|
49
|
+
const mergedBuiltinPlacements = (0, vue.computed)(() => {
|
|
50
|
+
return props?.builtinPlacements || getBuiltInPlacements(props.popupMatchSelectWidth);
|
|
51
|
+
});
|
|
52
|
+
const isNumberPopupWidth = (0, vue.computed)(() => typeof props.popupMatchSelectWidth === "number");
|
|
53
|
+
const stretch = (0, vue.computed)(() => {
|
|
54
|
+
if (isNumberPopupWidth.value) return null;
|
|
55
|
+
return props.popupMatchSelectWidth === false ? "minWidth" : "width";
|
|
56
|
+
});
|
|
57
|
+
const triggerPopupRef = (0, vue.shallowRef)();
|
|
58
|
+
expose({ getPopupElement: () => triggerPopupRef.value?.popupElement });
|
|
59
|
+
return () => {
|
|
60
|
+
const { prefixCls, popupElement, popupRender, animation, transitionName, popupStyle, popupMatchSelectWidth, onPopupVisibleChange, placement, direction = "ltr", builtinPlacements, onPopupMouseEnter, onPopupMouseDown, popupAlign, visible, getPopupContainer, popupClassName, empty,...restProps } = props;
|
|
61
|
+
let popupNode = popupElement;
|
|
62
|
+
if (popupRender) popupNode = popupRender(popupElement);
|
|
63
|
+
const popupPrefixCls = `${prefixCls}-dropdown`;
|
|
64
|
+
const mergedTransitionName = animation ? `${popupPrefixCls}-${animation}` : transitionName;
|
|
65
|
+
const mergedPopupStyle = popupStyle ?? {};
|
|
66
|
+
if (isNumberPopupWidth.value) mergedPopupStyle.width = `${popupMatchSelectWidth}px`;
|
|
67
|
+
return (0, vue.createVNode)(__v_c_trigger.default, (0, vue.mergeProps)(attrs, restProps, {
|
|
68
|
+
"showAction": onPopupVisibleChange ? ["click"] : [],
|
|
69
|
+
"hideAction": onPopupVisibleChange ? ["click"] : [],
|
|
70
|
+
"popupPlacement": placement || (direction === "rtl" ? "bottomRight" : "bottomLeft"),
|
|
71
|
+
"builtinPlacements": mergedBuiltinPlacements.value,
|
|
72
|
+
"prefixCls": popupPrefixCls,
|
|
73
|
+
"popup": (0, vue.createVNode)("div", {
|
|
74
|
+
"onMousedown": onPopupMouseDown,
|
|
75
|
+
"onMouseenter": onPopupMouseEnter
|
|
76
|
+
}, [popupNode]),
|
|
77
|
+
"ref": triggerPopupRef,
|
|
78
|
+
"stretch": stretch.value,
|
|
79
|
+
"popupMotion": { name: mergedTransitionName },
|
|
80
|
+
"popupAlign": popupAlign,
|
|
81
|
+
"popupVisible": visible,
|
|
82
|
+
"getPopupContainer": getPopupContainer,
|
|
83
|
+
"popupClassName": (0, __v_c_util.clsx)(popupClassName, { [`${popupPrefixCls}-empty`]: empty }),
|
|
84
|
+
"popupStyle": mergedPopupStyle,
|
|
85
|
+
"onPopupVisibleChange": onPopupVisibleChange ?? void 0
|
|
86
|
+
}), { default: () => [slots?.default?.()] });
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
props: /* @__PURE__ */ (0, vue.mergeDefaults)({
|
|
90
|
+
prefixCls: {
|
|
91
|
+
type: String,
|
|
92
|
+
required: true,
|
|
93
|
+
default: void 0
|
|
94
|
+
},
|
|
95
|
+
disabled: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
required: true,
|
|
98
|
+
default: void 0
|
|
99
|
+
},
|
|
100
|
+
visible: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: true,
|
|
103
|
+
default: void 0
|
|
104
|
+
},
|
|
105
|
+
popupElement: {
|
|
106
|
+
required: true,
|
|
107
|
+
default: void 0
|
|
108
|
+
},
|
|
109
|
+
animation: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false,
|
|
112
|
+
default: void 0
|
|
113
|
+
},
|
|
114
|
+
transitionName: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: void 0
|
|
118
|
+
},
|
|
119
|
+
placement: {
|
|
120
|
+
type: String,
|
|
121
|
+
required: false,
|
|
122
|
+
default: void 0
|
|
123
|
+
},
|
|
124
|
+
builtinPlacements: {
|
|
125
|
+
type: Object,
|
|
126
|
+
required: false,
|
|
127
|
+
default: void 0
|
|
128
|
+
},
|
|
129
|
+
popupStyle: {
|
|
130
|
+
type: Object,
|
|
131
|
+
required: false,
|
|
132
|
+
default: void 0
|
|
133
|
+
},
|
|
134
|
+
popupClassName: {
|
|
135
|
+
type: String,
|
|
136
|
+
required: false,
|
|
137
|
+
default: void 0
|
|
138
|
+
},
|
|
139
|
+
direction: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: false,
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
144
|
+
popupMatchSelectWidth: {
|
|
145
|
+
type: [Boolean, Number],
|
|
146
|
+
required: false,
|
|
147
|
+
default: void 0
|
|
148
|
+
},
|
|
149
|
+
popupRender: {
|
|
150
|
+
type: Function,
|
|
151
|
+
required: false,
|
|
152
|
+
default: void 0
|
|
153
|
+
},
|
|
154
|
+
getPopupContainer: {
|
|
155
|
+
type: Function,
|
|
156
|
+
required: false,
|
|
157
|
+
default: void 0
|
|
158
|
+
},
|
|
159
|
+
popupAlign: {
|
|
160
|
+
type: Object,
|
|
161
|
+
required: false,
|
|
162
|
+
default: void 0
|
|
163
|
+
},
|
|
164
|
+
empty: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
required: true,
|
|
167
|
+
default: void 0
|
|
168
|
+
},
|
|
169
|
+
onPopupVisibleChange: {
|
|
170
|
+
type: [Function, null],
|
|
171
|
+
required: false,
|
|
172
|
+
default: void 0
|
|
173
|
+
},
|
|
174
|
+
onPopupMouseEnter: {
|
|
175
|
+
type: Function,
|
|
176
|
+
required: true,
|
|
177
|
+
default: void 0
|
|
178
|
+
},
|
|
179
|
+
onPopupMouseDown: {
|
|
180
|
+
type: Function,
|
|
181
|
+
required: true,
|
|
182
|
+
default: void 0
|
|
183
|
+
}
|
|
184
|
+
}, { direction: "ltr" }),
|
|
185
|
+
name: "SelectTrigger",
|
|
186
|
+
inheritAttrs: false
|
|
187
|
+
});
|
|
188
|
+
var SelectTrigger_default = SelectTrigger;
|
|
189
|
+
exports.default = SelectTrigger_default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AlignType, BuildInPlacements } from '@v-c/trigger';
|
|
2
|
+
import { CSSProperties } from 'vue';
|
|
3
|
+
import { Placement, RenderDOMFunc } from './interface.ts';
|
|
4
|
+
export interface SelectTriggerProps {
|
|
5
|
+
prefixCls: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
visible: boolean;
|
|
8
|
+
popupElement: any;
|
|
9
|
+
animation?: string;
|
|
10
|
+
transitionName?: string;
|
|
11
|
+
placement?: Placement;
|
|
12
|
+
builtinPlacements?: BuildInPlacements;
|
|
13
|
+
popupStyle?: CSSProperties;
|
|
14
|
+
popupClassName?: string;
|
|
15
|
+
direction?: string;
|
|
16
|
+
popupMatchSelectWidth?: boolean | number;
|
|
17
|
+
popupRender?: (menu: any) => any;
|
|
18
|
+
getPopupContainer?: RenderDOMFunc;
|
|
19
|
+
popupAlign?: AlignType;
|
|
20
|
+
empty: boolean;
|
|
21
|
+
onPopupVisibleChange?: ((visible: boolean) => void) | null;
|
|
22
|
+
onPopupMouseEnter: () => void;
|
|
23
|
+
onPopupMouseDown: (event: MouseEvent) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const SelectTrigger: import('vue').DefineSetupFnComponent<SelectTriggerProps, {}, {}, SelectTriggerProps & {}, import('vue').PublicProps>;
|
|
26
|
+
export default SelectTrigger;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { computed, createVNode, defineComponent, mergeDefaults, mergeProps, shallowRef } from "vue";
|
|
2
|
+
import { clsx } from "@v-c/util";
|
|
3
|
+
import Trigger from "@v-c/trigger";
|
|
4
|
+
function getBuiltInPlacements(popupMatchSelectWidth) {
|
|
5
|
+
const adjustX = popupMatchSelectWidth === true ? 0 : 1;
|
|
6
|
+
return {
|
|
7
|
+
bottomLeft: {
|
|
8
|
+
points: ["tl", "bl"],
|
|
9
|
+
offset: [0, 4],
|
|
10
|
+
overflow: {
|
|
11
|
+
adjustX,
|
|
12
|
+
adjustY: 1
|
|
13
|
+
},
|
|
14
|
+
htmlRegion: "scroll"
|
|
15
|
+
},
|
|
16
|
+
bottomRight: {
|
|
17
|
+
points: ["tr", "br"],
|
|
18
|
+
offset: [0, 4],
|
|
19
|
+
overflow: {
|
|
20
|
+
adjustX,
|
|
21
|
+
adjustY: 1
|
|
22
|
+
},
|
|
23
|
+
htmlRegion: "scroll"
|
|
24
|
+
},
|
|
25
|
+
topLeft: {
|
|
26
|
+
points: ["bl", "tl"],
|
|
27
|
+
offset: [0, -4],
|
|
28
|
+
overflow: {
|
|
29
|
+
adjustX,
|
|
30
|
+
adjustY: 1
|
|
31
|
+
},
|
|
32
|
+
htmlRegion: "scroll"
|
|
33
|
+
},
|
|
34
|
+
topRight: {
|
|
35
|
+
points: ["br", "tr"],
|
|
36
|
+
offset: [0, -4],
|
|
37
|
+
overflow: {
|
|
38
|
+
adjustX,
|
|
39
|
+
adjustY: 1
|
|
40
|
+
},
|
|
41
|
+
htmlRegion: "scroll"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var SelectTrigger_default = /* @__PURE__ */ defineComponent((props, { slots, attrs, expose }) => {
|
|
46
|
+
const mergedBuiltinPlacements = computed(() => {
|
|
47
|
+
return props?.builtinPlacements || getBuiltInPlacements(props.popupMatchSelectWidth);
|
|
48
|
+
});
|
|
49
|
+
const isNumberPopupWidth = computed(() => typeof props.popupMatchSelectWidth === "number");
|
|
50
|
+
const stretch = computed(() => {
|
|
51
|
+
if (isNumberPopupWidth.value) return null;
|
|
52
|
+
return props.popupMatchSelectWidth === false ? "minWidth" : "width";
|
|
53
|
+
});
|
|
54
|
+
const triggerPopupRef = shallowRef();
|
|
55
|
+
expose({ getPopupElement: () => triggerPopupRef.value?.popupElement });
|
|
56
|
+
return () => {
|
|
57
|
+
const { prefixCls, popupElement, popupRender, animation, transitionName, popupStyle, popupMatchSelectWidth, onPopupVisibleChange, placement, direction = "ltr", builtinPlacements, onPopupMouseEnter, onPopupMouseDown, popupAlign, visible, getPopupContainer, popupClassName, empty,...restProps } = props;
|
|
58
|
+
let popupNode = popupElement;
|
|
59
|
+
if (popupRender) popupNode = popupRender(popupElement);
|
|
60
|
+
const popupPrefixCls = `${prefixCls}-dropdown`;
|
|
61
|
+
const mergedTransitionName = animation ? `${popupPrefixCls}-${animation}` : transitionName;
|
|
62
|
+
const mergedPopupStyle = popupStyle ?? {};
|
|
63
|
+
if (isNumberPopupWidth.value) mergedPopupStyle.width = `${popupMatchSelectWidth}px`;
|
|
64
|
+
return createVNode(Trigger, mergeProps(attrs, restProps, {
|
|
65
|
+
"showAction": onPopupVisibleChange ? ["click"] : [],
|
|
66
|
+
"hideAction": onPopupVisibleChange ? ["click"] : [],
|
|
67
|
+
"popupPlacement": placement || (direction === "rtl" ? "bottomRight" : "bottomLeft"),
|
|
68
|
+
"builtinPlacements": mergedBuiltinPlacements.value,
|
|
69
|
+
"prefixCls": popupPrefixCls,
|
|
70
|
+
"popup": createVNode("div", {
|
|
71
|
+
"onMousedown": onPopupMouseDown,
|
|
72
|
+
"onMouseenter": onPopupMouseEnter
|
|
73
|
+
}, [popupNode]),
|
|
74
|
+
"ref": triggerPopupRef,
|
|
75
|
+
"stretch": stretch.value,
|
|
76
|
+
"popupMotion": { name: mergedTransitionName },
|
|
77
|
+
"popupAlign": popupAlign,
|
|
78
|
+
"popupVisible": visible,
|
|
79
|
+
"getPopupContainer": getPopupContainer,
|
|
80
|
+
"popupClassName": clsx(popupClassName, { [`${popupPrefixCls}-empty`]: empty }),
|
|
81
|
+
"popupStyle": mergedPopupStyle,
|
|
82
|
+
"onPopupVisibleChange": onPopupVisibleChange ?? void 0
|
|
83
|
+
}), { default: () => [slots?.default?.()] });
|
|
84
|
+
};
|
|
85
|
+
}, {
|
|
86
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
87
|
+
prefixCls: {
|
|
88
|
+
type: String,
|
|
89
|
+
required: true,
|
|
90
|
+
default: void 0
|
|
91
|
+
},
|
|
92
|
+
disabled: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
required: true,
|
|
95
|
+
default: void 0
|
|
96
|
+
},
|
|
97
|
+
visible: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: true,
|
|
100
|
+
default: void 0
|
|
101
|
+
},
|
|
102
|
+
popupElement: {
|
|
103
|
+
required: true,
|
|
104
|
+
default: void 0
|
|
105
|
+
},
|
|
106
|
+
animation: {
|
|
107
|
+
type: String,
|
|
108
|
+
required: false,
|
|
109
|
+
default: void 0
|
|
110
|
+
},
|
|
111
|
+
transitionName: {
|
|
112
|
+
type: String,
|
|
113
|
+
required: false,
|
|
114
|
+
default: void 0
|
|
115
|
+
},
|
|
116
|
+
placement: {
|
|
117
|
+
type: String,
|
|
118
|
+
required: false,
|
|
119
|
+
default: void 0
|
|
120
|
+
},
|
|
121
|
+
builtinPlacements: {
|
|
122
|
+
type: Object,
|
|
123
|
+
required: false,
|
|
124
|
+
default: void 0
|
|
125
|
+
},
|
|
126
|
+
popupStyle: {
|
|
127
|
+
type: Object,
|
|
128
|
+
required: false,
|
|
129
|
+
default: void 0
|
|
130
|
+
},
|
|
131
|
+
popupClassName: {
|
|
132
|
+
type: String,
|
|
133
|
+
required: false,
|
|
134
|
+
default: void 0
|
|
135
|
+
},
|
|
136
|
+
direction: {
|
|
137
|
+
type: String,
|
|
138
|
+
required: false,
|
|
139
|
+
default: void 0
|
|
140
|
+
},
|
|
141
|
+
popupMatchSelectWidth: {
|
|
142
|
+
type: [Boolean, Number],
|
|
143
|
+
required: false,
|
|
144
|
+
default: void 0
|
|
145
|
+
},
|
|
146
|
+
popupRender: {
|
|
147
|
+
type: Function,
|
|
148
|
+
required: false,
|
|
149
|
+
default: void 0
|
|
150
|
+
},
|
|
151
|
+
getPopupContainer: {
|
|
152
|
+
type: Function,
|
|
153
|
+
required: false,
|
|
154
|
+
default: void 0
|
|
155
|
+
},
|
|
156
|
+
popupAlign: {
|
|
157
|
+
type: Object,
|
|
158
|
+
required: false,
|
|
159
|
+
default: void 0
|
|
160
|
+
},
|
|
161
|
+
empty: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
required: true,
|
|
164
|
+
default: void 0
|
|
165
|
+
},
|
|
166
|
+
onPopupVisibleChange: {
|
|
167
|
+
type: [Function, null],
|
|
168
|
+
required: false,
|
|
169
|
+
default: void 0
|
|
170
|
+
},
|
|
171
|
+
onPopupMouseEnter: {
|
|
172
|
+
type: Function,
|
|
173
|
+
required: true,
|
|
174
|
+
default: void 0
|
|
175
|
+
},
|
|
176
|
+
onPopupMouseDown: {
|
|
177
|
+
type: Function,
|
|
178
|
+
required: true,
|
|
179
|
+
default: void 0
|
|
180
|
+
}
|
|
181
|
+
}, { direction: "ltr" }),
|
|
182
|
+
name: "SelectTrigger",
|
|
183
|
+
inheritAttrs: false
|
|
184
|
+
});
|
|
185
|
+
export { SelectTrigger_default as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
|
|
3
|
+
let vue = require("vue");
|
|
4
|
+
let __v_c_util = require("@v-c/util");
|
|
5
|
+
var TransBtn = /* @__PURE__ */ (0, vue.defineComponent)((props, { slots }) => {
|
|
6
|
+
return () => {
|
|
7
|
+
const { className, style, customizeIcon, customizeIconProps, onMouseDown, onClick } = props;
|
|
8
|
+
const icon = typeof customizeIcon === "function" ? customizeIcon(customizeIconProps) : customizeIcon;
|
|
9
|
+
return (0, vue.createVNode)("span", {
|
|
10
|
+
"class": className,
|
|
11
|
+
"onMousedown": (event) => {
|
|
12
|
+
event.preventDefault();
|
|
13
|
+
onMouseDown?.(event);
|
|
14
|
+
},
|
|
15
|
+
"style": {
|
|
16
|
+
userSelect: "none",
|
|
17
|
+
WebkitUserSelect: "none",
|
|
18
|
+
...style
|
|
19
|
+
},
|
|
20
|
+
"unselectable": "on",
|
|
21
|
+
"onClick": onClick,
|
|
22
|
+
"aria-hidden": true
|
|
23
|
+
}, [icon !== void 0 ? icon : (0, vue.createVNode)("span", { "class": (0, __v_c_util.clsx)(className.split(/\s+/).map((cls) => `${cls}-icon`)) }, [slots?.default?.()])]);
|
|
24
|
+
};
|
|
25
|
+
}, {
|
|
26
|
+
props: {
|
|
27
|
+
className: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
style: {
|
|
33
|
+
type: Object,
|
|
34
|
+
required: false,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
customizeIcon: {
|
|
38
|
+
type: [
|
|
39
|
+
Object,
|
|
40
|
+
Function,
|
|
41
|
+
String,
|
|
42
|
+
Number,
|
|
43
|
+
null,
|
|
44
|
+
Boolean,
|
|
45
|
+
Array
|
|
46
|
+
],
|
|
47
|
+
required: false,
|
|
48
|
+
default: void 0
|
|
49
|
+
},
|
|
50
|
+
customizeIconProps: {
|
|
51
|
+
required: false,
|
|
52
|
+
default: void 0
|
|
53
|
+
},
|
|
54
|
+
onMouseDown: {
|
|
55
|
+
type: Function,
|
|
56
|
+
required: false,
|
|
57
|
+
default: void 0
|
|
58
|
+
},
|
|
59
|
+
onClick: {
|
|
60
|
+
type: Function,
|
|
61
|
+
required: false,
|
|
62
|
+
default: void 0
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
name: "TransBtn",
|
|
66
|
+
inheritAttrs: false
|
|
67
|
+
});
|
|
68
|
+
var TransBtn_default = TransBtn;
|
|
69
|
+
exports.default = TransBtn_default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CSSProperties } from 'vue';
|
|
2
|
+
import { RenderNode } from './interface.ts';
|
|
3
|
+
export interface TransBtnProps {
|
|
4
|
+
className: string;
|
|
5
|
+
style?: CSSProperties;
|
|
6
|
+
customizeIcon?: RenderNode;
|
|
7
|
+
customizeIconProps?: any;
|
|
8
|
+
onMouseDown?: (event: MouseEvent) => void;
|
|
9
|
+
onClick?: (event: MouseEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Small wrapper for Select icons (clear/arrow/etc.).
|
|
13
|
+
* Prevents default mousedown to avoid blurring or caret moves, and
|
|
14
|
+
* renders a custom icon or a fallback icon span.
|
|
15
|
+
*
|
|
16
|
+
* DOM structure:
|
|
17
|
+
* <span className={className} ...>
|
|
18
|
+
* { icon || <span className={`${className}-icon`}>{children}</span> }
|
|
19
|
+
* </span>
|
|
20
|
+
*/
|
|
21
|
+
declare const TransBtn: import('vue').DefineSetupFnComponent<TransBtnProps, {}, {}, TransBtnProps & {}, import('vue').PublicProps>;
|
|
22
|
+
export default TransBtn;
|
package/dist/TransBtn.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
|
+
import { clsx } from "@v-c/util";
|
|
3
|
+
var TransBtn_default = /* @__PURE__ */ defineComponent((props, { slots }) => {
|
|
4
|
+
return () => {
|
|
5
|
+
const { className, style, customizeIcon, customizeIconProps, onMouseDown, onClick } = props;
|
|
6
|
+
const icon = typeof customizeIcon === "function" ? customizeIcon(customizeIconProps) : customizeIcon;
|
|
7
|
+
return createVNode("span", {
|
|
8
|
+
"class": className,
|
|
9
|
+
"onMousedown": (event) => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
onMouseDown?.(event);
|
|
12
|
+
},
|
|
13
|
+
"style": {
|
|
14
|
+
userSelect: "none",
|
|
15
|
+
WebkitUserSelect: "none",
|
|
16
|
+
...style
|
|
17
|
+
},
|
|
18
|
+
"unselectable": "on",
|
|
19
|
+
"onClick": onClick,
|
|
20
|
+
"aria-hidden": true
|
|
21
|
+
}, [icon !== void 0 ? icon : createVNode("span", { "class": clsx(className.split(/\s+/).map((cls) => `${cls}-icon`)) }, [slots?.default?.()])]);
|
|
22
|
+
};
|
|
23
|
+
}, {
|
|
24
|
+
props: {
|
|
25
|
+
className: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true,
|
|
28
|
+
default: void 0
|
|
29
|
+
},
|
|
30
|
+
style: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: false,
|
|
33
|
+
default: void 0
|
|
34
|
+
},
|
|
35
|
+
customizeIcon: {
|
|
36
|
+
type: [
|
|
37
|
+
Object,
|
|
38
|
+
Function,
|
|
39
|
+
String,
|
|
40
|
+
Number,
|
|
41
|
+
null,
|
|
42
|
+
Boolean,
|
|
43
|
+
Array
|
|
44
|
+
],
|
|
45
|
+
required: false,
|
|
46
|
+
default: void 0
|
|
47
|
+
},
|
|
48
|
+
customizeIconProps: {
|
|
49
|
+
required: false,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
onMouseDown: {
|
|
53
|
+
type: Function,
|
|
54
|
+
required: false,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
onClick: {
|
|
58
|
+
type: Function,
|
|
59
|
+
required: false,
|
|
60
|
+
default: void 0
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
name: "TransBtn",
|
|
64
|
+
inheritAttrs: false
|
|
65
|
+
});
|
|
66
|
+
export { TransBtn_default as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
9
|
+
key = keys[i];
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: ((k) => from[k]).bind(null, key),
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
18
|
+
value: mod,
|
|
19
|
+
enumerable: true
|
|
20
|
+
}) : target, mod));
|
|
21
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const require_useBaseProps = require("./useBaseProps.cjs");
|
|
2
|
+
const require_useAllowClear = require("./useAllowClear.cjs");
|
|
3
|
+
const require_useComponents = require("./useComponents.cjs");
|
|
4
|
+
const require_useLock = require("./useLock.cjs");
|
|
5
|
+
const require_useOpen = require("./useOpen.cjs");
|
|
6
|
+
const require_useSelectTriggerControl = require("./useSelectTriggerControl.cjs");
|
|
7
|
+
const require_useCache = require("./useCache.cjs");
|
|
8
|
+
const require_useFilterOptions = require("./useFilterOptions.cjs");
|
|
9
|
+
const require_useOptions = require("./useOptions.cjs");
|
|
10
|
+
const require_useRefFunc = require("./useRefFunc.cjs");
|
|
11
|
+
const require_useSearchConfig = require("./useSearchConfig.cjs");
|
|
12
|
+
exports.useAllowClear = require_useAllowClear.useAllowClear;
|
|
13
|
+
exports.useBaseProps = require_useBaseProps.default;
|
|
14
|
+
exports.useBaseSelectProvider = require_useBaseProps.useBaseSelectProvider;
|
|
15
|
+
exports.useCache = require_useCache.default;
|
|
16
|
+
exports.useComponents = require_useComponents.default;
|
|
17
|
+
exports.useFilterOptions = require_useFilterOptions.default;
|
|
18
|
+
exports.useLock = require_useLock.default;
|
|
19
|
+
exports.useOpen = require_useOpen.default;
|
|
20
|
+
exports.useOptions = require_useOptions.default;
|
|
21
|
+
exports.useRefFunc = require_useRefFunc.default;
|
|
22
|
+
exports.useSearchConfig = require_useSearchConfig.default;
|
|
23
|
+
exports.useSelectTriggerControl = require_useSelectTriggerControl.default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { useAllowClear } from './useAllowClear';
|
|
2
|
+
export type { AllowClearConfig } from './useAllowClear';
|
|
3
|
+
export { default as useBaseProps, useBaseSelectProvider } from './useBaseProps';
|
|
4
|
+
export type { BaseSelectContextProps } from './useBaseProps';
|
|
5
|
+
export { default as useCache } from './useCache';
|
|
6
|
+
export { default as useComponents } from './useComponents';
|
|
7
|
+
export type { ComponentsConfig } from './useComponents';
|
|
8
|
+
export { default as useFilterOptions } from './useFilterOptions';
|
|
9
|
+
export { default as useLock } from './useLock';
|
|
10
|
+
export { default as useOpen } from './useOpen';
|
|
11
|
+
export type { TriggerOpenType } from './useOpen';
|
|
12
|
+
export { default as useOptions } from './useOptions';
|
|
13
|
+
export type { OptionsResult } from './useOptions';
|
|
14
|
+
export { default as useRefFunc } from './useRefFunc';
|
|
15
|
+
export { default as useSearchConfig } from './useSearchConfig';
|
|
16
|
+
export type { SearchConfigResult } from './useSearchConfig';
|
|
17
|
+
export { default as useSelectTriggerControl } from './useSelectTriggerControl';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import useBaseProps, { useBaseSelectProvider } from "./useBaseProps.js";
|
|
2
|
+
import { useAllowClear } from "./useAllowClear.js";
|
|
3
|
+
import useComponents from "./useComponents.js";
|
|
4
|
+
import useLock from "./useLock.js";
|
|
5
|
+
import useOpen from "./useOpen.js";
|
|
6
|
+
import useSelectTriggerControl from "./useSelectTriggerControl.js";
|
|
7
|
+
import useCache from "./useCache.js";
|
|
8
|
+
import useFilterOptions from "./useFilterOptions.js";
|
|
9
|
+
import useOptions from "./useOptions.js";
|
|
10
|
+
import useRefFunc from "./useRefFunc.js";
|
|
11
|
+
import useSearchConfig from "./useSearchConfig.js";
|
|
12
|
+
export { useAllowClear, useBaseProps, useBaseSelectProvider, useCache, useComponents, useFilterOptions, useLock, useOpen, useOptions, useRefFunc, useSearchConfig, useSelectTriggerControl };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
|
|
2
|
+
let vue = require("vue");
|
|
3
|
+
function useAllowClear(_prefixCls, displayValues, allowClear, clearIcon, disabled, mergedSearchValue, mode) {
|
|
4
|
+
const allowClearConfig = (0, vue.computed)(() => {
|
|
5
|
+
if (typeof allowClear?.value === "boolean") return { allowClear: allowClear.value };
|
|
6
|
+
if (allowClear?.value && typeof allowClear.value === "object") return allowClear.value;
|
|
7
|
+
return { allowClear: false };
|
|
8
|
+
});
|
|
9
|
+
return (0, vue.computed)(() => {
|
|
10
|
+
const mergedAllowClear = !disabled?.value && allowClearConfig.value?.allowClear !== false && (displayValues.value.length || mergedSearchValue?.value) && !(mode?.value === "combobox" && mergedSearchValue?.value === "");
|
|
11
|
+
return {
|
|
12
|
+
allowClear: !!mergedAllowClear,
|
|
13
|
+
clearIcon: mergedAllowClear ? allowClearConfig.value.clearIcon || clearIcon?.value || "×" : null
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.useAllowClear = useAllowClear;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { DisplayValueType, Mode } from '../interface.ts';
|
|
3
|
+
export interface AllowClearConfig {
|
|
4
|
+
allowClear: boolean;
|
|
5
|
+
clearIcon: any;
|
|
6
|
+
}
|
|
7
|
+
export declare function useAllowClear(_prefixCls: Ref<string>, displayValues: Ref<DisplayValueType[]>, allowClear?: Ref<boolean | {
|
|
8
|
+
clearIcon?: any;
|
|
9
|
+
}>, clearIcon?: Ref<any>, disabled?: Ref<boolean>, mergedSearchValue?: Ref<string | undefined>, mode?: Ref<Mode | undefined>): import('vue').ComputedRef<AllowClearConfig>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
function useAllowClear(_prefixCls, displayValues, allowClear, clearIcon, disabled, mergedSearchValue, mode) {
|
|
3
|
+
const allowClearConfig = computed(() => {
|
|
4
|
+
if (typeof allowClear?.value === "boolean") return { allowClear: allowClear.value };
|
|
5
|
+
if (allowClear?.value && typeof allowClear.value === "object") return allowClear.value;
|
|
6
|
+
return { allowClear: false };
|
|
7
|
+
});
|
|
8
|
+
return computed(() => {
|
|
9
|
+
const mergedAllowClear = !disabled?.value && allowClearConfig.value?.allowClear !== false && (displayValues.value.length || mergedSearchValue?.value) && !(mode?.value === "combobox" && mergedSearchValue?.value === "");
|
|
10
|
+
return {
|
|
11
|
+
allowClear: !!mergedAllowClear,
|
|
12
|
+
clearIcon: mergedAllowClear ? allowClearConfig.value.clearIcon || clearIcon?.value || "×" : null
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { useAllowClear };
|