monkey-front-core 0.0.417 → 0.0.418
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 +5 -1
- package/esm2020/lib/core/utils/validators.mjs +2 -2
- package/fesm2015/monkey-front-core.mjs +259 -256
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +256 -253
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/utils/utils.d.ts +1 -0
- package/lib/core/utils/validators.d.ts +1 -0
- package/monkey-front-core-0.0.418.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.417.tgz +0 -0
|
@@ -138,6 +138,247 @@ 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
|
+
|
|
141
382
|
/* eslint-disable comma-dangle */
|
|
142
383
|
/* eslint-disable block-scoped-var */
|
|
143
384
|
class MonkeyEcxUtils {
|
|
@@ -285,6 +526,9 @@ class MonkeyEcxUtils {
|
|
|
285
526
|
const length = (country === 'cl') ? 7 : 8;
|
|
286
527
|
return `${this.handleOnlyNumbers(zipCode)}`.length === length;
|
|
287
528
|
}
|
|
529
|
+
static isValidEmail(email) {
|
|
530
|
+
return EMAIL_REGEXP.test(email || '');
|
|
531
|
+
}
|
|
288
532
|
static getRandomString(len, charSet) {
|
|
289
533
|
charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
290
534
|
const randomString = new Array(len)
|
|
@@ -383,14 +627,14 @@ class MonkeyEcxUtils {
|
|
|
383
627
|
}
|
|
384
628
|
}
|
|
385
629
|
|
|
386
|
-
const moment$
|
|
630
|
+
const moment$5 = moment_;
|
|
387
631
|
class MonkeyEcxFormatDateTimelapsePipe {
|
|
388
632
|
transform(date, showTime = false, useUtc = true, format = '- HH:mm') {
|
|
389
633
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
390
634
|
return '';
|
|
391
|
-
let stillUtc = moment$
|
|
635
|
+
let stillUtc = moment$5.default.utc(date).toDate();
|
|
392
636
|
if (!useUtc)
|
|
393
|
-
stillUtc = moment$
|
|
637
|
+
stillUtc = moment$5.default(date).toDate();
|
|
394
638
|
if (date.toString().indexOf(':') <= -1) {
|
|
395
639
|
if (typeof date === 'string') {
|
|
396
640
|
stillUtc = date;
|
|
@@ -399,7 +643,7 @@ class MonkeyEcxFormatDateTimelapsePipe {
|
|
|
399
643
|
}
|
|
400
644
|
const formatFrom = `YYYY/MM/DD${showTime ? ` ${format}` : ''}`;
|
|
401
645
|
const formatTo = `DD/MM/YYYY${showTime ? ` ${format}` : ''}`;
|
|
402
|
-
return `${moment$
|
|
646
|
+
return `${moment$5.default(stillUtc, formatFrom).format(formatTo)}`;
|
|
403
647
|
}
|
|
404
648
|
}
|
|
405
649
|
MonkeyEcxFormatDateTimelapsePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxFormatDateTimelapsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -634,7 +878,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
634
878
|
}]
|
|
635
879
|
}] });
|
|
636
880
|
|
|
637
|
-
const moment$
|
|
881
|
+
const moment$4 = moment_;
|
|
638
882
|
class MonkeyEcxDisplaySupportPhone {
|
|
639
883
|
constructor() {
|
|
640
884
|
// not to do
|
|
@@ -646,9 +890,9 @@ class MonkeyEcxDisplaySupportPhone {
|
|
|
646
890
|
});
|
|
647
891
|
}
|
|
648
892
|
isPhoneOnline(phone) {
|
|
649
|
-
const start = moment$
|
|
650
|
-
const end = moment$
|
|
651
|
-
return moment$
|
|
893
|
+
const start = moment$4.default().startOf('day').add(phone === null || phone === void 0 ? void 0 : phone.startHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
894
|
+
const end = moment$4.default().startOf('day').add(phone === null || phone === void 0 ? void 0 : phone.endHour, 'hours').format('YYYY-MM-DD HH:mm');
|
|
895
|
+
return moment$4.default().isSameOrAfter(start) && moment$4.default().isSameOrBefore(end);
|
|
652
896
|
}
|
|
653
897
|
}
|
|
654
898
|
MonkeyEcxDisplaySupportPhone.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxDisplaySupportPhone, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
@@ -766,7 +1010,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
766
1010
|
}]
|
|
767
1011
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.CurrencyPipe }]; } });
|
|
768
1012
|
|
|
769
|
-
const moment$
|
|
1013
|
+
const moment$3 = moment_;
|
|
770
1014
|
class MonkeyEcxFormatDateGroupPipe {
|
|
771
1015
|
constructor(injector) {
|
|
772
1016
|
this.injector = injector;
|
|
@@ -778,12 +1022,12 @@ class MonkeyEcxFormatDateGroupPipe {
|
|
|
778
1022
|
var _a;
|
|
779
1023
|
if (!MonkeyEcxUtils.persistNullEmptyUndefined(date))
|
|
780
1024
|
return '';
|
|
781
|
-
let stillUtc = moment$
|
|
1025
|
+
let stillUtc = moment$3.default.utc(date).toDate();
|
|
782
1026
|
if (((_a = date.toString()) === null || _a === void 0 ? void 0 : _a.indexOf(':')) <= -1) {
|
|
783
1027
|
stillUtc = date;
|
|
784
1028
|
}
|
|
785
1029
|
const formatFrom = 'YYYY/MM/DD';
|
|
786
|
-
const fmt = moment$
|
|
1030
|
+
const fmt = moment$3.default(stillUtc, formatFrom).locale(this.lang);
|
|
787
1031
|
const dayFormated = fmt.format('DD/');
|
|
788
1032
|
const monthFormated = MonkeyEcxUtils.capitalize(fmt.format('MMMM'));
|
|
789
1033
|
const yearFormated = fmt.format('YYYY');
|
|
@@ -807,15 +1051,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
807
1051
|
}]
|
|
808
1052
|
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
|
809
1053
|
|
|
810
|
-
const moment$
|
|
1054
|
+
const moment$2 = moment_;
|
|
811
1055
|
class DateValidator {
|
|
812
1056
|
static do(control) {
|
|
813
1057
|
if (!control.parent || !control)
|
|
814
1058
|
return null;
|
|
815
1059
|
if (control && control.value) {
|
|
816
1060
|
const dateFormat = 'MM-DD-YYYY';
|
|
817
|
-
if (!moment$
|
|
818
|
-
.default(moment$
|
|
1061
|
+
if (!moment$2
|
|
1062
|
+
.default(moment$2.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
819
1063
|
.isValid()) {
|
|
820
1064
|
return {
|
|
821
1065
|
invalidDate: true
|
|
@@ -1074,247 +1318,6 @@ var decoratorsUtils = /*#__PURE__*/Object.freeze({
|
|
|
1074
1318
|
hasMonkeyEcxServiceAndHandlingProperties: hasMonkeyEcxServiceAndHandlingProperties
|
|
1075
1319
|
});
|
|
1076
1320
|
|
|
1077
|
-
const moment$2 = moment_;
|
|
1078
|
-
const EMAIL_REGEXP = /^[\w-.]+@([\w-]+\.)+[\w-]{1,64}$/;
|
|
1079
|
-
function isEmptyInputValue(value) {
|
|
1080
|
-
return value == null || value.length === 0;
|
|
1081
|
-
}
|
|
1082
|
-
function emailValidator(control) {
|
|
1083
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1084
|
-
return null;
|
|
1085
|
-
}
|
|
1086
|
-
const test = EMAIL_REGEXP.test(control.value);
|
|
1087
|
-
if (test)
|
|
1088
|
-
return null;
|
|
1089
|
-
return {
|
|
1090
|
-
email: true
|
|
1091
|
-
};
|
|
1092
|
-
}
|
|
1093
|
-
function dateRangeValidator(control) {
|
|
1094
|
-
var _a, _b;
|
|
1095
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1096
|
-
return null;
|
|
1097
|
-
}
|
|
1098
|
-
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;
|
|
1099
|
-
if (dates &&
|
|
1100
|
-
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates === null || dates === void 0 ? void 0 : dates.startDate) ||
|
|
1101
|
-
!MonkeyEcxUtils.persistNullEmptyUndefined(dates === null || dates === void 0 ? void 0 : dates.endDate))) {
|
|
1102
|
-
return {
|
|
1103
|
-
dateRange: true
|
|
1104
|
-
};
|
|
1105
|
-
}
|
|
1106
|
-
return null;
|
|
1107
|
-
}
|
|
1108
|
-
function registerValidator(control, type) {
|
|
1109
|
-
if (!control.parent || !control || isEmptyInputValue(control.value)) {
|
|
1110
|
-
return null;
|
|
1111
|
-
}
|
|
1112
|
-
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
1113
|
-
return {
|
|
1114
|
-
invalidUnlockRegister: true
|
|
1115
|
-
};
|
|
1116
|
-
}
|
|
1117
|
-
return null;
|
|
1118
|
-
}
|
|
1119
|
-
function dateStartEndValidator(control) {
|
|
1120
|
-
var _a, _b;
|
|
1121
|
-
if (!control.parent || !control) {
|
|
1122
|
-
return null;
|
|
1123
|
-
}
|
|
1124
|
-
const { parent } = control;
|
|
1125
|
-
const valueStart = (_a = parent === null || parent === void 0 ? void 0 : parent.get('dateStart')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1126
|
-
const valueEnd = (_b = parent === null || parent === void 0 ? void 0 : parent.get('dateEnd')) === null || _b === void 0 ? void 0 : _b.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
|
-
var _a, _b;
|
|
1156
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1157
|
-
return null;
|
|
1158
|
-
const { parent } = control;
|
|
1159
|
-
const password = (_a = parent === null || parent === void 0 ? void 0 : parent.get('password')) === null || _a === void 0 ? void 0 : _a.value;
|
|
1160
|
-
const passwordConfirm = (_b = parent === null || parent === void 0 ? void 0 : parent.get('passwordConfirm')) === null || _b === void 0 ? void 0 : _b.value;
|
|
1161
|
-
if (!password || !passwordConfirm)
|
|
1162
|
-
return null;
|
|
1163
|
-
if (password === passwordConfirm)
|
|
1164
|
-
return null;
|
|
1165
|
-
return {
|
|
1166
|
-
passwordsNotMatching: true
|
|
1167
|
-
};
|
|
1168
|
-
}
|
|
1169
|
-
function trueValidator(control) {
|
|
1170
|
-
if (!control.parent || !control)
|
|
1171
|
-
return null;
|
|
1172
|
-
if (control && control.value !== false)
|
|
1173
|
-
return null;
|
|
1174
|
-
return {
|
|
1175
|
-
invalidTrue: true
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
function comboValidator(control) {
|
|
1179
|
-
if (!control.parent || !control)
|
|
1180
|
-
return null;
|
|
1181
|
-
if (control && control.value !== '0')
|
|
1182
|
-
return null;
|
|
1183
|
-
return {
|
|
1184
|
-
invalidCombo: true
|
|
1185
|
-
};
|
|
1186
|
-
}
|
|
1187
|
-
function zipCodeValidator(control, country) {
|
|
1188
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1189
|
-
return null;
|
|
1190
|
-
if (control && control.value) {
|
|
1191
|
-
if (!MonkeyEcxUtils.isValidZipCode(control.value, country)) {
|
|
1192
|
-
return {
|
|
1193
|
-
invalidZipCode: true
|
|
1194
|
-
};
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
return null;
|
|
1198
|
-
}
|
|
1199
|
-
function documentValidator(control, country) {
|
|
1200
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1201
|
-
return null;
|
|
1202
|
-
if (country === 'BR') {
|
|
1203
|
-
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
1204
|
-
return {
|
|
1205
|
-
invalidCpfCnpj: true
|
|
1206
|
-
};
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
else if (country === 'CL') {
|
|
1210
|
-
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
1211
|
-
return {
|
|
1212
|
-
invalidCpfCnpj: true
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
}
|
|
1216
|
-
return null;
|
|
1217
|
-
}
|
|
1218
|
-
function dateValidator(control) {
|
|
1219
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1220
|
-
return null;
|
|
1221
|
-
const dateFormat = 'MM-DD-YYYY';
|
|
1222
|
-
if (!moment$2
|
|
1223
|
-
.default(moment$2.default(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true)
|
|
1224
|
-
.isValid()) {
|
|
1225
|
-
return {
|
|
1226
|
-
invalidDate: true
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
return null;
|
|
1230
|
-
}
|
|
1231
|
-
function valueGreaterThanZero(control) {
|
|
1232
|
-
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1233
|
-
return null;
|
|
1234
|
-
if (control && `${control === null || control === void 0 ? void 0 : control.value}` === '0') {
|
|
1235
|
-
return {
|
|
1236
|
-
invalidValueGreaterThanZero: true
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
return null;
|
|
1240
|
-
}
|
|
1241
|
-
function requiredWithTrimValidator(control) {
|
|
1242
|
-
if (!control.parent || !control)
|
|
1243
|
-
return null;
|
|
1244
|
-
if (control && !`${control === null || control === void 0 ? void 0 : control.value}`.trim()) {
|
|
1245
|
-
return {
|
|
1246
|
-
required: true
|
|
1247
|
-
};
|
|
1248
|
-
}
|
|
1249
|
-
return null;
|
|
1250
|
-
}
|
|
1251
|
-
function differentFromZero(control) {
|
|
1252
|
-
if (!control.parent || !control)
|
|
1253
|
-
return null;
|
|
1254
|
-
const handled = `${control === null || control === void 0 ? void 0 : control.value}`.trim().replace(/0/g, '');
|
|
1255
|
-
if (control && !handled) {
|
|
1256
|
-
return {
|
|
1257
|
-
differentFromZero: true
|
|
1258
|
-
};
|
|
1259
|
-
}
|
|
1260
|
-
return null;
|
|
1261
|
-
}
|
|
1262
|
-
class Validators {
|
|
1263
|
-
static email(control) {
|
|
1264
|
-
return emailValidator(control);
|
|
1265
|
-
}
|
|
1266
|
-
static dateRange(control) {
|
|
1267
|
-
return dateRangeValidator(control);
|
|
1268
|
-
}
|
|
1269
|
-
static unlockSponsorRegister(control) {
|
|
1270
|
-
return registerValidator(control, 'sponsor');
|
|
1271
|
-
}
|
|
1272
|
-
static unlockBuyerRegister(control) {
|
|
1273
|
-
return registerValidator(control, 'buyer');
|
|
1274
|
-
}
|
|
1275
|
-
static dateStartEnd(control) {
|
|
1276
|
-
return dateStartEndValidator(control);
|
|
1277
|
-
}
|
|
1278
|
-
static url(control) {
|
|
1279
|
-
return urlValidator(control);
|
|
1280
|
-
}
|
|
1281
|
-
static passwordConfirm(control) {
|
|
1282
|
-
return passwordConfirmValidator(control);
|
|
1283
|
-
}
|
|
1284
|
-
static true(control) {
|
|
1285
|
-
return trueValidator(control);
|
|
1286
|
-
}
|
|
1287
|
-
static combo(control) {
|
|
1288
|
-
return comboValidator(control);
|
|
1289
|
-
}
|
|
1290
|
-
static zipCode(control) {
|
|
1291
|
-
return zipCodeValidator(control);
|
|
1292
|
-
}
|
|
1293
|
-
static zipCodeByCountry(country) {
|
|
1294
|
-
return (control) => {
|
|
1295
|
-
return zipCodeValidator(control, country);
|
|
1296
|
-
};
|
|
1297
|
-
}
|
|
1298
|
-
static documentBR(control) {
|
|
1299
|
-
return documentValidator(control, 'BR');
|
|
1300
|
-
}
|
|
1301
|
-
static documentCL(control) {
|
|
1302
|
-
return documentValidator(control, 'CL');
|
|
1303
|
-
}
|
|
1304
|
-
static date(control) {
|
|
1305
|
-
return dateValidator(control);
|
|
1306
|
-
}
|
|
1307
|
-
static greaterThanZero(control) {
|
|
1308
|
-
return valueGreaterThanZero(control);
|
|
1309
|
-
}
|
|
1310
|
-
static required(control) {
|
|
1311
|
-
return requiredWithTrimValidator(control);
|
|
1312
|
-
}
|
|
1313
|
-
static differentFromZero(control) {
|
|
1314
|
-
return differentFromZero(control);
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
1321
|
/* eslint-disable object-curly-newline */
|
|
1319
1322
|
|
|
1320
1323
|
const moment$1 = moment_;
|
|
@@ -5965,5 +5968,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
5965
5968
|
* Generated bundle index. Do not edit.
|
|
5966
5969
|
*/
|
|
5967
5970
|
|
|
5968
|
-
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 };
|
|
5971
|
+
export { AlertsComponent, AlertsModule, ClosedToMaintenanceComponent, ClosedToMaintenanceModule, CurrencyConfigComponent, CurrencyConfigModule, decoratorsUtils as DecoratorsUtils, EMAIL_REGEXP, 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 };
|
|
5969
5972
|
//# sourceMappingURL=monkey-front-core.mjs.map
|