@afeefa/vue-app 0.0.178 → 0.0.180

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.178
1
+ 0.0.180
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.178",
3
+ "version": "0.0.180",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <v-alert
3
3
  v-bind="$attrs"
4
+ :type="type"
4
5
  :style="{display: inline ? 'inline-block' : 'block'}"
5
6
  :class="['a-info', {xSmall}]"
6
7
  dense
@@ -17,7 +18,7 @@
17
18
  import { Component, Vue } from '@a-vue'
18
19
 
19
20
  @Component({
20
- props: [{inline: true, xSmall: false}]
21
+ props: [{inline: true, xSmall: false, type: 'info'}]
21
22
  })
22
23
  export default class AInfo extends Vue {
23
24
  }
@@ -24,6 +24,7 @@
24
24
  <v-card v-if="modal">
25
25
  <v-card-title v-if="title">
26
26
  <v-icon
27
+ v-if="icon"
27
28
  :color="icon.color"
28
29
  class="mr-2"
29
30
  size="1.5rem"
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div>
3
+ <slot v-if="visible" />
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ import { Component, Vue } from '@a-vue'
9
+
10
+ @Component({
11
+ props: ['title']
12
+ })
13
+ export default class ATab extends Vue {
14
+ visible = false
15
+
16
+ show () {
17
+ this.visible = true
18
+ }
19
+
20
+ hide () {
21
+ this.visible = false
22
+ }
23
+ }
24
+ </script>
25
+
26
+ <style lang="scss" scoped>
27
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div>
3
+ <div :class="['menuContainer', {first}]">
4
+ <div class="menu">
5
+ <div
6
+ v-for="(title, index) in titles"
7
+ :key="index"
8
+ :class="['label', {selected: index === currentIndex}]"
9
+ @click="setTab(index)"
10
+ >
11
+ {{ title }}
12
+ </div>
13
+ </div>
14
+ </div>
15
+
16
+ <div class="content">
17
+ <slot />
18
+ </div>
19
+ </div>
20
+ </template>
21
+
22
+ <script>
23
+ import { Component, Vue } from '@a-vue'
24
+
25
+ @Component({
26
+ props: [{first: false}]
27
+ })
28
+ export default class ATabs extends Vue {
29
+ titles = []
30
+ currentIndex = 0
31
+
32
+ mounted () {
33
+ this.titles = this.$children.map(c => c.title)
34
+
35
+ this.$children[this.currentIndex].show()
36
+ }
37
+
38
+ setTab (index) {
39
+ this.currentIndex = index
40
+ this.$children.forEach((tab, i) => {
41
+ if (i === this.currentIndex) {
42
+ tab.show()
43
+ } else {
44
+ tab.hide()
45
+ }
46
+ })
47
+ }
48
+ }
49
+ </script>
50
+
51
+ <style lang="scss" scoped>
52
+ .menuContainer {
53
+ border-bottom: 3px solid #DDDDDD;
54
+ margin: 2rem 0;
55
+
56
+ &.first {
57
+ margin-top: 0;
58
+ }
59
+ }
60
+
61
+ .menu {
62
+ position: relative;
63
+ display: flex;
64
+ justify-content: center;
65
+
66
+ .label {
67
+ padding: .5rem 1rem .7rem;
68
+ background: white;
69
+ cursor: pointer;
70
+
71
+ text-transform: uppercase;
72
+ letter-spacing: 5px;
73
+ color: #BBBBBB;
74
+ font-size: .8rem;
75
+ white-space: nowrap;
76
+
77
+ &:hover {
78
+ background: #F4F4F4;
79
+ color: #AAAAAA;
80
+ }
81
+
82
+ &.selected {
83
+ background: #DDDDDD;
84
+ color: #666666;
85
+ }
86
+ }
87
+ }
88
+
89
+ </style>
@@ -3,6 +3,7 @@
3
3
  v-show="visible"
4
4
  id="information-bar"
5
5
  :class="{mobile, rail}"
6
+ :style="widthStyle"
6
7
  >
7
8
  <div :class="['toggleButton', {rail}]">
8
9
  <v-app-bar-nav-icon
