@fluxhub/fluxhub-lib 22.0.1 → 22.0.3

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, Inject, forwardRef, ViewChild, Optional, Pipe, HostListener, Directive, ViewEncapsulation, ViewContainerRef, ElementRef, ViewChildren, HostBinding } from '@angular/core';
2
+ import { Injectable, EventEmitter, Output, Input, ChangeDetectionStrategy, Component, ViewChild, Inject, forwardRef, Optional, Pipe, HostListener, Directive, ViewEncapsulation, ViewContainerRef, ElementRef, ViewChildren, HostBinding } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common/http';
4
4
  import { HttpHeaders, HttpEventType, HttpErrorResponse } from '@angular/common/http';
5
5
  import { map, catchError, flatMap, debounceTime, switchMap, filter, take, tap } from 'rxjs/operators';
@@ -2000,6 +2000,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
2000
2000
  type: Output
2001
2001
  }] } });
2002
2002
 
2003
+ /** minuscolo e senza accenti, un carattere per carattere (gli indici restano allineati) */
2004
+ function fold(s) {
2005
+ let r = '';
2006
+ for (const c of s) {
2007
+ const f = c.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
2008
+ r += f.length === 1 ? f : c.toLowerCase().charAt(0);
2009
+ }
2010
+ return r;
2011
+ }
2003
2012
  /**
2004
2013
  * Dialog di scelta da lista **con ricerca** — il "modo grande" di `FHComboBox`.
2005
2014
  *
@@ -2010,16 +2019,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
2010
2019
  * Non fa query: riceve le voci gia' caricate da `FHComboBox` (che le prende dal suo
2011
2020
  * `sql`/`option_values` come sempre). Ritorna il `valore` scelto, `''` per la voce
2012
2021
  * vuota, `undefined` se si chiude senza scegliere.
2022
+ *
2023
+ * La ricerca ignora maiuscole e accenti e accetta piu' parole (devono esserci tutte,
2024
+ * in qualsiasi ordine). Da tastiera: frecce per muoversi, Invio per scegliere.
2013
2025
  */
