vue-multiselect
Advanced tools
Comparing version 3.0.0-alpha.2 to 3.0.0-beta.1
@@ -312,2 +312,11 @@ import { openBlock, createBlock, withKeys, withModifiers, renderSlot, createVNode, withDirectives, Fragment, renderList, toDisplayString, vShow, createCommentVNode, Transition, withCtx, createTextVNode } from 'vue'; | ||
default: false | ||
}, | ||
/** | ||
* Prevent autofocus | ||
* @default false | ||
* @type {Boolean} | ||
*/ | ||
preventAutofocus: { | ||
type: Boolean, | ||
default: false | ||
} | ||
@@ -523,4 +532,2 @@ }, | ||
this.$emit('select', option, this.id); | ||
if (this.multiple) { | ||
@@ -532,2 +539,4 @@ this.$emit('update:modelValue', this.internalValue.concat([option])); | ||
this.$emit('select', option, this.id); | ||
/* istanbul ignore else */ | ||
@@ -561,6 +570,11 @@ if (this.clearOnSelect) this.search = ''; | ||
} else { | ||
const optionsToAdd = group[this.groupValues].filter( | ||
(option) => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
let optionsToAdd = group[this.groupValues].filter( | ||
option => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
); | ||
// if max is defined then just select options respecting max | ||
if (this.max) { | ||
optionsToAdd.splice(this.max - this.internalValue.length); | ||
} | ||
this.$emit('select', optionsToAdd, this.id); | ||
@@ -615,3 +629,2 @@ this.$emit( | ||
this.$emit('remove', option, this.id); | ||
if (this.multiple) { | ||
@@ -623,2 +636,3 @@ const newValue = this.internalValue.slice(0, index).concat(this.internalValue.slice(index + 1)); | ||
} | ||
this.$emit('remove', option, this.id); | ||
@@ -660,5 +674,5 @@ /* istanbul ignore else */ | ||
if (!this.preserveSearch) this.search = ''; | ||
this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else { | ||
this.$el.focus(); | ||
if (!this.preventAutofocus) this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else if (!this.preventAutofocus) { | ||
if (typeof this.$el !== 'undefined') this.$el.focus(); | ||
} | ||
@@ -678,5 +692,5 @@ this.$emit('open', this.id); | ||
if (this.searchable) { | ||
this.$refs.search && this.$refs.search.blur(); | ||
if (typeof this.$refs.search !== 'undefined') this.$refs.search.blur(); | ||
} else { | ||
this.$el.blur(); | ||
if (typeof this.$el !== 'undefined') this.$el.blur(); | ||
} | ||
@@ -1016,2 +1030,5 @@ if (!this.preserveSearch) this.search = ''; | ||
computed: { | ||
hasOptionGroup () { | ||
return this.groupValues && this.groupLabel && this.groupSelect | ||
}, | ||
isSingleLabelVisible () { | ||
@@ -1105,3 +1122,3 @@ return ( | ||
tabindex: _ctx.searchable ? -1 : $props.tabindex, | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove }, "multiselect"], | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove, 'multiselect--has-options-group': $options.hasOptionGroup }, "multiselect"], | ||
onFocus: _cache[14] || (_cache[14] = $event => (_ctx.activate())), | ||
@@ -1318,3 +1335,3 @@ onBlur: _cache[15] || (_cache[15] = $event => (_ctx.searchable ? false : _ctx.deactivate())), | ||
], 512 /* NEED_PATCH */), [ | ||
[vShow, $props.showNoOptions && (_ctx.options.length === 0 && !_ctx.search && !$props.loading)] | ||
[vShow, $props.showNoOptions && ((_ctx.options.length === 0 || ($options.hasOptionGroup === true && _ctx.filteredOptions.length === 0)) && !_ctx.search && !$props.loading)] | ||
]), | ||
@@ -1321,0 +1338,0 @@ renderSlot(_ctx.$slots, "afterList") |
@@ -1,2 +0,2 @@ | ||
(function (exports, vue) { | ||
var VueMultiselect = (function (exports, vue) { | ||
'use strict'; | ||
@@ -313,2 +313,11 @@ | ||
default: false | ||
}, | ||
/** | ||
* Prevent autofocus | ||
* @default false | ||
* @type {Boolean} | ||
*/ | ||
preventAutofocus: { | ||
type: Boolean, | ||
default: false | ||
} | ||
@@ -524,4 +533,2 @@ }, | ||
this.$emit('select', option, this.id); | ||
if (this.multiple) { | ||
@@ -533,2 +540,4 @@ this.$emit('update:modelValue', this.internalValue.concat([option])); | ||
this.$emit('select', option, this.id); | ||
/* istanbul ignore else */ | ||
@@ -562,6 +571,11 @@ if (this.clearOnSelect) this.search = ''; | ||
} else { | ||
const optionsToAdd = group[this.groupValues].filter( | ||
(option) => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
let optionsToAdd = group[this.groupValues].filter( | ||
option => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
); | ||
// if max is defined then just select options respecting max | ||
if (this.max) { | ||
optionsToAdd.splice(this.max - this.internalValue.length); | ||
} | ||
this.$emit('select', optionsToAdd, this.id); | ||
@@ -616,3 +630,2 @@ this.$emit( | ||
this.$emit('remove', option, this.id); | ||
if (this.multiple) { | ||
@@ -624,2 +637,3 @@ const newValue = this.internalValue.slice(0, index).concat(this.internalValue.slice(index + 1)); | ||
} | ||
this.$emit('remove', option, this.id); | ||
@@ -661,5 +675,5 @@ /* istanbul ignore else */ | ||
if (!this.preserveSearch) this.search = ''; | ||
this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else { | ||
this.$el.focus(); | ||
if (!this.preventAutofocus) this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else if (!this.preventAutofocus) { | ||
if (typeof this.$el !== 'undefined') this.$el.focus(); | ||
} | ||
@@ -679,5 +693,5 @@ this.$emit('open', this.id); | ||
if (this.searchable) { | ||
this.$refs.search && this.$refs.search.blur(); | ||
if (typeof this.$refs.search !== 'undefined') this.$refs.search.blur(); | ||
} else { | ||
this.$el.blur(); | ||
if (typeof this.$el !== 'undefined') this.$el.blur(); | ||
} | ||
@@ -1017,2 +1031,5 @@ if (!this.preserveSearch) this.search = ''; | ||
computed: { | ||
hasOptionGroup () { | ||
return this.groupValues && this.groupLabel && this.groupSelect | ||
}, | ||
isSingleLabelVisible () { | ||
@@ -1106,3 +1123,3 @@ return ( | ||
tabindex: _ctx.searchable ? -1 : $props.tabindex, | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove }, "multiselect"], | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove, 'multiselect--has-options-group': $options.hasOptionGroup }, "multiselect"], | ||
onFocus: _cache[14] || (_cache[14] = $event => (_ctx.activate())), | ||
@@ -1319,3 +1336,3 @@ onBlur: _cache[15] || (_cache[15] = $event => (_ctx.searchable ? false : _ctx.deactivate())), | ||
], 512 /* NEED_PATCH */), [ | ||
[vue.vShow, $props.showNoOptions && (_ctx.options.length === 0 && !_ctx.search && !$props.loading)] | ||
[vue.vShow, $props.showNoOptions && ((_ctx.options.length === 0 || ($options.hasOptionGroup === true && _ctx.filteredOptions.length === 0)) && !_ctx.search && !$props.loading)] | ||
]), | ||
@@ -1344,2 +1361,2 @@ vue.renderSlot(_ctx.$slots, "afterList") | ||
}({}, vue)); | ||
}({}, Vue)); |
@@ -316,2 +316,11 @@ 'use strict'; | ||
default: false | ||
}, | ||
/** | ||
* Prevent autofocus | ||
* @default false | ||
* @type {Boolean} | ||
*/ | ||
preventAutofocus: { | ||
type: Boolean, | ||
default: false | ||
} | ||
@@ -527,4 +536,2 @@ }, | ||
this.$emit('select', option, this.id); | ||
if (this.multiple) { | ||
@@ -536,2 +543,4 @@ this.$emit('update:modelValue', this.internalValue.concat([option])); | ||
this.$emit('select', option, this.id); | ||
/* istanbul ignore else */ | ||
@@ -565,6 +574,11 @@ if (this.clearOnSelect) this.search = ''; | ||
} else { | ||
const optionsToAdd = group[this.groupValues].filter( | ||
(option) => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
let optionsToAdd = group[this.groupValues].filter( | ||
option => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
); | ||
// if max is defined then just select options respecting max | ||
if (this.max) { | ||
optionsToAdd.splice(this.max - this.internalValue.length); | ||
} | ||
this.$emit('select', optionsToAdd, this.id); | ||
@@ -619,3 +633,2 @@ this.$emit( | ||
this.$emit('remove', option, this.id); | ||
if (this.multiple) { | ||
@@ -627,2 +640,3 @@ const newValue = this.internalValue.slice(0, index).concat(this.internalValue.slice(index + 1)); | ||
} | ||
this.$emit('remove', option, this.id); | ||
@@ -664,5 +678,5 @@ /* istanbul ignore else */ | ||
if (!this.preserveSearch) this.search = ''; | ||
this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else { | ||
this.$el.focus(); | ||
if (!this.preventAutofocus) this.$nextTick(() => this.$refs.search && this.$refs.search.focus()); | ||
} else if (!this.preventAutofocus) { | ||
if (typeof this.$el !== 'undefined') this.$el.focus(); | ||
} | ||
@@ -682,5 +696,5 @@ this.$emit('open', this.id); | ||
if (this.searchable) { | ||
this.$refs.search && this.$refs.search.blur(); | ||
if (typeof this.$refs.search !== 'undefined') this.$refs.search.blur(); | ||
} else { | ||
this.$el.blur(); | ||
if (typeof this.$el !== 'undefined') this.$el.blur(); | ||
} | ||
@@ -1020,2 +1034,5 @@ if (!this.preserveSearch) this.search = ''; | ||
computed: { | ||
hasOptionGroup () { | ||
return this.groupValues && this.groupLabel && this.groupSelect | ||
}, | ||
isSingleLabelVisible () { | ||
@@ -1109,3 +1126,3 @@ return ( | ||
tabindex: _ctx.searchable ? -1 : $props.tabindex, | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove }, "multiselect"], | ||
class: [{ 'multiselect--active': _ctx.isOpen, 'multiselect--disabled': $props.disabled, 'multiselect--above': $options.isAbove, 'multiselect--has-options-group': $options.hasOptionGroup }, "multiselect"], | ||
onFocus: _cache[14] || (_cache[14] = $event => (_ctx.activate())), | ||
@@ -1322,3 +1339,3 @@ onBlur: _cache[15] || (_cache[15] = $event => (_ctx.searchable ? false : _ctx.deactivate())), | ||
], 512 /* NEED_PATCH */), [ | ||
[vue.vShow, $props.showNoOptions && (_ctx.options.length === 0 && !_ctx.search && !$props.loading)] | ||
[vue.vShow, $props.showNoOptions && ((_ctx.options.length === 0 || ($options.hasOptionGroup === true && _ctx.filteredOptions.length === 0)) && !_ctx.search && !$props.loading)] | ||
]), | ||
@@ -1325,0 +1342,0 @@ vue.renderSlot(_ctx.$slots, "afterList") |
{ | ||
"name": "vue-multiselect", | ||
"version": "3.0.0-alpha.2", | ||
"version": "3.0.0-beta.1", | ||
"private": false, | ||
"types": "index.d.ts", | ||
"description": "Multiselect component for Vue 3", | ||
@@ -24,3 +25,4 @@ "author": { | ||
"dist", | ||
"src" | ||
"src", | ||
"index.d.ts" | ||
], | ||
@@ -27,0 +29,0 @@ "devDependencies": { |
@@ -11,17 +11,14 @@ # vue-multiselect | ||
### Gold | ||
<p align="center"> | ||
<a href="https://vuejs.amsterdam/?utm_source=newsletter&utm_medium=logo&utm_campaign=vuejs-newsletter" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/793583797454503976/793583831369646120/vuejsamsterdam.png" alt="Vuejs Amsterdam" width="380px"> | ||
<a href="https://getform.io/" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/1002927810710605875/1034915542596845728/getform.png" alt="Get Form" width="240px"> | ||
</a> | ||
</p> | ||
<p align="center"> | ||
<a href="https://theroadtoenterprise.com/?utm_source=newsletter&utm_medium=logo&utm_campaign=vuejs-newsletter" target="_blank"> | ||
<img src="https://cdn.discordapp.com/attachments/793583797454503976/809062891420123166/logo.png" alt="Vue - The Road To Enterprise" width="380px"> | ||
<a href="https://suade.org/" target="_blank"> | ||
<img src="https://tinyurl.com/suadelogo" alt="Suade Labs" width="200px"> | ||
</a> | ||
</p> | ||
### Silver | ||
<p align="center"> | ||
@@ -33,4 +30,2 @@ <a href="https://www.storyblok.com/developers?utm_source=newsletter&utm_medium=logo&utm_campaign=vuejs-newsletter" target="_blank"> | ||
### Bronze | ||
<p align="center"> | ||
@@ -157,5 +152,5 @@ <a href="https://www.vuemastery.com/" target="_blank"> | ||
> | ||
<span slot="noResult"> | ||
<template #noResult> | ||
Oops! No elements found. Consider changing the search query. | ||
</span> | ||
</template> | ||
</VueMultiselect> | ||
@@ -162,0 +157,0 @@ ``` |
@@ -310,2 +310,11 @@ function isEmpty (opt) { | ||
default: false | ||
}, | ||
/** | ||
* Prevent autofocus | ||
* @default false | ||
* @type {Boolean} | ||
*/ | ||
preventAutofocus: { | ||
type: Boolean, | ||
default: false | ||
} | ||
@@ -521,4 +530,2 @@ }, | ||
this.$emit('select', option, this.id) | ||
if (this.multiple) { | ||
@@ -530,2 +537,4 @@ this.$emit('update:modelValue', this.internalValue.concat([option])) | ||
this.$emit('select', option, this.id) | ||
/* istanbul ignore else */ | ||
@@ -559,6 +568,11 @@ if (this.clearOnSelect) this.search = '' | ||
} else { | ||
const optionsToAdd = group[this.groupValues].filter( | ||
(option) => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
let optionsToAdd = group[this.groupValues].filter( | ||
option => !(this.isOptionDisabled(option) || this.isSelected(option)) | ||
) | ||
// if max is defined then just select options respecting max | ||
if (this.max) { | ||
optionsToAdd.splice(this.max - this.internalValue.length) | ||
} | ||
this.$emit('select', optionsToAdd, this.id) | ||
@@ -613,3 +627,2 @@ this.$emit( | ||
this.$emit('remove', option, this.id) | ||
if (this.multiple) { | ||
@@ -621,2 +634,3 @@ const newValue = this.internalValue.slice(0, index).concat(this.internalValue.slice(index + 1)) | ||
} | ||
this.$emit('remove', option, this.id) | ||
@@ -658,5 +672,5 @@ /* istanbul ignore else */ | ||
if (!this.preserveSearch) this.search = '' | ||
this.$nextTick(() => this.$refs.search && this.$refs.search.focus()) | ||
} else { | ||
this.$el.focus() | ||
if (!this.preventAutofocus) this.$nextTick(() => this.$refs.search && this.$refs.search.focus()) | ||
} else if (!this.preventAutofocus) { | ||
if (typeof this.$el !== 'undefined') this.$el.focus() | ||
} | ||
@@ -676,5 +690,5 @@ this.$emit('open', this.id) | ||
if (this.searchable) { | ||
this.$refs.search && this.$refs.search.blur() | ||
if (typeof this.$refs.search !== 'undefined') this.$refs.search.blur() | ||
} else { | ||
this.$el.blur() | ||
if (typeof this.$el !== 'undefined') this.$el.blur() | ||
} | ||
@@ -681,0 +695,0 @@ if (!this.preserveSearch) this.search = '' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1134575
21
13353
180
7