@fluid-topics/ft-filter 1.1.61 → 1.1.63
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.
- package/build/ft-filter-level.d.ts +1 -0
- package/build/ft-filter-level.js +43 -38
- package/build/ft-filter-option.properties.d.ts +1 -0
- package/build/ft-filter.d.ts +1 -0
- package/build/ft-filter.js +6 -0
- package/build/ft-filter.light.js +45 -42
- package/build/ft-filter.min.js +45 -42
- package/package.json +10 -10
package/build/ft-filter-level.js
CHANGED
|
@@ -23,6 +23,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
23
23
|
this.multivalued = false;
|
|
24
24
|
this.disabled = false;
|
|
25
25
|
this.hideSelectedOptions = false;
|
|
26
|
+
this.displayCount = false;
|
|
26
27
|
this.preventNavigation = false;
|
|
27
28
|
this.filter = "";
|
|
28
29
|
this.moreValuesButtonLabel = "More";
|
|
@@ -52,52 +53,52 @@ class FtFilterLevel extends FtLitElement {
|
|
|
52
53
|
return html `
|
|
53
54
|
<div class="ft-filter-level--container ${this.disabled ? "ft-filter--disabled" : ""}">
|
|
54
55
|
${this.parent == null ? null : html `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
<div tabindex="0"
|
|
57
|
+
part="controls go-back"
|
|
58
|
+
class="ft-filter-level--go-back"
|
|
59
|
+
?disabled=${this.disabled}
|
|
60
|
+
@keyup=${this.goBackOnKeyPress}
|
|
61
|
+
@click=${this.goBackOnClick}>
|
|
62
|
+
<ft-ripple></ft-ripple>
|
|
63
|
+
<ft-icon>thin_arrow_left</ft-icon>
|
|
64
|
+
<ft-typography variant="body2">${this.parent.label}</ft-typography>
|
|
65
|
+
</div>
|
|
66
|
+
`}
|
|
66
67
|
${this.options.length === 0 && this.noValuesLabel ? html `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
<ft-typography class="ft-filter-level--no-values" element="span" variant="body2">
|
|
69
|
+
${this.noValuesLabel}
|
|
70
|
+
</ft-typography>
|
|
71
|
+
` : nothing}
|
|
71
72
|
${repeat(limitedOptions, option => option.value, option => {
|
|
72
73
|
var _a;
|
|
73
74
|
return html `
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
<div class="ft-filter-level--option" part="options">
|
|
76
|
+
${this.multivalued
|
|
76
77
|
? this.buildMultiValuedOption(option)
|
|
77
78
|
: this.buildMonoValuedOption(option)}
|
|
78
|
-
|
|
79
|
+
${this.preventNavigation || option.selected || ((_a = option.subOptions) !== null && _a !== void 0 ? _a : []).length === 0
|
|
79
80
|
? nothing
|
|
80
81
|
: html `
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
82
|
+
<ft-button icon="thin_arrow_right"
|
|
83
|
+
part="controls navigate-hierarchy"
|
|
84
|
+
label="${option.label}"
|
|
85
|
+
?disabled=${this.disabled}
|
|
86
|
+
tooltipPosition="left"
|
|
87
|
+
@click=${() => this.displayLevel(option)}></ft-button>
|
|
88
|
+
`}
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
90
91
|
})}
|
|
91
92
|
${limitedOptions.length < options.length ? html `
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
<ft-button
|
|
94
|
+
class="ft-filter-level--display-more"
|
|
95
|
+
icon="thin_arrow"
|
|
96
|
+
dense trailingIcon
|
|
97
|
+
part="controls display-more"
|
|
98
|
+
@click=${this.displayMore}>
|
|
99
|
+
${this.moreValuesButtonLabel}
|
|
100
|
+
</ft-button>
|
|
101
|
+
` : nothing}
|
|
101
102
|
</div>
|
|
102
103
|
`;
|
|
103
104
|
}
|
|
@@ -120,11 +121,12 @@ class FtFilterLevel extends FtLitElement {
|
|
|
120
121
|
<ft-checkbox name="${this.filterId}"
|
|
121
122
|
part="multivalued-option"
|
|
122
123
|
data-value="${option.value}"
|
|
124
|
+
|
|
123
125
|
.checked=${option.selected}
|
|
124
126
|
.disabled=${this.disabled}
|
|
125
127
|
.indeterminate=${flatDeep((_a = option.subOptions) !== null && _a !== void 0 ? _a : [], o => { var _a; return (_a = o.subOptions) !== null && _a !== void 0 ? _a : []; }).some(o => o.selected)}
|
|
126
128
|
@change=${(e) => this.optionsChanged(e, option)}>
|
|
127
|
-
${option.renderOption ? option.renderOption : option.label}
|
|
129
|
+
${option.renderOption ? option.renderOption : option.label}${this.displayCount ? ` (${option.count})` : ""}
|
|
128
130
|
</ft-checkbox>
|
|
129
131
|
`;
|
|
130
132
|
}
|
|
@@ -138,7 +140,7 @@ class FtFilterLevel extends FtLitElement {
|
|
|
138
140
|
@click=${(e) => this.optionsChanged(e, option)}
|
|
139
141
|
@keyup=${(e) => this.onRadioKeyUp(e, option)}
|
|
140
142
|
@change=${(e) => e.stopPropagation()}>
|
|
141
|
-
${option.renderOption ? option.renderOption : option.label}
|
|
143
|
+
${option.renderOption ? option.renderOption : option.label}${this.displayCount ? ` (${option.count})` : ""}
|
|
142
144
|
</ft-radio>
|
|
143
145
|
`;
|
|
144
146
|
}
|
|
@@ -183,6 +185,9 @@ __decorate([
|
|
|
183
185
|
__decorate([
|
|
184
186
|
property({ type: Boolean })
|
|
185
187
|
], FtFilterLevel.prototype, "hideSelectedOptions", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
property({ type: Boolean })
|
|
190
|
+
], FtFilterLevel.prototype, "displayCount", void 0);
|
|
186
191
|
__decorate([
|
|
187
192
|
property({ type: Boolean })
|
|
188
193
|
], FtFilterLevel.prototype, "preventNavigation", void 0);
|
package/build/ft-filter.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class FtFilter extends FtLitElement implements FtFilterProperties
|
|
|
18
18
|
multivalued: boolean;
|
|
19
19
|
disabled: boolean;
|
|
20
20
|
raiseSelectedOptions: boolean;
|
|
21
|
+
displayCount: boolean;
|
|
21
22
|
displayedValuesLimit: number;
|
|
22
23
|
hideClearButton: boolean;
|
|
23
24
|
private slotElement;
|
package/build/ft-filter.js
CHANGED
|
@@ -30,6 +30,7 @@ class FtFilter extends FtLitElement {
|
|
|
30
30
|
this.multivalued = false;
|
|
31
31
|
this.disabled = false;
|
|
32
32
|
this.raiseSelectedOptions = false;
|
|
33
|
+
this.displayCount = false;
|
|
33
34
|
this.displayedValuesLimit = 0;
|
|
34
35
|
this.hideClearButton = false;
|
|
35
36
|
this.lastLevelHasHiddenvalues = false;
|
|
@@ -142,6 +143,7 @@ class FtFilter extends FtLitElement {
|
|
|
142
143
|
filterId="${this.id}"
|
|
143
144
|
?multivalued=${this.multivalued}
|
|
144
145
|
?disabled=${this.disabled}
|
|
146
|
+
?displayCount="${this.displayCount}"
|
|
145
147
|
preventNavigation
|
|
146
148
|
.options=${selectedOptions}
|
|
147
149
|
@change=${this.onChange}
|
|
@@ -183,6 +185,7 @@ class FtFilter extends FtLitElement {
|
|
|
183
185
|
?multivalued=${this.multivalued}
|
|
184
186
|
?disabled=${this.disabled || className !== "ft-filter--level-center"}
|
|
185
187
|
?hideSelectedOptions=${this.raiseSelectedOptions}
|
|
188
|
+
?displayCount="${this.displayCount}"
|
|
186
189
|
.parent=${parent}
|
|
187
190
|
.options=${options}
|
|
188
191
|
.displayedValuesLimit=${this.displayedValuesLimit}
|
|
@@ -299,6 +302,9 @@ __decorate([
|
|
|
299
302
|
__decorate([
|
|
300
303
|
property({ type: Boolean })
|
|
301
304
|
], FtFilter.prototype, "raiseSelectedOptions", void 0);
|
|
305
|
+
__decorate([
|
|
306
|
+
property({ type: Boolean })
|
|
307
|
+
], FtFilter.prototype, "displayCount", void 0);
|
|
302
308
|
__decorate([
|
|
303
309
|
property({ type: Number })
|
|
304
310
|
], FtFilter.prototype, "displayedValuesLimit", void 0);
|
package/build/ft-filter.light.js
CHANGED
|
@@ -1082,58 +1082,59 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1082
1082
|
margin: 10px 0;
|
|
1083
1083
|
color: ${Ir.colorOnSurfaceMedium};
|
|
1084
1084
|
}
|
|
1085
|
-
`;var Wr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Rr extends o.FtLitElement{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,o;return null!==(o=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==o?o:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const o=t.slice(0,this.limit);return e.html`
|
|
1085
|
+
`;var Wr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Rr extends o.FtLitElement{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.displayCount=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,o;return null!==(o=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==o?o:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const o=t.slice(0,this.limit);return e.html`
|
|
1086
1086
|
<div class="ft-filter-level--container ${this.disabled?"ft-filter--disabled":""}">
|
|
1087
1087
|
${null==this.parent?null:e.html`
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1088
|
+
<div tabindex="0"
|
|
1089
|
+
part="controls go-back"
|
|
1090
|
+
class="ft-filter-level--go-back"
|
|
1091
|
+
?disabled=${this.disabled}
|
|
1092
|
+
@keyup=${this.goBackOnKeyPress}
|
|
1093
|
+
@click=${this.goBackOnClick}>
|
|
1094
|
+
<ft-ripple></ft-ripple>
|
|
1095
|
+
<ft-icon>thin_arrow_left</ft-icon>
|
|
1096
|
+
<ft-typography variant="body2">${this.parent.label}</ft-typography>
|
|
1097
|
+
</div>
|
|
1098
|
+
`}
|
|
1099
1099
|
${0===this.options.length&&this.noValuesLabel?e.html`
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1100
|
+
<ft-typography class="ft-filter-level--no-values" element="span" variant="body2">
|
|
1101
|
+
${this.noValuesLabel}
|
|
1102
|
+
</ft-typography>
|
|
1103
|
+
`:e.nothing}
|
|
1104
1104
|
${i.repeat(o,(t=>t.value),(t=>{var o;return e.html`
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1105
|
+
<div class="ft-filter-level--option" part="options">
|
|
1106
|
+
${this.multivalued?this.buildMultiValuedOption(t):this.buildMonoValuedOption(t)}
|
|
1107
|
+
${this.preventNavigation||t.selected||0===(null!==(o=t.subOptions)&&void 0!==o?o:[]).length?e.nothing:e.html`
|
|
1108
|
+
<ft-button icon="thin_arrow_right"
|
|
1109
|
+
part="controls navigate-hierarchy"
|
|
1110
|
+
label="${t.label}"
|
|
1111
|
+
?disabled=${this.disabled}
|
|
1112
|
+
tooltipPosition="left"
|
|
1113
|
+
@click=${()=>this.displayLevel(t)}></ft-button>
|
|
1114
|
+
`}
|
|
1115
|
+
</div>
|
|
1116
|
+
`}))}
|
|
1117
1117
|
${o.length<t.length?e.html`
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1118
|
+
<ft-button
|
|
1119
|
+
class="ft-filter-level--display-more"
|
|
1120
|
+
icon="thin_arrow"
|
|
1121
|
+
dense trailingIcon
|
|
1122
|
+
part="controls display-more"
|
|
1123
|
+
@click=${this.displayMore}>
|
|
1124
|
+
${this.moreValuesButtonLabel}
|
|
1125
|
+
</ft-button>
|
|
1126
|
+
`:e.nothing}
|
|
1127
1127
|
</div>
|
|
1128
1128
|
`}goBackOnKeyPress(t){"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}goBackOnClick(t){t.stopPropagation(),t.preventDefault(),this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}displayMore(){this.displayedPages++}buildMultiValuedOption(t){var r;return e.html`
|
|
1129
1129
|
<ft-checkbox name="${this.filterId}"
|
|
1130
1130
|
part="multivalued-option"
|
|
1131
1131
|
data-value="${t.value}"
|
|
1132
|
+
|
|
1132
1133
|
.checked=${t.selected}
|
|
1133
1134
|
.disabled=${this.disabled}
|
|
1134
1135
|
.indeterminate=${o.flatDeep(null!==(r=t.subOptions)&&void 0!==r?r:[],(t=>{var o;return null!==(o=t.subOptions)&&void 0!==o?o:[]})).some((t=>t.selected))}
|
|
1135
1136
|
@change=${o=>this.optionsChanged(o,t)}>
|
|
1136
|
-
${t.renderOption?t.renderOption:t.label}
|
|
1137
|
+
${t.renderOption?t.renderOption:t.label}${this.displayCount?` (${t.count})`:""}
|
|
1137
1138
|
</ft-checkbox>
|
|
1138
1139
|
`}buildMonoValuedOption(t){return e.html`
|
|
1139
1140
|
<ft-radio name="${this.filterId+Math.round(1e6*Math.random())}"
|
|
@@ -1144,9 +1145,9 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1144
1145
|
@click=${o=>this.optionsChanged(o,t)}
|
|
1145
1146
|
@keyup=${o=>this.onRadioKeyUp(o,t)}
|
|
1146
1147
|
@change=${t=>t.stopPropagation()}>
|
|
1147
|
-
${t.renderOption?t.renderOption:t.label}
|
|
1148
|
+
${t.renderOption?t.renderOption:t.label}${this.displayCount?` (${t.count})`:""}
|
|
1148
1149
|
</ft-radio>
|
|
1149
|
-
`}onRadioKeyUp(t,o){o.selected&&" "===t.key&&this.optionsChanged(t,o)}optionsChanged(t,o){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:o}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Rr.elementDefinitions={"ft-button":ir,"ft-ripple":Fo,"ft-typography":go,"ft-checkbox":br,"ft-icon":Qe,"ft-radio":wr},Rr.styles=Er,Wr([r.property({type:String})],Rr.prototype,"filterId",void 0),Wr([r.property({type:Object})],Rr.prototype,"parent",void 0),Wr([r.property({type:Array})],Rr.prototype,"options",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"multivalued",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"disabled",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"hideSelectedOptions",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"preventNavigation",void 0),Wr([r.property({type:String})],Rr.prototype,"filter",void 0),Wr([r.property({type:String})],Rr.prototype,"moreValuesButtonLabel",void 0),Wr([r.property({type:String})],Rr.prototype,"noValuesLabel",void 0),Wr([r.property({type:Number})],Rr.prototype,"displayedValuesLimit",void 0),Wr([r.query(".ft-filter-level--container")],Rr.prototype,"container",void 0),Wr([r.state()],Rr.prototype,"displayedPages",void 0);const Ur={buttonsColor:o.FtCssVariableFactory.extend("--ft-snap-scroll-buttons-color","",o.designSystemVariables.colorPrimary),buttonsZIndex:o.FtCssVariableFactory.create("--ft-snap-scroll-buttons-z-index","","NUMBER","1"),gap:o.FtCssVariableFactory.create("--ft-snap-scroll-gap","","SIZE","0"),colorSurface:o.FtCssVariableFactory.external(o.designSystemVariables.colorSurface,"Design system")},zr=e.css`
|
|
1150
|
+
`}onRadioKeyUp(t,o){o.selected&&" "===t.key&&this.optionsChanged(t,o)}optionsChanged(t,o){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:o}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Rr.elementDefinitions={"ft-button":ir,"ft-ripple":Fo,"ft-typography":go,"ft-checkbox":br,"ft-icon":Qe,"ft-radio":wr},Rr.styles=Er,Wr([r.property({type:String})],Rr.prototype,"filterId",void 0),Wr([r.property({type:Object})],Rr.prototype,"parent",void 0),Wr([r.property({type:Array})],Rr.prototype,"options",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"multivalued",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"disabled",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"hideSelectedOptions",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"displayCount",void 0),Wr([r.property({type:Boolean})],Rr.prototype,"preventNavigation",void 0),Wr([r.property({type:String})],Rr.prototype,"filter",void 0),Wr([r.property({type:String})],Rr.prototype,"moreValuesButtonLabel",void 0),Wr([r.property({type:String})],Rr.prototype,"noValuesLabel",void 0),Wr([r.property({type:Number})],Rr.prototype,"displayedValuesLimit",void 0),Wr([r.query(".ft-filter-level--container")],Rr.prototype,"container",void 0),Wr([r.state()],Rr.prototype,"displayedPages",void 0);const Ur={buttonsColor:o.FtCssVariableFactory.extend("--ft-snap-scroll-buttons-color","",o.designSystemVariables.colorPrimary),buttonsZIndex:o.FtCssVariableFactory.create("--ft-snap-scroll-buttons-z-index","","NUMBER","1"),gap:o.FtCssVariableFactory.create("--ft-snap-scroll-gap","","SIZE","0"),colorSurface:o.FtCssVariableFactory.external(o.designSystemVariables.colorSurface,"Design system")},zr=e.css`
|
|
1150
1151
|
.ft-snap-scroll {
|
|
1151
1152
|
box-sizing: border-box;
|
|
1152
1153
|
position: relative;
|
|
@@ -1410,7 +1411,7 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1410
1411
|
slot:not([name]) {
|
|
1411
1412
|
display: none;
|
|
1412
1413
|
}
|
|
1413
|
-
`];var Br=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Hr extends CustomEvent{constructor(t){super("change",{detail:t})}}class Ar extends o.FtLitElement{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new o.Debouncer(300),this.changeDebouncer=new o.Debouncer(10),this.lastDispatchedValues=[]}get flatOptions(){return o.flatDeep(this.options,(t=>{var o;return null!==(o=t.subOptions)&&void 0!==o?o:[]}))}get childrenFilteredFlatOptions(){return o.flatDeep(this.options,(t=>{var o;return t.selected?[]:null!==(o=t.subOptions)&&void 0!==o?o:[]}))}get selectedValues(){return this.childrenFilteredFlatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),o=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,r=this.filterPlaceHolder.replace("{0}",this.label);return e.html`
|
|
1414
|
+
`];var Br=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Hr extends CustomEvent{constructor(t){super("change",{detail:t})}}class Ar extends o.FtLitElement{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayCount=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new o.Debouncer(300),this.changeDebouncer=new o.Debouncer(10),this.lastDispatchedValues=[]}get flatOptions(){return o.flatDeep(this.options,(t=>{var o;return null!==(o=t.subOptions)&&void 0!==o?o:[]}))}get childrenFilteredFlatOptions(){return o.flatDeep(this.options,(t=>{var o;return t.selected?[]:null!==(o=t.subOptions)&&void 0!==o?o:[]}))}get selectedValues(){return this.childrenFilteredFlatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),o=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,r=this.filterPlaceHolder.replace("{0}",this.label);return e.html`
|
|
1414
1415
|
<div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
|
|
1415
1416
|
part="container">
|
|
1416
1417
|
${this.label||t?e.html`
|
|
@@ -1452,6 +1453,7 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1452
1453
|
filterId="${this.id}"
|
|
1453
1454
|
?multivalued=${this.multivalued}
|
|
1454
1455
|
?disabled=${this.disabled}
|
|
1456
|
+
?displayCount="${this.displayCount}"
|
|
1455
1457
|
preventNavigation
|
|
1456
1458
|
.options=${o}
|
|
1457
1459
|
@change=${this.onChange}
|
|
@@ -1475,6 +1477,7 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1475
1477
|
?multivalued=${this.multivalued}
|
|
1476
1478
|
?disabled=${this.disabled||"ft-filter--level-center"!==t}
|
|
1477
1479
|
?hideSelectedOptions=${this.raiseSelectedOptions}
|
|
1480
|
+
?displayCount="${this.displayCount}"
|
|
1478
1481
|
.parent=${r}
|
|
1479
1482
|
.options=${o}
|
|
1480
1483
|
.displayedValuesLimit=${this.displayedValuesLimit}
|
|
@@ -1485,6 +1488,6 @@ const G=Symbol.for(""),T=t=>{if(t?.r===G)return t?._$litStatic$},M=t=>({_$litSta
|
|
|
1485
1488
|
.exportpartsPrefixes=${["values","available-values"]}
|
|
1486
1489
|
noValuesLabel="${this.noValuesLabel}"
|
|
1487
1490
|
></ft-filter-level>
|
|
1488
|
-
`}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 o;t.stopPropagation();const e=this.flatOptions.find((o=>o.value===t.detail.value));e.selected=!e.selected;const r=t=>{var o;t!==e&&(t.selected=!1),null===(o=t.subOptions)||void 0===o||o.forEach(r)};this.multivalued?null===(o=e.subOptions)||void 0===o||o.forEach(r):this.options.forEach(r),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;o.deepEqual(this.lastDispatchedValues,t)||(this.dispatchEvent(new Hr(t)),this.lastDispatchedValues=t)}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,o;this.filter=null!==(o=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==o?o:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}Ar.elementDefinitions={"ft-button":ir,"ft-filter-level":Rr,"ft-snap-scroll":Kr,"ft-typography":go},Ar.styles=Fr,Br([r.property({type:String})],Ar.prototype,"id",void 0),Br([r.property({type:String})],Ar.prototype,"label",void 0),Br([r.property({type:String})],Ar.prototype,"filterPlaceHolder",void 0),Br([r.property({type:String})],Ar.prototype,"clearButtonLabel",void 0),Br([r.property({type:String})],Ar.prototype,"moreValuesButtonLabel",void 0),Br([r.property({type:String})],Ar.prototype,"noValuesLabel",void 0),Br([o.jsonProperty([])],Ar.prototype,"options",void 0),Br([r.property({type:Boolean})],Ar.prototype,"multivalued",void 0),Br([r.property({type:Boolean})],Ar.prototype,"disabled",void 0),Br([r.property({type:Boolean})],Ar.prototype,"raiseSelectedOptions",void 0),Br([r.property({type:Number})],Ar.prototype,"displayedValuesLimit",void 0),Br([r.property({type:Boolean})],Ar.prototype,"hideClearButton",void 0),Br([r.query(".ft-filter--slot")],Ar.prototype,"slotElement",void 0),Br([r.query(".ft-filter--container")],Ar.prototype,"container",void 0),Br([r.query(".ft-filter--values")],Ar.prototype,"valuesContainer",void 0),Br([r.query(".ft-filter--levels")],Ar.prototype,"levelsContainer",void 0),Br([r.state()],Ar.prototype,"lastLevelHasHiddenvalues",void 0),Br([r.query(".ft-filter--filter input")],Ar.prototype,"filterInput",void 0),Br([r.queryAll(".ft-filter--levels ft-filter-level")],Ar.prototype,"levels",void 0),Br([r.state()],Ar.prototype,"withScroll",void 0),Br([r.state()],Ar.prototype,"filter",void 0),Br([r.state()],Ar.prototype,"slideIn",void 0),Br([r.state()],Ar.prototype,"slideOut",void 0);var jr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Gr extends o.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return e.html`
|
|
1491
|
+
`}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 o;t.stopPropagation();const e=this.flatOptions.find((o=>o.value===t.detail.value));e.selected=!e.selected;const r=t=>{var o;t!==e&&(t.selected=!1),null===(o=t.subOptions)||void 0===o||o.forEach(r)};this.multivalued?null===(o=e.subOptions)||void 0===o||o.forEach(r):this.options.forEach(r),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;o.deepEqual(this.lastDispatchedValues,t)||(this.dispatchEvent(new Hr(t)),this.lastDispatchedValues=t)}updateOptionsFromSlot(t){t.stopPropagation(),this.options=this.slotElement.assignedElements().map((t=>t)),this.optionsChanged()}onFilterChange(){var t,o;this.filter=null!==(o=null===(t=this.filterInput)||void 0===t?void 0:t.value)&&void 0!==o?o:""}updateScroll(){this.valuesContainer&&(this.withScroll=this.valuesContainer.scrollHeight>this.valuesContainer.clientHeight)}}Ar.elementDefinitions={"ft-button":ir,"ft-filter-level":Rr,"ft-snap-scroll":Kr,"ft-typography":go},Ar.styles=Fr,Br([r.property({type:String})],Ar.prototype,"id",void 0),Br([r.property({type:String})],Ar.prototype,"label",void 0),Br([r.property({type:String})],Ar.prototype,"filterPlaceHolder",void 0),Br([r.property({type:String})],Ar.prototype,"clearButtonLabel",void 0),Br([r.property({type:String})],Ar.prototype,"moreValuesButtonLabel",void 0),Br([r.property({type:String})],Ar.prototype,"noValuesLabel",void 0),Br([o.jsonProperty([])],Ar.prototype,"options",void 0),Br([r.property({type:Boolean})],Ar.prototype,"multivalued",void 0),Br([r.property({type:Boolean})],Ar.prototype,"disabled",void 0),Br([r.property({type:Boolean})],Ar.prototype,"raiseSelectedOptions",void 0),Br([r.property({type:Boolean})],Ar.prototype,"displayCount",void 0),Br([r.property({type:Number})],Ar.prototype,"displayedValuesLimit",void 0),Br([r.property({type:Boolean})],Ar.prototype,"hideClearButton",void 0),Br([r.query(".ft-filter--slot")],Ar.prototype,"slotElement",void 0),Br([r.query(".ft-filter--container")],Ar.prototype,"container",void 0),Br([r.query(".ft-filter--values")],Ar.prototype,"valuesContainer",void 0),Br([r.query(".ft-filter--levels")],Ar.prototype,"levelsContainer",void 0),Br([r.state()],Ar.prototype,"lastLevelHasHiddenvalues",void 0),Br([r.query(".ft-filter--filter input")],Ar.prototype,"filterInput",void 0),Br([r.queryAll(".ft-filter--levels ft-filter-level")],Ar.prototype,"levels",void 0),Br([r.state()],Ar.prototype,"withScroll",void 0),Br([r.state()],Ar.prototype,"filter",void 0),Br([r.state()],Ar.prototype,"slideIn",void 0),Br([r.state()],Ar.prototype,"slideOut",void 0);var jr=function(t,o,e,r){for(var i,a=arguments.length,n=a<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r,l=t.length-1;l>=0;l--)(i=t[l])&&(n=(a<3?i(n):a>3?i(o,e,n):i(o,e))||n);return a>3&&n&&Object.defineProperty(o,e,n),n};class Gr extends o.FtLitElement{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return e.html`
|
|
1489
1492
|
<slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
|
|
1490
1493
|
`}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}update(t){super.update(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}Gr.elementDefinitions={},jr([r.property({type:String})],Gr.prototype,"label",void 0),jr([r.property({type:Object,converter:t=>t})],Gr.prototype,"value",void 0),jr([r.property({type:Boolean,reflect:!0})],Gr.prototype,"selected",void 0),jr([r.property({type:Object})],Gr.prototype,"subOptions",void 0),jr([o.jsonProperty({})],Gr.prototype,"renderOption",void 0),jr([r.query(".ft-filter-option--slot")],Gr.prototype,"slotElement",void 0),o.customElement("ft-filter")(Ar),o.customElement("ft-filter-option")(Gr),t.FtFilter=Ar,t.FtFilterChangeEvent=Hr,t.FtFilterCssVariables=Dr,t.FtFilterLevelCssVariables=Ir,t.FtFilterOption=Gr,t.levelStyles=Er,t.styles=Fr}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators,ftGlobals.litRepeat,ftGlobals.litClassMap,ftGlobals.litUnsafeHTML);
|
package/build/ft-filter.min.js
CHANGED
|
@@ -1250,58 +1250,59 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1250
1250
|
margin: 10px 0;
|
|
1251
1251
|
color: ${Zc.colorOnSurfaceMedium};
|
|
1252
1252
|
}
|
|
1253
|
-
`;var Kc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Hc extends Di{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,e;return null!==(e=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==e?e:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const e=t.slice(0,this.limit);return Jt`
|
|
1253
|
+
`;var Kc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class Hc extends Di{constructor(){super(...arguments),this.filterId="",this.options=[],this.multivalued=!1,this.disabled=!1,this.hideSelectedOptions=!1,this.displayCount=!1,this.preventNavigation=!1,this.filter="",this.moreValuesButtonLabel="More",this.displayedValuesLimit=0,this.displayedPages=1}get hasHiddenValues(){let t=this.limit;return null!=t&&t<this.options.length}get limit(){return this.displayedValuesLimit>0?this.displayedPages*this.displayedValuesLimit:void 0}get height(){var t,e;return null!==(e=null===(t=this.container)||void 0===t?void 0:t.scrollHeight)&&void 0!==e?e:0}render(){let t=[...this.options];this.hideSelectedOptions&&(t=t.filter((t=>!t.selected))),this.filter&&(t=t.filter((t=>t.label.toLowerCase().includes(this.filter.toLowerCase()))));const e=t.slice(0,this.limit);return Jt`
|
|
1254
1254
|
<div class="ft-filter-level--container ${this.disabled?"ft-filter--disabled":""}">
|
|
1255
1255
|
${null==this.parent?null:Jt`
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1256
|
+
<div tabindex="0"
|
|
1257
|
+
part="controls go-back"
|
|
1258
|
+
class="ft-filter-level--go-back"
|
|
1259
|
+
?disabled=${this.disabled}
|
|
1260
|
+
@keyup=${this.goBackOnKeyPress}
|
|
1261
|
+
@click=${this.goBackOnClick}>
|
|
1262
|
+
<ft-ripple></ft-ripple>
|
|
1263
|
+
<ft-icon>thin_arrow_left</ft-icon>
|
|
1264
|
+
<ft-typography variant="body2">${this.parent.label}</ft-typography>
|
|
1265
|
+
</div>
|
|
1266
|
+
`}
|
|
1267
1267
|
${0===this.options.length&&this.noValuesLabel?Jt`
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1268
|
+
<ft-typography class="ft-filter-level--no-values" element="span" variant="body2">
|
|
1269
|
+
${this.noValuesLabel}
|
|
1270
|
+
</ft-typography>
|
|
1271
|
+
`:te}
|
|
1272
1272
|
${Me(e,(t=>t.value),(t=>{var e;return Jt`
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1273
|
+
<div class="ft-filter-level--option" part="options">
|
|
1274
|
+
${this.multivalued?this.buildMultiValuedOption(t):this.buildMonoValuedOption(t)}
|
|
1275
|
+
${this.preventNavigation||t.selected||0===(null!==(e=t.subOptions)&&void 0!==e?e:[]).length?te:Jt`
|
|
1276
|
+
<ft-button icon="thin_arrow_right"
|
|
1277
|
+
part="controls navigate-hierarchy"
|
|
1278
|
+
label="${t.label}"
|
|
1279
|
+
?disabled=${this.disabled}
|
|
1280
|
+
tooltipPosition="left"
|
|
1281
|
+
@click=${()=>this.displayLevel(t)}></ft-button>
|
|
1282
|
+
`}
|
|
1283
|
+
</div>
|
|
1284
|
+
`}))}
|
|
1285
1285
|
${e.length<t.length?Jt`
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1286
|
+
<ft-button
|
|
1287
|
+
class="ft-filter-level--display-more"
|
|
1288
|
+
icon="thin_arrow"
|
|
1289
|
+
dense trailingIcon
|
|
1290
|
+
part="controls display-more"
|
|
1291
|
+
@click=${this.displayMore}>
|
|
1292
|
+
${this.moreValuesButtonLabel}
|
|
1293
|
+
</ft-button>
|
|
1294
|
+
`:te}
|
|
1295
1295
|
</div>
|
|
1296
1296
|
`}goBackOnKeyPress(t){"Enter"!==t.key&&" "!==t.key||this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}goBackOnClick(t){t.stopPropagation(),t.preventDefault(),this.dispatchEvent(new CustomEvent("go-back",{detail:this.parent}))}displayMore(){this.displayedPages++}buildMultiValuedOption(t){var e;return Jt`
|
|
1297
1297
|
<ft-checkbox name="${this.filterId}"
|
|
1298
1298
|
part="multivalued-option"
|
|
1299
1299
|
data-value="${t.value}"
|
|
1300
|
+
|
|
1300
1301
|
.checked=${t.selected}
|
|
1301
1302
|
.disabled=${this.disabled}
|
|
1302
1303
|
.indeterminate=${po(null!==(e=t.subOptions)&&void 0!==e?e:[],(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]})).some((t=>t.selected))}
|
|
1303
1304
|
@change=${e=>this.optionsChanged(e,t)}>
|
|
1304
|
-
${t.renderOption?t.renderOption:t.label}
|
|
1305
|
+
${t.renderOption?t.renderOption:t.label}${this.displayCount?` (${t.count})`:""}
|
|
1305
1306
|
</ft-checkbox>
|
|
1306
1307
|
`}buildMonoValuedOption(t){return Jt`
|
|
1307
1308
|
<ft-radio name="${this.filterId+Math.round(1e6*Math.random())}"
|
|
@@ -1312,9 +1313,9 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1312
1313
|
@click=${e=>this.optionsChanged(e,t)}
|
|
1313
1314
|
@keyup=${e=>this.onRadioKeyUp(e,t)}
|
|
1314
1315
|
@change=${t=>t.stopPropagation()}>
|
|
1315
|
-
${t.renderOption?t.renderOption:t.label}
|
|
1316
|
+
${t.renderOption?t.renderOption:t.label}${this.displayCount?` (${t.count})`:""}
|
|
1316
1317
|
</ft-radio>
|
|
1317
|
-
`}onRadioKeyUp(t,e){e.selected&&" "===t.key&&this.optionsChanged(t,e)}optionsChanged(t,e){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:e}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Hc.elementDefinitions={"ft-button":mc,"ft-ripple":Qs,"ft-typography":Rs,"ft-checkbox":Ic,"ft-icon":hc,"ft-radio":Ac},Hc.styles=Mc,Kc([we({type:String})],Hc.prototype,"filterId",void 0),Kc([we({type:Object})],Hc.prototype,"parent",void 0),Kc([we({type:Array})],Hc.prototype,"options",void 0),Kc([we({type:Boolean})],Hc.prototype,"multivalued",void 0),Kc([we({type:Boolean})],Hc.prototype,"disabled",void 0),Kc([we({type:Boolean})],Hc.prototype,"hideSelectedOptions",void 0),Kc([we({type:Boolean})],Hc.prototype,"preventNavigation",void 0),Kc([we({type:String})],Hc.prototype,"filter",void 0),Kc([we({type:String})],Hc.prototype,"moreValuesButtonLabel",void 0),Kc([we({type:String})],Hc.prototype,"noValuesLabel",void 0),Kc([we({type:Number})],Hc.prototype,"displayedValuesLimit",void 0),Kc([$e(".ft-filter-level--container")],Hc.prototype,"container",void 0),Kc([Se()],Hc.prototype,"displayedPages",void 0);const Tc={buttonsColor:Oo.extend("--ft-snap-scroll-buttons-color","",Sr.colorPrimary),buttonsZIndex:Oo.create("--ft-snap-scroll-buttons-z-index","","NUMBER","1"),gap:Oo.create("--ft-snap-scroll-gap","","SIZE","0"),colorSurface:Oo.external(Sr.colorSurface,"Design system")},Gc=dt`
|
|
1318
|
+
`}onRadioKeyUp(t,e){e.selected&&" "===t.key&&this.optionsChanged(t,e)}optionsChanged(t,e){t.stopPropagation(),this.dispatchEvent(new CustomEvent("change",{detail:e}))}displayLevel(t){this.dispatchEvent(new CustomEvent("display-level",{detail:t}))}}Hc.elementDefinitions={"ft-button":mc,"ft-ripple":Qs,"ft-typography":Rs,"ft-checkbox":Ic,"ft-icon":hc,"ft-radio":Ac},Hc.styles=Mc,Kc([we({type:String})],Hc.prototype,"filterId",void 0),Kc([we({type:Object})],Hc.prototype,"parent",void 0),Kc([we({type:Array})],Hc.prototype,"options",void 0),Kc([we({type:Boolean})],Hc.prototype,"multivalued",void 0),Kc([we({type:Boolean})],Hc.prototype,"disabled",void 0),Kc([we({type:Boolean})],Hc.prototype,"hideSelectedOptions",void 0),Kc([we({type:Boolean})],Hc.prototype,"displayCount",void 0),Kc([we({type:Boolean})],Hc.prototype,"preventNavigation",void 0),Kc([we({type:String})],Hc.prototype,"filter",void 0),Kc([we({type:String})],Hc.prototype,"moreValuesButtonLabel",void 0),Kc([we({type:String})],Hc.prototype,"noValuesLabel",void 0),Kc([we({type:Number})],Hc.prototype,"displayedValuesLimit",void 0),Kc([$e(".ft-filter-level--container")],Hc.prototype,"container",void 0),Kc([Se()],Hc.prototype,"displayedPages",void 0);const Tc={buttonsColor:Oo.extend("--ft-snap-scroll-buttons-color","",Sr.colorPrimary),buttonsZIndex:Oo.create("--ft-snap-scroll-buttons-z-index","","NUMBER","1"),gap:Oo.create("--ft-snap-scroll-gap","","SIZE","0"),colorSurface:Oo.external(Sr.colorSurface,"Design system")},Gc=dt`
|
|
1318
1319
|
.ft-snap-scroll {
|
|
1319
1320
|
box-sizing: border-box;
|
|
1320
1321
|
position: relative;
|
|
@@ -1578,7 +1579,7 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1578
1579
|
slot:not([name]) {
|
|
1579
1580
|
display: none;
|
|
1580
1581
|
}
|
|
1581
|
-
`];var Qc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class tf extends CustomEvent{constructor(t){super("change",{detail:t})}}class ef extends Di{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new lo(300),this.changeDebouncer=new lo(10),this.lastDispatchedValues=[]}get flatOptions(){return po(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get childrenFilteredFlatOptions(){return po(this.options,(t=>{var e;return t.selected?[]:null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get selectedValues(){return this.childrenFilteredFlatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),e=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,o=this.filterPlaceHolder.replace("{0}",this.label);return Jt`
|
|
1582
|
+
`];var Qc=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class tf extends CustomEvent{constructor(t){super("change",{detail:t})}}class ef extends Di{constructor(){super(...arguments),this.id="",this.label="",this.filterPlaceHolder="Filter {0}",this.clearButtonLabel="Clear",this.moreValuesButtonLabel="More",this.noValuesLabel="No values available",this.options=[],this.multivalued=!1,this.disabled=!1,this.raiseSelectedOptions=!1,this.displayCount=!1,this.displayedValuesLimit=0,this.hideClearButton=!1,this.lastLevelHasHiddenvalues=!1,this.withScroll=!1,this.filter="",this.displayedLevels=[],this.scrollResizeObserver=new ResizeObserver((()=>this.updateScroll())),this.levelsScrollDebouncer=new lo(300),this.changeDebouncer=new lo(10),this.lastDispatchedValues=[]}get flatOptions(){return po(this.options,(t=>{var e;return null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get childrenFilteredFlatOptions(){return po(this.options,(t=>{var e;return t.selected?[]:null!==(e=t.subOptions)&&void 0!==e?e:[]}))}get selectedValues(){return this.childrenFilteredFlatOptions.filter((t=>t.selected)).map((t=>t.value))}render(){const t=this.flatOptions.some((t=>t.selected)),e=this.withScroll||this.filter||this.lastLevelHasHiddenvalues,o=this.filterPlaceHolder.replace("{0}",this.label);return Jt`
|
|
1582
1583
|
<div class="ft-filter--container ${this.disabled?"ft-filter--disabled":""}"
|
|
1583
1584
|
part="container">
|
|
1584
1585
|
${this.label||t?Jt`
|
|
@@ -1620,6 +1621,7 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1620
1621
|
filterId="${this.id}"
|
|
1621
1622
|
?multivalued=${this.multivalued}
|
|
1622
1623
|
?disabled=${this.disabled}
|
|
1624
|
+
?displayCount="${this.displayCount}"
|
|
1623
1625
|
preventNavigation
|
|
1624
1626
|
.options=${e}
|
|
1625
1627
|
@change=${this.onChange}
|
|
@@ -1643,6 +1645,7 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1643
1645
|
?multivalued=${this.multivalued}
|
|
1644
1646
|
?disabled=${this.disabled||"ft-filter--level-center"!==t}
|
|
1645
1647
|
?hideSelectedOptions=${this.raiseSelectedOptions}
|
|
1648
|
+
?displayCount="${this.displayCount}"
|
|
1646
1649
|
.parent=${o}
|
|
1647
1650
|
.options=${e}
|
|
1648
1651
|
.displayedValuesLimit=${this.displayedValuesLimit}
|
|
@@ -1653,6 +1656,6 @@ const pl=Symbol.for(""),dl=t=>{if(t?.r===pl)return t?._$litStatic$},hl=t=>({_$li
|
|
|
1653
1656
|
.exportpartsPrefixes=${["values","available-values"]}
|
|
1654
1657
|
noValuesLabel="${this.noValuesLabel}"
|
|
1655
1658
|
></ft-filter-level>
|
|
1656
|
-
`}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 o=this.flatOptions.find((e=>e.value===t.detail.value));o.selected=!o.selected;const r=t=>{var e;t!==o&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(r)};this.multivalued?null===(e=o.subOptions)||void 0===e||e.forEach(r):this.options.forEach(r),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;uo(this.lastDispatchedValues,t)||(this.dispatchEvent(new tf(t)),this.lastDispatchedValues=t)}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)}}ef.elementDefinitions={"ft-button":mc,"ft-filter-level":Hc,"ft-snap-scroll":Yc,"ft-typography":Rs},ef.styles=Xc,Qc([we({type:String})],ef.prototype,"id",void 0),Qc([we({type:String})],ef.prototype,"label",void 0),Qc([we({type:String})],ef.prototype,"filterPlaceHolder",void 0),Qc([we({type:String})],ef.prototype,"clearButtonLabel",void 0),Qc([we({type:String})],ef.prototype,"moreValuesButtonLabel",void 0),Qc([we({type:String})],ef.prototype,"noValuesLabel",void 0),Qc([bo([])],ef.prototype,"options",void 0),Qc([we({type:Boolean})],ef.prototype,"multivalued",void 0),Qc([we({type:Boolean})],ef.prototype,"disabled",void 0),Qc([we({type:Boolean})],ef.prototype,"raiseSelectedOptions",void 0),Qc([we({type:Number})],ef.prototype,"displayedValuesLimit",void 0),Qc([we({type:Boolean})],ef.prototype,"hideClearButton",void 0),Qc([$e(".ft-filter--slot")],ef.prototype,"slotElement",void 0),Qc([$e(".ft-filter--container")],ef.prototype,"container",void 0),Qc([$e(".ft-filter--values")],ef.prototype,"valuesContainer",void 0),Qc([$e(".ft-filter--levels")],ef.prototype,"levelsContainer",void 0),Qc([Se()],ef.prototype,"lastLevelHasHiddenvalues",void 0),Qc([$e(".ft-filter--filter input")],ef.prototype,"filterInput",void 0),Qc([ke(".ft-filter--levels ft-filter-level")],ef.prototype,"levels",void 0),Qc([Se()],ef.prototype,"withScroll",void 0),Qc([Se()],ef.prototype,"filter",void 0),Qc([Se()],ef.prototype,"slideIn",void 0),Qc([Se()],ef.prototype,"slideOut",void 0);var of=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class rf extends Di{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return Jt`
|
|
1659
|
+
`}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 o=this.flatOptions.find((e=>e.value===t.detail.value));o.selected=!o.selected;const r=t=>{var e;t!==o&&(t.selected=!1),null===(e=t.subOptions)||void 0===e||e.forEach(r)};this.multivalued?null===(e=o.subOptions)||void 0===e||e.forEach(r):this.options.forEach(r),this.optionsChanged()}optionsChanged(){this.changeDebouncer.run((()=>{var t;this.sendEventIfValuesChanged(),this.requestUpdate(),null===(t=this.levels)||void 0===t||t.forEach((t=>t.requestUpdate()))}))}sendEventIfValuesChanged(){const t=this.selectedValues;uo(this.lastDispatchedValues,t)||(this.dispatchEvent(new tf(t)),this.lastDispatchedValues=t)}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)}}ef.elementDefinitions={"ft-button":mc,"ft-filter-level":Hc,"ft-snap-scroll":Yc,"ft-typography":Rs},ef.styles=Xc,Qc([we({type:String})],ef.prototype,"id",void 0),Qc([we({type:String})],ef.prototype,"label",void 0),Qc([we({type:String})],ef.prototype,"filterPlaceHolder",void 0),Qc([we({type:String})],ef.prototype,"clearButtonLabel",void 0),Qc([we({type:String})],ef.prototype,"moreValuesButtonLabel",void 0),Qc([we({type:String})],ef.prototype,"noValuesLabel",void 0),Qc([bo([])],ef.prototype,"options",void 0),Qc([we({type:Boolean})],ef.prototype,"multivalued",void 0),Qc([we({type:Boolean})],ef.prototype,"disabled",void 0),Qc([we({type:Boolean})],ef.prototype,"raiseSelectedOptions",void 0),Qc([we({type:Boolean})],ef.prototype,"displayCount",void 0),Qc([we({type:Number})],ef.prototype,"displayedValuesLimit",void 0),Qc([we({type:Boolean})],ef.prototype,"hideClearButton",void 0),Qc([$e(".ft-filter--slot")],ef.prototype,"slotElement",void 0),Qc([$e(".ft-filter--container")],ef.prototype,"container",void 0),Qc([$e(".ft-filter--values")],ef.prototype,"valuesContainer",void 0),Qc([$e(".ft-filter--levels")],ef.prototype,"levelsContainer",void 0),Qc([Se()],ef.prototype,"lastLevelHasHiddenvalues",void 0),Qc([$e(".ft-filter--filter input")],ef.prototype,"filterInput",void 0),Qc([ke(".ft-filter--levels ft-filter-level")],ef.prototype,"levels",void 0),Qc([Se()],ef.prototype,"withScroll",void 0),Qc([Se()],ef.prototype,"filter",void 0),Qc([Se()],ef.prototype,"slideIn",void 0),Qc([Se()],ef.prototype,"slideOut",void 0);var of=function(t,e,o,r){for(var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r,l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};class rf extends Di{constructor(){super(...arguments),this.label="",this.value=null,this.selected=!1,this.subOptions=[]}render(){return Jt`
|
|
1657
1660
|
<slot class="ft-filter-option--slot" @slotchange=${this.updateSubOptionsFromSlot}></slot>
|
|
1658
1661
|
`}updateSubOptionsFromSlot(t){t.stopPropagation(),this.subOptions=this.slotElement.assignedElements().map((t=>t))}update(t){super.update(t),this.dispatchEvent(new CustomEvent("option-change",{detail:this,bubbles:!0}))}}rf.elementDefinitions={},of([we({type:String})],rf.prototype,"label",void 0),of([we({type:Object,converter:t=>t})],rf.prototype,"value",void 0),of([we({type:Boolean,reflect:!0})],rf.prototype,"selected",void 0),of([we({type:Object})],rf.prototype,"subOptions",void 0),of([bo({})],rf.prototype,"renderOption",void 0),of([$e(".ft-filter-option--slot")],rf.prototype,"slotElement",void 0),yo("ft-filter")(ef),yo("ft-filter-option")(rf),t.FtFilter=ef,t.FtFilterChangeEvent=tf,t.FtFilterCssVariables=Jc,t.FtFilterLevelCssVariables=Zc,t.FtFilterOption=rf,t.levelStyles=Mc,t.styles=Xc}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-filter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.63",
|
|
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": "1.1.
|
|
23
|
-
"@fluid-topics/ft-checkbox": "1.1.
|
|
24
|
-
"@fluid-topics/ft-icon": "1.1.
|
|
25
|
-
"@fluid-topics/ft-radio": "1.1.
|
|
26
|
-
"@fluid-topics/ft-ripple": "1.1.
|
|
27
|
-
"@fluid-topics/ft-snap-scroll": "1.1.
|
|
28
|
-
"@fluid-topics/ft-typography": "1.1.
|
|
29
|
-
"@fluid-topics/ft-wc-utils": "1.1.
|
|
22
|
+
"@fluid-topics/ft-button": "1.1.63",
|
|
23
|
+
"@fluid-topics/ft-checkbox": "1.1.63",
|
|
24
|
+
"@fluid-topics/ft-icon": "1.1.63",
|
|
25
|
+
"@fluid-topics/ft-radio": "1.1.63",
|
|
26
|
+
"@fluid-topics/ft-ripple": "1.1.63",
|
|
27
|
+
"@fluid-topics/ft-snap-scroll": "1.1.63",
|
|
28
|
+
"@fluid-topics/ft-typography": "1.1.63",
|
|
29
|
+
"@fluid-topics/ft-wc-utils": "1.1.63",
|
|
30
30
|
"lit": "3.1.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "6f2845e11b1b3a26814c32cacd5413802aa28157"
|
|
33
33
|
}
|