@fluxhub/fluxhub-lib 19.0.241 → 19.0.242

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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Tipo di dato di un campo passato a `FHWorkflowForm.getfieldvalues()`.
3
+ *
4
+ * Stesso set di `QParam.types` (vedi QParam.ts): i due contratti descrivono
5
+ * la stessa cosa a due passi diversi della stessa pipeline (getfieldvalues()
6
+ * costruisce i campi, save_agg() li travasa dentro un QParam per la insert_aggiuntivi).
7
+ * 'cblob' non viene stringificato da save_agg() (nessun ramo per lui nell'if-chain):
8
+ * il valore passa cosi' com'e', quindi qui e' vincolato a string come gli altri
9
+ * campi testuali.
10
+ */
11
+ export type WkfFieldType = 'string' | 'int' | 'decimal' | 'date' | 'datetime' | 'boolean' | 'cblob';
12
+ /**
13
+ * Un campo da salvare tramite `FHWorkflowForm.getfieldvalues()`.
14
+ *
15
+ * `values` accetta il valore nativo (Date per date/datetime, number per
16
+ * int/decimal, boolean per boolean) OPPURE una stringa gia' pronta: entrambe
17
+ * le forme sono legittime perche' e' esattamente cio' che `save_agg()` gestisce
18
+ * gia' oggi (vedi wkf-form-data.ts, il ramo `if (arr[i].types == '...')` per
19
+ * ciascun tipo chiama uti_s.sql_date/sql_date_time o fa un cast a stringa, e
20
+ * se il valore era gia' una stringa nel formato giusto la passa cosi' com'e').
21
+ * `| null` copre i campi non valorizzati (save_agg() li manda come 'dbnull').
22
+ *
23
+ * Discriminato su `types`: assegnare `values: true` a un campo `types: 'datetime'`
24
+ * e' un errore di compilazione. Non e' un vincolo nuovo, e' quello che
25
+ * save_agg() richiede gia' silenziosamente a runtime.
26
+ */
27
+ export type WkfFieldValue = {
28
+ types: 'string' | 'cblob';
29
+ names: string;
30
+ values: string | null;
31
+ } | {
32
+ types: 'int' | 'decimal';
33
+ names: string;
34
+ values: number | string | null;
35
+ } | {
36
+ types: 'boolean';
37
+ names: string;
38
+ values: boolean | string | null;
39
+ } | {
40
+ types: 'date' | 'datetime';
41
+ names: string;
42
+ values: Date | string | null;
43
+ };
44
+ /**
45
+ * Costruisce un WkfFieldValue, con `values` vincolato al ramo giusto in base
46
+ * al `types` passato (overload esplicito, non un generico con `Extract<...>`:
47
+ * quella via distribuisce male su un discriminated union quando il generico
48
+ * non e' ancora risolto a un literal, e collassa il parametro a `never` --
49
+ * provato e scartato).
50
+ *
51
+ * Pensato per rimpiazzare il pattern storico
52
+ *
53
+ * o = new Object();
54
+ * o.types = 'boolean';
55
+ * o.names = 'verifica_tecnico';
56
+ * o.values = this.m_obj.verifica_tecnico;
57
+ * p.push(o);
58
+ *
59
+ * con una riga sola, tipizzata:
60
+ *
61
+ * p.push(wkfField('boolean', 'verifica_tecnico', this.m_obj.verifica_tecnico));
62
+ */
63
+ export declare function wkfField(types: 'string' | 'cblob', names: string, values: string | null): WkfFieldValue;
64
+ export declare function wkfField(types: 'int' | 'decimal', names: string, values: number | string | null): WkfFieldValue;
65
+ export declare function wkfField(types: 'boolean', names: string, values: boolean | string | null): WkfFieldValue;
66
+ export declare function wkfField(types: 'date' | 'datetime', names: string, values: Date | string | null): WkfFieldValue;
@@ -2,6 +2,7 @@ import { EventEmitter } from '@angular/core';
2
2
  import { MatDialog } from '@angular/material/dialog';
3
3
  import { ActivatedRoute, Router } from '@angular/router';
4
4
  import { TranslateService } from '@ngx-translate/core';
5
+ import { WkfFieldValue } from '../models/WkfFieldValue';
5
6
  import { AppService } from '../services/app.service';
6
7
  import { FileService } from '../services/dofile.service';
7
8
  import { QueryService } from '../services/doquery.service';
@@ -272,7 +273,19 @@ export declare abstract class FHWorkflowForm {
272
273
  b_valid: boolean;
273
274
  abstract reset_form(v_t: string): void;
274
275
  abstract alert(v_t: string, t: number): void;
275
- abstract getfieldvalues(): Array<any>;
276
+ /**
277
+ * Campi da persistere sul documento al salvataggio (usati sia da save_agg()
278
+ * che da back() per il diff "modifiche non salvate"). Override obbligatorio
279
+ * nel form concreto: la libreria non conosce lo schema della tabella dati
280
+ * del portale.
281
+ *
282
+ * Il tipo di ritorno e' Array<WkfFieldValue> (vedi models/WkfFieldValue.ts)
283
+ * ma un override che dichiara ancora `Array<any>` compila lo stesso: `any`
284
+ * e' compatibile in entrambe le direzioni, quindi questo irrigidimento non
285
+ * rompe nessun form gia' scritto. E' un tipo a cui i form esistenti possono
286
+ * migrare gradualmente, campo per campo, non un vincolo imposto subito.
287
+ */
288
+ abstract getfieldvalues(): Array<WkfFieldValue>;
276
289
  abstract ck_field(op?: string): boolean;
277
290
  abstract update_status(b_edit: boolean | null, b_respingi_button: boolean | null, b_incarico: boolean | null, b_assengna_a: boolean | null, n_avv: number): any;
278
291
  abstract wkf_rule(l: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxhub/fluxhub-lib",
3
- "version": "19.0.241",
3
+ "version": "19.0.242",
4
4
  "description": "FluxHub components and workflow library",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
package/public-api.d.ts CHANGED
@@ -85,6 +85,7 @@ export { QGParam } from './lib/models/QGParam';
85
85
  export { QGResult } from './lib/models/QGResult';
86
86
  export { QParam } from './lib/models/QParam';
87
87
  export { QResult } from './lib/models/QResult';
88
+ export { WkfFieldType, WkfFieldValue, wkfField } from './lib/models/WkfFieldValue';
88
89
  export { AppService } from './lib/services/app.service';
89
90
  export { AppMakerService } from './lib/services/app-maker.service';
90
91
  export { FileService } from './lib/services/dofile.service';