@phoenix-cg/v-filters 0.2.0-beta.4 → 0.2.0-beta.7

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.
@@ -4345,7 +4345,7 @@ if (typeof window !== 'undefined') {
4345
4345
  // Indicate to webpack that this file can be concatenated
4346
4346
  /* harmony default export */ var setPublicPath = (null);
4347
4347
 
4348
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1120b0fb-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/VFilters.vue?vue&type=template&id=687faba8&
4348
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"cf5396ca-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/VFilters.vue?vue&type=template&id=765a2cf6&
4349
4349
  var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"v-filters"},[_c('div',{staticClass:"v-filters_fields"},[_vm._t("before-fields"),_vm._l((_vm.fields),function(field){return _c(_vm.fieldComponentName,{key:field._name,tag:"component",attrs:{"title":field.title}},[_c(_vm.componentsMap[field._type],_vm._b({key:_vm.fieldKey,tag:"component",on:{"input":function($event){return _vm.handleFieldChange(field._name)}},model:{value:(_vm.filters[field._name]),callback:function ($$v) {_vm.$set(_vm.filters, field._name, $$v)},expression:"filters[field._name]"}},'component',field._fieldProps || {},false))],1)}),_vm._t("after-fields"),_vm._t("actions",[_c(_vm.fieldComponentName,{tag:"component"},[(!_vm.immediate)?_c('button',{staticClass:"v-button v-filters_button",on:{"click":_vm.showResult}},[_vm._v(" "+_vm._s(_vm.actionTitle)+" ")]):_vm._e(),(_vm.edited)?_c('button',{staticClass:"v-button v-filters_button __reset",on:{"click":_vm.resetFilters}},[_vm._v(" Сбросить параметры ")]):_vm._e()])],null,{
4350
4350
  showResult: _vm.showResult,
4351
4351
  resetFilters: _vm.resetFilters,
@@ -4362,7 +4362,7 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
4362
4362
  var staticRenderFns = []
4363
4363
 
4364
4364
 
4365
- // CONCATENATED MODULE: ./src/components/VFilters.vue?vue&type=template&id=687faba8&
4365
+ // CONCATENATED MODULE: ./src/components/VFilters.vue?vue&type=template&id=765a2cf6&
4366
4366
 
4367
4367
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
4368
4368
  var es_object_keys = __webpack_require__("b64b");
@@ -5318,6 +5318,28 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
5318
5318
  }
5319
5319
 
5320
5320
  _this2.addEditedField(field._name);
5321
+ } else if (params[field._name] && isUpdate && field._type !== 'range') {
5322
+ if (valueNotArray) {
5323
+ var isValueInData = field.data.some(function (dataValue) {
5324
+ return dataValue._id === value._id || dataValue._id === value;
5325
+ });
5326
+
5327
+ if (!isValueInData) {
5328
+ value = field.data[0];
5329
+ }
5330
+ } else {
5331
+ value = field.value.reduce(function (acc, currentValue) {
5332
+ var isValueInData = field.data.some(function (dataValue) {
5333
+ return dataValue._id === currentValue._id || dataValue._id === currentValue;
5334
+ });
5335
+
5336
+ if (isValueInData) {
5337
+ acc.push(currentValue);
5338
+ }
5339
+
5340
+ return acc;
5341
+ }, []);
5342
+ }
5321
5343
  } else if ((!params[field._name] || isUpdate) && valueNotArray) {
5322
5344
  var _field$value2 = _slicedToArray(field.value, 1);
5323
5345
 
@@ -5353,7 +5375,7 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
5353
5375
  _this2.$set(_this2.filters, field._name, value);
5354
5376
  });
5355
5377
  this.setUrlParams(isUpdate);
5356
- !isUpdate && this.doAction();
5378
+ !isUpdate && this.doAction(true);
5357
5379
  },
5358
5380
  resetFilters: function resetFilters() {
5359
5381
  this.editedFields = [];
@@ -5365,7 +5387,14 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
5365
5387
  }
5366
5388
  },
5367
5389
  doAction: function doAction() {
5368
- this.immediate ? this.showResult() : this.requestCount();
5390
+ var both = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
5391
+
5392
+ if (both) {
5393
+ this.requestCount();
5394
+ this.showResult();
5395
+ } else {
5396
+ this.immediate ? this.showResult() : this.requestCount();
5397
+ }
5369
5398
  },
5370
5399
  requestCount: function requestCount() {
5371
5400
  this.$emit('request-count', this.flatFilters);