aloha-vue 1.2.82 → 1.2.83

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.
Files changed (68) hide show
  1. package/docs/package.json +1 -1
  2. package/docs/src/views/PageFilters/PageFiltersExample/PageFiltersExample.js +18 -0
  3. package/docs/src/views/PageFilters/PageFiltersExample/PageFiltersExample.pug +1 -0
  4. package/docs/src/views/PageFilters/i18n/de.json +1 -1
  5. package/docs/src/views/PageTable/PageTableSort/PageTableSortExample/PageTableSortExample.js +1 -1
  6. package/docs/src/views/PageTable/i18n/de.json +1 -0
  7. package/package.json +3 -2
  8. package/src/AButton/AButton.js +6 -1
  9. package/src/AFilters/AFilterCenter/AFilterCenter.js +21 -4
  10. package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +9 -6
  11. package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/CloseFilterValueAPI.js +1 -1
  12. package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/HasFilterAPI.js +6 -11
  13. package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/ModelValuesAPI.js +35 -16
  14. package/src/AFilters/AFilterCenter/utils/utils.js +15 -0
  15. package/src/AFilters/AFilters/AFilters.js +4 -0
  16. package/src/AFilters/AFilters/compositionAPI/CloseFilterAPI.js +75 -25
  17. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +132 -35
  18. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +9 -4
  19. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/compositionAPI/LabelAPI.js +1 -1
  20. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersHiddenAPI.js +1 -24
  21. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSaveAPI.js +6 -76
  22. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +7 -28
  23. package/src/AFilters/AFiltersHorizontal/compositionAPI/SearchAPI.js +0 -28
  24. package/src/AFilters/AFiltersHorizontal/compositionAPI/ToggleAPI.js +4 -19
  25. package/src/AFilters/i18n/de.json +4 -1
  26. package/src/AFilters/i18n/en.json +4 -1
  27. package/src/AFilters/i18n/ru.json +4 -1
  28. package/src/APagination/APagination.js +2 -2
  29. package/src/APagination/APaginationCountPerPage/APaginationCountPerPage.js +63 -25
  30. package/src/APagination/APaginationPages/APaginationPages.js +10 -7
  31. package/src/ATable/ATableHeader/ATableHeader.js +1 -1
  32. package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +8 -6
  33. package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +6 -7
  34. package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +1 -1
  35. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +64 -183
  36. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/AttributesComponentAPI.js +39 -0
  37. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/ButtonVisibleAPI.js +75 -0
  38. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/LabelAPI.js +23 -0
  39. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/MoveColumnAPI.js +88 -0
  40. package/src/ATable/ATableTdAction/ATableTdAction.js +1 -1
  41. package/src/ATable/i18n/ar.json +6 -1
  42. package/src/ATable/i18n/de.json +6 -1
  43. package/src/ATable/i18n/en.json +6 -1
  44. package/src/ATable/i18n/es.json +6 -1
  45. package/src/ATable/i18n/fr.json +6 -1
  46. package/src/ATable/i18n/hr.json +6 -1
  47. package/src/ATable/i18n/it.json +6 -1
  48. package/src/ATable/i18n/ru.json +6 -1
  49. package/src/plugins/AIconPlugin.js +4 -0
  50. package/src/styles/components/AFilters.scss +168 -0
  51. package/src/styles/components/APagination.scss +148 -0
  52. package/src/styles/components/ATable.scss +66 -210
  53. package/src/styles/components/ui/ADatepicker.scss +7 -1
  54. package/src/styles/components/ui/AInputNumber.scss +7 -2
  55. package/src/styles/components/ui/AInputNumberRange.scss +6 -0
  56. package/src/styles/components/ui/ASelect.scss +1 -0
  57. package/src/styles/styles.scss +7 -2
  58. package/src/ui/ACheckbox/ACheckbox.js +16 -0
  59. package/src/ui/ACheckbox/ACheckboxItem/ACheckboxItem.js +41 -9
  60. package/src/ui/ACheckboxRadioGroups/ACheckboxRadioGroups.js +16 -0
  61. package/src/ui/AInputNumber/AInputNumber.js +7 -1
  62. package/src/ui/AInputNumber/compositionAPI/WidthAPI.js +24 -0
  63. package/src/ui/AInputNumberRange/AInputNumberRange.js +62 -54
  64. package/src/ui/ARadio/ARadio.js +16 -0
  65. package/src/ui/ARadio/ARadioItem/ARadioItem.js +40 -8
  66. package/src/ui/compositionApi/UiTitleElementAPI.js +28 -0
  67. package/src/AFilters/AFiltersHorizontal/compositionAPI/FilterMainAPI.js +0 -37
  68. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersLayoutAPI.js +0 -62
