@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.
- package/{fesm2020 → fesm2022}/fitcoders-shared.mjs +778 -766
- package/fesm2022/fitcoders-shared.mjs.map +1 -0
- package/{fitcoders-shared.d.ts → index.d.ts} +5 -5
- package/lib/constant/shared.const.d.ts +199 -199
- package/lib/directive/directive-api.d.ts +6 -6
- package/lib/directive/directives/control-error.directive.d.ts +25 -25
- package/lib/directive/directives/hover.directive.d.ts +13 -13
- package/lib/directive/directives/input.directive.d.ts +14 -14
- package/lib/directive/directives/scroll.directive.d.ts +16 -16
- package/lib/directive/directives/sensitive.directive.d.ts +10 -10
- package/lib/directive/fit-directive.module.d.ts +12 -12
- package/lib/helper/fit-form.util.d.ts +6 -6
- package/lib/helper/fit-general.util.d.ts +3 -3
- package/lib/helper/fit-validate.util.d.ts +13 -13
- package/lib/helper/helper-api.d.ts +3 -3
- package/lib/pipe/fit-pipe.module.d.ts +8 -8
- package/lib/pipe/pipe-api.d.ts +2 -2
- package/lib/pipe/pipes/fit-money.pipe.d.ts +13 -13
- package/lib/service/fit-adapte.service.d.ts +13 -13
- package/lib/service/fit-cookies.service.d.ts +20 -20
- package/lib/service/service-api.d.ts +2 -2
- package/package.json +15 -15
- package/public-api.d.ts +5 -5
- package/esm2020/fitcoders-shared.mjs +0 -5
- package/esm2020/lib/constant/shared.const.mjs +0 -200
- package/esm2020/lib/directive/directive-api.mjs +0 -9
- package/esm2020/lib/directive/directives/control-error.directive.mjs +0 -89
- package/esm2020/lib/directive/directives/hover.directive.mjs +0 -42
- package/esm2020/lib/directive/directives/input.directive.mjs +0 -48
- package/esm2020/lib/directive/directives/scroll.directive.mjs +0 -45
- package/esm2020/lib/directive/directives/sensitive.directive.mjs +0 -32
- package/esm2020/lib/directive/fit-directive.module.mjs +0 -47
- package/esm2020/lib/helper/fit-form.util.mjs +0 -34
- package/esm2020/lib/helper/fit-general.util.mjs +0 -13
- package/esm2020/lib/helper/fit-validate.util.mjs +0 -71
- package/esm2020/lib/helper/helper-api.mjs +0 -5
- package/esm2020/lib/pipe/fit-pipe.module.mjs +0 -31
- package/esm2020/lib/pipe/pipe-api.mjs +0 -5
- package/esm2020/lib/pipe/pipes/fit-money.pipe.mjs +0 -28
- package/esm2020/lib/service/fit-adapte.service.mjs +0 -27
- package/esm2020/lib/service/fit-cookies.service.mjs +0 -115
- package/esm2020/lib/service/service-api.mjs +0 -4
- package/esm2020/public-api.mjs +0 -6
- package/fesm2015/fitcoders-shared.mjs +0 -813
- package/fesm2015/fitcoders-shared.mjs.map +0 -1
- package/fesm2020/fitcoders-shared.mjs.map +0 -1
|
@@ -1,808 +1,820 @@
|
|
|
1
1
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
-
import
|
|
2
|
+
import moment from 'moment';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
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
6
|
import { CommonModule, DecimalPipe, isPlatformBrowser, DOCUMENT } from '@angular/common';
|
|
7
7
|
import { BehaviorSubject, fromEvent, map } from 'rxjs';
|
|
8
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: '$'
|
|
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
207
|
};
|
|
208
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
|
-
}
|
|
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
220
|
}
|
|
221
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
|
-
}
|
|
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
253
|
}
|
|
254
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
|
-
}
|
|
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
323
|
}
|
|
324
324
|
|
|
325
325
|
// helper
|
|
326
326
|
|
|
327
|
-
class HoverDirective {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
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']
|
|
365
367
|
}] } });
|
|
366
368
|
|
|
367
|
-
class InputDirective {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|| (event.keyCode ===
|
|
382
|
-
|| (event.keyCode ===
|
|
383
|
-
|| (event.keyCode ===
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const
|
|
389
|
-
const
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}],
|
|
408
|
-
type:
|
|
409
|
-
|
|
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']]
|
|
410
414
|
}] } });
|
|
411
415
|
|
|
412
|
-
class ScrollDirective {
|
|
413
|
-
|
|
414
|
-
|
|
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
|
-
|
|
439
|
-
|
|
440
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
441
|
-
type: Directive,
|
|
442
|
-
args: [{
|
|
443
|
-
selector: '[fitScroll]'
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
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']]
|
|
453
458
|
}] } });
|
|
454
459
|
|
|
455
|
-
class SensitiveDirective {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
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']]
|
|
483
490
|
}] } });
|
|
484
491
|
|
|
485
|
-
class ControlErrorDirective {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
this._control
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
this.
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
this.createHtml(this.
|
|
518
|
-
}
|
|
519
|
-
else if (this.control.errors['
|
|
520
|
-
this.createHtml(this.
|
|
521
|
-
}
|
|
522
|
-
else if (this.control.errors['
|
|
523
|
-
this.createHtml(this.
|
|
524
|
-
}
|
|
525
|
-
else if (this.control.errors['
|
|
526
|
-
this.createHtml(this.
|
|
527
|
-
}
|
|
528
|
-
else if (this.control.errors['
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
i0.ɵɵ
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
type: Input
|
|
560
|
-
}],
|
|
561
|
-
type: Input
|
|
562
|
-
}],
|
|
563
|
-
type: Input
|
|
564
|
-
}],
|
|
565
|
-
type: Input
|
|
566
|
-
}],
|
|
567
|
-
type: Input
|
|
568
|
-
}],
|
|
569
|
-
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
|
|
570
581
|
}] } });
|
|
571
582
|
|
|
572
|
-
class FitDirectiveModule {
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
],
|
|
607
|
-
providers: []
|
|
608
|
-
}]
|
|
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
|
+
}]
|
|
609
617
|
}] });
|
|
610
618
|
|
|
611
619
|
// directives
|
|
612
620
|
|
|
613
|
-
class FitMoneyPipe {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
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 }] });
|
|
636
646
|
|
|
637
|
-
class FitPipeModule {
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
],
|
|
652
|
-
|
|
653
|
-
FitMoneyPipe
|
|
654
|
-
],
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
]
|
|
658
|
-
|
|
659
|
-
DecimalPipe
|
|
660
|
-
]
|
|
661
|
-
}]
|
|
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
|
+
}]
|
|
662
669
|
}] });
|
|
663
670
|
|
|
664
671
|
// pipes
|
|
665
672
|
|
|
666
|
-
class FitAdapteService {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
})
|
|
679
|
-
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
i0.ɵɵ
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
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
|
+
}] }] });
|
|
689
698
|
|
|
690
|
-
class FitCookiesService {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
return
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
cookieString += 'expires=' +
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
}
|
|
747
|
-
if (
|
|
748
|
-
cookieString += '
|
|
749
|
-
}
|
|
750
|
-
if (
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
if (secure) {
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
this.
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
return encodedURIComponent;
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
i0.ɵɵ
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
type: Inject,
|
|
799
|
-
args: [
|
|
800
|
-
}] }
|
|
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
|
+
}] }] });
|
|
801
813
|
|
|
802
814
|
// service
|
|
803
815
|
|
|
804
|
-
/**
|
|
805
|
-
* Generated bundle index. Do not edit.
|
|
816
|
+
/**
|
|
817
|
+
* Generated bundle index. Do not edit.
|
|
806
818
|
*/
|
|
807
819
|
|
|
808
820
|
export { ControlErrorDirective, FitAdapteService, FitCookiesService, FitCurrencyConst, FitDirectiveModule, FitFormUtil, FitGeneralUtil, FitMoneyPipe, FitPipeModule, FitRegexConst, FitValidateUtil, HoverDirective, InputDirective, ScrollDirective, SensitiveDirective };
|