@fluxhub/fluxhub-lib 19.0.218 → 19.0.220

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.
@@ -32000,10 +32000,13 @@ class win_select_level_v2 {
32000
32000
  this.toastr = toastr;
32001
32001
  this._tsr = _tsr;
32002
32002
  this.data = data;
32003
+ // Lo sfondo del pulsante e' fisso (#fafafa): un colore chiaro rende il testo o il
32004
+ // filetto invisibili. `color` di default vale #ededed su molte configurazioni, quindi
32005
+ // non basta il controllo "assente": va scartato anche se troppo chiaro.
32003
32006
  this.trans = data.map((v) => {
32004
- if (!v.color)
32007
+ if (!v.color || this.isLight(v.color))
32005
32008
  v.color = '#1e2755';
32006
- if (!v.color_font)
32009
+ if (!v.color_font || this.isLight(v.color_font))
32007
32010
  v.color_font = '#1e2755';
32008
32011
  return v;
32009
32012
  });
@@ -32020,6 +32023,21 @@ class win_select_level_v2 {
32020
32023
  * ("check"). Se manca lo stile assume "fa-solid". Gestisce anche i vecchi
32021
32024
  * valori FontAwesome 4 ("fa fa-check").
32022
32025
  */
32026
+ /**
32027
+ * true se il colore e' troppo chiaro per stare su #fafafa.
32028
+ * Luminanza percettiva (ITU-R BT.601): il verde pesa piu' del blu.
32029
+ */
32030
+ isLight(hex) {
32031
+ const h = (hex || '').replace('#', '').trim();
32032
+ if (h.length !== 3 && h.length !== 6)
32033
+ return false;
32034
+ const f = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
32035
+ const n = parseInt(f, 16);
32036
+ if (isNaN(n))
32037
+ return false;
32038
+ const r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255;
32039
+ return (0.299 * r + 0.587 * g + 0.114 * b) > 186;
32040
+ }
32023
32041
  iconClass(v) {
32024
32042
  const raw = (v || "").trim();
32025
32043
  if (!raw)
@@ -32027,8 +32045,11 @@ class win_select_level_v2 {
32027
32045
  // gia` una classe completa con lo stile (solid/brands/regular/light/thin/duotone/sharp)
32028
32046
  if (/\bfa-(solid|brands|regular|light|thin|duotone|sharp)\b/.test(raw))
32029
32047
  return raw;
32030
- // vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`
32031
- if (/\bfa\b/.test(raw))
32048
+ // vecchia sintassi FA4 "fa fa-check" -> usala cosi` com'e`.
32049
+ // NB: serve il token "fa" ISOLATO. Con /\bfa\b/ anche "fa-check" matchava (il '-' e'
32050
+ // un confine di parola), quindi tornava senza stile e FontAwesome 5+ non la rendeva:
32051
+ // nel dialog si vedeva un quadratino vuoto.
32052
+ if (/(^|\s)fa(\s|$)/.test(raw))
32032
32053
  return raw;
32033
32054
  // nome icona, con o senza prefisso "fa-" -> assume lo stile solid
32034
32055
  const name = raw.startsWith("fa-") ? raw : "fa-" + raw;
@@ -32073,7 +32094,7 @@ class win_select_level_v2 {
32073
32094
  [style.border-color]="app.background_color || '#ddd'"
32074
32095
  [style.border-left-color]="app.color"
32075
32096
  [style.background-color]="'#fafafa'"
32076
- [style.color]="app.color"
32097
+ [style.color]="app.color_font"
32077
32098
  (click)="sel(app)">
32078
32099
  <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
32079
32100
  <span>{{ app.description | translate }}</span>
@@ -32105,7 +32126,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
32105
32126
  [style.border-color]="app.background_color || '#ddd'"
32106
32127
  [style.border-left-color]="app.color"
32107
32128
  [style.background-color]="'#fafafa'"
32108
- [style.color]="app.color"
32129
+ [style.color]="app.color_font"
32109
32130
  (click)="sel(app)">
32110
32131
  <i *ngIf="app.icon && app.icon!=''" [ngClass]="iconClass(app.icon)" aria-hidden="true"></i>
32111
32132
  <span>{{ app.description | translate }}</span>
@@ -34394,6 +34415,17 @@ class FHWorkflowForm {
34394
34415
  this.after_task_change();
34395
34416
  if (after)
34396
34417
  after();
34418
+ // Avanzamento automatico. Sta QUI e non in close_task() perche' load_step_tasks
34419
+ // gira anche all'APERTURA del documento: se l'utente aveva chiuso l'ultimo task e
34420
+ // poi il dialog di scelta transizione con la X, il documento restava fermo con
34421
+ // tutti i task chiusi e senza pulsante Procedi -- bloccato. Riaprendolo, avanza.
34422
+ if (this.step_mode == 'T' &&
34423
+ this.tasks_all_done &&
34424
+ this.b_edit &&
34425
+ !this.b_saving &&
34426
+ !this.btnprocedi) {
34427
+ this.procedi();
34428
+ }
34397
34429
  },
34398
34430
  error: () => {
34399
34431
  this.b_tasks_loading = false;
@@ -34507,16 +34539,13 @@ class FHWorkflowForm {
34507
34539
  return;
34508
34540
  // Ricarico dal DB invece di aggiornare in locale: `locked` degli altri task
34509
34541
  // dipende da questo, e un altro utente puo' aver chiuso qualcosa nel frattempo.
34542
+ // L'avanzamento automatico lo decide load_step_tasks (vedi li'): se lo step avanza
34543
+ // ci pensa procedi() -> exec_wkf, che ricalcola lettori e notifiche sullo step di
34544
+ // destinazione, ed e' inutile (e sbagliato) notificare i task di uno step che
34545
+ // stiamo lasciando.
34510
34546
  this.load_step_tasks(() => {
34511
- if (this.tasks_all_done && this.b_edit) {
34512
- // Lo step avanza: ci pensa procedi() -> exec_wkf, che ricalcola lettori e
34513
- // notifiche sullo step di destinazione. Inutile (e sbagliato) notificare i
34514
- // task di uno step che stiamo lasciando.
34515
- this.procedi();
34516
- }
34517
- else {
34547
+ if (!this.tasks_all_done)
34518
34548
  this.notify_task_closed(task.uiid);
34519
- }
34520
34549
  });
34521
34550
  });
34522
34551
  return true;
@@ -35538,6 +35567,8 @@ class FHWorkflowTasksPanel {
35538
35567
  locked_label = 'Si sblocca al completamento di';
35539
35568
  reopen_confirm = 'Vuoi riaprire questa attività?';
35540
35569
  note_label = 'Nota di chiusura';
35570
+ last_task_title = 'Ultima attività dello step';
35571
+ last_task_confirm = "Questa è l'ultima attività obbligatoria dello step: concludendola la pratica avanzerà. Vuoi procedere?";
35541
35572
  // Valori pre-calcolati: MAI getter dinamici nel template (un getter che costruisce
35542
35573
  // array darebbe a *ngFor un riferimento nuovo a ogni change detection).
35543
35574
  tasks = [];
@@ -35623,6 +35654,29 @@ class FHWorkflowTasksPanel {
35623
35654
  this.toastr.error(errs.join(' - '), t.title);
35624
35655
  return;
35625
35656
  }
35657
+ // Ultima attivita' obbligatoria rimasta aperta: chiuderla fa avanzare la pratica,
35658
+ // e l'avanzamento non e' annullabile. Chiediamo conferma PRIMA di chiudere: se
35659
+ // l'utente dice no, il task resta aperto e non succede nulla.
35660
+ if (this.isLastRequiredOpen(t)) {
35661
+ const ref = this.dialog.open(FHWinConfirmComponent, {
35662
+ disableClose: true,
35663
+ data: { title_dialog: this.last_task_title, msg_dialog: this.last_task_confirm },
35664
+ });
35665
+ ref.afterClosed().subscribe((ok) => {
35666
+ if (ok)
35667
+ this.doClose(t);
35668
+ });
35669
+ return;
35670
+ }
35671
+ this.doClose(t);
35672
+ }
35673
+ /** L'unico task obbligatorio ancora aperto e' proprio questo? */
35674
+ isLastRequiredOpen(t) {
35675
+ if (t.required !== 1)
35676
+ return false;
35677
+ return this.tasks.every((x) => x.required !== 1 || x.stato === 1 || x.uiid === t.uiid);
35678
+ }
35679
+ doClose(t) {
35626
35680
  if (t.note_required === 1) {
35627
35681
  const ref = this.dialog.open(FHWinAskBigTextComponent, {
35628
35682
  width: '600px',
@@ -35649,7 +35703,7 @@ class FHWorkflowTasksPanel {
35649
35703
  });
35650
35704
  }
35651
35705
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FHWorkflowTasksPanel, deps: [{ token: i1$2.MatDialog }, { token: i3$1.ToastrService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
35652
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label" }, ngImport: i0, template: `
35706
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: FHWorkflowTasksPanel, isStandalone: true, selector: "FHWorkflowTasksPanel", inputs: { dt_agg: "dt_agg", is_supervisor: "is_supervisor", title: "title", claim_label: "claim_label", release_label: "release_label", force_release_label: "force_release_label", in_charge_label: "in_charge_label", in_charge_you_label: "in_charge_you_label", claim_lost_label: "claim_lost_label", close_label: "close_label", reopen_label: "reopen_label", optional_label: "optional_label", closed_by_label: "closed_by_label", empty_label: "empty_label", no_role_label: "no_role_label", after_label: "after_label", locked_label: "locked_label", reopen_confirm: "reopen_confirm", note_label: "note_label", last_task_title: "last_task_title", last_task_confirm: "last_task_confirm" }, ngImport: i0, template: `
35653
35707
  <div class="fh-tasks" *ngIf="dt_agg && dt_agg.step_mode === 'T'">
35654
35708
  <div class="fh-tasks-head">
35655
35709
  <span class="material-symbols-outlined">checklist</span>
@@ -35925,6 +35979,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
35925
35979
  type: Input
35926
35980
  }], note_label: [{
35927
35981
  type: Input
35982
+ }], last_task_title: [{
35983
+ type: Input
35984
+ }], last_task_confirm: [{
35985
+ type: Input
35928
35986
  }] } });
35929
35987
 
35930
35988
  class AuthHttpRequestInterceptor {