From e626c0c338b6d3906b971b306813f6faeda28b78 Mon Sep 17 00:00:00 2001 From: Adam Berecz Date: Thu, 16 Dec 2021 17:12:29 +0100 Subject: [PATCH] chore: build, release 2.3.0 --- CHANGELOG.md | 21 +++++++ README.md | 100 +++++++++++++++++++++----------- dist/multiselect.global.js | 2 +- dist/multiselect.js | 2 +- dist/multiselect.vue2.global.js | 2 +- dist/multiselect.vue2.js | 2 +- package.json | 5 +- themes/default.css | 2 +- themes/tailwind.css | 2 +- 9 files changed, 98 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bf93ac..435b2fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +## v2.3.0 + +> `2021-12-16` + +### 🎉 Feature + - **Deprecated:** `appendNewTag`, `createTag`, `addTagOn` props and `@tag` event. + - Added `appendNewOption`, `createOption`, `addOptionOn` props and `@option` event [#150](https://github.com/vueform/multiselect/issues/150). + - Added `selectAll` method [#172](https://github.com/vueform/multiselect/issues/172). + - The `trackBy` prop now defaults to `label` [#175](https://github.com/vueform/multiselect/issues/175). + - Replaces focus on search when an option is selected [#163](https://github.com/vueform/multiselect/issues/163). + - Added `` wrapper for single label with `singleLabelText` class key [#157](https://github.com/vueform/multiselect/issues/157). + +### 🐞 Bug Fixes + - Don't show spinner when not active [#156](https://github.com/vueform/multiselect/issues/156). + - TailwindCSS 3 compatibility issue fix [#176](https://github.com/vueform/multiselect/issues/176). + - Don't show caret when `showOptions` are disabled [#173](https://github.com/vueform/multiselect/issues/173). + - Resolved headless UI modal click issue [#148](https://github.com/vueform/multiselect/issues/148). + - Resolved TailwindCSS/form ring issue [#135](https://github.com/vueform/multiselect/issues/135). + - Made classes reactive [#126](https://github.com/vueform/multiselect/issues/126). + - The `addTagOn` prop uses `key` instead of `keyCode` internally [#125](https://github.com/vueform/multiselect/issues/125). + ## v2.2.1 > `2021-11-23` diff --git a/README.md b/README.md index d3bafe6..a888fc2 100644 --- a/README.md +++ b/README.md @@ -89,13 +89,43 @@ Learn more: [https://vueform.com](https://vueform.com) * Custom slots * Events * CSS vars support -* Tailwind & utility class support +* **Tailwind** & utility class support * Fully configurable * CSP compilant +## Sections + +* [Demo](#demo) +* [Installation](#installation) + * [Using with Vue 3](#using-with-vue-3) + * [Using with Vue 2](#using-with-vue-2) + * [Using with Nuxt.js](#using-with-nuxtjs) +* [Support](#support) +* [Configuration](#configuration) + * [Basic props](#basic-props) + * [Advanced props](#advanced-props) +* [API](#api) +* [Events](#events) +* [Slots](#slots) +* [Styling](#styling) + * [Styling with CSS vars](#styling-with-css-vars) + * [Styling with Tailwind CSS](#styling-with-tailwind-css) +* [Examples](#examples) + * [Single select](#single-select) + * [Multiselect with object options](#multiselect-with-object-options) + * [Multiselect with disabled options](#multiselect-with-disabled-options) + * [Multiselect with groups](#multiselect-with-groups) + * [Tags with search, create and array of objects options](#tags-with-search-create-and-array-of-objects-options) + * [Autocomplete with async options](#autocomplete-with-async-options) + * [Tags with async options](#tags-with-async-options) + * [Select with custom options slot](#select-with-custom-options-slot) + * [Multiselect with custom label slot](#multiselect-with-custom-label-slot) + * [Tags with custom tags slot](#tags-with-custom-tags-slot) +* [License](#license) + ## Demo -Check out our demo. +Check out our demo. ## Installation @@ -191,7 +221,9 @@ For more information on using `@nuxtjs/composition-api` read [their documentatio Join our [Discord channel](https://discord.gg/WhX2nG6GTQ) or [open an issue](https://github.com/vueform/multiselect/issues). -## Basic props +## Configuration + +### Basic props | Name | Type | Default | Description | | --- | --- | --- | --- | @@ -327,7 +359,9 @@ mounted() { > Note: we don't use camelCase because they are [normalized back to lowercase](https://github.com/vuejs/vue/issues/9449#issuecomment-461170017) when written in DOM. -## Styling with CSS vars +## Styling + +### Styling with CSS vars The following CSS variables can be used to customize multiselect when using `default.css`: @@ -448,7 +482,7 @@ Or on an instance level: } ``` -## Styling with Tailwind CSS +### Styling with Tailwind CSS To use `Multiselect` with Tailwind CSS first you need to add background images to `tailwind.config.js`: @@ -489,12 +523,12 @@ Then you need to import `themes/tailwind.scss` to you main component: // ... - + ``` -### Using `:classes` prop +#### Using `:classes` prop Alternatively you can define class names directly by passing them to the `Multiselect` component via `classes` property. When using this approach you don't need to import `tailwind.scss`. Here's a default styling for Tailwind CSS (the same included in `tailwind.scss`): @@ -579,7 +613,7 @@ In case you need to override the same type of utility you might use [@neojp/tail /> ``` -JSFiddle - Example #1 +JSFiddle - Example #1 ### Multiselect with object options @@ -587,7 +621,7 @@ In case you need to override the same type of utility you might use [@neojp/tail JSFiddle - Example #2 +JSFiddle - Example #2 ### Multiselect with disabled options @@ -604,7 +638,7 @@ In case you need to override the same type of utility you might use [@neojp/tail JSFiddle - Example #3 +JSFiddle - Example #3 ### Multiselect with groups @@ -621,7 +655,7 @@ In case you need to override the same type of utility you might use [@neojp/tail JSFiddle - Example #4 +JSFiddle - Example #4 ### Tags with search, create and array of objects options @@ -644,9 +678,9 @@ In case you need to override the same type of utility you might use [@neojp/tail JSFiddle - Example #5 +JSFiddle - Example #5 ### Autocomplete with async options @@ -663,9 +697,9 @@ In case you need to override the same type of utility you might use [@neojp/tail JSFiddle - Example #6 +JSFiddle - Example #6 ### Tags with async options @@ -683,10 +717,10 @@ In case you need to override the same type of utility you might use [@neojp/tail v-model="value" mode="tags" placeholder="Choose your stack" - :closeOnSelect="false" - :filterResults="false" - :minChars="1" - :resolveOnLoad="false" + :close-on-select="false" + :filter-results="false" + :min-chars="1" + :resolve-on-load="false" :delay="0" :searchable="true" :options="async function(query) { @@ -695,7 +729,7 @@ In case you need to override the same type of utility you might use [@neojp/tail /> ``` -JSFiddle - Example #7 +JSFiddle - Example #7 ### Select with custom options slot @@ -723,7 +757,7 @@ In case you need to override the same type of utility you might use [@neojp/tail ``` -JSFiddle - Example #8 +JSFiddle - Example #8 ### Multiselect with custom label slot @@ -732,7 +766,7 @@ In case you need to override the same type of utility you might use [@neojp/tail v-model="value" mode="multiple" placeholder="Select your characters" - :closeOnSelect="false" + :close-on-select="false" :options="{ batman: 'Batman', robin: 'Robin', @@ -748,7 +782,7 @@ In case you need to override the same type of utility you might use [@neojp/tail ``` -JSFiddle - Example #9 +JSFiddle - Example #9 ### Tags with custom tags slot @@ -758,9 +792,9 @@ In case you need to override the same type of utility you might use [@neojp/tail v-model="value" mode="tags" placeholder="Select employees" - trackBy="name" + track-by="name" label="name" - :closeOnSelect="false" + :close-on-select="false" :search="true" :options="[ { value: 'judy', name: 'Judy', image: 'https://randomuser.me/api/portraits/med/women/1.jpg' }, @@ -814,7 +848,7 @@ In case you need to override the same type of utility you might use [@neojp/tail ``` -JSFiddle - Example #10 +JSFiddle - Example #10 ## License diff --git a/dist/multiselect.global.js b/dist/multiselect.global.js index 301a4ee..45d0bf8 100644 --- a/dist/multiselect.global.js +++ b/dist/multiselect.global.js @@ -1 +1 @@ -var VueformMultiselect=function(e,t){"use strict";function u(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function n(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,a)}return u}function r(e){for(var t=1;te.length)&&(t=e.length);for(var u=0,a=new Array(t);u1&&void 0!==arguments[1])||arguments[1];return t?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function s(t,n,o){var i=e.toRefs(t),s=i.options,d=i.mode,v=i.trackBy,p=i.limit,f=i.hideSelected,m=i.createTag,g=i.label,D=i.appendNewTag,h=i.multipleLabel,b=i.object,y=i.loading,C=i.delay,S=i.resolveOnLoad,B=i.minChars,F=i.filterResults,k=i.clearOnSearch,A=i.clearOnSelect,O=i.valueProp,E=i.canDeselect,L=i.max,V=i.strict,P=i.closeOnSelect,w=i.groups,N=(i.groupLabel,i.groupOptions),q=i.groupHideEmpty,x=i.groupSelect,T=o.iv,I=o.ev,_=o.search,j=o.clearSearch,R=o.update,M=o.pointer,$=o.clearPointer,H=o.blur,G=o.deactivate,K=e.ref([]),W=e.ref([]),U=e.ref(!1),z=e.computed((function(){if(w.value){var e=W.value||[],t=[];return e.forEach((function(e){ye(e[N.value]).forEach((function(u){t.push(Object.assign({},u,e.disabled?{disabled:!0}:{}))}))})),t}var u=ye(W.value||[]);return K.value.length&&(u=u.concat(K.value)),u})),J=e.computed((function(){return w.value?he((W.value||[]).map((function(e){var t,u=ye(e[N.value]);return r(r({},e),{},(l(t={group:!0},N.value,be(u,!1).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),l(t,"__VISIBLE__",be(u).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),t))}))):[]})),Q=e.computed((function(){var e=z.value;return te.value.length&&(e=te.value.concat(e)),e=be(e),p.value>0&&(e=e.slice(0,p.value)),e})),X=e.computed((function(){switch(d.value){case"single":return!u(T.value[O.value]);case"multiple":case"tags":return!u(T.value)&&T.value.length>0}})),Y=e.computed((function(){return void 0!==h&&void 0!==h.value?h.value(T.value):T.value&&T.value.length>1?"".concat(T.value.length," options selected"):"1 option selected"})),Z=e.computed((function(){return!z.value.length&&!U.value&&!te.value.length})),ee=e.computed((function(){return z.value.length>0&&0==Q.value.length&&(_.value&&w.value||!w.value)})),te=e.computed((function(){var e;return!1!==m.value&&_.value?-1!==me(_.value)?[]:[(e={},l(e,O.value,_.value),l(e,g.value,_.value),l(e,v.value,_.value),e)]:[]})),ue=e.computed((function(){switch(d.value){case"single":return null;case"multiple":case"tags":return[]}})),ae=e.computed((function(){return y.value||U.value})),le=function(e){switch("object"!==a(e)&&(e=fe(e)),d.value){case"single":R(e);break;case"multiple":case"tags":R(T.value.concat(e))}n.emit("select",re(e),e)},ne=function(e){switch("object"!==a(e)&&(e=fe(e)),d.value){case"single":ie();break;case"tags":case"multiple":R(Array.isArray(e)?T.value.filter((function(t){return-1===e.map((function(e){return e[O.value]})).indexOf(t[O.value])})):T.value.filter((function(t){return t[O.value]!=e[O.value]})))}n.emit("deselect",re(e),e)},re=function(e){return b.value?e:e[O.value]},oe=function(e){ne(e)},ie=function(){n.emit("clear"),R(ue.value)},ce=function(e){if(void 0!==e.group)return"single"!==d.value&&(pe(e[N.value])&&e[N.value].length);switch(d.value){case"single":return!u(T.value)&&T.value[O.value]==e[O.value];case"tags":case"multiple":return!u(T.value)&&-1!==T.value.map((function(e){return e[O.value]})).indexOf(e[O.value])}},se=function(e){return!0===e.disabled},de=function(){return!(void 0===L||-1===L.value||!X.value&&L.value>0)&&T.value.length>=L.value},ve=function(e){return void 0===e.find((function(e){return!ce(e)&&!e.disabled}))},pe=function(e){return void 0===e.find((function(e){return!ce(e)}))},fe=function(e){return z.value[z.value.map((function(e){return String(e[O.value])})).indexOf(String(e))]},me=function(e){return z.value.map((function(e){return e[v.value]})).indexOf(e)},ge=function(e){return-1!==["tags","multiple"].indexOf(d.value)&&f.value&&ce(e)},De=function(e){K.value.push(e)},he=function(e){return q.value?e.filter((function(e){return _.value?e.__VISIBLE__.length:e[N.value].length})):e.filter((function(e){return!_.value||e.__VISIBLE__.length}))},be=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=e;return _.value&&F.value&&(u=u.filter((function(e){return-1!==c(e[v.value],V.value).indexOf(c(_.value,V.value))}))),f.value&&t&&(u=u.filter((function(e){return!ge(e)}))),u},ye=function(e){var t,u=e;return t=u,"[object Object]"===Object.prototype.toString.call(t)&&(u=Object.keys(u).map((function(e){var t,a=u[e];return l(t={},O.value,e),l(t,v.value,a),l(t,g.value,a),t}))),u=u.map((function(e){var t;return"object"===a(e)?e:(l(t={},O.value,e),l(t,v.value,e),l(t,g.value,e),t)}))},Ce=function(){u(I.value)||(T.value=Be(I.value))},Se=function(e){U.value=!0,s.value(_.value).then((function(t){W.value=t,"function"==typeof e&&e(t),U.value=!1}))},Be=function(e){return u(e)?"single"===d.value?{}:[]:b.value?e:"single"===d.value?fe(e)||{}:e.filter((function(e){return!!fe(e)})).map((function(e){return fe(e)}))};if("single"!==d.value&&!u(I.value)&&!Array.isArray(I.value))throw new Error('v-model must be an array when using "'.concat(d.value,'" mode'));return s&&"function"==typeof s.value?S.value?Se(Ce):1==b.value&&Ce():(W.value=s.value,Ce()),C.value>-1&&e.watch(_,(function(e){e.length[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(t,a){const l=function(t,u){var a=e.toRefs(t),l=a.value,n=a.modelValue,r=a.mode,o=a.valueProp,i=e.ref("single"!==r.value?[]:{}),c=void 0!==u.expose?n:l,s=e.computed((function(){return"single"===r.value?i.value[o.value]:i.value.map((function(e){return e[o.value]}))})),d=e.computed((function(){return"single"!==r.value?i.value.map((function(e){return e[o.value]})).join(","):i.value[o.value]}));return{iv:i,internalValue:i,ev:c,externalValue:c,textValue:d,plainValue:s}}(t,a),n=function(t,u,a){var l=e.toRefs(t),n=l.groupSelect,r=l.mode,o=l.groups,i=e.ref(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===r.value||!n.value)||(i.value=e)};return{pointer:i,setPointer:c,clearPointer:function(){c(null)}}}(t),i=function(t,u,a){var l=e.toRefs(t).disabled,n=e.ref(!1);return{isOpen:n,open:function(){n.value||l.value||(n.value=!0,u.emit("open"))},close:function(){n.value&&(n.value=!1,u.emit("close"))}}}(t,a),c=function(t,u,a){var l=e.ref(null),n=e.ref(null);return e.watch(l,(function(e){u.emit("search-change",e)})),{search:l,input:n,clearSearch:function(){l.value=""},handleSearchInput:function(e){l.value=e.target.value},handlePaste:function(e){u.emit("paste",e)}}}(0,a),d=function(t,a,l){var n=e.toRefs(t),r=n.object,o=n.valueProp,i=n.mode,c=l.iv,s=function(e){return r.value||u(e)?e:Array.isArray(e)?e.map((function(e){return e[o.value]})):e[o.value]},d=function(e){return u(e)?"single"===i.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);a.emit("change",t),a.emit("input",t),a.emit("update:modelValue",t)}}}(t,a,{iv:l.iv}),v=function(t,u,a){var l=e.toRefs(t),n=l.searchable,r=l.disabled,o=a.input,i=a.open,c=a.close,s=a.clearSearch,d=e.ref(null),v=e.ref(!1),p=e.computed((function(){return n.value||r.value?-1:0})),f=function(){n.value&&o.value.blur(),d.value.blur()},m=function(){v.value=!1,setTimeout((function(){v.value||(c(),s())}),1)};return{multiselect:d,tabindex:p,isActive:v,blur:f,handleFocus:function(){n.value&&!r.value&&o.value.focus()},activate:function(){r.value||(v.value=!0,i())},deactivate:m,handleCaretClick:function(){m(),f()}}}(t,0,{input:c.input,open:i.open,close:i.close,clearSearch:c.clearSearch}),p=s(t,a,{ev:l.ev,iv:l.iv,search:c.search,clearSearch:c.clearSearch,update:d.update,pointer:n.pointer,clearPointer:n.clearPointer,blur:v.blur,deactivate:v.deactivate}),f=function(t,u,a){var l=e.toRefs(t),n=l.valueProp,r=l.showOptions,i=l.searchable,c=l.groupLabel,s=l.groups,d=l.mode,v=l.groupSelect,p=a.fo,f=a.fg,m=a.handleOptionClick,g=a.handleGroupClick,D=a.search,h=a.pointer,b=a.setPointer,y=a.clearPointer,C=a.multiselect,S=e.computed((function(){return p.value.filter((function(e){return!e.disabled}))})),B=e.computed((function(){return f.value.filter((function(e){return!e.disabled}))})),F=e.computed((function(){return"single"!==d.value&&v.value})),k=e.computed((function(){return h.value&&h.value.group})),A=e.computed((function(){return T(h.value)})),O=e.computed((function(){var e=k.value?h.value:T(h.value),t=B.value.map((function(e){return e[c.value]})).indexOf(e[c.value]),u=B.value[t-1];return void 0===u&&(u=L.value),u})),E=e.computed((function(){var e=B.value.map((function(e){return e.label})).indexOf(k.value?h.value[c.value]:T(h.value)[c.value])+1;return B.value.length<=e&&(e=0),B.value[e]})),L=e.computed((function(){return o(B.value).slice(-1)[0]})),V=e.computed((function(){return h.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),P=e.computed((function(){var e=A.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[n.value]})).indexOf(h.value[n.value])-1]})),w=e.computed((function(){var e=T(h.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[n.value]})).indexOf(h.value[n.value])+1]})),N=e.computed((function(){return o(O.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),q=e.computed((function(){return o(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),x=function(){b(S.value[0]||null)},T=function(e){return B.value.find((function(t){return-1!==t.__VISIBLE__.map((function(e){return e[n.value]})).indexOf(e[n.value])}))},I=function(){var e=C.value.querySelector("[data-pointed]");if(e){var t=e.parentElement.parentElement;s.value&&(t=k.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTope.activate&&e.activate(...t)),onFocusout:u[8]||(u[8]=(...t)=>e.deactivate&&e.deactivate(...t)),onKeydown:u[9]||(u[9]=(...t)=>e.handleKeydown&&e.handleKeydown(...t)),onFocus:u[10]||(u[10]=(...t)=>e.handleFocus&&e.handleFocus(...t))},[t.createCommentVNode(" Search "),"tags"!==a.mode&&a.searchable&&!a.disabled?(t.openBlock(),t.createBlock("input",{key:0,type:a.inputType,modelValue:e.search,value:e.search,class:e.classList.search,autocomplete:a.autocomplete,onInput:u[1]||(u[1]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[2]||(u[2]=t.withModifiers(((...t)=>e.handlePaste&&e.handlePaste(...t)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Tags (with search) "),"tags"==a.mode?(t.openBlock(),t.createBlock("div",{key:1,class:e.classList.tags},[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.iv,((u,l,n)=>t.renderSlot(e.$slots,"tag",{option:u,handleTagRemove:e.handleTagRemove,disabled:a.disabled},(()=>[(t.openBlock(),t.createBlock("span",{class:e.classList.tag,key:n},[t.createTextVNode(t.toDisplayString(u[a.label])+" ",1),a.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("span",{key:0,class:e.classList.tagRemove,onMousedown:t.withModifiers((t=>e.handleTagRemove(u,t)),["prevent"])},[t.createVNode("span",{class:e.classList.tagRemoveIcon},null,2)],42,["onMousedown"]))],2))])))),256)),t.createVNode("div",{class:e.classList.tagsSearchWrapper},[t.createCommentVNode(" Used for measuring search width "),t.createVNode("span",{class:e.classList.tagsSearchCopy},t.toDisplayString(e.search),3),t.createCommentVNode(" Actual search input "),a.searchable&&!a.disabled?(t.openBlock(),t.createBlock("input",{key:0,type:a.inputType,modelValue:e.search,value:e.search,class:e.classList.tagsSearch,autocomplete:a.autocomplete,onInput:u[3]||(u[3]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[4]||(u[4]=t.withModifiers(((...t)=>e.handlePaste&&e.handlePaste(...t)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):t.createCommentVNode("v-if",!0)],2)],2)):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Single label "),"single"==a.mode&&e.hasSelected&&!e.search&&e.iv?t.renderSlot(e.$slots,"singlelabel",{key:2,value:e.iv},(()=>[t.createVNode("div",{class:e.classList.singleLabel},t.toDisplayString(e.iv[a.label]),3)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Multiple label "),"multiple"==a.mode&&e.hasSelected&&!e.search?t.renderSlot(e.$slots,"multiplelabel",{key:3,values:e.iv},(()=>[t.createVNode("div",{class:e.classList.multipleLabel},t.toDisplayString(e.multipleLabelText),3)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Placeholder "),!a.placeholder||e.hasSelected||e.search?t.createCommentVNode("v-if",!0):t.renderSlot(e.$slots,"placeholder",{key:4},(()=>[t.createVNode("div",{class:e.classList.placeholder},t.toDisplayString(a.placeholder),3)])),t.createCommentVNode(" Spinner "),e.busy?t.renderSlot(e.$slots,"spinner",{key:5},(()=>[t.createVNode("span",{class:e.classList.spinner},null,2)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Clear "),e.hasSelected&&!a.disabled&&a.canClear&&!e.busy?t.renderSlot(e.$slots,"clear",{key:6,clear:e.clear},(()=>[t.createVNode("span",{class:e.classList.clear,onMousedown:u[5]||(u[5]=(...t)=>e.clear&&e.clear(...t))},[t.createVNode("span",{class:e.classList.clearIcon},null,2)],34)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Caret "),a.caret?t.renderSlot(e.$slots,"caret",{key:7},(()=>[t.createVNode("span",{class:e.classList.caret,onClick:u[6]||(u[6]=(...t)=>e.handleCaretClick&&e.handleCaretClick(...t))},null,2)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Options "),t.createVNode("div",{class:e.classList.dropdown,tabindex:"-1"},[t.renderSlot(e.$slots,"beforelist",{options:e.fo}),t.createVNode("ul",{class:e.classList.options},[a.groups?(t.openBlock(!0),t.createBlock(t.Fragment,{key:0},t.renderList(e.fg,((u,l,n)=>(t.openBlock(),t.createBlock("li",{class:e.classList.group,key:n},[t.createVNode("div",{class:e.classList.groupLabel(u),"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleGroupClick(u)},[t.renderSlot(e.$slots,"grouplabel",{group:u},(()=>[t.createVNode("span",null,t.toDisplayString(u[a.groupLabel]),1)]))],42,["data-pointed","onMouseenter","onClick"]),t.createVNode("ul",{class:e.classList.groupOptions},[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(u.__VISIBLE__,((l,n,r)=>(t.openBlock(),t.createBlock("li",{class:e.classList.option(l,u),key:r,"data-pointed":e.isPointed(l),onMouseenter:t=>e.setPointer(l),onClick:t=>e.handleOptionClick(l)},[t.renderSlot(e.$slots,"option",{option:l,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(l[a.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2)],2)))),128)):(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.fo,((u,l,n)=>(t.openBlock(),t.createBlock("li",{class:e.classList.option(u),key:n,"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleOptionClick(u)},[t.renderSlot(e.$slots,"option",{option:u,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(u[a.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2),e.noOptions?t.renderSlot(e.$slots,"nooptions",{key:0},(()=>[t.createVNode("div",{class:e.classList.noOptions,innerHTML:a.noOptionsText},null,10,["innerHTML"])])):t.createCommentVNode("v-if",!0),e.noResults?t.renderSlot(e.$slots,"noresults",{key:1},(()=>[t.createVNode("div",{class:e.classList.noResults,innerHTML:a.noResultsText},null,10,["innerHTML"])])):t.createCommentVNode("v-if",!0),t.renderSlot(e.$slots,"afterlist",{options:e.fo})],2),t.createCommentVNode(" Hacky input element to show HTML5 required warning "),a.required?(t.openBlock(),t.createBlock("input",{key:8,class:e.classList.fakeInput,tabindex:"-1",value:e.textValue,required:""},null,10,["value"])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Native input support "),a.nativeSupport?(t.openBlock(),t.createBlock(t.Fragment,{key:9},["single"==a.mode?(t.openBlock(),t.createBlock("input",{key:0,type:"hidden",name:a.name,value:void 0!==e.plainValue?e.plainValue:""},null,8,["name","value"])):(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.plainValue,((e,u)=>(t.openBlock(),t.createBlock("input",{type:"hidden",name:`${a.name}[]`,value:e,key:u},null,8,["name","value"])))),128))],64)):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Create height for empty input "),t.createVNode("div",{class:e.classList.spacer},null,2)],42,["tabindex","id"])},d.__file="src/Multiselect.vue",d}(Vue,Vue); +var VueformMultiselect=function(e,t){"use strict";function u(e){return-1!==[null,void 0,!1].indexOf(e)}function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t,u){return t in e?Object.defineProperty(e,t,{value:u,enumerable:!0,configurable:!0,writable:!0}):e[t]=u,e}function n(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,a)}return u}function r(e){for(var t=1;te.length)&&(t=e.length);for(var u=0,a=new Array(t);u1&&void 0!==arguments[1])||arguments[1];return t?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function s(t,n,o){var i=e.toRefs(t),s=i.options,d=i.mode,v=i.trackBy,p=i.limit,f=i.hideSelected,m=i.createTag,g=i.createOption,D=i.label,h=i.appendNewTag,b=i.appendNewOption,y=i.multipleLabel,C=i.object,B=i.loading,S=i.delay,F=i.resolveOnLoad,k=i.minChars,O=i.filterResults,A=i.clearOnSearch,E=i.clearOnSelect,L=i.valueProp,V=i.canDeselect,P=i.max,w=i.strict,N=i.closeOnSelect,q=i.groups,x=(i.groupLabel,i.groupOptions),T=i.groupHideEmpty,I=i.groupSelect,_=o.iv,j=o.ev,R=o.search,M=o.clearSearch,$=o.update,H=o.pointer,G=o.clearPointer,K=o.blur,W=o.focus,U=o.deactivate,z=e.ref([]),J=e.ref([]),Q=e.ref(!1),X=e.computed((function(){return m.value||g.value||!1})),Y=e.computed((function(){return void 0!==h.value?h.value:void 0===b.value||b.value})),Z=e.computed((function(){if(q.value){var e=J.value||[],t=[];return e.forEach((function(e){Ae(e[x.value]).forEach((function(u){t.push(Object.assign({},u,e.disabled?{disabled:!0}:{}))}))})),t}var u=Ae(J.value||[]);return z.value.length&&(u=u.concat(z.value)),u})),ee=e.computed((function(){return q.value?ke((J.value||[]).map((function(e){var t,u=Ae(e[x.value]);return r(r({},e),{},(l(t={group:!0},x.value,Oe(u,!1).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),l(t,"__VISIBLE__",Oe(u).map((function(t){return Object.assign({},t,e.disabled?{disabled:!0}:{})}))),t))}))):[]})),te=e.computed((function(){var e=Z.value;return re.value.length&&(e=re.value.concat(e)),e=Oe(e),p.value>0&&(e=e.slice(0,p.value)),e})),ue=e.computed((function(){switch(d.value){case"single":return!u(_.value[L.value]);case"multiple":case"tags":return!u(_.value)&&_.value.length>0}})),ae=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(_.value):_.value&&_.value.length>1?"".concat(_.value.length," options selected"):"1 option selected"})),le=e.computed((function(){return!Z.value.length&&!Q.value&&!re.value.length})),ne=e.computed((function(){return Z.value.length>0&&0==te.value.length&&(R.value&&q.value||!q.value)})),re=e.computed((function(){var e;return!1!==X.value&&R.value?-1!==Be(R.value)?[]:[(e={},l(e,L.value,R.value),l(e,D.value,R.value),l(e,oe.value,R.value),e)]:[]})),oe=e.computed((function(){return v.value||D.value})),ie=e.computed((function(){switch(d.value){case"single":return null;case"multiple":case"tags":return[]}})),ce=e.computed((function(){return B.value||Q.value})),se=function(e){switch("object"!==a(e)&&(e=Ce(e)),d.value){case"single":$(e);break;case"multiple":case"tags":$(_.value.concat(e))}n.emit("select",ve(e),e)},de=function(e){switch("object"!==a(e)&&(e=Ce(e)),d.value){case"single":fe();break;case"tags":case"multiple":$(Array.isArray(e)?_.value.filter((function(t){return-1===e.map((function(e){return e[L.value]})).indexOf(t[L.value])})):_.value.filter((function(t){return t[L.value]!=e[L.value]})))}n.emit("deselect",ve(e),e)},ve=function(e){return C.value?e:e[L.value]},pe=function(e){de(e)},fe=function(){n.emit("clear"),$(ie.value)},me=function(e){if(void 0!==e.group)return"single"!==d.value&&(ye(e[x.value])&&e[x.value].length);switch(d.value){case"single":return!u(_.value)&&_.value[L.value]==e[L.value];case"tags":case"multiple":return!u(_.value)&&-1!==_.value.map((function(e){return e[L.value]})).indexOf(e[L.value])}},ge=function(e){return!0===e.disabled},De=function(){return!(void 0===P||-1===P.value||!ue.value&&P.value>0)&&_.value.length>=P.value},he=function(e){void 0===Ce(e[L.value])&&X.value&&(n.emit("tag",e[L.value]),n.emit("option",e[L.value]),Y.value&&Fe(e),M())},be=function(e){return void 0===e.find((function(e){return!me(e)&&!e.disabled}))},ye=function(e){return void 0===e.find((function(e){return!me(e)}))},Ce=function(e){return Z.value[Z.value.map((function(e){return String(e[L.value])})).indexOf(String(e))]},Be=function(e){return Z.value.map((function(e){return e[oe.value]})).indexOf(e)},Se=function(e){return-1!==["tags","multiple"].indexOf(d.value)&&f.value&&me(e)},Fe=function(e){z.value.push(e)},ke=function(e){return T.value?e.filter((function(e){return R.value?e.__VISIBLE__.length:e[x.value].length})):e.filter((function(e){return!R.value||e.__VISIBLE__.length}))},Oe=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=e;return R.value&&O.value&&(u=u.filter((function(e){return-1!==c(e[oe.value],w.value).indexOf(c(R.value,w.value))}))),f.value&&t&&(u=u.filter((function(e){return!Se(e)}))),u},Ae=function(e){var t,u=e;return t=u,"[object Object]"===Object.prototype.toString.call(t)&&(u=Object.keys(u).map((function(e){var t,a=u[e];return l(t={},L.value,e),l(t,oe.value,a),l(t,D.value,a),t}))),u=u.map((function(e){var t;return"object"===a(e)?e:(l(t={},L.value,e),l(t,oe.value,e),l(t,D.value,e),t)}))},Ee=function(){u(j.value)||(_.value=Ve(j.value))},Le=function(e){Q.value=!0,s.value(R.value).then((function(t){J.value=t,"function"==typeof e&&e(t),Q.value=!1}))},Ve=function(e){return u(e)?"single"===d.value?{}:[]:C.value?e:"single"===d.value?Ce(e)||{}:e.filter((function(e){return!!Ce(e)})).map((function(e){return Ce(e)}))};if("single"!==d.value&&!u(j.value)&&!Array.isArray(j.value))throw new Error('v-model must be an array when using "'.concat(d.value,'" mode'));return s&&"function"==typeof s.value?F.value?Le(Ee):1==C.value&&Ee():(J.value=s.value,Ee()),S.value>-1&&e.watch(R,(function(e){e.length[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(t,a){const l=function(t,u){var a=e.toRefs(t),l=a.value,n=a.modelValue,r=a.mode,o=a.valueProp,i=e.ref("single"!==r.value?[]:{}),c=void 0!==u.expose?n:l,s=e.computed((function(){return"single"===r.value?i.value[o.value]:i.value.map((function(e){return e[o.value]}))})),d=e.computed((function(){return"single"!==r.value?i.value.map((function(e){return e[o.value]})).join(","):i.value[o.value]}));return{iv:i,internalValue:i,ev:c,externalValue:c,textValue:d,plainValue:s}}(t,a),n=function(t,u,a){var l=e.toRefs(t),n=l.groupSelect,r=l.mode,o=l.groups,i=e.ref(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===r.value||!n.value)||(i.value=e)};return{pointer:i,setPointer:c,clearPointer:function(){c(null)}}}(t),i=function(t,u,a){var l=e.toRefs(t).disabled,n=e.ref(!1);return{isOpen:n,open:function(){n.value||l.value||(n.value=!0,u.emit("open"))},close:function(){n.value&&(n.value=!1,u.emit("close"))}}}(t,a),c=function(t,u,a){var l=e.ref(null),n=e.ref(null);return e.watch(l,(function(e){u.emit("search-change",e)})),{search:l,input:n,clearSearch:function(){l.value=""},handleSearchInput:function(e){l.value=e.target.value},handlePaste:function(e){u.emit("paste",e)}}}(0,a),d=function(t,a,l){var n=e.toRefs(t),r=n.object,o=n.valueProp,i=n.mode,c=l.iv,s=function(e){return r.value||u(e)?e:Array.isArray(e)?e.map((function(e){return e[o.value]})):e[o.value]},d=function(e){return u(e)?"single"===i.value?{}:[]:e};return{update:function(e){c.value=d(e);var t=s(e);a.emit("change",t),a.emit("input",t),a.emit("update:modelValue",t)}}}(t,a,{iv:l.iv}),v=function(t,u,a){var l=e.toRefs(t),n=l.searchable,r=l.disabled,o=a.input,i=a.open,c=a.close,s=a.clearSearch,d=e.ref(null),v=e.ref(!1),p=e.computed((function(){return n.value||r.value?-1:0})),f=function(){n.value&&o.value.blur(),d.value.blur()},m=function(){n.value&&!r.value&&o.value.focus()},g=function(){v.value=!1,setTimeout((function(){v.value||(c(),s())}),1)};return{multiselect:d,tabindex:p,isActive:v,blur:f,focus:m,handleFocus:function(){m()},activate:function(){r.value||(v.value=!0,i())},deactivate:g,handleCaretClick:function(){g(),f()}}}(t,0,{input:c.input,open:i.open,close:i.close,clearSearch:c.clearSearch}),p=s(t,a,{ev:l.ev,iv:l.iv,search:c.search,clearSearch:c.clearSearch,update:d.update,pointer:n.pointer,clearPointer:n.clearPointer,blur:v.blur,focus:v.focus,deactivate:v.deactivate}),f=function(t,u,a){var l=e.toRefs(t),n=l.valueProp,r=l.showOptions,i=l.searchable,c=l.groupLabel,s=l.groups,d=l.mode,v=l.groupSelect,p=a.fo,f=a.fg,m=a.handleOptionClick,g=a.handleGroupClick,D=a.search,h=a.pointer,b=a.setPointer,y=a.clearPointer,C=a.multiselect,B=e.computed((function(){return p.value.filter((function(e){return!e.disabled}))})),S=e.computed((function(){return f.value.filter((function(e){return!e.disabled}))})),F=e.computed((function(){return"single"!==d.value&&v.value})),k=e.computed((function(){return h.value&&h.value.group})),O=e.computed((function(){return T(h.value)})),A=e.computed((function(){var e=k.value?h.value:T(h.value),t=S.value.map((function(e){return e[c.value]})).indexOf(e[c.value]),u=S.value[t-1];return void 0===u&&(u=L.value),u})),E=e.computed((function(){var e=S.value.map((function(e){return e.label})).indexOf(k.value?h.value[c.value]:T(h.value)[c.value])+1;return S.value.length<=e&&(e=0),S.value[e]})),L=e.computed((function(){return o(S.value).slice(-1)[0]})),V=e.computed((function(){return h.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),P=e.computed((function(){var e=O.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[n.value]})).indexOf(h.value[n.value])-1]})),w=e.computed((function(){var e=T(h.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[n.value]})).indexOf(h.value[n.value])+1]})),N=e.computed((function(){return o(A.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),q=e.computed((function(){return o(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),x=function(){b(B.value[0]||null)},T=function(e){return S.value.find((function(t){return-1!==t.__VISIBLE__.map((function(e){return e[n.value]})).indexOf(e[n.value])}))},I=function(){var e=C.value.querySelector("[data-pointed]");if(e){var t=e.parentElement.parentElement;s.value&&(t=k.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTope.activate&&e.activate(...t)),onFocusout:u[8]||(u[8]=(...t)=>e.deactivate&&e.deactivate(...t)),onKeydown:u[9]||(u[9]=(...t)=>e.handleKeydown&&e.handleKeydown(...t)),onFocus:u[10]||(u[10]=(...t)=>e.handleFocus&&e.handleFocus(...t))},[t.createCommentVNode(" Search "),"tags"!==a.mode&&a.searchable&&!a.disabled?(t.openBlock(),t.createBlock("input",{key:0,type:a.inputType,modelValue:e.search,value:e.search,class:e.classList.search,autocomplete:a.autocomplete,onInput:u[1]||(u[1]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[2]||(u[2]=t.withModifiers(((...t)=>e.handlePaste&&e.handlePaste(...t)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Tags (with search) "),"tags"==a.mode?(t.openBlock(),t.createBlock("div",{key:1,class:e.classList.tags},[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(e.iv,((u,l,n)=>t.renderSlot(e.$slots,"tag",{option:u,handleTagRemove:e.handleTagRemove,disabled:a.disabled},(()=>[(t.openBlock(),t.createBlock("span",{class:e.classList.tag,key:n},[t.createTextVNode(t.toDisplayString(u[a.label])+" ",1),a.disabled?t.createCommentVNode("v-if",!0):(t.openBlock(),t.createBlock("span",{key:0,class:e.classList.tagRemove,onClick:t=>e.handleTagRemove(u,t)},[t.createVNode("span",{class:e.classList.tagRemoveIcon},null,2)],10,["onClick"]))],2))])))),256)),t.createVNode("div",{class:e.classList.tagsSearchWrapper},[t.createCommentVNode(" Used for measuring search width "),t.createVNode("span",{class:e.classList.tagsSearchCopy},t.toDisplayString(e.search),3),t.createCommentVNode(" Actual search input "),a.searchable&&!a.disabled?(t.openBlock(),t.createBlock("input",{key:0,type:a.inputType,modelValue:e.search,value:e.search,class:e.classList.tagsSearch,autocomplete:a.autocomplete,onInput:u[3]||(u[3]=(...t)=>e.handleSearchInput&&e.handleSearchInput(...t)),onPaste:u[4]||(u[4]=t.withModifiers(((...t)=>e.handlePaste&&e.handlePaste(...t)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):t.createCommentVNode("v-if",!0)],2)],2)):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Single label "),"single"==a.mode&&e.hasSelected&&!e.search&&e.iv?t.renderSlot(e.$slots,"singlelabel",{key:2,value:e.iv},(()=>[t.createVNode("div",{class:e.classList.singleLabel},[t.createVNode("span",{class:e.classList.singleLabelText},t.toDisplayString(e.iv[a.label]),3)],2)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Multiple label "),"multiple"==a.mode&&e.hasSelected&&!e.search?t.renderSlot(e.$slots,"multiplelabel",{key:3,values:e.iv},(()=>[t.createVNode("div",{class:e.classList.multipleLabel},t.toDisplayString(e.multipleLabelText),3)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Placeholder "),!a.placeholder||e.hasSelected||e.search?t.createCommentVNode("v-if",!0):t.renderSlot(e.$slots,"placeholder",{key:4},(()=>[t.createVNode("div",{class:e.classList.placeholder},t.toDisplayString(a.placeholder),3)])),t.createCommentVNode(" Spinner "),e.busy&&e.isActive?t.renderSlot(e.$slots,"spinner",{key:5},(()=>[t.createVNode("span",{class:e.classList.spinner},null,2)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Clear "),e.hasSelected&&!a.disabled&&a.canClear&&!e.busy?t.renderSlot(e.$slots,"clear",{key:6,clear:e.clear},(()=>[t.createVNode("span",{class:e.classList.clear,onMousedown:u[5]||(u[5]=(...t)=>e.clear&&e.clear(...t))},[t.createVNode("span",{class:e.classList.clearIcon},null,2)],34)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Caret "),a.caret&&a.showOptions?t.renderSlot(e.$slots,"caret",{key:7},(()=>[t.createVNode("span",{class:e.classList.caret,onClick:u[6]||(u[6]=(...t)=>e.handleCaretClick&&e.handleCaretClick(...t))},null,2)])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Options "),t.createVNode("div",{class:e.classList.dropdown,tabindex:"-1"},[t.renderSlot(e.$slots,"beforelist",{options:e.fo}),t.createVNode("ul",{class:e.classList.options},[a.groups?(t.openBlock(!0),t.createBlock(t.Fragment,{key:0},t.renderList(e.fg,((u,l,n)=>(t.openBlock(),t.createBlock("li",{class:e.classList.group,key:n},[t.createVNode("div",{class:e.classList.groupLabel(u),"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleGroupClick(u)},[t.renderSlot(e.$slots,"grouplabel",{group:u},(()=>[t.createVNode("span",null,t.toDisplayString(u[a.groupLabel]),1)]))],42,["data-pointed","onMouseenter","onClick"]),t.createVNode("ul",{class:e.classList.groupOptions},[(t.openBlock(!0),t.createBlock(t.Fragment,null,t.renderList(u.__VISIBLE__,((l,n,r)=>(t.openBlock(),t.createBlock("li",{class:e.classList.option(l,u),key:r,"data-pointed":e.isPointed(l),onMouseenter:t=>e.setPointer(l),onClick:t=>e.handleOptionClick(l)},[t.renderSlot(e.$slots,"option",{option:l,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(l[a.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2)],2)))),128)):(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.fo,((u,l,n)=>(t.openBlock(),t.createBlock("li",{class:e.classList.option(u),key:n,"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleOptionClick(u)},[t.renderSlot(e.$slots,"option",{option:u,search:e.search},(()=>[t.createVNode("span",null,t.toDisplayString(u[a.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2),e.noOptions?t.renderSlot(e.$slots,"nooptions",{key:0},(()=>[t.createVNode("div",{class:e.classList.noOptions,innerHTML:a.noOptionsText},null,10,["innerHTML"])])):t.createCommentVNode("v-if",!0),e.noResults?t.renderSlot(e.$slots,"noresults",{key:1},(()=>[t.createVNode("div",{class:e.classList.noResults,innerHTML:a.noResultsText},null,10,["innerHTML"])])):t.createCommentVNode("v-if",!0),t.renderSlot(e.$slots,"afterlist",{options:e.fo})],2),t.createCommentVNode(" Hacky input element to show HTML5 required warning "),a.required?(t.openBlock(),t.createBlock("input",{key:8,class:e.classList.fakeInput,tabindex:"-1",value:e.textValue,required:""},null,10,["value"])):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Native input support "),a.nativeSupport?(t.openBlock(),t.createBlock(t.Fragment,{key:9},["single"==a.mode?(t.openBlock(),t.createBlock("input",{key:0,type:"hidden",name:a.name,value:void 0!==e.plainValue?e.plainValue:""},null,8,["name","value"])):(t.openBlock(!0),t.createBlock(t.Fragment,{key:1},t.renderList(e.plainValue,((e,u)=>(t.openBlock(),t.createBlock("input",{type:"hidden",name:`${a.name}[]`,value:e,key:u},null,8,["name","value"])))),128))],64)):t.createCommentVNode("v-if",!0),t.createCommentVNode(" Create height for empty input "),t.createVNode("div",{class:e.classList.spacer},null,2)],42,["tabindex","id"])},d.__file="src/Multiselect.vue",d}(Vue,Vue); diff --git a/dist/multiselect.js b/dist/multiselect.js index be1f50d..5f2b323 100644 --- a/dist/multiselect.js +++ b/dist/multiselect.js @@ -1 +1 @@ -import{toRefs as e,ref as u,computed as t,watch as l,nextTick as a,openBlock as n,createBlock as r,createCommentVNode as i,withModifiers as o,Fragment as s,renderList as c,renderSlot as v,createTextVNode as p,toDisplayString as d,createVNode as f}from"vue";function g(e){return-1!==[null,void 0,!1].indexOf(e)}function b(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return u?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,u){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);u&&(l=l.filter((function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable}))),t.push.apply(t,l)}return t}function D(e){for(var u=1;u0&&(e=e.slice(0,v.value)),e})),ee=t((function(){switch(s.value){case"single":return!g(R.value[k.value]);case"multiple":case"tags":return!g(R.value)&&R.value.length>0}})),ue=t((function(){return void 0!==O&&void 0!==O.value?O.value(R.value):R.value&&R.value.length>1?"".concat(R.value.length," options selected"):"1 option selected"})),te=t((function(){return!X.value.length&&!Q.value&&!ae.value.length})),le=t((function(){return X.value.length>0&&0==Z.value.length&&($.value&&I.value||!I.value)})),ae=t((function(){var e;return!1!==d.value&&$.value?-1!==me($.value)?[]:[(e={},y(e,k.value,$.value),y(e,f.value,$.value),y(e,c.value,$.value),e)]:[]})),ne=t((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),re=t((function(){return C.value||Q.value})),ie=function(e){switch("object"!==h(e)&&(e=he(e)),s.value){case"single":N(e);break;case"multiple":case"tags":N(R.value.concat(e))}n.emit("select",se(e),e)},oe=function(e){switch("object"!==h(e)&&(e=he(e)),s.value){case"single":ve();break;case"tags":case"multiple":N(Array.isArray(e)?R.value.filter((function(u){return-1===e.map((function(e){return e[k.value]})).indexOf(u[k.value])})):R.value.filter((function(u){return u[k.value]!=e[k.value]})))}n.emit("deselect",se(e),e)},se=function(e){return F.value?e:e[k.value]},ce=function(e){oe(e)},ve=function(){n.emit("clear"),N(ne.value)},pe=function(e){if(void 0!==e.group)return"single"!==s.value&&(be(e[T.value])&&e[T.value].length);switch(s.value){case"single":return!g(R.value)&&R.value[k.value]==e[k.value];case"tags":case"multiple":return!g(R.value)&&-1!==R.value.map((function(e){return e[k.value]})).indexOf(e[k.value])}},de=function(e){return!0===e.disabled},fe=function(){return!(void 0===q||-1===q.value||!ee.value&&q.value>0)&&R.value.length>=q.value},ge=function(e){return void 0===e.find((function(e){return!pe(e)&&!e.disabled}))},be=function(e){return void 0===e.find((function(e){return!pe(e)}))},he=function(e){return X.value[X.value.map((function(e){return String(e[k.value])})).indexOf(String(e))]},me=function(e){return X.value.map((function(e){return e[c.value]})).indexOf(e)},De=function(e){return-1!==["tags","multiple"].indexOf(s.value)&&p.value&&pe(e)},ye=function(e){z.value.push(e)},Oe=function(e){return _.value?e.filter((function(e){return $.value?e.__VISIBLE__.length:e[T.value].length})):e.filter((function(e){return!$.value||e.__VISIBLE__.length}))},Fe=function(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e;return $.value&&B.value&&(t=t.filter((function(e){return-1!==b(e[c.value],j.value).indexOf(b($.value,j.value))}))),p.value&&u&&(t=t.filter((function(e){return!De(e)}))),t},Ce=function(e){var u,t=e;return u=t,"[object Object]"===Object.prototype.toString.call(u)&&(t=Object.keys(t).map((function(e){var u,l=t[e];return y(u={},k.value,e),y(u,c.value,l),y(u,f.value,l),u}))),t=t.map((function(e){var u;return"object"===h(e)?e:(y(u={},k.value,e),y(u,c.value,e),y(u,f.value,e),u)}))},Se=function(){g(M.value)||(R.value=Ee(M.value))},Ae=function(e){Q.value=!0,o.value($.value).then((function(u){J.value=u,"function"==typeof e&&e(u),Q.value=!1}))},Ee=function(e){return g(e)?"single"===s.value?{}:[]:F.value?e:"single"===s.value?he(e)||{}:e.filter((function(e){return!!he(e)})).map((function(e){return he(e)}))};if("single"!==s.value&&!g(M.value)&&!Array.isArray(M.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return o&&"function"==typeof o.value?A.value?Ae(Se):1==F.value&&Se():(J.value=o.value,Se()),S.value>-1&&l($,(function(e){e.lengthe.length)&&(u=e.length);for(var t=0,l=new Array(u);te.length)&&(u=e.length);for(var t=0,l=new Array(u);t[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(n,r){const i=function(l,a){var n=e(l),r=n.value,i=n.modelValue,o=n.mode,s=n.valueProp,c=u("single"!==o.value?[]:{}),v=void 0!==a.expose?i:r,p=t((function(){return"single"===o.value?c.value[s.value]:c.value.map((function(e){return e[s.value]}))})),d=t((function(){return"single"!==o.value?c.value.map((function(e){return e[s.value]})).join(","):c.value[s.value]}));return{iv:c,internalValue:c,ev:v,externalValue:v,textValue:d,plainValue:p}}(n,r),o=function(t,l,a){var n=e(t),r=n.groupSelect,i=n.mode,o=n.groups,s=u(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===i.value||!r.value)||(s.value=e)};return{pointer:s,setPointer:c,clearPointer:function(){c(null)}}}(n),s=function(t,l,a){var n=e(t).disabled,r=u(!1);return{isOpen:r,open:function(){r.value||n.value||(r.value=!0,l.emit("open"))},close:function(){r.value&&(r.value=!1,l.emit("close"))}}}(n,r),c=function(e,t,a){var n=u(null),r=u(null);return l(n,(function(e){t.emit("search-change",e)})),{search:n,input:r,clearSearch:function(){n.value=""},handleSearchInput:function(e){n.value=e.target.value},handlePaste:function(e){t.emit("paste",e)}}}(0,r),v=function(u,t,l){var a=e(u),n=a.object,r=a.valueProp,i=a.mode,o=l.iv,s=function(e){return n.value||g(e)?e:Array.isArray(e)?e.map((function(e){return e[r.value]})):e[r.value]},c=function(e){return g(e)?"single"===i.value?{}:[]:e};return{update:function(e){o.value=c(e);var u=s(e);t.emit("change",u),t.emit("input",u),t.emit("update:modelValue",u)}}}(n,r,{iv:i.iv}),p=function(l,a,n){var r=e(l),i=r.searchable,o=r.disabled,s=n.input,c=n.open,v=n.close,p=n.clearSearch,d=u(null),f=u(!1),g=t((function(){return i.value||o.value?-1:0})),b=function(){i.value&&s.value.blur(),d.value.blur()},h=function(){f.value=!1,setTimeout((function(){f.value||(v(),p())}),1)};return{multiselect:d,tabindex:g,isActive:f,blur:b,handleFocus:function(){i.value&&!o.value&&s.value.focus()},activate:function(){o.value||(f.value=!0,c())},deactivate:h,handleCaretClick:function(){h(),b()}}}(n,0,{input:c.input,open:s.open,close:s.close,clearSearch:c.clearSearch}),d=O(n,r,{ev:i.ev,iv:i.iv,search:c.search,clearSearch:c.clearSearch,update:v.update,pointer:o.pointer,clearPointer:o.clearPointer,blur:p.blur,deactivate:p.deactivate}),f=function(u,n,r){var i=e(u),o=i.valueProp,s=i.showOptions,c=i.searchable,v=i.groupLabel,p=i.groups,d=i.mode,f=i.groupSelect,g=r.fo,b=r.fg,h=r.handleOptionClick,m=r.handleGroupClick,D=r.search,y=r.pointer,O=r.setPointer,C=r.clearPointer,S=r.multiselect,A=t((function(){return g.value.filter((function(e){return!e.disabled}))})),E=t((function(){return b.value.filter((function(e){return!e.disabled}))})),B=t((function(){return"single"!==d.value&&f.value})),P=t((function(){return y.value&&y.value.group})),L=t((function(){return R(y.value)})),k=t((function(){var e=P.value?y.value:R(y.value),u=E.value.map((function(e){return e[v.value]})).indexOf(e[v.value]),t=E.value[u-1];return void 0===t&&(t=q.value),t})),w=t((function(){var e=E.value.map((function(e){return e.label})).indexOf(P.value?y.value[v.value]:R(y.value)[v.value])+1;return E.value.length<=e&&(e=0),E.value[e]})),q=t((function(){return F(E.value).slice(-1)[0]})),j=t((function(){return y.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),x=t((function(){var e=L.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(y.value[o.value])-1]})),I=t((function(){var e=R(y.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(y.value[o.value])+1]})),T=t((function(){return F(k.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),_=t((function(){return F(q.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),V=function(){O(A.value[0]||null)},R=function(e){return E.value.find((function(u){return-1!==u.__VISIBLE__.map((function(e){return e[o.value]})).indexOf(e[o.value])}))},M=function(){var e=S.value.querySelector("[data-pointed]");if(e){var u=e.parentElement.parentElement;p.value&&(u=P.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>u.clientHeight+u.scrollTop&&(u.scrollTop=e.offsetTop+e.offsetHeight-u.clientHeight),e.offsetTope.activate&&e.activate(...u)),onFocusout:u[8]||(u[8]=(...u)=>e.deactivate&&e.deactivate(...u)),onKeydown:u[9]||(u[9]=(...u)=>e.handleKeydown&&e.handleKeydown(...u)),onFocus:u[10]||(u[10]=(...u)=>e.handleFocus&&e.handleFocus(...u))},[i(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(n(),r("input",{key:0,type:t.inputType,modelValue:e.search,value:e.search,class:e.classList.search,autocomplete:t.autocomplete,onInput:u[1]||(u[1]=(...u)=>e.handleSearchInput&&e.handleSearchInput(...u)),onPaste:u[2]||(u[2]=o(((...u)=>e.handlePaste&&e.handlePaste(...u)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):i("v-if",!0),i(" Tags (with search) "),"tags"==t.mode?(n(),r("div",{key:1,class:e.classList.tags},[(n(!0),r(s,null,c(e.iv,((u,l,a)=>v(e.$slots,"tag",{option:u,handleTagRemove:e.handleTagRemove,disabled:t.disabled},(()=>[(n(),r("span",{class:e.classList.tag,key:a},[p(d(u[t.label])+" ",1),t.disabled?i("v-if",!0):(n(),r("span",{key:0,class:e.classList.tagRemove,onMousedown:o((t=>e.handleTagRemove(u,t)),["prevent"])},[f("span",{class:e.classList.tagRemoveIcon},null,2)],42,["onMousedown"]))],2))])))),256)),f("div",{class:e.classList.tagsSearchWrapper},[i(" Used for measuring search width "),f("span",{class:e.classList.tagsSearchCopy},d(e.search),3),i(" Actual search input "),t.searchable&&!t.disabled?(n(),r("input",{key:0,type:t.inputType,modelValue:e.search,value:e.search,class:e.classList.tagsSearch,autocomplete:t.autocomplete,onInput:u[3]||(u[3]=(...u)=>e.handleSearchInput&&e.handleSearchInput(...u)),onPaste:u[4]||(u[4]=o(((...u)=>e.handlePaste&&e.handlePaste(...u)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):i("v-if",!0)],2)],2)):i("v-if",!0),i(" Single label "),"single"==t.mode&&e.hasSelected&&!e.search&&e.iv?v(e.$slots,"singlelabel",{key:2,value:e.iv},(()=>[f("div",{class:e.classList.singleLabel},d(e.iv[t.label]),3)])):i("v-if",!0),i(" Multiple label "),"multiple"==t.mode&&e.hasSelected&&!e.search?v(e.$slots,"multiplelabel",{key:3,values:e.iv},(()=>[f("div",{class:e.classList.multipleLabel},d(e.multipleLabelText),3)])):i("v-if",!0),i(" Placeholder "),!t.placeholder||e.hasSelected||e.search?i("v-if",!0):v(e.$slots,"placeholder",{key:4},(()=>[f("div",{class:e.classList.placeholder},d(t.placeholder),3)])),i(" Spinner "),e.busy?v(e.$slots,"spinner",{key:5},(()=>[f("span",{class:e.classList.spinner},null,2)])):i("v-if",!0),i(" Clear "),e.hasSelected&&!t.disabled&&t.canClear&&!e.busy?v(e.$slots,"clear",{key:6,clear:e.clear},(()=>[f("span",{class:e.classList.clear,onMousedown:u[5]||(u[5]=(...u)=>e.clear&&e.clear(...u))},[f("span",{class:e.classList.clearIcon},null,2)],34)])):i("v-if",!0),i(" Caret "),t.caret?v(e.$slots,"caret",{key:7},(()=>[f("span",{class:e.classList.caret,onClick:u[6]||(u[6]=(...u)=>e.handleCaretClick&&e.handleCaretClick(...u))},null,2)])):i("v-if",!0),i(" Options "),f("div",{class:e.classList.dropdown,tabindex:"-1"},[v(e.$slots,"beforelist",{options:e.fo}),f("ul",{class:e.classList.options},[t.groups?(n(!0),r(s,{key:0},c(e.fg,((u,l,a)=>(n(),r("li",{class:e.classList.group,key:a},[f("div",{class:e.classList.groupLabel(u),"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleGroupClick(u)},[v(e.$slots,"grouplabel",{group:u},(()=>[f("span",null,d(u[t.groupLabel]),1)]))],42,["data-pointed","onMouseenter","onClick"]),f("ul",{class:e.classList.groupOptions},[(n(!0),r(s,null,c(u.__VISIBLE__,((l,a,i)=>(n(),r("li",{class:e.classList.option(l,u),key:i,"data-pointed":e.isPointed(l),onMouseenter:u=>e.setPointer(l),onClick:u=>e.handleOptionClick(l)},[v(e.$slots,"option",{option:l,search:e.search},(()=>[f("span",null,d(l[t.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2)],2)))),128)):(n(!0),r(s,{key:1},c(e.fo,((u,l,a)=>(n(),r("li",{class:e.classList.option(u),key:a,"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleOptionClick(u)},[v(e.$slots,"option",{option:u,search:e.search},(()=>[f("span",null,d(u[t.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2),e.noOptions?v(e.$slots,"nooptions",{key:0},(()=>[f("div",{class:e.classList.noOptions,innerHTML:t.noOptionsText},null,10,["innerHTML"])])):i("v-if",!0),e.noResults?v(e.$slots,"noresults",{key:1},(()=>[f("div",{class:e.classList.noResults,innerHTML:t.noResultsText},null,10,["innerHTML"])])):i("v-if",!0),v(e.$slots,"afterlist",{options:e.fo})],2),i(" Hacky input element to show HTML5 required warning "),t.required?(n(),r("input",{key:8,class:e.classList.fakeInput,tabindex:"-1",value:e.textValue,required:""},null,10,["value"])):i("v-if",!0),i(" Native input support "),t.nativeSupport?(n(),r(s,{key:9},["single"==t.mode?(n(),r("input",{key:0,type:"hidden",name:t.name,value:void 0!==e.plainValue?e.plainValue:""},null,8,["name","value"])):(n(!0),r(s,{key:1},c(e.plainValue,((e,u)=>(n(),r("input",{type:"hidden",name:`${t.name}[]`,value:e,key:u},null,8,["name","value"])))),128))],64)):i("v-if",!0),i(" Create height for empty input "),f("div",{class:e.classList.spacer},null,2)],42,["tabindex","id"])},L.__file="src/Multiselect.vue";export default L; +import{toRefs as e,ref as u,computed as t,watch as l,nextTick as a,openBlock as n,createBlock as r,createCommentVNode as i,withModifiers as o,Fragment as s,renderList as c,renderSlot as v,createTextVNode as p,toDisplayString as d,createVNode as f}from"vue";function g(e){return-1!==[null,void 0,!1].indexOf(e)}function b(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return u?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,u){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);u&&(l=l.filter((function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable}))),t.push.apply(t,l)}return t}function D(e){for(var u=1;u0&&(e=e.slice(0,v.value)),e})),ne=t((function(){switch(s.value){case"single":return!g($.value[q.value]);case"multiple":case"tags":return!g($.value)&&$.value.length>0}})),re=t((function(){return void 0!==C&&void 0!==C.value?C.value($.value):$.value&&$.value.length>1?"".concat($.value.length," options selected"):"1 option selected"})),ie=t((function(){return!te.value.length&&!Z.value&&!se.value.length})),oe=t((function(){return te.value.length>0&&0==ae.value.length&&(N.value&&_.value||!_.value)})),se=t((function(){var e;return!1!==ee.value&&N.value?-1!==Se(N.value)?[]:[(e={},y(e,q.value,N.value),y(e,m.value,N.value),y(e,ce.value,N.value),e)]:[]})),ce=t((function(){return c.value||m.value})),ve=t((function(){switch(s.value){case"single":return null;case"multiple":case"tags":return[]}})),pe=t((function(){return S.value||Z.value})),de=function(e){switch("object"!==h(e)&&(e=Ae(e)),s.value){case"single":K(e);break;case"multiple":case"tags":K($.value.concat(e))}n.emit("select",ge(e),e)},fe=function(e){switch("object"!==h(e)&&(e=Ae(e)),s.value){case"single":he();break;case"tags":case"multiple":K(Array.isArray(e)?$.value.filter((function(u){return-1===e.map((function(e){return e[q.value]})).indexOf(u[q.value])})):$.value.filter((function(u){return u[q.value]!=e[q.value]})))}n.emit("deselect",ge(e),e)},ge=function(e){return A.value?e:e[q.value]},be=function(e){fe(e)},he=function(){n.emit("clear"),K(ve.value)},me=function(e){if(void 0!==e.group)return"single"!==s.value&&(Ce(e[V.value])&&e[V.value].length);switch(s.value){case"single":return!g($.value)&&$.value[q.value]==e[q.value];case"tags":case"multiple":return!g($.value)&&-1!==$.value.map((function(e){return e[q.value]})).indexOf(e[q.value])}},De=function(e){return!0===e.disabled},ye=function(){return!(void 0===T||-1===T.value||!ne.value&&T.value>0)&&$.value.length>=T.value},Oe=function(e){void 0===Ae(e[q.value])&&ee.value&&(n.emit("tag",e[q.value]),n.emit("option",e[q.value]),ue.value&&Be(e),G())},Fe=function(e){return void 0===e.find((function(e){return!me(e)&&!e.disabled}))},Ce=function(e){return void 0===e.find((function(e){return!me(e)}))},Ae=function(e){return te.value[te.value.map((function(e){return String(e[q.value])})).indexOf(String(e))]},Se=function(e){return te.value.map((function(e){return e[ce.value]})).indexOf(e)},Ee=function(e){return-1!==["tags","multiple"].indexOf(s.value)&&p.value&&me(e)},Be=function(e){X.value.push(e)},Le=function(e){return R.value?e.filter((function(e){return N.value?e.__VISIBLE__.length:e[V.value].length})):e.filter((function(e){return!N.value||e.__VISIBLE__.length}))},Pe=function(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e;return N.value&&P.value&&(t=t.filter((function(e){return-1!==b(e[ce.value],j.value).indexOf(b(N.value,j.value))}))),p.value&&u&&(t=t.filter((function(e){return!Ee(e)}))),t},ke=function(e){var u,t=e;return u=t,"[object Object]"===Object.prototype.toString.call(u)&&(t=Object.keys(t).map((function(e){var u,l=t[e];return y(u={},q.value,e),y(u,ce.value,l),y(u,m.value,l),u}))),t=t.map((function(e){var u;return"object"===h(e)?e:(y(u={},q.value,e),y(u,ce.value,e),y(u,m.value,e),u)}))},we=function(){g(H.value)||($.value=xe(H.value))},qe=function(e){Z.value=!0,o.value(N.value).then((function(u){Y.value=u,"function"==typeof e&&e(u),Z.value=!1}))},xe=function(e){return g(e)?"single"===s.value?{}:[]:A.value?e:"single"===s.value?Ae(e)||{}:e.filter((function(e){return!!Ae(e)})).map((function(e){return Ae(e)}))};if("single"!==s.value&&!g(H.value)&&!Array.isArray(H.value))throw new Error('v-model must be an array when using "'.concat(s.value,'" mode'));return o&&"function"==typeof o.value?B.value?qe(we):1==A.value&&we():(Y.value=o.value,we()),E.value>-1&&l(N,(function(e){e.lengthe.length)&&(u=e.length);for(var t=0,l=new Array(u);te.length)&&(u=e.length);for(var t=0,l=new Array(u);t[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(n,r){const i=function(l,a){var n=e(l),r=n.value,i=n.modelValue,o=n.mode,s=n.valueProp,c=u("single"!==o.value?[]:{}),v=void 0!==a.expose?i:r,p=t((function(){return"single"===o.value?c.value[s.value]:c.value.map((function(e){return e[s.value]}))})),d=t((function(){return"single"!==o.value?c.value.map((function(e){return e[s.value]})).join(","):c.value[s.value]}));return{iv:c,internalValue:c,ev:v,externalValue:v,textValue:d,plainValue:p}}(n,r),o=function(t,l,a){var n=e(t),r=n.groupSelect,i=n.mode,o=n.groups,s=u(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===i.value||!r.value)||(s.value=e)};return{pointer:s,setPointer:c,clearPointer:function(){c(null)}}}(n),s=function(t,l,a){var n=e(t).disabled,r=u(!1);return{isOpen:r,open:function(){r.value||n.value||(r.value=!0,l.emit("open"))},close:function(){r.value&&(r.value=!1,l.emit("close"))}}}(n,r),c=function(e,t,a){var n=u(null),r=u(null);return l(n,(function(e){t.emit("search-change",e)})),{search:n,input:r,clearSearch:function(){n.value=""},handleSearchInput:function(e){n.value=e.target.value},handlePaste:function(e){t.emit("paste",e)}}}(0,r),v=function(u,t,l){var a=e(u),n=a.object,r=a.valueProp,i=a.mode,o=l.iv,s=function(e){return n.value||g(e)?e:Array.isArray(e)?e.map((function(e){return e[r.value]})):e[r.value]},c=function(e){return g(e)?"single"===i.value?{}:[]:e};return{update:function(e){o.value=c(e);var u=s(e);t.emit("change",u),t.emit("input",u),t.emit("update:modelValue",u)}}}(n,r,{iv:i.iv}),p=function(l,a,n){var r=e(l),i=r.searchable,o=r.disabled,s=n.input,c=n.open,v=n.close,p=n.clearSearch,d=u(null),f=u(!1),g=t((function(){return i.value||o.value?-1:0})),b=function(){i.value&&s.value.blur(),d.value.blur()},h=function(){i.value&&!o.value&&s.value.focus()},m=function(){f.value=!1,setTimeout((function(){f.value||(v(),p())}),1)};return{multiselect:d,tabindex:g,isActive:f,blur:b,focus:h,handleFocus:function(){h()},activate:function(){o.value||(f.value=!0,c())},deactivate:m,handleCaretClick:function(){m(),b()}}}(n,0,{input:c.input,open:s.open,close:s.close,clearSearch:c.clearSearch}),d=O(n,r,{ev:i.ev,iv:i.iv,search:c.search,clearSearch:c.clearSearch,update:v.update,pointer:o.pointer,clearPointer:o.clearPointer,blur:p.blur,focus:p.focus,deactivate:p.deactivate}),f=function(u,n,r){var i=e(u),o=i.valueProp,s=i.showOptions,c=i.searchable,v=i.groupLabel,p=i.groups,d=i.mode,f=i.groupSelect,g=r.fo,b=r.fg,h=r.handleOptionClick,m=r.handleGroupClick,D=r.search,y=r.pointer,O=r.setPointer,C=r.clearPointer,A=r.multiselect,S=t((function(){return g.value.filter((function(e){return!e.disabled}))})),E=t((function(){return b.value.filter((function(e){return!e.disabled}))})),B=t((function(){return"single"!==d.value&&f.value})),L=t((function(){return y.value&&y.value.group})),P=t((function(){return R(y.value)})),k=t((function(){var e=L.value?y.value:R(y.value),u=E.value.map((function(e){return e[v.value]})).indexOf(e[v.value]),t=E.value[u-1];return void 0===t&&(t=q.value),t})),w=t((function(){var e=E.value.map((function(e){return e.label})).indexOf(L.value?y.value[v.value]:R(y.value)[v.value])+1;return E.value.length<=e&&(e=0),E.value[e]})),q=t((function(){return F(E.value).slice(-1)[0]})),x=t((function(){return y.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),T=t((function(){var e=P.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(y.value[o.value])-1]})),j=t((function(){var e=R(y.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(y.value[o.value])+1]})),I=t((function(){return F(k.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),_=t((function(){return F(q.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),V=function(){O(S.value[0]||null)},R=function(e){return E.value.find((function(u){return-1!==u.__VISIBLE__.map((function(e){return e[o.value]})).indexOf(e[o.value])}))},M=function(){var e=A.value.querySelector("[data-pointed]");if(e){var u=e.parentElement.parentElement;p.value&&(u=L.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>u.clientHeight+u.scrollTop&&(u.scrollTop=e.offsetTop+e.offsetHeight-u.clientHeight),e.offsetTope.activate&&e.activate(...u)),onFocusout:u[8]||(u[8]=(...u)=>e.deactivate&&e.deactivate(...u)),onKeydown:u[9]||(u[9]=(...u)=>e.handleKeydown&&e.handleKeydown(...u)),onFocus:u[10]||(u[10]=(...u)=>e.handleFocus&&e.handleFocus(...u))},[i(" Search "),"tags"!==t.mode&&t.searchable&&!t.disabled?(n(),r("input",{key:0,type:t.inputType,modelValue:e.search,value:e.search,class:e.classList.search,autocomplete:t.autocomplete,onInput:u[1]||(u[1]=(...u)=>e.handleSearchInput&&e.handleSearchInput(...u)),onPaste:u[2]||(u[2]=o(((...u)=>e.handlePaste&&e.handlePaste(...u)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):i("v-if",!0),i(" Tags (with search) "),"tags"==t.mode?(n(),r("div",{key:1,class:e.classList.tags},[(n(!0),r(s,null,c(e.iv,((u,l,a)=>v(e.$slots,"tag",{option:u,handleTagRemove:e.handleTagRemove,disabled:t.disabled},(()=>[(n(),r("span",{class:e.classList.tag,key:a},[p(d(u[t.label])+" ",1),t.disabled?i("v-if",!0):(n(),r("span",{key:0,class:e.classList.tagRemove,onClick:t=>e.handleTagRemove(u,t)},[f("span",{class:e.classList.tagRemoveIcon},null,2)],10,["onClick"]))],2))])))),256)),f("div",{class:e.classList.tagsSearchWrapper},[i(" Used for measuring search width "),f("span",{class:e.classList.tagsSearchCopy},d(e.search),3),i(" Actual search input "),t.searchable&&!t.disabled?(n(),r("input",{key:0,type:t.inputType,modelValue:e.search,value:e.search,class:e.classList.tagsSearch,autocomplete:t.autocomplete,onInput:u[3]||(u[3]=(...u)=>e.handleSearchInput&&e.handleSearchInput(...u)),onPaste:u[4]||(u[4]=o(((...u)=>e.handlePaste&&e.handlePaste(...u)),["stop"])),ref:"input"},null,42,["type","modelValue","value","autocomplete"])):i("v-if",!0)],2)],2)):i("v-if",!0),i(" Single label "),"single"==t.mode&&e.hasSelected&&!e.search&&e.iv?v(e.$slots,"singlelabel",{key:2,value:e.iv},(()=>[f("div",{class:e.classList.singleLabel},[f("span",{class:e.classList.singleLabelText},d(e.iv[t.label]),3)],2)])):i("v-if",!0),i(" Multiple label "),"multiple"==t.mode&&e.hasSelected&&!e.search?v(e.$slots,"multiplelabel",{key:3,values:e.iv},(()=>[f("div",{class:e.classList.multipleLabel},d(e.multipleLabelText),3)])):i("v-if",!0),i(" Placeholder "),!t.placeholder||e.hasSelected||e.search?i("v-if",!0):v(e.$slots,"placeholder",{key:4},(()=>[f("div",{class:e.classList.placeholder},d(t.placeholder),3)])),i(" Spinner "),e.busy&&e.isActive?v(e.$slots,"spinner",{key:5},(()=>[f("span",{class:e.classList.spinner},null,2)])):i("v-if",!0),i(" Clear "),e.hasSelected&&!t.disabled&&t.canClear&&!e.busy?v(e.$slots,"clear",{key:6,clear:e.clear},(()=>[f("span",{class:e.classList.clear,onMousedown:u[5]||(u[5]=(...u)=>e.clear&&e.clear(...u))},[f("span",{class:e.classList.clearIcon},null,2)],34)])):i("v-if",!0),i(" Caret "),t.caret&&t.showOptions?v(e.$slots,"caret",{key:7},(()=>[f("span",{class:e.classList.caret,onClick:u[6]||(u[6]=(...u)=>e.handleCaretClick&&e.handleCaretClick(...u))},null,2)])):i("v-if",!0),i(" Options "),f("div",{class:e.classList.dropdown,tabindex:"-1"},[v(e.$slots,"beforelist",{options:e.fo}),f("ul",{class:e.classList.options},[t.groups?(n(!0),r(s,{key:0},c(e.fg,((u,l,a)=>(n(),r("li",{class:e.classList.group,key:a},[f("div",{class:e.classList.groupLabel(u),"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleGroupClick(u)},[v(e.$slots,"grouplabel",{group:u},(()=>[f("span",null,d(u[t.groupLabel]),1)]))],42,["data-pointed","onMouseenter","onClick"]),f("ul",{class:e.classList.groupOptions},[(n(!0),r(s,null,c(u.__VISIBLE__,((l,a,i)=>(n(),r("li",{class:e.classList.option(l,u),key:i,"data-pointed":e.isPointed(l),onMouseenter:u=>e.setPointer(l),onClick:u=>e.handleOptionClick(l)},[v(e.$slots,"option",{option:l,search:e.search},(()=>[f("span",null,d(l[t.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2)],2)))),128)):(n(!0),r(s,{key:1},c(e.fo,((u,l,a)=>(n(),r("li",{class:e.classList.option(u),key:a,"data-pointed":e.isPointed(u),onMouseenter:t=>e.setPointer(u),onClick:t=>e.handleOptionClick(u)},[v(e.$slots,"option",{option:u,search:e.search},(()=>[f("span",null,d(u[t.label]),1)]))],42,["data-pointed","onMouseenter","onClick"])))),128))],2),e.noOptions?v(e.$slots,"nooptions",{key:0},(()=>[f("div",{class:e.classList.noOptions,innerHTML:t.noOptionsText},null,10,["innerHTML"])])):i("v-if",!0),e.noResults?v(e.$slots,"noresults",{key:1},(()=>[f("div",{class:e.classList.noResults,innerHTML:t.noResultsText},null,10,["innerHTML"])])):i("v-if",!0),v(e.$slots,"afterlist",{options:e.fo})],2),i(" Hacky input element to show HTML5 required warning "),t.required?(n(),r("input",{key:8,class:e.classList.fakeInput,tabindex:"-1",value:e.textValue,required:""},null,10,["value"])):i("v-if",!0),i(" Native input support "),t.nativeSupport?(n(),r(s,{key:9},["single"==t.mode?(n(),r("input",{key:0,type:"hidden",name:t.name,value:void 0!==e.plainValue?e.plainValue:""},null,8,["name","value"])):(n(!0),r(s,{key:1},c(e.plainValue,((e,u)=>(n(),r("input",{type:"hidden",name:`${t.name}[]`,value:e,key:u},null,8,["name","value"])))),128))],64)):i("v-if",!0),i(" Create height for empty input "),f("div",{class:e.classList.spacer},null,2)],42,["tabindex","id"])},P.__file="src/Multiselect.vue";export default P; diff --git a/dist/multiselect.vue2.global.js b/dist/multiselect.vue2.global.js index b81f5e1..10f2adf 100644 --- a/dist/multiselect.vue2.global.js +++ b/dist/multiselect.vue2.global.js @@ -1 +1 @@ -var VueformMultiselect=function(e){"use strict";function u(e){return-1!==[null,void 0,!1].indexOf(e)}function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,u,t){return u in e?Object.defineProperty(e,u,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[u]=t,e}function n(e,u){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);u&&(a=a.filter((function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable}))),t.push.apply(t,a)}return t}function l(e){for(var u=1;ue.length)&&(u=e.length);for(var t=0,a=new Array(u);t1&&void 0!==arguments[1])||arguments[1];return u?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function s(n,r,i){var s=e.toRefs(n),c=s.options,v=s.mode,p=s.trackBy,d=s.limit,f=s.hideSelected,g=s.createTag,m=s.label,D=s.appendNewTag,b=s.multipleLabel,h=s.object,y=s.loading,_=s.delay,F=s.resolveOnLoad,C=s.minChars,S=s.filterResults,O=s.clearOnSearch,A=s.clearOnSelect,E=s.valueProp,B=s.canDeselect,P=s.max,L=s.strict,w=s.closeOnSelect,k=s.groups,q=(s.groupLabel,s.groupOptions),x=s.groupHideEmpty,T=s.groupSelect,I=i.iv,R=i.ev,j=i.search,V=i.clearSearch,N=i.update,G=i.pointer,H=i.clearPointer,$=i.blur,M=i.deactivate,W=e.ref([]),U=e.ref([]),K=e.ref(!1),X=e.computed((function(){if(k.value){var e=U.value||[],u=[];return e.forEach((function(e){ye(e[q.value]).forEach((function(t){u.push(Object.assign({},t,e.disabled?{disabled:!0}:{}))}))})),u}var t=ye(U.value||[]);return W.value.length&&(t=t.concat(W.value)),t})),z=e.computed((function(){return k.value?be((U.value||[]).map((function(e){var u,t=ye(e[q.value]);return l(l({},e),{},(a(u={group:!0},q.value,he(t,!1).map((function(u){return Object.assign({},u,e.disabled?{disabled:!0}:{})}))),a(u,"__VISIBLE__",he(t).map((function(u){return Object.assign({},u,e.disabled?{disabled:!0}:{})}))),u))}))):[]})),J=e.computed((function(){var e=X.value;return ue.value.length&&(e=ue.value.concat(e)),e=he(e),d.value>0&&(e=e.slice(0,d.value)),e})),Q=e.computed((function(){switch(v.value){case"single":return!u(I.value[E.value]);case"multiple":case"tags":return!u(I.value)&&I.value.length>0}})),Y=e.computed((function(){return void 0!==b&&void 0!==b.value?b.value(I.value):I.value&&I.value.length>1?"".concat(I.value.length," options selected"):"1 option selected"})),Z=e.computed((function(){return!X.value.length&&!K.value&&!ue.value.length})),ee=e.computed((function(){return X.value.length>0&&0==J.value.length&&(j.value&&k.value||!k.value)})),ue=e.computed((function(){var e;return!1!==g.value&&j.value?-1!==ge(j.value)?[]:[(e={},a(e,E.value,j.value),a(e,m.value,j.value),a(e,p.value,j.value),e)]:[]})),te=e.computed((function(){switch(v.value){case"single":return null;case"multiple":case"tags":return[]}})),ae=e.computed((function(){return y.value||K.value})),ne=function(e){switch("object"!==t(e)&&(e=fe(e)),v.value){case"single":N(e);break;case"multiple":case"tags":N(I.value.concat(e))}r.emit("select",re(e),e)},le=function(e){switch("object"!==t(e)&&(e=fe(e)),v.value){case"single":oe();break;case"tags":case"multiple":N(Array.isArray(e)?I.value.filter((function(u){return-1===e.map((function(e){return e[E.value]})).indexOf(u[E.value])})):I.value.filter((function(u){return u[E.value]!=e[E.value]})))}r.emit("deselect",re(e),e)},re=function(e){return h.value?e:e[E.value]},ie=function(e){le(e)},oe=function(){r.emit("clear"),N(te.value)},se=function(e){if(void 0!==e.group)return"single"!==v.value&&(de(e[q.value])&&e[q.value].length);switch(v.value){case"single":return!u(I.value)&&I.value[E.value]==e[E.value];case"tags":case"multiple":return!u(I.value)&&-1!==I.value.map((function(e){return e[E.value]})).indexOf(e[E.value])}},ce=function(e){return!0===e.disabled},ve=function(){return!(void 0===P||-1===P.value||!Q.value&&P.value>0)&&I.value.length>=P.value},pe=function(e){return void 0===e.find((function(e){return!se(e)&&!e.disabled}))},de=function(e){return void 0===e.find((function(e){return!se(e)}))},fe=function(e){return X.value[X.value.map((function(e){return String(e[E.value])})).indexOf(String(e))]},ge=function(e){return X.value.map((function(e){return e[p.value]})).indexOf(e)},me=function(e){return-1!==["tags","multiple"].indexOf(v.value)&&f.value&&se(e)},De=function(e){W.value.push(e)},be=function(e){return x.value?e.filter((function(e){return j.value?e.__VISIBLE__.length:e[q.value].length})):e.filter((function(e){return!j.value||e.__VISIBLE__.length}))},he=function(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e;return j.value&&S.value&&(t=t.filter((function(e){return-1!==o(e[p.value],L.value).indexOf(o(j.value,L.value))}))),f.value&&u&&(t=t.filter((function(e){return!me(e)}))),t},ye=function(e){var u,n=e;return u=n,"[object Object]"===Object.prototype.toString.call(u)&&(n=Object.keys(n).map((function(e){var u,t=n[e];return a(u={},E.value,e),a(u,p.value,t),a(u,m.value,t),u}))),n=n.map((function(e){var u;return"object"===t(e)?e:(a(u={},E.value,e),a(u,p.value,e),a(u,m.value,e),u)}))},_e=function(){u(R.value)||(I.value=Ce(R.value))},Fe=function(e){K.value=!0,c.value(j.value).then((function(u){U.value=u,"function"==typeof e&&e(u),K.value=!1}))},Ce=function(e){return u(e)?"single"===v.value?{}:[]:h.value?e:"single"===v.value?fe(e)||{}:e.filter((function(e){return!!fe(e)})).map((function(e){return fe(e)}))};if("single"!==v.value&&!u(R.value)&&!Array.isArray(R.value))throw new Error('v-model must be an array when using "'.concat(v.value,'" mode'));return c&&"function"==typeof c.value?F.value?Fe(_e):1==h.value&&_e():(U.value=c.value,_e()),_.value>-1&&e.watch(j,(function(e){e.length[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(t,a){const n=function(u,t){var a=e.toRefs(u),n=a.value,l=a.modelValue,r=a.mode,i=a.valueProp,o=e.ref("single"!==r.value?[]:{}),s=void 0!==t.expose?l:n,c=e.computed((function(){return"single"===r.value?o.value[i.value]:o.value.map((function(e){return e[i.value]}))})),v=e.computed((function(){return"single"!==r.value?o.value.map((function(e){return e[i.value]})).join(","):o.value[i.value]}));return{iv:o,internalValue:o,ev:s,externalValue:s,textValue:v,plainValue:c}}(t,a),i=function(u,t,a){var n=e.toRefs(u),l=n.groupSelect,r=n.mode,i=n.groups,o=e.ref(null),s=function(e){void 0===e||null!==e&&e.disabled||i.value&&e&&e.group&&("single"===r.value||!l.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:function(){s(null)}}}(t),o=function(u,t,a){var n=e.toRefs(u).disabled,l=e.ref(!1);return{isOpen:l,open:function(){l.value||n.value||(l.value=!0,t.emit("open"))},close:function(){l.value&&(l.value=!1,t.emit("close"))}}}(t,a),c=function(u,t,a){var n=e.ref(null),l=e.ref(null);return e.watch(n,(function(e){t.emit("search-change",e)})),{search:n,input:l,clearSearch:function(){n.value=""},handleSearchInput:function(e){n.value=e.target.value},handlePaste:function(e){t.emit("paste",e)}}}(0,a),v=function(t,a,n){var l=e.toRefs(t),r=l.object,i=l.valueProp,o=l.mode,s=n.iv,c=function(e){return r.value||u(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},v=function(e){return u(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=v(e);var u=c(e);a.emit("change",u),a.emit("input",u),a.emit("update:modelValue",u)}}}(t,a,{iv:n.iv}),p=function(u,t,a){var n=e.toRefs(u),l=n.searchable,r=n.disabled,i=a.input,o=a.open,s=a.close,c=a.clearSearch,v=e.ref(null),p=e.ref(!1),d=e.computed((function(){return l.value||r.value?-1:0})),f=function(){l.value&&i.value.blur(),v.value.blur()},g=function(){p.value=!1,setTimeout((function(){p.value||(s(),c())}),1)};return{multiselect:v,tabindex:d,isActive:p,blur:f,handleFocus:function(){l.value&&!r.value&&i.value.focus()},activate:function(){r.value||(p.value=!0,o())},deactivate:g,handleCaretClick:function(){g(),f()}}}(t,0,{input:c.input,open:o.open,close:o.close,clearSearch:c.clearSearch}),d=s(t,a,{ev:n.ev,iv:n.iv,search:c.search,clearSearch:c.clearSearch,update:v.update,pointer:i.pointer,clearPointer:i.clearPointer,blur:p.blur,deactivate:p.deactivate}),f=function(u,t,a){var n=e.toRefs(u),l=n.valueProp,i=n.showOptions,o=n.searchable,s=n.groupLabel,c=n.groups,v=n.mode,p=n.groupSelect,d=a.fo,f=a.fg,g=a.handleOptionClick,m=a.handleGroupClick,D=a.search,b=a.pointer,h=a.setPointer,y=a.clearPointer,_=a.multiselect,F=e.computed((function(){return d.value.filter((function(e){return!e.disabled}))})),C=e.computed((function(){return f.value.filter((function(e){return!e.disabled}))})),S=e.computed((function(){return"single"!==v.value&&p.value})),O=e.computed((function(){return b.value&&b.value.group})),A=e.computed((function(){return I(b.value)})),E=e.computed((function(){var e=O.value?b.value:I(b.value),u=C.value.map((function(e){return e[s.value]})).indexOf(e[s.value]),t=C.value[u-1];return void 0===t&&(t=P.value),t})),B=e.computed((function(){var e=C.value.map((function(e){return e.label})).indexOf(O.value?b.value[s.value]:I(b.value)[s.value])+1;return C.value.length<=e&&(e=0),C.value[e]})),P=e.computed((function(){return r(C.value).slice(-1)[0]})),L=e.computed((function(){return b.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),w=e.computed((function(){var e=A.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[l.value]})).indexOf(b.value[l.value])-1]})),k=e.computed((function(){var e=I(b.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[l.value]})).indexOf(b.value[l.value])+1]})),q=e.computed((function(){return r(E.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),x=e.computed((function(){return r(P.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),T=function(){h(F.value[0]||null)},I=function(e){return C.value.find((function(u){return-1!==u.__VISIBLE__.map((function(e){return e[l.value]})).indexOf(e[l.value])}))},R=function(){var e=_.value.querySelector("[data-pointed]");if(e){var u=e.parentElement.parentElement;c.value&&(u=O.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>u.clientHeight+u.scrollTop&&(u.scrollTop=e.offsetTop+e.offsetHeight-u.clientHeight),e.offsetTope.length)&&(u=e.length);for(var t=0,a=new Array(u);t1&&void 0!==arguments[1])||arguments[1];return u?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function s(n,r,i){var s=e.toRefs(n),c=s.options,v=s.mode,p=s.trackBy,d=s.limit,f=s.hideSelected,g=s.createTag,m=s.createOption,D=s.label,b=s.appendNewTag,h=s.appendNewOption,y=s.multipleLabel,_=s.object,F=s.loading,O=s.delay,C=s.resolveOnLoad,A=s.minChars,S=s.filterResults,E=s.clearOnSearch,B=s.clearOnSelect,L=s.valueProp,P=s.canDeselect,w=s.max,k=s.strict,x=s.closeOnSelect,q=s.groups,T=(s.groupLabel,s.groupOptions),I=s.groupHideEmpty,R=s.groupSelect,j=i.iv,V=i.ev,N=i.search,G=i.clearSearch,H=i.update,$=i.pointer,M=i.clearPointer,U=i.blur,W=i.focus,K=i.deactivate,X=e.ref([]),z=e.ref([]),J=e.ref(!1),Q=e.computed((function(){return g.value||m.value||!1})),Y=e.computed((function(){return void 0!==b.value?b.value:void 0===h.value||h.value})),Z=e.computed((function(){if(q.value){var e=z.value||[],u=[];return e.forEach((function(e){Ee(e[T.value]).forEach((function(t){u.push(Object.assign({},t,e.disabled?{disabled:!0}:{}))}))})),u}var t=Ee(z.value||[]);return X.value.length&&(t=t.concat(X.value)),t})),ee=e.computed((function(){return q.value?Ae((z.value||[]).map((function(e){var u,t=Ee(e[T.value]);return l(l({},e),{},(a(u={group:!0},T.value,Se(t,!1).map((function(u){return Object.assign({},u,e.disabled?{disabled:!0}:{})}))),a(u,"__VISIBLE__",Se(t).map((function(u){return Object.assign({},u,e.disabled?{disabled:!0}:{})}))),u))}))):[]})),ue=e.computed((function(){var e=Z.value;return re.value.length&&(e=re.value.concat(e)),e=Se(e),d.value>0&&(e=e.slice(0,d.value)),e})),te=e.computed((function(){switch(v.value){case"single":return!u(j.value[L.value]);case"multiple":case"tags":return!u(j.value)&&j.value.length>0}})),ae=e.computed((function(){return void 0!==y&&void 0!==y.value?y.value(j.value):j.value&&j.value.length>1?"".concat(j.value.length," options selected"):"1 option selected"})),ne=e.computed((function(){return!Z.value.length&&!J.value&&!re.value.length})),le=e.computed((function(){return Z.value.length>0&&0==ue.value.length&&(N.value&&q.value||!q.value)})),re=e.computed((function(){var e;return!1!==Q.value&&N.value?-1!==Fe(N.value)?[]:[(e={},a(e,L.value,N.value),a(e,D.value,N.value),a(e,ie.value,N.value),e)]:[]})),ie=e.computed((function(){return p.value||D.value})),oe=e.computed((function(){switch(v.value){case"single":return null;case"multiple":case"tags":return[]}})),se=e.computed((function(){return F.value||J.value})),ce=function(e){switch("object"!==t(e)&&(e=_e(e)),v.value){case"single":H(e);break;case"multiple":case"tags":H(j.value.concat(e))}r.emit("select",pe(e),e)},ve=function(e){switch("object"!==t(e)&&(e=_e(e)),v.value){case"single":fe();break;case"tags":case"multiple":H(Array.isArray(e)?j.value.filter((function(u){return-1===e.map((function(e){return e[L.value]})).indexOf(u[L.value])})):j.value.filter((function(u){return u[L.value]!=e[L.value]})))}r.emit("deselect",pe(e),e)},pe=function(e){return _.value?e:e[L.value]},de=function(e){ve(e)},fe=function(){r.emit("clear"),H(oe.value)},ge=function(e){if(void 0!==e.group)return"single"!==v.value&&(ye(e[T.value])&&e[T.value].length);switch(v.value){case"single":return!u(j.value)&&j.value[L.value]==e[L.value];case"tags":case"multiple":return!u(j.value)&&-1!==j.value.map((function(e){return e[L.value]})).indexOf(e[L.value])}},me=function(e){return!0===e.disabled},De=function(){return!(void 0===w||-1===w.value||!te.value&&w.value>0)&&j.value.length>=w.value},be=function(e){void 0===_e(e[L.value])&&Q.value&&(r.emit("tag",e[L.value]),r.emit("option",e[L.value]),Y.value&&Ce(e),G())},he=function(e){return void 0===e.find((function(e){return!ge(e)&&!e.disabled}))},ye=function(e){return void 0===e.find((function(e){return!ge(e)}))},_e=function(e){return Z.value[Z.value.map((function(e){return String(e[L.value])})).indexOf(String(e))]},Fe=function(e){return Z.value.map((function(e){return e[ie.value]})).indexOf(e)},Oe=function(e){return-1!==["tags","multiple"].indexOf(v.value)&&f.value&&ge(e)},Ce=function(e){X.value.push(e)},Ae=function(e){return I.value?e.filter((function(e){return N.value?e.__VISIBLE__.length:e[T.value].length})):e.filter((function(e){return!N.value||e.__VISIBLE__.length}))},Se=function(e){var u=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e;return N.value&&S.value&&(t=t.filter((function(e){return-1!==o(e[ie.value],k.value).indexOf(o(N.value,k.value))}))),f.value&&u&&(t=t.filter((function(e){return!Oe(e)}))),t},Ee=function(e){var u,n=e;return u=n,"[object Object]"===Object.prototype.toString.call(u)&&(n=Object.keys(n).map((function(e){var u,t=n[e];return a(u={},L.value,e),a(u,ie.value,t),a(u,D.value,t),u}))),n=n.map((function(e){var u;return"object"===t(e)?e:(a(u={},L.value,e),a(u,ie.value,e),a(u,D.value,e),u)}))},Be=function(){u(V.value)||(j.value=Pe(V.value))},Le=function(e){J.value=!0,c.value(N.value).then((function(u){z.value=u,"function"==typeof e&&e(u),J.value=!1}))},Pe=function(e){return u(e)?"single"===v.value?{}:[]:_.value?e:"single"===v.value?_e(e)||{}:e.filter((function(e){return!!_e(e)})).map((function(e){return _e(e)}))};if("single"!==v.value&&!u(V.value)&&!Array.isArray(V.value))throw new Error('v-model must be an array when using "'.concat(v.value,'" mode'));return c&&"function"==typeof c.value?C.value?Le(Be):1==_.value&&Be():(z.value=c.value,Be()),O.value>-1&&e.watch(N,(function(e){e.length[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(t,a){const n=function(u,t){var a=e.toRefs(u),n=a.value,l=a.modelValue,r=a.mode,i=a.valueProp,o=e.ref("single"!==r.value?[]:{}),s=void 0!==t.expose?l:n,c=e.computed((function(){return"single"===r.value?o.value[i.value]:o.value.map((function(e){return e[i.value]}))})),v=e.computed((function(){return"single"!==r.value?o.value.map((function(e){return e[i.value]})).join(","):o.value[i.value]}));return{iv:o,internalValue:o,ev:s,externalValue:s,textValue:v,plainValue:c}}(t,a),i=function(u,t,a){var n=e.toRefs(u),l=n.groupSelect,r=n.mode,i=n.groups,o=e.ref(null),s=function(e){void 0===e||null!==e&&e.disabled||i.value&&e&&e.group&&("single"===r.value||!l.value)||(o.value=e)};return{pointer:o,setPointer:s,clearPointer:function(){s(null)}}}(t),o=function(u,t,a){var n=e.toRefs(u).disabled,l=e.ref(!1);return{isOpen:l,open:function(){l.value||n.value||(l.value=!0,t.emit("open"))},close:function(){l.value&&(l.value=!1,t.emit("close"))}}}(t,a),c=function(u,t,a){var n=e.ref(null),l=e.ref(null);return e.watch(n,(function(e){t.emit("search-change",e)})),{search:n,input:l,clearSearch:function(){n.value=""},handleSearchInput:function(e){n.value=e.target.value},handlePaste:function(e){t.emit("paste",e)}}}(0,a),v=function(t,a,n){var l=e.toRefs(t),r=l.object,i=l.valueProp,o=l.mode,s=n.iv,c=function(e){return r.value||u(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},v=function(e){return u(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=v(e);var u=c(e);a.emit("change",u),a.emit("input",u),a.emit("update:modelValue",u)}}}(t,a,{iv:n.iv}),p=function(u,t,a){var n=e.toRefs(u),l=n.searchable,r=n.disabled,i=a.input,o=a.open,s=a.close,c=a.clearSearch,v=e.ref(null),p=e.ref(!1),d=e.computed((function(){return l.value||r.value?-1:0})),f=function(){l.value&&i.value.blur(),v.value.blur()},g=function(){l.value&&!r.value&&i.value.focus()},m=function(){p.value=!1,setTimeout((function(){p.value||(s(),c())}),1)};return{multiselect:v,tabindex:d,isActive:p,blur:f,focus:g,handleFocus:function(){g()},activate:function(){r.value||(p.value=!0,o())},deactivate:m,handleCaretClick:function(){m(),f()}}}(t,0,{input:c.input,open:o.open,close:o.close,clearSearch:c.clearSearch}),d=s(t,a,{ev:n.ev,iv:n.iv,search:c.search,clearSearch:c.clearSearch,update:v.update,pointer:i.pointer,clearPointer:i.clearPointer,blur:p.blur,focus:p.focus,deactivate:p.deactivate}),f=function(u,t,a){var n=e.toRefs(u),l=n.valueProp,i=n.showOptions,o=n.searchable,s=n.groupLabel,c=n.groups,v=n.mode,p=n.groupSelect,d=a.fo,f=a.fg,g=a.handleOptionClick,m=a.handleGroupClick,D=a.search,b=a.pointer,h=a.setPointer,y=a.clearPointer,_=a.multiselect,F=e.computed((function(){return d.value.filter((function(e){return!e.disabled}))})),O=e.computed((function(){return f.value.filter((function(e){return!e.disabled}))})),C=e.computed((function(){return"single"!==v.value&&p.value})),A=e.computed((function(){return b.value&&b.value.group})),S=e.computed((function(){return I(b.value)})),E=e.computed((function(){var e=A.value?b.value:I(b.value),u=O.value.map((function(e){return e[s.value]})).indexOf(e[s.value]),t=O.value[u-1];return void 0===t&&(t=L.value),t})),B=e.computed((function(){var e=O.value.map((function(e){return e.label})).indexOf(A.value?b.value[s.value]:I(b.value)[s.value])+1;return O.value.length<=e&&(e=0),O.value[e]})),L=e.computed((function(){return r(O.value).slice(-1)[0]})),P=e.computed((function(){return b.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),w=e.computed((function(){var e=S.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[l.value]})).indexOf(b.value[l.value])-1]})),k=e.computed((function(){var e=I(b.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[l.value]})).indexOf(b.value[l.value])+1]})),x=e.computed((function(){return r(E.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),q=e.computed((function(){return r(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),T=function(){h(F.value[0]||null)},I=function(e){return O.value.find((function(u){return-1!==u.__VISIBLE__.map((function(e){return e[l.value]})).indexOf(e[l.value])}))},R=function(){var e=_.value.querySelector("[data-pointed]");if(e){var u=e.parentElement.parentElement;c.value&&(u=A.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>u.clientHeight+u.scrollTop&&(u.scrollTop=e.offsetTop+e.offsetHeight-u.clientHeight),e.offsetTop1&&void 0!==arguments[1])||arguments[1];return t?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,n)}return u}function s(e){for(var t=1;t0&&(e=e.slice(0,b.value)),e})),ee=u((function(){switch(f.value){case"single":return!l(V.value[L.value]);case"multiple":case"tags":return!l(V.value)&&V.value.length>0}})),te=u((function(){return void 0!==_&&void 0!==_.value?_.value(V.value):V.value&&V.value.length>1?"".concat(V.value.length," options selected"):"1 option selected"})),ue=u((function(){return!Q.value.length&&!J.value&&!ae.value.length})),ne=u((function(){return Q.value.length>0&&0==Z.value.length&&(G.value&&x.value||!x.value)})),ae=u((function(){var e;return!1!==D.value&&G.value?-1!==De(G.value)?[]:[(e={},c(e,L.value,G.value),c(e,h.value,G.value),c(e,g.value,G.value),e)]:[]})),le=u((function(){switch(f.value){case"single":return null;case"multiple":case"tags":return[]}})),re=u((function(){return F.value||J.value})),ie=function(e){switch("object"!==i(e)&&(e=me(e)),f.value){case"single":$(e);break;case"multiple":case"tags":$(V.value.concat(e))}o.emit("select",se(e),e)},oe=function(e){switch("object"!==i(e)&&(e=me(e)),f.value){case"single":ve();break;case"tags":case"multiple":$(Array.isArray(e)?V.value.filter((function(t){return-1===e.map((function(e){return e[L.value]})).indexOf(t[L.value])})):V.value.filter((function(t){return t[L.value]!=e[L.value]})))}o.emit("deselect",se(e),e)},se=function(e){return O.value?e:e[L.value]},ce=function(e){oe(e)},ve=function(){o.emit("clear"),$(le.value)},pe=function(e){if(void 0!==e.group)return"single"!==f.value&&(be(e[T.value])&&e[T.value].length);switch(f.value){case"single":return!l(V.value)&&V.value[L.value]==e[L.value];case"tags":case"multiple":return!l(V.value)&&-1!==V.value.map((function(e){return e[L.value]})).indexOf(e[L.value])}},de=function(e){return!0===e.disabled},fe=function(){return!(void 0===k||-1===k.value||!ee.value&&k.value>0)&&V.value.length>=k.value},ge=function(e){return void 0===e.find((function(e){return!pe(e)&&!e.disabled}))},be=function(e){return void 0===e.find((function(e){return!pe(e)}))},me=function(e){return Q.value[Q.value.map((function(e){return String(e[L.value])})).indexOf(String(e))]},De=function(e){return Q.value.map((function(e){return e[g.value]})).indexOf(e)},he=function(e){return-1!==["tags","multiple"].indexOf(f.value)&&m.value&&pe(e)},ye=function(e){X.value.push(e)},_e=function(e){return I.value?e.filter((function(e){return G.value?e.__VISIBLE__.length:e[T.value].length})):e.filter((function(e){return!G.value||e.__VISIBLE__.length}))},Oe=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=e;return G.value&&E.value&&(u=u.filter((function(e){return-1!==r(e[g.value],q.value).indexOf(r(G.value,q.value))}))),m.value&&t&&(u=u.filter((function(e){return!he(e)}))),u},Fe=function(e){var t,u=e;return t=u,"[object Object]"===Object.prototype.toString.call(t)&&(u=Object.keys(u).map((function(e){var t,n=u[e];return c(t={},L.value,e),c(t,g.value,n),c(t,h.value,n),t}))),u=u.map((function(e){var t;return"object"===i(e)?e:(c(t={},L.value,e),c(t,g.value,e),c(t,h.value,e),t)}))},Se=function(){l(N.value)||(V.value=Ae(N.value))},Ce=function(e){J.value=!0,d.value(G.value).then((function(t){z.value=t,"function"==typeof e&&e(t),J.value=!1}))},Ae=function(e){return l(e)?"single"===f.value?{}:[]:O.value?e:"single"===f.value?me(e)||{}:e.filter((function(e){return!!me(e)})).map((function(e){return me(e)}))};if("single"!==f.value&&!l(N.value)&&!Array.isArray(N.value))throw new Error('v-model must be an array when using "'.concat(f.value,'" mode'));return d&&"function"==typeof d.value?C.value?Ce(Se):1==O.value&&Se():(z.value=d.value,Se()),S.value>-1&&n(G,(function(e){e.lengthe.length)&&(t=e.length);for(var u=0,n=new Array(t);ue.length)&&(t=e.length);for(var u=0,n=new Array(t);u[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:"label"},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:!1},appendNewTag:{type:Boolean,required:!1,default:!0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},addTagOn:{type:Array,required:!1,default:()=>["enter"]},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(r,i){const o=function(n,a){var l=e(n),r=l.value,i=l.modelValue,o=l.mode,s=l.valueProp,c=t("single"!==o.value?[]:{}),v=void 0!==a.expose?i:r,p=u((function(){return"single"===o.value?c.value[s.value]:c.value.map((function(e){return e[s.value]}))})),d=u((function(){return"single"!==o.value?c.value.map((function(e){return e[s.value]})).join(","):c.value[s.value]}));return{iv:c,internalValue:c,ev:v,externalValue:v,textValue:d,plainValue:p}}(r,i),s=function(u,n,a){var l=e(u),r=l.groupSelect,i=l.mode,o=l.groups,s=t(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===i.value||!r.value)||(s.value=e)};return{pointer:s,setPointer:c,clearPointer:function(){c(null)}}}(r),c=function(u,n,a){var l=e(u).disabled,r=t(!1);return{isOpen:r,open:function(){r.value||l.value||(r.value=!0,n.emit("open"))},close:function(){r.value&&(r.value=!1,n.emit("close"))}}}(r,i),d=function(e,u,a){var l=t(null),r=t(null);return n(l,(function(e){u.emit("search-change",e)})),{search:l,input:r,clearSearch:function(){l.value=""},handleSearchInput:function(e){l.value=e.target.value},handlePaste:function(e){u.emit("paste",e)}}}(0,i),g=function(t,u,n){var a=e(t),r=a.object,i=a.valueProp,o=a.mode,s=n.iv,c=function(e){return r.value||l(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},v=function(e){return l(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=v(e);var t=c(e);u.emit("change",t),u.emit("input",t),u.emit("update:modelValue",t)}}}(r,i,{iv:o.iv}),b=function(n,a,l){var r=e(n),i=r.searchable,o=r.disabled,s=l.input,c=l.open,v=l.close,p=l.clearSearch,d=t(null),f=t(!1),g=u((function(){return i.value||o.value?-1:0})),b=function(){i.value&&s.value.blur(),d.value.blur()},m=function(){f.value=!1,setTimeout((function(){f.value||(v(),p())}),1)};return{multiselect:d,tabindex:g,isActive:f,blur:b,handleFocus:function(){i.value&&!o.value&&s.value.focus()},activate:function(){o.value||(f.value=!0,c())},deactivate:m,handleCaretClick:function(){m(),b()}}}(r,0,{input:d.input,open:c.open,close:c.close,clearSearch:d.clearSearch}),m=v(r,i,{ev:o.ev,iv:o.iv,search:d.search,clearSearch:d.clearSearch,update:g.update,pointer:s.pointer,clearPointer:s.clearPointer,blur:b.blur,deactivate:b.deactivate}),h=function(t,l,r){var i=e(t),o=i.valueProp,s=i.showOptions,c=i.searchable,v=i.groupLabel,d=i.groups,f=i.mode,g=i.groupSelect,b=r.fo,m=r.fg,D=r.handleOptionClick,h=r.handleGroupClick,y=r.search,_=r.pointer,O=r.setPointer,F=r.clearPointer,S=r.multiselect,C=u((function(){return b.value.filter((function(e){return!e.disabled}))})),A=u((function(){return m.value.filter((function(e){return!e.disabled}))})),E=u((function(){return"single"!==f.value&&g.value})),B=u((function(){return _.value&&_.value.group})),P=u((function(){return V(_.value)})),L=u((function(){var e=B.value?_.value:V(_.value),t=A.value.map((function(e){return e[v.value]})).indexOf(e[v.value]),u=A.value[t-1];return void 0===u&&(u=k.value),u})),w=u((function(){var e=A.value.map((function(e){return e.label})).indexOf(B.value?_.value[v.value]:V(_.value)[v.value])+1;return A.value.length<=e&&(e=0),A.value[e]})),k=u((function(){return p(A.value).slice(-1)[0]})),q=u((function(){return _.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),j=u((function(){var e=P.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(_.value[o.value])-1]})),x=u((function(){var e=V(_.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(_.value[o.value])+1]})),T=u((function(){return p(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),I=u((function(){return p(k.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),R=function(){O(C.value[0]||null)},V=function(e){return A.value.find((function(t){return-1!==t.__VISIBLE__.map((function(e){return e[o.value]})).indexOf(e[o.value])}))},N=function(){var e=S.value.querySelector("[data-pointed]");if(e){var t=e.parentElement.parentElement;d.value&&(t=B.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop1&&void 0!==arguments[1])||arguments[1];return t?String(e).toLowerCase().trim():String(e).normalize("NFD").replace(/(?:[\^`\xA8\xAF\xB4\xB7\xB8\u02B0-\u034E\u0350-\u0357\u035D-\u0362\u0374\u0375\u037A\u0384\u0385\u0483-\u0487\u0559\u0591-\u05A1\u05A3-\u05BD\u05BF\u05C1\u05C2\u05C4\u064B-\u0652\u0657\u0658\u06DF\u06E0\u06E5\u06E6\u06EA-\u06EC\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F5\u0818\u0819\u08E3-\u08FE\u093C\u094D\u0951-\u0954\u0971\u09BC\u09CD\u0A3C\u0A4D\u0ABC\u0ACD\u0AFD-\u0AFF\u0B3C\u0B4D\u0B55\u0BCD\u0C4D\u0CBC\u0CCD\u0D3B\u0D3C\u0D4D\u0DCA\u0E47-\u0E4C\u0E4E\u0EBA\u0EC8-\u0ECC\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F82-\u0F84\u0F86\u0F87\u0FC6\u1037\u1039\u103A\u1063\u1064\u1069-\u106D\u1087-\u108D\u108F\u109A\u109B\u135D-\u135F\u17C9-\u17D3\u17DD\u1939-\u193B\u1A75-\u1A7C\u1A7F\u1AB0-\u1ABD\u1B34\u1B44\u1B6B-\u1B73\u1BAA\u1BAB\u1C36\u1C37\u1C78-\u1C7D\u1CD0-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1D2C-\u1D6A\u1DC4-\u1DCF\u1DF5-\u1DF9\u1DFD-\u1DFF\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2CEF-\u2CF1\u2E2F\u302A-\u302F\u3099-\u309C\u30FC\uA66F\uA67C\uA67D\uA67F\uA69C\uA69D\uA6F0\uA6F1\uA700-\uA721\uA788-\uA78A\uA7F8\uA7F9\uA8C4\uA8E0-\uA8F1\uA92B-\uA92E\uA953\uA9B3\uA9C0\uA9E5\uAA7B-\uAA7D\uAABF-\uAAC2\uAAF6\uAB5B-\uAB5F\uAB69-\uAB6B\uABEC\uABED\uFB1E\uFE20-\uFE2F\uFF3E\uFF40\uFF70\uFF9E\uFF9F\uFFE3]|\uD800\uDEE0|\uD802[\uDEE5\uDEE6]|\uD803[\uDD22-\uDD27\uDF46-\uDF50]|\uD804[\uDCB9\uDCBA\uDD33\uDD34\uDD73\uDDC0\uDDCA-\uDDCC\uDE35\uDE36\uDEE9\uDEEA\uDF3C\uDF4D\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC42\uDC46\uDCC2\uDCC3\uDDBF\uDDC0\uDE3F\uDEB6\uDEB7\uDF2B]|\uD806[\uDC39\uDC3A\uDD3D\uDD3E\uDD43\uDDE0\uDE34\uDE47\uDE99]|\uD807[\uDC3F\uDD42\uDD44\uDD45\uDD97]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF8F-\uDF9F\uDFF0\uDFF1]|\uD834[\uDD67-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD]|\uD838[\uDD30-\uDD36\uDEEC-\uDEEF]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD46\uDD48-\uDD4A])/g,"").toLowerCase().trim()}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){var u=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),u.push.apply(u,n)}return u}function s(e){for(var t=1;t0&&(e=e.slice(0,b.value)),e})),le=u((function(){switch(f.value){case"single":return!l(G.value[k.value]);case"multiple":case"tags":return!l(G.value)&&G.value.length>0}})),re=u((function(){return void 0!==F&&void 0!==F.value?F.value(G.value):G.value&&G.value.length>1?"".concat(G.value.length," options selected"):"1 option selected"})),ie=u((function(){return!ue.value.length&&!Z.value&&!se.value.length})),oe=u((function(){return ue.value.length>0&&0==ae.value.length&&($.value&&I.value||!I.value)})),se=u((function(){var e;return!1!==ee.value&&$.value?-1!==Se($.value)?[]:[(e={},c(e,k.value,$.value),c(e,y.value,$.value),c(e,ce.value,$.value),e)]:[]})),ce=u((function(){return g.value||y.value})),ve=u((function(){switch(f.value){case"single":return null;case"multiple":case"tags":return[]}})),pe=u((function(){return S.value||Z.value})),de=function(e){switch("object"!==i(e)&&(e=Ae(e)),f.value){case"single":U(e);break;case"multiple":case"tags":U(G.value.concat(e))}o.emit("select",ge(e),e)},fe=function(e){switch("object"!==i(e)&&(e=Ae(e)),f.value){case"single":me();break;case"tags":case"multiple":U(Array.isArray(e)?G.value.filter((function(t){return-1===e.map((function(e){return e[k.value]})).indexOf(t[k.value])})):G.value.filter((function(t){return t[k.value]!=e[k.value]})))}o.emit("deselect",ge(e),e)},ge=function(e){return A.value?e:e[k.value]},be=function(e){fe(e)},me=function(){o.emit("clear"),U(ve.value)},De=function(e){if(void 0!==e.group)return"single"!==f.value&&(Fe(e[R.value])&&e[R.value].length);switch(f.value){case"single":return!l(G.value)&&G.value[k.value]==e[k.value];case"tags":case"multiple":return!l(G.value)&&-1!==G.value.map((function(e){return e[k.value]})).indexOf(e[k.value])}},he=function(e){return!0===e.disabled},ye=function(){return!(void 0===x||-1===x.value||!le.value&&x.value>0)&&G.value.length>=x.value},Oe=function(e){void 0===Ae(e[k.value])&&ee.value&&(o.emit("tag",e[k.value]),o.emit("option",e[k.value]),te.value&&Ee(e),M())},_e=function(e){return void 0===e.find((function(e){return!De(e)&&!e.disabled}))},Fe=function(e){return void 0===e.find((function(e){return!De(e)}))},Ae=function(e){return ue.value[ue.value.map((function(e){return String(e[k.value])})).indexOf(String(e))]},Se=function(e){return ue.value.map((function(e){return e[ce.value]})).indexOf(e)},Ce=function(e){return-1!==["tags","multiple"].indexOf(f.value)&&m.value&&De(e)},Ee=function(e){Q.value.push(e)},Be=function(e){return V.value?e.filter((function(e){return $.value?e.__VISIBLE__.length:e[R.value].length})):e.filter((function(e){return!$.value||e.__VISIBLE__.length}))},Pe=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],u=e;return $.value&&P.value&&(u=u.filter((function(e){return-1!==r(e[ce.value],T.value).indexOf(r($.value,T.value))}))),m.value&&t&&(u=u.filter((function(e){return!Ce(e)}))),u},Le=function(e){var t,u=e;return t=u,"[object Object]"===Object.prototype.toString.call(t)&&(u=Object.keys(u).map((function(e){var t,n=u[e];return c(t={},k.value,e),c(t,ce.value,n),c(t,y.value,n),t}))),u=u.map((function(e){var t;return"object"===i(e)?e:(c(t={},k.value,e),c(t,ce.value,e),c(t,y.value,e),t)}))},we=function(){l(H.value)||(G.value=qe(H.value))},ke=function(e){Z.value=!0,d.value($.value).then((function(t){Y.value=t,"function"==typeof e&&e(t),Z.value=!1}))},qe=function(e){return l(e)?"single"===f.value?{}:[]:A.value?e:"single"===f.value?Ae(e)||{}:e.filter((function(e){return!!Ae(e)})).map((function(e){return Ae(e)}))};if("single"!==f.value&&!l(H.value)&&!Array.isArray(H.value))throw new Error('v-model must be an array when using "'.concat(f.value,'" mode'));return d&&"function"==typeof d.value?E.value?ke(we):1==A.value&&we():(Y.value=d.value,we()),C.value>-1&&n($,(function(e){e.lengthe.length)&&(t=e.length);for(var u=0,n=new Array(t);ue.length)&&(t=e.length);for(var u=0,n=new Array(t);u[]},id:{type:[String,Number],required:!1},name:{type:[String,Number],required:!1,default:"multiselect"},disabled:{type:Boolean,required:!1,default:!1},label:{type:String,required:!1,default:"label"},trackBy:{type:String,required:!1,default:void 0},valueProp:{type:String,required:!1,default:"value"},placeholder:{type:String,required:!1,default:null},mode:{type:String,required:!1,default:"single"},searchable:{type:Boolean,required:!1,default:!1},limit:{type:Number,required:!1,default:-1},hideSelected:{type:Boolean,required:!1,default:!0},createTag:{type:Boolean,required:!1,default:void 0},createOption:{type:Boolean,required:!1,default:void 0},appendNewTag:{type:Boolean,required:!1,default:void 0},appendNewOption:{type:Boolean,required:!1,default:void 0},addTagOn:{type:Array,required:!1,default:void 0},addOptionOn:{type:Array,required:!1,default:void 0},caret:{type:Boolean,required:!1,default:!0},loading:{type:Boolean,required:!1,default:!1},noOptionsText:{type:String,required:!1,default:"The list is empty"},noResultsText:{type:String,required:!1,default:"No results found"},multipleLabel:{type:Function,required:!1},object:{type:Boolean,required:!1,default:!1},delay:{type:Number,required:!1,default:-1},minChars:{type:Number,required:!1,default:0},resolveOnLoad:{type:Boolean,required:!1,default:!0},filterResults:{type:Boolean,required:!1,default:!0},clearOnSearch:{type:Boolean,required:!1,default:!1},clearOnSelect:{type:Boolean,required:!1,default:!0},canDeselect:{type:Boolean,required:!1,default:!0},canClear:{type:Boolean,required:!1,default:!0},max:{type:Number,required:!1,default:-1},showOptions:{type:Boolean,required:!1,default:!0},required:{type:Boolean,required:!1,default:!1},openDirection:{type:String,required:!1,default:"bottom"},nativeSupport:{type:Boolean,required:!1,default:!1},classes:{type:Object,required:!1,default:()=>({})},strict:{type:Boolean,required:!1,default:!0},closeOnSelect:{type:Boolean,required:!1,default:!0},autocomplete:{type:String,required:!1},groups:{type:Boolean,required:!1,default:!1},groupLabel:{type:String,required:!1,default:"label"},groupOptions:{type:String,required:!1,default:"options"},groupHideEmpty:{type:Boolean,required:!1,default:!1},groupSelect:{type:Boolean,required:!1,default:!0},inputType:{type:String,required:!1,default:"text"}},setup(r,i){const o=function(n,a){var l=e(n),r=l.value,i=l.modelValue,o=l.mode,s=l.valueProp,c=t("single"!==o.value?[]:{}),v=void 0!==a.expose?i:r,p=u((function(){return"single"===o.value?c.value[s.value]:c.value.map((function(e){return e[s.value]}))})),d=u((function(){return"single"!==o.value?c.value.map((function(e){return e[s.value]})).join(","):c.value[s.value]}));return{iv:c,internalValue:c,ev:v,externalValue:v,textValue:d,plainValue:p}}(r,i),s=function(u,n,a){var l=e(u),r=l.groupSelect,i=l.mode,o=l.groups,s=t(null),c=function(e){void 0===e||null!==e&&e.disabled||o.value&&e&&e.group&&("single"===i.value||!r.value)||(s.value=e)};return{pointer:s,setPointer:c,clearPointer:function(){c(null)}}}(r),c=function(u,n,a){var l=e(u).disabled,r=t(!1);return{isOpen:r,open:function(){r.value||l.value||(r.value=!0,n.emit("open"))},close:function(){r.value&&(r.value=!1,n.emit("close"))}}}(r,i),d=function(e,u,a){var l=t(null),r=t(null);return n(l,(function(e){u.emit("search-change",e)})),{search:l,input:r,clearSearch:function(){l.value=""},handleSearchInput:function(e){l.value=e.target.value},handlePaste:function(e){u.emit("paste",e)}}}(0,i),g=function(t,u,n){var a=e(t),r=a.object,i=a.valueProp,o=a.mode,s=n.iv,c=function(e){return r.value||l(e)?e:Array.isArray(e)?e.map((function(e){return e[i.value]})):e[i.value]},v=function(e){return l(e)?"single"===o.value?{}:[]:e};return{update:function(e){s.value=v(e);var t=c(e);u.emit("change",t),u.emit("input",t),u.emit("update:modelValue",t)}}}(r,i,{iv:o.iv}),b=function(n,a,l){var r=e(n),i=r.searchable,o=r.disabled,s=l.input,c=l.open,v=l.close,p=l.clearSearch,d=t(null),f=t(!1),g=u((function(){return i.value||o.value?-1:0})),b=function(){i.value&&s.value.blur(),d.value.blur()},m=function(){i.value&&!o.value&&s.value.focus()},D=function(){f.value=!1,setTimeout((function(){f.value||(v(),p())}),1)};return{multiselect:d,tabindex:g,isActive:f,blur:b,focus:m,handleFocus:function(){m()},activate:function(){o.value||(f.value=!0,c())},deactivate:D,handleCaretClick:function(){D(),b()}}}(r,0,{input:d.input,open:c.open,close:c.close,clearSearch:d.clearSearch}),m=v(r,i,{ev:o.ev,iv:o.iv,search:d.search,clearSearch:d.clearSearch,update:g.update,pointer:s.pointer,clearPointer:s.clearPointer,blur:b.blur,focus:b.focus,deactivate:b.deactivate}),h=function(t,l,r){var i=e(t),o=i.valueProp,s=i.showOptions,c=i.searchable,v=i.groupLabel,d=i.groups,f=i.mode,g=i.groupSelect,b=r.fo,m=r.fg,D=r.handleOptionClick,h=r.handleGroupClick,y=r.search,O=r.pointer,_=r.setPointer,F=r.clearPointer,A=r.multiselect,S=u((function(){return b.value.filter((function(e){return!e.disabled}))})),C=u((function(){return m.value.filter((function(e){return!e.disabled}))})),E=u((function(){return"single"!==f.value&&g.value})),B=u((function(){return O.value&&O.value.group})),P=u((function(){return V(O.value)})),L=u((function(){var e=B.value?O.value:V(O.value),t=C.value.map((function(e){return e[v.value]})).indexOf(e[v.value]),u=C.value[t-1];return void 0===u&&(u=k.value),u})),w=u((function(){var e=C.value.map((function(e){return e.label})).indexOf(B.value?O.value[v.value]:V(O.value)[v.value])+1;return C.value.length<=e&&(e=0),C.value[e]})),k=u((function(){return p(C.value).slice(-1)[0]})),q=u((function(){return O.value.__VISIBLE__.filter((function(e){return!e.disabled}))[0]})),x=u((function(){var e=P.value.__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(O.value[o.value])-1]})),T=u((function(){var e=V(O.value).__VISIBLE__.filter((function(e){return!e.disabled}));return e[e.map((function(e){return e[o.value]})).indexOf(O.value[o.value])+1]})),j=u((function(){return p(L.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),I=u((function(){return p(k.value.__VISIBLE__.filter((function(e){return!e.disabled}))).slice(-1)[0]})),R=function(){_(S.value[0]||null)},V=function(e){return C.value.find((function(t){return-1!==t.__VISIBLE__.map((function(e){return e[o.value]})).indexOf(e[o.value])}))},N=function(){var e=A.value.querySelector("[data-pointed]");if(e){var t=e.parentElement.parentElement;d.value&&(t=B.value?e.parentElement.parentElement.parentElement:e.parentElement.parentElement.parentElement.parentElement),e.offsetTop+e.offsetHeight>t.clientHeight+t.scrollTop&&(t.scrollTop=e.offsetTop+e.offsetHeight-t.clientHeight),e.offsetTop