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