@esfaenza/parameters 15.2.32 → 16.0.1
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.
- package/{esm2020 → esm2022}/lib/es_parameters.component.loc.mjs +4 -4
- package/esm2022/lib/es_parameters.component.mjs +406 -0
- package/{esm2020 → esm2022}/lib/es_parameters.module.mjs +11 -11
- package/{fesm2020 → fesm2022}/esfaenza-parameters.mjs +23 -23
- package/{fesm2020 → fesm2022}/esfaenza-parameters.mjs.map +1 -1
- package/lib/es_parameters.component.d.ts +1 -1
- package/package.json +21 -27
- package/esm2020/lib/es_parameters.component.mjs +0 -406
- package/fesm2015/esfaenza-parameters.mjs +0 -519
- package/fesm2015/esfaenza-parameters.mjs.map +0 -1
- /package/{esm2020 → esm2022}/esfaenza-parameters.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/models/GenericParameter.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/models/GenericParameterGroup.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, forwardRef, Component, ViewEncapsulation, Input, NgModule } from '@angular/core';
|
|
3
|
-
import * as i3 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import * as i4 from '@angular/forms';
|
|
6
|
-
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
|
-
import * as i5 from '@esfaenza/forms-and-validations';
|
|
8
|
-
import { FormsAndValidationsModule } from '@esfaenza/forms-and-validations';
|
|
9
|
-
import * as i2 from '@esfaenza/localizations';
|
|
10
|
-
import { LocalizationService, LocalizationModule } from '@esfaenza/localizations';
|
|
11
|
-
import { of } from 'rxjs';
|
|
12
|
-
import * as i1 from '@esfaenza/extensions';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Classe di localizzazione per il componente **EsParametersComponent**
|
|
16
|
-
*/
|
|
17
|
-
class EsParametersLoc extends LocalizationService {
|
|
18
|
-
/**
|
|
19
|
-
* Costruttore
|
|
20
|
-
*
|
|
21
|
-
* @ignore
|
|
22
|
-
*/
|
|
23
|
-
constructor(injector) {
|
|
24
|
-
super(injector);
|
|
25
|
-
super.set("it->en", "Seleziona", ["Select"]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
EsParametersLoc.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersLoc, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
29
|
-
EsParametersLoc.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersLoc });
|
|
30
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersLoc, decorators: [{
|
|
31
|
-
type: Injectable
|
|
32
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Classe che rappresenta un gruppo di parametri generico
|
|
36
|
-
*/
|
|
37
|
-
class GenericParameterGroup {
|
|
38
|
-
/**
|
|
39
|
-
* Costruttore
|
|
40
|
-
* @param {string} groupName Descrizione del gruppo che fa anche da id
|
|
41
|
-
* @param {number} order ordine del gruppo
|
|
42
|
-
*/
|
|
43
|
-
constructor(groupName, order) {
|
|
44
|
-
this.groupName = groupName;
|
|
45
|
-
this.order = order;
|
|
46
|
-
this.parameters = [];
|
|
47
|
-
this.subgroups = [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Angular
|
|
52
|
-
/** Componente che permette di graficare una lista di **GenericParameter** come Input in base al loro tipo specifico */
|
|
53
|
-
class EsParametersComponent {
|
|
54
|
-
/** Permette di settare in una volta solo gli input **LabelColWidth** e **InputColWidth**, basta scriverlo con la sintassi "X Y" */
|
|
55
|
-
set LabelInputRatio(input) {
|
|
56
|
-
var ratio = input.split(/\s/);
|
|
57
|
-
this.LabelColWidth = parseInt(ratio[0]);
|
|
58
|
-
this.InputColWidth = parseInt(ratio[1]);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Costruttore
|
|
62
|
-
*
|
|
63
|
-
* @ignore
|
|
64
|
-
*/
|
|
65
|
-
constructor(utiExts, lc, cdr, inj, dates) {
|
|
66
|
-
this.utiExts = utiExts;
|
|
67
|
-
this.lc = lc;
|
|
68
|
-
this.cdr = cdr;
|
|
69
|
-
this.inj = inj;
|
|
70
|
-
this.dates = dates;
|
|
71
|
-
/** Indica se si lavora a singolo parametro forzato dentro un array for the glory of satan */
|
|
72
|
-
this.SingleParameterMode = false;
|
|
73
|
-
/**
|
|
74
|
-
* Pipeline di Angular
|
|
75
|
-
*
|
|
76
|
-
* @ignore
|
|
77
|
-
*/
|
|
78
|
-
this.propagateChange = (_) => { };
|
|
79
|
-
/** Indica che il parametro deve essere in modalità display */
|
|
80
|
-
this.DisplayMode = false;
|
|
81
|
-
/** Indica che il parametro (In Display mode!!) non appare se vuoto. In più, se tutti sono vuoti, fa vedere una bella card "non ci sono parametri presenti" */
|
|
82
|
-
this.HideEmpty = false;
|
|
83
|
-
/** Indica che l'ultimo parametro non deve avere margine in fondo */
|
|
84
|
-
this.LastParameterNoMargin = false;
|
|
85
|
-
/** col-md-X per la label */
|
|
86
|
-
this.LabelColWidth = 4;
|
|
87
|
-
/** col-md-X per l'input */
|
|
88
|
-
this.InputColWidth = 8;
|
|
89
|
-
/** Input a cui collegare la variabile **submitted** del form all'interno del quale viene utilizzato questo componente */
|
|
90
|
-
this.submitted = false;
|
|
91
|
-
/** Valore da mostrare qualora non fossero ancora ricevuti i **Parameters** da mostrare */
|
|
92
|
-
this.EmptyMessage = "";
|
|
93
|
-
/** Permette di rimuovere i parametri dalla lista cliccando sulla X davanti alla Label */
|
|
94
|
-
this.Removal = false;
|
|
95
|
-
/** Indica se i componenti di Input generati sono Readonly o no */
|
|
96
|
-
this.Readonly = false;
|
|
97
|
-
/** Indica il formato lista che dev'essere utilizzato */
|
|
98
|
-
this.ListFormat = 'Array';
|
|
99
|
-
/** Form che utilizza il componente. Fondamentale collegarlo se si vogliono le validazioni sul submit */
|
|
100
|
-
this.Form = null;
|
|
101
|
-
/** Quando utilizza un sottocomponente autocomplete abilita o disabilita il reset dell'input per ogni selezione */
|
|
102
|
-
this.AutocompleteHideChoicesOnSelection = false;
|
|
103
|
-
/** Indica come deve funzionare la multiselect */
|
|
104
|
-
this.MultiselectMode = 'CommaSeparated';
|
|
105
|
-
this.AllParametersEmpty = false;
|
|
106
|
-
this.Initialized = false;
|
|
107
|
-
}
|
|
108
|
-
ngOnInit() {
|
|
109
|
-
// Qui gli input dovrebbero essere settati. Alcuni form-roba non prendono bene i cambi di input
|
|
110
|
-
// Non sta funzionando come speravo... da rivedere
|
|
111
|
-
this.Initialized = true;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Pipeline di Angular
|
|
115
|
-
*
|
|
116
|
-
* @ignore
|
|
117
|
-
*/
|
|
118
|
-
writeValue(obj) {
|
|
119
|
-
if (!obj)
|
|
120
|
-
return;
|
|
121
|
-
if (!Array.isArray(obj))
|
|
122
|
-
this.SingleParameterMode = true;
|
|
123
|
-
this.Parameters = Array.isArray(obj) ? obj : [obj];
|
|
124
|
-
this.ParametersCache = {};
|
|
125
|
-
this.Parameters.forEach(t => {
|
|
126
|
-
var _a, _b;
|
|
127
|
-
this.ParametersCache[t.id] = t;
|
|
128
|
-
if (!t.typecode && !t.type)
|
|
129
|
-
console.warn("Non è stato specificato né un type né un typecode");
|
|
130
|
-
if (t.typecode && !t.type)
|
|
131
|
-
t.type = this.utiExts.getJsTypeFromTypeCode(t.typecode);
|
|
132
|
-
if (t.typecode && t.type != this.utiExts.getJsTypeFromTypeCode(t.typecode))
|
|
133
|
-
console.warn(`Rilevate inconsistenze fra il Tipo ${t.type} e il Tipo ${this.utiExts.getJsTypeFromTypeCode(t.typecode)} calcolato da TypeCode ${t.typecode} per il parametro ${t.id}`);
|
|
134
|
-
if (t.type == "boolean")
|
|
135
|
-
t.value = ((_b = (_a = t.value) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === "true";
|
|
136
|
-
if (t.enumtype || t.dicttype)
|
|
137
|
-
t.type = 'enum';
|
|
138
|
-
// Valore valido ma modalità di utilizzo a CommaSeparated, devo assicurarmi di riemettere la versione con la stringa
|
|
139
|
-
if (t.type == 'enum' && this.ListFormat == 'CommaSeparated' && t.multienum && t.value && Array.isArray(t.value))
|
|
140
|
-
this.changed();
|
|
141
|
-
// Aggiusto le modalità di funzionamento dei parametri lista. Che internamente funzionano sempre con una lista di valori
|
|
142
|
-
if (t.type == 'enum' && this.ListFormat == 'CommaSeparated' && t.multienum && t.value && !Array.isArray(t.value))
|
|
143
|
-
t.value = t.value ? t.value.split(',').map(t => t.trim()) : [];
|
|
144
|
-
});
|
|
145
|
-
this.AllParametersEmpty = this.Parameters.every(t => !t.value);
|
|
146
|
-
this.reviewParametersBindings();
|
|
147
|
-
this.generateGroups();
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Metodo che si occupa di creare e ordinare i gruppi dei parametri
|
|
151
|
-
*/
|
|
152
|
-
generateGroups() {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
this.Groups = [];
|
|
155
|
-
if (((_a = this.Parameters) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
156
|
-
this.Parameters.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
157
|
-
// Ciclo tutti i parametri
|
|
158
|
-
for (let i = 0; this.Parameters.length > i; i++) {
|
|
159
|
-
let par = this.Parameters[i];
|
|
160
|
-
let parGroupName = (_b = par.group) !== null && _b !== void 0 ? _b : "";
|
|
161
|
-
let groupOrder = par.group ? par.order : -1;
|
|
162
|
-
// Se il gruppo non esiste, lo aggiungo
|
|
163
|
-
if (!this.Groups.some(x => x.groupName == parGroupName)) {
|
|
164
|
-
this.Groups.push(new GenericParameterGroup(parGroupName, groupOrder));
|
|
165
|
-
}
|
|
166
|
-
// Inserisco il parametro dentro al suo gruppo
|
|
167
|
-
this.Groups.find(g => g.groupName == parGroupName).parameters.push(par);
|
|
168
|
-
}
|
|
169
|
-
// Gestione sottogruppi
|
|
170
|
-
let subgroups = this.Groups.filter(group => group.groupName.includes('§'));
|
|
171
|
-
for (let _; subgroups.length > 0; () => { }) {
|
|
172
|
-
// Recupero la lista di gruppi che hanno sottogruppi
|
|
173
|
-
// Per convenzione, nel nome contengono "§"
|
|
174
|
-
this.tryToAddSubgroups(subgroups);
|
|
175
|
-
subgroups = this.Groups.filter(group => group.groupName.includes('§'));
|
|
176
|
-
}
|
|
177
|
-
this.Groups.sort((a, b) => a.order < b.order ? -1 : 1);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Metodo che si occupa di creare e ordinare i sottogruppi dei parametri
|
|
182
|
-
*/
|
|
183
|
-
tryToAddSubgroups(subgroups) {
|
|
184
|
-
var _a;
|
|
185
|
-
for (let i = 0; subgroups.length > i; i++) {
|
|
186
|
-
let sub = subgroups[i];
|
|
187
|
-
// Ottengo un lista con la gerarchia dei gruppi, in ordine
|
|
188
|
-
let groupsParentHierarchy = (_a = sub.groupName.split('§')) !== null && _a !== void 0 ? _a : [];
|
|
189
|
-
// Recupero il gruppo padre
|
|
190
|
-
let parentGroupName = sub.groupName.replace(`§${groupsParentHierarchy[groupsParentHierarchy.length - 1]}`, ``);
|
|
191
|
-
// Se il gruppo padre non esiste, lo aggiungo
|
|
192
|
-
if (!this.Groups.some(x => x.groupName == parentGroupName)) {
|
|
193
|
-
this.Groups.push(new GenericParameterGroup(parentGroupName, sub.order));
|
|
194
|
-
}
|
|
195
|
-
// Rimuovo dal nome del gruppo l'informazione sul padre (Sistemando anche l'etichetta)
|
|
196
|
-
// e lo aggiungo ai sottogruppi del padre
|
|
197
|
-
sub.groupName = sub.groupName.replace(`${parentGroupName}§`, '');
|
|
198
|
-
let parentGroup = this.Groups.find(x => x.groupName == parentGroupName);
|
|
199
|
-
if (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.subgroups.some(s => s.groupName == sub.groupName)) {
|
|
200
|
-
let target = parentGroup.subgroups.find(f => f.groupName == sub.groupName);
|
|
201
|
-
sub.parameters.map(p => target.parameters.push(p));
|
|
202
|
-
sub.subgroups.map(s => target.subgroups.push(s));
|
|
203
|
-
target.order = sub.order < target.order ? sub.order : target.order;
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.subgroups.push(sub);
|
|
207
|
-
}
|
|
208
|
-
// Rimuovo il sottogruppo gruppo dalla lista
|
|
209
|
-
this.Groups.splice(this.Groups.indexOf(sub), 1);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Pipeline di Angular
|
|
214
|
-
*
|
|
215
|
-
* @ignore
|
|
216
|
-
*/
|
|
217
|
-
registerOnChange(fn) { this.propagateChange = fn; }
|
|
218
|
-
/**
|
|
219
|
-
* Pipeline di Angular
|
|
220
|
-
*
|
|
221
|
-
* @ignore
|
|
222
|
-
*/
|
|
223
|
-
registerOnTouched(fn) { }
|
|
224
|
-
/**
|
|
225
|
-
* Metodo che si occupa di gestire il modello in uscita e propagarlo sul binding ngModel
|
|
226
|
-
*/
|
|
227
|
-
changed() {
|
|
228
|
-
if (!this.Parameters)
|
|
229
|
-
return;
|
|
230
|
-
if (!this.Groups)
|
|
231
|
-
this.generateGroups();
|
|
232
|
-
// Se ci sono delle modifiche ai binding potrebbero essere cambiati i required. Ricreo tutti i componenti e ri-idrato la cache dei parametri
|
|
233
|
-
var changes = this.reviewParametersBindings();
|
|
234
|
-
if (changes.length > 0) {
|
|
235
|
-
// In base ai binding cambiati devo trovare tutti i parametri che han subito modifiche strutturali (visibilità, obbligatorietà)
|
|
236
|
-
// distruggerli e ricrearli in modo che i binding lato html si aggiornino di conseguenza.
|
|
237
|
-
// 1: Faccio una copia del parametro corrente
|
|
238
|
-
// 2: Trovo la sua posizione all'interno dei gruppi e lo sostituisco con la copia
|
|
239
|
-
// 3: Aggiorno la lista dei parametri e la sua cache in modo da puntare all'oggetto nuovo
|
|
240
|
-
changes.forEach(ch => {
|
|
241
|
-
let index = this.Parameters.findIndex(t => t.id == ch);
|
|
242
|
-
let parameterCopy = this.utiExts.deepClone(this.Parameters[index]);
|
|
243
|
-
let parameterRefFixed = false;
|
|
244
|
-
for (let ig = 0; ig < this.Groups.length; ig++) {
|
|
245
|
-
var g = this.Groups[ig];
|
|
246
|
-
for (let ip = 0; ip < g.parameters.length; ip++) {
|
|
247
|
-
var p = g.parameters[ip];
|
|
248
|
-
if (p === this.Parameters[index]) {
|
|
249
|
-
this.Groups[ig].parameters[ip] = parameterCopy;
|
|
250
|
-
parameterRefFixed = true;
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
if (parameterRefFixed)
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
this.Parameters[index] = parameterCopy;
|
|
258
|
-
this.ParametersCache[ch] = this.Parameters[index];
|
|
259
|
-
this.cdr.markForCheck();
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
var ParametersClone = this.utiExts.deepClone(this.Parameters);
|
|
263
|
-
// Aggiusto le modalità di funzionamento dei parametri lista. Che internamente funzionano sempre con una lista di valori
|
|
264
|
-
ParametersClone === null || ParametersClone === void 0 ? void 0 : ParametersClone.forEach(t => {
|
|
265
|
-
if (t.type == "enum" && this.ListFormat == 'CommaSeparated' && t.multienum && t.value && Array.isArray(t.value))
|
|
266
|
-
t.value = t.value.join(',');
|
|
267
|
-
});
|
|
268
|
-
this.propagateChange(this.SingleParameterMode ? ParametersClone[0] : ParametersClone);
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Rimuove il parametro selezionato e propaga il modello
|
|
272
|
-
*
|
|
273
|
-
* @param {GenericParameter} par Parametro da rimuovere
|
|
274
|
-
*/
|
|
275
|
-
removeParameter(par) {
|
|
276
|
-
this.Parameters.splice(this.Parameters.indexOf(par), 1);
|
|
277
|
-
this.changed();
|
|
278
|
-
}
|
|
279
|
-
GenerateParameterGroups() {
|
|
280
|
-
let Groups = [];
|
|
281
|
-
this.Parameters.forEach(param => {
|
|
282
|
-
Groups.push({ id: param.id, groups: param.group.split("§"), order: param.order });
|
|
283
|
-
});
|
|
284
|
-
let GroupedGroups = Groups.reduce((r, a) => {
|
|
285
|
-
var _a;
|
|
286
|
-
let firstGroupId = ((_a = a.groups) === null || _a === void 0 ? void 0 : _a.length) > 0 ? a.groups[0] : "";
|
|
287
|
-
r[firstGroupId] = [...r[firstGroupId] || [], a];
|
|
288
|
-
return r;
|
|
289
|
-
}, {});
|
|
290
|
-
console.log(GroupedGroups);
|
|
291
|
-
// Ciclo del risultato, aggiungendo i gruppi al modello
|
|
292
|
-
// Per ogni gruppo che aggiungo, assegno i parametri in ordine
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Rivede i bindings dei parametri in base a loro eventuali espressioni di controllo
|
|
296
|
-
*
|
|
297
|
-
* @returns {string[]} lista con gli id dei parametri che sono stati modificati
|
|
298
|
-
*/
|
|
299
|
-
reviewParametersBindings() {
|
|
300
|
-
let changes = [];
|
|
301
|
-
for (let i = 0; i < this.Parameters.length; i++) {
|
|
302
|
-
var p = this.Parameters[i];
|
|
303
|
-
if (p.requiredexp) {
|
|
304
|
-
let prevReq = p.required;
|
|
305
|
-
p.required = this.evaluate(p.requiredexp);
|
|
306
|
-
if (prevReq != p.required)
|
|
307
|
-
changes.push(p.id);
|
|
308
|
-
}
|
|
309
|
-
if (p.visibleexp) {
|
|
310
|
-
let prevVisi = p.visible;
|
|
311
|
-
p.visible = this.evaluate(p.visibleexp);
|
|
312
|
-
if (prevVisi != p.visible)
|
|
313
|
-
changes.push(p.id);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
return changes;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Valuta un'espressione in base ai parametri presenti nel modello attuale
|
|
320
|
-
*
|
|
321
|
-
* @param expr Espressione da valutare scritta nel formato (ripetibile) "ID (==|!=|<|>|>=|<=) (`valore` | null | true | false | XXX,XXX)" separato eventualmente da && ed ||
|
|
322
|
-
*
|
|
323
|
-
* @returns **true** se la condizione è verificata, **false** altrimenti
|
|
324
|
-
*/
|
|
325
|
-
evaluate(expr) {
|
|
326
|
-
var regex = /\s?([a-zA-Z0-9_-]+)\s?(!=|==|<|>|<=|>=)\s?(`[^`]+`|``|null|[0-9,]+|true|false)/gm;
|
|
327
|
-
var matches = [];
|
|
328
|
-
var finalExpr = expr;
|
|
329
|
-
while (matches = regex.exec(expr)) {
|
|
330
|
-
var fullMatch = matches[0].trim();
|
|
331
|
-
var id = matches[1].trim();
|
|
332
|
-
var operation = matches[2].trim();
|
|
333
|
-
let bValue = matches[3].trim().trim();
|
|
334
|
-
var value = matches[3].trim().trim().replace('`', '').replace('`', '');
|
|
335
|
-
finalExpr = finalExpr.replace(fullMatch, `this.checkValue('${id}', '${operation}', ${bValue == 'null' ? 'null' : `'${value}'`})`);
|
|
336
|
-
}
|
|
337
|
-
return eval(finalExpr);
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Restituisce l'operazione di comparazione fra un singolo valore di un parametro e un suo valore di confronto in base ad un operatore
|
|
341
|
-
* Richiamata da EVAL
|
|
342
|
-
*
|
|
343
|
-
* @param {string} key Chiave del parametro di cui verificare il valore
|
|
344
|
-
* @param {string} operator Operatore con cui verificare il valore: ==, !=, >, <, >=, <=
|
|
345
|
-
* @param {string} value Valore di confronto da utilizzare
|
|
346
|
-
*
|
|
347
|
-
* @returns **true** se la condizione è verificata, **false** altrimenti
|
|
348
|
-
*/
|
|
349
|
-
checkValue(key, operator, value) {
|
|
350
|
-
var rPar = this.ParametersCache[key];
|
|
351
|
-
try {
|
|
352
|
-
switch (rPar.type) {
|
|
353
|
-
case "string":
|
|
354
|
-
case "enum":
|
|
355
|
-
return eval(`"${this.defaultIfnullOrUndefined(rPar.value, ``)}" ${operator} "${this.defaultIfnullOrUndefined(value, ``)}"`);
|
|
356
|
-
case "boolean":
|
|
357
|
-
return eval(`${this.defaultIfnullOrUndefined(rPar.value, ``).toString()} ${operator} ${this.defaultIfnullOrUndefined(value, ``)}`);
|
|
358
|
-
case "number":
|
|
359
|
-
return eval(`${this.defaultIfnullOrUndefined(rPar.value, '""', true).replace(',', '.')} ${operator} ${this.defaultIfnullOrUndefined(value, '""', true).replace(',', '.')}`);
|
|
360
|
-
case "date":
|
|
361
|
-
let parDateConv = `this.dates.getDateConvertion("${rPar.value}")`;
|
|
362
|
-
let valDateConv = `this.dates.getDateConvertion("${value}")`;
|
|
363
|
-
switch (operator) {
|
|
364
|
-
case "==": return eval(`${parDateConv} == ${valDateConv} || (${parDateConv} != null && ${parDateConv}.isSame(${valDateConv}))`);
|
|
365
|
-
case "!=": return eval(`${parDateConv} != ${valDateConv} && ${parDateConv} != null && !${parDateConv}.isSame(${valDateConv})`);
|
|
366
|
-
case ">": return eval(`${parDateConv} != null && ${valDateConv} != null && ${parDateConv}.isAfter(${valDateConv})`);
|
|
367
|
-
case "<": return eval(`${parDateConv} != null && ${valDateConv} != null && ${parDateConv}.isBefore(${valDateConv})`);
|
|
368
|
-
case ">=": return eval(`${parDateConv} != null && ${valDateConv} != null && (${parDateConv}.isAfter(${valDateConv}) || ${parDateConv}?.isSame(${valDateConv}))`);
|
|
369
|
-
case "<=": return eval(`${parDateConv} != null && ${valDateConv} != null && (${parDateConv}.isBefore(${valDateConv}) || ${parDateConv}?.isSame(${valDateConv}))`);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
catch (error) {
|
|
374
|
-
console.error(error);
|
|
375
|
-
console.warn("Errori nella valutazione dell'espressione. Fallback a false");
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
378
|
-
throw `@esfaenza/parameters: Tipo parametro ${key} non riconosciuto: ${rPar.type}`;
|
|
379
|
-
}
|
|
380
|
-
/** @ignore */
|
|
381
|
-
defaultIfnullOrUndefined(item, dflt, emptyStringIsNull = false) {
|
|
382
|
-
if (item == null || item == undefined || item.toString() == 'null' || (emptyStringIsNull && item.toString() == ""))
|
|
383
|
-
return dflt;
|
|
384
|
-
return item;
|
|
385
|
-
}
|
|
386
|
-
/** @ignore */
|
|
387
|
-
getSource(parameter, search, byid) {
|
|
388
|
-
if (!this.AutoCompleteDataRetrieve) {
|
|
389
|
-
console.error("@forms-and-validations: funzione di dataretrieve non impostata per un parametro autocomplete");
|
|
390
|
-
return of([]);
|
|
391
|
-
}
|
|
392
|
-
else
|
|
393
|
-
return this.AutoCompleteDataRetrieve(parameter, search, byid);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
EsParametersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersComponent, deps: [{ token: i1.UtilityService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i1.DateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
397
|
-
EsParametersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: EsParametersComponent, selector: "es-parameters", inputs: { DisplayMode: "DisplayMode", HideEmpty: "HideEmpty", LastParameterNoMargin: "LastParameterNoMargin", LabelColWidth: "LabelColWidth", InputColWidth: "InputColWidth", submitted: "submitted", EmptyMessage: "EmptyMessage", Removal: "Removal", Readonly: "Readonly", ListFormat: "ListFormat", Form: "Form", AutocompleteHideChoicesOnSelection: "AutocompleteHideChoicesOnSelection", AutoCompleteDataRetrieve: "AutoCompleteDataRetrieve", MultiselectMode: "MultiselectMode", LabelInputRatio: "LabelInputRatio" }, providers: [
|
|
398
|
-
{ provide: LocalizationService, useClass: EsParametersLoc },
|
|
399
|
-
{
|
|
400
|
-
provide: NG_VALUE_ACCESSOR,
|
|
401
|
-
useExisting: forwardRef(() => EsParametersComponent),
|
|
402
|
-
multi: true
|
|
403
|
-
}
|
|
404
|
-
], ngImport: i0, template: "<div *ngIf=\"(!Parameters || Parameters.length == 0) && EmptyMessage\">\r\n <em>{{EmptyMessage}}</em>\r\n</div>\r\n\r\n<div *ngIf=\"Groups && Initialized\">\r\n <ng-container *ngTemplateOutlet=\"Temp; context: {item: { groups: Groups, isSubgroup: false }}\"></ng-container>\r\n</div>\r\n\r\n<ng-template #Temp let-item=\"item\">\r\n <ng-container *ngFor=\"let group of item.groups; let k = index\">\r\n <div [class.pars-subgroup]=\"item.isSubgroup\" [class.pars-group]=\"!item.isSubgroup\">\r\n <ng-container *ngTemplateOutlet=\"GroupsOrSubgroupsDisplay; context: { item: { group: group, index: k + (item.index ? ('_' + item.index) : ''), isSubgroup: item.isSubgroup }}\"></ng-container>\r\n <ng-container *ngIf=\"group.subgroups.length > 0\">\r\n <ng-container *ngTemplateOutlet=\"Temp; context: {item: { groups: group.subgroups, index: k + (item.index ? ('_' + item.index) : ''), isSubgroup: true }};\"></ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #GroupsOrSubgroupsDisplay let-item=\"item\">\r\n <div *ngIf=\"item.group && Initialized\">\r\n <div *ngIf=\"item.group.groupName\" [class.pars-group-title]=\"!item.isSubgroup\" [class.pars-subgroup-title]=\"item.isSubgroup\">\r\n {{item.group.groupName}}\r\n </div>\r\n <div *ngIf=\"item.group.parameters && item.group.parameters.length > 0\">\r\n <ng-container *ngFor=\"let par of item.group.parameters; let i= index; let last = last;\">\r\n <ng-container *ngIf=\"!DisplayMode || (!HideEmpty || (par.value))\">\r\n <div class=\"row form-group\" *ngIf=\"par.visible\" [class.app-margin-bottom-0]=\"LastParameterNoMargin && last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\"><span *ngIf=\"Removal\" class=\"fa fa-remove text-danger\" (click)=\"removeParameter(par)\"> </span>{{par.description}}{{par.required ? '*' : ''}}:</label>\r\n <!--Se Data-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'date'\">\r\n <form-date [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-date>\r\n </div>\r\n <!--Se stringa-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'string'\">\r\n <form-input [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-input>\r\n </div>\r\n <!--Se numero-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'number'\">\r\n <form-input [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator pattern=\"{{par.pattern || '^[+-]?[0-9]*[,]?[0-9]+$'}}\"></form-input>\r\n </div>\r\n <!--Se boolean-->\r\n <div class=\"col-md-{{InputColWidth}} m-t-5\" *ngIf=\"par.type == 'boolean'\">\r\n <form-checkbox [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-checkbox>\r\n </div>\r\n <!--Se enum single select-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && !par.multienum && !par.sourceapi\">\r\n <form-select [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator [Source]=\"par.enumvalues\"></form-select>\r\n </div>\r\n <!--Se enum multi select-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && !par.sourceapi\">\r\n <form-multiselect [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [UseJsonList]=\"MultiselectMode == 'JsonArray'\" [UseCommaSeparatedList]=\"MultiselectMode == 'CommaSeparated'\" [SelectLabel]=\"('Seleziona' | localize : lc) + '...'\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [Source]=\"par.enumvalues\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-multiselect>\r\n </div>\r\n <!--Se enum multiselect senza sorgente-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && !par.sourceapi && !par.enumvalues\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [HideChoicesOnSelection]=\"true\" [SelectLabel]=\"('Seleziona' | localize : lc) + '...'\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [UnboundMode]=\"true\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete> \r\n </div>\r\n <!--Se enum autocomplete-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && !par.multienum && par.sourceapi\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [SearchFunction]=\"getSource.bind(this, par)\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete>\r\n </div>\r\n <!--Se enum multiselect autocomplete-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && par.sourceapi\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [HideChoicesOnSelection]=\"AutocompleteHideChoicesOnSelection\" [Multi]=\"true\" [FormLayout]=\"false\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [SearchFunction]=\"getSource.bind(this, par)\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete>\r\n </div>\r\n <!--Se file-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'file'\">\r\n <form-file [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [ReadFile]=\"true\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.file\" name=\"{{item.index}}par{{i}}_{{par.id}}\" #validator></form-file>\r\n </div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n </ng-container>\r\n </ng-container>\r\n <div *ngIf=\"DisplayMode && AllParametersEmpty && HideEmpty\" class=\"card card-info app-padding-10 app-no-margin app-white-text\">\r\n Non è presente nulla da visualizzare\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: [".list-area{position:fixed}.pars-group-title{background:#ddd;margin-bottom:7px;padding:5px;text-transform:uppercase;font-weight:700;text-align:center;color:#333;font-size:13px}.pars-subgroup-title{font-weight:700;color:#333;font-size:16px}.pars-group{margin-left:0}.pars-subgroup{margin-left:15px}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i4.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i5.FormCheckboxComponent, selector: "form-checkbox", inputs: ["SliderMode"] }, { kind: "component", type: i5.FormDateComponent, selector: "form-date", inputs: ["JsDates"] }, { kind: "component", type: i5.FormInputComponent, selector: "form-input", inputs: ["Password"], outputs: ["onSuffixAction", "onPrefixAction"] }, { kind: "component", type: i5.FormSelectComponent, selector: "form-select", inputs: ["SelectLabel", "PlaceholderValue", "RequiredPlaceholder", "EmptyFieldValue", "ShowValidationSymbol", "OptionTemplate"] }, { kind: "component", type: i5.FormMultiSelectComponent, selector: "form-multiselect", inputs: ["SelectLabel", "UseKeyValues", "UseCommaSeparatedList", "UseJsonList"] }, { kind: "component", type: i5.FormFileComponent, selector: "form-file", inputs: ["Multiple", "AllowDownload", "MaxSize", "FancyMode", "ReadFile"] }, { kind: "component", type: i5.FormAutocompleteComponent, selector: "form-autocomplete", inputs: ["SelectLabel", "SearchFunctionContext", "SearchFunction", "MinChars", "HideChoicesOnSelection", "RequiredPlaceholder", "CaseSensitive", "Multi", "MultiElementsThreshold", "UnboundMode"] }, { kind: "pipe", type: i2.LocalizePipe, name: "localize" }], encapsulation: i0.ViewEncapsulation.None });
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersComponent, decorators: [{
|
|
406
|
-
type: Component,
|
|
407
|
-
args: [{ selector: "es-parameters", providers: [
|
|
408
|
-
{ provide: LocalizationService, useClass: EsParametersLoc },
|
|
409
|
-
{
|
|
410
|
-
provide: NG_VALUE_ACCESSOR,
|
|
411
|
-
useExisting: forwardRef(() => EsParametersComponent),
|
|
412
|
-
multi: true
|
|
413
|
-
}
|
|
414
|
-
], encapsulation: ViewEncapsulation.None, template: "<div *ngIf=\"(!Parameters || Parameters.length == 0) && EmptyMessage\">\r\n <em>{{EmptyMessage}}</em>\r\n</div>\r\n\r\n<div *ngIf=\"Groups && Initialized\">\r\n <ng-container *ngTemplateOutlet=\"Temp; context: {item: { groups: Groups, isSubgroup: false }}\"></ng-container>\r\n</div>\r\n\r\n<ng-template #Temp let-item=\"item\">\r\n <ng-container *ngFor=\"let group of item.groups; let k = index\">\r\n <div [class.pars-subgroup]=\"item.isSubgroup\" [class.pars-group]=\"!item.isSubgroup\">\r\n <ng-container *ngTemplateOutlet=\"GroupsOrSubgroupsDisplay; context: { item: { group: group, index: k + (item.index ? ('_' + item.index) : ''), isSubgroup: item.isSubgroup }}\"></ng-container>\r\n <ng-container *ngIf=\"group.subgroups.length > 0\">\r\n <ng-container *ngTemplateOutlet=\"Temp; context: {item: { groups: group.subgroups, index: k + (item.index ? ('_' + item.index) : ''), isSubgroup: true }};\"></ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n</ng-template>\r\n\r\n<ng-template #GroupsOrSubgroupsDisplay let-item=\"item\">\r\n <div *ngIf=\"item.group && Initialized\">\r\n <div *ngIf=\"item.group.groupName\" [class.pars-group-title]=\"!item.isSubgroup\" [class.pars-subgroup-title]=\"item.isSubgroup\">\r\n {{item.group.groupName}}\r\n </div>\r\n <div *ngIf=\"item.group.parameters && item.group.parameters.length > 0\">\r\n <ng-container *ngFor=\"let par of item.group.parameters; let i= index; let last = last;\">\r\n <ng-container *ngIf=\"!DisplayMode || (!HideEmpty || (par.value))\">\r\n <div class=\"row form-group\" *ngIf=\"par.visible\" [class.app-margin-bottom-0]=\"LastParameterNoMargin && last\">\r\n <label class=\"col-md-{{LabelColWidth}} m-t-5\"><span *ngIf=\"Removal\" class=\"fa fa-remove text-danger\" (click)=\"removeParameter(par)\"> </span>{{par.description}}{{par.required ? '*' : ''}}:</label>\r\n <!--Se Data-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'date'\">\r\n <form-date [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-date>\r\n </div>\r\n <!--Se stringa-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'string'\">\r\n <form-input [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-input>\r\n </div>\r\n <!--Se numero-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'number'\">\r\n <form-input [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator pattern=\"{{par.pattern || '^[+-]?[0-9]*[,]?[0-9]+$'}}\"></form-input>\r\n </div>\r\n <!--Se boolean-->\r\n <div class=\"col-md-{{InputColWidth}} m-t-5\" *ngIf=\"par.type == 'boolean'\">\r\n <form-checkbox [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator></form-checkbox>\r\n </div>\r\n <!--Se enum single select-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && !par.multienum && !par.sourceapi\">\r\n <form-select [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" (inputChange)=\"changed();\" #validator [Source]=\"par.enumvalues\"></form-select>\r\n </div>\r\n <!--Se enum multi select-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && !par.sourceapi\">\r\n <form-multiselect [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [UseJsonList]=\"MultiselectMode == 'JsonArray'\" [UseCommaSeparatedList]=\"MultiselectMode == 'CommaSeparated'\" [SelectLabel]=\"('Seleziona' | localize : lc) + '...'\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [Source]=\"par.enumvalues\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-multiselect>\r\n </div>\r\n <!--Se enum multiselect senza sorgente-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && !par.sourceapi && !par.enumvalues\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [HideChoicesOnSelection]=\"true\" [SelectLabel]=\"('Seleziona' | localize : lc) + '...'\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [UnboundMode]=\"true\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete> \r\n </div>\r\n <!--Se enum autocomplete-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && !par.multienum && par.sourceapi\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [FormLayout]=\"false\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [SearchFunction]=\"getSource.bind(this, par)\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete>\r\n </div>\r\n <!--Se enum multiselect autocomplete-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'enum' && par.multienum && par.sourceapi\">\r\n <form-autocomplete [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [HideChoicesOnSelection]=\"AutocompleteHideChoicesOnSelection\" [Multi]=\"true\" [FormLayout]=\"false\" [(ngModel)]=\"par.value\" name=\"{{item.index}}par{{i}}_{{par.id}}\" [Readonly]=\"Readonly || par.isreadonly\" [SearchFunction]=\"getSource.bind(this, par)\" [required]=\"par.required\" (inputChange)=\"changed();\" #validator></form-autocomplete>\r\n </div>\r\n <!--Se file-->\r\n <div class=\"col-md-{{InputColWidth}}\" *ngIf=\"par.type == 'file'\">\r\n <form-file [DisplayMode]=\"DisplayMode\" [Form]=\"Form\" [ReadFile]=\"true\" [FormLayout]=\"false\" [Readonly]=\"Readonly || par.isreadonly\" [required]=\"par.required\" [(ngModel)]=\"par.file\" name=\"{{item.index}}par{{i}}_{{par.id}}\" #validator></form-file>\r\n </div>\r\n </div>\r\n <div class=\"clearfix\"></div>\r\n </ng-container>\r\n </ng-container>\r\n <div *ngIf=\"DisplayMode && AllParametersEmpty && HideEmpty\" class=\"card card-info app-padding-10 app-no-margin app-white-text\">\r\n Non è presente nulla da visualizzare\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>", styles: [".list-area{position:fixed}.pars-group-title{background:#ddd;margin-bottom:7px;padding:5px;text-transform:uppercase;font-weight:700;text-align:center;color:#333;font-size:13px}.pars-subgroup-title{font-weight:700;color:#333;font-size:16px}.pars-group{margin-left:0}.pars-subgroup{margin-left:15px}\n"] }]
|
|
415
|
-
}], ctorParameters: function () { return [{ type: i1.UtilityService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.Injector }, { type: i1.DateService }]; }, propDecorators: { DisplayMode: [{
|
|
416
|
-
type: Input
|
|
417
|
-
}], HideEmpty: [{
|
|
418
|
-
type: Input
|
|
419
|
-
}], LastParameterNoMargin: [{
|
|
420
|
-
type: Input
|
|
421
|
-
}], LabelColWidth: [{
|
|
422
|
-
type: Input
|
|
423
|
-
}], InputColWidth: [{
|
|
424
|
-
type: Input
|
|
425
|
-
}], submitted: [{
|
|
426
|
-
type: Input
|
|
427
|
-
}], EmptyMessage: [{
|
|
428
|
-
type: Input
|
|
429
|
-
}], Removal: [{
|
|
430
|
-
type: Input
|
|
431
|
-
}], Readonly: [{
|
|
432
|
-
type: Input
|
|
433
|
-
}], ListFormat: [{
|
|
434
|
-
type: Input
|
|
435
|
-
}], Form: [{
|
|
436
|
-
type: Input
|
|
437
|
-
}], AutocompleteHideChoicesOnSelection: [{
|
|
438
|
-
type: Input
|
|
439
|
-
}], AutoCompleteDataRetrieve: [{
|
|
440
|
-
type: Input
|
|
441
|
-
}], MultiselectMode: [{
|
|
442
|
-
type: Input
|
|
443
|
-
}], LabelInputRatio: [{
|
|
444
|
-
type: Input
|
|
445
|
-
}] } });
|
|
446
|
-
|
|
447
|
-
class EsParametersModule {
|
|
448
|
-
}
|
|
449
|
-
EsParametersModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
450
|
-
EsParametersModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: EsParametersModule, declarations: [EsParametersComponent], imports: [CommonModule,
|
|
451
|
-
LocalizationModule,
|
|
452
|
-
FormsModule,
|
|
453
|
-
FormsAndValidationsModule], exports: [EsParametersComponent] });
|
|
454
|
-
EsParametersModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersModule, imports: [CommonModule,
|
|
455
|
-
LocalizationModule,
|
|
456
|
-
FormsModule,
|
|
457
|
-
FormsAndValidationsModule] });
|
|
458
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EsParametersModule, decorators: [{
|
|
459
|
-
type: NgModule,
|
|
460
|
-
args: [{
|
|
461
|
-
declarations: [EsParametersComponent],
|
|
462
|
-
imports: [
|
|
463
|
-
CommonModule,
|
|
464
|
-
LocalizationModule,
|
|
465
|
-
FormsModule,
|
|
466
|
-
FormsAndValidationsModule,
|
|
467
|
-
],
|
|
468
|
-
exports: [EsParametersComponent]
|
|
469
|
-
}]
|
|
470
|
-
}] });
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Classe che rappresenta un parametro generico
|
|
474
|
-
*/
|
|
475
|
-
class GenericParameter {
|
|
476
|
-
/**
|
|
477
|
-
* Costruttore
|
|
478
|
-
*
|
|
479
|
-
* @param {string} id Codice del parametro
|
|
480
|
-
* @param {string} description Descrizione del parametro
|
|
481
|
-
* @param {string} pattern Pattern di validazione
|
|
482
|
-
* @param {'date' | 'string' | 'number' | 'boolean' | 'enum'} type Tipo di input
|
|
483
|
-
* @param {boolean} required Indica se il valore è obbligatorio o meno
|
|
484
|
-
* @param {any} v_default Valore di default per questo Parametro
|
|
485
|
-
* @param {{ id: string, description: string }[]} enumvalues Qualora il **type** fosse di tipo **enum**, qui devono esserci tutti i valori che può assumere
|
|
486
|
-
* @param {boolean} multienum Qualora il **type** fosse di tipo **enum**, indica se è possibile selezionare più valori (multiselect)
|
|
487
|
-
* @param {string} sourceapi Nei casi in cui il **type** è **enum** indica l'api da cui recuperare i valori da bindare alla select o alla multiselect
|
|
488
|
-
* @param {boolean} pageddata Nei casi in cui il **type** è **enum** indica che l'api specificata eventualmetne da **sourceapi** è paginata
|
|
489
|
-
*/
|
|
490
|
-
constructor(id, description, pattern, type, required, v_default = null, enumvalues = [], multienum, sourceapi, pageddata) {
|
|
491
|
-
this.id = id;
|
|
492
|
-
this.description = description;
|
|
493
|
-
this.pattern = pattern;
|
|
494
|
-
this.required = required;
|
|
495
|
-
this.enumvalues = enumvalues;
|
|
496
|
-
this.multienum = multienum;
|
|
497
|
-
this.sourceapi = sourceapi;
|
|
498
|
-
this.pageddata = pageddata;
|
|
499
|
-
this.type = type == 'enum' ? null : type;
|
|
500
|
-
this.visible = true;
|
|
501
|
-
this.enumtype = type == 'enum' ? type : "";
|
|
502
|
-
this.isreadonly = false;
|
|
503
|
-
if (!this.enumtype && enumvalues.length != 0)
|
|
504
|
-
console.error("impossibile gestire valori di dizionario per un parametro non di tipo enum");
|
|
505
|
-
if (v_default != null)
|
|
506
|
-
this.value = v_default;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
/*
|
|
511
|
-
* Public API Surface of parameters
|
|
512
|
-
*/
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Generated bundle index. Do not edit.
|
|
516
|
-
*/
|
|
517
|
-
|
|
518
|
-
export { EsParametersComponent, EsParametersModule, GenericParameter };
|
|
519
|
-
//# sourceMappingURL=esfaenza-parameters.mjs.map
|