ngx-sp-infra 5.2.10 → 5.2.12

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.
@@ -4774,13 +4774,13 @@ class OrderingComponent {
4774
4774
  }
4775
4775
  // #region ==========> UTILS <==========
4776
4776
  /** Chamada quando o botão de ordenação é clicado */
4777
- emitSort() {
4777
+ emitSort(direction) {
4778
4778
  // Inverte a direção de ordenação atual
4779
- this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
4779
+ this.sortDirection = direction;
4780
4780
  // Emite o evento com a nova direção de ordenação
4781
4781
  this.sortDirectionChange.emit(this.sortDirection);
4782
4782
  // Emite o evento de mudança na ordenação com a direção e os atributos de ordenação
4783
- this.sortChange.emit({ direction: this.sortDirection, column: this.sortAttributes });
4783
+ this.sortChange.emit({ direction: direction, column: this.sortAttributes });
4784
4784
  }
4785
4785
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: OrderingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4786
4786
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: OrderingComponent, isStandalone: true, selector: "app-ordering, lib-ordering", inputs: { sortDirection: "sortDirection", sortAttributes: "sortAttributes" }, outputs: { sortDirectionChange: "sortDirectionChange", sortChange: "sortChange" }, ngImport: i0, template: `
@@ -4788,17 +4788,17 @@ class OrderingComponent {
4788
4788
  @case ('asc') {
4789
4789
  <lib-icon tooltip="Crescente" class="glb-cursor-pointer"
4790
4790
  iconName="seta-cima" iconColor="blue"
4791
- [iconSize]="20" (click)="emitSort()" />
4791
+ [iconSize]="20" (click)="emitSort('desc')" />
4792
4792
  }
4793
4793
  @case ('desc') {
4794
4794
  <lib-icon tooltip="Decrescente" class="glb-cursor-pointer"
4795
- iconName="seta-baixo" iconColor="blue"
4796
- [iconSize]="20" (click)="emitSort()" />
4795
+ iconName="seta-baixo" iconColor="blue"
4796
+ [iconSize]="20" (click)="emitSort('asc')" />
4797
4797
  }
4798
4798
  @default {
4799
4799
  <lib-icon tooltip="Sem ordenação aplicada" class="glb-cursor-pointer"
4800
- iconName="cimabaixo" iconColor="gray"
4801
- [iconSize]="20" (click)="emitSort()" />
4800
+ iconName="cimabaixo" iconColor="gray"
4801
+ [iconSize]="20" (click)="emitSort('asc')" />
4802
4802
  }
4803
4803
  }
4804
4804
  `, isInline: true, styles: [""], dependencies: [{ kind: "component", type: LibIconsComponent, selector: "lib-icon", inputs: ["iconName", "iconColor", "iconSize", "iconFill"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i1$3.TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }] }); }
@@ -4810,17 +4810,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
4810
4810
  @case ('asc') {
4811
4811
  <lib-icon tooltip="Crescente" class="glb-cursor-pointer"
4812
4812
  iconName="seta-cima" iconColor="blue"
4813
- [iconSize]="20" (click)="emitSort()" />
4813
+ [iconSize]="20" (click)="emitSort('desc')" />
4814
4814
  }
4815
4815
  @case ('desc') {
4816
4816
  <lib-icon tooltip="Decrescente" class="glb-cursor-pointer"
4817
- iconName="seta-baixo" iconColor="blue"
4818
- [iconSize]="20" (click)="emitSort()" />
4817
+ iconName="seta-baixo" iconColor="blue"
4818
+ [iconSize]="20" (click)="emitSort('asc')" />
4819
4819
  }
4820
4820
  @default {
4821
4821
  <lib-icon tooltip="Sem ordenação aplicada" class="glb-cursor-pointer"
4822
- iconName="cimabaixo" iconColor="gray"
4823
- [iconSize]="20" (click)="emitSort()" />
4822
+ iconName="cimabaixo" iconColor="gray"
4823
+ [iconSize]="20" (click)="emitSort('asc')" />
4824
4824
  }
4825
4825
  }
