tailjng 0.0.35 → 0.0.37

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.
@@ -1,71 +1,95 @@
1
1
  // component-manager.js
2
2
 
3
- const fs = require("fs")
4
- const path = require("path")
5
- const { copyComponentFiles } = require("./file-operations")
6
- const { installDependencies } = require("./dependency-manager")
7
- const { COLORS } = require("./settings/colors")
3
+ const { copyComponentFiles } = require("./file-operations");
4
+ const { installDependencies } = require("./dependency-manager");
5
+ const { COLORS } = require("./settings/colors");
8
6
 
7
+ // Registro global para evitar re-instalaciones duplicadas
8
+ const installedComponentsGlobal = new Set();
9
+
10
+ /**
11
+ * Instala un componente individual y sus dependencias.
12
+ */
9
13
  async function addComponent(componentName, componentList) {
10
- const componentData = componentList[componentName]
11
- if (!componentData) {
12
- console.error(
13
- `${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}ERROR: Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.red}not found in the component list.${COLORS.reset}`,
14
- )
15
- process.exit(1)
16
- }
14
+ const componentData = componentList[componentName];
15
+ if (!componentData) {
16
+ console.error(
17
+ `${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}ERROR: Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.red}not found in the component list.${COLORS.reset}`
18
+ );
19
+ process.exit(1);
20
+ }
17
21
 
18
- console.log(`${COLORS.blue}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.blue}Adding component: ${COLORS.bright}"${componentName}"${COLORS.reset}`)
22
+ console.log(
23
+ `${COLORS.blue}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.blue}Adding component: ${COLORS.bright}"${componentName}"${COLORS.reset}`
24
+ );
19
25
 
20
- // Create a Set to track already processed components
21
- const installedComponents = new Set()
26
+ // Instalar dependencias primero
27
+ await installDependencies(componentData.dependencies, componentList, installedComponentsGlobal);
22
28
 
23
- // Install dependencies first to ensure they are available before the main component
24
- await installDependencies(componentData.dependencies, componentList, installedComponents)
29
+ // Si el componente principal ya fue procesado (como dependencia), saltarlo
30
+ if (installedComponentsGlobal.has(componentName)) {
31
+ console.log(
32
+ `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Main component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.dim}was already processed as a dependency.${COLORS.reset}`
33
+ );
34
+ return;
35
+ }
25
36
 
26
- // Check if the main component was already processed as a dependency
27
- if (!installedComponents.has(componentName)) {
28
- // Copy the main component files to the project
29
- const wasInstalled = await copyComponentFiles(componentName, componentData.path, false)
37
+ // Copiar los archivos del componente principal
38
+ const wasInstalled = await copyComponentFiles(componentName, componentData.path, false);
30
39
 
31
- if (wasInstalled) {
32
- console.log(
33
- `${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.greenBright}installed successfully.${COLORS.reset}`,
34
- )
35
- } else {
36
- console.log(
37
- `${COLORS.yellow}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.yellow}Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.yellow}installation was cancelled by user.${COLORS.reset}`,
38
- )
39
- }
40
- } else {
41
- console.log(
42
- `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Main component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.dim}was already processed as a dependency.${COLORS.reset}`,
43
- )
44
- }
45
- }
40
+ installedComponentsGlobal.add(componentName); // lo marcamos como instalado
46
41
 
42
+ if (wasInstalled) {
43
+ console.log(
44
+ `${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.greenBright}installed successfully.${COLORS.reset}`
45
+ );
46
+ } else {
47
+ console.log(
48
+ `${COLORS.yellow}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.yellow}Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.yellow}installation was cancelled by user.${COLORS.reset}`
49
+ );
50
+ }
51
+ }
47
52
 
