@mintplayer/ng-spark 22.2.0 → 22.4.0

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.
Files changed (28) hide show
  1. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +78 -4
  2. package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
  3. package/fesm2022/mintplayer-ng-spark-grid.mjs +860 -0
  4. package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -0
  5. package/fesm2022/mintplayer-ng-spark-models.mjs +160 -1
  6. package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
  7. package/fesm2022/mintplayer-ng-spark-pipes.mjs +31 -5
  8. package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
  9. package/fesm2022/mintplayer-ng-spark-po-create.mjs +2 -2
  10. package/fesm2022/mintplayer-ng-spark-po-create.mjs.map +1 -1
  11. package/fesm2022/mintplayer-ng-spark-po-detail.mjs +36 -153
  12. package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
  13. package/fesm2022/mintplayer-ng-spark-po-edit.mjs +2 -2
  14. package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
  15. package/fesm2022/mintplayer-ng-spark-po-form.mjs +4 -4
  16. package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
  17. package/fesm2022/mintplayer-ng-spark-query-list.mjs +148 -277
  18. package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
  19. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +5 -3
  20. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
  21. package/fesm2022/mintplayer-ng-spark.mjs +1 -1
  22. package/fesm2022/mintplayer-ng-spark.mjs.map +1 -1
  23. package/package.json +6 -2
  24. package/types/mintplayer-ng-spark-client-operations.d.ts +39 -4
  25. package/types/mintplayer-ng-spark-grid.d.ts +499 -0
  26. package/types/mintplayer-ng-spark-models.d.ts +74 -3
  27. package/types/mintplayer-ng-spark-po-detail.d.ts +19 -31
  28. package/types/mintplayer-ng-spark-query-list.d.ts +56 -36
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mintplayer-ng-spark-grid.mjs","sources":["../../grid/src/spark-grid-columns.ts","../../grid/src/spark-grid-renderers.ts","../../grid/src/spark-query-slots.ts","../../grid/src/spark-grid-cell.component.ts","../../grid/src/spark-grid-cell.component.html","../../grid/src/spark-query-grid.component.ts","../../grid/src/spark-query-grid.component.html","../../grid/src/spark-query-card.component.ts","../../grid/src/spark-query-card.component.html","../../grid/mintplayer-ng-spark-grid.ts"],"sourcesContent":["import { DatatableSettings } from '@mintplayer/ng-bootstrap/datatable';\nimport { SortColumn } from '@mintplayer/pagination';\nimport {\n EntityAttributeDefinition,\n EntityType,\n ShowedOn,\n SparkQuery,\n hasShowedOnFlag,\n} from '@mintplayer/ng-spark/models';\n\n/** Page sizes offered by every Spark grid. */\nexport const SPARK_GRID_PAGE_SIZES = [10, 25, 50];\n\n/**\n * The attributes a grid shows, in display order.\n *\n * Shared so the two grids cannot disagree about what \"visible\" means — they each had their own\n * copy of this expression, which is the kind of thing that stays identical right up until it\n * doesn't.\n */\nexport function visibleGridAttributes(entityType: EntityType | null): EntityAttributeDefinition[] {\n return entityType?.attributes\n .filter(a => a.isVisible && hasShowedOnFlag(a.showedOn, ShowedOn.Query))\n .sort((a, b) => a.order - b.order) ?? [];\n}\n\n/**\n * Initial datatable settings for a query, seeded with the query's declared sort.\n *\n * The datatable owns paging and sorting from here on and calls the fetch callback per page; this\n * only decides where it starts.\n */\nexport function initialGridSettings(query: SparkQuery | null): DatatableSettings {\n // Nullable because one caller resolves its query from a route param and may not have one yet;\n // an unsorted grid is the right fallback, not a crash.\n const sortColumns: SortColumn[] = (query?.sortColumns || []).map(sc => ({\n property: sc.property,\n direction: sc.direction === 'desc' ? 'descending' as const : 'ascending' as const,\n }));\n\n return new DatatableSettings({\n perPage: { values: SPARK_GRID_PAGE_SIZES, selected: SPARK_GRID_PAGE_SIZES[0] },\n page: { values: [1], selected: 1 },\n sortColumns,\n });\n}\n\n/** Whether a query renders as a virtual-scrolling grid rather than a paged one. */\nexport function isVirtualScrollingQuery(query: SparkQuery | null): boolean {\n return query?.renderMode === 'VirtualScrolling';\n}\n","import { inject, Injectable, Type } from '@angular/core';\nimport {\n EntityAttributeDefinition,\n LookupReference,\n PersistentObject,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_ATTRIBUTE_RENDERERS, rendererValue, withDeclaredInputs } from '@mintplayer/ng-spark/renderers';\nimport { SparkService } from '@mintplayer/ng-spark/services';\n\n/**\n * Renderer lookup and lookup-reference loading for a Spark grid.\n *\n * This was extracted when `spark-query-list` and `spark-sub-query` were two components holding\n * byte-identical copies of it — around 120 lines between them. That duplication was not a\n * tidiness complaint: it produced drift. The two copies disagreed about `[indeterminate]`, about\n * resetting permission state, about whether a fetch failure surfaces or is swallowed, and about\n * virtual-scroll sizing — four user-visible bugs, each fixed on one side and not the other.\n *\n * There is now one grid, {@link SparkQueryGridComponent}, so the drift cannot recur. This stays\n * separate because it is stateless service-shaped logic rather than view state, and because it is\n * what a custom grid would need in order to render Spark cells at all.\n *\n * The constraint that shaped the split still holds and is why the grid takes rows as an input\n * rather than owning a socket: streaming's dependency graph must not reach the bundle of every\n * detail page.\n */\n@Injectable({ providedIn: 'root' })\nexport class SparkGridRenderers {\n private readonly registry = inject(SPARK_ATTRIBUTE_RENDERERS);\n private readonly sparkService = inject(SparkService);\n\n /** The registered column component for an attribute, or null to fall back to the default cell. */\n columnComponentFor(attr: EntityAttributeDefinition): Type<any> | null {\n if (!attr.renderer) return null;\n return this.registry.find(r => r.name === attr.renderer)?.columnComponent ?? null;\n }\n\n /**\n * Inputs for a column renderer, filtered to what the component actually declares —\n * `NgComponentOutlet` throws on an input the target does not have, which is what lets every\n * member of the renderer contract be optional.\n */\n columnInputsFor(component: Type<any>, item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any> {\n const itemAttr = item.attributes.find(a => a.name === attr.name);\n return this.cellInputsFor(component, rendererValue(itemAttr), attr, item);\n }\n\n /**\n * The same contract for a row that is not a <see cref=\"PersistentObject\"/>.\n *\n * An AsDetail row is a plain dictionary — embedded values with no id and no attribute list — so\n * its value cannot be read the way {@link columnInputsFor} reads one. Only the extraction\n * differs; the renderer contract is identical, and stating it once is what stops the two from\n * drifting the way the cell markup already had.\n */\n cellInputsFor(component: Type<any>, value: unknown, column: EntityAttributeDefinition, item: unknown): Record<string, any> {\n return withDeclaredInputs(component, {\n value,\n attribute: column,\n options: column.rendererOptions,\n item,\n });\n }\n\n /**\n * Loads every lookup reference the visible attributes need, in one pass.\n *\n * Returns an empty map rather than throwing when there are none, so callers never branch on it.\n */\n async loadLookupOptions(attributes: EntityAttributeDefinition[]): Promise<Record<string, LookupReference>> {\n const lookupAttrs = attributes.filter(a => a.lookupReferenceType);\n if (lookupAttrs.length === 0) return {};\n\n const names = [...new Set(lookupAttrs.map(a => a.lookupReferenceType!))];\n const entries = await Promise.all(\n names.map(async name => [name, await this.sparkService.getLookupReference(name)] as const),\n );\n return entries.reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {} as Record<string, LookupReference>);\n }\n}\n","import { Directive, inject, input, TemplateRef } from '@angular/core';\nimport { CustomActionDefinition, PersistentObject, SparkQuery } from '@mintplayer/ng-spark/models';\n\n/**\n * Header slots for `<spark-query-card>`.\n *\n * Each directive marks a template that REPLACES one region of the card header. Supplying one\n * leaves the other two alone — that is the whole point of having three rather than the single\n * whole-header template they replace, where changing the icon meant re-implementing the caption\n * and the action bar as well.\n *\n * An omitted slot is not an empty slot: the card renders its default. This is what keeps the\n * auto-rendered sub-query working. A sub-query is rendered from `EntityTypeDefinition.Queries`\n * with no host to project into, so a mechanism that only ever REPLACED chrome would leave that\n * call site with nothing — which is why an earlier design had the query declare its own chrome\n * server-side. Overriding a default needs no host; replacing one does.\n *\n * The two ends of that are visible in the defaults themselves. Neither `SparkQuery` nor\n * `EntityType` carries an icon, so the server has nothing to say and the slot is the only\n * source. Actions are the mirror image: the server declares them per type, so the default is\n * the real answer and the slot is a rare override.\n *\n * Naming follows ng-bootstrap's `*bsDatatableColumn` convention — prefix, component, slot —\n * with `spark`, since these are ng-spark directives and `bs` is another package's prefix. These\n * are the first attribute directives in ng-spark; every existing selector is an element.\n *\n * ## Targeting one query\n *\n * Each slot takes an optional query alias or id as its value. A detail page renders one card per\n * entry in `EntityTypeDefinition.Queries`, so a host that supplies a bare slot would decorate\n * every one of them identically — rarely what is wanted. A targeted slot applies to that query;\n * an untargeted one is the fallback for the rest.\n *\n * ```html\n * <span *sparkQueryIcon=\"'cars'\"><spark-icon name=\"car-front\" /></span>\n * <span *sparkQueryIcon><spark-icon name=\"table\" /></span>\n * ```\n *\n * Matching is case-insensitive, against the query's alias and then its id. This is the\n * `bsPriorityNavItem` shape: a value input aliased to the selector, collected with\n * `contentChildren`.\n */\n\n/** Resolves a slot list to the one that applies to a query: targeted first, then untargeted. */\nexport function slotFor<T extends { forQuery: () => string }>(\n slots: readonly T[],\n query: SparkQuery | null,\n): T | null {\n if (!slots.length) return null;\n\n const matches = (target: string) =>\n !!target && (\n target.localeCompare(query?.alias ?? '', undefined, { sensitivity: 'accent' }) === 0 ||\n target.localeCompare(query?.id ?? '', undefined, { sensitivity: 'accent' }) === 0);\n\n // A targeted slot wins over the catch-all even when it is declared later: \"this one query\"\n // is the more specific statement, and declaration order in a template is not a priority.\n return slots.find(s => matches(s.forQuery())) ?? slots.find(s => !s.forQuery()) ?? null;\n}\n\n/**\n * The icon at the header's leading edge. No default: nothing in the model describes one.\n *\n * ```html\n * <spark-query-card [queryId]=\"'cars'\">\n * <spark-icon *sparkQueryIcon name=\"car-front\" />\n * </spark-query-card>\n * ```\n */\n@Directive({ selector: '[sparkQueryIcon]' })\nexport class SparkQueryIconDirective {\n readonly templateRef = inject<TemplateRef<SparkQuerySlotContext>>(TemplateRef);\n\n /** Query alias or id this slot applies to. Empty targets every query on the page. */\n readonly forQuery = input('', { alias: 'sparkQueryIcon' });\n\n static ngTemplateContextGuard(\n _dir: SparkQueryIconDirective,\n ctx: unknown,\n ): ctx is SparkQuerySlotContext {\n return true;\n }\n}\n\n/**\n * The header caption. Defaults to the query's translated description, falling back to its name.\n *\n * The context carries that resolved default as `$implicit`, so a host can decorate it — add a\n * count, a badge — without re-resolving the translation itself.\n */\n@Directive({ selector: '[sparkQueryCaption]' })\nexport class SparkQueryCaptionDirective {\n readonly templateRef = inject<TemplateRef<SparkQueryCaptionContext>>(TemplateRef);\n\n readonly forQuery = input('', { alias: 'sparkQueryCaption' });\n\n static ngTemplateContextGuard(\n _dir: SparkQueryCaptionDirective,\n ctx: unknown,\n ): ctx is SparkQueryCaptionContext {\n return true;\n }\n}\n\n/**\n * The buttons at the header's trailing edge. Defaults to the server-declared custom actions.\n *\n * The context carries those actions and the current selection, so a host that wants its own\n * buttons ALONGSIDE the server's can render both rather than choosing. Without that, overriding\n * this slot to add one button would silently drop every action the type declares — and the\n * server's actions are the ones carrying `selectionRule` and the permission filter.\n *\n * ```html\n * <ng-container *sparkQueryActions=\"let actions; selection as rows\">\n * <button (click)=\"export(rows)\">Export</button>\n * </ng-container>\n * ```\n */\n@Directive({ selector: '[sparkQueryActions]' })\nexport class SparkQueryActionsDirective {\n readonly templateRef = inject<TemplateRef<SparkQueryActionsContext>>(TemplateRef);\n\n readonly forQuery = input('', { alias: 'sparkQueryActions' });\n\n static ngTemplateContextGuard(\n _dir: SparkQueryActionsDirective,\n ctx: unknown,\n ): ctx is SparkQueryActionsContext {\n return true;\n }\n}\n\n/** Context for the icon slot: the query whose card is being rendered. */\nexport class SparkQuerySlotContext {\n $implicit: SparkQuery | null = null;\n}\n\nexport class SparkQueryCaptionContext {\n /** The caption the card would have rendered: description, or the query name. */\n $implicit = '';\n query: SparkQuery | null = null;\n}\n\nexport class SparkQueryActionsContext {\n /** The custom actions the card would have rendered, already filtered for this query. */\n $implicit: CustomActionDefinition[] = [];\n /** Rows currently ticked. Empty unless an action is selection-gated. */\n selection: PersistentObject[] = [];\n query: SparkQuery | null = null;\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { CommonModule, NgComponentOutlet } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport { EntityAttributeDefinition } from '@mintplayer/ng-spark/models';\nimport { ReferenceChip } from '@mintplayer/ng-spark/pipes';\nimport { SparkGridRenderers } from './spark-grid-renderers';\n\n/**\n * One cell of a Spark table, wherever that table is.\n *\n * ## Why this exists\n *\n * The cell markup was written out three times: twice in the query grids (since merged into\n * {@link SparkQueryGridComponent}) and once more in the AsDetail table on the PO detail page. The\n * third copy was never counted, and it had already drifted — a `boolean` column rendered the text\n * `\"true\"` there while the grid rendered a checkbox, a `color` rendered its hex string rather than\n * a swatch, and a custom renderer was dispatched by a second, hand-copied lookup.\n *\n * ## What it does and does not own\n *\n * It owns **presentation**: which control a `dataType` becomes, and dispatching a declared custom\n * renderer. It does not own **value resolution**, and deliberately so — the two callers read from\n * genuinely different row models. A query row is a `PersistentObject` with an attribute list and\n * an id; an AsDetail row is a plain dictionary of embedded values with neither. Trying to unify\n * that would put a second row-access path inside this component and buy nothing.\n *\n * So the caller resolves the value with whichever pipe fits its row model, and passes the result.\n *\n * ## The two links are not the same link, and only one is here\n *\n * `link` is for a cell whose own value points at another entity — an AsDetail reference column.\n * The query grid's first-column link is a different rule (it points at the row's own detail page,\n * gated on `Read`), and it stays in the grid, wrapping this component. Passing both would nest\n * anchors, which is invalid HTML; the grid therefore leaves `link` unset.\n */\n@Component({\n selector: 'spark-grid-cell',\n imports: [CommonModule, NgComponentOutlet, RouterModule],\n templateUrl: './spark-grid-cell.component.html',\n styleUrl: './spark-grid-cell.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparkGridCellComponent {\n private readonly renderers = inject(SparkGridRenderers);\n\n /** The column being rendered. Its `dataType` and `renderer` decide everything below. */\n column = input.required<EntityAttributeDefinition>();\n\n /**\n * What the caller's value pipe produced: the display text for most columns, and the raw value\n * for `boolean` and `color`, which need the value rather than a rendering of it.\n */\n display = input<unknown>(null);\n\n /**\n * The value handed to a declared custom renderer.\n *\n * Separate from {@link display} because they are not the same thing: a renderer receives the\n * underlying value — for AsDetail, the nested object itself — while `display` has already been\n * flattened to something printable.\n */\n rendererValue = input<unknown>(null);\n\n /** The row, passed through to a custom renderer as `item`. */\n item = input<unknown>(null);\n\n /**\n * Pre-resolved chips for a reference-array column, or empty when the column is not one.\n *\n * Resolved by the caller because the label source differs: a query row carries a per-id\n * breadcrumb map, while an AsDetail row's `__sparkBreadcrumbs` is keyed by column name only and\n * so cannot label the members of an array. Rather than render a row of raw ids, an AsDetail\n * caller passes nothing and the cell falls through to text.\n */\n chips = input<ReferenceChip[]>([]);\n\n /** Route for a cell whose value references another entity. See the class comment. */\n link = input<unknown[] | null>(null);\n\n protected readonly rendererComponent = computed(() => this.renderers.columnComponentFor(this.column()));\n\n protected readonly rendererInputs = computed(() => {\n const component = this.rendererComponent();\n return component\n ? this.renderers.cellInputsFor(component, this.rendererValue(), this.column(), this.item())\n : {};\n });\n\n /** Null and undefined are distinct from `false` here — see the template. */\n protected readonly isUnsetBoolean = computed(() => this.display() == null);\n}\n","@if (rendererComponent(); as rendererType) {\n <ng-container *ngComponentOutlet=\"rendererType; inputs: rendererInputs()\"></ng-container>\n} @else if (column().dataType === 'boolean') {\n <!-- [indeterminate] matters: without it a null boolean renders as an unchecked box, which reads\n as an explicit `false`. One of the three copies of this cell bound it and the others had\n drifted, so the same column said different things on a detail page and in a grid. -->\n <input type=\"checkbox\"\n [checked]=\"display() === true\"\n [indeterminate]=\"isUnsetBoolean()\"\n disabled\n onclick=\"return false;\">\n} @else if (column().dataType === 'color') {\n @if (display(); as colorVal) {\n <!-- Inline on purpose, and it is not a style-guide slip. In a query grid this cell is\n rendered INSIDE <mp-datatable>'s shadow root, which does not see document\n stylesheets: neither this component's scoped rules nor Bootstrap utilities apply\n there. Inline styles do. Measured 2026-08-23 -- see the comment in the .scss. -->\n <span class=\"d-inline-block align-middle border rounded\"\n [style.background-color]=\"colorVal\"\n style=\"width: 1.5em; height: 1.5em;\"></span>\n }\n} @else if (chips().length) {\n <span class=\"d-inline-flex flex-wrap gap-1\">\n @for (chip of chips(); track chip.id) {\n <span class=\"spark-chip\">{{ chip.label }}</span>\n }\n </span>\n} @else if (link(); as route) {\n <a [routerLink]=\"route\">{{ display() }}</a>\n} @else {\n {{ display() }}\n}\n","import { ChangeDetectionStrategy, Component, computed, effect, inject, input, model, output, signal, untracked, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { RouterModule } from '@angular/router';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, DatatableSettings, type BsDatatableFetch } from '@mintplayer/ng-bootstrap/datatable';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { SparkQueryRefreshService } from '@mintplayer/ng-spark/client-operations';\nimport { rendererValue } from '@mintplayer/ng-spark/renderers';\nimport { AttributeValuePipe, ReferenceChipsPipe, ResolveTranslationPipe, TranslateKeyPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkLanguageService, SparkService } from '@mintplayer/ng-spark/services';\nimport {\n CustomActionDefinition,\n EntityAttributeDefinition,\n EntityType,\n LookupReference,\n PersistentObject,\n SparkQuery,\n filterQueryActions,\n parseSelectionRule,\n selectionModeFor,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_GRID_PAGE_SIZES, initialGridSettings, isVirtualScrollingQuery, visibleGridAttributes } from './spark-grid-columns';\nimport { SparkGridRenderers } from './spark-grid-renderers';\nimport { SparkGridCellComponent } from './spark-grid-cell.component';\n\n/**\n * The one Spark grid: a `<bs-datatable>` rendering a query or a sub-query.\n *\n * This replaces two components that were the same grid written twice — and, counting\n * `spark-query-list`'s streaming and paged branches, the `<bs-datatable>` element itself written\n * three times. The duplication had already produced four user-visible bugs, each fixed on one\n * side and not the other: `[indeterminate]` on null booleans, permission state surviving a failed\n * reload, a swallowed fetch failure, and virtual-scroll sizing. `SparkGridRenderers` was\n * extracted to stop that and could only take the stateless helpers with it; this takes the rest.\n *\n * ## What it deliberately does NOT own: streaming\n *\n * `spark-grid-renderers.ts` records why — a websocket dependency graph must not reach the bundle\n * of every PO detail page, none of which stream. So rows can come from **either** side:\n *\n * - unbound `data` — the grid fetches for itself, paging and sorting server-side;\n * - bound `data` — the grid renders what it is given and never fetches.\n *\n * `spark-query-list` keeps the socket and feeds its snapshot in. This is the line `bs-datatable`\n * itself draws: `[data]` and `[fetch]` are mutually exclusive, and binding both makes `[fetch]`\n * win silently.\n *\n * ## Reading its state\n *\n * `query`, `entityType`, `customActions`, `selection`, `canRead`, `canCreate` and `resultCount`\n * are readable so a host can render chrome around the grid. Read them through a template\n * reference variable — `<spark-query-grid #grid>` … `grid.query()` — not `viewChild`: hosts wrap\n * grids in `@if`, where a `viewChild` is intermittently undefined.\n */\n@Component({\n selector: 'spark-query-grid',\n imports: [CommonModule, RouterModule, BsAlertComponent, BsDatatableComponent, BsDatatableColumnDirective, BsRowTemplateDirective, BsSpinnerComponent, SparkGridCellComponent, ResolveTranslationPipe, AttributeValuePipe, ReferenceChipsPipe, TranslateKeyPipe],\n templateUrl: './spark-query-grid.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparkQueryGridComponent {\n private readonly sparkService = inject(SparkService);\n private readonly gridRenderers = inject(SparkGridRenderers);\n private readonly queryRefresh = inject(SparkQueryRefreshService);\n readonly lang = inject(SparkLanguageService);\n\n /** Query alias or id. */\n queryId = input.required<string>();\n\n /**\n * The parent persistent object this query is scoped to, when it has one.\n *\n * Optional, because not every query is a detail of something: a page can host a grid that\n * stands on its own — \"my accounts\", a dashboard list — and the server already treats an absent\n * parent as \"no parent\" rather than as an error. Requiring these made that shape impossible to\n * express: the component simply never loaded, with no request, no error and no log.\n *\n * Pass both or neither. One without the other is ignored, matching `SparkService.executeQuery`,\n * which omits either param when it is falsy, and the execute endpoint, which resolves a parent\n * only when both are present.\n */\n parentId = input<string>('');\n parentType = input<string>('');\n\n /**\n * Rows supplied from outside. When bound, the grid renders these and runs no fetch.\n *\n * This is how streaming stays out of this component (see the class comment). `null` — the\n * default — means \"fetch for yourself\"; an empty array means \"you have been given no rows\",\n * which is a different statement and renders an empty grid rather than triggering a load.\n */\n data = input<PersistentObject[] | null>(null);\n\n /**\n * Server-side search term, passed through to the query.\n *\n * An input rather than a box, so the host owns the control and the grid owns the request. A\n * host with client-side rows filters them itself before binding `data`.\n */\n search = input<string>('');\n\n /**\n * Change this to re-run the query. Any value works; only its identity matters.\n *\n * A declarative token rather than only a `reload()` method, because calling a method means\n * holding a component handle, and hosts wrap this grid in `@if`, where a `viewChild` is\n * intermittently undefined.\n *\n * This drives the CHEAP refresh (see {@link reload}). It deliberately does not feed the main\n * effect: re-running `loadData` would re-resolve the query, the entity types, the permissions\n * and the lookups, and reset the user's page and sort on every button press.\n */\n reloadToken = input<unknown>(null);\n\n /**\n * Paging and sorting. Two-way, so a host driving `data` can sort those rows by whatever the\n * user actually clicked — the datatable writes the new sort back through here.\n */\n settings = model(new DatatableSettings({\n perPage: { values: SPARK_GRID_PAGE_SIZES, selected: SPARK_GRID_PAGE_SIZES[0] },\n page: { values: [1], selected: 1 },\n sortColumns: [],\n }));\n\n /** Rows the user has ticked. Two-way so chrome outside the grid can read and clear them. */\n selection = model<PersistentObject[]>([]);\n\n /** Emitted whenever a load or a page fetch fails, for a host in bespoke chrome. */\n error = output<HttpErrorResponse>();\n rowClicked = output<PersistentObject>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n\n query = signal<SparkQuery | null>(null);\n entityType = signal<EntityType | null>(null);\n allEntityTypes = signal<EntityType[]>([]);\n lookupReferenceOptions = signal<Record<string, LookupReference>>({});\n loading = signal(true);\n canRead = signal(false);\n canCreate = signal(false);\n resultCount = signal<number | null>(null);\n customActions = signal<CustomActionDefinition[]>([]);\n fetchFn = signal<BsDatatableFetch<PersistentObject> | null>(null);\n\n /**\n * Why the component renders its own failure instead of only reporting one.\n *\n * `SparkService` is a bare `firstValueFrom` passthrough with no interceptor, so every failure\n * surfaces here and nowhere else. A host embedding this grid cannot surface what it never sees,\n * and the default has to be visible with no host cooperation — hence a rendered alert, not just\n * an output.\n */\n errorMessage = signal<string | null>(null);\n\n /** 'none' unless an action is selection-gated, so unaffected grids gain no checkbox column. */\n selectionMode = computed(() => selectionModeFor(this.customActions()));\n\n isVirtualScrolling = computed(() => isVirtualScrollingQuery(this.query()));\n\n visibleAttributes = computed(() => visibleGridAttributes(this.entityType()));\n\n /**\n * True when rows do not come from this component's own fetch.\n *\n * Either because the host bound `data`, or because the query streams — a streaming query's rows\n * arrive over a socket and `/execute` is not a way to get them. The grid recognises the second\n * case itself rather than waiting to be told, because it resolves the query before the host can\n * see it: left to `data` alone, every streaming grid would fire one pointless fetch on mount,\n * before the host had anything to bind.\n */\n hasExternalData = computed(() =>\n this.data() !== null || this.query()?.isStreamingQuery === true);\n\n /** Whether an action's selection rule is satisfied right now. The server checks it again. */\n isActionEnabled(action: CustomActionDefinition): boolean {\n return parseSelectionRule(action.selectionRule)(this.selection().length);\n }\n\n constructor() {\n effect(() => {\n const qId = this.queryId();\n const pId = this.parentId();\n const pType = this.parentType();\n // Only the query id is required. Requiring a parent here is what made a standalone grid\n // silently render nothing.\n if (qId) {\n this.loadData(qId, pId, pType);\n } else {\n // No query id at all. `loading` starts true, so without this the component would spin\n // forever instead of saying anything.\n this.loading.set(false);\n }\n });\n\n // Separate effect, so the token drives the cheap refresh and never the full metadata reload.\n // `first` skips the initial run: the effect above has already fetched, and reacting to the\n // token's starting value would double-fetch on mount.\n let first = true;\n effect(() => {\n // Both the host's token and the server's refreshQuery drive the same cheap refresh.\n this.reloadToken();\n this.queryRefresh.tokenFor(this.queryId());\n if (first) { first = false; return; }\n untracked(() => this.reload());\n });\n\n // A new search term must refetch even when page, perPage and sort are unchanged — the\n // datatable dedupes reloads by exactly that triple, and a new fetch identity is what resets\n // its dedupe key. Skipping the first run keeps mount to a single request.\n let firstSearch = true;\n effect(() => {\n this.search();\n if (firstSearch) { firstSearch = false; return; }\n untracked(() => this.onSearchChanged());\n });\n }\n\n /**\n * Re-run the query, keeping the current page, sort and scroll position.\n *\n * Data-level on purpose: it re-seeds the fetch closure and nothing else. For a definition\n * change — new columns, a renamed query — the inputs themselves must change; that is the\n * expensive path. Inert when rows come from the host: there is nothing here to re-run.\n */\n reload(): void {\n if (this.hasExternalData()) return;\n const q = this.query();\n if (q) this.fetchFn.set(this.makeFetch(q, this.parentId(), this.parentType()));\n }\n\n private onSearchChanged(): void {\n if (this.hasExternalData()) return;\n const s = this.settings();\n // Back to page 1: the old page number means nothing against a different result set.\n this.settings.set(new DatatableSettings({\n perPage: { values: s.perPage.values, selected: s.perPage.selected },\n page: { values: [1], selected: 1 },\n sortColumns: s.sortColumns,\n }));\n this.reload();\n }\n\n async onCustomAction(action: CustomActionDefinition): Promise<void> {\n if (action.confirmationMessageKey) {\n const message = this.lang.t(action.confirmationMessageKey) || 'Are you sure?';\n if (!confirm(message)) return;\n }\n try {\n await this.sparkService.executeCustomAction(this.entityType()!.id, action.name, undefined, this.selection());\n this.customActionExecuted.emit({ action });\n if (action.refreshOnCompleted) this.reload();\n } catch (e) {\n const err = e as HttpErrorResponse;\n this.errorMessage.set(err.error?.error || err.message || this.lang.t('common.actionFailed') || 'Action failed');\n }\n }\n\n private reportError(err: HttpErrorResponse): void {\n this.errorMessage.set(this.describe(err));\n this.error.emit(err);\n }\n\n /**\n * A 404 is deliberately generic.\n *\n * `Endpoints/Queries/Get.cs` answers 404 with byte-identical bodies for \"no such query\" and\n * \"you may not see it\", so existence is not disclosed (security audit M-3). The component\n * therefore genuinely cannot tell them apart, and both \"Not found\" and \"Access denied\" would be\n * a guess — one of them leaking, the other misleading.\n */\n private describe(err: HttpErrorResponse): string {\n if (err?.status === 404) {\n return this.lang.t('spark.query.unavailable') || 'This list is not available.';\n }\n return err?.error?.error || err?.message\n || this.lang.t('common.unexpectedError') || 'An unexpected error occurred';\n }\n\n private async loadData(queryId: string, parentId: string, parentType: string): Promise<void> {\n this.loading.set(true);\n this.errorMessage.set(null);\n this.fetchFn.set(null);\n // Reset everything derived from the previous query, not just the fetch. Leaving\n // `entityType`/`canRead` behind let a failed reload build a row link out of the PREVIOUS type\n // and the previous permission.\n this.query.set(null);\n this.entityType.set(null);\n this.canRead.set(false);\n this.canCreate.set(false);\n this.customActions.set([]);\n this.resultCount.set(null);\n // Ids from the previous query are meaningless against the next one, and would be POSTed as\n // though they belonged to it.\n this.selection.set([]);\n try {\n const [resolvedQuery, entityTypes] = await Promise.all([\n this.sparkService.getQuery(queryId),\n this.sparkService.getEntityTypes(),\n ]);\n\n this.query.set(resolvedQuery);\n this.allEntityTypes.set(entityTypes);\n\n const et = this.resolveEntityType(resolvedQuery, entityTypes);\n this.entityType.set(et);\n if (et) {\n const [permissions, actions] = await Promise.all([\n this.sparkService.getPermissions(et.id),\n this.sparkService.getCustomActions(et.id),\n ]);\n this.canRead.set(permissions.canRead);\n this.canCreate.set(permissions.canCreate);\n // 'query', not 'list'. The server model has always documented \"detail\" | \"query\" |\n // \"both\"; a filter testing for a value nothing emits renders the action NOWHERE.\n this.customActions.set(filterQueryActions(actions));\n }\n\n this.settings.set(initialGridSettings(resolvedQuery));\n // The datatable drives paging/sorting via [(settings)] and calls fetchFn per page. Virtual\n // scrolling is just the [virtualScroll] template flag.\n // `resolvedQuery`, not `hasExternalData()`: the query signal is set above, but reading the\n // computed here would depend on signal-read ordering inside an async method. Ask the value\n // directly.\n if (this.data() === null && !resolvedQuery?.isStreamingQuery) {\n this.fetchFn.set(this.makeFetch(resolvedQuery, parentId, parentType));\n }\n\n this.loadLookupReferenceOptions();\n } catch (e) {\n this.fetchFn.set(null);\n this.reportError(e as HttpErrorResponse);\n } finally {\n this.loading.set(false);\n }\n }\n\n /**\n * The query's entity type.\n *\n * The source-name fallback is not optional garnish: a `Database.*` query need not declare\n * `entityType`, and the sub-query grid — which matched on the declared name alone — rendered\n * those as an empty card with no columns, no rows and no error, while the identical query\n * rendered correctly as a page. Both grids are this one now, so there is one answer.\n */\n private resolveEntityType(query: SparkQuery | null, entityTypes: EntityType[]): EntityType | null {\n if (!query) return null;\n\n if (query.entityType) {\n return entityTypes.find(t =>\n t.name === query.entityType || t.alias === query.entityType?.toLowerCase()) ?? null;\n }\n\n const sourceName = extractSourceName(query.source);\n const singular = singularize(sourceName);\n return entityTypes.find(t =>\n t.name === sourceName || t.name === singular || t.clrType.endsWith(singular)) ?? null;\n }\n\n private makeFetch(query: SparkQuery, parentId: string, parentType: string): BsDatatableFetch<PersistentObject> {\n return (req) => this.sparkService.executeQuery(query.id, {\n sortColumns: req.sortColumns,\n skip: (req.page - 1) * req.perPage,\n take: req.perPage,\n search: this.search() || undefined,\n parentId, parentType,\n }).then(r => {\n this.errorMessage.set(null);\n this.resultCount.set(r.totalRecords);\n return {\n data: r.data,\n totalRecords: r.totalRecords,\n totalPages: Math.ceil(r.totalRecords / req.perPage) || 1,\n perPage: req.perPage,\n page: req.page,\n };\n }).catch((e: HttpErrorResponse) => {\n // Report before returning the empty page, or a failed fetch is indistinguishable from a\n // query that legitimately has no rows.\n this.reportError(e);\n this.resultCount.set(0);\n return { data: [], totalRecords: 0, totalPages: 1, perPage: req.perPage, page: req.page };\n });\n }\n\n private async loadLookupReferenceOptions(): Promise<void> {\n this.lookupReferenceOptions.set(await this.gridRenderers.loadLookupOptions(this.visibleAttributes()));\n }\n\n /**\n * The underlying value a custom renderer receives, which is not the printable one.\n *\n * `rendererValue` unwraps an AsDetail attribute to the nested object (or objects) rather than\n * flattening it to text — a renderer for a nested type needs the object, not a summary of it.\n */\n rendererValueFor(item: PersistentObject, attr: EntityAttributeDefinition): unknown {\n return rendererValue(item.attributes.find(a => a.name === attr.name));\n }\n\n getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null {\n return this.gridRenderers.columnComponentFor(attr);\n }\n\n getColumnRendererInputs(component: Type<any>, item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any> {\n return this.gridRenderers.columnInputsFor(component, item, attr);\n }\n}\n\nfunction extractSourceName(source: string): string {\n const dotIndex = source.indexOf('.');\n return dotIndex >= 0 ? source.substring(dotIndex + 1) : source;\n}\n\n/**\n * Enough English to map a query source onto a type name — `Cars` to `Car`, `People` to `Person`.\n *\n * Deliberately a small table plus three suffix rules rather than a library: it runs against type\n * names the application itself chose, and a wrong guess costs nothing, since the caller falls\n * through to matching the plural and the CLR type name.\n */\nfunction singularize(plural: string): string {\n const irregulars: Record<string, string> = {\n 'People': 'Person',\n 'Children': 'Child',\n 'Men': 'Man',\n 'Women': 'Woman',\n };\n if (irregulars[plural]) return irregulars[plural];\n if (plural.endsWith('ies')) return plural.slice(0, -3) + 'y';\n if (plural.endsWith('es')) return plural.slice(0, -2);\n if (plural.endsWith('s')) return plural.slice(0, -1);\n return plural;\n}\n","<!--\n Three explicit states, in this order, and the order is load-bearing.\n\n This template used to open with `@if (query(); as q)` wrapping EVERYTHING, and `query()` is only\n set after loadData's awaits resolve. Three separate bugs fell out of that one line: the spinner\n was unreachable on a first load (it rendered inside the gate, while `loading` starts true and\n `query` starts null), a first-load failure rendered ZERO DOM — no card, no message, nothing to\n see or report — and a failed RELOAD left the previous query's rows on screen.\n\n So: `loading` is checked first and outside any dependency on `query`, and the final `@else`\n always renders something. Do not fold these back into one gate, and do not move the spinner\n inside the `query()` branch.\n-->\n@if (loading()) {\n <div class=\"text-center p-3\">\n <bs-spinner />\n </div>\n} @else if (query()) {\n <!-- A page-fetch failure while the grid is already resolved. Without this the catch returns an\n empty page and a failed query is indistinguishable from one that legitimately has no rows. -->\n @if (errorMessage(); as err) {\n <bs-alert [type]=\"colors.danger\" class=\"mb-3\">\n {{ err }}\n </bs-alert>\n }\n\n <!--\n One datatable, two row sources. `[data]` and `[fetch]` are mutually exclusive in\n ng-bootstrap — binding both makes `[fetch]` win silently — so exactly one is ever non-null\n here: `fetchFn` is left null whenever `data` is bound. See the class comment for why rows can\n arrive from outside at all (streaming must not put a websocket in every detail page's bundle).\n -->\n <bs-datatable\n [selectionMode]=\"selectionMode()\"\n [(selection)]=\"selection\"\n [virtualScroll]=\"isVirtualScrolling()\"\n [itemSize]=\"40\"\n [isResponsive]=\"isVirtualScrolling()\"\n [data]=\"data()\"\n [fetch]=\"fetchFn()\"\n [(settings)]=\"settings\">\n @for (attr of visibleAttributes(); track attr.id) {\n <div *bsDatatableColumn=\"attr.name; sortable: true\">\n {{ (attr.label | resolveTranslation) || attr.name }}\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (attr of visibleAttributes(); track attr.id; let first = $first) {\n <td>\n @if (row) {\n <!-- The first column links to the row's detail page. Two things about this are\n routinely misread:\n\n 1. `cellContent` is projected INSIDE the anchor, so a custom `renderer` does NOT\n suppress this link — a renderer that emits its own <a> produces nested anchors\n (invalid HTML) rather than replacing this one.\n 2. `canRead()` is the whole gate, and it is the rights model: `Query` without\n `Read` lists the rows and withholds the link. Withhold `Read` for a query\n whose rows no detail page can load — a Custom.* query that fabricates rows in\n memory, say. -->\n @if (first && canRead()) {\n <a [routerLink]=\"['/po', entityType()!.alias || entityType()!.id, row.id]\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, attr: attr }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, attr: attr }\"></ng-container>\n }\n } @else {\n &nbsp;\n }\n </td>\n }\n </ng-container>\n </bs-datatable>\n} @else {\n <!-- The query could not be resolved. Rendering something keeps the host's layout intact and,\n crucially, makes the failure visible: this branch used to render nothing at all. -->\n <bs-alert [type]=\"colors.danger\" class=\"mb-0\">\n {{ errorMessage() || ('spark.query.unavailable' | t) }}\n </bs-alert>\n}\n\n<ng-template #cellContent let-item let-attr=\"attr\">\n <!--\n Presentation lives in <spark-grid-cell>, shared with the AsDetail table on the PO detail page.\n Value resolution stays here: a query row is a PersistentObject with an attribute list, and the\n AsDetail table's rows are plain dictionaries, so only the rendering is common.\n\n `link` is deliberately not passed. The first-column link is the grid's own rule and wraps this\n template from outside; setting both would nest anchors.\n -->\n <spark-grid-cell\n [column]=\"attr\"\n [display]=\"(attr.name | attributeValue:item:entityType():lookupReferenceOptions():allEntityTypes())\"\n [rendererValue]=\"rendererValueFor(item, attr)\"\n [item]=\"item\"\n [chips]=\"(attr.name | referenceChips:item)\" />\n</ng-template>\n","import { ChangeDetectionStrategy, Component, computed, contentChildren, input, output, viewChild, TemplateRef } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsCardComponent, BsCardHeaderComponent } from '@mintplayer/ng-bootstrap/card';\nimport { BsPriorityNavComponent, BsPriorityNavItemDirective } from '@mintplayer/ng-bootstrap/priority-nav';\nimport { ResolveTranslationPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkLanguageService } from '@mintplayer/ng-spark/services';\nimport { CustomActionDefinition, PersistentObject } from '@mintplayer/ng-spark/models';\nimport { inject } from '@angular/core';\nimport { SparkQueryGridComponent } from './spark-query-grid.component';\nimport {\n SparkQueryActionsDirective,\n SparkQueryCaptionDirective,\n SparkQueryIconDirective,\n slotFor,\n} from './spark-query-slots';\n\n/**\n * A `<bs-card>` around a {@link SparkQueryGridComponent}: icon, caption, actions, grid.\n *\n * ## Chrome is overridden, not replaced\n *\n * Every header region has a default, and a host replaces only the ones it supplies. That is what\n * lets this component serve the auto-rendered case: a sub-query is rendered once per entry in\n * `EntityTypeDefinition.Queries` with nobody projecting into it, and it must look right with no\n * host cooperation at all. A slot mechanism that only ever *replaced* chrome would leave that\n * call site blank — which is why an earlier design had the query carry its own chrome from the\n * server. Overriding a default needs no host; replacing one does.\n *\n * ## Two ways in, one set of templates\n *\n * Hand-written markup uses the structural directives and is found with `contentChildren`.\n * The auto-rendered path cannot: `spark-po-detail` is created by the router, so in a default app\n * there is no tag to project into. It therefore forwards `TemplateRef`s as inputs instead — a\n * directive cannot cross a component boundary but its template can, and that forwarding is\n * already the idiom in `spark-po-detail` (`extraActionsTemplate`, `extraContentTemplate`).\n *\n * Content wins over a forwarded input: the closer declaration is the more specific one.\n */\n@Component({\n selector: 'spark-query-card',\n imports: [CommonModule, BsCardComponent, BsCardHeaderComponent, BsPriorityNavComponent, BsPriorityNavItemDirective, SparkQueryGridComponent, ResolveTranslationPipe],\n templateUrl: './spark-query-card.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparkQueryCardComponent {\n readonly lang = inject(SparkLanguageService);\n\n queryId = input.required<string>();\n parentId = input<string>('');\n parentType = input<string>('');\n reloadToken = input<unknown>(null);\n data = input<PersistentObject[] | null>(null);\n search = input<string>('');\n\n /**\n * Slots forwarded from a host that cannot project content — see the class comment. A card\n * reached through hand-written markup should use the structural directives instead.\n */\n iconTemplate = input<TemplateRef<any> | null>(null);\n captionTemplate = input<TemplateRef<any> | null>(null);\n actionsTemplate = input<TemplateRef<any> | null>(null);\n\n error = output<HttpErrorResponse>();\n rowClicked = output<PersistentObject>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n\n private readonly iconSlots = contentChildren(SparkQueryIconDirective);\n private readonly captionSlots = contentChildren(SparkQueryCaptionDirective);\n private readonly actionSlots = contentChildren(SparkQueryActionsDirective);\n\n /**\n * The grid, read only to surface its state — the query, the actions, the selection — to this\n * component's own header.\n *\n * Optional rather than `required` on purpose. The header renders ABOVE the grid in this\n * template, so on the first change-detection pass the view query has not resolved yet and\n * `viewChild.required()` would throw where a plain one returns `undefined`. Everything below\n * therefore reads it defensively; the signal updates once the view initialises and the header\n * re-renders with the real query.\n *\n * A host reads grid state through a template reference variable instead, because a host may put\n * the grid behind an `@if`, where a view query genuinely is intermittently undefined.\n */\n protected readonly grid = viewChild(SparkQueryGridComponent);\n\n protected readonly query = computed(() => this.grid()?.query() ?? null);\n\n protected readonly iconTpl = computed(() =>\n slotFor(this.iconSlots(), this.query())?.templateRef ?? this.iconTemplate());\n\n protected readonly captionTpl = computed(() =>\n slotFor(this.captionSlots(), this.query())?.templateRef ?? this.captionTemplate());\n\n protected readonly actionsTpl = computed(() =>\n slotFor(this.actionSlots(), this.query())?.templateRef ?? this.actionsTemplate());\n\n /** The caption the card renders unless a slot replaces it. */\n protected readonly caption = computed(() => {\n const q = this.query();\n return (q?.description ? this.lang.resolve(q.description) : '') || q?.name || '';\n });\n\n protected readonly customActions = computed(() => this.grid()?.customActions() ?? []);\n protected readonly selection = computed(() => this.grid()?.selection() ?? []);\n}\n","<!--\n The card is always rendered. A host that wants no card uses <spark-query-grid> directly — which\n is what the old `showCard=\"false\"` meant, expressed as a component choice rather than a flag.\n-->\n<bs-card class=\"d-block my-3\">\n <bs-card-header>\n <div class=\"d-flex align-items-center gap-2\">\n @if (iconTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: query() }\"></ng-container>\n }\n\n <span class=\"me-auto\">\n @if (captionTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: caption(), query: query() }\"></ng-container>\n } @else {\n {{ caption() }}\n }\n </span>\n\n @if (actionsTpl(); as tpl) {\n <ng-container *ngTemplateOutlet=\"tpl; context: { $implicit: customActions(), selection: selection(), query: query() }\"></ng-container>\n } @else if (customActions().length) {\n <!-- The default: the actions the server declares for this type. The nav renders only when\n there are any, so a query without actions is pixel-identical to a plain caption.\n\n Disabled, not hidden: hiding makes the affordance undiscoverable and reflows the\n priority nav on every selection change. The server enforces the same rule. -->\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @for (action of customActions(); track action.name) {\n <button *bsPriorityNavItem=\"10 + action.offset\" class=\"btn btn-sm btn-outline-primary\"\n [disabled]=\"!grid()?.isActionEnabled(action)\" (click)=\"grid()?.onCustomAction(action)\">\n {{ action.displayName | resolveTranslation }}\n </button>\n }\n </bs-priority-nav>\n }\n </div>\n </bs-card-header>\n\n <div class=\"p-3\">\n <spark-query-grid\n [queryId]=\"queryId()\"\n [parentId]=\"parentId()\"\n [parentType]=\"parentType()\"\n [reloadToken]=\"reloadToken()\"\n [data]=\"data()\"\n [search]=\"search()\"\n (error)=\"error.emit($event)\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n </div>\n</bs-card>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAUA;AACO,MAAM,qBAAqB,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;AAEhD;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,UAA6B,EAAA;IACjE,OAAO,UAAU,EAAE;AAChB,SAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,IAAI,eAAe,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC;AACtE,SAAA,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;AAC5C;AAEA;;;;;AAKG;AACG,SAAU,mBAAmB,CAAC,KAAwB,EAAA;;;AAG1D,IAAA,MAAM,WAAW,GAAiB,CAAC,KAAK,EAAE,WAAW,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,KAAK;QACtE,QAAQ,EAAE,EAAE,CAAC,QAAQ;AACrB,QAAA,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,GAAG,YAAqB,GAAG,WAAoB;AAClF,KAAA,CAAC,CAAC;IAEH,OAAO,IAAI,iBAAiB,CAAC;AAC3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AAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,uBAAuB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MACpB,0BAA0B,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,WAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,eAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAC3B,0BAA0B,mFAerC,uBAAuB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEvF7D;;AAEG;;;;"}
@@ -68,6 +68,14 @@ function nestedPoToDict(po) {
68
68
  for (const attr of po.attributes ?? []) {
69
69
  dict[attr.name] = attributeValueForForm(attr);
70
70
  }
71
+ // The object's own server-resolved breadcrumb, kept under a reserved key so the form can label
72
+ // it without re-deriving a template it may be structurally unable to resolve. Safe to carry
73
+ // through save: `dictToNestedPo` walks the entity type's attributes, never the dict's keys, so
74
+ // a reserved key is never sent to the server. Attached only when it resolved, which keeps the
75
+ // common case byte-for-byte identical to the plain flat dict.
76
+ if (typeof po.breadcrumb === 'string' && po.breadcrumb !== '') {
77
+ dict[AS_DETAIL_SELF_BREADCRUMB_KEY] = po.breadcrumb;
78
+ }
71
79
  return dict;
72
80
  }
73
81
  function attributeValueForForm(attr) {
@@ -78,6 +86,41 @@ function attributeValueForForm(attr) {
78
86
  }
79
87
  return attr.value;
80
88
  }
89
+ /**
90
+ * Reserved key under which a flattened nested object keeps the breadcrumb the SERVER resolved for
91
+ * that object itself (as opposed to {@link AS_DETAIL_BREADCRUMBS_KEY}, which keys the breadcrumbs
92
+ * of its reference attributes by attribute name).
93
+ *
94
+ * This exists because a breadcrumb template can name a property the model does not carry. HR's
95
+ * `Address` declares `[Breadcrumb, IgnoreProperty] string Crumb`, and `Address.json` renders it as
96
+ * `"{Crumb}"` — the server resolves that by reflecting over the CLR property, which no client can
97
+ * do, because `[IgnoreProperty]` is exactly the instruction to keep it out of the model. Flattening
98
+ * used to discard the resolved string, leaving the form to substitute `{Crumb}` against a dict that
99
+ * can never contain it.
100
+ */
101
+ const AS_DETAIL_SELF_BREADCRUMB_KEY = '__sparkBreadcrumb';
102
+ /**
103
+ * The breadcrumb the server resolved for a flattened object, or null when it resolved to nothing.
104
+ *
105
+ * `EntityMapper` never emits an empty breadcrumb: when the template renders blank it substitutes
106
+ * the CLR type name, so an unset `Address` arrives as the literal string `"Address"`
107
+ * (EntityMapper.cs:209-211). That is a placeholder, not data, and rendering it would be worse than
108
+ * rendering nothing — it reads as a real value. `typeName` lets a caller filter it back out.
109
+ */
110
+ function selfBreadcrumb(row, typeName) {
111
+ const value = row?.[AS_DETAIL_SELF_BREADCRUMB_KEY];
112
+ if (typeof value !== 'string' || value.trim() === '')
113
+ return null;
114
+ // Callers hold the type name in two shapes — `EntityType.name` is the short model name, while an
115
+ // attribute's `asDetailType` is the full CLR name — and the server's placeholder is always the
116
+ // short one. Compare on the last dotted segment so either shape filters it.
117
+ if (typeName) {
118
+ const shortName = typeName.slice(typeName.lastIndexOf('.') + 1);
119
+ if (value === shortName)
120
+ return null;
121
+ }
122
+ return value;
123
+ }
81
124
  /**
82
125
  * Reserved key under which {@link nestedPoToDisplayRow} stashes the server-resolved breadcrumb of
83
126
  * each reference attribute (keyed by attribute name). Lets an AsDetail reference cell render the
@@ -107,6 +150,11 @@ function nestedPoToDisplayRow(po) {
107
150
  // case) byte-for-byte identical to the plain flat dict.
108
151
  if (breadcrumbs)
109
152
  dict[AS_DETAIL_BREADCRUMBS_KEY] = breadcrumbs;
153
+ // Same self-breadcrumb the form path carries: a nested-AsDetail COLUMN in a detail table has an
154
+ // inner dict as its value, which used to stringify to "[object Object]".
155
+ if (typeof po.breadcrumb === 'string' && po.breadcrumb !== '') {
156
+ dict[AS_DETAIL_SELF_BREADCRUMB_KEY] = po.breadcrumb;
157
+ }
110
158
  return dict;
111
159
  }
112
160
  function displayValueForAttribute(attr) {
@@ -174,9 +222,120 @@ function buildAttribute(attrDef, raw, resolve) {
174
222
  return attr;
175
223
  }
176
224
 
225
+ /**
226
+ * The custom actions a query should offer, from the entity type's full set.
227
+ *
228
+ * `showedOn` must include the query side. The accepted values are `"detail"`, `"query"`
229
+ * and `"both"` — as the server model and the custom-actions guide have always
230
+ * documented. Both grids previously tested for `"list"`, a value nothing emits, so an
231
+ * action authored per the documentation rendered nowhere at all.
232
+ *
233
+ * ⚠️ This narrows what is DISPLAYED. It is NOT an authorization boundary: the grant
234
+ * is, and it is enforced independently in `ExecuteCustomAction` regardless of which
235
+ * query the caller clicked from — a caller can always POST directly.
236
+ */
237
+ function filterQueryActions(actions) {
238
+ return actions.filter(a => a.showedOn === 'query' || a.showedOn === 'both');
239
+ }
240
+
241
+ /**
242
+ * Parses a custom action's `selectionRule` — a cardinality expression over the number
243
+ * of selected rows — into a predicate.
244
+ *
245
+ * A port of the server's `SelectionRuleParser`, and the two MUST agree: they are tested
246
+ * against one shared fixture (`selection-rule.fixture.json`) for exactly this reason.
247
+ * Vidyano, where this grammar comes from, has the same algorithm in C# and JavaScript and
248
+ * the two have already drifted — one throws on a non-numeric operand where the other
249
+ * silently permits everything.
250
+ *
251
+ * Grammar: `X` is the count placeholder, whitespace is insignificant, terms split on `X`
252
+ * are AND-combined (`1<X<5` is a range), operators are `<= >= < > != =` matched in that
253
+ * order so `>=` is never read as `>`, and a number-first term is mirrored (`0<X` is `>0`).
254
+ *
255
+ * Client-side this only drives whether a button is disabled. The server enforces the same
256
+ * rule independently — and neither is an authorization boundary: the action's grant is.
257
+ */
258
+ function parseSelectionRule(rule) {
259
+ if (!rule || !rule.trim())
260
+ return () => true;
261
+ try {
262
+ return compile(rule);
263
+ }
264
+ catch {
265
+ // Unlike the server, which refuses to start on a malformed rule, the client cannot
266
+ // usefully fail: the rule arrived over the wire from a server that already validated
267
+ // it. Disabling the button is the safe direction — it never permits an action the
268
+ // server would refuse.
269
+ return () => false;
270
+ }
271
+ }
272
+ const OPERATORS = ['<=', '>=', '<', '>', '!=', '='];
273
+ function compile(rule) {
274
+ const normalized = rule.replace(/ /g, '').toUpperCase();
275
+ const terms = normalized.split('X').filter(t => t.length > 0);
276
+ if (terms.length === 0)
277
+ throw new Error(`Selection rule '${rule}' has no condition.`);
278
+ const numberFirst = !normalized.startsWith('X') && normalized.includes('X');
279
+ const predicates = terms.map((term, i) => compileTerm(term, rule, numberFirst && i === 0));
280
+ return count => predicates.every(p => p(count));
281
+ }
282
+ function compileTerm(term, rule, mirrored) {
283
+ const op = OPERATORS.find(o => (mirrored ? term.endsWith(o) : term.startsWith(o)));
284
+ if (!op)
285
+ throw new Error(`Selection rule '${rule}' has no recognised operator in '${term}'.`);
286
+ const numberPart = mirrored ? term.slice(0, term.length - op.length) : term.slice(op.length);
287
+ // Number(' ') is 0 and Number('1.5') is 1.5 — neither is a valid operand here.
288
+ if (!/^-?\d+$/.test(numberPart)) {
289
+ throw new Error(`Selection rule '${rule}' has a non-numeric operand in '${term}'.`);
290
+ }
291
+ const value = Number(numberPart);
292
+ const effective = mirrored ? mirror(op) : op;
293
+ switch (effective) {
294
+ case '<=': return count => count <= value;
295
+ case '>=': return count => count >= value;
296
+ case '<': return count => count < value;
297
+ case '>': return count => count > value;
298
+ case '!=': return count => count !== value;
299
+ case '=': return count => count === value;
300
+ default: throw new Error(`Selection rule '${rule}' has an unsupported operator '${effective}'.`);
301
+ }
302
+ }
303
+ function mirror(op) {
304
+ switch (op) {
305
+ case '<': return '>';
306
+ case '>': return '<';
307
+ case '<=': return '>=';
308
+ case '>=': return '<=';
309
+ default: return op;
310
+ }
311
+ }
312
+
313
+ /**
314
+ * The selection mode a grid needs in order to satisfy the actions offered on it.
315
+ *
316
+ * Derived rather than configured, so a grid gains a checkbox column exactly when an
317
+ * action needs one and is otherwise pixel-identical to a grid with no selection at all.
318
+ * Vidyano's query grid does the same thing — it renders the checkbox column only if some
319
+ * action is selection-gated.
320
+ *
321
+ * `'single'` when every gated action is satisfied by one row and refused by two; anything
322
+ * else that cares about the count gets `'multiple'`.
323
+ */
324
+ function selectionModeFor(actions) {
325
+ // An action with no rule is not selection-gated: it acts on the query, not on rows.
326
+ const gated = actions.filter(a => !!a.selectionRule?.trim());
327
+ if (gated.length === 0)
328
+ return 'none';
329
+ const everyRuleWantsExactlyOne = gated.every(a => {
330
+ const rule = parseSelectionRule(a.selectionRule);
331
+ return rule(1) && !rule(2);
332
+ });
333
+ return everyRuleWantsExactlyOne ? 'single' : 'multiple';
334
+ }
335
+
177
336
  /**
178
337
  * Generated bundle index. Do not edit.
179
338
  */
180
339
 
181
- export { AS_DETAIL_BREADCRUMBS_KEY, ELookupDisplayType, EReferenceDisplayType, ShowedOn, currentLanguage, dictToNestedPo, hasShowedOnFlag, nestedPoToDict, nestedPoToDisplayRow, resolveTranslation };
340
+ export { AS_DETAIL_BREADCRUMBS_KEY, AS_DETAIL_SELF_BREADCRUMB_KEY, ELookupDisplayType, EReferenceDisplayType, ShowedOn, currentLanguage, dictToNestedPo, filterQueryActions, hasShowedOnFlag, nestedPoToDict, nestedPoToDisplayRow, parseSelectionRule, resolveTranslation, selectionModeFor, selfBreadcrumb };
182
341
  //# sourceMappingURL=mintplayer-ng-spark-models.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mintplayer-ng-spark-models.mjs","sources":["../../models/src/translated-string.ts","../../models/src/showed-on.ts","../../models/src/entity-type.ts","../../models/src/lookup-reference.ts","../../models/src/as-detail-conversions.ts","../../models/mintplayer-ng-spark-models.ts"],"sourcesContent":["import { signal, type WritableSignal } from '@angular/core';\n\nexport type TranslatedString = Record<string, string>;\n\n/** Global reactive language state — shared across library boundaries via globalThis */\nexport const currentLanguage: WritableSignal<string> =\n ((globalThis as any).__sparkCurrentLanguage ??= signal('en'));\n\nexport function resolveTranslation(ts: TranslatedString | undefined, lang?: string): string {\n if (!ts) return '';\n const language = lang ?? currentLanguage();\n return ts[language] ?? ts['en'] ?? Object.values(ts)[0] ?? '';\n}\n","/**\n * Flags enum controlling on which pages an attribute should be displayed.\n * Values can be combined: ShowedOn.Query | ShowedOn.PersistentObject\n */\nexport enum ShowedOn {\n Query = 1,\n PersistentObject = 2,\n}\n\n/**\n * Helper function to check if a ShowedOn value includes a specific flag.\n */\nexport function hasShowedOnFlag(value: ShowedOn | string | undefined, flag: ShowedOn): boolean {\n if (value === undefined) return true; // Default: show on all pages\n\n // Handle string values from JSON (e.g., \"Query, PersistentObject\")\n if (typeof value === 'string') {\n const parts = value.split(',').map(s => s.trim());\n const flagName = ShowedOn[flag];\n return parts.includes(flagName);\n }\n\n // Handle numeric flag values\n return (value & flag) === flag;\n}\n","import { ShowedOn } from './showed-on';\nimport { TranslatedString } from './translated-string';\nimport { ValidationRule } from './validation-rule';\n\n/**\n * Controls how a Reference attribute is picked in the PO-edit form.\n * Serialized as a string by the server (mirrors the .NET EReferenceDisplayType).\n */\nexport enum EReferenceDisplayType {\n /** Renders as a `<bs-select>` listing every referenced item. */\n Dropdown = 'Dropdown',\n /** Renders a readonly textbox + \"…\" button that opens a searchable modal grid picker. */\n Modal = 'Modal',\n}\n\nexport interface EntityAttributeDefinition {\n id: string;\n name: string;\n label?: TranslatedString;\n dataType: string;\n isRequired: boolean;\n isVisible: boolean;\n isReadOnly: boolean;\n order: number;\n query?: string;\n /** For reference attributes, specifies the target entity type's CLR type name */\n referenceType?: string;\n /** For AsDetail attributes, specifies the nested entity type's CLR type name */\n asDetailType?: string;\n /** When true, the attribute represents an array/collection of AsDetail objects */\n isArray?: boolean;\n /** For array AsDetail attributes: \"modal\" (default) or \"inline\" */\n editMode?: 'inline' | 'modal';\n /**\n * For Reference attributes: 'Modal' renders the \"…\" + modal query-grid picker;\n * 'Dropdown'/absent (default) renders a `<bs-select>`. Hand-set in the model JSON.\n */\n referenceDisplayType?: EReferenceDisplayType;\n /** For array AsDetail attributes: when true, rows can be drag-reordered (order = array position) */\n isSortable?: boolean;\n /** For LookupReference attributes, specifies the lookup reference type name */\n lookupReferenceType?: string;\n /**\n * Controls on which pages the attribute should be displayed.\n * Query = shown in list views, PersistentObject = shown in detail/edit views.\n * Can be a numeric flag value or a string like \"Query, PersistentObject\".\n */\n showedOn?: ShowedOn | string;\n rules: ValidationRule[];\n /** References an AttributeGroup.id to assign this attribute to a group */\n group?: string;\n /** Number of grid columns this attribute spans within a tab's column layout */\n columnSpan?: number;\n /** Renderer component name for custom display in detail/list views */\n renderer?: string;\n /** Options passed to the renderer component */\n rendererOptions?: Record<string, any>;\n}\n\nexport interface AttributeTab {\n id: string;\n name: string;\n label?: TranslatedString;\n order: number;\n /** Number of columns for the grid layout within this tab */\n columnCount?: number;\n}\n\nexport interface AttributeGroup {\n id: string;\n name: string;\n label?: TranslatedString;\n /** References an AttributeTab.id to assign this group to a tab */\n tab?: string;\n order: number;\n}\n\nexport interface EntityType {\n id: string;\n name: string;\n description?: TranslatedString;\n clrType: string;\n alias?: string;\n /**\n * Breadcrumb template: literal text plus `{AttributeName}` placeholders. A scalar placeholder\n * renders its value; a reference placeholder renders the referenced entity's breadcrumb.\n * The server resolves this — clients only read the resulting strings. Example: \"{Street}, {City}\".\n */\n breadcrumb?: string;\n /**\n * When false, the breadcrumb needs the collection document (a placeholder field is not on the\n * projection). null/absent means renderable from the projection. Informational on the client.\n */\n breadcrumbProjectionSatisfiable?: boolean;\n tabs?: AttributeTab[];\n groups?: AttributeGroup[];\n attributes: EntityAttributeDefinition[];\n /** Query aliases or IDs to display as related query tables on the detail page. */\n queries?: string[];\n}\n","import { TranslatedString } from './translated-string';\n\nexport enum ELookupDisplayType {\n Dropdown = 0,\n Modal = 1\n}\n\nexport interface LookupReferenceListItem {\n name: string;\n isTransient: boolean;\n valueCount: number;\n displayType: ELookupDisplayType;\n}\n\nexport interface LookupReference {\n name: string;\n isTransient: boolean;\n displayType: ELookupDisplayType;\n values: LookupReferenceValue[];\n}\n\nexport interface LookupReferenceValue {\n key: string;\n values: TranslatedString;\n isActive: boolean;\n extra?: Record<string, unknown>;\n}\n","import { EntityAttributeDefinition } from './entity-type';\nimport { EntityType } from './entity-type';\nimport { PersistentObject } from './persistent-object';\nimport { PersistentObjectAttribute } from './persistent-object-attribute';\n\n/**\n * Resolves an `EntityType` by its CLR type name (e.g. `\"HR.Entities.Address\"`).\n * Callers typically close over `sparkService.getEntityTypes()`'s cached list.\n */\nexport type EntityTypeResolver = (clrTypeName: string) => EntityType | undefined;\n\n/**\n * Flattens a nested `PersistentObject` into the plain `Record<string, any>` shape the\n * form state uses throughout ng-spark. Primitive / reference attributes contribute their\n * `value`; nested AsDetail attributes recurse — single becomes an inner dict, array\n * becomes an array of inner dicts. Returns `{}` for `null` / `undefined` input.\n *\n * This is the ONE place that reads the server's new AsDetail wire shape and collapses it\n * back to the flat dict the form components already handle.\n */\nexport function nestedPoToDict(po: PersistentObject | null | undefined): Record<string, any> {\n if (!po) return {};\n const dict: Record<string, any> = {};\n for (const attr of po.attributes ?? []) {\n dict[attr.name] = attributeValueForForm(attr);\n }\n return dict;\n}\n\nfunction attributeValueForForm(attr: PersistentObjectAttribute): any {\n if (attr.dataType === 'AsDetail') {\n if (attr.isArray) return (attr.objects ?? []).map(po => nestedPoToDict(po));\n return attr.object ? nestedPoToDict(attr.object) : null;\n }\n return attr.value;\n}\n\n/**\n * Reserved key under which {@link nestedPoToDisplayRow} stashes the server-resolved breadcrumb of\n * each reference attribute (keyed by attribute name). Lets an AsDetail reference cell render the\n * label the server already resolved by id — page-independent — instead of guessing from a single\n * reference-query options page. Prefixed to avoid colliding with a real attribute name.\n */\nexport const AS_DETAIL_BREADCRUMBS_KEY = '__sparkBreadcrumbs';\n\n/**\n * Like {@link nestedPoToDict}, but for the read-only detail display path. In addition to each\n * attribute's value it preserves the server-resolved per-reference `breadcrumb` under\n * {@link AS_DETAIL_BREADCRUMBS_KEY}, so an AsDetail reference cell can render the label by id\n * regardless of whether the referenced document fits on the reference query's first options page.\n * The form/edit path keeps using {@link nestedPoToDict}, which never carries breadcrumbs.\n */\nexport function nestedPoToDisplayRow(po: PersistentObject | null | undefined): Record<string, any> {\n if (!po) return {};\n const dict: Record<string, any> = {};\n let breadcrumbs: Record<string, string> | undefined;\n for (const attr of po.attributes ?? []) {\n dict[attr.name] = displayValueForAttribute(attr);\n if (attr.dataType === 'Reference' && !attr.isArray && typeof attr.breadcrumb === 'string' && attr.breadcrumb !== '') {\n (breadcrumbs ??= {})[attr.name] = attr.breadcrumb;\n }\n }\n // Only attach the side channel when something resolved — keeps reference-free rows (the common\n // case) byte-for-byte identical to the plain flat dict.\n if (breadcrumbs) dict[AS_DETAIL_BREADCRUMBS_KEY] = breadcrumbs;\n return dict;\n}\n\nfunction displayValueForAttribute(attr: PersistentObjectAttribute): any {\n if (attr.dataType === 'AsDetail') {\n if (attr.isArray) return (attr.objects ?? []).map(po => nestedPoToDisplayRow(po));\n return attr.object ? nestedPoToDisplayRow(attr.object) : null;\n }\n return attr.value;\n}\n\n/**\n * Builds a nested `PersistentObject` from a flat dict against the schema in\n * <paramref name=\"entityType\"/>. Used when the form is about to save — AsDetail attributes\n * are no longer sent as flat dicts in `attribute.value`; the server now requires\n * `attribute.object` / `attribute.objects` with fully scaffolded nested POs.\n *\n * `resolve` walks through AsDetail types registered elsewhere (usually the full\n * `getEntityTypes()` list, keyed by CLR type name). Nested AsDetail inside AsDetail is\n * handled recursively.\n */\nexport function dictToNestedPo(\n dict: Record<string, any> | null | undefined,\n entityType: EntityType,\n resolve: EntityTypeResolver,\n): PersistentObject {\n const attributes: PersistentObjectAttribute[] = (entityType.attributes ?? [])\n .map(attrDef => buildAttribute(attrDef, dict?.[attrDef.name], resolve));\n\n return {\n id: (dict?.['Id'] as string) ?? (dict?.['id'] as string) ?? '',\n name: entityType.name,\n objectTypeId: entityType.id,\n attributes,\n };\n}\n\nfunction buildAttribute(\n attrDef: EntityAttributeDefinition,\n raw: any,\n resolve: EntityTypeResolver,\n): PersistentObjectAttribute {\n const attr: PersistentObjectAttribute = {\n id: attrDef.id,\n name: attrDef.name,\n label: attrDef.label,\n dataType: attrDef.dataType,\n isArray: attrDef.isArray,\n isRequired: attrDef.isRequired,\n isVisible: attrDef.isVisible,\n isReadOnly: attrDef.isReadOnly,\n order: attrDef.order,\n rules: attrDef.rules ?? [],\n isValueChanged: true,\n };\n\n if (attrDef.dataType === 'AsDetail') {\n // Server expects attr.value null for AsDetail; the nested PO carries the data.\n attr.value = null;\n attr.asDetailType = attrDef.asDetailType;\n\n const nestedType = attrDef.asDetailType ? resolve(attrDef.asDetailType) : undefined;\n if (!nestedType) {\n attr.object = null;\n attr.objects = attrDef.isArray ? [] : null;\n return attr;\n }\n\n if (attrDef.isArray) {\n const items: any[] = Array.isArray(raw) ? raw : [];\n attr.objects = items.map(item => dictToNestedPo((item as Record<string, any>) ?? {}, nestedType, resolve));\n } else {\n attr.object = raw ? dictToNestedPo(raw as Record<string, any>, nestedType, resolve) : null;\n }\n return attr;\n }\n\n attr.value = raw;\n return attr;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAIA;AACO,MAAM,eAAe,IACxB,UAAkB,CAAC,sBAAsB,KAAK,MAAM,CAAC,IAAI,CAAC;AAExD,SAAU,kBAAkB,CAAC,EAAgC,EAAE,IAAa,EAAA;AAChF,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,EAAE;AAClB,IAAA,MAAM,QAAQ,GAAG,IAAI,IAAI,eAAe,EAAE;IAC1C,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;AAC/D;;ACZA;;;AAGG;IACS;AAA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+ {"version":3,"file":"mintplayer-ng-spark-models.mjs","sources":["../../models/src/translated-string.ts","../../models/src/showed-on.ts","../../models/src/entity-type.ts","../../models/src/lookup-reference.ts","../../models/src/as-detail-conversions.ts","../../models/src/query-actions.ts","../../models/src/selection-rule.ts","../../models/src/selection-mode.ts","../../models/mintplayer-ng-spark-models.ts"],"sourcesContent":["import { signal, type WritableSignal } from '@angular/core';\n\nexport type TranslatedString = Record<string, string>;\n\n/** Global reactive language state — shared across library boundaries via globalThis */\nexport const currentLanguage: WritableSignal<string> =\n ((globalThis as any).__sparkCurrentLanguage ??= signal('en'));\n\nexport function resolveTranslation(ts: TranslatedString | undefined, lang?: string): string {\n if (!ts) return '';\n const language = lang ?? currentLanguage();\n return ts[language] ?? ts['en'] ?? Object.values(ts)[0] ?? '';\n}\n","/**\n * Flags enum controlling on which pages an attribute should be displayed.\n * Values can be combined: ShowedOn.Query | ShowedOn.PersistentObject\n */\nexport enum ShowedOn {\n Query = 1,\n PersistentObject = 2,\n}\n\n/**\n * Helper function to check if a ShowedOn value includes a specific flag.\n */\nexport function hasShowedOnFlag(value: ShowedOn | string | undefined, flag: ShowedOn): boolean {\n if (value === undefined) return true; // Default: show on all pages\n\n // Handle string values from JSON (e.g., \"Query, PersistentObject\")\n if (typeof value === 'string') {\n const parts = value.split(',').map(s => s.trim());\n const flagName = ShowedOn[flag];\n return parts.includes(flagName);\n }\n\n // Handle numeric flag values\n return (value & flag) === flag;\n}\n","import { ShowedOn } from './showed-on';\nimport { TranslatedString } from './translated-string';\nimport { ValidationRule } from './validation-rule';\n\n/**\n * Controls how a Reference attribute is picked in the PO-edit form.\n * Serialized as a string by the server (mirrors the .NET EReferenceDisplayType).\n */\nexport enum EReferenceDisplayType {\n /** Renders as a `<bs-select>` listing every referenced item. */\n Dropdown = 'Dropdown',\n /** Renders a readonly textbox + \"…\" button that opens a searchable modal grid picker. */\n Modal = 'Modal',\n}\n\nexport interface EntityAttributeDefinition {\n id: string;\n name: string;\n label?: TranslatedString;\n dataType: string;\n isRequired: boolean;\n isVisible: boolean;\n isReadOnly: boolean;\n order: number;\n query?: string;\n /** For reference attributes, specifies the target entity type's CLR type name */\n referenceType?: string;\n /** For AsDetail attributes, specifies the nested entity type's CLR type name */\n asDetailType?: string;\n /** When true, the attribute represents an array/collection of AsDetail objects */\n isArray?: boolean;\n /** For array AsDetail attributes: \"modal\" (default) or \"inline\" */\n editMode?: 'inline' | 'modal';\n /**\n * For Reference attributes: 'Modal' renders the \"…\" + modal query-grid picker;\n * 'Dropdown'/absent (default) renders a `<bs-select>`. Hand-set in the model JSON.\n */\n referenceDisplayType?: EReferenceDisplayType;\n /** For array AsDetail attributes: when true, rows can be drag-reordered (order = array position) */\n isSortable?: boolean;\n /** For LookupReference attributes, specifies the lookup reference type name */\n lookupReferenceType?: string;\n /**\n * Controls on which pages the attribute should be displayed.\n * Query = shown in list views, PersistentObject = shown in detail/edit views.\n * Can be a numeric flag value or a string like \"Query, PersistentObject\".\n */\n showedOn?: ShowedOn | string;\n rules: ValidationRule[];\n /** References an AttributeGroup.id to assign this attribute to a group */\n group?: string;\n /** Number of grid columns this attribute spans within a tab's column layout */\n columnSpan?: number;\n /** Renderer component name for custom display in detail/list views */\n renderer?: string;\n /** Options passed to the renderer component */\n rendererOptions?: Record<string, any>;\n}\n\nexport interface AttributeTab {\n id: string;\n name: string;\n label?: TranslatedString;\n order: number;\n /** Number of columns for the grid layout within this tab */\n columnCount?: number;\n}\n\nexport interface AttributeGroup {\n id: string;\n name: string;\n label?: TranslatedString;\n /** References an AttributeTab.id to assign this group to a tab */\n tab?: string;\n order: number;\n}\n\nexport interface EntityType {\n id: string;\n name: string;\n description?: TranslatedString;\n clrType: string;\n alias?: string;\n /**\n * Breadcrumb template: literal text plus `{AttributeName}` placeholders. A scalar placeholder\n * renders its value; a reference placeholder renders the referenced entity's breadcrumb.\n * The server resolves this — clients only read the resulting strings. Example: \"{Street}, {City}\".\n */\n breadcrumb?: string;\n /**\n * When false, the breadcrumb needs the collection document (a placeholder field is not on the\n * projection). null/absent means renderable from the projection. Informational on the client.\n */\n breadcrumbProjectionSatisfiable?: boolean;\n tabs?: AttributeTab[];\n groups?: AttributeGroup[];\n attributes: EntityAttributeDefinition[];\n /** Query aliases or IDs to display as related query tables on the detail page. */\n queries?: string[];\n}\n","import { TranslatedString } from './translated-string';\n\nexport enum ELookupDisplayType {\n Dropdown = 0,\n Modal = 1\n}\n\nexport interface LookupReferenceListItem {\n name: string;\n isTransient: boolean;\n valueCount: number;\n displayType: ELookupDisplayType;\n}\n\nexport interface LookupReference {\n name: string;\n isTransient: boolean;\n displayType: ELookupDisplayType;\n values: LookupReferenceValue[];\n}\n\nexport interface LookupReferenceValue {\n key: string;\n values: TranslatedString;\n isActive: boolean;\n extra?: Record<string, unknown>;\n}\n","import { EntityAttributeDefinition } from './entity-type';\nimport { EntityType } from './entity-type';\nimport { PersistentObject } from './persistent-object';\nimport { PersistentObjectAttribute } from './persistent-object-attribute';\n\n/**\n * Resolves an `EntityType` by its CLR type name (e.g. `\"HR.Entities.Address\"`).\n * Callers typically close over a list they already hold. `getEntityTypes()` is NOT cached --\n * it issues a request per call -- so resolve against a list you fetched once rather than\n * calling it inside the resolver.\n */\nexport type EntityTypeResolver = (clrTypeName: string) => EntityType | undefined;\n\n/**\n * Flattens a nested `PersistentObject` into the plain `Record<string, any>` shape the\n * form state uses throughout ng-spark. Primitive / reference attributes contribute their\n * `value`; nested AsDetail attributes recurse — single becomes an inner dict, array\n * becomes an array of inner dicts. Returns `{}` for `null` / `undefined` input.\n *\n * This is the ONE place that reads the server's new AsDetail wire shape and collapses it\n * back to the flat dict the form components already handle.\n */\nexport function nestedPoToDict(po: PersistentObject | null | undefined): Record<string, any> {\n if (!po) return {};\n const dict: Record<string, any> = {};\n for (const attr of po.attributes ?? []) {\n dict[attr.name] = attributeValueForForm(attr);\n }\n // The object's own server-resolved breadcrumb, kept under a reserved key so the form can label\n // it without re-deriving a template it may be structurally unable to resolve. Safe to carry\n // through save: `dictToNestedPo` walks the entity type's attributes, never the dict's keys, so\n // a reserved key is never sent to the server. Attached only when it resolved, which keeps the\n // common case byte-for-byte identical to the plain flat dict.\n if (typeof po.breadcrumb === 'string' && po.breadcrumb !== '') {\n dict[AS_DETAIL_SELF_BREADCRUMB_KEY] = po.breadcrumb;\n }\n return dict;\n}\n\nfunction attributeValueForForm(attr: PersistentObjectAttribute): any {\n if (attr.dataType === 'AsDetail') {\n if (attr.isArray) return (attr.objects ?? []).map(po => nestedPoToDict(po));\n return attr.object ? nestedPoToDict(attr.object) : null;\n }\n return attr.value;\n}\n\n/**\n * Reserved key under which a flattened nested object keeps the breadcrumb the SERVER resolved for\n * that object itself (as opposed to {@link AS_DETAIL_BREADCRUMBS_KEY}, which keys the breadcrumbs\n * of its reference attributes by attribute name).\n *\n * This exists because a breadcrumb template can name a property the model does not carry. HR's\n * `Address` declares `[Breadcrumb, IgnoreProperty] string Crumb`, and `Address.json` renders it as\n * `\"{Crumb}\"` — the server resolves that by reflecting over the CLR property, which no client can\n * do, because `[IgnoreProperty]` is exactly the instruction to keep it out of the model. Flattening\n * used to discard the resolved string, leaving the form to substitute `{Crumb}` against a dict that\n * can never contain it.\n */\nexport const AS_DETAIL_SELF_BREADCRUMB_KEY = '__sparkBreadcrumb';\n\n/**\n * The breadcrumb the server resolved for a flattened object, or null when it resolved to nothing.\n *\n * `EntityMapper` never emits an empty breadcrumb: when the template renders blank it substitutes\n * the CLR type name, so an unset `Address` arrives as the literal string `\"Address\"`\n * (EntityMapper.cs:209-211). That is a placeholder, not data, and rendering it would be worse than\n * rendering nothing — it reads as a real value. `typeName` lets a caller filter it back out.\n */\nexport function selfBreadcrumb(row: Record<string, any> | null | undefined, typeName?: string): string | null {\n const value = row?.[AS_DETAIL_SELF_BREADCRUMB_KEY];\n if (typeof value !== 'string' || value.trim() === '') return null;\n\n // Callers hold the type name in two shapes — `EntityType.name` is the short model name, while an\n // attribute's `asDetailType` is the full CLR name — and the server's placeholder is always the\n // short one. Compare on the last dotted segment so either shape filters it.\n if (typeName) {\n const shortName = typeName.slice(typeName.lastIndexOf('.') + 1);\n if (value === shortName) return null;\n }\n return value;\n}\n\n/**\n * Reserved key under which {@link nestedPoToDisplayRow} stashes the server-resolved breadcrumb of\n * each reference attribute (keyed by attribute name). Lets an AsDetail reference cell render the\n * label the server already resolved by id — page-independent — instead of guessing from a single\n * reference-query options page. Prefixed to avoid colliding with a real attribute name.\n */\nexport const AS_DETAIL_BREADCRUMBS_KEY = '__sparkBreadcrumbs';\n\n/**\n * Like {@link nestedPoToDict}, but for the read-only detail display path. In addition to each\n * attribute's value it preserves the server-resolved per-reference `breadcrumb` under\n * {@link AS_DETAIL_BREADCRUMBS_KEY}, so an AsDetail reference cell can render the label by id\n * regardless of whether the referenced document fits on the reference query's first options page.\n * The form/edit path keeps using {@link nestedPoToDict}, which never carries breadcrumbs.\n */\nexport function nestedPoToDisplayRow(po: PersistentObject | null | undefined): Record<string, any> {\n if (!po) return {};\n const dict: Record<string, any> = {};\n let breadcrumbs: Record<string, string> | undefined;\n for (const attr of po.attributes ?? []) {\n dict[attr.name] = displayValueForAttribute(attr);\n if (attr.dataType === 'Reference' && !attr.isArray && typeof attr.breadcrumb === 'string' && attr.breadcrumb !== '') {\n (breadcrumbs ??= {})[attr.name] = attr.breadcrumb;\n }\n }\n // Only attach the side channel when something resolved — keeps reference-free rows (the common\n // case) byte-for-byte identical to the plain flat dict.\n if (breadcrumbs) dict[AS_DETAIL_BREADCRUMBS_KEY] = breadcrumbs;\n // Same self-breadcrumb the form path carries: a nested-AsDetail COLUMN in a detail table has an\n // inner dict as its value, which used to stringify to \"[object Object]\".\n if (typeof po.breadcrumb === 'string' && po.breadcrumb !== '') {\n dict[AS_DETAIL_SELF_BREADCRUMB_KEY] = po.breadcrumb;\n }\n return dict;\n}\n\nfunction displayValueForAttribute(attr: PersistentObjectAttribute): any {\n if (attr.dataType === 'AsDetail') {\n if (attr.isArray) return (attr.objects ?? []).map(po => nestedPoToDisplayRow(po));\n return attr.object ? nestedPoToDisplayRow(attr.object) : null;\n }\n return attr.value;\n}\n\n/**\n * Builds a nested `PersistentObject` from a flat dict against the schema in\n * <paramref name=\"entityType\"/>. Used when the form is about to save — AsDetail attributes\n * are no longer sent as flat dicts in `attribute.value`; the server now requires\n * `attribute.object` / `attribute.objects` with fully scaffolded nested POs.\n *\n * `resolve` walks through AsDetail types registered elsewhere (usually the full\n * `getEntityTypes()` list, keyed by CLR type name). Nested AsDetail inside AsDetail is\n * handled recursively.\n */\nexport function dictToNestedPo(\n dict: Record<string, any> | null | undefined,\n entityType: EntityType,\n resolve: EntityTypeResolver,\n): PersistentObject {\n const attributes: PersistentObjectAttribute[] = (entityType.attributes ?? [])\n .map(attrDef => buildAttribute(attrDef, dict?.[attrDef.name], resolve));\n\n return {\n id: (dict?.['Id'] as string) ?? (dict?.['id'] as string) ?? '',\n name: entityType.name,\n objectTypeId: entityType.id,\n attributes,\n };\n}\n\nfunction buildAttribute(\n attrDef: EntityAttributeDefinition,\n raw: any,\n resolve: EntityTypeResolver,\n): PersistentObjectAttribute {\n const attr: PersistentObjectAttribute = {\n id: attrDef.id,\n name: attrDef.name,\n label: attrDef.label,\n dataType: attrDef.dataType,\n isArray: attrDef.isArray,\n isRequired: attrDef.isRequired,\n isVisible: attrDef.isVisible,\n isReadOnly: attrDef.isReadOnly,\n order: attrDef.order,\n rules: attrDef.rules ?? [],\n isValueChanged: true,\n };\n\n if (attrDef.dataType === 'AsDetail') {\n // Server expects attr.value null for AsDetail; the nested PO carries the data.\n attr.value = null;\n attr.asDetailType = attrDef.asDetailType;\n\n const nestedType = attrDef.asDetailType ? resolve(attrDef.asDetailType) : undefined;\n if (!nestedType) {\n attr.object = null;\n attr.objects = attrDef.isArray ? [] : null;\n return attr;\n }\n\n if (attrDef.isArray) {\n const items: any[] = Array.isArray(raw) ? raw : [];\n attr.objects = items.map(item => dictToNestedPo((item as Record<string, any>) ?? {}, nestedType, resolve));\n } else {\n attr.object = raw ? dictToNestedPo(raw as Record<string, any>, nestedType, resolve) : null;\n }\n return attr;\n }\n\n attr.value = raw;\n return attr;\n}\n","import { CustomActionDefinition } from './custom-action';\n\n/**\n * The custom actions a query should offer, from the entity type's full set.\n *\n * `showedOn` must include the query side. The accepted values are `\"detail\"`, `\"query\"`\n * and `\"both\"` — as the server model and the custom-actions guide have always\n * documented. Both grids previously tested for `\"list\"`, a value nothing emits, so an\n * action authored per the documentation rendered nowhere at all.\n *\n * ⚠️ This narrows what is DISPLAYED. It is NOT an authorization boundary: the grant\n * is, and it is enforced independently in `ExecuteCustomAction` regardless of which\n * query the caller clicked from — a caller can always POST directly.\n */\nexport function filterQueryActions(\n actions: CustomActionDefinition[],\n): CustomActionDefinition[] {\n return actions.filter(a => a.showedOn === 'query' || a.showedOn === 'both');\n}\n","/**\n * Parses a custom action's `selectionRule` — a cardinality expression over the number\n * of selected rows — into a predicate.\n *\n * A port of the server's `SelectionRuleParser`, and the two MUST agree: they are tested\n * against one shared fixture (`selection-rule.fixture.json`) for exactly this reason.\n * Vidyano, where this grammar comes from, has the same algorithm in C# and JavaScript and\n * the two have already drifted — one throws on a non-numeric operand where the other\n * silently permits everything.\n *\n * Grammar: `X` is the count placeholder, whitespace is insignificant, terms split on `X`\n * are AND-combined (`1<X<5` is a range), operators are `<= >= < > != =` matched in that\n * order so `>=` is never read as `>`, and a number-first term is mirrored (`0<X` is `>0`).\n *\n * Client-side this only drives whether a button is disabled. The server enforces the same\n * rule independently — and neither is an authorization boundary: the action's grant is.\n */\nexport function parseSelectionRule(rule?: string | null): (count: number) => boolean {\n if (!rule || !rule.trim()) return () => true;\n try {\n return compile(rule);\n } catch {\n // Unlike the server, which refuses to start on a malformed rule, the client cannot\n // usefully fail: the rule arrived over the wire from a server that already validated\n // it. Disabling the button is the safe direction — it never permits an action the\n // server would refuse.\n return () => false;\n }\n}\n\nconst OPERATORS = ['<=', '>=', '<', '>', '!=', '='] as const;\n\nfunction compile(rule: string): (count: number) => boolean {\n const normalized = rule.replace(/ /g, '').toUpperCase();\n const terms = normalized.split('X').filter(t => t.length > 0);\n if (terms.length === 0) throw new Error(`Selection rule '${rule}' has no condition.`);\n\n const numberFirst = !normalized.startsWith('X') && normalized.includes('X');\n const predicates = terms.map((term, i) => compileTerm(term, rule, numberFirst && i === 0));\n\n return count => predicates.every(p => p(count));\n}\n\nfunction compileTerm(term: string, rule: string, mirrored: boolean): (count: number) => boolean {\n const op = OPERATORS.find(o => (mirrored ? term.endsWith(o) : term.startsWith(o)));\n if (!op) throw new Error(`Selection rule '${rule}' has no recognised operator in '${term}'.`);\n\n const numberPart = mirrored ? term.slice(0, term.length - op.length) : term.slice(op.length);\n // Number(' ') is 0 and Number('1.5') is 1.5 — neither is a valid operand here.\n if (!/^-?\\d+$/.test(numberPart)) {\n throw new Error(`Selection rule '${rule}' has a non-numeric operand in '${term}'.`);\n }\n const value = Number(numberPart);\n const effective = mirrored ? mirror(op) : op;\n\n switch (effective) {\n case '<=': return count => count <= value;\n case '>=': return count => count >= value;\n case '<': return count => count < value;\n case '>': return count => count > value;\n case '!=': return count => count !== value;\n case '=': return count => count === value;\n default: throw new Error(`Selection rule '${rule}' has an unsupported operator '${effective}'.`);\n }\n}\n\nfunction mirror(op: string): string {\n switch (op) {\n case '<': return '>';\n case '>': return '<';\n case '<=': return '>=';\n case '>=': return '<=';\n default: return op;\n }\n}\n","import { CustomActionDefinition } from './custom-action';\nimport { parseSelectionRule } from './selection-rule';\n\nexport type SparkSelectionMode = 'none' | 'single' | 'multiple';\n\n/**\n * The selection mode a grid needs in order to satisfy the actions offered on it.\n *\n * Derived rather than configured, so a grid gains a checkbox column exactly when an\n * action needs one and is otherwise pixel-identical to a grid with no selection at all.\n * Vidyano's query grid does the same thing — it renders the checkbox column only if some\n * action is selection-gated.\n *\n * `'single'` when every gated action is satisfied by one row and refused by two; anything\n * else that cares about the count gets `'multiple'`.\n */\nexport function selectionModeFor(actions: CustomActionDefinition[]): SparkSelectionMode {\n // An action with no rule is not selection-gated: it acts on the query, not on rows.\n const gated = actions.filter(a => !!a.selectionRule?.trim());\n if (gated.length === 0) return 'none';\n\n const everyRuleWantsExactlyOne = gated.every(a => {\n const rule = parseSelectionRule(a.selectionRule);\n return rule(1) && !rule(2);\n });\n\n return everyRuleWantsExactlyOne ? 'single' : 'multiple';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAIA;AACO,MAAM,eAAe,IACxB,UAAkB,CAAC,sBAAsB,KAAK,MAAM,CAAC,IAAI,CAAC;AAExD,SAAU,kBAAkB,CAAC,EAAgC,EAAE,IAAa,EAAA;AAChF,IAAA,IAAI,CAAC,EAAE;AAAE,QAAA,OAAO,EAAE;AAClB,IAAA,MAAM,QAAQ,GAAG,IAAI,IAAI,eAAe,EAAE;IAC1C,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;AAC/D;;ACZA;;;AAGG;IACS;AAAZ,CAAA,UAAY,QAAQ,EAAA;AAClB,IAAA,QAAA,CAAA,QAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS;AACT,IAAA,QAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,kBAAoB;AACtB,CAAC,EAHW,QAAQ,KAAR,QAAQ,GAAA,EAAA,CAAA,CAAA;AAKpB;;AAEG;AACG,SAAU,eAAe,CAAC,KAAoC,EAAE,IAAc,EAAA;IAClF,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;;AAGrC,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACjD,QAAA,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AAC,IAAI,CAAC,CAAC,CAAC;AAC5B,IAAA,CAAC,CAAC;IAEF,OAAO,wBAAwB,GAAG,QAAQ,GAAG,UAAU;AACzD;;AC3BA;;AAEG;;;;"}
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, Pipe } from '@angular/core';
3
3
  import { SparkLanguageService } from '@mintplayer/ng-spark/services';