4826
4826
  ` }]
@@ -5501,6 +5501,38 @@ class Utils {
5501
5501
  }
5502
5502
  return 0;
5503
5503
  }
5504
+ /** Método de ordenação alfanumérico com possibilidade de direção */
5505
+ static alphanumericSortOld(a, b, direction = 'asc') {
5506
+ const regex = /(\d+|\D+)/g;
5507
+ const stringA = this.propertyIsNullUndefinedOrEmpty(a) ? "" : a;
5508
+ const stringB = this.propertyIsNullUndefinedOrEmpty(b) ? "" : b;
5509
+ const aParts = stringA.toString().match(regex) || [];
5510
+ const bParts = stringB.toString().match(regex) || [];
5511
+ const length = Math.max(aParts.length, bParts.length);
5512
+ for (let i = 0; i < length; i++) {
5513
+ const aPart = aParts[i] || "";
5514
+ const bPart = bParts[i] || "";
5515
+ const aIsNumber = !isNaN(Number(aPart));
5516
+ const bIsNumber = !isNaN(Number(bPart));
5517
+ if (aIsNumber && bIsNumber) {
5518
+ const numCompare = Number(aPart) - Number(bPart);
5519
+ if (numCompare !== 0)
5520
+ return direction === 'asc' ? numCompare : -numCompare;
5521
+ }
5522
+ else if (aIsNumber) {
5523
+ return direction === 'asc' ? -1 : 1;
5524
+ }
5525
+ else if (bIsNumber) {
5526
+ return direction === 'asc' ? 1 : -1;
5527
+ }
5528
+ else {
5529
+ const strCompare = aPart.localeCompare(bPart);
5530
+ if (strCompare !== 0)
5531
+ return direction === 'asc' ? strCompare : -strCompare;
5532
+ }
5533
+ }
5534
+ return 0;
5535
+ }
5504
5536
  // #endregion ORDENAÇÃO
5505
5537
  // #region ==========> VALIDAÇÕES DE VAZIO <==========
5506
5538
  /** Retorna se a variável informada é === null || undefined || "" (string vazia) */
@@ -6055,7 +6087,7 @@ class TableComponent {
6055
6087
  recordsList.sort((a, b) => {
6056
6088
  const propertyA = this.getProperty(a, attribute).toUpperCase(); // Puxa o nome da coluna que irá ordenar
6057
6089
  const propertyB = this.getProperty(b, attribute).toUpperCase(); // Puxa o nome da coluna que irá ordenar
6058
- return Utils.alphanumericSort(propertyA, propertyB, this.sortDirection[attribute]);
6090
+ return Utils.alphanumericSortOld(propertyA, propertyB, this.sortDirection[attribute]);
6059
6091
  });
6060
6092
  }
6061
6093
  }
@@ -7626,7 +7658,7 @@ class LibTransferListComponent {
7626
7658
  atualizarSelecoes(origem, destino, origemConfig, origemSelecionados, componenteOrigem, componenteDestino) {
7627
7659
  origemSelecionados.forEach(item => destino.push(item));
7628
7660
  // destino = [ ...origemSelecionados ];
7629
- destino.sort((a, b) => Utils.alphanumericSort(a.ID, b.ID));
7661
+ destino.sort((a, b) => Utils.alphanumericSortOld(a.ID, b.ID));
7630
7662
  origemSelecionados.forEach(selectedItem => {
7631
7663
  const index = origem.findIndex(item => item === selectedItem);
7632
7664
  if (index !== -1)
@@ -8778,7 +8810,7 @@ class LibCustomizableTableComponent {
8778
8810
  this.list.sort((a, b) => {
8779
8811
  const propertyA = this.getProperty(a, attribute).toUpperCase();
8780
8812
  const propertyB = this.getProperty(b, attribute).toUpperCase();
8781
- return Utils.alphanumericSort(propertyA, propertyB, this.sortDirection[attribute]);
8813
+ return Utils.alphanumericSortOld(propertyA, propertyB, this.sortDirection[attribute]);
8782
8814
  });
8783
8815
  }
8784
8816
  /** Compara os valores das propriedades entre dois objetos */