ngx-opalbytes-components 1.16.1 → 1.18.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.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
- import { CommonModule, NgOptimizedImage, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
2
+ import { CommonModule, isPlatformBrowser, NgTemplateOutlet, NgOptimizedImage } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, Input, Output, Component, ViewChild, inject, ElementRef, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, NgModule, Injectable, ContentChildren, Directive, TemplateRef, ContentChild, signal, PLATFORM_ID, ViewChildren, HostBinding } from '@angular/core';
4
+ import { EventEmitter, Input, Output, Component, ViewChild, inject, ElementRef, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, NgModule, ContentChildren, Directive, TemplateRef, ContentChild, signal, PLATFORM_ID, ViewChildren, HostBinding, Injectable } from '@angular/core';
5
5
  import * as i3 from '@angular/material/tooltip';
6
6
  import { MatTooltipModule } from '@angular/material/tooltip';
7
7
  import { LucideDynamicIcon } from '@lucide/angular';
@@ -16,7 +16,7 @@ import * as i4 from '@angular/material/input';
16
16
  import { MatInputModule } from '@angular/material/input';
17
17
  import * as i5 from '@angular/material/autocomplete';
18
18
  import { MatAutocompleteModule, MatAutocompleteTrigger } from '@angular/material/autocomplete';
19
- import { BehaviorSubject, combineLatest, startWith, map, Subject, Subscription } from 'rxjs';
19
+ import { BehaviorSubject, combineLatest, startWith, map, Subscription, Subject } from 'rxjs';
20
20
  import * as i4$1 from '@angular/material/icon';
21
21
  import { MatIconModule } from '@angular/material/icon';
22
22
  import { Router, ActivatedRoute } from '@angular/router';
@@ -73,11 +73,12 @@ class CaoBaseButtonComponent {
73
73
  dataCy;
74
74
  iconColor;
75
75
  strokeWidthIcon = 1;
76
+ minTextToTooltip = 20;
76
77
  ngOnInit() {
77
78
  if (!this.dataCy) {
78
79
  this.dataCy = `btn-${this.buttonText.replace(/\s+/g, '-').toLowerCase()}`;
79
80
  }
80
- if (!this.tooltip && this.buttonText.length >= 20) {
81
+ if (!this.tooltip && this.buttonText.length >= this.minTextToTooltip) {
81
82
  this.tooltip = this.buttonText;
82
83
  }
83
84
  }
@@ -87,7 +88,7 @@ class CaoBaseButtonComponent {
87
88
  }
88
89
  }
89
90
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoBaseButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
90
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoBaseButtonComponent, isStandalone: true, selector: "cao-button", inputs: { buttonText: "buttonText", isDarkMode: "isDarkMode", isDisabled: "isDisabled", isLoading: "isLoading", btnClass: "btnClass", tooltip: "tooltip", trailingIcon: "trailingIcon", leadingIcon: "leadingIcon", isLucideIcon: "isLucideIcon", dataCy: "dataCy", iconColor: "iconColor", strokeWidthIcon: "strokeWidthIcon" }, outputs: { buttonClick: "buttonClick" }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"base-button\"\n matTooltipPosition=\"below\"\n matTooltipClass=\"custom-arrow-tooltip\"\n [matTooltip]=\"tooltip\"\n [matTooltipDisabled]=\"!tooltip\"\n [class.dark-mode]=\"isDarkMode\"\n [class.disabled]=\"isDisabled\"\n [class.loading]=\"isLoading\"\n [disabled]=\"isDisabled || isLoading\"\n [attr.data-cy]=\"dataCy\"\n (click)=\"onClick()\">\n @if (leadingIcon) {\n <span class=\"leading-icon\">\n @if (isLucideIcon) {\n <svg [lucideIcon]=\"leadingIcon\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"leadingIcon\" />\n }\n </span>\n } {{ buttonText }} @if (trailingIcon) {\n <span class=\"trailing-icon\">\n @if (isLucideIcon) {\n <svg [lucideIcon]=\"trailingIcon\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"trailingIcon\" />\n }\n </span>\n } @if (isLoading) {\n <span class=\"loader\"></span>\n }\n</button>\n", styles: [".base-button{display:flex;gap:5px;width:100%;align-items:center;justify-content:center;cursor:pointer}.base-button.disabled{cursor:not-allowed}.base-button.loading{cursor:progress}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
91
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoBaseButtonComponent, isStandalone: true, selector: "cao-button", inputs: { buttonText: "buttonText", isDarkMode: "isDarkMode", isDisabled: "isDisabled", isLoading: "isLoading", btnClass: "btnClass", tooltip: "tooltip", trailingIcon: "trailingIcon", leadingIcon: "leadingIcon", isLucideIcon: "isLucideIcon", dataCy: "dataCy", iconColor: "iconColor", strokeWidthIcon: "strokeWidthIcon", minTextToTooltip: "minTextToTooltip" }, outputs: { buttonClick: "buttonClick" }, ngImport: i0, template: "<button\n type=\"button\"\n class=\"base-button\"\n matTooltipPosition=\"below\"\n matTooltipClass=\"custom-arrow-tooltip\"\n [matTooltip]=\"tooltip\"\n [matTooltipDisabled]=\"!tooltip\"\n [class.dark-mode]=\"isDarkMode\"\n [class.disabled]=\"isDisabled\"\n [class.loading]=\"isLoading\"\n [disabled]=\"isDisabled || isLoading\"\n [attr.data-cy]=\"dataCy\"\n (click)=\"onClick()\">\n @if (leadingIcon) {\n <span class=\"leading-icon\">\n @if (isLucideIcon) {\n <svg [lucideIcon]=\"leadingIcon\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"leadingIcon\" />\n }\n </span>\n } {{ buttonText }} @if (trailingIcon) {\n <span class=\"trailing-icon\">\n @if (isLucideIcon) {\n <svg [lucideIcon]=\"trailingIcon\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"trailingIcon\" />\n }\n </span>\n } @if (isLoading) {\n <span class=\"loader\"></span>\n }\n</button>\n", styles: [".base-button{display:flex;gap:5px;width:100%;align-items:center;justify-content:center;cursor:pointer}.base-button.disabled{cursor:not-allowed}.base-button.loading{cursor:progress}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
91
92
  }
92
93
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoBaseButtonComponent, decorators: [{
93
94
  type: Component,
@@ -118,6 +119,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
118
119
  type: Input
119
120
  }], strokeWidthIcon: [{
120
121
  type: Input
122
+ }], minTextToTooltip: [{
123
+ type: Input
121
124
  }] } });
122
125
 
123
126
  class CaoBaseInput {
@@ -1233,696 +1236,559 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
1233
1236
  type: Output
1234
1237
  }] } });
1235
1238
 
1236
- class BaseModalService {
1237
- constructor() { }
1238
- toggleModalEvent = new EventEmitter();
1239
- closeAllModalsEvent = new EventEmitter();
1240
- openModal = new EventEmitter();
1241
- modalResultSubject = new Subject();
1242
- emitModalResult(result) {
1243
- this.modalResultSubject.next(result);
1244
- }
1245
- onModalResult() {
1246
- return this.modalResultSubject.asObservable();
1247
- }
1248
- toggleModal(modalInfo) {
1249
- this.toggleModalEvent.emit(modalInfo);
1250
- }
1251
- closeAllModals() {
1252
- this.closeAllModalsEvent.emit(true);
1253
- }
1254
- showModal(_selectedModal, data) {
1255
- this.closeAllModals();
1256
- const modalInfo = {
1257
- type: _selectedModal,
1258
- data: data,
1259
- status: true,
1260
- };
1261
- this.openModal.emit(modalInfo);
1262
- }
1263
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1264
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, providedIn: "root" });
1265
- }
1266
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, decorators: [{
1267
- type: Injectable,
1268
- args: [{
1269
- providedIn: "root",
1270
- }]
1271
- }], ctorParameters: () => [], propDecorators: { toggleModalEvent: [{
1272
- type: Output
1273
- }], closeAllModalsEvent: [{
1274
- type: Output
1275
- }], openModal: [{
1276
- type: Output
1277
- }] } });
1278
-
1279
- class BaseModal {
1280
- showModal = false;
1239
+ class StepComponent {
1281
1240
  title = "";
1282
- data;
1283
- modalTypeClass = "default";
1284
- modalClass = "modal-default";
1285
- modalSize = "w-70";
1286
- closeOnOverlayClick = false;
1287
- modalService = inject(BaseModalService);
1288
- closeModals() { }
1289
- closeModalsWithoutDialog() {
1290
- this.modalService.closeAllModals();
1291
- }
1292
- onOverlayClick() {
1293
- if (this.closeOnOverlayClick) {
1294
- this.closeModals();
1295
- }
1296
- }
1297
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModal, deps: [], target: i0.ɵɵFactoryTarget.Component });
1298
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BaseModal, isStandalone: true, selector: "cao-modal", inputs: { showModal: "showModal", title: "title", data: "data", modalTypeClass: "modalTypeClass", modalClass: "modalClass", modalSize: "modalSize", closeOnOverlayClick: "closeOnOverlayClick" }, ngImport: i0, template: "<div aria-hidden=\"true\" class=\"modal\" tabIndex=\"0\" [class.show]=\"showModal\" (keydown)=\"onOverlayClick()\"\n (click)=\"onOverlayClick()\">\n <div aria-hidden=\"true\" class=\"modal-dialog\" tabIndex=\"1\" [ngClass]=\"[modalSize, modalClass]\"\n (keydown)=\"$event.stopPropagation()\" (click)=\"$event.stopPropagation()\">\n <ng-content />\n </div>\n</div>", styles: [".modal{width:100vw;height:100vh;align-items:center;justify-content:center;position:fixed;transition:.5s;top:-100vh;left:0}.modal .modal-dialog{padding:24px 34px;border-radius:20px;position:relative;max-width:1444px;height:auto;top:-100vh;transition:.5s;background-color:var(--bg-card);left:0}.modal .modal-dialog.custom{padding:0}.modal .modal-dialog.w-100{width:100%}.modal .modal-dialog.w-90{width:90%}.modal .modal-dialog.w-80{width:80%}.modal .modal-dialog.w-75{width:75%}.modal .modal-dialog.w-70{width:70%}.modal .modal-dialog.w-60{width:60%}.modal .modal-dialog.w-50{width:50%}.modal .modal-dialog.w-40{width:40%}.modal .modal-dialog.w-30{width:30%}.modal .modal-dialog.w-20{width:20%}.modal .modal-dialog.w-10{width:10%}.modal.show{z-index:1000;display:flex;top:0;background-color:#00000080}.modal.show .modal-dialog{top:0}@media(max-width:768px){.modal-dialog{width:90%;max-width:90vw;margin-left:0}}@media(min-width:769px){.modal-dialog{width:75%;margin-left:250px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1241
+ isActive = false;
1242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1243
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: StepComponent, isStandalone: true, selector: "cao-step", inputs: { title: "title", isActive: "isActive" }, ngImport: i0, template: "<div class=\"step d-flex aic jcc\" [ngClass]=\"{'active': isActive}\"> {{ title }} </div>\n", styles: [".step{width:44px;height:44px;border-radius:100%;font-size:18px;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1299
1244
  }
1300
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModal, decorators: [{
1245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepComponent, decorators: [{
1301
1246
  type: Component,
1302
- args: [{ selector: 'cao-modal', imports: [CommonModule], template: "<div aria-hidden=\"true\" class=\"modal\" tabIndex=\"0\" [class.show]=\"showModal\" (keydown)=\"onOverlayClick()\"\n (click)=\"onOverlayClick()\">\n <div aria-hidden=\"true\" class=\"modal-dialog\" tabIndex=\"1\" [ngClass]=\"[modalSize, modalClass]\"\n (keydown)=\"$event.stopPropagation()\" (click)=\"$event.stopPropagation()\">\n <ng-content />\n </div>\n</div>", styles: [".modal{width:100vw;height:100vh;align-items:center;justify-content:center;position:fixed;transition:.5s;top:-100vh;left:0}.modal .modal-dialog{padding:24px 34px;border-radius:20px;position:relative;max-width:1444px;height:auto;top:-100vh;transition:.5s;background-color:var(--bg-card);left:0}.modal .modal-dialog.custom{padding:0}.modal .modal-dialog.w-100{width:100%}.modal .modal-dialog.w-90{width:90%}.modal .modal-dialog.w-80{width:80%}.modal .modal-dialog.w-75{width:75%}.modal .modal-dialog.w-70{width:70%}.modal .modal-dialog.w-60{width:60%}.modal .modal-dialog.w-50{width:50%}.modal .modal-dialog.w-40{width:40%}.modal .modal-dialog.w-30{width:30%}.modal .modal-dialog.w-20{width:20%}.modal .modal-dialog.w-10{width:10%}.modal.show{z-index:1000;display:flex;top:0;background-color:#00000080}.modal.show .modal-dialog{top:0}@media(max-width:768px){.modal-dialog{width:90%;max-width:90vw;margin-left:0}}@media(min-width:769px){.modal-dialog{width:75%;margin-left:250px}}\n"] }]
1303
- }], propDecorators: { showModal: [{
1304
- type: Input
1305
- }], title: [{
1306
- type: Input
1307
- }], data: [{
1308
- type: Input
1309
- }], modalTypeClass: [{
1310
- type: Input
1311
- }], modalClass: [{
1312
- type: Input
1313
- }], modalSize: [{
1247
+ args: [{ selector: "cao-step", standalone: true, imports: [CommonModule], template: "<div class=\"step d-flex aic jcc\" [ngClass]=\"{'active': isActive}\"> {{ title }} </div>\n", styles: [".step{width:44px;height:44px;border-radius:100%;font-size:18px;font-weight:700}\n"] }]
1248
+ }], propDecorators: { title: [{
1314
1249
  type: Input
1315
- }], closeOnOverlayClick: [{
1250
+ }], isActive: [{
1316
1251
  type: Input
1317
1252
  }] } });
1318
1253
 
1319
- class BaseDialog {
1320
- config;
1321
- closeDialog = this.noop;
1322
- iconPaths = {
1323
- success: "https://placehold.co/600x400",
1324
- error: "https://placehold.co/600x400",
1325
- info: "https://placehold.co/600x400",
1326
- warning: "https://placehold.co/600x400",
1327
- };
1328
- noop() {
1329
- return;
1254
+ class StepperComponent {
1255
+ constructor() { }
1256
+ steps;
1257
+ title;
1258
+ activeStepIndex = 0;
1259
+ lengthStep = 0;
1260
+ showLine = true;
1261
+ maxReachedEvent = new EventEmitter();
1262
+ ngAfterContentInit() {
1263
+ if (this.steps.length > 0) {
1264
+ this.steps.toArray()[0].isActive = true;
1265
+ this.lengthStep = this.steps.length;
1266
+ }
1330
1267
  }
1331
- getIconPath() {
1332
- return this.iconPaths[this.config.type];
1268
+ nextStep() {
1269
+ if (this.steps.length > 0) {
1270
+ if (this.activeStepIndex < this.steps.length - 1) {
1271
+ this.activeStepIndex++;
1272
+ this.steps.toArray()[this.activeStepIndex].isActive = true;
1273
+ }
1274
+ else {
1275
+ this.maxReachedEvent.emit(null);
1276
+ }
1277
+ }
1333
1278
  }
1334
- handleConfirm() {
1335
- this.config.onConfirm?.();
1336
- this.closeDialog();
1279
+ prevStep() {
1280
+ if (this.steps.length > 0) {
1281
+ if (this.activeStepIndex > 0) {
1282
+ this.steps.toArray()[this.activeStepIndex].isActive = false;
1283
+ this.activeStepIndex--;
1284
+ this.steps.toArray()[this.activeStepIndex].isActive = true;
1285
+ }
1286
+ }
1337
1287
  }
1338
- handleCancel() {
1339
- this.config.onCancel?.();
1340
- this.closeDialog();
1288
+ resetStepper() {
1289
+ this.activeStepIndex = 0;
1290
+ this.steps.forEach((step) => (step.isActive = false));
1291
+ if (this.steps.length > 0) {
1292
+ this.steps.toArray()[0].isActive = true;
1293
+ }
1341
1294
  }
1342
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
1343
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseDialog, isStandalone: true, selector: "cao-dialog", inputs: { config: "config" }, ngImport: i0, template: "\n<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [fill]=\"true\" [ngSrc]=\"config.logoIcon ?? ''\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\" [ngClass]=\"config.type\">\n <div class=\"title\">{{ config.title }}</div>\n <div class=\"message\">{{ config.message }}</div>\n <div class=\"button-container\">\n @if (config.cancelButtonText) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n [attr.data-cy]=\"config.cancelButtonText\"\n (keydown)=\"handleCancel()\"\n (click)=\"handleCancel()\">\n {{ config.cancelButtonText }}\n </button>\n } @if (config.confirmButtonText) {\n <button\n type=\"button\"\n class=\"confirm-button\"\n [ngClass]=\"config.type\"\n [attr.data-cy]=\"config.confirmButtonText\"\n (click)=\"handleConfirm()\"\n (keydown)=\"handleConfirm()\"\n >\n {{ config.confirmButtonText }}\n </button>\n }\n </div>\n </div>\n <div class=\"icon-container\">\n <img alt=\"Dialog Icon\" class=\"alert-icon\" [fill]=\"true\" [ngSrc]=\"getIconPath()\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;z-index:1000;background:#0009}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white);max-width:90%;margin-left:250px}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.button-container{display:flex;gap:10px}.confirm-button,.cancel-button{padding:10px 20px;border:none;border-radius:20px;cursor:pointer;font-weight:600;transition:all .3s ease}.confirm-button{color:var(--white);background-color:var(--primary)}.cancel-button{background-color:var(--disabled-button);color:var(--white)}.confirm-button:hover,.cancel-button:hover{opacity:.9}.text-content{flex-grow:1;padding-right:20px}.text-content .title{font-weight:700;font-size:20px;color:var(--primary);margin-bottom:10px}.text-content.success .title{color:var(--primary)}.text-content.error .title{color:var(--error-color)}.text-content.error .confirm-button{background-color:var(--error-color)}.text-content.warning .title{color:var(--support-orange)}.text-content.info .title{color:var(--primary)}.text-content.info .confirm-button{background-color:var(--primary)}.message{font-weight:400;font-size:16px;color:var(--message-color);margin-bottom:15px}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){.dialog-container{width:400px;max-width:90%;margin-left:0}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}.button-container{flex-direction:column;width:100%}.confirm-button,.cancel-button{width:100%;margin-bottom:10px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }] });
1295
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1296
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: StepperComponent, isStandalone: true, selector: "cao-stepper", inputs: { title: "title" }, outputs: { maxReachedEvent: "maxReachedEvent" }, queries: [{ propertyName: "steps", predicate: StepComponent }], ngImport: i0, template: "@if(title){\n<h3 class=\"stepper-title\">{{ title }}</h3>\n}\n<div class=\"d-flex step-container aic jcsb\">\n @if (showLine) {\n <div class=\"line\"></div>\n }\n <div class=\"steps d-flex aic jcsb\">\n <ng-content />\n </div>\n</div>\n", styles: [".step-container{position:relative}.steps{z-index:2;gap:24px}.line{width:100%;position:absolute;top:50%;height:1.5px;background-color:var(--return-color);z-index:1}\n"] });
1344
1297
  }
1345
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialog, decorators: [{
1298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepperComponent, decorators: [{
1346
1299
  type: Component,
1347
- args: [{ selector: 'cao-dialog', imports: [CommonModule, NgOptimizedImage], template: "\n<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [fill]=\"true\" [ngSrc]=\"config.logoIcon ?? ''\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\" [ngClass]=\"config.type\">\n <div class=\"title\">{{ config.title }}</div>\n <div class=\"message\">{{ config.message }}</div>\n <div class=\"button-container\">\n @if (config.cancelButtonText) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n [attr.data-cy]=\"config.cancelButtonText\"\n (keydown)=\"handleCancel()\"\n (click)=\"handleCancel()\">\n {{ config.cancelButtonText }}\n </button>\n } @if (config.confirmButtonText) {\n <button\n type=\"button\"\n class=\"confirm-button\"\n [ngClass]=\"config.type\"\n [attr.data-cy]=\"config.confirmButtonText\"\n (click)=\"handleConfirm()\"\n (keydown)=\"handleConfirm()\"\n >\n {{ config.confirmButtonText }}\n </button>\n }\n </div>\n </div>\n <div class=\"icon-container\">\n <img alt=\"Dialog Icon\" class=\"alert-icon\" [fill]=\"true\" [ngSrc]=\"getIconPath()\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;z-index:1000;background:#0009}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white);max-width:90%;margin-left:250px}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.button-container{display:flex;gap:10px}.confirm-button,.cancel-button{padding:10px 20px;border:none;border-radius:20px;cursor:pointer;font-weight:600;transition:all .3s ease}.confirm-button{color:var(--white);background-color:var(--primary)}.cancel-button{background-color:var(--disabled-button);color:var(--white)}.confirm-button:hover,.cancel-button:hover{opacity:.9}.text-content{flex-grow:1;padding-right:20px}.text-content .title{font-weight:700;font-size:20px;color:var(--primary);margin-bottom:10px}.text-content.success .title{color:var(--primary)}.text-content.error .title{color:var(--error-color)}.text-content.error .confirm-button{background-color:var(--error-color)}.text-content.warning .title{color:var(--support-orange)}.text-content.info .title{color:var(--primary)}.text-content.info .confirm-button{background-color:var(--primary)}.message{font-weight:400;font-size:16px;color:var(--message-color);margin-bottom:15px}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){.dialog-container{width:400px;max-width:90%;margin-left:0}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}.button-container{flex-direction:column;width:100%}.confirm-button,.cancel-button{width:100%;margin-bottom:10px}}\n"] }]
1348
- }], propDecorators: { config: [{
1300
+ args: [{ selector: "cao-stepper", standalone: true, template: "@if(title){\n<h3 class=\"stepper-title\">{{ title }}</h3>\n}\n<div class=\"d-flex step-container aic jcsb\">\n @if (showLine) {\n <div class=\"line\"></div>\n }\n <div class=\"steps d-flex aic jcsb\">\n <ng-content />\n </div>\n</div>\n", styles: [".step-container{position:relative}.steps{z-index:2;gap:24px}.line{width:100%;position:absolute;top:50%;height:1.5px;background-color:var(--return-color);z-index:1}\n"] }]
1301
+ }], ctorParameters: () => [], propDecorators: { steps: [{
1302
+ type: ContentChildren,
1303
+ args: [StepComponent]
1304
+ }], title: [{
1349
1305
  type: Input
1306
+ }], maxReachedEvent: [{
1307
+ type: Output
1350
1308
  }] } });
1351
1309
 
1352
- class BaseDialogService {
1353
- overlay;
1354
- constructor(overlay) {
1355
- this.overlay = overlay;
1356
- }
1357
- open(config) {
1358
- const overlayRef = this.overlay.create({
1359
- hasBackdrop: true,
1360
- positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
1361
- scrollStrategy: this.overlay.scrollStrategies.block(),
1362
- backdropClass: "dialog-backdrop",
1363
- });
1364
- const dialogPortal = new ComponentPortal(this.generateComponentPortal());
1365
- const componentRef = overlayRef.attach(dialogPortal);
1366
- componentRef.instance.config = config;
1367
- componentRef.instance.closeDialog = () => {
1368
- overlayRef.dispose();
1369
- };
1370
- return overlayRef;
1371
- }
1372
- generateComponentPortal() {
1373
- return BaseDialog;
1374
- }
1375
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, deps: [{ token: i1$4.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
1376
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, providedIn: "root" });
1310
+ class CaoTabContentDirective {
1311
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1312
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabContentDirective, isStandalone: true, selector: "[caoTabContent]", ngImport: i0 });
1377
1313
  }
1378
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, decorators: [{
1379
- type: Injectable,
1314
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabContentDirective, decorators: [{
1315
+ type: Directive,
1380
1316
  args: [{
1381
- providedIn: "root",
1317
+ selector: '[caoTabContent]',
1318
+ standalone: true,
1382
1319
  }]
1383
- }], ctorParameters: () => [{ type: i1$4.Overlay }] });
1320
+ }] });
1384
1321
 
