@masterteam/client-components 0.0.59 → 0.0.60
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.
|
@@ -8,6 +8,7 @@ import { Button } from '@masterteam/components/button';
|
|
|
8
8
|
import { RuntimeActionRunner, resolveActionLabel } from '@masterteam/components/runtime-action';
|
|
9
9
|
import { HttpClient } from '@angular/common/http';
|
|
10
10
|
import { switchMap, of, map, Observable, share, take } from 'rxjs';
|
|
11
|
+
import { resolveLocalizedLabel, isSectionKey, EntitiesPreview } from '@masterteam/components/entities';
|
|
11
12
|
import { Table, TableExportService, TableGroupingController, TableValueResolver, TableCaption } from '@masterteam/components/table';
|
|
12
13
|
import * as i2 from 'primeng/skeleton';
|
|
13
14
|
import { SkeletonModule } from 'primeng/skeleton';
|
|
@@ -15,7 +16,6 @@ import { Card } from '@masterteam/components/card';
|
|
|
15
16
|
import { Icon } from '@masterteam/icons';
|
|
16
17
|
import { ConfirmationService } from '@masterteam/components/confirmation';
|
|
17
18
|
import { MTDateFormatPipe } from '@masterteam/components';
|
|
18
|
-
import { EntitiesPreview } from '@masterteam/components/entities';
|
|
19
19
|
import * as i3 from 'primeng/popover';
|
|
20
20
|
import { PopoverModule } from 'primeng/popover';
|
|
21
21
|
import { DashboardViewer } from '@masterteam/dashboard-builder';
|
|
@@ -190,6 +190,7 @@ class ClientListStateService {
|
|
|
190
190
|
configuration: column.configuration ?? null,
|
|
191
191
|
}));
|
|
192
192
|
const propertyMaps = this.createPropertyMaps(response.catalog);
|
|
193
|
+
const lang = this.resolveActiveLang();
|
|
193
194
|
const rows = (response.records ?? []).map((record) => {
|
|
194
195
|
const row = {
|
|
195
196
|
Id: record.id,
|
|
@@ -197,7 +198,7 @@ class ClientListStateService {
|
|
|
197
198
|
};
|
|
198
199
|
columns.forEach((column) => {
|
|
199
200
|
const property = this.resolvePropertyMeta(column.key, propertyMaps);
|
|
200
|
-
row[column.key] = this.toEntityData(column.key, record.values?.[property?.key ?? column.key], property, column.viewType, column.label, column.configuration, property?.configuration, record.id, column.order ?? property?.order, propertyMaps.nestedByOwnerKey.get(property?.key ?? column.key));
|
|
201
|
+
row[column.key] = this.toEntityData(column.key, record.values?.[property?.key ?? column.key], property, column.viewType, column.label, column.configuration, property?.configuration, record.id, column.order ?? property?.order, propertyMaps.nestedByOwnerKey.get(property?.key ?? column.key), lang);
|
|
201
202
|
});
|
|
202
203
|
return row;
|
|
203
204
|
});
|
|
@@ -329,13 +330,14 @@ class ClientListStateService {
|
|
|
329
330
|
const records = this.orderRecords(data?.records ?? [], data?.projectionMeta?.groups ?? []);
|
|
330
331
|
const catalogProperties = data?.catalog?.properties ?? [];
|
|
331
332
|
const propertyMaps = this.createPropertyMaps(data?.catalog);
|
|
333
|
+
const lang = this.resolveActiveLang();
|
|
332
334
|
const descriptors = this.buildCardDescriptors(data?.projectionMeta?.displayOrder ?? [], data?.projectionMeta?.columns ?? [], propertyMaps);
|
|
333
335
|
return records.map((record) => {
|
|
334
336
|
const schema = data?.schemas?.find((item) => item.id === record.schemaId);
|
|
335
337
|
const propertyDescriptors = descriptors.length
|
|
336
338
|
? descriptors
|
|
337
339
|
: this.buildFallbackCardDescriptors(record, catalogProperties);
|
|
338
|
-
const entities = propertyDescriptors.map((propertyDescriptor) => this.toEntityData(propertyDescriptor.projectionKey, record.values?.[propertyDescriptor.recordValueKey], propertyDescriptor.property, propertyDescriptor.viewType, propertyDescriptor.label, propertyDescriptor.configuration, propertyDescriptor.propertyConfiguration, record.id, propertyDescriptor.order, propertyMaps.nestedByOwnerKey.get(propertyDescriptor.recordValueKey)));
|
|
340
|
+
const entities = propertyDescriptors.map((propertyDescriptor) => this.toEntityData(propertyDescriptor.projectionKey, record.values?.[propertyDescriptor.recordValueKey], propertyDescriptor.property, propertyDescriptor.viewType, propertyDescriptor.label, propertyDescriptor.configuration, propertyDescriptor.propertyConfiguration, record.id, propertyDescriptor.order, propertyMaps.nestedByOwnerKey.get(propertyDescriptor.recordValueKey), lang));
|
|
339
341
|
const statusColor = this.resolveCardStatusColor(entities);
|
|
340
342
|
const normalizedEntities = statusColor
|
|
341
343
|
? this.applyCardProgressColor(entities, statusColor)
|
|
@@ -388,14 +390,29 @@ class ClientListStateService {
|
|
|
388
390
|
return (response.schemas?.find((item) => item.id === recordSchemaId) ??
|
|
389
391
|
response.schemas?.[0]);
|
|
390
392
|
}
|
|
391
|
-
toEntityData(projectionKey, cell, property, viewType, label, configuration, propertyConfiguration, recordId, order, nestedProperties) {
|
|
393
|
+
toEntityData(projectionKey, cell, property, viewType, label, configuration, propertyConfiguration, recordId, order, nestedProperties, lang) {
|
|
392
394
|
const resolvedViewType = (viewType ?? 'Text');
|
|
395
|
+
// Custom label override saved on the display config (localized).
|
|
396
|
+
const customLabel = resolveLocalizedLabel(configuration?.label, lang);
|
|
397
|
+
// Section markers are layout-only: no value, heading from the label config.
|
|
398
|
+
if (resolvedViewType === 'Section') {
|
|
399
|
+
return {
|
|
400
|
+
id: recordId,
|
|
401
|
+
key: projectionKey,
|
|
402
|
+
normalizedKey: projectionKey,
|
|
403
|
+
name: customLabel,
|
|
404
|
+
value: '',
|
|
405
|
+
viewType: 'Section',
|
|
406
|
+
order: order ?? property?.order,
|
|
407
|
+
configuration: configuration,
|
|
408
|
+
};
|
|
409
|
+
}
|
|
393
410
|
return {
|
|
394
411
|
id: recordId,
|
|
395
412
|
propertyId: property?.id,
|
|
396
413
|
key: property?.key ?? projectionKey,
|
|
397
414
|
normalizedKey: property?.normalizedKey ?? projectionKey,
|
|
398
|
-
name: label
|
|
415
|
+
name: customLabel || label || property?.label || projectionKey,
|
|
399
416
|
rawValue: cell?.raw === null || cell?.raw === undefined
|
|
400
417
|
? undefined
|
|
401
418
|
: String(cell.raw),
|
|
@@ -409,6 +426,12 @@ class ClientListStateService {
|
|
|
409
426
|
comparison: cell?.comparison,
|
|
410
427
|
};
|
|
411
428
|
}
|
|
429
|
+
/** Active UI language for resolving localized display labels. */
|
|
430
|
+
resolveActiveLang() {
|
|
431
|
+
if (typeof document === 'undefined')
|
|
432
|
+
return 'en';
|
|
433
|
+
return document.documentElement.lang || 'en';
|
|
434
|
+
}
|
|
412
435
|
createPropertyMaps(catalog) {
|
|
413
436
|
const properties = catalog?.properties ?? [];
|
|
414
437
|
return {
|
|
@@ -424,6 +447,19 @@ class ClientListStateService {
|
|
|
424
447
|
buildCardDescriptors(displayOrder, columns, propertyMaps) {
|
|
425
448
|
if (displayOrder?.length) {
|
|
426
449
|
return displayOrder.map((item) => {
|
|
450
|
+
// Section markers carry a synthetic key with no backing property.
|
|
451
|
+
if (isSectionKey(item.propertyKey)) {
|
|
452
|
+
return {
|
|
453
|
+
projectionKey: item.propertyKey,
|
|
454
|
+
recordValueKey: item.propertyKey,
|
|
455
|
+
property: undefined,
|
|
456
|
+
label: undefined,
|
|
457
|
+
viewType: 'Section',
|
|
458
|
+
order: item.order,
|
|
459
|
+
configuration: item.configuration ?? null,
|
|
460
|
+
propertyConfiguration: null,
|
|
461
|
+
};
|
|
462
|
+
}
|
|
427
463
|
const property = this.resolvePropertyMeta(item.propertyKey, propertyMaps);
|
|
428
464
|
return {
|
|
429
465
|
projectionKey: item.propertyKey,
|
|
@@ -829,7 +865,10 @@ class ClientListCardsView {
|
|
|
829
865
|
const sampleCard = this.cardsState().cards[0];
|
|
830
866
|
if (!sampleCard?.entities?.length)
|
|
831
867
|
return [];
|
|
832
|
-
|
|
868
|
+
// Section markers are card-layout only — never table columns.
|
|
869
|
+
return sampleCard.entities
|
|
870
|
+
.filter((entity) => entity.viewType !== 'Section')
|
|
871
|
+
.map((entity) => {
|
|
833
872
|
const raw = entity;
|
|
834
873
|
const key = (typeof raw['key'] === 'string' && raw['key']) ||
|
|
835
874
|
(typeof raw['normalizedKey'] === 'string' && raw['normalizedKey']) ||
|
|
@@ -860,6 +899,8 @@ class ClientListCardsView {
|
|
|
860
899
|
}
|
|
861
900
|
: { Id: card.id, [CLIENT_LIST_RECORD_STATE_KEY]: card.state ?? null };
|
|
862
901
|
for (const entity of card.entities ?? []) {
|
|
902
|
+
if (entity.viewType === 'Section')
|
|
903
|
+
continue;
|
|
863
904
|
const e = entity;
|
|
864
905
|
const key = (typeof e['key'] === 'string' && e['key']) ||
|
|
865
906
|
(typeof e['normalizedKey'] === 'string' && e['normalizedKey']) ||
|