tailjng 0.0.43 → 0.0.45

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.
Files changed (24) hide show
  1. package/cli/settings/components-list.js +1 -1
  2. package/cli/settings/header-generator.js +1 -1
  3. package/fesm2022/tailjng.mjs +200 -103
  4. package/fesm2022/tailjng.mjs.map +1 -1
  5. package/lib/interfaces/crud/filter.interface.d.ts +3 -0
  6. package/lib/services/crud/converter-crud.service.d.ts +3 -5
  7. package/lib/services/static/icons.service.d.ts +1 -0
  8. package/lib/services/transformer/transform.service.d.ts +86 -0
  9. package/package.json +2 -2
  10. package/src/lib/components/badge/badge.component.html +2 -2
  11. package/src/lib/components/badge/badge.component.ts +1 -1
  12. package/src/lib/components/card/card-crud-complete/complete-crud-card.component.html +16 -14
  13. package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +20 -5
  14. package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +2 -2
  15. package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +5 -1
  16. package/src/lib/components/filter/filter-complete/complete-filter.component.html +2 -2
  17. package/src/lib/components/input/input-file/file-input.component.html +18 -5
  18. package/src/lib/components/input/input-file/file-input.component.ts +86 -7
  19. package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +30 -8
  20. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +93 -83
  21. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +188 -64
  22. package/src/lib/components/table/table-complete/complete-table.component.html +2 -3
  23. package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +4 -4
  24. package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +10 -6
@@ -32,7 +32,7 @@ function getComponentList() {
32
32
  },
33
33
  'checkbox-input': {
34
34
  path: "src/lib/components/checkbox/checkbox-input",
35
- dependencies: ["color"],
35
+ dependencies: ["tooltip", "color"],
36
36
  },
37
37
  'checkbox-switch': {
38
38
  path: "src/lib/components/checkbox/checkbox-switch",
@@ -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.43
30
+ Version: 0.0.45
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 { CircleAlert, 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';
9
+ import { Clipboard, CircleAlert, 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';
@@ -424,7 +424,7 @@ class JCalendarService {
424
424
  const utc_date = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
425
425
  let new_date = utc_date;
426
426
  const año = new_date.getUTCFullYear();
427
- const mes = new_date.getUTCMonth();
427
+ const mes = new_date.getUTCMonth() + 1;
428
428
  const día = new_date.getUTCDate();
429
429
  const díaFormateado = día < 10 ? `0${día}` : día.toString();
430
430
  const mesFormateado = mes < 10 ? `0${mes}` : mes.toString();
@@ -598,13 +598,188 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
598
598
  }]
599
599
  }] });
600
600
 
