@afeefa/vue-app 0.0.227 → 0.0.229

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.227
1
+ 0.0.229
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.227",
3
+ "version": "0.0.229",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -38,5 +38,6 @@ export default class ACheckbox extends Vue {
38
38
  <style lang="scss" scoped>
39
39
  .v-input--checkbox {
40
40
  margin: 0;
41
+ padding: 0;
41
42
  }
42
43
  </style>
@@ -7,8 +7,11 @@
7
7
  v-bind="$attrs"
8
8
  @change="$emit('input', $event)"
9
9
  >
10
- <template v-for="option in options_">
10
+ <slot v-if="$slots.default" />
11
+
12
+ <template v-else>
11
13
  <v-radio
14
+ v-for="option in options_"
12
15
  :key="option.itemText"
13
16
  :value="option.itemValue"
14
17
  >
@@ -15,12 +15,9 @@ import EditFormButtons from './form/EditFormButtons'
15
15
  import RemoveButton from './form/RemoveButton'
16
16
  import RemoveDialog from './form/RemoveDialog'
17
17
  import HSeparator from './HSeparator'
18
- import ListCard from './list/ListCard'
19
18
  import ListColumnHeader from './list/ListColumnHeader'
20
19
  import ListColumnSelector from './list/ListColumnSelector'
21
- import ListContent from './list/ListContent'
22
- import ListMeta from './list/ListMeta'
23
- import ListTitle from './list/ListTitle'
20
+ import ListConfig from './list/ListConfig'
24
21
  import ListView from './list/ListView'
25
22
  import ModelCount from './model/ModelCount'
26
23
  import ModelIcon from './model/ModelIcon'
@@ -30,11 +27,8 @@ import Start from './Start'
30
27
  import StickyFooter from './StickyFooter'
31
28
  import CollapseTransition from './transitions/CollapseTransition'
32
29
 
33
- Vue.component('ListCard', ListCard)
34
30
  Vue.component('ListColumnHeader', ListColumnHeader)
35
- Vue.component('ListContent', ListContent)
36
- Vue.component('ListMeta', ListMeta)
37
- Vue.component('ListTitle', ListTitle)
31
+ Vue.component('ListConfig', ListConfig)
38
32
  Vue.component('ListView', ListView)
39
33
  Vue.component('ListColumnSelector', ListColumnSelector)
40
34
 
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <div>
3
+ <div
4
+ v-if="bulkSelection"
5
+ class="mb-4"
6
+ >
7
+ <label>Mehrfachauswahl</label>
8
+ <a-checkbox
9
+ v-model="bulkSelection_"
10
+ hide-details
11
+ label="Mehrere auswählen"
12
+ @input="updateList"
13
+ />
14
+ </div>
15
+
16
+ <label>Auswahlmodus</label>
17
+ <a-radio-group
18
+ v-model="dragMode"
19
+ @input="updateList"
20
+ >
21
+ <template #default>
22
+ <v-radio value="grab">
23
+ <template #label>
24
+ <a-icon
25
+ :icon="{icon: grabIcon}"
26
+ class="mr-2"
27
+ /> Liste verschieben
28
+ </template>
29
+ </v-radio>
30
+ <v-radio value="select">
31
+ <template #label>
32
+ <a-icon
33
+ :icon="{icon: selectIcon}"
34
+ class="mr-2"
35
+ /> Text auswählen
36
+ </template>
37
+ </v-radio>
38
+ </template>
39
+ </a-radio-group>
40
+ </div>
41
+ </template>
42
+
43
+ <script>
44
+ import { Component, Vue } from '@a-vue'
45
+ import { mdiTextRecognition, mdiHandBackRight } from '@mdi/js'
46
+
47
+ @Component({
48
+ props: [{
49
+ bulkSelection: false
50
+ }]
51
+ })
52
+ export default class ListConfig extends Vue {
53
+ bulkSelection_ = false
54
+ dragMode = 'grab'
55
+
56
+ grabIcon = mdiHandBackRight
57
+ selectIcon = mdiTextRecognition
58
+
59
+ created () {
60
+ this.bulkSelection_ = this.listView._bulkSelection
61
+ this.dragMode = this.listView._dragMode
62
+ }
63
+
64
+ get listView () {
65
+ let parent = this.$parent
66
+ while (parent) {
67
+ if (parent.LIST_VIEW) {
68
+ return parent
69
+ }
70
+ parent = parent.$parent
71
+ }
72
+ return null
73
+ }
74
+
75
+ updateList () {
76
+ this.listView.setBulkSelection(this.bulkSelection_)
77
+ this.listView.setDragMode(this.dragMode)
78
+ }
79
+ }
80
+ </script>
81
+
82
+
83
+ <style lang="scss" scoped>
84
+ .contextButton {
85
+ font-size: .7rem;
86
+ cursor: pointer;
87
+ }
88
+
89
+ label {
90
+ color: gray;
91
+ }
92
+ </style>
@@ -29,10 +29,10 @@
29
29
  </template>
30
30
 
31
31
  <template v-else-if="$scopedSlots['model-table']">
32
- <div class="a-table-wrapper">
32
+ <div :class="['a-table-wrapper', _dragMode]">
33
33
  <a-table>
34
34
  <a-table-header>
35
- <div v-if="bulkselection" />
35
+ <div v-if="_bulkSelection" />
36
36
 
37
37
  <div v-if="$has.icon">
38
38
  <slot name="header-icon" />
@@ -54,14 +54,14 @@
54
54
  @click="emitFlyingContext(model)"
55
55
  >
56
56
  <div
57
- v-if="bulkselection"
57
+ v-if="_bulkSelection"
58
58
  class="pr-2"
59
59
  >
60
60
  <a-checkbox
61
61
  :value="isSelected(model)"
62
62
  hide-details
63
63
  class="pa-0"
64
- @input="selectClient(model)"
64
+ @input="selectModel(model)"
65
65
  />
66
66
  </div>
67
67
 
@@ -90,7 +90,7 @@
90
90
  subModel: true
91
91
  }"
