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