@ozdao/martyrs 0.2.581 → 0.2.583

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 (86) hide show
  1. package/dist/martyrs/src/components/Feed/Feed.vue.js +1 -1
  2. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js +6 -12
  3. package/dist/martyrs/src/modules/auth/views/components/pages/Profile.vue.js.map +1 -1
  4. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js +1 -1
  5. package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEdit.vue.js.map +1 -1
  6. package/dist/martyrs/src/modules/auth/views/components/pages/UserDashboard.vue.js +182 -89
  7. package/dist/martyrs/src/modules/auth/views/components/pages/UserDashboard.vue.js.map +1 -1
  8. package/dist/martyrs/src/modules/auth/views/configs/navigation.user.config.js +11 -5
  9. package/dist/martyrs/src/modules/auth/views/configs/navigation.user.config.js.map +1 -1
  10. package/dist/martyrs/src/modules/auth/views/router/users.router.js +1 -2
  11. package/dist/martyrs/src/modules/auth/views/router/users.router.js.map +1 -1
  12. package/dist/martyrs/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
  13. package/dist/martyrs/src/modules/core/views/classes/ws.manager.js +16 -1
  14. package/dist/martyrs/src/modules/core/views/classes/ws.manager.js.map +1 -1
  15. package/dist/martyrs/src/modules/core/views/components/sections/{Filters.vue.js → Filters.vue2.js} +2 -2
  16. package/dist/martyrs/src/modules/core/views/components/sections/Filters.vue2.js.map +1 -0
  17. package/dist/martyrs/src/modules/core/views/utils/vue-app-renderer.js +7 -0
  18. package/dist/martyrs/src/modules/core/views/utils/vue-app-renderer.js.map +1 -1
  19. package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +1 -1
  20. package/dist/martyrs/src/modules/events/components/pages/Event.vue.js +1 -1
  21. package/dist/martyrs/src/modules/gallery/components/sections/BackofficeGallery.vue.js +1 -1
  22. package/dist/martyrs/src/modules/marketplace/views/components/pages/Marketplace.vue.js +1 -1
  23. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js +3 -3
  24. package/dist/martyrs/src/modules/notifications/components/elements/NotificationBadge.vue.js.map +1 -1
  25. package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js +11 -40
  26. package/dist/martyrs/src/modules/notifications/components/layouts/NotificationsLayout.vue.js.map +1 -1
  27. package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.js +26 -21
  28. package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.js.map +1 -1
  29. package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.js +54 -48
  30. package/dist/martyrs/src/modules/notifications/components/sections/NotificationPreferences.vue.js.map +1 -1
  31. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js +37 -117
  32. package/dist/martyrs/src/modules/notifications/components/sections/NotificationsList.vue.js.map +1 -1
  33. package/dist/martyrs/src/modules/notifications/notifications.client.js +18 -15
  34. package/dist/martyrs/src/modules/notifications/notifications.client.js.map +1 -1
  35. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js +90 -175
  36. package/dist/martyrs/src/modules/orders/components/blocks/CardOrderUser.vue.js.map +1 -1
  37. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js +6 -6
  38. package/dist/martyrs/src/modules/orders/components/pages/OrderBackoffice.vue.js.map +1 -1
  39. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +41 -28
  40. package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js.map +1 -1
  41. package/dist/martyrs/src/modules/orders/components/sections/FormDelivery.vue.js +1 -1
  42. package/dist/martyrs/src/modules/orders/orders.client.js +14 -14
  43. package/dist/martyrs/src/modules/orders/orders.client.js.map +1 -1
  44. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
  45. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +88 -39
  46. package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js.map +1 -1
  47. package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +1 -1
  48. package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
  49. package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +1 -1
  50. package/dist/style.css +73 -265
  51. package/package.json +1 -1
  52. package/src/modules/TASKS.MD +26 -1
  53. package/src/modules/auth/views/components/pages/Profile.vue +9 -15
  54. package/src/modules/auth/views/components/pages/ProfileEdit.vue +1 -1
  55. package/src/modules/auth/views/components/pages/UserDashboard.vue +214 -125
  56. package/src/modules/auth/views/configs/navigation.user.config.js +17 -11
  57. package/src/modules/auth/views/router/users.router.js +0 -1
  58. package/src/modules/core/views/classes/ws.manager.js +20 -1
  59. package/src/modules/core/views/utils/vue-app-renderer.js +9 -3
  60. package/src/modules/notifications/components/elements/NotificationBadge.vue +1 -1
  61. package/src/modules/notifications/components/layouts/NotificationsLayout.vue +9 -53
  62. package/src/modules/notifications/components/pages/Notifications.vue +21 -22
  63. package/src/modules/notifications/components/sections/NotificationPreferences.vue +41 -180
  64. package/src/modules/notifications/components/sections/NotificationsList.vue +39 -219
  65. package/src/modules/notifications/notifications.client.js +17 -16
  66. package/src/modules/orders/components/blocks/CardOrderUser.vue +88 -190
  67. package/src/modules/orders/components/pages/OrderBackoffice.vue +5 -5
  68. package/src/modules/orders/components/pages/Orders.vue +56 -50
  69. package/src/modules/organizations/components/pages/OrganizationEdit.vue +42 -11
  70. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js +0 -625
  71. package/dist/martyrs/src/components/SelectMulti/SelectMulti.vue.js.map +0 -1
  72. package/dist/martyrs/src/modules/auth/views/components/blocks/ProfileCard.vue.js +0 -44
  73. package/dist/martyrs/src/modules/auth/views/components/blocks/ProfileCard.vue.js.map +0 -1
  74. package/dist/martyrs/src/modules/core/views/components/sections/Filters.vue.js.map +0 -1
  75. package/dist/martyrs/src/modules/orders/components/icons/IconStatusCanceled.vue.js +0 -32
  76. package/dist/martyrs/src/modules/orders/components/icons/IconStatusCanceled.vue.js.map +0 -1
  77. package/dist/martyrs/src/modules/orders/components/icons/IconStatusConfirmed.vue.js +0 -32
  78. package/dist/martyrs/src/modules/orders/components/icons/IconStatusConfirmed.vue.js.map +0 -1
  79. package/dist/martyrs/src/modules/orders/components/icons/IconStatusCreated.vue.js +0 -32
  80. package/dist/martyrs/src/modules/orders/components/icons/IconStatusCreated.vue.js.map +0 -1
  81. package/dist/martyrs/src/modules/orders/components/icons/IconStatusDelay.vue.js +0 -32
  82. package/dist/martyrs/src/modules/orders/components/icons/IconStatusDelay.vue.js.map +0 -1
  83. package/dist/martyrs/src/modules/orders/components/icons/IconStatusFinished.vue.js +0 -32
  84. package/dist/martyrs/src/modules/orders/components/icons/IconStatusFinished.vue.js.map +0 -1
  85. package/dist/martyrs/src/modules/orders/components/icons/IconStatusInUse.vue.js +0 -32
  86. package/dist/martyrs/src/modules/orders/components/icons/IconStatusInUse.vue.js.map +0 -1
