@afeefa/vue-app 0.0.224 → 0.0.225

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.224
1
+ 0.0.225
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.224",
3
+ "version": "0.0.225",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -74,10 +74,10 @@
74
74
  <script>
75
75
  import { Component, Mixins } from '@a-vue'
76
76
  import { ListFilterMixin } from '../ListFilterMixin'
77
- import { ListAction } from '@a-vue/api-resources/ApiActions'
77
+ import { ListAction, GetAction } from '@a-vue/api-resources/ApiActions'
78
78
 
79
79
  @Component({
80
- props: ['itemTitle', 'itemValue']
80
+ props: ['itemTitle', 'itemValue', {selectedKey: 'id'}]
81
81
  })
82
82
  export default class ListFilterSearchSelect extends Mixins(ListFilterMixin) {
83
83
  $hasOptions = ['icon']
@@ -87,19 +87,17 @@ export default class ListFilterSearchSelect extends Mixins(ListFilterMixin) {
87
87
 
88
88
  async created () {
89
89
  if (this.filter.value) {
90
- const {models} = await this.createListAction()
90
+ const model = await this.createGetAction()
91
91
  .params({
92
- [this.filter.name]: this.filter.value
92
+ [this.selectedKey]: this.filter.value
93
93
  })
94
94
  .load()
95
95
 
96
- if (models.length) {
96
+ if (model) {
97
97
  if (this.filter.value) {
98
- const selectedModel = models.find(m => m.id === this.filter.value)
98
+ const selectedModel = model
99
99
  if (selectedModel) {
100
100
  this.inputModel = selectedModel.getTitle()
101
- } else {
102
- this.inputModel = models[0].getTitle()
103
101
  }
104
102
  }
105
103
  }
@@ -126,6 +124,20 @@ export default class ListFilterSearchSelect extends Mixins(ListFilterMixin) {
126
124
  return ListAction.fromRequest(request)
127
125
  }
128
126
 
127
+ createGetAction () {
128
+ const request = this.filter
129
+ .createOptionsRequest('get')
130
+
131
+ const getAction = this.$apiResources.getAction({
132
+ resourceType: request.getAction().getResource().getType(),
133
+ actionName: 'get'
134
+ })
135
+
136
+ request.action(getAction)
137
+
138
+ return GetAction.fromRequest(request)
139
+ }
140
+
129
141
  itemSelected (model) {
130
142
  if (model) {
131
143
  this.filter.value = model.id