92
92
  >
93
- <div v-if="bulkselection" />
93
+ <div v-if="_bulkSelection" />
94
94
 
95
95
  <div v-if="$has.icon" />
96
96
 
@@ -167,7 +167,8 @@ import { LoadingEvent } from '@a-vue/events'
167
167
  'rowClasses',
168
168
  'rowListeners',
169
169
  {
170
- bulkselection: false,
170
+ bulkSelection: false,
171
+ dragMode: 'grab',
171
172
  getSubModels: {
172
173
  default: () => model => []
173
174
  }
@@ -186,16 +187,41 @@ export default class ListView extends Mixins(ListViewMixin) {
186
187
 
187
188
  selectedModels = []
188
189
 
190
+ dragMode_ = null
191
+ bulkSelection_ = null
192
+
193
+ setDragMode (mode) {
194
+ this.dragMode_ = mode
195
+ }
196
+
197
+ get _dragMode () {
198
+ return this.dragMode_ || this.dragMode
199
+ }
200
+
201
+ setBulkSelection (mode) {
202
+ this.bulkSelection_ = mode
203
+ }
204
+
205
+ get _bulkSelection () {
206
+ return this.bulkSelection_ || this.bulkSelection
207
+ }
208
+
189
209
  isSelected (model) {
190
210
  return this.selectedModels.includes(model)
191
211
  }
192
212
 
193
- selectClient (model) {
213
+ selectModel (model) {
194
214
  if (!this.isSelected(model)) {
195
215
  this.selectedModels.push(model)
196
216
  } else {
197
217
  this.selectedModels = this.selectedModels.filter(m => m !== model)
198
218
  }
219
+ this.$emit('update:selectedModels', this.selectedModels)
220
+ }
221
+
222
+ _listLoaded () {
223
+ this.selectedModels = []
224
+ this.$emit('update:selectedModels', this.selectedModels)
199
225
  }
200
226
 
201
227
  @Watch('isLoading')
@@ -269,6 +295,10 @@ export default class ListView extends Mixins(ListViewMixin) {
269
295
  }
270
296
 
271
297
  startShifting (event) {
298
+ if (this._dragMode !== 'grab') {
299
+ return
300
+ }
301
+
272
302
  this.scrollContainerX = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'h')
273
303
  this.scrollContainerY = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'v')
274
304
 
@@ -352,7 +382,10 @@ export default class ListView extends Mixins(ListViewMixin) {
352
382
  overflow-x: auto;
353
383
  overflow-y: hidden;
354
384
  padding-bottom: 1rem;
355
- cursor: grab;
385
+
386
+ &.grab {
387
+ cursor: grab;
388
+ }
356
389
  }
357
390
 
358
391
  .filters:not(:empty) {
@@ -1,12 +0,0 @@
1
- <template>
2
- <div class="listCard">
3
- <slot />
4
- </div>
5
- </template>
6
-
7
-
8
- <style lang="scss" scoped>
9
- .listCard {
10
- margin-bottom: 1rem;
11
- }
12
- </style>
@@ -1,13 +0,0 @@
1
- <template>
2
- <div class="listContent">
3
- <slot />
4
- </div>
5
- </template>
6
-
7
-
8
- <style lang="scss" scoped>
9
- .listContent {
10
- background: #F4F4F4;
11
- padding: .5rem;
12
- }
13
- </style>
@@ -1,13 +0,0 @@
1
- <template>
2
- <div class="listMeta">
3
- <slot />
4
- </div>
5
- </template>
6
-
7
-
8
- <style lang="scss" scoped>
9
- .listMeta {
10
- color: gray;
11
- font-size: .7rem;
12
- }
13
- </style>
@@ -1,24 +0,0 @@
1
- <template>
2
- <router-link
3
- v-if="link"
4
- :to="link"
5
- >
6
- <h3>
7
- <slot />
8
- </h3>
9
- </router-link>
10
-
11
- <h3 v-else>
12
- <slot />
13
- </h3>
14
- </template>
15
-
16
- <script>
17
- import { Component, Vue } from '@a-vue'
18
-
19
- @Component({
20
- props: ['link']
21
- })
22
- export default class ListTitle extends Vue {
23
- }
24
- </script>