@dataclouder/ngx-core 0.1.11 → 0.1.13

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,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, Input, Component, output, ChangeDetectionStrategy, inject, HostListener, InjectionToken, Directive, Injectable, ChangeDetectorRef, Pipe, signal, effect, ViewChild, Optional, Inject } from '@angular/core';
2
+ import { input, Input, Component, output, ChangeDetectionStrategy, inject, HostListener, ChangeDetectorRef, Injectable, Pipe, signal, effect, ViewChild, InjectionToken, Directive, Optional, Inject } from '@angular/core';
3
3
  import * as i1 from '@angular/forms';
4
4
  import { FormsModule } from '@angular/forms';
5
5
  import * as i1$1 from 'primeng/button';
@@ -17,9 +17,6 @@ import { MessageService, FilterMatchMode } from 'primeng/api';
17
17
  import { DynamicDialogConfig, DynamicDialogRef, DialogService } from 'primeng/dynamicdialog';
18
18
  import * as i2 from 'primeng/message';
19
19
  import { MessageModule } from 'primeng/message';
20
- import * as i1$2 from '@angular/router';
21
- import { RouterModule } from '@angular/router';
22
- import { firstValueFrom, tap, catchError, lastValueFrom, throwError } from 'rxjs';
23
20
  import * as i3$1 from 'primeng/progressbar';
24
21
  import { ProgressBarModule, ProgressBar } from 'primeng/progressbar';
25
22
  import * as i2$1 from 'primeng/toast';
@@ -27,11 +24,16 @@ import { ToastModule, Toast } from 'primeng/toast';
27
24
  import { CardModule } from 'primeng/card';
28
25
  import * as i4$1 from 'primeng/inputtext';
29
26
  import { InputTextModule } from 'primeng/inputtext';
27
+ import { RouterModule, ActivatedRoute, Router } from '@angular/router';
30
28
  import { SpeedDialModule } from 'primeng/speeddial';
31
29
  import { PaginatorModule } from 'primeng/paginator';
32
30
  import * as i3$2 from 'primeng/table';
33
31
  import { TableModule } from 'primeng/table';
34
32
  import { get } from 'lodash';
33
+ import { firstValueFrom, tap, catchError, lastValueFrom, throwError } from 'rxjs';
34
+ import { CommonModule } from '@angular/common';
35
+ import * as i4$2 from 'primeng/textarea';
36
+ import { TextareaModule } from 'primeng/textarea';
35
37
  import { HttpClient } from '@angular/common/http';
36
38
 
