@afeefa/vue-app 0.0.227 → 0.0.228

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.227
1
+ 0.0.228
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.228",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -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,93 @@
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
+ columns: false
51
+ }]
52
+ })
53
+ export default class ListConfig extends Vue {
54
+ bulkSelection_ = false
55
+ dragMode = 'grab'
56
+
57
+ grabIcon = mdiHandBackRight
58
+ selectIcon = mdiTextRecognition
59
+
60
+ created () {
61
+ this.bulkSelection_ = this.listView._bulkSelection
62
+ this.dragMode = this.listView._dragMode
63
+ }
64
+
65
+ get listView () {
66
+ let parent = this.$parent
67
+ while (parent) {
68
+ if (parent.LIST_VIEW) {
69
+ return parent
70
+ }
71
+ parent = parent.$parent
72
+ }
73
+ return null
74
+ }
75
+
76
+ updateList () {
77
+ this.listView.setBulkSelection(this.bulkSelection_)
78
+ this.listView.setDragMode(this.dragMode)
79
+ }
80
+ }
81
+ </script>
82
+
83
+
84
+ <style lang="scss" scoped>
85
+ .contextButton {
86
+ font-size: .7rem;
87
+ cursor: pointer;
88
+ }
89
+
90
+ label {
91
+ color: gray;
92
+ }
93
+ </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,7 +54,7 @@
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
@@ -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,6 +187,25 @@ 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
  }
@@ -269,6 +289,10 @@ export default class ListView extends Mixins(ListViewMixin) {
269
289
  }
270
290
 
271
291
  startShifting (event) {
292
+ if (this._dragMode !== 'grab') {
293
+ return
294
+ }
295
+
272
296
  this.scrollContainerX = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'h')
273
297
  this.scrollContainerY = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'v')
274
298
 
@@ -352,7 +376,10 @@ export default class ListView extends Mixins(ListViewMixin) {
352
376
  overflow-x: auto;
353
377
  overflow-y: hidden;
354
378
  padding-bottom: 1rem;
355
- cursor: grab;
379
+
380
+ &.grab {
381
+ cursor: grab;
382
+ }
356
383
  }
357
384
 
358
385
  .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>