@dataclouder/ngx-core 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/dataclouder-ngx-core.mjs +646 -163
- package/fesm2022/dataclouder-ngx-core.mjs.map +1 -1
- package/lib/components/confirm/confirm.component.d.ts +4 -3
- package/lib/components/empty-state/empty-state.component.d.ts +2 -2
- package/lib/components/list-filter-bar/dc-list-filter-bar.component.d.ts +7 -6
- package/lib/components/loading-bar/loading-bar.d.ts +2 -1
- package/lib/components/progress-toast/progress-toast.d.ts +7 -7
- package/lib/components/quick-table/quick-table.d.ts +13 -15
- package/lib/models/pagination.abstract.d.ts +3 -4
- package/lib/services/confirm.service.d.ts +2 -1
- package/lib/services/http-core.service.d.ts +204 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/README.md +0 -24
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { NgIf, CommonModule } from '@angular/common';
|
|
2
|
+
import { input, Input, Component, output, ChangeDetectionStrategy, inject, HostListener, InjectionToken, Directive, Injectable, ChangeDetectorRef, Pipe, signal, effect, ViewChild, Optional, Inject } from '@angular/core';
|
|
4
3
|
import * as i1 from '@angular/forms';
|
|
5
4
|
import { FormsModule } from '@angular/forms';
|
|
6
|
-
import * as
|
|
5
|
+
import * as i1$1 from 'primeng/button';
|
|
7
6
|
import { ButtonModule } from 'primeng/button';
|
|
8
7
|
import * as i4 from 'primeng/dialog';
|
|
9
8
|
import { DialogModule } from 'primeng/dialog';
|
|
@@ -13,43 +12,44 @@ import * as i6 from 'primeng/multiselect';
|
|
|
13
12
|
import { MultiSelectModule } from 'primeng/multiselect';
|
|
14
13
|
import * as i7 from 'primeng/calendar';
|
|
15
14
|
import { CalendarModule } from 'primeng/calendar';
|
|
16
|
-
import * as
|
|
17
|
-
import { MessageService } from 'primeng/api';
|
|
18
|
-
import
|
|
15
|
+
import * as i3 from 'primeng/api';
|
|
16
|
+
import { MessageService, FilterMatchMode } from 'primeng/api';
|
|
17
|
+
import { DynamicDialogConfig, DynamicDialogRef, DialogService } from 'primeng/dynamicdialog';
|
|
18
|
+
import * as i2 from 'primeng/message';
|
|
19
19
|
import { MessageModule } from 'primeng/message';
|
|
20
|
-
import * as i1$2 from '
|
|
21
|
-
import * as i1$3 from '@angular/router';
|
|
20
|
+
import * as i1$2 from '@angular/router';
|
|
22
21
|
import { RouterModule } from '@angular/router';
|
|
23
|
-
import { firstValueFrom } from 'rxjs';
|
|
24
|
-
import * as
|
|
22
|
+
import { firstValueFrom, tap, catchError, lastValueFrom, throwError } from 'rxjs';
|
|
23
|
+
import * as i3$1 from 'primeng/progressbar';
|
|
25
24
|
import { ProgressBarModule, ProgressBar } from 'primeng/progressbar';
|
|
26
|
-
import * as
|
|
25
|
+
import * as i2$1 from 'primeng/toast';
|
|
27
26
|
import { ToastModule, Toast } from 'primeng/toast';
|
|
28
27
|
import { CardModule } from 'primeng/card';
|
|
28
|
+
import * as i4$1 from 'primeng/inputtext';
|
|
29
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
29
30
|
import { SpeedDialModule } from 'primeng/speeddial';
|
|
30
31
|
import { PaginatorModule } from 'primeng/paginator';
|
|
31
|
-
import * as
|
|
32
|
+
import * as i3$2 from 'primeng/table';
|
|
32
33
|
import { TableModule } from 'primeng/table';
|
|
33
34
|
import { get } from 'lodash';
|
|
35
|
+
import { HttpClient } from '@angular/common/http';
|
|
34
36
|
|
|
35
37
|
class EmptyStateComponent {
|
|
36
38
|
constructor() {
|
|
37
39
|
this.headingText = 'No existe el recurso que buscas';
|
|
38
40
|
this.subHeadingText = 'Intenta más tarde';
|
|
39
|
-
this.mainIconSrcString = 'assets/img/empty-states/empty-box.png';
|
|
41
|
+
this.mainIconSrcString = input('assets/img/empty-states/empty-box.png');
|
|
40
42
|
}
|
|
41
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
42
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
43
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EmptyStateComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
44
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: EmptyStateComponent, isStandalone: true, selector: "dc-empty-state", inputs: { headingText: { classPropertyName: "headingText", publicName: "headingText", isSignal: false, isRequired: false, transformFunction: null }, subHeadingText: { classPropertyName: "subHeadingText", publicName: "subHeadingText", isSignal: false, isRequired: false, transformFunction: null }, mainIconSrcString: { classPropertyName: "mainIconSrcString", publicName: "mainIconSrcString", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div class=\"grid justify-content-center\">\n <div class=\"empty-state-content\">\n @if (headingText) {\n <h5 class=\"text-center\">{{ headingText }}</h5>\n }\n <img width=\"180px\" class=\"image-empty-state\" src=\"{{ mainIconSrcString() }}\" />\n @if (subHeadingText) {\n <h6>{{ subHeadingText }}</h6>\n }\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".empty-state-content{padding-top:20px}.empty-state-content .image-empty-state{filter:grayscale(40%);padding-top:10px}\n"] }); }
|
|
43
45
|
}
|
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EmptyStateComponent, decorators: [{
|
|
45
47
|
type: Component,
|
|
46
|
-
args: [{ selector: 'dc-empty-state', standalone: true, imports: [
|
|
48
|
+
args: [{ selector: 'dc-empty-state', standalone: true, imports: [], template: "<div class=\"grid justify-content-center\">\n <div class=\"empty-state-content\">\n @if (headingText) {\n <h5 class=\"text-center\">{{ headingText }}</h5>\n }\n <img width=\"180px\" class=\"image-empty-state\" src=\"{{ mainIconSrcString() }}\" />\n @if (subHeadingText) {\n <h6>{{ subHeadingText }}</h6>\n }\n <ng-content></ng-content>\n </div>\n</div>\n", styles: [".empty-state-content{padding-top:20px}.empty-state-content .image-empty-state{filter:grayscale(40%);padding-top:10px}\n"] }]
|
|
47
49
|
}], propDecorators: { headingText: [{
|
|
48
50
|
type: Input
|
|
49
51
|
}], subHeadingText: [{
|
|
50
52
|
type: Input
|
|
51
|
-
}], mainIconSrcString: [{
|
|
52
|
-
type: Input
|
|
53
53
|
}] } });
|
|
54
54
|
|
|
55
55
|
const availibleFilters = [
|
|
@@ -81,11 +81,16 @@ const sortTypes = [
|
|
|
81
81
|
const DEFAULT_FILTERS = { filters: {}, page: 0, rowsPerPage: 10, sort: { _id: -1 } };
|
|
82
82
|
class DCFilterBarComponent {
|
|
83
83
|
constructor() {
|
|
84
|
-
|
|
84
|
+
// Signal Inputs
|
|
85
|
+
this.isAdmin = input(true); // TODO: create a solution for is admin
|
|
86
|
+
this.items = input([]);
|
|
87
|
+
// Inputs
|
|
85
88
|
this.customFilters = [];
|
|
86
|
-
|
|
87
|
-
this.onFilterAction =
|
|
88
|
-
this.onChangeSort =
|
|
89
|
+
// Outputs
|
|
90
|
+
this.onFilterAction = output();
|
|
91
|
+
this.onChangeSort = output();
|
|
92
|
+
this.onNew = output();
|
|
93
|
+
// Internal State
|
|
89
94
|
this.customFilterModels = [];
|
|
90
95
|
this.availibleFilters = availibleFilters;
|
|
91
96
|
this.sortOptions = sortOptions;
|
|
@@ -119,9 +124,8 @@ class DCFilterBarComponent {
|
|
|
119
124
|
this.onChangeSort.emit(event.value);
|
|
120
125
|
}
|
|
121
126
|
createNew() {
|
|
122
|
-
// this.router.navigate(['edit/'], { relativeTo: this.route });
|
|
123
127
|
console.log('createNew from core components');
|
|
124
|
-
this.
|
|
128
|
+
this.onNew.emit('new');
|
|
125
129
|
}
|
|
126
130
|
search(text = null) {
|
|
127
131
|
if (!text) {
|
|
@@ -144,22 +148,14 @@ class DCFilterBarComponent {
|
|
|
144
148
|
doItemAction(filterEvent) {
|
|
145
149
|
this.onFilterAction.emit(filterEvent);
|
|
146
150
|
}
|
|
147
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
148
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.1", type: DCFilterBarComponent, isStandalone: true, selector: "dc-filter-bar", inputs: { isAdmin: "isAdmin", customFilters: "customFilters", items: "items" }, outputs: { onFilterAction: "onFilterAction", onChangeSort: "onChangeSort" }, 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: CommonModule }, { 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: i2.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: i1$1.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 }); }
|
|
151
|
+
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 }); }
|
|
149
153
|
}
|
|
150
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCFilterBarComponent, decorators: [{
|
|
151
155
|
type: Component,
|
|
152
|
-
args: [{ selector: 'dc-filter-bar', standalone: true, imports: [
|
|
153
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
154
|
-
type: Input
|
|
155
|
-
}], customFilters: [{
|
|
156
|
-
type: Input
|
|
157
|
-
}], items: [{
|
|
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
158
|
type: Input
|
|
159
|
-
}], onFilterAction: [{
|
|
160
|
-
type: Output
|
|
161
|
-
}], onChangeSort: [{
|
|
162
|
-
type: Output
|
|
163
159
|
}] } });
|
|
164
160
|
|
|
165
161
|
class ConfirmComponent {
|
|
@@ -169,9 +165,9 @@ class ConfirmComponent {
|
|
|
169
165
|
onEscapte(_event) {
|
|
170
166
|
this.cancel();
|
|
171
167
|
}
|
|
172
|
-
constructor(
|
|
173
|
-
this.dynamicDialogConfig =
|
|
174
|
-
this.ref =
|
|
168
|
+
constructor() {
|
|
169
|
+
this.dynamicDialogConfig = inject(DynamicDialogConfig);
|
|
170
|
+
this.ref = inject(DynamicDialogRef);
|
|
175
171
|
this.title = 'Confirmación';
|
|
176
172
|
if (this.dynamicDialogConfig.data) {
|
|
177
173
|
this.title = this.dynamicDialogConfig.data.title;
|
|
@@ -190,13 +186,13 @@ class ConfirmComponent {
|
|
|
190
186
|
confirm() {
|
|
191
187
|
this.ref.close(true);
|
|
192
188
|
}
|
|
193
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
194
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.
|
|
189
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
190
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: ConfirmComponent, isStandalone: true, selector: "app-confirm", inputs: { title: "title", message: "message", warning: "warning", oneBotton: "oneBotton", acceptText: "acceptText", cancelText: "cancelText", piIcon: "piIcon" }, host: { listeners: { "window:keyup.enter": "onEnter($event)", "window:keyup.escape": "onEscapte($event)" } }, ngImport: i0, template: "<div class=\"form-input-card\">\n <p-message severity=\"secondary\"> {{ title }}</p-message>\n\n <div style=\"text-align: center; padding: 1rem\">\n <i style=\"font-size: 4rem; color: #ff0040\" class=\"pi {{ piIcon }}\"></i>\n </div>\n\n <div>{{ message }} </div>\n\n @if (warning) {\n <p-message severity=\"warn\">\n <i class=\"pi pi-exclamation-triangle\"></i>\n {{ warning }}</p-message\n >\n }\n\n <br /><br />\n\n <div>\n <div style=\"float: right\">\n @if (oneBotton) {\n <p-button label=\"Ok\" (click)=\"confirm()\"></p-button>\n }\n </div>\n\n @if (!oneBotton) {\n <div class=\"options\">\n <p-button [label]=\"cancelText\" (click)=\"cancel()\" severity=\"secondary\"></p-button>\n <p-button [label]=\"acceptText\" (click)=\"confirm()\" severity=\"danger\"></p-button>\n </div>\n }\n </div>\n </div>\n", styles: [".options{display:flex;justify-content:space-between}.subtext{color:#353535;font-size:small}nb-card{min-width:50vw;max-width:88vw;max-height:90vh}\n"], dependencies: [{ 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: 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"] }] }); }
|
|
195
191
|
}
|
|
196
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmComponent, decorators: [{
|
|
197
193
|
type: Component,
|
|
198
|
-
args: [{ selector: 'app-confirm', standalone: true, imports: [
|
|
199
|
-
}], ctorParameters: () => [
|
|
194
|
+
args: [{ selector: 'app-confirm', standalone: true, imports: [ButtonModule, MessageModule], template: "<div class=\"form-input-card\">\n <p-message severity=\"secondary\"> {{ title }}</p-message>\n\n <div style=\"text-align: center; padding: 1rem\">\n <i style=\"font-size: 4rem; color: #ff0040\" class=\"pi {{ piIcon }}\"></i>\n </div>\n\n <div>{{ message }} </div>\n\n @if (warning) {\n <p-message severity=\"warn\">\n <i class=\"pi pi-exclamation-triangle\"></i>\n {{ warning }}</p-message\n >\n }\n\n <br /><br />\n\n <div>\n <div style=\"float: right\">\n @if (oneBotton) {\n <p-button label=\"Ok\" (click)=\"confirm()\"></p-button>\n }\n </div>\n\n @if (!oneBotton) {\n <div class=\"options\">\n <p-button [label]=\"cancelText\" (click)=\"cancel()\" severity=\"secondary\"></p-button>\n <p-button [label]=\"acceptText\" (click)=\"confirm()\" severity=\"danger\"></p-button>\n </div>\n }\n </div>\n </div>\n", styles: [".options{display:flex;justify-content:space-between}.subtext{color:#353535;font-size:small}nb-card{min-width:50vw;max-width:88vw;max-height:90vh}\n"] }]
|
|
195
|
+
}], ctorParameters: () => [], propDecorators: { title: [{
|
|
200
196
|
type: Input
|
|
201
197
|
}], message: [{
|
|
202
198
|
type: Input
|
|
@@ -229,6 +225,7 @@ function provideToastAlert(serviceImplementation) {
|
|
|
229
225
|
},
|
|
230
226
|
];
|
|
231
227
|
}
|
|
228
|
+
// @deprecated, moved to ngx-tts
|
|
232
229
|
var AudioSpeed;
|
|
233
230
|
(function (AudioSpeed) {
|
|
234
231
|
AudioSpeed["VerySlow"] = "verySlow";
|
|
@@ -252,11 +249,16 @@ class PaginationBase {
|
|
|
252
249
|
constructor(route, router) {
|
|
253
250
|
this.route = route;
|
|
254
251
|
this.router = router;
|
|
252
|
+
/**
|
|
253
|
+
* Available actions for items.
|
|
254
|
+
* Must be implemented by child classes.
|
|
255
|
+
*/
|
|
256
|
+
this.actions = input();
|
|
255
257
|
/**
|
|
256
258
|
* Event emitted when an action is performed on an item.
|
|
257
259
|
* Emits an object containing the item and the action that was triggered.
|
|
258
260
|
*/
|
|
259
|
-
this.onAction =
|
|
261
|
+
this.onAction = output();
|
|
260
262
|
/** Current first record index for the paginator */
|
|
261
263
|
this.paginatorFirst = 0;
|
|
262
264
|
/** Number of rows to display per page */
|
|
@@ -323,20 +325,16 @@ class PaginationBase {
|
|
|
323
325
|
doAction(actionEvent) {
|
|
324
326
|
this.onAction.emit(actionEvent);
|
|
325
327
|
}
|
|
326
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
327
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
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 }); }
|
|
328
330
|
}
|
|
329
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, decorators: [{
|
|
330
332
|
type: Directive
|
|
331
|
-
}], ctorParameters: () => [{ type: i1$
|
|
332
|
-
type: Input
|
|
333
|
-
}], onAction: [{
|
|
334
|
-
type: Output
|
|
335
|
-
}] } });
|
|
333
|
+
}], ctorParameters: () => [{ type: i1$2.ActivatedRoute }, { type: i1$2.Router }] });
|
|
336
334
|
|
|
337
335
|
class ConfirmService {
|
|
338
|
-
constructor(
|
|
339
|
-
this.pdialogService =
|
|
336
|
+
constructor() {
|
|
337
|
+
this.pdialogService = inject(DialogService);
|
|
340
338
|
}
|
|
341
339
|
openConfirm(title = '', message = '', acceptText = 'Aceptar') {
|
|
342
340
|
const dialogRef = this.pdialogService.open(ConfirmComponent, {
|
|
@@ -366,15 +364,15 @@ class ConfirmService {
|
|
|
366
364
|
});
|
|
367
365
|
return firstValueFrom(dialogRef.onClose);
|
|
368
366
|
}
|
|
369
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
370
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
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' }); }
|
|
371
369
|
}
|
|
372
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, decorators: [{
|
|
373
371
|
type: Injectable,
|
|
374
372
|
args: [{
|
|
375
373
|
providedIn: 'root',
|
|
376
374
|
}]
|
|
377
|
-
}], ctorParameters: () => [
|
|
375
|
+
}], ctorParameters: () => [] });
|
|
378
376
|
|
|
379
377
|
/**
|
|
380
378
|
* Extracts and parses the first JSON object or array found within a string.
|
|
@@ -425,13 +423,13 @@ function extractJsonFromString(content) {
|
|
|
425
423
|
}
|
|
426
424
|
|
|
427
425
|
class DCProgressToastComponent {
|
|
428
|
-
constructor(
|
|
429
|
-
this.messageService =
|
|
430
|
-
this.cdr =
|
|
426
|
+
constructor() {
|
|
427
|
+
this.messageService = inject(MessageService);
|
|
428
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
431
429
|
this.visible = false;
|
|
432
|
-
this.progress = 0;
|
|
433
|
-
this.processCompleted =
|
|
434
|
-
this.processClosed =
|
|
430
|
+
this.progress = input(0);
|
|
431
|
+
this.processCompleted = output();
|
|
432
|
+
this.processClosed = output();
|
|
435
433
|
}
|
|
436
434
|
ngOnChanges(changes) {
|
|
437
435
|
if (changes['visible'] && changes['visible'].currentValue) {
|
|
@@ -442,7 +440,7 @@ class DCProgressToastComponent {
|
|
|
442
440
|
}
|
|
443
441
|
// Handle progress changes
|
|
444
442
|
if (changes['progress']) {
|
|
445
|
-
if (this.progress >= 100) {
|
|
443
|
+
if (this.progress() >= 100) {
|
|
446
444
|
this.onComplete();
|
|
447
445
|
}
|
|
448
446
|
this.cdr.markForCheck();
|
|
@@ -478,20 +476,14 @@ class DCProgressToastComponent {
|
|
|
478
476
|
this.messageService.clear('confirm');
|
|
479
477
|
this.processClosed.emit();
|
|
480
478
|
}
|
|
481
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
482
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
479
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCProgressToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
480
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.4", type: DCProgressToastComponent, isStandalone: true, selector: "dc-progress-toast", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: false, isRequired: false, transformFunction: null }, progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { processCompleted: "processCompleted", processClosed: "processClosed" }, providers: [MessageService], usesOnChanges: true, ngImport: i0, template: "<div class=\"card flex justify-center\">\n <p-toast position=\"top-center\" key=\"confirm\" (onClose)=\"onClose()\" [baseZIndex]=\"9000\">\n <ng-template let-message #headless let-closeFn=\"closeFn\">\n <section style=\"padding: 15px\">\n <div>\n <i class=\"pi pi-cloud-upload\"></i>\n <span>{{ message.summary }}</span>\n </div>\n <div>\n <p-progressbar [value]=\"progress()\" [showValue]=\"false\" [style]=\"{ height: '6px' }\" />\n\n <label style=\"color: beige\">{{ progress() }}% uploaded</label>\n </div>\n <div>\n <p-button label=\"Another Upload?\" (click)=\"closeFn($event)\" size=\"small\" />\n <p-button label=\"Cancel\" (click)=\"closeFn($event)\" size=\"small\" />\n </div>\n </section>\n </ng-template>\n </p-toast>\n</div>\n", styles: [""], dependencies: [{ 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: ToastModule }, { kind: "component", type: i2$1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i3$1.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }] }); }
|
|
483
481
|
}
|
|
484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCProgressToastComponent, decorators: [{
|
|
485
483
|
type: Component,
|
|
486
|
-
args: [{ selector: 'dc-progress-toast', standalone: true, providers: [MessageService], imports: [ButtonModule,
|
|
487
|
-
}], ctorParameters: () => [
|
|
484
|
+
args: [{ selector: 'dc-progress-toast', standalone: true, providers: [MessageService], imports: [ButtonModule, ToastModule, ProgressBarModule, Toast, ButtonModule, ProgressBar], template: "<div class=\"card flex justify-center\">\n <p-toast position=\"top-center\" key=\"confirm\" (onClose)=\"onClose()\" [baseZIndex]=\"9000\">\n <ng-template let-message #headless let-closeFn=\"closeFn\">\n <section style=\"padding: 15px\">\n <div>\n <i class=\"pi pi-cloud-upload\"></i>\n <span>{{ message.summary }}</span>\n </div>\n <div>\n <p-progressbar [value]=\"progress()\" [showValue]=\"false\" [style]=\"{ height: '6px' }\" />\n\n <label style=\"color: beige\">{{ progress() }}% uploaded</label>\n </div>\n <div>\n <p-button label=\"Another Upload?\" (click)=\"closeFn($event)\" size=\"small\" />\n <p-button label=\"Cancel\" (click)=\"closeFn($event)\" size=\"small\" />\n </div>\n </section>\n </ng-template>\n </p-toast>\n</div>\n" }]
|
|
485
|
+
}], ctorParameters: () => [], propDecorators: { visible: [{
|
|
488
486
|
type: Input
|
|
489
|
-
}], progress: [{
|
|
490
|
-
type: Input
|
|
491
|
-
}], processCompleted: [{
|
|
492
|
-
type: Output
|
|
493
|
-
}], processClosed: [{
|
|
494
|
-
type: Output
|
|
495
487
|
}] } });
|
|
496
488
|
|
|
497
489
|
/**
|
|
@@ -619,10 +611,10 @@ class LoadingBarService {
|
|
|
619
611
|
}
|
|
620
612
|
}, intervalMs);
|
|
621
613
|
}
|
|
622
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
623
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
614
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
615
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarService, providedIn: 'root' }); }
|
|
624
616
|
}
|
|
625
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarService, decorators: [{
|
|
626
618
|
type: Injectable,
|
|
627
619
|
args: [{
|
|
628
620
|
providedIn: 'root',
|
|
@@ -630,25 +622,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
630
622
|
}], ctorParameters: () => [] });
|
|
631
623
|
|
|
632
624
|
class LoadingBarComponent {
|
|
633
|
-
constructor(
|
|
634
|
-
this.loadingBarService =
|
|
625
|
+
constructor() {
|
|
626
|
+
this.loadingBarService = inject(LoadingBarService);
|
|
635
627
|
}
|
|
636
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
637
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.
|
|
628
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
629
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: LoadingBarComponent, isStandalone: true, selector: "dc-loading-bar", providers: [MessageService], ngImport: i0, template: "@if (loadingBarService.isShowing) {\n<p-progressbar [color]=\"loadingBarService.color\" [mode]=\"loadingBarService.mode\" [style]=\"{ height: '4px' }\" [value]=\"loadingBarService.progress\" />\n}\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "ngmodule", type: ToastModule }, { kind: "ngmodule", type: ProgressBarModule }, { kind: "component", type: i3$1.ProgressBar, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: ["value", "showValue", "styleClass", "valueStyleClass", "style", "unit", "mode", "color"] }] }); }
|
|
638
630
|
}
|
|
639
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarComponent, decorators: [{
|
|
640
632
|
type: Component,
|
|
641
|
-
args: [{ selector: 'dc-loading-bar', standalone: true, providers: [MessageService], imports: [ButtonModule,
|
|
642
|
-
}], ctorParameters: () => [
|
|
633
|
+
args: [{ selector: 'dc-loading-bar', standalone: true, providers: [MessageService], imports: [ButtonModule, ToastModule, ProgressBarModule, ButtonModule, ProgressBar], template: "@if (loadingBarService.isShowing) {\n<p-progressbar [color]=\"loadingBarService.color\" [mode]=\"loadingBarService.mode\" [style]=\"{ height: '4px' }\" [value]=\"loadingBarService.progress\" />\n}\n" }]
|
|
634
|
+
}], ctorParameters: () => [] });
|
|
643
635
|
|
|
644
636
|
class GetPathPipe {
|
|
645
637
|
transform(obj, path) {
|
|
646
638
|
return get(obj, path, 'No disponible');
|
|
647
639
|
}
|
|
648
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
649
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.
|
|
640
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GetPathPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
641
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.4", ngImport: i0, type: GetPathPipe, isStandalone: true, name: "getPath" }); }
|
|
650
642
|
}
|
|
651
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GetPathPipe, decorators: [{
|
|
652
644
|
type: Pipe,
|
|
653
645
|
args: [{
|
|
654
646
|
name: 'getPath',
|
|
@@ -656,95 +648,586 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
656
648
|
}]
|
|
657
649
|
}] });
|
|
658
650
|
|
|
659
|
-
// TODO: extends PaginationBase this handle filter, pagination, and url params ?page=1
|
|
660
651
|
class QuickTableComponent {
|
|
661
|
-
constructor(
|
|
662
|
-
|
|
663
|
-
this.
|
|
664
|
-
this.
|
|
665
|
-
|
|
666
|
-
this.actions = [{ title: '
|
|
667
|
-
|
|
652
|
+
constructor() {
|
|
653
|
+
// Inputs
|
|
654
|
+
this.columns = input([]);
|
|
655
|
+
this.tableData = input([]);
|
|
656
|
+
// Default action is only select
|
|
657
|
+
this.actions = input([{ title: 'select', label: 'Select', icon: 'pi pi-check', severity: 'primary' }]);
|
|
658
|
+
// Outputs
|
|
659
|
+
this.onAction = output();
|
|
660
|
+
// Signals
|
|
661
|
+
this._columns = signal([]);
|
|
662
|
+
this.filters = signal({});
|
|
663
|
+
this.globalFilterFields = signal([]);
|
|
668
664
|
this.tableColumns = [];
|
|
669
|
-
// super(
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
this.initializeTableColumns();
|
|
675
|
-
this.cdr.detectChanges();
|
|
665
|
+
// super();
|
|
666
|
+
effect(() => {
|
|
667
|
+
this.initializeTableColumns();
|
|
668
|
+
this.initializeFilters();
|
|
669
|
+
});
|
|
676
670
|
}
|
|
677
|
-
|
|
678
|
-
if (this.
|
|
679
|
-
|
|
671
|
+
initializeTableColumns() {
|
|
672
|
+
if (!this.columns()) {
|
|
673
|
+
console.warn('No columns provided. please privide columns for acuracy');
|
|
674
|
+
if (this.tableData()[0]) {
|
|
675
|
+
this.tableColumns = Object.keys(this.tableData()[0]).map((key) => ({
|
|
676
|
+
field: key,
|
|
677
|
+
header: key,
|
|
678
|
+
sortable: true,
|
|
679
|
+
}));
|
|
680
|
+
console.log(this.tableColumns);
|
|
681
|
+
this._columns.set(this.tableColumns);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
// Transform string column names to column objects
|
|
686
|
+
this.tableColumns = this.columns().map((col) => ({
|
|
687
|
+
field: col,
|
|
688
|
+
header: col,
|
|
689
|
+
sortable: true,
|
|
690
|
+
}));
|
|
691
|
+
// Add actions column
|
|
692
|
+
this.tableColumns.push({
|
|
693
|
+
field: 'actions',
|
|
694
|
+
header: 'Actions',
|
|
695
|
+
});
|
|
696
|
+
this._columns.set(this.tableColumns);
|
|
680
697
|
}
|
|
681
|
-
console.log(this.columns, this.actions);
|
|
682
698
|
}
|
|
683
|
-
//
|
|
684
|
-
//
|
|
685
|
-
//
|
|
699
|
+
// private configureTable(): void {
|
|
700
|
+
// // Configure table properties programmatically if needed
|
|
701
|
+
// this.table.reset();
|
|
702
|
+
// this.table.rows = 5;
|
|
703
|
+
// this.table.paginator = true;
|
|
704
|
+
// this.table.rowsPerPageOptions = [5, 10, 20];
|
|
705
|
+
// this.table.tableStyle = { 'min-width': '50rem' };
|
|
706
|
+
// this.cdr.detectChanges();
|
|
686
707
|
// }
|
|
687
|
-
initializeTableColumns() {
|
|
688
|
-
// Transform string column names to column objects
|
|
689
|
-
this.tableColumns = this.columns.map((col) => ({
|
|
690
|
-
field: col,
|
|
691
|
-
header: col,
|
|
692
|
-
sortable: true,
|
|
693
|
-
}));
|
|
694
|
-
// Add actions column
|
|
695
|
-
this.tableColumns.push({
|
|
696
|
-
field: 'actions',
|
|
697
|
-
header: 'Actions',
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
configureTable() {
|
|
701
|
-
// Configure table properties programmatically if needed
|
|
702
|
-
this.table.reset();
|
|
703
|
-
this.table.rows = 5;
|
|
704
|
-
this.table.paginator = true;
|
|
705
|
-
this.table.rowsPerPageOptions = [5, 10, 20];
|
|
706
|
-
this.table.tableStyle = { 'min-width': '50rem' };
|
|
707
|
-
this.cdr.detectChanges();
|
|
708
|
-
}
|
|
709
708
|
selectItem(item, action) {
|
|
710
709
|
console.log('onAction', { item, action });
|
|
711
710
|
this.onAction.emit({ item, action: action.label });
|
|
712
711
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
712
|
+
onGlobalFilter(event) {
|
|
713
|
+
const value = event.target.value;
|
|
714
|
+
this.table.filterGlobal(value, FilterMatchMode.CONTAINS);
|
|
715
|
+
}
|
|
716
|
+
getFilterType(column) {
|
|
717
|
+
if (column.type === 'image') {
|
|
718
|
+
return 'text';
|
|
720
719
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
720
|
+
return 'text';
|
|
721
|
+
}
|
|
722
|
+
initializeFilters() {
|
|
723
|
+
// Initialize filters
|
|
724
|
+
const filterObj = {};
|
|
725
|
+
const fields = [];
|
|
726
|
+
if (this._columns()) {
|
|
727
|
+
this._columns().forEach((col) => {
|
|
728
|
+
if (col.field !== 'actions') {
|
|
729
|
+
// Add field to global filter fields
|
|
730
|
+
fields.push(col.field);
|
|
731
|
+
// Initialize filter for this column
|
|
732
|
+
filterObj[col.field] = {
|
|
733
|
+
value: null,
|
|
734
|
+
matchMode: FilterMatchMode.CONTAINS,
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
});
|
|
725
738
|
}
|
|
739
|
+
this.filters.set(filterObj);
|
|
740
|
+
this.globalFilterFields.set(fields);
|
|
726
741
|
}
|
|
727
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
728
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.
|
|
742
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: QuickTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
743
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.4", type: QuickTableComponent, isStandalone: true, selector: "app-quick-table", inputs: { columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, tableData: { classPropertyName: "tableData", publicName: "tableData", isSignal: true, isRequired: false, transformFunction: null }, actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAction: "onAction" }, viewQueries: [{ propertyName: "table", first: true, predicate: ["dataTable"], descendants: true }], ngImport: i0, template: "<p-table #dataTable [value]=\"tableData()\" [columns]=\"_columns()\" [globalFilterFields]=\"globalFilterFields()\" [filters]=\"filters()\">\n <ng-template pTemplate=\"caption\">\n <div class=\"flex justify-content-between align-items-center\">\n <h5 class=\"m-0\">Table Data</h5>\n <span class=\"p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onGlobalFilter($event)\" placeholder=\"Search keyword\" />\n </span>\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (column of columns; track column) {\n <th [pSortableColumn]=\"column.field\">{{ column.header }} <p-sortIcon [field]=\"column.field\"></p-sortIcon></th>\n }\n\n <th>Actions</th>\n </tr>\n <tr>\n @for (column of columns; track column) {\n <th>\n <p-columnFilter [type]=\"getFilterType(column)\" [field]=\"column.field\" placeholder=\"Search\" [showMenu]=\"false\"></p-columnFilter>\n </th>\n }\n <th></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-columns=\"columns\">\n <tr>\n @for (column of columns; track column) {\n <td>\n @if(column.type === 'image'){\n <div class=\"image-container\">\n <img src=\"{{ item | getPath: column.field }}\" alt=\"Image\" class=\"image\" />\n </div>\n } @else {\n <span>{{ item | getPath: column.field}} </span>\n }\n </td>\n }\n\n <td>\n <div style=\"display: flex; gap: 2px\">\n @for (actionBtn of actions(); track actionBtn) {\n <p-button (click)=\"selectItem(item, actionBtn)\" [icon]=\"actionBtn.icon\" [severity]=\"actionBtn['severity']\" />\n }\n </div>\n </td>\n </tr>\n </ng-template>\n</p-table>\n", styles: [":host{display:block;height:100%}.generic-list-container{display:flex;flex-direction:column;height:100%}.generic-list-content{margin-top:10px;flex:1;overflow-y:auto;padding-bottom:10px}.card-source{margin-bottom:10px;position:relative}.paginator-container{margin-top:auto;padding-top:10px}.image-container{width:50px;height:50px;border-radius:50%;overflow:hidden;display:flex;justify-content:center;align-items:center}.image-container img{width:100%;height:100%;object-fit:cover}\n"], dependencies: [{ kind: "ngmodule", type: CardModule }, { kind: "directive", type: i3.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { 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: SpeedDialModule }, { kind: "ngmodule", type: PaginatorModule }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i3$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i3$2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i3$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i3$2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel", "filterButtonProps"], outputs: ["onShow", "onHide"] }, { kind: "ngmodule", type: RouterModule }, { kind: "pipe", type: GetPathPipe, name: "getPath" }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i4$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
729
744
|
}
|
|
730
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: QuickTableComponent, decorators: [{
|
|
731
746
|
type: Component,
|
|
732
|
-
args: [{ selector: 'app-quick-table', imports: [CardModule, ButtonModule, SpeedDialModule, PaginatorModule, TableModule, RouterModule, GetPathPipe], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<p-table #dataTable [value]=\"tableData\" [columns]=\"
|
|
733
|
-
}], ctorParameters: () => [
|
|
734
|
-
type: Input
|
|
735
|
-
}], columns: [{
|
|
736
|
-
type: Input
|
|
737
|
-
}], tableData: [{
|
|
738
|
-
type: Input
|
|
739
|
-
}], actions: [{
|
|
740
|
-
type: Input
|
|
741
|
-
}], onAction: [{
|
|
742
|
-
type: Output
|
|
743
|
-
}], table: [{
|
|
747
|
+
args: [{ selector: 'app-quick-table', imports: [CardModule, ButtonModule, SpeedDialModule, PaginatorModule, TableModule, RouterModule, GetPathPipe, InputTextModule], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, template: "<p-table #dataTable [value]=\"tableData()\" [columns]=\"_columns()\" [globalFilterFields]=\"globalFilterFields()\" [filters]=\"filters()\">\n <ng-template pTemplate=\"caption\">\n <div class=\"flex justify-content-between align-items-center\">\n <h5 class=\"m-0\">Table Data</h5>\n <span class=\"p-input-icon-left\">\n <i class=\"pi pi-search\"></i>\n <input pInputText type=\"text\" (input)=\"onGlobalFilter($event)\" placeholder=\"Search keyword\" />\n </span>\n </div>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n @for (column of columns; track column) {\n <th [pSortableColumn]=\"column.field\">{{ column.header }} <p-sortIcon [field]=\"column.field\"></p-sortIcon></th>\n }\n\n <th>Actions</th>\n </tr>\n <tr>\n @for (column of columns; track column) {\n <th>\n <p-columnFilter [type]=\"getFilterType(column)\" [field]=\"column.field\" placeholder=\"Search\" [showMenu]=\"false\"></p-columnFilter>\n </th>\n }\n <th></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-columns=\"columns\">\n <tr>\n @for (column of columns; track column) {\n <td>\n @if(column.type === 'image'){\n <div class=\"image-container\">\n <img src=\"{{ item | getPath: column.field }}\" alt=\"Image\" class=\"image\" />\n </div>\n } @else {\n <span>{{ item | getPath: column.field}} </span>\n }\n </td>\n }\n\n <td>\n <div style=\"display: flex; gap: 2px\">\n @for (actionBtn of actions(); track actionBtn) {\n <p-button (click)=\"selectItem(item, actionBtn)\" [icon]=\"actionBtn.icon\" [severity]=\"actionBtn['severity']\" />\n }\n </div>\n </td>\n </tr>\n </ng-template>\n</p-table>\n", styles: [":host{display:block;height:100%}.generic-list-container{display:flex;flex-direction:column;height:100%}.generic-list-content{margin-top:10px;flex:1;overflow-y:auto;padding-bottom:10px}.card-source{margin-bottom:10px;position:relative}.paginator-container{margin-top:auto;padding-top:10px}.image-container{width:50px;height:50px;border-radius:50%;overflow:hidden;display:flex;justify-content:center;align-items:center}.image-container img{width:100%;height:100%;object-fit:cover}\n"] }]
|
|
748
|
+
}], ctorParameters: () => [], propDecorators: { table: [{
|
|
744
749
|
type: ViewChild,
|
|
745
750
|
args: ['dataTable']
|
|
746
751
|
}] } });
|
|
747
752
|
|
|
753
|
+
/**
|
|
754
|
+
* Injection token for HttpCoreService configuration
|
|
755
|
+
*/
|
|
756
|
+
const HTTP_CORE_CONFIG = new InjectionToken('HTTP_CORE_CONFIG');
|
|
757
|
+
/**
|
|
758
|
+
* Modern HTTP service for Angular applications
|
|
759
|
+
* Provides methods for making HTTP requests with proper error handling and response transformation
|
|
760
|
+
*/
|
|
761
|
+
class HttpCoreService {
|
|
762
|
+
constructor(config) {
|
|
763
|
+
this.httpClient = inject(HttpClient);
|
|
764
|
+
// Use signals for reactive state
|
|
765
|
+
this.isLoading = signal(false);
|
|
766
|
+
this.lastError = signal(null);
|
|
767
|
+
if (config && config.primaryUrl) {
|
|
768
|
+
this.config = {
|
|
769
|
+
defaultHost: 'primary',
|
|
770
|
+
...config,
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
// Initialize with a placeholder - this will be set properly with setConfig
|
|
775
|
+
this.config = {
|
|
776
|
+
primaryUrl: '',
|
|
777
|
+
defaultHost: 'primary',
|
|
778
|
+
};
|
|
779
|
+
if (!config) {
|
|
780
|
+
console.warn('HttpCoreService: No configuration provided. Use setConfig to configure the service.');
|
|
781
|
+
}
|
|
782
|
+
else if (!config.primaryUrl) {
|
|
783
|
+
console.warn('HttpCoreService: primaryUrl is required in configuration. Use setConfig to set it.');
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Set the configuration for the service
|
|
789
|
+
* This allows for manual configuration when not using dependency injection
|
|
790
|
+
*/
|
|
791
|
+
setConfig(config) {
|
|
792
|
+
this.config = {
|
|
793
|
+
...this.config,
|
|
794
|
+
...config,
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Get the loading state as a signal
|
|
799
|
+
*/
|
|
800
|
+
loading() {
|
|
801
|
+
return this.isLoading;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Get the last error as a signal
|
|
805
|
+
*/
|
|
806
|
+
error() {
|
|
807
|
+
return this.lastError;
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Make a POST request to the specified service
|
|
811
|
+
* @param service The service endpoint
|
|
812
|
+
* @param data The data to send
|
|
813
|
+
* @param host The host to use (primary or secondary)
|
|
814
|
+
* @returns A promise with the response
|
|
815
|
+
*/
|
|
816
|
+
async post(service, data, host = this.config.defaultHost) {
|
|
817
|
+
this.isLoading.set(true);
|
|
818
|
+
try {
|
|
819
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
820
|
+
const dataPlain = this.toPlainObject(data);
|
|
821
|
+
const response$ = this.httpClient.post(url, dataPlain).pipe(tap(this.checkResponseStatus.bind(this)), catchError(this.handleRequestError.bind(this)));
|
|
822
|
+
const result = await lastValueFrom(response$);
|
|
823
|
+
this.isLoading.set(false);
|
|
824
|
+
return result;
|
|
825
|
+
}
|
|
826
|
+
catch (error) {
|
|
827
|
+
this.isLoading.set(false);
|
|
828
|
+
throw error;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Make a POST request to a specific URL
|
|
833
|
+
* @param baseUrl The base URL
|
|
834
|
+
* @param service The service endpoint
|
|
835
|
+
* @param data The data to send
|
|
836
|
+
* @returns A promise with the response
|
|
837
|
+
*/
|
|
838
|
+
async postToUrl(baseUrl, service, data) {
|
|
839
|
+
this.isLoading.set(true);
|
|
840
|
+
try {
|
|
841
|
+
const url = `${baseUrl}/${service}`;
|
|
842
|
+
const dataPlain = this.toPlainObject(data);
|
|
843
|
+
const response$ = this.httpClient.post(url, dataPlain).pipe(tap(this.checkResponseStatus.bind(this)), catchError(this.handleRequestError.bind(this)));
|
|
844
|
+
const result = await lastValueFrom(response$);
|
|
845
|
+
this.isLoading.set(false);
|
|
846
|
+
return result;
|
|
847
|
+
}
|
|
848
|
+
catch (error) {
|
|
849
|
+
this.isLoading.set(false);
|
|
850
|
+
throw error;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Make a PUT request to the specified service
|
|
855
|
+
* @param service The service endpoint
|
|
856
|
+
* @param data The data to send
|
|
857
|
+
* @param host The host to use (primary or secondary)
|
|
858
|
+
* @returns A promise with the response
|
|
859
|
+
*/
|
|
860
|
+
async put(service, data, host = this.config.defaultHost) {
|
|
861
|
+
this.isLoading.set(true);
|
|
862
|
+
try {
|
|
863
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
864
|
+
const dataPlain = this.toPlainObject(data);
|
|
865
|
+
const response$ = this.httpClient.put(url, dataPlain).pipe(catchError(this.handleRequestError.bind(this)));
|
|
866
|
+
const result = await lastValueFrom(response$);
|
|
867
|
+
this.isLoading.set(false);
|
|
868
|
+
return result;
|
|
869
|
+
}
|
|
870
|
+
catch (error) {
|
|
871
|
+
this.isLoading.set(false);
|
|
872
|
+
throw error;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Make a PUT request to a specific URL
|
|
877
|
+
* @param baseUrl The base URL
|
|
878
|
+
* @param service The service endpoint
|
|
879
|
+
* @param data The data to send
|
|
880
|
+
* @returns A promise with the response
|
|
881
|
+
*/
|
|
882
|
+
async putToUrl(baseUrl, service, data) {
|
|
883
|
+
this.isLoading.set(true);
|
|
884
|
+
try {
|
|
885
|
+
const url = `${baseUrl}/${service}`;
|
|
886
|
+
const dataPlain = this.toPlainObject(data);
|
|
887
|
+
const response$ = this.httpClient.put(url, dataPlain).pipe(catchError(this.handleRequestError.bind(this)));
|
|
888
|
+
const result = await lastValueFrom(response$);
|
|
889
|
+
this.isLoading.set(false);
|
|
890
|
+
return result;
|
|
891
|
+
}
|
|
892
|
+
catch (error) {
|
|
893
|
+
this.isLoading.set(false);
|
|
894
|
+
throw error;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Make a GET request to the specified service
|
|
899
|
+
* @param service The service endpoint
|
|
900
|
+
* @param host The host to use (primary or secondary)
|
|
901
|
+
* @param skipErrorHandling Whether to skip error handling
|
|
902
|
+
* @returns A promise with the response
|
|
903
|
+
*/
|
|
904
|
+
async get(service, host = this.config.defaultHost, skipErrorHandling = false) {
|
|
905
|
+
this.isLoading.set(true);
|
|
906
|
+
try {
|
|
907
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
908
|
+
const response$ = this.httpClient.get(url).pipe(catchError((err) => {
|
|
909
|
+
if (!skipErrorHandling) {
|
|
910
|
+
return this.handleRequestError(err);
|
|
911
|
+
}
|
|
912
|
+
return throwError(() => err);
|
|
913
|
+
}));
|
|
914
|
+
const result = await lastValueFrom(response$);
|
|
915
|
+
this.isLoading.set(false);
|
|
916
|
+
return result;
|
|
917
|
+
}
|
|
918
|
+
catch (error) {
|
|
919
|
+
this.isLoading.set(false);
|
|
920
|
+
throw error;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Make a GET request to a specific URL
|
|
925
|
+
* @param baseUrl The base URL
|
|
926
|
+
* @param service The service endpoint
|
|
927
|
+
* @param skipErrorHandling Whether to skip error handling
|
|
928
|
+
* @returns A promise with the response
|
|
929
|
+
*/
|
|
930
|
+
async getFromUrl(baseUrl, service, skipErrorHandling = false) {
|
|
931
|
+
this.isLoading.set(true);
|
|
932
|
+
try {
|
|
933
|
+
const url = `${baseUrl}/${service}`;
|
|
934
|
+
const response$ = this.httpClient.get(url).pipe(catchError((err) => {
|
|
935
|
+
if (!skipErrorHandling) {
|
|
936
|
+
return this.handleRequestError(err);
|
|
937
|
+
}
|
|
938
|
+
return throwError(() => err);
|
|
939
|
+
}));
|
|
940
|
+
const result = await lastValueFrom(response$);
|
|
941
|
+
this.isLoading.set(false);
|
|
942
|
+
return result;
|
|
943
|
+
}
|
|
944
|
+
catch (error) {
|
|
945
|
+
this.isLoading.set(false);
|
|
946
|
+
throw error;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Make a DELETE request to the specified service
|
|
951
|
+
* @param service The service endpoint
|
|
952
|
+
* @param host The host to use (primary or secondary)
|
|
953
|
+
* @returns A promise with the response
|
|
954
|
+
*/
|
|
955
|
+
async delete(service, host = this.config.defaultHost) {
|
|
956
|
+
this.isLoading.set(true);
|
|
957
|
+
try {
|
|
958
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
959
|
+
const response$ = this.httpClient.delete(url).pipe(catchError(this.handleRequestError.bind(this)));
|
|
960
|
+
const result = await lastValueFrom(response$);
|
|
961
|
+
this.isLoading.set(false);
|
|
962
|
+
return result;
|
|
963
|
+
}
|
|
964
|
+
catch (error) {
|
|
965
|
+
this.isLoading.set(false);
|
|
966
|
+
throw error;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Make a DELETE request to a specific URL
|
|
971
|
+
* @param baseUrl The base URL
|
|
972
|
+
* @param service The service endpoint
|
|
973
|
+
* @returns A promise with the response
|
|
974
|
+
*/
|
|
975
|
+
async deleteFromUrl(baseUrl, service) {
|
|
976
|
+
this.isLoading.set(true);
|
|
977
|
+
try {
|
|
978
|
+
const url = `${baseUrl}/${service}`;
|
|
979
|
+
const response$ = this.httpClient.delete(url).pipe(catchError(this.handleRequestError.bind(this)));
|
|
980
|
+
const result = await lastValueFrom(response$);
|
|
981
|
+
this.isLoading.set(false);
|
|
982
|
+
return result;
|
|
983
|
+
}
|
|
984
|
+
catch (error) {
|
|
985
|
+
this.isLoading.set(false);
|
|
986
|
+
throw error;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
/**
|
|
990
|
+
* Get an observable for a GET request
|
|
991
|
+
* @param service The service endpoint
|
|
992
|
+
* @param host The host to use (primary or secondary)
|
|
993
|
+
* @returns An observable with the response
|
|
994
|
+
*/
|
|
995
|
+
getObservable(service, host = this.config.defaultHost) {
|
|
996
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
997
|
+
return this.httpClient.get(url).pipe(catchError(this.handleRequestError.bind(this)));
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Get an observable for a POST request
|
|
1001
|
+
* @param service The service endpoint
|
|
1002
|
+
* @param data The data to send
|
|
1003
|
+
* @param skipErrorHandling Whether to skip error handling
|
|
1004
|
+
* @param host The host to use (primary or secondary)
|
|
1005
|
+
* @returns An observable with the response
|
|
1006
|
+
*/
|
|
1007
|
+
postObservable(service, data, skipErrorHandling = false, host = this.config.defaultHost) {
|
|
1008
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
1009
|
+
const dataPlain = this.toPlainObject(data);
|
|
1010
|
+
return this.httpClient.post(url, dataPlain).pipe(catchError((err) => {
|
|
1011
|
+
if (!skipErrorHandling) {
|
|
1012
|
+
return this.handleRequestError(err);
|
|
1013
|
+
}
|
|
1014
|
+
return throwError(() => err);
|
|
1015
|
+
}));
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Get an observable for a DELETE request
|
|
1019
|
+
* @param service The service endpoint
|
|
1020
|
+
* @param host The host to use (primary or secondary)
|
|
1021
|
+
* @returns An observable with the response
|
|
1022
|
+
*/
|
|
1023
|
+
deleteObservable(service, host = this.config.defaultHost) {
|
|
1024
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
1025
|
+
return this.httpClient.delete(url).pipe(catchError(this.handleRequestError.bind(this)));
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Upload a file to the specified service
|
|
1029
|
+
* @param service The service endpoint
|
|
1030
|
+
* @param file The file to upload
|
|
1031
|
+
* @param metadata Optional metadata to send with the file
|
|
1032
|
+
* @param host The host to use (primary or secondary)
|
|
1033
|
+
* @returns A promise with the response
|
|
1034
|
+
*/
|
|
1035
|
+
async uploadFile(service, file, metadata = null, host = this.config.defaultHost) {
|
|
1036
|
+
this.isLoading.set(true);
|
|
1037
|
+
try {
|
|
1038
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
1039
|
+
const formData = new FormData();
|
|
1040
|
+
formData.append('file', file);
|
|
1041
|
+
let headers = {};
|
|
1042
|
+
if (metadata) {
|
|
1043
|
+
headers = { metadata: JSON.stringify(metadata) };
|
|
1044
|
+
}
|
|
1045
|
+
const response$ = this.httpClient.post(url, formData, { headers });
|
|
1046
|
+
const result = await lastValueFrom(response$);
|
|
1047
|
+
this.isLoading.set(false);
|
|
1048
|
+
return result;
|
|
1049
|
+
}
|
|
1050
|
+
catch (error) {
|
|
1051
|
+
this.isLoading.set(false);
|
|
1052
|
+
throw error;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Download a file from the specified service
|
|
1057
|
+
* @param service The service endpoint
|
|
1058
|
+
* @param host The host to use (primary or secondary)
|
|
1059
|
+
* @returns A promise with the response
|
|
1060
|
+
*/
|
|
1061
|
+
async downloadFile(service, host = this.config.defaultHost) {
|
|
1062
|
+
this.isLoading.set(true);
|
|
1063
|
+
try {
|
|
1064
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
1065
|
+
const response$ = this.httpClient
|
|
1066
|
+
.get(url, {
|
|
1067
|
+
responseType: 'blob',
|
|
1068
|
+
observe: 'response',
|
|
1069
|
+
})
|
|
1070
|
+
.pipe(catchError(this.handleBlobError.bind(this)));
|
|
1071
|
+
const result = await lastValueFrom(response$);
|
|
1072
|
+
this.isLoading.set(false);
|
|
1073
|
+
return result;
|
|
1074
|
+
}
|
|
1075
|
+
catch (error) {
|
|
1076
|
+
this.isLoading.set(false);
|
|
1077
|
+
throw error;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Upload a file to the specified service and get the response as a blob
|
|
1082
|
+
* @param service The service endpoint
|
|
1083
|
+
* @param data The data to send
|
|
1084
|
+
* @param host The host to use (primary or secondary)
|
|
1085
|
+
* @returns A promise with the response
|
|
1086
|
+
*/
|
|
1087
|
+
async postFileAndGetBlob(service, data, host = this.config.defaultHost) {
|
|
1088
|
+
this.isLoading.set(true);
|
|
1089
|
+
try {
|
|
1090
|
+
let url = this.getHostUrl(host);
|
|
1091
|
+
if (service) {
|
|
1092
|
+
url += '/' + service;
|
|
1093
|
+
}
|
|
1094
|
+
const response$ = this.httpClient
|
|
1095
|
+
.post(url, data, {
|
|
1096
|
+
observe: 'response',
|
|
1097
|
+
responseType: 'blob',
|
|
1098
|
+
})
|
|
1099
|
+
.pipe(catchError(this.handleBlobError.bind(this)));
|
|
1100
|
+
const result = await lastValueFrom(response$);
|
|
1101
|
+
this.isLoading.set(false);
|
|
1102
|
+
return result;
|
|
1103
|
+
}
|
|
1104
|
+
catch (error) {
|
|
1105
|
+
this.isLoading.set(false);
|
|
1106
|
+
throw error;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* Get a file from the specified service as an observable
|
|
1111
|
+
* @param service The service endpoint
|
|
1112
|
+
* @param host The host to use (primary or secondary)
|
|
1113
|
+
* @returns An observable with the response
|
|
1114
|
+
*/
|
|
1115
|
+
getFileObservable(service, host = this.config.defaultHost) {
|
|
1116
|
+
const url = this.getHostUrl(host) + '/' + service;
|
|
1117
|
+
return this.httpClient.get(url, { responseType: 'blob' });
|
|
1118
|
+
}
|
|
1119
|
+
/**
|
|
1120
|
+
* Get the URL for the specified host
|
|
1121
|
+
* @param host The host to use (primary or secondary)
|
|
1122
|
+
* @returns The URL for the specified host
|
|
1123
|
+
*/
|
|
1124
|
+
getHostUrl(host = this.config.defaultHost) {
|
|
1125
|
+
return host === 'secondary' && this.config.secondaryUrl ? this.config.secondaryUrl : this.config.primaryUrl;
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Handle an error from a request
|
|
1129
|
+
* @param error The error to handle
|
|
1130
|
+
* @returns An observable that throws the error
|
|
1131
|
+
*/
|
|
1132
|
+
handleRequestError(error) {
|
|
1133
|
+
this.isLoading.set(false);
|
|
1134
|
+
// Set the last error
|
|
1135
|
+
if (error.error && typeof error.error === 'object') {
|
|
1136
|
+
this.lastError.set({
|
|
1137
|
+
error_message: error.error.error_message || 'An error occurred',
|
|
1138
|
+
explanation: error.error.explanation || 'Please try again later',
|
|
1139
|
+
status: error.status,
|
|
1140
|
+
code: error.error.code,
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
this.lastError.set({
|
|
1145
|
+
error_message: error.message || 'An error occurred',
|
|
1146
|
+
explanation: 'Please try again later',
|
|
1147
|
+
status: error.status,
|
|
1148
|
+
});
|
|
1149
|
+
}
|
|
1150
|
+
// Call the custom error handler if provided
|
|
1151
|
+
if (this.config.errorHandler) {
|
|
1152
|
+
this.config.errorHandler(error);
|
|
1153
|
+
}
|
|
1154
|
+
return throwError(() => error);
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* Handle an error from a blob request
|
|
1158
|
+
* @param error The error to handle
|
|
1159
|
+
* @returns An observable that throws the error
|
|
1160
|
+
*/
|
|
1161
|
+
async handleBlobError(error) {
|
|
1162
|
+
// Convert blob error response to JSON if possible
|
|
1163
|
+
if (error.error instanceof Blob) {
|
|
1164
|
+
try {
|
|
1165
|
+
const errorText = await error.error.text();
|
|
1166
|
+
error.error = JSON.parse(errorText);
|
|
1167
|
+
}
|
|
1168
|
+
catch (e) {
|
|
1169
|
+
// If parsing fails, create a generic error
|
|
1170
|
+
error.error = {
|
|
1171
|
+
error_message: 'Error processing file',
|
|
1172
|
+
explanation: 'Unable to process server response',
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return this.handleRequestError(error);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Check the status of a response
|
|
1180
|
+
* @param response The response to check
|
|
1181
|
+
*/
|
|
1182
|
+
checkResponseStatus(response) {
|
|
1183
|
+
// Implement any response status checking logic here
|
|
1184
|
+
// For example, check for specific status codes or error messages
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Convert an object to a plain object
|
|
1188
|
+
* @param obj The object to convert
|
|
1189
|
+
* @returns A plain object
|
|
1190
|
+
*/
|
|
1191
|
+
toPlainObject(obj) {
|
|
1192
|
+
if (!obj)
|
|
1193
|
+
return obj;
|
|
1194
|
+
// Handle simple types
|
|
1195
|
+
if (typeof obj !== 'object' || obj instanceof Blob || obj instanceof File) {
|
|
1196
|
+
return obj;
|
|
1197
|
+
}
|
|
1198
|
+
// Handle arrays
|
|
1199
|
+
if (Array.isArray(obj)) {
|
|
1200
|
+
return obj.map((item) => this.toPlainObject(item));
|
|
1201
|
+
}
|
|
1202
|
+
// Handle objects
|
|
1203
|
+
const result = {};
|
|
1204
|
+
for (const key in obj) {
|
|
1205
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1206
|
+
const value = obj[key];
|
|
1207
|
+
// Skip functions and undefined values
|
|
1208
|
+
if (typeof value === 'function' || value === undefined) {
|
|
1209
|
+
continue;
|
|
1210
|
+
}
|
|
1211
|
+
result[key] = this.toPlainObject(value);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
return result;
|
|
1215
|
+
}
|
|
1216
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HttpCoreService, deps: [{ token: HTTP_CORE_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1217
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HttpCoreService, providedIn: 'root' }); }
|
|
1218
|
+
}
|
|
1219
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: HttpCoreService, decorators: [{
|
|
1220
|
+
type: Injectable,
|
|
1221
|
+
args: [{
|
|
1222
|
+
providedIn: 'root',
|
|
1223
|
+
}]
|
|
1224
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1225
|
+
type: Optional
|
|
1226
|
+
}, {
|
|
1227
|
+
type: Inject,
|
|
1228
|
+
args: [HTTP_CORE_CONFIG]
|
|
1229
|
+
}] }] });
|
|
1230
|
+
|
|
748
1231
|
/*
|
|
749
1232
|
* Public API Surface of core-components
|
|
750
1233
|
*/
|
|
@@ -753,5 +1236,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
753
1236
|
* Generated bundle index. Do not edit.
|
|
754
1237
|
*/
|
|
755
1238
|
|
|
756
|
-
export { AudioSpeed, ConfirmComponent, ConfirmService, DCFilterBarComponent, DCProgressToastComponent, EmptyStateComponent, GetPathPipe, LoadingBarComponent, LoadingBarService, OptionValue, PaginationBase, QuickTableComponent, TOAST_ALERTS_TOKEN, ToastAlertsAbstractService, availibleFilters, extractJsonFromString, provideToastAlert, sortOptions, sortTypes };
|
|
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 };
|
|
757
1240
|
//# sourceMappingURL=dataclouder-ngx-core.mjs.map
|