sin-pipes 1.0.3 → 1.1.0

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.
Files changed (49) hide show
  1. package/README.md +7 -7
  2. package/esm2020/lib/pipes/boolean-it.pipe.mjs +19 -0
  3. package/esm2020/lib/pipes/bytetoxformat.pipe.mjs +25 -0
  4. package/esm2020/lib/pipes/camel-case-to-split.pipe.mjs +21 -0
  5. package/esm2020/lib/pipes/currency-it.pipe.mjs +25 -0
  6. package/esm2020/lib/pipes/filter.pipe.mjs +50 -0
  7. package/esm2020/lib/pipes/form-error.pipe.mjs +58 -0
  8. package/esm2020/lib/pipes/number-it.pipe.mjs +22 -0
  9. package/esm2020/lib/pipes/safe-html.pipe.mjs +20 -0
  10. package/esm2020/lib/pipes/trend-it.pipe.mjs +22 -0
  11. package/esm2020/lib/sin-pipes.module.mjs +61 -0
  12. package/esm2020/public-api.mjs +14 -0
  13. package/esm2020/sin-pipes.mjs +5 -0
  14. package/fesm2015/sin-pipes.mjs +307 -0
  15. package/fesm2015/sin-pipes.mjs.map +1 -0
  16. package/fesm2020/sin-pipes.mjs +307 -0
  17. package/fesm2020/sin-pipes.mjs.map +1 -0
  18. package/lib/pipes/boolean-it.pipe.d.ts +3 -0
  19. package/lib/pipes/bytetoxformat.pipe.d.ts +3 -0
  20. package/lib/pipes/camel-case-to-split.pipe.d.ts +3 -0
  21. package/lib/pipes/currency-it.pipe.d.ts +3 -0
  22. package/lib/pipes/filter.pipe.d.ts +3 -0
  23. package/lib/pipes/form-error.pipe.d.ts +4 -1
  24. package/lib/pipes/number-it.pipe.d.ts +3 -0
  25. package/lib/pipes/safe-html.pipe.d.ts +3 -0
  26. package/lib/pipes/trend-it.pipe.d.ts +3 -0
  27. package/lib/sin-pipes.module.d.ts +13 -0
  28. package/package.json +22 -10
  29. package/public-api.d.ts +9 -0
  30. package/sin-pipes.d.ts +1 -9
  31. package/bundles/sin-pipes.umd.js +0 -311
  32. package/bundles/sin-pipes.umd.js.map +0 -1
  33. package/bundles/sin-pipes.umd.min.js +0 -2
  34. package/bundles/sin-pipes.umd.min.js.map +0 -1
  35. package/esm2015/lib/pipes/boolean-it.pipe.js +0 -15
  36. package/esm2015/lib/pipes/bytetoxformat.pipe.js +0 -21
  37. package/esm2015/lib/pipes/camel-case-to-split.pipe.js +0 -17
  38. package/esm2015/lib/pipes/currency-it.pipe.js +0 -21
  39. package/esm2015/lib/pipes/filter.pipe.js +0 -46
  40. package/esm2015/lib/pipes/form-error.pipe.js +0 -54
  41. package/esm2015/lib/pipes/number-it.pipe.js +0 -18
  42. package/esm2015/lib/pipes/safe-html.pipe.js +0 -19
  43. package/esm2015/lib/pipes/trend-it.pipe.js +0 -18
  44. package/esm2015/lib/sin-pipes.module.js +0 -40
  45. package/esm2015/public-api.js +0 -5
  46. package/esm2015/sin-pipes.js +0 -14
  47. package/fesm2015/sin-pipes.js +0 -262
  48. package/fesm2015/sin-pipes.js.map +0 -1
  49. package/sin-pipes.metadata.json +0 -1
