@fitcoders/shared 1.0.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 (32) hide show
  1. package/README.md +24 -0
  2. package/esm2020/fitcoders-shared.mjs +5 -0
  3. package/esm2020/lib/constant/shared.const.mjs +200 -0
  4. package/esm2020/lib/directive/directive-api.mjs +9 -0
  5. package/esm2020/lib/directive/directive.module.mjs +47 -0
  6. package/esm2020/lib/directive/directives/control-error.directive.mjs +89 -0
  7. package/esm2020/lib/directive/directives/hover.directive.mjs +42 -0
  8. package/esm2020/lib/directive/directives/input.directive.mjs +48 -0
  9. package/esm2020/lib/directive/directives/scroll.directive.mjs +45 -0
  10. package/esm2020/lib/directive/directives/sensitive.directive.mjs +32 -0
  11. package/esm2020/lib/pipe/pipe-api.mjs +5 -0
  12. package/esm2020/lib/pipe/pipe.module.mjs +31 -0
  13. package/esm2020/lib/pipe/pipes/money.pipe.mjs +28 -0
  14. package/esm2020/public-api.mjs +4 -0
  15. package/fesm2015/fitcoders-shared.mjs +550 -0
  16. package/fesm2015/fitcoders-shared.mjs.map +1 -0
  17. package/fesm2020/fitcoders-shared.mjs +550 -0
  18. package/fesm2020/fitcoders-shared.mjs.map +1 -0
  19. package/fitcoders-shared.d.ts +5 -0
  20. package/lib/constant/shared.const.d.ts +199 -0
  21. package/lib/directive/directive-api.d.ts +6 -0
  22. package/lib/directive/directive.module.d.ts +12 -0
  23. package/lib/directive/directives/control-error.directive.d.ts +25 -0
  24. package/lib/directive/directives/hover.directive.d.ts +13 -0
  25. package/lib/directive/directives/input.directive.d.ts +14 -0
  26. package/lib/directive/directives/scroll.directive.d.ts +16 -0
  27. package/lib/directive/directives/sensitive.directive.d.ts +10 -0
  28. package/lib/pipe/pipe-api.d.ts +2 -0
  29. package/lib/pipe/pipe.module.d.ts +8 -0
  30. package/lib/pipe/pipes/money.pipe.d.ts +13 -0
  31. package/package.json +31 -0
  32. package/public-api.d.ts +3 -0