1385
- class BaseFilterTableService {
1386
- filterSubject = new Subject();
1387
- filter$ = this.filterSubject.asObservable();
1388
- updateFilter(filterValue) {
1389
- this.filterSubject.next(filterValue);
1390
- }
1391
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1392
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, providedIn: "root" });
1322
+ class CaoTabLabelDirective {
1323
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1324
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabLabelDirective, isStandalone: true, selector: "[caoTabLabel]", ngImport: i0 });
1393
1325
  }
1394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, decorators: [{
1395
- type: Injectable,
1326
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabLabelDirective, decorators: [{
1327
+ type: Directive,
1396
1328
  args: [{
1397
- providedIn: "root",
1329
+ selector: '[caoTabLabel]',
1330
+ standalone: true,
1398
1331
  }]
1399
1332
  }] });
1400
1333
 
1401
- class BaseTableService {
1402
- tableConfigSubject = new BehaviorSubject(null);
1403
- dataSubject = new BehaviorSubject([]);
1404
- columnsSubject = new BehaviorSubject([]);
1405
- tableConfig$ = this.tableConfigSubject.asObservable();
1406
- columns$ = this.columnsSubject.asObservable();
1407
- data$ = this.dataSubject.asObservable();
1408
- visibleColumns$ = this.columns$.pipe(map((columns) => columns.filter((col) => col.visible).map((col) => col.key || col.element || "")));
1409
- createTable(data, columns, customConfig) {
1410
- const tableConfig = {
1411
- columns: columns ? columns.map((col) => col.key || col.element || "") : [],
1412
- data,
1413
- columnData: {},
1414
- result: {
1415
- noData: "Não há dados para o filtro selecionado.",
1416
- defaultMessage: "Nenhum resultado encontrado.",
1417
- },
1418
- ...customConfig,
1419
- };
1420
- if (data.length > 0 && columns) {
1421
- const columnData = {};
1422
- columns.forEach((col) => {
1423
- columnData[col.key || col.element || ""] = {
1424
- ...col,
1425
- type: col.type || this.inferColumnType(data[0][col.key || col.element || ""]),
1426
- visible: col.visible !== undefined ? col.visible : true,
1427
- };
1428
- });
1429
- tableConfig.columnData = columnData;
1430
- }
1431
- else if (data.length === 0 && columns) {
1432
- const columnData = {};
1433
- columns.forEach((col) => {
1434
- columnData[col.key || col.element || ""] = {
1435
- ...col,
1436
- type: col.type || "STRING",
1437
- visible: col.visible !== undefined ? col.visible : true,
1438
- };
1439
- });
1440
- tableConfig.columnData = columnData;
1441
- }
1442
- this.tableConfigSubject.next(tableConfig);
1443
- this.columnsSubject.next(columns || []);
1444
- this.dataSubject.next(data);
1445
- }
1446
- inferColumnType(value) {
1447
- if (value === null || value === undefined) {
1448
- return "STRING";
1449
- }
1450
- switch (typeof value) {
1451
- case "boolean":
1452
- return "BOOLEAN";
1453
- case "number":
1454
- return "NUMBER";
1455
- case "string":
1456
- return this.isValidDate(value) ? "DATE" : "STRING";
1457
- default:
1458
- return "STRING";
1459
- }
1460
- }
1461
- isValidDate(value) {
1462
- return !isNaN(Date.parse(value));
1463
- }
1464
- toggleColumnVisibility(columnKey) {
1465
- const currentColumns = this.columnsSubject.value;
1466
- const updatedColumns = currentColumns.map((col) => col.key === columnKey || col.element === columnKey ? { ...col, visible: !col.visible } : col);
1467
- const currentConfig = this.tableConfigSubject.value;
1468
- if (currentConfig) {
1469
- const updatedColumnData = { ...currentConfig.columnData };
1470
- const columnToUpdate = Object.keys(updatedColumnData).find((key) => key === columnKey);
1471
- if (columnToUpdate) {
1472
- updatedColumnData[columnToUpdate].visible = !updatedColumnData[columnToUpdate].visible;
1473
- this.tableConfigSubject.next({
1474
- ...currentConfig,
1475
- columnData: updatedColumnData,
1476
- });
1477
- }
1478
- }
1479
- this.columnsSubject.next(updatedColumns);
1480
- }
1481
- getVisibleColumns() {
1482
- return this.columnsSubject.value.filter((col) => col.visible);
1483
- }
1484
- setColumns(columns) {
1485
- const currentConfig = this.tableConfigSubject.value;
1486
- if (currentConfig) {
1487
- const columnData = {};
1488
- columns.forEach((col) => {
1489
- columnData[col.key || col.element || ""] = col;
1490
- });
1491
- this.tableConfigSubject.next({
1492
- ...currentConfig,
1493
- columns: columns.map((col) => col.key || col.element || ""),
1494
- columnData,
1495
- });
1496
- }
1497
- this.columnsSubject.next(columns);
1498
- }
1499
- setData(data) {
1500
- this.dataSubject.next(data);
1501
- const currentConfig = this.tableConfigSubject.value;
1502
- if (currentConfig) {
1503
- this.tableConfigSubject.next({
1504
- ...currentConfig,
1505
- data,
1506
- });
1507
- }
1508
- }
1509
- updateTableData(data) {
1510
- this.setData(data);
1511
- }
1512
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1513
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, providedIn: "root" });
1334
+ class CaoTabPanel {
1335
+ label = '';
1336
+ isLucideIcon = true;
1337
+ trailingIcon = null;
1338
+ leadingIcon = null;
1339
+ isDisabled = false;
1340
+ labelTemplate;
1341
+ lazyContent;
1342
+ content;
1343
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
1344
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabPanel, isStandalone: true, selector: "cao-tab-panel", inputs: { label: "label", isLucideIcon: "isLucideIcon", trailingIcon: "trailingIcon", leadingIcon: "leadingIcon", isDisabled: "isDisabled" }, queries: [{ propertyName: "labelTemplate", first: true, predicate: CaoTabLabelDirective, descendants: true, read: TemplateRef }, { propertyName: "lazyContent", first: true, predicate: CaoTabContentDirective, descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "content", first: true, predicate: ["implicitContent"], descendants: true, static: true }], ngImport: i0, template: `
1345
+ <ng-template #implicitContent>
1346
+ <ng-content />
1347
+ </ng-template>
1348
+ `, isInline: true, styles: [""] });
1514
1349
  }
1515
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, decorators: [{
1516
- type: Injectable,
1517
- args: [{
1518
- providedIn: "root",
1519
- }]
1520
- }] });
1350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabPanel, decorators: [{
1351
+ type: Component,
1352
+ args: [{ selector: "cao-tab-panel", imports: [], template: `
1353
+ <ng-template #implicitContent>
1354
+ <ng-content />
1355
+ </ng-template>
1356
+ ` }]
1357
+ }], propDecorators: { label: [{
1358
+ type: Input
1359
+ }], isLucideIcon: [{
1360
+ type: Input
1361
+ }], trailingIcon: [{
1362
+ type: Input
1363
+ }], leadingIcon: [{
1364
+ type: Input
1365
+ }], isDisabled: [{
1366
+ type: Input
1367
+ }], labelTemplate: [{
1368
+ type: ContentChild,
1369
+ args: [CaoTabLabelDirective, { read: TemplateRef }]
1370
+ }], lazyContent: [{
1371
+ type: ContentChild,
1372
+ args: [CaoTabContentDirective, { read: TemplateRef }]
1373
+ }], content: [{
1374
+ type: ViewChild,
1375
+ args: ['implicitContent', { static: true }]
1376
+ }] } });
1521
1377
 
