| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <script>
- import AutoComplete from "primevue/autocomplete"
- export default {
- name: "PatchedAutoComplete",
- extends: AutoComplete,
- methods: {
- // onFocus(event) {
- // if (this.disabled) {
- // // For ScreenReaders
- // return
- // }
- //
- // if (!this.dirty && this.completeOnFocus) {
- // this.search(event, event.target.value, "focus")
- // }
- //
- // this.dirty = true
- // this.focused = true
- //
- // if (this.overlayVisible) {
- // this.focusedOptionIndex =
- // this.focusedOptionIndex !== -1
- // ? this.focusedOptionIndex
- // : this.overlayVisible && this.autoOptionFocus
- // ? this.findFirstFocusedOptionIndex()
- // : -1
- // this.scrollInView(this.focusedOptionIndex)
- // }
- //
- // this.$emit("focus", event)
- // },
- //
- // onInput(event) {
- // if (this.typeahead) {
- // if (this.searchTimeout) {
- // clearTimeout(this.searchTimeout)
- // }
- //
- // let query = event.target.value
- //
- // if (!this.multiple) {
- // this.updateModel(event, query)
- // }
- //
- // if (query.length === 0 && this.minLength > 0) {
- // this.hide()
- // this.$emit("clear")
- // } else {
- // if (query.length >= this.minLength) {
- // this.focusedOptionIndex = -1
- //
- // this.searchTimeout = setTimeout(() => {
- // this.search(event, query, "input")
- // }, this.delay)
- // } else {
- // this.hide()
- // }
- // }
- // }
- // },
- search(event, query, _) {
- //allow empty string but not undefined or null
- if (query === undefined || query === null) {
- return
- }
- // CHANGED: **DO** search blank values on input change
- //do not search blank values on input change
- // if (source === "input" && query.trim().length === 0) {
- // return
- // }
- this.searching = true
- this.$emit("complete", { originalEvent: event, query })
- }
- }
- }
- </script>
|