@digibib/deichman-admin-frontend-common
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -11,2 +11,14 @@ # Changelog | ||
## 2.4.0 | ||
* `Added` Autocomplete - `autoHighlightSingle` flag added. If set to true, and `allowFreeText` is also true, and the | ||
suggestion list is filtered down to none item without highlight, the one and only list item gets highlighted. On enter | ||
the value of the text field is set to the originalLabel of the highlighted item. | ||
* `Added` Autocomplete - `submitOnFilterChange` flag added. If set to true, any change to the filter input triggers a | ||
`select` event. | ||
* `Added` Autocomplete - `matchOnStart` flag added. If set to true, filtering matches only on the start of the | ||
suggestion list item labels. | ||
* `Added` Autocomplete - Bunch of tests to cover new functionality. | ||
* `Fixed` Autocomplete - Hiding open/close icon if all items are filtered out. | ||
## 2.3.2 | ||
@@ -13,0 +25,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){const i=new RegExp(l.escapeRegExp(e),t?"":"i");return this.items.filter(t=>""===e||t.originalLabel.match(i)).map((e,t)=>(e.index=t,e.displayLabel=e.originalLabel.replace(i,(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})}}class s{constructor(e=!1,t=!1){this._opened=!1,this._userOpened=!1,this._highlightedItem=null,this.filterText="",this._filteredItems=[],this.internalItems=null,this.filterCaseSensitive=e,this.allowFreeText=t}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.rollOverIndexDisabled()?-1:e}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.rollOverIndexDisabled()?-1:e}rollOverIndexDisabled(){return this.allowFreeText}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}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))&&void 0!==i?i:[],null!=this._highlightedItem?this._filteredItems.some(e=>e.key===this._highlightedItem.key)||this.highlight(this._filteredItems[0]):this.autoHighlightEnabled()&&this.highlight(this._filteredItems[0]),this}autoHighlightEnabled(){return!this.allowFreeText}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.filter(this.filterText),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 o;!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"}(o||(o={}));var r=o;const{window:a}=t.globals;function h(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 d(e,t,i){const n=e.slice();return n[63]=t[i],n}const u=e=>({item:8192&e[0],displayLabel:8192&e[0]}),c=e=>({item:e[63].originalItem,displayLabel:e[63].displayLabel}),g=e=>({}),p=e=>({}),m=e=>({}),f=e=>({});function _(e){let i,n,l,s;const o=[v,I],r=[];function a(e,t){return e[13].opened?0:1}return i=a(e),n=r[i]=o[i](e),{c(){n.c(),l=t.empty()},m(e,n){r[i].m(e,n),t.insert(e,l,n),s=!0},p(e,s){let h=i;i=a(e),i===h?r[i].p(e,s):(t.group_outros(),t.transition_out(r[h],1,1,()=>{r[h]=null}),t.check_outros(),n=r[i],n?n.p(e,s):(n=r[i]=o[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){r[i].d(e),e&&t.detach(l)}}}function I(e){let i,n,l,s;const o=e[40].openIcon,a=t.create_slot(o,e,e[39],p),h=a||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",r.OPEN_LIST),t.toggle_class(i,"wide",e[7])},m(o,r){t.insert(o,i,r),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[45]),l=!0)},p(e,l){a&&a.p&&(!n||256&l[1])&&t.update_slot_base(a,o,e,e[39],n?t.get_slot_changes(o,e[39],l,g):t.get_all_dirty_from_scope(e[39]),p),128&l[0]&&t.toggle_class(i,"wide",e[7])},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 v(e){let i,n,l,s;const o=e[40].closeIcon,a=t.create_slot(o,e,e[39],f),h=a||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",r.CLOSE_LIST),t.toggle_class(i,"wide",e[7])},m(o,r){t.insert(o,i,r),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[44]),l=!0)},p(e,l){a&&a.p&&(!n||256&l[1])&&t.update_slot_base(a,o,e,e[39],n?t.get_slot_changes(o,e[39],l,m):t.get_all_dirty_from_scope(e[39]),f),128&l[0]&&t.toggle_class(i,"wide",e[7])},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 w(e){let i,n,l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[4].hits:e[4].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){8208&i[0]&&l!==(l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[4].hits:e[4].hit}`)&&t.set_data(n,l)},d(e){e&&t.detach(i)}}}function b(e){let i,n,l=e[4].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){16&i[0]&&l!==(l=e[4].noHit+"")&&t.set_data(n,l)},i:t.noop,o:t.noop,d(e){e&&t.detach(i)}}}function y(e){let i,n,l=e[13].filteredItems,s=[];for(let t=0;t<l.length;t+=1)s[t]=x(d(e,l,t));const o=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]|256&n[1]){let r;for(l=e[13].filteredItems,r=0;r<l.length;r+=1){const o=d(e,l,r);s[r]?(s[r].p(o,n),t.transition_in(s[r],1)):(s[r]=x(o),s[r].c(),t.transition_in(s[r],1),s[r].m(i.parentNode,i))}for(t.group_outros(),r=l.length;r<s.length;r+=1)o(r);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 x(e){let i,n,l,s,o;const a=e[40].listItem,h=t.create_slot(a,e,e[39],c),d=h||function(e){let i,n,l=e[63].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[63].displayLabel+"")&&i.p(l)},d(e){e&&t.detach(n),e&&i.d()}}}(e);function g(){return e[46](e[63])}return{c(){i=t.element("div"),d&&d.c(),n=t.space(),t.attr(i,"data-testid",r.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[63]))},m(r,a){t.insert(r,i,a),d&&d.m(i,null),t.append(i,n),l=!0,s||(o=[t.listen(i,"pointerenter",g),t.listen(i,"mousedown",e[47])],s=!0)},p(n,s){e=n,h?h.p&&(!l||8192&s[0]|256&s[1])&&t.update_slot_base(h,a,e,e[39],l?t.get_slot_changes(a,e[39],s,u):t.get_all_dirty_from_scope(e[39]),c):d&&d.p&&(!l||8192&s[0])&&d.p(e,l?s:[-1,-1,-1]),8192&s[0]&&t.toggle_class(i,"highlighted",e[13].isHighlighted(e[63]))},i(e){l||(t.transition_in(d,e),l=!0)},o(e){t.transition_out(d,e),l=!1},d(e){e&&t.detach(i),d&&d.d(e),s=!1,t.run_all(o)}}}function O(e){let i,n,l,s,o,h,d,u,c,g,p,m,f,I,v,x,O,S=e[13].hasItems(),L=[{autocomplete:"off"},{class:s=e[3].join(" ")},{id:e[17]},{style:e[2]},{tabindex:e[8]},{placeholder:o=e[13].hasItems()?e[9]:void 0},{disabled:h=!e[13].hasItems()},{type:"text"},e[10]],T={};for(let e=0;e<L.length;e+=1)T=t.assign(T,L[e]);let k=S&&_(e),N=e[6]&&w(e);const H=[y,b],F=[];function E(e,t){return e[13].filteredItems.length>0?0:e[11]?-1:1}return~(p=E(e))&&(m=F[p]=H[p](e)),{c(){i=t.element("div"),n=t.element("div"),l=t.element("input"),d=t.space(),k&&k.c(),u=t.space(),N&&N.c(),c=t.space(),g=t.element("div"),m&&m.c(),t.set_attributes(l,T),t.toggle_class(l,"wide",e[7]),t.toggle_class(l,"svelte-aniw8a",!0),t.attr(n,"class","input-and-icons svelte-aniw8a"),t.toggle_class(n,"wide",e[7]),t.attr(g,"data-testid",r.AC_LIST),t.attr(g,"class","dropdown svelte-aniw8a"),t.attr(g,"style",f="z-index: "+(e[5]+1)),t.toggle_class(g,"hidden",!(e[13].opened&&e[13].hasItems())||e[11]&&0===e[13].filteredItems.length),t.attr(i,"class",I=t.null_to_empty(`autocomplete ${e[17]} ${e[0].join(" ")}`)+" svelte-aniw8a"),t.attr(i,"style",e[1]),t.attr(i,"data-testid",r.ROOT)},m(s,o){t.insert(s,i,o),t.append(i,n),t.append(n,l),l.autofocus&&l.focus(),e[42](l),t.set_input_value(l,e[12]),t.append(n,d),k&&k.m(n,null),t.append(i,u),N&&N.m(i,null),t.append(i,c),t.append(i,g),~p&&F[p].m(g,null),e[48](g),e[49](i),v=!0,x||(O=[t.listen(a,"mousedown",e[25]),t.listen(a,"scroll",e[41]),t.listen(l,"input",e[43]),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(g,"keydown",t.prevent_default(C)),t.listen(g,"scroll",t.stop_propagation(t.prevent_default($))),t.listen(i,"mousedown",t.stop_propagation(t.prevent_default(e[50])))],x=!0)},p(e,r){t.set_attributes(l,T=t.get_spread_update(L,[{autocomplete:"off"},(!v||8&r[0]&&s!==(s=e[3].join(" ")))&&{class:s},{id:e[17]},(!v||4&r[0])&&{style:e[2]},(!v||256&r[0])&&{tabindex:e[8]},(!v||8704&r[0]&&o!==(o=e[13].hasItems()?e[9]:void 0))&&{placeholder:o},(!v||8192&r[0]&&h!==(h=!e[13].hasItems()))&&{disabled:h},{type:"text"},1024&r[0]&&e[10]])),4096&r[0]&&l.value!==e[12]&&t.set_input_value(l,e[12]),t.toggle_class(l,"wide",e[7]),t.toggle_class(l,"svelte-aniw8a",!0),8192&r[0]&&(S=e[13].hasItems()),S?k?(k.p(e,r),8192&r[0]&&t.transition_in(k,1)):(k=_(e),k.c(),t.transition_in(k,1),k.m(n,null)):k&&(t.group_outros(),t.transition_out(k,1,1,()=>{k=null}),t.check_outros()),128&r[0]&&t.toggle_class(n,"wide",e[7]),e[6]?N?N.p(e,r):(N=w(e),N.c(),N.m(i,c)):N&&(N.d(1),N=null);let a=p;p=E(e),p===a?~p&&F[p].p(e,r):(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,r):(m=F[p]=H[p](e),m.c()),t.transition_in(m,1),m.m(g,null)):m=null),(!v||32&r[0]&&f!==(f="z-index: "+(e[5]+1)))&&t.attr(g,"style",f),10240&r[0]&&t.toggle_class(g,"hidden",!(e[13].opened&&e[13].hasItems())||e[11]&&0===e[13].filteredItems.length),(!v||1&r[0]&&I!==(I=t.null_to_empty(`autocomplete ${e[17]} ${e[0].join(" ")}`)+" svelte-aniw8a"))&&t.attr(i,"class",I),(!v||2&r[0])&&t.attr(i,"style",e[1])},i(e){v||(t.transition_in(k),t.transition_in(m),v=!0)},o(e){t.transition_out(k),t.transition_out(m),v=!1},d(n){n&&t.detach(i),e[42](null),k&&k.d(),N&&N.d(),~p&&F[p].d(),e[48](null),e[49](null),x=!1,t.run_all(O)}}}let S=0;const C=()=>!1,$=()=>!1;function L(e,n,l){let o,r,{$$slots:a={},$$scope:h}=n;const d=i.createEventDispatcher();let{items:u=[]}=n,{labelFieldName:c=null}=n,{labelFunction:g=null}=n,{containerClassNames:p=[]}=n,{containerStyle:m=""}=n,{inputStyle:f=""}=n,{inputClassNames:_=[]}=n,{i18n:I={hit:" treff",hits:" treff",noHit:"Ingen treff"}}=n,{minCharsToSuggest:v=3}=n,{removeOnSelect:w=!1}=n,{closeOnSelect:b=!0}=n,{zIndexOffset:y=0}=n,{preferOpenUpwards:x=!1}=n,{showNumberOfHits:O=!0}=n,{caseSensitive:C=!1}=n,{wide:$=!1}=n,{tabIndex:L=null}=n,{placeholder:T=null}=n,{inputProps:k={}}=n,{allowFreeText:N=!1}=n;const H="autocomplete-"+S++;let F,E,P,A=!1,D=!1,U="",B=[];function j(e=!1){l(13,r=r.setOpened(!0).setUserOpened(e)),J()}function z(e=!1){l(13,r.userClosed=e,r),l(13,r=r.setOpened(!1)),N&&r.highlight(null)}i.afterUpdate(()=>{B.forEach(e=>e()),B=[]});const R={Escape:function(){l(12,U=""),E.blur(),l(37,A=!1),z(!0)},ArrowDown:M,ArrowUp:M,Enter:q,Backspace:function(){U.length<=1&&z()},Tab:function(){D=!0},PageDown:V,PageUp:V};function M(e){e.stopPropagation(),e.preventDefault(),r.opened?("ArrowDown"===(null==e?void 0:e.key)&&l(13,r=r.highlightNext()),"ArrowUp"===(null==e?void 0:e.key)&&l(13,r=r.highlightPrev()),K()):j(!0)}function q(e){r.opened&&(null!==r.highlightedItem?(d("select",{selected:r.highlightedItem.originalItem}),w&&(l(13,r=r.removeHighlighted()),r.hasItems()||l(12,U=""),J())):N&&U.length>0&&d("select",{selected:U}),b?z(!0):e&&w&&B.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(H))&&(null===(i=e.classList)||void 0===i?void 0:i.contains("list-item"))});null==e||e.dispatchEvent(new PointerEvent("pointerenter"))}))}function V(e){if(e.stopPropagation(),e.preventDefault(),r.opened){const t="PageDown"===e.key?1:-1,i=F.scrollHeight/r.filteredItems.length,n=Math.floor(F.getBoundingClientRect().height/i)-1;l(13,r=r.shiftHighlightBy(t*n)),K()}else j(!0)}function G(e){r.isHighlighted(e)||l(13,r=r.highlight(e))}function J(){B.push(()=>Q()),K()}function K(){B.push(()=>{var e;null!=P&&r.opened&&(null===(e=null==F?void 0:F.querySelector(".highlighted"))||void 0===e||e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))})}function Q(){if(null==P)return;const{height:e,pageLeft:t}=window.visualViewport,{bottom:i,height:n,top:s}=E.getBoundingClientRect(),{height:o}=F.getBoundingClientRect();l(14,F.style.top=i+o>e||x&&s-o>t?`-${o}px`:n+"px",F)}return e.$$set=e=>{"items"in e&&l(28,u=e.items),"labelFieldName"in e&&l(29,c=e.labelFieldName),"labelFunction"in e&&l(30,g=e.labelFunction),"containerClassNames"in e&&l(0,p=e.containerClassNames),"containerStyle"in e&&l(1,m=e.containerStyle),"inputStyle"in e&&l(2,f=e.inputStyle),"inputClassNames"in e&&l(3,_=e.inputClassNames),"i18n"in e&&l(4,I=e.i18n),"minCharsToSuggest"in e&&l(31,v=e.minCharsToSuggest),"removeOnSelect"in e&&l(32,w=e.removeOnSelect),"closeOnSelect"in e&&l(33,b=e.closeOnSelect),"zIndexOffset"in e&&l(5,y=e.zIndexOffset),"preferOpenUpwards"in e&&l(34,x=e.preferOpenUpwards),"showNumberOfHits"in e&&l(6,O=e.showNumberOfHits),"caseSensitive"in e&&l(35,C=e.caseSensitive),"wide"in e&&l(7,$=e.wide),"tabIndex"in e&&l(8,L=e.tabIndex),"placeholder"in e&&l(9,T=e.placeholder),"inputProps"in e&&l(10,k=e.inputProps),"allowFreeText"in e&&l(11,N=e.allowFreeText),"$$scope"in e&&l(39,h=e.$$scope)},e.$$.update=()=>{1610612736&e.$$.dirty[0]&&l(38,o=null!=g?g:null!=c?e=>e[c]:e=>e),268437504&e.$$.dirty[0]|144&e.$$.dirty[1]&&l(13,r=new s(C,N).setItems(u||[],o)),12288&e.$$.dirty[0]&&(!function(e){l(13,r=r.filter(e)),K()}(U),r.opened&&J()),12288&e.$$.dirty[0]|65&e.$$.dirty[1]&&(U.length>=v&&!r.opened&&A&&!r.userClosed?j(!1):(r.opened&&!r.userOpened&&U.length<v||!A||r.userClosed)&&z())},[p,m,f,_,I,y,O,$,L,T,k,N,U,r,F,E,P,H,function(){l(37,A=!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(H)});l(37,A=!D&&e),B.push(()=>D=!1)},j,z,function(e){return R[e.key]&&R[e.key](e)},function(){!r.opened&&j(!0)},q,function(){l(37,A=!1),z()},G,Q,u,c,g,v,w,b,x,C,function(e){l(13,r=r.addItem(e))},A,o,h,a,()=>{r.opened&&Q()},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{E=e,l(15,E)})},function(){U=this.value,l(12,U)},()=>z(!0),()=>j(!0),e=>G(e),()=>q(!0),function(e){t.binding_callbacks[e?"unshift":"push"](()=>{F=e,l(14,F)})},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{P=e,l(16,P)})},()=>E.focus()]}class T extends t.SvelteComponent{constructor(e){super(),t.init(this,e,L,O,t.safe_not_equal,{items:28,labelFieldName:29,labelFunction:30,containerClassNames:0,containerStyle:1,inputStyle:2,inputClassNames:3,i18n:4,minCharsToSuggest:31,removeOnSelect:32,closeOnSelect:33,zIndexOffset:5,preferOpenUpwards:34,showNumberOfHits:6,caseSensitive:35,wide:7,tabIndex:8,placeholder:9,inputProps:10,allowFreeText:11,addItem:36},h,[-1,-1,-1])}get addItem(){return this.$$.ctx[36]}}e.Autocomplete=T,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 o=s;const{FIRST_FILTERED:r,SINGLE_ONLY:h}=o;class a{constructor(e=!1,t=!0,i=r,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 o.FIRST_FILTERED:this.highlight(this._filteredItems[0]);break;case o.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.filter(this.filterText),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[68]=t[i],n}const m=e=>({item:8192&e[0],displayLabel:8192&e[0]}),f=e=>({item:e[68].originalItem,displayLabel:e[68].displayLabel}),_=e=>({}),I=e=>({}),v=e=>({}),w=e=>({});function b(e){let i,n,l,s;const o=[x,y],r=[];function h(e,t){return e[13].opened?0:1}return i=h(e),n=r[i]=o[i](e),{c(){n.c(),l=t.empty()},m(e,n){r[i].m(e,n),t.insert(e,l,n),s=!0},p(e,s){let a=i;i=h(e),i===a?r[i].p(e,s):(t.group_outros(),t.transition_out(r[a],1,1,()=>{r[a]=null}),t.check_outros(),n=r[i],n?n.p(e,s):(n=r[i]=o[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){r[i].d(e),e&&t.detach(l)}}}function y(e){let i,n,l,s;const o=e[45].openIcon,r=t.create_slot(o,e,e[44],I),h=r||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[7])},m(o,r){t.insert(o,i,r),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[50]),l=!0)},p(e,l){r&&r.p&&(!n||8192&l[1])&&t.update_slot_base(r,o,e,e[44],n?t.get_slot_changes(o,e[44],l,_):t.get_all_dirty_from_scope(e[44]),I),128&l[0]&&t.toggle_class(i,"wide",e[7])},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 o=e[45].closeIcon,r=t.create_slot(o,e,e[44],w),h=r||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[7])},m(o,r){t.insert(o,i,r),h&&h.m(i,null),n=!0,l||(s=t.listen(i,"mousedown",e[49]),l=!0)},p(e,l){r&&r.p&&(!n||8192&l[1])&&t.update_slot_base(r,o,e,e[44],n?t.get_slot_changes(o,e[44],l,v):t.get_all_dirty_from_scope(e[44]),w),128&l[0]&&t.toggle_class(i,"wide",e[7])},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[4].hits:e[4].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){8208&i[0]&&l!==(l=`${e[13].filteredItems.length} ${e[13].filteredItems.length>1?e[4].hits:e[4].hit}`)&&t.set_data(n,l)},d(e){e&&t.detach(i)}}}function S(e){let i,n,l=e[4].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){16&i[0]&&l!==(l=e[4].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 o=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(167911424&n[0]|8192&n[1]){let r;for(l=e[13].filteredItems,r=0;r<l.length;r+=1){const o=p(e,l,r);s[r]?(s[r].p(o,n),t.transition_in(s[r],1)):(s[r]=C(o),s[r].c(),t.transition_in(s[r],1),s[r].m(i.parentNode,i))}for(t.group_outros(),r=l.length;r<s.length;r+=1)o(r);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,o;const r=e[45].listItem,h=t.create_slot(r,e,e[44],f),a=h||function(e){let i,n,l=e[68].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[68].displayLabel+"")&&i.p(l)},d(e){e&&t.detach(n),e&&i.d()}}}(e);function d(){return e[51](e[68])}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[68]))},m(r,h){t.insert(r,i,h),a&&a.m(i,null),t.append(i,n),l=!0,s||(o=[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,r,e,e[44],l?t.get_slot_changes(r,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[68]))},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(o)}}}function $(e){let i,n,l,s,o,r,h,a,d,c,p,m,f,_,I,v,w,y=[{autocomplete:"off"},{class:s=e[3].join(" ")},{id:e[17]},{style:e[2]},{tabindex:e[8]},{placeholder:o=e[13].hasItems()?e[9]:void 0},{disabled:r=!e[13].hasItems()},{type:"text"},e[10]],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[6]&&O(e);const T=[L,S],F=[];function H(e,t){return e[13].filteredItems.length>0?0:e[11]?-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[7]),t.toggle_class(l,"svelte-aniw8a",!0),t.attr(n,"class","input-and-icons svelte-aniw8a"),t.toggle_class(n,"wide",e[7]),t.attr(c,"data-testid",u.AC_LIST),t.attr(c,"class","dropdown svelte-aniw8a"),t.attr(c,"style",f="z-index: "+(e[5]+1)),t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[11]&&0===e[13].filteredItems.length),t.attr(i,"class",_=t.null_to_empty(`autocomplete ${e[17]} ${e[0].join(" ")}`)+" svelte-aniw8a"),t.attr(i,"style",e[1]),t.attr(i,"data-testid",u.ROOT)},m(s,o){t.insert(s,i,o),t.append(i,n),t.append(n,l),l.autofocus&&l.focus(),e[47](l),t.set_input_value(l,e[12]),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[53](c),e[54](i),I=!0,v||(w=[t.listen(g,"mousedown",e[26]),t.listen(g,"scroll",e[46]),t.listen(l,"input",e[48]),t.listen(l,"blur",e[19]),t.listen(l,"dblclick",e[24]),t.listen(l,"focus",e[18]),t.listen(l,"keydown",e[23]),t.listen(l,"input",e[22]),t.listen(c,"pointerleave",e[28]),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[55])))],v=!0)},p(e,h){t.set_attributes(l,x=t.get_spread_update(y,[{autocomplete:"off"},(!I||8&h[0]&&s!==(s=e[3].join(" ")))&&{class:s},{id:e[17]},(!I||4&h[0])&&{style:e[2]},(!I||256&h[0])&&{tabindex:e[8]},(!I||8704&h[0]&&o!==(o=e[13].hasItems()?e[9]:void 0))&&{placeholder:o},(!I||8192&h[0]&&r!==(r=!e[13].hasItems()))&&{disabled:r},{type:"text"},1024&h[0]&&e[10]])),4096&h[0]&&l.value!==e[12]&&t.set_input_value(l,e[12]),t.toggle_class(l,"wide",e[7]),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()),128&h[0]&&t.toggle_class(n,"wide",e[7]),e[6]?$?$.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||32&h[0]&&f!==(f="z-index: "+(e[5]+1)))&&t.attr(c,"style",f),10240&h[0]&&t.toggle_class(c,"hidden",!(e[13].opened&&e[13].hasItems())||e[11]&&0===e[13].filteredItems.length),(!I||1&h[0]&&_!==(_=t.null_to_empty(`autocomplete ${e[17]} ${e[0].join(" ")}`)+" svelte-aniw8a"))&&t.attr(i,"class",_),(!I||2&h[0])&&t.attr(i,"style",e[1])},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&&F[p].d(),e[53](null),e[54](null),v=!1,t.run_all(w)}}}let T=0;const N=()=>!1,k=()=>!1;function F(e,n,l){let s,r,{$$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;const R="autocomplete-"+T++;let A,D,M,U=!1,B=!1,j="",z=[];function q(e=!1){l(13,r=r.setOpened(!0).setUserOpened(e)),W()}function G(e=!1){l(13,r.userClosed=e,r),l(13,r=r.setOpened(!1))}i.afterUpdate(()=>{z.forEach(e=>e()),z=[]});const Y={Escape:function(){l(12,j=""),D.blur(),l(42,U=!1),G(!0)},ArrowDown:V,ArrowUp:V,Enter:J,Backspace:function(){j.length<=1&&G()},Tab:function(){B=!0},PageDown:K,PageUp:K};function V(e){e.stopPropagation(),e.preventDefault(),r.opened?("ArrowDown"===(null==e?void 0:e.key)&&l(13,r=r.highlightNext()),"ArrowUp"===(null==e?void 0:e.key)&&l(13,r=r.highlightPrev()),X()):q(!0)}function J(e){r.opened&&(null!==r.highlightedItem?(u("select",{selected:r.highlightedItem.originalItem}),E&&l(12,j=r.highlightedItem.originalLabel),b&&(l(13,r=r.removeHighlighted()),r.hasItems()||l(12,j=""),W())):!H&&F&&j.length>0&&u("select",{selected:j}),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(R))&&(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(),r.opened){const t="PageDown"===e.key?1:-1,i=A.scrollHeight/r.filteredItems.length,n=Math.floor(A.getBoundingClientRect().height/i)-1;l(13,r=r.shiftHighlightBy(t*n)),X()}else q(!0)}function Q(e){r.isHighlighted(e)||l(13,r=r.highlight(e))}function W(){z.push(()=>Z()),X()}function X(){z.push(()=>{var e;null!=M&&r.opened&&(null===(e=null==A?void 0:A.querySelector(".highlighted"))||void 0===e||e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}))})}function Z(){if(null==M)return;const{height:e,pageLeft:t}=window.visualViewport,{bottom:i,height:n,top:s}=D.getBoundingClientRect(),{height:o}=A.getBoundingClientRect();l(14,A.style.top=i+o>e||O&&s-o>t?`-${o}px`:n+"px",A)}return e.$$set=e=>{"items"in e&&l(30,g=e.items),"labelFieldName"in e&&l(31,c=e.labelFieldName),"labelFunction"in e&&l(32,p=e.labelFunction),"containerClassNames"in e&&l(0,m=e.containerClassNames),"containerStyle"in e&&l(1,f=e.containerStyle),"inputStyle"in e&&l(2,_=e.inputStyle),"inputClassNames"in e&&l(3,I=e.inputClassNames),"i18n"in e&&l(4,v=e.i18n),"minCharsToSuggest"in e&&l(33,w=e.minCharsToSuggest),"removeOnSelect"in e&&l(34,b=e.removeOnSelect),"closeOnSelect"in e&&l(35,y=e.closeOnSelect),"zIndexOffset"in e&&l(5,x=e.zIndexOffset),"preferOpenUpwards"in e&&l(36,O=e.preferOpenUpwards),"showNumberOfHits"in e&&l(6,S=e.showNumberOfHits),"caseSensitive"in e&&l(37,L=e.caseSensitive),"wide"in e&&l(7,C=e.wide),"tabIndex"in e&&l(8,$=e.tabIndex),"placeholder"in e&&l(9,N=e.placeholder),"inputProps"in e&&l(10,k=e.inputProps),"allowFreeText"in e&&l(11,F=e.allowFreeText),"submitOnFilterChange"in e&&l(38,H=e.submitOnFilterChange),"autoHighlightSingle"in e&&l(39,E=e.autoHighlightSingle),"matchOnStart"in e&&l(40,P=e.matchOnStart),"$$scope"in e&&l(44,d=e.$$scope)},e.$$.update=()=>{3&e.$$.dirty[1]&&l(43,s=null!=p?p:null!=c?e=>e[c]:e=>e),1073743872&e.$$.dirty[0]|4928&e.$$.dirty[1]&&l(13,r=new a(L,!F,E?o.SINGLE_ONLY:o.FIRST_FILTERED,P).setItems(g||[],s)),4096&e.$$.dirty[0]&&function(e){l(13,r=r.filter(e)),r.opened&&W()}(j),12288&e.$$.dirty[0]|2052&e.$$.dirty[1]&&(j.length>=w&&!r.opened&&U&&!r.userClosed?q(!1):(r.opened&&!r.userOpened&&j.length<w||!U||r.userClosed)&&G())},[m,f,_,I,v,x,S,C,$,N,k,F,j,r,A,D,M,R,function(){l(42,U=!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(R)});l(42,U=!B&&e),z.push(()=>B=!1)},q,G,function(){F&&H&&u("select",{selected:j})},function(e){return Y[e.key]&&Y[e.key](e)},function(){!r.opened&&q(!0)},J,function(){l(42,U=!1),G()},Q,function(){F&&l(13,r=r.highlight(null))},Z,g,c,p,w,b,y,O,L,H,E,P,function(e){l(13,r=r.addItem(e))},U,s,d,h,()=>{r.opened&&Z()},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{D=e,l(15,D)})},function(){j=this.value,l(12,j)},()=>G(!0),()=>q(!0),e=>Q(e),()=>J(!0),function(e){t.binding_callbacks[e?"unshift":"push"](()=>{A=e,l(14,A)})},function(e){t.binding_callbacks[e?"unshift":"push"](()=>{M=e,l(16,M)})},()=>D.focus()]}class H extends t.SvelteComponent{constructor(e){super(),t.init(this,e,F,$,t.safe_not_equal,{items:30,labelFieldName:31,labelFunction:32,containerClassNames:0,containerStyle:1,inputStyle:2,inputClassNames:3,i18n:4,minCharsToSuggest:33,removeOnSelect:34,closeOnSelect:35,zIndexOffset:5,preferOpenUpwards:36,showNumberOfHits:6,caseSensitive:37,wide:7,tabIndex:8,placeholder:9,inputProps:10,allowFreeText:11,submitOnFilterChange:38,autoHighlightSingle:39,matchOnStart: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.3.2", | ||
"version": "2.4.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
173833
152