@phoenix-cg/v-filters 0.2.13 → 0.2.15

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": "@phoenix-cg/v-filters",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -293,21 +293,25 @@ export default {
293
293
  this.$set(this.filters, field._name, value)
294
294
  })
295
295
  this.inited = true
296
- if (!isUpdate) {
296
+ if (!isUpdate && this.initializedEmitted ) {
297
+ this.setUrlParams()
298
+ this.doAction(true)
299
+ }
300
+ if (!this.initializedEmitted ) {
297
301
  this.setUrlParams(false, this.getInitialFlatFilters())
298
302
  this.$emit('fields-initialized', this.getInitialFlatFilters())
299
303
  this.initializedEmitted = true
300
- } else {
301
- this.setUrlParams()
302
- this.doAction(true)
303
304
  }
304
305
  },
305
306
  getInitialFlatFilters () {
306
307
  const filters = { ...this.filterParamsToInclude }
307
308
  this.fields.forEach(field => {
308
- const value = this.filters[field._name]
309
- if (!value) return
310
- filters[field._name] = [value._id]
309
+ const filtersValue = this.filters[field._name]
310
+ const wrappedValue = getType(filtersValue) === 'Array' ? filtersValue : [filtersValue]
311
+ const [value] = wrappedValue
312
+ if (value) {
313
+ filters[field._name] = wrappedValue.map(value => value?._id || value)
314
+ }
311
315
  })
312
316
  return filters
313
317
  },
@@ -332,7 +336,7 @@ export default {
332
336
  this.editedFields = this.editedFields.filter(field => !toRemove.includes(field))
333
337
  },
334
338
  doAction (showResult = false) {
335
- if (showResult && !this.initializedEmitted) {
339
+ if (showResult) {
336
340
  this.showResult()
337
341
  } else {
338
342
  this.requestCount()