lib-portal-angular 0.0.36 → 0.0.38
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/lib/components/button/button.component.mjs +31 -15
- package/esm2022/lib/components/components.module.mjs +8 -3
- package/esm2022/lib/components/confirmation/confirmation.component.mjs +7 -4
- package/esm2022/lib/components/confirmation/confirmation.service.mjs +16 -7
- package/esm2022/lib/components/custom-pagination/custom-pagination.component.mjs +7 -1
- package/esm2022/lib/components/imput/input.component.mjs +34 -29
- package/esm2022/lib/components/search-input/search-input.component.mjs +122 -0
- package/esm2022/lib/components/tables/data-paginate.service.mjs +37 -0
- package/esm2022/lib/components/tables/data-table.component.mjs +81 -45
- package/esm2022/lib/lib-portal-angular.module.mjs +6 -3
- package/esm2022/lib/service/auth-service.service.mjs +34 -0
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/lib-portal-angular.mjs +355 -97
- package/fesm2022/lib-portal-angular.mjs.map +1 -1
- package/lib/components/button/button.component.d.ts +9 -5
- package/lib/components/components.module.d.ts +5 -4
- package/lib/components/confirmation/confirmation.component.d.ts +3 -1
- package/lib/components/confirmation/confirmation.service.d.ts +4 -1
- package/lib/components/custom-pagination/custom-pagination.component.d.ts +4 -2
- package/lib/components/imput/input.component.d.ts +8 -7
- package/lib/components/search-input/search-input.component.d.ts +44 -0
- package/lib/components/tables/data-paginate.service.d.ts +21 -0
- package/lib/components/tables/data-table.component.d.ts +22 -14
- package/lib/service/auth-service.service.d.ts +9 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
@@ -1,14 +1,17 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { Component, Input, EventEmitter, ChangeDetectionStrategy, Output, HostListener, forwardRef, ViewChild, Directive, NgModule, createComponent
|
2
|
+
import { Component, Input, EventEmitter, ChangeDetectionStrategy, Output, HostListener, Injectable, forwardRef, ViewChild, Directive, NgModule, createComponent } from '@angular/core';
|
3
3
|
import * as i1 from '@angular/common';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
|
-
import * as
|
5
|
+
import * as i3 from '@angular/forms';
|
6
6
|
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
7
7
|
import hljs from 'highlight.js';
|
8
8
|
import * as i1$1 from '@ng-bootstrap/ng-bootstrap';
|
9
|
-
import { of,
|
10
|
-
import * as i3 from '@ng-select/ng-select';
|
9
|
+
import { Subject, of, Subscription, Observable } from 'rxjs';
|
10
|
+
import * as i3$1 from '@ng-select/ng-select';
|
11
11
|
import { NgSelectModule } from '@ng-select/ng-select';
|
12
|
+
import { debounceTime, takeUntil, map } from 'rxjs/operators';
|
13
|
+
import * as i1$2 from '@angular/common/http';
|
14
|
+
import { HttpParams } from '@angular/common/http';
|
12
15
|
|
13
16
|
class AlertComponent {
|
14
17
|
constructor() {
|
@@ -250,8 +253,41 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
250
253
|
args: ['mouseup']
|
251
254
|
}] } });
|
252
255
|
|
253
|
-
class
|
256
|
+
class AuthService {
|
254
257
|
constructor() {
|
258
|
+
this.userRoles = [];
|
259
|
+
this.loadUserRoles();
|
260
|
+
}
|
261
|
+
loadUserRoles() {
|
262
|
+
const storedUser = localStorage.getItem('user');
|
263
|
+
if (!storedUser) {
|
264
|
+
throw new Error('User not found in localStorage');
|
265
|
+
}
|
266
|
+
const { role } = JSON.parse(storedUser);
|
267
|
+
if (!role || !Array.isArray(role)) {
|
268
|
+
throw new Error('Roles not found or invalid in localStorage');
|
269
|
+
}
|
270
|
+
this.userRoles = role.flatMap((roleArray) => roleArray.map(role => role.toString()));
|
271
|
+
}
|
272
|
+
hasPermission(requiredPermissions) {
|
273
|
+
if (this.userRoles.length === 0) {
|
274
|
+
throw new Error('No roles found for the user');
|
275
|
+
}
|
276
|
+
return requiredPermissions.every(permission => this.userRoles.includes(permission));
|
277
|
+
}
|
278
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
279
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, providedIn: 'root' }); }
|
280
|
+
}
|
281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AuthService, decorators: [{
|
282
|
+
type: Injectable,
|
283
|
+
args: [{
|
284
|
+
providedIn: 'root'
|
285
|
+
}]
|
286
|
+
}], ctorParameters: function () { return []; } });
|
287
|
+
|
288
|
+
class ButtonComponent {
|
289
|
+
constructor(authService) {
|
290
|
+
this.authService = authService;
|
255
291
|
this.type = 'button';
|
256
292
|
this.label = 'Submit';
|
257
293
|
this.btnClass = ButtonClasses.Primary;
|
@@ -271,11 +307,13 @@ class ButtonComponent {
|
|
271
307
|
this.marginLeft = 0;
|
272
308
|
this.marginRight = 0;
|
273
309
|
this.permissions = [];
|
274
|
-
this.permissionChecker = null;
|
275
310
|
this.clickEvent = new EventEmitter();
|
276
311
|
this.isHovered = false;
|
277
312
|
this.isActive = false;
|
278
313
|
}
|
314
|
+
ngOnInit() {
|
315
|
+
// O componente não precisa capturar erros do serviço, apenas chama o método de verificação
|
316
|
+
}
|
279
317
|
onMouseEnter() {
|
280
318
|
this.isHovered = true;
|
281
319
|
}
|
@@ -292,7 +330,10 @@ class ButtonComponent {
|
|
292
330
|
onClick(event) {
|
293
331
|
this.clickEvent.emit(event);
|
294
332
|
}
|
295
|
-
|
333
|
+
get dynamicStyles() {
|
334
|
+
return this.calculateDynamicStyles();
|
335
|
+
}
|
336
|
+
calculateDynamicStyles() {
|
296
337
|
let backgroundColor = '';
|
297
338
|
let textColor = '#fff'; // Default text color
|
298
339
|
let borderColor = '';
|
@@ -347,18 +388,29 @@ class ButtonComponent {
|
|
347
388
|
};
|
348
389
|
}
|
349
390
|
hasPermission() {
|
350
|
-
if (!this.
|
391
|
+
if (!this.permissions || this.permissions.length === 0) {
|
392
|
+
return true;
|
393
|
+
}
|
394
|
+
try {
|
395
|
+
return this.authService.hasPermission(this.permissions);
|
396
|
+
}
|
397
|
+
catch (error) {
|
398
|
+
if (error instanceof Error) {
|
399
|
+
console.error('Permission error:', error.message);
|
400
|
+
}
|
401
|
+
else {
|
402
|
+
console.error('Unknown error occurred during permission check');
|
403
|
+
}
|
351
404
|
return true;
|
352
405
|
}
|
353
|
-
return this.permissionChecker(this.permissions);
|
354
406
|
}
|
355
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
356
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ButtonComponent, selector: "sim-app-button", inputs: { type: "type", label: "label", btnClass: "btnClass", fontSize: "fontSize", disabled: "disabled", autofocus: "autofocus", form: "form", formaction: "formaction", formenctype: "formenctype", formmethod: "formmethod", formnovalidate: "formnovalidate", formtarget: "formtarget", name: "name", value: "value", marginTop: "marginTop", marginBottom: "marginBottom", marginLeft: "marginLeft", marginRight: "marginRight", permissions: "permissions"
|
407
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ButtonComponent, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
|
408
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ButtonComponent, selector: "sim-app-button", inputs: { type: "type", label: "label", btnClass: "btnClass", fontSize: "fontSize", disabled: "disabled", autofocus: "autofocus", form: "form", formaction: "formaction", formenctype: "formenctype", formmethod: "formmethod", formnovalidate: "formnovalidate", formtarget: "formtarget", name: "name", value: "value", marginTop: "marginTop", marginBottom: "marginBottom", marginLeft: "marginLeft", marginRight: "marginRight", permissions: "permissions" }, outputs: { clickEvent: "clickEvent" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "mousedown": "onMouseDown()", "mouseup": "onMouseUp()" } }, ngImport: i0, template: `
|
357
409
|
<ng-container *ngIf="hasPermission()">
|
358
410
|
<button [type]="type"
|
359
411
|
class="btn"
|
360
412
|
[ngClass]="btnClass"
|
361
|
-
[ngStyle]="
|
413
|
+
[ngStyle]="dynamicStyles"
|
362
414
|
(click)="onClick($event)"
|
363
415
|
[disabled]="disabled"
|
364
416
|
[attr.autofocus]="autofocus ? true : null"
|
@@ -382,7 +434,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
382
434
|
<button [type]="type"
|
383
435
|
class="btn"
|
384
436
|
[ngClass]="btnClass"
|
385
|
-
[ngStyle]="
|
437
|
+
[ngStyle]="dynamicStyles"
|
386
438
|
(click)="onClick($event)"
|
387
439
|
[disabled]="disabled"
|
388
440
|
[attr.autofocus]="autofocus ? true : null"
|
@@ -398,7 +450,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
398
450
|
</button>
|
399
451
|
</ng-container>
|
400
452
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".btn{padding:.5rem 1rem;border-radius:.25rem;transition:background-color .3s,border-color .3s,filter .3s;font-family:Inter,sans-serif;font-size:16px;font-weight:600;line-height:24px;letter-spacing:.005em;text-align:left}\n"] }]
|
401
|
-
}], propDecorators: { type: [{
|
453
|
+
}], ctorParameters: function () { return [{ type: AuthService }]; }, propDecorators: { type: [{
|
402
454
|
type: Input
|
403
455
|
}], label: [{
|
404
456
|
type: Input
|
@@ -436,8 +488,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
436
488
|
type: Input
|
437
489
|
}], permissions: [{
|
438
490
|
type: Input
|
439
|
-
}], permissionChecker: [{
|
440
|
-
type: Input
|
441
491
|
}], clickEvent: [{
|
442
492
|
type: Output
|
443
493
|
}], onMouseEnter: [{
|
@@ -676,12 +726,15 @@ class ConfirmationComponent {
|
|
676
726
|
cancel() {
|
677
727
|
this.activeModal.dismiss('cancel');
|
678
728
|
}
|
729
|
+
ngOnDestroy() {
|
730
|
+
// Clear any subscriptions if there were any
|
731
|
+
}
|
679
732
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfirmationComponent, deps: [{ token: i1$1.NgbActiveModal }], target: i0.ɵɵFactoryTarget.Component }); }
|
680
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ConfirmationComponent, selector: "app-confirmation", inputs: { title: "title", message: "message", confirmButtonText: "confirmButtonText", cancelButtonText: "cancelButtonText" }, ngImport: i0, template: "<div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"confirmationModalLabel\">{{ title }}</h5>\n</div>\n<div class=\"modal-body\">\n <p>{{ message }}</p>\n</div>\n<div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancel()\">{{ cancelButtonText }}</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"confirm()\" appAutofocus>{{ confirmButtonText }}</button>\n</div>\n", styles: ["@charset \"UTF-8\";.modal-header{background-color:#00444c}.modal-title{font-family:Inter,sans-serif;color:#fff}.modal-body{text-align:center}.modal-body p{color:#666;font-family:Inter,sans-serif;font-size:1.5rem}.modal-footer{background-color:#e9eaeb}.btn-primary{background-color:#00444c;border-color:#00444c;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-primary:hover{opacity:.8}.btn-primary:active{transform:scale(.98);background-color:#00444c;border-color:#00444c}.btn-secondary{background-color:#f44336;border-color:#f44336;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-secondary:hover{opacity:.8}.btn-secondary:active{transform:scale(.98);background-color:#f44336;border-color:#f44336}\n"], dependencies: [{ kind: "directive", type: AutofocusDirective, selector: "[appAutofocus]" }] }); }
|
733
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ConfirmationComponent, selector: "app-confirmation", inputs: { title: "title", message: "message", confirmButtonText: "confirmButtonText", cancelButtonText: "cancelButtonText" }, ngImport: i0, template: "<div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"confirmationModalLabel\">{{ title }}</h5>\n</div>\n<div class=\"modal-body\">\n <p>{{ message }}</p>\n</div>\n<div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancel()\">{{ cancelButtonText }}</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"confirm()\" appAutofocus>{{ confirmButtonText }}</button>\n</div>\n", styles: ["@charset \"UTF-8\";.modal-header{background-color:#00444c}.modal-title{font-family:Inter,sans-serif;color:#fff}.modal-body{text-align:center}.modal-body p{color:#666;font-family:Inter,sans-serif;font-size:1.5rem}.modal-footer{background-color:#e9eaeb}.btn-primary{background-color:#00444c;border-color:#00444c;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-primary:hover{opacity:.8}.btn-primary:active{transform:scale(.98);background-color:#00444c;border-color:#00444c}.btn-secondary{background-color:#f44336;border-color:#f44336;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-secondary:hover{opacity:.8}.btn-secondary:active{transform:scale(.98);background-color:#f44336;border-color:#f44336}\n"], dependencies: [{ kind: "directive", type: AutofocusDirective, selector: "[appAutofocus]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
681
734
|
}
|
682
735
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfirmationComponent, decorators: [{
|
683
736
|
type: Component,
|
684
|
-
args: [{ selector: 'app-confirmation', template: "<div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"confirmationModalLabel\">{{ title }}</h5>\n</div>\n<div class=\"modal-body\">\n <p>{{ message }}</p>\n</div>\n<div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancel()\">{{ cancelButtonText }}</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"confirm()\" appAutofocus>{{ confirmButtonText }}</button>\n</div>\n", styles: ["@charset \"UTF-8\";.modal-header{background-color:#00444c}.modal-title{font-family:Inter,sans-serif;color:#fff}.modal-body{text-align:center}.modal-body p{color:#666;font-family:Inter,sans-serif;font-size:1.5rem}.modal-footer{background-color:#e9eaeb}.btn-primary{background-color:#00444c;border-color:#00444c;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-primary:hover{opacity:.8}.btn-primary:active{transform:scale(.98);background-color:#00444c;border-color:#00444c}.btn-secondary{background-color:#f44336;border-color:#f44336;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-secondary:hover{opacity:.8}.btn-secondary:active{transform:scale(.98);background-color:#f44336;border-color:#f44336}\n"] }]
|
737
|
+
args: [{ selector: 'app-confirmation', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"modal-header\">\n <h5 class=\"modal-title\" id=\"confirmationModalLabel\">{{ title }}</h5>\n</div>\n<div class=\"modal-body\">\n <p>{{ message }}</p>\n</div>\n<div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" (click)=\"cancel()\">{{ cancelButtonText }}</button>\n <button type=\"button\" class=\"btn btn-primary\" (click)=\"confirm()\" appAutofocus>{{ confirmButtonText }}</button>\n</div>\n", styles: ["@charset \"UTF-8\";.modal-header{background-color:#00444c}.modal-title{font-family:Inter,sans-serif;color:#fff}.modal-body{text-align:center}.modal-body p{color:#666;font-family:Inter,sans-serif;font-size:1.5rem}.modal-footer{background-color:#e9eaeb}.btn-primary{background-color:#00444c;border-color:#00444c;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-primary:hover{opacity:.8}.btn-primary:active{transform:scale(.98);background-color:#00444c;border-color:#00444c}.btn-secondary{background-color:#f44336;border-color:#f44336;font-family:Inter,sans-serif;transition:opacity .3s,transform .1s}.btn-secondary:hover{opacity:.8}.btn-secondary:active{transform:scale(.98);background-color:#f44336;border-color:#f44336}\n"] }]
|
685
738
|
}], ctorParameters: function () { return [{ type: i1$1.NgbActiveModal }]; }, propDecorators: { title: [{
|
686
739
|
type: Input
|
687
740
|
}], message: [{
|
@@ -702,6 +755,7 @@ class CustomPaginationComponent {
|
|
702
755
|
this.ofText = 'of'; // Texto para "of"
|
703
756
|
this.showPageInfo = true; // Mostrar ou esconder a informação da página
|
704
757
|
this.pageChange = new EventEmitter();
|
758
|
+
this.destroy$ = new Subject();
|
705
759
|
}
|
706
760
|
get totalPages() {
|
707
761
|
return Math.ceil(this.totalItems / this.itemsPerPage);
|
@@ -726,6 +780,10 @@ class CustomPaginationComponent {
|
|
726
780
|
}
|
727
781
|
return pages;
|
728
782
|
}
|
783
|
+
ngOnDestroy() {
|
784
|
+
this.destroy$.next();
|
785
|
+
this.destroy$.complete();
|
786
|
+
}
|
729
787
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CustomPaginationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
730
788
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CustomPaginationComponent, selector: "custom-pagination", inputs: { totalItems: "totalItems", itemsPerPage: "itemsPerPage", currentPage: "currentPage", maxSize: "maxSize", pageText: "pageText", ofText: "ofText", showPageInfo: "showPageInfo" }, outputs: { pageChange: "pageChange" }, ngImport: i0, template: "<nav *ngIf=\"totalPages > 0\">\n <ul class=\"pagination\">\n <li class=\"page-item\" [class.disabled]=\"currentPage === 1\">\n <a class=\"page-link\" (click)=\"changePage(1)\">««</a>\n </li>\n <li class=\"page-item\" [class.disabled]=\"currentPage === 1\">\n <a class=\"page-link\" (click)=\"changePage(currentPage - 1)\">«</a>\n </li>\n <li class=\"page-item\" *ngFor=\"let page of pages\" [class.active]=\"page === currentPage\">\n <a class=\"page-link\" (click)=\"changePage(page)\">{{ page }}</a>\n </li>\n <li class=\"page-item\" [class.disabled]=\"currentPage === totalPages\">\n <a class=\"page-link\" (click)=\"changePage(currentPage + 1)\">»</a>\n </li>\n <li class=\"page-item\" [class.disabled]=\"currentPage === totalPages\">\n <a class=\"page-link\" (click)=\"changePage(totalPages)\">»»</a>\n </li>\n </ul>\n <div class=\"page-info\" *ngIf=\"showPageInfo\" style=\"font-size: 0.8rem;\">\n {{ pageText }} {{ currentPage }} {{ ofText }} {{ totalPages }}\n </div>\n</nav>\n", styles: [".pagination{display:flex;list-style:none;padding:0;margin:1rem 0;justify-content:center;align-items:center}.page-item{margin:0 .25rem}.page-item.disabled .page-link{cursor:not-allowed;opacity:.5}.page-item.active .page-link{background-color:#00444c;color:#fff}.page-item .page-link{padding:.5rem .75rem;border:1px solid #dee2e6;border-radius:.25rem;text-decoration:none;color:#00444c;cursor:pointer;transition:background-color .2s}.page-item .page-link:hover{background-color:#2ca58d}.page-info{margin-left:1rem;font-size:1rem;color:#00444c;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
731
789
|
}
|
@@ -820,7 +878,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
820
878
|
}] } });
|
821
879
|
|
822
880
|
class InputComponent {
|
823
|
-
constructor() {
|
881
|
+
constructor(authService) {
|
882
|
+
this.authService = authService;
|
824
883
|
this.label = 'Default Label';
|
825
884
|
this.placeholder = '';
|
826
885
|
this.id = 'inputId';
|
@@ -838,7 +897,6 @@ class InputComponent {
|
|
838
897
|
this.marginRight = 0;
|
839
898
|
this.labelFontWeight = 400;
|
840
899
|
this.permissions = [];
|
841
|
-
this.permissionChecker = null;
|
842
900
|
this.inputEvent = new EventEmitter();
|
843
901
|
this.changeEvent = new EventEmitter();
|
844
902
|
this.focusEvent = new EventEmitter();
|
@@ -849,6 +907,7 @@ class InputComponent {
|
|
849
907
|
this.onChangeCallback = () => { };
|
850
908
|
this.onTouchedCallback = () => { };
|
851
909
|
this.value = '';
|
910
|
+
this.subscriptions = [];
|
852
911
|
}
|
853
912
|
onInput(event) {
|
854
913
|
const inputElement = event.target;
|
@@ -866,15 +925,6 @@ class InputComponent {
|
|
866
925
|
this.onTouchedCallback();
|
867
926
|
this.blurEvent.emit(event);
|
868
927
|
}
|
869
|
-
onKeyup(event) {
|
870
|
-
this.keyupEvent.emit(event);
|
871
|
-
}
|
872
|
-
onKeydown(event) {
|
873
|
-
this.keydownEvent.emit(event);
|
874
|
-
}
|
875
|
-
onKeypress(event) {
|
876
|
-
this.keypressEvent.emit(event);
|
877
|
-
}
|
878
928
|
writeValue(value) {
|
879
929
|
this.value = value;
|
880
930
|
}
|
@@ -888,10 +938,21 @@ class InputComponent {
|
|
888
938
|
this.disabled = isDisabled;
|
889
939
|
}
|
890
940
|
hasPermission() {
|
891
|
-
if (
|
941
|
+
if (this.permissions.length === 0) {
|
942
|
+
return true;
|
943
|
+
}
|
944
|
+
try {
|
945
|
+
return this.authService.hasPermission(this.permissions);
|
946
|
+
}
|
947
|
+
catch (error) {
|
948
|
+
if (error instanceof Error) {
|
949
|
+
console.error('Permission error:', error.message);
|
950
|
+
}
|
951
|
+
else {
|
952
|
+
console.error('Unknown error occurred during permission check');
|
953
|
+
}
|
892
954
|
return true;
|
893
955
|
}
|
894
|
-
return this.permissionChecker(this.permissions);
|
895
956
|
}
|
896
957
|
getLabelStyles() {
|
897
958
|
return {
|
@@ -908,8 +969,11 @@ class InputComponent {
|
|
908
969
|
'text-align': 'left'
|
909
970
|
};
|
910
971
|
}
|
911
|
-
|
912
|
-
|
972
|
+
ngOnDestroy() {
|
973
|
+
this.subscriptions.forEach(sub => sub.unsubscribe());
|
974
|
+
}
|
975
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InputComponent, deps: [{ token: AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
|
976
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: InputComponent, selector: "sim-app-input", inputs: { label: "label", placeholder: "placeholder", id: "id", type: "type", disabled: "disabled", readonly: "readonly", maxlength: "maxlength", minlength: "minlength", required: "required", pattern: "pattern", autofocus: "autofocus", marginTop: "marginTop", marginBottom: "marginBottom", marginLeft: "marginLeft", marginRight: "marginRight", labelFontWeight: "labelFontWeight", permissions: "permissions" }, outputs: { inputEvent: "inputEvent", changeEvent: "changeEvent", focusEvent: "focusEvent", blurEvent: "blurEvent", keyupEvent: "keyupEvent", keydownEvent: "keydownEvent", keypressEvent: "keypressEvent" }, providers: [
|
913
977
|
{
|
914
978
|
provide: NG_VALUE_ACCESSOR,
|
915
979
|
useExisting: forwardRef(() => InputComponent),
|
@@ -932,9 +996,9 @@ class InputComponent {
|
|
932
996
|
(change)="onChange($event)"
|
933
997
|
(focus)="onFocus($event)"
|
934
998
|
(blur)="onBlur($event)"
|
935
|
-
(keyup)="
|
936
|
-
(keydown)="
|
937
|
-
(keypress)="
|
999
|
+
(keyup)="keyupEvent.emit($event)"
|
1000
|
+
(keydown)="keydownEvent.emit($event)"
|
1001
|
+
(keypress)="keypressEvent.emit($event)"
|
938
1002
|
[disabled]="disabled"
|
939
1003
|
[readonly]="readonly"
|
940
1004
|
[attr.maxlength]="maxlength"
|
@@ -943,7 +1007,7 @@ class InputComponent {
|
|
943
1007
|
[attr.pattern]="pattern"
|
944
1008
|
[autofocus]="autofocus">
|
945
1009
|
</div>
|
946
|
-
`, isInline: true, styles: [".form-group{font-family:Inter;font-size:1rem;font-weight:700}.form-check-input{font-family:Inter;color:#333;font-size:.9rem}.form-check-label{width:623px;height:19px;top:1608px;left:133px;gap:0px;opacity:0px;font-family:Inter;font-size:16px;line-height:19.36px;text-align:left}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type:
|
1010
|
+
`, isInline: true, styles: [".form-group{font-family:Inter;font-size:1rem;font-weight:700}.form-check-input{font-family:Inter;color:#333;font-size:.9rem}.form-check-label{width:623px;height:19px;top:1608px;left:133px;gap:0px;opacity:0px;font-family:Inter;font-size:16px;line-height:19.36px;text-align:left}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
947
1011
|
}
|
948
1012
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: InputComponent, decorators: [{
|
949
1013
|
type: Component,
|
@@ -964,9 +1028,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
964
1028
|
(change)="onChange($event)"
|
965
1029
|
(focus)="onFocus($event)"
|
966
1030
|
(blur)="onBlur($event)"
|
967
|
-
(keyup)="
|
968
|
-
(keydown)="
|
969
|
-
(keypress)="
|
1031
|
+
(keyup)="keyupEvent.emit($event)"
|
1032
|
+
(keydown)="keydownEvent.emit($event)"
|
1033
|
+
(keypress)="keypressEvent.emit($event)"
|
970
1034
|
[disabled]="disabled"
|
971
1035
|
[readonly]="readonly"
|
972
1036
|
[attr.maxlength]="maxlength"
|
@@ -982,7 +1046,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
982
1046
|
multi: true
|
983
1047
|
}
|
984
1048
|
], changeDetection: ChangeDetectionStrategy.OnPush, styles: [".form-group{font-family:Inter;font-size:1rem;font-weight:700}.form-check-input{font-family:Inter;color:#333;font-size:.9rem}.form-check-label{width:623px;height:19px;top:1608px;left:133px;gap:0px;opacity:0px;font-family:Inter;font-size:16px;line-height:19.36px;text-align:left}\n"] }]
|
985
|
-
}], propDecorators: { label: [{
|
1049
|
+
}], ctorParameters: function () { return [{ type: AuthService }]; }, propDecorators: { label: [{
|
986
1050
|
type: Input
|
987
1051
|
}], placeholder: [{
|
988
1052
|
type: Input
|
@@ -1016,8 +1080,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1016
1080
|
type: Input
|
1017
1081
|
}], permissions: [{
|
1018
1082
|
type: Input
|
1019
|
-
}], permissionChecker: [{
|
1020
|
-
type: Input
|
1021
1083
|
}], inputEvent: [{
|
1022
1084
|
type: Output
|
1023
1085
|
}], changeEvent: [{
|
@@ -1111,7 +1173,7 @@ class MultiSelectComponent {
|
|
1111
1173
|
</ng-template>
|
1112
1174
|
</ng-select>
|
1113
1175
|
</div>
|
1114
|
-
`, isInline: true, styles: [".form-group{font-family:Arial,sans-serif;font-size:1rem}.form-label{font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type:
|
1176
|
+
`, isInline: true, styles: [".form-group{font-family:Arial,sans-serif;font-size:1rem}.form-label{font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i3$1.NgSelectComponent, selector: "ng-select", inputs: ["bindLabel", "bindValue", "markFirst", "placeholder", "notFoundText", "typeToSearchText", "addTagText", "loadingText", "clearAllText", "appearance", "dropdownPosition", "appendTo", "loading", "closeOnSelect", "hideSelected", "selectOnTab", "openOnEnter", "maxSelectedItems", "groupBy", "groupValue", "bufferAmount", "virtualScroll", "selectableGroup", "selectableGroupAsModel", "searchFn", "trackByFn", "clearOnBackspace", "labelForId", "inputAttrs", "tabIndex", "readonly", "searchWhileComposing", "minTermLength", "editableSearchTerm", "keyDownFn", "typeahead", "multiple", "addTag", "searchable", "clearable", "isOpen", "items", "compareWith", "clearSearchOnAdd", "deselectOnClick"], outputs: ["blur", "focus", "change", "open", "close", "search", "clear", "add", "remove", "scroll", "scrollToEnd"] }, { kind: "directive", type: i3$1.NgOptionTemplateDirective, selector: "[ng-option-tmp]" }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1115
1177
|
}
|
1116
1178
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
1117
1179
|
type: Component,
|
@@ -1284,6 +1346,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1284
1346
|
type: Output
|
1285
1347
|
}] } });
|
1286
1348
|
|
1349
|
+
class SearchInputComponent {
|
1350
|
+
constructor() {
|
1351
|
+
this.id = '';
|
1352
|
+
this.label = 'Search';
|
1353
|
+
this.type = 'text';
|
1354
|
+
this.placeholder = 'Type to search...';
|
1355
|
+
this.value = '';
|
1356
|
+
this.disabled = false;
|
1357
|
+
this.readonly = false;
|
1358
|
+
this.autofocus = false;
|
1359
|
+
this.maxlength = null;
|
1360
|
+
this.minlength = null;
|
1361
|
+
this.required = false;
|
1362
|
+
this.pattern = null;
|
1363
|
+
this.debounceTime = 700; // Valor padrão
|
1364
|
+
this.search = new EventEmitter();
|
1365
|
+
this.inputChange = new EventEmitter();
|
1366
|
+
this.change = new EventEmitter();
|
1367
|
+
this.focus = new EventEmitter();
|
1368
|
+
this.blur = new EventEmitter();
|
1369
|
+
this.keyup = new EventEmitter();
|
1370
|
+
this.keydown = new EventEmitter();
|
1371
|
+
this.keypress = new EventEmitter();
|
1372
|
+
this.searchSubject = new Subject();
|
1373
|
+
this.searchSubscription = new Subscription();
|
1374
|
+
}
|
1375
|
+
ngOnInit() {
|
1376
|
+
this.searchSubscription = this.searchSubject.pipe(debounceTime(this.debounceTime)).subscribe((searchText) => {
|
1377
|
+
this.search.emit(searchText);
|
1378
|
+
});
|
1379
|
+
}
|
1380
|
+
onInput(event) {
|
1381
|
+
const inputElement = event.target;
|
1382
|
+
const value = inputElement.value;
|
1383
|
+
this.value = value;
|
1384
|
+
this.inputChange.emit(value); // Emite o valor de input imediatamente
|
1385
|
+
this.searchSubject.next(value);
|
1386
|
+
}
|
1387
|
+
onChange(event) {
|
1388
|
+
this.change.emit(event);
|
1389
|
+
}
|
1390
|
+
onFocus(event) {
|
1391
|
+
this.focus.emit(event);
|
1392
|
+
}
|
1393
|
+
onBlur(event) {
|
1394
|
+
this.blur.emit(event);
|
1395
|
+
}
|
1396
|
+
onKeyup(event) {
|
1397
|
+
this.keyup.emit(event);
|
1398
|
+
}
|
1399
|
+
onKeydown(event) {
|
1400
|
+
this.keydown.emit(event);
|
1401
|
+
}
|
1402
|
+
onKeypress(event) {
|
1403
|
+
this.keypress.emit(event);
|
1404
|
+
}
|
1405
|
+
ngOnDestroy() {
|
1406
|
+
this.searchSubscription.unsubscribe();
|
1407
|
+
}
|
1408
|
+
getLabelStyles() {
|
1409
|
+
return {
|
1410
|
+
fontFamily: 'Inter',
|
1411
|
+
fontSize: '16px',
|
1412
|
+
lineHeight: '19.36px',
|
1413
|
+
};
|
1414
|
+
}
|
1415
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SearchInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1416
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SearchInputComponent, selector: "sim-search-input", inputs: { id: "id", label: "label", type: "type", placeholder: "placeholder", value: "value", disabled: "disabled", readonly: "readonly", autofocus: "autofocus", maxlength: "maxlength", minlength: "minlength", required: "required", pattern: "pattern", debounceTime: "debounceTime" }, outputs: { search: "search", inputChange: "inputChange", change: "change", focus: "focus", blur: "blur", keyup: "keyup", keydown: "keydown", keypress: "keypress" }, ngImport: i0, template: "<div class=\"form-group\">\n <label [for]=\"id\" [ngStyle]=\"getLabelStyles()\">{{ label }}</label>\n <input [type]=\"type\"\n class=\"form-control custom-input\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [(ngModel)]=\"value\"\n (input)=\"onInput($event)\"\n (change)=\"onChange($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (keypress)=\"onKeypress($event)\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [attr.maxlength]=\"maxlength\"\n [attr.minlength]=\"minlength\"\n [required]=\"required\"\n [attr.pattern]=\"pattern\"\n [autofocus]=\"autofocus\">\n</div>\n", styles: [".form-group{font-family:Inter;font-size:1rem;font-weight:700}.custom-input{font-family:Inter;color:#333;font-size:.9rem}label{font-family:Inter;font-size:16px;line-height:19.36px;text-align:left}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
1417
|
+
}
|
1418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SearchInputComponent, decorators: [{
|
1419
|
+
type: Component,
|
1420
|
+
args: [{ selector: 'sim-search-input', template: "<div class=\"form-group\">\n <label [for]=\"id\" [ngStyle]=\"getLabelStyles()\">{{ label }}</label>\n <input [type]=\"type\"\n class=\"form-control custom-input\"\n [id]=\"id\"\n [placeholder]=\"placeholder\"\n [(ngModel)]=\"value\"\n (input)=\"onInput($event)\"\n (change)=\"onChange($event)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"onBlur($event)\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (keypress)=\"onKeypress($event)\"\n [disabled]=\"disabled\"\n [readonly]=\"readonly\"\n [attr.maxlength]=\"maxlength\"\n [attr.minlength]=\"minlength\"\n [required]=\"required\"\n [attr.pattern]=\"pattern\"\n [autofocus]=\"autofocus\">\n</div>\n", styles: [".form-group{font-family:Inter;font-size:1rem;font-weight:700}.custom-input{font-family:Inter;color:#333;font-size:.9rem}label{font-family:Inter;font-size:16px;line-height:19.36px;text-align:left}\n"] }]
|
1421
|
+
}], ctorParameters: function () { return []; }, propDecorators: { id: [{
|
1422
|
+
type: Input
|
1423
|
+
}], label: [{
|
1424
|
+
type: Input
|
1425
|
+
}], type: [{
|
1426
|
+
type: Input
|
1427
|
+
}], placeholder: [{
|
1428
|
+
type: Input
|
1429
|
+
}], value: [{
|
1430
|
+
type: Input
|
1431
|
+
}], disabled: [{
|
1432
|
+
type: Input
|
1433
|
+
}], readonly: [{
|
1434
|
+
type: Input
|
1435
|
+
}], autofocus: [{
|
1436
|
+
type: Input
|
1437
|
+
}], maxlength: [{
|
1438
|
+
type: Input
|
1439
|
+
}], minlength: [{
|
1440
|
+
type: Input
|
1441
|
+
}], required: [{
|
1442
|
+
type: Input
|
1443
|
+
}], pattern: [{
|
1444
|
+
type: Input
|
1445
|
+
}], debounceTime: [{
|
1446
|
+
type: Input
|
1447
|
+
}], search: [{
|
1448
|
+
type: Output
|
1449
|
+
}], inputChange: [{
|
1450
|
+
type: Output
|
1451
|
+
}], change: [{
|
1452
|
+
type: Output
|
1453
|
+
}], focus: [{
|
1454
|
+
type: Output
|
1455
|
+
}], blur: [{
|
1456
|
+
type: Output
|
1457
|
+
}], keyup: [{
|
1458
|
+
type: Output
|
1459
|
+
}], keydown: [{
|
1460
|
+
type: Output
|
1461
|
+
}], keypress: [{
|
1462
|
+
type: Output
|
1463
|
+
}] } });
|
1464
|
+
|
1287
1465
|
class SelectComponent {
|
1288
1466
|
constructor() {
|
1289
1467
|
this.label = 'Default Label';
|
@@ -1339,7 +1517,7 @@ class SelectComponent {
|
|
1339
1517
|
<option *ngFor="let option of options" [value]="option.value">{{ option.label }}</option>
|
1340
1518
|
</select>
|
1341
1519
|
</div>
|
1342
|
-
`, isInline: true, styles: [".form-group{margin-bottom:1rem}.form-label{font-family:Arial,sans-serif;color:#333;font-size:1rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type:
|
1520
|
+
`, isInline: true, styles: [".form-group{margin-bottom:1rem}.form-label{font-family:Arial,sans-serif;color:#333;font-size:1rem;font-weight:700}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1343
1521
|
}
|
1344
1522
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectComponent, decorators: [{
|
1345
1523
|
type: Component,
|
@@ -1387,10 +1565,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1387
1565
|
}] } });
|
1388
1566
|
|
1389
1567
|
class DataTableComponent {
|
1390
|
-
constructor(cdr) {
|
1568
|
+
constructor(cdr, authService) {
|
1391
1569
|
this.cdr = cdr;
|
1570
|
+
this.authService = authService;
|
1392
1571
|
this.columns = [];
|
1393
|
-
this.
|
1572
|
+
this.hiddenColumns = [];
|
1394
1573
|
this.itemsPerPageOptions = [5, 10, 15, 20];
|
1395
1574
|
this.defaultItemsPerPage = 10;
|
1396
1575
|
this.itemsPerPageLabel = 'Items per page:';
|
@@ -1404,15 +1583,15 @@ class DataTableComponent {
|
|
1404
1583
|
this.tableFontColor = '#000';
|
1405
1584
|
this.tableFontSize = '14px';
|
1406
1585
|
this.fetchDataFunction = () => {
|
1407
|
-
return
|
1408
|
-
};
|
1586
|
+
return new Observable(subscriber => subscriber.error('Implement the fetchDataFunction to fetch paginated data from the back-end.'));
|
1587
|
+
};
|
1409
1588
|
this.editPermissions = [];
|
1410
1589
|
this.deletePermissions = [];
|
1411
1590
|
this.viewPermissions = [];
|
1412
|
-
this.
|
1413
|
-
this.
|
1414
|
-
this.
|
1415
|
-
this.
|
1591
|
+
this.showPageInfo = true;
|
1592
|
+
this.pageText = 'Page';
|
1593
|
+
this.ofText = 'of';
|
1594
|
+
this.filterDescription = ''; // Novo input para filterDescription
|
1416
1595
|
this.sortChange = new EventEmitter();
|
1417
1596
|
this.pageChange = new EventEmitter();
|
1418
1597
|
this.itemsPerPageChange = new EventEmitter();
|
@@ -1420,8 +1599,11 @@ class DataTableComponent {
|
|
1420
1599
|
this.onDeleteTable = new EventEmitter();
|
1421
1600
|
this.onViewTable = new EventEmitter();
|
1422
1601
|
this.currentPage = 1;
|
1602
|
+
this.sortColumn = '';
|
1603
|
+
this.sortDirection = 'asc';
|
1423
1604
|
this.pagedData = [];
|
1424
1605
|
this.isLoading = false;
|
1606
|
+
this.destroy$ = new Subject();
|
1425
1607
|
this.labelStyle = {
|
1426
1608
|
'font-family': 'Inter, Arial, sans-serif',
|
1427
1609
|
'font-size': '14px',
|
@@ -1430,75 +1612,104 @@ class DataTableComponent {
|
|
1430
1612
|
}
|
1431
1613
|
ngOnInit() {
|
1432
1614
|
this.fetchData();
|
1433
|
-
this.setDefaultPermissions();
|
1434
1615
|
}
|
1435
1616
|
ngOnChanges(changes) {
|
1436
|
-
if (changes['totalItems'] || changes['defaultItemsPerPage'] || changes['currentPage'] || changes['
|
1617
|
+
if (changes['totalItems'] || changes['defaultItemsPerPage'] || changes['currentPage'] || changes['fetchDataFunction'] || changes['filterDescription']) {
|
1437
1618
|
this.fetchData();
|
1438
1619
|
}
|
1439
1620
|
}
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
}
|
1621
|
+
ngOnDestroy() {
|
1622
|
+
this.destroy$.next();
|
1623
|
+
this.destroy$.complete();
|
1444
1624
|
}
|
1445
|
-
|
1625
|
+
fetchData() {
|
1446
1626
|
if (this.fetchDataFunction) {
|
1447
1627
|
this.isLoading = true;
|
1448
|
-
|
1449
|
-
|
1450
|
-
this.
|
1451
|
-
this.
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1628
|
+
const params = {
|
1629
|
+
filterDescription: this.filterDescription,
|
1630
|
+
pageNumber: this.currentPage,
|
1631
|
+
pageSize: this.defaultItemsPerPage,
|
1632
|
+
sortColumn: this.sortColumn,
|
1633
|
+
sortDirection: this.sortDirection
|
1634
|
+
};
|
1635
|
+
this.fetchDataFunction(params).pipe(takeUntil(this.destroy$)).subscribe({
|
1636
|
+
next: (result) => {
|
1637
|
+
this.pagedData = result.items;
|
1638
|
+
this.totalItems = result.totalItems;
|
1639
|
+
this.isLoading = false;
|
1640
|
+
this.cdr.markForCheck();
|
1641
|
+
},
|
1642
|
+
error: (error) => {
|
1643
|
+
console.error('Error fetching data:', error);
|
1644
|
+
this.isLoading = false;
|
1645
|
+
}
|
1646
|
+
});
|
1457
1647
|
}
|
1458
1648
|
}
|
1459
1649
|
onSort(column) {
|
1460
|
-
this.
|
1650
|
+
this.sortColumn = column;
|
1651
|
+
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
1652
|
+
this.sortChange.emit({ column, direction: this.sortDirection });
|
1653
|
+
this.fetchData();
|
1461
1654
|
}
|
1462
1655
|
onPageChange(page) {
|
1463
1656
|
this.currentPage = page;
|
1464
1657
|
this.pageChange.emit(page);
|
1465
1658
|
this.fetchData();
|
1466
1659
|
}
|
1467
|
-
onItemsPerPageChange(
|
1468
|
-
const itemsPerPage = parseInt(event, 10);
|
1469
|
-
this.defaultItemsPerPage = itemsPerPage;
|
1660
|
+
onItemsPerPageChange() {
|
1470
1661
|
this.currentPage = 1;
|
1471
|
-
this.itemsPerPageChange.emit(
|
1662
|
+
this.itemsPerPageChange.emit(this.defaultItemsPerPage);
|
1472
1663
|
this.fetchData();
|
1473
1664
|
}
|
1474
1665
|
handleAction(action, item, index) {
|
1475
1666
|
switch (action) {
|
1476
1667
|
case 'edit':
|
1477
|
-
this.
|
1668
|
+
if (this.hasPermission(this.editPermissions)) {
|
1669
|
+
this.onEditTable.emit({ item, index });
|
1670
|
+
}
|
1478
1671
|
break;
|
1479
1672
|
case 'delete':
|
1480
|
-
this.
|
1673
|
+
if (this.hasPermission(this.deletePermissions)) {
|
1674
|
+
this.onDeleteTable.emit({ item, index });
|
1675
|
+
}
|
1481
1676
|
break;
|
1482
1677
|
case 'view':
|
1483
|
-
this.
|
1678
|
+
if (this.hasPermission(this.viewPermissions)) {
|
1679
|
+
this.onViewTable.emit({ item, index });
|
1680
|
+
}
|
1484
1681
|
break;
|
1485
1682
|
}
|
1486
1683
|
}
|
1487
1684
|
hasPermission(requiredPermissions) {
|
1488
|
-
if (!
|
1685
|
+
if (!requiredPermissions || requiredPermissions.length === 0) {
|
1686
|
+
return true;
|
1687
|
+
}
|
1688
|
+
try {
|
1689
|
+
return this.authService.hasPermission(requiredPermissions);
|
1690
|
+
}
|
1691
|
+
catch (error) {
|
1692
|
+
if (error instanceof Error) {
|
1693
|
+
console.error('Permission error:', error.message);
|
1694
|
+
}
|
1695
|
+
else {
|
1696
|
+
console.error('Unknown error occurred during permission check');
|
1697
|
+
}
|
1489
1698
|
return true;
|
1490
1699
|
}
|
1491
|
-
return requiredPermissions.every(permission => this.userPermissions.includes(permission));
|
1492
1700
|
}
|
1493
|
-
|
1494
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DataTableComponent, selector: "sim-data-table", inputs: { columns: "columns", data: "data", itemsPerPageOptions: "itemsPerPageOptions", defaultItemsPerPage: "defaultItemsPerPage", itemsPerPageLabel: "itemsPerPageLabel", marginTop: "marginTop", marginBottom: "marginBottom", marginLeft: "marginLeft", marginRight: "marginRight", showActionColumn: "showActionColumn", actionColumnLabel: "actionColumnLabel", totalItems: "totalItems", tableFontColor: "tableFontColor", tableFontSize: "tableFontSize", fetchDataFunction: "fetchDataFunction", editPermissions: "editPermissions", deletePermissions: "deletePermissions", viewPermissions: "viewPermissions", userPermissions: "userPermissions", showPageInfo: "showPageInfo", pageText: "pageText", ofText: "ofText" }, outputs: { sortChange: "sortChange", pageChange: "pageChange", itemsPerPageChange: "itemsPerPageChange", onEditTable: "onEditTable", onDeleteTable: "onDeleteTable", onViewTable: "onViewTable" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"form-group\" [ngStyle]=\"{\n 'margin-top': marginTop + 'rem',\n 'margin-bottom': marginBottom + 'rem',\n 'margin-left': marginLeft + 'rem',\n 'margin-right': marginRight + 'rem'\n}\" style=\"text-align: right;\">\n <label for=\"itemsPerPageSelect\" style=\"margin-right: 0.5rem; margin-bottom: 0.7rem;\" [ngStyle]=\"labelStyle\">{{ itemsPerPageLabel }}</label>\n <select\n id=\"itemsPerPageSelect\"\n class=\"form-control form-control-sm d-inline-block w-auto\"\n [(ngModel)]=\"defaultItemsPerPage\"\n (ngModelChange)=\"onItemsPerPageChange($event)\">\n <option *ngFor=\"let option of itemsPerPageOptions\" [value]=\"option\">{{ option }}</option>\n </select>\n</div>\n\n<div class=\"table-responsive\">\n <table class=\"table table-hover\" [ngStyle]=\"{ 'color': tableFontColor, 'font-size': tableFontSize }\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let column of columns\">\n <th *ngIf=\"hasPermission(column.permissions || [])\" (click)=\"onSort(column.prop)\">\n {{ column.label }}\n </th>\n </ng-container>\n <th *ngIf=\"showActionColumn\">{{ actionColumnLabel }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of pagedData; let i = index\">\n <ng-container *ngFor=\"let column of columns\">\n <td *ngIf=\"hasPermission(column.permissions || [])\">\n {{ item[column.prop] }}\n </td>\n </ng-container>\n <td *ngIf=\"showActionColumn\">\n <div class=\"d-flex justify-content-center\">\n <div *ngIf=\"hasPermission(editPermissions)\" (click)=\"handleAction('edit', item, i)\" class=\"btn-icon edit mx-1\"></div>\n <div *ngIf=\"hasPermission(deletePermissions)\" (click)=\"handleAction('delete', item, i)\" class=\"btn-icon delete mx-1\"></div>\n <div *ngIf=\"hasPermission(viewPermissions)\" (click)=\"handleAction('view', item, i)\" class=\"btn-icon view mx-1\"></div>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n\n<div class=\"text-center pagination-controls\">\n <custom-pagination\n [totalItems]=\"totalItems\"\n [itemsPerPage]=\"defaultItemsPerPage\"\n [currentPage]=\"currentPage\"\n [showPageInfo]=\"showPageInfo\"\n [pageText]=\"pageText\"\n [ofText]=\"ofText\"\n (pageChange)=\"onPageChange($event)\">\n </custom-pagination>\n</div>\n", styles: ["@charset \"UTF-8\";@import\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\";:host{font-family:Inter,Arial,sans-serif}.label-style{font-family:Inter,Arial,sans-serif;font-size:14px;color:#000}.table{font-family:Inter,Arial,sans-serif;color:var(--table-font-color, #000);font-size:var(--table-font-size, 14px);border-collapse:separate;border-spacing:0;border-radius:8px;overflow:hidden;border:.13rem solid #00444C}.table thead th{background-color:#00444c;color:#fff;padding:10px;border-bottom:1rem solid rgba(0,68,76,.8);border-right:1rem solid rgba(0,68,76,.8);border-radius:0}.table thead th:last-child{border-right:none}.table tbody td{padding:10px;border-bottom:.1rem solid rgba(0,68,76,.8);border-right:.1rem solid rgba(0,68,76,.8)}.table tbody tr:last-child td{border-bottom:none}.table tbody td:last-child{border-right:none}.table thead th:first-child{border-top-left-radius:0}.table thead th:last-child{border-top-right-radius:0}.table tbody tr:last-child td:first-child{border-bottom-left-radius:8px}.table tbody tr:last-child td:last-child{border-bottom-right-radius:8px}.btn-icon{width:24px;height:24px;background-size:cover;display:inline-block;cursor:pointer;margin-right:16px}.btn-icon.edit{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAABrUlEQVR4nGNgoDI44+PD9b++nona5jLsSC4UupOauvpVVdXLJ4WF128mJkZSzfCdxfViG5dueHtswcr/3/v7wfhxYeF1qvikuLtbbMXG/WduPPvy/+K9t/8PLVwFtuBlZeVLUHBRZHhMdzF3Wk//7XN3Xv27+fzrfxC+dPfNf5BP7qanr6DYcL2CxF2MLj7/oxp7/1+4+wZsCcgnm5Zuersls0KQIsP185N2gwxngOLw+p7/IJ8s37Tv4sbWVnGquJwBCYP4qb199/ImTKDQ8MKEndgM1y9MPOjXWcpLkeFGxYl7GF3pbLjBkHW5/sg1vL47Q8y6JOE0zQwPqEl8h244g6vPf928hH0UGQ4CU2akHbLOjcN0eX7intApWTwUGb6221vn0d7KD5s2VP93LEyAG+5UGn+bYsNBYM/chFlfz7X+B+Etm6r/OxQm/A+oTnpXPyVegmLDMzJcxULDgn883F8PtuDR3oqPs2enHaickEx+wYUMcpKDNps5+P4PDQv+uW9e8sIVfYFGDNQC/xkYGIOD/Z8nxwfujIvzlqaawTBQz8DABMJUNxgKAOk7VoIIOJGlAAAAAElFTkSuQmCC)}.btn-icon.delete{background-image:url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220%2C0%2C256%2C256%22 width%3D%2224px%22 height%3D%2224px%22%3E%3Cg fill%3D%22%23fb0909%22 fill-rule%3D%22nonzero%22 stroke%3D%22none%22 stroke-width%3D%221%22 stroke-linecap%3D%22butt%22 stroke-linejoin%3D%22miter%22 stroke-miterlimit%3D%2210%22 stroke-dasharray%3D%22%22 stroke-dashoffset%3D%220%22 font-family%3D%22none%22 font-weight%3D%22none%22 font-size%3D%22none%22 text-anchor%3D%22none%22 style%3D%22mix-blend-mode%3A normal%22%3E%3Cg transform%3D%22scale(2%2C2)%22%3E%3Cpath d%3D%22M49%2C1c-1.66%2C0 -3%2C1.34 -3%2C3c0%2C1.66 1.34%2C3 3%2C3h30c1.66%2C0 3%2C-1.34 3%2C-3c0%2C-1.66 -1.34%2C-3 -3%2C-3zM24%2C15c-7.17%2C0 -13%2C5.83 -13%2C13c0%2C7.17 5.83%2C13 13%2C13h77v63c0%2C9.37 -7.63%2C17 -17%2C17h-40c-9.37%2C0 -17%2C-7.63 -17%2C-17v-52c0%2C-1.66 -1.34%2C-3 -3%2C-3c-1.66%2C0 -3%2C1.34 -3%2C3v52c0%2C12.68 10.32%2C23 23%2C23h40c12.68%2C0 23%2C-10.32 23%2C-23v-63.35937c5.72%2C-1.36 10%2C-6.50062 10%2C-12.64062c0%2C-7.17 -5.83%2C-13 -13%2C-13zM24%2C21h80c3.86%2C0 7%2C3.14 7%2C7c0%2C3.86 -3.14%2C7 -7%2C7h-80c-3.86%2C0 -7%2C-3.14 -7%2C-7c0%2C-3.86 3.14%2C-7 7%2C-7zM50%2C55c-1.66%2C0 -3%2C1.34 -3%2C3v46c0%2C1.66 1.34%2C3 3%2C3c1.66%2C0 3%2C-1.34 3%2C-3v-46c0%2C-1.66 -1.34%2C-3 -3%2C-3zM78%2C55c-1.66%2C0 -3%2C1.34 -3%2C3v46c0%2C1.66 1.34%2C3 3%2C3c1.66%2C0 3%2C-1.34 3%2C-3v-46c0%2C-1.66 -1.34%2C-3 -3%2C-3z%22%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E\")}.btn-icon.view{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAQHQAAEB0B0blUQwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAcrSURBVHja7Zt5TBRXHMc1aZu09Y8mbdI/G5NqatukTUysu4iuSgHxrLYeKOsRrfGIpsa2aluDWiM0aivWgyogKDvDSjhEsevOsOCCCyjKjZy6FLmP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FZc8k0mjcYM9TEDjdacQo9NEBILSSDL+7YtdMol8vh+x3bIV8bB2na2HpFSkzGL5pocjFFnn7lM2ji57lUlIdME/aevTPDnAwYT/n6+n6EwCsw/Ga5fCAo8Pi5vPT4D4V+r2gMQODxGB6pF+nb8XqvmAw4hFTp5+e3ejzf+z+xmopYfAdAyAAAAABJRU5ErkJggg==)}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CustomPaginationComponent, selector: "custom-pagination", inputs: ["totalItems", "itemsPerPage", "currentPage", "maxSize", "pageText", "ofText", "showPageInfo"], outputs: ["pageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1701
|
+
isColumnHidden(columnProp) {
|
1702
|
+
return this.hiddenColumns.includes(columnProp);
|
1703
|
+
}
|
1704
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataTableComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: AuthService }], target: i0.ɵɵFactoryTarget.Component }); }
|
1705
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DataTableComponent, selector: "sim-data-table", inputs: { columns: "columns", hiddenColumns: "hiddenColumns", itemsPerPageOptions: "itemsPerPageOptions", defaultItemsPerPage: "defaultItemsPerPage", itemsPerPageLabel: "itemsPerPageLabel", marginTop: "marginTop", marginBottom: "marginBottom", marginLeft: "marginLeft", marginRight: "marginRight", showActionColumn: "showActionColumn", actionColumnLabel: "actionColumnLabel", totalItems: "totalItems", tableFontColor: "tableFontColor", tableFontSize: "tableFontSize", fetchDataFunction: "fetchDataFunction", editPermissions: "editPermissions", deletePermissions: "deletePermissions", viewPermissions: "viewPermissions", showPageInfo: "showPageInfo", pageText: "pageText", ofText: "ofText", filterDescription: "filterDescription" }, outputs: { sortChange: "sortChange", pageChange: "pageChange", itemsPerPageChange: "itemsPerPageChange", onEditTable: "onEditTable", onDeleteTable: "onDeleteTable", onViewTable: "onViewTable" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"form-group\" [ngStyle]=\"{\n 'margin-top': marginTop + 'rem',\n 'margin-bottom': marginBottom + 'rem',\n 'margin-left': marginLeft + 'rem',\n 'margin-right': marginRight + 'rem'\n}\" style=\"text-align: right;\">\n <label for=\"itemsPerPageSelect\" style=\"margin-right: 0.5rem; margin-bottom: 0.7rem;\" [ngStyle]=\"labelStyle\">{{ itemsPerPageLabel }}</label>\n <select\n id=\"itemsPerPageSelect\"\n class=\"form-control form-control-sm d-inline-block w-auto\"\n [(ngModel)]=\"defaultItemsPerPage\"\n (ngModelChange)=\"onItemsPerPageChange()\">\n <option *ngFor=\"let option of itemsPerPageOptions\" [value]=\"option\">{{ option }}</option>\n </select>\n</div>\n\n<div class=\"table-responsive\">\n <table class=\"table table-hover\" [ngStyle]=\"{ 'color': tableFontColor, 'font-size': tableFontSize }\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let column of columns\">\n <th *ngIf=\"!isColumnHidden(column.prop)\" (click)=\"onSort(column.prop)\">\n {{ column.label }}\n </th>\n </ng-container>\n <th *ngIf=\"showActionColumn\">{{ actionColumnLabel }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of pagedData; let i = index\">\n <ng-container *ngFor=\"let column of columns\">\n <td *ngIf=\"!isColumnHidden(column.prop)\">\n {{ item[column.prop] }}\n </td>\n </ng-container>\n <td *ngIf=\"showActionColumn\">\n <div class=\"d-flex justify-content-center\">\n <div *ngIf=\"hasPermission(editPermissions) && onEditTable.observers.length > 0\" (click)=\"handleAction('edit', item, i)\" class=\"btn-icon edit mx-1\"></div>\n <div *ngIf=\"hasPermission(deletePermissions) && onDeleteTable.observers.length > 0\" (click)=\"handleAction('delete', item, i)\" class=\"btn-icon delete mx-1\"></div>\n <div *ngIf=\"hasPermission(viewPermissions) && onViewTable.observers.length > 0\" (click)=\"handleAction('view', item, i)\" class=\"btn-icon view mx-1\"></div>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n\n<div class=\"text-center pagination-controls\">\n <custom-pagination\n [totalItems]=\"totalItems\"\n [itemsPerPage]=\"defaultItemsPerPage\"\n [currentPage]=\"currentPage\"\n [showPageInfo]=\"showPageInfo\"\n [pageText]=\"pageText\"\n [ofText]=\"ofText\"\n (pageChange)=\"onPageChange($event)\">\n </custom-pagination>\n</div>\n", styles: ["@charset \"UTF-8\";@import\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\";:host{font-family:Inter,Arial,sans-serif}.label-style{font-family:Inter,Arial,sans-serif;font-size:14px;color:#000}.table{font-family:Inter,Arial,sans-serif;color:var(--table-font-color, #000);font-size:var(--table-font-size, 14px);border-collapse:separate;border-spacing:0;border-radius:8px;overflow:hidden;border:.13rem solid #00444C}.table thead th{background-color:#00444c;color:#fff;padding:10px;border-bottom:1rem solid rgba(0,68,76,.8);border-right:1rem solid rgba(0,68,76,.8);border-radius:0}.table thead th:last-child{border-right:none}.table tbody td{padding:10px;border-bottom:.1rem solid rgba(0,68,76,.8);border-right:.1rem solid rgba(0,68,76,.8)}.table tbody tr:last-child td{border-bottom:none}.table tbody td:last-child{border-right:none}.table thead th:first-child{border-top-left-radius:0}.table thead th:last-child{border-top-right-radius:0}.table tbody tr:last-child td:first-child{border-bottom-left-radius:8px}.table tbody tr:last-child td:last-child{border-bottom-right-radius:8px}.btn-icon{width:24px;height:24px;background-size:cover;display:inline-block;cursor:pointer;margin-right:16px}.btn-icon.edit{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAABrUlEQVR4nGNgoDI44+PD9b++nona5jLsSC4UupOauvpVVdXLJ4WF128mJkZSzfCdxfViG5dueHtswcr/3/v7wfhxYeF1qvikuLtbbMXG/WduPPvy/+K9t/8PLVwFtuBlZeVLUHBRZHhMdzF3Wk//7XN3Xv27+fzrfxC+dPfNf5BP7qanr6DYcL2CxF2MLj7/oxp7/1+4+wZsCcgnm5Zuersls0KQIsP185N2gwxngOLw+p7/IJ8s37Tv4sbWVnGquJwBCYP4qb199/ImTKDQ8MKEndgM1y9MPOjXWcpLkeFGxYl7GF3pbLjBkHW5/sg1vL47Q8y6JOE0zQwPqEl8h244g6vPf928hH0UGQ4CU2akHbLOjcN0eX7intApWTwUGb6221vn0d7KD5s2VP93LEyAG+5UGn+bYsNBYM/chFlfz7X+B+Etm6r/OxQm/A+oTnpXPyVegmLDMzJcxULDgn883F8PtuDR3oqPs2enHaickEx+wYUMcpKDNps5+P4PDQv+uW9e8sIVfYFGDNQC/xkYGIOD/Z8nxwfujIvzlqaawTBQz8DABMJUNxgKAOk7VoIIOJGlAAAAAElFTkSuQmCC)}.btn-icon.delete{background-image:url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220%2C0%2C256%2C256%22 width%3D%2224px%22 height%3D%2224px%22%3E%3Cg fill%3D%22%23fb0909%22 fill-rule%3D%22nonzero%22 stroke%3D%22none%22 stroke-width%3D%221%22 stroke-linecap%3D%22butt%22 stroke-linejoin%3D%22miter%22 stroke-miterlimit%3D%2210%22 stroke-dasharray%3D%22%22 stroke-dashoffset%3D%220%22 font-family%3D%22none%22 font-weight%3D%22none%22 font-size%3D%22none%22 text-anchor%3D%22none%22 style%3D%22mix-blend-mode%3A normal%22%3E%3Cg transform%3D%22scale(2%2C2)%22%3E%3Cpath d%3D%22M49%2C1c-1.66%2C0 -3%2C1.34 -3%2C3c0%2C1.66 1.34%2C3 3%2C3h30c1.66%2C0 3%2C-1.34 3%2C-3c0%2C-1.66 -1.34%2C-3 -3%2C-3zM24%2C15c-7.17%2C0 -13%2C5.83 -13%2C13c0%2C7.17 5.83%2C13 13%2C13h77v63c0%2C9.37 -7.63%2C17 -17%2C17h-40c-9.37%2C0 -17%2C-7.63 -17%2C-17v-52c0%2C-1.66 -1.34%2C-3 -3%2C-3c-1.66%2C0 -3%2C1.34 -3%2C3v52c0%2C12.68 10.32%2C23 23%2C23h40c12.68%2C0 23%2C-10.32 23%2C-23v-63.35937c5.72%2C-1.36 10%2C-6.50062 10%2C-12.64062c0%2C-7.17 -5.83%2C-13 -13%2C-13zM24%2C21h80c3.86%2C0 7%2C3.14 7%2C7c0%2C3.86 -3.14%2C7 -7%2C7h-80c-3.86%2C0 -7%2C-3.14 -7%2C-7c0%2C-3.86 3.14%2C-7 7%2C-7zM50%2C55c-1.66%2C0 -3%2C1.34 -3%2C3v46c0%2C1.66 1.34%2C3 3%2C3c1.66%2C0 3%2C-1.34 3%2C-3v-46c0%2C-1.66 -1.34%2C-3 -3%2C-3zM78%2C55c-1.66%2C0 -3%2C1.34 -3%2C3v46c0%2C1.66 1.34%2C3 3%2C3c1.66%2C0 3%2C-1.34 3%2C-3v-46c0%2C-1.66 -1.34%2C-3 -3%2C-3z%22%3E%3C%2Fpath%3E%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cP9wa9MS4E80OnBdBR6NgjJiITtykUPwu+3Dg4RS7LR1XiBTbNldekEyVBXRJhMwfMoY4ZEGpCrycysDJHTkHHSxTzSLGklR0FimgyakF8iErEhPO/DHuT2bJoNGPDSFbjgpFgN+0t1i4LFqStLgTooS7l/2GBu8miidnZDwzogG4GNl6EadGAwgs9UmeBWagRYiZQ8zAcPv4ggvoYgOCU1I7Z4bZE6PqQn/1318rvip1gK+cJgJjsDjk6T4WBDnk6NMd7gX+eXgEVTCON7w6xKvwwn/I3Ay8JgFPFYOEqEhYXt8oP1gRxEliGE3Aprq0NFZc8k0mjcYM9TEDjdacQo9NEBILSSDL+7YtdMol8vh+x3bIV8bB2na2HpFSkzGL5pocjFFnn7lM2ji57lUlIdME/aevTPDnAwYT/n6+n6EwCsw/Ga5fCAo8Pi5vPT4D4V+r2gMQODxGB6pF+nb8XqvmAw4hFTp5+e3ejzf+z+xmopYfAdAyAAAAABJRU5ErkJggg==)}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i3.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: CustomPaginationComponent, selector: "custom-pagination", inputs: ["totalItems", "itemsPerPage", "currentPage", "maxSize", "pageText", "ofText", "showPageInfo"], outputs: ["pageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
1495
1706
|
}
|
1496
1707
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataTableComponent, decorators: [{
|
1497
1708
|
type: Component,
|
1498
|
-
args: [{ selector: 'sim-data-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\" [ngStyle]=\"{\n 'margin-top': marginTop + 'rem',\n 'margin-bottom': marginBottom + 'rem',\n 'margin-left': marginLeft + 'rem',\n 'margin-right': marginRight + 'rem'\n}\" style=\"text-align: right;\">\n <label for=\"itemsPerPageSelect\" style=\"margin-right: 0.5rem; margin-bottom: 0.7rem;\" [ngStyle]=\"labelStyle\">{{ itemsPerPageLabel }}</label>\n <select\n id=\"itemsPerPageSelect\"\n class=\"form-control form-control-sm d-inline-block w-auto\"\n [(ngModel)]=\"defaultItemsPerPage\"\n (ngModelChange)=\"onItemsPerPageChange(
|
1499
|
-
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { columns: [{
|
1709
|
+
args: [{ selector: 'sim-data-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"form-group\" [ngStyle]=\"{\n 'margin-top': marginTop + 'rem',\n 'margin-bottom': marginBottom + 'rem',\n 'margin-left': marginLeft + 'rem',\n 'margin-right': marginRight + 'rem'\n}\" style=\"text-align: right;\">\n <label for=\"itemsPerPageSelect\" style=\"margin-right: 0.5rem; margin-bottom: 0.7rem;\" [ngStyle]=\"labelStyle\">{{ itemsPerPageLabel }}</label>\n <select\n id=\"itemsPerPageSelect\"\n class=\"form-control form-control-sm d-inline-block w-auto\"\n [(ngModel)]=\"defaultItemsPerPage\"\n (ngModelChange)=\"onItemsPerPageChange()\">\n <option *ngFor=\"let option of itemsPerPageOptions\" [value]=\"option\">{{ option }}</option>\n </select>\n</div>\n\n<div class=\"table-responsive\">\n <table class=\"table table-hover\" [ngStyle]=\"{ 'color': tableFontColor, 'font-size': tableFontSize }\">\n <thead>\n <tr>\n <ng-container *ngFor=\"let column of columns\">\n <th *ngIf=\"!isColumnHidden(column.prop)\" (click)=\"onSort(column.prop)\">\n {{ column.label }}\n </th>\n </ng-container>\n <th *ngIf=\"showActionColumn\">{{ actionColumnLabel }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let item of pagedData; let i = index\">\n <ng-container *ngFor=\"let column of columns\">\n <td *ngIf=\"!isColumnHidden(column.prop)\">\n {{ item[column.prop] }}\n </td>\n </ng-container>\n <td *ngIf=\"showActionColumn\">\n <div class=\"d-flex justify-content-center\">\n <div *ngIf=\"hasPermission(editPermissions) && onEditTable.observers.length > 0\" (click)=\"handleAction('edit', item, i)\" class=\"btn-icon edit mx-1\"></div>\n <div *ngIf=\"hasPermission(deletePermissions) && onDeleteTable.observers.length > 0\" (click)=\"handleAction('delete', item, i)\" class=\"btn-icon delete mx-1\"></div>\n <div *ngIf=\"hasPermission(viewPermissions) && onViewTable.observers.length > 0\" (click)=\"handleAction('view', item, i)\" class=\"btn-icon view mx-1\"></div>\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n\n<div class=\"text-center pagination-controls\">\n <custom-pagination\n [totalItems]=\"totalItems\"\n [itemsPerPage]=\"defaultItemsPerPage\"\n [currentPage]=\"currentPage\"\n [showPageInfo]=\"showPageInfo\"\n [pageText]=\"pageText\"\n [ofText]=\"ofText\"\n (pageChange)=\"onPageChange($event)\">\n </custom-pagination>\n</div>\n", styles: ["@charset \"UTF-8\";@import\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\";:host{font-family:Inter,Arial,sans-serif}.label-style{font-family:Inter,Arial,sans-serif;font-size:14px;color:#000}.table{font-family:Inter,Arial,sans-serif;color:var(--table-font-color, #000);font-size:var(--table-font-size, 14px);border-collapse:separate;border-spacing:0;border-radius:8px;overflow:hidden;border:.13rem solid #00444C}.table thead th{background-color:#00444c;color:#fff;padding:10px;border-bottom:1rem solid rgba(0,68,76,.8);border-right:1rem solid rgba(0,68,76,.8);border-radius:0}.table thead th:last-child{border-right:none}.table tbody td{padding:10px;border-bottom:.1rem solid rgba(0,68,76,.8);border-right:.1rem solid rgba(0,68,76,.8)}.table tbody tr:last-child td{border-bottom:none}.table tbody td:last-child{border-right:none}.table thead th:first-child{border-top-left-radius:0}.table thead th:last-child{border-top-right-radius:0}.table tbody tr:last-child td:first-child{border-bottom-left-radius:8px}.table tbody tr:last-child td:last-child{border-bottom-right-radius:8px}.btn-icon{width:24px;height:24px;background-size:cover;display:inline-block;cursor:pointer;margin-right:16px}.btn-icon.edit{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAABrUlEQVR4nGNgoDI44+PD9b++nona5jLsSC4UupOauvpVVdXLJ4WF128mJkZSzfCdxfViG5dueHtswcr/3/v7wfhxYeF1qvikuLtbbMXG/WduPPvy/+K9t/8PLVwFtuBlZeVLUHBRZHhMdzF3Wk//7XN3Xv27+fzrfxC+dPfNf5BP7qanr6DYcL2CxF2MLj7/oxp7/1+4+wZsCcgnm5Zuersls0KQIsP185N2gwxngOLw+p7/IJ8s37Tv4sbWVnGquJwBCYP4qb199/ImTKDQ8MKEndgM1y9MPOjXWcpLkeFGxYl7GF3pbLjBkHW5/sg1vL47Q8y6JOE0zQwPqEl8h244g6vPf928hH0UGQ4CU2akHbLOjcN0eX7intApWTwUGb6221vn0d7KD5s2VP93LEyAG+5UGn+bYsNBYM/chFlfz7X+B+Etm6r/OxQm/A+oTnpXPyVegmLDMzJcxULDgn883F8PtuDR3oqPs2enHaickEx+wYUMcpKDNps5+P4PDQv+uW9e8sIVfYFGDNQC/xkYGIOD/Z8nxwfujIvzlqaawTBQz8DABMJUNxgKAOk7VoIIOJGlAAAAAElFTkSuQmCC)}.btn-icon.delete{background-image:url(\"data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22 viewBox%3D%220%2C0%2C256%2C256%22 width%3D%2224px%22 height%3D%2224px%22%3E%3Cg fill%3D%22%23fb0909%22 fill-rule%3D%22nonzero%22 stroke%3D%22none%22 stroke-width%3D%221%22 stroke-linecap%3D%22butt%22 stroke-linejoin%3D%22miter%22 stroke-miterlimit%3D%2210%22 stroke-dasharray%3D%22%22 stroke-dashoffset%3D%220%22 font-family%3D%22none%22 font-weight%3D%22none%22 font-size%3D%22none%22 text-anchor%3D%22none%22 style%3D%22mix-blend-mode%3A normal%22%3E%3Cg transform%3D%22scale(2%2C2)%22%3E%3Cpath d%3D%22M49%2C1c-1.66%2C0 -3%2C1.34 -3%2C3c0%2C1.66 1.34%2C3 3%2C3h30c1.66%2C0 3%2C-1.34 3%2C-3c0%2C-1.66 -1.34%2C-3 -3%2C-3zM24%2C15c-7.17%2C0 -13%2C5.83 -13%2C13c0%2C7.17 5.83%2C13 13%2C13h77v63c0%2C9.37 -7.63%2C17 -17%2C17h-40c-9.37%2C0 -17%2C-7.63 -17%2C-17v-52c0%2C-1.66 -1.34%2C-3 -3%2C-3c-1.66%2C0 -3%2C1.34 -3%2C3v52c0%2C12.68 10.32%2C23 23%2C23h40c12.68%2C0 23%2C-10.32 23%2C-23v-63.35937c5.72%2C-1.36 10%2C-6.50062 10%2C-12.64062c0%2C-7.17 -5.83%2C-13 -13%2C-13zM24%2C21h80c3.86%2C0 7%2C3.14 7%2C7c0%2C3.86 -3.14%2C7 -7%2C7h-80c-3.86%2C0 -7%2C-3.14 -7%2C-7c0%2C-3.86 3.14%2C-7 7%2C-7zM50%2C55c-1.66%2C0 -3%2C1.34 -3%2C3v46c0%2C1.66 1.34%2C3 3%2C3c1.66%2C0 3%2C-1.34 3%2C-3v-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4ZbCFw9aU0e9AQ30+P/wrK/gm1OyTLy1wBN7aAClNXOSyOaLMbHMErj1sBFviqsqcBR6refhO0QNct8KZb45gS0ZTjWDD3VLVP6OC3xNz7FXPfTisCxDujnwo8/1C5e0GZn1PqJovCJ/jEHzZmVn24LGCLQyQaZTTBg8TcP9wa9MS4E80OnBdBR6NgjJiITtykUPwu+3Dg4RS7LR1XiBTbNldekEyVBXRJhMwfMoY4ZEGpCrycysDJHTkHHSxTzSLGklR0FimgyakF8iErEhPO/DHuT2bJoNGPDSFbjgpFgN+0t1i4LFqStLgTooS7l/2GBu8miidnZDwzogG4GNl6EadGAwgs9UmeBWagRYiZQ8zAcPv4ggvoYgOCU1I7Z4bZE6PqQn/1318rvip1gK+cJgJjsDjk6T4WBDnk6NMd7gX+eXgEVTCON7w6xKvwwn/I3Ay8JgFPFYOEqEhYXt8oP1gRxEliGE3Aprq0NFZc8k0mjcYM9TEDjdacQo9NEBILSSDL+7YtdMol8vh+x3bIV8bB2na2HpFSkzGL5pocjFFnn7lM2ji57lUlIdME/aevTPDnAwYT/n6+n6EwCsw/Ga5fCAo8Pi5vPT4D4V+r2gMQODxGB6pF+nb8XqvmAw4hFTp5+e3ejzf+z+xmopYfAdAyAAAAABJRU5ErkJggg==)}\n"] }]
|
1710
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: AuthService }]; }, propDecorators: { columns: [{
|
1500
1711
|
type: Input
|
1501
|
-
}],
|
1712
|
+
}], hiddenColumns: [{
|
1502
1713
|
type: Input
|
1503
1714
|
}], itemsPerPageOptions: [{
|
1504
1715
|
type: Input
|
@@ -1532,14 +1743,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1532
1743
|
type: Input
|
1533
1744
|
}], viewPermissions: [{
|
1534
1745
|
type: Input
|
1535
|
-
}], userPermissions: [{
|
1536
|
-
type: Input
|
1537
1746
|
}], showPageInfo: [{
|
1538
1747
|
type: Input
|
1539
1748
|
}], pageText: [{
|
1540
1749
|
type: Input
|
1541
1750
|
}], ofText: [{
|
1542
1751
|
type: Input
|
1752
|
+
}], filterDescription: [{
|
1753
|
+
type: Input
|
1543
1754
|
}], sortChange: [{
|
1544
1755
|
type: Output
|
1545
1756
|
}], pageChange: [{
|
@@ -1812,7 +2023,8 @@ class ComponentsModule {
|
|
1812
2023
|
ConfirmationComponent,
|
1813
2024
|
AutofocusDirective,
|
1814
2025
|
CustomPaginationComponent,
|
1815
|
-
TreeNodeComponent
|
2026
|
+
TreeNodeComponent,
|
2027
|
+
SearchInputComponent], imports: [CommonModule,
|
1816
2028
|
FormsModule,
|
1817
2029
|
ReactiveFormsModule,
|
1818
2030
|
NgSelectModule], exports: [ButtonComponent,
|
@@ -1833,7 +2045,8 @@ class ComponentsModule {
|
|
1833
2045
|
AlertComponent,
|
1834
2046
|
ConfirmationComponent,
|
1835
2047
|
CustomPaginationComponent,
|
1836
|
-
TreeNodeComponent
|
2048
|
+
TreeNodeComponent,
|
2049
|
+
SearchInputComponent] }); }
|
1837
2050
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ComponentsModule, imports: [CommonModule,
|
1838
2051
|
FormsModule,
|
1839
2052
|
ReactiveFormsModule,
|
@@ -1862,6 +2075,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1862
2075
|
AutofocusDirective,
|
1863
2076
|
CustomPaginationComponent,
|
1864
2077
|
TreeNodeComponent,
|
2078
|
+
SearchInputComponent,
|
1865
2079
|
],
|
1866
2080
|
imports: [
|
1867
2081
|
CommonModule,
|
@@ -1889,6 +2103,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1889
2103
|
ConfirmationComponent,
|
1890
2104
|
CustomPaginationComponent,
|
1891
2105
|
TreeNodeComponent,
|
2106
|
+
SearchInputComponent,
|
1892
2107
|
],
|
1893
2108
|
}]
|
1894
2109
|
}] });
|
@@ -1923,19 +2138,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1923
2138
|
class ConfirmationService {
|
1924
2139
|
constructor(modalService) {
|
1925
2140
|
this.modalService = modalService;
|
2141
|
+
this.modalRef = null;
|
1926
2142
|
}
|
1927
2143
|
confirm(title, message, confirmButtonText = 'Sim', cancelButtonText = 'Não') {
|
1928
|
-
|
1929
|
-
modalRef.componentInstance.title = title;
|
1930
|
-
modalRef.componentInstance.message = message;
|
1931
|
-
modalRef.componentInstance.confirmButtonText = confirmButtonText;
|
1932
|
-
modalRef.componentInstance.cancelButtonText = cancelButtonText;
|
1933
|
-
return modalRef.result.then((result) => {
|
2144
|
+
this.modalRef = this.modalService.open(ConfirmationComponent, { backdrop: 'static', keyboard: false });
|
2145
|
+
this.modalRef.componentInstance.title = title;
|
2146
|
+
this.modalRef.componentInstance.message = message;
|
2147
|
+
this.modalRef.componentInstance.confirmButtonText = confirmButtonText;
|
2148
|
+
this.modalRef.componentInstance.cancelButtonText = cancelButtonText;
|
2149
|
+
return this.modalRef.result.then((result) => {
|
1934
2150
|
return result === 'confirm';
|
1935
2151
|
}, () => {
|
1936
2152
|
return false;
|
2153
|
+
}).finally(() => {
|
2154
|
+
this.modalRef = null; // Clear the reference after the modal is closed
|
1937
2155
|
});
|
1938
2156
|
}
|
2157
|
+
ngOnDestroy() {
|
2158
|
+
if (this.modalRef) {
|
2159
|
+
this.modalRef.dismiss();
|
2160
|
+
this.modalRef = null;
|
2161
|
+
}
|
2162
|
+
}
|
1939
2163
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfirmationService, deps: [{ token: i1$1.NgbModal }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
1940
2164
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfirmationService, providedIn: 'root' }); }
|
1941
2165
|
}
|
@@ -1946,12 +2170,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1946
2170
|
}]
|
1947
2171
|
}], ctorParameters: function () { return [{ type: i1$1.NgbModal }]; } });
|
1948
2172
|
|
2173
|
+
class DataPaginateService {
|
2174
|
+
constructor(http) {
|
2175
|
+
this.http = http;
|
2176
|
+
}
|
2177
|
+
fetchData(url, params) {
|
2178
|
+
let httpParams = new HttpParams()
|
2179
|
+
.set('page', params.pageNumber.toString())
|
2180
|
+
.set('limit', params.pageSize.toString())
|
2181
|
+
.set('sort', params.sortColumn)
|
2182
|
+
.set('order', params.sortDirection);
|
2183
|
+
if (params.filterDescription) {
|
2184
|
+
httpParams = httpParams.set('description', params.filterDescription);
|
2185
|
+
}
|
2186
|
+
return this.http.get(url, { params: httpParams }).pipe(map(response => {
|
2187
|
+
const items = response.data || [];
|
2188
|
+
const totalItems = response.meta.total || 0;
|
2189
|
+
return {
|
2190
|
+
items,
|
2191
|
+
totalItems
|
2192
|
+
};
|
2193
|
+
}));
|
2194
|
+
}
|
2195
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataPaginateService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
2196
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataPaginateService, providedIn: 'root' }); }
|
2197
|
+
}
|
2198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataPaginateService, decorators: [{
|
2199
|
+
type: Injectable,
|
2200
|
+
args: [{
|
2201
|
+
providedIn: 'root'
|
2202
|
+
}]
|
2203
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
|
2204
|
+
|
1949
2205
|
class LibPortalAngularModule {
|
1950
2206
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LibPortalAngularModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1951
2207
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LibPortalAngularModule, imports: [ComponentsModule], exports: [ComponentsModule] }); }
|
1952
2208
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LibPortalAngularModule, providers: [
|
1953
2209
|
NotificationService,
|
1954
|
-
ConfirmationService
|
2210
|
+
ConfirmationService,
|
2211
|
+
DataPaginateService,
|
1955
2212
|
], imports: [ComponentsModule, ComponentsModule] }); }
|
1956
2213
|
}
|
1957
2214
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LibPortalAngularModule, decorators: [{
|
@@ -1965,7 +2222,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1965
2222
|
],
|
1966
2223
|
providers: [
|
1967
2224
|
NotificationService,
|
1968
|
-
ConfirmationService
|
2225
|
+
ConfirmationService,
|
2226
|
+
DataPaginateService,
|
1969
2227
|
],
|
1970
2228
|
}]
|
1971
2229
|
}] });
|
@@ -1982,5 +2240,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
1982
2240
|
* Generated bundle index. Do not edit.
|
1983
2241
|
*/
|
1984
2242
|
|
1985
|
-
export { AlertComponent, BadgeComponent, ButtonClasses, ButtonComponent, CardComponent, CheckboxComponent, CodeHighlightComponent, ComponentsModule, ConfirmationComponent, ConfirmationService, CustomPaginationComponent, DataTableComponent, FormComponent, InputComponent, LibPortalAngularModule, MultiSelectComponent, NotificationService, RadioComponent, SelectComponent, TextareaComponent, TreeNodeComponent };
|
2243
|
+
export { AlertComponent, BadgeComponent, ButtonClasses, ButtonComponent, CardComponent, CheckboxComponent, CodeHighlightComponent, ComponentsModule, ConfirmationComponent, ConfirmationService, CustomPaginationComponent, DataPaginateService, DataTableComponent, FormComponent, InputComponent, LibPortalAngularModule, MultiSelectComponent, NotificationService, RadioComponent, SearchInputComponent, SelectComponent, TextareaComponent, TreeNodeComponent };
|
1986
2244
|
//# sourceMappingURL=lib-portal-angular.mjs.map
|