@afeefa/vue-app 0.0.322 → 0.0.324
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.324
|
package/package.json
CHANGED
|
@@ -31,11 +31,12 @@ import { Component, Mixins, Watch } from '@a-vue'
|
|
|
31
31
|
import { UsesPositionServiceMixin } from '../services/position/UsesPositionServiceMixin'
|
|
32
32
|
import { Positions, PositionConfig } from '../services/PositionService'
|
|
33
33
|
import { randomCssClass } from '../utils/random'
|
|
34
|
+
import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
|
|
34
35
|
|
|
35
36
|
@Component({
|
|
36
37
|
props: ['contentHeight', 'repositionWatchKey', 'triggerIcon', 'customAnchor']
|
|
37
38
|
})
|
|
38
|
-
export default class AContextMenu extends Mixins(UsesPositionServiceMixin) {
|
|
39
|
+
export default class AContextMenu extends Mixins(UsesPositionServiceMixin, CancelOnEscMixin) {
|
|
39
40
|
CONTEXT_MENU = true
|
|
40
41
|
menuId = randomCssClass(10)
|
|
41
42
|
nosePosition = 'left'
|
|
@@ -91,7 +92,7 @@ export default class AContextMenu extends Mixins(UsesPositionServiceMixin) {
|
|
|
91
92
|
window.addEventListener('mousedown', this.onClickOutside)
|
|
92
93
|
window.addEventListener('wheel', this.close)
|
|
93
94
|
window.addEventListener('touchmove', this.close)
|
|
94
|
-
window.addEventListener('keydown', this.
|
|
95
|
+
window.addEventListener('keydown', this.onKeyDown)
|
|
95
96
|
|
|
96
97
|
const container = this.getContainer()
|
|
97
98
|
container.appendChild(this.popUp)
|
|
@@ -100,6 +101,8 @@ export default class AContextMenu extends Mixins(UsesPositionServiceMixin) {
|
|
|
100
101
|
|
|
101
102
|
this.isOpen = true
|
|
102
103
|
|
|
104
|
+
this.coe_watchCancel()
|
|
105
|
+
|
|
103
106
|
this.$emit('open')
|
|
104
107
|
}
|
|
105
108
|
|
|
@@ -109,12 +112,14 @@ export default class AContextMenu extends Mixins(UsesPositionServiceMixin) {
|
|
|
109
112
|
window.removeEventListener('mousedown', this.onClickOutside)
|
|
110
113
|
window.removeEventListener('wheel', this.close)
|
|
111
114
|
window.removeEventListener('touchmove', this.close)
|
|
112
|
-
window.removeEventListener('keydown', this.
|
|
115
|
+
window.removeEventListener('keydown', this.onKeyDown)
|
|
113
116
|
|
|
114
117
|
this.$el.appendChild(this.popUp)
|
|
115
118
|
|
|
116
119
|
this.isOpen = false
|
|
117
120
|
|
|
121
|
+
this.coe_unwatchCancel()
|
|
122
|
+
|
|
118
123
|
this.$emit('close')
|
|
119
124
|
}
|
|
120
125
|
|
|
@@ -139,6 +144,17 @@ export default class AContextMenu extends Mixins(UsesPositionServiceMixin) {
|
|
|
139
144
|
return container.querySelector('.' + this.popUpCssClass)
|
|
140
145
|
}
|
|
141
146
|
|
|
147
|
+
coe_cancelOnEsc () {
|
|
148
|
+
this.close()
|
|
149
|
+
return false // stop esc propagation
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
onKeyDown (e) {
|
|
153
|
+
if (e.key !== 'Escape') {
|
|
154
|
+
this.close()
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
142
158
|
onClickOutside (e) {
|
|
143
159
|
const popUp = this.popUp
|
|
144
160
|
|
|
@@ -92,9 +92,12 @@ export default class ListColumnSelector extends Vue {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
resetColumnOrder () {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const defaultKeys = Object.keys(this.defaultColumns)
|
|
96
|
+
const columns = {}
|
|
97
|
+
for (const key of defaultKeys) {
|
|
98
|
+
columns[key] = this.columns_[key]
|
|
99
|
+
}
|
|
100
|
+
this.columns_ = columns
|
|
98
101
|
this.$emit('update:columns', this.columns_)
|
|
99
102
|
this.saveColumnConfiguration()
|
|
100
103
|
}
|