@fluid-topics/ft-filter 0.2.8 → 0.2.11

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.
@@ -43,6 +43,7 @@ export declare class FtFilter extends FtLitElement implements FtFilterProperties
43
43
  private valuesContainer?;
44
44
  private levelsContainer?;
45
45
  private lastLevel?;
46
+ private filterInput?;
46
47
  private levels?;
47
48
  private withScroll;
48
49
  private filter;
@@ -1146,6 +1146,7 @@ class yi extends He{constructor(t){if(super(t),this.it=V,t.type!==Pe)throw Error
1146
1146
  class="ft-typography--caption"
1147
1147
  ?disabled=${!o}
1148
1148
  placeholder="${this.filterPlaceHolder.replace("{0}",this.label)}"
1149
+ @search=${this.onFilterChange}
1149
1150
  @keyup=${this.onFilterChange}>
1150
1151
  </div>
1151
1152
  <div class="ft-filter--values">
@@ -1191,7 +1192,7 @@ class yi extends He{constructor(t){if(super(t),this.it=V,t.type!==Pe)throw Error
1191
1192
  @display-level=${this.onDisplayLevel}
1192
1193
  part="values"
1193
1194
  ></ft-filter-level>
1194
- `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const e=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new co(e)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(t){const e=t.composedPath()[0];this.filter=e.value}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}po.elementDefinitions={"ft-button":Bi,"ft-filter-level":Yi,"ft-snap-scroll":eo,"ft-typography":Te},po.styles=[je,v`
1195
+ `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const e=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new co(e)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,e;this.filter=null!==(e=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==e?e:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}po.elementDefinitions={"ft-button":Bi,"ft-filter-level":Yi,"ft-snap-scroll":eo,"ft-typography":Te},po.styles=[je,v`
1195
1196
  :host {
1196
1197
  display: flex;
1197
1198
  max-height: 100%;
@@ -1296,6 +1297,6 @@ class yi extends He{constructor(t){if(super(t),this.it=V,t.type!==Pe)throw Error
1296
1297
  slot {
1297
1298
  display: none;
1298
1299
  }
1299
- `],io([i({type:String})],po.prototype,"id",void 0),io([i({type:String})],po.prototype,"label",void 0),io([i({type:String})],po.prototype,"filterPlaceHolder",void 0),io([i({type:String})],po.prototype,"clearButtonLabel",void 0),io([i({type:String})],po.prototype,"moreValuesButtonLabel",void 0),io([function(t,e){const o=()=>JSON.parse(JSON.stringify(t));return i({type:Object,converter:{fromAttribute:t=>{if(null==t)return o();try{return JSON.parse(t)}catch{return o()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],po.prototype,"options",void 0),io([i({type:Boolean})],po.prototype,"multivalued",void 0),io([i({type:Boolean})],po.prototype,"disabled",void 0),io([i({type:Boolean})],po.prototype,"raiseSelectedOptions",void 0),io([i({type:Number})],po.prototype,"displayedValuesLimit",void 0),io([n(".ft-filter--slot")],po.prototype,"slotElement",void 0),io([n(".ft-filter--container")],po.prototype,"container",void 0),io([n(".ft-filter--values")],po.prototype,"valuesContainer",void 0),io([n(".ft-filter--levels")],po.prototype,"levelsContainer",void 0),io([n(".ft-filter--levels ft-filter-level:last-child")],po.prototype,"lastLevel",void 0),io([function(t){return s({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".ft-filter--levels ft-filter-level")],po.prototype,"levels",void 0),io([o()],po.prototype,"withScroll",void 0),io([o()],po.prototype,"filter",void 0),io([o()],po.prototype,"slideIn",void 0),io([o()],po.prototype,"slideOut",void 0);var fo=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class uo extends vt{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return W`
1300
+ `],io([i({type:String})],po.prototype,"id",void 0),io([i({type:String})],po.prototype,"label",void 0),io([i({type:String})],po.prototype,"filterPlaceHolder",void 0),io([i({type:String})],po.prototype,"clearButtonLabel",void 0),io([i({type:String})],po.prototype,"moreValuesButtonLabel",void 0),io([function(t,e){const o=()=>JSON.parse(JSON.stringify(t));return i({type:Object,converter:{fromAttribute:t=>{if(null==t)return o();try{return JSON.parse(t)}catch{return o()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],po.prototype,"options",void 0),io([i({type:Boolean})],po.prototype,"multivalued",void 0),io([i({type:Boolean})],po.prototype,"disabled",void 0),io([i({type:Boolean})],po.prototype,"raiseSelectedOptions",void 0),io([i({type:Number})],po.prototype,"displayedValuesLimit",void 0),io([n(".ft-filter--slot")],po.prototype,"slotElement",void 0),io([n(".ft-filter--container")],po.prototype,"container",void 0),io([n(".ft-filter--values")],po.prototype,"valuesContainer",void 0),io([n(".ft-filter--levels")],po.prototype,"levelsContainer",void 0),io([n(".ft-filter--levels ft-filter-level:last-child")],po.prototype,"lastLevel",void 0),io([n(".ft-filter--filter input")],po.prototype,"filterInput",void 0),io([function(t){return s({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".ft-filter--levels ft-filter-level")],po.prototype,"levels",void 0),io([o()],po.prototype,"withScroll",void 0),io([o()],po.prototype,"filter",void 0),io([o()],po.prototype,"slideIn",void 0),io([o()],po.prototype,"slideOut",void 0);var fo=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class uo extends vt{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return W`
1300
1301
  <slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
1301
1302
  `}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}uo.elementDefinitions={},fo([i({type:String})],uo.prototype,"label",void 0),fo([i({type:Object,converter:t=>t})],uo.prototype,"value",void 0),fo([i({type:Boolean,reflect:!0})],uo.prototype,"selected",void 0),fo([i({type:Object})],uo.prototype,"subOptions",void 0),fo([n(".ft-filter-option--slot")],uo.prototype,"slotElement",void 0),h("ft-filter")(xt(po)),h("ft-filter-option")(xt(uo))}();
@@ -73,6 +73,7 @@ export class FtFilter extends FtLitElement {
73
73
  class="ft-typography--caption"
74
74
  ?disabled=${!showFilter}
75
75
  placeholder="${this.filterPlaceHolder.replace("{0}", this.label)}"
76
+ @search=${this.onFilterChange}
76
77
  @keyup=${this.onFilterChange}>
77
78
  </div>
78
79
  <div class="ft-filter--values">
@@ -230,9 +231,9 @@ export class FtFilter extends FtLitElement {
230
231
  this.options = this.slotElement.assignedElements().map(n => n);
231
232
  this.optionsChanged();
232
233
  }
233
- onFilterChange(e) {
234
- const input = e.composedPath()[0];
235
- this.filter = input.value;
234
+ onFilterChange() {
235
+ var _a, _b;
236
+ this.filter = (_b = (_a = this.filterInput) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
236
237
  }
237
238
  updateScroll() {
238
239
  if (this.valuesContainer) {
@@ -401,6 +402,9 @@ __decorate([
401
402
  __decorate([
402
403
  query(".ft-filter--levels ft-filter-level:last-child")
403
404
  ], FtFilter.prototype, "lastLevel", void 0);
405
+ __decorate([
406
+ query(".ft-filter--filter input")
407
+ ], FtFilter.prototype, "filterInput", void 0);
404
408
  __decorate([
405
409
  queryAll(".ft-filter--levels ft-filter-level")
406
410
  ], FtFilter.prototype, "levels", void 0);
@@ -1033,6 +1033,7 @@ const H=Symbol.for(""),U=t=>{var i,e;if((null===(i=t)||void 0===i?void 0:i.r)===
1033
1033
  class="ft-typography--caption"
1034
1034
  ?disabled=${!s}
1035
1035
  placeholder="${this.filterPlaceHolder.replace("{0}",this.label)}"
1036
+ @search=${this.onFilterChange}
1036
1037
  @keyup=${this.onFilterChange}>
1037
1038
  </div>
1038
1039
  <div class="ft-filter--values">
@@ -1078,7 +1079,7 @@ const H=Symbol.for(""),U=t=>{var i,e;if((null===(i=t)||void 0===i?void 0:i.r)===
1078
1079
  @display-level=${this.onDisplayLevel}
1079
1080
  part="values"
1080
1081
  ></ft-filter-level>
1081
- `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var i;t.stopPropagation();const e=this.flatOptions.find((i=>i.value===t.detail.value));e.selected=!e.selected;const o=t=>{var i;t!==e&&(t.selected=!1),null===(i=t.subOptions)||void 0===i||i.forEach(o)};this.multivalued?null===(i=e.subOptions)||void 0===i||i.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const i=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new ae(i)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(t){const i=t.composedPath()[0];this.filter=i.value}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}he.elementDefinitions={"ft-button":Ni,"ft-filter-level":ie,"ft-snap-scroll":ne,"ft-typography":oi},he.styles=[Qt,e.css`
1082
+ `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var i;t.stopPropagation();const e=this.flatOptions.find((i=>i.value===t.detail.value));e.selected=!e.selected;const o=t=>{var i;t!==e&&(t.selected=!1),null===(i=t.subOptions)||void 0===i||i.forEach(o)};this.multivalued?null===(i=e.subOptions)||void 0===i||i.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const i=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new ae(i)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,i;this.filter=null!==(i=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==i?i:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}he.elementDefinitions={"ft-button":Ni,"ft-filter-level":ie,"ft-snap-scroll":ne,"ft-typography":oi},he.styles=[Qt,e.css`
1082
1083
  :host {
1083
1084
  display: flex;
1084
1085
  max-height: 100%;
@@ -1183,6 +1184,6 @@ const H=Symbol.for(""),U=t=>{var i,e;if((null===(i=t)||void 0===i?void 0:i.r)===
1183
1184
  slot {
1184
1185
  display: none;
1185
1186
  }
1186
- `],re([o.property({type:String})],he.prototype,"id",void 0),re([o.property({type:String})],he.prototype,"label",void 0),re([o.property({type:String})],he.prototype,"filterPlaceHolder",void 0),re([o.property({type:String})],he.prototype,"clearButtonLabel",void 0),re([o.property({type:String})],he.prototype,"moreValuesButtonLabel",void 0),re([i.jsonProperty([])],he.prototype,"options",void 0),re([o.property({type:Boolean})],he.prototype,"multivalued",void 0),re([o.property({type:Boolean})],he.prototype,"disabled",void 0),re([o.property({type:Boolean})],he.prototype,"raiseSelectedOptions",void 0),re([o.property({type:Number})],he.prototype,"displayedValuesLimit",void 0),re([o.query(".ft-filter--slot")],he.prototype,"slotElement",void 0),re([o.query(".ft-filter--container")],he.prototype,"container",void 0),re([o.query(".ft-filter--values")],he.prototype,"valuesContainer",void 0),re([o.query(".ft-filter--levels")],he.prototype,"levelsContainer",void 0),re([o.query(".ft-filter--levels ft-filter-level:last-child")],he.prototype,"lastLevel",void 0),re([o.queryAll(".ft-filter--levels ft-filter-level")],he.prototype,"levels",void 0),re([o.state()],he.prototype,"withScroll",void 0),re([o.state()],he.prototype,"filter",void 0),re([o.state()],he.prototype,"slideIn",void 0),re([o.state()],he.prototype,"slideOut",void 0);var pe=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class fe extends i.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return e.html`
1187
+ `],re([o.property({type:String})],he.prototype,"id",void 0),re([o.property({type:String})],he.prototype,"label",void 0),re([o.property({type:String})],he.prototype,"filterPlaceHolder",void 0),re([o.property({type:String})],he.prototype,"clearButtonLabel",void 0),re([o.property({type:String})],he.prototype,"moreValuesButtonLabel",void 0),re([i.jsonProperty([])],he.prototype,"options",void 0),re([o.property({type:Boolean})],he.prototype,"multivalued",void 0),re([o.property({type:Boolean})],he.prototype,"disabled",void 0),re([o.property({type:Boolean})],he.prototype,"raiseSelectedOptions",void 0),re([o.property({type:Number})],he.prototype,"displayedValuesLimit",void 0),re([o.query(".ft-filter--slot")],he.prototype,"slotElement",void 0),re([o.query(".ft-filter--container")],he.prototype,"container",void 0),re([o.query(".ft-filter--values")],he.prototype,"valuesContainer",void 0),re([o.query(".ft-filter--levels")],he.prototype,"levelsContainer",void 0),re([o.query(".ft-filter--levels ft-filter-level:last-child")],he.prototype,"lastLevel",void 0),re([o.query(".ft-filter--filter input")],he.prototype,"filterInput",void 0),re([o.queryAll(".ft-filter--levels ft-filter-level")],he.prototype,"levels",void 0),re([o.state()],he.prototype,"withScroll",void 0),re([o.state()],he.prototype,"filter",void 0),re([o.state()],he.prototype,"slideIn",void 0),re([o.state()],he.prototype,"slideOut",void 0);var pe=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class fe extends i.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return e.html`
1187
1188
  <slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
1188
1189
  `}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}fe.elementDefinitions={},pe([o.property({type:String})],fe.prototype,"label",void 0),pe([o.property({type:Object,converter:t=>t})],fe.prototype,"value",void 0),pe([o.property({type:Boolean,reflect:!0})],fe.prototype,"selected",void 0),pe([o.property({type:Object})],fe.prototype,"subOptions",void 0),pe([o.query(".ft-filter-option--slot")],fe.prototype,"slotElement",void 0),i.customElement("ft-filter")(he),i.customElement("ft-filter-option")(fe),t.FtFilter=he,t.FtFilterChangeEvent=ae,t.FtFilterCssVariables=le,t.FtFilterOption=fe,Object.defineProperty(t,"t",{value:!0})}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
@@ -1141,6 +1141,7 @@ class yi extends He{constructor(t){if(super(t),this.it=Z,t.type!==Pe)throw Error
1141
1141
  class="ft-typography--caption"
1142
1142
  ?disabled=${!o}
1143
1143
  placeholder="${this.filterPlaceHolder.replace("{0}",this.label)}"
1144
+ @search=${this.onFilterChange}
1144
1145
  @keyup=${this.onFilterChange}>
1145
1146
  </div>
1146
1147
  <div class="ft-filter--values">
@@ -1186,7 +1187,7 @@ class yi extends He{constructor(t){if(super(t),this.it=Z,t.type!==Pe)throw Error
1186
1187
  @display-level=${this.onDisplayLevel}
1187
1188
  part="values"
1188
1189
  ></ft-filter-level>
1189
- `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const e=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new so(e)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(t){const e=t.composedPath()[0];this.filter=e.value}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}no.elementDefinitions={"ft-button":Fi,"ft-filter-level":Yi,"ft-snap-scroll":eo,"ft-typography":Te},no.styles=[je,b`
1190
+ `}goBack(t){this.slideOut=t.detail.value}onDisplayLevel(t){this.displayedLevels.push(t.detail.value),this.slideIn=t.detail.value}clear(){if(this.flatOptions.forEach((t=>t.selected=!1)),this.displayedLevels.length>0){let t=this.displayedLevels[this.displayedLevels.length-1];this.displayedLevels=[t],this.slideOut=t}this.optionsChanged()}onChange(t){var e;t.stopPropagation();const i=this.flatOptions.find((e=>e.value===t.detail.value));i.selected=!i.selected;const o=t=>{var e;t!==i&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(o)};this.multivalued?null===(e=i.subOptions)||void 0===e||e.forEach(o):this.options.forEach(o),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;const e=this.flatOptions.filter((t=>t.selected)).map((t=>t.value));this.dispatchEvent(new so(e)),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,e;this.filter=null!==(e=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==e?e:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}no.elementDefinitions={"ft-button":Fi,"ft-filter-level":Yi,"ft-snap-scroll":eo,"ft-typography":Te},no.styles=[je,b`
1190
1191
  :host {
1191
1192
  display: flex;
1192
1193
  max-height: 100%;
@@ -1291,6 +1292,6 @@ class yi extends He{constructor(t){if(super(t),this.it=Z,t.type!==Pe)throw Error
1291
1292
  slot {
1292
1293
  display: none;
1293
1294
  }
1294
- `],io([o({type:String})],no.prototype,"id",void 0),io([o({type:String})],no.prototype,"label",void 0),io([o({type:String})],no.prototype,"filterPlaceHolder",void 0),io([o({type:String})],no.prototype,"clearButtonLabel",void 0),io([o({type:String})],no.prototype,"moreValuesButtonLabel",void 0),io([function(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],no.prototype,"options",void 0),io([o({type:Boolean})],no.prototype,"multivalued",void 0),io([o({type:Boolean})],no.prototype,"disabled",void 0),io([o({type:Boolean})],no.prototype,"raiseSelectedOptions",void 0),io([o({type:Number})],no.prototype,"displayedValuesLimit",void 0),io([r(".ft-filter--slot")],no.prototype,"slotElement",void 0),io([r(".ft-filter--container")],no.prototype,"container",void 0),io([r(".ft-filter--values")],no.prototype,"valuesContainer",void 0),io([r(".ft-filter--levels")],no.prototype,"levelsContainer",void 0),io([r(".ft-filter--levels ft-filter-level:last-child")],no.prototype,"lastLevel",void 0),io([function(t){return n({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".ft-filter--levels ft-filter-level")],no.prototype,"levels",void 0),io([s()],no.prototype,"withScroll",void 0),io([s()],no.prototype,"filter",void 0),io([s()],no.prototype,"slideIn",void 0),io([s()],no.prototype,"slideOut",void 0);var ro=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class lo extends bt{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return K`
1295
+ `],io([o({type:String})],no.prototype,"id",void 0),io([o({type:String})],no.prototype,"label",void 0),io([o({type:String})],no.prototype,"filterPlaceHolder",void 0),io([o({type:String})],no.prototype,"clearButtonLabel",void 0),io([o({type:String})],no.prototype,"moreValuesButtonLabel",void 0),io([function(t,e){const i=()=>JSON.parse(JSON.stringify(t));return o({type:Object,converter:{fromAttribute:t=>{if(null==t)return i();try{return JSON.parse(t)}catch{return i()}},toAttribute:t=>JSON.stringify(t)},...null!=e?e:{}})}([])],no.prototype,"options",void 0),io([o({type:Boolean})],no.prototype,"multivalued",void 0),io([o({type:Boolean})],no.prototype,"disabled",void 0),io([o({type:Boolean})],no.prototype,"raiseSelectedOptions",void 0),io([o({type:Number})],no.prototype,"displayedValuesLimit",void 0),io([r(".ft-filter--slot")],no.prototype,"slotElement",void 0),io([r(".ft-filter--container")],no.prototype,"container",void 0),io([r(".ft-filter--values")],no.prototype,"valuesContainer",void 0),io([r(".ft-filter--levels")],no.prototype,"levelsContainer",void 0),io([r(".ft-filter--levels ft-filter-level:last-child")],no.prototype,"lastLevel",void 0),io([r(".ft-filter--filter input")],no.prototype,"filterInput",void 0),io([function(t){return n({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".ft-filter--levels ft-filter-level")],no.prototype,"levels",void 0),io([s()],no.prototype,"withScroll",void 0),io([s()],no.prototype,"filter",void 0),io([s()],no.prototype,"slideIn",void 0),io([s()],no.prototype,"slideOut",void 0);var ro=function(t,e,i,o){for(var s,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(e,i,r):s(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r};class lo extends bt{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return K`
1295
1296
  <slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
1296
1297
  `}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}updated(t){super.updated(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}lo.elementDefinitions={},ro([o({type:String})],lo.prototype,"label",void 0),ro([o({type:Object,converter:t=>t})],lo.prototype,"value",void 0),ro([o({type:Boolean,reflect:!0})],lo.prototype,"selected",void 0),ro([o({type:Object})],lo.prototype,"subOptions",void 0),ro([r(".ft-filter-option--slot")],lo.prototype,"slotElement",void 0),c("ft-filter")(no),c("ft-filter-option")(lo),t.FtFilter=no,t.FtFilterChangeEvent=so,t.FtFilterCssVariables=oo,t.FtFilterOption=lo,Object.defineProperty(t,"t",{value:!0})}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-filter",
3
- "version": "0.2.8",
3
+ "version": "0.2.11",
4
4
  "description": "Flat selector for multivalued or monovalued filters",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,15 +19,15 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-button": "^0.2.8",
23
- "@fluid-topics/ft-checkbox": "^0.2.8",
24
- "@fluid-topics/ft-icon": "^0.2.8",
25
- "@fluid-topics/ft-radio": "^0.2.8",
26
- "@fluid-topics/ft-ripple": "^0.2.8",
27
- "@fluid-topics/ft-snap-scroll": "^0.2.8",
28
- "@fluid-topics/ft-typography": "^0.2.8",
29
- "@fluid-topics/ft-wc-utils": "^0.2.8",
22
+ "@fluid-topics/ft-button": "^0.2.11",
23
+ "@fluid-topics/ft-checkbox": "^0.2.11",
24
+ "@fluid-topics/ft-icon": "^0.2.11",
25
+ "@fluid-topics/ft-radio": "^0.2.11",
26
+ "@fluid-topics/ft-ripple": "^0.2.11",
27
+ "@fluid-topics/ft-snap-scroll": "^0.2.11",
28
+ "@fluid-topics/ft-typography": "^0.2.11",
29
+ "@fluid-topics/ft-wc-utils": "^0.2.11",
30
30
  "lit": "2.1.3"
31
31
  },
32
- "gitHead": "5e7358f54e9b775a44aaf77fe30fe506d90feea2"
32
+ "gitHead": "ea42e7abc5e502bb3d9616eb7477bc4eb67a62bf"
33
33
  }