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.
- package/README.md +7 -7
- package/esm2020/lib/pipes/boolean-it.pipe.mjs +19 -0
- package/esm2020/lib/pipes/bytetoxformat.pipe.mjs +25 -0
- package/esm2020/lib/pipes/camel-case-to-split.pipe.mjs +21 -0
- package/esm2020/lib/pipes/currency-it.pipe.mjs +25 -0
- package/esm2020/lib/pipes/filter.pipe.mjs +50 -0
- package/esm2020/lib/pipes/form-error.pipe.mjs +58 -0
- package/esm2020/lib/pipes/number-it.pipe.mjs +22 -0
- package/esm2020/lib/pipes/safe-html.pipe.mjs +20 -0
- package/esm2020/lib/pipes/trend-it.pipe.mjs +22 -0
- package/esm2020/lib/sin-pipes.module.mjs +61 -0
- package/esm2020/public-api.mjs +14 -0
- package/esm2020/sin-pipes.mjs +5 -0
- package/fesm2015/sin-pipes.mjs +307 -0
- package/fesm2015/sin-pipes.mjs.map +1 -0
- package/fesm2020/sin-pipes.mjs +307 -0
- package/fesm2020/sin-pipes.mjs.map +1 -0
- package/lib/pipes/boolean-it.pipe.d.ts +3 -0
- package/lib/pipes/bytetoxformat.pipe.d.ts +3 -0
- package/lib/pipes/camel-case-to-split.pipe.d.ts +3 -0
- package/lib/pipes/currency-it.pipe.d.ts +3 -0
- package/lib/pipes/filter.pipe.d.ts +3 -0
- package/lib/pipes/form-error.pipe.d.ts +4 -1
- package/lib/pipes/number-it.pipe.d.ts +3 -0
- package/lib/pipes/safe-html.pipe.d.ts +3 -0
- package/lib/pipes/trend-it.pipe.d.ts +3 -0
- package/lib/sin-pipes.module.d.ts +13 -0
- package/package.json +22 -10
- package/public-api.d.ts +9 -0
- package/sin-pipes.d.ts +1 -9
- package/bundles/sin-pipes.umd.js +0 -311
- package/bundles/sin-pipes.umd.js.map +0 -1
- package/bundles/sin-pipes.umd.min.js +0 -2
- package/bundles/sin-pipes.umd.min.js.map +0 -1
- package/esm2015/lib/pipes/boolean-it.pipe.js +0 -15
- package/esm2015/lib/pipes/bytetoxformat.pipe.js +0 -21
- package/esm2015/lib/pipes/camel-case-to-split.pipe.js +0 -17
- package/esm2015/lib/pipes/currency-it.pipe.js +0 -21
- package/esm2015/lib/pipes/filter.pipe.js +0 -46
- package/esm2015/lib/pipes/form-error.pipe.js +0 -54
- package/esm2015/lib/pipes/number-it.pipe.js +0 -18
- package/esm2015/lib/pipes/safe-html.pipe.js +0 -19
- package/esm2015/lib/pipes/trend-it.pipe.js +0 -18
- package/esm2015/lib/sin-pipes.module.js +0 -40
- package/esm2015/public-api.js +0 -5
- package/esm2015/sin-pipes.js +0 -14
- package/fesm2015/sin-pipes.js +0 -262
- package/fesm2015/sin-pipes.js.map +0 -1
- package/sin-pipes.metadata.json +0 -1
|
@@ -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,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI,EAAE;YAC1E,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;YACtC,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI;gBACtB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;aAC3C,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,KAAK,CAAC;SACd;KACF;;;;;IAMD,WAAW,CAAC,IAAS,EAAE,MAAc;QACnC,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;YACxB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI;gBAAE,SAAS;YAEnC,IAAI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0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro per la formattazione di booleani in visualizzazione
|
|
4
5
|
*/
|
|
5
6
|
export declare class BooleanItPipe implements PipeTransform {
|
|
6
7
|
transform(value: any, ...args: any[]): any;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BooleanItPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<BooleanItPipe, "booleanIt">;
|
|
7
10
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro per la formattazione del size dei file
|
|
4
5
|
*/
|
|
5
6
|
export declare class ByteToXFormatPipe implements PipeTransform {
|
|
6
7
|
transform(value: number, newFormat: string): string;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ByteToXFormatPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ByteToXFormatPipe, "bytetoxformat">;
|
|
7
10
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
export declare class CamelCaseToSplitPipe implements PipeTransform {
|
|
3
4
|
transform(value: string): string;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CamelCaseToSplitPipe, never>;
|
|
6
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CamelCaseToSplitPipe, "camelCaseToSplit">;
|
|
4
7
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro per la formattazione degli importi ( per ora fisso in € )
|
|
4
5
|
*/
|
|
5
6
|
export declare class CurrencyItPipe implements PipeTransform {
|
|
6
7
|
transform(input: any): any;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyItPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyItPipe, "currency_it">;
|
|
7
10
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro che replica il "filter" di AngularJS (da usare con parsimonia, se una vista necessita un filtro particolare è meglio farne uno specifico)
|
|
4
5
|
*/
|
|
@@ -9,4 +10,6 @@ export declare class FilterPipe implements PipeTransform {
|
|
|
9
10
|
* Applica il filtro all'oggetto
|
|
10
11
|
*/
|
|
11
12
|
applyFilter(item: any, filter: string): boolean;
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FilterPipe, never>;
|
|
14
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<FilterPipe, "filter">;
|
|
12
15
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
-
import { ValidationErrors } from
|
|
2
|
+
import { ValidationErrors } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class FormErrorPipe implements PipeTransform {
|
|
4
5
|
transform(errors: ValidationErrors): any;
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormErrorPipe, never>;
|
|
7
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<FormErrorPipe, "formError">;
|
|
5
8
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro per la formattazioni di numeri
|
|
4
5
|
*/
|
|
5
6
|
export declare class NumberItPipe implements PipeTransform {
|
|
6
7
|
transform(input: any): any;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NumberItPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NumberItPipe, "number_it">;
|
|
7
10
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
2
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class SafeHtmlPipe implements PipeTransform {
|
|
4
5
|
private sanitizer;
|
|
5
6
|
constructor(sanitizer: DomSanitizer);
|
|
6
7
|
transform(html: any, args?: any): any;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SafeHtmlPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<SafeHtmlPipe, "safeHtml">;
|
|
7
10
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/**
|
|
3
4
|
* Filtro per la formattazione di un numero % ( come il trend )
|
|
4
5
|
*/
|
|
5
6
|
export declare class TrendItPipe implements PipeTransform {
|
|
6
7
|
transform(input: any): any;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TrendItPipe, never>;
|
|
9
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<TrendItPipe, "trend_it">;
|
|
7
10
|
}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./pipes/filter.pipe";
|
|
3
|
+
import * as i2 from "./pipes/number-it.pipe";
|
|
4
|
+
import * as i3 from "./pipes/trend-it.pipe";
|
|
5
|
+
import * as i4 from "./pipes/currency-it.pipe";
|
|
6
|
+
import * as i5 from "./pipes/safe-html.pipe";
|
|
7
|
+
import * as i6 from "./pipes/boolean-it.pipe";
|
|
8
|
+
import * as i7 from "./pipes/bytetoxformat.pipe";
|
|
9
|
+
import * as i8 from "./pipes/form-error.pipe";
|
|
10
|
+
import * as i9 from "./pipes/camel-case-to-split.pipe";
|
|
1
11
|
export declare class SinPipesModule {
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SinPipesModule, never>;
|
|
13
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<SinPipesModule, [typeof i1.FilterPipe, typeof i2.NumberItPipe, typeof i3.TrendItPipe, typeof i4.CurrencyItPipe, typeof i5.SafeHtmlPipe, typeof i6.BooleanItPipe, typeof i7.ByteToXFormatPipe, typeof i8.FormErrorPipe, typeof i9.CamelCaseToSplitPipe], never, [typeof i1.FilterPipe, typeof i2.NumberItPipe, typeof i3.TrendItPipe, typeof i4.CurrencyItPipe, typeof i5.SafeHtmlPipe, typeof i6.BooleanItPipe, typeof i7.ByteToXFormatPipe, typeof i8.FormErrorPipe, typeof i9.CamelCaseToSplitPipe]>;
|
|
14
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<SinPipesModule>;
|
|
2
15
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sin-pipes",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": ">=
|
|
6
|
-
"@angular/core": ">=
|
|
5
|
+
"@angular/common": ">=13.0.0",
|
|
6
|
+
"@angular/core": ">=13.0.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.0.0"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"fesm2015": "fesm2015/sin-pipes.
|
|
11
|
+
"module": "fesm2015/sin-pipes.mjs",
|
|
12
|
+
"es2020": "fesm2020/sin-pipes.mjs",
|
|
13
|
+
"esm2020": "esm2020/sin-pipes.mjs",
|
|
14
|
+
"fesm2020": "fesm2020/sin-pipes.mjs",
|
|
15
|
+
"fesm2015": "fesm2015/sin-pipes.mjs",
|
|
16
16
|
"typings": "sin-pipes.d.ts",
|
|
17
|
-
"
|
|
17
|
+
"exports": {
|
|
18
|
+
"./package.json": {
|
|
19
|
+
"default": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./sin-pipes.d.ts",
|
|
23
|
+
"esm2020": "./esm2020/sin-pipes.mjs",
|
|
24
|
+
"es2020": "./fesm2020/sin-pipes.mjs",
|
|
25
|
+
"es2015": "./fesm2015/sin-pipes.mjs",
|
|
26
|
+
"node": "./fesm2015/sin-pipes.mjs",
|
|
27
|
+
"default": "./fesm2020/sin-pipes.mjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
18
30
|
"sideEffects": false
|
|
19
|
-
}
|
|
31
|
+
}
|
package/public-api.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
1
|
export * from './lib/sin-pipes.module';
|
|
2
|
+
export * from './lib/pipes/boolean-it.pipe';
|
|
3
|
+
export * from './lib/pipes/bytetoxformat.pipe';
|
|
4
|
+
export * from './lib/pipes/camel-case-to-split.pipe';
|
|
5
|
+
export * from './lib/pipes/filter.pipe';
|
|
6
|
+
export * from './lib/pipes/form-error.pipe';
|
|
7
|
+
export * from './lib/pipes/currency-it.pipe';
|
|
8
|
+
export * from './lib/pipes/number-it.pipe';
|
|
9
|
+
export * from './lib/pipes/safe-html.pipe';
|
|
10
|
+
export * from './lib/pipes/trend-it.pipe';
|
package/sin-pipes.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generated bundle index. Do not edit.
|
|
3
3
|
*/
|
|
4
|
+
/// <amd-module name="sin-pipes" />
|
|
4
5
|
export * from './public-api';
|
|
5
|
-
export { BooleanItPipe as ɵf } from './lib/pipes/boolean-it.pipe';
|
|
6
|
-
export { ByteToXFormatPipe as ɵg } from './lib/pipes/bytetoxformat.pipe';
|
|
7
|
-
export { CamelCaseToSplitPipe as ɵi } from './lib/pipes/camel-case-to-split.pipe';
|
|
8
|
-
export { CurrencyItPipe as ɵd } from './lib/pipes/currency-it.pipe';
|
|
9
|
-
export { FilterPipe as ɵa } from './lib/pipes/filter.pipe';
|
|
10
|
-
export { FormErrorPipe as ɵh } from './lib/pipes/form-error.pipe';
|
|
11
|
-
export { NumberItPipe as ɵb } from './lib/pipes/number-it.pipe';
|
|
12
|
-
export { SafeHtmlPipe as ɵe } from './lib/pipes/safe-html.pipe';
|
|
13
|
-
export { TrendItPipe as ɵc } from './lib/pipes/trend-it.pipe';
|
package/bundles/sin-pipes.umd.js
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/platform-browser')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('sin-pipes', ['exports', '@angular/core', '@angular/platform-browser'], factory) :
|
|
4
|
-
(global = global || self, factory(global['sin-pipes'] = {}, global.ng.core, global.ng.platformBrowser));
|
|
5
|
-
}(this, (function (exports, core, platformBrowser) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Filtro che replica il "filter" di AngularJS (da usare con parsimonia, se una vista necessita un filtro particolare è meglio farne uno specifico)
|
|
9
|
-
*/
|
|
10
|
-
var FilterPipe = /** @class */ (function () {
|
|
11
|
-
function FilterPipe() {
|
|
12
|
-
}
|
|
13
|
-
FilterPipe.prototype.transform = function (items, searchText) {
|
|
14
|
-
var _this = this;
|
|
15
|
-
if (searchText === '')
|
|
16
|
-
searchText = undefined;
|
|
17
|
-
if (searchText !== undefined && items !== undefined && searchText !== null) {
|
|
18
|
-
searchText = searchText.toLowerCase();
|
|
19
|
-
return items.filter(function (item) {
|
|
20
|
-
return _this.applyFilter(item, searchText);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return items;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* TODO da migliorare con l'implementazione delle date e/o altri tipi
|
|
29
|
-
* Applica il filtro all'oggetto
|
|
30
|
-
*/
|
|
31
|
-
FilterPipe.prototype.applyFilter = function (item, filter) {
|
|
32
|
-
for (var field in item) {
|
|
33
|
-
if (item[field] === null)
|
|
34
|
-
continue;
|
|
35
|
-
if (typeof item[field] === 'string') {
|
|
36
|
-
if (item[field].toLowerCase().indexOf(filter) !== -1) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
else if (typeof item[field] === 'number') {
|
|
41
|
-
if (item[field] === filter) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
};
|
|
48
|
-
return FilterPipe;
|
|
49
|
-
}());
|
|
50
|
-
FilterPipe.decorators = [
|
|
51
|
-
{ type: core.Pipe, args: [{
|
|
52
|
-
name: 'filter'
|
|
53
|
-
},] }
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Filtro per la formattazioni di numeri
|
|
58
|
-
*/
|
|
59
|
-
var NumberItPipe = /** @class */ (function () {
|
|
60
|
-
function NumberItPipe() {
|
|
61
|
-
}
|
|
62
|
-
NumberItPipe.prototype.transform = function (input) {
|
|
63
|
-
if (input === undefined || input === null) {
|
|
64
|
-
return '';
|
|
65
|
-
}
|
|
66
|
-
return input.toLocaleString();
|
|
67
|
-
};
|
|
68
|
-
return NumberItPipe;
|
|
69
|
-
}());
|
|
70
|
-
NumberItPipe.decorators = [
|
|
71
|
-
{ type: core.Pipe, args: [{
|
|
72
|
-
name: 'number_it'
|
|
73
|
-
},] }
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Filtro per la formattazione di un numero % ( come il trend )
|
|
78
|
-
*/
|
|
79
|
-
var TrendItPipe = /** @class */ (function () {
|
|
80
|
-
function TrendItPipe() {
|
|
81
|
-
}
|
|
82
|
-
TrendItPipe.prototype.transform = function (input) {
|
|
83
|
-
if (input === undefined || input === null) {
|
|
84
|
-
return '';
|
|
85
|
-
}
|
|
86
|
-
return input.toLocaleString() + ' %';
|
|
87
|
-
};
|
|
88
|
-
return TrendItPipe;
|
|
89
|
-
}());
|
|
90
|
-
TrendItPipe.decorators = [
|
|
91
|
-
{ type: core.Pipe, args: [{
|
|
92
|
-
name: 'trend_it'
|
|
93
|
-
},] }
|
|
94
|
-
];
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Filtro per la formattazione degli importi ( per ora fisso in € )
|
|
98
|
-
*/
|
|
99
|
-
var CurrencyItPipe = /** @class */ (function () {
|
|
100
|
-
function CurrencyItPipe() {
|
|
101
|
-
}
|
|
102
|
-
CurrencyItPipe.prototype.transform = function (input) {
|
|
103
|
-
if (input === undefined || input === null) {
|
|
104
|
-
return "";
|
|
105
|
-
}
|
|
106
|
-
var moneystr = "";
|
|
107
|
-
var dec = (input - Math.floor(input) == 0) ? ",00" : "";
|
|
108
|
-
moneystr = input.toLocaleString() + dec + " \u20AC";
|
|
109
|
-
return moneystr;
|
|
110
|
-
};
|
|
111
|
-
return CurrencyItPipe;
|
|
112
|
-
}());
|
|
113
|
-
CurrencyItPipe.decorators = [
|
|
114
|
-
{ type: core.Pipe, args: [{
|
|
115
|
-
name: 'currency_it'
|
|
116
|
-
},] }
|
|
117
|
-
];
|
|
118
|
-
|
|
119
|
-
var SafeHtmlPipe = /** @class */ (function () {
|
|
120
|
-
function SafeHtmlPipe(sanitizer) {
|
|
121
|
-
this.sanitizer = sanitizer;
|
|
122
|
-
}
|
|
123
|
-
SafeHtmlPipe.prototype.transform = function (html, args) {
|
|
124
|
-
return this.sanitizer.bypassSecurityTrustHtml(html);
|
|
125
|
-
};
|
|
126
|
-
return SafeHtmlPipe;
|
|
127
|
-
}());
|
|
128
|
-
SafeHtmlPipe.decorators = [
|
|
129
|
-
{ type: core.Pipe, args: [{
|
|
130
|
-
name: 'safeHtml'
|
|
131
|
-
},] }
|
|
132
|
-
];
|
|
133
|
-
SafeHtmlPipe.ctorParameters = function () { return [
|
|
134
|
-
{ type: platformBrowser.DomSanitizer }
|
|
135
|
-
]; };
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Filtro per la formattazione di booleani in visualizzazione
|
|
139
|
-
*/
|
|
140
|
-
var BooleanItPipe = /** @class */ (function () {
|
|
141
|
-
function BooleanItPipe() {
|
|
142
|
-
}
|
|
143
|
-
BooleanItPipe.prototype.transform = function (value) {
|
|
144
|
-
var args = [];
|
|
145
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
146
|
-
args[_i - 1] = arguments[_i];
|
|
147
|
-
}
|
|
148
|
-
return value === true ? 'Si' : 'No';
|
|
149
|
-
};
|
|
150
|
-
return BooleanItPipe;
|
|
151
|
-
}());
|
|
152
|
-
BooleanItPipe.decorators = [
|
|
153
|
-
{ type: core.Pipe, args: [{
|
|
154
|
-
name: 'booleanIt'
|
|
155
|
-
},] }
|
|
156
|
-
];
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Filtro per la formattazione del size dei file
|
|
160
|
-
*/
|
|
161
|
-
var ByteToXFormatPipe = /** @class */ (function () {
|
|
162
|
-
function ByteToXFormatPipe() {
|
|
163
|
-
}
|
|
164
|
-
ByteToXFormatPipe.prototype.transform = function (value, newFormat) {
|
|
165
|
-
if (newFormat === 'kilobytes') {
|
|
166
|
-
return (value / 1024).toFixed(2);
|
|
167
|
-
}
|
|
168
|
-
if (newFormat === 'megabytes') {
|
|
169
|
-
return (value / (Math.pow(1024, 2))).toFixed(2);
|
|
170
|
-
}
|
|
171
|
-
if (newFormat === 'gigbytes') {
|
|
172
|
-
return (value / (Math.pow(1024, 3))).toFixed(2);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
return ByteToXFormatPipe;
|
|
176
|
-
}());
|
|
177
|
-
ByteToXFormatPipe.decorators = [
|
|
178
|
-
{ type: core.Pipe, args: [{ name: 'bytetoxformat' },] }
|
|
179
|
-
];
|
|
180
|
-
|
|
181
|
-
var FormErrorPipe = /** @class */ (function () {
|
|
182
|
-
function FormErrorPipe() {
|
|
183
|
-
}
|
|
184
|
-
FormErrorPipe.prototype.transform = function (errors) {
|
|
185
|
-
if (errors) {
|
|
186
|
-
var text_1 = '';
|
|
187
|
-
Object.keys(errors).forEach(function (error) {
|
|
188
|
-
switch (error) {
|
|
189
|
-
case 'required':
|
|
190
|
-
text_1 += " campo obbligatorio !";
|
|
191
|
-
break;
|
|
192
|
-
case 'pattern':
|
|
193
|
-
text_1 += " ha un formato non valido !";
|
|
194
|
-
break;
|
|
195
|
-
case 'requiredPattern':
|
|
196
|
-
text_1 += " non rispetta la formattazione richiesta !";
|
|
197
|
-
break;
|
|
198
|
-
case 'invalid':
|
|
199
|
-
text_1 += " ha un formato non valido !";
|
|
200
|
-
break;
|
|
201
|
-
case 'email':
|
|
202
|
-
text_1 += " ha un formato non valido !";
|
|
203
|
-
break;
|
|
204
|
-
case 'minlength':
|
|
205
|
-
text_1 += " lunghezza minima " + errors[error].requiredLength + " caratteri !";
|
|
206
|
-
break;
|
|
207
|
-
case 'maxlength':
|
|
208
|
-
text_1 += " lunghezza massima " + errors[error].requiredLength + " caratteri !";
|
|
209
|
-
break;
|
|
210
|
-
case 'areEqual':
|
|
211
|
-
text_1 += " deve essere uguale !";
|
|
212
|
-
break;
|
|
213
|
-
case 'ngbDate':
|
|
214
|
-
text_1 += " ha un formato non valido !";
|
|
215
|
-
break;
|
|
216
|
-
case 'value':
|
|
217
|
-
text_1 += " ha un formato non valido !";
|
|
218
|
-
break;
|
|
219
|
-
case 'actualValue':
|
|
220
|
-
break;
|
|
221
|
-
default:
|
|
222
|
-
text_1 += error + ": " + errors[error];
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
return text_1;
|
|
226
|
-
}
|
|
227
|
-
return '';
|
|
228
|
-
};
|
|
229
|
-
return FormErrorPipe;
|
|
230
|
-
}());
|
|
231
|
-
FormErrorPipe.decorators = [
|
|
232
|
-
{ type: core.Pipe, args: [{
|
|
233
|
-
name: 'formError'
|
|
234
|
-
},] }
|
|
235
|
-
];
|
|
236
|
-
|
|
237
|
-
var CamelCaseToSplitPipe = /** @class */ (function () {
|
|
238
|
-
function CamelCaseToSplitPipe() {
|
|
239
|
-
}
|
|
240
|
-
CamelCaseToSplitPipe.prototype.transform = function (value) {
|
|
241
|
-
if (value === value.toUpperCase() || value === value.toLowerCase()) {
|
|
242
|
-
return value;
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
return CamelCaseToSplitPipe;
|
|
249
|
-
}());
|
|
250
|
-
CamelCaseToSplitPipe.decorators = [
|
|
251
|
-
{ type: core.Pipe, args: [{
|
|
252
|
-
name: 'camelCaseToSplit'
|
|
253
|
-
},] }
|
|
254
|
-
];
|
|
255
|
-
|
|
256
|
-
var SinPipesModule = /** @class */ (function () {
|
|
257
|
-
function SinPipesModule() {
|
|
258
|
-
}
|
|
259
|
-
return SinPipesModule;
|
|
260
|
-
}());
|
|
261
|
-
SinPipesModule.decorators = [
|
|
262
|
-
{ type: core.NgModule, args: [{
|
|
263
|
-
declarations: [
|
|
264
|
-
FilterPipe,
|
|
265
|
-
NumberItPipe,
|
|
266
|
-
TrendItPipe,
|
|
267
|
-
CurrencyItPipe,
|
|
268
|
-
SafeHtmlPipe,
|
|
269
|
-
BooleanItPipe,
|
|
270
|
-
ByteToXFormatPipe,
|
|
271
|
-
FormErrorPipe,
|
|
272
|
-
CamelCaseToSplitPipe
|
|
273
|
-
],
|
|
274
|
-
imports: [],
|
|
275
|
-
exports: [
|
|
276
|
-
FilterPipe,
|
|
277
|
-
NumberItPipe,
|
|
278
|
-
TrendItPipe,
|
|
279
|
-
CurrencyItPipe,
|
|
280
|
-
SafeHtmlPipe,
|
|
281
|
-
BooleanItPipe,
|
|
282
|
-
ByteToXFormatPipe,
|
|
283
|
-
FormErrorPipe,
|
|
284
|
-
CamelCaseToSplitPipe
|
|
285
|
-
]
|
|
286
|
-
},] }
|
|
287
|
-
];
|
|
288
|
-
|
|
289
|
-
/*
|
|
290
|
-
* Public API Surface of sin-pipes
|
|
291
|
-
*/
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Generated bundle index. Do not edit.
|
|
295
|
-
*/
|
|
296
|
-
|
|
297
|
-
exports.SinPipesModule = SinPipesModule;
|
|
298
|
-
exports.ɵa = FilterPipe;
|
|
299
|
-
exports.ɵb = NumberItPipe;
|
|
300
|
-
exports.ɵc = TrendItPipe;
|
|
301
|
-
exports.ɵd = CurrencyItPipe;
|
|
302
|
-
exports.ɵe = SafeHtmlPipe;
|
|
303
|
-
exports.ɵf = BooleanItPipe;
|
|
304
|
-
exports.ɵg = ByteToXFormatPipe;
|
|
305
|
-
exports.ɵh = FormErrorPipe;
|
|
306
|
-
exports.ɵi = CamelCaseToSplitPipe;
|
|
307
|
-
|
|
308
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
309
|
-
|
|
310
|
-
})));
|
|
311
|
-
//# sourceMappingURL=sin-pipes.umd.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sin-pipes.umd.js","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';\n\n/**\n * Filtro per la formattazioni di numeri\n */\n@Pipe({\n name: 'number_it'\n})\nexport class NumberItPipe implements PipeTransform {\n\n transform(input: any): any {\n if (input === undefined || input === null) {\n return '';\n }\n return input.toLocaleString();\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione di un numero % ( come il trend )\n */\n@Pipe({\n name: 'trend_it'\n})\nexport class TrendItPipe implements PipeTransform {\n\n transform(input: any): any {\n if (input === undefined || input === null) {\n return '';\n }\n return input.toLocaleString() + ' %';\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione degli importi ( per ora fisso in € )\n */\n@Pipe({\n name: 'currency_it'\n})\nexport class CurrencyItPipe implements PipeTransform {\n\n transform(input: any): any\n {\n if (input === undefined || input === null)\n {\n return \"\";\n }\n\n let moneystr = \"\";\n let dec = (input - Math.floor(input) == 0) ? \",00\" : \"\";\n moneystr = input.toLocaleString() + dec + \" \\u20AC\";\n return moneystr;\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport {DomSanitizer} from '@angular/platform-browser';\n\n@Pipe({\n name: 'safeHtml'\n})\nexport class SafeHtmlPipe implements PipeTransform {\n constructor(private sanitizer: DomSanitizer) { }\n\n transform(html: any, args?: any): any {\n return this.sanitizer.bypassSecurityTrustHtml(html);\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione di booleani in visualizzazione\n */\n@Pipe({\n name: 'booleanIt'\n})\nexport class BooleanItPipe implements PipeTransform {\n\n transform(value: any, ...args: any[]): any {\n return value === true ? 'Si' : 'No';\n }\n\n}\n\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';\nimport {ValidationErrors} from \"@angular/forms\";\n\n@Pipe({\n name: 'formError'\n})\nexport class FormErrorPipe implements PipeTransform {\n\n transform(errors: ValidationErrors): any {\n if (errors) {\n let text: string = '';\n Object.keys(errors).forEach(error => {\n switch (error) {\n case 'required':\n text += ` campo obbligatorio !`;\n break;\n case 'pattern':\n text += ` ha un formato non valido !`;\n break;\n case 'requiredPattern':\n text += ` non rispetta la formattazione richiesta !`;\n break;\n case 'invalid':\n text += ` ha un formato non valido !`;\n break;\n case 'email':\n text += ` ha un formato non valido !`;\n break;\n case 'minlength':\n text += ` lunghezza minima ${errors[error].requiredLength} caratteri !`;\n break;\n case 'maxlength':\n text += ` lunghezza massima ${errors[error].requiredLength} caratteri !`;\n break;\n case 'areEqual':\n text += ` deve essere uguale !`;\n break;\n case 'ngbDate':\n text += ` ha un formato non valido !`;\n break;\n case 'value':\n text += ` ha un formato non valido !`;\n break;\n case 'actualValue':\n break;\n default:\n text += `${error}: ${errors[error]}`;\n }\n });\n return text;\n }\n return '';\n }\n\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({\n name: 'camelCaseToSplit'\n})\nexport class CamelCaseToSplitPipe implements PipeTransform {\n\n transform(value: string): string {\n if (value === value.toUpperCase() || value === value.toLowerCase()) {\n return value;\n } else {\n return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');\n }\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { FilterPipe } from './pipes/filter.pipe';\nimport { NumberItPipe } from './pipes/number-it.pipe';\nimport { TrendItPipe } from './pipes/trend-it.pipe';\nimport { CurrencyItPipe } from './pipes/currency-it.pipe';\nimport { SafeHtmlPipe } from './pipes/safe-html.pipe';\nimport {BooleanItPipe} from './pipes/boolean-it.pipe';\nimport {ByteToXFormatPipe} from './pipes/bytetoxformat.pipe';\nimport {FormErrorPipe} from './pipes/form-error.pipe';\nimport {CamelCaseToSplitPipe} from './pipes/camel-case-to-split.pipe';\n\n@NgModule({\n declarations: [\n FilterPipe,\n NumberItPipe,\n TrendItPipe,\n CurrencyItPipe,\n SafeHtmlPipe,\n BooleanItPipe,\n ByteToXFormatPipe,\n FormErrorPipe,\n CamelCaseToSplitPipe\n ],\n imports: [ ],\n exports: [\n FilterPipe,\n NumberItPipe,\n TrendItPipe,\n CurrencyItPipe,\n SafeHtmlPipe,\n BooleanItPipe,\n ByteToXFormatPipe,\n FormErrorPipe,\n CamelCaseToSplitPipe\n ]\n})\nexport class SinPipesModule { }\n","/*\n * Public API Surface of sin-pipes\n */\n\nexport * from './lib/sin-pipes.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {BooleanItPipe as ɵf} from './lib/pipes/boolean-it.pipe';\nexport {ByteToXFormatPipe as ɵg} from './lib/pipes/bytetoxformat.pipe';\nexport {CamelCaseToSplitPipe as ɵi} from './lib/pipes/camel-case-to-split.pipe';\nexport {CurrencyItPipe as ɵd} from './lib/pipes/currency-it.pipe';\nexport {FilterPipe as ɵa} from './lib/pipes/filter.pipe';\nexport {FormErrorPipe as ɵh} from './lib/pipes/form-error.pipe';\nexport {NumberItPipe as ɵb} from './lib/pipes/number-it.pipe';\nexport {SafeHtmlPipe as ɵe} from './lib/pipes/safe-html.pipe';\nexport {TrendItPipe as ɵc} from './lib/pipes/trend-it.pipe';"],"names":["Pipe","DomSanitizer","NgModule"],"mappings":";;;;;;IAEA;;;;QAMA;;QAEE,8BAAS,GAAT,UAAU,KAAY,EAAE,UAAkB;YAA1C,iBAWC;YAVC,IAAI,UAAU,KAAK,EAAE;gBAAE,UAAU,GAAG,SAAS,CAAC;YAE9C,IAAI,UAAU,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,UAAU,KAAK,IAAI,EAAE;gBAC1E,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;gBACtC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAA,IAAI;oBACtB,OAAO,KAAI,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;iBAC3C,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,KAAK,CAAC;aACd;SACF;;;;;QAMD,gCAAW,GAAX,UAAY,IAAS,EAAE,MAAc;YACnC,KAAK,IAAM,KAAK,IAAI,IAAI,EAAE;gBACxB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI;oBAAE,SAAS;gBAEnC,IAAI,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;oBACnC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WA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CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrD;SACF;;;;gBAXFA,SAAI,SAAC;oBACJ,IAAI,EAAE,kBAAkB;iBACzB;;;;QCgCD;;;;;gBAzBCE,aAAQ,SAAC;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;;;ICnCD;;;;ICAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/platform-browser")):"function"==typeof define&&define.amd?define("sin-pipes",["exports","@angular/core","@angular/platform-browser"],e):e((r=r||self)["sin-pipes"]={},r.ng.core,r.ng.platformBrowser)}(this,(function(r,e,t){"use strict";var n=function(){function r(){}return r.prototype.transform=function(r,e){var t=this;return""===e&&(e=void 0),void 0!==e&&void 0!==r&&null!==e?(e=e.toLowerCase(),r.filter((function(r){return t.applyFilter(r,e)}))):r},r.prototype.applyFilter=function(r,e){for(var t in r)if(null!==r[t])if("string"==typeof r[t]){if(-1!==r[t].toLowerCase().indexOf(e))return!0}else if("number"==typeof r[t]&&r[t]===e)return!0;return!1},r}();n.decorators=[{type:e.Pipe,args:[{name:"filter"}]}];var o=function(){function r(){}return r.prototype.transform=function(r){return null==r?"":r.toLocaleString()},r}();o.decorators=[{type:e.Pipe,args:[{name:"number_it"}]}];var a=function(){function r(){}return r.prototype.transform=function(r){return null==r?"":r.toLocaleString()+" %"},r}();a.decorators=[{type:e.Pipe,args:[{name:"trend_it"}]}];var i=function(){function r(){}return r.prototype.transform=function(r){if(null==r)return"";var e=r-Math.floor(r)==0?",00":"";return r.toLocaleString()+e+" €"},r}();i.decorators=[{type:e.Pipe,args:[{name:"currency_it"}]}];var u=function(){function r(r){this.sanitizer=r}return r.prototype.transform=function(r,e){return this.sanitizer.bypassSecurityTrustHtml(r)},r}();u.decorators=[{type:e.Pipe,args:[{name:"safeHtml"}]}],u.ctorParameters=function(){return[{type:t.DomSanitizer}]};var s=function(){function r(){}return r.prototype.transform=function(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return!0===r?"Si":"No"},r}();s.decorators=[{type:e.Pipe,args:[{name:"booleanIt"}]}];var c=function(){function r(){}return r.prototype.transform=function(r,e){return"kilobytes"===e?(r/1024).toFixed(2):"megabytes"===e?(r/Math.pow(1024,2)).toFixed(2):"gigbytes"===e?(r/Math.pow(1024,3)).toFixed(2):void 0},r}();c.decorators=[{type:e.Pipe,args:[{name:"bytetoxformat"}]}];var f=function(){function r(){}return r.prototype.transform=function(r){if(r){var e="";return Object.keys(r).forEach((function(t){switch(t){case"required":e+=" campo obbligatorio !";break;case"pattern":e+=" ha un formato non valido !";break;case"requiredPattern":e+=" non rispetta la formattazione richiesta !";break;case"invalid":case"email":e+=" ha un formato non valido !";break;case"minlength":e+=" lunghezza minima "+r[t].requiredLength+" caratteri !";break;case"maxlength":e+=" lunghezza massima "+r[t].requiredLength+" caratteri !";break;case"areEqual":e+=" deve essere uguale !";break;case"ngbDate":case"value":e+=" ha un formato non valido !";break;case"actualValue":break;default:e+=t+": "+r[t]}})),e}return""},r}();f.decorators=[{type:e.Pipe,args:[{name:"formError"}]}];var p=function(){function r(){}return r.prototype.transform=function(r){return r===r.toUpperCase()||r===r.toLowerCase()?r:r.match(/[A-Z][a-z]+|[0-9]+/g).join(" ")},r}();p.decorators=[{type:e.Pipe,args:[{name:"camelCaseToSplit"}]}];var l=function(){};l.decorators=[{type:e.NgModule,args:[{declarations:[n,o,a,i,u,s,c,f,p],imports:[],exports:[n,o,a,i,u,s,c,f,p]}]}],r.SinPipesModule=l,r.ɵa=n,r.ɵb=o,r.ɵc=a,r.ɵd=i,r.ɵe=u,r.ɵf=s,r.ɵg=c,r.ɵh=f,r.ɵi=p,Object.defineProperty(r,"__esModule",{value:!0})}));
|
|
2
|
-
//# sourceMappingURL=sin-pipes.umd.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"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"],"names":["FilterPipe","prototype","transform","items","searchText","_this","this","undefined","toLowerCase","filter","item","applyFilter","field","indexOf","Pipe","args","name","NumberItPipe","input","toLocaleString","TrendItPipe","CurrencyItPipe","dec","Math","floor","SafeHtmlPipe","sanitizer","html","bypassSecurityTrustHtml","DomSanitizer","BooleanItPipe","value","_i","arguments","length","ByteToXFormatPipe","newFormat","toFixed","pow","FormErrorPipe","errors","text_1","Object","keys","forEach","error","requiredLength","CamelCaseToSplitPipe","toUpperCase","match","join","NgModule","declarations","imports","exports"],"mappings":"oXAQA,SAAAA,YAEEA,EAAAC,UAAAC,UAAA,SAAUC,EAAcC,GAAxB,IAAAC,EAAAC,KAGE,MAFmB,KAAfF,IAAmBA,OAAaG,QAEjBA,IAAfH,QAAsCG,IAAVJ,GAAsC,OAAfC,GACrDA,EAAaA,EAAWI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,CACZpD,EACAiB,EACAG,EACAC,EACAI,EACAK,EACAK,EACAI,EACAQ,GAEFM,QAAS,GACTC,QAAS,CACPtD,EACAiB,EACAG,EACAC,EACAI,EACAK,EACAK,EACAI,EACAQ","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';\n\n/**\n * Filtro per la formattazioni di numeri\n */\n@Pipe({\n name: 'number_it'\n})\nexport class NumberItPipe implements PipeTransform {\n\n transform(input: any): any {\n if (input === undefined || input === null) {\n return '';\n }\n return input.toLocaleString();\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione di un numero % ( come il trend )\n */\n@Pipe({\n name: 'trend_it'\n})\nexport class TrendItPipe implements PipeTransform {\n\n transform(input: any): any {\n if (input === undefined || input === null) {\n return '';\n }\n return input.toLocaleString() + ' %';\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione degli importi ( per ora fisso in € )\n */\n@Pipe({\n name: 'currency_it'\n})\nexport class CurrencyItPipe implements PipeTransform {\n\n transform(input: any): any\n {\n if (input === undefined || input === null)\n {\n return \"\";\n }\n\n let moneystr = \"\";\n let dec = (input - Math.floor(input) == 0) ? \",00\" : \"\";\n moneystr = input.toLocaleString() + dec + \" \\u20AC\";\n return moneystr;\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport {DomSanitizer} from '@angular/platform-browser';\n\n@Pipe({\n name: 'safeHtml'\n})\nexport class SafeHtmlPipe implements PipeTransform {\n constructor(private sanitizer: DomSanitizer) { }\n\n transform(html: any, args?: any): any {\n return this.sanitizer.bypassSecurityTrustHtml(html);\n }\n\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n/**\n * Filtro per la formattazione di booleani in visualizzazione\n */\n@Pipe({\n name: 'booleanIt'\n})\nexport class BooleanItPipe implements PipeTransform {\n\n transform(value: any, ...args: any[]): any {\n return value === true ? 'Si' : 'No';\n }\n\n}\n\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';\nimport {ValidationErrors} from \"@angular/forms\";\n\n@Pipe({\n name: 'formError'\n})\nexport class FormErrorPipe implements PipeTransform {\n\n transform(errors: ValidationErrors): any {\n if (errors) {\n let text: string = '';\n Object.keys(errors).forEach(error => {\n switch (error) {\n case 'required':\n text += ` campo obbligatorio !`;\n break;\n case 'pattern':\n text += ` ha un formato non valido !`;\n break;\n case 'requiredPattern':\n text += ` non rispetta la formattazione richiesta !`;\n break;\n case 'invalid':\n text += ` ha un formato non valido !`;\n break;\n case 'email':\n text += ` ha un formato non valido !`;\n break;\n case 'minlength':\n text += ` lunghezza minima ${errors[error].requiredLength} caratteri !`;\n break;\n case 'maxlength':\n text += ` lunghezza massima ${errors[error].requiredLength} caratteri !`;\n break;\n case 'areEqual':\n text += ` deve essere uguale !`;\n break;\n case 'ngbDate':\n text += ` ha un formato non valido !`;\n break;\n case 'value':\n text += ` ha un formato non valido !`;\n break;\n case 'actualValue':\n break;\n default:\n text += `${error}: ${errors[error]}`;\n }\n });\n return text;\n }\n return '';\n }\n\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({\n name: 'camelCaseToSplit'\n})\nexport class CamelCaseToSplitPipe implements PipeTransform {\n\n transform(value: string): string {\n if (value === value.toUpperCase() || value === value.toLowerCase()) {\n return value;\n } else {\n return value.match(/[A-Z][a-z]+|[0-9]+/g).join(' ');\n }\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { FilterPipe } from './pipes/filter.pipe';\nimport { NumberItPipe } from './pipes/number-it.pipe';\nimport { TrendItPipe } from './pipes/trend-it.pipe';\nimport { CurrencyItPipe } from './pipes/currency-it.pipe';\nimport { SafeHtmlPipe } from './pipes/safe-html.pipe';\nimport {BooleanItPipe} from './pipes/boolean-it.pipe';\nimport {ByteToXFormatPipe} from './pipes/bytetoxformat.pipe';\nimport {FormErrorPipe} from './pipes/form-error.pipe';\nimport {CamelCaseToSplitPipe} from './pipes/camel-case-to-split.pipe';\n\n@NgModule({\n declarations: [\n FilterPipe,\n NumberItPipe,\n TrendItPipe,\n CurrencyItPipe,\n SafeHtmlPipe,\n BooleanItPipe,\n ByteToXFormatPipe,\n FormErrorPipe,\n CamelCaseToSplitPipe\n ],\n imports: [ ],\n exports: [\n FilterPipe,\n NumberItPipe,\n TrendItPipe,\n CurrencyItPipe,\n SafeHtmlPipe,\n BooleanItPipe,\n ByteToXFormatPipe,\n FormErrorPipe,\n CamelCaseToSplitPipe\n ]\n})\nexport class SinPipesModule { }\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Pipe } from '@angular/core';
|
|
2
|
-
/**
|
|
3
|
-
* Filtro per la formattazione di booleani in visualizzazione
|
|
4
|
-
*/
|
|
5
|
-
export class BooleanItPipe {
|
|
6
|
-
transform(value, ...args) {
|
|
7
|
-
return value === true ? 'Si' : 'No';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
BooleanItPipe.decorators = [
|
|
11
|
-
{ type: Pipe, args: [{
|
|
12
|
-
name: 'booleanIt'
|
|
13
|
-
},] }
|
|
14
|
-
];
|
|
15
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYm9vbGVhbi1pdC5waXBlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvc2luLXBpcGVzL3NyYy9saWIvcGlwZXMvYm9vbGVhbi1pdC5waXBlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxJQUFJLEVBQWlCLE1BQU0sZUFBZSxDQUFDO0FBRXBEOztHQUVHO0FBSUgsTUFBTSxPQUFPLGFBQWE7SUFFeEIsU0FBUyxDQUFDLEtBQVUsRUFBRSxHQUFHLElBQVc7UUFDbEMsT0FBTyxLQUFLLEtBQUssSUFBSSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQztJQUN0QyxDQUFDOzs7WUFQRixJQUFJLFNBQUM7Z0JBQ0osSUFBSSxFQUFFLFdBQVc7YUFDbEIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBQaXBlLCBQaXBlVHJhbnNmb3JtIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7X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