aloha-vue 2.1.13 → 2.3.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/CHANGELOG.md +45 -0
- package/dist/aloha-vue.es.js +10670 -10458
- package/dist/aloha-vue.umd.js +60 -60
- package/package.json +2 -1
- package/src/AAlert/AAlert.js +20 -2
- package/src/AAlert/compositionAPI/AttributesAPI.js +30 -0
- package/src/ADropdown/ADropdown.js +15 -2
- package/src/ADropdown/compositionAPI/ToggleAPI.js +9 -0
- package/src/AModal/compositionAPI/EscapeAPI.js +27 -21
- package/src/compositionAPI/AHttpAPI.js +5 -1
- package/src/compositionAPI/APopupAPI.js +19 -1
- package/src/ui/ASelect/ASelect.js +103 -13
- package/src/ui/ASelect/compositionAPI/DisabledAPI.js +38 -0
- package/src/ui/ASelect/compositionAPI/ExclusiveOptionsAPI.js +45 -0
- package/src/ui/ASelect/compositionAPI/ModelAPI.js +2 -1
- package/src/ui/ASelect/compositionAPI/ModelChangeAPI.js +17 -0
- package/src/ui/ASelect/compositionAPI/ToggleAPI.js +10 -0
- package/src/ui/ASelect/i18n/ar.json +2 -1
- package/src/ui/ASelect/i18n/de.json +2 -1
- package/src/ui/ASelect/i18n/en.json +2 -1
- package/src/ui/ASelect/i18n/es.json +2 -1
- package/src/ui/ASelect/i18n/fr.json +2 -1
- package/src/ui/ASelect/i18n/hr.json +2 -1
- package/src/ui/ASelect/i18n/it.json +2 -1
- package/src/ui/ASelect/i18n/ru.json +2 -1
- package/src/ui/compositionApi/UiSearchAPI.js +19 -0
|
@@ -15,6 +15,7 @@ export default function ModelAPI(props, {
|
|
|
15
15
|
dataKeyByKeyIdLocal = computed(() => ({})),
|
|
16
16
|
}) {
|
|
17
17
|
const countMultiselect = toRef(props, "countMultiselect");
|
|
18
|
+
const exclusiveOptionValue = toRef(props, "exclusiveOptionValue");
|
|
18
19
|
const modelValue = toRef(props, "modelValue");
|
|
19
20
|
const type = toRef(props, "type");
|
|
20
21
|
|
|
@@ -28,7 +29,7 @@ export default function ModelAPI(props, {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
return filter(modelValue.value, currentModel => {
|
|
31
|
-
return dataKeyByKeyIdLocal.value[currentModel];
|
|
32
|
+
return dataKeyByKeyIdLocal.value[currentModel] || currentModel === exclusiveOptionValue.value;
|
|
32
33
|
});
|
|
33
34
|
});
|
|
34
35
|
|
|
@@ -16,11 +16,15 @@ export default function ModelChangeAPI(props, {
|
|
|
16
16
|
changeModel = () => {},
|
|
17
17
|
dataAll = computed(() => []),
|
|
18
18
|
dataKeyByKeyIdLocal = computed(() => ({})),
|
|
19
|
+
disabledLocal = computed(() => false),
|
|
19
20
|
isMultiselect = computed(() => false),
|
|
20
21
|
togglePopover = () => {},
|
|
21
22
|
}) {
|
|
22
23
|
const countMultiselect = toRef(props, "countMultiselect");
|
|
24
|
+
const disabled = toRef(props, "disabled");
|
|
25
|
+
const exclusiveOptionValue = toRef(props, "exclusiveOptionValue");
|
|
23
26
|
const isCloseByClick = toRef(props, "isCloseByClick");
|
|
27
|
+
const isExclusiveOptionEnabled = toRef(props, "isExclusiveOptionEnabled");
|
|
24
28
|
const deselectable = toRef(props, "deselectable");
|
|
25
29
|
const maxCountMultiselect = toRef(props, "maxCountMultiselect");
|
|
26
30
|
const modelValue = toRef(props, "modelValue");
|
|
@@ -47,6 +51,11 @@ export default function ModelChangeAPI(props, {
|
|
|
47
51
|
if (isSelected) {
|
|
48
52
|
const INDEX = modelValueLocal.indexOf(currentValue);
|
|
49
53
|
modelValueLocal.splice(INDEX, 1);
|
|
54
|
+
if (isExclusiveOptionEnabled.value && currentValue === exclusiveOptionValue.value) {
|
|
55
|
+
modelValueLocal = [];
|
|
56
|
+
}
|
|
57
|
+
} else if (isExclusiveOptionEnabled.value && currentValue === exclusiveOptionValue.value) {
|
|
58
|
+
modelValueLocal = [currentValue];
|
|
50
59
|
} else {
|
|
51
60
|
if (isMaxSelected.value) {
|
|
52
61
|
return;
|
|
@@ -83,6 +92,10 @@ export default function ModelChangeAPI(props, {
|
|
|
83
92
|
};
|
|
84
93
|
|
|
85
94
|
const onSelectAll = () => {
|
|
95
|
+
if (disabledLocal.value) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
86
99
|
const MODEL = dataAll.value.map(item => item[AKeyId]);
|
|
87
100
|
changeModel({
|
|
88
101
|
model: MODEL,
|
|
@@ -99,6 +112,10 @@ export default function ModelChangeAPI(props, {
|
|
|
99
112
|
};
|
|
100
113
|
|
|
101
114
|
const onDeselectAll = () => {
|
|
115
|
+
if (disabled.value) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
changeModel({
|
|
103
120
|
model: [],
|
|
104
121
|
});
|
|
@@ -25,6 +25,10 @@ const ELEMENTS_FOR_ARROWS = ".a_select__element_clickable:not([disabled]):not([d
|
|
|
25
25
|
|
|
26
26
|
export default function ToggleAPI(props, {
|
|
27
27
|
emit,
|
|
28
|
+
}, {
|
|
29
|
+
closePopup = () => {},
|
|
30
|
+
htmlIdLocal = computed(() => ""),
|
|
31
|
+
openPopup = () => {},
|
|
28
32
|
}) {
|
|
29
33
|
const disabled = toRef(props, "disabled");
|
|
30
34
|
const menuWidthType = toRef(props, "menuWidthType");
|
|
@@ -113,6 +117,9 @@ export default function ToggleAPI(props, {
|
|
|
113
117
|
};
|
|
114
118
|
|
|
115
119
|
const onOpen = () => {
|
|
120
|
+
openPopup({
|
|
121
|
+
id: htmlIdLocal.value,
|
|
122
|
+
});
|
|
116
123
|
emit("open");
|
|
117
124
|
};
|
|
118
125
|
|
|
@@ -228,6 +235,9 @@ export default function ToggleAPI(props, {
|
|
|
228
235
|
destroyPopover();
|
|
229
236
|
destroyEventClickOutside();
|
|
230
237
|
destroyEventPressArrows();
|
|
238
|
+
closePopup({
|
|
239
|
+
id: htmlIdLocal.value,
|
|
240
|
+
});
|
|
231
241
|
}
|
|
232
242
|
|
|
233
243
|
onBeforeUnmount(() => destroyEventPressArrows());
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "اختر هذا الخيار فقط",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Nur diese Option auswählen",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[Keine Auswahl]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Suche",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} ausgewählt",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Suche",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} ausgewählt"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Select only this option",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Seleccionar solo esta opción",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Sélectionner uniquement cette option",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Odaberi samo ovu opciju",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Seleziona solo questa opzione",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[No choices]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Search",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} selected",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Search",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} selected"
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"_A_SELECT_EXCLUSIVE_": "Выбрать только этот вариант",
|
|
2
3
|
"_A_SELECT_HAS_NOT_ELEMENTS_WITH_SEARCH_": "[Нет элементов для выбора]",
|
|
3
|
-
"_A_SELECT_SEARCH_": "Поиск",
|
|
4
4
|
"_A_SELECT_MORE_SELECTED_{{count}}_": "+ {{count}} выбрано",
|
|
5
|
+
"_A_SELECT_SEARCH_": "Поиск",
|
|
5
6
|
"_A_SELECT_SELECTED_{{count}}_": "{{count}} выбрано"
|
|
6
7
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
export default function UiSearchAPI(props, { emit }, {
|
|
19
19
|
data = computed(() => []),
|
|
20
20
|
dataExtra = computed(() => []),
|
|
21
|
+
exclusiveOption = computed(() => undefined),
|
|
21
22
|
groupsForLever = computed(() => undefined),
|
|
22
23
|
hasKeyGroup = computed(() => false),
|
|
23
24
|
htmlIdLocal = computed(() => ""),
|
|
@@ -35,6 +36,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
35
36
|
const searching = ref(false);
|
|
36
37
|
const searchingElements = ref({});
|
|
37
38
|
const searchingElementsExtra = ref({});
|
|
39
|
+
const searchingElementsExclusive = ref({});
|
|
38
40
|
const searchingGroups = ref({});
|
|
39
41
|
const searchingGroupsWithSearchInGroup = ref({});
|
|
40
42
|
const searchOutsideRef = ref(undefined);
|
|
@@ -107,6 +109,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
107
109
|
const setElementsVisibleWithSearch = () => {
|
|
108
110
|
const ELEMENTS_EXTRA_VISIBLE = {};
|
|
109
111
|
const ELEMENTS_VISIBLE = {};
|
|
112
|
+
const ELEMENTS_EXCLUSIVE_VISIBLE = {};
|
|
110
113
|
const GROUPS_VISIBLE = {};
|
|
111
114
|
if (modelSearch.value) {
|
|
112
115
|
searching.value = true;
|
|
@@ -144,14 +147,27 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
144
147
|
ELEMENTS_EXTRA_VISIBLE[ELEMENT_ID] = true;
|
|
145
148
|
}
|
|
146
149
|
});
|
|
150
|
+
if (exclusiveOption.value) {
|
|
151
|
+
const ELEMENT_LABEL = exclusiveOption.value[AKeyLabel];
|
|
152
|
+
const ELEMENT_ID = exclusiveOption.value[AKeyId];
|
|
153
|
+
if (`${ ELEMENT_LABEL }`.search(modelSearchRE.value) !== -1) {
|
|
154
|
+
ELEMENTS_EXCLUSIVE_VISIBLE[ELEMENT_ID] = true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
147
157
|
} else {
|
|
148
158
|
searching.value = false;
|
|
149
159
|
}
|
|
150
160
|
searchingElements.value = ELEMENTS_VISIBLE;
|
|
151
161
|
searchingElementsExtra.value = ELEMENTS_EXTRA_VISIBLE;
|
|
162
|
+
searchingElementsExclusive.value = ELEMENTS_EXCLUSIVE_VISIBLE;
|
|
152
163
|
searchingGroups.value = GROUPS_VISIBLE;
|
|
153
164
|
};
|
|
154
165
|
|
|
166
|
+
const hasNotElementsExclusiveWithSearch = computed(() => {
|
|
167
|
+
return !!(searching.value &&
|
|
168
|
+
isEmpty(searchingElementsExclusive.value));
|
|
169
|
+
});
|
|
170
|
+
|
|
155
171
|
const hasNotElementsExtraWithSearch = computed(() => {
|
|
156
172
|
return !!(searching.value &&
|
|
157
173
|
isEmpty(searchingElementsExtra.value));
|
|
@@ -161,6 +177,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
161
177
|
return !!(searching.value &&
|
|
162
178
|
isEmpty(searchingElements.value) &&
|
|
163
179
|
hasNotElementsExtraWithSearch.value &&
|
|
180
|
+
hasNotElementsExclusiveWithSearch.value &&
|
|
164
181
|
!hasAtLeastOneElementInGroupSearch.value);
|
|
165
182
|
});
|
|
166
183
|
|
|
@@ -193,6 +210,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
193
210
|
};
|
|
194
211
|
|
|
195
212
|
return {
|
|
213
|
+
hasNotElementsExclusiveWithSearch,
|
|
196
214
|
hasNotElementsExtraWithSearch,
|
|
197
215
|
hasNotElementsWithSearch,
|
|
198
216
|
idForButtonSearchOutside,
|
|
@@ -202,6 +220,7 @@ export default function UiSearchAPI(props, { emit }, {
|
|
|
202
220
|
onSearchOutside,
|
|
203
221
|
searching,
|
|
204
222
|
searchingElements,
|
|
223
|
+
searchingElementsExclusive,
|
|
205
224
|
searchingElementsExtra,
|
|
206
225
|
searchingGroups,
|
|
207
226
|
searchingGroupsWithSearchInGroup,
|