@fluxhub/fluxhub-lib 22.0.31 → 22.0.33

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.
@@ -10694,19 +10694,52 @@ class FHGridComponent {
10694
10694
  this.command.emit(o);
10695
10695
  }
10696
10696
  b_ensure = false;
10697
+ // Le chiavi _POS/_POS2/_LAST_ROW non si cancellano dopo il ripristino: anche un
10698
+ // secondo aggiornamento della pagina deve tornare sull'ultima riga cliccata.
10697
10699
  ensure_visible() {
10698
- if (this.b_ensure)
10700
+ if (this.b_ensure || this.b_row_restored)
10699
10701
  return;
10700
10702
  this.b_ensure = true;
10701
10703
  try {
10702
- if (localStorage.getItem(this.grid_customer_preference_key + '_POS') != null) {
10703
- if (this.gridApi)
10704
- this.gridApi.ensureIndexVisible(parseInt(localStorage.getItem(this.grid_customer_preference_key + '_POS') || '0'));
10705
- localStorage.removeItem(this.grid_customer_preference_key + '_POS');
10706
- }
10704
+ const pos = localStorage.getItem(this.grid_customer_preference_key + '_POS');
10705
+ if (pos != null && this.gridApi)
10706
+ this.gridApi.ensureIndexVisible(parseInt(pos) || 0, 'middle');
10707
10707
  }
10708
10708
  catch (e) { }
10709
10709
  }
10710
+ b_row_restored = false;
10711
+ /**
10712
+ * Riposiziona la grid sull'ultima riga cliccata (una volta per istanza). Chiamata a ogni
10713
+ * blocco caricato dal server: se la riga sta in un blocco successivo la trova quando
10714
+ * ensure_visible() lo fa caricare. Cerca per id (gridOptions.getRowId) e, per le righe
10715
+ * senza chiave (id generato a caso), confronta i dati con _LAST_ROW.
10716
+ */
10717
+ restore_last_row() {
10718
+ if (this.b_row_restored || !this.gridApi)
10719
+ return;
10720
+ const id = localStorage.getItem(this.grid_customer_preference_key + '_POS2');
10721
+ const raw = localStorage.getItem(this.grid_customer_preference_key + '_LAST_ROW');
10722
+ if (id == null && (raw == null || raw === 'undefined'))
10723
+ return;
10724
+ let node = id != null ? this.gridApi.getRowNode(id) : null;
10725
+ if (node == null && raw != null)
10726
+ this.gridApi.forEachNode((n) => {
10727
+ if (node == null && n.data != null && JSON.stringify(n.data) === raw)
10728
+ node = n;
10729
+ });
10730
+ if (node == null || node.rowIndex == null)
10731
+ return;
10732
+ this.b_row_restored = true;
10733
+ this.sRow = node.data;
10734
+ if (this.selection_mode?.enableClickSelection)
10735
+ node.setSelected(true, true);
10736
+ this.gridApi.ensureNodeVisible(node, 'middle');
10737
+ // focus sulla prima colonna con dati, non su quella delle checkbox (si vedrebbe appena)
10738
+ const cols = this.gridApi.getAllDisplayedColumns();
10739
+ const col = cols.find((c) => c.getColDef()?.field) || cols[0];
10740
+ if (col)
10741
+ this.gridApi.setFocusedCell(node.rowIndex, col);
10742
+ }
10710
10743
  gf = null;
10711
10744
  toggle_mantieni = null;
10712
10745
  ck_flag() {
@@ -11036,21 +11069,7 @@ class FHGridComponent {
11036
11069
  this.fill_end.emit();
11037
11070
  this.check_width();
11038
11071
  localStorage.setItem(this.grid_customer_preference_key + '_POS1', JSON.stringify(p));
11039
- if (localStorage.getItem(this.grid_customer_preference_key + '_POS2') != null)
11040
- if (this.gridOptions != null)
11041
- if (this.gridApi != null)
11042
- this.gridApi.forEachNode((node) => {
11043
- if (this.getRowId(node) ===
11044
- localStorage.getItem(this.grid_customer_preference_key + '_POS2')) {
11045
- node.setSelected(true);
11046
- localStorage.removeItem(this.grid_customer_preference_key + '_POS2');
11047
- if (localStorage.getItem(this.grid_customer_preference_key + '_LAST_ROW') != null)
11048
- this.sRow = this.read_last_row();
11049
- else
11050
- this.sRow = null;
11051
- localStorage.removeItem(this.grid_customer_preference_key + '_LAST_ROW');
11052
- }
11053
- });
11072
+ this.restore_last_row();
11054
11073
  let b_mantieni_ck = false;
11055
11074
  if (this.toggle_mantieni != null)
11056
11075
  b_mantieni_ck = this.toggle_mantieni.checked;
@@ -11279,19 +11298,6 @@ class FHGridComponent {
11279
11298
  }
11280
11299
  };
11281
11300
  }