@@ -1,625 +0,0 @@
1
- import { ref, computed, watch, onMounted, createElementBlock, openBlock, withKeys, normalizeClass, withModifiers, renderSlot, createElementVNode, createVNode, createCommentVNode, withDirectives, Fragment, renderList, toDisplayString, vShow, Transition, withCtx, normalizeStyle, createTextVNode, nextTick } from "vue";
2
- /* empty css */
3
- const _hoisted_1 = ["tabindex", "onKeydown", "onKeypress", "aria-owns"];
4
- const _hoisted_2 = { class: "multiselect__tags-wrap" };
5
- const _hoisted_3 = { class: "multiselect__tag" };
6
- const _hoisted_4 = ["textContent"];
7
- const _hoisted_5 = ["onKeypress", "onMousedown"];
8
- const _hoisted_6 = ["textContent"];
9
- const _hoisted_7 = { class: "multiselect__spinner" };
10
- const _hoisted_8 = ["name", "id", "placeholder", "value", "disabled", "tabindex", "onKeydown", "onKeypress", "aria-controls"];
11
- const _hoisted_9 = ["id"];
12
- const _hoisted_10 = { key: 0 };
13
- const _hoisted_11 = { class: "multiselect__option" };
14
- const _hoisted_12 = ["id", "role"];
15
- const _hoisted_13 = ["onClick", "onMouseenter", "data-select", "data-selected", "data-deselect"];
16
- const _hoisted_14 = ["data-select", "data-deselect", "onMouseenter", "onMousedown"];
17
- const _hoisted_15 = { class: "multiselect__option" };
18
- const _hoisted_16 = { class: "multiselect__option" };
19
- const _sfc_main = {
20
- __name: "SelectMulti",
21
- props: {
22
- modelValue: { type: null, default: () => [] },
23
- options: { type: Array, required: true },
24
- multiple: { type: Boolean, default: false },
25
- trackBy: String,
26
- label: String,
27
- searchable: { type: Boolean, default: true },
28
- clearOnSelect: { type: Boolean, default: true },
29
- hideSelected: { type: Boolean, default: false },
30
- placeholder: { type: String, default: "Select option" },
31
- allowEmpty: { type: Boolean, default: true },
32
- resetAfter: { type: Boolean, default: false },
33
- closeOnSelect: { type: Boolean, default: true },
34
- customLabel: {
35
- type: Function,
36
- default: (option, label) => {
37
- if (!option && option !== 0) return "";
38
- return label ? option[label] : option;
39
- }
40
- },
41
- taggable: { type: Boolean, default: false },
42
- tagPlaceholder: { type: String, default: "Press enter to create a tag" },
43
- tagPosition: { type: String, default: "top" },
44
- max: { type: [Number, Boolean], default: false },
45
- id: { default: null },
46
- optionsLimit: { type: Number, default: 1e3 },
47
- groupValues: String,
48
- groupLabel: String,
49
- groupSelect: { type: Boolean, default: false },
50
- blockKeys: { type: Array, default: () => [] },
51
- preserveSearch: { type: Boolean, default: false },
52
- preselectFirst: { type: Boolean, default: false },
53
- preventAutofocus: { type: Boolean, default: false },
54
- internalSearch: { type: Boolean, default: true },
55
- name: { type: String, default: "" },
56
- selectLabel: { type: String, default: "Press enter to select" },
57
- selectGroupLabel: { type: String, default: "Press enter to select group" },
58
- selectedLabel: { type: String, default: "Selected" },
59
- deselectLabel: { type: String, default: "Press enter to remove" },
60
- deselectGroupLabel: { type: String, default: "Press enter to deselect group" },
61
- showLabels: { type: Boolean, default: true },
62
- limit: { type: Number, default: 99999 },
63
- maxHeight: { type: Number, default: 300 },
64
- limitText: { type: Function, default: (count) => `and ${count} more` },
65
- loading: { type: Boolean, default: false },
66
- disabled: { type: Boolean, default: false },
67
- openDirection: { type: String, default: "" },
68
- showNoOptions: { type: Boolean, default: true },
69
- showNoResults: { type: Boolean, default: true },
70
- tabindex: { type: Number, default: 0 },
71
- showPointer: { type: Boolean, default: true },
72
- optionHeight: { type: Number, default: 40 }
73
- },
74
- emits: ["open", "search-change", "close", "select", "update:modelValue", "remove", "tag"],
75
- setup(__props, { emit: __emit }) {
76
- const props = __props;
77
- const emit = __emit;
78
- const multiselect = ref(null);
79
- const searchInput = ref(null);
80
- const list = ref(null);
81
- const tags = ref(null);
82
- const search = ref("");
83
- const isOpen = ref(false);
84
- const preferredOpenDirection = ref("below");
85
- const optimizedHeight = ref(props.maxHeight);
86
- const pointer = ref(0);
87
- const pointerDirty = ref(false);
88
- const isEmpty = (opt) => {
89
- if (opt === 0) return false;
90
- if (Array.isArray(opt) && opt.length === 0) return true;
91
- return !opt;
92
- };
93
- const includes = (str, query) => {
94
- if (str === void 0) str = "undefined";
95
- if (str === null) str = "null";
96
- if (str === false) str = "false";
97
- return str.toString().toLowerCase().indexOf(query.trim()) !== -1;
98
- };
99
- const filterOptions = (options, search2, label, customLabel) => {
100
- return search2 ? options.filter((option) => includes(customLabel(option, label), search2)).sort((a, b) => customLabel(a, label).length - customLabel(b, label).length) : options;
101
- };
102
- const flattenOptions = (values, label) => (options) => options.reduce((prev, curr) => {
103
- if (curr[values]?.length) {
104
- prev.push({ $groupLabel: curr[label], $isLabel: true });
105
- return prev.concat(curr[values]);
106
- }
107
- return prev;
108
- }, []);
109
- const stripGroups = (options) => options.filter((option) => !option.$isLabel);
110
- const filterGroups = (search2, label, values, groupLabel, customLabel) => (groups) => groups.map((group) => {
111
- if (!group[values]) {
112
- console.warn(`Options passed to vue-multiselect do not contain groups, despite the config.`);
113
- return [];
114
- }
115
- const groupOptions = filterOptions(group[values], search2, label, customLabel);
116
- return groupOptions.length ? { [groupLabel]: group[groupLabel], [values]: groupOptions } : [];
117
- });
118
- const flow = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
119
- const internalValue = computed(() => {
120
- const val = props.modelValue;
121
- return val || val === 0 ? Array.isArray(val) ? val : [val] : [];
122
- });
123
- const filteredOptions = computed(() => {
124
- const searchVal = search.value || "";
125
- const normalizedSearch = searchVal.toLowerCase().trim();
126
- let options = props.options.concat();
127
- if (props.internalSearch) {
128
- options = props.groupValues ? filterAndFlat(options, normalizedSearch, props.label) : filterOptions(options, normalizedSearch, props.label, props.customLabel);
129
- } else {
130
- options = props.groupValues ? flattenOptions(props.groupValues, props.groupLabel)(options) : options;
131
- }
132
- options = props.hideSelected ? options.filter((o) => !isSelected(o)) : options;
133
- if (props.taggable && normalizedSearch.length && !isExistingOption(normalizedSearch)) {
134
- if (props.tagPosition === "bottom") {
135
- options.push({ isTag: true, label: searchVal });
136
- } else {
137
- options.unshift({ isTag: true, label: searchVal });
138
- }
139
- }
140
- return options.slice(0, props.optionsLimit);
141
- });
142
- const valueKeys = computed(
143
- () => props.trackBy ? internalValue.value.map((el) => el[props.trackBy]) : internalValue.value
144
- );
145
- const optionKeys = computed(() => {
146
- const options = props.groupValues ? flatAndStrip(props.options) : props.options;
147
- return options.map((el) => props.customLabel(el, props.label).toString().toLowerCase());
148
- });
149
- const currentOptionLabel = computed(
150
- () => props.multiple ? props.searchable ? "" : props.placeholder : internalValue.value.length ? getOptionLabel(internalValue.value[0]) : props.searchable ? "" : props.placeholder
151
- );
152
- const hasOptionGroup = computed(() => props.groupValues && props.groupLabel && props.groupSelect);
153
- const isSingleLabelVisible = computed(
154
- () => (singleValue.value || singleValue.value === 0) && (!isOpen.value || !props.searchable) && !visibleValues.value.length
155
- );
156
- const isPlaceholderVisible = computed(
157
- () => !internalValue.value.length && (!props.searchable || !isOpen.value)
158
- );
159
- const visibleValues = computed(
160
- () => props.multiple ? internalValue.value.slice(0, props.limit) : []
161
- );
162
- const singleValue = computed(() => internalValue.value[0]);
163
- const deselectLabelText = computed(() => props.showLabels ? props.deselectLabel : "");
164
- const deselectGroupLabelText = computed(() => props.showLabels ? props.deselectGroupLabel : "");
165
- const selectLabelText = computed(() => props.showLabels ? props.selectLabel : "");
166
- const selectGroupLabelText = computed(() => props.showLabels ? props.selectGroupLabel : "");
167
- const selectedLabelText = computed(() => props.showLabels ? props.selectedLabel : "");
168
- const inputStyle = computed(() => {
169
- if (props.searchable || props.multiple && props.modelValue?.length) {
170
- return isOpen.value ? { width: "100%" } : { width: "0", position: "absolute", padding: "0" };
171
- }
172
- return "";
173
- });
174
- const contentStyle = computed(
175
- () => props.options.length ? { display: "inline-block" } : { display: "block" }
176
- );
177
- const isAbove = computed(() => {
178
- if (["above", "top"].includes(props.openDirection)) return true;
179
- if (["below", "bottom"].includes(props.openDirection)) return false;
180
- return preferredOpenDirection.value === "above";
181
- });
182
- const pointerPosition = computed(() => pointer.value * props.optionHeight);
183
- const visibleElements = computed(() => optimizedHeight.value / props.optionHeight);
184
- const filterAndFlat = (options, search2, label) => flow(
185
- filterGroups(search2, label, props.groupValues, props.groupLabel, props.customLabel),
186
- flattenOptions(props.groupValues, props.groupLabel)
187
- )(options);
188
- const flatAndStrip = (options) => flow(
189
- flattenOptions(props.groupValues, props.groupLabel),
190
- stripGroups
191
- )(options);
192
- const updateSearch = (query) => {
193
- search.value = query;
194
- };
195
- const isExistingOption = (query) => props.options ? optionKeys.value.indexOf(query) > -1 : false;
196
- const isSelected = (option) => {
197
- const opt = props.trackBy ? option[props.trackBy] : option;
198
- return valueKeys.value.indexOf(opt) > -1;
199
- };
200
- const isOptionDisabled = (option) => !!option?.$isDisabled;
201
- const getOptionLabel = (option) => {
202
- if (isEmpty(option)) return "";
203
- if (option.isTag) return option.label;
204
- if (option.$isLabel) return option.$groupLabel;
205
- const label = props.customLabel(option, props.label);
206
- return isEmpty(label) ? "" : label;
207
- };
208
- const select = (option, key) => {
209
- if (option.$isLabel && props.groupSelect) {
210
- selectGroup(option);
211
- return;
212
- }
213
- if (props.blockKeys.indexOf(key) !== -1 || props.disabled || option.$isDisabled || option.$isLabel) return;
214
- if (props.max && props.multiple && internalValue.value.length === props.max) return;
215
- if (key === "Tab" && !pointerDirty.value) return;
216
- if (option.isTag) {
217
- emit("tag", option.label, props.id);
218
- search.value = "";
219
- if (props.closeOnSelect && !props.multiple) deactivate();
220
- } else {
221
- if (isSelected(option)) {
222
- if (key !== "Tab") removeElement(option);
223
- return;
224
- }
225
- emit("update:modelValue", props.multiple ? internalValue.value.concat([option]) : option);
226
- emit("select", option, props.id);
227
- if (props.clearOnSelect) search.value = "";
228
- }
229
- if (props.closeOnSelect) deactivate();
230
- };
231
- const selectGroup = (selectedGroup) => {
232
- const group = props.options.find(
233
- (option) => option[props.groupLabel] === selectedGroup.$groupLabel
234
- );
235
- if (!group) return;
236
- if (wholeGroupSelected(group)) {
237
- emit("remove", group[props.groupValues], props.id);
238
- const newValue = internalValue.value.filter(
239
- (option) => group[props.groupValues].indexOf(option) === -1
240
- );
241
- emit("update:modelValue", newValue);
242
- } else {
243
- let optionsToAdd = group[props.groupValues].filter(
244
- (option) => !(isOptionDisabled(option) || isSelected(option))
245
- );
246
- if (props.max) optionsToAdd.splice(props.max - internalValue.value.length);
247
- emit("select", optionsToAdd, props.id);
248
- emit("update:modelValue", internalValue.value.concat(optionsToAdd));
249
- }
250
- if (props.closeOnSelect) deactivate();
251
- };
252
- const wholeGroupSelected = (group) => group[props.groupValues].every((option) => isSelected(option) || isOptionDisabled(option));
253
- const wholeGroupDisabled = (group) => group[props.groupValues].every(isOptionDisabled);
254
- const removeElement = (option, shouldClose = true) => {
255
- if (props.disabled || option?.$isDisabled) return;
256
- if (!props.allowEmpty && internalValue.value.length <= 1) {
257
- deactivate();
258
- return;
259
- }
260
- const index = typeof option === "object" ? valueKeys.value.indexOf(option[props.trackBy]) : valueKeys.value.indexOf(option);
261
- const newValue = props.multiple ? internalValue.value.slice(0, index).concat(internalValue.value.slice(index + 1)) : null;
262
- emit("update:modelValue", newValue);
263
- emit("remove", option, props.id);
264
- if (props.closeOnSelect && shouldClose) deactivate();
265
- };
266
- const removeLastElement = () => {
267
- if (props.blockKeys.indexOf("Delete") !== -1) return;
268
- if (search.value.length === 0 && Array.isArray(internalValue.value) && internalValue.value.length) {
269
- removeElement(internalValue.value[internalValue.value.length - 1], false);
270
- }
271
- };
272
- const activate = () => {
273
- if (isOpen.value || props.disabled) return;
274
- adjustPosition();
275
- if (props.groupValues && pointer.value === 0 && filteredOptions.value.length) {
276
- pointer.value = 1;
277
- }
278
- isOpen.value = true;
279
- if (props.searchable) {
280
- if (!props.preserveSearch) search.value = "";
281
- if (!props.preventAutofocus) nextTick(() => searchInput.value?.focus());
282
- } else if (!props.preventAutofocus) {
283
- multiselect.value?.focus();
284
- }
285
- emit("open", props.id);
286
- };
287
- const deactivate = () => {
288
- if (!isOpen.value) return;
289
- isOpen.value = false;
290
- if (props.searchable) {
291
- searchInput.value?.blur();
292
- } else {
293
- multiselect.value?.blur();
294
- }
295
- if (!props.preserveSearch) search.value = "";
296
- emit("close", getValue(), props.id);
297
- };
298
- const toggle = () => {
299
- isOpen.value ? deactivate() : activate();
300
- };
301
- const adjustPosition = () => {
302
- if (typeof window === "undefined") return;
303
- const spaceAbove = multiselect.value.getBoundingClientRect().top;
304
- const spaceBelow = window.innerHeight - multiselect.value.getBoundingClientRect().bottom;
305
- const hasEnoughSpaceBelow = spaceBelow > props.maxHeight;
306
- if (hasEnoughSpaceBelow || spaceBelow > spaceAbove || ["below", "bottom"].includes(props.openDirection)) {
307
- preferredOpenDirection.value = "below";
308
- optimizedHeight.value = Math.min(spaceBelow - 40, props.maxHeight);
309
- } else {
310
- preferredOpenDirection.value = "above";
311
- optimizedHeight.value = Math.min(spaceAbove - 40, props.maxHeight);
312
- }
313
- };
314
- const getValue = () => props.multiple ? internalValue.value : internalValue.value.length === 0 ? null : internalValue.value[0];
315
- const optionHighlight = (index, option) => ({
316
- "multiselect__option--highlight": index === pointer.value && props.showPointer,
317
- "multiselect__option--selected": isSelected(option)
318
- });
319
- const groupHighlight = (index, selectedGroup) => {
320
- if (!props.groupSelect) {
321
- return ["multiselect__option--disabled", { "multiselect__option--group": selectedGroup.$isLabel }];
322
- }
323
- const group = props.options.find(
324
- (option) => option[props.groupLabel] === selectedGroup.$groupLabel
325
- );
326
- return group && !wholeGroupDisabled(group) ? [
327
- "multiselect__option--group",
328
- { "multiselect__option--highlight": index === pointer.value && props.showPointer },
329
- { "multiselect__option--group-selected": wholeGroupSelected(group) }
330
- ] : "multiselect__option--disabled";
331
- };
332
- const addPointerElement = ({ key } = "Enter") => {
333
- if (filteredOptions.value.length > 0) {
334
- select(filteredOptions.value[pointer.value], key);
335
- }
336
- pointerReset();
337
- };
338
- const pointerForward = () => {
339
- if (pointer.value < filteredOptions.value.length - 1) {
340
- pointer.value++;
341
- if (list.value.scrollTop <= pointerPosition.value - (visibleElements.value - 1) * props.optionHeight) {
342
- list.value.scrollTop = pointerPosition.value - (visibleElements.value - 1) * props.optionHeight;
343
- }
344
- if (filteredOptions.value[pointer.value]?.$isLabel && !props.groupSelect) pointerForward();
345
- }
346
- pointerDirty.value = true;
347
- };
348
- const pointerBackward = () => {
349
- if (pointer.value > 0) {
350
- pointer.value--;
351
- if (list.value.scrollTop >= pointerPosition.value) {
352
- list.value.scrollTop = pointerPosition.value;
353
- }
354
- if (filteredOptions.value[pointer.value]?.$isLabel && !props.groupSelect) pointerBackward();
355
- } else {
356
- if (filteredOptions.value[pointer.value]?.$isLabel && !props.groupSelect) pointerForward();
357
- }
358
- pointerDirty.value = true;
359
- };
360
- const pointerReset = () => {
361
- if (!props.closeOnSelect) return;
362
- pointer.value = 0;
363
- if (list.value) list.value.scrollTop = 0;
364
- };
365
- const pointerAdjust = () => {
366
- if (pointer.value >= filteredOptions.value.length - 1) {
367
- pointer.value = filteredOptions.value.length ? filteredOptions.value.length - 1 : 0;
368
- }
369
- if (filteredOptions.value.length > 0 && filteredOptions.value[pointer.value]?.$isLabel && !props.groupSelect) {
370
- pointerForward();
371
- }
372
- };
373
- const pointerSet = (index) => {
374
- pointer.value = index;
375
- pointerDirty.value = true;
376
- };
377
- watch(() => internalValue.value, () => {
378
- if (props.resetAfter && internalValue.value.length) {
379
- search.value = "";
380
- emit("update:modelValue", props.multiple ? [] : null);
381
- }
382
- }, { deep: true });
383
- watch(search, () => emit("search-change", search.value));
384
- watch(filteredOptions, () => pointerAdjust());
385
- watch(isOpen, () => pointerDirty.value = false);
386
- watch(pointer, () => {
387
- searchInput.value?.setAttribute("aria-activedescendant", `${props.id}-${pointer.value}`);
388
- });
389
- onMounted(() => {
390
- if (!props.multiple && props.max) {
391
- console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false.");
392
- }
393
- if (props.preselectFirst && !internalValue.value.length && props.options.length) {
394
- select(filteredOptions.value[0]);
395
- }
396
- });
397
- return (_ctx, _cache) => {
398
- return openBlock(), createElementBlock("div", {
399
- ref_key: "multiselect",
400
- ref: multiselect,
401
- tabindex: __props.searchable ? -1 : __props.tabindex,
402
- class: normalizeClass([{
403
- "multiselect--active": isOpen.value,
404
- "multiselect--disabled": __props.disabled,
405
- "multiselect--above": isAbove.value,
406
- "multiselect--has-options-group": hasOptionGroup.value
407
- }, "multiselect flex flex-v-center"]),
408
- onFocus: activate,
409
- onBlur: _cache[2] || (_cache[2] = ($event) => __props.searchable ? false : deactivate),
410
- onKeydown: [
411
- withKeys(withModifiers(pointerForward, ["self", "prevent"]), ["down"]),
412
- withKeys(withModifiers(pointerBackward, ["self", "prevent"]), ["up"])
413
- ],
414
- onKeypress: withKeys(withModifiers(addPointerElement, ["stop", "self"]), ["enter", "tab"]),
415
- onKeyup: withKeys(deactivate, ["esc"]),
416
- role: "combobox",
417
- "aria-owns": `listbox-${__props.id}`
418
- }, [
419
- renderSlot(_ctx.$slots, "caret", { toggle }, () => [
420
- createElementVNode("div", {
421
- onMousedown: withModifiers(toggle, ["prevent", "stop"]),
422
- class: "multiselect__select"
423
- }, null, 32)
424
- ]),
425
- renderSlot(_ctx.$slots, "clear", { search: search.value }),
426
- createElementVNode("div", {
427
- ref_key: "tags",
428
- ref: tags,
429
- class: "multiselect__tags"
430
- }, [
431
- renderSlot(_ctx.$slots, "selection", {
432
- search: search.value,
433
- remove: removeElement,
434
- values: visibleValues.value,
435
- isOpen: isOpen.value
436
- }, () => [
437
- withDirectives(createElementVNode("div", _hoisted_2, [
438
- (openBlock(true), createElementBlock(Fragment, null, renderList(visibleValues.value, (option, index) => {
439
- return renderSlot(_ctx.$slots, "tag", {
440
- key: index,
441
- option,
442
- search: search.value,
443
- remove: removeElement
444
- }, () => [
445
- createElementVNode("span", _hoisted_3, [
446
- createElementVNode("span", {
447
- textContent: toDisplayString(getOptionLabel(option))
448
- }, null, 8, _hoisted_4),
449
- createElementVNode("i", {
450
- tabindex: "1",
451
- onKeypress: withKeys(withModifiers(($event) => removeElement(option), ["prevent"]), ["enter"]),
452
- onMousedown: withModifiers(($event) => removeElement(option), ["prevent"]),
453
- class: "multiselect__tag-icon"
454
- }, null, 40, _hoisted_5)
455
- ])
456
- ]);
457
- }), 128))
458
- ], 512), [
459
- [vShow, visibleValues.value.length > 0]
460
- ]),
461
- internalValue.value?.length > __props.limit ? renderSlot(_ctx.$slots, "limit", { key: 0 }, () => [
462
- createElementVNode("strong", {
463
- class: "multiselect__strong",
464
- textContent: toDisplayString(__props.limitText(internalValue.value.length - __props.limit))
465
- }, null, 8, _hoisted_6)
466
- ]) : createCommentVNode("", true)
467
- ]),
468
- createVNode(Transition, { name: "multiselect__loading" }, {
469
- default: withCtx(() => [
470
- renderSlot(_ctx.$slots, "loading", {}, () => [
471
- withDirectives(createElementVNode("div", _hoisted_7, null, 512), [
472
- [vShow, __props.loading]
473
- ])
474
- ])
475
- ]),
476
- _: 3
477
- }),
478
- __props.searchable ? (openBlock(), createElementBlock("input", {
479
- key: 0,
480
- ref_key: "searchInput",
481
- ref: searchInput,
482
- name: __props.name,
483
- id: __props.id,
484
- type: "text",
485
- autocomplete: "off",
486
- spellcheck: "false",
487
- placeholder: __props.placeholder,
488
- style: normalizeStyle(inputStyle.value),
489
- value: search.value,
490
- disabled: __props.disabled,
491
- tabindex: __props.tabindex,
492
- onInput: _cache[0] || (_cache[0] = ($event) => updateSearch($event.target.value)),
493
- onFocus: withModifiers(activate, ["prevent"]),
494
- onBlur: withModifiers(deactivate, ["prevent"]),
495
- onKeyup: withKeys(deactivate, ["esc"]),
496
- onKeydown: [
497
- withKeys(withModifiers(pointerForward, ["prevent"]), ["down"]),
498
- withKeys(withModifiers(pointerBackward, ["prevent"]), ["up"]),
499
- withKeys(withModifiers(removeLastElement, ["stop"]), ["delete"])
500
- ],
501
- onKeypress: withKeys(withModifiers(addPointerElement, ["prevent", "stop", "self"]), ["enter"]),
502
- class: "multiselect__input",
503
- "aria-controls": `listbox-${__props.id}`
504
- }, null, 44, _hoisted_8)) : createCommentVNode("", true),
505
- isSingleLabelVisible.value ? (openBlock(), createElementBlock("span", {
506
- key: 1,
507
- class: "multiselect__single",
508
- onMousedown: withModifiers(toggle, ["prevent"])
509
- }, [
510
- renderSlot(_ctx.$slots, "singleLabel", { option: singleValue.value }, () => [
511
- createTextVNode(toDisplayString(currentOptionLabel.value), 1)
512
- ])
513
- ], 32)) : createCommentVNode("", true),
514
- isPlaceholderVisible.value ? (openBlock(), createElementBlock("span", {
515
- key: 2,
516
- class: "multiselect__placeholder",
517
- onMousedown: withModifiers(toggle, ["prevent"])
518
- }, [
519
- renderSlot(_ctx.$slots, "placeholder", {}, () => [
520
- createTextVNode(toDisplayString(__props.placeholder), 1)
521
- ])
522
- ], 32)) : createCommentVNode("", true)
523
- ], 512),
524
- createVNode(Transition, { name: "multiselect" }, {
525
- default: withCtx(() => [
526
- withDirectives(createElementVNode("div", {
527
- class: "multiselect__content-wrapper",
528
- onFocus: activate,
529
- tabindex: "-1",
530
- onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
531
- }, ["prevent"])),
532
- style: normalizeStyle({ maxHeight: `${optimizedHeight.value}px` }),
533
- ref_key: "list",
534
- ref: list
535
- }, [
536
- createElementVNode("ul", {
537
- class: "multiselect__content",
538
- style: normalizeStyle(contentStyle.value),
539
- role: "listbox",
540
- id: `listbox-${__props.id}`
541
- }, [
542
- renderSlot(_ctx.$slots, "beforeList"),
543
- __props.multiple && __props.max === internalValue.value.length ? (openBlock(), createElementBlock("li", _hoisted_10, [
544
- createElementVNode("span", _hoisted_11, [
545
- renderSlot(_ctx.$slots, "maxElements", {}, () => [
546
- createTextVNode(" Maximum of " + toDisplayString(__props.max) + " options selected. First remove a selected option to select another. ", 1)
547
- ])
548
- ])
549
- ])) : createCommentVNode("", true),
550
- !__props.max || internalValue.value.length < __props.max ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(filteredOptions.value, (option, index) => {
551
- return openBlock(), createElementBlock("li", {
552
- class: "multiselect__element",
553
- key: index,
554
- id: `${__props.id}-${index}`,
555
- role: !(option?.$isLabel || option?.$isDisabled) ? "option" : null
556
- }, [
557
- !(option?.$isLabel || option?.$isDisabled) ? (openBlock(), createElementBlock("span", {
558
- key: 0,
559
- class: normalizeClass([optionHighlight(index, option), "multiselect__option"]),
560
- onClick: withModifiers(($event) => select(option), ["stop"]),
561
- onMouseenter: withModifiers(($event) => pointerSet(index), ["self"]),
562
- "data-select": option?.isTag ? __props.tagPlaceholder : selectLabelText.value,
563
- "data-selected": selectedLabelText.value,
564
- "data-deselect": deselectLabelText.value
565
- }, [
566
- renderSlot(_ctx.$slots, "option", {
567
- option,
568
- search: search.value,
569
- index
570
- }, () => [
571
- createElementVNode("span", null, toDisplayString(getOptionLabel(option)), 1)
572
- ])
573
- ], 42, _hoisted_13)) : createCommentVNode("", true),
574
- option?.$isLabel || option?.$isDisabled ? (openBlock(), createElementBlock("span", {
575
- key: 1,
576
- "data-select": __props.groupSelect && selectGroupLabelText.value,
577
- "data-deselect": __props.groupSelect && deselectGroupLabelText.value,
578
- class: normalizeClass([groupHighlight(index, option), "multiselect__option"]),
579
- onMouseenter: withModifiers(($event) => __props.groupSelect && pointerSet(index), ["self"]),
580
- onMousedown: withModifiers(($event) => selectGroup(option), ["prevent"])
581
- }, [
582
- renderSlot(_ctx.$slots, "option", {
583
- option,
584
- search: search.value,
585
- index
586
- }, () => [
587
- createElementVNode("span", null, toDisplayString(getOptionLabel(option)), 1)
588
- ])
589
- ], 42, _hoisted_14)) : createCommentVNode("", true)
590
- ], 8, _hoisted_12);
591
- }), 128)) : createCommentVNode("", true),
592
- withDirectives(createElementVNode("li", null, [
593
- createElementVNode("span", _hoisted_15, [
594
- renderSlot(_ctx.$slots, "noResult", { search: search.value }, () => [
595
- _cache[3] || (_cache[3] = createTextVNode(" No elements found. Consider changing the search query. "))
596
- ])
597
- ])
598
- ], 512), [
599
- [vShow, __props.showNoResults && filteredOptions.value.length === 0 && search.value && !__props.loading]
600
- ]),
601
- withDirectives(createElementVNode("li", null, [
602
- createElementVNode("span", _hoisted_16, [
603
- renderSlot(_ctx.$slots, "noOptions", {}, () => [
604
- _cache[4] || (_cache[4] = createTextVNode("List is empty."))
605
- ])
606
- ])
607
- ], 512), [
608
- [vShow, __props.showNoOptions && (__props.options.length === 0 || hasOptionGroup.value && filteredOptions.value.length === 0) && !search.value && !__props.loading]
609
- ]),
610
- renderSlot(_ctx.$slots, "afterList")
611
- ], 12, _hoisted_9)
612
- ], 36), [
613
- [vShow, isOpen.value]
614
- ])
615
- ]),
616
- _: 3
617
- })
618
- ], 42, _hoisted_1);
619
- };
620
- }
621
- };
622
- export {
623
- _sfc_main as default
624
- };
625
- //# sourceMappingURL=SelectMulti.vue.js.map