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