@afeefa/vue-app 0.0.320 → 0.0.322

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.320
1
+ 0.0.322
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.320",
3
+ "version": "0.0.322",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -99,6 +99,8 @@
99
99
  >
100
100
  Alles zurücksetzen
101
101
  </v-btn>
102
+
103
+ <slot name="append" />
102
104
  </a-row>
103
105
  </div>
104
106
  </div>
@@ -42,7 +42,7 @@ export class ComponentWidthMixin extends Vue {
42
42
  }
43
43
 
44
44
  if (maxWidth) {
45
- styles.push(`max-width: ${this.cwm_toPixel_(maxWidth)}; background: yellow`)
45
+ styles.push(`max-width: ${this.cwm_toPixel_(maxWidth)}`)
46
46
  }
47
47
 
48
48
  return styles.join(' ')
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Recursively merges source into target.
3
+ * Returns a new object without mutating target or source.
4
+ * Arrays and non-plain-objects are overwritten (not merged).
5
+ */
6
+ export function deepMerge (target, source) {
7
+ const result = { ...target }
8
+ for (const key of Object.keys(source)) {
9
+ if (
10
+ result[key] && typeof result[key] === 'object' && !Array.isArray(result[key]) &&
11
+ source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])
12
+ ) {
13
+ result[key] = deepMerge(result[key], source[key])
14
+ } else {
15
+ result[key] = source[key]
16
+ }
17
+ }
18
+ return result
19
+ }
20
+
@@ -2,9 +2,17 @@
2
2
  <div>
3
3
  <a-context-menu>
4
4
  <template #activator>
5
- <div class="contextButton">
6
- {{ selectedColumns.length }}/{{ Object.keys(columns_).length }}
7
- </div>
5
+ <v-btn
6
+ class="columnsButton"
7
+ title="Spalten wählen"
8
+ >
9
+ <v-icon color="#BBBBBB">
10
+ {{ mdiViewColumn }}
11
+ </v-icon>
12
+ <div class="ml-1">
13
+ {{ selectedColumns.length }}/{{ Object.keys(columns_).length }}
14
+ </div>
15
+ </v-btn>
8
16
  </template>
9
17
 
10
18
  <a-draggable-checkbox-group
@@ -24,21 +32,43 @@
24
32
  v-on="$listeners"
25
33
  @input="columnSelected"
26
34
  />
35
+
36
+ <v-btn
37
+ v-if="drag"
38
+ x-small
39
+ text
40
+ class="mt-2 reset-button"
41
+ @click="resetColumnOrder"
42
+ >
43
+ <v-icon
44
+ small
45
+ class="mr-1"
46
+ >
47
+ {{ mdiRestore }}
48
+ </v-icon>
49
+ Reihenfolge zurücksetzen
50
+ </v-btn>
27
51
  </a-context-menu>
28
52
  </div>
29
53
  </template>
30
54
 
31
55
  <script>
32
56
  import { Component, Vue } from '@a-vue'
57
+ import { mdiRestore, mdiViewColumn } from '@mdi/js'
33
58
 
34
59
  @Component({
35
60
  props: ['columns', 'storageKey', {drag: false}]
36
61
  })
37
62
  export default class ListColumnSelector extends Vue {
63
+ mdiViewColumn = mdiViewColumn
64
+ mdiRestore = mdiRestore
65
+
38
66
  columns_ = {}
67
+ defaultColumns = {}
39
68
  selectedColumns = []
40
69
 
41
70
  created () {
71
+ this.defaultColumns = JSON.parse(JSON.stringify(this.columns))
42
72
  this.loadColumnConfiguration()
43
73
  this.saveColumnConfiguration()
44
74
  }
@@ -54,9 +84,18 @@ export default class ListColumnSelector extends Vue {
54
84
  }
55
85
 
56
86
  columnSelected () {
57
- for (const key in this.columns) {
58
- this.columns[key].visible = this.selectedColumns.includes(key)
87
+ for (const key in this.columns_) {
88
+ this.columns_[key].visible = this.selectedColumns.includes(key)
59
89
  }
90
+ this.$emit('update:columns', this.columns_)
91
+ this.saveColumnConfiguration()
92
+ }
93
+
94
+ resetColumnOrder () {
95
+ this.columns_ = JSON.parse(JSON.stringify(this.defaultColumns))
96
+ this.selectedColumns = Object.keys(this.columns_)
97
+ .filter(k => this.columns_[k].visible)
98
+ this.$emit('update:columns', this.columns_)
60
99
  this.saveColumnConfiguration()
61
100
  }
62
101
 
@@ -126,8 +165,19 @@ export default class ListColumnSelector extends Vue {
126
165
 
127
166
 
128
167
  <style lang="scss" scoped>
129
- .contextButton {
130
- font-size: .7rem;
131
- cursor: pointer;
168
+ .columnsButton {
169
+ padding: 0 8px 0 5px !important;
170
+ height: 2.2rem !important;
171
+
172
+ div {
173
+ font-size: .8rem;
174
+ color: #666666;
175
+ }
176
+ }
177
+
178
+ .reset-button {
179
+ font-size: .75rem;
180
+ text-transform: none;
181
+ letter-spacing: normal;
132
182
  }
133
183
  </style>