@digibib/deichman-admin-frontend-common
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -11,2 +11,8 @@ # Changelog | ||
## 2.6.0 | ||
* `Added` Autocomplete - Added flag `resetFilterOnSubmit`. Note that setting both, `submitOnFilterChange` and | ||
`resetFilterOnSubmit` might have no useful meaning, since the select event is fired with an empty value as the filter is | ||
reset, or at least special handling logic is needed on the caller side. | ||
## 2.5.0 | ||
@@ -13,0 +19,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("svelte/internal"),require("svelte")):"function"==typeof define&&define.amd?define(["exports","svelte/internal","svelte"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Autocomplete={},e["svelte/internal"],e.svelte)}(this,(function(e,t,i){"use strict";class n{constructor({originalItem:e,displayLabel:t,originalLabel:i,highlighted:n}){this._originalItem=e,this._displayLabel=t,this._originalLabel=i,this._highlighted=n,this.key=Symbol(),this._index=0}get originalItem(){return this._originalItem}get originalLabel(){return this._originalLabel}get index(){return this._index}set index(e){this._index=e}get displayLabel(){return this._displayLabel}set displayLabel(e){this._displayLabel=e}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e}}class l{constructor(e,t){this.labelFunction=t,this.items=e.map(this.convertItem.bind(this)),this.sortItems()}filter(e,t=!1,i=!1){const n=new RegExp(`${i?"^":""}${l.escapeRegExp(e)}`,t?"":"i");return this.items.filter(t=>""===e||t.originalLabel.match(n)).map((e,t)=>(e.index=t,e.displayLabel=e.originalLabel.replace(n,(function(e){return""!=e?`<B>${e}</B>`:""})),e))}addItem(e){this.items=[...this.items,this.convertItem(e)],this.sortItems()}remove(e){this.items=this.items.filter(t=>t.key!==e.key)}hasItems(){return 0!==this.items.length}static escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}sortItems(){this.items.sort((e,t)=>e.originalLabel.localeCompare(t.originalLabel))}convertItem(e){return new n({originalItem:e,displayLabel:this.labelFunction(e),originalLabel:this.labelFunction(e),highlighted:!1})}}var s;!function(e){e.FIRST_FILTERED="first_filtered",e.SINGLE_ONLY="single_only"}(s||(s={}));var r=s;const{FIRST_FILTERED:o,SINGLE_ONLY:h}=r;class a{constructor(e=!1,t=!0,i=o,n=!1){this._opened=!1,this._userOpened=!1,this._highlightedItem=null,this.filterText="",this._filteredItems=[],this.internalItems=null,this.filterCaseSensitive=e,this.rollOverHighlight=t,this.filterHighlightMode=i,this.matchOnStart=n}highlight(e){return null!=this._highlightedItem&&(this._highlightedItem.highlighted=!1,this._highlightedItem=null),null!=e?(e.highlighted=!0,this._highlightedItem=e):this._highlightedItem=null,this}highlightNext(){if(null!=this._highlightedItem){const e=this.getNextIndex(),t=-1===e?null:this._filteredItems[e];this.highlight(t)}else this._filteredItems.length>0&&this.highlight(this._filteredItems[0]);return this}getNextIndex(){const e=this._highlightedItem.index+1<this._filteredItems.length?this._highlightedItem.index+1:0;return 0!==e||this.rollOverHighlight?e:-1}highlightPrev(){if(null!=this._highlightedItem){const e=this.getPrevIndex(),t=-1===e?null:this._filteredItems[e];this.highlight(t)}else this._filteredItems.length>0&&this.highlight(this._filteredItems[this._filteredItems.length-1]);return this}getPrevIndex(){const e=0===this._highlightedItem.index?this._filteredItems.length-1:this._highlightedItem.index-1;return e!==this.filteredItems.length-1||this.rollOverHighlight?e:-1}shiftHighlightBy(e){if(null!=this._highlightedItem){const t=this._highlightedItem.index,i=Math.min(Math.max(0,t+e),this._filteredItems.length-1);this.highlight(this._filteredItems[i])}return this}setOpened(e){return this._opened=e,e?this._userClosed=!1:this._userOpened=!1,this._opened||this.filterHighlightMode===h&&this._filteredItems.length>1&&this.highlight(null),this}get opened(){return this._opened}setUserOpened(e){return this._userOpened=e,this}setItems(e,t){return this.internalItems=new l(e,t),this.filter(this.filterText),this.highlight(null),this}hasItems(){return this.internalItems.hasItems()}addItem(e){var t;return null===(t=this.internalItems)||void 0===t||t.addItem(e),this.filter(this.filterText),this}filter(e){var t,i;return this.filterText=e,this._filteredItems=null!==(i=null===(t=this.internalItems)||void 0===t?void 0:t.filter(this.filterText,this.filterCaseSensitive,this.matchOnStart))&&void 0!==i?i:[],0===this._filteredItems.length?this.highlight(null):this.updateHighlight(),this}updateHighlight(){if(this.highlightFilteredOut()||null==this.highlightedItem)switch(this.filterHighlightMode){case r.FIRST_FILTERED:this.highlight(this._filteredItems[0]);break;case r.SINGLE_ONLY:this.highlight(1===this._filteredItems.length?this._filteredItems[0]:null)}}highlightFilteredOut(){return null!=this._highlightedItem&&!this._filteredItems.some(e=>e.key===this._highlightedItem.key)}isHighlighted(e){var t;return(null===(t=this._highlightedItem)||void 0===t?void 0:t.key)===e.key}removeHighlighted(){if(null!=this._highlightedItem){const e=Math.max(this._highlightedItem.index-1,0);this.internalItems.remove(this._highlightedItem),this._filteredItems=this._filteredItems.filter(e=>e.key!==this._highlightedItem.key),this._filteredItems.forEach((e,t)=>e.index=t),this._filteredItems.length>0?this.highlight(this._filteredItems[e]):this.highlight(null)}return this}get userClosed(){return this._userClosed}set userClosed(e){this._userClosed=e}get userOpened(){return this._userOpened}set userOpened(e){this._userOpened=e}get highlightedItem(){return this._highlightedItem}get filteredItems(){return this._filteredItems}}var d;!function(e){e.AC_LIST="ac-list",e.AC_LIST_ITEM="ac-list-item",e.CLOSE_LIST="close-list",e.OPEN_LIST="open-list",e.ROOT="root"}(d||(d={}));var u=d;const{window:g}=t.globals;function c(e){t.append_styles(e,"svelte-aniw8a","div.autocomplete.svelte-aniw8a{position:relative;display:flex;align-content:center;justify-content:start}label.input-label.svelte-aniw8a{text-align:right;color:#aaaaaa;white-space:nowrap;min-width:6rem;margin:auto 0}input.svelte-aniw8a{display:inline-block;width:auto;min-width:10rem}input.wide.svelte-aniw8a{width:100%}div.input-and-icons.svelte-aniw8a{position:relative;display:flex;align-items:center;justify-content:stretch}div.input-and-icons.wide.svelte-aniw8a{width:100%}div.dropdown.svelte-aniw8a{background:#fff;position:absolute;max-width:100%;min-width:200px;overflow-y:auto;z-index:99;padding:0 0;top:0;border:1px solid #999;max-height:calc(10 * (1rem + 10px) + 15px);user-select:none}div.dropdown.hidden.svelte-aniw8a{visibility:hidden}div.list-item.highlighted.svelte-aniw8a{background-color:#bbbb}div.openClose.svelte-aniw8a{display:inline-block;position:relative;left:-1.2rem;font-size:0.7rem;user-select:none;width:1.5rem}div.openClose.wide.svelte-aniw8a{position:absolute;left:calc(100% - 1.2rem)}div.openClose.arrow.svelte-aniw8a{transform:scale(1.5, 1)}div.openClose.circle.svelte-aniw8a{transform:scale(1.5, 1.5)}div.openClose.svelte-aniw8a:hover{cursor:pointer}")}function p(e,t,i){const n=e.slice();return n[67]=t[i],n}const m=e=>({item:8192&e[0],displayLabel:8192&e[0]}),f=e=>({item:e[67].originalItem,displayLabel:e[67].displayLabel}),_=e=>({}),I=e=>({}),v=e=>({}),w=e=>({});function b(e){let i,n,l,s;const r=[x,y],o=[];function h(e,t){return e[13].opened?0:1}return i=h(e),n=o[i]=r[i](e),{c(){n.c(),l=t.empty()},m(e,n){o[i].m(e,n),t.insert(e,l,n),s=!0},p(e,s){let a=i;i=h(e),i===a?o[i].p(e,s):(t.group_outros(),t.transition_out(o[a],1,1,()=>{o[a]=null}),t.check_outros(),n=o[i],n?n.p(e,s):(n=o[i]=r[i](e),n.c()),t.transition_in(n,1),n.m(l.parentNode,l))},i(e){s||(t.transition_in(n),s=!0)},o(e){t.transition_out(n),s=!1},d(e){o[i].d(e),e&&t.detach(l)}}}function y(e){let i,n,l,s;const r=e[44].openIcon,o=t.create_slot(r,e,e[43],I),h=o||function(e){let i;return{c(){i=t.text("ᐯ")},m(e,n){t.insert(e,i,n)},d(e){e&&t.detach(i)}}}();return{c(){i=t.element("div"),h&&h.c(),t.attr(i,"class","openClose arrow svelte-aniw8a"),t.attr(i,"data-testid",u.OPEN_LIST),t.toggle_class(i,"wide",e[8])},m(r,o){t.insert(r,i,o),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[49]),l=!0)},p(e,l){o&&o.p&&(!n||4096&l[1])&&t.update_slot_base(o,r,e,e[43],n?t.get_slot_changes(r,e[43],l,_):t.get_all_dirty_from_scope(e[43]),I),256&l[0]&&t.toggle_class(i,"wide",e[8])},i(e){n||(t.transition_in(h,e),n=!0)},o(e){t.transition_out(h,e),n=!1},d(e){e&&t.detach(i),h&&h.d(e),l=!1,s()}}}function x(e){let i,n,l,s;const r=e[44].closeIcon,o=t.create_slot(r,e,e[43],w),h=o||function(e){let i;return{c(){i=t.text("Ⓧ")},m(e,n){t.insert(e,i,n)},d(e){e&&t.detach(i)}}}();return{c(){i=t.element("div"),h&&h.c(),t.attr(i,"class","openClose circle svelte-aniw8a"),t.attr(i,"data-testid",u.CLOSE_LIST),t.toggle_class(i,"wide",e[8])},m(r,o){t.insert(r,i,o),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[48]),l=!0)},p(e,l){o&&o.p&&(!n||4096&l[1])&&t.update_slot_base(o,r,e,e[43],n?t.get_slot_changes(r,e[43],l,v):t.get_all_dirty_from_scope(e[43]),w),256&l[0]&&t.toggle_class(i,"wide",e[8])},i(e){n||(t.transition_in(h,e),n=!0)},o(e){t.transition_out(h,e),n=!1},d(e){e&&t.detach(i),h&&h.d(e),l=!1,s()}}}function O(e){let i,n,l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[5].hits:e[5].hit}`;return{c(){i=t.element("label"),n=t.text(l),t.attr(i,"class","input-label svelte-aniw8a"),t.attr(i,"for",e[17])},m(e,l){t.insert(e,i,l),t.append(i,n)},p(e,i){8224&i[0]&&l!==(l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[5].hits:e[5].hit}`)&&t.set_data(n,l)},d(e){e&&t.detach(i)}}}function S(e){let i,n,l=e[5].noHit+"";return{c(){i=t.element("div"),n=t.text(l),t.attr(i,"class","list-item")},m(e,l){t.insert(e,i,l),t.append(i,n)},p(e,i){32&i[0]&&l!==(l=e[5].noHit+"")&&t.set_data(n,l)},i:t.noop,o:t.noop,d(e){e&&t.detach(i)}}}function L(e){let i,n,l=e[13].filteredItems,s=[];for(let t=0;t<l.length;t+=1)s[t]=C(p(e,l,t));const r=e=>t.transition_out(s[e],1,1,()=>{s[e]=null});return{c(){for(let e=0;e<s.length;e+=1)s[e].c();i=t.empty()},m(e,l){for(let t=0;t<s.length;t+=1)s[t].m(e,l);t.insert(e,i,l),n=!0},p(e,n){if(84025344&n[0]|4096&n[1]){let o;for(l=e[13].filteredItems,o=0;o<l.length;o+=1){const r=p(e,l,o);s[o]?(s[o].p(r,n),t.transition_in(s[o],1)):(s[o]=C(r),s[o].c(),t.transition_in(s[o],1),s[o].m(i.parentNode,i))}for(t.group_outros(),o=l.length;o<s.length;o+=1)r(o);t.check_outros()}},i(e){if(!n){for(let e=0;e<l.length;e+=1)t.transition_in(s[e]);n=!0}},o(e){s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)t.transition_out(s[e]);n=!1},d(e){t.destroy_each(s,e),e&&t.detach(i)}}}function C(e){let i,n,l,s,r;const o=e[44].listItem,h=t.create_slot(o,e,e[43],f),a=h||function(e){let i,n,l=e[67].displayLabel+"";return{c(){i=new t.HtmlTag(!1),n=t.empty(),i.a=n},m(e,s){i.m(l,e,s),t.insert(e,n,s)},p(e,t){8192&t[0]&&l!==(l=e[67].displayLabel+"")&&i.p(l)},d(e){e&&t.detach(n),e&&i.d()}}}(e);function d(){return e[50](e[67])}return{c(){i=t.element("div"),a&&a.c(),n=t.space(),t.attr(i,"data-testid",u.AC_LIST_ITEM),t.attr(i,"class",t.null_to_empty("list-item "+e[17])+" svelte-aniw8a"),t.toggle_class(i,"highlighted",e[13].isHighlighted(e[67]))},m(o,h){t.insert(o,i,h),a&&a.m(i,null),t.append(i,n),l=!0,s||(r=[t.listen(i,"pointerenter",d),t.listen(i,"mousedown",e[51])],s=!0)},p(n,s){e=n,h?h.p&&(!l||8192&s[0]|4096&s[1])&&t.update_slot_base(h,o,e,e[43],l?t.get_slot_changes(o,e[43],s,m):t.get_all_dirty_from_scope(e[43]),f):a&&a.p&&(!l||8192&s[0])&&a.p(e,l?s:[-1,-1,-1]),8192&s[0]&&t.toggle_class(i,"highlighted",e[13].isHighlighted(e[67]))},i(e){l||(t.transition_in(a,e),l=!0)},o(e){t.transition_out(a,e),l=!1},d(e){e&&t.detach(i),a&&a.d(e),s=!1,t.run_all(r)}}}function $(e){let i,n,l,s,r,o,h,a,d,c,p,m,f,_,I,v,w,y=[{autocomplete:"off"},{class:s=e[4].join(" ")},{id:e[17]},{style:e[3]},{tabindex:e[9]},{placeholder:r=e[13].hasItems()?e[10]:void 0},{disabled:o=!e[13].hasItems()},{type:"text"},e[11]],x={};for(let e=0;e<y.length;e+=1)x=t.assign(x,y[e]);let C=e[13].filteredItems.length>0&&b(e),$=e[7]&&O(e);const T=[L,S],F=[];function H(e,t){return e[13].filteredItems.length>0?0:e[12]?-1:1}return~(p=H(e))&&(m=F[p]=T[p](e)),{c(){i=t.element("div"),n=t.element("div"),l=t.element("input"),h=t.space(),C&&C.c(),a=t.space(),$&&$.c(),d=t.space(),c=t.element("div"),m&&m.c(),t.set_attributes(l,x),t.toggle_class(l,"wide",e[8]),t.toggle_class(l,"svelte-aniw8a",!0),t.attr(n,"class","input-and-icons svelte-aniw8a"),t.toggle_class(n,"wide",e[8]),t.attr(c,"data-testid",u.AC_LIST),t.attr(c,"class","dropdown svelte-aniw8a"),t.attr(c,"style",f="z-index: "+(e[6]+1)),t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[12]&&0===e[13].filteredItems.length),t.attr(i,"class",_=t.null_to_empty(`autocomplete ${e[17]} ${e[1].join(" ")}`)+" svelte-aniw8a"),t.attr(i,"style",e[2]),t.attr(i,"data-testid",u.ROOT)},m(s,r){t.insert(s,i,r),t.append(i,n),t.append(n,l),l.autofocus&&l.focus(),e[46](l),t.set_input_value(l,e[0]),t.append(n,h),C&&C.m(n,null),t.append(i,a),$&&$.m(i,null),t.append(i,d),t.append(i,c),~p&&F[p].m(c,null),e[52](c),e[53](i),I=!0,v||(w=[t.listen(g,"mousedown",e[25]),t.listen(g,"scroll",e[45]),t.listen(l,"input",e[47]),t.listen(l,"blur",e[19]),t.listen(l,"dblclick",e[23]),t.listen(l,"focus",e[18]),t.listen(l,"keydown",e[22]),t.listen(c,"pointerleave",e[27]),t.listen(c,"keydown",t.prevent_default(N)),t.listen(c,"scroll",t.stop_propagation(t.prevent_default(k))),t.listen(i,"mousedown",t.stop_propagation(t.prevent_default(e[54])))],v=!0)},p(e,h){t.set_attributes(l,x=t.get_spread_update(y,[{autocomplete:"off"},(!I||16&h[0]&&s!==(s=e[4].join(" ")))&&{class:s},{id:e[17]},(!I||8&h[0])&&{style:e[3]},(!I||512&h[0])&&{tabindex:e[9]},(!I||9216&h[0]&&r!==(r=e[13].hasItems()?e[10]:void 0))&&{placeholder:r},(!I||8192&h[0]&&o!==(o=!e[13].hasItems()))&&{disabled:o},{type:"text"},2048&h[0]&&e[11]])),1&h[0]&&l.value!==e[0]&&t.set_input_value(l,e[0]),t.toggle_class(l,"wide",e[8]),t.toggle_class(l,"svelte-aniw8a",!0),e[13].filteredItems.length>0?C?(C.p(e,h),8192&h[0]&&t.transition_in(C,1)):(C=b(e),C.c(),t.transition_in(C,1),C.m(n,null)):C&&(t.group_outros(),t.transition_out(C,1,1,()=>{C=null}),t.check_outros()),256&h[0]&&t.toggle_class(n,"wide",e[8]),e[7]?$?$.p(e,h):($=O(e),$.c(),$.m(i,d)):$&&($.d(1),$=null);let a=p;p=H(e),p===a?~p&&F[p].p(e,h):(m&&(t.group_outros(),t.transition_out(F[a],1,1,()=>{F[a]=null}),t.check_outros()),~p?(m=F[p],m?m.p(e,h):(m=F[p]=T[p](e),m.c()),t.transition_in(m,1),m.m(c,null)):m=null),(!I||64&h[0]&&f!==(f="z-index: "+(e[6]+1)))&&t.attr(c,"style",f),12288&h[0]&&t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[12]&&0===e[13].filteredItems.length),(!I||2&h[0]&&_!==(_=t.null_to_empty(`autocomplete ${e[17]} ${e[1].join(" ")}`)+" svelte-aniw8a"))&&t.attr(i,"class",_),(!I||4&h[0])&&t.attr(i,"style",e[2])},i(e){I||(t.transition_in(C),t.transition_in(m),I=!0)},o(e){t.transition_out(C),t.transition_out(m),I=!1},d(n){n&&t.detach(i),e[46](null),C&&C.d(),$&&$.d(),~p&&F[p].d(),e[52](null),e[53](null),v=!1,t.run_all(w)}}}let T=0;const N=()=>!1,k=()=>!1;function F(e,n,l){let s,o,{$$slots:h={},$$scope:d}=n;const u=i.createEventDispatcher();let{items:g=[]}=n,{labelFieldName:c=null}=n,{labelFunction:p=null}=n,{containerClassNames:m=[]}=n,{containerStyle:f=""}=n,{inputStyle:_=""}=n,{inputClassNames:I=[]}=n,{i18n:v={hit:" treff",hits:" treff",noHit:"Ingen treff"}}=n,{minCharsToSuggest:w=3}=n,{removeOnSelect:b=!1}=n,{closeOnSelect:y=!0}=n,{zIndexOffset:x=0}=n,{preferOpenUpwards:O=!1}=n,{showNumberOfHits:S=!0}=n,{caseSensitive:L=!1}=n,{wide:C=!1}=n,{tabIndex:$=null}=n,{placeholder:N=null}=n,{inputProps:k={}}=n,{allowFreeText:F=!1}=n,{submitOnFilterChange:H=!1}=n,{autoHighlightSingle:E=!1}=n,{matchOnStart:P=!1}=n,{filterText:R=""}=n;const A="autocomplete-"+T++;let D,M,U,B=!1,j=!1,z=[];function q(e=!1){l(13,o=o.setOpened(!0).setUserOpened(e)),W()}function G(e=!1){l(13,o.userClosed=e,o),l(13,o=o.setOpened(!1))}i.afterUpdate(()=>{z.forEach(e=>e()),z=[]});const Y={Escape:function(){l(0,R=""),M.blur(),l(41,B=!1),G(!0)},ArrowDown:V,ArrowUp:V,Enter:J,Backspace:function(){R.length<=1&&G()},Tab:function(){j=!0},PageDown:K,PageUp:K};function V(e){e.stopPropagation(),e.preventDefault(),o.opened?("ArrowDown"===(null==e?void 0:e.key)&&l(13,o=o.highlightNext()),"ArrowUp"===(null==e?void 0:e.key)&&l(13,o=o.highlightPrev()),X()):q(!0)}function J(e){o.opened&&(null!==o.highlightedItem?(u("select",{selected:o.highlightedItem.originalItem}),E&&l(0,R=o.highlightedItem.originalLabel),b&&(l(13,o=o.removeHighlighted()),o.hasItems()||l(0,R=""),W())):!H&&F&&R.length>0&&u("select",{selected:R}),y?G(!0):e&&b&&z.push(()=>{const e=Array.from(document.querySelectorAll(":hover")).find(e=>{var t,i;return(null===(t=e.classList)||void 0===t?void 0:t.contains(A))&&(null===(i=e.classList)||void 0===i?void 0:i.contains("list-item"))});null==e||e.dispatchEvent(new PointerEvent("pointerenter"))}))}function K(e){if(e.stopPropagation(),e.preventDefault(),o.opened){const t="PageDown"===e.key?1:-1,i=D.scrollHeight/o.filteredItems.length,n=Math.floor(D.getBoundingClientRect().height/i)-1;l(13,o=o.shiftHighlightBy(t*n)),X()}else q(!0)}function Q(e){o.isHighlighted(e)||l(13,o=o.highlight(e))}function W(){z.push(()=>Z()),X()}function X(){z.push(()=>{var e;null!=U&&o.opened&&(null===(e=null==D?void 0:D.querySelector(".highlighted"))||void 0===e||e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))})}function Z(){if(null==U)return;const{height:e,pageLeft:t}=window.visualViewport,{bottom:i,height:n,top:s}=M.getBoundingClientRect(),{height:r}=D.getBoundingClientRect();l(14,D.style.top=i+r>e||O&&s-r>t?`-${r}px`:n+"px",D)}return e.$$set=e=>{"items"in e&&l(29,g=e.items),"labelFieldName"in e&&l(30,c=e.labelFieldName),"labelFunction"in e&&l(31,p=e.labelFunction),"containerClassNames"in e&&l(1,m=e.containerClassNames),"containerStyle"in e&&l(2,f=e.containerStyle),"inputStyle"in e&&l(3,_=e.inputStyle),"inputClassNames"in e&&l(4,I=e.inputClassNames),"i18n"in e&&l(5,v=e.i18n),"minCharsToSuggest"in e&&l(32,w=e.minCharsToSuggest),"removeOnSelect"in e&&l(33,b=e.removeOnSelect),"closeOnSelect"in e&&l(34,y=e.closeOnSelect),"zIndexOffset"in e&&l(6,x=e.zIndexOffset),"preferOpenUpwards"in e&&l(35,O=e.preferOpenUpwards),"showNumberOfHits"in e&&l(7,S=e.showNumberOfHits),"caseSensitive"in e&&l(36,L=e.caseSensitive),"wide"in e&&l(8,C=e.wide),"tabIndex"in e&&l(9,$=e.tabIndex),"placeholder"in e&&l(10,N=e.placeholder),"inputProps"in e&&l(11,k=e.inputProps),"allowFreeText"in e&&l(12,F=e.allowFreeText),"submitOnFilterChange"in e&&l(37,H=e.submitOnFilterChange),"autoHighlightSingle"in e&&l(38,E=e.autoHighlightSingle),"matchOnStart"in e&&l(39,P=e.matchOnStart),"filterText"in e&&l(0,R=e.filterText),"$$scope"in e&&l(43,d=e.$$scope)},e.$$.update=()=>{var t;1073741824&e.$$.dirty[0]|1&e.$$.dirty[1]&&l(42,s=null!=p?p:null!=c?e=>e[c]:e=>e),536875008&e.$$.dirty[0]|2464&e.$$.dirty[1]&&l(13,o=new a(L,!F,E?r.SINGLE_ONLY:r.FIRST_FILTERED,P).setItems(g||[],s)),4097&e.$$.dirty[0]|64&e.$$.dirty[1]&&(t=R,l(13,o=o.filter(t)),o.opened&&W(),F&&H&&u("select",{selected:R})),8193&e.$$.dirty[0]|1026&e.$$.dirty[1]&&(R.length>=w&&!o.opened&&B&&!o.userClosed?q(!1):(o.opened&&!o.userOpened&&R.length<w||!B||o.userClosed)&&G())},[R,m,f,_,I,v,x,S,C,$,N,k,F,o,D,M,U,A,function(){l(41,B=!0)},function(){const e=Array.from(document.querySelectorAll(":hover")).some(e=>{var t;return null===(t=e.classList)||void 0===t?void 0:t.contains(A)});l(41,B=!j&&e),z.push(()=>j=!1)},q,G,function(e){return Y[e.key]&&Y[e.key](e)},function(){!o.opened&&q(!0)},J,function(){l(41,B=!1),G()},Q,function(){F&&l(13,o=o.highlight(null))},Z,g,c,p,w,b,y,O,L,H,E,P,function(e){l(13,o=o.addItem(e))},B,s,d,h,()=>{o.opened&&Z()},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{M=e,l(15,M)})},function(){R=this.value,l(0,R)},()=>G(!0),()=>q(!0),e=>Q(e),()=>J(!0),function(e){t.binding_callbacks[e?"unshift":"push"](()=>{D=e,l(14,D)})},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{U=e,l(16,U)})},()=>M.focus()]}class H extends t.SvelteComponent{constructor(e){super(),t.init(this,e,F,$,t.safe_not_equal,{items:29,labelFieldName:30,labelFunction:31,containerClassNames:1,containerStyle:2,inputStyle:3,inputClassNames:4,i18n:5,minCharsToSuggest:32,removeOnSelect:33,closeOnSelect:34,zIndexOffset:6,preferOpenUpwards:35,showNumberOfHits:7,caseSensitive:36,wide:8,tabIndex:9,placeholder:10,inputProps:11,allowFreeText:12,submitOnFilterChange:37,autoHighlightSingle:38,matchOnStart:39,filterText:0,addItem:40},c,[-1,-1,-1])}get addItem(){return this.$$.ctx[40]}}e.Autocomplete=H,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("svelte/internal"),require("svelte")):"function"==typeof define&&define.amd?define(["exports","svelte/internal","svelte"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Autocomplete={},e["svelte/internal"],e.svelte)}(this,(function(e,t,i){"use strict";class n{constructor({originalItem:e,displayLabel:t,originalLabel:i,highlighted:n}){this._originalItem=e,this._displayLabel=t,this._originalLabel=i,this._highlighted=n,this.key=Symbol(),this._index=0}get originalItem(){return this._originalItem}get originalLabel(){return this._originalLabel}get index(){return this._index}set index(e){this._index=e}get displayLabel(){return this._displayLabel}set displayLabel(e){this._displayLabel=e}get highlighted(){return this._highlighted}set highlighted(e){this._highlighted=e}}class l{constructor(e,t){this.labelFunction=t,this.items=e.map(this.convertItem.bind(this)),this.sortItems()}filter(e,t=!1,i=!1){const n=new RegExp(`${i?"^":""}${l.escapeRegExp(e)}`,t?"":"i");return this.items.filter(t=>""===e||t.originalLabel.match(n)).map((e,t)=>(e.index=t,e.displayLabel=e.originalLabel.replace(n,(function(e){return""!=e?`<B>${e}</B>`:""})),e))}addItem(e){this.items=[...this.items,this.convertItem(e)],this.sortItems()}remove(e){this.items=this.items.filter(t=>t.key!==e.key)}hasItems(){return 0!==this.items.length}static escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}sortItems(){this.items.sort((e,t)=>e.originalLabel.localeCompare(t.originalLabel))}convertItem(e){return new n({originalItem:e,displayLabel:this.labelFunction(e),originalLabel:this.labelFunction(e),highlighted:!1})}}var s;!function(e){e.FIRST_FILTERED="first_filtered",e.SINGLE_ONLY="single_only"}(s||(s={}));var r=s;const{FIRST_FILTERED:o,SINGLE_ONLY:h}=r;class a{constructor(e=!1,t=!0,i=o,n=!1){this._opened=!1,this._userOpened=!1,this._highlightedItem=null,this.filterText="",this._filteredItems=[],this.internalItems=null,this.filterCaseSensitive=e,this.rollOverHighlight=t,this.filterHighlightMode=i,this.matchOnStart=n}highlight(e){return null!=this._highlightedItem&&(this._highlightedItem.highlighted=!1,this._highlightedItem=null),null!=e?(e.highlighted=!0,this._highlightedItem=e):this._highlightedItem=null,this}highlightNext(){if(null!=this._highlightedItem){const e=this.getNextIndex(),t=-1===e?null:this._filteredItems[e];this.highlight(t)}else this._filteredItems.length>0&&this.highlight(this._filteredItems[0]);return this}getNextIndex(){const e=this._highlightedItem.index+1<this._filteredItems.length?this._highlightedItem.index+1:0;return 0!==e||this.rollOverHighlight?e:-1}highlightPrev(){if(null!=this._highlightedItem){const e=this.getPrevIndex(),t=-1===e?null:this._filteredItems[e];this.highlight(t)}else this._filteredItems.length>0&&this.highlight(this._filteredItems[this._filteredItems.length-1]);return this}getPrevIndex(){const e=0===this._highlightedItem.index?this._filteredItems.length-1:this._highlightedItem.index-1;return e!==this.filteredItems.length-1||this.rollOverHighlight?e:-1}shiftHighlightBy(e){if(null!=this._highlightedItem){const t=this._highlightedItem.index,i=Math.min(Math.max(0,t+e),this._filteredItems.length-1);this.highlight(this._filteredItems[i])}return this}setOpened(e){return this._opened=e,e?this._userClosed=!1:this._userOpened=!1,this._opened||this.filterHighlightMode===h&&this._filteredItems.length>1&&this.highlight(null),this}get opened(){return this._opened}setUserOpened(e){return this._userOpened=e,this}setItems(e,t){return this.internalItems=new l(e,t),this.filter(this.filterText),this.highlight(null),this}hasItems(){return this.internalItems.hasItems()}addItem(e){var t;return null===(t=this.internalItems)||void 0===t||t.addItem(e),this.filter(this.filterText),this}filter(e){var t,i;return this.filterText=e,this._filteredItems=null!==(i=null===(t=this.internalItems)||void 0===t?void 0:t.filter(this.filterText,this.filterCaseSensitive,this.matchOnStart))&&void 0!==i?i:[],0===this._filteredItems.length?this.highlight(null):this.updateHighlight(),this}updateHighlight(){if(this.highlightFilteredOut()||null==this.highlightedItem)switch(this.filterHighlightMode){case r.FIRST_FILTERED:this.highlight(this._filteredItems[0]);break;case r.SINGLE_ONLY:this.highlight(1===this._filteredItems.length?this._filteredItems[0]:null)}}highlightFilteredOut(){return null!=this._highlightedItem&&!this._filteredItems.some(e=>e.key===this._highlightedItem.key)}isHighlighted(e){var t;return(null===(t=this._highlightedItem)||void 0===t?void 0:t.key)===e.key}removeHighlighted(){if(null!=this._highlightedItem){const e=Math.max(this._highlightedItem.index-1,0);this.internalItems.remove(this._highlightedItem),this._filteredItems=this._filteredItems.filter(e=>e.key!==this._highlightedItem.key),this._filteredItems.forEach((e,t)=>e.index=t),this._filteredItems.length>0?this.highlight(this._filteredItems[e]):this.highlight(null)}return this}get userClosed(){return this._userClosed}set userClosed(e){this._userClosed=e}get userOpened(){return this._userOpened}set userOpened(e){this._userOpened=e}get highlightedItem(){return this._highlightedItem}get filteredItems(){return this._filteredItems}}var d;!function(e){e.AC_LIST="ac-list",e.AC_LIST_ITEM="ac-list-item",e.CLOSE_LIST="close-list",e.OPEN_LIST="open-list",e.ROOT="root"}(d||(d={}));var u=d;const{window:g}=t.globals;function c(e){t.append_styles(e,"svelte-aniw8a","div.autocomplete.svelte-aniw8a{position:relative;display:flex;align-content:center;justify-content:start}label.input-label.svelte-aniw8a{text-align:right;color:#aaaaaa;white-space:nowrap;min-width:6rem;margin:auto 0}input.svelte-aniw8a{display:inline-block;width:auto;min-width:10rem}input.wide.svelte-aniw8a{width:100%}div.input-and-icons.svelte-aniw8a{position:relative;display:flex;align-items:center;justify-content:stretch}div.input-and-icons.wide.svelte-aniw8a{width:100%}div.dropdown.svelte-aniw8a{background:#fff;position:absolute;max-width:100%;min-width:200px;overflow-y:auto;z-index:99;padding:0 0;top:0;border:1px solid #999;max-height:calc(10 * (1rem + 10px) + 15px);user-select:none}div.dropdown.hidden.svelte-aniw8a{visibility:hidden}div.list-item.highlighted.svelte-aniw8a{background-color:#bbbb}div.openClose.svelte-aniw8a{display:inline-block;position:relative;left:-1.2rem;font-size:0.7rem;user-select:none;width:1.5rem}div.openClose.wide.svelte-aniw8a{position:absolute;left:calc(100% - 1.2rem)}div.openClose.arrow.svelte-aniw8a{transform:scale(1.5, 1)}div.openClose.circle.svelte-aniw8a{transform:scale(1.5, 1.5)}div.openClose.svelte-aniw8a:hover{cursor:pointer}")}function p(e,t,i){const n=e.slice();return n[69]=t[i],n}const m=e=>({item:8192&e[0],displayLabel:8192&e[0]}),f=e=>({item:e[69].originalItem,displayLabel:e[69].displayLabel}),_=e=>({}),I=e=>({}),v=e=>({}),b=e=>({});function w(e){let i,n,l,s;const r=[x,y],o=[];function h(e,t){return e[13].opened?0:1}return i=h(e),n=o[i]=r[i](e),{c(){n.c(),l=t.empty()},m(e,n){o[i].m(e,n),t.insert(e,l,n),s=!0},p(e,s){let a=i;i=h(e),i===a?o[i].p(e,s):(t.group_outros(),t.transition_out(o[a],1,1,()=>{o[a]=null}),t.check_outros(),n=o[i],n?n.p(e,s):(n=o[i]=r[i](e),n.c()),t.transition_in(n,1),n.m(l.parentNode,l))},i(e){s||(t.transition_in(n),s=!0)},o(e){t.transition_out(n),s=!1},d(e){o[i].d(e),e&&t.detach(l)}}}function y(e){let i,n,l,s;const r=e[45].openIcon,o=t.create_slot(r,e,e[44],I),h=o||function(e){let i;return{c(){i=t.text("ᐯ")},m(e,n){t.insert(e,i,n)},d(e){e&&t.detach(i)}}}();return{c(){i=t.element("div"),h&&h.c(),t.attr(i,"class","openClose arrow svelte-aniw8a"),t.attr(i,"data-testid",u.OPEN_LIST),t.toggle_class(i,"wide",e[8])},m(r,o){t.insert(r,i,o),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[50]),l=!0)},p(e,l){o&&o.p&&(!n||8192&l[1])&&t.update_slot_base(o,r,e,e[44],n?t.get_slot_changes(r,e[44],l,_):t.get_all_dirty_from_scope(e[44]),I),256&l[0]&&t.toggle_class(i,"wide",e[8])},i(e){n||(t.transition_in(h,e),n=!0)},o(e){t.transition_out(h,e),n=!1},d(e){e&&t.detach(i),h&&h.d(e),l=!1,s()}}}function x(e){let i,n,l,s;const r=e[45].closeIcon,o=t.create_slot(r,e,e[44],b),h=o||function(e){let i;return{c(){i=t.text("Ⓧ")},m(e,n){t.insert(e,i,n)},d(e){e&&t.detach(i)}}}();return{c(){i=t.element("div"),h&&h.c(),t.attr(i,"class","openClose circle svelte-aniw8a"),t.attr(i,"data-testid",u.CLOSE_LIST),t.toggle_class(i,"wide",e[8])},m(r,o){t.insert(r,i,o),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[49]),l=!0)},p(e,l){o&&o.p&&(!n||8192&l[1])&&t.update_slot_base(o,r,e,e[44],n?t.get_slot_changes(r,e[44],l,v):t.get_all_dirty_from_scope(e[44]),b),256&l[0]&&t.toggle_class(i,"wide",e[8])},i(e){n||(t.transition_in(h,e),n=!0)},o(e){t.transition_out(h,e),n=!1},d(e){e&&t.detach(i),h&&h.d(e),l=!1,s()}}}function O(e){let i,n,l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[5].hits:e[5].hit}`;return{c(){i=t.element("label"),n=t.text(l),t.attr(i,"class","input-label svelte-aniw8a"),t.attr(i,"for",e[17])},m(e,l){t.insert(e,i,l),t.append(i,n)},p(e,i){8224&i[0]&&l!==(l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[5].hits:e[5].hit}`)&&t.set_data(n,l)},d(e){e&&t.detach(i)}}}function S(e){let i,n,l=e[5].noHit+"";return{c(){i=t.element("div"),n=t.text(l),t.attr(i,"class","list-item")},m(e,l){t.insert(e,i,l),t.append(i,n)},p(e,i){32&i[0]&&l!==(l=e[5].noHit+"")&&t.set_data(n,l)},i:t.noop,o:t.noop,d(e){e&&t.detach(i)}}}function L(e){let i,n,l=e[13].filteredItems,s=[];for(let t=0;t<l.length;t+=1)s[t]=C(p(e,l,t));const r=e=>t.transition_out(s[e],1,1,()=>{s[e]=null});return{c(){for(let e=0;e<s.length;e+=1)s[e].c();i=t.empty()},m(e,l){for(let t=0;t<s.length;t+=1)s[t].m(e,l);t.insert(e,i,l),n=!0},p(e,n){if(84025344&n[0]|8192&n[1]){let o;for(l=e[13].filteredItems,o=0;o<l.length;o+=1){const r=p(e,l,o);s[o]?(s[o].p(r,n),t.transition_in(s[o],1)):(s[o]=C(r),s[o].c(),t.transition_in(s[o],1),s[o].m(i.parentNode,i))}for(t.group_outros(),o=l.length;o<s.length;o+=1)r(o);t.check_outros()}},i(e){if(!n){for(let e=0;e<l.length;e+=1)t.transition_in(s[e]);n=!0}},o(e){s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)t.transition_out(s[e]);n=!1},d(e){t.destroy_each(s,e),e&&t.detach(i)}}}function C(e){let i,n,l,s,r;const o=e[45].listItem,h=t.create_slot(o,e,e[44],f),a=h||function(e){let i,n,l=e[69].displayLabel+"";return{c(){i=new t.HtmlTag(!1),n=t.empty(),i.a=n},m(e,s){i.m(l,e,s),t.insert(e,n,s)},p(e,t){8192&t[0]&&l!==(l=e[69].displayLabel+"")&&i.p(l)},d(e){e&&t.detach(n),e&&i.d()}}}(e);function d(){return e[51](e[69])}return{c(){i=t.element("div"),a&&a.c(),n=t.space(),t.attr(i,"data-testid",u.AC_LIST_ITEM),t.attr(i,"class",t.null_to_empty("list-item "+e[17])+" svelte-aniw8a"),t.toggle_class(i,"highlighted",e[13].isHighlighted(e[69]))},m(o,h){t.insert(o,i,h),a&&a.m(i,null),t.append(i,n),l=!0,s||(r=[t.listen(i,"pointerenter",d),t.listen(i,"mousedown",e[52])],s=!0)},p(n,s){e=n,h?h.p&&(!l||8192&s[0]|8192&s[1])&&t.update_slot_base(h,o,e,e[44],l?t.get_slot_changes(o,e[44],s,m):t.get_all_dirty_from_scope(e[44]),f):a&&a.p&&(!l||8192&s[0])&&a.p(e,l?s:[-1,-1,-1]),8192&s[0]&&t.toggle_class(i,"highlighted",e[13].isHighlighted(e[69]))},i(e){l||(t.transition_in(a,e),l=!0)},o(e){t.transition_out(a,e),l=!1},d(e){e&&t.detach(i),a&&a.d(e),s=!1,t.run_all(r)}}}function $(e){let i,n,l,s,r,o,h,a,d,c,p,m,f,_,I,v,b,y=[{autocomplete:"off"},{class:s=e[4].join(" ")},{id:e[17]},{style:e[3]},{tabindex:e[9]},{placeholder:r=e[13].hasItems()?e[10]:void 0},{disabled:o=!e[13].hasItems()},{type:"text"},e[11]],x={};for(let e=0;e<y.length;e+=1)x=t.assign(x,y[e]);let C=e[13].filteredItems.length>0&&w(e),$=e[7]&&O(e);const T=[L,S],k=[];function H(e,t){return e[13].filteredItems.length>0?0:e[12]?-1:1}return~(p=H(e))&&(m=k[p]=T[p](e)),{c(){i=t.element("div"),n=t.element("div"),l=t.element("input"),h=t.space(),C&&C.c(),a=t.space(),$&&$.c(),d=t.space(),c=t.element("div"),m&&m.c(),t.set_attributes(l,x),t.toggle_class(l,"wide",e[8]),t.toggle_class(l,"svelte-aniw8a",!0),t.attr(n,"class","input-and-icons svelte-aniw8a"),t.toggle_class(n,"wide",e[8]),t.attr(c,"data-testid",u.AC_LIST),t.attr(c,"class","dropdown svelte-aniw8a"),t.attr(c,"style",f="z-index: "+(e[6]+1)),t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[12]&&0===e[13].filteredItems.length),t.attr(i,"class",_=t.null_to_empty(`autocomplete ${e[17]} ${e[1].join(" ")}`)+" svelte-aniw8a"),t.attr(i,"style",e[2]),t.attr(i,"data-testid",u.ROOT)},m(s,r){t.insert(s,i,r),t.append(i,n),t.append(n,l),l.autofocus&&l.focus(),e[47](l),t.set_input_value(l,e[0]),t.append(n,h),C&&C.m(n,null),t.append(i,a),$&&$.m(i,null),t.append(i,d),t.append(i,c),~p&&k[p].m(c,null),e[53](c),e[54](i),I=!0,v||(b=[t.listen(g,"mousedown",e[25]),t.listen(g,"scroll",e[46]),t.listen(l,"input",e[48]),t.listen(l,"blur",e[19]),t.listen(l,"dblclick",e[23]),t.listen(l,"focus",e[18]),t.listen(l,"keydown",e[22]),t.listen(c,"pointerleave",e[27]),t.listen(c,"keydown",t.prevent_default(F)),t.listen(c,"scroll",t.stop_propagation(t.prevent_default(N))),t.listen(i,"mousedown",t.stop_propagation(t.prevent_default(e[55])))],v=!0)},p(e,h){t.set_attributes(l,x=t.get_spread_update(y,[{autocomplete:"off"},(!I||16&h[0]&&s!==(s=e[4].join(" ")))&&{class:s},{id:e[17]},(!I||8&h[0])&&{style:e[3]},(!I||512&h[0])&&{tabindex:e[9]},(!I||9216&h[0]&&r!==(r=e[13].hasItems()?e[10]:void 0))&&{placeholder:r},(!I||8192&h[0]&&o!==(o=!e[13].hasItems()))&&{disabled:o},{type:"text"},2048&h[0]&&e[11]])),1&h[0]&&l.value!==e[0]&&t.set_input_value(l,e[0]),t.toggle_class(l,"wide",e[8]),t.toggle_class(l,"svelte-aniw8a",!0),e[13].filteredItems.length>0?C?(C.p(e,h),8192&h[0]&&t.transition_in(C,1)):(C=w(e),C.c(),t.transition_in(C,1),C.m(n,null)):C&&(t.group_outros(),t.transition_out(C,1,1,()=>{C=null}),t.check_outros()),256&h[0]&&t.toggle_class(n,"wide",e[8]),e[7]?$?$.p(e,h):($=O(e),$.c(),$.m(i,d)):$&&($.d(1),$=null);let a=p;p=H(e),p===a?~p&&k[p].p(e,h):(m&&(t.group_outros(),t.transition_out(k[a],1,1,()=>{k[a]=null}),t.check_outros()),~p?(m=k[p],m?m.p(e,h):(m=k[p]=T[p](e),m.c()),t.transition_in(m,1),m.m(c,null)):m=null),(!I||64&h[0]&&f!==(f="z-index: "+(e[6]+1)))&&t.attr(c,"style",f),12288&h[0]&&t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[12]&&0===e[13].filteredItems.length),(!I||2&h[0]&&_!==(_=t.null_to_empty(`autocomplete ${e[17]} ${e[1].join(" ")}`)+" svelte-aniw8a"))&&t.attr(i,"class",_),(!I||4&h[0])&&t.attr(i,"style",e[2])},i(e){I||(t.transition_in(C),t.transition_in(m),I=!0)},o(e){t.transition_out(C),t.transition_out(m),I=!1},d(n){n&&t.detach(i),e[47](null),C&&C.d(),$&&$.d(),~p&&k[p].d(),e[53](null),e[54](null),v=!1,t.run_all(b)}}}let T=0;const F=()=>!1,N=()=>!1;function k(e,n,l){let s,o,{$$slots:h={},$$scope:d}=n;const u=i.createEventDispatcher();let{items:g=[]}=n,{labelFieldName:c=null}=n,{labelFunction:p=null}=n,{containerClassNames:m=[]}=n,{containerStyle:f=""}=n,{inputStyle:_=""}=n,{inputClassNames:I=[]}=n,{i18n:v={hit:" treff",hits:" treff",noHit:"Ingen treff"}}=n,{minCharsToSuggest:b=3}=n,{removeOnSelect:w=!1}=n,{closeOnSelect:y=!0}=n,{zIndexOffset:x=0}=n,{preferOpenUpwards:O=!1}=n,{showNumberOfHits:S=!0}=n,{caseSensitive:L=!1}=n,{wide:C=!1}=n,{tabIndex:$=null}=n,{placeholder:F=null}=n,{inputProps:N={}}=n,{allowFreeText:k=!1}=n,{submitOnFilterChange:H=!1}=n,{autoHighlightSingle:E=!1}=n,{matchOnStart:P=!1}=n,{filterText:R=""}=n,{resetFilterOnSubmit:A=!1}=n;const D="autocomplete-"+T++;let M,U,B,j=!1,z=!1,q=[];function G(e=!1){l(13,o=o.setOpened(!0).setUserOpened(e)),X()}function Y(e=!1){l(13,o.userClosed=e,o),l(13,o=o.setOpened(!1))}i.afterUpdate(()=>{q.forEach(e=>e()),q=[]});const V={Escape:function(){l(0,R=""),U.blur(),l(42,j=!1),Y(!0)},ArrowDown:J,ArrowUp:J,Enter:K,Backspace:function(){R.length<=1&&Y()},Tab:function(){z=!0},PageDown:Q,PageUp:Q};function J(e){e.stopPropagation(),e.preventDefault(),o.opened?("ArrowDown"===(null==e?void 0:e.key)&&l(13,o=o.highlightNext()),"ArrowUp"===(null==e?void 0:e.key)&&l(13,o=o.highlightPrev()),Z()):G(!0)}function K(e){var t,i;o.opened&&(null!==o.highlightedItem?(u("select",{selected:o.highlightedItem.originalItem}),w&&(l(13,o=o.removeHighlighted()),X())):!H&&k&&R.length>0&&u("select",{selected:R}),A||!o.hasItems()?l(0,R=""):k&&!w&&l(0,R=null!==(i=null===(t=o.highlightedItem)||void 0===t?void 0:t.originalLabel)&&void 0!==i?i:""),y?Y(!0):e&&w&&q.push(()=>{const e=Array.from(document.querySelectorAll(":hover")).find(e=>{var t,i;return(null===(t=e.classList)||void 0===t?void 0:t.contains(D))&&(null===(i=e.classList)||void 0===i?void 0:i.contains("list-item"))});null==e||e.dispatchEvent(new PointerEvent("pointerenter"))}))}function Q(e){if(e.stopPropagation(),e.preventDefault(),o.opened){const t="PageDown"===e.key?1:-1,i=M.scrollHeight/o.filteredItems.length,n=Math.floor(M.getBoundingClientRect().height/i)-1;l(13,o=o.shiftHighlightBy(t*n)),Z()}else G(!0)}function W(e){o.isHighlighted(e)||l(13,o=o.highlight(e))}function X(){q.push(()=>ee()),Z()}function Z(){q.push(()=>{var e;null!=B&&o.opened&&(null===(e=null==M?void 0:M.querySelector(".highlighted"))||void 0===e||e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))})}function ee(){if(null==B)return;const{height:e,pageLeft:t}=window.visualViewport,{bottom:i,height:n,top:s}=U.getBoundingClientRect(),{height:r}=M.getBoundingClientRect();l(14,M.style.top=i+r>e||O&&s-r>t?`-${r}px`:n+"px",M)}return e.$$set=e=>{"items"in e&&l(29,g=e.items),"labelFieldName"in e&&l(30,c=e.labelFieldName),"labelFunction"in e&&l(31,p=e.labelFunction),"containerClassNames"in e&&l(1,m=e.containerClassNames),"containerStyle"in e&&l(2,f=e.containerStyle),"inputStyle"in e&&l(3,_=e.inputStyle),"inputClassNames"in e&&l(4,I=e.inputClassNames),"i18n"in e&&l(5,v=e.i18n),"minCharsToSuggest"in e&&l(32,b=e.minCharsToSuggest),"removeOnSelect"in e&&l(33,w=e.removeOnSelect),"closeOnSelect"in e&&l(34,y=e.closeOnSelect),"zIndexOffset"in e&&l(6,x=e.zIndexOffset),"preferOpenUpwards"in e&&l(35,O=e.preferOpenUpwards),"showNumberOfHits"in e&&l(7,S=e.showNumberOfHits),"caseSensitive"in e&&l(36,L=e.caseSensitive),"wide"in e&&l(8,C=e.wide),"tabIndex"in e&&l(9,$=e.tabIndex),"placeholder"in e&&l(10,F=e.placeholder),"inputProps"in e&&l(11,N=e.inputProps),"allowFreeText"in e&&l(12,k=e.allowFreeText),"submitOnFilterChange"in e&&l(37,H=e.submitOnFilterChange),"autoHighlightSingle"in e&&l(38,E=e.autoHighlightSingle),"matchOnStart"in e&&l(39,P=e.matchOnStart),"filterText"in e&&l(0,R=e.filterText),"resetFilterOnSubmit"in e&&l(40,A=e.resetFilterOnSubmit),"$$scope"in e&&l(44,d=e.$$scope)},e.$$.update=()=>{var t;1073741824&e.$$.dirty[0]|1&e.$$.dirty[1]&&l(43,s=null!=p?p:null!=c?e=>e[c]:e=>e),536875008&e.$$.dirty[0]|4512&e.$$.dirty[1]&&l(13,o=new a(L,!k,E?r.SINGLE_ONLY:r.FIRST_FILTERED,P).setItems(g||[],s)),4097&e.$$.dirty[0]|64&e.$$.dirty[1]&&(t=R,l(13,o=o.filter(t)),o.opened&&X(),k&&H&&u("select",{selected:R})),8193&e.$$.dirty[0]|2050&e.$$.dirty[1]&&(R.length>=b&&!o.opened&&j&&!o.userClosed?G(!1):(o.opened&&!o.userOpened&&R.length<b||!j||o.userClosed)&&Y())},[R,m,f,_,I,v,x,S,C,$,F,N,k,o,M,U,B,D,function(){l(42,j=!0)},function(){const e=Array.from(document.querySelectorAll(":hover")).some(e=>{var t;return null===(t=e.classList)||void 0===t?void 0:t.contains(D)});l(42,j=!z&&e),q.push(()=>z=!1)},G,Y,function(e){return V[e.key]&&V[e.key](e)},function(){!o.opened&&G(!0)},K,function(){l(42,j=!1),Y()},W,function(){k&&l(13,o=o.highlight(null))},ee,g,c,p,b,w,y,O,L,H,E,P,A,function(e){l(13,o=o.addItem(e))},j,s,d,h,()=>{o.opened&&ee()},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{U=e,l(15,U)})},function(){R=this.value,l(0,R)},()=>Y(!0),()=>G(!0),e=>W(e),()=>K(!0),function(e){t.binding_callbacks[e?"unshift":"push"](()=>{M=e,l(14,M)})},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{B=e,l(16,B)})},()=>U.focus()]}class H extends t.SvelteComponent{constructor(e){super(),t.init(this,e,k,$,t.safe_not_equal,{items:29,labelFieldName:30,labelFunction:31,containerClassNames:1,containerStyle:2,inputStyle:3,inputClassNames:4,i18n:5,minCharsToSuggest:32,removeOnSelect:33,closeOnSelect:34,zIndexOffset:6,preferOpenUpwards:35,showNumberOfHits:7,caseSensitive:36,wide:8,tabIndex:9,placeholder:10,inputProps:11,allowFreeText:12,submitOnFilterChange:37,autoHighlightSingle:38,matchOnStart:39,filterText:0,resetFilterOnSubmit:40,addItem:41},c,[-1,-1,-1])}get addItem(){return this.$$.ctx[41]}}e.Autocomplete=H,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@digibib/deichman-admin-frontend-common", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Set of common Deichman Svelte components", | ||
@@ -5,0 +5,0 @@ "svelte": "src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
177401
154