@afeefa/vue-app 0.0.77 → 0.0.80

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.77
1
+ 0.0.80
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.77",
3
+ "version": "0.0.80",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -23,10 +23,24 @@
23
23
  {{ title }}
24
24
  </v-card-title>
25
25
 
26
- <v-card-text v-if="message">
26
+ <v-card-text
27
+ v-if="message"
28
+ >
27
29
  <span v-html="message" />
28
30
  </v-card-text>
29
31
 
32
+ <v-card-text
33
+ v-if="info"
34
+ class="dialogInfo"
35
+ >
36
+ <v-alert
37
+ dense
38
+ type="info"
39
+ >
40
+ {{ info }}
41
+ </v-alert>
42
+ </v-card-text>
43
+
30
44
  <v-card-text v-if="$slots.default">
31
45
  <slot :props="props" />
32
46
  </v-card-text>
@@ -70,6 +84,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
70
84
 
71
85
  title = null
72
86
  message = null
87
+ info = null
73
88
  yesButton = null
74
89
  yesColor = null
75
90
  cancelButton = null
@@ -103,6 +118,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
103
118
 
104
119
  this.title = this.payload.title
105
120
  this.message = this.payload.message
121
+ this.info = this.payload.info
106
122
  this.yesButton = this.payload.yesButton
107
123
  this.yesColor = this.payload.yesColor
108
124
  this.cancelButton = this.payload.cancelButton
@@ -178,6 +194,7 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
178
194
 
179
195
  this.title = dialogEvent.payload.title
180
196
  this.message = dialogEvent.payload.message
197
+ this.info = dialogEvent.payload.info
181
198
  this.yesButton = dialogEvent.payload.yesButton
182
199
  this.yesColor = dialogEvent.payload.yesColor
183
200
  this.cancelButton = dialogEvent.payload.cancelButton
@@ -234,4 +251,9 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEs
234
251
  }
235
252
  }
236
253
  }
254
+
255
+ .dialogInfo {
256
+ padding-top: 0 !important;
257
+ padding-bottom: 0 !important;
258
+ }
237
259
  </style>
@@ -9,6 +9,7 @@
9
9
  :valid="valid"
10
10
  :modelToEdit="modelToEdit"
11
11
  :model="model"
12
+ :getField="getField"
12
13
  />
13
14
  </v-form>
14
15
  </template>
@@ -35,6 +36,15 @@ export default class EditForm extends Vue {
35
36
  this.reset()
36
37
  }
37
38
 
39
+ getField = name => {
40
+ const modelType = this.$apiResources.getType(this.model.type)
41
+ const update = !!this.model.id
42
+ const fields = update
43
+ ? modelType.getUpdateFields()
44
+ : modelType.getCreateFields()
45
+ return fields[name]
46
+ }
47
+
38
48
  forceUnchanged () {
39
49
  this.forcedUnchange = true
40
50
  this.$emit('update:changed', false)
@@ -69,7 +69,18 @@ export class FormFieldMixin extends Vue {
69
69
  }
70
70
 
71
71
  if (field.hasOptions()) {
72
- const options = field.getOptions()
72
+ let options = field.getOptions()
73
+
74
+ if (!Array.isArray(options)) {
75
+ options = Object.entries(options).map(([key, title]) => {
76
+ return {
77
+ itemText: title,
78
+ itemValue: key
79
+ }
80
+ })
81
+ return options
82
+ }
83
+
73
84
  return options.map((value, index) => {
74
85
  if (typeof value === 'object') { // object option
75
86
  return {
@@ -41,7 +41,7 @@ import { DialogEvent } from '@a-vue/events'
41
41
  import { randomCssClass } from '@a-vue/utils/random'
42
42
 
43
43
  @Component({
44
- props: ['title', 'itemTitle', 'protect']
44
+ props: ['title', 'message', 'info', 'itemTitle', 'protect']
45
45
  })
46
46
  export default class EditPage extends Vue {
47
47
  dialogId = randomCssClass(10)
@@ -56,7 +56,8 @@ export default class EditPage extends Vue {
56
56
  const result = await this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
57
57
  id: this.dialogId,
58
58
  title: this.itemTitle + ' löschen?',
59
- message: 'Soll ' + this.itemTitle + ' gelöscht werden?',
59
+ message: ['Soll ' + this.itemTitle + ' gelöscht werden?', this.message].filter(m => m).join('<br><br>'),
60
+ info: this.info,
60
61
  yesButton: 'Löschen',
61
62
  yesColor: 'red white--text'
62
63
  }))
@@ -8,11 +8,12 @@
8
8
  :createModelToEdit="createModelToEdit"
9
9
  v-on="$listeners"
10
10
  >
11
- <template #form="{modelToEdit, model, changed, valid}">
11
+ <template #form="{modelToEdit, model, getField, changed, valid}">
12
12
  <slot
13
13
  name="form"
14
14
  :modelToEdit="modelToEdit"
15
15
  :model="model"
16
+ :getField="getField"
16
17
  :changed="changed"
17
18
  :valid="valid"
18
19
  />