@afeefa/vue-app 0.0.58 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.58
1
+ 0.0.59
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.58",
3
+ "version": "0.0.59",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -8,11 +8,13 @@
8
8
  >
9
9
  <template #activator="{ on, attrs }">
10
10
  <v-combobox
11
+ ref="input"
11
12
  :value="formattedDate"
12
13
  :label="label"
13
14
  :style="cwm_widthStyle"
14
15
  readonly
15
16
  v-bind="attrs"
17
+ :rules="validationRules"
16
18
  v-on="on"
17
19
  @click.native="on.click"
18
20
  />
@@ -37,7 +39,7 @@ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
37
39
  props: ['value', 'validator']
38
40
  })
39
41
  export default class ADatePicker extends Mixins(ComponentWidthMixin) {
40
- value_ = new Date()
42
+ value_ = null
41
43
  menu = false
42
44
 
43
45
  created () {
@@ -26,8 +26,17 @@ export default class EditForm extends Vue {
26
26
  valid = false
27
27
  lastJson = null
28
28
 
29
- created () {
29
+ /**
30
+ * This will be triggered after the this.model has been set
31
+ * but before sub components may have changed model values
32
+ * as a date field, which could turn a null to a default date.
33
+ * Using the created() method would result in already having set
34
+ * the default date, hence not detecting a valid "change" anymore.
35
+ */
36
+ @Watch('model', {immediate: true})
37
+ modelChanged () {
30
38
  this.lastJson = this.json
39
+ this.$emit('update:changed', this.changed)
31
40
  }
32
41
 
33
42
  get json () {
@@ -38,11 +47,6 @@ export default class EditForm extends Vue {
38
47
  return this.json !== this.lastJson
39
48
  }
40
49
 
41
- @Watch('model')
42
- modelChanged () {
43
- this.lastJson = this.json
44
- }
45
-
46
50
  @Watch('valid')
47
51
  validChanged () {
48
52
  this.$emit('update:valid', this.valid)
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div>
3
+ <slot name="fields" />
4
+
5
+ <slot :model="model" />
6
+ </div>
7
+ </template>
8
+
9
+
10
+ <script>
11
+ import { Component, Vue } from '@a-vue'
12
+
13
+ @Component({
14
+ props: ['model']
15
+ })
16
+ export default class NestedEditForm extends Vue {
17
+ EDIT_FORM = true
18
+
19
+ created () {
20
+ if (!this.model) {
21
+ console.warn('Nested edit form does not have a model.')
22
+ }
23
+ }
24
+ }
25
+ </script>
@@ -11,12 +11,14 @@ import FormFieldSelect from './form/fields/FormFieldSelect'
11
11
  import FormFieldSelect2 from './form/fields/FormFieldSelect2'
12
12
  import FormFieldText from './form/fields/FormFieldText'
13
13
  import FormFieldTextArea from './form/fields/FormFieldTextArea'
14
+ import NestedEditForm from './form/NestedEditForm'
14
15
  import ListFilterPage from './list/filters/ListFilterPage'
15
16
  import ListFilterSearch from './list/filters/ListFilterSearch'
16
17
  import ListFilterSelect from './list/filters/ListFilterSelect'
17
18
  import ListFilterRow from './list/ListFilterRow'
18
19
 
19
20
  Vue.component('EditForm', EditForm)
21
+ Vue.component('NestedEditForm', NestedEditForm)
20
22
  Vue.component('EditModal', EditModal)
21
23
  Vue.component('FormFieldText', FormFieldText)
22
24
  Vue.component('FormFieldTextArea', FormFieldTextArea)
@@ -23,14 +23,6 @@
23
23
  </v-btn>
24
24
  </app-bar-button>
25
25
 
26
- <component
27
- :is="Component"
28
- v-if="false"
29
- :model="modelToEdit"
30
- :valid.sync="valid"
31
- :changed.sync="changed"
32
- />
33
-
34
26
  <edit-form
35
27
  :model="modelToEdit"
36
28
  :valid.sync="valid"
@@ -83,14 +75,12 @@ export default class EditPage extends Mixins(EditPageMixin) {
83
75
 
84
76
  this.model_ = this.model
85
77
  this.reset()
86
- this.$emit('model', this.modelToEdit)
87
78
  }
88
79
 
89
80
  @Watch('model')
90
81
  modelChanged () {
91
82
  this.model_ = this.model
92
83
  this.reset()
93
- this.$emit('model', this.modelToEdit)
94
84
  }
95
85
 
96
86
  get editConfig () {
@@ -1,6 +1,6 @@
1
+ import { Component, Vue } from '@a-vue'
1
2
  import { SaveAction } from '@a-vue/api-resources/ApiActions'
2
3
  import { DialogEvent } from '@a-vue/events'
3
- import { Component, Vue } from '@a-vue'
4
4
 
5
5
  @Component({
6
6
  props: ['saveAction']
@@ -79,6 +79,7 @@ export class EditPageMixin extends Vue {
79
79
 
80
80
  reset () {
81
81
  this.modelToEdit = this.createModelToEdit()
82
+ this.$emit('model', this.modelToEdit)
82
83
  }
83
84
 
84
85
  afterSave (_model) {