4
- import { resolveTranslation, nestedPoToDict, AS_DETAIL_BREADCRUMBS_KEY, ELookupDisplayType, nestedPoToDisplayRow } from '@mintplayer/ng-spark/models';
4
+ import { resolveTranslation, nestedPoToDict, AS_DETAIL_BREADCRUMBS_KEY, selfBreadcrumb, ELookupDisplayType, nestedPoToDisplayRow } from '@mintplayer/ng-spark/models';
5
5
 
6
6
  class TranslateKeyPipe {
7
7
  lang = inject(SparkLanguageService);
@@ -87,6 +87,14 @@ class AttributeValuePipe {
87
87
  return `${count} item${count !== 1 ? 's' : ''}`;
88
88
  }
89
89
  if (attr.object) {
90
+ // The server has already resolved this object's breadcrumb, and it can resolve templates
91
+ // this side cannot. A type's breadcrumb may name a computed property that `[IgnoreProperty]`
92
+ // keeps out of the model — HR's `Address.Crumb` is exactly that, `[Breadcrumb, IgnoreProperty]`
93
+ // — so the template `{Crumb}` has no matching attribute here and never will. Recomputing it
94
+ // client-side produced an empty string and fell through to "(object)" while the correct
95
+ // "Deinzestraat 231, 9700 Oudenaarde" sat unread on `attr.object.breadcrumb`.
96
+ if (attr.object.breadcrumb)
97
+ return attr.object.breadcrumb;
90
98
  return this.formatAsDetailValue(attrDef, nestedPoToDict(attr.object), allEntityTypes);
91
99
  }
92
100
  }
