@masterteam/client-components 0.0.92 → 0.0.94

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Injectable, input, signal, computed, effect, untracked, Component } from '@angular/core';
3
3
  import { TranslocoService, TranslocoPipe } from '@jsverse/transloco';
4
- import { EntitiesPreview, isSectionKey, resolveLocalizedLabel, serializeEntityRawValue } from '@masterteam/components/entities';
4
+ import { EntitiesPreview, isSectionKey, resolveLocalizedLabel, readEntityValueColor, serializeEntityRawValue } from '@masterteam/components/entities';
5
5
  import { HttpClient } from '@angular/common/http';
6
6
  import { map } from 'rxjs';
7
7
 
@@ -72,7 +72,14 @@ class ClientInstancePreview {
72
72
  loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
73
73
  error = signal(null, ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
74
74
  response = signal(null, ...(ngDevMode ? [{ debugName: "response" }] : /* istanbul ignore next */ []));
75
- entities = computed(() => mapPreviewToEntities(this.response(), this.config().displayAreas ?? ['card']), ...(ngDevMode ? [{ debugName: "entities" }] : /* istanbul ignore next */ []));
75
+ entities = computed(() => {
76
+ const response = this.response();
77
+ const config = this.config();
78
+ const entities = mapPreviewToEntities(response, config.displayAreas ?? ['card']);
79
+ return response && config.transformEntities
80
+ ? config.transformEntities(entities, response)
81
+ : entities;
82
+ }, ...(ngDevMode ? [{ debugName: "entities" }] : /* istanbul ignore next */ []));
76
83
  /**
77
84
  * Name of the schema the loaded record belongs to — the level name for a
78
85
  * `level:{id}` context, the module name for a `.../module:{id}` one. Hosts
@@ -217,6 +224,7 @@ function toEntityData(meta, cell, displayConfiguration, recordId, nestedProperti
217
224
  normalizedKey: meta.normalizedKey,
218
225
  name: customLabel || meta.label,
219
226
  rawValue: serializeEntityRawValue(cell?.raw),
227
+ color: readEntityValueColor(cell?.color),
220
228
  value: toEntityValue(cell),
221
229
  viewType,
222
230
  type: meta?.source,
@@ -1 +1 @@
1
- {"version":3,"file":"masterteam-client-components-client-instance-preview.mjs","sources":["../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview-api.service.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.html","../../../../packages/masterteam/client-components/client-instance-preview/masterteam-client-components-client-instance-preview.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { map, Observable } from 'rxjs';\r\nimport {\r\n ClientInstancePreviewConfig,\r\n PreviewFetchRecordResponse,\r\n PreviewResponse,\r\n Response,\r\n} from './client-instance-preview.model';\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientInstancePreviewApiService {\r\n private readonly http = inject(HttpClient);\r\n private readonly fetchBaseUrl = 'fetch';\r\n\r\n resolve(\r\n config: ClientInstancePreviewConfig,\r\n ): Observable<Response<PreviewResponse>> {\r\n const contextKey = config.contextKey;\r\n const areaKeys = config.displayAreas?.length\r\n ? config.displayAreas\r\n : ['card'];\r\n\r\n return this.http\r\n .get<Response<PreviewFetchRecordResponse>>(\r\n `${this.fetchBaseUrl}/records/${config.instanceId}`,\r\n {\r\n params: this.buildRecordPreviewParams(\r\n contextKey,\r\n areaKeys,\r\n config.processRequestId,\r\n ),\r\n },\r\n )\r\n .pipe(\r\n map((recordResponse) => ({\r\n endpoint: recordResponse.endpoint,\r\n status: recordResponse.status,\r\n code: recordResponse.code,\r\n locale: recordResponse.locale,\r\n message: recordResponse.message,\r\n errors: recordResponse.errors,\r\n cacheSession: recordResponse.cacheSession,\r\n data: {\r\n contextKey: recordResponse.data?.contextKey ?? contextKey,\r\n schemas: recordResponse.data?.schemas ?? [],\r\n catalog: recordResponse.data?.catalog ?? { properties: [] },\r\n record: recordResponse.data?.record ?? null,\r\n displayConfigurations:\r\n recordResponse.data?.projectionMeta?.displayOrder ?? [],\r\n },\r\n })),\r\n );\r\n }\r\n\r\n private buildRecordPreviewParams(\r\n contextKey: string,\r\n areaKeys: string[],\r\n processRequestId?: number,\r\n ): Record<string, string> {\r\n const params: Record<string, string> = {\r\n contextKey,\r\n Projection: 'Card',\r\n };\r\n\r\n if (processRequestId != null) {\r\n params['ProcessContext[RequestId]'] = String(processRequestId);\r\n }\r\n\r\n areaKeys.forEach((areaKey, index) => {\r\n params[`Display[areas][${index}]`] = areaKey;\r\n });\r\n\r\n return params;\r\n }\r\n}\r\n","import {\r\n Component,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n OnDestroy,\r\n signal,\r\n untracked,\r\n} from '@angular/core';\r\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport {\r\n EntitiesPreview,\r\n EntityData,\r\n EntityNestedPropertyMeta,\r\n EntitySectionLabel,\r\n isSectionKey,\r\n resolveLocalizedLabel,\r\n serializeEntityRawValue,\r\n} from '@masterteam/components/entities';\r\n\r\nimport { ClientInstancePreviewApiService } from './client-instance-preview-api.service';\r\nimport {\r\n ClientInstancePreviewConfig,\r\n DisplayConfiguration,\r\n PreviewFetchPropertyMeta,\r\n PreviewFetchValueCell,\r\n PreviewResponse,\r\n} from './client-instance-preview.model';\r\n\r\n@Component({\r\n selector: 'mt-client-instance-preview',\r\n standalone: true,\r\n imports: [EntitiesPreview, TranslocoPipe],\r\n templateUrl: './client-instance-preview.html',\r\n})\r\nexport class ClientInstancePreview implements OnDestroy {\r\n private readonly clientInstancePreviewApiService = inject(\r\n ClientInstancePreviewApiService,\r\n );\r\n private readonly transloco = inject(TranslocoService);\r\n private loadSub?: Subscription;\r\n\r\n readonly config = input.required<ClientInstancePreviewConfig>();\r\n /** When true, suppresses the \"No preview data\" empty-state placeholder so the host can collapse. */\r\n readonly hideEmptyState = input<boolean>(false);\r\n /**\r\n * Forwarded to the inner `mt-entities-preview`. When `true` (default) every\r\n * field collapses to full width below a ~400px container width; pass `false`\r\n * from a host wide enough that each entity's `size` configuration should be\r\n * honored instead. The hard ≤280px overflow stack always applies regardless.\r\n */\r\n readonly stackOnNarrow = input<boolean>(true);\r\n readonly loading = signal(false);\r\n readonly error = signal<string | null>(null);\r\n readonly response = signal<PreviewResponse | null>(null);\r\n\r\n readonly entities = computed(() =>\r\n mapPreviewToEntities(\r\n this.response(),\r\n this.config().displayAreas ?? ['card'],\r\n ),\r\n );\r\n /**\r\n * Name of the schema the loaded record belongs to — the level name for a\r\n * `level:{id}` context, the module name for a `.../module:{id}` one. Hosts\r\n * read it to title the preview (e.g. \"{Level Name} Details\"). Null until the\r\n * fetch resolves.\r\n */\r\n readonly schemaName = computed(() => {\r\n const response = this.response();\r\n const schemas = response?.schemas ?? [];\r\n const schemaId = response?.record?.schemaId;\r\n const schema =\r\n schemas.find((candidate) => candidate.id === schemaId) ?? schemas[0];\r\n\r\n return schema?.name || null;\r\n });\r\n\r\n constructor() {\r\n effect(() => {\r\n const config = this.config();\r\n if (!config) {\r\n return;\r\n }\r\n\r\n untracked(() => this.load(config));\r\n });\r\n }\r\n\r\n load(config: ClientInstancePreviewConfig): void {\r\n this.loadSub?.unsubscribe();\r\n this.loading.set(true);\r\n this.error.set(null);\r\n\r\n this.loadSub = this.clientInstancePreviewApiService\r\n .resolve(config)\r\n .subscribe({\r\n next: (response) => {\r\n this.loading.set(false);\r\n this.response.set(response.data);\r\n },\r\n error: (error) => {\r\n this.loading.set(false);\r\n this.response.set(null);\r\n\r\n // A row that exists in a Publish-mode project's DRAFT but has not\r\n // been published yet is a defined state, not a failure: the module\r\n // tabs read the published plan, so the record legitimately is not\r\n // there. Rendering the generic \"failed to load\" for it reads as data\r\n // loss to someone who can see the row in the schedule.\r\n if (isRecordNotPublished(error)) {\r\n this.error.set(\r\n this.transloco.translate(\r\n 'components.clientComponents.instancePreview.notPublishedYet',\r\n ),\r\n );\r\n return;\r\n }\r\n\r\n const message =\r\n error?.error?.message ??\r\n error?.message ??\r\n this.transloco.translate(\r\n 'components.clientComponents.instancePreview.loadFailed',\r\n );\r\n this.error.set(message);\r\n },\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.loadSub?.unsubscribe();\r\n }\r\n}\r\n\r\n/**\r\n * \"This row exists in the draft but has not been published yet.\"\r\n *\r\n * Matched on `errors.details.reason`, NOT on the code or the message. The\r\n * envelope's `errors.code` is a fixed shared set — every not-found is `NF_001` —\r\n * and the message is localized, so neither can carry a distinction a client is\r\n * meant to branch on. The reason token is stable and culture-independent.\r\n */\r\nconst RECORD_NOT_PUBLISHED_REASON = 'schedule.record_not_published';\r\n\r\nfunction isRecordNotPublished(error: unknown): boolean {\r\n const body = (error as { error?: unknown } | null)?.error as\r\n | { errors?: { details?: { reason?: unknown } } }\r\n | null\r\n | undefined;\r\n\r\n return body?.errors?.details?.reason === RECORD_NOT_PUBLISHED_REASON;\r\n}\r\n\r\nfunction mapPreviewToEntities(\r\n response: PreviewResponse | null,\r\n areaKeys: string[],\r\n): EntityData[] {\r\n const record = response?.record;\r\n if (!record) {\r\n return [];\r\n }\r\n\r\n const properties = response?.catalog?.properties ?? [];\r\n const nestedProperties = response?.catalog?.nestedProperties ?? {};\r\n const propertyByKey = new Map(\r\n properties.map((property) => [property.key, property]),\r\n );\r\n const displayConfigurationsByPropertyKey =\r\n buildDisplayConfigurationsByPropertyKey(\r\n response?.displayConfigurations ?? [],\r\n areaKeys,\r\n );\r\n const lang = resolveActiveLang();\r\n\r\n // Iterate the display configs (not the catalog) so section markers — which\r\n // have no backing catalog property — are emitted too.\r\n const entities: EntityData[] = [];\r\n for (const [\r\n propertyKey,\r\n configuration,\r\n ] of displayConfigurationsByPropertyKey) {\r\n if (isSectionKey(propertyKey)) {\r\n entities.push(toSectionEntity(configuration, record.id, lang));\r\n continue;\r\n }\r\n const property = propertyByKey.get(propertyKey);\r\n if (!property) {\r\n continue;\r\n }\r\n entities.push(\r\n toEntityData(\r\n property,\r\n record.values?.[property.key],\r\n configuration,\r\n record.id,\r\n nestedProperties[property.key],\r\n lang,\r\n ),\r\n );\r\n }\r\n return entities;\r\n}\r\n\r\nfunction toSectionEntity(\r\n configuration: DisplayConfiguration,\r\n recordId: number,\r\n lang: string,\r\n): EntityData {\r\n const label = configuration.configuration?.['label'] as\r\n | EntitySectionLabel\r\n | undefined;\r\n return {\r\n id: recordId,\r\n key: configuration.propertyKey,\r\n normalizedKey: configuration.propertyKey,\r\n name: resolveLocalizedLabel(label, lang),\r\n value: '',\r\n viewType: 'Section',\r\n order: configuration.order,\r\n configuration: configuration.configuration as EntityData['configuration'],\r\n };\r\n}\r\n\r\nfunction resolveActiveLang(): string {\r\n if (typeof document === 'undefined') return 'en';\r\n return document.documentElement.lang || 'en';\r\n}\r\n\r\nfunction buildDisplayConfigurationsByPropertyKey(\r\n displayConfigurations: DisplayConfiguration[],\r\n areaKeys: string[],\r\n): Map<string, DisplayConfiguration> {\r\n const result = new Map<string, DisplayConfiguration>();\r\n const filteredConfigurations = displayConfigurations.filter((configuration) =>\r\n areaKeys.includes(configuration.areaKey),\r\n );\r\n const source =\r\n filteredConfigurations.length > 0\r\n ? filteredConfigurations\r\n : displayConfigurations;\r\n\r\n for (const configuration of source) {\r\n if (!configuration.propertyKey || result.has(configuration.propertyKey)) {\r\n continue;\r\n }\r\n\r\n result.set(configuration.propertyKey, configuration);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nfunction toEntityData(\r\n meta: PreviewFetchPropertyMeta,\r\n cell: PreviewFetchValueCell | undefined,\r\n displayConfiguration: DisplayConfiguration | undefined,\r\n recordId: number,\r\n nestedProperties: PreviewFetchPropertyMeta[] | undefined,\r\n lang: string,\r\n): EntityData {\r\n const viewType = meta.viewType ?? 'Text';\r\n // Custom label override saved on the display config wins over the catalog label.\r\n const customLabel = resolveLocalizedLabel(\r\n displayConfiguration?.configuration?.['label'] as\r\n | EntitySectionLabel\r\n | undefined,\r\n lang,\r\n );\r\n\r\n return {\r\n id: recordId,\r\n propertyId: meta?.id,\r\n key: meta.key,\r\n normalizedKey: meta.normalizedKey,\r\n name: customLabel || meta.label,\r\n rawValue: serializeEntityRawValue(cell?.raw),\r\n value: toEntityValue(cell),\r\n viewType,\r\n type: meta?.source,\r\n order: displayConfiguration?.order ?? meta.order,\r\n configuration: displayConfiguration?.configuration ?? undefined,\r\n propertyConfiguration: meta.configuration ?? undefined,\r\n nestedProperties: nestedProperties?.map(toNestedPropertyMeta),\r\n comparison: cell?.comparison,\r\n };\r\n}\r\n\r\nfunction toNestedPropertyMeta(\r\n meta: PreviewFetchPropertyMeta,\r\n): EntityNestedPropertyMeta {\r\n return {\r\n id: meta.id,\r\n key: meta.key,\r\n normalizedKey: meta.normalizedKey,\r\n label: meta.label,\r\n viewType: meta.viewType ?? 'Text',\r\n configuration: meta.configuration ?? undefined,\r\n order: meta.order,\r\n };\r\n}\r\n\r\nfunction toEntityValue(\r\n cell: PreviewFetchValueCell | undefined,\r\n): EntityData['value'] {\r\n return (cell?.value ?? '') as EntityData['value'];\r\n}\r\n","@if (loading()) {\r\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\r\n @for (item of [1, 2, 3, 4]; track item) {\r\n <div class=\"rounded-lg border border-surface-200 bg-surface-50 p-4\">\r\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\r\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\r\n </div>\r\n }\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ error() }}\r\n </p>\r\n </div>\r\n} @else if (entities().length) {\r\n <mt-entities-preview\r\n [entities]=\"entities()\"\r\n [stackOnNarrow]=\"stackOnNarrow()\"\r\n />\r\n} @else if (!hideEmptyState()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{\r\n \"components.clientComponents.instancePreview.noPreviewData\" | transloco\r\n }}\r\n </p>\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAWa,+BAA+B,CAAA;AACzB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,YAAY,GAAG,OAAO;AAEvC,IAAA,OAAO,CACL,MAAmC,EAAA;AAEnC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU;AACpC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE;cAClC,MAAM,CAAC;AACT,cAAE,CAAC,MAAM,CAAC;QAEZ,OAAO,IAAI,CAAC;aACT,GAAG,CACF,CAAA,EAAG,IAAI,CAAC,YAAY,YAAY,MAAM,CAAC,UAAU,CAAA,CAAE,EACnD;AACE,YAAA,MAAM,EAAE,IAAI,CAAC,wBAAwB,CACnC,UAAU,EACV,QAAQ,EACR,MAAM,CAAC,gBAAgB,CACxB;SACF;aAEF,IAAI,CACH,GAAG,CAAC,CAAC,cAAc,MAAM;YACvB,QAAQ,EAAE,cAAc,CAAC,QAAQ;YACjC,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,IAAI,EAAE,cAAc,CAAC,IAAI;YACzB,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,OAAO,EAAE,cAAc,CAAC,OAAO;YAC/B,MAAM,EAAE,cAAc,CAAC,MAAM;YAC7B,YAAY,EAAE,cAAc,CAAC,YAAY;AACzC,YAAA,IAAI,EAAE;AACJ,gBAAA,UAAU,EAAE,cAAc,CAAC,IAAI,EAAE,UAAU,IAAI,UAAU;AACzD,gBAAA,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE;gBAC3C,OAAO,EAAE,cAAc,CAAC,IAAI,EAAE,OAAO,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;AAEA,SAAS,aAAa,CACpB,IAAuC,EAAA;AAEvC,IAAA,QAAQ,IAAI,EAAE,KAAK,IAAI,EAAE;AAC3B;;AErTA;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-client-components-client-instance-preview.mjs","sources":["../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview-api.service.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.ts","../../../../packages/masterteam/client-components/client-instance-preview/client-instance-preview.html","../../../../packages/masterteam/client-components/client-instance-preview/masterteam-client-components-client-instance-preview.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { map, Observable } from 'rxjs';\nimport {\n ClientInstancePreviewConfig,\n PreviewFetchRecordResponse,\n PreviewResponse,\n Response,\n} from './client-instance-preview.model';\n\n@Injectable({ providedIn: 'root' })\nexport class ClientInstancePreviewApiService {\n private readonly http = inject(HttpClient);\n private readonly fetchBaseUrl = 'fetch';\n\n resolve(\n config: ClientInstancePreviewConfig,\n ): Observable<Response<PreviewResponse>> {\n const contextKey = config.contextKey;\n const areaKeys = config.displayAreas?.length\n ? config.displayAreas\n : ['card'];\n\n return this.http\n .get<Response<PreviewFetchRecordResponse>>(\n `${this.fetchBaseUrl}/records/${config.instanceId}`,\n {\n params: this.buildRecordPreviewParams(\n contextKey,\n areaKeys,\n config.processRequestId,\n ),\n },\n )\n .pipe(\n map((recordResponse) => ({\n endpoint: recordResponse.endpoint,\n status: recordResponse.status,\n code: recordResponse.code,\n locale: recordResponse.locale,\n message: recordResponse.message,\n errors: recordResponse.errors,\n cacheSession: recordResponse.cacheSession,\n data: {\n contextKey: recordResponse.data?.contextKey ?? contextKey,\n schemas: recordResponse.data?.schemas ?? [],\n catalog: recordResponse.data?.catalog ?? { properties: [] },\n record: recordResponse.data?.record ?? null,\n displayConfigurations:\n recordResponse.data?.projectionMeta?.displayOrder ?? [],\n },\n })),\n );\n }\n\n private buildRecordPreviewParams(\n contextKey: string,\n areaKeys: string[],\n processRequestId?: number,\n ): Record<string, string> {\n const params: Record<string, string> = {\n contextKey,\n Projection: 'Card',\n };\n\n if (processRequestId != null) {\n params['ProcessContext[RequestId]'] = String(processRequestId);\n }\n\n areaKeys.forEach((areaKey, index) => {\n params[`Display[areas][${index}]`] = areaKey;\n });\n\n return params;\n }\n}\n","import {\n Component,\n computed,\n effect,\n inject,\n input,\n OnDestroy,\n signal,\n untracked,\n} from '@angular/core';\nimport { TranslocoPipe, TranslocoService } from '@jsverse/transloco';\nimport { Subscription } from 'rxjs';\n\nimport {\n EntitiesPreview,\n EntityData,\n EntityNestedPropertyMeta,\n EntitySectionLabel,\n isSectionKey,\n resolveLocalizedLabel,\n readEntityValueColor,\n serializeEntityRawValue,\n} from '@masterteam/components/entities';\n\nimport { ClientInstancePreviewApiService } from './client-instance-preview-api.service';\nimport {\n ClientInstancePreviewConfig,\n DisplayConfiguration,\n PreviewFetchPropertyMeta,\n PreviewFetchValueCell,\n PreviewResponse,\n} from './client-instance-preview.model';\n\n@Component({\n selector: 'mt-client-instance-preview',\n standalone: true,\n imports: [EntitiesPreview, TranslocoPipe],\n templateUrl: './client-instance-preview.html',\n})\nexport class ClientInstancePreview implements OnDestroy {\n private readonly clientInstancePreviewApiService = inject(\n ClientInstancePreviewApiService,\n );\n private readonly transloco = inject(TranslocoService);\n private loadSub?: Subscription;\n\n readonly config = input.required<ClientInstancePreviewConfig>();\n /** When true, suppresses the \"No preview data\" empty-state placeholder so the host can collapse. */\n readonly hideEmptyState = input<boolean>(false);\n /**\n * Forwarded to the inner `mt-entities-preview`. When `true` (default) every\n * field collapses to full width below a ~400px container width; pass `false`\n * from a host wide enough that each entity's `size` configuration should be\n * honored instead. The hard ≤280px overflow stack always applies regardless.\n */\n readonly stackOnNarrow = input<boolean>(true);\n readonly loading = signal(false);\n readonly error = signal<string | null>(null);\n readonly response = signal<PreviewResponse | null>(null);\n\n readonly entities = computed(() => {\n const response = this.response();\n const config = this.config();\n const entities = mapPreviewToEntities(\n response,\n config.displayAreas ?? ['card'],\n );\n\n return response && config.transformEntities\n ? config.transformEntities(entities, response)\n : entities;\n });\n /**\n * Name of the schema the loaded record belongs to — the level name for a\n * `level:{id}` context, the module name for a `.../module:{id}` one. Hosts\n * read it to title the preview (e.g. \"{Level Name} Details\"). Null until the\n * fetch resolves.\n */\n readonly schemaName = computed(() => {\n const response = this.response();\n const schemas = response?.schemas ?? [];\n const schemaId = response?.record?.schemaId;\n const schema =\n schemas.find((candidate) => candidate.id === schemaId) ?? schemas[0];\n\n return schema?.name || null;\n });\n\n constructor() {\n effect(() => {\n const config = this.config();\n if (!config) {\n return;\n }\n\n untracked(() => this.load(config));\n });\n }\n\n load(config: ClientInstancePreviewConfig): void {\n this.loadSub?.unsubscribe();\n this.loading.set(true);\n this.error.set(null);\n\n this.loadSub = this.clientInstancePreviewApiService\n .resolve(config)\n .subscribe({\n next: (response) => {\n this.loading.set(false);\n this.response.set(response.data);\n },\n error: (error) => {\n this.loading.set(false);\n this.response.set(null);\n\n // A row that exists in a Publish-mode project's DRAFT but has not\n // been published yet is a defined state, not a failure: the module\n // tabs read the published plan, so the record legitimately is not\n // there. Rendering the generic \"failed to load\" for it reads as data\n // loss to someone who can see the row in the schedule.\n if (isRecordNotPublished(error)) {\n this.error.set(\n this.transloco.translate(\n 'components.clientComponents.instancePreview.notPublishedYet',\n ),\n );\n return;\n }\n\n const message =\n error?.error?.message ??\n error?.message ??\n this.transloco.translate(\n 'components.clientComponents.instancePreview.loadFailed',\n );\n this.error.set(message);\n },\n });\n }\n\n ngOnDestroy(): void {\n this.loadSub?.unsubscribe();\n }\n}\n\n/**\n * \"This row exists in the draft but has not been published yet.\"\n *\n * Matched on `errors.details.reason`, NOT on the code or the message. The\n * envelope's `errors.code` is a fixed shared set — every not-found is `NF_001` —\n * and the message is localized, so neither can carry a distinction a client is\n * meant to branch on. The reason token is stable and culture-independent.\n */\nconst RECORD_NOT_PUBLISHED_REASON = 'schedule.record_not_published';\n\nfunction isRecordNotPublished(error: unknown): boolean {\n const body = (error as { error?: unknown } | null)?.error as\n | { errors?: { details?: { reason?: unknown } } }\n | null\n | undefined;\n\n return body?.errors?.details?.reason === RECORD_NOT_PUBLISHED_REASON;\n}\n\nfunction mapPreviewToEntities(\n response: PreviewResponse | null,\n areaKeys: string[],\n): EntityData[] {\n const record = response?.record;\n if (!record) {\n return [];\n }\n\n const properties = response?.catalog?.properties ?? [];\n const nestedProperties = response?.catalog?.nestedProperties ?? {};\n const propertyByKey = new Map(\n properties.map((property) => [property.key, property]),\n );\n const displayConfigurationsByPropertyKey =\n buildDisplayConfigurationsByPropertyKey(\n response?.displayConfigurations ?? [],\n areaKeys,\n );\n const lang = resolveActiveLang();\n\n // Iterate the display configs (not the catalog) so section markers — which\n // have no backing catalog property — are emitted too.\n const entities: EntityData[] = [];\n for (const [\n propertyKey,\n configuration,\n ] of displayConfigurationsByPropertyKey) {\n if (isSectionKey(propertyKey)) {\n entities.push(toSectionEntity(configuration, record.id, lang));\n continue;\n }\n const property = propertyByKey.get(propertyKey);\n if (!property) {\n continue;\n }\n entities.push(\n toEntityData(\n property,\n record.values?.[property.key],\n configuration,\n record.id,\n nestedProperties[property.key],\n lang,\n ),\n );\n }\n return entities;\n}\n\nfunction toSectionEntity(\n configuration: DisplayConfiguration,\n recordId: number,\n lang: string,\n): EntityData {\n const label = configuration.configuration?.['label'] as\n | EntitySectionLabel\n | undefined;\n return {\n id: recordId,\n key: configuration.propertyKey,\n normalizedKey: configuration.propertyKey,\n name: resolveLocalizedLabel(label, lang),\n value: '',\n viewType: 'Section',\n order: configuration.order,\n configuration: configuration.configuration as EntityData['configuration'],\n };\n}\n\nfunction resolveActiveLang(): string {\n if (typeof document === 'undefined') return 'en';\n return document.documentElement.lang || 'en';\n}\n\nfunction buildDisplayConfigurationsByPropertyKey(\n displayConfigurations: DisplayConfiguration[],\n areaKeys: string[],\n): Map<string, DisplayConfiguration> {\n const result = new Map<string, DisplayConfiguration>();\n const filteredConfigurations = displayConfigurations.filter((configuration) =>\n areaKeys.includes(configuration.areaKey),\n );\n const source =\n filteredConfigurations.length > 0\n ? filteredConfigurations\n : displayConfigurations;\n\n for (const configuration of source) {\n if (!configuration.propertyKey || result.has(configuration.propertyKey)) {\n continue;\n }\n\n result.set(configuration.propertyKey, configuration);\n }\n\n return result;\n}\n\nfunction toEntityData(\n meta: PreviewFetchPropertyMeta,\n cell: PreviewFetchValueCell | undefined,\n displayConfiguration: DisplayConfiguration | undefined,\n recordId: number,\n nestedProperties: PreviewFetchPropertyMeta[] | undefined,\n lang: string,\n): EntityData {\n const viewType = meta.viewType ?? 'Text';\n // Custom label override saved on the display config wins over the catalog label.\n const customLabel = resolveLocalizedLabel(\n displayConfiguration?.configuration?.['label'] as\n | EntitySectionLabel\n | undefined,\n lang,\n );\n\n return {\n id: recordId,\n propertyId: meta?.id,\n key: meta.key,\n normalizedKey: meta.normalizedKey,\n name: customLabel || meta.label,\n rawValue: serializeEntityRawValue(cell?.raw),\n color: readEntityValueColor(cell?.color),\n value: toEntityValue(cell),\n viewType,\n type: meta?.source,\n order: displayConfiguration?.order ?? meta.order,\n configuration: displayConfiguration?.configuration ?? undefined,\n propertyConfiguration: meta.configuration ?? undefined,\n nestedProperties: nestedProperties?.map(toNestedPropertyMeta),\n comparison: cell?.comparison,\n };\n}\n\nfunction toNestedPropertyMeta(\n meta: PreviewFetchPropertyMeta,\n): EntityNestedPropertyMeta {\n return {\n id: meta.id,\n key: meta.key,\n normalizedKey: meta.normalizedKey,\n label: meta.label,\n viewType: meta.viewType ?? 'Text',\n configuration: meta.configuration ?? undefined,\n order: meta.order,\n };\n}\n\nfunction toEntityValue(\n cell: PreviewFetchValueCell | undefined,\n): EntityData['value'] {\n return (cell?.value ?? '') as EntityData['value'];\n}\n","@if (loading()) {\r\n <div class=\"grid grid-cols-1 gap-3 md:grid-cols-2\">\r\n @for (item of [1, 2, 3, 4]; track item) {\r\n <div class=\"rounded-lg border border-surface-200 bg-surface-50 p-4\">\r\n <div class=\"mb-3 h-4 w-28 animate-pulse rounded bg-surface-200\"></div>\r\n <div class=\"h-5 w-40 animate-pulse rounded bg-surface-200\"></div>\r\n </div>\r\n }\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{ error() }}\r\n </p>\r\n </div>\r\n} @else if (entities().length) {\r\n <mt-entities-preview\r\n [entities]=\"entities()\"\r\n [stackOnNarrow]=\"stackOnNarrow()\"\r\n />\r\n} @else if (!hideEmptyState()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n {{\r\n \"components.clientComponents.instancePreview.noPreviewData\" | transloco\r\n }}\r\n </p>\r\n </div>\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAWa,+BAA+B,CAAA;AACzB,IAAA,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC;IACzB,YAAY,GAAG,OAAO;AAEvC,IAAA,OAAO,CACL,MAAmC,EAAA;AAEnC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU;AACpC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,EAAE;cAClC,MAAM,CAAC;AACT,cAAE,CAAC,MAAM,CAAC;QAEZ,OAAO,IAAI,CAAC;aACT,GAAG,CACF,CAAA,EAAG,IAAI,CAAC,YAAY,YAAY,MAAM,CAAC,UAAU,CAAA,CAAE,EACnD;AACE,YAAA,MAAM,EAAE,IAAI,CAAC,wBAAwB,CACnC,UAAU,EACV,QAAQ,EACR,MAAM,CAAC,gBAAgB,CACxB;SACF;aAEF,IAAI,CACH,GAAG,CAAC,CAAC,cAAc,MAAM;YACvB,QAAQ,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AE,IAAI,EAAE,MAAM;AAClB,QAAA,KAAK,EAAE,oBAAoB,EAAE,KAAK,IAAI,IAAI,CAAC,KAAK;AAChD,QAAA,aAAa,EAAE,oBAAoB,EAAE,aAAa,IAAI,SAAS;AAC/D,QAAA,qBAAqB,EAAE,IAAI,CAAC,aAAa,IAAI,SAAS;AACtD,QAAA,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,CAAC,oBAAoB,CAAC;QAC7D,UAAU,EAAE,IAAI,EAAE,UAAU;KAC7B;AACH;AAEA,SAAS,oBAAoB,CAC3B,IAA8B,EAAA;IAE9B,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,KAAK,EAAE,IAAI,CAAC,KAAK;AACjB,QAAA,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,MAAM;AACjC,QAAA,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,SAAS;QAC9C,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB;AACH;AAEA,SAAS,aAAa,CACpB,IAAuC,EAAA;AAEvC,IAAA,QAAQ,IAAI,EAAE,KAAK,IAAI,EAAE;AAC3B;;AE7TA;;AAEG;;;;"}
@@ -8,7 +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, map, of, Observable, share, take } from 'rxjs';
11
- import { resolveLocalizedLabel, serializeEntityRawValue, isSectionKey, EntitiesPreview } from '@masterteam/components/entities';
11
+ import { resolveLocalizedLabel, readEntityValueColor, serializeEntityRawValue, isSectionKey, EntitiesPreview } from '@masterteam/components/entities';
12
12
  import { Table, TableExportService, TableGroupingController, TableValueResolver, TableCaption } from '@masterteam/components/table';
13
13
  import * as i2 from 'primeng/skeleton';
14
14
  import { SkeletonModule } from 'primeng/skeleton';
@@ -180,6 +180,118 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
180
180
  args: [{ providedIn: 'root' }]
181
181
  }] });
182
182
 
183
+ function normalizeKey(value) {
184
+ return typeof value === 'string'
185
+ ? value
186
+ .trim()
187
+ .toLowerCase()
188
+ .replace(/[^a-z0-9]/g, '')
189
+ : '';
190
+ }
191
+ function selectionMatchesTarget(selection, target) {
192
+ const selector = typeof selection.selector === 'string'
193
+ ? selection.selector
194
+ : typeof selection.moduleType === 'string' &&
195
+ selection.moduleId !== undefined &&
196
+ selection.moduleId !== null
197
+ ? `${selection.moduleType}:${String(selection.moduleId)}`
198
+ : '';
199
+ const separator = selector.indexOf(':');
200
+ if (separator < 1) {
201
+ return false;
202
+ }
203
+ const type = selector.slice(0, separator);
204
+ const ids = selector
205
+ .slice(separator + 1)
206
+ .split(',')
207
+ .map((id) => id.trim());
208
+ return (normalizeKey(type) === normalizeKey(target.type) &&
209
+ ids.includes(String(target.id).trim()));
210
+ }
211
+ function injectSelectionFilter(selection, injection) {
212
+ if (!selectionMatchesTarget(selection, injection.target)) {
213
+ return selection;
214
+ }
215
+ const filter = injection.filter;
216
+ const propertyKey = normalizeKey(filter.propertyKey);
217
+ if (!propertyKey) {
218
+ return selection;
219
+ }
220
+ const filters = Array.isArray(selection.filters)
221
+ ? selection.filters.map((item) => item && typeof item === 'object'
222
+ ? { ...item }
223
+ : item)
224
+ : [];
225
+ const existingIndex = filters.findIndex((item) => item &&
226
+ typeof item === 'object' &&
227
+ normalizeKey(item['propertyKey']) ===
228
+ propertyKey);
229
+ if (existingIndex >= 0) {
230
+ filters[existingIndex] = {
231
+ ...filters[existingIndex],
232
+ ...filter,
233
+ };
234
+ }
235
+ else {
236
+ filters.push({ ...filter });
237
+ }
238
+ return { ...selection, filters };
239
+ }
240
+ function injectServiceConfigFilters(source, injections) {
241
+ const next = { ...source };
242
+ if (Array.isArray(source.selection)) {
243
+ next.selection = source.selection.map((item) => {
244
+ if (!item || typeof item !== 'object') {
245
+ return item;
246
+ }
247
+ return injections.reduce((selection, injection) => injectSelectionFilter(selection, injection), { ...item });
248
+ });
249
+ }
250
+ if (Array.isArray(source.ServiceConfigs)) {
251
+ next.ServiceConfigs = source.ServiceConfigs.map((item) => item && typeof item === 'object'
252
+ ? injectServiceConfigFilters(item, injections)
253
+ : item);
254
+ }
255
+ return next;
256
+ }
257
+ /**
258
+ * Apply host-owned selection filters to a chart without changing the saved
259
+ * dashboard object. Existing same-property filters are updated in place;
260
+ * missing filters are appended only to the explicitly targeted selections.
261
+ */
262
+ function injectInformativeSelectionFilters(chart, injections = []) {
263
+ if (!chart || typeof chart !== 'object' || injections.length === 0) {
264
+ return chart;
265
+ }
266
+ const chartRecord = chart;
267
+ const config = chartRecord['config'];
268
+ if (!config || typeof config !== 'object') {
269
+ return chart;
270
+ }
271
+ const configRecord = config;
272
+ const serviceConfig = configRecord['serviceConfig'];
273
+ if (!serviceConfig || typeof serviceConfig !== 'object') {
274
+ return chart;
275
+ }
276
+ return {
277
+ ...chartRecord,
278
+ config: {
279
+ ...configRecord,
280
+ serviceConfig: injectServiceConfigFilters(serviceConfig, injections),
281
+ },
282
+ };
283
+ }
284
+ function toDashboardExtraFilters(filters = []) {
285
+ const extraFilters = {};
286
+ for (const filter of filters) {
287
+ if (!filter.key) {
288
+ continue;
289
+ }
290
+ extraFilters[filter.key] = filter.value;
291
+ }
292
+ return extraFilters;
293
+ }
294
+
183
295
  const UNSORTABLE_ENTITY_VIEW_TYPES = new Set([
184
296
  'Attachment',
185
297
  'Checkbox',
@@ -570,7 +682,7 @@ class ClientListStateService {
570
682
  target.title ||
571
683
  this.transloco.translate('components.clientComponents.list.informativeDashboard');
572
684
  const dashboardData = response
573
- ? this.toDashboardData(response, title)
685
+ ? this.toDashboardData(response, title, config.selectionFilterInjections)
574
686
  : null;
575
687
  this.itemsByKey.set({
576
688
  ...this.itemsByKey(),
@@ -718,6 +830,7 @@ class ClientListStateService {
718
830
  normalizedKey: property?.normalizedKey ?? projectionKey,
719
831
  name: customLabel || label || property?.label || projectionKey,
720
832
  rawValue: serializeEntityRawValue(cell?.raw),
833
+ color: readEntityValueColor(cell?.color),
721
834
  value: (cell?.value ?? ''),
722
835
  viewType: resolvedViewType,
723
836
  type: property?.source,
@@ -832,15 +945,15 @@ class ClientListStateService {
832
945
  };
833
946
  });
834
947
  }
835
- toDashboardData(data, title) {
948
+ toDashboardData(data, title, selectionFilterInjections) {
836
949
  const filters = data.filters;
837
950
  const charts = (data.chartLinks ?? []).map((link) => {
838
951
  const configuration = link.configuration ?? {};
839
- return {
952
+ return injectInformativeSelectionFilters({
840
953
  ...configuration,
841
954
  id: link.id,
842
955
  chartComponentId: link.chartComponentId,
843
- };
956
+ }, selectionFilterInjections);
844
957
  });
845
958
  return {
846
959
  page: {
@@ -1908,17 +2021,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImpor
1908
2021
  ], providers: [MTDateFormatPipe], template: "<mt-table-caption\n [generalSearch]=\"true\"\n [showFilters]=\"true\"\n filterMode=\"popover\"\n [printable]=\"true\"\n [groupable]=\"true\"\n [exportable]=\"true\"\n [columns]=\"columns()\"\n [data]=\"rowRepresentations()\"\n [groupColumns]=\"grouping.groupableColumns()\"\n [actions]=\"toolbarActions()\"\n [captionStart]=\"cardsState().config.toolbarStart ?? null\"\n [captionEnd]=\"cardsState().config.toolbarEnd ?? null\"\n [filters]=\"bucket().filters()\"\n (filtersChange)=\"bucket().filters.set($event)\"\n [filterTerm]=\"bucket().filterTerm()\"\n (filterTermChange)=\"bucket().filterTerm.set($event)\"\n [groupBy]=\"bucket().groupBy()\"\n (groupByChange)=\"bucket().groupBy.set($event)\"\n [activeTab]=\"bucket().activeTab()\"\n (activeTabChange)=\"bucket().activeTab.set($event)\"\n (exportRequested)=\"exportExcel()\"\n (printRequested)=\"printPdf()\"\n/>\n\n@if (badgeLegend().length > 0) {\n <!--\n Decodes the coloured count pills on the cards below. Rendered once for the\n whole board rather than per card, so it costs one line of vertical space\n instead of repeating a key inside every tile (finding M-04).\n -->\n <div\n class=\"mb-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-1\"\n role=\"list\"\n [attr.aria-label]=\"\n 'components.clientComponents.list.badgeLegend' | transloco\n \"\n >\n <span class=\"text-xs font-medium text-gray-500 dark:text-gray-400\">\n {{ \"components.clientComponents.list.badgeLegend\" | transloco }}\n </span>\n @for (entry of badgeLegend(); track entry.key) {\n <span class=\"flex items-center gap-1.5\" role=\"listitem\">\n <span\n class=\"inline-flex h-4 min-w-4 items-center justify-center rounded text-[10px] font-bold\"\n [style.background-color]=\"entry.color\"\n [style.color]=\"entry.textColor\"\n aria-hidden=\"true\"\n >\n #\n </span>\n <span class=\"text-xs text-gray-600 dark:text-gray-300\">{{\n entry.label\n }}</span>\n </span>\n }\n </div>\n}\n\n@if (cardsState().loading && cardsState().cards.length === 0) {\n <div class=\"mt-cards-grid\">\n @for (i of [1, 2, 3, 4, 5, 6]; track i) {\n <p-skeleton height=\"20rem\" class=\"rounded-lg\" />\n }\n </div>\n} @else if (cardsState().error) {\n <div class=\"rounded-lg border border-red-200 bg-red-50 p-6 text-red-600\">\n {{ cardsState().error }}\n </div>\n} @else if (visibleCards().length === 0) {\n <!--\n The same empty state the tables use, so a board and a list stop looking like\n two products (finding H-12). A board narrowed by a search or a filter says\n so and offers to clear it, instead of the bare grey \"No cards found.\"\n -->\n <mt-empty-state\n [variant]=\"hasActiveCardFilters() ? 'filtered' : 'empty'\"\n [title]=\"\n hasActiveCardFilters()\n ? ''\n : ('components.clientComponents.list.noCardsFound' | transloco)\n \"\n [actionLabel]=\"\n hasActiveCardFilters()\n ? ('components.emptyState.clearFilters' | transloco)\n : ''\n \"\n actionIcon=\"general.x-close\"\n (actionClick)=\"clearCardFilters()\"\n />\n} @else if (grouping.groupingActive()) {\n <div class=\"flex flex-col gap-6\">\n @for (group of groupedCards(); track group.key) {\n <section class=\"flex flex-col gap-3\">\n <header\n class=\"flex items-center gap-3 px-2 py-2 bg-surface-50 dark:bg-surface-900 border-y border-surface-200 dark:border-surface-700 rounded\"\n [style.--mt-group-accent]=\"group.accent ?? 'var(--p-primary-color)'\"\n >\n <span\n class=\"inline-block w-1 h-5 rounded-full\"\n [style.background]=\"'var(--mt-group-accent)'\"\n ></span>\n <span\n class=\"text-xs uppercase tracking-wide text-gray-500 dark:text-gray-400\"\n >\n {{ group.columnLabel }}\n </span>\n <span class=\"text-sm font-semibold text-gray-900 dark:text-gray-100\">\n {{ group.label }}\n </span>\n <span\n class=\"ml-auto inline-flex items-center gap-1 text-xs px-2 py-0.5 rounded-full bg-primary-50 text-primary-700 dark:bg-primary-950 dark:text-primary-300\"\n >\n {{ group.count }}\n </span>\n </header>\n <div class=\"mt-cards-grid\">\n @for (card of group.cards; track card.id) {\n <mt-card\n class=\"relative cursor-pointer p-5 shadow-sm transition-shadow hover:shadow-md\"\n (click)=\"cardClick.emit(card)\"\n >\n <ng-template #headless>\n <ng-container\n [ngTemplateOutlet]=\"cardActionsMenu\"\n [ngTemplateOutletContext]=\"{ $implicit: card }\"\n />\n <mt-entities-preview\n [entities]=\"card.entities\"\n attachmentShape=\"compact\"\n [stackOnNarrow]=\"false\"\n [clickableKeys]=\"clickableEntityKeys()\"\n [activeKeys]=\"activeKeysForCard(card)\"\n [clickableTooltip]=\"filterByThisLabel()\"\n [activeTooltip]=\"clearFilterLabel()\"\n (entityClick)=\"onEntityFilterClick(card, $event)\"\n />\n </ng-template>\n </mt-card>\n }\n </div>\n </section>\n }\n </div>\n} @else {\n <div class=\"mt-cards-grid\">\n @for (card of visibleCards(); track card.id) {\n @defer (on viewport) {\n <mt-card\n class=\"relative cursor-pointer p-5 shadow-sm transition-shadow hover:shadow-md\"\n (click)=\"cardClick.emit(card)\"\n >\n <ng-template #headless>\n <ng-container\n [ngTemplateOutlet]=\"cardActionsMenu\"\n [ngTemplateOutletContext]=\"{ $implicit: card }\"\n />\n <mt-entities-preview\n [entities]=\"card.entities\"\n attachmentShape=\"compact\"\n [stackOnNarrow]=\"false\"\n [clickableKeys]=\"clickableEntityKeys()\"\n [activeKeys]=\"activeKeysForCard(card)\"\n [clickableTooltip]=\"filterByThisLabel()\"\n [activeTooltip]=\"clearFilterLabel()\"\n (entityClick)=\"onEntityFilterClick(card, $event)\"\n />\n </ng-template>\n </mt-card>\n } @placeholder {\n <div class=\"min-h-[20rem]\">\n <p-skeleton height=\"20rem\" class=\"rounded-lg\" />\n </div>\n }\n }\n </div>\n}\n\n<!--\n Infinite-scroll trigger. Deliberately outside the @if/@else chain above:\n inside it the element would be torn down and rebuilt every time the view\n swapped branch (error, empty filter result, group-by), and the observer\n would be left watching a detached node. Kept in the DOM and hidden via CSS\n when there is nothing left to load, so appending a page never recreates it.\n It also has to sit outside so infinite scroll keeps working while a\n group-by is active \u2014 grouping is a pure FE view over whatever has been\n fetched, not a reason to stop fetching.\n-->\n<div\n #loadMoreSentinel\n class=\"mt-cards-grid py-4\"\n [class.hidden]=\"!hasMoreCards()\"\n>\n @for (i of [1, 2, 3]; track i) {\n <p-skeleton height=\"20rem\" class=\"rounded-lg\" />\n }\n</div>\n\n<!--\n Per-card escalation marker and 3-dots actions menu. The compact corner cover\n only indicates active escalation state; its preview action lives in the menu\n so the marker never displaces or competes with the menu trigger.\n-->\n<ng-template #cardActionsMenu let-card>\n @let escalationAction = escalationMarkerAction(card);\n @if (escalationAction) {\n <span\n class=\"mt-escalation-marker absolute end-0 top-0 z-10 h-[18px] w-[20px]\"\n role=\"img\"\n tabindex=\"0\"\n [attr.aria-label]=\"escalationLabel()\"\n [mtTooltip]=\"escalationLabel()\"\n tooltipPosition=\"top\"\n ></span>\n }\n @if (rowActions().length > 0) {\n <div\n class=\"absolute end-2 top-2 z-20 flex items-center gap-1\"\n (click)=\"$event.stopPropagation()\"\n >\n @for (action of inlineActionsForCard(card); track $index) {\n <mt-button\n [icon]=\"action.icon\"\n [severity]=\"action.color\"\n [variant]=\"action.variant\"\n [size]=\"actionSize(action) || 'small'\"\n [tooltip]=\"action.tooltip\"\n [label]=\"action.label\"\n [loading]=\"resolveActionLoading(action, card)\"\n (onClick)=\"runCardAction($event, action, card)\"\n />\n }\n @if (showCardActionsMenu(card)) {\n <button\n type=\"button\"\n class=\"flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent p-0 text-base text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 dark:text-gray-300 dark:hover:bg-surface-700 dark:hover:text-gray-100\"\n [attr.aria-label]=\"actionsLabel()\"\n [mtTooltip]=\"actionsLabel()\"\n tooltipPosition=\"top\"\n (click)=\"onCardActionsToggle($event, cardPopover, card)\"\n >\n <mt-icon icon=\"general.dots-vertical\" class=\"text-base\" />\n </button>\n <p-popover #cardPopover appendTo=\"body\">\n <div class=\"flex min-w-44 flex-col gap-1 p-1\">\n @if (isCardActionsLoading(card)) {\n <div class=\"flex flex-col gap-2 p-1\">\n <p-skeleton height=\"1.75rem\" />\n <p-skeleton height=\"1.75rem\" />\n <p-skeleton height=\"1.75rem\" />\n </div>\n } @else {\n @for (action of menuActionsForCard(card); track $index) {\n @if (isFirstDestructiveCardAction(card, $index)) {\n <hr\n class=\"my-1 border-0 border-t border-surface-200 dark:border-surface-700\"\n />\n }\n <button\n type=\"button\"\n class=\"flex cursor-pointer items-center gap-2 rounded px-2 py-2 text-start text-sm transition-colors\"\n [class]=\"\n action.color === 'danger'\n ? 'text-red-600 hover:bg-red-50 dark:hover:bg-red-950'\n : action.color === 'warn'\n ? 'text-orange-600 hover:bg-orange-50 dark:text-orange-400 dark:hover:bg-orange-950'\n : 'text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-surface-700'\n \"\n (click)=\"\n runCardAction($event, action, card); cardPopover.hide()\n \"\n >\n @if (action.icon) {\n <mt-icon [icon]=\"action.icon\" class=\"text-base\" />\n }\n <span>{{ action.label || action.tooltip }}</span>\n </button>\n }\n }\n </div>\n </p-popover>\n }\n </div>\n }\n</ng-template>\n", styles: [".mt-cards-grid{--mt-cards-gap: 1rem;--mt-cards-min: 335px;--mt-cards-track: max( var(--mt-cards-min), (100% - 3 * var(--mt-cards-gap)) / 4 );display:grid;gap:var(--mt-cards-gap);grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--mt-cards-track)),1fr))}.mt-cards-grid.hidden,.mt-cards-grid[hidden]{display:none}.mt-escalation-marker{border-start-end-radius:.5rem;background:var(--p-button-text-warn-color, var(--p-orange-500, #f59e0b));clip-path:polygon(0 0,100% 0,100% 100%);transition:filter .15s ease}.mt-escalation-marker:dir(rtl){clip-path:polygon(0 0,100% 0,0 100%)}.mt-escalation-marker:hover{filter:brightness(.92)}.mt-escalation-marker:focus-visible{filter:brightness(.92) drop-shadow(0 0 2px var(--p-button-text-warn-color, #f59e0b));outline:none}\n"] }]
1909
2022
  }], ctorParameters: () => [], propDecorators: { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], rowActions: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActions", required: false }] }], rowActionsLoadingFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "rowActionsLoadingFn", required: false }] }], lazyLoad: [{ type: i0.Output, args: ["lazyLoad"] }], loadMore: [{ type: i0.Output, args: ["loadMore"] }], cardClick: [{ type: i0.Output, args: ["cardClick"] }], rowActionsRequested: [{ type: i0.Output, args: ["rowActionsRequested"] }], loadMoreSentinel: [{ type: i0.ViewChild, args: ['loadMoreSentinel', { isSignal: true }] }] } });
1910
2023
 
1911
- function toDashboardExtraFilters(filters = []) {
1912
- const extraFilters = {};
1913
- for (const filter of filters) {
1914
- if (!filter.key) {
1915
- continue;
1916
- }
1917
- extraFilters[filter.key] = filter.value;
1918
- }
1919
- return extraFilters;
1920
- }
1921
-
1922
2024
  const DEFAULT_GRID_COLUMNS$1 = 12;
1923
2025
  class ClientListInformativeView {
1924
2026
  state = input.required(...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
@@ -3013,6 +3115,7 @@ class ClientList {
3013
3115
  contextKey: formConfig?.contextKey ?? null,
3014
3116
  instanceId: formConfig?.instanceId ?? informativeConfig?.instanceId ?? null,
3015
3117
  filters: formConfig?.filters ?? informativeConfig?.filters ?? [],
3118
+ selectionFilterInjections: informativeConfig?.selectionFilterInjections ?? [],
3016
3119
  hierarchy: this.resolveHierarchyScope(formConfig, areaType),
3017
3120
  levelId: informativeConfig?.levelId ?? null,
3018
3121
  moduleId: informativeConfig?.moduleId ?? 0,
@@ -3230,6 +3333,7 @@ class ClientList {
3230
3333
  config.levelId ?? 'x',
3231
3334
  config.moduleId,
3232
3335
  this.serializeFilters(config.filters),
3336
+ JSON.stringify(config.selectionFilterInjections),
3233
3337
  'dashboard',
3234
3338
  ].join('|');
3235
3339
  }