PatchedAutoComplete.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <script>
  2. import AutoComplete from "primevue/autocomplete"
  3. export default {
  4. name: "PatchedAutoComplete",
  5. extends: AutoComplete,
  6. methods: {
  7. // onFocus(event) {
  8. // if (this.disabled) {
  9. // // For ScreenReaders
  10. // return
  11. // }
  12. //
  13. // if (!this.dirty && this.completeOnFocus) {
  14. // this.search(event, event.target.value, "focus")
  15. // }
  16. //
  17. // this.dirty = true
  18. // this.focused = true
  19. //
  20. // if (this.overlayVisible) {
  21. // this.focusedOptionIndex =
  22. // this.focusedOptionIndex !== -1
  23. // ? this.focusedOptionIndex
  24. // : this.overlayVisible && this.autoOptionFocus
  25. // ? this.findFirstFocusedOptionIndex()
  26. // : -1
  27. // this.scrollInView(this.focusedOptionIndex)
  28. // }
  29. //
  30. // this.$emit("focus", event)
  31. // },
  32. //
  33. // onInput(event) {
  34. // if (this.typeahead) {
  35. // if (this.searchTimeout) {
  36. // clearTimeout(this.searchTimeout)
  37. // }
  38. //
  39. // let query = event.target.value
  40. //
  41. // if (!this.multiple) {
  42. // this.updateModel(event, query)
  43. // }
  44. //
  45. // if (query.length === 0 && this.minLength > 0) {
  46. // this.hide()
  47. // this.$emit("clear")
  48. // } else {
  49. // if (query.length >= this.minLength) {
  50. // this.focusedOptionIndex = -1
  51. //
  52. // this.searchTimeout = setTimeout(() => {
  53. // this.search(event, query, "input")
  54. // }, this.delay)
  55. // } else {
  56. // this.hide()
  57. // }
  58. // }
  59. // }
  60. // },
  61. search(event, query, _) {
  62. //allow empty string but not undefined or null
  63. if (query === undefined || query === null) {
  64. return
  65. }
  66. // CHANGED: **DO** search blank values on input change
  67. //do not search blank values on input change
  68. // if (source === "input" && query.trim().length === 0) {
  69. // return
  70. // }
  71. this.searching = true
  72. this.$emit("complete", { originalEvent: event, query })
  73. }
  74. }
  75. }
  76. </script>