1522
- function getPtBrPaginatorIntlBaseTable() {
1523
- const paginatorIntl = new MatPaginatorIntl();
1524
- paginatorIntl.itemsPerPageLabel = "Itens por página:";
1525
- paginatorIntl.nextPageLabel = "Próxima página";
1526
- paginatorIntl.previousPageLabel = "Página anterior";
1527
- paginatorIntl.firstPageLabel = "Primeira página";
1528
- paginatorIntl.lastPageLabel = "Última página";
1529
- paginatorIntl.getRangeLabel = (page, pageSize, length) => {
1530
- if (length === 0 || pageSize === 0) {
1531
- return `0 de ${length}`;
1532
- }
1533
- const startIndex = page * pageSize;
1534
- const endIndex = Math.min(startIndex + pageSize, length);
1535
- return `${startIndex + 1} – ${endIndex} de ${length}`;
1536
- };
1537
- return paginatorIntl;
1538
- }
1539
- class BaseTable {
1540
- customClass = "";
1541
- pageSizeOptions = [5, 10, 20, 50];
1542
- showFirstLastButtons = true;
1543
- isPaginatedByServer = false;
1544
- pageChanged = new EventEmitter();
1545
- pageSizeChanged = new EventEmitter();
1546
- firstPageClicked = new EventEmitter();
1547
- lastPageClicked = new EventEmitter();
1548
- selectionChanged = new EventEmitter();
1549
- pageEvent = new EventEmitter();
1550
- dataSource = new MatTableDataSource([]);
1551
- selection = new SelectionModel(true, []);
1552
- allColumns = [];
1553
- displayedColumns = [];
1554
- filterValue = "";
1555
- configSubscription = null;
1556
- visibleColumnsSubscription = null;
1557
- dataSubscription = null;
1558
- filterSubscription = null;
1559
- tableConfig = null;
1560
- sort;
1561
- paginator;
1562
- totalItems = 0;
1563
- pageSize = 10;
1564
- currentPage = 1;
1565
- previousPage = 1;
1566
- getAllColumns() {
1567
- return ["select", ...this.displayedColumns];
1378
+ class CaoTabGroup {
1379
+ get _hostStyles() {
1380
+ return {
1381
+ '--cao-tab-label-height': this.labelHeight,
1382
+ '--cao-tab-label-px': this.labelPaddingX,
1383
+ '--cao-tab-label-gap': this.labelGap,
1384
+ '--cao-tab-color-text': this.colorText,
1385
+ '--cao-tab-color-active': this.colorActive,
1386
+ '--cao-tab-color-hover-bg': this.colorHoverBg,
1387
+ '--cao-tab-color-disabled': this.colorDisabled,
1388
+ '--cao-tab-color-ink-bar': this.colorInkBar,
1389
+ '--cao-tab-color-header-border': this.colorHeaderBorder,
1390
+ '--cao-tab-ink-bar-height': this.inkBarHeight,
1391
+ '--cao-tab-content-pt': this.contentPaddingTop,
1392
+ '--cao-tab-radius': this.labelRadius,
1393
+ };
1568
1394
  }
1569
- tableService = inject(BaseTableService);
1570
- liveAnnouncer = inject(LiveAnnouncer);
1571
- filterTableService = inject(BaseFilterTableService);
1572
- constructor() {
1573
- this.initializeSortingAccessor();
1574
- this.initializeFilterPredicate();
1395
+ set selectedIndex(val) {
1396
+ this.selectIndex(val, false);
1575
1397
  }
1576
- ngOnInit() {
1577
- this.configSubscription = this.tableService.tableConfig$.subscribe((config) => {
1578
- if (config) {
1579
- this.tableConfig = config;
1580
- this.allColumns = config.columns;
1581
- }
1582
- });
1583
- this.visibleColumnsSubscription = this.tableService.visibleColumns$.subscribe((visibleColumns) => {
1584
- this.displayedColumns = visibleColumns.filter((col) => col !== "select");
1585
- });
1586
- this.dataSubscription = this.tableService.data$.subscribe((data) => {
1587
- this.dataSource.data = data;
1588
- this.updateTotalItems();
1589
- });
1590
- this.filterSubscription = this.filterTableService.filter$.subscribe((filterValue) => {
1591
- this.filterValue = filterValue;
1592
- this.applyFilter();
1593
- });
1398
+ get selectedIndex() {
1399
+ return this.activeIndex();
1594
1400
  }
1595
- ngAfterViewInit() {
1596
- this.dataSource.sort = this.sort;
1597
- // Connect paginator if available
1598
- setTimeout(() => {
1599
- if (this.paginator) {
1600
- this.dataSource.paginator = this.paginator;
1601
- this.paginator.pageIndex = this.currentPage - 1;
1602
- this.paginator.pageSize = this.pageSize;
1603
- this.paginator.showFirstLastButtons = this.showFirstLastButtons;
1604
- }
1605
- });
1606
- this.selection.changed.subscribe(() => {
1607
- this.selectionChanged.emit(this.selection.selected);
1608
- });
1401
+ labelHeight = '48px';
1402
+ labelPaddingX = '16px';
1403
+ labelGap = '6px';
1404
+ colorText = '#6b7280';
1405
+ colorActive = '#4f46e5';
1406
+ colorHoverBg = '#f3f4f6';
1407
+ colorDisabled = '#d1d5db';
1408
+ colorInkBar = '#4f46e5';
1409
+ colorHeaderBorder = '#e5e7eb';
1410
+ inkBarHeight = '2px';
1411
+ contentPaddingTop = '20px';
1412
+ labelRadius = '4px';
1413
+ animationDuration = '300ms';
1414
+ dynamicHeight = false;
1415
+ labelAlign = 'start';
1416
+ iconColorActive = '';
1417
+ iconColorInactive = '';
1418
+ strokeWidthIcon = 1;
1419
+ selectedTabChange = new EventEmitter();
1420
+ focusChange = new EventEmitter();
1421
+ tabs;
1422
+ tabBtns;
1423
+ inkBar;
1424
+ activeIndex = signal(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
1425
+ activatedSet = new Set();
1426
+ tabList = [];
1427
+ subs = new Subscription();
1428
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
1429
+ ngAfterContentInit() {
1430
+ this.tabList = this.tabs.toArray();
1431
+ this.activatedSet.add(this.activeIndex());
1432
+ this.subs.add(this.tabs.changes.subscribe(() => {
1433
+ this.tabList = this.tabs.toArray();
1434
+ const safe = Math.min(this.activeIndex(), this.tabList.length - 1);
1435
+ this.activeIndex.set(Math.max(0, safe));
1436
+ this.scheduleInkBar();
1437
+ }));
1438
+ this.scheduleInkBar();
1609
1439
  }
1610
1440
  ngOnDestroy() {
1611
- this.configSubscription?.unsubscribe();
1612
- this.visibleColumnsSubscription?.unsubscribe();
1613
- this.dataSubscription?.unsubscribe();
1614
- this.filterSubscription?.unsubscribe();
1441
+ this.subs.unsubscribe();
1615
1442
  }
1616
- initializeSortingAccessor() {
1617
- this.dataSource.sortingDataAccessor = (item, property) => {
1618
- const value = item[property];
1619
- if (typeof value === "string") {
1620
- return value.toLowerCase();
1621
- }
1622
- else if (typeof value === "number") {
1623
- return value;
1624
- }
1625
- else if (typeof value === "boolean") {
1626
- return value ? 1 : 0;
1627
- }
1628
- else if (value instanceof Date) {
1629
- return value.valueOf();
1630
- }
1631
- else if (value === null) {
1632
- return "";
1633
- }
1634
- else if (value === undefined) {
1635
- return undefined;
1636
- }
1637
- else if (typeof value === "object") {
1638
- return value.toString();
1639
- }
1640
- return value;
1641
- };
1443
+ selectTab(index) {
1444
+ this.selectIndex(index, true);
1642
1445
  }
1643
- initializeFilterPredicate() {
1644
- this.dataSource.filterPredicate = (data, filter) => {
1645
- const searchTerms = filter.trim().toLowerCase();
1646
- if (!searchTerms) {
1647
- return true;
1648
- }
1649
- const dataStr = Object.keys(data).reduce((currentTerm, key) => {
1650
- const value = data[key];
1651
- return (currentTerm +
1652
- (value !== null && value !== undefined ? value.toString().toLowerCase() : ""));
1653
- }, "");
1654
- return dataStr.indexOf(searchTerms) !== -1;
1655
- };
1446
+ get activeTab() {
1447
+ return this.tabList[this.activeIndex()] ?? null;
1656
1448
  }
1657
- applyFilter() {
1658
- const normalizedFilter = this.filterValue.trim().toLowerCase();
1659
- this.dataSource.filter = normalizedFilter;
1449
+ isActive(index) {
1450
+ return this.activeIndex() === index;
1660
1451
  }
1661
- toggleColumnVisibility(columnKey) {
1662
- this.tableService.toggleColumnVisibility(columnKey);
1452
+ wasActivated(index) {
1453
+ return this.activatedSet.has(index);
1663
1454
  }
1664
- isColumnVisible(column) {
1665
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
1666
- return true;
1455
+ onTabClick(index) {
1456
+ if (this.tabList[index]?.isDisabled) {
1457
+ return;
1667
1458
  }
1668
- return this.tableConfig.columnData[column].visible !== false;
1459
+ this.selectIndex(index, true);
1669
1460
  }
1670
- getColumnHeader(column) {
1671
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
1672
- return column;
1461
+ onKeydown(event, currentIndex) {
1462
+ let next = currentIndex;
1463
+ switch (event.key) {
1464
+ case 'ArrowRight':
1465
+ next = this.nextEnabled(currentIndex, 1);
1466
+ break;
1467
+ case 'ArrowLeft':
1468
+ next = this.nextEnabled(currentIndex, -1);
1469
+ break;
1470
+ case 'Home':
1471
+ next = this.nextEnabled(-1, 1);
1472
+ break;
1473
+ case 'End':
1474
+ next = this.nextEnabled(this.tabList.length, -1);
1475
+ break;
1476
+ default: return;
1673
1477
  }
1674
- return this.tableConfig.columnData[column].header || column;
1478
+ event.preventDefault();
1479
+ this.selectIndex(next, true);
1480
+ this.focusTab(next);
1675
1481
  }
1676
- getColumnType(column) {
1677
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
1678
- return "STRING";
1679
- }
1680
- return this.tableConfig.columnData[column].type || "STRING";
1482
+ onFocus(index) {
1483
+ this.focusChange.emit(index);
1681
1484
  }
1682
- getColumnElement(column) {
1683
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
1684
- return column;
1485
+ nextEnabled(from, dir) {
1486
+ const tabs = this.tabList;
1487
+ let idx = from + dir;
1488
+ while (idx >= 0 && idx < tabs.length) {
1489
+ if (!tabs[idx].isDisabled) {
1490
+ return idx;
1491
+ }
1492
+ idx += dir;
1685
1493
  }
1686
- return this.tableConfig.columnData[column].element || column;
1494
+ return from;
1687
1495
  }
1688
- getColumnButtons(column) {
1689
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
1690
- return [];
1496
+ selectIndex(index, emit) {
1497
+ if (!this.tabList) {
1498
+ this.activeIndex.set(Math.max(0, index));
1499
+ return;
1691
1500
  }
1692
- return this.tableConfig.columnData[column].buttons || [];
1693
- }
1694
- isAllSelected() {
1695
- if (!this.paginator ||
1696
- !this.dataSource.filteredData ||
1697
- this.dataSource.filteredData.length === 0) {
1698
- return false;
1501
+ const clamped = Math.max(0, Math.min(index, this.tabList.length - 1));
1502
+ const previous = this.activeIndex();
1503
+ if (clamped === previous && emit) {
1504
+ return;
1699
1505
  }
1700
- const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
1701
- const endIndex = Math.min(startIndex + this.paginator.pageSize, this.dataSource.filteredData.length);
1702
- const currentPageData = this.dataSource.filteredData.slice(startIndex, endIndex);
1703
- if (currentPageData.length === 0) {
1704
- return false;
1506
+ this.activeIndex.set(clamped);
1507
+ this.activatedSet.add(clamped);
1508
+ if (emit) {
1509
+ this.selectedTabChange.emit({
1510
+ previousIndex: previous,
1511
+ index: clamped,
1512
+ tab: this.tabList[clamped],
1513
+ });
1705
1514
  }
1706
- return currentPageData.every((row) => this.selection.isSelected(row));
1515
+ this.scheduleInkBar();
1707
1516
  }
1708
- toggleAllRows() {
1709
- if (!this.paginator || !this.dataSource.filteredData) {
1517
+ focusTab(index) {
1518
+ this.tabBtns?.toArray()[index]?.nativeElement?.focus();
1519
+ }
1520
+ scheduleInkBar() {
1521
+ if (!this.isBrowser) {
1710
1522
  return;
1711
1523
  }
1712
- if (this.isAllSelected()) {
1713
- this.selection.clear();
1714
- }
1715
- else {
1716
- const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
1717
- const endIndex = Math.min(startIndex + this.paginator.pageSize, this.dataSource.filteredData.length);
1718
- const currentPageData = this.dataSource.filteredData.slice(startIndex, endIndex);
1719
- currentPageData.forEach((row) => this.selection.select(row));
1720
- }
1524
+ requestAnimationFrame(() => this.updateInkBar());
1721
1525
  }
1722
- announceSortChange(sortState) {
1723
- if (sortState.direction) {
1724
- this.liveAnnouncer.announce(`Ordenado ${sortState.direction === "asc" ? "ascendente" : "descendente"}`);
1526
+ updateInkBar() {
1527
+ const btns = this.tabBtns?.toArray();
1528
+ const bar = this.inkBar?.nativeElement;
1529
+ if (!btns || !bar) {
1530
+ return;
1725
1531
  }
1726
- else {
1727
- this.liveAnnouncer.announce("Ordenação removida");
1532
+ const btn = btns[this.activeIndex()]?.nativeElement;
1533
+ if (!btn) {
1534
+ return;
1728
1535
  }
1536
+ bar.style.width = `${btn.offsetWidth}px`;
1537
+ bar.style.transform = `translateX(${btn.offsetLeft}px)`;
1538
+ bar.style.transitionDuration = this.animationDuration;
1729
1539
  }
1730
- trackByFn(index, item) {
1731
- return item;
1540
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
1541
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoTabGroup, isStandalone: true, selector: "cao-tab-group", inputs: { selectedIndex: "selectedIndex", labelHeight: "labelHeight", labelPaddingX: "labelPaddingX", labelGap: "labelGap", colorText: "colorText", colorActive: "colorActive", colorHoverBg: "colorHoverBg", colorDisabled: "colorDisabled", colorInkBar: "colorInkBar", colorHeaderBorder: "colorHeaderBorder", inkBarHeight: "inkBarHeight", contentPaddingTop: "contentPaddingTop", labelRadius: "labelRadius", animationDuration: "animationDuration", dynamicHeight: "dynamicHeight", labelAlign: "labelAlign", iconColorActive: "iconColorActive", iconColorInactive: "iconColorInactive", strokeWidthIcon: "strokeWidthIcon" }, outputs: { selectedTabChange: "selectedTabChange", focusChange: "focusChange" }, host: { properties: { "style": "this._hostStyles" }, classAttribute: "cao-tab-group" }, queries: [{ propertyName: "tabs", predicate: CaoTabPanel }], viewQueries: [{ propertyName: "inkBar", first: true, predicate: ["inkBar"], descendants: true }, { propertyName: "tabBtns", predicate: ["tabBtn"], descendants: true }], ngImport: i0, template: "<div\n #header\n [class]=\"'cao-tab-header cao-tab-header--align-' + labelAlign\"\n>\n <div class=\"cao-tab-label-list\" role=\"tablist\">\n @for (tab of tabList; track $index; let i = $index) {\n <button\n #tabBtn\n role=\"tab\"\n type=\"button\"\n class=\"cao-tab-label\"\n [class.cao-tab-label--active]=\"isActive(i)\"\n [class.cao-tab-label--disabled]=\"tab.isDisabled\"\n [attr.aria-selected]=\"isActive(i)\"\n [attr.aria-disabled]=\"tab.isDisabled || null\"\n [attr.tabindex]=\"isActive(i) ? 0 : -1\"\n [attr.id]=\"'cao-tab-label-' + i\"\n [attr.aria-controls]=\"'cao-tab-content-' + i\"\n (click)=\"onTabClick(i)\"\n (keydown)=\"onKeydown($event, i)\"\n (focus)=\"onFocus(i)\"\n >\n @if (tab.leadingIcon) {\n <span class=\"leading-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.leadingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.leadingIcon\" />\n }\n </span>\n }\n\n @if (tab.labelTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.labelTemplate\" />\n } @else {\n <span class=\"cao-tab-labeltext\">{{ tab.label }}</span>\n }\n\n @if (tab.trailingIcon) {\n <span class=\"trailing-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.trailingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.trailingIcon\" />\n }\n </span>\n }\n </button>\n }\n </div>\n\n <!-- Ink bar animado -->\n <div class=\"cao-tab-ink-bar-track\">\n <div #inkBar class=\"cao-tab-ink-bar\"></div>\n </div>\n</div>\n\n<!-- \u2550\u2550\u2550 Tab Bodies \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div\n class=\"cao-tab-body-wrapper\"\n [class.cao-tab-body-wrapper--dynamic]=\"dynamicHeight\"\n>\n @for (tab of tabList; track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n class=\"cao-tab-body\"\n [class.cao-tab-body--active]=\"isActive(i)\"\n [attr.id]=\"'cao-tab-content-' + i\"\n [attr.aria-labelledby]=\"'cao-tab-label-' + i\"\n [attr.aria-hidden]=\"!isActive(i)\"\n [style.--cao-tab-anim-duration]=\"animationDuration\"\n >\n <div class=\"cao-tab-bodycontent\">\n @if (tab.lazyContent) {\n @if (isActive(i) || wasActivated(i)) {\n <ng-container [ngTemplateOutlet]=\"tab.lazyContent\" />\n }\n } @else {\n <ng-container [ngTemplateOutlet]=\"tab.content\" />\n }\n </div>\n </div>\n }\n</div>", styles: [":host{--cao-tab-font-family: inherit;--cao-tab-font-size: .875rem;--cao-tab-font-weight: 500;--cao-tab-label-height: 48px;--cao-tab-Label-px: 16px;--cao-tab-Label-gap: 6px;--cao-tab-color-text: #6b7280;--cao-tab-color-active: #4f46e5;--cao-tab-color-hover-bg: #f3f4f6;--cao-tab-color-disabled: #d1d5db;--cao-tab-color-ink-bar: #4f46e5;--cao-tab-color-header-border: #e5e7eb;--cao-tab-ink-bar-height: 2px;--cao-tab-content-pt: 20px;--cao-tab-radius: 4px;display:flex;flex-direction:column;width:100%}.cao-tab-header{position:relative;border-bottom:1px solid var(--cao-tab-color-header-border);overflow-x:auto;scrollbar-width:none}.cao-tab-header::-webkit-scrollbar{display:none}.cao-tab-label-list{display:flex;align-items:center;min-width:max-content}.cao-tab-header--align-center .cao-tab-label-list{justify-content:center}.cao-tab-header--align-end .cao-tab-label-list{justify-content:flex-end}.cao-tab-header--align-start .cao-tab-label-list{justify-content:flex-start}.cao-tab-label{width:100%;display:inline-flex;justify-content:center;align-items:center;gap:var(--cao-tab-label-gap);height:var(--cao-tab-label-height);padding:0 var(--cao-tab-label-px);font-family:var(--cao-tab-font-family);font-size:var(--cao-tab-font-size);font-weight:var(--cao-tab-font-weight);color:var(--cao-tab-color-text);white-space:nowrap;background:transparent;border:none;border-radius:var(--cao-tab-radius) var(--cao-tab-radius) 0 0;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .18s ease,background-color .18s ease;outline:none}.cao-tab-label:focus-visible{outline:2px solid var(--cao-tab-color-active);outline-offset:-2px}.cao-tab-label:hover:not(.cao-tab-label--disabled){background-color:var(--cao-tab-color-hover-bg);color:var(--cao-tab-color-active)}.cao-tab-label--active{color:var(--cao-tab-color-active)}.cao-tab-label--disabled{color:var(--cao-tab-color-disabled);cursor:not-allowed;pointer-events:none}.cao-tab-label__icon{flex-shrink:0;color:inherit;transition:color .18s ease}.cao-tab-ink-bar-track{position:absolute;bottom:0;left:0;right:0;height:var(--cao-tab-ink-bar-height);pointer-events:none}.cao-tab-ink-bar{position:absolute;bottom:0;left:0;height:100%;background-color:var(--cao-tab-color-ink-bar);border-radius:2px 2px 0 0;transition-property:transform,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.cao-tab-body-wrapper{position:relative;overflow:hidden}.cao-tab-body-wrapper--dynamic{height:auto}.cao-tab-body{position:absolute;top:0;left:0;width:100%;visibility:hidden;opacity:0;pointer-events:none;transform:translate(24px);transition:opacity var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1),transform var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1)}.cao-tab-body--active{position:relative;visibility:visible;opacity:1;pointer-events:auto;transform:translate(0)}.cao-tab-body__content{padding-top:var(--cao-tab-content-pt)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
1542
+ }
1543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabGroup, decorators: [{
1544
+ type: Component,
1545
+ args: [{ selector: 'cao-tab-group', standalone: true, imports: [NgTemplateOutlet, LucideDynamicIcon], host: { class: 'cao-tab-group' }, template: "<div\n #header\n [class]=\"'cao-tab-header cao-tab-header--align-' + labelAlign\"\n>\n <div class=\"cao-tab-label-list\" role=\"tablist\">\n @for (tab of tabList; track $index; let i = $index) {\n <button\n #tabBtn\n role=\"tab\"\n type=\"button\"\n class=\"cao-tab-label\"\n [class.cao-tab-label--active]=\"isActive(i)\"\n [class.cao-tab-label--disabled]=\"tab.isDisabled\"\n [attr.aria-selected]=\"isActive(i)\"\n [attr.aria-disabled]=\"tab.isDisabled || null\"\n [attr.tabindex]=\"isActive(i) ? 0 : -1\"\n [attr.id]=\"'cao-tab-label-' + i\"\n [attr.aria-controls]=\"'cao-tab-content-' + i\"\n (click)=\"onTabClick(i)\"\n (keydown)=\"onKeydown($event, i)\"\n (focus)=\"onFocus(i)\"\n >\n @if (tab.leadingIcon) {\n <span class=\"leading-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.leadingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.leadingIcon\" />\n }\n </span>\n }\n\n @if (tab.labelTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.labelTemplate\" />\n } @else {\n <span class=\"cao-tab-labeltext\">{{ tab.label }}</span>\n }\n\n @if (tab.trailingIcon) {\n <span class=\"trailing-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.trailingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.trailingIcon\" />\n }\n </span>\n }\n </button>\n }\n </div>\n\n <!-- Ink bar animado -->\n <div class=\"cao-tab-ink-bar-track\">\n <div #inkBar class=\"cao-tab-ink-bar\"></div>\n </div>\n</div>\n\n<!-- \u2550\u2550\u2550 Tab Bodies \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div\n class=\"cao-tab-body-wrapper\"\n [class.cao-tab-body-wrapper--dynamic]=\"dynamicHeight\"\n>\n @for (tab of tabList; track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n class=\"cao-tab-body\"\n [class.cao-tab-body--active]=\"isActive(i)\"\n [attr.id]=\"'cao-tab-content-' + i\"\n [attr.aria-labelledby]=\"'cao-tab-label-' + i\"\n [attr.aria-hidden]=\"!isActive(i)\"\n [style.--cao-tab-anim-duration]=\"animationDuration\"\n >\n <div class=\"cao-tab-bodycontent\">\n @if (tab.lazyContent) {\n @if (isActive(i) || wasActivated(i)) {\n <ng-container [ngTemplateOutlet]=\"tab.lazyContent\" />\n }\n } @else {\n <ng-container [ngTemplateOutlet]=\"tab.content\" />\n }\n </div>\n </div>\n }\n</div>", styles: [":host{--cao-tab-font-family: inherit;--cao-tab-font-size: .875rem;--cao-tab-font-weight: 500;--cao-tab-label-height: 48px;--cao-tab-Label-px: 16px;--cao-tab-Label-gap: 6px;--cao-tab-color-text: #6b7280;--cao-tab-color-active: #4f46e5;--cao-tab-color-hover-bg: #f3f4f6;--cao-tab-color-disabled: #d1d5db;--cao-tab-color-ink-bar: #4f46e5;--cao-tab-color-header-border: #e5e7eb;--cao-tab-ink-bar-height: 2px;--cao-tab-content-pt: 20px;--cao-tab-radius: 4px;display:flex;flex-direction:column;width:100%}.cao-tab-header{position:relative;border-bottom:1px solid var(--cao-tab-color-header-border);overflow-x:auto;scrollbar-width:none}.cao-tab-header::-webkit-scrollbar{display:none}.cao-tab-label-list{display:flex;align-items:center;min-width:max-content}.cao-tab-header--align-center .cao-tab-label-list{justify-content:center}.cao-tab-header--align-end .cao-tab-label-list{justify-content:flex-end}.cao-tab-header--align-start .cao-tab-label-list{justify-content:flex-start}.cao-tab-label{width:100%;display:inline-flex;justify-content:center;align-items:center;gap:var(--cao-tab-label-gap);height:var(--cao-tab-label-height);padding:0 var(--cao-tab-label-px);font-family:var(--cao-tab-font-family);font-size:var(--cao-tab-font-size);font-weight:var(--cao-tab-font-weight);color:var(--cao-tab-color-text);white-space:nowrap;background:transparent;border:none;border-radius:var(--cao-tab-radius) var(--cao-tab-radius) 0 0;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .18s ease,background-color .18s ease;outline:none}.cao-tab-label:focus-visible{outline:2px solid var(--cao-tab-color-active);outline-offset:-2px}.cao-tab-label:hover:not(.cao-tab-label--disabled){background-color:var(--cao-tab-color-hover-bg);color:var(--cao-tab-color-active)}.cao-tab-label--active{color:var(--cao-tab-color-active)}.cao-tab-label--disabled{color:var(--cao-tab-color-disabled);cursor:not-allowed;pointer-events:none}.cao-tab-label__icon{flex-shrink:0;color:inherit;transition:color .18s ease}.cao-tab-ink-bar-track{position:absolute;bottom:0;left:0;right:0;height:var(--cao-tab-ink-bar-height);pointer-events:none}.cao-tab-ink-bar{position:absolute;bottom:0;left:0;height:100%;background-color:var(--cao-tab-color-ink-bar);border-radius:2px 2px 0 0;transition-property:transform,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.cao-tab-body-wrapper{position:relative;overflow:hidden}.cao-tab-body-wrapper--dynamic{height:auto}.cao-tab-body{position:absolute;top:0;left:0;width:100%;visibility:hidden;opacity:0;pointer-events:none;transform:translate(24px);transition:opacity var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1),transform var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1)}.cao-tab-body--active{position:relative;visibility:visible;opacity:1;pointer-events:auto;transform:translate(0)}.cao-tab-body__content{padding-top:var(--cao-tab-content-pt)}\n"] }]
1546
+ }], propDecorators: { _hostStyles: [{
1547
+ type: HostBinding,
1548
+ args: ['style']
1549
+ }], selectedIndex: [{
1550
+ type: Input
1551
+ }], labelHeight: [{
1552
+ type: Input
1553
+ }], labelPaddingX: [{
1554
+ type: Input
1555
+ }], labelGap: [{
1556
+ type: Input
1557
+ }], colorText: [{
1558
+ type: Input
1559
+ }], colorActive: [{
1560
+ type: Input
1561
+ }], colorHoverBg: [{
1562
+ type: Input
1563
+ }], colorDisabled: [{
1564
+ type: Input
1565
+ }], colorInkBar: [{
1566
+ type: Input
1567
+ }], colorHeaderBorder: [{
1568
+ type: Input
1569
+ }], inkBarHeight: [{
1570
+ type: Input
1571
+ }], contentPaddingTop: [{
1572
+ type: Input
1573
+ }], labelRadius: [{
1574
+ type: Input
1575
+ }], animationDuration: [{
1576
+ type: Input
1577
+ }], dynamicHeight: [{
1578
+ type: Input
1579
+ }], labelAlign: [{
1580
+ type: Input
1581
+ }], iconColorActive: [{
1582
+ type: Input
1583
+ }], iconColorInactive: [{
1584
+ type: Input
1585
+ }], strokeWidthIcon: [{
1586
+ type: Input
1587
+ }], selectedTabChange: [{
1588
+ type: Output
1589
+ }], focusChange: [{
1590
+ type: Output
1591
+ }], tabs: [{
1592
+ type: ContentChildren,
1593
+ args: [CaoTabPanel]
1594
+ }], tabBtns: [{
1595
+ type: ViewChildren,
1596
+ args: ['tabBtn']
1597
+ }], inkBar: [{
1598
+ type: ViewChild,
1599
+ args: ['inkBar']
1600
+ }] } });
1601
+
1602
+ class CaoBaseIcon {
1603
+ imgSource = "";
1604
+ isLucideIcon = true;
1605
+ strokeWidthIcon = 1;
1606
+ iconColor = "";
1607
+ size = 32;
1608
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoBaseIcon, deps: [], target: i0.ɵɵFactoryTarget.Component });
1609
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoBaseIcon, isStandalone: true, selector: "cao-base-icon", inputs: { imgSource: "imgSource", isLucideIcon: "isLucideIcon", strokeWidthIcon: "strokeWidthIcon", iconColor: "iconColor", size: "size" }, ngImport: i0, template: "@if (imgSource) {\n @if (isLucideIcon) {\n <div class=\"icon\">\n <svg [lucideIcon]=\"imgSource\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\" [size]=\"size\"></svg>\n </div>\n } @else {\n <div class=\"icon\">\n <img alt=\"\u00EDcone de in\u00EDcio\" [src]=\"imgSource\" />\n </div>\n }\n}", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
1610
+ }
1611
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoBaseIcon, decorators: [{
1612
+ type: Component,
1613
+ args: [{ selector: 'cao-base-icon', imports: [CommonModule, LucideDynamicIcon], template: "@if (imgSource) {\n @if (isLucideIcon) {\n <div class=\"icon\">\n <svg [lucideIcon]=\"imgSource\" [style.color]=\"iconColor\" [strokeWidth]=\"strokeWidthIcon\" [size]=\"size\"></svg>\n </div>\n } @else {\n <div class=\"icon\">\n <img alt=\"\u00EDcone de in\u00EDcio\" [src]=\"imgSource\" />\n </div>\n }\n}" }]
1614
+ }], propDecorators: { imgSource: [{
1615
+ type: Input
1616
+ }], isLucideIcon: [{
1617
+ type: Input
1618
+ }], strokeWidthIcon: [{
1619
+ type: Input
1620
+ }], iconColor: [{
1621
+ type: Input
1622
+ }], size: [{
1623
+ type: Input
1624
+ }] } });
1625
+
1626
+ class BaseModalService {
1627
+ constructor() { }
1628
+ toggleModalEvent = new EventEmitter();
1629
+ closeAllModalsEvent = new EventEmitter();
1630
+ openModal = new EventEmitter();
1631
+ modalResultSubject = new Subject();
1632
+ emitModalResult(result) {
1633
+ this.modalResultSubject.next(result);
1732
1634
  }
1733
- onPageChanged(page) {
1734
- this.currentPage = page;
1735
- this.pageChanged.emit(page);
1736
- if (this.paginator && this.paginator.pageIndex !== page - 1) {
1737
- this.paginator.pageIndex = page - 1;
1738
- }
1635
+ onModalResult() {
1636
+ return this.modalResultSubject.asObservable();
1739
1637
  }
1740
- onPageSizeChanged(pageSize) {
1741
- this.pageSize = pageSize;
1742
- this.pageSizeChanged.emit(pageSize);
1743
- if (this.paginator && this.paginator.pageSize !== pageSize) {
1744
- this.paginator.pageSize = pageSize;
1745
- }
1638
+ toggleModal(modalInfo) {
1639
+ this.toggleModalEvent.emit(modalInfo);
1746
1640
  }
1747
- /**
1748
- * Handle pagination events from Mat Paginator
1749
- */
1750
- onPageEvent(event) {
1751
- const newPage = event.pageIndex + 1;
1752
- const isFirstPage = newPage === 1 && this.previousPage !== 1;
1753
- const isLastPage = newPage === Math.ceil(this.totalItems / event.pageSize) && newPage !== this.previousPage;
1754
- // Handle page size changes
1755
- if (event.pageSize !== this.pageSize) {
1756
- this.onPageSizeChanged(event.pageSize);
1757
- }
1758
- // Handle page changes
1759
- if (newPage !== this.currentPage) {
1760
- this.previousPage = this.currentPage; // Store previous page for first/last detection
1761
- this.onPageChanged(newPage);
1762
- // Emit specific events for first/last page navigation
1763
- if (isFirstPage) {
1764
- this.firstPageClicked.emit();
1765
- this.liveAnnouncer.announce("Primeira página");
1766
- }
1767
- else if (isLastPage) {
1768
- this.lastPageClicked.emit();
1769
- this.liveAnnouncer.announce("Última página");
1770
- }
1771
- }
1772
- this.pageEvent.emit(event);
1641
+ closeAllModals() {
1642
+ this.closeAllModalsEvent.emit(true);
1773
1643
  }
1774
- /**
1775
- * Navigate to first page programmatically
1776
- */
1777
- goToFirstPage() {
1778
- if (this.currentPage !== 1) {
1779
- this.onPageChanged(1);
1780
- this.firstPageClicked.emit();
1781
- this.liveAnnouncer.announce("Primeira página");
1782
- }
1644
+ showModal(_selectedModal, data) {
1645
+ this.closeAllModals();
1646
+ const modalInfo = {
1647
+ type: _selectedModal,
1648
+ data: data,
1649
+ status: true,
1650
+ };
1651
+ this.openModal.emit(modalInfo);
1783
1652
  }
1784
- /**
1785
- * Navigate to last page programmatically
1786
- */
1787
- goToLastPage() {
1788
- const lastPage = Math.max(1, Math.ceil(this.totalItems / this.pageSize));
1789
- if (this.currentPage !== lastPage) {
1790
- this.onPageChanged(lastPage);
1791
- this.lastPageClicked.emit();
1792
- this.liveAnnouncer.announce("Última página");
1793
- }
1653
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1654
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, providedIn: "root" });
1655
+ }
1656
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModalService, decorators: [{
1657
+ type: Injectable,
1658
+ args: [{
1659
+ providedIn: "root",
1660
+ }]
1661
+ }], ctorParameters: () => [], propDecorators: { toggleModalEvent: [{
1662
+ type: Output
1663
+ }], closeAllModalsEvent: [{
1664
+ type: Output
1665
+ }], openModal: [{
1666
+ type: Output
1667
+ }] } });
1668
+
1669
+ class BaseModal {
1670
+ showModal = false;
1671
+ title = "";
1672
+ data;
1673
+ modalTypeClass = "default";
1674
+ modalClass = "modal-default";
1675
+ modalSize = "w-70";
1676
+ closeOnOverlayClick = false;
1677
+ modalService = inject(BaseModalService);
1678
+ closeModals() { }
1679
+ closeModalsWithoutDialog() {
1680
+ this.modalService.closeAllModals();
1794
1681
  }
1795
- /**
1796
- * Update total items when data changes
1797
- */
1798
- updateTotalItems() {
1799
- if (this.isPaginatedByServer) {
1800
- return;
1682
+ onOverlayClick() {
1683
+ if (this.closeOnOverlayClick) {
1684
+ this.closeModals();
1801
1685
  }
1802
- this.totalItems = this.dataSource.data.length;
1803
1686
  }
1804
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
1805
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseTable, isStandalone: true, selector: "cao-table", inputs: { customClass: "customClass", pageSizeOptions: "pageSizeOptions", showFirstLastButtons: "showFirstLastButtons", isPaginatedByServer: "isPaginatedByServer" }, outputs: { pageChanged: "pageChanged", pageSizeChanged: "pageSizeChanged", firstPageClicked: "firstPageClicked", lastPageClicked: "lastPageClicked", selectionChanged: "selectionChanged", pageEvent: "pageEvent" }, providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBaseTable() }], viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <div class=\"table-controls\">\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </div>\n\n <table\n mat-table\n matSort\n class=\"mat-elevation-z8\"\n [dataSource]=\"dataSource\"\n (matSortChange)=\"announceSortChange($event)\">\n <ng-container matColumnDef=\"select\">\n <th *matHeaderCellDef mat-header-cell>\n <mat-checkbox\n data-cy=\"checkbox-select-all\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (change)=\"$event ? toggleAllRows() : null\" />\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-select-row-' + row.id\"\n [checked]=\"selection.isSelected(row)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\" />\n </td>\n </ng-container>\n\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell [mat-sort-header]=\"column\">\n <span>{{ getColumnHeader(column) }}</span>\n <img\n alt=\"icone\"\n [ngSrc]=\"'.src/assets/svg/arrow-left-double.svg'\"\n [fill]=\"true\"\n [matMenuTriggerFor]=\"menuColunas\" />\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </th>\n <td *matCellDef=\"let element\" mat-cell>\n @switch (getColumnType(column)) { @case ('STRING') {\n <span>{{ element[getColumnElement(column)] }}</span>\n } @case ('BOOLEAN') {\n <mat-checkbox\n disabled\n [attr.data-cy]=\"'checkbox-value-' + column + '-' + element.id\"\n [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button\n mat-icon-button\n [type]=\"'button'\" [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } @default {\n <span>{{ element[getColumnElement(column)] }}</span>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td *matFooterCellDef mat-footer-cell [attr.colspan]=\"displayedColumns.length + 1\">\n Total de Registros: {{ dataSource.data.length }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"getAllColumns()\" mat-header-row></tr>\n <tr\n *matRowDef=\"let row; columns: getAllColumns();\"\n mat-row\n (click)=\"selection.toggle(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row></tr>\n </table>\n }\n</div>\n\n<mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n\n@if (!tableConfig || tableConfig.data.length === 0) {\n<div class=\"no-data-container\">\n <h2 class=\"no-data-title\">{{ tableConfig?.result?.noData || 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p class=\"no-data-message\"\n >{{ tableConfig?.result?.defaultMessage || 'Adicione alguns dados' }}</p\n >\n</div>\n}\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;max-width:100%;overflow:auto hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:max-content;min-width:100%;background-color:var(--table-body-color)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{border-right:none!important}.table-container .mat-mdc-table .mat-mdc-header-cell:not(:first-child),.table-container .mat-mdc-table .mat-mdc-cell:not(:first-child){border-right:1px solid var(--primary)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{width:60px;max-width:60px;min-width:60px;border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row{background-color:var(--table-header)}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--white);font-weight:600;color:var(--white);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--primary);color:var(--gray-dark);border-bottom:1px solid var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin-right:12px}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--input-disabled-bg)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:left;color:var(--gray-dark)}.table-container span,.table-container img{margin-right:10px}.table-container[_ngcontent-ng-c1530403114] .mat-mdc-table[_ngcontent-ng-c1530403114] .mat-mdc-footer-row[_ngcontent-ng-c1530403114]{display:none}.no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:15px;font-size:1.1rem}.no-data-container .no-data-title{color:var(--table-header);margin-bottom:12px}.no-data-container .no-data-message{color:var(--table-header)}@media(max-width:768px){.table-container .table-controls{flex-direction:column;align-items:stretch}.table-container .table-controls .filter-field{margin-right:0;margin-bottom:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MaterialModule }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i5$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i1$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i8.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i8.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i8.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
1687
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModal, deps: [], target: i0.ɵɵFactoryTarget.Component });
1688
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BaseModal, isStandalone: true, selector: "cao-modal", inputs: { showModal: "showModal", title: "title", data: "data", modalTypeClass: "modalTypeClass", modalClass: "modalClass", modalSize: "modalSize", closeOnOverlayClick: "closeOnOverlayClick" }, ngImport: i0, template: "<div aria-hidden=\"true\" class=\"modal\" tabIndex=\"0\" [class.show]=\"showModal\" (keydown)=\"onOverlayClick()\"\n (click)=\"onOverlayClick()\">\n <div aria-hidden=\"true\" class=\"modal-dialog\" tabIndex=\"1\" [ngClass]=\"[modalSize, modalClass]\"\n (keydown)=\"$event.stopPropagation()\" (click)=\"$event.stopPropagation()\">\n <ng-content />\n </div>\n</div>", styles: [".modal{width:100vw;height:100vh;align-items:center;justify-content:center;position:fixed;transition:.5s;top:-100vh;left:0}.modal .modal-dialog{padding:24px 34px;border-radius:20px;position:relative;max-width:1444px;height:auto;top:-100vh;transition:.5s;background-color:var(--bg-card);left:0}.modal .modal-dialog.custom{padding:0}.modal .modal-dialog.w-100{width:100%}.modal .modal-dialog.w-90{width:90%}.modal .modal-dialog.w-80{width:80%}.modal .modal-dialog.w-75{width:75%}.modal .modal-dialog.w-70{width:70%}.modal .modal-dialog.w-60{width:60%}.modal .modal-dialog.w-50{width:50%}.modal .modal-dialog.w-40{width:40%}.modal .modal-dialog.w-30{width:30%}.modal .modal-dialog.w-20{width:20%}.modal .modal-dialog.w-10{width:10%}.modal.show{z-index:1000;display:flex;top:0;background-color:#00000080}.modal.show .modal-dialog{top:0}@media(max-width:768px){.modal-dialog{width:90%;max-width:90vw;margin-left:0}}@media(min-width:769px){.modal-dialog{width:75%;margin-left:250px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1806
1689
  }
1807
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTable, decorators: [{
1690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseModal, decorators: [{
1808
1691
  type: Component,
1809
- args: [{ selector: "cao-table", imports: [CommonModule, MaterialModule, NgOptimizedImage], providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBaseTable() }], template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <div class=\"table-controls\">\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </div>\n\n <table\n mat-table\n matSort\n class=\"mat-elevation-z8\"\n [dataSource]=\"dataSource\"\n (matSortChange)=\"announceSortChange($event)\">\n <ng-container matColumnDef=\"select\">\n <th *matHeaderCellDef mat-header-cell>\n <mat-checkbox\n data-cy=\"checkbox-select-all\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (change)=\"$event ? toggleAllRows() : null\" />\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-select-row-' + row.id\"\n [checked]=\"selection.isSelected(row)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\" />\n </td>\n </ng-container>\n\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell [mat-sort-header]=\"column\">\n <span>{{ getColumnHeader(column) }}</span>\n <img\n alt=\"icone\"\n [ngSrc]=\"'.src/assets/svg/arrow-left-double.svg'\"\n [fill]=\"true\"\n [matMenuTriggerFor]=\"menuColunas\" />\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </th>\n <td *matCellDef=\"let element\" mat-cell>\n @switch (getColumnType(column)) { @case ('STRING') {\n <span>{{ element[getColumnElement(column)] }}</span>\n } @case ('BOOLEAN') {\n <mat-checkbox\n disabled\n [attr.data-cy]=\"'checkbox-value-' + column + '-' + element.id\"\n [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button\n mat-icon-button\n [type]=\"'button'\" [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } @default {\n <span>{{ element[getColumnElement(column)] }}</span>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td *matFooterCellDef mat-footer-cell [attr.colspan]=\"displayedColumns.length + 1\">\n Total de Registros: {{ dataSource.data.length }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"getAllColumns()\" mat-header-row></tr>\n <tr\n *matRowDef=\"let row; columns: getAllColumns();\"\n mat-row\n (click)=\"selection.toggle(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row></tr>\n </table>\n }\n</div>\n\n<mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n\n@if (!tableConfig || tableConfig.data.length === 0) {\n<div class=\"no-data-container\">\n <h2 class=\"no-data-title\">{{ tableConfig?.result?.noData || 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p class=\"no-data-message\"\n >{{ tableConfig?.result?.defaultMessage || 'Adicione alguns dados' }}</p\n >\n</div>\n}\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;max-width:100%;overflow:auto hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:max-content;min-width:100%;background-color:var(--table-body-color)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{border-right:none!important}.table-container .mat-mdc-table .mat-mdc-header-cell:not(:first-child),.table-container .mat-mdc-table .mat-mdc-cell:not(:first-child){border-right:1px solid var(--primary)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{width:60px;max-width:60px;min-width:60px;border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row{background-color:var(--table-header)}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--white);font-weight:600;color:var(--white);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--primary);color:var(--gray-dark);border-bottom:1px solid var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin-right:12px}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--input-disabled-bg)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:left;color:var(--gray-dark)}.table-container span,.table-container img{margin-right:10px}.table-container[_ngcontent-ng-c1530403114] .mat-mdc-table[_ngcontent-ng-c1530403114] .mat-mdc-footer-row[_ngcontent-ng-c1530403114]{display:none}.no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:15px;font-size:1.1rem}.no-data-container .no-data-title{color:var(--table-header);margin-bottom:12px}.no-data-container .no-data-message{color:var(--table-header)}@media(max-width:768px){.table-container .table-controls{flex-direction:column;align-items:stretch}.table-container .table-controls .filter-field{margin-right:0;margin-bottom:12px}}\n"] }]
1810
- }], ctorParameters: () => [], propDecorators: { customClass: [{
1692
+ args: [{ selector: 'cao-modal', imports: [CommonModule], template: "<div aria-hidden=\"true\" class=\"modal\" tabIndex=\"0\" [class.show]=\"showModal\" (keydown)=\"onOverlayClick()\"\n (click)=\"onOverlayClick()\">\n <div aria-hidden=\"true\" class=\"modal-dialog\" tabIndex=\"1\" [ngClass]=\"[modalSize, modalClass]\"\n (keydown)=\"$event.stopPropagation()\" (click)=\"$event.stopPropagation()\">\n <ng-content />\n </div>\n</div>", styles: [".modal{width:100vw;height:100vh;align-items:center;justify-content:center;position:fixed;transition:.5s;top:-100vh;left:0}.modal .modal-dialog{padding:24px 34px;border-radius:20px;position:relative;max-width:1444px;height:auto;top:-100vh;transition:.5s;background-color:var(--bg-card);left:0}.modal .modal-dialog.custom{padding:0}.modal .modal-dialog.w-100{width:100%}.modal .modal-dialog.w-90{width:90%}.modal .modal-dialog.w-80{width:80%}.modal .modal-dialog.w-75{width:75%}.modal .modal-dialog.w-70{width:70%}.modal .modal-dialog.w-60{width:60%}.modal .modal-dialog.w-50{width:50%}.modal .modal-dialog.w-40{width:40%}.modal .modal-dialog.w-30{width:30%}.modal .modal-dialog.w-20{width:20%}.modal .modal-dialog.w-10{width:10%}.modal.show{z-index:1000;display:flex;top:0;background-color:#00000080}.modal.show .modal-dialog{top:0}@media(max-width:768px){.modal-dialog{width:90%;max-width:90vw;margin-left:0}}@media(min-width:769px){.modal-dialog{width:75%;margin-left:250px}}\n"] }]
1693
+ }], propDecorators: { showModal: [{
1811
1694
  type: Input
1812
- }], pageSizeOptions: [{
1695
+ }], title: [{
1813
1696
  type: Input
1814
- }], showFirstLastButtons: [{
1697
+ }], data: [{
1815
1698
  type: Input
1816
- }], isPaginatedByServer: [{
1699
+ }], modalTypeClass: [{
1700
+ type: Input
1701
+ }], modalClass: [{
1702
+ type: Input
1703
+ }], modalSize: [{
1704
+ type: Input
1705
+ }], closeOnOverlayClick: [{
1817
1706
  type: Input
1818
- }], pageChanged: [{
1819
- type: Output
1820
- }], pageSizeChanged: [{
1821
- type: Output
1822
- }], firstPageClicked: [{
1823
- type: Output
1824
- }], lastPageClicked: [{
1825
- type: Output
1826
- }], selectionChanged: [{
1827
- type: Output
1828
- }], pageEvent: [{
1829
- type: Output
1830
- }], sort: [{
1831
- type: ViewChild,
1832
- args: [MatSort]
1833
- }], paginator: [{
1834
- type: ViewChild,
1835
- args: [MatPaginator]
1836
1707
  }] } });
1837
1708
 
1838
- class BaseFilterTablePaginatedService {
1839
- filterSubject = new Subject();
1840
- filter$ = this.filterSubject.asObservable();
1841
- updateFilter(filterValue) {
1842
- this.filterSubject.next(filterValue);
1709
+ class BaseDialog {
1710
+ config;
1711
+ closeDialog = this.noop;
1712
+ iconPaths = {
1713
+ success: "https://placehold.co/600x400",
1714
+ error: "https://placehold.co/600x400",
1715
+ info: "https://placehold.co/600x400",
1716
+ warning: "https://placehold.co/600x400",
1717
+ };
1718
+ noop() {
1719
+ return;
1843
1720
  }
1844
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1845
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, providedIn: "root" });
1846
- }
1847
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, decorators: [{
1848
- type: Injectable,
1849
- args: [{
1850
- providedIn: "root",
1851
- }]
1852
- }] });
1853
-
1854
- class BasePaginationService {
1855
- pageSubject = new BehaviorSubject(1);
1856
- pageSizeSubject = new BehaviorSubject(10);
1857
- totalItemsSubject = new BehaviorSubject(0);
1858
- currentPage$ = this.pageSubject.asObservable();
1859
- pageSize$ = this.pageSizeSubject.asObservable();
1860
- totalItems$ = this.totalItemsSubject.asObservable();
1861
- constructor() { }
1862
- /**
1863
- * Sets the current page number
1864
- * @param page The page number to set
1865
- */
1866
- setPage(page) {
1867
- if (page !== this.pageSubject.value) {
1868
- this.pageSubject.next(page);
1869
- }
1721
+ getIconPath() {
1722
+ return this.iconPaths[this.config.type];
1870
1723
  }
1871
- /**
1872
- * Sets the page size
1873
- * @param size The page size to set
1874
- */
1875
- setPageSize(size) {
1876
- if (size !== this.pageSizeSubject.value) {
1877
- this.pageSizeSubject.next(size);
1878
- }
1724
+ handleConfirm() {
1725
+ this.config.onConfirm?.();
1726
+ this.closeDialog();
1879
1727
  }
1880
- /**
1881
- * Sets the total number of items
1882
- * @param total The total number of items
1883
- */
1884
- setTotalItems(total) {
1885
- if (total !== this.totalItemsSubject.value) {
1886
- this.totalItemsSubject.next(total);
1887
- }
1728
+ handleCancel() {
1729
+ this.config.onCancel?.();
1730
+ this.closeDialog();
1888
1731
  }
1889
- /**
1890
- * Gets the current page
1891
- */
1892
- getCurrentPage() {
1893
- return this.pageSubject.value;
1732
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialog, deps: [], target: i0.ɵɵFactoryTarget.Component });
1733
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseDialog, isStandalone: true, selector: "cao-dialog", inputs: { config: "config" }, ngImport: i0, template: "\n<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [fill]=\"true\" [ngSrc]=\"config.logoIcon ?? ''\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\" [ngClass]=\"config.type\">\n <div class=\"title\">{{ config.title }}</div>\n <div class=\"message\">{{ config.message }}</div>\n <div class=\"button-container\">\n @if (config.cancelButtonText) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n [attr.data-cy]=\"config.cancelButtonText\"\n (keydown)=\"handleCancel()\"\n (click)=\"handleCancel()\">\n {{ config.cancelButtonText }}\n </button>\n } @if (config.confirmButtonText) {\n <button\n type=\"button\"\n class=\"confirm-button\"\n [ngClass]=\"config.type\"\n [attr.data-cy]=\"config.confirmButtonText\"\n (click)=\"handleConfirm()\"\n (keydown)=\"handleConfirm()\"\n >\n {{ config.confirmButtonText }}\n </button>\n }\n </div>\n </div>\n <div class=\"icon-container\">\n <img alt=\"Dialog Icon\" class=\"alert-icon\" [fill]=\"true\" [ngSrc]=\"getIconPath()\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;z-index:1000;background:#0009}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white);max-width:90%;margin-left:250px}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.button-container{display:flex;gap:10px}.confirm-button,.cancel-button{padding:10px 20px;border:none;border-radius:20px;cursor:pointer;font-weight:600;transition:all .3s ease}.confirm-button{color:var(--white);background-color:var(--primary)}.cancel-button{background-color:var(--disabled-button);color:var(--white)}.confirm-button:hover,.cancel-button:hover{opacity:.9}.text-content{flex-grow:1;padding-right:20px}.text-content .title{font-weight:700;font-size:20px;color:var(--primary);margin-bottom:10px}.text-content.success .title{color:var(--primary)}.text-content.error .title{color:var(--error-color)}.text-content.error .confirm-button{background-color:var(--error-color)}.text-content.warning .title{color:var(--support-orange)}.text-content.info .title{color:var(--primary)}.text-content.info .confirm-button{background-color:var(--primary)}.message{font-weight:400;font-size:16px;color:var(--message-color);margin-bottom:15px}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){.dialog-container{width:400px;max-width:90%;margin-left:0}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}.button-container{flex-direction:column;width:100%}.confirm-button,.cancel-button{width:100%;margin-bottom:10px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }] });
1734
+ }
1735
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialog, decorators: [{
1736
+ type: Component,
1737
+ args: [{ selector: 'cao-dialog', imports: [CommonModule, NgOptimizedImage], template: "\n<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [fill]=\"true\" [ngSrc]=\"config.logoIcon ?? ''\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\" [ngClass]=\"config.type\">\n <div class=\"title\">{{ config.title }}</div>\n <div class=\"message\">{{ config.message }}</div>\n <div class=\"button-container\">\n @if (config.cancelButtonText) {\n <button\n type=\"button\"\n class=\"cancel-button\"\n [attr.data-cy]=\"config.cancelButtonText\"\n (keydown)=\"handleCancel()\"\n (click)=\"handleCancel()\">\n {{ config.cancelButtonText }}\n </button>\n } @if (config.confirmButtonText) {\n <button\n type=\"button\"\n class=\"confirm-button\"\n [ngClass]=\"config.type\"\n [attr.data-cy]=\"config.confirmButtonText\"\n (click)=\"handleConfirm()\"\n (keydown)=\"handleConfirm()\"\n >\n {{ config.confirmButtonText }}\n </button>\n }\n </div>\n </div>\n <div class=\"icon-container\">\n <img alt=\"Dialog Icon\" class=\"alert-icon\" [fill]=\"true\" [ngSrc]=\"getIconPath()\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;z-index:1000;background:#0009}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white);max-width:90%;margin-left:250px}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.button-container{display:flex;gap:10px}.confirm-button,.cancel-button{padding:10px 20px;border:none;border-radius:20px;cursor:pointer;font-weight:600;transition:all .3s ease}.confirm-button{color:var(--white);background-color:var(--primary)}.cancel-button{background-color:var(--disabled-button);color:var(--white)}.confirm-button:hover,.cancel-button:hover{opacity:.9}.text-content{flex-grow:1;padding-right:20px}.text-content .title{font-weight:700;font-size:20px;color:var(--primary);margin-bottom:10px}.text-content.success .title{color:var(--primary)}.text-content.error .title{color:var(--error-color)}.text-content.error .confirm-button{background-color:var(--error-color)}.text-content.warning .title{color:var(--support-orange)}.text-content.info .title{color:var(--primary)}.text-content.info .confirm-button{background-color:var(--primary)}.message{font-weight:400;font-size:16px;color:var(--message-color);margin-bottom:15px}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){.dialog-container{width:400px;max-width:90%;margin-left:0}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}.button-container{flex-direction:column;width:100%}.confirm-button,.cancel-button{width:100%;margin-bottom:10px}}\n"] }]
1738
+ }], propDecorators: { config: [{
1739
+ type: Input
1740
+ }] } });
1741
+
1742
+ class BaseDialogService {
1743
+ overlay;
1744
+ constructor(overlay) {
1745
+ this.overlay = overlay;
1894
1746
  }
1895
- /**
1896
- * Gets the current page size
1897
- */
1898
- getPageSize() {
1899
- return this.pageSizeSubject.value;
1747
+ open(config) {
1748
+ const overlayRef = this.overlay.create({
1749
+ hasBackdrop: true,
1750
+ positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
1751
+ scrollStrategy: this.overlay.scrollStrategies.block(),
1752
+ backdropClass: "dialog-backdrop",
1753
+ });
1754
+ const dialogPortal = new ComponentPortal(this.generateComponentPortal());
1755
+ const componentRef = overlayRef.attach(dialogPortal);
1756
+ componentRef.instance.config = config;
1757
+ componentRef.instance.closeDialog = () => {
1758
+ overlayRef.dispose();
1759
+ };
1760
+ return overlayRef;
1900
1761
  }
1901
- /**
1902
- * Gets the total number of items
1903
- */
1904
- getTotalItems() {
1905
- return this.totalItemsSubject.value;
1762
+ generateComponentPortal() {
1763
+ return BaseDialog;
1906
1764
  }
1907
- /**
1908
- * Resets pagination to default values
1909
- */
1910
- reset() {
1911
- this.pageSubject.next(1);
1912
- this.pageSizeSubject.next(10);
1913
- this.totalItemsSubject.next(0);
1765
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, deps: [{ token: i1$4.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
1766
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, providedIn: "root" });
1767
+ }
1768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseDialogService, decorators: [{
1769
+ type: Injectable,
1770
+ args: [{
1771
+ providedIn: "root",
1772
+ }]
1773
+ }], ctorParameters: () => [{ type: i1$4.Overlay }] });
1774
+
1775
+ class BaseFilterTableService {
1776
+ filterSubject = new Subject();
1777
+ filter$ = this.filterSubject.asObservable();
1778
+ updateFilter(filterValue) {
1779
+ this.filterSubject.next(filterValue);
1914
1780
  }
1915
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1916
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, providedIn: "root" });
1781
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1782
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, providedIn: "root" });
1917
1783
  }
1918
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, decorators: [{
1784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTableService, decorators: [{
1919
1785
  type: Injectable,
1920
1786
  args: [{
1921
1787
  providedIn: "root",
1922
1788
  }]
1923
- }], ctorParameters: () => [] });
1789
+ }] });
1924
1790
 
1925
- class TablePaginatedService {
1791
+ class BaseTableService {
1926
1792
  tableConfigSubject = new BehaviorSubject(null);
1927
1793
  dataSubject = new BehaviorSubject([]);
1928
1794
  columnsSubject = new BehaviorSubject([]);
@@ -2033,17 +1899,17 @@ class TablePaginatedService {
2033
1899
  updateTableData(data) {
2034
1900
  this.setData(data);
2035
1901
  }
2036
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2037
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, providedIn: "root" });
1902
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1903
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, providedIn: "root" });
2038
1904
  }
2039
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, decorators: [{
1905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTableService, decorators: [{
2040
1906
  type: Injectable,
2041
1907
  args: [{
2042
1908
  providedIn: "root",
2043
1909
  }]
2044
1910
  }] });
2045
1911
 
2046
- function getPtBrPaginatorIntlBasePaginated() {
1912
+ function getPtBrPaginatorIntlBaseTable() {
2047
1913
  const paginatorIntl = new MatPaginatorIntl();
2048
1914
  paginatorIntl.itemsPerPageLabel = "Itens por página:";
2049
1915
  paginatorIntl.nextPageLabel = "Próxima página";
@@ -2060,19 +1926,17 @@ function getPtBrPaginatorIntlBasePaginated() {
2060
1926
  };
2061
1927
  return paginatorIntl;
2062
1928
  }
2063
- class BaseTablePaginated {
2064
- paginationSubscriptions = [];
2065
- getColumnCssClass;
1929
+ class BaseTable {
2066
1930
  customClass = "";
2067
1931
  pageSizeOptions = [5, 10, 20, 50];
2068
1932
  showFirstLastButtons = true;
1933
+ isPaginatedByServer = false;
2069
1934
  pageChanged = new EventEmitter();
2070
1935
  pageSizeChanged = new EventEmitter();
2071
1936
  firstPageClicked = new EventEmitter();
2072
1937
  lastPageClicked = new EventEmitter();
2073
1938
  selectionChanged = new EventEmitter();
2074
1939
  pageEvent = new EventEmitter();
2075
- rowClicked = new EventEmitter();
2076
1940
  dataSource = new MatTableDataSource([]);
2077
1941
  selection = new SelectionModel(true, []);
2078
1942
  allColumns = [];
@@ -2089,21 +1953,16 @@ class BaseTablePaginated {
2089
1953
  pageSize = 10;
2090
1954
  currentPage = 1;
2091
1955
  previousPage = 1;
2092
- paginationService = inject(BasePaginationService);
2093
- tableService = inject(TablePaginatedService);
1956
+ getAllColumns() {
1957
+ return ["select", ...this.displayedColumns];
1958
+ }
1959
+ tableService = inject(BaseTableService);
2094
1960
  liveAnnouncer = inject(LiveAnnouncer);
2095
- filterTableService = inject(BaseFilterTablePaginatedService);
1961
+ filterTableService = inject(BaseFilterTableService);
2096
1962
  constructor() {
2097
1963
  this.initializeSortingAccessor();
2098
1964
  this.initializeFilterPredicate();
2099
1965
  }
2100
- onPageChanged(page) {
2101
- this.currentPage = page;
2102
- this.pageChanged.emit(page);
2103
- if (this.paginator && this.paginator.pageIndex !== page - 1) {
2104
- this.paginator.pageIndex = page - 1;
2105
- }
2106
- }
2107
1966
  ngOnInit() {
2108
1967
  this.configSubscription = this.tableService.tableConfig$.subscribe((config) => {
2109
1968
  if (config) {
@@ -2122,73 +1981,27 @@ class BaseTablePaginated {
2122
1981
  this.filterValue = filterValue;
2123
1982
  this.applyFilter();
2124
1983
  });
2125
- this.paginationSubscriptions.push(this.paginationService.currentPage$.subscribe((page) => {
2126
- if (this.currentPage !== page) {
2127
- this.onPageChanged(page);
2128
- }
2129
- }), this.paginationService.pageSize$.subscribe((size) => {
2130
- if (this.pageSize !== size) {
2131
- this.onPageSizeChanged(size);
1984
+ }
1985
+ ngAfterViewInit() {
1986
+ this.dataSource.sort = this.sort;
1987
+ // Connect paginator if available
1988
+ setTimeout(() => {
1989
+ if (this.paginator) {
1990
+ this.dataSource.paginator = this.paginator;
1991
+ this.paginator.pageIndex = this.currentPage - 1;
1992
+ this.paginator.pageSize = this.pageSize;
1993
+ this.paginator.showFirstLastButtons = this.showFirstLastButtons;
2132
1994
  }
2133
- }));
1995
+ });
1996
+ this.selection.changed.subscribe(() => {
1997
+ this.selectionChanged.emit(this.selection.selected);
1998
+ });
2134
1999
  }
2135
2000
  ngOnDestroy() {
2136
2001
  this.configSubscription?.unsubscribe();
2137
2002
  this.visibleColumnsSubscription?.unsubscribe();
2138
2003
  this.dataSubscription?.unsubscribe();
2139
2004
  this.filterSubscription?.unsubscribe();
2140
- this.paginationSubscriptions.forEach((sub) => sub.unsubscribe());
2141
- }
2142
- updateTotalItems(newTotalItens) {
2143
- this.totalItems = newTotalItens ?? this.totalItems;
2144
- this.paginationService.setTotalItems(this.totalItems);
2145
- const lastPage = this.pageSize > 0 ? Math.ceil(this.totalItems / this.pageSize) : 1;
2146
- const lastValidPage = lastPage > 0 ? lastPage : 1;
2147
- if (this.currentPage > lastValidPage) {
2148
- this.paginationService.setPage(1);
2149
- }
2150
- }
2151
- onPageSizeChanged(pageSize) {
2152
- this.pageSize = pageSize;
2153
- this.pageSizeChanged.emit(pageSize);
2154
- if (this.paginator && this.paginator.pageSize !== pageSize) {
2155
- this.paginator.pageSize = pageSize;
2156
- }
2157
- }
2158
- getColumnHeader(column) {
2159
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2160
- return column;
2161
- }
2162
- return this.tableConfig.columnData[column].header || column;
2163
- }
2164
- getColumnElement(column) {
2165
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2166
- return column;
2167
- }
2168
- return this.tableConfig.columnData[column].element || column;
2169
- }
2170
- getColumnType(column) {
2171
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2172
- return "STRING";
2173
- }
2174
- return this.tableConfig.columnData[column].type || "STRING";
2175
- }
2176
- announceSortChange(sortState) {
2177
- if (sortState.direction) {
2178
- this.liveAnnouncer.announce(`Ordenado ${sortState.direction === "asc" ? "ascendente" : "descendente"}`);
2179
- }
2180
- else {
2181
- this.liveAnnouncer.announce("Ordenação removida");
2182
- }
2183
- }
2184
- handlePageChange(event) {
2185
- this.pageSize = event.pageSize;
2186
- this.paginationService.setPageSize(event.pageSize);
2187
- this.pageChanged.emit(event.pageIndex);
2188
- }
2189
- applyFilter() {
2190
- const normalizedFilter = this.filterValue.trim().toLowerCase();
2191
- this.dataSource.filter = normalizedFilter;
2192
2005
  }
2193
2006
  initializeSortingAccessor() {
2194
2007
  this.dataSource.sortingDataAccessor = (item, property) => {
@@ -2231,9 +2044,99 @@ class BaseTablePaginated {
2231
2044
  return dataStr.indexOf(searchTerms) !== -1;
2232
2045
  };
2233
2046
  }
2234
- onRowClick(row) {
2235
- this.rowClicked.emit(row);
2047
+ applyFilter() {
2048
+ const normalizedFilter = this.filterValue.trim().toLowerCase();
2049
+ this.dataSource.filter = normalizedFilter;
2050
+ }
2051
+ toggleColumnVisibility(columnKey) {
2052
+ this.tableService.toggleColumnVisibility(columnKey);
2053
+ }
2054
+ isColumnVisible(column) {
2055
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2056
+ return true;
2057
+ }
2058
+ return this.tableConfig.columnData[column].visible !== false;
2059
+ }
2060
+ getColumnHeader(column) {
2061
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2062
+ return column;
2063
+ }
2064
+ return this.tableConfig.columnData[column].header || column;
2065
+ }
2066
+ getColumnType(column) {
2067
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2068
+ return "STRING";
2069
+ }
2070
+ return this.tableConfig.columnData[column].type || "STRING";
2071
+ }
2072
+ getColumnElement(column) {
2073
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2074
+ return column;
2075
+ }
2076
+ return this.tableConfig.columnData[column].element || column;
2077
+ }
2078
+ getColumnButtons(column) {
2079
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2080
+ return [];
2081
+ }
2082
+ return this.tableConfig.columnData[column].buttons || [];
2083
+ }
2084
+ isAllSelected() {
2085
+ if (!this.paginator ||
2086
+ !this.dataSource.filteredData ||
2087
+ this.dataSource.filteredData.length === 0) {
2088
+ return false;
2089
+ }
2090
+ const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
2091
+ const endIndex = Math.min(startIndex + this.paginator.pageSize, this.dataSource.filteredData.length);
2092
+ const currentPageData = this.dataSource.filteredData.slice(startIndex, endIndex);
2093
+ if (currentPageData.length === 0) {
2094
+ return false;
2095
+ }
2096
+ return currentPageData.every((row) => this.selection.isSelected(row));
2097
+ }
2098
+ toggleAllRows() {
2099
+ if (!this.paginator || !this.dataSource.filteredData) {
2100
+ return;
2101
+ }
2102
+ if (this.isAllSelected()) {
2103
+ this.selection.clear();
2104
+ }
2105
+ else {
2106
+ const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
2107
+ const endIndex = Math.min(startIndex + this.paginator.pageSize, this.dataSource.filteredData.length);
2108
+ const currentPageData = this.dataSource.filteredData.slice(startIndex, endIndex);
2109
+ currentPageData.forEach((row) => this.selection.select(row));
2110
+ }
2111
+ }
2112
+ announceSortChange(sortState) {
2113
+ if (sortState.direction) {
2114
+ this.liveAnnouncer.announce(`Ordenado ${sortState.direction === "asc" ? "ascendente" : "descendente"}`);
2115
+ }
2116
+ else {
2117
+ this.liveAnnouncer.announce("Ordenação removida");
2118
+ }
2119
+ }
2120
+ trackByFn(index, item) {
2121
+ return item;
2122
+ }
2123
+ onPageChanged(page) {
2124
+ this.currentPage = page;
2125
+ this.pageChanged.emit(page);
2126
+ if (this.paginator && this.paginator.pageIndex !== page - 1) {
2127
+ this.paginator.pageIndex = page - 1;
2128
+ }
2129
+ }
2130
+ onPageSizeChanged(pageSize) {
2131
+ this.pageSize = pageSize;
2132
+ this.pageSizeChanged.emit(pageSize);
2133
+ if (this.paginator && this.paginator.pageSize !== pageSize) {
2134
+ this.paginator.pageSize = pageSize;
2135
+ }
2236
2136
  }
2137
+ /**
2138
+ * Handle pagination events from Mat Paginator
2139
+ */
2237
2140
  onPageEvent(event) {
2238
2141
  const newPage = event.pageIndex + 1;
2239
2142
  const isFirstPage = newPage === 1 && this.previousPage !== 1;
@@ -2258,26 +2161,50 @@ class BaseTablePaginated {
2258
2161
  }
2259
2162
  this.pageEvent.emit(event);
2260
2163
  }
2261
- getColumnButtons(column) {
2262
- if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2263
- return [];
2164
+ /**
2165
+ * Navigate to first page programmatically
2166
+ */
2167
+ goToFirstPage() {
2168
+ if (this.currentPage !== 1) {
2169
+ this.onPageChanged(1);
2170
+ this.firstPageClicked.emit();
2171
+ this.liveAnnouncer.announce("Primeira página");
2264
2172
  }
2265
- return this.tableConfig.columnData[column].buttons || [];
2266
2173
  }
2267
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTablePaginated, deps: [], target: i0.ɵɵFactoryTarget.Component });
2268
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseTablePaginated, isStandalone: true, selector: "cao-table-paginated", inputs: { getColumnCssClass: "getColumnCssClass", customClass: "customClass", pageSizeOptions: "pageSizeOptions", showFirstLastButtons: "showFirstLastButtons" }, outputs: { pageChanged: "pageChanged", pageSizeChanged: "pageSizeChanged", firstPageClicked: "firstPageClicked", lastPageClicked: "lastPageClicked", selectionChanged: "selectionChanged", pageEvent: "pageEvent", rowClicked: "rowClicked" }, providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBasePaginated() }], viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <table mat-table matSort [dataSource]=\"dataSource\" (matSortChange)=\"announceSortChange($event)\">\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell mat-sort-header class=\"table-header\">\n {{ getColumnHeader(column) }}\n </th>\n <td *matCellDef=\"let element\" mat-cell class=\"table-cell\">\n @switch (getColumnType(column)) { @case ('STRING') { @if (getColumnCssClass &&\n getColumnCssClass(column, element[getColumnElement(column)])) {\n <span [class]=\"getColumnCssClass(column, element[getColumnElement(column)])\">\n {{ element[getColumnElement(column)] }}\n </span>\n } @else {\n <span>{{ element[getColumnElement(column)] }}</span>\n } } @case ('BOOLEAN') {\n <mat-checkbox disabled [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button type=\"button\" mat-icon-button [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td\n *matFooterCellDef\n mat-footer-cell\n class=\"table-cell\"\n [attr.colspan]=\"displayedColumns.length\">\n Total de Registros: {{ totalItems }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" mat-row (click)=\"onRowClick(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row class=\"mat-row-footer\"></tr>\n </table>\n @if(totalItems > 0){\n\n <mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n } @else {\n <div class=\"no-data-container\">\n <h2>{{ tableConfig?.result?.noData ?? 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p>{{ tableConfig?.result?.defaultMessage ?? 'Adicione alguns dados' }}</p>\n </div>\n } }\n</div>\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;overflow:hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px;justify-content:center}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px;margin:0 auto}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none;text-align:center}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:100%}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--data-bg);font-weight:600;color:var(--message-color);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem;text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell .mat-sort-header-container{justify-content:center}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease;background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(2n){background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(odd){background-color:var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--border-table-ligth);color:var(--gray-dark);border-bottom:1px solid var(--input-background);text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin:0 auto;display:block}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--text-color)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:center}.table-container .no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;text-align:center;background-color:var(--table-background)}.table-container .no-data-container h2{color:var(--input-disabled-bg);margin-bottom:12px}.table-container .no-data-container p{color:var(--input-disabled-bg)}@media(width<=768px){.table-container .table-controls{flex-direction:column;align-items:center}.table-container .table-controls .filter-field{width:80%;margin-right:0;margin-bottom:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MaterialModule }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i1$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i8.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i8.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i8.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.DatePipe, name: "date" }], encapsulation: i0.ViewEncapsulation.None });
2174
+ /**
2175
+ * Navigate to last page programmatically
2176
+ */
2177
+ goToLastPage() {
2178
+ const lastPage = Math.max(1, Math.ceil(this.totalItems / this.pageSize));
2179
+ if (this.currentPage !== lastPage) {
2180
+ this.onPageChanged(lastPage);
2181
+ this.lastPageClicked.emit();
2182
+ this.liveAnnouncer.announce("Última página");
2183
+ }
2184
+ }
2185
+ /**
2186
+ * Update total items when data changes
2187
+ */
2188
+ updateTotalItems() {
2189
+ if (this.isPaginatedByServer) {
2190
+ return;
2191
+ }
2192
+ this.totalItems = this.dataSource.data.length;
2193
+ }
2194
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTable, deps: [], target: i0.ɵɵFactoryTarget.Component });
2195
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseTable, isStandalone: true, selector: "cao-table", inputs: { customClass: "customClass", pageSizeOptions: "pageSizeOptions", showFirstLastButtons: "showFirstLastButtons", isPaginatedByServer: "isPaginatedByServer" }, outputs: { pageChanged: "pageChanged", pageSizeChanged: "pageSizeChanged", firstPageClicked: "firstPageClicked", lastPageClicked: "lastPageClicked", selectionChanged: "selectionChanged", pageEvent: "pageEvent" }, providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBaseTable() }], viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <div class=\"table-controls\">\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </div>\n\n <table\n mat-table\n matSort\n class=\"mat-elevation-z8\"\n [dataSource]=\"dataSource\"\n (matSortChange)=\"announceSortChange($event)\">\n <ng-container matColumnDef=\"select\">\n <th *matHeaderCellDef mat-header-cell>\n <mat-checkbox\n data-cy=\"checkbox-select-all\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (change)=\"$event ? toggleAllRows() : null\" />\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-select-row-' + row.id\"\n [checked]=\"selection.isSelected(row)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\" />\n </td>\n </ng-container>\n\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell [mat-sort-header]=\"column\">\n <span>{{ getColumnHeader(column) }}</span>\n <img\n alt=\"icone\"\n [ngSrc]=\"'.src/assets/svg/arrow-left-double.svg'\"\n [fill]=\"true\"\n [matMenuTriggerFor]=\"menuColunas\" />\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </th>\n <td *matCellDef=\"let element\" mat-cell>\n @switch (getColumnType(column)) { @case ('STRING') {\n <span>{{ element[getColumnElement(column)] }}</span>\n } @case ('BOOLEAN') {\n <mat-checkbox\n disabled\n [attr.data-cy]=\"'checkbox-value-' + column + '-' + element.id\"\n [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button\n mat-icon-button\n [type]=\"'button'\" [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } @default {\n <span>{{ element[getColumnElement(column)] }}</span>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td *matFooterCellDef mat-footer-cell [attr.colspan]=\"displayedColumns.length + 1\">\n Total de Registros: {{ dataSource.data.length }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"getAllColumns()\" mat-header-row></tr>\n <tr\n *matRowDef=\"let row; columns: getAllColumns();\"\n mat-row\n (click)=\"selection.toggle(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row></tr>\n </table>\n }\n</div>\n\n<mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n\n@if (!tableConfig || tableConfig.data.length === 0) {\n<div class=\"no-data-container\">\n <h2 class=\"no-data-title\">{{ tableConfig?.result?.noData || 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p class=\"no-data-message\"\n >{{ tableConfig?.result?.defaultMessage || 'Adicione alguns dados' }}</p\n >\n</div>\n}\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;max-width:100%;overflow:auto hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:max-content;min-width:100%;background-color:var(--table-body-color)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{border-right:none!important}.table-container .mat-mdc-table .mat-mdc-header-cell:not(:first-child),.table-container .mat-mdc-table .mat-mdc-cell:not(:first-child){border-right:1px solid var(--primary)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{width:60px;max-width:60px;min-width:60px;border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row{background-color:var(--table-header)}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--white);font-weight:600;color:var(--white);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--primary);color:var(--gray-dark);border-bottom:1px solid var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin-right:12px}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--input-disabled-bg)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:left;color:var(--gray-dark)}.table-container span,.table-container img{margin-right:10px}.table-container[_ngcontent-ng-c1530403114] .mat-mdc-table[_ngcontent-ng-c1530403114] .mat-mdc-footer-row[_ngcontent-ng-c1530403114]{display:none}.no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:15px;font-size:1.1rem}.no-data-container .no-data-title{color:var(--table-header);margin-bottom:12px}.no-data-container .no-data-message{color:var(--table-header)}@media(max-width:768px){.table-container .table-controls{flex-direction:column;align-items:stretch}.table-container .table-controls .filter-field{margin-right:0;margin-bottom:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MaterialModule }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$1.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i5$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i5$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "component", type: i1$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i8.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i8.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i8.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.DatePipe, name: "date" }] });
2269
2196
  }