@@ -40,6 +41,7 @@ export default class InformationBar extends Vue {
40
41
  visible = false
41
42
  mobile = false
42
43
  rail = false
44
+ width = 300
43
45
 
44
46
  created () {
45
47
  this.$events.on(SidebarEvent.STATUS, ({payload: {information, informationRailed, mobile}}) => {
@@ -69,15 +71,15 @@ export default class InformationBar extends Vue {
69
71
 
70
72
  const elTop = document.createElement('div')
71
73
  document.body.appendChild(elTop)
72
- moveChildren(this.$el.querySelector('#information-bar__children .top'), elTop)
74
+ moveChildren(this.getTopContainer(), elTop)
73
75
 
74
76
  const elBottom = document.createElement('div')
75
77
  document.body.appendChild(elBottom)
76
- moveChildren(this.$el.querySelector('#information-bar__children .bottom'), elBottom)
78
+ moveChildren(this.getBottomContainer(), elBottom)
77
79
 
78
80
  this.$nextTick(() => {
79
- moveChildren(elTop, document.querySelector('#information-bar__children .top'))
80
- moveChildren(elBottom, document.querySelector('#information-bar__children .bottom'))
81
+ moveChildren(elTop, this.getTopContainer())
82
+ moveChildren(elBottom, this.getBottomContainer())
81
83
  this.$nextTick(() => {
82
84
  this.$events.dispatch(new SidebarEvent(SidebarEvent.STATUS, new SidebarState(sidebarService)))
83
85
  })
@@ -86,7 +88,8 @@ export default class InformationBar extends Vue {
86
88
 
87
89
  @Watch('rail')
88
90
  railChanged () {
89
- this.$el.style.marginRight = this.rail ? '-240px' : 0
91
+ const right = `calc(-${this.width}px - 3rem + 60px)`
92
+ this.$el.style.marginRight = this.rail ? right : 0
90
93
  }
91
94
 
92
95
  toggleRail () {
@@ -98,6 +101,7 @@ export default class InformationBar extends Vue {
98
101
  const visible = this.hasSidebarItems()
99
102
 
100
103
  if (visible && !old) {
104
+ this.width = this.getWidthFromItems()
101
105
  sidebarService.setInformation(true)
102
106
  }
103
107
 
@@ -110,6 +114,14 @@ export default class InformationBar extends Vue {
110
114
  return this.$el.querySelector('#information-bar__children')
111
115
  }
112
116
 
117
+ getTopContainer () {
118
+ return document.querySelector('#information-bar__children .top')
119
+ }
120
+
121
+ getBottomContainer () {
122
+ return document.querySelector('#information-bar__children .bottom')
123
+ }
124
+
113
125
  hasSidebarItems () {
114
126
  return !!(this.$el.querySelector('#information-bar__children .top').children.length +
115
127
  this.$el.querySelector('#information-bar__children .bottom').children.length)
@@ -118,6 +130,33 @@ export default class InformationBar extends Vue {
118
130
  hideSidebar () {
119
131
  sidebarService.setInformation(false)
120
132
  }
133
+
134
+ getWidthFromItems () {
135
+ let width = 0
136
+
137
+ Array.from(this.getTopContainer().children).forEach(c => {
138
+ if (c.style.width !== 'auto') {
139
+ const w = parseInt(c.style.width)
140
+ width = Math.max(width, w)
141
+ }
142
+ })
143
+
144
+ Array.from(this.getBottomContainer().children).forEach(c => {
145
+ if (c.style.width !== 'auto') {
146
+ const w = parseInt(c.style.width)
147
+ width = Math.max(width, w)
148
+ }
149
+ })
150
+
151
+ return width
152
+ }
153
+
154
+ get widthStyle () {
155
+ return {
156
+ flex: `0 0 calc(${this.width}px + 3rem)`,
157
+ width: `calc(${this.width}px + 3rem)`
158
+ }
159
+ }
121
160
  }
122
161
  </script>
123
162
 
@@ -126,8 +165,6 @@ export default class InformationBar extends Vue {
126
165
  #information-bar {
127
166
  position: relative;
128
167
 
129
- flex: 0 0 300px;
130
- width: 300px;
131
168
  height: 100vh;
132
169
  overflow-x: hidden;
133
170
  overflow-y: auto;
@@ -9,6 +9,7 @@
9
9
 
10
10
  <a-text-field
11
11
  v-model="removeConfirmed"
12
+ class="mt-2"
12
13
  label="Key"
13
14
  :focus="true"
14
15
  width="100"
@@ -34,7 +34,7 @@
34
34
  </a-table-header>
35
35
 
36
36
  <a-table-row
37
- v-for="model in models_"
37
+ v-for="(model, index) in models_"
38
38
  :key="model.id"
39
39
  v-flying-context-trigger="hasFlyingContext"
40
40
  :class="getRowClasses(model)"
@@ -52,6 +52,7 @@
52
52
  <slot
53
53
  name="model-table"
54
54
  :model="model"
55
+ :index="index"
55
56
  />
56
57
  </a-table-row>
57
58
  </a-table>