11282
- getRowId(item) {
11283
- if (item == null)
11284
- return this.uti_s.newGuid();
11285
- if (item.data == null)
11286
- return this.uti_s.newGuid();
11287
- if (item.data.id != null)
11288
- return String(item.data.id);
11289
- if (item.data.uiid != null)
11290
- return item.data.uiid;
11291
- if (item.data.codice != null)
11292
- return item.data.codice;
11293
- return this.uti_s.newGuid();
11294
- }
11295
11301
  agGrid;
11296
11302
  b_init = false;
11297
11303
  b_init1 = false;
@@ -12160,18 +12166,17 @@ class FHGridComponent {
12160
12166
  return;
12161
12167
  if (this.isTotalsRow($event))
12162
12168
  return;
12163
- var selectedInGrid;
12164
- if (this.gridApi)
12165
- selectedInGrid = this.gridApi.getSelectedNodes();
12166
- if (selectedInGrid != null)
12167
- if (selectedInGrid[0] != null) {
12168
- localStorage.setItem(this.grid_customer_preference_key + '_POS', String(selectedInGrid[0].rowIndex));
12169
- if (this.gridApi)
12170
- localStorage.setItem(this.grid_customer_preference_key + '_POS_BAR', JSON.stringify(this.gridApi.getVerticalPixelRange()));
12171
- localStorage.setItem(this.grid_customer_preference_key + '_POS2', this.getRowId(selectedInGrid[0]));
12172
- // this.m_appService.getState().grid_obj=new Object();
12173
- // this.m_appService.getState().grid_obj[this.grid_customer_preference_key+'_NODE']=this.gridApi.getSelectedRows[0];
12174
- }
12169
+ // Posizione da ripristinare al ricaricamento: la riga CLICCATA, non la selezione
12170
+ // (con rowSelection multiRow il click non seleziona e getSelectedNodes() e' vuoto
12171
+ // o contiene le righe spuntate). Id = quello di gridOptions.getRowId (node.id).
12172
+ const node = $event.node;
12173
+ if (node != null && node.data != null && node.rowIndex != null) {
12174
+ localStorage.setItem(this.grid_customer_preference_key + '_POS', String(node.rowIndex));
12175
+ if (this.gridApi)
12176
+ localStorage.setItem(this.grid_customer_preference_key + '_POS_BAR', JSON.stringify(this.gridApi.getVerticalPixelRange()));
12177
+ if (node.id != null)
12178
+ localStorage.setItem(this.grid_customer_preference_key + '_POS2', String(node.id));
12179
+ }
12175
12180
  this.sRow = $event.data;
12176
12181
  // riga senza dati (gruppo, riga di caricamento): niente LAST_ROW, altrimenti si salva la stringa 'undefined'
12177
12182
  if (this.sRow != null)
@@ -40432,6 +40437,12 @@ class FHHomeLauncherComponent {
40432
40437
  get _ink() {
40433
40438
  return this.ink;
40434
40439
  }
40440
+ /**
40441
+ * Colora ogni sezione con il colore della sua categoria (applications_categories.color):
40442
+ * filetto, numero, icone e box. Le categorie senza colore usano [accent]/[accentDark].
40443
+ * Default false: resta l'accento unico del launcher.
40444
+ */
40445
+ useCategoryColors = false;
40435
40446
  // ---- Layout ----
40436
40447
  /** Mostra l'indice numerato (01, 02, ...) accanto al titolo categoria. */
40437
40448
  showIndex = true;
@@ -40619,8 +40630,13 @@ class FHHomeLauncherComponent {
40619
40630
  });
40620
40631
  }
40621
40632
  const cats = grouped.filter((c) => c.apps.length > 0);
40622
- for (const c of cats)
40633
+ for (const c of cats) {
40623
40634
  c.isBox = this.isBoxCat(c);
40635
+ // colore della categoria come accento della sezione (calcolato qui, non nel template)
40636
+ const col = this.useCategoryColors ? (c.color || '').trim() : '';
40637
+ c.accent = col || null;
40638
+ c.accentDark = col ? `color-mix(in srgb, ${col} 78%, #000)` : null;
40639
+ }
40624
40640
  this.categories = cats;
