mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-21 03:42:54 +00:00
Fix #4005
This commit is contained in:
2
public/v1/js/create_transaction.js
vendored
2
public/v1/js/create_transaction.js
vendored
File diff suppressed because one or more lines are too long
2
public/v1/js/edit_transaction.js
vendored
2
public/v1/js/edit_transaction.js
vendored
File diff suppressed because one or more lines are too long
@@ -50,10 +50,19 @@
|
|||||||
:async-function="aSyncFunction"
|
:async-function="aSyncFunction"
|
||||||
:open-on-empty=true
|
:open-on-empty=true
|
||||||
:open-on-focus=true
|
:open-on-focus=true
|
||||||
|
ref="typea"
|
||||||
:target="target"
|
:target="target"
|
||||||
item-key="name"
|
item-key="name"
|
||||||
v-on:input="selectedItem"
|
v-on:input="selectedItem"
|
||||||
></typeahead>
|
>
|
||||||
|
<template slot="item" slot-scope="props">
|
||||||
|
<li v-for="(item, index) in props.items" :class="{active:props.activeIndex===index}">
|
||||||
|
<a role="button" @click="props.select(item)">
|
||||||
|
<span v-html="betterHighlight(item)"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</template>
|
||||||
|
</typeahead>
|
||||||
<ul v-for="error in this.error" class="list-unstyled">
|
<ul v-for="error in this.error" class="list-unstyled">
|
||||||
<li class="text-danger">{{ error }}</li>
|
<li class="text-danger">{{ error }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -78,10 +87,12 @@ export default {
|
|||||||
categoryAutoCompleteURI: null,
|
categoryAutoCompleteURI: null,
|
||||||
name: null,
|
name: null,
|
||||||
target: null,
|
target: null,
|
||||||
|
acKey: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ready() {
|
ready() {
|
||||||
this.name = this.accountName;
|
this.name = this.accountName;
|
||||||
|
this.acKey = 'name';
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.target = this.$refs.input;
|
this.target = this.$refs.input;
|
||||||
@@ -91,6 +102,11 @@ export default {
|
|||||||
hasError: function () {
|
hasError: function () {
|
||||||
return this.error.length > 0;
|
return this.error.length > 0;
|
||||||
},
|
},
|
||||||
|
betterHighlight: function (item) {
|
||||||
|
var inputValue = this.$refs.input.value.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||||
|
var escapedName = this.escapeHtml(item.name);
|
||||||
|
return escapedName.replace(new RegExp(("" + inputValue), 'i'), '<b>$&</b>');
|
||||||
|
},
|
||||||
aSyncFunction: function (query, done) {
|
aSyncFunction: function (query, done) {
|
||||||
axios.get(this.categoryAutoCompleteURI + query)
|
axios.get(this.categoryAutoCompleteURI + query)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -100,7 +116,10 @@ export default {
|
|||||||
for (const key in res.data) {
|
for (const key in res.data) {
|
||||||
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
if (res.data.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
||||||
current = res.data[key];
|
current = res.data[key];
|
||||||
current.name = this.escapeHtml(res.data[key].name)
|
//current.name_html = res.data[key].name;
|
||||||
|
//current.name = this.escapeHtml(res.data[key].name);
|
||||||
|
|
||||||
|
//current.name = res.data[key].name;
|
||||||
escapedData.push(current);
|
escapedData.push(current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user