37
39
  class EmptyStateComponent {
@@ -82,8 +84,8 @@ const DEFAULT_FILTERS = { filters: {}, page: 0, rowsPerPage: 10, sort: { _id: -1
82
84
  class DCFilterBarComponent {
83
85
  constructor() {
84
86
  // Signal Inputs
85
- this.isAdmin = input(true); // TODO: create a solution for is admin
86
87
  this.items = input([]);
88
+ this.options = input({ showCreateButton: true });
87
89
  // Inputs
88
90
  this.customFilters = [];
89
91
  // Outputs
@@ -149,12 +151,12 @@ class DCFilterBarComponent {
149
151
  this.onFilterAction.emit(filterEvent);
150
152
  }
151
153
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCFilterBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
152
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCFilterBarComponent, isStandalone: true, selector: "dc-filter-bar", inputs: { isAdmin: { classPropertyName: "isAdmin", publicName: "isAdmin", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, customFilters: { classPropertyName: "customFilters", publicName: "customFilters", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onFilterAction: "onFilterAction", onChangeSort: "onChangeSort", onNew: "onNew" }, ngImport: i0, template: "<div class=\"background-bar\">\n <div class=\"button-flex\">\n <div>\n <p-button icon=\"pi pi-search\" label=\"buscar\" severity=\"secondary\" (click)=\"isSearchVisible = true\" />\n </div>\n\n @if (isAdmin()) {\n <span class=\"admin\">\n <p-button icon=\"pi pi-plus\" label=\"Crear Nueva\" severity=\"secondary\" (click)=\"createNew()\" />\n </span>\n }\n </div>\n\n <p-button icon=\"pi pi-objects-column\" variant=\"text\" (click)=\"doItemAction({ action: 'changeView', item: null })\" severity=\"secondary\"></p-button>\n\n @for(item of items(); track $index) {\n <p-button [icon]=\"item.icon\" variant=\"text\" (click)=\"doItemAction({ action: item.title, item: item })\" severity=\"secondary\"></p-button>\n\n }\n\n <div class=\"button-flex\">\n <p-button icon=\"pi pi-filter\" label=\"Filtrar\" severity=\"secondary\" (click)=\"isFilterVisible = true\" />\n </div>\n</div>\n\n@if (placeholder) {\n<span class=\"search-flex\" (click)=\"search(null)\"> <i class=\"pi pi-times\"></i>{{ placeholder }} </span>\n}\n\n<p-dialog [(visible)]=\"isSearchVisible\" [dismissableMask]=\"true\" [modal]=\"true\" [showHeader]=\"false\" (onHide)=\"isSearchVisible = false\">\n <p>Haz una b\u00FAsqueda (Enter)</p>\n <div>\n <span>\n <input (keydown.enter)=\"search(placeholder)\" type=\"text\" pInputText [(ngModel)]=\"placeholder\" />\n </span>\n </div>\n</p-dialog>\n\n<p-dialog [(visible)]=\"isFilterVisible\" [modal]=\"true\" [style]=\"{ width: '70vw', height: '70vh' }\" [header]=\"'Filtros'\">\n <div class=\"flex flex-column gap-4\">\n <!-- Sort Options -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Ordenar por</label>\n <p-select [options]=\"sortOptions\" [(ngModel)]=\"selectedSort\" optionLabel=\"label\" [style]=\"{ width: '100%' }\" placeholder=\"Seleccionar orden\"> </p-select>\n </div>\n\n <p-multiselect\n [options]=\"availibleFilters\"\n [(ngModel)]=\"selectedFilters\"\n optionLabel=\"name\"\n placeholder=\"Filtros R\u00E1pidos\"\n [maxSelectedLabels]=\"3\"\n styleClass=\"w-full md:w-80\" />\n\n <!-- Date Filter -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Rango de fechas</label>\n <p-calendar\n [(ngModel)]=\"dateRange\"\n selectionMode=\"range\"\n [showButtonBar]=\"true\"\n [style]=\"{ width: '100%' }\"\n placeholder=\"Seleccionar fechas\"\n dateFormat=\"dd/mm/yy\">\n </p-calendar>\n </div>\n\n @if (customFilters?.length > 0) {\n <h4>Filtros Personalizados (No terminado...) </h4>\n <h6>Encontrar la forma de que cada custom filter se renderize como un nuevo form.</h6>\n @for (filter of customFilters; track filter.name) {\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">{{ filter.name }}</label>\n </div>\n } }\n\n <!-- Recent/All Toggle -->\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"flex justify-content-end gap-2\">\n <p-button label=\"Limpiar\" icon=\"pi pi-trash\" (click)=\"clearFilters()\" styleClass=\"p-button-text\"> </p-button>\n <p-button label=\"Aplicar\" icon=\"pi pi-check\" (click)=\"applyFilters()\" severity=\"primary\"> </p-button>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host{display:block}.admin{margin-left:10px}.background-bar{background-color:var(--p-primary-color);display:flex;border-radius:10px;justify-content:space-between;padding:10px}.button-flex{display:flex;margin-right:10px}.white{color:#fff}.search-flex{margin-left:10px}.search-dialog{width:750px;-webkit-backdrop-filter:blur(70px);backdrop-filter:blur(70px)}.border-none{border:none}.bg-black-alpha-50{background-color:var(--p-primary-color)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i6.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i7.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
154
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: DCFilterBarComponent, isStandalone: true, selector: "dc-filter-bar", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, customFilters: { classPropertyName: "customFilters", publicName: "customFilters", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { onFilterAction: "onFilterAction", onChangeSort: "onChangeSort", onNew: "onNew" }, ngImport: i0, template: "<div class=\"background-bar\">\n <div class=\"button-flex\">\n <div>\n <p-button icon=\"pi pi-search\" label=\"buscar\" severity=\"secondary\" (click)=\"isSearchVisible = true\" />\n </div>\n\n @if (options().showCreateButton) {\n <span class=\"admin\">\n <p-button icon=\"pi pi-plus\" label=\"Crear Nueva\" severity=\"secondary\" (click)=\"createNew()\" />\n </span>\n }\n </div>\n\n @if(options().showViewButton){\n <p-button icon=\"pi pi-objects-column\" variant=\"text\" (click)=\"doItemAction({ action: 'changeView', item: null })\" severity=\"secondary\"></p-button>\n } @if(options().showActions){ @for(item of items(); track $index) {\n <p-button [icon]=\"item.icon\" variant=\"text\" (click)=\"doItemAction({ action: item.title, item: item })\" severity=\"secondary\"></p-button>\n }\n\n <div class=\"button-flex\">\n <p-button icon=\"pi pi-filter\" label=\"Filtrar\" severity=\"secondary\" (click)=\"isFilterVisible = true\" />\n </div>\n }\n</div>\n\n@if (placeholder) {\n<span class=\"search-flex\" (click)=\"search(null)\"> <i class=\"pi pi-times\"></i>{{ placeholder }} </span>\n}\n\n<p-dialog [(visible)]=\"isSearchVisible\" [dismissableMask]=\"true\" [modal]=\"true\" [showHeader]=\"false\" (onHide)=\"isSearchVisible = false\">\n <p>Haz una b\u00FAsqueda (Enter)</p>\n <div>\n <span>\n <input (keydown.enter)=\"search(placeholder)\" type=\"text\" pInputText [(ngModel)]=\"placeholder\" />\n </span>\n </div>\n</p-dialog>\n\n<p-dialog [(visible)]=\"isFilterVisible\" [modal]=\"true\" [style]=\"{ width: '70vw', height: '70vh' }\" [header]=\"'Filtros'\">\n <div class=\"flex flex-column gap-4\">\n <!-- Sort Options -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Ordenar por</label>\n <p-select [options]=\"sortOptions\" [(ngModel)]=\"selectedSort\" optionLabel=\"label\" [style]=\"{ width: '100%' }\" placeholder=\"Seleccionar orden\"> </p-select>\n </div>\n\n <p-multiselect\n [options]=\"availibleFilters\"\n [(ngModel)]=\"selectedFilters\"\n optionLabel=\"name\"\n placeholder=\"Filtros R\u00E1pidos\"\n [maxSelectedLabels]=\"3\"\n styleClass=\"w-full md:w-80\" />\n\n <!-- Date Filter -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Rango de fechas</label>\n <p-calendar\n [(ngModel)]=\"dateRange\"\n selectionMode=\"range\"\n [showButtonBar]=\"true\"\n [style]=\"{ width: '100%' }\"\n placeholder=\"Seleccionar fechas\"\n dateFormat=\"dd/mm/yy\">\n </p-calendar>\n </div>\n\n @if (customFilters?.length > 0) {\n <h4>Filtros Personalizados (No terminado...) </h4>\n <h6>Encontrar la forma de que cada custom filter se renderize como un nuevo form.</h6>\n @for (filter of customFilters; track filter.name) {\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">{{ filter.name }}</label>\n </div>\n } }\n\n <!-- Recent/All Toggle -->\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"flex justify-content-end gap-2\">\n <p-button label=\"Limpiar\" icon=\"pi pi-trash\" (click)=\"clearFilters()\" styleClass=\"p-button-text\"> </p-button>\n <p-button label=\"Aplicar\" icon=\"pi pi-check\" (click)=\"applyFilters()\" severity=\"primary\"> </p-button>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host{display:block}.admin{margin-left:10px}.background-bar{background-color:var(--p-primary-color);display:flex;border-radius:10px;justify-content:space-between;padding:10px}.button-flex{display:flex;margin-right:10px}.white{color:#fff}.search-flex{margin-left:10px}.search-dialog{width:750px;-webkit-backdrop-filter:blur(70px);backdrop-filter:blur(70px)}.border-none{border:none}.bg-black-alpha-50{background-color:var(--p-primary-color)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i4.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i5.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i6.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: CalendarModule }, { kind: "component", type: i7.Calendar, selector: "p-calendar", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
153
155
  }
154
156
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCFilterBarComponent, decorators: [{
155
157
  type: Component,
156
- args: [{ selector: 'dc-filter-bar', standalone: true, imports: [FormsModule, ButtonModule, DialogModule, SelectModule, MultiSelectModule, CalendarModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"background-bar\">\n <div class=\"button-flex\">\n <div>\n <p-button icon=\"pi pi-search\" label=\"buscar\" severity=\"secondary\" (click)=\"isSearchVisible = true\" />\n </div>\n\n @if (isAdmin()) {\n <span class=\"admin\">\n <p-button icon=\"pi pi-plus\" label=\"Crear Nueva\" severity=\"secondary\" (click)=\"createNew()\" />\n </span>\n }\n </div>\n\n <p-button icon=\"pi pi-objects-column\" variant=\"text\" (click)=\"doItemAction({ action: 'changeView', item: null })\" severity=\"secondary\"></p-button>\n\n @for(item of items(); track $index) {\n <p-button [icon]=\"item.icon\" variant=\"text\" (click)=\"doItemAction({ action: item.title, item: item })\" severity=\"secondary\"></p-button>\n\n }\n\n <div class=\"button-flex\">\n <p-button icon=\"pi pi-filter\" label=\"Filtrar\" severity=\"secondary\" (click)=\"isFilterVisible = true\" />\n </div>\n</div>\n\n@if (placeholder) {\n<span class=\"search-flex\" (click)=\"search(null)\"> <i class=\"pi pi-times\"></i>{{ placeholder }} </span>\n}\n\n<p-dialog [(visible)]=\"isSearchVisible\" [dismissableMask]=\"true\" [modal]=\"true\" [showHeader]=\"false\" (onHide)=\"isSearchVisible = false\">\n <p>Haz una b\u00FAsqueda (Enter)</p>\n <div>\n <span>\n <input (keydown.enter)=\"search(placeholder)\" type=\"text\" pInputText [(ngModel)]=\"placeholder\" />\n </span>\n </div>\n</p-dialog>\n\n<p-dialog [(visible)]=\"isFilterVisible\" [modal]=\"true\" [style]=\"{ width: '70vw', height: '70vh' }\" [header]=\"'Filtros'\">\n <div class=\"flex flex-column gap-4\">\n <!-- Sort Options -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Ordenar por</label>\n <p-select [options]=\"sortOptions\" [(ngModel)]=\"selectedSort\" optionLabel=\"label\" [style]=\"{ width: '100%' }\" placeholder=\"Seleccionar orden\"> </p-select>\n </div>\n\n <p-multiselect\n [options]=\"availibleFilters\"\n [(ngModel)]=\"selectedFilters\"\n optionLabel=\"name\"\n placeholder=\"Filtros R\u00E1pidos\"\n [maxSelectedLabels]=\"3\"\n styleClass=\"w-full md:w-80\" />\n\n <!-- Date Filter -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Rango de fechas</label>\n <p-calendar\n [(ngModel)]=\"dateRange\"\n selectionMode=\"range\"\n [showButtonBar]=\"true\"\n [style]=\"{ width: '100%' }\"\n placeholder=\"Seleccionar fechas\"\n dateFormat=\"dd/mm/yy\">\n </p-calendar>\n </div>\n\n @if (customFilters?.length > 0) {\n <h4>Filtros Personalizados (No terminado...) </h4>\n <h6>Encontrar la forma de que cada custom filter se renderize como un nuevo form.</h6>\n @for (filter of customFilters; track filter.name) {\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">{{ filter.name }}</label>\n </div>\n } }\n\n <!-- Recent/All Toggle -->\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"flex justify-content-end gap-2\">\n <p-button label=\"Limpiar\" icon=\"pi pi-trash\" (click)=\"clearFilters()\" styleClass=\"p-button-text\"> </p-button>\n <p-button label=\"Aplicar\" icon=\"pi pi-check\" (click)=\"applyFilters()\" severity=\"primary\"> </p-button>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host{display:block}.admin{margin-left:10px}.background-bar{background-color:var(--p-primary-color);display:flex;border-radius:10px;justify-content:space-between;padding:10px}.button-flex{display:flex;margin-right:10px}.white{color:#fff}.search-flex{margin-left:10px}.search-dialog{width:750px;-webkit-backdrop-filter:blur(70px);backdrop-filter:blur(70px)}.border-none{border:none}.bg-black-alpha-50{background-color:var(--p-primary-color)}\n"] }]
157
- }], ctorParameters: () => [], propDecorators: { customFilters: [{
158
+ args: [{ selector: 'dc-filter-bar', standalone: true, imports: [FormsModule, ButtonModule, DialogModule, SelectModule, MultiSelectModule, CalendarModule], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"background-bar\">\n <div class=\"button-flex\">\n <div>\n <p-button icon=\"pi pi-search\" label=\"buscar\" severity=\"secondary\" (click)=\"isSearchVisible = true\" />\n </div>\n\n @if (options().showCreateButton) {\n <span class=\"admin\">\n <p-button icon=\"pi pi-plus\" label=\"Crear Nueva\" severity=\"secondary\" (click)=\"createNew()\" />\n </span>\n }\n </div>\n\n @if(options().showViewButton){\n <p-button icon=\"pi pi-objects-column\" variant=\"text\" (click)=\"doItemAction({ action: 'changeView', item: null })\" severity=\"secondary\"></p-button>\n } @if(options().showActions){ @for(item of items(); track $index) {\n <p-button [icon]=\"item.icon\" variant=\"text\" (click)=\"doItemAction({ action: item.title, item: item })\" severity=\"secondary\"></p-button>\n }\n\n <div class=\"button-flex\">\n <p-button icon=\"pi pi-filter\" label=\"Filtrar\" severity=\"secondary\" (click)=\"isFilterVisible = true\" />\n </div>\n }\n</div>\n\n@if (placeholder) {\n<span class=\"search-flex\" (click)=\"search(null)\"> <i class=\"pi pi-times\"></i>{{ placeholder }} </span>\n}\n\n<p-dialog [(visible)]=\"isSearchVisible\" [dismissableMask]=\"true\" [modal]=\"true\" [showHeader]=\"false\" (onHide)=\"isSearchVisible = false\">\n <p>Haz una b\u00FAsqueda (Enter)</p>\n <div>\n <span>\n <input (keydown.enter)=\"search(placeholder)\" type=\"text\" pInputText [(ngModel)]=\"placeholder\" />\n </span>\n </div>\n</p-dialog>\n\n<p-dialog [(visible)]=\"isFilterVisible\" [modal]=\"true\" [style]=\"{ width: '70vw', height: '70vh' }\" [header]=\"'Filtros'\">\n <div class=\"flex flex-column gap-4\">\n <!-- Sort Options -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Ordenar por</label>\n <p-select [options]=\"sortOptions\" [(ngModel)]=\"selectedSort\" optionLabel=\"label\" [style]=\"{ width: '100%' }\" placeholder=\"Seleccionar orden\"> </p-select>\n </div>\n\n <p-multiselect\n [options]=\"availibleFilters\"\n [(ngModel)]=\"selectedFilters\"\n optionLabel=\"name\"\n placeholder=\"Filtros R\u00E1pidos\"\n [maxSelectedLabels]=\"3\"\n styleClass=\"w-full md:w-80\" />\n\n <!-- Date Filter -->\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">Rango de fechas</label>\n <p-calendar\n [(ngModel)]=\"dateRange\"\n selectionMode=\"range\"\n [showButtonBar]=\"true\"\n [style]=\"{ width: '100%' }\"\n placeholder=\"Seleccionar fechas\"\n dateFormat=\"dd/mm/yy\">\n </p-calendar>\n </div>\n\n @if (customFilters?.length > 0) {\n <h4>Filtros Personalizados (No terminado...) </h4>\n <h6>Encontrar la forma de que cada custom filter se renderize como un nuevo form.</h6>\n @for (filter of customFilters; track filter.name) {\n <div class=\"field\">\n <label class=\"font-semibold block mb-2\">{{ filter.name }}</label>\n </div>\n } }\n\n <!-- Recent/All Toggle -->\n </div>\n\n <ng-template pTemplate=\"footer\">\n <div class=\"flex justify-content-end gap-2\">\n <p-button label=\"Limpiar\" icon=\"pi pi-trash\" (click)=\"clearFilters()\" styleClass=\"p-button-text\"> </p-button>\n <p-button label=\"Aplicar\" icon=\"pi pi-check\" (click)=\"applyFilters()\" severity=\"primary\"> </p-button>\n </div>\n </ng-template>\n</p-dialog>\n", styles: [":host{display:block}.admin{margin-left:10px}.background-bar{background-color:var(--p-primary-color);display:flex;border-radius:10px;justify-content:space-between;padding:10px}.button-flex{display:flex;margin-right:10px}.white{color:#fff}.search-flex{margin-left:10px}.search-dialog{width:750px;-webkit-backdrop-filter:blur(70px);backdrop-filter:blur(70px)}.border-none{border:none}.bg-black-alpha-50{background-color:var(--p-primary-color)}\n"] }]
159
+ }], propDecorators: { customFilters: [{
158
160
  type: Input
159
161
  }] } });
