@afeefa/vue-app 0.0.257 → 0.0.258
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.
|
1
|
+
0.0.258
|
package/package.json
CHANGED
@@ -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,7 +59,7 @@ export default class appBarTitle extends Vue {
|
|
59
59
|
return document.getElementById('appBarTitleContainer')
|
60
60
|
}
|
61
61
|
|
62
|
-
|
62
|
+
getLastNamedRoute () {
|
63
63
|
const currentRouteName = this.$route.name
|
64
64
|
const historyStack = routeConfigPlugin.getRouteHistory()
|
65
65
|
|
@@ -67,12 +67,21 @@ export default class appBarTitle extends Vue {
|
|
67
67
|
for (let i = historyStack.length - 2; i >= 0; i--) {
|
68
68
|
const route = historyStack[i]
|
69
69
|
if (route.name && route.name !== currentRouteName) {
|
70
|
-
|
71
|
-
|
72
|
-
|
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,146 @@
|
|
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
|
+
:rules="validationRules"
|
19
|
+
placeholder="Mausklick oder Space/↓-Taste zum Auswählen"
|
20
|
+
:clearable="false"
|
21
|
+
appendIcon="$dropdown"
|
22
|
+
@keydown.space.prevent="open"
|
23
|
+
@keydown.down.prevent="open"
|
24
|
+
@keydown.enter.prevent="open"
|
25
|
+
/>
|
26
|
+
</template>
|
27
|
+
|
28
|
+
<template #filters="{onSearchInputKey}">
|
29
|
+
<a-row gap="4">
|
30
|
+
<list-filter-search
|
31
|
+
ref="searchInput"
|
32
|
+
:focus="true"
|
33
|
+
tabindex="1"
|
34
|
+
maxWidth="100%"
|
35
|
+
:label="'Suche ' + label"
|
36
|
+
v-on="onSearchInputKey"
|
37
|
+
/>
|
38
|
+
|
39
|
+
<list-filter-page
|
40
|
+
:has="{page_size: false, page_number: true}"
|
41
|
+
:totalVisible="0"
|
42
|
+
/>
|
43
|
+
</a-row>
|
44
|
+
</template>
|
45
|
+
|
46
|
+
<template #row="{ model, on }">
|
47
|
+
<div
|
48
|
+
v-if="$has.icon"
|
49
|
+
class="pr-0"
|
50
|
+
>
|
51
|
+
<v-icon
|
52
|
+
:color="model.getIcon().color"
|
53
|
+
size="1.5rem"
|
54
|
+
class="mr-2"
|
55
|
+
v-on="on"
|
56
|
+
v-text="model.getIcon().icon"
|
57
|
+
/>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div
|
61
|
+
style="width:100%;"
|
62
|
+
v-on="on"
|
63
|
+
>
|
64
|
+
{{ getTitle(model) }}
|
65
|
+
<div
|
66
|
+
v-if="getSubtitle(model)"
|
67
|
+
class="grey--text mt-n1"
|
68
|
+
>
|
69
|
+
{{ getSubtitle(model) }}
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</template>
|
73
|
+
</a-search-select>
|
74
|
+
</template>
|
75
|
+
|
76
|
+
<script>
|
77
|
+
import { Component, Vue } from '@a-vue'
|
78
|
+
import { ListAction } from '@a-vue/api-resources/ApiActions'
|
79
|
+
|
80
|
+
@Component({
|
81
|
+
props: [
|
82
|
+
'modelType',
|
83
|
+
'label',
|
84
|
+
'fields',
|
85
|
+
'customValidator',
|
86
|
+
'additionalRules',
|
87
|
+
{
|
88
|
+
getTitle: {type: Function, default: m => m.getTitle()},
|
89
|
+
getSubtitle: {type: Function, default: m => m.getSubtitle()}
|
90
|
+
}]
|
91
|
+
})
|
92
|
+
export default class SearchSelectNavigator extends Vue {
|
93
|
+
$hasOptions = ['icon']
|
94
|
+
|
95
|
+
mounted () {
|
96
|
+
if (this.validator) {
|
97
|
+
this.$refs.input.validate()
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
calculateSelectorSize () {
|
102
|
+
const input = this.$refs.input.$el
|
103
|
+
const inputWidth = input.offsetWidth
|
104
|
+
this.$refs.select.setWidth(`calc(${inputWidth}px + 1rem)`)
|
105
|
+
}
|
106
|
+
|
107
|
+
get listAction () {
|
108
|
+
return new ListAction()
|
109
|
+
.action({
|
110
|
+
resourceType: this.modelType,
|
111
|
+
actionName: 'list'
|
112
|
+
})
|
113
|
+
.filters()
|
114
|
+
.fields(this.fields)
|
115
|
+
}
|
116
|
+
|
117
|
+
itemSelected (model) {
|
118
|
+
this.$router.push(model.getLink('detail'))
|
119
|
+
}
|
120
|
+
|
121
|
+
focusInput () {
|
122
|
+
this.$refs.input.setFocus(true)
|
123
|
+
}
|
124
|
+
|
125
|
+
get validator () {
|
126
|
+
const validator = this.customValidator
|
127
|
+
if (this.additionalRules) {
|
128
|
+
validator.setAdditionalRules(this.additionalRules)
|
129
|
+
}
|
130
|
+
return validator
|
131
|
+
}
|
132
|
+
|
133
|
+
get validationRules () {
|
134
|
+
const label = this.label
|
135
|
+
return (this.validator && this.validator.getRules(label)) || []
|
136
|
+
}
|
137
|
+
}
|
138
|
+
</script>
|
139
|
+
|
140
|
+
|
141
|
+
<style lang="scss" scoped>
|
142
|
+
.selectedItem,
|
143
|
+
:deep(.a-table-row) {
|
144
|
+
cursor: pointer;
|
145
|
+
}
|
146
|
+
</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)
|