2270
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTablePaginated, decorators: [{
2197
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTable, decorators: [{
2271
2198
  type: Component,
2272
- args: [{ selector: "cao-table-paginated", encapsulation: ViewEncapsulation.None, imports: [CommonModule, MaterialModule], providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBasePaginated() }], template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <table mat-table matSort [dataSource]=\"dataSource\" (matSortChange)=\"announceSortChange($event)\">\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell mat-sort-header class=\"table-header\">\n {{ getColumnHeader(column) }}\n </th>\n <td *matCellDef=\"let element\" mat-cell class=\"table-cell\">\n @switch (getColumnType(column)) { @case ('STRING') { @if (getColumnCssClass &&\n getColumnCssClass(column, element[getColumnElement(column)])) {\n <span [class]=\"getColumnCssClass(column, element[getColumnElement(column)])\">\n {{ element[getColumnElement(column)] }}\n </span>\n } @else {\n <span>{{ element[getColumnElement(column)] }}</span>\n } } @case ('BOOLEAN') {\n <mat-checkbox disabled [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button type=\"button\" mat-icon-button [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td\n *matFooterCellDef\n mat-footer-cell\n class=\"table-cell\"\n [attr.colspan]=\"displayedColumns.length\">\n Total de Registros: {{ totalItems }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" mat-row (click)=\"onRowClick(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row class=\"mat-row-footer\"></tr>\n </table>\n @if(totalItems > 0){\n\n <mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n } @else {\n <div class=\"no-data-container\">\n <h2>{{ tableConfig?.result?.noData ?? 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p>{{ tableConfig?.result?.defaultMessage ?? 'Adicione alguns dados' }}</p>\n </div>\n } }\n</div>\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;overflow:hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px;justify-content:center}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px;margin:0 auto}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none;text-align:center}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:100%}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--data-bg);font-weight:600;color:var(--message-color);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem;text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell .mat-sort-header-container{justify-content:center}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease;background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(2n){background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(odd){background-color:var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--border-table-ligth);color:var(--gray-dark);border-bottom:1px solid var(--input-background);text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin:0 auto;display:block}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--text-color)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:center}.table-container .no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;text-align:center;background-color:var(--table-background)}.table-container .no-data-container h2{color:var(--input-disabled-bg);margin-bottom:12px}.table-container .no-data-container p{color:var(--input-disabled-bg)}@media(width<=768px){.table-container .table-controls{flex-direction:column;align-items:center}.table-container .table-controls .filter-field{width:80%;margin-right:0;margin-bottom:12px}}\n"] }]
2273
- }], ctorParameters: () => [], propDecorators: { getColumnCssClass: [{
2274
- type: Input
2275
- }], customClass: [{
2199
+ args: [{ selector: "cao-table", imports: [CommonModule, MaterialModule, NgOptimizedImage], providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBaseTable() }], template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <div class=\"table-controls\">\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </div>\n\n <table\n mat-table\n matSort\n class=\"mat-elevation-z8\"\n [dataSource]=\"dataSource\"\n (matSortChange)=\"announceSortChange($event)\">\n <ng-container matColumnDef=\"select\">\n <th *matHeaderCellDef mat-header-cell>\n <mat-checkbox\n data-cy=\"checkbox-select-all\"\n [checked]=\"selection.hasValue() && isAllSelected()\"\n [indeterminate]=\"selection.hasValue() && !isAllSelected()\"\n (change)=\"$event ? toggleAllRows() : null\" />\n </th>\n <td *matCellDef=\"let row\" mat-cell>\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-select-row-' + row.id\"\n [checked]=\"selection.isSelected(row)\"\n (click)=\"$event.stopPropagation()\"\n (change)=\"$event ? selection.toggle(row) : null\" />\n </td>\n </ng-container>\n\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell [mat-sort-header]=\"column\">\n <span>{{ getColumnHeader(column) }}</span>\n <img\n alt=\"icone\"\n [ngSrc]=\"'.src/assets/svg/arrow-left-double.svg'\"\n [fill]=\"true\"\n [matMenuTriggerFor]=\"menuColunas\" />\n <mat-menu #menuColunas=\"matMenu\">\n @for (column of allColumns; track column) {\n <button\n mat-menu-item\n [type]=\"'button'\" (click)=\"toggleColumnVisibility(column)\">\n <mat-checkbox\n [attr.data-cy]=\"'checkbox-toggle-column-' + column\"\n [checked]=\"isColumnVisible(column)\">\n {{ getColumnHeader(column) }}\n </mat-checkbox>\n </button>\n }\n </mat-menu>\n </th>\n <td *matCellDef=\"let element\" mat-cell>\n @switch (getColumnType(column)) { @case ('STRING') {\n <span>{{ element[getColumnElement(column)] }}</span>\n } @case ('BOOLEAN') {\n <mat-checkbox\n disabled\n [attr.data-cy]=\"'checkbox-value-' + column + '-' + element.id\"\n [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button\n mat-icon-button\n [type]=\"'button'\" [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } @default {\n <span>{{ element[getColumnElement(column)] }}</span>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td *matFooterCellDef mat-footer-cell [attr.colspan]=\"displayedColumns.length + 1\">\n Total de Registros: {{ dataSource.data.length }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"getAllColumns()\" mat-header-row></tr>\n <tr\n *matRowDef=\"let row; columns: getAllColumns();\"\n mat-row\n (click)=\"selection.toggle(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row></tr>\n </table>\n }\n</div>\n\n<mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n\n@if (!tableConfig || tableConfig.data.length === 0) {\n<div class=\"no-data-container\">\n <h2 class=\"no-data-title\">{{ tableConfig?.result?.noData || 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p class=\"no-data-message\"\n >{{ tableConfig?.result?.defaultMessage || 'Adicione alguns dados' }}</p\n >\n</div>\n}\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;max-width:100%;overflow:auto hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:max-content;min-width:100%;background-color:var(--table-body-color)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{border-right:none!important}.table-container .mat-mdc-table .mat-mdc-header-cell:not(:first-child),.table-container .mat-mdc-table .mat-mdc-cell:not(:first-child){border-right:1px solid var(--primary)}.table-container .mat-mdc-table .mat-mdc-header-cell:first-child,.table-container .mat-mdc-table .mat-mdc-cell:first-child{width:60px;max-width:60px;min-width:60px;border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row{background-color:var(--table-header)}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--white);font-weight:600;color:var(--white);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--primary);color:var(--gray-dark);border-bottom:1px solid var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin-right:12px}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--input-disabled-bg)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:left;color:var(--gray-dark)}.table-container span,.table-container img{margin-right:10px}.table-container[_ngcontent-ng-c1530403114] .mat-mdc-table[_ngcontent-ng-c1530403114] .mat-mdc-footer-row[_ngcontent-ng-c1530403114]{display:none}.no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:15px;font-size:1.1rem}.no-data-container .no-data-title{color:var(--table-header);margin-bottom:12px}.no-data-container .no-data-message{color:var(--table-header)}@media(max-width:768px){.table-container .table-controls{flex-direction:column;align-items:stretch}.table-container .table-controls .filter-field{margin-right:0;margin-bottom:12px}}\n"] }]
2200
+ }], ctorParameters: () => [], propDecorators: { customClass: [{
2276
2201
  type: Input
2277
2202
  }], pageSizeOptions: [{
2278
2203
  type: Input
2279
2204
  }], showFirstLastButtons: [{
2280
2205
  type: Input
2206
+ }], isPaginatedByServer: [{
2207
+ type: Input
2281
2208
  }], pageChanged: [{
2282
2209
  type: Output
2283
2210
  }], pageSizeChanged: [{
@@ -2290,8 +2217,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
2290
2217
  type: Output
2291
2218
  }], pageEvent: [{
2292
2219
  type: Output
2293
- }], rowClicked: [{
2294
- type: Output
2295
2220
  }], sort: [{
2296
2221
  type: ViewChild,
2297
2222
  args: [MatSort]
@@ -2300,430 +2225,528 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
2300
2225
  args: [MatPaginator]
2301
2226
  }] } });