601
- class JConverterCrudService {
601
+ class JTransformService {
602
602
  currencyPipe;
603
603
  calendarService;
604
604
  constructor(currencyPipe, calendarService) {
605
605
  this.currencyPipe = currencyPipe;
606
606
  this.calendarService = calendarService;
607
607
  }
608
+ /**
609
+ * Verify if the value is a valid JSON string.
610
+ * @param value
611
+ * @returns
612
+ */
613
+ isJson(value) {
614
+ try {
615
+ JSON.parse(value);
616
+ return true;
617
+ }
618
+ catch (e) {
619
+ return false;
620
+ }
621
+ }
622
+ /**
623
+ * Parse a JSON string and return the array.
624
+ * @param value The JSON string to parse.
625
+ * @returns The parsed array.
626
+ */
627
+ parseJson(value) {
628
+ return JSON.parse(value);
629
+ }
630
+ /**
631
+ * Capitalize the first letter of each word and lowercase the rest.
632
+ * @param name The input string to capitalize.
633
+ * @returns The capitalized string.
634
+ */
635
+ capitalizeText(name) {
636
+ return name
637
+ .trim()
638
+ .toLowerCase()
639
+ .split(' ')
640
+ .filter(Boolean)
641
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
642
+ .join(' ');
643
+ }
644
+ /**
645
+ * Format a number as currency.
646
+ * @param value
647
+ * @param currency
648
+ * @returns
649
+ */
650
+ formatCurrency(value, currency) {
651
+ const transformedValue = this.currencyPipe.transform(value, currency, 'symbol', '1.2-2');
652
+ return transformedValue ? transformedValue.replace('US', '') : null;
653
+ }
654
+ /**
655
+ * Format a date to DMY format.
656
+ * @param value
657
+ * @returns
658
+ */
659
+ formatDate(value) {
660
+ return this.calendarService.formatDateStringToDMY(`${value}`);
661
+ }
662
+ /**
663
+ * Format a date to long format.
664
+ * @param value
665
+ * @returns
666
+ */
667
+ formatDateText(value) {
668
+ return this.calendarService.formatDateStringToLong(`${value}`);
669
+ }
670
+ /**
671
+ * Format a date-time to locale string.
672
+ * @param value
673
+ * @returns
674
+ */
675
+ formatDateTime(value) {
676
+ return new Date(value).toLocaleString();
677
+ }
678
+ /**
679
+ * Format a date-time to string.
680
+ * @param value
681
+ * @returns
682
+ */
683
+ formatDateTimeText(value) {
684
+ return new Date(value).toString();
685
+ }
686
+ /**
687
+ * Format a value to relative time.
688
+ * @param value
689
+ * @returns
690
+ */
691
+ formatRelativeTime(value) {
692
+ return this.calendarService.formatRelativeDate(value);
693
+ }
694
+ /**
695
+ * Format to get the first word of a string.
696
+ * @param value
697
+ * @returns
698
+ */
699
+ formatFirstWord(value) {
700
+ return value.split(' ')[0];
701
+ }
702
+ /**
703
+ * Format a phone number to Ecuadorian format.
704
+ * @param value
705
+ * @returns
706
+ */
707
+ formatPhoneEcuadorian(value) {
708
+ if (value.startsWith('+593')) {
709
+ const restOfNumber = value.slice(4);
710
+ return `+593 ${restOfNumber}`;
711
+ }
712
+ if (value.startsWith('0')) {
713
+ return `+593 ${value.replace(/^0/, '')}`;
714
+ }
715
+ if (value.startsWith('9')) {
716
+ return `+593 ${value}`;
717
+ }
718
+ return value;
719
+ }
720
+ /**
721
+ * Clean value based on the column type.
722
+ * @param value
723
+ * @param column
724
+ * @returns
725
+ */
726
+ cleanValue(value, column) {
727
+ let cleaned = value;
728
+ if (typeof cleaned === 'string') {
729
+ cleaned = cleaned.trim();
730
+ }
731
+ return cleaned;
732
+ }
733
+ /**
734
+ * Parse a currency string to number.
735
+ * @param value
736
+ * @returns
737
+ */
738
+ parseCurrency(value) {
739
+ return value ? parseFloat(value.replace(/[^\d,.-]/g, '').replace(',', '.')) : null;
740
+ }
741
+ /**
742
+ * Parse a date text to ISO format.
743
+ * @param value
744
+ * @returns
745
+ */
746
+ parseDateText(value) {
747
+ const parsedDate = this.calendarService.parseDateString(value);
748
+ return parsedDate ?? value;
749
+ }
750
+ /**
751
+ * Parse a date to ISO format.
752
+ * @param value
753
+ * @returns
754
+ */
755
+ parseDate(value) {
756
+ const date = new Date(value);
757
+ return isNaN(date.getTime()) ? value : date.toISOString().substring(0, 10);
758
+ }
759
+ /**
760
+ * Parse a date-time to ISO format.
761
+ * @param value
762
+ * @returns
763
+ */
764
+ parseDateTime(value) {
765
+ const date = new Date(value);
766
+ return isNaN(date.getTime()) ? value : date.toISOString();
767
+ }
768
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, deps: [{ token: i1.CurrencyPipe }, { token: JCalendarService }], target: i0.ɵɵFactoryTarget.Injectable });
769
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, providedIn: 'root' });
770
+ }
771
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, decorators: [{
772
+ type: Injectable,
773
+ args: [{
774
+ providedIn: 'root'
775
+ }]
776
+ }], ctorParameters: () => [{ type: i1.CurrencyPipe }, { type: JCalendarService }] });
777
+
778
+ class JConverterCrudService {
779
+ transformService;
780
+ constructor(transformService) {
781
+ this.transformService = transformService;
782
+ }
608
783
  /**
609
784
  * Get the correct sort key from the sortColumn object or string.
610
785
  * @param sortColumn The column to sort by, can be a string or an object with a 'col' property.
@@ -636,45 +811,31 @@ class JConverterCrudService {
636
811
  */
637
812
  formatData(value, column) {
638
813
  if (column.isdollar && value !== null) {
639
- const transformedValue = this.currencyPipe.transform(value, 'USD', 'symbol', '1.2-2');
640
- return transformedValue ? transformedValue.replace('US', '') : null;
814
+ return this.transformService.formatCurrency(value, 'USD');
641
815
  }
642
816
  if (column.isCurrency && value !== null) {
643
- return this.currencyPipe.transform(value, 'USD', 'symbol', '1.2-2');
817
+ return this.transformService.formatCurrency(value, 'USD');
644
818
  }
645
819
  if (column.isDate && value !== null) {
646
- return this.calendarService.formatDateStringToDMY(`${value}`);
820
+ return this.transformService.formatDate(value);
647
821
  }
648
822
  if (column.isDateText && value !== null) {
649
- return this.calendarService.formatDateStringToLong(`${value}`);
823
+ return this.transformService.formatDateText(value);
650
824
  }
651
825
  if (column.isDateTime && value !== null) {
652
- return new Date(value).toLocaleString();
826
+ return this.transformService.formatDateTime(value);
653
827
  }
654
828
  if (column.isDateTimeText && value !== null) {
655
- return new Date(value).toString();
829
+ return this.transformService.formatDateTimeText(value);
656
830
  }
657
831
  if (column.isRelativeTime && value !== null) {
658
- return this.calendarService.formatRelativeDate(value);
832
+ return this.transformService.formatRelativeTime(value);
659
833
  }
660
834
  if (column.isFirstWord && value !== null) {
661
- return value.split(' ')[0];
835
+ return this.transformService.formatFirstWord(value);
662
836
  }
663
837
  if (column.isPhoneEcuadorian && value !== null) {
664
- // Si el número ya empieza con +593
665
- if (value.startsWith('+593')) {
666
- const restOfNumber = value.slice(4);
667
- return `+593 ${restOfNumber}`;
668
- }
669
- // Si el número empieza con 0, reemplazar el 0 por +593
670
- if (value.startsWith('0')) {
671
- return `+593 ${value.replace(/^0/, '')}`;
672
- }
673
- // Si el número empieza con 9 (y no tiene +593), agregar +593 al principio
674
- if (value.startsWith('9')) {
675
- return `+593 ${value}`;
676
- }
677
- return value;
838
+ return this.transformService.formatPhoneEcuadorian(value);
678
839
  }
679
840
  // Si no se aplica ningún formato, retornar el valor original
680
841
  return value;
@@ -690,43 +851,25 @@ class JConverterCrudService {
690
851
  if (value === null || value === undefined || value === 'S/N') {
691
852
  return null;
692
853
  }
693
- let cleaned = value;
694
- if (typeof cleaned === 'string') {
695
- cleaned = cleaned.trim();
696
- }
697
- if (column.isdollar && typeof cleaned === 'string') {
698
- cleaned = cleaned.replace(/[^\d,.-]/g, '').replace(',', '.');
699
- return cleaned ? parseFloat(cleaned) : null;
700
- }
701
- if (column.isCurrency && typeof cleaned === 'string') {
702
- cleaned = cleaned.replace(/[^\d,.-]/g, '').replace(',', '.');
703
- return cleaned ? parseFloat(cleaned) : null;
854
+ let cleaned = this.transformService.cleanValue(value, column);
855
+ if (column.isdollar || column.isCurrency) {
856
+ return this.transformService.parseCurrency(cleaned);
704
857
  }
705
- if (column.isDateText && typeof cleaned === 'string') {
706
- const fecha = this.calendarService.parseDateString(cleaned);
707
- return fecha ?? cleaned;
858
+ if (column.isDateText) {
859
+ return this.transformService.parseDateText(cleaned);
708
860
  }
709
- if (column.isDate && typeof cleaned === 'string') {
710
- const fecha = new Date(cleaned);
711
- return isNaN(fecha.getTime()) ? cleaned : fecha.toISOString().substring(0, 10);
861
+ if (column.isDate) {
862
+ return this.transformService.parseDate(cleaned);
712
863
  }
713
- if (column.isDateTime && typeof cleaned === 'string') {
714
- const fecha = new Date(cleaned);
715
- return isNaN(fecha.getTime()) ? cleaned : fecha.toISOString();
864
+ if (column.isDateTime || column.isDateTimeText) {
865
+ return this.transformService.parseDateTime(cleaned);
716
866
  }
717
- if (column.isDateTimeText && typeof cleaned === 'string') {
718
- const fecha = new Date(cleaned);
719
- return isNaN(fecha.getTime()) ? cleaned : fecha.toISOString();
720
- }
721
- if (column.isRelativeTime) {
722
- return cleaned;
723
- }
724
- if (column.isFirstWord) {
867
+ if (column.isRelativeTime || column.isFirstWord) {
725
868
  return cleaned;
726
869
  }
727
870
  return cleaned;
728
871
  }
729
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JConverterCrudService, deps: [{ token: i1.CurrencyPipe }, { token: JCalendarService }], target: i0.ɵɵFactoryTarget.Injectable });
872
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JConverterCrudService, deps: [{ token: JTransformService }], target: i0.ɵɵFactoryTarget.Injectable });
730
873
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JConverterCrudService, providedIn: 'root' });
731
874
  }
