Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select the content of the field by clicking on it #1141

Merged
merged 2 commits into from
Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/components/ADempiere/Field/FieldNumber.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
@focus="focusGained"
@keydown.native="keyPressed"
@keyup.native="keyReleased"
@keyup.native.enter="select"
/>
<el-input
v-else
Expand All @@ -61,7 +62,6 @@
<script>
import fieldMixin from '@/components/ADempiere/Field/mixin/mixinField.js'
import { FIELDS_CURRENCY, FIELDS_DECIMALS } from '@/utils/ADempiere/references'

export default {
name: 'FieldNumber',
mixins: [fieldMixin],
Expand Down Expand Up @@ -134,7 +134,6 @@ export default {
if (!this.isDecimal) {
return value
}

let options = {
useGrouping: true,
minimumIntegerDigits: 1,
Expand All @@ -150,7 +149,6 @@ export default {
currency: this.currencyCode
}
}

// TODO: Check the grouping of thousands
const formatterInstance = new Intl.NumberFormat(lang, options)
return formatterInstance.format(value)
Expand Down Expand Up @@ -180,6 +178,15 @@ export default {
},
customFocusGained(event) {
this.isFocus = true
// this.focusGained(event)
this.$nextTick(() => {
this.$refs[this.metadata.columnName].focus()
})
},
select() {
this.$nextTick(() => {
this.$refs[this.metadata.columnName].select()
})
},
customFocusLost(event) {
this.isFocus = false
Expand Down Expand Up @@ -239,7 +246,6 @@ export default {
}
}
</script>

<style lang="scss" scoped>
/* Show input width 100% in container */
.el-input-number, .el-input {
Expand Down