160
162
 
@@ -214,214 +216,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
214
216
  args: ['window:keyup.escape', ['$event']]
215
217
  }] } });
216
218
 
217
- const TOAST_ALERTS_TOKEN = new InjectionToken('Toast alerts Service');
218
- class ToastAlertsAbstractService {
219
- }
220
- function provideToastAlert(serviceImplementation) {
221
- return [
222
- {
223
- provide: TOAST_ALERTS_TOKEN,
224
- useExisting: serviceImplementation,
225
- },
226
- ];
227
- }
228
- // @deprecated, moved to ngx-tts
229
- var AudioSpeed;
230
- (function (AudioSpeed) {
231
- AudioSpeed["VerySlow"] = "verySlow";
232
- AudioSpeed["Slow"] = "slow";
233
- AudioSpeed["Regular"] = "regular";
234
- AudioSpeed["Fast"] = "fast";
235
- AudioSpeed["VeryFast"] = "veryFast";
236
- })(AudioSpeed || (AudioSpeed = {}));
237
-
238
- /**
239
- * Abstract base class for implementing pagination functionality.
240
- * Provides common pagination logic, state management, and navigation handling.
241
- * Child classes must implement the loadData method and define columns.
242
- */
243
- class PaginationBase {
244
- /**
245
- * Creates an instance of PaginationBase.
246
- * @param route - The ActivatedRoute for accessing route parameters
247
- * @param router - The Router for navigation
248
- */
249
- constructor(route, router) {
250
- this.route = route;
251
- this.router = router;
252
- /**
253
- * Available actions for items.
254
- * Must be implemented by child classes.
255
- */
256
- this.actions = input();
257
- /**
258
- * Event emitted when an action is performed on an item.
259
- * Emits an object containing the item and the action that was triggered.
260
- */
261
- this.onAction = output();
262
- /** Current first record index for the paginator */
263
- this.paginatorFirst = 0;
264
- /** Number of rows to display per page */
265
- this.paginatorRows = 10;
266
- /** Total number of records available */
267
- this.totalRecords = 0;
268
- /** Current view mode, either cards or table */
269
- this.viewMode = 'table';
270
- /** Loading state indicator */
271
- this.isLoading = false;
272
- /** Available button actions for items */
273
- this.buttonActions = [];
274
- /**
275
- * Configuration for filtering, sorting, and pagination.
276
- * Includes current page, rows per page, sorting criteria, and applied filters.
277
- */
278
- this.filterConfig = { page: 0, rowsPerPage: this.paginatorRows, sort: { _id: -1 }, filters: {} };
279
- this.initializePagination();
280
- }
281
- /**
282
- * Initializes pagination based on URL query parameters.
283
- * Sets the current page from the 'page' query parameter if available.
284
- * @private
285
- */
286
- initializePagination() {
287
- const page = this.route.snapshot.queryParamMap.get('page');
288
- if (page) {
289
- this.filterConfig.page = +page - 1;
290
- this.paginatorFirst = this.filterConfig.page * this.paginatorRows;
291
- }
292
- }
293
- /**
294
- * Handles pagination events from the paginator component.
295
- * Updates the filter configuration, loads new data, and updates the URL.
296
- * @param pageEvent - The page event containing page number and rows per page
297
- */
298
- async onPageChange(pageEvent) {
299
- this.paginatorRows = pageEvent.rows;
300
- this.filterConfig = {
301
- ...this.filterConfig,
302
- page: pageEvent.page,
303
- rowsPerPage: this.paginatorRows,
304
- };
305
- await this.loadData();
306
- this.updatePageParam(pageEvent.page + 1);
307
- }
308
- /**
309
- * Updates the 'page' query parameter in the URL.
310
- * @param newPage - The new page number to set in the URL
311
- * @private
312
- */
313
- updatePageParam(newPage) {
314
- const queryParams = { page: newPage };
315
- this.router.navigate([], {
316
- relativeTo: this.route,
317
- queryParams: queryParams,
318
- queryParamsHandling: 'merge',
319
- });
320
- }
321
- /**
322
- * Handle actions triggered from the table or card view
323
- * @param param0 Object containing the item and action that was triggered
324
- */
325
- doAction(actionEvent) {
326
- this.onAction.emit(actionEvent);
327
- }
328
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, deps: [{ token: i1$2.ActivatedRoute }, { token: i1$2.Router }], target: i0.ɵɵFactoryTarget.Directive }); }
329
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: PaginationBase, isStandalone: true, inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAction: "onAction" }, ngImport: i0 }); }
330
- }
331
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, decorators: [{
332
- type: Directive
333
- }], ctorParameters: () => [{ type: i1$2.ActivatedRoute }, { type: i1$2.Router }] });
334
-
335
- class ConfirmService {
336
- constructor() {
337
- this.pdialogService = inject(DialogService);
338
- }
339
- openConfirm(title = '', message = '', acceptText = 'Aceptar') {
340
- const dialogRef = this.pdialogService.open(ConfirmComponent, {
341
- data: {
342
- message: message,
343
- title: title,
344
- acceptText,
345
- },
346
- closable: true,
347
- modal: true,
348
- });
349
- return dialogRef.onClose;
350
- }
351
- confirm(options) {
352
- const dialogRef = this.pdialogService.open(ConfirmComponent, {
353
- data: {
354
- message: options.message || '',
355
- title: options.title || 'Confirmación',
356
- acceptText: options.acceptText || 'Aceptar',
357
- cancelText: options.cancelText || 'Cancelar',
358
- warning: options.warning || null,
359
- oneBotton: options.oneBotton || false,
360
- piIcon: options.piIcon || null,
361
- },
362
- closable: true,
363
- modal: true,
364
- });
365
- return firstValueFrom(dialogRef.onClose);
366
- }
367
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
368
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, providedIn: 'root' }); }
369
- }
370
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, decorators: [{
371
- type: Injectable,
372
- args: [{
373
- providedIn: 'root',
374
- }]
375
- }], ctorParameters: () => [] });
376
-
377
- /**
378
- * Extracts and parses the first JSON object or array found within a string.
379
- *
380
- * @param content - The input string that may contain JSON data
381
- * @returns {any} The parsed JSON data if found and valid, or null if:
382
- * - No JSON object/array is found in the string
383
- * - The found JSON is invalid and cannot be parsed
384
- *
385
- * @example
386
- * // Returns {name: "John"}
387
- * extractJsonFromString('Some text {"name": "John"} more text');
388
- *
389
- * // Returns [1, 2, 3]
390
- * extractJsonFromString('Before [1,2,3] after');
391
- *
392
- * // Returns null
393
- * extractJsonFromString('No JSON here');
394
- */
395
- function extractJsonFromString(content) {
396
- console.log(content);
397
- try {
398
- // First try to parse the entire string as JSON
399
- return JSON.parse(content);
400
- }
401
- catch {
402
- try {
403
- // If that fails, try to find the first valid JSON object or array in the string
404
- const matches = content.match(/(\{[\s\S]*\}|\[[\s\S]*\])/g);
405
- if (!matches)
406
- return null;
407
- // Try each matched potential JSON string until we find a valid one
408
- for (const match of matches) {
409
- try {
410
- return JSON.parse(match);
411
- }
412
- catch {
413
- continue;
414
- }
415
- }
416
- return null;
417
- }
418
- catch (error) {
419
- console.error('Error parsing JSON:', error);
420
- return null;
421
- }
422
- }
423
- }
424
-
425
219
  class DCProgressToastComponent {
426
220
  constructor() {
427
221
  this.messageService = inject(MessageService);
@@ -558,7 +352,21 @@ class LoadingBarService {
558
352
  this.color = '#4BBD97';
559
353
  setTimeout(() => {
560
354
  this.hideProgressBar();
561
- }, 1600);
355
+ }, 1100);
356
+ }
357
+ infoAndHide() {
358
+ // Clear any existing progress interval
359
+ if (this.progressInterval) {
360
+ clearInterval(this.progressInterval);
361
+ this.progressInterval = null;
362
+ }
363
+ this.isShowing = true;
364
+ this.mode = 'indeterminate';
365
+ this.progress = 100;
366
+ this.color = '#45C8F3';
367
+ setTimeout(() => {
368
+ this.hideProgressBar();
369
+ }, 1000);
562
370
  }