2302
2227
 
2303
- class BaseAlert {
2304
- data;
2305
- iconPath;
2306
- titleClass;
2307
- iconPaths = {
2308
- success: "https://placehold.co/600x400",
2309
- error: "https://placehold.co/600x400",
2310
- info: "https://placehold.co/600x400",
2311
- warning: "https://placehold.co/600x400",
2312
- };
2313
- ngOnInit() {
2314
- this.iconPath = this.iconPaths[this.data.type];
2315
- this.titleClass = `title-${this.data.type}`;
2228
+ class BaseFilterTablePaginatedService {
2229
+ filterSubject = new Subject();
2230
+ filter$ = this.filterSubject.asObservable();
2231
+ updateFilter(filterValue) {
2232
+ this.filterSubject.next(filterValue);
2233
+ }
2234
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2235
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, providedIn: "root" });
2236
+ }
2237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFilterTablePaginatedService, decorators: [{
2238
+ type: Injectable,
2239
+ args: [{
2240
+ providedIn: "root",
2241
+ }]
2242
+ }] });
2243
+
2244
+ class BasePaginationService {
2245
+ pageSubject = new BehaviorSubject(1);
2246
+ pageSizeSubject = new BehaviorSubject(10);
2247
+ totalItemsSubject = new BehaviorSubject(0);
2248
+ currentPage$ = this.pageSubject.asObservable();
2249
+ pageSize$ = this.pageSizeSubject.asObservable();
2250
+ totalItems$ = this.totalItemsSubject.asObservable();
2251
+ constructor() { }
2252
+ /**
2253
+ * Sets the current page number
2254
+ * @param page The page number to set
2255
+ */
2256
+ setPage(page) {
2257
+ if (page !== this.pageSubject.value) {
2258
+ this.pageSubject.next(page);
2259
+ }
2260
+ }
2261
+ /**
2262
+ * Sets the page size
2263
+ * @param size The page size to set
2264
+ */
2265
+ setPageSize(size) {
2266
+ if (size !== this.pageSizeSubject.value) {
2267
+ this.pageSizeSubject.next(size);
2268
+ }
2316
2269
  }
2317
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlert, deps: [], target: i0.ɵɵFactoryTarget.Component });
2318
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseAlert, isStandalone: true, selector: "cao-alert", ngImport: i0, template: "<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [ngSrc]=\"data.alertIcon ?? ''\" [fill]=\"true\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\">\n @if (data.title) {\n <div class=\"title\" [ngClass]=\"titleClass\">{{ data.title }}</div>\n } @if (data.title && data.message) {\n <div class=\"message-spacer\"></div>\n } @if (data.message) {\n <div class=\"message\">{{ data.message }}</div>\n }\n </div>\n <div class=\"icon-container\">\n <img alt=\"Alert Icon\" class=\"alert-icon\" [ngSrc]=\"iconPath\" [fill]=\"true\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:10%;left:55%;transform:translate(-50%);z-index:1000;display:block;animation:slide-in .3s ease-out}@keyframes slide-in{0%{opacity:0;transform:translate(-50%,-20px)}to{opacity:1;transform:translate(-50%)}}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white)}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.text-content{flex-grow:1;margin:20px;padding-right:20px}.title{font-family:Lato,sans-serif;font-weight:700;font-size:24px;color:var(--primary);margin-bottom:5px}.title.success{color:var(--primary)}.title.error{color:var(--error-color)}.title.warning{color:var(--support-orange)}.title.info,.title.title-success{color:var(--primary)}.title.title-error{color:var(--error)}.title.title-warning{color:var(--support-orange)}.title.title-info{color:var(--primary)}.message-spacer{height:16px}.message{font-family:Lato,sans-serif;font-weight:400;font-size:26px;line-height:100%;color:var(--message-color)}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){:host{left:55%;max-width:95%}.dialog-container{max-width:90%;width:400px}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2319
- }
2320
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlert, decorators: [{
2321
- type: Component,
2322
- args: [{ selector: 'cao-alert', imports: [CommonModule, NgOptimizedImage], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [ngSrc]=\"data.alertIcon ?? ''\" [fill]=\"true\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\">\n @if (data.title) {\n <div class=\"title\" [ngClass]=\"titleClass\">{{ data.title }}</div>\n } @if (data.title && data.message) {\n <div class=\"message-spacer\"></div>\n } @if (data.message) {\n <div class=\"message\">{{ data.message }}</div>\n }\n </div>\n <div class=\"icon-container\">\n <img alt=\"Alert Icon\" class=\"alert-icon\" [ngSrc]=\"iconPath\" [fill]=\"true\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:10%;left:55%;transform:translate(-50%);z-index:1000;display:block;animation:slide-in .3s ease-out}@keyframes slide-in{0%{opacity:0;transform:translate(-50%,-20px)}to{opacity:1;transform:translate(-50%)}}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white)}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.text-content{flex-grow:1;margin:20px;padding-right:20px}.title{font-family:Lato,sans-serif;font-weight:700;font-size:24px;color:var(--primary);margin-bottom:5px}.title.success{color:var(--primary)}.title.error{color:var(--error-color)}.title.warning{color:var(--support-orange)}.title.info,.title.title-success{color:var(--primary)}.title.title-error{color:var(--error)}.title.title-warning{color:var(--support-orange)}.title.title-info{color:var(--primary)}.message-spacer{height:16px}.message{font-family:Lato,sans-serif;font-weight:400;font-size:26px;line-height:100%;color:var(--message-color)}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){:host{left:55%;max-width:95%}.dialog-container{max-width:90%;width:400px}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}}\n"] }]
2323
- }] });
2324
-
2325
- class BaseAlertService {
2326
- overlay;
2327
- constructor(overlay) {
2328
- this.overlay = overlay;
2270
+ /**
2271
+ * Sets the total number of items
2272
+ * @param total The total number of items
2273
+ */
2274
+ setTotalItems(total) {
2275
+ if (total !== this.totalItemsSubject.value) {
2276
+ this.totalItemsSubject.next(total);
2277
+ }
2329
2278
  }
2330
- defaultTime = 3000;
2331
- show(config) {
2332
- const overlayRef = this.overlay.create({
2333
- hasBackdrop: false,
2334
- positionStrategy: this.overlay.position().global().centerHorizontally().top("10%"),
2335
- scrollStrategy: this.overlay.scrollStrategies.block(),
2336
- });
2337
- const alertPortal = new ComponentPortal(this.generateComponentPortal());
2338
- const componentRef = overlayRef.attach(alertPortal);
2339
- componentRef.instance.data = config;
2340
- setTimeout(() => {
2341
- overlayRef.dispose();
2342
- }, this.defaultTime);
2279
+ /**
2280
+ * Gets the current page
2281
+ */
2282
+ getCurrentPage() {
2283
+ return this.pageSubject.value;
2343
2284
  }
2344
- generateComponentPortal() {
2345
- return BaseAlert;
2285
+ /**
2286
+ * Gets the current page size
2287
+ */
2288
+ getPageSize() {
2289
+ return this.pageSizeSubject.value;
2346
2290
  }
2347
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, deps: [{ token: i1$4.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
2348
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, providedIn: "root" });
2291
+ /**
2292
+ * Gets the total number of items
2293
+ */
2294
+ getTotalItems() {
2295
+ return this.totalItemsSubject.value;
2296
+ }
2297
+ /**
2298
+ * Resets pagination to default values
2299
+ */
2300
+ reset() {
2301
+ this.pageSubject.next(1);
2302
+ this.pageSizeSubject.next(10);
2303
+ this.totalItemsSubject.next(0);
2304
+ }
2305
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2306
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, providedIn: "root" });
2349
2307
  }
2350
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, decorators: [{
2308
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BasePaginationService, decorators: [{
2351
2309
  type: Injectable,
2352
2310
  args: [{
2353
2311
  providedIn: "root",
2354
2312
  }]
2355
- }], ctorParameters: () => [{ type: i1$4.Overlay }] });
2356
-
2357
- class StepComponent {
2358
- title = "";
2359
- isActive = false;
2360
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2361
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: StepComponent, isStandalone: true, selector: "cao-step", inputs: { title: "title", isActive: "isActive" }, ngImport: i0, template: "<div class=\"step d-flex aic jcc\" [ngClass]=\"{'active': isActive}\"> {{ title }} </div>\n", styles: [".step{width:44px;height:44px;border-radius:100%;font-size:18px;font-weight:700}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
2362
- }
2363
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepComponent, decorators: [{
2364
- type: Component,
2365
- args: [{ selector: "cao-step", standalone: true, imports: [CommonModule], template: "<div class=\"step d-flex aic jcc\" [ngClass]=\"{'active': isActive}\"> {{ title }} </div>\n", styles: [".step{width:44px;height:44px;border-radius:100%;font-size:18px;font-weight:700}\n"] }]
2366
- }], propDecorators: { title: [{
2367
- type: Input
2368
- }], isActive: [{
2369
- type: Input
2370
- }] } });
2313
+ }], ctorParameters: () => [] });
2371
2314
 
