@eox/itemfilter 1.10.0 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -861,16 +861,13 @@ tc-range-slider {
861
861
  margin-top: 4px;
862
862
  padding: 8px;
863
863
  }
864
- .inline-container {
865
- position: relative;
866
- align-items: center;
867
- }
868
864
  .inline-container-wrapper {
869
865
  width: 100%;
870
866
  position: relative;
871
867
  }
872
868
  .inline-container {
873
869
  position: relative;
870
+ align-items: center;
874
871
  border: 1px solid var(--border-color);
875
872
  border-radius: 4px;
876
873
  flex: 1;
@@ -880,6 +877,7 @@ tc-range-slider {
880
877
  display: flex;
881
878
  inline-size: 100%;
882
879
  block-size: 100%;
880
+ overflow-x: auto;
883
881
  }
884
882
  [popover] {
885
883
  position: fixed;
@@ -887,7 +885,6 @@ tc-range-slider {
887
885
  left: 0;
888
886
  margin: 0;
889
887
  padding: 0;
890
- background-color: var(--background-color);
891
888
  border: none;
892
889
  }
893
890
  .input-container {
@@ -921,13 +918,21 @@ button.icon {
921
918
  width: unset;
922
919
  }
923
920
  -container-results::-webkit-scrollbar,
924
- .inline-container::-webkit-scrollbar {
925
- height: 2px;
921
+ .inline-container::-webkit-scrollbar,
922
+ .inline-content::-webkit-scrollbar {
923
+ inline-size: 0.4rem;
924
+ block-size: 0.4rem;
926
925
  }
927
926
  -container-results::-webkit-scrollbar-thumb,
928
- .inline-container::-webkit-scrollbar-thumb {
927
+ .inline-container::-webkit-scrollbar-thumb,
928
+ .inline-content::-webkit-scrollbar-thumb {
929
929
  background: lightgrey;
930
- border-radius: 2px;
930
+ border-radius: 1rem;
931
+ cursor: default;
932
+ }
933
+ .inline-container:is(:hover,:focus)::-webkit-scrollbar-thumb,
934
+ .inline-content:is(:hover,:focus)::-webkit-scrollbar-thumb {
935
+ background: var(--outline);
931
936
  }
932
937
  .hidden {
933
938
  height: 0;
@@ -1059,6 +1064,12 @@ mark.highlight {
1059
1064
  flex: 0;
1060
1065
  align-items: center;
1061
1066
  }
1067
+ .chip {
1068
+ white-space: nowrap;
1069
+ }
1070
+ .input-container.field {
1071
+ min-width: 10rem;
1072
+ }
1062
1073
  .input-container.dirty-filter-input {
1063
1074
  margin-left: 25px;
1064
1075
  }
@@ -4226,9 +4237,12 @@ class Wc extends tt {
4226
4237
  />
4227
4238
  </div>
4228
4239
  </div>
4229
- <div popover="manual">
4240
+ <div
4241
+ popover="manual"
4242
+ class="square surface-container-lowest small-elevate"
4243
+ >
4230
4244
  <div
4231
- class="inline-content square border"
4245
+ class="inline-content"
4232
4246
  slot="content"
4233
4247
  @keydown="${fe(this, ze, Jn)}"
4234
4248
  @click="${fe(this, ze, Qn)}"
@@ -4463,18 +4477,16 @@ function id(t, e) {
4463
4477
  }
4464
4478
  function nd(t, e) {
4465
4479
  var i;
4466
- const r = ((i = t.filterObject) == null ? void 0 : i.sort) || ((n, o) => n.localeCompare(o));
4480
+ const r = ((i = t.filterObject) == null ? void 0 : i.sort) || ((n, o) => n.toString().localeCompare(o.toString(), void 0, { numeric: !0 }));
4467
4481
  return e.sort(r).map((n) => n);
4468
4482
  }
4469
4483
  function mo(t) {
4470
- var r, i, n;
4471
- let e;
4472
- t.query && (e = new Gt(t.suggestions, {
4484
+ var i, n, o;
4485
+ const e = (((i = t.filterObject) == null ? void 0 : i.filterKeys) || t.suggestions).map((a) => `${a}`);
4486
+ let r = e;
4487
+ t.query && (r = new Gt(e, {
4473
4488
  threshold: 0.4
4474
- }).search(t.query).map((a) => a.item)), t.filteredSuggestions = nd(
4475
- t,
4476
- e || t.suggestions
4477
- ), (r = t.filterObject) != null && r.filterKeys && (t.filteredSuggestions = (i = t.filterObject) == null ? void 0 : i.filterKeys.map((o) => `${o}`), t.filterObject.state = (n = t.filterObject) == null ? void 0 : n.filterKeys.map((o) => `${o}`).reduce((o, a) => (a in o || (o[a] = void 0), o), t.filterObject.state)), t.highlightedIndex = -1;
4489
+ }).search(t.query).map((l) => l.item)), t.filteredSuggestions = (n = t.filterObject) != null && n.filterKeys ? r : nd(t, r), (o = t.filterObject) != null && o.filterKeys && (t.filterObject.state = e.reduce((a, l) => (l in a || (a[l] = void 0), a), t.filterObject.state)), t.highlightedIndex = -1;
4478
4490
  }
4479
4491
  function Ua(t) {
4480
4492
  Object.keys(t.filterObject.state).forEach((e) => {
@@ -5093,7 +5105,7 @@ class Ja extends tt {
5093
5105
  }
5094
5106
  </style>
5095
5107
  ${qe(
5096
- this.suggestions.length > 10,
5108
+ (this.filterObject.filterKeys || this.suggestions).length >= 10,
5097
5109
  () => V`<div class="autocomplete-container">
5098
5110
  <div
5099
5111
  class="autocomplete-container-wrapper field small no-round"
@@ -6248,6 +6260,14 @@ class Ad extends tt {
6248
6260
  controller: { attribute: !1, type: Object }
6249
6261
  };
6250
6262
  }
6263
+ /**
6264
+ * Overrides the default createRenderRoot method to render in the light DOM.
6265
+ *
6266
+ * @returns {this} - The current instance to render in the light DOM.
6267
+ */
6268
+ createRenderRoot() {
6269
+ return this;
6270
+ }
6251
6271
  /**
6252
6272
  * Lifecycle method called when the element is connected to the DOM.
6253
6273
  * Adds a keyboard event listener.
@@ -6299,7 +6319,7 @@ class Ad extends tt {
6299
6319
  i.stopPropagation(), this.controller.remove(i), this.requestUpdate();
6300
6320
  }}
6301
6321
  ></span>
6302
- </span>
6322
+ </span>
6303
6323
  </span>
6304
6324
  `
6305
6325
  )}
@@ -311,16 +311,13 @@ tc-range-slider {
311
311
  margin-top: 4px;
312
312
  padding: 8px;
313
313
  }
314
- .inline-container {
315
- position: relative;
316
- align-items: center;
317
- }
318
314
  .inline-container-wrapper {
319
315
  width: 100%;
320
316
  position: relative;
321
317
  }
322
318
  .inline-container {
323
319
  position: relative;
320
+ align-items: center;
324
321
  border: 1px solid var(--border-color);
325
322
  border-radius: 4px;
326
323
  flex: 1;
@@ -330,6 +327,7 @@ tc-range-slider {
330
327
  display: flex;
331
328
  inline-size: 100%;
332
329
  block-size: 100%;
330
+ overflow-x: auto;
333
331
  }
334
332
  [popover] {
335
333
  position: fixed;
@@ -337,7 +335,6 @@ tc-range-slider {
337
335
  left: 0;
338
336
  margin: 0;
339
337
  padding: 0;
340
- background-color: var(--background-color);
341
338
  border: none;
342
339
  }
343
340
  .input-container {
@@ -371,13 +368,21 @@ button.icon {
371
368
  width: unset;
372
369
  }
373
370
  -container-results::-webkit-scrollbar,
374
- .inline-container::-webkit-scrollbar {
375
- height: 2px;
371
+ .inline-container::-webkit-scrollbar,
372
+ .inline-content::-webkit-scrollbar {
373
+ inline-size: 0.4rem;
374
+ block-size: 0.4rem;
376
375
  }
377
376
  -container-results::-webkit-scrollbar-thumb,
378
- .inline-container::-webkit-scrollbar-thumb {
377
+ .inline-container::-webkit-scrollbar-thumb,
378
+ .inline-content::-webkit-scrollbar-thumb {
379
379
  background: lightgrey;
380
- border-radius: 2px;
380
+ border-radius: 1rem;
381
+ cursor: default;
382
+ }
383
+ .inline-container:is(:hover,:focus)::-webkit-scrollbar-thumb,
384
+ .inline-content:is(:hover,:focus)::-webkit-scrollbar-thumb {
385
+ background: var(--outline);
381
386
  }
382
387
  .hidden {
383
388
  height: 0;
@@ -509,6 +514,12 @@ mark.highlight {
509
514
  flex: 0;
510
515
  align-items: center;
511
516
  }
517
+ .chip {
518
+ white-space: nowrap;
519
+ }
520
+ .input-container.field {
521
+ min-width: 10rem;
522
+ }
512
523
  .input-container.dirty-filter-input {
513
524
  margin-left: 25px;
514
525
  }
@@ -615,9 +626,12 @@ input {
615
626
  />
616
627
  </div>
617
628
  </div>
618
- <div popover="manual">
629
+ <div
630
+ popover="manual"
631
+ class="square surface-container-lowest small-elevate"
632
+ >
619
633
  <div
620
- class="inline-content square border"
634
+ class="inline-content"
621
635
  slot="content"
622
636
  @keydown="${fe(this,ze,po)}"
623
637
  @click="${fe(this,ze,ho)}"
@@ -628,7 +642,7 @@ input {
628
642
  </div>
629
643
  </div>
630
644
  `:V`<slot name="section"></slot>`}
631
- `}}ze=new WeakSet,Ja=function(){setTimeout(()=>this._overlayCleanup=Il(this))},co=function(){document.addEventListener("click",this._handleClickOutside),document.addEventListener("focusout",this._handleClickOutside),document.addEventListener("keydown",this._handleKeyDown),fe(this,ze,Ja).call(this)},uo=function(){document.removeEventListener("click",this._handleClickOutside),document.removeEventListener("focusout",this._handleClickOutside),document.removeEventListener("keydown",this._handleKeyDown),this._overlayCleanup()},Za=function(r){Vl(r,this)},po=function(r){Wl(r,this)},fo=function(r){Fl(r,this)},Qa=function(){Ul(this)},ho=function(r){ql(r,this)},es=function(r){gl(r,this)},ts=function(r){Ko(r,this)},customElements.define("eox-itemfilter-container",Hc);var Wn,Ma;function Ic(){if(Ma)return Wn;Ma=1;var t="Expected a function",e=NaN,r="[object Symbol]",i=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,c=typeof ht=="object"&&ht&&ht.Object===Object&&ht,d=typeof self=="object"&&self&&self.Object===Object&&self,m=c||d||Function("return this")(),g=Object.prototype,w=g.toString,b=Math.max,$=Math.min,C=function(){return m.Date.now()};function F(R,le,ne){var ke,_e,he,ee,ye,Ue,E=0,M=!1,z=!1,N=!0;if(typeof R!="function")throw new TypeError(t);le=se(le)||0,q(ne)&&(M=!!ne.leading,z="maxWait"in ne,he=z?b(se(ne.maxWait)||0,le):he,N="trailing"in ne?!!ne.trailing:N);function L(j){var Oe=ke,Se=_e;return ke=_e=void 0,E=j,ee=R.apply(Se,Oe),ee}function Y(j){return E=j,ye=setTimeout(me,le),M?L(j):ee}function K(j){var Oe=j-Ue,Se=j-E,G=le-Oe;return z?$(G,he-Se):G}function ie(j){var Oe=j-Ue,Se=j-E;return Ue===void 0||Oe>=le||Oe<0||z&&Se>=he}function me(){var j=C();if(ie(j))return Me(j);ye=setTimeout(me,K(j))}function Me(j){return ye=void 0,N&&ke?L(j):(ke=_e=void 0,ee)}function Pe(){ye!==void 0&&clearTimeout(ye),E=0,ke=Ue=_e=ye=void 0}function Ie(){return ye===void 0?ee:Me(C())}function Ce(){var j=C(),Oe=ie(j);if(ke=arguments,_e=this,Ue=j,Oe){if(ye===void 0)return Y(Ue);if(z)return ye=setTimeout(me,le),L(Ue)}return ye===void 0&&(ye=setTimeout(me,le)),ee}return Ce.cancel=Pe,Ce.flush=Ie,Ce}function q(R){var le=typeof R;return!!R&&(le=="object"||le=="function")}function ae(R){return!!R&&typeof R=="object"}function te(R){return typeof R=="symbol"||ae(R)&&w.call(R)==r}function se(R){if(typeof R=="number")return R;if(te(R))return e;if(q(R)){var le=typeof R.valueOf=="function"?R.valueOf():R;R=q(le)?le+"":le}if(typeof R!="string")return R===0?R:+R;R=R.replace(i,"");var ne=o.test(R);return ne||a.test(R)?l(R.slice(2),ne?2:8):n.test(R)?e:+R}return Wn=F,Wn}var qc=Ic();const Xi=Yi(qc);function Uc(t){const e=t.renderRoot.querySelector("input[type='text']");e.value="",Gi(t.filterObject),t.requestUpdate()}function Fc(t){const e=t.renderRoot.querySelector("input[type='text']");t.isValid=e.checkValidity(),t.filterObject.keys.forEach(r=>{t.filterObject.state[r]=e.value}),t.filterObject.dirty=!0,t.filterObject.stringifiedState=e.value,t.dispatchEvent(new CustomEvent("filter")),e.value===""&&t.reset()}const Vn="ddd, D MMM YYYY HH:mm:ss";function Wc(t){if(t.filterObject=Gi(t.filterObject),t.filterObject){const e=t.querySelector("tc-range-slider"),r=t.filterObject.min,i=t.filterObject.max;e.value1!==r&&(e.value1=r),e.value2!==i&&(e.value2=i)}t.requestUpdate()}function Vc(t,e){const[r,i]=t.detail.values;(r!==e.filterObject.state.min||i!==e.filterObject.state.max)&&([e.filterObject.state.min,e.filterObject.state.max]=[r,i],e.filterObject.dirty=!0),e.filterObject.dirty&&(e.filterObject.stringifiedState=e.filterObject.format==="date"?`${ni.unix(r).format(Vn)} - ${ni.unix(i).format(Vn)}`:`${r} - ${i}`),e.dispatchEvent(new CustomEvent("filter")),r===e.filterObject.min&&i===e.filterObject.max?e.reset():e.requestUpdate()}function Yc(t,e,r){const i=r.filterObject.format==="date",n=r.filterObject.state[t],o=i?ni.unix(n).format(Vn):n;return V`<div class="range-${e}">${o}</div>`}function Kc(t){Gc(-1,t),Gi(t.filterObject),t.requestUpdate()}function Gc(t,e){e.selectedItems=[],Yn(e),Ca(e)}function Sa(t,e){const r=e.selectedItems.indexOf(t);r>=0?e.selectedItems=e.selectedItems.filter((i,n)=>n!==r):e.type==="multiselect"?e.selectedItems=[...e.selectedItems,t]:(e.selectedItems=[t],e.showSuggestions=!1),Yn(e),Ca(e)}function Xc(t,e){t.target instanceof HTMLInputElement&&(e.query=t.target.value,e.showSuggestions=!0)}function Jc(t,e){switch(t.key){case"ArrowDown":e.highlightedIndex=Math.min(e.highlightedIndex+1,e.filteredSuggestions.length-1);break;case"ArrowUp":e.highlightedIndex=Math.max(e.highlightedIndex-1,0);break;case"Enter":e.highlightedIndex>=0&&Sa(e.filteredSuggestions[e.highlightedIndex],e);break;case"Escape":e.showSuggestions=!1;break}}function Zc(t,e){(t.has("suggestions")||t.has("query"))&&Yn(e)}function Qc(t,e){var i;const r=((i=t.filterObject)==null?void 0:i.sort)||((n,o)=>n.localeCompare(o));return e.sort(r).map(n=>n)}function Yn(t){var r,i,n;let e;t.query&&(e=new qt(t.suggestions,{threshold:.4}).search(t.query).map(a=>a.item)),t.filteredSuggestions=Qc(t,e||t.suggestions),(r=t.filterObject)!=null&&r.filterKeys&&(t.filteredSuggestions=(i=t.filterObject)==null?void 0:i.filterKeys.map(o=>`${o}`),t.filterObject.state=(n=t.filterObject)==null?void 0:n.filterKeys.map(o=>`${o}`).reduce((o,a)=>(a in o||(o[a]=void 0),o),t.filterObject.state)),t.highlightedIndex=-1}function Ca(t){Object.keys(t.filterObject.state).forEach(e=>{t.filterObject.state[e]=t.selectedItems.includes(e)}),t.filterObject.stringifiedState=Object.keys(t.filterObject.state).filter(e=>t.filterObject.state[e]).join(", ")||"",t.filterObject.dirty=t.filterObject.stringifiedState.length>0,t.dispatchEvent(new CustomEvent("filter")),t.requestUpdate()}function ed(t){Gi(t.filterObject),t.renderRoot.querySelector("eox-itemfilter-spatial-filter").reset(),t.requestUpdate()}function td(t){t.renderRoot.querySelector("#eox-map").innerHTML="",La(t)}function rd(t,e){e.filterObject.state.mode=t;const r=new CustomEvent("filter",{detail:{[e.filterObject.key]:{}}});e.dispatchEvent(r)}function La(t){const e=t.renderRoot.querySelector("#eox-map");e.innerHTML===""&&(e.innerHTML='<eox-map part="map" style="height: 400px"></eox-map>');const r=t.geometry&&id(t.geometry),i=jc(t.geometry,r);t.eoxMap=t.renderRoot.querySelector("eox-map"),setTimeout(()=>{t.eoxMap.layers=i;const n=o=>{const a=new CustomEvent("filter",{detail:{geometry:{type:"Polygon",coordinates:o.getGeometry().clone().transform("EPSG:3857","EPSG:4326").getCoordinates()}}});t.dispatchEvent(a)};t.eoxMap.interactions.drawInteraction.on("drawend",o=>{n(o.feature),t.eoxMap.removeInteraction("drawInteraction")}),t.eoxMap.interactions.drawInteraction_modify.on("modifyend",o=>{n(o.features.getArray()[0])})},1e3)}function id(t){return`data:text/json,${encodeURIComponent(JSON.stringify({type:"FeatureCollection",features:[{type:"Feature",properties:null,geometry:t}]}))}`}class nd extends tt{constructor(){super();nt(this,Qi,()=>{Fc(this)});Ci(this,"debouncedInputHandler",Xi(pt(this,Qi),500,{leading:!0}));this.filterObject={},this.unstyled=!1,this.tabIndex=0,this.isValid=!1}static get properties(){return{filterObject:{attribute:!1,type:Object},tabIndex:{attribute:!1,type:Number},unstyled:{type:Boolean},isValid:{state:!0,type:Boolean}}}reset(){Uc(this)}createRenderRoot(){return this}render(){return Fe(this.filterObject,()=>{var r;return V`
645
+ `}}ze=new WeakSet,Ja=function(){setTimeout(()=>this._overlayCleanup=Il(this))},co=function(){document.addEventListener("click",this._handleClickOutside),document.addEventListener("focusout",this._handleClickOutside),document.addEventListener("keydown",this._handleKeyDown),fe(this,ze,Ja).call(this)},uo=function(){document.removeEventListener("click",this._handleClickOutside),document.removeEventListener("focusout",this._handleClickOutside),document.removeEventListener("keydown",this._handleKeyDown),this._overlayCleanup()},Za=function(r){Vl(r,this)},po=function(r){Wl(r,this)},fo=function(r){Fl(r,this)},Qa=function(){Ul(this)},ho=function(r){ql(r,this)},es=function(r){gl(r,this)},ts=function(r){Ko(r,this)},customElements.define("eox-itemfilter-container",Hc);var Wn,Ma;function Ic(){if(Ma)return Wn;Ma=1;var t="Expected a function",e=NaN,r="[object Symbol]",i=/^\s+|\s+$/g,n=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,l=parseInt,c=typeof ht=="object"&&ht&&ht.Object===Object&&ht,d=typeof self=="object"&&self&&self.Object===Object&&self,m=c||d||Function("return this")(),g=Object.prototype,w=g.toString,b=Math.max,$=Math.min,C=function(){return m.Date.now()};function F(R,le,ne){var ke,_e,he,ee,ye,Ue,E=0,M=!1,z=!1,N=!0;if(typeof R!="function")throw new TypeError(t);le=se(le)||0,q(ne)&&(M=!!ne.leading,z="maxWait"in ne,he=z?b(se(ne.maxWait)||0,le):he,N="trailing"in ne?!!ne.trailing:N);function L(j){var Oe=ke,Se=_e;return ke=_e=void 0,E=j,ee=R.apply(Se,Oe),ee}function Y(j){return E=j,ye=setTimeout(me,le),M?L(j):ee}function K(j){var Oe=j-Ue,Se=j-E,G=le-Oe;return z?$(G,he-Se):G}function ie(j){var Oe=j-Ue,Se=j-E;return Ue===void 0||Oe>=le||Oe<0||z&&Se>=he}function me(){var j=C();if(ie(j))return Me(j);ye=setTimeout(me,K(j))}function Me(j){return ye=void 0,N&&ke?L(j):(ke=_e=void 0,ee)}function Pe(){ye!==void 0&&clearTimeout(ye),E=0,ke=Ue=_e=ye=void 0}function Ie(){return ye===void 0?ee:Me(C())}function Ce(){var j=C(),Oe=ie(j);if(ke=arguments,_e=this,Ue=j,Oe){if(ye===void 0)return Y(Ue);if(z)return ye=setTimeout(me,le),L(Ue)}return ye===void 0&&(ye=setTimeout(me,le)),ee}return Ce.cancel=Pe,Ce.flush=Ie,Ce}function q(R){var le=typeof R;return!!R&&(le=="object"||le=="function")}function ae(R){return!!R&&typeof R=="object"}function te(R){return typeof R=="symbol"||ae(R)&&w.call(R)==r}function se(R){if(typeof R=="number")return R;if(te(R))return e;if(q(R)){var le=typeof R.valueOf=="function"?R.valueOf():R;R=q(le)?le+"":le}if(typeof R!="string")return R===0?R:+R;R=R.replace(i,"");var ne=o.test(R);return ne||a.test(R)?l(R.slice(2),ne?2:8):n.test(R)?e:+R}return Wn=F,Wn}var qc=Ic();const Xi=Yi(qc);function Uc(t){const e=t.renderRoot.querySelector("input[type='text']");e.value="",Gi(t.filterObject),t.requestUpdate()}function Fc(t){const e=t.renderRoot.querySelector("input[type='text']");t.isValid=e.checkValidity(),t.filterObject.keys.forEach(r=>{t.filterObject.state[r]=e.value}),t.filterObject.dirty=!0,t.filterObject.stringifiedState=e.value,t.dispatchEvent(new CustomEvent("filter")),e.value===""&&t.reset()}const Vn="ddd, D MMM YYYY HH:mm:ss";function Wc(t){if(t.filterObject=Gi(t.filterObject),t.filterObject){const e=t.querySelector("tc-range-slider"),r=t.filterObject.min,i=t.filterObject.max;e.value1!==r&&(e.value1=r),e.value2!==i&&(e.value2=i)}t.requestUpdate()}function Vc(t,e){const[r,i]=t.detail.values;(r!==e.filterObject.state.min||i!==e.filterObject.state.max)&&([e.filterObject.state.min,e.filterObject.state.max]=[r,i],e.filterObject.dirty=!0),e.filterObject.dirty&&(e.filterObject.stringifiedState=e.filterObject.format==="date"?`${ni.unix(r).format(Vn)} - ${ni.unix(i).format(Vn)}`:`${r} - ${i}`),e.dispatchEvent(new CustomEvent("filter")),r===e.filterObject.min&&i===e.filterObject.max?e.reset():e.requestUpdate()}function Yc(t,e,r){const i=r.filterObject.format==="date",n=r.filterObject.state[t],o=i?ni.unix(n).format(Vn):n;return V`<div class="range-${e}">${o}</div>`}function Kc(t){Gc(-1,t),Gi(t.filterObject),t.requestUpdate()}function Gc(t,e){e.selectedItems=[],Yn(e),Ca(e)}function Sa(t,e){const r=e.selectedItems.indexOf(t);r>=0?e.selectedItems=e.selectedItems.filter((i,n)=>n!==r):e.type==="multiselect"?e.selectedItems=[...e.selectedItems,t]:(e.selectedItems=[t],e.showSuggestions=!1),Yn(e),Ca(e)}function Xc(t,e){t.target instanceof HTMLInputElement&&(e.query=t.target.value,e.showSuggestions=!0)}function Jc(t,e){switch(t.key){case"ArrowDown":e.highlightedIndex=Math.min(e.highlightedIndex+1,e.filteredSuggestions.length-1);break;case"ArrowUp":e.highlightedIndex=Math.max(e.highlightedIndex-1,0);break;case"Enter":e.highlightedIndex>=0&&Sa(e.filteredSuggestions[e.highlightedIndex],e);break;case"Escape":e.showSuggestions=!1;break}}function Zc(t,e){(t.has("suggestions")||t.has("query"))&&Yn(e)}function Qc(t,e){var i;const r=((i=t.filterObject)==null?void 0:i.sort)||((n,o)=>n.toString().localeCompare(o.toString(),void 0,{numeric:!0}));return e.sort(r).map(n=>n)}function Yn(t){var i,n,o;const e=(((i=t.filterObject)==null?void 0:i.filterKeys)||t.suggestions).map(a=>`${a}`);let r=e;t.query&&(r=new qt(e,{threshold:.4}).search(t.query).map(l=>l.item)),t.filteredSuggestions=(n=t.filterObject)!=null&&n.filterKeys?r:Qc(t,r),(o=t.filterObject)!=null&&o.filterKeys&&(t.filterObject.state=e.reduce((a,l)=>(l in a||(a[l]=void 0),a),t.filterObject.state)),t.highlightedIndex=-1}function Ca(t){Object.keys(t.filterObject.state).forEach(e=>{t.filterObject.state[e]=t.selectedItems.includes(e)}),t.filterObject.stringifiedState=Object.keys(t.filterObject.state).filter(e=>t.filterObject.state[e]).join(", ")||"",t.filterObject.dirty=t.filterObject.stringifiedState.length>0,t.dispatchEvent(new CustomEvent("filter")),t.requestUpdate()}function ed(t){Gi(t.filterObject),t.renderRoot.querySelector("eox-itemfilter-spatial-filter").reset(),t.requestUpdate()}function td(t){t.renderRoot.querySelector("#eox-map").innerHTML="",La(t)}function rd(t,e){e.filterObject.state.mode=t;const r=new CustomEvent("filter",{detail:{[e.filterObject.key]:{}}});e.dispatchEvent(r)}function La(t){const e=t.renderRoot.querySelector("#eox-map");e.innerHTML===""&&(e.innerHTML='<eox-map part="map" style="height: 400px"></eox-map>');const r=t.geometry&&id(t.geometry),i=jc(t.geometry,r);t.eoxMap=t.renderRoot.querySelector("eox-map"),setTimeout(()=>{t.eoxMap.layers=i;const n=o=>{const a=new CustomEvent("filter",{detail:{geometry:{type:"Polygon",coordinates:o.getGeometry().clone().transform("EPSG:3857","EPSG:4326").getCoordinates()}}});t.dispatchEvent(a)};t.eoxMap.interactions.drawInteraction.on("drawend",o=>{n(o.feature),t.eoxMap.removeInteraction("drawInteraction")}),t.eoxMap.interactions.drawInteraction_modify.on("modifyend",o=>{n(o.features.getArray()[0])})},1e3)}function id(t){return`data:text/json,${encodeURIComponent(JSON.stringify({type:"FeatureCollection",features:[{type:"Feature",properties:null,geometry:t}]}))}`}class nd extends tt{constructor(){super();nt(this,Qi,()=>{Fc(this)});Ci(this,"debouncedInputHandler",Xi(pt(this,Qi),500,{leading:!0}));this.filterObject={},this.unstyled=!1,this.tabIndex=0,this.isValid=!1}static get properties(){return{filterObject:{attribute:!1,type:Object},tabIndex:{attribute:!1,type:Number},unstyled:{type:Boolean},isValid:{state:!0,type:Boolean}}}reset(){Uc(this)}createRenderRoot(){return this}render(){return Fe(this.filterObject,()=>{var r;return V`
632
646
  <style></style>
633
647
  <div class="text-container">
634
648
  <div
@@ -799,7 +813,7 @@ input {
799
813
  --select-filter-max-items: 5;
800
814
  }
801
815
  </style>
802
- ${Fe(this.suggestions.length>10,()=>V`<div class="autocomplete-container">
816
+ ${Fe((this.filterObject.filterKeys||this.suggestions).length>=10,()=>V`<div class="autocomplete-container">
803
817
  <div
804
818
  class="autocomplete-container-wrapper field small no-round"
805
819
  style="margin-left: var(--list-padding)"
@@ -876,7 +890,7 @@ input {
876
890
  @filter="${i=>{this.filterObject.state.geometry=i.detail.geometry,this.filterObject.dirty=!0,this.filterObject.stringifiedState="Polygon",this.dispatchEvent(new CustomEvent("filter"))}}"
877
891
  ></eox-itemfilter-spatial>
878
892
  </div>
879
- `})}}en=new WeakSet,ss=function(r){rd(r,this)},customElements.define("eox-itemfilter-spatial",md);class gd extends tt{constructor(){super();nt(this,tn);this.geometry=null,this.eoxMap=null}static get properties(){return{geometry:{type:Object},eoxMap:{type:Object}}}firstUpdated(){fe(this,tn,ls).call(this)}reset(){td(this)}render(){return V`<div id="eox-map"></div>`}}tn=new WeakSet,ls=function(){La(this)},customElements.define("eox-itemfilter-spatial-filter",gd);function bd(t,e){e.renderRoot.querySelectorAll(".chip").forEach(r=>{r.classList.remove("highlighted")}),t.target instanceof HTMLElement&&t.target.classList.add("highlighted"),e.requestUpdate()}function vd(t,e){const{code:r,target:i}=t;i instanceof HTMLElement&&i.id!=="eox-itemfilter-input-search"||e.parentElement.classList.contains("hidden")&&["ArrowLeft","ArrowRight","Backspace"].includes(r)||(r==="Space"&&t.preventDefault(),["Escape","Space","Enter"].includes(r)||t.stopPropagation(),["ArrowLeft","ArrowRight","Escape","Backspace"].includes(r)&&yd(r,t.target.value??"",e))}function yd(t,e,r){const i=r.renderRoot.querySelector(".chip.highlighted");if((t==="Escape"||e)&&i&&i.classList.remove("highlighted"),t==="Backspace"&&!e){if(r.items.length){i&&(i.querySelector(".chip-item-close").click(),r.items.splice(Array.from(r.renderRoot.querySelectorAll(".chip")).indexOf(i),1));const n=r.renderRoot.querySelectorAll(".chip")[r.renderRoot.querySelectorAll(".chip").length-1];n.classList.contains("highlighted")||n.classList.add("highlighted"),r.requestUpdate()}r._dispatchEvent()}if((t==="ArrowLeft"||t==="ArrowRight")&&!e){if(r.renderRoot.querySelectorAll(".chip").length<1)return;let n=0;const o=r.renderRoot.querySelector(".chip.highlighted");o&&(n=Array.from(r.renderRoot.querySelectorAll(".chip")).indexOf(o),o.classList.remove("highlighted")),n=n+(t==="ArrowLeft"?-1:1),t==="ArrowLeft"&&n<0&&(n=r.renderRoot.querySelectorAll(".chip").length-1),t==="ArrowRight"&&n>r.renderRoot.querySelectorAll(".chip").length-1&&(n=0),Array.from(r.renderRoot.querySelectorAll(".chip"))[n].classList.add("highlighted")}}class xd extends tt{constructor(){super();nt(this,cr);this.items={},this.controller={}}static get properties(){return{items:{attribute:!1,type:Object},controller:{attribute:!1,type:Object}}}connectedCallback(){super.connectedCallback(),this.getRootNode().addEventListener("keydown",fe(this,cr,bo).bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.getRootNode().removeEventListener("keydown",fe(this,cr,bo).bind(this))}_dispatchEvent(){this.dispatchEvent(new CustomEvent("items-selected",{detail:this.items}))}render(){return V`
893
+ `})}}en=new WeakSet,ss=function(r){rd(r,this)},customElements.define("eox-itemfilter-spatial",md);class gd extends tt{constructor(){super();nt(this,tn);this.geometry=null,this.eoxMap=null}static get properties(){return{geometry:{type:Object},eoxMap:{type:Object}}}firstUpdated(){fe(this,tn,ls).call(this)}reset(){td(this)}render(){return V`<div id="eox-map"></div>`}}tn=new WeakSet,ls=function(){La(this)},customElements.define("eox-itemfilter-spatial-filter",gd);function bd(t,e){e.renderRoot.querySelectorAll(".chip").forEach(r=>{r.classList.remove("highlighted")}),t.target instanceof HTMLElement&&t.target.classList.add("highlighted"),e.requestUpdate()}function vd(t,e){const{code:r,target:i}=t;i instanceof HTMLElement&&i.id!=="eox-itemfilter-input-search"||e.parentElement.classList.contains("hidden")&&["ArrowLeft","ArrowRight","Backspace"].includes(r)||(r==="Space"&&t.preventDefault(),["Escape","Space","Enter"].includes(r)||t.stopPropagation(),["ArrowLeft","ArrowRight","Escape","Backspace"].includes(r)&&yd(r,t.target.value??"",e))}function yd(t,e,r){const i=r.renderRoot.querySelector(".chip.highlighted");if((t==="Escape"||e)&&i&&i.classList.remove("highlighted"),t==="Backspace"&&!e){if(r.items.length){i&&(i.querySelector(".chip-item-close").click(),r.items.splice(Array.from(r.renderRoot.querySelectorAll(".chip")).indexOf(i),1));const n=r.renderRoot.querySelectorAll(".chip")[r.renderRoot.querySelectorAll(".chip").length-1];n.classList.contains("highlighted")||n.classList.add("highlighted"),r.requestUpdate()}r._dispatchEvent()}if((t==="ArrowLeft"||t==="ArrowRight")&&!e){if(r.renderRoot.querySelectorAll(".chip").length<1)return;let n=0;const o=r.renderRoot.querySelector(".chip.highlighted");o&&(n=Array.from(r.renderRoot.querySelectorAll(".chip")).indexOf(o),o.classList.remove("highlighted")),n=n+(t==="ArrowLeft"?-1:1),t==="ArrowLeft"&&n<0&&(n=r.renderRoot.querySelectorAll(".chip").length-1),t==="ArrowRight"&&n>r.renderRoot.querySelectorAll(".chip").length-1&&(n=0),Array.from(r.renderRoot.querySelectorAll(".chip"))[n].classList.add("highlighted")}}class xd extends tt{constructor(){super();nt(this,cr);this.items={},this.controller={}}static get properties(){return{items:{attribute:!1,type:Object},controller:{attribute:!1,type:Object}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.getRootNode().addEventListener("keydown",fe(this,cr,bo).bind(this))}disconnectedCallback(){super.disconnectedCallback(),this.getRootNode().removeEventListener("keydown",fe(this,cr,bo).bind(this))}_dispatchEvent(){this.dispatchEvent(new CustomEvent("items-selected",{detail:this.items}))}render(){return V`
880
894
  <span class="chip-container">
881
895
  ${Di(this.items,r=>V`
882
896
  <span class="chip tiny-margin" @click=${fe(this,cr,cs).bind(this)}>
@@ -886,7 +900,7 @@ input {
886
900
  data-close=${r.key}
887
901
  @click=${i=>{i.stopPropagation(),this.controller.remove(i),this.requestUpdate()}}
888
902
  ></span>
889
- </span>
903
+ </span>
890
904
  </span>
891
905
  `)}
892
906
  </span>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/itemfilter",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "type": "module",
5
5
  "devDependencies": {
6
6
  "@types/geojson": "^7946.0.14",
@@ -38,6 +38,15 @@ export class EOxItemFilterChipsV2 extends LitElement {
38
38
  this.controller = {};
39
39
  }
40
40
 
41
+ /**
42
+ * Overrides the default createRenderRoot method to render in the light DOM.
43
+ *
44
+ * @returns {this} - The current instance to render in the light DOM.
45
+ */
46
+ createRenderRoot() {
47
+ return this;
48
+ }
49
+
41
50
  /**
42
51
  * Lifecycle method called when the element is connected to the DOM.
43
52
  * Adds a keyboard event listener.
@@ -115,7 +124,7 @@ export class EOxItemFilterChipsV2 extends LitElement {
115
124
  this.requestUpdate();
116
125
  }}
117
126
  ></span>
118
- </span>
127
+ </span>
119
128
  </span>
120
129
  `,
121
130
  )}
@@ -196,7 +196,7 @@ export class EOxSelector extends LitElement {
196
196
  }
197
197
  </style>
198
198
  ${when(
199
- this.suggestions.length > 10,
199
+ (this.filterObject.filterKeys || this.suggestions).length >= 10,
200
200
  () =>
201
201
  html`<div class="autocomplete-container">
202
202
  <div
@@ -282,9 +282,12 @@ export class EOxItemFilterContainer extends LitElement {
282
282
  />
283
283
  </div>
284
284
  </div>
285
- <div popover="manual">
285
+ <div
286
+ popover="manual"
287
+ class="square surface-container-lowest small-elevate"
288
+ >
286
289
  <div
287
- class="inline-content square border"
290
+ class="inline-content"
288
291
  slot="content"
289
292
  @keydown="${this.#handleKeyDown}"
290
293
  @click="${this.#handleFormClick}"
@@ -140,7 +140,9 @@ export function updatedSelectorMethod(
140
140
  */
141
141
  function getSortedSuggestions(EOxItemFilterSelector, suggestion) {
142
142
  const sortCallback =
143
- EOxItemFilterSelector.filterObject?.sort || ((a, b) => a.localeCompare(b));
143
+ EOxItemFilterSelector.filterObject?.sort ||
144
+ ((a, b) =>
145
+ a.toString().localeCompare(b.toString(), undefined, { numeric: true }));
144
146
 
145
147
  return suggestion.sort(sortCallback).map((i) => i);
146
148
  }
@@ -151,33 +153,34 @@ function getSortedSuggestions(EOxItemFilterSelector, suggestion) {
151
153
  * @param {Object} EOxItemFilterSelector - The EOxItemFilterSelector component instance.
152
154
  */
153
155
  function updateSuggestions(EOxItemFilterSelector) {
154
- let filteredSuggestion;
156
+ const items = (
157
+ EOxItemFilterSelector.filterObject?.filterKeys ||
158
+ EOxItemFilterSelector.suggestions
159
+ ).map((i) => `${i}`);
160
+ let filteredSuggestion = items;
161
+
155
162
  if (EOxItemFilterSelector.query) {
156
- const fuse = new Fuse(EOxItemFilterSelector.suggestions, {
163
+ const fuse = new Fuse(items, {
157
164
  threshold: 0.4,
158
165
  });
159
166
  filteredSuggestion = fuse
160
167
  .search(EOxItemFilterSelector.query)
161
168
  .map((result) => result.item);
162
169
  }
163
- EOxItemFilterSelector.filteredSuggestions = getSortedSuggestions(
164
- EOxItemFilterSelector,
165
- filteredSuggestion || EOxItemFilterSelector.suggestions,
166
- );
170
+
171
+ EOxItemFilterSelector.filteredSuggestions = EOxItemFilterSelector.filterObject
172
+ ?.filterKeys
173
+ ? filteredSuggestion
174
+ : getSortedSuggestions(EOxItemFilterSelector, filteredSuggestion);
167
175
 
168
176
  // if `filterKeys` is defined, force filter keys
169
177
  if (EOxItemFilterSelector.filterObject?.filterKeys) {
170
- EOxItemFilterSelector.filteredSuggestions =
171
- EOxItemFilterSelector.filterObject?.filterKeys.map((k) => `${k}`);
172
- EOxItemFilterSelector.filterObject.state =
173
- EOxItemFilterSelector.filterObject?.filterKeys
174
- .map((k) => `${k}`)
175
- .reduce((acc, curr) => {
176
- if (!(curr in acc)) {
177
- acc[curr] = undefined;
178
- }
179
- return acc;
180
- }, EOxItemFilterSelector.filterObject.state);
178
+ EOxItemFilterSelector.filterObject.state = items.reduce((acc, curr) => {
179
+ if (!(curr in acc)) {
180
+ acc[curr] = undefined;
181
+ }
182
+ return acc;
183
+ }, EOxItemFilterSelector.filterObject.state);
181
184
  }
182
185
 
183
186
  EOxItemFilterSelector.highlightedIndex = -1;
package/src/style.eox.js CHANGED
@@ -236,16 +236,13 @@ tc-range-slider {
236
236
  margin-top: 4px;
237
237
  padding: 8px;
238
238
  }
239
- .inline-container {
240
- position: relative;
241
- align-items: center;
242
- }
243
239
  .inline-container-wrapper {
244
240
  width: 100%;
245
241
  position: relative;
246
242
  }
247
243
  .inline-container {
248
244
  position: relative;
245
+ align-items: center;
249
246
  border: 1px solid var(--border-color);
250
247
  border-radius: 4px;
251
248
  flex: 1;
@@ -255,6 +252,7 @@ tc-range-slider {
255
252
  display: flex;
256
253
  inline-size: 100%;
257
254
  block-size: 100%;
255
+ overflow-x: auto;
258
256
  }
259
257
  [popover] {
260
258
  position: fixed;
@@ -262,7 +260,6 @@ tc-range-slider {
262
260
  left: 0;
263
261
  margin: 0;
264
262
  padding: 0;
265
- background-color: var(--background-color);
266
263
  border: none;
267
264
  }
268
265
  .input-container {
@@ -296,13 +293,21 @@ button.icon {
296
293
  width: unset;
297
294
  }
298
295
  -container-results::-webkit-scrollbar,
299
- .inline-container::-webkit-scrollbar {
300
- height: 2px;
296
+ .inline-container::-webkit-scrollbar,
297
+ .inline-content::-webkit-scrollbar {
298
+ inline-size: 0.4rem;
299
+ block-size: 0.4rem;
301
300
  }
302
301
  -container-results::-webkit-scrollbar-thumb,
303
- .inline-container::-webkit-scrollbar-thumb {
302
+ .inline-container::-webkit-scrollbar-thumb,
303
+ .inline-content::-webkit-scrollbar-thumb {
304
304
  background: lightgrey;
305
- border-radius: 2px;
305
+ border-radius: 1rem;
306
+ cursor: default;
307
+ }
308
+ .inline-container:is(:hover,:focus)::-webkit-scrollbar-thumb,
309
+ .inline-content:is(:hover,:focus)::-webkit-scrollbar-thumb {
310
+ background: var(--outline);
306
311
  }
307
312
  .hidden {
308
313
  height: 0;
@@ -434,6 +439,12 @@ mark.highlight {
434
439
  flex: 0;
435
440
  align-items: center;
436
441
  }
442
+ .chip {
443
+ white-space: nowrap;
444
+ }
445
+ .input-container.field {
446
+ min-width: 10rem;
447
+ }
437
448
  .input-container.dirty-filter-input {
438
449
  margin-left: 25px;
439
450
  }
@@ -27,6 +27,12 @@ export class EOxItemFilterChipsV2 extends LitElement {
27
27
  * @type Object
28
28
  */
29
29
  controller: any;
30
+ /**
31
+ * Overrides the default createRenderRoot method to render in the light DOM.
32
+ *
33
+ * @returns {this} - The current instance to render in the light DOM.
34
+ */
35
+ createRenderRoot(): this;
30
36
  /**
31
37
  * Dispatches a custom event with the selected items.
32
38
  *
@@ -1 +1 @@
1
- {"version":3,"file":"chips.d.ts","sourceRoot":"","sources":["../../src/components/chips.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;MAKC;IAKC;;OAEG;IACH,WAAe;IAEf;;OAEG;IACH,gBAAoB;IA2BtB;;;;OAIG;IAEH,uBAMC;IAqBD;;OAEG;IACH,+CAuBC;;CACF;2BA5HgC,KAAK"}
1
+ {"version":3,"file":"chips.d.ts","sourceRoot":"","sources":["../../src/components/chips.js"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;MAKC;IAKC;;OAEG;IACH,WAAe;IAEf;;OAEG;IACH,gBAAoB;IAGtB;;;;OAIG;IACH,oBAFa,IAAI,CAIhB;IA0BD;;;;OAIG;IAEH,uBAMC;IAqBD;;OAEG;IACH,+CAuBC;;CACF;2BArIgC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"itemfilter-container.d.ts","sourceRoot":"","sources":["../../src/components/itemfilter-container.js"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;;;;;;;;MAOC;IAKC;;OAEG;IACH,sBAA0B;IAE1B;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,aAAiB;IAEjB;;OAEG;IACH,qBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAC,UAAU,KAAK,GAAG,CAEE;IAE9D;;OAEG;IACH,gBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,KAAK,GAAG,CAEA;IAGtD;;OAEG;IACH,gCAIC;IAED,4BAEC;IA6CD;;;;;;OAMG;IACH,wBAAoB;IA+DpB;;;OAGG;IACH,qBAEC;IAED,uCAKC;IAED;;OAEG;IACH,+CAqFC;;CACF;2BA5SgC,KAAK"}
1
+ {"version":3,"file":"itemfilter-container.d.ts","sourceRoot":"","sources":["../../src/components/itemfilter-container.js"],"names":[],"mappings":"AAeA;;;;;;;;;GASG;AACH;IAEE;;;;;;;;;;;;;;;;MAOC;IAKC;;OAEG;IACH,sBAA0B;IAE1B;;OAEG;IACH,kBAAqB;IAErB;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,aAAiB;IAEjB;;OAEG;IACH,qBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,GAAC,UAAU,KAAK,GAAG,CAEE;IAE9D;;OAEG;IACH,gBAFU,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,aAAa,KAAK,GAAG,CAEA;IAGtD;;OAEG;IACH,gCAIC;IAED,4BAEC;IA6CD;;;;;;OAMG;IACH,wBAAoB;IA+DpB;;;OAGG;IACH,qBAEC;IAED,uCAKC;IAED;;OAEG;IACH,+CAwFC;;CACF;2BA/SgC,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"style.eox.d.ts","sourceRoot":"","sources":["../src/style.eox.js"],"names":[],"mappings":"AAKA,8BA+bE"}
1
+ {"version":3,"file":"style.eox.d.ts","sourceRoot":"","sources":["../src/style.eox.js"],"names":[],"mappings":"AAKA,8BA0cE"}