tailjng 0.0.26 → 0.0.28
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/cli/settings/components-list.js +8 -5
- package/cli/settings/header-generator.js +1 -1
- package/fesm2022/tailjng.mjs +352 -164
- package/fesm2022/tailjng.mjs.map +1 -1
- package/lib/services/static/icons.service.d.ts +6 -1
- package/lib/services/transformer/transform.service.d.ts +23 -0
- package/lib/shared/dialog.shared.d.ts +22 -0
- package/lib/shared/form.shared.d.ts +57 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
- package/src/lib/components/menu/menu-options-table/options-table-menu.component.ts +10 -10
- package/src/lib/components/table/table-complete/complete-table.component.html +626 -0
- package/src/lib/components/table/table-complete/complete-table.component.scss +5 -0
- package/src/lib/components/table/table-complete/complete-table.component.ts +1027 -0
|
@@ -110,11 +110,14 @@ function getComponentList() {
|
|
|
110
110
|
path: "src/lib/components/menu/menu-options-table",
|
|
111
111
|
dependencies: ["button"],
|
|
112
112
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
'table-complete': {
|
|
118
|
+
path: "src/lib/components/table/table-complete",
|
|
119
|
+
dependencies: ["button", "paginator-complete", "filter-complete", "checkbox-input", "menu-options-table", "dialog", "image-viewer", "select-dropdown", "input"],
|
|
120
|
+
},
|
|
118
121
|
'theme-generator': {
|
|
119
122
|
path: "src/lib/components/theme-generator",
|
|
120
123
|
dependencies: ["input", "input-range", "button", "label", "form-container"],
|
package/fesm2022/tailjng.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken,
|
|
2
|
+
import { InjectionToken, signal, computed, Injectable, Inject } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { formatDistanceToNowStrict } from 'date-fns';
|
|
5
5
|
import { es } from 'date-fns/locale';
|
|
6
6
|
import { map, isObservable, firstValueFrom, forkJoin } from 'rxjs';
|
|
7
7
|
import * as i1$1 from '@angular/common/http';
|
|
8
8
|
import { HttpParams } from '@angular/common/http';
|
|
9
|
-
import { EllipsisVertical, Trash, Edit, Pencil, PencilLine, ListRestart, FileUp, MonitorUp, FileSpreadsheet, Cpu, Trash2, Eraser, ArrowDownWideNarrow, Filter, ChevronsRight, ChevronRight, ChevronLeft, ChevronsLeft, Loader2, Moon, Sun, Save, Copy, Search, SquareDashedMousePointer, ChevronsUpDown,
|
|
9
|
+
import { Clock, Calendar, EllipsisVertical, Trash, Edit, Pencil, PencilLine, ListRestart, FileUp, MonitorUp, FileSpreadsheet, Cpu, Trash2, Eraser, ArrowDownWideNarrow, Filter, ArrowBigRight, ChevronsRight, ChevronRight, ChevronLeft, ChevronsLeft, Loader2, Moon, Sun, Save, Copy, Search, SquareDashedMousePointer, ChevronsUpDown, ChevronDown, ChevronUp, Eye, Upload, ImageOff, Images, Image, Minimize2, Scan, RefreshCcw, RotateCcw, RotateCw, ZoomOut, ZoomIn, Check, X, CircleHelp, TriangleAlert, CircleX, CircleCheck, Info } from 'lucide-angular';
|
|
10
10
|
import * as FileSaver from 'file-saver';
|
|
11
11
|
import * as ExcelJS from 'exceljs';
|
|
12
12
|
import * as XLSX from 'xlsx';
|
|
@@ -28,6 +28,302 @@ const TAILJNG_CONFIG = new InjectionToken('TAILJNG_CONFIG');
|
|
|
28
28
|
// This interface defines the structure of a table column in a CRUD application.
|
|
29
29
|
// ======================================================
|
|
30
30
|
|
|
31
|
+
class JAlertToastService {
|
|
32
|
+
toastsSignal = signal([]);
|
|
33
|
+
autoCloseTimers = new Map();
|
|
34
|
+
// Default auto-close delay in milliseconds
|
|
35
|
+
DEFAULT_AUTO_CLOSE_DELAY = 5000;
|
|
36
|
+
// Default action button text
|
|
37
|
+
DEFAULT_ACTION_BUTTON_TEXT = "Action";
|
|
38
|
+
// For compatibility with existing code
|
|
39
|
+
isOpenSignal = signal(false);
|
|
40
|
+
configSignal = signal(null);
|
|
41
|
+
isLoadingAction = signal(false);
|
|
42
|
+
isLoadingCancel = signal(false);
|
|
43
|
+
// Computed values for all toasts
|
|
44
|
+
toasts = computed(() => this.toastsSignal());
|
|
45
|
+
// For backward compatibility with existing code
|
|
46
|
+
isOpen = computed(() => this.isOpenSignal());
|
|
47
|
+
config = computed(() => this.configSignal());
|
|
48
|
+
isActionLoading = computed(() => this.isLoadingAction());
|
|
49
|
+
isCancelLoading = computed(() => this.isLoadingCancel());
|
|
50
|
+
getConfig() {
|
|
51
|
+
return this.configSignal();
|
|
52
|
+
}
|
|
53
|
+
AlertToast(config) {
|
|
54
|
+
const toastId = crypto.randomUUID();
|
|
55
|
+
// Store callbacks for this toast
|
|
56
|
+
const onActionCallback = "onAction" in config ? config.onAction : undefined;
|
|
57
|
+
const onCancelCallback = "onCancel" in config ? config.onCancel : undefined;
|
|
58
|
+
// Get action button text or use default
|
|
59
|
+
const actionNameButton = config.actionButtonText ?? this.DEFAULT_ACTION_BUTTON_TEXT;
|
|
60
|
+
const toast = {
|
|
61
|
+
id: toastId,
|
|
62
|
+
config,
|
|
63
|
+
isActionLoading: false,
|
|
64
|
+
isCancelLoading: false,
|
|
65
|
+
onActionCallback,
|
|
66
|
+
onCancelCallback,
|
|
67
|
+
actionNameButton, // Add the button text
|
|
68
|
+
createdAt: Date.now()
|
|
69
|
+
};
|
|
70
|
+
// Add the toast to our list
|
|
71
|
+
this.toastsSignal.update(toasts => [...toasts, toast]);
|
|
72
|
+
// Check if this toast should auto-close
|
|
73
|
+
// If autoClose is explicitly set to true OR
|
|
74
|
+
// if it's a success toast and autoClose is not explicitly set to false
|
|
75
|
+
const shouldAutoClose = config.autoClose === true ||
|
|
76
|
+
(config.type === 'success' && config.autoClose !== false);
|
|
77
|
+
if (shouldAutoClose) {
|
|
78
|
+
// Use the provided delay or the default
|
|
79
|
+
const delay = config.autoCloseDelay ?? this.DEFAULT_AUTO_CLOSE_DELAY;
|
|
80
|
+
const timerId = setTimeout(() => {
|
|
81
|
+
this.closeToastById(toastId);
|
|
82
|
+
this.autoCloseTimers.delete(toastId);
|
|
83
|
+
}, delay);
|
|
84
|
+
this.autoCloseTimers.set(toastId, timerId);
|
|
85
|
+
}
|
|
86
|
+
return toastId;
|
|
87
|
+
}
|
|
88
|
+
closeToastById(toastId) {
|
|
89
|
+
// Clear any auto-close timer
|
|
90
|
+
if (this.autoCloseTimers.has(toastId)) {
|
|
91
|
+
clearTimeout(this.autoCloseTimers.get(toastId));
|
|
92
|
+
this.autoCloseTimers.delete(toastId);
|
|
93
|
+
}
|
|
94
|
+
this.toastsSignal.update(toasts => toasts.filter(toast => toast.id !== toastId));
|
|
95
|
+
}
|
|
96
|
+
closeAllToasts() {
|
|
97
|
+
// Clear all timers
|
|
98
|
+
this.autoCloseTimers.forEach(timerId => clearTimeout(timerId));
|
|
99
|
+
this.autoCloseTimers.clear();
|
|
100
|
+
this.toastsSignal.set([]);
|
|
101
|
+
}
|
|
102
|
+
async executeToastAction(toastId, action) {
|
|
103
|
+
const toast = this.toastsSignal().find(t => t.id === toastId);
|
|
104
|
+
if (!toast)
|
|
105
|
+
return;
|
|
106
|
+
let callback;
|
|
107
|
+
let loadingProperty;
|
|
108
|
+
switch (action) {
|
|
109
|
+
case "action":
|
|
110
|
+
callback = toast.onActionCallback;
|
|
111
|
+
loadingProperty = 'isActionLoading';
|
|
112
|
+
break;
|
|
113
|
+
case "cancel":
|
|
114
|
+
callback = toast.onCancelCallback;
|
|
115
|
+
loadingProperty = 'isCancelLoading';
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
if (callback) {
|
|
119
|
+
// Update loading state
|
|
120
|
+
this.toastsSignal.update(toasts => toasts.map(t => t.id === toastId ? { ...t, [loadingProperty]: true } : t));
|
|
121
|
+
try {
|
|
122
|
+
await callback();
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.error(`Error en la acción ${action}:`, error);
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
// Update loading state back to false (in case the toast hasn't been closed)
|
|
129
|
+
this.toastsSignal.update(toasts => {
|
|
130
|
+
const updatedToasts = toasts.map(t => t.id === toastId ? { ...t, [loadingProperty]: false } : t);
|
|
131
|
+
return updatedToasts;
|
|
132
|
+
});
|
|
133
|
+
this.closeToastById(toastId);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
this.closeToastById(toastId);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// For backward compatibility with existing code
|
|
141
|
+
closeToast() {
|
|
142
|
+
this.closeAllToasts();
|
|
143
|
+
this.isOpenSignal.set(false);
|
|
144
|
+
this.configSignal.set(null);
|
|
145
|
+
}
|
|
146
|
+
// For backward compatibility with existing code
|
|
147
|
+
async executeAction(action) {
|
|
148
|
+
let callback;
|
|
149
|
+
let loadingSignal;
|
|
150
|
+
switch (action) {
|
|
151
|
+
case "action":
|
|
152
|
+
callback = "onAction" in (this.configSignal() || {})
|
|
153
|
+
? this.configSignal().onAction
|
|
154
|
+
: undefined;
|
|
155
|
+
loadingSignal = this.isLoadingAction;
|
|
156
|
+
break;
|
|
157
|
+
case "cancel":
|
|
158
|
+
callback = "onCancel" in (this.configSignal() || {})
|
|
159
|
+
? this.configSignal().onCancel
|
|
160
|
+
: undefined;
|
|
161
|
+
loadingSignal = this.isLoadingCancel;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (callback) {
|
|
165
|
+
loadingSignal.set(true);
|
|
166
|
+
try {
|
|
167
|
+
await callback();
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
console.error(`Error en la acción ${action}:`, error);
|
|
171
|
+
}
|
|
172
|
+
finally {
|
|
173
|
+
loadingSignal.set(false);
|
|
174
|
+
this.closeToast();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.closeToast();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
182
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, providedIn: "root" });
|
|
183
|
+
}
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, decorators: [{
|
|
185
|
+
type: Injectable,
|
|
186
|
+
args: [{
|
|
187
|
+
providedIn: "root",
|
|
188
|
+
}]
|
|
189
|
+
}] });
|
|
190
|
+
|
|
191
|
+
class JFormShared {
|
|
192
|
+
alertToastService;
|
|
193
|
+
onResetCallback = null;
|
|
194
|
+
isLoading = false;
|
|
195
|
+
openForm = false;
|
|
196
|
+
typeForm = 'create';
|
|
197
|
+
formControls = {};
|
|
198
|
+
messages = null;
|
|
199
|
+
isVisiblePassword = false;
|
|
200
|
+
constructor(alertToastService) {
|
|
201
|
+
this.alertToastService = alertToastService;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Open form
|
|
205
|
+
*/
|
|
206
|
+
onOpen() {
|
|
207
|
+
this.openForm = true;
|
|
208
|
+
if (this.onResetCallback) {
|
|
209
|
+
this.onResetCallback();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Close form
|
|
214
|
+
*/
|
|
215
|
+
onClose() {
|
|
216
|
+
this.openForm = false;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Validate the change form
|
|
220
|
+
* @param validation
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
223
|
+
onValidateChange(validation) {
|
|
224
|
+
if (validation) {
|
|
225
|
+
this.alertToastService.AlertToast({
|
|
226
|
+
type: "info",
|
|
227
|
+
title: "Sin cambios...",
|
|
228
|
+
description: "No se han realizado cambios en el formulario"
|
|
229
|
+
});
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Handle form submit
|
|
236
|
+
*/
|
|
237
|
+
onTableDataLoaded() {
|
|
238
|
+
this.isLoading = false;
|
|
239
|
+
this.openForm = false;
|
|
240
|
+
if (this.messages) {
|
|
241
|
+
this.alertToastService.AlertToast({
|
|
242
|
+
type: "success",
|
|
243
|
+
...this.messages
|
|
244
|
+
});
|
|
245
|
+
this.messages = null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Toggle password visibility
|
|
250
|
+
* @param event
|
|
251
|
+
*/
|
|
252
|
+
togglePasswordVisibility(event) {
|
|
253
|
+
const checkbox = event.target;
|
|
254
|
+
if (checkbox.checked) {
|
|
255
|
+
this.isVisiblePassword = true;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
this.isVisiblePassword = false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Converter a formato ISO local
|
|
263
|
+
* @param date
|
|
264
|
+
* @returns
|
|
265
|
+
*/
|
|
266
|
+
toLocalISO(date) {
|
|
267
|
+
const d = date ? new Date(date) : new Date();
|
|
268
|
+
const offset = d.getTimezoneOffset();
|
|
269
|
+
const localDate = new Date(d.getTime() - offset * 60000);
|
|
270
|
+
return localDate.toISOString().slice(0, 16);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Converter a formato de entrada de fecha
|
|
274
|
+
* @param date
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
277
|
+
toDateInputValue(date) {
|
|
278
|
+
if (!date)
|
|
279
|
+
return '';
|
|
280
|
+
const d = new Date(date);
|
|
281
|
+
const utcOffset = d.getUTCDay();
|
|
282
|
+
const adjustedDate = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
|
|
283
|
+
return adjustedDate.toISOString().split('T')[0];
|
|
284
|
+
}
|
|
285
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFormShared, deps: [{ token: JAlertToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
286
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFormShared, providedIn: 'root' });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFormShared, decorators: [{
|
|
289
|
+
type: Injectable,
|
|
290
|
+
args: [{
|
|
291
|
+
providedIn: 'root'
|
|
292
|
+
}]
|
|
293
|
+
}], ctorParameters: () => [{ type: JAlertToastService }] });
|
|
294
|
+
|
|
295
|
+
class JDialogShared {
|
|
296
|
+
dialogStates = {};
|
|
297
|
+
/**
|
|
298
|
+
* Open dialog
|
|
299
|
+
* @param id
|
|
300
|
+
*/
|
|
301
|
+
onOpen(id) {
|
|
302
|
+
this.dialogStates[id] = true;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Close dialog
|
|
306
|
+
* @param id
|
|
307
|
+
*/
|
|
308
|
+
onClose(id) {
|
|
309
|
+
this.dialogStates[id] = false;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Check if dialog is open
|
|
313
|
+
* @param id
|
|
314
|
+
* @returns
|
|
315
|
+
*/
|
|
316
|
+
isOpen(id) {
|
|
317
|
+
return this.dialogStates[id] ?? false;
|
|
318
|
+
}
|
|
319
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JDialogShared, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
320
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JDialogShared, providedIn: 'root' });
|
|
321
|
+
}
|
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JDialogShared, decorators: [{
|
|
323
|
+
type: Injectable,
|
|
324
|
+
args: [{ providedIn: 'root' }]
|
|
325
|
+
}] });
|
|
326
|
+
|
|
31
327
|
class JCalendarService {
|
|
32
328
|
nameDaysAb = ['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'];
|
|
33
329
|
nameDays = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
|
|
@@ -660,6 +956,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
660
956
|
}]
|
|
661
957
|
}] });
|
|
662
958
|
|
|
959
|
+
class JTransformService {
|
|
960
|
+
/**
|
|
961
|
+
* Verify if the value is a valid JSON string.
|
|
962
|
+
* @param value
|
|
963
|
+
* @returns
|
|
964
|
+
*/
|
|
965
|
+
isJson(value) {
|
|
966
|
+
try {
|
|
967
|
+
JSON.parse(value);
|
|
968
|
+
return true;
|
|
969
|
+
}
|
|
970
|
+
catch (e) {
|
|
971
|
+
return false;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Parse a JSON string and return the array.
|
|
976
|
+
* @param value The JSON string to parse.
|
|
977
|
+
* @returns The parsed array.
|
|
978
|
+
*/
|
|
979
|
+
parseJson(value) {
|
|
980
|
+
return JSON.parse(value);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Capitalize the first letter of each word and lowercase the rest.
|
|
984
|
+
* @param name The input string to capitalize.
|
|
985
|
+
* @returns The capitalized string.
|
|
986
|
+
*/
|
|
987
|
+
capitalizeText(name) {
|
|
988
|
+
return name
|
|
989
|
+
.trim()
|
|
990
|
+
.toLowerCase()
|
|
991
|
+
.split(' ')
|
|
992
|
+
.filter(Boolean)
|
|
993
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
994
|
+
.join(' ');
|
|
995
|
+
}
|
|
996
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
997
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, providedIn: 'root' });
|
|
998
|
+
}
|
|
999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, decorators: [{
|
|
1000
|
+
type: Injectable,
|
|
1001
|
+
args: [{
|
|
1002
|
+
providedIn: 'root'
|
|
1003
|
+
}]
|
|
1004
|
+
}] });
|
|
1005
|
+
|
|
663
1006
|
class JIconsService {
|
|
664
1007
|
icons = {
|
|
665
1008
|
info: Info,
|
|
@@ -676,11 +1019,13 @@ class JIconsService {
|
|
|
676
1019
|
reset: RefreshCcw,
|
|
677
1020
|
fullscreen: Scan,
|
|
678
1021
|
exitFullscreen: Minimize2,
|
|
1022
|
+
img: Image,
|
|
1023
|
+
imgs: Images,
|
|
679
1024
|
imageOff: ImageOff,
|
|
680
1025
|
upload: Upload,
|
|
681
1026
|
view: Eye,
|
|
682
|
-
chevronDown: ChevronDown,
|
|
683
1027
|
chevronUp: ChevronUp,
|
|
1028
|
+
chevronDown: ChevronDown,
|
|
684
1029
|
chevronsUpDown: ChevronsUpDown,
|
|
685
1030
|
squareDashedMousePointer: SquareDashedMousePointer,
|
|
686
1031
|
search: Search,
|
|
@@ -693,6 +1038,7 @@ class JIconsService {
|
|
|
693
1038
|
prevPage: ChevronLeft,
|
|
694
1039
|
nextPage: ChevronRight,
|
|
695
1040
|
lastPage: ChevronsRight,
|
|
1041
|
+
arrowBigRight: ArrowBigRight,
|
|
696
1042
|
filter: Filter,
|
|
697
1043
|
filterList: ArrowDownWideNarrow,
|
|
698
1044
|
eraser: Eraser,
|
|
@@ -707,6 +1053,8 @@ class JIconsService {
|
|
|
707
1053
|
edit: Edit,
|
|
708
1054
|
delete: Trash,
|
|
709
1055
|
ellipsisVertical: EllipsisVertical,
|
|
1056
|
+
calendar: Calendar,
|
|
1057
|
+
clock: Clock,
|
|
710
1058
|
};
|
|
711
1059
|
constructor() { }
|
|
712
1060
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JIconsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -868,166 +1216,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
868
1216
|
}]
|
|
869
1217
|
}] });
|
|
870
1218
|
|
|
871
|
-
class JAlertToastService {
|
|
872
|
-
toastsSignal = signal([]);
|
|
873
|
-
autoCloseTimers = new Map();
|
|
874
|
-
// Default auto-close delay in milliseconds
|
|
875
|
-
DEFAULT_AUTO_CLOSE_DELAY = 5000;
|
|
876
|
-
// Default action button text
|
|
877
|
-
DEFAULT_ACTION_BUTTON_TEXT = "Action";
|
|
878
|
-
// For compatibility with existing code
|
|
879
|
-
isOpenSignal = signal(false);
|
|
880
|
-
configSignal = signal(null);
|
|
881
|
-
isLoadingAction = signal(false);
|
|
882
|
-
isLoadingCancel = signal(false);
|
|
883
|
-
// Computed values for all toasts
|
|
884
|
-
toasts = computed(() => this.toastsSignal());
|
|
885
|
-
// For backward compatibility with existing code
|
|
886
|
-
isOpen = computed(() => this.isOpenSignal());
|
|
887
|
-
config = computed(() => this.configSignal());
|
|
888
|
-
isActionLoading = computed(() => this.isLoadingAction());
|
|
889
|
-
isCancelLoading = computed(() => this.isLoadingCancel());
|
|
890
|
-
getConfig() {
|
|
891
|
-
return this.configSignal();
|
|
892
|
-
}
|
|
893
|
-
AlertToast(config) {
|
|
894
|
-
const toastId = crypto.randomUUID();
|
|
895
|
-
// Store callbacks for this toast
|
|
896
|
-
const onActionCallback = "onAction" in config ? config.onAction : undefined;
|
|
897
|
-
const onCancelCallback = "onCancel" in config ? config.onCancel : undefined;
|
|
898
|
-
// Get action button text or use default
|
|
899
|
-
const actionNameButton = config.actionButtonText ?? this.DEFAULT_ACTION_BUTTON_TEXT;
|
|
900
|
-
const toast = {
|
|
901
|
-
id: toastId,
|
|
902
|
-
config,
|
|
903
|
-
isActionLoading: false,
|
|
904
|
-
isCancelLoading: false,
|
|
905
|
-
onActionCallback,
|
|
906
|
-
onCancelCallback,
|
|
907
|
-
actionNameButton, // Add the button text
|
|
908
|
-
createdAt: Date.now()
|
|
909
|
-
};
|
|
910
|
-
// Add the toast to our list
|
|
911
|
-
this.toastsSignal.update(toasts => [...toasts, toast]);
|
|
912
|
-
// Check if this toast should auto-close
|
|
913
|
-
// If autoClose is explicitly set to true OR
|
|
914
|
-
// if it's a success toast and autoClose is not explicitly set to false
|
|
915
|
-
const shouldAutoClose = config.autoClose === true ||
|
|
916
|
-
(config.type === 'success' && config.autoClose !== false);
|
|
917
|
-
if (shouldAutoClose) {
|
|
918
|
-
// Use the provided delay or the default
|
|
919
|
-
const delay = config.autoCloseDelay ?? this.DEFAULT_AUTO_CLOSE_DELAY;
|
|
920
|
-
const timerId = setTimeout(() => {
|
|
921
|
-
this.closeToastById(toastId);
|
|
922
|
-
this.autoCloseTimers.delete(toastId);
|
|
923
|
-
}, delay);
|
|
924
|
-
this.autoCloseTimers.set(toastId, timerId);
|
|
925
|
-
}
|
|
926
|
-
return toastId;
|
|
927
|
-
}
|
|
928
|
-
closeToastById(toastId) {
|
|
929
|
-
// Clear any auto-close timer
|
|
930
|
-
if (this.autoCloseTimers.has(toastId)) {
|
|
931
|
-
clearTimeout(this.autoCloseTimers.get(toastId));
|
|
932
|
-
this.autoCloseTimers.delete(toastId);
|
|
933
|
-
}
|
|
934
|
-
this.toastsSignal.update(toasts => toasts.filter(toast => toast.id !== toastId));
|
|
935
|
-
}
|
|
936
|
-
closeAllToasts() {
|
|
937
|
-
// Clear all timers
|
|
938
|
-
this.autoCloseTimers.forEach(timerId => clearTimeout(timerId));
|
|
939
|
-
this.autoCloseTimers.clear();
|
|
940
|
-
this.toastsSignal.set([]);
|
|
941
|
-
}
|
|
942
|
-
async executeToastAction(toastId, action) {
|
|
943
|
-
const toast = this.toastsSignal().find(t => t.id === toastId);
|
|
944
|
-
if (!toast)
|
|
945
|
-
return;
|
|
946
|
-
let callback;
|
|
947
|
-
let loadingProperty;
|
|
948
|
-
switch (action) {
|
|
949
|
-
case "action":
|
|
950
|
-
callback = toast.onActionCallback;
|
|
951
|
-
loadingProperty = 'isActionLoading';
|
|
952
|
-
break;
|
|
953
|
-
case "cancel":
|
|
954
|
-
callback = toast.onCancelCallback;
|
|
955
|
-
loadingProperty = 'isCancelLoading';
|
|
956
|
-
break;
|
|
957
|
-
}
|
|
958
|
-
if (callback) {
|
|
959
|
-
// Update loading state
|
|
960
|
-
this.toastsSignal.update(toasts => toasts.map(t => t.id === toastId ? { ...t, [loadingProperty]: true } : t));
|
|
961
|
-
try {
|
|
962
|
-
await callback();
|
|
963
|
-
}
|
|
964
|
-
catch (error) {
|
|
965
|
-
console.error(`Error en la acción ${action}:`, error);
|
|
966
|
-
}
|
|
967
|
-
finally {
|
|
968
|
-
// Update loading state back to false (in case the toast hasn't been closed)
|
|
969
|
-
this.toastsSignal.update(toasts => {
|
|
970
|
-
const updatedToasts = toasts.map(t => t.id === toastId ? { ...t, [loadingProperty]: false } : t);
|
|
971
|
-
return updatedToasts;
|
|
972
|
-
});
|
|
973
|
-
this.closeToastById(toastId);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
else {
|
|
977
|
-
this.closeToastById(toastId);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
// For backward compatibility with existing code
|
|
981
|
-
closeToast() {
|
|
982
|
-
this.closeAllToasts();
|
|
983
|
-
this.isOpenSignal.set(false);
|
|
984
|
-
this.configSignal.set(null);
|
|
985
|
-
}
|
|
986
|
-
// For backward compatibility with existing code
|
|
987
|
-
async executeAction(action) {
|
|
988
|
-
let callback;
|
|
989
|
-
let loadingSignal;
|
|
990
|
-
switch (action) {
|
|
991
|
-
case "action":
|
|
992
|
-
callback = "onAction" in (this.configSignal() || {})
|
|
993
|
-
? this.configSignal().onAction
|
|
994
|
-
: undefined;
|
|
995
|
-
loadingSignal = this.isLoadingAction;
|
|
996
|
-
break;
|
|
997
|
-
case "cancel":
|
|
998
|
-
callback = "onCancel" in (this.configSignal() || {})
|
|
999
|
-
? this.configSignal().onCancel
|
|
1000
|
-
: undefined;
|
|
1001
|
-
loadingSignal = this.isLoadingCancel;
|
|
1002
|
-
break;
|
|
1003
|
-
}
|
|
1004
|
-
if (callback) {
|
|
1005
|
-
loadingSignal.set(true);
|
|
1006
|
-
try {
|
|
1007
|
-
await callback();
|
|
1008
|
-
}
|
|
1009
|
-
catch (error) {
|
|
1010
|
-
console.error(`Error en la acción ${action}:`, error);
|
|
1011
|
-
}
|
|
1012
|
-
finally {
|
|
1013
|
-
loadingSignal.set(false);
|
|
1014
|
-
this.closeToast();
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
else {
|
|
1018
|
-
this.closeToast();
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1022
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, providedIn: "root" });
|
|
1023
|
-
}
|
|
1024
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JAlertToastService, decorators: [{
|
|
1025
|
-
type: Injectable,
|
|
1026
|
-
args: [{
|
|
1027
|
-
providedIn: "root",
|
|
1028
|
-
}]
|
|
1029
|
-
}] });
|
|
1030
|
-
|
|
1031
1219
|
class JExcelService {
|
|
1032
1220
|
http;
|
|
1033
1221
|
converterService;
|
|
@@ -1698,5 +1886,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1698
1886
|
* Generated bundle index. Do not edit.
|
|
1699
1887
|
*/
|
|
1700
1888
|
|
|
1701
|
-
export { ErrorHandlerHttpService, JAlertDialogService, JAlertToastService, JCalendarService, JConverterCrudService, JExcelFilterService, JExcelService, JGenericCrudService, JIconsService, JParamsHttpService, JThemeService, JUploadFilterService, TAILJNG_CONFIG };
|
|
1889
|
+
export { ErrorHandlerHttpService, JAlertDialogService, JAlertToastService, JCalendarService, JConverterCrudService, JDialogShared, JExcelFilterService, JExcelService, JFormShared, JGenericCrudService, JIconsService, JParamsHttpService, JThemeService, JTransformService, JUploadFilterService, TAILJNG_CONFIG };
|
|
1702
1890
|
//# sourceMappingURL=tailjng.mjs.map
|