package/docs/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@floating-ui/vue": "1.0.2",
15
- "aloha-css": "1.0.127",
15
+ "aloha-css": "1.0.132",
16
16
  "axios": "1.4.0",
17
17
  "dompurify": "3.0.3",
18
18
  "fecha": "4.2.3",
@@ -42,6 +42,24 @@ export default {
42
42
  label: "_A_PAGE_FILTER_DATE_",
43
43
  alwaysVisible: true,
44
44
  },
45
+ {
46
+ type: "integer",
47
+ id: "integer",
48
+ label: "_A_PAGE_FILTER_INTEGER_",
49
+ alwaysVisible: true,
50
+ },
51
+ {
52
+ type: "dateRange",
53
+ id: "dateRange",
54
+ label: "_A_TABLE_FILTER_INPUT_DATE_RANGE_",
55
+ alwaysVisible: true,
56
+ },
57
+ {
58
+ type: "numberRange",
59
+ id: "numberRange",
60
+ label: "_A_TABLE_FILTER_INPUT_NUMBER_RANGE_",
61
+ alwaysVisible: true,
62
+ },
45
63
  ];
46
64
 
47
65
  const appliedModel = ref({});
@@ -7,6 +7,7 @@ aloha-example(
7
7
  )
8
8
  div
9
9
  a-filters(
10
+ :can-save="true"
10
11
  :filters="filters"
11
12
  v-model:applied-model="appliedModel"
12
13
  v-model:unapplied-model="unappliedModel"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "_A_FILTERS_COMPONENT_DESCRIPTION_": "_A_FILTERS_COMPONENT_DESCRIPTION_",
3
3
  "_A_FILTERS_COMPONENT_NAME_": "Filters",
4
- "_A_PAGE_FILTER_SEARCH_": "Search",
4
+ "_A_PAGE_FILTER_SEARCH_": "Schnellsuche",
5
5
  "_A_PAGE_FILTER_TEXT_": "Text",
6
6
  "_A_PAGE_FILTER_DATE_": "Datum"
7
7
  }