@@ -0,0 +1,307 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ /**
6
+ * Filtro che replica il "filter" di AngularJS (da usare con parsimonia, se una vista necessita un filtro particolare è meglio farne uno specifico)
7
+ */
8
+ class FilterPipe {
9
+ transform(items, searchText) {
10
+ if (searchText === '')
11
+ searchText = undefined;
12
+ if (searchText !== undefined && items !== undefined && searchText !== null) {
13
+ searchText = searchText.toLowerCase();
14
+ return items.filter(item => {
15
+ return this.applyFilter(item, searchText);
16
+ });
17
+ }
18
+ else {
19
+ return items;
20
+ }
21
+ }
22
+ /**
23
+ * TODO da migliorare con l'implementazione delle date e/o altri tipi
24
+ * Applica il filtro all'oggetto
25
+ */
26
+ applyFilter(item, filter) {
27
+ for (const field in item) {
28
+ if (item[field] === null)
29
+ continue;
30
+ if (typeof item[field] === 'string') {
31
+ if (item[field].toLowerCase().indexOf(filter) !== -1) {
32
+ return true;
33
+ }
34
+ }
35
+ else if (typeof item[field] === 'number') {
36
+ if (item[field] === filter) {
37
+ return true;
38
+ }
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ }
44
+ FilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
45
+ FilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, name: "filter" });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, decorators: [{
47
+ type: Pipe,
48
+ args: [{
49
+ name: 'filter'
50
+ }]
51
+ }] });
52
+
53
+ /**
54
+ * Filtro per la formattazioni di numeri
55
+ */
56
+ class NumberItPipe {
57
+ transform(input) {
58
+ if (input === undefined || input === null) {
59
+ return '';
60
+ }
61
+ return input.toLocaleString();
62
+ }
63
+ }
64
+ NumberItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
65
+ NumberItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, name: "number_it" });
66
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, decorators: [{
67
+ type: Pipe,
68
+ args: [{
69
+ name: 'number_it'
70
+ }]
71
+ }] });
72
+
73
+ /**
74
+ * Filtro per la formattazione di un numero % ( come il trend )
75
+ */
76
+ class TrendItPipe {
77
+ transform(input) {
78
+ if (input === undefined || input === null) {
79
+ return '';
80
+ }
81
+ return input.toLocaleString() + ' %';
82
+ }
83
+ }
84
+ TrendItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
85
+ TrendItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, name: "trend_it" });
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, decorators: [{
87
+ type: Pipe,
88
+ args: [{
89
+ name: 'trend_it'
90
+ }]
91
+ }] });
92
+
93
+ /**
94
+ * Filtro per la formattazione degli importi ( per ora fisso in € )
95
+ */
96
+ class CurrencyItPipe {
97
+ transform(input) {
98
+ if (input === undefined || input === null) {
99
+ return "";
100
+ }
101
+ let moneystr = "";
102
+ let dec = (input - Math.floor(input) == 0) ? ",00" : "";
103
+ moneystr = input.toLocaleString() + dec + " \u20AC";
104
+ return moneystr;
105
+ }
106
+ }
107
+ CurrencyItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
108
+ CurrencyItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, name: "currency_it" });
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, decorators: [{
110
+ type: Pipe,
111
+ args: [{
112
+ name: 'currency_it'
113
+ }]
114
+ }] });
115
+
116
+ class SafeHtmlPipe {
117
+ constructor(sanitizer) {
118
+ this.sanitizer = sanitizer;
119
+ }
120
+ transform(html, args) {
121
+ return this.sanitizer.bypassSecurityTrustHtml(html);
122
+ }
123
+ }
124
+ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
125
+ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, decorators: [{
127
+ type: Pipe,
128
+ args: [{
129
+ name: 'safeHtml'
130
+ }]
131
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
132
+
133
+ /**
134
+ * Filtro per la formattazione di booleani in visualizzazione
135
+ */
136
+ class BooleanItPipe {
137
+ transform(value, ...args) {
138
+ return value === true ? 'Si' : 'No';
139
+ }
140
+ }
141
+ BooleanItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
142
+ BooleanItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, name: "booleanIt" });
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, decorators: [{
144
+ type: Pipe,
145
+ args: [{
146
+ name: 'booleanIt'
147
+ }]
148
+ }] });
149
+
150
+ /**
151
+ * Filtro per la formattazione del size dei file
152
+ */
153
+ class ByteToXFormatPipe {
154
+ transform(value, newFormat) {
155
+ if (newFormat === 'kilobytes') {
156
+ return (value / 1024).toFixed(2);
157
+ }
158
+ if (newFormat === 'megabytes') {
159
+ return (value / (Math.pow(1024, 2))).toFixed(2);
160
+ }
161
+ if (newFormat === 'gigbytes') {
162
+ return (value / (Math.pow(1024, 3))).toFixed(2);
163
+ }
164
+ }
165
+ }
166
+ ByteToXFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
167
+ ByteToXFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, name: "bytetoxformat" });
168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, decorators: [{
169
+ type: Pipe,
170
+ args: [{ name: 'bytetoxformat' }]
171
+ }] });
172
+
173
+ class FormErrorPipe {
174
+ transform(errors) {
175
+ if (errors) {
176
+ let text = '';
177
+ Object.keys(errors).forEach(error => {
178
+ switch (error) {
179
+ case 'required':
180
+ text += ` campo obbligatorio !`;
181
+ break;
182
+ case 'pattern':
183
+ text += ` ha un formato non valido !`;
184
+ break;
185
+ case 'requiredPattern':
186
+ text += ` non rispetta la formattazione richiesta !`;
187
+ break;
188
+ case 'invalid':
189
+ text += ` ha un formato non valido !`;
190
+ break;
191
+ case 'email':
192
+ text += ` ha un formato non valido !`;
193
+ break;
194
+ case 'minlength':
195
+ text += ` lunghezza minima ${errors[error].requiredLength} caratteri !`;
196
+ break;
197
+ case 'maxlength':
198
+ text += ` lunghezza massima ${errors[error].requiredLength} caratteri !`;
199
+ break;
200
+ case 'areEqual':
201
+ text += ` deve essere uguale !`;
202
+ break;
203
+ case 'ngbDate':
204
+ text += ` ha un formato non valido !`;
205
+ break;
206
+ case 'value':
207
+ text += ` ha un formato non valido !`;
208
+ break;
209
+ case 'actualValue':
210
+ break;
211
+ default:
212
+ text += `${error}: ${errors[error]}`;
213
+ }
214
+ });
215
+ return text;
216
+ }
217
+ return '';
218
+ }
219
+ }
220
+ FormErrorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
221
+ FormErrorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, name: "formError" });
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, decorators: [{
223
+ type: Pipe,
224
+ args: [{
225
+ name: 'formError'
226
+ }]
227
+ }] });
228
+
229
+ class CamelCaseToSplitPipe {
230
+ transform(value) {
231
+ if (value === value.toUpperCase() || value === value.toLowerCase()) {
232
+ return value;
233
+ }
234
+ else {
235
+ return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');
236
+ }
237
+ }
238
+ }
239
+ CamelCaseToSplitPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
240
+ CamelCaseToSplitPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, name: "camelCaseToSplit" });
241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, decorators: [{
242
+ type: Pipe,
243
+ args: [{
244
+ name: 'camelCaseToSplit'
245
+ }]
246
+ }] });
247
+
248
+ class SinPipesModule {
249
+ }
250
+ SinPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
251
+ SinPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, declarations: [FilterPipe,
252
+ NumberItPipe,
253
+ TrendItPipe,
254
+ CurrencyItPipe,
255
+ SafeHtmlPipe,
256
+ BooleanItPipe,
257
+ ByteToXFormatPipe,
258
+ FormErrorPipe,
259
+ CamelCaseToSplitPipe], exports: [FilterPipe,
260
+ NumberItPipe,
261
+ TrendItPipe,
262
+ CurrencyItPipe,
263
+ SafeHtmlPipe,
264
+ BooleanItPipe,
265
+ ByteToXFormatPipe,
266
+ FormErrorPipe,
267
+ CamelCaseToSplitPipe] });
268
+ SinPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, imports: [[]] });
269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, decorators: [{
270
+ type: NgModule,
271
+ args: [{
272
+ declarations: [
273
+ FilterPipe,
274
+ NumberItPipe,
275
+ TrendItPipe,
276
+ CurrencyItPipe,
277
+ SafeHtmlPipe,
278
+ BooleanItPipe,
279
+ ByteToXFormatPipe,
280
+ FormErrorPipe,
281
+ CamelCaseToSplitPipe
282
+ ],
283
+ imports: [],
284
+ exports: [
285
+ FilterPipe,
286
+ NumberItPipe,
287
+ TrendItPipe,
288
+ CurrencyItPipe,
289
+ SafeHtmlPipe,
290
+ BooleanItPipe,
291
+ ByteToXFormatPipe,
292
+ FormErrorPipe,
293
+ CamelCaseToSplitPipe
294
+ ]
295
+ }]
296
+ }] });
297
+
298
+ /*
299
+ * Public API Surface of sin-pipes
300
+ */
301
+
302
+ /**
303
+ * Generated bundle index. Do not edit.
304
+ */
305
+
306
+ export { BooleanItPipe, ByteToXFormatPipe, CamelCaseToSplitPipe, CurrencyItPipe, FilterPipe, FormErrorPipe, NumberItPipe, SafeHtmlPipe, SinPipesModule, TrendItPipe };
307
+ //# sourceMappingURL=sin-pipes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sin-pipes.mjs","sources":["../../../projects/sin-pipes/src/lib/pipes/filter.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/number-it.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/trend-it.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/currency-it.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/safe-html.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/boolean-it.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/bytetoxformat.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/form-error.pipe.ts","../../../projects/sin-pipes/src/lib/pipes/camel-case-to-split.pipe.ts","../../../projects/sin-pipes/src/lib/sin-pipes.module.ts","../../../projects/sin-pipes/src/public-api.ts","../../../projects/sin-pipes/src/sin-pipes.ts"],"sourcesContent":["import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro che replica il \"filter\" di AngularJS (da usare con parsimonia, se una vista necessita un filtro particolare è meglio farne uno specifico)\r\n */\r\n@Pipe({\r\n name: 'filter'\r\n})\r\nexport class FilterPipe implements PipeTransform {\r\n\r\n transform(items: any[], searchText: string): any {\r\n if (searchText === '') searchText = undefined;\r\n\r\n if (searchText !== undefined && items !== undefined && searchText !== null) {\r\n searchText = searchText.toLowerCase();\r\n return items.filter(item => {\r\n return this.applyFilter(item, searchText);\r\n });\r\n } else {\r\n return items;\r\n }\r\n }\r\n\r\n /**\r\n * TODO da migliorare con l'implementazione delle date e/o altri tipi\r\n * Applica il filtro all'oggetto\r\n */\r\n applyFilter(item: any, filter: string): boolean {\r\n for (const field in item) {\r\n if (item[field] === null) continue;\r\n\r\n if (typeof item[field] === 'string') {\r\n if (item[field].toLowerCase().indexOf(filter) !== -1) {\r\n return true;\r\n }\r\n } else if (typeof item[field] === 'number') {\r\n if (item[field] === filter) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro per la formattazioni di numeri\r\n */\r\n@Pipe({\r\n name: 'number_it'\r\n})\r\nexport class NumberItPipe implements PipeTransform {\r\n\r\n transform(input: any): any {\r\n if (input === undefined || input === null) {\r\n return '';\r\n }\r\n return input.toLocaleString();\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro per la formattazione di un numero % ( come il trend )\r\n */\r\n@Pipe({\r\n name: 'trend_it'\r\n})\r\nexport class TrendItPipe implements PipeTransform {\r\n\r\n transform(input: any): any {\r\n if (input === undefined || input === null) {\r\n return '';\r\n }\r\n return input.toLocaleString() + ' %';\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro per la formattazione degli importi ( per ora fisso in € )\r\n */\r\n@Pipe({\r\n name: 'currency_it'\r\n})\r\nexport class CurrencyItPipe implements PipeTransform {\r\n\r\n transform(input: any): any\r\n {\r\n if (input === undefined || input === null)\r\n {\r\n return \"\";\r\n }\r\n\r\n let moneystr = \"\";\r\n let dec = (input - Math.floor(input) == 0) ? \",00\" : \"\";\r\n moneystr = input.toLocaleString() + dec + \" \\u20AC\";\r\n return moneystr;\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\nimport {DomSanitizer} from '@angular/platform-browser';\r\n\r\n@Pipe({\r\n name: 'safeHtml'\r\n})\r\nexport class SafeHtmlPipe implements PipeTransform {\r\n constructor(private sanitizer: DomSanitizer) { }\r\n\r\n transform(html: any, args?: any): any {\r\n return this.sanitizer.bypassSecurityTrustHtml(html);\r\n }\r\n\r\n}\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro per la formattazione di booleani in visualizzazione\r\n */\r\n@Pipe({\r\n name: 'booleanIt'\r\n})\r\nexport class BooleanItPipe implements PipeTransform {\r\n\r\n transform(value: any, ...args: any[]): any {\r\n return value === true ? 'Si' : 'No';\r\n }\r\n\r\n}\r\n\r\n","import { Pipe, PipeTransform } from '@angular/core';\r\n\r\n/**\r\n * Filtro per la formattazione del size dei file\r\n */\r\n@Pipe({ name: 'bytetoxformat' })\r\nexport class ByteToXFormatPipe implements PipeTransform {\r\n transform(value: number, newFormat: string): string {\r\n if (newFormat === 'kilobytes') {\r\n return (value / 1024).toFixed(2);\r\n }\r\n if (newFormat === 'megabytes') {\r\n return (value / (1024 ** 2)).toFixed(2);\r\n }\r\n if (newFormat === 'gigbytes') {\r\n return (value / (1024 ** 3)).toFixed(2);\r\n }\r\n }\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\nimport {ValidationErrors} from '@angular/forms';\r\n\r\n@Pipe({\r\n name: 'formError'\r\n})\r\nexport class FormErrorPipe implements PipeTransform {\r\n\r\n transform(errors: ValidationErrors): any {\r\n if (errors) {\r\n let text: string = '';\r\n Object.keys(errors).forEach(error => {\r\n switch (error) {\r\n case 'required':\r\n text += ` campo obbligatorio !`;\r\n break;\r\n case 'pattern':\r\n text += ` ha un formato non valido !`;\r\n break;\r\n case 'requiredPattern':\r\n text += ` non rispetta la formattazione richiesta !`;\r\n break;\r\n case 'invalid':\r\n text += ` ha un formato non valido !`;\r\n break;\r\n case 'email':\r\n text += ` ha un formato non valido !`;\r\n break;\r\n case 'minlength':\r\n text += ` lunghezza minima ${errors[error].requiredLength} caratteri !`;\r\n break;\r\n case 'maxlength':\r\n text += ` lunghezza massima ${errors[error].requiredLength} caratteri !`;\r\n break;\r\n case 'areEqual':\r\n text += ` deve essere uguale !`;\r\n break;\r\n case 'ngbDate':\r\n text += ` ha un formato non valido !`;\r\n break;\r\n case 'value':\r\n text += ` ha un formato non valido !`;\r\n break;\r\n case 'actualValue':\r\n break;\r\n default:\r\n text += `${error}: ${errors[error]}`;\r\n }\r\n });\r\n return text;\r\n }\r\n return '';\r\n }\r\n\r\n}\r\n","import {Pipe, PipeTransform} from '@angular/core';\r\n\r\n@Pipe({\r\n name: 'camelCaseToSplit'\r\n})\r\nexport class CamelCaseToSplitPipe implements PipeTransform {\r\n\r\n transform(value: string): string {\r\n if (value === value.toUpperCase() || value === value.toLowerCase()) {\r\n return value;\r\n } else {\r\n return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');\r\n }\r\n }\r\n\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { FilterPipe } from './pipes/filter.pipe';\r\nimport { NumberItPipe } from './pipes/number-it.pipe';\r\nimport { TrendItPipe } from './pipes/trend-it.pipe';\r\nimport { CurrencyItPipe } from './pipes/currency-it.pipe';\r\nimport { SafeHtmlPipe } from './pipes/safe-html.pipe';\r\nimport {BooleanItPipe} from './pipes/boolean-it.pipe';\r\nimport {ByteToXFormatPipe} from './pipes/bytetoxformat.pipe';\r\nimport {FormErrorPipe} from './pipes/form-error.pipe';\r\nimport {CamelCaseToSplitPipe} from './pipes/camel-case-to-split.pipe';\r\n\r\n@NgModule({\r\n declarations: [\r\n FilterPipe,\r\n NumberItPipe,\r\n TrendItPipe,\r\n CurrencyItPipe,\r\n SafeHtmlPipe,\r\n BooleanItPipe,\r\n ByteToXFormatPipe,\r\n FormErrorPipe,\r\n CamelCaseToSplitPipe\r\n ],\r\n imports: [ ],\r\n exports: [\r\n FilterPipe,\r\n NumberItPipe,\r\n TrendItPipe,\r\n CurrencyItPipe,\r\n SafeHtmlPipe,\r\n BooleanItPipe,\r\n ByteToXFormatPipe,\r\n FormErrorPipe,\r\n CamelCaseToSplitPipe\r\n ]\r\n})\r\nexport class SinPipesModule { }\r\n","/*\r\n * Public API Surface of sin-pipes\r\n */\r\n\r\nexport * from './lib/sin-pipes.module';\r\n\r\nexport * from './lib/pipes/boolean-it.pipe';\r\nexport * from './lib/pipes/bytetoxformat.pipe';\r\nexport * from './lib/pipes/camel-case-to-split.pipe';\r\nexport * from './lib/pipes/filter.pipe';\r\nexport * from './lib/pipes/form-error.pipe';\r\nexport * from './lib/pipes/currency-it.pipe';\r\nexport * from './lib/pipes/number-it.pipe';\r\nexport * from './lib/pipes/safe-html.pipe';\r\nexport * from './lib/pipes/trend-it.pipe';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAEA;;;MAMa,UAAU;IAErB,SAAS,CAAC,KAAY,EAAE,UAAkB;QACxC,IAAI,UAAU,KAAK,EAAE;YAAE,UAAU,GAAG,SAAS,CAAC;QAE9C,IAAI,UAAU,KAAK,SAAS,IAAI,KAAK,KAA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B1B,QAAQ;mBAAC;oBACR,YAAY,EAAE;wBACZ,UAAU;wBACV,YAAY;wBACZ,WAAW;wBACX,cAAc;wBACd,YAAY;wBACZ,aAAa;wBACb,iBAAiB;wBACjB,aAAa;wBACb,oBAAoB;qBACrB;oBACD,OAAO,EAAE,EAAG;oBACZ,OAAO,EAAE;wBACP,UAAU;wBACV,YAAY;wBACZ,WAAW;wBACX,cAAc;wBACd,YAAY;wBACZ,aAAa;wBACb,iBAAiB;wBACjB,aAAa;wBACb,oBAAoB;qBACrB;iBACF;;;ACnCD;;;;ACAA;;;;;;"}
@@ -0,0 +1,307 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/platform-browser';
4
+
5
+ /**
6
+ * Filtro che replica il "filter" di AngularJS (da usare con parsimonia, se una vista necessita un filtro particolare è meglio farne uno specifico)
7
+ */
8
+ class FilterPipe {
9
+ transform(items, searchText) {
10
+ if (searchText === '')
11
+ searchText = undefined;
12
+ if (searchText !== undefined && items !== undefined && searchText !== null) {
13
+ searchText = searchText.toLowerCase();
14
+ return items.filter(item => {
15
+ return this.applyFilter(item, searchText);
16
+ });
17
+ }
18
+ else {
19
+ return items;
20
+ }
21
+ }
22
+ /**
23
+ * TODO da migliorare con l'implementazione delle date e/o altri tipi
24
+ * Applica il filtro all'oggetto
25
+ */
26
+ applyFilter(item, filter) {
27
+ for (const field in item) {
28
+ if (item[field] === null)
29
+ continue;
30
+ if (typeof item[field] === 'string') {
31
+ if (item[field].toLowerCase().indexOf(filter) !== -1) {
32
+ return true;
33
+ }
34
+ }
35
+ else if (typeof item[field] === 'number') {
36
+ if (item[field] === filter) {
37
+ return true;
38
+ }
39
+ }
40
+ }
41
+ return false;
42
+ }
43
+ }
44
+ FilterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
45
+ FilterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, name: "filter" });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FilterPipe, decorators: [{
47
+ type: Pipe,
48
+ args: [{
49
+ name: 'filter'
50
+ }]
51
+ }] });
52
+
53
+ /**
54
+ * Filtro per la formattazioni di numeri
55
+ */
56
+ class NumberItPipe {
57
+ transform(input) {
58
+ if (input === undefined || input === null) {
59
+ return '';
60
+ }
61
+ return input.toLocaleString();
62
+ }
63
+ }
64
+ NumberItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
65
+ NumberItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, name: "number_it" });
66
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: NumberItPipe, decorators: [{
67
+ type: Pipe,
68
+ args: [{
69
+ name: 'number_it'
70
+ }]
71
+ }] });
72
+
73
+ /**
74
+ * Filtro per la formattazione di un numero % ( come il trend )
75
+ */
76
+ class TrendItPipe {
77
+ transform(input) {
78
+ if (input === undefined || input === null) {
79
+ return '';
80
+ }
81
+ return input.toLocaleString() + ' %';
82
+ }
83
+ }
84
+ TrendItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
85
+ TrendItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, name: "trend_it" });
86
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: TrendItPipe, decorators: [{
87
+ type: Pipe,
88
+ args: [{
89
+ name: 'trend_it'
90
+ }]
91
+ }] });
92
+
93
+ /**
94
+ * Filtro per la formattazione degli importi ( per ora fisso in € )
95
+ */
96
+ class CurrencyItPipe {
97
+ transform(input) {
98
+ if (input === undefined || input === null) {
99
+ return "";
100
+ }
101
+ let moneystr = "";
102
+ let dec = (input - Math.floor(input) == 0) ? ",00" : "";
103
+ moneystr = input.toLocaleString() + dec + " \u20AC";
104
+ return moneystr;
105
+ }
106
+ }
107
+ CurrencyItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
108
+ CurrencyItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, name: "currency_it" });
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CurrencyItPipe, decorators: [{
110
+ type: Pipe,
111
+ args: [{
112
+ name: 'currency_it'
113
+ }]
114
+ }] });
115
+
116
+ class SafeHtmlPipe {
117
+ constructor(sanitizer) {
118
+ this.sanitizer = sanitizer;
119
+ }
120
+ transform(html, args) {
121
+ return this.sanitizer.bypassSecurityTrustHtml(html);
122
+ }
123
+ }
124
+ SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
125
+ SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, name: "safeHtml" });
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SafeHtmlPipe, decorators: [{
127
+ type: Pipe,
128
+ args: [{
129
+ name: 'safeHtml'
130
+ }]
131
+ }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
132
+
133
+ /**
134
+ * Filtro per la formattazione di booleani in visualizzazione
135
+ */
136
+ class BooleanItPipe {
137
+ transform(value, ...args) {
138
+ return value === true ? 'Si' : 'No';
139
+ }
140
+ }
141
+ BooleanItPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
142
+ BooleanItPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, name: "booleanIt" });
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: BooleanItPipe, decorators: [{
144
+ type: Pipe,
145
+ args: [{
146
+ name: 'booleanIt'
147
+ }]
148
+ }] });
149
+
150
+ /**
151
+ * Filtro per la formattazione del size dei file
152
+ */
153
+ class ByteToXFormatPipe {
154
+ transform(value, newFormat) {
155
+ if (newFormat === 'kilobytes') {
156
+ return (value / 1024).toFixed(2);
157
+ }
158
+ if (newFormat === 'megabytes') {
159
+ return (value / (1024 ** 2)).toFixed(2);
160
+ }
161
+ if (newFormat === 'gigbytes') {
162
+ return (value / (1024 ** 3)).toFixed(2);
163
+ }
164
+ }
165
+ }
166
+ ByteToXFormatPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
167
+ ByteToXFormatPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, name: "bytetoxformat" });
168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: ByteToXFormatPipe, decorators: [{
169
+ type: Pipe,
170
+ args: [{ name: 'bytetoxformat' }]
171
+ }] });
172
+
173
+ class FormErrorPipe {
174
+ transform(errors) {
175
+ if (errors) {
176
+ let text = '';
177
+ Object.keys(errors).forEach(error => {
178
+ switch (error) {
179
+ case 'required':
180
+ text += ` campo obbligatorio !`;
181
+ break;
182
+ case 'pattern':
183
+ text += ` ha un formato non valido !`;
184
+ break;
185
+ case 'requiredPattern':
186
+ text += ` non rispetta la formattazione richiesta !`;
187
+ break;
188
+ case 'invalid':
189
+ text += ` ha un formato non valido !`;
190
+ break;
191
+ case 'email':
192
+ text += ` ha un formato non valido !`;
193
+ break;
194
+ case 'minlength':
195
+ text += ` lunghezza minima ${errors[error].requiredLength} caratteri !`;
196
+ break;
197
+ case 'maxlength':
198
+ text += ` lunghezza massima ${errors[error].requiredLength} caratteri !`;
199
+ break;
200
+ case 'areEqual':
201
+ text += ` deve essere uguale !`;
202
+ break;
203
+ case 'ngbDate':
204
+ text += ` ha un formato non valido !`;
205
+ break;
206
+ case 'value':
207
+ text += ` ha un formato non valido !`;
208
+ break;
209
+ case 'actualValue':
210
+ break;
211
+ default:
212
+ text += `${error}: ${errors[error]}`;
213
+ }
214
+ });
215
+ return text;
216
+ }
217
+ return '';
218
+ }
219
+ }
220
+ FormErrorPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
221
+ FormErrorPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, name: "formError" });
222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: FormErrorPipe, decorators: [{
223
+ type: Pipe,
224
+ args: [{
225
+ name: 'formError'
226
+ }]
227
+ }] });
228
+
229
+ class CamelCaseToSplitPipe {
230
+ transform(value) {
231
+ if (value === value.toUpperCase() || value === value.toLowerCase()) {
232
+ return value;
233
+ }
234
+ else {
235
+ return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');
236
+ }
237
+ }
238
+ }
239
+ CamelCaseToSplitPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
240
+ CamelCaseToSplitPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, name: "camelCaseToSplit" });
241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: CamelCaseToSplitPipe, decorators: [{
242
+ type: Pipe,
243
+ args: [{
244
+ name: 'camelCaseToSplit'
245
+ }]
246
+ }] });
247
+
248
+ class SinPipesModule {
249
+ }
250
+ SinPipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
251
+ SinPipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, declarations: [FilterPipe,
252
+ NumberItPipe,
253
+ TrendItPipe,
254
+ CurrencyItPipe,
255
+ SafeHtmlPipe,
256
+ BooleanItPipe,
257
+ ByteToXFormatPipe,
258
+ FormErrorPipe,
259
+ CamelCaseToSplitPipe], exports: [FilterPipe,
260
+ NumberItPipe,
261
+ TrendItPipe,
262
+ CurrencyItPipe,
263
+ SafeHtmlPipe,
264
+ BooleanItPipe,
265
+ ByteToXFormatPipe,
266
+ FormErrorPipe,
267
+ CamelCaseToSplitPipe] });
268
+ SinPipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, imports: [[]] });
269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.2", ngImport: i0, type: SinPipesModule, decorators: [{
270
+ type: NgModule,
271
+ args: [{
272
+ declarations: [
273
+ FilterPipe,
274
+ NumberItPipe,
275
+ TrendItPipe,
276
+ CurrencyItPipe,
277
+ SafeHtmlPipe,
278
+ BooleanItPipe,
279
+ ByteToXFormatPipe,
280
+ FormErrorPipe,
281
+ CamelCaseToSplitPipe
282
+ ],
283
+ imports: [],
284
+ exports: [
285
+ FilterPipe,
286
+ NumberItPipe,
287
+ TrendItPipe,
288
+ CurrencyItPipe,
289
+ SafeHtmlPipe,
290
+ BooleanItPipe,
291
+ ByteToXFormatPipe,
292
+ FormErrorPipe,
293
+ CamelCaseToSplitPipe
294
+ ]
295
+ }]
296
+ }] });
297
+
298
+ /*
299
+ * Public API Surface of sin-pipes
300
+ */
301
+
302
+ /**
303
+ * Generated bundle index. Do not edit.
304
+ */
305
+
306
+ export { BooleanItPipe, ByteToXFormatPipe, CamelCaseToSplitPipe, CurrencyItPipe, FilterPipe, FormErrorPipe, NumberItPipe, SafeHtmlPipe, SinPipesModule, TrendItPipe };
307
+ //# sourceMappingURL=sin-pipes.mjs.map