@afeefa/vue-app 0.0.189 → 0.0.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 0.0.189
1
+ 0.0.191
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.189",
3
+ "version": "0.0.191",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@ import { Component, Vue } from '@a-vue'
2
2
  import { ListAction } from '@a-vue/api-resources/ApiActions'
3
3
 
4
4
  @Component({
5
- props: ['name', 'label', 'additionalRules', 'optionRequestParams']
5
+ props: ['name', 'label', 'customValidator', 'additionalRules', 'optionRequestParams']
6
6
  })
7
7
  export class FormFieldMixin extends Vue {
8
8
  get model () {
@@ -114,11 +114,11 @@ export class FormFieldMixin extends Vue {
114
114
  }
115
115
 
116
116
  get validator () {
117
- const validator = this.field.getValidator()
117
+ const validator = this.customValidator || this.field.getValidator()
118
118
  if (this.additionalRules) {
119
119
  validator.setAdditionalRules(this.additionalRules)
120
120
  }
121
- return this.field.getValidator()
121
+ return validator
122
122
  }
123
123
 
124
124
  get validationRules () {
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <detail-property
3
+ :label="label"
4
+ :icon="icon"
5
+ >
6
+ <template #actionButton>
7
+ <a-icon
8
+ v-if="buttonEdit"
9
+ size="1.3rem"
10
+ class="contextButton mt-n1"
11
+ title="Bearbeiten"
12
+ @click="showForm = true"
13
+ >
14
+ $pencilCircleIcon
15
+ </a-icon>
16
+
17
+ <a-icon
18
+ v-if="buttonAdd"
19
+ size="1.3rem"
20
+ class="contextButton mt-n1"
21
+ title="Bearbeiten"
22
+ @click="showForm = true"
23
+ >
24
+ $addIcon
25
+ </a-icon>
26
+
27
+ <edit-modal
28
+ ref="modal"
29
+ :width="modalWidth"
30
+ :show="showForm"
31
+ :model="model"
32
+ :createModelToEdit="createModelToEdit"
33
+ :title="label"
34
+ :icon="icon"
35
+ @save="save"
36
+ @close="showForm = null"
37
+ >
38
+ <template #form="{modelToEdit}">
39
+ <slot
40
+ name="form"
41
+ :modelToEdit="modelToEdit"
42
+ />
43
+ </template>
44
+ </edit-modal>
45
+ </template>
46
+
47
+ <template v-if="sectionModel">
48
+ <slot
49
+ name="model"
50
+ :model="model"
51
+ />
52
+ </template>
53
+
54
+ <div v-else>
55
+ <div v-if="labelEmpty">
56
+ <x-icon :color="xColorEmpty" /> {{ labelEmpty }}
57
+ </div>
58
+
59
+ <a-icon-button
60
+ v-if="buttonCreate"
61
+ small
62
+ class="mt-4"
63
+ icon="$plusIcon"
64
+ :text="label"
65
+ @click="showForm = true"
66
+ />
67
+ </div>
68
+ </detail-property>
69
+ </template>
70
+
71
+
72
+ <script>
73
+ import { Component, Vue } from '@a-vue'
74
+
75
+ @Component({
76
+ props: [
77
+ 'model', 'createModelToEdit',
78
+ 'icon',
79
+ 'label',
80
+ 'labelEmpty', 'xColorEmpty',
81
+ {
82
+ sectionModel: false,
83
+ buttonEdit: false,
84
+ buttonAdd: false,
85
+ buttonCreate: false,
86
+ modalWidth: 'auto'
87
+ }
88
+ ]
89
+ })
90
+ export default class EditableDetailProperty extends Vue {
91
+ showForm = false
92
+
93
+ save (model, ignoreChangesOnClose, closeModal) {
94
+ this.$emit('save', {model, ignoreChangesOnClose, closeModal})
95
+ }
96
+ }
97
+ </script>
98
+
99
+
100
+ <style lang="scss" scoped>
101
+ </style>
@@ -8,6 +8,7 @@ import DetailContent from './detail/DetailContent'
8
8
  import DetailMeta from './detail/DetailMeta'
9
9
  import DetailProperty from './detail/DetailProperty'
10
10
  import DetailTitle from './detail/DetailTitle'
11
+ import EditableDetailProperty from './detail/EditableDetailProperty'
11
12
  import DetailOrInfo from './DetailOrInfo'
12
13
  import FlyingContext from './FlyingContext'
13
14
  import EditFormButtons from './form/EditFormButtons'
@@ -47,6 +48,7 @@ Vue.component('DetailContent', DetailContent)
47
48
  Vue.component('DetailMeta', DetailMeta)
48
49
  Vue.component('DetailTitle', DetailTitle)
49
50
  Vue.component('DetailProperty', DetailProperty)
51
+ Vue.component('EditableDetailProperty', EditableDetailProperty)
50
52
  Vue.component('DetailColumn', DetailColumn)
51
53
 
52
54
  Vue.component('AppBarButton', AppBarButton)