@@ -31,7 +31,7 @@ export default {
31
31
  {
32
32
  id: "column1",
33
33
  keyLabel: "id",
34
- label: "_A_TABLE_COLUMN_1_",
34
+ label: "_A_TABLE_COLUMN_MULTI_ROWS_",
35
35
  sortId: "id",
36
36
  },
37
37
  {
@@ -9,6 +9,7 @@
9
9
  "_A_TABLE_COLUMN_8_": "Spalte 8",
10
10
  "_A_TABLE_COLUMN_9_": "Spalte 9",
11
11
  "_A_TABLE_COLUMN_10_": "Spalte 10",
12
+ "_A_TABLE_COLUMN_MULTI_ROWS_": "Spalte Spalte Spalte Spalte Spalte Spalte Spalte Spalte",
12
13
  "_A_TABLE_FILTER_SEARCH_": "Suche",
13
14
  "_A_TABLE_FILTER_TEXT_": "Text",
14
15
  "_A_TABLE_FILTER_DATE_": "Datum",
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "Vue.js"
15
15
  ],
16
16
  "homepage": "https://github.com/ilia-brykin/aloha/#README.md",
17
- "version": "1.2.82",
17
+ "version": "1.2.83",
18
18
  "author": {
19
19
  "name": "Ilia Brykin",
20
20
  "email": "brykin.ilia@gmail.com"
@@ -38,11 +38,12 @@
38
38
  },
39
39
  "scripts": {
40
40
  "build-icons": "node scriptsNode/iconsSvgToJs.js bootstrap3 && node scriptsNode/iconsSvgToJs.js bootstrap-1-9-1",
41
+ "publish": "npm publish --scope=@npm",
41
42
  "test": "jest"
42
43
  },
43
44
  "dependencies": {
44
45
  "@floating-ui/vue": "1.0.2",
45
- "aloha-css": "1.0.98",
46
+ "aloha-css": "1.0.132",
46
47
  "axios": "^1.4.0",
47
48
  "dompurify": "^2.4.1",
48
49
  "fecha": "^4.2.3",
@@ -47,6 +47,11 @@ export default {
47
47
  required: false,
48
48
  default: undefined,
49
49
  },
50
+ classDefault: { // TODO: Documentation
51
+ type: String,
52
+ required: false,
53
+ default: "aloha_btn",
54
+ },
50
55
  disabled: {
51
56
  type: Boolean,
52
57
  required: false,
@@ -300,7 +305,7 @@ export default {
300
305
  ref: "buttonRef",
301
306
  id: this.id,
302
307
  class: [
303
- "aloha_btn",
308
+ this.classDefault,
304
309
  this.switchClass,
305
310
  this.class,
306
311
  {
@@ -2,9 +2,11 @@ import {
2
2
  h,
3
3
  } from "vue";
4
4
 
5
+ import ATranslation from "../../ATranslation/ATranslation";
5
6
  import AFilterCenterItem from "./AFilterCenterItem/AFilterCenterItem";
6
7
 
7
8
  import VisibleFiltersAPI from "./compositionAPI/VisibleFiltersAPI";
9
+ import AButton from "../../AButton/AButton";
8
10
 
9
11
  export default {
10
12
  name: "AFilterCenter",
@@ -13,6 +15,10 @@ export default {
13
15
  type: Object,
14
16
  required: true,
15
17
  },
18
+ closeAllFilters: {
19
+ type: Function,
20
+ required: true,
21
+ },
16
22
  closeFilterValue: {
17
23
  type: Function,
18
24
  required: true,
@@ -51,12 +57,14 @@ export default {
51
57
  },
52
58
  render() {
53
59
  return h("div", {
54
- class: "a_table__filters_center",
60
+ class: "a_filters_center",
55
61
  style: this.styleHide,
56
62
  }, [
57
- h("span", {
58
- class: "a_table__filters_center__headline a_table__filters_center__item",
59
- }, "Ihre Auswahl:"),
63
+ h(ATranslation, {
64
+ class: "a_filters_center__headline a_filters_center__item",
65
+ tag: "span",
66
+ text: "_A_FILTERS_YOUR_SELECTION_",
67
+ }),
60
68
  this.filtersVisibleAll.map(filter => {
61
69
  return h(AFilterCenterItem, {
62
70
  key: filter.id,
@@ -69,6 +77,15 @@ export default {
69
77
  onUpdateVisibleChildFilters: this.updateVisibleChildFilters,
70
78
  }, this.$slots);
71
79
  }),
80
+ h("div", {
81
+ class: "a_filters_center__item",
82
+ }, [
83
+ h(AButton, {
84
+ class: "a_btn a_btn_link a_btn_small",
85
+ text: "_A_FILTERS_DESELECT_ALL_",
86
+ onClick: this.closeAllFilters,
87
+ }),
88
+ ]),
72
89
  ]);
73
90
  },
74
91
  };
@@ -103,7 +103,7 @@ export default {
103
103
  this.modelValuesForCurrentFilter.map(modelValue => {
104
104
  return h("div", {
105
105
  role: "group",
106
- class: "a_table__filters_center__item a_btn_group a_btn_group_small",
106
+ class: "a_filters_center__item a_btn_group a_btn_group_small",
107
107
  }, [
108
108
  this.filter.hasNotClose && h(AButton, {
109
109
  class: "a_btn a_btn_secondary",
@@ -116,14 +116,14 @@ export default {
116
116
  onClick: () => this.goToFilter({ modelValue }),
117
117
  }, () => [
118
118
  this.filterLabel && h("strong", {
119
- class: "a_table__filters_center__item__label",
119
+ class: "a_filters_center__item__label",
120
120
  }, [
121
121
  h(ATranslation, {
122
122
  tag: "span",
123
123
  html: this.filterLabel,
124
124
  }),
125
125
  modelValue.filterLabelSuffix && h(ATranslation, {
126
- class: "a_table__filters_center__item__label__suffix",
126
+ class: "a_filters_center__item__label__suffix",
127
127
  tag: "span",
128
128
  html: modelValue.filterLabelSuffix,
129
129
  }),
@@ -134,9 +134,12 @@ export default {
134
134
  item: modelValue.item,
135
135
  label: modelValue.label,
136
136
  }) :
137
- h("span", {
138
- class: "a_table__filters_center__item__value",
139
- }, modelValue.label),
137
+ h(ATranslation, {
138
+ class: "a_filters_center__item__value",
139
+ tag: "span",
140
+ html: modelValue.label,
141
+ extra: modelValue.extra,
142
+ }),
140
143
  ]),
141
144
  !this.filter.hasNotClose && h(AButton, {
142
145
  class: "a_btn a_btn_secondary",
@@ -13,7 +13,7 @@ export default function CloseFilterValueAPI(props) {
13
13
  }
14
14
  closeFilterValue.value({
15
15
  filter: filter.value,
16
- currentModel: modelValue.value,
16
+ modelArray: modelValue.modelArray,
17
17
  keyId: modelValue.keyId,
18
18
  });
19
19
  };
@@ -4,23 +4,18 @@ import {
4
4
  } from "vue";
5
5
 
6
6
  import {
7
- isArray,
8
- isNil,
9
- } from "lodash-es";
7
+ hasFilterCenter,
8
+ } from "../../utils/utils";
10
9
 
11
10
  export default function HasFilterAPI(props) {
12
11
  const filter = toRef(props, "filter");
13
12
  const model = toRef(props, "model");
14
13
 
15
14
  const hasCurrentFilter = computed(() => {
16
- if (!filter.value ||
17
- filter.value.hideFilterCenter ||
18
- isNil(model.value) ||
19
- model.value === "" ||
20
- (isArray(model.value) && !model.value.length)) {
21
- return false;
22
- }
23
- return true;
15
+ return hasFilterCenter({
16
+ filter: filter.value,
17
+ currentModel: model.value,
18
+ });
24
19
  });
25
20
 
26
21
  return {
@@ -9,8 +9,9 @@ import AKeyLabel from "../../../../const/AKeyLabel";
9
9
  import AUiTypesModelArray from "../../../../ui/const/AUiTypesModelArray";
10
10
  import TypesNumberRange from "../../../../ui/AInputNumberRange/utils/Types";
11
11
  import {
12
- forEach,
13
- get, isNil,
12
+ filter as _filter,
13
+ get,
14
+ isNil,
14
15
  } from "lodash-es";
15
16
 
16
17
 
@@ -21,6 +22,11 @@ export default function ModelValuesAPI(props, {
21
22
  const filter = toRef(props, "filter");
22
23
  const model = toRef(props, "model");
23
24
 
25
+ const {
26
+ filterBoolean,
27
+ filterDate,
28
+ } = AFiltersAPI();
29
+
24
30
  const filterDataKey = computed(() => {
25
31
  if (filter.value) {
26
32
  return dataKeyByKeyIdPerFilter.value[filter.value.id];
@@ -28,10 +34,14 @@ export default function ModelValuesAPI(props, {
28
34
  return undefined;
29
35
  });
30
36
 
31
- const {
32
- filterBoolean,
33
- filterDate,
34
- } = AFiltersAPI();
37
+ const modelArrayReal = computed(() => {
38
+ if (model.value?.length) {
39
+ return _filter(model.value, modelItem => {
40
+ return filterDataKey.value && filterDataKey.value[modelItem];
41
+ });
42
+ }
43
+ return [];
44
+ });
35
45
 
36
46
  const modelValuesForCurrentFilter = computed(() => {
37
47
  if (!hasCurrentFilter.value) {
@@ -61,18 +71,27 @@ export default function ModelValuesAPI(props, {
61
71
  }
62
72
  if (AUiTypesModelArray[filter.value.type] ||
63
73
  (filter.value.type === "radio" && filter.value.isModelArray)) {
64
- const MODEL_VALUES = [];
65
- forEach(model.value, modelItem => {
66
- if (filterDataKey.value && filterDataKey.value[modelItem]) {
67
- MODEL_VALUES.push({
68
- label: filterDataKey.value[modelItem][AKeyLabel],
69
- value: modelItem,
70
- item: filterDataKey.value[modelItem],
71
- });
74
+ if (modelArrayReal.value.length) {
75
+ if (modelArrayReal.value.length === 1) {
76
+ const item = filterDataKey.value?.[modelArrayReal.value[0]];
77
+
78
+ return [{
79
+ label: item?.[AKeyLabel],
80
+ item,
81
+ modelArray: modelArrayReal.value,
82
+ }];
72
83
  }
73
- });
74
- return MODEL_VALUES;
84
+ return [{
85
+ label: "_A_FILTERS_SELECTED_{{count}}_",
86
+ extra: {
87
+ count: modelArrayReal.value.length,
88
+ modelArray: modelArrayReal.value,
89
+ },
90
+ }];
91
+ }
92
+ return [];
75
93
  }
94
+
76
95
  if (filter.value.type === "dateRange") {
77
96
  const KEY_FROM = filter.value.keyFrom || "from";
78
97
  const KEY_UNTIL = filter.value.keyUntil || "until";
@@ -0,0 +1,15 @@
1
+ import {
2
+ isArray,
3
+ isNil,
4
+ } from "lodash-es";
5
+
6
+ export function hasFilterCenter({ filter, currentModel }) {
7
+ if (!filter ||
8
+ filter.hideFilterCenter ||
9
+ isNil(currentModel) ||
10
+ currentModel === "" ||
11
+ (isArray(currentModel) && !currentModel.length)) {
12
+ return false;
13
+ }
14
+ return true;
15
+ }
@@ -95,8 +95,10 @@ export default {
95
95
  } = FiltersAPI(props, context);
96
96
 
97
97
  const {
98
+ closeAllFilters,
98
99
  closeFilterValue,
99
100
  } = CloseFilterAPI(props, context, {
101
+ filtersVisibleAll,
100
102
  onUpdateModelFilters,
101
103
  });
102
104
 
@@ -134,6 +136,7 @@ export default {
134
136
  initFiltersSaved();
135
137
 
136
138
  return {
139
+ closeAllFilters,
137
140
  closeFilterValue,
138
141
  dataKeyByKeyIdPerFilter,
139
142
  filtersDataKeyById,
@@ -193,6 +196,7 @@ export default {
193
196
  h(AFilterCenter, {
194
197
  id: this.id,
195
198
  appliedModel: this.appliedModel,
199
+ closeAllFilters: this.closeAllFilters,
196
200
  closeFilterValue: this.closeFilterValue,
197
201
  dataKeyByKeyIdPerFilter: this.dataKeyByKeyIdPerFilter,
198
202
  disabled: this.disabled,
@@ -1,4 +1,5 @@
1
1
  import {
2
+ computed,
2
3
  toRef,
3
4
  } from "vue";
4
5
 
@@ -6,52 +7,100 @@ import AUiTypesModelArray from "../../../ui/const/AUiTypesModelArray";
6
7
  import AUiTypesModelObject from "../../../ui/const/AUiTypesModelObject";
7
8
  import {
8
9
  cloneDeep,
10
+ filter as _filter,
11
+ forEach,
9
12
  isPlainObject,
10
13
  } from "lodash-es";
11
14
 
12
15
  export default function CloseFilterAPI(props, { emit }, {
16
+ filtersVisibleAll = computed(() => []),
13
17
  onUpdateModelFilters = () => {},
14
18
  }) {
15
19
  const appliedModel = toRef(props, "appliedModel");
16
20
  const unappliedModel = toRef(props, "unappliedModel");
17
21
 
18
- const closeFilterValue = ({ filter, currentModel, keyId }) => {
22
+ const closeCurrentFilter = ({ filter, keyId, modelArray, appliedModelLocal, unappliedModelLocal }) => {
19
23
  const MODEL_ID = filter.modelId || filter.id;
20
24
 
21
- const APPLIED_MODEL = cloneDeep(appliedModel.value);
22
25
  if (AUiTypesModelArray[filter.type]) {
23
- if (APPLIED_MODEL[MODEL_ID] &&
24
- APPLIED_MODEL[MODEL_ID].length) {
25
- const INDEX_IN_MODEL = APPLIED_MODEL[MODEL_ID].indexOf(currentModel);
26
- if (INDEX_IN_MODEL !== -1) {
27
- APPLIED_MODEL[MODEL_ID].splice(INDEX_IN_MODEL, 1);
26
+ if (appliedModelLocal[MODEL_ID] &&
27
+ appliedModelLocal[MODEL_ID].length) {
28
+ if (modelArray) {
29
+ appliedModelLocal[MODEL_ID] = _filter(appliedModelLocal[MODEL_ID], modelItem => {
30
+ return modelArray.indexOf(modelItem) === -1;
31
+ });
32
+ } else {
33
+ appliedModelLocal[MODEL_ID] = [];
28
34
  }
29
35
  }
30
- if (unappliedModel.value[MODEL_ID] &&
31
- unappliedModel.value[MODEL_ID].length) {
32
- const INDEX_IN_MODEL = unappliedModel.value[MODEL_ID].indexOf(currentModel);
33
- if (INDEX_IN_MODEL !== -1) {
34
- const UNAPPLIED_MODEL = cloneDeep(unappliedModel.value);
35
- UNAPPLIED_MODEL[MODEL_ID].splice(INDEX_IN_MODEL, 1);
36
- emit("update:unappliedModel", UNAPPLIED_MODEL);
36
+ if (unappliedModelLocal[MODEL_ID] &&
37
+ unappliedModelLocal[MODEL_ID].length) {
38
+ if (modelArray) {
39
+ unappliedModelLocal[MODEL_ID] = _filter(unappliedModelLocal[MODEL_ID], modelItem => {
40
+ return modelArray.indexOf(modelItem) === -1;
41
+ });
42
+ } else {
43
+ unappliedModelLocal[MODEL_ID] = [];
37
44
  }
38
45
  }
39
46
  } else if (AUiTypesModelObject[filter.type] && keyId) {
40
- const UNAPPLIED_MODEL = cloneDeep(unappliedModel.value);
41
- if (isPlainObject(UNAPPLIED_MODEL?.[MODEL_ID])) {
42
- UNAPPLIED_MODEL[MODEL_ID][keyId] = undefined;
47
+ if (isPlainObject(unappliedModelLocal?.[MODEL_ID])) {
48
+ unappliedModelLocal[MODEL_ID][keyId] = undefined;
43
49
  }
44
- if (isPlainObject(APPLIED_MODEL?.[MODEL_ID])) {
45
- APPLIED_MODEL[MODEL_ID][keyId] = undefined;
50
+ if (isPlainObject(appliedModelLocal?.[MODEL_ID])) {
51
+ appliedModelLocal[MODEL_ID][keyId] = undefined;
46
52
  }
47
- emit("update:unappliedModel", UNAPPLIED_MODEL);
48
53
  } else {
49
- const UNAPPLIED_MODEL = cloneDeep(unappliedModel.value);
50
- UNAPPLIED_MODEL[MODEL_ID] = undefined;
51
- emit("update:unappliedModel", UNAPPLIED_MODEL);
52
- APPLIED_MODEL[MODEL_ID] = undefined;
54
+ unappliedModelLocal[MODEL_ID] = undefined;
55
+ appliedModelLocal[MODEL_ID] = undefined;
53
56
  }
54
- emit("update:appliedModel", APPLIED_MODEL);
57
+
58
+ return {
59
+ appliedModelLocal,
60
+ unappliedModelLocal,
61
+ };
62
+ };
63
+
64
+ const closeFilterValue = ({ filter, keyId, modelArray }) => {
65
+ const APPLIED_MODEL = cloneDeep(appliedModel.value);
66
+ const UNAPPLIED_MODEL = cloneDeep(unappliedModel.value);
67
+
68
+ const {
69
+ appliedModelLocal,
70
+ unappliedModelLocal,
71
+ } = closeCurrentFilter({
72
+ filter,
73
+ keyId,
74
+ modelArray,
75
+ appliedModelLocal: APPLIED_MODEL,
76
+ unappliedModelLocal: UNAPPLIED_MODEL,
77
+ });
78
+
79
+ emit("update:unappliedModel", unappliedModelLocal);
80
+ emit("update:appliedModel", appliedModelLocal);
81
+
82
+ setTimeout(() => {
83
+ onUpdateModelFilters({ model: appliedModel.value });
84
+ });
85
+ };
86
+
87
+ const closeAllFilters = () => {
88
+ let appliedModelLocal = cloneDeep(appliedModel.value);
89
+ let unappliedModelLocal = cloneDeep(unappliedModel.value);
90
+
91
+ forEach(filtersVisibleAll.value, filter => {
92
+ const MODELS_OBJECT = closeCurrentFilter({
93
+ filter,
94
+ appliedModelLocal: appliedModelLocal,
95
+ unappliedModelLocal: unappliedModelLocal,
96
+ });
97
+
98
+ appliedModelLocal = MODELS_OBJECT.appliedModelLocal;
99
+ unappliedModelLocal = MODELS_OBJECT.unappliedModelLocal;
100
+ });
101
+
102
+ emit("update:unappliedModel", unappliedModelLocal);
103
+ emit("update:appliedModel", appliedModelLocal);
55
104
 
56
105
  setTimeout(() => {
57
106
  onUpdateModelFilters({ model: appliedModel.value });
@@ -59,6 +108,7 @@ export default function CloseFilterAPI(props, { emit }, {
59
108
  };
60
109
 
61
110
  return {
111
+ closeAllFilters,
62
112
  closeFilterValue,
63
113
  };
64
114
  }