563
371
  /**
564
372
  * Demonstrates the loading bar by simulating progress from 0% to 100% over 5 seconds.
@@ -669,7 +477,9 @@ class QuickTableComponent {
669
477
  });
670
478
  }
671
479
  initializeTableColumns() {
672
- if (!this.columns()) {
480
+ debugger;
481
+ console.log('tableData', this.columns());
482
+ if (!this.columns() || this.columns().length === 0) {
673
483
  console.warn('No columns provided. please privide columns for acuracy');
674
484
  if (this.tableData()[0]) {
675
485
  this.tableColumns = Object.keys(this.tableData()[0]).map((key) => ({
@@ -750,6 +560,282 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
750
560
  args: ['dataTable']
751
561
  }] } });
752
562
 
563
+ const TOAST_ALERTS_TOKEN = new InjectionToken('Toast alerts Service');
564
+ class ToastAlertsAbstractService {
565
+ }
566
+ function provideToastAlert(serviceImplementation) {
567
+ return [
568
+ {
569
+ provide: TOAST_ALERTS_TOKEN,
570
+ useExisting: serviceImplementation,
571
+ },
572
+ ];
573
+ }
574
+ // @deprecated, moved to ngx-tts
575
+ var AudioSpeed;
576
+ (function (AudioSpeed) {
577
+ AudioSpeed["VerySlow"] = "verySlow";
578
+ AudioSpeed["Slow"] = "slow";
579
+ AudioSpeed["Regular"] = "regular";
580
+ AudioSpeed["Fast"] = "fast";
581
+ AudioSpeed["VeryFast"] = "veryFast";
582
+ })(AudioSpeed || (AudioSpeed = {}));
583
+
584
+ /**
585
+ * Abstract base class for implementing pagination functionality.
586
+ * Provides common pagination logic, state management, and navigation handling.
587
+ * Child classes must implement the loadData method and define columns.
588
+ */
589
+ class PaginationBase {
590
+ /**
591
+ * Creates an instance of PaginationBase.
592
+ * @param route - The ActivatedRoute for accessing route parameters
593
+ * @param router - The Router for navigation
594
+ */
595
+ constructor() {
596
+ /**
597
+ * Available actions for items.
598
+ * Must be implemented by child classes.
599
+ */
600
+ this.actions = input();
601
+ /**
602
+ * Event emitted when an action is performed on an item.
603
+ * Emits an object containing the item and the action that was triggered.
604
+ */
605
+ this.onAction = output();
606
+ /** Current first record index for the paginator */
607
+ this.paginatorFirst = 0;
608
+ /** Number of rows to display per page */
609
+ this.paginatorRows = 10;
610
+ /** Total number of records available */
611
+ this.totalRecords = 0;
612
+ /** Current view mode, either cards or table */
613
+ this.viewMode = 'table';
614
+ /** Loading state indicator */
615
+ this.isLoading = false;
616
+ /** Available button actions for items */
617
+ this.buttonActions = [];
618
+ /**
619
+ * Configuration for filtering, sorting, and pagination.
620
+ * Includes current page, rows per page, sorting criteria, and applied filters.
621
+ */
622
+ this.filterConfig = { page: 0, rowsPerPage: this.paginatorRows, sort: { _id: -1 }, filters: {} };
623
+ this.route = inject(ActivatedRoute);
624
+ this.router = inject(Router);
625
+ this.initializePagination();
626
+ }
627
+ /**
628
+ * Initializes pagination based on URL query parameters.
629
+ * Sets the current page from the 'page' query parameter if available.
630
+ * @private
631
+ */
632
+ initializePagination() {
633
+ const page = this.route.snapshot.queryParamMap.get('page');
634
+ if (page) {
635
+ this.filterConfig.page = +page - 1;
636
+ this.paginatorFirst = this.filterConfig.page * this.paginatorRows;
637
+ }
638
+ }
639
+ /**
640
+ * Handles pagination events from the paginator component.
641
+ * Updates the filter configuration, loads new data, and updates the URL.
642
+ * @param pageEvent - The page event containing page number and rows per page
643
+ */
644
+ async onPageChange(pageEvent) {
645
+ this.paginatorRows = pageEvent.rows;
646
+ this.filterConfig = {
647
+ ...this.filterConfig,
648
+ page: pageEvent.page,
649
+ rowsPerPage: this.paginatorRows,
650
+ };
651
+ await this.loadData();
652
+ this.updatePageParam(pageEvent.page + 1);
653
+ }
654
+ /**
655
+ * Updates the 'page' query parameter in the URL.
656
+ * @param newPage - The new page number to set in the URL
657
+ * @private
658
+ */
659
+ updatePageParam(newPage) {
660
+ const queryParams = { page: newPage };
661
+ this.router.navigate([], {
662
+ relativeTo: this.route,
663
+ queryParams: queryParams,
664
+ queryParamsHandling: 'merge',
665
+ });
666
+ }
667
+ /**
668
+ * Handle actions triggered from the table or card view
669
+ * @param param0 Object containing the item and action that was triggered
670
+ */
671
+ doAction(actionEvent) {
672
+ this.onAction.emit(actionEvent);
673
+ }
674
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
675
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.4", type: PaginationBase, isStandalone: true, inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAction: "onAction" }, ngImport: i0 }); }
676
+ }
677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, decorators: [{
678
+ type: Directive
679
+ }], ctorParameters: () => [] });
680
+
681
+ /**
682
+ * Extracts and parses the first JSON object or array found within a string.
683
+ *
684
+ * @param content - The input string that may contain JSON data
685
+ * @returns {any} The parsed JSON data if found and valid, or null if:
686
+ * - No JSON object/array is found in the string
687
+ * - The found JSON is invalid and cannot be parsed
688
+ *
689
+ * @example
690
+ * // Returns {name: "John"}
691
+ * extractJsonFromString('Some text {"name": "John"} more text');
692
+ *
693
+ * // Returns [1, 2, 3]
694
+ * extractJsonFromString('Before [1,2,3] after');
695
+ *
696
+ * // Returns null
697
+ * extractJsonFromString('No JSON here');
698
+ */
699
+ function extractJsonFromString(content) {
700
+ console.log(content);
701
+ try {
702
+ // First try to parse the entire string as JSON
703
+ return JSON.parse(content);
704
+ }
705
+ catch {
706
+ try {
707
+ // If that fails, try to find the first valid JSON object or array in the string
708
+ const matches = content.match(/(\{[\s\S]*\}|\[[\s\S]*\])/g);
709
+ if (!matches)
710
+ return null;
711
+ // Try each matched potential JSON string until we find a valid one
712
+ for (const match of matches) {
713
+ try {
714
+ return JSON.parse(match);
715
+ }
716
+ catch {
717
+ continue;
718
+ }
719
+ }
720
+ return null;
721
+ }
722
+ catch (error) {
723
+ console.error('Error parsing JSON:', error);
724
+ return null;
725
+ }
726
+ }
727
+ }
728
+
729
+ class ConfirmService {
730
+ constructor() {
731
+ this.pdialogService = inject(DialogService);
732
+ }
733
+ openConfirm(title = '', message = '', acceptText = 'Aceptar') {
734
+ const dialogRef = this.pdialogService.open(ConfirmComponent, {
735
+ data: {
736
+ message: message,
737
+ title: title,
738
+ acceptText,
739
+ },
740
+ closable: true,
741
+ modal: true,
742
+ });
743
+ return dialogRef.onClose;
744
+ }
745
+ confirm(options) {
746
+ const dialogRef = this.pdialogService.open(ConfirmComponent, {
747
+ data: {
748
+ message: options.message || '',
749
+ title: options.title || 'Confirmación',
750
+ acceptText: options.acceptText || 'Aceptar',
751
+ cancelText: options.cancelText || 'Cancelar',
752
+ warning: options.warning || null,
753
+ oneBotton: options.oneBotton || false,
754
+ piIcon: options.piIcon || null,
755
+ },
756
+ closable: true,
757
+ modal: true,
758
+ });
759
+ return firstValueFrom(dialogRef.onClose);
760
+ }
761
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
762
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, providedIn: 'root' }); }
763
+ }
764
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, decorators: [{
765
+ type: Injectable,
766
+ args: [{
767
+ providedIn: 'root',
768
+ }]
769
+ }], ctorParameters: () => [] });
770
+
771
+ class PromptComponent {
772
+ constructor() {
773
+ this.ref = inject(DynamicDialogRef);
774
+ this.config = inject(DynamicDialogConfig);
775
+ this.title = signal('Prompt');
776
+ this.message = signal('');
777
+ this.acceptText = signal('Accept');
778
+ this.cancelText = signal('Cancel');
779
+ this.inputValue = signal('');
780
+ }
781
+ ngOnInit() {
782
+ this.title.set(this.config.data?.title || 'Prompt');
783
+ this.message.set(this.config.data?.message || '');
784
+ this.acceptText.set(this.config.data?.acceptText || 'Accept');
785
+ this.cancelText.set(this.config.data?.cancelText || 'Cancel');
786
+ // Set initial value if provided
787
+ this.inputValue.set(this.config.data?.initialValue || '');
788
+ }
789
+ accept() {
790
+ this.ref.close(this.inputValue());
791
+ }
792
+ cancel() {
793
+ this.ref.close(null);
794
+ }
795
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
796
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.4", type: PromptComponent, isStandalone: true, selector: "dc-prompt", ngImport: i0, template: "<div class=\"form-input-card p-4\">\n <p-message severity=\"secondary\"> {{ title() }}</p-message>\n\n <div class=\"my-4\">{{ message() }}</div>\n\n <div class=\"p-field mb-4\">\n <textarea rows=\"5\" cols=\"30\" pTextarea [(ngModel)]=\"inputValue\" class=\"w-full\"></textarea>\n </div>\n\n <div class=\"flex justify-content-end gap-2\">\n <p-button [label]=\"cancelText()\" (click)=\"cancel()\" severity=\"secondary\"></p-button>\n <p-button [label]=\"acceptText()\" (click)=\"accept()\"></p-button>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i2.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i4$2.Textarea, selector: "[pTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }] }); }
797
+ }
798
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptComponent, decorators: [{
799
+ type: Component,
800
+ args: [{ selector: 'dc-prompt', standalone: true, imports: [CommonModule, ButtonModule, InputTextModule, FormsModule, MessageModule, TextareaModule], template: "<div class=\"form-input-card p-4\">\n <p-message severity=\"secondary\"> {{ title() }}</p-message>\n\n <div class=\"my-4\">{{ message() }}</div>\n\n <div class=\"p-field mb-4\">\n <textarea rows=\"5\" cols=\"30\" pTextarea [(ngModel)]=\"inputValue\" class=\"w-full\"></textarea>\n </div>\n\n <div class=\"flex justify-content-end gap-2\">\n <p-button [label]=\"cancelText()\" (click)=\"cancel()\" severity=\"secondary\"></p-button>\n <p-button [label]=\"acceptText()\" (click)=\"accept()\"></p-button>\n </div>\n</div>\n" }]
801
+ }] });
802
+
803
+ class PromptService {
804
+ constructor() {
805
+ this.dialogService = inject(DialogService);
806
+ }
807
+ /**
808
+ * Opens a prompt dialog.
809
+ * @param options Configuration options for the prompt dialog.
810
+ * @returns A promise that resolves with the input value if accepted, or null if canceled.
811
+ */
812
+ openPrompt(options) {
813
+ const dialogRef = this.dialogService.open(PromptComponent, {
814
+ data: {
815
+ title: options.title || 'Prompt',
816
+ message: options.message || '',
817
+ acceptText: options.acceptText || 'Accept',
818
+ cancelText: options.cancelText || 'Cancel',
819
+ initialValue: options.initialValue || '', // Pass initialValue to component data
820
+ },
821
+ header: options.title || 'Prompt', // Set header for accessibility and title bar
822
+ closable: true,
823
+ modal: true,
824
+ width: '700px', // Optional: Adjust width as needed
825
+ });
826
+ // Return the result when the dialog closes
827
+ return firstValueFrom(dialogRef.onClose);
828
+ }
829
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
830
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptService, providedIn: 'root' }); }
831
+ }
832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PromptService, decorators: [{
833
+ type: Injectable,
834
+ args: [{
835
+ providedIn: 'root',
836
+ }]
837
+ }] });
838
+
753
839
  /**
754
840
  * Injection token for HttpCoreService configuration
755
841
  */
