@afeefa/vue-app 0.0.297 → 0.0.299

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.297
1
+ 0.0.299
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.297",
3
+ "version": "0.0.299",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -18,6 +18,7 @@ import NestedEditForm from './form/NestedEditForm'
18
18
  import ListFilterDate from './list/filters/ListFilterDate'
19
19
  import ListFilterPage from './list/filters/ListFilterPage'
20
20
  import ListFilterSearch from './list/filters/ListFilterSearch'
21
+ import ListFilterSearch2 from './list/filters/ListFilterSearch2'
21
22
  import ListFilterSearchSelect from './list/filters/ListFilterSearchSelect'
22
23
  import ListFilterSelect from './list/filters/ListFilterSelect'
23
24
 
@@ -38,6 +39,7 @@ Vue.component('FormFieldSelect', FormFieldSelect)
38
39
  Vue.component('FormFieldSelect2', FormFieldSelect2)
39
40
  Vue.component('ListFilterPage', ListFilterPage)
40
41
  Vue.component('ListFilterSearch', ListFilterSearch)
42
+ Vue.component('ListFilterSearch2', ListFilterSearch2)
41
43
  Vue.component('ListFilterSelect', ListFilterSelect)
42
44
  Vue.component('ListFilterSearchSelect', ListFilterSearchSelect)
43
45
  Vue.component('ListFilterDate', ListFilterDate)
@@ -0,0 +1,96 @@
1
+ <template>
2
+ <a-row gap="4">
3
+ <a-text-field
4
+ ref="input"
5
+ v-model="filter.value"
6
+ :maxWidth="$attrs.maxWidth || maxWidth_"
7
+ :label="label_"
8
+ :debounce="500"
9
+ v-bind="$attrs"
10
+ clearable
11
+ hide-details
12
+ @keyup.esc="clearValue"
13
+ v-on="$listeners"
14
+ />
15
+
16
+ <a-radio-group
17
+ v-model="filters.qfield.value"
18
+ :options="qFieldOptions"
19
+ row
20
+ hide-details
21
+ />
22
+ </a-row>
23
+ </template>
24
+
25
+
26
+ <script>
27
+ import { Component, Mixins } from '@a-vue'
28
+ import { ListFilterMixin } from '../ListFilterMixin'
29
+
30
+ @Component({
31
+ props: [{
32
+ translateOption: {
33
+ default: () => title => title
34
+ }
35
+ }]
36
+ })
37
+ export default class ListFilterSearch2 extends Mixins(ListFilterMixin) {
38
+ name_ = 'q'
39
+ maxWidth_ = 200
40
+
41
+ clearValue (e) {
42
+ if (this.filter.value) {
43
+ e.stopPropagation()
44
+ this.filter.value = null
45
+ }
46
+ }
47
+
48
+ setFocus (force) {
49
+ this.$refs.input.setFocus(force)
50
+ }
51
+
52
+ hasQFieldOptions () {
53
+ return this.filters.qfield && this.filters.qfield.hasOptions()
54
+ }
55
+
56
+ get qFieldOptions () {
57
+ return this.filters.qfield.options.map(o => ({
58
+ ...o,
59
+ itemText: this.translateOption(o.title),
60
+ itemValue: o.value
61
+ }))
62
+ }
63
+
64
+ get label_ () {
65
+ const label = this.label || 'Suche'
66
+
67
+ if (this.hasQFieldOptions() && !this.filters.qfield.hasDefaultValueSet()) {
68
+ const selected = this.qFieldOptions.filter(o => o.value === this.filters.qfield.value)[0]
69
+ if (selected) {
70
+ const qFieldTitle = this.translateOption(selected.title)
71
+ return `${label} (${qFieldTitle})`
72
+ }
73
+ }
74
+
75
+ return label
76
+ }
77
+ }
78
+ </script>
79
+
80
+
81
+ <style lang="scss" scoped>
82
+ ::v-deep() {
83
+ .v-text-field .v-label {
84
+ max-width: unset;
85
+ }
86
+
87
+ .v-radio {
88
+ margin-right: 14px !important;
89
+ margin-top: -4px;
90
+ }
91
+
92
+ .v-input--selection-controls__input {
93
+ margin-right: 3px;
94
+ }
95
+ }
96
+ </style>