@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 +1,821 @@
1
1
  import { FormControl, FormGroup } from '@angular/forms';
2
- import * as moment from 'moment';
2
+ import moment from 'moment';
3
3
  import * as i0 from '@angular/core';
4
- import { Directive, Input, HostListener, EventEmitter, Output, NgModule, Pipe } from '@angular/core';
4
+ import { HostListener, Input, Directive, EventEmitter, Output, NgModule, Pipe, Inject, Injectable, PLATFORM_ID } from '@angular/core';
5
5
  import * as i1 from '@angular/common';
6
- import { CommonModule, DecimalPipe } from '@angular/common';
6
+ import { CommonModule, DecimalPipe, isPlatformBrowser, DOCUMENT } from '@angular/common';
7
+ import { BehaviorSubject, fromEvent, map } from 'rxjs';
7
8
 
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: '$'
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: '$'
206
207
  };
207
208
 
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
- }
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
+ }
219
220
  }
220
221
 
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
- }
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
+ }
252
253
  }
253
254
 
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
- }
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
+ }
322
323
  }
323
324
 
324
325
  // helper
325
326
 
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']
327
+ class HoverDirective {
328
+ elementRef;
329
+ hover = '';
330
+ constructor(elementRef) {
331
+ this.elementRef = elementRef;
332
+ }
333
+ onMouseEnter() {
334
+ this.setHoverEffect();
335
+ }
336
+ onMouseLeave() {
337
+ this.removeHoverEffect();
338
+ }
339
+ setHoverEffect() {
340
+ for (const _class of this.hover.split(' ')) {
341
+ this.elementRef.nativeElement.classList.add(_class);
342
+ }
343
+ }
344
+ removeHoverEffect() {
345
+ for (const _class of this.hover.split(' ')) {
346
+ this.elementRef.nativeElement.classList.remove(_class);
347
+ }
348
+ }
349
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: HoverDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
350
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: HoverDirective, isStandalone: true, selector: "[fitHover]", inputs: { hover: ["fitHover", "hover"] }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()" } }, ngImport: i0 });
351
+ }
352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: HoverDirective, decorators: [{
353
+ type: Directive,
354
+ args: [{
355
+ selector: '[fitHover]',
356
+ standalone: true
357
+ }]
358
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { hover: [{
359
+ type: Input,
360
+ args: ['fitHover']
361
+ }], onMouseEnter: [{
362
+ type: HostListener,
363
+ args: ['mouseenter']
364
+ }], onMouseLeave: [{
365
+ type: HostListener,
366
+ args: ['mouseleave']
364
367
  }] } });
365
368
 
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']]
369
+ class InputDirective {
370
+ el;
371
+ input = '';
372
+ space = false;
373
+ _regex = FitRegexConst;
374
+ _specialKeys = ['Backspace', 'Tab', 'Enter', 'Escape', 'End', 'Home', 'ArrowLeft', 'ArrowRight', 'Delete'];
375
+ constructor(el) {
376
+ this.el = el;
377
+ }
378
+ onKeyDown(event) {
379
+ if (!this.input) {
380
+ return;
381
+ }
382
+ if (this._specialKeys.indexOf(event.key) !== -1
383
+ || (event.keyCode === 65 && event.ctrlKey) // Allow: Ctrl+A
384
+ || (event.keyCode === 67 && event.ctrlKey) // Allow: Ctrl+C
385
+ || (event.keyCode === 86 && event.ctrlKey) // Allow: Ctrl+V
386
+ || (event.keyCode === 88 && event.ctrlKey) // Allow: Ctrl+X
387
+ ) {
388
+ return;
389
+ }
390
+ const current = this.el.nativeElement.value;
391
+ const next = current.concat(event.key);
392
+ const input = this.space && (this.input === 'alphabetical' || this.input === 'alphanumeric') ? `${this.input}s` : this.input;
393
+ if (next && !String(next).match(this._regex[input])) {
394
+ event.preventDefault();
395
+ }
396
+ }
397
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InputDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
398
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: InputDirective, isStandalone: true, selector: "[fitInput]", inputs: { input: ["fitInput", "input"], space: "space" }, host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 });
399
+ }
400
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: InputDirective, decorators: [{
401
+ type: Directive,
402
+ args: [{
403
+ selector: '[fitInput]',
404
+ standalone: true
405
+ }]
406
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { input: [{
407
+ type: Input,
408
+ args: ['fitInput']
409
+ }], space: [{
410
+ type: Input
411
+ }], onKeyDown: [{
412
+ type: HostListener,
413
+ args: ['keydown', ['$event']]
409
414
  }] } });
