@enso-ui/typeahead 3.0.8 → 3.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enso-ui/typeahead",
3
- "version": "3.0.8",
3
+ "version": "3.0.12",
4
4
  "description": "Vue Typeahead",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <typeahead v-bind="$attrs"
2
+ <typeahead
3
+ :http="http"
3
4
  :i18n="i18n"
4
5
  :source="source ? route(source) : null"
5
6
  :error-handler="errorHandler"
@@ -23,7 +24,7 @@ export default {
23
24
 
24
25
  components: { Typeahead },
25
26
 
26
- inject: ['errorHandler', 'i18n', 'route'],
27
+ inject: ['errorHandler', 'http', 'i18n', 'route'],
27
28
 
28
29
  props: {
29
30
  source: {
@@ -1,11 +1,12 @@
1
1
  <template>
2
- <core-typeahead v-bind="$attrs"
2
+ <core-typeahead
3
3
  ref="typeahead">
4
4
  <template #default="{
5
5
  addTag, canAddTag, clearBindings, controlEvents, disabled,
6
6
  invalidQuery, highlight, i18n, inputBindings, inputEvents,
7
7
  itemEvents, items, label, loading, minQueryLength,
8
- modeSelector, modeBindings, modeEvents, query, searchControl,
8
+ modeSelector, modeBindings, modeEvents,
9
+ readonly, query, searchControl,
9
10
  }">
10
11
  <dropdown class="typeahead"
11
12
  :class="$attrs.class"
@@ -23,6 +24,7 @@
23
24
  ]"
24
25
  v-bind="inputBindings"
25
26
  type="text"
27
+ :readonly="readonly"
26
28
  :disabled="disabled"
27
29
  :placeholder="i18n(placeholder)"
28
30
  @keydown="$emit('keydown', $event)"
@@ -29,6 +29,10 @@ export default {
29
29
  type: Boolean,
30
30
  default: false,
31
31
  },
32
+ http: {
33
+ required: true,
34
+ type: Function,
35
+ },
32
36
  i18n: {
33
37
  type: Function,
34
38
  default: v => v,
@@ -49,6 +53,10 @@ export default {
49
53
  type: Object,
50
54
  default: null,
51
55
  },
56
+ readonly: {
57
+ type: Boolean,
58
+ default: false,
59
+ },
52
60
  regExp: {
53
61
  type: RegExp,
54
62
  default() {
@@ -159,10 +167,10 @@ export default {
159
167
  this.ongoingRequest.cancel();
160
168
  }
161
169
 
162
- this.ongoingRequest = axios.CancelToken.source();
170
+ this.ongoingRequest = this.http.CancelToken.source();
163
171
  this.loading = true;
164
172
 
165
- axios.get(this.source, {
173
+ this.http.get(this.source, {
166
174
  params: this.requestParams,
167
175
  cancelToken: this.ongoingRequest.token,
168
176
  }).then(({ data }) => {
@@ -217,7 +225,7 @@ export default {
217
225
  invalidQuery: this.invalidQuery,
218
226
  highlight: this.highlight,
219
227
  i18n: this.i18n,
220
- inputBindings: { modelValue: this.query },
228
+ inputBindings: { value: this.query },
221
229
  inputEvents: selection => ({
222
230
  input: e => {
223
231
  this.query = e.target.value;
@@ -257,6 +265,7 @@ export default {
257
265
  change: this.fetch,
258
266
  },
259
267
  modeSelector: this.modeSelector,
268
+ readonly: this.readonly,
260
269
  query: this.query,
261
270
  searchControl: this.searchControl,
262
271
  });