@masterteam/client-components 0.0.87 → 0.0.88

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 +1 @@
1
- {"version":3,"file":"masterteam-client-components-client-list.mjs","sources":["../../../../packages/masterteam/client-components/client-list/models/client-list.model.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-api.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-state.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-runtime-actions.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-toolbar.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-table-view/client-list-table-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-table-view/client-list-table-view.html","../../../../packages/masterteam/client-components/client-list/components/client-list-cards-view/client-list-cards-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-cards-view/client-list-cards-view.html","../../../../packages/masterteam/client-components/client-list/utils/informative-filters.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-informative-view/client-list-informative-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-informative-view/client-list-informative-view.html","../../../../packages/masterteam/client-components/client-list/utils/runtime-filters.ts","../../../../packages/masterteam/client-components/client-list/utils/paging-continuity.ts","../../../../packages/masterteam/client-components/client-list/client-list.ts","../../../../packages/masterteam/client-components/client-list/client-list.html","../../../../packages/masterteam/client-components/client-list/masterteam-client-components-client-list.ts"],"sourcesContent":["import { TemplateRef } from '@angular/core';\nimport { DashboardBuilderData } from '@masterteam/dashboard-builder';\nimport {\n EntityConfiguration,\n EntityData,\n} from '@masterteam/components/entities';\nimport {\n ColumnDef,\n TableAction,\n TableActionShape,\n TableFilters,\n} from '@masterteam/components/table';\nimport { RuntimeAction } from '@masterteam/components/runtime-action';\n\nexport type ClientListMode = 'auto' | 'override';\nexport type ClientListAreaType = 'table' | 'cards';\nexport type ClientListType = 'form' | 'informative';\nexport type ClientListTablePersistStateKey =\n | 'pageSize'\n | 'pagePosition'\n | 'sort'\n | 'selection'\n | 'groupBy';\n\nexport interface Response<T> {\n endpoint: string;\n status: number;\n code: number;\n locale: string;\n message?: string | null;\n errors?: unknown | null;\n data: T;\n cacheSession?: string;\n}\n\nexport type ClientListRuntimeContext = string;\nexport type ClientListFetchStateKey = 'escalation';\nexport const CLIENT_LIST_RECORD_STATE_KEY = '__clientListRecordState';\n\n/** Record state every list request asks for. */\nexport const CLIENT_LIST_DEFAULT_INCLUDE_STATE: readonly ClientListFetchStateKey[] =\n ['escalation'];\n\n/**\n * `fetch/query` filter key that selects a single record by its own id. Reading\n * one record back after a write filters on this, never on the list's scope\n * filters alone — those match a whole page, not the row that just changed.\n */\nexport const CLIENT_LIST_RECORD_ID_FILTER_KEY = 'id';\n\nexport interface ClientListBaseConfiguration {\n key?: string;\n title?: string;\n showHeader?: boolean;\n collapse?: ClientListCollapseConfig;\n layout?: ClientListLayoutConfig;\n headerStart?: TemplateRef<ClientListContentTemplateContext>;\n headerEnd?: TemplateRef<ClientListContentTemplateContext>;\n /**\n * Templates rendered inside the list's own toolbar row, alongside the search\n * box / filter / export controls, rather than above it. Use these for a\n * control that belongs to the list itself (a view switcher, a scope picker)\n * so it reads as one toolbar instead of a second floating row. `headerStart`\n * / `headerEnd` remain the slots for the title row, which only renders when\n * `showHeader` is on. Rendered without a context object.\n */\n toolbarStart?: TemplateRef<unknown>;\n toolbarEnd?: TemplateRef<unknown>;\n contentStart?: TemplateRef<ClientListContentTemplateContext>;\n contentEnd?: TemplateRef<ClientListContentTemplateContext>;\n templateContent?: TemplateRef<ClientListContentTemplateContext>;\n rowActions?: TableAction[];\n actionShape?: TableActionShape;\n dataLoaded?: ClientListDataLoadedHandler;\n /**\n * Lazy backend-driven per-row actions. When enabled, ClientList fetches\n * each row's available `RuntimeAction[]` only when the user opens the row's\n * 3-dots menu (default `loadStrategy: 'onMenuOpen'`), then merges them into\n * the row's action list. Replaces the eager fan-out of one HTTP per visible\n * row that callers used to wire by hand.\n */\n runtimeRecordActions?: ClientListRuntimeRecordActionsConfig;\n}\n\nexport interface ClientListRuntimeRecordActionsContext {\n listKey: string;\n contextKey: string | null;\n instanceId: number | null;\n moduleId: number;\n row: RuntimeTableDisplayRow;\n recordId: number;\n}\n\nexport interface ClientListRuntimeRecordActionsConfig {\n /** Master flag — set to false to disable without removing the config block. */\n enabled: boolean;\n /**\n * `onMenuOpen` (default): fetch when the 3-dots popover opens for a row.\n * Requires `actionShape: 'popover'`. `eager`: fetch for every visible row\n * after the list loads (legacy behavior, kept for opt-in).\n */\n loadStrategy?: 'onMenuOpen' | 'eager';\n /**\n * Endpoint template. `{instanceId}` is replaced with the list's\n * `instanceId`. Defaults to\n * `LevelData/{instanceId}/workspace-record-actions`.\n */\n endpoint?: string;\n /**\n * Query params per row. Defaults to\n * `{ targetType: 'ModuleData', targetId: recordId, moduleKey? }`.\n */\n buildParams?: (\n ctx: ClientListRuntimeRecordActionsContext,\n ) => Record<string, string | number>;\n /** Cache TTL in ms. `null` = until manual invalidation. Default: 60_000. */\n cacheTtlMs?: number | null;\n /** Read the record id from a row. Defaults to `row.Id ?? row.id ?? row.ModuleDataId`. */\n resolveRecordId?: (row: RuntimeTableDisplayRow) => number | null;\n /** Read the module key from a row (for the `moduleKey` query param). */\n resolveModuleKey?: (\n row: RuntimeTableDisplayRow,\n ctx: { listKey: string; moduleId: number },\n ) => string | null;\n /**\n * Optional visual overrides for discovered runtime row actions. Use this to\n * align backend-discovered actions with existing app action styling.\n */\n resolveActionPresentation?: (\n action: RuntimeAction,\n ) => Partial<\n Pick<\n TableAction,\n 'icon' | 'color' | 'variant' | 'label' | 'tooltip' | 'loading'\n >\n >;\n /**\n * Optional interceptor before the default runtime runner executes a\n * discovered action. Return `true` when the consumer handled the action and\n * the built-in runner should be skipped.\n */\n onActionTriggered?: (\n action: RuntimeAction,\n ctx: ClientListRuntimeRecordActionsContext,\n ) => boolean | Promise<boolean>;\n /**\n * Called after a runtime action executes successfully (the list also\n * auto-reloads and the per-row cache is invalidated). Use this to refresh\n * any external state the consumer owns.\n */\n onActionExecuted?: (\n action: RuntimeAction,\n ctx: ClientListRuntimeRecordActionsContext,\n ) => void;\n /**\n * Visual: icon used for runtime action buttons (popover entries). Defaults\n * to `media.play-circle`. Must be a valid `MTIcon` literal.\n */\n actionIcon?: string;\n}\n\nexport interface ClientListTableDisplayConfig {\n pageSize?: number;\n searchable?: boolean;\n exportable?: boolean;\n /**\n * mt-table storage keys to exclude when this list provides a storageKey.\n * Defaults to `['pagePosition']`, so current page is not restored unless the\n * host explicitly opts in with `[]`.\n */\n persistStateExclude?: ClientListTablePersistStateKey[];\n}\n\nexport interface NormalizedClientListTableDisplayConfig {\n pageSize: number;\n searchable: boolean;\n exportable: boolean;\n persistStateExclude: ClientListTablePersistStateKey[];\n}\n\nexport interface ClientListFormConfiguration extends ClientListBaseConfiguration {\n type?: 'form';\n areaType?: ClientListAreaType;\n contextKey: ClientListRuntimeContext;\n /**\n * Optional host/runtime metadata forwarded to row-action context. It does\n * not add request filters; hosts own the complete `filters` array.\n */\n instanceId?: number;\n /** Complete filter array forwarded unchanged to `fetch/query`. */\n filters?: ClientListFetchRequestFilter[];\n mode?: ClientListMode;\n columnKeys?: string[];\n /**\n * `areaType: 'table'` — defaults to true. Paginated tables use backend\n * page/pageSize requests and render a paginator. Set false only for\n * bounded local datasets that should render through virtual scroll.\n *\n * `areaType: 'cards'` — defaults to false (the full record set is fetched\n * in one call, preserving pre-existing behavior). Set true to opt into\n * backend-paginated cards, fetched page by page and appended as the user\n * scrolls (infinite scroll) instead of loading every record up front.\n *\n * Note for cards: this flag used to be ignored entirely — cards always\n * fetched everything regardless of what was configured. A cards config\n * that already carries `isPaginated: true` (copied from a table config,\n * or a config object shared across area types) therefore changes\n * behaviour: it now pages. Requires backend support for `page`/`pageSize`\n * on the `Card` projection; without a `pagination` block in the response\n * the list degrades to the first page only.\n */\n isPaginated?: boolean;\n /**\n * Backend page size when `isPaginated` is true. For local virtual-scroll\n * tables (`isPaginated: false`), this is the explicit fetch cap. Ignored\n * for cards when `isPaginated` is false.\n */\n take?: number;\n /**\n * Presentation settings. `pageSize` controls visible table rows/paginator\n * size; it is not used as the local fetch cap when `isPaginated` is false.\n */\n table?: ClientListTableDisplayConfig;\n /**\n * Host hook to reshape built columns/rows before render — see\n * {@link ClientListTableTransform}. Applies to `table` area only.\n */\n transformResult?: ClientListTableTransform;\n}\n\nexport interface ClientListInformativeConfiguration extends ClientListBaseConfiguration {\n type: 'informative';\n levelId: number;\n moduleId: number;\n /**\n * Optional host/runtime metadata. It does not add dashboard filters; hosts\n * own the complete `filters` array.\n */\n instanceId?: number;\n /** Complete filter array converted by key/value to dashboard extraFilters. */\n filters?: ClientListFetchRequestFilter[];\n areaType?: 'table';\n}\n\nexport type ClientListConfiguration =\n | ClientListFormConfiguration\n | ClientListInformativeConfiguration;\n\nexport interface ClientListCollapseConfig {\n enabled?: boolean;\n expandedByDefault?: boolean;\n collapseIcon?: string;\n expandIcon?: string;\n}\n\nexport interface ClientListLayoutConfig {\n startSpan?: number;\n tableSpan?: number;\n endSpan?: number;\n}\n\nexport interface ClientListTableQuery {\n mode: ClientListMode;\n columnKeys?: string[];\n skip: number;\n take: number;\n}\n\nexport type ClientListFetchProjection = 'Card' | 'Table';\n\nexport interface ClientListFetchRequestFilter {\n key: string;\n operator: 'Equals' | 'Contains' | 'GreaterThanOrEqual' | 'LessThanOrEqual';\n value: string | number;\n}\n\nexport interface ClientListFetchRequestDisplay {\n areas: string[];\n}\n\nexport interface ClientListFetchQueryRequest {\n contextKey: string;\n projection: ClientListFetchProjection;\n propertyKeys?: string[];\n filters?: ClientListFetchRequestFilter[];\n includeState?: ClientListFetchStateKey[];\n page?: number;\n pageSize?: number;\n surfaceKey?: string;\n display?: ClientListFetchRequestDisplay;\n}\n\n/**\n * The query settings a list renders with, in the shape `process-submit` takes\n * as `returnRecord`. Sending these with a write asks the backend to project\n * the written record exactly the way this list would have fetched it, so the\n * list can splice the result straight in.\n *\n * The same object doubles as the spec for reading a single record back through\n * `fetch/query` when the write could not project one — one description of\n * \"how this list reads a record\", used by both paths so they cannot drift.\n */\nexport interface ClientListReturnRecordRequest {\n projection: ClientListFetchProjection;\n surfaceKey?: string;\n includeState?: ClientListFetchStateKey[];\n propertyKeys?: string[];\n culture?: string;\n}\n\nexport type ClientListRecordProjectionStatus = 'Available' | 'Unavailable';\n\n/**\n * The part of a `process-submit` response a list needs to apply a write\n * locally. Structural on purpose: `ProcessFormSubmitResponse` from\n * `@masterteam/forms/client-form` satisfies it, and so does any host-owned\n * envelope that carries the same three keys.\n */\nexport interface ClientListRecordWriteResult {\n /** `PendingApproval` writes nothing yet — the list must stay as it is. */\n status?: string | null;\n recordId?: number | string | null;\n record?: ClientListFetchRecord | null;\n recordProjectionStatus?: ClientListRecordProjectionStatus | string | null;\n}\n\n/**\n * A table page plus the `propertyKeys` the request actually carried. The keys\n * are not derivable from the response — the backend echoes columns, not the\n * projection it was asked for — and `returnRecord` has to repeat them\n * verbatim, so the request reports them.\n */\nexport interface ClientListRowsFetchResult {\n response: Response<RuntimeTableRowsResponse>;\n /** `undefined` when the request left the projection to the backend. */\n propertyKeys?: string[];\n}\n\nexport interface ClientListTableSettingsColumn {\n key?: string;\n propertyKey?: string;\n order?: number;\n visible?: boolean;\n}\n\nexport interface ClientListTableSettingsCatalogResponse {\n effectiveColumns?: Array<ClientListTableSettingsColumn | string>;\n}\n\nexport interface ClientListFetchPropertyMeta {\n id: number;\n key: string;\n normalizedKey: string;\n label: string;\n viewType: string;\n configuration: EntityData['propertyConfiguration'];\n source?: string;\n order: number;\n isRequired?: boolean;\n isSystem?: boolean;\n}\n\nexport interface ClientListFetchValueCell {\n raw: unknown;\n value: unknown;\n display?: string | null;\n comparison?: import('@masterteam/components/entities').PropertyValueComparison;\n [key: string]: unknown;\n}\n\nexport interface ClientListRecordEscalationState {\n hasActive: boolean;\n instanceId?: number | null;\n}\n\nexport interface ClientListFetchRecordState {\n escalation?: ClientListRecordEscalationState | null;\n}\n\nexport interface ClientListFetchRecord {\n id: number;\n name?: string;\n schemaId?: number;\n values: Record<string, ClientListFetchValueCell>;\n state?: ClientListFetchRecordState | null;\n}\n\nexport interface ClientListFetchSchema {\n id: number;\n key: string;\n name: string;\n order?: number;\n typeGroup?: string;\n}\n\nexport interface ClientListFetchCatalog {\n properties: ClientListFetchPropertyMeta[];\n /**\n * Catalog metadata for properties captured inside another property's value,\n * keyed by the owning property key (e.g. a `LookupModuleCheckList`).\n */\n nestedProperties?: Record<string, ClientListFetchPropertyMeta[]>;\n}\n\nexport interface ClientListFetchTableColumn {\n key: string;\n label: string;\n viewType: string;\n order: number;\n visible: boolean;\n configuration: Record<string, unknown> | null;\n}\n\nexport interface ClientListFetchCardDisplayOrderItem {\n contextKey: string;\n areaKey: string;\n propertyKey: string;\n order: number;\n configuration?: EntityConfiguration | null;\n}\n\nexport interface ClientListFetchCardGroup {\n schemaId: number;\n recordIds: number[];\n}\n\nexport interface ClientListFetchProjectionMeta {\n kind: string;\n columns?: ClientListFetchTableColumn[];\n displayOrder?: ClientListFetchCardDisplayOrderItem[];\n groups?: ClientListFetchCardGroup[];\n}\n\nexport interface ClientListFetchQueryResponse {\n contextKey: string;\n schemas?: ClientListFetchSchema[];\n catalog?: ClientListFetchCatalog;\n records?: ClientListFetchRecord[];\n pagination?: {\n page: number;\n pageSize: number;\n totalCount: number;\n };\n projectionMeta?: ClientListFetchProjectionMeta;\n}\n\nexport interface RuntimeEntityColumnDef extends ColumnDef {\n key: string;\n /** Stable fetch/query filter key from the runtime property catalog. */\n normalizedKey?: string;\n label: string;\n type: 'entity';\n viewType?: string;\n order?: number;\n visible?: boolean;\n configuration?: Record<string, unknown> | null;\n}\n\nexport type RuntimeTableDisplayRow = Record<string, unknown | EntityData>;\nexport type RuntimeTableRowsResponse = ClientListFetchQueryResponse;\n\n/**\n * Built table shape handed to a {@link ClientListTableTransform}: the visible\n * `columns` (already filtered + ordered) and the per-row `rows` (each cell an\n * `EntityData` keyed by column key, plus the `Id` field).\n */\nexport interface ClientListTableTransformResult {\n columns: RuntimeEntityColumnDef[];\n rows: RuntimeTableDisplayRow[];\n}\n\n/**\n * Optional host hook to reshape the table after ClientList builds it from the\n * fetch response and before it is rendered. Use it to merge/derive columns\n * (e.g. collapse two type-specific columns into one conditional column) without\n * forking the library. Must return the columns/rows to render; return the input\n * unchanged to opt out. The raw `response` is provided for cases where the\n * discriminator lives in a property that is not a visible column.\n */\nexport type ClientListTableTransform = (\n result: ClientListTableTransformResult,\n response: RuntimeTableRowsResponse,\n) => ClientListTableTransformResult;\n\nexport interface ClientListCardModule {\n id: number;\n key?: string;\n name: string;\n order?: number;\n typeGroup?: string;\n}\n\nexport type ClientListCardProperty = EntityData;\n\nexport interface ClientListCard {\n id: number;\n name: string;\n module?: ClientListCardModule;\n instanceId?: number;\n state?: ClientListFetchRecordState | null;\n properties: ClientListCardProperty[];\n displayProperties?: Record<string, unknown>;\n entities: EntityData[];\n}\n\nexport type ClientListCardsPayload = ClientListFetchQueryResponse;\n\nexport interface ClientListInformativeChartLink {\n id?: number;\n chartComponentId?: string;\n configuration?: Record<string, any>;\n order?: number;\n}\n\nexport interface ClientListInformativeDashboardPayload {\n moduleId: number;\n ignoreQueryFilter: boolean;\n filters: Record<string, any> | any[];\n extraInfo: Record<string, any>;\n versionNumber: number;\n chartLinks: ClientListInformativeChartLink[];\n}\n\nexport interface ClientListBaseState {\n key: string;\n config: NormalizedClientListConfiguration;\n type: ClientListType;\n areaType: ClientListAreaType;\n loading: boolean;\n error: string | null;\n title: string;\n moduleKey: string;\n totalCount: number;\n columns: RuntimeEntityColumnDef[];\n rows: RuntimeTableDisplayRow[];\n cards: ClientListCard[];\n skip: number;\n take: number;\n expanded: boolean;\n dashboardData: DashboardBuilderData | null;\n rawData: unknown | null;\n}\n\nexport interface ClientListTableState extends ClientListBaseState {\n type: 'form';\n areaType: 'table';\n}\n\nexport interface ClientListCardsState extends ClientListBaseState {\n type: 'form';\n areaType: 'cards';\n}\n\nexport interface ClientListInformativeState extends ClientListBaseState {\n type: 'informative';\n areaType: 'table';\n}\n\nexport type ClientListState =\n | ClientListTableState\n | ClientListCardsState\n | ClientListInformativeState;\n\nexport type ClientListClickableItem = RuntimeTableDisplayRow | ClientListCard;\n\nexport interface ClientListItemClickedEvent {\n key: string;\n areaType: 'table' | 'cards';\n item: ClientListClickableItem;\n state: ClientListState;\n}\n\nexport interface NormalizedClientListConfiguration {\n contextKey: ClientListRuntimeContext | null;\n instanceId: number | null;\n filters: ClientListFetchRequestFilter[];\n levelId: number | null;\n moduleId: number;\n type: ClientListType;\n areaType: ClientListAreaType;\n mode: ClientListMode;\n isPaginated: boolean;\n take: number;\n title?: string;\n showHeader: boolean;\n columnKeys: string[];\n table: NormalizedClientListTableDisplayConfig;\n collapse: Required<ClientListCollapseConfig>;\n layout: Required<ClientListLayoutConfig>;\n headerStart?: TemplateRef<ClientListContentTemplateContext>;\n headerEnd?: TemplateRef<ClientListContentTemplateContext>;\n toolbarStart?: TemplateRef<unknown>;\n toolbarEnd?: TemplateRef<unknown>;\n contentStart?: TemplateRef<ClientListContentTemplateContext>;\n contentEnd?: TemplateRef<ClientListContentTemplateContext>;\n templateContent?: TemplateRef<ClientListContentTemplateContext>;\n rowActions: TableAction[];\n actionShape?: TableActionShape;\n dataLoaded?: ClientListDataLoadedHandler;\n runtimeRecordActions?: ClientListRuntimeRecordActionsConfig;\n transformResult?: ClientListTableTransform;\n}\n\nexport interface ClientListContentTemplateContext {\n $implicit: ClientListState;\n table: ClientListState;\n item: ClientListState;\n loading: boolean;\n error: string | null;\n data: unknown | null;\n}\n\nexport type ClientListDataLoadedHandler = (\n context: ClientListContentTemplateContext,\n) => void;\n\nexport interface ClientListLazyLoadEvent {\n pageSize?: number;\n first?: number;\n currentPage?: number;\n filters?: TableFilters;\n}\n","import { Injectable, inject } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { map, Observable, of, switchMap } from 'rxjs';\r\nimport {\r\n CLIENT_LIST_DEFAULT_INCLUDE_STATE,\r\n ClientListFetchQueryResponse,\r\n ClientListFetchRequestFilter,\r\n ClientListCardsPayload,\r\n ClientListFetchQueryRequest,\r\n ClientListReturnRecordRequest,\r\n ClientListRowsFetchResult,\r\n ClientListRuntimeContext,\r\n ClientListInformativeDashboardPayload,\r\n ClientListTableSettingsCatalogResponse,\r\n ClientListTableQuery,\r\n Response,\r\n RuntimeTableRowsResponse,\r\n} from '../models/client-list.model';\r\n\r\nconst DEFAULT_INCLUDE_STATE = CLIENT_LIST_DEFAULT_INCLUDE_STATE;\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientListApiService {\r\n private readonly http = inject(HttpClient);\r\n private readonly runtimeFetchBaseUrl = 'fetch/query';\r\n private readonly informativeBaseUrl = 'LevelData';\r\n\r\n /**\r\n * Fetches a table page. Resolves to the response **and** the `propertyKeys`\r\n * the request carried, because a write that wants its record projected the\r\n * same way has to repeat them and cannot recover them from the response.\r\n */\r\n getRows(\r\n contextKey: ClientListRuntimeContext,\r\n query: ClientListTableQuery,\r\n filters: ClientListFetchRequestFilter[] = [],\r\n ): Observable<ClientListRowsFetchResult> {\r\n return this.resolveTablePropertyKeys(contextKey, query).pipe(\r\n switchMap((resolvedKeys) => {\r\n const propertyKeys = resolvedKeys?.length ? resolvedKeys : undefined;\r\n\r\n return this.queryRuntime<RuntimeTableRowsResponse>({\r\n contextKey,\r\n projection: 'Table',\r\n surfaceKey: 'table',\r\n includeState: [...DEFAULT_INCLUDE_STATE],\r\n propertyKeys,\r\n filters,\r\n page: this.toPage(query.skip, query.take),\r\n pageSize: query.take,\r\n }).pipe(map((response) => ({ response, propertyKeys })));\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Reads a single record back with the list's own query settings — the path\r\n * taken when a write reports `recordProjectionStatus: 'Unavailable'`. The\r\n * write itself already succeeded; this only reads, and must never be served\r\n * by re-submitting.\r\n */\r\n getRecord(\r\n contextKey: ClientListRuntimeContext,\r\n request: ClientListReturnRecordRequest,\r\n filters: ClientListFetchRequestFilter[],\r\n ): Observable<Response<ClientListFetchQueryResponse>> {\r\n return this.queryRuntime<ClientListFetchQueryResponse>({\r\n contextKey,\r\n projection: request.projection,\r\n surfaceKey: request.surfaceKey,\r\n includeState: request.includeState\r\n ? [...request.includeState]\r\n : [...DEFAULT_INCLUDE_STATE],\r\n propertyKeys: request.propertyKeys?.length\r\n ? request.propertyKeys\r\n : undefined,\r\n filters,\r\n page: 1,\r\n pageSize: 1,\r\n ...(request.projection === 'Card'\r\n ? { display: { areas: ['card'] } }\r\n : {}),\r\n });\r\n }\r\n\r\n getCards(\r\n contextKey: ClientListRuntimeContext,\r\n filters: ClientListFetchRequestFilter[] = [],\r\n skip?: number,\r\n take?: number,\r\n ): Observable<Response<ClientListCardsPayload>> {\r\n // `page` and `pageSize` must be sent together or not at all (fetch/query\r\n // request constraints), so a missing or non-positive `take` means the\r\n // caller wants the whole set in one call.\r\n const pageSize = typeof take === 'number' && take > 0 ? take : null;\r\n\r\n return this.queryRuntime<ClientListCardsPayload>({\r\n contextKey,\r\n projection: 'Card',\r\n includeState: [...DEFAULT_INCLUDE_STATE],\r\n filters,\r\n display: { areas: ['card'] },\r\n ...(pageSize === null\r\n ? {}\r\n : { page: this.toPage(skip ?? 0, pageSize), pageSize }),\r\n });\r\n }\r\n\r\n getInformativeDashboard(\r\n levelId: number,\r\n moduleId: number,\r\n ): Observable<Response<ClientListInformativeDashboardPayload>> {\r\n return this.http.get<Response<ClientListInformativeDashboardPayload>>(\r\n `${this.informativeBaseUrl}/levels/${levelId}/modules/${moduleId}/dashboard`,\r\n );\r\n }\r\n\r\n private queryRuntime<T>(\r\n payload: ClientListFetchQueryRequest,\r\n ): Observable<Response<T>> {\r\n return this.http.post<Response<T>>(this.runtimeFetchBaseUrl, payload);\r\n }\r\n\r\n private resolveTablePropertyKeys(\r\n contextKey: ClientListRuntimeContext,\r\n query: ClientListTableQuery,\r\n ): Observable<string[] | undefined> {\r\n if (query.columnKeys?.length) {\r\n return of(query.columnKeys);\r\n }\r\n\r\n const context = this.readTableSettingsContext(contextKey);\r\n if (!context) {\r\n return of(undefined);\r\n }\r\n\r\n return this.http\r\n .get<\r\n Response<ClientListTableSettingsCatalogResponse>\r\n >(`LevelData/levels/${context.levelId}/modules/${context.moduleId}/table-display-settings/catalog?surfaceKey=table`)\r\n .pipe(\r\n map((response) =>\r\n this.toEffectiveColumnKeys(response.data?.effectiveColumns ?? []),\r\n ),\r\n );\r\n }\r\n\r\n private toPage(skip: number, take: number): number {\r\n if (take <= 0) {\r\n return 1;\r\n }\r\n\r\n return Math.floor(skip / take) + 1;\r\n }\r\n\r\n private toEffectiveColumnKeys(\r\n columns: ClientListTableSettingsCatalogResponse['effectiveColumns'],\r\n ): string[] | undefined {\r\n const keys = (columns ?? [])\r\n .filter((column) =>\r\n typeof column === 'string' ? true : column.visible !== false,\r\n )\r\n .sort(\r\n (a, b) =>\r\n (typeof a === 'string' ? 0 : (a.order ?? 0)) -\r\n (typeof b === 'string' ? 0 : (b.order ?? 0)),\r\n )\r\n .map((column) =>\r\n typeof column === 'string'\r\n ? column\r\n : (column.key ?? column.propertyKey ?? ''),\r\n )\r\n .filter((key) => key.length > 0);\r\n\r\n return keys.length ? keys : undefined;\r\n }\r\n\r\n private readTableSettingsContext(\r\n contextKey: string,\r\n ): { levelId: string; moduleId: string } | null {\r\n const [levelPart, modulePart] = contextKey.split('/');\r\n const levelId = levelPart?.split(':')[1];\r\n const moduleId = modulePart?.split(':')[1];\r\n\r\n if (!levelId || !moduleId) {\r\n return null;\r\n }\r\n\r\n return { levelId, moduleId };\r\n }\r\n}\r\n","import { Injectable, computed, inject, signal } from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport {\r\n DashboardBuilderData,\r\n DashboardChartItem,\r\n} from '@masterteam/dashboard-builder';\r\nimport {\r\n EntityData,\r\n EntityNestedPropertyMeta,\r\n EntityViewType,\r\n isSectionKey,\r\n resolveLocalizedLabel,\r\n serializeEntityRawValue,\r\n} from '@masterteam/components/entities';\r\nimport {\r\n CLIENT_LIST_RECORD_STATE_KEY,\r\n ClientListCard,\r\n ClientListCardsPayload,\r\n ClientListFetchCatalog,\r\n ClientListFetchPropertyMeta,\r\n ClientListFetchQueryResponse,\r\n ClientListFetchRecord,\r\n ClientListFetchSchema,\r\n ClientListFetchTableColumn,\r\n ClientListInformativeDashboardPayload,\r\n ClientListState,\r\n NormalizedClientListConfiguration,\r\n RuntimeEntityColumnDef,\r\n RuntimeTableDisplayRow,\r\n RuntimeTableRowsResponse,\r\n} from '../models/client-list.model';\r\n\r\ninterface ClientListPropertyMaps {\r\n byKey: Map<string, ClientListFetchPropertyMeta>;\r\n byNormalizedKey: Map<string, ClientListFetchPropertyMeta>;\r\n /** Nested catalog metadata, keyed by the owning property key. */\r\n nestedByOwnerKey: Map<string, EntityNestedPropertyMeta[]>;\r\n}\r\n\r\ninterface ClientListCardDescriptor {\r\n projectionKey: string;\r\n recordValueKey: string;\r\n property?: ClientListFetchPropertyMeta;\r\n label?: string;\r\n viewType?: string;\r\n order?: number;\r\n configuration?: EntityData['configuration'] | null;\r\n propertyConfiguration?: EntityData['propertyConfiguration'];\r\n}\r\n\r\nconst UNSORTABLE_ENTITY_VIEW_TYPES = new Set<EntityViewType>([\r\n 'Attachment',\r\n 'Checkbox',\r\n]);\r\n\r\nfunction toNestedPropertyMeta(\r\n meta: ClientListFetchPropertyMeta,\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') as EntityViewType,\r\n configuration: meta.configuration ?? undefined,\r\n order: meta.order,\r\n };\r\n}\r\n\r\n@Injectable()\r\nexport class ClientListStateService {\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly itemsByKey = signal<Record<string, ClientListState>>({});\r\n\r\n readonly items = computed<ClientListState[]>(() =>\r\n Object.values(this.itemsByKey()).sort((a, b) =>\r\n a.config.moduleId === b.config.moduleId\r\n ? (a.config.instanceId ?? 0) - (b.config.instanceId ?? 0)\r\n : a.config.moduleId - b.config.moduleId,\r\n ),\r\n );\r\n\r\n setConfigs(configs: ClientListState[]): void {\r\n const currentItems = this.itemsByKey();\r\n const next: Record<string, ClientListState> = {};\r\n\r\n configs.forEach((item) => {\r\n next[item.key] = this.mergeItemState(item, currentItems[item.key]);\r\n });\r\n\r\n this.itemsByKey.set(next);\r\n }\r\n\r\n setLoading(key: string, loading: boolean): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n loading,\r\n },\r\n });\r\n }\r\n\r\n setError(key: string, message: string | null): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n error: message,\r\n },\r\n });\r\n }\r\n\r\n setTablePaging(key: string, skip: number, take: number): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'table'\r\n ) {\r\n return;\r\n }\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n skip,\r\n take,\r\n },\r\n });\r\n }\r\n\r\n setRowsResult(\r\n key: string,\r\n response: RuntimeTableRowsResponse,\r\n config: NormalizedClientListConfiguration,\r\n skip: number,\r\n take: number,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'table'\r\n ) {\r\n return;\r\n }\r\n\r\n const propertyMaps = this.createPropertyMaps(response.catalog);\r\n const columns: RuntimeEntityColumnDef[] = (\r\n response.projectionMeta?.columns ?? []\r\n )\r\n .filter((column) => column.visible)\r\n .sort((a, b) => a.order - b.order)\r\n .map((column, index) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n return {\r\n key: column.key,\r\n normalizedKey: property?.normalizedKey ?? column.key,\r\n label: column.label,\r\n type: 'entity' as const,\r\n sortable: !UNSORTABLE_ENTITY_VIEW_TYPES.has(\r\n column.viewType as EntityViewType,\r\n ),\r\n width: index === 0 ? '200px' : undefined,\r\n viewType: column.viewType,\r\n order: column.order,\r\n visible: column.visible,\r\n configuration: column.configuration ?? null,\r\n };\r\n });\r\n\r\n const lang = this.resolveActiveLang();\r\n\r\n const rows: RuntimeTableDisplayRow[] = (response.records ?? []).map(\r\n (record) => {\r\n const row: RuntimeTableDisplayRow = {\r\n Id: record.id,\r\n [CLIENT_LIST_RECORD_STATE_KEY]: record.state ?? null,\r\n };\r\n\r\n columns.forEach((column) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n row[column.key] = this.toEntityData(\r\n column.key,\r\n record.values?.[property?.key ?? column.key],\r\n property,\r\n column.viewType,\r\n column.label,\r\n column.configuration,\r\n property?.configuration,\r\n record.id,\r\n column.order ?? property?.order,\r\n propertyMaps.nestedByOwnerKey.get(property?.key ?? column.key),\r\n lang,\r\n );\r\n });\r\n\r\n return row;\r\n },\r\n );\r\n\r\n // Host hook: let the consumer reshape columns/rows (e.g. merge two\r\n // type-specific columns into one conditional column) before render.\r\n const shaped = config.transformResult\r\n ? config.transformResult({ columns, rows }, response)\r\n : { columns, rows };\r\n\r\n const schema = this.resolvePrimarySchema(response);\r\n const title =\r\n (config.title ?? '').trim() || schema?.name || schema?.key || '';\r\n const totalCount =\r\n config.isPaginated === false\r\n ? shaped.rows.length\r\n : (response.pagination?.totalCount ?? shaped.rows.length);\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey: schema?.key ?? '',\r\n columns: shaped.columns,\r\n rows: shaped.rows,\r\n cards: [],\r\n skip,\r\n take,\r\n totalCount,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n setCardsResult(\r\n key: string,\r\n response: ClientListCardsPayload,\r\n config: NormalizedClientListConfiguration,\r\n skip = 0,\r\n take = 0,\r\n append = false,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'cards'\r\n ) {\r\n return;\r\n }\r\n\r\n const newCards = this.toCards(response);\r\n const isAppend = append && config.isPaginated;\r\n // Never trust two pages not to overlap. A record inserted or re-sorted\r\n // between fetches shifts the window, and the grid tracks by `card.id` —\r\n // a repeat would raise NG0955 (duplicate keys) rather than just look odd.\r\n const cards = isAppend\r\n ? this.concatDistinctCards(target.cards, newCards)\r\n : newCards;\r\n const schema = this.resolvePrimarySchema(response);\r\n const firstCardModule = newCards[0]?.module;\r\n const moduleKey = schema?.key ?? firstCardModule?.key ?? target.moduleKey;\r\n const title =\r\n (config.title ?? '').trim() ||\r\n schema?.name ||\r\n firstCardModule?.name ||\r\n moduleKey ||\r\n target.title;\r\n\r\n // The backend is the authority on how big a page actually is: it may cap\r\n // `pageSize` below what we asked for. Offsets are derived from that\r\n // effective size, not from the requested `take` — `toPage()` floors\r\n // `skip / take`, so a mismatch would re-request a page we already hold.\r\n const effectiveTake = this.resolveEffectivePageSize(response, take);\r\n // A page shorter than the effective size is the last page, whatever\r\n // `totalCount` claims — without this the sentinel would sit there\r\n // showing skeletons for records the backend will never return. A\r\n // non-positive size means the response carried no usable paging info at\r\n // all, which we also treat as \"this is everything\".\r\n const exhausted =\r\n !config.isPaginated ||\r\n effectiveTake <= 0 ||\r\n newCards.length < effectiveTake;\r\n const totalCount =\r\n config.isPaginated && !exhausted\r\n ? (response.pagination?.totalCount ?? cards.length)\r\n : cards.length;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey,\r\n columns: [],\r\n rows: [],\r\n cards,\r\n // `skip` is the offset of the *next* page to fetch, always a multiple\r\n // of the effective page size so `toPage()` stays exact.\r\n skip: config.isPaginated\r\n ? exhausted\r\n ? cards.length\r\n : skip + effectiveTake\r\n : 0,\r\n take:\r\n config.isPaginated && effectiveTake > 0 ? effectiveTake : target.take,\r\n totalCount,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Splices a canonical record into the data the list already holds, so a\r\n * create or update lands without re-fetching the page.\r\n *\r\n * Tables replay the whole page through {@link setRowsResult}: for a table\r\n * the rendered page *is* the raw response, so replaying it keeps the catalog\r\n * lookup, the column build and the host `transformResult` hook on exactly\r\n * one code path — a second mapper for single rows would drift from the one\r\n * that built the rest of the table. Cards cannot replay: with infinite\r\n * scroll `rawData` holds only the last page while `cards` holds every page,\r\n * so a single card is built and merged into the accumulated set instead.\r\n *\r\n * Returns `false` when there is nothing to splice into — an informative\r\n * dashboard, or a list that never completed a load. The caller then falls\r\n * back to a real fetch rather than inventing state.\r\n */\r\n upsertRecord(\r\n key: string,\r\n record: ClientListFetchRecord,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'form') return false;\r\n\r\n const raw = target.rawData as ClientListFetchQueryResponse | null;\r\n if (!raw) return false;\r\n\r\n return target.areaType === 'cards'\r\n ? this.upsertCardRecord(key, target, raw, record)\r\n : this.upsertRowRecord(key, target, raw, record, config);\r\n }\r\n\r\n /**\r\n * Drops a record the backend has deleted, without re-fetching. Returns\r\n * `false` when the record is not in the loaded set, so the caller can decide\r\n * whether a reload is warranted.\r\n */\r\n removeRecord(\r\n key: string,\r\n recordId: number,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'form') return false;\r\n\r\n const raw = target.rawData as ClientListFetchQueryResponse | null;\r\n if (!raw) return false;\r\n\r\n const records = (raw.records ?? []).filter((item) => item.id !== recordId);\r\n\r\n if (target.areaType === 'cards') {\r\n const cards = target.cards.filter((card) => card.id !== recordId);\r\n if (cards.length === target.cards.length) return false;\r\n\r\n this.patchItem(key, {\r\n ...target,\r\n cards,\r\n totalCount: Math.max(0, target.totalCount - 1),\r\n error: null,\r\n rawData: this.withRecords(raw, records, -1),\r\n });\r\n\r\n return true;\r\n }\r\n\r\n if (records.length === (raw.records ?? []).length) return false;\r\n\r\n this.setRowsResult(\r\n key,\r\n this.withRecords(raw, records, -1),\r\n config,\r\n target.skip,\r\n target.take,\r\n );\r\n\r\n return true;\r\n }\r\n\r\n private upsertRowRecord(\r\n key: string,\r\n target: ClientListState,\r\n raw: ClientListFetchQueryResponse,\r\n record: ClientListFetchRecord,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n // No columns means no completed table load to splice into.\r\n if (!target.columns.length) return false;\r\n\r\n const records = [...(raw.records ?? [])];\r\n const index = records.findIndex((item) => item.id === record.id);\r\n\r\n if (index >= 0) {\r\n records[index] = this.mergeRecord(records[index], record);\r\n } else {\r\n // The backend owns the real ordering and does not say where the new\r\n // record landed, so it goes to the top of the page in view: the user\r\n // has to see what they just created. The next real load puts it in its\r\n // true place.\r\n records.unshift(record);\r\n\r\n // Keep the page the size the paginator promises — the row pushed off\r\n // the end now lives on the next page.\r\n if (\r\n config.isPaginated &&\r\n target.take > 0 &&\r\n records.length > target.take\r\n ) {\r\n records.length = target.take;\r\n }\r\n }\r\n\r\n this.setRowsResult(\r\n key,\r\n this.withRecords(raw, records, index >= 0 ? 0 : 1),\r\n config,\r\n target.skip,\r\n target.take,\r\n );\r\n\r\n return true;\r\n }\r\n\r\n private upsertCardRecord(\r\n key: string,\r\n target: ClientListState,\r\n raw: ClientListFetchQueryResponse,\r\n record: ClientListFetchRecord,\r\n ): boolean {\r\n if (!raw.projectionMeta) return false;\r\n\r\n const previous = (raw.records ?? []).find((item) => item.id === record.id);\r\n const merged = previous ? this.mergeRecord(previous, record) : record;\r\n const [card] = this.toCards({ ...raw, records: [merged] });\r\n if (!card) return false;\r\n\r\n const index = target.cards.findIndex((item) => item.id === card.id);\r\n const isInsert = index < 0;\r\n const cards = isInsert\r\n ? [card, ...target.cards]\r\n : target.cards.map((item, position) =>\r\n position === index ? card : item,\r\n );\r\n\r\n const records = [...(raw.records ?? [])];\r\n const recordIndex = records.findIndex((item) => item.id === merged.id);\r\n if (recordIndex >= 0) records[recordIndex] = merged;\r\n else records.unshift(merged);\r\n\r\n this.patchItem(key, {\r\n ...target,\r\n cards,\r\n totalCount: isInsert ? target.totalCount + 1 : target.totalCount,\r\n error: null,\r\n rawData: this.withRecords(raw, records, isInsert ? 1 : 0),\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Overlays the written record on the one being replaced, key by key. A\r\n * cleared property comes back explicitly (`{ raw: null, value: null }`) and\r\n * overwrites; only a key the backend left out entirely keeps its previous\r\n * cell, which beats blanking a value that did not actually change.\r\n */\r\n private mergeRecord(\r\n previous: ClientListFetchRecord,\r\n next: ClientListFetchRecord,\r\n ): ClientListFetchRecord {\r\n return {\r\n ...previous,\r\n ...next,\r\n values: { ...previous.values, ...next.values },\r\n };\r\n }\r\n\r\n private withRecords(\r\n raw: ClientListFetchQueryResponse,\r\n records: ClientListFetchRecord[],\r\n totalCountDelta: number,\r\n ): ClientListFetchQueryResponse {\r\n return {\r\n ...raw,\r\n records,\r\n pagination: raw.pagination\r\n ? {\r\n ...raw.pagination,\r\n totalCount: Math.max(\r\n 0,\r\n raw.pagination.totalCount + totalCountDelta,\r\n ),\r\n }\r\n : raw.pagination,\r\n };\r\n }\r\n\r\n private patchItem(key: string, next: ClientListState): void {\r\n this.itemsByKey.set({ ...this.itemsByKey(), [key]: next });\r\n }\r\n\r\n /**\r\n * Appends `next` to `current`, dropping any card whose id is already\r\n * present. Ids are the grid's `@for` track key, so duplicates are a runtime\r\n * error, not a cosmetic issue.\r\n */\r\n private concatDistinctCards(\r\n current: ClientListCard[],\r\n next: ClientListCard[],\r\n ): ClientListCard[] {\r\n if (!next.length) return current;\r\n\r\n const seen = new Set(current.map((card) => card.id));\r\n const fresh = next.filter((card) => !seen.has(card.id));\r\n\r\n return fresh.length ? [...current, ...fresh] : current;\r\n }\r\n\r\n /**\r\n * The page size the backend actually applied, falling back to the size we\r\n * asked for. Returns `0` when neither is usable — i.e. the response carried\r\n * no paging contract, so there is no stride to walk and the caller should\r\n * treat the set as complete.\r\n */\r\n private resolveEffectivePageSize(\r\n response: ClientListCardsPayload,\r\n requestedTake: number,\r\n ): number {\r\n const serverPageSize = response.pagination?.pageSize;\r\n if (typeof serverPageSize === 'number' && serverPageSize > 0) {\r\n return serverPageSize;\r\n }\r\n\r\n return requestedTake > 0 ? requestedTake : 0;\r\n }\r\n\r\n setInformativeResult(\r\n key: string,\r\n response: ClientListInformativeDashboardPayload | null,\r\n config: NormalizedClientListConfiguration,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'informative') return;\r\n\r\n const moduleKey = target.moduleKey || `Module ${config.moduleId}`;\r\n const title =\r\n (config.title ?? '').trim() ||\r\n target.title ||\r\n this.transloco.translate(\r\n 'components.clientComponents.list.informativeDashboard',\r\n );\r\n const dashboardData = response\r\n ? this.toDashboardData(response, title)\r\n : null;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey,\r\n columns: [],\r\n rows: [],\r\n cards: [],\r\n skip: 0,\r\n take: 0,\r\n totalCount: dashboardData?.charts?.length ?? 0,\r\n dashboardData,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n toggleExpanded(key: string): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n expanded: !target.expanded,\r\n },\r\n });\r\n }\r\n\r\n private mergeItemState(\r\n item: ClientListState,\r\n existing?: ClientListState,\r\n ): ClientListState {\r\n if (\r\n !existing ||\r\n existing.type !== item.type ||\r\n existing.areaType !== item.areaType\r\n ) {\r\n return item;\r\n }\r\n\r\n return {\r\n ...item,\r\n loading: existing.loading,\r\n error: existing.error,\r\n title: item.title || existing.title,\r\n moduleKey: existing.moduleKey || item.moduleKey,\r\n totalCount: existing.totalCount,\r\n columns: existing.columns,\r\n rows: existing.rows,\r\n cards: existing.cards,\r\n // Paging is settled by the caller, which compared the incoming config\r\n // against the previous one. Re-deciding it here — with only the two\r\n // states and no view of what changed in the config — is what used to\r\n // drop the user's page whenever their rows-per-page differed from the\r\n // configured default.\r\n skip: item.skip,\r\n take: item.take,\r\n expanded: existing.expanded,\r\n dashboardData: existing.dashboardData,\r\n rawData: existing.rawData,\r\n };\r\n }\r\n\r\n private toCards(data?: ClientListCardsPayload): ClientListCard[] {\r\n const records = this.orderRecords(\r\n data?.records ?? [],\r\n data?.projectionMeta?.groups ?? [],\r\n );\r\n const catalogProperties = data?.catalog?.properties ?? [];\r\n const propertyMaps = this.createPropertyMaps(data?.catalog);\r\n const lang = this.resolveActiveLang();\r\n const descriptors = this.buildCardDescriptors(\r\n data?.projectionMeta?.displayOrder ?? [],\r\n data?.projectionMeta?.columns ?? [],\r\n propertyMaps,\r\n );\r\n\r\n return records.map((record) => {\r\n const schema = data?.schemas?.find((item) => item.id === record.schemaId);\r\n const propertyDescriptors = descriptors.length\r\n ? descriptors\r\n : this.buildFallbackCardDescriptors(record, catalogProperties);\r\n const entities = propertyDescriptors.map((propertyDescriptor) =>\r\n this.toEntityData(\r\n propertyDescriptor.projectionKey,\r\n record.values?.[propertyDescriptor.recordValueKey],\r\n propertyDescriptor.property,\r\n propertyDescriptor.viewType,\r\n propertyDescriptor.label,\r\n propertyDescriptor.configuration,\r\n propertyDescriptor.propertyConfiguration,\r\n record.id,\r\n propertyDescriptor.order,\r\n propertyMaps.nestedByOwnerKey.get(propertyDescriptor.recordValueKey),\r\n lang,\r\n ),\r\n );\r\n const statusColor = this.resolveCardStatusColor(entities);\r\n const normalizedEntities = statusColor\r\n ? this.applyCardProgressColor(entities, statusColor)\r\n : entities;\r\n\r\n return {\r\n id: record.id,\r\n name: record.name ?? `Record ${record.id}`,\r\n module: schema\r\n ? {\r\n id: schema.id,\r\n key: schema.key,\r\n name: schema.name,\r\n order: schema.order,\r\n typeGroup: schema.typeGroup,\r\n }\r\n : undefined,\r\n instanceId: record.id,\r\n state: record.state ?? null,\r\n properties: normalizedEntities,\r\n entities: normalizedEntities,\r\n };\r\n });\r\n }\r\n\r\n private orderRecords(\r\n records: ClientListFetchRecord[],\r\n groups: Array<{ recordIds: number[] }>,\r\n ): ClientListFetchRecord[] {\r\n if (!groups.length) {\r\n return records;\r\n }\r\n\r\n const recordsById = new Map(records.map((record) => [record.id, record]));\r\n const ordered: ClientListFetchRecord[] = [];\r\n const seen = new Set<number>();\r\n\r\n groups.forEach((group) => {\r\n group.recordIds.forEach((recordId) => {\r\n const record = recordsById.get(recordId);\r\n if (!record || seen.has(recordId)) {\r\n return;\r\n }\r\n\r\n ordered.push(record);\r\n seen.add(recordId);\r\n });\r\n });\r\n\r\n records.forEach((record) => {\r\n if (!seen.has(record.id)) {\r\n ordered.push(record);\r\n }\r\n });\r\n\r\n return ordered;\r\n }\r\n\r\n private resolvePrimarySchema(\r\n response: RuntimeTableRowsResponse | ClientListCardsPayload,\r\n ): ClientListFetchSchema | undefined {\r\n const recordSchemaId = response.records?.[0]?.schemaId;\r\n\r\n return (\r\n response.schemas?.find((item) => item.id === recordSchemaId) ??\r\n response.schemas?.[0]\r\n );\r\n }\r\n\r\n private toEntityData(\r\n projectionKey: string,\r\n cell: ClientListFetchRecord['values'][string] | undefined,\r\n property: ClientListFetchPropertyMeta | undefined,\r\n viewType: string | undefined,\r\n label: string | undefined,\r\n configuration: EntityData['configuration'] | null | undefined,\r\n propertyConfiguration: EntityData['propertyConfiguration'],\r\n recordId: number,\r\n order: number | undefined,\r\n nestedProperties: EntityNestedPropertyMeta[] | undefined,\r\n lang: string,\r\n ): EntityData {\r\n const resolvedViewType = (viewType ?? 'Text') as EntityData['viewType'];\r\n // Custom label override saved on the display config (localized).\r\n const customLabel = resolveLocalizedLabel(configuration?.label, lang);\r\n\r\n // Section markers are layout-only: no value, heading from the label config.\r\n if (resolvedViewType === 'Section') {\r\n return {\r\n id: recordId,\r\n key: projectionKey,\r\n normalizedKey: projectionKey,\r\n name: customLabel,\r\n value: '',\r\n viewType: 'Section',\r\n order: order ?? property?.order,\r\n configuration: configuration as EntityData['configuration'] | undefined,\r\n };\r\n }\r\n\r\n return {\r\n id: recordId,\r\n propertyId: property?.id,\r\n key: property?.key ?? projectionKey,\r\n normalizedKey: property?.normalizedKey ?? projectionKey,\r\n name: customLabel || label || property?.label || projectionKey,\r\n rawValue: serializeEntityRawValue(cell?.raw),\r\n value: (cell?.value ?? '') as EntityData['value'],\r\n viewType: resolvedViewType,\r\n type: property?.source,\r\n order: order ?? property?.order,\r\n configuration: configuration as EntityData['configuration'] | undefined,\r\n propertyConfiguration: propertyConfiguration ?? undefined,\r\n nestedProperties,\r\n comparison: cell?.comparison,\r\n };\r\n }\r\n\r\n /** Active UI language for resolving localized display labels. */\r\n private resolveActiveLang(): string {\r\n if (typeof document === 'undefined') return 'en';\r\n return document.documentElement.lang || 'en';\r\n }\r\n\r\n private createPropertyMaps(\r\n catalog: ClientListFetchCatalog | undefined,\r\n ): ClientListPropertyMaps {\r\n const properties = catalog?.properties ?? [];\r\n\r\n return {\r\n byKey: new Map(properties.map((property) => [property.key, property])),\r\n byNormalizedKey: new Map(\r\n properties.map((property) => [property.normalizedKey, property]),\r\n ),\r\n nestedByOwnerKey: new Map(\r\n Object.entries(catalog?.nestedProperties ?? {}).map(\r\n ([ownerKey, nested]) => [ownerKey, nested.map(toNestedPropertyMeta)],\r\n ),\r\n ),\r\n };\r\n }\r\n\r\n private resolvePropertyMeta(\r\n projectionKey: string,\r\n propertyMaps: ClientListPropertyMaps,\r\n ): ClientListFetchPropertyMeta | undefined {\r\n return (\r\n propertyMaps.byKey.get(projectionKey) ??\r\n propertyMaps.byNormalizedKey.get(projectionKey)\r\n );\r\n }\r\n\r\n private buildCardDescriptors(\r\n displayOrder: NonNullable<\r\n ClientListCardsPayload['projectionMeta']\r\n >['displayOrder'],\r\n columns: ClientListFetchTableColumn[],\r\n propertyMaps: ClientListPropertyMaps,\r\n ): ClientListCardDescriptor[] {\r\n if (displayOrder?.length) {\r\n return displayOrder.map((item) => {\r\n // Section markers carry a synthetic key with no backing property.\r\n if (isSectionKey(item.propertyKey)) {\r\n return {\r\n projectionKey: item.propertyKey,\r\n recordValueKey: item.propertyKey,\r\n property: undefined,\r\n label: undefined,\r\n viewType: 'Section',\r\n order: item.order,\r\n configuration: item.configuration ?? null,\r\n propertyConfiguration: null,\r\n };\r\n }\r\n\r\n const property = this.resolvePropertyMeta(\r\n item.propertyKey,\r\n propertyMaps,\r\n );\r\n\r\n return {\r\n projectionKey: item.propertyKey,\r\n recordValueKey: property?.key ?? item.propertyKey,\r\n property,\r\n label: property?.label,\r\n viewType: property?.viewType,\r\n order: item.order ?? property?.order,\r\n configuration: item.configuration ?? null,\r\n propertyConfiguration: property?.configuration ?? null,\r\n };\r\n });\r\n }\r\n\r\n if (columns?.length) {\r\n return columns\r\n .filter((column) => column.visible)\r\n .map((column) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n return {\r\n projectionKey: column.key,\r\n recordValueKey: property?.key ?? column.key,\r\n property,\r\n label: column.label ?? property?.label,\r\n viewType: column.viewType ?? property?.viewType,\r\n order: column.order ?? property?.order,\r\n configuration: column.configuration ?? null,\r\n propertyConfiguration: property?.configuration ?? null,\r\n };\r\n });\r\n }\r\n\r\n return [];\r\n }\r\n\r\n private buildFallbackCardDescriptors(\r\n record: ClientListFetchRecord,\r\n properties: ClientListFetchPropertyMeta[],\r\n ): ClientListCardDescriptor[] {\r\n return properties\r\n .filter((property) => record.values?.[property.key] !== undefined)\r\n .map((property) => ({\r\n projectionKey: property.normalizedKey || property.key,\r\n recordValueKey: property.key,\r\n property,\r\n label: property.label,\r\n viewType: property.viewType,\r\n order: property.order,\r\n configuration: null,\r\n propertyConfiguration: property.configuration ?? null,\r\n }));\r\n }\r\n\r\n private resolveCardStatusColor(entities: EntityData[]): string | null {\r\n const statusEntity = entities.find(\r\n (entity) => entity.normalizedKey === 'Status',\r\n );\r\n const value = statusEntity?.value;\r\n const color =\r\n value && typeof value === 'object' && 'color' in value\r\n ? value.color\r\n : null;\r\n\r\n return typeof color === 'string' && color.trim().length\r\n ? color.trim()\r\n : null;\r\n }\r\n\r\n private applyCardProgressColor(\r\n entities: EntityData[],\r\n color: string,\r\n ): EntityData[] {\r\n return entities.map((entity) => {\r\n if (entity.normalizedKey !== 'Actual_Progress') {\r\n return entity;\r\n }\r\n\r\n return {\r\n ...entity,\r\n configuration: {\r\n ...(entity.configuration ?? {}),\r\n color,\r\n },\r\n };\r\n });\r\n }\r\n\r\n private toDashboardData(\r\n data: ClientListInformativeDashboardPayload,\r\n title: string,\r\n ): DashboardBuilderData {\r\n const filters = data.filters;\r\n const charts: DashboardChartItem[] = (data.chartLinks ?? []).map((link) => {\r\n const configuration = link.configuration ?? {};\r\n\r\n return {\r\n ...configuration,\r\n id: link.id,\r\n chartComponentId: link.chartComponentId,\r\n } as DashboardChartItem;\r\n });\r\n\r\n return {\r\n page: {\r\n id: data.moduleId,\r\n name: { en: title, ar: title },\r\n type: 'Dashboard',\r\n dashboardConfig: {\r\n ignoreQueryFilter: data.ignoreQueryFilter,\r\n filters: data.filters,\r\n versionNumber: data.versionNumber,\r\n extraInfo: data.extraInfo,\r\n },\r\n },\r\n charts,\r\n dialogs: [],\r\n filters: Array.isArray(filters) ? [...filters] : filters ? [filters] : [],\r\n };\r\n }\r\n}\r\n","import { Injectable, computed, inject, signal } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { map, Observable, share, take } from 'rxjs';\r\nimport { RuntimeAction } from '@masterteam/components/runtime-action';\r\nimport {\r\n ClientListRuntimeRecordActionsConfig,\r\n ClientListRuntimeRecordActionsContext,\r\n RuntimeTableDisplayRow,\r\n} from '../models/client-list.model';\r\n\r\ninterface CachedActions {\r\n actions: RuntimeAction[];\r\n fetchedAt: number;\r\n}\r\n\r\ninterface RuntimeActionsResponse {\r\n code: number;\r\n data?: { actions?: RuntimeAction[] };\r\n}\r\n\r\nconst DEFAULT_ENDPOINT = 'LevelData/{instanceId}/workspace-record-actions';\r\nconst DEFAULT_CACHE_TTL_MS = 60_000;\r\nconst DEFAULT_TARGET_TYPE = 'ModuleData';\r\n\r\n/**\r\n * Lazy per-row runtime actions. Fetches `workspace-record-actions` only when\r\n * the row's 3-dots menu is opened (or for every visible row when the list\r\n * opts in to `eager`), with per-row caching, in-flight dedupe, and a single\r\n * cache-invalidation hook tied to action execution.\r\n */\r\n@Injectable()\r\nexport class ClientListRuntimeActionsService {\r\n private readonly http = inject(HttpClient);\r\n\r\n private readonly cache = signal<ReadonlyMap<string, CachedActions>>(\r\n new Map(),\r\n );\r\n private readonly inFlightKeys = signal<ReadonlySet<string>>(new Set());\r\n private readonly inFlight = new Map<string, Observable<RuntimeAction[]>>();\r\n\r\n /** Actions keyed by `${listKey}:${recordId}`. */\r\n readonly actionsByRowKey = computed<ReadonlyMap<string, RuntimeAction[]>>(\r\n () => {\r\n const out = new Map<string, RuntimeAction[]>();\r\n for (const [key, value] of this.cache()) {\r\n out.set(key, value.actions);\r\n }\r\n return out;\r\n },\r\n );\r\n\r\n /** Row keys currently being fetched. Drives the popover skeleton state. */\r\n readonly loadingRowKeys = this.inFlightKeys.asReadonly();\r\n\r\n rowKey(listKey: string, recordId: number): string {\r\n return `${listKey}:${recordId}`;\r\n }\r\n\r\n has(\r\n listKey: string,\r\n recordId: number,\r\n ttlMs: number | null | undefined,\r\n ): boolean {\r\n const key = this.rowKey(listKey, recordId);\r\n const entry = this.cache().get(key);\r\n if (!entry) return false;\r\n if (ttlMs == null) return true;\r\n return Date.now() - entry.fetchedAt < ttlMs;\r\n }\r\n\r\n /**\r\n * Fetch (or reuse cached/in-flight) per-row runtime actions for a row.\r\n * Returns an Observable so callers can chain off the result; the cache and\r\n * loading signals are also kept in sync so the table popover skeleton and\r\n * the merged-actions computation react automatically.\r\n */\r\n request(\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): Observable<RuntimeAction[]> {\r\n const key = this.rowKey(ctx.listKey, ctx.recordId);\r\n const ttl = config.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;\r\n const cached = this.cache().get(key);\r\n if (cached && (ttl == null || Date.now() - cached.fetchedAt < ttl)) {\r\n const actions = cached.actions;\r\n return new Observable<RuntimeAction[]>((subscriber) => {\r\n subscriber.next(actions);\r\n subscriber.complete();\r\n });\r\n }\r\n\r\n const inFlight = this.inFlight.get(key);\r\n if (inFlight) {\r\n return inFlight;\r\n }\r\n\r\n const url = this.resolveEndpoint(config.endpoint ?? DEFAULT_ENDPOINT, ctx);\r\n const params = this.buildParams(config, ctx);\r\n\r\n this.markLoading(key, true);\r\n\r\n const obs = this.http.get<RuntimeActionsResponse>(url, { params }).pipe(\r\n map((response) =>\r\n response?.code === 1 ? (response.data?.actions ?? []) : [],\r\n ),\r\n share(),\r\n );\r\n\r\n this.inFlight.set(key, obs);\r\n\r\n obs.pipe(take(1)).subscribe({\r\n next: (actions) => {\r\n this.writeCache(key, actions);\r\n this.markLoading(key, false);\r\n this.inFlight.delete(key);\r\n },\r\n error: () => {\r\n this.writeCache(key, []);\r\n this.markLoading(key, false);\r\n this.inFlight.delete(key);\r\n },\r\n });\r\n\r\n return obs;\r\n }\r\n\r\n invalidateRow(listKey: string, recordId: number): void {\r\n const key = this.rowKey(listKey, recordId);\r\n this.cache.update((current) => {\r\n if (!current.has(key)) return current;\r\n const next = new Map(current);\r\n next.delete(key);\r\n return next;\r\n });\r\n }\r\n\r\n invalidateList(listKey: string): void {\r\n const prefix = `${listKey}:`;\r\n this.cache.update((current) => {\r\n let changed = false;\r\n const next = new Map(current);\r\n for (const key of next.keys()) {\r\n if (key.startsWith(prefix)) {\r\n next.delete(key);\r\n changed = true;\r\n }\r\n }\r\n return changed ? next : current;\r\n });\r\n }\r\n\r\n clearAll(): void {\r\n this.cache.set(new Map());\r\n }\r\n\r\n private writeCache(key: string, actions: RuntimeAction[]): void {\r\n this.cache.update((current) => {\r\n const next = new Map(current);\r\n next.set(key, { actions, fetchedAt: Date.now() });\r\n return next;\r\n });\r\n }\r\n\r\n private markLoading(key: string, loading: boolean): void {\r\n this.inFlightKeys.update((current) => {\r\n const next = new Set(current);\r\n if (loading) next.add(key);\r\n else next.delete(key);\r\n return next;\r\n });\r\n }\r\n\r\n private resolveEndpoint(\r\n template: string,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): string {\r\n const instanceId = ctx.instanceId ?? '';\r\n return template\r\n .replace('{instanceId}', String(instanceId))\r\n .replace('{listKey}', ctx.listKey)\r\n .replace('{moduleId}', String(ctx.moduleId))\r\n .replace('{recordId}', String(ctx.recordId));\r\n }\r\n\r\n private buildParams(\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): Record<string, string | number> {\r\n if (config.buildParams) {\r\n return config.buildParams(ctx);\r\n }\r\n\r\n const moduleKey = config.resolveModuleKey?.(ctx.row, {\r\n listKey: ctx.listKey,\r\n moduleId: ctx.moduleId,\r\n });\r\n\r\n const params: Record<string, string | number> = {\r\n targetType: DEFAULT_TARGET_TYPE,\r\n targetId: ctx.recordId,\r\n };\r\n\r\n if (moduleKey) {\r\n params['moduleKey'] = moduleKey;\r\n }\r\n\r\n return params;\r\n }\r\n}\r\n\r\nexport function defaultResolveRecordId(\r\n row: RuntimeTableDisplayRow,\r\n): number | null {\r\n const candidates = ['Id', 'id', 'ModuleDataId'] as const;\r\n for (const key of candidates) {\r\n const value = row[key];\r\n if (typeof value === 'number' && Number.isFinite(value)) return value;\r\n if (typeof value === 'string') {\r\n const parsed = Number(value);\r\n if (Number.isFinite(parsed)) return parsed;\r\n }\r\n }\r\n return null;\r\n}\r\n","import { Injectable, signal, WritableSignal } from '@angular/core';\r\nimport { TableFilters } from '@masterteam/components/table';\r\n\r\n/**\r\n * Toolbar state for a single client-list instance: search term, column filters,\r\n * group column, and active tab. Kept as mutable signals so both the table view\r\n * and the cards view can two-way bind to the same source of truth and stay in\r\n * sync when the user toggles between them.\r\n */\r\nexport interface ClientListToolbarBucket {\r\n filters: WritableSignal<TableFilters>;\r\n filterTerm: WritableSignal<string>;\r\n groupBy: WritableSignal<string | null>;\r\n activeTab: WritableSignal<any>;\r\n}\r\n\r\n/**\r\n * Per-list toolbar state holder. Buckets are keyed by list `key` (see\r\n * `ClientListBaseState.key`) so switching between table and cards for the same\r\n * list carries search/filter/group/tab forward. In-memory only — per-component\r\n * `storageKey` persistence on the underlying mt-table continues to handle\r\n * refresh-resilient hydration.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientListToolbarService {\r\n private readonly buckets = new Map<string, ClientListToolbarBucket>();\r\n\r\n forList(key: string): ClientListToolbarBucket {\r\n let bucket = this.buckets.get(key);\r\n if (!bucket) {\r\n bucket = {\r\n filters: signal<TableFilters>({}),\r\n filterTerm: signal<string>(''),\r\n groupBy: signal<string | null>(null),\r\n activeTab: signal<any>(null),\r\n };\r\n this.buckets.set(key, bucket);\r\n }\r\n return bucket;\r\n }\r\n\r\n clear(key: string): void {\r\n this.buckets.delete(key);\r\n }\r\n}\r\n","import { Component, computed, inject, input, output } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport {\r\n Table,\r\n TableAction,\r\n TableActionShape,\r\n} from '@masterteam/components/table';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport {\r\n ClientListContentTemplateContext,\r\n ClientListLazyLoadEvent,\r\n RuntimeTableDisplayRow,\r\n ClientListState,\r\n ClientListTableState,\r\n} from '../../models/client-list.model';\r\nimport { ClientListToolbarService } from '../../services/client-list-toolbar';\r\n\r\nconst DEFAULT_GRID_COLUMNS = 12;\r\n\r\n@Component({\r\n selector: 'mt-client-list-table-view',\r\n standalone: true,\r\n imports: [CommonModule, Table, SkeletonModule],\r\n templateUrl: './client-list-table-view.html',\r\n})\r\nexport class ClientListTableView {\r\n private readonly toolbar = inject(ClientListToolbarService);\r\n\r\n readonly state = input.required<ClientListState>();\r\n readonly rowActions = input<TableAction[]>([]);\r\n readonly actionShape = input<TableActionShape | undefined>(undefined);\r\n readonly rowActionsLoadingFn = input<\r\n ((row: RuntimeTableDisplayRow) => boolean) | null\r\n >(null);\r\n readonly lazyLoad = output<ClientListLazyLoadEvent>();\r\n readonly rowClick = output<RuntimeTableDisplayRow>();\r\n readonly rowActionsRequested = output<RuntimeTableDisplayRow>();\r\n\r\n protected readonly table = computed(() => {\r\n return this.state() as ClientListTableState;\r\n });\r\n\r\n /**\r\n * Shared toolbar bucket (search / filters / groupBy / activeTab) keyed by\r\n * list identity. The cards view for the same list resolves the same bucket\r\n * so switching area types preserves the toolbar state.\r\n */\r\n protected readonly bucket = computed(() =>\r\n this.toolbar.forList(this.state().key),\r\n );\r\n\r\n protected readonly pageSize = computed(() => {\r\n const table = this.table();\r\n return table.config.isPaginated ? table.take : table.config.table.pageSize;\r\n });\r\n\r\n /**\r\n * Stable, per-instance storage key. Excludes `areaType` so table and cards\r\n * views for the same logical list share persistence (matches the toolbar\r\n * bucket sharing behaviour).\r\n */\r\n protected readonly tableStorageKey = computed<string | null>(() => {\r\n const s = this.state();\r\n const cfg = s.config;\r\n const parts = [\r\n 'client-list',\r\n s.key,\r\n cfg.type,\r\n cfg.contextKey ?? '',\r\n cfg.moduleId ?? '',\r\n cfg.instanceId ?? '',\r\n ];\r\n const key = parts\r\n .map((p) => String(p ?? ''))\r\n .filter((p) => p.length > 0)\r\n .join(':');\r\n return key.length > 'client-list'.length ? key : null;\r\n });\r\n\r\n protected readonly gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;\r\n\r\n protected slotGridSpan(span: number): string {\r\n return `span ${span} / span ${span}`;\r\n }\r\n\r\n protected templateContext(\r\n item: ClientListState,\r\n ): ClientListContentTemplateContext {\r\n return {\r\n $implicit: item,\r\n table: item,\r\n item,\r\n loading: item.loading,\r\n error: item.error,\r\n data: item.rawData,\r\n };\r\n }\r\n}\r\n","<div class=\"grid gap-4\" [style.gridTemplateColumns]=\"gridTemplateColumns\">\n @if (table().config.contentStart) {\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.startSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table().config.contentStart\"\n [ngTemplateOutletContext]=\"templateContext(table())\"\n />\n </div>\n }\n\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.tableSpan)\">\n @if (table().loading && table().rows.length === 0) {\n <div class=\"flex flex-col gap-3 py-3\">\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n </div>\n } @else if (table().error) {\n <div\n class=\"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ table().error }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"table().rows\"\n [columns]=\"table().columns\"\n dataKey=\"Id\"\n [storageKey]=\"tableStorageKey()\"\n [persistStateExclude]=\"table().config.table.persistStateExclude\"\n [captionStartTemplate]=\"table().config.toolbarStart ?? null\"\n [captionEndTemplate]=\"table().config.toolbarEnd ?? null\"\n [rowActions]=\"rowActions()\"\n [actionShape]=\"actionShape()\"\n [rowActionsLoadingFn]=\"rowActionsLoadingFn()\"\n (rowActionsRequested)=\"rowActionsRequested.emit($event)\"\n [generalSearch]=\"table().config.table.searchable\"\n [showFilters]=\"true\"\n filterMode=\"column\"\n [printable]=\"true\"\n [groupable]=\"true\"\n [cellClickFilter]=\"true\"\n [freezeActions]=\"true\"\n [exportable]=\"table().config.table.exportable\"\n [loading]=\"table().loading\"\n [clickableRows]=\"true\"\n [lazy]=\"table().config.isPaginated\"\n [lazyTotalRecords]=\"table().totalCount\"\n [virtualScroll]=\"!table().config.isPaginated\"\n [virtualScrollItemSize]=\"56\"\n scrollHeight=\"520px\"\n [pageSize]=\"pageSize()\"\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 (lazyLoad)=\"lazyLoad.emit($event)\"\n (rowClick)=\"rowClick.emit($event)\"\n />\n }\n </div>\n\n @if (table().config.contentEnd) {\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.endSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table().config.contentEnd\"\n [ngTemplateOutletContext]=\"templateContext(table())\"\n />\n </div>\n }\n</div>\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n ElementRef,\r\n inject,\r\n input,\r\n output,\r\n Signal,\r\n signal,\r\n untracked,\r\n viewChild,\r\n WritableSignal,\r\n} from '@angular/core';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoModule, TranslocoService } from '@jsverse/transloco';\r\nimport { Card } from '@masterteam/components/card';\r\nimport { EmptyState } from '@masterteam/components/empty-state';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { ConfirmationService } from '@masterteam/components/confirmation';\r\nimport {\r\n MTDateFormatPipe,\r\n type MTDateFormatType,\r\n} from '@masterteam/components';\r\nimport {\r\n EntitiesPreview,\r\n EntityClickEvent,\r\n type LeafDetailsEntityValue,\r\n} from '@masterteam/components/entities';\r\nimport { readableTextOn } from '@masterteam/components';\r\nimport {\r\n ColumnDef,\r\n TableAction,\r\n TableCaption,\r\n TableExportService,\r\n TableGroupingController,\r\n TableValueResolver,\r\n} from '@masterteam/components/table';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport { PopoverModule } from 'primeng/popover';\r\nimport {\r\n CLIENT_LIST_RECORD_STATE_KEY,\r\n ClientListCard,\r\n ClientListCardsState,\r\n ClientListLazyLoadEvent,\r\n ClientListState,\r\n RuntimeEntityColumnDef,\r\n RuntimeTableDisplayRow,\r\n} from '../../models/client-list.model';\r\nimport { ClientListToolbarService } from '../../services/client-list-toolbar';\r\n\r\nconst EMPTY_KEY_SET: ReadonlySet<string> = new Set();\r\n\r\n/** A card's visible actions, pre-split into the buckets the template renders. */\r\ninterface CardActionSet {\r\n inline: TableAction[];\r\n menu: TableAction[];\r\n escalationMarker: TableAction | null;\r\n}\r\n\r\n/** Shared fallback so cards without an entry keep a stable identity. */\r\nconst EMPTY_CARD_ACTION_SET: CardActionSet = {\r\n inline: [],\r\n menu: [],\r\n escalationMarker: null,\r\n};\r\n\r\n/**\r\n * How far ahead of the viewport the infinite-scroll sentinel counts as\r\n * visible — roughly one card row, so the next page is already in flight by\r\n * the time the user reaches the bottom of the grid.\r\n */\r\nconst LOAD_MORE_ROOT_MARGIN = '400px';\r\n\r\n/** Deleting, or anything the caller flagged `danger`. Mirrors `mt-table`. */\r\nfunction isDestructiveAction(action: TableAction | undefined): boolean {\r\n if (!action) {\r\n return false;\r\n }\r\n return (\r\n action.color === 'danger' ||\r\n action.confirmation?.confirmationType === 'delete'\r\n );\r\n}\r\n\r\n/** Matches the neutral fallback `mt-entity-leaf-details` paints an uncoloured status. */\r\nconst DEFAULT_BADGE_COLOR = '#9CA3AF';\r\n\r\n/** One entry of the board-level legend decoding the coloured count badges. */\r\ninterface CardBadgeLegendEntry {\r\n key: string;\r\n label: string;\r\n color: string;\r\n textColor: string;\r\n}\r\n\r\ninterface CardGroup {\r\n key: string;\r\n columnLabel: string;\r\n label: string;\r\n accent: string | null;\r\n count: number;\r\n cards: ClientListCard[];\r\n}\r\n\r\ntype ClientListPlacedTableAction = TableAction & {\r\n placement?: 'menu' | 'inline';\r\n size?: 'small' | 'large';\r\n cardMarker?: 'escalation';\r\n};\r\n\r\n@Component({\r\n selector: 'mt-client-list-cards-view',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n TranslocoModule,\r\n Card,\r\n Button,\r\n Tooltip,\r\n Icon,\r\n EntitiesPreview,\r\n SkeletonModule,\r\n PopoverModule,\r\n TableCaption,\r\n EmptyState,\r\n ],\r\n providers: [MTDateFormatPipe],\r\n templateUrl: './client-list-cards-view.html',\r\n styleUrl: './client-list-cards-view.css',\r\n})\r\nexport class ClientListCardsView {\r\n private readonly toolbar = inject(ClientListToolbarService);\r\n private readonly exportService = inject(TableExportService);\r\n private readonly dateFormat = inject(MTDateFormatPipe);\r\n private readonly confirmationService = inject(ConfirmationService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly state = input.required<ClientListState>();\r\n readonly rowActions = input<TableAction[]>([]);\r\n /** Per-card loading predicate — drives the popover skeleton while runtime\r\n * actions are being fetched. Mirrors the table view's `rowActionsLoadingFn`;\r\n * the predicate operates on the card's row representation (`{ Id, ... }`). */\r\n readonly rowActionsLoadingFn = input<\r\n ((row: RuntimeTableDisplayRow) => boolean) | null\r\n >(null);\r\n readonly lazyLoad = output<ClientListLazyLoadEvent>();\r\n /** Emitted when the infinite-scroll sentinel enters the viewport and more\r\n * pages remain — the parent responds by fetching and appending the next\r\n * page of cards. Only relevant when `config.isPaginated` is true. */\r\n readonly loadMore = output<void>();\r\n readonly cardClick = output<ClientListCard>();\r\n /** Emitted when a card's 3-dots menu opens, so the parent can lazily fetch\r\n * that record's runtime actions (same contract as the table view). */\r\n readonly rowActionsRequested = output<RuntimeTableDisplayRow>();\r\n\r\n protected readonly cardsState = computed(\r\n () => this.state() as ClientListCardsState,\r\n );\r\n\r\n /** True while backend pagination is enabled and more pages remain to\r\n * fetch — drives the infinite-scroll sentinel's visibility. */\r\n protected readonly hasMoreCards = computed(\r\n () =>\r\n this.cardsState().config.isPaginated &&\r\n this.cardsState().cards.length < this.cardsState().totalCount,\r\n );\r\n\r\n /** Anchor element rendered at the end of the grid when more cards remain;\r\n * observed so scrolling it into view triggers `loadMore`. */\r\n private readonly loadMoreSentinel =\r\n viewChild<ElementRef<HTMLElement>>('loadMoreSentinel');\r\n private loadMoreObserver: IntersectionObserver | null = null;\r\n\r\n /** Shared toolbar bucket — same instance the table view uses. */\r\n protected readonly bucket = computed(() =>\r\n this.toolbar.forList(this.state().key),\r\n );\r\n\r\n /** True while a column filter or search term is active — drives the\r\n * reset button's visibility in the caption toolbar. */\r\n protected readonly hasActiveFilter = computed(\r\n () =>\r\n Object.keys(this.bucket().filters()).length > 0 ||\r\n this.bucket().filterTerm().trim().length > 0,\r\n );\r\n\r\n /**\r\n * A language-reactive label.\r\n *\r\n * `translate()` is a plain call, not a signal, so a computed that used it\r\n * directly would keep the label in whatever language was active when it\r\n * first ran. `selectTranslate` re-emits on language switch *and* once the\r\n * new language's file has loaded.\r\n *\r\n * Every label the card loop needs is hoisted through here rather than left\r\n * as `| transloco` in the template: that pipe is impure, so each occurrence\r\n * inside the loop was one more pipe instance re-running on every check of\r\n * every card in the grid.\r\n */\r\n private label(key: string): Signal<string> {\r\n return toSignal(this.transloco.selectTranslate<string>(key), {\r\n initialValue: this.transloco.translate<string>(key),\r\n });\r\n }\r\n\r\n private readonly resetLabel = this.label('components.table.reset');\r\n\r\n /** Entity click-to-filter affordance tooltips, one instance for the grid. */\r\n protected readonly filterByThisLabel = this.label(\r\n 'components.table.filterByThis',\r\n );\r\n protected readonly clearFilterLabel = this.label(\r\n 'components.table.clearFilter',\r\n );\r\n protected readonly actionsLabel = this.label('components.table.actions');\r\n protected readonly escalationLabel = this.label(\r\n 'components.clientComponents.list.hasActiveEscalation',\r\n );\r\n\r\n /** Caption toolbar action: clears both column filters and the search\r\n * term. For paginated (server-driven) cards this also re-triggers the\r\n * filter-change effect below, which re-fetches page 1 without any\r\n * filters/search — i.e. reloads the full unfiltered set. */\r\n protected readonly toolbarActions = computed<TableAction[]>(() =>\r\n this.hasActiveFilter()\r\n ? [\r\n {\r\n icon: 'arrow.refresh-cw-01',\r\n color: 'secondary',\r\n variant: 'text',\r\n tooltip: this.resetLabel(),\r\n label: this.resetLabel(),\r\n action: () => this.resetFilters(),\r\n },\r\n ]\r\n : [],\r\n );\r\n\r\n protected resetFilters(): void {\r\n this.bucket().filters.set({});\r\n this.bucket().filterTerm.set('');\r\n }\r\n\r\n /**\r\n * Columns for filter/group/export. `state.columns` is empty for cards area\r\n * (the state service doesn't populate it — see `setCardsResult`), so we\r\n * reconstruct `ColumnDef[]` from the first card's entity metadata. Each\r\n * entity carries its `key`, `name` (label), and `viewType`, which is\r\n * everything `TableValueResolver.getColumnFilterType` needs to classify\r\n * filter behaviour (select / boolean / date / user / text).\r\n */\r\n protected readonly columns = computed<ColumnDef[]>(() => {\r\n const fromState = this.state().columns;\r\n if (fromState && fromState.length > 0) return fromState;\r\n\r\n const sampleCard = this.cardsState().cards[0];\r\n if (!sampleCard?.entities?.length) return [];\r\n\r\n // Section markers are card-layout only — never table columns.\r\n return sampleCard.entities\r\n .filter((entity) => entity.viewType !== 'Section')\r\n .map((entity): RuntimeEntityColumnDef => {\r\n const raw = entity as unknown as Record<string, unknown>;\r\n const key =\r\n (typeof raw['key'] === 'string' && raw['key']) ||\r\n (typeof raw['normalizedKey'] === 'string' && raw['normalizedKey']) ||\r\n entity.name;\r\n return {\r\n key: String(key),\r\n normalizedKey:\r\n typeof raw['normalizedKey'] === 'string'\r\n ? raw['normalizedKey']\r\n : String(key),\r\n label: entity.name ?? String(key),\r\n type: 'entity',\r\n viewType: (entity.viewType ?? 'Text') as string,\r\n };\r\n });\r\n });\r\n\r\n /**\r\n * Row view of each card. Cards carry their data as `entities: EntityData[]`,\r\n * not as a pre-built record, so we rebuild the row shape mt-table expects:\r\n * `{ [entityKey]: EntityData | scalar }`. Falls back to `displayProperties`\r\n * if a newer backend populates it. Row index matches card index so we can\r\n * look up by position elsewhere.\r\n */\r\n protected readonly rowRepresentations = computed<Record<string, unknown>[]>(\r\n () => this.cardsState().cards.map((card) => this.cardToRow(card)),\r\n );\r\n\r\n private cardToRow(card: ClientListCard): Record<string, unknown> {\r\n const fromDisplay = card.displayProperties as\r\n | Record<string, unknown>\r\n | undefined;\r\n const record: Record<string, unknown> =\r\n fromDisplay && Object.keys(fromDisplay).length > 0\r\n ? {\r\n Id: card.id,\r\n ...fromDisplay,\r\n [CLIENT_LIST_RECORD_STATE_KEY]: card.state ?? null,\r\n }\r\n : { Id: card.id, [CLIENT_LIST_RECORD_STATE_KEY]: card.state ?? null };\r\n\r\n for (const entity of card.entities ?? []) {\r\n if (entity.viewType === 'Section') continue;\r\n const e = entity as unknown as Record<string, unknown>;\r\n const key =\r\n (typeof e['key'] === 'string' && e['key']) ||\r\n (typeof e['normalizedKey'] === 'string' && e['normalizedKey']) ||\r\n entity.name;\r\n const normalizedKey =\r\n typeof e['normalizedKey'] === 'string' ? e['normalizedKey'] : null;\r\n const keys = new Set(\r\n [key, normalizedKey].filter(\r\n (entry): entry is string =>\r\n typeof entry === 'string' && entry.length > 0,\r\n ),\r\n );\r\n\r\n for (const entityKey of keys) {\r\n record[entityKey] = entity;\r\n }\r\n }\r\n return record;\r\n }\r\n\r\n /**\r\n * Stable card → row lookup. Row actions (and their `hidden` / `action`\r\n * callbacks plus the loading predicate) are authored against the table's\r\n * row shape — `{ Id, ...entities }` — so every action interaction routes the\r\n * card through `cardToRow` first. Memoized per card so repeated `hidden`\r\n * evaluations in the template don't rebuild the record each call.\r\n */\r\n private readonly rowByCard = computed<\r\n ReadonlyMap<ClientListCard, RuntimeTableDisplayRow>\r\n >(() => {\r\n const map = new Map<ClientListCard, RuntimeTableDisplayRow>();\r\n for (const card of this.cardsState().cards) {\r\n map.set(card, this.cardToRow(card));\r\n }\r\n return map;\r\n });\r\n\r\n protected rowForCard(card: ClientListCard): RuntimeTableDisplayRow {\r\n return this.rowByCard().get(card) ?? this.cardToRow(card);\r\n }\r\n\r\n /**\r\n * Every card's actions, already filtered by `hidden` and split into the\r\n * three buckets the template renders (inline buttons, 3-dots menu,\r\n * escalation corner marker).\r\n *\r\n * Memoized rather than derived per template call on purpose: the four call\r\n * sites below each used to re-run `hidden()` across the whole action list,\r\n * so a single card cost four full passes — on every change detection tick,\r\n * for every card in the grid. `rowActions()` is rebuilt with a new array\r\n * identity whenever the runtime-action cache its predicates close over\r\n * changes, so this stays correct without re-evaluating on every pass.\r\n */\r\n private readonly actionsByCard = computed<\r\n ReadonlyMap<ClientListCard, CardActionSet>\r\n >(() => {\r\n const actions = this.rowActions();\r\n const rows = this.rowByCard();\r\n const map = new Map<ClientListCard, CardActionSet>();\r\n\r\n for (const card of this.cardsState().cards) {\r\n const row = rows.get(card) ?? this.cardToRow(card);\r\n const inline: TableAction[] = [];\r\n const menu: TableAction[] = [];\r\n let escalationMarker: TableAction | null = null;\r\n\r\n for (const action of actions) {\r\n if (action.hidden?.(row)) continue;\r\n\r\n if (this.isCardMarkerAction(action)) {\r\n escalationMarker ??= action;\r\n menu.push(action);\r\n } else if (this.actionPlacement(action) === 'inline') {\r\n inline.push(action);\r\n } else {\r\n menu.push(action);\r\n }\r\n }\r\n\r\n // Destructive actions last, so the irreversible one is never adjacent to\r\n // the two most common ones (finding M-07). Sorted here rather than at\r\n // read time so it costs one pass per card, not one per change detection.\r\n map.set(card, {\r\n inline,\r\n menu: [\r\n ...menu.filter((action) => !isDestructiveAction(action)),\r\n ...menu.filter((action) => isDestructiveAction(action)),\r\n ],\r\n escalationMarker,\r\n });\r\n }\r\n\r\n return map;\r\n });\r\n\r\n private actionsFor(card: ClientListCard): CardActionSet {\r\n return this.actionsByCard().get(card) ?? EMPTY_CARD_ACTION_SET;\r\n }\r\n\r\n protected inlineActionsForCard(card: ClientListCard): TableAction[] {\r\n return this.actionsFor(card).inline;\r\n }\r\n\r\n protected escalationMarkerAction(card: ClientListCard): TableAction | null {\r\n return this.actionsFor(card).escalationMarker;\r\n }\r\n\r\n /**\r\n * Menu actions with the destructive ones moved to the bottom, matching the\r\n * table's row menu. A card and a row are the same record in two shapes, so\r\n * the irreversible action has to sit in the same place in both (finding\r\n * M-07).\r\n */\r\n protected menuActionsForCard(card: ClientListCard): TableAction[] {\r\n return this.actionsFor(card).menu;\r\n }\r\n\r\n /** Whether the user narrowed the board themselves — drives the empty state. */\r\n protected hasActiveCardFilters(): boolean {\r\n const bucket = this.bucket();\r\n if (bucket.filterTerm().trim().length > 0) {\r\n return true;\r\n }\r\n\r\n return Object.entries(bucket.filters()).some(\r\n ([key, value]) =>\r\n key !== 'generalSearch' &&\r\n value !== null &&\r\n value !== undefined &&\r\n value !== '',\r\n );\r\n }\r\n\r\n protected clearCardFilters(): void {\r\n this.bucket().filterTerm.set('');\r\n this.bucket().filters.set({});\r\n }\r\n\r\n /** True at the first destructive item — where the divider is drawn. */\r\n protected isFirstDestructiveCardAction(\r\n card: ClientListCard,\r\n index: number,\r\n ): boolean {\r\n const menu = this.menuActionsForCard(card);\r\n const action = menu[index];\r\n return (\r\n index > 0 &&\r\n !!action &&\r\n isDestructiveAction(action) &&\r\n !isDestructiveAction(menu[index - 1])\r\n );\r\n }\r\n\r\n protected showCardActionsMenu(card: ClientListCard): boolean {\r\n return (\r\n this.isCardActionsLoading(card) || this.actionsFor(card).menu.length > 0\r\n );\r\n }\r\n\r\n protected resolveActionLoading(\r\n action: TableAction,\r\n card: ClientListCard,\r\n ): boolean | undefined {\r\n const loading = action.loading;\r\n if (typeof loading === 'function') {\r\n return loading(this.rowForCard(card));\r\n }\r\n return typeof loading === 'boolean' ? loading : undefined;\r\n }\r\n\r\n protected actionSize(action: TableAction): 'small' | 'large' | undefined {\r\n return (action as ClientListPlacedTableAction).size;\r\n }\r\n\r\n private actionPlacement(action: TableAction): 'menu' | 'inline' | undefined {\r\n return (action as ClientListPlacedTableAction).placement;\r\n }\r\n\r\n private isCardMarkerAction(action: TableAction): boolean {\r\n return (action as ClientListPlacedTableAction).cardMarker === 'escalation';\r\n }\r\n\r\n protected isCardActionsLoading(card: ClientListCard): boolean {\r\n return this.rowActionsLoadingFn()?.(this.rowForCard(card)) ?? false;\r\n }\r\n\r\n /**\r\n * Open handler for a card's 3-dots menu. Emits `rowActionsRequested` so the\r\n * parent lazily fetches runtime actions for this record, then toggles the\r\n * popover — identical to the table view's `onRowActionsToggle`.\r\n */\r\n protected onCardActionsToggle(\r\n event: Event,\r\n popover: { toggle: (e: Event) => void },\r\n card: ClientListCard,\r\n ): void {\r\n this.rowActionsRequested.emit(this.rowForCard(card));\r\n popover.toggle(event);\r\n }\r\n\r\n /** Run a card action, honouring optional confirmation — same flow as the\r\n * table view's `rowAction`. */\r\n protected runCardAction(\r\n event: Event,\r\n action: TableAction,\r\n card: ClientListCard,\r\n ): void {\r\n const row = this.rowForCard(card);\r\n if (!action.confirmation) {\r\n action.action(row);\r\n return;\r\n }\r\n\r\n if (action.confirmation.confirmationType === 'delete') {\r\n this.confirmationService.confirmDelete({\r\n event,\r\n ...action.confirmation,\r\n accept: () => action.action(row),\r\n reject: () => {},\r\n });\r\n return;\r\n }\r\n\r\n this.confirmationService.confirm({\r\n event,\r\n ...action.confirmation,\r\n accept: () => action.action(row),\r\n reject: () => {},\r\n });\r\n }\r\n\r\n // Local throwaway signals for the grouping controller's sort arguments —\r\n // cards don't sort via column click so the controller's sort-pinning\r\n // side-effect is a no-op here.\r\n private readonly noopSortField = signal<string | null>(null);\r\n private readonly noopSortDir = signal<'asc' | 'desc' | null>(null);\r\n\r\n /**\r\n * Writable proxy around `bucket().groupBy` — the grouping controller wants a\r\n * `WritableSignal<string | null>`. Reads delegate to the current bucket's\r\n * signal; writes mutate it via `.set()`. This keeps the controller's\r\n * `setGroup()` side-effect safe even though cards view callers never invoke\r\n * it today.\r\n */\r\n private readonly groupBySignal: WritableSignal<string | null> = (() => {\r\n const read = computed(() => this.bucket().groupBy());\r\n const proxy = ((...args: [] | [string | null]) =>\r\n args.length === 0 ? read() : this.bucket().groupBy.set(args[0]!)) as any;\r\n proxy.set = (value: string | null) => this.bucket().groupBy.set(value);\r\n proxy.update = (fn: (value: string | null) => string | null) =>\r\n this.bucket().groupBy.set(fn(this.bucket().groupBy()));\r\n proxy.asReadonly = () => read;\r\n return proxy as WritableSignal<string | null>;\r\n })();\r\n\r\n /**\r\n * Grouping controller bound to the shared toolbar bucket, so picking a group\r\n * in the cards menu surfaces in the table view's group header (and vice\r\n * versa) when the user toggles area types.\r\n */\r\n protected readonly grouping = new TableGroupingController(\r\n this.columns,\r\n this.rowRepresentations,\r\n this.groupBySignal,\r\n this.noopSortField,\r\n this.noopSortDir,\r\n );\r\n\r\n /**\r\n * Visible (after search + filters) cards. Backend-paginated lists re-query\r\n * on filter change so `cards` already reflects the server response and this\r\n * just passes through; local lists filter in-place.\r\n */\r\n protected readonly visibleCards = computed<ClientListCard[]>(() => {\r\n const state = this.cardsState();\r\n const isLazy = state.config.isPaginated;\r\n const cards = state.cards;\r\n\r\n if (isLazy) return cards;\r\n\r\n const term = this.bucket().filterTerm().trim().toLowerCase();\r\n const filters = this.bucket().filters();\r\n const columns = this.columns();\r\n const filterKeys = Object.keys(filters);\r\n\r\n return cards.filter((card, index) => {\r\n const row = this.rowRepresentations()[index] ?? {};\r\n\r\n // Row values are EntityData envelopes (`{ name, value, viewType, ... }`),\r\n // identical to the shape mt-table builds. Reuse its recursive matcher so\r\n // the cards view searches every nested property value exactly like the\r\n // table view. The old shallow `resolveDisplayValue(value)` returned the\r\n // entity's `name` (field label) instead of its `value`, so every\r\n // value-based search missed and the grid was always \"not found\".\r\n if (term && !TableValueResolver.matchesSearchTerm(row, term)) {\r\n return false;\r\n }\r\n\r\n if (filterKeys.length === 0) return true;\r\n return filterKeys.every((key) => {\r\n if (key === 'generalSearch') return true;\r\n const column = columns.find((c) => c.key === key);\r\n return TableValueResolver.matchesFilter(row, key, filters[key], column);\r\n });\r\n });\r\n });\r\n\r\n /**\r\n * Legend for the coloured count badges the cards carry.\r\n *\r\n * Each card renders a cluster of small coloured pills under a level name\r\n * (\"Programs (2)\") and, before this, nothing on the card or on the page said\r\n * what the colours counted — a convention you either had been told offline or\r\n * could not decode (finding M-04). The per-badge tooltip names one status at\r\n * a time; this names the whole set once, above the board, so the mapping is\r\n * readable without hovering anything.\r\n *\r\n * Built from the cards actually on screen rather than from a catalog call:\r\n * the statuses in play are exactly the ones the board is showing, and a\r\n * legend listing statuses that appear nowhere would be its own noise. Empty\r\n * when no card carries a badge cluster, so boards without them are unchanged.\r\n */\r\n protected readonly badgeLegend = computed<CardBadgeLegendEntry[]>(() => {\r\n const entries = new Map<string, CardBadgeLegendEntry>();\r\n\r\n for (const card of this.visibleCards()) {\r\n for (const entity of card.entities ?? []) {\r\n if (entity.viewType !== 'LeafDetails') continue;\r\n\r\n const value = entity.value as LeafDetailsEntityValue | undefined;\r\n for (const status of value?.statuses ?? []) {\r\n if (!status?.key || entries.has(status.key)) continue;\r\n const color = status.color ?? DEFAULT_BADGE_COLOR;\r\n entries.set(status.key, {\r\n key: status.key,\r\n label: status.display || status.key,\r\n color,\r\n textColor: readableTextOn(color),\r\n });\r\n }\r\n }\r\n }\r\n\r\n return [...entries.values()];\r\n });\r\n\r\n /**\r\n * Grouped cards. Reuses TableGroupingController helpers so the accent color,\r\n * label, and count rendering match the table's subheader exactly.\r\n */\r\n protected readonly groupedCards = computed<CardGroup[]>(() => {\r\n const column = this.grouping.activeGroupColumn();\r\n if (!column) return [];\r\n\r\n const groups = new Map<string, CardGroup>();\r\n this.visibleCards().forEach((card) => {\r\n const row = this.cardToRow(card);\r\n const label = this.grouping.getGroupLabel(row);\r\n const accent = this.grouping.getGroupAccentColor(row);\r\n const key = `${label}__${accent ?? ''}`;\r\n\r\n const existing = groups.get(key);\r\n if (existing) {\r\n existing.cards.push(card);\r\n existing.count += 1;\r\n } else {\r\n groups.set(key, {\r\n key,\r\n columnLabel: column.label,\r\n label,\r\n accent,\r\n count: 1,\r\n cards: [card],\r\n });\r\n }\r\n });\r\n\r\n return Array.from(groups.values());\r\n });\r\n\r\n /**\r\n * Export the visible (after search + filter) cards as XLSX. Uses the cards'\r\n * derived row shape + the state's columns, so the file mirrors what the\r\n * user sees. Custom columns are excluded upstream by `TableExportService`.\r\n */\r\n /**\r\n * Set of column keys that are click-to-filter eligible — same predicate\r\n * mt-table's `isCellClickFilterable` uses (select / boolean / user). One\r\n * set computed once per columns / first-card change; all visible cards\r\n * read from it. Reactive via signal — when columns load, the entities\r\n * inside cards automatically become clickable.\r\n */\r\n protected readonly clickableEntityKeys = computed<ReadonlySet<string>>(() => {\r\n const sample = this.cardsState().cards[0]\r\n ? this.cardToRow(this.cardsState().cards[0])\r\n : undefined;\r\n const result = new Set<string>();\r\n for (const column of this.columns()) {\r\n const filterType = TableValueResolver.getColumnFilterType(column, sample);\r\n if (\r\n filterType === 'select' ||\r\n filterType === 'user' ||\r\n filterType === 'boolean'\r\n ) {\r\n result.add(column.key);\r\n }\r\n }\r\n return result;\r\n });\r\n\r\n /**\r\n * Per-card set of entity keys that match the active filter — passed into\r\n * `<mt-entities-preview [activeKeys]>`.\r\n *\r\n * Memoized rather than built per call: the template binds the result\r\n * straight into a child input, and minting a fresh `Set` on every call\r\n * handed `mt-entities-preview` a new input identity on every change\r\n * detection pass, re-rendering every card's entity grid whenever any\r\n * filter was active. Cards with no match are left out of the map so they\r\n * all share the one `EMPTY_KEY_SET` reference.\r\n */\r\n private readonly activeKeysByCard = computed<\r\n ReadonlyMap<ClientListCard, ReadonlySet<string>>\r\n >(() => {\r\n const map = new Map<ClientListCard, ReadonlySet<string>>();\r\n const filters = this.bucket().filters();\r\n const columns = this.columns();\r\n\r\n const targets = Object.keys(filters)\r\n .filter((key) => key !== 'generalSearch')\r\n .map((key) => ({ key, column: columns.find((c) => c.key === key) }))\r\n .filter(\r\n (target): target is { key: string; column: ColumnDef } =>\r\n !!target.column,\r\n );\r\n if (targets.length === 0) return map;\r\n\r\n const rows = this.rowByCard();\r\n for (const card of this.cardsState().cards) {\r\n const row = rows.get(card) ?? this.cardToRow(card);\r\n const result = new Set<string>();\r\n for (const { key, column } of targets) {\r\n const cellTarget = TableValueResolver.buildClickFilterValue(\r\n row,\r\n column,\r\n );\r\n if (cellTarget === null || cellTarget === undefined) continue;\r\n if (TableValueResolver.isFilterValueEqual(filters[key], cellTarget)) {\r\n result.add(key);\r\n }\r\n }\r\n if (result.size > 0) map.set(card, result);\r\n }\r\n\r\n return map;\r\n });\r\n\r\n protected activeKeysForCard(card: ClientListCard): ReadonlySet<string> {\r\n return this.activeKeysByCard().get(card) ?? EMPTY_KEY_SET;\r\n }\r\n\r\n /**\r\n * Click-to-filter handler invoked from `<mt-entities-preview (entityClick)>`.\r\n * Mirrors mt-table's `onCellFilterClick`: builds the filter value via the\r\n * shared `TableValueResolver`, toggles it on the shared toolbar bucket so\r\n * the funnel chip in the filter popover lights up, and clears on a second\r\n * click against the same value.\r\n */\r\n protected onEntityFilterClick(\r\n card: ClientListCard,\r\n event: EntityClickEvent,\r\n ): void {\r\n const column = this.columns().find((c) => c.key === event.key);\r\n if (!column) return;\r\n\r\n const row = this.cardToRow(card);\r\n const next = TableValueResolver.buildClickFilterValue(row, column);\r\n if (next === null || next === undefined) return;\r\n\r\n const current = this.bucket().filters();\r\n const patched = { ...current };\r\n if (TableValueResolver.isFilterValueEqual(current[column.key], next)) {\r\n delete patched[column.key];\r\n } else {\r\n patched[column.key] = next;\r\n }\r\n this.bucket().filters.set(patched);\r\n }\r\n\r\n protected exportExcel(): void {\r\n const rows = this.visibleCards().map((card) => this.cardToRow(card));\r\n this.exportService.exportToExcel({\r\n rows,\r\n columns: this.columns(),\r\n filename: this.resolveExportFilename(),\r\n resolveValue: (row, column) => this.resolveCellValue(row, column),\r\n });\r\n }\r\n\r\n protected printPdf(): void {\r\n const rows = this.visibleCards().map((card) => this.cardToRow(card));\r\n this.exportService.printPdf({\r\n rows,\r\n columns: this.columns(),\r\n filename: this.resolveExportFilename(),\r\n title: this.cardsState().title || undefined,\r\n resolveValue: (row, column) => this.resolveCellValue(row, column),\r\n });\r\n }\r\n\r\n private resolveExportFilename(): string {\r\n const title = this.cardsState().title?.trim();\r\n return title || this.cardsState().moduleKey || 'cards';\r\n }\r\n\r\n /**\r\n * Value resolver compatible with `TableExportConfig.resolveValue`. Reuses\r\n * `TableValueResolver` so currency, dates, entities, booleans export the\r\n * same way they would from the table view. Date columns (native or entity\r\n * with viewType `Date`/`DateTime`) are passed through `mtDateFormat` so\r\n * Excel and PDF show locale-formatted dates instead of raw ISO strings.\r\n */\r\n private resolveCellValue(\r\n row: unknown,\r\n column: ColumnDef,\r\n ): string | number | boolean | null {\r\n const cellValue = TableValueResolver.getProperty(row, column.key);\r\n if (cellValue === null || cellValue === undefined) return null;\r\n\r\n const dateType = this.resolveDateColumnType(column, cellValue);\r\n if (dateType) {\r\n const source =\r\n column.type === 'entity'\r\n ? TableValueResolver.getEntityValueByType(cellValue, 'sort')\r\n : cellValue;\r\n const dateValue = TableValueResolver.resolveDateValue(source);\r\n if (dateValue === null) return null;\r\n const formatted = this.dateFormat.transform(dateValue, dateType);\r\n return formatted || null;\r\n }\r\n\r\n if (column.type === 'entity') {\r\n return TableValueResolver.getEntityValueByType(cellValue, 'export');\r\n }\r\n return TableValueResolver.resolveDisplayValue(cellValue);\r\n }\r\n\r\n private resolveDateColumnType(\r\n column: ColumnDef,\r\n cellValue: unknown,\r\n ): MTDateFormatType | null {\r\n if (column.type === 'date') return 'date';\r\n if (column.type === 'dateTime') return 'dateTime';\r\n if (column.type !== 'entity') return null;\r\n\r\n const viewType = (column as { viewType?: unknown }).viewType;\r\n const fromColumn =\r\n typeof viewType === 'string' ? viewType.toLowerCase() : '';\r\n if (fromColumn === 'datetime') return 'dateTime';\r\n if (fromColumn === 'date') return 'date';\r\n if (fromColumn === 'time') return 'time';\r\n\r\n if (cellValue && typeof cellValue === 'object') {\r\n const inner = (cellValue as { viewType?: string }).viewType;\r\n if (inner === 'DateTime') return 'dateTime';\r\n if (inner === 'Date') return 'date';\r\n if (inner === 'Time') return 'time';\r\n }\r\n return null;\r\n }\r\n\r\n constructor() {\r\n // Attach the observer to whatever element the sentinel query currently\r\n // resolves to, and re-attach if Angular ever swaps that element. Keying\r\n // on the element instance is what makes this safe: appending a page\r\n // doesn't recreate the node, so the observer is *not* rebuilt per page —\r\n // which matters because a fresh IntersectionObserver always fires once\r\n // with the current intersection state, and rebuilding on every append\r\n // would cascade through the remaining pages on its own.\r\n //\r\n // Attaching only once, however, is not safe: the sentinel lives at the\r\n // end of the grid, and the grid is one branch of the view (the initial\r\n // skeleton, an error, an empty result and the grouped layout are the\r\n // others). A one-shot attach survives the initial skeleton but then\r\n // silently observes a detached node the first time any sibling branch\r\n // takes over, killing infinite scroll for the rest of the component's\r\n // life.\r\n effect((onCleanup) => {\r\n const el = this.loadMoreSentinel()?.nativeElement;\r\n if (!el) {\r\n this.loadMoreObserver = null;\r\n return;\r\n }\r\n\r\n const observer = new IntersectionObserver(\r\n (entries) => {\r\n if (!this.hasMoreCards()) return;\r\n if (entries.some((entry) => entry.isIntersecting)) {\r\n this.loadMore.emit();\r\n }\r\n },\r\n { rootMargin: LOAD_MORE_ROOT_MARGIN },\r\n );\r\n observer.observe(el);\r\n this.loadMoreObserver = observer;\r\n\r\n onCleanup(() => {\r\n observer.disconnect();\r\n if (this.loadMoreObserver === observer) this.loadMoreObserver = null;\r\n });\r\n });\r\n\r\n // Re-arm after each page settles. IntersectionObserver only reports\r\n // threshold *crossings*: if an appended page is too short to push the\r\n // sentinel back out of the root margin, the entry stays `isIntersecting`\r\n // and no further callback ever arrives — the list stalls part-loaded\r\n // until the user happens to scroll. Re-observing the same element\r\n // delivers a fresh initial callback, so the loop continues until the\r\n // sentinel really is out of range (callback reports no intersection, no\r\n // emit, no state change, effect idle) or the data runs out\r\n // (`hasMoreCards()` false). `observe()` on an already-observed target is\r\n // a no-op, hence the explicit `unobserve` first.\r\n effect(() => {\r\n const state = this.cardsState();\r\n const el = this.loadMoreSentinel()?.nativeElement;\r\n const observer = this.loadMoreObserver;\r\n\r\n if (!observer || !el || state.loading || !this.hasMoreCards()) return;\r\n\r\n observer.unobserve(el);\r\n observer.observe(el);\r\n });\r\n\r\n // Emit lazyLoad only on genuine filter / search changes for paginated\r\n // lists, matching mt-table's behaviour (group-by is a pure FE concern,\r\n // not a re-fetch trigger). Deliberately reads `cardsState()` via\r\n // `untracked` — the item state gets a new object reference on every\r\n // page append (infinite scroll), and reacting to that here would\r\n // re-emit `lazyLoad` after every append, which re-fetches with\r\n // `append: false` and wipes out everything already loaded.\r\n let primed = false;\r\n effect(() => {\r\n const filters = this.bucket().filters();\r\n const filterTerm = this.bucket().filterTerm();\r\n const state = untracked(() => this.cardsState());\r\n\r\n if (!state.config.isPaginated) return;\r\n if (!primed) {\r\n primed = true;\r\n if (Object.keys(filters).length === 0 && !filterTerm) return;\r\n }\r\n\r\n queueMicrotask(() =>\r\n this.lazyLoad.emit({\r\n filters: {\r\n ...filters,\r\n ...(filterTerm ? { generalSearch: filterTerm } : {}),\r\n },\r\n pageSize: state.take,\r\n first: 0,\r\n currentPage: 1,\r\n } as ClientListLazyLoadEvent),\r\n );\r\n });\r\n }\r\n}\r\n","<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 — 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","import { ClientListFetchRequestFilter } from '../models/client-list.model';\r\n\r\nexport function toDashboardExtraFilters(\r\n filters: ClientListFetchRequestFilter[] = [],\r\n): Record<string, unknown> {\r\n const extraFilters: Record<string, unknown> = {};\r\n\r\n for (const filter of filters) {\r\n if (!filter.key) {\r\n continue;\r\n }\r\n\r\n extraFilters[filter.key] = filter.value;\r\n }\r\n\r\n return extraFilters;\r\n}\r\n","import { Component, computed, input } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { Card } from '@masterteam/components/card';\r\nimport { DashboardViewer } from '@masterteam/dashboard-builder';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport {\r\n ClientListContentTemplateContext,\r\n ClientListInformativeState,\r\n ClientListState,\r\n} from '../../models/client-list.model';\r\nimport { toDashboardExtraFilters } from '../../utils/informative-filters';\r\n\r\nconst DEFAULT_GRID_COLUMNS = 12;\r\n\r\n@Component({\r\n selector: 'mt-client-list-informative-view',\r\n standalone: true,\r\n imports: [CommonModule, Card, DashboardViewer, SkeletonModule, TranslocoPipe],\r\n templateUrl: './client-list-informative-view.html',\r\n})\r\nexport class ClientListInformativeView {\r\n readonly state = input.required<ClientListState>();\r\n\r\n protected readonly informativeState = computed(\r\n () => this.state() as ClientListInformativeState,\r\n );\r\n protected readonly dashboardExtraFilters = computed(() => {\r\n return toDashboardExtraFilters(this.informativeState().config.filters);\r\n });\r\n protected readonly gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;\r\n\r\n protected slotGridSpan(span: number): string {\r\n return `span ${span} / span ${span}`;\r\n }\r\n\r\n protected templateContext(\r\n item: ClientListState,\r\n ): ClientListContentTemplateContext {\r\n return {\r\n $implicit: item,\r\n table: item,\r\n item,\r\n loading: item.loading,\r\n error: item.error,\r\n data: item.rawData,\r\n };\r\n }\r\n}\r\n","<div class=\"grid gap-4\" [style.gridTemplateColumns]=\"gridTemplateColumns\">\r\n @if (informativeState().config.contentStart) {\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.startSpan)\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"informativeState().config.contentStart\"\r\n [ngTemplateOutletContext]=\"templateContext(informativeState())\"\r\n />\r\n </div>\r\n }\r\n\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.tableSpan)\r\n \"\r\n >\r\n <mt-card>\r\n @if (\r\n informativeState().loading &&\r\n !informativeState().dashboardData?.charts?.length\r\n ) {\r\n <div class=\"flex flex-col gap-3 py-3\">\r\n <p-skeleton height=\"6rem\" />\r\n <p-skeleton height=\"12rem\" />\r\n <p-skeleton height=\"12rem\" />\r\n </div>\r\n } @else if (informativeState().error) {\r\n <div\r\n class=\"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ informativeState().error }}\r\n </div>\r\n } @else if (!informativeState().dashboardData?.charts?.length) {\r\n <div class=\"p-6 text-center text-gray-400\">\r\n {{\r\n \"components.clientComponents.list.noInformativeDashboard\"\r\n | transloco\r\n }}\r\n </div>\r\n } @else {\r\n <div class=\"min-h-[420px]\">\r\n <mt-dashboard-viewer\r\n [isPage]=\"false\"\r\n [showFilters]=\"false\"\r\n [dashboardData]=\"informativeState().dashboardData\"\r\n [extraFilters]=\"dashboardExtraFilters()\"\r\n />\r\n </div>\r\n }\r\n </mt-card>\r\n </div>\r\n\r\n @if (informativeState().config.contentEnd) {\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.endSpan)\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"informativeState().config.contentEnd\"\r\n [ngTemplateOutletContext]=\"templateContext(informativeState())\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n","import { TableFilters, TableValueResolver } from '@masterteam/components/table';\r\nimport {\r\n ClientListFetchRequestFilter,\r\n RuntimeEntityColumnDef,\r\n} from '../models/client-list.model';\r\n\r\nexport function mergeRuntimeFilters(\r\n configured: ClientListFetchRequestFilter[] = [],\r\n runtime: TableFilters = {},\r\n columns: RuntimeEntityColumnDef[] = [],\r\n): ClientListFetchRequestFilter[] {\r\n const filters = [...configured];\r\n\r\n for (const [rawKey, rawValue] of Object.entries(runtime)) {\r\n const column = columns.find(\r\n (item) => item.key === rawKey || item.normalizedKey === rawKey,\r\n );\r\n const key =\r\n rawKey === 'generalSearch' ? 'Name' : (column?.normalizedKey ?? rawKey);\r\n const filterType = column\r\n ? TableValueResolver.getColumnFilterType(column)\r\n : null;\r\n\r\n if (isRange(rawValue)) {\r\n appendRange(filters, key, rawValue, filterType === 'date');\r\n continue;\r\n }\r\n\r\n const scalar = toScalar(rawValue);\r\n const value =\r\n rawKey === 'generalSearch' && typeof scalar === 'string'\r\n ? scalar.trim()\r\n : scalar;\r\n if (value === null) continue;\r\n\r\n filters.push({\r\n key,\r\n operator:\r\n rawKey === 'generalSearch' || filterType === 'text'\r\n ? 'Contains'\r\n : 'Equals',\r\n value,\r\n });\r\n }\r\n\r\n return filters;\r\n}\r\n\r\nexport function runtimeFiltersChanged(\r\n previous: TableFilters | undefined,\r\n next: TableFilters | undefined,\r\n): boolean {\r\n return JSON.stringify(previous ?? {}) !== JSON.stringify(next ?? {});\r\n}\r\n\r\nfunction appendRange(\r\n filters: ClientListFetchRequestFilter[],\r\n key: string,\r\n range: { from?: unknown; to?: unknown },\r\n isDate: boolean,\r\n): void {\r\n const from = toRangeValue(range.from, isDate);\r\n const to = toRangeValue(range.to, isDate);\r\n\r\n if (from !== null) {\r\n filters.push({ key, operator: 'GreaterThanOrEqual', value: from });\r\n }\r\n if (to !== null) {\r\n filters.push({ key, operator: 'LessThanOrEqual', value: to });\r\n }\r\n}\r\n\r\nfunction isRange(value: unknown): value is { from?: unknown; to?: unknown } {\r\n return (\r\n !!value && typeof value === 'object' && ('from' in value || 'to' in value)\r\n );\r\n}\r\n\r\nfunction toRangeValue(value: unknown, isDate: boolean): string | number | null {\r\n if (value === null || value === undefined || value === '') return null;\r\n if (!isDate) return toScalar(value);\r\n\r\n if (typeof value === 'string') {\r\n const trimmed = value.trim();\r\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(trimmed)) return trimmed;\r\n }\r\n\r\n const date = value instanceof Date ? value : new Date(String(value));\r\n if (Number.isNaN(date.getTime())) return null;\r\n\r\n const year = date.getFullYear();\r\n const month = String(date.getMonth() + 1).padStart(2, '0');\r\n const day = String(date.getDate()).padStart(2, '0');\r\n return `${year}-${month}-${day}`;\r\n}\r\n\r\nfunction toScalar(value: unknown): string | number | null {\r\n if (Array.isArray(value)) {\r\n return value.length === 1 ? toScalar(value[0]) : null;\r\n }\r\n if (value === null || value === undefined || value === '') return null;\r\n if (typeof value === 'string' || typeof value === 'number') return value;\r\n if (typeof value === 'boolean') return String(value);\r\n if (typeof value !== 'object') return null;\r\n\r\n const item = value as Record<string, unknown>;\r\n return toScalar(\r\n item['value'] ??\r\n item['id'] ??\r\n item['key'] ??\r\n item['userName'] ??\r\n item['displayName'],\r\n );\r\n}\r\n","import {\n ClientListAreaType,\n ClientListState,\n NormalizedClientListConfiguration,\n} from '../models/client-list.model';\n\n/**\n * Whether the offset a list is currently sitting on still describes the same\n * result set, i.e. this reconfigure changed nothing about what gets fetched.\n *\n * Hosts rebuild the `configurations` array from a `computed()`, so *any*\n * unrelated state change — a permission refresh after a write, a language\n * switch, a re-rendered header template — hands the list a brand new array\n * with identical content. That must not move the user off their page, and\n * must not cost a request.\n *\n * The page size is compared **as configured**, never as currently applied. The\n * table owns its rows-per-page: the user picks it from the paginator and\n * `mt-table` restores a persisted value, and either of those legitimately\n * leaves the runtime `take` different from the configured one. Reading that\n * difference as drift to correct is what used to reset the paginator and\n * refetch page 1 on every reconfigure.\n */\nexport function preservesPaging(\n existing: ClientListState | undefined,\n areaType: ClientListAreaType,\n next: NormalizedClientListConfiguration,\n): boolean {\n if (\n !existing ||\n existing.type !== 'form' ||\n existing.areaType !== areaType ||\n next.type !== 'form'\n ) {\n return false;\n }\n\n const current = existing.config;\n\n return (\n current.isPaginated === next.isPaginated &&\n current.take === next.take &&\n current.contextKey === next.contextKey &&\n serializeFilters(current.filters) === serializeFilters(next.filters)\n );\n}\n\nfunction serializeFilters(\n filters: NormalizedClientListConfiguration['filters'] | undefined,\n): string {\n return JSON.stringify(filters ?? []);\n}\n","import {\n Component,\n computed,\n effect,\n inject,\n input,\n output,\n untracked,\n OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslocoService } from '@jsverse/transloco';\nimport { Subscription } from 'rxjs';\nimport { Button } from '@masterteam/components/button';\nimport { TableAction } from '@masterteam/components/table';\nimport {\n RuntimeAction,\n RuntimeActionRunner,\n resolveActionLabel,\n} from '@masterteam/components/runtime-action';\nimport { ClientListApiService } from './services/client-list-api.service';\nimport { ClientListStateService } from './services/client-list-state.service';\nimport {\n ClientListRuntimeActionsService,\n defaultResolveRecordId,\n} from './services/client-list-runtime-actions.service';\nimport { ClientListToolbarService } from './services/client-list-toolbar';\nimport {\n ClientListAreaType,\n ClientListConfiguration,\n ClientListContentTemplateContext,\n ClientListFormConfiguration,\n ClientListItemClickedEvent,\n ClientListInformativeConfiguration,\n ClientListLazyLoadEvent,\n ClientListLayoutConfig,\n ClientListMode,\n ClientListRuntimeRecordActionsConfig,\n ClientListRuntimeRecordActionsContext,\n ClientListState,\n RuntimeTableDisplayRow,\n ClientListTableQuery,\n ClientListTablePersistStateKey,\n ClientListType,\n NormalizedClientListConfiguration,\n ClientListCard,\n CLIENT_LIST_DEFAULT_INCLUDE_STATE,\n CLIENT_LIST_RECORD_ID_FILTER_KEY,\n CLIENT_LIST_RECORD_STATE_KEY,\n ClientListFetchRecord,\n ClientListFetchRecordState,\n ClientListFetchRequestFilter,\n ClientListRecordWriteResult,\n ClientListReturnRecordRequest,\n} from './models/client-list.model';\nimport { ClientListTableView } from './components/client-list-table-view/client-list-table-view';\nimport { ClientListCardsView } from './components/client-list-cards-view/client-list-cards-view';\nimport { ClientListInformativeView } from './components/client-list-informative-view/client-list-informative-view';\nimport {\n mergeRuntimeFilters,\n runtimeFiltersChanged,\n} from './utils/runtime-filters';\nimport { preservesPaging } from './utils/paging-continuity';\n\nconst DEFAULT_AREA_TYPE: ClientListAreaType = 'table';\nconst DEFAULT_MODE: ClientListMode = 'auto';\nconst DEFAULT_TYPE: ClientListType = 'form';\nconst DEFAULT_SERVER_PAGE_SIZE = 100;\nconst DEFAULT_TABLE_PAGE_SIZE = 100;\nconst DEFAULT_TABLE_PERSIST_STATE_EXCLUDE: ClientListTablePersistStateKey[] = [\n 'pagePosition',\n];\nconst DEFAULT_COLLAPSE_ICON = 'arrow.chevron-up';\nconst DEFAULT_EXPAND_ICON = 'arrow.chevron-down';\nconst DEFAULT_SIDE_CONTENT_SPAN = 3;\nconst DEFAULT_GRID_COLUMNS = 12;\nconst ESCALATION_STATE_KEY = 'escalation';\nconst VIEW_ESCALATION_ACTION_KEY = 'viewEscalation';\nconst VIEW_ESCALATION_OPERATION_KEY = 'ViewEscalation';\n\ntype ClientListInlineTableAction = TableAction & {\n placement: 'inline';\n cardMarker?: 'escalation';\n};\n\n@Component({\n selector: 'mt-client-list',\n standalone: true,\n imports: [\n CommonModule,\n Button,\n ClientListTableView,\n ClientListCardsView,\n ClientListInformativeView,\n ],\n providers: [\n ClientListStateService,\n ClientListRuntimeActionsService,\n ClientListToolbarService,\n ],\n templateUrl: './client-list.html',\n})\nexport class ClientList implements OnDestroy {\n private readonly api = inject(ClientListApiService);\n protected readonly state = inject(ClientListStateService);\n private readonly runtimeActions = inject(ClientListRuntimeActionsService);\n private readonly runtimeRunner = inject(RuntimeActionRunner);\n private readonly transloco = inject(TranslocoService);\n\n readonly configurations = input.required<ClientListConfiguration[]>();\n readonly defaultTake = input(DEFAULT_SERVER_PAGE_SIZE);\n\n readonly loaded = output<string>();\n readonly errored = output<{ key: string; message: string }>();\n readonly itemClicked = output<ClientListItemClickedEvent>();\n\n protected readonly items = this.state.items;\n private readonly subscriptions = new Map<string, Subscription>();\n private readonly inFlightRequestSignatures = new Map<string, string>();\n private readonly fulfilledRequestSignatures = new Map<string, string>();\n private readonly runtimeFilters = new Map<\n string,\n ClientListLazyLoadEvent['filters']\n >();\n /**\n * The `propertyKeys` the last table request carried, per item. `undefined`\n * means the request left the projection to the backend, which is a distinct\n * state from \"not loaded yet\" — hence the map rather than a nullable field.\n */\n private readonly requestPropertyKeys = new Map<\n string,\n string[] | undefined\n >();\n /** Single-record read-backs, kept apart from the page loads they must not cancel. */\n private readonly recordSubscriptions = new Map<string, Subscription>();\n\n constructor() {\n effect(() => {\n const configs = this.configurations();\n untracked(() => this.configureItems(configs));\n\n untracked(() => {\n this.state.items().forEach((item) => {\n this.loadItem(item);\n });\n });\n });\n }\n\n onLazyLoad(itemKey: string, event: ClientListLazyLoadEvent): void {\n const item = this.state.itemsByKey()[itemKey];\n if (!item || item.type === 'informative' || !item.config.isPaginated) {\n return;\n }\n\n const nextFilters =\n event.filters ?? this.runtimeFilters.get(item.key) ?? {};\n const filtersChanged = runtimeFiltersChanged(\n this.runtimeFilters.get(item.key),\n nextFilters,\n );\n this.runtimeFilters.set(item.key, nextFilters);\n\n const take = this.resolvePositiveInteger(event.pageSize) ?? item.take;\n const skip = filtersChanged\n ? 0\n : (this.resolveNonNegativeInteger(event.first) ?? 0);\n\n if (item.areaType === 'cards') {\n this.loadCards(item.key, item.config, skip, take, false);\n return;\n }\n\n this.state.setTablePaging(item.key, skip, take);\n this.loadTable(item.key, item.config, skip, take);\n }\n\n /**\n * Fetches the next page of cards and appends it to the currently loaded\n * set — the infinite-scroll counterpart to table pagination. No-op unless\n * `isPaginated` is enabled for this cards list, a load is already in\n * flight, or every record has already been loaded.\n *\n * The offset comes from `item.skip`, which the state service advances by\n * the page size the backend actually applied. Deriving it from\n * `cards.length` instead would drift the moment a page came back short (a\n * capped `pageSize`, a de-duplicated overlap) and re-request a page we\n * already hold.\n */\n loadMoreCards(itemKey: string): void {\n const item = this.state.itemsByKey()[itemKey];\n if (\n !item ||\n item.type !== 'form' ||\n item.areaType !== 'cards' ||\n !item.config.isPaginated ||\n item.loading ||\n item.cards.length >= item.totalCount\n ) {\n return;\n }\n\n this.loadCards(item.key, item.config, item.skip, item.take, true);\n }\n\n reload(itemKey?: string): void {\n if (itemKey) {\n this.reloadByKey(itemKey);\n return;\n }\n\n this.items().forEach((item) => {\n this.loadItem(item, true);\n });\n }\n\n reloadByKey(itemKey: string): void {\n const item = this.state.itemsByKey()[itemKey];\n if (!item) return;\n\n this.loadItem(item, true);\n }\n\n /**\n * The query settings this list renders with, shaped as the `returnRecord`\n * block of a `process-submit` payload. Send it with a create/update so the\n * backend projects the written record the way this list reads records, then\n * hand the response to {@link applyWriteResult} — that pair replaces the\n * full page re-fetch a write used to cost.\n *\n * Returns `null` for an informative dashboard (no records to project) or an\n * unknown key.\n */\n getReturnRecordRequest(\n itemKey: string,\n ): ClientListReturnRecordRequest | null {\n const item = this.state.itemsByKey()[itemKey];\n if (!item || item.type !== 'form') return null;\n\n const includeState = [...CLIENT_LIST_DEFAULT_INCLUDE_STATE];\n const culture = this.transloco.getActiveLang();\n\n if (item.areaType === 'cards') {\n return { projection: 'Card', includeState, culture };\n }\n\n const propertyKeys = this.requestPropertyKeys.get(itemKey);\n\n return {\n projection: 'Table',\n surfaceKey: 'table',\n includeState,\n // Omitted, not empty, when the table let the backend pick the\n // projection — an empty array would read as \"no columns\".\n ...(propertyKeys?.length ? { propertyKeys } : {}),\n culture,\n };\n }\n\n /**\n * Applies a create/update to the list in place, without re-fetching the\n * page. Pass the `process-submit` response as-is.\n *\n * Three outcomes, in the order they are tried:\n * - the write carried a usable record projection → splice it in, no request;\n * - it did not (`recordProjectionStatus: 'Unavailable'`, or the list has\n * nothing to splice into) → read that one record back by id. The write\n * already succeeded; this only reads, and never re-submits;\n * - nothing identifies the record at all → reload the page, as before.\n *\n * An approval-queued submit is a no-op: nothing has been written yet.\n *\n * Note that the list cannot know where the backend would have sorted a new\n * record, so an insert lands at the top of the page in view.\n */\n applyWriteResult(\n itemKey: string,\n result: ClientListRecordWriteResult | null | undefined,\n ): void {\n const item = this.state.itemsByKey()[itemKey];\n if (!item || item.type !== 'form') return;\n\n if (this.isPendingApprovalWrite(result)) return;\n\n const recordId = this.toFiniteNumber(result?.recordId);\n const record = this.toWriteRecord(result, recordId);\n\n if (record) {\n // A failed splice means the list holds no page to splice into, so\n // reading the record back would not help either.\n if (this.state.upsertRecord(itemKey, record, item.config)) {\n this.afterRecordApplied(itemKey);\n } else {\n this.reloadByKey(itemKey);\n }\n return;\n }\n\n if (recordId != null) {\n this.readRecordBack(item, recordId);\n return;\n }\n\n this.reloadByKey(itemKey);\n }\n\n /**\n * Drops a deleted record from the list in place. Falls back to a reload when\n * the record is not part of the loaded set, so a stale list still corrects\n * itself.\n */\n removeRecord(itemKey: string, recordId: number): void {\n const item = this.state.itemsByKey()[itemKey];\n if (!item || item.type !== 'form') return;\n\n if (!this.state.removeRecord(itemKey, recordId, item.config)) {\n this.reloadByKey(itemKey);\n return;\n }\n\n this.runtimeActions.invalidateRow(itemKey, recordId);\n this.afterRecordApplied(itemKey, { invalidateRuntimeActions: false });\n }\n\n toggleExpanded(key: string): void {\n this.state.toggleExpanded(key);\n }\n\n onTableRowClick(item: ClientListState, row: RuntimeTableDisplayRow): void {\n this.itemClicked.emit({\n key: item.key,\n areaType: 'table',\n item: row,\n state: item,\n });\n }\n\n onCardClick(item: ClientListState, card: ClientListCard): void {\n this.itemClicked.emit({\n key: item.key,\n areaType: 'cards',\n item: card,\n state: item,\n });\n }\n\n /**\n * Called by the table view when a row's 3-dots menu is opened. Triggers a\n * lazy fetch of that row's runtime actions when `runtimeRecordActions` is\n * enabled with the default `onMenuOpen` strategy. Skips when the cache is\n * still warm — the service handles in-flight dedupe and TTL.\n */\n onRowActionsRequested(\n item: ClientListState,\n row: RuntimeTableDisplayRow,\n ): void {\n const config = item.config.runtimeRecordActions;\n if (!config?.enabled) return;\n if ((config.loadStrategy ?? 'onMenuOpen') !== 'onMenuOpen') return;\n\n const ctx = this.toRuntimeActionsContext(item, row, config);\n if (!ctx) return;\n\n this.runtimeActions.request(config, ctx);\n }\n\n /**\n * Per-row predicate used by the popover skeleton state.\n */\n isRowActionsLoading(\n item: ClientListState,\n row: RuntimeTableDisplayRow,\n ): boolean {\n const config = item.config.runtimeRecordActions;\n if (!config?.enabled) return false;\n const recordId = this.resolveRecordId(config, row);\n if (recordId == null) return false;\n return this.runtimeActions\n .loadingRowKeys()\n .has(this.runtimeActions.rowKey(item.key, recordId));\n }\n\n /**\n * Per-list merged row-actions, keyed by item.key. Static `rowActions` are\n * augmented with one entry per distinct runtime `actionKey` discovered for\n * any row in the list, and re-evaluated when the runtime cache changes.\n */\n protected readonly mergedRowActionsByKey = computed<\n ReadonlyMap<string, TableAction[]>\n >(() => {\n const cache = this.runtimeActions.actionsByRowKey();\n const result = new Map<string, TableAction[]>();\n for (const item of this.state.items()) {\n result.set(item.key, this.computeMergedRowActions(item, cache));\n }\n return result;\n });\n\n /** Fallback used by the template when no entry exists for an item.key. */\n private readonly emptyActions: TableAction[] = [];\n private readonly rowActionsLoadingFnCache = new Map<\n string,\n (row: RuntimeTableDisplayRow) => boolean\n >();\n\n rowActionsFor(item: ClientListState): TableAction[] {\n return (\n this.mergedRowActionsByKey().get(item.key) ??\n item.config.rowActions ??\n this.emptyActions\n );\n }\n\n rowActionsLoadingFnFor(\n item: ClientListState,\n ): (row: RuntimeTableDisplayRow) => boolean {\n let fn = this.rowActionsLoadingFnCache.get(item.key);\n if (!fn) {\n const itemKey = item.key;\n fn = (row: RuntimeTableDisplayRow) => {\n const current = this.state.itemsByKey()[itemKey];\n return current ? this.isRowActionsLoading(current, row) : false;\n };\n this.rowActionsLoadingFnCache.set(itemKey, fn);\n }\n return fn;\n }\n\n private computeMergedRowActions(\n item: ClientListState,\n cache: ReadonlyMap<string, RuntimeAction[]>,\n ): TableAction[] {\n const baseActions = item.config.rowActions ?? [];\n const config = item.config.runtimeRecordActions;\n const escalationAction =\n config?.enabled && this.hasActiveEscalation(item)\n ? this.createEscalationPreviewRowAction(item, config)\n : null;\n const baseWithEscalation = escalationAction\n ? [escalationAction, ...baseActions]\n : baseActions;\n if (!config?.enabled) return baseWithEscalation;\n\n const prefix = `${item.key}:`;\n const prototypes = new Map<string, RuntimeAction>();\n for (const [key, actions] of cache) {\n if (!key.startsWith(prefix)) continue;\n for (const action of actions) {\n if (!prototypes.has(action.actionKey)) {\n prototypes.set(action.actionKey, action);\n }\n }\n }\n\n if (prototypes.size === 0) {\n return baseWithEscalation;\n }\n\n const icon = config.actionIcon ?? 'media.play-circle';\n const runtimeActionEntries: TableAction[] = [];\n for (const [actionKey, prototype] of prototypes) {\n if (this.isViewEscalationAction(prototype)) {\n continue;\n }\n\n const label = resolveActionLabel(prototype);\n const presentation = config.resolveActionPresentation?.(prototype) ?? {};\n runtimeActionEntries.push({\n icon: (presentation.icon ?? icon) as TableAction['icon'],\n color: presentation.color ?? 'secondary',\n variant: presentation.variant ?? 'outlined',\n label: presentation.label ?? label,\n tooltip: presentation.tooltip ?? label,\n loading: presentation.loading,\n hidden: (row) => {\n const recordId = this.resolveRecordId(config, row);\n if (recordId == null) return true;\n const rowActions = cache.get(\n this.runtimeActions.rowKey(item.key, recordId),\n );\n return !rowActions?.some(\n (a) => a.actionKey === actionKey && a.isAvailable !== false,\n );\n },\n action: (row) => {\n const ctx = this.toRuntimeActionsContext(item, row, config);\n if (!ctx) return;\n const rowActions = cache.get(\n this.runtimeActions.rowKey(item.key, ctx.recordId),\n );\n const action = rowActions?.find((a) => a.actionKey === actionKey);\n if (action) {\n void this.executeRuntimeAction(item, ctx, config, action);\n }\n },\n });\n }\n\n return [...baseWithEscalation, ...runtimeActionEntries];\n }\n\n private createEscalationPreviewRowAction(\n item: ClientListState,\n config: ClientListRuntimeRecordActionsConfig,\n ): TableAction {\n const label = this.transloco.translate(\n 'components.clientComponents.list.viewEscalation',\n );\n\n const action: ClientListInlineTableAction = {\n icon: 'editor.hand',\n color: 'warn',\n variant: 'text',\n placement: 'inline',\n cardMarker: 'escalation',\n tooltip: label,\n hidden: (row) => this.resolveEscalationInstanceId(row) == null,\n action: (row) => {\n void this.triggerEscalationPreviewAction(item, row, config);\n },\n };\n\n return action;\n }\n\n private async triggerEscalationPreviewAction(\n item: ClientListState,\n row: RuntimeTableDisplayRow,\n config: ClientListRuntimeRecordActionsConfig,\n ): Promise<void> {\n const instanceId = this.resolveEscalationInstanceId(row);\n if (instanceId == null) return;\n\n const ctx = this.toRuntimeActionsContext(item, row, config);\n if (!ctx) return;\n\n const action = this.toEscalationPreviewRuntimeAction(instanceId);\n const handled = await Promise.resolve(\n config.onActionTriggered?.(action, ctx),\n );\n if (handled === true) return;\n\n const result = await this.runtimeRunner.execute(action, {\n defaultAfterSuccess: 'refresh',\n });\n\n if (result.status !== 'success') return;\n this.runtimeActions.invalidateList(item.key);\n this.reloadByKey(item.key);\n config.onActionExecuted?.(action, ctx);\n }\n\n private toEscalationPreviewRuntimeAction(instanceId: number): RuntimeAction {\n return {\n actionKey: VIEW_ESCALATION_ACTION_KEY,\n actionName: this.transloco.translate(\n 'components.clientComponents.list.viewEscalation',\n ),\n httpMethod: 'GET',\n url: `escalations/${instanceId}/preview`,\n isAvailable: true,\n operationKey: VIEW_ESCALATION_OPERATION_KEY,\n targetType: 'Escalation',\n targetId: instanceId,\n payloadTemplate: {\n escalationInstanceId: instanceId,\n instanceId,\n },\n };\n }\n\n private resolveEscalationInstanceId(\n row: RuntimeTableDisplayRow,\n ): number | null {\n const state = row[CLIENT_LIST_RECORD_STATE_KEY] as\n | ClientListFetchRecordState\n | null\n | undefined;\n\n return this.resolveEscalationInstanceIdFromState(state);\n }\n\n private resolveEscalationInstanceIdFromState(\n state: ClientListFetchRecordState | null | undefined,\n ): number | null {\n const escalation = state?.[ESCALATION_STATE_KEY];\n\n if (escalation?.hasActive !== true) {\n return null;\n }\n\n return this.toFiniteNumber(escalation.instanceId);\n }\n\n private hasActiveEscalation(item: ClientListState): boolean {\n if (item.type !== 'form') {\n return false;\n }\n\n if (item.areaType === 'cards') {\n return item.cards.some(\n (card) => this.resolveEscalationInstanceIdFromState(card.state) != null,\n );\n }\n\n return item.rows.some(\n (row) => this.resolveEscalationInstanceId(row) != null,\n );\n }\n\n private isViewEscalationAction(action: RuntimeAction): boolean {\n return (\n this.normalizeActionKey(action.operationKey) ===\n this.normalizeActionKey(VIEW_ESCALATION_OPERATION_KEY) ||\n this.normalizeActionKey(action.actionKey) ===\n this.normalizeActionKey(VIEW_ESCALATION_ACTION_KEY)\n );\n }\n\n private normalizeActionKey(value: string | null | undefined): string {\n return (value ?? '').trim().toLowerCase();\n }\n\n private toFiniteNumber(value: unknown): number | null {\n if (typeof value === 'number') {\n return Number.isFinite(value) ? value : null;\n }\n\n if (typeof value === 'string' && value.trim() !== '') {\n const parsed = Number(value);\n return Number.isFinite(parsed) ? parsed : null;\n }\n\n return null;\n }\n\n private async executeRuntimeAction(\n item: ClientListState,\n ctx: ClientListRuntimeRecordActionsContext,\n config: ClientListRuntimeRecordActionsConfig,\n action: RuntimeAction,\n ): Promise<void> {\n const handled = await Promise.resolve(\n config.onActionTriggered?.(action, ctx),\n );\n if (handled === true) return;\n\n const result = await this.runtimeRunner.execute(action, {\n defaultAfterSuccess: 'refresh',\n });\n\n if (result.status !== 'success') return;\n\n if (result.afterSuccess === 'refresh' || result.afterSuccess == null) {\n this.runtimeActions.invalidateList(item.key);\n this.reloadByKey(item.key);\n config.onActionExecuted?.(action, ctx);\n }\n }\n\n /**\n * A submit that only queued an approval request has written nothing — the\n * record it describes does not exist yet, so the list must not move.\n */\n private isPendingApprovalWrite(\n result: ClientListRecordWriteResult | null | undefined,\n ): boolean {\n return (\n String(result?.status ?? '')\n .trim()\n .toLowerCase() === 'pendingapproval'\n );\n }\n\n /**\n * The canonical record from a write response, or `null` when there is none\n * to trust. A backend that has not shipped the canonical projection yet\n * answers with neither `recordProjectionStatus: 'Available'` nor `values`,\n * and falls through to the read-back path — which is why this is a plain\n * shape check and not a parse of alternative record shapes.\n */\n private toWriteRecord(\n result: ClientListRecordWriteResult | null | undefined,\n recordId: number | null,\n ): ClientListFetchRecord | null {\n if (result?.recordProjectionStatus !== 'Available') return null;\n\n const record = result.record;\n if (!record?.values) return null;\n\n const id = this.toFiniteNumber(record.id) ?? recordId;\n if (id == null) return null;\n\n return { ...record, id };\n }\n\n /**\n * Reads one record back through `fetch/query` with this list's own settings.\n * Taken when the write could not project the record itself — the write has\n * already happened, so this reads and never re-submits.\n */\n private readRecordBack(item: ClientListState, recordId: number): void {\n const config = item.config;\n const request = this.getReturnRecordRequest(item.key);\n\n if (!request || !this.hasValidIdentifiers(config)) {\n this.reloadByKey(item.key);\n return;\n }\n\n // The host's own scope filters plus the record id. Runtime filters (the\n // search box, a column filter) are deliberately left out: a record the\n // user just wrote should come back whether or not it matches whatever\n // they happen to have typed into the list.\n const filters: ClientListFetchRequestFilter[] = [\n ...config.filters,\n {\n key: CLIENT_LIST_RECORD_ID_FILTER_KEY,\n operator: 'Equals',\n value: recordId,\n },\n ];\n\n this.recordSubscriptions.get(item.key)?.unsubscribe();\n\n const sub = this.api\n .getRecord(config.contextKey!, request, filters)\n .subscribe({\n next: (response) => {\n this.recordSubscriptions.delete(item.key);\n const record = response.data?.records?.[0];\n\n if (!record || !this.state.upsertRecord(item.key, record, config)) {\n this.reloadByKey(item.key);\n return;\n }\n\n this.afterRecordApplied(item.key);\n },\n error: () => {\n this.recordSubscriptions.delete(item.key);\n this.reloadByKey(item.key);\n },\n });\n\n this.recordSubscriptions.set(item.key, sub);\n }\n\n /**\n * Runs the tail of a load for a list that changed without one: the row\n * action cache is stale (a written record's available actions follow its new\n * state), and hosts hang work off `dataLoaded` / `loaded`.\n */\n private afterRecordApplied(\n itemKey: string,\n options?: { invalidateRuntimeActions?: boolean },\n ): void {\n if (options?.invalidateRuntimeActions !== false) {\n this.runtimeActions.invalidateList(itemKey);\n }\n\n this.notifyDataLoaded(itemKey);\n this.loaded.emit(itemKey);\n }\n\n private toRuntimeActionsContext(\n item: ClientListState,\n row: RuntimeTableDisplayRow,\n config: ClientListRuntimeRecordActionsConfig,\n ): ClientListRuntimeRecordActionsContext | null {\n const recordId = this.resolveRecordId(config, row);\n if (recordId == null) return null;\n\n return {\n listKey: item.key,\n contextKey: item.config.contextKey ?? null,\n instanceId: item.config.instanceId ?? null,\n moduleId: item.config.moduleId ?? 0,\n row,\n recordId,\n };\n }\n\n private resolveRecordId(\n config: ClientListRuntimeRecordActionsConfig,\n row: RuntimeTableDisplayRow,\n ): number | null {\n return (config.resolveRecordId ?? defaultResolveRecordId)(row);\n }\n\n templateContext(item: ClientListState): ClientListContentTemplateContext {\n return {\n $implicit: item,\n table: item,\n item,\n loading: item.loading,\n error: item.error,\n data: item.rawData,\n };\n }\n\n defaultTitle(item: ClientListState): string {\n if (item.type === 'informative') {\n return this.transloco.translate(\n 'components.clientComponents.list.informativeDashboard',\n );\n }\n\n return this.transloco.translate(\n item.areaType === 'cards'\n ? 'components.clientComponents.list.cards'\n : 'components.clientComponents.list.table',\n );\n }\n\n ngOnDestroy(): void {\n this.subscriptions.forEach((sub) => sub.unsubscribe());\n this.subscriptions.clear();\n this.recordSubscriptions.forEach((sub) => sub.unsubscribe());\n this.recordSubscriptions.clear();\n this.requestPropertyKeys.clear();\n this.rowActionsLoadingFnCache.clear();\n this.runtimeActions.clearAll();\n }\n\n private configureItems(configs: ClientListConfiguration[]): void {\n const previousItems = this.state.itemsByKey();\n const hasMultipleConfigs = (configs ?? []).length > 1;\n\n const normalized: ClientListState[] = (configs ?? []).map(\n (config, index) => {\n const type = this.resolveType(config);\n const isInformative = type === 'informative';\n const formConfig = isInformative ? null : this.asFormConfig(config);\n const areaType = isInformative\n ? DEFAULT_AREA_TYPE\n : this.resolveAreaType(formConfig?.areaType);\n const mode = isInformative\n ? DEFAULT_MODE\n : this.resolveMode(formConfig?.mode, formConfig?.columnKeys);\n const isPaginated =\n !isInformative &&\n (areaType === 'table'\n ? (formConfig?.isPaginated ?? true)\n : (formConfig?.isPaginated ?? false));\n const configuredTablePageSize = this.resolvePositiveInteger(\n formConfig?.table?.pageSize,\n );\n const configuredTake = this.resolvePositiveInteger(formConfig?.take);\n const showHeader = config.showHeader ?? true;\n const take =\n !isInformative && (areaType === 'table' || isPaginated)\n ? isPaginated\n ? (configuredTake ??\n configuredTablePageSize ??\n this.resolveDefaultTake())\n : (configuredTake ?? this.resolveDefaultTake())\n : 0;\n const collapseEnabled =\n showHeader &&\n (config.collapse?.enabled ?? true) &&\n hasMultipleConfigs;\n const layout = this.resolveLayout(config);\n const key = config.key ?? this.createItemKey(config, index);\n const existing = previousItems[key];\n const normalizedConfig = this.toNormalizedConfig(\n config,\n type,\n areaType,\n mode,\n isPaginated,\n take,\n showHeader,\n collapseEnabled,\n layout,\n );\n // Paging is runtime state, not config state: it survives a reconfigure\n // that changed nothing about the fetch, and the *applied* page size\n // (the user's rows-per-page choice) is carried forward with it.\n const keepsPaging = preservesPaging(\n existing,\n areaType,\n normalizedConfig,\n );\n\n if (isInformative) {\n return {\n key,\n config: normalizedConfig,\n type: 'informative',\n areaType: 'table',\n loading: false,\n error: null,\n title: config.title?.trim() || '',\n moduleKey: '',\n totalCount: 0,\n columns: [],\n rows: [],\n cards: [],\n skip: 0,\n take: 0,\n expanded:\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\n dashboardData: existing?.dashboardData ?? null,\n rawData: existing?.rawData ?? null,\n };\n }\n\n if (areaType === 'cards') {\n return {\n key,\n config: normalizedConfig,\n type: 'form',\n areaType: 'cards',\n loading: false,\n error: null,\n title: config.title?.trim() || '',\n moduleKey: '',\n totalCount: 0,\n columns: [],\n rows: [],\n cards: [],\n // For infinite scroll `skip` is the next offset into the loaded\n // set, so it travels with that set: kept while the fetch is\n // unchanged (the cards themselves are kept too, by\n // `mergeItemState`), and restarted at 0 the moment the fetch\n // changes and the loaded set stops meaning anything.\n skip: keepsPaging ? existing.skip : 0,\n take: keepsPaging ? existing.take : take,\n expanded:\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\n dashboardData: null,\n rawData: existing?.rawData ?? null,\n };\n }\n\n return {\n key,\n config: normalizedConfig,\n type: 'form',\n areaType: 'table',\n loading: false,\n error: null,\n title: config.title?.trim() || '',\n moduleKey: '',\n totalCount: 0,\n columns: [],\n rows: [],\n cards: [],\n skip: keepsPaging ? existing.skip : 0,\n take: keepsPaging ? existing.take : take,\n expanded:\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\n dashboardData: null,\n rawData: existing?.rawData ?? null,\n };\n },\n );\n\n this.state.setConfigs(normalized);\n this.cleanupStaleResources(new Set(normalized.map((item) => item.key)));\n }\n\n private loadItem(item: ClientListState, force = false): void {\n if (item.type === 'informative') {\n this.loadInformative(item.key, item.config, force);\n return;\n }\n\n if (item.areaType === 'cards') {\n this.loadCards(item.key, item.config, 0, item.take, false, force);\n return;\n }\n\n this.loadTable(item.key, item.config, item.skip, item.take, force);\n }\n\n private loadTable(\n key: string,\n config: NormalizedClientListConfiguration,\n skip: number,\n take: number,\n force = false,\n ): void {\n if (!this.hasValidIdentifiers(config)) {\n this.state.setLoading(key, false);\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\n return;\n }\n\n const query = this.toTableQuery(config, skip, take);\n const filters = this.resolveFetchFilters(key, config);\n const requestSignature = this.createTableRequestSignature(\n config,\n query,\n filters,\n );\n\n if (force) {\n this.inFlightRequestSignatures.delete(key);\n this.fulfilledRequestSignatures.delete(key);\n } else if (\n this.inFlightRequestSignatures.get(key) === requestSignature ||\n this.fulfilledRequestSignatures.get(key) === requestSignature\n ) {\n return;\n }\n\n this.subscriptions.get(key)?.unsubscribe();\n this.inFlightRequestSignatures.set(key, requestSignature);\n this.state.setLoading(key, true);\n this.state.setError(key, null);\n\n const sub = this.api.getRows(config.contextKey!, query, filters).subscribe({\n next: ({ response, propertyKeys }) => {\n let hasLoadedData = false;\n\n if (response.data) {\n this.requestPropertyKeys.set(key, propertyKeys);\n this.state.setRowsResult(\n key,\n response.data,\n config,\n query.skip,\n query.take,\n );\n this.fulfilledRequestSignatures.set(key, requestSignature);\n hasLoadedData = true;\n } else {\n const message: string =\n response.message ??\n this.transloco.translate<string>(\n 'components.clientComponents.list.errors.tableRowsLoadFailed',\n );\n this.state.setError(key, message);\n this.errored.emit({ key, message });\n }\n\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n\n if (hasLoadedData) {\n this.notifyDataLoaded(key);\n this.loaded.emit(key);\n }\n },\n error: (error) => {\n const message: string =\n error?.error?.message ??\n error?.message ??\n this.transloco.translate<string>(\n 'components.clientComponents.list.errors.rowsLoadFailed',\n );\n this.state.setError(key, message);\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n this.errored.emit({ key, message });\n },\n });\n\n this.subscriptions.set(key, sub);\n }\n\n private loadCards(\n key: string,\n config: NormalizedClientListConfiguration,\n skip = 0,\n take = 0,\n append = false,\n force = false,\n ): void {\n if (!this.hasValidIdentifiers(config)) {\n this.state.setLoading(key, false);\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\n return;\n }\n\n const filters = this.resolveFetchFilters(key, config);\n const requestSignature = this.createCardsRequestSignature(\n config,\n filters,\n skip,\n take,\n );\n\n if (force) {\n this.inFlightRequestSignatures.delete(key);\n this.fulfilledRequestSignatures.delete(key);\n } else if (\n this.inFlightRequestSignatures.get(key) === requestSignature ||\n this.fulfilledRequestSignatures.get(key) === requestSignature\n ) {\n return;\n }\n\n this.subscriptions.get(key)?.unsubscribe();\n this.inFlightRequestSignatures.set(key, requestSignature);\n this.state.setLoading(key, true);\n this.state.setError(key, null);\n\n const sub = this.api\n .getCards(\n config.contextKey!,\n filters,\n config.isPaginated ? skip : undefined,\n config.isPaginated ? take : undefined,\n )\n .subscribe({\n next: (response) => {\n let hasLoadedData = false;\n\n if (response.data) {\n this.state.setCardsResult(\n key,\n response.data,\n config,\n skip,\n take,\n append,\n );\n this.fulfilledRequestSignatures.set(key, requestSignature);\n hasLoadedData = true;\n } else {\n const message: string =\n response.message ??\n this.transloco.translate<string>(\n 'components.clientComponents.list.errors.cardsLoadFailed',\n );\n this.state.setError(key, message);\n this.errored.emit({ key, message });\n }\n\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n\n if (hasLoadedData) {\n this.notifyDataLoaded(key);\n this.loaded.emit(key);\n }\n },\n error: (error) => {\n const message: string =\n error?.error?.message ??\n error?.message ??\n this.transloco.translate<string>(\n 'components.clientComponents.list.errors.cardsLoadFailed',\n );\n this.state.setError(key, message);\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n this.errored.emit({ key, message });\n },\n });\n\n this.subscriptions.set(key, sub);\n }\n\n private loadInformative(\n key: string,\n config: NormalizedClientListConfiguration,\n force = false,\n ): void {\n if (!this.hasValidIdentifiers(config)) {\n this.state.setLoading(key, false);\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\n return;\n }\n\n const requestSignature = this.createInformativeRequestSignature(config);\n\n if (force) {\n this.inFlightRequestSignatures.delete(key);\n this.fulfilledRequestSignatures.delete(key);\n } else if (\n this.inFlightRequestSignatures.get(key) === requestSignature ||\n this.fulfilledRequestSignatures.get(key) === requestSignature\n ) {\n return;\n }\n\n this.subscriptions.get(key)?.unsubscribe();\n this.inFlightRequestSignatures.set(key, requestSignature);\n this.state.setLoading(key, true);\n this.state.setError(key, null);\n\n const sub = this.api\n .getInformativeDashboard(config.levelId!, config.moduleId)\n .subscribe({\n next: (response) => {\n this.state.setInformativeResult(key, response.data ?? null, config);\n this.fulfilledRequestSignatures.set(key, requestSignature);\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n this.notifyDataLoaded(key);\n this.loaded.emit(key);\n },\n error: (error) => {\n if (error?.status === 404) {\n this.state.setInformativeResult(key, null, config);\n this.fulfilledRequestSignatures.set(key, requestSignature);\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n this.notifyDataLoaded(key);\n this.loaded.emit(key);\n return;\n }\n\n const message: string =\n error?.error?.message ??\n error?.message ??\n this.transloco.translate<string>(\n 'components.clientComponents.list.errors.informativeLoadFailed',\n );\n this.state.setError(key, message);\n this.state.setLoading(key, false);\n this.inFlightRequestSignatures.delete(key);\n this.errored.emit({ key, message });\n },\n });\n\n this.subscriptions.set(key, sub);\n }\n\n private resolveAreaType(\n areaType: ClientListAreaType | undefined,\n ): ClientListAreaType {\n return areaType === 'cards' ? 'cards' : DEFAULT_AREA_TYPE;\n }\n\n private resolveType(config: ClientListConfiguration): ClientListType {\n return config.type === 'informative' ? 'informative' : DEFAULT_TYPE;\n }\n\n private resolveMode(\n mode: ClientListMode | undefined,\n columnKeys: string[] | undefined,\n ): ClientListMode {\n if (mode !== 'override') return DEFAULT_MODE;\n return (columnKeys ?? []).length > 0 ? 'override' : DEFAULT_MODE;\n }\n\n private toNormalizedConfig(\n config: ClientListConfiguration,\n type: ClientListType,\n areaType: ClientListAreaType,\n mode: ClientListMode,\n isPaginated: boolean,\n take: number,\n showHeader: boolean,\n collapseEnabled: boolean,\n layout: Required<ClientListLayoutConfig>,\n ): NormalizedClientListConfiguration {\n const informativeConfig = this.asInformativeConfig(config);\n const formConfig = this.asFormConfig(config);\n\n return {\n contextKey: formConfig?.contextKey ?? null,\n instanceId:\n formConfig?.instanceId ?? informativeConfig?.instanceId ?? null,\n filters: formConfig?.filters ?? informativeConfig?.filters ?? [],\n levelId: informativeConfig?.levelId ?? null,\n moduleId: informativeConfig?.moduleId ?? 0,\n type,\n areaType,\n mode,\n isPaginated,\n take,\n title: config.title,\n showHeader,\n columnKeys: formConfig?.columnKeys ?? [],\n table: this.resolveTableDisplayConfig(formConfig, take, isPaginated),\n headerStart: config.headerStart,\n headerEnd: config.headerEnd,\n toolbarStart: config.toolbarStart,\n toolbarEnd: config.toolbarEnd,\n contentStart: config.contentStart,\n contentEnd: config.contentEnd,\n templateContent: config.templateContent,\n rowActions: config.rowActions ?? [],\n actionShape: config.actionShape,\n dataLoaded: config.dataLoaded,\n runtimeRecordActions: config.runtimeRecordActions,\n transformResult: formConfig?.transformResult,\n collapse: {\n enabled: collapseEnabled,\n expandedByDefault: config.collapse?.expandedByDefault ?? true,\n collapseIcon: config.collapse?.collapseIcon ?? DEFAULT_COLLAPSE_ICON,\n expandIcon: config.collapse?.expandIcon ?? DEFAULT_EXPAND_ICON,\n },\n layout,\n };\n }\n\n private createItemKey(\n config: ClientListConfiguration,\n index: number,\n ): string {\n if (this.isInformativeConfig(config)) {\n return [\n 'informative',\n config.moduleId,\n config.instanceId ?? 'scope',\n this.serializeFilters(config.filters),\n index,\n ].join('-');\n }\n\n return [\n config.contextKey,\n config.instanceId ?? 'scope',\n this.serializeFilters(config.filters),\n config.areaType ?? DEFAULT_AREA_TYPE,\n index,\n ].join('-');\n }\n\n private resolveLayout(\n config: ClientListConfiguration,\n ): Required<ClientListLayoutConfig> {\n const hasStart = !!config.contentStart;\n const hasEnd = !!config.contentEnd;\n\n const startSpan = hasStart\n ? this.clampSpan(config.layout?.startSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\n : 0;\n let endSpan = hasEnd\n ? this.clampSpan(config.layout?.endSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\n : 0;\n\n if (startSpan + endSpan >= DEFAULT_GRID_COLUMNS) {\n endSpan = Math.max(0, DEFAULT_GRID_COLUMNS - startSpan - 1);\n }\n\n const availableForTable = Math.max(\n 1,\n DEFAULT_GRID_COLUMNS - startSpan - endSpan,\n );\n const tableSpan = this.clampSpan(\n config.layout?.tableSpan ?? availableForTable,\n 1,\n availableForTable,\n );\n\n return {\n startSpan,\n tableSpan,\n endSpan,\n };\n }\n\n private resolveTableDisplayConfig(\n config: ClientListFormConfiguration | null,\n take: number,\n isPaginated: boolean,\n ) {\n const configuredPageSize = this.resolvePositiveInteger(\n config?.table?.pageSize,\n );\n\n return {\n pageSize: isPaginated\n ? take\n : (configuredPageSize ?? DEFAULT_TABLE_PAGE_SIZE),\n searchable: config?.table?.searchable ?? false,\n exportable: config?.table?.exportable ?? false,\n persistStateExclude: [\n ...(config?.table?.persistStateExclude ??\n DEFAULT_TABLE_PERSIST_STATE_EXCLUDE),\n ],\n };\n }\n\n private clampSpan(\n value: number | undefined,\n min = 0,\n max = DEFAULT_GRID_COLUMNS,\n ): number {\n const normalized = Number(value ?? min);\n if (!Number.isFinite(normalized)) return min;\n return Math.min(max, Math.max(min, Math.trunc(normalized)));\n }\n\n private resolvePositiveInteger(value: number | undefined): number | null {\n const normalized = Number(value);\n if (!Number.isFinite(normalized) || normalized <= 0) {\n return null;\n }\n\n return Math.trunc(normalized);\n }\n\n private resolveDefaultTake(): number {\n return (\n this.resolvePositiveInteger(this.defaultTake()) ??\n DEFAULT_SERVER_PAGE_SIZE\n );\n }\n\n private resolveNonNegativeInteger(value: number | undefined): number | null {\n const normalized = Number(value);\n if (!Number.isFinite(normalized) || normalized < 0) {\n return null;\n }\n\n return Math.trunc(normalized);\n }\n\n private cleanupStaleResources(activeKeys: Set<string>): void {\n for (const [key, sub] of this.subscriptions.entries()) {\n if (!activeKeys.has(key)) {\n sub.unsubscribe();\n this.subscriptions.delete(key);\n this.inFlightRequestSignatures.delete(key);\n this.fulfilledRequestSignatures.delete(key);\n }\n }\n\n for (const [key, sub] of this.recordSubscriptions.entries()) {\n if (!activeKeys.has(key)) {\n sub.unsubscribe();\n this.recordSubscriptions.delete(key);\n }\n }\n\n for (const key of this.runtimeFilters.keys()) {\n if (!activeKeys.has(key)) {\n this.runtimeFilters.delete(key);\n }\n }\n\n for (const key of this.requestPropertyKeys.keys()) {\n if (!activeKeys.has(key)) {\n this.requestPropertyKeys.delete(key);\n }\n }\n\n for (const key of this.rowActionsLoadingFnCache.keys()) {\n if (!activeKeys.has(key)) {\n this.rowActionsLoadingFnCache.delete(key);\n this.runtimeActions.invalidateList(key);\n }\n }\n }\n\n private notifyDataLoaded(key: string): void {\n const item = this.state.itemsByKey()[key];\n if (!item) {\n return;\n }\n\n this.maybeEagerLoadRuntimeActions(item);\n item.config.dataLoaded?.(this.templateContext(item));\n }\n\n private maybeEagerLoadRuntimeActions(item: ClientListState): void {\n const config = item.config.runtimeRecordActions;\n if (!config?.enabled || config.loadStrategy !== 'eager') return;\n if (item.type !== 'form' || item.areaType !== 'table') return;\n\n for (const row of item.rows) {\n const ctx = this.toRuntimeActionsContext(item, row, config);\n if (!ctx) continue;\n this.runtimeActions.request(config, ctx);\n }\n }\n\n private toTableQuery(\n config: NormalizedClientListConfiguration,\n skip: number,\n take: number,\n ): ClientListTableQuery {\n const queryTake =\n this.resolvePositiveInteger(take) ?? this.resolveDefaultTake();\n\n return {\n mode: config.mode,\n columnKeys: config.mode === 'override' ? config.columnKeys : undefined,\n skip: config.isPaginated ? skip : 0,\n take: queryTake,\n };\n }\n\n private createTableRequestSignature(\n config: NormalizedClientListConfiguration,\n query: ClientListTableQuery,\n filters: NormalizedClientListConfiguration['filters'],\n ): string {\n return [\n config.type,\n config.areaType,\n config.contextKey ?? 'x',\n this.serializeFilters(filters),\n query.mode,\n query.skip,\n query.take,\n ...(query.columnKeys ?? []),\n ].join('|');\n }\n\n private createCardsRequestSignature(\n config: NormalizedClientListConfiguration,\n filters: NormalizedClientListConfiguration['filters'],\n skip: number,\n take: number,\n ): string {\n return [\n config.type,\n config.areaType,\n config.contextKey ?? 'x',\n this.serializeFilters(filters),\n 'Card',\n config.isPaginated ? skip : 0,\n config.isPaginated ? take : 0,\n ].join('|');\n }\n\n private createInformativeRequestSignature(\n config: NormalizedClientListConfiguration,\n ): string {\n return [\n config.type,\n config.levelId ?? 'x',\n config.moduleId,\n this.serializeFilters(config.filters),\n 'dashboard',\n ].join('|');\n }\n\n private hasValidIdentifiers(\n config: NormalizedClientListConfiguration,\n ): boolean {\n if (config.type === 'informative') {\n return (\n config.levelId != null &&\n Number.isFinite(config.levelId) &&\n config.levelId > 0 &&\n Number.isFinite(config.moduleId) &&\n config.moduleId > 0\n );\n }\n\n return Boolean(config.contextKey?.trim());\n }\n\n private getMissingIdentifiersMessage(\n config: NormalizedClientListConfiguration,\n ): string {\n if (config.type === 'informative') {\n return this.transloco.translate(\n 'components.clientComponents.list.errors.missingModuleId',\n );\n }\n\n return this.transloco.translate(\n 'components.clientComponents.list.errors.missingContextKey',\n );\n }\n\n private isInformativeConfig(\n config: ClientListConfiguration,\n ): config is ClientListInformativeConfiguration {\n return config.type === 'informative';\n }\n\n private asInformativeConfig(\n config: ClientListConfiguration,\n ): ClientListInformativeConfiguration | null {\n return this.isInformativeConfig(config) ? config : null;\n }\n\n private asFormConfig(\n config: ClientListConfiguration,\n ): ClientListFormConfiguration | null {\n return this.isInformativeConfig(config) ? null : config;\n }\n\n private serializeFilters(\n filters: NormalizedClientListConfiguration['filters'] | undefined,\n ): string {\n return JSON.stringify(filters ?? []);\n }\n\n private resolveFetchFilters(\n key: string,\n config: NormalizedClientListConfiguration,\n ): NormalizedClientListConfiguration['filters'] {\n return mergeRuntimeFilters(\n config.filters,\n this.runtimeFilters.get(key),\n this.state.itemsByKey()[key]?.columns,\n );\n }\n}\n","<div class=\"flex flex-col gap-4\">\r\n @for (item of items(); track item.key) {\r\n <section class=\"flex flex-col gap-4\">\r\n @if (item.config.showHeader) {\r\n <div class=\"flex w-full items-center gap-2\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-2\">\r\n @if (item.config.collapse.enabled) {\r\n <mt-button\r\n variant=\"text\"\r\n severity=\"secondary\"\r\n [icon]=\"\r\n item.expanded\r\n ? item.config.collapse.collapseIcon\r\n : item.config.collapse.expandIcon\r\n \"\r\n (onClick)=\"toggleExpanded(item.key)\"\r\n />\r\n }\r\n <h3 class=\"m-0 text-lg font-semibold\">\r\n {{ item.title || item.moduleKey || defaultTitle(item) }}\r\n </h3>\r\n @if (item.config.headerStart) {\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.headerStart\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n @if (item.config.headerEnd) {\r\n <div class=\"ml-auto flex shrink-0 items-center gap-2\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.headerEnd\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (item.expanded || !item.config.collapse.enabled) {\r\n @if (item.config.templateContent) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.templateContent\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n } @else if (item.type === \"informative\") {\r\n <mt-client-list-informative-view [state]=\"item\" />\r\n } @else if (item.areaType === \"table\") {\r\n <mt-client-list-table-view\r\n [state]=\"item\"\r\n [rowActions]=\"rowActionsFor(item)\"\r\n [actionShape]=\"item.config.actionShape\"\r\n [rowActionsLoadingFn]=\"rowActionsLoadingFnFor(item)\"\r\n (rowActionsRequested)=\"onRowActionsRequested(item, $event)\"\r\n (lazyLoad)=\"onLazyLoad(item.key, $event)\"\r\n (rowClick)=\"onTableRowClick(item, $event)\"\r\n />\r\n } @else {\r\n <mt-client-list-cards-view\r\n [state]=\"item\"\r\n [rowActions]=\"rowActionsFor(item)\"\r\n [rowActionsLoadingFn]=\"rowActionsLoadingFnFor(item)\"\r\n (rowActionsRequested)=\"onRowActionsRequested(item, $event)\"\r\n (lazyLoad)=\"onLazyLoad(item.key, $event)\"\r\n (loadMore)=\"loadMoreCards(item.key)\"\r\n (cardClick)=\"onCardClick(item, $event)\"\r\n />\r\n }\r\n }\r\n </section>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DEFAULT_GRID_COLUMNS"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A,IAAA,EAAA,UAAA,EAAA,IAAA,EDeI,YAAY,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACZ,MAAM,yWACN,mBAAmB,EAAA,QAAA,EAAA,2BAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,YAAA,EAAA,aAAA,EAAA,qBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,qBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,mBAAmB,EAAA,QAAA,EAAA,2BAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,YAAA,EAAA,qBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,UAAA,EAAA,UAAA,EAAA,WAAA,EAAA,qBAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACnB,yBAAyB,EAAA,QAAA,EAAA,iCAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAShB,UAAU,EAAA,UAAA,EAAA,CAAA;kBAjBtB,SAAS;+BACE,gBAAgB,EAAA,UAAA,EACd,IAAI,EAAA,OAAA,EACP;wBACP,YAAY;wBACZ,MAAM;wBACN,mBAAmB;wBACnB,mBAAmB;wBACnB,yBAAyB;qBAC1B,EAAA,SAAA,EACU;wBACT,sBAAsB;wBACtB,+BAA+B;wBAC/B,wBAAwB;AACzB,qBAAA,EAAA,QAAA,EAAA,6hGAAA,EAAA;;;AEnGH;;AAEG;;;;"}
1
+ {"version":3,"file":"masterteam-client-components-client-list.mjs","sources":["../../../../packages/masterteam/client-components/client-list/models/client-list.model.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-api.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-state.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-runtime-actions.service.ts","../../../../packages/masterteam/client-components/client-list/services/client-list-toolbar.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-table-view/client-list-table-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-table-view/client-list-table-view.html","../../../../packages/masterteam/client-components/client-list/components/client-list-cards-view/client-list-cards-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-cards-view/client-list-cards-view.html","../../../../packages/masterteam/client-components/client-list/utils/informative-filters.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-informative-view/client-list-informative-view.ts","../../../../packages/masterteam/client-components/client-list/components/client-list-informative-view/client-list-informative-view.html","../../../../packages/masterteam/client-components/client-list/utils/runtime-filters.ts","../../../../packages/masterteam/client-components/client-list/utils/paging-continuity.ts","../../../../packages/masterteam/client-components/client-list/client-list.ts","../../../../packages/masterteam/client-components/client-list/client-list.html","../../../../packages/masterteam/client-components/client-list/masterteam-client-components-client-list.ts"],"sourcesContent":["import { TemplateRef } from '@angular/core';\nimport { DashboardBuilderData } from '@masterteam/dashboard-builder';\nimport {\n EntityConfiguration,\n EntityData,\n} from '@masterteam/components/entities';\nimport {\n ColumnDef,\n TableAction,\n TableActionShape,\n TableFilters,\n} from '@masterteam/components/table';\nimport { RuntimeAction } from '@masterteam/components/runtime-action';\n\nexport type ClientListMode = 'auto' | 'override';\nexport type ClientListAreaType = 'table' | 'cards';\nexport type ClientListType = 'form' | 'informative';\nexport type ClientListTablePersistStateKey =\n | 'pageSize'\n | 'pagePosition'\n | 'sort'\n | 'selection'\n | 'groupBy';\n\nexport interface Response<T> {\n endpoint: string;\n status: number;\n code: number;\n locale: string;\n message?: string | null;\n errors?: unknown | null;\n data: T;\n cacheSession?: string;\n}\n\nexport type ClientListRuntimeContext = string;\nexport type ClientListFetchStateKey = 'escalation';\nexport const CLIENT_LIST_RECORD_STATE_KEY = '__clientListRecordState';\n\n/** Record state every list request asks for. */\nexport const CLIENT_LIST_DEFAULT_INCLUDE_STATE: readonly ClientListFetchStateKey[] =\n ['escalation'];\n\n/**\n * `fetch/query` filter key that selects a single record by its own id. Reading\n * one record back after a write filters on this, never on the list's scope\n * filters alone — those match a whole page, not the row that just changed.\n */\nexport const CLIENT_LIST_RECORD_ID_FILTER_KEY = 'id';\n\nexport interface ClientListBaseConfiguration {\n key?: string;\n title?: string;\n showHeader?: boolean;\n collapse?: ClientListCollapseConfig;\n layout?: ClientListLayoutConfig;\n headerStart?: TemplateRef<ClientListContentTemplateContext>;\n headerEnd?: TemplateRef<ClientListContentTemplateContext>;\n /**\n * Templates rendered inside the list's own toolbar row, alongside the search\n * box / filter / export controls, rather than above it. Use these for a\n * control that belongs to the list itself (a view switcher, a scope picker)\n * so it reads as one toolbar instead of a second floating row. `headerStart`\n * / `headerEnd` remain the slots for the title row, which only renders when\n * `showHeader` is on. Rendered without a context object.\n */\n toolbarStart?: TemplateRef<unknown>;\n toolbarEnd?: TemplateRef<unknown>;\n contentStart?: TemplateRef<ClientListContentTemplateContext>;\n contentEnd?: TemplateRef<ClientListContentTemplateContext>;\n templateContent?: TemplateRef<ClientListContentTemplateContext>;\n rowActions?: TableAction[];\n actionShape?: TableActionShape;\n dataLoaded?: ClientListDataLoadedHandler;\n /**\n * Lazy backend-driven per-row actions. When enabled, ClientList fetches\n * each row's available `RuntimeAction[]` only when the user opens the row's\n * 3-dots menu (default `loadStrategy: 'onMenuOpen'`), then merges them into\n * the row's action list. Replaces the eager fan-out of one HTTP per visible\n * row that callers used to wire by hand.\n */\n runtimeRecordActions?: ClientListRuntimeRecordActionsConfig;\n}\n\nexport interface ClientListRuntimeRecordActionsContext {\n listKey: string;\n contextKey: string | null;\n instanceId: number | null;\n moduleId: number;\n row: RuntimeTableDisplayRow;\n recordId: number;\n}\n\nexport interface ClientListRuntimeRecordActionsConfig {\n /** Master flag — set to false to disable without removing the config block. */\n enabled: boolean;\n /**\n * `onMenuOpen` (default): fetch when the 3-dots popover opens for a row.\n * Requires `actionShape: 'popover'`. `eager`: fetch for every visible row\n * after the list loads (legacy behavior, kept for opt-in).\n */\n loadStrategy?: 'onMenuOpen' | 'eager';\n /**\n * Endpoint template. `{instanceId}` is replaced with the list's\n * `instanceId`. Defaults to\n * `LevelData/{instanceId}/workspace-record-actions`.\n */\n endpoint?: string;\n /**\n * Query params per row. Defaults to\n * `{ targetType: 'ModuleData', targetId: recordId, moduleKey? }`.\n */\n buildParams?: (\n ctx: ClientListRuntimeRecordActionsContext,\n ) => Record<string, string | number>;\n /** Cache TTL in ms. `null` = until manual invalidation. Default: 60_000. */\n cacheTtlMs?: number | null;\n /** Read the record id from a row. Defaults to `row.Id ?? row.id ?? row.ModuleDataId`. */\n resolveRecordId?: (row: RuntimeTableDisplayRow) => number | null;\n /** Read the module key from a row (for the `moduleKey` query param). */\n resolveModuleKey?: (\n row: RuntimeTableDisplayRow,\n ctx: { listKey: string; moduleId: number },\n ) => string | null;\n /**\n * Optional visual overrides for discovered runtime row actions. Use this to\n * align backend-discovered actions with existing app action styling.\n */\n resolveActionPresentation?: (\n action: RuntimeAction,\n ) => Partial<\n Pick<\n TableAction,\n 'icon' | 'color' | 'variant' | 'label' | 'tooltip' | 'loading'\n >\n >;\n /**\n * Optional interceptor before the default runtime runner executes a\n * discovered action. Return `true` when the consumer handled the action and\n * the built-in runner should be skipped.\n */\n onActionTriggered?: (\n action: RuntimeAction,\n ctx: ClientListRuntimeRecordActionsContext,\n ) => boolean | Promise<boolean>;\n /**\n * Called after a runtime action executes successfully (the list also\n * auto-reloads and the per-row cache is invalidated). Use this to refresh\n * any external state the consumer owns.\n */\n onActionExecuted?: (\n action: RuntimeAction,\n ctx: ClientListRuntimeRecordActionsContext,\n ) => void;\n /**\n * Visual: icon used for runtime action buttons (popover entries). Defaults\n * to `media.play-circle`. Must be a valid `MTIcon` literal.\n */\n actionIcon?: string;\n}\n\nexport interface ClientListTableDisplayConfig {\n pageSize?: number;\n searchable?: boolean;\n exportable?: boolean;\n /**\n * mt-table storage keys to exclude when this list provides a storageKey.\n * Defaults to `['pagePosition']`, so current page is not restored unless the\n * host explicitly opts in with `[]`.\n */\n persistStateExclude?: ClientListTablePersistStateKey[];\n}\n\nexport interface NormalizedClientListTableDisplayConfig {\n pageSize: number;\n searchable: boolean;\n exportable: boolean;\n persistStateExclude: ClientListTablePersistStateKey[];\n}\n\nexport interface ClientListFormConfiguration extends ClientListBaseConfiguration {\n type?: 'form';\n areaType?: ClientListAreaType;\n contextKey: ClientListRuntimeContext;\n /**\n * Optional host/runtime metadata forwarded to row-action context. It does\n * not add request filters; hosts own the complete `filters` array.\n */\n instanceId?: number;\n /** Complete filter array forwarded unchanged to `fetch/query`. */\n filters?: ClientListFetchRequestFilter[];\n mode?: ClientListMode;\n columnKeys?: string[];\n /**\n * `areaType: 'table'` — defaults to true. Paginated tables use backend\n * page/pageSize requests and render a paginator. Set false only for\n * bounded local datasets that should render through virtual scroll.\n *\n * `areaType: 'cards'` — defaults to false (the full record set is fetched\n * in one call, preserving pre-existing behavior). Set true to opt into\n * backend-paginated cards, fetched page by page and appended as the user\n * scrolls (infinite scroll) instead of loading every record up front.\n *\n * Note for cards: this flag used to be ignored entirely — cards always\n * fetched everything regardless of what was configured. A cards config\n * that already carries `isPaginated: true` (copied from a table config,\n * or a config object shared across area types) therefore changes\n * behaviour: it now pages. Requires backend support for `page`/`pageSize`\n * on the `Card` projection; without a `pagination` block in the response\n * the list degrades to the first page only.\n */\n isPaginated?: boolean;\n /**\n * Backend page size when `isPaginated` is true. For local virtual-scroll\n * tables (`isPaginated: false`), this is the explicit fetch cap. Ignored\n * for cards when `isPaginated` is false.\n */\n take?: number;\n /**\n * Presentation settings. `pageSize` controls visible table rows/paginator\n * size; it is not used as the local fetch cap when `isPaginated` is false.\n */\n table?: ClientListTableDisplayConfig;\n /**\n * Host hook to reshape built columns/rows before render — see\n * {@link ClientListTableTransform}. Applies to `table` area only.\n */\n transformResult?: ClientListTableTransform;\n}\n\nexport interface ClientListInformativeConfiguration extends ClientListBaseConfiguration {\n type: 'informative';\n levelId: number;\n moduleId: number;\n /**\n * Optional host/runtime metadata. It does not add dashboard filters; hosts\n * own the complete `filters` array.\n */\n instanceId?: number;\n /** Complete filter array converted by key/value to dashboard extraFilters. */\n filters?: ClientListFetchRequestFilter[];\n areaType?: 'table';\n}\n\nexport type ClientListConfiguration =\n | ClientListFormConfiguration\n | ClientListInformativeConfiguration;\n\nexport interface ClientListCollapseConfig {\n enabled?: boolean;\n expandedByDefault?: boolean;\n collapseIcon?: string;\n expandIcon?: string;\n}\n\nexport interface ClientListLayoutConfig {\n startSpan?: number;\n tableSpan?: number;\n endSpan?: number;\n}\n\nexport interface ClientListTableQuery {\n mode: ClientListMode;\n columnKeys?: string[];\n skip: number;\n take: number;\n}\n\nexport type ClientListFetchProjection = 'Card' | 'Table';\n\nexport interface ClientListFetchRequestFilter {\n key: string;\n operator: 'Equals' | 'Contains' | 'GreaterThanOrEqual' | 'LessThanOrEqual';\n value: string | number;\n}\n\nexport interface ClientListFetchRequestDisplay {\n areas: string[];\n}\n\nexport interface ClientListFetchQueryRequest {\n contextKey: string;\n projection: ClientListFetchProjection;\n propertyKeys?: string[];\n filters?: ClientListFetchRequestFilter[];\n includeState?: ClientListFetchStateKey[];\n page?: number;\n pageSize?: number;\n surfaceKey?: string;\n display?: ClientListFetchRequestDisplay;\n}\n\n/**\n * The query settings a list renders with, in the shape `process-submit` takes\n * as `returnRecord`. Sending these with a write asks the backend to project\n * the written record exactly the way this list would have fetched it, so the\n * list can splice the result straight in.\n *\n * The same object doubles as the spec for reading a single record back through\n * `fetch/query` when the write could not project one — one description of\n * \"how this list reads a record\", used by both paths so they cannot drift.\n */\nexport interface ClientListReturnRecordRequest {\n projection: ClientListFetchProjection;\n surfaceKey?: string;\n includeState?: ClientListFetchStateKey[];\n propertyKeys?: string[];\n culture?: string;\n}\n\nexport type ClientListRecordProjectionStatus = 'Available' | 'Unavailable';\n\n/**\n * The part of a `process-submit` response a list needs to apply a write\n * locally. Structural on purpose: `ProcessFormSubmitResponse` from\n * `@masterteam/forms/client-form` satisfies it, and so does any host-owned\n * envelope that carries the same three keys.\n */\nexport interface ClientListRecordWriteResult {\n /** `PendingApproval` writes nothing yet — the list must stay as it is. */\n status?: string | null;\n recordId?: number | string | null;\n record?: ClientListFetchRecord | null;\n recordProjectionStatus?: ClientListRecordProjectionStatus | string | null;\n}\n\n/**\n * A table page plus the `propertyKeys` the request actually carried. The keys\n * are not derivable from the response — the backend echoes columns, not the\n * projection it was asked for — and `returnRecord` has to repeat them\n * verbatim, so the request reports them.\n */\nexport interface ClientListRowsFetchResult {\n response: Response<RuntimeTableRowsResponse>;\n /** `undefined` when the request left the projection to the backend. */\n propertyKeys?: string[];\n}\n\nexport interface ClientListTableSettingsColumn {\n key?: string;\n propertyKey?: string;\n order?: number;\n visible?: boolean;\n}\n\nexport interface ClientListTableSettingsCatalogResponse {\n effectiveColumns?: Array<ClientListTableSettingsColumn | string>;\n}\n\nexport interface ClientListFetchPropertyMeta {\n id: number;\n key: string;\n normalizedKey: string;\n label: string;\n viewType: string;\n configuration: EntityData['propertyConfiguration'];\n source?: string;\n order: number;\n isRequired?: boolean;\n isSystem?: boolean;\n}\n\nexport interface ClientListFetchValueCell {\n raw: unknown;\n value: unknown;\n display?: string | null;\n comparison?: import('@masterteam/components/entities').PropertyValueComparison;\n [key: string]: unknown;\n}\n\nexport interface ClientListRecordEscalationState {\n hasActive: boolean;\n instanceId?: number | null;\n}\n\nexport interface ClientListFetchRecordState {\n escalation?: ClientListRecordEscalationState | null;\n}\n\nexport interface ClientListFetchRecord {\n id: number;\n name?: string;\n schemaId?: number;\n values: Record<string, ClientListFetchValueCell>;\n state?: ClientListFetchRecordState | null;\n}\n\nexport interface ClientListFetchSchema {\n id: number;\n key: string;\n name: string;\n order?: number;\n typeGroup?: string;\n}\n\nexport interface ClientListFetchCatalog {\n properties: ClientListFetchPropertyMeta[];\n /**\n * Catalog metadata for properties captured inside another property's value,\n * keyed by the owning property key (e.g. a `LookupModuleCheckList`).\n */\n nestedProperties?: Record<string, ClientListFetchPropertyMeta[]>;\n}\n\nexport interface ClientListFetchTableColumn {\n key: string;\n label: string;\n viewType: string;\n order: number;\n visible: boolean;\n configuration: Record<string, unknown> | null;\n}\n\nexport interface ClientListFetchCardDisplayOrderItem {\n contextKey: string;\n areaKey: string;\n propertyKey: string;\n order: number;\n configuration?: EntityConfiguration | null;\n}\n\nexport interface ClientListFetchCardGroup {\n schemaId: number;\n recordIds: number[];\n}\n\nexport interface ClientListFetchProjectionMeta {\n kind: string;\n columns?: ClientListFetchTableColumn[];\n displayOrder?: ClientListFetchCardDisplayOrderItem[];\n groups?: ClientListFetchCardGroup[];\n}\n\nexport interface ClientListFetchQueryResponse {\n contextKey: string;\n schemas?: ClientListFetchSchema[];\n catalog?: ClientListFetchCatalog;\n records?: ClientListFetchRecord[];\n pagination?: {\n page: number;\n pageSize: number;\n totalCount: number;\n };\n projectionMeta?: ClientListFetchProjectionMeta;\n}\n\nexport interface RuntimeEntityColumnDef extends ColumnDef {\n key: string;\n /** Stable fetch/query filter key from the runtime property catalog. */\n normalizedKey?: string;\n label: string;\n type: 'entity';\n viewType?: string;\n order?: number;\n visible?: boolean;\n configuration?: Record<string, unknown> | null;\n}\n\nexport type RuntimeTableDisplayRow = Record<string, unknown | EntityData>;\nexport type RuntimeTableRowsResponse = ClientListFetchQueryResponse;\n\n/**\n * Built table shape handed to a {@link ClientListTableTransform}: the visible\n * `columns` (already filtered + ordered) and the per-row `rows` (each cell an\n * `EntityData` keyed by column key, plus the `Id` field).\n */\nexport interface ClientListTableTransformResult {\n columns: RuntimeEntityColumnDef[];\n rows: RuntimeTableDisplayRow[];\n}\n\n/**\n * Optional host hook to reshape the table after ClientList builds it from the\n * fetch response and before it is rendered. Use it to merge/derive columns\n * (e.g. collapse two type-specific columns into one conditional column) without\n * forking the library. Must return the columns/rows to render; return the input\n * unchanged to opt out. The raw `response` is provided for cases where the\n * discriminator lives in a property that is not a visible column.\n */\nexport type ClientListTableTransform = (\n result: ClientListTableTransformResult,\n response: RuntimeTableRowsResponse,\n) => ClientListTableTransformResult;\n\nexport interface ClientListCardModule {\n id: number;\n key?: string;\n name: string;\n order?: number;\n typeGroup?: string;\n}\n\nexport type ClientListCardProperty = EntityData;\n\nexport interface ClientListCard {\n id: number;\n name: string;\n module?: ClientListCardModule;\n instanceId?: number;\n state?: ClientListFetchRecordState | null;\n properties: ClientListCardProperty[];\n displayProperties?: Record<string, unknown>;\n entities: EntityData[];\n}\n\nexport type ClientListCardsPayload = ClientListFetchQueryResponse;\n\nexport interface ClientListInformativeChartLink {\n id?: number;\n chartComponentId?: string;\n configuration?: Record<string, any>;\n order?: number;\n}\n\nexport interface ClientListInformativeDashboardPayload {\n moduleId: number;\n ignoreQueryFilter: boolean;\n filters: Record<string, any> | any[];\n extraInfo: Record<string, any>;\n versionNumber: number;\n chartLinks: ClientListInformativeChartLink[];\n}\n\nexport interface ClientListBaseState {\n key: string;\n config: NormalizedClientListConfiguration;\n type: ClientListType;\n areaType: ClientListAreaType;\n loading: boolean;\n error: string | null;\n title: string;\n moduleKey: string;\n totalCount: number;\n columns: RuntimeEntityColumnDef[];\n rows: RuntimeTableDisplayRow[];\n cards: ClientListCard[];\n skip: number;\n take: number;\n expanded: boolean;\n dashboardData: DashboardBuilderData | null;\n rawData: unknown | null;\n}\n\nexport interface ClientListTableState extends ClientListBaseState {\n type: 'form';\n areaType: 'table';\n}\n\nexport interface ClientListCardsState extends ClientListBaseState {\n type: 'form';\n areaType: 'cards';\n}\n\nexport interface ClientListInformativeState extends ClientListBaseState {\n type: 'informative';\n areaType: 'table';\n}\n\nexport type ClientListState =\n | ClientListTableState\n | ClientListCardsState\n | ClientListInformativeState;\n\nexport type ClientListClickableItem = RuntimeTableDisplayRow | ClientListCard;\n\nexport interface ClientListItemClickedEvent {\n key: string;\n areaType: 'table' | 'cards';\n item: ClientListClickableItem;\n state: ClientListState;\n}\n\nexport interface NormalizedClientListConfiguration {\n contextKey: ClientListRuntimeContext | null;\n instanceId: number | null;\n filters: ClientListFetchRequestFilter[];\n levelId: number | null;\n moduleId: number;\n type: ClientListType;\n areaType: ClientListAreaType;\n mode: ClientListMode;\n isPaginated: boolean;\n take: number;\n title?: string;\n showHeader: boolean;\n columnKeys: string[];\n table: NormalizedClientListTableDisplayConfig;\n collapse: Required<ClientListCollapseConfig>;\n layout: Required<ClientListLayoutConfig>;\n headerStart?: TemplateRef<ClientListContentTemplateContext>;\n headerEnd?: TemplateRef<ClientListContentTemplateContext>;\n toolbarStart?: TemplateRef<unknown>;\n toolbarEnd?: TemplateRef<unknown>;\n contentStart?: TemplateRef<ClientListContentTemplateContext>;\n contentEnd?: TemplateRef<ClientListContentTemplateContext>;\n templateContent?: TemplateRef<ClientListContentTemplateContext>;\n rowActions: TableAction[];\n actionShape?: TableActionShape;\n dataLoaded?: ClientListDataLoadedHandler;\n runtimeRecordActions?: ClientListRuntimeRecordActionsConfig;\n transformResult?: ClientListTableTransform;\n}\n\nexport interface ClientListContentTemplateContext {\n $implicit: ClientListState;\n table: ClientListState;\n item: ClientListState;\n loading: boolean;\n error: string | null;\n data: unknown | null;\n}\n\nexport type ClientListDataLoadedHandler = (\n context: ClientListContentTemplateContext,\n) => void;\n\nexport interface ClientListLazyLoadEvent {\n pageSize?: number;\n first?: number;\n currentPage?: number;\n filters?: TableFilters;\n}\n","import { Injectable, inject } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { map, Observable, of, switchMap } from 'rxjs';\r\nimport {\r\n CLIENT_LIST_DEFAULT_INCLUDE_STATE,\r\n ClientListFetchQueryResponse,\r\n ClientListFetchRequestFilter,\r\n ClientListCardsPayload,\r\n ClientListFetchQueryRequest,\r\n ClientListReturnRecordRequest,\r\n ClientListRowsFetchResult,\r\n ClientListRuntimeContext,\r\n ClientListInformativeDashboardPayload,\r\n ClientListTableSettingsCatalogResponse,\r\n ClientListTableQuery,\r\n Response,\r\n RuntimeTableRowsResponse,\r\n} from '../models/client-list.model';\r\n\r\nconst DEFAULT_INCLUDE_STATE = CLIENT_LIST_DEFAULT_INCLUDE_STATE;\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientListApiService {\r\n private readonly http = inject(HttpClient);\r\n private readonly runtimeFetchBaseUrl = 'fetch/query';\r\n private readonly informativeBaseUrl = 'LevelData';\r\n\r\n /**\r\n * Fetches a table page. Resolves to the response **and** the `propertyKeys`\r\n * the request carried, because a write that wants its record projected the\r\n * same way has to repeat them and cannot recover them from the response.\r\n */\r\n getRows(\r\n contextKey: ClientListRuntimeContext,\r\n query: ClientListTableQuery,\r\n filters: ClientListFetchRequestFilter[] = [],\r\n ): Observable<ClientListRowsFetchResult> {\r\n return this.resolveTablePropertyKeys(contextKey, query).pipe(\r\n switchMap((resolvedKeys) => {\r\n const propertyKeys = resolvedKeys?.length ? resolvedKeys : undefined;\r\n\r\n return this.queryRuntime<RuntimeTableRowsResponse>({\r\n contextKey,\r\n projection: 'Table',\r\n surfaceKey: 'table',\r\n includeState: [...DEFAULT_INCLUDE_STATE],\r\n propertyKeys,\r\n filters,\r\n page: this.toPage(query.skip, query.take),\r\n pageSize: query.take,\r\n }).pipe(map((response) => ({ response, propertyKeys })));\r\n }),\r\n );\r\n }\r\n\r\n /**\r\n * Reads a single record back with the list's own query settings — the path\r\n * taken when a write reports `recordProjectionStatus: 'Unavailable'`. The\r\n * write itself already succeeded; this only reads, and must never be served\r\n * by re-submitting.\r\n */\r\n getRecord(\r\n contextKey: ClientListRuntimeContext,\r\n request: ClientListReturnRecordRequest,\r\n filters: ClientListFetchRequestFilter[],\r\n ): Observable<Response<ClientListFetchQueryResponse>> {\r\n return this.queryRuntime<ClientListFetchQueryResponse>({\r\n contextKey,\r\n projection: request.projection,\r\n surfaceKey: request.surfaceKey,\r\n includeState: request.includeState\r\n ? [...request.includeState]\r\n : [...DEFAULT_INCLUDE_STATE],\r\n propertyKeys: request.propertyKeys?.length\r\n ? request.propertyKeys\r\n : undefined,\r\n filters,\r\n page: 1,\r\n pageSize: 1,\r\n ...(request.projection === 'Card'\r\n ? { display: { areas: ['card'] } }\r\n : {}),\r\n });\r\n }\r\n\r\n getCards(\r\n contextKey: ClientListRuntimeContext,\r\n filters: ClientListFetchRequestFilter[] = [],\r\n skip?: number,\r\n take?: number,\r\n ): Observable<Response<ClientListCardsPayload>> {\r\n // `page` and `pageSize` must be sent together or not at all (fetch/query\r\n // request constraints), so a missing or non-positive `take` means the\r\n // caller wants the whole set in one call.\r\n const pageSize = typeof take === 'number' && take > 0 ? take : null;\r\n\r\n return this.queryRuntime<ClientListCardsPayload>({\r\n contextKey,\r\n projection: 'Card',\r\n includeState: [...DEFAULT_INCLUDE_STATE],\r\n filters,\r\n display: { areas: ['card'] },\r\n ...(pageSize === null\r\n ? {}\r\n : { page: this.toPage(skip ?? 0, pageSize), pageSize }),\r\n });\r\n }\r\n\r\n getInformativeDashboard(\r\n levelId: number,\r\n moduleId: number,\r\n ): Observable<Response<ClientListInformativeDashboardPayload>> {\r\n return this.http.get<Response<ClientListInformativeDashboardPayload>>(\r\n `${this.informativeBaseUrl}/levels/${levelId}/modules/${moduleId}/dashboard`,\r\n );\r\n }\r\n\r\n private queryRuntime<T>(\r\n payload: ClientListFetchQueryRequest,\r\n ): Observable<Response<T>> {\r\n return this.http.post<Response<T>>(this.runtimeFetchBaseUrl, payload);\r\n }\r\n\r\n private resolveTablePropertyKeys(\r\n contextKey: ClientListRuntimeContext,\r\n query: ClientListTableQuery,\r\n ): Observable<string[] | undefined> {\r\n if (query.columnKeys?.length) {\r\n return of(query.columnKeys);\r\n }\r\n\r\n const context = this.readTableSettingsContext(contextKey);\r\n if (!context) {\r\n return of(undefined);\r\n }\r\n\r\n return this.http\r\n .get<\r\n Response<ClientListTableSettingsCatalogResponse>\r\n >(`LevelData/levels/${context.levelId}/modules/${context.moduleId}/table-display-settings/catalog?surfaceKey=table`)\r\n .pipe(\r\n map((response) =>\r\n this.toEffectiveColumnKeys(response.data?.effectiveColumns ?? []),\r\n ),\r\n );\r\n }\r\n\r\n private toPage(skip: number, take: number): number {\r\n if (take <= 0) {\r\n return 1;\r\n }\r\n\r\n return Math.floor(skip / take) + 1;\r\n }\r\n\r\n private toEffectiveColumnKeys(\r\n columns: ClientListTableSettingsCatalogResponse['effectiveColumns'],\r\n ): string[] | undefined {\r\n const keys = (columns ?? [])\r\n .filter((column) =>\r\n typeof column === 'string' ? true : column.visible !== false,\r\n )\r\n .sort(\r\n (a, b) =>\r\n (typeof a === 'string' ? 0 : (a.order ?? 0)) -\r\n (typeof b === 'string' ? 0 : (b.order ?? 0)),\r\n )\r\n .map((column) =>\r\n typeof column === 'string'\r\n ? column\r\n : (column.key ?? column.propertyKey ?? ''),\r\n )\r\n .filter((key) => key.length > 0);\r\n\r\n return keys.length ? keys : undefined;\r\n }\r\n\r\n private readTableSettingsContext(\r\n contextKey: string,\r\n ): { levelId: string; moduleId: string } | null {\r\n const [levelPart, modulePart] = contextKey.split('/');\r\n const levelId = levelPart?.split(':')[1];\r\n const moduleId = modulePart?.split(':')[1];\r\n\r\n if (!levelId || !moduleId) {\r\n return null;\r\n }\r\n\r\n return { levelId, moduleId };\r\n }\r\n}\r\n","import { Injectable, computed, inject, signal } from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport {\r\n DashboardBuilderData,\r\n DashboardChartItem,\r\n} from '@masterteam/dashboard-builder';\r\nimport {\r\n EntityData,\r\n EntityNestedPropertyMeta,\r\n EntityViewType,\r\n isSectionKey,\r\n resolveLocalizedLabel,\r\n serializeEntityRawValue,\r\n} from '@masterteam/components/entities';\r\nimport {\r\n CLIENT_LIST_RECORD_STATE_KEY,\r\n ClientListCard,\r\n ClientListCardsPayload,\r\n ClientListFetchCatalog,\r\n ClientListFetchPropertyMeta,\r\n ClientListFetchQueryResponse,\r\n ClientListFetchRecord,\r\n ClientListFetchSchema,\r\n ClientListFetchTableColumn,\r\n ClientListInformativeDashboardPayload,\r\n ClientListState,\r\n NormalizedClientListConfiguration,\r\n RuntimeEntityColumnDef,\r\n RuntimeTableDisplayRow,\r\n RuntimeTableRowsResponse,\r\n} from '../models/client-list.model';\r\n\r\ninterface ClientListPropertyMaps {\r\n byKey: Map<string, ClientListFetchPropertyMeta>;\r\n byNormalizedKey: Map<string, ClientListFetchPropertyMeta>;\r\n /** Nested catalog metadata, keyed by the owning property key. */\r\n nestedByOwnerKey: Map<string, EntityNestedPropertyMeta[]>;\r\n}\r\n\r\ninterface ClientListCardDescriptor {\r\n projectionKey: string;\r\n recordValueKey: string;\r\n property?: ClientListFetchPropertyMeta;\r\n label?: string;\r\n viewType?: string;\r\n order?: number;\r\n configuration?: EntityData['configuration'] | null;\r\n propertyConfiguration?: EntityData['propertyConfiguration'];\r\n}\r\n\r\nconst UNSORTABLE_ENTITY_VIEW_TYPES = new Set<EntityViewType>([\r\n 'Attachment',\r\n 'Checkbox',\r\n]);\r\n\r\nfunction toNestedPropertyMeta(\r\n meta: ClientListFetchPropertyMeta,\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') as EntityViewType,\r\n configuration: meta.configuration ?? undefined,\r\n order: meta.order,\r\n };\r\n}\r\n\r\n@Injectable()\r\nexport class ClientListStateService {\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly itemsByKey = signal<Record<string, ClientListState>>({});\r\n\r\n readonly items = computed<ClientListState[]>(() =>\r\n Object.values(this.itemsByKey()).sort((a, b) =>\r\n a.config.moduleId === b.config.moduleId\r\n ? (a.config.instanceId ?? 0) - (b.config.instanceId ?? 0)\r\n : a.config.moduleId - b.config.moduleId,\r\n ),\r\n );\r\n\r\n setConfigs(configs: ClientListState[]): void {\r\n const currentItems = this.itemsByKey();\r\n const next: Record<string, ClientListState> = {};\r\n\r\n configs.forEach((item) => {\r\n next[item.key] = this.mergeItemState(item, currentItems[item.key]);\r\n });\r\n\r\n this.itemsByKey.set(next);\r\n }\r\n\r\n setLoading(key: string, loading: boolean): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n loading,\r\n },\r\n });\r\n }\r\n\r\n setError(key: string, message: string | null): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n error: message,\r\n },\r\n });\r\n }\r\n\r\n setTablePaging(key: string, skip: number, take: number): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'table'\r\n ) {\r\n return;\r\n }\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n skip,\r\n take,\r\n },\r\n });\r\n }\r\n\r\n setRowsResult(\r\n key: string,\r\n response: RuntimeTableRowsResponse,\r\n config: NormalizedClientListConfiguration,\r\n skip: number,\r\n take: number,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'table'\r\n ) {\r\n return;\r\n }\r\n\r\n const propertyMaps = this.createPropertyMaps(response.catalog);\r\n const columns: RuntimeEntityColumnDef[] = (\r\n response.projectionMeta?.columns ?? []\r\n )\r\n .filter((column) => column.visible)\r\n .sort((a, b) => a.order - b.order)\r\n .map((column, index) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n return {\r\n key: column.key,\r\n normalizedKey: property?.normalizedKey ?? column.key,\r\n label: column.label,\r\n type: 'entity' as const,\r\n sortable: !UNSORTABLE_ENTITY_VIEW_TYPES.has(\r\n column.viewType as EntityViewType,\r\n ),\r\n width: index === 0 ? '200px' : undefined,\r\n viewType: column.viewType,\r\n order: column.order,\r\n visible: column.visible,\r\n configuration: column.configuration ?? null,\r\n };\r\n });\r\n\r\n const lang = this.resolveActiveLang();\r\n\r\n const rows: RuntimeTableDisplayRow[] = (response.records ?? []).map(\r\n (record) => {\r\n const row: RuntimeTableDisplayRow = {\r\n Id: record.id,\r\n [CLIENT_LIST_RECORD_STATE_KEY]: record.state ?? null,\r\n };\r\n\r\n columns.forEach((column) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n row[column.key] = this.toEntityData(\r\n column.key,\r\n record.values?.[property?.key ?? column.key],\r\n property,\r\n column.viewType,\r\n column.label,\r\n column.configuration,\r\n property?.configuration,\r\n record.id,\r\n column.order ?? property?.order,\r\n propertyMaps.nestedByOwnerKey.get(property?.key ?? column.key),\r\n lang,\r\n );\r\n });\r\n\r\n return row;\r\n },\r\n );\r\n\r\n // Host hook: let the consumer reshape columns/rows (e.g. merge two\r\n // type-specific columns into one conditional column) before render.\r\n const shaped = config.transformResult\r\n ? config.transformResult({ columns, rows }, response)\r\n : { columns, rows };\r\n\r\n const schema = this.resolvePrimarySchema(response);\r\n const title =\r\n (config.title ?? '').trim() || schema?.name || schema?.key || '';\r\n const totalCount =\r\n config.isPaginated === false\r\n ? shaped.rows.length\r\n : (response.pagination?.totalCount ?? shaped.rows.length);\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey: schema?.key ?? '',\r\n columns: shaped.columns,\r\n rows: shaped.rows,\r\n cards: [],\r\n skip,\r\n take,\r\n totalCount,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n setCardsResult(\r\n key: string,\r\n response: ClientListCardsPayload,\r\n config: NormalizedClientListConfiguration,\r\n skip = 0,\r\n take = 0,\r\n append = false,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (\r\n !target ||\r\n target.type === 'informative' ||\r\n target.areaType !== 'cards'\r\n ) {\r\n return;\r\n }\r\n\r\n const newCards = this.toCards(response);\r\n const isAppend = append && config.isPaginated;\r\n // Never trust two pages not to overlap. A record inserted or re-sorted\r\n // between fetches shifts the window, and the grid tracks by `card.id` —\r\n // a repeat would raise NG0955 (duplicate keys) rather than just look odd.\r\n const cards = isAppend\r\n ? this.concatDistinctCards(target.cards, newCards)\r\n : newCards;\r\n const schema = this.resolvePrimarySchema(response);\r\n const firstCardModule = newCards[0]?.module;\r\n const moduleKey = schema?.key ?? firstCardModule?.key ?? target.moduleKey;\r\n const title =\r\n (config.title ?? '').trim() ||\r\n schema?.name ||\r\n firstCardModule?.name ||\r\n moduleKey ||\r\n target.title;\r\n\r\n // The backend is the authority on how big a page actually is: it may cap\r\n // `pageSize` below what we asked for. Offsets are derived from that\r\n // effective size, not from the requested `take` — `toPage()` floors\r\n // `skip / take`, so a mismatch would re-request a page we already hold.\r\n const effectiveTake = this.resolveEffectivePageSize(response, take);\r\n // A page shorter than the effective size is the last page, whatever\r\n // `totalCount` claims — without this the sentinel would sit there\r\n // showing skeletons for records the backend will never return. A\r\n // non-positive size means the response carried no usable paging info at\r\n // all, which we also treat as \"this is everything\".\r\n const exhausted =\r\n !config.isPaginated ||\r\n effectiveTake <= 0 ||\r\n newCards.length < effectiveTake;\r\n const totalCount =\r\n config.isPaginated && !exhausted\r\n ? (response.pagination?.totalCount ?? cards.length)\r\n : cards.length;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey,\r\n columns: [],\r\n rows: [],\r\n cards,\r\n // `skip` is the offset of the *next* page to fetch, always a multiple\r\n // of the effective page size so `toPage()` stays exact.\r\n skip: config.isPaginated\r\n ? exhausted\r\n ? cards.length\r\n : skip + effectiveTake\r\n : 0,\r\n take:\r\n config.isPaginated && effectiveTake > 0 ? effectiveTake : target.take,\r\n totalCount,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n /**\r\n * Splices a canonical record into the data the list already holds, so a\r\n * create or update lands without re-fetching the page.\r\n *\r\n * Tables replay the whole page through {@link setRowsResult}: for a table\r\n * the rendered page *is* the raw response, so replaying it keeps the catalog\r\n * lookup, the column build and the host `transformResult` hook on exactly\r\n * one code path — a second mapper for single rows would drift from the one\r\n * that built the rest of the table. Cards cannot replay: with infinite\r\n * scroll `rawData` holds only the last page while `cards` holds every page,\r\n * so a single card is built and merged into the accumulated set instead.\r\n *\r\n * Returns `false` when there is nothing to splice into — an informative\r\n * dashboard, or a list that never completed a load. The caller then falls\r\n * back to a real fetch rather than inventing state.\r\n */\r\n upsertRecord(\r\n key: string,\r\n record: ClientListFetchRecord,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'form') return false;\r\n\r\n const raw = target.rawData as ClientListFetchQueryResponse | null;\r\n if (!raw) return false;\r\n\r\n return target.areaType === 'cards'\r\n ? this.upsertCardRecord(key, target, raw, record)\r\n : this.upsertRowRecord(key, target, raw, record, config);\r\n }\r\n\r\n /**\r\n * Drops a record the backend has deleted, without re-fetching. Returns\r\n * `false` when the record is not in the loaded set, so the caller can decide\r\n * whether a reload is warranted.\r\n */\r\n removeRecord(\r\n key: string,\r\n recordId: number,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'form') return false;\r\n\r\n const raw = target.rawData as ClientListFetchQueryResponse | null;\r\n if (!raw) return false;\r\n\r\n const records = (raw.records ?? []).filter((item) => item.id !== recordId);\r\n\r\n if (target.areaType === 'cards') {\r\n const cards = target.cards.filter((card) => card.id !== recordId);\r\n if (cards.length === target.cards.length) return false;\r\n\r\n this.patchItem(key, {\r\n ...target,\r\n cards,\r\n totalCount: Math.max(0, target.totalCount - 1),\r\n error: null,\r\n rawData: this.withRecords(raw, records, -1),\r\n });\r\n\r\n return true;\r\n }\r\n\r\n if (records.length === (raw.records ?? []).length) return false;\r\n\r\n this.setRowsResult(\r\n key,\r\n this.withRecords(raw, records, -1),\r\n config,\r\n target.skip,\r\n target.take,\r\n );\r\n\r\n return true;\r\n }\r\n\r\n private upsertRowRecord(\r\n key: string,\r\n target: ClientListState,\r\n raw: ClientListFetchQueryResponse,\r\n record: ClientListFetchRecord,\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n // No columns means no completed table load to splice into.\r\n if (!target.columns.length) return false;\r\n\r\n const records = [...(raw.records ?? [])];\r\n const index = records.findIndex((item) => item.id === record.id);\r\n\r\n if (index >= 0) {\r\n records[index] = this.mergeRecord(records[index], record);\r\n } else {\r\n // The backend owns the real ordering and does not say where the new\r\n // record landed, so it goes to the top of the page in view: the user\r\n // has to see what they just created. The next real load puts it in its\r\n // true place.\r\n records.unshift(record);\r\n\r\n // Keep the page the size the paginator promises — the row pushed off\r\n // the end now lives on the next page.\r\n if (\r\n config.isPaginated &&\r\n target.take > 0 &&\r\n records.length > target.take\r\n ) {\r\n records.length = target.take;\r\n }\r\n }\r\n\r\n this.setRowsResult(\r\n key,\r\n this.withRecords(raw, records, index >= 0 ? 0 : 1),\r\n config,\r\n target.skip,\r\n target.take,\r\n );\r\n\r\n return true;\r\n }\r\n\r\n private upsertCardRecord(\r\n key: string,\r\n target: ClientListState,\r\n raw: ClientListFetchQueryResponse,\r\n record: ClientListFetchRecord,\r\n ): boolean {\r\n if (!raw.projectionMeta) return false;\r\n\r\n const previous = (raw.records ?? []).find((item) => item.id === record.id);\r\n const merged = previous ? this.mergeRecord(previous, record) : record;\r\n const [card] = this.toCards({ ...raw, records: [merged] });\r\n if (!card) return false;\r\n\r\n const index = target.cards.findIndex((item) => item.id === card.id);\r\n const isInsert = index < 0;\r\n const cards = isInsert\r\n ? [card, ...target.cards]\r\n : target.cards.map((item, position) =>\r\n position === index ? card : item,\r\n );\r\n\r\n const records = [...(raw.records ?? [])];\r\n const recordIndex = records.findIndex((item) => item.id === merged.id);\r\n if (recordIndex >= 0) records[recordIndex] = merged;\r\n else records.unshift(merged);\r\n\r\n this.patchItem(key, {\r\n ...target,\r\n cards,\r\n totalCount: isInsert ? target.totalCount + 1 : target.totalCount,\r\n error: null,\r\n rawData: this.withRecords(raw, records, isInsert ? 1 : 0),\r\n });\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Overlays the written record on the one being replaced, key by key. A\r\n * cleared property comes back explicitly (`{ raw: null, value: null }`) and\r\n * overwrites; only a key the backend left out entirely keeps its previous\r\n * cell, which beats blanking a value that did not actually change.\r\n */\r\n private mergeRecord(\r\n previous: ClientListFetchRecord,\r\n next: ClientListFetchRecord,\r\n ): ClientListFetchRecord {\r\n return {\r\n ...previous,\r\n ...next,\r\n values: { ...previous.values, ...next.values },\r\n };\r\n }\r\n\r\n private withRecords(\r\n raw: ClientListFetchQueryResponse,\r\n records: ClientListFetchRecord[],\r\n totalCountDelta: number,\r\n ): ClientListFetchQueryResponse {\r\n return {\r\n ...raw,\r\n records,\r\n pagination: raw.pagination\r\n ? {\r\n ...raw.pagination,\r\n totalCount: Math.max(\r\n 0,\r\n raw.pagination.totalCount + totalCountDelta,\r\n ),\r\n }\r\n : raw.pagination,\r\n };\r\n }\r\n\r\n private patchItem(key: string, next: ClientListState): void {\r\n this.itemsByKey.set({ ...this.itemsByKey(), [key]: next });\r\n }\r\n\r\n /**\r\n * Appends `next` to `current`, dropping any card whose id is already\r\n * present. Ids are the grid's `@for` track key, so duplicates are a runtime\r\n * error, not a cosmetic issue.\r\n */\r\n private concatDistinctCards(\r\n current: ClientListCard[],\r\n next: ClientListCard[],\r\n ): ClientListCard[] {\r\n if (!next.length) return current;\r\n\r\n const seen = new Set(current.map((card) => card.id));\r\n const fresh = next.filter((card) => !seen.has(card.id));\r\n\r\n return fresh.length ? [...current, ...fresh] : current;\r\n }\r\n\r\n /**\r\n * The page size the backend actually applied, falling back to the size we\r\n * asked for. Returns `0` when neither is usable — i.e. the response carried\r\n * no paging contract, so there is no stride to walk and the caller should\r\n * treat the set as complete.\r\n */\r\n private resolveEffectivePageSize(\r\n response: ClientListCardsPayload,\r\n requestedTake: number,\r\n ): number {\r\n const serverPageSize = response.pagination?.pageSize;\r\n if (typeof serverPageSize === 'number' && serverPageSize > 0) {\r\n return serverPageSize;\r\n }\r\n\r\n return requestedTake > 0 ? requestedTake : 0;\r\n }\r\n\r\n setInformativeResult(\r\n key: string,\r\n response: ClientListInformativeDashboardPayload | null,\r\n config: NormalizedClientListConfiguration,\r\n ): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target || target.type !== 'informative') return;\r\n\r\n const moduleKey = target.moduleKey || `Module ${config.moduleId}`;\r\n const title =\r\n (config.title ?? '').trim() ||\r\n target.title ||\r\n this.transloco.translate(\r\n 'components.clientComponents.list.informativeDashboard',\r\n );\r\n const dashboardData = response\r\n ? this.toDashboardData(response, title)\r\n : null;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n title,\r\n moduleKey,\r\n columns: [],\r\n rows: [],\r\n cards: [],\r\n skip: 0,\r\n take: 0,\r\n totalCount: dashboardData?.charts?.length ?? 0,\r\n dashboardData,\r\n error: null,\r\n rawData: response,\r\n },\r\n });\r\n }\r\n\r\n toggleExpanded(key: string): void {\r\n const target = this.itemsByKey()[key];\r\n if (!target) return;\r\n\r\n this.itemsByKey.set({\r\n ...this.itemsByKey(),\r\n [key]: {\r\n ...target,\r\n expanded: !target.expanded,\r\n },\r\n });\r\n }\r\n\r\n private mergeItemState(\r\n item: ClientListState,\r\n existing?: ClientListState,\r\n ): ClientListState {\r\n if (\r\n !existing ||\r\n existing.type !== item.type ||\r\n existing.areaType !== item.areaType\r\n ) {\r\n return item;\r\n }\r\n\r\n return {\r\n ...item,\r\n loading: existing.loading,\r\n error: existing.error,\r\n title: item.title || existing.title,\r\n moduleKey: existing.moduleKey || item.moduleKey,\r\n totalCount: existing.totalCount,\r\n columns: existing.columns,\r\n rows: existing.rows,\r\n cards: existing.cards,\r\n // Paging is settled by the caller, which compared the incoming config\r\n // against the previous one. Re-deciding it here — with only the two\r\n // states and no view of what changed in the config — is what used to\r\n // drop the user's page whenever their rows-per-page differed from the\r\n // configured default.\r\n skip: item.skip,\r\n take: item.take,\r\n expanded: existing.expanded,\r\n dashboardData: existing.dashboardData,\r\n rawData: existing.rawData,\r\n };\r\n }\r\n\r\n private toCards(data?: ClientListCardsPayload): ClientListCard[] {\r\n const records = this.orderRecords(\r\n data?.records ?? [],\r\n data?.projectionMeta?.groups ?? [],\r\n );\r\n const catalogProperties = data?.catalog?.properties ?? [];\r\n const propertyMaps = this.createPropertyMaps(data?.catalog);\r\n const lang = this.resolveActiveLang();\r\n const descriptors = this.buildCardDescriptors(\r\n data?.projectionMeta?.displayOrder ?? [],\r\n data?.projectionMeta?.columns ?? [],\r\n propertyMaps,\r\n );\r\n\r\n return records.map((record) => {\r\n const schema = data?.schemas?.find((item) => item.id === record.schemaId);\r\n const propertyDescriptors = descriptors.length\r\n ? descriptors\r\n : this.buildFallbackCardDescriptors(record, catalogProperties);\r\n const entities = propertyDescriptors.map((propertyDescriptor) =>\r\n this.toEntityData(\r\n propertyDescriptor.projectionKey,\r\n record.values?.[propertyDescriptor.recordValueKey],\r\n propertyDescriptor.property,\r\n propertyDescriptor.viewType,\r\n propertyDescriptor.label,\r\n propertyDescriptor.configuration,\r\n propertyDescriptor.propertyConfiguration,\r\n record.id,\r\n propertyDescriptor.order,\r\n propertyMaps.nestedByOwnerKey.get(propertyDescriptor.recordValueKey),\r\n lang,\r\n ),\r\n );\r\n const statusColor = this.resolveCardStatusColor(entities);\r\n const normalizedEntities = statusColor\r\n ? this.applyCardProgressColor(entities, statusColor)\r\n : entities;\r\n\r\n return {\r\n id: record.id,\r\n name: record.name ?? `Record ${record.id}`,\r\n module: schema\r\n ? {\r\n id: schema.id,\r\n key: schema.key,\r\n name: schema.name,\r\n order: schema.order,\r\n typeGroup: schema.typeGroup,\r\n }\r\n : undefined,\r\n instanceId: record.id,\r\n state: record.state ?? null,\r\n properties: normalizedEntities,\r\n entities: normalizedEntities,\r\n };\r\n });\r\n }\r\n\r\n private orderRecords(\r\n records: ClientListFetchRecord[],\r\n groups: Array<{ recordIds: number[] }>,\r\n ): ClientListFetchRecord[] {\r\n if (!groups.length) {\r\n return records;\r\n }\r\n\r\n const recordsById = new Map(records.map((record) => [record.id, record]));\r\n const ordered: ClientListFetchRecord[] = [];\r\n const seen = new Set<number>();\r\n\r\n groups.forEach((group) => {\r\n group.recordIds.forEach((recordId) => {\r\n const record = recordsById.get(recordId);\r\n if (!record || seen.has(recordId)) {\r\n return;\r\n }\r\n\r\n ordered.push(record);\r\n seen.add(recordId);\r\n });\r\n });\r\n\r\n records.forEach((record) => {\r\n if (!seen.has(record.id)) {\r\n ordered.push(record);\r\n }\r\n });\r\n\r\n return ordered;\r\n }\r\n\r\n private resolvePrimarySchema(\r\n response: RuntimeTableRowsResponse | ClientListCardsPayload,\r\n ): ClientListFetchSchema | undefined {\r\n const recordSchemaId = response.records?.[0]?.schemaId;\r\n\r\n return (\r\n response.schemas?.find((item) => item.id === recordSchemaId) ??\r\n response.schemas?.[0]\r\n );\r\n }\r\n\r\n private toEntityData(\r\n projectionKey: string,\r\n cell: ClientListFetchRecord['values'][string] | undefined,\r\n property: ClientListFetchPropertyMeta | undefined,\r\n viewType: string | undefined,\r\n label: string | undefined,\r\n configuration: EntityData['configuration'] | null | undefined,\r\n propertyConfiguration: EntityData['propertyConfiguration'],\r\n recordId: number,\r\n order: number | undefined,\r\n nestedProperties: EntityNestedPropertyMeta[] | undefined,\r\n lang: string,\r\n ): EntityData {\r\n const resolvedViewType = (viewType ?? 'Text') as EntityData['viewType'];\r\n // Custom label override saved on the display config (localized).\r\n const customLabel = resolveLocalizedLabel(configuration?.label, lang);\r\n\r\n // Section markers are layout-only: no value, heading from the label config.\r\n if (resolvedViewType === 'Section') {\r\n return {\r\n id: recordId,\r\n key: projectionKey,\r\n normalizedKey: projectionKey,\r\n name: customLabel,\r\n value: '',\r\n viewType: 'Section',\r\n order: order ?? property?.order,\r\n configuration: configuration as EntityData['configuration'] | undefined,\r\n };\r\n }\r\n\r\n return {\r\n id: recordId,\r\n propertyId: property?.id,\r\n key: property?.key ?? projectionKey,\r\n normalizedKey: property?.normalizedKey ?? projectionKey,\r\n name: customLabel || label || property?.label || projectionKey,\r\n rawValue: serializeEntityRawValue(cell?.raw),\r\n value: (cell?.value ?? '') as EntityData['value'],\r\n viewType: resolvedViewType,\r\n type: property?.source,\r\n order: order ?? property?.order,\r\n configuration: configuration as EntityData['configuration'] | undefined,\r\n propertyConfiguration: propertyConfiguration ?? undefined,\r\n nestedProperties,\r\n comparison: cell?.comparison,\r\n };\r\n }\r\n\r\n /** Active UI language for resolving localized display labels. */\r\n private resolveActiveLang(): string {\r\n if (typeof document === 'undefined') return 'en';\r\n return document.documentElement.lang || 'en';\r\n }\r\n\r\n private createPropertyMaps(\r\n catalog: ClientListFetchCatalog | undefined,\r\n ): ClientListPropertyMaps {\r\n const properties = catalog?.properties ?? [];\r\n\r\n return {\r\n byKey: new Map(properties.map((property) => [property.key, property])),\r\n byNormalizedKey: new Map(\r\n properties.map((property) => [property.normalizedKey, property]),\r\n ),\r\n nestedByOwnerKey: new Map(\r\n Object.entries(catalog?.nestedProperties ?? {}).map(\r\n ([ownerKey, nested]) => [ownerKey, nested.map(toNestedPropertyMeta)],\r\n ),\r\n ),\r\n };\r\n }\r\n\r\n private resolvePropertyMeta(\r\n projectionKey: string,\r\n propertyMaps: ClientListPropertyMaps,\r\n ): ClientListFetchPropertyMeta | undefined {\r\n return (\r\n propertyMaps.byKey.get(projectionKey) ??\r\n propertyMaps.byNormalizedKey.get(projectionKey)\r\n );\r\n }\r\n\r\n private buildCardDescriptors(\r\n displayOrder: NonNullable<\r\n ClientListCardsPayload['projectionMeta']\r\n >['displayOrder'],\r\n columns: ClientListFetchTableColumn[],\r\n propertyMaps: ClientListPropertyMaps,\r\n ): ClientListCardDescriptor[] {\r\n if (displayOrder?.length) {\r\n return displayOrder.map((item) => {\r\n // Section markers carry a synthetic key with no backing property.\r\n if (isSectionKey(item.propertyKey)) {\r\n return {\r\n projectionKey: item.propertyKey,\r\n recordValueKey: item.propertyKey,\r\n property: undefined,\r\n label: undefined,\r\n viewType: 'Section',\r\n order: item.order,\r\n configuration: item.configuration ?? null,\r\n propertyConfiguration: null,\r\n };\r\n }\r\n\r\n const property = this.resolvePropertyMeta(\r\n item.propertyKey,\r\n propertyMaps,\r\n );\r\n\r\n return {\r\n projectionKey: item.propertyKey,\r\n recordValueKey: property?.key ?? item.propertyKey,\r\n property,\r\n label: property?.label,\r\n viewType: property?.viewType,\r\n order: item.order ?? property?.order,\r\n configuration: item.configuration ?? null,\r\n propertyConfiguration: property?.configuration ?? null,\r\n };\r\n });\r\n }\r\n\r\n if (columns?.length) {\r\n return columns\r\n .filter((column) => column.visible)\r\n .map((column) => {\r\n const property = this.resolvePropertyMeta(column.key, propertyMaps);\r\n\r\n return {\r\n projectionKey: column.key,\r\n recordValueKey: property?.key ?? column.key,\r\n property,\r\n label: column.label ?? property?.label,\r\n viewType: column.viewType ?? property?.viewType,\r\n order: column.order ?? property?.order,\r\n configuration: column.configuration ?? null,\r\n propertyConfiguration: property?.configuration ?? null,\r\n };\r\n });\r\n }\r\n\r\n return [];\r\n }\r\n\r\n private buildFallbackCardDescriptors(\r\n record: ClientListFetchRecord,\r\n properties: ClientListFetchPropertyMeta[],\r\n ): ClientListCardDescriptor[] {\r\n return properties\r\n .filter((property) => record.values?.[property.key] !== undefined)\r\n .map((property) => ({\r\n projectionKey: property.normalizedKey || property.key,\r\n recordValueKey: property.key,\r\n property,\r\n label: property.label,\r\n viewType: property.viewType,\r\n order: property.order,\r\n configuration: null,\r\n propertyConfiguration: property.configuration ?? null,\r\n }));\r\n }\r\n\r\n private resolveCardStatusColor(entities: EntityData[]): string | null {\r\n const statusEntity = entities.find(\r\n (entity) => entity.normalizedKey === 'Status',\r\n );\r\n const value = statusEntity?.value;\r\n const color =\r\n value && typeof value === 'object' && 'color' in value\r\n ? value.color\r\n : null;\r\n\r\n return typeof color === 'string' && color.trim().length\r\n ? color.trim()\r\n : null;\r\n }\r\n\r\n private applyCardProgressColor(\r\n entities: EntityData[],\r\n color: string,\r\n ): EntityData[] {\r\n return entities.map((entity) => {\r\n if (entity.normalizedKey !== 'Actual_Progress') {\r\n return entity;\r\n }\r\n\r\n return {\r\n ...entity,\r\n configuration: {\r\n ...(entity.configuration ?? {}),\r\n color,\r\n },\r\n };\r\n });\r\n }\r\n\r\n private toDashboardData(\r\n data: ClientListInformativeDashboardPayload,\r\n title: string,\r\n ): DashboardBuilderData {\r\n const filters = data.filters;\r\n const charts: DashboardChartItem[] = (data.chartLinks ?? []).map((link) => {\r\n const configuration = link.configuration ?? {};\r\n\r\n return {\r\n ...configuration,\r\n id: link.id,\r\n chartComponentId: link.chartComponentId,\r\n } as DashboardChartItem;\r\n });\r\n\r\n return {\r\n page: {\r\n id: data.moduleId,\r\n name: { en: title, ar: title },\r\n type: 'Dashboard',\r\n dashboardConfig: {\r\n ignoreQueryFilter: data.ignoreQueryFilter,\r\n filters: data.filters,\r\n versionNumber: data.versionNumber,\r\n extraInfo: data.extraInfo,\r\n },\r\n },\r\n charts,\r\n dialogs: [],\r\n filters: Array.isArray(filters) ? [...filters] : filters ? [filters] : [],\r\n };\r\n }\r\n}\r\n","import { Injectable, computed, inject, signal } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { map, Observable, share, take } from 'rxjs';\r\nimport { RuntimeAction } from '@masterteam/components/runtime-action';\r\nimport {\r\n ClientListRuntimeRecordActionsConfig,\r\n ClientListRuntimeRecordActionsContext,\r\n RuntimeTableDisplayRow,\r\n} from '../models/client-list.model';\r\n\r\ninterface CachedActions {\r\n actions: RuntimeAction[];\r\n fetchedAt: number;\r\n}\r\n\r\ninterface RuntimeActionsResponse {\r\n code: number;\r\n data?: { actions?: RuntimeAction[] };\r\n}\r\n\r\nconst DEFAULT_ENDPOINT = 'LevelData/{instanceId}/workspace-record-actions';\r\nconst DEFAULT_CACHE_TTL_MS = 60_000;\r\nconst DEFAULT_TARGET_TYPE = 'ModuleData';\r\n\r\n/**\r\n * Lazy per-row runtime actions. Fetches `workspace-record-actions` only when\r\n * the row's 3-dots menu is opened (or for every visible row when the list\r\n * opts in to `eager`), with per-row caching, in-flight dedupe, and a single\r\n * cache-invalidation hook tied to action execution.\r\n */\r\n@Injectable()\r\nexport class ClientListRuntimeActionsService {\r\n private readonly http = inject(HttpClient);\r\n\r\n private readonly cache = signal<ReadonlyMap<string, CachedActions>>(\r\n new Map(),\r\n );\r\n private readonly inFlightKeys = signal<ReadonlySet<string>>(new Set());\r\n private readonly inFlight = new Map<string, Observable<RuntimeAction[]>>();\r\n\r\n /** Actions keyed by `${listKey}:${recordId}`. */\r\n readonly actionsByRowKey = computed<ReadonlyMap<string, RuntimeAction[]>>(\r\n () => {\r\n const out = new Map<string, RuntimeAction[]>();\r\n for (const [key, value] of this.cache()) {\r\n out.set(key, value.actions);\r\n }\r\n return out;\r\n },\r\n );\r\n\r\n /** Row keys currently being fetched. Drives the popover skeleton state. */\r\n readonly loadingRowKeys = this.inFlightKeys.asReadonly();\r\n\r\n rowKey(listKey: string, recordId: number): string {\r\n return `${listKey}:${recordId}`;\r\n }\r\n\r\n has(\r\n listKey: string,\r\n recordId: number,\r\n ttlMs: number | null | undefined,\r\n ): boolean {\r\n const key = this.rowKey(listKey, recordId);\r\n const entry = this.cache().get(key);\r\n if (!entry) return false;\r\n if (ttlMs == null) return true;\r\n return Date.now() - entry.fetchedAt < ttlMs;\r\n }\r\n\r\n /**\r\n * Fetch (or reuse cached/in-flight) per-row runtime actions for a row.\r\n * Returns an Observable so callers can chain off the result; the cache and\r\n * loading signals are also kept in sync so the table popover skeleton and\r\n * the merged-actions computation react automatically.\r\n */\r\n request(\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): Observable<RuntimeAction[]> {\r\n const key = this.rowKey(ctx.listKey, ctx.recordId);\r\n const ttl = config.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;\r\n const cached = this.cache().get(key);\r\n if (cached && (ttl == null || Date.now() - cached.fetchedAt < ttl)) {\r\n const actions = cached.actions;\r\n return new Observable<RuntimeAction[]>((subscriber) => {\r\n subscriber.next(actions);\r\n subscriber.complete();\r\n });\r\n }\r\n\r\n const inFlight = this.inFlight.get(key);\r\n if (inFlight) {\r\n return inFlight;\r\n }\r\n\r\n const url = this.resolveEndpoint(config.endpoint ?? DEFAULT_ENDPOINT, ctx);\r\n const params = this.buildParams(config, ctx);\r\n\r\n this.markLoading(key, true);\r\n\r\n const obs = this.http.get<RuntimeActionsResponse>(url, { params }).pipe(\r\n map((response) =>\r\n response?.code === 1 ? (response.data?.actions ?? []) : [],\r\n ),\r\n share(),\r\n );\r\n\r\n this.inFlight.set(key, obs);\r\n\r\n obs.pipe(take(1)).subscribe({\r\n next: (actions) => {\r\n this.writeCache(key, actions);\r\n this.markLoading(key, false);\r\n this.inFlight.delete(key);\r\n },\r\n error: () => {\r\n this.writeCache(key, []);\r\n this.markLoading(key, false);\r\n this.inFlight.delete(key);\r\n },\r\n });\r\n\r\n return obs;\r\n }\r\n\r\n invalidateRow(listKey: string, recordId: number): void {\r\n const key = this.rowKey(listKey, recordId);\r\n this.cache.update((current) => {\r\n if (!current.has(key)) return current;\r\n const next = new Map(current);\r\n next.delete(key);\r\n return next;\r\n });\r\n }\r\n\r\n invalidateList(listKey: string): void {\r\n const prefix = `${listKey}:`;\r\n this.cache.update((current) => {\r\n let changed = false;\r\n const next = new Map(current);\r\n for (const key of next.keys()) {\r\n if (key.startsWith(prefix)) {\r\n next.delete(key);\r\n changed = true;\r\n }\r\n }\r\n return changed ? next : current;\r\n });\r\n }\r\n\r\n clearAll(): void {\r\n this.cache.set(new Map());\r\n }\r\n\r\n private writeCache(key: string, actions: RuntimeAction[]): void {\r\n this.cache.update((current) => {\r\n const next = new Map(current);\r\n next.set(key, { actions, fetchedAt: Date.now() });\r\n return next;\r\n });\r\n }\r\n\r\n private markLoading(key: string, loading: boolean): void {\r\n this.inFlightKeys.update((current) => {\r\n const next = new Set(current);\r\n if (loading) next.add(key);\r\n else next.delete(key);\r\n return next;\r\n });\r\n }\r\n\r\n private resolveEndpoint(\r\n template: string,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): string {\r\n const instanceId = ctx.instanceId ?? '';\r\n return template\r\n .replace('{instanceId}', String(instanceId))\r\n .replace('{listKey}', ctx.listKey)\r\n .replace('{moduleId}', String(ctx.moduleId))\r\n .replace('{recordId}', String(ctx.recordId));\r\n }\r\n\r\n private buildParams(\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n ): Record<string, string | number> {\r\n if (config.buildParams) {\r\n return config.buildParams(ctx);\r\n }\r\n\r\n const moduleKey = config.resolveModuleKey?.(ctx.row, {\r\n listKey: ctx.listKey,\r\n moduleId: ctx.moduleId,\r\n });\r\n\r\n const params: Record<string, string | number> = {\r\n targetType: DEFAULT_TARGET_TYPE,\r\n targetId: ctx.recordId,\r\n };\r\n\r\n if (moduleKey) {\r\n params['moduleKey'] = moduleKey;\r\n }\r\n\r\n return params;\r\n }\r\n}\r\n\r\nexport function defaultResolveRecordId(\r\n row: RuntimeTableDisplayRow,\r\n): number | null {\r\n const candidates = ['Id', 'id', 'ModuleDataId'] as const;\r\n for (const key of candidates) {\r\n const value = row[key];\r\n if (typeof value === 'number' && Number.isFinite(value)) return value;\r\n if (typeof value === 'string') {\r\n const parsed = Number(value);\r\n if (Number.isFinite(parsed)) return parsed;\r\n }\r\n }\r\n return null;\r\n}\r\n","import { Injectable, signal, WritableSignal } from '@angular/core';\r\nimport { TableFilters } from '@masterteam/components/table';\r\n\r\n/**\r\n * Toolbar state for a single client-list instance: search term, column filters,\r\n * group column, and active tab. Kept as mutable signals so both the table view\r\n * and the cards view can two-way bind to the same source of truth and stay in\r\n * sync when the user toggles between them.\r\n */\r\nexport interface ClientListToolbarBucket {\r\n filters: WritableSignal<TableFilters>;\r\n filterTerm: WritableSignal<string>;\r\n groupBy: WritableSignal<string | null>;\r\n activeTab: WritableSignal<any>;\r\n}\r\n\r\n/**\r\n * Per-list toolbar state holder. Buckets are keyed by list `key` (see\r\n * `ClientListBaseState.key`) so switching between table and cards for the same\r\n * list carries search/filter/group/tab forward. In-memory only — per-component\r\n * `storageKey` persistence on the underlying mt-table continues to handle\r\n * refresh-resilient hydration.\r\n */\r\n@Injectable({ providedIn: 'root' })\r\nexport class ClientListToolbarService {\r\n private readonly buckets = new Map<string, ClientListToolbarBucket>();\r\n\r\n forList(key: string): ClientListToolbarBucket {\r\n let bucket = this.buckets.get(key);\r\n if (!bucket) {\r\n bucket = {\r\n filters: signal<TableFilters>({}),\r\n filterTerm: signal<string>(''),\r\n groupBy: signal<string | null>(null),\r\n activeTab: signal<any>(null),\r\n };\r\n this.buckets.set(key, bucket);\r\n }\r\n return bucket;\r\n }\r\n\r\n clear(key: string): void {\r\n this.buckets.delete(key);\r\n }\r\n}\r\n","import { Component, computed, inject, input, output } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport {\r\n Table,\r\n TableAction,\r\n TableActionShape,\r\n} from '@masterteam/components/table';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport {\r\n ClientListContentTemplateContext,\r\n ClientListLazyLoadEvent,\r\n RuntimeTableDisplayRow,\r\n ClientListState,\r\n ClientListTableState,\r\n} from '../../models/client-list.model';\r\nimport { ClientListToolbarService } from '../../services/client-list-toolbar';\r\n\r\nconst DEFAULT_GRID_COLUMNS = 12;\r\n\r\n@Component({\r\n selector: 'mt-client-list-table-view',\r\n standalone: true,\r\n imports: [CommonModule, Table, SkeletonModule],\r\n templateUrl: './client-list-table-view.html',\r\n})\r\nexport class ClientListTableView {\r\n private readonly toolbar = inject(ClientListToolbarService);\r\n\r\n readonly state = input.required<ClientListState>();\r\n readonly rowActions = input<TableAction[]>([]);\r\n readonly actionShape = input<TableActionShape | undefined>(undefined);\r\n readonly rowActionsLoadingFn = input<\r\n ((row: RuntimeTableDisplayRow) => boolean) | null\r\n >(null);\r\n readonly lazyLoad = output<ClientListLazyLoadEvent>();\r\n readonly rowClick = output<RuntimeTableDisplayRow>();\r\n readonly rowActionsRequested = output<RuntimeTableDisplayRow>();\r\n\r\n protected readonly table = computed(() => {\r\n return this.state() as ClientListTableState;\r\n });\r\n\r\n /**\r\n * Shared toolbar bucket (search / filters / groupBy / activeTab) keyed by\r\n * list identity. The cards view for the same list resolves the same bucket\r\n * so switching area types preserves the toolbar state.\r\n */\r\n protected readonly bucket = computed(() =>\r\n this.toolbar.forList(this.state().key),\r\n );\r\n\r\n protected readonly pageSize = computed(() => {\r\n const table = this.table();\r\n return table.config.isPaginated ? table.take : table.config.table.pageSize;\r\n });\r\n\r\n /**\r\n * Stable, per-instance storage key. Excludes `areaType` so table and cards\r\n * views for the same logical list share persistence (matches the toolbar\r\n * bucket sharing behaviour).\r\n */\r\n protected readonly tableStorageKey = computed<string | null>(() => {\r\n const s = this.state();\r\n const cfg = s.config;\r\n const parts = [\r\n 'client-list',\r\n s.key,\r\n cfg.type,\r\n cfg.contextKey ?? '',\r\n cfg.moduleId ?? '',\r\n cfg.instanceId ?? '',\r\n ];\r\n const key = parts\r\n .map((p) => String(p ?? ''))\r\n .filter((p) => p.length > 0)\r\n .join(':');\r\n return key.length > 'client-list'.length ? key : null;\r\n });\r\n\r\n protected readonly gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;\r\n\r\n protected slotGridSpan(span: number): string {\r\n return `span ${span} / span ${span}`;\r\n }\r\n\r\n protected templateContext(\r\n item: ClientListState,\r\n ): ClientListContentTemplateContext {\r\n return {\r\n $implicit: item,\r\n table: item,\r\n item,\r\n loading: item.loading,\r\n error: item.error,\r\n data: item.rawData,\r\n };\r\n }\r\n}\r\n","<div class=\"grid gap-4\" [style.gridTemplateColumns]=\"gridTemplateColumns\">\n @if (table().config.contentStart) {\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.startSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table().config.contentStart\"\n [ngTemplateOutletContext]=\"templateContext(table())\"\n />\n </div>\n }\n\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.tableSpan)\">\n @if (table().loading && table().rows.length === 0) {\n <div class=\"flex flex-col gap-3 py-3\">\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n <p-skeleton height=\"3rem\" />\n </div>\n } @else if (table().error) {\n <div\n class=\"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\n >\n {{ table().error }}\n </div>\n } @else {\n <mt-table\n [noCard]=\"true\"\n [data]=\"table().rows\"\n [columns]=\"table().columns\"\n dataKey=\"Id\"\n [storageKey]=\"tableStorageKey()\"\n [persistStateExclude]=\"table().config.table.persistStateExclude\"\n [captionStartTemplate]=\"table().config.toolbarStart ?? null\"\n [captionEndTemplate]=\"table().config.toolbarEnd ?? null\"\n [rowActions]=\"rowActions()\"\n [actionShape]=\"actionShape()\"\n [rowActionsLoadingFn]=\"rowActionsLoadingFn()\"\n (rowActionsRequested)=\"rowActionsRequested.emit($event)\"\n [generalSearch]=\"table().config.table.searchable\"\n [showFilters]=\"true\"\n filterMode=\"column\"\n [printable]=\"true\"\n [groupable]=\"true\"\n [cellClickFilter]=\"true\"\n [freezeActions]=\"true\"\n [exportable]=\"table().config.table.exportable\"\n [loading]=\"table().loading\"\n [clickableRows]=\"true\"\n [lazy]=\"table().config.isPaginated\"\n [lazyTotalRecords]=\"table().totalCount\"\n [virtualScroll]=\"!table().config.isPaginated\"\n [virtualScrollItemSize]=\"56\"\n scrollHeight=\"520px\"\n [pageSize]=\"pageSize()\"\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 (lazyLoad)=\"lazyLoad.emit($event)\"\n (rowClick)=\"rowClick.emit($event)\"\n />\n }\n </div>\n\n @if (table().config.contentEnd) {\n <div [style.gridColumn]=\"slotGridSpan(table().config.layout.endSpan)\">\n <ng-container\n [ngTemplateOutlet]=\"table().config.contentEnd\"\n [ngTemplateOutletContext]=\"templateContext(table())\"\n />\n </div>\n }\n</div>\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n effect,\r\n ElementRef,\r\n inject,\r\n input,\r\n output,\r\n Signal,\r\n signal,\r\n untracked,\r\n viewChild,\r\n WritableSignal,\r\n} from '@angular/core';\r\nimport { toSignal } from '@angular/core/rxjs-interop';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoModule, TranslocoService } from '@jsverse/transloco';\r\nimport { Card } from '@masterteam/components/card';\r\nimport { EmptyState } from '@masterteam/components/empty-state';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { Tooltip } from '@masterteam/components/tooltip';\r\nimport { Icon } from '@masterteam/icons';\r\nimport { ConfirmationService } from '@masterteam/components/confirmation';\r\nimport {\r\n MTDateFormatPipe,\r\n type MTDateFormatType,\r\n} from '@masterteam/components';\r\nimport {\r\n EntitiesPreview,\r\n EntityClickEvent,\r\n type LeafDetailsEntityValue,\r\n} from '@masterteam/components/entities';\r\nimport { readableTextOn } from '@masterteam/components';\r\nimport {\r\n ColumnDef,\r\n TableAction,\r\n TableCaption,\r\n TableExportService,\r\n TableGroupingController,\r\n TableValueResolver,\r\n} from '@masterteam/components/table';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport { PopoverModule } from 'primeng/popover';\r\nimport {\r\n CLIENT_LIST_RECORD_STATE_KEY,\r\n ClientListCard,\r\n ClientListCardsState,\r\n ClientListLazyLoadEvent,\r\n ClientListState,\r\n RuntimeEntityColumnDef,\r\n RuntimeTableDisplayRow,\r\n} from '../../models/client-list.model';\r\nimport { ClientListToolbarService } from '../../services/client-list-toolbar';\r\n\r\nconst EMPTY_KEY_SET: ReadonlySet<string> = new Set();\r\n\r\n/** A card's visible actions, pre-split into the buckets the template renders. */\r\ninterface CardActionSet {\r\n inline: TableAction[];\r\n menu: TableAction[];\r\n escalationMarker: TableAction | null;\r\n}\r\n\r\n/** Shared fallback so cards without an entry keep a stable identity. */\r\nconst EMPTY_CARD_ACTION_SET: CardActionSet = {\r\n inline: [],\r\n menu: [],\r\n escalationMarker: null,\r\n};\r\n\r\n/**\r\n * How far ahead of the viewport the infinite-scroll sentinel counts as\r\n * visible — roughly one card row, so the next page is already in flight by\r\n * the time the user reaches the bottom of the grid.\r\n */\r\nconst LOAD_MORE_ROOT_MARGIN = '400px';\r\n\r\n/** Deleting, or anything the caller flagged `danger`. Mirrors `mt-table`. */\r\nfunction isDestructiveAction(action: TableAction | undefined): boolean {\r\n if (!action) {\r\n return false;\r\n }\r\n return (\r\n action.color === 'danger' ||\r\n action.confirmation?.confirmationType === 'delete'\r\n );\r\n}\r\n\r\n/** Matches the neutral fallback `mt-entity-leaf-details` paints an uncoloured status. */\r\nconst DEFAULT_BADGE_COLOR = '#9CA3AF';\r\n\r\n/** One entry of the board-level legend decoding the coloured count badges. */\r\ninterface CardBadgeLegendEntry {\r\n key: string;\r\n label: string;\r\n color: string;\r\n textColor: string;\r\n}\r\n\r\ninterface CardGroup {\r\n key: string;\r\n columnLabel: string;\r\n label: string;\r\n accent: string | null;\r\n count: number;\r\n cards: ClientListCard[];\r\n}\r\n\r\ntype ClientListPlacedTableAction = TableAction & {\r\n placement?: 'menu' | 'inline';\r\n size?: 'small' | 'large';\r\n cardMarker?: 'escalation';\r\n};\r\n\r\n@Component({\r\n selector: 'mt-client-list-cards-view',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n TranslocoModule,\r\n Card,\r\n Button,\r\n Tooltip,\r\n Icon,\r\n EntitiesPreview,\r\n SkeletonModule,\r\n PopoverModule,\r\n TableCaption,\r\n EmptyState,\r\n ],\r\n providers: [MTDateFormatPipe],\r\n templateUrl: './client-list-cards-view.html',\r\n styleUrl: './client-list-cards-view.css',\r\n})\r\nexport class ClientListCardsView {\r\n private readonly toolbar = inject(ClientListToolbarService);\r\n private readonly exportService = inject(TableExportService);\r\n private readonly dateFormat = inject(MTDateFormatPipe);\r\n private readonly confirmationService = inject(ConfirmationService);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly state = input.required<ClientListState>();\r\n readonly rowActions = input<TableAction[]>([]);\r\n /** Per-card loading predicate — drives the popover skeleton while runtime\r\n * actions are being fetched. Mirrors the table view's `rowActionsLoadingFn`;\r\n * the predicate operates on the card's row representation (`{ Id, ... }`). */\r\n readonly rowActionsLoadingFn = input<\r\n ((row: RuntimeTableDisplayRow) => boolean) | null\r\n >(null);\r\n readonly lazyLoad = output<ClientListLazyLoadEvent>();\r\n /** Emitted when the infinite-scroll sentinel enters the viewport and more\r\n * pages remain — the parent responds by fetching and appending the next\r\n * page of cards. Only relevant when `config.isPaginated` is true. */\r\n readonly loadMore = output<void>();\r\n readonly cardClick = output<ClientListCard>();\r\n /** Emitted when a card's 3-dots menu opens, so the parent can lazily fetch\r\n * that record's runtime actions (same contract as the table view). */\r\n readonly rowActionsRequested = output<RuntimeTableDisplayRow>();\r\n\r\n protected readonly cardsState = computed(\r\n () => this.state() as ClientListCardsState,\r\n );\r\n\r\n /** True while backend pagination is enabled and more pages remain to\r\n * fetch — drives the infinite-scroll sentinel's visibility. */\r\n protected readonly hasMoreCards = computed(\r\n () =>\r\n this.cardsState().config.isPaginated &&\r\n this.cardsState().cards.length < this.cardsState().totalCount,\r\n );\r\n\r\n /** Anchor element rendered at the end of the grid when more cards remain;\r\n * observed so scrolling it into view triggers `loadMore`. */\r\n private readonly loadMoreSentinel =\r\n viewChild<ElementRef<HTMLElement>>('loadMoreSentinel');\r\n private loadMoreObserver: IntersectionObserver | null = null;\r\n\r\n /** Shared toolbar bucket — same instance the table view uses. */\r\n protected readonly bucket = computed(() =>\r\n this.toolbar.forList(this.state().key),\r\n );\r\n\r\n /** True while a column filter or search term is active — drives the\r\n * reset button's visibility in the caption toolbar. */\r\n protected readonly hasActiveFilter = computed(\r\n () =>\r\n Object.keys(this.bucket().filters()).length > 0 ||\r\n this.bucket().filterTerm().trim().length > 0,\r\n );\r\n\r\n /**\r\n * A language-reactive label.\r\n *\r\n * `translate()` is a plain call, not a signal, so a computed that used it\r\n * directly would keep the label in whatever language was active when it\r\n * first ran. `selectTranslate` re-emits on language switch *and* once the\r\n * new language's file has loaded.\r\n *\r\n * Every label the card loop needs is hoisted through here rather than left\r\n * as `| transloco` in the template: that pipe is impure, so each occurrence\r\n * inside the loop was one more pipe instance re-running on every check of\r\n * every card in the grid.\r\n */\r\n private label(key: string): Signal<string> {\r\n return toSignal(this.transloco.selectTranslate<string>(key), {\r\n initialValue: this.transloco.translate<string>(key),\r\n });\r\n }\r\n\r\n private readonly resetLabel = this.label('components.table.reset');\r\n\r\n /** Entity click-to-filter affordance tooltips, one instance for the grid. */\r\n protected readonly filterByThisLabel = this.label(\r\n 'components.table.filterByThis',\r\n );\r\n protected readonly clearFilterLabel = this.label(\r\n 'components.table.clearFilter',\r\n );\r\n protected readonly actionsLabel = this.label('components.table.actions');\r\n protected readonly escalationLabel = this.label(\r\n 'components.clientComponents.list.hasActiveEscalation',\r\n );\r\n\r\n /** Caption toolbar action: clears both column filters and the search\r\n * term. For paginated (server-driven) cards this also re-triggers the\r\n * filter-change effect below, which re-fetches page 1 without any\r\n * filters/search — i.e. reloads the full unfiltered set. */\r\n protected readonly toolbarActions = computed<TableAction[]>(() =>\r\n this.hasActiveFilter()\r\n ? [\r\n {\r\n icon: 'arrow.refresh-cw-01',\r\n color: 'secondary',\r\n variant: 'text',\r\n tooltip: this.resetLabel(),\r\n label: this.resetLabel(),\r\n action: () => this.resetFilters(),\r\n },\r\n ]\r\n : [],\r\n );\r\n\r\n protected resetFilters(): void {\r\n this.bucket().filters.set({});\r\n this.bucket().filterTerm.set('');\r\n }\r\n\r\n /**\r\n * Columns for filter/group/export. `state.columns` is empty for cards area\r\n * (the state service doesn't populate it — see `setCardsResult`), so we\r\n * reconstruct `ColumnDef[]` from the first card's entity metadata. Each\r\n * entity carries its `key`, `name` (label), and `viewType`, which is\r\n * everything `TableValueResolver.getColumnFilterType` needs to classify\r\n * filter behaviour (select / boolean / date / user / text).\r\n */\r\n protected readonly columns = computed<ColumnDef[]>(() => {\r\n const fromState = this.state().columns;\r\n if (fromState && fromState.length > 0) return fromState;\r\n\r\n const sampleCard = this.cardsState().cards[0];\r\n if (!sampleCard?.entities?.length) return [];\r\n\r\n // Section markers are card-layout only — never table columns.\r\n return sampleCard.entities\r\n .filter((entity) => entity.viewType !== 'Section')\r\n .map((entity): RuntimeEntityColumnDef => {\r\n const raw = entity as unknown as Record<string, unknown>;\r\n const key =\r\n (typeof raw['key'] === 'string' && raw['key']) ||\r\n (typeof raw['normalizedKey'] === 'string' && raw['normalizedKey']) ||\r\n entity.name;\r\n return {\r\n key: String(key),\r\n normalizedKey:\r\n typeof raw['normalizedKey'] === 'string'\r\n ? raw['normalizedKey']\r\n : String(key),\r\n label: entity.name ?? String(key),\r\n type: 'entity',\r\n viewType: (entity.viewType ?? 'Text') as string,\r\n };\r\n });\r\n });\r\n\r\n /**\r\n * Row view of each card. Cards carry their data as `entities: EntityData[]`,\r\n * not as a pre-built record, so we rebuild the row shape mt-table expects:\r\n * `{ [entityKey]: EntityData | scalar }`. Falls back to `displayProperties`\r\n * if a newer backend populates it. Row index matches card index so we can\r\n * look up by position elsewhere.\r\n */\r\n protected readonly rowRepresentations = computed<Record<string, unknown>[]>(\r\n () => this.cardsState().cards.map((card) => this.cardToRow(card)),\r\n );\r\n\r\n private cardToRow(card: ClientListCard): Record<string, unknown> {\r\n const fromDisplay = card.displayProperties as\r\n | Record<string, unknown>\r\n | undefined;\r\n const record: Record<string, unknown> =\r\n fromDisplay && Object.keys(fromDisplay).length > 0\r\n ? {\r\n Id: card.id,\r\n ...fromDisplay,\r\n [CLIENT_LIST_RECORD_STATE_KEY]: card.state ?? null,\r\n }\r\n : { Id: card.id, [CLIENT_LIST_RECORD_STATE_KEY]: card.state ?? null };\r\n\r\n for (const entity of card.entities ?? []) {\r\n if (entity.viewType === 'Section') continue;\r\n const e = entity as unknown as Record<string, unknown>;\r\n const key =\r\n (typeof e['key'] === 'string' && e['key']) ||\r\n (typeof e['normalizedKey'] === 'string' && e['normalizedKey']) ||\r\n entity.name;\r\n const normalizedKey =\r\n typeof e['normalizedKey'] === 'string' ? e['normalizedKey'] : null;\r\n const keys = new Set(\r\n [key, normalizedKey].filter(\r\n (entry): entry is string =>\r\n typeof entry === 'string' && entry.length > 0,\r\n ),\r\n );\r\n\r\n for (const entityKey of keys) {\r\n record[entityKey] = entity;\r\n }\r\n }\r\n return record;\r\n }\r\n\r\n /**\r\n * Stable card → row lookup. Row actions (and their `hidden` / `action`\r\n * callbacks plus the loading predicate) are authored against the table's\r\n * row shape — `{ Id, ...entities }` — so every action interaction routes the\r\n * card through `cardToRow` first. Memoized per card so repeated `hidden`\r\n * evaluations in the template don't rebuild the record each call.\r\n */\r\n private readonly rowByCard = computed<\r\n ReadonlyMap<ClientListCard, RuntimeTableDisplayRow>\r\n >(() => {\r\n const map = new Map<ClientListCard, RuntimeTableDisplayRow>();\r\n for (const card of this.cardsState().cards) {\r\n map.set(card, this.cardToRow(card));\r\n }\r\n return map;\r\n });\r\n\r\n protected rowForCard(card: ClientListCard): RuntimeTableDisplayRow {\r\n return this.rowByCard().get(card) ?? this.cardToRow(card);\r\n }\r\n\r\n /**\r\n * Every card's actions, already filtered by `hidden` and split into the\r\n * three buckets the template renders (inline buttons, 3-dots menu,\r\n * escalation corner marker).\r\n *\r\n * Memoized rather than derived per template call on purpose: the four call\r\n * sites below each used to re-run `hidden()` across the whole action list,\r\n * so a single card cost four full passes — on every change detection tick,\r\n * for every card in the grid. `rowActions()` is rebuilt with a new array\r\n * identity whenever the runtime-action cache its predicates close over\r\n * changes, so this stays correct without re-evaluating on every pass.\r\n */\r\n private readonly actionsByCard = computed<\r\n ReadonlyMap<ClientListCard, CardActionSet>\r\n >(() => {\r\n const actions = this.rowActions();\r\n const rows = this.rowByCard();\r\n const map = new Map<ClientListCard, CardActionSet>();\r\n\r\n for (const card of this.cardsState().cards) {\r\n const row = rows.get(card) ?? this.cardToRow(card);\r\n const inline: TableAction[] = [];\r\n const menu: TableAction[] = [];\r\n let escalationMarker: TableAction | null = null;\r\n\r\n for (const action of actions) {\r\n if (action.hidden?.(row)) continue;\r\n\r\n if (this.isCardMarkerAction(action)) {\r\n escalationMarker ??= action;\r\n menu.push(action);\r\n } else if (this.actionPlacement(action) === 'inline') {\r\n inline.push(action);\r\n } else {\r\n menu.push(action);\r\n }\r\n }\r\n\r\n // Destructive actions last, so the irreversible one is never adjacent to\r\n // the two most common ones (finding M-07). Sorted here rather than at\r\n // read time so it costs one pass per card, not one per change detection.\r\n map.set(card, {\r\n inline,\r\n menu: [\r\n ...menu.filter((action) => !isDestructiveAction(action)),\r\n ...menu.filter((action) => isDestructiveAction(action)),\r\n ],\r\n escalationMarker,\r\n });\r\n }\r\n\r\n return map;\r\n });\r\n\r\n private actionsFor(card: ClientListCard): CardActionSet {\r\n return this.actionsByCard().get(card) ?? EMPTY_CARD_ACTION_SET;\r\n }\r\n\r\n protected inlineActionsForCard(card: ClientListCard): TableAction[] {\r\n return this.actionsFor(card).inline;\r\n }\r\n\r\n protected escalationMarkerAction(card: ClientListCard): TableAction | null {\r\n return this.actionsFor(card).escalationMarker;\r\n }\r\n\r\n /**\r\n * Menu actions with the destructive ones moved to the bottom, matching the\r\n * table's row menu. A card and a row are the same record in two shapes, so\r\n * the irreversible action has to sit in the same place in both (finding\r\n * M-07).\r\n */\r\n protected menuActionsForCard(card: ClientListCard): TableAction[] {\r\n return this.actionsFor(card).menu;\r\n }\r\n\r\n /** Whether the user narrowed the board themselves — drives the empty state. */\r\n protected hasActiveCardFilters(): boolean {\r\n const bucket = this.bucket();\r\n if (bucket.filterTerm().trim().length > 0) {\r\n return true;\r\n }\r\n\r\n return Object.entries(bucket.filters()).some(\r\n ([key, value]) =>\r\n key !== 'generalSearch' &&\r\n value !== null &&\r\n value !== undefined &&\r\n value !== '',\r\n );\r\n }\r\n\r\n protected clearCardFilters(): void {\r\n this.bucket().filterTerm.set('');\r\n this.bucket().filters.set({});\r\n }\r\n\r\n /** True at the first destructive item — where the divider is drawn. */\r\n protected isFirstDestructiveCardAction(\r\n card: ClientListCard,\r\n index: number,\r\n ): boolean {\r\n const menu = this.menuActionsForCard(card);\r\n const action = menu[index];\r\n return (\r\n index > 0 &&\r\n !!action &&\r\n isDestructiveAction(action) &&\r\n !isDestructiveAction(menu[index - 1])\r\n );\r\n }\r\n\r\n protected showCardActionsMenu(card: ClientListCard): boolean {\r\n return (\r\n this.isCardActionsLoading(card) || this.actionsFor(card).menu.length > 0\r\n );\r\n }\r\n\r\n protected resolveActionLoading(\r\n action: TableAction,\r\n card: ClientListCard,\r\n ): boolean | undefined {\r\n const loading = action.loading;\r\n if (typeof loading === 'function') {\r\n return loading(this.rowForCard(card));\r\n }\r\n return typeof loading === 'boolean' ? loading : undefined;\r\n }\r\n\r\n protected actionSize(action: TableAction): 'small' | 'large' | undefined {\r\n return (action as ClientListPlacedTableAction).size;\r\n }\r\n\r\n private actionPlacement(action: TableAction): 'menu' | 'inline' | undefined {\r\n return (action as ClientListPlacedTableAction).placement;\r\n }\r\n\r\n private isCardMarkerAction(action: TableAction): boolean {\r\n return (action as ClientListPlacedTableAction).cardMarker === 'escalation';\r\n }\r\n\r\n protected isCardActionsLoading(card: ClientListCard): boolean {\r\n return this.rowActionsLoadingFn()?.(this.rowForCard(card)) ?? false;\r\n }\r\n\r\n /**\r\n * Open handler for a card's 3-dots menu. Emits `rowActionsRequested` so the\r\n * parent lazily fetches runtime actions for this record, then toggles the\r\n * popover — identical to the table view's `onRowActionsToggle`.\r\n */\r\n protected onCardActionsToggle(\r\n event: Event,\r\n popover: { toggle: (e: Event) => void },\r\n card: ClientListCard,\r\n ): void {\r\n this.rowActionsRequested.emit(this.rowForCard(card));\r\n popover.toggle(event);\r\n }\r\n\r\n /** Run a card action, honouring optional confirmation — same flow as the\r\n * table view's `rowAction`. */\r\n protected runCardAction(\r\n event: Event,\r\n action: TableAction,\r\n card: ClientListCard,\r\n ): void {\r\n const row = this.rowForCard(card);\r\n if (!action.confirmation) {\r\n action.action(row);\r\n return;\r\n }\r\n\r\n if (action.confirmation.confirmationType === 'delete') {\r\n this.confirmationService.confirmDelete({\r\n event,\r\n ...action.confirmation,\r\n accept: () => action.action(row),\r\n reject: () => {},\r\n });\r\n return;\r\n }\r\n\r\n this.confirmationService.confirm({\r\n event,\r\n ...action.confirmation,\r\n accept: () => action.action(row),\r\n reject: () => {},\r\n });\r\n }\r\n\r\n // Local throwaway signals for the grouping controller's sort arguments —\r\n // cards don't sort via column click so the controller's sort-pinning\r\n // side-effect is a no-op here.\r\n private readonly noopSortField = signal<string | null>(null);\r\n private readonly noopSortDir = signal<'asc' | 'desc' | null>(null);\r\n\r\n /**\r\n * Writable proxy around `bucket().groupBy` — the grouping controller wants a\r\n * `WritableSignal<string | null>`. Reads delegate to the current bucket's\r\n * signal; writes mutate it via `.set()`. This keeps the controller's\r\n * `setGroup()` side-effect safe even though cards view callers never invoke\r\n * it today.\r\n */\r\n private readonly groupBySignal: WritableSignal<string | null> = (() => {\r\n const read = computed(() => this.bucket().groupBy());\r\n const proxy = ((...args: [] | [string | null]) =>\r\n args.length === 0 ? read() : this.bucket().groupBy.set(args[0]!)) as any;\r\n proxy.set = (value: string | null) => this.bucket().groupBy.set(value);\r\n proxy.update = (fn: (value: string | null) => string | null) =>\r\n this.bucket().groupBy.set(fn(this.bucket().groupBy()));\r\n proxy.asReadonly = () => read;\r\n return proxy as WritableSignal<string | null>;\r\n })();\r\n\r\n /**\r\n * Grouping controller bound to the shared toolbar bucket, so picking a group\r\n * in the cards menu surfaces in the table view's group header (and vice\r\n * versa) when the user toggles area types.\r\n */\r\n protected readonly grouping = new TableGroupingController(\r\n this.columns,\r\n this.rowRepresentations,\r\n this.groupBySignal,\r\n this.noopSortField,\r\n this.noopSortDir,\r\n );\r\n\r\n /**\r\n * Visible (after search + filters) cards. Backend-paginated lists re-query\r\n * on filter change so `cards` already reflects the server response and this\r\n * just passes through; local lists filter in-place.\r\n */\r\n protected readonly visibleCards = computed<ClientListCard[]>(() => {\r\n const state = this.cardsState();\r\n const isLazy = state.config.isPaginated;\r\n const cards = state.cards;\r\n\r\n if (isLazy) return cards;\r\n\r\n const term = this.bucket().filterTerm().trim().toLowerCase();\r\n const filters = this.bucket().filters();\r\n const columns = this.columns();\r\n const filterKeys = Object.keys(filters);\r\n\r\n return cards.filter((card, index) => {\r\n const row = this.rowRepresentations()[index] ?? {};\r\n\r\n // Row values are EntityData envelopes (`{ name, value, viewType, ... }`),\r\n // identical to the shape mt-table builds. Reuse its recursive matcher so\r\n // the cards view searches every nested property value exactly like the\r\n // table view. The old shallow `resolveDisplayValue(value)` returned the\r\n // entity's `name` (field label) instead of its `value`, so every\r\n // value-based search missed and the grid was always \"not found\".\r\n if (term && !TableValueResolver.matchesSearchTerm(row, term)) {\r\n return false;\r\n }\r\n\r\n if (filterKeys.length === 0) return true;\r\n return filterKeys.every((key) => {\r\n if (key === 'generalSearch') return true;\r\n const column = columns.find((c) => c.key === key);\r\n return TableValueResolver.matchesFilter(row, key, filters[key], column);\r\n });\r\n });\r\n });\r\n\r\n /**\r\n * Legend for the coloured count badges the cards carry.\r\n *\r\n * Each card renders a cluster of small coloured pills under a level name\r\n * (\"Programs (2)\") and, before this, nothing on the card or on the page said\r\n * what the colours counted — a convention you either had been told offline or\r\n * could not decode (finding M-04). The per-badge tooltip names one status at\r\n * a time; this names the whole set once, above the board, so the mapping is\r\n * readable without hovering anything.\r\n *\r\n * Built from the cards actually on screen rather than from a catalog call:\r\n * the statuses in play are exactly the ones the board is showing, and a\r\n * legend listing statuses that appear nowhere would be its own noise. Empty\r\n * when no card carries a badge cluster, so boards without them are unchanged.\r\n */\r\n protected readonly badgeLegend = computed<CardBadgeLegendEntry[]>(() => {\r\n const entries = new Map<string, CardBadgeLegendEntry>();\r\n\r\n for (const card of this.visibleCards()) {\r\n for (const entity of card.entities ?? []) {\r\n if (entity.viewType !== 'LeafDetails') continue;\r\n\r\n const value = entity.value as LeafDetailsEntityValue | undefined;\r\n for (const status of value?.statuses ?? []) {\r\n if (!status?.key || entries.has(status.key)) continue;\r\n const color = status.color ?? DEFAULT_BADGE_COLOR;\r\n entries.set(status.key, {\r\n key: status.key,\r\n label: status.display || status.key,\r\n color,\r\n textColor: readableTextOn(color),\r\n });\r\n }\r\n }\r\n }\r\n\r\n return [...entries.values()];\r\n });\r\n\r\n /**\r\n * Grouped cards. Reuses TableGroupingController helpers so the accent color,\r\n * label, and count rendering match the table's subheader exactly.\r\n */\r\n protected readonly groupedCards = computed<CardGroup[]>(() => {\r\n const column = this.grouping.activeGroupColumn();\r\n if (!column) return [];\r\n\r\n const groups = new Map<string, CardGroup>();\r\n this.visibleCards().forEach((card) => {\r\n const row = this.cardToRow(card);\r\n const label = this.grouping.getGroupLabel(row);\r\n const accent = this.grouping.getGroupAccentColor(row);\r\n const key = `${label}__${accent ?? ''}`;\r\n\r\n const existing = groups.get(key);\r\n if (existing) {\r\n existing.cards.push(card);\r\n existing.count += 1;\r\n } else {\r\n groups.set(key, {\r\n key,\r\n columnLabel: column.label,\r\n label,\r\n accent,\r\n count: 1,\r\n cards: [card],\r\n });\r\n }\r\n });\r\n\r\n return Array.from(groups.values());\r\n });\r\n\r\n /**\r\n * Export the visible (after search + filter) cards as XLSX. Uses the cards'\r\n * derived row shape + the state's columns, so the file mirrors what the\r\n * user sees. Custom columns are excluded upstream by `TableExportService`.\r\n */\r\n /**\r\n * Set of column keys that are click-to-filter eligible — same predicate\r\n * mt-table's `isCellClickFilterable` uses (select / boolean / user). One\r\n * set computed once per columns / first-card change; all visible cards\r\n * read from it. Reactive via signal — when columns load, the entities\r\n * inside cards automatically become clickable.\r\n */\r\n protected readonly clickableEntityKeys = computed<ReadonlySet<string>>(() => {\r\n const sample = this.cardsState().cards[0]\r\n ? this.cardToRow(this.cardsState().cards[0])\r\n : undefined;\r\n const result = new Set<string>();\r\n for (const column of this.columns()) {\r\n const filterType = TableValueResolver.getColumnFilterType(column, sample);\r\n if (\r\n filterType === 'select' ||\r\n filterType === 'user' ||\r\n filterType === 'boolean'\r\n ) {\r\n result.add(column.key);\r\n }\r\n }\r\n return result;\r\n });\r\n\r\n /**\r\n * Per-card set of entity keys that match the active filter — passed into\r\n * `<mt-entities-preview [activeKeys]>`.\r\n *\r\n * Memoized rather than built per call: the template binds the result\r\n * straight into a child input, and minting a fresh `Set` on every call\r\n * handed `mt-entities-preview` a new input identity on every change\r\n * detection pass, re-rendering every card's entity grid whenever any\r\n * filter was active. Cards with no match are left out of the map so they\r\n * all share the one `EMPTY_KEY_SET` reference.\r\n */\r\n private readonly activeKeysByCard = computed<\r\n ReadonlyMap<ClientListCard, ReadonlySet<string>>\r\n >(() => {\r\n const map = new Map<ClientListCard, ReadonlySet<string>>();\r\n const filters = this.bucket().filters();\r\n const columns = this.columns();\r\n\r\n const targets = Object.keys(filters)\r\n .filter((key) => key !== 'generalSearch')\r\n .map((key) => ({ key, column: columns.find((c) => c.key === key) }))\r\n .filter(\r\n (target): target is { key: string; column: ColumnDef } =>\r\n !!target.column,\r\n );\r\n if (targets.length === 0) return map;\r\n\r\n const rows = this.rowByCard();\r\n for (const card of this.cardsState().cards) {\r\n const row = rows.get(card) ?? this.cardToRow(card);\r\n const result = new Set<string>();\r\n for (const { key, column } of targets) {\r\n const cellTarget = TableValueResolver.buildClickFilterValue(\r\n row,\r\n column,\r\n );\r\n if (cellTarget === null || cellTarget === undefined) continue;\r\n if (TableValueResolver.isFilterValueEqual(filters[key], cellTarget)) {\r\n result.add(key);\r\n }\r\n }\r\n if (result.size > 0) map.set(card, result);\r\n }\r\n\r\n return map;\r\n });\r\n\r\n protected activeKeysForCard(card: ClientListCard): ReadonlySet<string> {\r\n return this.activeKeysByCard().get(card) ?? EMPTY_KEY_SET;\r\n }\r\n\r\n /**\r\n * Click-to-filter handler invoked from `<mt-entities-preview (entityClick)>`.\r\n * Mirrors mt-table's `onCellFilterClick`: builds the filter value via the\r\n * shared `TableValueResolver`, toggles it on the shared toolbar bucket so\r\n * the funnel chip in the filter popover lights up, and clears on a second\r\n * click against the same value.\r\n */\r\n protected onEntityFilterClick(\r\n card: ClientListCard,\r\n event: EntityClickEvent,\r\n ): void {\r\n const column = this.columns().find((c) => c.key === event.key);\r\n if (!column) return;\r\n\r\n const row = this.cardToRow(card);\r\n const next = TableValueResolver.buildClickFilterValue(row, column);\r\n if (next === null || next === undefined) return;\r\n\r\n const current = this.bucket().filters();\r\n const patched = { ...current };\r\n if (TableValueResolver.isFilterValueEqual(current[column.key], next)) {\r\n delete patched[column.key];\r\n } else {\r\n patched[column.key] = next;\r\n }\r\n this.bucket().filters.set(patched);\r\n }\r\n\r\n protected exportExcel(): void {\r\n const rows = this.visibleCards().map((card) => this.cardToRow(card));\r\n this.exportService.exportToExcel({\r\n rows,\r\n columns: this.columns(),\r\n filename: this.resolveExportFilename(),\r\n resolveValue: (row, column) => this.resolveCellValue(row, column),\r\n });\r\n }\r\n\r\n protected printPdf(): void {\r\n const rows = this.visibleCards().map((card) => this.cardToRow(card));\r\n this.exportService.printPdf({\r\n rows,\r\n columns: this.columns(),\r\n filename: this.resolveExportFilename(),\r\n title: this.cardsState().title || undefined,\r\n resolveValue: (row, column) => this.resolveCellValue(row, column),\r\n });\r\n }\r\n\r\n private resolveExportFilename(): string {\r\n const title = this.cardsState().title?.trim();\r\n return title || this.cardsState().moduleKey || 'cards';\r\n }\r\n\r\n /**\r\n * Value resolver compatible with `TableExportConfig.resolveValue`. Reuses\r\n * `TableValueResolver` so currency, dates, entities, booleans export the\r\n * same way they would from the table view. Date columns (native or entity\r\n * with viewType `Date`/`DateTime`) are passed through `mtDateFormat` so\r\n * Excel and PDF show locale-formatted dates instead of raw ISO strings.\r\n */\r\n private resolveCellValue(\r\n row: unknown,\r\n column: ColumnDef,\r\n ): string | number | boolean | null {\r\n const cellValue = TableValueResolver.getProperty(row, column.key);\r\n if (cellValue === null || cellValue === undefined) return null;\r\n\r\n const dateType = this.resolveDateColumnType(column, cellValue);\r\n if (dateType) {\r\n const source =\r\n column.type === 'entity'\r\n ? TableValueResolver.getEntityValueByType(cellValue, 'sort')\r\n : cellValue;\r\n const dateValue = TableValueResolver.resolveDateValue(source);\r\n if (dateValue === null) return null;\r\n const formatted = this.dateFormat.transform(dateValue, dateType);\r\n return formatted || null;\r\n }\r\n\r\n if (column.type === 'entity') {\r\n return TableValueResolver.getEntityValueByType(cellValue, 'export');\r\n }\r\n return TableValueResolver.resolveDisplayValue(cellValue);\r\n }\r\n\r\n private resolveDateColumnType(\r\n column: ColumnDef,\r\n cellValue: unknown,\r\n ): MTDateFormatType | null {\r\n if (column.type === 'date') return 'date';\r\n if (column.type === 'dateTime') return 'dateTime';\r\n if (column.type !== 'entity') return null;\r\n\r\n const viewType = (column as { viewType?: unknown }).viewType;\r\n const fromColumn =\r\n typeof viewType === 'string' ? viewType.toLowerCase() : '';\r\n if (fromColumn === 'datetime') return 'dateTime';\r\n if (fromColumn === 'date') return 'date';\r\n if (fromColumn === 'time') return 'time';\r\n\r\n if (cellValue && typeof cellValue === 'object') {\r\n const inner = (cellValue as { viewType?: string }).viewType;\r\n if (inner === 'DateTime') return 'dateTime';\r\n if (inner === 'Date') return 'date';\r\n if (inner === 'Time') return 'time';\r\n }\r\n return null;\r\n }\r\n\r\n constructor() {\r\n // Attach the observer to whatever element the sentinel query currently\r\n // resolves to, and re-attach if Angular ever swaps that element. Keying\r\n // on the element instance is what makes this safe: appending a page\r\n // doesn't recreate the node, so the observer is *not* rebuilt per page —\r\n // which matters because a fresh IntersectionObserver always fires once\r\n // with the current intersection state, and rebuilding on every append\r\n // would cascade through the remaining pages on its own.\r\n //\r\n // Attaching only once, however, is not safe: the sentinel lives at the\r\n // end of the grid, and the grid is one branch of the view (the initial\r\n // skeleton, an error, an empty result and the grouped layout are the\r\n // others). A one-shot attach survives the initial skeleton but then\r\n // silently observes a detached node the first time any sibling branch\r\n // takes over, killing infinite scroll for the rest of the component's\r\n // life.\r\n effect((onCleanup) => {\r\n const el = this.loadMoreSentinel()?.nativeElement;\r\n if (!el) {\r\n this.loadMoreObserver = null;\r\n return;\r\n }\r\n\r\n const observer = new IntersectionObserver(\r\n (entries) => {\r\n if (!this.hasMoreCards()) return;\r\n if (entries.some((entry) => entry.isIntersecting)) {\r\n this.loadMore.emit();\r\n }\r\n },\r\n { rootMargin: LOAD_MORE_ROOT_MARGIN },\r\n );\r\n observer.observe(el);\r\n this.loadMoreObserver = observer;\r\n\r\n onCleanup(() => {\r\n observer.disconnect();\r\n if (this.loadMoreObserver === observer) this.loadMoreObserver = null;\r\n });\r\n });\r\n\r\n // Re-arm after each page settles. IntersectionObserver only reports\r\n // threshold *crossings*: if an appended page is too short to push the\r\n // sentinel back out of the root margin, the entry stays `isIntersecting`\r\n // and no further callback ever arrives — the list stalls part-loaded\r\n // until the user happens to scroll. Re-observing the same element\r\n // delivers a fresh initial callback, so the loop continues until the\r\n // sentinel really is out of range (callback reports no intersection, no\r\n // emit, no state change, effect idle) or the data runs out\r\n // (`hasMoreCards()` false). `observe()` on an already-observed target is\r\n // a no-op, hence the explicit `unobserve` first.\r\n effect(() => {\r\n const state = this.cardsState();\r\n const el = this.loadMoreSentinel()?.nativeElement;\r\n const observer = this.loadMoreObserver;\r\n\r\n if (!observer || !el || state.loading || !this.hasMoreCards()) return;\r\n\r\n observer.unobserve(el);\r\n observer.observe(el);\r\n });\r\n\r\n // Emit lazyLoad only on genuine filter / search changes for paginated\r\n // lists, matching mt-table's behaviour (group-by is a pure FE concern,\r\n // not a re-fetch trigger). Deliberately reads `cardsState()` via\r\n // `untracked` — the item state gets a new object reference on every\r\n // page append (infinite scroll), and reacting to that here would\r\n // re-emit `lazyLoad` after every append, which re-fetches with\r\n // `append: false` and wipes out everything already loaded.\r\n let primed = false;\r\n effect(() => {\r\n const filters = this.bucket().filters();\r\n const filterTerm = this.bucket().filterTerm();\r\n const state = untracked(() => this.cardsState());\r\n\r\n if (!state.config.isPaginated) return;\r\n if (!primed) {\r\n primed = true;\r\n if (Object.keys(filters).length === 0 && !filterTerm) return;\r\n }\r\n\r\n queueMicrotask(() =>\r\n this.lazyLoad.emit({\r\n filters: {\r\n ...filters,\r\n ...(filterTerm ? { generalSearch: filterTerm } : {}),\r\n },\r\n pageSize: state.take,\r\n first: 0,\r\n currentPage: 1,\r\n } as ClientListLazyLoadEvent),\r\n );\r\n });\r\n }\r\n}\r\n","<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 — 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","import { ClientListFetchRequestFilter } from '../models/client-list.model';\r\n\r\nexport function toDashboardExtraFilters(\r\n filters: ClientListFetchRequestFilter[] = [],\r\n): Record<string, unknown> {\r\n const extraFilters: Record<string, unknown> = {};\r\n\r\n for (const filter of filters) {\r\n if (!filter.key) {\r\n continue;\r\n }\r\n\r\n extraFilters[filter.key] = filter.value;\r\n }\r\n\r\n return extraFilters;\r\n}\r\n","import { Component, computed, input } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoPipe } from '@jsverse/transloco';\r\nimport { Card } from '@masterteam/components/card';\r\nimport { DashboardViewer } from '@masterteam/dashboard-builder';\r\nimport { SkeletonModule } from 'primeng/skeleton';\r\nimport {\r\n ClientListContentTemplateContext,\r\n ClientListInformativeState,\r\n ClientListState,\r\n} from '../../models/client-list.model';\r\nimport { toDashboardExtraFilters } from '../../utils/informative-filters';\r\n\r\nconst DEFAULT_GRID_COLUMNS = 12;\r\n\r\n@Component({\r\n selector: 'mt-client-list-informative-view',\r\n standalone: true,\r\n imports: [CommonModule, Card, DashboardViewer, SkeletonModule, TranslocoPipe],\r\n templateUrl: './client-list-informative-view.html',\r\n})\r\nexport class ClientListInformativeView {\r\n readonly state = input.required<ClientListState>();\r\n\r\n protected readonly informativeState = computed(\r\n () => this.state() as ClientListInformativeState,\r\n );\r\n protected readonly dashboardExtraFilters = computed(() => {\r\n return toDashboardExtraFilters(this.informativeState().config.filters);\r\n });\r\n protected readonly gridTemplateColumns = `repeat(${DEFAULT_GRID_COLUMNS}, minmax(0, 1fr))`;\r\n\r\n protected slotGridSpan(span: number): string {\r\n return `span ${span} / span ${span}`;\r\n }\r\n\r\n protected templateContext(\r\n item: ClientListState,\r\n ): ClientListContentTemplateContext {\r\n return {\r\n $implicit: item,\r\n table: item,\r\n item,\r\n loading: item.loading,\r\n error: item.error,\r\n data: item.rawData,\r\n };\r\n }\r\n}\r\n","<div class=\"grid gap-4\" [style.gridTemplateColumns]=\"gridTemplateColumns\">\r\n @if (informativeState().config.contentStart) {\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.startSpan)\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"informativeState().config.contentStart\"\r\n [ngTemplateOutletContext]=\"templateContext(informativeState())\"\r\n />\r\n </div>\r\n }\r\n\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.tableSpan)\r\n \"\r\n >\r\n <mt-card>\r\n @if (\r\n informativeState().loading &&\r\n !informativeState().dashboardData?.charts?.length\r\n ) {\r\n <div class=\"flex flex-col gap-3 py-3\">\r\n <p-skeleton height=\"6rem\" />\r\n <p-skeleton height=\"12rem\" />\r\n <p-skeleton height=\"12rem\" />\r\n </div>\r\n } @else if (informativeState().error) {\r\n <div\r\n class=\"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700\"\r\n >\r\n {{ informativeState().error }}\r\n </div>\r\n } @else if (!informativeState().dashboardData?.charts?.length) {\r\n <div class=\"p-6 text-center text-gray-400\">\r\n {{\r\n \"components.clientComponents.list.noInformativeDashboard\"\r\n | transloco\r\n }}\r\n </div>\r\n } @else {\r\n <div class=\"min-h-[420px]\">\r\n <mt-dashboard-viewer\r\n [isPage]=\"false\"\r\n [showFilters]=\"false\"\r\n [dashboardData]=\"informativeState().dashboardData\"\r\n [extraFilters]=\"dashboardExtraFilters()\"\r\n />\r\n </div>\r\n }\r\n </mt-card>\r\n </div>\r\n\r\n @if (informativeState().config.contentEnd) {\r\n <div\r\n [style.gridColumn]=\"\r\n slotGridSpan(informativeState().config.layout.endSpan)\r\n \"\r\n >\r\n <ng-container\r\n [ngTemplateOutlet]=\"informativeState().config.contentEnd\"\r\n [ngTemplateOutletContext]=\"templateContext(informativeState())\"\r\n />\r\n </div>\r\n }\r\n</div>\r\n","import { TableFilters, TableValueResolver } from '@masterteam/components/table';\r\nimport {\r\n ClientListFetchRequestFilter,\r\n RuntimeEntityColumnDef,\r\n} from '../models/client-list.model';\r\n\r\nexport function mergeRuntimeFilters(\r\n configured: ClientListFetchRequestFilter[] = [],\r\n runtime: TableFilters = {},\r\n columns: RuntimeEntityColumnDef[] = [],\r\n): ClientListFetchRequestFilter[] {\r\n const filters = [...configured];\r\n\r\n for (const [rawKey, rawValue] of Object.entries(runtime)) {\r\n const column = columns.find(\r\n (item) => item.key === rawKey || item.normalizedKey === rawKey,\r\n );\r\n const key =\r\n rawKey === 'generalSearch' ? 'Name' : (column?.normalizedKey ?? rawKey);\r\n const filterType = column\r\n ? TableValueResolver.getColumnFilterType(column)\r\n : null;\r\n\r\n if (isRange(rawValue)) {\r\n appendRange(filters, key, rawValue, filterType === 'date');\r\n continue;\r\n }\r\n\r\n const scalar = toScalar(rawValue);\r\n const value =\r\n rawKey === 'generalSearch' && typeof scalar === 'string'\r\n ? scalar.trim()\r\n : scalar;\r\n if (value === null) continue;\r\n\r\n filters.push({\r\n key,\r\n operator:\r\n rawKey === 'generalSearch' || filterType === 'text'\r\n ? 'Contains'\r\n : 'Equals',\r\n value,\r\n });\r\n }\r\n\r\n return filters;\r\n}\r\n\r\nexport function runtimeFiltersChanged(\r\n previous: TableFilters | undefined,\r\n next: TableFilters | undefined,\r\n): boolean {\r\n return JSON.stringify(previous ?? {}) !== JSON.stringify(next ?? {});\r\n}\r\n\r\nfunction appendRange(\r\n filters: ClientListFetchRequestFilter[],\r\n key: string,\r\n range: { from?: unknown; to?: unknown },\r\n isDate: boolean,\r\n): void {\r\n const from = toRangeValue(range.from, isDate);\r\n const to = toRangeValue(range.to, isDate);\r\n\r\n if (from !== null) {\r\n filters.push({ key, operator: 'GreaterThanOrEqual', value: from });\r\n }\r\n if (to !== null) {\r\n filters.push({ key, operator: 'LessThanOrEqual', value: to });\r\n }\r\n}\r\n\r\nfunction isRange(value: unknown): value is { from?: unknown; to?: unknown } {\r\n return (\r\n !!value && typeof value === 'object' && ('from' in value || 'to' in value)\r\n );\r\n}\r\n\r\nfunction toRangeValue(value: unknown, isDate: boolean): string | number | null {\r\n if (value === null || value === undefined || value === '') return null;\r\n if (!isDate) return toScalar(value);\r\n\r\n if (typeof value === 'string') {\r\n const trimmed = value.trim();\r\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(trimmed)) return trimmed;\r\n }\r\n\r\n const date = value instanceof Date ? value : new Date(String(value));\r\n if (Number.isNaN(date.getTime())) return null;\r\n\r\n const year = date.getFullYear();\r\n const month = String(date.getMonth() + 1).padStart(2, '0');\r\n const day = String(date.getDate()).padStart(2, '0');\r\n return `${year}-${month}-${day}`;\r\n}\r\n\r\nfunction toScalar(value: unknown): string | number | null {\r\n if (Array.isArray(value)) {\r\n return value.length === 1 ? toScalar(value[0]) : null;\r\n }\r\n if (value === null || value === undefined || value === '') return null;\r\n if (typeof value === 'string' || typeof value === 'number') return value;\r\n if (typeof value === 'boolean') return String(value);\r\n if (typeof value !== 'object') return null;\r\n\r\n const item = value as Record<string, unknown>;\r\n return toScalar(\r\n item['value'] ??\r\n item['id'] ??\r\n item['key'] ??\r\n item['userName'] ??\r\n item['displayName'],\r\n );\r\n}\r\n","import {\r\n ClientListAreaType,\r\n ClientListState,\r\n NormalizedClientListConfiguration,\r\n} from '../models/client-list.model';\r\n\r\n/**\r\n * Whether the offset a list is currently sitting on still describes the same\r\n * result set, i.e. this reconfigure changed nothing about what gets fetched.\r\n *\r\n * Hosts rebuild the `configurations` array from a `computed()`, so *any*\r\n * unrelated state change — a permission refresh after a write, a language\r\n * switch, a re-rendered header template — hands the list a brand new array\r\n * with identical content. That must not move the user off their page, and\r\n * must not cost a request.\r\n *\r\n * The page size is compared **as configured**, never as currently applied. The\r\n * table owns its rows-per-page: the user picks it from the paginator and\r\n * `mt-table` restores a persisted value, and either of those legitimately\r\n * leaves the runtime `take` different from the configured one. Reading that\r\n * difference as drift to correct is what used to reset the paginator and\r\n * refetch page 1 on every reconfigure.\r\n */\r\nexport function preservesPaging(\r\n existing: ClientListState | undefined,\r\n areaType: ClientListAreaType,\r\n next: NormalizedClientListConfiguration,\r\n): boolean {\r\n if (\r\n !existing ||\r\n existing.type !== 'form' ||\r\n existing.areaType !== areaType ||\r\n next.type !== 'form'\r\n ) {\r\n return false;\r\n }\r\n\r\n const current = existing.config;\r\n\r\n return (\r\n current.isPaginated === next.isPaginated &&\r\n current.take === next.take &&\r\n current.contextKey === next.contextKey &&\r\n serializeFilters(current.filters) === serializeFilters(next.filters)\r\n );\r\n}\r\n\r\nfunction serializeFilters(\r\n filters: NormalizedClientListConfiguration['filters'] | undefined,\r\n): string {\r\n return JSON.stringify(filters ?? []);\r\n}\r\n","import {\r\n Component,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n output,\r\n untracked,\r\n OnDestroy,\r\n} from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { Subscription } from 'rxjs';\r\nimport { Button } from '@masterteam/components/button';\r\nimport { TableAction } from '@masterteam/components/table';\r\nimport {\r\n RuntimeAction,\r\n RuntimeActionRunner,\r\n resolveActionLabel,\r\n} from '@masterteam/components/runtime-action';\r\nimport { ClientListApiService } from './services/client-list-api.service';\r\nimport { ClientListStateService } from './services/client-list-state.service';\r\nimport {\r\n ClientListRuntimeActionsService,\r\n defaultResolveRecordId,\r\n} from './services/client-list-runtime-actions.service';\r\nimport { ClientListToolbarService } from './services/client-list-toolbar';\r\nimport {\r\n ClientListAreaType,\r\n ClientListConfiguration,\r\n ClientListContentTemplateContext,\r\n ClientListFormConfiguration,\r\n ClientListItemClickedEvent,\r\n ClientListInformativeConfiguration,\r\n ClientListLazyLoadEvent,\r\n ClientListLayoutConfig,\r\n ClientListMode,\r\n ClientListRuntimeRecordActionsConfig,\r\n ClientListRuntimeRecordActionsContext,\r\n ClientListState,\r\n RuntimeTableDisplayRow,\r\n ClientListTableQuery,\r\n ClientListTablePersistStateKey,\r\n ClientListType,\r\n NormalizedClientListConfiguration,\r\n ClientListCard,\r\n CLIENT_LIST_DEFAULT_INCLUDE_STATE,\r\n CLIENT_LIST_RECORD_ID_FILTER_KEY,\r\n CLIENT_LIST_RECORD_STATE_KEY,\r\n ClientListFetchRecord,\r\n ClientListFetchRecordState,\r\n ClientListFetchRequestFilter,\r\n ClientListRecordWriteResult,\r\n ClientListReturnRecordRequest,\r\n} from './models/client-list.model';\r\nimport { ClientListTableView } from './components/client-list-table-view/client-list-table-view';\r\nimport { ClientListCardsView } from './components/client-list-cards-view/client-list-cards-view';\r\nimport { ClientListInformativeView } from './components/client-list-informative-view/client-list-informative-view';\r\nimport {\r\n mergeRuntimeFilters,\r\n runtimeFiltersChanged,\r\n} from './utils/runtime-filters';\r\nimport { preservesPaging } from './utils/paging-continuity';\r\n\r\nconst DEFAULT_AREA_TYPE: ClientListAreaType = 'table';\r\nconst DEFAULT_MODE: ClientListMode = 'auto';\r\nconst DEFAULT_TYPE: ClientListType = 'form';\r\nconst DEFAULT_SERVER_PAGE_SIZE = 100;\r\nconst DEFAULT_TABLE_PAGE_SIZE = 100;\r\nconst DEFAULT_TABLE_PERSIST_STATE_EXCLUDE: ClientListTablePersistStateKey[] = [\r\n 'pagePosition',\r\n];\r\nconst DEFAULT_COLLAPSE_ICON = 'arrow.chevron-up';\r\nconst DEFAULT_EXPAND_ICON = 'arrow.chevron-down';\r\nconst DEFAULT_SIDE_CONTENT_SPAN = 3;\r\nconst DEFAULT_GRID_COLUMNS = 12;\r\nconst ESCALATION_STATE_KEY = 'escalation';\r\nconst VIEW_ESCALATION_ACTION_KEY = 'viewEscalation';\r\nconst VIEW_ESCALATION_OPERATION_KEY = 'ViewEscalation';\r\n\r\ntype ClientListInlineTableAction = TableAction & {\r\n placement: 'inline';\r\n cardMarker?: 'escalation';\r\n};\r\n\r\n@Component({\r\n selector: 'mt-client-list',\r\n standalone: true,\r\n imports: [\r\n CommonModule,\r\n Button,\r\n ClientListTableView,\r\n ClientListCardsView,\r\n ClientListInformativeView,\r\n ],\r\n providers: [\r\n ClientListStateService,\r\n ClientListRuntimeActionsService,\r\n ClientListToolbarService,\r\n ],\r\n templateUrl: './client-list.html',\r\n})\r\nexport class ClientList implements OnDestroy {\r\n private readonly api = inject(ClientListApiService);\r\n protected readonly state = inject(ClientListStateService);\r\n private readonly runtimeActions = inject(ClientListRuntimeActionsService);\r\n private readonly runtimeRunner = inject(RuntimeActionRunner);\r\n private readonly transloco = inject(TranslocoService);\r\n\r\n readonly configurations = input.required<ClientListConfiguration[]>();\r\n readonly defaultTake = input(DEFAULT_SERVER_PAGE_SIZE);\r\n\r\n readonly loaded = output<string>();\r\n readonly errored = output<{ key: string; message: string }>();\r\n readonly itemClicked = output<ClientListItemClickedEvent>();\r\n\r\n protected readonly items = this.state.items;\r\n private readonly subscriptions = new Map<string, Subscription>();\r\n private readonly inFlightRequestSignatures = new Map<string, string>();\r\n private readonly fulfilledRequestSignatures = new Map<string, string>();\r\n private readonly runtimeFilters = new Map<\r\n string,\r\n ClientListLazyLoadEvent['filters']\r\n >();\r\n /**\r\n * The `propertyKeys` the last table request carried, per item. `undefined`\r\n * means the request left the projection to the backend, which is a distinct\r\n * state from \"not loaded yet\" — hence the map rather than a nullable field.\r\n */\r\n private readonly requestPropertyKeys = new Map<\r\n string,\r\n string[] | undefined\r\n >();\r\n /** Single-record read-backs, kept apart from the page loads they must not cancel. */\r\n private readonly recordSubscriptions = new Map<string, Subscription>();\r\n\r\n constructor() {\r\n effect(() => {\r\n const configs = this.configurations();\r\n untracked(() => this.configureItems(configs));\r\n\r\n untracked(() => {\r\n this.state.items().forEach((item) => {\r\n this.loadItem(item);\r\n });\r\n });\r\n });\r\n }\r\n\r\n onLazyLoad(itemKey: string, event: ClientListLazyLoadEvent): void {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (!item || item.type === 'informative' || !item.config.isPaginated) {\r\n return;\r\n }\r\n\r\n const nextFilters =\r\n event.filters ?? this.runtimeFilters.get(item.key) ?? {};\r\n const filtersChanged = runtimeFiltersChanged(\r\n this.runtimeFilters.get(item.key),\r\n nextFilters,\r\n );\r\n this.runtimeFilters.set(item.key, nextFilters);\r\n\r\n const take = this.resolvePositiveInteger(event.pageSize) ?? item.take;\r\n const skip = filtersChanged\r\n ? 0\r\n : (this.resolveNonNegativeInteger(event.first) ?? 0);\r\n\r\n if (item.areaType === 'cards') {\r\n this.loadCards(item.key, item.config, skip, take, false);\r\n return;\r\n }\r\n\r\n this.state.setTablePaging(item.key, skip, take);\r\n this.loadTable(item.key, item.config, skip, take);\r\n }\r\n\r\n /**\r\n * Fetches the next page of cards and appends it to the currently loaded\r\n * set — the infinite-scroll counterpart to table pagination. No-op unless\r\n * `isPaginated` is enabled for this cards list, a load is already in\r\n * flight, or every record has already been loaded.\r\n *\r\n * The offset comes from `item.skip`, which the state service advances by\r\n * the page size the backend actually applied. Deriving it from\r\n * `cards.length` instead would drift the moment a page came back short (a\r\n * capped `pageSize`, a de-duplicated overlap) and re-request a page we\r\n * already hold.\r\n */\r\n loadMoreCards(itemKey: string): void {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (\r\n !item ||\r\n item.type !== 'form' ||\r\n item.areaType !== 'cards' ||\r\n !item.config.isPaginated ||\r\n item.loading ||\r\n item.cards.length >= item.totalCount\r\n ) {\r\n return;\r\n }\r\n\r\n this.loadCards(item.key, item.config, item.skip, item.take, true);\r\n }\r\n\r\n reload(itemKey?: string): void {\r\n if (itemKey) {\r\n this.reloadByKey(itemKey);\r\n return;\r\n }\r\n\r\n this.items().forEach((item) => {\r\n this.loadItem(item, true);\r\n });\r\n }\r\n\r\n reloadByKey(itemKey: string): void {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (!item) return;\r\n\r\n this.loadItem(item, true);\r\n }\r\n\r\n /**\r\n * The query settings this list renders with, shaped as the `returnRecord`\r\n * block of a `process-submit` payload. Send it with a create/update so the\r\n * backend projects the written record the way this list reads records, then\r\n * hand the response to {@link applyWriteResult} — that pair replaces the\r\n * full page re-fetch a write used to cost.\r\n *\r\n * Returns `null` for an informative dashboard (no records to project) or an\r\n * unknown key.\r\n */\r\n getReturnRecordRequest(\r\n itemKey: string,\r\n ): ClientListReturnRecordRequest | null {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (!item || item.type !== 'form') return null;\r\n\r\n const includeState = [...CLIENT_LIST_DEFAULT_INCLUDE_STATE];\r\n const culture = this.transloco.getActiveLang();\r\n\r\n if (item.areaType === 'cards') {\r\n return { projection: 'Card', includeState, culture };\r\n }\r\n\r\n const propertyKeys = this.requestPropertyKeys.get(itemKey);\r\n\r\n return {\r\n projection: 'Table',\r\n surfaceKey: 'table',\r\n includeState,\r\n // Omitted, not empty, when the table let the backend pick the\r\n // projection — an empty array would read as \"no columns\".\r\n ...(propertyKeys?.length ? { propertyKeys } : {}),\r\n culture,\r\n };\r\n }\r\n\r\n /**\r\n * Applies a create/update to the list in place, without re-fetching the\r\n * page. Pass the `process-submit` response as-is.\r\n *\r\n * Three outcomes, in the order they are tried:\r\n * - the write carried a usable record projection → splice it in, no request;\r\n * - it did not (`recordProjectionStatus: 'Unavailable'`, or the list has\r\n * nothing to splice into) → read that one record back by id. The write\r\n * already succeeded; this only reads, and never re-submits;\r\n * - nothing identifies the record at all → reload the page, as before.\r\n *\r\n * An approval-queued submit is a no-op: nothing has been written yet.\r\n *\r\n * Note that the list cannot know where the backend would have sorted a new\r\n * record, so an insert lands at the top of the page in view.\r\n */\r\n applyWriteResult(\r\n itemKey: string,\r\n result: ClientListRecordWriteResult | null | undefined,\r\n ): void {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (!item || item.type !== 'form') return;\r\n\r\n if (this.isPendingApprovalWrite(result)) return;\r\n\r\n const recordId = this.toFiniteNumber(result?.recordId);\r\n const record = this.toWriteRecord(result, recordId);\r\n\r\n if (record) {\r\n // A failed splice means the list holds no page to splice into, so\r\n // reading the record back would not help either.\r\n if (this.state.upsertRecord(itemKey, record, item.config)) {\r\n this.afterRecordApplied(itemKey);\r\n } else {\r\n this.reloadByKey(itemKey);\r\n }\r\n return;\r\n }\r\n\r\n if (recordId != null) {\r\n this.readRecordBack(item, recordId);\r\n return;\r\n }\r\n\r\n this.reloadByKey(itemKey);\r\n }\r\n\r\n /**\r\n * Drops a deleted record from the list in place. Falls back to a reload when\r\n * the record is not part of the loaded set, so a stale list still corrects\r\n * itself.\r\n */\r\n removeRecord(itemKey: string, recordId: number): void {\r\n const item = this.state.itemsByKey()[itemKey];\r\n if (!item || item.type !== 'form') return;\r\n\r\n if (!this.state.removeRecord(itemKey, recordId, item.config)) {\r\n this.reloadByKey(itemKey);\r\n return;\r\n }\r\n\r\n this.runtimeActions.invalidateRow(itemKey, recordId);\r\n this.afterRecordApplied(itemKey, { invalidateRuntimeActions: false });\r\n }\r\n\r\n toggleExpanded(key: string): void {\r\n this.state.toggleExpanded(key);\r\n }\r\n\r\n onTableRowClick(item: ClientListState, row: RuntimeTableDisplayRow): void {\r\n this.itemClicked.emit({\r\n key: item.key,\r\n areaType: 'table',\r\n item: row,\r\n state: item,\r\n });\r\n }\r\n\r\n onCardClick(item: ClientListState, card: ClientListCard): void {\r\n this.itemClicked.emit({\r\n key: item.key,\r\n areaType: 'cards',\r\n item: card,\r\n state: item,\r\n });\r\n }\r\n\r\n /**\r\n * Called by the table view when a row's 3-dots menu is opened. Triggers a\r\n * lazy fetch of that row's runtime actions when `runtimeRecordActions` is\r\n * enabled with the default `onMenuOpen` strategy. Skips when the cache is\r\n * still warm — the service handles in-flight dedupe and TTL.\r\n */\r\n onRowActionsRequested(\r\n item: ClientListState,\r\n row: RuntimeTableDisplayRow,\r\n ): void {\r\n const config = item.config.runtimeRecordActions;\r\n if (!config?.enabled) return;\r\n if ((config.loadStrategy ?? 'onMenuOpen') !== 'onMenuOpen') return;\r\n\r\n const ctx = this.toRuntimeActionsContext(item, row, config);\r\n if (!ctx) return;\r\n\r\n this.runtimeActions.request(config, ctx);\r\n }\r\n\r\n /**\r\n * Per-row predicate used by the popover skeleton state.\r\n */\r\n isRowActionsLoading(\r\n item: ClientListState,\r\n row: RuntimeTableDisplayRow,\r\n ): boolean {\r\n const config = item.config.runtimeRecordActions;\r\n if (!config?.enabled) return false;\r\n const recordId = this.resolveRecordId(config, row);\r\n if (recordId == null) return false;\r\n return this.runtimeActions\r\n .loadingRowKeys()\r\n .has(this.runtimeActions.rowKey(item.key, recordId));\r\n }\r\n\r\n /**\r\n * Per-list merged row-actions, keyed by item.key. Static `rowActions` are\r\n * augmented with one entry per distinct runtime `actionKey` discovered for\r\n * any row in the list, and re-evaluated when the runtime cache changes.\r\n */\r\n protected readonly mergedRowActionsByKey = computed<\r\n ReadonlyMap<string, TableAction[]>\r\n >(() => {\r\n const cache = this.runtimeActions.actionsByRowKey();\r\n const result = new Map<string, TableAction[]>();\r\n for (const item of this.state.items()) {\r\n result.set(item.key, this.computeMergedRowActions(item, cache));\r\n }\r\n return result;\r\n });\r\n\r\n /** Fallback used by the template when no entry exists for an item.key. */\r\n private readonly emptyActions: TableAction[] = [];\r\n private readonly rowActionsLoadingFnCache = new Map<\r\n string,\r\n (row: RuntimeTableDisplayRow) => boolean\r\n >();\r\n\r\n rowActionsFor(item: ClientListState): TableAction[] {\r\n return (\r\n this.mergedRowActionsByKey().get(item.key) ??\r\n item.config.rowActions ??\r\n this.emptyActions\r\n );\r\n }\r\n\r\n rowActionsLoadingFnFor(\r\n item: ClientListState,\r\n ): (row: RuntimeTableDisplayRow) => boolean {\r\n let fn = this.rowActionsLoadingFnCache.get(item.key);\r\n if (!fn) {\r\n const itemKey = item.key;\r\n fn = (row: RuntimeTableDisplayRow) => {\r\n const current = this.state.itemsByKey()[itemKey];\r\n return current ? this.isRowActionsLoading(current, row) : false;\r\n };\r\n this.rowActionsLoadingFnCache.set(itemKey, fn);\r\n }\r\n return fn;\r\n }\r\n\r\n private computeMergedRowActions(\r\n item: ClientListState,\r\n cache: ReadonlyMap<string, RuntimeAction[]>,\r\n ): TableAction[] {\r\n const baseActions = item.config.rowActions ?? [];\r\n const config = item.config.runtimeRecordActions;\r\n const escalationAction =\r\n config?.enabled && this.hasActiveEscalation(item)\r\n ? this.createEscalationPreviewRowAction(item, config)\r\n : null;\r\n const baseWithEscalation = escalationAction\r\n ? [escalationAction, ...baseActions]\r\n : baseActions;\r\n if (!config?.enabled) return baseWithEscalation;\r\n\r\n const prefix = `${item.key}:`;\r\n const prototypes = new Map<string, RuntimeAction>();\r\n for (const [key, actions] of cache) {\r\n if (!key.startsWith(prefix)) continue;\r\n for (const action of actions) {\r\n if (!prototypes.has(action.actionKey)) {\r\n prototypes.set(action.actionKey, action);\r\n }\r\n }\r\n }\r\n\r\n if (prototypes.size === 0) {\r\n return baseWithEscalation;\r\n }\r\n\r\n const icon = config.actionIcon ?? 'media.play-circle';\r\n const runtimeActionEntries: TableAction[] = [];\r\n for (const [actionKey, prototype] of prototypes) {\r\n if (this.isViewEscalationAction(prototype)) {\r\n continue;\r\n }\r\n\r\n const label = resolveActionLabel(prototype);\r\n const presentation = config.resolveActionPresentation?.(prototype) ?? {};\r\n runtimeActionEntries.push({\r\n icon: (presentation.icon ?? icon) as TableAction['icon'],\r\n color: presentation.color ?? 'secondary',\r\n variant: presentation.variant ?? 'outlined',\r\n label: presentation.label ?? label,\r\n tooltip: presentation.tooltip ?? label,\r\n loading: presentation.loading,\r\n hidden: (row) => {\r\n const recordId = this.resolveRecordId(config, row);\r\n if (recordId == null) return true;\r\n const rowActions = cache.get(\r\n this.runtimeActions.rowKey(item.key, recordId),\r\n );\r\n return !rowActions?.some(\r\n (a) => a.actionKey === actionKey && a.isAvailable !== false,\r\n );\r\n },\r\n action: (row) => {\r\n const ctx = this.toRuntimeActionsContext(item, row, config);\r\n if (!ctx) return;\r\n const rowActions = cache.get(\r\n this.runtimeActions.rowKey(item.key, ctx.recordId),\r\n );\r\n const action = rowActions?.find((a) => a.actionKey === actionKey);\r\n if (action) {\r\n void this.executeRuntimeAction(item, ctx, config, action);\r\n }\r\n },\r\n });\r\n }\r\n\r\n return [...baseWithEscalation, ...runtimeActionEntries];\r\n }\r\n\r\n private createEscalationPreviewRowAction(\r\n item: ClientListState,\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ): TableAction {\r\n const label = this.transloco.translate(\r\n 'components.clientComponents.list.viewEscalation',\r\n );\r\n\r\n const action: ClientListInlineTableAction = {\r\n icon: 'editor.hand',\r\n color: 'warn',\r\n variant: 'text',\r\n placement: 'inline',\r\n cardMarker: 'escalation',\r\n tooltip: label,\r\n hidden: (row) => this.resolveEscalationInstanceId(row) == null,\r\n action: (row) => {\r\n void this.triggerEscalationPreviewAction(item, row, config);\r\n },\r\n };\r\n\r\n return action;\r\n }\r\n\r\n private async triggerEscalationPreviewAction(\r\n item: ClientListState,\r\n row: RuntimeTableDisplayRow,\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ): Promise<void> {\r\n const instanceId = this.resolveEscalationInstanceId(row);\r\n if (instanceId == null) return;\r\n\r\n const ctx = this.toRuntimeActionsContext(item, row, config);\r\n if (!ctx) return;\r\n\r\n const action = this.toEscalationPreviewRuntimeAction(instanceId);\r\n const handled = await Promise.resolve(\r\n config.onActionTriggered?.(action, ctx),\r\n );\r\n if (handled === true) return;\r\n\r\n const result = await this.runtimeRunner.execute(action, {\r\n defaultAfterSuccess: 'refresh',\r\n });\r\n\r\n if (result.status !== 'success') return;\r\n this.runtimeActions.invalidateList(item.key);\r\n this.reloadByKey(item.key);\r\n config.onActionExecuted?.(action, ctx);\r\n }\r\n\r\n private toEscalationPreviewRuntimeAction(instanceId: number): RuntimeAction {\r\n return {\r\n actionKey: VIEW_ESCALATION_ACTION_KEY,\r\n actionName: this.transloco.translate(\r\n 'components.clientComponents.list.viewEscalation',\r\n ),\r\n httpMethod: 'GET',\r\n url: `escalations/${instanceId}/preview`,\r\n isAvailable: true,\r\n operationKey: VIEW_ESCALATION_OPERATION_KEY,\r\n targetType: 'Escalation',\r\n targetId: instanceId,\r\n payloadTemplate: {\r\n escalationInstanceId: instanceId,\r\n instanceId,\r\n },\r\n };\r\n }\r\n\r\n private resolveEscalationInstanceId(\r\n row: RuntimeTableDisplayRow,\r\n ): number | null {\r\n const state = row[CLIENT_LIST_RECORD_STATE_KEY] as\r\n | ClientListFetchRecordState\r\n | null\r\n | undefined;\r\n\r\n return this.resolveEscalationInstanceIdFromState(state);\r\n }\r\n\r\n private resolveEscalationInstanceIdFromState(\r\n state: ClientListFetchRecordState | null | undefined,\r\n ): number | null {\r\n const escalation = state?.[ESCALATION_STATE_KEY];\r\n\r\n if (escalation?.hasActive !== true) {\r\n return null;\r\n }\r\n\r\n return this.toFiniteNumber(escalation.instanceId);\r\n }\r\n\r\n private hasActiveEscalation(item: ClientListState): boolean {\r\n if (item.type !== 'form') {\r\n return false;\r\n }\r\n\r\n if (item.areaType === 'cards') {\r\n return item.cards.some(\r\n (card) => this.resolveEscalationInstanceIdFromState(card.state) != null,\r\n );\r\n }\r\n\r\n return item.rows.some(\r\n (row) => this.resolveEscalationInstanceId(row) != null,\r\n );\r\n }\r\n\r\n private isViewEscalationAction(action: RuntimeAction): boolean {\r\n return (\r\n this.normalizeActionKey(action.operationKey) ===\r\n this.normalizeActionKey(VIEW_ESCALATION_OPERATION_KEY) ||\r\n this.normalizeActionKey(action.actionKey) ===\r\n this.normalizeActionKey(VIEW_ESCALATION_ACTION_KEY)\r\n );\r\n }\r\n\r\n private normalizeActionKey(value: string | null | undefined): string {\r\n return (value ?? '').trim().toLowerCase();\r\n }\r\n\r\n private toFiniteNumber(value: unknown): number | null {\r\n if (typeof value === 'number') {\r\n return Number.isFinite(value) ? value : null;\r\n }\r\n\r\n if (typeof value === 'string' && value.trim() !== '') {\r\n const parsed = Number(value);\r\n return Number.isFinite(parsed) ? parsed : null;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private async executeRuntimeAction(\r\n item: ClientListState,\r\n ctx: ClientListRuntimeRecordActionsContext,\r\n config: ClientListRuntimeRecordActionsConfig,\r\n action: RuntimeAction,\r\n ): Promise<void> {\r\n const handled = await Promise.resolve(\r\n config.onActionTriggered?.(action, ctx),\r\n );\r\n if (handled === true) return;\r\n\r\n const result = await this.runtimeRunner.execute(action, {\r\n defaultAfterSuccess: 'refresh',\r\n });\r\n\r\n if (result.status !== 'success') return;\r\n\r\n if (result.afterSuccess === 'refresh' || result.afterSuccess == null) {\r\n this.runtimeActions.invalidateList(item.key);\r\n this.reloadByKey(item.key);\r\n config.onActionExecuted?.(action, ctx);\r\n }\r\n }\r\n\r\n /**\r\n * A submit that only queued an approval request has written nothing — the\r\n * record it describes does not exist yet, so the list must not move.\r\n */\r\n private isPendingApprovalWrite(\r\n result: ClientListRecordWriteResult | null | undefined,\r\n ): boolean {\r\n return (\r\n String(result?.status ?? '')\r\n .trim()\r\n .toLowerCase() === 'pendingapproval'\r\n );\r\n }\r\n\r\n /**\r\n * The canonical record from a write response, or `null` when there is none\r\n * to trust. A backend that has not shipped the canonical projection yet\r\n * answers with neither `recordProjectionStatus: 'Available'` nor `values`,\r\n * and falls through to the read-back path — which is why this is a plain\r\n * shape check and not a parse of alternative record shapes.\r\n */\r\n private toWriteRecord(\r\n result: ClientListRecordWriteResult | null | undefined,\r\n recordId: number | null,\r\n ): ClientListFetchRecord | null {\r\n if (result?.recordProjectionStatus !== 'Available') return null;\r\n\r\n const record = result.record;\r\n if (!record?.values) return null;\r\n\r\n const id = this.toFiniteNumber(record.id) ?? recordId;\r\n if (id == null) return null;\r\n\r\n return { ...record, id };\r\n }\r\n\r\n /**\r\n * Reads one record back through `fetch/query` with this list's own settings.\r\n * Taken when the write could not project the record itself — the write has\r\n * already happened, so this reads and never re-submits.\r\n */\r\n private readRecordBack(item: ClientListState, recordId: number): void {\r\n const config = item.config;\r\n const request = this.getReturnRecordRequest(item.key);\r\n\r\n if (!request || !this.hasValidIdentifiers(config)) {\r\n this.reloadByKey(item.key);\r\n return;\r\n }\r\n\r\n // The host's own scope filters plus the record id. Runtime filters (the\r\n // search box, a column filter) are deliberately left out: a record the\r\n // user just wrote should come back whether or not it matches whatever\r\n // they happen to have typed into the list.\r\n const filters: ClientListFetchRequestFilter[] = [\r\n ...config.filters,\r\n {\r\n key: CLIENT_LIST_RECORD_ID_FILTER_KEY,\r\n operator: 'Equals',\r\n value: recordId,\r\n },\r\n ];\r\n\r\n this.recordSubscriptions.get(item.key)?.unsubscribe();\r\n\r\n const sub = this.api\r\n .getRecord(config.contextKey!, request, filters)\r\n .subscribe({\r\n next: (response) => {\r\n this.recordSubscriptions.delete(item.key);\r\n const record = response.data?.records?.[0];\r\n\r\n if (!record || !this.state.upsertRecord(item.key, record, config)) {\r\n this.reloadByKey(item.key);\r\n return;\r\n }\r\n\r\n this.afterRecordApplied(item.key);\r\n },\r\n error: () => {\r\n this.recordSubscriptions.delete(item.key);\r\n this.reloadByKey(item.key);\r\n },\r\n });\r\n\r\n this.recordSubscriptions.set(item.key, sub);\r\n }\r\n\r\n /**\r\n * Runs the tail of a load for a list that changed without one: the row\r\n * action cache is stale (a written record's available actions follow its new\r\n * state), and hosts hang work off `dataLoaded` / `loaded`.\r\n */\r\n private afterRecordApplied(\r\n itemKey: string,\r\n options?: { invalidateRuntimeActions?: boolean },\r\n ): void {\r\n if (options?.invalidateRuntimeActions !== false) {\r\n this.runtimeActions.invalidateList(itemKey);\r\n }\r\n\r\n this.notifyDataLoaded(itemKey);\r\n this.loaded.emit(itemKey);\r\n }\r\n\r\n private toRuntimeActionsContext(\r\n item: ClientListState,\r\n row: RuntimeTableDisplayRow,\r\n config: ClientListRuntimeRecordActionsConfig,\r\n ): ClientListRuntimeRecordActionsContext | null {\r\n const recordId = this.resolveRecordId(config, row);\r\n if (recordId == null) return null;\r\n\r\n return {\r\n listKey: item.key,\r\n contextKey: item.config.contextKey ?? null,\r\n instanceId: item.config.instanceId ?? null,\r\n moduleId: item.config.moduleId ?? 0,\r\n row,\r\n recordId,\r\n };\r\n }\r\n\r\n private resolveRecordId(\r\n config: ClientListRuntimeRecordActionsConfig,\r\n row: RuntimeTableDisplayRow,\r\n ): number | null {\r\n return (config.resolveRecordId ?? defaultResolveRecordId)(row);\r\n }\r\n\r\n templateContext(item: ClientListState): ClientListContentTemplateContext {\r\n return {\r\n $implicit: item,\r\n table: item,\r\n item,\r\n loading: item.loading,\r\n error: item.error,\r\n data: item.rawData,\r\n };\r\n }\r\n\r\n defaultTitle(item: ClientListState): string {\r\n if (item.type === 'informative') {\r\n return this.transloco.translate(\r\n 'components.clientComponents.list.informativeDashboard',\r\n );\r\n }\r\n\r\n return this.transloco.translate(\r\n item.areaType === 'cards'\r\n ? 'components.clientComponents.list.cards'\r\n : 'components.clientComponents.list.table',\r\n );\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.subscriptions.forEach((sub) => sub.unsubscribe());\r\n this.subscriptions.clear();\r\n this.recordSubscriptions.forEach((sub) => sub.unsubscribe());\r\n this.recordSubscriptions.clear();\r\n this.requestPropertyKeys.clear();\r\n this.rowActionsLoadingFnCache.clear();\r\n this.runtimeActions.clearAll();\r\n }\r\n\r\n private configureItems(configs: ClientListConfiguration[]): void {\r\n const previousItems = this.state.itemsByKey();\r\n const hasMultipleConfigs = (configs ?? []).length > 1;\r\n\r\n const normalized: ClientListState[] = (configs ?? []).map(\r\n (config, index) => {\r\n const type = this.resolveType(config);\r\n const isInformative = type === 'informative';\r\n const formConfig = isInformative ? null : this.asFormConfig(config);\r\n const areaType = isInformative\r\n ? DEFAULT_AREA_TYPE\r\n : this.resolveAreaType(formConfig?.areaType);\r\n const mode = isInformative\r\n ? DEFAULT_MODE\r\n : this.resolveMode(formConfig?.mode, formConfig?.columnKeys);\r\n const isPaginated =\r\n !isInformative &&\r\n (areaType === 'table'\r\n ? (formConfig?.isPaginated ?? true)\r\n : (formConfig?.isPaginated ?? false));\r\n const configuredTablePageSize = this.resolvePositiveInteger(\r\n formConfig?.table?.pageSize,\r\n );\r\n const configuredTake = this.resolvePositiveInteger(formConfig?.take);\r\n const showHeader = config.showHeader ?? true;\r\n const take =\r\n !isInformative && (areaType === 'table' || isPaginated)\r\n ? isPaginated\r\n ? (configuredTake ??\r\n configuredTablePageSize ??\r\n this.resolveDefaultTake())\r\n : (configuredTake ?? this.resolveDefaultTake())\r\n : 0;\r\n const collapseEnabled =\r\n showHeader &&\r\n (config.collapse?.enabled ?? true) &&\r\n hasMultipleConfigs;\r\n const layout = this.resolveLayout(config);\r\n const key = config.key ?? this.createItemKey(config, index);\r\n const existing = previousItems[key];\r\n const normalizedConfig = this.toNormalizedConfig(\r\n config,\r\n type,\r\n areaType,\r\n mode,\r\n isPaginated,\r\n take,\r\n showHeader,\r\n collapseEnabled,\r\n layout,\r\n );\r\n // Paging is runtime state, not config state: it survives a reconfigure\r\n // that changed nothing about the fetch, and the *applied* page size\r\n // (the user's rows-per-page choice) is carried forward with it.\r\n const keepsPaging = preservesPaging(\r\n existing,\r\n areaType,\r\n normalizedConfig,\r\n );\r\n\r\n if (isInformative) {\r\n return {\r\n key,\r\n config: normalizedConfig,\r\n type: 'informative',\r\n areaType: 'table',\r\n loading: false,\r\n error: null,\r\n title: config.title?.trim() || '',\r\n moduleKey: '',\r\n totalCount: 0,\r\n columns: [],\r\n rows: [],\r\n cards: [],\r\n skip: 0,\r\n take: 0,\r\n expanded:\r\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\r\n dashboardData: existing?.dashboardData ?? null,\r\n rawData: existing?.rawData ?? null,\r\n };\r\n }\r\n\r\n if (areaType === 'cards') {\r\n return {\r\n key,\r\n config: normalizedConfig,\r\n type: 'form',\r\n areaType: 'cards',\r\n loading: false,\r\n error: null,\r\n title: config.title?.trim() || '',\r\n moduleKey: '',\r\n totalCount: 0,\r\n columns: [],\r\n rows: [],\r\n cards: [],\r\n // For infinite scroll `skip` is the next offset into the loaded\r\n // set, so it travels with that set: kept while the fetch is\r\n // unchanged (the cards themselves are kept too, by\r\n // `mergeItemState`), and restarted at 0 the moment the fetch\r\n // changes and the loaded set stops meaning anything.\r\n skip: keepsPaging ? existing.skip : 0,\r\n take: keepsPaging ? existing.take : take,\r\n expanded:\r\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\r\n dashboardData: null,\r\n rawData: existing?.rawData ?? null,\r\n };\r\n }\r\n\r\n return {\r\n key,\r\n config: normalizedConfig,\r\n type: 'form',\r\n areaType: 'table',\r\n loading: false,\r\n error: null,\r\n title: config.title?.trim() || '',\r\n moduleKey: '',\r\n totalCount: 0,\r\n columns: [],\r\n rows: [],\r\n cards: [],\r\n skip: keepsPaging ? existing.skip : 0,\r\n take: keepsPaging ? existing.take : take,\r\n expanded:\r\n existing?.expanded ?? config.collapse?.expandedByDefault ?? true,\r\n dashboardData: null,\r\n rawData: existing?.rawData ?? null,\r\n };\r\n },\r\n );\r\n\r\n this.state.setConfigs(normalized);\r\n this.cleanupStaleResources(new Set(normalized.map((item) => item.key)));\r\n }\r\n\r\n private loadItem(item: ClientListState, force = false): void {\r\n if (item.type === 'informative') {\r\n this.loadInformative(item.key, item.config, force);\r\n return;\r\n }\r\n\r\n if (item.areaType === 'cards') {\r\n this.loadCards(item.key, item.config, 0, item.take, false, force);\r\n return;\r\n }\r\n\r\n this.loadTable(item.key, item.config, item.skip, item.take, force);\r\n }\r\n\r\n private loadTable(\r\n key: string,\r\n config: NormalizedClientListConfiguration,\r\n skip: number,\r\n take: number,\r\n force = false,\r\n ): void {\r\n if (!this.hasValidIdentifiers(config)) {\r\n this.state.setLoading(key, false);\r\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\r\n return;\r\n }\r\n\r\n const query = this.toTableQuery(config, skip, take);\r\n const filters = this.resolveFetchFilters(key, config);\r\n const requestSignature = this.createTableRequestSignature(\r\n config,\r\n query,\r\n filters,\r\n );\r\n\r\n if (force) {\r\n this.inFlightRequestSignatures.delete(key);\r\n this.fulfilledRequestSignatures.delete(key);\r\n } else if (\r\n this.inFlightRequestSignatures.get(key) === requestSignature ||\r\n this.fulfilledRequestSignatures.get(key) === requestSignature\r\n ) {\r\n return;\r\n }\r\n\r\n this.subscriptions.get(key)?.unsubscribe();\r\n this.inFlightRequestSignatures.set(key, requestSignature);\r\n this.state.setLoading(key, true);\r\n this.state.setError(key, null);\r\n\r\n const sub = this.api.getRows(config.contextKey!, query, filters).subscribe({\r\n next: ({ response, propertyKeys }) => {\r\n let hasLoadedData = false;\r\n\r\n if (response.data) {\r\n this.requestPropertyKeys.set(key, propertyKeys);\r\n this.state.setRowsResult(\r\n key,\r\n response.data,\r\n config,\r\n query.skip,\r\n query.take,\r\n );\r\n this.fulfilledRequestSignatures.set(key, requestSignature);\r\n hasLoadedData = true;\r\n } else {\r\n const message: string =\r\n response.message ??\r\n this.transloco.translate<string>(\r\n 'components.clientComponents.list.errors.tableRowsLoadFailed',\r\n );\r\n this.state.setError(key, message);\r\n this.errored.emit({ key, message });\r\n }\r\n\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n\r\n if (hasLoadedData) {\r\n this.notifyDataLoaded(key);\r\n this.loaded.emit(key);\r\n }\r\n },\r\n error: (error) => {\r\n const message: string =\r\n error?.error?.message ??\r\n error?.message ??\r\n this.transloco.translate<string>(\r\n 'components.clientComponents.list.errors.rowsLoadFailed',\r\n );\r\n this.state.setError(key, message);\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.errored.emit({ key, message });\r\n },\r\n });\r\n\r\n this.subscriptions.set(key, sub);\r\n }\r\n\r\n private loadCards(\r\n key: string,\r\n config: NormalizedClientListConfiguration,\r\n skip = 0,\r\n take = 0,\r\n append = false,\r\n force = false,\r\n ): void {\r\n if (!this.hasValidIdentifiers(config)) {\r\n this.state.setLoading(key, false);\r\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\r\n return;\r\n }\r\n\r\n const filters = this.resolveFetchFilters(key, config);\r\n const requestSignature = this.createCardsRequestSignature(\r\n config,\r\n filters,\r\n skip,\r\n take,\r\n );\r\n\r\n if (force) {\r\n this.inFlightRequestSignatures.delete(key);\r\n this.fulfilledRequestSignatures.delete(key);\r\n } else if (\r\n this.inFlightRequestSignatures.get(key) === requestSignature ||\r\n this.fulfilledRequestSignatures.get(key) === requestSignature\r\n ) {\r\n return;\r\n }\r\n\r\n this.subscriptions.get(key)?.unsubscribe();\r\n this.inFlightRequestSignatures.set(key, requestSignature);\r\n this.state.setLoading(key, true);\r\n this.state.setError(key, null);\r\n\r\n const sub = this.api\r\n .getCards(\r\n config.contextKey!,\r\n filters,\r\n config.isPaginated ? skip : undefined,\r\n config.isPaginated ? take : undefined,\r\n )\r\n .subscribe({\r\n next: (response) => {\r\n let hasLoadedData = false;\r\n\r\n if (response.data) {\r\n this.state.setCardsResult(\r\n key,\r\n response.data,\r\n config,\r\n skip,\r\n take,\r\n append,\r\n );\r\n this.fulfilledRequestSignatures.set(key, requestSignature);\r\n hasLoadedData = true;\r\n } else {\r\n const message: string =\r\n response.message ??\r\n this.transloco.translate<string>(\r\n 'components.clientComponents.list.errors.cardsLoadFailed',\r\n );\r\n this.state.setError(key, message);\r\n this.errored.emit({ key, message });\r\n }\r\n\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n\r\n if (hasLoadedData) {\r\n this.notifyDataLoaded(key);\r\n this.loaded.emit(key);\r\n }\r\n },\r\n error: (error) => {\r\n const message: string =\r\n error?.error?.message ??\r\n error?.message ??\r\n this.transloco.translate<string>(\r\n 'components.clientComponents.list.errors.cardsLoadFailed',\r\n );\r\n this.state.setError(key, message);\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.errored.emit({ key, message });\r\n },\r\n });\r\n\r\n this.subscriptions.set(key, sub);\r\n }\r\n\r\n private loadInformative(\r\n key: string,\r\n config: NormalizedClientListConfiguration,\r\n force = false,\r\n ): void {\r\n if (!this.hasValidIdentifiers(config)) {\r\n this.state.setLoading(key, false);\r\n this.state.setError(key, this.getMissingIdentifiersMessage(config));\r\n return;\r\n }\r\n\r\n const requestSignature = this.createInformativeRequestSignature(config);\r\n\r\n if (force) {\r\n this.inFlightRequestSignatures.delete(key);\r\n this.fulfilledRequestSignatures.delete(key);\r\n } else if (\r\n this.inFlightRequestSignatures.get(key) === requestSignature ||\r\n this.fulfilledRequestSignatures.get(key) === requestSignature\r\n ) {\r\n return;\r\n }\r\n\r\n this.subscriptions.get(key)?.unsubscribe();\r\n this.inFlightRequestSignatures.set(key, requestSignature);\r\n this.state.setLoading(key, true);\r\n this.state.setError(key, null);\r\n\r\n const sub = this.api\r\n .getInformativeDashboard(config.levelId!, config.moduleId)\r\n .subscribe({\r\n next: (response) => {\r\n this.state.setInformativeResult(key, response.data ?? null, config);\r\n this.fulfilledRequestSignatures.set(key, requestSignature);\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.notifyDataLoaded(key);\r\n this.loaded.emit(key);\r\n },\r\n error: (error) => {\r\n if (error?.status === 404) {\r\n this.state.setInformativeResult(key, null, config);\r\n this.fulfilledRequestSignatures.set(key, requestSignature);\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.notifyDataLoaded(key);\r\n this.loaded.emit(key);\r\n return;\r\n }\r\n\r\n const message: string =\r\n error?.error?.message ??\r\n error?.message ??\r\n this.transloco.translate<string>(\r\n 'components.clientComponents.list.errors.informativeLoadFailed',\r\n );\r\n this.state.setError(key, message);\r\n this.state.setLoading(key, false);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.errored.emit({ key, message });\r\n },\r\n });\r\n\r\n this.subscriptions.set(key, sub);\r\n }\r\n\r\n private resolveAreaType(\r\n areaType: ClientListAreaType | undefined,\r\n ): ClientListAreaType {\r\n return areaType === 'cards' ? 'cards' : DEFAULT_AREA_TYPE;\r\n }\r\n\r\n private resolveType(config: ClientListConfiguration): ClientListType {\r\n return config.type === 'informative' ? 'informative' : DEFAULT_TYPE;\r\n }\r\n\r\n private resolveMode(\r\n mode: ClientListMode | undefined,\r\n columnKeys: string[] | undefined,\r\n ): ClientListMode {\r\n if (mode !== 'override') return DEFAULT_MODE;\r\n return (columnKeys ?? []).length > 0 ? 'override' : DEFAULT_MODE;\r\n }\r\n\r\n private toNormalizedConfig(\r\n config: ClientListConfiguration,\r\n type: ClientListType,\r\n areaType: ClientListAreaType,\r\n mode: ClientListMode,\r\n isPaginated: boolean,\r\n take: number,\r\n showHeader: boolean,\r\n collapseEnabled: boolean,\r\n layout: Required<ClientListLayoutConfig>,\r\n ): NormalizedClientListConfiguration {\r\n const informativeConfig = this.asInformativeConfig(config);\r\n const formConfig = this.asFormConfig(config);\r\n\r\n return {\r\n contextKey: formConfig?.contextKey ?? null,\r\n instanceId:\r\n formConfig?.instanceId ?? informativeConfig?.instanceId ?? null,\r\n filters: formConfig?.filters ?? informativeConfig?.filters ?? [],\r\n levelId: informativeConfig?.levelId ?? null,\r\n moduleId: informativeConfig?.moduleId ?? 0,\r\n type,\r\n areaType,\r\n mode,\r\n isPaginated,\r\n take,\r\n title: config.title,\r\n showHeader,\r\n columnKeys: formConfig?.columnKeys ?? [],\r\n table: this.resolveTableDisplayConfig(formConfig, take, isPaginated),\r\n headerStart: config.headerStart,\r\n headerEnd: config.headerEnd,\r\n toolbarStart: config.toolbarStart,\r\n toolbarEnd: config.toolbarEnd,\r\n contentStart: config.contentStart,\r\n contentEnd: config.contentEnd,\r\n templateContent: config.templateContent,\r\n rowActions: config.rowActions ?? [],\r\n actionShape: config.actionShape,\r\n dataLoaded: config.dataLoaded,\r\n runtimeRecordActions: config.runtimeRecordActions,\r\n transformResult: formConfig?.transformResult,\r\n collapse: {\r\n enabled: collapseEnabled,\r\n expandedByDefault: config.collapse?.expandedByDefault ?? true,\r\n collapseIcon: config.collapse?.collapseIcon ?? DEFAULT_COLLAPSE_ICON,\r\n expandIcon: config.collapse?.expandIcon ?? DEFAULT_EXPAND_ICON,\r\n },\r\n layout,\r\n };\r\n }\r\n\r\n private createItemKey(\r\n config: ClientListConfiguration,\r\n index: number,\r\n ): string {\r\n if (this.isInformativeConfig(config)) {\r\n return [\r\n 'informative',\r\n config.moduleId,\r\n config.instanceId ?? 'scope',\r\n this.serializeFilters(config.filters),\r\n index,\r\n ].join('-');\r\n }\r\n\r\n return [\r\n config.contextKey,\r\n config.instanceId ?? 'scope',\r\n this.serializeFilters(config.filters),\r\n config.areaType ?? DEFAULT_AREA_TYPE,\r\n index,\r\n ].join('-');\r\n }\r\n\r\n private resolveLayout(\r\n config: ClientListConfiguration,\r\n ): Required<ClientListLayoutConfig> {\r\n const hasStart = !!config.contentStart;\r\n const hasEnd = !!config.contentEnd;\r\n\r\n const startSpan = hasStart\r\n ? this.clampSpan(config.layout?.startSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\r\n : 0;\r\n let endSpan = hasEnd\r\n ? this.clampSpan(config.layout?.endSpan ?? DEFAULT_SIDE_CONTENT_SPAN)\r\n : 0;\r\n\r\n if (startSpan + endSpan >= DEFAULT_GRID_COLUMNS) {\r\n endSpan = Math.max(0, DEFAULT_GRID_COLUMNS - startSpan - 1);\r\n }\r\n\r\n const availableForTable = Math.max(\r\n 1,\r\n DEFAULT_GRID_COLUMNS - startSpan - endSpan,\r\n );\r\n const tableSpan = this.clampSpan(\r\n config.layout?.tableSpan ?? availableForTable,\r\n 1,\r\n availableForTable,\r\n );\r\n\r\n return {\r\n startSpan,\r\n tableSpan,\r\n endSpan,\r\n };\r\n }\r\n\r\n private resolveTableDisplayConfig(\r\n config: ClientListFormConfiguration | null,\r\n take: number,\r\n isPaginated: boolean,\r\n ) {\r\n const configuredPageSize = this.resolvePositiveInteger(\r\n config?.table?.pageSize,\r\n );\r\n\r\n return {\r\n pageSize: isPaginated\r\n ? take\r\n : (configuredPageSize ?? DEFAULT_TABLE_PAGE_SIZE),\r\n searchable: config?.table?.searchable ?? false,\r\n exportable: config?.table?.exportable ?? false,\r\n persistStateExclude: [\r\n ...(config?.table?.persistStateExclude ??\r\n DEFAULT_TABLE_PERSIST_STATE_EXCLUDE),\r\n ],\r\n };\r\n }\r\n\r\n private clampSpan(\r\n value: number | undefined,\r\n min = 0,\r\n max = DEFAULT_GRID_COLUMNS,\r\n ): number {\r\n const normalized = Number(value ?? min);\r\n if (!Number.isFinite(normalized)) return min;\r\n return Math.min(max, Math.max(min, Math.trunc(normalized)));\r\n }\r\n\r\n private resolvePositiveInteger(value: number | undefined): number | null {\r\n const normalized = Number(value);\r\n if (!Number.isFinite(normalized) || normalized <= 0) {\r\n return null;\r\n }\r\n\r\n return Math.trunc(normalized);\r\n }\r\n\r\n private resolveDefaultTake(): number {\r\n return (\r\n this.resolvePositiveInteger(this.defaultTake()) ??\r\n DEFAULT_SERVER_PAGE_SIZE\r\n );\r\n }\r\n\r\n private resolveNonNegativeInteger(value: number | undefined): number | null {\r\n const normalized = Number(value);\r\n if (!Number.isFinite(normalized) || normalized < 0) {\r\n return null;\r\n }\r\n\r\n return Math.trunc(normalized);\r\n }\r\n\r\n private cleanupStaleResources(activeKeys: Set<string>): void {\r\n for (const [key, sub] of this.subscriptions.entries()) {\r\n if (!activeKeys.has(key)) {\r\n sub.unsubscribe();\r\n this.subscriptions.delete(key);\r\n this.inFlightRequestSignatures.delete(key);\r\n this.fulfilledRequestSignatures.delete(key);\r\n }\r\n }\r\n\r\n for (const [key, sub] of this.recordSubscriptions.entries()) {\r\n if (!activeKeys.has(key)) {\r\n sub.unsubscribe();\r\n this.recordSubscriptions.delete(key);\r\n }\r\n }\r\n\r\n for (const key of this.runtimeFilters.keys()) {\r\n if (!activeKeys.has(key)) {\r\n this.runtimeFilters.delete(key);\r\n }\r\n }\r\n\r\n for (const key of this.requestPropertyKeys.keys()) {\r\n if (!activeKeys.has(key)) {\r\n this.requestPropertyKeys.delete(key);\r\n }\r\n }\r\n\r\n for (const key of this.rowActionsLoadingFnCache.keys()) {\r\n if (!activeKeys.has(key)) {\r\n this.rowActionsLoadingFnCache.delete(key);\r\n this.runtimeActions.invalidateList(key);\r\n }\r\n }\r\n }\r\n\r\n private notifyDataLoaded(key: string): void {\r\n const item = this.state.itemsByKey()[key];\r\n if (!item) {\r\n return;\r\n }\r\n\r\n this.maybeEagerLoadRuntimeActions(item);\r\n item.config.dataLoaded?.(this.templateContext(item));\r\n }\r\n\r\n private maybeEagerLoadRuntimeActions(item: ClientListState): void {\r\n const config = item.config.runtimeRecordActions;\r\n if (!config?.enabled || config.loadStrategy !== 'eager') return;\r\n if (item.type !== 'form' || item.areaType !== 'table') return;\r\n\r\n for (const row of item.rows) {\r\n const ctx = this.toRuntimeActionsContext(item, row, config);\r\n if (!ctx) continue;\r\n this.runtimeActions.request(config, ctx);\r\n }\r\n }\r\n\r\n private toTableQuery(\r\n config: NormalizedClientListConfiguration,\r\n skip: number,\r\n take: number,\r\n ): ClientListTableQuery {\r\n const queryTake =\r\n this.resolvePositiveInteger(take) ?? this.resolveDefaultTake();\r\n\r\n return {\r\n mode: config.mode,\r\n columnKeys: config.mode === 'override' ? config.columnKeys : undefined,\r\n skip: config.isPaginated ? skip : 0,\r\n take: queryTake,\r\n };\r\n }\r\n\r\n private createTableRequestSignature(\r\n config: NormalizedClientListConfiguration,\r\n query: ClientListTableQuery,\r\n filters: NormalizedClientListConfiguration['filters'],\r\n ): string {\r\n return [\r\n config.type,\r\n config.areaType,\r\n config.contextKey ?? 'x',\r\n this.serializeFilters(filters),\r\n query.mode,\r\n query.skip,\r\n query.take,\r\n ...(query.columnKeys ?? []),\r\n ].join('|');\r\n }\r\n\r\n private createCardsRequestSignature(\r\n config: NormalizedClientListConfiguration,\r\n filters: NormalizedClientListConfiguration['filters'],\r\n skip: number,\r\n take: number,\r\n ): string {\r\n return [\r\n config.type,\r\n config.areaType,\r\n config.contextKey ?? 'x',\r\n this.serializeFilters(filters),\r\n 'Card',\r\n config.isPaginated ? skip : 0,\r\n config.isPaginated ? take : 0,\r\n ].join('|');\r\n }\r\n\r\n private createInformativeRequestSignature(\r\n config: NormalizedClientListConfiguration,\r\n ): string {\r\n return [\r\n config.type,\r\n config.levelId ?? 'x',\r\n config.moduleId,\r\n this.serializeFilters(config.filters),\r\n 'dashboard',\r\n ].join('|');\r\n }\r\n\r\n private hasValidIdentifiers(\r\n config: NormalizedClientListConfiguration,\r\n ): boolean {\r\n if (config.type === 'informative') {\r\n return (\r\n config.levelId != null &&\r\n Number.isFinite(config.levelId) &&\r\n config.levelId > 0 &&\r\n Number.isFinite(config.moduleId) &&\r\n config.moduleId > 0\r\n );\r\n }\r\n\r\n return Boolean(config.contextKey?.trim());\r\n }\r\n\r\n private getMissingIdentifiersMessage(\r\n config: NormalizedClientListConfiguration,\r\n ): string {\r\n if (config.type === 'informative') {\r\n return this.transloco.translate(\r\n 'components.clientComponents.list.errors.missingModuleId',\r\n );\r\n }\r\n\r\n return this.transloco.translate(\r\n 'components.clientComponents.list.errors.missingContextKey',\r\n );\r\n }\r\n\r\n private isInformativeConfig(\r\n config: ClientListConfiguration,\r\n ): config is ClientListInformativeConfiguration {\r\n return config.type === 'informative';\r\n }\r\n\r\n private asInformativeConfig(\r\n config: ClientListConfiguration,\r\n ): ClientListInformativeConfiguration | null {\r\n return this.isInformativeConfig(config) ? config : null;\r\n }\r\n\r\n private asFormConfig(\r\n config: ClientListConfiguration,\r\n ): ClientListFormConfiguration | null {\r\n return this.isInformativeConfig(config) ? null : config;\r\n }\r\n\r\n private serializeFilters(\r\n filters: NormalizedClientListConfiguration['filters'] | undefined,\r\n ): string {\r\n return JSON.stringify(filters ?? []);\r\n }\r\n\r\n private resolveFetchFilters(\r\n key: string,\r\n config: NormalizedClientListConfiguration,\r\n ): NormalizedClientListConfiguration['filters'] {\r\n return mergeRuntimeFilters(\r\n config.filters,\r\n this.runtimeFilters.get(key),\r\n this.state.itemsByKey()[key]?.columns,\r\n );\r\n }\r\n}\r\n","<div class=\"flex flex-col gap-4\">\r\n @for (item of items(); track item.key) {\r\n <section class=\"flex flex-col gap-4\">\r\n @if (item.config.showHeader) {\r\n <div class=\"flex w-full items-center gap-2\">\r\n <div class=\"flex min-w-0 flex-1 items-center gap-2\">\r\n @if (item.config.collapse.enabled) {\r\n <mt-button\r\n variant=\"text\"\r\n severity=\"secondary\"\r\n [icon]=\"\r\n item.expanded\r\n ? item.config.collapse.collapseIcon\r\n : item.config.collapse.expandIcon\r\n \"\r\n (onClick)=\"toggleExpanded(item.key)\"\r\n />\r\n }\r\n <h3 class=\"m-0 text-lg font-semibold\">\r\n {{ item.title || item.moduleKey || defaultTitle(item) }}\r\n </h3>\r\n @if (item.config.headerStart) {\r\n <div class=\"flex items-center gap-2\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.headerStart\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n @if (item.config.headerEnd) {\r\n <div class=\"ml-auto flex shrink-0 items-center gap-2\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.headerEnd\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n </div>\r\n }\r\n </div>\r\n }\r\n\r\n @if (item.expanded || !item.config.collapse.enabled) {\r\n @if (item.config.templateContent) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"item.config.templateContent\"\r\n [ngTemplateOutletContext]=\"templateContext(item)\"\r\n />\r\n } @else if (item.type === \"informative\") {\r\n <mt-client-list-informative-view [state]=\"item\" />\r\n } @else if (item.areaType === \"table\") {\r\n <mt-client-list-table-view\r\n [state]=\"item\"\r\n [rowActions]=\"rowActionsFor(item)\"\r\n [actionShape]=\"item.config.actionShape\"\r\n [rowActionsLoadingFn]=\"rowActionsLoadingFnFor(item)\"\r\n (rowActionsRequested)=\"onRowActionsRequested(item, $event)\"\r\n (lazyLoad)=\"onLazyLoad(item.key, $event)\"\r\n (rowClick)=\"onTableRowClick(item, $event)\"\r\n />\r\n } @else {\r\n <mt-client-list-cards-view\r\n [state]=\"item\"\r\n [rowActions]=\"rowActionsFor(item)\"\r\n [rowActionsLoadingFn]=\"rowActionsLoadingFnFor(item)\"\r\n (rowActionsRequested)=\"onRowActionsRequested(item, $event)\"\r\n (lazyLoad)=\"onLazyLoad(item.key, $event)\"\r\n (loadMore)=\"loadMoreCards(item.key)\"\r\n (cardClick)=\"onCardClick(item, $event)\"\r\n />\r\n }\r\n }\r\n </section>\r\n }\r\n</div>\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport *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