2014
2026
  class FHWinSearchListComponent {
2015
2027
  ref;
2016
2028
  data;
2017
2029
  filter = '';
2018
- visible = [];
2030
+ rows = [];
2031
+ /** quante voci vere (esclusa la voce vuota) passano il filtro */
2032
+ matches = 0;
2033
+ /** riga evidenziata da tastiera/mouse: Invio sceglie questa */
2034
+ active = -1;
2035
+ /** altezza della lista all'apertura: filtrando la dialog non si accorcia a scatti */
2036
+ listMinHeight = null;
2037
+ searchInput;
2038
+ list;
2039
+ head;
2019
2040
  /** un solo pulsante: la scelta chiude la dialog, come nel pannello di una combo */
2020
2041
  buttons = [
2021
2042
  { text: 'ANNULLA', type: 'stroked', returnValue: undefined },
2022
2043
  ];
2044
+ /** descrizioni gia' "piegate" (minuscole, senza accenti), calcolate una volta */
2045
+ folded = [];
2023
2046
  constructor(ref, data) {
2024
2047
  this.ref = ref;
2025
2048
  this.data = data;
@@ -2027,75 +2050,215 @@ class FHWinSearchListComponent {
2027
2050
  this.data = { items: [] };
2028
2051
  if (!this.data.items)
2029
2052
  this.data.items = [];
2030
- this.visible = this.data.items;
2053
+ this.folded = this.data.items.map((v) => fold(v.descrizione_valore || ''));
2054
+ this.applyFilter();
2055
+ // all'apertura la riga attiva e' quella gia' scelta
2056
+ const i = this.rows.findIndex((r) => this.isSelected(r));
2057
+ this.active = i >= 0 ? i : -1;
2058
+ }
2059
+ ngAfterViewInit() {
2060
+ // chi scrolla e' il wrapper di DialogBase (genitore di [dialog-content])
2061
+ const sc = this.list?.nativeElement.parentElement?.parentElement;
2062
+ if (sc)
2063
+ this.stickHead(sc);
2064
+ setTimeout(() => {
2065
+ this.searchInput?.nativeElement.focus();
2066
+ const el = this.list?.nativeElement;
2067
+ if (!el)
2068
+ return;
2069
+ // si blocca solo la parte visibile della lista, non tutta (altrimenti filtrando
2070
+ // resterebbe una scrollbar su spazio vuoto)
2071
+ // (misure di layout, non getBoundingClientRect: la dialog sta ancora animando la scala)
2072
+ if (sc) {
2073
+ const overflow = Math.max(0, sc.scrollHeight - sc.clientHeight);
2074
+ this.listMinHeight = Math.max(0, el.offsetHeight - overflow);
2075
+ }
2076
+ this.scrollToActive('center');
2077
+ });
2078
+ }
2079
+ /**
2080
+ * Incolla la ricerca al bordo del wrapper che scrolla, annullandone il padding.
2081
+ * Il padding si legge a runtime perche' cambia da portale a portale; inline con
2082
+ * !important perche' i portali forzano con !important il margin-top del primo figlio.
2083
+ */
2084
+ stickHead(sc) {
2085
+ const head = this.head?.nativeElement;
2086
+ if (!head)
2087
+ return;
2088
+ const cs = getComputedStyle(sc);
2089
+ const pt = parseFloat(cs.paddingTop) || 0;
2090
+ const pl = parseFloat(cs.paddingLeft) || 0;
2091
+ const pr = parseFloat(cs.paddingRight) || 0;
2092
+ head.style.setProperty('margin', `${-pt}px ${-pr}px 0 ${-pl}px`, 'important');
2093
+ head.style.setProperty('top', `${-pt}px`, 'important');
2094
+ }
2095
+ isSelected(r) {
2096
+ const s = this.data.selected;
2097
+ if (r.empty)
2098
+ return !s || s === '-1';
2099
+ return r.valore === s;
2031
2100
  }
2032
2101
  applyFilter() {
2033
- const f = (this.filter || '').trim().toLowerCase();
2034
- this.visible = !f
2035
- ? this.data.items
2036
- : this.data.items.filter((v) => (v.descrizione_valore || '').toLowerCase().includes(f));
2102
+ const terms = fold((this.filter || '').trim())
2103
+ .split(/\s+/)
2104
+ .filter((t) => t);
2105
+ const rows = [];
2106
+ if (this.data.allowEmpty && !terms.length) {
2107
+ rows.push({
2108
+ valore: '',
2109
+ parts: [{ t: this.data.emptyLabel || '', m: false }],
2110
+ empty: true,
2111
+ });
2112
+ }
2113
+ this.data.items.forEach((v, i) => {
2114
+ const d = v.descrizione_valore || '';
2115
+ const f = this.folded[i];
2116
+ if (!terms.every((t) => f.includes(t)))
2117
+ return;
2118
+ rows.push({ valore: v.valore, parts: this.split(d, f, terms) });
2119
+ });
2120
+ this.rows = rows;
2121
+ this.matches = rows.filter((r) => !r.empty).length;
2122
+ // filtrando, la prima voce che corrisponde e' gia' pronta per Invio
2123
+ this.active = terms.length && rows.length ? 0 : -1;
2124
+ if (this.active === 0)
2125
+ this.scrollToActive('nearest');
2126
+ }
2127
+ /** spezza la descrizione nei tratti che corrispondono ai termini cercati */
2128
+ split(d, f, terms) {
2129
+ if (!terms.length)
2130
+ return [{ t: d, m: false }];
2131
+ const hit = new Array(d.length).fill(false);
2132
+ for (const t of terms) {
2133
+ let p = f.indexOf(t);
2134
+ while (p >= 0) {
2135
+ for (let k = p; k < p + t.length; k++)
2136
+ hit[k] = true;
2137
+ p = f.indexOf(t, p + t.length);
2138
+ }
2139
+ }
2140
+ const parts = [];
2141
+ for (let k = 0; k < d.length; k++) {
2142
+ const last = parts[parts.length - 1];
2143
+ if (last && last.m === hit[k])
2144
+ last.t += d[k];
2145
+ else
2146
+ parts.push({ t: d[k], m: hit[k] });
2147
+ }
2148
+ return parts;
2037
2149
  }
2038
2150
  clearFilter() {
2039
2151
  this.filter = '';
2040
2152
  this.applyFilter();
2153
+ this.searchInput?.nativeElement.focus();
2154
+ }
2155
+ onKey(e) {
2156
+ if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
2157
+ e.preventDefault();
2158
+ if (!this.rows.length)
2159
+ return;
2160
+ const step = e.key === 'ArrowDown' ? 1 : -1;
2161
+ const n = this.rows.length;
2162
+ this.active = this.active < 0 ? (step > 0 ? 0 : n - 1) : (this.active + step + n) % n;
2163
+ this.scrollToActive('nearest');
2164
+ }
2165
+ else if (e.key === 'Enter') {
2166
+ e.preventDefault();
2167
+ const r = this.rows[this.active];
2168
+ if (r)
2169
+ this.choose(r.valore);
2170
+ }
2171
+ }
2172
+ scrollToActive(block) {
2173
+ setTimeout(() => {
2174
+ const el = this.list?.nativeElement.children[this.active];
2175
+ el?.scrollIntoView({ block });
2176
+ });
2041
2177
  }
2042
2178
  choose(valore) {
2043
2179
  this.ref.close(valore);
2044
2180
  }
2045
2181
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FHWinSearchListComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
2046
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: FHWinSearchListComponent, isStandalone: true, selector: "FHWinSearchList", ngImport: i0, template: `
2182
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: FHWinSearchListComponent, isStandalone: true, selector: "FHWinSearchList", viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "list", first: true, predicate: ["list"], descendants: true }, { propertyName: "head", first: true, predicate: ["head"], descendants: true }], ngImport: i0, template: `
2047
2183
  <fh-dialog-base
2048
2184
  [title]="data.title || ''"
2049
2185
  [buttons]="buttons"
2050
2186
  [showCloseButton]="true"
2051
2187
  >
2052
- <div dialog-content>
2053
- <div class="fh-sl-search">
2054
- <mat-icon>search</mat-icon>
2055
- <input
2056
- type="text"
2057
- [placeholder]="(data.searchLabel || 'Cerca...') | translate"
2058
- [(ngModel)]="filter"
2059
- (ngModelChange)="applyFilter()"
2060
- autocomplete="off"
2061
- />
2062
- @if (filter) {
2063
- <button type="button" class="fh-sl-clear" (click)="clearFilter()">
2064
- <mat-icon>close</mat-icon>
2065
- </button>
2066
- }
2188
+ <div dialog-content class="fh-sl-root">
2189
+ <!-- sticky: chi scrolla e' il wrapper di DialogBase, la ricerca deve restare in cima -->
2190
+ <div class="fh-sl-head" #head>
2191
+ <div class="fh-sl-search">
2192
+ <mat-icon>search</mat-icon>
2193
+ <input
2194
+ #searchInput
2195
+ type="text"
2196
+ [placeholder]="(data.searchLabel || 'Cerca...') | translate"
2197
+ [(ngModel)]="filter"
2198
+ (ngModelChange)="applyFilter()"
2199
+ (keydown)="onKey($event)"
2200
+ autocomplete="off"
2201
+ />
2202
+ <!-- contatore dentro la casella: una riga in meno, piu' voci visibili -->
2203
+ <span class="fh-sl-count">
2204
+ @if (filter) {
2205
+ {{ matches }} / {{ data.items.length }}
2206
+ } @else {
2207
+ {{ data.items.length }} {{ 'voci' | translate }}
2208
+ }
2209
+ </span>
2210
+ @if (filter) {
2211
+ <button
2212
+ type="button"
2213
+ class="fh-sl-clear"
2214
+ tabindex="-1"
2215
+ (click)="clearFilter()"
2216
+ >
2217
+ <mat-icon>close</mat-icon>
2218
+ </button>
2219
+ }
2220
+ </div>
2067
2221
  </div>
2068
2222
 
2069
- <div class="fh-sl-list">
2070
- @if (data.allowEmpty && !filter) {
2071
- <button
2072
- type="button"
2073
- class="fh-sl-item fh-sl-item--empty"
2074
- [class.sel]="!data.selected || data.selected === '-1'"
2075
- (click)="choose('')"
2076
- >
2077
- {{ data.emptyLabel || '' }}
2078
- </button>
2079
- }
2080
- @for (v of visible; track v.valore) {
2223
+ <div class="fh-sl-list" #list [style.min-height.px]="listMinHeight">
2224
+ @for (r of rows; track r.valore; let i = $index) {
2081
2225
  <button
2082
2226
  type="button"
2227
+ tabindex="-1"
2083
2228
  class="fh-sl-item"
2084
- [class.sel]="v.valore === data.selected"
2085
- (click)="choose(v.valore)"
2229
+ [class.fh-sl-item--empty]="r.empty"
2230
+ [class.sel]="isSelected(r)"
2231
+ [class.active]="i === active"
2232
+ (mousemove)="active = i"
2233
+ (click)="choose(r.valore)"
2086
2234
  >
2087
- {{ v.descrizione_valore }}
2235
+ <span class="fh-sl-text">
2236
+ @if (r.empty && !r.parts[0].t) {
2237
+ {{ '(nessuna selezione)' | translate }}
2238
+ }
2239
+ @for (p of r.parts; track $index) {
2240
+ @if (p.m) {
2241
+ <mark>{{ p.t }}</mark>
2242
+ } @else {
2243
+ {{ p.t }}
2244
+ }
2245
+ }
2246
+ </span>
2247
+ @if (isSelected(r)) {
2248
+ <mat-icon class="fh-sl-check">check</mat-icon>
2249
+ }
2088
2250
  </button>
2089
2251
  }
2090
- @if (!visible.length) {
2252
+ @if (!matches) {
2091
2253
  <div class="fh-sl-empty">
2254
+ <mat-icon>search_off</mat-icon>
2092
2255
  {{ 'Nessuna voce corrisponde alla ricerca.' | translate }}
2093
2256
  </div>
2094
2257
  }
2095
2258
  </div>
2096
2259
  </div>
2097
2260
  </fh-dialog-base>
2098
- `, isInline: true, styles: [".fh-sl-search{display:flex;align-items:center;gap:6px;border:1px solid #ccc;border-radius:4px;padding:4px 8px;margin-bottom:8px}.fh-sl-search input{flex:1;border:0;outline:0;font-size:14px;background:transparent}.fh-sl-search mat-icon{color:#888;font-size:20px;width:20px;height:20px}.fh-sl-clear{border:0;background:transparent;cursor:pointer;line-height:0;padding:0}.fh-sl-list{display:flex;flex-direction:column}.fh-sl-item{text-align:left;border:0;border-bottom:1px solid #eee;background:transparent;padding:8px 6px;font-size:13px;line-height:1.35;cursor:pointer}.fh-sl-item:hover{background:#0000000a}.fh-sl-item.sel{background:#3f51b51f;font-weight:600}.fh-sl-item--empty{font-style:italic;opacity:.75}.fh-sl-empty{padding:12px 6px;opacity:.7;font-size:13px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: DialogBaseComponent, selector: "fh-dialog-base", inputs: ["title", "buttons", "showCloseButton", "canValidate", "buttonsAlignment"], outputs: ["buttonClick", "beforeClose"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2261
+ `, isInline: true, styles: [":host{--fh-sl-accent: var(--mat-sys-primary, #3f51b5)}.fh-sl-root{max-height:none!important;overflow:visible!important}.fh-sl-head{position:sticky;top:0;z-index:1;margin:0 -10px;padding:8px 10px;background:var(--mat-sys-surface, #fff);box-shadow:0 6px 6px -6px #0000002e}.fh-sl-search{display:flex;align-items:center;gap:8px;height:40px;border:1px solid rgba(0,0,0,.25);border-radius:8px;padding:0 6px 0 10px;transition:border-color .15s,box-shadow .15s}.fh-sl-search:focus-within{border-color:var(--fh-sl-accent);box-shadow:0 0 0 1px var(--fh-sl-accent)}.fh-sl-search input{flex:1;min-width:0;border:0;outline:0;font:inherit;font-size:14px;background:transparent;color:inherit}.fh-sl-search mat-icon{color:#00000080;font-size:20px;width:20px;height:20px}.fh-sl-search:focus-within>mat-icon{color:var(--fh-sl-accent)}.fh-sl-clear{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:50%;background:transparent;cursor:pointer;padding:0}.fh-sl-clear:hover{background:#0000000f}.fh-sl-count{flex-shrink:0;font-size:12px;color:#00000080;white-space:nowrap}.fh-sl-count:last-child{padding-right:6px}.fh-sl-list{display:flex;flex-direction:column;padding-top:4px;box-sizing:border-box}.fh-sl-item{display:flex;align-items:center;gap:8px;text-align:left;border:0;border-radius:6px;background:transparent;color:inherit;padding:9px 10px;font:inherit;font-size:13px;line-height:1.4;cursor:pointer;scroll-margin-top:90px;scroll-margin-bottom:8px}.fh-sl-item+.fh-sl-item{margin-top:1px}.fh-sl-text{flex:1;min-width:0}.fh-sl-item.active{background:#0000000d}.fh-sl-item.sel{background:color-mix(in srgb,var(--fh-sl-accent) 12%,transparent);font-weight:600}.fh-sl-item.sel.active{background:color-mix(in srgb,var(--fh-sl-accent) 18%,transparent)}.fh-sl-check{flex-shrink:0;color:var(--fh-sl-accent);font-size:20px;width:20px;height:20px}.fh-sl-item--empty{font-style:italic;color:#0009}.fh-sl-item mark{background:color-mix(in srgb,#ffc107 45%,transparent);color:inherit;border-radius:2px}.fh-sl-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:28px 6px;color:#0000008c;font-size:13px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "ngmodule", type: MatDialogModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: DialogBaseComponent, selector: "fh-dialog-base", inputs: ["title", "buttons", "showCloseButton", "canValidate", "buttonsAlignment"], outputs: ["buttonClick", "beforeClose"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager });
2099
2262
  }
2100
2263
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FHWinSearchListComponent, decorators: [{
2101
2264
  type: Component,
@@ -2112,57 +2275,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
2112
2275
  [buttons]="buttons"
2113
2276
  [showCloseButton]="true"
2114
2277
  >
2115
- <div dialog-content>
2116
- <div class="fh-sl-search">
2117
- <mat-icon>search</mat-icon>
2118
- <input
2119
- type="text"
2120
- [placeholder]="(data.searchLabel || 'Cerca...') | translate"
2121
- [(ngModel)]="filter"
2122
- (ngModelChange)="applyFilter()"
2123
- autocomplete="off"
2124
- />
2125
- @if (filter) {
2126
- <button type="button" class="fh-sl-clear" (click)="clearFilter()">
2127
- <mat-icon>close</mat-icon>
2128
- </button>
2129
- }
2278
+ <div dialog-content class="fh-sl-root">
2279
+ <!-- sticky: chi scrolla e' il wrapper di DialogBase, la ricerca deve restare in cima -->
2280
+ <div class="fh-sl-head" #head>
2281
+ <div class="fh-sl-search">
2282
+ <mat-icon>search</mat-icon>
2283
+ <input
2284
+ #searchInput
2285
+ type="text"
2286
+ [placeholder]="(data.searchLabel || 'Cerca...') | translate"
2287
+ [(ngModel)]="filter"
2288
+ (ngModelChange)="applyFilter()"
2289
+ (keydown)="onKey($event)"
2290
+ autocomplete="off"
2291
+ />
2292
+ <!-- contatore dentro la casella: una riga in meno, piu' voci visibili -->
2293
+ <span class="fh-sl-count">
2294
+ @if (filter) {
2295
+ {{ matches }} / {{ data.items.length }}
2296
+ } @else {
2297
+ {{ data.items.length }} {{ 'voci' | translate }}
2298
+ }
2299
+ </span>
2300
+ @if (filter) {
2301
+ <button
2302
+ type="button"
2303
+ class="fh-sl-clear"
2304
+ tabindex="-1"
2305
+ (click)="clearFilter()"
2306
+ >
2307
+ <mat-icon>close</mat-icon>
2308
+ </button>
2309
+ }
2310
+ </div>
2130
2311
  </div>
2131
2312
 
2132
- <div class="fh-sl-list">
2133
- @if (data.allowEmpty && !filter) {
2134
- <button
2135
- type="button"
2136
- class="fh-sl-item fh-sl-item--empty"
2137
- [class.sel]="!data.selected || data.selected === '-1'"
2138
- (click)="choose('')"
2139
- >
2140
- {{ data.emptyLabel || '' }}
2141
- </button>
2142
- }
2143
- @for (v of visible; track v.valore) {
2313
+ <div class="fh-sl-list" #list [style.min-height.px]="listMinHeight">
2314
+ @for (r of rows; track r.valore; let i = $index) {
2144
2315
  <button
2145
2316
  type="button"
2317
+ tabindex="-1"
2146
2318
  class="fh-sl-item"
2147
- [class.sel]="v.valore === data.selected"
2148
- (click)="choose(v.valore)"
2319
+ [class.fh-sl-item--empty]="r.empty"
2320
+ [class.sel]="isSelected(r)"
2321
+ [class.active]="i === active"
2322
+ (mousemove)="active = i"
2323
+ (click)="choose(r.valore)"
2149
2324
  >
2150
- {{ v.descrizione_valore }}
2325
+ <span class="fh-sl-text">
2326
+ @if (r.empty && !r.parts[0].t) {
2327
+ {{ '(nessuna selezione)' | translate }}
2328
+ }
2329
+ @for (p of r.parts; track $index) {
2330
+ @if (p.m) {
2331
+ <mark>{{ p.t }}</mark>
2332
+ } @else {
2333
+ {{ p.t }}
2334
+ }
2335
+ }
2336
+ </span>
2337
+ @if (isSelected(r)) {
2338
+ <mat-icon class="fh-sl-check">check</mat-icon>
2339
+ }
2151
2340
  </button>
2152
2341
  }
2153
- @if (!visible.length) {
2342
+ @if (!matches) {
2154
2343
  <div class="fh-sl-empty">
2344
+ <mat-icon>search_off</mat-icon>
2155
2345
  {{ 'Nessuna voce corrisponde alla ricerca.' | translate }}
2156
2346
  </div>
2157
2347
  }
2158
2348
  </div>
2159
2349
  </div>
2160
2350
  </fh-dialog-base>
2161
- `, changeDetection: ChangeDetectionStrategy.Eager, styles: [".fh-sl-search{display:flex;align-items:center;gap:6px;border:1px solid #ccc;border-radius:4px;padding:4px 8px;margin-bottom:8px}.fh-sl-search input{flex:1;border:0;outline:0;font-size:14px;background:transparent}.fh-sl-search mat-icon{color:#888;font-size:20px;width:20px;height:20px}.fh-sl-clear{border:0;background:transparent;cursor:pointer;line-height:0;padding:0}.fh-sl-list{display:flex;flex-direction:column}.fh-sl-item{text-align:left;border:0;border-bottom:1px solid #eee;background:transparent;padding:8px 6px;font-size:13px;line-height:1.35;cursor:pointer}.fh-sl-item:hover{background:#0000000a}.fh-sl-item.sel{background:#3f51b51f;font-weight:600}.fh-sl-item--empty{font-style:italic;opacity:.75}.fh-sl-empty{padding:12px 6px;opacity:.7;font-size:13px}\n"] }]
2351
+ `, changeDetection: ChangeDetectionStrategy.Eager, styles: [":host{--fh-sl-accent: var(--mat-sys-primary, #3f51b5)}.fh-sl-root{max-height:none!important;overflow:visible!important}.fh-sl-head{position:sticky;top:0;z-index:1;margin:0 -10px;padding:8px 10px;background:var(--mat-sys-surface, #fff);box-shadow:0 6px 6px -6px #0000002e}.fh-sl-search{display:flex;align-items:center;gap:8px;height:40px;border:1px solid rgba(0,0,0,.25);border-radius:8px;padding:0 6px 0 10px;transition:border-color .15s,box-shadow .15s}.fh-sl-search:focus-within{border-color:var(--fh-sl-accent);box-shadow:0 0 0 1px var(--fh-sl-accent)}.fh-sl-search input{flex:1;min-width:0;border:0;outline:0;font:inherit;font-size:14px;background:transparent;color:inherit}.fh-sl-search mat-icon{color:#00000080;font-size:20px;width:20px;height:20px}.fh-sl-search:focus-within>mat-icon{color:var(--fh-sl-accent)}.fh-sl-clear{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border:0;border-radius:50%;background:transparent;cursor:pointer;padding:0}.fh-sl-clear:hover{background:#0000000f}.fh-sl-count{flex-shrink:0;font-size:12px;color:#00000080;white-space:nowrap}.fh-sl-count:last-child{padding-right:6px}.fh-sl-list{display:flex;flex-direction:column;padding-top:4px;box-sizing:border-box}.fh-sl-item{display:flex;align-items:center;gap:8px;text-align:left;border:0;border-radius:6px;background:transparent;color:inherit;padding:9px 10px;font:inherit;font-size:13px;line-height:1.4;cursor:pointer;scroll-margin-top:90px;scroll-margin-bottom:8px}.fh-sl-item+.fh-sl-item{margin-top:1px}.fh-sl-text{flex:1;min-width:0}.fh-sl-item.active{background:#0000000d}.fh-sl-item.sel{background:color-mix(in srgb,var(--fh-sl-accent) 12%,transparent);font-weight:600}.fh-sl-item.sel.active{background:color-mix(in srgb,var(--fh-sl-accent) 18%,transparent)}.fh-sl-check{flex-shrink:0;color:var(--fh-sl-accent);font-size:20px;width:20px;height:20px}.fh-sl-item--empty{font-style:italic;color:#0009}.fh-sl-item mark{background:color-mix(in srgb,#ffc107 45%,transparent);color:inherit;border-radius:2px}.fh-sl-empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:28px 6px;color:#0000008c;font-size:13px}\n"] }]
2162
2352
  }], ctorParameters: () => [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
2163
2353
  type: Inject,
2164
2354
  args: [MAT_DIALOG_DATA]
2165
- }] }] });
2355
+ }] }], propDecorators: { searchInput: [{
2356
+ type: ViewChild,
2357
+ args: ['searchInput']
2358
+ }], list: [{
2359
+ type: ViewChild,
2360
+ args: ['list']
2361
+ }], head: [{
2362
+ type: ViewChild,
2363
+ args: ['head']
2364
+ }] } });
2166
2365
 
2167
2366
  class OdbcService {
2168
2367
  http;