element-plus
Version:
A Component Library for Vue 3
300 lines (296 loc) • 7.63 kB
JavaScript
'use strict';
var core = require('@popperjs/core');
var iconsVue = require('@element-plus/icons-vue');
var useProps = require('../../select-v2/src/useProps.js');
var tag = require('../../tag/src/tag.js');
var scrollbar = require('../../scrollbar/src/scrollbar.js');
var runtime = require('../../../utils/vue/props/runtime.js');
var index = require('../../../hooks/use-aria/index.js');
var index$1 = require('../../../hooks/use-empty-values/index.js');
var content = require('../../tooltip/src/content.js');
var icon = require('../../../utils/vue/icon.js');
var index$2 = require('../../../hooks/use-size/index.js');
var event = require('../../../constants/event.js');
const selectProps = runtime.buildProps({
/**
* @description the name attribute of select input
*/
name: String,
/**
* @description native input id
*/
id: String,
/**
* @description binding value
*/
modelValue: {
type: runtime.definePropType([
Array,
String,
Number,
Boolean,
Object
]),
default: void 0
},
/**
* @description the autocomplete attribute of select input
*/
autocomplete: {
type: String,
default: "off"
},
/**
* @description for non-filterable Select, this prop decides if the option menu pops up when the input is focused
*/
automaticDropdown: Boolean,
/**
* @description size of Input
*/
size: index$2.useSizeProp,
/**
* @description tooltip theme, built-in theme: `dark` / `light`
*/
effect: {
type: runtime.definePropType(String),
default: "light"
},
/**
* @description whether Select is disabled
*/
disabled: {
type: Boolean,
default: void 0
},
/**
* @description whether select can be cleared
*/
clearable: Boolean,
/**
* @description whether Select is filterable
*/
filterable: Boolean,
/**
* @description whether creating new items is allowed. To use this, `filterable` must be true
*/
allowCreate: Boolean,
/**
* @description whether Select is loading data from server
*/
loading: Boolean,
/**
* @description custom class name for Select's dropdown
*/
popperClass: {
type: String,
default: ""
},
/**
* @description custom style for Select's dropdown
*/
popperStyle: {
type: runtime.definePropType([String, Object])
},
/**
* @description [popper.js](https://popper.js.org/docs/v2/) parameters
*/
popperOptions: {
type: runtime.definePropType(Object),
default: () => ({})
},
/**
* @description whether options are loaded from server
*/
remote: Boolean,
/**
* @description debounce delay during remote search, in milliseconds
*/
debounce: {
type: Number,
default: 300
},
/**
* @description displayed text while loading data from server, default is 'Loading'
*/
loadingText: String,
/**
* @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'
*/
noMatchText: String,
/**
* @description displayed text when there is no options, you can also use slot `empty`, default is 'No data'
*/
noDataText: String,
/**
* @description function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true
*/
remoteMethod: {
type: runtime.definePropType(Function)
},
/**
* @description custom filter method, the first parameter is the current input value. To use this, `filterable` must be true
*/
filterMethod: {
type: runtime.definePropType(Function)
},
/**
* @description whether multiple-select is activated
*/
multiple: Boolean,
/**
* @description maximum number of options user can select when `multiple` is `true`. No limit when set to 0
*/
multipleLimit: {
type: Number,
default: 0
},
/**
* @description placeholder, default is 'Select'
*/
placeholder: {
type: String
},
/**
* @description select first matching option on enter key. Use with `filterable` or `remote`
*/
defaultFirstOption: Boolean,
/**
* @description when `multiple` and `filter` is true, whether to reserve current keyword after selecting an option
*/
reserveKeyword: {
type: Boolean,
default: true
},
/**
* @description unique identity key name for value, required when value is an object
*/
valueKey: {
type: String,
default: "value"
},
/**
* @description whether to collapse tags to a text when multiple selecting
*/
collapseTags: Boolean,
/**
* @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true
*/
collapseTagsTooltip: Boolean,
/**
* @description the max tags number to be shown. To use this, `collapse-tags` must be true
*/
maxCollapseTags: {
type: Number,
default: 1
},
/**
* @description whether select dropdown is teleported, if `true` it will be teleported to where `append-to` sets
*/
teleported: content.useTooltipContentProps.teleported,
/**
* @description when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed
*/
persistent: {
type: Boolean,
default: true
},
/**
* @description custom clear icon component
*/
clearIcon: {
type: icon.iconPropType,
default: iconsVue.CircleClose
},
/**
* @description whether the width of the dropdown is the same as the input
*/
fitInputWidth: Boolean,
/**
* @description custom suffix icon component
*/
suffixIcon: {
type: icon.iconPropType,
default: iconsVue.ArrowDown
},
/**
* @description tag type
*/
tagType: { ...tag.tagProps.type, default: "info" },
/**
* @description tag effect
*/
tagEffect: { ...tag.tagProps.effect, default: "light" },
/**
* @description whether to trigger form validation
*/
validateEvent: {
type: Boolean,
default: true
},
/**
* @description in remote search method show suffix icon
*/
remoteShowSuffix: Boolean,
/**
* @description determines whether the arrow is displayed
*/
showArrow: {
type: Boolean,
default: true
},
/**
* @description offset of the dropdown
*/
offset: {
type: Number,
default: 12
},
/**
* @description position of dropdown
*/
placement: {
type: runtime.definePropType(String),
values: core.placements,
default: "bottom-start"
},
/**
* @description list of possible positions for dropdown
*/
fallbackPlacements: {
type: runtime.definePropType(Array),
default: ["bottom-start", "top-start", "right", "left"]
},
/**
* @description tabindex for input
*/
tabindex: {
type: [String, Number],
default: 0
},
/**
* @description which element the selection dropdown appends to
*/
appendTo: content.useTooltipContentProps.appendTo,
options: {
type: runtime.definePropType(Array)
},
props: {
type: runtime.definePropType(Object),
default: () => useProps.defaultProps
},
...index$1.useEmptyValuesProps,
...index.useAriaProps(["ariaLabel"])
});
const selectEmits = {
[event.UPDATE_MODEL_EVENT]: (val) => true,
[event.CHANGE_EVENT]: (val) => true,
"popup-scroll": scrollbar.scrollbarEmits.scroll,
"remove-tag": (val) => true,
"visible-change": (visible) => true,
focus: (evt) => evt instanceof FocusEvent,
blur: (evt) => evt instanceof FocusEvent,
clear: () => true
};
exports.selectEmits = selectEmits;
exports.selectProps = selectProps;
//# sourceMappingURL=select.js.map