53
+ /**
54
+ * Instala todos los componentes disponibles en la lista.
55
+ */
48
56
  async function installAllComponents(componentList) {
49
- console.log(`${COLORS.blue}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.blue}Installing all components...${COLORS.reset}`)
50
-
51
- const installedComponents = new Set()
52
-
53
- for (const componentName of Object.keys(componentList)) {
54
- if (!installedComponents.has(componentName)) {
55
- await installDependencies(componentList[componentName].dependencies, componentList, installedComponents)
56
-
57
- if (!installedComponents.has(componentName)) {
58
- const wasInstalled = await copyComponentFiles(componentName, componentList[componentName].path, false)
59
- if (wasInstalled) {
60
- console.log(`${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.greenBright}installed successfully.${COLORS.reset}`)
61
- } else {
62
- console.log(`${COLORS.yellow}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.yellow}Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.yellow}installation was skipped by user.${COLORS.reset}`)
63
- }
64
- }
65
- }
57
+ console.log(
58
+ `${COLORS.blue}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.blue}Installing all components...${COLORS.reset}`
59
+ );
60
+
61
+ for (const componentName of Object.keys(componentList)) {
62
+ const componentData = componentList[componentName];
63
+
64
+ // Evita duplicados
65
+ if (installedComponentsGlobal.has(componentName)) {
66
+ console.log(
67
+ `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Skipping already installed: ${COLORS.bright}"${componentName}"${COLORS.reset}`
68
+ );
69
+ continue;
70
+ }
71
+
72
+ // Instalar dependencias
73
+ await installDependencies(componentData.dependencies, componentList, installedComponentsGlobal);
74
+
75
+ // Instalar el componente principal
76
+ const wasInstalled = await copyComponentFiles(componentName, componentData.path, false);
77
+ installedComponentsGlobal.add(componentName);
78
+
79
+ if (wasInstalled) {
80
+ console.log(
81
+ `${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.greenBright}installed successfully.${COLORS.reset}`
82
+ );
83
+ } else {
84
+ console.log(
85
+ `${COLORS.yellow}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.yellow}Component ${COLORS.bright}"${componentName}"${COLORS.reset} ${COLORS.yellow}installation was skipped by user.${COLORS.reset}`
86
+ );
66
87
  }
88
+ }
67
89
 
68
- console.log(`${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ All components processed.${COLORS.reset}`)
90
+ console.log(
91
+ `${COLORS.greenBright}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.greenBright}✔ All components processed.${COLORS.reset}`
92
+ );
69
93
  }
70
94
 
71
- module.exports = { addComponent, installAllComponents }
95
+ module.exports = { addComponent, installAllComponents };
@@ -1,54 +1,71 @@
1
1
  // dependency-manager.js
2
+ const { copyComponentFiles } = require("./file-operations");
3
+ const { COLORS } = require("./settings/colors");
2
4
 
3
- const { copyComponentFiles } = require("./file-operations")
4
- const { COLORS } = require("./settings/colors")
5
-
5
+ /**
6
+ * Instala recursivamente dependencias de componentes,
7
+ * evitando re-instalar o re-actualizar los mismos componentes.
8
+ */
6
9
  async function installDependencies(dependencies = [], componentList, installedComponents = new Set()) {
7
- if (dependencies.length === 0) {
8
- console.log(`${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}No dependencies to install.${COLORS.reset}`)
9
- return
10
+ if (!dependencies || dependencies.length === 0) {
11
+ console.log(
12
+ `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}No dependencies to install.${COLORS.reset}`
13
+ );
14
+ return;
10
15
  }
11
16
 
12
17
  for (const dep of dependencies) {
13
- // Avoid infinite loops by checking if the component was already processed
18
+ // Evita duplicados y bucles
14
19
  if (installedComponents.has(dep)) {
15
- console.log(`${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Component ${COLORS.bright}"${dep}"${COLORS.reset} ${COLORS.dim}already processed, skipping.${COLORS.reset}`)
16
- continue
20
+ console.log(
21
+ `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Component ${COLORS.bright}"${dep}"${COLORS.reset} ${COLORS.dim}already processed, skipping.${COLORS.reset}`
22
+ );
23
+ continue;
17
24
  }
18
25
 
19
- const depComponentData = componentList[dep]
26
+ const depComponentData = componentList[dep];
20
27
  if (!depComponentData) {
21
28
  console.error(
22
- `${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}ERROR: Dependency component ${COLORS.bright}"${dep}" ${COLORS.red}not found in the component list.${COLORS.reset}`,
23
- )
24
- process.exit(1)
29
+ `${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}ERROR: Dependency component ${COLORS.bright}"${dep}"${COLORS.red} not found in the component list.${COLORS.reset}`
30
+ );
31
+ process.exit(1);
25
32
  }
26
33
 
27
- console.log(`${COLORS.magenta}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.magenta}Installing dependency component: ${COLORS.bright}"${dep}"${COLORS.reset}`)
34
+ // Marca como instalado antes de procesarlo (previene loops circulares)
35
+ installedComponents.add(dep);
28
36
 
29
- // Mark as processed before installing to avoid infinite loops
30
- installedComponents.add(dep)
37
+ console.log(
38
+ `${COLORS.magenta}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.magenta}Installing dependency: ${COLORS.bright}"${dep}"${COLORS.reset}`
39
+ );
31
40
 
32
- // Install recursively the dependencies of this dependency
41
+ // Instalar dependencias internas del dependency
33
42
  if (depComponentData.dependencies && depComponentData.dependencies.length > 0) {
34
- await installDependencies(depComponentData.dependencies, componentList, installedComponents)
43
+ await installDependencies(depComponentData.dependencies, componentList, installedComponents);
35
44
  }
36
45
 
37
- // Copy the dependent component files
46
+ // Copiar los archivos del componente
38
47
  try {
39
- const wasInstalled = await copyComponentFiles(dep, depComponentData.path, true)
48
+ const wasInstalled = await copyComponentFiles(dep, depComponentData.path, true);
40
49
 
41
50
  if (wasInstalled) {
42
- console.log(`${COLORS.green}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.green}Successfully installed dependency: ${COLORS.bright}"${dep}"${COLORS.reset}`)
51
+ console.log(
52
+ `${COLORS.green}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.green}Successfully installed dependency: ${COLORS.bright}"${dep}"${COLORS.reset}`
53
+ );
43
54
  } else {
44
- console.log(`${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Dependency ${COLORS.bright}"${dep}"${COLORS.reset} ${COLORS.dim}was skipped by user choice.${COLORS.reset}`)
55
+ console.log(
56
+ `${COLORS.dim}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.dim}Dependency ${COLORS.bright}"${dep}"${COLORS.reset} ${COLORS.dim}was skipped by user choice.${COLORS.reset}`
57
+ );
45
58
  }
46
59
  } catch (err) {
47
- console.error(`${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}Failed to install dependency component: ${COLORS.bright}"${dep}"${COLORS.reset}`)
48
- console.error(`${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}Error details:${COLORS.reset}`, err)
49
- process.exit(1)
60
+ console.error(
61
+ `${COLORS.red}${COLORS.bright}[tailjng CLI]${COLORS.reset} ${COLORS.red}Failed to install dependency: ${COLORS.bright}"${dep}"${COLORS.reset}`
62
+ );
63
+ console.error(`${COLORS.red}Error details:${COLORS.reset}`, err);
64
+ process.exit(1);
50
65
  }
51
66
  }
67
+
68
+ return installedComponents;
52
69
  }
53
70
 
54
- module.exports = { installDependencies }
71
+ module.exports = { installDependencies };
@@ -18,7 +18,7 @@ Purpose:
18
18
 
19
19
  Usage:
20
20
  To access full functionality, simply import the necessary modules and use the
21
- components according to your use case. Be sure to review the official documentation for detailed examples
21
+ components according to your use case. Be sure to review the official documentation for detailed examples
22
22
  on implementation and customization.
23
23
 
24
24
  Authors:
@@ -27,7 +27,7 @@ Authors:
27
27
  License:
28
28
  This project is licensed under the BSD 3-Clause - see the LICENSE file for more details.
29
29
 
30
- Version: 0.0.35
30
+ Version: 0.0.37
31
31
  Creation Date: 2025-01-04
32
32
  ===============================================`
33
33
 
@@ -6,7 +6,7 @@ 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 { 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';
9
+ import { Clock, Calendar, EllipsisVertical, Trash, Edit, Pencil, PencilLine, ListRestart, FileUp, Download, 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';
@@ -282,6 +282,21 @@ class JFormShared {
282
282
  const adjustedDate = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
283
283
  return adjustedDate.toISOString().split('T')[0];
284
284
  }
285
+ /**
286
+ * Get invalid controls in the form group
287
+ * @returns
288
+ */
289
+ getInvalidControls(formGroup) {
290
+ const invalidControls = [];
291
+ Object.keys(formGroup.controls).forEach((controlName) => {
292
+ const control = formGroup.get(controlName);
293
+ if (control && control.invalid && control.touched) {
294
+ invalidControls.push(controlName);
295
+ console.error(`${controlName} es inválido. Errores:`, control.errors);
296
+ }
297
+ });
298
+ return invalidControls;
299
+ }
285
300
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFormShared, deps: [{ token: JAlertToastService }], target: i0.ɵɵFactoryTarget.Injectable });
286
301
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JFormShared, providedIn: 'root' });
287
302
  }
@@ -1055,6 +1070,7 @@ class JIconsService {
1055
1070
  default: Cpu,
1056
1071
  fileSpreadsheet: FileSpreadsheet,
1057
1072
  monitorUp: MonitorUp,
1073
+ download: Download,
1058
1074
  fileUp: FileUp,
1059
1075
  listRestart: ListRestart,
1060
1076
  editRowLine: PencilLine,