gamutable/js/vue-next-select.js

1601 lines
42 KiB
JavaScript

this.VueNextSelect = (function (e) {
'use strict';
function t(e) {
return (t =
'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator
? function (e) {
return typeof e;
}
: function (e) {
return e && 'function' == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype
? 'symbol'
: typeof e;
})(e);
}
function n(e) {
return (
(function (e) {
if (Array.isArray(e)) return a(e);
})(e) ||
(function (e) {
if (('undefined' != typeof Symbol && null != e[Symbol.iterator]) || null != e['@@iterator'])
return Array.from(e);
})(e) ||
o(e) ||
(function () {
throw new TypeError(
'Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
);
})()
);
}
function o(e, t) {
if (e) {
if ('string' == typeof e) return a(e, t);
var n = Object.prototype.toString.call(e).slice(8, -1);
return (
'Object' === n && e.constructor && (n = e.constructor.name),
'Map' === n || 'Set' === n
? Array.from(e)
: 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)
? a(e, t)
: void 0
);
}
}
function a(e, t) {
(null == t || t > e.length) && (t = e.length);
for (var n = 0, o = new Array(t); n < t; n++) o[n] = e[n];
return o;
}
function l(e, t) {
var n = ('undefined' != typeof Symbol && e[Symbol.iterator]) || e['@@iterator'];
if (!n) {
if (Array.isArray(e) || (n = o(e)) || (t && e && 'number' == typeof e.length)) {
n && (e = n);
var a = 0,
l = function () {};
return {
s: l,
n: function () {
return a >= e.length ? { done: !0 } : { done: !1, value: e[a++] };
},
e: function (e) {
throw e;
},
f: l,
};
}
throw new TypeError(
'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
);
}
var r,
u = !0,
i = !1;
return {
s: function () {
n = n.call(e);
},
n: function () {
var e = n.next();
return (u = e.done), e;
},
e: function (e) {
(i = !0), (r = e);
},
f: function () {
try {
u || null == n.return || n.return();
} finally {
if (i) throw r;
}
},
};
}
var r = {
inheritAttrs: !1,
name: 'vue-input',
props: {
autocomplete: { required: !1, type: String },
modelValue: { required: !0, type: String },
placeholder: { required: !0, type: String },
disabled: { required: !0, type: Boolean },
tabindex: { required: !0, type: Number },
autofocus: { required: !0, type: Boolean },
comboboxUid: { required: !0, type: Number },
},
emits: ['update:modelValue', 'input', 'change', 'focus', 'blur', 'escape'],
setup: function (t, n) {
var o = e.ref(null);
return (
e.onMounted(function () {
t.autofocus && o.value.focus();
}),
e.onUpdated(function () {
t.autofocus && o.value.focus();
}),
{
handleInput: function (e) {
n.emit('input', e), n.emit('update:modelValue', e.target.value);
},
handleChange: function (e) {
n.emit('change', e), n.emit('update:modelValue', e.target.value);
},
handleFocus: function (e) {
n.emit('focus', e);
},
handleBlur: function (e) {
n.emit('blur', e);
},
input: o,
handleEscape: function (e) {
o.value.blur(), n.emit('escape', e);
},
}
);
},
},
u = { class: 'vue-input' },
i = [
'autocomplete',
'modelValue',
'placeholder',
'disabled',
'tabindex',
'autofocus',
'aria-controls',
'aria-labelledby',
];
(r.render = function (t, n, o, a, l, r) {
return (
e.openBlock(),
e.createElementBlock('div', u, [
e.renderSlot(t.$slots, 'prepend'),
e.createElementVNode(
'input',
{
ref: 'input',
autocomplete: o.autocomplete,
modelValue: o.modelValue,
placeholder: o.placeholder,
disabled: o.disabled,
onInput:
n[0] ||
(n[0] = function () {
return a.handleInput && a.handleInput.apply(a, arguments);
}),
onChange:
n[1] ||
(n[1] = function () {
return a.handleChange && a.handleChange.apply(a, arguments);
}),
onFocus:
n[2] ||
(n[2] = function () {
return a.handleFocus && a.handleFocus.apply(a, arguments);
}),
onBlur:
n[3] ||
(n[3] = function () {
return a.handleBlur && a.handleBlur.apply(a, arguments);
}),
onKeyup:
n[4] ||
(n[4] = e.withKeys(
e.withModifiers(
function () {
return a.handleEscape && a.handleEscape.apply(a, arguments);
},
['exact']
),
['esc']
)),
tabindex: o.tabindex,
autofocus: o.autofocus,
'aria-autocomplete': 'list',
'aria-controls': 'vs'.concat(o.comboboxUid, '-listbox'),
'aria-labelledby': 'vs'.concat(o.comboboxUid, '-combobox'),
},
null,
40,
i
),
e.renderSlot(t.$slots, 'append'),
])
);
}),
(r.__file = 'src/components/input.vue');
var c = {
inheritAttrs: !1,
name: 'vue-tags',
props: {
modelValue: {
required: !0,
type: Array,
validator: function (e) {
return e.every(function (e) {
return void 0 !== t(e.key) && void 0 !== e.label && 'boolean' == typeof e.selected;
});
},
},
collapseTags: { type: Boolean },
},
emits: ['click'],
setup: function (t, n) {
return {
dataAttrs: e.inject('dataAttrs'),
handleClick: function (e) {
n.emit('click', e);
},
};
},
};
(c.render = function (t, n, o, a, l, r) {
return (
e.openBlock(),
e.createElementBlock(
'ul',
e.mergeProps(
{
class: ['vue-tags', { collapsed: o.collapseTags }],
onMousedown: n[0] || (n[0] = e.withModifiers(function () {}, ['prevent'])),
tabindex: '-1',
onClick:
n[1] ||
(n[1] = function () {
return a.handleClick && a.handleClick.apply(a, arguments);
}),
},
a.dataAttrs
),
[
(e.openBlock(!0),
e.createElementBlock(
e.Fragment,
null,
e.renderList(o.modelValue, function (n) {
return (
e.openBlock(),
e.createElementBlock(
e.Fragment,
{ key: n.key },
[
n.group
? e.createCommentVNode('v-if', !0)
: (e.openBlock(),
e.createElementBlock(
'li',
{
key: 0,
class: e.normalizeClass(['vue-tag', { selected: n.selected }]),
},
[
e.renderSlot(t.$slots, 'default', { option: n }, function () {
return [
e.createElementVNode(
'span',
null,
e.toDisplayString(n.label),
1
),
];
}),
],
2
)),
],
64
)
);
}),
128
)),
],
16
)
);
}),
(c.__file = 'src/components/tags.vue');
var d = {
inheritAttrs: !1,
name: 'vue-dropdown',
props: {
modelValue: {
required: !0,
type: Array,
validator: function (e) {
return e.every(function (e) {
return void 0 !== t(e.key) && void 0 !== e.label && 'boolean' == typeof e.selected;
});
},
},
comboboxUid: { required: !0, type: Number },
maxHeight: { required: !0 },
highlightedOriginalIndex: { required: !0 },
},
emits: ['click-item', 'mouseenter'],
setup: function (t, n) {
return {
dataAttrs: e.inject('dataAttrs'),
handleClickItem: function (e, t) {
t.disabled || n.emit('click-item', e, t);
},
handleMouseenter: function (e, t) {
n.emit('mouseenter', e, t);
},
};
},
},
s = ['id', 'aria-multiselectable', 'aria-busy', 'aria-disabled'],
p = ['onClick', 'onMouseenter', 'id', 'aria-selected', 'aria-disabled'];
(d.render = function (t, n, o, a, l, r) {
return (
e.openBlock(),
e.createElementBlock(
'ul',
e.mergeProps(
{
class: 'vue-dropdown',
style: { maxHeight: o.maxHeight + 'px' },
onMousedown: n[0] || (n[0] = e.withModifiers(function () {}, ['prevent'])),
},
a.dataAttrs,
{
role: 'listbox',
id: 'vs'.concat(o.comboboxUid, '-listbox'),
'aria-multiselectable': a.dataAttrs['data-multiple'],
'aria-busy': a.dataAttrs['data-loading'],
'aria-disabled': a.dataAttrs['data-disabled'],
}
),
[
(e.openBlock(!0),
e.createElementBlock(
e.Fragment,
null,
e.renderList(o.modelValue, function (n, l) {
return (
e.openBlock(),
e.createElementBlock(
e.Fragment,
{ key: n.key },
[
n.visible && !1 === n.hidden
? (e.openBlock(),
e.createElementBlock(
'li',
{
key: 0,
onClick: function (e) {
return a.handleClickItem(e, n);
},
class: e.normalizeClass([
'vue-dropdown-item',
{
selected: n.selected,
disabled: n.disabled,
highlighted:
n.originalIndex === o.highlightedOriginalIndex,
group: n.group,
},
]),
onMouseenter: function (e) {
return a.handleMouseenter(e, n);
},
role: 'option',
id: 'vs'.concat(o.comboboxUid, '-option-').concat(l),
'aria-selected': !!n.selected || (!!n.disabled && void 0),
'aria-disabled': n.disabled,
},
[
e.renderSlot(t.$slots, 'default', { option: n }, function () {
return [
e.createElementVNode(
'span',
null,
e.toDisplayString(n.label),
1
),
];
}),
],
42,
p
))
: e.createCommentVNode('v-if', !0),
],
64
)
);
}),
128
)),
],
16,
s
)
);
}),
(d.__file = 'src/components/dropdown.vue');
var v = function (e, t, n) {
var o = n.valueBy;
return o(e) === o(t);
},
f = function (e, t, n) {
var o = n.valueBy;
return e.some(function (e) {
return v(e, t, { valueBy: o });
});
},
m = function (e, t, n) {
var o = n.valueBy;
return e.find(function (e) {
return o(e) === t;
});
},
g = function (e, t, n) {
var o = n.max,
a = n.valueBy;
return f(e, t, { valueBy: a }) || e.length >= o ? e : e.concat(t);
},
h = function (e, t, n) {
var o = n.min,
a = n.valueBy;
return !1 === f(e, t, { valueBy: a }) || e.length <= o
? e
: e.filter(function (e) {
return !1 === v(e, t, { valueBy: a });
});
},
y = function (t) {
return e.computed(function () {
return 'function' == typeof t.value
? t.value
: 'string' == typeof t.value
? function (e) {
return t.value.split('.').reduce(function (e, t) {
return e[t];
}, e);
}
: function (e) {
return e;
};
});
},
b = function (t, n) {
var o = e.computed(function () {
return t.value.reduce(function (e, t) {
return Object.assign(
e,
((n = {}),
(o = t.originalIndex),
(a = t),
o in n
? Object.defineProperty(n, o, {
value: a,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (n[o] = a),
n)
);
var n, o, a;
}, {});
}),
a = function (e) {
var t = o.value[e];
return void 0 !== t && !1 !== r(t) && ((n.value = e), !0);
},
r = function (e) {
return !e.disabled && !e.hidden && e.visible;
},
u = e.computed(function () {
return t.value.some(function (e) {
return r(e);
});
});
return (
e.watchEffect(function () {
if ((!1 === u.value && (n.value = null), null !== n.value && t.value.length <= n.value)) {
var e,
o = l(t.value.reverse());
try {
for (o.s(); !(e = o.n()).done; ) {
var i = e.value;
if (a(i.originalIndex)) break;
}
} catch (e) {
o.e(e);
} finally {
o.f();
}
}
if (null === n.value || !1 === r(t.value[n.value])) {
var c,
d = l(t.value);
try {
for (d.s(); !(c = d.n()).done; ) {
var s = c.value;
if (a(s.originalIndex)) break;
}
} catch (e) {
d.e(e);
} finally {
d.f();
}
}
}),
{
pointerForward: function () {
if (!1 !== u.value && null !== n.value)
for (
var e = n.value + 1, o = 0;
e !== n.value && o++ < t.value.length && (t.value.length <= e && (e = 0), !a(e));
)
++e;
},
pointerBackward: function () {
if (!1 !== u.value && null !== n.value)
for (
var e = n.value - 1, o = 0;
e !== n.value && o++ < t.value.length && (e < 0 && (e = t.value.length - 1), !a(e));
)
--e;
},
pointerSet: a,
}
);
};
var B = e.defineComponent({
name: 'vue-select',
inheritAttrs: !1,
props: {
modelValue: { required: !0 },
emptyModelValue: {},
options: { required: !0, type: Array },
labelBy: { type: [String, Function] },
valueBy: { type: [String, Function] },
disabledBy: { default: 'disabled', type: [String, Function] },
groupBy: { default: 'group', type: [String, Function] },
visibleOptions: { type: Array, default: null },
multiple: { default: !1, type: Boolean },
min: { default: 0, type: Number },
max: { default: 1 / 0, type: Number },
searchable: { default: !1, type: Boolean },
searchPlaceholder: { default: 'Type to search', type: String },
clearOnSelect: { default: !1, type: Boolean },
clearOnClose: { default: !1, type: Boolean },
taggable: { default: !1, type: Boolean },
collapseTags: { default: !1, type: Boolean },
autocomplete: { default: 'off', type: String },
disabled: { default: !1, type: Boolean },
loading: { default: !1, type: Boolean },
closeOnSelect: { default: !1, type: Boolean },
hideSelected: { default: !1, type: Boolean },
placeholder: { default: 'Select option', type: String },
tabindex: { default: 0, type: Number },
autofocus: { default: !1, type: Boolean },
maxHeight: { default: 300, type: Number },
openDirection: {
type: String,
validator: function (e) {
return ['top', 'bottom'].includes(e);
},
},
},
emits: [
'selected',
'removed',
'update:modelValue',
'focus',
'blur',
'toggle',
'opened',
'closed',
'search:input',
'search:change',
'search:focus',
'search:blur',
],
setup: function (t, o) {
var a = (function (t) {
var n = e.reactive({}),
o = y(e.toRef(t, 'labelBy'));
e.watchEffect(function () {
return (n.labelBy = o.value);
});
var a = y(e.toRef(t, 'valueBy'));
e.watchEffect(function () {
return (n.valueBy = a.value);
});
var l = y(e.toRef(t, 'disabledBy'));
e.watchEffect(function () {
return (n.disabledBy = l.value);
});
var r = y(e.toRef(t, 'groupBy'));
e.watchEffect(function () {
return (n.groupBy = r.value);
});
var u = e.computed(function () {
return t.multiple ? t.min : Math.min(1, t.min);
});
e.watchEffect(function () {
return (n.min = u.value);
});
var i = e.computed(function () {
return t.multiple ? t.max : 1;
});
return (
e.watchEffect(function () {
return (n.max = i.value);
}),
e.watchEffect(function () {
return (n.options = t.options);
}),
n
);
})(t),
r = e.computed(function () {
var e;
return null !== (e = t.emptyModelValue) && void 0 !== e ? e : null;
}),
u = e.getCurrentInstance(),
i = e.ref(),
c = e.ref(),
d = e.ref(),
s = e.computed(function () {
var e;
return null === (e = d.value) || void 0 === e ? void 0 : e._.refs.input;
}),
p = e.ref(!1);
e.watch(
function () {
return p.value;
},
function () {
p.value
? (o.emit('opened'),
o.emit('focus'),
t.searchable
? (s.value !== document.activeElement && s.value.focus(), o.emit('search:focus'))
: i.value.focus())
: (t.searchable
? (s.value === document.activeElement && s.value.blur(),
t.clearOnClose && C(),
o.emit('search:blur'))
: i.value.blur(),
o.emit('closed'),
o.emit('blur')),
o.emit('toggle');
}
);
var v = function () {
t.disabled || (p.value = !0);
},
B = function (e) {
i.value.contains(null == e ? void 0 : e.relatedTarget)
? setTimeout(function () {
i.value.focus();
})
: (p.value = !1);
};
e.watch(
function () {
return t.disabled;
},
function () {
return B();
}
);
var w = e.ref(''),
I = e.computed(function () {
return new RegExp(w.value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'i');
}),
x = e.computed(function () {
return w.value
? a.options.filter(function (e) {
return I.value.test(a.labelBy(e));
})
: void 0;
}),
k = e.ref([]),
V = e.computed(function () {
return new Set(
k.value.map(function (e) {
return a.valueBy(e);
})
);
}),
M = function () {
if (t.multiple) {
if (!1 === Array.isArray(t.modelValue)) return !1;
if (k.value.length !== t.modelValue.length) return !1;
if (
Object.keys(k.value).some(function (e) {
return k.value[e] !== m(a.options, t.modelValue[e], { valueBy: a.valueBy });
})
)
return !1;
} else {
if (0 === k.value.length && t.modelValue !== r.value) return !1;
if (1 === k.value.length && t.modelValue === r.value) return !1;
if (k.value[0] !== m(a.options, t.modelValue, { valueBy: a.valueBy })) return !1;
}
return !0;
},
E = function () {
if (!M()) {
k.value = [];
var e,
n = l(t.multiple ? t.modelValue : t.modelValue === r.value ? [] : [t.modelValue]);
try {
for (n.s(); !(e = n.n()).done; ) {
var o = e.value,
u = m(a.options, o, { valueBy: a.valueBy });
!1 !== f(a.options, u, { valueBy: a.valueBy }) &&
(k.value = g(k.value, u, { max: 1 / 0, valueBy: a.valueBy }));
}
} catch (e) {
n.e(e);
} finally {
n.f();
}
}
};
E(),
e.watch(
function () {
return t.modelValue;
},
function () {
return E();
},
{ deep: !0 }
),
e.watch(
function () {
return a.options;
},
function () {
k.value = a.options.filter(function (e) {
return V.value.has(a.valueBy(e));
});
},
{ deep: !0 }
);
var S,
N = function (e, t) {
(t = t.originalOption).value.every(function (e) {
var t = m(a.options, e, { valueBy: a.valueBy });
return f(k.value, t, { valueBy: a.valueBy });
})
? t.value.forEach(function (e) {
var t = m(a.options, e, { valueBy: a.valueBy });
(k.value = h(k.value, t, { min: a.min, valueBy: a.valueBy })), o.emit('removed', t);
})
: t.value.forEach(function (e) {
var t = m(a.options, e, { valueBy: a.valueBy });
f(k.value, t, { valueBy: a.valueBy }) ||
((k.value = g(k.value, t, { max: a.max, valueBy: a.valueBy })),
o.emit('selected', t));
});
},
F = function (e, n) {
if (((n = n.originalOption), f(k.value, n, { valueBy: a.valueBy })))
(k.value = h(k.value, n, { min: a.min, valueBy: a.valueBy })), o.emit('removed', n);
else {
if (!t.multiple && 1 === k.value.length) {
var l = k.value[0];
(k.value = h(k.value, k.value[0], { min: 0, valueBy: a.valueBy })), o.emit('removed', l);
}
(k.value = g(k.value, n, { max: a.max, valueBy: a.valueBy })), o.emit('selected', n);
}
},
O = function () {
if (!M()) {
var e = k.value.map(function (e) {
return a.valueBy(e);
});
t.multiple
? o.emit('update:modelValue', e)
: e.length
? o.emit('update:modelValue', e[0])
: o.emit('update:modelValue', r.value);
}
},
C = function () {
(s.value.value = ''),
s.value.dispatchEvent(new Event('input')),
s.value.dispatchEvent(new Event('change'));
},
A = e.computed(function () {
var e, n;
return null !== (n = null !== (e = t.visibleOptions) && void 0 !== e ? e : x.value) && void 0 !== n
? n
: a.options;
}),
T = e.ref(0),
D = e.computed(function () {
var e,
n = new Set(
A.value.map(function (e) {
return a.valueBy(e);
})
),
o = a.options.map(function (e, o) {
var l = {
key: a.valueBy(e),
label: a.labelBy(e),
group: a.groupBy(e),
originalIndex: o,
originalOption: e,
};
return (
(l.selected = l.group
? e.value.every(function (e) {
return V.value.has(e);
})
: V.value.has(a.valueBy(e))),
(l.disabled = l.group
? a.disabledBy(e) ||
e.value.every(function (e) {
var t = m(a.options, e, { valueBy: a.valueBy });
return a.disabledBy(t);
})
: a.disabledBy(e)),
(l.visible = l.group
? e.value.some(function (e) {
return n.has(e);
})
: n.has(a.valueBy(e))),
(l.hidden =
!!t.hideSelected &&
(l.group
? e.value.every(function (e) {
return V.value.has(e);
})
: V.value.has(a.valueBy(e)))),
l
);
}),
r = l(o);
try {
for (r.s(); !(e = r.n()).done; ) {
var u = e.value;
!1 !== u.group &&
u.disabled &&
(function () {
var e = new Set(u.originalOption.value);
o.filter(function (t) {
return e.has(a.valueBy(t.originalOption));
}).forEach(function (e) {
return (e.disabled = !0);
});
})();
}
} catch (e) {
r.e(e);
} finally {
r.f();
}
return o;
}),
L = b(D, T),
j = L.pointerForward,
z = L.pointerBackward,
$ = L.pointerSet,
U = '',
P = /^[\w]$/,
R = e.computed(function () {
var e = n(a.options.keys());
return e.slice(T.value).concat(e.slice(0, T.value));
}),
q = function () {
var e,
t = null === (e = i.value) || void 0 === e ? void 0 : e.querySelector('.highlighted');
if (t && c.value) {
var n,
o = getComputedStyle(t);
for (
n = 0;
t.offsetTop +
parseFloat(o.height) +
parseFloat(o.paddingTop) +
parseFloat(o.paddingBottom) >
c.value.$el.clientHeight + c.value.$el.scrollTop && n++ < D.value.length;
)
c.value.$el.scrollTop =
c.value.$el.scrollTop +
parseFloat(o.height) +
parseFloat(o.paddingTop) +
parseFloat(o.paddingBottom);
for (n = 0; t.offsetTop < c.value.$el.scrollTop && n++ < D.value.length; )
c.value.$el.scrollTop =
c.value.$el.scrollTop -
parseFloat(o.height) -
parseFloat(o.paddingTop) -
parseFloat(o.paddingBottom);
}
};
e.watch(
function () {
return [p.value, a.options, V.value];
},
function (t, n) {
!0 !== (null == n ? void 0 : n[0]) &&
!1 !== p.value &&
0 !== k.value.length &&
($(
a.options.findIndex(function (e) {
return V.value.has(a.valueBy(e));
})
),
e.nextTick(q));
},
{ deep: !0, immediate: !0 }
);
var H = e.computed(function () {
return {
'data-is-focusing': p.value,
'data-visible-length': D.value.filter(function (e) {
return e.visible && !1 === e.hidden;
}).length,
'data-not-selected-length':
a.options.length -
D.value.filter(function (e) {
return e.selected;
}).length,
'data-selected-length': D.value.filter(function (e) {
return e.selected;
}).length,
'data-addable':
D.value.filter(function (e) {
return e.selected;
}).length < a.max,
'data-removable':
D.value.filter(function (e) {
return e.selected;
}).length > a.min,
'data-total-length': a.options.length,
'data-multiple': t.multiple,
'data-loading': t.loading,
'data-disabled': t.disabled,
};
});
e.provide('dataAttrs', H);
var _ = e.computed(function () {
return D.value
.filter(function (e) {
return e.selected;
})
.filter(function (e) {
return !e.group;
});
}),
W = e.computed(function () {
return t.multiple
? 0 === _.value.length
? t.placeholder
: 1 === _.value.length
? '1 option selected'
: _.value.length + ' options selected'
: 0 === _.value.length
? t.placeholder
: _.value[0].label + '';
}),
Z = e.computed(function () {
var e = _.value.map(function (e) {
return e.originalOption;
});
return t.multiple ? e : e[0] || r.value;
}),
K = e.ref();
return (
e.watch(
function () {
return [t.openDirection, p.value];
},
function () {
var e, n;
K.value =
null !==
(n =
null !== (e = t.openDirection) && void 0 !== e
? e
: (function () {
if (void 0 === i.value) return;
if (void 0 === window) return;
return window.innerHeight - i.value.getBoundingClientRect().bottom >=
t.maxHeight
? 'bottom'
: 'top';
})()) && void 0 !== n
? n
: 'bottom';
},
{ immediate: !0 }
),
{
instance: u,
isFocusing: p,
wrapper: i,
dropdown: c,
input: d,
focus: v,
blur: B,
toggle: function () {
p.value ? B() : v();
},
searchingInputValue: w,
handleInputForInput: function (e) {
o.emit('search:input', e);
},
handleChangeForInput: function (e) {
o.emit('search:change', e);
},
handleFocusForInput: function (e) {
v();
},
handleBlurForInput: function (e) {
B();
},
optionsWithInfo: D,
addOrRemoveOption: function (e, n) {
t.disabled ||
(n.group && t.multiple ? N(e, n) : F(e, n),
O(),
!0 === t.closeOnSelect && (p.value = !1),
!0 === t.clearOnSelect && w.value && C());
},
dataAttrs: H,
innerPlaceholder: W,
selected: Z,
highlightedOriginalIndex: T,
pointerForward: function () {
j(), e.nextTick(q);
},
pointerBackward: function () {
z(), e.nextTick(q);
},
pointerFirst: function () {
var t,
n = l(a.options.keys());
try {
for (n.s(); !(t = n.n()).done; ) {
var o = t.value;
if ($(o)) break;
}
} catch (e) {
n.e(e);
} finally {
n.f();
}
e.nextTick(q);
},
pointerLast: function () {
var t,
o = l(n(a.options.keys()).reverse());
try {
for (o.s(); !(t = o.n()).done; ) {
var r = t.value;
if ($(r)) break;
}
} catch (e) {
o.e(e);
} finally {
o.f();
}
e.nextTick(q);
},
typeAhead: function (e) {
var n, o;
if (!t.searchable) {
var r = !1;
if (
(P.test(e.key)
? ((U += e.key.toLowerCase()), (r = !0))
: 'Space' === e.code && (U += ' '),
r)
) {
var u,
i = l(R.value);
try {
for (i.s(); !(u = i.n()).done; ) {
var c = u.value;
if (
!0 ===
(null ===
(o =
null === (n = a.labelBy(a.options[c])) || void 0 === n
? void 0
: n.toLowerCase()) || void 0 === o
? void 0
: o.startsWith(U)) &&
$(c)
)
break;
}
} catch (e) {
i.e(e);
} finally {
i.f();
}
clearTimeout(S),
(S = setTimeout(function () {
U = '';
}, 500));
}
}
},
pointerSet: $,
direction: K,
}
);
},
components: { VInput: r, VTags: c, VDropdown: d },
});
B.__VERSION__ = '2.10.1';
var w = [
'tabindex',
'id',
'role',
'aria-expanded',
'aria-owns',
'aria-activedescendant',
'aria-busy',
'aria-disabled',
],
I = { ref: 'header', class: 'vue-select-header' },
x = { key: 0, class: 'vue-input' },
k = ['placeholder', 'autocomplete'],
V = ['onClick'],
M = e.createElementVNode(
'span',
{ class: 'icon loading' },
[e.createElementVNode('div'), e.createElementVNode('div'), e.createElementVNode('div')],
-1
),
E = { key: 0, class: 'vue-select-input-wrapper' },
S = e.createElementVNode(
'span',
{ class: 'icon loading' },
[e.createElementVNode('div'), e.createElementVNode('div'), e.createElementVNode('div')],
-1
);
return (
(B.render = function (t, n, o, a, l, r) {
var u = e.resolveComponent('v-tags'),
i = e.resolveComponent('v-input'),
c = e.resolveComponent('v-dropdown');
return (
e.openBlock(),
e.createElementBlock(
'div',
e.mergeProps(
{
ref: 'wrapper',
class: ['vue-select', ['direction-'.concat(t.direction)]],
tabindex: t.isFocusing ? -1 : t.tabindex,
onFocus:
n[9] ||
(n[9] = function () {
return t.focus && t.focus.apply(t, arguments);
}),
onBlur:
n[10] ||
(n[10] = function (e) {
return !t.searchable && t.blur(e);
}),
},
Object.assign({}, t.dataAttrs, t.$attrs),
{
onKeypress:
n[11] ||
(n[11] = e.withKeys(
e.withModifiers(
function () {
return (
null !== t.highlightedOriginalIndex &&
t.addOrRemoveOption(
t.$event,
t.optionsWithInfo[t.highlightedOriginalIndex]
)
);
},
['prevent', 'exact']
),
['enter']
)),
onKeydown: [
n[12] ||
(n[12] = e.withKeys(
e.withModifiers(
function () {
return t.pointerForward && t.pointerForward.apply(t, arguments);
},
['prevent', 'exact']
),
['down']
)),
n[13] ||
(n[13] = e.withKeys(
e.withModifiers(
function () {
return t.pointerBackward && t.pointerBackward.apply(t, arguments);
},
['prevent', 'exact']
),
['up']
)),
n[14] ||
(n[14] = e.withKeys(
e.withModifiers(
function () {
return t.pointerFirst && t.pointerFirst.apply(t, arguments);
},
['prevent', 'exact']
),
['home']
)),
n[15] ||
(n[15] = e.withKeys(
e.withModifiers(
function () {
return t.pointerLast && t.pointerLast.apply(t, arguments);
},
['prevent', 'exact']
),
['end']
)),
n[16] ||
(n[16] = function () {
return t.typeAhead && t.typeAhead.apply(t, arguments);
}),
],
id: 'vs'.concat(t.instance.uid, '-combobox'),
role: t.searchable ? 'combobox' : null,
'aria-expanded': t.isFocusing,
'aria-haspopup': 'listbox',
'aria-owns': 'vs'.concat(t.instance.uid, '-listbox'),
'aria-activedescendant':
null === t.highlightedOriginalIndex
? null
: 'vs'.concat(t.instance.uid, '-option-').concat(t.highlightedOriginalIndex),
'aria-busy': t.loading,
'aria-disabled': t.disabled,
}
),
[
e.createElementVNode(
'div',
I,
[
(t.multiple && t.taggable && 0 === t.modelValue.length) ||
(!1 === t.searchable && !1 === t.taggable)
? (e.openBlock(),
e.createElementBlock('div', x, [
e.renderSlot(t.$slots, 'label', { selected: t.selected }, function () {
return [
e.createElementVNode(
'input',
{
placeholder: t.innerPlaceholder,
autocomplete: t.autocomplete,
readonly: '',
onClick:
n[0] ||
(n[0] = function () {
return t.focus && t.focus.apply(t, arguments);
}),
},
null,
8,
k
),
];
}),
]))
: e.createCommentVNode('v-if', !0),
t.multiple && t.taggable
? (e.openBlock(),
e.createElementBlock(
e.Fragment,
{ key: 1 },
[
e.createVNode(
u,
{
modelValue: t.optionsWithInfo,
'collapse-tags': t.collapseTags,
tabindex: '-1',
onClick: t.focus,
},
{
default: e.withCtx(function (n) {
var o = n.option;
return [
e.renderSlot(
t.$slots,
'tag',
{
option: o.originalOption,
remove: function () {
return t.addOrRemoveOption(t.$event, o);
},
},
function () {
return [
e.createElementVNode(
'span',
null,
e.toDisplayString(o.label),
1
),
e.createElementVNode(
'img',
{
src: 'data:image/svg+xml;base64,PHN2ZyBpZD0iZGVsZXRlIiBkYXRhLW5hbWU9ImRlbGV0ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHRpdGxlPmRlbGV0ZTwvdGl0bGU+PHBhdGggZD0iTTI1NiwyNEMzODMuOSwyNCw0ODgsMTI4LjEsNDg4LDI1NlMzODMuOSw0ODgsMjU2LDQ4OCwyNC4wNiwzODMuOSwyNC4wNiwyNTYsMTI4LjEsMjQsMjU2LDI0Wk0wLDI1NkMwLDM5Ny4xNiwxMTQuODQsNTEyLDI1Niw1MTJTNTEyLDM5Ny4xNiw1MTIsMjU2LDM5Ny4xNiwwLDI1NiwwLDAsMTE0Ljg0LDAsMjU2WiIgZmlsbD0iIzViNWI1ZiIvPjxwb2x5Z29uIHBvaW50cz0iMzgyIDE3Mi43MiAzMzkuMjkgMTMwLjAxIDI1NiAyMTMuMjkgMTcyLjcyIDEzMC4wMSAxMzAuMDEgMTcyLjcyIDIxMy4yOSAyNTYgMTMwLjAxIDMzOS4yOCAxNzIuNzIgMzgyIDI1NiAyOTguNzEgMzM5LjI5IDM4MS45OSAzODIgMzM5LjI4IDI5OC43MSAyNTYgMzgyIDE3Mi43MiIgZmlsbD0iIzViNWI1ZiIvPjwvc3ZnPg==',
alt: 'delete tag',
class: 'icon delete',
onClick: e.withModifiers(
function () {
return t.addOrRemoveOption(
t.$event,
o
);
},
['prevent', 'stop']
),
},
null,
8,
V
),
];
}
),
];
}),
_: 3,
},
8,
['modelValue', 'collapse-tags', 'onClick']
),
e.renderSlot(
t.$slots,
'toggle',
{ isFocusing: t.isFocusing, toggle: t.toggle },
function () {
return [
e.createElementVNode(
'span',
{
class: e.normalizeClass([
'icon arrow-downward',
{ active: t.isFocusing },
]),
onClick:
n[1] ||
(n[1] = function () {
return (
t.toggle && t.toggle.apply(t, arguments)
);
}),
onMousedown:
n[2] ||
(n[2] = e.withModifiers(function () {}, [
'prevent',
'stop',
])),
},
null,
34
),
];
}
),
],
64
))
: (e.openBlock(),
e.createElementBlock(
e.Fragment,
{ key: 2 },
[
t.searchable
? (e.openBlock(),
e.createBlock(
i,
{
key: 0,
ref: 'input',
modelValue: t.searchingInputValue,
'onUpdate:modelValue':
n[3] ||
(n[3] = function (e) {
return (t.searchingInputValue = e);
}),
disabled: t.disabled,
autocomplete: t.autocomplete,
placeholder: t.isFocusing
? t.searchPlaceholder
: t.innerPlaceholder,
onInput: t.handleInputForInput,
onChange: t.handleChangeForInput,
onFocus: t.handleFocusForInput,
onBlur: t.handleBlurForInput,
onEscape: t.blur,
autofocus: t.autofocus || (t.taggable && t.searchable),
tabindex: t.tabindex,
comboboxUid: t.instance.uid,
},
null,
8,
[
'modelValue',
'disabled',
'autocomplete',
'placeholder',
'onInput',
'onChange',
'onFocus',
'onBlur',
'onEscape',
'autofocus',
'tabindex',
'comboboxUid',
]
))
: e.createCommentVNode('v-if', !0),
t.loading
? e.renderSlot(t.$slots, 'loading', { key: 1 }, function () {
return [M];
})
: e.renderSlot(
t.$slots,
'toggle',
{ key: 2, isFocusing: t.isFocusing, toggle: t.toggle },
function () {
return [
e.createElementVNode(
'span',
{
class: e.normalizeClass([
'icon arrow-downward',
{ active: t.isFocusing },
]),
onClick:
n[4] ||
(n[4] = function () {
return (
t.toggle &&
t.toggle.apply(t, arguments)
);
}),
onMousedown:
n[5] ||
(n[5] = e.withModifiers(
function () {},
['prevent', 'stop']
)),
},
null,
34
),
];
}
),
],
64
)),
],
512
),
t.multiple && t.taggable && t.searchable
? (e.openBlock(),
e.createElementBlock('div', E, [
e.withDirectives(
e.createVNode(
i,
{
ref: 'input',
modelValue: t.searchingInputValue,
'onUpdate:modelValue':
n[6] ||
(n[6] = function (e) {
return (t.searchingInputValue = e);
}),
disabled: t.disabled,
autocomplete: t.autocomplete,
placeholder: t.isFocusing ? t.searchPlaceholder : t.innerPlaceholder,
onInput: t.handleInputForInput,
onChange: t.handleChangeForInput,
onFocus: t.handleFocusForInput,
onBlur: t.handleBlurForInput,
onEscape: t.blur,
autofocus: t.autofocus || (t.taggable && t.searchable),
tabindex: t.tabindex,
comboboxUid: t.instance.uid,
},
null,
8,
[
'modelValue',
'disabled',
'autocomplete',
'placeholder',
'onInput',
'onChange',
'onFocus',
'onBlur',
'onEscape',
'autofocus',
'tabindex',
'comboboxUid',
]
),
[[e.vShow, t.isFocusing]]
),
t.loading
? e.renderSlot(t.$slots, 'loading', { key: 0 }, function () {
return [S];
})
: e.createCommentVNode('v-if', !0),
]))
: e.createCommentVNode('v-if', !0),
e.createVNode(
c,
{
ref: 'dropdown',
modelValue: t.optionsWithInfo,
'onUpdate:modelValue':
n[7] ||
(n[7] = function (e) {
return (t.optionsWithInfo = e);
}),
onClickItem: t.addOrRemoveOption,
onMouseenter:
n[8] ||
(n[8] = function (e, n) {
return t.pointerSet(n.originalIndex);
}),
comboboxUid: t.instance.uid,
maxHeight: t.maxHeight,
highlightedOriginalIndex: t.highlightedOriginalIndex,
},
{
default: e.withCtx(function (n) {
var o = n.option;
return [
e.renderSlot(
t.$slots,
'dropdown-item',
{ option: o.originalOption },
function () {
return [
e.createElementVNode('span', null, e.toDisplayString(o.label), 1),
];
}
),
];
}),
_: 3,
},
8,
['modelValue', 'onClickItem', 'comboboxUid', 'maxHeight', 'highlightedOriginalIndex']
),
],
16,
w
)
);
}),
(B.__file = 'src/index.vue'),
B
);
})(Vue);