monkey-front-core 0.0.418 → 0.0.419
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/esm2020/lib/core/utils/utils.mjs +2 -3
- package/esm2020/lib/core/utils/validators.mjs +2 -2
- package/fesm2015/monkey-front-core.mjs +257 -257
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +254 -254
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/utils/validators.d.ts +0 -1
- package/monkey-front-core-0.0.419.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.418.tgz +0 -0
|
@@ -137,244 +137,6 @@ var statics = /*#__PURE__*/Object.freeze({
|
|
|
137
137
|
get CountryMasks () { return CountryMasks; }
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
-
const moment$6 = moment_;
|
|
141
|
-
const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
|
|
142
|
-
function isEmptyInputValue(value) {
|
|
143
|
-
return value == null || value.length === 0;
|
|
144
|
-
}
|
|
145
|
-
function emailValidator(control) {
|
|
146
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
const test = EMAIL_REGEXP.test(control.value);
|
|
150
|
-
if (test)
|
|
151
|
-
return null;
|
|
152
|
-
return {
|
|
153
|
-
email: true
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function dateRangeValidator(control) {
|
|
157
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
const dates = control?.parent?.get('dates')?.value;
|
|
161
|
-
if (dates &&
|
|
162
|
-
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
|
|
163
|
-
!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
|
|
164
|
-
return {
|
|
165
|
-
dateRange: true
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
function registerValidator(control, type) {
|
|
171
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
175
|
-
return {
|
|
176
|
-
invalidUnlockRegister: true
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
function dateStartEndValidator(control) {
|
|
182
|
-
if (!control.parent || !control) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
const { parent } = control;
|
|
186
|
-
const valueStart = parent?.get('dateStart')?.value;
|
|
187
|
-
const valueEnd = parent?.get('dateEnd')?.value;
|
|
188
|
-
let dateStart = null;
|
|
189
|
-
let dateEnd = null;
|
|
190
|
-
if (valueStart) {
|
|
191
|
-
dateStart = new Date(valueStart);
|
|
192
|
-
}
|
|
193
|
-
if (valueEnd) {
|
|
194
|
-
dateEnd = new Date(valueEnd);
|
|
195
|
-
}
|
|
196
|
-
if (!dateEnd || !dateStart)
|
|
197
|
-
return null;
|
|
198
|
-
if (dateStart > dateEnd) {
|
|
199
|
-
return {
|
|
200
|
-
dateStartMustBeLessThanAnd: true
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
function urlValidator(control) {
|
|
206
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
207
|
-
return null;
|
|
208
|
-
if (!MonkeyEcxUtils.isValidUrl(control.value)) {
|
|
209
|
-
return {
|
|
210
|
-
url: true
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
return null;
|
|
214
|
-
}
|
|
215
|
-
function passwordConfirmValidator(control) {
|
|
216
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
217
|
-
return null;
|
|
218
|
-
const { parent } = control;
|
|
219
|
-
const password = parent?.get('password')?.value;
|
|
220
|
-
const passwordConfirm = parent?.get('passwordConfirm')?.value;
|
|
221
|
-
if (!password || !passwordConfirm)
|
|
222
|
-
return null;
|
|
223
|
-
if (password === passwordConfirm)
|
|
224
|
-
return null;
|
|
225
|
-
return {
|
|
226
|
-
passwordsNotMatching: true
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
function trueValidator(control) {
|
|
230
|
-
if (!control.parent || !control)
|
|
231
|
-
return null;
|
|
232
|
-
if (control && control.value !== false)
|
|
233
|
-
return null;
|
|
234
|
-
return {
|
|
235
|
-
invalidTrue: true
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function comboValidator(control) {
|
|
239
|
-
if (!control.parent || !control)
|
|
240
|
-
return null;
|
|
241
|
-
if (control && control.value !== '0')
|
|
242
|
-
return null;
|
|
243
|
-
return {
|
|
244
|
-
invalidCombo: true
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
|
-
function zipCodeValidator(control, country) {
|
|
248
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
249
|
-
return null;
|
|
250
|
-
if (control && control.value) {
|
|
251
|
-
if (!MonkeyEcxUtils.isValidZipCode(control.value, country)) {
|
|
252
|
-
return {
|
|
253
|
-
invalidZipCode: true
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
function documentValidator(control, country) {
|
|
260
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
261
|
-
return null;
|
|
262
|
-
if (country === 'BR') {
|
|
263
|
-
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
264
|
-
return {
|
|
265
|
-
invalidCpfCnpj: true
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
else if (country === 'CL') {
|
|
270
|
-
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
271
|
-
return {
|
|
272
|
-
invalidCpfCnpj: true
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
function dateValidator(control) {
|
|
279
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
280
|
-
return null;
|
|
281
|
-
const dateFormat = 'MM-DD-YYYY';
|
|
282
|
-
if (!moment$6
|
|
283
|
-
.default(moment$6.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
284
|
-
.isValid()) {
|
|
285
|
-
return {
|
|
286
|
-
invalidDate: true
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
return null;
|
|
290
|
-
}
|
|
291
|
-
function valueGreaterThanZero(control) {
|
|
292
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
293
|
-
return null;
|
|
294
|
-
if (control && `${control?.value}` === '0') {
|
|
295
|
-
return {
|
|
296
|
-
invalidValueGreaterThanZero: true
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
function requiredWithTrimValidator(control) {
|
|
302
|
-
if (!control.parent || !control)
|
|
303
|
-
return null;
|
|
304
|
-
if (control && !`${control?.value}`.trim()) {
|
|
305
|
-
return {
|
|
306
|
-
required: true
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
return null;
|
|
310
|
-
}
|
|
311
|
-
function differentFromZero(control) {
|
|
312
|
-
if (!control.parent || !control)
|
|
313
|
-
return null;
|
|
314
|
-
const handled = `${control?.value}`.trim().replace(/0/g, '');
|
|
315
|
-
if (control && !handled) {
|
|
316
|
-
return {
|
|
317
|
-
differentFromZero: true
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
return null;
|
|
321
|
-
}
|
|
322
|
-
class Validators {
|
|
323
|
-
static email(control) {
|
|
324
|
-
return emailValidator(control);
|
|
325
|
-
}
|
|
326
|
-
static dateRange(control) {
|
|
327
|
-
return dateRangeValidator(control);
|
|
328
|
-
}
|
|
329
|
-
static unlockSponsorRegister(control) {
|
|
330
|
-
return registerValidator(control, 'sponsor');
|
|
331
|
-
}
|
|
332
|
-
static unlockBuyerRegister(control) {
|
|
333
|
-
return registerValidator(control, 'buyer');
|
|
334
|
-
}
|
|
335
|
-
static dateStartEnd(control) {
|
|
336
|
-
return dateStartEndValidator(control);
|
|
337
|
-
}
|
|
338
|
-
static url(control) {
|
|
339
|
-
return urlValidator(control);
|
|
340
|
-
}
|
|
341
|
-
static passwordConfirm(control) {
|
|
342
|
-
return passwordConfirmValidator(control);
|
|
343
|
-
}
|
|
344
|
-
static true(control) {
|
|
345
|
-
return trueValidator(control);
|
|
346
|
-
}
|
|
347
|
-
static combo(control) {
|
|
348
|
-
return comboValidator(control);
|
|
349
|
-
}
|
|
350
|
-
static zipCode(control) {
|
|
351
|
-
return zipCodeValidator(control);
|
|
352
|
-
}
|
|
353
|
-
static zipCodeByCountry(country) {
|
|
354
|
-
return (control) => {
|
|
355
|
-
return zipCodeValidator(control, country);
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
static documentBR(control) {
|
|
359
|
-
return documentValidator(control, 'BR');
|
|
360
|
-
}
|
|
361
|
-
static documentCL(control) {
|
|
362
|
-
return documentValidator(control, 'CL');
|
|
363
|
-
}
|
|
364
|
-
static date(control) {
|
|
365
|
-
return dateValidator(control);
|
|
366
|
-
}
|
|
367
|
-
static greaterThanZero(control) {
|
|
368
|
-
return valueGreaterThanZero(control);
|
|
369
|
-
}
|
|
370
|
-
static required(control) {
|
|
371
|
-
return requiredWithTrimValidator(control);
|
|
372
|
-
}
|
|
373
|
-
static differentFromZero(control) {
|
|
374
|
-
return differentFromZero(control);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
140
|
/* eslint-disable comma-dangle */
|
|
379
141
|
/* eslint-disable block-scoped-var */
|
|
380
142
|
class MonkeyEcxUtils {
|
|
@@ -520,7 +282,7 @@ class MonkeyEcxUtils {
|
|
|
520
282
|
return `${this.handleOnlyNumbers(zipCode)}`.length === length;
|
|
521
283
|
}
|
|
522
284
|
static isValidEmail(email) {
|
|
523
|
-
return
|
|
285
|
+
return /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/.test(email || '');
|
|
524
286
|
}
|
|
525
287
|
static getRandomString(len, charSet) {
|
|
526
288
|
charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
@@ -620,14 +382,14 @@ class MonkeyEcxUtils {
|
|
|
620
382
|
}
|
|
621
383
|
}
|
|
622
384
|
|
|
623
|
-
const moment$
|
|
385
|
+
const moment$6 = moment_;
|
|
624
386
|
class MonkeyEcxFormatDateTimelapsePipe {
|
|
625
387
|
transform(date, showTime = false, useUtc = true, format = '- HH:mm') {
|
|
626
388
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
627
389
|
return '';
|
|
628
|
-
let stillUtc = moment$
|
|
390
|
+
let stillUtc = moment$6.default.utc(date).toDate();
|
|
629
391
|
if (!useUtc)
|
|
630
|
-
stillUtc = moment$
|
|
392
|
+
stillUtc = moment$6.default(date).toDate();
|
|
631
393
|
if (date.toString().indexOf(':') <= -1) {
|
|
632
394
|
if (typeof date === 'string') {
|
|
633
395
|
stillUtc = date;
|
|
@@ -636,7 +398,7 @@ class MonkeyEcxFormatDateTimelapsePipe {
|
|
|
636
398
|
}
|
|
637
399
|
const formatFrom = `YYYY/MM/DD${showTime ? ` ${format}` : ''}`;
|
|
638
400
|
const formatTo = `DD/MM/YYYY${showTime ? ` ${format}` : ''}`;
|
|
639
|
-
return `${moment$
|
|
401
|
+
return `${moment$6.default(stillUtc, formatFrom).format(formatTo)}`;
|
|
640
402
|
}
|
|
641
403
|
}
|
|
642
404
|
MonkeyEcxFormatDateTimelapsePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -872,7 +634,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
872
634
|
}]
|
|
873
635
|
}] });
|
|
874
636
|
|
|
875
|
-
const moment$
|
|
637
|
+
const moment$5 = moment_;
|
|
876
638
|
class MonkeyEcxDisplaySupportPhone {
|
|
877
639
|
constructor() {
|
|
878
640
|
// not to do
|
|
@@ -888,9 +650,9 @@ class MonkeyEcxDisplaySupportPhone {
|
|
|
888
650
|
});
|
|
889
651
|
}
|
|
890
652
|
isPhoneOnline(phone) {
|
|
891
|
-
const start = moment$
|
|
892
|
-
const end = moment$
|
|
893
|
-
return moment$
|
|
653
|
+
const start = moment$5.default().startOf('day').add(phone?.startHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
654
|
+
const end = moment$5.default().startOf('day').add(phone?.endHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
655
|
+
return moment$5.default().isSameOrAfter(start) && moment$5.default().isSameOrBefore(end);
|
|
894
656
|
}
|
|
895
657
|
}
|
|
896
658
|
MonkeyEcxDisplaySupportPhone.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDisplaySupportPhone, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -1008,7 +770,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1008
770
|
}]
|
|
1009
771
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.CurrencyPipe }]; } });
|
|
1010
772
|
|
|
1011
|
-
const moment$
|
|
773
|
+
const moment$4 = moment_;
|
|
1012
774
|
class MonkeyEcxFormatDateGroupPipe {
|
|
1013
775
|
constructor(injector) {
|
|
1014
776
|
this.injector = injector;
|
|
@@ -1019,12 +781,12 @@ class MonkeyEcxFormatDateGroupPipe {
|
|
|
1019
781
|
format(date) {
|
|
1020
782
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
1021
783
|
return '';
|
|
1022
|
-
let stillUtc = moment$
|
|
784
|
+
let stillUtc = moment$4.default.utc(date).toDate();
|
|
1023
785
|
if (date.toString()?.indexOf(':') <= -1) {
|
|
1024
786
|
stillUtc = date;
|
|
1025
787
|
}
|
|
1026
788
|
const formatFrom = 'YYYY/MM/DD';
|
|
1027
|
-
const fmt = moment$
|
|
789
|
+
const fmt = moment$4.default(stillUtc, formatFrom).locale(this.lang);
|
|
1028
790
|
const dayFormated = fmt.format('DD/');
|
|
1029
791
|
const monthFormated = MonkeyEcxUtils.capitalize(fmt.format('MMMM'));
|
|
1030
792
|
const yearFormated = fmt.format('YYYY');
|
|
@@ -1048,15 +810,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1048
810
|
}]
|
|
1049
811
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
1050
812
|
|
|
1051
|
-
const moment$
|
|
813
|
+
const moment$3 = moment_;
|
|
1052
814
|
class DateValidator {
|
|
1053
815
|
static do(control) {
|
|
1054
816
|
if (!control.parent || !control)
|
|
1055
817
|
return null;
|
|
1056
818
|
if (control && control.value) {
|
|
1057
819
|
const dateFormat = 'MM-DD-YYYY';
|
|
1058
|
-
if (!moment$
|
|
1059
|
-
.default(moment$
|
|
820
|
+
if (!moment$3
|
|
821
|
+
.default(moment$3.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
1060
822
|
.isValid()) {
|
|
1061
823
|
return {
|
|
1062
824
|
invalidDate: true
|
|
@@ -1314,6 +1076,244 @@ var decoratorsUtils = /*#__PURE__*/Object.freeze({
|
|
|
1314
1076
|
hasMonkeyEcxServiceAndHandlingProperties: hasMonkeyEcxServiceAndHandlingProperties
|
|
1315
1077
|
});
|
|
1316
1078
|
|
|
1079
|
+
const moment$2 = moment_;
|
|
1080
|
+
const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
|
|
1081
|
+
function isEmptyInputValue(value) {
|
|
1082
|
+
return value == null || value.length === 0;
|
|
1083
|
+
}
|
|
1084
|
+
function emailValidator(control) {
|
|
1085
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1086
|
+
return null;
|
|
1087
|
+
}
|
|
1088
|
+
const test = EMAIL_REGEXP.test(control.value);
|
|
1089
|
+
if (test)
|
|
1090
|
+
return null;
|
|
1091
|
+
return {
|
|
1092
|
+
email: true
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
function dateRangeValidator(control) {
|
|
1096
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1097
|
+
return null;
|
|
1098
|
+
}
|
|
1099
|
+
const dates = control?.parent?.get('dates')?.value;
|
|
1100
|
+
if (dates &&
|
|
1101
|
+
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
|
|
1102
|
+
!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
|
|
1103
|
+
return {
|
|
1104
|
+
dateRange: true
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
return null;
|
|
1108
|
+
}
|
|
1109
|
+
function registerValidator(control, type) {
|
|
1110
|
+
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1111
|
+
return null;
|
|
1112
|
+
}
|
|
1113
|
+
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
1114
|
+
return {
|
|
1115
|
+
invalidUnlockRegister: true
|
|
1116
|
+
};
|
|
1117
|
+
}
|
|
1118
|
+
return null;
|
|
1119
|
+
}
|
|
1120
|
+
function dateStartEndValidator(control) {
|
|
1121
|
+
if (!control.parent || !control) {
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
const { parent } = control;
|
|
1125
|
+
const valueStart = parent?.get('dateStart')?.value;
|
|
1126
|
+
const valueEnd = parent?.get('dateEnd')?.value;
|
|
1127
|
+
let dateStart = null;
|
|
1128
|
+
let dateEnd = null;
|
|
1129
|
+
if (valueStart) {
|
|
1130
|
+
dateStart = new Date(valueStart);
|
|
1131
|
+
}
|
|
1132
|
+
if (valueEnd) {
|
|
1133
|
+
dateEnd = new Date(valueEnd);
|
|
1134
|
+
}
|
|
1135
|
+
if (!dateEnd || !dateStart)
|
|
1136
|
+
return null;
|
|
1137
|
+
if (dateStart > dateEnd) {
|
|
1138
|
+
return {
|
|
1139
|
+
dateStartMustBeLessThanAnd: true
|
|
1140
|
+
};
|
|
1141
|
+
}
|
|
1142
|
+
return null;
|
|
1143
|
+
}
|
|
1144
|
+
function urlValidator(control) {
|
|
1145
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1146
|
+
return null;
|
|
1147
|
+
if (!MonkeyEcxUtils.isValidUrl(control.value)) {
|
|
1148
|
+
return {
|
|
1149
|
+
url: true
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
function passwordConfirmValidator(control) {
|
|
1155
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1156
|
+
return null;
|
|
1157
|
+
const { parent } = control;
|
|
1158
|
+
const password = parent?.get('password')?.value;
|
|
1159
|
+
const passwordConfirm = parent?.get('passwordConfirm')?.value;
|
|
1160
|
+
if (!password || !passwordConfirm)
|
|
1161
|
+
return null;
|
|
1162
|
+
if (password === passwordConfirm)
|
|
1163
|
+
return null;
|
|
1164
|
+
return {
|
|
1165
|
+
passwordsNotMatching: true
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
function trueValidator(control) {
|
|
1169
|
+
if (!control.parent || !control)
|
|
1170
|
+
return null;
|
|
1171
|
+
if (control && control.value !== false)
|
|
1172
|
+
return null;
|
|
1173
|
+
return {
|
|
1174
|
+
invalidTrue: true
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
function comboValidator(control) {
|
|
1178
|
+
if (!control.parent || !control)
|
|
1179
|
+
return null;
|
|
1180
|
+
if (control && control.value !== '0')
|
|
1181
|
+
return null;
|
|
1182
|
+
return {
|
|
1183
|
+
invalidCombo: true
|
|
1184
|
+
};
|
|
1185
|
+
}
|
|
1186
|
+
function zipCodeValidator(control, country) {
|
|
1187
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1188
|
+
return null;
|
|
1189
|
+
if (control && control.value) {
|
|
1190
|
+
if (!MonkeyEcxUtils.isValidZipCode(control.value, country)) {
|
|
1191
|
+
return {
|
|
1192
|
+
invalidZipCode: true
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
function documentValidator(control, country) {
|
|
1199
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1200
|
+
return null;
|
|
1201
|
+
if (country === 'BR') {
|
|
1202
|
+
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
1203
|
+
return {
|
|
1204
|
+
invalidCpfCnpj: true
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
else if (country === 'CL') {
|
|
1209
|
+
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
1210
|
+
return {
|
|
1211
|
+
invalidCpfCnpj: true
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
return null;
|
|
1216
|
+
}
|
|
1217
|
+
function dateValidator(control) {
|
|
1218
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1219
|
+
return null;
|
|
1220
|
+
const dateFormat = 'MM-DD-YYYY';
|
|
1221
|
+
if (!moment$2
|
|
1222
|
+
.default(moment$2.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
1223
|
+
.isValid()) {
|
|
1224
|
+
return {
|
|
1225
|
+
invalidDate: true
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
function valueGreaterThanZero(control) {
|
|
1231
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1232
|
+
return null;
|
|
1233
|
+
if (control && `${control?.value}` === '0') {
|
|
1234
|
+
return {
|
|
1235
|
+
invalidValueGreaterThanZero: true
|
|
1236
|
+
};
|
|
1237
|
+
}
|
|
1238
|
+
return null;
|
|
1239
|
+
}
|
|
1240
|
+
function requiredWithTrimValidator(control) {
|
|
1241
|
+
if (!control.parent || !control)
|
|
1242
|
+
return null;
|
|
1243
|
+
if (control && !`${control?.value}`.trim()) {
|
|
1244
|
+
return {
|
|
1245
|
+
required: true
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
function differentFromZero(control) {
|
|
1251
|
+
if (!control.parent || !control)
|
|
1252
|
+
return null;
|
|
1253
|
+
const handled = `${control?.value}`.trim().replace(/0/g, '');
|
|
1254
|
+
if (control && !handled) {
|
|
1255
|
+
return {
|
|
1256
|
+
differentFromZero: true
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
return null;
|
|
1260
|
+
}
|
|
1261
|
+
class Validators {
|
|
1262
|
+
static email(control) {
|
|
1263
|
+
return emailValidator(control);
|
|
1264
|
+
}
|
|
1265
|
+
static dateRange(control) {
|
|
1266
|
+
return dateRangeValidator(control);
|
|
1267
|
+
}
|
|
1268
|
+
static unlockSponsorRegister(control) {
|
|
1269
|
+
return registerValidator(control, 'sponsor');
|
|
1270
|
+
}
|
|
1271
|
+
static unlockBuyerRegister(control) {
|
|
1272
|
+
return registerValidator(control, 'buyer');
|
|
1273
|
+
}
|
|
1274
|
+
static dateStartEnd(control) {
|
|
1275
|
+
return dateStartEndValidator(control);
|
|
1276
|
+
}
|
|
1277
|
+
static url(control) {
|
|
1278
|
+
return urlValidator(control);
|
|
1279
|
+
}
|
|
1280
|
+
static passwordConfirm(control) {
|
|
1281
|
+
return passwordConfirmValidator(control);
|
|
1282
|
+
}
|
|
1283
|
+
static true(control) {
|
|
1284
|
+
return trueValidator(control);
|
|
1285
|
+
}
|
|
1286
|
+
static combo(control) {
|
|
1287
|
+
return comboValidator(control);
|
|
1288
|
+
}
|
|
1289
|
+
static zipCode(control) {
|
|
1290
|
+
return zipCodeValidator(control);
|
|
1291
|
+
}
|
|
1292
|
+
static zipCodeByCountry(country) {
|
|
1293
|
+
return (control) => {
|
|
1294
|
+
return zipCodeValidator(control, country);
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
static documentBR(control) {
|
|
1298
|
+
return documentValidator(control, 'BR');
|
|
1299
|
+
}
|
|
1300
|
+
static documentCL(control) {
|
|
1301
|
+
return documentValidator(control, 'CL');
|
|
1302
|
+
}
|
|
1303
|
+
static date(control) {
|
|
1304
|
+
return dateValidator(control);
|
|
1305
|
+
}
|
|
1306
|
+
static greaterThanZero(control) {
|
|
1307
|
+
return valueGreaterThanZero(control);
|
|
1308
|
+
}
|
|
1309
|
+
static required(control) {
|
|
1310
|
+
return requiredWithTrimValidator(control);
|
|
1311
|
+
}
|
|
1312
|
+
static differentFromZero(control) {
|
|
1313
|
+
return differentFromZero(control);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
1317
|
/* eslint-disable object-curly-newline */
|
|
1318
1318
|
|
|
1319
1319
|
const moment$1 = moment_;
|
|
@@ -6035,5 +6035,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
6035
6035
|
* Generated bundle index. Do not edit.
|
|
6036
6036
|
*/
|
|
6037
6037
|
|
|
6038
|
-
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils,
|
|
6038
|
+
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, Link, MonkeyEcxAlertsService, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardByRole, MonkeyEcxAuthGuardCompany, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxBlobSecurePipe, MonkeyEcxCommonsService, MonkeyEcxCommonsStoreService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxCurrencyConfigService, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDisplayInitialsPipe, MonkeyEcxDisplaySupportPhone, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureByProgramDirective, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatBeaufityJSONPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDateGroupPipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDateUnixTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatTaxPipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLinksModel, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPaginationService, MonkeyEcxPipesModule, MonkeyEcxPopoverDirective, MonkeyEcxPopoverOptionsDirective, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModule, OpSearch, POPOVER_OPTIONS, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, differentFromZero, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, requiredWithTrimValidator, index as store, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
6039
6039
|
//# sourceMappingURL=monkey-front-core.mjs.map
|