@@ -111,7 +119,12 @@ class AttributeValuePipe {
111
119
  if (result && result.trim())
112
120
  return result;
113
121
  }
114
- return '(object)';
122
+ // Last resort, reached when the type declares no breadcrumb or its template resolved to
123
+ // nothing. Joining the scalar values is always more use to a reader than "(object)", which
124
+ // named the failure rather than the row and looked identical for every unresolvable cell.
125
+ return Object.values(value)
126
+ .filter(v => v != null && typeof v !== 'object' && String(v).trim() !== '')
127
+ .join(', ');
115
128
  }
116
129
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: AttributeValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
117
130
  static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.0", ngImport: i0, type: AttributeValuePipe, isStandalone: true, name: "attributeValue" });
@@ -283,6 +296,11 @@ class AsDetailCellValuePipe {
283
296
  }
284
297
  }
285
298
  }
299
+ // A nested-AsDetail column's value is an inner dict, so String(value) produced "[object
300
+ // Object]". The flattener kept that object's server-resolved breadcrumb for exactly this.
301
+ if (col.dataType === 'AsDetail' && typeof value === 'object') {
302
+ return selfBreadcrumb(value, col.asDetailType) ?? '';
303
+ }
286
304
  return String(value);
287
305
  }
288
306
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: AsDetailCellValuePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
@@ -300,9 +318,17 @@ class AsDetailDisplayValuePipe {
300
318
  if (!value)
301
319
  return this.lang.t('notSet');
302
320
  const asDetailType = asDetailTypes[attr.name] || null;
303
- // Resolve the breadcrumb template against the nested object's own fields.
304
- // (Phase 1: flat substitution mirrors the server's transitional behavior; Phase 5
305
- // replaces this with a server-emitted breadcrumb on the nested object.)
321
+ // The server's own resolution wins, because it can render templates this side cannot: a
322
+ // breadcrumb may name a property that `[IgnoreProperty]` deliberately keeps out of the model
323
+ // (HR's `Address.Crumb`), and no amount of client-side substitution will ever find it. Passing
324
+ // the type name filters out the mapper's "template rendered blank" placeholder, which is the
325
+ // bare type name rather than an empty string — see `selfBreadcrumb`.
326
+ const resolved = selfBreadcrumb(value, asDetailType?.name);
327
+ if (resolved)
328
+ return resolved;
329
+ // Still correct for a template naming real, projected attributes (`"{Street}, {City}"`), which
330
+ // is the common case and the only one reachable on the create path, where there is no server
331
+ // object to have resolved anything yet.
306
332
  if (asDetailType?.breadcrumb) {
307
333
  const result = applyFieldTemplate(asDetailType.breadcrumb, value);
308
334
  if (result && result.trim())