@fluxhub/fluxhub-lib 19.0.241 → 19.0.243
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,69 @@
|
|
|
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 | undefined` copre i campi non valorizzati (save_agg() li manda
|
|
22
|
+
* come 'dbnull' con `== null`, che in JS e' vero per entrambi): `undefined`
|
|
23
|
+
* non e' un caso raro, e' cio' che produce `this.qualcheControllo?.getValue()`
|
|
24
|
+
* su un campo non ancora renderizzato, pattern usatissimo nei form concreti.
|
|
25
|
+
*
|
|
26
|
+
* Discriminato su `types`: assegnare `values: true` a un campo `types: 'datetime'`
|
|
27
|
+
* e' un errore di compilazione. Non e' un vincolo nuovo, e' quello che
|
|
28
|
+
* save_agg() richiede gia' silenziosamente a runtime.
|
|
29
|
+
*/
|
|
30
|
+
export type WkfFieldValue = {
|
|
31
|
+
types: 'string' | 'cblob';
|
|
32
|
+
names: string;
|
|
33
|
+
values: string | null | undefined;
|
|
34
|
+
} | {
|
|
35
|
+
types: 'int' | 'decimal';
|
|
36
|
+
names: string;
|
|
37
|
+
values: number | string | null | undefined;
|
|
38
|
+
} | {
|
|
39
|
+
types: 'boolean';
|
|
40
|
+
names: string;
|
|
41
|
+
values: boolean | string | null | undefined;
|
|
42
|
+
} | {
|
|
43
|
+
types: 'date' | 'datetime';
|
|
44
|
+
names: string;
|
|
45
|
+
values: Date | string | null | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Costruisce un WkfFieldValue, con `values` vincolato al ramo giusto in base
|
|
49
|
+
* al `types` passato (overload esplicito, non un generico con `Extract<...>`:
|
|
50
|
+
* quella via distribuisce male su un discriminated union quando il generico
|
|
51
|
+
* non e' ancora risolto a un literal, e collassa il parametro a `never` --
|
|
52
|
+
* provato e scartato).
|
|
53
|
+
*
|
|
54
|
+
* Pensato per rimpiazzare il pattern storico
|
|
55
|
+
*
|
|
56
|
+
* o = new Object();
|
|
57
|
+
* o.types = 'boolean';
|
|
58
|
+
* o.names = 'verifica_tecnico';
|
|
59
|
+
* o.values = this.m_obj.verifica_tecnico;
|
|
60
|
+
* p.push(o);
|
|
61
|
+
*
|
|
62
|
+
* con una riga sola, tipizzata:
|
|
63
|
+
*
|
|
64
|
+
* p.push(wkfField('boolean', 'verifica_tecnico', this.m_obj.verifica_tecnico));
|
|
65
|
+
*/
|
|
66
|
+
export declare function wkfField(types: 'string' | 'cblob', names: string, values: string | null | undefined): WkfFieldValue;
|
|
67
|
+
export declare function wkfField(types: 'int' | 'decimal', names: string, values: number | string | null | undefined): WkfFieldValue;
|
|
68
|
+
export declare function wkfField(types: 'boolean', names: string, values: boolean | string | null | undefined): WkfFieldValue;
|
|
69
|
+
export declare function wkfField(types: 'date' | 'datetime', names: string, values: Date | string | null | undefined): 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
|
-
|
|
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
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';
|