ngx-material-entity 15.1.0 → 15.1.1
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.
- package/classes/entity.utilities.d.ts +1 -0
- package/esm2020/classes/entity.utilities.mjs +8 -2
- package/esm2020/decorators/base/property-decorator-internal.data.mjs +3 -3
- package/fesm2015/ngx-material-entity.mjs +10 -3
- package/fesm2015/ngx-material-entity.mjs.map +1 -1
- package/fesm2020/ngx-material-entity.mjs +9 -3
- package/fesm2020/ngx-material-entity.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -183,8 +183,8 @@ class PositionInternal {
|
|
|
183
183
|
if (data?.row != null && data.row < 1) {
|
|
184
184
|
throw new Error('row must be at least 1');
|
|
185
185
|
}
|
|
186
|
-
if (data?.tab != null && data.tab < 2) {
|
|
187
|
-
throw new Error('tab must be at least 2');
|
|
186
|
+
if (data?.tab != null && data.tab != -1 && data.tab < 2) {
|
|
187
|
+
throw new Error('tab must be either -1 for the first tab or at least 2');
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -1399,7 +1399,7 @@ class EntityUtilities {
|
|
|
1399
1399
|
const numberOfTabs = EntityUtilities.getNumberOfTabs(keys, entity);
|
|
1400
1400
|
if (EntityUtilities.getEntityRows(entity, -1, hideOmitForCreate, hideOmitForEdit).length) {
|
|
1401
1401
|
const firstTab = {
|
|
1402
|
-
tabName:
|
|
1402
|
+
tabName: EntityUtilities.getFirstTabName(entity),
|
|
1403
1403
|
tab: -1,
|
|
1404
1404
|
rows: EntityUtilities.getEntityRows(entity, -1, hideOmitForCreate, hideOmitForEdit)
|
|
1405
1405
|
};
|
|
@@ -1438,6 +1438,12 @@ class EntityUtilities {
|
|
|
1438
1438
|
.find(m => m.position.tab === tab && m.position.tabName)?.position.tabName;
|
|
1439
1439
|
return providedTabName ?? `Tab ${tab}`;
|
|
1440
1440
|
}
|
|
1441
|
+
static getFirstTabName(entity) {
|
|
1442
|
+
const providedTabName = EntityUtilities.keysOf(entity)
|
|
1443
|
+
.map(k => EntityUtilities.getPropertyMetadata(entity, k))
|
|
1444
|
+
.find(m => m.position.tabName && m.position.tab === -1)?.position.tabName;
|
|
1445
|
+
return providedTabName ?? 'Tab 1';
|
|
1446
|
+
}
|
|
1441
1447
|
/**
|
|
1442
1448
|
* Gets the keys of the provided entity correctly typed.
|
|
1443
1449
|
*
|