ngx-vector-components 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/assets/styles/_primeng-custom-theme.scss +1 -1
- package/esm2020/lib/interceptors/http-interceptor.mjs +10 -4
- package/esm2020/lib/pipes/index.mjs +2 -1
- package/esm2020/lib/pipes/only-active.pipe.mjs +16 -0
- package/esm2020/lib/pipes/pipes.module.mjs +5 -4
- package/esm2020/lib/services/menu.service.mjs +11 -4
- package/esm2020/lib/utils/validation.util.mjs +44 -1
- package/fesm2015/ngx-vector-components.mjs +79 -11
- package/fesm2015/ngx-vector-components.mjs.map +1 -1
- package/fesm2020/ngx-vector-components.mjs +77 -10
- package/fesm2020/ngx-vector-components.mjs.map +1 -1
- package/lib/interceptors/http-interceptor.d.ts +3 -1
- package/lib/pipes/index.d.ts +1 -0
- package/lib/pipes/only-active.pipe.d.ts +7 -0
- package/lib/pipes/pipes.module.d.ts +2 -1
- package/lib/utils/validation.util.d.ts +2 -0
- package/package.json +1 -1
|
@@ -157,16 +157,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
157
157
|
}]
|
|
158
158
|
}] });
|
|
159
159
|
|
|
160
|
+
class OnlyActivePipe {
|
|
161
|
+
transform(value) {
|
|
162
|
+
return value?.filter((item) => item.active) || [];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
OnlyActivePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: OnlyActivePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
166
|
+
OnlyActivePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: OnlyActivePipe, name: "onlyActive" });
|
|
167
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: OnlyActivePipe, decorators: [{
|
|
168
|
+
type: Pipe,
|
|
169
|
+
args: [{
|
|
170
|
+
name: 'onlyActive',
|
|
171
|
+
}]
|
|
172
|
+
}] });
|
|
173
|
+
|
|
160
174
|
class PipesModule {
|
|
161
175
|
}
|
|
162
176
|
PipesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
163
|
-
PipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipesModule, declarations: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe], exports: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe] });
|
|
177
|
+
PipesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipesModule, declarations: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe, OnlyActivePipe], exports: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe, OnlyActivePipe] });
|
|
164
178
|
PipesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipesModule });
|
|
165
179
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: PipesModule, decorators: [{
|
|
166
180
|
type: NgModule,
|
|
167
181
|
args: [{
|
|
168
|
-
declarations: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe],
|
|
169
|
-
exports: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe],
|
|
182
|
+
declarations: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe, OnlyActivePipe],
|
|
183
|
+
exports: [RemoveLastChildPipe, CurrencyBrlPipe, NotHiddenPipe, OnlyActivePipe],
|
|
170
184
|
}]
|
|
171
185
|
}] });
|
|
172
186
|
|
|
@@ -650,14 +664,16 @@ class MenuService {
|
|
|
650
664
|
}
|
|
651
665
|
getSideMainMenuOptions() {
|
|
652
666
|
return this.menuOptions
|
|
653
|
-
.filter((
|
|
667
|
+
.filter((menu) => !menu.view && !menu.hidden && this.profileService.userHasPermission(menu.permission))
|
|
654
668
|
.map((menu) => this.removeHiddenChildren(menu))
|
|
669
|
+
.filter((menu) => !menu.hidden)
|
|
655
670
|
.map((menu, index) => this.generateId(menu, `${index}`));
|
|
656
671
|
}
|
|
657
672
|
getSideAdminMenuOptions() {
|
|
658
673
|
return this.menuOptions
|
|
659
|
-
.filter((
|
|
674
|
+
.filter((menu) => menu.view === View.ADMIN && !menu.hidden && this.profileService.userHasPermission(menu.permission))
|
|
660
675
|
.map((menu) => this.removeHiddenChildren(menu))
|
|
676
|
+
.filter((menu) => !menu.hidden)
|
|
661
677
|
.map((menu, index) => this.generateId(menu, `${index}`));
|
|
662
678
|
}
|
|
663
679
|
navigateToPortal(params) {
|
|
@@ -679,9 +695,14 @@ class MenuService {
|
|
|
679
695
|
}
|
|
680
696
|
removeHiddenChildren(menu) {
|
|
681
697
|
const newMenu = { ...menu };
|
|
698
|
+
const hadChildren = !!newMenu.children?.length;
|
|
682
699
|
newMenu.children = newMenu.children
|
|
683
700
|
?.filter((child) => !child.hidden && this.profileService.userHasPermission(child.permission))
|
|
684
|
-
.map((menu) => this.removeHiddenChildren(menu))
|
|
701
|
+
.map((menu) => this.removeHiddenChildren(menu))
|
|
702
|
+
.filter((child) => !child.hidden);
|
|
703
|
+
if (hadChildren && !newMenu.children?.length) {
|
|
704
|
+
newMenu.hidden = true;
|
|
705
|
+
}
|
|
685
706
|
return newMenu;
|
|
686
707
|
}
|
|
687
708
|
generateId(menu, index, parentId = '') {
|
|
@@ -1280,6 +1301,48 @@ class ValidationUtil {
|
|
|
1280
1301
|
}
|
|
1281
1302
|
return null;
|
|
1282
1303
|
}
|
|
1304
|
+
static lowerThanOrEqualTo(greaterControlName) {
|
|
1305
|
+
const validator = (control) => {
|
|
1306
|
+
const lowerValue = control.value;
|
|
1307
|
+
const greaterValue = control.parent?.get(greaterControlName)?.value;
|
|
1308
|
+
if (!control.parent?.get(greaterControlName)) {
|
|
1309
|
+
console.log(`Control with name ${greaterControlName} not registered`);
|
|
1310
|
+
return {};
|
|
1311
|
+
}
|
|
1312
|
+
if (ObjectUtil.isValid(lowerValue) &&
|
|
1313
|
+
ObjectUtil.isValid(greaterValue) &&
|
|
1314
|
+
lowerValue !== '' &&
|
|
1315
|
+
greaterValue !== '' &&
|
|
1316
|
+
+lowerValue > +greaterValue) {
|
|
1317
|
+
return {
|
|
1318
|
+
invalid: 'Valor mínimo deve ser menor ou igual ao valor máximo',
|
|
1319
|
+
};
|
|
1320
|
+
}
|
|
1321
|
+
return {};
|
|
1322
|
+
};
|
|
1323
|
+
return validator;
|
|
1324
|
+
}
|
|
1325
|
+
static greaterThanOrEqualTo(lowerControlName) {
|
|
1326
|
+
const validator = (control) => {
|
|
1327
|
+
const greaterValue = control.value;
|
|
1328
|
+
const lowerValue = control.parent?.get(lowerControlName)?.value;
|
|
1329
|
+
if (!control.parent?.get(lowerControlName)) {
|
|
1330
|
+
console.log(`Control with name ${lowerControlName} not registered`);
|
|
1331
|
+
return {};
|
|
1332
|
+
}
|
|
1333
|
+
if (ObjectUtil.isValid(lowerValue) &&
|
|
1334
|
+
ObjectUtil.isValid(greaterValue) &&
|
|
1335
|
+
lowerValue !== '' &&
|
|
1336
|
+
greaterValue !== '' &&
|
|
1337
|
+
+lowerValue > +greaterValue) {
|
|
1338
|
+
return {
|
|
1339
|
+
invalid: 'Valor máximo deve ser maior ou igual ao valor mínimo',
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
return {};
|
|
1343
|
+
};
|
|
1344
|
+
return validator;
|
|
1345
|
+
}
|
|
1283
1346
|
}
|
|
1284
1347
|
|
|
1285
1348
|
class WindowUtil {
|
|
@@ -3044,11 +3107,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
3044
3107
|
}], ctorParameters: function () { return [{ type: StorageService }]; } });
|
|
3045
3108
|
|
|
3046
3109
|
class HttpInterceptorProvider {
|
|
3047
|
-
constructor(storageService, errorMessageService, loadingService, authService, environment) {
|
|
3110
|
+
constructor(storageService, errorMessageService, loadingService, authService, messageService, environment) {
|
|
3048
3111
|
this.storageService = storageService;
|
|
3049
3112
|
this.errorMessageService = errorMessageService;
|
|
3050
3113
|
this.loadingService = loadingService;
|
|
3051
3114
|
this.authService = authService;
|
|
3115
|
+
this.messageService = messageService;
|
|
3052
3116
|
this.environment = environment;
|
|
3053
3117
|
this.activeRequests = [];
|
|
3054
3118
|
this.isRefreshing = false;
|
|
@@ -3079,6 +3143,9 @@ class HttpInterceptorProvider {
|
|
|
3079
3143
|
if (response.status === 403) {
|
|
3080
3144
|
this.errorMessageService.genericModalErrorMessage$.next('Usuário sem privilégios para realizar essa ação');
|
|
3081
3145
|
}
|
|
3146
|
+
else {
|
|
3147
|
+
this.messageService.add({ severity: MessageStatus.ERROR, summary: 'Erro', detail: response.error });
|
|
3148
|
+
}
|
|
3082
3149
|
}
|
|
3083
3150
|
if (this.activeRequests.includes(this.getUrlWithoutParams(response.url))) {
|
|
3084
3151
|
this.activeRequests.splice(this.activeRequests.findIndex((item) => item === this.getUrlWithoutParams(request.url)), 1);
|
|
@@ -3198,11 +3265,11 @@ class HttpInterceptorProvider {
|
|
|
3198
3265
|
return this.refreshTokenSubject.pipe(filter((token) => token !== null), take(1), switchMap((token) => next.handle(this.addTokenIfPresent(request))));
|
|
3199
3266
|
}
|
|
3200
3267
|
}
|
|
3201
|
-
HttpInterceptorProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HttpInterceptorProvider, deps: [{ token: StorageService }, { token: ErrorMessageService }, { token: LoadingService }, { token: AuthService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3268
|
+
HttpInterceptorProvider.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HttpInterceptorProvider, deps: [{ token: StorageService }, { token: ErrorMessageService }, { token: LoadingService }, { token: AuthService }, { token: i2$2.MessageService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3202
3269
|
HttpInterceptorProvider.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HttpInterceptorProvider });
|
|
3203
3270
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImport: i0, type: HttpInterceptorProvider, decorators: [{
|
|
3204
3271
|
type: Injectable
|
|
3205
|
-
}], ctorParameters: function () { return [{ type: StorageService }, { type: ErrorMessageService }, { type: LoadingService }, { type: AuthService }, { type: undefined, decorators: [{
|
|
3272
|
+
}], ctorParameters: function () { return [{ type: StorageService }, { type: ErrorMessageService }, { type: LoadingService }, { type: AuthService }, { type: i2$2.MessageService }, { type: undefined, decorators: [{
|
|
3206
3273
|
type: Inject,
|
|
3207
3274
|
args: ['environment']
|
|
3208
3275
|
}] }]; } });
|
|
@@ -3211,5 +3278,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.3", ngImpor
|
|
|
3211
3278
|
* Generated bundle index. Do not edit.
|
|
3212
3279
|
*/
|
|
3213
3280
|
|
|
3214
|
-
export { AppName, AuthService, BooleanType, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, CalendarComponent, CheckboxFieldComponent, CrudBaseComponent, CrudBaseService, CrudFooterComponent, CrudMode, CurrencyBrlPipe, CurrencyFieldComponent, DataTableComponent, DocumentType, DropdownFieldComponent, EnumService, ErrorMessageService, FieldErrorMessageComponent, FieldType, FieldsModule, FileUtil, FiltersComponent, FooterModule, GenericErrorModalComponent, GenericErrorModalModule, GenericModalComponent, GenericModalModule, GetTokenByGuidGuard, HasPermissionGuard, HttpInterceptorProvider, LoadingService, MaskUtil, MenuComponent, MenuModule, MenuService, MessageStatus, ModalService, MultiselectFieldComponent, NotHiddenPipe, ObjectUtil, PanelComponent, PanelModule, PercentageFieldComponent, PipesModule, ProfileModuleActionType, ProfileModuleType, ProfileService, RadioButtonFieldComponent, RangeValueComponent, RemoveLastChildPipe, Role, RoleGuard, SearchFieldComponent, Status, StorageService, StringUtil, SubMenusListComponent, TableColumnType, TextFieldComponent, TextareaFieldComponent, TokenIsPresentGuard, TopBarComponent, TopBarModule, ValidationUtil, View, WindowUtil };
|
|
3281
|
+
export { AppName, AuthService, BooleanType, BreadcrumbComponent, BreadcrumbModule, ButtonComponent, CalendarComponent, CheckboxFieldComponent, CrudBaseComponent, CrudBaseService, CrudFooterComponent, CrudMode, CurrencyBrlPipe, CurrencyFieldComponent, DataTableComponent, DocumentType, DropdownFieldComponent, EnumService, ErrorMessageService, FieldErrorMessageComponent, FieldType, FieldsModule, FileUtil, FiltersComponent, FooterModule, GenericErrorModalComponent, GenericErrorModalModule, GenericModalComponent, GenericModalModule, GetTokenByGuidGuard, HasPermissionGuard, HttpInterceptorProvider, LoadingService, MaskUtil, MenuComponent, MenuModule, MenuService, MessageStatus, ModalService, MultiselectFieldComponent, NotHiddenPipe, ObjectUtil, OnlyActivePipe, PanelComponent, PanelModule, PercentageFieldComponent, PipesModule, ProfileModuleActionType, ProfileModuleType, ProfileService, RadioButtonFieldComponent, RangeValueComponent, RemoveLastChildPipe, Role, RoleGuard, SearchFieldComponent, Status, StorageService, StringUtil, SubMenusListComponent, TableColumnType, TextFieldComponent, TextareaFieldComponent, TokenIsPresentGuard, TopBarComponent, TopBarModule, ValidationUtil, View, WindowUtil };
|
|
3215
3282
|
//# sourceMappingURL=ngx-vector-components.mjs.map
|