@afeefa/vue-app 0.0.153 → 0.0.155

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.153
1
+ 0.0.155
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.153",
3
+ "version": "0.0.155",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -13,7 +13,7 @@ import { randomCssClass } from '@a-vue/utils/random'
13
13
  import { CancelOnEscMixin } from '@a-vue/services/escape/CancelOnEscMixin'
14
14
 
15
15
  @Component({
16
- props: [{show: false}, 'beforeClose']
16
+ props: [{show: false}, 'beforeClose', 'width']
17
17
  })
18
18
  export default class FlyingContext extends Mixins(CancelOnEscMixin) {
19
19
  isVisible = false
@@ -43,7 +43,14 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
43
43
  }
44
44
 
45
45
  if (this.isVisible) {
46
- const container = this.getSidebarContainer()
46
+ const containerContainer = this.getFlyingContextContainer()
47
+ if (this.width) {
48
+ containerContainer.style.width = this.width
49
+ } else {
50
+ containerContainer.style.width = 'auto'
51
+ }
52
+
53
+ const container = this.getChildrenContainer()
47
54
  container.appendChild(el)
48
55
  this.coe_watchCancel() // show context -> watch esc
49
56
  } else {
@@ -53,7 +60,7 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
53
60
  }
54
61
 
55
62
  destroyed () {
56
- const container = this.getSidebarContainer()
63
+ const container = this.getChildrenContainer()
57
64
  const el = this.getContent()
58
65
  if (container.contains(el)) {
59
66
  container.removeChild(el)
@@ -87,7 +94,11 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
87
94
  return document.querySelector('.' + this.contextId)
88
95
  }
89
96
 
90
- getSidebarContainer () {
97
+ getFlyingContextContainer () {
98
+ return document.getElementById('flyingContextContainer')
99
+ }
100
+
101
+ getChildrenContainer () {
91
102
  return document.getElementById('flyingContextContainer__children')
92
103
  }
93
104
  }
@@ -35,10 +35,13 @@ export default class FlyingContextContainer extends Vue {
35
35
  oldOverflowY = null
36
36
 
37
37
  mounted () {
38
- this.mutationWatcher = new MutationObserver(this.domChanged)
39
- this.mutationWatcher.observe(this.getChildrenContainer(), { childList: true })
38
+ const mutationWatcher = new MutationObserver(this.domChanged)
39
+ mutationWatcher.observe(this.getChildrenContainer(), { childList: true })
40
40
 
41
41
  window.addEventListener('mousedown', this.onClickOutside)
42
+
43
+ const sizeWatcher = new ResizeObserver(this.sizeChanged)
44
+ sizeWatcher.observe(this.getChildrenContainer())
42
45
  }
43
46
 
44
47
  getScrollbarWidth () {
@@ -57,6 +60,17 @@ export default class FlyingContextContainer extends Vue {
57
60
  }
58
61
 
59
62
 
63
+ sizeChanged () {
64
+ if (this.visible) {
65
+ this.$nextTick(() => {
66
+ const scrollbarWidth = this.getScrollbarWidth()
67
+ const el = document.documentElement
68
+ const newSize = el.offsetWidth - this.$el.offsetWidth + scrollbarWidth
69
+ this.$el.style.left = newSize + 'px'
70
+ })
71
+ }
72
+ }
73
+
60
74
  domChanged () {
61
75
  const container = this.getChildrenContainer()
62
76
  this.visible = !!container.children.length
@@ -71,6 +85,8 @@ export default class FlyingContextContainer extends Vue {
71
85
  el.style.overflowY = 'hidden'
72
86
  el.style.marginRight = scrollbarWidth + 'px'
73
87
  }, 100)
88
+
89
+ this.$el.style.left = (el.offsetWidth - this.$el.offsetWidth + scrollbarWidth) + 'px'
74
90
  } else {
75
91
  el.style.overflowY = this.oldOverflowY
76
92
  el.style.marginRight = 0
@@ -79,7 +95,10 @@ export default class FlyingContextContainer extends Vue {
79
95
 
80
96
  hide () {
81
97
  if (this.visible) {
82
- this.$events.dispatch(new FlyingContextEvent(FlyingContextEvent.HIDE_ALL))
98
+ this.$el.style.left = '101vw'
99
+ setTimeout(() => { // fade in then hide contents
100
+ this.$events.dispatch(new FlyingContextEvent(FlyingContextEvent.HIDE_ALL))
101
+ }, 200)
83
102
  }
84
103
  }
85
104
 
@@ -120,19 +139,19 @@ export default class FlyingContextContainer extends Vue {
120
139
  #flyingContextContainer {
121
140
  position: fixed;
122
141
  z-index: 200;
123
- right: 0;
124
142
  height: 100%;
143
+ width: auto;
125
144
  min-width: 400px;
126
145
  max-width: calc(100vw - 100px);
127
146
  top: 0;
128
147
  background: white;
129
- transition: right .2s;
148
+ transition: left .2s;
130
149
  padding: 2rem;
131
150
  overflow-y: auto;
132
151
  border-left: 1px solid rgba(0, 0, 0, .12);
133
152
 
134
153
  &:not(.visible) {
135
- right: -80vw;
154
+ left: 101vw;
136
155
  }
137
156
 
138
157
  .closeButton {