@fluxhub/fluxhub-lib 19.0.210 → 19.0.213

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.
@@ -425,6 +425,21 @@ class UtilityService {
425
425
  this.titleService = titleService;
426
426
  this.translateService = translateService;
427
427
  }
428
+ /**
429
+ * Log di debug attivo SOLO sul dev server ng-serve (localhost:4200):
430
+ * in produzione non stampa nulla. È STATICO di proposito: così è
431
+ * richiamabile ovunque senza iniettare UtilityService — anche dentro gli
432
+ * HTTP interceptor, dove iniettare un service che usa HttpClient darebbe
433
+ * un cyclic dependency ("Cannot instantiate cyclic dependency! HttpClient").
434
+ * Uso: UtilityService.dlog('[TAG]', valore, ...);
435
+ */
436
+ static dlog(...args) {
437
+ if (typeof window !== 'undefined' &&
438
+ window.location.hostname === 'localhost' &&
439
+ window.location.port === '4200') {
440
+ console.log(...args);
441
+ }
442
+ }
428
443
  set_home_title(s) {
429
444
  setTimeout(() => {
430
445
  // Se la stringa è valida, usa il translate service
@@ -6850,6 +6865,8 @@ class FHFieldPickListComponent {
6850
6865
  hidden = false;
6851
6866
  only_in_list = true;
6852
6867
  single_sel = false;
6868
+ /** Abilita la ricerca in memoria (filtro client-side) nel dialog di scelta. */
6869
+ enableSearch = true;
6853
6870
  label = '';
6854
6871
  enabled = true;
6855
6872
  required = false;
@@ -6902,6 +6919,7 @@ class FHFieldPickListComponent {
6902
6919
  disableClose: true,
6903
6920
  data: {
6904
6921
  single_sel: this.single_sel,
6922
+ enableSearch: this.enableSearch,
6905
6923
  sel_values: this.value,
6906
6924
  sel_valori: this.valore,
6907
6925
  separator: this.separator,
@@ -6933,12 +6951,14 @@ class FHFieldPickListComponent {
6933
6951
  for (const element of this.selectedObjects) {
6934
6952
  if (element == null)
6935
6953
  continue;
6954
+ const desc = (element.descrizione_valore ?? '').toString().trim();
6955
+ const val = (element.valore ?? '').toString().trim();
6936
6956
  if (this.value != '')
6937
6957
  this.value += this.separator;
6938
- this.value += element.descrizione_valore ?? '';
6958
+ this.value += desc;
6939
6959
  if (this.valore != '')
6940
6960
  this.valore += this.separator;
6941
- this.valore += element.valore ?? '';
6961
+ this.valore += val;
6942
6962
  }
6943
6963
  this.writeValue(this.value);
6944
6964
  }
@@ -6982,7 +7002,7 @@ class FHFieldPickListComponent {
6982
7002
  });
6983
7003
  }
6984
7004
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHFieldPickListComponent, deps: [{ token: i1$2.MatDialog }, { token: i3.TranslateService }, { token: QueryService }], target: i0.ɵɵFactoryTarget.Component });
6985
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHFieldPickListComponent, isStandalone: true, selector: "FHFieldPickList", inputs: { sql: "sql", types: "types", values: "values", hidden: "hidden", only_in_list: "only_in_list", single_sel: "single_sel", label: "label", enabled: "enabled", required: "required", db_type: "db_type", separator: "separator", value: "value" }, outputs: { selchange: "selchange" }, providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$6], ngImport: i0, template: `
7005
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHFieldPickListComponent, isStandalone: true, selector: "FHFieldPickList", inputs: { sql: "sql", types: "types", values: "values", hidden: "hidden", only_in_list: "only_in_list", single_sel: "single_sel", enableSearch: "enableSearch", label: "label", enabled: "enabled", required: "required", db_type: "db_type", separator: "separator", value: "value" }, outputs: { selchange: "selchange" }, providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$6], ngImport: i0, template: `
6986
7006
  <div
6987
7007
  fxLayout="row"
6988
7008
  [hidden]="!enabled || hidden"
@@ -7121,6 +7141,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
7121
7141
  type: Input
7122
7142
  }], single_sel: [{
7123
7143
  type: Input
7144
+ }], enableSearch: [{
7145
+ type: Input
7124
7146
  }], label: [{
7125
7147
  type: Input
7126
7148
  }], enabled: [{
@@ -31944,6 +31966,27 @@ class win_select_level_v2 {
31944
31966
  updateButtons() {
31945
31967
  this.buttons = [];
31946
31968
  }
31969
+ /**
31970
+ * Classe CSS FontAwesome per l'icona dello step. Il valore (scelto con
31971
+ * FHIconPicker) puo` essere: classe completa ("fa-solid fa-check",
31972
+ * "fa-brands fa-github"), nome con prefisso ("fa-check") o nome semplice
31973
+ * ("check"). Se manca lo stile assume "fa-solid". Gestisce anche i vecchi
31974
+ * valori FontAwesome 4 ("fa fa-check").
31975
+ */
31976
+ iconClass(v) {
31977
+ const raw = (v || "").trim();
31978
+ if (!raw)
31979
+ return "";
31980
+ // gia` una classe completa con lo stile (solid/brands/regular/light/thin/duotone/sharp)
31981
+ if (/\bfa-(solid|brands|regular|light|thin|duotone|sharp)\b/.test(raw))
31982
+ return raw;
31983
+ // vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`
31984
+ if (/\bfa\b/.test(raw))
31985
+ return raw;
31986
+ // nome icona, con o senza prefisso "fa-" -> assume lo stile solid
31987
+ const name = raw.startsWith("fa-") ? raw : "fa-" + raw;
31988
+ return "fa-solid " + name;
31989
+ }
31947
31990
  onBeforeClose(event) {
31948
31991
  event.preventDefault();
31949
31992
  this.close();
@@ -31985,7 +32028,7 @@ class win_select_level_v2 {
31985
32028
  [style.background-color]="'#fafafa'"
31986
32029
  [style.color]="app.color"
31987
32030
  (click)="sel(app)">
31988
- <i *ngIf="app.icon && app.icon!=''" [ngClass]="'fa ' + app.icon" aria-hidden="true"></i>
32031
+ <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
31989
32032
  <span>{{ app.description | translate }}</span>
31990
32033
  </div>
31991
32034
  </div>
@@ -32017,7 +32060,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
32017
32060
  [style.background-color]="'#fafafa'"
32018
32061
  [style.color]="app.color"
32019
32062
  (click)="sel(app)">
32020
- <i *ngIf="app.icon && app.icon!=''" [ngClass]="'fa ' + app.icon" aria-hidden="true"></i>
32063
+ <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
32021
32064
  <span>{{ app.description | translate }}</span>
32022
32065
  </div>
32023
32066
  </div>
@@ -35148,6 +35191,12 @@ class AuthHttpRequestInterceptor {
35148
35191
  this.appService = appService;
35149
35192
  this.http = http;
35150
35193
  }
35194
+ // Log di debug attivi SOLO sul dev server ng-serve (localhost:4200): in
35195
+ // produzione non stampano nulla. Delego a UtilityService.dlog (statico, così
35196
+ // non devo iniettare il service qui ed evito cyclic dependency con HttpClient).
35197
+ dlog(...args) {
35198
+ UtilityService.dlog('[AUTHDBG]', ...args);
35199
+ }
35151
35200
  intercept(request, next) {
35152
35201
  const token = this.getJwtToken();
35153
35202
  if (token && token !== 'ZZ') {
@@ -35159,11 +35208,12 @@ class AuthHttpRequestInterceptor {
35159
35208
  if (error instanceof HttpErrorResponse &&
35160
35209
  error.status === 400 &&
35161
35210
  error.error === 'Invalid client request') {
35162
- // console.error('[AuthInterceptor] Invalid client request (400)');
35211
+ this.dlog('400 Invalid client request su', request.url, '-> LOGOUT immediato');
35163
35212
  this.loginservice.logout();
35164
35213
  return throwError(error);
35165
35214
  }
35166
35215
  if (error instanceof HttpErrorResponse && error.status === 401) {
35216
+ this.dlog('401 su', request.url, '-> handle401Error');
35167
35217
  return this.handle401Error(request, next);
35168
35218
  }
35169
35219
  else {
@@ -35181,35 +35231,43 @@ class AuthHttpRequestInterceptor {
35181
35231
  handle401Error(request, next) {
35182
35232
  const refreshToken = localStorage.getItem(this.appService.COMPANY_KEY + 'refreshToken');
35183
35233
  const token = localStorage.getItem(this.appService.COMPANY_KEY + 'token');
35234
+ this.dlog('handle401Error url=', request.url, 'hasToken=', !!token, 'hasRefresh=', !!refreshToken, 'isRefreshing=', this.isRefreshing);
35184
35235
  if (!token || !refreshToken) {
35236
+ this.dlog('>> SKIP refresh: token o refreshToken mancante -> replay senza refresh');
35185
35237
  return next.handle(request);
35186
35238
  }
35187
35239
  if (!this.isRefreshing) {
35188
35240
  this.isRefreshing = true;
35189
35241
  this.refreshTokenSubject.next(null);
35242
+ this.dlog('>> CHIAMO token/refresh ...');
35190
35243
  return this.refreshToken(token, refreshToken).pipe(switchMap((res) => {
35191
35244
  this.isRefreshing = false;
35192
35245
  const newToken = localStorage.getItem(this.appService.COMPANY_KEY + 'token');
35246
+ this.dlog('token/refresh risposta=', res, 'newToken presente=', !!newToken);
35193
35247
  // refresh fallito (ND / risposta non valida): NON ritentare col token
35194
35248
  // stantio, sblocca i waiter con il sentinel e fai logout pulito.
35195
35249
  if (!res ||
35196
35250
  (res.accessToken || 'ND') === 'ND' ||
35197
35251
  !newToken ||
35198
35252
  newToken === AuthHttpRequestInterceptor.REFRESH_FAILED) {
35253
+ this.dlog('>> REFRESH FALLITO -> LOGOUT');
35199
35254
  this.refreshTokenSubject.next(AuthHttpRequestInterceptor.REFRESH_FAILED);
35200
35255
  this.loginservice.logout();
35201
35256
  return throwError(() => new Error('Refresh token non valido'));
35202
35257
  }
35258
+ this.dlog('>> REFRESH OK -> ritento la request originale col nuovo token');
35203
35259
  this.refreshTokenSubject.next(newToken);
35204
35260
  return next.handle(this.addToken(request, newToken));
35205
35261
  }), catchError((error) => {
35206
35262
  this.isRefreshing = false;
35263
+ this.dlog('>> token/refresh ERRORE HTTP -> LOGOUT', error?.status, error?.message);
35207
35264
  this.refreshTokenSubject.next(AuthHttpRequestInterceptor.REFRESH_FAILED);
35208
35265
  this.loginservice.logout();
35209
35266
  return throwError(() => error);
35210
35267
  }));
35211
35268
  }
35212
35269
  else {
35270
+ this.dlog('>> refresh gia in corso: mi accodo (waiter)');
35213
35271
  return this.refreshTokenSubject.pipe(filter((t) => t != null), take(1), switchMap((jwt) => {
35214
35272
  // se il refresh in corso è fallito, fallisci anche tu invece di
35215
35273
  // ritentare col token vecchio (evita la raffica di 401)