intelica-library-project 20.0.2
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/intelica-library-project.mjs +2974 -0
- package/fesm2022/intelica-library-project.mjs.map +1 -0
- package/index.d.ts +804 -0
- package/package.json +25 -0
|
@@ -0,0 +1,2974 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, EventEmitter, forwardRef, Output, Input, Component, Pipe, Injectable, TemplateRef, ContentChild, Directive, ContentChildren, PLATFORM_ID, Inject } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/forms';
|
|
4
|
+
import { FormBuilder, FormsModule, ReactiveFormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import * as i2 from 'primeng/radiobutton';
|
|
6
|
+
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
7
|
+
import { Popover } from 'primeng/popover';
|
|
8
|
+
import { InputText, InputTextModule } from 'primeng/inputtext';
|
|
9
|
+
import * as i1$1 from '@angular/common';
|
|
10
|
+
import { CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
|
|
11
|
+
import * as i5 from 'primeng/tooltip';
|
|
12
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
13
|
+
import { GlobalTermService, TermPipe, FormatDateConstants, ConfigService, Color, getColor } from 'intelica-library-base';
|
|
14
|
+
import * as i4 from 'primeng/button';
|
|
15
|
+
import { ButtonModule } from 'primeng/button';
|
|
16
|
+
import { Subscription, Subject, BehaviorSubject, of, tap, map, shareReplay, throwError } from 'rxjs';
|
|
17
|
+
import { BadgeModule } from 'primeng/badge';
|
|
18
|
+
import * as i6 from 'primeng/checkbox';
|
|
19
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
20
|
+
import * as i2$1 from 'primeng/iconfield';
|
|
21
|
+
import { IconFieldModule, IconField } from 'primeng/iconfield';
|
|
22
|
+
import { InputIcon } from 'primeng/inputicon';
|
|
23
|
+
import { InputNumber } from 'primeng/inputnumber';
|
|
24
|
+
import { Paginator } from 'primeng/paginator';
|
|
25
|
+
import { Select } from 'primeng/select';
|
|
26
|
+
import * as i3 from 'primeng/table';
|
|
27
|
+
import { TableModule } from 'primeng/table';
|
|
28
|
+
import moment from 'moment';
|
|
29
|
+
import * as _ from 'lodash';
|
|
30
|
+
import * as i4$1 from 'primeng/api';
|
|
31
|
+
import * as i2$2 from 'primeng/skeleton';
|
|
32
|
+
import { SkeletonModule } from 'primeng/skeleton';
|
|
33
|
+
import * as echarts from 'echarts';
|
|
34
|
+
import { HttpClient } from '@angular/common/http';
|
|
35
|
+
import { catchError } from 'rxjs/operators';
|
|
36
|
+
|
|
37
|
+
var SearchInputEnum;
|
|
38
|
+
(function (SearchInputEnum) {
|
|
39
|
+
SearchInputEnum["OperatorId"] = "operatorId";
|
|
40
|
+
SearchInputEnum["FieldId"] = "fieldId";
|
|
41
|
+
SearchInputEnum["SearchText"] = "searchText";
|
|
42
|
+
})(SearchInputEnum || (SearchInputEnum = {}));
|
|
43
|
+
|
|
44
|
+
class SearchComponent {
|
|
45
|
+
GlobalTermService = inject(GlobalTermService);
|
|
46
|
+
/**
|
|
47
|
+
* Indica el componente del que proviene.
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
ComponentId = "";
|
|
51
|
+
ShowTooltip = false;
|
|
52
|
+
/**
|
|
53
|
+
* Opciones para campos de búsqueda.
|
|
54
|
+
* @type {{ id: number; value: string }[]}
|
|
55
|
+
*/
|
|
56
|
+
SearchFieldOptions;
|
|
57
|
+
/**
|
|
58
|
+
* Indica si realizar la búsqueda al soltar una tecla.
|
|
59
|
+
* @type {boolean}
|
|
60
|
+
*/
|
|
61
|
+
SearchOnKeyup;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated No debe ser utilizado. Es sólo para uso interno y no para módulos.
|
|
64
|
+
* @type {boolean}
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
SimpleSearchInput = false;
|
|
68
|
+
/**
|
|
69
|
+
* Placeholder para el componente de búsqueda.
|
|
70
|
+
* @type {string}
|
|
71
|
+
*/
|
|
72
|
+
Placeholder = "";
|
|
73
|
+
/**
|
|
74
|
+
* Evento emitido al realizar una búsqueda.
|
|
75
|
+
* @type {EventEmitter<{ operatorId: number; operatorText: string, fieldId: number, fieldText: string, searchText: string }>}
|
|
76
|
+
*/
|
|
77
|
+
OnSearchEvent = new EventEmitter();
|
|
78
|
+
FormBuilder = inject(FormBuilder);
|
|
79
|
+
// Option!: string;
|
|
80
|
+
// Placeholder!: string;
|
|
81
|
+
/**
|
|
82
|
+
* Indica si el dropdown está abierto
|
|
83
|
+
* @type {boolean}
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
IsDropdownOpen = false;
|
|
87
|
+
/**
|
|
88
|
+
* Formulario para manejar los parámetros de búsqueda
|
|
89
|
+
* @type {FormGroup}
|
|
90
|
+
*/
|
|
91
|
+
SearchForm;
|
|
92
|
+
/**
|
|
93
|
+
* Suscripción a los valores del formulario.
|
|
94
|
+
* @type {Subscription}
|
|
95
|
+
*/
|
|
96
|
+
FormValuesSubscription;
|
|
97
|
+
/**
|
|
98
|
+
* Opciones para operadores de búsqueda.
|
|
99
|
+
* @type {{ id: number; value: string }[]}
|
|
100
|
+
*/
|
|
101
|
+
SearchOperatorOptions;
|
|
102
|
+
/**
|
|
103
|
+
* Función llamada cuando cambia el valor del campo de búsqueda.
|
|
104
|
+
* @type {() => void}
|
|
105
|
+
*/
|
|
106
|
+
OnChange = () => { };
|
|
107
|
+
/**
|
|
108
|
+
* Función llamada cuando el componente de búsqueda es tocado.
|
|
109
|
+
* @type {() => void}
|
|
110
|
+
*/
|
|
111
|
+
OnTouched = () => { };
|
|
112
|
+
constructor() { }
|
|
113
|
+
ngOnInit() {
|
|
114
|
+
this.SearchForm = this.FormBuilder.group({
|
|
115
|
+
operatorId: 0,
|
|
116
|
+
fieldId: 0,
|
|
117
|
+
searchText: "",
|
|
118
|
+
});
|
|
119
|
+
this.FormValuesSubscription = this.SearchForm.valueChanges.subscribe(value => {
|
|
120
|
+
this.OnChange(value);
|
|
121
|
+
});
|
|
122
|
+
//loadTerms
|
|
123
|
+
if (this.Placeholder === "")
|
|
124
|
+
this.Placeholder = "SearchPlaceholder";
|
|
125
|
+
this.SearchOperatorOptions ??= this.GetSearchOperatorOptions();
|
|
126
|
+
this.SearchFieldOptions ??= this.GetSearchFieldOptions();
|
|
127
|
+
this.InitializeForm();
|
|
128
|
+
}
|
|
129
|
+
ngOnDestroy() {
|
|
130
|
+
this.FormValuesSubscription.unsubscribe();
|
|
131
|
+
}
|
|
132
|
+
InitializeForm() {
|
|
133
|
+
this.SearchForm.setValue({
|
|
134
|
+
operatorId: this.SearchOperatorOptions[0].id,
|
|
135
|
+
fieldId: this.SearchFieldOptions.length > 0 ? this.SearchFieldOptions[0].id : 0,
|
|
136
|
+
searchText: "",
|
|
137
|
+
});
|
|
138
|
+
this.OnSearch();
|
|
139
|
+
}
|
|
140
|
+
DropDownChange(isOpen) {
|
|
141
|
+
this.IsDropdownOpen = isOpen;
|
|
142
|
+
}
|
|
143
|
+
OnSearchEnter() {
|
|
144
|
+
if (!this.SearchOnKeyup)
|
|
145
|
+
this.OnSearch();
|
|
146
|
+
}
|
|
147
|
+
OnSearchKeyup() {
|
|
148
|
+
if (this.SearchOnKeyup)
|
|
149
|
+
this.OnSearch();
|
|
150
|
+
}
|
|
151
|
+
OnSearch() {
|
|
152
|
+
const value = this.SearchForm.value;
|
|
153
|
+
value.operatorText = this.SearchOperatorOptions.find(o => o.id === value.operatorId)?.value || "";
|
|
154
|
+
value.fieldText = this.SearchFieldOptions.find(f => f.id === value.fieldId)?.value || "";
|
|
155
|
+
this.OnChange(value);
|
|
156
|
+
this.OnTouched();
|
|
157
|
+
this.OnSearchEvent.emit(value);
|
|
158
|
+
}
|
|
159
|
+
ClearSearchText(emitEvent = true) {
|
|
160
|
+
this.SearchForm.get(SearchInputEnum.SearchText)?.setValue("");
|
|
161
|
+
if (emitEvent) {
|
|
162
|
+
this.OnSearch();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
get HasSearchText() {
|
|
166
|
+
const searchText = this.SearchForm.get(SearchInputEnum.SearchText)?.value;
|
|
167
|
+
return searchText && searchText.length > 0;
|
|
168
|
+
}
|
|
169
|
+
GetSelectedOperatorValue() {
|
|
170
|
+
const selectedId = this.SearchForm.get(SearchInputEnum.OperatorId)?.value;
|
|
171
|
+
const selectedItem = this.SearchOperatorOptions?.find(item => item.id === selectedId);
|
|
172
|
+
return selectedItem ? selectedItem.value : "";
|
|
173
|
+
}
|
|
174
|
+
GetSelectedFieldValue() {
|
|
175
|
+
const selectedId = this.SearchForm.get(SearchInputEnum.FieldId)?.value;
|
|
176
|
+
const selectedItem = this.SearchFieldOptions?.find(item => item.id === selectedId);
|
|
177
|
+
return selectedItem ? selectedItem.value : "";
|
|
178
|
+
}
|
|
179
|
+
GetSelectedValues() {
|
|
180
|
+
return `${this.GetSelectedOperatorValue()}, ${this.GetSelectedFieldValue()}`;
|
|
181
|
+
}
|
|
182
|
+
SetSearchTextValue(text) {
|
|
183
|
+
this.SearchForm.get(SearchInputEnum.SearchText)?.setValue(text);
|
|
184
|
+
}
|
|
185
|
+
SetOperatorValue(value) {
|
|
186
|
+
this.SearchForm.get(SearchInputEnum.OperatorId)?.setValue(value ?? 0);
|
|
187
|
+
}
|
|
188
|
+
SetFieldValue(value) {
|
|
189
|
+
this.SearchForm.get(SearchInputEnum.FieldId)?.setValue(value ?? 0);
|
|
190
|
+
}
|
|
191
|
+
GetSearchOperatorOptions() {
|
|
192
|
+
return [
|
|
193
|
+
{ id: 0, value: "Contains" },
|
|
194
|
+
{ id: 1, value: "Exact" },
|
|
195
|
+
{ id: 2, value: "Begin" },
|
|
196
|
+
{ id: 3, value: "Ends" },
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
GetSearchFieldOptions() {
|
|
200
|
+
return [
|
|
201
|
+
{ id: 0, value: "code" },
|
|
202
|
+
{ id: 1, value: "name" },
|
|
203
|
+
];
|
|
204
|
+
}
|
|
205
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: SearchComponent, isStandalone: true, selector: "intelica-search", inputs: { ComponentId: "ComponentId", ShowTooltip: "ShowTooltip", SearchFieldOptions: "SearchFieldOptions", SearchOnKeyup: "SearchOnKeyup", SimpleSearchInput: "SimpleSearchInput", Placeholder: "Placeholder" }, outputs: { OnSearchEvent: "OnSearch" }, providers: [
|
|
207
|
+
{
|
|
208
|
+
provide: NG_VALUE_ACCESSOR,
|
|
209
|
+
useExisting: forwardRef(() => SearchComponent),
|
|
210
|
+
},
|
|
211
|
+
], ngImport: i0, template: "<form [formGroup]=\"SearchForm\">\n\t<div class=\"prSearchBar\">\n\t\t<div class=\"prSearchBar__dropdown\" (click)=\"op.toggle($event)\" *ngIf=\"!SimpleSearchInput\">\n\t\t\t<div\n\t\t\t\tclass=\"prSearchBar__dropdown--label\"\n\t\t\t\t[pTooltip]=\"ShowTooltip ? (GetSelectedOperatorValue() | term : GlobalTermService.languageCode) + ', ' + (GetSelectedFieldValue() | term : GlobalTermService.languageCode) : ''\"\n\t\t\t\ttooltipPosition=\"top\"\n\t\t\t>\n\t\t\t\t{{ GetSelectedFieldValue() | term : GlobalTermService.languageCode }}\n\t\t\t</div>\n\t\t\t<div class=\"prSearchBar__dropdown--icon\">\n\t\t\t\t<i [ngClass]=\"IsDropdownOpen ? 'icon-arrow-up' : 'icon-arrow-down'\"></i>\n\t\t\t</div>\n\t\t</div>\n\t\t<p-popover #op (onShow)=\"DropDownChange(true)\" (onHide)=\"DropDownChange(false)\" class=\"prSearchBar__popover\">\n\t\t\t<div class=\"searchDropDown\">\n\t\t\t\t<div class=\"searchDropDown__group\">\n\t\t\t\t\t<div class=\"searchDropDown__title\">{{ \"Selectoperator\" | term : GlobalTermService.languageCode }}</div>\n\t\t\t\t\t<div class=\"searchDropDown__listOption\">\n\t\t\t\t\t\t@for ( option of SearchOperatorOptions ; track option.id; let index = $index){\n\t\t\t\t\t\t<div class=\"searchDropDown__option\">\n\t\t\t\t\t\t\t<p-radiobutton [inputId]=\"ComponentId + option.id\" class=\"prRadioButton\" [value]=\"option.id\" formControlName=\"operatorId\" (change)=\"OnSearchKeyup()\" />\n\t\t\t\t\t\t\t<label [for]=\"ComponentId + option.id\" class=\"prRadioButton--label\">{{ option.value | term : GlobalTermService.languageCode }}</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<hr />\n\t\t\t\t<div class=\"searchDropDown__group\">\n\t\t\t\t\t<div class=\"searchDropDown__title\">{{ \"Selectfield\" | term : GlobalTermService.languageCode }}</div>\n\t\t\t\t\t@for ( option of SearchFieldOptions ; track option.id; let index = $index){\n\t\t\t\t\t<div class=\"searchDropDown__option\">\n\t\t\t\t\t\t<p-radiobutton [inputId]=\"ComponentId + 'fieldId_' + option.id\" class=\"prRadioButton\" [value]=\"option.id\" formControlName=\"fieldId\" (change)=\"OnSearchKeyup()\" />\n\t\t\t\t\t\t<label [for]=\"ComponentId + 'fieldId_' + option.id\" class=\"prRadioButton--label\">{{ option.value | term : GlobalTermService.languageCode }}</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</p-popover>\n\t\t<div class=\"prSearchBar__content\">\n\t\t\t<div class=\"prSearchBar__btn\">\n\t\t\t\t<button pButton type=\"button\" class=\"prSearchBar__btn-action\" (click)=\"ClearSearchText()\" *ngIf=\"HasSearchText\">\n\t\t\t\t\t<i class=\"icon-times\"></i>\n\t\t\t\t</button>\n\t\t\t\t<button pButton type=\"button\" class=\"prSearchBar__btn-action\" (click)=\"OnSearch()\">\n\t\t\t\t\t<i class=\"icon-search\"></i>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\tpInputText\n\t\t\t\ttype=\"text\"\n\t\t\t\tclass=\"prSearchBar__input\"\n\t\t\t\tformControlName=\"searchText\"\n\t\t\t\t[placeholder]=\"Placeholder | term : GlobalTermService.languageCode\"\n\t\t\t\t(keyup.enter)=\"OnSearchEnter()\"\n\t\t\t\t(keyup)=\"OnSearchKeyup()\"\n\t\t\t/>\n\t\t</div>\n\t</div>\n</form>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: RadioButtonModule }, { kind: "component", type: i2.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "styleClass", "autofocus", "binary", "variant", "size"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: Popover, selector: "p-popover", inputs: ["ariaLabel", "ariaLabelledBy", "dismissable", "style", "styleClass", "appendTo", "autoZIndex", "ariaCloseLabel", "baseZIndex", "focusOnShow", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onShow", "onHide"] }, { kind: "directive", type: InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip"] }, { kind: "pipe", type: TermPipe, name: "term" }] });
|
|
212
|
+
}
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SearchComponent, decorators: [{
|
|
214
|
+
type: Component,
|
|
215
|
+
args: [{ selector: "intelica-search", imports: [FormsModule, ReactiveFormsModule, RadioButtonModule, Popover, InputText, CommonModule, TooltipModule, TermPipe], providers: [
|
|
216
|
+
{
|
|
217
|
+
provide: NG_VALUE_ACCESSOR,
|
|
218
|
+
useExisting: forwardRef(() => SearchComponent),
|
|
219
|
+
},
|
|
220
|
+
], template: "<form [formGroup]=\"SearchForm\">\n\t<div class=\"prSearchBar\">\n\t\t<div class=\"prSearchBar__dropdown\" (click)=\"op.toggle($event)\" *ngIf=\"!SimpleSearchInput\">\n\t\t\t<div\n\t\t\t\tclass=\"prSearchBar__dropdown--label\"\n\t\t\t\t[pTooltip]=\"ShowTooltip ? (GetSelectedOperatorValue() | term : GlobalTermService.languageCode) + ', ' + (GetSelectedFieldValue() | term : GlobalTermService.languageCode) : ''\"\n\t\t\t\ttooltipPosition=\"top\"\n\t\t\t>\n\t\t\t\t{{ GetSelectedFieldValue() | term : GlobalTermService.languageCode }}\n\t\t\t</div>\n\t\t\t<div class=\"prSearchBar__dropdown--icon\">\n\t\t\t\t<i [ngClass]=\"IsDropdownOpen ? 'icon-arrow-up' : 'icon-arrow-down'\"></i>\n\t\t\t</div>\n\t\t</div>\n\t\t<p-popover #op (onShow)=\"DropDownChange(true)\" (onHide)=\"DropDownChange(false)\" class=\"prSearchBar__popover\">\n\t\t\t<div class=\"searchDropDown\">\n\t\t\t\t<div class=\"searchDropDown__group\">\n\t\t\t\t\t<div class=\"searchDropDown__title\">{{ \"Selectoperator\" | term : GlobalTermService.languageCode }}</div>\n\t\t\t\t\t<div class=\"searchDropDown__listOption\">\n\t\t\t\t\t\t@for ( option of SearchOperatorOptions ; track option.id; let index = $index){\n\t\t\t\t\t\t<div class=\"searchDropDown__option\">\n\t\t\t\t\t\t\t<p-radiobutton [inputId]=\"ComponentId + option.id\" class=\"prRadioButton\" [value]=\"option.id\" formControlName=\"operatorId\" (change)=\"OnSearchKeyup()\" />\n\t\t\t\t\t\t\t<label [for]=\"ComponentId + option.id\" class=\"prRadioButton--label\">{{ option.value | term : GlobalTermService.languageCode }}</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<hr />\n\t\t\t\t<div class=\"searchDropDown__group\">\n\t\t\t\t\t<div class=\"searchDropDown__title\">{{ \"Selectfield\" | term : GlobalTermService.languageCode }}</div>\n\t\t\t\t\t@for ( option of SearchFieldOptions ; track option.id; let index = $index){\n\t\t\t\t\t<div class=\"searchDropDown__option\">\n\t\t\t\t\t\t<p-radiobutton [inputId]=\"ComponentId + 'fieldId_' + option.id\" class=\"prRadioButton\" [value]=\"option.id\" formControlName=\"fieldId\" (change)=\"OnSearchKeyup()\" />\n\t\t\t\t\t\t<label [for]=\"ComponentId + 'fieldId_' + option.id\" class=\"prRadioButton--label\">{{ option.value | term : GlobalTermService.languageCode }}</label>\n\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</p-popover>\n\t\t<div class=\"prSearchBar__content\">\n\t\t\t<div class=\"prSearchBar__btn\">\n\t\t\t\t<button pButton type=\"button\" class=\"prSearchBar__btn-action\" (click)=\"ClearSearchText()\" *ngIf=\"HasSearchText\">\n\t\t\t\t\t<i class=\"icon-times\"></i>\n\t\t\t\t</button>\n\t\t\t\t<button pButton type=\"button\" class=\"prSearchBar__btn-action\" (click)=\"OnSearch()\">\n\t\t\t\t\t<i class=\"icon-search\"></i>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\tpInputText\n\t\t\t\ttype=\"text\"\n\t\t\t\tclass=\"prSearchBar__input\"\n\t\t\t\tformControlName=\"searchText\"\n\t\t\t\t[placeholder]=\"Placeholder | term : GlobalTermService.languageCode\"\n\t\t\t\t(keyup.enter)=\"OnSearchEnter()\"\n\t\t\t\t(keyup)=\"OnSearchKeyup()\"\n\t\t\t/>\n\t\t</div>\n\t</div>\n</form>\n" }]
|
|
221
|
+
}], ctorParameters: () => [], propDecorators: { ComponentId: [{
|
|
222
|
+
type: Input
|
|
223
|
+
}], ShowTooltip: [{
|
|
224
|
+
type: Input
|
|
225
|
+
}], SearchFieldOptions: [{
|
|
226
|
+
type: Input
|
|
227
|
+
}], SearchOnKeyup: [{
|
|
228
|
+
type: Input
|
|
229
|
+
}], SimpleSearchInput: [{
|
|
230
|
+
type: Input
|
|
231
|
+
}], Placeholder: [{
|
|
232
|
+
type: Input
|
|
233
|
+
}], OnSearchEvent: [{
|
|
234
|
+
type: Output,
|
|
235
|
+
args: ["OnSearch"]
|
|
236
|
+
}] } });
|
|
237
|
+
|
|
238
|
+
class OrderConstants {
|
|
239
|
+
//DESCRIPTION
|
|
240
|
+
static ORDER_BY_DESC = "desc";
|
|
241
|
+
static ORDER_BY_ASC = "asc";
|
|
242
|
+
//VALUES
|
|
243
|
+
static ORDER_BY_DESC_VALUE = "1";
|
|
244
|
+
static ORDER_BY_ASC_VALUE = "0";
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
class SortingComponent {
|
|
248
|
+
/**
|
|
249
|
+
* Suscripción a un observable.
|
|
250
|
+
* @type {Subscription}
|
|
251
|
+
*/
|
|
252
|
+
subscription = new Subscription();
|
|
253
|
+
/**
|
|
254
|
+
* Términos utilizados en el componente.
|
|
255
|
+
* @type {any}
|
|
256
|
+
*/
|
|
257
|
+
terms;
|
|
258
|
+
/**
|
|
259
|
+
* Lista de modelos de filtro en cascada.
|
|
260
|
+
* @type {CascadeFilterModel[]}
|
|
261
|
+
* @default []
|
|
262
|
+
*/
|
|
263
|
+
LCascadefilter = [];
|
|
264
|
+
/**
|
|
265
|
+
* Número máximo de ordenamiento.
|
|
266
|
+
* @type {number}
|
|
267
|
+
* @default 4
|
|
268
|
+
*/
|
|
269
|
+
NumMaxSorting = 4;
|
|
270
|
+
/**
|
|
271
|
+
* Lista de objetos de ordenamiento.
|
|
272
|
+
* @type {any}
|
|
273
|
+
* @default []
|
|
274
|
+
*/
|
|
275
|
+
Sorters = [];
|
|
276
|
+
/**
|
|
277
|
+
* Objeto que indica el ordenamiento actual.
|
|
278
|
+
* @type {any}
|
|
279
|
+
*/
|
|
280
|
+
OrderBy;
|
|
281
|
+
/**
|
|
282
|
+
* Objeto que indica el ordenamiento predeterminado.
|
|
283
|
+
* @type {any}
|
|
284
|
+
* @default {}
|
|
285
|
+
*/
|
|
286
|
+
OrderByDefault = {};
|
|
287
|
+
/**
|
|
288
|
+
* Indica si se debe realizar un solo renderizado.
|
|
289
|
+
* @type {boolean}
|
|
290
|
+
* @default false
|
|
291
|
+
*/
|
|
292
|
+
OneRender = false;
|
|
293
|
+
/**
|
|
294
|
+
* Evento emitido al realizar un retorno de datos.
|
|
295
|
+
* @type {EventEmitter<any>}
|
|
296
|
+
*/
|
|
297
|
+
ReturnSorting = new EventEmitter();
|
|
298
|
+
/**
|
|
299
|
+
* Evento emitido al alertar sobre una ordenación.
|
|
300
|
+
* @type {EventEmitter<any>}
|
|
301
|
+
*/
|
|
302
|
+
AlertOrder = new EventEmitter();
|
|
303
|
+
/**
|
|
304
|
+
* Objeto que contiene constantes de ordenación.
|
|
305
|
+
* @type {OrderConstants}
|
|
306
|
+
*/
|
|
307
|
+
Order = OrderConstants;
|
|
308
|
+
constructor() { }
|
|
309
|
+
ngOnDestroy() {
|
|
310
|
+
this.subscription.unsubscribe();
|
|
311
|
+
}
|
|
312
|
+
ngOnInit() {
|
|
313
|
+
// this.subscription = this.sharedService.isLoadingPageInfo.subscribe({
|
|
314
|
+
// next: isLoadingPageInfo => {
|
|
315
|
+
// if (!isLoadingPageInfo) this.terms = this.globals.languageTerms;
|
|
316
|
+
// },
|
|
317
|
+
// });
|
|
318
|
+
}
|
|
319
|
+
ngOnChanges(changes) {
|
|
320
|
+
if (changes.OrderBy && this.Sorters.length > 0)
|
|
321
|
+
this.GetInfoSorting();
|
|
322
|
+
if (changes.Sorters && this.Sorters.length > 0)
|
|
323
|
+
this.GetInfoSorting();
|
|
324
|
+
// this.terms = this.globals.languageTerms;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Obtiene información sobre la ordenación y la asigna a la lista de modelos de filtro en cascada.
|
|
328
|
+
* - Si no hay información de ordenación (`orderBy`), la función sale.
|
|
329
|
+
* - Crea una lista de modelos de filtro en cascada con una longitud determinada.
|
|
330
|
+
* - Filtra las propiedades de ordenación que coinciden con los campos existentes.
|
|
331
|
+
* - Asigna las propiedades de ordenación a los modelos de filtro en cascada.
|
|
332
|
+
*/
|
|
333
|
+
GetInfoSorting() {
|
|
334
|
+
// Si no hay información de ordenación (orderBy), la función sale temprano.
|
|
335
|
+
if (!this.OrderBy)
|
|
336
|
+
return;
|
|
337
|
+
// Crea una lista de modelos de filtro en cascada con una longitud determinada.
|
|
338
|
+
this.LCascadefilter = this.PushCascade(this.Sorters.length);
|
|
339
|
+
// Filtra las propiedades de ordenación que coinciden con los campos existentes.
|
|
340
|
+
this.OrderBy = Object.fromEntries(Object.entries(this.OrderBy).filter(([key]) => this.Sorters.find((y) => y.field === key)));
|
|
341
|
+
// Obtiene las columnas y el orden de la ordenación.
|
|
342
|
+
const columns = Object.keys(this.OrderBy).map(x => x);
|
|
343
|
+
const order = columns.map(x => this.OrderBy[x]);
|
|
344
|
+
// Asigna las propiedades de ordenación a los modelos de filtro en cascada.
|
|
345
|
+
columns.forEach((f, i) => {
|
|
346
|
+
this.LCascadefilter[i].id = f;
|
|
347
|
+
this.LCascadefilter[i].order = order[i];
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Función que genera una lista de modelos de filtro en cascada con una cantidad determinada.
|
|
352
|
+
*
|
|
353
|
+
* @param {number} cant - Cantidad de modelos de filtro en cascada a generar.
|
|
354
|
+
* @returns {Array} - Lista de modelos de filtro en cascada.
|
|
355
|
+
*/
|
|
356
|
+
PushCascade(cant) {
|
|
357
|
+
let Lcascadefilter = [];
|
|
358
|
+
for (let i = 0; i < cant; i++) {
|
|
359
|
+
Lcascadefilter.push({ id: "0", index: i, order: OrderConstants.ORDER_BY_ASC });
|
|
360
|
+
}
|
|
361
|
+
return Lcascadefilter;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Verifica y procesa la ordenación en cascada.
|
|
365
|
+
* - Si algún modelo de filtro en cascada tiene un ID diferente de '0', se realiza la ordenación.
|
|
366
|
+
* - De lo contrario, se emite una alerta indicando que no hay columna seleccionada para ordenar.
|
|
367
|
+
*/
|
|
368
|
+
CheckCascadeOrder() {
|
|
369
|
+
this.OrderBy = {};
|
|
370
|
+
if (this.LCascadefilter.some(s => s.id !== "0")) {
|
|
371
|
+
this.CascadeOrder();
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
return this.AlertOrder.emit({ ValidMessage: "Select at least one column to sort" }); //this.sharedService.getTermTextByCode("MSG_NO_COLUMN_ORDER") });
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Procesa la ordenación en cascada y emite el resultado.
|
|
379
|
+
*/
|
|
380
|
+
CascadeOrder() {
|
|
381
|
+
this.LCascadefilter.forEach(element => {
|
|
382
|
+
if (element.id !== "0") {
|
|
383
|
+
this.OrderBy[element.id] = element.order;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
this.ReturnSorting.emit(this.OrderBy);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Restaura la ordenación en cascada a la configuración predeterminada y obtiene la información de ordenación.
|
|
390
|
+
*/
|
|
391
|
+
ClearCascadeOrder() {
|
|
392
|
+
this.OrderBy = { ...this.OrderByDefault };
|
|
393
|
+
this.GetInfoSorting();
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Verifica si un modelo de filtro en cascada está deshabilitado basándose en su ID.
|
|
397
|
+
*
|
|
398
|
+
* @param {string} id - ID del modelo de filtro en cascada.
|
|
399
|
+
* @param {number} index - Índice del modelo de filtro en cascada.
|
|
400
|
+
* @returns {boolean} - Indica si el modelo de filtro en cascada está deshabilitado.
|
|
401
|
+
*/
|
|
402
|
+
CheckCascadeDisabled(id, index) {
|
|
403
|
+
return this.LCascadefilter.some(e => e.id == id);
|
|
404
|
+
}
|
|
405
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SortingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
406
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.23", type: SortingComponent, isStandalone: true, selector: "intelica-sorting", inputs: { Sorters: "Sorters", OrderBy: "OrderBy", OrderByDefault: "OrderByDefault", OneRender: "OneRender" }, outputs: { ReturnSorting: "ReturnSorting", AlertOrder: "AlertOrder" }, usesOnChanges: true, ngImport: i0, template: "<ng-container>\n\t<div class=\"sortingAnalytics\">\n\t\t<div class=\"sortingCtr\">\n\t\t\t<div></div>\n\t\t\t<div class=\"triangle-top\"></div>\n\t\t\t<div class=\"triangle-down\"></div>\n\t\t\t<ng-container *ngIf=\"OneRender; else multiple_render\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"one_render; context: { Sorters: Sorters }\"></ng-container>\n\t\t\t</ng-container>\n\t\t</div>\n\n\t\t<div class=\"sortingBtnCtr\">\n\t\t\t<!-- <span>{{'BTN_APPLY_SORT' | term : terms}}</span> -->\n\t\t\t<p-button pRipple class=\"prButton applyAnalytics\" label=\"{{ 'Apply sort' }}\" (onClick)=\"CheckCascadeOrder()\" />\n\t\t\t<!-- <span>{{'BTN_CLEAR_SORT' | term : terms}}</span> -->\n\t\t\t<p-button pRipple class=\"prButton cleanAnalytics\" label=\"{{ 'Clear sort' }}\" severity=\"secondary\" (onClick)=\"ClearCascadeOrder()\" />\n\t\t</div>\n\t</div>\n</ng-container>\n\n<ng-template #one_render let-Sorters=\"Sorters\">\n\t<ng-container *ngFor=\"let row of Sorters; let i = index\">\n\t\t<ng-container *ngIf=\"LCascadefilter.length > 0 && i <= NumMaxSorting\">\n\t\t\t<ng-container *ngIf=\"OneRender && i == 0\">\n\t\t\t\t<div class=\"idx-select\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<div class=\"formRowInputNumber\">\n\t\t\t\t\t\t<span>{{ i + 1 }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<select class=\"grSelect\" [(ngModel)]=\"LCascadefilter[i].id\">\n\t\t\t\t\t\t<option *ngIf=\"i === 0\" [value]=\"0\">\n\t\t\t\t\t\t\t--\n\t\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_BY\" | term : terms }}</span> -->\n\t\t\t\t\t\t\t<span>Sort By</span>\n\t\t\t\t\t\t\t--\n\t\t\t\t\t\t</option>\n\t\t\t\t\t\t<option *ngFor=\"let sort of Sorters\" [ngValue]=\"sort.field\" [disabled]=\"CheckCascadeDisabled(sort.field, i)\">\n\t\t\t\t\t\t\t{{ sort.headerText }}\n\t\t\t\t\t\t</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_ASC\" [inputId]=\"'test{{ i + i + 1 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t\t<label for=\"test{{ i + i + 1 }}\"></label>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_DESC\" [inputId]=\"'test{{ i + i + 2 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t\t<label for=\"test{{ i + i + 2 }}\"></label>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\t</ng-container>\n</ng-template>\n\n<ng-template #multiple_render>\n\t<ng-container *ngFor=\"let row of Sorters; let i = index\">\n\t\t<ng-container *ngIf=\"LCascadefilter.length > 0 && i <= NumMaxSorting\">\n\t\t\t<div class=\"idx-select\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<div class=\"formRowInputNumber\">\n\t\t\t\t\t<span>{{ i + 1 }}</span>\n\t\t\t\t</div>\n\t\t\t\t<select class=\"grSelect\" [(ngModel)]=\"LCascadefilter[i].id\">\n\t\t\t\t\t<option *ngIf=\"i === 0\" [value]=\"0\">\n\t\t\t\t\t\t--\n\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_BY\" | term : terms }}</span> -->\n\t\t\t\t\t\t<span>Sort By</span>\n\t\t\t\t\t\t--\n\t\t\t\t\t</option>\n\t\t\t\t\t<option *ngIf=\"i > 0\" [value]=\"0\">\n\t\t\t\t\t\t--\n\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_THEN\" | term : terms }}</span> -->\n\t\t\t\t\t\t<span>Then by</span>\n\t\t\t\t\t\t--\n\t\t\t\t\t</option>\n\t\t\t\t\t<option *ngFor=\"let sort of Sorters\" [ngValue]=\"sort.field\" [disabled]=\"CheckCascadeDisabled(sort.field, i)\">\n\t\t\t\t\t\t{{ sort.headerText }}\n\t\t\t\t\t</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\n\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_ASC\" [inputId]=\"'test{{ i + i + 1 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t<label for=\"test{{ i + i + 1 }}\"></label>\n\t\t\t</div>\n\n\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_DESC\" [inputId]=\"'test{{ i + i + 2 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t<label for=\"test{{ i + i + 2 }}\"></label>\n\t\t\t</div>\n\t\t</ng-container>\n\t</ng-container>\n</ng-template>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { 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: RadioButtonModule }, { kind: "component", type: i2.RadioButton, selector: "p-radioButton, p-radiobutton, p-radio-button", inputs: ["value", "tabindex", "inputId", "ariaLabelledBy", "ariaLabel", "styleClass", "autofocus", "binary", "variant", "size"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i4.Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }] });
|
|
407
|
+
}
|
|
408
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SortingComponent, decorators: [{
|
|
409
|
+
type: Component,
|
|
410
|
+
args: [{ selector: "intelica-sorting", imports: [CommonModule, FormsModule, RadioButtonModule, ButtonModule], template: "<ng-container>\n\t<div class=\"sortingAnalytics\">\n\t\t<div class=\"sortingCtr\">\n\t\t\t<div></div>\n\t\t\t<div class=\"triangle-top\"></div>\n\t\t\t<div class=\"triangle-down\"></div>\n\t\t\t<ng-container *ngIf=\"OneRender; else multiple_render\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"one_render; context: { Sorters: Sorters }\"></ng-container>\n\t\t\t</ng-container>\n\t\t</div>\n\n\t\t<div class=\"sortingBtnCtr\">\n\t\t\t<!-- <span>{{'BTN_APPLY_SORT' | term : terms}}</span> -->\n\t\t\t<p-button pRipple class=\"prButton applyAnalytics\" label=\"{{ 'Apply sort' }}\" (onClick)=\"CheckCascadeOrder()\" />\n\t\t\t<!-- <span>{{'BTN_CLEAR_SORT' | term : terms}}</span> -->\n\t\t\t<p-button pRipple class=\"prButton cleanAnalytics\" label=\"{{ 'Clear sort' }}\" severity=\"secondary\" (onClick)=\"ClearCascadeOrder()\" />\n\t\t</div>\n\t</div>\n</ng-container>\n\n<ng-template #one_render let-Sorters=\"Sorters\">\n\t<ng-container *ngFor=\"let row of Sorters; let i = index\">\n\t\t<ng-container *ngIf=\"LCascadefilter.length > 0 && i <= NumMaxSorting\">\n\t\t\t<ng-container *ngIf=\"OneRender && i == 0\">\n\t\t\t\t<div class=\"idx-select\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<div class=\"formRowInputNumber\">\n\t\t\t\t\t\t<span>{{ i + 1 }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<select class=\"grSelect\" [(ngModel)]=\"LCascadefilter[i].id\">\n\t\t\t\t\t\t<option *ngIf=\"i === 0\" [value]=\"0\">\n\t\t\t\t\t\t\t--\n\t\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_BY\" | term : terms }}</span> -->\n\t\t\t\t\t\t\t<span>Sort By</span>\n\t\t\t\t\t\t\t--\n\t\t\t\t\t\t</option>\n\t\t\t\t\t\t<option *ngFor=\"let sort of Sorters\" [ngValue]=\"sort.field\" [disabled]=\"CheckCascadeDisabled(sort.field, i)\">\n\t\t\t\t\t\t\t{{ sort.headerText }}\n\t\t\t\t\t\t</option>\n\t\t\t\t\t</select>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_ASC\" [inputId]=\"'test{{ i + i + 1 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t\t<label for=\"test{{ i + i + 1 }}\"></label>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_DESC\" [inputId]=\"'test{{ i + i + 2 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t\t<label for=\"test{{ i + i + 2 }}\"></label>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t</ng-container>\n\t</ng-container>\n</ng-template>\n\n<ng-template #multiple_render>\n\t<ng-container *ngFor=\"let row of Sorters; let i = index\">\n\t\t<ng-container *ngIf=\"LCascadefilter.length > 0 && i <= NumMaxSorting\">\n\t\t\t<div class=\"idx-select\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<div class=\"formRowInputNumber\">\n\t\t\t\t\t<span>{{ i + 1 }}</span>\n\t\t\t\t</div>\n\t\t\t\t<select class=\"grSelect\" [(ngModel)]=\"LCascadefilter[i].id\">\n\t\t\t\t\t<option *ngIf=\"i === 0\" [value]=\"0\">\n\t\t\t\t\t\t--\n\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_BY\" | term : terms }}</span> -->\n\t\t\t\t\t\t<span>Sort By</span>\n\t\t\t\t\t\t--\n\t\t\t\t\t</option>\n\t\t\t\t\t<option *ngIf=\"i > 0\" [value]=\"0\">\n\t\t\t\t\t\t--\n\t\t\t\t\t\t<!-- <span>{{ \"LBL_SORT_THEN\" | term : terms }}</span> -->\n\t\t\t\t\t\t<span>Then by</span>\n\t\t\t\t\t\t--\n\t\t\t\t\t</option>\n\t\t\t\t\t<option *ngFor=\"let sort of Sorters\" [ngValue]=\"sort.field\" [disabled]=\"CheckCascadeDisabled(sort.field, i)\">\n\t\t\t\t\t\t{{ sort.headerText }}\n\t\t\t\t\t</option>\n\t\t\t\t</select>\n\t\t\t</div>\n\n\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_ASC\" [inputId]=\"'test{{ i + i + 1 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t<label for=\"test{{ i + i + 1 }}\"></label>\n\t\t\t</div>\n\n\t\t\t<div class=\"form-check\" *ngIf=\"i < LCascadefilter.length\">\n\t\t\t\t<p-radiobutton class=\"prRadioButton\" name=\"optSort{{ i }}\" [value]=\"Order.ORDER_BY_DESC\" [inputId]=\"'test{{ i + i + 2 }}'\" [(ngModel)]=\"LCascadefilter[i].order\" tabindex=\"0\" />\n\t\t\t\t<label for=\"test{{ i + i + 2 }}\"></label>\n\t\t\t</div>\n\t\t</ng-container>\n\t</ng-container>\n</ng-template>\n" }]
|
|
411
|
+
}], ctorParameters: () => [], propDecorators: { Sorters: [{
|
|
412
|
+
type: Input
|
|
413
|
+
}], OrderBy: [{
|
|
414
|
+
type: Input
|
|
415
|
+
}], OrderByDefault: [{
|
|
416
|
+
type: Input
|
|
417
|
+
}], OneRender: [{
|
|
418
|
+
type: Input
|
|
419
|
+
}], ReturnSorting: [{
|
|
420
|
+
type: Output
|
|
421
|
+
}], AlertOrder: [{
|
|
422
|
+
type: Output
|
|
423
|
+
}] } });
|
|
424
|
+
|
|
425
|
+
class FormatCellPipe {
|
|
426
|
+
datePipe = inject(DatePipe);
|
|
427
|
+
transform(value, type) {
|
|
428
|
+
if (value == null)
|
|
429
|
+
return "";
|
|
430
|
+
switch (type) {
|
|
431
|
+
case "date":
|
|
432
|
+
return this.formatDateValue(value, "day");
|
|
433
|
+
case "date2":
|
|
434
|
+
return this.formatDateValue(value, "month");
|
|
435
|
+
case "date3":
|
|
436
|
+
return this.formatDateValue(value, "year");
|
|
437
|
+
case "time":
|
|
438
|
+
return this.formatTime(value);
|
|
439
|
+
case "decimal2":
|
|
440
|
+
return this.formatDecimal(value, 2);
|
|
441
|
+
case "decimal4":
|
|
442
|
+
return this.formatDecimal(value, 4);
|
|
443
|
+
case "tarifa":
|
|
444
|
+
return this.formatTarifa(value);
|
|
445
|
+
default:
|
|
446
|
+
return value;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
getDateFormat(mode) {
|
|
450
|
+
switch (mode) {
|
|
451
|
+
case "month":
|
|
452
|
+
return "M/yy";
|
|
453
|
+
case "year":
|
|
454
|
+
return "yy";
|
|
455
|
+
default:
|
|
456
|
+
return "d/M/yy";
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
formatDateValue(value, mode) {
|
|
460
|
+
const pattern = this.getDateFormat(mode);
|
|
461
|
+
if (Array.isArray(value) && value.length === 2) {
|
|
462
|
+
return `${this.datePipe.transform(value[0], pattern)} - ${this.datePipe.transform(value[1], pattern)}`;
|
|
463
|
+
}
|
|
464
|
+
if (value) {
|
|
465
|
+
return this.datePipe.transform(value, pattern) || "";
|
|
466
|
+
}
|
|
467
|
+
return "";
|
|
468
|
+
}
|
|
469
|
+
formatTime(value) {
|
|
470
|
+
const date = new Date(value);
|
|
471
|
+
if (isNaN(date.getTime()))
|
|
472
|
+
return "";
|
|
473
|
+
let hours = date.getHours();
|
|
474
|
+
const minutes = date.getMinutes();
|
|
475
|
+
const seconds = date.getSeconds();
|
|
476
|
+
const ampm = hours >= 12 ? "PM" : "AM";
|
|
477
|
+
hours = hours % 12;
|
|
478
|
+
hours = hours ? hours : 12;
|
|
479
|
+
const hh = hours.toString().padStart(2, "0");
|
|
480
|
+
const mm = minutes.toString().padStart(2, "0");
|
|
481
|
+
const ss = seconds.toString().padStart(2, "0");
|
|
482
|
+
return `${hh}:${mm}:${ss} ${ampm}`;
|
|
483
|
+
}
|
|
484
|
+
formatDecimal(value, digits) {
|
|
485
|
+
const num = parseFloat(value);
|
|
486
|
+
if (isNaN(num))
|
|
487
|
+
return "";
|
|
488
|
+
return num.toFixed(digits);
|
|
489
|
+
}
|
|
490
|
+
formatTarifa(value) {
|
|
491
|
+
const num = parseFloat(value);
|
|
492
|
+
if (isNaN(num))
|
|
493
|
+
return "";
|
|
494
|
+
const absNum = Math.abs(num);
|
|
495
|
+
if (absNum >= 0.000001 && absNum <= 0.1) {
|
|
496
|
+
// Mostrar hasta 6 decimales
|
|
497
|
+
return absNum.toFixed(6);
|
|
498
|
+
}
|
|
499
|
+
else if (absNum < 0.000001) {
|
|
500
|
+
return num.toString();
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
return num.toString();
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: FormatCellPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
507
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.23", ngImport: i0, type: FormatCellPipe, isStandalone: true, name: "formatCell" });
|
|
508
|
+
}
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: FormatCellPipe, decorators: [{
|
|
510
|
+
type: Pipe,
|
|
511
|
+
args: [{
|
|
512
|
+
name: "formatCell",
|
|
513
|
+
standalone: true,
|
|
514
|
+
}]
|
|
515
|
+
}] });
|
|
516
|
+
|
|
517
|
+
class SharedService {
|
|
518
|
+
location;
|
|
519
|
+
configObservable = new Subject();
|
|
520
|
+
isLoading = new BehaviorSubject(false);
|
|
521
|
+
isLoadingHeader = new BehaviorSubject(true);
|
|
522
|
+
isExpandedContent = new BehaviorSubject(false);
|
|
523
|
+
isLoadingPageInfo = new BehaviorSubject(true);
|
|
524
|
+
notifyProfileType = new Subject();
|
|
525
|
+
charges = 0;
|
|
526
|
+
showHelper = new BehaviorSubject(false);
|
|
527
|
+
headerPathName = new BehaviorSubject([]);
|
|
528
|
+
pageId = 0;
|
|
529
|
+
openActionMenu$ = new Subject();
|
|
530
|
+
months = {
|
|
531
|
+
en: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
532
|
+
es: ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"],
|
|
533
|
+
};
|
|
534
|
+
subtitleDescriptionNotification$;
|
|
535
|
+
constructor(location) {
|
|
536
|
+
this.location = location;
|
|
537
|
+
}
|
|
538
|
+
///METODOS GLOBALS.
|
|
539
|
+
IsNumberRate(n) {
|
|
540
|
+
return !isNaN(parseFloat(n)) && !isNaN(n - 0);
|
|
541
|
+
}
|
|
542
|
+
RemovePercentage(string) {
|
|
543
|
+
if (string.length > 0) {
|
|
544
|
+
if (string.startsWith("%"))
|
|
545
|
+
string = string.substring(1);
|
|
546
|
+
let last = string.length - 1;
|
|
547
|
+
if (string.endsWith("%"))
|
|
548
|
+
string = string.substring(0, last);
|
|
549
|
+
}
|
|
550
|
+
return string;
|
|
551
|
+
}
|
|
552
|
+
GetTotalAmountByCrncy(col, listGeneral) {
|
|
553
|
+
return listGeneral.reduce((a, b) => a + (b[col] || 0), 0);
|
|
554
|
+
}
|
|
555
|
+
GetTotalAverageByColumn(col, listGeneral) {
|
|
556
|
+
return listGeneral.reduce((a, b) => a + (b[col] || 0), 0) / (listGeneral.length || 1);
|
|
557
|
+
}
|
|
558
|
+
GetTotalByGroup(col, listGeneral, groupBy) {
|
|
559
|
+
if (!groupBy?.length)
|
|
560
|
+
return [listGeneral.reduce((a, b) => a + (b[col] || 0), 0)];
|
|
561
|
+
let result = listGeneral.reduce((acc, item) => {
|
|
562
|
+
const groupKey = groupBy.map(prop => item[prop]).join("||");
|
|
563
|
+
acc[groupKey] = (acc[groupKey] || 0) + item[col];
|
|
564
|
+
return acc;
|
|
565
|
+
}, {});
|
|
566
|
+
const propiedades = Object.keys(result).sort();
|
|
567
|
+
const indexGroup = groupBy.indexOf(col);
|
|
568
|
+
if (indexGroup != -1)
|
|
569
|
+
return propiedades.map(propiedad => propiedad.split("||")[indexGroup]);
|
|
570
|
+
return propiedades.map(propiedad => result[propiedad]);
|
|
571
|
+
}
|
|
572
|
+
TransformNegative(value) {
|
|
573
|
+
value = value?.toString() ?? "0.00";
|
|
574
|
+
if (value?.indexOf("-") > -1)
|
|
575
|
+
return "(" + value.replace("-", "") + ")";
|
|
576
|
+
else
|
|
577
|
+
return value.toString();
|
|
578
|
+
}
|
|
579
|
+
FormatNumber(value, decimalMax, decimalMin) {
|
|
580
|
+
return value.toLocaleString("en-US", {
|
|
581
|
+
maximumFractionDigits: decimalMax,
|
|
582
|
+
minimumFractionDigits: decimalMin,
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
ClickOutSideValidator(event) {
|
|
586
|
+
let res = false;
|
|
587
|
+
if (event !== undefined) {
|
|
588
|
+
const src = event.srcElement;
|
|
589
|
+
res = src.id !== "button-alignment" && !this.CheckParents(src, 0);
|
|
590
|
+
}
|
|
591
|
+
return res;
|
|
592
|
+
}
|
|
593
|
+
CheckParents(src, c) {
|
|
594
|
+
var ids = [];
|
|
595
|
+
ids.push("HamburgerMenu");
|
|
596
|
+
var strings = [];
|
|
597
|
+
strings.push("swal2-container");
|
|
598
|
+
if (src.className.includes("backdrop-visible"))
|
|
599
|
+
return false;
|
|
600
|
+
var res = ids.some(function (v) {
|
|
601
|
+
return src.id === v;
|
|
602
|
+
});
|
|
603
|
+
if (!res && (src.tagName === "BODY" || src.parentElement === null) && c === 0) {
|
|
604
|
+
res = true;
|
|
605
|
+
}
|
|
606
|
+
if (!res &&
|
|
607
|
+
strings.some(function (v) {
|
|
608
|
+
return src.classList.contains(v);
|
|
609
|
+
}))
|
|
610
|
+
res = true;
|
|
611
|
+
if (src.parentElement && !res) {
|
|
612
|
+
c++;
|
|
613
|
+
res = this.CheckParents(src.parentElement, c);
|
|
614
|
+
}
|
|
615
|
+
return res;
|
|
616
|
+
}
|
|
617
|
+
GetTitleByRegionOrCountry(CurrentGroup, Current, field) {
|
|
618
|
+
return CurrentGroup ? CurrentGroup.groupName + " - " + Current[field] : Current[field];
|
|
619
|
+
}
|
|
620
|
+
GetTitleByBank(ListGeneralCountryAll, CurrentBank) {
|
|
621
|
+
return ListGeneralCountryAll.length > 1 ? CurrentBank.groupName + " - " + CurrentBank.countryName + " - " + CurrentBank.bankNameCommercial : CurrentBank.bankNameCommercial;
|
|
622
|
+
}
|
|
623
|
+
Roundgen(value, precision) {
|
|
624
|
+
var multiplier = Math.pow(10, precision || 0);
|
|
625
|
+
return Math.round(value * multiplier) / multiplier;
|
|
626
|
+
}
|
|
627
|
+
ReturnAmountPercen(amount) {
|
|
628
|
+
if (isNaN(amount))
|
|
629
|
+
amount = 0;
|
|
630
|
+
let resultado = "";
|
|
631
|
+
let AmountStr = amount === 0
|
|
632
|
+
? "0"
|
|
633
|
+
: amount.toLocaleString("en-US", {
|
|
634
|
+
maximumFractionDigits: 1,
|
|
635
|
+
minimumFractionDigits: 1,
|
|
636
|
+
});
|
|
637
|
+
if (AmountStr.indexOf(".0") !== -1)
|
|
638
|
+
AmountStr = amount.toLocaleString("en-US", {
|
|
639
|
+
maximumFractionDigits: 0,
|
|
640
|
+
minimumFractionDigits: 0,
|
|
641
|
+
});
|
|
642
|
+
if (amount < 0 && parseInt(amount.toString()) * -1 === 0) {
|
|
643
|
+
resultado =
|
|
644
|
+
amount
|
|
645
|
+
.toLocaleString("en-US", {
|
|
646
|
+
maximumFractionDigits: 1,
|
|
647
|
+
minimumFractionDigits: 1,
|
|
648
|
+
})
|
|
649
|
+
.replace("-", "(") + "%)";
|
|
650
|
+
}
|
|
651
|
+
else if (amount < 0)
|
|
652
|
+
resultado = AmountStr.replace("-", "(") + "%)";
|
|
653
|
+
else
|
|
654
|
+
resultado = AmountStr + "%";
|
|
655
|
+
if (Number.NEGATIVE_INFINITY === amount || Number.POSITIVE_INFINITY === amount)
|
|
656
|
+
resultado = "";
|
|
657
|
+
return resultado;
|
|
658
|
+
}
|
|
659
|
+
ReturAmountFormat(amount) {
|
|
660
|
+
if (isNaN(amount))
|
|
661
|
+
amount = 0;
|
|
662
|
+
amount = this.Roundgen(amount, 2);
|
|
663
|
+
let resultado = "";
|
|
664
|
+
if (amount < 0 && parseInt(amount.toString()) * -1 === 0)
|
|
665
|
+
resultado = amount.toString().replace("-", "(") + ")";
|
|
666
|
+
else if (amount < 0 && amount > -1000) {
|
|
667
|
+
resultado = this.Roundgen(amount, 0).toString().replace("-", "(") + ")";
|
|
668
|
+
}
|
|
669
|
+
else if (amount < 0 && -1000000000 >= amount) {
|
|
670
|
+
resultado =
|
|
671
|
+
this.Roundgen(amount / 1000000000, 1)
|
|
672
|
+
.toString()
|
|
673
|
+
.replace("-", "(") + " B)";
|
|
674
|
+
}
|
|
675
|
+
else if (amount < 0 && -1000000 >= amount) {
|
|
676
|
+
resultado =
|
|
677
|
+
this.Roundgen(amount / 1000000, 1)
|
|
678
|
+
.toString()
|
|
679
|
+
.replace("-", "(") + " M)";
|
|
680
|
+
}
|
|
681
|
+
else if (amount < 0) {
|
|
682
|
+
resultado =
|
|
683
|
+
this.Roundgen(amount / 1000, 1)
|
|
684
|
+
.toString()
|
|
685
|
+
.replace("-", "(") + " K)";
|
|
686
|
+
}
|
|
687
|
+
else if (amount < 1000)
|
|
688
|
+
resultado = this.Roundgen(amount, 0).toString();
|
|
689
|
+
else if (1000000000 < amount)
|
|
690
|
+
resultado = this.Roundgen(amount / 1000000000, 1).toString() + " B";
|
|
691
|
+
else if (1000000 < amount)
|
|
692
|
+
resultado = this.Roundgen(amount / 1000000, 1).toString() + " M";
|
|
693
|
+
else
|
|
694
|
+
resultado = this.Roundgen(amount / 1000, 1).toString() + " K";
|
|
695
|
+
if (resultado.indexOf(".") === -1 && amount !== 0 && amount >= 1000) {
|
|
696
|
+
let a = resultado;
|
|
697
|
+
let b = ".0";
|
|
698
|
+
let output = a + b;
|
|
699
|
+
if (resultado.indexOf(" ") !== -1) {
|
|
700
|
+
let position = resultado.indexOf(" ");
|
|
701
|
+
output = [a.slice(0, position), b, a.slice(position)].join("");
|
|
702
|
+
}
|
|
703
|
+
else if (resultado.indexOf(" ") === -1 && resultado.indexOf(")") !== -1) {
|
|
704
|
+
let position = resultado.indexOf(")");
|
|
705
|
+
output = [a.slice(0, position), b, a.slice(position)].join("");
|
|
706
|
+
}
|
|
707
|
+
resultado = output;
|
|
708
|
+
}
|
|
709
|
+
return resultado;
|
|
710
|
+
}
|
|
711
|
+
DownloadFile(fileName, blob) {
|
|
712
|
+
const nav = window.navigator;
|
|
713
|
+
if (nav.msSaveOrOpenBlob) {
|
|
714
|
+
nav.msSaveOrOpenBlob(blob, fileName);
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
const link = document.createElement("a");
|
|
718
|
+
link.setAttribute("type", "hidden");
|
|
719
|
+
link.download = fileName;
|
|
720
|
+
link.href = window.URL.createObjectURL(blob.body);
|
|
721
|
+
document.body.appendChild(link);
|
|
722
|
+
link.click();
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
ViewFile(response) {
|
|
726
|
+
const a = document.createElement("a");
|
|
727
|
+
a.setAttribute("style", "display:none;");
|
|
728
|
+
document.body.appendChild(a);
|
|
729
|
+
a.href = URL.createObjectURL(response.body);
|
|
730
|
+
a.target = "_blank";
|
|
731
|
+
a.click();
|
|
732
|
+
document.body.removeChild(a);
|
|
733
|
+
}
|
|
734
|
+
GetNumberCurrency(amount) {
|
|
735
|
+
return amount === 0
|
|
736
|
+
? "0"
|
|
737
|
+
: amount.toLocaleString("en-US", {
|
|
738
|
+
maximumFractionDigits: 2,
|
|
739
|
+
minimumFractionDigits: 2,
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
CountDecimals(param) {
|
|
743
|
+
if (Math.floor(param) === param)
|
|
744
|
+
return 0;
|
|
745
|
+
return param.toString().split(".")[1].length || 0;
|
|
746
|
+
}
|
|
747
|
+
IsEmpty(value) {
|
|
748
|
+
return value === null || value === "" || value === undefined;
|
|
749
|
+
}
|
|
750
|
+
GroupByColumn(data, columnGroup) {
|
|
751
|
+
let colUnique = [];
|
|
752
|
+
if (columnGroup != "") {
|
|
753
|
+
colUnique = [
|
|
754
|
+
...new Set(data.map(item => {
|
|
755
|
+
return item[columnGroup];
|
|
756
|
+
})),
|
|
757
|
+
].filter(unique => !this.IsEmpty(unique));
|
|
758
|
+
}
|
|
759
|
+
else {
|
|
760
|
+
colUnique = [
|
|
761
|
+
...new Set(data.map(item => {
|
|
762
|
+
return item;
|
|
763
|
+
})),
|
|
764
|
+
].filter(unique => !this.IsEmpty(unique));
|
|
765
|
+
}
|
|
766
|
+
return colUnique;
|
|
767
|
+
}
|
|
768
|
+
GetRoswpanbyData(column, index, data) {
|
|
769
|
+
let ValOfAgruppated = null;
|
|
770
|
+
let rowspanI = 1;
|
|
771
|
+
for (let i = index - 1; i < data.length; i++) {
|
|
772
|
+
let val = data[i][column];
|
|
773
|
+
if (ValOfAgruppated == null) {
|
|
774
|
+
ValOfAgruppated = val;
|
|
775
|
+
}
|
|
776
|
+
else if (val !== null && ValOfAgruppated == val) {
|
|
777
|
+
rowspanI++;
|
|
778
|
+
}
|
|
779
|
+
else if (val !== null && ValOfAgruppated != val) {
|
|
780
|
+
ValOfAgruppated = null;
|
|
781
|
+
return rowspanI;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return rowspanI;
|
|
785
|
+
}
|
|
786
|
+
FormatterStringJsonByKey(data, key, separador) {
|
|
787
|
+
let result = "";
|
|
788
|
+
let colUnique = [];
|
|
789
|
+
data.forEach(element => {
|
|
790
|
+
colUnique.push(element[key]);
|
|
791
|
+
});
|
|
792
|
+
result = colUnique.join(separador);
|
|
793
|
+
return result;
|
|
794
|
+
}
|
|
795
|
+
GroupByKey(xs, key) {
|
|
796
|
+
return xs.reduce(function (rv, x) {
|
|
797
|
+
(rv[x[key]] = rv[x[key]] || []).push(x);
|
|
798
|
+
return rv;
|
|
799
|
+
}, {});
|
|
800
|
+
}
|
|
801
|
+
LoadProjectsCss(route) {
|
|
802
|
+
const elements = this.CheckProjectsCss(route);
|
|
803
|
+
if (elements.length === 0) {
|
|
804
|
+
const node = document.createElement("link");
|
|
805
|
+
node.href = "./assets/css/projects/" + route + ".css";
|
|
806
|
+
node.rel = "stylesheet";
|
|
807
|
+
document.getElementsByTagName("head")[0].appendChild(node);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
RemoveProjectsCss(route) {
|
|
811
|
+
const elements = this.CheckProjectsCss(route);
|
|
812
|
+
elements.forEach(element => {
|
|
813
|
+
document.getElementsByTagName("head")[0].removeChild(element);
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
CheckProjectsCss(route) {
|
|
817
|
+
const parent = document.getElementsByTagName("head")[0];
|
|
818
|
+
const elements = [];
|
|
819
|
+
parent.childNodes.forEach((element) => {
|
|
820
|
+
var a = element;
|
|
821
|
+
if (element.nodeName === "LINK") {
|
|
822
|
+
var elemethref = element["href"];
|
|
823
|
+
if (elemethref && elemethref.indexOf(route) > 0) {
|
|
824
|
+
elements.push(element);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
return elements;
|
|
829
|
+
}
|
|
830
|
+
CountDecimalsDigits(numero) {
|
|
831
|
+
if (this.IsEmpty(numero))
|
|
832
|
+
return 0;
|
|
833
|
+
numero = parseFloat(numero);
|
|
834
|
+
let arrayNumero = numero.toString().split(".");
|
|
835
|
+
numero = arrayNumero.length > 1 ? arrayNumero[1] : "";
|
|
836
|
+
return numero.length;
|
|
837
|
+
}
|
|
838
|
+
GetMaxNumberDecimals(data, key) {
|
|
839
|
+
let arrCountDecimals = [];
|
|
840
|
+
data.forEach(element => {
|
|
841
|
+
let decimals = this.CountDecimalsDigits(element[key]);
|
|
842
|
+
arrCountDecimals.push(decimals);
|
|
843
|
+
});
|
|
844
|
+
var maxDecimal = Math.max(...arrCountDecimals);
|
|
845
|
+
return maxDecimal;
|
|
846
|
+
}
|
|
847
|
+
SetHeaderPathName(name) {
|
|
848
|
+
this.headerPathName.next(name);
|
|
849
|
+
}
|
|
850
|
+
FormatDate(date, format) {
|
|
851
|
+
return moment(date).format(format);
|
|
852
|
+
}
|
|
853
|
+
CopyTo(src, dest) {
|
|
854
|
+
Object.keys(src).forEach(property => {
|
|
855
|
+
dest[property] = src[property];
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
IsValidEmail(email) {
|
|
859
|
+
const emailPattern = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/;
|
|
860
|
+
return emailPattern.test(email);
|
|
861
|
+
}
|
|
862
|
+
IsGuid(str) {
|
|
863
|
+
const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
864
|
+
return guidRegex.test(str);
|
|
865
|
+
}
|
|
866
|
+
ContainsSpecialCharacters(str) {
|
|
867
|
+
const specialCharacter = /^[^\\/?%*:|"<>]+$/;
|
|
868
|
+
return !specialCharacter.test(str);
|
|
869
|
+
}
|
|
870
|
+
IsNumber(value) {
|
|
871
|
+
return /^-?\d+(\.\d+)?$/.test(value);
|
|
872
|
+
}
|
|
873
|
+
CalculatePreviousDate(date, monthsAgo) {
|
|
874
|
+
date.setMonth(date.getMonth() - monthsAgo);
|
|
875
|
+
const newDate = moment(date).format(FormatDateConstants.DMYY_MOMENT);
|
|
876
|
+
return newDate;
|
|
877
|
+
}
|
|
878
|
+
GetFilteredSearchKey(listTempAll, key, value, operatorId) {
|
|
879
|
+
let listFilter = [];
|
|
880
|
+
switch (operatorId) {
|
|
881
|
+
case 0: //'Contains'
|
|
882
|
+
let word = value.split("&", 100);
|
|
883
|
+
let count = 0;
|
|
884
|
+
let listTemp;
|
|
885
|
+
if (word.length > 1) {
|
|
886
|
+
word.forEach((element) => {
|
|
887
|
+
if (count === 0) {
|
|
888
|
+
listTemp = listTempAll.filter(a => a[key]?.toString()?.toLowerCase().includes(element.toLowerCase()));
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
listTemp = listTemp.filter((a) => a[key]?.toString()?.toLowerCase().includes(element.toLowerCase()));
|
|
892
|
+
}
|
|
893
|
+
count++;
|
|
894
|
+
});
|
|
895
|
+
listFilter = listTemp;
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
listFilter = listTempAll.filter(a => a[key]?.toString()?.toLowerCase().includes(value));
|
|
899
|
+
}
|
|
900
|
+
break;
|
|
901
|
+
case 1: //'Exact'
|
|
902
|
+
listFilter = value ? listTempAll.filter(a => a[key]?.toString()?.toLowerCase() === value) : listTempAll;
|
|
903
|
+
break;
|
|
904
|
+
case 2: //'Begin'
|
|
905
|
+
listFilter = listTempAll.filter(a => a[key]?.toString()?.toLowerCase().startsWith(value));
|
|
906
|
+
break;
|
|
907
|
+
case 3: //'Ends'
|
|
908
|
+
listFilter = listTempAll.filter(a => a[key]?.toString()?.toLowerCase().endsWith(value));
|
|
909
|
+
break;
|
|
910
|
+
default:
|
|
911
|
+
listFilter = listTempAll.filter(a => a[key]?.toString()?.toLowerCase().includes(value));
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
914
|
+
return listFilter;
|
|
915
|
+
}
|
|
916
|
+
GetFilteredSearchKeyV2(listTempAll, key, value, operatorId, subKey = null) {
|
|
917
|
+
if (value.length == 0)
|
|
918
|
+
return listTempAll;
|
|
919
|
+
if (!listTempAll || !key || value == null)
|
|
920
|
+
return [];
|
|
921
|
+
let listFilter = listTempAll;
|
|
922
|
+
value = value.toString().toLowerCase();
|
|
923
|
+
const words = value.includes("&") ? value.split("&").filter(Boolean) : [value];
|
|
924
|
+
const filterFunction = (item) => {
|
|
925
|
+
const itemValue = item[key]?.toString()?.toLowerCase();
|
|
926
|
+
switch (operatorId) {
|
|
927
|
+
case 0: // 'Contains'
|
|
928
|
+
return words.every((word) => itemValue?.includes(word));
|
|
929
|
+
case 1: // 'Exact'
|
|
930
|
+
return itemValue === value;
|
|
931
|
+
case 2: // 'Begin'
|
|
932
|
+
return itemValue?.startsWith(value);
|
|
933
|
+
case 3: // 'Ends'
|
|
934
|
+
return itemValue?.endsWith(value);
|
|
935
|
+
default:
|
|
936
|
+
return itemValue?.includes(value);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
if (subKey) {
|
|
940
|
+
// Filtrar primero a nivel de sublista
|
|
941
|
+
listFilter = listFilter.map(filter => {
|
|
942
|
+
return {
|
|
943
|
+
...filter,
|
|
944
|
+
[subKey]: filter[subKey]?.filter((item) => filterFunction(item)),
|
|
945
|
+
};
|
|
946
|
+
});
|
|
947
|
+
// Filtrar luego la lista principal basado en si la sublista contiene elementos
|
|
948
|
+
listFilter = listFilter.filter(filter => filter[subKey].length > 0);
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
// Filtrar solo la lista principal
|
|
952
|
+
listFilter = listFilter.filter(filterFunction);
|
|
953
|
+
}
|
|
954
|
+
return listFilter;
|
|
955
|
+
}
|
|
956
|
+
TransformArrayToHashTable(arr, getKey) {
|
|
957
|
+
//example of Use:
|
|
958
|
+
// this.transformArrayToHashTable<any,string>([{id:1,prop1:"prop1Value"}],(o)=>o.id.toString())
|
|
959
|
+
const hashTable = {};
|
|
960
|
+
arr.forEach((object) => (hashTable[getKey(object)] = object));
|
|
961
|
+
return hashTable;
|
|
962
|
+
}
|
|
963
|
+
TransformArrayToMap(arr, getKey) {
|
|
964
|
+
//example of Use:
|
|
965
|
+
// this.transformArrayToMap<string,any>([{id:1,prop1:"prop1Value"}],(o)=>o.id.toString())
|
|
966
|
+
return new Map(arr.map(obj => [getKey(obj), obj]));
|
|
967
|
+
}
|
|
968
|
+
UrlHasQaUatSubdomain() {
|
|
969
|
+
const { hostname } = new URL(window.location.href);
|
|
970
|
+
const [subdomain] = hostname.split(".");
|
|
971
|
+
return ["qa", "uat"].includes(subdomain);
|
|
972
|
+
}
|
|
973
|
+
UrlHasQaSubdomain() {
|
|
974
|
+
const { hostname } = new URL(window.location.href);
|
|
975
|
+
const [subdomain] = hostname.split(".");
|
|
976
|
+
return ["qa"].includes(subdomain);
|
|
977
|
+
}
|
|
978
|
+
GetLastSegmentUrl() {
|
|
979
|
+
const segments = this.location.path().split("/");
|
|
980
|
+
const lastSegment = segments[segments.length - 1];
|
|
981
|
+
const numberMappings = {
|
|
982
|
+
"0": "intelica-allocated",
|
|
983
|
+
"1": "penalty-summary",
|
|
984
|
+
};
|
|
985
|
+
// Verifica si lastSegment es un número y si tiene un mapeo correspondiente
|
|
986
|
+
if (!isNaN(Number(lastSegment)) && numberMappings.hasOwnProperty(lastSegment))
|
|
987
|
+
return numberMappings[lastSegment];
|
|
988
|
+
else
|
|
989
|
+
return lastSegment;
|
|
990
|
+
}
|
|
991
|
+
OnChangeMultiple($event, selectDescription) {
|
|
992
|
+
let select = $event != null ? $event.element.ej2_instances[0] : null;
|
|
993
|
+
if (select?.value.length > 0) {
|
|
994
|
+
select.viewWrapper.innerHTML = `${select.value.length} ${selectDescription}`;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
RemoveParamsAndSegments(url) {
|
|
998
|
+
// Remover parámetros de consultanom
|
|
999
|
+
const urlWithoutParams = url.split("?")[0];
|
|
1000
|
+
// Remover segmentos de ruta dinámicos
|
|
1001
|
+
const regex = /\/\d+(?=\/|$)(?!$)/g; // Encuentra segmentos de ruta que consisten en números
|
|
1002
|
+
return urlWithoutParams.replace(regex, "");
|
|
1003
|
+
}
|
|
1004
|
+
OpenActionMenu() {
|
|
1005
|
+
this.openActionMenu$.next(true);
|
|
1006
|
+
}
|
|
1007
|
+
AbbreviateNumber(number, fixed = 2) {
|
|
1008
|
+
if (number == 0.0 || number == 0 || number == 0.0) {
|
|
1009
|
+
return "0";
|
|
1010
|
+
}
|
|
1011
|
+
let formatCant = "";
|
|
1012
|
+
let numberOriginal = number;
|
|
1013
|
+
if (number < 0) {
|
|
1014
|
+
number = Math.abs(number);
|
|
1015
|
+
}
|
|
1016
|
+
if (number >= 1000 && number < 1000000) {
|
|
1017
|
+
number = parseFloat((number / 1000).toFixed(fixed));
|
|
1018
|
+
formatCant = " K";
|
|
1019
|
+
}
|
|
1020
|
+
else if (number >= 1000000 && number < 1000000000) {
|
|
1021
|
+
number = parseFloat((number / 1000000).toFixed(fixed));
|
|
1022
|
+
formatCant = " M";
|
|
1023
|
+
}
|
|
1024
|
+
else if (number >= 1000000000 && number <= 1000000000000) {
|
|
1025
|
+
number = parseFloat((number / 1000000000).toFixed(fixed));
|
|
1026
|
+
formatCant = " B";
|
|
1027
|
+
}
|
|
1028
|
+
else {
|
|
1029
|
+
number = this.NumberFormatByNumberCriteria(number, fixed);
|
|
1030
|
+
}
|
|
1031
|
+
return numberOriginal < 0 ? `(${number}${formatCant})` : `${number}${formatCant}`;
|
|
1032
|
+
}
|
|
1033
|
+
NumberFormatByNumberCriteria(number, fixed = 4) {
|
|
1034
|
+
const rounded = (Math.round(number * Math.pow(10, fixed)) / Math.pow(10, fixed)).toFixed(fixed);
|
|
1035
|
+
return rounded;
|
|
1036
|
+
}
|
|
1037
|
+
FormatPercentage(number, decimal = 2) {
|
|
1038
|
+
let numberInit = number;
|
|
1039
|
+
if (number < 0)
|
|
1040
|
+
number = Math.abs(number);
|
|
1041
|
+
number = parseFloat(number.toFixed(decimal));
|
|
1042
|
+
let finalNumber = `${number.toLocaleString("en-US")}%`;
|
|
1043
|
+
return numberInit < 0 ? `(${finalNumber})` : `${finalNumber}`;
|
|
1044
|
+
}
|
|
1045
|
+
GetMonthName(monthIndex, lang = "en") {
|
|
1046
|
+
return this.months[lang][monthIndex];
|
|
1047
|
+
}
|
|
1048
|
+
FormatNumberWithSuffix(number, decimalPlaces = 0) {
|
|
1049
|
+
if (number === 0) {
|
|
1050
|
+
return "0";
|
|
1051
|
+
}
|
|
1052
|
+
const isNegative = number < 0;
|
|
1053
|
+
const absoluteValue = Math.abs(number);
|
|
1054
|
+
const scaledNumber = parseFloat((absoluteValue / 1000).toFixed(decimalPlaces)).toLocaleString("en-US");
|
|
1055
|
+
const suffix = " K";
|
|
1056
|
+
return isNegative ? `(${scaledNumber}${suffix})` : `${scaledNumber}${suffix}`;
|
|
1057
|
+
}
|
|
1058
|
+
//SYNFCUNTION
|
|
1059
|
+
GenerateGUID() {
|
|
1060
|
+
let uuid = "", i, random;
|
|
1061
|
+
for (i = 0; i < 32; i++) {
|
|
1062
|
+
random = (Math.random() * 16) | 0;
|
|
1063
|
+
if (i === 8 || i === 12 || i === 16 || i === 20) {
|
|
1064
|
+
uuid += "-";
|
|
1065
|
+
}
|
|
1066
|
+
uuid += (i === 12 ? 4 : i === 16 ? (random & 3) | 8 : random).toString(16);
|
|
1067
|
+
}
|
|
1068
|
+
return uuid;
|
|
1069
|
+
}
|
|
1070
|
+
AttachDataLabelClickEvent(chartElementId, dataArray, onClickCallback) {
|
|
1071
|
+
const chartElement = document.getElementById(chartElementId);
|
|
1072
|
+
if (!chartElement) {
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
const dataLabels = chartElement.querySelectorAll('[id*="_DataLabel_"]');
|
|
1076
|
+
const dataLabelsArray = Array.prototype.slice.call(dataLabels);
|
|
1077
|
+
dataLabelsArray.forEach((label, index) => {
|
|
1078
|
+
// Calcula el índice ajustado para obtener el dato correcto
|
|
1079
|
+
const adjustedIndex = index % dataArray.length;
|
|
1080
|
+
label.addEventListener("click", () => {
|
|
1081
|
+
const clickedData = dataArray[adjustedIndex];
|
|
1082
|
+
if (clickedData) {
|
|
1083
|
+
onClickCallback(clickedData);
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
FormatNumberAbsolute(number) {
|
|
1089
|
+
const isNegative = number < 0;
|
|
1090
|
+
if (number < 0) {
|
|
1091
|
+
number = Math.abs(number);
|
|
1092
|
+
}
|
|
1093
|
+
let finalNumber = `${number.toLocaleString("en-US")}`;
|
|
1094
|
+
return isNegative ? `(${finalNumber})` : `${finalNumber}`;
|
|
1095
|
+
}
|
|
1096
|
+
SortRecursive(data, column, criteria) {
|
|
1097
|
+
return _.orderBy(data.map(item => {
|
|
1098
|
+
Object.keys(item).forEach(key => {
|
|
1099
|
+
if (Array.isArray(item[key])) {
|
|
1100
|
+
item[key] = this.SortRecursive(item[key], column, criteria);
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
return item;
|
|
1104
|
+
}), [
|
|
1105
|
+
(elm) => {
|
|
1106
|
+
let value = elm[column];
|
|
1107
|
+
if (value == null) {
|
|
1108
|
+
value = "";
|
|
1109
|
+
}
|
|
1110
|
+
if (typeof value === "string") {
|
|
1111
|
+
const normalized = value.trim().toLowerCase();
|
|
1112
|
+
const startsWithSpecial = /^[^a-z0-9]/i.test(normalized);
|
|
1113
|
+
return startsWithSpecial ? `~${normalized}` : normalized;
|
|
1114
|
+
}
|
|
1115
|
+
return value;
|
|
1116
|
+
},
|
|
1117
|
+
], [criteria]);
|
|
1118
|
+
}
|
|
1119
|
+
SortRecursivePrimeNg(data, column, criteria) {
|
|
1120
|
+
return _.orderBy(data.map(item => {
|
|
1121
|
+
Object.keys(item).forEach(key => {
|
|
1122
|
+
if (Array.isArray(item[key])) {
|
|
1123
|
+
item[key] = this.SortRecursive(item[key], column, criteria);
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
return item;
|
|
1127
|
+
}), [
|
|
1128
|
+
(elm) => {
|
|
1129
|
+
let value = elm[column];
|
|
1130
|
+
if (value == null || (typeof value === "string" && value.trim() === "")) {
|
|
1131
|
+
return "___0";
|
|
1132
|
+
}
|
|
1133
|
+
if (typeof value === "string") {
|
|
1134
|
+
const normalized = value.trim().toLowerCase();
|
|
1135
|
+
const startsWithSpecial = /^[^a-z0-9]/i.test(normalized);
|
|
1136
|
+
if (startsWithSpecial) {
|
|
1137
|
+
return `___1${normalized}`;
|
|
1138
|
+
}
|
|
1139
|
+
return `___2${normalized}`;
|
|
1140
|
+
}
|
|
1141
|
+
return `___2${value}`;
|
|
1142
|
+
},
|
|
1143
|
+
], [criteria]);
|
|
1144
|
+
}
|
|
1145
|
+
SortRecursiveNumber(data, column, criteria) {
|
|
1146
|
+
return _.orderBy(data.map(item => {
|
|
1147
|
+
Object.keys(item).forEach(key => {
|
|
1148
|
+
if (Array.isArray(item[key])) {
|
|
1149
|
+
item[key] = this.SortRecursiveNumber(item[key], column, criteria);
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
return item;
|
|
1153
|
+
}), [
|
|
1154
|
+
(elm) => {
|
|
1155
|
+
let value = elm[column];
|
|
1156
|
+
if (value == null || value === "") {
|
|
1157
|
+
return Number.NEGATIVE_INFINITY;
|
|
1158
|
+
}
|
|
1159
|
+
if (typeof value === "number") {
|
|
1160
|
+
return value;
|
|
1161
|
+
}
|
|
1162
|
+
if (!isNaN(Number(value))) {
|
|
1163
|
+
return Number(value);
|
|
1164
|
+
}
|
|
1165
|
+
return Number.NEGATIVE_INFINITY;
|
|
1166
|
+
},
|
|
1167
|
+
], [criteria]);
|
|
1168
|
+
}
|
|
1169
|
+
IsDateFormat(value) {
|
|
1170
|
+
return typeof value === "string" && /^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(value);
|
|
1171
|
+
}
|
|
1172
|
+
SortRecursiveDate(data, column, criteria) {
|
|
1173
|
+
return _.orderBy(data.map(item => {
|
|
1174
|
+
Object.keys(item).forEach(key => {
|
|
1175
|
+
if (Array.isArray(item[key])) {
|
|
1176
|
+
item[key] = this.SortRecursiveDate(item[key], column, criteria);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
return item;
|
|
1180
|
+
}), [
|
|
1181
|
+
(elm) => {
|
|
1182
|
+
let value = elm[column];
|
|
1183
|
+
if (value == null || value === "") {
|
|
1184
|
+
return Number.NEGATIVE_INFINITY;
|
|
1185
|
+
}
|
|
1186
|
+
const dateValue = new Date(value);
|
|
1187
|
+
if (isNaN(dateValue.getTime())) {
|
|
1188
|
+
return Number.NEGATIVE_INFINITY;
|
|
1189
|
+
}
|
|
1190
|
+
return dateValue.getTime();
|
|
1191
|
+
},
|
|
1192
|
+
], [criteria]);
|
|
1193
|
+
}
|
|
1194
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SharedService, deps: [{ token: i1$1.Location }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1195
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SharedService, providedIn: "root" });
|
|
1196
|
+
}
|
|
1197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SharedService, decorators: [{
|
|
1198
|
+
type: Injectable,
|
|
1199
|
+
args: [{
|
|
1200
|
+
providedIn: "root",
|
|
1201
|
+
}]
|
|
1202
|
+
}], ctorParameters: () => [{ type: i1$1.Location }] });
|
|
1203
|
+
|
|
1204
|
+
class ColumnComponent {
|
|
1205
|
+
field;
|
|
1206
|
+
header;
|
|
1207
|
+
sortable = false;
|
|
1208
|
+
width;
|
|
1209
|
+
className;
|
|
1210
|
+
headerTooltip = "";
|
|
1211
|
+
headerTooltipPosition = "top";
|
|
1212
|
+
tooltip = "";
|
|
1213
|
+
tooltipPosition = "top";
|
|
1214
|
+
showIndex = false;
|
|
1215
|
+
showHeader = true;
|
|
1216
|
+
minWidth;
|
|
1217
|
+
isChecboxColumn = false;
|
|
1218
|
+
//@Input() isGrouped: boolean = false;
|
|
1219
|
+
//@Input() isGroup: boolean = false;
|
|
1220
|
+
formatType = "string";
|
|
1221
|
+
templateRef;
|
|
1222
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ColumnComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1223
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.23", type: ColumnComponent, isStandalone: true, selector: "column", inputs: { field: "field", header: "header", sortable: "sortable", width: "width", className: "className", headerTooltip: "headerTooltip", headerTooltipPosition: "headerTooltipPosition", tooltip: "tooltip", tooltipPosition: "tooltipPosition", showIndex: "showIndex", showHeader: "showHeader", minWidth: "minWidth", isChecboxColumn: "isChecboxColumn", formatType: "formatType" }, queries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
|
|
1224
|
+
}
|
|
1225
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ColumnComponent, decorators: [{
|
|
1226
|
+
type: Directive,
|
|
1227
|
+
args: [{ selector: "column" }]
|
|
1228
|
+
}], propDecorators: { field: [{
|
|
1229
|
+
type: Input
|
|
1230
|
+
}], header: [{
|
|
1231
|
+
type: Input
|
|
1232
|
+
}], sortable: [{
|
|
1233
|
+
type: Input
|
|
1234
|
+
}], width: [{
|
|
1235
|
+
type: Input
|
|
1236
|
+
}], className: [{
|
|
1237
|
+
type: Input
|
|
1238
|
+
}], headerTooltip: [{
|
|
1239
|
+
type: Input
|
|
1240
|
+
}], headerTooltipPosition: [{
|
|
1241
|
+
type: Input
|
|
1242
|
+
}], tooltip: [{
|
|
1243
|
+
type: Input
|
|
1244
|
+
}], tooltipPosition: [{
|
|
1245
|
+
type: Input
|
|
1246
|
+
}], showIndex: [{
|
|
1247
|
+
type: Input
|
|
1248
|
+
}], showHeader: [{
|
|
1249
|
+
type: Input
|
|
1250
|
+
}], minWidth: [{
|
|
1251
|
+
type: Input
|
|
1252
|
+
}], isChecboxColumn: [{
|
|
1253
|
+
type: Input
|
|
1254
|
+
}], formatType: [{
|
|
1255
|
+
type: Input
|
|
1256
|
+
}], templateRef: [{
|
|
1257
|
+
type: ContentChild,
|
|
1258
|
+
args: [TemplateRef]
|
|
1259
|
+
}] } });
|
|
1260
|
+
class ColumnGroupComponent {
|
|
1261
|
+
field;
|
|
1262
|
+
header;
|
|
1263
|
+
sortable = false;
|
|
1264
|
+
width;
|
|
1265
|
+
minWidth;
|
|
1266
|
+
className;
|
|
1267
|
+
headerTooltip = "";
|
|
1268
|
+
headerTooltipPosition = "top";
|
|
1269
|
+
// @Input() tooltip: string = "";
|
|
1270
|
+
// @Input() tooltipPosition: "top" | "bottom" | "left" | "right" = "top";
|
|
1271
|
+
// @Input() showIndex: boolean = false;
|
|
1272
|
+
// @Input() isGrouped: boolean = false;
|
|
1273
|
+
// @Input() isGroup: boolean = false;
|
|
1274
|
+
colspan = 1;
|
|
1275
|
+
rowspan = 1;
|
|
1276
|
+
level = 0;
|
|
1277
|
+
formatType = "string";
|
|
1278
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ColumnGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1279
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.23", type: ColumnGroupComponent, isStandalone: true, selector: "columnGroup", inputs: { field: "field", header: "header", sortable: "sortable", width: "width", minWidth: "minWidth", className: "className", headerTooltip: "headerTooltip", headerTooltipPosition: "headerTooltipPosition", colspan: "colspan", rowspan: "rowspan", level: "level", formatType: "formatType" }, ngImport: i0 });
|
|
1280
|
+
}
|
|
1281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ColumnGroupComponent, decorators: [{
|
|
1282
|
+
type: Directive,
|
|
1283
|
+
args: [{ selector: "columnGroup" }]
|
|
1284
|
+
}], propDecorators: { field: [{
|
|
1285
|
+
type: Input
|
|
1286
|
+
}], header: [{
|
|
1287
|
+
type: Input
|
|
1288
|
+
}], sortable: [{
|
|
1289
|
+
type: Input
|
|
1290
|
+
}], width: [{
|
|
1291
|
+
type: Input
|
|
1292
|
+
}], minWidth: [{
|
|
1293
|
+
type: Input
|
|
1294
|
+
}], className: [{
|
|
1295
|
+
type: Input
|
|
1296
|
+
}], headerTooltip: [{
|
|
1297
|
+
type: Input
|
|
1298
|
+
}], headerTooltipPosition: [{
|
|
1299
|
+
type: Input
|
|
1300
|
+
}], colspan: [{
|
|
1301
|
+
type: Input
|
|
1302
|
+
}], rowspan: [{
|
|
1303
|
+
type: Input
|
|
1304
|
+
}], level: [{
|
|
1305
|
+
type: Input
|
|
1306
|
+
}], formatType: [{
|
|
1307
|
+
type: Input
|
|
1308
|
+
}] } });
|
|
1309
|
+
class RowResumenComponent {
|
|
1310
|
+
field;
|
|
1311
|
+
className;
|
|
1312
|
+
// @Input() width?: string;
|
|
1313
|
+
// @Input() className?: string;
|
|
1314
|
+
// @Input() headerTooltip: string = "";
|
|
1315
|
+
// @Input() headerTooltipPosition: "top" | "bottom" | "left" | "right" = "top";
|
|
1316
|
+
// @Input() tooltip: string = "";
|
|
1317
|
+
// @Input() tooltipPosition: "top" | "bottom" | "left" | "right" = "top";
|
|
1318
|
+
// @Input() showIndex: boolean = false;
|
|
1319
|
+
// @Input() isGrouped: boolean = false;
|
|
1320
|
+
// @Input() isGroup: boolean = false;
|
|
1321
|
+
colspan = 1;
|
|
1322
|
+
rowspan = 1;
|
|
1323
|
+
templateRef;
|
|
1324
|
+
formatType = "string";
|
|
1325
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: RowResumenComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1326
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.23", type: RowResumenComponent, isStandalone: true, selector: "rowResumenComponent", inputs: { field: "field", className: "className", colspan: "colspan", rowspan: "rowspan", formatType: "formatType" }, queries: [{ propertyName: "templateRef", first: true, predicate: TemplateRef, descendants: true }], ngImport: i0 });
|
|
1327
|
+
}
|
|
1328
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: RowResumenComponent, decorators: [{
|
|
1329
|
+
type: Directive,
|
|
1330
|
+
args: [{ selector: "rowResumenComponent" }]
|
|
1331
|
+
}], propDecorators: { field: [{
|
|
1332
|
+
type: Input
|
|
1333
|
+
}], className: [{
|
|
1334
|
+
type: Input
|
|
1335
|
+
}], colspan: [{
|
|
1336
|
+
type: Input
|
|
1337
|
+
}], rowspan: [{
|
|
1338
|
+
type: Input
|
|
1339
|
+
}], templateRef: [{
|
|
1340
|
+
type: ContentChild,
|
|
1341
|
+
args: [TemplateRef]
|
|
1342
|
+
}], formatType: [{
|
|
1343
|
+
type: Input
|
|
1344
|
+
}] } });
|
|
1345
|
+
|
|
1346
|
+
class TableComponent {
|
|
1347
|
+
SharedService = inject(SharedService);
|
|
1348
|
+
GlobalTermService = inject(GlobalTermService);
|
|
1349
|
+
ComponentId = "";
|
|
1350
|
+
ListData = [];
|
|
1351
|
+
ShowRowPerPage = true;
|
|
1352
|
+
ShowSearch = false;
|
|
1353
|
+
ShowPagination = false;
|
|
1354
|
+
RowsPerPage = 10;
|
|
1355
|
+
ShowCheckbox = false;
|
|
1356
|
+
ShowIndex = false;
|
|
1357
|
+
ListDataSelected = [];
|
|
1358
|
+
SelectedIdentifier = null;
|
|
1359
|
+
ClassName = "";
|
|
1360
|
+
DefaultSortField = "";
|
|
1361
|
+
DefaultSortOrder = 1;
|
|
1362
|
+
scrollHeight = "400px";
|
|
1363
|
+
scrollable = false;
|
|
1364
|
+
AllowedPageSizes = [10, 25, 50, 100];
|
|
1365
|
+
tableStyle = {};
|
|
1366
|
+
_isTableDisabled = false;
|
|
1367
|
+
_pendingUncheck = false;
|
|
1368
|
+
HeaderState = {};
|
|
1369
|
+
set IsTableDisabled(val) {
|
|
1370
|
+
this._isTableDisabled = val;
|
|
1371
|
+
if (val) {
|
|
1372
|
+
if (!this.ColumnList || this.ColumnList.length === 0) {
|
|
1373
|
+
this._pendingUncheck = true;
|
|
1374
|
+
}
|
|
1375
|
+
else {
|
|
1376
|
+
this.ListDataSelectedTemp = [];
|
|
1377
|
+
this.ListDataSelectedFilter = [];
|
|
1378
|
+
this.ExecuteSearch();
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
get IsTableDisabled() {
|
|
1383
|
+
return this._isTableDisabled;
|
|
1384
|
+
}
|
|
1385
|
+
recomputeHeaderState(field) {
|
|
1386
|
+
const total = this.ListDataFilter.length;
|
|
1387
|
+
if (total === 0) {
|
|
1388
|
+
this.HeaderState[field] = { checked: false, indeterminate: false };
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
const checked = this.ListDataFilter.filter(r => r[field] === true).length;
|
|
1392
|
+
this.HeaderState[field] = {
|
|
1393
|
+
checked: checked === total,
|
|
1394
|
+
indeterminate: checked > 0 && checked < total,
|
|
1395
|
+
};
|
|
1396
|
+
}
|
|
1397
|
+
onBodyCheckboxChange(field) {
|
|
1398
|
+
this.recomputeHeaderState(field);
|
|
1399
|
+
}
|
|
1400
|
+
refreshAllHeaderStates() {
|
|
1401
|
+
this.ColumnList.filter(c => c.isChecboxColumn).forEach(c => this.recomputeHeaderState(c.field));
|
|
1402
|
+
}
|
|
1403
|
+
EmitSelectedItem = new EventEmitter();
|
|
1404
|
+
EmitListDataFilter = new EventEmitter();
|
|
1405
|
+
EmitSearchEvent = new EventEmitter();
|
|
1406
|
+
EmitSortEvent = new EventEmitter();
|
|
1407
|
+
Columns;
|
|
1408
|
+
ColumnGroups;
|
|
1409
|
+
RowResumenGroups;
|
|
1410
|
+
AdditionalTemplate;
|
|
1411
|
+
AdditionalExtendedTemplate;
|
|
1412
|
+
AdditionalCentralTemplate;
|
|
1413
|
+
ColumnList = [];
|
|
1414
|
+
ColumnGroupList = [];
|
|
1415
|
+
RowResumenList = [];
|
|
1416
|
+
ListDataFilter = [];
|
|
1417
|
+
ListDataTable = [];
|
|
1418
|
+
ListDataSelectedFilter = [];
|
|
1419
|
+
ListDataSelectedTemp = [];
|
|
1420
|
+
SearchInput = { searchText: "" };
|
|
1421
|
+
TotalRecords = 0;
|
|
1422
|
+
CurrentPage = 1;
|
|
1423
|
+
SortOrder = 1;
|
|
1424
|
+
SortField = null;
|
|
1425
|
+
MaxLevel = 0;
|
|
1426
|
+
Levels = [];
|
|
1427
|
+
ngOnChanges() {
|
|
1428
|
+
if (!this.SortField && this.DefaultSortField) {
|
|
1429
|
+
this.SortField = this.DefaultSortField;
|
|
1430
|
+
this.SortOrder = this.DefaultSortOrder;
|
|
1431
|
+
}
|
|
1432
|
+
this.ExecuteSearch();
|
|
1433
|
+
this.ValidateSelect();
|
|
1434
|
+
}
|
|
1435
|
+
ngAfterContentInit() {
|
|
1436
|
+
this.ColumnList = this.Columns?.toArray() ?? [];
|
|
1437
|
+
this.ColumnGroupList = this.ColumnGroups?.toArray() ?? [];
|
|
1438
|
+
this.RowResumenList = this.RowResumenGroups?.toArray() ?? [];
|
|
1439
|
+
const levels = this.ColumnGroupList.map(c => c.level);
|
|
1440
|
+
this.MaxLevel = levels.length ? Math.max(...levels) + 1 : 1;
|
|
1441
|
+
this.Levels = Array.from({ length: this.MaxLevel }, (_, i) => i);
|
|
1442
|
+
this.ColumnList.filter(c => c.isChecboxColumn).forEach(c => {
|
|
1443
|
+
if (!this.HeaderState[c.field]) {
|
|
1444
|
+
this.HeaderState[c.field] = { checked: false, indeterminate: false };
|
|
1445
|
+
}
|
|
1446
|
+
});
|
|
1447
|
+
if (this._isTableDisabled && this._pendingUncheck) {
|
|
1448
|
+
this.ListDataSelectedTemp = [];
|
|
1449
|
+
this.ListDataSelectedFilter = [];
|
|
1450
|
+
this._pendingUncheck = false;
|
|
1451
|
+
this.ExecuteSearch();
|
|
1452
|
+
}
|
|
1453
|
+
else {
|
|
1454
|
+
this.refreshAllHeaderStates();
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
OnSort(field) {
|
|
1458
|
+
if (this.SortField === field) {
|
|
1459
|
+
this.SortOrder *= -1;
|
|
1460
|
+
}
|
|
1461
|
+
else {
|
|
1462
|
+
this.SortField = field;
|
|
1463
|
+
this.SortOrder = 1;
|
|
1464
|
+
}
|
|
1465
|
+
this.CurrentPage = 1;
|
|
1466
|
+
this.SortPages();
|
|
1467
|
+
}
|
|
1468
|
+
OnPageChange(event) {
|
|
1469
|
+
if (typeof event === "number") {
|
|
1470
|
+
this.CurrentPage = event;
|
|
1471
|
+
}
|
|
1472
|
+
else {
|
|
1473
|
+
if (typeof event?.rows === "number") {
|
|
1474
|
+
this.RowsPerPage = event.rows;
|
|
1475
|
+
}
|
|
1476
|
+
if (typeof event?.page === "number") {
|
|
1477
|
+
this.CurrentPage = event.page + 1;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
this.UpdatePages();
|
|
1481
|
+
}
|
|
1482
|
+
ExecuteSearch(searchText) {
|
|
1483
|
+
if (typeof searchText === "string") {
|
|
1484
|
+
this.SearchInput = { ...(this.SearchInput ?? {}), searchText };
|
|
1485
|
+
}
|
|
1486
|
+
this.ListDataFilter = [...this.ListData];
|
|
1487
|
+
const search = this.SearchInput?.searchText?.trim()?.toLowerCase();
|
|
1488
|
+
if (search) {
|
|
1489
|
+
this.ListDataFilter = this.ListData.filter(item => {
|
|
1490
|
+
const searchableText = Object.values(item)
|
|
1491
|
+
.filter(v => v !== null && v !== undefined)
|
|
1492
|
+
.join(" ")
|
|
1493
|
+
.toLowerCase();
|
|
1494
|
+
return searchableText.includes(search);
|
|
1495
|
+
});
|
|
1496
|
+
this.CurrentPage = 1;
|
|
1497
|
+
}
|
|
1498
|
+
this.SortPages();
|
|
1499
|
+
}
|
|
1500
|
+
SortPages() {
|
|
1501
|
+
if (!this.SortField) {
|
|
1502
|
+
this.UpdatePages();
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1505
|
+
const order = this.SortOrder === 1 ? "asc" : "desc";
|
|
1506
|
+
const field = this.SortField;
|
|
1507
|
+
const colConfig = this.ColumnList.find(c => c.field === field);
|
|
1508
|
+
if (!colConfig) {
|
|
1509
|
+
console.warn("Columna no encontrada:", field);
|
|
1510
|
+
this.UpdatePages();
|
|
1511
|
+
return;
|
|
1512
|
+
}
|
|
1513
|
+
const formatType = colConfig.formatType;
|
|
1514
|
+
const sampleValue = this.ListDataFilter.find(item => item[field] !== null && item[field] !== undefined)?.[field];
|
|
1515
|
+
if (typeof sampleValue === "number") {
|
|
1516
|
+
this.ListDataFilter = this.SharedService.SortRecursiveNumber([...this.ListDataFilter], field, order);
|
|
1517
|
+
}
|
|
1518
|
+
else {
|
|
1519
|
+
if (formatType === "date") {
|
|
1520
|
+
this.ListDataFilter = this.SharedService.SortRecursiveDate([...this.ListDataFilter], field, order);
|
|
1521
|
+
}
|
|
1522
|
+
else {
|
|
1523
|
+
this.ListDataFilter = this.SharedService.SortRecursivePrimeNg([...this.ListDataFilter], field, order);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
this.UpdatePages();
|
|
1527
|
+
}
|
|
1528
|
+
UpdatePages() {
|
|
1529
|
+
if (this.ShowPagination) {
|
|
1530
|
+
this.TotalRecords = this.ListDataFilter.length;
|
|
1531
|
+
const start = (this.CurrentPage - 1) * this.RowsPerPage;
|
|
1532
|
+
const end = start + this.RowsPerPage;
|
|
1533
|
+
this.ListDataTable = this.ListDataFilter.slice(start, end);
|
|
1534
|
+
}
|
|
1535
|
+
else {
|
|
1536
|
+
this.ListDataTable = this.ListDataFilter;
|
|
1537
|
+
}
|
|
1538
|
+
if (this.ShowCheckbox)
|
|
1539
|
+
this.ListDataSelectedFilter = [...this.ListDataSelectedTemp];
|
|
1540
|
+
this.refreshAllHeaderStates();
|
|
1541
|
+
this.EmitSearchValues();
|
|
1542
|
+
}
|
|
1543
|
+
ValidateSelect() {
|
|
1544
|
+
if (!this.SelectedIdentifier && this.ShowCheckbox) {
|
|
1545
|
+
this.ShowCheckbox = false;
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
const selectedIds = new Set(this.ListDataSelected.map(item => item[this.SelectedIdentifier]));
|
|
1549
|
+
this.ListDataSelectedTemp = this.ListData.filter(item => selectedIds.has(item[this.SelectedIdentifier]));
|
|
1550
|
+
this.ListDataSelectedFilter = [...this.ListDataSelectedTemp];
|
|
1551
|
+
}
|
|
1552
|
+
SelectAll(event) {
|
|
1553
|
+
if (!this.SelectedIdentifier && this.ShowCheckbox)
|
|
1554
|
+
return;
|
|
1555
|
+
if (event.checked) {
|
|
1556
|
+
const idsSelected = new Set(this.ListDataSelectedTemp.map(item => item[this.SelectedIdentifier]));
|
|
1557
|
+
this.ListDataFilter.forEach(item => {
|
|
1558
|
+
if (!idsSelected.has(item[this.SelectedIdentifier])) {
|
|
1559
|
+
this.ListDataSelectedTemp.push(item);
|
|
1560
|
+
}
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
else {
|
|
1564
|
+
const idsSelected = new Set(this.ListDataFilter.map(item => item[this.SelectedIdentifier]));
|
|
1565
|
+
this.ListDataSelectedTemp = this.ListDataSelectedTemp.filter(item => !idsSelected.has(item[this.SelectedIdentifier]));
|
|
1566
|
+
}
|
|
1567
|
+
this.ListDataSelectedFilter = [...this.ListDataSelectedTemp];
|
|
1568
|
+
this.EmitSelectedItem.emit(this.ListDataSelectedTemp);
|
|
1569
|
+
}
|
|
1570
|
+
OnHeaderSelectionToggle(checked) {
|
|
1571
|
+
this.SelectAll({ checked });
|
|
1572
|
+
}
|
|
1573
|
+
OnRowSelect(event) {
|
|
1574
|
+
if (!this.SelectedIdentifier && this.ShowCheckbox)
|
|
1575
|
+
return;
|
|
1576
|
+
const selectedItem = event.data;
|
|
1577
|
+
const exists = this.ListDataSelectedTemp.some(item => item[this.SelectedIdentifier] === selectedItem[this.SelectedIdentifier]);
|
|
1578
|
+
if (!exists) {
|
|
1579
|
+
this.ListDataSelectedTemp.push(selectedItem);
|
|
1580
|
+
}
|
|
1581
|
+
this.EmitSelectedItem.emit(this.ListDataSelectedTemp);
|
|
1582
|
+
}
|
|
1583
|
+
OnRowUnselect(event) {
|
|
1584
|
+
if (!this.SelectedIdentifier && this.ShowCheckbox)
|
|
1585
|
+
return;
|
|
1586
|
+
const unselectedItem = event.data;
|
|
1587
|
+
this.ListDataSelectedTemp = this.ListDataSelectedTemp.filter(item => item[this.SelectedIdentifier] !== unselectedItem[this.SelectedIdentifier]);
|
|
1588
|
+
this.EmitSelectedItem.emit(this.ListDataSelectedTemp);
|
|
1589
|
+
}
|
|
1590
|
+
ResetTable() {
|
|
1591
|
+
this.CurrentPage = 1;
|
|
1592
|
+
this.SearchInput = { ...(this.SearchInput ?? {}), searchText: "" };
|
|
1593
|
+
this.ExecuteSearch();
|
|
1594
|
+
}
|
|
1595
|
+
EmitSearchValues() {
|
|
1596
|
+
this.EmitListDataFilter.emit(this.ListDataFilter);
|
|
1597
|
+
this.EmitSearchEvent.emit(this.SearchInput);
|
|
1598
|
+
this.EmitSortEvent.emit([
|
|
1599
|
+
{
|
|
1600
|
+
sortOrder: this.SortOrder,
|
|
1601
|
+
sortField: this.SortField?.toString() ?? "",
|
|
1602
|
+
},
|
|
1603
|
+
]);
|
|
1604
|
+
}
|
|
1605
|
+
OnHeaderCheckboxChange(checked, field) {
|
|
1606
|
+
this.ListDataFilter.forEach(r => (r[field] = checked));
|
|
1607
|
+
this.HeaderState[field] = { checked, indeterminate: false };
|
|
1608
|
+
this.UpdatePages();
|
|
1609
|
+
}
|
|
1610
|
+
getFilteredSelectedCount() {
|
|
1611
|
+
if (!this.SelectedIdentifier || this.ListDataFilter.length === 0 || this.ListDataSelectedTemp.length === 0)
|
|
1612
|
+
return 0;
|
|
1613
|
+
const selectedIds = new Set(this.ListDataSelectedTemp.map(item => item[this.SelectedIdentifier]));
|
|
1614
|
+
return this.ListDataFilter.filter(item => selectedIds.has(item[this.SelectedIdentifier])).length;
|
|
1615
|
+
}
|
|
1616
|
+
get IsHeaderSelectionChecked() {
|
|
1617
|
+
return this.ListDataFilter.length > 0 && this.getFilteredSelectedCount() === this.ListDataFilter.length;
|
|
1618
|
+
}
|
|
1619
|
+
get IsHeaderSelectionIndeterminate() {
|
|
1620
|
+
const selectedCount = this.getFilteredSelectedCount();
|
|
1621
|
+
return selectedCount > 0 && selectedCount < this.ListDataFilter.length;
|
|
1622
|
+
}
|
|
1623
|
+
FilterData(field) {
|
|
1624
|
+
let c = this.ListData.filter(item => item[field]);
|
|
1625
|
+
}
|
|
1626
|
+
IsInderteminate(column) {
|
|
1627
|
+
const rowsChek = this.ListData.filter(item => item[column]).length;
|
|
1628
|
+
const element = [...document.querySelectorAll("[data-check]")].find(x => x.getAttribute("data-check") == column);
|
|
1629
|
+
if (element == undefined)
|
|
1630
|
+
return;
|
|
1631
|
+
if (rowsChek > 0 && rowsChek < this.ListData.length) {
|
|
1632
|
+
element.setAttribute("class", "prCheckbox--indeterminate");
|
|
1633
|
+
}
|
|
1634
|
+
else {
|
|
1635
|
+
element.removeAttribute("class");
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
OnRowsPerPageChange(value) {
|
|
1639
|
+
this.RowsPerPage = value;
|
|
1640
|
+
this.CurrentPage = 1;
|
|
1641
|
+
this.UpdatePages();
|
|
1642
|
+
}
|
|
1643
|
+
ResetTableSelected() {
|
|
1644
|
+
this.ListDataSelectedTemp = [];
|
|
1645
|
+
this.ListDataSelectedFilter = [...this.ListDataSelectedTemp];
|
|
1646
|
+
}
|
|
1647
|
+
ClearSearch() {
|
|
1648
|
+
this.SearchInput.searchText = "";
|
|
1649
|
+
this.ExecuteSearch();
|
|
1650
|
+
}
|
|
1651
|
+
get TotalPages() {
|
|
1652
|
+
return Math.ceil(this.TotalRecords / this.RowsPerPage);
|
|
1653
|
+
}
|
|
1654
|
+
onChangeSelectPage(event) {
|
|
1655
|
+
const eventValue = event.target.value;
|
|
1656
|
+
if (eventValue === "" || isNaN(parseInt(eventValue)) || eventValue === "0" || eventValue.indexOf("-") >= 0) {
|
|
1657
|
+
this.CurrentPage = 1;
|
|
1658
|
+
this.UpdatePages();
|
|
1659
|
+
return;
|
|
1660
|
+
}
|
|
1661
|
+
this.CurrentPage = parseInt(eventValue);
|
|
1662
|
+
if (this.CurrentPage > this.TotalPages) {
|
|
1663
|
+
this.CurrentPage = this.TotalPages;
|
|
1664
|
+
}
|
|
1665
|
+
this.UpdatePages();
|
|
1666
|
+
}
|
|
1667
|
+
get RenderPanel() {
|
|
1668
|
+
return Boolean(this.AdditionalTemplate) || this.ShowSearch || Boolean(this.AdditionalCentralTemplate) || Boolean(this.AdditionalExtendedTemplate);
|
|
1669
|
+
}
|
|
1670
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1671
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: TableComponent, isStandalone: true, selector: "intelica-table", inputs: { ComponentId: "ComponentId", ListData: "ListData", ShowRowPerPage: "ShowRowPerPage", ShowSearch: "ShowSearch", ShowPagination: "ShowPagination", RowsPerPage: "RowsPerPage", ShowCheckbox: "ShowCheckbox", ShowIndex: "ShowIndex", ListDataSelected: "ListDataSelected", SelectedIdentifier: "SelectedIdentifier", ClassName: "ClassName", DefaultSortField: "DefaultSortField", DefaultSortOrder: "DefaultSortOrder", scrollHeight: "scrollHeight", scrollable: "scrollable", AllowedPageSizes: "AllowedPageSizes", tableStyle: "tableStyle", IsTableDisabled: "IsTableDisabled" }, outputs: { EmitSelectedItem: "EmitSelectedItem", EmitListDataFilter: "EmitListDataFilter", EmitSearchEvent: "EmitSearchEvent", EmitSortEvent: "EmitSortEvent" }, providers: [FormatCellPipe, DatePipe], queries: [{ propertyName: "AdditionalTemplate", first: true, predicate: ["additionalTemplate"], descendants: true }, { propertyName: "AdditionalExtendedTemplate", first: true, predicate: ["additionalExtendedTemplate"], descendants: true }, { propertyName: "AdditionalCentralTemplate", first: true, predicate: ["additionalCentralTemplate"], descendants: true }, { propertyName: "Columns", predicate: ColumnComponent }, { propertyName: "ColumnGroups", predicate: ColumnGroupComponent }, { propertyName: "RowResumenGroups", predicate: RowResumenComponent }], usesOnChanges: true, ngImport: i0, template: "<div class=\"prTable\">\n\t@if (RenderPanel) {\n\t\t<div class=\"\">\n\t\t\t<div class=\"prCard__row justify-content-end\">\n\t\t\t\t<div class=\"prCard__actionflex\">\n\t\t\t\t\t@if (AdditionalTemplate) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalTemplate\"></ng-container>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t\t@if (ShowSearch) {\n\t\t\t\t\t<div class=\"ptSearch searchTableGA\">\n\t\t\t\t\t\t<p-iconfield>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclass=\"prInputText\"\n\t\t\t\t\t\t\t\tpInputText\n\t\t\t\t\t\t\t\tplaceholder=\"{{ 'LBL_SEARCH_SELECT' | term: GlobalTermService.languageCode }}\"\n\t\t\t\t\t\t\t\t[(ngModel)]=\"SearchInput.searchText\"\n\t\t\t\t\t\t\t\t(keydown.enter)=\"ExecuteSearch()\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p-inputicon>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--close\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-cancel\" *ngIf=\"SearchInput.searchText\" (click)=\"ClearSearch()\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<span class=\"ptSearch__icon ptSearch__icon--divider\" *ngIf=\"SearchInput.searchText\"></span>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--search\" (click)=\"ExecuteSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-search\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</p-inputicon>\n\t\t\t\t\t\t</p-iconfield>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (AdditionalCentralTemplate) {\n\t\t\t\t\t<div class=\"prTableTools__new prTableTools__new--right\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalCentralTemplate\"></ng-container>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</div>\n\n\t\t\t@if (AdditionalExtendedTemplate) {\n\t\t\t\t<div class=\"prTableTools justify-content-start\">\n\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalExtendedTemplate\"></ng-container>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t}\n\t<p-table\n\t\tclass=\"prTable\"\n\t\t[ngClass]=\"ClassName\"\n\t\t[value]=\"ListDataTable\"\n\t\tresponsiveLayout=\"scroll\"\n\t\t[(selection)]=\"ListDataSelectedFilter\"\n\t\t(onRowSelect)=\"OnRowSelect($event)\"\n\t\t(onRowUnselect)=\"OnRowUnselect($event)\"\n\t\t[sortField]=\"DefaultSortField\"\n\t\t[scrollable]=\"scrollable\"\n\t\t[scrollHeight]=\"scrollable ? scrollHeight : 'auto'\"\n\t\t[tableStyle]=\"tableStyle\"\n\t\t[sortOrder]=\"DefaultSortOrder\"\n\t>\n\t\t<ng-template pTemplate=\"header\">\n\t\t\t@for (level of Levels; track $index) {\n\t\t\t\t<tr>\n\t\t\t\t\t@for (col of ColumnGroupList; track $index) {\n\t\t\t\t\t\t@if (col.level === level) {\n\t\t\t\t\t\t\t<th [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\" [pSortableColumn]=\"col.sortable ? col.field : ''\" [style.min-width]=\"col.minWidth\" (click)=\"col.sortable && OnSort(col.field)\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@if (ShowCheckbox && level === 0 && ColumnGroupList.length != 0) {\n\t\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\" [attr.rowspan]=\"MaxLevel === 1 ? 2 : MaxLevel\">\n\t\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t\t[ngModel]=\"IsHeaderSelectionChecked\"\n\t\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderSelectionToggle($event)\"\n\t\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled || ListDataFilter.length === 0\"\n\t\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': IsHeaderSelectionIndeterminate,\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t@if (col.showHeader) {\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t[class]=\"col.className\"\n\t\t\t\t\t\t\t[pSortableColumn]=\"!col.isChecboxColumn && col.sortable ? col.field : ''\"\n\t\t\t\t\t\t\t[style.width]=\"col.width\"\n\t\t\t\t\t\t\t[style.min-width]=\"col.minWidth\"\n\t\t\t\t\t\t\t(click)=\"!col.isChecboxColumn && col.sortable && OnSort(col.field)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div class=\"prTable__header\">\n\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t@if (!col.showIndex) {\n\t\t\t\t\t\t\t\t\t@if (col.isChecboxColumn) {\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t\t\t\t\t[(ngModel)]=\"HeaderState[col.field].checked\"\n\t\t\t\t\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderCheckboxChange($event, col.field)\"\n\t\t\t\t\t\t\t\t\t\t\t[attr.data-check]=\"col.field\"\n\t\t\t\t\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled\"\n\t\t\t\t\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': HeaderState[col.field].indeterminate,\n\t\t\t\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox && ColumnGroupList.length == 0) {\n\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\">\n\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t[ngModel]=\"IsHeaderSelectionChecked\"\n\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderSelectionToggle($event)\"\n\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled || ListDataFilter.length === 0\"\n\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': IsHeaderSelectionIndeterminate,\n\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t</th>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t\t@if (RowResumenList.length && ListDataFilter.length) {\n\t\t\t\t<tr class=\"fixedRow\">\n\t\t\t\t\t@for (col of RowResumenList; track $index) {\n\t\t\t\t\t\t<td [ngClass]=\"col.className\" [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\">\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef\"></ng-container>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<ng-template #defaultContent></ng-template>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t</ng-template>\n\t\t<ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t<td [ngClass]=\"col.className\">\n\t\t\t\t\t\t@if (col.showIndex) {\n\t\t\t\t\t\t\t{{ rowIndex + 1 + (CurrentPage - 1) * RowsPerPage }}\n\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef; context: { $implicit: rowData }\"></ng-container>\n\t\t\t\t\t\t\t} @else if (col.isChecboxColumn) {\n\t\t\t\t\t\t\t\t<p-checkbox [binary]=\"true\" [(ngModel)]=\"rowData[col.field]\" (onChange)=\"onBodyCheckboxChange(col.field)\" [disabled]=\"IsTableDisabled\"></p-checkbox>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<span class=\"text-breakWord\" tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.tooltip\" [tooltipPosition]=\"col.tooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ rowData[col.field] | formatCell: col.formatType }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox) {\n\t\t\t\t\t<td class=\"text-center\">\n\t\t\t\t\t\t<p-tableCheckbox [value]=\"rowData\" class=\"prCheckbox\" />\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t</ng-template>\n\t\t<ng-template #emptymessage>\n\t\t\t<tr>\n\t\t\t\t<td [attr.colspan]=\"ColumnList.length + (ShowCheckbox ? 1 : 0)\" class=\"text-center\">\n\t\t\t\t\t{{ \"Nodata\" | term: GlobalTermService.languageCode }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</ng-template>\n\t</p-table>\n\t<div class=\"d-flex justify-content-end\">\n\t\t@if (TotalRecords !== 0 && ShowPagination && TotalPages > 1) {\n\t\t\t<div class=\"ptTablePaginator\">\n\t\t\t\t<p-paginator\n\t\t\t\t\tclass=\"prPaginator paginatorTableGA\"\n\t\t\t\t\t[first]=\"(CurrentPage - 1) * RowsPerPage\"\n\t\t\t\t\t[rows]=\"RowsPerPage\"\n\t\t\t\t\t[totalRecords]=\"TotalRecords\"\n\t\t\t\t\t(onPageChange)=\"OnPageChange($event)\"\n\t\t\t\t\t[showJumpToPageInput]=\"false\"\n\t\t\t\t\t[showCurrentPageReport]=\"false\"\n\t\t\t\t\t[showPageLinks]=\"false\"\n\t\t\t\t\t[showFirstLastIcon]=\"false\"\n\t\t\t\t\t[templateLeft]=\"templateLeft\"\n\t\t\t\t>\n\t\t\t\t\t<ng-template #previouspagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-left paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template #nextpagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-right paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template pTemplate=\"templateLeft\" let-state #templateLeft>\n\t\t\t\t\t\t@if (ShowRowPerPage) {\n\t\t\t\t\t\t\t<span>{{ \"ROWS_PER_PAGE\" | term: GlobalTermService.languageCode }}</span>\n\t\t\t\t\t\t\t<p-select\n\t\t\t\t\t\t\t\tpanelStyleClass=\"prSelect paginatorSelectTableGA\"\n\t\t\t\t\t\t\t\tclass=\"prSelect\"\n\t\t\t\t\t\t\t\t[options]=\"AllowedPageSizes\"\n\t\t\t\t\t\t\t\t[ngModel]=\"RowsPerPage\"\n\t\t\t\t\t\t\t\t(onChange)=\"OnRowsPerPageChange($event.value)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ng-template #dropdownicon>\n\t\t\t\t\t\t\t\t <i class=\"icon icon-arrow-down\"></i>\n\t\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t\t</p-select>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{{ \"Page\" | term: GlobalTermService.languageCode }}\n\t\t\t\t\t\t\t<p-inputnumber class=\"p-paginator-jtp-input\" inputId=\"integeronly\" [(ngModel)]=\"CurrentPage\" [allowEmpty]=\"false\" [min]=\"1\" (keyup.enter)=\"onChangeSelectPage($event)\" />\n\t\t\t\t\t\t\t{{ \"Of\" | term: GlobalTermService.languageCode }} {{ TotalPages }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</p-paginator>\n\t\t\t</div>\n\t\t}\n\t</div>\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: IconFieldModule }, { kind: "component", type: i2$1.IconField, selector: "p-iconfield, p-iconField, p-icon-field", inputs: ["hostName", "iconPosition", "styleClass"] }, { kind: "component", type: InputIcon, selector: "p-inputicon, p-inputIcon", inputs: ["hostName", "styleClass"] }, { kind: "directive", type: InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "component", type: InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: Paginator, selector: "p-paginator", inputs: ["pageLinkSize", "styleClass", "alwaysShow", "dropdownAppendTo", "templateLeft", "templateRight", "dropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showFirstLastIcon", "totalRecords", "rows", "rowsPerPageOptions", "showJumpToPageDropdown", "showJumpToPageInput", "jumpToPageItemTemplate", "showPageLinks", "locale", "dropdownItemTemplate", "first", "appendTo"], outputs: ["onPageChange"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "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", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "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: i4$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["value", "disabled", "required", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: BadgeModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i6.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["hostName", "value", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "inputStyle", "styleClass", "inputClass", "indeterminate", "formControl", "checkboxIcon", "readonly", "autofocus", "trueValue", "falseValue", "variant", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { 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: "pipe", type: TermPipe, name: "term" }, { kind: "pipe", type: FormatCellPipe, name: "formatCell" }] });
|
|
1672
|
+
}
|
|
1673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TableComponent, decorators: [{
|
|
1674
|
+
type: Component,
|
|
1675
|
+
args: [{ selector: "intelica-table", standalone: true, imports: [
|
|
1676
|
+
CommonModule,
|
|
1677
|
+
IconFieldModule,
|
|
1678
|
+
InputIcon,
|
|
1679
|
+
InputText,
|
|
1680
|
+
InputTextModule,
|
|
1681
|
+
InputNumber,
|
|
1682
|
+
Paginator,
|
|
1683
|
+
TableModule,
|
|
1684
|
+
Select,
|
|
1685
|
+
BadgeModule,
|
|
1686
|
+
TooltipModule,
|
|
1687
|
+
TermPipe,
|
|
1688
|
+
CheckboxModule,
|
|
1689
|
+
FormsModule,
|
|
1690
|
+
FormatCellPipe,
|
|
1691
|
+
], providers: [FormatCellPipe, DatePipe], template: "<div class=\"prTable\">\n\t@if (RenderPanel) {\n\t\t<div class=\"\">\n\t\t\t<div class=\"prCard__row justify-content-end\">\n\t\t\t\t<div class=\"prCard__actionflex\">\n\t\t\t\t\t@if (AdditionalTemplate) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalTemplate\"></ng-container>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t\t@if (ShowSearch) {\n\t\t\t\t\t<div class=\"ptSearch searchTableGA\">\n\t\t\t\t\t\t<p-iconfield>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\tclass=\"prInputText\"\n\t\t\t\t\t\t\t\tpInputText\n\t\t\t\t\t\t\t\tplaceholder=\"{{ 'LBL_SEARCH_SELECT' | term: GlobalTermService.languageCode }}\"\n\t\t\t\t\t\t\t\t[(ngModel)]=\"SearchInput.searchText\"\n\t\t\t\t\t\t\t\t(keydown.enter)=\"ExecuteSearch()\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<p-inputicon>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--close\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-cancel\" *ngIf=\"SearchInput.searchText\" (click)=\"ClearSearch()\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<span class=\"ptSearch__icon ptSearch__icon--divider\" *ngIf=\"SearchInput.searchText\"></span>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--search\" (click)=\"ExecuteSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-search\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</p-inputicon>\n\t\t\t\t\t\t</p-iconfield>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@if (AdditionalCentralTemplate) {\n\t\t\t\t\t<div class=\"prTableTools__new prTableTools__new--right\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalCentralTemplate\"></ng-container>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</div>\n\n\t\t\t@if (AdditionalExtendedTemplate) {\n\t\t\t\t<div class=\"prTableTools justify-content-start\">\n\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalExtendedTemplate\"></ng-container>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t}\n\t<p-table\n\t\tclass=\"prTable\"\n\t\t[ngClass]=\"ClassName\"\n\t\t[value]=\"ListDataTable\"\n\t\tresponsiveLayout=\"scroll\"\n\t\t[(selection)]=\"ListDataSelectedFilter\"\n\t\t(onRowSelect)=\"OnRowSelect($event)\"\n\t\t(onRowUnselect)=\"OnRowUnselect($event)\"\n\t\t[sortField]=\"DefaultSortField\"\n\t\t[scrollable]=\"scrollable\"\n\t\t[scrollHeight]=\"scrollable ? scrollHeight : 'auto'\"\n\t\t[tableStyle]=\"tableStyle\"\n\t\t[sortOrder]=\"DefaultSortOrder\"\n\t>\n\t\t<ng-template pTemplate=\"header\">\n\t\t\t@for (level of Levels; track $index) {\n\t\t\t\t<tr>\n\t\t\t\t\t@for (col of ColumnGroupList; track $index) {\n\t\t\t\t\t\t@if (col.level === level) {\n\t\t\t\t\t\t\t<th [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\" [pSortableColumn]=\"col.sortable ? col.field : ''\" [style.min-width]=\"col.minWidth\" (click)=\"col.sortable && OnSort(col.field)\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@if (ShowCheckbox && level === 0 && ColumnGroupList.length != 0) {\n\t\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\" [attr.rowspan]=\"MaxLevel === 1 ? 2 : MaxLevel\">\n\t\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t\t[ngModel]=\"IsHeaderSelectionChecked\"\n\t\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderSelectionToggle($event)\"\n\t\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled || ListDataFilter.length === 0\"\n\t\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': IsHeaderSelectionIndeterminate,\n\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t@if (col.showHeader) {\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t[class]=\"col.className\"\n\t\t\t\t\t\t\t[pSortableColumn]=\"!col.isChecboxColumn && col.sortable ? col.field : ''\"\n\t\t\t\t\t\t\t[style.width]=\"col.width\"\n\t\t\t\t\t\t\t[style.min-width]=\"col.minWidth\"\n\t\t\t\t\t\t\t(click)=\"!col.isChecboxColumn && col.sortable && OnSort(col.field)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div class=\"prTable__header\">\n\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t@if (!col.showIndex) {\n\t\t\t\t\t\t\t\t\t@if (col.isChecboxColumn) {\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t\t\t\t\t[(ngModel)]=\"HeaderState[col.field].checked\"\n\t\t\t\t\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderCheckboxChange($event, col.field)\"\n\t\t\t\t\t\t\t\t\t\t\t[attr.data-check]=\"col.field\"\n\t\t\t\t\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled\"\n\t\t\t\t\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': HeaderState[col.field].indeterminate,\n\t\t\t\t\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox && ColumnGroupList.length == 0) {\n\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\">\n\t\t\t\t\t\t<p-checkbox\n\t\t\t\t\t\t\tclass=\"prCheckbox\"\n\t\t\t\t\t\t\t[binary]=\"true\"\n\t\t\t\t\t\t\t(click)=\"$event.stopPropagation()\"\n\t\t\t\t\t\t\t[ngModel]=\"IsHeaderSelectionChecked\"\n\t\t\t\t\t\t\t(ngModelChange)=\"OnHeaderSelectionToggle($event)\"\n\t\t\t\t\t\t\t[disabled]=\"IsTableDisabled || ListDataFilter.length === 0\"\n\t\t\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t\t\t'prCheckbox--indeterminate': IsHeaderSelectionIndeterminate,\n\t\t\t\t\t\t\t}\"\n\t\t\t\t\t\t></p-checkbox>\n\t\t\t\t\t</th>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t\t@if (RowResumenList.length && ListDataFilter.length) {\n\t\t\t\t<tr class=\"fixedRow\">\n\t\t\t\t\t@for (col of RowResumenList; track $index) {\n\t\t\t\t\t\t<td [ngClass]=\"col.className\" [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\">\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef\"></ng-container>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<ng-template #defaultContent></ng-template>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t</ng-template>\n\t\t<ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t<td [ngClass]=\"col.className\">\n\t\t\t\t\t\t@if (col.showIndex) {\n\t\t\t\t\t\t\t{{ rowIndex + 1 + (CurrentPage - 1) * RowsPerPage }}\n\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef; context: { $implicit: rowData }\"></ng-container>\n\t\t\t\t\t\t\t} @else if (col.isChecboxColumn) {\n\t\t\t\t\t\t\t\t<p-checkbox [binary]=\"true\" [(ngModel)]=\"rowData[col.field]\" (onChange)=\"onBodyCheckboxChange(col.field)\" [disabled]=\"IsTableDisabled\"></p-checkbox>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<span class=\"text-breakWord\" tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.tooltip\" [tooltipPosition]=\"col.tooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ rowData[col.field] | formatCell: col.formatType }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox) {\n\t\t\t\t\t<td class=\"text-center\">\n\t\t\t\t\t\t<p-tableCheckbox [value]=\"rowData\" class=\"prCheckbox\" />\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t</ng-template>\n\t\t<ng-template #emptymessage>\n\t\t\t<tr>\n\t\t\t\t<td [attr.colspan]=\"ColumnList.length + (ShowCheckbox ? 1 : 0)\" class=\"text-center\">\n\t\t\t\t\t{{ \"Nodata\" | term: GlobalTermService.languageCode }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</ng-template>\n\t</p-table>\n\t<div class=\"d-flex justify-content-end\">\n\t\t@if (TotalRecords !== 0 && ShowPagination && TotalPages > 1) {\n\t\t\t<div class=\"ptTablePaginator\">\n\t\t\t\t<p-paginator\n\t\t\t\t\tclass=\"prPaginator paginatorTableGA\"\n\t\t\t\t\t[first]=\"(CurrentPage - 1) * RowsPerPage\"\n\t\t\t\t\t[rows]=\"RowsPerPage\"\n\t\t\t\t\t[totalRecords]=\"TotalRecords\"\n\t\t\t\t\t(onPageChange)=\"OnPageChange($event)\"\n\t\t\t\t\t[showJumpToPageInput]=\"false\"\n\t\t\t\t\t[showCurrentPageReport]=\"false\"\n\t\t\t\t\t[showPageLinks]=\"false\"\n\t\t\t\t\t[showFirstLastIcon]=\"false\"\n\t\t\t\t\t[templateLeft]=\"templateLeft\"\n\t\t\t\t>\n\t\t\t\t\t<ng-template #previouspagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-left paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template #nextpagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-right paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template pTemplate=\"templateLeft\" let-state #templateLeft>\n\t\t\t\t\t\t@if (ShowRowPerPage) {\n\t\t\t\t\t\t\t<span>{{ \"ROWS_PER_PAGE\" | term: GlobalTermService.languageCode }}</span>\n\t\t\t\t\t\t\t<p-select\n\t\t\t\t\t\t\t\tpanelStyleClass=\"prSelect paginatorSelectTableGA\"\n\t\t\t\t\t\t\t\tclass=\"prSelect\"\n\t\t\t\t\t\t\t\t[options]=\"AllowedPageSizes\"\n\t\t\t\t\t\t\t\t[ngModel]=\"RowsPerPage\"\n\t\t\t\t\t\t\t\t(onChange)=\"OnRowsPerPageChange($event.value)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ng-template #dropdownicon>\n\t\t\t\t\t\t\t\t <i class=\"icon icon-arrow-down\"></i>\n\t\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t\t</p-select>\n\t\t\t\t\t\t}\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{{ \"Page\" | term: GlobalTermService.languageCode }}\n\t\t\t\t\t\t\t<p-inputnumber class=\"p-paginator-jtp-input\" inputId=\"integeronly\" [(ngModel)]=\"CurrentPage\" [allowEmpty]=\"false\" [min]=\"1\" (keyup.enter)=\"onChangeSelectPage($event)\" />\n\t\t\t\t\t\t\t{{ \"Of\" | term: GlobalTermService.languageCode }} {{ TotalPages }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</p-paginator>\n\t\t\t</div>\n\t\t}\n\t</div>\n</div>\n" }]
|
|
1692
|
+
}], propDecorators: { ComponentId: [{
|
|
1693
|
+
type: Input
|
|
1694
|
+
}], ListData: [{
|
|
1695
|
+
type: Input
|
|
1696
|
+
}], ShowRowPerPage: [{
|
|
1697
|
+
type: Input
|
|
1698
|
+
}], ShowSearch: [{
|
|
1699
|
+
type: Input
|
|
1700
|
+
}], ShowPagination: [{
|
|
1701
|
+
type: Input
|
|
1702
|
+
}], RowsPerPage: [{
|
|
1703
|
+
type: Input
|
|
1704
|
+
}], ShowCheckbox: [{
|
|
1705
|
+
type: Input
|
|
1706
|
+
}], ShowIndex: [{
|
|
1707
|
+
type: Input
|
|
1708
|
+
}], ListDataSelected: [{
|
|
1709
|
+
type: Input
|
|
1710
|
+
}], SelectedIdentifier: [{
|
|
1711
|
+
type: Input
|
|
1712
|
+
}], ClassName: [{
|
|
1713
|
+
type: Input
|
|
1714
|
+
}], DefaultSortField: [{
|
|
1715
|
+
type: Input
|
|
1716
|
+
}], DefaultSortOrder: [{
|
|
1717
|
+
type: Input
|
|
1718
|
+
}], scrollHeight: [{
|
|
1719
|
+
type: Input
|
|
1720
|
+
}], scrollable: [{
|
|
1721
|
+
type: Input
|
|
1722
|
+
}], AllowedPageSizes: [{
|
|
1723
|
+
type: Input
|
|
1724
|
+
}], tableStyle: [{
|
|
1725
|
+
type: Input
|
|
1726
|
+
}], IsTableDisabled: [{
|
|
1727
|
+
type: Input
|
|
1728
|
+
}], EmitSelectedItem: [{
|
|
1729
|
+
type: Output
|
|
1730
|
+
}], EmitListDataFilter: [{
|
|
1731
|
+
type: Output
|
|
1732
|
+
}], EmitSearchEvent: [{
|
|
1733
|
+
type: Output
|
|
1734
|
+
}], EmitSortEvent: [{
|
|
1735
|
+
type: Output
|
|
1736
|
+
}], Columns: [{
|
|
1737
|
+
type: ContentChildren,
|
|
1738
|
+
args: [ColumnComponent]
|
|
1739
|
+
}], ColumnGroups: [{
|
|
1740
|
+
type: ContentChildren,
|
|
1741
|
+
args: [ColumnGroupComponent]
|
|
1742
|
+
}], RowResumenGroups: [{
|
|
1743
|
+
type: ContentChildren,
|
|
1744
|
+
args: [RowResumenComponent]
|
|
1745
|
+
}], AdditionalTemplate: [{
|
|
1746
|
+
type: ContentChild,
|
|
1747
|
+
args: ["additionalTemplate"]
|
|
1748
|
+
}], AdditionalExtendedTemplate: [{
|
|
1749
|
+
type: ContentChild,
|
|
1750
|
+
args: ["additionalExtendedTemplate"]
|
|
1751
|
+
}], AdditionalCentralTemplate: [{
|
|
1752
|
+
type: ContentChild,
|
|
1753
|
+
args: ["additionalCentralTemplate"]
|
|
1754
|
+
}] } });
|
|
1755
|
+
|
|
1756
|
+
class TableFetchComponent {
|
|
1757
|
+
cdr;
|
|
1758
|
+
GlobalTermService = inject(GlobalTermService);
|
|
1759
|
+
ComponentId = "";
|
|
1760
|
+
ShowRowPerPage = true;
|
|
1761
|
+
ShowSearch = false;
|
|
1762
|
+
ShowPagination = false;
|
|
1763
|
+
RowsPerPage = 10;
|
|
1764
|
+
ShowCheckbox = false;
|
|
1765
|
+
ShowIndex = false;
|
|
1766
|
+
ClassName = "";
|
|
1767
|
+
DefaultSortField = "";
|
|
1768
|
+
scrollHeight = "400px";
|
|
1769
|
+
scrollable = false;
|
|
1770
|
+
AllowedPageSizes = [10, 25, 50, 100];
|
|
1771
|
+
tableStyle = {};
|
|
1772
|
+
Levels = [];
|
|
1773
|
+
FilteredList = [];
|
|
1774
|
+
TotalItems = 0;
|
|
1775
|
+
TotalRecords = 0;
|
|
1776
|
+
IsPaginatorInputSearch = false;
|
|
1777
|
+
EmitQueryParametersChange = new EventEmitter();
|
|
1778
|
+
Columns;
|
|
1779
|
+
ColumnGroups;
|
|
1780
|
+
RowResumenGroups;
|
|
1781
|
+
AdditionalTemplate;
|
|
1782
|
+
AdditionalCentralTemplate;
|
|
1783
|
+
AdditionalExtendedTemplate;
|
|
1784
|
+
EmitSortEvent = new EventEmitter();
|
|
1785
|
+
ColumnList = [];
|
|
1786
|
+
ColumnGroupList = [];
|
|
1787
|
+
RowResumenList = [];
|
|
1788
|
+
CurrentPage = 1;
|
|
1789
|
+
SortOrder = 1;
|
|
1790
|
+
SortField = null;
|
|
1791
|
+
MaxLevel = 0;
|
|
1792
|
+
ListDataTable = [];
|
|
1793
|
+
SearchInput = "";
|
|
1794
|
+
constructor(cdr) {
|
|
1795
|
+
this.cdr = cdr;
|
|
1796
|
+
}
|
|
1797
|
+
ngOnChanges(changes) {
|
|
1798
|
+
if (changes["FilteredList"] || changes["RowsPerPage"] || changes["CurrentPage"]) {
|
|
1799
|
+
this.UpdatePages();
|
|
1800
|
+
}
|
|
1801
|
+
if (changes["SortField"] || changes["SortOrder"]) {
|
|
1802
|
+
this.EmitSortEvent.emit([
|
|
1803
|
+
{
|
|
1804
|
+
sortOrder: this.SortOrder,
|
|
1805
|
+
sortField: this.SortField?.toString() ?? "",
|
|
1806
|
+
},
|
|
1807
|
+
]);
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
ngAfterContentInit() {
|
|
1811
|
+
this.captureColumns();
|
|
1812
|
+
this.captureGroups();
|
|
1813
|
+
this.captureResumen();
|
|
1814
|
+
this.Columns.changes.subscribe(() => {
|
|
1815
|
+
this.captureColumns();
|
|
1816
|
+
this.cdr.markForCheck();
|
|
1817
|
+
});
|
|
1818
|
+
this.ColumnGroups.changes.subscribe(() => {
|
|
1819
|
+
this.captureGroups();
|
|
1820
|
+
this.cdr.markForCheck();
|
|
1821
|
+
});
|
|
1822
|
+
this.RowResumenGroups.changes.subscribe(() => {
|
|
1823
|
+
this.captureResumen();
|
|
1824
|
+
this.cdr.markForCheck();
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
captureColumns() {
|
|
1828
|
+
this.ColumnList = this.Columns?.toArray() ?? [];
|
|
1829
|
+
}
|
|
1830
|
+
captureGroups() {
|
|
1831
|
+
this.ColumnGroupList = this.ColumnGroups?.toArray() ?? [];
|
|
1832
|
+
const levels = this.ColumnGroupList.map(c => c.level);
|
|
1833
|
+
this.MaxLevel = levels.length ? Math.max(...levels) + 1 : 1;
|
|
1834
|
+
this.Levels = Array.from({ length: this.MaxLevel }, (_, i) => i);
|
|
1835
|
+
}
|
|
1836
|
+
captureResumen() {
|
|
1837
|
+
this.RowResumenList = this.RowResumenGroups?.toArray() ?? [];
|
|
1838
|
+
}
|
|
1839
|
+
OnSort(field) {
|
|
1840
|
+
if (this.SortField === field) {
|
|
1841
|
+
this.SortOrder *= -1;
|
|
1842
|
+
}
|
|
1843
|
+
else {
|
|
1844
|
+
this.SortField = field;
|
|
1845
|
+
this.SortOrder = 1;
|
|
1846
|
+
}
|
|
1847
|
+
this.CurrentPage = 1;
|
|
1848
|
+
this.ExecuteSearch({});
|
|
1849
|
+
}
|
|
1850
|
+
UpdatePages() {
|
|
1851
|
+
if (this.ShowPagination) {
|
|
1852
|
+
this.TotalRecords = this.TotalItems;
|
|
1853
|
+
const start = (this.CurrentPage - 1) * this.RowsPerPage;
|
|
1854
|
+
const end = start + this.RowsPerPage;
|
|
1855
|
+
this.ListDataTable = this.FilteredList.slice(start, end);
|
|
1856
|
+
}
|
|
1857
|
+
else {
|
|
1858
|
+
this.ListDataTable = this.FilteredList;
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
OnPageChange(event) {
|
|
1862
|
+
if (typeof event === "number") {
|
|
1863
|
+
this.CurrentPage = event;
|
|
1864
|
+
}
|
|
1865
|
+
else {
|
|
1866
|
+
if (typeof event?.rows === "number") {
|
|
1867
|
+
this.RowsPerPage = event.rows;
|
|
1868
|
+
}
|
|
1869
|
+
if (typeof event?.page === "number") {
|
|
1870
|
+
this.CurrentPage = event.page + 1;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
this.IsPaginatorInputSearch = true;
|
|
1874
|
+
this.ExecuteSearch({});
|
|
1875
|
+
}
|
|
1876
|
+
ResetTable() {
|
|
1877
|
+
this.CurrentPage = 1;
|
|
1878
|
+
this.ExecuteSearch({});
|
|
1879
|
+
}
|
|
1880
|
+
ExecuteSearch(event) {
|
|
1881
|
+
if (event?.fieldText !== undefined && event?.fieldText !== "") {
|
|
1882
|
+
this.SearchInput = event;
|
|
1883
|
+
}
|
|
1884
|
+
if (this.SearchInput !== undefined && this.SearchInput !== "" && !this.IsPaginatorInputSearch) {
|
|
1885
|
+
this.CurrentPage = 1;
|
|
1886
|
+
}
|
|
1887
|
+
const newQueryParameters = {
|
|
1888
|
+
FilterValue: this.SearchInput.trim(),
|
|
1889
|
+
OrderBy: this.SortField ? String(this.SortField) : undefined,
|
|
1890
|
+
SortDirection: this.SortOrder === 1 ? "asc" : "desc",
|
|
1891
|
+
PageNumber: this.CurrentPage,
|
|
1892
|
+
PageSize: this.RowsPerPage,
|
|
1893
|
+
};
|
|
1894
|
+
this.EmitQueryParametersChange.emit(newQueryParameters);
|
|
1895
|
+
this.UpdatePages();
|
|
1896
|
+
this.IsPaginatorInputSearch = false;
|
|
1897
|
+
}
|
|
1898
|
+
OnRowsPerPageChange(value) {
|
|
1899
|
+
this.RowsPerPage = value;
|
|
1900
|
+
this.CurrentPage = 1;
|
|
1901
|
+
this.ExecuteSearch({});
|
|
1902
|
+
}
|
|
1903
|
+
ClearSearch() {
|
|
1904
|
+
this.SearchInput = "";
|
|
1905
|
+
this.CurrentPage = 1;
|
|
1906
|
+
this.ExecuteSearch({});
|
|
1907
|
+
}
|
|
1908
|
+
get TotalPages() {
|
|
1909
|
+
return Math.ceil(this.TotalRecords / this.RowsPerPage);
|
|
1910
|
+
}
|
|
1911
|
+
get RenderPanel() {
|
|
1912
|
+
return Boolean(this.AdditionalTemplate) || this.ShowSearch || Boolean(this.AdditionalCentralTemplate) || Boolean(this.AdditionalExtendedTemplate);
|
|
1913
|
+
}
|
|
1914
|
+
onChangeSelectPage(event) {
|
|
1915
|
+
this.IsPaginatorInputSearch = true;
|
|
1916
|
+
const eventValue = event.target.value;
|
|
1917
|
+
if (eventValue === "" || isNaN(parseInt(eventValue)) || eventValue === "0" || eventValue.indexOf("-") >= 0) {
|
|
1918
|
+
this.CurrentPage = 1;
|
|
1919
|
+
this.ExecuteSearch({});
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
this.CurrentPage = parseInt(eventValue);
|
|
1923
|
+
if (this.CurrentPage > this.TotalPages) {
|
|
1924
|
+
this.CurrentPage = this.TotalPages;
|
|
1925
|
+
}
|
|
1926
|
+
this.ExecuteSearch({});
|
|
1927
|
+
}
|
|
1928
|
+
OnSearch() {
|
|
1929
|
+
this.CurrentPage = 1;
|
|
1930
|
+
this.ExecuteSearch({});
|
|
1931
|
+
}
|
|
1932
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TableFetchComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1933
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: TableFetchComponent, isStandalone: true, selector: "intelica-table-fetch", inputs: { ComponentId: "ComponentId", ShowRowPerPage: "ShowRowPerPage", ShowSearch: "ShowSearch", ShowPagination: "ShowPagination", RowsPerPage: "RowsPerPage", ShowCheckbox: "ShowCheckbox", ShowIndex: "ShowIndex", ClassName: "ClassName", DefaultSortField: "DefaultSortField", scrollHeight: "scrollHeight", scrollable: "scrollable", AllowedPageSizes: "AllowedPageSizes", tableStyle: "tableStyle", FilteredList: "FilteredList", TotalItems: "TotalItems", CurrentPage: "CurrentPage", SortOrder: "SortOrder", SortField: "SortField" }, outputs: { EmitQueryParametersChange: "EmitQueryParametersChange", EmitSortEvent: "EmitSortEvent" }, providers: [FormatCellPipe, DatePipe], queries: [{ propertyName: "AdditionalTemplate", first: true, predicate: ["additionalTemplate"], descendants: true }, { propertyName: "AdditionalCentralTemplate", first: true, predicate: ["additionalCentralTemplate"], descendants: true }, { propertyName: "AdditionalExtendedTemplate", first: true, predicate: ["additionalExtendedTemplate"], descendants: true }, { propertyName: "Columns", predicate: ColumnComponent }, { propertyName: "ColumnGroups", predicate: ColumnGroupComponent }, { propertyName: "RowResumenGroups", predicate: RowResumenComponent }], usesOnChanges: true, ngImport: i0, template: "<div class=\"prTable\">\n\t@if (RenderPanel) {\n\t\t<div class=\" \">\n\t\t\t<div class=\"prCard__row justify-content-end\">\n\t\t\t\t<div class=\"prCard__actionflex\">\n\t\t\t\t\t@if (AdditionalTemplate) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalTemplate\"></ng-container>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\n\t\t\t\t@if (ShowSearch) {\n\t\t\t\t\t<div class=\"ptSearch searchTableGA\">\n\t\t\t\t\t\t<p-iconfield>\n\t\t\t\t\t\t\t<input type=\"text\" class=\"prInputText\" pInputText placeholder=\"{{ 'LBL_SEARCH_SELECT' | term: GlobalTermService.languageCode }}\" [(ngModel)]=\"SearchInput\" (keydown.enter)=\"OnSearch()\" />\n\t\t\t\t\t\t\t<p-inputicon>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--close\" *ngIf=\"SearchInput\" (click)=\"ClearSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-cancel\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<span class=\"ptSearch__icon ptSearch__icon--divider\" *ngIf=\"SearchInput\"></span>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--search\" (click)=\"OnSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-search\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</p-inputicon>\n\t\t\t\t\t\t</p-iconfield>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t<!-- -->\n\t\t\t\t@if (AdditionalCentralTemplate) {\n\t\t\t\t\t<div class=\"prTableTools__new prTableTools__new--right\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalCentralTemplate\"></ng-container>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (AdditionalExtendedTemplate) {\n\t\t\t<div class=\"prTableTools justify-content-start\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalExtendedTemplate\"></ng-container>\n\t\t\t</div>\n\t\t}\n\t}\n\t<p-table\n\t\tclass=\"prTable\"\n\t\t[ngClass]=\"ClassName\"\n\t\t[value]=\"FilteredList\"\n\t\tresponsiveLayout=\"scroll\"\n\t\t[sortField]=\"DefaultSortField\"\n\t\t[sortOrder]=\"SortOrder\"\n\t\t[scrollable]=\"scrollable\"\n\t\t[scrollHeight]=\"scrollable ? scrollHeight : 'auto'\"\n\t\t[tableStyle]=\"tableStyle\"\n\t>\n\t\t<!-- Cabecera con columnas agrupadas -->\n\t\t<ng-template pTemplate=\"header\">\n\t\t\t@for (level of Levels; track $index) {\n\t\t\t\t<tr>\n\t\t\t\t\t@for (col of ColumnGroupList; track $index) {\n\t\t\t\t\t\t@if (col.level === level) {\n\t\t\t\t\t\t\t<th [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\" [pSortableColumn]=\"col.sortable ? col.field : ''\" [style.min-width]=\"col.minWidth\" (click)=\"col.sortable && OnSort(col.field)\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" F [pTooltip]=\"col.headerTooltip || col.header\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@if (ShowCheckbox && level === 0 && ColumnGroupList.length != 0) {\n\t\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\" [attr.rowspan]=\"MaxLevel === 1 ? 2 : MaxLevel\">\n\t\t\t\t\t\t\t<p-tableHeaderCheckbox class=\"prCheckbox\" />\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t@if (col.showHeader) {\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t[class]=\"col.className\"\n\t\t\t\t\t\t\t[pSortableColumn]=\"!col.isChecboxColumn && col.sortable ? col.field : ''\"\n\t\t\t\t\t\t\t[style.width]=\"col.width\"\n\t\t\t\t\t\t\t[style.min-width]=\"col.minWidth\"\n\t\t\t\t\t\t\t(click)=\"!col.isChecboxColumn && col.sortable && OnSort(col.field)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div class=\"prTable__header\">\n\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip || col.header\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t@if (!col.showIndex) {\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox && ColumnGroupList.length == 0) {\n\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\">\n\t\t\t\t\t\t<p-tableHeaderCheckbox class=\"prCheckbox\" />\n\t\t\t\t\t</th>\n\t\t\t\t}\n\t\t\t</tr>\n\n\t\t\t@if (FilteredList.length > 0 && RowResumenList.length > 0) {\n\t\t\t\t<tr class=\"fixedRow\">\n\t\t\t\t\t@for (col of RowResumenList; track $index) {\n\t\t\t\t\t\t<td [ngClass]=\"col.className\" [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\">\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef\"></ng-container>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t</ng-template>\n\n\t\t<!-- Cuerpo de la tabla -->\n\t\t<ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t<td [ngClass]=\"col.className\">\n\t\t\t\t\t\t@if (col.showIndex) {\n\t\t\t\t\t\t\t{{ rowIndex + 1 + (CurrentPage - 1) * RowsPerPage }}\n\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef; context: { $implicit: rowData }\"></ng-container>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<span class=\"text-breakWord\" tooltipStyleClass=\"prTooltip\" pTooltip=\"{{ col.tooltip }}\" tooltipPosition=\"{{ col.tooltipPosition }}\">\n\t\t\t\t\t\t\t\t\t{{ rowData[col.field] | formatCell: col.formatType }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox) {\n\t\t\t\t\t<td class=\"text-center\">\n\t\t\t\t\t\t<p-tableCheckbox [value]=\"rowData\" class=\"prCheckbox\" />\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t</ng-template>\n\n\t\t<!-- Mensaje cuando no hay datos -->\n\t\t<ng-template pTemplate=\"emptymessage\">\n\t\t\t<tr>\n\t\t\t\t<td [attr.colspan]=\"ColumnList.length + (ShowCheckbox ? 1 : 0)\" class=\"text-center\">\n\t\t\t\t\t{{ \"Nodata\" | term: GlobalTermService.languageCode }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</ng-template>\n\t</p-table>\n\n\t<!-- <div class=\"prTableToolsBottom\"> -->\n\t<div class=\"d-flex justify-content-end\">\n\t\t@if (TotalRecords !== 0 && ShowPagination) {\n\t\t\t<div class=\"ptTablePaginator\">\n\t\t\t\t<p-paginator\n\t\t\t\t\tclass=\"prPaginator paginatorTableGA\"\n\t\t\t\t\t[first]=\"(CurrentPage - 1) * RowsPerPage\"\n\t\t\t\t\t[rows]=\"RowsPerPage\"\n\t\t\t\t\t[totalRecords]=\"TotalRecords\"\n\t\t\t\t\t(onPageChange)=\"OnPageChange($event)\"\n\t\t\t\t\t[showJumpToPageInput]=\"false\"\n\t\t\t\t\t[showCurrentPageReport]=\"false\"\n\t\t\t\t\t[showPageLinks]=\"false\"\n\t\t\t\t\t[showFirstLastIcon]=\"false\"\n\t\t\t\t\t[templateLeft]=\"templateLeft\"\n\t\t\t\t>\n\t\t\t\t\t<ng-template #previouspagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-left paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template #nextpagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-right paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template pTemplate=\"templateLeft\" let-state #templateLeft>\n\t\t\t\t\t\t<span>{{ \"ROWS_PER_PAGE\" | term: GlobalTermService.languageCode }}</span>\n\t\t\t\t\t\t<p-select\n\t\t\t\t\t\t\tpanelStyleClass=\"prSelect paginatorSelectTableGA\"\n\t\t\t\t\t\t\tclass=\"prSelect\"\n\t\t\t\t\t\t\t[options]=\"AllowedPageSizes\"\n\t\t\t\t\t\t\t[ngModel]=\"RowsPerPage\"\n\t\t\t\t\t\t\t(onChange)=\"OnRowsPerPageChange($event.value)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ng-template #dropdownicon>\n\t\t\t\t\t\t\t <i class=\"icon icon-arrow-down\"></i>\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t</p-select>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{{ \"Page\" | term: GlobalTermService.languageCode }}\n\t\t\t\t\t\t\t<p-inputnumber class=\"p-paginator-jtp-input\" inputId=\"integeronly\" [(ngModel)]=\"CurrentPage\" [allowEmpty]=\"false\" [min]=\"1\" (keyup.enter)=\"onChangeSelectPage($event)\" />\n\t\t\t\t\t\t\t{{ \"Of\" | term: GlobalTermService.languageCode }} {{ TotalPages }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</p-paginator>\n\t\t\t</div>\n\t\t}\n\t</div>\n</div>\n", dependencies: [{ kind: "component", type: InputIcon, selector: "p-inputicon, p-inputIcon", inputs: ["hostName", "styleClass"] }, { kind: "component", type: IconField, selector: "p-iconfield, p-iconField, p-icon-field", inputs: ["hostName", "iconPosition", "styleClass"] }, { kind: "directive", type: InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pSize", "variant", "fluid", "invalid"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "component", type: InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "placeholder", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "autocomplete", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: Paginator, selector: "p-paginator", inputs: ["pageLinkSize", "styleClass", "alwaysShow", "dropdownAppendTo", "templateLeft", "templateRight", "dropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showFirstLastIcon", "totalRecords", "rows", "rowsPerPageOptions", "showJumpToPageDropdown", "showJumpToPageInput", "jumpToPageItemTemplate", "showPageLinks", "locale", "dropdownItemTemplate", "first", "appendTo"], outputs: ["onPageChange"] }, { 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: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i3.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "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", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "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: i4$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i3.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i3.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i3.TableCheckbox, selector: "p-tableCheckbox", inputs: ["value", "disabled", "required", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i3.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "panelStyle", "styleClass", "panelStyleClass", "readonly", "editable", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "filterValue", "options", "appendTo"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: BadgeModule }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i5.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions", "appendTo", "ptTooltip"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "pipe", type: TermPipe, name: "term" }, { kind: "pipe", type: FormatCellPipe, name: "formatCell" }] });
|
|
1934
|
+
}
|
|
1935
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TableFetchComponent, decorators: [{
|
|
1936
|
+
type: Component,
|
|
1937
|
+
args: [{ selector: "intelica-table-fetch", standalone: true, imports: [
|
|
1938
|
+
InputIcon,
|
|
1939
|
+
IconField,
|
|
1940
|
+
InputText,
|
|
1941
|
+
InputTextModule,
|
|
1942
|
+
InputNumber,
|
|
1943
|
+
Paginator,
|
|
1944
|
+
FormsModule,
|
|
1945
|
+
CommonModule,
|
|
1946
|
+
TableModule,
|
|
1947
|
+
Select,
|
|
1948
|
+
BadgeModule,
|
|
1949
|
+
TooltipModule,
|
|
1950
|
+
TermPipe,
|
|
1951
|
+
CheckboxModule,
|
|
1952
|
+
FormsModule,
|
|
1953
|
+
FormatCellPipe,
|
|
1954
|
+
], providers: [FormatCellPipe, DatePipe], template: "<div class=\"prTable\">\n\t@if (RenderPanel) {\n\t\t<div class=\" \">\n\t\t\t<div class=\"prCard__row justify-content-end\">\n\t\t\t\t<div class=\"prCard__actionflex\">\n\t\t\t\t\t@if (AdditionalTemplate) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalTemplate\"></ng-container>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\n\t\t\t\t@if (ShowSearch) {\n\t\t\t\t\t<div class=\"ptSearch searchTableGA\">\n\t\t\t\t\t\t<p-iconfield>\n\t\t\t\t\t\t\t<input type=\"text\" class=\"prInputText\" pInputText placeholder=\"{{ 'LBL_SEARCH_SELECT' | term: GlobalTermService.languageCode }}\" [(ngModel)]=\"SearchInput\" (keydown.enter)=\"OnSearch()\" />\n\t\t\t\t\t\t\t<p-inputicon>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--close\" *ngIf=\"SearchInput\" (click)=\"ClearSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-cancel\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t<span class=\"ptSearch__icon ptSearch__icon--divider\" *ngIf=\"SearchInput\"></span>\n\t\t\t\t\t\t\t\t<button class=\"ptSearch__icon ptSearch__icon--search\" (click)=\"OnSearch()\">\n\t\t\t\t\t\t\t\t\t<i class=\"icon icon-search\"></i>\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</p-inputicon>\n\t\t\t\t\t\t</p-iconfield>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t<!-- -->\n\t\t\t\t@if (AdditionalCentralTemplate) {\n\t\t\t\t\t<div class=\"prTableTools__new prTableTools__new--right\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalCentralTemplate\"></ng-container>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (AdditionalExtendedTemplate) {\n\t\t\t<div class=\"prTableTools justify-content-start\">\n\t\t\t\t<ng-container *ngTemplateOutlet=\"AdditionalExtendedTemplate\"></ng-container>\n\t\t\t</div>\n\t\t}\n\t}\n\t<p-table\n\t\tclass=\"prTable\"\n\t\t[ngClass]=\"ClassName\"\n\t\t[value]=\"FilteredList\"\n\t\tresponsiveLayout=\"scroll\"\n\t\t[sortField]=\"DefaultSortField\"\n\t\t[sortOrder]=\"SortOrder\"\n\t\t[scrollable]=\"scrollable\"\n\t\t[scrollHeight]=\"scrollable ? scrollHeight : 'auto'\"\n\t\t[tableStyle]=\"tableStyle\"\n\t>\n\t\t<!-- Cabecera con columnas agrupadas -->\n\t\t<ng-template pTemplate=\"header\">\n\t\t\t@for (level of Levels; track $index) {\n\t\t\t\t<tr>\n\t\t\t\t\t@for (col of ColumnGroupList; track $index) {\n\t\t\t\t\t\t@if (col.level === level) {\n\t\t\t\t\t\t\t<th [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\" [pSortableColumn]=\"col.sortable ? col.field : ''\" [style.min-width]=\"col.minWidth\" (click)=\"col.sortable && OnSort(col.field)\">\n\t\t\t\t\t\t\t\t<div>\n\t\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" F [pTooltip]=\"col.headerTooltip || col.header\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</th>\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t@if (ShowCheckbox && level === 0 && ColumnGroupList.length != 0) {\n\t\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\" [attr.rowspan]=\"MaxLevel === 1 ? 2 : MaxLevel\">\n\t\t\t\t\t\t\t<p-tableHeaderCheckbox class=\"prCheckbox\" />\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t@if (col.showHeader) {\n\t\t\t\t\t\t<th\n\t\t\t\t\t\t\t[class]=\"col.className\"\n\t\t\t\t\t\t\t[pSortableColumn]=\"!col.isChecboxColumn && col.sortable ? col.field : ''\"\n\t\t\t\t\t\t\t[style.width]=\"col.width\"\n\t\t\t\t\t\t\t[style.min-width]=\"col.minWidth\"\n\t\t\t\t\t\t\t(click)=\"!col.isChecboxColumn && col.sortable && OnSort(col.field)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div class=\"prTable__header\">\n\t\t\t\t\t\t\t\t<span tooltipStyleClass=\"prTooltip\" [pTooltip]=\"col.headerTooltip || col.header\" [tooltipPosition]=\"col.headerTooltipPosition || 'top'\">\n\t\t\t\t\t\t\t\t\t{{ col.header }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t@if (!col.showIndex) {\n\t\t\t\t\t\t\t\t\t<p-sortIcon *ngIf=\"col.sortable\" [field]=\"col.field\"></p-sortIcon>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</th>\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox && ColumnGroupList.length == 0) {\n\t\t\t\t\t<th class=\"text-center\" style=\"width: 4%\">\n\t\t\t\t\t\t<p-tableHeaderCheckbox class=\"prCheckbox\" />\n\t\t\t\t\t</th>\n\t\t\t\t}\n\t\t\t</tr>\n\n\t\t\t@if (FilteredList.length > 0 && RowResumenList.length > 0) {\n\t\t\t\t<tr class=\"fixedRow\">\n\t\t\t\t\t@for (col of RowResumenList; track $index) {\n\t\t\t\t\t\t<td [ngClass]=\"col.className\" [attr.colspan]=\"col.colspan\" [attr.rowspan]=\"col.rowspan\">\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef\"></ng-container>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t}\n\t\t\t\t</tr>\n\t\t\t}\n\t\t</ng-template>\n\n\t\t<!-- Cuerpo de la tabla -->\n\t\t<ng-template pTemplate=\"body\" let-rowData let-rowIndex=\"rowIndex\">\n\t\t\t<tr>\n\t\t\t\t@for (col of ColumnList; track $index) {\n\t\t\t\t\t<td [ngClass]=\"col.className\">\n\t\t\t\t\t\t@if (col.showIndex) {\n\t\t\t\t\t\t\t{{ rowIndex + 1 + (CurrentPage - 1) * RowsPerPage }}\n\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t@if (col.templateRef) {\n\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"col.templateRef; context: { $implicit: rowData }\"></ng-container>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<span class=\"text-breakWord\" tooltipStyleClass=\"prTooltip\" pTooltip=\"{{ col.tooltip }}\" tooltipPosition=\"{{ col.tooltipPosition }}\">\n\t\t\t\t\t\t\t\t\t{{ rowData[col.field] | formatCell: col.formatType }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t\t@if (ShowCheckbox) {\n\t\t\t\t\t<td class=\"text-center\">\n\t\t\t\t\t\t<p-tableCheckbox [value]=\"rowData\" class=\"prCheckbox\" />\n\t\t\t\t\t</td>\n\t\t\t\t}\n\t\t\t</tr>\n\t\t</ng-template>\n\n\t\t<!-- Mensaje cuando no hay datos -->\n\t\t<ng-template pTemplate=\"emptymessage\">\n\t\t\t<tr>\n\t\t\t\t<td [attr.colspan]=\"ColumnList.length + (ShowCheckbox ? 1 : 0)\" class=\"text-center\">\n\t\t\t\t\t{{ \"Nodata\" | term: GlobalTermService.languageCode }}\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</ng-template>\n\t</p-table>\n\n\t<!-- <div class=\"prTableToolsBottom\"> -->\n\t<div class=\"d-flex justify-content-end\">\n\t\t@if (TotalRecords !== 0 && ShowPagination) {\n\t\t\t<div class=\"ptTablePaginator\">\n\t\t\t\t<p-paginator\n\t\t\t\t\tclass=\"prPaginator paginatorTableGA\"\n\t\t\t\t\t[first]=\"(CurrentPage - 1) * RowsPerPage\"\n\t\t\t\t\t[rows]=\"RowsPerPage\"\n\t\t\t\t\t[totalRecords]=\"TotalRecords\"\n\t\t\t\t\t(onPageChange)=\"OnPageChange($event)\"\n\t\t\t\t\t[showJumpToPageInput]=\"false\"\n\t\t\t\t\t[showCurrentPageReport]=\"false\"\n\t\t\t\t\t[showPageLinks]=\"false\"\n\t\t\t\t\t[showFirstLastIcon]=\"false\"\n\t\t\t\t\t[templateLeft]=\"templateLeft\"\n\t\t\t\t>\n\t\t\t\t\t<ng-template #previouspagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-left paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template #nextpagelinkicon>\n\t\t\t\t\t\t<i class=\"icon icon-arrow-right paginatorArrowGA\"></i>\n\t\t\t\t\t</ng-template>\n\t\t\t\t\t<ng-template pTemplate=\"templateLeft\" let-state #templateLeft>\n\t\t\t\t\t\t<span>{{ \"ROWS_PER_PAGE\" | term: GlobalTermService.languageCode }}</span>\n\t\t\t\t\t\t<p-select\n\t\t\t\t\t\t\tpanelStyleClass=\"prSelect paginatorSelectTableGA\"\n\t\t\t\t\t\t\tclass=\"prSelect\"\n\t\t\t\t\t\t\t[options]=\"AllowedPageSizes\"\n\t\t\t\t\t\t\t[ngModel]=\"RowsPerPage\"\n\t\t\t\t\t\t\t(onChange)=\"OnRowsPerPageChange($event.value)\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ng-template #dropdownicon>\n\t\t\t\t\t\t\t <i class=\"icon icon-arrow-down\"></i>\n\t\t\t\t\t\t\t</ng-template>\n\t\t\t\t\t\t</p-select>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{{ \"Page\" | term: GlobalTermService.languageCode }}\n\t\t\t\t\t\t\t<p-inputnumber class=\"p-paginator-jtp-input\" inputId=\"integeronly\" [(ngModel)]=\"CurrentPage\" [allowEmpty]=\"false\" [min]=\"1\" (keyup.enter)=\"onChangeSelectPage($event)\" />\n\t\t\t\t\t\t\t{{ \"Of\" | term: GlobalTermService.languageCode }} {{ TotalPages }}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</ng-template>\n\t\t\t\t</p-paginator>\n\t\t\t</div>\n\t\t}\n\t</div>\n</div>\n" }]
|
|
1955
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { ComponentId: [{
|
|
1956
|
+
type: Input
|
|
1957
|
+
}], ShowRowPerPage: [{
|
|
1958
|
+
type: Input
|
|
1959
|
+
}], ShowSearch: [{
|
|
1960
|
+
type: Input
|
|
1961
|
+
}], ShowPagination: [{
|
|
1962
|
+
type: Input
|
|
1963
|
+
}], RowsPerPage: [{
|
|
1964
|
+
type: Input
|
|
1965
|
+
}], ShowCheckbox: [{
|
|
1966
|
+
type: Input
|
|
1967
|
+
}], ShowIndex: [{
|
|
1968
|
+
type: Input
|
|
1969
|
+
}], ClassName: [{
|
|
1970
|
+
type: Input
|
|
1971
|
+
}], DefaultSortField: [{
|
|
1972
|
+
type: Input
|
|
1973
|
+
}], scrollHeight: [{
|
|
1974
|
+
type: Input
|
|
1975
|
+
}], scrollable: [{
|
|
1976
|
+
type: Input
|
|
1977
|
+
}], AllowedPageSizes: [{
|
|
1978
|
+
type: Input
|
|
1979
|
+
}], tableStyle: [{
|
|
1980
|
+
type: Input
|
|
1981
|
+
}], FilteredList: [{
|
|
1982
|
+
type: Input
|
|
1983
|
+
}], TotalItems: [{
|
|
1984
|
+
type: Input
|
|
1985
|
+
}], EmitQueryParametersChange: [{
|
|
1986
|
+
type: Output
|
|
1987
|
+
}], Columns: [{
|
|
1988
|
+
type: ContentChildren,
|
|
1989
|
+
args: [ColumnComponent]
|
|
1990
|
+
}], ColumnGroups: [{
|
|
1991
|
+
type: ContentChildren,
|
|
1992
|
+
args: [ColumnGroupComponent]
|
|
1993
|
+
}], RowResumenGroups: [{
|
|
1994
|
+
type: ContentChildren,
|
|
1995
|
+
args: [RowResumenComponent]
|
|
1996
|
+
}], AdditionalTemplate: [{
|
|
1997
|
+
type: ContentChild,
|
|
1998
|
+
args: ["additionalTemplate"]
|
|
1999
|
+
}], AdditionalCentralTemplate: [{
|
|
2000
|
+
type: ContentChild,
|
|
2001
|
+
args: ["additionalCentralTemplate"]
|
|
2002
|
+
}], AdditionalExtendedTemplate: [{
|
|
2003
|
+
type: ContentChild,
|
|
2004
|
+
args: ["additionalExtendedTemplate"]
|
|
2005
|
+
}], EmitSortEvent: [{
|
|
2006
|
+
type: Output
|
|
2007
|
+
}], CurrentPage: [{
|
|
2008
|
+
type: Input
|
|
2009
|
+
}], SortOrder: [{
|
|
2010
|
+
type: Input
|
|
2011
|
+
}], SortField: [{
|
|
2012
|
+
type: Input
|
|
2013
|
+
}] } });
|
|
2014
|
+
|
|
2015
|
+
class SkeletonTableComponent {
|
|
2016
|
+
/**
|
|
2017
|
+
* @description number of rows to display
|
|
2018
|
+
* @default 6
|
|
2019
|
+
* @type number
|
|
2020
|
+
* @example <intelica-skeleton-table [rows]="6"></intelica-skeleton-table>
|
|
2021
|
+
*/
|
|
2022
|
+
rows = 6;
|
|
2023
|
+
/**
|
|
2024
|
+
* @description number of columns to display
|
|
2025
|
+
* @default 6
|
|
2026
|
+
* @type number
|
|
2027
|
+
* @example <intelica-skeleton-table [columns]="6"></intelica-skeleton-table>
|
|
2028
|
+
*/
|
|
2029
|
+
columns = 6;
|
|
2030
|
+
showLeftSkeleton = true;
|
|
2031
|
+
showRightSkeleton = true;
|
|
2032
|
+
columnSizes = [];
|
|
2033
|
+
ngOnInit() {
|
|
2034
|
+
const baseSize = 12 / this.columns;
|
|
2035
|
+
this.columnSizes = Array.from({ length: this.columns }, (_, i) => {
|
|
2036
|
+
return `col-${baseSize}`;
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
get justifyClass() {
|
|
2040
|
+
if (this.showLeftSkeleton && this.showRightSkeleton)
|
|
2041
|
+
return "justify-content-between";
|
|
2042
|
+
if (this.showLeftSkeleton)
|
|
2043
|
+
return "justify-content-start";
|
|
2044
|
+
if (this.showRightSkeleton)
|
|
2045
|
+
return "justify-content-end";
|
|
2046
|
+
return null;
|
|
2047
|
+
}
|
|
2048
|
+
getRows() {
|
|
2049
|
+
return new Array(this.rows);
|
|
2050
|
+
}
|
|
2051
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SkeletonTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2052
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.23", type: SkeletonTableComponent, isStandalone: true, selector: "intelica-skeleton-table", inputs: { rows: "rows", columns: "columns", showLeftSkeleton: "showLeftSkeleton", showRightSkeleton: "showRightSkeleton" }, ngImport: i0, template: "<div class=\"skeletonTable\">\n\t<div class=\"mb-2 row\" *ngIf=\"showLeftSkeleton || showRightSkeleton\" [ngClass]=\"justifyClass\">\n\t\t<div class=\"col-1 px-0\" *ngIf=\"showLeftSkeleton\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'3rem'\"></p-skeleton>\n\t\t</div>\n\t\t<div class=\"col-3 px-0\" *ngIf=\"showRightSkeleton\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'3rem'\"></p-skeleton>\n\t\t</div>\n\t</div>\n\n\t<div class=\"row\">\n\t\t<div class=\"col-12 px-0 mb-2\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'4rem'\"></p-skeleton>\n\t\t</div>\n\t</div>\n\t@for (row of getRows(); track $index) {\n\t<div class=\"row borderBottomRow\">\n\t\t@for (column of columnSizes; track $index) {\n\t\t<div class=\"{{ column }} px-0\">\n\t\t\t<div class=\"bodyPaddingTable\">\n\t\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'2rem'\"></p-skeleton>\n\t\t\t</div>\n\t\t</div>\n\t\t}\n\t</div>\n\t}\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i2$2.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "shape", "animation", "borderRadius", "size", "width", "height"] }] });
|
|
2053
|
+
}
|
|
2054
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: SkeletonTableComponent, decorators: [{
|
|
2055
|
+
type: Component,
|
|
2056
|
+
args: [{ selector: "intelica-skeleton-table", imports: [CommonModule, SkeletonModule], template: "<div class=\"skeletonTable\">\n\t<div class=\"mb-2 row\" *ngIf=\"showLeftSkeleton || showRightSkeleton\" [ngClass]=\"justifyClass\">\n\t\t<div class=\"col-1 px-0\" *ngIf=\"showLeftSkeleton\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'3rem'\"></p-skeleton>\n\t\t</div>\n\t\t<div class=\"col-3 px-0\" *ngIf=\"showRightSkeleton\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'3rem'\"></p-skeleton>\n\t\t</div>\n\t</div>\n\n\t<div class=\"row\">\n\t\t<div class=\"col-12 px-0 mb-2\">\n\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'4rem'\"></p-skeleton>\n\t\t</div>\n\t</div>\n\t@for (row of getRows(); track $index) {\n\t<div class=\"row borderBottomRow\">\n\t\t@for (column of columnSizes; track $index) {\n\t\t<div class=\"{{ column }} px-0\">\n\t\t\t<div class=\"bodyPaddingTable\">\n\t\t\t\t<p-skeleton class=\"prSkeleton\" [height]=\"'2rem'\"></p-skeleton>\n\t\t\t</div>\n\t\t</div>\n\t\t}\n\t</div>\n\t}\n</div>\n" }]
|
|
2057
|
+
}], propDecorators: { rows: [{
|
|
2058
|
+
type: Input
|
|
2059
|
+
}], columns: [{
|
|
2060
|
+
type: Input
|
|
2061
|
+
}], showLeftSkeleton: [{
|
|
2062
|
+
type: Input
|
|
2063
|
+
}], showRightSkeleton: [{
|
|
2064
|
+
type: Input
|
|
2065
|
+
}] } });
|
|
2066
|
+
|
|
2067
|
+
class EchartComponent {
|
|
2068
|
+
el;
|
|
2069
|
+
platformId;
|
|
2070
|
+
config;
|
|
2071
|
+
id;
|
|
2072
|
+
renderer = "canvas";
|
|
2073
|
+
containerStyle = {
|
|
2074
|
+
width: "100%",
|
|
2075
|
+
height: "400px",
|
|
2076
|
+
};
|
|
2077
|
+
event = new EventEmitter();
|
|
2078
|
+
chart;
|
|
2079
|
+
constructor(el, platformId) {
|
|
2080
|
+
this.el = el;
|
|
2081
|
+
this.platformId = platformId;
|
|
2082
|
+
}
|
|
2083
|
+
ngAfterViewInit() {
|
|
2084
|
+
const chartElement = this.el.nativeElement.querySelector(`#${this.id}_plot`);
|
|
2085
|
+
if (!this.config) {
|
|
2086
|
+
throw new Error("Chart configuration is not set");
|
|
2087
|
+
}
|
|
2088
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
2089
|
+
throw new Error("Platform is not browser");
|
|
2090
|
+
}
|
|
2091
|
+
if (!chartElement) {
|
|
2092
|
+
throw new Error("Plot area not found");
|
|
2093
|
+
}
|
|
2094
|
+
this.initChart(chartElement);
|
|
2095
|
+
}
|
|
2096
|
+
refreshChart() {
|
|
2097
|
+
this.chart.setOption(this.config);
|
|
2098
|
+
}
|
|
2099
|
+
resize() {
|
|
2100
|
+
if (this.chart) {
|
|
2101
|
+
setTimeout(() => {
|
|
2102
|
+
this.chart.resize();
|
|
2103
|
+
}, 1);
|
|
2104
|
+
}
|
|
2105
|
+
}
|
|
2106
|
+
initChart(chartElement) {
|
|
2107
|
+
const observer = new ResizeObserver(() => this.resize());
|
|
2108
|
+
this.chart = echarts.init(chartElement, null, { renderer: this.renderer });
|
|
2109
|
+
this.chart.setOption(this.config);
|
|
2110
|
+
this.chart.on("click", params => {
|
|
2111
|
+
this.event.emit(params);
|
|
2112
|
+
});
|
|
2113
|
+
observer.observe(chartElement);
|
|
2114
|
+
}
|
|
2115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: EchartComponent, deps: [{ token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
2116
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.23", type: EchartComponent, isStandalone: true, selector: "intelica-echart", inputs: { config: "config", id: "id", renderer: "renderer", containerStyle: "containerStyle" }, outputs: { event: "event" }, ngImport: i0, template: "<div [id]=\"id + '_plot'\" class=\"chart\" [ngStyle]=\"containerStyle\"></div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
|
|
2117
|
+
}
|
|
2118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: EchartComponent, decorators: [{
|
|
2119
|
+
type: Component,
|
|
2120
|
+
args: [{ selector: "intelica-echart", imports: [CommonModule], template: "<div [id]=\"id + '_plot'\" class=\"chart\" [ngStyle]=\"containerStyle\"></div>\n" }]
|
|
2121
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: Object, decorators: [{
|
|
2122
|
+
type: Inject,
|
|
2123
|
+
args: [PLATFORM_ID]
|
|
2124
|
+
}] }], propDecorators: { config: [{
|
|
2125
|
+
type: Input
|
|
2126
|
+
}], id: [{
|
|
2127
|
+
type: Input
|
|
2128
|
+
}], renderer: [{
|
|
2129
|
+
type: Input
|
|
2130
|
+
}], containerStyle: [{
|
|
2131
|
+
type: Input
|
|
2132
|
+
}], event: [{
|
|
2133
|
+
type: Output
|
|
2134
|
+
}] } });
|
|
2135
|
+
|
|
2136
|
+
class PageElementService {
|
|
2137
|
+
_http = inject(HttpClient);
|
|
2138
|
+
_configService = inject(ConfigService);
|
|
2139
|
+
GetElements(pageRoot) {
|
|
2140
|
+
return this._http.get(`${this._configService.environment?.securityPath}/Page/GetAvailableElementsByPageRoot/${pageRoot}`);
|
|
2141
|
+
}
|
|
2142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: PageElementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2143
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: PageElementService, providedIn: "root" });
|
|
2144
|
+
}
|
|
2145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: PageElementService, decorators: [{
|
|
2146
|
+
type: Injectable,
|
|
2147
|
+
args: [{ providedIn: "root" }]
|
|
2148
|
+
}] });
|
|
2149
|
+
|
|
2150
|
+
class ElementService {
|
|
2151
|
+
Elements = [];
|
|
2152
|
+
PageRoot = "";
|
|
2153
|
+
pageElementService = inject(PageElementService);
|
|
2154
|
+
Initialize$(pageRootValue) {
|
|
2155
|
+
if (!pageRootValue)
|
|
2156
|
+
return of();
|
|
2157
|
+
this.PageRoot = pageRootValue;
|
|
2158
|
+
return this.pageElementService.GetElements(this.PageRoot).pipe(tap(elements => (this.Elements = elements)), map(() => void 0));
|
|
2159
|
+
}
|
|
2160
|
+
HasElement(description) {
|
|
2161
|
+
return this.Elements.some(x => x.elementDescription === description);
|
|
2162
|
+
}
|
|
2163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ElementService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2164
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ElementService, providedIn: "root" });
|
|
2165
|
+
}
|
|
2166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: ElementService, decorators: [{
|
|
2167
|
+
type: Injectable,
|
|
2168
|
+
args: [{ providedIn: "root" }]
|
|
2169
|
+
}] });
|
|
2170
|
+
|
|
2171
|
+
function darkenColor(input, amount = 0.2) {
|
|
2172
|
+
const clamp = (v) => Math.max(0, Math.min(255, v));
|
|
2173
|
+
const toHex = (v) => v.toString(16).padStart(2, '0');
|
|
2174
|
+
if (input.startsWith('#')) {
|
|
2175
|
+
const r = parseInt(input.slice(1, 3), 16);
|
|
2176
|
+
const g = parseInt(input.slice(3, 5), 16);
|
|
2177
|
+
const b = parseInt(input.slice(5, 7), 16);
|
|
2178
|
+
return `#${toHex(clamp(Math.round(r * (1 - amount))))}${toHex(clamp(Math.round(g * (1 - amount))))}${toHex(clamp(Math.round(b * (1 - amount))))}`;
|
|
2179
|
+
}
|
|
2180
|
+
const m = input.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/i);
|
|
2181
|
+
if (m) {
|
|
2182
|
+
const r = clamp(Math.round(+m[1] * (1 - amount)));
|
|
2183
|
+
const g = clamp(Math.round(+m[2] * (1 - amount)));
|
|
2184
|
+
const b = clamp(Math.round(+m[3] * (1 - amount)));
|
|
2185
|
+
const a = m[4] !== undefined ? `, ${m[4]}` : '';
|
|
2186
|
+
return `rgba(${r}, ${g}, ${b}${a})`;
|
|
2187
|
+
}
|
|
2188
|
+
return input;
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
class FormatAmountPipe {
|
|
2192
|
+
transform(value, shortFormat = false, decimalPlaces = 2, validNegative = false) {
|
|
2193
|
+
if (value === null || value === undefined || value == 0) {
|
|
2194
|
+
return "-";
|
|
2195
|
+
}
|
|
2196
|
+
const numericValue = typeof value === "string" ? Number.parseFloat(value) : value;
|
|
2197
|
+
if (Number.isNaN(numericValue)) {
|
|
2198
|
+
return "-";
|
|
2199
|
+
}
|
|
2200
|
+
let formattedValue;
|
|
2201
|
+
if (shortFormat) {
|
|
2202
|
+
formattedValue = this.getShortFormat(numericValue, decimalPlaces);
|
|
2203
|
+
}
|
|
2204
|
+
else {
|
|
2205
|
+
formattedValue = this.formatWithThousandSeparators(numericValue, decimalPlaces);
|
|
2206
|
+
}
|
|
2207
|
+
if (validNegative) {
|
|
2208
|
+
if (numericValue < 0) {
|
|
2209
|
+
formattedValue = `(${formattedValue})`;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
return formattedValue;
|
|
2213
|
+
}
|
|
2214
|
+
getShortFormat(value, decimalPlaces) {
|
|
2215
|
+
const absValue = Math.abs(value);
|
|
2216
|
+
const suffixes = [
|
|
2217
|
+
{ limit: 1e12, suffix: "T" },
|
|
2218
|
+
{ limit: 1e9, suffix: "B" },
|
|
2219
|
+
{ limit: 1e6, suffix: "M" },
|
|
2220
|
+
{ limit: 1e3, suffix: "K" },
|
|
2221
|
+
];
|
|
2222
|
+
for (const { limit, suffix } of suffixes) {
|
|
2223
|
+
if (absValue >= limit) {
|
|
2224
|
+
return (absValue / limit).toFixed(decimalPlaces) + suffix;
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
return absValue.toFixed(decimalPlaces);
|
|
2228
|
+
}
|
|
2229
|
+
formatWithThousandSeparators(value, decimalPlaces) {
|
|
2230
|
+
const absValue = Math.abs(value);
|
|
2231
|
+
return new Intl.NumberFormat("en-US", {
|
|
2232
|
+
minimumFractionDigits: decimalPlaces,
|
|
2233
|
+
maximumFractionDigits: decimalPlaces,
|
|
2234
|
+
}).format(absValue);
|
|
2235
|
+
}
|
|
2236
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: FormatAmountPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2237
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.23", ngImport: i0, type: FormatAmountPipe, isStandalone: true, name: "amount" });
|
|
2238
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: FormatAmountPipe, providedIn: "root" });
|
|
2239
|
+
}
|
|
2240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: FormatAmountPipe, decorators: [{
|
|
2241
|
+
type: Injectable,
|
|
2242
|
+
args: [{
|
|
2243
|
+
providedIn: "root",
|
|
2244
|
+
}]
|
|
2245
|
+
}, {
|
|
2246
|
+
type: Pipe,
|
|
2247
|
+
args: [{
|
|
2248
|
+
name: "amount",
|
|
2249
|
+
}]
|
|
2250
|
+
}] });
|
|
2251
|
+
|
|
2252
|
+
class EchartService {
|
|
2253
|
+
_formatAmountPipe = inject(FormatAmountPipe);
|
|
2254
|
+
/// Chart Generals
|
|
2255
|
+
getDefultAxisConfiguration(type, data, showAxis = true, showSplitLine = false) {
|
|
2256
|
+
return {
|
|
2257
|
+
show: showAxis,
|
|
2258
|
+
type: type,
|
|
2259
|
+
data: data,
|
|
2260
|
+
axisTick: {
|
|
2261
|
+
show: false,
|
|
2262
|
+
},
|
|
2263
|
+
axisLine: {
|
|
2264
|
+
show: false,
|
|
2265
|
+
lineStyle: { color: getColor("gray"), type: "dashed" },
|
|
2266
|
+
},
|
|
2267
|
+
splitLine: {
|
|
2268
|
+
show: showSplitLine,
|
|
2269
|
+
// lineStyle: {
|
|
2270
|
+
// color: Color.gray,
|
|
2271
|
+
// type: "dashed",
|
|
2272
|
+
// width: 1,
|
|
2273
|
+
// },
|
|
2274
|
+
lineStyle: { width: 1, color: Color.gray, type: [5, 5], cap: "round" },
|
|
2275
|
+
},
|
|
2276
|
+
axisLabel: {
|
|
2277
|
+
fontFamily: "Lato, sans-serif",
|
|
2278
|
+
show: true,
|
|
2279
|
+
// show: showAxis,
|
|
2280
|
+
color: Color.gray3,
|
|
2281
|
+
fontSize: 14,
|
|
2282
|
+
padding: 10,
|
|
2283
|
+
},
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
getCategoryAxisConfiguration(data) {
|
|
2287
|
+
return this.getDefultAxisConfiguration("category", data, true);
|
|
2288
|
+
}
|
|
2289
|
+
getValueAxisConfiguration(showAxis = true, format = true, showAxisLines = true) {
|
|
2290
|
+
let axisConfiguration = this.getDefultAxisConfiguration("value", undefined, showAxis, showAxisLines);
|
|
2291
|
+
if (format) {
|
|
2292
|
+
axisConfiguration.axisLabel.formatter = (value) => {
|
|
2293
|
+
const formatted = this._formatAmountPipe.transform(value, true, 0, true);
|
|
2294
|
+
return formatted === "-" ? 0 : formatted;
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
return axisConfiguration;
|
|
2298
|
+
}
|
|
2299
|
+
getGridConfiguration() {
|
|
2300
|
+
return {
|
|
2301
|
+
// left: "0%",
|
|
2302
|
+
// right: "0%",
|
|
2303
|
+
// //bottom: '0%',
|
|
2304
|
+
// containLabel: true,
|
|
2305
|
+
left: 0,
|
|
2306
|
+
right: 0,
|
|
2307
|
+
top: 20,
|
|
2308
|
+
bottom: 40,
|
|
2309
|
+
containLabel: true,
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
getLegendConfiguration() {
|
|
2313
|
+
return {
|
|
2314
|
+
// orient: "horizontal", // 'horizontal | vertical'
|
|
2315
|
+
// icon: "circle",
|
|
2316
|
+
// bottom: 5,
|
|
2317
|
+
// align: "auto",
|
|
2318
|
+
// itemGap: 20,
|
|
2319
|
+
// textStyle: { color: Color.blue, fontSize: 14 },
|
|
2320
|
+
data: [{ name: "Expenses", icon: "circle" }],
|
|
2321
|
+
bottom: 0,
|
|
2322
|
+
textStyle: {
|
|
2323
|
+
color: "#4E546F",
|
|
2324
|
+
fontFamily: "Lato, sans-serif",
|
|
2325
|
+
fontSize: 12,
|
|
2326
|
+
lineHeight: 12,
|
|
2327
|
+
},
|
|
2328
|
+
itemWidth: 10,
|
|
2329
|
+
itemHeight: 10,
|
|
2330
|
+
itemGap: 25,
|
|
2331
|
+
align: "left",
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
2334
|
+
/**
|
|
2335
|
+
*
|
|
2336
|
+
* @param color - Color of the tooltip
|
|
2337
|
+
* @param title - Title of the tooltip
|
|
2338
|
+
* @param body - Body of the tooltip
|
|
2339
|
+
* @returns - Tooltip HTML string
|
|
2340
|
+
*/
|
|
2341
|
+
getTooltipFormatter(color, title, body) {
|
|
2342
|
+
const titleHtml = title.length > 0
|
|
2343
|
+
? `
|
|
2344
|
+
<b style=" font-size: 13px;">${title} </b><br>
|
|
2345
|
+
<hr style="border: 1px solid ${color}; margin: 4px 0;">`
|
|
2346
|
+
: "";
|
|
2347
|
+
return `
|
|
2348
|
+
<div style="font-size: 12px; boder-color: ${color}; color: ${color}; border-radius: 6px; min-width: 120px; text-align: center;">
|
|
2349
|
+
${titleHtml}
|
|
2350
|
+
${body}
|
|
2351
|
+
</div>
|
|
2352
|
+
`;
|
|
2353
|
+
}
|
|
2354
|
+
/// Charts Configuration
|
|
2355
|
+
/// BAR CHARTS
|
|
2356
|
+
/**
|
|
2357
|
+
*
|
|
2358
|
+
* @param categories - Array of categories for the x-axis
|
|
2359
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2360
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
2361
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
2362
|
+
* @param showLegend - Optional flag to show the legend
|
|
2363
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
2364
|
+
*/
|
|
2365
|
+
getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
2366
|
+
return {
|
|
2367
|
+
textStyle: { fontFamily: "Lato, sans-serif" },
|
|
2368
|
+
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
2369
|
+
yAxis: this.getValueAxisConfiguration(),
|
|
2370
|
+
series: [
|
|
2371
|
+
...series.map((item) => ({
|
|
2372
|
+
type: "bar",
|
|
2373
|
+
name: item.name,
|
|
2374
|
+
itemStyle: { color: item.color, borderRadius: 8 },
|
|
2375
|
+
data: item.value,
|
|
2376
|
+
barWidth: "33%",
|
|
2377
|
+
barGap: "0%",
|
|
2378
|
+
label: {
|
|
2379
|
+
show: true,
|
|
2380
|
+
position: "top",
|
|
2381
|
+
color: Color.blue,
|
|
2382
|
+
fontSize: 12,
|
|
2383
|
+
formatter: labelConfig,
|
|
2384
|
+
},
|
|
2385
|
+
})),
|
|
2386
|
+
],
|
|
2387
|
+
tooltip: {
|
|
2388
|
+
trigger: "item",
|
|
2389
|
+
backgroundColor: "#FFFFFF",
|
|
2390
|
+
borderWidth: 2,
|
|
2391
|
+
textStyle: { fontSize: 12 },
|
|
2392
|
+
formatter: tooltipConfig,
|
|
2393
|
+
appendTo: "body",
|
|
2394
|
+
},
|
|
2395
|
+
grid: this.getGridConfiguration(),
|
|
2396
|
+
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
/**
|
|
2400
|
+
*
|
|
2401
|
+
* @param categories - Array of categories for the x-axis
|
|
2402
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2403
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
2404
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
2405
|
+
* @param showLegend - Optional flag to show the legend
|
|
2406
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
2407
|
+
*/
|
|
2408
|
+
getBarChartStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
2409
|
+
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
2410
|
+
barBase.series.forEach((serie, index) => {
|
|
2411
|
+
// serie.barWidth = "50%";
|
|
2412
|
+
// serie.barGap = "0%";
|
|
2413
|
+
serie.barCategoryGap = "10%";
|
|
2414
|
+
serie.stack = "total";
|
|
2415
|
+
if (index < series.length - 1) {
|
|
2416
|
+
serie.label = undefined;
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
return barBase;
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
*
|
|
2423
|
+
* @param categories - Array of categories for the y-axis
|
|
2424
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2425
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
2426
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
2427
|
+
* @param showLegend - Optional flag to show the legend
|
|
2428
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
2429
|
+
*/
|
|
2430
|
+
getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend = false, enableSelectStyle = false // 👈 nuevo
|
|
2431
|
+
) {
|
|
2432
|
+
let barBase = this.getBarChartOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
2433
|
+
barBase.xAxis = this.getValueAxisConfiguration(false, true, false);
|
|
2434
|
+
barBase.yAxis = this.getCategoryAxisConfiguration(categories);
|
|
2435
|
+
barBase.series.forEach((serie, idx) => {
|
|
2436
|
+
if (serie.label) {
|
|
2437
|
+
serie.label.position = "right";
|
|
2438
|
+
}
|
|
2439
|
+
const baseColor = serie.itemStyle?.color ?? (series[idx] && series[idx].color) ?? "#FF8A00";
|
|
2440
|
+
serie.itemStyle = {
|
|
2441
|
+
...(serie.itemStyle || {}),
|
|
2442
|
+
color: baseColor,
|
|
2443
|
+
borderWidth: 0,
|
|
2444
|
+
};
|
|
2445
|
+
if (enableSelectStyle) {
|
|
2446
|
+
serie.selectedMode = "single";
|
|
2447
|
+
const selectedColor = darkenColor(String(baseColor), 0.38);
|
|
2448
|
+
serie.select = {
|
|
2449
|
+
itemStyle: {
|
|
2450
|
+
color: selectedColor,
|
|
2451
|
+
borderWidth: 0,
|
|
2452
|
+
},
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
});
|
|
2456
|
+
if (barBase.grid) {
|
|
2457
|
+
barBase.grid.left = "10%";
|
|
2458
|
+
barBase.grid.right = "10%";
|
|
2459
|
+
barBase.grid.bottom = "10%";
|
|
2460
|
+
barBase.grid.containLabel = true;
|
|
2461
|
+
}
|
|
2462
|
+
return barBase;
|
|
2463
|
+
}
|
|
2464
|
+
/**
|
|
2465
|
+
*
|
|
2466
|
+
* @param categories - Array of categories for the y-axis
|
|
2467
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2468
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
2469
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
2470
|
+
* @param showLegend - Optional flag to show the legend
|
|
2471
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
2472
|
+
*/
|
|
2473
|
+
getBarChartHorizontalStackOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
2474
|
+
let barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend);
|
|
2475
|
+
barBase.series.forEach((serie, index) => {
|
|
2476
|
+
// serie.barWidth = "50%";
|
|
2477
|
+
// serie.barGap = "0%";
|
|
2478
|
+
serie.barCategoryGap = "10%";
|
|
2479
|
+
serie.stack = "total";
|
|
2480
|
+
if (serie.label) {
|
|
2481
|
+
serie.label.position = "right";
|
|
2482
|
+
}
|
|
2483
|
+
if (index < series.length - 1) {
|
|
2484
|
+
serie.label = undefined;
|
|
2485
|
+
}
|
|
2486
|
+
});
|
|
2487
|
+
if (barBase.grid) {
|
|
2488
|
+
barBase.grid.left = "10%";
|
|
2489
|
+
barBase.grid.right = "10%";
|
|
2490
|
+
barBase.grid.bottom = "10%";
|
|
2491
|
+
barBase.grid.containLabel = true;
|
|
2492
|
+
}
|
|
2493
|
+
return barBase;
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
*
|
|
2497
|
+
* @param categories - Array of categories for the y-axis
|
|
2498
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2499
|
+
* @param labelConfig - Optional label configuration for the bars
|
|
2500
|
+
* @param tooltipConfig - Optional tooltip configuration for the bars
|
|
2501
|
+
* @param showLegend - Optional flag to show the legend
|
|
2502
|
+
* @returns - EChartsOption - Configuration object for the bar chart
|
|
2503
|
+
*/
|
|
2504
|
+
getBarChartTopOptions(categories, series, categoryWidth = 240, labelConfig, tooltipConfig, showLegend = false, categoryFormatter) {
|
|
2505
|
+
const barBase = this.getBarChartHorizontalOptions(categories, series, labelConfig, tooltipConfig, showLegend, true);
|
|
2506
|
+
if (barBase.yAxis) {
|
|
2507
|
+
const y = barBase.yAxis;
|
|
2508
|
+
const gr = barBase.grid;
|
|
2509
|
+
const defaultCategoryFormatter = (value, index) => {
|
|
2510
|
+
const sangriaBase = "\u2008\u2008\u2008\u2008\u2008\u2008\u2009";
|
|
2511
|
+
const lineLength = 35;
|
|
2512
|
+
const text = String(value ?? "");
|
|
2513
|
+
const prefix = `${index + 1} - `;
|
|
2514
|
+
const digitCount = String(index + 1).length;
|
|
2515
|
+
let extraRepeat = 0;
|
|
2516
|
+
if (digitCount === 2)
|
|
2517
|
+
extraRepeat = 2;
|
|
2518
|
+
else if (digitCount === 3)
|
|
2519
|
+
extraRepeat = 5;
|
|
2520
|
+
const sangria = sangriaBase + "\u2008".repeat(extraRepeat);
|
|
2521
|
+
const words = text.split(" ");
|
|
2522
|
+
const lines = [];
|
|
2523
|
+
let current = "";
|
|
2524
|
+
for (const w of words) {
|
|
2525
|
+
const test = current ? `${current} ${w}` : w;
|
|
2526
|
+
if (test.length <= lineLength)
|
|
2527
|
+
current = test;
|
|
2528
|
+
else {
|
|
2529
|
+
if (current)
|
|
2530
|
+
lines.push(current);
|
|
2531
|
+
current = w;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
if (current)
|
|
2535
|
+
lines.push(current);
|
|
2536
|
+
return prefix + lines.map((ln, i) => (i === 0 ? ln : `${sangria}${ln}`)).join("\n");
|
|
2537
|
+
};
|
|
2538
|
+
// y.inverse = true;
|
|
2539
|
+
// y.axisLabel = {
|
|
2540
|
+
// ...y.axisLabel,
|
|
2541
|
+
// color: Color.blue,
|
|
2542
|
+
// fontSize: 12,
|
|
2543
|
+
// width: categoryWidth,
|
|
2544
|
+
// overflow: "break",
|
|
2545
|
+
// align: "left",
|
|
2546
|
+
// verticalAlign: "middle",
|
|
2547
|
+
// margin: categoryWidth + 30,
|
|
2548
|
+
// lineHeight: 16,
|
|
2549
|
+
// formatter: categoryFormatter || defaultCategoryFormatter,
|
|
2550
|
+
// };
|
|
2551
|
+
gr.top = "0%";
|
|
2552
|
+
gr.left = -1 * categoryWidth + 60;
|
|
2553
|
+
gr.right = 20;
|
|
2554
|
+
gr.bottom = "0%";
|
|
2555
|
+
gr.containLabel = true;
|
|
2556
|
+
}
|
|
2557
|
+
barBase.series.forEach(serie => {
|
|
2558
|
+
serie.label = {
|
|
2559
|
+
...(serie.label || {}),
|
|
2560
|
+
formatter: labelConfig,
|
|
2561
|
+
};
|
|
2562
|
+
});
|
|
2563
|
+
return barBase;
|
|
2564
|
+
}
|
|
2565
|
+
/// LINE CHARTS
|
|
2566
|
+
/**
|
|
2567
|
+
*
|
|
2568
|
+
* @param categories - Array of categories for the x-axis
|
|
2569
|
+
* @param series - Array of series data, each containing name, value, and color
|
|
2570
|
+
* @param labelConfig - Optional label configuration for the lines
|
|
2571
|
+
* @param tooltipConfig - Optional tooltip configuration for the lines
|
|
2572
|
+
* @param showLegend - Optional flag to show the legend
|
|
2573
|
+
* @returns - EChartsOption - Configuration object for the line chart
|
|
2574
|
+
*/
|
|
2575
|
+
getLineChartOptions(categories, series, labelConfig, tooltipConfig, showLegend = false) {
|
|
2576
|
+
return {
|
|
2577
|
+
xAxis: this.getCategoryAxisConfiguration(categories),
|
|
2578
|
+
yAxis: this.getValueAxisConfiguration(true, true, true),
|
|
2579
|
+
series: [
|
|
2580
|
+
...series.map((item, seriesIndex) => ({
|
|
2581
|
+
type: "line",
|
|
2582
|
+
name: item.name,
|
|
2583
|
+
data: item.value,
|
|
2584
|
+
itemStyle: { color: item.color },
|
|
2585
|
+
symbol: "circle",
|
|
2586
|
+
symbolSize: 14,
|
|
2587
|
+
emphasis: {
|
|
2588
|
+
itemStyle: {
|
|
2589
|
+
color: item.color,
|
|
2590
|
+
borderColor: item.color + "40", // 40 ( hexadecimal ) = .25 ( decimal )
|
|
2591
|
+
borderWidth: 16,
|
|
2592
|
+
},
|
|
2593
|
+
},
|
|
2594
|
+
})),
|
|
2595
|
+
],
|
|
2596
|
+
tooltip: {
|
|
2597
|
+
trigger: "item",
|
|
2598
|
+
backgroundColor: "#FFFFFF",
|
|
2599
|
+
borderWidth: 2,
|
|
2600
|
+
textStyle: { fontSize: 12 },
|
|
2601
|
+
formatter: tooltipConfig,
|
|
2602
|
+
appendTo: "body ",
|
|
2603
|
+
},
|
|
2604
|
+
dataZoom: [
|
|
2605
|
+
{
|
|
2606
|
+
type: "inside", // inside | slider
|
|
2607
|
+
show: true,
|
|
2608
|
+
height: 12,
|
|
2609
|
+
bottom: 10,
|
|
2610
|
+
backgroundColor: "#ddd",
|
|
2611
|
+
borderColor: "transparent",
|
|
2612
|
+
fillerColor: "rgba(150, 150, 150, 0.5)",
|
|
2613
|
+
handleSize: "80%",
|
|
2614
|
+
handleStyle: {
|
|
2615
|
+
color: "#A0A0A0",
|
|
2616
|
+
borderColor: "transparent",
|
|
2617
|
+
shadowBlur: 2,
|
|
2618
|
+
shadowColor: "rgba(0, 0, 0, 0.2)",
|
|
2619
|
+
},
|
|
2620
|
+
showDataShadow: false,
|
|
2621
|
+
},
|
|
2622
|
+
{
|
|
2623
|
+
type: "inside",
|
|
2624
|
+
showDataShadow: false,
|
|
2625
|
+
},
|
|
2626
|
+
],
|
|
2627
|
+
legend: showLegend ? this.getLegendConfiguration() : undefined,
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
/// PIE CHARTS
|
|
2631
|
+
/**
|
|
2632
|
+
*
|
|
2633
|
+
* @param data - Array of series data, each containing name, value, and color
|
|
2634
|
+
* @param labelConfig - Optional label configuration
|
|
2635
|
+
* @param tooltipConfig - Optional tooltip configuration
|
|
2636
|
+
* @returns - EChartsOption - Configuration object for the pie
|
|
2637
|
+
*/
|
|
2638
|
+
getDoughnutPieOptions(data, labelConfig, tooltipConfig) {
|
|
2639
|
+
return {
|
|
2640
|
+
series: [
|
|
2641
|
+
{
|
|
2642
|
+
data: data.map(item => ({
|
|
2643
|
+
...item,
|
|
2644
|
+
itemStyle: { color: item.color },
|
|
2645
|
+
})),
|
|
2646
|
+
name: "Pie Chart",
|
|
2647
|
+
type: "pie",
|
|
2648
|
+
radius: ["40%", "70%"],
|
|
2649
|
+
avoidLabelOverlap: false,
|
|
2650
|
+
emphasis: {
|
|
2651
|
+
scale: true,
|
|
2652
|
+
},
|
|
2653
|
+
labelLine: {
|
|
2654
|
+
show: true,
|
|
2655
|
+
length: 15,
|
|
2656
|
+
length2: 20,
|
|
2657
|
+
},
|
|
2658
|
+
label: {
|
|
2659
|
+
show: true,
|
|
2660
|
+
position: "outside",
|
|
2661
|
+
color: Color.blue,
|
|
2662
|
+
fontSize: 14,
|
|
2663
|
+
formatter: labelConfig,
|
|
2664
|
+
},
|
|
2665
|
+
},
|
|
2666
|
+
],
|
|
2667
|
+
tooltip: {
|
|
2668
|
+
trigger: "item",
|
|
2669
|
+
formatter: tooltipConfig,
|
|
2670
|
+
appendTo: "body",
|
|
2671
|
+
// extraCssText: this.chartService.getTooltipCssText(),
|
|
2672
|
+
},
|
|
2673
|
+
legend: {
|
|
2674
|
+
orient: "horizontal", // 'horizontal | vertical'
|
|
2675
|
+
icon: "circle",
|
|
2676
|
+
bottom: 5,
|
|
2677
|
+
align: "auto",
|
|
2678
|
+
itemGap: 20,
|
|
2679
|
+
textStyle: { color: Color.blue, fontSize: 14 },
|
|
2680
|
+
},
|
|
2681
|
+
};
|
|
2682
|
+
}
|
|
2683
|
+
/**
|
|
2684
|
+
*
|
|
2685
|
+
* @param letter - text to show in the center of the pie
|
|
2686
|
+
* @param value - rate value
|
|
2687
|
+
* @param textSize - size of the letter
|
|
2688
|
+
* @param color - color of the letter and pie
|
|
2689
|
+
* @param total - total value for the pie (default is 100)
|
|
2690
|
+
* @returns
|
|
2691
|
+
*/
|
|
2692
|
+
getRateDoughnutPieOptions(letter, value, textSize, color, total = 100) {
|
|
2693
|
+
const data = [
|
|
2694
|
+
{ name: letter, value: value, itemStyle: { color: color } },
|
|
2695
|
+
{
|
|
2696
|
+
name: "placeholder",
|
|
2697
|
+
value: total - value,
|
|
2698
|
+
itemStyle: { color: Color.gray5 },
|
|
2699
|
+
},
|
|
2700
|
+
];
|
|
2701
|
+
return {
|
|
2702
|
+
tooltip: {
|
|
2703
|
+
trigger: "none",
|
|
2704
|
+
appendTo: "body",
|
|
2705
|
+
},
|
|
2706
|
+
series: [
|
|
2707
|
+
{
|
|
2708
|
+
name: "RateDoughnutPie",
|
|
2709
|
+
type: "pie",
|
|
2710
|
+
tooltip: {
|
|
2711
|
+
trigger: "none",
|
|
2712
|
+
},
|
|
2713
|
+
radius: ["80%", "60%"],
|
|
2714
|
+
data: data,
|
|
2715
|
+
startAngle: 0,
|
|
2716
|
+
selectedMode: false,
|
|
2717
|
+
silent: true,
|
|
2718
|
+
label: {
|
|
2719
|
+
show: true,
|
|
2720
|
+
formatter: letter,
|
|
2721
|
+
color: color,
|
|
2722
|
+
position: "center",
|
|
2723
|
+
fontWeight: "bold",
|
|
2724
|
+
fontSize: textSize,
|
|
2725
|
+
fontFamily: "Arial",
|
|
2726
|
+
lineHeight: textSize * -0.22,
|
|
2727
|
+
align: "center",
|
|
2728
|
+
verticalAlign: "middle",
|
|
2729
|
+
backgroundColor: "transparent",
|
|
2730
|
+
},
|
|
2731
|
+
},
|
|
2732
|
+
],
|
|
2733
|
+
};
|
|
2734
|
+
}
|
|
2735
|
+
/**
|
|
2736
|
+
* Semi doughnut gauge (half circle) with:
|
|
2737
|
+
* - Progress arc
|
|
2738
|
+
* - End dot
|
|
2739
|
+
* - Center letter
|
|
2740
|
+
*
|
|
2741
|
+
* @param letter - Text to show in the center
|
|
2742
|
+
* @param value - Current value
|
|
2743
|
+
* @param textSize - Center letter font size
|
|
2744
|
+
* @param color - Progress and end dot color
|
|
2745
|
+
* @param total - Max value (default 100)
|
|
2746
|
+
*/
|
|
2747
|
+
getRateSemiDoughnutOptions(letter, value, textSize, color, total = 100, bottomText) {
|
|
2748
|
+
const safeTotal = total > 0 ? total : 100;
|
|
2749
|
+
const safeValue = Math.max(0, Math.min(value, safeTotal));
|
|
2750
|
+
const START_ANGLE = 210;
|
|
2751
|
+
const END_ANGLE = -30;
|
|
2752
|
+
const THICKNESS = 11;
|
|
2753
|
+
const BACKGROUND_COLOR = "#D9D9E3";
|
|
2754
|
+
const TEXT_COLOR = "#4F5470";
|
|
2755
|
+
const MIN_LABEL = "0";
|
|
2756
|
+
const MAX_LABEL = String(safeTotal);
|
|
2757
|
+
const MIN_MAX_FONT_SIZE = 15;
|
|
2758
|
+
const RADIUS = "96%";
|
|
2759
|
+
const CENTER = ["50%", "50%"];
|
|
2760
|
+
const dotSizePx = THICKNESS + 5;
|
|
2761
|
+
const POINTER_LENGTH = "98%";
|
|
2762
|
+
const option = {
|
|
2763
|
+
tooltip: { trigger: "none", appendTo: "body" },
|
|
2764
|
+
series: [
|
|
2765
|
+
/* ================= GAUGE 1: PROGRESS ================= */
|
|
2766
|
+
{
|
|
2767
|
+
type: "gauge",
|
|
2768
|
+
radius: RADIUS,
|
|
2769
|
+
center: CENTER,
|
|
2770
|
+
startAngle: START_ANGLE,
|
|
2771
|
+
endAngle: END_ANGLE,
|
|
2772
|
+
min: 0,
|
|
2773
|
+
max: safeTotal,
|
|
2774
|
+
pointer: { show: false },
|
|
2775
|
+
progress: {
|
|
2776
|
+
show: true,
|
|
2777
|
+
roundCap: true,
|
|
2778
|
+
width: THICKNESS,
|
|
2779
|
+
itemStyle: { color },
|
|
2780
|
+
},
|
|
2781
|
+
axisLine: {
|
|
2782
|
+
roundCap: true,
|
|
2783
|
+
lineStyle: {
|
|
2784
|
+
width: THICKNESS,
|
|
2785
|
+
color: [[1, BACKGROUND_COLOR]],
|
|
2786
|
+
},
|
|
2787
|
+
},
|
|
2788
|
+
axisTick: { show: false },
|
|
2789
|
+
splitLine: { show: false },
|
|
2790
|
+
axisLabel: { show: false },
|
|
2791
|
+
detail: {
|
|
2792
|
+
show: true,
|
|
2793
|
+
offsetCenter: [0, "8%"],
|
|
2794
|
+
formatter: () => (bottomText ? `{letter|${letter}}\n{bottom|${bottomText}}` : `{letter|${letter}}`),
|
|
2795
|
+
rich: {
|
|
2796
|
+
letter: {
|
|
2797
|
+
fontSize: textSize,
|
|
2798
|
+
fontWeight: 700,
|
|
2799
|
+
color: TEXT_COLOR,
|
|
2800
|
+
fontFamily: "Lato, sans-serif",
|
|
2801
|
+
lineHeight: textSize + 2,
|
|
2802
|
+
align: "center",
|
|
2803
|
+
},
|
|
2804
|
+
bottom: {
|
|
2805
|
+
fontSize: 16,
|
|
2806
|
+
fontWeight: 500,
|
|
2807
|
+
color: TEXT_COLOR,
|
|
2808
|
+
fontFamily: "Lato, sans-serif",
|
|
2809
|
+
lineHeight: 22,
|
|
2810
|
+
align: "center",
|
|
2811
|
+
},
|
|
2812
|
+
},
|
|
2813
|
+
},
|
|
2814
|
+
data: [
|
|
2815
|
+
{
|
|
2816
|
+
value: safeValue,
|
|
2817
|
+
name: "0",
|
|
2818
|
+
title: {
|
|
2819
|
+
show: true,
|
|
2820
|
+
formatter: () => MIN_LABEL,
|
|
2821
|
+
offsetCenter: ["-80%", "66%"],
|
|
2822
|
+
fontSize: MIN_MAX_FONT_SIZE,
|
|
2823
|
+
color: TEXT_COLOR,
|
|
2824
|
+
},
|
|
2825
|
+
},
|
|
2826
|
+
{
|
|
2827
|
+
value: safeValue,
|
|
2828
|
+
name: "100",
|
|
2829
|
+
title: {
|
|
2830
|
+
show: true,
|
|
2831
|
+
formatter: () => MAX_LABEL,
|
|
2832
|
+
offsetCenter: ["80%", "66%"],
|
|
2833
|
+
fontSize: MIN_MAX_FONT_SIZE,
|
|
2834
|
+
color: TEXT_COLOR,
|
|
2835
|
+
},
|
|
2836
|
+
},
|
|
2837
|
+
],
|
|
2838
|
+
},
|
|
2839
|
+
/* ================= GAUGE 2: END DOT ================= */
|
|
2840
|
+
{
|
|
2841
|
+
type: "gauge",
|
|
2842
|
+
radius: RADIUS,
|
|
2843
|
+
center: CENTER,
|
|
2844
|
+
startAngle: START_ANGLE,
|
|
2845
|
+
endAngle: END_ANGLE,
|
|
2846
|
+
min: 0,
|
|
2847
|
+
max: safeTotal,
|
|
2848
|
+
axisLine: { show: false },
|
|
2849
|
+
progress: { show: false },
|
|
2850
|
+
splitLine: { show: false },
|
|
2851
|
+
axisTick: { show: false },
|
|
2852
|
+
axisLabel: { show: false },
|
|
2853
|
+
detail: { show: false },
|
|
2854
|
+
pointer: {
|
|
2855
|
+
show: true,
|
|
2856
|
+
icon: "circle",
|
|
2857
|
+
length: POINTER_LENGTH,
|
|
2858
|
+
width: dotSizePx,
|
|
2859
|
+
itemStyle: {
|
|
2860
|
+
color,
|
|
2861
|
+
borderWidth: 0,
|
|
2862
|
+
},
|
|
2863
|
+
},
|
|
2864
|
+
data: [{ value: safeValue }],
|
|
2865
|
+
},
|
|
2866
|
+
],
|
|
2867
|
+
};
|
|
2868
|
+
return option;
|
|
2869
|
+
}
|
|
2870
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: EchartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2871
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: EchartService, providedIn: "root" });
|
|
2872
|
+
}
|
|
2873
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: EchartService, decorators: [{
|
|
2874
|
+
type: Injectable,
|
|
2875
|
+
args: [{
|
|
2876
|
+
providedIn: "root",
|
|
2877
|
+
}]
|
|
2878
|
+
}] });
|
|
2879
|
+
|
|
2880
|
+
class RequestCacheService {
|
|
2881
|
+
cache = new Map();
|
|
2882
|
+
maxEntries = 300;
|
|
2883
|
+
defaultTtlMs = 5 * 60 * 1000;
|
|
2884
|
+
getOrSet(key, factory, ttlMs = this.defaultTtlMs) {
|
|
2885
|
+
this.removeExpiredEntries();
|
|
2886
|
+
const now = Date.now();
|
|
2887
|
+
const cached = this.cache.get(key);
|
|
2888
|
+
if (cached && cached.expiresAt > now) {
|
|
2889
|
+
return cached.value$;
|
|
2890
|
+
}
|
|
2891
|
+
const value$ = factory().pipe(shareReplay(1), catchError(error => {
|
|
2892
|
+
this.cache.delete(key);
|
|
2893
|
+
return throwError(() => error);
|
|
2894
|
+
}));
|
|
2895
|
+
this.cache.set(key, { value$, expiresAt: now + Math.max(ttlMs, 0) });
|
|
2896
|
+
this.enforceCapacityLimit();
|
|
2897
|
+
return value$;
|
|
2898
|
+
}
|
|
2899
|
+
invalidate(prefix) {
|
|
2900
|
+
if (!prefix) {
|
|
2901
|
+
this.cache.clear();
|
|
2902
|
+
return;
|
|
2903
|
+
}
|
|
2904
|
+
for (const key of this.cache.keys()) {
|
|
2905
|
+
if (key.startsWith(prefix)) {
|
|
2906
|
+
this.cache.delete(key);
|
|
2907
|
+
}
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
removeExpiredEntries() {
|
|
2911
|
+
const now = Date.now();
|
|
2912
|
+
for (const [key, entry] of this.cache.entries()) {
|
|
2913
|
+
if (entry.expiresAt <= now) {
|
|
2914
|
+
this.cache.delete(key);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
}
|
|
2918
|
+
enforceCapacityLimit() {
|
|
2919
|
+
while (this.cache.size > this.maxEntries) {
|
|
2920
|
+
const oldestKey = this.cache.keys().next().value;
|
|
2921
|
+
if (!oldestKey)
|
|
2922
|
+
break;
|
|
2923
|
+
this.cache.delete(oldestKey);
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: RequestCacheService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2927
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: RequestCacheService, providedIn: "root" });
|
|
2928
|
+
}
|
|
2929
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: RequestCacheService, decorators: [{
|
|
2930
|
+
type: Injectable,
|
|
2931
|
+
args: [{ providedIn: "root" }]
|
|
2932
|
+
}] });
|
|
2933
|
+
|
|
2934
|
+
class TruncatePipe {
|
|
2935
|
+
transform(value, size = 15, original = false) {
|
|
2936
|
+
if (!value)
|
|
2937
|
+
return value;
|
|
2938
|
+
if (value.length <= size)
|
|
2939
|
+
return value;
|
|
2940
|
+
let truncateString = value.substring(0, size);
|
|
2941
|
+
return !original ? `${truncateString}...` : truncateString.toUpperCase();
|
|
2942
|
+
}
|
|
2943
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2944
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.23", ngImport: i0, type: TruncatePipe, isStandalone: true, name: "truncate" });
|
|
2945
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TruncatePipe, providedIn: "root" });
|
|
2946
|
+
}
|
|
2947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.23", ngImport: i0, type: TruncatePipe, decorators: [{
|
|
2948
|
+
type: Injectable,
|
|
2949
|
+
args: [{ providedIn: "root" }]
|
|
2950
|
+
}, {
|
|
2951
|
+
type: Pipe,
|
|
2952
|
+
args: [{
|
|
2953
|
+
name: "truncate",
|
|
2954
|
+
}]
|
|
2955
|
+
}] });
|
|
2956
|
+
|
|
2957
|
+
class PageInformation {
|
|
2958
|
+
pageTitle;
|
|
2959
|
+
pageRoot;
|
|
2960
|
+
constructor(pageTitle, pageRoot) {
|
|
2961
|
+
this.pageTitle = pageTitle;
|
|
2962
|
+
this.pageRoot = pageRoot;
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// Public API Surface of intelica-library-project
|
|
2967
|
+
// Components
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Generated bundle index. Do not edit.
|
|
2971
|
+
*/
|
|
2972
|
+
|
|
2973
|
+
export { ColumnComponent, ColumnGroupComponent, EchartComponent, EchartService, ElementService, FormatAmountPipe, FormatCellPipe, OrderConstants, PageElementService, PageInformation, RequestCacheService, RowResumenComponent, SearchComponent, SearchInputEnum, SharedService, SkeletonTableComponent, SortingComponent, TableComponent, TableFetchComponent, TruncatePipe, darkenColor };
|
|
2974
|
+
//# sourceMappingURL=intelica-library-project.mjs.map
|