ln-20-lib-components 0.0.35 → 0.0.36
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/ln-20-lib-components-ln-20-lib-components-pJLg_v6U.mjs +3349 -0
- package/fesm2022/ln-20-lib-components-ln-20-lib-components-pJLg_v6U.mjs.map +1 -0
- package/fesm2022/ln-20-lib-components-selected-items-management.component-qjE14pdH.mjs +55 -0
- package/fesm2022/ln-20-lib-components-selected-items-management.component-qjE14pdH.mjs.map +1 -0
- package/fesm2022/ln-20-lib-components.mjs +1 -1
- package/lib/components/origin/pick-list/components/container-elements/container-elements.component.d.ts +1 -1
- package/lib/components/origin/pick-list/pick-list.component.d.ts +2 -2
- package/lib/components/prime-ng/table-ng/table-ng.component.d.ts +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,3349 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Component, model, input, computed, output, forwardRef, ChangeDetectionStrategy, effect, signal, ContentChildren, inject, Pipe, viewChild, ContentChild, ViewChild } from '@angular/core';
|
|
3
|
+
import { toObservable, takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
4
|
+
import * as i1 from '@angular/forms';
|
|
5
|
+
import { ReactiveFormsModule, NG_VALUE_ACCESSOR, FormsModule, NonNullableFormBuilder, FormGroup } from '@angular/forms';
|
|
6
|
+
import { switchMap, debounceTime, filter, map, distinctUntilChanged, Subject } from 'rxjs';
|
|
7
|
+
import * as i1$1 from '@angular/common';
|
|
8
|
+
import { NgClass, CommonModule } from '@angular/common';
|
|
9
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
10
|
+
import * as i2 from 'primeng/datepicker';
|
|
11
|
+
import { DatePickerModule } from 'primeng/datepicker';
|
|
12
|
+
import { IftaLabelModule } from 'primeng/iftalabel';
|
|
13
|
+
import * as i6 from 'primeng/inputotp';
|
|
14
|
+
import { InputOtpModule } from 'primeng/inputotp';
|
|
15
|
+
import * as i3 from 'primeng/multiselect';
|
|
16
|
+
import { MultiSelectModule } from 'primeng/multiselect';
|
|
17
|
+
import * as i4 from 'primeng/select';
|
|
18
|
+
import { SelectModule } from 'primeng/select';
|
|
19
|
+
import * as i5 from 'primeng/togglebutton';
|
|
20
|
+
import { ToggleButtonModule } from 'primeng/togglebutton';
|
|
21
|
+
import * as i7 from 'primeng/toggleswitch';
|
|
22
|
+
import { ToggleSwitchModule } from 'primeng/toggleswitch';
|
|
23
|
+
import * as i10 from 'primeng/tooltip';
|
|
24
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
25
|
+
import * as i8 from 'primeng/inputnumber';
|
|
26
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
|
27
|
+
import * as i9 from 'primeng/textarea';
|
|
28
|
+
import { TextareaModule } from 'primeng/textarea';
|
|
29
|
+
import * as i2$1 from 'primeng/inputtext';
|
|
30
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
31
|
+
import { InputMaskModule } from 'primeng/inputmask';
|
|
32
|
+
import * as i9$1 from 'primeng/knob';
|
|
33
|
+
import { KnobModule } from 'primeng/knob';
|
|
34
|
+
import * as i11 from 'primeng/chip';
|
|
35
|
+
import { ChipModule } from 'primeng/chip';
|
|
36
|
+
import * as i4$1 from 'primeng/api';
|
|
37
|
+
import { PrimeTemplate, FilterService } from 'primeng/api';
|
|
38
|
+
import * as i1$2 from 'primeng/button';
|
|
39
|
+
import { ButtonModule } from 'primeng/button';
|
|
40
|
+
import jsPDF from 'jspdf';
|
|
41
|
+
import autoTable from 'jspdf-autotable';
|
|
42
|
+
import * as i2$2 from 'primeng/table';
|
|
43
|
+
import { TableModule } from 'primeng/table';
|
|
44
|
+
import * as XLSX from 'xlsx';
|
|
45
|
+
import * as i1$3 from 'primeng/badge';
|
|
46
|
+
import { BadgeModule } from 'primeng/badge';
|
|
47
|
+
import * as i1$4 from 'primeng/toolbar';
|
|
48
|
+
import { ToolbarModule } from 'primeng/toolbar';
|
|
49
|
+
import { DialogService, DynamicDialogRef, DynamicDialogConfig } from 'primeng/dynamicdialog';
|
|
50
|
+
import * as i1$5 from 'primeng/speeddial';
|
|
51
|
+
import { SpeedDialModule } from 'primeng/speeddial';
|
|
52
|
+
|
|
53
|
+
class LibComponentsService {
|
|
54
|
+
constructor() { }
|
|
55
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LibComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
56
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LibComponentsService, providedIn: 'root' });
|
|
57
|
+
}
|
|
58
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LibComponentsService, decorators: [{
|
|
59
|
+
type: Injectable,
|
|
60
|
+
args: [{
|
|
61
|
+
providedIn: 'root'
|
|
62
|
+
}]
|
|
63
|
+
}], ctorParameters: () => [] });
|
|
64
|
+
|
|
65
|
+
class LibComponentsComponent {
|
|
66
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LibComponentsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
67
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: LibComponentsComponent, isStandalone: true, selector: "lib-lib-components", ngImport: i0, template: `
|
|
68
|
+
<p>
|
|
69
|
+
lib-components works!
|
|
70
|
+
</p>
|
|
71
|
+
`, isInline: true, styles: [""] });
|
|
72
|
+
}
|
|
73
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LibComponentsComponent, decorators: [{
|
|
74
|
+
type: Component,
|
|
75
|
+
args: [{ selector: 'lib-lib-components', imports: [], template: `
|
|
76
|
+
<p>
|
|
77
|
+
lib-components works!
|
|
78
|
+
</p>
|
|
79
|
+
` }]
|
|
80
|
+
}] });
|
|
81
|
+
|
|
82
|
+
var ETypeInput;
|
|
83
|
+
(function (ETypeInput) {
|
|
84
|
+
ETypeInput["TEXT"] = "text";
|
|
85
|
+
ETypeInput["PASSWORD"] = "password";
|
|
86
|
+
ETypeInput["EMAIL"] = "email";
|
|
87
|
+
ETypeInput["EMAIL_PASSWORD"] = "email-password";
|
|
88
|
+
ETypeInput["NUMBER"] = "number";
|
|
89
|
+
ETypeInput["DATE"] = "date";
|
|
90
|
+
ETypeInput["TIME"] = "time";
|
|
91
|
+
ETypeInput["DATETIME_LOCAL"] = "datetime-local";
|
|
92
|
+
ETypeInput["SEARCH"] = "search";
|
|
93
|
+
ETypeInput["TEL"] = "tel";
|
|
94
|
+
ETypeInput["URL"] = "url";
|
|
95
|
+
ETypeInput["COLOR"] = "color";
|
|
96
|
+
ETypeInput["MONTH"] = "month";
|
|
97
|
+
ETypeInput["WEEK"] = "week";
|
|
98
|
+
ETypeInput["FILE"] = "file";
|
|
99
|
+
ETypeInput["CHECKBOX"] = "checkbox";
|
|
100
|
+
ETypeInput["RADIO"] = "radio";
|
|
101
|
+
ETypeInput["RANGE"] = "range";
|
|
102
|
+
ETypeInput["HIDDEN"] = "hidden";
|
|
103
|
+
ETypeInput["TEXTAREA"] = "textarea";
|
|
104
|
+
ETypeInput["SELECT"] = "select";
|
|
105
|
+
ETypeInput["MULTISELECT"] = "multiselect";
|
|
106
|
+
ETypeInput["AUTOCOMPLETE"] = "autocomplete";
|
|
107
|
+
ETypeInput["SWITCH"] = "switch";
|
|
108
|
+
ETypeInput["CALENDAR"] = "calendar";
|
|
109
|
+
ETypeInput["DROPDOWN"] = "dropdown";
|
|
110
|
+
ETypeInput["CHIPS"] = "chips";
|
|
111
|
+
ETypeInput["TOGGLE"] = "toggle";
|
|
112
|
+
ETypeInput["OTP"] = "otp";
|
|
113
|
+
ETypeInput["CURRENCY"] = "currency";
|
|
114
|
+
ETypeInput["KNOB"] = "knob";
|
|
115
|
+
ETypeInput["BADGE"] = "badge";
|
|
116
|
+
ETypeInput["DECIMAL"] = "decimal";
|
|
117
|
+
ETypeInput["IMAGE"] = "image";
|
|
118
|
+
ETypeInput["COMPONENT"] = "component";
|
|
119
|
+
})(ETypeInput || (ETypeInput = {}));
|
|
120
|
+
|
|
121
|
+
class DisabledContainerComponent {
|
|
122
|
+
disabled = model(false);
|
|
123
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DisabledContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
124
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.17", type: DisabledContainerComponent, isStandalone: true, selector: "lib-disabled-container", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange" }, ngImport: i0, template: "<fieldset [disabled]=\"disabled()\" class=\"disabled-container\">\r\n <ng-content></ng-content>\r\n</fieldset>\r\n", styles: [".disabled-container{border:none;margin:0;padding:0;min-width:0}.disabled-container:disabled{opacity:.6;cursor:not-allowed}.disabled-container:disabled *{pointer-events:none}\n"] });
|
|
125
|
+
}
|
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DisabledContainerComponent, decorators: [{
|
|
127
|
+
type: Component,
|
|
128
|
+
args: [{ selector: 'lib-disabled-container', imports: [], template: "<fieldset [disabled]=\"disabled()\" class=\"disabled-container\">\r\n <ng-content></ng-content>\r\n</fieldset>\r\n", styles: [".disabled-container{border:none;margin:0;padding:0;min-width:0}.disabled-container:disabled{opacity:.6;cursor:not-allowed}.disabled-container:disabled *{pointer-events:none}\n"] }]
|
|
129
|
+
}] });
|
|
130
|
+
|
|
131
|
+
class CustomInputComponent {
|
|
132
|
+
controlData = input.required();
|
|
133
|
+
controlUpperName = computed(() => this.controlData().controlName.toLocaleUpperCase());
|
|
134
|
+
showPassword = false;
|
|
135
|
+
output = output();
|
|
136
|
+
onChange = (_value) => { };
|
|
137
|
+
constructor() { }
|
|
138
|
+
writeValue(value) {
|
|
139
|
+
if (value !== this.controlData().control.value) {
|
|
140
|
+
this.controlData().control.setValue(value, { emitEvent: false });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
get showLabel() {
|
|
144
|
+
return !this.controlData().hideLabel;
|
|
145
|
+
}
|
|
146
|
+
get inputTypesEnum() {
|
|
147
|
+
return ETypeInput;
|
|
148
|
+
}
|
|
149
|
+
onCheckboxChange(event, control) {
|
|
150
|
+
const input = event.target;
|
|
151
|
+
const isChecked = input.checked;
|
|
152
|
+
control.setValue(isChecked);
|
|
153
|
+
}
|
|
154
|
+
registerOnChange(fn) {
|
|
155
|
+
this.onChange = fn;
|
|
156
|
+
}
|
|
157
|
+
onBlur() {
|
|
158
|
+
this.controlData().onBlur?.();
|
|
159
|
+
}
|
|
160
|
+
onFocus() {
|
|
161
|
+
this.controlData().onFocus?.();
|
|
162
|
+
}
|
|
163
|
+
onTouched = () => { };
|
|
164
|
+
registerOnTouched(fn) {
|
|
165
|
+
this.onTouched = fn;
|
|
166
|
+
}
|
|
167
|
+
// setDisabledState(isDisabled: boolean): void {
|
|
168
|
+
// if (isDisabled) {
|
|
169
|
+
// this.controlData().control.disable()
|
|
170
|
+
// } else {
|
|
171
|
+
// this.controlData().control.enable()
|
|
172
|
+
// }
|
|
173
|
+
// }
|
|
174
|
+
generateUniqueId(baseString) {
|
|
175
|
+
const timestamp = new Date().getTime();
|
|
176
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
177
|
+
return `${baseString}-${timestamp}-${random}`;
|
|
178
|
+
}
|
|
179
|
+
togglePasswordVisibility() {
|
|
180
|
+
this.showPassword = !this.showPassword;
|
|
181
|
+
}
|
|
182
|
+
onSelectChange() {
|
|
183
|
+
this.output.emit(this.controlData());
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Sincroniza el valor del input visible con el input oculto de password
|
|
187
|
+
* para mantener ambos actualizados
|
|
188
|
+
*/
|
|
189
|
+
syncPasswordAutofill(event) {
|
|
190
|
+
const visibleInput = event.target;
|
|
191
|
+
const currentComponent = visibleInput.closest('lib-custom-input');
|
|
192
|
+
if (!currentComponent)
|
|
193
|
+
return;
|
|
194
|
+
const hiddenInput = currentComponent.querySelector('input[type="password"][id^="password-autofill-hidden-"]');
|
|
195
|
+
if (hiddenInput && hiddenInput.value !== visibleInput.value) {
|
|
196
|
+
hiddenInput.value = visibleInput.value;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Maneja el autocompletado cuando el navegador llena el input oculto de password.
|
|
201
|
+
* Actualiza el input visible y el FormControl.
|
|
202
|
+
*/
|
|
203
|
+
onPasswordAutofillHidden(event) {
|
|
204
|
+
const hiddenInput = event.target;
|
|
205
|
+
const passwordValue = hiddenInput.value;
|
|
206
|
+
if (!passwordValue)
|
|
207
|
+
return;
|
|
208
|
+
// Buscar el input visible de password en el mismo componente
|
|
209
|
+
const currentComponent = hiddenInput.closest('lib-custom-input');
|
|
210
|
+
if (!currentComponent)
|
|
211
|
+
return;
|
|
212
|
+
const visibleInput = currentComponent.querySelector('input[type="password"]:not([id^="password-autofill-hidden-"]), input[type="text"][class*="custom-password"]');
|
|
213
|
+
if (visibleInput && visibleInput.value !== passwordValue) {
|
|
214
|
+
// Actualizar el input visible
|
|
215
|
+
visibleInput.value = passwordValue;
|
|
216
|
+
// Actualizar el FormControl
|
|
217
|
+
this.controlData().control.setValue(passwordValue, { emitEvent: true });
|
|
218
|
+
// Disparar eventos para que Angular Forms lo detecte
|
|
219
|
+
visibleInput.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }));
|
|
220
|
+
visibleInput.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Maneja el autocompletado del password cuando el navegador llena automáticamente
|
|
225
|
+
* el campo de password oculto en EMAIL_PASSWORD. Busca el siguiente campo de password
|
|
226
|
+
* en el formulario y actualiza su FormControl directamente.
|
|
227
|
+
*/
|
|
228
|
+
onPasswordAutofill(event) {
|
|
229
|
+
const passwordInput = event.target;
|
|
230
|
+
const passwordValue = passwordInput.value;
|
|
231
|
+
if (!passwordValue)
|
|
232
|
+
return;
|
|
233
|
+
// Buscar el formulario padre
|
|
234
|
+
let parent = passwordInput.parentElement;
|
|
235
|
+
let formElement = null;
|
|
236
|
+
for (let i = 0; i < 6 && parent; i++) {
|
|
237
|
+
if (parent.tagName === 'FORM') {
|
|
238
|
+
formElement = parent;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
parent = parent.parentElement;
|
|
242
|
+
}
|
|
243
|
+
if (!formElement)
|
|
244
|
+
return;
|
|
245
|
+
// Buscar el componente lib-custom-input actual (EMAIL_PASSWORD)
|
|
246
|
+
const currentComponent = passwordInput.closest('lib-custom-input');
|
|
247
|
+
if (!currentComponent)
|
|
248
|
+
return;
|
|
249
|
+
// Buscar todos los componentes lib-custom-input en el formulario
|
|
250
|
+
const allCustomInputs = formElement.querySelectorAll('lib-custom-input');
|
|
251
|
+
const currentIndex = Array.from(allCustomInputs).indexOf(currentComponent);
|
|
252
|
+
// Buscar el siguiente componente después del actual que tenga un campo de password
|
|
253
|
+
for (let i = currentIndex + 1; i < allCustomInputs.length; i++) {
|
|
254
|
+
const nextComponent = allCustomInputs[i];
|
|
255
|
+
// Buscar el input de password dentro del componente siguiente
|
|
256
|
+
const passwordField = nextComponent.querySelector('input[type="password"]:not([id="password-autofill-helper"])');
|
|
257
|
+
if (passwordField) {
|
|
258
|
+
// Actualizar el valor directamente en el input
|
|
259
|
+
// y disparar eventos para que Angular Forms lo detecte
|
|
260
|
+
passwordField.value = passwordValue;
|
|
261
|
+
passwordField.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }));
|
|
262
|
+
passwordField.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
|
|
263
|
+
// Forzar la actualización después de un breve delay
|
|
264
|
+
// para asegurar que Angular Forms procese el cambio
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
if (passwordField.value !== passwordValue) {
|
|
267
|
+
passwordField.value = passwordValue;
|
|
268
|
+
passwordField.dispatchEvent(new Event('input', { bubbles: true }));
|
|
269
|
+
}
|
|
270
|
+
}, 50);
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
276
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: CustomInputComponent, isStandalone: true, selector: "lib-custom-input", inputs: { controlData: { classPropertyName: "controlData", publicName: "controlData", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { output: "output" }, providers: [{
|
|
277
|
+
provide: NG_VALUE_ACCESSOR,
|
|
278
|
+
useExisting: forwardRef(() => CustomInputComponent),
|
|
279
|
+
multi: true
|
|
280
|
+
}], ngImport: i0, template: "@let localControl = controlData().control;\r\n@let placeholder = controlData().label || controlUpperName();\r\n@let name = controlData().controlName;\r\n@let typeInput = controlData().typeInput;\r\n@let readonly = controlData().readonly || false;\r\n@let dateConfig = controlData().dateConfig;\r\n@let multiSelectConfig = controlData().multiSelectConfig;\r\n@let selectConfig = controlData().selectConfig;\r\n@let toggleConfig = controlData().toggleConfig;\r\n@let textareaConfig = controlData().textareaConfig;\r\n@let currencyConfig = controlData().currencyConfig;\r\n@let decimalConfig = controlData().decimalConfig;\r\n@let autoFocus = controlData().autoFocus ?? false;\r\n<div class=\"flex flex-col gap-1 \">\r\n <lib-disabled-container [disabled]=\"readonly\">\r\n\r\n <p style=\"font-size: 12px; letter-spacing: 0.5px;\" class=\"text-sm text-gray-600 dark:text-gray-300 truncate\"\r\n [pTooltip]=\"placeholder\" tooltipPosition=\"top\" [showDelay]=\"300\">\r\n {{ placeholder }}\r\n </p>\r\n @switch (typeInput) {\r\n @case (inputTypesEnum.EMAIL_PASSWORD) {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [name]=\"name\"\r\n type=\"email\" [readOnly]=\"readonly\" autocomplete=\"email\" autocorrect=\"on\" autocapitalize=\"on\"\r\n spellcheck=\"true\" [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n <input type=\"password\" name=\"password\" id=\"password-autofill-helper\" autocomplete=\"current-password\" tabindex=\"-1\"\r\n style=\"position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;\"\r\n aria-hidden=\"true\"\r\n (input)=\"onPasswordAutofill($event)\" />\r\n }\r\n @case (inputTypesEnum.PASSWORD) {\r\n <!-- Input oculto siempre de tipo password para el autocompletado del navegador -->\r\n <input \r\n type=\"password\" \r\n name=\"password-autofill\"\r\n [id]=\"'password-autofill-hidden-' + generateUniqueId(name)\"\r\n autocomplete=\"current-password\" \r\n tabindex=\"-1\"\r\n style=\"position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;\"\r\n aria-hidden=\"true\"\r\n [value]=\"localControl.value || ''\"\r\n (input)=\"onPasswordAutofillHidden($event)\" />\r\n <div class=\"relative\">\r\n <input [readOnly]=\"readonly || false\" [id]=\"generateUniqueId(name)\" [type]=\"showPassword ? 'text' : 'password'\"\r\n autocomplete=\"password\" autocorrect=\"on\" autocapitalize=\"on\" spellcheck=\"true\"\r\n class=\"custom-password w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200\"\r\n aria-describedby=\"password-help\" [formControl]=\"localControl\" \r\n (input)=\"syncPasswordAutofill($event)\" />\r\n <button type=\"button\"\r\n class=\"custom-password-toggle absolute inset-y-0 right-0 flex items-center justify-center w-12 h-full text-gray-400 transition-colors duration-200 ease-in-out hover:text-gray-600 focus:outline-none focus:text-gray-600 active:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 dark:focus:text-gray-300\"\r\n (click)=\"togglePasswordVisibility()\" [attr.aria-label]=\"\r\n showPassword ? 'Ocultar contrase\u00F1a' : 'Mostrar contrase\u00F1a'\r\n \">\r\n <i class=\"fas text-lg transition-all duration-200 ease-in-out\" [ngClass]=\"{\r\n 'fa-solid fa-eye': !showPassword,\r\n 'fa-solid fa-eye-slash': showPassword,\r\n }\"></i>\r\n </button>\r\n </div>\r\n }\r\n @case (inputTypesEnum.EMAIL) {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [name]=\"name\"\r\n [type]=\"typeInput\" [readOnly]=\"readonly\" autocomplete=\"email\" autocorrect=\"on\" autocapitalize=\"on\" spellcheck=\"true\"\r\n [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n }\r\n @case (inputTypesEnum.CURRENCY) {\r\n <p-inputnumber [autofocus]=\"autoFocus ?? false\" [formControl]=\"localControl\" (onFocus)=\"onFocus()\" (onBlur)=\"onBlur()\" (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" mode=\"currency\"\r\n [currency]=\"currencyConfig?.currency ?? 'USD'\" [locale]=\"currencyConfig?.locale ?? 'es-CO'\" [minFractionDigits]=\"currencyConfig?.minFractionDigits ?? 2\"\r\n [maxFractionDigits]=\"currencyConfig?.maxFractionDigits ?? 2\" [readonly]=\"readonly\" [disabled]=\"readonly\" />\r\n }\r\n @case (inputTypesEnum.DATE) {\r\n <lib-disabled-container [disabled]=\"readonly\">\r\n <p-datepicker [formControl]=\"localControl\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\"\r\n [maxDate]=\"dateConfig?.maxDate || null\" [minDate]=\"dateConfig?.minDate || null\" class=\"custom-datepicker\"\r\n appendTo=\"body\" />\r\n </lib-disabled-container>\r\n }\r\n @case (inputTypesEnum.TOGGLE) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-togglebutton [formControl]=\"localControl\" [onLabel]=\"toggleConfig?.onLabel || 'Si'\"\r\n [offLabel]=\"toggleConfig?.offLabel || 'No'\" class=\"custom-toggle\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.MULTISELECT) {\r\n <p-multiselect [filter]=\"true\" [options]=\"multiSelectConfig?.options\" [formControl]=\"localControl\"\r\n [optionLabel]=\"multiSelectConfig?.optionLabel ?? 'name'\" placeholder=\"\" [maxSelectedLabels]=\"3\"\r\n class=\"custom-multiselect\" appendTo=\"body\" />\r\n }\r\n @case (inputTypesEnum.SELECT) {\r\n <p-select [filter]=\"true\" [options]=\"selectConfig?.options\" [formControl]=\"localControl\"\r\n [optionLabel]=\"selectConfig?.optionLabel ?? 'name'\" placeholder=\"\" class=\"custom-select\"\r\n (onChange)=\"onSelectChange()\" appendTo=\"body\" [disabled]=\"readonly\" [readonly]=\"readonly\" [styleClass]=\"\r\n (localControl.invalid && (localControl.dirty || localControl.touched) ? 'border-red-500 focus:ring-red-500 ' : '') +\r\n (readonly ? 'bg-gray-100 cursor-not-allowed' : '')\r\n \" />\r\n }\r\n \r\n @case (inputTypesEnum.CHECKBOX) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <input [id]=\"generateUniqueId(name)\" [readOnly]=\"readonly\" [type]=\"typeInput\" [checked]=\"localControl.value\"\r\n (change)=\"onCheckboxChange($event, localControl)\"\r\n class=\"custom-checkbox h-5 w-5 border-2 border-gray-300 dark:border-transparent rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n [formControl]=\"localControl\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.OTP) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-inputotp [id]=\"generateUniqueId(name)\" (onBlur)=\"onTouched()\" [mask]=\"controlData().otpConfig?.mask ?? false\"\r\n [length]=\"controlData().otpConfig?.length ?? 6\" [integerOnly]=\"controlData().otpConfig?.integerOnly ?? false\"\r\n class=\"custom-otp border-2 border-gray-300 dark:border-transparent rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n [formControl]=\"localControl\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.SWITCH) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-toggleswitch [id]=\"generateUniqueId(name)\" [formControl]=\"localControl\"\r\n class=\"custom-switch border-2 border-gray-300 dark:border-transparent rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n (change)=\"onCheckboxChange($event, localControl)\">\r\n <ng-template #handle let-checked=\"checked\">\r\n <span class=\"text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200 rounded-full px-1\">\r\n @if (checked) {\r\n Si\r\n }\r\n @else {\r\n No\r\n }\r\n </span>\r\n </ng-template>\r\n </p-toggleswitch>\r\n </div>\r\n }\r\n @case (inputTypesEnum.DECIMAL) {\r\n <p-inputnumber [autofocus]=\"autoFocus ?? false\" [formControl]=\"localControl\" (onBlur)=\"onBlur()\" (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" mode=\"decimal\"\r\n (onFocus)=\"onFocus()\"\r\n [locale]=\"'es-CO'\" [minFractionDigits]=\"decimalConfig?.minFractionDigits ?? 2\" [maxFractionDigits]=\"decimalConfig?.maxFractionDigits ?? 2\" [useGrouping]=\"decimalConfig?.useGrouping ?? true\" [readonly]=\"readonly\" [disabled]=\"readonly\" />\r\n }\r\n @case (inputTypesEnum.TEXTAREA) {\r\n <textarea pTextarea [formControl]=\"localControl\" [rows]=\"textareaConfig?.rows ?? 3\"\r\n [cols]=\"textareaConfig?.cols ?? 30\" [autoResize]=\"true\" [variant]=\"textareaConfig?.variant ?? 'outlined'\"\r\n (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" [readonly]=\"readonly\" autocomplete=\"off\" autocorrect=\"off\"\r\n autocapitalize=\"off\" spellcheck=\"false\"\r\n class=\"custom-textarea w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\"></textarea>\r\n }\r\n @default {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [type]=\"typeInput\"\r\n [readOnly]=\"readonly\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n }\r\n }\r\n </lib-disabled-container>\r\n\r\n</div>\r\n\r\n@if (localControl.invalid && (localControl.dirty || localControl.touched)) {\r\n<div class=\"custom-error mt-1 text-sm text-red-600 dark:text-red-400\">\r\n @if (localControl.errors?.[\"required\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El campo es requerido' }}</span>\r\n }\r\n @if (localControl.errors?.[\"min\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{ 'El valor m\u00EDnimo es de ' +\r\n localControl.errors?.[\"min\"].min.toFixed(2) }}</span>\r\n }\r\n @if (localControl.errors?.[\"max\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{ 'El valor m\u00E1ximo es de ' +\r\n localControl.errors?.[\"max\"].max.toFixed(2) }}</span>\r\n }\r\n @if (localControl.errors?.[\"minlength\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El largo m\u00EDnimo es de ' + localControl.errors?.[\"minlength\"].requiredLength\r\n }}</span>\r\n }\r\n @if (localControl.errors?.[\"maxlength\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El largo m\u00E1ximo es de ' + localControl.errors?.[\"maxlength\"].requiredLength\r\n }}</span>\r\n }\r\n @if (localControl.errors?.[\"email\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El correo electr\u00F3nico no es v\u00E1lido' }}</span>\r\n }\r\n @if (localControl.errors?.[\"pattern\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El formato no es v\u00E1lido' }}</span>\r\n }\r\n</div>\r\n}", styles: ["@charset \"UTF-8\";:host ::ng-deep p-datepicker>span>.p-inputtext{width:100%;border-radius:.5rem;outline:none;background-color:#f9fafb;height:44px;padding-right:2.5rem;color:#111827;transition:all .2s ease-in-out}:host ::ng-deep p-datepicker>.p-datepicker>.p-inputtext{background:transparent;color:#111827;height:44px;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-datepicker>.p-datepicker>.p-inputtext{background:transparent;background-color:#374151;color:#f3f4f6}:host ::ng-deep p-datepicker>span{width:100%;position:relative;display:inline-flex}:host ::ng-deep p-datepicker .p-datepicker-trigger{position:absolute!important;right:0!important;top:0!important;height:44px!important;width:2.5rem!important;background:transparent!important;border:none!important;box-shadow:none!important;color:#6b7280!important;display:flex!important;align-items:center!important;justify-content:center!important;z-index:1!important}:host ::ng-deep .my-app-dark p-datepicker .p-datepicker-trigger{color:#9ca3af!important}:host ::ng-deep p-datepicker .p-datepicker-trigger .p-button-icon{font-size:.875rem}:host ::ng-deep p-multiselect{border:1px solid #d1d5db;background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-multiselect{background:transparent;color:#f3f4f6}:host ::ng-deep p-select{background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-select{background:transparent;color:#f3f4f6}:host ::ng-deep p-select>.p-select-label{font-size:small;position:relative}:host ::ng-deep p-inputnumber{background:transparent;color:#111827;height:44px;width:100%;border:1px solid #d1d5db;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-inputnumber{background:transparent;color:#f3f4f6}:host-context(.my-app-dark) ::ng-deep .custom-datepicker>.p-inputwrapper>.p-inputtext{color:#f3f4f6;background-color:#374151}:host-context(.my-app-dark) ::ng-deep p-datepicker>span>.p-inputtext{background-color:#374151;color:#f3f4f6}:host-context(.my-app-dark) ::ng-deep .p-inputtext{background-color:#374151;color:#f3f4f6;border-color:transparent}:host-context(.my-app-dark) ::ng-deep .p-inputnumber-input{background-color:#374151;color:#f3f4f6;border-color:transparent}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { 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.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: IftaLabelModule }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i4.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: ToggleButtonModule }, { kind: "component", type: i5.ToggleButton, selector: "p-toggleButton, p-togglebutton, p-toggle-button", inputs: ["onLabel", "offLabel", "onIcon", "offIcon", "ariaLabel", "ariaLabelledBy", "disabled", "style", "styleClass", "inputId", "tabindex", "size", "iconPos", "autofocus", "allowEmpty"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputOtpModule }, { kind: "component", type: i6.InputOtp, selector: "p-inputOtp, p-inputotp, p-input-otp", inputs: ["invalid", "disabled", "readonly", "variant", "tabindex", "length", "styleClass", "mask", "integerOnly", "autofocus", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ToggleSwitchModule }, { kind: "component", type: i7.ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i8.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i9.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "component", type: DisabledContainerComponent, selector: "lib-disabled-container", inputs: ["disabled"], outputs: ["disabledChange"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i10.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
281
|
+
}
|
|
282
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomInputComponent, decorators: [{
|
|
283
|
+
type: Component,
|
|
284
|
+
args: [{ selector: 'lib-custom-input', imports: [
|
|
285
|
+
ReactiveFormsModule,
|
|
286
|
+
IftaLabelModule,
|
|
287
|
+
NgClass,
|
|
288
|
+
DatePickerModule,
|
|
289
|
+
CheckboxModule,
|
|
290
|
+
MultiSelectModule,
|
|
291
|
+
SelectModule,
|
|
292
|
+
ToggleButtonModule,
|
|
293
|
+
InputOtpModule,
|
|
294
|
+
ToggleSwitchModule,
|
|
295
|
+
InputNumberModule,
|
|
296
|
+
TextareaModule,
|
|
297
|
+
DisabledContainerComponent,
|
|
298
|
+
TooltipModule,
|
|
299
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [{
|
|
300
|
+
provide: NG_VALUE_ACCESSOR,
|
|
301
|
+
useExisting: forwardRef(() => CustomInputComponent),
|
|
302
|
+
multi: true
|
|
303
|
+
}], template: "@let localControl = controlData().control;\r\n@let placeholder = controlData().label || controlUpperName();\r\n@let name = controlData().controlName;\r\n@let typeInput = controlData().typeInput;\r\n@let readonly = controlData().readonly || false;\r\n@let dateConfig = controlData().dateConfig;\r\n@let multiSelectConfig = controlData().multiSelectConfig;\r\n@let selectConfig = controlData().selectConfig;\r\n@let toggleConfig = controlData().toggleConfig;\r\n@let textareaConfig = controlData().textareaConfig;\r\n@let currencyConfig = controlData().currencyConfig;\r\n@let decimalConfig = controlData().decimalConfig;\r\n@let autoFocus = controlData().autoFocus ?? false;\r\n<div class=\"flex flex-col gap-1 \">\r\n <lib-disabled-container [disabled]=\"readonly\">\r\n\r\n <p style=\"font-size: 12px; letter-spacing: 0.5px;\" class=\"text-sm text-gray-600 dark:text-gray-300 truncate\"\r\n [pTooltip]=\"placeholder\" tooltipPosition=\"top\" [showDelay]=\"300\">\r\n {{ placeholder }}\r\n </p>\r\n @switch (typeInput) {\r\n @case (inputTypesEnum.EMAIL_PASSWORD) {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [name]=\"name\"\r\n type=\"email\" [readOnly]=\"readonly\" autocomplete=\"email\" autocorrect=\"on\" autocapitalize=\"on\"\r\n spellcheck=\"true\" [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n <input type=\"password\" name=\"password\" id=\"password-autofill-helper\" autocomplete=\"current-password\" tabindex=\"-1\"\r\n style=\"position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;\"\r\n aria-hidden=\"true\"\r\n (input)=\"onPasswordAutofill($event)\" />\r\n }\r\n @case (inputTypesEnum.PASSWORD) {\r\n <!-- Input oculto siempre de tipo password para el autocompletado del navegador -->\r\n <input \r\n type=\"password\" \r\n name=\"password-autofill\"\r\n [id]=\"'password-autofill-hidden-' + generateUniqueId(name)\"\r\n autocomplete=\"current-password\" \r\n tabindex=\"-1\"\r\n style=\"position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0;\"\r\n aria-hidden=\"true\"\r\n [value]=\"localControl.value || ''\"\r\n (input)=\"onPasswordAutofillHidden($event)\" />\r\n <div class=\"relative\">\r\n <input [readOnly]=\"readonly || false\" [id]=\"generateUniqueId(name)\" [type]=\"showPassword ? 'text' : 'password'\"\r\n autocomplete=\"password\" autocorrect=\"on\" autocapitalize=\"on\" spellcheck=\"true\"\r\n class=\"custom-password w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 transition-all duration-200\"\r\n aria-describedby=\"password-help\" [formControl]=\"localControl\" \r\n (input)=\"syncPasswordAutofill($event)\" />\r\n <button type=\"button\"\r\n class=\"custom-password-toggle absolute inset-y-0 right-0 flex items-center justify-center w-12 h-full text-gray-400 transition-colors duration-200 ease-in-out hover:text-gray-600 focus:outline-none focus:text-gray-600 active:text-gray-700 dark:text-gray-500 dark:hover:text-gray-300 dark:focus:text-gray-300\"\r\n (click)=\"togglePasswordVisibility()\" [attr.aria-label]=\"\r\n showPassword ? 'Ocultar contrase\u00F1a' : 'Mostrar contrase\u00F1a'\r\n \">\r\n <i class=\"fas text-lg transition-all duration-200 ease-in-out\" [ngClass]=\"{\r\n 'fa-solid fa-eye': !showPassword,\r\n 'fa-solid fa-eye-slash': showPassword,\r\n }\"></i>\r\n </button>\r\n </div>\r\n }\r\n @case (inputTypesEnum.EMAIL) {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [name]=\"name\"\r\n [type]=\"typeInput\" [readOnly]=\"readonly\" autocomplete=\"email\" autocorrect=\"on\" autocapitalize=\"on\" spellcheck=\"true\"\r\n [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n }\r\n @case (inputTypesEnum.CURRENCY) {\r\n <p-inputnumber [autofocus]=\"autoFocus ?? false\" [formControl]=\"localControl\" (onFocus)=\"onFocus()\" (onBlur)=\"onBlur()\" (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" mode=\"currency\"\r\n [currency]=\"currencyConfig?.currency ?? 'USD'\" [locale]=\"currencyConfig?.locale ?? 'es-CO'\" [minFractionDigits]=\"currencyConfig?.minFractionDigits ?? 2\"\r\n [maxFractionDigits]=\"currencyConfig?.maxFractionDigits ?? 2\" [readonly]=\"readonly\" [disabled]=\"readonly\" />\r\n }\r\n @case (inputTypesEnum.DATE) {\r\n <lib-disabled-container [disabled]=\"readonly\">\r\n <p-datepicker [formControl]=\"localControl\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\"\r\n [maxDate]=\"dateConfig?.maxDate || null\" [minDate]=\"dateConfig?.minDate || null\" class=\"custom-datepicker\"\r\n appendTo=\"body\" />\r\n </lib-disabled-container>\r\n }\r\n @case (inputTypesEnum.TOGGLE) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-togglebutton [formControl]=\"localControl\" [onLabel]=\"toggleConfig?.onLabel || 'Si'\"\r\n [offLabel]=\"toggleConfig?.offLabel || 'No'\" class=\"custom-toggle\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.MULTISELECT) {\r\n <p-multiselect [filter]=\"true\" [options]=\"multiSelectConfig?.options\" [formControl]=\"localControl\"\r\n [optionLabel]=\"multiSelectConfig?.optionLabel ?? 'name'\" placeholder=\"\" [maxSelectedLabels]=\"3\"\r\n class=\"custom-multiselect\" appendTo=\"body\" />\r\n }\r\n @case (inputTypesEnum.SELECT) {\r\n <p-select [filter]=\"true\" [options]=\"selectConfig?.options\" [formControl]=\"localControl\"\r\n [optionLabel]=\"selectConfig?.optionLabel ?? 'name'\" placeholder=\"\" class=\"custom-select\"\r\n (onChange)=\"onSelectChange()\" appendTo=\"body\" [disabled]=\"readonly\" [readonly]=\"readonly\" [styleClass]=\"\r\n (localControl.invalid && (localControl.dirty || localControl.touched) ? 'border-red-500 focus:ring-red-500 ' : '') +\r\n (readonly ? 'bg-gray-100 cursor-not-allowed' : '')\r\n \" />\r\n }\r\n \r\n @case (inputTypesEnum.CHECKBOX) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <input [id]=\"generateUniqueId(name)\" [readOnly]=\"readonly\" [type]=\"typeInput\" [checked]=\"localControl.value\"\r\n (change)=\"onCheckboxChange($event, localControl)\"\r\n class=\"custom-checkbox h-5 w-5 border-2 border-gray-300 dark:border-transparent rounded focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n [formControl]=\"localControl\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.OTP) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-inputotp [id]=\"generateUniqueId(name)\" (onBlur)=\"onTouched()\" [mask]=\"controlData().otpConfig?.mask ?? false\"\r\n [length]=\"controlData().otpConfig?.length ?? 6\" [integerOnly]=\"controlData().otpConfig?.integerOnly ?? false\"\r\n class=\"custom-otp border-2 border-gray-300 dark:border-transparent rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n [formControl]=\"localControl\" />\r\n </div>\r\n }\r\n @case (inputTypesEnum.SWITCH) {\r\n <div class=\"flex justify-center items-center p-4\">\r\n <p-toggleswitch [id]=\"generateUniqueId(name)\" [formControl]=\"localControl\"\r\n class=\"custom-switch border-2 border-gray-300 dark:border-transparent rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 bg-white dark:bg-gray-700 transition-all duration-200\"\r\n (change)=\"onCheckboxChange($event, localControl)\">\r\n <ng-template #handle let-checked=\"checked\">\r\n <span class=\"text-xs bg-gray-100 dark:bg-gray-600 text-gray-800 dark:text-gray-200 rounded-full px-1\">\r\n @if (checked) {\r\n Si\r\n }\r\n @else {\r\n No\r\n }\r\n </span>\r\n </ng-template>\r\n </p-toggleswitch>\r\n </div>\r\n }\r\n @case (inputTypesEnum.DECIMAL) {\r\n <p-inputnumber [autofocus]=\"autoFocus ?? false\" [formControl]=\"localControl\" (onBlur)=\"onBlur()\" (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" mode=\"decimal\"\r\n (onFocus)=\"onFocus()\"\r\n [locale]=\"'es-CO'\" [minFractionDigits]=\"decimalConfig?.minFractionDigits ?? 2\" [maxFractionDigits]=\"decimalConfig?.maxFractionDigits ?? 2\" [useGrouping]=\"decimalConfig?.useGrouping ?? true\" [readonly]=\"readonly\" [disabled]=\"readonly\" />\r\n }\r\n @case (inputTypesEnum.TEXTAREA) {\r\n <textarea pTextarea [formControl]=\"localControl\" [rows]=\"textareaConfig?.rows ?? 3\"\r\n [cols]=\"textareaConfig?.cols ?? 30\" [autoResize]=\"true\" [variant]=\"textareaConfig?.variant ?? 'outlined'\"\r\n (blur)=\"onTouched()\" [id]=\"generateUniqueId(name)\" [readonly]=\"readonly\" autocomplete=\"off\" autocorrect=\"off\"\r\n autocapitalize=\"off\" spellcheck=\"false\"\r\n class=\"custom-textarea w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\"></textarea>\r\n }\r\n @default {\r\n <input [formControl]=\"localControl\" (blur)=\"onTouched()\" pInputText [id]=\"generateUniqueId(name)\" [type]=\"typeInput\"\r\n [readOnly]=\"readonly\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" [ngClass]=\"{\r\n 'border-red-500 focus:ring-red-500':\r\n localControl.invalid &&\r\n (localControl.dirty || localControl.touched),\r\n 'bg-gray-100 cursor-not-allowed': readonly,\r\n }\"\r\n class=\"custom-input h-12 w-full px-3 py-2 border border-gray-300 dark:border-transparent rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-all duration-200 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100\" />\r\n }\r\n }\r\n </lib-disabled-container>\r\n\r\n</div>\r\n\r\n@if (localControl.invalid && (localControl.dirty || localControl.touched)) {\r\n<div class=\"custom-error mt-1 text-sm text-red-600 dark:text-red-400\">\r\n @if (localControl.errors?.[\"required\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El campo es requerido' }}</span>\r\n }\r\n @if (localControl.errors?.[\"min\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{ 'El valor m\u00EDnimo es de ' +\r\n localControl.errors?.[\"min\"].min.toFixed(2) }}</span>\r\n }\r\n @if (localControl.errors?.[\"max\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{ 'El valor m\u00E1ximo es de ' +\r\n localControl.errors?.[\"max\"].max.toFixed(2) }}</span>\r\n }\r\n @if (localControl.errors?.[\"minlength\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El largo m\u00EDnimo es de ' + localControl.errors?.[\"minlength\"].requiredLength\r\n }}</span>\r\n }\r\n @if (localControl.errors?.[\"maxlength\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El largo m\u00E1ximo es de ' + localControl.errors?.[\"maxlength\"].requiredLength\r\n }}</span>\r\n }\r\n @if (localControl.errors?.[\"email\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El correo electr\u00F3nico no es v\u00E1lido' }}</span>\r\n }\r\n @if (localControl.errors?.[\"pattern\"]) {\r\n <span style=\"font-size: 0.675rem; font-style: italic; letter-spacing: 0.02em;\">{{\r\n 'El formato no es v\u00E1lido' }}</span>\r\n }\r\n</div>\r\n}", styles: ["@charset \"UTF-8\";:host ::ng-deep p-datepicker>span>.p-inputtext{width:100%;border-radius:.5rem;outline:none;background-color:#f9fafb;height:44px;padding-right:2.5rem;color:#111827;transition:all .2s ease-in-out}:host ::ng-deep p-datepicker>.p-datepicker>.p-inputtext{background:transparent;color:#111827;height:44px;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-datepicker>.p-datepicker>.p-inputtext{background:transparent;background-color:#374151;color:#f3f4f6}:host ::ng-deep p-datepicker>span{width:100%;position:relative;display:inline-flex}:host ::ng-deep p-datepicker .p-datepicker-trigger{position:absolute!important;right:0!important;top:0!important;height:44px!important;width:2.5rem!important;background:transparent!important;border:none!important;box-shadow:none!important;color:#6b7280!important;display:flex!important;align-items:center!important;justify-content:center!important;z-index:1!important}:host ::ng-deep .my-app-dark p-datepicker .p-datepicker-trigger{color:#9ca3af!important}:host ::ng-deep p-datepicker .p-datepicker-trigger .p-button-icon{font-size:.875rem}:host ::ng-deep p-multiselect{border:1px solid #d1d5db;background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-multiselect{background:transparent;color:#f3f4f6}:host ::ng-deep p-select{background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-select{background:transparent;color:#f3f4f6}:host ::ng-deep p-select>.p-select-label{font-size:small;position:relative}:host ::ng-deep p-inputnumber{background:transparent;color:#111827;height:44px;width:100%;border:1px solid #d1d5db;border-radius:.5rem;transition:all .2s ease-in-out}:host ::ng-deep .my-app-dark p-inputnumber{background:transparent;color:#f3f4f6}:host-context(.my-app-dark) ::ng-deep .custom-datepicker>.p-inputwrapper>.p-inputtext{color:#f3f4f6;background-color:#374151}:host-context(.my-app-dark) ::ng-deep p-datepicker>span>.p-inputtext{background-color:#374151;color:#f3f4f6}:host-context(.my-app-dark) ::ng-deep .p-inputtext{background-color:#374151;color:#f3f4f6;border-color:transparent}:host-context(.my-app-dark) ::ng-deep .p-inputnumber-input{background-color:#374151;color:#f3f4f6;border-color:transparent}\n"] }]
|
|
304
|
+
}], ctorParameters: () => [] });
|
|
305
|
+
|
|
306
|
+
class FormChildComponent {
|
|
307
|
+
controlsData = input.required();
|
|
308
|
+
formGroup = input.required();
|
|
309
|
+
formSubmit = output();
|
|
310
|
+
constructor() {
|
|
311
|
+
}
|
|
312
|
+
submit() {
|
|
313
|
+
this.formSubmit.emit(this.formGroup());
|
|
314
|
+
}
|
|
315
|
+
onSelectChange(controlConfig) {
|
|
316
|
+
controlConfig.selectConfig?.change?.(controlConfig);
|
|
317
|
+
}
|
|
318
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormChildComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: FormChildComponent, isStandalone: true, selector: "lib-form-child", inputs: { controlsData: { classPropertyName: "controlsData", publicName: "controlsData", isSignal: true, isRequired: true, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { formSubmit: "formSubmit" }, ngImport: i0, template: "@let controls = controlsData();\r\n\r\n<form\r\n [formGroup]=\"formGroup()\"\r\n (submit)=\"submit()\"\r\n autocomplete=\"off\"\r\n class=\"grid grid-cols-12 gap-3\"\r\n>\r\n @for (controlData of controls; track controlData.controlName) {\r\n <div\r\n class=\"flex flex-col w-full\"\r\n [ngClass]=\"{\r\n 'col-span-1': !controlData.colSpan,\r\n 'col-span-2': controlData.colSpan === 2,\r\n 'col-span-3': controlData.colSpan === 3,\r\n 'col-span-4': controlData.colSpan === 4,\r\n 'col-span-5': controlData.colSpan === 5,\r\n 'col-span-6': controlData.colSpan === 6,\r\n 'col-span-7': controlData.colSpan === 7,\r\n 'col-span-8': controlData.colSpan === 8,\r\n 'col-span-9': controlData.colSpan === 9,\r\n 'col-span-10': controlData.colSpan === 10,\r\n 'col-span-11': controlData.colSpan === 11,\r\n 'col-span-12': controlData.colSpan === 12,\r\n }\"\r\n >\r\n <lib-custom-input\r\n [id]=\"controlData.controlName\"\r\n [controlData]=\"controlData\"\r\n [formControlName]=\"controlData.controlName\"\r\n class=\"w-full\"\r\n (output)=\"onSelectChange($event)\"\r\n >\r\n </lib-custom-input>\r\n </div>\r\n }\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { 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: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: CustomInputComponent, selector: "lib-custom-input", inputs: ["controlData"], outputs: ["output"] }] });
|
|
320
|
+
}
|
|
321
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormChildComponent, decorators: [{
|
|
322
|
+
type: Component,
|
|
323
|
+
args: [{ selector: 'lib-form-child', imports: [
|
|
324
|
+
ReactiveFormsModule,
|
|
325
|
+
CommonModule,
|
|
326
|
+
CustomInputComponent
|
|
327
|
+
], template: "@let controls = controlsData();\r\n\r\n<form\r\n [formGroup]=\"formGroup()\"\r\n (submit)=\"submit()\"\r\n autocomplete=\"off\"\r\n class=\"grid grid-cols-12 gap-3\"\r\n>\r\n @for (controlData of controls; track controlData.controlName) {\r\n <div\r\n class=\"flex flex-col w-full\"\r\n [ngClass]=\"{\r\n 'col-span-1': !controlData.colSpan,\r\n 'col-span-2': controlData.colSpan === 2,\r\n 'col-span-3': controlData.colSpan === 3,\r\n 'col-span-4': controlData.colSpan === 4,\r\n 'col-span-5': controlData.colSpan === 5,\r\n 'col-span-6': controlData.colSpan === 6,\r\n 'col-span-7': controlData.colSpan === 7,\r\n 'col-span-8': controlData.colSpan === 8,\r\n 'col-span-9': controlData.colSpan === 9,\r\n 'col-span-10': controlData.colSpan === 10,\r\n 'col-span-11': controlData.colSpan === 11,\r\n 'col-span-12': controlData.colSpan === 12,\r\n }\"\r\n >\r\n <lib-custom-input\r\n [id]=\"controlData.controlName\"\r\n [controlData]=\"controlData\"\r\n [formControlName]=\"controlData.controlName\"\r\n class=\"w-full\"\r\n (output)=\"onSelectChange($event)\"\r\n >\r\n </lib-custom-input>\r\n </div>\r\n }\r\n</form>\r\n" }]
|
|
328
|
+
}], ctorParameters: () => [] });
|
|
329
|
+
|
|
330
|
+
class HttpMessageComponent {
|
|
331
|
+
httpMessage = model();
|
|
332
|
+
clearMessage() {
|
|
333
|
+
this.httpMessage.set(undefined);
|
|
334
|
+
}
|
|
335
|
+
get isError() {
|
|
336
|
+
const message = this.httpMessage();
|
|
337
|
+
return message?.type === 'error';
|
|
338
|
+
}
|
|
339
|
+
get isSuccess() {
|
|
340
|
+
const message = this.httpMessage();
|
|
341
|
+
return message?.type === 'success';
|
|
342
|
+
}
|
|
343
|
+
get isWarning() {
|
|
344
|
+
const message = this.httpMessage();
|
|
345
|
+
return message?.type === 'warning';
|
|
346
|
+
}
|
|
347
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: HttpMessageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
348
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: HttpMessageComponent, isStandalone: true, selector: "lib-http-message", inputs: { httpMessage: { classPropertyName: "httpMessage", publicName: "httpMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { httpMessage: "httpMessageChange" }, ngImport: i0, template: "@if (httpMessage()) {\r\n @if (isError) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-red-500 dark:text-red-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-red-700 dark:text-red-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-200 p-1 rounded hover:bg-red-100 dark:hover:bg-red-800/30\"\r\n aria-label=\"Cerrar mensaje de error\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (isSuccess) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-green-500 dark:text-green-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-green-700 dark:text-green-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-green-500 dark:text-green-400 hover:text-green-700 dark:hover:text-green-200 p-1 rounded hover:bg-green-100 dark:hover:bg-green-800/30\"\r\n aria-label=\"Cerrar mensaje de \u00E9xito\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (isWarning) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-amber-500 dark:text-amber-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-amber-700 dark:text-amber-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-amber-500 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-200 p-1 rounded hover:bg-amber-100 dark:hover:bg-amber-800/30\"\r\n aria-label=\"Cerrar mensaje de advertencia\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n}\r\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
349
|
+
}
|
|
350
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: HttpMessageComponent, decorators: [{
|
|
351
|
+
type: Component,
|
|
352
|
+
args: [{ selector: 'lib-http-message', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (httpMessage()) {\r\n @if (isError) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-red-500 dark:text-red-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-red-700 dark:text-red-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-red-500 dark:text-red-400 hover:text-red-700 dark:hover:text-red-200 p-1 rounded hover:bg-red-100 dark:hover:bg-red-800/30\"\r\n aria-label=\"Cerrar mensaje de error\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (isSuccess) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-green-500 dark:text-green-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-green-700 dark:text-green-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-green-500 dark:text-green-400 hover:text-green-700 dark:hover:text-green-200 p-1 rounded hover:bg-green-100 dark:hover:bg-green-800/30\"\r\n aria-label=\"Cerrar mensaje de \u00E9xito\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n @if (isWarning) {\r\n <div class=\"group relative mt-3 p-3 rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 transition-all duration-200 hover:shadow-md\">\r\n <div class=\"flex items-start gap-2\">\r\n <svg class=\"w-5 h-5 text-amber-500 dark:text-amber-400 flex-shrink-0 mt-0.5\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\r\n <path fill-rule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clip-rule=\"evenodd\" />\r\n </svg>\r\n <p class=\"flex-1 text-amber-700 dark:text-amber-300 text-sm font-medium leading-relaxed\">\r\n {{ httpMessage()?.message }}\r\n </p>\r\n <button\r\n type=\"button\"\r\n (click)=\"clearMessage()\"\r\n class=\"opacity-0 group-hover:opacity-100 transition-opacity duration-200 text-amber-500 dark:text-amber-400 hover:text-amber-700 dark:hover:text-amber-200 p-1 rounded hover:bg-amber-100 dark:hover:bg-amber-800/30\"\r\n aria-label=\"Cerrar mensaje de advertencia\"\r\n >\r\n <svg class=\"w-4 h-4\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\r\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 18L18 6M6 6l12 12\" />\r\n </svg>\r\n </button>\r\n </div>\r\n </div>\r\n }\r\n}\r\n" }]
|
|
353
|
+
}] });
|
|
354
|
+
|
|
355
|
+
class FormComponent {
|
|
356
|
+
formGroup = model.required();
|
|
357
|
+
controls = input.required();
|
|
358
|
+
formConfig = input();
|
|
359
|
+
httpMessage = model();
|
|
360
|
+
formSubmit = output();
|
|
361
|
+
formChanges = output();
|
|
362
|
+
formChangesDebounced = output();
|
|
363
|
+
constructor() {
|
|
364
|
+
effect(() => {
|
|
365
|
+
const controls = this.controls();
|
|
366
|
+
const controlsNames = this.controls().map((controlConfig) => controlConfig.controlName);
|
|
367
|
+
const controlsToDelete = Object.keys(this.formGroup().controls).filter(control => !controlsNames.includes(control));
|
|
368
|
+
controls.forEach((controlData) => {
|
|
369
|
+
this.formGroup.update((formGroup) => {
|
|
370
|
+
if (formGroup.contains(controlData.controlName)) {
|
|
371
|
+
formGroup.setControl(controlData.controlName, controlData.control);
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
formGroup.addControl(controlData.controlName, controlData.control);
|
|
375
|
+
}
|
|
376
|
+
controlsToDelete.forEach(controlName => {
|
|
377
|
+
formGroup.removeControl(controlName);
|
|
378
|
+
});
|
|
379
|
+
return formGroup;
|
|
380
|
+
});
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
effect(() => {
|
|
384
|
+
const controlsDataTypeSelect = this.controls().filter((controlData) => controlData.typeInput === ETypeInput.SELECT);
|
|
385
|
+
controlsDataTypeSelect.forEach((controlData) => {
|
|
386
|
+
const control = this.formGroup().get(controlData.controlName);
|
|
387
|
+
const controlValue = control?.value;
|
|
388
|
+
if (controlValue) {
|
|
389
|
+
const options = controlData.selectConfig?.options ?? [];
|
|
390
|
+
const optionSelected = options.find((option) => {
|
|
391
|
+
return option.code === controlValue.code;
|
|
392
|
+
});
|
|
393
|
+
if (optionSelected) {
|
|
394
|
+
control?.setValue(optionSelected);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
effect(() => {
|
|
400
|
+
this.formGroup().valueChanges.subscribe(() => {
|
|
401
|
+
this.formChanges.emit(this.formGroup());
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
const fg$ = toObservable(this.formGroup);
|
|
405
|
+
fg$.pipe(switchMap((fg) => fg.valueChanges.pipe(debounceTime(650), filter(() => this.anyInteracted(fg)), map(() => fg))), takeUntilDestroyed())
|
|
406
|
+
.subscribe(() => this.formChangesDebounced.emit(this.formGroup()));
|
|
407
|
+
}
|
|
408
|
+
anyInteracted(formGroup) {
|
|
409
|
+
return Object.values(formGroup.controls).some(control => control.touched || control.dirty);
|
|
410
|
+
}
|
|
411
|
+
submit(formGroup) {
|
|
412
|
+
this.formSubmit.emit(formGroup);
|
|
413
|
+
}
|
|
414
|
+
clearHttpMessage() {
|
|
415
|
+
this.httpMessage.set(undefined);
|
|
416
|
+
}
|
|
417
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
418
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: FormComponent, isStandalone: true, selector: "lib-form", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, controls: { classPropertyName: "controls", publicName: "controls", isSignal: true, isRequired: true, transformFunction: null }, formConfig: { classPropertyName: "formConfig", publicName: "formConfig", isSignal: true, isRequired: false, transformFunction: null }, httpMessage: { classPropertyName: "httpMessage", publicName: "httpMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { formGroup: "formGroupChange", httpMessage: "httpMessageChange", formSubmit: "formSubmit", formChanges: "formChanges", formChangesDebounced: "formChangesDebounced" }, ngImport: i0, template: "<div class=\"w-full p-2 rounded-lg\" [style.backgroundColor]=\"formConfig()?.backgroundColor || 'transparent'\">\r\n <lib-form-child [controlsData]=\"controls()\" [formGroup]=\"formGroup()\" (formSubmit)=\"submit($event)\">\r\n </lib-form-child>\r\n @if (httpMessage()) {\r\n <lib-http-message [(httpMessage)]=\"httpMessage\"></lib-http-message>\r\n }\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FormChildComponent, selector: "lib-form-child", inputs: ["controlsData", "formGroup"], outputs: ["formSubmit"] }, { kind: "component", type: HttpMessageComponent, selector: "lib-http-message", inputs: ["httpMessage"], outputs: ["httpMessageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
419
|
+
}
|
|
420
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: FormComponent, decorators: [{
|
|
421
|
+
type: Component,
|
|
422
|
+
args: [{ selector: 'lib-form', imports: [
|
|
423
|
+
ReactiveFormsModule,
|
|
424
|
+
FormChildComponent,
|
|
425
|
+
HttpMessageComponent
|
|
426
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"w-full p-2 rounded-lg\" [style.backgroundColor]=\"formConfig()?.backgroundColor || 'transparent'\">\r\n <lib-form-child [controlsData]=\"controls()\" [formGroup]=\"formGroup()\" (formSubmit)=\"submit($event)\">\r\n </lib-form-child>\r\n @if (httpMessage()) {\r\n <lib-http-message [(httpMessage)]=\"httpMessage\"></lib-http-message>\r\n }\r\n</div>" }]
|
|
427
|
+
}], ctorParameters: () => [] });
|
|
428
|
+
|
|
429
|
+
class InlineInputComponent {
|
|
430
|
+
config = input({ typeInput: ETypeInput.TEXT });
|
|
431
|
+
value = model(null);
|
|
432
|
+
outputValue = output();
|
|
433
|
+
outputBlur = output();
|
|
434
|
+
outputDebounced = output();
|
|
435
|
+
// Capturar templates proyectados desde el componente padre
|
|
436
|
+
templates;
|
|
437
|
+
// Para el manejo de chips
|
|
438
|
+
chips = [];
|
|
439
|
+
currentInput = '';
|
|
440
|
+
showDuplicateMessage = false;
|
|
441
|
+
duplicateChips = [];
|
|
442
|
+
duplicateMessageTimer = null;
|
|
443
|
+
constructor() {
|
|
444
|
+
effect(() => {
|
|
445
|
+
this.outputValue.emit(this.value());
|
|
446
|
+
});
|
|
447
|
+
const value$ = toObservable(this.value);
|
|
448
|
+
value$
|
|
449
|
+
.pipe(debounceTime(300), // <- adjust ms here
|
|
450
|
+
distinctUntilChanged(), // avoid repeats for same value
|
|
451
|
+
takeUntilDestroyed() // auto-cleanup on destroy
|
|
452
|
+
)
|
|
453
|
+
.subscribe(v => this.outputDebounced.emit(v));
|
|
454
|
+
effect(() => {
|
|
455
|
+
this.valueSelect.update((_prev) => {
|
|
456
|
+
const options = this.config()?.selectConfig?.options;
|
|
457
|
+
const currentValue = this.value();
|
|
458
|
+
if (this.isSelection(currentValue))
|
|
459
|
+
return currentValue;
|
|
460
|
+
if (currentValue === null || currentValue === undefined)
|
|
461
|
+
return undefined;
|
|
462
|
+
return options?.find(option => option.code === currentValue);
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
ngOnInit() {
|
|
467
|
+
}
|
|
468
|
+
onChange = () => { };
|
|
469
|
+
onTouched = () => { };
|
|
470
|
+
writeValue(value) {
|
|
471
|
+
this.value.set(value);
|
|
472
|
+
// Si es tipo CHIPS, inicializar los chips desde el valor
|
|
473
|
+
if (this.type === ETypeInput.CHIPS && typeof value === 'string') {
|
|
474
|
+
this.chips = value ? value.split(' ').filter(chip => chip.trim() !== '') : [];
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
registerOnChange(fn) {
|
|
478
|
+
this.onChange = fn;
|
|
479
|
+
}
|
|
480
|
+
registerOnTouched(fn) {
|
|
481
|
+
this.onTouched = fn;
|
|
482
|
+
}
|
|
483
|
+
onChangeValue(value) {
|
|
484
|
+
this.value.set(value);
|
|
485
|
+
this.onChange(value);
|
|
486
|
+
}
|
|
487
|
+
onBlur() {
|
|
488
|
+
this.onTouched();
|
|
489
|
+
this.outputBlur.emit(this.value());
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Maneja eventos de teclado para prevenir la navegación de PrimeNG Table
|
|
493
|
+
* cuando se usan las flechas izquierda/derecha dentro del input
|
|
494
|
+
*/
|
|
495
|
+
onKeyDown(event) {
|
|
496
|
+
// Verificar si son teclas de flecha izquierda o derecha
|
|
497
|
+
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
498
|
+
// Detener la propagación del evento hacia el table
|
|
499
|
+
event.stopPropagation();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
isSelection(value) {
|
|
503
|
+
return !!value && typeof value === 'object' && 'code' in value && 'name' in value;
|
|
504
|
+
}
|
|
505
|
+
valueSelect = signal(undefined);
|
|
506
|
+
setValueSelect(value) {
|
|
507
|
+
this.valueSelect.set(value);
|
|
508
|
+
}
|
|
509
|
+
get type() {
|
|
510
|
+
return this.config()?.typeInput ?? ETypeInput.TEXT;
|
|
511
|
+
}
|
|
512
|
+
get ETypeInput() {
|
|
513
|
+
return ETypeInput;
|
|
514
|
+
}
|
|
515
|
+
get duplicatesText() {
|
|
516
|
+
return this.duplicateChips.join(', ');
|
|
517
|
+
}
|
|
518
|
+
get currency() {
|
|
519
|
+
return this.config()?.currencyConfig?.currency ?? 'COP';
|
|
520
|
+
}
|
|
521
|
+
get locale() {
|
|
522
|
+
return this.config()?.currencyConfig?.locale ?? 'es-CO';
|
|
523
|
+
}
|
|
524
|
+
get minFractionDigits() {
|
|
525
|
+
return this.config()?.currencyConfig?.minFractionDigits ?? 2;
|
|
526
|
+
}
|
|
527
|
+
get maxFractionDigits() {
|
|
528
|
+
return this.config()?.currencyConfig?.maxFractionDigits ?? 2;
|
|
529
|
+
}
|
|
530
|
+
knobValueInput = computed(() => {
|
|
531
|
+
let response = this.value();
|
|
532
|
+
const knobConfig = this.config()?.knobConfig ?? { min: 0, max: 100, step: 1 };
|
|
533
|
+
response = parseInt(this.value()) ?? 0;
|
|
534
|
+
if (response < (knobConfig?.min ?? 0)) {
|
|
535
|
+
response = knobConfig.min ?? 0;
|
|
536
|
+
}
|
|
537
|
+
if (response > (knobConfig?.max ?? 100)) {
|
|
538
|
+
response = knobConfig.max ?? 100;
|
|
539
|
+
}
|
|
540
|
+
return response;
|
|
541
|
+
});
|
|
542
|
+
knobValueTemplate = computed(() => {
|
|
543
|
+
return this.config()?.knobConfig?.valueTemplate ?? '';
|
|
544
|
+
});
|
|
545
|
+
// Métodos para manejo de chips
|
|
546
|
+
onChipInputChange(event) {
|
|
547
|
+
const target = event.target;
|
|
548
|
+
this.currentInput = target.value;
|
|
549
|
+
}
|
|
550
|
+
onChipKeydown(event) {
|
|
551
|
+
if (event.key === ' ' || event.key === 'Enter') {
|
|
552
|
+
event.preventDefault();
|
|
553
|
+
this.addChip();
|
|
554
|
+
}
|
|
555
|
+
else if (event.key === 'Backspace' && this.currentInput === '' && this.chips.length > 0) {
|
|
556
|
+
// Si no hay texto y hay chips, eliminar el último chip
|
|
557
|
+
this.removeChip(this.chips.length - 1);
|
|
558
|
+
}
|
|
559
|
+
// No interceptar las flechas aquí ya que se maneja en onKeyDown
|
|
560
|
+
}
|
|
561
|
+
onChipPaste(event) {
|
|
562
|
+
event.preventDefault();
|
|
563
|
+
const pastedText = event.clipboardData?.getData('text') || '';
|
|
564
|
+
this.processPastedText(pastedText);
|
|
565
|
+
}
|
|
566
|
+
addChip() {
|
|
567
|
+
const trimmedValue = this.currentInput.trim();
|
|
568
|
+
if (trimmedValue) {
|
|
569
|
+
if (this.chips.includes(trimmedValue)) {
|
|
570
|
+
// Mostrar mensaje de duplicado con el chip específico
|
|
571
|
+
this.duplicateChips = [trimmedValue];
|
|
572
|
+
this.showDuplicateAlert();
|
|
573
|
+
}
|
|
574
|
+
else {
|
|
575
|
+
this.chips.push(trimmedValue);
|
|
576
|
+
this.currentInput = '';
|
|
577
|
+
this.updateChipsValue();
|
|
578
|
+
this.hideDuplicateAlert();
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
removeChip(index) {
|
|
583
|
+
this.chips.splice(index, 1);
|
|
584
|
+
this.updateChipsValue();
|
|
585
|
+
}
|
|
586
|
+
updateChipsValue() {
|
|
587
|
+
const chipsValue = this.chips.join(' ');
|
|
588
|
+
this.value.set(chipsValue);
|
|
589
|
+
this.onChange(chipsValue);
|
|
590
|
+
}
|
|
591
|
+
showDuplicateAlert() {
|
|
592
|
+
this.showDuplicateMessage = true;
|
|
593
|
+
// Limpiar timer anterior si existe
|
|
594
|
+
if (this.duplicateMessageTimer) {
|
|
595
|
+
clearTimeout(this.duplicateMessageTimer);
|
|
596
|
+
}
|
|
597
|
+
// Ocultar mensaje después de 3 segundos
|
|
598
|
+
this.duplicateMessageTimer = setTimeout(() => {
|
|
599
|
+
this.hideDuplicateAlert();
|
|
600
|
+
}, 3000);
|
|
601
|
+
}
|
|
602
|
+
hideDuplicateAlert() {
|
|
603
|
+
this.showDuplicateMessage = false;
|
|
604
|
+
this.duplicateChips = [];
|
|
605
|
+
if (this.duplicateMessageTimer) {
|
|
606
|
+
clearTimeout(this.duplicateMessageTimer);
|
|
607
|
+
this.duplicateMessageTimer = null;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
processPastedText(text) {
|
|
611
|
+
// Dividir el texto por espacios y filtrar elementos vacíos
|
|
612
|
+
const newChips = text
|
|
613
|
+
.split(/\s+/) // Dividir por uno o más espacios
|
|
614
|
+
.map(chip => chip.trim()) // Limpiar espacios en cada elemento
|
|
615
|
+
.filter(chip => chip !== ''); // Filtrar elementos vacíos
|
|
616
|
+
const foundDuplicates = [];
|
|
617
|
+
let addedChips = 0;
|
|
618
|
+
// Agregar cada chip nuevo y recopilar duplicados
|
|
619
|
+
newChips.forEach(chipText => {
|
|
620
|
+
if (!this.chips.includes(chipText)) {
|
|
621
|
+
this.chips.push(chipText);
|
|
622
|
+
addedChips++;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
// Solo agregar a duplicados si no está ya en la lista
|
|
626
|
+
if (!foundDuplicates.includes(chipText)) {
|
|
627
|
+
foundDuplicates.push(chipText);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
// Limpiar el input actual
|
|
632
|
+
this.currentInput = '';
|
|
633
|
+
// Actualizar el valor si se agregaron chips
|
|
634
|
+
if (addedChips > 0) {
|
|
635
|
+
this.updateChipsValue();
|
|
636
|
+
}
|
|
637
|
+
// Mostrar alerta si hubo duplicados
|
|
638
|
+
if (foundDuplicates.length > 0) {
|
|
639
|
+
this.duplicateChips = foundDuplicates;
|
|
640
|
+
this.showDuplicateAlert();
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
this.hideDuplicateAlert();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* Método público para establecer chips desde un array externo
|
|
648
|
+
* @param chipsArray Array de strings que representan las chips
|
|
649
|
+
*/
|
|
650
|
+
setChipsFromArray(chipsArray) {
|
|
651
|
+
if (!Array.isArray(chipsArray)) {
|
|
652
|
+
console.warn('setChipsFromArray: El parámetro debe ser un array de strings');
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
// Filtrar elementos válidos (strings no vacíos)
|
|
656
|
+
const validChips = chipsArray
|
|
657
|
+
.filter(chip => typeof chip === 'string' && chip.trim() !== '')
|
|
658
|
+
.map(chip => chip.trim());
|
|
659
|
+
// Actualizar el array de chips
|
|
660
|
+
this.chips = [...validChips];
|
|
661
|
+
// Limpiar el input actual
|
|
662
|
+
this.currentInput = '';
|
|
663
|
+
// Actualizar el valor del componente
|
|
664
|
+
this.updateChipsValue();
|
|
665
|
+
// Ocultar cualquier mensaje de duplicado
|
|
666
|
+
this.hideDuplicateAlert();
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* Método público para obtener las chips actuales como array
|
|
670
|
+
* @returns Array de strings con las chips actuales
|
|
671
|
+
*/
|
|
672
|
+
getChipsAsArray() {
|
|
673
|
+
return [...this.chips];
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Método público para limpiar todas las chips
|
|
677
|
+
*/
|
|
678
|
+
clearAllChips() {
|
|
679
|
+
this.chips = [];
|
|
680
|
+
this.currentInput = '';
|
|
681
|
+
this.updateChipsValue();
|
|
682
|
+
this.hideDuplicateAlert();
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Método público para agregar múltiples chips desde un array
|
|
686
|
+
* Evita duplicados y muestra mensajes de alerta si es necesario
|
|
687
|
+
* @param chipsArray Array de strings a agregar
|
|
688
|
+
*/
|
|
689
|
+
addChipsFromArray(chipsArray) {
|
|
690
|
+
if (!Array.isArray(chipsArray)) {
|
|
691
|
+
console.warn('addChipsFromArray: El parámetro debe ser un array de strings');
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
// Filtrar elementos válidos
|
|
695
|
+
const validChips = chipsArray
|
|
696
|
+
.filter(chip => typeof chip === 'string' && chip.trim() !== '')
|
|
697
|
+
.map(chip => chip.trim());
|
|
698
|
+
const foundDuplicates = [];
|
|
699
|
+
let addedChips = 0;
|
|
700
|
+
// Agregar cada chip nuevo y recopilar duplicados
|
|
701
|
+
validChips.forEach(chipText => {
|
|
702
|
+
if (!this.chips.includes(chipText)) {
|
|
703
|
+
this.chips.push(chipText);
|
|
704
|
+
addedChips++;
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
// Solo agregar a duplicados si no está ya en la lista
|
|
708
|
+
if (!foundDuplicates.includes(chipText)) {
|
|
709
|
+
foundDuplicates.push(chipText);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
// Actualizar el valor si se agregaron chips
|
|
714
|
+
if (addedChips > 0) {
|
|
715
|
+
this.updateChipsValue();
|
|
716
|
+
}
|
|
717
|
+
// Mostrar alerta si hubo duplicados
|
|
718
|
+
if (foundDuplicates.length > 0) {
|
|
719
|
+
this.duplicateChips = foundDuplicates;
|
|
720
|
+
this.showDuplicateAlert();
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
this.hideDuplicateAlert();
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
// Limpiar timer al destruir el componente
|
|
727
|
+
ngOnDestroy() {
|
|
728
|
+
if (this.duplicateMessageTimer) {
|
|
729
|
+
clearTimeout(this.duplicateMessageTimer);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InlineInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
733
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: InlineInputComponent, isStandalone: true, selector: "lib-inline-input", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", outputValue: "outputValue", outputBlur: "outputBlur", outputDebounced: "outputDebounced" }, providers: [
|
|
734
|
+
{
|
|
735
|
+
provide: NG_VALUE_ACCESSOR,
|
|
736
|
+
useExisting: forwardRef(() => InlineInputComponent),
|
|
737
|
+
multi: true
|
|
738
|
+
}
|
|
739
|
+
], queries: [{ propertyName: "templates", predicate: PrimeTemplate }], ngImport: i0, template: "@let valueInput = value();\n@let isDisabled = config().isDisabled ?? false;\n@let knobConfig = config().knobConfig;\n@let textareaConfig = config().textareaConfig;\n@let dateConfig = config().dateConfig;\n\n@switch (type) {\n@case (ETypeInput.CURRENCY) {\n<p-inputnumber [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" mode=\"currency\" [currency]=\"currency\" [locale]=\"locale\"\n [minFractionDigits]=\"minFractionDigits\" [maxFractionDigits]=\"maxFractionDigits\" class=\"w-full\"\n [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.DECIMAL) {\n<p-inputnumber [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" mode=\"decimal\" [locale]=\"locale\" [minFractionDigits]=\"2\" [maxFractionDigits]=\"2\"\n [useGrouping]=\"true\" class=\"w-full\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.DATE) {\n<p-datepicker [ngModel]=\"valueInput\" appendTo=\"body\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" class=\"w-full\" [disabled]=\"isDisabled\" [maxDate]=\"dateConfig?.maxDate || null\"\n [minDate]=\"dateConfig?.minDate || null\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\" />\n}\n@case (ETypeInput.DATETIME_LOCAL) {\n<p-datepicker [ngModel]=\"valueInput\" appendTo=\"body\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" class=\"w-full\" [showTime]=\"true\" [hourFormat]=\"'24'\" [disabled]=\"isDisabled\"\n [maxDate]=\"dateConfig?.maxDate || null\" [minDate]=\"dateConfig?.minDate || null\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\" />\n}\n@case (ETypeInput.SELECT) {\n<p-select [options]=\"config().selectConfig?.options ?? []\" [optionLabel]=\"config().selectConfig?.optionLabel ?? 'name'\"\n [(ngModel)]=\"valueSelect\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\"\n appendTo=\"body\" class=\"w-full inline-input-select\" [disabled]=\"config().isDisabled ?? false\" >\n @for (template of templates; track $index) {\n <ng-template [pTemplate]=\"template.getType()\" let-item>\n <ng-container *ngTemplateOutlet=\"template.template; context: { $implicit: item }\"></ng-container>\n </ng-template>\n }\n</p-select>\n}\n@case (ETypeInput.MULTISELECT) {\n<p-multiselect [options]=\"config().multiSelectConfig?.options ?? []\"\n [optionLabel]=\"config().multiSelectConfig?.optionLabel ?? 'name'\" [ngModel]=\"valueInput\"\n (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [filter]=\"true\"\n appendTo=\"body\" class=\"w-full\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.OTP) {\n<p-inputotp class=\"w-full\" [mask]=\"config().otpConfig?.mask ?? false\" [length]=\"config().otpConfig?.length ?? 6\"\n [integerOnly]=\"config().otpConfig?.integerOnly ?? false\" [ngModel]=\"valueInput\"\n (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.KNOB) {\n<p-knob [ngModel]=\"knobValueInput()\" (ngModelChange)=\"onChangeValue($event)\" class=\"w-full\" [min]=\"knobConfig?.min ?? 0\"\n [max]=\"knobConfig?.max ?? 100\" [step]=\"knobConfig?.step ?? 1\" [disabled]=\"isDisabled\" [readonly]=\"true\"\n [valueTemplate]=\"knobValueTemplate()\" [size]=\"knobConfig?.size ?? 100\" />\n}\n@case (ETypeInput.TEXTAREA) {\n<textarea class=\"w-full h-full p-2 border border-gray-300 rounded-md\" pTextarea [rows]=\"textareaConfig?.rows ?? 3\"\n [cols]=\"textareaConfig?.cols ?? 30\" [autoResize]=\"true\" [variant]=\"textareaConfig?.variant ?? 'outlined'\"\n [disabled]=\"isDisabled\" [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"></textarea>\n}\n@case (ETypeInput.CHIPS) {\n<div class=\"chips-input-wrapper\">\n <div\n class=\"chips-container w-full p-2 border border-gray-300 rounded-md min-h-[40px] flex flex-wrap items-center gap-2\"\n [class.border-red-500]=\"showDuplicateMessage\">\n @for (chip of chips; track $index) {\n <p-chip [label]=\"chip\" [removable]=\"!isDisabled\" (onRemove)=\"removeChip($index)\" class=\"chip-item\" />\n }\n <input type=\"text\" class=\"chip-input flex-1 border-0 outline-0 bg-transparent min-w-[100px]\" [value]=\"currentInput\"\n (input)=\"onChipInputChange($event)\" (keydown)=\"onChipKeydown($event); onKeyDown($event)\"\n (paste)=\"onChipPaste($event)\" [disabled]=\"isDisabled\"\n placeholder=\"Escribe o pega elementos separados por espacios...\" />\n </div>\n @if (showDuplicateMessage) {\n <div class=\"duplicate-message text-red-500 text-sm mt-1 flex items-center gap-1\">\n <i class=\"pi pi-exclamation-triangle text-red-500\"></i>\n <span>\n @if (duplicateChips.length === 1) {\n El elemento \"<strong>{{ duplicatesText }}</strong>\" ya existe en la lista\n } @else {\n Los elementos \"<strong>{{ duplicatesText }}</strong>\" ya existen en la lista\n }\n </span>\n </div>\n }\n</div>\n}\n@case (ETypeInput.SWITCH) {\n<div class=\"flex justify-center items-center p-2\">\n <p-toggleswitch [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n class=\"w-full\" [disabled]=\"isDisabled\" />\n</div>\n}\n@default {\n<input pInputText class=\"w-full h-full p-2 border border-gray-300 rounded-md\" [type]=\"type\"\n [readOnly]=\"config().readonly ?? false\" [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\"\n (blur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [disabled]=\"isDisabled\" />\n}\n}", styles: [":host{width:100%;height:100%}.chips-input-wrapper{width:100%}.chips-input-wrapper .chips-container{cursor:text;transition:border-color .2s ease,box-shadow .2s ease}.chips-input-wrapper .chips-container:focus-within{border-color:#007ad9;box-shadow:0 0 0 1px #007ad9}.chips-input-wrapper .chips-container.border-red-500{border-color:#ef4444!important;box-shadow:0 0 0 1px #ef4444!important}.chips-input-wrapper .chips-container .chip-item{margin:0}.chips-input-wrapper .chips-container .chip-input:focus{outline:none}.chips-input-wrapper .chips-container .chip-input::placeholder{color:#6b7280;font-style:italic}.chips-input-wrapper .duplicate-message{animation:slideDown .3s ease-out}.chips-input-wrapper .duplicate-message i{font-size:14px}@keyframes slideDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}::ng-deep p-select.inline-input-select{border:1px solid #d1d5db!important;background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out;display:flex;align-items:center;justify-content:space-between}::ng-deep p-select.inline-input-select .p-select-label{border:none}::ng-deep p-select.inline-input-select .p-select-trigger{border:none}::ng-deep .my-app-dark p-select.inline-input-select{border:1px solid transparent!important;background:transparent;color:#f3f4f6}::ng-deep .my-app-dark p-inputnumber .p-inputnumber-input{background-color:#374151;color:#f3f4f6;border-color:transparent}::ng-deep .my-app-dark p-datepicker .p-inputtext{background-color:#374151;color:#f3f4f6}::ng-deep .my-app-dark p-multiselect .p-multiselect-label{background-color:#374151;color:#f3f4f6}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i2.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i4$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i4.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: MultiSelectModule }, { kind: "component", type: i3.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus", "highlightOnSelect"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "ngmodule", type: InputMaskModule }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i8.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: InputOtpModule }, { kind: "component", type: i6.InputOtp, selector: "p-inputOtp, p-inputotp, p-input-otp", inputs: ["invalid", "disabled", "readonly", "variant", "tabindex", "length", "styleClass", "mask", "integerOnly", "autofocus", "size"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: KnobModule }, { kind: "component", type: i9$1.Knob, selector: "p-knob", inputs: ["styleClass", "style", "ariaLabel", "ariaLabelledBy", "tabindex", "valueColor", "rangeColor", "textColor", "valueTemplate", "name", "size", "step", "min", "max", "strokeWidth", "disabled", "showValue", "readonly"], outputs: ["onChange"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i9.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }, { kind: "ngmodule", type: ChipModule }, { kind: "component", type: i11.Chip, selector: "p-chip", inputs: ["label", "icon", "image", "alt", "style", "styleClass", "removable", "removeIcon", "chipProps"], outputs: ["onRemove", "onImageError"] }, { kind: "ngmodule", type: ToggleSwitchModule }, { kind: "component", type: i7.ToggleSwitch, selector: "p-toggleswitch, p-toggleSwitch, p-toggle-switch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
740
|
+
}
|
|
741
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: InlineInputComponent, decorators: [{
|
|
742
|
+
type: Component,
|
|
743
|
+
args: [{ selector: 'lib-inline-input', standalone: true, imports: [
|
|
744
|
+
FormsModule,
|
|
745
|
+
InputTextModule,
|
|
746
|
+
DatePickerModule,
|
|
747
|
+
SelectModule,
|
|
748
|
+
MultiSelectModule,
|
|
749
|
+
InputMaskModule,
|
|
750
|
+
InputNumberModule,
|
|
751
|
+
InputOtpModule,
|
|
752
|
+
KnobModule,
|
|
753
|
+
TextareaModule,
|
|
754
|
+
ChipModule,
|
|
755
|
+
ToggleSwitchModule,
|
|
756
|
+
CommonModule
|
|
757
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
758
|
+
{
|
|
759
|
+
provide: NG_VALUE_ACCESSOR,
|
|
760
|
+
useExisting: forwardRef(() => InlineInputComponent),
|
|
761
|
+
multi: true
|
|
762
|
+
}
|
|
763
|
+
], template: "@let valueInput = value();\n@let isDisabled = config().isDisabled ?? false;\n@let knobConfig = config().knobConfig;\n@let textareaConfig = config().textareaConfig;\n@let dateConfig = config().dateConfig;\n\n@switch (type) {\n@case (ETypeInput.CURRENCY) {\n<p-inputnumber [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" mode=\"currency\" [currency]=\"currency\" [locale]=\"locale\"\n [minFractionDigits]=\"minFractionDigits\" [maxFractionDigits]=\"maxFractionDigits\" class=\"w-full\"\n [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.DECIMAL) {\n<p-inputnumber [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" mode=\"decimal\" [locale]=\"locale\" [minFractionDigits]=\"2\" [maxFractionDigits]=\"2\"\n [useGrouping]=\"true\" class=\"w-full\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.DATE) {\n<p-datepicker [ngModel]=\"valueInput\" appendTo=\"body\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" class=\"w-full\" [disabled]=\"isDisabled\" [maxDate]=\"dateConfig?.maxDate || null\"\n [minDate]=\"dateConfig?.minDate || null\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\" />\n}\n@case (ETypeInput.DATETIME_LOCAL) {\n<p-datepicker [ngModel]=\"valueInput\" appendTo=\"body\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\" class=\"w-full\" [showTime]=\"true\" [hourFormat]=\"'24'\" [disabled]=\"isDisabled\"\n [maxDate]=\"dateConfig?.maxDate || null\" [minDate]=\"dateConfig?.minDate || null\" [selectionMode]=\"dateConfig?.selectionMode || 'single'\" />\n}\n@case (ETypeInput.SELECT) {\n<p-select [options]=\"config().selectConfig?.options ?? []\" [optionLabel]=\"config().selectConfig?.optionLabel ?? 'name'\"\n [(ngModel)]=\"valueSelect\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\"\n appendTo=\"body\" class=\"w-full inline-input-select\" [disabled]=\"config().isDisabled ?? false\" >\n @for (template of templates; track $index) {\n <ng-template [pTemplate]=\"template.getType()\" let-item>\n <ng-container *ngTemplateOutlet=\"template.template; context: { $implicit: item }\"></ng-container>\n </ng-template>\n }\n</p-select>\n}\n@case (ETypeInput.MULTISELECT) {\n<p-multiselect [options]=\"config().multiSelectConfig?.options ?? []\"\n [optionLabel]=\"config().multiSelectConfig?.optionLabel ?? 'name'\" [ngModel]=\"valueInput\"\n (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [filter]=\"true\"\n appendTo=\"body\" class=\"w-full\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.OTP) {\n<p-inputotp class=\"w-full\" [mask]=\"config().otpConfig?.mask ?? false\" [length]=\"config().otpConfig?.length ?? 6\"\n [integerOnly]=\"config().otpConfig?.integerOnly ?? false\" [ngModel]=\"valueInput\"\n (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [disabled]=\"isDisabled\" />\n}\n@case (ETypeInput.KNOB) {\n<p-knob [ngModel]=\"knobValueInput()\" (ngModelChange)=\"onChangeValue($event)\" class=\"w-full\" [min]=\"knobConfig?.min ?? 0\"\n [max]=\"knobConfig?.max ?? 100\" [step]=\"knobConfig?.step ?? 1\" [disabled]=\"isDisabled\" [readonly]=\"true\"\n [valueTemplate]=\"knobValueTemplate()\" [size]=\"knobConfig?.size ?? 100\" />\n}\n@case (ETypeInput.TEXTAREA) {\n<textarea class=\"w-full h-full p-2 border border-gray-300 rounded-md\" pTextarea [rows]=\"textareaConfig?.rows ?? 3\"\n [cols]=\"textareaConfig?.cols ?? 30\" [autoResize]=\"true\" [variant]=\"textareaConfig?.variant ?? 'outlined'\"\n [disabled]=\"isDisabled\" [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (blur)=\"onBlur()\"\n (keydown)=\"onKeyDown($event)\"></textarea>\n}\n@case (ETypeInput.CHIPS) {\n<div class=\"chips-input-wrapper\">\n <div\n class=\"chips-container w-full p-2 border border-gray-300 rounded-md min-h-[40px] flex flex-wrap items-center gap-2\"\n [class.border-red-500]=\"showDuplicateMessage\">\n @for (chip of chips; track $index) {\n <p-chip [label]=\"chip\" [removable]=\"!isDisabled\" (onRemove)=\"removeChip($index)\" class=\"chip-item\" />\n }\n <input type=\"text\" class=\"chip-input flex-1 border-0 outline-0 bg-transparent min-w-[100px]\" [value]=\"currentInput\"\n (input)=\"onChipInputChange($event)\" (keydown)=\"onChipKeydown($event); onKeyDown($event)\"\n (paste)=\"onChipPaste($event)\" [disabled]=\"isDisabled\"\n placeholder=\"Escribe o pega elementos separados por espacios...\" />\n </div>\n @if (showDuplicateMessage) {\n <div class=\"duplicate-message text-red-500 text-sm mt-1 flex items-center gap-1\">\n <i class=\"pi pi-exclamation-triangle text-red-500\"></i>\n <span>\n @if (duplicateChips.length === 1) {\n El elemento \"<strong>{{ duplicatesText }}</strong>\" ya existe en la lista\n } @else {\n Los elementos \"<strong>{{ duplicatesText }}</strong>\" ya existen en la lista\n }\n </span>\n </div>\n }\n</div>\n}\n@case (ETypeInput.SWITCH) {\n<div class=\"flex justify-center items-center p-2\">\n <p-toggleswitch [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\" (onBlur)=\"onBlur()\"\n class=\"w-full\" [disabled]=\"isDisabled\" />\n</div>\n}\n@default {\n<input pInputText class=\"w-full h-full p-2 border border-gray-300 rounded-md\" [type]=\"type\"\n [readOnly]=\"config().readonly ?? false\" [ngModel]=\"valueInput\" (ngModelChange)=\"onChangeValue($event)\"\n (blur)=\"onBlur()\" (keydown)=\"onKeyDown($event)\" [disabled]=\"isDisabled\" />\n}\n}", styles: [":host{width:100%;height:100%}.chips-input-wrapper{width:100%}.chips-input-wrapper .chips-container{cursor:text;transition:border-color .2s ease,box-shadow .2s ease}.chips-input-wrapper .chips-container:focus-within{border-color:#007ad9;box-shadow:0 0 0 1px #007ad9}.chips-input-wrapper .chips-container.border-red-500{border-color:#ef4444!important;box-shadow:0 0 0 1px #ef4444!important}.chips-input-wrapper .chips-container .chip-item{margin:0}.chips-input-wrapper .chips-container .chip-input:focus{outline:none}.chips-input-wrapper .chips-container .chip-input::placeholder{color:#6b7280;font-style:italic}.chips-input-wrapper .duplicate-message{animation:slideDown .3s ease-out}.chips-input-wrapper .duplicate-message i{font-size:14px}@keyframes slideDown{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}::ng-deep p-select.inline-input-select{border:1px solid #d1d5db!important;background:transparent;color:#111827;height:44px;width:100%;border-radius:.5rem;transition:all .2s ease-in-out;display:flex;align-items:center;justify-content:space-between}::ng-deep p-select.inline-input-select .p-select-label{border:none}::ng-deep p-select.inline-input-select .p-select-trigger{border:none}::ng-deep .my-app-dark p-select.inline-input-select{border:1px solid transparent!important;background:transparent;color:#f3f4f6}::ng-deep .my-app-dark p-inputnumber .p-inputnumber-input{background-color:#374151;color:#f3f4f6;border-color:transparent}::ng-deep .my-app-dark p-datepicker .p-inputtext{background-color:#374151;color:#f3f4f6}::ng-deep .my-app-dark p-multiselect .p-multiselect-label{background-color:#374151;color:#f3f4f6}\n"] }]
|
|
764
|
+
}], ctorParameters: () => [], propDecorators: { templates: [{
|
|
765
|
+
type: ContentChildren,
|
|
766
|
+
args: [PrimeTemplate]
|
|
767
|
+
}] } });
|
|
768
|
+
|
|
769
|
+
class AminatedContainerComponent {
|
|
770
|
+
isLoading = true;
|
|
771
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AminatedContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
772
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: AminatedContainerComponent, isStandalone: true, selector: "lib-aminated-container", ngImport: i0, template: "<div class=\"fade-in-container\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: ["@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.fade-in-container{animation:fadeIn .8s ease-out forwards;opacity:0;transform:translateY(10px)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }] });
|
|
773
|
+
}
|
|
774
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AminatedContainerComponent, decorators: [{
|
|
775
|
+
type: Component,
|
|
776
|
+
args: [{ selector: 'lib-aminated-container', imports: [CommonModule], template: "<div class=\"fade-in-container\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: ["@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.fade-in-container{animation:fadeIn .8s ease-out forwards;opacity:0;transform:translateY(10px)}\n"] }]
|
|
777
|
+
}] });
|
|
778
|
+
|
|
779
|
+
class AppButtonNgService {
|
|
780
|
+
buttonConfig = signal({});
|
|
781
|
+
constructor() {
|
|
782
|
+
// Effect para manejar automáticamente la rotación de mensajes
|
|
783
|
+
effect(() => {
|
|
784
|
+
const config = this.buttonConfig();
|
|
785
|
+
if (config.loading && config.loadingMessages && config.loadingMessages.length > 1) {
|
|
786
|
+
this.startMessageRotation();
|
|
787
|
+
}
|
|
788
|
+
else {
|
|
789
|
+
this.stopMessageRotation();
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
setButtonConfig(buttonConfig) {
|
|
794
|
+
this.buttonConfig.set(buttonConfig);
|
|
795
|
+
}
|
|
796
|
+
// Computed público para acceder al label dinámico
|
|
797
|
+
label = computed(() => {
|
|
798
|
+
const config = this.buttonConfig();
|
|
799
|
+
// Si está cargando y tiene mensajes de carga, rotar entre ellos
|
|
800
|
+
if (config.loading && config.loadingMessages && config.loadingMessages.length > 0) {
|
|
801
|
+
const messages = config.loadingMessages;
|
|
802
|
+
const index = this.messageIndex() % messages.length; // Wrap around
|
|
803
|
+
return messages[index];
|
|
804
|
+
}
|
|
805
|
+
// Si no está cargando, retornar el label normal
|
|
806
|
+
return config.label ? config.label : '';
|
|
807
|
+
});
|
|
808
|
+
//#region Loading Messages
|
|
809
|
+
messageIndex = signal(0);
|
|
810
|
+
intervalId;
|
|
811
|
+
startMessageRotation() {
|
|
812
|
+
if (this.intervalId)
|
|
813
|
+
return;
|
|
814
|
+
this.intervalId = setInterval(() => {
|
|
815
|
+
this.messageIndex.update(index => index + 1);
|
|
816
|
+
}, 6000);
|
|
817
|
+
}
|
|
818
|
+
stopMessageRotation() {
|
|
819
|
+
if (this.intervalId) {
|
|
820
|
+
clearInterval(this.intervalId);
|
|
821
|
+
this.intervalId = undefined;
|
|
822
|
+
this.messageIndex.set(0);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AppButtonNgService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
826
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AppButtonNgService, providedIn: 'root' });
|
|
827
|
+
}
|
|
828
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AppButtonNgService, decorators: [{
|
|
829
|
+
type: Injectable,
|
|
830
|
+
args: [{
|
|
831
|
+
providedIn: 'root'
|
|
832
|
+
}]
|
|
833
|
+
}], ctorParameters: () => [] });
|
|
834
|
+
|
|
835
|
+
class ButtonNgComponent {
|
|
836
|
+
appButtonNgService = inject(AppButtonNgService);
|
|
837
|
+
buttonConfig = model.required();
|
|
838
|
+
onClick = output();
|
|
839
|
+
constructor() {
|
|
840
|
+
effect(() => {
|
|
841
|
+
this.appButtonNgService.setButtonConfig(this.buttonConfig());
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
get label() {
|
|
845
|
+
return this.appButtonNgService.label();
|
|
846
|
+
}
|
|
847
|
+
onClickButton() {
|
|
848
|
+
if (this.buttonConfig().onClick) {
|
|
849
|
+
return;
|
|
850
|
+
}
|
|
851
|
+
this.onClick.emit();
|
|
852
|
+
}
|
|
853
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ButtonNgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
854
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: ButtonNgComponent, isStandalone: true, selector: "lib-button-ng", inputs: { buttonConfig: { classPropertyName: "buttonConfig", publicName: "buttonConfig", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { buttonConfig: "buttonConfigChange", onClick: "onClick" }, providers: [AppButtonNgService], ngImport: i0, template: "@let config = buttonConfig(); @let tooltipConfig = buttonConfig().tooltipConfig;\r\n@if (!config.hideButton) {\r\n <div\r\n [ngClass]=\"{\r\n 'full-width-button': config.fullWidth,\r\n 'full-height-button': config.fullHeight,\r\n 'cursor-pointer': this.onClick\r\n }\"\r\n [class]=\"config.class ?? ''\"\r\n >\r\n <p-button\r\n [label]=\"config.hasTemplate ? undefined : label\"\r\n [icon]=\"config.hasTemplate ? undefined : config.icon\"\r\n [severity]=\"config.hasTemplate ? 'secondary' : config.severity\"\r\n [loading]=\"config.loading || false\"\r\n [disabled]=\"config.disabled || false\"\r\n [rounded]=\"config.rounded || false\"\r\n [raised]=\"config.raised || false\"\r\n [variant]=\"config.hasTemplate ? 'text' : config.variant\"\r\n [badge]=\"config.badge\"\r\n (onClick)=\"config?.onClick?.() ?? onClickButton()\"\r\n [size]=\"config?.size\"\r\n pTooltip=\"{{ tooltipConfig?.pTooltip }}\"\r\n [tooltipPosition]=\"tooltipConfig?.tooltipPosition ?? 'top'\"\r\n [iconPos]=\"config?.iconPos ?? 'left'\"\r\n [ngClass]=\"{\r\n 'cursor-pointer': (config.onClick || config.hasStaticClick) && !config.disabled,\r\n 'cursor-auto': !((config.onClick || config.hasStaticClick) && !config.disabled),\r\n 'no-hover-template': config.hasTemplate\r\n }\"\r\n [outlined]=\"config.outlined || false\"\r\n [text]=\"config.text || false\"\r\n >\r\n @if (config.hasTemplate) {\r\n <ng-content></ng-content>\r\n }\r\n </p-button>\r\n </div>\r\n}\r\n", styles: [".full-width-button ::ng-deep p-button button{width:100%}.full-height-button ::ng-deep p-button button{height:100%}::ng-deep .cursor-auto button{cursor:auto!important}::ng-deep .cursor-pointer button{cursor:pointer!important}::ng-deep .no-hover-template button{background:transparent!important;border:none!important;box-shadow:none!important;padding:0!important}::ng-deep .no-hover-template button:hover,::ng-deep .no-hover-template button:focus,::ng-deep .no-hover-template button:active{background:transparent!important;border:none!important;box-shadow:none!important}\n"], dependencies: [{ kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1$2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i10.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
|
|
855
|
+
}
|
|
856
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ButtonNgComponent, decorators: [{
|
|
857
|
+
type: Component,
|
|
858
|
+
args: [{ selector: 'lib-button-ng', imports: [
|
|
859
|
+
ButtonModule,
|
|
860
|
+
TooltipModule,
|
|
861
|
+
CommonModule
|
|
862
|
+
], providers: [AppButtonNgService], template: "@let config = buttonConfig(); @let tooltipConfig = buttonConfig().tooltipConfig;\r\n@if (!config.hideButton) {\r\n <div\r\n [ngClass]=\"{\r\n 'full-width-button': config.fullWidth,\r\n 'full-height-button': config.fullHeight,\r\n 'cursor-pointer': this.onClick\r\n }\"\r\n [class]=\"config.class ?? ''\"\r\n >\r\n <p-button\r\n [label]=\"config.hasTemplate ? undefined : label\"\r\n [icon]=\"config.hasTemplate ? undefined : config.icon\"\r\n [severity]=\"config.hasTemplate ? 'secondary' : config.severity\"\r\n [loading]=\"config.loading || false\"\r\n [disabled]=\"config.disabled || false\"\r\n [rounded]=\"config.rounded || false\"\r\n [raised]=\"config.raised || false\"\r\n [variant]=\"config.hasTemplate ? 'text' : config.variant\"\r\n [badge]=\"config.badge\"\r\n (onClick)=\"config?.onClick?.() ?? onClickButton()\"\r\n [size]=\"config?.size\"\r\n pTooltip=\"{{ tooltipConfig?.pTooltip }}\"\r\n [tooltipPosition]=\"tooltipConfig?.tooltipPosition ?? 'top'\"\r\n [iconPos]=\"config?.iconPos ?? 'left'\"\r\n [ngClass]=\"{\r\n 'cursor-pointer': (config.onClick || config.hasStaticClick) && !config.disabled,\r\n 'cursor-auto': !((config.onClick || config.hasStaticClick) && !config.disabled),\r\n 'no-hover-template': config.hasTemplate\r\n }\"\r\n [outlined]=\"config.outlined || false\"\r\n [text]=\"config.text || false\"\r\n >\r\n @if (config.hasTemplate) {\r\n <ng-content></ng-content>\r\n }\r\n </p-button>\r\n </div>\r\n}\r\n", styles: [".full-width-button ::ng-deep p-button button{width:100%}.full-height-button ::ng-deep p-button button{height:100%}::ng-deep .cursor-auto button{cursor:auto!important}::ng-deep .cursor-pointer button{cursor:pointer!important}::ng-deep .no-hover-template button{background:transparent!important;border:none!important;box-shadow:none!important;padding:0!important}::ng-deep .no-hover-template button:hover,::ng-deep .no-hover-template button:focus,::ng-deep .no-hover-template button:active{background:transparent!important;border:none!important;box-shadow:none!important}\n"] }]
|
|
863
|
+
}], ctorParameters: () => [] });
|
|
864
|
+
|
|
865
|
+
class KeyToDisplayNamePipe {
|
|
866
|
+
transform(key, keysNames) {
|
|
867
|
+
return keysNames?.[key] ?? key;
|
|
868
|
+
}
|
|
869
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeyToDisplayNamePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
870
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.17", ngImport: i0, type: KeyToDisplayNamePipe, isStandalone: true, name: "keyToDisplayName" });
|
|
871
|
+
}
|
|
872
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: KeyToDisplayNamePipe, decorators: [{
|
|
873
|
+
type: Pipe,
|
|
874
|
+
args: [{
|
|
875
|
+
name: 'keyToDisplayName'
|
|
876
|
+
}]
|
|
877
|
+
}] });
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* Utilidades para manejar errores de API según la interfaz IApiError
|
|
881
|
+
*/
|
|
882
|
+
class ApiErrorUtil {
|
|
883
|
+
/**
|
|
884
|
+
* Procesa errores de API y extrae el mensaje según la interfaz IApiError
|
|
885
|
+
* @param error - El error HTTP recibido
|
|
886
|
+
* @param fallbackMessage - Mensaje por defecto si no se puede extraer el mensaje del error
|
|
887
|
+
* @returns El mensaje de error procesado
|
|
888
|
+
*/
|
|
889
|
+
static handleApiError(error, fallbackMessage) {
|
|
890
|
+
const apiError = error.error;
|
|
891
|
+
const errorMessage = Array.isArray(apiError?.message)
|
|
892
|
+
? apiError.message.join(', ')
|
|
893
|
+
: apiError?.message ?? fallbackMessage;
|
|
894
|
+
return errorMessage;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Procesa errores de API con información detallada de campos
|
|
898
|
+
* y muestra tanto el mensaje general como los errores específicos de campo
|
|
899
|
+
* @param error - El error HTTP recibido
|
|
900
|
+
* @param fallbackMessage - Mensaje por defecto si no se puede extraer el mensaje del error
|
|
901
|
+
* @returns El mensaje de error procesado con información de campos si está disponible
|
|
902
|
+
*/
|
|
903
|
+
static handleApiErrorWithFields(error, fallbackMessage) {
|
|
904
|
+
const apiError = error.error;
|
|
905
|
+
let errorMessage = Array.isArray(apiError?.message)
|
|
906
|
+
? apiError.message.join(', ')
|
|
907
|
+
: apiError?.message ?? fallbackMessage;
|
|
908
|
+
// Si hay errores de campo específicos, los agregamos al mensaje
|
|
909
|
+
if (apiError?.errors && apiError.errors.length > 0) {
|
|
910
|
+
const fieldErrors = apiError.errors
|
|
911
|
+
.map(fieldError => `${fieldError.field}: ${fieldError.message}`)
|
|
912
|
+
.join(', ');
|
|
913
|
+
errorMessage = `${errorMessage}. Errores de campos: ${fieldErrors}`;
|
|
914
|
+
}
|
|
915
|
+
return errorMessage;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Obtiene solo los errores de campo específicos
|
|
919
|
+
* @param error - El error HTTP recibido
|
|
920
|
+
* @returns Array de errores de campo o array vacío si no hay errores
|
|
921
|
+
*/
|
|
922
|
+
static getFieldErrors(error) {
|
|
923
|
+
const apiError = error.error;
|
|
924
|
+
return apiError?.errors ?? [];
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Verifica si el error tiene errores de campo específicos
|
|
928
|
+
* @param error - El error HTTP recibido
|
|
929
|
+
* @returns true si hay errores de campo, false en caso contrario
|
|
930
|
+
*/
|
|
931
|
+
static hasFieldErrors(error) {
|
|
932
|
+
const apiError = error.error;
|
|
933
|
+
return apiError?.errors && apiError.errors.length > 0;
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Obtiene el código de error específico
|
|
937
|
+
* @param error - El error HTTP recibido
|
|
938
|
+
* @returns El código de error o undefined si no está disponible
|
|
939
|
+
*/
|
|
940
|
+
static getErrorCode(error) {
|
|
941
|
+
const apiError = error.error;
|
|
942
|
+
return apiError?.errorCode;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Obtiene el timestamp del error
|
|
946
|
+
* @param error - El error HTTP recibido
|
|
947
|
+
* @returns El timestamp del error o undefined si no está disponible
|
|
948
|
+
*/
|
|
949
|
+
static getErrorTimestamp(error) {
|
|
950
|
+
const apiError = error.error;
|
|
951
|
+
return apiError?.timestamp;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
class CookieUtil {
|
|
956
|
+
/**
|
|
957
|
+
* Obtiene el valor de una cookie por su nombre
|
|
958
|
+
* @param name - Nombre de la cookie
|
|
959
|
+
* @returns El valor de la cookie o null si no existe
|
|
960
|
+
*/
|
|
961
|
+
static getCookie(name) {
|
|
962
|
+
if (typeof document === 'undefined') {
|
|
963
|
+
return null;
|
|
964
|
+
}
|
|
965
|
+
const nameEQ = name + '=';
|
|
966
|
+
const ca = document.cookie.split(';');
|
|
967
|
+
for (let i = 0; i < ca.length; i++) {
|
|
968
|
+
let c = ca[i];
|
|
969
|
+
while (c.charAt(0) === ' ') {
|
|
970
|
+
c = c.substring(1, c.length);
|
|
971
|
+
}
|
|
972
|
+
if (c.indexOf(nameEQ) === 0) {
|
|
973
|
+
return c.substring(nameEQ.length, c.length);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Establece una cookie
|
|
980
|
+
* @param name - Nombre de la cookie
|
|
981
|
+
* @param value - Valor de la cookie
|
|
982
|
+
* @param days - Días hasta que expire (por defecto 365)
|
|
983
|
+
* @param path - Ruta de la cookie (por defecto '/')
|
|
984
|
+
*/
|
|
985
|
+
static setCookie(name, value, days = 365, path = '/') {
|
|
986
|
+
if (typeof document === 'undefined') {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
let expires = '';
|
|
990
|
+
if (days) {
|
|
991
|
+
const date = new Date();
|
|
992
|
+
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
993
|
+
expires = '; expires=' + date.toUTCString();
|
|
994
|
+
}
|
|
995
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=' + path;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Elimina una cookie
|
|
999
|
+
* @param name - Nombre de la cookie a eliminar
|
|
1000
|
+
* @param path - Ruta de la cookie (por defecto '/')
|
|
1001
|
+
*/
|
|
1002
|
+
static eraseCookie(name, path = '/') {
|
|
1003
|
+
if (typeof document === 'undefined') {
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
document.cookie = name + '=; Path=' + path + '; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Obtiene un valor booleano desde una cookie
|
|
1010
|
+
* @param name - Nombre de la cookie
|
|
1011
|
+
* @param defaultValue - Valor por defecto si la cookie no existe
|
|
1012
|
+
* @returns El valor booleano
|
|
1013
|
+
*/
|
|
1014
|
+
static getBooleanCookie(name, defaultValue = false) {
|
|
1015
|
+
const value = this.getCookie(name);
|
|
1016
|
+
if (value === null) {
|
|
1017
|
+
return defaultValue;
|
|
1018
|
+
}
|
|
1019
|
+
return value === 'true';
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Establece un valor booleano en una cookie
|
|
1023
|
+
* @param name - Nombre de la cookie
|
|
1024
|
+
* @param value - Valor booleano
|
|
1025
|
+
* @param days - Días hasta que expire (por defecto 365)
|
|
1026
|
+
* @param path - Ruta de la cookie (por defecto '/')
|
|
1027
|
+
*/
|
|
1028
|
+
static setBooleanCookie(name, value, days = 365, path = '/') {
|
|
1029
|
+
this.setCookie(name, value.toString(), days, path);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
const formatCurrency = (amount, currency) => {
|
|
1034
|
+
return new Intl.NumberFormat('es-CO', {
|
|
1035
|
+
style: 'currency',
|
|
1036
|
+
currency: currency || 'COP'
|
|
1037
|
+
}).format(amount);
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
const isSameDay = (date1, date2) => {
|
|
1041
|
+
const date1Copy = new Date(date1.setHours(0, 0, 0, 0));
|
|
1042
|
+
const date2Copy = new Date(date2.setHours(0, 0, 0, 0));
|
|
1043
|
+
return date1Copy.getTime() === date2Copy.getTime();
|
|
1044
|
+
};
|
|
1045
|
+
const formatDateDMA = (date) => {
|
|
1046
|
+
return new Date(date).toLocaleDateString('es-CO', {
|
|
1047
|
+
year: 'numeric',
|
|
1048
|
+
month: '2-digit',
|
|
1049
|
+
day: '2-digit'
|
|
1050
|
+
});
|
|
1051
|
+
};
|
|
1052
|
+
// Crea una funcion que tambien muestre la hora
|
|
1053
|
+
const formatDateDMAWithTime = (date) => {
|
|
1054
|
+
return new Date(date).toLocaleDateString('es-CO', {
|
|
1055
|
+
year: 'numeric',
|
|
1056
|
+
month: '2-digit',
|
|
1057
|
+
day: '2-digit',
|
|
1058
|
+
hour: '2-digit',
|
|
1059
|
+
minute: '2-digit'
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Enum con los tipos de archivos más relevantes para la aplicación
|
|
1065
|
+
*/
|
|
1066
|
+
var EFileType;
|
|
1067
|
+
(function (EFileType) {
|
|
1068
|
+
// Documentos
|
|
1069
|
+
EFileType["PDF"] = "application/pdf";
|
|
1070
|
+
EFileType["DOC"] = "application/msword";
|
|
1071
|
+
EFileType["DOCX"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
1072
|
+
EFileType["XLS"] = "application/vnd.ms-excel";
|
|
1073
|
+
EFileType["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
1074
|
+
EFileType["PPT"] = "application/vnd.ms-powerpoint";
|
|
1075
|
+
EFileType["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
1076
|
+
EFileType["TXT"] = "text/plain";
|
|
1077
|
+
EFileType["RTF"] = "application/rtf";
|
|
1078
|
+
// Imágenes
|
|
1079
|
+
EFileType["JPG"] = "image/jpeg";
|
|
1080
|
+
EFileType["PNG"] = "image/png";
|
|
1081
|
+
EFileType["GIF"] = "image/gif";
|
|
1082
|
+
EFileType["BMP"] = "image/bmp";
|
|
1083
|
+
EFileType["SVG"] = "image/svg+xml";
|
|
1084
|
+
EFileType["WEBP"] = "image/webp";
|
|
1085
|
+
// Archivos comprimidos
|
|
1086
|
+
EFileType["ZIP"] = "application/zip";
|
|
1087
|
+
EFileType["RAR"] = "application/vnd.rar";
|
|
1088
|
+
EFileType["TAR"] = "application/x-tar";
|
|
1089
|
+
EFileType["GZ"] = "application/gzip";
|
|
1090
|
+
// Archivos de datos
|
|
1091
|
+
EFileType["CSV"] = "text/csv";
|
|
1092
|
+
EFileType["JSON"] = "application/json";
|
|
1093
|
+
EFileType["XML"] = "application/xml";
|
|
1094
|
+
// Archivos de audio
|
|
1095
|
+
EFileType["MP3"] = "audio/mpeg";
|
|
1096
|
+
EFileType["WAV"] = "audio/wav";
|
|
1097
|
+
EFileType["OGG"] = "audio/ogg";
|
|
1098
|
+
// Archivos de video
|
|
1099
|
+
EFileType["MP4"] = "video/mp4";
|
|
1100
|
+
EFileType["AVI"] = "video/x-msvideo";
|
|
1101
|
+
EFileType["MOV"] = "video/quicktime";
|
|
1102
|
+
EFileType["WMV"] = "video/x-ms-wmv";
|
|
1103
|
+
// Todos los tipos de imagen
|
|
1104
|
+
EFileType["ALL_IMAGES"] = "image/*";
|
|
1105
|
+
// Todos los tipos de documento
|
|
1106
|
+
EFileType["ALL_DOCUMENTS"] = "application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,text/plain,application/rtf";
|
|
1107
|
+
// Todos los tipos de archivo
|
|
1108
|
+
EFileType["ALL_FILES"] = "*/*";
|
|
1109
|
+
})(EFileType || (EFileType = {}));
|
|
1110
|
+
/**
|
|
1111
|
+
* Método mejorado para abrir el selector de archivos
|
|
1112
|
+
* @param options - Opciones para configurar el input de archivo
|
|
1113
|
+
*/
|
|
1114
|
+
const triggerFileInput = (options = {}) => {
|
|
1115
|
+
const { accept = EFileType.ALL_FILES, multiple = false, onFileSelected } = options;
|
|
1116
|
+
const input = document.createElement('input');
|
|
1117
|
+
input.type = 'file';
|
|
1118
|
+
input.accept = accept;
|
|
1119
|
+
input.multiple = multiple;
|
|
1120
|
+
input.style.display = 'none';
|
|
1121
|
+
input.onchange = (event) => {
|
|
1122
|
+
const target = event.target;
|
|
1123
|
+
const files = target.files;
|
|
1124
|
+
if (files && files.length > 0 && onFileSelected) {
|
|
1125
|
+
if (multiple) {
|
|
1126
|
+
// Si es múltiple, llamar al callback con todos los archivos
|
|
1127
|
+
Array.from(files).forEach(file => {
|
|
1128
|
+
onFileSelected(file);
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
// Si es único, llamar al callback con el primer archivo
|
|
1133
|
+
const file = files[0];
|
|
1134
|
+
onFileSelected(file);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
document.body.removeChild(input);
|
|
1138
|
+
};
|
|
1139
|
+
document.body.appendChild(input);
|
|
1140
|
+
input.click();
|
|
1141
|
+
};
|
|
1142
|
+
/**
|
|
1143
|
+
* Función para capturar una foto usando la cámara
|
|
1144
|
+
*/
|
|
1145
|
+
const capturePhotoFromCamera = async (options = {}) => {
|
|
1146
|
+
const { quality = 0.9, facingMode = 'environment', onPhotoTaken, onError } = options;
|
|
1147
|
+
try {
|
|
1148
|
+
if (!navigator.mediaDevices?.getUserMedia) {
|
|
1149
|
+
throw new Error('Cámara no soportada en este navegador');
|
|
1150
|
+
}
|
|
1151
|
+
const stream = await navigator.mediaDevices.getUserMedia({
|
|
1152
|
+
video: { facingMode }
|
|
1153
|
+
});
|
|
1154
|
+
const video = document.createElement('video');
|
|
1155
|
+
const canvas = document.createElement('canvas');
|
|
1156
|
+
const context = canvas.getContext('2d');
|
|
1157
|
+
// Crear modal
|
|
1158
|
+
const modal = document.createElement('div');
|
|
1159
|
+
modal.style.cssText = `
|
|
1160
|
+
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
|
1161
|
+
background: rgba(0,0,0,0.9); display: flex; flex-direction: column;
|
|
1162
|
+
align-items: center; justify-content: center; z-index: 10000;
|
|
1163
|
+
`;
|
|
1164
|
+
video.style.cssText = 'width: 80%; max-width: 500px; border-radius: 8px;';
|
|
1165
|
+
video.srcObject = stream;
|
|
1166
|
+
video.autoplay = true;
|
|
1167
|
+
video.playsInline = true;
|
|
1168
|
+
const buttonsDiv = document.createElement('div');
|
|
1169
|
+
buttonsDiv.style.cssText = 'display: flex; gap: 20px; margin-top: 20px;';
|
|
1170
|
+
const captureBtn = document.createElement('button');
|
|
1171
|
+
captureBtn.textContent = 'Tomar Foto';
|
|
1172
|
+
captureBtn.style.cssText = `
|
|
1173
|
+
padding: 12px 24px; background: #007bff; color: white;
|
|
1174
|
+
border: none; border-radius: 6px; cursor: pointer; font-size: 16px;
|
|
1175
|
+
`;
|
|
1176
|
+
const cancelBtn = document.createElement('button');
|
|
1177
|
+
cancelBtn.textContent = 'Cancelar';
|
|
1178
|
+
cancelBtn.style.cssText = `
|
|
1179
|
+
padding: 12px 24px; background: #6c757d; color: white;
|
|
1180
|
+
border: none; border-radius: 6px; cursor: pointer; font-size: 16px;
|
|
1181
|
+
`;
|
|
1182
|
+
const cleanup = () => {
|
|
1183
|
+
stream.getTracks().forEach(track => track.stop());
|
|
1184
|
+
modal.remove();
|
|
1185
|
+
};
|
|
1186
|
+
captureBtn.onclick = () => {
|
|
1187
|
+
canvas.width = video.videoWidth;
|
|
1188
|
+
canvas.height = video.videoHeight;
|
|
1189
|
+
context.drawImage(video, 0, 0);
|
|
1190
|
+
canvas.toBlob((blob) => {
|
|
1191
|
+
if (blob && onPhotoTaken) {
|
|
1192
|
+
const file = new File([blob], `photo-${Date.now()}.jpg`, { type: 'image/jpeg' });
|
|
1193
|
+
onPhotoTaken(file);
|
|
1194
|
+
}
|
|
1195
|
+
cleanup();
|
|
1196
|
+
}, 'image/jpeg', quality);
|
|
1197
|
+
};
|
|
1198
|
+
cancelBtn.onclick = cleanup;
|
|
1199
|
+
document.addEventListener('keydown', (e) => {
|
|
1200
|
+
if (e.key === 'Escape')
|
|
1201
|
+
cleanup();
|
|
1202
|
+
});
|
|
1203
|
+
buttonsDiv.append(captureBtn, cancelBtn);
|
|
1204
|
+
modal.append(video, buttonsDiv);
|
|
1205
|
+
document.body.appendChild(modal);
|
|
1206
|
+
}
|
|
1207
|
+
catch (error) {
|
|
1208
|
+
if (onError)
|
|
1209
|
+
onError(error);
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
var EFileIcons;
|
|
1213
|
+
(function (EFileIcons) {
|
|
1214
|
+
EFileIcons["FILE"] = "file";
|
|
1215
|
+
EFileIcons["IMAGE"] = "image";
|
|
1216
|
+
EFileIcons["VIDEO"] = "video";
|
|
1217
|
+
EFileIcons["FOLDER"] = "folder";
|
|
1218
|
+
EFileIcons["EXCEL"] = "excel";
|
|
1219
|
+
EFileIcons["SIGNATURE"] = "signature";
|
|
1220
|
+
EFileIcons["CONTRACT"] = "contract";
|
|
1221
|
+
EFileIcons["FINGERPRINT"] = "fingerprint";
|
|
1222
|
+
EFileIcons["ID_CARD"] = "id_card";
|
|
1223
|
+
EFileIcons["FILE_BOX"] = "file_box";
|
|
1224
|
+
EFileIcons["SECURE_BUILDING"] = "secure_building";
|
|
1225
|
+
EFileIcons["POLICE"] = "police";
|
|
1226
|
+
})(EFileIcons || (EFileIcons = {}));
|
|
1227
|
+
const DocumentIcon = {
|
|
1228
|
+
[EFileIcons.FILE]: 'fa-solid fa-file-lines',
|
|
1229
|
+
[EFileIcons.IMAGE]: 'fa-solid fa-file-image',
|
|
1230
|
+
[EFileIcons.VIDEO]: 'fa-solid fa-file-video',
|
|
1231
|
+
[EFileIcons.FOLDER]: 'fa-solid fa-folder',
|
|
1232
|
+
[EFileIcons.EXCEL]: 'fa-solid fa-file-excel',
|
|
1233
|
+
[EFileIcons.SIGNATURE]: 'fa-solid fa-signature',
|
|
1234
|
+
[EFileIcons.CONTRACT]: 'fa-solid fa-file-contract',
|
|
1235
|
+
[EFileIcons.FINGERPRINT]: 'fa-solid fa-fingerprint',
|
|
1236
|
+
[EFileIcons.ID_CARD]: 'fa-solid fa-id-card',
|
|
1237
|
+
[EFileIcons.SECURE_BUILDING]: 'fa-solid fa-building-shield',
|
|
1238
|
+
[EFileIcons.POLICE]: 'fa-solid fa-hand-middle-finger',
|
|
1239
|
+
[EFileIcons.FILE_BOX]: 'fa-solid fa-box-archive'
|
|
1240
|
+
};
|
|
1241
|
+
const downloadFile = (blob, fileName) => {
|
|
1242
|
+
const url = window.URL.createObjectURL(blob);
|
|
1243
|
+
const link = document.createElement('a');
|
|
1244
|
+
link.href = url;
|
|
1245
|
+
link.download = fileName;
|
|
1246
|
+
document.body.appendChild(link);
|
|
1247
|
+
link.click();
|
|
1248
|
+
document.body.removeChild(link);
|
|
1249
|
+
window.URL.revokeObjectURL(url);
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
//sin uuid, codigo propio
|
|
1253
|
+
const generateId = () => {
|
|
1254
|
+
return Date.now().toString(36) + Math.random().toString(36).substring(2, 15);
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
const formatNumber = (number) => {
|
|
1258
|
+
return new Intl.NumberFormat('es-CO', {
|
|
1259
|
+
minimumFractionDigits: 2,
|
|
1260
|
+
maximumFractionDigits: 2
|
|
1261
|
+
}).format(number);
|
|
1262
|
+
};
|
|
1263
|
+
const fixedNumber = (number) => {
|
|
1264
|
+
return Number(number.toFixed(2));
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
const hasValues = (obj) => {
|
|
1268
|
+
return Object.values(obj).some(value => value !== null && value !== undefined);
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Elimina las propiedades de un objeto que tengan valores null o undefined.
|
|
1272
|
+
* Retorna un nuevo objeto sin mutar el original.
|
|
1273
|
+
* @param obj - Objeto del cual se eliminarán las propiedades null/undefined
|
|
1274
|
+
* @returns Nuevo objeto sin las propiedades con valores null o undefined
|
|
1275
|
+
*/
|
|
1276
|
+
const removeNullUndefined = (obj) => {
|
|
1277
|
+
const result = {};
|
|
1278
|
+
Object.keys(obj).forEach(key => {
|
|
1279
|
+
const value = obj[key];
|
|
1280
|
+
if (value !== null && value !== undefined) {
|
|
1281
|
+
result[key] = value;
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
return result;
|
|
1285
|
+
};
|
|
1286
|
+
/**
|
|
1287
|
+
* Realiza un upsert en un array de strings. Si el string ya existe, no hace nada.
|
|
1288
|
+
* Si no existe, lo agrega al array.
|
|
1289
|
+
* @param targetArray - Array de strings donde se realizará el upsert
|
|
1290
|
+
* @param value - String o array de strings a insertar
|
|
1291
|
+
* @returns Array actualizado con los nuevos valores
|
|
1292
|
+
*/
|
|
1293
|
+
const upsertArrayStrings = (targetArray, value) => {
|
|
1294
|
+
// Crear una copia del array original para evitar mutaciones
|
|
1295
|
+
const result = [...targetArray];
|
|
1296
|
+
// Convertir el valor a array para procesamiento uniforme
|
|
1297
|
+
const valuesToInsert = Array.isArray(value) ? value : [value];
|
|
1298
|
+
// Procesar cada valor
|
|
1299
|
+
valuesToInsert.forEach(stringValue => {
|
|
1300
|
+
// Solo agregar si no existe en el array
|
|
1301
|
+
if (!result.includes(stringValue)) {
|
|
1302
|
+
result.push(stringValue);
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
return result;
|
|
1306
|
+
};
|
|
1307
|
+
const sameArray = (arr1, arr2) => {
|
|
1308
|
+
if (arr1.length !== arr2.length)
|
|
1309
|
+
return false;
|
|
1310
|
+
const sorted1 = Array.from(arr1).sort();
|
|
1311
|
+
const sorted2 = Array.from(arr2).sort();
|
|
1312
|
+
return sorted1.every((item, index) => item === sorted2[index]);
|
|
1313
|
+
};
|
|
1314
|
+
const getOptionByCode = (options, code) => {
|
|
1315
|
+
if (!code)
|
|
1316
|
+
return undefined;
|
|
1317
|
+
return options.find((item) => item.code === code);
|
|
1318
|
+
};
|
|
1319
|
+
const createEnumeratedList = (items) => {
|
|
1320
|
+
if (items.length === 0) {
|
|
1321
|
+
return '';
|
|
1322
|
+
}
|
|
1323
|
+
if (items.length === 1) {
|
|
1324
|
+
return `1. ${items[0]}`;
|
|
1325
|
+
}
|
|
1326
|
+
return items
|
|
1327
|
+
.map((item, index) => `${index + 1}. ${item}`)
|
|
1328
|
+
.join('\n');
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
class PrimeNgUtil {
|
|
1332
|
+
static isPrimeNgSelection(value) {
|
|
1333
|
+
return typeof value === 'object' && value !== null && 'name' in value && 'code' in value;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
class BadgeNgComponent {
|
|
1338
|
+
config = model.required();
|
|
1339
|
+
get value() {
|
|
1340
|
+
return this.config().value;
|
|
1341
|
+
}
|
|
1342
|
+
get severity() {
|
|
1343
|
+
return this.config().severity;
|
|
1344
|
+
}
|
|
1345
|
+
get badgeSize() {
|
|
1346
|
+
return this.config().badgeSize ?? 'small';
|
|
1347
|
+
}
|
|
1348
|
+
get fullWidth() {
|
|
1349
|
+
return this.config().fullWidth ?? true;
|
|
1350
|
+
}
|
|
1351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BadgeNgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1352
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.17", type: BadgeNgComponent, isStandalone: true, selector: "lib-badge-ng", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { config: "configChange" }, ngImport: i0, template: "<p-badge\r\n [style]=\"{\r\n textAlign: 'center',\r\n width: fullWidth ? '100%' : 'auto'\r\n }\"\r\n [value]=\"value\"\r\n [severity]=\"severity\"\r\n [badgeSize]=\"badgeSize\"\r\n/>\r\n", dependencies: [{ kind: "ngmodule", type: BadgeModule }, { kind: "component", type: i1$3.Badge, selector: "p-badge", inputs: ["styleClass", "style", "badgeSize", "size", "severity", "value", "badgeDisabled"] }] });
|
|
1353
|
+
}
|
|
1354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BadgeNgComponent, decorators: [{
|
|
1355
|
+
type: Component,
|
|
1356
|
+
args: [{ selector: 'lib-badge-ng', imports: [BadgeModule], template: "<p-badge\r\n [style]=\"{\r\n textAlign: 'center',\r\n width: fullWidth ? '100%' : 'auto'\r\n }\"\r\n [value]=\"value\"\r\n [severity]=\"severity\"\r\n [badgeSize]=\"badgeSize\"\r\n/>\r\n" }]
|
|
1357
|
+
}] });
|
|
1358
|
+
|
|
1359
|
+
class ToolbarNgComponent {
|
|
1360
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ToolbarNgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1361
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: ToolbarNgComponent, isStandalone: true, selector: "lib-toolbar-ng", ngImport: i0, template: "<p-toolbar class=\"border-0 bg-transparent\">\r\n <ng-template pTemplate=\"start\">\r\n <ng-content select=\"[toolbarStart]\"></ng-content>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"center\">\r\n <ng-content select=\"[toolbarCenter]\"></ng-content>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"end\">\r\n <ng-content select=\"[toolbarEnd]\"></ng-content>\r\n </ng-template>\r\n</p-toolbar>\r\n", styles: [""], dependencies: [{ kind: "ngmodule", type: ToolbarModule }, { kind: "component", type: i1$4.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass", "ariaLabelledBy"] }, { kind: "directive", type: i4$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }] });
|
|
1362
|
+
}
|
|
1363
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ToolbarNgComponent, decorators: [{
|
|
1364
|
+
type: Component,
|
|
1365
|
+
args: [{ selector: 'lib-toolbar-ng', imports: [
|
|
1366
|
+
ToolbarModule
|
|
1367
|
+
], template: "<p-toolbar class=\"border-0 bg-transparent\">\r\n <ng-template pTemplate=\"start\">\r\n <ng-content select=\"[toolbarStart]\"></ng-content>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"center\">\r\n <ng-content select=\"[toolbarCenter]\"></ng-content>\r\n </ng-template>\r\n\r\n <ng-template pTemplate=\"end\">\r\n <ng-content select=\"[toolbarEnd]\"></ng-content>\r\n </ng-template>\r\n</p-toolbar>\r\n" }]
|
|
1368
|
+
}] });
|
|
1369
|
+
|
|
1370
|
+
class TableNgEditService {
|
|
1371
|
+
editConfig = signal(undefined);
|
|
1372
|
+
keysNames = signal({});
|
|
1373
|
+
constructor() { }
|
|
1374
|
+
setEditConfig(editConfig) {
|
|
1375
|
+
this.editConfig.set(editConfig);
|
|
1376
|
+
}
|
|
1377
|
+
setKeysNames(keysNames) {
|
|
1378
|
+
this.keysNames.set(keysNames);
|
|
1379
|
+
}
|
|
1380
|
+
fb = inject(NonNullableFormBuilder);
|
|
1381
|
+
controls = computed(() => {
|
|
1382
|
+
const formValues = this.searchFormGroup().value;
|
|
1383
|
+
const controls = [
|
|
1384
|
+
{
|
|
1385
|
+
controlName: 'search',
|
|
1386
|
+
control: this.fb.control(formValues.search, { validators: [] }),
|
|
1387
|
+
typeInput: ETypeInput.TEXT,
|
|
1388
|
+
colSpan: 12,
|
|
1389
|
+
label: '-'
|
|
1390
|
+
}
|
|
1391
|
+
];
|
|
1392
|
+
return controls;
|
|
1393
|
+
});
|
|
1394
|
+
searchFormGroup = signal(new FormGroup({}));
|
|
1395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgEditService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1396
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgEditService, providedIn: 'root' });
|
|
1397
|
+
}
|
|
1398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgEditService, decorators: [{
|
|
1399
|
+
type: Injectable,
|
|
1400
|
+
args: [{
|
|
1401
|
+
providedIn: 'root'
|
|
1402
|
+
}]
|
|
1403
|
+
}], ctorParameters: () => [] });
|
|
1404
|
+
|
|
1405
|
+
class TableNgGeneralService {
|
|
1406
|
+
constructor() { }
|
|
1407
|
+
MOCK_EMPTY_DATE = new Date(1900, 0, 1);
|
|
1408
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgGeneralService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1409
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgGeneralService, providedIn: 'root' });
|
|
1410
|
+
}
|
|
1411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgGeneralService, decorators: [{
|
|
1412
|
+
type: Injectable,
|
|
1413
|
+
args: [{
|
|
1414
|
+
providedIn: 'root'
|
|
1415
|
+
}]
|
|
1416
|
+
}], ctorParameters: () => [] });
|
|
1417
|
+
|
|
1418
|
+
// services/dialog.service.ts
|
|
1419
|
+
class CustomDialogService {
|
|
1420
|
+
dialogRef;
|
|
1421
|
+
dialogService = inject(DialogService);
|
|
1422
|
+
constructor() { }
|
|
1423
|
+
open(component, options = {}) {
|
|
1424
|
+
const defaultConfig = {
|
|
1425
|
+
closable: true,
|
|
1426
|
+
header: options.header || '',
|
|
1427
|
+
width: options.width || '50%',
|
|
1428
|
+
height: options.height || 'auto',
|
|
1429
|
+
closeOnEscape: options.closeOnEscape ?? true,
|
|
1430
|
+
baseZIndex: options.baseZIndex || 10000,
|
|
1431
|
+
maximizable: options.maximizable ?? true,
|
|
1432
|
+
data: options.data || {},
|
|
1433
|
+
style: {
|
|
1434
|
+
borderRadius: '8px',
|
|
1435
|
+
...options.style
|
|
1436
|
+
},
|
|
1437
|
+
modal: true
|
|
1438
|
+
};
|
|
1439
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1440
|
+
this.dialogRef = this.dialogService.open(component, defaultConfig);
|
|
1441
|
+
return this.dialogRef;
|
|
1442
|
+
}
|
|
1443
|
+
close(result) {
|
|
1444
|
+
if (this.dialogRef) {
|
|
1445
|
+
this.dialogRef.close(result);
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1449
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomDialogService, providedIn: 'root' });
|
|
1450
|
+
}
|
|
1451
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: CustomDialogService, decorators: [{
|
|
1452
|
+
type: Injectable,
|
|
1453
|
+
args: [{
|
|
1454
|
+
providedIn: 'root'
|
|
1455
|
+
}]
|
|
1456
|
+
}], ctorParameters: () => [] });
|
|
1457
|
+
|
|
1458
|
+
class TableNgService {
|
|
1459
|
+
tableNgGeneralService = inject(TableNgGeneralService);
|
|
1460
|
+
filterService = inject(FilterService);
|
|
1461
|
+
dialogService = inject(CustomDialogService);
|
|
1462
|
+
initialValue;
|
|
1463
|
+
constructor() {
|
|
1464
|
+
this.filterService.register('globalCustomFilter', (rowData, filter) => {
|
|
1465
|
+
if (!filter || filter.trim() === '')
|
|
1466
|
+
return true;
|
|
1467
|
+
const searchTerm = filter.toLowerCase();
|
|
1468
|
+
// Si es string
|
|
1469
|
+
if (typeof rowData === 'string') {
|
|
1470
|
+
return rowData.toLowerCase().includes(searchTerm);
|
|
1471
|
+
}
|
|
1472
|
+
// Si es array de botones
|
|
1473
|
+
if (Array.isArray(rowData)) {
|
|
1474
|
+
return rowData.some((button) => {
|
|
1475
|
+
const label = button.label || '';
|
|
1476
|
+
return label.toLowerCase().includes(searchTerm);
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
return false;
|
|
1480
|
+
});
|
|
1481
|
+
/**
|
|
1482
|
+
* Filtro para arrays de strings que verifica si el valor contiene alguno de los strings del filtro.
|
|
1483
|
+
* Uso: dt.filter(['valor1', 'valor2'], 'nombreColumna', 'arrayStringFilter')
|
|
1484
|
+
* @param rowData - Puede ser un string o array de strings
|
|
1485
|
+
* @param filter - Array de strings para filtrar
|
|
1486
|
+
* @returns true si encuentra coincidencias parciales (case-insensitive)
|
|
1487
|
+
*/
|
|
1488
|
+
this.filterService.register('arrayStringFilter', (rowData, filter) => {
|
|
1489
|
+
// Si no hay filtro o el filtro está vacío, mostrar todos los elementos
|
|
1490
|
+
if (!filter || !Array.isArray(filter) || filter.length === 0)
|
|
1491
|
+
return true;
|
|
1492
|
+
// Si rowData es null, undefined o vacío, no mostrar el elemento
|
|
1493
|
+
if (rowData == null || rowData === '')
|
|
1494
|
+
return false;
|
|
1495
|
+
// Si rowData es un string
|
|
1496
|
+
if (typeof rowData === 'string') {
|
|
1497
|
+
return filter.some(filterValue => rowData.toLowerCase().includes(filterValue.toLowerCase()));
|
|
1498
|
+
}
|
|
1499
|
+
// Si rowData es un array de strings
|
|
1500
|
+
if (Array.isArray(rowData)) {
|
|
1501
|
+
return rowData.some(dataValue => filter.some(filterValue => typeof dataValue === 'string' &&
|
|
1502
|
+
dataValue.toLowerCase().includes(filterValue.toLowerCase())));
|
|
1503
|
+
}
|
|
1504
|
+
// Para otros tipos de datos, convertir a string si es posible
|
|
1505
|
+
const stringValue = String(rowData);
|
|
1506
|
+
if (stringValue && stringValue !== 'undefined' && stringValue !== 'null') {
|
|
1507
|
+
return filter.some(filterValue => stringValue.toLowerCase().includes(filterValue.toLowerCase()));
|
|
1508
|
+
}
|
|
1509
|
+
return false;
|
|
1510
|
+
});
|
|
1511
|
+
/**
|
|
1512
|
+
* Filtro exacto para arrays de strings que verifica coincidencias exactas.
|
|
1513
|
+
* Uso: dt.filter(['valor1', 'valor2'], 'nombreColumna', 'arrayStringExactFilter')
|
|
1514
|
+
* @param rowData - Puede ser un string o array de strings
|
|
1515
|
+
* @param filter - Array de strings para filtrar
|
|
1516
|
+
* @returns true si encuentra coincidencias exactas (case-sensitive)
|
|
1517
|
+
*/
|
|
1518
|
+
this.filterService.register('arrayStringExactFilter', (rowData, filter) => {
|
|
1519
|
+
if (!filter || !Array.isArray(filter) || filter.length === 0)
|
|
1520
|
+
return true;
|
|
1521
|
+
// Si rowData es null, undefined o vacío, no mostrar el elemento
|
|
1522
|
+
if (rowData == null || rowData === '')
|
|
1523
|
+
return false;
|
|
1524
|
+
// Si rowData es un string
|
|
1525
|
+
if (typeof rowData === 'string') {
|
|
1526
|
+
return filter.includes(rowData);
|
|
1527
|
+
}
|
|
1528
|
+
// Si rowData es un array de strings
|
|
1529
|
+
if (Array.isArray(rowData)) {
|
|
1530
|
+
return rowData.some(dataValue => filter.includes(dataValue));
|
|
1531
|
+
}
|
|
1532
|
+
// Para otros tipos de datos, convertir a string si es posible
|
|
1533
|
+
const stringValue = String(rowData);
|
|
1534
|
+
if (stringValue && stringValue !== 'undefined' && stringValue !== 'null') {
|
|
1535
|
+
return filter.includes(stringValue);
|
|
1536
|
+
}
|
|
1537
|
+
return false;
|
|
1538
|
+
});
|
|
1539
|
+
this.filterService.register('customIn', (rowData, filter) => {
|
|
1540
|
+
if (!filter || !Array.isArray(filter) || filter.length === 0)
|
|
1541
|
+
return true;
|
|
1542
|
+
// Si rowData es null, undefined o vacío, no mostrar el elemento
|
|
1543
|
+
if (rowData == null || rowData === '')
|
|
1544
|
+
return false;
|
|
1545
|
+
if (typeof rowData === 'string') {
|
|
1546
|
+
return filter.includes(rowData);
|
|
1547
|
+
}
|
|
1548
|
+
// Para otros tipos de datos, convertir a string si es posible
|
|
1549
|
+
const stringValue = String(rowData);
|
|
1550
|
+
if (stringValue && stringValue !== 'undefined' && stringValue !== 'null') {
|
|
1551
|
+
return filter.includes(stringValue);
|
|
1552
|
+
}
|
|
1553
|
+
return false;
|
|
1554
|
+
});
|
|
1555
|
+
}
|
|
1556
|
+
get MOCK_EMPTY_DATE() {
|
|
1557
|
+
return this.tableNgGeneralService.MOCK_EMPTY_DATE;
|
|
1558
|
+
}
|
|
1559
|
+
setInitialValue(data) {
|
|
1560
|
+
this.initialValue = data;
|
|
1561
|
+
}
|
|
1562
|
+
//#region SORT
|
|
1563
|
+
customSort(event) {
|
|
1564
|
+
let field = undefined;
|
|
1565
|
+
let order = undefined;
|
|
1566
|
+
switch (event.mode) {
|
|
1567
|
+
case 'single':
|
|
1568
|
+
field = event.field;
|
|
1569
|
+
order = event.order;
|
|
1570
|
+
break;
|
|
1571
|
+
case 'multiple': {
|
|
1572
|
+
const multiSortMeta = event.multiSortMeta ?? [];
|
|
1573
|
+
const sortMeta = multiSortMeta[0];
|
|
1574
|
+
field = sortMeta?.field ?? undefined;
|
|
1575
|
+
order = sortMeta?.order ?? undefined;
|
|
1576
|
+
break;
|
|
1577
|
+
}
|
|
1578
|
+
default:
|
|
1579
|
+
break;
|
|
1580
|
+
}
|
|
1581
|
+
if (!field || order === undefined)
|
|
1582
|
+
return;
|
|
1583
|
+
const data = event.data ?? [];
|
|
1584
|
+
if (order === 0) {
|
|
1585
|
+
// Sin sorting - restaurar orden original
|
|
1586
|
+
data.splice(0, data.length, ...this.initialValue);
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
// Aplicar sorting
|
|
1590
|
+
data.sort((a, b) => {
|
|
1591
|
+
const valueA = this.getFieldValue(a, field);
|
|
1592
|
+
const valueB = this.getFieldValue(b, field);
|
|
1593
|
+
const result = this.compareValues(valueA, valueB);
|
|
1594
|
+
return order * result; // 1 para ASC, -1 para DESC
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
getFieldValue(item, field) {
|
|
1599
|
+
const rawValue = item.rowData[field];
|
|
1600
|
+
// Si es un array (probablemente IButtonConfig[])
|
|
1601
|
+
if (Array.isArray(rawValue) && rawValue.length > 0) {
|
|
1602
|
+
// Verificar si tenemos configuración de sorting para este campo
|
|
1603
|
+
const buttonKeyToSort = item.sortConfig?.buttonKeyToSort?.[field];
|
|
1604
|
+
if (buttonKeyToSort) {
|
|
1605
|
+
// Usar la primera configuración de botón del array
|
|
1606
|
+
const firstButton = rawValue[0];
|
|
1607
|
+
return firstButton[buttonKeyToSort];
|
|
1608
|
+
}
|
|
1609
|
+
// Si no hay configuración, intentar usar 'label' por defecto
|
|
1610
|
+
const firstButton = rawValue[0];
|
|
1611
|
+
return firstButton.label || '';
|
|
1612
|
+
}
|
|
1613
|
+
// Si es un string o cualquier otro tipo
|
|
1614
|
+
return rawValue;
|
|
1615
|
+
}
|
|
1616
|
+
compareValues(a, b) {
|
|
1617
|
+
// Manejar valores null/undefined
|
|
1618
|
+
if (a == null && b == null)
|
|
1619
|
+
return 0;
|
|
1620
|
+
if (a == null)
|
|
1621
|
+
return -1;
|
|
1622
|
+
if (b == null)
|
|
1623
|
+
return 1;
|
|
1624
|
+
// Si ambos son strings, usar localeCompare para mejor sorting
|
|
1625
|
+
if (typeof a === 'string' && typeof b === 'string') {
|
|
1626
|
+
return a.toLowerCase().localeCompare(b.toLowerCase());
|
|
1627
|
+
}
|
|
1628
|
+
// Si ambos son números
|
|
1629
|
+
if (typeof a === 'number' && typeof b === 'number') {
|
|
1630
|
+
return a - b;
|
|
1631
|
+
}
|
|
1632
|
+
// Si ambos son booleanos
|
|
1633
|
+
if (typeof a === 'boolean' && typeof b === 'boolean') {
|
|
1634
|
+
return a === b ? 0 : a ? 1 : -1;
|
|
1635
|
+
}
|
|
1636
|
+
// Si son fechas
|
|
1637
|
+
if (a instanceof Date && b instanceof Date) {
|
|
1638
|
+
return a.getTime() - b.getTime();
|
|
1639
|
+
}
|
|
1640
|
+
// Para otros tipos, convertir a string y comparar
|
|
1641
|
+
const strA = String(a).toLowerCase();
|
|
1642
|
+
const strB = String(b).toLowerCase();
|
|
1643
|
+
return strA.localeCompare(strB);
|
|
1644
|
+
}
|
|
1645
|
+
//#endregion
|
|
1646
|
+
//#region Global Filter
|
|
1647
|
+
fb = inject(NonNullableFormBuilder);
|
|
1648
|
+
controls = computed(() => {
|
|
1649
|
+
const formValues = this.searchFormGroup().value;
|
|
1650
|
+
const controls = [
|
|
1651
|
+
{
|
|
1652
|
+
controlName: 'search',
|
|
1653
|
+
control: this.fb.control(formValues.search, { validators: [] }),
|
|
1654
|
+
typeInput: ETypeInput.TEXT,
|
|
1655
|
+
colSpan: 12,
|
|
1656
|
+
label: 'Buscar'
|
|
1657
|
+
}
|
|
1658
|
+
];
|
|
1659
|
+
return controls;
|
|
1660
|
+
});
|
|
1661
|
+
searchFormGroup = signal(new FormGroup({}));
|
|
1662
|
+
values = toSignal(this.searchFormGroup().valueChanges);
|
|
1663
|
+
submitGlobalSearch(formGroup, dt) {
|
|
1664
|
+
const search = formGroup.value.search ?? '';
|
|
1665
|
+
dt.filterGlobal(search, 'globalCustomFilter');
|
|
1666
|
+
}
|
|
1667
|
+
clearSearchInput() {
|
|
1668
|
+
this.searchFormGroup().get('search')?.setValue('');
|
|
1669
|
+
}
|
|
1670
|
+
//#endregion
|
|
1671
|
+
//#region Selection
|
|
1672
|
+
async openModalManagementSelectedItems(selectedItems, config) {
|
|
1673
|
+
const { SelectedItemsManagementComponent } = await import('./ln-20-lib-components-selected-items-management.component-qjE14pdH.mjs');
|
|
1674
|
+
let configSelectedItems = config;
|
|
1675
|
+
if (config) {
|
|
1676
|
+
configSelectedItems = structuredClone(config);
|
|
1677
|
+
const selectionTableConfig = {
|
|
1678
|
+
...(configSelectedItems.selectionTableConfig ?? {}),
|
|
1679
|
+
showManagementConfig: false
|
|
1680
|
+
};
|
|
1681
|
+
delete configSelectedItems.lazyLoadingConfig;
|
|
1682
|
+
configSelectedItems.selectionTableConfig = selectionTableConfig;
|
|
1683
|
+
}
|
|
1684
|
+
const ref = this.dialogService?.open(SelectedItemsManagementComponent, {
|
|
1685
|
+
header: 'Gestionar Seleccionados',
|
|
1686
|
+
data: {
|
|
1687
|
+
selectedItems: selectedItems(),
|
|
1688
|
+
config: configSelectedItems
|
|
1689
|
+
},
|
|
1690
|
+
width: '90%',
|
|
1691
|
+
height: '90%',
|
|
1692
|
+
styleClass: 'overflow-hidden'
|
|
1693
|
+
});
|
|
1694
|
+
ref.onClose.subscribe((selectedReturnItems) => {
|
|
1695
|
+
if (selectedReturnItems) {
|
|
1696
|
+
selectedItems.set(selectedReturnItems);
|
|
1697
|
+
}
|
|
1698
|
+
});
|
|
1699
|
+
}
|
|
1700
|
+
//#endregion
|
|
1701
|
+
//#region Custom Filter
|
|
1702
|
+
//#endregion
|
|
1703
|
+
excelButton = computed(() => {
|
|
1704
|
+
return {
|
|
1705
|
+
label: '',
|
|
1706
|
+
icon: 'fa-solid fa-file-excel',
|
|
1707
|
+
variant: 'text',
|
|
1708
|
+
severity: 'success',
|
|
1709
|
+
raised: true,
|
|
1710
|
+
size: 'large',
|
|
1711
|
+
tooltipConfig: {
|
|
1712
|
+
pTooltip: this.config()?.labelsConfig?.exportExcelTooltip ?? 'Exportar a Excel',
|
|
1713
|
+
tooltipPosition: 'top'
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
});
|
|
1717
|
+
pdfButton = computed(() => {
|
|
1718
|
+
return {
|
|
1719
|
+
label: '',
|
|
1720
|
+
icon: 'fa-solid fa-file-pdf',
|
|
1721
|
+
variant: 'text',
|
|
1722
|
+
severity: 'danger',
|
|
1723
|
+
raised: true,
|
|
1724
|
+
size: 'large',
|
|
1725
|
+
tooltipConfig: {
|
|
1726
|
+
pTooltip: this.config()?.labelsConfig?.exportPdfTooltip ?? 'Exportar a PDF',
|
|
1727
|
+
tooltipPosition: 'top'
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
});
|
|
1731
|
+
refreshButton = computed(() => {
|
|
1732
|
+
return {
|
|
1733
|
+
label: '',
|
|
1734
|
+
icon: 'fa-solid fa-refresh',
|
|
1735
|
+
variant: 'text',
|
|
1736
|
+
severity: 'info',
|
|
1737
|
+
raised: true,
|
|
1738
|
+
size: 'large',
|
|
1739
|
+
onClick: () => {
|
|
1740
|
+
this.refreshTable();
|
|
1741
|
+
},
|
|
1742
|
+
tooltipConfig: {
|
|
1743
|
+
pTooltip: this.config()?.labelsConfig?.refreshTooltip ?? 'Refrescar',
|
|
1744
|
+
tooltipPosition: 'top'
|
|
1745
|
+
},
|
|
1746
|
+
loading: this.isLoadingRefreshButton(),
|
|
1747
|
+
disabled: this.isLoadingRefreshButton(),
|
|
1748
|
+
};
|
|
1749
|
+
});
|
|
1750
|
+
refreshTable() {
|
|
1751
|
+
if (this.refreshConfig()) {
|
|
1752
|
+
this.refreshConfig()?.callback();
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
_config = signal(undefined);
|
|
1756
|
+
config = this._config.asReadonly();
|
|
1757
|
+
setConfig(value) {
|
|
1758
|
+
this._config.set(value);
|
|
1759
|
+
}
|
|
1760
|
+
refreshConfig = computed(() => {
|
|
1761
|
+
return this.config()?.refreshConfig;
|
|
1762
|
+
});
|
|
1763
|
+
enableRefreshButton = computed(() => {
|
|
1764
|
+
return this.refreshConfig()?.isEnabled ?? false;
|
|
1765
|
+
});
|
|
1766
|
+
isLoadingRefreshButton = computed(() => {
|
|
1767
|
+
return this.refreshConfig()?.isLoading ?? false;
|
|
1768
|
+
});
|
|
1769
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1770
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgService, providedIn: 'root' });
|
|
1771
|
+
}
|
|
1772
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgService, decorators: [{
|
|
1773
|
+
type: Injectable,
|
|
1774
|
+
args: [{
|
|
1775
|
+
providedIn: 'root'
|
|
1776
|
+
}]
|
|
1777
|
+
}], ctorParameters: () => [] });
|
|
1778
|
+
|
|
1779
|
+
class BaseDialogComponent {
|
|
1780
|
+
destroy$ = new Subject();
|
|
1781
|
+
data;
|
|
1782
|
+
ref = inject(DynamicDialogRef);
|
|
1783
|
+
config = inject(DynamicDialogConfig);
|
|
1784
|
+
constructor() {
|
|
1785
|
+
this.data = this.config.data;
|
|
1786
|
+
}
|
|
1787
|
+
ngOnDestroy() {
|
|
1788
|
+
this.destroy$.next();
|
|
1789
|
+
this.destroy$.complete();
|
|
1790
|
+
}
|
|
1791
|
+
close(result) {
|
|
1792
|
+
this.ref.close(result);
|
|
1793
|
+
}
|
|
1794
|
+
dismiss() {
|
|
1795
|
+
this.ref.close({ success: false });
|
|
1796
|
+
}
|
|
1797
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1798
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: BaseDialogComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
1799
|
+
}
|
|
1800
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: BaseDialogComponent, decorators: [{
|
|
1801
|
+
type: Component,
|
|
1802
|
+
args: [{
|
|
1803
|
+
standalone: true,
|
|
1804
|
+
template: ''
|
|
1805
|
+
}]
|
|
1806
|
+
}], ctorParameters: () => [] });
|
|
1807
|
+
|
|
1808
|
+
const pickListConstant = (e, element) => {
|
|
1809
|
+
if (e.id === element?.id) {
|
|
1810
|
+
e.isSelected = !e.isSelected;
|
|
1811
|
+
if (e.isSelected) {
|
|
1812
|
+
delete e.buttonConfig.variant;
|
|
1813
|
+
delete e.buttonConfig.raised;
|
|
1814
|
+
}
|
|
1815
|
+
else {
|
|
1816
|
+
e.buttonConfig.variant = 'outlined';
|
|
1817
|
+
e.buttonConfig.raised = true;
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
class ContainerElementsComponent {
|
|
1823
|
+
cols = input(3);
|
|
1824
|
+
elements = model([]);
|
|
1825
|
+
severityButton = input('contrast');
|
|
1826
|
+
outputElements = output();
|
|
1827
|
+
constructor() {
|
|
1828
|
+
}
|
|
1829
|
+
ngOnInit() {
|
|
1830
|
+
this.elements.update((elements) => {
|
|
1831
|
+
elements.forEach((e) => {
|
|
1832
|
+
// Si e.isSelected es true, se elimina el variant y raised
|
|
1833
|
+
if (e.isSelected) {
|
|
1834
|
+
delete e.buttonConfig.variant;
|
|
1835
|
+
delete e.buttonConfig.raised;
|
|
1836
|
+
}
|
|
1837
|
+
else {
|
|
1838
|
+
e.buttonConfig.variant = 'outlined';
|
|
1839
|
+
e.buttonConfig.raised = true;
|
|
1840
|
+
}
|
|
1841
|
+
e.buttonConfig = {
|
|
1842
|
+
...e.buttonConfig,
|
|
1843
|
+
fullWidth: true,
|
|
1844
|
+
fullHeight: true,
|
|
1845
|
+
hasStaticClick: true,
|
|
1846
|
+
severity: this.severityButton()
|
|
1847
|
+
};
|
|
1848
|
+
});
|
|
1849
|
+
return [...elements];
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
containerClass = computed(() => 'w-[45%] flex flex-col shadow-md bg-white dark:bg-gray-800 rounded-xl h-full overflow-y-auto');
|
|
1853
|
+
titleClass = computed(() => 'text-lg font-bold self-center text-center');
|
|
1854
|
+
containerElementsClass = computed(() => `grid grid-cols-${this.cols() ?? 3} gap-2 p-2`);
|
|
1855
|
+
getButtonConfig(buttonConfig) {
|
|
1856
|
+
return { ...buttonConfig, fullWidth: true, severity: this.severityButton(), hasStaticClick: true };
|
|
1857
|
+
}
|
|
1858
|
+
onButtonClick(element) {
|
|
1859
|
+
this.elements.update((elements) => {
|
|
1860
|
+
elements.forEach((e) => {
|
|
1861
|
+
pickListConstant(e, element);
|
|
1862
|
+
});
|
|
1863
|
+
return [...elements];
|
|
1864
|
+
});
|
|
1865
|
+
this.outputElements.emit([...this.elements()]);
|
|
1866
|
+
}
|
|
1867
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ContainerElementsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1868
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: ContainerElementsComponent, isStandalone: true, selector: "lib-container-elements", inputs: { cols: { classPropertyName: "cols", publicName: "cols", isSignal: true, isRequired: false, transformFunction: null }, elements: { classPropertyName: "elements", publicName: "elements", isSignal: true, isRequired: false, transformFunction: null }, severityButton: { classPropertyName: "severityButton", publicName: "severityButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { elements: "elementsChange", outputElements: "outputElements" }, ngImport: i0, template: "<div class=\"h-full w-full\" [class]=\"containerClass()\">\r\n <div class=\"dynamic-grid\" [style.--grid-cols]=\"cols()\">\r\n @for (element of elements(); track element.id) {\r\n <div class=\"grid-item\">\r\n @if (element.buttonConfig) {\r\n <lib-button-ng [(buttonConfig)]=\"element.buttonConfig\" (onClick)=\"onButtonClick(element)\"></lib-button-ng>\r\n }\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".dynamic-grid{display:grid;gap:.5rem;padding:.5rem;grid-template-columns:repeat(var(--grid-cols, 3),1fr)}.grid-item{border-radius:.375rem;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}\n"], dependencies: [{ kind: "component", type: ButtonNgComponent, selector: "lib-button-ng", inputs: ["buttonConfig"], outputs: ["buttonConfigChange", "onClick"] }, { kind: "ngmodule", type: CommonModule }] });
|
|
1869
|
+
}
|
|
1870
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ContainerElementsComponent, decorators: [{
|
|
1871
|
+
type: Component,
|
|
1872
|
+
args: [{ selector: 'lib-container-elements', imports: [ButtonNgComponent, CommonModule], template: "<div class=\"h-full w-full\" [class]=\"containerClass()\">\r\n <div class=\"dynamic-grid\" [style.--grid-cols]=\"cols()\">\r\n @for (element of elements(); track element.id) {\r\n <div class=\"grid-item\">\r\n @if (element.buttonConfig) {\r\n <lib-button-ng [(buttonConfig)]=\"element.buttonConfig\" (onClick)=\"onButtonClick(element)\"></lib-button-ng>\r\n }\r\n </div>\r\n }\r\n </div>\r\n</div>", styles: [".dynamic-grid{display:grid;gap:.5rem;padding:.5rem;grid-template-columns:repeat(var(--grid-cols, 3),1fr)}.grid-item{border-radius:.375rem;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}\n"] }]
|
|
1873
|
+
}], ctorParameters: () => [] });
|
|
1874
|
+
|
|
1875
|
+
class PickListComponent {
|
|
1876
|
+
constructor() {
|
|
1877
|
+
}
|
|
1878
|
+
ngOnInit() { }
|
|
1879
|
+
sourceElements = model([]);
|
|
1880
|
+
hasAnySourceElementSelected = computed(() => this.sourceElements().some(element => element.isSelected));
|
|
1881
|
+
targetElements = model([]);
|
|
1882
|
+
hasAnyTargetElementSelected = computed(() => this.targetElements().some(element => element.isSelected));
|
|
1883
|
+
config = input();
|
|
1884
|
+
outputElements = output();
|
|
1885
|
+
sourceSeverityButton = computed(() => this.config()?.sourceSeverityButton ?? 'secondary');
|
|
1886
|
+
targetSeverityButton = computed(() => this.config()?.targetSeverityButton ?? 'contrast');
|
|
1887
|
+
controlButtons = computed(() => [
|
|
1888
|
+
{
|
|
1889
|
+
label: '',
|
|
1890
|
+
icon: 'pi pi-angle-double-right',
|
|
1891
|
+
severity: this.sourceSeverityButton(),
|
|
1892
|
+
disabled: this.sourceElements().length === 0,
|
|
1893
|
+
tooltipConfig: {
|
|
1894
|
+
pTooltip: this.sourceElements().length === 0 ? 'No hay elementos' : 'Mover todos hacia la derecha',
|
|
1895
|
+
tooltipPosition: 'top'
|
|
1896
|
+
},
|
|
1897
|
+
onClick: () => {
|
|
1898
|
+
this.moveAllSourceToTarget();
|
|
1899
|
+
}
|
|
1900
|
+
},
|
|
1901
|
+
{
|
|
1902
|
+
label: '',
|
|
1903
|
+
icon: 'pi pi-angle-right',
|
|
1904
|
+
severity: this.sourceSeverityButton(),
|
|
1905
|
+
disabled: !this.hasAnySourceElementSelected(),
|
|
1906
|
+
tooltipConfig: {
|
|
1907
|
+
pTooltip: !this.hasAnySourceElementSelected() ? 'No hay elementos seleccionados' : 'Mover los elementos seleccionados hacia la derecha',
|
|
1908
|
+
tooltipPosition: 'top'
|
|
1909
|
+
},
|
|
1910
|
+
onClick: () => {
|
|
1911
|
+
this.moveSelectedSourceToTarget();
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
label: '',
|
|
1916
|
+
icon: 'pi pi-angle-double-left',
|
|
1917
|
+
severity: this.targetSeverityButton(),
|
|
1918
|
+
disabled: this.targetElements().length === 0,
|
|
1919
|
+
tooltipConfig: {
|
|
1920
|
+
pTooltip: this.targetElements().length === 0 ? 'No hay elementos' : 'Mover todos hacia la izquierda',
|
|
1921
|
+
tooltipPosition: 'top'
|
|
1922
|
+
},
|
|
1923
|
+
onClick: () => {
|
|
1924
|
+
this.moveAllTargetToSource();
|
|
1925
|
+
}
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
label: '',
|
|
1929
|
+
icon: 'pi pi-angle-left',
|
|
1930
|
+
severity: this.targetSeverityButton(),
|
|
1931
|
+
disabled: !this.hasAnyTargetElementSelected(),
|
|
1932
|
+
tooltipConfig: {
|
|
1933
|
+
pTooltip: !this.hasAnyTargetElementSelected() ? 'No hay elementos seleccionados' : 'Mover los elementos seleccionados hacia la izquierda',
|
|
1934
|
+
tooltipPosition: 'top'
|
|
1935
|
+
},
|
|
1936
|
+
onClick: () => {
|
|
1937
|
+
this.moveSelectedTargetToSource();
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
]);
|
|
1941
|
+
/**
|
|
1942
|
+
* Mueve todos los elementos del sourceElements al targetElements,
|
|
1943
|
+
* convirtiendo su severidad para que coincida con targetSeverityButton
|
|
1944
|
+
*/
|
|
1945
|
+
moveAllSourceToTarget() {
|
|
1946
|
+
const sourceElementsCopy = [...this.sourceElements()];
|
|
1947
|
+
if (sourceElementsCopy.length === 0) {
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
// Convertir los elementos para usar targetSeverityButton
|
|
1951
|
+
const convertedElements = sourceElementsCopy.map(element => {
|
|
1952
|
+
const convertedElement = {
|
|
1953
|
+
...element,
|
|
1954
|
+
isSelected: false, // Limpiar selección
|
|
1955
|
+
buttonConfig: {
|
|
1956
|
+
...element.buttonConfig,
|
|
1957
|
+
severity: this.targetSeverityButton(),
|
|
1958
|
+
variant: 'outlined',
|
|
1959
|
+
raised: true
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
return convertedElement;
|
|
1963
|
+
});
|
|
1964
|
+
// Agregar elementos convertidos al target
|
|
1965
|
+
this.targetElements.update(currentTarget => [
|
|
1966
|
+
...currentTarget,
|
|
1967
|
+
...convertedElements
|
|
1968
|
+
]);
|
|
1969
|
+
// Limpiar sourceElements
|
|
1970
|
+
this.sourceElements.set([]);
|
|
1971
|
+
this.handleOutputElements();
|
|
1972
|
+
}
|
|
1973
|
+
/**
|
|
1974
|
+
* Mueve todos los elementos del targetElements al sourceElements,
|
|
1975
|
+
* convirtiendo su severidad para que coincida con sourceSeverityButton
|
|
1976
|
+
*/
|
|
1977
|
+
moveAllTargetToSource() {
|
|
1978
|
+
const targetElementsCopy = [...this.targetElements()];
|
|
1979
|
+
if (targetElementsCopy.length === 0) {
|
|
1980
|
+
return;
|
|
1981
|
+
}
|
|
1982
|
+
// Convertir los elementos para usar sourceSeverityButton
|
|
1983
|
+
const convertedElements = targetElementsCopy.map(element => {
|
|
1984
|
+
const convertedElement = {
|
|
1985
|
+
...element,
|
|
1986
|
+
isSelected: false, // Limpiar selección
|
|
1987
|
+
buttonConfig: {
|
|
1988
|
+
...element.buttonConfig,
|
|
1989
|
+
severity: this.sourceSeverityButton(),
|
|
1990
|
+
variant: 'outlined',
|
|
1991
|
+
raised: true
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
return convertedElement;
|
|
1995
|
+
});
|
|
1996
|
+
// Agregar elementos convertidos al source
|
|
1997
|
+
this.sourceElements.update(currentSource => [
|
|
1998
|
+
...currentSource,
|
|
1999
|
+
...convertedElements
|
|
2000
|
+
]);
|
|
2001
|
+
// Limpiar targetElements
|
|
2002
|
+
this.targetElements.set([]);
|
|
2003
|
+
this.handleOutputElements();
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* Mueve los elementos seleccionados del sourceElements al targetElements,
|
|
2007
|
+
* ubicándolos en la primera posición y convirtiendo su severidad
|
|
2008
|
+
*/
|
|
2009
|
+
moveSelectedSourceToTarget() {
|
|
2010
|
+
const selectedElements = this.sourceElements().filter(element => element.isSelected);
|
|
2011
|
+
const remainingElements = this.sourceElements().filter(element => !element.isSelected);
|
|
2012
|
+
if (selectedElements.length === 0) {
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
2015
|
+
// Convertir los elementos seleccionados para usar targetSeverityButton
|
|
2016
|
+
const convertedElements = selectedElements.map(element => {
|
|
2017
|
+
const convertedElement = {
|
|
2018
|
+
...element,
|
|
2019
|
+
isSelected: false, // Limpiar selección
|
|
2020
|
+
buttonConfig: {
|
|
2021
|
+
...element.buttonConfig,
|
|
2022
|
+
severity: this.targetSeverityButton(),
|
|
2023
|
+
variant: 'outlined',
|
|
2024
|
+
raised: true
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
return convertedElement;
|
|
2028
|
+
});
|
|
2029
|
+
// Agregar elementos convertidos al inicio de targetElements
|
|
2030
|
+
this.targetElements.update(currentTarget => [
|
|
2031
|
+
...convertedElements,
|
|
2032
|
+
...currentTarget
|
|
2033
|
+
]);
|
|
2034
|
+
// Actualizar sourceElements sin los elementos seleccionados
|
|
2035
|
+
this.sourceElements.set(remainingElements);
|
|
2036
|
+
this.handleOutputElements();
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Mueve los elementos seleccionados del targetElements al sourceElements,
|
|
2040
|
+
* ubicándolos en la primera posición y convirtiendo su severidad
|
|
2041
|
+
*/
|
|
2042
|
+
moveSelectedTargetToSource() {
|
|
2043
|
+
const selectedElements = this.targetElements().filter(element => element.isSelected);
|
|
2044
|
+
const remainingElements = this.targetElements().filter(element => !element.isSelected);
|
|
2045
|
+
if (selectedElements.length === 0) {
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
// Convertir los elementos seleccionados para usar sourceSeverityButton
|
|
2049
|
+
const convertedElements = selectedElements.map(element => {
|
|
2050
|
+
const convertedElement = {
|
|
2051
|
+
...element,
|
|
2052
|
+
isSelected: false, // Limpiar selección
|
|
2053
|
+
buttonConfig: {
|
|
2054
|
+
...element.buttonConfig,
|
|
2055
|
+
severity: this.sourceSeverityButton(),
|
|
2056
|
+
variant: 'outlined',
|
|
2057
|
+
raised: true
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
return convertedElement;
|
|
2061
|
+
});
|
|
2062
|
+
// Agregar elementos convertidos al inicio de sourceElements
|
|
2063
|
+
this.sourceElements.update(currentSource => [
|
|
2064
|
+
...convertedElements,
|
|
2065
|
+
...currentSource
|
|
2066
|
+
]);
|
|
2067
|
+
// Actualizar targetElements sin los elementos seleccionados
|
|
2068
|
+
this.targetElements.set(remainingElements);
|
|
2069
|
+
this.handleOutputElements();
|
|
2070
|
+
}
|
|
2071
|
+
handleOutputElements() {
|
|
2072
|
+
this.outputElements.emit({ sourceElements: this.sourceElements(), targetElements: this.targetElements() });
|
|
2073
|
+
}
|
|
2074
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PickListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2075
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: PickListComponent, isStandalone: true, selector: "lib-pick-list", inputs: { sourceElements: { classPropertyName: "sourceElements", publicName: "sourceElements", isSignal: true, isRequired: false, transformFunction: null }, targetElements: { classPropertyName: "targetElements", publicName: "targetElements", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sourceElements: "sourceElementsChange", targetElements: "targetElementsChange", outputElements: "outputElements" }, ngImport: i0, template: "@let cols = config()?.cols ?? 3;\r\n@let sourceSeverityButton = config()?.sourceSeverityButton ?? 'secondary';\r\n@let targetSeverityButton = config()?.targetSeverityButton ?? 'contrast';\r\n<div class=\"flex gap-4 h-80 w-full bg-gray-100 dark:bg-gray-800 rounded-xl p-3\">\r\n <lib-container-elements id=\"source-container\" [cols]=\"cols\" class=\"w-full h-full\" [(elements)]=\"sourceElements\"\r\n #sourceContainer [severityButton]=\"sourceSeverityButton\"\r\n (outputElements)=\"handleOutputElements()\"></lib-container-elements>\r\n\r\n <div class=\"w-[10%] flex flex-col items-center justify-center gap-6 rounded-xl bg-gray-200 dark:bg-gray-800\">\r\n @for (button of controlButtons(); track $index) {\r\n <lib-button-ng [buttonConfig]=\"button\"></lib-button-ng>\r\n }\r\n </div>\r\n\r\n <lib-container-elements id=\"target-container\" [cols]=\"cols\" class=\"w-full h-full\" [(elements)]=\"targetElements\"\r\n #targetContainer [severityButton]=\"targetSeverityButton\"\r\n (outputElements)=\"handleOutputElements()\"></lib-container-elements>\r\n\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: ButtonNgComponent, selector: "lib-button-ng", inputs: ["buttonConfig"], outputs: ["buttonConfigChange", "onClick"] }, { kind: "component", type: ContainerElementsComponent, selector: "lib-container-elements", inputs: ["cols", "elements", "severityButton"], outputs: ["elementsChange", "outputElements"] }] });
|
|
2076
|
+
}
|
|
2077
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PickListComponent, decorators: [{
|
|
2078
|
+
type: Component,
|
|
2079
|
+
args: [{ selector: 'lib-pick-list', imports: [ButtonNgComponent, ContainerElementsComponent], template: "@let cols = config()?.cols ?? 3;\r\n@let sourceSeverityButton = config()?.sourceSeverityButton ?? 'secondary';\r\n@let targetSeverityButton = config()?.targetSeverityButton ?? 'contrast';\r\n<div class=\"flex gap-4 h-80 w-full bg-gray-100 dark:bg-gray-800 rounded-xl p-3\">\r\n <lib-container-elements id=\"source-container\" [cols]=\"cols\" class=\"w-full h-full\" [(elements)]=\"sourceElements\"\r\n #sourceContainer [severityButton]=\"sourceSeverityButton\"\r\n (outputElements)=\"handleOutputElements()\"></lib-container-elements>\r\n\r\n <div class=\"w-[10%] flex flex-col items-center justify-center gap-6 rounded-xl bg-gray-200 dark:bg-gray-800\">\r\n @for (button of controlButtons(); track $index) {\r\n <lib-button-ng [buttonConfig]=\"button\"></lib-button-ng>\r\n }\r\n </div>\r\n\r\n <lib-container-elements id=\"target-container\" [cols]=\"cols\" class=\"w-full h-full\" [(elements)]=\"targetElements\"\r\n #targetContainer [severityButton]=\"targetSeverityButton\"\r\n (outputElements)=\"handleOutputElements()\"></lib-container-elements>\r\n\r\n</div>" }]
|
|
2080
|
+
}], ctorParameters: () => [] });
|
|
2081
|
+
|
|
2082
|
+
class AdvancedFilterService {
|
|
2083
|
+
constructor() {
|
|
2084
|
+
// Effect para actualizar isSelected basado en los chips
|
|
2085
|
+
effect(() => {
|
|
2086
|
+
const chips = [...this.searchChips()];
|
|
2087
|
+
this.updateElementSelection(chips);
|
|
2088
|
+
});
|
|
2089
|
+
}
|
|
2090
|
+
configInlineInput = computed(() => ({
|
|
2091
|
+
typeInput: ETypeInput.CHIPS
|
|
2092
|
+
}));
|
|
2093
|
+
_searchChips = signal([]);
|
|
2094
|
+
searchChips = this._searchChips.asReadonly();
|
|
2095
|
+
setSearchChips(searchChips) {
|
|
2096
|
+
this._searchChips.set(searchChips);
|
|
2097
|
+
}
|
|
2098
|
+
setStringToArrayChips(searchValue) {
|
|
2099
|
+
this._searchChips.set(searchValue.split(' ').filter(chip => chip.trim() !== ''));
|
|
2100
|
+
}
|
|
2101
|
+
_sourceElements = signal([]);
|
|
2102
|
+
sourceElements = this._sourceElements.asReadonly();
|
|
2103
|
+
setSourceElements(sourceElements) {
|
|
2104
|
+
this._sourceElements.set(sourceElements);
|
|
2105
|
+
}
|
|
2106
|
+
configPickList = computed(() => ({
|
|
2107
|
+
cols: 3,
|
|
2108
|
+
sourceSeverityButton: 'contrast',
|
|
2109
|
+
targetSeverityButton: 'success'
|
|
2110
|
+
}));
|
|
2111
|
+
/**
|
|
2112
|
+
* Actualiza la selección de elementos basándose en los chips del input
|
|
2113
|
+
* @param chips Array de strings que representan los chips actuales
|
|
2114
|
+
*/
|
|
2115
|
+
updateElementSelection(chips) {
|
|
2116
|
+
this._sourceElements.update(currentElements => {
|
|
2117
|
+
return currentElements.map((element) => {
|
|
2118
|
+
// Verificar si el label del elemento está en el array de chips
|
|
2119
|
+
const shouldBeSelected = chips.includes(element.buttonConfig?.label || '');
|
|
2120
|
+
if (shouldBeSelected) {
|
|
2121
|
+
delete element.buttonConfig.variant;
|
|
2122
|
+
delete element.buttonConfig.raised;
|
|
2123
|
+
}
|
|
2124
|
+
else {
|
|
2125
|
+
element.buttonConfig.variant = 'outlined';
|
|
2126
|
+
element.buttonConfig.raised = true;
|
|
2127
|
+
}
|
|
2128
|
+
return {
|
|
2129
|
+
...element,
|
|
2130
|
+
isSelected: shouldBeSelected
|
|
2131
|
+
};
|
|
2132
|
+
});
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
outputElements(event) {
|
|
2136
|
+
const { sourceElements } = event;
|
|
2137
|
+
this.setSourceElements(sourceElements);
|
|
2138
|
+
this.validateAndSyncChipsWithElements(sourceElements);
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Valida y sincroniza los chips con los elementos de sourceElements
|
|
2142
|
+
* @param sourceElements Array de elementos fuente
|
|
2143
|
+
*/
|
|
2144
|
+
validateAndSyncChipsWithElements(sourceElements) {
|
|
2145
|
+
const currentChips = this._searchChips();
|
|
2146
|
+
if (sourceElements.length === 0) {
|
|
2147
|
+
this.setSearchChips([]);
|
|
2148
|
+
return;
|
|
2149
|
+
}
|
|
2150
|
+
const validChips = [];
|
|
2151
|
+
// Iterar sobre cada chip actual
|
|
2152
|
+
currentChips.forEach(chip => {
|
|
2153
|
+
// Buscar el elemento correspondiente en sourceElements
|
|
2154
|
+
const element = sourceElements.find(el => el.buttonConfig?.label === chip);
|
|
2155
|
+
if (element) {
|
|
2156
|
+
// Si la chip existe en sourceElements
|
|
2157
|
+
if (element.isSelected === false) {
|
|
2158
|
+
// Si la chip está en isSelected false, NO la incluimos en validChips (la eliminamos)
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
else {
|
|
2162
|
+
// Si la chip está seleccionada, la mantenemos
|
|
2163
|
+
validChips.push(chip);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
else {
|
|
2167
|
+
// Si la chip no está en sourceElements, NO la incluimos en validChips (la eliminamos)
|
|
2168
|
+
return;
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
// Verificar si hay elementos seleccionados que no tienen chip correspondiente
|
|
2172
|
+
sourceElements.forEach(element => {
|
|
2173
|
+
if (element.isSelected && element.buttonConfig?.label) {
|
|
2174
|
+
const chipExists = currentChips.includes(element.buttonConfig.label);
|
|
2175
|
+
if (!chipExists) {
|
|
2176
|
+
// Si el elemento está seleccionado pero no tiene chip, agregamos la chip
|
|
2177
|
+
validChips.push(element.buttonConfig.label);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
});
|
|
2181
|
+
// Actualizar los chips solo si hay cambios
|
|
2182
|
+
if (JSON.stringify(validChips.sort()) !== JSON.stringify(currentChips.sort())) {
|
|
2183
|
+
this._searchChips.set(validChips);
|
|
2184
|
+
}
|
|
2185
|
+
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Método público para establecer chips desde un array externo
|
|
2188
|
+
* Útil para gestionar las chips programáticamente
|
|
2189
|
+
* @param chipsArray Array de strings que representan las chips
|
|
2190
|
+
*/
|
|
2191
|
+
setChipsFromArray(chipsArray) {
|
|
2192
|
+
if (!Array.isArray(chipsArray)) {
|
|
2193
|
+
console.warn('setChipsFromArray: El parámetro debe ser un array de strings');
|
|
2194
|
+
return;
|
|
2195
|
+
}
|
|
2196
|
+
// Filtrar elementos válidos (strings no vacíos)
|
|
2197
|
+
const validChips = chipsArray
|
|
2198
|
+
.filter(chip => typeof chip === 'string' && chip.trim() !== '')
|
|
2199
|
+
.map(chip => chip.trim());
|
|
2200
|
+
// Actualizar las chips
|
|
2201
|
+
this._searchChips.set(validChips);
|
|
2202
|
+
}
|
|
2203
|
+
/**
|
|
2204
|
+
* Método público para limpiar todas las chips
|
|
2205
|
+
*/
|
|
2206
|
+
clearAllChips() {
|
|
2207
|
+
this._searchChips.set([]);
|
|
2208
|
+
}
|
|
2209
|
+
/**
|
|
2210
|
+
* Método público para agregar chips desde un array
|
|
2211
|
+
* Evita duplicados
|
|
2212
|
+
* @param chipsArray Array de strings a agregar
|
|
2213
|
+
*/
|
|
2214
|
+
addChipsFromArray(chipsArray) {
|
|
2215
|
+
if (!Array.isArray(chipsArray)) {
|
|
2216
|
+
console.warn('addChipsFromArray: El parámetro debe ser un array de strings');
|
|
2217
|
+
return;
|
|
2218
|
+
}
|
|
2219
|
+
const currentChips = this._searchChips();
|
|
2220
|
+
// Filtrar elementos válidos y únicos
|
|
2221
|
+
const validChips = chipsArray
|
|
2222
|
+
.filter(chip => typeof chip === 'string' && chip.trim() !== '')
|
|
2223
|
+
.map(chip => chip.trim())
|
|
2224
|
+
.filter(chip => !currentChips.includes(chip));
|
|
2225
|
+
// Agregar las nuevas chips
|
|
2226
|
+
if (validChips.length > 0) {
|
|
2227
|
+
this._searchChips.set([...currentChips, ...validChips]);
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AdvancedFilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2231
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AdvancedFilterService, providedIn: 'root' });
|
|
2232
|
+
}
|
|
2233
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AdvancedFilterService, decorators: [{
|
|
2234
|
+
type: Injectable,
|
|
2235
|
+
args: [{
|
|
2236
|
+
providedIn: 'root'
|
|
2237
|
+
}]
|
|
2238
|
+
}], ctorParameters: () => [] });
|
|
2239
|
+
|
|
2240
|
+
class AdvancedFilterComponent {
|
|
2241
|
+
advancedFilterService = inject(AdvancedFilterService);
|
|
2242
|
+
sourceElements = model([]);
|
|
2243
|
+
targetElements = model([]);
|
|
2244
|
+
// Referencia al componente de inline input para gestionar las chips
|
|
2245
|
+
inlineInputComponent = viewChild('inlineInputRef');
|
|
2246
|
+
constructor() {
|
|
2247
|
+
// Sincronizar el service con el model del componente
|
|
2248
|
+
effect(() => {
|
|
2249
|
+
this.sourceElements.set(this.advancedFilterService.sourceElements());
|
|
2250
|
+
});
|
|
2251
|
+
// Efecto para sincronizar chips con el inline input
|
|
2252
|
+
effect(() => {
|
|
2253
|
+
const chips = this.advancedFilterService.searchChips();
|
|
2254
|
+
const inlineInput = this.inlineInputComponent();
|
|
2255
|
+
if (inlineInput && Array.isArray(chips)) {
|
|
2256
|
+
// Usar el nuevo método para establecer las chips
|
|
2257
|
+
inlineInput.setChipsFromArray(chips);
|
|
2258
|
+
}
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
ngOnInit() {
|
|
2262
|
+
this.initializeChipsWhitSourceElementsSelected();
|
|
2263
|
+
this.advancedFilterService.setSourceElements(this.sourceElements());
|
|
2264
|
+
}
|
|
2265
|
+
initializeChipsWhitSourceElementsSelected() {
|
|
2266
|
+
this.advancedFilterService.setSearchChips(this.sourceElements()
|
|
2267
|
+
.filter((element) => element.isSelected)
|
|
2268
|
+
.map((element) => element.buttonConfig?.label?.toString() ?? ''));
|
|
2269
|
+
}
|
|
2270
|
+
get configInlineInput() {
|
|
2271
|
+
return this.advancedFilterService.configInlineInput();
|
|
2272
|
+
}
|
|
2273
|
+
valueChangeInlineInput(value) {
|
|
2274
|
+
this.advancedFilterService.setStringToArrayChips(value);
|
|
2275
|
+
}
|
|
2276
|
+
get configPickList() {
|
|
2277
|
+
return this.advancedFilterService.configPickList();
|
|
2278
|
+
}
|
|
2279
|
+
outputElements(event) {
|
|
2280
|
+
this.advancedFilterService.outputElements(event);
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Método público para establecer chips desde un array externo
|
|
2284
|
+
* @param chipsArray Array de strings que representan las chips
|
|
2285
|
+
*/
|
|
2286
|
+
setChipsFromArray(chipsArray) {
|
|
2287
|
+
this.advancedFilterService.setChipsFromArray(chipsArray);
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Método público para limpiar todas las chips
|
|
2291
|
+
*/
|
|
2292
|
+
clearAllChips() {
|
|
2293
|
+
this.advancedFilterService.clearAllChips();
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* Método público para agregar chips desde un array
|
|
2297
|
+
* @param chipsArray Array de strings a agregar
|
|
2298
|
+
*/
|
|
2299
|
+
addChipsFromArray(chipsArray) {
|
|
2300
|
+
this.advancedFilterService.addChipsFromArray(chipsArray);
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Método público para obtener las chips actuales como array
|
|
2304
|
+
* @returns Array de strings con las chips actuales
|
|
2305
|
+
*/
|
|
2306
|
+
getChipsAsArray() {
|
|
2307
|
+
return this.advancedFilterService.searchChips();
|
|
2308
|
+
}
|
|
2309
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AdvancedFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2310
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.17", type: AdvancedFilterComponent, isStandalone: true, selector: "lib-advanced-filter", inputs: { sourceElements: { classPropertyName: "sourceElements", publicName: "sourceElements", isSignal: true, isRequired: false, transformFunction: null }, targetElements: { classPropertyName: "targetElements", publicName: "targetElements", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { sourceElements: "sourceElementsChange", targetElements: "targetElementsChange" }, providers: [AdvancedFilterService], viewQueries: [{ propertyName: "inlineInputComponent", first: true, predicate: ["inlineInputRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"flex flex-col gap-4\">\r\n <lib-inline-input #inlineInputRef [config]=\"configInlineInput\" (valueChange)=\"valueChangeInlineInput($event)\">\r\n </lib-inline-input>\r\n <lib-pick-list [(sourceElements)]=\"sourceElements\" [(targetElements)]=\"targetElements\"\r\n (outputElements)=\"outputElements($event)\" [config]=\"configPickList\"></lib-pick-list>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: InlineInputComponent, selector: "lib-inline-input", inputs: ["config", "value"], outputs: ["valueChange", "outputValue", "outputBlur", "outputDebounced"] }, { kind: "component", type: PickListComponent, selector: "lib-pick-list", inputs: ["sourceElements", "targetElements", "config"], outputs: ["sourceElementsChange", "targetElementsChange", "outputElements"] }] });
|
|
2311
|
+
}
|
|
2312
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: AdvancedFilterComponent, decorators: [{
|
|
2313
|
+
type: Component,
|
|
2314
|
+
args: [{ selector: 'lib-advanced-filter', imports: [InlineInputComponent, PickListComponent], providers: [AdvancedFilterService], template: "<div class=\"flex flex-col gap-4\">\r\n <lib-inline-input #inlineInputRef [config]=\"configInlineInput\" (valueChange)=\"valueChangeInlineInput($event)\">\r\n </lib-inline-input>\r\n <lib-pick-list [(sourceElements)]=\"sourceElements\" [(targetElements)]=\"targetElements\"\r\n (outputElements)=\"outputElements($event)\" [config]=\"configPickList\"></lib-pick-list>\r\n</div>" }]
|
|
2315
|
+
}], ctorParameters: () => [] });
|
|
2316
|
+
|
|
2317
|
+
class ModalAdvancedFilterComponent extends BaseDialogComponent {
|
|
2318
|
+
constructor() {
|
|
2319
|
+
super();
|
|
2320
|
+
}
|
|
2321
|
+
sourceElements = signal([]);
|
|
2322
|
+
targetElements = signal([]);
|
|
2323
|
+
ngOnInit() {
|
|
2324
|
+
if (this.data) {
|
|
2325
|
+
this.sourceElements.set(this.data.sourceElements ?? []);
|
|
2326
|
+
this.targetElements.set(this.data.targetElements ?? []);
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
applyFiltersButton = computed(() => {
|
|
2330
|
+
return {
|
|
2331
|
+
label: 'Aplicar Filtros',
|
|
2332
|
+
severity: 'info',
|
|
2333
|
+
onClick: () => {
|
|
2334
|
+
this.close({ success: true, data: { sourceElements: this.sourceElements(), targetElements: this.targetElements() } });
|
|
2335
|
+
},
|
|
2336
|
+
disabled: this.targetElements().length === 0
|
|
2337
|
+
};
|
|
2338
|
+
});
|
|
2339
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ModalAdvancedFilterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2340
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: ModalAdvancedFilterComponent, isStandalone: true, selector: "lib-modal-advanced-filter", usesInheritance: true, ngImport: i0, template: "<div class=\"flex flex-col gap-4\">\r\n <lib-advanced-filter [(sourceElements)]=\"sourceElements\" [(targetElements)]=\"targetElements\"></lib-advanced-filter>\r\n <div class=\"flex justify-end\">\r\n <lib-button-ng [buttonConfig]=\"applyFiltersButton()\"></lib-button-ng>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: AdvancedFilterComponent, selector: "lib-advanced-filter", inputs: ["sourceElements", "targetElements"], outputs: ["sourceElementsChange", "targetElementsChange"] }, { kind: "component", type: ButtonNgComponent, selector: "lib-button-ng", inputs: ["buttonConfig"], outputs: ["buttonConfigChange", "onClick"] }] });
|
|
2341
|
+
}
|
|
2342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ModalAdvancedFilterComponent, decorators: [{
|
|
2343
|
+
type: Component,
|
|
2344
|
+
args: [{ selector: 'lib-modal-advanced-filter', imports: [AdvancedFilterComponent, ButtonNgComponent], template: "<div class=\"flex flex-col gap-4\">\r\n <lib-advanced-filter [(sourceElements)]=\"sourceElements\" [(targetElements)]=\"targetElements\"></lib-advanced-filter>\r\n <div class=\"flex justify-end\">\r\n <lib-button-ng [buttonConfig]=\"applyFiltersButton()\"></lib-button-ng>\r\n </div>\r\n</div>" }]
|
|
2345
|
+
}], ctorParameters: () => [] });
|
|
2346
|
+
|
|
2347
|
+
class SpeedDialNgService {
|
|
2348
|
+
constructor() { }
|
|
2349
|
+
_config = signal({});
|
|
2350
|
+
config = this._config.asReadonly();
|
|
2351
|
+
items = computed(() => this.config().items);
|
|
2352
|
+
buttonProps = computed(() => this.config().buttonProps ?? { severity: 'primary', rounded: true });
|
|
2353
|
+
tooltipOptions = computed(() => this.config().tooltipOptions ?? { tooltipPosition: 'top' });
|
|
2354
|
+
style = computed(() => this.config().style ?? {});
|
|
2355
|
+
direction = computed(() => this.config().direction ?? 'down');
|
|
2356
|
+
setConfig(value) {
|
|
2357
|
+
this._config.set(value);
|
|
2358
|
+
}
|
|
2359
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SpeedDialNgService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2360
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SpeedDialNgService, providedIn: 'root' });
|
|
2361
|
+
}
|
|
2362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SpeedDialNgService, decorators: [{
|
|
2363
|
+
type: Injectable,
|
|
2364
|
+
args: [{
|
|
2365
|
+
providedIn: 'root'
|
|
2366
|
+
}]
|
|
2367
|
+
}], ctorParameters: () => [] });
|
|
2368
|
+
|
|
2369
|
+
class SpeedDialNgComponent {
|
|
2370
|
+
speedDialNgService = inject(SpeedDialNgService);
|
|
2371
|
+
configInput = input.required();
|
|
2372
|
+
constructor() {
|
|
2373
|
+
}
|
|
2374
|
+
ngOnInit() {
|
|
2375
|
+
this.speedDialNgService.setConfig(this.configInput());
|
|
2376
|
+
}
|
|
2377
|
+
get config() {
|
|
2378
|
+
return this.speedDialNgService.config();
|
|
2379
|
+
}
|
|
2380
|
+
get items() {
|
|
2381
|
+
return this.speedDialNgService.items();
|
|
2382
|
+
}
|
|
2383
|
+
get buttonProps() {
|
|
2384
|
+
return this.speedDialNgService.buttonProps();
|
|
2385
|
+
}
|
|
2386
|
+
get tooltipOptions() {
|
|
2387
|
+
return this.speedDialNgService.tooltipOptions();
|
|
2388
|
+
}
|
|
2389
|
+
get style() {
|
|
2390
|
+
return this.speedDialNgService.style();
|
|
2391
|
+
}
|
|
2392
|
+
get direction() {
|
|
2393
|
+
return this.speedDialNgService.direction();
|
|
2394
|
+
}
|
|
2395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SpeedDialNgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2396
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.17", type: SpeedDialNgComponent, isStandalone: true, selector: "lib-speed-dial-ng", inputs: { configInput: { classPropertyName: "configInput", publicName: "configInput", isSignal: true, isRequired: true, transformFunction: null } }, providers: [SpeedDialNgService], ngImport: i0, template: "\r\n<p-speeddial \r\n[model]=\"items\" \r\ndirection=\"up\" \r\n[style]=\"style\" \r\n[buttonProps]=\"buttonProps\" \r\n[tooltipOptions]=\"tooltipOptions\" \r\n[direction]=\"direction\"\r\n/>", styles: [""], dependencies: [{ kind: "ngmodule", type: SpeedDialModule }, { kind: "component", type: i1$5.SpeedDial, selector: "p-speeddial, p-speedDial, p-speed-dial", inputs: ["id", "model", "visible", "style", "className", "direction", "transitionDelay", "type", "radius", "mask", "disabled", "hideOnClickOutside", "buttonStyle", "buttonClassName", "maskStyle", "maskClassName", "showIcon", "hideIcon", "rotateAnimation", "ariaLabel", "ariaLabelledBy", "tooltipOptions", "buttonProps"], outputs: ["onVisibleChange", "visibleChange", "onClick", "onShow", "onHide"] }] });
|
|
2397
|
+
}
|
|
2398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: SpeedDialNgComponent, decorators: [{
|
|
2399
|
+
type: Component,
|
|
2400
|
+
args: [{ selector: 'lib-speed-dial-ng', imports: [SpeedDialModule], providers: [SpeedDialNgService], template: "\r\n<p-speeddial \r\n[model]=\"items\" \r\ndirection=\"up\" \r\n[style]=\"style\" \r\n[buttonProps]=\"buttonProps\" \r\n[tooltipOptions]=\"tooltipOptions\" \r\n[direction]=\"direction\"\r\n/>" }]
|
|
2401
|
+
}], ctorParameters: () => [] });
|
|
2402
|
+
|
|
2403
|
+
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
2404
|
+
class TableNgComponent {
|
|
2405
|
+
tableNgService = inject(TableNgService);
|
|
2406
|
+
tableNgEditService = inject(TableNgEditService);
|
|
2407
|
+
dialogService = inject(CustomDialogService);
|
|
2408
|
+
data = model.required();
|
|
2409
|
+
// Loading state management
|
|
2410
|
+
loadingTimeout = null;
|
|
2411
|
+
isLoading = signal(false);
|
|
2412
|
+
timeoutExpired = signal(false);
|
|
2413
|
+
config = model();
|
|
2414
|
+
editConfig = model();
|
|
2415
|
+
footerConfig = model();
|
|
2416
|
+
toolbarButtons = model([]);
|
|
2417
|
+
toolbarSpeedDialButtons = model([]);
|
|
2418
|
+
sourceElements = model([]);
|
|
2419
|
+
targetElements = model([]);
|
|
2420
|
+
httpMessage = model();
|
|
2421
|
+
lazyLoading = output();
|
|
2422
|
+
outputChangeData = output();
|
|
2423
|
+
outputHandleEditInitButton = output();
|
|
2424
|
+
outputAddRow = output();
|
|
2425
|
+
outputDeleteRow = output();
|
|
2426
|
+
outputRowInlineChange = output();
|
|
2427
|
+
outputRowDataChange = output();
|
|
2428
|
+
outputEditData = output();
|
|
2429
|
+
outputIsEditing = output();
|
|
2430
|
+
resetData() {
|
|
2431
|
+
this.data.set([]);
|
|
2432
|
+
}
|
|
2433
|
+
advancedFiltersPerformed = [];
|
|
2434
|
+
advancedFiltersValues = signal({});
|
|
2435
|
+
dt;
|
|
2436
|
+
fb = inject(NonNullableFormBuilder);
|
|
2437
|
+
//#region Labels Configuration
|
|
2438
|
+
/** Get pagination report template with default English value */
|
|
2439
|
+
getCustomPageReport() {
|
|
2440
|
+
return this.config()?.labelsConfig?.customPageReport ?? 'Showing {first} to {last} of {totalRecords} entries';
|
|
2441
|
+
}
|
|
2442
|
+
/** Get selected items label with default English value */
|
|
2443
|
+
getSelectedItemsLabel() {
|
|
2444
|
+
return this.config()?.labelsConfig?.selectedItemsLabel ?? 'You have selected';
|
|
2445
|
+
}
|
|
2446
|
+
/** Get records label with default English value */
|
|
2447
|
+
getRecordsLabel() {
|
|
2448
|
+
return this.config()?.labelsConfig?.recordsLabel ?? 'records';
|
|
2449
|
+
}
|
|
2450
|
+
/** Get loading message with default English value */
|
|
2451
|
+
getLoadingMessage() {
|
|
2452
|
+
return this.config()?.labelsConfig?.loadingMessage ?? 'Loading...';
|
|
2453
|
+
}
|
|
2454
|
+
/** Get no data message with default English value */
|
|
2455
|
+
getNoDataMessage() {
|
|
2456
|
+
return this.config()?.labelsConfig?.noDataMessage ?? 'No information available';
|
|
2457
|
+
}
|
|
2458
|
+
//#endregion
|
|
2459
|
+
constructor() {
|
|
2460
|
+
this.tableNgEditService.setEditConfig(this.editConfig());
|
|
2461
|
+
this.tableNgEditService.setKeysNames(this.config()?.keysNames ?? {});
|
|
2462
|
+
// Effect para sincronizar el config con el servicio cuando cambie
|
|
2463
|
+
effect(() => {
|
|
2464
|
+
const configValue = this.config();
|
|
2465
|
+
if (configValue) {
|
|
2466
|
+
this.tableNgService.setConfig(configValue);
|
|
2467
|
+
}
|
|
2468
|
+
});
|
|
2469
|
+
effect(() => {
|
|
2470
|
+
this.outputChangeData.emit([...this.data()]);
|
|
2471
|
+
});
|
|
2472
|
+
// Effect para gestionar el loading basado en el estado de data
|
|
2473
|
+
effect(() => {
|
|
2474
|
+
const currentData = this.data();
|
|
2475
|
+
// Limpiar el timeout anterior si existe
|
|
2476
|
+
if (this.loadingTimeout) {
|
|
2477
|
+
clearTimeout(this.loadingTimeout);
|
|
2478
|
+
this.loadingTimeout = null;
|
|
2479
|
+
}
|
|
2480
|
+
if (currentData.length === 0) {
|
|
2481
|
+
// Si data está vacío, activar loading
|
|
2482
|
+
this.isLoading.set(true);
|
|
2483
|
+
this.loadingTimeout = setTimeout(() => {
|
|
2484
|
+
if (this.data().length === 0) {
|
|
2485
|
+
this.isLoading.set(false);
|
|
2486
|
+
this.timeoutExpired.set(true);
|
|
2487
|
+
}
|
|
2488
|
+
}, 0);
|
|
2489
|
+
}
|
|
2490
|
+
else {
|
|
2491
|
+
// Si hay data, desactivar loading y resetear timeout
|
|
2492
|
+
this.isLoading.set(false);
|
|
2493
|
+
this.timeoutExpired.set(false);
|
|
2494
|
+
}
|
|
2495
|
+
});
|
|
2496
|
+
}
|
|
2497
|
+
ngOnInit() {
|
|
2498
|
+
this.tableNgService.setInitialValue([...this.data()]);
|
|
2499
|
+
}
|
|
2500
|
+
ngOnDestroy() {
|
|
2501
|
+
// Limpiar el timeout al destruir el componente
|
|
2502
|
+
if (this.loadingTimeout) {
|
|
2503
|
+
clearTimeout(this.loadingTimeout);
|
|
2504
|
+
this.loadingTimeout = null;
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
get hideToolbar() { return this.config()?.hideToolbar ?? false; }
|
|
2508
|
+
/**
|
|
2509
|
+
* Calcula el número total de columnas para el colspan del mensaje vacío
|
|
2510
|
+
*/
|
|
2511
|
+
totalColumns = computed(() => {
|
|
2512
|
+
const selectedColumns = this.config()?.selectedColumns ?? [];
|
|
2513
|
+
const baseColumns = selectedColumns.length > 0 ? selectedColumns.length : this.keys().length;
|
|
2514
|
+
const selectionColumn = this.config()?.selectionTableConfig?.isEnabled ? 1 : 0;
|
|
2515
|
+
const expansionColumn = this.config()?.rowExpansionConfig?.isEnabled ? 1 : 0;
|
|
2516
|
+
const editColumn = (this.editConfig()?.type === 'row' || this.editConfig()?.type === 'cell') && this.editConfig()?.isEnabled ? 1 : 0;
|
|
2517
|
+
return baseColumns + selectionColumn + expansionColumn + editColumn;
|
|
2518
|
+
});
|
|
2519
|
+
isPrimeNgSelection(value) {
|
|
2520
|
+
return PrimeNgUtil.isPrimeNgSelection(value);
|
|
2521
|
+
}
|
|
2522
|
+
hasErrorValues(object) {
|
|
2523
|
+
return Object.keys(object).length > 0;
|
|
2524
|
+
}
|
|
2525
|
+
rowFieldsValue = signal({});
|
|
2526
|
+
rowFieldsHasValue = computed(() => {
|
|
2527
|
+
return Object.keys(this.rowFieldsValue()).reduce((acc, key) => {
|
|
2528
|
+
acc[key] = !!this.rowFieldsValue()[key];
|
|
2529
|
+
return acc;
|
|
2530
|
+
}, {});
|
|
2531
|
+
});
|
|
2532
|
+
inlineChange(value, key) {
|
|
2533
|
+
this.rowFieldsValue.update((prev) => {
|
|
2534
|
+
return { ...prev, [key]: value };
|
|
2535
|
+
});
|
|
2536
|
+
this.outputRowInlineChange.emit({ ...this.rowFieldsValue() });
|
|
2537
|
+
}
|
|
2538
|
+
trackById(index, item) {
|
|
2539
|
+
return item.id;
|
|
2540
|
+
}
|
|
2541
|
+
frozenHandle(value) {
|
|
2542
|
+
return value ? value : false;
|
|
2543
|
+
}
|
|
2544
|
+
isDate(value) {
|
|
2545
|
+
return value instanceof Date;
|
|
2546
|
+
}
|
|
2547
|
+
onFilter(event) {
|
|
2548
|
+
const filters = event.filters;
|
|
2549
|
+
if (!filters)
|
|
2550
|
+
return;
|
|
2551
|
+
const global = filters['global'];
|
|
2552
|
+
if (!global?.['value']) {
|
|
2553
|
+
this.handleAdvancedFiltersPerformed(filters);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
resetRowDatas() {
|
|
2557
|
+
this.data.update((data) => {
|
|
2558
|
+
return data.map((item) => {
|
|
2559
|
+
return {
|
|
2560
|
+
...item,
|
|
2561
|
+
rowData: {}
|
|
2562
|
+
};
|
|
2563
|
+
});
|
|
2564
|
+
});
|
|
2565
|
+
}
|
|
2566
|
+
get ETypeInput() {
|
|
2567
|
+
return ETypeInput;
|
|
2568
|
+
}
|
|
2569
|
+
handleAdvancedFiltersPerformed(filters) {
|
|
2570
|
+
if (!filters)
|
|
2571
|
+
return;
|
|
2572
|
+
const entriesFilters = Object.entries(filters);
|
|
2573
|
+
const keysColumn = this.config()?.keys ?? [];
|
|
2574
|
+
entriesFilters.forEach(([key, value]) => {
|
|
2575
|
+
const valueArray = value;
|
|
2576
|
+
const hasValue = !!valueArray[0]?.value;
|
|
2577
|
+
const keyColumn = key.split('.')[1];
|
|
2578
|
+
if (keysColumn.includes(keyColumn)) {
|
|
2579
|
+
const index = this.advancedFiltersPerformed.indexOf(keyColumn);
|
|
2580
|
+
if (hasValue && index === -1) {
|
|
2581
|
+
// Agregar si no existe
|
|
2582
|
+
this.advancedFiltersPerformed.push(keyColumn);
|
|
2583
|
+
}
|
|
2584
|
+
else if (!hasValue && index !== -1) {
|
|
2585
|
+
// Quitar si ya no tiene valor
|
|
2586
|
+
this.advancedFiltersPerformed.splice(index, 1);
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
numberOfRecords = computed(() => {
|
|
2592
|
+
return this.data().length ?? 0;
|
|
2593
|
+
});
|
|
2594
|
+
hasRecords = computed(() => {
|
|
2595
|
+
return this.numberOfRecords() > 0;
|
|
2596
|
+
});
|
|
2597
|
+
/**
|
|
2598
|
+
* Computed que valida si al menos una fila tiene datos válidos en rowData.
|
|
2599
|
+
* Retorna true si al menos una fila tiene un valor que no sea '', null o undefined.
|
|
2600
|
+
* Retorna false si todas las filas tienen valores vacíos, null o undefined.
|
|
2601
|
+
*/
|
|
2602
|
+
hasValidRowData = computed(() => {
|
|
2603
|
+
const data = this.data();
|
|
2604
|
+
return data.some(item => {
|
|
2605
|
+
if (!item?.rowData || typeof item.rowData !== 'object') {
|
|
2606
|
+
return false;
|
|
2607
|
+
}
|
|
2608
|
+
const values = Object.values(item.rowData);
|
|
2609
|
+
// Verificar si al menos un valor es válido (no vacío, null o undefined)
|
|
2610
|
+
return values.some(value => {
|
|
2611
|
+
if (value === null || value === undefined || value === '') {
|
|
2612
|
+
return false;
|
|
2613
|
+
}
|
|
2614
|
+
// Si es string, verificar que no esté vacío después de trim
|
|
2615
|
+
if (typeof value === 'string') {
|
|
2616
|
+
return value.trim() !== '';
|
|
2617
|
+
}
|
|
2618
|
+
// Para otros tipos (números, fechas, booleanos, etc.)
|
|
2619
|
+
return true;
|
|
2620
|
+
});
|
|
2621
|
+
});
|
|
2622
|
+
});
|
|
2623
|
+
keys = computed(() => {
|
|
2624
|
+
return this.config()?.keys ?? [];
|
|
2625
|
+
});
|
|
2626
|
+
onRowClick(item) {
|
|
2627
|
+
item.onClick();
|
|
2628
|
+
}
|
|
2629
|
+
//#region Scroll Config
|
|
2630
|
+
scrollHeight = computed(() => {
|
|
2631
|
+
const scrollHeightInitial = this.config()?.scrollConfig?.scrollHeight ?? '58vh';
|
|
2632
|
+
let res = scrollHeightInitial;
|
|
2633
|
+
if (this.showBottomToolbar()) {
|
|
2634
|
+
const { number: size, unit } = this.parseValue(scrollHeightInitial);
|
|
2635
|
+
res = `${size - 7.6}${unit}`;
|
|
2636
|
+
}
|
|
2637
|
+
return res;
|
|
2638
|
+
});
|
|
2639
|
+
parseValue(str) {
|
|
2640
|
+
const match = str.match(/^(-?\d+\.?\d*)(.*)$/);
|
|
2641
|
+
if (match) {
|
|
2642
|
+
return {
|
|
2643
|
+
number: parseFloat(match[1]),
|
|
2644
|
+
unit: match[2]
|
|
2645
|
+
};
|
|
2646
|
+
}
|
|
2647
|
+
return { number: 0, unit: '' };
|
|
2648
|
+
}
|
|
2649
|
+
//#endregion
|
|
2650
|
+
//#region Paginator Config
|
|
2651
|
+
paginatorStyleClass = computed(() => {
|
|
2652
|
+
if (this.showBottomToolbar()) {
|
|
2653
|
+
return 'p-datatable-paginator p-datatable-paginator-bottom sticky bottom-18 z-10';
|
|
2654
|
+
}
|
|
2655
|
+
return 'p-datatable-paginator p-datatable-paginator-bottom sticky bottom-2 z-10';
|
|
2656
|
+
});
|
|
2657
|
+
//#endregion
|
|
2658
|
+
//#region toolbar config
|
|
2659
|
+
showBottomToolbar = computed(() => {
|
|
2660
|
+
return this.showManagementSelectionConfig();
|
|
2661
|
+
});
|
|
2662
|
+
//#endregion
|
|
2663
|
+
//#region Clear Filters
|
|
2664
|
+
clearFilters() {
|
|
2665
|
+
this.tableNgService.clearSearchInput();
|
|
2666
|
+
this.advancedFiltersPerformed = [];
|
|
2667
|
+
this.advancedFiltersValues.set({});
|
|
2668
|
+
this.dt.clear();
|
|
2669
|
+
this.targetElements.set([]);
|
|
2670
|
+
this.handleTableValueToSourceElements();
|
|
2671
|
+
this.selectedItems.set([]);
|
|
2672
|
+
}
|
|
2673
|
+
get filteredValue() {
|
|
2674
|
+
return !!this.dt?.filteredValue && this.dt.filteredValue.length > 0;
|
|
2675
|
+
}
|
|
2676
|
+
clearFiltersButton = computed(() => {
|
|
2677
|
+
return {
|
|
2678
|
+
icon: 'fa-solid fa-filter-circle-xmark',
|
|
2679
|
+
rounded: true,
|
|
2680
|
+
raised: true,
|
|
2681
|
+
severity: 'contrast',
|
|
2682
|
+
tooltipConfig: {
|
|
2683
|
+
pTooltip: 'Limpiar filtros'
|
|
2684
|
+
},
|
|
2685
|
+
onClick: () => {
|
|
2686
|
+
this.clearFilters();
|
|
2687
|
+
}
|
|
2688
|
+
};
|
|
2689
|
+
});
|
|
2690
|
+
//#endregion
|
|
2691
|
+
//#region Global Filter
|
|
2692
|
+
get controlsGlobalFilter() {
|
|
2693
|
+
return this.tableNgService.controls();
|
|
2694
|
+
}
|
|
2695
|
+
get searchFormGroupGlobalFilter() {
|
|
2696
|
+
return this.tableNgService.searchFormGroup();
|
|
2697
|
+
}
|
|
2698
|
+
submitGlobalSearch(formGroup) {
|
|
2699
|
+
this.dt.globalFilterFields = this.config()?.globalFilterConfig?.globalFilterFields ?? [];
|
|
2700
|
+
this.tableNgService.submitGlobalSearch(formGroup, this.dt);
|
|
2701
|
+
}
|
|
2702
|
+
//#endregion
|
|
2703
|
+
//#region SORT
|
|
2704
|
+
customSort(event) {
|
|
2705
|
+
this.tableNgService.customSort(event);
|
|
2706
|
+
}
|
|
2707
|
+
//#endregion
|
|
2708
|
+
//#region Selection
|
|
2709
|
+
selectedItems = model([]);
|
|
2710
|
+
totalItemsSelected = computed(() => this.selectedItems().length);
|
|
2711
|
+
showManagementSelectionConfig = computed(() => this.totalItemsSelected() > 0 && (this.config()?.selectionTableConfig?.showManagementConfig ?? false));
|
|
2712
|
+
buttonTotalItemsSelected = computed(() => {
|
|
2713
|
+
return {
|
|
2714
|
+
label: this.totalItemsSelected().toLocaleString(),
|
|
2715
|
+
variant: 'text',
|
|
2716
|
+
rounded: true
|
|
2717
|
+
};
|
|
2718
|
+
});
|
|
2719
|
+
showSelectedItemsManagementButton = computed(() => {
|
|
2720
|
+
return {
|
|
2721
|
+
icon: 'fa-solid fa-eye',
|
|
2722
|
+
rounded: true,
|
|
2723
|
+
variant: 'text',
|
|
2724
|
+
severity: 'secondary',
|
|
2725
|
+
onClick: () => {
|
|
2726
|
+
this.openModalManagementSelectedItems();
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
});
|
|
2730
|
+
openModalManagementSelectedItems() {
|
|
2731
|
+
this.tableNgService.openModalManagementSelectedItems(this.selectedItems, this.config())
|
|
2732
|
+
.then(() => { })
|
|
2733
|
+
.catch(() => { });
|
|
2734
|
+
}
|
|
2735
|
+
//#endregion
|
|
2736
|
+
//#region Custom Filter
|
|
2737
|
+
inlineFormChanges(inlineValue, filter, typeInput, key) {
|
|
2738
|
+
const lazyLoadingConfig = this.config()?.lazyLoadingConfig;
|
|
2739
|
+
if (typeInput === ETypeInput.MULTISELECT) {
|
|
2740
|
+
const options = inlineValue ? inlineValue : undefined;
|
|
2741
|
+
const arrayValue = options ? options.map((data) => lazyLoadingConfig?.isEnabled ? data.code : data.name) : undefined;
|
|
2742
|
+
if (Array.isArray(arrayValue) && arrayValue.length === 0) {
|
|
2743
|
+
if (key) {
|
|
2744
|
+
this.advancedFiltersValues.update((prev) => {
|
|
2745
|
+
const { [key]: _value, ...rest } = prev;
|
|
2746
|
+
return { ...rest };
|
|
2747
|
+
});
|
|
2748
|
+
}
|
|
2749
|
+
}
|
|
2750
|
+
if (inlineValue && (Array.isArray(arrayValue) && arrayValue.length > 0)) {
|
|
2751
|
+
filter(arrayValue);
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
formChanges(formValue, filter, key) {
|
|
2756
|
+
if (Array.isArray(formValue['multiSelect'])) {
|
|
2757
|
+
this.advancedFiltersValues.update((prev) => {
|
|
2758
|
+
return { ...prev, [key]: formValue };
|
|
2759
|
+
});
|
|
2760
|
+
}
|
|
2761
|
+
if (!Array.isArray(formValue['multiSelect']) && this.advancedFiltersValues()?.[key]) {
|
|
2762
|
+
this.advancedFiltersValues.update((prev) => {
|
|
2763
|
+
const { [key]: _value, ...rest } = prev;
|
|
2764
|
+
return { ...rest };
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2767
|
+
const arrayValue = Array.isArray(formValue['multiSelect'])
|
|
2768
|
+
? formValue['multiSelect'].map((data) => data.code)
|
|
2769
|
+
: [];
|
|
2770
|
+
if (arrayValue.length > 0) {
|
|
2771
|
+
filter(arrayValue);
|
|
2772
|
+
}
|
|
2773
|
+
}
|
|
2774
|
+
rowDataKey(key) {
|
|
2775
|
+
return `rowData.${key}`;
|
|
2776
|
+
}
|
|
2777
|
+
//#endregion
|
|
2778
|
+
//#region Lazy Loading
|
|
2779
|
+
onLazyLoad(event) {
|
|
2780
|
+
const filters = event.filters ?? {};
|
|
2781
|
+
const filtersWithValue = this.getFiltersWithValue(filters);
|
|
2782
|
+
const metaPagination = {};
|
|
2783
|
+
if (event.first) {
|
|
2784
|
+
metaPagination.skip = event.first;
|
|
2785
|
+
}
|
|
2786
|
+
if (event.rows) {
|
|
2787
|
+
metaPagination.limit = event.rows;
|
|
2788
|
+
}
|
|
2789
|
+
if (event.sortOrder) {
|
|
2790
|
+
metaPagination.sortOrder = event.sortOrder === 1 ? 'ASC' : 'DESC';
|
|
2791
|
+
}
|
|
2792
|
+
if (event.sortField) {
|
|
2793
|
+
metaPagination.sortBy = event.sortField;
|
|
2794
|
+
}
|
|
2795
|
+
const lazyLoadResponse = {
|
|
2796
|
+
filters: filtersWithValue,
|
|
2797
|
+
metaPagination
|
|
2798
|
+
};
|
|
2799
|
+
this.lazyLoading.emit(lazyLoadResponse);
|
|
2800
|
+
}
|
|
2801
|
+
getFiltersWithValue(filters) {
|
|
2802
|
+
const result = {};
|
|
2803
|
+
Object.entries(filters).forEach(([key, filter]) => {
|
|
2804
|
+
const keyColumn = key.split('.')[1];
|
|
2805
|
+
if (!filter)
|
|
2806
|
+
return;
|
|
2807
|
+
if (Array.isArray(filter)) {
|
|
2808
|
+
// Si es un array, filtrar solo los elementos que tienen value
|
|
2809
|
+
const filtersWithValue = filter.filter(f => f.value !== undefined && f.value !== null && f.value !== '');
|
|
2810
|
+
if (filtersWithValue.length > 0) {
|
|
2811
|
+
result[keyColumn] = filtersWithValue;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
else {
|
|
2815
|
+
// Si es un objeto único, verificar si tiene value
|
|
2816
|
+
if (filter.value !== undefined && filter.value !== null && filter.value !== '') {
|
|
2817
|
+
result[keyColumn] = filter;
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
});
|
|
2821
|
+
return result;
|
|
2822
|
+
}
|
|
2823
|
+
//#endregion
|
|
2824
|
+
//#region Edit
|
|
2825
|
+
onCellValueChange() {
|
|
2826
|
+
this.updateDataWithTableValue();
|
|
2827
|
+
}
|
|
2828
|
+
onRowDataChange(_data) {
|
|
2829
|
+
}
|
|
2830
|
+
onEditData() {
|
|
2831
|
+
this.updateDataWithTableValue();
|
|
2832
|
+
this.outputEditData.emit([...this.data()]);
|
|
2833
|
+
}
|
|
2834
|
+
get controlsEdit() {
|
|
2835
|
+
return this.tableNgEditService.controls();
|
|
2836
|
+
}
|
|
2837
|
+
get searchFormGroupEdit() {
|
|
2838
|
+
return this.tableNgEditService.searchFormGroup();
|
|
2839
|
+
}
|
|
2840
|
+
customControlConfig(key, value) {
|
|
2841
|
+
return {
|
|
2842
|
+
controlName: key,
|
|
2843
|
+
control: this.fb.control(value),
|
|
2844
|
+
typeInput: ETypeInput.TEXT
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
cellFormGroup = this.fb.group({});
|
|
2848
|
+
//#region Row
|
|
2849
|
+
addRowButton = computed(() => {
|
|
2850
|
+
const editConfig = this.editConfig();
|
|
2851
|
+
const isDisabled = editConfig?.type === 'cell'
|
|
2852
|
+
? (editConfig?.cellEditConfig?.isDisabledAddButton ?? false)
|
|
2853
|
+
: (editConfig?.rowEditConfig?.isDisabledAddButton ?? false) || this.hasRowInEdit;
|
|
2854
|
+
const button = {
|
|
2855
|
+
icon: 'fa-solid fa-plus',
|
|
2856
|
+
rounded: true,
|
|
2857
|
+
severity: 'success',
|
|
2858
|
+
tooltipConfig: {
|
|
2859
|
+
pTooltip: 'Agregar registro',
|
|
2860
|
+
tooltipPosition: 'top'
|
|
2861
|
+
},
|
|
2862
|
+
onClick: () => {
|
|
2863
|
+
this.addRow();
|
|
2864
|
+
},
|
|
2865
|
+
disabled: isDisabled
|
|
2866
|
+
};
|
|
2867
|
+
return button;
|
|
2868
|
+
});
|
|
2869
|
+
addRow() {
|
|
2870
|
+
const editConfig = this.editConfig();
|
|
2871
|
+
// Si es modo cell y hay defaultTableNgData configurado, agregar la fila directamente
|
|
2872
|
+
if (editConfig?.type === 'cell' && editConfig?.cellEditConfig?.defaultTableNgData) {
|
|
2873
|
+
const newRow = this.editConfig()?.cellEditConfig?.defaultTableNgData;
|
|
2874
|
+
if (newRow) {
|
|
2875
|
+
this.data.update(currentData => [...currentData, newRow]);
|
|
2876
|
+
this.outputChangeData.emit(this.data());
|
|
2877
|
+
return;
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
// Comportamiento original para modo row o cuando no hay defaultTableNgData
|
|
2881
|
+
this.outputAddRow.emit(this.data());
|
|
2882
|
+
this.setEditingRowId(null);
|
|
2883
|
+
}
|
|
2884
|
+
defaultTableNgData = computed(() => {
|
|
2885
|
+
const editConfig = this.editConfig();
|
|
2886
|
+
let defaultData;
|
|
2887
|
+
// Usar la configuración apropiada según el tipo de edición
|
|
2888
|
+
if (editConfig?.type === 'cell' && editConfig?.cellEditConfig?.defaultTableNgData) {
|
|
2889
|
+
defaultData = editConfig.cellEditConfig.defaultTableNgData;
|
|
2890
|
+
}
|
|
2891
|
+
else if (editConfig?.type === 'row' && editConfig?.rowEditConfig?.defaultTableNgData) {
|
|
2892
|
+
defaultData = editConfig.rowEditConfig.defaultTableNgData;
|
|
2893
|
+
}
|
|
2894
|
+
const res = { ...defaultData };
|
|
2895
|
+
return {
|
|
2896
|
+
...res,
|
|
2897
|
+
id: generateId()
|
|
2898
|
+
};
|
|
2899
|
+
});
|
|
2900
|
+
clonedRowData = null;
|
|
2901
|
+
editingRowId = signal(null);
|
|
2902
|
+
/**
|
|
2903
|
+
* Verifica si una fila específica está siendo editada
|
|
2904
|
+
*/
|
|
2905
|
+
isRowEditing(id) {
|
|
2906
|
+
return this.editingRowId() === id;
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* Verifica si hay alguna fila siendo editada actualmente
|
|
2910
|
+
*/
|
|
2911
|
+
get hasRowInEdit() {
|
|
2912
|
+
return this.editingRowId() !== null;
|
|
2913
|
+
}
|
|
2914
|
+
onRowEditInit(data) {
|
|
2915
|
+
// Verificar si ya hay una fila en edición
|
|
2916
|
+
this.clonedRowData = structuredClone(data.rowData);
|
|
2917
|
+
this.setEditingRowId(data.id);
|
|
2918
|
+
this.outputHandleEditInitButton.emit(data);
|
|
2919
|
+
}
|
|
2920
|
+
setEditingRowId(id) {
|
|
2921
|
+
this.editingRowId.set(id);
|
|
2922
|
+
this.outputIsEditing.emit(true);
|
|
2923
|
+
}
|
|
2924
|
+
onRowEditSave(_data) {
|
|
2925
|
+
this.clonedRowData = null;
|
|
2926
|
+
this.editingRowId.set(null);
|
|
2927
|
+
this.updateDataWithTableValue();
|
|
2928
|
+
this.setEnableErrors(false);
|
|
2929
|
+
this.outputIsEditing.emit(false);
|
|
2930
|
+
this.outputRowDataChange.emit(_data);
|
|
2931
|
+
}
|
|
2932
|
+
onRowEditCancel(data, index) {
|
|
2933
|
+
if (this.clonedRowData && this.editingRowId() === data.id) {
|
|
2934
|
+
const items = [...this.data()];
|
|
2935
|
+
items[index] = { ...items[index], rowData: this.clonedRowData };
|
|
2936
|
+
this.data.set(items);
|
|
2937
|
+
}
|
|
2938
|
+
this.clonedRowData = null;
|
|
2939
|
+
this.setEditingRowId(null);
|
|
2940
|
+
this.setEnableErrors(false);
|
|
2941
|
+
this.outputIsEditing.emit(false);
|
|
2942
|
+
}
|
|
2943
|
+
updateDataWithTableValue() {
|
|
2944
|
+
const tableValue = (this.dt.value ?? []);
|
|
2945
|
+
this.data.set([...tableValue]);
|
|
2946
|
+
}
|
|
2947
|
+
editInitButton = computed(() => {
|
|
2948
|
+
return {
|
|
2949
|
+
icon: 'fa-solid fa-pencil',
|
|
2950
|
+
rounded: true,
|
|
2951
|
+
variant: 'text',
|
|
2952
|
+
severity: 'secondary'
|
|
2953
|
+
};
|
|
2954
|
+
});
|
|
2955
|
+
getEditInitButton(productId) {
|
|
2956
|
+
return {
|
|
2957
|
+
...this.editInitButton(),
|
|
2958
|
+
disabled: this.hasRowInEdit && !this.isRowEditing(productId)
|
|
2959
|
+
};
|
|
2960
|
+
}
|
|
2961
|
+
editSaveButton = computed(() => {
|
|
2962
|
+
return {
|
|
2963
|
+
icon: 'fa-solid fa-check',
|
|
2964
|
+
rounded: true,
|
|
2965
|
+
variant: 'text',
|
|
2966
|
+
severity: 'secondary'
|
|
2967
|
+
};
|
|
2968
|
+
});
|
|
2969
|
+
editSaveButtonWithErrors = computed(() => {
|
|
2970
|
+
return {
|
|
2971
|
+
icon: 'fa-solid fa-check',
|
|
2972
|
+
rounded: true,
|
|
2973
|
+
variant: 'text',
|
|
2974
|
+
severity: 'secondary'
|
|
2975
|
+
};
|
|
2976
|
+
});
|
|
2977
|
+
enableErrors = false;
|
|
2978
|
+
setEnableErrors(value) {
|
|
2979
|
+
this.enableErrors = value;
|
|
2980
|
+
}
|
|
2981
|
+
onEditSaveWithErrors() {
|
|
2982
|
+
this.setEnableErrors(true);
|
|
2983
|
+
}
|
|
2984
|
+
editCancelButton = computed(() => {
|
|
2985
|
+
return {
|
|
2986
|
+
icon: 'fa-solid fa-times',
|
|
2987
|
+
rounded: true,
|
|
2988
|
+
variant: 'text',
|
|
2989
|
+
severity: 'secondary'
|
|
2990
|
+
};
|
|
2991
|
+
});
|
|
2992
|
+
deleteRowButton = computed(() => {
|
|
2993
|
+
return {
|
|
2994
|
+
icon: 'fa-solid fa-trash',
|
|
2995
|
+
rounded: true,
|
|
2996
|
+
variant: 'text',
|
|
2997
|
+
severity: 'danger'
|
|
2998
|
+
};
|
|
2999
|
+
});
|
|
3000
|
+
getDeleteRowButton() {
|
|
3001
|
+
return {
|
|
3002
|
+
...this.deleteRowButton(),
|
|
3003
|
+
disabled: this.hasRowInEdit
|
|
3004
|
+
};
|
|
3005
|
+
}
|
|
3006
|
+
removeRowFromData(data) {
|
|
3007
|
+
const { id } = data;
|
|
3008
|
+
const items = [...this.data()];
|
|
3009
|
+
items.splice(items.findIndex(item => item.id === id), 1);
|
|
3010
|
+
this.data.set(items);
|
|
3011
|
+
this.outputDeleteRow.emit(data);
|
|
3012
|
+
}
|
|
3013
|
+
deleteRow(data) {
|
|
3014
|
+
this.removeRowFromData(data);
|
|
3015
|
+
this.outputEditData.emit(this.data());
|
|
3016
|
+
}
|
|
3017
|
+
//#endregion Row
|
|
3018
|
+
get footerRows() {
|
|
3019
|
+
return this.footerConfig()?.footerRows || [];
|
|
3020
|
+
}
|
|
3021
|
+
applyPipe(value, pipeConfig) {
|
|
3022
|
+
if (!pipeConfig || !pipeConfig.pipe) {
|
|
3023
|
+
return value?.toString() || '';
|
|
3024
|
+
}
|
|
3025
|
+
switch (pipeConfig.pipe) {
|
|
3026
|
+
case 'currency': {
|
|
3027
|
+
const currencyCode = pipeConfig.args?.[0] || 'COP';
|
|
3028
|
+
return new Intl.NumberFormat('es-CO', {
|
|
3029
|
+
style: 'currency',
|
|
3030
|
+
currency: currencyCode
|
|
3031
|
+
}).format(value);
|
|
3032
|
+
}
|
|
3033
|
+
case 'number': {
|
|
3034
|
+
const digits = pipeConfig.args?.[0] || '1.2-2';
|
|
3035
|
+
const [minInteger, fractional] = digits.split('.');
|
|
3036
|
+
const [minFractional, maxFractional] = fractional ? fractional.split('-') : ['0', '0'];
|
|
3037
|
+
return new Intl.NumberFormat('es-CO', {
|
|
3038
|
+
minimumIntegerDigits: parseInt(minInteger),
|
|
3039
|
+
minimumFractionDigits: parseInt(minFractional),
|
|
3040
|
+
maximumFractionDigits: parseInt(maxFractional || minFractional)
|
|
3041
|
+
}).format(value);
|
|
3042
|
+
}
|
|
3043
|
+
case 'date': {
|
|
3044
|
+
if (value instanceof Date) {
|
|
3045
|
+
return value.toLocaleDateString('es-CO');
|
|
3046
|
+
}
|
|
3047
|
+
return value?.toString() || '';
|
|
3048
|
+
}
|
|
3049
|
+
default:
|
|
3050
|
+
return value?.toString() || '';
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
// #endregion
|
|
3054
|
+
//#region Row Expansion
|
|
3055
|
+
rowExpansionButton(isRowExpanded) {
|
|
3056
|
+
return computed(() => {
|
|
3057
|
+
return {
|
|
3058
|
+
icon: isRowExpanded ? 'fa-solid fa-chevron-down' : 'fa-solid fa-chevron-right',
|
|
3059
|
+
rounded: true,
|
|
3060
|
+
variant: 'text',
|
|
3061
|
+
severity: 'contrast'
|
|
3062
|
+
};
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
//#endregion
|
|
3066
|
+
itemTemplateInput = input(null);
|
|
3067
|
+
itemTemplate;
|
|
3068
|
+
get currentItemTemplate() {
|
|
3069
|
+
return this.itemTemplateInput() || this.itemTemplate || null;
|
|
3070
|
+
}
|
|
3071
|
+
isThatItemInTheProductSelection(field) {
|
|
3072
|
+
const selectedColumns = this.config()?.selectedColumns ?? [];
|
|
3073
|
+
if (!selectedColumns.length) {
|
|
3074
|
+
return true;
|
|
3075
|
+
}
|
|
3076
|
+
return selectedColumns.some((column) => column.field === field);
|
|
3077
|
+
}
|
|
3078
|
+
//#region Advanced Identifier Filters
|
|
3079
|
+
advancedIdentifierFiltersButton = computed(() => {
|
|
3080
|
+
return {
|
|
3081
|
+
icon: 'pi pi-filter',
|
|
3082
|
+
rounded: true,
|
|
3083
|
+
severity: 'warn',
|
|
3084
|
+
raised: true,
|
|
3085
|
+
tooltipConfig: {
|
|
3086
|
+
pTooltip: this.data().length === 0 ? 'No hay datos para filtrar' : 'Filtros avanzados',
|
|
3087
|
+
tooltipPosition: 'top'
|
|
3088
|
+
},
|
|
3089
|
+
onClick: () => {
|
|
3090
|
+
this.openAdvancedIdentifierFilters();
|
|
3091
|
+
},
|
|
3092
|
+
disabled: this.data().length === 0
|
|
3093
|
+
};
|
|
3094
|
+
});
|
|
3095
|
+
openAdvancedIdentifierFilters() {
|
|
3096
|
+
if (this.sourceElements().length === 0) {
|
|
3097
|
+
this.handleTableValueToSourceElements();
|
|
3098
|
+
}
|
|
3099
|
+
this.handleSelectedItemsToSourceElements();
|
|
3100
|
+
if (this.data().length === 0) {
|
|
3101
|
+
return;
|
|
3102
|
+
}
|
|
3103
|
+
const ref = this.dialogService.open(ModalAdvancedFilterComponent, {
|
|
3104
|
+
header: 'Filtros Avanzados',
|
|
3105
|
+
width: '70%',
|
|
3106
|
+
height: '70%',
|
|
3107
|
+
styleClass: 'overflow-hidden',
|
|
3108
|
+
data: {
|
|
3109
|
+
sourceElements: this.sourceElements(),
|
|
3110
|
+
targetElements: this.targetElements()
|
|
3111
|
+
}
|
|
3112
|
+
});
|
|
3113
|
+
ref.onClose.subscribe((result) => {
|
|
3114
|
+
const { sourceElements, targetElements } = result?.data ?? {};
|
|
3115
|
+
if (!result?.success) {
|
|
3116
|
+
return;
|
|
3117
|
+
}
|
|
3118
|
+
if (result?.data?.targetElements?.length === 0) {
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
3121
|
+
if (sourceElements.length === 0) {
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
this.sourceElements.set(sourceElements ?? []);
|
|
3125
|
+
this.targetElements.set(targetElements ?? []);
|
|
3126
|
+
this.identifiersSelected.set((this.targetElements() ?? []).filter((element) => element.buttonConfig?.label).map((element) => element.buttonConfig?.label) ?? []);
|
|
3127
|
+
this.dt.filter(this.identifiersSelected(), 'rowData.identifier', 'arrayStringFilter');
|
|
3128
|
+
});
|
|
3129
|
+
}
|
|
3130
|
+
handleTableValueToSourceElements() {
|
|
3131
|
+
const value = this.data();
|
|
3132
|
+
if (!value.some((item) => item.rowData['identifier'])) {
|
|
3133
|
+
return;
|
|
3134
|
+
}
|
|
3135
|
+
const sourceElements = value.map((item) => ({
|
|
3136
|
+
id: item.id,
|
|
3137
|
+
buttonConfig: {
|
|
3138
|
+
label: item.rowData['identifier'],
|
|
3139
|
+
fullWidth: true,
|
|
3140
|
+
fullHeight: true
|
|
3141
|
+
},
|
|
3142
|
+
isSelected: false
|
|
3143
|
+
}));
|
|
3144
|
+
this.sourceElements.set(sourceElements);
|
|
3145
|
+
}
|
|
3146
|
+
handleSelectedItemsToSourceElements() {
|
|
3147
|
+
const selectedItems = this.selectedItems();
|
|
3148
|
+
if (!selectedItems.some((item) => item.rowData['identifier'])) {
|
|
3149
|
+
return;
|
|
3150
|
+
}
|
|
3151
|
+
const identifiers = selectedItems.map((item) => item.rowData['identifier']);
|
|
3152
|
+
const sourceElements = this.sourceElements().map((item) => ({
|
|
3153
|
+
...item,
|
|
3154
|
+
isSelected: identifiers.includes(item.buttonConfig?.label)
|
|
3155
|
+
}));
|
|
3156
|
+
this.sourceElements.set(sourceElements);
|
|
3157
|
+
}
|
|
3158
|
+
identifiersSelected = signal([]);
|
|
3159
|
+
//#endregion
|
|
3160
|
+
get excelButton() {
|
|
3161
|
+
return this.tableNgService.excelButton();
|
|
3162
|
+
}
|
|
3163
|
+
get pdfButton() {
|
|
3164
|
+
return this.tableNgService.pdfButton();
|
|
3165
|
+
}
|
|
3166
|
+
lazyLoadingConfig = computed(() => {
|
|
3167
|
+
return this.config()?.lazyLoadingConfig ?? undefined;
|
|
3168
|
+
});
|
|
3169
|
+
isEnabledLazyLoading = computed(() => {
|
|
3170
|
+
return this.lazyLoadingConfig()?.isEnabled ?? false;
|
|
3171
|
+
});
|
|
3172
|
+
prepareDataForExport(dataToExport) {
|
|
3173
|
+
const keys = this.config()?.keys ?? [];
|
|
3174
|
+
const keysNames = this.config()?.keysNames ?? {};
|
|
3175
|
+
return dataToExport.map((item) => {
|
|
3176
|
+
const row = {};
|
|
3177
|
+
const rowData = item.rowData;
|
|
3178
|
+
keys.forEach((key) => {
|
|
3179
|
+
const keyName = keysNames[key] ?? key;
|
|
3180
|
+
if (rowData[key]) {
|
|
3181
|
+
let value = rowData[key];
|
|
3182
|
+
switch (typeof value) {
|
|
3183
|
+
case 'number':
|
|
3184
|
+
value = formatNumber(value);
|
|
3185
|
+
break;
|
|
3186
|
+
default:
|
|
3187
|
+
break;
|
|
3188
|
+
}
|
|
3189
|
+
row[keyName] = value;
|
|
3190
|
+
}
|
|
3191
|
+
});
|
|
3192
|
+
return row;
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
exportCSV(data) {
|
|
3196
|
+
// Create a new workbook
|
|
3197
|
+
const workbook = XLSX.utils.book_new();
|
|
3198
|
+
const worksheet = XLSX.utils.json_to_sheet(data);
|
|
3199
|
+
// Get title from config or use default
|
|
3200
|
+
const name = this.config()?.excelConfig?.name ?? 'Report';
|
|
3201
|
+
const fileName = name || 'table-export';
|
|
3202
|
+
// Excel sheet names cannot exceed 31 characters
|
|
3203
|
+
const sheetName = name.substring(0, 31);
|
|
3204
|
+
// Add the worksheet to the workbook
|
|
3205
|
+
XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
|
|
3206
|
+
// Generate Excel file and trigger download
|
|
3207
|
+
XLSX.writeFile(workbook, `${fileName}.xlsx`);
|
|
3208
|
+
}
|
|
3209
|
+
exportData(dt, endpoint) {
|
|
3210
|
+
if (this.isEnabledLazyLoading()) {
|
|
3211
|
+
const filters = dt.filters ?? {};
|
|
3212
|
+
const filterQuery = {};
|
|
3213
|
+
Object.entries(filters).forEach(([key, value]) => {
|
|
3214
|
+
const keyName = key.split('.')[1];
|
|
3215
|
+
const valueFilter = value[0]?.value;
|
|
3216
|
+
filterQuery[keyName] = valueFilter;
|
|
3217
|
+
});
|
|
3218
|
+
this.lazyLoadingConfig()?.excelLazyLoadingConfig?.callback(removeNullUndefined(filterQuery))
|
|
3219
|
+
.subscribe((response) => {
|
|
3220
|
+
const data = this.prepareDataForExport(response);
|
|
3221
|
+
if (endpoint === 'excel') {
|
|
3222
|
+
this.exportCSV(data);
|
|
3223
|
+
}
|
|
3224
|
+
else {
|
|
3225
|
+
this.exportPDF(data);
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
}
|
|
3229
|
+
else {
|
|
3230
|
+
const value = dt.value ?? this.data();
|
|
3231
|
+
const filteredValue = dt.filteredValue ?? [];
|
|
3232
|
+
let dataToExport = [];
|
|
3233
|
+
if (filteredValue.length > 0) {
|
|
3234
|
+
dataToExport = filteredValue;
|
|
3235
|
+
}
|
|
3236
|
+
else {
|
|
3237
|
+
dataToExport = value;
|
|
3238
|
+
}
|
|
3239
|
+
const data = this.prepareDataForExport(dataToExport);
|
|
3240
|
+
if (endpoint === 'excel') {
|
|
3241
|
+
this.exportCSV(data);
|
|
3242
|
+
}
|
|
3243
|
+
else {
|
|
3244
|
+
this.exportPDF(data);
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
exportPDF(data) {
|
|
3249
|
+
// Get title from config or use default
|
|
3250
|
+
const name = this.config()?.pdfConfig?.name ?? this.config()?.excelConfig?.name ?? 'Report';
|
|
3251
|
+
const fileName = name || 'table-export';
|
|
3252
|
+
// Get keys and column names
|
|
3253
|
+
const keys = this.config()?.keys ?? [];
|
|
3254
|
+
const keysNames = this.config()?.keysNames ?? {};
|
|
3255
|
+
// Prepare headers
|
|
3256
|
+
const headers = keys.map((key) => keysNames[key] ?? key);
|
|
3257
|
+
// Prepare rows data
|
|
3258
|
+
const rows = data.map((row) => {
|
|
3259
|
+
return keys.map((key) => {
|
|
3260
|
+
const keyName = keysNames[key] ?? key;
|
|
3261
|
+
return row[keyName] ?? '';
|
|
3262
|
+
});
|
|
3263
|
+
});
|
|
3264
|
+
// Create PDF document
|
|
3265
|
+
const doc = new jsPDF({
|
|
3266
|
+
orientation: 'landscape',
|
|
3267
|
+
unit: 'mm',
|
|
3268
|
+
format: 'a4'
|
|
3269
|
+
});
|
|
3270
|
+
// Add title
|
|
3271
|
+
doc.setFontSize(16);
|
|
3272
|
+
doc.text(name, 14, 15);
|
|
3273
|
+
// Add table
|
|
3274
|
+
autoTable(doc, {
|
|
3275
|
+
head: [headers],
|
|
3276
|
+
body: rows,
|
|
3277
|
+
startY: 20,
|
|
3278
|
+
styles: {
|
|
3279
|
+
fontSize: 8,
|
|
3280
|
+
cellPadding: 2
|
|
3281
|
+
},
|
|
3282
|
+
headStyles: {
|
|
3283
|
+
fillColor: [66, 139, 202],
|
|
3284
|
+
textColor: 255,
|
|
3285
|
+
fontStyle: 'bold'
|
|
3286
|
+
},
|
|
3287
|
+
alternateRowStyles: {
|
|
3288
|
+
fillColor: [245, 245, 245]
|
|
3289
|
+
},
|
|
3290
|
+
margin: { top: 20 }
|
|
3291
|
+
});
|
|
3292
|
+
// Save PDF
|
|
3293
|
+
doc.save(`${fileName}.pdf`);
|
|
3294
|
+
}
|
|
3295
|
+
enableExcelButton = computed(() => {
|
|
3296
|
+
return this.config()?.excelConfig?.isEnabled ?? false;
|
|
3297
|
+
});
|
|
3298
|
+
enablePdfButton = computed(() => {
|
|
3299
|
+
return this.config()?.pdfConfig?.isEnabled ?? false;
|
|
3300
|
+
});
|
|
3301
|
+
get enableRefreshButton() {
|
|
3302
|
+
return this.tableNgService.enableRefreshButton();
|
|
3303
|
+
}
|
|
3304
|
+
get refreshButton() {
|
|
3305
|
+
return this.tableNgService.refreshButton();
|
|
3306
|
+
}
|
|
3307
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3308
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: TableNgComponent, isStandalone: true, selector: "lib-table-ng", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, editConfig: { classPropertyName: "editConfig", publicName: "editConfig", isSignal: true, isRequired: false, transformFunction: null }, footerConfig: { classPropertyName: "footerConfig", publicName: "footerConfig", isSignal: true, isRequired: false, transformFunction: null }, toolbarButtons: { classPropertyName: "toolbarButtons", publicName: "toolbarButtons", isSignal: true, isRequired: false, transformFunction: null }, toolbarSpeedDialButtons: { classPropertyName: "toolbarSpeedDialButtons", publicName: "toolbarSpeedDialButtons", isSignal: true, isRequired: false, transformFunction: null }, sourceElements: { classPropertyName: "sourceElements", publicName: "sourceElements", isSignal: true, isRequired: false, transformFunction: null }, targetElements: { classPropertyName: "targetElements", publicName: "targetElements", isSignal: true, isRequired: false, transformFunction: null }, httpMessage: { classPropertyName: "httpMessage", publicName: "httpMessage", isSignal: true, isRequired: false, transformFunction: null }, selectedItems: { classPropertyName: "selectedItems", publicName: "selectedItems", isSignal: true, isRequired: false, transformFunction: null }, itemTemplateInput: { classPropertyName: "itemTemplateInput", publicName: "itemTemplateInput", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { data: "dataChange", config: "configChange", editConfig: "editConfigChange", footerConfig: "footerConfigChange", toolbarButtons: "toolbarButtonsChange", toolbarSpeedDialButtons: "toolbarSpeedDialButtonsChange", sourceElements: "sourceElementsChange", targetElements: "targetElementsChange", httpMessage: "httpMessageChange", lazyLoading: "lazyLoading", outputChangeData: "outputChangeData", outputHandleEditInitButton: "outputHandleEditInitButton", outputAddRow: "outputAddRow", outputDeleteRow: "outputDeleteRow", outputRowInlineChange: "outputRowInlineChange", outputRowDataChange: "outputRowDataChange", outputEditData: "outputEditData", outputIsEditing: "outputIsEditing", selectedItems: "selectedItemsChange" }, providers: [TableNgService, TableNgEditService], queries: [{ propertyName: "itemTemplate", first: true, predicate: ["item"], descendants: true, static: true }], viewQueries: [{ propertyName: "dt", first: true, predicate: ["dt"], descendants: true }], ngImport: i0, template: "@let paginationConfig = config()?.paginationConfig;\n@let globalFilterConfig = config()?.globalFilterConfig;\n@let selectionTableConfig = config()?.selectionTableConfig;\n@let filterConfigByKey = config()?.filterConfigByKey;\n@let frozenColumnConfigByKey = config()?.frozenColumnConfigByKey;\n@let scrollConfig = config()?.scrollConfig;\n@let lazyLoadingConfig = config()?.lazyLoadingConfig;\n@let keysNames = config()?.keysNames;\n@let columnConfig = config()?.columnConfig;\n@let editEnabled = editConfig()?.isEnabled ?? false;\n@let editType = editConfig()?.type ?? 'cell';\n@let inlineControls = editConfig()?.inlineControls;\n@let rowErrorConfig = editConfig()?.rowEditConfig?.rowErrorConfig;\n@let footerRows = footerConfig()?.footerRows;\n@let footerEnabled = footerConfig()?.isEnabled ?? false;\n@let titleConfig = config()?.titleConfig;\n@let selectedColumns = config()?.selectedColumns;\n@let rowExpansionConfig = config()?.rowExpansionConfig;\n@let advancedIdentifierFiltersConfig = config()?.globalFilterConfig?.advancedIdentifierFiltersConfig;\n\n<div class=\"p-datatable-wrapper\">\n @if (titleConfig?.isEnabled && titleConfig?.title) {\n <div class=\"table-title-container\">\n <h2 class=\"table-title\">{{ titleConfig!.title }}</h2>\n </div>\n }\n @if (!hideToolbar || (filteredValue || advancedFiltersPerformed.length > 0)) {\n <lib-toolbar-ng class=\"p-toolbar-header sticky top-0 z-30 dark:bg-gray-800\">\n <div class=\"flex gap-2\" toolbarStart>\n @if (globalFilterConfig?.isEnabled && !lazyLoadingConfig?.isEnabled) {\n <lib-form [controls]=\"controlsGlobalFilter\" [(formGroup)]=\"searchFormGroupGlobalFilter\"\n (formSubmit)=\"submitGlobalSearch($event)\"></lib-form>\n }\n @if (advancedIdentifierFiltersConfig?.isEnabled) {\n <lib-button-ng class=\"animate__animated animate__fadeIn\"\n [buttonConfig]=\"advancedIdentifierFiltersButton()\"></lib-button-ng>\n }\n @if (filteredValue || advancedFiltersPerformed.length > 0) {\n <lib-button-ng class=\"animate__animated animate__fadeIn\" [buttonConfig]=\"clearFiltersButton()\"></lib-button-ng>\n }\n </div>\n <div class=\"flex gap-2\" toolbarEnd>\n @if (toolbarSpeedDialButtons().length > 0) {\n @for (speedDial of toolbarSpeedDialButtons(); track $index) {\n <lib-speed-dial-ng [configInput]=\"speedDial\"></lib-speed-dial-ng>\n }\n }\n @if (toolbarButtons().length > 0) {\n @for (button of toolbarButtons(); track $index) {\n <lib-button-ng [buttonConfig]=\"button\"></lib-button-ng>\n }\n }\n @if ((editType === 'row' || editType === 'cell') && editEnabled) {\n <lib-button-ng [buttonConfig]=\"addRowButton()\"></lib-button-ng>\n }\n @if (enableExcelButton()) {\n <lib-button-ng [buttonConfig]=\"excelButton\" (onClick)=\"exportData(dt,'excel')\"></lib-button-ng>\n }\n @if (enablePdfButton()) {\n <lib-button-ng [buttonConfig]=\"pdfButton\" (onClick)=\"exportData(dt,'pdf')\"></lib-button-ng>\n }\n @if (enableRefreshButton) {\n <lib-button-ng [buttonConfig]=\"refreshButton\"></lib-button-ng>\n }\n </div>\n </lib-toolbar-ng>\n }\n <p-table #dt styleClass=\"p-datatable-sm\" [value]=\"data()\" [lazy]=\"lazyLoadingConfig?.isEnabled ?? false\"\n [editMode]=\"editType\" [totalRecords]=\"\n lazyLoadingConfig?.isEnabled\n ? (lazyLoadingConfig?.totalRecords ?? 0)\n : data().length\n \" [customSort]=\"true\" [paginator]=\"paginationConfig?.paginator ?? true\" [showCurrentPageReport]=\"true\"\n [rows]=\"paginationConfig?.rows ?? 5\" [rowsPerPageOptions]=\"paginationConfig?.rowsPerPageOptions ?? [5, 10, 20]\"\n [paginatorStyleClass]=\"paginatorStyleClass()\" [resizableColumns]=\"true\" [rowTrackBy]=\"trackById\"\n [columns]=\"selectedColumns\" [scrollable]=\"scrollConfig?.isEnabled ?? false\"\n [scrollHeight]=\"scrollConfig?.isEnabled ? scrollHeight() : undefined\" (onLazyLoad)=\"onLazyLoad($event)\"\n (sortFunction)=\"customSort($event)\" (onFilter)=\"onFilter($event)\" [(selection)]=\"selectedItems\"\n [currentPageReportTemplate]=\"getCustomPageReport()\" selectionPageOnly=\"true\" dataKey=\"id\" class=\"w-full\">\n <ng-template #header let-columns>\n <tr>\n @if (rowExpansionConfig?.isEnabled) {\n <th alignFrozen=\"left\" pFrozenColumn style=\"width: 2rem\" class=\"p-datatable-header-cell p-frozen-column\">\n\n </th>\n }\n @if (selectionTableConfig?.isEnabled) {\n <th alignFrozen=\"left\" pFrozenColumn style=\"width: 2rem\" class=\"p-datatable-header-cell p-frozen-column\">\n <p-tableHeaderCheckbox />\n </th>\n }\n\n @if (selectedColumns) {\n @for (column of columns; track $index) {\n <th pResizableColumn [id]=\"column.field\" alignFrozen=\"right\" pFrozenColumn\n [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[column.field])\" [pSortableColumn]=\"column.field\"\n class=\"p-datatable-header-cell\" [style.width.%]=\"columnConfig?.sizeByKey?.[column.field] ?? null\" [ngClass]=\"{\n 'p-frozen-column': frozenHandle(\n frozenColumnConfigByKey?.[column.field]\n ),\n }\">\n <div class=\"flex gap-2 justify-center items-center py-0 px-0\">\n {{ column.field | keyToDisplayName: keysNames }}\n @if(!editEnabled){\n <p-sortIcon [field]=\"column.field\" />\n }\n @if (filterConfigByKey?.[column.field]?.isEnabled) {\n <p-columnFilter type=\"text\" [field]=\"`rowData.${column.field}`\" display=\"menu\" [ngClass]=\"{\n 'bg-green-200 rounded-full p-1 shadow-sm text-green-500 transition-all duration-300 ease-in-out':\n advancedFiltersPerformed.includes(column.field),\n }\" [type]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig?.type ??\n 'text'\n \" [matchMode]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.matchMode\n \" [showMatchModes]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showMatchModes ?? false\n \" [showOperator]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showOperator ?? false\n \" [showAddButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showAddButton ?? false\n \" [showApplyButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showApplyButton ?? false\n \" [showClearButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showClearButton ?? false\n \">\n @if (\n filterConfigByKey?.[column.field]?.customColumnFilterConfig\n ?.isEnabled ?? false\n ) {\n <ng-template #filter let-value let-filter=\"filterCallback\">\n <div style=\"min-width: 20rem\" class=\"\">\n <lib-inline-input\n (outputValue)=\"inlineFormChanges($event, filter, filterConfigByKey?.[column.field]?.customColumnFilterConfig?.inlineControlConfig?.typeInput, column.field)\"\n (outputDebounced)=\"onFilter($event)\" [(ngModel)]=\"advancedFiltersValues()[column.field]\"\n [config]=\"filterConfigByKey?.[column.field]?.customColumnFilterConfig?.inlineControlConfig ?? {typeInput: ETypeInput.TEXT}\"></lib-inline-input>\n </div>\n </ng-template>\n }\n </p-columnFilter>\n }\n </div>\n </th>\n }\n }@else {\n @for (key of keys(); track $index) {\n <th [id]=\"key\" pResizableColumn alignFrozen=\"right\" pFrozenColumn\n [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[key])\" [pSortableColumn]=\"key\"\n class=\"p-datatable-header-cell\" [style.width.%]=\"columnConfig?.sizeByKey?.[key] ?? null\" [ngClass]=\"{\n 'p-frozen-column': frozenHandle(frozenColumnConfigByKey?.[key]),\n }\">\n <div class=\"flex gap-2 justify-center items-center py-0 px-0\">\n {{ key | keyToDisplayName: keysNames }}\n @if(!editEnabled){\n <p-sortIcon [field]=\"key\" />\n }\n @if (filterConfigByKey?.[key]?.isEnabled) {\n <p-columnFilter type=\"text\" [field]=\"`rowData.${key}`\" display=\"menu\" [ngClass]=\"{\n 'bg-green-200 rounded-full p-1 shadow-sm text-green-500 transition-all duration-300 ease-in-out':\n advancedFiltersPerformed.includes(key),\n }\" [type]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.type ?? 'text'\"\n [matchMode]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.matchMode\"\n [showMatchModes]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showMatchModes ?? false\"\n [showOperator]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showOperator ?? false\"\n [showAddButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showAddButton ?? false\"\n [showApplyButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showApplyButton ?? false\"\n [showClearButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showClearButton ?? false\">\n @if (\n filterConfigByKey?.[key]?.customColumnFilterConfig\n ?.isEnabled ?? false\n ) {\n <ng-template #filter let-value let-filter=\"filterCallback\">\n <div style=\"min-width: 20rem\" class=\"\">\n <!-- <app-custom-advanced-filter filter\n [customColumnFilterConfig]=\"filterConfigByKey![key]!.customColumnFilterConfig!\"\n (formChanges)=\"formChanges($event, filter, key)\"\n [initialValue]=\"advancedFiltersValues[key]\"></app-custom-advanced-filter> -->\n <lib-inline-input\n (outputValue)=\"inlineFormChanges($event, filter, filterConfigByKey?.[key]?.customColumnFilterConfig?.inlineControlConfig?.typeInput, key)\"\n [(ngModel)]=\"advancedFiltersValues()[key]\"\n [config]=\"filterConfigByKey?.[key]?.customColumnFilterConfig?.inlineControlConfig ?? {typeInput: ETypeInput.TEXT}\"></lib-inline-input>\n </div>\n </ng-template>\n }\n </p-columnFilter>\n }\n </div>\n </th>\n }\n }\n\n @if (editType === 'cell' && editEnabled) {\n <th class=\"p-datatable-header-cell\" style=\"width: 100px\">\n </th>\n }\n @if (editType === 'row' && editEnabled) {\n <th class=\"p-datatable-header-cell\" style=\"width: 100px\">\n </th>\n }\n\n </tr>\n </ng-template>\n\n <ng-template #emptymessage>\n <tr>\n <td [attr.colspan]=\"totalColumns()\">\n @if (isLoading()) {\n <!-- Loading state -->\n <div class=\"p-8 text-center\">\n <div class=\"flex flex-col items-center justify-center gap-4\">\n <i class=\"pi pi-spin pi-spinner text-4xl text-blue-500\"></i>\n <p class=\"text-gray-600 text-lg\">{{ getLoadingMessage() }}</p>\n </div>\n </div>\n } @else if (timeoutExpired()) {\n <!-- No data available -->\n <div class=\"p-8 text-center text-gray-500\">\n <div class=\"flex flex-col items-center justify-center gap-3\">\n <i class=\"pi pi-info-circle text-4xl text-gray-400\"></i>\n <p class=\"text-lg\">{{ getNoDataMessage() }}</p>\n </div>\n </div>\n }\n </td>\n </tr>\n </ng-template>\n\n @if (hasRecords()) {\n @if (editEnabled) {\n @switch (editType) {\n @case ('cell') {\n <ng-template #body let-item let-editing=\"editing\">\n <tr class=\"p-datatable-row p-selectable-row\">\n @if (selectedColumns) {\n @for (column of selectedColumns; track $index){\n <td [pEditableColumn]=\"column.field\" pEditableColumnField=\"rowData.{{column.field}}\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[column.field]\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[column.field] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n @if (inlineControls?.[column.field]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | number: '1.2-2' }}\n\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | currency: item?.currencyTypeCellConfig?.[column.field]?.currency ??\n 'USD' }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATE) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATETIME_LOCAL) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy HH:mm\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[column.field]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[column.field]?.name) {\n {{ item.rowData[column.field]?.name }}\n } @else {\n {{ item.rowData[column.field] }}\n }\n }\n\n </ng-template>\n </p-cellEditor>\n </td>\n }\n } @else {\n @for (key of keys(); track $index){\n <td [pEditableColumn]=\"key\" pEditableColumnField=\"rowData.{{key}}\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[key]\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[key] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n @if (inlineControls?.[key]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[key]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n {{ item.rowData[key] }}\n }\n </ng-template>\n </p-cellEditor>\n </td>\n }\n }\n @if (editType === 'cell' && editEnabled) {\n <td class=\"px-2 py-1 text-center\">\n <div class=\"flex justify-center items-center gap-2\">\n <lib-button-ng [buttonConfig]=\"getDeleteRowButton()\" (onClick)=\"deleteRow(item)\"></lib-button-ng>\n </div>\n </td>\n }\n </tr>\n </ng-template>\n }\n @case ('row') {\n <ng-template #body let-item let-editing=\"editing\" let-ri=\"rowIndex\">\n <tr [pEditableRow]=\"item\" class=\"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 border-b\">\n @if (selectedColumns) {\n @for (column of selectedColumns; track $index){\n <td>\n <div class=\"flex flex-col gap-2\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[column.field]\"\n (outputValue)=\"inlineChange($event, column.field)\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[column.field] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n\n </ng-template>\n <ng-template #output>\n\n @if (inlineControls?.[column.field]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | number: '1.2-2' }}\n\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | currency: item?.currencyTypeCellConfig?.[column.field]?.currency ??\n 'USD' }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATE) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATETIME_LOCAL) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy HH:mm\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[column.field]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[column.field]?.name) {\n {{ item.rowData[column.field]?.name }}\n } @else {\n {{ item.rowData[column.field] }}\n }\n }\n\n\n </ng-template>\n </p-cellEditor>\n\n @if (rowErrorConfig?.isEnabled && enableErrors && !rowFieldsHasValue()[column.field]) {\n <span class=\"text-red-500 italic text-xs\">{{\n rowErrorConfig?.fieldErrors?.[item.id]?.[column.field]?.message ??\n '' }}</span>\n }\n </div>\n </td>\n }\n } @else {\n @for (key of keys(); track $index){\n <td>\n <div class=\"flex flex-col gap-2\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[key]\" (outputValue)=\"inlineChange($event, key)\"\n (outputDebounced)=\"onEditData()\" [config]=\"inlineControls?.[key] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n\n @if (inlineControls?.[key]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[key] | number: '1.2-2' }}\n\n </div>\n }\n @else if(inlineControls?.[key]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[key] | currency: item?.currencyTypeCellConfig?.[key]?.currency ?? 'USD' }}\n </div>\n } @else if(inlineControls?.[key]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[key]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[key]?.name) {\n {{ item.rowData[key]?.name }}\n } @else {\n {{ item.rowData[key] }}\n }\n }\n\n\n </ng-template>\n </p-cellEditor>\n\n @if (rowErrorConfig?.isEnabled && enableErrors && !rowFieldsHasValue()[key]) {\n <span class=\"text-red-500 italic text-xs\">{{ rowErrorConfig?.fieldErrors?.[item.id]?.[key]?.message ??\n '' }}</span>\n }\n </div>\n </td>\n }\n }\n <td>\n <div class=\"flex justify-center items-center gap-2\">\n @if(!editing){\n <lib-button-ng pButton pRipple pInitEditableRow [buttonConfig]=\"getEditInitButton(item.id)\"\n (onClick)=\"onRowEditInit(item)\"></lib-button-ng>\n @if(!editConfig()?.rowEditConfig?.isDisabledDeleteButton){\n <lib-button-ng [buttonConfig]=\"getDeleteRowButton()\" (onClick)=\"deleteRow(item)\"></lib-button-ng>\n }\n }\n @if(editing){\n @if (hasErrorValues(rowErrorConfig?.fieldErrors?.[item.id] ?? {})) {\n <lib-button-ng [buttonConfig]=\"editSaveButtonWithErrors()\"\n (onClick)=\"onEditSaveWithErrors()\"></lib-button-ng>\n }\n @else {\n <lib-button-ng pButton pRipple pSaveEditableRow [buttonConfig]=\"editSaveButton()\"\n (onClick)=\"onRowEditSave(item)\"></lib-button-ng>\n }\n <lib-button-ng pButton pRipple pCancelEditableRow [buttonConfig]=\"editCancelButton()\"\n (onClick)=\"onRowEditCancel(item, ri)\"></lib-button-ng>\n }\n </div>\n </td>\n </tr>\n </ng-template>\n }\n }\n } @else {\n\n <ng-template #body let-item let-expanded=\"expanded\">\n <tr class=\"p-datatable-row p-selectable-row\" [ngClass]=\"{\n 'bg-gray-50 dark:bg-gray-800 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700': item.onClick && !item.isSelected && !item.isLoading,\n 'bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600': !item.onClick && !item.isSelected && !item.isLoading,\n 'bg-blue-100 dark:bg-blue-900 border-l-4 border-blue-500 hover:bg-blue-200 dark:hover:bg-blue-800': item.isSelected && !item.isLoading,\n 'skeleton-row': item.isLoading\n }\" (click)=\"item?.isLoading ? null : onRowClick(item)\">\n\n @if (rowExpansionConfig?.isEnabled) {\n <td (click)=\"$event.stopPropagation()\" [class.skeleton-cell]=\"item.isLoading\"\n [style.height]=\"item.isLoading ? '3rem' : 'auto'\">\n @if (!item.isLoading) {\n <lib-button-ng [buttonConfig]=\"rowExpansionButton(expanded)()\" type=\"button\" pRipple\n [pRowToggler]=\"item\"></lib-button-ng>\n } @else {\n <div class=\"skeleton-content\"></div>\n }\n </td>\n }\n\n @if (selectionTableConfig?.isEnabled) {\n <td (click)=\"$event.stopPropagation()\" alignFrozen=\"left\" pFrozenColumn class=\"shadow-lg\"\n [class.skeleton-cell]=\"item.isLoading\" [style.height]=\"item.isLoading ? '3rem' : 'auto'\">\n @if (!item.isLoading) {\n <p-tableCheckbox [id]=\"item\" [value]=\"item\" />\n } @else {\n <div class=\"skeleton-content\"></div>\n }\n </td>\n }\n\n @for (key of keys(); track $index) {\n @if (isThatItemInTheProductSelection(key)) {\n <td [id]=\"key\" class=\"p-datatable-cell\" [style.height]=\"item.isLoading ? '3rem' : 'min-content'\"\n alignFrozen=\"right\" pFrozenColumn [ngClass]=\"{\n 'p-frozen-column': frozenHandle(frozenColumnConfigByKey?.[key]),\n 'text-center': item.rowDataButtons?.[key] || item.typeCell?.[key] === ETypeInput.BADGE,\n 'skeleton-cell': item.isLoading\n }\" [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[key])\">\n @if (item.isLoading) {\n <div class=\"skeleton-content\"></div>\n } @else {\n @if (item.rowDataButtons?.[key]) {\n <div class=\"flex gap-4 w-full justify-center items-center\">\n @for (btn of item.rowDataButtons[key]; track $index) {\n @if (btn) {\n <lib-button-ng class=\"w-full\" (click)=\"$event.stopPropagation()\" [buttonConfig]=\"btn\"></lib-button-ng>\n }\n }\n </div>\n } @else {\n @switch (item.typeCell?.[key]) {\n @case (ETypeInput.IMAGE) {\n <img [src]=\"item.rowData[key]\" alt=\"Image\" class=\"w-10 h-10 mx-auto\">\n }\n @case (ETypeInput.DATE) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy\" }}\n }\n @case (ETypeInput.DATETIME_LOCAL) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy HH:mm\" }}\n }\n @case (ETypeInput.CURRENCY) {\n {{item?.currencyTypeCellConfig?.[key]?.currency}} {{ item.rowData[key] | currency:\n item?.currencyTypeCellConfig?.[key]?.currency ?? 'USD' }}\n }\n @case (ETypeInput.BADGE) {\n <lib-badge-ng [config]=\"item.rowData[key]\"></lib-badge-ng>\n }\n @case (ETypeInput.COMPONENT) {\n <ng-container\n *ngTemplateOutlet=\"item.rowDataComponents?.[key]; context: { $implicit: item.raw }\"></ng-container>\n }\n @default {\n @if (isDate(item.rowData[key])) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy\" }}\n } @else if (typeof item.rowData[key] === \"string\") {\n {{ item.rowData[key] }}\n } @else if (isPrimeNgSelection(item.rowData[key])) {\n {{ item.rowData[key].name }}\n } @else if(typeof item.rowData[key] === \"number\") {\n <p class=\"text-right\">\n {{ item.rowData[key] | number: '1.2-2' }}\n </p>\n }\n }\n }\n }\n }\n </td>\n }\n }\n </tr>\n </ng-template>\n }\n }\n\n <ng-template #footer>\n @if (footerEnabled) {\n @for (row of footerRows; track $index) {\n <tr class=\"p-datatable-row p-datatable-footer-row\">\n @for (cell of row; track $index) {\n <td colSpan=\"{{ cell.colSpan }}\" class=\"{{ cell.class }} text-right font-bold p-3 pb-0\">{{\n applyPipe(cell.value,\n cell.pipeConfig) }}</td>\n\n }\n </tr>\n }\n\n }\n </ng-template>\n <ng-template #expandedrow let-item>\n <tr>\n <td colspan=\"100%\">\n <div class=\"p-datatable-row-expansion\">\n <ng-container *ngTemplateOutlet=\"currentItemTemplate; context: { $implicit: item }\"></ng-container>\n\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (showBottomToolbar()) {\n <div class=\"p-datatable-footer sticky bottom-2 z-9 animate__animated animate__fadeIn\">\n <lib-toolbar-ng>\n @if (showManagementSelectionConfig()) {\n <div toolbarStart\n class=\"p-datatable-footer-content flex items-center gap-3 px-4 rounded-lg animate__animated animate__fadeIn\">\n <span class=\"font-medium text-gray-700\">{{ getSelectedItemsLabel() }}</span>\n <div class=\"p-datatable-footer-badge flex items-center justify-center min-w-[28px] h-7 px-2 rounded-md\">\n <span class=\"font-semibold text-gray-900\">{{\n totalItemsSelected().toLocaleString()\n }}</span>\n </div>\n <span class=\"text-sm text-gray-600\">{{ getRecordsLabel() }}</span>\n <lib-button-ng [buttonConfig]=\"showSelectedItemsManagementButton()\"></lib-button-ng>\n </div>\n }\n </lib-toolbar-ng>\n </div>\n }\n</div>\n@if (httpMessage()) {\n<lib-http-message [(httpMessage)]=\"httpMessage\"></lib-http-message>\n}", styles: [".cursor-pointer{cursor:pointer}.empty-data-message{text-align:center;padding:2rem;color:#6c757d;font-style:italic}.table-title-container{background:var(--p-surface-50);border-bottom:1px solid var(--p-surface-200);padding:1.25rem 2rem;position:relative}.table-title{color:var(--p-text-color);font-size:1.5rem;font-weight:600;text-align:center;margin:0;letter-spacing:-.025em;text-shadow:0 1px 2px rgba(0,0,0,.05);background:linear-gradient(135deg,var(--p-text-color) 0%,var(--p-text-muted-color) 100%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;position:relative}.table-title:after{content:\"\";position:absolute;bottom:-.5rem;left:50%;transform:translate(-50%);width:60px;height:2px;background:linear-gradient(90deg,var(--p-primary-color),var(--p-primary-600));border-radius:1px}:host ::ng-deep .p-datatable-paginator{background:var(--p-surface-100);border-top:1px solid var(--p-surface-300);padding:1rem}:host ::ng-deep .p-datatable-paginator .p-paginator{background:transparent;border:none;padding:0}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page:hover{background:var(--p-surface-300);border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page.p-highlight{background:var(--p-primary-color);border-color:var(--p-primary-color);color:var(--p-primary-contrast-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:hover{background:var(--p-surface-300);border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:disabled{background:var(--p-surface-100);border-color:var(--p-surface-300);color:var(--p-text-muted-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-current{color:var(--p-text-color);font-weight:500}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:hover{border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:focus{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-100)}.skeleton-row{pointer-events:none;-webkit-user-select:none;user-select:none;min-height:3rem}.skeleton-cell{position:relative;overflow:hidden;min-height:3rem;padding:.75rem .5rem!important}.skeleton-cell .skeleton-content{position:absolute;inset:.5rem;min-height:1.5rem;background:linear-gradient(90deg,#d1d5db33,#d1d5db66,#d1d5db33);background-size:200% 100%;animation:skeleton-loading 1.5s ease-in-out infinite;border-radius:4px}@keyframes skeleton-loading{0%{background-position:200% 0}to{background-position:-200% 0}}:host-context(.my-app-dark) .skeleton-cell .skeleton-content{background:linear-gradient(90deg,#4b556333,#4b556366,#4b556333);background-size:200% 100%}:host ::ng-deep .p-datatable .p-datatable-tbody .skeleton-row .skeleton-cell{width:auto;min-width:fit-content}:host-context(.my-app-dark) .table-title-container{background:var(--p-surface-800);border-bottom-color:var(--p-surface-700)}:host-context(.my-app-dark) .table-title{color:var(--p-text-color);background:linear-gradient(135deg,var(--p-text-color) 0%,var(--p-text-muted-color) 100%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator{background:var(--p-surface-900);border-top-color:var(--p-surface-800)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page:hover{background:var(--p-surface-700);border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page.p-highlight{background:var(--p-primary-color);border-color:var(--p-primary-color);color:var(--p-primary-contrast-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:hover{background:var(--p-surface-700);border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:disabled{background:var(--p-surface-900);border-color:var(--p-surface-800);color:var(--p-text-muted-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-current{color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:hover{border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:focus{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-100)}.flex{display:flex}.flex-col{flex-direction:column}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.justify-center{justify-content:center}.items-center{align-items:center}.text-center{text-align:center}.text-right{text-align:right}.text-left{text-align:left}.text-gray-400{color:#9ca3af}.text-gray-500{color:#6b7280}.text-gray-600{color:#4b5563}.text-gray-700{color:#374151}.text-gray-900{color:#111827}.text-blue-500{color:#3b82f6}.text-red-500{color:#ef4444}.text-green-500{color:#22c55e}.text-xs{font-size:.75rem;line-height:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.italic{font-style:italic}.w-full{width:100%}.w-10{width:2.5rem}.h-10{height:2.5rem}.h-7{height:1.75rem}.min-w-28{min-width:28px}.mx-auto{margin-left:auto;margin-right:auto}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-8{padding:2rem}.px-0{padding-left:0;padding-right:0}.py-0{padding-top:0;padding-bottom:0}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.pb-0{padding-bottom:0}.bg-gray-50{background-color:#f9fafb}.bg-gray-100{background-color:#f3f4f6}.bg-gray-200{background-color:#e5e7eb}.bg-gray-600{background-color:#4b5563}.bg-gray-700{background-color:#374151}.bg-gray-800{background-color:#1f2937}.bg-blue-100{background-color:#dbeafe}.bg-blue-200{background-color:#bfdbfe}.bg-blue-800{background-color:#1e40af}.bg-blue-900{background-color:#1e3a8a}.bg-green-200{background-color:#bbf7d0}.border-b{border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--p-surface-300)}.border-l-4{border-left-width:4px;border-left-style:solid}.border-blue-500{border-color:#3b82f6}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.rounded-lg{border-radius:.5rem}.shadow-sm{box-shadow:0 1px 2px #0000000d}.shadow-lg{box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.sticky{position:sticky}.top-0{top:0}.bottom-2{bottom:.5rem}.bottom-18{bottom:4.5rem}.z-9{z-index:9}.z-10{z-index:10}.z-30{z-index:30}.hover\\:bg-gray-50:hover{background-color:#f9fafb}.hover\\:bg-gray-100:hover{background-color:#f3f4f6}.hover\\:bg-gray-200:hover{background-color:#e5e7eb}.hover\\:bg-blue-200:hover{background-color:#bfdbfe}.hover\\:bg-blue-800:hover{background-color:#1e40af}:host-context(.my-app-dark) .dark\\:bg-gray-800{background-color:#1f2937}:host-context(.my-app-dark) .dark\\:bg-gray-700{background-color:#374151}:host-context(.my-app-dark) .dark\\:bg-gray-600{background-color:#4b5563}:host-context(.my-app-dark) .dark\\:bg-blue-900{background-color:#1e3a8a}:host-context(.my-app-dark) .dark\\:bg-blue-800{background-color:#1e40af}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-800:hover{background-color:#1f2937}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-700:hover{background-color:#374151}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-600:hover{background-color:#4b5563}:host-context(.my-app-dark) .dark\\:hover\\:bg-blue-800:hover{background-color:#1e40af}.animate__animated{animation-duration:1s;animation-fill-mode:both}.animate__fadeIn{animation-name:fadeIn}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i2$2.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i2$2.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "directive", type: i2$2.FrozenColumn, selector: "[pFrozenColumn]", inputs: ["frozen", "alignFrozen"] }, { kind: "directive", type: i2$2.RowToggler, selector: "[pRowToggler]", inputs: ["pRowToggler", "pRowTogglerDisabled"] }, { kind: "directive", type: i2$2.ResizableColumn, selector: "[pResizableColumn]", inputs: ["pResizableColumnDisabled"] }, { kind: "directive", type: i2$2.EditableColumn, selector: "[pEditableColumn]", inputs: ["pEditableColumn", "pEditableColumnField", "pEditableColumnRowIndex", "pEditableColumnDisabled", "pFocusCellSelector"] }, { kind: "component", type: i2$2.CellEditor, selector: "p-cellEditor" }, { kind: "component", type: i2$2.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i2$2.TableCheckbox, selector: "p-tableCheckbox", inputs: ["value", "disabled", "required", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i2$2.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "directive", type: i2$2.EditableRow, selector: "[pEditableRow]", inputs: ["pEditableRow", "pEditableRowDisabled"] }, { kind: "directive", type: i2$2.InitEditableRow, selector: "[pInitEditableRow]" }, { kind: "directive", type: i2$2.SaveEditableRow, selector: "[pSaveEditableRow]" }, { kind: "directive", type: i2$2.CancelEditableRow, selector: "[pCancelEditableRow]" }, { kind: "component", type: i2$2.ColumnFilter, selector: "p-columnFilter", inputs: ["field", "type", "display", "showMenu", "matchMode", "operator", "showOperator", "showClearButton", "showApplyButton", "showMatchModes", "showAddButton", "hideOnClear", "placeholder", "matchModeOptions", "maxConstraints", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "locale", "localeMatcher", "currency", "currencyDisplay", "useGrouping", "showButtons", "ariaLabel", "filterButtonProps"], outputs: ["onShow", "onHide"] }, { kind: "component", type: ButtonNgComponent, selector: "lib-button-ng", inputs: ["buttonConfig"], outputs: ["buttonConfigChange", "onClick"] }, { kind: "component", type: ToolbarNgComponent, selector: "lib-toolbar-ng" }, { kind: "component", type: FormComponent, selector: "lib-form", inputs: ["formGroup", "controls", "formConfig", "httpMessage"], outputs: ["formGroupChange", "httpMessageChange", "formSubmit", "formChanges", "formChangesDebounced"] }, { kind: "pipe", type: KeyToDisplayNamePipe, name: "keyToDisplayName" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: InlineInputComponent, selector: "lib-inline-input", inputs: ["config", "value"], outputs: ["valueChange", "outputValue", "outputBlur", "outputDebounced"] }, { kind: "component", type: BadgeNgComponent, selector: "lib-badge-ng", inputs: ["config"], outputs: ["configChange"] }, { kind: "component", type: HttpMessageComponent, selector: "lib-http-message", inputs: ["httpMessage"], outputs: ["httpMessageChange"] }, { kind: "component", type: SpeedDialNgComponent, selector: "lib-speed-dial-ng", inputs: ["configInput"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
3309
|
+
}
|
|
3310
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TableNgComponent, decorators: [{
|
|
3311
|
+
type: Component,
|
|
3312
|
+
args: [{ selector: 'lib-table-ng', imports: [
|
|
3313
|
+
CommonModule,
|
|
3314
|
+
TableModule,
|
|
3315
|
+
ButtonNgComponent,
|
|
3316
|
+
ToolbarNgComponent,
|
|
3317
|
+
FormComponent,
|
|
3318
|
+
KeyToDisplayNamePipe,
|
|
3319
|
+
FormsModule,
|
|
3320
|
+
InlineInputComponent,
|
|
3321
|
+
BadgeNgComponent,
|
|
3322
|
+
HttpMessageComponent,
|
|
3323
|
+
SpeedDialNgComponent
|
|
3324
|
+
], providers: [TableNgService, TableNgEditService], changeDetection: ChangeDetectionStrategy.OnPush, template: "@let paginationConfig = config()?.paginationConfig;\n@let globalFilterConfig = config()?.globalFilterConfig;\n@let selectionTableConfig = config()?.selectionTableConfig;\n@let filterConfigByKey = config()?.filterConfigByKey;\n@let frozenColumnConfigByKey = config()?.frozenColumnConfigByKey;\n@let scrollConfig = config()?.scrollConfig;\n@let lazyLoadingConfig = config()?.lazyLoadingConfig;\n@let keysNames = config()?.keysNames;\n@let columnConfig = config()?.columnConfig;\n@let editEnabled = editConfig()?.isEnabled ?? false;\n@let editType = editConfig()?.type ?? 'cell';\n@let inlineControls = editConfig()?.inlineControls;\n@let rowErrorConfig = editConfig()?.rowEditConfig?.rowErrorConfig;\n@let footerRows = footerConfig()?.footerRows;\n@let footerEnabled = footerConfig()?.isEnabled ?? false;\n@let titleConfig = config()?.titleConfig;\n@let selectedColumns = config()?.selectedColumns;\n@let rowExpansionConfig = config()?.rowExpansionConfig;\n@let advancedIdentifierFiltersConfig = config()?.globalFilterConfig?.advancedIdentifierFiltersConfig;\n\n<div class=\"p-datatable-wrapper\">\n @if (titleConfig?.isEnabled && titleConfig?.title) {\n <div class=\"table-title-container\">\n <h2 class=\"table-title\">{{ titleConfig!.title }}</h2>\n </div>\n }\n @if (!hideToolbar || (filteredValue || advancedFiltersPerformed.length > 0)) {\n <lib-toolbar-ng class=\"p-toolbar-header sticky top-0 z-30 dark:bg-gray-800\">\n <div class=\"flex gap-2\" toolbarStart>\n @if (globalFilterConfig?.isEnabled && !lazyLoadingConfig?.isEnabled) {\n <lib-form [controls]=\"controlsGlobalFilter\" [(formGroup)]=\"searchFormGroupGlobalFilter\"\n (formSubmit)=\"submitGlobalSearch($event)\"></lib-form>\n }\n @if (advancedIdentifierFiltersConfig?.isEnabled) {\n <lib-button-ng class=\"animate__animated animate__fadeIn\"\n [buttonConfig]=\"advancedIdentifierFiltersButton()\"></lib-button-ng>\n }\n @if (filteredValue || advancedFiltersPerformed.length > 0) {\n <lib-button-ng class=\"animate__animated animate__fadeIn\" [buttonConfig]=\"clearFiltersButton()\"></lib-button-ng>\n }\n </div>\n <div class=\"flex gap-2\" toolbarEnd>\n @if (toolbarSpeedDialButtons().length > 0) {\n @for (speedDial of toolbarSpeedDialButtons(); track $index) {\n <lib-speed-dial-ng [configInput]=\"speedDial\"></lib-speed-dial-ng>\n }\n }\n @if (toolbarButtons().length > 0) {\n @for (button of toolbarButtons(); track $index) {\n <lib-button-ng [buttonConfig]=\"button\"></lib-button-ng>\n }\n }\n @if ((editType === 'row' || editType === 'cell') && editEnabled) {\n <lib-button-ng [buttonConfig]=\"addRowButton()\"></lib-button-ng>\n }\n @if (enableExcelButton()) {\n <lib-button-ng [buttonConfig]=\"excelButton\" (onClick)=\"exportData(dt,'excel')\"></lib-button-ng>\n }\n @if (enablePdfButton()) {\n <lib-button-ng [buttonConfig]=\"pdfButton\" (onClick)=\"exportData(dt,'pdf')\"></lib-button-ng>\n }\n @if (enableRefreshButton) {\n <lib-button-ng [buttonConfig]=\"refreshButton\"></lib-button-ng>\n }\n </div>\n </lib-toolbar-ng>\n }\n <p-table #dt styleClass=\"p-datatable-sm\" [value]=\"data()\" [lazy]=\"lazyLoadingConfig?.isEnabled ?? false\"\n [editMode]=\"editType\" [totalRecords]=\"\n lazyLoadingConfig?.isEnabled\n ? (lazyLoadingConfig?.totalRecords ?? 0)\n : data().length\n \" [customSort]=\"true\" [paginator]=\"paginationConfig?.paginator ?? true\" [showCurrentPageReport]=\"true\"\n [rows]=\"paginationConfig?.rows ?? 5\" [rowsPerPageOptions]=\"paginationConfig?.rowsPerPageOptions ?? [5, 10, 20]\"\n [paginatorStyleClass]=\"paginatorStyleClass()\" [resizableColumns]=\"true\" [rowTrackBy]=\"trackById\"\n [columns]=\"selectedColumns\" [scrollable]=\"scrollConfig?.isEnabled ?? false\"\n [scrollHeight]=\"scrollConfig?.isEnabled ? scrollHeight() : undefined\" (onLazyLoad)=\"onLazyLoad($event)\"\n (sortFunction)=\"customSort($event)\" (onFilter)=\"onFilter($event)\" [(selection)]=\"selectedItems\"\n [currentPageReportTemplate]=\"getCustomPageReport()\" selectionPageOnly=\"true\" dataKey=\"id\" class=\"w-full\">\n <ng-template #header let-columns>\n <tr>\n @if (rowExpansionConfig?.isEnabled) {\n <th alignFrozen=\"left\" pFrozenColumn style=\"width: 2rem\" class=\"p-datatable-header-cell p-frozen-column\">\n\n </th>\n }\n @if (selectionTableConfig?.isEnabled) {\n <th alignFrozen=\"left\" pFrozenColumn style=\"width: 2rem\" class=\"p-datatable-header-cell p-frozen-column\">\n <p-tableHeaderCheckbox />\n </th>\n }\n\n @if (selectedColumns) {\n @for (column of columns; track $index) {\n <th pResizableColumn [id]=\"column.field\" alignFrozen=\"right\" pFrozenColumn\n [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[column.field])\" [pSortableColumn]=\"column.field\"\n class=\"p-datatable-header-cell\" [style.width.%]=\"columnConfig?.sizeByKey?.[column.field] ?? null\" [ngClass]=\"{\n 'p-frozen-column': frozenHandle(\n frozenColumnConfigByKey?.[column.field]\n ),\n }\">\n <div class=\"flex gap-2 justify-center items-center py-0 px-0\">\n {{ column.field | keyToDisplayName: keysNames }}\n @if(!editEnabled){\n <p-sortIcon [field]=\"column.field\" />\n }\n @if (filterConfigByKey?.[column.field]?.isEnabled) {\n <p-columnFilter type=\"text\" [field]=\"`rowData.${column.field}`\" display=\"menu\" [ngClass]=\"{\n 'bg-green-200 rounded-full p-1 shadow-sm text-green-500 transition-all duration-300 ease-in-out':\n advancedFiltersPerformed.includes(column.field),\n }\" [type]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig?.type ??\n 'text'\n \" [matchMode]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.matchMode\n \" [showMatchModes]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showMatchModes ?? false\n \" [showOperator]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showOperator ?? false\n \" [showAddButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showAddButton ?? false\n \" [showApplyButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showApplyButton ?? false\n \" [showClearButton]=\"\n filterConfigByKey?.[column.field]?.primeNgColumnFilterConfig\n ?.showClearButton ?? false\n \">\n @if (\n filterConfigByKey?.[column.field]?.customColumnFilterConfig\n ?.isEnabled ?? false\n ) {\n <ng-template #filter let-value let-filter=\"filterCallback\">\n <div style=\"min-width: 20rem\" class=\"\">\n <lib-inline-input\n (outputValue)=\"inlineFormChanges($event, filter, filterConfigByKey?.[column.field]?.customColumnFilterConfig?.inlineControlConfig?.typeInput, column.field)\"\n (outputDebounced)=\"onFilter($event)\" [(ngModel)]=\"advancedFiltersValues()[column.field]\"\n [config]=\"filterConfigByKey?.[column.field]?.customColumnFilterConfig?.inlineControlConfig ?? {typeInput: ETypeInput.TEXT}\"></lib-inline-input>\n </div>\n </ng-template>\n }\n </p-columnFilter>\n }\n </div>\n </th>\n }\n }@else {\n @for (key of keys(); track $index) {\n <th [id]=\"key\" pResizableColumn alignFrozen=\"right\" pFrozenColumn\n [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[key])\" [pSortableColumn]=\"key\"\n class=\"p-datatable-header-cell\" [style.width.%]=\"columnConfig?.sizeByKey?.[key] ?? null\" [ngClass]=\"{\n 'p-frozen-column': frozenHandle(frozenColumnConfigByKey?.[key]),\n }\">\n <div class=\"flex gap-2 justify-center items-center py-0 px-0\">\n {{ key | keyToDisplayName: keysNames }}\n @if(!editEnabled){\n <p-sortIcon [field]=\"key\" />\n }\n @if (filterConfigByKey?.[key]?.isEnabled) {\n <p-columnFilter type=\"text\" [field]=\"`rowData.${key}`\" display=\"menu\" [ngClass]=\"{\n 'bg-green-200 rounded-full p-1 shadow-sm text-green-500 transition-all duration-300 ease-in-out':\n advancedFiltersPerformed.includes(key),\n }\" [type]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.type ?? 'text'\"\n [matchMode]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.matchMode\"\n [showMatchModes]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showMatchModes ?? false\"\n [showOperator]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showOperator ?? false\"\n [showAddButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showAddButton ?? false\"\n [showApplyButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showApplyButton ?? false\"\n [showClearButton]=\"filterConfigByKey?.[key]?.primeNgColumnFilterConfig?.showClearButton ?? false\">\n @if (\n filterConfigByKey?.[key]?.customColumnFilterConfig\n ?.isEnabled ?? false\n ) {\n <ng-template #filter let-value let-filter=\"filterCallback\">\n <div style=\"min-width: 20rem\" class=\"\">\n <!-- <app-custom-advanced-filter filter\n [customColumnFilterConfig]=\"filterConfigByKey![key]!.customColumnFilterConfig!\"\n (formChanges)=\"formChanges($event, filter, key)\"\n [initialValue]=\"advancedFiltersValues[key]\"></app-custom-advanced-filter> -->\n <lib-inline-input\n (outputValue)=\"inlineFormChanges($event, filter, filterConfigByKey?.[key]?.customColumnFilterConfig?.inlineControlConfig?.typeInput, key)\"\n [(ngModel)]=\"advancedFiltersValues()[key]\"\n [config]=\"filterConfigByKey?.[key]?.customColumnFilterConfig?.inlineControlConfig ?? {typeInput: ETypeInput.TEXT}\"></lib-inline-input>\n </div>\n </ng-template>\n }\n </p-columnFilter>\n }\n </div>\n </th>\n }\n }\n\n @if (editType === 'cell' && editEnabled) {\n <th class=\"p-datatable-header-cell\" style=\"width: 100px\">\n </th>\n }\n @if (editType === 'row' && editEnabled) {\n <th class=\"p-datatable-header-cell\" style=\"width: 100px\">\n </th>\n }\n\n </tr>\n </ng-template>\n\n <ng-template #emptymessage>\n <tr>\n <td [attr.colspan]=\"totalColumns()\">\n @if (isLoading()) {\n <!-- Loading state -->\n <div class=\"p-8 text-center\">\n <div class=\"flex flex-col items-center justify-center gap-4\">\n <i class=\"pi pi-spin pi-spinner text-4xl text-blue-500\"></i>\n <p class=\"text-gray-600 text-lg\">{{ getLoadingMessage() }}</p>\n </div>\n </div>\n } @else if (timeoutExpired()) {\n <!-- No data available -->\n <div class=\"p-8 text-center text-gray-500\">\n <div class=\"flex flex-col items-center justify-center gap-3\">\n <i class=\"pi pi-info-circle text-4xl text-gray-400\"></i>\n <p class=\"text-lg\">{{ getNoDataMessage() }}</p>\n </div>\n </div>\n }\n </td>\n </tr>\n </ng-template>\n\n @if (hasRecords()) {\n @if (editEnabled) {\n @switch (editType) {\n @case ('cell') {\n <ng-template #body let-item let-editing=\"editing\">\n <tr class=\"p-datatable-row p-selectable-row\">\n @if (selectedColumns) {\n @for (column of selectedColumns; track $index){\n <td [pEditableColumn]=\"column.field\" pEditableColumnField=\"rowData.{{column.field}}\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[column.field]\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[column.field] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n @if (inlineControls?.[column.field]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | number: '1.2-2' }}\n\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | currency: item?.currencyTypeCellConfig?.[column.field]?.currency ??\n 'USD' }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATE) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATETIME_LOCAL) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy HH:mm\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[column.field]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[column.field]?.name) {\n {{ item.rowData[column.field]?.name }}\n } @else {\n {{ item.rowData[column.field] }}\n }\n }\n\n </ng-template>\n </p-cellEditor>\n </td>\n }\n } @else {\n @for (key of keys(); track $index){\n <td [pEditableColumn]=\"key\" pEditableColumnField=\"rowData.{{key}}\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[key]\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[key] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n @if (inlineControls?.[key]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[key]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n {{ item.rowData[key] }}\n }\n </ng-template>\n </p-cellEditor>\n </td>\n }\n }\n @if (editType === 'cell' && editEnabled) {\n <td class=\"px-2 py-1 text-center\">\n <div class=\"flex justify-center items-center gap-2\">\n <lib-button-ng [buttonConfig]=\"getDeleteRowButton()\" (onClick)=\"deleteRow(item)\"></lib-button-ng>\n </div>\n </td>\n }\n </tr>\n </ng-template>\n }\n @case ('row') {\n <ng-template #body let-item let-editing=\"editing\" let-ri=\"rowIndex\">\n <tr [pEditableRow]=\"item\" class=\"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 border-b\">\n @if (selectedColumns) {\n @for (column of selectedColumns; track $index){\n <td>\n <div class=\"flex flex-col gap-2\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[column.field]\"\n (outputValue)=\"inlineChange($event, column.field)\" (outputDebounced)=\"onEditData()\"\n [config]=\"inlineControls?.[column.field] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n\n </ng-template>\n <ng-template #output>\n\n @if (inlineControls?.[column.field]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | number: '1.2-2' }}\n\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[column.field] | currency: item?.currencyTypeCellConfig?.[column.field]?.currency ??\n 'USD' }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATE) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.DATETIME_LOCAL) {\n <div class=\"text-left\">\n {{ item.rowData[column.field] | date: \"dd/MM/yyyy HH:mm\" }}\n </div>\n } @else if(inlineControls?.[column.field]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[column.field]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[column.field]?.name) {\n {{ item.rowData[column.field]?.name }}\n } @else {\n {{ item.rowData[column.field] }}\n }\n }\n\n\n </ng-template>\n </p-cellEditor>\n\n @if (rowErrorConfig?.isEnabled && enableErrors && !rowFieldsHasValue()[column.field]) {\n <span class=\"text-red-500 italic text-xs\">{{\n rowErrorConfig?.fieldErrors?.[item.id]?.[column.field]?.message ??\n '' }}</span>\n }\n </div>\n </td>\n }\n } @else {\n @for (key of keys(); track $index){\n <td>\n <div class=\"flex flex-col gap-2\">\n <p-cellEditor>\n <ng-template #input>\n <lib-inline-input [(ngModel)]=\"item.rowData[key]\" (outputValue)=\"inlineChange($event, key)\"\n (outputDebounced)=\"onEditData()\" [config]=\"inlineControls?.[key] ?? {typeInput: ETypeInput.TEXT}\">\n </lib-inline-input>\n </ng-template>\n <ng-template #output>\n\n @if (inlineControls?.[key]?.typeInput === ETypeInput.NUMBER) {\n <div class=\"text-right\">\n {{ item.rowData[key] | number: '1.2-2' }}\n\n </div>\n }\n @else if(inlineControls?.[key]?.typeInput === ETypeInput.CURRENCY) {\n <div class=\"text-right\">\n {{ item.rowData[key] | currency: item?.currencyTypeCellConfig?.[key]?.currency ?? 'USD' }}\n </div>\n } @else if(inlineControls?.[key]?.typeInput === ETypeInput.SWITCH) {\n <div class=\"text-center\">\n @if (item.rowData[key]) {\n <i class=\"fa-solid fa-check text-green-500\"></i>\n } @else {\n <i class=\"fa-solid fa-times text-red-500\"></i>\n }\n </div>\n } @else {\n @if (item.rowData[key]?.name) {\n {{ item.rowData[key]?.name }}\n } @else {\n {{ item.rowData[key] }}\n }\n }\n\n\n </ng-template>\n </p-cellEditor>\n\n @if (rowErrorConfig?.isEnabled && enableErrors && !rowFieldsHasValue()[key]) {\n <span class=\"text-red-500 italic text-xs\">{{ rowErrorConfig?.fieldErrors?.[item.id]?.[key]?.message ??\n '' }}</span>\n }\n </div>\n </td>\n }\n }\n <td>\n <div class=\"flex justify-center items-center gap-2\">\n @if(!editing){\n <lib-button-ng pButton pRipple pInitEditableRow [buttonConfig]=\"getEditInitButton(item.id)\"\n (onClick)=\"onRowEditInit(item)\"></lib-button-ng>\n @if(!editConfig()?.rowEditConfig?.isDisabledDeleteButton){\n <lib-button-ng [buttonConfig]=\"getDeleteRowButton()\" (onClick)=\"deleteRow(item)\"></lib-button-ng>\n }\n }\n @if(editing){\n @if (hasErrorValues(rowErrorConfig?.fieldErrors?.[item.id] ?? {})) {\n <lib-button-ng [buttonConfig]=\"editSaveButtonWithErrors()\"\n (onClick)=\"onEditSaveWithErrors()\"></lib-button-ng>\n }\n @else {\n <lib-button-ng pButton pRipple pSaveEditableRow [buttonConfig]=\"editSaveButton()\"\n (onClick)=\"onRowEditSave(item)\"></lib-button-ng>\n }\n <lib-button-ng pButton pRipple pCancelEditableRow [buttonConfig]=\"editCancelButton()\"\n (onClick)=\"onRowEditCancel(item, ri)\"></lib-button-ng>\n }\n </div>\n </td>\n </tr>\n </ng-template>\n }\n }\n } @else {\n\n <ng-template #body let-item let-expanded=\"expanded\">\n <tr class=\"p-datatable-row p-selectable-row\" [ngClass]=\"{\n 'bg-gray-50 dark:bg-gray-800 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700': item.onClick && !item.isSelected && !item.isLoading,\n 'bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600': !item.onClick && !item.isSelected && !item.isLoading,\n 'bg-blue-100 dark:bg-blue-900 border-l-4 border-blue-500 hover:bg-blue-200 dark:hover:bg-blue-800': item.isSelected && !item.isLoading,\n 'skeleton-row': item.isLoading\n }\" (click)=\"item?.isLoading ? null : onRowClick(item)\">\n\n @if (rowExpansionConfig?.isEnabled) {\n <td (click)=\"$event.stopPropagation()\" [class.skeleton-cell]=\"item.isLoading\"\n [style.height]=\"item.isLoading ? '3rem' : 'auto'\">\n @if (!item.isLoading) {\n <lib-button-ng [buttonConfig]=\"rowExpansionButton(expanded)()\" type=\"button\" pRipple\n [pRowToggler]=\"item\"></lib-button-ng>\n } @else {\n <div class=\"skeleton-content\"></div>\n }\n </td>\n }\n\n @if (selectionTableConfig?.isEnabled) {\n <td (click)=\"$event.stopPropagation()\" alignFrozen=\"left\" pFrozenColumn class=\"shadow-lg\"\n [class.skeleton-cell]=\"item.isLoading\" [style.height]=\"item.isLoading ? '3rem' : 'auto'\">\n @if (!item.isLoading) {\n <p-tableCheckbox [id]=\"item\" [value]=\"item\" />\n } @else {\n <div class=\"skeleton-content\"></div>\n }\n </td>\n }\n\n @for (key of keys(); track $index) {\n @if (isThatItemInTheProductSelection(key)) {\n <td [id]=\"key\" class=\"p-datatable-cell\" [style.height]=\"item.isLoading ? '3rem' : 'min-content'\"\n alignFrozen=\"right\" pFrozenColumn [ngClass]=\"{\n 'p-frozen-column': frozenHandle(frozenColumnConfigByKey?.[key]),\n 'text-center': item.rowDataButtons?.[key] || item.typeCell?.[key] === ETypeInput.BADGE,\n 'skeleton-cell': item.isLoading\n }\" [frozen]=\"frozenHandle(frozenColumnConfigByKey?.[key])\">\n @if (item.isLoading) {\n <div class=\"skeleton-content\"></div>\n } @else {\n @if (item.rowDataButtons?.[key]) {\n <div class=\"flex gap-4 w-full justify-center items-center\">\n @for (btn of item.rowDataButtons[key]; track $index) {\n @if (btn) {\n <lib-button-ng class=\"w-full\" (click)=\"$event.stopPropagation()\" [buttonConfig]=\"btn\"></lib-button-ng>\n }\n }\n </div>\n } @else {\n @switch (item.typeCell?.[key]) {\n @case (ETypeInput.IMAGE) {\n <img [src]=\"item.rowData[key]\" alt=\"Image\" class=\"w-10 h-10 mx-auto\">\n }\n @case (ETypeInput.DATE) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy\" }}\n }\n @case (ETypeInput.DATETIME_LOCAL) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy HH:mm\" }}\n }\n @case (ETypeInput.CURRENCY) {\n {{item?.currencyTypeCellConfig?.[key]?.currency}} {{ item.rowData[key] | currency:\n item?.currencyTypeCellConfig?.[key]?.currency ?? 'USD' }}\n }\n @case (ETypeInput.BADGE) {\n <lib-badge-ng [config]=\"item.rowData[key]\"></lib-badge-ng>\n }\n @case (ETypeInput.COMPONENT) {\n <ng-container\n *ngTemplateOutlet=\"item.rowDataComponents?.[key]; context: { $implicit: item.raw }\"></ng-container>\n }\n @default {\n @if (isDate(item.rowData[key])) {\n {{ item.rowData[key] | date: \"dd/MM/yyyy\" }}\n } @else if (typeof item.rowData[key] === \"string\") {\n {{ item.rowData[key] }}\n } @else if (isPrimeNgSelection(item.rowData[key])) {\n {{ item.rowData[key].name }}\n } @else if(typeof item.rowData[key] === \"number\") {\n <p class=\"text-right\">\n {{ item.rowData[key] | number: '1.2-2' }}\n </p>\n }\n }\n }\n }\n }\n </td>\n }\n }\n </tr>\n </ng-template>\n }\n }\n\n <ng-template #footer>\n @if (footerEnabled) {\n @for (row of footerRows; track $index) {\n <tr class=\"p-datatable-row p-datatable-footer-row\">\n @for (cell of row; track $index) {\n <td colSpan=\"{{ cell.colSpan }}\" class=\"{{ cell.class }} text-right font-bold p-3 pb-0\">{{\n applyPipe(cell.value,\n cell.pipeConfig) }}</td>\n\n }\n </tr>\n }\n\n }\n </ng-template>\n <ng-template #expandedrow let-item>\n <tr>\n <td colspan=\"100%\">\n <div class=\"p-datatable-row-expansion\">\n <ng-container *ngTemplateOutlet=\"currentItemTemplate; context: { $implicit: item }\"></ng-container>\n\n </div>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (showBottomToolbar()) {\n <div class=\"p-datatable-footer sticky bottom-2 z-9 animate__animated animate__fadeIn\">\n <lib-toolbar-ng>\n @if (showManagementSelectionConfig()) {\n <div toolbarStart\n class=\"p-datatable-footer-content flex items-center gap-3 px-4 rounded-lg animate__animated animate__fadeIn\">\n <span class=\"font-medium text-gray-700\">{{ getSelectedItemsLabel() }}</span>\n <div class=\"p-datatable-footer-badge flex items-center justify-center min-w-[28px] h-7 px-2 rounded-md\">\n <span class=\"font-semibold text-gray-900\">{{\n totalItemsSelected().toLocaleString()\n }}</span>\n </div>\n <span class=\"text-sm text-gray-600\">{{ getRecordsLabel() }}</span>\n <lib-button-ng [buttonConfig]=\"showSelectedItemsManagementButton()\"></lib-button-ng>\n </div>\n }\n </lib-toolbar-ng>\n </div>\n }\n</div>\n@if (httpMessage()) {\n<lib-http-message [(httpMessage)]=\"httpMessage\"></lib-http-message>\n}", styles: [".cursor-pointer{cursor:pointer}.empty-data-message{text-align:center;padding:2rem;color:#6c757d;font-style:italic}.table-title-container{background:var(--p-surface-50);border-bottom:1px solid var(--p-surface-200);padding:1.25rem 2rem;position:relative}.table-title{color:var(--p-text-color);font-size:1.5rem;font-weight:600;text-align:center;margin:0;letter-spacing:-.025em;text-shadow:0 1px 2px rgba(0,0,0,.05);background:linear-gradient(135deg,var(--p-text-color) 0%,var(--p-text-muted-color) 100%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent;position:relative}.table-title:after{content:\"\";position:absolute;bottom:-.5rem;left:50%;transform:translate(-50%);width:60px;height:2px;background:linear-gradient(90deg,var(--p-primary-color),var(--p-primary-600));border-radius:1px}:host ::ng-deep .p-datatable-paginator{background:var(--p-surface-100);border-top:1px solid var(--p-surface-300);padding:1rem}:host ::ng-deep .p-datatable-paginator .p-paginator{background:transparent;border:none;padding:0}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page:hover{background:var(--p-surface-300);border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page.p-highlight{background:var(--p-primary-color);border-color:var(--p-primary-color);color:var(--p-primary-contrast-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:hover,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:hover{background:var(--p-surface-300);border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:disabled,:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:disabled{background:var(--p-surface-100);border-color:var(--p-surface-300);color:var(--p-text-muted-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-current{color:var(--p-text-color);font-weight:500}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown{background:var(--p-surface-200);border:1px solid var(--p-surface-300);color:var(--p-text-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:hover{border-color:var(--p-primary-color)}:host ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:focus{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-100)}.skeleton-row{pointer-events:none;-webkit-user-select:none;user-select:none;min-height:3rem}.skeleton-cell{position:relative;overflow:hidden;min-height:3rem;padding:.75rem .5rem!important}.skeleton-cell .skeleton-content{position:absolute;inset:.5rem;min-height:1.5rem;background:linear-gradient(90deg,#d1d5db33,#d1d5db66,#d1d5db33);background-size:200% 100%;animation:skeleton-loading 1.5s ease-in-out infinite;border-radius:4px}@keyframes skeleton-loading{0%{background-position:200% 0}to{background-position:-200% 0}}:host-context(.my-app-dark) .skeleton-cell .skeleton-content{background:linear-gradient(90deg,#4b556333,#4b556366,#4b556333);background-size:200% 100%}:host ::ng-deep .p-datatable .p-datatable-tbody .skeleton-row .skeleton-cell{width:auto;min-width:fit-content}:host-context(.my-app-dark) .table-title-container{background:var(--p-surface-800);border-bottom-color:var(--p-surface-700)}:host-context(.my-app-dark) .table-title{color:var(--p-text-color);background:linear-gradient(135deg,var(--p-text-color) 0%,var(--p-text-muted-color) 100%);background-clip:text;-webkit-background-clip:text;-webkit-text-fill-color:transparent}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator{background:var(--p-surface-900);border-top-color:var(--p-surface-800)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page:hover{background:var(--p-surface-700);border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-pages .p-paginator-page.p-highlight{background:var(--p-primary-color);border-color:var(--p-primary-color);color:var(--p-primary-contrast-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:hover,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:hover{background:var(--p-surface-700);border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-first:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-prev:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-next:disabled,:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-last:disabled{background:var(--p-surface-900);border-color:var(--p-surface-800);color:var(--p-text-muted-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-paginator-current{color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown{background:var(--p-surface-800);border-color:var(--p-surface-700);color:var(--p-text-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:hover{border-color:var(--p-primary-color)}:host-context(.my-app-dark) ::ng-deep .p-datatable-paginator .p-paginator .p-dropdown:focus{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-100)}.flex{display:flex}.flex-col{flex-direction:column}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.justify-center{justify-content:center}.items-center{align-items:center}.text-center{text-align:center}.text-right{text-align:right}.text-left{text-align:left}.text-gray-400{color:#9ca3af}.text-gray-500{color:#6b7280}.text-gray-600{color:#4b5563}.text-gray-700{color:#374151}.text-gray-900{color:#111827}.text-blue-500{color:#3b82f6}.text-red-500{color:#ef4444}.text-green-500{color:#22c55e}.text-xs{font-size:.75rem;line-height:1rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}.italic{font-style:italic}.w-full{width:100%}.w-10{width:2.5rem}.h-10{height:2.5rem}.h-7{height:1.75rem}.min-w-28{min-width:28px}.mx-auto{margin-left:auto;margin-right:auto}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-8{padding:2rem}.px-0{padding-left:0;padding-right:0}.py-0{padding-top:0;padding-bottom:0}.px-2{padding-left:.5rem;padding-right:.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.px-4{padding-left:1rem;padding-right:1rem}.pb-0{padding-bottom:0}.bg-gray-50{background-color:#f9fafb}.bg-gray-100{background-color:#f3f4f6}.bg-gray-200{background-color:#e5e7eb}.bg-gray-600{background-color:#4b5563}.bg-gray-700{background-color:#374151}.bg-gray-800{background-color:#1f2937}.bg-blue-100{background-color:#dbeafe}.bg-blue-200{background-color:#bfdbfe}.bg-blue-800{background-color:#1e40af}.bg-blue-900{background-color:#1e3a8a}.bg-green-200{background-color:#bbf7d0}.border-b{border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:var(--p-surface-300)}.border-l-4{border-left-width:4px;border-left-style:solid}.border-blue-500{border-color:#3b82f6}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.rounded-lg{border-radius:.5rem}.shadow-sm{box-shadow:0 1px 2px #0000000d}.shadow-lg{box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.sticky{position:sticky}.top-0{top:0}.bottom-2{bottom:.5rem}.bottom-18{bottom:4.5rem}.z-9{z-index:9}.z-10{z-index:10}.z-30{z-index:30}.hover\\:bg-gray-50:hover{background-color:#f9fafb}.hover\\:bg-gray-100:hover{background-color:#f3f4f6}.hover\\:bg-gray-200:hover{background-color:#e5e7eb}.hover\\:bg-blue-200:hover{background-color:#bfdbfe}.hover\\:bg-blue-800:hover{background-color:#1e40af}:host-context(.my-app-dark) .dark\\:bg-gray-800{background-color:#1f2937}:host-context(.my-app-dark) .dark\\:bg-gray-700{background-color:#374151}:host-context(.my-app-dark) .dark\\:bg-gray-600{background-color:#4b5563}:host-context(.my-app-dark) .dark\\:bg-blue-900{background-color:#1e3a8a}:host-context(.my-app-dark) .dark\\:bg-blue-800{background-color:#1e40af}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-800:hover{background-color:#1f2937}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-700:hover{background-color:#374151}:host-context(.my-app-dark) .dark\\:hover\\:bg-gray-600:hover{background-color:#4b5563}:host-context(.my-app-dark) .dark\\:hover\\:bg-blue-800:hover{background-color:#1e40af}.animate__animated{animation-duration:1s;animation-fill-mode:both}.animate__fadeIn{animation-name:fadeIn}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}\n"] }]
|
|
3325
|
+
}], ctorParameters: () => [], propDecorators: { dt: [{
|
|
3326
|
+
type: ViewChild,
|
|
3327
|
+
args: ['dt']
|
|
3328
|
+
}], itemTemplate: [{
|
|
3329
|
+
type: ContentChild,
|
|
3330
|
+
args: ['item', { static: true }]
|
|
3331
|
+
}] } });
|
|
3332
|
+
|
|
3333
|
+
/*
|
|
3334
|
+
* Public API Surface of lib-components
|
|
3335
|
+
|
|
3336
|
+
NPM TOKEN:
|
|
3337
|
+
4f5f941cb6703a2bea326507bd5098aa7dd8224ef4d9b434f6209c73855bf7ac
|
|
3338
|
+
8b61ac2dab0cf90c13878339c755b09f868b34906ad196a1138433f76f41feb4
|
|
3339
|
+
37b8f0500846352a33a9d1e2a8504e8a4332cd035a3819d9dc4b2dcdf557c3f0
|
|
3340
|
+
31f1ccdf0a47736bd3851647d485385323328542c49de9d95498d875e3977f5e
|
|
3341
|
+
de13d65e8a0357ce9f2e18c899c8e7f6f728181baa031761ecdd7ef5cb166eb2
|
|
3342
|
+
*/
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* Generated bundle index. Do not edit.
|
|
3346
|
+
*/
|
|
3347
|
+
|
|
3348
|
+
export { AminatedContainerComponent as A, BaseDialogComponent as B, DisabledContainerComponent as D, ETypeInput as E, FormComponent as F, HttpMessageComponent as H, InlineInputComponent as I, LibComponentsService as L, SpeedDialNgComponent as S, TableNgComponent as T, ButtonNgComponent as a, LibComponentsComponent as b };
|
|
3349
|
+
//# sourceMappingURL=ln-20-lib-components-ln-20-lib-components-pJLg_v6U.mjs.map
|