2372
- class StepperComponent {
2373
- constructor() { }
2374
- steps;
2375
- title;
2376
- activeStepIndex = 0;
2377
- lengthStep = 0;
2378
- showLine = true;
2379
- maxReachedEvent = new EventEmitter();
2380
- ngAfterContentInit() {
2381
- if (this.steps.length > 0) {
2382
- this.steps.toArray()[0].isActive = true;
2383
- this.lengthStep = this.steps.length;
2315
+ class TablePaginatedService {
2316
+ tableConfigSubject = new BehaviorSubject(null);
2317
+ dataSubject = new BehaviorSubject([]);
2318
+ columnsSubject = new BehaviorSubject([]);
2319
+ tableConfig$ = this.tableConfigSubject.asObservable();
2320
+ columns$ = this.columnsSubject.asObservable();
2321
+ data$ = this.dataSubject.asObservable();
2322
+ visibleColumns$ = this.columns$.pipe(map((columns) => columns.filter((col) => col.visible).map((col) => col.key || col.element || "")));
2323
+ createTable(data, columns, customConfig) {
2324
+ const tableConfig = {
2325
+ columns: columns ? columns.map((col) => col.key || col.element || "") : [],
2326
+ data,
2327
+ columnData: {},
2328
+ result: {
2329
+ noData: "Não há dados para o filtro selecionado.",
2330
+ defaultMessage: "Nenhum resultado encontrado.",
2331
+ },
2332
+ ...customConfig,
2333
+ };
2334
+ if (data.length > 0 && columns) {
2335
+ const columnData = {};
2336
+ columns.forEach((col) => {
2337
+ columnData[col.key || col.element || ""] = {
2338
+ ...col,
2339
+ type: col.type || this.inferColumnType(data[0][col.key || col.element || ""]),
2340
+ visible: col.visible !== undefined ? col.visible : true,
2341
+ };
2342
+ });
2343
+ tableConfig.columnData = columnData;
2344
+ }
2345
+ else if (data.length === 0 && columns) {
2346
+ const columnData = {};
2347
+ columns.forEach((col) => {
2348
+ columnData[col.key || col.element || ""] = {
2349
+ ...col,
2350
+ type: col.type || "STRING",
2351
+ visible: col.visible !== undefined ? col.visible : true,
2352
+ };
2353
+ });
2354
+ tableConfig.columnData = columnData;
2384
2355
  }
2356
+ this.tableConfigSubject.next(tableConfig);
2357
+ this.columnsSubject.next(columns || []);
2358
+ this.dataSubject.next(data);
2385
2359
  }
2386
- nextStep() {
2387
- if (this.steps.length > 0) {
2388
- if (this.activeStepIndex < this.steps.length - 1) {
2389
- this.activeStepIndex++;
2390
- this.steps.toArray()[this.activeStepIndex].isActive = true;
2391
- }
2392
- else {
2393
- this.maxReachedEvent.emit(null);
2394
- }
2360
+ inferColumnType(value) {
2361
+ if (value === null || value === undefined) {
2362
+ return "STRING";
2363
+ }
2364
+ switch (typeof value) {
2365
+ case "boolean":
2366
+ return "BOOLEAN";
2367
+ case "number":
2368
+ return "NUMBER";
2369
+ case "string":
2370
+ return this.isValidDate(value) ? "DATE" : "STRING";
2371
+ default:
2372
+ return "STRING";
2395
2373
  }
2396
2374
  }
2397
- prevStep() {
2398
- if (this.steps.length > 0) {
2399
- if (this.activeStepIndex > 0) {
2400
- this.steps.toArray()[this.activeStepIndex].isActive = false;
2401
- this.activeStepIndex--;
2402
- this.steps.toArray()[this.activeStepIndex].isActive = true;
2375
+ isValidDate(value) {
2376
+ return !isNaN(Date.parse(value));
2377
+ }
2378
+ toggleColumnVisibility(columnKey) {
2379
+ const currentColumns = this.columnsSubject.value;
2380
+ const updatedColumns = currentColumns.map((col) => col.key === columnKey || col.element === columnKey ? { ...col, visible: !col.visible } : col);
2381
+ const currentConfig = this.tableConfigSubject.value;
2382
+ if (currentConfig) {
2383
+ const updatedColumnData = { ...currentConfig.columnData };
2384
+ const columnToUpdate = Object.keys(updatedColumnData).find((key) => key === columnKey);
2385
+ if (columnToUpdate) {
2386
+ updatedColumnData[columnToUpdate].visible = !updatedColumnData[columnToUpdate].visible;
2387
+ this.tableConfigSubject.next({
2388
+ ...currentConfig,
2389
+ columnData: updatedColumnData,
2390
+ });
2403
2391
  }
2404
2392
  }
2393
+ this.columnsSubject.next(updatedColumns);
2405
2394
  }
2406
- resetStepper() {
2407
- this.activeStepIndex = 0;
2408
- this.steps.forEach((step) => (step.isActive = false));
2409
- if (this.steps.length > 0) {
2410
- this.steps.toArray()[0].isActive = true;
2395
+ getVisibleColumns() {
2396
+ return this.columnsSubject.value.filter((col) => col.visible);
2397
+ }
2398
+ setColumns(columns) {
2399
+ const currentConfig = this.tableConfigSubject.value;
2400
+ if (currentConfig) {
2401
+ const columnData = {};
2402
+ columns.forEach((col) => {
2403
+ columnData[col.key || col.element || ""] = col;
2404
+ });
2405
+ this.tableConfigSubject.next({
2406
+ ...currentConfig,
2407
+ columns: columns.map((col) => col.key || col.element || ""),
2408
+ columnData,
2409
+ });
2411
2410
  }
2411
+ this.columnsSubject.next(columns);
2412
2412
  }
2413
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2414
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: StepperComponent, isStandalone: true, selector: "cao-stepper", inputs: { title: "title" }, outputs: { maxReachedEvent: "maxReachedEvent" }, queries: [{ propertyName: "steps", predicate: StepComponent }], ngImport: i0, template: "@if(title){\n<h3 class=\"stepper-title\">{{ title }}</h3>\n}\n<div class=\"d-flex step-container aic jcsb\">\n @if (showLine) {\n <div class=\"line\"></div>\n }\n <div class=\"steps d-flex aic jcsb\">\n <ng-content />\n </div>\n</div>\n", styles: [".step-container{position:relative}.steps{z-index:2;gap:24px}.line{width:100%;position:absolute;top:50%;height:1.5px;background-color:var(--return-color);z-index:1}\n"] });
2415
- }
2416
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: StepperComponent, decorators: [{
2417
- type: Component,
2418
- args: [{ selector: "cao-stepper", standalone: true, template: "@if(title){\n<h3 class=\"stepper-title\">{{ title }}</h3>\n}\n<div class=\"d-flex step-container aic jcsb\">\n @if (showLine) {\n <div class=\"line\"></div>\n }\n <div class=\"steps d-flex aic jcsb\">\n <ng-content />\n </div>\n</div>\n", styles: [".step-container{position:relative}.steps{z-index:2;gap:24px}.line{width:100%;position:absolute;top:50%;height:1.5px;background-color:var(--return-color);z-index:1}\n"] }]
2419
- }], ctorParameters: () => [], propDecorators: { steps: [{
2420
- type: ContentChildren,
2421
- args: [StepComponent]
2422
- }], title: [{
2423
- type: Input
2424
- }], maxReachedEvent: [{
2425
- type: Output
2426
- }] } });
2427
-
2428
- class CaoTabContentDirective {
2429
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2430
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabContentDirective, isStandalone: true, selector: "[caoTabContent]", ngImport: i0 });
2431
- }
2432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabContentDirective, decorators: [{
2433
- type: Directive,
2434
- args: [{
2435
- selector: '[caoTabContent]',
2436
- standalone: true,
2437
- }]
2438
- }] });
2439
-
2440
- class CaoTabLabelDirective {
2441
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2442
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabLabelDirective, isStandalone: true, selector: "[caoTabLabel]", ngImport: i0 });
2413
+ setData(data) {
2414
+ this.dataSubject.next(data);
2415
+ const currentConfig = this.tableConfigSubject.value;
2416
+ if (currentConfig) {
2417
+ this.tableConfigSubject.next({
2418
+ ...currentConfig,
2419
+ data,
2420
+ });
2421
+ }
2422
+ }
2423
+ updateTableData(data) {
2424
+ this.setData(data);
2425
+ }
2426
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2427
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, providedIn: "root" });
2443
2428
  }
2444
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabLabelDirective, decorators: [{
2445
- type: Directive,
2429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TablePaginatedService, decorators: [{
2430
+ type: Injectable,
2446
2431
  args: [{
2447
- selector: '[caoTabLabel]',
2448
- standalone: true,
2432
+ providedIn: "root",
2449
2433
  }]
2450
2434
  }] });
2451
2435
 
2452
- class CaoTabPanel {
2453
- label = '';
2454
- isLucideIcon = true;
2455
- trailingIcon = null;
2456
- leadingIcon = null;
2457
- isDisabled = false;
2458
- labelTemplate;
2459
- lazyContent;
2460
- content;
2461
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
2462
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: CaoTabPanel, isStandalone: true, selector: "cao-tab-panel", inputs: { label: "label", isLucideIcon: "isLucideIcon", trailingIcon: "trailingIcon", leadingIcon: "leadingIcon", isDisabled: "isDisabled" }, queries: [{ propertyName: "labelTemplate", first: true, predicate: CaoTabLabelDirective, descendants: true, read: TemplateRef }, { propertyName: "lazyContent", first: true, predicate: CaoTabContentDirective, descendants: true, read: TemplateRef }], viewQueries: [{ propertyName: "content", first: true, predicate: ["implicitContent"], descendants: true, static: true }], ngImport: i0, template: `
2463
- <ng-template #implicitContent>
2464
- <ng-content />
2465
- </ng-template>
2466
- `, isInline: true, styles: [""] });
2436
+ function getPtBrPaginatorIntlBasePaginated() {
2437
+ const paginatorIntl = new MatPaginatorIntl();
2438
+ paginatorIntl.itemsPerPageLabel = "Itens por página:";
2439
+ paginatorIntl.nextPageLabel = "Próxima página";
2440
+ paginatorIntl.previousPageLabel = "Página anterior";
2441
+ paginatorIntl.firstPageLabel = "Primeira página";
2442
+ paginatorIntl.lastPageLabel = "Última página";
2443
+ paginatorIntl.getRangeLabel = (page, pageSize, length) => {
2444
+ if (length === 0 || pageSize === 0) {
2445
+ return `0 de ${length}`;
2446
+ }
2447
+ const startIndex = page * pageSize;
2448
+ const endIndex = Math.min(startIndex + pageSize, length);
2449
+ return `${startIndex + 1} – ${endIndex} de ${length}`;
2450
+ };
2451
+ return paginatorIntl;
2467
2452
  }
