@afeefa/vue-app 0.0.257 → 0.0.260

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.257
1
+ 0.0.260
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.257",
3
+ "version": "0.0.260",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -85,7 +85,7 @@ import { ListAction, GetAction } from '@a-vue/api-resources/ApiActions'
85
85
  import { Category } from '@/models'
86
86
 
87
87
  @Component({
88
- props: ['itemTitle', 'itemValue', {
88
+ props: ['itemTitle', 'itemValue', 'optionRequestFilters', {
89
89
  selectedKey: 'id',
90
90
  getTitle: {type: Function, default: m => m.getTitle()},
91
91
  getSubtitle: {type: Function, default: m => m.getSubtitle()},
@@ -145,6 +145,7 @@ export default class ListFilterSearchSelect extends Mixins(ListFilterMixin) {
145
145
  createListAction () {
146
146
  const request = this.filter
147
147
  .createOptionsRequest()
148
+ .addFilters(this.optionRequestFilters || {})
148
149
  return ListAction.fromRequest(request)
149
150
  }
150
151
 
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <a-row gap="4">
3
3
  <v-btn
4
- v-if="back"
4
+ v-if="back && getLastNamedRoute()"
5
5
  fab
6
6
  x-small
7
7
  color="#F4F4F4"
@@ -59,20 +59,29 @@ export default class appBarTitle extends Vue {
59
59
  return document.getElementById('appBarTitleContainer')
60
60
  }
61
61
 
62
- goToLastNamedRoute () {
63
- const currentRouteName = this.$route.name
62
+ getLastNamedRoute () {
63
+ const currentRoutePath = this.$route.path
64
64
  const historyStack = routeConfigPlugin.getRouteHistory()
65
65
 
66
66
  // Durchlaufe die Historie rückwärts, um die letzte benannte Route zu finden, die sich vom aktuellen Namen unterscheidet
67
67
  for (let i = historyStack.length - 2; i >= 0; i--) {
68
68
  const route = historyStack[i]
69
- if (route.name && route.name !== currentRouteName) {
70
- this.$router.push({ name: route.name, params: route.params })
71
- routeConfigPlugin.removeFromRouteHistoryAfterIndex(i)
72
- return
69
+ if (route.path && route.path !== currentRoutePath) {
70
+ return {
71
+ route,
72
+ index: i
73
+ }
73
74
  }
74
75
  }
75
76
  }
77
+
78
+ goToLastNamedRoute () {
79
+ const routeInfo = this.getLastNamedRoute()
80
+ if (routeInfo) {
81
+ this.$router.push({ name: routeInfo.route.name, params: routeInfo.route.params })
82
+ routeConfigPlugin.removeFromRouteHistoryAfterIndex(routeInfo.index)
83
+ }
84
+ }
76
85
  }
77
86
  </script>
78
87
 
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <a-search-select
3
+ ref="select"
4
+ :listAction="listAction"
5
+ :getSearchInput="() => $refs.searchInput"
6
+ diffXControls="-.5rem"
7
+ diffYControls="-.5rem"
8
+ v-bind="$attrs"
9
+ @select="itemSelected"
10
+ @close="focusInput"
11
+ @beforeOpen="calculateSelectorSize"
12
+ >
13
+ <template #activator="{open}">
14
+ <a-text-field
15
+ ref="input"
16
+ readonly
17
+ :label="label"
18
+ placeholder="Mausklick oder Space/↓-Taste zum Auswählen"
19
+ :clearable="false"
20
+ appendIcon="$dropdown"
21
+ @keydown.space.prevent="open"
22
+ @keydown.down.prevent="open"
23
+ @keydown.enter.prevent="open"
24
+ />
25
+ </template>
26
+
27
+ <template #filters="{onSearchInputKey}">
28
+ <a-row gap="4">
29
+ <list-filter-search
30
+ ref="searchInput"
31
+ :focus="true"
32
+ tabindex="1"
33
+ maxWidth="100%"
34
+ :label="'Suche ' + label"
35
+ v-on="onSearchInputKey"
36
+ />
37
+
38
+ <list-filter-page
39
+ :has="{page_size: false, page_number: true}"
40
+ :totalVisible="0"
41
+ />
42
+ </a-row>
43
+ </template>
44
+
45
+ <template #row="{ model, on }">
46
+ <div
47
+ v-if="$has.icon"
48
+ class="pr-0"
49
+ >
50
+ <v-icon
51
+ :color="model.getIcon().color"
52
+ size="1.5rem"
53
+ class="mr-2"
54
+ v-on="on"
55
+ v-text="model.getIcon().icon"
56
+ />
57
+ </div>
58
+
59
+ <div
60
+ style="width:100%;"
61
+ v-on="on"
62
+ >
63
+ {{ getTitle(model) }}
64
+ <div
65
+ v-if="getSubtitle(model)"
66
+ class="grey--text mt-n1"
67
+ >
68
+ {{ getSubtitle(model) }}
69
+ </div>
70
+ </div>
71
+ </template>
72
+ </a-search-select>
73
+ </template>
74
+
75
+ <script>
76
+ import { Component, Vue } from '@a-vue'
77
+ import { ListAction } from '@a-vue/api-resources/ApiActions'
78
+
79
+ @Component({
80
+ props: [
81
+ 'modelType',
82
+ 'label',
83
+ 'fields',
84
+ {
85
+ getTitle: {type: Function, default: m => m.getTitle()},
86
+ getSubtitle: {type: Function, default: m => m.getSubtitle()}
87
+ }]
88
+ })
89
+ export default class SearchSelectNavigator extends Vue {
90
+ $hasOptions = ['icon']
91
+
92
+ calculateSelectorSize () {
93
+ const input = this.$refs.input.$el
94
+ const inputWidth = input.offsetWidth
95
+ this.$refs.select.setWidth(`calc(${inputWidth}px + 1rem)`)
96
+ }
97
+
98
+ get listAction () {
99
+ return new ListAction()
100
+ .action({
101
+ resourceType: this.modelType,
102
+ actionName: 'list'
103
+ })
104
+ .filters()
105
+ .fields(this.fields)
106
+ }
107
+
108
+ itemSelected (model) {
109
+ this.$router.push(model.getLink('detail'))
110
+ }
111
+
112
+ focusInput () {
113
+ this.$refs.input.setFocus(true)
114
+ }
115
+ }
116
+ </script>
117
+
118
+
119
+ <style lang="scss" scoped>
120
+ .selectedItem,
121
+ :deep(.a-table-row) {
122
+ cursor: pointer;
123
+ }
124
+ </style>
@@ -3,6 +3,7 @@ import Vue from 'vue'
3
3
  import AppBarButton from './app/AppBarButton'
4
4
  import AppBarTitle from './app/AppBarTitle'
5
5
  import CollapsibleSection from './CollapsibleSection'
6
+ import SearchSelectNavigator from './controls/SearchSelectNavigator'
6
7
  import DetailColumn from './detail/DetailColumn'
7
8
  import DetailContent from './detail/DetailContent'
8
9
  import DetailMeta from './detail/DetailMeta'
@@ -50,6 +51,8 @@ Vue.component('DetailColumn', DetailColumn)
50
51
  Vue.component('AppBarButton', AppBarButton)
51
52
  Vue.component('AppBarTitle', AppBarTitle)
52
53
 
54
+ Vue.component('SearchSelectNavigator', SearchSelectNavigator)
55
+
53
56
  Vue.component('HSeparator', HSeparator)
54
57
  Vue.component('CollapsibleSection', CollapsibleSection)
55
58
  Vue.component('CollapseTransition', CollapseTransition)