410
415
 
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']]
416
+ class ScrollDirective {
417
+ onScroll = new EventEmitter();
418
+ constructor() {
419
+ }
420
+ scrolled($event) {
421
+ this.elementSE($event);
422
+ }
423
+ windowScrolled($event) {
424
+ this.windowSE($event);
425
+ }
426
+ windowSE($event) {
427
+ const target = $event.target;
428
+ const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
429
+ const header = scrollTop < 200;
430
+ const bottom = scrollTop > 200;
431
+ const emitVal = { header, bottom };
432
+ this.onScroll.emit(emitVal);
433
+ }
434
+ elementSE($event) {
435
+ const target = $event.target;
436
+ const header = target.scrollTop < 200;
437
+ const bottom = target.scrollTop > 200;
438
+ const emitVal = { header, bottom };
439
+ this.onScroll.emit(emitVal);
440
+ }
441
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ScrollDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
442
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: ScrollDirective, isStandalone: true, selector: "[fitScroll]", outputs: { onScroll: "onScroll" }, host: { listeners: { "scroll": "scrolled($event)", "window:scroll": "windowScrolled($event)" } }, ngImport: i0 });
443
+ }
444
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ScrollDirective, decorators: [{
445
+ type: Directive,
446
+ args: [{
447
+ selector: '[fitScroll]',
448
+ standalone: true
449
+ }]
450
+ }], ctorParameters: () => [], propDecorators: { onScroll: [{
451
+ type: Output
452
+ }], scrolled: [{
453
+ type: HostListener,
454
+ args: ['scroll', ['$event']]
455
+ }], windowScrolled: [{
456
+ type: HostListener,
457
+ args: ['window:scroll', ['$event']]
452
458
  }] } });
453
459
 
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']]
460
+ class SensitiveDirective {
461
+ _el;
462
+ caseType = '';
463
+ constructor(_el) {
464
+ this._el = _el;
465
+ }
466
+ onKeyUp(event) {
467
+ const value = event.target.value;
468
+ if (this.caseType === 'upper') {
469
+ event.target.value = value.toUpperCase();
470
+ }
471
+ else if (this.caseType === 'lower') {
472
+ event.target.value = value.toLowerCase();
473
+ }
474
+ }
475
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SensitiveDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
476
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: SensitiveDirective, isStandalone: true, selector: "[fitSensitive]", inputs: { caseType: ["fitSensitive", "caseType"] }, host: { listeners: { "input": "onKeyUp($event)" } }, ngImport: i0 });
477
+ }
478
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: SensitiveDirective, decorators: [{
479
+ type: Directive,
480
+ args: [{
481
+ selector: '[fitSensitive]',
482
+ standalone: true
483
+ }]
484
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { caseType: [{
485
+ type: Input,
486
+ args: ['fitSensitive']
487
+ }], onKeyUp: [{
488
+ type: HostListener,
489
+ args: ['input', ['$event']]
482
490
  }] } });
