monkey-front-core 0.0.46 → 0.0.50
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/interfaces/index.mjs +2 -1
- package/esm2020/lib/core/interfaces/monkeyecx-config.mjs +1 -1
- package/esm2020/lib/core/interfaces/monkeyecx-response-links.mjs +2 -0
- package/esm2020/lib/core/services/commons/monkeyecx-commons.service.mjs +8 -3
- package/esm2020/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.mjs +13 -6
- package/esm2020/lib/core/services/storage/monkeyecx-token-storage.service.mjs +8 -8
- package/esm2020/lib/core/utils/validators.mjs +26 -13
- package/fesm2015/monkey-front-core.mjs +51 -25
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +52 -27
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/interfaces/index.d.ts +1 -0
- package/lib/core/interfaces/monkeyecx-config.d.ts +8 -0
- package/lib/core/interfaces/monkeyecx-response-links.d.ts +11 -0
- package/lib/core/services/commons/monkeyecx-commons.service.d.ts +2 -1
- package/lib/core/services/request-paged/monkeyecx-request-request-paged-handling.d.ts +3 -2
- package/lib/core/utils/validators.d.ts +2 -0
- package/monkey-front-core-0.0.50.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.46.tgz +0 -0
|
@@ -1167,7 +1167,7 @@ function emailValidator(control) {
|
|
|
1167
1167
|
if (test)
|
|
1168
1168
|
return null;
|
|
1169
1169
|
return {
|
|
1170
|
-
email: true
|
|
1170
|
+
email: true,
|
|
1171
1171
|
};
|
|
1172
1172
|
}
|
|
1173
1173
|
function dateRangeValidator(control) {
|
|
@@ -1179,7 +1179,7 @@ function dateRangeValidator(control) {
|
|
|
1179
1179
|
(!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.startDate) ||
|
|
1180
1180
|
!MonkeyEcxUtils.persistNullEmptyUndefined(dates?.endDate))) {
|
|
1181
1181
|
return {
|
|
1182
|
-
dateRange: true
|
|
1182
|
+
dateRange: true,
|
|
1183
1183
|
};
|
|
1184
1184
|
}
|
|
1185
1185
|
return null;
|
|
@@ -1190,7 +1190,7 @@ function registerValidator(control, type) {
|
|
|
1190
1190
|
}
|
|
1191
1191
|
if (control && control.value !== `#MONKEY${type}`.toUpperCase()) {
|
|
1192
1192
|
return {
|
|
1193
|
-
invalidUnlockRegister: true
|
|
1193
|
+
invalidUnlockRegister: true,
|
|
1194
1194
|
};
|
|
1195
1195
|
}
|
|
1196
1196
|
return null;
|
|
@@ -1214,7 +1214,7 @@ function dateStartEndValidator(control) {
|
|
|
1214
1214
|
return null;
|
|
1215
1215
|
if (dateStart > dateEnd) {
|
|
1216
1216
|
return {
|
|
1217
|
-
dateStartMustBeLessThanAnd: true
|
|
1217
|
+
dateStartMustBeLessThanAnd: true,
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
1220
|
return null;
|
|
@@ -1224,7 +1224,7 @@ function urlValidator(control) {
|
|
|
1224
1224
|
return null;
|
|
1225
1225
|
if (!MonkeyEcxUtils.isValidUrl(control.value)) {
|
|
1226
1226
|
return {
|
|
1227
|
-
url: true
|
|
1227
|
+
url: true,
|
|
1228
1228
|
};
|
|
1229
1229
|
}
|
|
1230
1230
|
return null;
|
|
@@ -1240,7 +1240,7 @@ function passwordConfirmValidator(control) {
|
|
|
1240
1240
|
if (password === passwordConfirm)
|
|
1241
1241
|
return null;
|
|
1242
1242
|
return {
|
|
1243
|
-
passwordsNotMatching: true
|
|
1243
|
+
passwordsNotMatching: true,
|
|
1244
1244
|
};
|
|
1245
1245
|
}
|
|
1246
1246
|
function trueValidator(control) {
|
|
@@ -1249,7 +1249,7 @@ function trueValidator(control) {
|
|
|
1249
1249
|
if (control && control.value !== false)
|
|
1250
1250
|
return null;
|
|
1251
1251
|
return {
|
|
1252
|
-
invalidTrue: true
|
|
1252
|
+
invalidTrue: true,
|
|
1253
1253
|
};
|
|
1254
1254
|
}
|
|
1255
1255
|
function comboValidator(control) {
|
|
@@ -1258,7 +1258,7 @@ function comboValidator(control) {
|
|
|
1258
1258
|
if (control && control.value !== '0')
|
|
1259
1259
|
return null;
|
|
1260
1260
|
return {
|
|
1261
|
-
invalidCombo: true
|
|
1261
|
+
invalidCombo: true,
|
|
1262
1262
|
};
|
|
1263
1263
|
}
|
|
1264
1264
|
function zipCodeValidator(control) {
|
|
@@ -1267,7 +1267,7 @@ function zipCodeValidator(control) {
|
|
|
1267
1267
|
if (control && control.value) {
|
|
1268
1268
|
if (!MonkeyEcxUtils.isValidZipCode(control.value)) {
|
|
1269
1269
|
return {
|
|
1270
|
-
invalidZipCode: true
|
|
1270
|
+
invalidZipCode: true,
|
|
1271
1271
|
};
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
@@ -1279,14 +1279,14 @@ function documentValidator(control, country) {
|
|
|
1279
1279
|
if (country === 'BR') {
|
|
1280
1280
|
if (!MonkeyEcxUtils.isCPFCNPJValid(control.value)) {
|
|
1281
1281
|
return {
|
|
1282
|
-
invalidCpfCnpj: true
|
|
1282
|
+
invalidCpfCnpj: true,
|
|
1283
1283
|
};
|
|
1284
1284
|
}
|
|
1285
1285
|
}
|
|
1286
1286
|
else if (country === 'CL') {
|
|
1287
1287
|
if (!MonkeyEcxUtils.isValidRUT(control.value)) {
|
|
1288
1288
|
return {
|
|
1289
|
-
invalidCpfCnpj: true
|
|
1289
|
+
invalidCpfCnpj: true,
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
1292
|
}
|
|
@@ -1298,7 +1298,17 @@ function dateValidator(control) {
|
|
|
1298
1298
|
const dateFormat = 'MM-DD-YYYY';
|
|
1299
1299
|
if (!moment(moment(control.value).format(dateFormat), ['DD/MM/YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD'], true).isValid()) {
|
|
1300
1300
|
return {
|
|
1301
|
-
invalidDate: true
|
|
1301
|
+
invalidDate: true,
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
return null;
|
|
1305
|
+
}
|
|
1306
|
+
function valueGreaterThanZero(control) {
|
|
1307
|
+
if (!control.parent || !control || isEmptyInputValue(control.value))
|
|
1308
|
+
return null;
|
|
1309
|
+
if (control && `${control?.value}` === '0') {
|
|
1310
|
+
return {
|
|
1311
|
+
invalidValueGreaterThanZero: true,
|
|
1302
1312
|
};
|
|
1303
1313
|
}
|
|
1304
1314
|
return null;
|
|
@@ -1343,6 +1353,9 @@ class Validators {
|
|
|
1343
1353
|
static date(control) {
|
|
1344
1354
|
return dateValidator(control);
|
|
1345
1355
|
}
|
|
1356
|
+
static greaterThanZero(control) {
|
|
1357
|
+
return dateValidator(control);
|
|
1358
|
+
}
|
|
1346
1359
|
}
|
|
1347
1360
|
|
|
1348
1361
|
/* eslint-disable object-curly-newline */
|
|
@@ -1709,11 +1722,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
1709
1722
|
}] } });
|
|
1710
1723
|
|
|
1711
1724
|
class MonkeyEcxRequestPagedHandling {
|
|
1712
|
-
constructor(_url, _pagedParams) {
|
|
1725
|
+
constructor(_url, _pagedParams, _links) {
|
|
1713
1726
|
this.url = _url;
|
|
1714
1727
|
this.pagedParams = _pagedParams || {
|
|
1715
|
-
page: {}
|
|
1728
|
+
page: {},
|
|
1716
1729
|
};
|
|
1730
|
+
this.links = _links;
|
|
1717
1731
|
}
|
|
1718
1732
|
handlePagedValuesFromApi(url = '') {
|
|
1719
1733
|
if (url.search('\\?') < 0)
|
|
@@ -1721,8 +1735,11 @@ class MonkeyEcxRequestPagedHandling {
|
|
|
1721
1735
|
const params = url.substring(url.search('\\?') + 1, url.length);
|
|
1722
1736
|
url = url.substring(0, url.search('\\?'));
|
|
1723
1737
|
return `${url}?${new HttpParams({
|
|
1724
|
-
fromString: params
|
|
1725
|
-
})
|
|
1738
|
+
fromString: params,
|
|
1739
|
+
})
|
|
1740
|
+
.delete('size')
|
|
1741
|
+
.delete('page')
|
|
1742
|
+
.toString()}`;
|
|
1726
1743
|
}
|
|
1727
1744
|
getUrlParams(url) {
|
|
1728
1745
|
const { pagedParams } = this;
|
|
@@ -1731,7 +1748,10 @@ class MonkeyEcxRequestPagedHandling {
|
|
|
1731
1748
|
return `${!hasInitialQueryParams ? '?' : '&'}page=${number || 0}&size=${size || 20}`;
|
|
1732
1749
|
}
|
|
1733
1750
|
getRequestWithPagedParams() {
|
|
1734
|
-
const { url } = this;
|
|
1751
|
+
const { url, links } = this;
|
|
1752
|
+
if (links && links.next) {
|
|
1753
|
+
return links.next.href;
|
|
1754
|
+
}
|
|
1735
1755
|
const handled = this.handlePagedValuesFromApi(url);
|
|
1736
1756
|
return `${handled}${this.getUrlParams(handled)}`;
|
|
1737
1757
|
}
|
|
@@ -1746,6 +1766,7 @@ class MonkeyEcxCommonsService {
|
|
|
1746
1766
|
this.__error = null;
|
|
1747
1767
|
this.__handledError = null;
|
|
1748
1768
|
this.__page = null;
|
|
1769
|
+
this.__links = null;
|
|
1749
1770
|
this.__requestPaged = null;
|
|
1750
1771
|
this.__onSearchChanged$ = new BehaviorSubject(null);
|
|
1751
1772
|
this.__onDataChanged$ = new BehaviorSubject(null);
|
|
@@ -1838,6 +1859,9 @@ class MonkeyEcxCommonsService {
|
|
|
1838
1859
|
return this;
|
|
1839
1860
|
}
|
|
1840
1861
|
nextPage() {
|
|
1862
|
+
if (this.__links) {
|
|
1863
|
+
return !!this.__links?.next;
|
|
1864
|
+
}
|
|
1841
1865
|
if (!this.__requestPaged)
|
|
1842
1866
|
return false;
|
|
1843
1867
|
const { page } = this.__requestPaged;
|
|
@@ -1859,8 +1883,8 @@ class MonkeyEcxCommonsService {
|
|
|
1859
1883
|
return _embedded ? _embedded[field] : null;
|
|
1860
1884
|
}
|
|
1861
1885
|
getNormalizedUrl(url) {
|
|
1862
|
-
const { __requestPaged } = this;
|
|
1863
|
-
return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}).getRequestWithPagedParams();
|
|
1886
|
+
const { __requestPaged, __links } = this;
|
|
1887
|
+
return new MonkeyEcxRequestPagedHandling(url, __requestPaged || {}, __links).getRequestWithPagedParams();
|
|
1864
1888
|
}
|
|
1865
1889
|
clear(clearData) {
|
|
1866
1890
|
if (clearData) {
|
|
@@ -1868,6 +1892,7 @@ class MonkeyEcxCommonsService {
|
|
|
1868
1892
|
this.__requestPaged = null;
|
|
1869
1893
|
this.__params = null;
|
|
1870
1894
|
this.__page = null;
|
|
1895
|
+
this.__links = null;
|
|
1871
1896
|
if (this.__schedule) {
|
|
1872
1897
|
const { queue } = this.__schedule;
|
|
1873
1898
|
if (queue) {
|
|
@@ -2591,8 +2616,8 @@ class MonkeyEcxTokenStorageService {
|
|
|
2591
2616
|
programType: '',
|
|
2592
2617
|
role: '',
|
|
2593
2618
|
_clearIgnore: {
|
|
2594
|
-
ignore: ['username', 'program']
|
|
2595
|
-
}
|
|
2619
|
+
ignore: ['username', 'program'],
|
|
2620
|
+
},
|
|
2596
2621
|
};
|
|
2597
2622
|
this.token$ = new BehaviorSubject(null);
|
|
2598
2623
|
this.me$ = new BehaviorSubject(null);
|
|
@@ -2612,7 +2637,7 @@ class MonkeyEcxTokenStorageService {
|
|
|
2612
2637
|
getAllTokens() {
|
|
2613
2638
|
const { token, config } = this;
|
|
2614
2639
|
const handledToken = {
|
|
2615
|
-
...token
|
|
2640
|
+
...token,
|
|
2616
2641
|
};
|
|
2617
2642
|
Object.entries(token || {}).forEach(([key, value]) => {
|
|
2618
2643
|
handledToken[key] = localStorage.getItem(key);
|
|
@@ -2624,12 +2649,12 @@ class MonkeyEcxTokenStorageService {
|
|
|
2624
2649
|
}
|
|
2625
2650
|
setAllMe(me) {
|
|
2626
2651
|
const { me$ } = this;
|
|
2627
|
-
let previousMe = JSON.parse(localStorage?.getItem('me') || '');
|
|
2652
|
+
let previousMe = JSON.parse(localStorage?.getItem('me') || '{}');
|
|
2628
2653
|
Object.entries(me).forEach(([key, value]) => {
|
|
2629
2654
|
if (MonkeyEcxUtils.persistNullEmptyUndefined(value)) {
|
|
2630
2655
|
previousMe = {
|
|
2631
2656
|
...previousMe,
|
|
2632
|
-
[key]: value
|
|
2657
|
+
[key]: value,
|
|
2633
2658
|
};
|
|
2634
2659
|
}
|
|
2635
2660
|
});
|
|
@@ -2638,7 +2663,7 @@ class MonkeyEcxTokenStorageService {
|
|
|
2638
2663
|
}
|
|
2639
2664
|
getAllMe() {
|
|
2640
2665
|
const me = localStorage.getItem('me');
|
|
2641
|
-
return JSON.parse(me || '');
|
|
2666
|
+
return JSON.parse(me || '{}');
|
|
2642
2667
|
}
|
|
2643
2668
|
tokenHasChanged() {
|
|
2644
2669
|
return this.token$.asObservable();
|
|
@@ -2690,7 +2715,7 @@ MonkeyEcxTokenStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "
|
|
|
2690
2715
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxTokenStorageService, decorators: [{
|
|
2691
2716
|
type: Injectable,
|
|
2692
2717
|
args: [{
|
|
2693
|
-
providedIn: 'root'
|
|
2718
|
+
providedIn: 'root',
|
|
2694
2719
|
}]
|
|
2695
2720
|
}], ctorParameters: function () { return [{ type: MonkeyEcxConfigService }]; } });
|
|
2696
2721
|
|
|
@@ -4209,5 +4234,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
4209
4234
|
* Generated bundle index. Do not edit.
|
|
4210
4235
|
*/
|
|
4211
4236
|
|
|
4212
|
-
export { ClosedToMaintenanceComponent, ClosedToMaintenanceModule, decoratorsUtils as DecoratorsUtils, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDatePipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPipesModule, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModuleModule, OpSearch, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, trueValidator, urlValidator, zipCodeValidator };
|
|
4237
|
+
export { ClosedToMaintenanceComponent, ClosedToMaintenanceModule, decoratorsUtils as DecoratorsUtils, MonkeyEcxAuthGuard, MonkeyEcxAuthGuardLogin, MonkeyEcxAuthenticationService, MonkeyEcxCommonsService, MonkeyEcxConfigModule, MonkeyEcxConfigService, MonkeyEcxCookieStorageService, MonkeyEcxCoreCharts, MonkeyEcxCoreClearDecorators, MonkeyEcxCoreLog, MonkeyEcxCoreService, MonkeyEcxCoreServiceConstructor, MonkeyEcxCoreServicePaged, MonkeyEcxCoreServiceQueue, MonkeyEcxDirectivesModule, MonkeyEcxDiscoveryParamsService, MonkeyEcxDisplayFirstNamePipe, MonkeyEcxDragDropDirective, MonkeyEcxErrorConfigService, MonkeyEcxErrorHandlingModule, MonkeyEcxErrorHandlingService, MonkeyEcxFeatureDirective, MonkeyEcxFeatureToggleService, MonkeyEcxFormatAddressPipe, MonkeyEcxFormatCurrency, MonkeyEcxFormatCurrencyPipe, MonkeyEcxFormatDatePipe, MonkeyEcxFormatDateTimelapsePipe, MonkeyEcxFormatDocumentPipe, MonkeyEcxFormatDocumentTypePipe, MonkeyEcxFormatNumberPipe, MonkeyEcxFormatPhonePipe, MonkeyEcxFormatSizePipe, MonkeyEcxFormatUpper, MonkeyEcxFormatValue, MonkeyEcxFormatZipCodePipe, MonkeyEcxHandlingService, MonkeyEcxHttpConfigErrorInterceptor, MonkeyEcxHttpConfigHeaderInterceptor, MonkeyEcxHttpConfigInterceptorModule, MonkeyEcxHttpConfigLoadingInProgressInterceptor, MonkeyEcxHttpConfigQueueInterceptor, MonkeyEcxHttpErrorHandlingService, MonkeyEcxLoggedHandlingService, MonkeyEcxLogsConfigService, MonkeyEcxMaintenanceConfigService, MonkeyEcxModel, MonkeyEcxOnlyAlphaNumericDirective, MonkeyEcxOnlyNumbersDirective, MonkeyEcxOthersErrorsHandlingService, MonkeyEcxPipesModule, MonkeyEcxProgressBarComponent, MonkeyEcxProgressBarModule, MonkeyEcxProgressBarService, MonkeyEcxRequestDownloadHandlingService, MonkeyEcxRequestDownloadedHandlingService, MonkeyEcxRequestPagedHandling, MonkeyEcxRequestQueueHandlingService, MonkeyEcxRequestQueueModalHandlingService, MonkeyEcxRequestScheduleService, MonkeyEcxSecurityConsoleConfigService, MonkeyEcxSecurityDirective, MonkeyEcxService, MonkeyEcxServiceDownload, MonkeyEcxServiceUpload, MonkeyEcxServiceWorkerConfigService, MonkeyEcxSpecificationSearch, MonkeyEcxTextTruncatePipe, MonkeyEcxTokenStorageService, MonkeyEcxTooltipDirective, MonkeyEcxTruncateQtdPipe, MonkeyEcxUtils, MonkeyEcxi18nConfigService, MonkeyFrontCoreModuleModule, OpSearch, statics as Statics, validateUtils as ValidateUtils, Validators, VersionChangedComponent, VersionChangedModule, comboValidator, dateRangeValidator, dateStartEndValidator, dateValidator, documentValidator, emailValidator, passwordConfirmValidator, registerValidator, trueValidator, urlValidator, valueGreaterThanZero, zipCodeValidator };
|
|
4213
4238
|
//# sourceMappingURL=monkey-front-core.mjs.map
|