@afeefa/vue-app 0.0.324 → 0.0.326

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.324
1
+ 0.0.326
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.324",
3
+ "version": "0.0.326",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -14,7 +14,7 @@
14
14
  </v-icon>
15
15
 
16
16
  <div>
17
- <h3>{{ _headline }}</h3>
17
+ <h3>{{ headline }}</h3>
18
18
 
19
19
  <div v-html="message" />
20
20
 
@@ -55,13 +55,6 @@ export default class AAlert extends Vue {
55
55
  window.addEventListener('mouseup', this.onMouseDown)
56
56
  }
57
57
 
58
- get _headline () {
59
- if (this.headline) {
60
- return this.headline
61
- }
62
- return this.error ? 'Ein Fehler ist aufgetreten.' : 'Alles super!'
63
- }
64
-
65
58
  onError (alertEvent) {
66
59
  this.success = false
67
60
  this.error = true
@@ -75,6 +68,14 @@ export default class AAlert extends Vue {
75
68
  }
76
69
 
77
70
  show (alert) {
71
+ if (!alert.headline) {
72
+ const messages = this.error
73
+ ? ['Ein Fehler ist aufgetreten', 'Da stimmt was nicht', 'Leider nicht geklappt', 'Da hakt es', 'Hoppla', 'Etwas ist schiefgelaufen', 'Das hat nicht funktioniert', 'Da klemmt etwas', 'Unerwartetes Hindernis', 'Kritischer Fehler #983-45§.v2)= ;-)', 'Kann mal passieren', 'Die Technik wieder']
74
+ : ['Erledigt!', 'Einwandfrei', 'Passt!', 'Wunderbar', 'Alles klar', 'Daten sicher verstaut', 'Tipptopp', 'Reibungslos', 'Bestens', 'Hat geklappt', 'Super', 'Totalgenial']
75
+ const index = Math.floor(Math.random() * messages.length)
76
+ alert.headline = messages[index]
77
+ }
78
+
78
79
  this.headline = alert.headline
79
80
  this.message = alert.message
80
81
  this.detail = alert.detail
@@ -10,7 +10,7 @@
10
10
  >
11
11
  <a-checkbox
12
12
  v-for="option in options_"
13
- :key="option.itemValue"
13
+ :key="optionKey(option.itemValue)"
14
14
  :label="option.itemText"
15
15
  :value="isChecked(option.itemValue)"
16
16
  hide-details
@@ -58,20 +58,26 @@ export default class ACheckboxGroup extends Vue {
58
58
  this.init()
59
59
  }
60
60
 
61
+ optionKey (value) {
62
+ return value && value.id !== undefined ? value.id : value
63
+ }
64
+
61
65
  checked (key, value) {
62
66
  if (value) {
63
67
  if (!this.isChecked(key)) {
64
68
  this.value_.push(key)
65
69
  }
66
70
  } else {
67
- this.value_ = this.value_.filter(v => v !== key)
71
+ const keyId = this.optionKey(key)
72
+ this.value_ = this.value_.filter(v => this.optionKey(v) !== keyId)
68
73
  }
69
74
  this.$emit('input', this.value_)
70
75
  this.validate()
71
76
  }
72
77
 
73
78
  isChecked (key) {
74
- return this.value_.includes(key)
79
+ const keyId = this.optionKey(key)
80
+ return this.value_.some(v => this.optionKey(v) === keyId)
75
81
  }
76
82
 
77
83
  @Watch('options')
@@ -66,13 +66,11 @@ export class FormFieldMixin extends Vue {
66
66
 
67
67
  const options = []
68
68
 
69
- if (!this.validator || !this.validator.getParam('filled')) {
70
- if (!this.$attrs.hasOwnProperty('multiple')) { // don't offer 'keine auswahl' on multiselects
71
- options.push({
72
- itemText: 'Keine Auswahl',
73
- itemValue: null
74
- })
75
- }
69
+ if (this._addNullOption && (!this.validator || !this.validator.getParam('filled'))) {
70
+ options.push({
71
+ itemText: 'Keine Auswahl',
72
+ itemValue: null
73
+ })
76
74
  }
77
75
 
78
76
  return [
@@ -113,6 +111,10 @@ export class FormFieldMixin extends Vue {
113
111
  }
114
112
  }
115
113
 
114
+ get _addNullOption () {
115
+ return !('multiple' in this.$attrs)
116
+ }
117
+
116
118
  get validator () {
117
119
  const validator = this.customValidator || this.field.getValidator()
118
120
  if (this.additionalRules) {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <a-checkbox-group
3
3
  v-model="model[name]"
4
- :label="label || name"
4
+ :label="label"
5
5
  :options="_options"
6
6
  :validator="validator"
7
7
  v-bind="$attrs"
@@ -23,6 +23,10 @@ export default class FormFieldCheckboxGroup extends Mixins(FormFieldMixin) {
23
23
  }
24
24
  }
25
25
 
26
+ get _addNullOption () {
27
+ return false
28
+ }
29
+
26
30
  get _options () {
27
31
  return this.$attrs.options || this.options || []
28
32
  }