@ebiz/designer-components 0.0.18 → 0.0.19
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/package.json +3 -2
- package/src/apiService/mockDataService.js +116 -0
- package/src/apiService/simpleDataService.js +186 -80
- package/src/components/Button.vue +72 -22
- package/src/components/EbizAvatar.vue +116 -0
- package/src/components/EbizCheckbox.vue +94 -0
- package/src/components/EbizCheckboxGroup.vue +70 -0
- package/src/components/EbizDetailBlock.vue +82 -0
- package/src/components/EbizDialog.vue +244 -56
- package/src/components/EbizEmployeeInfo.vue +139 -0
- package/src/components/EbizFileUpload.vue +202 -0
- package/src/components/EbizPageHeader.vue +96 -0
- package/src/components/EbizPagination.vue +163 -0
- package/src/components/EbizRadio.vue +87 -0
- package/src/components/EbizRadioGroup.vue +84 -0
- package/src/components/EbizRemoteSelect.vue +118 -40
- package/src/components/EbizSpace.vue +101 -0
- package/src/components/EbizStatistic.vue +150 -0
- package/src/components/EbizSwiper.vue +114 -0
- package/src/components/EbizSwiperItem.vue +14 -0
- package/src/components/EbizSwitch.vue +86 -0
- package/src/components/EbizTabHeader.vue +145 -0
- package/src/components/EbizTabPanel.vue +23 -0
- package/src/components/EbizTable.vue +466 -0
- package/src/components/EbizTableColumn.vue +117 -0
- package/src/components/EbizTableSort.vue +181 -0
- package/src/components/EbizTabs.vue +133 -91
- package/src/components/EbizTimePicker.vue +144 -0
- package/src/components/EbizTitle.vue +3 -10
- package/src/components/EbizTree.vue +153 -0
- package/src/components/EbizTreeSelector.vue +423 -0
- package/src/components/Home.vue +8 -0
- package/src/components/TdesignAlert.vue +116 -0
- package/src/components/TdesignButton.vue +130 -0
- package/src/components/TdesignCalendar/index.vue +146 -0
- package/src/components/TdesignCard.vue +196 -0
- package/src/components/TdesignCol.vue +102 -0
- package/src/components/TdesignCollapse.vue +143 -0
- package/src/components/TdesignCollapsePanel.vue +80 -0
- package/src/components/TdesignDatePicker.vue +125 -0
- package/src/components/TdesignDialog.vue +226 -0
- package/src/components/TdesignForm.vue +134 -0
- package/src/components/TdesignFormItem.vue +106 -0
- package/src/components/TdesignGrid.vue +56 -0
- package/src/components/TdesignIcon.vue +68 -0
- package/src/components/TdesignImage.vue +163 -0
- package/src/components/TdesignImageViewer.vue +201 -0
- package/src/components/TdesignInput.vue +243 -0
- package/src/components/TdesignSelect.vue +445 -0
- package/src/components/TdesignTag.vue +118 -0
- package/src/components/TdesignTextarea.vue +143 -0
- package/src/components/TdesignTimeline.vue +58 -0
- package/src/components/TdesignTimelineItem.vue +72 -0
- package/src/components/TdesignUpload.vue +757 -0
- package/src/components/TdesignWatermark.vue +108 -0
- package/src/index.js +130 -0
- package/src/main.js +20 -4
- package/src/router/index.js +244 -5
- package/src/views/Button.vue +7 -3
- package/src/views/CheckboxDemo.vue +105 -0
- package/src/views/DialogDemo.vue +126 -0
- package/src/views/EbizAvatar.vue +224 -0
- package/src/views/EbizDetailBlockDemo.vue +31 -0
- package/src/views/EbizEmployeeInfo.vue +250 -0
- package/src/views/EbizRadioDemo.vue +152 -0
- package/src/views/EbizSpace.vue +186 -0
- package/src/views/EbizSwiper.vue +158 -0
- package/src/views/GridDemo.vue +239 -0
- package/src/views/Home.vue +63 -2
- package/src/views/PageHeaderDemo.vue +105 -0
- package/src/views/PaginationDemo.vue +97 -0
- package/src/views/RemoteSelect.vue +336 -5
- package/src/views/StatisticDemo.vue +191 -0
- package/src/views/SwitchDemo.vue +80 -0
- package/src/views/TableDemo.vue +335 -0
- package/src/views/TableSortDemo.vue +144 -0
- package/src/views/TableView.vue +69 -0
- package/src/views/TabsDemo.vue +283 -0
- package/src/views/TagDemo.vue +102 -0
- package/src/views/TdesignAlert.vue +99 -0
- package/src/views/TdesignButton.vue +191 -0
- package/src/views/TdesignCalendar.vue +95 -0
- package/src/views/TdesignCard.vue +297 -0
- package/src/views/TdesignCollapse.vue +294 -0
- package/src/views/TdesignDatePicker.vue +188 -0
- package/src/views/TdesignForm.vue +249 -0
- package/src/views/TdesignIcon.vue +204 -0
- package/src/views/TdesignImage.vue +216 -0
- package/src/views/TdesignImageViewer.vue +199 -0
- package/src/views/TdesignInput.vue +253 -0
- package/src/views/TdesignSelect.vue +474 -0
- package/src/views/TdesignSwiper.vue +158 -0
- package/src/views/TextareaDemo.vue +94 -0
- package/src/views/TimePickerDemo.vue +147 -0
- package/src/views/TimelineDemo.vue +161 -0
- package/src/views/TreeDemo.vue +255 -0
- package/src/views/TreeSelectorDemo.vue +246 -0
- package/src/views/UploadDemo.vue +122 -0
- package/src/views/WatermarkDemo.vue +86 -0
@@ -0,0 +1,243 @@
|
|
1
|
+
<template>
|
2
|
+
<t-input
|
3
|
+
:align="align"
|
4
|
+
:autocomplete="autocomplete"
|
5
|
+
:autofocus="autofocus"
|
6
|
+
:clearable="clearable"
|
7
|
+
:disabled="disabled"
|
8
|
+
:format="format"
|
9
|
+
:label="label"
|
10
|
+
:maxcharacter="maxcharacter"
|
11
|
+
:maxlength="maxlength"
|
12
|
+
:name="name"
|
13
|
+
:placeholder="placeholder"
|
14
|
+
:readonly="readonly"
|
15
|
+
:show-clear-icon-on-empty="showClearIconOnEmpty"
|
16
|
+
:show-limit-number="showLimitNumber"
|
17
|
+
:size="size"
|
18
|
+
:status="status"
|
19
|
+
:tips="tips"
|
20
|
+
:type="type"
|
21
|
+
:value="modelValue"
|
22
|
+
@blur="handleBlur"
|
23
|
+
@change="handleChange"
|
24
|
+
@clear="handleClear"
|
25
|
+
@enter="handleEnter"
|
26
|
+
@focus="handleFocus"
|
27
|
+
@input="handleInput"
|
28
|
+
@keydown="handleKeydown"
|
29
|
+
@keypress="handleKeypress"
|
30
|
+
@keyup="handleKeyup"
|
31
|
+
@mouseenter="handleMouseenter"
|
32
|
+
@mouseleave="handleMouseleave"
|
33
|
+
>
|
34
|
+
<!-- 前置图标插槽 -->
|
35
|
+
<template v-if="$slots.prefixIcon" #prefix-icon>
|
36
|
+
<slot name="prefixIcon"></slot>
|
37
|
+
</template>
|
38
|
+
|
39
|
+
<!-- 后置图标插槽 -->
|
40
|
+
<template v-if="$slots.suffixIcon" #suffix-icon>
|
41
|
+
<slot name="suffixIcon"></slot>
|
42
|
+
</template>
|
43
|
+
|
44
|
+
<!-- 前置内容插槽 -->
|
45
|
+
<template v-if="$slots.label" #label>
|
46
|
+
<slot name="label"></slot>
|
47
|
+
</template>
|
48
|
+
|
49
|
+
<!-- 后置内容插槽 -->
|
50
|
+
<template v-if="$slots.suffix" #suffix>
|
51
|
+
<slot name="suffix"></slot>
|
52
|
+
</template>
|
53
|
+
</t-input>
|
54
|
+
</template>
|
55
|
+
|
56
|
+
<script>
|
57
|
+
export default {
|
58
|
+
name: "EbizTdesignInput"
|
59
|
+
}
|
60
|
+
</script>
|
61
|
+
|
62
|
+
<script setup>
|
63
|
+
import { defineProps, defineEmits } from 'vue';
|
64
|
+
import { Input as TInput } from 'tdesign-vue-next';
|
65
|
+
|
66
|
+
const _props = defineProps({
|
67
|
+
// 对齐方式
|
68
|
+
align: {
|
69
|
+
type: String,
|
70
|
+
default: 'left',
|
71
|
+
validator: (val) => ['left', 'center', 'right'].includes(val)
|
72
|
+
},
|
73
|
+
// 自动完成
|
74
|
+
autocomplete: {
|
75
|
+
type: String,
|
76
|
+
default: undefined
|
77
|
+
},
|
78
|
+
// 自动获取焦点
|
79
|
+
autofocus: {
|
80
|
+
type: Boolean,
|
81
|
+
default: false
|
82
|
+
},
|
83
|
+
// 是否可清空
|
84
|
+
clearable: {
|
85
|
+
type: Boolean,
|
86
|
+
default: false
|
87
|
+
},
|
88
|
+
// 是否禁用
|
89
|
+
disabled: {
|
90
|
+
type: Boolean,
|
91
|
+
default: false
|
92
|
+
},
|
93
|
+
// 格式化函数
|
94
|
+
format: {
|
95
|
+
type: Function,
|
96
|
+
default: undefined
|
97
|
+
},
|
98
|
+
// 左侧文本
|
99
|
+
label: {
|
100
|
+
type: String,
|
101
|
+
default: ''
|
102
|
+
},
|
103
|
+
// 用户最多可以输入的字符个数
|
104
|
+
maxcharacter: {
|
105
|
+
type: Number,
|
106
|
+
default: undefined
|
107
|
+
},
|
108
|
+
// 用户最多可以输入的字符长度
|
109
|
+
maxlength: {
|
110
|
+
type: Number,
|
111
|
+
default: undefined
|
112
|
+
},
|
113
|
+
// 输入框名称
|
114
|
+
name: {
|
115
|
+
type: String,
|
116
|
+
default: ''
|
117
|
+
},
|
118
|
+
// 占位符
|
119
|
+
placeholder: {
|
120
|
+
type: String,
|
121
|
+
default: undefined
|
122
|
+
},
|
123
|
+
// 只读状态
|
124
|
+
readonly: {
|
125
|
+
type: Boolean,
|
126
|
+
default: false
|
127
|
+
},
|
128
|
+
// 输入框为空时是否显示清除按钮
|
129
|
+
showClearIconOnEmpty: {
|
130
|
+
type: Boolean,
|
131
|
+
default: false
|
132
|
+
},
|
133
|
+
// 是否显示字数限制
|
134
|
+
showLimitNumber: {
|
135
|
+
type: Boolean,
|
136
|
+
default: false
|
137
|
+
},
|
138
|
+
// 输入框尺寸
|
139
|
+
size: {
|
140
|
+
type: String,
|
141
|
+
default: 'medium',
|
142
|
+
validator: (val) => ['small', 'medium', 'large'].includes(val)
|
143
|
+
},
|
144
|
+
// 输入框状态
|
145
|
+
status: {
|
146
|
+
type: String,
|
147
|
+
default: undefined,
|
148
|
+
validator: (val) => ['default', 'success', 'warning', 'error'].includes(val)
|
149
|
+
},
|
150
|
+
// 提示文本
|
151
|
+
tips: {
|
152
|
+
type: String,
|
153
|
+
default: ''
|
154
|
+
},
|
155
|
+
// 输入框类型
|
156
|
+
type: {
|
157
|
+
type: String,
|
158
|
+
default: 'text',
|
159
|
+
validator: (val) => ['text', 'number', 'url', 'tel', 'password', 'search', 'submit', 'hidden'].includes(val)
|
160
|
+
},
|
161
|
+
// v-model绑定值
|
162
|
+
modelValue: {
|
163
|
+
type: [String, Number],
|
164
|
+
default: ''
|
165
|
+
}
|
166
|
+
});
|
167
|
+
|
168
|
+
const emit = defineEmits([
|
169
|
+
'update:modelValue',
|
170
|
+
'blur',
|
171
|
+
'change',
|
172
|
+
'clear',
|
173
|
+
'enter',
|
174
|
+
'focus',
|
175
|
+
'input',
|
176
|
+
'keydown',
|
177
|
+
'keypress',
|
178
|
+
'keyup',
|
179
|
+
'mouseenter',
|
180
|
+
'mouseleave'
|
181
|
+
]);
|
182
|
+
|
183
|
+
// 处理输入事件
|
184
|
+
const handleInput = (value, context) => {
|
185
|
+
emit('input', value, context);
|
186
|
+
};
|
187
|
+
|
188
|
+
// 处理变化事件
|
189
|
+
const handleChange = (value, context) => {
|
190
|
+
emit('update:modelValue', value);
|
191
|
+
emit('change', value, context);
|
192
|
+
};
|
193
|
+
|
194
|
+
// 处理失去焦点事件
|
195
|
+
const handleBlur = (value, context) => {
|
196
|
+
emit('blur', value, context);
|
197
|
+
};
|
198
|
+
|
199
|
+
// 处理获取焦点事件
|
200
|
+
const handleFocus = (value, context) => {
|
201
|
+
emit('focus', value, context);
|
202
|
+
};
|
203
|
+
|
204
|
+
// 处理回车事件
|
205
|
+
const handleEnter = (value, context) => {
|
206
|
+
emit('enter', value, context);
|
207
|
+
};
|
208
|
+
|
209
|
+
// 处理清空事件
|
210
|
+
const handleClear = (context) => {
|
211
|
+
emit('update:modelValue', '');
|
212
|
+
emit('clear', context);
|
213
|
+
};
|
214
|
+
|
215
|
+
// 处理键盘按下事件
|
216
|
+
const handleKeydown = (value, context) => {
|
217
|
+
emit('keydown', value, context);
|
218
|
+
};
|
219
|
+
|
220
|
+
// 处理键盘按键事件
|
221
|
+
const handleKeypress = (value, context) => {
|
222
|
+
emit('keypress', value, context);
|
223
|
+
};
|
224
|
+
|
225
|
+
// 处理键盘弹起事件
|
226
|
+
const handleKeyup = (value, context) => {
|
227
|
+
emit('keyup', value, context);
|
228
|
+
};
|
229
|
+
|
230
|
+
// 处理鼠标进入事件
|
231
|
+
const handleMouseenter = (value, context) => {
|
232
|
+
emit('mouseenter', value, context);
|
233
|
+
};
|
234
|
+
|
235
|
+
// 处理鼠标离开事件
|
236
|
+
const handleMouseleave = (value, context) => {
|
237
|
+
emit('mouseleave', value, context);
|
238
|
+
};
|
239
|
+
</script>
|
240
|
+
|
241
|
+
<style lang="less" scoped>
|
242
|
+
/* 自定义样式 */
|
243
|
+
</style>
|
@@ -0,0 +1,445 @@
|
|
1
|
+
<template>
|
2
|
+
<t-select
|
3
|
+
:autoWidth="autoWidth"
|
4
|
+
:borderless="borderless"
|
5
|
+
:clearable="clearable"
|
6
|
+
:collapsedItems="collapsedItems"
|
7
|
+
:creatable="creatable"
|
8
|
+
:disabled="disabled"
|
9
|
+
:empty="empty"
|
10
|
+
:filter="filter"
|
11
|
+
:filterable="filterable"
|
12
|
+
:keys="keys"
|
13
|
+
:label="label"
|
14
|
+
:loading="loading"
|
15
|
+
:loadingText="loadingText"
|
16
|
+
:max="max"
|
17
|
+
:minCollapsedNum="minCollapsedNum"
|
18
|
+
:multiple="multiple"
|
19
|
+
:options="options"
|
20
|
+
:placeholder="placeholder"
|
21
|
+
:popupProps="popupProps"
|
22
|
+
:popupVisible="popupVisible"
|
23
|
+
:prefixIcon="prefixIcon"
|
24
|
+
:readonly="readonly"
|
25
|
+
:reserveKeyword="reserveKeyword"
|
26
|
+
:scroll="scroll"
|
27
|
+
:selectInputProps="selectInputProps"
|
28
|
+
:showArrow="showArrow"
|
29
|
+
:size="size"
|
30
|
+
:status="status"
|
31
|
+
:tagInputProps="tagInputProps"
|
32
|
+
:tagProps="tagProps"
|
33
|
+
:tips="tips"
|
34
|
+
:valueDisplay="valueDisplay"
|
35
|
+
:valueType="valueType"
|
36
|
+
:onPaste="onPaste"
|
37
|
+
v-model="selectedValue"
|
38
|
+
@blur="handleBlur"
|
39
|
+
@change="handleChange"
|
40
|
+
@clear="handleClear"
|
41
|
+
@create="handleCreate"
|
42
|
+
@dropdown-visible-change="handleDropdownVisibleChange"
|
43
|
+
@enter="handleEnter"
|
44
|
+
@focus="handleFocus"
|
45
|
+
@keydown="handleKeydown"
|
46
|
+
@mouseenter="handleMouseenter"
|
47
|
+
@mouseleave="handleMouseleave"
|
48
|
+
@paste="handlePaste"
|
49
|
+
@popup-visible-change="handlePopupVisibleChange"
|
50
|
+
@remove="handleRemove"
|
51
|
+
@scroll="handleScroll"
|
52
|
+
@search="handleSearch"
|
53
|
+
>
|
54
|
+
<!-- 选项插槽 -->
|
55
|
+
<template v-if="$slots.options" #options>
|
56
|
+
<slot name="options"></slot>
|
57
|
+
</template>
|
58
|
+
|
59
|
+
<!-- 前缀图标插槽 -->
|
60
|
+
<template v-if="$slots.prefixIcon" #prefixIcon>
|
61
|
+
<slot name="prefixIcon"></slot>
|
62
|
+
</template>
|
63
|
+
|
64
|
+
<!-- 后缀图标插槽 -->
|
65
|
+
<template v-if="$slots.suffixIcon" #suffixIcon>
|
66
|
+
<slot name="suffixIcon"></slot>
|
67
|
+
</template>
|
68
|
+
|
69
|
+
<!-- 后缀内容插槽 -->
|
70
|
+
<template v-if="$slots.suffix" #suffix>
|
71
|
+
<slot name="suffix"></slot>
|
72
|
+
</template>
|
73
|
+
|
74
|
+
<!-- 空数据插槽 -->
|
75
|
+
<template v-if="$slots.empty" #empty>
|
76
|
+
<slot name="empty"></slot>
|
77
|
+
</template>
|
78
|
+
|
79
|
+
<!-- 选项显示插槽 -->
|
80
|
+
<template v-if="$slots.valueDisplay" #valueDisplay>
|
81
|
+
<slot name="valueDisplay"></slot>
|
82
|
+
</template>
|
83
|
+
|
84
|
+
<!-- 面板底部内容插槽 -->
|
85
|
+
<template v-if="$slots.panelBottomContent" #panelBottomContent>
|
86
|
+
<slot name="panelBottomContent"></slot>
|
87
|
+
</template>
|
88
|
+
|
89
|
+
<!-- 面板顶部内容插槽 -->
|
90
|
+
<template v-if="$slots.panelTopContent" #panelTopContent>
|
91
|
+
<slot name="panelTopContent"></slot>
|
92
|
+
</template>
|
93
|
+
|
94
|
+
<!-- 选项标签插槽 -->
|
95
|
+
<template v-if="$slots.tag" #tag>
|
96
|
+
<slot name="tag"></slot>
|
97
|
+
</template>
|
98
|
+
|
99
|
+
<!-- 加载中插槽 -->
|
100
|
+
<template v-if="$slots.loadingText" #loadingText>
|
101
|
+
<slot name="loadingText"></slot>
|
102
|
+
</template>
|
103
|
+
|
104
|
+
<!-- 折叠项插槽 -->
|
105
|
+
<template v-if="$slots.collapsedItems" #collapsedItems>
|
106
|
+
<slot name="collapsedItems"></slot>
|
107
|
+
</template>
|
108
|
+
|
109
|
+
<!-- 选择框自定义首部内容插槽 -->
|
110
|
+
<template v-if="$slots.header" #header>
|
111
|
+
<slot name="header"></slot>
|
112
|
+
</template>
|
113
|
+
|
114
|
+
<!-- 选择框自定义底部内容插槽 -->
|
115
|
+
<template v-if="$slots.footer" #footer>
|
116
|
+
<slot name="footer"></slot>
|
117
|
+
</template>
|
118
|
+
|
119
|
+
<!-- 输入框前置内容插槽 -->
|
120
|
+
<template v-if="$slots.prepend" #prepend>
|
121
|
+
<slot name="prepend"></slot>
|
122
|
+
</template>
|
123
|
+
|
124
|
+
<!-- 输入框后置内容插槽 -->
|
125
|
+
<template v-if="$slots.append" #append>
|
126
|
+
<slot name="append"></slot>
|
127
|
+
</template>
|
128
|
+
|
129
|
+
<!-- 选项内容插槽 -->
|
130
|
+
<template v-if="$slots.default" #default>
|
131
|
+
<slot></slot>
|
132
|
+
</template>
|
133
|
+
|
134
|
+
<!-- 选项分组标题插槽 -->
|
135
|
+
<template v-if="$slots.optionGroup" #optionGroup>
|
136
|
+
<slot name="optionGroup"></slot>
|
137
|
+
</template>
|
138
|
+
</t-select>
|
139
|
+
</template>
|
140
|
+
|
141
|
+
<script>
|
142
|
+
export default {
|
143
|
+
name: "EbizTdesignSelect"
|
144
|
+
}
|
145
|
+
</script>
|
146
|
+
|
147
|
+
<script setup>
|
148
|
+
import { defineProps, defineEmits, computed } from 'vue';
|
149
|
+
import { Select as TSelect } from 'tdesign-vue-next';
|
150
|
+
|
151
|
+
const props = defineProps({
|
152
|
+
// 选择器的值
|
153
|
+
modelValue: {
|
154
|
+
type: [String, Number, Object, Array],
|
155
|
+
default: undefined
|
156
|
+
},
|
157
|
+
// 宽度随内容自适应
|
158
|
+
autoWidth: {
|
159
|
+
type: Boolean,
|
160
|
+
default: false
|
161
|
+
},
|
162
|
+
// 无边框模式
|
163
|
+
borderless: {
|
164
|
+
type: Boolean,
|
165
|
+
default: false
|
166
|
+
},
|
167
|
+
// 是否可以清空选项
|
168
|
+
clearable: {
|
169
|
+
type: Boolean,
|
170
|
+
default: false
|
171
|
+
},
|
172
|
+
// 用于控制多选数量超出时,折叠选项的内容
|
173
|
+
collapsedItems: {
|
174
|
+
type: [Function, Boolean],
|
175
|
+
default: undefined
|
176
|
+
},
|
177
|
+
// 是否允许用户创建新条目
|
178
|
+
creatable: {
|
179
|
+
type: Boolean,
|
180
|
+
default: false
|
181
|
+
},
|
182
|
+
// 是否禁用选择器
|
183
|
+
disabled: {
|
184
|
+
type: Boolean,
|
185
|
+
default: false
|
186
|
+
},
|
187
|
+
// 当下拉列表为空时显示的内容
|
188
|
+
empty: {
|
189
|
+
type: String,
|
190
|
+
default: undefined
|
191
|
+
},
|
192
|
+
// 自定义过滤方法
|
193
|
+
filter: {
|
194
|
+
type: Function,
|
195
|
+
default: undefined
|
196
|
+
},
|
197
|
+
// 是否可搜索
|
198
|
+
filterable: {
|
199
|
+
type: Boolean,
|
200
|
+
default: false
|
201
|
+
},
|
202
|
+
// 用来定义选项中的字段别名
|
203
|
+
keys: {
|
204
|
+
type: Object,
|
205
|
+
default: () => ({})
|
206
|
+
},
|
207
|
+
// 左侧文本
|
208
|
+
label: {
|
209
|
+
type: [String, Function],
|
210
|
+
default: undefined
|
211
|
+
},
|
212
|
+
// 是否为加载状态
|
213
|
+
loading: {
|
214
|
+
type: Boolean,
|
215
|
+
default: false
|
216
|
+
},
|
217
|
+
// 远程加载时显示的文字
|
218
|
+
loadingText: {
|
219
|
+
type: String,
|
220
|
+
default: undefined
|
221
|
+
},
|
222
|
+
// 用于控制多选数量,值为 0 则不限制
|
223
|
+
max: {
|
224
|
+
type: Number,
|
225
|
+
default: 0
|
226
|
+
},
|
227
|
+
// 最小折叠数量,用于多选情况下折叠选中项
|
228
|
+
minCollapsedNum: {
|
229
|
+
type: Number,
|
230
|
+
default: 0
|
231
|
+
},
|
232
|
+
// 是否允许多选
|
233
|
+
multiple: {
|
234
|
+
type: Boolean,
|
235
|
+
default: false
|
236
|
+
},
|
237
|
+
// 数据化配置选项内容
|
238
|
+
options: {
|
239
|
+
type: Array,
|
240
|
+
default: () => []
|
241
|
+
},
|
242
|
+
// 占位符
|
243
|
+
placeholder: {
|
244
|
+
type: String,
|
245
|
+
default: undefined
|
246
|
+
},
|
247
|
+
// 弹出层的定位方式,同 Popup 组件
|
248
|
+
popupProps: {
|
249
|
+
type: Object,
|
250
|
+
default: () => ({})
|
251
|
+
},
|
252
|
+
// 是否显示下拉框
|
253
|
+
popupVisible: {
|
254
|
+
type: Boolean,
|
255
|
+
default: undefined
|
256
|
+
},
|
257
|
+
// 前缀图标
|
258
|
+
prefixIcon: {
|
259
|
+
type: [Function, String],
|
260
|
+
default: undefined
|
261
|
+
},
|
262
|
+
// 只读状态
|
263
|
+
readonly: {
|
264
|
+
type: Boolean,
|
265
|
+
default: false
|
266
|
+
},
|
267
|
+
// 多选且可搜索时,是否在选中一个选项后保留当前的搜索关键词
|
268
|
+
reserveKeyword: {
|
269
|
+
type: Boolean,
|
270
|
+
default: false
|
271
|
+
},
|
272
|
+
// 懒加载和虚拟滚动配置
|
273
|
+
scroll: {
|
274
|
+
type: Object,
|
275
|
+
default: () => ({})
|
276
|
+
},
|
277
|
+
// 透传 SelectInput 筛选器输入框组件的全部属性
|
278
|
+
selectInputProps: {
|
279
|
+
type: Object,
|
280
|
+
default: () => ({})
|
281
|
+
},
|
282
|
+
// 是否显示右侧箭头
|
283
|
+
showArrow: {
|
284
|
+
type: Boolean,
|
285
|
+
default: true
|
286
|
+
},
|
287
|
+
// 组件尺寸
|
288
|
+
size: {
|
289
|
+
type: String,
|
290
|
+
default: 'medium',
|
291
|
+
validator: (val) => ['small', 'medium', 'large'].includes(val)
|
292
|
+
},
|
293
|
+
// 输入框状态
|
294
|
+
status: {
|
295
|
+
type: String,
|
296
|
+
default: undefined,
|
297
|
+
validator: (val) => ['default', 'success', 'warning', 'error'].includes(val)
|
298
|
+
},
|
299
|
+
// 后置图标前的后置内容
|
300
|
+
suffix: {
|
301
|
+
type: String,
|
302
|
+
default: undefined
|
303
|
+
},
|
304
|
+
// 后置图标
|
305
|
+
suffixIcon: {
|
306
|
+
type: [Function, String],
|
307
|
+
default: undefined
|
308
|
+
},
|
309
|
+
// 透传 TagInput 标签输入框组件的全部属性
|
310
|
+
tagInputProps: {
|
311
|
+
type: Object,
|
312
|
+
default: () => ({})
|
313
|
+
},
|
314
|
+
// 透传 Tag 标签组件的全部属性
|
315
|
+
tagProps: {
|
316
|
+
type: Object,
|
317
|
+
default: () => ({})
|
318
|
+
},
|
319
|
+
// 输入框下方提示文本,会根据不同的 status 呈现不同的样式
|
320
|
+
tips: {
|
321
|
+
type: String,
|
322
|
+
default: ''
|
323
|
+
},
|
324
|
+
// 自定义选中项呈现方式
|
325
|
+
valueDisplay: {
|
326
|
+
type: Function,
|
327
|
+
default: undefined
|
328
|
+
},
|
329
|
+
// 用于控制选中值的类型
|
330
|
+
valueType: {
|
331
|
+
type: String,
|
332
|
+
default: undefined,
|
333
|
+
validator: (val) => ['value', 'object'].includes(val)
|
334
|
+
},
|
335
|
+
// 粘贴事件回调函数,参数为粘贴板内容
|
336
|
+
onPaste: {
|
337
|
+
type: Function,
|
338
|
+
default: undefined
|
339
|
+
}
|
340
|
+
});
|
341
|
+
|
342
|
+
// 选择器的值
|
343
|
+
const selectedValue = computed({
|
344
|
+
get: () => props.modelValue,
|
345
|
+
set: (value) => emit('update:modelValue', value)
|
346
|
+
});
|
347
|
+
|
348
|
+
const emit = defineEmits([
|
349
|
+
'update:modelValue',
|
350
|
+
'blur',
|
351
|
+
'change',
|
352
|
+
'clear',
|
353
|
+
'create',
|
354
|
+
'dropdown-visible-change',
|
355
|
+
'enter',
|
356
|
+
'focus',
|
357
|
+
'keydown',
|
358
|
+
'mouseenter',
|
359
|
+
'mouseleave',
|
360
|
+
'paste',
|
361
|
+
'popup-visible-change',
|
362
|
+
'remove',
|
363
|
+
'scroll',
|
364
|
+
'search'
|
365
|
+
]);
|
366
|
+
|
367
|
+
// 失去焦点时触发
|
368
|
+
const handleBlur = (value, context) => {
|
369
|
+
emit('blur', value, context);
|
370
|
+
};
|
371
|
+
|
372
|
+
// 选中值变化时触发
|
373
|
+
const handleChange = (value, context) => {
|
374
|
+
emit('change', value, context);
|
375
|
+
};
|
376
|
+
|
377
|
+
// 点击清除按钮时触发
|
378
|
+
const handleClear = (context) => {
|
379
|
+
emit('clear', context);
|
380
|
+
};
|
381
|
+
|
382
|
+
// 当新增选项时触发
|
383
|
+
const handleCreate = (value, context) => {
|
384
|
+
emit('create', value, context);
|
385
|
+
};
|
386
|
+
|
387
|
+
// 下拉框显示状态变化时触发
|
388
|
+
const handleDropdownVisibleChange = (visible) => {
|
389
|
+
emit('dropdown-visible-change', visible);
|
390
|
+
};
|
391
|
+
|
392
|
+
// 按下回车键时触发
|
393
|
+
const handleEnter = (context) => {
|
394
|
+
emit('enter', context);
|
395
|
+
};
|
396
|
+
|
397
|
+
// 获得焦点时触发
|
398
|
+
const handleFocus = (context) => {
|
399
|
+
emit('focus', context);
|
400
|
+
};
|
401
|
+
|
402
|
+
// 键盘按下时触发
|
403
|
+
const handleKeydown = (value, context) => {
|
404
|
+
emit('keydown', value, context);
|
405
|
+
};
|
406
|
+
|
407
|
+
// 鼠标进入时触发
|
408
|
+
const handleMouseenter = (context) => {
|
409
|
+
emit('mouseenter', context);
|
410
|
+
};
|
411
|
+
|
412
|
+
// 鼠标离开时触发
|
413
|
+
const handleMouseleave = (context) => {
|
414
|
+
emit('mouseleave', context);
|
415
|
+
};
|
416
|
+
|
417
|
+
// 粘贴事件触发
|
418
|
+
const handlePaste = (context) => {
|
419
|
+
emit('paste', context);
|
420
|
+
};
|
421
|
+
|
422
|
+
// 下拉框显示或隐藏时触发
|
423
|
+
const handlePopupVisibleChange = (visible, context) => {
|
424
|
+
emit('popup-visible-change', visible, context);
|
425
|
+
};
|
426
|
+
|
427
|
+
// 多选模式下移除tag时触发
|
428
|
+
const handleRemove = (options) => {
|
429
|
+
emit('remove', options);
|
430
|
+
};
|
431
|
+
|
432
|
+
// 滚动事件触发
|
433
|
+
const handleScroll = ({ scrollTop, scrollBottom }) => {
|
434
|
+
emit('scroll', { scrollTop, scrollBottom });
|
435
|
+
};
|
436
|
+
|
437
|
+
// 搜索时触发
|
438
|
+
const handleSearch = (filterWords) => {
|
439
|
+
emit('search', filterWords);
|
440
|
+
};
|
441
|
+
</script>
|
442
|
+
|
443
|
+
<style lang="less" scoped>
|
444
|
+
/* 自定义样式 */
|
445
|
+
</style>
|