@bildvitta/quasar-ui-asteroid 2.23.0-beta.4 → 2.23.0-beta.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
- "version": "2.23.0-beta.4",
3
+ "version": "2.23.0-beta.5",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -112,6 +112,10 @@ export default {
112
112
  }
113
113
  },
114
114
 
115
+ fetching: {
116
+ description: 'Fires when fetching the options.'
117
+ },
118
+
115
119
  input: {
116
120
  description: 'Fires when the result changes.',
117
121
  table: noSummary
@@ -109,6 +109,10 @@ export default {
109
109
  }
110
110
  },
111
111
 
112
+ fetching: {
113
+ description: 'Fires when fetching the options.'
114
+ },
115
+
112
116
  input: {
113
117
  description: 'Fires when model changes. Also used by `v-model`.'
114
118
  },
@@ -17,7 +17,7 @@
17
17
  <q-item>
18
18
  <q-item-section class="text-grey">
19
19
  <template v-if="isLoading">
20
- Buscando por {{ label }}...
20
+ Buscando opções de {{ label }}...
21
21
  </template>
22
22
  <template v-else>
23
23
  {{ noOptionLabel }}
@@ -1,21 +1,23 @@
1
1
  <template>
2
2
  <qas-search-box v-bind="$attrs" class="q-pa-md" :fuse-options="fuseOptions" :list="sortedOptions">
3
3
  <template #default="{ results }">
4
- <q-item v-for="(item, index) in results" :key="index">
5
- <slot name="item" v-bind="self">
6
- <slot name="item-section" :result="item">
7
- <q-item-section class="items-start text-bold">
8
- <div :class="labelClass" @click="redirectRoute(item)">{{ item.label }}</div>
4
+ <q-list separator>
5
+ <q-item v-for="(item, index) in results" :key="index">
6
+ <slot name="item" v-bind="self">
7
+ <slot name="item-section" :result="item">
8
+ <q-item-section class="items-start text-bold">
9
+ <div :class="labelClass" @click="redirectRoute(item)">{{ item.label }}</div>
10
+ </q-item-section>
11
+ </slot>
12
+
13
+ <q-item-section avatar>
14
+ <slot name="item-action" v-bind="self">
15
+ <qas-btn hide-mobile-label v-bind="setButtonProps(item)" size="sm" @click="handleClick(item)" />
16
+ </slot>
9
17
  </q-item-section>
10
18
  </slot>
11
-
12
- <q-item-section avatar>
13
- <slot name="item-action" v-bind="self">
14
- <qas-btn hide-mobile-label v-bind="setButtonProps(item)" size="sm" @click="handleClick(item)" />
15
- </slot>
16
- </q-item-section>
17
- </slot>
18
- </q-item>
19
+ </q-item>
20
+ </q-list>
19
21
  </template>
20
22
  </qas-search-box>
21
23
  </template>
@@ -1,4 +1,6 @@
1
1
  import { decamelize } from 'humps'
2
+ import { isEqual } from 'lodash'
3
+ import { uid } from 'quasar'
2
4
 
3
5
  export default {
4
6
  props: {
@@ -63,7 +65,19 @@ export default {
63
65
  },
64
66
 
65
67
  $_virtualScrollClassName () {
66
- return `virtual-scroll-${this.name}`
68
+ const id = uid()
69
+ return `virtual-scroll-${id}`
70
+ }
71
+ },
72
+
73
+ watch: {
74
+ lazyLoadingProps: {
75
+ handler (value, oldValue) {
76
+ if (isEqual(value, oldValue)) return
77
+
78
+ this.$_resetFilter()
79
+ this.$emit('input', '')
80
+ }
67
81
  }
68
82
  },
69
83
 
@@ -114,7 +128,9 @@ export default {
114
128
  if (!this.name) throw new Error(this.$_getMissingPropsMessage('name'))
115
129
 
116
130
  this.hasFetchError = false
131
+
117
132
  this.isLoading = true
133
+ this.$emit('fetching', true)
118
134
 
119
135
  const { url, params, decamelizeFieldName } = this.$_defaultLazyLoadingProps
120
136
 
@@ -148,6 +164,7 @@ export default {
148
164
  return []
149
165
  } finally {
150
166
  this.isLoading = false
167
+ this.$emit('fetching', false)
151
168
  }
152
169
  },
153
170