From fb0cf6454982a371e68b22e29b0374507425242d Mon Sep 17 00:00:00 2001
From: Xiaofeng An <futureweb2020@yandex.com>
Date: Fri, 8 Feb 2019 10:49:14 -0500
Subject: #255 - make AutoCompleteInput component

---
 .../autocomplete_input/autocomplete_input.vue      | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 src/components/autocomplete_input/autocomplete_input.vue

(limited to 'src/components/autocomplete_input/autocomplete_input.vue')

diff --git a/src/components/autocomplete_input/autocomplete_input.vue b/src/components/autocomplete_input/autocomplete_input.vue
new file mode 100644
index 00000000..1c049891
--- /dev/null
+++ b/src/components/autocomplete_input/autocomplete_input.vue
@@ -0,0 +1,34 @@
+<template>
+  <div>
+    <textarea
+      ref="textarea"
+      :value="text"
+      @input="text = $event.target.value, $emit('input', $event.target.value), autoResize && resize($event)" 
+      @click="setCaret"
+      @keyup="setCaret" :placeholder="$t('post_status.default')" rows="1" :class="classObj"
+      @keydown.down="cycleForward"
+      @keydown.up="cycleBackward"
+      @keydown.shift.tab="cycleBackward"
+      @keydown.tab="cycleForward"
+      @keydown.enter="replaceCandidate"
+      @drop="drop && drop()"
+      @dragover.prevent="dragoverPrevent && dragoverPrevent()"
+      @paste="paste && paste()"
+      @keydown.meta.enter="keydownMetaEnter && keydownMetaEnter()"
+      @keyup.ctrl.enter="keyupCtrlEnter && keyupCtrlEnter()">
+    </textarea>
+    <div style="position:relative;" v-if="candidates">
+      <div class="autocomplete-panel">
+        <div v-for="candidate in candidates" @click="replace(candidate.utf || (candidate.screen_name + ' '))">
+          <div class="autocomplete" :class="{ highlighted: candidate.highlighted }">
+            <span v-if="candidate.img"><img :src="candidate.img"></img></span>
+            <span v-else>{{candidate.utf}}</span>
+            <span>{{candidate.screen_name}}<small>{{candidate.name}}</small></span>
+          </div>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script src="./autocomplete_input.js"></script>
-- 
cgit v1.2.3-70-g09d2

