mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
Set awesomplete input value on value change
This commit is contained in:
parent
0cef55e0aa
commit
8d8b75bce8
@ -35,6 +35,7 @@ export default {
|
|||||||
minChars: 0,
|
minChars: 0,
|
||||||
maxItems: 99,
|
maxItems: 99,
|
||||||
sort: this.sort(),
|
sort: this.sort(),
|
||||||
|
filter: this.filter(),
|
||||||
item: (text, input) => {
|
item: (text, input) => {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
li.classList.add('dropdown-item');
|
li.classList.add('dropdown-item');
|
||||||
@ -52,7 +53,10 @@ export default {
|
|||||||
|
|
||||||
},
|
},
|
||||||
sort() {
|
sort() {
|
||||||
//
|
// return a function that handles sorting of items
|
||||||
|
},
|
||||||
|
filter() {
|
||||||
|
// return a function that filters list suggestions based on input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
import frappe from 'frappejs';
|
import frappe from 'frappejs';
|
||||||
import feather from 'feather-icons';
|
import feather from 'feather-icons';
|
||||||
|
import Awesomplete from 'awesomplete';
|
||||||
import Autocomplete from './Autocomplete';
|
import Autocomplete from './Autocomplete';
|
||||||
import Form from '../Form/Form';
|
import Form from '../Form/Form';
|
||||||
import { _ } from 'frappejs/utils';
|
import { _ } from 'frappejs/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
extends: Autocomplete,
|
extends: Autocomplete,
|
||||||
|
watch: {
|
||||||
|
value(newValue) {
|
||||||
|
this.$refs.input.value = newValue;
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getList(query) {
|
async getList(query) {
|
||||||
const list = await frappe.db.getAll({
|
const list = await frappe.db.getAll({
|
||||||
@ -45,6 +51,14 @@ export default {
|
|||||||
return a.value > b.value;
|
return a.value > b.value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
filter() {
|
||||||
|
return (suggestion, txt) => {
|
||||||
|
if (suggestion.value === '__newItem') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return Awesomplete.FILTER_CONTAINS(suggestion, txt);
|
||||||
|
}
|
||||||
|
},
|
||||||
bindEvents() {
|
bindEvents() {
|
||||||
const input = this.$refs.input;
|
const input = this.$refs.input;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user