Reimplement SaveButton disabled until input change

This commit is contained in:
leigh-mil
2019-06-13 14:34:55 -04:00
parent ab761d9d88
commit 5be4efb9d9
9 changed files with 323 additions and 267 deletions

View File

@@ -20,6 +20,10 @@ export default {
mindate: { type: String },
maxdate: { type: String },
nameTag: { type: String },
watch: {
type: Boolean,
default: false,
},
},
data: function() {
@@ -138,7 +142,11 @@ export default {
methods: {
_emitChange: function(name, value, valid) {
emitEvent('field-change', this, { value, name })
emitEvent('field-change', this, {
value: value,
name: name,
watch: this.watch,
})
},
},

View File

@@ -1,3 +1,5 @@
import stickybits from 'stickybits'
import ClinFields from '../clin_fields'
import DateSelector from '../date_selector'
import FormMixin from '../../mixins/form'
@@ -40,4 +42,12 @@ export default {
++this.clinIndex
},
},
directives: {
sticky: {
inserted: el => {
stickybits(el)
},
},
},
}

View File

@@ -27,6 +27,10 @@ export default {
paragraph: String,
noMaxWidth: String,
optional: Boolean,
watch: {
type: Boolean,
default: false,
},
},
data: function() {
@@ -122,6 +126,7 @@ export default {
value: this._rawValue(value),
valid,
name: this.name,
watch: this.watch,
})
},

View File

@@ -1,6 +1,7 @@
import createNumberMask from 'text-mask-addons/dist/createNumberMask'
import { conformToMask } from 'vue-text-mask'
import { emitEvent } from '../lib/emitters'
import FormMixin from '../mixins/form'
import textinput from './text_input'
import optionsinput from './options_input'
@@ -22,6 +23,10 @@ export default {
initialErrors: {
type: Boolean,
},
watch: {
type: Boolean,
default: false,
},
},
data: function() {
@@ -38,6 +43,12 @@ export default {
this.attachment = e.target.value
this.showErrors = false
this.changed = true
emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
watch: this.watch,
})
},
removeAttachment: function(e) {
e.preventDefault()
@@ -47,6 +58,12 @@ export default {
}
this.showErrors = false
this.changed = true
emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
watch: this.watch,
})
},
},