diff --git a/css/vue-next-select.css b/css/vue-next-select.css
index e261e40..bebae3a 100644
--- a/css/vue-next-select.css
+++ b/css/vue-next-select.css
@@ -50,11 +50,13 @@
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
-.vue-input > input[disabled],
.vue-select.disabled {
background-color: rgba(239, 239, 239);
}
-.vue-select.disabled * {
+.vue-dropdown[data-removable='false'] .vue-dropdown-item.selected:hover,
+.vue-select.disabled *,
+.vue-select.disabled input,
+.vue-tags[data-removable='false'] .vue-tag.selected img:hover {
cursor: not-allowed;
}
.vue-select-header {
@@ -121,9 +123,10 @@
font-size: 0.8rem;
padding: 0;
}
-.vue-input > input[readonly] {
- cursor: default;
+.vue-input > input[disabled] {
+ background-color: rgba(239, 239, 239);
}
+.vue-input > input[readonly],
.vue-select-header > .vue-input > input[disabled] {
background-color: unset;
}
@@ -163,6 +166,9 @@
.vue-dropdown-item.selected:hover {
background-color: #ff6a6a;
}
+.vue-dropdown[data-addable='false'][data-multiple='true'] .vue-dropdown-item:not(.selected):hover {
+ cursor: not-allowed;
+}
.icon.loading {
display: inline-block;
position: relative;
diff --git a/js/gamutable.es6.js b/js/gamutable.es6.js
index 1c11fa5..fd66725 100644
--- a/js/gamutable.es6.js
+++ b/js/gamutable.es6.js
@@ -619,6 +619,7 @@ let monTableau = {
multiple
taggable
close-on-select
+ clear-on-close
searchable
@selected="selectValCol"
@search:input="hanldeSearchInput($event, head)"
diff --git a/js/gamutable.js b/js/gamutable.js
index 45c56a6..8a14ff9 100644
--- a/js/gamutable.js
+++ b/js/gamutable.js
@@ -634,7 +634,7 @@ var monTableau = {
this.quelleVue = vue;
}
},
- template: "\n\t
\n\t\t
\n\t\t\t\n\t\t\t\t{{v}} \n\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\tMise \xE0 jour de la base de donn\xE9e\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t{{tableau.length}} / {{table.length}} \xE9l\xE9ments \n\t\t
\n\n\t\t
\n\t\t
\n\t\t
\n\t\t\t
{{tableau.length}} / {{table.length}} \xE9l\xE9ments
\n\t\t\t\n\t\t
\n\t
"
+ template: "\n\t\n\t\t
\n\t\t\t\n\t\t\t\t{{v}} \n\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\tMise \xE0 jour de la base de donn\xE9e\n\t\t\t\t \n\t\t\t \n\t\t\t\n\t\t\t\t \n\t\t\t \n\t\t\t{{tableau.length}} / {{table.length}} \xE9l\xE9ments \n\t\t
\n\n\t\t
\n\t\t
\n\t\t
\n\t\t\t
{{tableau.length}} / {{table.length}} \xE9l\xE9ments
\n\t\t\t\n\t\t
\n\t
"
};
var gamuTable = {
components: {
diff --git a/js/vue-next-select.js b/js/vue-next-select.js
index 9cfd0c3..c48b61c 100644
--- a/js/vue-next-select.js
+++ b/js/vue-next-select.js
@@ -1,771 +1 @@
-this.VueNextSelect = (function (e) {
- 'use strict';
- var l = {
- inheritAttrs: !1,
- name: 'vue-input',
- props: {
- 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 },
- },
- emits: ['update:modelValue', 'input', 'change', 'focus', 'blur', 'escape'],
- setup(l, t) {
- const a = e.ref(null);
- return (
- e.onMounted(() => {
- l.autofocus && a.value.focus();
- }),
- e.onUpdated(() => {
- l.autofocus && a.value.focus();
- }),
- {
- handleInput: (e) => {
- t.emit('input', e), t.emit('update:modelValue', e.target.value);
- },
- handleChange: (e) => {
- t.emit('change', e), t.emit('update:modelValue', e.target.value);
- },
- handleFocus: (e) => {
- t.emit('focus', e);
- },
- handleBlur: (e) => {
- t.emit('blur', e);
- },
- input: a,
- handleEscape: (e) => {
- a.value.blur(), t.emit('escape', e);
- },
- }
- );
- },
- };
- const t = { class: 'vue-input' };
- (l.render = function (l, a, n, o, u, i) {
- return (
- e.openBlock(),
- e.createBlock('div', t, [
- e.renderSlot(l.$slots, 'prepend'),
- e.createVNode(
- 'input',
- {
- ref: 'input',
- modelValue: n.modelValue,
- placeholder: n.placeholder,
- disabled: n.disabled,
- onInput: a[1] || (a[1] = (...e) => o.handleInput && o.handleInput(...e)),
- onChange: a[2] || (a[2] = (...e) => o.handleChange && o.handleChange(...e)),
- onFocus: a[3] || (a[3] = (...e) => o.handleFocus && o.handleFocus(...e)),
- onBlur: a[4] || (a[4] = (...e) => o.handleBlur && o.handleBlur(...e)),
- onKeyup:
- a[5] ||
- (a[5] = e.withKeys(
- e.withModifiers((...e) => o.handleEscape && o.handleEscape(...e), ['exact']),
- ['esc']
- )),
- tabindex: n.tabindex,
- autofocus: n.autofocus,
- },
- null,
- 40,
- ['modelValue', 'placeholder', 'disabled', 'tabindex', 'autofocus']
- ),
- e.renderSlot(l.$slots, 'append'),
- ])
- );
- }),
- (l.__file = 'src/components/input.vue');
- var a = {
- inheritAttrs: !1,
- name: 'vue-tags',
- props: {
- modelValue: {
- required: !0,
- type: Array,
- validator: (e) =>
- e.every((e) => void 0 !== typeof e.key && void 0 !== e.label && 'boolean' == typeof e.selected),
- },
- collapseTags: { type: Boolean },
- },
- emits: ['click'],
- setup: (l, t) => ({
- dataAttrs: e.inject('dataAttrs'),
- handleClick: (e) => {
- t.emit('click', e);
- },
- }),
- };
- (a.render = function (l, t, a, n, o, u) {
- return (
- e.openBlock(),
- e.createBlock(
- 'ul',
- {
- class: ['vue-tags', { collapsed: a.collapseTags }],
- onMousedown: t[1] || (t[1] = e.withModifiers(() => {}, ['prevent'])),
- tabindex: '-1',
- onClick: t[2] || (t[2] = (...e) => n.handleClick && n.handleClick(...e)),
- 'data-is-focusing': n.dataAttrs.isFocusing,
- 'data-visible-length': n.dataAttrs.visibleLength,
- 'data-not-selected-length': n.dataAttrs.notSelectedLength,
- 'data-selected-length': n.dataAttrs.selectedLength,
- 'data-total-length': n.dataAttrs.totalLength,
- },
- [
- (e.openBlock(!0),
- e.createBlock(
- e.Fragment,
- null,
- e.renderList(
- a.modelValue,
- (t) => (
- e.openBlock(),
- e.createBlock(
- 'li',
- { key: t.key, class: ['vue-tag', { selected: t.selected }] },
- [
- e.renderSlot(l.$slots, 'default', { option: t }, () => [
- e.createVNode('span', null, e.toDisplayString(t.label), 1),
- ]),
- ],
- 2
- )
- )
- ),
- 128
- )),
- ],
- 42,
- [
- 'data-is-focusing',
- 'data-visible-length',
- 'data-not-selected-length',
- 'data-selected-length',
- 'data-total-length',
- ]
- )
- );
- }),
- (a.__file = 'src/components/tags.vue');
- var n = {
- inheritAttrs: !1,
- name: 'vue-dropdown',
- props: {
- modelValue: {
- required: !0,
- type: Array,
- validator: (e) =>
- e.every((e) => void 0 !== typeof e.key && void 0 !== e.label && 'boolean' == typeof e.selected),
- },
- headerHeight: { required: !0, type: String },
- },
- emits: ['click'],
- setup: (l, t) => ({
- dataAttrs: e.inject('dataAttrs'),
- handleClick: (e, l) => {
- t.emit('click', e, l);
- },
- }),
- };
- (n.render = function (l, t, a, n, o, u) {
- return (
- e.openBlock(),
- e.createBlock(
- 'ul',
- {
- class: 'vue-dropdown',
- onMousedown: t[1] || (t[1] = e.withModifiers(() => {}, ['prevent'])),
- style: { top: a.headerHeight },
- 'data-is-focusing': n.dataAttrs.isFocusing,
- 'data-visible-length': n.dataAttrs.visibleLength,
- 'data-not-selected-length': n.dataAttrs.notSelectedLength,
- 'data-selected-length': n.dataAttrs.selectedLength,
- 'data-total-length': n.dataAttrs.totalLength,
- },
- [
- (e.openBlock(!0),
- e.createBlock(
- e.Fragment,
- null,
- e.renderList(
- a.modelValue,
- (t) => (
- e.openBlock(),
- e.createBlock(
- e.Fragment,
- { key: t.key },
- [
- t.visible && !1 === t.hidden
- ? (e.openBlock(),
- e.createBlock(
- 'li',
- {
- key: 0,
- onClick: (e) => n.handleClick(e, t),
- class: ['vue-dropdown-item', { selected: t.selected }],
- },
- [
- e.renderSlot(l.$slots, 'default', { option: t }, () => [
- e.createVNode('span', null, e.toDisplayString(t.label), 1),
- ]),
- ],
- 10,
- ['onClick']
- ))
- : e.createCommentVNode('v-if', !0),
- ],
- 64
- )
- )
- ),
- 128
- )),
- ],
- 44,
- [
- 'data-is-focusing',
- 'data-visible-length',
- 'data-not-selected-length',
- 'data-selected-length',
- 'data-total-length',
- ]
- )
- );
- }),
- (n.__file = 'src/components/dropdown.vue');
- const o = (e, l, { valueBy: t }) => t(e) === t(l),
- u = (e, l, { valueBy: t }) => -1 !== e.findIndex((e) => o(e, l, { valueBy: t })),
- i = (e, l, { valueBy: t }) => e.find((e) => t(e) === l),
- d = (e, l, { max: t, valueBy: a }) => (u(e, l, { valueBy: a }) || e.length + 1 > t ? e : e.concat(l)),
- s = (e, l, { min: t, valueBy: a }) =>
- !1 === u(e, l, { valueBy: a }) || e.length - 1 < t ? e : e.filter((e) => !1 === o(e, l, { valueBy: a }));
- var r = {
- name: 'vue-select',
- inheritAttrs: !1,
- props: {
- modelValue: { required: !0 },
- options: { required: !0, type: Array },
- visibleOptions: { type: [Array, null], default: null },
- multiple: { default: !1, type: Boolean },
- min: { default: 0, type: Number },
- max: { default: 1 / 0, type: Number },
- closeOnSelect: { default: !1, type: Boolean },
- clearOnSelect: { default: !1, type: Boolean },
- trackBy: { type: [String, Function] },
- hideSelected: { default: !1, type: Boolean },
- labelBy: { type: [String, Function] },
- valueBy: { type: [String, Function] },
- disabled: { default: !1, type: Boolean },
- loading: { default: !1, type: Boolean },
- placeholder: { default: 'Select option', type: String },
- searchPlaceholder: { default: 'Type to search', type: String },
- searchable: { default: !1, type: Boolean },
- taggable: { default: !1, type: Boolean },
- collapseTags: { default: !1, type: Boolean },
- tabindex: { default: 0, type: Number },
- autofocus: { default: !1, type: Boolean },
- },
- emits: [
- 'update:modelValue',
- 'selected',
- 'removed',
- 'opened',
- 'closed',
- 'search:input',
- 'search:change',
- 'search:focus',
- 'search:blur',
- ],
- setup(l, t) {
- const { trackBy: a, labelBy: n, valueBy: o, min: r, max: c, options: p } = ((l) => ({
- trackBy: e.computed(() =>
- 'function' == typeof l.trackBy
- ? l.trackBy
- : 'string' == typeof l.trackBy
- ? (e) => l.trackBy.split('.').reduce((e, l) => e[l], e)
- : (e) => e
- ),
- labelBy: e.computed(() =>
- 'function' == typeof l.labelBy
- ? l.labelBy
- : 'string' == typeof l.labelBy
- ? (e) => l.labelBy.split('.').reduce((e, l) => e[l], e)
- : (e) => e
- ),
- valueBy: e.computed(() =>
- 'function' == typeof l.valueBy
- ? l.valueBy
- : 'string' == typeof l.valueBy
- ? (e) => l.valueBy.split('.').reduce((e, l) => e[l], e)
- : (e) => e
- ),
- min: e.computed(() => (l.multiple ? l.min : Math.min(1, l.min))),
- max: e.computed(() => (l.multiple ? l.max : 1)),
- options: e.isRef(l.options) || e.isReactive(l.options) ? e.toRef(l, 'options') : e.ref(l.options),
- }))(l),
- h = e.ref(null),
- v = e.ref(null),
- g = e.ref(!1);
- e.watch(
- () => g.value,
- () => {
- g.value
- ? (t.emit('opened'),
- l.searchable && t.emit('search:focus'),
- l.searchable
- ? v.value &&
- v.value._.refs.input !== document.activeElement &&
- v.value._.refs.input.focus()
- : !1 === l.searchable && h.value.focus())
- : (v.value && v.value._.refs.input === document.activeElement && v.value._.refs.input.blur(),
- h.value && h.value === document.activeElement && h.value.blur(),
- l.searchable && t.emit('search:blur'),
- t.emit('closed'));
- }
- );
- const m = () => {
- l.disabled || (g.value = !0);
- },
- y = () => {
- g.value = !1;
- };
- e.watch(
- () => l.disabled,
- () => y()
- );
- const f = e.ref(null),
- b =
- ((B = f),
- (w = () => l.modelValue),
- (I = e.ref('0')),
- (k = function () {
- setTimeout(function () {
- B.value && (I.value = window.getComputedStyle(B.value).height);
- });
- }),
- e.watch(w, k),
- e.onMounted(k),
- I);
- var B, w, I, k;
- const V = e.computed(() => (l.searchable && l.multiple && l.taggable ? '22px' : '0px')),
- M = e.computed(() => parseFloat(b.value) + parseFloat(V.value) + 'px'),
- N = e.ref(''),
- S = e.ref([]),
- A = () => {
- if (l.multiple) {
- if (!1 === Array.isArray(l.modelValue)) return !1;
- if (S.value.length !== l.modelValue.length) return !1;
- if (
- Object.keys(S.value).some(
- (e) => S.value[e] !== i(p.value, l.modelValue[e], { valueBy: o.value })
- )
- )
- return !1;
- } else {
- if (0 === S.value.length && null !== l.modelValue) return !1;
- if (1 === S.value.length && null === l.modelValue) return !1;
- if (S.value[0] !== i(p.value, l.modelValue, { valueBy: o.value })) return !1;
- }
- return !0;
- },
- C = () => {
- if (A()) return;
- S.value = [];
- const e = l.multiple ? l.modelValue : null === l.modelValue ? [] : [l.modelValue];
- for (const l of e) {
- const e = i(p.value, l, { valueBy: o.value });
- !1 !== u(p.value, e, { valueBy: o.value }) &&
- (S.value = d(S.value, e, { max: 1 / 0, valueBy: o.value }));
- }
- };
- C(),
- e.watch(
- () => l.modelValue,
- () => {
- C();
- },
- { deep: !0 }
- );
- e.watch(
- () => S,
- () => {
- (() => {
- if (A()) return;
- const e = S.value.map((e) => o.value(e));
- l.multiple
- ? t.emit('update:modelValue', e)
- : e.length
- ? t.emit('update:modelValue', e[0])
- : t.emit('update:modelValue', null);
- })();
- },
- { deep: !0 }
- ),
- e.watch(
- () => p.value,
- () => {
- const e = new Set(S.value.map((e) => o.value(e)));
- S.value = p.value.filter((l) => e.has(o.value(l)));
- },
- { deep: !0 }
- );
- const D = (e, a) => {
- if (!l.disabled) {
- if (((a = a.originalOption), u(S.value, a, { valueBy: o.value })))
- (S.value = s(S.value, a, { min: r.value, valueBy: o.value })), t.emit('removed', a);
- else {
- if (!l.multiple) {
- const e = S.value[0];
- (S.value = s(S.value, S.value[0], { min: 0, valueBy: o.value })), t.emit('removed', e);
- }
- (S.value = d(S.value, a, { max: c.value, valueBy: o.value })), t.emit('selected', a);
- }
- !0 === l.closeOnSelect && (g.value = !1),
- !0 === l.clearOnSelect &&
- N.value &&
- ((v.value._.refs.input.value = ''),
- v.value._.refs.input.dispatchEvent(new Event('input')),
- v.value._.refs.input.dispatchEvent(new Event('change')));
- }
- },
- F = e.computed(() => {
- const e = new Set(S.value.map((e) => o.value(e))),
- t =
- null !== l.visibleOptions
- ? new Set(l.visibleOptions.map((e) => o.value(e)))
- : new Set(p.value.map((e) => o.value(e)));
- return p.value.map((u) => ({
- key: a.value(u),
- label: n.value(u),
- selected: e.has(o.value(u)),
- visible: t.has(o.value(u)),
- hidden: !!l.hideSelected && e.has(o.value(u)),
- originalOption: u,
- }));
- }),
- x = e.computed(() => ({
- isFocusing: g.value,
- visibleLength: F.value.filter((e) => e.visible && !1 === e.hidden).length,
- notSelectedLength: p.value.length - F.value.filter((e) => e.selected).length,
- selectedLength: F.value.filter((e) => e.selected).length,
- totalLength: p.value.length,
- }));
- e.provide('dataAttrs', x);
- const L = e.computed(() => {
- const e = F.value.filter((e) => e.selected);
- return l.multiple
- ? 0 === e.length
- ? l.placeholder
- : 1 === e.length
- ? '1 option selected'
- : e.length + ' options selected'
- : 0 === e.length
- ? l.placeholder
- : e[0].label;
- });
- return {
- isFocusing: g,
- wrapper: h,
- input: v,
- focus: m,
- blur: y,
- toggle: () => {
- g.value ? y() : m();
- },
- header: f,
- headerAndInputHeight: M,
- searchingInputValue: N,
- handleInputForInput: (e) => {
- t.emit('search:input', e);
- },
- handleChangeForInput: (e) => {
- t.emit('search:change', e);
- },
- handleFocusForInput: (e) => {
- m();
- },
- handleBlurForInput: (e) => {
- y();
- },
- handleClickForDropdown: (e, l) => D(0, l),
- handleClickForTag: (e, l) => D(0, l),
- optionsWithInfo: F,
- addOrRemoveOption: D,
- dataAttrs: x,
- innerPlaceholder: L,
- };
- },
- components: { VInput: l, VTags: a, VDropdown: n },
- };
- const c = { ref: 'header', class: 'vue-select-header' },
- p = { key: 0, class: 'vue-input' },
- h = { class: 'icon loading' },
- v = e.createVNode('div', null, null, -1),
- g = e.createVNode('div', null, null, -1),
- m = e.createVNode('div', null, null, -1),
- y = { class: 'icon loading' },
- f = e.createVNode('div', null, null, -1),
- b = e.createVNode('div', null, null, -1),
- B = e.createVNode('div', null, null, -1);
- return (
- (r.render = function (l, t, a, n, o, u) {
- const i = e.resolveComponent('v-tags'),
- d = e.resolveComponent('v-input'),
- s = e.resolveComponent('v-dropdown');
- return (
- e.openBlock(),
- e.createBlock(
- 'div',
- {
- ref: 'wrapper',
- class: ['vue-select', { disabled: a.disabled }],
- tabindex: n.isFocusing ? -1 : a.tabindex,
- onFocus: t[9] || (t[9] = (...e) => n.focus && n.focus(...e)),
- onBlur: t[10] || (t[10] = () => !a.searchable && n.blur()),
- 'data-is-focusing': n.dataAttrs.isFocusing,
- 'data-visible-length': n.dataAttrs.visibleLength,
- 'data-not-selected-length': n.dataAttrs.notSelectedLength,
- 'data-selected-length': n.dataAttrs.selectedLength,
- 'data-total-length': n.dataAttrs.totalLength,
- },
- [
- e.createVNode(
- 'div',
- c,
- [
- (a.multiple && a.taggable && 0 === a.modelValue.length) ||
- (!1 === a.searchable && !1 === a.taggable)
- ? (e.openBlock(),
- e.createBlock('div', p, [
- e.createVNode(
- 'input',
- {
- placeholder: n.innerPlaceholder,
- readonly: '',
- onClick: t[1] || (t[1] = (...e) => n.focus && n.focus(...e)),
- },
- null,
- 8,
- ['placeholder']
- ),
- ]))
- : e.createCommentVNode('v-if', !0),
- a.multiple && a.taggable
- ? (e.openBlock(),
- e.createBlock(
- e.Fragment,
- { key: 1 },
- [
- e.createVNode(
- i,
- {
- modelValue: n.optionsWithInfo,
- 'collapse-tags': a.collapseTags,
- tabindex: '-1',
- onClick: n.focus,
- },
- {
- default: e.withCtx(({ option: t }) => [
- e.renderSlot(
- l.$slots,
- 'tag',
- { option: t.originalOption },
- () => [
- e.createVNode(
- 'span',
- null,
- e.toDisplayString(t.label),
- 1
- ),
- e.createVNode(
- 'img',
- {
- src:
- 'data:image/svg+xml;base64,PHN2ZyBpZD0iZGVsZXRlIiBkYXRhLW5hbWU9ImRlbGV0ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHRpdGxlPmRlbGV0ZTwvdGl0bGU+PHBhdGggZD0iTTI1NiwyNEMzODMuOSwyNCw0ODgsMTI4LjEsNDg4LDI1NlMzODMuOSw0ODgsMjU2LDQ4OCwyNC4wNiwzODMuOSwyNC4wNiwyNTYsMTI4LjEsMjQsMjU2LDI0Wk0wLDI1NkMwLDM5Ny4xNiwxMTQuODQsNTEyLDI1Niw1MTJTNTEyLDM5Ny4xNiw1MTIsMjU2LDM5Ny4xNiwwLDI1NiwwLDAsMTE0Ljg0LDAsMjU2WiIgZmlsbD0iIzViNWI1ZiIvPjxwb2x5Z29uIHBvaW50cz0iMzgyIDE3Mi43MiAzMzkuMjkgMTMwLjAxIDI1NiAyMTMuMjkgMTcyLjcyIDEzMC4wMSAxMzAuMDEgMTcyLjcyIDIxMy4yOSAyNTYgMTMwLjAxIDMzOS4yOCAxNzIuNzIgMzgyIDI1NiAyOTguNzEgMzM5LjI5IDM4MS45OSAzODIgMzM5LjI4IDI5OC43MSAyNTYgMzgyIDE3Mi43MiIgZmlsbD0iIzViNWI1ZiIvPjwvc3ZnPg==',
- alt: 'delete tag',
- class: 'icon delete',
- onClick: e.withModifiers(
- () => n.addOrRemoveOption(l.$event, t),
- ['prevent', 'stop']
- ),
- },
- null,
- 8,
- ['onClick']
- ),
- ]
- ),
- ]),
- _: 1,
- },
- 8,
- ['modelValue', 'collapse-tags', 'onClick']
- ),
- e.createVNode(
- 'span',
- {
- class: ['icon arrow-downward', { active: n.isFocusing }],
- onClick: t[2] || (t[2] = (...e) => n.toggle && n.toggle(...e)),
- onMousedown:
- t[3] ||
- (t[3] = e.withModifiers(() => {}, ['prevent', 'stop'])),
- },
- null,
- 34
- ),
- ],
- 64
- ))
- : (e.openBlock(),
- e.createBlock(
- e.Fragment,
- { key: 2 },
- [
- a.searchable
- ? (e.openBlock(),
- e.createBlock(
- d,
- {
- key: 0,
- ref: 'input',
- modelValue: n.searchingInputValue,
- 'onUpdate:modelValue':
- t[4] || (t[4] = (e) => (n.searchingInputValue = e)),
- disabled: a.disabled,
- placeholder: n.isFocusing
- ? a.searchPlaceholder
- : n.innerPlaceholder,
- onInput: n.handleInputForInput,
- onChange: n.handleChangeForInput,
- onFocus: n.handleFocusForInput,
- onBlur: n.handleBlurForInput,
- onEscape: n.blur,
- autofocus: a.autofocus || (a.taggable && a.searchable),
- tabindex: a.tabindex,
- },
- null,
- 8,
- [
- 'modelValue',
- 'disabled',
- 'placeholder',
- 'onInput',
- 'onChange',
- 'onFocus',
- 'onBlur',
- 'onEscape',
- 'autofocus',
- 'tabindex',
- ]
- ))
- : e.createCommentVNode('v-if', !0),
- e.withDirectives(e.createVNode('span', h, [v, g, m], 512), [
- [e.vShow, a.loading],
- ]),
- e.withDirectives(
- e.createVNode(
- 'span',
- {
- class: ['icon arrow-downward', { active: n.isFocusing }],
- onClick:
- t[5] || (t[5] = (...e) => n.toggle && n.toggle(...e)),
- onMousedown:
- t[6] ||
- (t[6] = e.withModifiers(() => {}, ['prevent', 'stop'])),
- },
- null,
- 34
- ),
- [[e.vShow, !1 === a.loading]]
- ),
- ],
- 64
- )),
- ],
- 512
- ),
- a.multiple && a.taggable && a.searchable
- ? e.withDirectives(
- (e.openBlock(),
- e.createBlock(
- d,
- {
- key: 0,
- ref: 'input',
- modelValue: n.searchingInputValue,
- 'onUpdate:modelValue': t[7] || (t[7] = (e) => (n.searchingInputValue = e)),
- disabled: a.disabled,
- placeholder: a.searchPlaceholder,
- onInput: n.handleInputForInput,
- onChange: n.handleChangeForInput,
- onFocus: n.handleFocusForInput,
- onBlur: n.handleBlurForInput,
- onEscape: n.blur,
- tabindex: a.tabindex,
- autofocus: a.autofocus || (a.taggable && a.searchable),
- },
- {
- append: e.withCtx(() => [
- e.withDirectives(e.createVNode('span', y, [f, b, B], 512), [
- [e.vShow, a.loading],
- ]),
- ]),
- _: 1,
- },
- 8,
- [
- 'modelValue',
- 'disabled',
- 'placeholder',
- 'onInput',
- 'onChange',
- 'onFocus',
- 'onBlur',
- 'onEscape',
- 'tabindex',
- 'autofocus',
- ]
- )),
- [[e.vShow, n.isFocusing]]
- )
- : e.createCommentVNode('v-if', !0),
- e.withDirectives(
- e.createVNode(
- s,
- {
- modelValue: n.optionsWithInfo,
- 'onUpdate:modelValue': t[8] || (t[8] = (e) => (n.optionsWithInfo = e)),
- onClick: n.handleClickForDropdown,
- 'header-height': n.headerAndInputHeight,
- },
- {
- default: e.withCtx(({ option: t }) => [
- e.renderSlot(l.$slots, 'dropdown-item', { option: t.originalOption }, () => [
- e.createVNode('span', null, e.toDisplayString(t.label), 1),
- ]),
- ]),
- _: 1,
- },
- 8,
- ['modelValue', 'onClick', 'header-height']
- ),
- [[e.vShow, n.isFocusing]]
- ),
- ],
- 42,
- [
- 'tabindex',
- 'data-is-focusing',
- 'data-visible-length',
- 'data-not-selected-length',
- 'data-selected-length',
- 'data-total-length',
- ]
- )
- );
- }),
- (r.__file = 'src/index.vue'),
- r
- );
-})(Vue);
+this.VueNextSelect=function(e){"use strict";var l={inheritAttrs:!1,name:"vue-input",props:{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}},emits:["update:modelValue","input","change","focus","blur","escape"],setup(l,a){const t=e.ref(null);return e.onMounted((()=>{l.autofocus&&t.value.focus()})),e.onUpdated((()=>{l.autofocus&&t.value.focus()})),{handleInput:e=>{a.emit("input",e),a.emit("update:modelValue",e.target.value)},handleChange:e=>{a.emit("change",e),a.emit("update:modelValue",e.target.value)},handleFocus:e=>{a.emit("focus",e)},handleBlur:e=>{a.emit("blur",e)},input:t,handleEscape:e=>{t.value.blur(),a.emit("escape",e)}}}};const a={class:"vue-input"};l.render=function(l,t,o,n,u,i){return e.openBlock(),e.createBlock("div",a,[e.renderSlot(l.$slots,"prepend"),e.createVNode("input",{ref:"input",modelValue:o.modelValue,placeholder:o.placeholder,disabled:o.disabled,onInput:t[1]||(t[1]=(...e)=>n.handleInput&&n.handleInput(...e)),onChange:t[2]||(t[2]=(...e)=>n.handleChange&&n.handleChange(...e)),onFocus:t[3]||(t[3]=(...e)=>n.handleFocus&&n.handleFocus(...e)),onBlur:t[4]||(t[4]=(...e)=>n.handleBlur&&n.handleBlur(...e)),onKeyup:t[5]||(t[5]=e.withKeys(e.withModifiers(((...e)=>n.handleEscape&&n.handleEscape(...e)),["exact"]),["esc"])),tabindex:o.tabindex,autofocus:o.autofocus},null,40,["modelValue","placeholder","disabled","tabindex","autofocus"]),e.renderSlot(l.$slots,"append")])},l.__file="src/components/input.vue";var t={inheritAttrs:!1,name:"vue-tags",props:{modelValue:{required:!0,type:Array,validator:e=>e.every((e=>void 0!==typeof e.key&&void 0!==e.label&&"boolean"==typeof e.selected))},collapseTags:{type:Boolean}},emits:["click"],setup:(l,a)=>({dataAttrs:e.inject("dataAttrs"),handleClick:e=>{a.emit("click",e)}})};t.render=function(l,a,t,o,n,u){return e.openBlock(),e.createBlock("ul",e.mergeProps({class:["vue-tags",{collapsed:t.collapseTags}],onMousedown:a[1]||(a[1]=e.withModifiers((()=>{}),["prevent"])),tabindex:"-1",onClick:a[2]||(a[2]=(...e)=>o.handleClick&&o.handleClick(...e))},o.dataAttrs),[(e.openBlock(!0),e.createBlock(e.Fragment,null,e.renderList(t.modelValue,(a=>(e.openBlock(),e.createBlock("li",{key:a.key,class:["vue-tag",{selected:a.selected}]},[e.renderSlot(l.$slots,"default",{option:a},(()=>[e.createVNode("span",null,e.toDisplayString(a.label),1)]))],2)))),128))],16)},t.__file="src/components/tags.vue";var o={inheritAttrs:!1,name:"vue-dropdown",props:{modelValue:{required:!0,type:Array,validator:e=>e.every((e=>void 0!==typeof e.key&&void 0!==e.label&&"boolean"==typeof e.selected))},headerHeight:{required:!0,type:String}},emits:["click"],setup:(l,a)=>({dataAttrs:e.inject("dataAttrs"),handleClick:(e,l)=>{a.emit("click",e,l)}})};o.render=function(l,a,t,o,n,u){return e.openBlock(),e.createBlock("ul",e.mergeProps({class:"vue-dropdown",onMousedown:a[1]||(a[1]=e.withModifiers((()=>{}),["prevent"])),style:{top:t.headerHeight}},o.dataAttrs),[(e.openBlock(!0),e.createBlock(e.Fragment,null,e.renderList(t.modelValue,(a=>(e.openBlock(),e.createBlock(e.Fragment,{key:a.key},[a.visible&&!1===a.hidden?(e.openBlock(),e.createBlock("li",{key:0,onClick:e=>o.handleClick(e,a),class:["vue-dropdown-item",{selected:a.selected}]},[e.renderSlot(l.$slots,"default",{option:a},(()=>[e.createVNode("span",null,e.toDisplayString(a.label),1)]))],10,["onClick"])):e.createCommentVNode("v-if",!0)],64)))),128))],16)},o.__file="src/components/dropdown.vue";const n=(e,l,{valueBy:a})=>a(e)===a(l),u=(e,l,{valueBy:a})=>e.some((e=>n(e,l,{valueBy:a}))),i=(e,l,{valueBy:a})=>e.find((e=>a(e)===l)),d=(e,l,{max:a,valueBy:t})=>u(e,l,{valueBy:t})||e.length>=a?e:e.concat(l),r=(e,l,{min:a,valueBy:t})=>!1===u(e,l,{valueBy:t})||e.length<=a?e:e.filter((e=>!1===n(e,l,{valueBy:t}))),s=l=>e.computed((()=>"function"==typeof l.value?l.value:"string"==typeof l.value?e=>l.value.split(".").reduce(((e,l)=>e[l]),e):e=>e));const c={name:"vue-select",inheritAttrs:!1,props:{modelValue:{required:!0},emptyModelValue:{default:null},options:{required:!0,type:Array},visibleOptions:{type:[Array,null],default:null},multiple:{default:!1,type:Boolean},min:{default:0,type:Number},max:{default:1/0,type:Number},closeOnSelect:{default:!1,type:Boolean},clearOnSelect:{default:!1,type:Boolean},trackBy:{type:[String,Function]},hideSelected:{default:!1,type:Boolean},labelBy:{type:[String,Function]},valueBy:{type:[String,Function]},disabled:{default:!1,type:Boolean},loading:{default:!1,type:Boolean},placeholder:{default:"Select option",type:String},searchPlaceholder:{default:"Type to search",type:String},searchable:{default:!1,type:Boolean},clearOnClose:{default:!1,type:Boolean},taggable:{default:!1,type:Boolean},collapseTags:{default:!1,type:Boolean},tabindex:{default:0,type:Number},autofocus:{default:!1,type:Boolean}},emits:["update:modelValue","selected","removed","opened","closed","search:input","search:change","search:focus","search:blur"],setup(l,a){const{trackBy:t,labelBy:o,valueBy:n,min:c,max:p,options:v}=(l=>({trackBy:s(e.toRef(l,"trackBy")),labelBy:s(e.toRef(l,"labelBy")),valueBy:s(e.toRef(l,"valueBy")),min:e.computed((()=>l.multiple?l.min:Math.min(1,l.min))),max:e.computed((()=>l.multiple?l.max:1)),options:e.isRef(l.options)||e.isReactive(l.options)?e.toRef(l,"options"):e.ref(l.options)}))(l),h=e.ref(),m=e.ref(),g=e.ref(!1);e.watch((()=>g.value),(()=>{g.value?(a.emit("opened"),l.searchable?(m.value&&m.value._.refs.input!==document.activeElement&&m.value._.refs.input.focus(),a.emit("search:focus")):h.value.focus()):(l.searchable?(m.value&&m.value._.refs.input===document.activeElement&&m.value._.refs.input.blur(),l.clearOnClose&&F(),a.emit("search:blur")):h.value.blur(),a.emit("closed"))}));const f=()=>{l.disabled||(g.value=!0)},y=()=>{g.value=!1};e.watch((()=>l.disabled),(()=>y()));const b=e.ref(),B=(V=b,I=()=>l.modelValue,w=e.ref("0"),k=function(){e.nextTick((function(){V.value&&(w.value=window.getComputedStyle(V.value).height)}))},e.watch(I,k),e.onMounted(k),w);var V,I,w,k;const M=e.computed((()=>l.searchable&&l.multiple&&l.taggable?"22px":"0px")),N=e.computed((()=>parseFloat(B.value)+parseFloat(M.value)+"px")),C=e.ref(""),S=e.ref([]),x=()=>{if(l.multiple){if(!1===Array.isArray(l.modelValue))return!1;if(S.value.length!==l.modelValue.length)return!1;if(Object.keys(S.value).some((e=>S.value[e]!==i(v.value,l.modelValue[e],{valueBy:n.value}))))return!1}else{if(0===S.value.length&&l.modelValue!==l.emptyModelValue)return!1;if(1===S.value.length&&l.modelValue===l.emptyModelValue)return!1;if(S.value[0]!==i(v.value,l.modelValue,{valueBy:n.value}))return!1}return!0},D=()=>{if(x())return;S.value=[];const e=l.multiple?l.modelValue:l.modelValue===l.emptyModelValue?[]:[l.modelValue];for(const l of e){const e=i(v.value,l,{valueBy:n.value});!1!==u(v.value,e,{valueBy:n.value})&&(S.value=d(S.value,e,{max:1/0,valueBy:n.value}))}};D(),e.watch((()=>l.modelValue),(()=>D()),{deep:!0});e.watch((()=>S),(()=>(()=>{if(x())return;const e=S.value.map((e=>n.value(e)));l.multiple?a.emit("update:modelValue",e):e.length?a.emit("update:modelValue",e[0]):a.emit("update:modelValue",l.emptyModelValue)})()),{deep:!0}),e.watch((()=>v.value),(()=>{const e=new Set(S.value.map((e=>n.value(e))));S.value=v.value.filter((l=>e.has(n.value(l))))}),{deep:!0});const F=()=>{m.value._.refs.input.value="",m.value._.refs.input.dispatchEvent(new Event("input")),m.value._.refs.input.dispatchEvent(new Event("change"))},O=e.computed((()=>{const e=new Set(S.value.map((e=>n.value(e)))),a=null!==l.visibleOptions?new Set(l.visibleOptions.map((e=>n.value(e)))):new Set(v.value.map((e=>n.value(e))));return v.value.map((u=>({key:t.value(u),label:o.value(u),selected:e.has(n.value(u)),visible:a.has(n.value(u)),hidden:!!l.hideSelected&&e.has(n.value(u)),originalOption:u})))})),A=e.computed((()=>({"data-is-focusing":g.value,"data-visible-length":O.value.filter((e=>e.visible&&!1===e.hidden)).length,"data-not-selected-length":v.value.length-O.value.filter((e=>e.selected)).length,"data-selected-length":O.value.filter((e=>e.selected)).length,"data-addable":O.value.filter((e=>e.selected)).lengthe.selected)).length>c.value,"data-total-length":v.value.length,"data-multiple":l.multiple})));e.provide("dataAttrs",A);const T=e.computed((()=>{const e=O.value.filter((e=>e.selected));return l.multiple?0===e.length?l.placeholder:1===e.length?"1 option selected":e.length+" options selected":0===e.length?l.placeholder:e[0].label+""}));return{isFocusing:g,wrapper:h,input:m,focus:f,blur:y,toggle:()=>{g.value?y():f()},header:b,headerAndInputHeight:N,searchingInputValue:C,handleInputForInput:e=>{a.emit("search:input",e)},handleChangeForInput:e=>{a.emit("search:change",e)},handleFocusForInput:e=>{f()},handleBlurForInput:e=>{y()},optionsWithInfo:O,addOrRemoveOption:(e,t)=>{if(!l.disabled){if(t=t.originalOption,u(S.value,t,{valueBy:n.value}))S.value=r(S.value,t,{min:c.value,valueBy:n.value}),a.emit("removed",t);else{if(!l.multiple){const e=S.value[0];S.value=r(S.value,S.value[0],{min:0,valueBy:n.value}),a.emit("removed",e)}S.value=d(S.value,t,{max:p.value,valueBy:n.value}),a.emit("selected",t)}!0===l.closeOnSelect&&(g.value=!1),!0===l.clearOnSelect&&C.value&&F()}},dataAttrs:A,innerPlaceholder:T}},components:{VInput:l,VTags:t,VDropdown:o},__VERSION__:"1.2.1"};const p={ref:"header",class:"vue-select-header"},v={key:0,class:"vue-input"},h={class:"icon loading"},m=e.createVNode("div",null,null,-1),g=e.createVNode("div",null,null,-1),f=e.createVNode("div",null,null,-1),y={class:"icon loading"},b=e.createVNode("div",null,null,-1),B=e.createVNode("div",null,null,-1),V=e.createVNode("div",null,null,-1);return c.render=function(l,a,t,o,n,u){const i=e.resolveComponent("v-tags"),d=e.resolveComponent("v-input"),r=e.resolveComponent("v-dropdown");return e.openBlock(),e.createBlock("div",e.mergeProps({ref:"wrapper",class:["vue-select",{disabled:l.disabled}],tabindex:l.isFocusing?-1:l.tabindex,onFocus:a[9]||(a[9]=(...e)=>l.focus&&l.focus(...e)),onBlur:a[10]||(a[10]=()=>!l.searchable&&l.blur())},l.dataAttrs),[e.createVNode("div",p,[l.multiple&&l.taggable&&0===l.modelValue.length||!1===l.searchable&&!1===l.taggable?(e.openBlock(),e.createBlock("div",v,[e.createVNode("input",{placeholder:l.innerPlaceholder,readonly:"",onClick:a[1]||(a[1]=(...e)=>l.focus&&l.focus(...e))},null,8,["placeholder"])])):e.createCommentVNode("v-if",!0),l.multiple&&l.taggable?(e.openBlock(),e.createBlock(e.Fragment,{key:1},[e.createVNode(i,{modelValue:l.optionsWithInfo,"collapse-tags":l.collapseTags,tabindex:"-1",onClick:l.focus},{default:e.withCtx((({option:a})=>[e.renderSlot(l.$slots,"tag",{option:a.originalOption},(()=>[e.createVNode("span",null,e.toDisplayString(a.label),1),e.createVNode("img",{src:"data:image/svg+xml;base64,PHN2ZyBpZD0iZGVsZXRlIiBkYXRhLW5hbWU9ImRlbGV0ZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgNTEyIDUxMiI+PHRpdGxlPmRlbGV0ZTwvdGl0bGU+PHBhdGggZD0iTTI1NiwyNEMzODMuOSwyNCw0ODgsMTI4LjEsNDg4LDI1NlMzODMuOSw0ODgsMjU2LDQ4OCwyNC4wNiwzODMuOSwyNC4wNiwyNTYsMTI4LjEsMjQsMjU2LDI0Wk0wLDI1NkMwLDM5Ny4xNiwxMTQuODQsNTEyLDI1Niw1MTJTNTEyLDM5Ny4xNiw1MTIsMjU2LDM5Ny4xNiwwLDI1NiwwLDAsMTE0Ljg0LDAsMjU2WiIgZmlsbD0iIzViNWI1ZiIvPjxwb2x5Z29uIHBvaW50cz0iMzgyIDE3Mi43MiAzMzkuMjkgMTMwLjAxIDI1NiAyMTMuMjkgMTcyLjcyIDEzMC4wMSAxMzAuMDEgMTcyLjcyIDIxMy4yOSAyNTYgMTMwLjAxIDMzOS4yOCAxNzIuNzIgMzgyIDI1NiAyOTguNzEgMzM5LjI5IDM4MS45OSAzODIgMzM5LjI4IDI5OC43MSAyNTYgMzgyIDE3Mi43MiIgZmlsbD0iIzViNWI1ZiIvPjwvc3ZnPg==",alt:"delete tag",class:"icon delete",onClick:e.withModifiers((()=>l.addOrRemoveOption(l.$event,a)),["prevent","stop"])},null,8,["onClick"])]))])),_:1},8,["modelValue","collapse-tags","onClick"]),e.createVNode("span",{class:["icon arrow-downward",{active:l.isFocusing}],onClick:a[2]||(a[2]=(...e)=>l.toggle&&l.toggle(...e)),onMousedown:a[3]||(a[3]=e.withModifiers((()=>{}),["prevent","stop"]))},null,34)],64)):(e.openBlock(),e.createBlock(e.Fragment,{key:2},[l.searchable?(e.openBlock(),e.createBlock(d,{key:0,ref:"input",modelValue:l.searchingInputValue,"onUpdate:modelValue":a[4]||(a[4]=e=>l.searchingInputValue=e),disabled:l.disabled,placeholder:l.isFocusing?l.searchPlaceholder:l.innerPlaceholder,onInput:l.handleInputForInput,onChange:l.handleChangeForInput,onFocus:l.handleFocusForInput,onBlur:l.handleBlurForInput,onEscape:l.blur,autofocus:l.autofocus||l.taggable&&l.searchable,tabindex:l.tabindex},null,8,["modelValue","disabled","placeholder","onInput","onChange","onFocus","onBlur","onEscape","autofocus","tabindex"])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createVNode("span",h,[m,g,f],512),[[e.vShow,l.loading]]),e.withDirectives(e.createVNode("span",{class:["icon arrow-downward",{active:l.isFocusing}],onClick:a[5]||(a[5]=(...e)=>l.toggle&&l.toggle(...e)),onMousedown:a[6]||(a[6]=e.withModifiers((()=>{}),["prevent","stop"]))},null,34),[[e.vShow,!1===l.loading]])],64))],512),l.multiple&&l.taggable&&l.searchable?e.withDirectives((e.openBlock(),e.createBlock(d,{key:0,ref:"input",modelValue:l.searchingInputValue,"onUpdate:modelValue":a[7]||(a[7]=e=>l.searchingInputValue=e),disabled:l.disabled,placeholder:l.searchPlaceholder,onInput:l.handleInputForInput,onChange:l.handleChangeForInput,onFocus:l.handleFocusForInput,onBlur:l.handleBlurForInput,onEscape:l.blur,tabindex:l.tabindex,autofocus:l.autofocus||l.taggable&&l.searchable},{append:e.withCtx((()=>[e.withDirectives(e.createVNode("span",y,[b,B,V],512),[[e.vShow,l.loading]])])),_:1},8,["modelValue","disabled","placeholder","onInput","onChange","onFocus","onBlur","onEscape","tabindex","autofocus"])),[[e.vShow,l.isFocusing]]):e.createCommentVNode("v-if",!0),e.withDirectives(e.createVNode(r,{modelValue:l.optionsWithInfo,"onUpdate:modelValue":a[8]||(a[8]=e=>l.optionsWithInfo=e),onClick:l.addOrRemoveOption,"header-height":l.headerAndInputHeight},{default:e.withCtx((({option:a})=>[e.renderSlot(l.$slots,"dropdown-item",{option:a.originalOption},(()=>[e.createVNode("span",null,e.toDisplayString(a.label),1)]))])),_:1},8,["modelValue","onClick","header-height"]),[[e.vShow,l.isFocusing]])],16,["tabindex"])},c.__file="src/index.vue",c}(Vue);