483
491
 
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
492
+ class ControlErrorDirective {
493
+ _elementRef;
494
+ render2;
495
+ FORMAT = 'DD/MM/YYYY';
496
+ _control;
497
+ msgRequired = 'El campo es obligatorio';
498
+ msgMinlength = 'Ingrese mínimo {requiredLength} caracteres';
499
+ msgMaxlength = 'Ingrese máximo {requiredLength} caracteres';
500
+ msgPattern = 'El formato del valor es inválido';
501
+ msgInvalidDate = 'La fecha es inválida';
502
+ msgMinDate = 'La fecha mínima es {minDate}';
503
+ msgMaxDate = 'La fecha máxima es {maxDate}';
504
+ set control(value) {
505
+ this._control = value;
506
+ this._control.valueChanges.subscribe(() => {
507
+ this.loadError();
508
+ });
509
+ }
510
+ get control() {
511
+ return this._control;
512
+ }
513
+ constructor(_elementRef, render2) {
514
+ this._elementRef = _elementRef;
515
+ this.render2 = render2;
516
+ }
517
+ ngAfterViewInit() {
518
+ this.removeHtml();
519
+ }
520
+ loadError() {
521
+ if (this.control && (this.control.dirty || this.control.touched) && this.control.errors) {
522
+ this.removeHtml();
523
+ if (this.control.errors['required'] && !this.control.errors['matDatepickerParse']) {
524
+ this.createHtml(this.msgRequired);
525
+ }
526
+ else if (this.control.errors['minlength']) {
527
+ this.createHtml(this.msgMinlength.replace('{requiredLength}', this.control.errors['minlength'].requiredLength));
528
+ }
529
+ else if (this.control.errors['maxlength'] && !this.control.errors['minlength']) {
530
+ this.createHtml(this.msgMaxlength.replace('{requiredLength}', this.control.errors['maxlength'].requiredLength));
531
+ }
532
+ else if (this.control.errors['pattern'] && !this.control.errors['maxlength'] && !this.control.errors['minlength']) {
533
+ this.createHtml(this.msgPattern);
534
+ }
535
+ else if (this.control.errors['matDatepickerParse'] && this.control.errors['matDatepickerParse'].text) {
536
+ this.createHtml(this.msgInvalidDate);
537
+ }
538
+ else if (this.control.errors['matDatepickerMin'] && this.control.errors['matDatepickerMin'].min) {
539
+ const minDate = this.control.errors['matDatepickerMin'].min.format(this.FORMAT);
540
+ this.createHtml(this.msgMinDate.replace('{minDate}', minDate));
541
+ }
542
+ else if (this.control.errors['matDatepickerMax'] && this.control.errors['matDatepickerMax'].max) {
543
+ const maxDate = this.control.errors['matDatepickerMax'].max.format(this.FORMAT);
544
+ this.createHtml(this.msgMaxDate.replace('{maxDate}', maxDate));
545
+ }
546
+ }
547
+ }
548
+ removeHtml() {
549
+ if (this._elementRef.nativeElement.firstChild) {
550
+ this._elementRef.nativeElement.removeChild(this._elementRef.nativeElement.firstChild);
551
+ }
552
+ }
553
+ createHtml(message) {
554
+ this.render2.setProperty(this._elementRef.nativeElement, 'innerHTML', message);
555
+ }
556
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ControlErrorDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Directive });
557
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.18", type: ControlErrorDirective, isStandalone: true, selector: "[fitControlError]", inputs: { msgRequired: "msgRequired", msgMinlength: "msgMinlength", msgMaxlength: "msgMaxlength", msgPattern: "msgPattern", msgInvalidDate: "msgInvalidDate", msgMinDate: "msgMinDate", msgMaxDate: "msgMaxDate", control: "control" }, ngImport: i0 });
558
+ }
559
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: ControlErrorDirective, decorators: [{
560
+ type: Directive,
561
+ args: [{
562
+ selector: '[fitControlError]',
563
+ standalone: true
564
+ }]
565
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { msgRequired: [{
566
+ type: Input
567
+ }], msgMinlength: [{
568
+ type: Input
569
+ }], msgMaxlength: [{
570
+ type: Input
571
+ }], msgPattern: [{
572
+ type: Input
573
+ }], msgInvalidDate: [{
574
+ type: Input
575
+ }], msgMinDate: [{
576
+ type: Input
577
+ }], msgMaxDate: [{
578
+ type: Input
579
+ }], control: [{
580
+ type: Input
569
581
  }] } });
570
582
 
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
- }]
583
+ class FitDirectiveModule {
584
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
585
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: FitDirectiveModule, imports: [CommonModule,
586
+ InputDirective,
587
+ SensitiveDirective,
588
+ ControlErrorDirective,
589
+ ScrollDirective,
590
+ HoverDirective], exports: [InputDirective,
591
+ SensitiveDirective,
592
+ ControlErrorDirective,
593
+ ScrollDirective,
594
+ HoverDirective] });
595
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitDirectiveModule, imports: [CommonModule] });
596
+ }
597
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitDirectiveModule, decorators: [{
598
+ type: NgModule,
599
+ args: [{
600
+ imports: [
601
+ CommonModule,
602
+ InputDirective,
603
+ SensitiveDirective,
604
+ ControlErrorDirective,
605
+ ScrollDirective,
606
+ HoverDirective
607
+ ],
608
+ exports: [
609
+ InputDirective,
610
+ SensitiveDirective,
611
+ ControlErrorDirective,
612
+ ScrollDirective,
613
+ HoverDirective
614
+ ],
615
+ providers: []
616
+ }]
608
617
  }] });
