@afeefa/vue-app 0.0.292 → 0.0.293

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.292
1
+ 0.0.293
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.292",
3
+ "version": "0.0.293",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <div>
3
- <div :class="['menuContainer', {first}]">
3
+ <div
4
+ v-if="countTabs > 1 || !hideSingle"
5
+ :class="['menuContainer', {first}]"
6
+ >
4
7
  <div class="menu">
5
8
  <div
6
9
  v-for="(title, index) in titles"
7
- :key="index"
10
+ :key="title + '-' + index"
8
11
  :class="['label', {selected: index === currentIndex}]"
9
12
  @click="setTab(index)"
10
13
  >
@@ -30,21 +33,33 @@
30
33
  </template>
31
34
 
32
35
  <script>
33
- import { Component, Vue } from '@a-vue'
36
+ import { Component, Vue, Watch } from '@a-vue'
34
37
 
35
38
  @Component({
36
- props: ['beforeChange', {first: false}]
39
+ props: ['beforeChange', {first: false, hideSingle: false}]
37
40
  })
38
41
  export default class ATabs extends Vue {
39
42
  titles = []
40
43
  icons = []
41
44
  currentIndex = 0
45
+ countTabs = 0
42
46
 
43
47
  mounted () {
44
- this.titles = this.$children.map(c => c.title)
45
- this.icons = this.$children.map(c => c.icon)
48
+ this.countTabs = this.getCountTabs()
49
+ }
46
50
 
47
- this.$children[this.currentIndex].show()
51
+ updated () {
52
+ this.countTabs = this.getCountTabs()
53
+ }
54
+
55
+ @Watch('countTabs')
56
+ countTabsChanged (oldt, newt) {
57
+ this.$nextTick(() => {
58
+ this.titles = this.$children.map(c => c.title).filter(t => t)
59
+ this.icons = this.$children.map(c => c.icon).filter(i => i)
60
+
61
+ this.setTab(0)
62
+ })
48
63
  }
49
64
 
50
65
  async setTab (index) {
@@ -56,7 +71,7 @@ export default class ATabs extends Vue {
56
71
  }
57
72
 
58
73
  this.currentIndex = index
59
- const tabs = this.$slots.default.map(s => s.componentInstance)
74
+ const tabs = this.$slots.default.map(s => s.componentInstance).filter(i => i)
60
75
  tabs.forEach((tab, i) => {
61
76
  if (i === this.currentIndex) {
62
77
  tab.show()
@@ -65,6 +80,10 @@ export default class ATabs extends Vue {
65
80
  }
66
81
  })
67
82
  }
83
+
84
+ getCountTabs () {
85
+ return this.$slots.default.filter(s => !!s.tag).length // removed slot has vm.tag === undefined
86
+ }
68
87
  }
69
88
  </script>
70
89
 
@@ -65,6 +65,10 @@ html {
65
65
 
66
66
  .theme--light.v-btn.v-btn--has-bg {
67
67
  background-color: #E9E9E9;
68
+
69
+ &.theme--light.v-btn.v-btn--disabled.v-btn--has-bg {
70
+ background-color: #CCCCCC !important;
71
+ }
68
72
  }
69
73
 
70
74
  .theme--light.v-btn:focus::before {