40625
40641
  this.is_loaded = true;
40626
40642
  });
@@ -40702,7 +40718,7 @@ class FHHomeLauncherComponent {
40702
40718
  this.appOpen.emit(app);
40703
40719
  }
40704
40720
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.3", ngImport: i0, type: FHHomeLauncherComponent, deps: [{ token: AppService }, { token: AuthenticationService }, { token: QueryService }, { token: UtilityService }, { token: i3$2.Router }], target: i0.ɵɵFactoryTarget.Component });
40705
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: FHHomeLauncherComponent, isStandalone: true, selector: "FHHomeLauncher", inputs: { accent: "accent", accentDark: "accentDark", ink: "ink", showIndex: "showIndex", columnWidth: "columnWidth", columnGap: "columnGap", boxCategoryIds: "boxCategoryIds", boxIcon: "boxIcon", boxActionLabel: "boxActionLabel", boxLayout: "boxLayout", enableFavorites: "enableFavorites", sqlCatPrefsGet: "sqlCatPrefsGet", sqlCatPrefsSave: "sqlCatPrefsSave", favoriteTooltip: "favoriteTooltip", unfavoriteTooltip: "unfavoriteTooltip", background: "background", showGridBackground: "showGridBackground", sqlUserAccess: "sqlUserAccess", sqlAllApps: "sqlAllApps", sqlApps: "sqlApps", sqlAccessLog: "sqlAccessLog", appVersion: "appVersion" }, outputs: { appOpen: "appOpen" }, host: { properties: { "style.--fh-home-accent": "this._a", "style.--fh-home-accent-dark": "this._ad", "style.--fh-home-ink": "this._ink" } }, ngImport: i0, template: `
40721
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.3", type: FHHomeLauncherComponent, isStandalone: true, selector: "FHHomeLauncher", inputs: { accent: "accent", accentDark: "accentDark", ink: "ink", useCategoryColors: "useCategoryColors", showIndex: "showIndex", columnWidth: "columnWidth", columnGap: "columnGap", boxCategoryIds: "boxCategoryIds", boxIcon: "boxIcon", boxActionLabel: "boxActionLabel", boxLayout: "boxLayout", enableFavorites: "enableFavorites", sqlCatPrefsGet: "sqlCatPrefsGet", sqlCatPrefsSave: "sqlCatPrefsSave", favoriteTooltip: "favoriteTooltip", unfavoriteTooltip: "unfavoriteTooltip", background: "background", showGridBackground: "showGridBackground", sqlUserAccess: "sqlUserAccess", sqlAllApps: "sqlAllApps", sqlApps: "sqlApps", sqlAccessLog: "sqlAccessLog", appVersion: "appVersion" }, outputs: { appOpen: "appOpen" }, host: { properties: { "style.--fh-home-accent": "this._a", "style.--fh-home-accent-dark": "this._ad", "style.--fh-home-ink": "this._ink" } }, ngImport: i0, template: `
40706
40722
  @if (is_loaded) {
40707
40723
  <div
40708
40724
  class="launcher"
@@ -40715,7 +40731,11 @@ class FHHomeLauncherComponent {
40715
40731
  [style.column-gap.px]="columnGap"
40716
40732
  >
40717
40733
  @for (cat of categories; track cat; let i = $index) {
40718
- <section class="cat">
40734
+ <section
40735
+ class="cat"
40736
+ [style.--fh-home-accent]="cat.accent"
40737
+ [style.--fh-home-accent-dark]="cat.accentDark"
40738
+ >
40719
40739
  <header class="cat-head">
40720
40740
  @if (showIndex) {
40721
40741
  <span class="cat-index">{{
@@ -40819,7 +40839,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
40819
40839
  [style.column-gap.px]="columnGap"
40820
40840
  >
40821
40841
  @for (cat of categories; track cat; let i = $index) {
40822
- <section class="cat">
40842
+ <section
40843
+ class="cat"
40844
+ [style.--fh-home-accent]="cat.accent"
40845
+ [style.--fh-home-accent-dark]="cat.accentDark"
40846
+ >
40823
40847
  <header class="cat-head">
40824
40848
  @if (showIndex) {
40825
40849
  <span class="cat-index">{{
@@ -40922,6 +40946,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.3", ngImpor
40922
40946
  }], _ink: [{
40923
40947
  type: HostBinding,
40924
40948
  args: ['style.--fh-home-ink']
40949
+ }], useCategoryColors: [{
40950
+ type: Input
40925
40951
  }], showIndex: [{
40926
40952
  type: Input
40927
40953
  }], columnWidth: [{