609
618
 
610
619
  // directives
611
620
 
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 }]; } });
621
+ class FitMoneyPipe {
622
+ decimalPipe;
623
+ _currency = FitCurrencyConst;
624
+ _defaultCurrency = 'PEN';
625
+ _defaultDecimal = 2;
626
+ constructor(decimalPipe) {
627
+ this.decimalPipe = decimalPipe;
628
+ }
629
+ transform(value, currency = this._defaultCurrency, decimal = this._defaultDecimal) {
630
+ const format = `.${decimal}-${decimal}`;
631
+ if (value && `${value}`.match(FitRegexConst.decimal)) {
632
+ return `${this._currency[currency]} ${this.decimalPipe.transform(Number(value), (format))}`;
633
+ }
634
+ return `${this._currency[currency]} ${this.decimalPipe.transform(0, (format))}`;
635
+ }
636
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitMoneyPipe, deps: [{ token: i1.DecimalPipe }], target: i0.ɵɵFactoryTarget.Pipe });
637
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: FitMoneyPipe, isStandalone: true, name: "fitMoney" });
638
+ }
639
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitMoneyPipe, decorators: [{
640
+ type: Pipe,
641
+ args: [{
642
+ name: 'fitMoney',
643
+ standalone: true
644
+ }]
645
+ }], ctorParameters: () => [{ type: i1.DecimalPipe }] });
635
646
 
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
- }]
647
+ class FitPipeModule {
648
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitPipeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
649
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.18", ngImport: i0, type: FitPipeModule, imports: [CommonModule,
650
+ FitMoneyPipe], exports: [FitMoneyPipe] });
651
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitPipeModule, providers: [
652
+ DecimalPipe
653
+ ], imports: [CommonModule] });
654
+ }
655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitPipeModule, decorators: [{
656
+ type: NgModule,
657
+ args: [{
658
+ imports: [
659
+ CommonModule,
660
+ FitMoneyPipe
661
+ ],
662
+ exports: [
663
+ FitMoneyPipe
664
+ ],
665
+ providers: [
666
+ DecimalPipe
667
+ ]
668
+ }]
661
669
  }] });
662
670
 
663
671
  // pipes
664
672
 
