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.
- package/docs/package.json +1 -1
- package/docs/src/views/PageFilters/PageFiltersExample/PageFiltersExample.js +18 -0
- package/docs/src/views/PageFilters/PageFiltersExample/PageFiltersExample.pug +1 -0
- package/docs/src/views/PageFilters/i18n/de.json +1 -1
- package/docs/src/views/PageTable/PageTableSort/PageTableSortExample/PageTableSortExample.js +1 -1
- package/docs/src/views/PageTable/i18n/de.json +1 -0
- package/package.json +3 -2
- package/src/AButton/AButton.js +6 -1
- package/src/AFilters/AFilterCenter/AFilterCenter.js +21 -4
- package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +9 -6
- package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/CloseFilterValueAPI.js +1 -1
- package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/HasFilterAPI.js +6 -11
- package/src/AFilters/AFilterCenter/AFilterCenterItem/compositionAPI/ModelValuesAPI.js +35 -16
- package/src/AFilters/AFilterCenter/utils/utils.js +15 -0
- package/src/AFilters/AFilters/AFilters.js +4 -0
- package/src/AFilters/AFilters/compositionAPI/CloseFilterAPI.js +75 -25
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +132 -35
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +9 -4
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/compositionAPI/LabelAPI.js +1 -1
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersHiddenAPI.js +1 -24
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSaveAPI.js +6 -76
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +7 -28
- package/src/AFilters/AFiltersHorizontal/compositionAPI/SearchAPI.js +0 -28
- package/src/AFilters/AFiltersHorizontal/compositionAPI/ToggleAPI.js +4 -19
- package/src/AFilters/i18n/de.json +4 -1
- package/src/AFilters/i18n/en.json +4 -1
- package/src/AFilters/i18n/ru.json +4 -1
- package/src/APagination/APagination.js +2 -2
- package/src/APagination/APaginationCountPerPage/APaginationCountPerPage.js +63 -25
- package/src/APagination/APaginationPages/APaginationPages.js +10 -7
- package/src/ATable/ATableHeader/ATableHeader.js +1 -1
- package/src/ATable/ATableHeaderTh/ATableHeaderTh.js +8 -6
- package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +6 -7
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +1 -1
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +64 -183
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/AttributesComponentAPI.js +39 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/ButtonVisibleAPI.js +75 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/LabelAPI.js +23 -0
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/compositionAPI/MoveColumnAPI.js +88 -0
- package/src/ATable/ATableTdAction/ATableTdAction.js +1 -1
- package/src/ATable/i18n/ar.json +6 -1
- package/src/ATable/i18n/de.json +6 -1
- package/src/ATable/i18n/en.json +6 -1
- package/src/ATable/i18n/es.json +6 -1
- package/src/ATable/i18n/fr.json +6 -1
- package/src/ATable/i18n/hr.json +6 -1
- package/src/ATable/i18n/it.json +6 -1
- package/src/ATable/i18n/ru.json +6 -1
- package/src/plugins/AIconPlugin.js +4 -0
- package/src/styles/components/AFilters.scss +168 -0
- package/src/styles/components/APagination.scss +148 -0
- package/src/styles/components/ATable.scss +66 -210
- package/src/styles/components/ui/ADatepicker.scss +7 -1
- package/src/styles/components/ui/AInputNumber.scss +7 -2
- package/src/styles/components/ui/AInputNumberRange.scss +6 -0
- package/src/styles/components/ui/ASelect.scss +1 -0
- package/src/styles/styles.scss +7 -2
- package/src/ui/ACheckbox/ACheckbox.js +16 -0
- package/src/ui/ACheckbox/ACheckboxItem/ACheckboxItem.js +41 -9
- package/src/ui/ACheckboxRadioGroups/ACheckboxRadioGroups.js +16 -0
- package/src/ui/AInputNumber/AInputNumber.js +7 -1
- package/src/ui/AInputNumber/compositionAPI/WidthAPI.js +24 -0
- package/src/ui/AInputNumberRange/AInputNumberRange.js +62 -54
- package/src/ui/ARadio/ARadio.js +16 -0
- package/src/ui/ARadio/ARadioItem/ARadioItem.js +40 -8
- package/src/ui/compositionApi/UiTitleElementAPI.js +28 -0
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FilterMainAPI.js +0 -37
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersLayoutAPI.js +0 -62
package/docs/package.json
CHANGED
|
@@ -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({});
|
|
@@ -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_": "
|
|
4
|
+
"_A_PAGE_FILTER_SEARCH_": "Schnellsuche",
|
|
5
5
|
"_A_PAGE_FILTER_TEXT_": "Text",
|
|
6
6
|
"_A_PAGE_FILTER_DATE_": "Datum"
|
|
7
7
|
}
|
|
@@ -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.
|
|
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.
|
|
46
|
+
"aloha-css": "1.0.132",
|
|
46
47
|
"axios": "^1.4.0",
|
|
47
48
|
"dompurify": "^2.4.1",
|
|
48
49
|
"fecha": "^4.2.3",
|
package/src/AButton/AButton.js
CHANGED
|
@@ -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
|
-
|
|
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: "
|
|
60
|
+
class: "a_filters_center",
|
|
55
61
|
style: this.styleHide,
|
|
56
62
|
}, [
|
|
57
|
-
h(
|
|
58
|
-
class: "
|
|
59
|
-
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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(
|
|
138
|
-
class: "
|
|
139
|
-
|
|
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",
|
|
@@ -4,23 +4,18 @@ import {
|
|
|
4
4
|
} from "vue";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
17
|
-
filter.value
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
13
|
-
get,
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
item
|
|
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
|
-
|
|
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
|
|
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 (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
UNAPPLIED_MODEL[MODEL_ID][keyId] = undefined;
|
|
47
|
+
if (isPlainObject(unappliedModelLocal?.[MODEL_ID])) {
|
|
48
|
+
unappliedModelLocal[MODEL_ID][keyId] = undefined;
|
|
43
49
|
}
|
|
44
|
-
if (isPlainObject(
|
|
45
|
-
|
|
50
|
+
if (isPlainObject(appliedModelLocal?.[MODEL_ID])) {
|
|
51
|
+
appliedModelLocal[MODEL_ID][keyId] = undefined;
|
|
46
52
|
}
|
|
47
|
-
emit("update:unappliedModel", UNAPPLIED_MODEL);
|
|
48
53
|
} else {
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
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
|
}
|