@@ -0,0 +1,31 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule, DecimalPipe } from '@angular/common';
3
+ import { MoneyPipe } from './pipes/money.pipe';
4
+ import * as i0 from "@angular/core";
5
+ export class PipeModule {
6
+ }
7
+ PipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
8
+ PipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, declarations: [MoneyPipe], imports: [CommonModule], exports: [MoneyPipe] });
9
+ PipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, providers: [
10
+ DecimalPipe
11
+ ], imports: [[
12
+ CommonModule
13
+ ]] });
14
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, decorators: [{
15
+ type: NgModule,
16
+ args: [{
17
+ imports: [
18
+ CommonModule
19
+ ],
20
+ declarations: [
21
+ MoneyPipe
22
+ ],
23
+ exports: [
24
+ MoneyPipe
25
+ ],
26
+ providers: [
27
+ DecimalPipe
28
+ ]
29
+ }]
30
+ }] });
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9zaGFyZWQvc3JjL2xpYi9waXBlL3BpcGUubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxRQUFRLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFDdkMsT0FBTyxFQUFDLFlBQVksRUFBRSxXQUFXLEVBQUMsTUFBTSxpQkFBaUIsQ0FBQztBQUMxRCxPQUFPLEVBQUMsU0FBUyxFQUFDLE1BQU0sb0JBQW9CLENBQUM7O0FBZ0I3QyxNQUFNLE9BQU8sVUFBVTs7dUdBQVYsVUFBVTt3R0FBVixVQUFVLGlCQVRuQixTQUFTLGFBSFQsWUFBWSxhQU1aLFNBQVM7d0dBTUEsVUFBVSxhQUpWO1FBQ1QsV0FBVztLQUNaLFlBWFE7WUFDUCxZQUFZO1NBQ2I7MkZBV1UsVUFBVTtrQkFkdEIsUUFBUTttQkFBQztvQkFDUixPQUFPLEVBQUU7d0JBQ1AsWUFBWTtxQkFDYjtvQkFDRCxZQUFZLEVBQUU7d0JBQ1osU0FBUztxQkFDVjtvQkFDRCxPQUFPLEVBQUU7d0JBQ1AsU0FBUztxQkFDVjtvQkFDRCxTQUFTLEVBQUU7d0JBQ1QsV0FBVztxQkFDWjtpQkFDRiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7TmdNb2R1bGV9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHtDb21tb25Nb2R1bGUsIERlY2ltYWxQaXBlfSBmcm9tICdAYW5ndWxhci9jb21tb24nO1xuaW1wb3J0IHtNb25leVBpcGV9IGZyb20gJy4vcGlwZXMvbW9uZXkucGlwZSc7XG5cbkBOZ01vZHVsZSh7XG4gIGltcG9ydHM6IFtcbiAgICBDb21tb25Nb2R1bGVcbiAgXSxcbiAgZGVjbGFyYXRpb25zOiBbXG4gICAgTW9uZXlQaXBlXG4gIF0sXG4gIGV4cG9ydHM6IFtcbiAgICBNb25leVBpcGVcbiAgXSxcbiAgcHJvdmlkZXJzOiBbXG4gICAgRGVjaW1hbFBpcGVcbiAgXVxufSlcbmV4cG9ydCBjbGFzcyBQaXBlTW9kdWxlIHtcbn1cbiJdfQ==
@@ -0,0 +1,28 @@
1
+ import { Pipe } from '@angular/core';
2
+ import { FitCurrencyConst, FitRegexConst } from '../../constant/shared.const';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/common";
5
+ export class MoneyPipe {
6
+ constructor(decimalPipe) {
7
+ this.decimalPipe = decimalPipe;
8
+ this._currency = FitCurrencyConst;
9
+ this._defaultCurrency = 'PEN';
10
+ this._defaultDecimal = 2;
11
+ }
12
+ transform(value, currency = this._defaultCurrency, decimal = this._defaultDecimal) {
13
+ const format = `.${decimal}-${decimal}`;
14
+ if (value && `${value}`.match(FitRegexConst.decimal)) {
15
+ return `${this._currency[currency]} ${this.decimalPipe.transform(Number(value), (format))}`;
16
+ }
17
+ return `${this._currency[currency]} ${this.decimalPipe.transform(0, (format))}`;
18
+ }
19
+ }
20
+ MoneyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, deps: [{ token: i1.DecimalPipe }], target: i0.ɵɵFactoryTarget.Pipe });
21
+ MoneyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, name: "fitMoney" });
22
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, decorators: [{
23
+ type: Pipe,
24
+ args: [{
25
+ name: 'fitMoney'
26
+ }]
27
+ }], ctorParameters: function () { return [{ type: i1.DecimalPipe }]; } });
28
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9uZXkucGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3NoYXJlZC9zcmMvbGliL3BpcGUvcGlwZXMvbW9uZXkucGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDQSxPQUFPLEVBQUMsSUFBSSxFQUFnQixNQUFNLGVBQWUsQ0FBQztBQUNsRCxPQUFPLEVBQUMsZ0JBQWdCLEVBQUUsYUFBYSxFQUFDLE1BQU0sNkJBQTZCLENBQUM7OztBQUs1RSxNQUF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1hdCkpfWA7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,4 @@
1
+ export * from './lib/constant/shared.const';
2
+ export * from './lib/directive/directive-api';
3
+ export * from './lib/pipe/pipe-api';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3NoYXJlZC9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLDZCQUE2QixDQUFDO0FBRTVDLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyxxQkFBcUIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vbGliL2NvbnN0YW50L3NoYXJlZC5jb25zdCc7XG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL2RpcmVjdGl2ZS9kaXJlY3RpdmUtYXBpJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3BpcGUvcGlwZS1hcGknO1xuIl19
@@ -0,0 +1,550 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Directive, Input, HostListener, EventEmitter, Output, NgModule, Pipe } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule, DecimalPipe } from '@angular/common';
5
+
6
+ const FitRegexConst = {
7
+ number: new RegExp(/^[0-9]\d*$/),
8
+ decimal: new RegExp(/^[0-9]+(\.[0-9]*){0,1}$/),
9
+ percent: new RegExp(/^[1-9][0-9]*$/),
10
+ alphabetical: /^[a-zA-Z\u00C0-\u00FF]+$/,
11
+ alphabeticals: /^[a-zA-Z\u00C0-\u00FF ]+$/,
12
+ alphanumeric: new RegExp(/^[0-9a-zA-Z\u00C0-\u00FF]+$/),
13
+ alphanumerics: new RegExp(/^[0-9a-zA-Z\u00C0-\u00FF ]+$/),
14
+ cell: new RegExp(/^9[0-9]*$/),
15
+ noSpaces: new RegExp(/^\S*$/gmi)
16
+ };
17
+ const FitCurrencyConst = {
18
+ AED: 'د.إ',
19
+ AFN: '؋',
20
+ ALL: 'L',
21
+ AMD: '֏',
22
+ ANG: 'ƒ',
23
+ AOA: 'Kz',
24
+ ARS: '$',
25
+ AUD: '$',
26
+ AWG: 'ƒ',
27
+ AZN: '₼',
28
+ BAM: 'KM',
29
+ BBD: '$',
30
+ BDT: '৳',
31
+ BGN: 'лв',
32
+ BHD: '.د.ب',
33
+ BIF: 'FBu',
34
+ BMD: '$',
35
+ BND: '$',
36
+ BOB: '$b',
37
+ BOV: 'BOV',
38
+ BRL: 'R$',
39
+ BSD: '$',
40
+ BTC: '₿',
41
+ BTN: 'Nu.',
42
+ BWP: 'P',
43
+ BYN: 'Br',
44
+ BYR: 'Br',
45
+ BZD: 'BZ$',
46
+ CAD: '$',
47
+ CDF: 'FC',
48
+ CHE: 'CHE',
49
+ CHF: 'CHF',
50
+ CHW: 'CHW',
51
+ CLF: 'CLF',
52
+ CLP: '$',
53
+ CNY: '¥',
54
+ COP: '$',
55
+ COU: 'COU',
56
+ CRC: '₡',
57
+ CUC: '$',
58
+ CUP: '₱',
59
+ CVE: '$',
60
+ CZK: 'Kč',
61
+ DJF: 'Fdj',
62
+ DKK: 'kr',
63
+ DOP: 'RD$',
64
+ DZD: 'دج',
65
+ EEK: 'kr',
66
+ EGP: '£',
67
+ ERN: 'Nfk',
68
+ ETB: 'Br',
69
+ ETH: 'Ξ',
70
+ EUR: '€',
71
+ FJD: '$',
72
+ FKP: '£',
73
+ GBP: '£',
74
+ GEL: '₾',
75
+ GGP: '£',
76
+ GHC: '₵',
77
+ GHS: 'GH₵',
78
+ GIP: '£',
79
+ GMD: 'D',
80
+ GNF: 'FG',
81
+ GTQ: 'Q',
82
+ GYD: '$',
83
+ HKD: '$',
84
+ HNL: 'L',
85
+ HRK: 'kn',
86
+ HTG: 'G',
87
+ HUF: 'Ft',
88
+ IDR: 'Rp',
89
+ ILS: '₪',
90
+ IMP: '£',
91
+ INR: '₹',
92
+ IQD: 'ع.د',
93
+ IRR: '﷼',
94
+ ISK: 'kr',
95
+ JEP: '£',
96
+ JMD: 'J$',
97
+ JOD: 'JD',
98
+ JPY: '¥',
99
+ KES: 'KSh',
100
+ KGS: 'лв',
101
+ KHR: '៛',
102
+ KMF: 'CF',
103
+ KPW: '₩',
104
+ KRW: '₩',
105
+ KWD: 'KD',
106
+ KYD: '$',
107
+ KZT: '₸',
108
+ LAK: '₭',
109
+ LBP: '£',
110
+ LKR: '₨',
111
+ LRD: '$',
112
+ LSL: 'M',
113
+ LTC: 'Ł',
114
+ LTL: 'Lt',
115
+ LVL: 'Ls',
116
+ LYD: 'LD',
117
+ MAD: 'MAD',
118
+ MDL: 'lei',
119
+ MGA: 'Ar',
120
+ MKD: 'ден',
121
+ MMK: 'K',
122
+ MNT: '₮',
123
+ MOP: 'MOP$',
124
+ MRO: 'UM',
125
+ MRU: 'UM',
126
+ MUR: '₨',
127
+ MVR: 'Rf',
128
+ MWK: 'MK',
129
+ MXN: '$',
130
+ MXV: 'MXV',
131
+ MYR: 'RM',
132
+ MZN: 'MT',
133
+ NAD: '$',
134
+ NGN: '₦',
135
+ NIO: 'C$',
136
+ NOK: 'kr',
137
+ NPR: '₨',
138
+ NZD: '$',
139
+ OMR: '﷼',
140
+ PAB: 'B/.',
141
+ PEN: 'S/.',
142
+ PGK: 'K',
143
+ PHP: '₱',
144
+ PKR: '₨',
145
+ PLN: 'zł',
146
+ PYG: 'Gs',
147
+ QAR: '﷼',
148
+ RMB: '¥',
149
+ RON: 'lei',
150
+ RSD: 'Дин.',
151
+ RUB: '₽',
152
+ RWF: 'R₣',
153
+ SAR: '﷼',
154
+ SBD: '$',
155
+ SCR: '₨',
156
+ SDG: 'ج.س.',
157
+ SEK: 'kr',
158
+ SGD: 'S$',
159
+ SHP: '£',
160
+ SLL: 'Le',
161
+ SOS: 'S',
162
+ SRD: '$',
163
+ SSP: '£',
164
+ STD: 'Db',
165
+ STN: 'Db',
166
+ SVC: '$',
167
+ SYP: '£',
168
+ SZL: 'E',
169
+ THB: '฿',
170
+ TJS: 'SM',
171
+ TMT: 'T',
172
+ TND: 'د.ت',
173
+ TOP: 'T$',
174
+ TRL: '₤',
175
+ TRY: '₺',
176
+ TTD: 'TT$',
177
+ TVD: '$',
178
+ TWD: 'NT$',
179
+ TZS: 'TSh',
180
+ UAH: '₴',
181
+ UGX: 'USh',
182
+ USD: '$',
183
+ UYI: 'UYI',
184
+ UYU: '$U',
185
+ UYW: 'UYW',
186
+ UZS: 'лв',
187
+ VEF: 'Bs',
188
+ VES: 'Bs.S',
189
+ VND: '₫',
190
+ VUV: 'VT',
191
+ WST: 'WS$',
192
+ XAF: 'FCFA',
193
+ XBT: 'Ƀ',
194
+ XCD: '$',
195
+ XOF: 'CFA',
196
+ XPF: '₣',
197
+ XSU: 'Sucre',
198
+ XUA: 'XUA',
199
+ YER: '﷼',
200
+ ZAR: 'R',
201
+ ZMW: 'ZK',
202
+ ZWD: 'Z$',
203
+ ZWL: '$'
204
+ };
205
+
206
+ class HoverDirective {
207
+ constructor(elementRef) {
208
+ this.elementRef = elementRef;
209
+ this.hover = '';
210
+ }
211
+ onMouseEnter() {
212
+ this.setHoverEffect();
213
+ }
214
+ onMouseLeave() {
215
+ this.removeHoverEffect();
216
+ }
217
+ setHoverEffect() {
218
+ for (const _class of this.hover.split(' ')) {
219
+ this.elementRef.nativeElement.classList.add(_class);
220
+ }
221
+ }
222
+ removeHoverEffect() {
223
+ for (const _class of this.hover.split(' ')) {
224
+ this.elementRef.nativeElement.classList.remove(_class);
225
+ }
226
+ }
227
+ }
228
+ HoverDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HoverDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
229
+ HoverDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: HoverDirective, selector: "[fitHover]", inputs: { hover: ["fitHover", "hover"] }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0 });
230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HoverDirective, decorators: [{
231
+ type: Directive,
232
+ args: [{
233
+ selector: '[fitHover]'
234
+ }]
235
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { hover: [{
236
+ type: Input,
237
+ args: ['fitHover']
238
+ }], onMouseEnter: [{
239
+ type: HostListener,
240
+ args: ['mouseenter']
241
+ }], onMouseLeave: [{
242
+ type: HostListener,
243
+ args: ['mouseleave']
244
+ }] } });
245
+
246
+ class InputDirective {
247
+ constructor(el) {
248
+ this.el = el;
249
+ this.input = '';
250
+ this.space = false;
251
+ this._regex = FitRegexConst;
252
+ this._specialKeys = ['Backspace', 'Tab', 'Enter', 'Escape', 'End', 'Home', 'ArrowLeft', 'ArrowRight', 'Delete'];
253
+ }
254
+ onKeyDown(event) {
255
+ if (!this.input) {
256
+ return;
257
+ }
258
+ if (this._specialKeys.indexOf(event.key) !== -1
259
+ || (event.keyCode === 65 && event.ctrlKey) // Allow: Ctrl+A
260
+ || (event.keyCode === 67 && event.ctrlKey) // Allow: Ctrl+C
261
+ || (event.keyCode === 86 && event.ctrlKey) // Allow: Ctrl+V
262
+ || (event.keyCode === 88 && event.ctrlKey) // Allow: Ctrl+X
263
+ ) {
264
+ return;
265
+ }
266
+ const current = this.el.nativeElement.value;
267
+ const next = current.concat(event.key);
268
+ const input = this.space && (this.input === 'alphabetical' || this.input === 'alphanumeric') ? `${this.input}s` : this.input;
269
+ if (next && !String(next).match(this._regex[input])) {
270
+ event.preventDefault();
271
+ }
272
+ }
273
+ }
274
+ InputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: InputDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
275
+ InputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: InputDirective, selector: "[fitInput]", inputs: { input: ["fitInput", "input"], space: "space" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
276
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: InputDirective, decorators: [{
277
+ type: Directive,
278
+ args: [{
279
+ selector: '[fitInput]'
280
+ }]
281
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { input: [{
282
+ type: Input,
283
+ args: ['fitInput']
284
+ }], space: [{
285
+ type: Input
286
+ }], onKeyDown: [{
287
+ type: HostListener,
288
+ args: ['keydown', ['$event']]
289
+ }] } });
290
+
291
+ class ScrollDirective {
292
+ constructor() {
293
+ this.onScroll = new EventEmitter();
294
+ }
295
+ scrolled($event) {
296
+ this.elementSE($event);
297
+ }
298
+ windowScrolled($event) {
299
+ this.windowSE($event);
300
+ }
301
+ windowSE($event) {
302
+ const target = $event.target;
303
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
304
+ const header = scrollTop < 200;
305
+ const bottom = scrollTop > 200;
306
+ const emitVal = { header, bottom };
307
+ this.onScroll.emit(emitVal);
308
+ }
309
+ elementSE($event) {
310
+ const target = $event.target;
311
+ const header = target.scrollTop < 200;
312
+ const bottom = target.scrollTop > 200;
313
+ const emitVal = { header, bottom };
314
+ this.onScroll.emit(emitVal);
315
+ }
316
+ }
317
+ ScrollDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
318
+ ScrollDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: ScrollDirective, selector: "[fitScroll]", outputs: { onScroll: "onScroll" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0 });
319
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ScrollDirective, decorators: [{
320
+ type: Directive,
321
+ args: [{
322
+ selector: '[fitScroll]'
323
+ }]
324
+ }], ctorParameters: function () { return []; }, propDecorators: { onScroll: [{
325
+ type: Output
326
+ }], scrolled: [{
327
+ type: HostListener,
328
+ args: ['scroll', ['$event']]
329
+ }], windowScrolled: [{
330
+ type: HostListener,
331
+ args: ['window:scroll', ['$event']]
332
+ }] } });
333
+
334
+ class SensitiveDirective {
335
+ constructor(_el) {
336
+ this._el = _el;
337
+ this.caseType = '';
338
+ }
339
+ onKeyUp(event) {
340
+ const value = event.target.value;
341
+ if (this.caseType === 'upper') {
342
+ event.target.value = value.toUpperCase();
343
+ }
344
+ else if (this.caseType === 'lower') {
345
+ event.target.value = value.toLowerCase();
346
+ }
347
+ }
348
+ }
349
+ SensitiveDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: SensitiveDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
350
+ SensitiveDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: SensitiveDirective, selector: "[fitSensitive]", inputs: { caseType: ["fitSensitive", "caseType"] }, host: { listeners: { "input": "onKeyUp($event)" } }, ngImport: i0 });
351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: SensitiveDirective, decorators: [{
352
+ type: Directive,
353
+ args: [{
354
+ selector: '[fitSensitive]'
355
+ }]
356
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { caseType: [{
357
+ type: Input,
358
+ args: ['fitSensitive']
359
+ }], onKeyUp: [{
360
+ type: HostListener,
361
+ args: ['input', ['$event']]
362
+ }] } });
363
+
364
+ class ControlErrorDirective {
365
+ constructor(_elementRef, render2) {
366
+ this._elementRef = _elementRef;
367
+ this.render2 = render2;
368
+ this.FORMAT = 'DD/MM/YYYY';
369
+ this.msgRequired = 'El campo es obligatorio';
370
+ this.msgMinlength = 'Ingrese mínimo {requiredLength} caracteres';
371
+ this.msgMaxlength = 'Ingrese máximo {requiredLength} caracteres';
372
+ this.msgPattern = 'El formato del valor es inválido';
373
+ this.msgInvalidDate = 'La fecha es inválida';
374
+ this.msgMinDate = 'La fecha mínima es {minDate}';
375
+ this.msgMaxDate = 'La fecha máxima es {maxDate}';
376
+ }
377
+ set control(value) {
378
+ this._control = value;
379
+ this._control.valueChanges.subscribe(() => {
380
+ this.loadError();
381
+ });
382
+ }
383
+ get control() {
384
+ return this._control;
385
+ }
386
+ ngAfterViewInit() {
387
+ this.removeHtml();
388
+ }
389
+ loadError() {
390
+ if (this.control && (this.control.dirty || this.control.touched) && this.control.errors) {
391
+ this.removeHtml();
392
+ if (this.control.errors['required'] && !this.control.errors['matDatepickerParse']) {
393
+ this.createHtml(this.msgRequired);
394
+ }
395
+ else if (this.control.errors['minlength']) {
396
+ this.createHtml(this.msgMinlength.replace('{requiredLength}', this.control.errors['minlength'].requiredLength));
397
+ }
398
+ else if (this.control.errors['maxlength'] && !this.control.errors['minlength']) {
399
+ this.createHtml(this.msgMaxlength.replace('{requiredLength}', this.control.errors['maxlength'].requiredLength));
400
+ }
401
+ else if (this.control.errors['pattern'] && !this.control.errors['maxlength'] && !this.control.errors['minlength']) {
402
+ this.createHtml(this.msgPattern);
403
+ }
404
+ else if (this.control.errors['matDatepickerParse'] && this.control.errors['matDatepickerParse'].text) {
405
+ this.createHtml(this.msgInvalidDate);
406
+ }
407
+ else if (this.control.errors['matDatepickerMin'] && this.control.errors['matDatepickerMin'].min) {
408
+ const minDate = this.control.errors['matDatepickerMin'].min.format(this.FORMAT);
409
+ this.createHtml(this.msgMinDate.replace('{minDate}', minDate));
410
+ }
411
+ else if (this.control.errors['matDatepickerMax'] && this.control.errors['matDatepickerMax'].max) {
412
+ const maxDate = this.control.errors['matDatepickerMax'].max.format(this.FORMAT);
413
+ this.createHtml(this.msgMaxDate.replace('{maxDate}', maxDate));
414
+ }
415
+ }
416
+ }
417
+ removeHtml() {
418
+ if (this._elementRef.nativeElement.firstChild) {
419
+ this._elementRef.nativeElement.removeChild(this._elementRef.nativeElement.firstChild);
420
+ }
421
+ }
422
+ createHtml(message) {
423
+ this.render2.setProperty(this._elementRef.nativeElement, 'innerHTML', message);
424
+ }
425
+ }
426
+ ControlErrorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ControlErrorDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
427
+ ControlErrorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.1.3", type: ControlErrorDirective, selector: "[fitControlError]", inputs: { msgRequired: "msgRequired", msgMinlength: "msgMinlength", msgMaxlength: "msgMaxlength", msgPattern: "msgPattern", msgInvalidDate: "msgInvalidDate", msgMinDate: "msgMinDate", msgMaxDate: "msgMaxDate", control: "control" }, ngImport: i0 });
428
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: ControlErrorDirective, decorators: [{
429
+ type: Directive,
430
+ args: [{
431
+ selector: '[fitControlError]'
432
+ }]
433
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { msgRequired: [{
434
+ type: Input
435
+ }], msgMinlength: [{
436
+ type: Input
437
+ }], msgMaxlength: [{
438
+ type: Input
439
+ }], msgPattern: [{
440
+ type: Input
441
+ }], msgInvalidDate: [{
442
+ type: Input
443
+ }], msgMinDate: [{
444
+ type: Input
445
+ }], msgMaxDate: [{
446
+ type: Input
447
+ }], control: [{
448
+ type: Input
449
+ }] } });
450
+
451
+ class DirectiveModule {
452
+ }
453
+ DirectiveModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: DirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
454
+ DirectiveModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: DirectiveModule, declarations: [InputDirective,
455
+ SensitiveDirective,
456
+ ControlErrorDirective,
457
+ ScrollDirective,
458
+ HoverDirective], imports: [CommonModule], exports: [InputDirective,
459
+ SensitiveDirective,
460
+ ControlErrorDirective,
461
+ ScrollDirective,
462
+ HoverDirective] });
463
+ DirectiveModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: DirectiveModule, providers: [], imports: [[
464
+ CommonModule
465
+ ]] });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: DirectiveModule, decorators: [{
467
+ type: NgModule,
468
+ args: [{
469
+ imports: [
470
+ CommonModule
471
+ ],
472
+ declarations: [
473
+ InputDirective,
474
+ SensitiveDirective,
475
+ ControlErrorDirective,
476
+ ScrollDirective,
477
+ HoverDirective
478
+ ],
479
+ exports: [
480
+ InputDirective,
481
+ SensitiveDirective,
482
+ ControlErrorDirective,
483
+ ScrollDirective,
484
+ HoverDirective
485
+ ],
486
+ providers: []
487
+ }]
488
+ }] });
489
+
490
+ // directives
491
+
492
+ class MoneyPipe {
493
+ constructor(decimalPipe) {
494
+ this.decimalPipe = decimalPipe;
495
+ this._currency = FitCurrencyConst;
496
+ this._defaultCurrency = 'PEN';
497
+ this._defaultDecimal = 2;
498
+ }
499
+ transform(value, currency = this._defaultCurrency, decimal = this._defaultDecimal) {
500
+ const format = `.${decimal}-${decimal}`;
501
+ if (value && `${value}`.match(FitRegexConst.decimal)) {
502
+ return `${this._currency[currency]} ${this.decimalPipe.transform(Number(value), (format))}`;
503
+ }
504
+ return `${this._currency[currency]} ${this.decimalPipe.transform(0, (format))}`;
505
+ }
506
+ }
507
+ MoneyPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, deps: [{ token: i1.DecimalPipe }], target: i0.ɵɵFactoryTarget.Pipe });
508
+ MoneyPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, name: "fitMoney" });
509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: MoneyPipe, decorators: [{
510
+ type: Pipe,
511
+ args: [{
512
+ name: 'fitMoney'
513
+ }]
514
+ }], ctorParameters: function () { return [{ type: i1.DecimalPipe }]; } });
515
+
516
+ class PipeModule {
517
+ }
518
+ PipeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
519
+ PipeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, declarations: [MoneyPipe], imports: [CommonModule], exports: [MoneyPipe] });
520
+ PipeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, providers: [
521
+ DecimalPipe
522
+ ], imports: [[
523
+ CommonModule
524
+ ]] });
525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipeModule, decorators: [{
526
+ type: NgModule,
527
+ args: [{
528
+ imports: [
529
+ CommonModule
530
+ ],
531
+ declarations: [
532
+ MoneyPipe
533
+ ],
534
+ exports: [
535
+ MoneyPipe
536
+ ],
537
+ providers: [
538
+ DecimalPipe
539
+ ]
540
+ }]
541
+ }] });
542
+
543
+ // pipes
544
+
545
+ /**
546
+ * Generated bundle index. Do not edit.
547
+ */
548
+
549
+ export { ControlErrorDirective, DirectiveModule, FitCurrencyConst, FitRegexConst, HoverDirective, InputDirective, MoneyPipe, PipeModule, ScrollDirective, SensitiveDirective };
550
+ //# sourceMappingURL=fitcoders-shared.mjs.map