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AaD,aAdD;AAeD,SAzJM;AA0JP,kBA1JO,wBA0JG;AACR,iBAAK,kBAAL;AACD,SA5JM;AA6JP,0BA7JO,gCA6JW;AAChB,gBAAI,CAAC,KAAK,aAAN,IACF,CAAC,KAAK,aADR,EAEE;AAEF,gBAAI,CAAC,KAAK,eAAL,CACH,KAAK,cADF,EAEH,KAAK,QAAL,CAAc,KAAK,aAAnB,CAFG,CAAL,EAGG;AACD,qBAAK,SAAL;AACD;AACF,SAxKM;AAyKP,eAzKO,mBAyKE,IAzKF,EAyKM;AACX,mBAAO,KAAK,cAAL,CAAoB,OAApB,CAA4B,KAAK,QAAL,CAAc,IAAd,CAA5B,IAAmD,CAAC,CAA3D;AACD;AA3KM;AAzLmB,CAAf,C","sourcesContent":["// Styles\nimport '../../stylus/components/_autocompletes.styl'\n\n// Extensions\nimport VSelect, { defaultMenuProps as VSelectMenuProps } from '../VSelect/VSelect'\nimport VTextField from '../VTextField/VTextField'\n\n// Utils\nimport { keyCodes } from '../../util/helpers'\n\nconst defaultMenuProps = {\n ...VSelectMenuProps,\n offsetY: true,\n offsetOverflow: true,\n transition: false\n}\n\n/* @vue/component */\nexport default VSelect.extend({\n name: 'v-autocomplete',\n\n props: {\n allowOverflow: {\n type: Boolean,\n default: true\n },\n browserAutocomplete: {\n type: String,\n default: 'off'\n },\n filter: {\n type: Function,\n default: (item, queryText, itemText) => {\n return itemText.toLocaleLowerCase().indexOf(queryText.toLocaleLowerCase()) > -1\n }\n },\n hideNoData: Boolean,\n noFilter: Boolean,\n searchInput: {\n default: undefined\n },\n menuProps: {\n type: VSelect.options.props.menuProps.type,\n default: () => defaultMenuProps\n },\n autoSelectFirst: {\n type: Boolean,\n default: false\n }\n },\n\n data: vm => ({\n attrsInput: null,\n lazySearch: vm.searchInput\n }),\n\n computed: {\n classes () {\n return Object.assign({}, VSelect.options.computed.classes.call(this), {\n 'v-autocomplete': true,\n 'v-autocomplete--is-selecting-index': this.selectedIndex > -1\n })\n },\n computedItems () {\n return this.filteredItems\n },\n selectedValues () {\n return this.selectedItems.map(item => this.getValue(item))\n },\n hasDisplayedItems () {\n return this.hideSelected\n ? this.filteredItems.some(item => !this.hasItem(item))\n : this.filteredItems.length > 0\n },\n /**\n * The range of the current input text\n *\n * @return {Number}\n */\n currentRange () {\n if (this.selectedItem == null) return 0\n\n return this.getText(this.selectedItem).toString().length\n },\n filteredItems () {\n if (!this.isSearching || this.noFilter || this.internalSearch == null) return this.allItems\n\n return this.allItems.filter(item => this.filter(item, this.internalSearch.toString(), this.getText(item).toString()))\n },\n internalSearch: {\n get () {\n return this.lazySearch\n },\n set (val) {\n this.lazySearch = val\n\n this.$emit('update:searchInput', val)\n }\n },\n isAnyValueAllowed () {\n return false\n },\n isDirty () {\n return this.searchIsDirty || this.selectedItems.length > 0\n },\n isSearching () {\n if (this.multiple) return this.searchIsDirty\n\n return (\n this.searchIsDirty &&\n this.internalSearch !== this.getText(this.selectedItem)\n )\n },\n menuCanShow () {\n if (!this.isFocused) return false\n\n return this.hasDisplayedItems || !this.hideNoData\n },\n $_menuProps () {\n const props = VSelect.options.computed.$_menuProps.call(this)\n props.contentClass = `v-autocomplete__content ${props.contentClass || ''}`.trim()\n return {\n ...defaultMenuProps,\n ...props\n }\n },\n searchIsDirty () {\n return this.internalSearch != null &&\n this.internalSearch !== ''\n },\n selectedItem () {\n if (this.multiple) return null\n\n return this.selectedItems.find(i => {\n return this.valueComparator(this.getValue(i), this.getValue(this.internalValue))\n })\n },\n listData () {\n const data = VSelect.options.computed.listData.call(this)\n\n Object.assign(data.props, {\n items: this.virtualizedItems,\n noFilter: (\n this.noFilter ||\n !this.isSearching ||\n !this.filteredItems.length\n ),\n searchInput: this.internalSearch\n })\n\n return data\n }\n },\n\n watch: {\n filteredItems (val) {\n this.onFilteredItemsChanged(val)\n },\n internalValue () {\n this.setSearch()\n },\n isFocused (val) {\n if (val) {\n this.$refs.input &&\n this.$refs.input.select()\n } else {\n this.updateSelf()\n }\n },\n isMenuActive (val) {\n if (val || !this.hasSlot) return\n\n this.lazySearch = null\n },\n items (val, oldVal) {\n // If we are focused, the menu\n // is not active, hide no data is enabled,\n // and items change\n // User is probably async loading\n // items, try to activate the menu\n if (\n !(oldVal && oldVal.length) &&\n this.hideNoData &&\n this.isFocused &&\n !this.isMenuActive &&\n val.length\n ) this.activateMenu()\n },\n searchInput (val) {\n this.lazySearch = val\n },\n internalSearch (val) {\n this.onInternalSearchChanged(val)\n },\n itemText () {\n this.updateSelf()\n }\n },\n\n created () {\n this.setSearch()\n },\n\n methods: {\n onFilteredItemsChanged (val) {\n this.setMenuIndex(-1)\n\n this.$nextTick(() => {\n this.setMenuIndex(val.length > 0 && (val.length === 1 || this.autoSelectFirst) ? 0 : -1)\n })\n },\n onInternalSearchChanged (val) {\n this.updateMenuDimensions()\n },\n updateMenuDimensions () {\n if (this.isMenuActive &&\n this.$refs.menu\n ) {\n this.$refs.menu.updateDimensions()\n }\n },\n changeSelectedIndex (keyCode) {\n // Do not allow changing of selectedIndex\n // when search is dirty\n if (this.searchIsDirty) return\n\n if (![\n keyCodes.backspace,\n keyCodes.left,\n keyCodes.right,\n keyCodes.delete\n ].includes(keyCode)) return\n\n const indexes = this.selectedItems.length - 1\n\n if (keyCode === keyCodes.left) {\n this.selectedIndex = this.selectedIndex === -1\n ? indexes\n : this.selectedIndex - 1\n } else if (keyCode === keyCodes.right) {\n this.selectedIndex = this.selectedIndex >= indexes\n ? -1\n : this.selectedIndex + 1\n } else if (this.selectedIndex === -1) {\n this.selectedIndex = indexes\n return\n }\n\n const currentItem = this.selectedItems[this.selectedIndex]\n\n if ([\n keyCodes.backspace,\n keyCodes.delete\n ].includes(keyCode) &&\n !this.getDisabled(currentItem)\n ) {\n const newIndex = this.selectedIndex === indexes\n ? this.selectedIndex - 1\n : this.selectedItems[this.selectedIndex + 1]\n ? this.selectedIndex\n : -1\n\n if (newIndex === -1) {\n this.setValue(this.multiple ? [] : undefined)\n } else {\n this.selectItem(currentItem)\n }\n\n this.selectedIndex = newIndex\n }\n },\n clearableCallback () {\n this.internalSearch = undefined\n\n VSelect.options.methods.clearableCallback.call(this)\n },\n genInput () {\n const input = VTextField.options.methods.genInput.call(this)\n\n input.data.attrs.role = 'combobox'\n input.data.domProps.value = this.internalSearch\n\n return input\n },\n genSelections () {\n return this.hasSlot || this.multiple\n ? VSelect.options.methods.genSelections.call(this)\n : []\n },\n onClick () {\n if (this.isDisabled) return\n\n this.selectedIndex > -1\n ? (this.selectedIndex = -1)\n : this.onFocus()\n\n this.activateMenu()\n },\n onEnterDown () {\n // Avoid invoking this method\n // will cause updateSelf to\n // be called emptying search\n },\n onInput (e) {\n if (this.selectedIndex > -1) return\n\n // If typing and menu is not currently active\n if (e.target.value) {\n this.activateMenu()\n if (!this.isAnyValueAllowed) this.setMenuIndex(0)\n }\n\n this.mask && this.resetSelections(e.target)\n this.internalSearch = e.target.value\n this.badInput = e.target.validity && e.target.validity.badInput\n },\n onKeyDown (e) {\n const keyCode = e.keyCode\n\n VSelect.options.methods.onKeyDown.call(this, e)\n\n // The ordering is important here\n // allows new value to be updated\n // and then moves the index to the\n // proper location\n this.changeSelectedIndex(keyCode)\n },\n onTabDown (e) {\n VSelect.options.methods.onTabDown.call(this, e)\n this.updateSelf()\n },\n setSelectedItems () {\n VSelect.options.methods.setSelectedItems.call(this)\n\n // #4273 Don't replace if searching\n // #4403 Don't replace if focused\n if (!this.isFocused) this.setSearch()\n },\n setSearch () {\n // Wait for nextTick so selectedItem\n // has had time to update\n this.$nextTick(() => {\n this.internalSearch = (\n this.multiple &&\n this.internalSearch &&\n this.isMenuActive\n )\n ? this.internalSearch\n : (\n !this.selectedItems.length ||\n this.multiple ||\n this.hasSlot\n )\n ? null\n : this.getText(this.selectedItem)\n })\n },\n updateSelf () {\n this.updateAutocomplete()\n },\n updateAutocomplete () {\n if (!this.searchIsDirty &&\n !this.internalValue\n ) return\n\n if (!this.valueComparator(\n this.internalSearch,\n this.getValue(this.internalValue)\n )) {\n this.setSearch()\n }\n },\n hasItem (item) {\n return this.selectedValues.indexOf(this.getValue(item)) > -1\n }\n }\n})\n"],"sourceRoot":""}
|