@bildvitta/quasar-ui-asteroid 2.12.0 → 2.12.4

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.0",
3
+ "version": "2.12.4",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -59,7 +59,7 @@ export default {
59
59
 
60
60
  computed: {
61
61
  labelValue () {
62
- return !this.hideLabel && this.label
62
+ return this.hideLabel ? '' : this.label
63
63
  }
64
64
  }
65
65
  }
@@ -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">
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <q-input v-bind="$attrs" fill-mask="0" :mask="mask" reverse-fill-mask :value="inputValue" v-on="events" @input="input" />
2
+ <div>
3
+ <q-input v-bind="$attrs" fill-mask="0" :mask="mask" reverse-fill-mask :value="inputValue" v-on="events" @input="input" />
4
+ </div>
3
5
  </template>
4
6
 
5
7
  <script>
@@ -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 }} = "{{ getChipValue(filterItem.value) }}"</q-chip>
45
45
  </div>
46
46
 
47
47
  <slot :context="context" :filter="filter" :filters="activeFilters" :removeFilter="removeFilter" />
@@ -122,7 +122,7 @@ export default {
122
122
  const hasField = fields.includes(key)
123
123
 
124
124
  if (hasField) {
125
- const value = humanize(this.fields[key], filters[key])
125
+ const value = humanize(this.fields[key], this.normalizeValues(filters[key], this.fields[key]?.multiple))
126
126
  const { label, name } = this.fields[key]
127
127
 
128
128
  activeFilters[key] = { label, name, value }
@@ -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
  }
@@ -96,6 +96,8 @@ function handleMasks (value) {
96
96
 
97
97
  // Labels
98
98
  function humanize (field = {}, value) {
99
+ if (!value) return value
100
+
99
101
  const mappedMasks = handleMasks(value)
100
102
 
101
103
  if (mappedMasks[field.mask]) {