@afeefa/vue-app 0.0.116 → 0.0.118

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.116
1
+ 0.0.118
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.116",
3
+ "version": "0.0.118",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -3,6 +3,7 @@
3
3
  ref="radios"
4
4
  :rules="validationRules"
5
5
  :class="{hasLabel: $has.label}"
6
+ :valueComparator="compareValues"
6
7
  v-bind="$attrs"
7
8
  @change="$emit('input', $event)"
8
9
  >
@@ -22,6 +23,7 @@
22
23
 
23
24
  <script>
24
25
  import { Component, Vue, Watch } from '@a-vue'
26
+ import { Model } from '@afeefa/api-resources-client'
25
27
 
26
28
  @Component({
27
29
  props: ['options', 'validator']
@@ -56,6 +58,13 @@ export default class ARadioGroup extends Vue {
56
58
  }
57
59
  }
58
60
 
61
+ compareValues (a, b) {
62
+ if (a instanceof Model && b instanceof Model) {
63
+ return a.equals(b)
64
+ }
65
+ return JSON.stringify(a) === JSON.stringify(b)
66
+ }
67
+
59
68
  get validationRules () {
60
69
  const label = this.$attrs.label
61
70
  return (this.validator && this.validator.getRules(label)) || []
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div
3
+ :style="cwm_widthStyle + ' ' + displayStyle"
3
4
  :class="['a-row', directionClass, gapClass, classes]"
4
- :style="cwm_widthStyle"
5
5
  >
6
6
  <slot />
7
7
  </div>
@@ -14,7 +14,7 @@ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
14
14
 
15
15
  @Component({
16
16
  props: [
17
- { vertical: false },
17
+ { vertical: false, inline: false },
18
18
  'gap'
19
19
  ]
20
20
  })
@@ -27,6 +27,10 @@ export default class ARow extends Mixins(ComponentWidthMixin) {
27
27
  return classes
28
28
  }
29
29
 
30
+ get displayStyle () {
31
+ return 'display: ' + (this.inline ? 'inline-flex' : 'flex') + ';'
32
+ }
33
+
30
34
  get gapClass () {
31
35
  if (this.gap) {
32
36
  return 'gap-' + this.gap
@@ -44,7 +48,6 @@ export default class ARow extends Mixins(ComponentWidthMixin) {
44
48
 
45
49
  <style scoped lang="scss">
46
50
  .a-row {
47
- display: flex;
48
51
  align-items: center;
49
52
 
50
53
  &.vertical {
@@ -53,7 +53,7 @@ export default class ASelect extends Mixins(ComponentWidthMixin) {
53
53
  }
54
54
 
55
55
  if (a instanceof Model && b instanceof Model) {
56
- return a.id === b.id && a.type === b.type
56
+ return a.equals(b)
57
57
  }
58
58
 
59
59
  return JSON.stringify(a) === JSON.stringify(b)
@@ -62,10 +62,22 @@ export class FormFieldMixin extends Vue {
62
62
  .fromRequest(request)
63
63
  .load()
64
64
 
65
- return models.map(model => ({
66
- itemText: model.getTitle(),
67
- itemValue: model
68
- }))
65
+ const options = []
66
+
67
+ if (!this.validator || !this.validator.getParams().filled) {
68
+ options.push({
69
+ itemText: 'Keine Auswahl',
70
+ itemValue: null
71
+ })
72
+ }
73
+
74
+ return [
75
+ ...options,
76
+ ...models.map(model => ({
77
+ itemText: model.getTitle(),
78
+ itemValue: model
79
+ }))
80
+ ]
69
81
  }
70
82
 
71
83
  if (field.hasOptions()) {
@@ -18,9 +18,7 @@ export default class FormFieldRadioGroup extends Mixins(FormFieldMixin) {
18
18
  options = null
19
19
 
20
20
  created () {
21
- if (this.fieldHasOptionsRequest()) {
22
- this.options = this.getSelectOptions()
23
- } else if (this.fieldHasOptions()) {
21
+ if (this.fieldHasOptionsRequest() || this.fieldHasOptions()) {
24
22
  this.options = this.getSelectOptions()
25
23
  }
26
24
  }
@@ -50,8 +50,8 @@
50
50
  <div>
51
51
  <div class="accountName">
52
52
  {{ account.first_name }}
53
- <template v-if="$auth.roles()[0]">
54
- ({{ $auth.roles()[0].title }})
53
+ <template v-if="$auth.roles[0]">
54
+ ({{ $auth.roles[0].title }})
55
55
  </template>
56
56
  </div>
57
57
 
@@ -63,7 +63,7 @@
63
63
  </div>
64
64
  </div>
65
65
 
66
- <a-context-menu>
66
+ <a-context-menu v-if="$has.settings">
67
67
  <a-context-menu-item
68
68
  :to="{name: 'settings', params: {accountId: account.id}}"
69
69
  >
@@ -144,6 +144,8 @@ import '../styles.scss'
144
144
  }
145
145
  })
146
146
  export default class App extends Vue {
147
+ $hasOptions = ['settings']
148
+
147
149
  drawer = true
148
150
  isLoading = false
149
151
 
@@ -10,7 +10,9 @@ class AuthPlugin {
10
10
 
11
11
  hasRole: name => authService.currentAccountHasRole(name),
12
12
 
13
- roles: () => authService.getCurrentAccountRoles(),
13
+ get roles () {
14
+ return authService.getCurrentAccountRoles()
15
+ },
14
16
 
15
17
  logout: () => authService.forwardToLogoutEndpoint()
16
18
  }