@afeefa/vue-app 0.0.115 → 0.0.117

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.115
1
+ 0.0.117
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.115",
3
+ "version": "0.0.117",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,4 +1,6 @@
1
1
  import { NextRouteFilterSource } from '@a-vue/components/list/NextRouteFilterSource'
2
+ import { AlertEvent } from '@a-vue/events'
3
+ import { eventBus } from '@a-vue/plugins/event-bus/EventBus'
2
4
  import { ListViewModel } from '@afeefa/api-resources-client'
3
5
 
4
6
  import { ApiAction } from './ApiAction'
@@ -24,4 +26,14 @@ export class ListAction extends ApiAction {
24
26
 
25
27
  return ListAction.fromRequest(request)
26
28
  }
29
+
30
+ processError (result) {
31
+ if (this._showError) {
32
+ eventBus.dispatch(new AlertEvent(AlertEvent.ERROR, {
33
+ headline: 'Die Daten konntent nicht geladen werden.',
34
+ message: result.message,
35
+ detail: result.detail
36
+ }))
37
+ }
38
+ }
27
39
  }
@@ -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)) || []
@@ -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)
@@ -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
  }
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <v-menu
3
+ ref="menu"
4
+ v-model="menu"
5
+ :close-on-content-click="false"
6
+ :nudge-right="40"
7
+ :return-value.sync="model[name]"
8
+ transition="scale-transition"
9
+ offset-y
10
+ max-width="290px"
11
+ min-width="290px"
12
+ >
13
+ <template #activator="{ on, attrs }">
14
+ <v-text-field
15
+ v-model="model[name]"
16
+ :label="label || name"
17
+ prepend-icon="mdi-clock-time-four-outline"
18
+ readonly
19
+ dense
20
+ outlined
21
+ v-bind="attrs"
22
+ v-on="on"
23
+ />
24
+ </template>
25
+ <v-time-picker
26
+ v-if="menu"
27
+ ref="timePicker"
28
+ v-model="model[name]"
29
+ :validator="validator"
30
+ v-bind="$attrs"
31
+ full-width
32
+ scrollable
33
+ format="24hr"
34
+ v-on="$listeners"
35
+ @click:minute="$refs.menu.save(model[name])"
36
+ />
37
+ </v-menu>
38
+ </template>
39
+
40
+ <script>
41
+ import { Component, Mixins } from '@a-vue'
42
+ import { FormFieldMixin } from '../FormFieldMixin'
43
+
44
+ @Component
45
+ export default class FormFieldTime extends Mixins(FormFieldMixin) {
46
+ menu = false
47
+ validate () {
48
+ this.$refs.timePicker.validate()
49
+ }
50
+ }
51
+ </script>
@@ -4,6 +4,7 @@ import EditForm from './form/EditForm'
4
4
  import EditModal from './form/EditModal'
5
5
  import FormFieldCheckbox from './form/fields/FormFieldCheckbox'
6
6
  import FormFieldDate from './form/fields/FormFieldDate'
7
+ import FormFieldTime from './form/fields/FormFieldTime'
7
8
  import FormFieldRadioGroup from './form/fields/FormFieldRadioGroup'
8
9
  import FormFieldRichTextArea from './form/fields/FormFieldRichTextArea'
9
10
  import FormFieldSearchSelect from './form/fields/FormFieldSearchSelect'
@@ -25,6 +26,7 @@ Vue.component('FormFieldRichTextArea', FormFieldRichTextArea)
25
26
  Vue.component('FormFieldRadioGroup', FormFieldRadioGroup)
26
27
  Vue.component('FormFieldCheckbox', FormFieldCheckbox)
27
28
  Vue.component('FormFieldDate', FormFieldDate)
29
+ Vue.component('FormFieldTime', FormFieldTime)
28
30
  Vue.component('FormFieldSearchSelect', FormFieldSearchSelect)
29
31
  Vue.component('FormFieldSelect', FormFieldSelect)
30
32
  Vue.component('FormFieldSelect2', FormFieldSelect2)
@@ -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
 
@@ -47,7 +47,6 @@ export class DataRouteMixin extends Vue {
47
47
  })
48
48
  }
49
49
 
50
-
51
50
  // watches (if defined) route idKey and reloads data if changed
52
51
  @Watch('drm_id')
53
52
  async drm_routeParamsChanged () {
@@ -68,14 +67,18 @@ export class DataRouteMixin extends Vue {
68
67
  }
69
68
 
70
69
  drm_onLoad (result) {
71
- onLoadCallback(this, result)
70
+ const wrapped = this.$children.find(c => c.constructor.drm_getActions)
71
+ onLoadCallback(wrapped || this, result)
72
72
  lastResult = result
73
73
  }
74
74
 
75
75
  created () {
76
76
  // hmr reload creates vm but not triggers route enter
77
77
  if (!routerHookCalled) {
78
- onLoadCallback(this, lastResult)
78
+ this.$nextTick(() => { // next tick bc c.constructor else not available
79
+ const wrapped = this.$children.find(c => c.constructor.drm_getActions)
80
+ onLoadCallback(wrapped || this, lastResult)
81
+ })
79
82
  }
80
83
  }
81
84
  }
@@ -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
  }