@afeefa/vue-app 0.0.226 → 0.0.228

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.226
1
+ 0.0.228
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.226",
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,9 +29,11 @@
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" />
36
+
35
37
  <div v-if="$has.icon">
36
38
  <slot name="header-icon" />
37
39
  </div>
@@ -39,29 +41,67 @@
39
41
  <slot name="header-table" />
40
42
  </a-table-header>
41
43
 
42
- <a-table-row
43
- v-for="(model, index) in models_"
44
- :key="model.id"
45
- v-flying-context-trigger="hasFlyingContext"
46
- :class="getRowClasses(model)"
47
- v-bind="getRowAttributes(model)"
48
- v-on="getRowListeners(model)"
49
- @click="emitFlyingContext(model)"
50
- >
51
- <v-icon
52
- v-if="$has.icon"
53
- :color="model.getIcon().color"
54
- size="1.2rem"
55
- v-text="model.getIcon().icon"
56
- />
57
-
58
- <slot
59
- name="model-table"
60
- :model="model"
61
- :index="index"
62
- :filters="filters"
63
- />
64
- </a-table-row>
44
+ <template v-for="(model, index) in models_">
45
+ <a-table-row
46
+ :key="'model' + model.id"
47
+ v-flying-context-trigger="hasFlyingContext"
48
+ :class="[
49
+ getRowClasses(model),
50
+ { hasSubModels: !!getSubModels(model).length }
51
+ ]"
52
+ v-bind="getRowAttributes(model)"
53
+ v-on="getRowListeners(model)"
54
+ @click="emitFlyingContext(model)"
55
+ >
56
+ <div
57
+ v-if="_bulkSelection"
58
+ class="pr-2"
59
+ >
60
+ <a-checkbox
61
+ :value="isSelected(model)"
62
+ hide-details
63
+ class="pa-0"
64
+ @input="selectClient(model)"
65
+ />
66
+ </div>
67
+
68
+ <v-icon
69
+ v-if="$has.icon"
70
+ :color="model.getIcon().color"
71
+ size="1.2rem"
72
+ v-text="model.getIcon().icon"
73
+ />
74
+
75
+ <slot
76
+ name="model-table"
77
+ :model="model"
78
+ :index="index"
79
+ :filters="filters"
80
+ />
81
+ </a-table-row>
82
+
83
+ <a-table-row
84
+ v-for="(subModel, subIndex) in getSubModels(model)"
85
+ :key="subModel.id"
86
+ small
87
+ :class="{
88
+ ...getRowClasses(model),
89
+ last: subIndex === getSubModels(model).length - 1,
90
+ subModel: true
91
+ }"
92
+ >
93
+ <div v-if="_bulkSelection" />
94
+
95
+ <div v-if="$has.icon" />
96
+
97
+ <slot
98
+ name="subModel-table"
99
+ :model="subModel"
100
+ :index="subIndex"
101
+ :filters="filters"
102
+ />
103
+ </a-table-row>
104
+ </template>
65
105
  </a-table>
66
106
  </div>
67
107
  </template>
@@ -122,7 +162,18 @@ import { ListViewMixin } from '@a-vue/components/list/ListViewMixin'
122
162
  import { LoadingEvent } from '@a-vue/events'
123
163
 
124
164
  @Component({
125
- props: ['rowAttributes', 'rowClasses', 'rowListeners']
165
+ props: [
166
+ 'rowAttributes',
167
+ 'rowClasses',
168
+ 'rowListeners',
169
+ {
170
+ bulkSelection: false,
171
+ dragMode: 'grab',
172
+ getSubModels: {
173
+ default: () => model => []
174
+ }
175
+ }
176
+ ]
126
177
  })
127
178
  export default class ListView extends Mixins(ListViewMixin) {
128
179
  $hasOptions = ['icon', 'filters']
@@ -134,6 +185,39 @@ export default class ListView extends Mixins(ListViewMixin) {
134
185
  scrollTopStart = null
135
186
  scrollContainerY = null
136
187
 
188
+ selectedModels = []
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
+
209
+ isSelected (model) {
210
+ return this.selectedModels.includes(model)
211
+ }
212
+
213
+ selectClient (model) {
214
+ if (!this.isSelected(model)) {
215
+ this.selectedModels.push(model)
216
+ } else {
217
+ this.selectedModels = this.selectedModels.filter(m => m !== model)
218
+ }
219
+ }
220
+
137
221
  @Watch('isLoading')
138
222
  isLoadingChanged () {
139
223
  if (this.events) {
@@ -205,6 +289,10 @@ export default class ListView extends Mixins(ListViewMixin) {
205
289
  }
206
290
 
207
291
  startShifting (event) {
292
+ if (this._dragMode !== 'grab') {
293
+ return
294
+ }
295
+
208
296
  this.scrollContainerX = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'h')
209
297
  this.scrollContainerY = this.getScrollParent(this.$el.querySelector('.a-table-wrapper'), 'v')
210
298
 
@@ -288,7 +376,10 @@ export default class ListView extends Mixins(ListViewMixin) {
288
376
  overflow-x: auto;
289
377
  overflow-y: hidden;
290
378
  padding-bottom: 1rem;
291
- cursor: grab;
379
+
380
+ &.grab {
381
+ cursor: grab;
382
+ }
292
383
  }
293
384
 
294
385
  .filters:not(:empty) {
@@ -308,4 +399,19 @@ filters-below:not(:empty) {
308
399
  .a-table-row.clickable {
309
400
  cursor: pointer;
310
401
  }
402
+
403
+ :deep(.a-table-row.hasSubModels) > * {
404
+ padding-bottom: 0;
405
+ border: none;
406
+ }
407
+
408
+ :deep(.a-table-row.small.subModel) > * {
409
+ padding-top: 0;
410
+ color: gray;
411
+ }
412
+
413
+ :deep(.a-table-row.small.subModel):not(.last) > * {
414
+ border: none;
415
+ padding-bottom: 0;
416
+ }
311
417
  </style>
@@ -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>