2468
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabPanel, decorators: [{
2469
- type: Component,
2470
- args: [{ selector: "cao-tab-panel", imports: [], template: `
2471
- <ng-template #implicitContent>
2472
- <ng-content />
2473
- </ng-template>
2474
- ` }]
2475
- }], propDecorators: { label: [{
2476
- type: Input
2477
- }], isLucideIcon: [{
2478
- type: Input
2479
- }], trailingIcon: [{
2480
- type: Input
2481
- }], leadingIcon: [{
2482
- type: Input
2483
- }], isDisabled: [{
2484
- type: Input
2485
- }], labelTemplate: [{
2486
- type: ContentChild,
2487
- args: [CaoTabLabelDirective, { read: TemplateRef }]
2488
- }], lazyContent: [{
2489
- type: ContentChild,
2490
- args: [CaoTabContentDirective, { read: TemplateRef }]
2491
- }], content: [{
2492
- type: ViewChild,
2493
- args: ['implicitContent', { static: true }]
2494
- }] } });
2495
-
2496
- class CaoTabGroup {
2497
- get _hostStyles() {
2498
- return {
2499
- '--cao-tab-label-height': this.labelHeight,
2500
- '--cao-tab-label-px': this.labelPaddingX,
2501
- '--cao-tab-label-gap': this.labelGap,
2502
- '--cao-tab-color-text': this.colorText,
2503
- '--cao-tab-color-active': this.colorActive,
2504
- '--cao-tab-color-hover-bg': this.colorHoverBg,
2505
- '--cao-tab-color-disabled': this.colorDisabled,
2506
- '--cao-tab-color-ink-bar': this.colorInkBar,
2507
- '--cao-tab-color-header-border': this.colorHeaderBorder,
2508
- '--cao-tab-ink-bar-height': this.inkBarHeight,
2509
- '--cao-tab-content-pt': this.contentPaddingTop,
2510
- '--cao-tab-radius': this.labelRadius,
2511
- };
2512
- }
2513
- set selectedIndex(val) {
2514
- this.selectIndex(val, false);
2453
+ class BaseTablePaginated {
2454
+ paginationSubscriptions = [];
2455
+ getColumnCssClass;
2456
+ customClass = "";
2457
+ pageSizeOptions = [5, 10, 20, 50];
2458
+ showFirstLastButtons = true;
2459
+ pageChanged = new EventEmitter();
2460
+ pageSizeChanged = new EventEmitter();
2461
+ firstPageClicked = new EventEmitter();
2462
+ lastPageClicked = new EventEmitter();
2463
+ selectionChanged = new EventEmitter();
2464
+ pageEvent = new EventEmitter();
2465
+ rowClicked = new EventEmitter();
2466
+ dataSource = new MatTableDataSource([]);
2467
+ selection = new SelectionModel(true, []);
2468
+ allColumns = [];
2469
+ displayedColumns = [];
2470
+ filterValue = "";
2471
+ configSubscription = null;
2472
+ visibleColumnsSubscription = null;
2473
+ dataSubscription = null;
2474
+ filterSubscription = null;
2475
+ tableConfig = null;
2476
+ sort;
2477
+ paginator;
2478
+ totalItems = 0;
2479
+ pageSize = 10;
2480
+ currentPage = 1;
2481
+ previousPage = 1;
2482
+ paginationService = inject(BasePaginationService);
2483
+ tableService = inject(TablePaginatedService);
2484
+ liveAnnouncer = inject(LiveAnnouncer);
2485
+ filterTableService = inject(BaseFilterTablePaginatedService);
2486
+ constructor() {
2487
+ this.initializeSortingAccessor();
2488
+ this.initializeFilterPredicate();
2515
2489
  }
2516
- get selectedIndex() {
2517
- return this.activeIndex();
2490
+ onPageChanged(page) {
2491
+ this.currentPage = page;
2492
+ this.pageChanged.emit(page);
2493
+ if (this.paginator && this.paginator.pageIndex !== page - 1) {
2494
+ this.paginator.pageIndex = page - 1;
2495
+ }
2518
2496
  }
2519
- labelHeight = '48px';
2520
- labelPaddingX = '16px';
2521
- labelGap = '6px';
2522
- colorText = '#6b7280';
2523
- colorActive = '#4f46e5';
2524
- colorHoverBg = '#f3f4f6';
2525
- colorDisabled = '#d1d5db';
2526
- colorInkBar = '#4f46e5';
2527
- colorHeaderBorder = '#e5e7eb';
2528
- inkBarHeight = '2px';
2529
- contentPaddingTop = '20px';
2530
- labelRadius = '4px';
2531
- animationDuration = '300ms';
2532
- dynamicHeight = false;
2533
- labelAlign = 'start';
2534
- iconColorActive = '';
2535
- iconColorInactive = '';
2536
- strokeWidthIcon = 1;
2537
- selectedTabChange = new EventEmitter();
2538
- focusChange = new EventEmitter();
2539
- tabs;
2540
- tabBtns;
2541
- inkBar;
2542
- activeIndex = signal(0, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
2543
- activatedSet = new Set();
2544
- tabList = [];
2545
- subs = new Subscription();
2546
- isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
2547
- ngAfterContentInit() {
2548
- this.tabList = this.tabs.toArray();
2549
- this.activatedSet.add(this.activeIndex());
2550
- this.subs.add(this.tabs.changes.subscribe(() => {
2551
- this.tabList = this.tabs.toArray();
2552
- const safe = Math.min(this.activeIndex(), this.tabList.length - 1);
2553
- this.activeIndex.set(Math.max(0, safe));
2554
- this.scheduleInkBar();
2497
+ ngOnInit() {
2498
+ this.configSubscription = this.tableService.tableConfig$.subscribe((config) => {
2499
+ if (config) {
2500
+ this.tableConfig = config;
2501
+ this.allColumns = config.columns;
2502
+ }
2503
+ });
2504
+ this.visibleColumnsSubscription = this.tableService.visibleColumns$.subscribe((visibleColumns) => {
2505
+ this.displayedColumns = visibleColumns.filter((col) => col !== "select");
2506
+ });
2507
+ this.dataSubscription = this.tableService.data$.subscribe((data) => {
2508
+ this.dataSource.data = data;
2509
+ this.updateTotalItems();
2510
+ });
2511
+ this.filterSubscription = this.filterTableService.filter$.subscribe((filterValue) => {
2512
+ this.filterValue = filterValue;
2513
+ this.applyFilter();
2514
+ });
2515
+ this.paginationSubscriptions.push(this.paginationService.currentPage$.subscribe((page) => {
2516
+ if (this.currentPage !== page) {
2517
+ this.onPageChanged(page);
2518
+ }
2519
+ }), this.paginationService.pageSize$.subscribe((size) => {
2520
+ if (this.pageSize !== size) {
2521
+ this.onPageSizeChanged(size);
2522
+ }
2555
2523
  }));
2556
- this.scheduleInkBar();
2557
2524
  }
2558
2525
  ngOnDestroy() {
2559
- this.subs.unsubscribe();
2560
- }
2561
- selectTab(index) {
2562
- this.selectIndex(index, true);
2563
- }
2564
- get activeTab() {
2565
- return this.tabList[this.activeIndex()] ?? null;
2566
- }
2567
- isActive(index) {
2568
- return this.activeIndex() === index;
2569
- }
2570
- wasActivated(index) {
2571
- return this.activatedSet.has(index);
2526
+ this.configSubscription?.unsubscribe();
2527
+ this.visibleColumnsSubscription?.unsubscribe();
2528
+ this.dataSubscription?.unsubscribe();
2529
+ this.filterSubscription?.unsubscribe();
2530
+ this.paginationSubscriptions.forEach((sub) => sub.unsubscribe());
2572
2531
  }
2573
- onTabClick(index) {
2574
- if (this.tabList[index]?.isDisabled) {
2575
- return;
2532
+ updateTotalItems(newTotalItens) {
2533
+ this.totalItems = newTotalItens ?? this.totalItems;
2534
+ this.paginationService.setTotalItems(this.totalItems);
2535
+ const lastPage = this.pageSize > 0 ? Math.ceil(this.totalItems / this.pageSize) : 1;
2536
+ const lastValidPage = lastPage > 0 ? lastPage : 1;
2537
+ if (this.currentPage > lastValidPage) {
2538
+ this.paginationService.setPage(1);
2576
2539
  }
2577
- this.selectIndex(index, true);
2578
2540
  }
2579
- onKeydown(event, currentIndex) {
2580
- let next = currentIndex;
2581
- switch (event.key) {
2582
- case 'ArrowRight':
2583
- next = this.nextEnabled(currentIndex, 1);
2584
- break;
2585
- case 'ArrowLeft':
2586
- next = this.nextEnabled(currentIndex, -1);
2587
- break;
2588
- case 'Home':
2589
- next = this.nextEnabled(-1, 1);
2590
- break;
2591
- case 'End':
2592
- next = this.nextEnabled(this.tabList.length, -1);
2593
- break;
2594
- default: return;
2541
+ onPageSizeChanged(pageSize) {
2542
+ this.pageSize = pageSize;
2543
+ this.pageSizeChanged.emit(pageSize);
2544
+ if (this.paginator && this.paginator.pageSize !== pageSize) {
2545
+ this.paginator.pageSize = pageSize;
2595
2546
  }
2596
- event.preventDefault();
2597
- this.selectIndex(next, true);
2598
- this.focusTab(next);
2599
2547
  }
2600
- onFocus(index) {
2601
- this.focusChange.emit(index);
2548
+ getColumnHeader(column) {
2549
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2550
+ return column;
2551
+ }
2552
+ return this.tableConfig.columnData[column].header || column;
2602
2553
  }
2603
- nextEnabled(from, dir) {
2604
- const tabs = this.tabList;
2605
- let idx = from + dir;
2606
- while (idx >= 0 && idx < tabs.length) {
2607
- if (!tabs[idx].isDisabled) {
2608
- return idx;
2609
- }
2610
- idx += dir;
2554
+ getColumnElement(column) {
2555
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2556
+ return column;
2611
2557
  }
2612
- return from;
2558
+ return this.tableConfig.columnData[column].element || column;
2613
2559
  }
2614
- selectIndex(index, emit) {
2615
- if (!this.tabList) {
2616
- this.activeIndex.set(Math.max(0, index));
2617
- return;
2560
+ getColumnType(column) {
2561
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2562
+ return "STRING";
2618
2563
  }
2619
- const clamped = Math.max(0, Math.min(index, this.tabList.length - 1));
2620
- const previous = this.activeIndex();
2621
- if (clamped === previous && emit) {
2622
- return;
2564
+ return this.tableConfig.columnData[column].type || "STRING";
2565
+ }
2566
+ announceSortChange(sortState) {
2567
+ if (sortState.direction) {
2568
+ this.liveAnnouncer.announce(`Ordenado ${sortState.direction === "asc" ? "ascendente" : "descendente"}`);
2623
2569
  }
2624
- this.activeIndex.set(clamped);
2625
- this.activatedSet.add(clamped);
2626
- if (emit) {
2627
- this.selectedTabChange.emit({
2628
- previousIndex: previous,
2629
- index: clamped,
2630
- tab: this.tabList[clamped],
2631
- });
2570
+ else {
2571
+ this.liveAnnouncer.announce("Ordenação removida");
2632
2572
  }
2633
- this.scheduleInkBar();
2634
2573
  }
2635
- focusTab(index) {
2636
- this.tabBtns?.toArray()[index]?.nativeElement?.focus();
2574
+ handlePageChange(event) {
2575
+ this.pageSize = event.pageSize;
2576
+ this.paginationService.setPageSize(event.pageSize);
2577
+ this.pageChanged.emit(event.pageIndex);
2637
2578
  }
2638
- scheduleInkBar() {
2639
- if (!this.isBrowser) {
2640
- return;
2641
- }
2642
- requestAnimationFrame(() => this.updateInkBar());
2579
+ applyFilter() {
2580
+ const normalizedFilter = this.filterValue.trim().toLowerCase();
2581
+ this.dataSource.filter = normalizedFilter;
2643
2582
  }
2644
- updateInkBar() {
2645
- const btns = this.tabBtns?.toArray();
2646
- const bar = this.inkBar?.nativeElement;
2647
- if (!btns || !bar) {
2648
- return;
2583
+ initializeSortingAccessor() {
2584
+ this.dataSource.sortingDataAccessor = (item, property) => {
2585
+ const value = item[property];
2586
+ if (typeof value === "string") {
2587
+ return value.toLowerCase();
2588
+ }
2589
+ else if (typeof value === "number") {
2590
+ return value;
2591
+ }
2592
+ else if (typeof value === "boolean") {
2593
+ return value ? 1 : 0;
2594
+ }
2595
+ else if (value instanceof Date) {
2596
+ return value.valueOf();
2597
+ }
2598
+ else if (value === null) {
2599
+ return "";
2600
+ }
2601
+ else if (value === undefined) {
2602
+ return undefined;
2603
+ }
2604
+ else if (typeof value === "object") {
2605
+ return value.toString();
2606
+ }
2607
+ return value;
2608
+ };
2609
+ }
2610
+ initializeFilterPredicate() {
2611
+ this.dataSource.filterPredicate = (data, filter) => {
2612
+ const searchTerms = filter.trim().toLowerCase();
2613
+ if (!searchTerms) {
2614
+ return true;
2615
+ }
2616
+ const dataStr = Object.keys(data).reduce((currentTerm, key) => {
2617
+ const value = data[key];
2618
+ return (currentTerm +
2619
+ (value !== null && value !== undefined ? value.toString().toLowerCase() : ""));
2620
+ }, "");
2621
+ return dataStr.indexOf(searchTerms) !== -1;
2622
+ };
2623
+ }
2624
+ onRowClick(row) {
2625
+ this.rowClicked.emit(row);
2626
+ }
2627
+ onPageEvent(event) {
2628
+ const newPage = event.pageIndex + 1;
2629
+ const isFirstPage = newPage === 1 && this.previousPage !== 1;
2630
+ const isLastPage = newPage === Math.ceil(this.totalItems / event.pageSize) && newPage !== this.previousPage;
2631
+ // Handle page size changes
2632
+ if (event.pageSize !== this.pageSize) {
2633
+ this.onPageSizeChanged(event.pageSize);
2649
2634
  }
2650
- const btn = btns[this.activeIndex()]?.nativeElement;
2651
- if (!btn) {
2652
- return;
2635
+ // Handle page changes
2636
+ if (newPage !== this.currentPage) {
2637
+ this.previousPage = this.currentPage; // Store previous page for first/last detection
2638
+ this.onPageChanged(newPage);
2639
+ // Emit specific events for first/last page navigation
2640
+ if (isFirstPage) {
2641
+ this.firstPageClicked.emit();
2642
+ this.liveAnnouncer.announce("Primeira página");
2643
+ }
2644
+ else if (isLastPage) {
2645
+ this.lastPageClicked.emit();
2646
+ this.liveAnnouncer.announce("Última página");
2647
+ }
2653
2648
  }
2654
- bar.style.width = `${btn.offsetWidth}px`;
2655
- bar.style.transform = `translateX(${btn.offsetLeft}px)`;
2656
- bar.style.transitionDuration = this.animationDuration;
2649
+ this.pageEvent.emit(event);
2657
2650
  }
2658
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
2659
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: CaoTabGroup, isStandalone: true, selector: "cao-tab-group", inputs: { selectedIndex: "selectedIndex", labelHeight: "labelHeight", labelPaddingX: "labelPaddingX", labelGap: "labelGap", colorText: "colorText", colorActive: "colorActive", colorHoverBg: "colorHoverBg", colorDisabled: "colorDisabled", colorInkBar: "colorInkBar", colorHeaderBorder: "colorHeaderBorder", inkBarHeight: "inkBarHeight", contentPaddingTop: "contentPaddingTop", labelRadius: "labelRadius", animationDuration: "animationDuration", dynamicHeight: "dynamicHeight", labelAlign: "labelAlign", iconColorActive: "iconColorActive", iconColorInactive: "iconColorInactive", strokeWidthIcon: "strokeWidthIcon" }, outputs: { selectedTabChange: "selectedTabChange", focusChange: "focusChange" }, host: { properties: { "style": "this._hostStyles" }, classAttribute: "cao-tab-group" }, queries: [{ propertyName: "tabs", predicate: CaoTabPanel }], viewQueries: [{ propertyName: "inkBar", first: true, predicate: ["inkBar"], descendants: true }, { propertyName: "tabBtns", predicate: ["tabBtn"], descendants: true }], ngImport: i0, template: "<div\n #header\n [class]=\"'cao-tab-header cao-tab-header--align-' + labelAlign\"\n>\n <div class=\"cao-tab-label-list\" role=\"tablist\">\n @for (tab of tabList; track $index; let i = $index) {\n <button\n #tabBtn\n role=\"tab\"\n type=\"button\"\n class=\"cao-tab-label\"\n [class.cao-tab-label--active]=\"isActive(i)\"\n [class.cao-tab-label--disabled]=\"tab.isDisabled\"\n [attr.aria-selected]=\"isActive(i)\"\n [attr.aria-disabled]=\"tab.isDisabled || null\"\n [attr.tabindex]=\"isActive(i) ? 0 : -1\"\n [attr.id]=\"'cao-tab-label-' + i\"\n [attr.aria-controls]=\"'cao-tab-content-' + i\"\n (click)=\"onTabClick(i)\"\n (keydown)=\"onKeydown($event, i)\"\n (focus)=\"onFocus(i)\"\n >\n @if (tab.leadingIcon) {\n <span class=\"leading-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.leadingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.leadingIcon\" />\n }\n </span>\n }\n\n @if (tab.labelTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.labelTemplate\" />\n } @else {\n <span class=\"cao-tab-labeltext\">{{ tab.label }}</span>\n }\n\n @if (tab.trailingIcon) {\n <span class=\"trailing-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.trailingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.trailingIcon\" />\n }\n </span>\n }\n </button>\n }\n </div>\n\n <!-- Ink bar animado -->\n <div class=\"cao-tab-ink-bar-track\">\n <div #inkBar class=\"cao-tab-ink-bar\"></div>\n </div>\n</div>\n\n<!-- \u2550\u2550\u2550 Tab Bodies \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div\n class=\"cao-tab-body-wrapper\"\n [class.cao-tab-body-wrapper--dynamic]=\"dynamicHeight\"\n>\n @for (tab of tabList; track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n class=\"cao-tab-body\"\n [class.cao-tab-body--active]=\"isActive(i)\"\n [attr.id]=\"'cao-tab-content-' + i\"\n [attr.aria-labelledby]=\"'cao-tab-label-' + i\"\n [attr.aria-hidden]=\"!isActive(i)\"\n [style.--cao-tab-anim-duration]=\"animationDuration\"\n >\n <div class=\"cao-tab-bodycontent\">\n @if (tab.lazyContent) {\n @if (isActive(i) || wasActivated(i)) {\n <ng-container [ngTemplateOutlet]=\"tab.lazyContent\" />\n }\n } @else {\n <ng-container [ngTemplateOutlet]=\"tab.content\" />\n }\n </div>\n </div>\n }\n</div>", styles: [":host{--cao-tab-font-family: inherit;--cao-tab-font-size: .875rem;--cao-tab-font-weight: 500;--cao-tab-label-height: 48px;--cao-tab-Label-px: 16px;--cao-tab-Label-gap: 6px;--cao-tab-color-text: #6b7280;--cao-tab-color-active: #4f46e5;--cao-tab-color-hover-bg: #f3f4f6;--cao-tab-color-disabled: #d1d5db;--cao-tab-color-ink-bar: #4f46e5;--cao-tab-color-header-border: #e5e7eb;--cao-tab-ink-bar-height: 2px;--cao-tab-content-pt: 20px;--cao-tab-radius: 4px;display:flex;flex-direction:column;width:100%}.cao-tab-header{position:relative;border-bottom:1px solid var(--cao-tab-color-header-border);overflow-x:auto;scrollbar-width:none}.cao-tab-header::-webkit-scrollbar{display:none}.cao-tab-label-list{display:flex;align-items:center;min-width:max-content}.cao-tab-header--align-center .cao-tab-label-list{justify-content:center}.cao-tab-header--align-end .cao-tab-label-list{justify-content:flex-end}.cao-tab-header--align-start .cao-tab-label-list{justify-content:flex-start}.cao-tab-label{display:inline-flex;align-items:center;gap:var(--cao-tab-label-gap);height:var(--cao-tab-label-height);padding:0 var(--cao-tab-label-px);font-family:var(--cao-tab-font-family);font-size:var(--cao-tab-font-size);font-weight:var(--cao-tab-font-weight);color:var(--cao-tab-color-text);white-space:nowrap;background:transparent;border:none;border-radius:var(--cao-tab-radius) var(--cao-tab-radius) 0 0;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .18s ease,background-color .18s ease;outline:none}.cao-tab-label:focus-visible{outline:2px solid var(--cao-tab-color-active);outline-offset:-2px}.cao-tab-label:hover:not(.cao-tab-label--disabled){background-color:var(--cao-tab-color-hover-bg);color:var(--cao-tab-color-active)}.cao-tab-label--active{color:var(--cao-tab-color-active)}.cao-tab-label--disabled{color:var(--cao-tab-color-disabled);cursor:not-allowed;pointer-events:none}.cao-tab-label__icon{flex-shrink:0;color:inherit;transition:color .18s ease}.cao-tab-ink-bar-track{position:absolute;bottom:0;left:0;right:0;height:var(--cao-tab-ink-bar-height);pointer-events:none}.cao-tab-ink-bar{position:absolute;bottom:0;left:0;height:100%;background-color:var(--cao-tab-color-ink-bar);border-radius:2px 2px 0 0;transition-property:transform,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.cao-tab-body-wrapper{position:relative;overflow:hidden}.cao-tab-body-wrapper--dynamic{height:auto}.cao-tab-body{position:absolute;top:0;left:0;width:100%;visibility:hidden;opacity:0;pointer-events:none;transform:translate(24px);transition:opacity var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1),transform var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1)}.cao-tab-body--active{position:relative;visibility:visible;opacity:1;pointer-events:auto;transform:translate(0)}.cao-tab-body__content{padding-top:var(--cao-tab-content-pt)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }] });
2651
+ getColumnButtons(column) {
2652
+ if (!this.tableConfig || !this.tableConfig.columnData || !this.tableConfig.columnData[column]) {
2653
+ return [];
2654
+ }
2655
+ return this.tableConfig.columnData[column].buttons || [];
2656
+ }
2657
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTablePaginated, deps: [], target: i0.ɵɵFactoryTarget.Component });
2658
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseTablePaginated, isStandalone: true, selector: "cao-table-paginated", inputs: { getColumnCssClass: "getColumnCssClass", customClass: "customClass", pageSizeOptions: "pageSizeOptions", showFirstLastButtons: "showFirstLastButtons" }, outputs: { pageChanged: "pageChanged", pageSizeChanged: "pageSizeChanged", firstPageClicked: "firstPageClicked", lastPageClicked: "lastPageClicked", selectionChanged: "selectionChanged", pageEvent: "pageEvent", rowClicked: "rowClicked" }, providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBasePaginated() }], viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }], ngImport: i0, template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <table mat-table matSort [dataSource]=\"dataSource\" (matSortChange)=\"announceSortChange($event)\">\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell mat-sort-header class=\"table-header\">\n {{ getColumnHeader(column) }}\n </th>\n <td *matCellDef=\"let element\" mat-cell class=\"table-cell\">\n @switch (getColumnType(column)) { @case ('STRING') { @if (getColumnCssClass &&\n getColumnCssClass(column, element[getColumnElement(column)])) {\n <span [class]=\"getColumnCssClass(column, element[getColumnElement(column)])\">\n {{ element[getColumnElement(column)] }}\n </span>\n } @else {\n <span>{{ element[getColumnElement(column)] }}</span>\n } } @case ('BOOLEAN') {\n <mat-checkbox disabled [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button type=\"button\" mat-icon-button [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td\n *matFooterCellDef\n mat-footer-cell\n class=\"table-cell\"\n [attr.colspan]=\"displayedColumns.length\">\n Total de Registros: {{ totalItems }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" mat-row (click)=\"onRowClick(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row class=\"mat-row-footer\"></tr>\n </table>\n @if(totalItems > 0){\n\n <mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n } @else {\n <div class=\"no-data-container\">\n <h2>{{ tableConfig?.result?.noData ?? 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p>{{ tableConfig?.result?.defaultMessage ?? 'Adicione alguns dados' }}</p>\n </div>\n } }\n</div>\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;overflow:hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px;justify-content:center}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px;margin:0 auto}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none;text-align:center}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:100%}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--data-bg);font-weight:600;color:var(--message-color);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem;text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell .mat-sort-header-container{justify-content:center}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease;background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(2n){background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(odd){background-color:var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--border-table-ligth);color:var(--gray-dark);border-bottom:1px solid var(--input-background);text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin:0 auto;display:block}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--text-color)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:center}.table-container .no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;text-align:center;background-color:var(--table-background)}.table-container .no-data-container h2{color:var(--input-disabled-bg);margin-bottom:12px}.table-container .no-data-container p{color:var(--input-disabled-bg)}@media(width<=768px){.table-container .table-controls{flex-direction:column;align-items:center}.table-container .table-controls .filter-field{width:80%;margin-right:0;margin-bottom:12px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: MaterialModule }, { kind: "component", type: i2$2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i3$1.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i1$2.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "component", type: i7.MatSortHeader, selector: "[mat-sort-header]", inputs: ["mat-sort-header", "arrowPosition", "start", "disabled", "sortActionDescription", "disableClear"], exportAs: ["matSortHeader"] }, { kind: "component", type: i8.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i8.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i8.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i8.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i8.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i8.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i8.MatFooterCellDef, selector: "[matFooterCellDef]" }, { kind: "directive", type: i8.MatFooterRowDef, selector: "[matFooterRowDef]", inputs: ["matFooterRowDef", "matFooterRowDefSticky"] }, { kind: "directive", type: i8.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i8.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "directive", type: i8.MatFooterCell, selector: "mat-footer-cell, td[mat-footer-cell]" }, { kind: "component", type: i8.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i8.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i8.MatFooterRow, selector: "mat-footer-row, tr[mat-footer-row]", exportAs: ["matFooterRow"] }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.DatePipe, name: "date" }], encapsulation: i0.ViewEncapsulation.None });
2660
2659
  }
2661
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CaoTabGroup, decorators: [{
2660
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseTablePaginated, decorators: [{
2662
2661
  type: Component,
2663
- args: [{ selector: 'cao-tab-group', standalone: true, imports: [NgTemplateOutlet, LucideDynamicIcon], host: { class: 'cao-tab-group' }, template: "<div\n #header\n [class]=\"'cao-tab-header cao-tab-header--align-' + labelAlign\"\n>\n <div class=\"cao-tab-label-list\" role=\"tablist\">\n @for (tab of tabList; track $index; let i = $index) {\n <button\n #tabBtn\n role=\"tab\"\n type=\"button\"\n class=\"cao-tab-label\"\n [class.cao-tab-label--active]=\"isActive(i)\"\n [class.cao-tab-label--disabled]=\"tab.isDisabled\"\n [attr.aria-selected]=\"isActive(i)\"\n [attr.aria-disabled]=\"tab.isDisabled || null\"\n [attr.tabindex]=\"isActive(i) ? 0 : -1\"\n [attr.id]=\"'cao-tab-label-' + i\"\n [attr.aria-controls]=\"'cao-tab-content-' + i\"\n (click)=\"onTabClick(i)\"\n (keydown)=\"onKeydown($event, i)\"\n (focus)=\"onFocus(i)\"\n >\n @if (tab.leadingIcon) {\n <span class=\"leading-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.leadingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.leadingIcon\" />\n }\n </span>\n }\n\n @if (tab.labelTemplate) {\n <ng-container [ngTemplateOutlet]=\"tab.labelTemplate\" />\n } @else {\n <span class=\"cao-tab-labeltext\">{{ tab.label }}</span>\n }\n\n @if (tab.trailingIcon) {\n <span class=\"trailing-icon\">\n @if (tab.isLucideIcon) {\n <svg [lucideIcon]=\"tab.trailingIcon\" [style.color]=\"isActive(i) ? iconColorActive : iconColorInactive\" [strokeWidth]=\"strokeWidthIcon\"></svg>\n } @else {\n <img alt=\"icon\" [src]=\"tab.trailingIcon\" />\n }\n </span>\n }\n </button>\n }\n </div>\n\n <!-- Ink bar animado -->\n <div class=\"cao-tab-ink-bar-track\">\n <div #inkBar class=\"cao-tab-ink-bar\"></div>\n </div>\n</div>\n\n<!-- \u2550\u2550\u2550 Tab Bodies \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 -->\n<div\n class=\"cao-tab-body-wrapper\"\n [class.cao-tab-body-wrapper--dynamic]=\"dynamicHeight\"\n>\n @for (tab of tabList; track $index; let i = $index) {\n <div\n role=\"tabpanel\"\n class=\"cao-tab-body\"\n [class.cao-tab-body--active]=\"isActive(i)\"\n [attr.id]=\"'cao-tab-content-' + i\"\n [attr.aria-labelledby]=\"'cao-tab-label-' + i\"\n [attr.aria-hidden]=\"!isActive(i)\"\n [style.--cao-tab-anim-duration]=\"animationDuration\"\n >\n <div class=\"cao-tab-bodycontent\">\n @if (tab.lazyContent) {\n @if (isActive(i) || wasActivated(i)) {\n <ng-container [ngTemplateOutlet]=\"tab.lazyContent\" />\n }\n } @else {\n <ng-container [ngTemplateOutlet]=\"tab.content\" />\n }\n </div>\n </div>\n }\n</div>", styles: [":host{--cao-tab-font-family: inherit;--cao-tab-font-size: .875rem;--cao-tab-font-weight: 500;--cao-tab-label-height: 48px;--cao-tab-Label-px: 16px;--cao-tab-Label-gap: 6px;--cao-tab-color-text: #6b7280;--cao-tab-color-active: #4f46e5;--cao-tab-color-hover-bg: #f3f4f6;--cao-tab-color-disabled: #d1d5db;--cao-tab-color-ink-bar: #4f46e5;--cao-tab-color-header-border: #e5e7eb;--cao-tab-ink-bar-height: 2px;--cao-tab-content-pt: 20px;--cao-tab-radius: 4px;display:flex;flex-direction:column;width:100%}.cao-tab-header{position:relative;border-bottom:1px solid var(--cao-tab-color-header-border);overflow-x:auto;scrollbar-width:none}.cao-tab-header::-webkit-scrollbar{display:none}.cao-tab-label-list{display:flex;align-items:center;min-width:max-content}.cao-tab-header--align-center .cao-tab-label-list{justify-content:center}.cao-tab-header--align-end .cao-tab-label-list{justify-content:flex-end}.cao-tab-header--align-start .cao-tab-label-list{justify-content:flex-start}.cao-tab-label{display:inline-flex;align-items:center;gap:var(--cao-tab-label-gap);height:var(--cao-tab-label-height);padding:0 var(--cao-tab-label-px);font-family:var(--cao-tab-font-family);font-size:var(--cao-tab-font-size);font-weight:var(--cao-tab-font-weight);color:var(--cao-tab-color-text);white-space:nowrap;background:transparent;border:none;border-radius:var(--cao-tab-radius) var(--cao-tab-radius) 0 0;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .18s ease,background-color .18s ease;outline:none}.cao-tab-label:focus-visible{outline:2px solid var(--cao-tab-color-active);outline-offset:-2px}.cao-tab-label:hover:not(.cao-tab-label--disabled){background-color:var(--cao-tab-color-hover-bg);color:var(--cao-tab-color-active)}.cao-tab-label--active{color:var(--cao-tab-color-active)}.cao-tab-label--disabled{color:var(--cao-tab-color-disabled);cursor:not-allowed;pointer-events:none}.cao-tab-label__icon{flex-shrink:0;color:inherit;transition:color .18s ease}.cao-tab-ink-bar-track{position:absolute;bottom:0;left:0;right:0;height:var(--cao-tab-ink-bar-height);pointer-events:none}.cao-tab-ink-bar{position:absolute;bottom:0;left:0;height:100%;background-color:var(--cao-tab-color-ink-bar);border-radius:2px 2px 0 0;transition-property:transform,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}.cao-tab-body-wrapper{position:relative;overflow:hidden}.cao-tab-body-wrapper--dynamic{height:auto}.cao-tab-body{position:absolute;top:0;left:0;width:100%;visibility:hidden;opacity:0;pointer-events:none;transform:translate(24px);transition:opacity var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1),transform var(--cao-tab-anim-duration, .3s) cubic-bezier(.4,0,.2,1)}.cao-tab-body--active{position:relative;visibility:visible;opacity:1;pointer-events:auto;transform:translate(0)}.cao-tab-body__content{padding-top:var(--cao-tab-content-pt)}\n"] }]
2664
- }], propDecorators: { _hostStyles: [{
2665
- type: HostBinding,
2666
- args: ['style']
2667
- }], selectedIndex: [{
2668
- type: Input
2669
- }], labelHeight: [{
2670
- type: Input
2671
- }], labelPaddingX: [{
2672
- type: Input
2673
- }], labelGap: [{
2674
- type: Input
2675
- }], colorText: [{
2676
- type: Input
2677
- }], colorActive: [{
2678
- type: Input
2679
- }], colorHoverBg: [{
2680
- type: Input
2681
- }], colorDisabled: [{
2682
- type: Input
2683
- }], colorInkBar: [{
2684
- type: Input
2685
- }], colorHeaderBorder: [{
2686
- type: Input
2687
- }], inkBarHeight: [{
2688
- type: Input
2689
- }], contentPaddingTop: [{
2690
- type: Input
2691
- }], labelRadius: [{
2692
- type: Input
2693
- }], animationDuration: [{
2694
- type: Input
2695
- }], dynamicHeight: [{
2696
- type: Input
2697
- }], labelAlign: [{
2662
+ args: [{ selector: "cao-table-paginated", encapsulation: ViewEncapsulation.None, imports: [CommonModule, MaterialModule], providers: [{ provide: MatPaginatorIntl, useValue: getPtBrPaginatorIntlBasePaginated() }], template: "<div class=\"table-container\" [ngClass]=\"customClass\">\n @if (tableConfig) {\n <table mat-table matSort [dataSource]=\"dataSource\" (matSortChange)=\"announceSortChange($event)\">\n @for (column of displayedColumns; track column) {\n <ng-container [matColumnDef]=\"column\">\n <th *matHeaderCellDef mat-header-cell mat-sort-header class=\"table-header\">\n {{ getColumnHeader(column) }}\n </th>\n <td *matCellDef=\"let element\" mat-cell class=\"table-cell\">\n @switch (getColumnType(column)) { @case ('STRING') { @if (getColumnCssClass &&\n getColumnCssClass(column, element[getColumnElement(column)])) {\n <span [class]=\"getColumnCssClass(column, element[getColumnElement(column)])\">\n {{ element[getColumnElement(column)] }}\n </span>\n } @else {\n <span>{{ element[getColumnElement(column)] }}</span>\n } } @case ('BOOLEAN') {\n <mat-checkbox disabled [checked]=\"element[getColumnElement(column)]\" />\n } @case ('DATE') {\n <span>{{ element[getColumnElement(column)] | date:'mediumDate' }}</span>\n } @case ('NUMBER') {\n <span>{{ element[getColumnElement(column)] | number:'1.2-2' }}</span>\n } @case ('SINGLE_BUTTON') {\n <div>\n @for (btn of getColumnButtons(column); track btn) {\n <button type=\"button\" mat-icon-button [matTooltip]=\"btn.tooltip\" (click)=\"btn.onClick(element)\">\n <mat-icon>{{ btn.icon }}</mat-icon>\n </button>\n }\n </div>\n } }\n </td>\n </ng-container>\n }\n\n <ng-container matColumnDef=\"footer\">\n <td\n *matFooterCellDef\n mat-footer-cell\n class=\"table-cell\"\n [attr.colspan]=\"displayedColumns.length\">\n Total de Registros: {{ totalItems }}\n </td>\n </ng-container>\n\n <tr *matHeaderRowDef=\"displayedColumns\" mat-header-row></tr>\n <tr *matRowDef=\"let row; columns: displayedColumns;\" mat-row (click)=\"onRowClick(row)\"></tr>\n <tr *matFooterRowDef=\"['footer']\" mat-footer-row class=\"mat-row-footer\"></tr>\n </table>\n @if(totalItems > 0){\n\n <mat-paginator\n #paginator\n aria-label=\"Select page\"\n [length]=\"totalItems\"\n [pageSize]=\"pageSize\"\n [pageSizeOptions]=\"pageSizeOptions\"\n [pageIndex]=\"currentPage - 1\"\n [hidePageSize]=\"false\"\n [showFirstLastButtons]=\"showFirstLastButtons\"\n (page)=\"onPageEvent($event)\" />\n } @else {\n <div class=\"no-data-container\">\n <h2>{{ tableConfig?.result?.noData ?? 'N\u00E3o h\u00E1 dados dispon\u00EDveis' }}</h2>\n <p>{{ tableConfig?.result?.defaultMessage ?? 'Adicione alguns dados' }}</p>\n </div>\n } }\n</div>\n", styles: [".table-container{border-radius:8px;box-shadow:0 4px 6px #0000001a;overflow:hidden}.table-container .table-controls{display:flex;align-items:center;padding:20px;justify-content:center}.table-container .table-controls .filter-field{display:flex;align-items:center;justify-content:space-between;padding:10px;flex-direction:row;border:none;border-radius:10px;background-color:var(--input-disabled-bg);width:50%;height:55px;margin:0 auto}.table-container .table-controls .filter-field input:focus{outline:none!important;box-shadow:none!important;border-color:transparent!important}.table-container .table-controls .filter-field .input-filter{width:100%;box-sizing:border-box;background-color:transparent;border:none;transition:none;text-align:center}.table-container .table-controls .filter-field i{color:var(--icon-collor);margin-left:8px}.table-container .mat-mdc-table{width:100%}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell{border-right:1px solid var(--data-bg);font-weight:600;color:var(--message-color);border-bottom:1px solid var(--input-background);text-transform:uppercase;font-size:.875rem;text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-header-row .mat-mdc-header-cell .mat-sort-header-container{justify-content:center}.table-container .mat-mdc-table .mat-mdc-row{transition:background-color .2s ease;background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(2n){background-color:transparent}.table-container .mat-mdc-table .mat-mdc-row:nth-child(odd){background-color:var(--input-background)}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell{border-right:1px solid var(--border-table-ligth);color:var(--gray-dark);border-bottom:1px solid var(--input-background);text-align:center;padding:12px;vertical-align:middle}.table-container .mat-mdc-table .mat-mdc-row .mat-mdc-cell:last-child{border-right:none}.table-container .mat-mdc-table .mat-mdc-row:hover{background-color:#0000000a}.table-container .mat-mdc-table .mat-mdc-row.selected{background-color:#3f51b51a}.table-container .mat-mdc-table .mat-mdc-checkbox{margin:0 auto;display:block}.table-container .mat-mdc-table .mat-mdc-checkbox .mdc-checkbox{--mdc-checkbox-unselected-icon-color: var(--gray-dark);--mdc-checkbox-selected-icon-color: var(--info)}.table-container .mat-mdc-table .mat-mdc-footer-row{background-color:var(--table-background);font-weight:600;color:var(--text-color)}.table-container .mat-mdc-table .mat-mdc-footer-row .mat-mdc-footer-cell{padding:12px;text-align:center}.table-container .no-data-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px;text-align:center;background-color:var(--table-background)}.table-container .no-data-container h2{color:var(--input-disabled-bg);margin-bottom:12px}.table-container .no-data-container p{color:var(--input-disabled-bg)}@media(width<=768px){.table-container .table-controls{flex-direction:column;align-items:center}.table-container .table-controls .filter-field{width:80%;margin-right:0;margin-bottom:12px}}\n"] }]
2663
+ }], ctorParameters: () => [], propDecorators: { getColumnCssClass: [{
2698
2664
  type: Input
2699
- }], iconColorActive: [{
2665
+ }], customClass: [{
2700
2666
  type: Input
2701
- }], iconColorInactive: [{
2667
+ }], pageSizeOptions: [{
2702
2668
  type: Input
2703
- }], strokeWidthIcon: [{
2669
+ }], showFirstLastButtons: [{
2704
2670
  type: Input
2705
- }], selectedTabChange: [{
2671
+ }], pageChanged: [{
2706
2672
  type: Output
2707
- }], focusChange: [{
2673
+ }], pageSizeChanged: [{
2708
2674
  type: Output
2709
- }], tabs: [{
2710
- type: ContentChildren,
2711
- args: [CaoTabPanel]
2712
- }], tabBtns: [{
2713
- type: ViewChildren,
2714
- args: ['tabBtn']
2715
- }], inkBar: [{
2675
+ }], firstPageClicked: [{
2676
+ type: Output
2677
+ }], lastPageClicked: [{
2678
+ type: Output
2679
+ }], selectionChanged: [{
2680
+ type: Output
2681
+ }], pageEvent: [{
2682
+ type: Output
2683
+ }], rowClicked: [{
2684
+ type: Output
2685
+ }], sort: [{
2716
2686
  type: ViewChild,
2717
- args: ['inkBar']
2687
+ args: [MatSort]
2688
+ }], paginator: [{
2689
+ type: ViewChild,
2690
+ args: [MatPaginator]
2718
2691
  }] } });
2719
2692
 
2720
- /*
2721
- * Public API Surface of ngx-opalbytes-components
2722
- */
2693
+ class BaseAlert {
2694
+ data;
2695
+ iconPath;
2696
+ titleClass;
2697
+ iconPaths = {
2698
+ success: "https://placehold.co/600x400",
2699
+ error: "https://placehold.co/600x400",
2700
+ info: "https://placehold.co/600x400",
2701
+ warning: "https://placehold.co/600x400",
2702
+ };
2703
+ ngOnInit() {
2704
+ this.iconPath = this.iconPaths[this.data.type];
2705
+ this.titleClass = `title-${this.data.type}`;
2706
+ }
2707
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlert, deps: [], target: i0.ɵɵFactoryTarget.Component });
2708
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: BaseAlert, isStandalone: true, selector: "cao-alert", ngImport: i0, template: "<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [ngSrc]=\"data.alertIcon ?? ''\" [fill]=\"true\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\">\n @if (data.title) {\n <div class=\"title\" [ngClass]=\"titleClass\">{{ data.title }}</div>\n } @if (data.title && data.message) {\n <div class=\"message-spacer\"></div>\n } @if (data.message) {\n <div class=\"message\">{{ data.message }}</div>\n }\n </div>\n <div class=\"icon-container\">\n <img alt=\"Alert Icon\" class=\"alert-icon\" [ngSrc]=\"iconPath\" [fill]=\"true\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:10%;left:55%;transform:translate(-50%);z-index:1000;display:block;animation:slide-in .3s ease-out}@keyframes slide-in{0%{opacity:0;transform:translate(-50%,-20px)}to{opacity:1;transform:translate(-50%)}}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white)}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.text-content{flex-grow:1;margin:20px;padding-right:20px}.title{font-family:Lato,sans-serif;font-weight:700;font-size:24px;color:var(--primary);margin-bottom:5px}.title.success{color:var(--primary)}.title.error{color:var(--error-color)}.title.warning{color:var(--support-orange)}.title.info,.title.title-success{color:var(--primary)}.title.title-error{color:var(--error)}.title.title-warning{color:var(--support-orange)}.title.title-info{color:var(--primary)}.message-spacer{height:16px}.message{font-family:Lato,sans-serif;font-weight:400;font-size:26px;line-height:100%;color:var(--message-color)}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){:host{left:55%;max-width:95%}.dialog-container{max-width:90%;width:400px}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgOptimizedImage, selector: "img[ngSrc]", inputs: ["ngSrc", "ngSrcset", "sizes", "width", "height", "decoding", "loading", "priority", "loaderParams", "disableOptimizedSrcset", "fill", "placeholder", "placeholderConfig", "src", "srcset"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2709
+ }
2710
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlert, decorators: [{
2711
+ type: Component,
2712
+ args: [{ selector: 'cao-alert', imports: [CommonModule, NgOptimizedImage], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"dialog-container\">\n <div class=\"dialog-content\">\n <img alt=\"Logo\" class=\"logo\" [ngSrc]=\"data.alertIcon ?? ''\" [fill]=\"true\" />\n <div class=\"alert-wrapper\">\n <div class=\"text-content\">\n @if (data.title) {\n <div class=\"title\" [ngClass]=\"titleClass\">{{ data.title }}</div>\n } @if (data.title && data.message) {\n <div class=\"message-spacer\"></div>\n } @if (data.message) {\n <div class=\"message\">{{ data.message }}</div>\n }\n </div>\n <div class=\"icon-container\">\n <img alt=\"Alert Icon\" class=\"alert-icon\" [ngSrc]=\"iconPath\" [fill]=\"true\" />\n </div>\n </div>\n </div>\n</div>\n", styles: [":host{position:fixed;top:10%;left:55%;transform:translate(-50%);z-index:1000;display:block;animation:slide-in .3s ease-out}@keyframes slide-in{0%{opacity:0;transform:translate(-50%,-20px)}to{opacity:1;transform:translate(-50%)}}.dialog-container{width:600px;border-radius:30px;overflow:hidden;box-shadow:0 4px 6px #0000001a;background-color:var(--white)}.dialog-content{padding:20px 30px;box-sizing:border-box}.logo{width:150px;height:24px;margin-bottom:15px}.alert-wrapper{display:flex;align-items:center;justify-content:space-between}.text-content{flex-grow:1;margin:20px;padding-right:20px}.title{font-family:Lato,sans-serif;font-weight:700;font-size:24px;color:var(--primary);margin-bottom:5px}.title.success{color:var(--primary)}.title.error{color:var(--error-color)}.title.warning{color:var(--support-orange)}.title.info,.title.title-success{color:var(--primary)}.title.title-error{color:var(--error)}.title.title-warning{color:var(--support-orange)}.title.title-info{color:var(--primary)}.message-spacer{height:16px}.message{font-family:Lato,sans-serif;font-weight:400;font-size:26px;line-height:100%;color:var(--message-color)}.icon-container{width:150px;height:150px;flex-shrink:0}.alert-icon{width:100%;height:100%;object-fit:contain}@media(max-width:768px){:host{left:55%;max-width:95%}.dialog-container{max-width:90%;width:400px}.alert-wrapper{flex-direction:column;text-align:center}.text-content{padding-right:0;margin-bottom:10px}.icon-container{width:100px;height:100px}}\n"] }]
2713
+ }] });
2714
+
2715
+ class BaseAlertService {
2716
+ overlay;
2717
+ constructor(overlay) {
2718
+ this.overlay = overlay;
2719
+ }
2720
+ defaultTime = 3000;
2721
+ show(config) {
2722
+ const overlayRef = this.overlay.create({
2723
+ hasBackdrop: false,
2724
+ positionStrategy: this.overlay.position().global().centerHorizontally().top("10%"),
2725
+ scrollStrategy: this.overlay.scrollStrategies.block(),
2726
+ });
2727
+ const alertPortal = new ComponentPortal(this.generateComponentPortal());
2728
+ const componentRef = overlayRef.attach(alertPortal);
2729
+ componentRef.instance.data = config;
2730
+ setTimeout(() => {
2731
+ overlayRef.dispose();
2732
+ }, this.defaultTime);
2733
+ }
2734
+ generateComponentPortal() {
2735
+ return BaseAlert;
2736
+ }
2737
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, deps: [{ token: i1$4.Overlay }], target: i0.ɵɵFactoryTarget.Injectable });
2738
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, providedIn: "root" });
2739
+ }
2740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseAlertService, decorators: [{
2741
+ type: Injectable,
2742
+ args: [{
2743
+ providedIn: "root",
2744
+ }]
2745
+ }], ctorParameters: () => [{ type: i1$4.Overlay }] });
2723
2746
 
2724
2747
  /**
2725
2748
  * Generated bundle index. Do not edit.
2726
2749
  */
2727
2750
 
2728
- export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseInput, CaoDropDownComponent, CaoTabGroup, CaoTabPanel, Footer, LinksButton, Paginator, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
2751
+ export { BaseAlert, BaseAlertService, BaseDialog, BaseDialogService, BaseFilterTablePaginatedService, BaseFilterTableService, BaseModal, BaseModalService, BasePaginationService, BaseTable, BaseTablePaginated, BaseTableService, BaseTimeRange, CaoAutocompleteComponent, CaoBaseButtonComponent, CaoBaseIcon, CaoBaseInput, CaoDropDownComponent, CaoTabGroup, CaoTabPanel, Footer, LinksButton, Paginator, StepComponent, StepperComponent, TablePaginatedService, TimePicker, getPtBrPaginatorIntlBasePaginated, getPtBrPaginatorIntlBaseTable };
2729
2752
  //# sourceMappingURL=ngx-opalbytes-components.mjs.map