@bildvitta/quasar-ui-asteroid 2.12.1 → 2.12.2

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.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <q-drawer v-model="model" content-class="bg-primary-contrast" :mini="miniMode" :width="230" @before-hide="beforeHide">
3
- <q-list class="text-primary" padding>
3
+ <q-list class="text-primary">
4
4
  <div v-for="(header, index) in items" :key="index">
5
5
  <q-expansion-item v-if="hasChildren(header)" :active-class="activeSecondaryItemClasses" :default-opened="shouldExpand(header)" expand-icon="o_keyboard_arrow_down" expand-separator :icon="header.icon" :label="header.label" :to="header.to">
6
6
  <q-item v-for="(item, itemIndex) in header.children" :key="itemIndex" v-ripple :active-class="activeItemClasses" clickable :to="item.to">
@@ -41,7 +41,7 @@
41
41
  </div>
42
42
 
43
43
  <div v-if="badges && hasActiveFilters" class="q-mt-md">
44
- <q-chip v-for="(filterItem, key) in activeFilters" :key="key" color="grey-4" dense removable size="md" text-color="grey-8" @remove="removeFilter(filterItem)">{{ filterItem.label }} = "{{ filterItem.value }}"</q-chip>
44
+ <q-chip v-for="(filterItem, key) in activeFilters" :key="key" color="grey-4" dense removable size="md" text-color="grey-8" @remove="removeFilter(filterItem)">{{ filterItem.label }} = "{{ handleChipValue(filterItem.value) }}"</q-chip>
45
45
  </div>
46
46
 
47
47
  <slot :context="context" :filter="filter" :filters="activeFilters" :removeFilter="removeFilter" />
@@ -188,7 +188,7 @@ export default {
188
188
 
189
189
  created () {
190
190
  this.fetchFilters()
191
- this.updateValues()
191
+ this.watchOnceFields()
192
192
  },
193
193
 
194
194
  methods: {
@@ -252,6 +252,10 @@ export default {
252
252
  this.$router.push({ query })
253
253
  },
254
254
 
255
+ getChipValue (value) {
256
+ return Array.isArray(value) ? value.join(', ') : value
257
+ },
258
+
255
259
  removeFilter ({ name }) {
256
260
  const query = { ...this.$route.query }
257
261
 
@@ -266,8 +270,23 @@ export default {
266
270
  this.search = search || ''
267
271
 
268
272
  for (const key in filters) {
269
- this.$set(this.filters, key, parseValue(filters[key]))
273
+ this.$set(this.filters, key, parseValue(this.normalizeValues(filters[key], this.fields[key]?.multiple)))
270
274
  }
275
+ },
276
+
277
+ normalizeValues (value, isMultiple) {
278
+ if (Array.isArray(value)) return value
279
+
280
+ return isMultiple ? [value] : value
281
+ },
282
+
283
+ watchOnceFields () {
284
+ const watchOnce = this.$watch('fields', values => {
285
+ if (Object.keys(values).length) {
286
+ this.updateValues()
287
+ watchOnce()
288
+ }
289
+ })
271
290
  }
272
291
  }
273
292
  }