@phoenix-cg/v-filters 0.2.0-beta.2 → 0.2.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/dist/v-filters.common.js +50 -6
- package/dist/v-filters.common.js.map +1 -1
- package/dist/v-filters.umd.js +50 -6
- package/dist/v-filters.umd.js.map +1 -1
- package/dist/v-filters.umd.min.js +1 -1
- package/dist/v-filters.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VFilters.vue +15 -5
package/package.json
CHANGED
|
@@ -122,6 +122,10 @@ export default {
|
|
|
122
122
|
fieldKey: {
|
|
123
123
|
type: [String, Number],
|
|
124
124
|
default: '1'
|
|
125
|
+
},
|
|
126
|
+
alwaysSendFields: {
|
|
127
|
+
type: Array,
|
|
128
|
+
default: () => []
|
|
125
129
|
}
|
|
126
130
|
},
|
|
127
131
|
data () {
|
|
@@ -148,8 +152,9 @@ export default {
|
|
|
148
152
|
},
|
|
149
153
|
flatFilters () {
|
|
150
154
|
let filters = {}
|
|
155
|
+
const fieldsToInclude = [...this.editedFields, ...this.alwaysSendFields]
|
|
151
156
|
Object.keys(this.filters).forEach(name => {
|
|
152
|
-
if (
|
|
157
|
+
if (fieldsToInclude.includes(name)) {
|
|
153
158
|
const filtersValue = this.filters[name]
|
|
154
159
|
const wrappedValue = getType(filtersValue) === 'Object' ? [filtersValue] : filtersValue
|
|
155
160
|
filters[name] = wrappedValue.map(value => value._id || value)
|
|
@@ -216,19 +221,24 @@ export default {
|
|
|
216
221
|
this.$set(this.filters, field._name, value)
|
|
217
222
|
})
|
|
218
223
|
this.setUrlParams(isUpdate)
|
|
219
|
-
!isUpdate && this.doAction()
|
|
224
|
+
!isUpdate && this.doAction(true)
|
|
220
225
|
},
|
|
221
226
|
resetFilters () {
|
|
222
227
|
this.editedFields = []
|
|
223
|
-
this.$emit('reset-filters')
|
|
228
|
+
this.$emit('reset-filters', this.flatFilters)
|
|
224
229
|
},
|
|
225
230
|
addEditedField (name) {
|
|
226
231
|
if (!this.editedFields.includes(name)) {
|
|
227
232
|
this.editedFields.push(name)
|
|
228
233
|
}
|
|
229
234
|
},
|
|
230
|
-
doAction () {
|
|
231
|
-
|
|
235
|
+
doAction (both = false) {
|
|
236
|
+
if (both) {
|
|
237
|
+
this.requestCount()
|
|
238
|
+
this.showResult()
|
|
239
|
+
} else {
|
|
240
|
+
this.immediate ? this.showResult() : this.requestCount()
|
|
241
|
+
}
|
|
232
242
|
},
|
|
233
243
|
requestCount () {
|
|
234
244
|
this.$emit('request-count', this.flatFilters)
|