Create emitter function for field-change event
This commit is contained in:
parent
bc0382834b
commit
04b9250ea1
@ -1,3 +1,5 @@
|
|||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'checkboxinput',
|
name: 'checkboxinput',
|
||||||
|
|
||||||
@ -15,7 +17,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onInput: function() {
|
onInput: function() {
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { emitEvent } from '../lib/emitters'
|
import { emitFieldChange, emitEvent } from '../lib/emitters'
|
||||||
import optionsinput from './options_input'
|
import optionsinput from './options_input'
|
||||||
import textinput from './text_input'
|
import textinput from './text_input'
|
||||||
import clindollaramount from './clin_dollar_amount'
|
import clindollaramount from './clin_dollar_amount'
|
||||||
@ -98,7 +98,7 @@ export default {
|
|||||||
} else if (event && event.name.includes(NUMBER)) {
|
} else if (event && event.name.includes(NUMBER)) {
|
||||||
this.clinNumber = event.value
|
this.clinNumber = event.value
|
||||||
}
|
}
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
|
|
||||||
removeClin: function() {
|
removeClin: function() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import { getDaysInMonth } from 'date-fns'
|
import { getDaysInMonth } from 'date-fns'
|
||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
let paddedNumber = function(number) {
|
let paddedNumber = function(number) {
|
||||||
if ((number + '').length === 1) {
|
if ((number + '').length === 1) {
|
||||||
@ -209,7 +210,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onInput: function() {
|
onInput: function() {
|
||||||
this.$parent.$emit('field-change', {
|
emitFieldChange(this, {
|
||||||
value: this.formattedDate,
|
value: this.formattedDate,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
valid: this.isDateValid,
|
valid: this.isDateValid,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'multicheckboxinput',
|
name: 'multicheckboxinput',
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onInput: function(e) {
|
onInput: function(e) {
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
this.showError = false
|
this.showError = false
|
||||||
this.showValid = true
|
this.showValid = true
|
||||||
},
|
},
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'optionsinput',
|
name: 'optionsinput',
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onInput: function() {
|
onInput: function() {
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
|
|
||||||
_isValid: function(value) {
|
_isValid: function(value) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { format } from 'date-fns'
|
import { format } from 'date-fns'
|
||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
import DateSelector from './date_selector'
|
import DateSelector from './date_selector'
|
||||||
|
|
||||||
const START_DATE = 'start_date'
|
const START_DATE = 'start_date'
|
||||||
@ -63,7 +63,7 @@ export default {
|
|||||||
let date = new Date(event.value)
|
let date = new Date(event.value)
|
||||||
this.maxStartDate = this.calcMaxStartDate(date)
|
this.maxStartDate = this.calcMaxStartDate(date)
|
||||||
}
|
}
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
|
|
||||||
calcMaxStartDate: function(date) {
|
calcMaxStartDate: function(date) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { buildUploader } from '../lib/upload'
|
import { buildUploader } from '../lib/upload'
|
||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'uploadinput',
|
name: 'uploadinput',
|
||||||
@ -68,7 +69,7 @@ export default {
|
|||||||
|
|
||||||
this.changed = true
|
this.changed = true
|
||||||
|
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
removeAttachment: function(e) {
|
removeAttachment: function(e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@ -80,7 +81,7 @@ export default {
|
|||||||
this.clearErrors()
|
this.clearErrors()
|
||||||
this.changed = true
|
this.changed = true
|
||||||
|
|
||||||
this.$parent.$emit('field-change')
|
emitFieldChange(this)
|
||||||
},
|
},
|
||||||
clearErrors: function() {
|
clearErrors: function() {
|
||||||
this.uploadError = false
|
this.uploadError = false
|
||||||
|
@ -4,3 +4,7 @@ export const emitEvent = (event_type, el, data) => {
|
|||||||
parent_uid: el.$parent && el.$parent._uid,
|
parent_uid: el.$parent && el.$parent._uid,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const emitFieldChange = (el, data = null) => {
|
||||||
|
el.$parent.$emit('field-change', data)
|
||||||
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import MaskedInput, { conformToMask } from 'vue-text-mask'
|
import MaskedInput, { conformToMask } from 'vue-text-mask'
|
||||||
import inputValidations from '../lib/input_validations'
|
import inputValidations from '../lib/input_validations'
|
||||||
import { formatDollars } from '../lib/dollars'
|
import { formatDollars } from '../lib/dollars'
|
||||||
|
import { emitFieldChange } from '../lib/emitters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'textinput',
|
name: 'textinput',
|
||||||
@ -131,7 +132,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit a change event
|
// Emit a change event
|
||||||
this.$parent.$emit('field-change', {
|
emitFieldChange(this, {
|
||||||
value: this._rawValue(value),
|
value: this._rawValue(value),
|
||||||
name: this.name,
|
name: this.name,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user