@@ -1231,10 +1317,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
1231
1317
  /*
1232
1318
  * Public API Surface of core-components
1233
1319
  */
1320
+ // Components
1234
1321
 
1235
1322
  /**
1236
1323
  * Generated bundle index. Do not edit.
1237
1324
  */
1238
1325
 
1239
- export { AudioSpeed, ConfirmComponent, ConfirmService, DCFilterBarComponent, DCProgressToastComponent, EmptyStateComponent, GetPathPipe, HTTP_CORE_CONFIG, HttpCoreService, LoadingBarComponent, LoadingBarService, OptionValue, PaginationBase, QuickTableComponent, TOAST_ALERTS_TOKEN, ToastAlertsAbstractService, availibleFilters, extractJsonFromString, provideToastAlert, sortOptions, sortTypes };
1326
+ export { AudioSpeed, ConfirmComponent, ConfirmService, DCFilterBarComponent, DCProgressToastComponent, EmptyStateComponent, GetPathPipe, HTTP_CORE_CONFIG, HttpCoreService, LoadingBarComponent, LoadingBarService, OptionValue, PaginationBase, PromptService, QuickTableComponent, TOAST_ALERTS_TOKEN, ToastAlertsAbstractService, availibleFilters, extractJsonFromString, provideToastAlert, sortOptions, sortTypes };
1240
1327
  //# sourceMappingURL=dataclouder-ngx-core.mjs.map