diff --git a/dist/svelecte-element.mjs b/dist/svelecte-element.mjs index 829a269..a6cb974 100644 --- a/dist/svelecte-element.mjs +++ b/dist/svelecte-element.mjs @@ -1 +1 @@ -function e(){}function t(e){return e()}function n(){return Object.create(null)}function i(e){e.forEach(t)}function l(e){return"function"==typeof e}function s(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function r(t,...n){if(null==t)return e;const i=t.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}function o(e,t,n){e.$$.on_destroy.push(r(t,n))}function a(e,t,n,i){if(e){const l=c(e,t,n,i);return e[0](l)}}function c(e,t,n,i){return e[1]&&i?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](i(t))):n.ctx}function d(e,t,n,i){if(e[2]&&i){const l=e[2](i(n));if(void 0===t.dirty)return l;if("object"==typeof l){const e=[],n=Math.max(t.dirty.length,l.length);for(let i=0;i32){const t=[],n=e.ctx.length/32;for(let e=0;ee.removeEventListener(t,n,i)}function A(e){return function(t){return t.preventDefault(),e.call(this,t)}}function I(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function k(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function C(e,t){e.value=null==t?"":t}let O,E;function F(){if(void 0===O){O=!1;try{"undefined"!=typeof window&&window.parent&&window.parent.document}catch(e){O=!0}}return O}function T(e,t,n){e.classList[n?"add":"remove"](t)}class D{constructor(){this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.e=$(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t{const i=e.$$.callbacks[t];if(i){const l=function(e,t,n=!1){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,!1,t),i}(t,n);i.slice().forEach((t=>{t.call(e,l)}))}}}function R(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach((e=>e.call(this,t)))}const N=[],V=[],_=[],B=[],q=Promise.resolve();let G=!1;function W(){G||(G=!0,q.then(X))}function K(){return W(),q}function Q(e){_.push(e)}let U=!1;const J=new Set;function X(){if(!U){U=!0;do{for(let e=0;e{Y.delete(e),i&&(n&&e.d(1),i())})),e.o(t)}}function se(e,t){le(e,1,1,(()=>{t.delete(e.key)}))}function re(e){e&&e.c()}function oe(e,n,s,r){const{fragment:o,on_mount:a,on_destroy:c,after_update:d}=e.$$;o&&o.m(n,s),r||Q((()=>{const n=a.map(t).filter(l);c?c.push(...n):i(n),e.$$.on_mount=[]})),d.forEach(Q)}function ae(e,t){const n=e.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function ce(t,l,s,r,o,a,c,d=[-1]){const u=E;M(t);const h=t.$$={fragment:null,ctx:null,props:a,update:e,not_equal:o,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(u?u.$$.context:[])),callbacks:n(),dirty:d,skip_bound:!1,root:l.target||u.$$.root};c&&c(h.root);let p=!1;if(h.ctx=s?s(t,l.props||{},((e,n,...i)=>{const l=i.length?i[0]:n;return h.ctx&&o(h.ctx[e],h.ctx[e]=l)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](l),p&&function(e,t){-1===e.$$.dirty[0]&&(N.push(e),W(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}var ue=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};ue.prototype.tokenize=function(e,t){if(!(e=me(String(e||"").toLowerCase()))||!e.length)return[];var n,i,l,s,r=[],o=e.split(/ +/);for(n=0,i=o.length;n0)&&i.items.push({score:n,id:l})})):r.iterator(r.items,(function(e,t){i.items.push({score:1,id:t})})),(l=r.getSortFunction(i,t))&&i.items.sort(l),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i};var he=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:e(t=ve(String(t||"")))?1:t>e?-1:0},pe=function(e,t){var n,i,l,s;for(n=1,i=arguments.length;n'+s+"";$e||($e=document.createElement("div"),$e.className="sv-item-content"),$e.innerHTML=s;return ve(n).split(" ").filter((e=>e)).forEach((e=>{Se($e,e)})),$e.outerHTML}const Se=function(e,t){let n=0;if(3===e.nodeType){const i=ve(e.data);let l=i.indexOf(t);if(l-=i.substr(0,l).toUpperCase().length-i.substr(0,l).length,l>=0){const i=document.createElement("span");i.className="highlight";const s=e.splitText(l);s.splitText(t.length);const r=s.cloneNode(!0);i.appendChild(r),s.parentNode.replaceChild(i,s),n=1}}else if(1===e.nodeType&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&("highlight"!==e.className||"SPAN"!==e.tagName))for(var i=0;is.includes(e))).concat([Object.keys(e)[n]]).shift()}return l}const Ae={disabled:!1,valueField:null,labelField:null,disabledField:"$disabled",placeholder:"Select",searchable:!0,clearable:!1,selectOnTab:!1,resetOnBlur:!0,fetchResetOnBlur:!0,multiple:!1,max:0,collapseSelection:!1,creatable:!1,creatablePrefix:"*",keepCreated:!0,allowEditing:!1,delimiter:",",fetchCallback:null,minQuery:1,lazyDropdown:!0,virtualList:!1,vlItemSize:null,vlHeight:null,i18n:{empty:"No options",nomatch:"No matching options",max:e=>`Maximum items ${e} selected`,fetchBefore:"Type to search",fetchQuery:e=>`Type ${e>1?`at least ${e} characters `:""}to search`,fetchEmpty:"No data related to your search",collapsedSelection:e=>`${e} selected`,createRowLabel:e=>`Create '${e}'`},collapseSelectionFn:function(e,t){return Ae.i18n.collapsedSelection(e)}},Ie=[];function ke(t,n=e){let i;const l=new Set;function r(e){if(s(t,e)&&(t=e,i)){const e=!Ie.length;for(const e of l)e[1](),Ie.push(e,t);if(e){for(let e=0;e{l.delete(a),0===l.size&&(i(),i=null)}}}}function Ce(e,t,n){if(e&&!t){const t=Array.isArray(e)?e:[e];return this.reduce(((e,i)=>(t.includes(i[n])&&e.push(i),e)),[])}return t?Array.isArray(t)?t:[t]:[]}function Oe(e,t){const n=e.reduce(((e,n,i)=>t.isOptionArray?(e.push({[t.valueField]:i,[t.labelField]:n}),e):n.options&&n.options.length?(t.optionsWithGroups=!0,e.push({label:n.label,$isGroupHeader:!0}),e.push(...n.options.map((e=>(e.$isGroupItem=!0,e)))),e):(e.push(n),e)),[]);return function(e,t){t.isOptionArray&&(t.optionProps||(t.optionProps=["value","label"]));e.some((e=>!e.$isGroupHeader&&(t.optionProps=Ee(e),!0)))}(n,t),n}function Ee(e){e.options&&(e=e.options[0]);const t=["$disabled","$isGroupHeader","$isGroupItem"];return Object.keys(e).filter((e=>!t.includes(e)))}function Fe(e){g(e,"svelte-mtw92l",".inputBox.svelte-mtw92l{box-sizing:content-box;width:19px;background:rgba(0, 0, 0, 0) none repeat scroll 0px center;border:0px none;font-size:inherit;font-family:inherit;opacity:1;outline:currentcolor none 0px;padding:0px;color:inherit;margin:-2px 0 0;height:20px}.inputBox.svelte-mtw92l:read-only{width:100%}.shadow-text.svelte-mtw92l{opacity:0;position:absolute;left:100%;z-index:-100;min-width:24px;white-space:nowrap;top:0;left:0}")}function Te(t){let n,l,s,r,o,a,c,d;return{c(){n=$("input"),s=w(),r=$("div"),o=x(t[9]),I(n,"type","text"),I(n,"class","inputBox svelte-mtw92l"),n.disabled=t[1],n.readOnly=l=!t[0],I(n,"style",t[8]),I(n,"placeholder",t[5]),I(r,"class","shadow-text svelte-mtw92l"),Q((()=>t[24].call(r)))},m(e,i){var l;b(e,n,i),t[22](n),C(n,t[6]),b(e,s,i),b(e,r,i),m(r,o),a=function(e,t){"static"===getComputedStyle(e).position&&(e.style.position="relative");const n=$("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const i=F();let l;return i?(n.src="data:text/html,