@phoenix-cg/v-filters 0.2.0-beta.8 → 0.2.0
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/.browserslistrc +3 -3
- package/.eslintrc.js +26 -26
- package/README.md +39 -39
- package/babel.config.js +3 -3
- package/dist/v-filters.common.js +93 -34
- package/dist/v-filters.common.js.map +1 -1
- package/dist/v-filters.umd.js +93 -34
- 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/jest.config.js +3 -3
- package/package.json +45 -45
- package/postcss.config.js +24 -24
- package/public/index.html +17 -17
- package/src/App.vue +28 -28
- package/src/components/VFilters.vue +327 -315
- package/src/export.js +2 -2
- package/src/main.js +8 -8
- package/tests/unit/example.spec.js +12 -12
- package/vue.config.js +6 -6
package/.browserslistrc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
> 1%
|
|
2
|
-
last 2 versions
|
|
3
|
-
not dead
|
|
1
|
+
> 1%
|
|
2
|
+
last 2 versions
|
|
3
|
+
not dead
|
package/.eslintrc.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
node: true
|
|
5
|
-
},
|
|
6
|
-
extends: ["plugin:vue/essential", "eslint:recommended"],
|
|
7
|
-
parserOptions: {
|
|
8
|
-
parser: "babel-eslint"
|
|
9
|
-
},
|
|
10
|
-
rules: {
|
|
11
|
-
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
12
|
-
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
13
|
-
'quotes': ['error', 'single']
|
|
14
|
-
},
|
|
15
|
-
overrides: [
|
|
16
|
-
{
|
|
17
|
-
files: [
|
|
18
|
-
"**/__tests__/*.{j,t}s?(x)",
|
|
19
|
-
"**/tests/unit/**/*.spec.{j,t}s?(x)"
|
|
20
|
-
],
|
|
21
|
-
env: {
|
|
22
|
-
jest: true
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true
|
|
5
|
+
},
|
|
6
|
+
extends: ["plugin:vue/essential", "eslint:recommended"],
|
|
7
|
+
parserOptions: {
|
|
8
|
+
parser: "babel-eslint"
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
12
|
+
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
|
|
13
|
+
'quotes': ['error', 'single']
|
|
14
|
+
},
|
|
15
|
+
overrides: [
|
|
16
|
+
{
|
|
17
|
+
files: [
|
|
18
|
+
"**/__tests__/*.{j,t}s?(x)",
|
|
19
|
+
"**/tests/unit/**/*.spec.{j,t}s?(x)"
|
|
20
|
+
],
|
|
21
|
+
env: {
|
|
22
|
+
jest: true
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
};
|
package/README.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
# v-filters
|
|
2
|
-
|
|
3
|
-
## Project setup
|
|
4
|
-
```
|
|
5
|
-
npm install @phoenix-cg/v-filters
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
## Props
|
|
9
|
-
|
|
10
|
-
| Props | Description | Default value |
|
|
11
|
-
|--------------------|----------------------------------------------------------------------------------------------------------------------------------|----------------|
|
|
12
|
-
| componentsMap | [Object], required. Object with components name mapping to field types | none |
|
|
13
|
-
| fieldComponentName | [String] Component for field rendering. Should has "title" prop and a slot for field component | v-filter-field |
|
|
14
|
-
| fields | [Array], required. Array with fields | none |
|
|
15
|
-
| showWords | [Array] Array with words to put before found result count. First element should be in future tense and a last one in past tense. | [] |
|
|
16
|
-
| notFoundTitle | [String] Will be shown in button if count is 0 | '' |
|
|
17
|
-
| declensionWords | [Array] Array of words to put after found result count. | [] |
|
|
18
|
-
| count | [Number] Found count | 0 |
|
|
19
|
-
| showParams | [Boolean] If true current filters state will be reflected in page query params. | true |
|
|
20
|
-
| isResultShown | [Boolean] If true action button title will be constructed in past tense | false |
|
|
21
|
-
| humanLink | [String] Human link feature | '' |
|
|
22
|
-
| editedOutside | [Boolean] If true reset button will be shown even if the v-filters itself is untouched. | false |
|
|
23
|
-
| immediate | [Boolean] If true action button will not be shown and show-result event will fire immediately after change | false |
|
|
24
|
-
|
|
25
|
-
## Slots
|
|
26
|
-
|
|
27
|
-
| Slot | Description | Scope |
|
|
28
|
-
|---------------|-----------------------------------------|--------------------------------------------------------|
|
|
29
|
-
| before-fields | Slot to place anything before fields | none |
|
|
30
|
-
| after-fields | Slot to place anything after fields | none |
|
|
31
|
-
| actions | Slot for actions. Displays after fields | { showResult, resetFilters, count, immediate, edited } |
|
|
32
|
-
| actions-after | Slot for actions. Displays after fields | { showResult, resetFilters, count, immediate, edited } |
|
|
33
|
-
|
|
34
|
-
## Events
|
|
35
|
-
|
|
36
|
-
| Event | Description | Payload |
|
|
37
|
-
|---------------|---------------------|-----------------------------------------|
|
|
38
|
-
| request-count | Request count event | flatFilters: { ..., name: [1, 2] ,... } |
|
|
39
|
-
| show-result | Show result event | flatFilters: { ..., name: [1, 2],... } |
|
|
1
|
+
# v-filters
|
|
2
|
+
|
|
3
|
+
## Project setup
|
|
4
|
+
```
|
|
5
|
+
npm install @phoenix-cg/v-filters
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
## Props
|
|
9
|
+
|
|
10
|
+
| Props | Description | Default value |
|
|
11
|
+
|--------------------|----------------------------------------------------------------------------------------------------------------------------------|----------------|
|
|
12
|
+
| componentsMap | [Object], required. Object with components name mapping to field types | none |
|
|
13
|
+
| fieldComponentName | [String] Component for field rendering. Should has "title" prop and a slot for field component | v-filter-field |
|
|
14
|
+
| fields | [Array], required. Array with fields | none |
|
|
15
|
+
| showWords | [Array] Array with words to put before found result count. First element should be in future tense and a last one in past tense. | [] |
|
|
16
|
+
| notFoundTitle | [String] Will be shown in button if count is 0 | '' |
|
|
17
|
+
| declensionWords | [Array] Array of words to put after found result count. | [] |
|
|
18
|
+
| count | [Number] Found count | 0 |
|
|
19
|
+
| showParams | [Boolean] If true current filters state will be reflected in page query params. | true |
|
|
20
|
+
| isResultShown | [Boolean] If true action button title will be constructed in past tense | false |
|
|
21
|
+
| humanLink | [String] Human link feature | '' |
|
|
22
|
+
| editedOutside | [Boolean] If true reset button will be shown even if the v-filters itself is untouched. | false |
|
|
23
|
+
| immediate | [Boolean] If true action button will not be shown and show-result event will fire immediately after change | false |
|
|
24
|
+
|
|
25
|
+
## Slots
|
|
26
|
+
|
|
27
|
+
| Slot | Description | Scope |
|
|
28
|
+
|---------------|-----------------------------------------|--------------------------------------------------------|
|
|
29
|
+
| before-fields | Slot to place anything before fields | none |
|
|
30
|
+
| after-fields | Slot to place anything after fields | none |
|
|
31
|
+
| actions | Slot for actions. Displays after fields | { showResult, resetFilters, count, immediate, edited } |
|
|
32
|
+
| actions-after | Slot for actions. Displays after fields | { showResult, resetFilters, count, immediate, edited } |
|
|
33
|
+
|
|
34
|
+
## Events
|
|
35
|
+
|
|
36
|
+
| Event | Description | Payload |
|
|
37
|
+
|---------------|---------------------|-----------------------------------------|
|
|
38
|
+
| request-count | Request count event | flatFilters: { ..., name: [1, 2] ,... } |
|
|
39
|
+
| show-result | Show result event | flatFilters: { ..., name: [1, 2],... } |
|
|
40
40
|
| reset-filters | Reset filters event | none |
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: ["@vue/cli-plugin-babel/preset"],
|
|
3
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
presets: ["@vue/cli-plugin-babel/preset"],
|
|
3
|
+
};
|
package/dist/v-filters.common.js
CHANGED
|
@@ -539,6 +539,39 @@ $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') },
|
|
|
539
539
|
});
|
|
540
540
|
|
|
541
541
|
|
|
542
|
+
/***/ }),
|
|
543
|
+
|
|
544
|
+
/***/ "25f0":
|
|
545
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
546
|
+
|
|
547
|
+
"use strict";
|
|
548
|
+
|
|
549
|
+
var redefine = __webpack_require__("6eeb");
|
|
550
|
+
var anObject = __webpack_require__("825a");
|
|
551
|
+
var fails = __webpack_require__("d039");
|
|
552
|
+
var flags = __webpack_require__("ad6d");
|
|
553
|
+
|
|
554
|
+
var TO_STRING = 'toString';
|
|
555
|
+
var RegExpPrototype = RegExp.prototype;
|
|
556
|
+
var nativeToString = RegExpPrototype[TO_STRING];
|
|
557
|
+
|
|
558
|
+
var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
|
|
559
|
+
// FF44- RegExp#toString has a wrong name
|
|
560
|
+
var INCORRECT_NAME = nativeToString.name != TO_STRING;
|
|
561
|
+
|
|
562
|
+
// `RegExp.prototype.toString` method
|
|
563
|
+
// https://tc39.es/ecma262/#sec-regexp.prototype.tostring
|
|
564
|
+
if (NOT_GENERIC || INCORRECT_NAME) {
|
|
565
|
+
redefine(RegExp.prototype, TO_STRING, function toString() {
|
|
566
|
+
var R = anObject(this);
|
|
567
|
+
var p = String(R.source);
|
|
568
|
+
var rf = R.flags;
|
|
569
|
+
var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
|
|
570
|
+
return '/' + p + '/' + f;
|
|
571
|
+
}, { unsafe: true });
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
|
|
542
575
|
/***/ }),
|
|
543
576
|
|
|
544
577
|
/***/ "2a62":
|
|
@@ -4374,8 +4407,8 @@ if (typeof window !== 'undefined') {
|
|
|
4374
4407
|
// Indicate to webpack that this file can be concatenated
|
|
4375
4408
|
/* harmony default export */ var setPublicPath = (null);
|
|
4376
4409
|
|
|
4377
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
4378
|
-
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,{
|
|
4410
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"48b26f89-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=0eb82076&
|
|
4411
|
+
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",class:[("__" + (field._name))],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, $event)}},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,{
|
|
4379
4412
|
showResult: _vm.showResult,
|
|
4380
4413
|
resetFilters: _vm.resetFilters,
|
|
4381
4414
|
count: _vm.count,
|
|
@@ -4391,7 +4424,7 @@ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._sel
|
|
|
4391
4424
|
var staticRenderFns = []
|
|
4392
4425
|
|
|
4393
4426
|
|
|
4394
|
-
// CONCATENATED MODULE: ./src/components/VFilters.vue?vue&type=template&id=
|
|
4427
|
+
// CONCATENATED MODULE: ./src/components/VFilters.vue?vue&type=template&id=0eb82076&
|
|
4395
4428
|
|
|
4396
4429
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.object.keys.js
|
|
4397
4430
|
var es_object_keys = __webpack_require__("b64b");
|
|
@@ -4617,6 +4650,9 @@ var es_array_map = __webpack_require__("d81d");
|
|
|
4617
4650
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.reduce.js
|
|
4618
4651
|
var es_array_reduce = __webpack_require__("13d5");
|
|
4619
4652
|
|
|
4653
|
+
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.to-string.js
|
|
4654
|
+
var es_regexp_to_string = __webpack_require__("25f0");
|
|
4655
|
+
|
|
4620
4656
|
// EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
|
|
4621
4657
|
var es_array_find = __webpack_require__("7db0");
|
|
4622
4658
|
|
|
@@ -5125,6 +5161,8 @@ _curry2(function equals(a, b) {
|
|
|
5125
5161
|
|
|
5126
5162
|
|
|
5127
5163
|
|
|
5164
|
+
|
|
5165
|
+
|
|
5128
5166
|
//
|
|
5129
5167
|
//
|
|
5130
5168
|
//
|
|
@@ -5246,7 +5284,7 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5246
5284
|
default: false
|
|
5247
5285
|
},
|
|
5248
5286
|
humanLink: {
|
|
5249
|
-
type:
|
|
5287
|
+
type: Object
|
|
5250
5288
|
},
|
|
5251
5289
|
editedOutside: {
|
|
5252
5290
|
type: Boolean,
|
|
@@ -5265,6 +5303,18 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5265
5303
|
default: function _default() {
|
|
5266
5304
|
return [];
|
|
5267
5305
|
}
|
|
5306
|
+
},
|
|
5307
|
+
paramsToInclude: {
|
|
5308
|
+
type: Object,
|
|
5309
|
+
default: function _default() {
|
|
5310
|
+
return {};
|
|
5311
|
+
}
|
|
5312
|
+
},
|
|
5313
|
+
notArrayValueFields: {
|
|
5314
|
+
type: Array,
|
|
5315
|
+
default: function _default() {
|
|
5316
|
+
return ['select', 'tab'];
|
|
5317
|
+
}
|
|
5268
5318
|
}
|
|
5269
5319
|
},
|
|
5270
5320
|
data: function data() {
|
|
@@ -5314,6 +5364,13 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5314
5364
|
handler: function handler() {
|
|
5315
5365
|
this.setFilters(true);
|
|
5316
5366
|
}
|
|
5367
|
+
},
|
|
5368
|
+
paramsToInclude: {
|
|
5369
|
+
deep: true,
|
|
5370
|
+
handler: function handler(newVal, oldVal) {
|
|
5371
|
+
console.log(newVal, oldVal);
|
|
5372
|
+
this.setUrlParams(true);
|
|
5373
|
+
}
|
|
5317
5374
|
}
|
|
5318
5375
|
},
|
|
5319
5376
|
created: function created() {
|
|
@@ -5326,7 +5383,8 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5326
5383
|
var params = this.getUrlParams();
|
|
5327
5384
|
this.fields.forEach(function (field) {
|
|
5328
5385
|
var value = field._type === 'range' ? field.value : [];
|
|
5329
|
-
|
|
5386
|
+
|
|
5387
|
+
var valueNotArray = _this2.notArrayValueFields.includes(field._type);
|
|
5330
5388
|
|
|
5331
5389
|
if (valueNotArray) {
|
|
5332
5390
|
var _field$value = _slicedToArray(field.value, 1);
|
|
@@ -5341,12 +5399,20 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5341
5399
|
value = field.data.reduce(function (acc, item) {
|
|
5342
5400
|
var itemVal = item._id || item;
|
|
5343
5401
|
|
|
5344
|
-
if (paramsValue.
|
|
5402
|
+
if (paramsValue.includes(itemVal.toString())) {
|
|
5345
5403
|
acc.push(item);
|
|
5346
5404
|
}
|
|
5347
5405
|
|
|
5348
5406
|
return acc;
|
|
5349
5407
|
}, []);
|
|
5408
|
+
|
|
5409
|
+
if (valueNotArray) {
|
|
5410
|
+
var _value = value;
|
|
5411
|
+
|
|
5412
|
+
var _value2 = _slicedToArray(_value, 1);
|
|
5413
|
+
|
|
5414
|
+
value = _value2[0];
|
|
5415
|
+
}
|
|
5350
5416
|
} else {
|
|
5351
5417
|
value = paramsValue;
|
|
5352
5418
|
}
|
|
@@ -5408,11 +5474,12 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5408
5474
|
|
|
5409
5475
|
_this2.$set(_this2.filters, field._name, value);
|
|
5410
5476
|
});
|
|
5411
|
-
this.setUrlParams(
|
|
5477
|
+
!isUpdate && this.setUrlParams();
|
|
5412
5478
|
!isUpdate && this.doAction(true);
|
|
5413
5479
|
},
|
|
5414
5480
|
resetFilters: function resetFilters() {
|
|
5415
5481
|
this.editedFields = [];
|
|
5482
|
+
this.setUrlParams(true, {});
|
|
5416
5483
|
this.$emit('reset-filters', this.flatFilters);
|
|
5417
5484
|
},
|
|
5418
5485
|
addEditedField: function addEditedField(name) {
|
|
@@ -5420,6 +5487,11 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5420
5487
|
this.editedFields.push(name);
|
|
5421
5488
|
}
|
|
5422
5489
|
},
|
|
5490
|
+
removeEditedField: function removeEditedField(name) {
|
|
5491
|
+
this.editedFields = this.editedFields.filter(function (fieldName) {
|
|
5492
|
+
return fieldName !== name;
|
|
5493
|
+
});
|
|
5494
|
+
},
|
|
5423
5495
|
removeDependentFieldsFromEdited: function removeDependentFieldsFromEdited(name) {
|
|
5424
5496
|
var field = this.fields.find(function (field) {
|
|
5425
5497
|
return field._name === name;
|
|
@@ -5437,10 +5509,9 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5437
5509
|
}
|
|
5438
5510
|
},
|
|
5439
5511
|
doAction: function doAction() {
|
|
5440
|
-
var
|
|
5512
|
+
var showResult = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
5441
5513
|
|
|
5442
|
-
if (
|
|
5443
|
-
this.requestCount();
|
|
5514
|
+
if (showResult) {
|
|
5444
5515
|
this.showResult();
|
|
5445
5516
|
} else {
|
|
5446
5517
|
this.immediate ? this.showResult() : this.requestCount();
|
|
@@ -5450,36 +5521,20 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5450
5521
|
this.$emit('request-count', this.flatFilters);
|
|
5451
5522
|
},
|
|
5452
5523
|
showResult: function showResult() {
|
|
5524
|
+
this.setUrlParams();
|
|
5453
5525
|
this.$emit('show-result', this.flatFilters);
|
|
5454
5526
|
},
|
|
5455
5527
|
getUrlParams: function getUrlParams() {
|
|
5456
5528
|
return VFiltersvue_type_script_lang_js_unserialize(window.location.search);
|
|
5457
5529
|
},
|
|
5458
|
-
setUrlParams: function setUrlParams(
|
|
5530
|
+
setUrlParams: function setUrlParams(isUpdate, rewriteParams) {
|
|
5459
5531
|
if (this.showParams) {
|
|
5460
|
-
var params = this.
|
|
5461
|
-
|
|
5462
|
-
for (var name in this.filters) {
|
|
5463
|
-
var filterValue = this.filters[name];
|
|
5464
|
-
|
|
5465
|
-
if (this.editedFields.includes(name)) {
|
|
5466
|
-
if (Array.isArray(filterValue) && filterValue.length > 0) {
|
|
5467
|
-
params[name] = filterValue.map(function (val) {
|
|
5468
|
-
return val._id || val;
|
|
5469
|
-
});
|
|
5470
|
-
} else if (filterValue instanceof Object) {
|
|
5471
|
-
filterValue = _objectSpread2({}, filterValue);
|
|
5472
|
-
params[name] = [filterValue._id];
|
|
5473
|
-
}
|
|
5474
|
-
} else {
|
|
5475
|
-
delete params[name];
|
|
5476
|
-
}
|
|
5477
|
-
}
|
|
5532
|
+
var params = rewriteParams || _objectSpread2(_objectSpread2({}, this.flatFilters), this.paramsToInclude);
|
|
5478
5533
|
|
|
5479
5534
|
var currentParams = this.getUrlParams();
|
|
5480
5535
|
var newParamsLength = Object.keys(params).length;
|
|
5481
5536
|
|
|
5482
|
-
if ((newParamsLength && !es_equals(params, currentParams) ||
|
|
5537
|
+
if ((newParamsLength && !es_equals(params, currentParams) || isUpdate || rewriteParams) && !this.humanLink) {
|
|
5483
5538
|
var query = VFiltersvue_type_script_lang_js_serialize(params);
|
|
5484
5539
|
var url = window.location.origin + window.location.pathname + "".concat(newParamsLength ? '?' : '').concat(query);
|
|
5485
5540
|
history.replaceState({
|
|
@@ -5488,10 +5543,14 @@ var VFiltersvue_type_script_lang_js_unserialize = function unserialize(input) {
|
|
|
5488
5543
|
}
|
|
5489
5544
|
}
|
|
5490
5545
|
},
|
|
5491
|
-
handleFieldChange: function handleFieldChange(name) {
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5546
|
+
handleFieldChange: function handleFieldChange(name, value) {
|
|
5547
|
+
if (value !== null) {
|
|
5548
|
+
this.addEditedField(name);
|
|
5549
|
+
this.removeDependentFieldsFromEdited(name);
|
|
5550
|
+
} else {
|
|
5551
|
+
this.removeEditedField(name);
|
|
5552
|
+
}
|
|
5553
|
+
|
|
5495
5554
|
this.doAction();
|
|
5496
5555
|
}
|
|
5497
5556
|
}
|