@bildvitta/quasar-ui-asteroid 2.23.0-beta.5 → 2.23.0-beta.6
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
|
@@ -12,16 +12,19 @@
|
|
|
12
12
|
</slot>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
+
<template #hint>
|
|
16
|
+
<slot name="hint">
|
|
17
|
+
<div v-if="isLoading" class="q-pb-sm">
|
|
18
|
+
Buscando por opções...
|
|
19
|
+
</div>
|
|
20
|
+
</slot>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
15
23
|
<template #no-option>
|
|
16
|
-
<slot name="no-option">
|
|
24
|
+
<slot v-if="!isLoading" name="no-option">
|
|
17
25
|
<q-item>
|
|
18
26
|
<q-item-section class="text-grey">
|
|
19
|
-
|
|
20
|
-
Buscando opções de {{ label }}...
|
|
21
|
-
</template>
|
|
22
|
-
<template v-else>
|
|
23
|
-
{{ noOptionLabel }}
|
|
24
|
-
</template>
|
|
27
|
+
{{ noOptionLabel }}
|
|
25
28
|
</q-item-section>
|
|
26
29
|
</q-item>
|
|
27
30
|
</slot>
|
|
@@ -98,10 +101,6 @@ export default {
|
|
|
98
101
|
}
|
|
99
102
|
},
|
|
100
103
|
|
|
101
|
-
label () {
|
|
102
|
-
return this.$attrs.label || ''
|
|
103
|
-
},
|
|
104
|
-
|
|
105
104
|
listeners () {
|
|
106
105
|
const { input, ...events } = this.$listeners
|
|
107
106
|
|
|
@@ -148,19 +147,23 @@ export default {
|
|
|
148
147
|
return this.hasFetchError || this.$attrs.error
|
|
149
148
|
},
|
|
150
149
|
|
|
150
|
+
hasLoading () {
|
|
151
|
+
return this.isLoading || this.$attrs.loading
|
|
152
|
+
},
|
|
153
|
+
|
|
151
154
|
attributes () {
|
|
152
155
|
return {
|
|
156
|
+
bottomSlots: true,
|
|
153
157
|
emitValue: true,
|
|
154
158
|
mapOptions: true,
|
|
155
159
|
outlined: true,
|
|
156
160
|
clearable: this.isSearchable,
|
|
157
|
-
loading: this.isLoading,
|
|
158
161
|
inputDebounce: this.useLazyLoading ? 500 : 0,
|
|
159
|
-
popupContentClass: this.$_virtualScrollClassName,
|
|
160
162
|
...this.$attrs,
|
|
161
163
|
options: this.filteredOptions,
|
|
162
164
|
useInput: this.isSearchable,
|
|
163
|
-
error: this.hasError
|
|
165
|
+
error: this.hasError,
|
|
166
|
+
loading: this.hasLoading
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
},
|
|
@@ -192,12 +195,16 @@ export default {
|
|
|
192
195
|
},
|
|
193
196
|
|
|
194
197
|
methods: {
|
|
195
|
-
onFilter (value, update) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
async onFilter (value, update) {
|
|
199
|
+
if (this.useLazyLoading && value !== this.search) {
|
|
200
|
+
await this.$_filterOptionsByStore(value)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!this.useLazyLoading && this.searchable) {
|
|
204
|
+
this.filterOptionsByFuse(value)
|
|
205
|
+
}
|
|
198
206
|
|
|
199
|
-
|
|
200
|
-
})
|
|
207
|
+
update()
|
|
201
208
|
},
|
|
202
209
|
|
|
203
210
|
filterOptionsByFuse (value) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { decamelize } from 'humps'
|
|
2
2
|
import { isEqual } from 'lodash'
|
|
3
|
-
import { uid } from 'quasar'
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
props: {
|
|
@@ -62,11 +61,6 @@ export default {
|
|
|
62
61
|
|
|
63
62
|
$_hasFilteredOptions () {
|
|
64
63
|
return !!this.filteredOptions.length
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
$_virtualScrollClassName () {
|
|
68
|
-
const id = uid()
|
|
69
|
-
return `virtual-scroll-${id}`
|
|
70
64
|
}
|
|
71
65
|
},
|
|
72
66
|
|
|
@@ -96,17 +90,16 @@ export default {
|
|
|
96
90
|
}
|
|
97
91
|
},
|
|
98
92
|
|
|
99
|
-
async $_onVirtualScroll ({ index }) {
|
|
93
|
+
async $_onVirtualScroll ({ index, ref }) {
|
|
100
94
|
const lastIndex = this.filteredOptions.length - 1
|
|
101
95
|
|
|
102
96
|
if (index === lastIndex && this.$_canFetchOptions()) {
|
|
103
|
-
const { scrollContainer, top } = this.$_getScrollContainerTop()
|
|
104
|
-
|
|
105
97
|
await this.$_loadMoreOptions()
|
|
106
98
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
99
|
+
this.$nextTick(() => {
|
|
100
|
+
ref.reset()
|
|
101
|
+
ref.refresh(lastIndex)
|
|
102
|
+
})
|
|
110
103
|
}
|
|
111
104
|
},
|
|
112
105
|
|
|
@@ -179,17 +172,6 @@ export default {
|
|
|
179
172
|
return hasMorePages && !this.isLoading && !this.isScrolling && this.useLazyLoading
|
|
180
173
|
},
|
|
181
174
|
|
|
182
|
-
$_getScrollContainerTop () {
|
|
183
|
-
const scrollContainer = document.querySelector(`.${this.$_virtualScrollClassName}`)
|
|
184
|
-
const scrollContainerHeight = scrollContainer.offsetHeight
|
|
185
|
-
const scrollContainerTop = scrollContainer.scrollTop
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
scrollContainer,
|
|
189
|
-
top: scrollContainerTop + (scrollContainerHeight / 2)
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
|
|
193
175
|
$_handleOptions (options) {
|
|
194
176
|
if (this.labelKey && this.valueKey && this.renameKey) {
|
|
195
177
|
return options.map(item => this.renameKey(item))
|