732
875
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JConverterCrudService, decorators: [{
@@ -734,7 +877,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
734
877
  args: [{
735
878
  providedIn: 'root'
736
879
  }]
737
- }], ctorParameters: () => [{ type: i1.CurrencyPipe }, { type: JCalendarService }] });
880
+ }], ctorParameters: () => [{ type: JTransformService }] });
738
881
 
739
882
  class JParamsHttpService {
740
883
  /**
@@ -985,53 +1128,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
985
1128
  }]
986
1129
  }] });
987
1130
 
988
- class JTransformService {
989
- /**
990
- * Verify if the value is a valid JSON string.
991
- * @param value
992
- * @returns
993
- */
994
- isJson(value) {
995
- try {
996
- JSON.parse(value);
997
- return true;
998
- }
999
- catch (e) {
1000
- return false;
1001
- }
1002
- }
1003
- /**
1004
- * Parse a JSON string and return the array.
1005
- * @param value The JSON string to parse.
1006
- * @returns The parsed array.
1007
- */
1008
- parseJson(value) {
1009
- return JSON.parse(value);
1010
- }
1011
- /**
1012
- * Capitalize the first letter of each word and lowercase the rest.
1013
- * @param name The input string to capitalize.
1014
- * @returns The capitalized string.
1015
- */
1016
- capitalizeText(name) {
1017
- return name
1018
- .trim()
1019
- .toLowerCase()
1020
- .split(' ')
1021
- .filter(Boolean)
1022
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
1023
- .join(' ');
1024
- }
1025
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1026
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, providedIn: 'root' });
1027
- }
1028
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JTransformService, decorators: [{
1029
- type: Injectable,
1030
- args: [{
1031
- providedIn: 'root'
1032
- }]
1033
- }] });
1034
-
1035
1131
  class JIconsService {
1036
1132
  icons = {
1037
1133
  info: Info,
@@ -1086,6 +1182,7 @@ class JIconsService {
1086
1182
  calendar: Calendar,
1087
1183
  clock: Clock,
1088
1184
  circleAlert: CircleAlert,
1185
+ clipboard: Clipboard,
1089
1186
  };
1090
1187
  constructor() { }
1091
1188
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JIconsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });