@afeefa/vue-app 0.0.96 → 0.0.97
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.97
|
package/package.json
CHANGED
@@ -58,10 +58,7 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
|
|
58
58
|
}
|
59
59
|
|
60
60
|
mounted () {
|
61
|
-
|
62
|
-
this.$refs.input.validate(true)
|
63
|
-
}
|
64
|
-
this.$refs.input.validate(true)
|
61
|
+
this.validate()
|
65
62
|
}
|
66
63
|
|
67
64
|
@Watch('value')
|
@@ -71,6 +68,10 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
|
|
71
68
|
|
72
69
|
@Watch('value_')
|
73
70
|
value_Changed () { // validate on any change
|
71
|
+
this.validateDateValue()
|
72
|
+
}
|
73
|
+
|
74
|
+
validateDateValue () {
|
74
75
|
this.errorMessages = []
|
75
76
|
if (this.validator) {
|
76
77
|
const rules = this.validator.getRules(this.label)
|
@@ -130,6 +131,10 @@ export default class ADatePicker extends Mixins(ComponentWidthMixin) {
|
|
130
131
|
return formatDate(new Date(date))
|
131
132
|
}
|
132
133
|
|
134
|
+
validate () {
|
135
|
+
this.validateDateValue()
|
136
|
+
}
|
137
|
+
|
133
138
|
get validationRules () {
|
134
139
|
if (this.type !== 'month') {
|
135
140
|
const dateFormat = v => {
|
@@ -32,10 +32,15 @@ export default class EditForm extends Vue {
|
|
32
32
|
lastJson = null
|
33
33
|
forcedUnchange = false
|
34
34
|
|
35
|
+
|
35
36
|
created () {
|
36
37
|
this.reset()
|
37
38
|
}
|
38
39
|
|
40
|
+
validate () {
|
41
|
+
this.$refs.form.validate()
|
42
|
+
}
|
43
|
+
|
39
44
|
getField = name => {
|
40
45
|
const modelType = this.$apiResources.getType(this.model.type)
|
41
46
|
const update = !!this.model.id
|
@@ -100,9 +100,7 @@ export class FormFieldMixin extends Vue {
|
|
100
100
|
get validator () {
|
101
101
|
const validator = this.field.getValidator()
|
102
102
|
if (this.additionalRules) {
|
103
|
-
this.additionalRules
|
104
|
-
validator.addRule(validate)
|
105
|
-
})
|
103
|
+
validator.setAdditionalRules(this.additionalRules)
|
106
104
|
}
|
107
105
|
return this.field.getValidator()
|
108
106
|
}
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<template>
|
2
2
|
<a-date-picker
|
3
|
+
ref="datePicker"
|
3
4
|
v-model="model[name]"
|
4
5
|
:label="label || name"
|
5
6
|
:validator="validator"
|
6
7
|
v-bind="$attrs"
|
8
|
+
v-on="$listeners"
|
7
9
|
/>
|
8
10
|
</template>
|
9
11
|
|
@@ -13,5 +15,8 @@ import { FormFieldMixin } from '../FormFieldMixin'
|
|
13
15
|
|
14
16
|
@Component
|
15
17
|
export default class FormFieldDate extends Mixins(FormFieldMixin) {
|
18
|
+
validate () {
|
19
|
+
this.$refs.datePicker.validate()
|
20
|
+
}
|
16
21
|
}
|
17
22
|
</script>
|