@afeefa/vue-app 0.0.250 → 0.0.252
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.252
|
package/package.json
CHANGED
@@ -22,14 +22,19 @@
|
|
22
22
|
</template>
|
23
23
|
|
24
24
|
<v-card v-if="modal">
|
25
|
-
<v-card-title
|
25
|
+
<v-card-title
|
26
|
+
v-if="title"
|
27
|
+
:style="{ cursor: draggable ? 'move' : 'default' }"
|
28
|
+
@mousedown="startDrag"
|
29
|
+
>
|
26
30
|
<v-icon
|
27
31
|
v-if="icon"
|
28
32
|
:color="icon.color"
|
29
33
|
class="mr-2"
|
30
34
|
size="1.5rem"
|
31
|
-
|
32
|
-
|
35
|
+
>
|
36
|
+
{{ icon.icon }}
|
37
|
+
</v-icon>
|
33
38
|
|
34
39
|
{{ title }}
|
35
40
|
</v-card-title>
|
@@ -51,7 +56,7 @@ import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
|
|
51
56
|
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
52
57
|
|
53
58
|
@Component({
|
54
|
-
props: ['show', 'icon', 'title', 'beforeClose', 'anchorPosition', 'screenCentered']
|
59
|
+
props: ['show', 'icon', 'title', 'beforeClose', 'anchorPosition', 'screenCentered', {draggable: true}]
|
55
60
|
})
|
56
61
|
export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentWidthMixin, CancelOnEscMixin) {
|
57
62
|
modalId = randomCssClass(10)
|
@@ -59,6 +64,11 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
59
64
|
modal = false
|
60
65
|
position = null
|
61
66
|
|
67
|
+
dragStartX = 0
|
68
|
+
dragStartY = 0
|
69
|
+
initialLeft = 0
|
70
|
+
initialTop = 0
|
71
|
+
|
62
72
|
cwm_maxWidth_ = 1000
|
63
73
|
|
64
74
|
created () {
|
@@ -95,6 +105,42 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
95
105
|
}, true) // capture phase, stop event before v-dialog receives it
|
96
106
|
}
|
97
107
|
|
108
|
+
startDrag (event) {
|
109
|
+
if (!this.draggable) {
|
110
|
+
return
|
111
|
+
}
|
112
|
+
|
113
|
+
this.dragStartX = event.clientX
|
114
|
+
this.dragStartY = event.clientY
|
115
|
+
|
116
|
+
const dialog = document.querySelector('.' + this.modalId)
|
117
|
+
const rect = dialog.getBoundingClientRect()
|
118
|
+
this.initialLeft = rect.left
|
119
|
+
this.initialTop = rect.top
|
120
|
+
|
121
|
+
document.addEventListener('mousemove', this.onDrag)
|
122
|
+
document.addEventListener('mouseup', this.stopDrag)
|
123
|
+
}
|
124
|
+
|
125
|
+
onDrag (event) {
|
126
|
+
const deltaX = event.clientX - this.dragStartX
|
127
|
+
const deltaY = event.clientY - this.dragStartY
|
128
|
+
|
129
|
+
const dialog = document.querySelector('.' + this.modalId)
|
130
|
+
if (dialog) {
|
131
|
+
dialog.style.left = `${this.initialLeft + deltaX}px`
|
132
|
+
dialog.style.top = `${this.initialTop + deltaY}px`
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
stopDrag () {
|
137
|
+
document.removeEventListener('mousemove', this.onDrag)
|
138
|
+
document.removeEventListener('mouseup', this.stopDrag)
|
139
|
+
|
140
|
+
// remove from position watching if has been dragged once
|
141
|
+
this.urp_unregisterPositionWatchers()
|
142
|
+
}
|
143
|
+
|
98
144
|
coe_cancelOnEsc () {
|
99
145
|
this.cancel()
|
100
146
|
return false // stop esc propagation
|
@@ -201,7 +247,6 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
201
247
|
}
|
202
248
|
</script>
|
203
249
|
|
204
|
-
|
205
250
|
<style lang="scss" scoped>
|
206
251
|
.v-card__title {
|
207
252
|
padding: .8rem 1rem !important;
|
@@ -46,6 +46,8 @@ class RouteConfigPlugin {
|
|
46
46
|
_router = null
|
47
47
|
_routes = []
|
48
48
|
|
49
|
+
_routeHistory = [];
|
50
|
+
|
49
51
|
_promise = Promise.resolve(true)
|
50
52
|
|
51
53
|
router (options = {}) {
|
@@ -178,6 +180,11 @@ class RouteConfigPlugin {
|
|
178
180
|
}
|
179
181
|
})
|
180
182
|
}
|
183
|
+
|
184
|
+
this._router.beforeEach((to, from, next) => {
|
185
|
+
this._routeHistory.push(to)
|
186
|
+
next()
|
187
|
+
})
|
181
188
|
})
|
182
189
|
})
|
183
190
|
|
@@ -353,6 +360,14 @@ class RouteConfigPlugin {
|
|
353
360
|
}
|
354
361
|
return new BreadcrumbSetDefinition(options).getDefinitions()
|
355
362
|
}
|
363
|
+
|
364
|
+
getRouteHistory () {
|
365
|
+
return this._routeHistory
|
366
|
+
}
|
367
|
+
|
368
|
+
removeFromRouteHistoryAfterIndex (index) {
|
369
|
+
this._routeHistory.splice(index + 1)
|
370
|
+
}
|
356
371
|
}
|
357
372
|
|
358
373
|
export const routeConfigPlugin = new RouteConfigPlugin()
|
@@ -7,7 +7,7 @@
|
|
7
7
|
color="#F4F4F4"
|
8
8
|
title="Zurück"
|
9
9
|
class="mr-n2"
|
10
|
-
@click="
|
10
|
+
@click="goToLastNamedRoute()"
|
11
11
|
>
|
12
12
|
<v-icon>
|
13
13
|
$arrowLeftIcon
|
@@ -34,6 +34,7 @@
|
|
34
34
|
|
35
35
|
<script>
|
36
36
|
import { Component, Vue } from '@a-vue'
|
37
|
+
import { routeConfigPlugin } from '@a-vue/plugins/route-config/RouteConfigPlugin'
|
37
38
|
|
38
39
|
@Component({
|
39
40
|
props: ['back', 'icon', 'title', 'subtitle', 'detail']
|
@@ -57,6 +58,21 @@ export default class appBarTitle extends Vue {
|
|
57
58
|
getButtonBar () {
|
58
59
|
return document.getElementById('appBarTitleContainer')
|
59
60
|
}
|
61
|
+
|
62
|
+
goToLastNamedRoute () {
|
63
|
+
const currentRouteName = this.$route.name
|
64
|
+
const historyStack = routeConfigPlugin.getRouteHistory()
|
65
|
+
|
66
|
+
// Durchlaufe die Historie rückwärts, um die letzte benannte Route zu finden, die sich vom aktuellen Namen unterscheidet
|
67
|
+
for (let i = historyStack.length - 2; i >= 0; i--) {
|
68
|
+
const route = historyStack[i]
|
69
|
+
if (route.name && route.name !== currentRouteName) {
|
70
|
+
this.$router.push({ name: route.name })
|
71
|
+
routeConfigPlugin.removeFromRouteHistoryAfterIndex(i)
|
72
|
+
return
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
60
76
|
}
|
61
77
|
</script>
|
62
78
|
|