@gipisistemas/ngx-core 1.0.19 → 1.0.20
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.
|
@@ -18,6 +18,7 @@ import * as libPhone from 'libphonenumber-js';
|
|
|
18
18
|
import * as i2 from '@angular/material/icon';
|
|
19
19
|
import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
|
|
20
20
|
import { HttpClient, HttpHeaders, HttpParams, HttpErrorResponse } from '@angular/common/http';
|
|
21
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
21
22
|
import { coerceBooleanProperty, coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
22
23
|
import * as i1$4 from '@angular/forms';
|
|
23
24
|
import { NG_VALUE_ACCESSOR, FormsModule, NgControl } from '@angular/forms';
|
|
@@ -45,7 +46,6 @@ import { MatPaginatorIntl, MatPaginatorModule, MatPaginator } from '@angular/mat
|
|
|
45
46
|
import { GlobalWorkerOptions, getDocument, OPS } from 'pdfjs-dist';
|
|
46
47
|
import { EventBus, PDFLinkService, PDFViewer } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
47
48
|
import { __decorate } from 'tslib';
|
|
48
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
49
49
|
import * as i2$4 from '@angular/cdk/table';
|
|
50
50
|
import { CdkTableModule } from '@angular/cdk/table';
|
|
51
51
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
@@ -5174,6 +5174,9 @@ function useFilterPersistence(config) {
|
|
|
5174
5174
|
}
|
|
5175
5175
|
|
|
5176
5176
|
class BaseListComponent extends BaseComponent {
|
|
5177
|
+
get idsSelectedEntities() {
|
|
5178
|
+
return this.selectedEntities.selected.map((entity) => entity.id);
|
|
5179
|
+
}
|
|
5177
5180
|
constructor(service) {
|
|
5178
5181
|
super();
|
|
5179
5182
|
this.service = service;
|
|
@@ -5181,6 +5184,7 @@ class BaseListComponent extends BaseComponent {
|
|
|
5181
5184
|
this.pageAdjustService = inject(PageAdjustService);
|
|
5182
5185
|
this._isHydrating = signal(true, ...(ngDevMode ? [{ debugName: "_isHydrating" }] : []));
|
|
5183
5186
|
this._persistTimer = null;
|
|
5187
|
+
this.selectedEntities = new SelectionModel(true, []);
|
|
5184
5188
|
this.filter = signal(this.newFilter(), ...(ngDevMode ? [{ debugName: "filter" }] : []));
|
|
5185
5189
|
this.page = signal(this.newPage(), ...(ngDevMode ? [{ debugName: "page" }] : []));
|
|
5186
5190
|
this.tableColumns = signal([], ...(ngDevMode ? [{ debugName: "tableColumns" }] : []));
|
|
@@ -5643,18 +5647,11 @@ class BaseListComponent extends BaseComponent {
|
|
|
5643
5647
|
this.findAll();
|
|
5644
5648
|
}
|
|
5645
5649
|
handleEntityId(id) {
|
|
5646
|
-
if (!UUIDUtil.isValid(id)) {
|
|
5650
|
+
if (!UUIDUtil.isEmpty(id) && !UUIDUtil.isValid(id) && this.selectedEntities.isEmpty()) {
|
|
5647
5651
|
throw new Error('O identificador do registro não é válido');
|
|
5648
5652
|
}
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
!ObjectUtil.isEmpty(page) &&
|
|
5652
|
-
!ArrayUtil.isEmpty(page.content)) {
|
|
5653
|
-
const firstSeletected = page.content.filter((c) => c.selected)[0];
|
|
5654
|
-
if (ObjectUtil.isEmpty(firstSeletected)) {
|
|
5655
|
-
return null;
|
|
5656
|
-
}
|
|
5657
|
-
return firstSeletected.id;
|
|
5653
|
+
if (UUIDUtil.isEmpty(id) && !ArrayUtil.isEmpty(this.page()?.content)) {
|
|
5654
|
+
return this.idsSelectedEntities[0] ?? null;
|
|
5658
5655
|
}
|
|
5659
5656
|
return id;
|
|
5660
5657
|
}
|
|
@@ -5666,14 +5663,8 @@ class BaseListComponent extends BaseComponent {
|
|
|
5666
5663
|
}
|
|
5667
5664
|
}
|
|
5668
5665
|
}
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
!ObjectUtil.isEmpty(page) &&
|
|
5672
|
-
!ArrayUtil.isEmpty(page.content)) {
|
|
5673
|
-
const listSelected = page.content
|
|
5674
|
-
.filter((p) => p.selected)
|
|
5675
|
-
.map((p) => p.id);
|
|
5676
|
-
return listSelected;
|
|
5666
|
+
if (ArrayUtil.isEmpty(idList) && !ArrayUtil.isEmpty(this.page()?.content)) {
|
|
5667
|
+
return this.idsSelectedEntities;
|
|
5677
5668
|
}
|
|
5678
5669
|
return !ArrayUtil.isEmpty(idList) ? idList : [];
|
|
5679
5670
|
}
|
|
@@ -5927,7 +5918,6 @@ class BaseModel {
|
|
|
5927
5918
|
this.enabled = data?.enabled ?? true;
|
|
5928
5919
|
this.createdDate = data?.createdDate ?? null;
|
|
5929
5920
|
this.modifiedDate = data?.modifiedDate ?? null;
|
|
5930
|
-
this.selected = data?.selected ?? false;
|
|
5931
5921
|
}
|
|
5932
5922
|
}
|
|
5933
5923
|
|