@afeefa/vue-app 0.0.225 → 0.0.226

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- 0.0.225
1
+ 0.0.226
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.225",
3
+ "version": "0.0.226",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -5,6 +5,7 @@
5
5
  :items="items_"
6
6
  :valueComparator="compareValues"
7
7
  :style="cwm_widthStyle"
8
+ :multiple="multiple"
8
9
  v-bind="{...$attrs, dense, outlined}"
9
10
  v-on="$listeners"
10
11
  />
@@ -17,7 +18,7 @@ import { Model } from '@afeefa/api-resources-client'
17
18
  import { ComponentWidthMixin } from './mixins/ComponentWidthMixin'
18
19
 
19
20
  @Component({
20
- props: ['validator', 'defaultValue', 'items', {dense: true, outlined: true}]
21
+ props: ['validator', 'defaultValue', 'items', {dense: true, outlined: true, multiple: false}]
21
22
  })
22
23
  export default class ASelect extends Mixins(ComponentWidthMixin) {
23
24
  items_ = []
@@ -34,7 +35,11 @@ export default class ASelect extends Mixins(ComponentWidthMixin) {
34
35
  const setValue = this.select.setValue
35
36
  this.select.setValue = value => {
36
37
  if (this.select.isClear) {
37
- value = this.defaultValue || null
38
+ if (this.multiple) {
39
+ value = this.defaultValue || []
40
+ } else {
41
+ value = this.defaultValue || null
42
+ }
38
43
  }
39
44
  setValue(value)
40
45
  }
@@ -98,6 +103,14 @@ export default class ASelect extends Mixins(ComponentWidthMixin) {
98
103
  </script>
99
104
 
100
105
 
106
+ <style lang="scss">
107
+ .v-application .v-select-list .v-list-item__action {
108
+ margin: 0;
109
+ margin-right: .5rem;
110
+ }
111
+
112
+ </style>
113
+
101
114
  <style lang="scss" scoped>
102
115
  .v-text-field :deep(.v-input__icon--clear) { // always show clear icon, https://github.com/vuetifyjs/vuetify/pull/15876
103
116
  opacity: 1;
@@ -5,7 +5,8 @@
5
5
  :items="_items"
6
6
  itemText="itemTitle"
7
7
  itemValue="itemValue"
8
- :clearable="filter.hasDefaultValue() && !filter.hasDefaultValueSet()"
8
+ :multiple="filter.multiple"
9
+ :clearable="clearable"
9
10
  :defaultValue="filter.defaultValue"
10
11
  hide-details
11
12
  v-bind="$attrs"
@@ -25,6 +26,10 @@ export default class ListFilterSelect extends Mixins(ListFilterMixin) {
25
26
  items = null
26
27
 
27
28
  created () {
29
+ if (this.filter.multiple && !this.filter.value) {
30
+ this.filter.value = []
31
+ }
32
+
28
33
  if (this.filter.hasOptionsRequest()) {
29
34
  this.items = this.loadRequestOptions()
30
35
  } else if (this.filter.hasOptions()) {
@@ -32,6 +37,18 @@ export default class ListFilterSelect extends Mixins(ListFilterMixin) {
32
37
  }
33
38
  }
34
39
 
40
+ get clearable () {
41
+ if (this.multiple) {
42
+ return !!this.filter.value?.length
43
+ }
44
+
45
+ if (this.filter.hasDefaultValue()) {
46
+ return !this.filter.hasDefaultValueSet()
47
+ }
48
+
49
+ return !!this.filter.value
50
+ }
51
+
35
52
  get _items () {
36
53
  return this.$attrs.items || this.items || []
37
54
  }