665
- /**
666
- * Generated bundle index. Do not edit.
673
+ class FitAdapteService {
674
+ window;
675
+ sizeChanged;
676
+ constructor(window) {
677
+ this.window = window;
678
+ this.sizeChanged = new BehaviorSubject({
679
+ width: this.window.innerWidth,
680
+ height: this.window.innerHeight
681
+ });
682
+ fromEvent(window, 'resize').pipe(map(event => ({
683
+ width: event.currentTarget.innerWidth,
684
+ height: event.currentTarget.innerHeight
685
+ }))).subscribe((windowSize) => {
686
+ this.sizeChanged.next(windowSize);
687
+ });
688
+ }
689
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitAdapteService, deps: [{ token: 'windowObject' }], target: i0.ɵɵFactoryTarget.Injectable });
690
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitAdapteService });
691
+ }
692
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitAdapteService, decorators: [{
693
+ type: Injectable
694
+ }], ctorParameters: () => [{ type: Window, decorators: [{
695
+ type: Inject,
696
+ args: ['windowObject']
697
+ }] }] });
698
+
699
+ class FitCookiesService {
700
+ document;
701
+ platformId;
702
+ documentIsAccessible;
703
+ constructor(document, platformId) {
704
+ this.document = document;
705
+ this.platformId = platformId;
706
+ this.documentIsAccessible = isPlatformBrowser(this.platformId);
707
+ }
708
+ check(name) {
709
+ if (!this.documentIsAccessible) {
710
+ return false;
711
+ }
712
+ name = encodeURIComponent(name);
713
+ const regExp = this.getCookieRegExp(name);
714
+ const exists = regExp.test(this.document.cookie);
715
+ return exists;
716
+ }
717
+ get(name) {
718
+ if (this.documentIsAccessible && this.check(name)) {
719
+ name = encodeURIComponent(name);
720
+ const regExp = this.getCookieRegExp(name);
721
+ const result = regExp.exec(this.document.cookie);
722
+ return this.safeDecodeURIComponent(result[1]);
723
+ }
724
+ else {
725
+ return '';
726
+ }
727
+ }
728
+ getAll() {
729
+ if (!this.documentIsAccessible) {
730
+ return {};
731
+ }
732
+ const cookies = {};
733
+ const document = this.document;
734
+ if (document.cookie && document.cookie !== '') {
735
+ document.cookie.split(';').forEach((currentCookie) => {
736
+ const [cookieName, cookieValue] = currentCookie.split('=');
737
+ cookies[this.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = this.safeDecodeURIComponent(cookieValue);
738
+ });
739
+ }
740
+ return cookies;
741
+ }
742
+ set(name, value, expires, path, domain, secure, sameSite = 'Lax') {
743
+ if (!this.documentIsAccessible) {
744
+ return;
745
+ }
746
+ let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';
747
+ if (expires) {
748
+ if (typeof expires === 'number') {
749
+ const dateExpires = new Date(new Date().getTime() + expires * 1000 * 60 * 60 * 24);
750
+ cookieString += 'expires=' + dateExpires.toUTCString() + ';';
751
+ }
752
+ else {
753
+ cookieString += 'expires=' + expires.toUTCString() + ';';
754
+ }
755
+ }
756
+ if (path) {
757
+ cookieString += 'path=' + path + ';';
758
+ }
759
+ if (domain) {
760
+ cookieString += 'domain=' + domain + ';';
761
+ }
762
+ if (secure === false && sameSite === 'None') {
763
+ secure = true;
764
+ }
765
+ if (secure) {
766
+ cookieString += 'secure;';
767
+ }
768
+ cookieString += 'sameSite=' + sameSite + ';';
769
+ this.document.cookie = cookieString;
770
+ }
771
+ delete(name, path, domain, secure, sameSite = 'Lax') {
772
+ if (!this.documentIsAccessible) {
773
+ return;
774
+ }
775
+ this.set(name, '', new Date('Thu, 01 Jan 1970 00:00:01 GMT'), path, domain, secure, sameSite);
776
+ }
777
+ deleteAll(path, domain, secure, sameSite = 'Lax') {
778
+ if (!this.documentIsAccessible) {
779
+ return;
780
+ }
781
+ const cookies = this.getAll();
782
+ for (const cookieName in cookies) {
783
+ if (cookies.hasOwnProperty(cookieName)) {
784
+ this.delete(cookieName, path, domain, secure, sameSite);
785
+ }
786
+ }
787
+ }
788
+ getCookieRegExp(name) {
789
+ const escapedName = name.replace(/([\[\]\{\}\(\)\|\=\;\+\?\,\.\*\^\$])/gi, '\\$1');
790
+ return new RegExp('(?:^' + escapedName + '|;\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');
791
+ }
792
+ safeDecodeURIComponent(encodedURIComponent) {
793
+ try {
794
+ return decodeURIComponent(encodedURIComponent);
795
+ }
796
+ catch {
797
+ return encodedURIComponent;
798
+ }
799
+ }
800
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitCookiesService, deps: [{ token: DOCUMENT }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
801
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitCookiesService, providedIn: 'root' });
802
+ }
803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.18", ngImport: i0, type: FitCookiesService, decorators: [{
804
+ type: Injectable,
805
+ args: [{ providedIn: 'root' }]
806
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
807
+ type: Inject,
808
+ args: [DOCUMENT]
809
+ }] }, { type: i0.InjectionToken, decorators: [{
810
+ type: Inject,
811
+ args: [PLATFORM_ID]
812
+ }] }] });
813
+
814
+ // service
815
+
816
+ /**
817
+ * Generated bundle index. Do not edit.
667
818
  */
668
819
 
669
- export { ControlErrorDirective, FitCurrencyConst, FitDirectiveModule, FitFormUtil, FitGeneralUtil, FitMoneyPipe, FitPipeModule, FitRegexConst, FitValidateUtil, HoverDirective, InputDirective, ScrollDirective, SensitiveDirective };
820
+ export { ControlErrorDirective, FitAdapteService, FitCookiesService, FitCurrencyConst, FitDirectiveModule, FitFormUtil, FitGeneralUtil, FitMoneyPipe, FitPipeModule, FitRegexConst, FitValidateUtil, HoverDirective, InputDirective, ScrollDirective, SensitiveDirective };
670
821
  //# sourceMappingURL=fitcoders-shared.mjs.map