@dataclouder/ngx-core 0.1.8 → 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 +651 -187
- 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 +9 -24
- 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,23 +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.
|
|
88
|
-
this.onChangeSort =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*/
|
|
92
|
-
this.onNew = new EventEmitter();
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated Use onAction with action='search' instead
|
|
95
|
-
*/
|
|
96
|
-
this.onSearch = new EventEmitter();
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Use onAction with action='filterChange' instead
|
|
99
|
-
*/
|
|
100
|
-
this.onFilterChange = new EventEmitter();
|
|
89
|
+
// Outputs
|
|
90
|
+
this.onFilterAction = output();
|
|
91
|
+
this.onChangeSort = output();
|
|
92
|
+
this.onNew = output();
|
|
93
|
+
// Internal State
|
|
101
94
|
this.customFilterModels = [];
|
|
102
95
|
this.availibleFilters = availibleFilters;
|
|
103
96
|
this.sortOptions = sortOptions;
|
|
@@ -131,10 +124,8 @@ class DCFilterBarComponent {
|
|
|
131
124
|
this.onChangeSort.emit(event.value);
|
|
132
125
|
}
|
|
133
126
|
createNew() {
|
|
134
|
-
// this.router.navigate(['edit/'], { relativeTo: this.route });
|
|
135
127
|
console.log('createNew from core components');
|
|
136
|
-
this.onNew.emit();
|
|
137
|
-
this.doItemAction('new', null);
|
|
128
|
+
this.onNew.emit('new');
|
|
138
129
|
}
|
|
139
130
|
search(text = null) {
|
|
140
131
|
if (!text) {
|
|
@@ -142,43 +133,29 @@ class DCFilterBarComponent {
|
|
|
142
133
|
this.clearFilters();
|
|
143
134
|
}
|
|
144
135
|
else {
|
|
145
|
-
this.
|
|
136
|
+
this.doItemAction({ action: 'search', item: text });
|
|
146
137
|
}
|
|
147
138
|
this.isSearchVisible = false;
|
|
148
139
|
}
|
|
149
140
|
clearFilters() {
|
|
150
141
|
this.filter = { ...DEFAULT_FILTERS };
|
|
151
|
-
this.
|
|
142
|
+
this.doItemAction({ action: 'filterChange', item: this.filter });
|
|
152
143
|
}
|
|
153
144
|
applyFilters() {
|
|
154
|
-
this.
|
|
145
|
+
this.doItemAction({ action: 'filterChange', item: this.filter });
|
|
155
146
|
this.isFilterVisible = false;
|
|
156
147
|
}
|
|
157
|
-
doItemAction(
|
|
158
|
-
this.
|
|
148
|
+
doItemAction(filterEvent) {
|
|
149
|
+
this.onFilterAction.emit(filterEvent);
|
|
159
150
|
}
|
|
160
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
161
|
-
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: { onAction: "onAction", onChangeSort: "onChangeSort", onNew: "onNew", onSearch: "onSearch", onFilterChange: "onFilterChange" }, 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 @for(item of items; track $index) {\n <p-button [icon]=\"item.icon\" variant=\"text\" (click)=\"doItemAction('changeView', 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</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 }); }
|
|
162
153
|
}
|
|
163
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCFilterBarComponent, decorators: [{
|
|
164
155
|
type: Component,
|
|
165
|
-
args: [{ selector: 'dc-filter-bar', standalone: true, imports: [
|
|
166
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
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: [{
|
|
167
158
|
type: Input
|
|
168
|
-
}], customFilters: [{
|
|
169
|
-
type: Input
|
|
170
|
-
}], items: [{
|
|
171
|
-
type: Input
|
|
172
|
-
}], onAction: [{
|
|
173
|
-
type: Output
|
|
174
|
-
}], onChangeSort: [{
|
|
175
|
-
type: Output
|
|
176
|
-
}], onNew: [{
|
|
177
|
-
type: Output
|
|
178
|
-
}], onSearch: [{
|
|
179
|
-
type: Output
|
|
180
|
-
}], onFilterChange: [{
|
|
181
|
-
type: Output
|
|
182
159
|
}] } });
|
|
183
160
|
|
|
184
161
|
class ConfirmComponent {
|
|
@@ -188,9 +165,9 @@ class ConfirmComponent {
|
|
|
188
165
|
onEscapte(_event) {
|
|
189
166
|
this.cancel();
|
|
190
167
|
}
|
|
191
|
-
constructor(
|
|
192
|
-
this.dynamicDialogConfig =
|
|
193
|
-
this.ref =
|
|
168
|
+
constructor() {
|
|
169
|
+
this.dynamicDialogConfig = inject(DynamicDialogConfig);
|
|
170
|
+
this.ref = inject(DynamicDialogRef);
|
|
194
171
|
this.title = 'Confirmación';
|
|
195
172
|
if (this.dynamicDialogConfig.data) {
|
|
196
173
|
this.title = this.dynamicDialogConfig.data.title;
|
|
@@ -209,13 +186,13 @@ class ConfirmComponent {
|
|
|
209
186
|
confirm() {
|
|
210
187
|
this.ref.close(true);
|
|
211
188
|
}
|
|
212
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
213
|
-
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"] }] }); }
|
|
214
191
|
}
|
|
215
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
192
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmComponent, decorators: [{
|
|
216
193
|
type: Component,
|
|
217
|
-
args: [{ selector: 'app-confirm', standalone: true, imports: [
|
|
218
|
-
}], 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: [{
|
|
219
196
|
type: Input
|
|
220
197
|
}], message: [{
|
|
221
198
|
type: Input
|
|
@@ -248,6 +225,7 @@ function provideToastAlert(serviceImplementation) {
|
|
|
248
225
|
},
|
|
249
226
|
];
|
|
250
227
|
}
|
|
228
|
+
// @deprecated, moved to ngx-tts
|
|
251
229
|
var AudioSpeed;
|
|
252
230
|
(function (AudioSpeed) {
|
|
253
231
|
AudioSpeed["VerySlow"] = "verySlow";
|
|
@@ -271,11 +249,16 @@ class PaginationBase {
|
|
|
271
249
|
constructor(route, router) {
|
|
272
250
|
this.route = route;
|
|
273
251
|
this.router = router;
|
|
252
|
+
/**
|
|
253
|
+
* Available actions for items.
|
|
254
|
+
* Must be implemented by child classes.
|
|
255
|
+
*/
|
|
256
|
+
this.actions = input();
|
|
274
257
|
/**
|
|
275
258
|
* Event emitted when an action is performed on an item.
|
|
276
259
|
* Emits an object containing the item and the action that was triggered.
|
|
277
260
|
*/
|
|
278
|
-
this.onAction =
|
|
261
|
+
this.onAction = output();
|
|
279
262
|
/** Current first record index for the paginator */
|
|
280
263
|
this.paginatorFirst = 0;
|
|
281
264
|
/** Number of rows to display per page */
|
|
@@ -342,20 +325,16 @@ class PaginationBase {
|
|
|
342
325
|
doAction(actionEvent) {
|
|
343
326
|
this.onAction.emit(actionEvent);
|
|
344
327
|
}
|
|
345
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
346
|
-
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 }); }
|
|
347
330
|
}
|
|
348
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: PaginationBase, decorators: [{
|
|
349
332
|
type: Directive
|
|
350
|
-
}], ctorParameters: () => [{ type: i1$
|
|
351
|
-
type: Input
|
|
352
|
-
}], onAction: [{
|
|
353
|
-
type: Output
|
|
354
|
-
}] } });
|
|
333
|
+
}], ctorParameters: () => [{ type: i1$2.ActivatedRoute }, { type: i1$2.Router }] });
|
|
355
334
|
|
|
356
335
|
class ConfirmService {
|
|
357
|
-
constructor(
|
|
358
|
-
this.pdialogService =
|
|
336
|
+
constructor() {
|
|
337
|
+
this.pdialogService = inject(DialogService);
|
|
359
338
|
}
|
|
360
339
|
openConfirm(title = '', message = '', acceptText = 'Aceptar') {
|
|
361
340
|
const dialogRef = this.pdialogService.open(ConfirmComponent, {
|
|
@@ -385,15 +364,15 @@ class ConfirmService {
|
|
|
385
364
|
});
|
|
386
365
|
return firstValueFrom(dialogRef.onClose);
|
|
387
366
|
}
|
|
388
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
389
|
-
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' }); }
|
|
390
369
|
}
|
|
391
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
370
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: ConfirmService, decorators: [{
|
|
392
371
|
type: Injectable,
|
|
393
372
|
args: [{
|
|
394
373
|
providedIn: 'root',
|
|
395
374
|
}]
|
|
396
|
-
}], ctorParameters: () => [
|
|
375
|
+
}], ctorParameters: () => [] });
|
|
397
376
|
|
|
398
377
|
/**
|
|
399
378
|
* Extracts and parses the first JSON object or array found within a string.
|
|
@@ -444,13 +423,13 @@ function extractJsonFromString(content) {
|
|
|
444
423
|
}
|
|
445
424
|
|
|
446
425
|
class DCProgressToastComponent {
|
|
447
|
-
constructor(
|
|
448
|
-
this.messageService =
|
|
449
|
-
this.cdr =
|
|
426
|
+
constructor() {
|
|
427
|
+
this.messageService = inject(MessageService);
|
|
428
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
450
429
|
this.visible = false;
|
|
451
|
-
this.progress = 0;
|
|
452
|
-
this.processCompleted =
|
|
453
|
-
this.processClosed =
|
|
430
|
+
this.progress = input(0);
|
|
431
|
+
this.processCompleted = output();
|
|
432
|
+
this.processClosed = output();
|
|
454
433
|
}
|
|
455
434
|
ngOnChanges(changes) {
|
|
456
435
|
if (changes['visible'] && changes['visible'].currentValue) {
|
|
@@ -461,7 +440,7 @@ class DCProgressToastComponent {
|
|
|
461
440
|
}
|
|
462
441
|
// Handle progress changes
|
|
463
442
|
if (changes['progress']) {
|
|
464
|
-
if (this.progress >= 100) {
|
|
443
|
+
if (this.progress() >= 100) {
|
|
465
444
|
this.onComplete();
|
|
466
445
|
}
|
|
467
446
|
this.cdr.markForCheck();
|
|
@@ -497,20 +476,14 @@ class DCProgressToastComponent {
|
|
|
497
476
|
this.messageService.clear('confirm');
|
|
498
477
|
this.processClosed.emit();
|
|
499
478
|
}
|
|
500
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
501
|
-
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"] }] }); }
|
|
502
481
|
}
|
|
503
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: DCProgressToastComponent, decorators: [{
|
|
504
483
|
type: Component,
|
|
505
|
-
args: [{ selector: 'dc-progress-toast', standalone: true, providers: [MessageService], imports: [ButtonModule,
|
|
506
|
-
}], ctorParameters: () => [
|
|
507
|
-
type: Input
|
|
508
|
-
}], progress: [{
|
|
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: [{
|
|
509
486
|
type: Input
|
|
510
|
-
}], processCompleted: [{
|
|
511
|
-
type: Output
|
|
512
|
-
}], processClosed: [{
|
|
513
|
-
type: Output
|
|
514
487
|
}] } });
|
|
515
488
|
|
|
516
489
|
/**
|
|
@@ -638,10 +611,10 @@ class LoadingBarService {
|
|
|
638
611
|
}
|
|
639
612
|
}, intervalMs);
|
|
640
613
|
}
|
|
641
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
642
|
-
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' }); }
|
|
643
616
|
}
|
|
644
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
617
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarService, decorators: [{
|
|
645
618
|
type: Injectable,
|
|
646
619
|
args: [{
|
|
647
620
|
providedIn: 'root',
|
|
@@ -649,25 +622,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
649
622
|
}], ctorParameters: () => [] });
|
|
650
623
|
|
|
651
624
|
class LoadingBarComponent {
|
|
652
|
-
constructor(
|
|
653
|
-
this.loadingBarService =
|
|
625
|
+
constructor() {
|
|
626
|
+
this.loadingBarService = inject(LoadingBarService);
|
|
654
627
|
}
|
|
655
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
656
|
-
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"] }] }); }
|
|
657
630
|
}
|
|
658
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
631
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: LoadingBarComponent, decorators: [{
|
|
659
632
|
type: Component,
|
|
660
|
-
args: [{ selector: 'dc-loading-bar', standalone: true, providers: [MessageService], imports: [ButtonModule,
|
|
661
|
-
}], 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: () => [] });
|
|
662
635
|
|
|
663
636
|
class GetPathPipe {
|
|
664
637
|
transform(obj, path) {
|
|
665
638
|
return get(obj, path, 'No disponible');
|
|
666
639
|
}
|
|
667
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
668
|
-
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" }); }
|
|
669
642
|
}
|
|
670
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: GetPathPipe, decorators: [{
|
|
671
644
|
type: Pipe,
|
|
672
645
|
args: [{
|
|
673
646
|
name: 'getPath',
|
|
@@ -675,95 +648,586 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
675
648
|
}]
|
|
676
649
|
}] });
|
|
677
650
|
|
|
678
|
-
// TODO: extends PaginationBase this handle filter, pagination, and url params ?page=1
|
|
679
651
|
class QuickTableComponent {
|
|
680
|
-
constructor(
|
|
681
|
-
|
|
682
|
-
this.
|
|
683
|
-
this.
|
|
684
|
-
|
|
685
|
-
this.actions = [{ title: '
|
|
686
|
-
|
|
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([]);
|
|
687
664
|
this.tableColumns = [];
|
|
688
|
-
// super(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
this.initializeTableColumns();
|
|
694
|
-
this.cdr.detectChanges();
|
|
665
|
+
// super();
|
|
666
|
+
effect(() => {
|
|
667
|
+
this.initializeTableColumns();
|
|
668
|
+
this.initializeFilters();
|
|
669
|
+
});
|
|
695
670
|
}
|
|
696
|
-
|
|
697
|
-
if (this.
|
|
698
|
-
|
|
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);
|
|
699
697
|
}
|
|
700
|
-
console.log(this.columns, this.actions);
|
|
701
698
|
}
|
|
702
|
-
//
|
|
703
|
-
//
|
|
704
|
-
//
|
|
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();
|
|
705
707
|
// }
|
|
706
|
-
initializeTableColumns() {
|
|
707
|
-
// Transform string column names to column objects
|
|
708
|
-
this.tableColumns = this.columns.map((col) => ({
|
|
709
|
-
field: col,
|
|
710
|
-
header: col,
|
|
711
|
-
sortable: true,
|
|
712
|
-
}));
|
|
713
|
-
// Add actions column
|
|
714
|
-
this.tableColumns.push({
|
|
715
|
-
field: 'actions',
|
|
716
|
-
header: 'Actions',
|
|
717
|
-
});
|
|
718
|
-
}
|
|
719
|
-
configureTable() {
|
|
720
|
-
// Configure table properties programmatically if needed
|
|
721
|
-
this.table.reset();
|
|
722
|
-
this.table.rows = 5;
|
|
723
|
-
this.table.paginator = true;
|
|
724
|
-
this.table.rowsPerPageOptions = [5, 10, 20];
|
|
725
|
-
this.table.tableStyle = { 'min-width': '50rem' };
|
|
726
|
-
this.cdr.detectChanges();
|
|
727
|
-
}
|
|
728
708
|
selectItem(item, action) {
|
|
729
709
|
console.log('onAction', { item, action });
|
|
730
710
|
this.onAction.emit({ item, action: action.label });
|
|
731
711
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
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';
|
|
739
719
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
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
|
+
});
|
|
744
738
|
}
|
|
739
|
+
this.filters.set(filterObj);
|
|
740
|
+
this.globalFilterFields.set(fields);
|
|
745
741
|
}
|
|
746
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
747
|
-
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 }); }
|
|
748
744
|
}
|
|
749
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
745
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: QuickTableComponent, decorators: [{
|
|
750
746
|
type: Component,
|
|
751
|
-
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]=\"
|
|
752
|
-
}], ctorParameters: () => [
|
|
753
|
-
type: Input
|
|
754
|
-
}], columns: [{
|
|
755
|
-
type: Input
|
|
756
|
-
}], tableData: [{
|
|
757
|
-
type: Input
|
|
758
|
-
}], actions: [{
|
|
759
|
-
type: Input
|
|
760
|
-
}], onAction: [{
|
|
761
|
-
type: Output
|
|
762
|
-
}], 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: [{
|
|
763
749
|
type: ViewChild,
|
|
764
750
|
args: ['dataTable']
|
|
765
751
|
}] } });
|
|
766
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
|
+
|
|
767
1231
|
/*
|
|
768
1232
|
* Public API Surface of core-components
|
|
769
1233
|
*/
|
|
@@ -772,5 +1236,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
|
|
|
772
1236
|
* Generated bundle index. Do not edit.
|
|
773
1237
|
*/
|
|
774
1238
|
|
|
775
|
-
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 };
|
|
776
1240
|
//# sourceMappingURL=dataclouder-ngx-core.mjs.map
|