@afeefa/vue-app 0.0.75 → 0.0.76
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.
- package/.afeefa/package/release/version.txt +1 -1
- package/package.json +1 -1
- package/src/components/ADialog.vue +16 -2
- package/src/components/AModal.vue +17 -4
- package/src-admin/components/App.vue +1 -1
- package/src-admin/components/FlyingContext.vue +11 -2
- package/src-admin/components/StickyHeader.vue +1 -1
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.76
|
package/package.json
CHANGED
@@ -5,8 +5,9 @@
|
|
5
5
|
:contentClass="_dialogId"
|
6
6
|
transition="v-fade-transition"
|
7
7
|
v-bind="$attrs"
|
8
|
+
persistent
|
9
|
+
no-click-animation
|
8
10
|
@click:outside="cancel"
|
9
|
-
@keydown.esc="cancel"
|
10
11
|
>
|
11
12
|
<template #activator="{ on }">
|
12
13
|
<div v-on="on">
|
@@ -59,11 +60,12 @@ import { DialogEvent } from './dialog/DialogEvent'
|
|
59
60
|
import { PositionConfig } from '../services/PositionService'
|
60
61
|
import { UsesPositionServiceMixin } from '../services/position/UsesPositionServiceMixin'
|
61
62
|
import { randomCssClass } from '../utils/random'
|
63
|
+
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
62
64
|
|
63
65
|
@Component({
|
64
66
|
props: ['id', 'anchor', 'active', 'payload']
|
65
67
|
})
|
66
|
-
export default class ADialog extends Mixins(UsesPositionServiceMixin) {
|
68
|
+
export default class ADialog extends Mixins(UsesPositionServiceMixin, CancelOnEscMixin) {
|
67
69
|
dialogId = randomCssClass(10)
|
68
70
|
|
69
71
|
title = null
|
@@ -88,6 +90,11 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin) {
|
|
88
90
|
this.$events.off(DialogEvent.SHOW, this.show)
|
89
91
|
}
|
90
92
|
|
93
|
+
coe_cancelOnEsc () {
|
94
|
+
this.cancel()
|
95
|
+
return false // stop esc propagation
|
96
|
+
}
|
97
|
+
|
91
98
|
@Watch('dialog')
|
92
99
|
dialogChanged () {
|
93
100
|
// called without event from activator
|
@@ -105,6 +112,13 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin) {
|
|
105
112
|
|
106
113
|
this.calledViaEvent = false
|
107
114
|
}
|
115
|
+
|
116
|
+
// register for esc
|
117
|
+
if (this.dialog) {
|
118
|
+
this.coe_watchCancel()
|
119
|
+
} else {
|
120
|
+
this.coe_unwatchCancel()
|
121
|
+
}
|
108
122
|
}
|
109
123
|
|
110
124
|
get _dialogId () {
|
@@ -7,10 +7,9 @@
|
|
7
7
|
v-bind="$attrs"
|
8
8
|
:contentClass="modalId"
|
9
9
|
transition="v-fade-transition"
|
10
|
-
|
11
|
-
|
10
|
+
persistent
|
11
|
+
no-click-animation
|
12
12
|
@click:outside="cancel"
|
13
|
-
@keydown.esc="cancel"
|
14
13
|
>
|
15
14
|
<template #activator="{ on }">
|
16
15
|
<div
|
@@ -41,11 +40,12 @@ import { UsesPositionServiceMixin } from '@a-vue/services/position/UsesPositionS
|
|
41
40
|
import { randomCssClass } from '../utils/random'
|
42
41
|
import { getZIndex } from 'vuetify/lib/util/helpers'
|
43
42
|
import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
|
43
|
+
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
44
44
|
|
45
45
|
@Component({
|
46
46
|
props: ['show', 'title', 'beforeClose', 'triggerClass', 'anchorPosition']
|
47
47
|
})
|
48
|
-
export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentWidthMixin) {
|
48
|
+
export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentWidthMixin, CancelOnEscMixin) {
|
49
49
|
modalId = randomCssClass(10)
|
50
50
|
|
51
51
|
modal = false
|
@@ -79,6 +79,11 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
79
79
|
}
|
80
80
|
}
|
81
81
|
|
82
|
+
coe_cancelOnEsc () {
|
83
|
+
this.cancel()
|
84
|
+
return false // stop esc propagation
|
85
|
+
}
|
86
|
+
|
82
87
|
/**
|
83
88
|
* visiblility changes from outside
|
84
89
|
* this will trigger the modal watcher
|
@@ -107,6 +112,14 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
107
112
|
} else {
|
108
113
|
this.removeTransientAnchor()
|
109
114
|
}
|
115
|
+
|
116
|
+
// register for esc
|
117
|
+
if (this.modal) {
|
118
|
+
this.coe_watchCancel()
|
119
|
+
} else {
|
120
|
+
this.coe_unwatchCancel()
|
121
|
+
}
|
122
|
+
|
110
123
|
this.$emit('update:show', this.modal)
|
111
124
|
}
|
112
125
|
|
@@ -7,14 +7,15 @@
|
|
7
7
|
</template>
|
8
8
|
|
9
9
|
<script>
|
10
|
-
import { Component, Watch,
|
10
|
+
import { Component, Watch, Mixins } from '@a-vue'
|
11
11
|
import { FlyingContextEvent } from '@a-vue/events'
|
12
12
|
import { randomCssClass } from '@a-vue/utils/random'
|
13
|
+
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
13
14
|
|
14
15
|
@Component({
|
15
16
|
props: [{show: false}]
|
16
17
|
})
|
17
|
-
export default class FlyingContext extends
|
18
|
+
export default class FlyingContext extends Mixins(CancelOnEscMixin) {
|
18
19
|
isVisible = false
|
19
20
|
contextId = randomCssClass(10)
|
20
21
|
|
@@ -44,8 +45,10 @@ export default class FlyingContext extends Vue {
|
|
44
45
|
if (this.isVisible) {
|
45
46
|
const container = this.getSidebarContainer()
|
46
47
|
container.appendChild(el)
|
48
|
+
this.coe_watchCancel() // show context -> watch esc
|
47
49
|
} else {
|
48
50
|
this.$el.appendChild(el)
|
51
|
+
this.coe_unwatchCancel() // hide context -> do not watch esc any more
|
49
52
|
}
|
50
53
|
}
|
51
54
|
|
@@ -62,11 +65,17 @@ export default class FlyingContext extends Vue {
|
|
62
65
|
onHide () {
|
63
66
|
if (this.isVisible) {
|
64
67
|
this.$el.appendChild(this.getContent())
|
68
|
+
this.coe_unwatchCancel() // hide context -> do not watch esc any more
|
65
69
|
this.isVisible = false
|
66
70
|
this.$emit('hide')
|
67
71
|
}
|
68
72
|
}
|
69
73
|
|
74
|
+
coe_cancelOnEsc () {
|
75
|
+
this.onHide()
|
76
|
+
return false // stop esc propagation
|
77
|
+
}
|
78
|
+
|
70
79
|
getContent () {
|
71
80
|
return document.querySelector('.' + this.contextId)
|
72
81
|
}
|