@trudb/tru-common-lib 0.2.552 → 0.2.553
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.
|
@@ -8796,8 +8796,24 @@ class TruDataGrid {
|
|
|
8796
8796
|
rowCount = 'Rows: 0';
|
|
8797
8797
|
selectedRowCount = 'Selected: 0';
|
|
8798
8798
|
api;
|
|
8799
|
+
invalidRowIds = new WeakMap();
|
|
8800
|
+
invalidRowIdSequence = 0;
|
|
8799
8801
|
gridOptions = {
|
|
8800
|
-
getRowId: (params) => {
|
|
8802
|
+
getRowId: (params) => {
|
|
8803
|
+
const ref = params.data?.$entity?.Ref;
|
|
8804
|
+
if (ref !== null && ref !== undefined)
|
|
8805
|
+
return ref.toString();
|
|
8806
|
+
const rowData = params.data;
|
|
8807
|
+
if (rowData && typeof rowData === 'object') {
|
|
8808
|
+
let fallbackId = this.invalidRowIds.get(rowData);
|
|
8809
|
+
if (!fallbackId) {
|
|
8810
|
+
fallbackId = 'invalid-row-' + (++this.invalidRowIdSequence).toString();
|
|
8811
|
+
this.invalidRowIds.set(rowData, fallbackId);
|
|
8812
|
+
}
|
|
8813
|
+
return fallbackId;
|
|
8814
|
+
}
|
|
8815
|
+
return 'invalid-row';
|
|
8816
|
+
},
|
|
8801
8817
|
context: {
|
|
8802
8818
|
grid: this
|
|
8803
8819
|
},
|
|
@@ -9051,8 +9067,14 @@ class TruDataGrid {
|
|
|
9051
9067
|
return data;
|
|
9052
9068
|
};
|
|
9053
9069
|
loadGridData = (entities) => {
|
|
9054
|
-
|
|
9055
|
-
|
|
9070
|
+
const validEntities = (entities ?? []).filter(entity => entity?.Ref !== null && entity?.Ref !== undefined);
|
|
9071
|
+
const invalidEntityCount = (entities?.length ?? 0) - validEntities.length;
|
|
9072
|
+
if (invalidEntityCount > 0) {
|
|
9073
|
+
const tableName = this.config.tablePluralLabel ?? this.config.tablePluralName ?? this.config.tableName ?? 'records';
|
|
9074
|
+
this.uiNotification.error('Some ' + tableName + ' could not be displayed because the server returned them without an identity.', [invalidEntityCount.toString() + ' invalid record(s) were rejected.']);
|
|
9075
|
+
}
|
|
9076
|
+
this.rowData = validEntities.map(this.enhanceRowDataForEntity, validEntities);
|
|
9077
|
+
this.rowCount = 'Rows: ' + validEntities.length;
|
|
9056
9078
|
this.cdr.markForCheck();
|
|
9057
9079
|
};
|
|
9058
9080
|
loadManyToManyGridData = (associatedEntities, associatableEntities, initalLoad) => {
|