@quoreadmin/ui 1.7.9 → 1.7.10

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 (205) hide show
  1. package/dist/index.css +1 -1
  2. package/dist/index140.js +2 -2
  3. package/dist/index142.js +13 -13
  4. package/dist/index144.js +4 -4
  5. package/dist/index155.js +1 -1
  6. package/dist/index159.js +7 -7
  7. package/dist/index172.js +14 -14
  8. package/dist/index173.js +3 -3
  9. package/dist/index183.js +2 -2
  10. package/dist/index185.js +9 -9
  11. package/dist/index187.js +5938 -36
  12. package/dist/index188.js +205 -42
  13. package/dist/index189.js +25 -1180
  14. package/dist/index190.js +20 -0
  15. package/dist/index191.js +72 -5932
  16. package/dist/index192.js +245 -199
  17. package/dist/index193.js +13674 -25
  18. package/dist/index194.js +26 -17
  19. package/dist/index195.js +61 -76
  20. package/dist/index196.js +224 -239
  21. package/dist/index197.js +283 -13659
  22. package/dist/index198.js +288 -27
  23. package/dist/index199.js +36 -63
  24. package/dist/index200.js +44 -238
  25. package/dist/index201.js +1169 -287
  26. package/dist/index203.js +29 -84
  27. package/dist/index204.js +109 -400
  28. package/dist/index205.js +36 -22
  29. package/dist/index206.js +26 -33
  30. package/dist/index207.js +31 -111
  31. package/dist/index208.js +9 -36
  32. package/dist/index209.js +19 -26
  33. package/dist/index210.js +10 -36
  34. package/dist/index211.js +10 -9
  35. package/dist/index212.js +50 -18
  36. package/dist/index213.js +43 -10
  37. package/dist/index214.js +4 -10
  38. package/dist/index215.js +36 -48
  39. package/dist/index216.js +21 -43
  40. package/dist/index217.js +87 -3
  41. package/dist/index218.js +403 -35
  42. package/dist/index219.js +22 -21
  43. package/dist/index220.js +4 -4
  44. package/dist/index221.js +1 -1
  45. package/dist/index222.js +1 -1
  46. package/dist/index223.js +1 -1
  47. package/dist/index224.js +7 -7
  48. package/dist/index225.js +2 -2
  49. package/dist/index227.js +2 -2
  50. package/dist/index232.js +3614 -109
  51. package/dist/index233.js +49 -32
  52. package/dist/index234.js +70 -73
  53. package/dist/index235.js +52 -20
  54. package/dist/index236.js +215 -20
  55. package/dist/index237.js +10 -20
  56. package/dist/index238.js +57 -20
  57. package/dist/index239.js +61 -22
  58. package/dist/index240.js +54 -22
  59. package/dist/index241.js +75 -20
  60. package/dist/index242.js +678 -791
  61. package/dist/index243.js +32 -695
  62. package/dist/index244.js +56 -168
  63. package/dist/index245.js +11 -22
  64. package/dist/index246.js +705 -20
  65. package/dist/index247.js +820 -20
  66. package/dist/index248.js +127 -3
  67. package/dist/index249.js +24 -173
  68. package/dist/index250.js +78 -131
  69. package/dist/index251.js +20 -1223
  70. package/dist/index252.js +10 -10
  71. package/dist/index253.js +13 -15
  72. package/dist/index254.js +13 -15
  73. package/dist/index255.js +15 -22
  74. package/dist/index256.js +15 -13
  75. package/dist/index257.js +12 -12
  76. package/dist/index258.js +836 -2
  77. package/dist/index259.js +702 -2
  78. package/dist/index260.js +170 -3626
  79. package/dist/index261.js +22 -55
  80. package/dist/index262.js +20 -77
  81. package/dist/index263.js +20 -52
  82. package/dist/index264.js +3 -215
  83. package/dist/index265.js +187 -10
  84. package/dist/index266.js +128 -52
  85. package/dist/index267.js +1214 -52
  86. package/dist/index268.js +20 -54
  87. package/dist/index269.js +22 -75
  88. package/dist/index270.js +21 -722
  89. package/dist/index271.js +29 -39
  90. package/dist/index272.js +20 -64
  91. package/dist/index273.js +20 -11
  92. package/dist/index274.js +2 -705
  93. package/dist/index275.js +2 -820
  94. package/dist/index280.js +54 -3
  95. package/dist/index281.js +77 -25
  96. package/dist/index282.js +25 -53
  97. package/dist/index283.js +21 -78
  98. package/dist/index284.js +13 -17
  99. package/dist/index285.js +16 -22
  100. package/dist/index286.js +17 -22
  101. package/dist/index287.js +22 -15
  102. package/dist/index288.js +3 -17
  103. package/dist/index289.js +27 -23
  104. package/dist/index290.js +1518 -2
  105. package/dist/index291.js +366 -215
  106. package/dist/index292.js +2729 -4
  107. package/dist/index293.js +83 -131
  108. package/dist/index294.js +3768 -66
  109. package/dist/index295.js +56 -83
  110. package/dist/index296.js +15 -29
  111. package/dist/index297.js +83 -8
  112. package/dist/index298.js +191 -64
  113. package/dist/index299.js +245 -3
  114. package/dist/index300.js +2 -2
  115. package/dist/index301.js +74 -78
  116. package/dist/index302.js +21 -53
  117. package/dist/index303.js +934 -5
  118. package/dist/index304.js +21 -4
  119. package/dist/index305.js +19 -178
  120. package/dist/index306.js +19 -62
  121. package/dist/index307.js +68 -74
  122. package/dist/index308.js +19 -1518
  123. package/dist/index309.js +19 -386
  124. package/dist/index310.js +22 -2731
  125. package/dist/index311.js +21 -85
  126. package/dist/index312.js +63 -3770
  127. package/dist/index313.js +227 -52
  128. package/dist/index314.js +5 -78
  129. package/dist/index315.js +133 -21
  130. package/dist/index316.js +62 -929
  131. package/dist/index317.js +86 -21
  132. package/dist/index318.js +28 -19
  133. package/dist/index319.js +7 -18
  134. package/dist/index320.js +73 -67
  135. package/dist/index321.js +4 -19
  136. package/dist/index322.js +2 -19
  137. package/dist/index323.js +82 -21
  138. package/dist/index324.js +53 -21
  139. package/dist/index325.js +6 -63
  140. package/dist/index326.js +5 -15
  141. package/dist/index327.js +166 -71
  142. package/dist/index328.js +57 -196
  143. package/dist/index329.js +75 -246
  144. package/dist/index330.js +36 -8
  145. package/dist/index331.js +8 -12
  146. package/dist/index332.js +12 -54
  147. package/dist/index333.js +52 -9
  148. package/dist/index334.js +11 -13
  149. package/dist/index335.js +9 -53
  150. package/dist/index336.js +55 -49
  151. package/dist/index337.js +49 -28
  152. package/dist/index338.js +31 -2
  153. package/dist/index339.js +2 -5
  154. package/dist/index340.js +5 -2
  155. package/dist/index341.js +2 -23
  156. package/dist/index342.js +21 -39
  157. package/dist/index343.js +41 -2
  158. package/dist/index344.js +2 -11
  159. package/dist/index345.js +11 -20
  160. package/dist/index346.js +18 -15
  161. package/dist/index347.js +16 -9
  162. package/dist/index348.js +9 -9
  163. package/dist/index349.js +10 -2
  164. package/dist/index350.js +2 -9
  165. package/dist/index351.js +9 -10
  166. package/dist/index352.js +10 -14
  167. package/dist/index353.js +14 -37
  168. package/dist/index354.js +19 -20
  169. package/dist/index355.js +19 -55
  170. package/dist/index356.js +63 -28
  171. package/dist/index357.js +37 -7
  172. package/dist/index358.js +18 -49
  173. package/dist/index359.js +56 -6
  174. package/dist/index360.js +27 -10
  175. package/dist/index361.js +7 -7
  176. package/dist/index362.js +51 -27
  177. package/dist/index363.js +6 -2
  178. package/dist/index364.js +11 -69
  179. package/dist/index365.js +6 -166
  180. package/dist/index366.js +28 -20
  181. package/dist/index367.js +2 -20
  182. package/dist/index368.js +67 -61
  183. package/dist/index369.js +166 -36
  184. package/dist/index370.js +98 -28
  185. package/dist/index371.js +90 -10
  186. package/dist/index372.js +98 -4
  187. package/dist/index373.js +17 -4
  188. package/dist/index374.js +30 -12
  189. package/dist/index375.js +11 -7
  190. package/dist/index376.js +3 -11
  191. package/dist/index377.js +3 -4
  192. package/dist/index378.js +13 -33
  193. package/dist/index379.js +7 -31
  194. package/dist/index380.js +12 -28
  195. package/dist/index381.js +5 -61
  196. package/dist/index382.js +33 -101
  197. package/dist/index383.js +31 -91
  198. package/dist/index384.js +27 -16
  199. package/dist/index385.js +59 -96
  200. package/dist/index386.js +1 -1
  201. package/dist/index391.js +1 -1
  202. package/dist/index392.js +2 -2
  203. package/dist/index44.js +22 -22
  204. package/package.json +1 -1
  205. package/dist/index202.js +0 -290
package/dist/index201.js CHANGED
@@ -1,310 +1,1192 @@
1
- import { Mark as x, markPasteRule as b, mergeAttributes as v, combineTransactionSteps as w, getChangedRanges as T, findChildrenInRange as O, getMarksBetween as R, getAttributes as _ } from "./index260.js";
2
- import { registerCustomProtocol as C, tokenize as H, find as M, reset as U } from "./index274.js";
3
- import { Plugin as g, PluginKey as A } from "./index275.js";
4
- var P = "[\0-   ᠎ -\u2029  ]", I = new RegExp(P), B = new RegExp(`${P}$`), N = new RegExp(P, "g");
5
- function W(t) {
6
- return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1;
1
+ import { createElementBlock as d, openBlock as p, withKeys as f, normalizeClass as V, withModifiers as r, renderSlot as u, createElementVNode as o, createVNode as L, createCommentVNode as c, withDirectives as b, Fragment as $, renderList as B, toDisplayString as g, vShow as y, Transition as k, withCtx as D, normalizeStyle as O, createTextVNode as v } from "vue";
2
+ function S(e) {
3
+ return e === 0 ? !1 : Array.isArray(e) && e.length === 0 ? !0 : !e;
7
4
  }
8
- function z(t) {
9
- return new g({
10
- key: new A("autolink"),
11
- appendTransaction: (e, r, o) => {
12
- const s = e.some((i) => i.docChanged) && !r.doc.eq(o.doc), l = e.some((i) => i.getMeta("preventAutolink"));
13
- if (!s || l)
14
- return;
15
- const { tr: d } = o, a = w(r.doc, [...e]);
16
- if (T(a).forEach(({ newRange: i }) => {
17
- const f = O(o.doc, i, (c) => c.isTextblock);
18
- let u, p;
19
- if (f.length > 1)
20
- u = f[0], p = o.doc.textBetween(
21
- u.pos,
22
- u.pos + u.node.nodeSize,
23
- void 0,
24
- " "
25
- );
26
- else if (f.length) {
27
- const c = o.doc.textBetween(i.from, i.to, " ", " ");
28
- if (!B.test(c))
29
- return;
30
- u = f[0], p = o.doc.textBetween(u.pos, i.to, void 0, " ");
31
- }
32
- if (u && p) {
33
- const c = p.split(I).filter(Boolean);
34
- if (c.length <= 0)
35
- return !1;
36
- const m = c[c.length - 1], E = u.pos + p.lastIndexOf(m);
37
- if (!m)
38
- return !1;
39
- const L = H(m).map((n) => n.toObject(t.defaultProtocol));
40
- if (!W(L))
41
- return !1;
42
- L.filter((n) => n.isLink).map((n) => ({
43
- ...n,
44
- from: E + n.start + 1,
45
- to: E + n.end + 1
46
- })).filter((n) => o.schema.marks.code ? !o.doc.rangeHasMark(n.from, n.to, o.schema.marks.code) : !0).filter((n) => t.validate(n.value)).filter((n) => t.shouldAutoLink(n.value)).forEach((n) => {
47
- R(n.from, n.to, o.doc).some((y) => y.mark.type === t.type) || d.addMark(
48
- n.from,
49
- n.to,
50
- t.type.create({
51
- href: n.href
52
- })
53
- );
54
- });
55
- }
56
- }), !!d.steps.length)
57
- return d;
58
- }
59
- });
5
+ function T(e) {
6
+ return (...t) => !e(...t);
60
7
  }
61
- function V(t) {
62
- return new g({
63
- key: new A("handleClickLink"),
64
- props: {
65
- handleClick: (e, r, o) => {
66
- var s, l;
67
- if (o.button !== 0 || !e.editable)
68
- return !1;
69
- let d = !1;
70
- if (t.enableClickSelection && (d = t.editor.commands.extendMarkRange(t.type.name)), t.openOnClick) {
71
- let a = null;
72
- if (o.target instanceof HTMLAnchorElement)
73
- a = o.target;
74
- else {
75
- let u = o.target;
76
- const p = [];
77
- for (; u.nodeName !== "DIV"; )
78
- p.push(u), u = u.parentNode;
79
- a = p.find((c) => c.nodeName === "A");
80
- }
81
- if (!a)
82
- return d;
83
- const h = _(e.state, t.type.name), i = (s = a?.href) != null ? s : h.href, f = (l = a?.target) != null ? l : h.target;
84
- a && i && (window.open(i, f), d = !0);
85
- }
86
- return d;
87
- }
88
- }
89
- });
8
+ function A(e, t) {
9
+ return e === void 0 && (e = "undefined"), e === null && (e = "null"), e === !1 && (e = "false"), e.toString().toLowerCase().indexOf(t.trim()) !== -1;
90
10
  }
91
- function D(t) {
92
- return new g({
93
- key: new A("handlePasteLink"),
94
- props: {
95
- handlePaste: (e, r, o) => {
96
- const { shouldAutoLink: s } = t, { state: l } = e, { selection: d } = l, { empty: a } = d;
97
- if (a)
98
- return !1;
99
- let h = "";
100
- o.content.forEach((f) => {
101
- h += f.textContent;
102
- });
103
- const i = M(h, { defaultProtocol: t.defaultProtocol }).find(
104
- (f) => f.isLink && f.value === h
105
- );
106
- return !h || !i || s !== void 0 && !s(i.value) ? !1 : t.editor.commands.setMark(t.type, {
107
- href: i.href
108
- });
109
- }
110
- }
111
- });
11
+ function M(e) {
12
+ return e.filter((t) => !t.$isLabel);
112
13
  }
113
- function k(t, e) {
114
- const r = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
115
- return e && e.forEach((o) => {
116
- const s = typeof o == "string" ? o : o.scheme;
117
- s && r.push(s);
118
- }), !t || t.replace(N, "").match(
119
- new RegExp(
120
- // eslint-disable-next-line no-useless-escape
121
- `^(?:(?:${r.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
122
- "i"
123
- )
124
- );
14
+ function w(e, t) {
15
+ return (i) => i.reduce((l, a) => a[e] && a[e].length ? (l.push({
16
+ $groupLabel: a[t],
17
+ $isLabel: !0
18
+ }), l.concat(a[e])) : l, []);
125
19
  }
126
- var X = x.create({
127
- name: "link",
128
- priority: 1e3,
129
- keepOnSplit: !1,
130
- exitable: !0,
131
- onCreate() {
132
- this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((t) => {
133
- if (typeof t == "string") {
134
- C(t);
135
- return;
20
+ const E = (...e) => (t) => e.reduce((i, l) => l(i), t);
21
+ var P = {
22
+ data() {
23
+ return {
24
+ search: "",
25
+ isOpen: !1,
26
+ preferredOpenDirection: "below",
27
+ optimizedHeight: this.maxHeight
28
+ };
29
+ },
30
+ props: {
31
+ /**
32
+ * Decide whether to filter the results based on search query.
33
+ * Useful for async filtering, where we search through more complex data.
34
+ * @type {Boolean}
35
+ */
36
+ internalSearch: {
37
+ type: Boolean,
38
+ default: !0
39
+ },
40
+ /**
41
+ * Array of available options: Objects, Strings or Integers.
42
+ * If array of objects, visible label will default to option.label.
43
+ * If `labal` prop is passed, label will equal option['label']
44
+ * @type {Array}
45
+ */
46
+ options: {
47
+ type: Array,
48
+ required: !0
49
+ },
50
+ /**
51
+ * Equivalent to the `multiple` attribute on a `<select>` input.
52
+ * @default false
53
+ * @type {Boolean}
54
+ */
55
+ multiple: {
56
+ type: Boolean,
57
+ default: !1
58
+ },
59
+ /**
60
+ * Key to compare objects
61
+ * @default 'id'
62
+ * @type {String}
63
+ */
64
+ trackBy: {
65
+ type: String
66
+ },
67
+ /**
68
+ * Label to look for in option Object
69
+ * @default 'label'
70
+ * @type {String}
71
+ */
72
+ label: {
73
+ type: String
74
+ },
75
+ /**
76
+ * Enable/disable search in options
77
+ * @default true
78
+ * @type {Boolean}
79
+ */
80
+ searchable: {
81
+ type: Boolean,
82
+ default: !0
83
+ },
84
+ /**
85
+ * Clear the search input after `)
86
+ * @default true
87
+ * @type {Boolean}
88
+ */
89
+ clearOnSelect: {
90
+ type: Boolean,
91
+ default: !0
92
+ },
93
+ /**
94
+ * Hide already selected options
95
+ * @default false
96
+ * @type {Boolean}
97
+ */
98
+ hideSelected: {
99
+ type: Boolean,
100
+ default: !1
101
+ },
102
+ /**
103
+ * Equivalent to the `placeholder` attribute on a `<select>` input.
104
+ * @default 'Select option'
105
+ * @type {String}
106
+ */
107
+ placeholder: {
108
+ type: String,
109
+ default: "Select option"
110
+ },
111
+ /**
112
+ * Allow to remove all selected values
113
+ * @default true
114
+ * @type {Boolean}
115
+ */
116
+ allowEmpty: {
117
+ type: Boolean,
118
+ default: !0
119
+ },
120
+ /**
121
+ * Reset this.internalValue, this.search after this.internalValue changes.
122
+ * Useful if want to create a stateless dropdown.
123
+ * @default false
124
+ * @type {Boolean}
125
+ */
126
+ resetAfter: {
127
+ type: Boolean,
128
+ default: !1
129
+ },
130
+ /**
131
+ * Enable/disable closing after selecting an option
132
+ * @default true
133
+ * @type {Boolean}
134
+ */
135
+ closeOnSelect: {
136
+ type: Boolean,
137
+ default: !0
138
+ },
139
+ /**
140
+ * Function to interpolate the custom label
141
+ * @default false
142
+ * @type {Function}
143
+ */
144
+ customLabel: {
145
+ type: Function,
146
+ default(e, t) {
147
+ return S(e) ? "" : t ? e[t] : e;
136
148
  }
137
- C(t.scheme, t.optionalSlashes);
138
- });
149
+ },
150
+ /**
151
+ * Disable / Enable tagging
152
+ * @default false
153
+ * @type {Boolean}
154
+ */
155
+ taggable: {
156
+ type: Boolean,
157
+ default: !1
158
+ },
159
+ /**
160
+ * String to show when highlighting a potential tag
161
+ * @default 'Press enter to create a tag'
162
+ * @type {String}
163
+ */
164
+ tagPlaceholder: {
165
+ type: String,
166
+ default: "Press enter to create a tag"
167
+ },
168
+ /**
169
+ * By default new tags will appear above the search results.
170
+ * Changing to 'bottom' will revert this behaviour
171
+ * and will proritize the search results
172
+ * @default 'top'
173
+ * @type {String}
174
+ */
175
+ tagPosition: {
176
+ type: String,
177
+ default: "top"
178
+ },
179
+ /**
180
+ * Number of allowed selected options. No limit if 0.
181
+ * @default 0
182
+ * @type {Number}
183
+ */
184
+ max: {
185
+ type: [Number, Boolean],
186
+ default: !1
187
+ },
188
+ /**
189
+ * Will be passed with all events as second param.
190
+ * Useful for identifying events origin.
191
+ * @default null
192
+ * @type {String|Integer}
193
+ */
194
+ id: {
195
+ default: null
196
+ },
197
+ /**
198
+ * Limits the options displayed in the dropdown
199
+ * to the first X options.
200
+ * @default 1000
201
+ * @type {Integer}
202
+ */
203
+ optionsLimit: {
204
+ type: Number,
205
+ default: 1e3
206
+ },
207
+ /**
208
+ * Name of the property containing
209
+ * the group values
210
+ * @default 1000
211
+ * @type {String}
212
+ */
213
+ groupValues: {
214
+ type: String
215
+ },
216
+ /**
217
+ * Name of the property containing
218
+ * the group label
219
+ * @default 1000
220
+ * @type {String}
221
+ */
222
+ groupLabel: {
223
+ type: String
224
+ },
225
+ /**
226
+ * Allow to select all group values
227
+ * by selecting the group label
228
+ * @default false
229
+ * @type {Boolean}
230
+ */
231
+ groupSelect: {
232
+ type: Boolean,
233
+ default: !1
234
+ },
235
+ /**
236
+ * Array of keyboard keys to block
237
+ * when selecting
238
+ * @default 1000
239
+ * @type {String}
240
+ */
241
+ blockKeys: {
242
+ type: Array,
243
+ default() {
244
+ return [];
245
+ }
246
+ },
247
+ /**
248
+ * Prevent from wiping up the search value
249
+ * @default false
250
+ * @type {Boolean}
251
+ */
252
+ preserveSearch: {
253
+ type: Boolean,
254
+ default: !1
255
+ },
256
+ /**
257
+ * Select 1st options if value is empty
258
+ * @default false
259
+ * @type {Boolean}
260
+ */
261
+ preselectFirst: {
262
+ type: Boolean,
263
+ default: !1
264
+ },
265
+ /**
266
+ * Prevent autofocus
267
+ * @default false
268
+ * @type {Boolean}
269
+ */
270
+ preventAutofocus: {
271
+ type: Boolean,
272
+ default: !1
273
+ },
274
+ /**
275
+ * Allows a custom function for sorting search/filtered results.
276
+ * @default null
277
+ * @type {Function}
278
+ */
279
+ filteringSortFunc: {
280
+ type: Function,
281
+ default: null
282
+ }
139
283
  },
140
- onDestroy() {
141
- U();
284
+ mounted() {
285
+ !this.multiple && this.max && console.warn("[Vue-Multiselect warn]: Max prop should not be used when prop Multiple equals false."), this.preselectFirst && !this.internalValue.length && this.options.length && this.select(this.filteredOptions[0]);
142
286
  },
143
- inclusive() {
144
- return this.options.autolink;
287
+ computed: {
288
+ internalValue() {
289
+ return this.modelValue || this.modelValue === 0 ? Array.isArray(this.modelValue) ? this.modelValue : [this.modelValue] : [];
290
+ },
291
+ filteredOptions() {
292
+ const e = this.search || "", t = e.toLowerCase().trim();
293
+ let i = this.options.concat();
294
+ return this.internalSearch ? i = this.groupValues ? this.filterAndFlat(i, t, this.label) : this.filterOptions(i, t, this.label, this.customLabel) : i = this.groupValues ? w(this.groupValues, this.groupLabel)(i) : i, i = this.hideSelected ? i.filter(T(this.isSelected)) : i, this.taggable && t.length && !this.isExistingOption(t) && (this.tagPosition === "bottom" ? i.push({ isTag: !0, label: e }) : i.unshift({ isTag: !0, label: e })), i.slice(0, this.optionsLimit);
295
+ },
296
+ valueKeys() {
297
+ return this.trackBy ? this.internalValue.map((e) => e[this.trackBy]) : this.internalValue;
298
+ },
299
+ optionKeys() {
300
+ return (this.groupValues ? this.flatAndStrip(this.options) : this.options).map((t) => this.customLabel(t, this.label).toString().toLowerCase());
301
+ },
302
+ currentOptionLabel() {
303
+ return this.multiple ? this.searchable ? "" : this.placeholder : this.internalValue.length ? this.getOptionLabel(this.internalValue[0]) : this.searchable ? "" : this.placeholder;
304
+ }
145
305
  },
146
- addOptions() {
147
- return {
148
- openOnClick: !0,
149
- enableClickSelection: !1,
150
- linkOnPaste: !0,
151
- autolink: !0,
152
- protocols: [],
153
- defaultProtocol: "http",
154
- HTMLAttributes: {
155
- target: "_blank",
156
- rel: "noopener noreferrer nofollow",
157
- class: null
306
+ watch: {
307
+ internalValue: {
308
+ handler() {
309
+ this.resetAfter && this.internalValue.length && (this.search = "", this.$emit("update:modelValue", this.multiple ? [] : null));
158
310
  },
159
- isAllowedUri: (t, e) => !!k(t, e.protocols),
160
- validate: (t) => !!t,
161
- shouldAutoLink: (t) => {
162
- const e = /^[a-z][a-z0-9+.-]*:\/\//i.test(t), r = /^[a-z][a-z0-9+.-]*:/i.test(t);
163
- if (e || r && !t.includes("@"))
164
- return !0;
165
- const s = (t.includes("@") ? t.split("@").pop() : t).split(/[/?#:]/)[0];
166
- return !(/^\d{1,3}(\.\d{1,3}){3}$/.test(s) || !/\./.test(s));
167
- }
168
- };
311
+ deep: !0
312
+ },
313
+ search() {
314
+ this.$emit("search-change", this.search);
315
+ }
169
316
  },
170
- addAttributes() {
171
- return {
172
- href: {
173
- default: null,
174
- parseHTML(t) {
175
- return t.getAttribute("href");
317
+ emits: ["open", "search-change", "close", "select", "update:modelValue", "remove", "tag"],
318
+ methods: {
319
+ /**
320
+ * Returns the internalValue in a way it can be emited to the parent
321
+ * @returns {Object||Array||String||Integer}
322
+ */
323
+ getValue() {
324
+ return this.multiple ? this.internalValue : this.internalValue.length === 0 ? null : this.internalValue[0];
325
+ },
326
+ /**
327
+ * Filters and then flattens the options list
328
+ * @param {Array}
329
+ * @return {Array} returns a filtered and flat options list
330
+ */
331
+ filterAndFlat(e, t, i) {
332
+ return E(
333
+ this.filterGroups(t, i, this.groupValues, this.groupLabel, this.customLabel),
334
+ w(this.groupValues, this.groupLabel)
335
+ )(e);
336
+ },
337
+ /**
338
+ * Flattens and then strips the group labels from the options list
339
+ * @param {Array}
340
+ * @return {Array} returns a flat options list without group labels
341
+ */
342
+ flatAndStrip(e) {
343
+ return E(
344
+ w(this.groupValues, this.groupLabel),
345
+ M
346
+ )(e);
347
+ },
348
+ /**
349
+ * Updates the search value
350
+ * @param {String}
351
+ */
352
+ updateSearch(e) {
353
+ this.search = e;
354
+ },
355
+ /**
356
+ * Finds out if the given query is already present
357
+ * in the available options
358
+ * @param {String}
359
+ * @return {Boolean} returns true if element is available
360
+ */
361
+ isExistingOption(e) {
362
+ return this.options ? this.optionKeys.indexOf(e) > -1 : !1;
363
+ },
364
+ /**
365
+ * Finds out if the given element is already present
366
+ * in the result value
367
+ * @param {Object||String||Integer} option passed element to check
368
+ * @returns {Boolean} returns true if element is selected
369
+ */
370
+ isSelected(e) {
371
+ const t = this.trackBy ? e[this.trackBy] : e;
372
+ return this.valueKeys.indexOf(t) > -1;
373
+ },
374
+ /**
375
+ * Finds out if the given option is disabled
376
+ * @param {Object||String||Integer} option passed element to check
377
+ * @returns {Boolean} returns true if element is disabled
378
+ */
379
+ isOptionDisabled(e) {
380
+ return !!e.$isDisabled;
381
+ },
382
+ /**
383
+ * Returns empty string when options is null/undefined
384
+ * Returns tag query if option is tag.
385
+ * Returns the customLabel() results and casts it to string.
386
+ *
387
+ * @param {Object||String||Integer} Passed option
388
+ * @returns {Object||String}
389
+ */
390
+ getOptionLabel(e) {
391
+ if (S(e)) return "";
392
+ if (e.isTag) return e.label;
393
+ if (e.$isLabel) return e.$groupLabel;
394
+ const t = this.customLabel(e, this.label);
395
+ return S(t) ? "" : t;
396
+ },
397
+ /**
398
+ * Add the given option to the list of selected options
399
+ * or sets the option as the selected option.
400
+ * If option is already selected -> remove it from the results.
401
+ *
402
+ * @param {Object||String||Integer} option to select/deselect
403
+ * @param {Boolean} block removing
404
+ */
405
+ select(e, t) {
406
+ if (e.$isLabel && this.groupSelect) {
407
+ this.selectGroup(e);
408
+ return;
409
+ }
410
+ if (!(this.blockKeys.indexOf(t) !== -1 || this.disabled || e.$isDisabled || e.$isLabel) && !(this.max && this.multiple && this.internalValue.length === this.max) && !(t === "Tab" && !this.pointerDirty)) {
411
+ if (e.isTag)
412
+ this.$emit("tag", e.label, this.id), this.search = "", this.closeOnSelect && !this.multiple && this.deactivate();
413
+ else {
414
+ if (this.isSelected(e)) {
415
+ t !== "Tab" && this.removeElement(e);
416
+ return;
417
+ }
418
+ this.multiple ? this.$emit("update:modelValue", this.internalValue.concat([e])) : this.$emit("update:modelValue", e), this.$emit("select", e, this.id), this.clearOnSelect && (this.search = "");
176
419
  }
177
- },
178
- target: {
179
- default: this.options.HTMLAttributes.target
180
- },
181
- rel: {
182
- default: this.options.HTMLAttributes.rel
183
- },
184
- class: {
185
- default: this.options.HTMLAttributes.class
420
+ this.closeOnSelect && this.deactivate();
186
421
  }
187
- };
188
- },
189
- parseHTML() {
190
- return [
191
- {
192
- tag: "a[href]",
193
- getAttrs: (t) => {
194
- const e = t.getAttribute("href");
195
- return !e || !this.options.isAllowedUri(e, {
196
- defaultValidate: (r) => !!k(r, this.options.protocols),
197
- protocols: this.options.protocols,
198
- defaultProtocol: this.options.defaultProtocol
199
- }) ? !1 : null;
422
+ },
423
+ /**
424
+ * Add the given group options to the list of selected options
425
+ * If all group optiona are already selected -> remove it from the results.
426
+ *
427
+ * @param {Object||String||Integer} group to select/deselect
428
+ */
429
+ selectGroup(e) {
430
+ const t = this.options.find((i) => i[this.groupLabel] === e.$groupLabel);
431
+ if (t) {
432
+ if (this.wholeGroupSelected(t)) {
433
+ this.$emit("remove", t[this.groupValues], this.id);
434
+ const i = this.trackBy ? t[this.groupValues].map((a) => a[this.trackBy]) : t[this.groupValues], l = this.internalValue.filter(
435
+ (a) => i.indexOf(this.trackBy ? a[this.trackBy] : a) === -1
436
+ );
437
+ this.$emit("update:modelValue", l);
438
+ } else {
439
+ const i = t[this.groupValues].filter(
440
+ (l) => !(this.isOptionDisabled(l) || this.isSelected(l))
441
+ );
442
+ this.max && i.splice(this.max - this.internalValue.length), this.$emit("select", i, this.id), this.$emit(
443
+ "update:modelValue",
444
+ this.internalValue.concat(i)
445
+ );
200
446
  }
447
+ this.closeOnSelect && this.deactivate();
201
448
  }
202
- ];
449
+ },
450
+ /**
451
+ * Helper to identify if all values in a group are selected
452
+ *
453
+ * @param {Object} group to validated selected values against
454
+ */
455
+ wholeGroupSelected(e) {
456
+ return e[this.groupValues].every(
457
+ (t) => this.isSelected(t) || this.isOptionDisabled(t)
458
+ );
459
+ },
460
+ /**
461
+ * Helper to identify if all values in a group are disabled
462
+ *
463
+ * @param {Object} group to check for disabled values
464
+ */
465
+ wholeGroupDisabled(e) {
466
+ return e[this.groupValues].every(this.isOptionDisabled);
467
+ },
468
+ /**
469
+ * Removes the given option from the selected options.
470
+ * Additionally checks this.allowEmpty prop if option can be removed when
471
+ * it is the last selected option.
472
+ *
473
+ * @param {type} option description
474
+ * @return {type} description
475
+ */
476
+ removeElement(e, t = !0) {
477
+ if (this.disabled || e.$isDisabled) return;
478
+ if (!this.allowEmpty && this.internalValue.length <= 1) {
479
+ this.deactivate();
480
+ return;
481
+ }
482
+ const i = typeof e == "object" ? this.valueKeys.indexOf(e[this.trackBy]) : this.valueKeys.indexOf(e);
483
+ if (this.multiple) {
484
+ const l = this.internalValue.slice(0, i).concat(this.internalValue.slice(i + 1));
485
+ this.$emit("update:modelValue", l);
486
+ } else
487
+ this.$emit("update:modelValue", null);
488
+ this.$emit("remove", e, this.id), this.closeOnSelect && t && this.deactivate();
489
+ },
490
+ /**
491
+ * Calls this.removeElement() with the last element
492
+ * from this.internalValue (selected element Array)
493
+ *
494
+ * @fires this#removeElement
495
+ */
496
+ removeLastElement() {
497
+ this.blockKeys.indexOf("Delete") === -1 && this.search.length === 0 && Array.isArray(this.internalValue) && this.internalValue.length && this.removeElement(this.internalValue[this.internalValue.length - 1], !1);
498
+ },
499
+ /**
500
+ * Opens the multiselect’s dropdown.
501
+ * Sets this.isOpen to TRUE
502
+ */
503
+ activate() {
504
+ this.isOpen || this.disabled || (this.adjustPosition(), this.groupValues && this.pointer === 0 && this.filteredOptions.length && (this.pointer = 1), this.isOpen = !0, this.searchable ? (this.preserveSearch || (this.search = ""), this.preventAutofocus || this.$nextTick(() => this.$refs.search && this.$refs.search.focus())) : this.preventAutofocus || typeof this.$el < "u" && this.$el.focus(), this.$emit("open", this.id));
505
+ },
506
+ /**
507
+ * Closes the multiselect’s dropdown.
508
+ * Sets this.isOpen to FALSE
509
+ */
510
+ deactivate() {
511
+ this.isOpen && (this.isOpen = !1, this.searchable ? this.$refs.search !== null && typeof this.$refs.search < "u" && this.$refs.search.blur() : typeof this.$el < "u" && this.$el.blur(), this.preserveSearch || (this.search = ""), this.$emit("close", this.getValue(), this.id));
512
+ },
513
+ /**
514
+ * Call this.activate() or this.deactivate()
515
+ * depending on this.isOpen value.
516
+ *
517
+ * @fires this#activate || this#deactivate
518
+ * @property {Boolean} isOpen indicates if dropdown is open
519
+ */
520
+ toggle() {
521
+ this.isOpen ? this.deactivate() : this.activate();
522
+ },
523
+ /**
524
+ * Updates the hasEnoughSpace variable used for
525
+ * detecting where to expand the dropdown
526
+ */
527
+ adjustPosition() {
528
+ if (typeof window > "u") return;
529
+ const e = this.$el.getBoundingClientRect().top, t = window.innerHeight - this.$el.getBoundingClientRect().bottom;
530
+ t > this.maxHeight || t > e || this.openDirection === "below" || this.openDirection === "bottom" ? (this.preferredOpenDirection = "below", this.optimizedHeight = Math.min(t - 40, this.maxHeight)) : (this.preferredOpenDirection = "above", this.optimizedHeight = Math.min(e - 40, this.maxHeight));
531
+ },
532
+ /**
533
+ * Filters and sorts the options ready for selection
534
+ * @param {Array} options
535
+ * @param {String} search
536
+ * @param {String} label
537
+ * @param {Function} customLabel
538
+ * @returns {Array}
539
+ */
540
+ filterOptions(e, t, i, l) {
541
+ return t ? e.filter((a) => A(l(a, i), t)).sort((a, n) => typeof this.filteringSortFunc == "function" ? this.filteringSortFunc(a, n) : l(a, i).length - l(n, i).length) : e;
542
+ },
543
+ /**
544
+ *
545
+ * @param {String} search
546
+ * @param {String} label
547
+ * @param {String} values
548
+ * @param {String} groupLabel
549
+ * @param {function} customLabel
550
+ * @returns {function(*): *}
551
+ */
552
+ filterGroups(e, t, i, l, a) {
553
+ return (n) => n.map((s) => {
554
+ if (!s[i])
555
+ return console.warn("Options passed to vue-multiselect do not contain groups, despite the config."), [];
556
+ const h = this.filterOptions(s[i], e, t, a);
557
+ return h.length ? {
558
+ [l]: s[l],
559
+ [i]: h
560
+ } : [];
561
+ });
562
+ }
563
+ }
564
+ }, F = {
565
+ data() {
566
+ return {
567
+ pointer: 0,
568
+ pointerDirty: !1
569
+ };
203
570
  },
204
- renderHTML({ HTMLAttributes: t }) {
205
- return this.options.isAllowedUri(t.href, {
206
- defaultValidate: (e) => !!k(e, this.options.protocols),
207
- protocols: this.options.protocols,
208
- defaultProtocol: this.options.defaultProtocol
209
- }) ? ["a", v(this.options.HTMLAttributes, t), 0] : ["a", v(this.options.HTMLAttributes, { ...t, href: "" }), 0];
571
+ props: {
572
+ /**
573
+ * Enable/disable highlighting of the pointed value.
574
+ * @type {Boolean}
575
+ * @default true
576
+ */
577
+ showPointer: {
578
+ type: Boolean,
579
+ default: !0
580
+ },
581
+ optionHeight: {
582
+ type: Number,
583
+ default: 40
584
+ }
210
585
  },
211
- markdownTokenName: "link",
212
- parseMarkdown: (t, e) => e.applyMark("link", e.parseInline(t.tokens || []), {
213
- href: t.href,
214
- title: t.title || null
215
- }),
216
- renderMarkdown: (t, e) => {
217
- var r;
218
- const o = ((r = t.attrs) == null ? void 0 : r.href) || "";
219
- return `[${e.renderChildren(t)}](${o})`;
586
+ computed: {
587
+ pointerPosition() {
588
+ return this.pointer * this.optionHeight;
589
+ },
590
+ visibleElements() {
591
+ return this.optimizedHeight / this.optionHeight;
592
+ }
220
593
  },
221
- addCommands() {
222
- return {
223
- setLink: (t) => ({ chain: e }) => {
224
- const { href: r } = t;
225
- return this.options.isAllowedUri(r, {
226
- defaultValidate: (o) => !!k(o, this.options.protocols),
227
- protocols: this.options.protocols,
228
- defaultProtocol: this.options.defaultProtocol
229
- }) ? e().setMark(this.name, t).setMeta("preventAutolink", !0).run() : !1;
230
- },
231
- toggleLink: (t) => ({ chain: e }) => {
232
- const { href: r } = t || {};
233
- return r && !this.options.isAllowedUri(r, {
234
- defaultValidate: (o) => !!k(o, this.options.protocols),
235
- protocols: this.options.protocols,
236
- defaultProtocol: this.options.defaultProtocol
237
- }) ? !1 : e().toggleMark(this.name, t, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run();
238
- },
239
- unsetLink: () => ({ chain: t }) => t().unsetMark(this.name, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run()
240
- };
594
+ watch: {
595
+ filteredOptions() {
596
+ this.pointerAdjust();
597
+ },
598
+ isOpen() {
599
+ this.pointerDirty = !1;
600
+ },
601
+ pointer() {
602
+ this.$refs.search && this.$refs.search.setAttribute("aria-activedescendant", this.id + "-" + this.pointer.toString());
603
+ }
241
604
  },
242
- addPasteRules() {
243
- return [
244
- b({
245
- find: (t) => {
246
- const e = [];
247
- if (t) {
248
- const { protocols: r, defaultProtocol: o } = this.options, s = M(t).filter(
249
- (l) => l.isLink && this.options.isAllowedUri(l.value, {
250
- defaultValidate: (d) => !!k(d, r),
251
- protocols: r,
252
- defaultProtocol: o
253
- })
254
- );
255
- s.length && s.forEach((l) => {
256
- this.options.shouldAutoLink(l.value) && e.push({
257
- text: l.value,
258
- data: {
259
- href: l.href
260
- },
261
- index: l.start
262
- });
263
- });
264
- }
265
- return e;
266
- },
267
- type: this.type,
268
- getAttributes: (t) => {
269
- var e;
270
- return {
271
- href: (e = t.data) == null ? void 0 : e.href
272
- };
273
- }
274
- })
275
- ];
605
+ methods: {
606
+ optionHighlight(e, t) {
607
+ return {
608
+ "multiselect__option--highlight": e === this.pointer && this.showPointer,
609
+ "multiselect__option--selected": this.isSelected(t)
610
+ };
611
+ },
612
+ groupHighlight(e, t) {
613
+ if (!this.groupSelect)
614
+ return [
615
+ "multiselect__option--disabled",
616
+ { "multiselect__option--group": t.$isLabel }
617
+ ];
618
+ const i = this.options.find((l) => l[this.groupLabel] === t.$groupLabel);
619
+ return i && !this.wholeGroupDisabled(i) ? [
620
+ "multiselect__option--group",
621
+ { "multiselect__option--highlight": e === this.pointer && this.showPointer },
622
+ { "multiselect__option--group-selected": this.wholeGroupSelected(i) }
623
+ ] : "multiselect__option--disabled";
624
+ },
625
+ addPointerElement({ key: e } = "Enter") {
626
+ this.filteredOptions.length > 0 && this.select(this.filteredOptions[this.pointer], e), this.pointerReset();
627
+ },
628
+ pointerForward() {
629
+ this.pointer < this.filteredOptions.length - 1 && (this.pointer++, this.$refs.list.scrollTop <= this.pointerPosition - (this.visibleElements - 1) * this.optionHeight && (this.$refs.list.scrollTop = this.pointerPosition - (this.visibleElements - 1) * this.optionHeight), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward()), this.pointerDirty = !0;
630
+ },
631
+ pointerBackward() {
632
+ this.pointer > 0 ? (this.pointer--, this.$refs.list.scrollTop >= this.pointerPosition && (this.$refs.list.scrollTop = this.pointerPosition), this.filteredOptions[this.pointer] && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerBackward()) : this.filteredOptions[this.pointer] && this.filteredOptions[0].$isLabel && !this.groupSelect && this.pointerForward(), this.pointerDirty = !0;
633
+ },
634
+ pointerReset() {
635
+ this.closeOnSelect && (this.pointer = 0, this.$refs.list && (this.$refs.list.scrollTop = 0));
636
+ },
637
+ pointerAdjust() {
638
+ this.pointer >= this.filteredOptions.length - 1 && (this.pointer = this.filteredOptions.length ? this.filteredOptions.length - 1 : 0), this.filteredOptions.length > 0 && this.filteredOptions[this.pointer].$isLabel && !this.groupSelect && this.pointerForward();
639
+ },
640
+ pointerSet(e) {
641
+ this.pointer = e, this.pointerDirty = !0;
642
+ }
643
+ }
644
+ }, G = {
645
+ name: "vue-multiselect",
646
+ mixins: [P, F],
647
+ compatConfig: {
648
+ MODE: 3,
649
+ ATTR_ENUMERATED_COERCION: !1
276
650
  },
277
- addProseMirrorPlugins() {
278
- const t = [], { protocols: e, defaultProtocol: r } = this.options;
279
- return this.options.autolink && t.push(
280
- z({
281
- type: this.type,
282
- defaultProtocol: this.options.defaultProtocol,
283
- validate: (o) => this.options.isAllowedUri(o, {
284
- defaultValidate: (s) => !!k(s, e),
285
- protocols: e,
286
- defaultProtocol: r
287
- }),
288
- shouldAutoLink: this.options.shouldAutoLink
289
- })
290
- ), t.push(
291
- V({
292
- type: this.type,
293
- editor: this.editor,
294
- openOnClick: this.options.openOnClick === "whenNotEditable" ? !0 : this.options.openOnClick,
295
- enableClickSelection: this.options.enableClickSelection
296
- })
297
- ), this.options.linkOnPaste && t.push(
298
- D({
299
- editor: this.editor,
300
- defaultProtocol: this.options.defaultProtocol,
301
- type: this.type,
302
- shouldAutoLink: this.options.shouldAutoLink
303
- })
304
- ), t;
651
+ props: {
652
+ /**
653
+ * name attribute to match optional label element
654
+ * @default ''
655
+ * @type {String}
656
+ */
657
+ name: {
658
+ type: String,
659
+ default: ""
660
+ },
661
+ /**
662
+ * Presets the selected options value.
663
+ * @type {Object||Array||String||Integer}
664
+ */
665
+ modelValue: {
666
+ type: null,
667
+ default() {
668
+ return [];
669
+ }
670
+ },
671
+ /**
672
+ * String to show when pointing to an option
673
+ * @default 'Press enter to select'
674
+ * @type {String}
675
+ */
676
+ selectLabel: {
677
+ type: String,
678
+ default: "Press enter to select"
679
+ },
680
+ /**
681
+ * String to show when pointing to an option
682
+ * @default 'Press enter to select'
683
+ * @type {String}
684
+ */
685
+ selectGroupLabel: {
686
+ type: String,
687
+ default: "Press enter to select group"
688
+ },
689
+ /**
690
+ * String to show next to selected option
691
+ * @default 'Selected'
692
+ * @type {String}
693
+ */
694
+ selectedLabel: {
695
+ type: String,
696
+ default: "Selected"
697
+ },
698
+ /**
699
+ * String to show when pointing to an already selected option
700
+ * @default 'Press enter to remove'
701
+ * @type {String}
702
+ */
703
+ deselectLabel: {
704
+ type: String,
705
+ default: "Press enter to remove"
706
+ },
707
+ /**
708
+ * String to show when pointing to an already selected option
709
+ * @default 'Press enter to remove'
710
+ * @type {String}
711
+ */
712
+ deselectGroupLabel: {
713
+ type: String,
714
+ default: "Press enter to deselect group"
715
+ },
716
+ /**
717
+ * Decide whether to show pointer labels
718
+ * @default true
719
+ * @type {Boolean}
720
+ */
721
+ showLabels: {
722
+ type: Boolean,
723
+ default: !0
724
+ },
725
+ /**
726
+ * Limit the display of selected options. The rest will be hidden within the limitText string.
727
+ * @default 99999
728
+ * @type {Integer}
729
+ */
730
+ limit: {
731
+ type: Number,
732
+ default: 99999
733
+ },
734
+ /**
735
+ * Sets maxHeight style value of the dropdown
736
+ * @default 300
737
+ * @type {Integer}
738
+ */
739
+ maxHeight: {
740
+ type: Number,
741
+ default: 300
742
+ },
743
+ /**
744
+ * Function that process the message shown when selected
745
+ * elements pass the defined limit.
746
+ * @default 'and * more'
747
+ * @param {Int} count Number of elements more than limit
748
+ * @type {Function}
749
+ */
750
+ limitText: {
751
+ type: Function,
752
+ default: (e) => `and ${e} more`
753
+ },
754
+ /**
755
+ * Set true to trigger the loading spinner.
756
+ * @default False
757
+ * @type {Boolean}
758
+ */
759
+ loading: {
760
+ type: Boolean,
761
+ default: !1
762
+ },
763
+ /**
764
+ * Disables the multiselect if true.
765
+ * @default false
766
+ * @type {Boolean}
767
+ */
768
+ disabled: {
769
+ type: Boolean,
770
+ default: !1
771
+ },
772
+ /**
773
+ * Enables search input's spellcheck if true.
774
+ * @default false
775
+ * @type {Boolean}
776
+ */
777
+ spellcheck: {
778
+ type: Boolean,
779
+ default: !1
780
+ },
781
+ /**
782
+ * Fixed opening direction
783
+ * @default ''
784
+ * @type {String}
785
+ */
786
+ openDirection: {
787
+ type: String,
788
+ default: ""
789
+ },
790
+ /**
791
+ * Shows slot with message about empty options
792
+ * @default true
793
+ * @type {Boolean}
794
+ */
795
+ showNoOptions: {
796
+ type: Boolean,
797
+ default: !0
798
+ },
799
+ showNoResults: {
800
+ type: Boolean,
801
+ default: !0
802
+ },
803
+ tabindex: {
804
+ type: Number,
805
+ default: 0
806
+ },
807
+ /**
808
+ * Adds Required attribute to the input element when there is no value selected
809
+ * @default false
810
+ * @type {Boolean}
811
+ */
812
+ required: {
813
+ type: Boolean,
814
+ default: !1
815
+ }
816
+ },
817
+ computed: {
818
+ hasOptionGroup() {
819
+ return this.groupValues && this.groupLabel && this.groupSelect;
820
+ },
821
+ isSingleLabelVisible() {
822
+ return (this.singleValue || this.singleValue === 0) && (!this.isOpen || !this.searchable) && !this.visibleValues.length;
823
+ },
824
+ isPlaceholderVisible() {
825
+ return !this.internalValue.length && (!this.searchable || !this.isOpen);
826
+ },
827
+ visibleValues() {
828
+ return this.multiple ? this.internalValue.slice(0, this.limit) : [];
829
+ },
830
+ singleValue() {
831
+ return this.internalValue[0];
832
+ },
833
+ deselectLabelText() {
834
+ return this.showLabels ? this.deselectLabel : "";
835
+ },
836
+ deselectGroupLabelText() {
837
+ return this.showLabels ? this.deselectGroupLabel : "";
838
+ },
839
+ selectLabelText() {
840
+ return this.showLabels ? this.selectLabel : "";
841
+ },
842
+ selectGroupLabelText() {
843
+ return this.showLabels ? this.selectGroupLabel : "";
844
+ },
845
+ selectedLabelText() {
846
+ return this.showLabels ? this.selectedLabel : "";
847
+ },
848
+ inputStyle() {
849
+ return this.searchable || this.multiple && this.modelValue && this.modelValue.length ? this.isOpen ? { width: "100%" } : { width: "0", position: "absolute", padding: "0" } : "";
850
+ },
851
+ contentStyle() {
852
+ return this.options.length ? { display: "inline-block" } : { display: "block" };
853
+ },
854
+ isAbove() {
855
+ return this.openDirection === "above" || this.openDirection === "top" ? !0 : this.openDirection === "below" || this.openDirection === "bottom" ? !1 : this.preferredOpenDirection === "above";
856
+ },
857
+ showSearchInput() {
858
+ return this.searchable && (this.hasSingleSelectedSlot && (this.visibleSingleValue || this.visibleSingleValue === 0) ? this.isOpen : !0);
859
+ },
860
+ isRequired() {
861
+ return this.required === !1 ? !1 : this.internalValue.length <= 0;
862
+ }
305
863
  }
306
- });
864
+ };
865
+ const H = ["tabindex", "aria-expanded", "aria-owns", "aria-activedescendant"], C = {
866
+ ref: "tags",
867
+ class: "multiselect__tags"
868
+ }, K = { class: "multiselect__tags-wrap" }, N = ["textContent"], R = ["onKeypress", "onMousedown"], q = ["textContent"], z = { class: "multiselect__spinner" }, j = ["name", "id", "spellcheck", "placeholder", "required", "value", "disabled", "tabindex", "aria-label", "aria-controls"], I = ["id", "aria-multiselectable"], U = { key: 0 }, J = { class: "multiselect__option" }, Q = ["aria-selected", "id", "role"], W = ["onClick", "onMouseenter", "data-select", "data-selected", "data-deselect"], X = ["data-select", "data-deselect", "onMouseenter", "onMousedown"], Y = { class: "multiselect__option" }, Z = { class: "multiselect__option" };
869
+ function x(e, t, i, l, a, n) {
870
+ return p(), d("div", {
871
+ tabindex: e.searchable ? -1 : i.tabindex,
872
+ class: V([{ "multiselect--active": e.isOpen, "multiselect--disabled": i.disabled, "multiselect--above": n.isAbove, "multiselect--has-options-group": n.hasOptionGroup }, "multiselect"]),
873
+ onFocus: t[14] || (t[14] = (s) => e.activate()),
874
+ onBlur: t[15] || (t[15] = (s) => e.searchable ? !1 : e.deactivate()),
875
+ onKeydown: [
876
+ t[16] || (t[16] = f(r((s) => e.pointerForward(), ["self", "prevent"]), ["down"])),
877
+ t[17] || (t[17] = f(r((s) => e.pointerBackward(), ["self", "prevent"]), ["up"]))
878
+ ],
879
+ onKeypress: t[18] || (t[18] = f(r((s) => e.addPointerElement(s), ["stop", "self"]), ["enter", "tab"])),
880
+ onKeyup: t[19] || (t[19] = f((s) => e.deactivate(), ["esc"])),
881
+ role: "combobox",
882
+ "aria-expanded": e.isOpen,
883
+ "aria-owns": "listbox-" + e.id,
884
+ "aria-activedescendant": e.isOpen && e.pointer !== null ? e.id + "-" + e.pointer : null
885
+ }, [
886
+ u(e.$slots, "caret", { toggle: e.toggle }, () => [
887
+ o(
888
+ "div",
889
+ {
890
+ onMousedown: t[0] || (t[0] = r((s) => e.toggle(), ["prevent", "stop"])),
891
+ class: "multiselect__select"
892
+ },
893
+ null,
894
+ 32
895
+ /* NEED_HYDRATION */
896
+ )
897
+ ]),
898
+ u(e.$slots, "clear", { search: e.search }),
899
+ o(
900
+ "div",
901
+ C,
902
+ [
903
+ u(e.$slots, "selection", {
904
+ search: e.search,
905
+ remove: e.removeElement,
906
+ values: n.visibleValues,
907
+ isOpen: e.isOpen
908
+ }, () => [
909
+ b(o(
910
+ "div",
911
+ K,
912
+ [
913
+ (p(!0), d(
914
+ $,
915
+ null,
916
+ B(n.visibleValues, (s, h) => u(e.$slots, "tag", {
917
+ option: s,
918
+ search: e.search,
919
+ remove: e.removeElement
920
+ }, () => [
921
+ (p(), d(
922
+ "span",
923
+ {
924
+ class: "multiselect__tag",
925
+ key: h,
926
+ onMousedown: t[1] || (t[1] = r(() => {
927
+ }, ["prevent"]))
928
+ },
929
+ [
930
+ o("span", {
931
+ textContent: g(e.getOptionLabel(s))
932
+ }, null, 8, N),
933
+ o("i", {
934
+ tabindex: "1",
935
+ onKeypress: f(r((m) => e.removeElement(s), ["prevent"]), ["enter"]),
936
+ onMousedown: r((m) => e.removeElement(s), ["prevent"]),
937
+ class: "multiselect__tag-icon"
938
+ }, null, 40, R)
939
+ ],
940
+ 32
941
+ /* NEED_HYDRATION */
942
+ ))
943
+ ])),
944
+ 256
945
+ /* UNKEYED_FRAGMENT */
946
+ ))
947
+ ],
948
+ 512
949
+ /* NEED_PATCH */
950
+ ), [
951
+ [y, n.visibleValues.length > 0]
952
+ ]),
953
+ e.internalValue && e.internalValue.length > i.limit ? u(e.$slots, "limit", { key: 0 }, () => [
954
+ o("strong", {
955
+ class: "multiselect__strong",
956
+ textContent: g(i.limitText(e.internalValue.length - i.limit))
957
+ }, null, 8, q)
958
+ ]) : c("v-if", !0)
959
+ ]),
960
+ L(k, { name: "multiselect__loading" }, {
961
+ default: D(() => [
962
+ u(e.$slots, "loading", {}, () => [
963
+ b(o(
964
+ "div",
965
+ z,
966
+ null,
967
+ 512
968
+ /* NEED_PATCH */
969
+ ), [
970
+ [y, i.loading]
971
+ ])
972
+ ])
973
+ ]),
974
+ _: 3
975
+ /* FORWARDED */
976
+ }),
977
+ e.searchable ? (p(), d("input", {
978
+ key: 0,
979
+ ref: "search",
980
+ name: i.name,
981
+ id: e.id,
982
+ type: "text",
983
+ autocomplete: "off",
984
+ spellcheck: i.spellcheck,
985
+ placeholder: e.placeholder,
986
+ required: n.isRequired,
987
+ style: O(n.inputStyle),
988
+ value: e.search,
989
+ disabled: i.disabled,
990
+ tabindex: i.tabindex,
991
+ "aria-label": i.name + "-searchbox",
992
+ onInput: t[2] || (t[2] = (s) => e.updateSearch(s.target.value)),
993
+ onFocus: t[3] || (t[3] = r((s) => e.activate(), ["prevent"])),
994
+ onBlur: t[4] || (t[4] = r((s) => e.deactivate(), ["prevent"])),
995
+ onKeyup: t[5] || (t[5] = f((s) => e.deactivate(), ["esc"])),
996
+ onKeydown: [
997
+ t[6] || (t[6] = f(r((s) => e.pointerForward(), ["prevent"]), ["down"])),
998
+ t[7] || (t[7] = f(r((s) => e.pointerBackward(), ["prevent"]), ["up"])),
999
+ t[9] || (t[9] = f(r((s) => e.removeLastElement(), ["stop"]), ["delete"]))
1000
+ ],
1001
+ onKeypress: t[8] || (t[8] = f(r((s) => e.addPointerElement(s), ["prevent", "stop", "self"]), ["enter"])),
1002
+ class: "multiselect__input",
1003
+ "aria-controls": "listbox-" + e.id
1004
+ }, null, 44, j)) : c("v-if", !0),
1005
+ n.isSingleLabelVisible ? (p(), d(
1006
+ "span",
1007
+ {
1008
+ key: 1,
1009
+ class: "multiselect__single",
1010
+ onMousedown: t[10] || (t[10] = r((...s) => e.toggle && e.toggle(...s), ["prevent"]))
1011
+ },
1012
+ [
1013
+ u(e.$slots, "singleLabel", { option: n.singleValue }, () => [
1014
+ v(
1015
+ g(e.currentOptionLabel),
1016
+ 1
1017
+ /* TEXT */
1018
+ )
1019
+ ])
1020
+ ],
1021
+ 32
1022
+ /* NEED_HYDRATION */
1023
+ )) : c("v-if", !0),
1024
+ n.isPlaceholderVisible ? (p(), d(
1025
+ "span",
1026
+ {
1027
+ key: 2,
1028
+ class: "multiselect__placeholder",
1029
+ onMousedown: t[11] || (t[11] = r((...s) => e.toggle && e.toggle(...s), ["prevent"]))
1030
+ },
1031
+ [
1032
+ u(e.$slots, "placeholder", {}, () => [
1033
+ v(
1034
+ g(e.placeholder),
1035
+ 1
1036
+ /* TEXT */
1037
+ )
1038
+ ])
1039
+ ],
1040
+ 32
1041
+ /* NEED_HYDRATION */
1042
+ )) : c("v-if", !0)
1043
+ ],
1044
+ 512
1045
+ /* NEED_PATCH */
1046
+ ),
1047
+ L(k, {
1048
+ name: "multiselect",
1049
+ persisted: ""
1050
+ }, {
1051
+ default: D(() => [
1052
+ b(o(
1053
+ "div",
1054
+ {
1055
+ class: "multiselect__content-wrapper",
1056
+ onFocus: t[12] || (t[12] = (...s) => e.activate && e.activate(...s)),
1057
+ tabindex: "-1",
1058
+ onMousedown: t[13] || (t[13] = r(() => {
1059
+ }, ["prevent"])),
1060
+ style: O({ maxHeight: e.optimizedHeight + "px" }),
1061
+ ref: "list"
1062
+ },
1063
+ [
1064
+ o("ul", {
1065
+ class: "multiselect__content",
1066
+ style: O(n.contentStyle),
1067
+ role: "listbox",
1068
+ id: "listbox-" + e.id,
1069
+ "aria-multiselectable": e.multiple
1070
+ }, [
1071
+ u(e.$slots, "beforeList"),
1072
+ e.multiple && e.max === e.internalValue.length ? (p(), d("li", U, [
1073
+ o("span", J, [
1074
+ u(e.$slots, "maxElements", {}, () => [
1075
+ v(
1076
+ "Maximum of " + g(e.max) + " options selected. First remove a selected option to select another.",
1077
+ 1
1078
+ /* TEXT */
1079
+ )
1080
+ ])
1081
+ ])
1082
+ ])) : c("v-if", !0),
1083
+ !e.max || e.internalValue.length < e.max ? (p(!0), d(
1084
+ $,
1085
+ { key: 1 },
1086
+ B(e.filteredOptions, (s, h) => (p(), d("li", {
1087
+ class: "multiselect__element",
1088
+ key: h,
1089
+ "aria-selected": e.isSelected(s),
1090
+ id: e.id + "-" + h,
1091
+ role: s && (s.$isLabel || s.$isDisabled) ? null : "option"
1092
+ }, [
1093
+ s && (s.$isLabel || s.$isDisabled) ? c("v-if", !0) : (p(), d("span", {
1094
+ key: 0,
1095
+ class: V([e.optionHighlight(h, s), "multiselect__option"]),
1096
+ onClick: r((m) => e.select(s), ["stop"]),
1097
+ onMouseenter: r((m) => e.pointerSet(h), ["self"]),
1098
+ "data-select": s && s.isTag ? e.tagPlaceholder : n.selectLabelText,
1099
+ "data-selected": n.selectedLabelText,
1100
+ "data-deselect": n.deselectLabelText
1101
+ }, [
1102
+ u(e.$slots, "option", {
1103
+ option: s,
1104
+ search: e.search,
1105
+ index: h
1106
+ }, () => [
1107
+ o(
1108
+ "span",
1109
+ null,
1110
+ g(e.getOptionLabel(s)),
1111
+ 1
1112
+ /* TEXT */
1113
+ )
1114
+ ])
1115
+ ], 42, W)),
1116
+ s && (s.$isLabel || s.$isDisabled) ? (p(), d("span", {
1117
+ key: 1,
1118
+ "data-select": e.groupSelect && n.selectGroupLabelText,
1119
+ "data-deselect": e.groupSelect && n.deselectGroupLabelText,
1120
+ class: V([e.groupHighlight(h, s), "multiselect__option"]),
1121
+ onMouseenter: r((m) => e.groupSelect && e.pointerSet(h), ["self"]),
1122
+ onMousedown: r((m) => e.selectGroup(s), ["prevent"])
1123
+ }, [
1124
+ u(e.$slots, "option", {
1125
+ option: s,
1126
+ search: e.search,
1127
+ index: h
1128
+ }, () => [
1129
+ o(
1130
+ "span",
1131
+ null,
1132
+ g(e.getOptionLabel(s)),
1133
+ 1
1134
+ /* TEXT */
1135
+ )
1136
+ ])
1137
+ ], 42, X)) : c("v-if", !0)
1138
+ ], 8, Q))),
1139
+ 128
1140
+ /* KEYED_FRAGMENT */
1141
+ )) : c("v-if", !0),
1142
+ b(o(
1143
+ "li",
1144
+ null,
1145
+ [
1146
+ o("span", Y, [
1147
+ u(e.$slots, "noResult", { search: e.search }, () => [
1148
+ t[20] || (t[20] = v("No elements found. Consider changing the search query."))
1149
+ ])
1150
+ ])
1151
+ ],
1152
+ 512
1153
+ /* NEED_PATCH */
1154
+ ), [
1155
+ [y, i.showNoResults && e.filteredOptions.length === 0 && e.search && !i.loading]
1156
+ ]),
1157
+ b(o(
1158
+ "li",
1159
+ null,
1160
+ [
1161
+ o("span", Z, [
1162
+ u(e.$slots, "noOptions", {}, () => [
1163
+ t[21] || (t[21] = v("List is empty."))
1164
+ ])
1165
+ ])
1166
+ ],
1167
+ 512
1168
+ /* NEED_PATCH */
1169
+ ), [
1170
+ [y, i.showNoOptions && (e.options.length === 0 || n.hasOptionGroup === !0 && e.filteredOptions.length === 0) && !e.search && !i.loading]
1171
+ ]),
1172
+ u(e.$slots, "afterList")
1173
+ ], 12, I)
1174
+ ],
1175
+ 36
1176
+ /* STYLE, NEED_HYDRATION */
1177
+ ), [
1178
+ [y, e.isOpen]
1179
+ ])
1180
+ ]),
1181
+ _: 3
1182
+ /* FORWARDED */
1183
+ })
1184
+ ], 42, H);
1185
+ }
1186
+ G.render = x;
307
1187
  export {
308
- X as Link,
309
- k as isAllowedUri
1188
+ G as Multiselect,
1189
+ G as default,
1190
+ P as multiselectMixin,
1191
+ F as pointerMixin
310
1192
  };