@mintplayer/ng-spark 22.23.0 → 22.25.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 (71) hide show
  1. package/README.md +196 -0
  2. package/fesm2022/mintplayer-ng-spark-attribute-description.mjs +100 -47
  3. package/fesm2022/mintplayer-ng-spark-attribute-description.mjs.map +1 -1
  4. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +310 -329
  5. package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
  6. package/fesm2022/mintplayer-ng-spark-column-filter.mjs +175 -135
  7. package/fesm2022/mintplayer-ng-spark-column-filter.mjs.map +1 -1
  8. package/fesm2022/mintplayer-ng-spark-contributions.mjs +721 -0
  9. package/fesm2022/mintplayer-ng-spark-contributions.mjs.map +1 -0
  10. package/fesm2022/mintplayer-ng-spark-grid.mjs +2385 -1118
  11. package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -1
  12. package/fesm2022/mintplayer-ng-spark-history.mjs +598 -0
  13. package/fesm2022/mintplayer-ng-spark-history.mjs.map +1 -0
  14. package/fesm2022/mintplayer-ng-spark-icon.mjs +64 -27
  15. package/fesm2022/mintplayer-ng-spark-icon.mjs.map +1 -1
  16. package/fesm2022/mintplayer-ng-spark-models.mjs +405 -762
  17. package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
  18. package/fesm2022/mintplayer-ng-spark-moderation.mjs +1212 -0
  19. package/fesm2022/mintplayer-ng-spark-moderation.mjs.map +1 -0
  20. package/fesm2022/mintplayer-ng-spark-panels.mjs +60 -0
  21. package/fesm2022/mintplayer-ng-spark-panels.mjs.map +1 -0
  22. package/fesm2022/mintplayer-ng-spark-pipes.mjs +1158 -765
  23. package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
  24. package/fesm2022/mintplayer-ng-spark-po-create.mjs +273 -169
  25. package/fesm2022/mintplayer-ng-spark-po-create.mjs.map +1 -1
  26. package/fesm2022/mintplayer-ng-spark-po-detail.mjs +795 -410
  27. package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
  28. package/fesm2022/mintplayer-ng-spark-po-edit.mjs +1196 -280
  29. package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
  30. package/fesm2022/mintplayer-ng-spark-po-form.mjs +2244 -1224
  31. package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
  32. package/fesm2022/mintplayer-ng-spark-query-list.mjs +571 -303
  33. package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
  34. package/fesm2022/mintplayer-ng-spark-renderers.mjs +44 -55
  35. package/fesm2022/mintplayer-ng-spark-renderers.mjs.map +1 -1
  36. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +216 -177
  37. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
  38. package/fesm2022/mintplayer-ng-spark-routes.mjs +24 -28
  39. package/fesm2022/mintplayer-ng-spark-routes.mjs.map +1 -1
  40. package/fesm2022/mintplayer-ng-spark-services.mjs +625 -640
  41. package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
  42. package/fesm2022/mintplayer-ng-spark-shell.mjs +1031 -397
  43. package/fesm2022/mintplayer-ng-spark-shell.mjs.map +1 -1
  44. package/fesm2022/mintplayer-ng-spark-soft-delete.mjs +294 -0
  45. package/fesm2022/mintplayer-ng-spark-soft-delete.mjs.map +1 -0
  46. package/fesm2022/mintplayer-ng-spark.mjs +14 -48
  47. package/fesm2022/mintplayer-ng-spark.mjs.map +1 -1
  48. package/package.json +23 -2
  49. package/types/mintplayer-ng-spark-attribute-description.d.ts +25 -18
  50. package/types/mintplayer-ng-spark-client-operations.d.ts +139 -160
  51. package/types/mintplayer-ng-spark-column-filter.d.ts +73 -55
  52. package/types/mintplayer-ng-spark-contributions.d.ts +231 -0
  53. package/types/mintplayer-ng-spark-grid.d.ts +917 -448
  54. package/types/mintplayer-ng-spark-history.d.ts +216 -0
  55. package/types/mintplayer-ng-spark-icon.d.ts +15 -13
  56. package/types/mintplayer-ng-spark-models.d.ts +681 -573
  57. package/types/mintplayer-ng-spark-moderation.d.ts +402 -0
  58. package/types/mintplayer-ng-spark-panels.d.ts +143 -0
  59. package/types/mintplayer-ng-spark-pipes.d.ts +131 -149
  60. package/types/mintplayer-ng-spark-po-create.d.ts +46 -37
  61. package/types/mintplayer-ng-spark-po-detail.d.ts +180 -117
  62. package/types/mintplayer-ng-spark-po-edit.d.ts +367 -64
  63. package/types/mintplayer-ng-spark-po-form.d.ts +558 -373
  64. package/types/mintplayer-ng-spark-query-list.d.ts +143 -82
  65. package/types/mintplayer-ng-spark-renderers.d.ts +121 -85
  66. package/types/mintplayer-ng-spark-retry-action-modal.d.ts +31 -34
  67. package/types/mintplayer-ng-spark-routes.d.ts +7 -11
  68. package/types/mintplayer-ng-spark-services.d.ts +377 -261
  69. package/types/mintplayer-ng-spark-shell.d.ts +228 -132
  70. package/types/mintplayer-ng-spark-soft-delete.d.ts +90 -0
  71. package/types/mintplayer-ng-spark.d.ts +19 -12
@@ -1 +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 QueryColumn,\n QueryResultItem,\n SparkCellColumn,\n valueFor,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_ATTRIBUTE_RENDERERS, cellValue, 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@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 a column, or null to fall back to the default cell. */\n columnComponentFor(column: SparkCellColumn): Type<any> | null {\n if (!column.renderer) return null;\n return this.registry.find(r => r.name === column.renderer)?.columnComponent ?? null;\n }\n\n /** The registered filter-label function for a column, or null to use the server-computed text. */\n filterLabelFor(column: SparkCellColumn): ((value: unknown) => string) | null {\n if (!column.renderer) return null;\n return this.registry.find(r => r.name === column.renderer)?.filterLabel ?? null;\n }\n\n /**\n * Inputs for a query-grid cell 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: QueryResultItem, column: QueryColumn): Record<string, any> {\n return this.cellInputsFor(component, cellValue(valueFor(item, column.name)), column, item);\n }\n\n /**\n * The same contract for a row that is not a query result — an AsDetail sub-table row, which is\n * a plain dictionary of embedded values with no id and no column metadata of its own, so its\n * value cannot be read the way {@link columnInputsFor} reads one.\n *\n * Only the extraction differs; the renderer contract is identical, and stating it once is what\n * stops the two from drifting the way the cell markup already had.\n */\n cellInputsFor(component: Type<any>, value: unknown, column: SparkCellColumn, item: unknown): Record<string, any> {\n return withDeclaredInputs(component, {\n value,\n column,\n options: column.rendererOptions,\n item,\n });\n }\n\n /**\n * Loads every lookup reference the visible columns 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(columns: readonly (SparkCellColumn | EntityAttributeDefinition)[]): Promise<Record<string, LookupReference>> {\n const lookupColumns = columns.filter(c => c.lookupReferenceType);\n if (lookupColumns.length === 0) return {};\n\n const names = [...new Set(lookupColumns.map(c => c.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, SparkCellColumn } 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<SparkCellColumn>();\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 /**\n * {@link display} when it really is a `Date`, and `null` otherwise.\n *\n * Angular's `DatePipe` does not degrade on a non-date: it **throws**\n * `NG02100: InvalidPipeArgument`, which would take down the whole cell. Both cell pipes\n * deliberately fall back to the raw text for an unparseable date rather than hiding the stored\n * value, so that text reaches this component and must not be piped. A template cannot express\n * `instanceof`, hence the computed.\n */\n protected readonly dateValue = computed(() => {\n const value = this.display();\n return value instanceof Date && !Number.isNaN(value.getTime()) ? value : null;\n });\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 === 'date' || column().dataType === 'datetime') {\n <!--\n Formatted in ONE place for both grids. Before this, a date column printed whatever its pipe\n produced, which was the raw ISO string — `2026-09-07T13:25:57.3119825Z` in a table cell. Both\n cell pipes now hand over a real Date, and `date:` accepts a string too, so an unparseable value\n that fell back to text still renders as that text rather than blank.\n -->\n @if (dateValue(); as when) {\n {{ when | date:(column().dataType === 'date' ? 'mediumDate' : 'short') }}\n } @else {\n {{ display() }}\n }\n} @else if (column().dataType === 'color') {\n @if (display(); as colorVal) {\n <!-- Shares `.spark-color-swatch` with the detail page, which is where the sizing already\n lived. It used to be inline here because the grid rendered inside <mp-datatable>'s\n shadow root, where neither this component's scoped rules nor Bootstrap's arrived;\n ng-bootstrap 22.18.0 moved the datatable to the light DOM, so the class reaches it. -->\n <span class=\"spark-color-swatch d-inline-block align-middle border rounded\"\n [style.background-color]=\"colorVal\"></span>\n }\n} @else if (column().dataType === 'image') {\n @if (display(); as src) {\n <!-- `alt` is empty on purpose — the cell is decorative next to the row's own labelled\n columns, and a filename read aloud is worse than nothing. -->\n <img [src]=\"src\" alt=\"\" loading=\"lazy\" class=\"spark-grid-image align-middle rounded\">\n }\n} @else if (column().dataType === 'url') {\n @if (display(); as href) {\n <!-- rel is not optional with target=_blank: without noopener the opened page gets a handle on\n this one through window.opener, and these hrefs are data. -->\n <a [href]=\"href\" target=\"_blank\" rel=\"noopener noreferrer\">{{ href }}</a>\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, BsDatatableFilterPanelDirective, BsRowTemplateDirective, DatatableSettings, type BsDatatableFetch, type DatatableDistincts, type FilterChangeDetail } from '@mintplayer/ng-bootstrap/datatable';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { SparkQueryRefreshService } from '@mintplayer/ng-spark/client-operations';\nimport { cellValue } from '@mintplayer/ng-spark/renderers';\nimport { QueryCellValuePipe, QueryReferenceChipsPipe, ResolveTranslationPipe, TranslateKeyPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkAttributeDescriptionComponent } from '@mintplayer/ng-spark/attribute-description';\nimport { SparkLanguageService, SparkService } from '@mintplayer/ng-spark/services';\nimport { SparkColumnFilterPanelComponent } from '@mintplayer/ng-spark/column-filter';\nimport {\n CustomActionDefinition,\n EntityAttributeDefinition,\n EntityType,\n LookupReference,\n QueryColumn,\n QueryColumnFilter,\n QueryResultItem,\n SparkQuery,\n filterQueryActions,\n parseSelectionRule,\n selectionModeFor,\n valueFor,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_GRID_PAGE_SIZES, initialGridSettings, isVirtualScrollingQuery } 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, BsDatatableFilterPanelDirective, BsRowTemplateDirective, BsSpinnerComponent, SparkGridCellComponent, ResolveTranslationPipe, QueryCellValuePipe, QueryReferenceChipsPipe, TranslateKeyPipe, SparkAttributeDescriptionComponent, SparkColumnFilterPanelComponent],\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<QueryResultItem[] | 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 * Column metadata for externally supplied rows. Required whenever `data` is bound, because a\n * projection cannot describe itself — there is no per-row metadata left to infer it from.\n */\n columns = input<QueryColumn[] | null>(null);\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<QueryResultItem[]>([]);\n\n /**\n * Replaces where the first column's link points, per row.\n *\n * Return `null` to suppress the link for that row — useful when a grid mixes rows that have a\n * detail page with rows that do not.\n *\n * ⚠️ **It changes the destination, not the permission.** `canRead()` still gates whether any\n * link is rendered at all, and this function is never consulted when that gate is closed. It\n * cannot be used to reach a row the rights model withheld; it exists for the case where the\n * row's natural destination is not `/po/{type}/{id}` — a composed row that maps to a page of\n * its own, or a grid embedded in a route that owns its own child paths.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\n\n /** Emitted whenever a load or a page fetch fails, for a host in bespoke chrome. */\n error = output<HttpErrorResponse>();\n rowClicked = output<QueryResultItem>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n\n /**\n * Where the first column's link points for this row: the host's `rowRoute` when it supplied one,\n * otherwise the row's own detail page.\n *\n * A method rather than a computed because the answer is per row, and the template already\n * iterates rows — a computed would have to be a map keyed by id, rebuilt on every page.\n */\n protected rowRouteFor(row: QueryResultItem): unknown[] | null {\n const custom = this.rowRoute();\n if (custom) return custom(row);\n\n const type = this.entityType();\n\n // ⚠️ A composed type has no per-row detail page by construction: its rows are computed, and\n // `{Name}Actions.OnLoadAsync` serves ONE page which is free to ignore the id it was given. So\n // /po/{type}/{rowId} does not 404 — it silently renders that same page, which is worse, because\n // nothing looks wrong. This branch is live in DemoApp today: Read/StartPage implies\n // Query/StartPage, so the composed grid renders with canRead() true and every row linked.\n //\n // `clrType` is absent exactly for those types and is already on the wire; the grid simply never\n // consulted it. A host whose composed rows DO have a page says so with `rowRoute`.\n if (!type?.clrType) return null;\n\n return ['/po', type.alias || type.id, row.id];\n }\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\n /** Names the server withheld for this RESULT; see QueryResult.disabledActions. */\n private readonly disabledActions = signal<string[]>([]);\n\n /**\n * The actions actually offered for this result.\n *\n * The catalogue at `/spark/actions/{objectTypeId}` is per TYPE and is never told what an\n * execution returned, so an action that applies to only some results cannot be filtered there.\n * A custom query withholds what does not apply via `CustomQueryArgs.DisableActions(...)`, and\n * the answer arrives on the result.\n *\n * An affordance, not a permission -- the action handler still refuses on its own terms.\n */\n visibleCustomActions = computed(() => {\n const withheld = this.disabledActions();\n if (!withheld.length) return this.customActions();\n\n const lowered = new Set(withheld.map(name => name.toLowerCase()));\n return this.customActions().filter(action => !lowered.has(action.name.toLowerCase()));\n });\n fetchFn = signal<BsDatatableFetch<QueryResultItem> | 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 /**\n * Columns as sent with the most recent fetched page.\n *\n * A host binding `data` (streaming) supplies its own via the `columns` input instead — the\n * snapshot carries them once, exactly as a paged result does.\n */\n private readonly fetchedColumns = signal<QueryColumn[]>([]);\n\n /** Every column on the wire, drawn or not — what renderers and lookups resolve against. */\n allColumns = computed(() => this.columns() ?? this.fetchedColumns());\n\n /**\n * The columns the grid draws. `isVisible: false` ships a value without a column, so a renderer\n * can read a sibling the grid does not show; undefined means visible, so a server that predates\n * the field still draws everything.\n */\n visibleColumns = computed(() => this.allColumns().filter(c => c.isVisible !== false));\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().map(r => r.id).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 /**\n * Replaces the fetched columns only when they actually differ.\n *\n * Columns ship **once per result**, so every page fetch returns an identical set. Assigning it\n * unconditionally wrote a new array of new objects into the signal each time, re-rendering every\n * header and re-evaluating every `*bsDatatableColumn` input for no change in content.\n *\n * Compared by serialized value rather than by reference: the objects are freshly deserialized from\n * JSON on every response, so reference equality is always false and would defeat the check. A\n * dozen small objects per fetch is nothing beside the request that produced them.\n *\n * ⚠️ This was written believing it fixed a panel-teardown bug (#431 F7). Measured in a browser: it\n * does not. The columns were already identical on every fetch, so the guard hits every time and the\n * teardown had another cause entirely. Kept because avoiding a pointless re-render of every header\n * on every page is worth having on its own — but it is an optimization, not a fix, and the F7\n * question remains open.\n */\n private setFetchedColumns(columns: QueryColumn[]): void {\n const current = this.fetchedColumns();\n if (current.length === columns.length && JSON.stringify(current) === JSON.stringify(columns)) return;\n\n this.fetchedColumns.set(columns);\n }\n\n /**\n * The per-column filters currently applied (#431).\n *\n * Read inside `makeFetch`'s closure, like `search`, so a change refetches by producing a new fetch\n * identity rather than by being captured.\n */\n private readonly filters = signal<QueryColumnFilter[]>([]);\n\n /**\n * The value source behind every column's panel.\n *\n * ⚠️ **Referentially stable, and that is the whole point.** It reads `filters()` when the datatable\n * *calls* it, not when it is built — so it always sees the current filters while never changing\n * identity.\n *\n * This was a `computed` first, on the reasoning that it had to close over the current filters\n * because `DistinctsRequest` carries only `{ column, search, signal }`. That was wrong, and the way\n * it was wrong is worth keeping: a new identity reassigns `[distincts]` on the element, and the\n * component aborts the in-flight request and bumps a generation counter — so a response already on\n * its way is discarded as stale and the list renders empty over a perfectly good answer.\n *\n * Reading the signal at call time removes the race entirely and is simpler besides.\n *\n * The asked-for column's own filter is excluded: a panel must offer the values you could still\n * pick, not only the ones you already picked.\n */\n /**\n * The last complete distinct list seen per column, for translating a `< none >` selection.\n *\n * ⚠️ Only stored when the server reported the list was NOT truncated (`hasMore === false`). The\n * translation below is the complement of what is listed, so a partial list would exclude the wrong\n * set — and silently, which is the failure mode this whole feature exists to remove.\n */\n private readonly completeDistincts = new Map<string, unknown[]>();\n\n protected readonly distinctsFn: DatatableDistincts = async request => {\n const queryId = this.query()?.id;\n if (!queryId) return null;\n\n // Read at call time — never captured.\n const others = this.filters().filter(f => f.name !== request.column);\n\n // The server's shape IS the datatable's shape, so there is nothing to map.\n const result = await this.sparkService.getDistinctValues(queryId, request.column, {\n search: request.search,\n columns: others,\n parentId: this.parentId(),\n parentType: this.parentType(),\n });\n\n // A searched list is a subset by construction, so it is never a basis for a complement.\n if (result && !result.hasMore && !request.search)\n this.completeDistincts.set(request.column, result.matching.map(v => v.value));\n else\n this.completeDistincts.delete(request.column);\n\n return result;\n };\n\n /**\n * Translates one filter change into the wire shape and refetches.\n *\n * The event always arrives as the `'values'` shape because the panel only ever calls\n * `ctx.apply(...)`; comparison mode is never declared. `inverse` is a flag on the event and two\n * arrays on the wire — the translation is this method's whole job.\n */\n protected onFilterChange(detail: FilterChangeDetail): void {\n if (detail.mode !== 'values') return;\n\n const values = detail.selected.map(v => v.value);\n const next = this.filters().filter(f => f.name !== detail.column);\n\n if (values.length > 0) {\n // ⚠️ `< none >` cannot be asked for directly. The server compares against the index term, and\n // RavenDB gives a field the document never wrote NO term at all — so `Col == null` matches a\n // field written as JSON null but NOT one that is absent, while `Col != null` puts the absent row\n // with the rows that HAVE a value. Both rows render blank, the panel offers one entry for the\n // pair, and no predicate selects that pair. Measured in AbsentVersusNullFieldTests.\n //\n // The complement is expressible, though: \"none of the real values\" catches absent and null\n // alike. So a selection containing the null entry is sent as an exclusion of everything NOT\n // selected, which is exactly the same set and needs no server change.\n const complete = this.completeDistincts.get(detail.column);\n const selectsNone = values.some(v => v === null || v === undefined);\n\n if (selectsNone && !detail.inverse && complete) {\n const unselected = complete.filter(v =>\n v !== null && v !== undefined && !values.some(s => s === v));\n\n // Everything is selected, so the filter narrows nothing — drop it rather than sending an\n // empty exclusion, which would read as \"exclude nothing\" only by accident.\n if (unselected.length > 0)\n next.push({ name: detail.column, excludes: unselected });\n } else {\n next.push(detail.inverse\n ? { name: detail.column, excludes: values }\n : { name: detail.column, includes: values });\n }\n }\n\n this.filters.set(next);\n this.onFilterChanged();\n }\n\n /**\n * Back to page 1 and a fresh fetch identity, exactly as a new search term does.\n *\n * Both halves matter: the old page number means nothing against a different result set, and the\n * datatable dedupes reloads by `(page, perPage, sort)` — none of which a filter changes — so\n * without a new fetch identity the request is silently never made.\n */\n private onFilterChanged(): void {\n if (this.hasExternalData()) return;\n const s = this.settings();\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 // The sub-query's container travels with the action (#327). Without it an action invoked\n // from a company's Cars tab could not tell it was on a company's page at all — the grid knew\n // (it filters the rows by that parent) and simply dropped the fact on the way out.\n //\n // Sent as parentId/parentType, NOT as the `parent` argument: that one means an object of this\n // action's OWN type and is loaded under it server-side, so handing it a Company id for a Car\n // action refuses — correctly, and confusingly.\n const pId = this.parentId();\n const pType = this.parentType();\n await this.sparkService.executeCustomAction(\n this.entityType()!.id,\n action.name,\n undefined,\n this.selection().map(r => r.id),\n pId && pType ? { id: pId, type: pType } : undefined,\n // The query too: the server re-runs it narrowed to these ids, so the action receives the\n // rows this grid rendered rather than a re-derivation from documents.\n this.query()?.id);\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 // A filter belongs to the query it was applied to. Surviving a query switch would POST it\n // against the next query, where the column may not exist or may mean something else entirely.\n this.filters.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 // `name + 's'` because the \"-es\" rule over-strips (Vehicles -> \"Vehicl\", Roles -> \"Rol\"); the\n // page resolver in spark-query-list has always matched this way.\n return entityTypes.find(t =>\n t.name === sourceName || t.name === singular || t.name + 's' === sourceName || t.clrType?.endsWith(singular)) ?? null;\n }\n\n private makeFetch(query: SparkQuery, parentId: string, parentType: string): BsDatatableFetch<QueryResultItem> {\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 // Read inside the closure, exactly as `search` is: what forces a refetch is the fetch\n // identity `reload()` creates, not the value captured when this closure was built.\n columns: this.filters(),\n parentId, parentType,\n }).then(r => {\n this.errorMessage.set(null);\n this.resultCount.set(r.totalItems);\n // Columns come from the result now, not from the entity type: the server decides the query\n // surface (ShowedOn.Query) and is the same place the sort-column allow-list is checked.\n // ?? [] because a malformed or older response must render an empty grid, not throw inside a\n // computed — where the stack points at the column filter and not at the response that lacked them.\n this.setFetchedColumns(r.columns ?? []);\n // Per-result, so it is re-read on every page rather than latched from the first.\n this.disabledActions.set(r.disabledActions ?? []);\n return {\n data: r.items,\n totalRecords: r.totalItems,\n totalPages: Math.ceil(r.totalItems / 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 // Over ALL columns, not just the drawn ones: an undrawn column's value can still be rendered\n // by a renderer reading it as a sibling, and it would resolve to a raw key without its options.\n this.lookupReferenceOptions.set(await this.gridRenderers.loadLookupOptions(this.allColumns()));\n }\n\n /**\n * The underlying value a custom renderer receives, which is not the printable one.\n *\n * A projection is flat, so this is the cell's own value rather than a display string. It is\n * deliberately not the attribute-shaped `rendererValue`: a query row has no nested object to\n * fall back to, and reaching for one would hand every renderer `undefined`.\n */\n rendererValueFor(item: QueryResultItem, column: QueryColumn): unknown {\n return cellValue(valueFor(item, column.name));\n }\n\n getColumnRendererComponent(column: QueryColumn): Type<any> | null {\n return this.gridRenderers.columnComponentFor(column);\n }\n\n /** The renderer's optional filter-label override for this column, or null for the server text. */\n filterLabelFor(column: QueryColumn): ((value: unknown) => string) | null {\n return this.gridRenderers.filterLabelFor(column);\n }\n\n getColumnRendererInputs(component: Type<any>, item: QueryResultItem, column: QueryColumn): Record<string, any> {\n return this.gridRenderers.columnInputsFor(component, item, column);\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 [distincts]=\"distinctsFn\"\n (filterChange)=\"onFilterChange($event)\"\n [(settings)]=\"settings\">\n @for (col of visibleColumns(); track col.name) {\n <!--\n `canSort`/`canFilter` arrive already resolved by the server (query override → attribute →\n true), so this only spells the polarity. `!== false` is needed for BOTH, for opposite\n reasons: absent means capable on our wire, while the datatable's own `filterable` defaults\n to false, unlike `sortable`.\n\n ⚠️ `filterActive` and `filterSummary` are deliberately NOT bound. Any *bsDatatableColumn\n input change recomputes the column set, which retires the live filter view — while the web\n component's mount-once guard leaves the panel's nodes in place and never re-renders them.\n Binding them to state our own panel mutates would freeze the panel the instant a value is\n ticked, until it is closed and reopened. The cost is that a filtered column carries no\n visual marker yet, which is worth far less than a panel that dies on first use. See #431 F7.\n -->\n <div *bsDatatableColumn=\"col.name; sortable: col.canSort !== false; filterable: col.canFilter !== false\">\n {{ (col.label | resolveTranslation) || col.name }}\n <spark-attribute-description [description]=\"col.description\" />\n\n @if (col.canFilter !== false) {\n <ng-container *bsDatatableFilterPanel=\"let values; let ctx = ctx\">\n <spark-column-filter-panel\n [column]=\"col\"\n [values]=\"values()\"\n [ctx]=\"ctx\"\n [filterLabel]=\"filterLabelFor(col)\" />\n </ng-container>\n }\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (col of visibleColumns(); track col.name; 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 3. `rowRoute` replaces the DESTINATION only, never the gate: returning a route\n from it cannot make a row clickable that `canRead()` withheld, and returning\n null from it suppresses the link for that one row. -->\n @if (first && canRead() && rowRouteFor(row); as route) {\n <a [routerLink]=\"route\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></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-col=\"col\">\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]=\"col\"\n [display]=\"(col | queryCellValue:item:lookupReferenceOptions())\"\n [rendererValue]=\"rendererValueFor(item, col)\"\n [item]=\"item\"\n [chips]=\"(col | queryReferenceChips: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, QueryResultItem } 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<QueryResultItem[] | 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<QueryResultItem>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n /**\n * Forwarded to the grid. Without this the escape hatch was unreachable from a card — i.e. from\n * every auto-rendered sub-query and program-unit query page, which is most grids.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\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()?.visibleCustomActions() ?? []);\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 @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\n <!--\n Caption last, actions first. The auto margin is conditional rather than fixed, and that is\n the point: with actions present `ms-auto` pushes the caption to the trailing edge, and with\n none it falls back to `me-auto` so a plain card looks exactly as it always did. A fixed\n `ms-auto` would have right-aligned the caption of every action-less query card in every app\n — a change nobody asked for, to fix a layout only some cards have.\n -->\n <span [class.ms-auto]=\"customActions().length\" [class.me-auto]=\"!customActions().length\">\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 </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 [rowRoute]=\"rowRoute()\"\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;AAC3B,QAAA,OAAO,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAAE;QAC9E,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAA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EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE7F7D;;AAEG;;;;"}
1
+ {"version":3,"file":"mintplayer-ng-spark-grid.mjs","names":[],"sources":["../../grid/src/spark-grid-columns.ts","../../grid/src/spark-grid-renderers.ts","../../grid/src/spark-query-slots.ts","../../grid/src/preset-filters.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-toolbar.ts","../../grid/src/spark-search-box.component.ts","../../grid/src/spark-query-card.component.ts","../../grid/src/spark-query-card.component.html"],"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 QueryColumn,\n QueryResultItem,\n SparkCellColumn,\n valueFor,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_ATTRIBUTE_RENDERERS, cellValue, 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@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 a column, or null to fall back to the default cell. */\n columnComponentFor(column: SparkCellColumn): Type<any> | null {\n if (!column.renderer) return null;\n return this.registry.find(r => r.name === column.renderer)?.columnComponent ?? null;\n }\n\n /** The registered filter-label function for a column, or null to use the server-computed text. */\n filterLabelFor(column: SparkCellColumn): ((value: unknown) => string) | null {\n if (!column.renderer) return null;\n return this.registry.find(r => r.name === column.renderer)?.filterLabel ?? null;\n }\n\n /**\n * Inputs for a query-grid cell 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: QueryResultItem, column: QueryColumn): Record<string, any> {\n return this.cellInputsFor(component, cellValue(valueFor(item, column.name)), column, item);\n }\n\n /**\n * The same contract for a row that is not a query result — an AsDetail sub-table row, which is\n * a plain dictionary of embedded values with no id and no column metadata of its own, so its\n * value cannot be read the way {@link columnInputsFor} reads one.\n *\n * Only the extraction differs; the renderer contract is identical, and stating it once is what\n * stops the two from drifting the way the cell markup already had.\n */\n cellInputsFor(component: Type<any>, value: unknown, column: SparkCellColumn, item: unknown): Record<string, any> {\n return withDeclaredInputs(component, {\n value,\n column,\n options: column.rendererOptions,\n item,\n });\n }\n\n /**\n * Loads every lookup reference the visible columns 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(columns: readonly (SparkCellColumn | EntityAttributeDefinition)[]): Promise<Record<string, LookupReference>> {\n const lookupColumns = columns.filter(c => c.lookupReferenceType);\n if (lookupColumns.length === 0) return {};\n\n const names = [...new Set(lookupColumns.map(c => c.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 { EntityType, QueryColumnFilter } from '@mintplayer/ng-spark/models';\n\nconst NUMERIC_TYPES = new Set(['number', 'int', 'integer', 'long', 'decimal', 'double', 'float']);\n\n/**\n * The preset column filters (a query page's URL filters) that name an attribute of the query's\n * entity type, with their values coerced to the attribute's type — a URL carries only strings, and\n * the server compares a number column against numbers. Filters naming anything else are dropped, so\n * an unrelated query-string parameter never becomes a request.\n */\nexport function applicablePresetFilters(\n filters: readonly QueryColumnFilter[] | null | undefined,\n entityType: EntityType | null | undefined,\n): QueryColumnFilter[] {\n if (!filters?.length || !entityType) return [];\n const result: QueryColumnFilter[] = [];\n for (const filter of filters) {\n const attribute = (entityType.attributes ?? []).find(a => a.name === filter.name);\n if (!attribute || attribute.isVisible === false) continue;\n const coerce = (value: unknown): unknown => {\n if (typeof value !== 'string') return value;\n if (NUMERIC_TYPES.has(attribute.dataType)) {\n const n = Number(value);\n return value.trim() !== '' && Number.isFinite(n) ? n : value;\n }\n if (attribute.dataType === 'boolean') return value === 'true' ? true : value === 'false' ? false : value;\n return value;\n };\n const includes = filter.includes?.map(coerce);\n const excludes = filter.excludes?.map(coerce);\n if (!includes?.length && !excludes?.length) continue;\n result.push({ name: filter.name, ...(includes?.length ? { includes } : {}), ...(excludes?.length ? { excludes } : {}) });\n }\n return result;\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';\nimport { CommonModule, NgComponentOutlet } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport { EntityAttributeDefinition, SparkCellColumn } 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<SparkCellColumn>();\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 /**\n * {@link display} when it really is a `Date`, and `null` otherwise.\n *\n * Angular's `DatePipe` does not degrade on a non-date: it **throws**\n * `NG02100: InvalidPipeArgument`, which would take down the whole cell. Both cell pipes\n * deliberately fall back to the raw text for an unparseable date rather than hiding the stored\n * value, so that text reaches this component and must not be piped. A template cannot express\n * `instanceof`, hence the computed.\n */\n protected readonly dateValue = computed(() => {\n const value = this.display();\n return value instanceof Date && !Number.isNaN(value.getTime()) ? value : null;\n });\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 === 'date' || column().dataType === 'datetime') {\n <!--\n Formatted in ONE place for both grids. Before this, a date column printed whatever its pipe\n produced, which was the raw ISO string — `2026-09-07T13:25:57.3119825Z` in a table cell. Both\n cell pipes now hand over a real Date, and `date:` accepts a string too, so an unparseable value\n that fell back to text still renders as that text rather than blank.\n -->\n @if (dateValue(); as when) {\n {{ when | date:(column().dataType === 'date' ? 'mediumDate' : 'short') }}\n } @else {\n {{ display() }}\n }\n} @else if (column().dataType === 'color') {\n @if (display(); as colorVal) {\n <!-- Shares `.spark-color-swatch` with the detail page, which is where the sizing already\n lived. It used to be inline here because the grid rendered inside <mp-datatable>'s\n shadow root, where neither this component's scoped rules nor Bootstrap's arrived;\n ng-bootstrap 22.18.0 moved the datatable to the light DOM, so the class reaches it. -->\n <span class=\"spark-color-swatch d-inline-block align-middle border rounded\"\n [style.background-color]=\"colorVal\"></span>\n }\n} @else if (column().dataType === 'image') {\n @if (display(); as src) {\n <!-- `alt` is empty on purpose — the cell is decorative next to the row's own labelled\n columns, and a filename read aloud is worse than nothing. -->\n <img [src]=\"src\" alt=\"\" loading=\"lazy\" class=\"spark-grid-image align-middle rounded\">\n }\n} @else if (column().dataType === 'url') {\n @if (display(); as href) {\n <!-- rel is not optional with target=_blank: without noopener the opened page gets a handle on\n this one through window.opener, and these hrefs are data. -->\n <a [href]=\"href\" target=\"_blank\" rel=\"noopener noreferrer\">{{ href }}</a>\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, Injector, computed, effect, inject, input, model, output, runInInjectionContext, signal, untracked, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { NavigationEnd, Router, RouterModule } from '@angular/router';\nimport { filter, map } from 'rxjs';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsDatatableComponent, BsDatatableColumnDirective, BsDatatableFilterPanelDirective, BsRowTemplateDirective, DatatableSettings, type BsDatatableFetch, type BsDatatableRowEvent, type DatatableDistincts, type FilterChangeDetail } from '@mintplayer/ng-bootstrap/datatable';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { BsBadgeComponent } from '@mintplayer/ng-bootstrap/badge';\n// ⚠️ NOT @mintplayer/ng-bootstrap/dropdown. Its fesm (22.19.0) declares BsDropdownToggleDirective,\n// whose factory lists BsDropdownDirective as an eager dependency, BEFORE BsDropdownDirective. Linked\n// (an app build) that is harmless; evaluated unlinked — every vitest / unit-test-builder spec that\n// imports this grid, in ng-spark and in every app — it throws \"Cannot access 'BsDropdownDirective'\n// before initialization\" at import time (#460 M15, CI run a1b47012). The row menu therefore drives\n// the CDK overlay itself and keeps ng-bootstrap's menu for the look.\nimport { CdkConnectedOverlay, CdkOverlayOrigin, type ConnectedPosition } from '@angular/cdk/overlay';\nimport { BsDropdownItemDirective, BsDropdownMenuComponent } from '@mintplayer/ng-bootstrap/dropdown-menu';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SparkQueryRefreshService } from '@mintplayer/ng-spark/client-operations';\nimport { cellValue } from '@mintplayer/ng-spark/renderers';\nimport { QueryCellValuePipe, QueryReferenceChipsPipe, ResolveTranslationPipe, TranslateKeyPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkAttributeDescriptionComponent } from '@mintplayer/ng-spark/attribute-description';\nimport { SPARK_RETURN_URL_STATE_KEY, SparkLanguageService, SparkService } from '@mintplayer/ng-spark/services';\nimport { SparkColumnFilterPanelComponent } from '@mintplayer/ng-spark/column-filter';\nimport {\n CustomActionDefinition,\n EntityAttributeDefinition,\n EntityType,\n LookupReference,\n QueryColumn,\n QueryColumnFilter,\n QueryResultItem,\n SparkQuery,\n EntityPermissions,\n SparkDeletedFilter,\n filterQueryActions,\n defaultQueryActions,\n type SparkSelectionModeSetting,\n parseSelectionRule,\n selectionModeFor,\n valueFor,\n} from '@mintplayer/ng-spark/models';\nimport { SPARK_GRID_PAGE_SIZES, initialGridSettings, isVirtualScrollingQuery } from './spark-grid-columns';\nimport { applicablePresetFilters } from './preset-filters';\nimport { SparkGridRenderers } from './spark-grid-renderers';\nimport { SparkGridCellComponent } from './spark-grid-cell.component';\nimport { SparkQueryToolbarAction, sparkActionClass } from './spark-query-toolbar';\nimport { SPARK_QUERY_ROW_ACTIONS, SparkQueryRowAction, orderSparkExtensions } from '@mintplayer/ng-spark/panels';\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, BsDatatableFilterPanelDirective, BsRowTemplateDirective, BsSpinnerComponent, SparkGridCellComponent, ResolveTranslationPipe, QueryCellValuePipe, QueryReferenceChipsPipe, TranslateKeyPipe, SparkAttributeDescriptionComponent, SparkColumnFilterPanelComponent, BsBadgeComponent, CdkOverlayOrigin, CdkConnectedOverlay, BsDropdownMenuComponent, BsDropdownItemDirective, SparkIconComponent],\n templateUrl: './spark-query-grid.component.html',\n styleUrl: './spark-query-grid.component.scss',\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 private readonly injector = inject(Injector);\n /** Add-on row-menu entries (`SPARK_QUERY_ROW_ACTIONS`), e.g. Contributions' revert. */\n private readonly addonRowActions = orderSparkExtensions(inject(SPARK_QUERY_ROW_ACTIONS, { optional: true }), a => a.priority ?? 50);\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 * Column filters in force from the first fetch on — the query page's URL filters, e.g. the\n * contributions History link's `?Language=en&Script=Latn`. Only those naming an attribute of the\n * query's entity type are applied ({@link applicablePresetFilters}); see {@link appliedPresetFilters}.\n * A change replaces the previous preset (filters the user set in a column panel on other columns\n * stay) and refetches from page 1.\n */\n presetFilters = input<readonly QueryColumnFilter[]>([]);\n\n /** The preset filters actually applied, for a host to show (and offer to clear). */\n readonly appliedPresetFilters = signal<QueryColumnFilter[]>([]);\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<QueryResultItem[] | 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 * Column metadata for externally supplied rows. Required whenever `data` is bound, because a\n * projection cannot describe itself — there is no per-row metadata left to infer it from.\n */\n columns = input<QueryColumn[] | null>(null);\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 * Soft-deletion mode (#460, T2): `exclude` (the default, not sent), `include` or `only` (the\n * recycle bin). Sent with every page and distinct-values request; the server honours a widening\n * only for `ViewDeleted` holders. A change goes back to page 1 and refetches, like a filter.\n * While set, row links carry `?deleted=` so the detail page loads the row the same way — a deleted\n * row is a 404 by id otherwise.\n */\n deleted = input<SparkDeletedFilter | null | undefined>(null);\n\n /** The mode actually sent: `exclude` and \"unset\" are the same request. */\n protected readonly effectiveDeleted = computed(() => {\n const mode = this.deleted();\n return mode && mode !== 'exclude' ? mode : undefined;\n });\n\n /**\n * The rows' parent is soft-deleted (#460): the detail page it sits on was opened from the recycle\n * bin with `?deleted=only`. Nothing may be created, deleted or run under a deleted row, so the grid\n * offers no actions — the same rule as {@link recycleBin}. The fetch is unchanged.\n */\n parentDeleted = input(false);\n\n /**\n * The recycle-bin rule (#460), applied here once for every host: while the grid lists `?deleted=only`\n * (or sits under a deleted parent), it offers no New, no default Delete and no custom action, in\n * the toolbar or the row menu — as the detail page does for a row opened from the recycle bin. The\n * server would refuse them anyway: every action judges live rows, and a deleted row is a 404 to it.\n * Restore and Purge are the SoftDelete entry point's own actions, on the row's detail page.\n */\n readonly recycleBin = computed(() => this.effectiveDeleted() === 'only' || this.parentDeleted());\n\n /** Query parameters for the row links; null keeps a plain link. */\n protected readonly rowQueryParams = computed(() => {\n const mode = this.effectiveDeleted();\n return mode ? { deleted: mode } : null;\n });\n\n private readonly router = inject(Router);\n private readonly currentUrl = toSignal(\n this.router.events.pipe(filter(e => e instanceof NavigationEnd), map(() => this.router.url)),\n { initialValue: this.router.url });\n\n /**\n * Navigation state for a row link: this page's URL, so the detail page can return to this list\n * (with its `?deleted=` mode) once the row is deleted or purged. See SparkReturnNavigationService.\n */\n protected readonly rowLinkState = computed(() => ({ [SPARK_RETURN_URL_STATE_KEY]: this.currentUrl() }));\n\n /**\n * A click anywhere on a row opens it, like its first-column link — the link used to be the only\n * target, so a row whose first column was empty (\"—\") could not be opened at all. While rows are\n * selectable a click selects instead, and a double-click opens. Clicks on the link itself or on an\n * interactive element inside the row (a vote button, a checkbox) are theirs, not the row's; a\n * modified click (Ctrl, ⌘, Shift, middle) is left to the browser.\n */\n protected onRowClick(event: BsDatatableRowEvent<unknown>): void {\n if (this.selectionMode() === 'none') this.openRow(event);\n }\n\n protected onRowDblClick(event: BsDatatableRowEvent<unknown>): void {\n if (this.selectionMode() !== 'none') this.openRow(event);\n }\n\n private openRow(event: BsDatatableRowEvent<unknown>): void {\n const row = event.row as QueryResultItem | null;\n const original = event.originalEvent as MouseEvent | undefined;\n const target = original?.target as Element | null | undefined;\n if (target?.closest?.('a, button, input, select, textarea, label, [role=\"button\"]')) return;\n if (original && (original.ctrlKey || original.metaKey || original.shiftKey || original.button === 1)) return;\n if (!row || !this.canRead()) return;\n const route = this.rowRouteFor(row);\n if (!route) return;\n this.rowClicked.emit(row);\n void this.router.navigate(route, { queryParams: this.rowQueryParams() ?? undefined, state: this.rowLinkState() });\n }\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<QueryResultItem[]>([]);\n\n /**\n * Replaces where the first column's link points, per row.\n *\n * Return `null` to suppress the link for that row — useful when a grid mixes rows that have a\n * detail page with rows that do not.\n *\n * ⚠️ **It changes the destination, not the permission.** `canRead()` still gates whether any\n * link is rendered at all, and this function is never consulted when that gate is closed. It\n * cannot be used to reach a row the rights model withheld; it exists for the case where the\n * row's natural destination is not `/po/{type}/{id}` — a composed row that maps to a page of\n * its own, or a grid embedded in a route that owns its own child paths.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\n\n /**\n * Overrides the query's own `selectionMode` (#460, D17) — the detail page passes the sub-query\n * entry's. `null` (the default) defers to the query, whose absent setting is `'auto'`.\n */\n selectionModeSetting = input<SparkSelectionModeSetting | null>(null);\n\n /** Emitted whenever a load or a page fetch fails, for a host in bespoke chrome. */\n error = output<HttpErrorResponse>();\n rowClicked = output<QueryResultItem>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n /** Emitted when the toolbar's New is pressed, just before the grid navigates to the create page. */\n createClicked = output<void>();\n\n colors = Color;\n\n /**\n * Where the first column's link points for this row: the host's `rowRoute` when it supplied one,\n * otherwise the row's own detail page.\n *\n * A method rather than a computed because the answer is per row, and the template already\n * iterates rows — a computed would have to be a map keyed by id, rebuilt on every page.\n */\n protected rowRouteFor(row: QueryResultItem): unknown[] | null {\n const custom = this.rowRoute();\n if (custom) return custom(row);\n\n const type = this.entityType();\n\n // ⚠️ A composed type has no per-row detail page by construction: its rows are computed, and\n // `{Name}Actions.OnLoadAsync` serves ONE page which is free to ignore the id it was given. So\n // /po/{type}/{rowId} does not 404 — it silently renders that same page, which is worse, because\n // nothing looks wrong. This branch is live in DemoApp today: Read/StartPage implies\n // Query/StartPage, so the composed grid renders with canRead() true and every row linked.\n //\n // `clrType` is absent exactly for those types and is already on the wire; the grid simply never\n // consulted it. A host whose composed rows DO have a page says so with `rowRoute`.\n if (!type?.clrType) return null;\n\n return ['/po', type.alias || type.id, row.id];\n }\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 /** The entity type's full rights, for hosts (the query page hands them to its add-on actions). */\n permissions = signal<EntityPermissions | null>(null);\n resultCount = signal<number | null>(null);\n customActions = signal<CustomActionDefinition[]>([]);\n /** The built-in New and Delete the server listed for this caller (#460, D18); see `toolbarActions`. */\n defaultActions = signal<CustomActionDefinition[]>([]);\n\n /** Names the server withheld for this RESULT; see QueryResult.disabledActions. */\n private readonly disabledActions = signal<string[]>([]);\n\n /**\n * The actions actually offered for this result.\n *\n * The catalogue at `/spark/actions/{objectTypeId}` is per TYPE and is never told what an\n * execution returned, so an action that applies to only some results cannot be filtered there.\n * The entity's `OnDisableActionsAsync` hook withholds what does not apply to this query (#460,\n * D13), and the answer arrives on the result. The server asks the same hook when an action is\n * submitted from this query and refuses a disabled one with 403.\n */\n /**\n * Whether to offer \"New\": the type-level right, unless the result withholds `New` (or `Save`) --\n * the server's OnDisableActionsAsync said so and would refuse the create with 403 (#460, D13).\n * `canCreate` stays the bare right, since hosts read it as exactly that.\n */\n offersCreate = computed(() => {\n if (!this.canCreate() || this.recycleBin()) return false;\n const withheld = this.disabledActions().map(name => name.toLowerCase());\n return !withheld.includes('new') && !withheld.includes('save');\n });\n\n visibleCustomActions = computed(() => {\n if (this.recycleBin()) return [];\n const withheld = this.disabledActions();\n if (!withheld.length) return this.customActions();\n\n const lowered = new Set(withheld.map(name => name.toLowerCase()));\n return this.customActions().filter(action => !lowered.has(action.name.toLowerCase()));\n });\n fetchFn = signal<BsDatatableFetch<QueryResultItem> | 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 /**\n * The rendered selection mode (#460, D17): the host's override (a sub-query entry's\n * `selectionMode`), else the query's own, else `'auto'` — derived from the CUSTOM actions offered,\n * exactly as before the setting existed, so no existing grid changes behaviour. The default Delete\n * does not widen `'auto'`: selection is opt-in, and without it Delete stays reachable per row\n * through the row menu.\n */\n selectionMode = computed(() => selectionModeFor(\n this.visibleCustomActions(),\n this.selectionModeSetting() ?? this.query()?.selectionMode ?? 'auto'));\n\n /**\n * The actions a host renders in its toolbar, in one list (#460, M15): New, Delete and the custom\n * actions, each with the rule that enables it. The query card and the query-list page render this\n * same list, so the two surfaces cannot drift.\n *\n * - New: the default entry's `showedOn` includes the query, the caller holds `New/T`, and the\n * result does not withhold `New`/`Save`.\n * - Delete: likewise with `Delete/T` and `Delete`, and only while rows can be selected (otherwise\n * it could never be enabled — the row menu offers it per row instead).\n * - Custom: `visibleCustomActions()`.\n * - In the recycle bin ({@link recycleBin}) none of the three: the list is empty.\n */\n toolbarActions = computed((): SparkQueryToolbarAction[] => {\n const actions: SparkQueryToolbarAction[] = [];\n const withheld = new Set(this.disabledActions().map(name => name.toLowerCase()));\n\n for (const definition of this.defaultActions()) {\n const name = definition.name.toLowerCase();\n if (name === 'new' && this.offersCreate()) {\n actions.push({ kind: 'new', name: definition.name, definition, priority: 1 + definition.offset });\n } else if (name === 'delete' && this.offersDelete(withheld) && this.selectionMode() !== 'none') {\n actions.push({ kind: 'delete', name: definition.name, definition, priority: 5 + definition.offset });\n }\n }\n\n for (const definition of this.visibleCustomActions())\n actions.push({ kind: 'custom', name: definition.name, definition, priority: 10 + definition.offset });\n\n return actions;\n });\n\n /**\n * The per-row `⋮` menu: every offered action whose rule accepts exactly one row — Delete included,\n * whatever the selection mode. An action without a rule acts on the query, not on a row, and is\n * left to the toolbar.\n */\n rowActions = computed((): SparkQueryToolbarAction[] => {\n const withheld = new Set(this.disabledActions().map(name => name.toLowerCase()));\n const rowTaking = (definition: CustomActionDefinition) =>\n !!definition.selectionRule?.trim() && parseSelectionRule(definition.selectionRule)(1);\n\n const actions: SparkQueryToolbarAction[] = [];\n for (const definition of this.defaultActions()) {\n if (definition.name.toLowerCase() === 'delete' && this.offersDelete(withheld) && rowTaking(definition))\n actions.push({ kind: 'delete', name: definition.name, definition, priority: 5 + definition.offset });\n }\n for (const definition of this.visibleCustomActions()) {\n if (rowTaking(definition))\n actions.push({ kind: 'custom', name: definition.name, definition, priority: 10 + definition.offset });\n }\n const scope = this.rowActionScope();\n if (scope) {\n for (const addon of this.addonRowActions) {\n if (!addon.isOffered(scope)) continue;\n const priority = addon.priority ?? 50;\n actions.push({\n kind: 'addon', name: addon.id, addon, priority,\n // The menu renders a definition's display name; an add-on has only a translation key.\n definition: { name: addon.id, displayName: { en: this.lang.t(addon.labelKey) }, showedOn: 'query', refreshOnCompleted: true, offset: priority },\n });\n }\n }\n return actions;\n });\n\n /** What an add-on row action is asked whether it is offered; null until the type resolved. */\n private readonly rowActionScope = computed(() => {\n const query = this.query();\n const entityType = this.entityType();\n if (!query || !entityType) return null;\n return { query, entityType, permissions: this.permissions(), deleted: this.effectiveDeleted() ?? null };\n });\n\n /** The default Delete: not withheld by the result, and never in the recycle bin. */\n private offersDelete(withheld: Set<string>): boolean {\n return !this.recycleBin() && !withheld.has('delete');\n }\n\n /** Whether a toolbar action can run with the current selection. The server checks again. */\n isToolbarActionEnabled(action: SparkQueryToolbarAction): boolean {\n return this.isActionEnabled(action.definition);\n }\n\n /** Runs a toolbar action on the current selection. */\n async runToolbarAction(action: SparkQueryToolbarAction): Promise<void> {\n switch (action.kind) {\n case 'new':\n this.startNew();\n return;\n case 'delete':\n await this.deleteRows(this.selection().map(r => r.id), action.definition);\n return;\n default:\n await this.onCustomAction(action.definition);\n }\n }\n\n /**\n * The chip's ⊗, offered only for single selection: there the datatable renders no checkbox\n * column, so it has no header deselect-all, and a row click never deselects.\n */\n clearSelection(): void {\n this.selection.set([]);\n }\n\n /** The id of the row whose `⋮` menu is open; at most one is. */\n readonly openRowMenu = signal<string | null>(null);\n\n /** Below the toggle, right-aligned; above it when there is no room below. */\n readonly rowMenuPositions: ConnectedPosition[] = [\n { originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },\n { originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },\n ];\n\n toggleRowMenu(row: QueryResultItem): void {\n this.openRowMenu.update(open => open === row.id ? null : row.id);\n }\n\n /**\n * Closes the open row menu. With a `rowId`, only when that row's menu is the open one: a row's\n * overlay reports its outside click and its detach AFTER another row's toggle has already opened\n * that row's menu, and an unscoped close there shut the menu the user had just opened.\n */\n closeRowMenu(rowId?: string): void {\n if (rowId !== undefined && this.openRowMenu() !== rowId) return;\n this.openRowMenu.set(null);\n }\n\n /**\n * A click outside the open menu closes it — except on its own toggle, whose click handler toggles\n * it; closing here as well would reopen it at once.\n */\n onRowMenuOutsideClick(event: MouseEvent, toggle: HTMLElement, rowId: string): void {\n if (event.target instanceof Node && toggle.contains(event.target)) return;\n this.closeRowMenu(rowId);\n }\n\n /** Runs the chosen row-menu item and closes the menu. */\n async chooseRowAction(action: SparkQueryToolbarAction, row: QueryResultItem): Promise<void> {\n this.closeRowMenu();\n await this.runRowAction(action, row);\n }\n\n /**\n * Runs a row-menu action on that ONE row. The checkbox selection is neither read nor changed:\n * the menu is a shortcut for this row, not a second way to tick it.\n */\n async runRowAction(action: SparkQueryToolbarAction, row: QueryResultItem): Promise<void> {\n if (action.kind === 'delete') {\n await this.deleteRows([row.id], action.definition);\n return;\n }\n if (action.kind === 'addon' && action.addon) {\n await this.runAddonRowAction(action.addon, row);\n return;\n }\n await this.onCustomAction(action.definition, [row.id]);\n }\n\n /** An add-on row action, in this grid's injection context; a failure lands in the grid's alert. */\n private async runAddonRowAction(addon: SparkQueryRowAction, row: QueryResultItem): Promise<void> {\n const scope = this.rowActionScope();\n if (!scope) return;\n try {\n this.errorMessage.set(null);\n await runInInjectionContext(this.injector, () => addon.run({ ...scope, row, reload: () => this.reload() }));\n } catch (e) {\n const err = e as HttpErrorResponse;\n const first = err?.error?.result?.errors?.[0];\n const validation = typeof first?.errorMessage === 'string'\n ? first.errorMessage\n : first?.errorMessage ? this.lang.resolve(first.errorMessage) : '';\n this.errorMessage.set(\n validation\n || first?.message\n || err?.error?.result?.error\n || err?.error?.error\n || (err?.status === 404 ? this.lang.t('spark.query.unavailable') : '')\n || err?.message\n || this.lang.t('common.actionFailed')\n || 'Action failed');\n }\n }\n\n /**\n * New from this grid: the create page, carrying the sub-query's parent (#460, D19) as query\n * parameters so it survives the navigation and a reload of the create page. The server's\n * `OnNewAsync` receives the parent; its base fills the parent reference.\n */\n startNew(): void {\n const type = this.entityType();\n if (!type) return;\n this.createClicked.emit();\n\n const parentId = this.parentId();\n const parentType = this.parentType();\n const query = this.query();\n const queryParams = parentId && parentType && query\n ? { parentId, parentType, queryId: query.alias || query.id }\n : undefined;\n void this.router.navigate(['/po', type.alias || type.id, 'new'], { queryParams, state: this.rowLinkState() });\n }\n\n /**\n * The default Delete on `ids`: one request, all rows or none (#460, D18). Asks first — with the\n * entry's `confirmationMessageKey` — then clears the selection and refreshes.\n */\n async deleteRows(ids: string[], definition?: CustomActionDefinition): Promise<void> {\n const type = this.entityType();\n if (!type || !ids.length) return;\n\n const key = definition?.confirmationMessageKey;\n const message = ids.length === 1\n ? this.lang.t('common.confirmDelete')\n : (key ? this.lang.t(key) : '') || this.lang.t('common.confirmDeleteSelected');\n if (!confirm(`${message || 'Are you sure?'}${ids.length > 1 ? ` (${ids.length})` : ''}`)) return;\n\n const parentId = this.parentId();\n const parentType = this.parentType();\n try {\n await this.sparkService.deleteMany(type.id, ids, {\n queryId: this.query()?.id,\n ...(parentId && parentType ? { parentId, parentType } : {}),\n });\n const removed = new Set(ids);\n this.selection.set(this.selection().filter(r => !removed.has(r.id)));\n this.reload();\n } catch (e) {\n const err = e as HttpErrorResponse;\n this.errorMessage.set(\n err.error?.result?.errors?.[0]?.message\n || err.error?.result?.error\n || err.error?.error\n || (err.status === 404 ? this.lang.t('common.deleteRefused') : '')\n || err.message\n || this.lang.t('common.actionFailed')\n || 'Action failed');\n }\n }\n\n isVirtualScrolling = computed(() => isVirtualScrollingQuery(this.query()));\n\n /**\n * Columns as sent with the most recent fetched page.\n *\n * A host binding `data` (streaming) supplies its own via the `columns` input instead — the\n * snapshot carries them once, exactly as a paged result does.\n */\n private readonly fetchedColumns = signal<QueryColumn[]>([]);\n\n /** Every column on the wire, drawn or not — what renderers and lookups resolve against. */\n allColumns = computed(() => this.columns() ?? this.fetchedColumns());\n\n /**\n * The columns the grid draws. `isVisible: false` ships a value without a column, so a renderer\n * can read a sibling the grid does not show; undefined means visible, so a server that predates\n * the field still draws everything.\n */\n visibleColumns = computed(() => this.allColumns().filter(c => c.isVisible !== false));\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().map(r => r.id).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 //\n // ⚠️ A new term also CLEARS the selection (#460 M15, D17 addendum), on both surfaces — the card\n // and the query-list page — and in both transports. Reconciling it with the new rows was the\n // alternative and was rejected: the grid only ever holds one page, so a ticked row that is merely\n // on another page of the searched result would be indistinguishable from one the search excluded,\n // and a bulk Delete would then act on rows the user can no longer see. Clearing keeps the\n // \"N selected\" chip equal to what is ticked on screen, exactly as the soft-deletion mode does.\n let firstSearch = true;\n effect(() => {\n this.search();\n if (firstSearch) { firstSearch = false; return; }\n untracked(() => {\n this.selection.set([]);\n this.onSearchChanged();\n });\n });\n\n // New preset (URL) filters: swap them for the previous preset, keep the user's own column\n // filters on other columns, back to page 1. Skips the first run — loadData applies the initial set.\n let firstPreset = true;\n effect(() => {\n const presetFilters = this.presetFilters();\n if (firstPreset) { firstPreset = false; return; }\n untracked(() => {\n const next = applicablePresetFilters(presetFilters, this.entityType());\n const previous = new Set(this.appliedPresetFilters().map(f => f.name));\n const replaced = new Set(next.map(f => f.name));\n this.appliedPresetFilters.set(next);\n this.filters.set([...this.filters().filter(f => !previous.has(f.name) && !replaced.has(f.name)), ...next]);\n this.selection.set([]);\n this.onFilterChanged();\n });\n });\n\n // A different soft-deletion mode is a different result set: page 1, fresh fetch identity. The\n // selection is dropped too — ids ticked in the recycle bin are not rows of the live list.\n let firstDeleted = true;\n effect(() => {\n this.effectiveDeleted();\n if (firstDeleted) { firstDeleted = false; return; }\n untracked(() => {\n this.selection.set([]);\n this.onFilterChanged();\n });\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 /**\n * Replaces the fetched columns only when they actually differ.\n *\n * Columns ship **once per result**, so every page fetch returns an identical set. Assigning it\n * unconditionally wrote a new array of new objects into the signal each time, re-rendering every\n * header and re-evaluating every `*bsDatatableColumn` input for no change in content.\n *\n * Compared by serialized value rather than by reference: the objects are freshly deserialized from\n * JSON on every response, so reference equality is always false and would defeat the check. A\n * dozen small objects per fetch is nothing beside the request that produced them.\n *\n * ⚠️ This was written believing it fixed a panel-teardown bug (#431 F7). Measured in a browser: it\n * does not. The columns were already identical on every fetch, so the guard hits every time and the\n * teardown had another cause entirely. Kept because avoiding a pointless re-render of every header\n * on every page is worth having on its own — but it is an optimization, not a fix, and the F7\n * question remains open.\n */\n private setFetchedColumns(columns: QueryColumn[]): void {\n const current = this.fetchedColumns();\n if (current.length === columns.length && JSON.stringify(current) === JSON.stringify(columns)) return;\n\n this.fetchedColumns.set(columns);\n }\n\n /**\n * The per-column filters currently applied (#431).\n *\n * Read inside `makeFetch`'s closure, like `search`, so a change refetches by producing a new fetch\n * identity rather than by being captured.\n */\n private readonly filters = signal<QueryColumnFilter[]>([]);\n\n /**\n * The value source behind every column's panel.\n *\n * ⚠️ **Referentially stable, and that is the whole point.** It reads `filters()` when the datatable\n * *calls* it, not when it is built — so it always sees the current filters while never changing\n * identity.\n *\n * This was a `computed` first, on the reasoning that it had to close over the current filters\n * because `DistinctsRequest` carries only `{ column, search, signal }`. That was wrong, and the way\n * it was wrong is worth keeping: a new identity reassigns `[distincts]` on the element, and the\n * component aborts the in-flight request and bumps a generation counter — so a response already on\n * its way is discarded as stale and the list renders empty over a perfectly good answer.\n *\n * Reading the signal at call time removes the race entirely and is simpler besides.\n *\n * The asked-for column's own filter is excluded: a panel must offer the values you could still\n * pick, not only the ones you already picked.\n */\n /**\n * The last complete distinct list seen per column, for translating a `< none >` selection.\n *\n * ⚠️ Only stored when the server reported the list was NOT truncated (`hasMore === false`). The\n * translation below is the complement of what is listed, so a partial list would exclude the wrong\n * set — and silently, which is the failure mode this whole feature exists to remove.\n */\n private readonly completeDistincts = new Map<string, unknown[]>();\n\n protected readonly distinctsFn: DatatableDistincts = async request => {\n const queryId = this.query()?.id;\n if (!queryId) return null;\n\n // Read at call time — never captured.\n const others = this.filters().filter(f => f.name !== request.column);\n\n // The server's shape IS the datatable's shape, so there is nothing to map.\n // The grid's own search too (#460 M15), read at call time like the filters: the values are\n // drawn from the rows the searched grid shows, not from the whole query.\n const querySearch = this.search() || undefined;\n const parentId = this.parentId();\n const parentType = this.parentType();\n const result = await this.sparkService.getDistinctValues(queryId, request.column, {\n search: request.search,\n querySearch,\n columns: others,\n parentId,\n parentType,\n deleted: this.effectiveDeleted(),\n // The same parent mode as the grid's own fetch (#460), and under the same condition.\n parentDeleted: this.parentDeleted() && parentId && parentType ? 'include' : undefined,\n });\n\n // A searched list is a subset by construction, so it is never a basis for a complement — and\n // that holds for the grid's search as much as for the panel's own.\n if (result && !result.hasMore && !request.search && !querySearch)\n this.completeDistincts.set(request.column, result.matching.map(v => v.value));\n else\n this.completeDistincts.delete(request.column);\n\n return result;\n };\n\n /**\n * Translates one filter change into the wire shape and refetches.\n *\n * The event always arrives as the `'values'` shape because the panel only ever calls\n * `ctx.apply(...)`; comparison mode is never declared. `inverse` is a flag on the event and two\n * arrays on the wire — the translation is this method's whole job.\n */\n protected onFilterChange(detail: FilterChangeDetail): void {\n if (detail.mode !== 'values') return;\n\n const values = detail.selected.map(v => v.value);\n const next = this.filters().filter(f => f.name !== detail.column);\n\n if (values.length > 0) {\n // ⚠️ `< none >` cannot be asked for directly. The server compares against the index term, and\n // RavenDB gives a field the document never wrote NO term at all — so `Col == null` matches a\n // field written as JSON null but NOT one that is absent, while `Col != null` puts the absent row\n // with the rows that HAVE a value. Both rows render blank, the panel offers one entry for the\n // pair, and no predicate selects that pair. Measured in AbsentVersusNullFieldTests.\n //\n // The complement is expressible, though: \"none of the real values\" catches absent and null\n // alike. So a selection containing the null entry is sent as an exclusion of everything NOT\n // selected, which is exactly the same set and needs no server change.\n const complete = this.completeDistincts.get(detail.column);\n const selectsNone = values.some(v => v === null || v === undefined);\n\n if (selectsNone && !detail.inverse && complete) {\n const unselected = complete.filter(v =>\n v !== null && v !== undefined && !values.some(s => s === v));\n\n // Everything is selected, so the filter narrows nothing — drop it rather than sending an\n // empty exclusion, which would read as \"exclude nothing\" only by accident.\n if (unselected.length > 0)\n next.push({ name: detail.column, excludes: unselected });\n } else {\n next.push(detail.inverse\n ? { name: detail.column, excludes: values }\n : { name: detail.column, includes: values });\n }\n }\n\n this.filters.set(next);\n this.onFilterChanged();\n }\n\n /**\n * Back to page 1 and a fresh fetch identity, exactly as a new search term does.\n *\n * Both halves matter: the old page number means nothing against a different result set, and the\n * datatable dedupes reloads by `(page, perPage, sort)` — none of which a filter changes — so\n * without a new fetch identity the request is silently never made.\n */\n private onFilterChanged(): void {\n if (this.hasExternalData()) return;\n const s = this.settings();\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 /**\n * Runs a custom action on the selection — or on `rowIds` when given (the row menu), which leaves\n * the checkbox selection untouched.\n */\n async onCustomAction(action: CustomActionDefinition, rowIds?: string[]): 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 // The sub-query's container travels with the action (#327). Without it an action invoked\n // from a company's Cars tab could not tell it was on a company's page at all — the grid knew\n // (it filters the rows by that parent) and simply dropped the fact on the way out.\n //\n // Sent as parentId/parentType, NOT as the `parent` argument: that one means an object of this\n // action's OWN type and is loaded under it server-side, so handing it a Company id for a Car\n // action refuses — correctly, and confusingly.\n const pId = this.parentId();\n const pType = this.parentType();\n await this.sparkService.executeCustomAction(\n this.entityType()!.id,\n action.name,\n undefined,\n rowIds ?? this.selection().map(r => r.id),\n pId && pType ? { id: pId, type: pType } : undefined,\n // The query too: the server re-runs it narrowed to these ids, so the action receives the\n // rows this grid rendered rather than a re-derivation from documents.\n this.query()?.id);\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.permissions.set(null);\n this.customActions.set([]);\n this.defaultActions.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 // A filter belongs to the query it was applied to. Surviving a query switch would POST it\n // against the next query, where the column may not exist or may mean something else entirely.\n this.filters.set([]);\n // The previous query's columns too: the new datatable would otherwise size its columns from\n // them against the new query's first page, and keep those widths for column names that no\n // longer exist (see the row-actions column in the template).\n this.fetchedColumns.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 // The host's preset (URL) filters, now that the type can validate them. Untracked: this runs\n // inside the loading effect, and a preset change has its own cheaper path (see the constructor).\n const preset = applicablePresetFilters(untracked(() => this.presetFilters()), et);\n this.appliedPresetFilters.set(preset);\n this.filters.set([...preset]);\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 this.permissions.set(permissions);\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 this.defaultActions.set(defaultQueryActions(actions));\n } else if (resolvedQuery) {\n // Said out loud: with no entity type there are no permissions and no actions to ask for, and\n // a grid that silently offers nothing reads exactly like \"this type has no actions\" (M15).\n console.warn(`[spark] Query '${resolvedQuery.name}' names entity type '${resolvedQuery.entityType ?? resolvedQuery.source}', `\n + 'which resolves to no type in /spark/types; the grid offers no actions and no row links.');\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 // `name + 's'` because the \"-es\" rule over-strips (Vehicles -> \"Vehicl\", Roles -> \"Rol\"); the\n // page resolver in spark-query-list has always matched this way.\n return entityTypes.find(t =>\n t.name === sourceName || t.name === singular || t.name + 's' === sourceName || t.clrType?.endsWith(singular)) ?? null;\n }\n\n private makeFetch(query: SparkQuery, parentId: string, parentType: string): BsDatatableFetch<QueryResultItem> {\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 // Read inside the closure, exactly as `search` is: what forces a refetch is the fetch\n // identity `reload()` creates, not the value captured when this closure was built.\n columns: this.filters(),\n parentId, parentType,\n // Only when set, so a plain grid's request body is exactly what it was before #460.\n ...(this.effectiveDeleted() ? { deleted: this.effectiveDeleted() } : {}),\n // A deleted parent (#460) is resolved including deleted rows; its children keep `deleted`.\n ...(this.parentDeleted() && parentId && parentType ? { parentDeleted: 'include' as const } : {}),\n }).then(r => {\n this.errorMessage.set(null);\n this.resultCount.set(r.totalItems);\n // Columns come from the result now, not from the entity type: the server decides the query\n // surface (ShowedOn.Query) and is the same place the sort-column allow-list is checked.\n // ?? [] because a malformed or older response must render an empty grid, not throw inside a\n // computed — where the stack points at the column filter and not at the response that lacked them.\n this.setFetchedColumns(r.columns ?? []);\n // Per-result, so it is re-read on every page rather than latched from the first.\n this.disabledActions.set(r.disabledActions ?? []);\n return {\n data: r.items,\n totalRecords: r.totalItems,\n totalPages: Math.ceil(r.totalItems / 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 // Over ALL columns, not just the drawn ones: an undrawn column's value can still be rendered\n // by a renderer reading it as a sibling, and it would resolve to a raw key without its options.\n this.lookupReferenceOptions.set(await this.gridRenderers.loadLookupOptions(this.allColumns()));\n }\n\n /**\n * The underlying value a custom renderer receives, which is not the printable one.\n *\n * A projection is flat, so this is the cell's own value rather than a display string. It is\n * deliberately not the attribute-shaped `rendererValue`: a query row has no nested object to\n * fall back to, and reaching for one would hand every renderer `undefined`.\n */\n rendererValueFor(item: QueryResultItem, column: QueryColumn): unknown {\n return cellValue(valueFor(item, column.name));\n }\n\n getColumnRendererComponent(column: QueryColumn): Type<any> | null {\n return this.gridRenderers.columnComponentFor(column);\n }\n\n /** The renderer's optional filter-label override for this column, or null for the server text. */\n filterLabelFor(column: QueryColumn): ((value: unknown) => string) | null {\n return this.gridRenderers.filterLabelFor(column);\n }\n\n getColumnRendererInputs(component: Type<any>, item: QueryResultItem, column: QueryColumn): Record<string, any> {\n return this.gridRenderers.columnInputsFor(component, item, column);\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 <!--\n The selection bar (#460, M15): the \"N selected\" chip, only while rows are selected, and part\n of the grid rather than of a host, so the query card and the query-list page show the same\n thing. There is deliberately no select-all (owner decision, 2026-09-29): with paged, lazy or\n virtual-scrolled rows it could only tick the rows loaded so far. Deselect-all is the\n datatable's own header checkbox, which it shows only while a row is selected; the chip does\n not repeat it. Single selection has no checkbox column, so no header checkbox either, and a\n row click only ever selects: there the chip's ⊗ is the deselect. The bar keeps its height\n while empty, so ticking the first row does not push the table down under the pointer.\n -->\n @if (selectionMode() !== 'none') {\n <div class=\"spark-selection-bar d-flex align-items-center gap-2 mb-2\" style=\"min-height: 1.5rem\">\n @if (selection().length) {\n <bs-badge [type]=\"colors.primary\" class=\"spark-selection-chip\">\n {{ selection().length }} {{ 'common.selected' | t }}\n @if (selectionMode() === 'single') {\n <button type=\"button\" class=\"spark-selection-clear\"\n [attr.aria-label]=\"'common.clearSelection' | t\" (click)=\"clearSelection()\">\n <spark-icon name=\"x-circle\" />\n </button>\n }\n </bs-badge>\n }\n </div>\n }\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 [distincts]=\"distinctsFn\"\n (filterChange)=\"onFilterChange($event)\"\n (rowClick)=\"onRowClick($event)\"\n (rowDblClick)=\"onRowDblClick($event)\"\n [(settings)]=\"settings\">\n @for (col of visibleColumns(); track col.name) {\n <!--\n `canSort`/`canFilter` arrive already resolved by the server (query override → attribute →\n true), so this only spells the polarity. `!== false` is needed for BOTH, for opposite\n reasons: absent means capable on our wire, while the datatable's own `filterable` defaults\n to false, unlike `sortable`.\n\n ⚠️ `filterActive` and `filterSummary` are deliberately NOT bound. Any *bsDatatableColumn\n input change recomputes the column set, which retires the live filter view — while the web\n component's mount-once guard leaves the panel's nodes in place and never re-renders them.\n Binding them to state our own panel mutates would freeze the panel the instant a value is\n ticked, until it is closed and reopened. The cost is that a filtered column carries no\n visual marker yet, which is worth far less than a panel that dies on first use. See #431 F7.\n -->\n <div *bsDatatableColumn=\"col.name; sortable: col.canSort !== false; filterable: col.canFilter !== false\">\n {{ (col.label | resolveTranslation) || col.name }}\n <spark-attribute-description [description]=\"col.description\" />\n\n @if (col.canFilter !== false) {\n <ng-container *bsDatatableFilterPanel=\"let values; let ctx = ctx\">\n <spark-column-filter-panel\n [column]=\"col\"\n [values]=\"values()\"\n [ctx]=\"ctx\"\n [filterLabel]=\"filterLabelFor(col)\" />\n </ng-container>\n }\n </div>\n }\n <!--\n The per-row ⋮ menu's column: no header, never sorted or filtered.\n\n ⚠️ Only once the data columns exist. Those ship WITH the first page, so the rows reach the\n datatable one render before the column templates do. The datatable sizes its columns ONCE,\n from the first render that has both columns and rows, then switches to `table-layout: fixed`\n and never measures again. If this column were already registered it would be the only one\n measured; the data columns would share what it left over equally, and at phone width their\n unclipped headers ran into each other. With no column at all the datatable waits.\n -->\n @if (rowActions().length && visibleColumns().length) {\n <div *bsDatatableColumn=\"'__sparkRowActions'; sortable: false; filterable: false\">\n <span class=\"visually-hidden\">{{ 'common.actions' | t }}</span>\n </div>\n }\n\n <ng-container *bsRowTemplate=\"let item\">\n @let row = $any(item);\n @for (col of visibleColumns(); track col.name; 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 3. `rowRoute` replaces the DESTINATION only, never the gate: returning a route\n from it cannot make a row clickable that `canRead()` withheld, and returning\n null from it suppresses the link for that one row. -->\n @if (first && canRead() && rowRouteFor(row); as route) {\n <a [routerLink]=\"route\" [queryParams]=\"rowQueryParams()\" [state]=\"rowLinkState()\"\n (click)=\"rowClicked.emit(row)\">\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n </a>\n } @else {\n <ng-container *ngTemplateOutlet=\"cellContent; context: { $implicit: row, col: col }\"></ng-container>\n }\n } @else {\n &nbsp;\n }\n </td>\n }\n @if (rowActions().length) {\n <!-- The row menu: every action whose rule accepts one row, run on THIS row only. The\n checkbox selection is left alone (runRowAction never reads or writes it). -->\n <td class=\"spark-row-actions text-end\" (click)=\"$event.stopPropagation()\" (dblclick)=\"$event.stopPropagation()\">\n @if (row) {\n <button type=\"button\" cdkOverlayOrigin #rowMenuOrigin=\"cdkOverlayOrigin\" #rowMenuToggle\n class=\"btn btn-sm btn-link spark-row-menu-toggle\"\n aria-haspopup=\"menu\" [attr.aria-expanded]=\"openRowMenu() === row.id\"\n [attr.aria-label]=\"'common.actions' | t\" (click)=\"toggleRowMenu(row)\">\n <spark-icon name=\"three-dots-vertical\" />\n </button>\n <ng-template cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"rowMenuOrigin\"\n [cdkConnectedOverlayOpen]=\"openRowMenu() === row.id\"\n [cdkConnectedOverlayPositions]=\"rowMenuPositions\"\n (overlayOutsideClick)=\"onRowMenuOutsideClick($event, rowMenuToggle, row.id)\"\n (overlayKeydown)=\"$event.key === 'Escape' && closeRowMenu(row.id)\"\n (detach)=\"closeRowMenu(row.id)\">\n <bs-dropdown-menu class=\"spark-row-menu\">\n @for (action of rowActions(); track action.name) {\n <li bsDropdownItem class=\"spark-row-action\" [attr.data-action]=\"action.name\"\n (click)=\"chooseRowAction(action, row)\">\n {{ action.definition.displayName | resolveTranslation }}\n </li>\n }\n </bs-dropdown-menu>\n </ng-template>\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-col=\"col\">\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]=\"col\"\n [display]=\"(col | queryCellValue:item:lookupReferenceOptions())\"\n [rendererValue]=\"rendererValueFor(item, col)\"\n [item]=\"item\"\n [chips]=\"(col | queryReferenceChips:item)\" />\n</ng-template>\n","import { CustomActionDefinition } from '@mintplayer/ng-spark/models';\nimport type { SparkQueryRowAction } from '@mintplayer/ng-spark/panels';\n\n/**\n * One button of a query's toolbar (#460, M15): the built-in New or Delete, or a custom action.\n *\n * Built by `SparkQueryGridComponent.toolbarActions()` and rendered by every host of the grid — the\n * query card's header and the query-list page's action bar — so both surfaces offer the same\n * actions, enabled by the same rules.\n */\nexport interface SparkQueryToolbarAction {\n kind: 'new' | 'delete' | 'custom' | 'addon';\n /** For `addon` (row menu only): the add-on's entry (`SPARK_QUERY_ROW_ACTIONS`). */\n addon?: SparkQueryRowAction;\n /** The action's name, unique within the toolbar. */\n name: string;\n /** Its catalogue entry: label, icon, `selectionRule`, `variant`, confirmation. */\n definition: CustomActionDefinition;\n /** `*bsPriorityNavItem` priority: New first, then Delete, then custom actions by offset. */\n priority: number;\n}\n\n/**\n * The button classes for an action's `variant`: an allow-list, so a typo cannot inject a class, and\n * the neutral outline default for anything else. Shared by the detail page, the query card and the\n * query-list page.\n */\nexport function sparkActionClass(definition: CustomActionDefinition, size?: 'sm'): string {\n const variant = definition.variant?.toLowerCase();\n const sizeClass = size ? ` btn-${size}` : '';\n switch (variant) {\n case 'danger':\n case 'warning':\n case 'primary':\n case 'secondary':\n case 'success':\n return `btn btn-${variant}${sizeClass}`;\n default:\n return `btn btn-outline-primary${sizeClass}`;\n }\n}\n","import { ChangeDetectionStrategy, Component, DestroyRef, effect, inject, input, model, signal, untracked } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { BsFormComponent, BsFormControlDirective } from '@mintplayer/ng-bootstrap/form';\nimport { BsInputGroupComponent } from '@mintplayer/ng-bootstrap/input-group';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { TranslateKeyPipe } from '@mintplayer/ng-spark/pipes';\n\n/** How long typing must pause before the term is published, in milliseconds. */\nexport const SPARK_SEARCH_DEBOUNCE_MS = 300;\n\n/**\n * The query search box: a magnifier, the input and a clear button (#460 M15, D17 addendum).\n *\n * One component for both surfaces that search a query — the query-list page above its grid and the\n * `<spark-query-card>` header next to its actions, as Vidyano's sub-query tabs have it — so they\n * behave identically: the same debounce, the same clear button, the same placeholder.\n *\n * Two-way bound through `term`, which is what a grid's `search` input takes:\n *\n * ```html\n * <spark-search-box [(term)]=\"searchTerm\" />\n * <spark-query-grid [search]=\"searchTerm()\" … />\n * ```\n *\n * Typing publishes the term once it has paused for {@link SPARK_SEARCH_DEBOUNCE_MS}, so a word is\n * one query rather than one per keystroke. Clearing (the ✕ button, or Escape) publishes at once. A\n * `term` set from outside — a host resetting it — replaces what the box shows.\n */\n@Component({\n selector: 'spark-search-box',\n imports: [FormsModule, BsFormComponent, BsFormControlDirective, BsInputGroupComponent, SparkIconComponent, TranslateKeyPipe],\n template: `\n <bs-form>\n <bs-input-group [size]=\"size()\">\n <span class=\"addon\">\n <spark-icon name=\"search\" />\n </span>\n <input\n type=\"text\"\n class=\"spark-search-input\"\n [attr.aria-label]=\"'common.search' | t\"\n [placeholder]=\"'common.search' | t\"\n [ngModel]=\"text()\"\n (ngModelChange)=\"onInput($event)\"\n (keydown.escape)=\"clear()\">\n @if (text()) {\n <button\n type=\"button\"\n class=\"btn btn-outline-secondary spark-search-clear\"\n [attr.aria-label]=\"'common.clearSearch' | t\"\n (click)=\"clear()\">\n <spark-icon name=\"x-lg\" />\n </button>\n }\n </bs-input-group>\n </bs-form>\n `,\n styles: [`\n :host { display: block; }\n /* bs-form renders a <form>; in a card header it must not add the page form's spacing. */\n :host ::ng-deep form { margin: 0; }\n `],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SparkSearchBoxComponent {\n /** The published search term. Debounced while typing; immediate on clear. */\n readonly term = model<string>('');\n\n /** The input group's size: `sm` for a card header, the default for a page. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n\n /** Overrides {@link SPARK_SEARCH_DEBOUNCE_MS}; `0` publishes on every keystroke. */\n readonly debounce = input<number>(SPARK_SEARCH_DEBOUNCE_MS);\n\n /** What the input shows, which runs ahead of `term` while the debounce is pending. */\n protected readonly text = signal('');\n\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n // A term set from outside replaces the text. Reading only `term` keeps typing (which writes\n // `text` first and `term` later) from bouncing back into the box mid-word.\n effect(() => {\n const term = this.term();\n untracked(() => {\n if (term !== this.text()) {\n this.cancelPending();\n this.text.set(term);\n }\n });\n });\n\n inject(DestroyRef).onDestroy(() => this.cancelPending());\n }\n\n protected onInput(value: string): void {\n this.text.set(value ?? '');\n this.cancelPending();\n\n const delay = this.debounce();\n if (delay <= 0 || !value) {\n // Emptying the box by hand is a clear: publish at once, like the button.\n this.term.set(value ?? '');\n return;\n }\n this.timer = setTimeout(() => {\n this.timer = null;\n this.term.set(this.text());\n }, delay);\n }\n\n /** Empties the box and publishes the empty term at once. */\n clear(): void {\n this.cancelPending();\n this.text.set('');\n this.term.set('');\n }\n\n private cancelPending(): void {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, contentChildren, input, linkedSignal, 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, QueryResultItem, type SparkDeletedFilter, type SparkSelectionModeSetting } from '@mintplayer/ng-spark/models';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SparkQueryToolbarAction, sparkActionClass } from './spark-query-toolbar';\nimport { inject } from '@angular/core';\nimport { SparkQueryGridComponent } from './spark-query-grid.component';\nimport { SparkSearchBoxComponent } from './spark-search-box.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, SparkSearchBoxComponent, ResolveTranslationPipe, SparkIconComponent],\n // The search box keeps a steady width beside the actions; the priority nav gives way first.\n styles: ['.spark-query-card-search { flex: 0 1 14rem; min-width: 8rem; }'],\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<QueryResultItem[] | null>(null);\n\n /**\n * The initial search term. The header's search box starts from it and the user takes over from\n * there; a new value from the host replaces what was typed.\n */\n search = input<string>('');\n\n /**\n * Whether the header offers the search box (#460 M15, D17 addendum). On by default, as every\n * Vidyano sub-query tab has one; a card over bound `data` never shows it, because the grid does\n * not refetch bound rows and the box would do nothing.\n */\n searchable = input<boolean>(true);\n\n /** What the grid searches: the host's `search`, until the user types in the header box. */\n readonly searchTerm = linkedSignal(() => this.search());\n\n protected readonly showSearch = computed(() => this.searchable() && this.data() === null);\n\n /**\n * Overrides the query's `selectionMode` for this card (#460, D17) — the detail page passes the\n * sub-query entry's. `null` defers to the query (absent there = `'auto'`).\n */\n selectionMode = input<SparkSelectionModeSetting | null>(null);\n\n /**\n * Soft-deletion mode and deleted parent (#460), forwarded to the grid. In the recycle bin — the\n * grid lists `deleted: 'only'`, or its parent row was opened with `?deleted=only` — the card offers\n * no New, Delete or custom action, exactly as the query-list page does. See `recycleBin`.\n */\n deleted = input<SparkDeletedFilter | null | undefined>(null);\n parentDeleted = input(false);\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<QueryResultItem>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n /**\n * Forwarded to the grid. Without this the escape hatch was unreachable from a card — i.e. from\n * every auto-rendered sub-query and program-unit query page, which is most grids.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\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()?.visibleCustomActions() ?? []);\n\n /**\n * The header's buttons: New, Delete and the custom actions, from the grid (#460, M15) — the same\n * list the query-list page renders.\n */\n protected readonly toolbarActions = computed(() => this.grid()?.toolbarActions() ?? []);\n\n protected actionClass(action: SparkQueryToolbarAction): string {\n // Square corners in the card header (owner, 2026-09-29): the buttons sit edge to edge there.\n return `${sparkActionClass(action.definition, 'sm')} rounded-0`;\n }\n\n protected isEnabled(action: SparkQueryToolbarAction): boolean {\n return this.grid()?.isToolbarActionEnabled(action) ?? false;\n }\n\n protected run(action: SparkQueryToolbarAction): void {\n void this.grid()?.runToolbarAction(action);\n }\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 <!--\n Caption first, actions on the trailing edge (#460 M15, as query-grid-card-PRD.md always said,\n and as Vidyano's sub-query tabs do). `me-auto` on the caption pushes the actions right; a card\n without actions looks exactly as a plain caption did.\n -->\n <span class=\"me-auto spark-query-card-caption\">\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(), actions: toolbarActions(), selection: selection(), query: query() }\"></ng-container>\n } @else if (toolbarActions().length) {\n <!-- The default: New, Delete and the custom actions the server offers this caller, with the\n overflow in the priority nav under the translated \"More\" (common.more). The nav renders only when there are any.\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 rules. -->\n <bs-priority-nav class=\"spark-query-card-actions\" [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n @for (action of toolbarActions(); track action.name) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"actionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isEnabled(action)\" (click)=\"run(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.displayName | resolveTranslation }}\n </button>\n }\n </bs-priority-nav>\n }\n\n <!-- The query search, on the trailing edge next to the actions, as Vidyano's sub-query tabs\n have it (#460 M15, D17 addendum). The same box as the query-list page; it feeds the\n grid's `search`, which the server applies together with the parent. Absent for bound\n `data`, which the grid never refetches. -->\n @if (showSearch()) {\n <spark-search-box class=\"spark-query-card-search\" size=\"sm\" [(term)]=\"searchTerm\" />\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]=\"searchTerm()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n [deleted]=\"deleted()\"\n [parentDeleted]=\"parentDeleted()\"\n (error)=\"error.emit($event)\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n </div>\n</bs-card>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAa,wBAAwB;CAAC;CAAI;CAAI;AAAE;AAShD,SAAgB,sBAAsB,YAA6B;CACjE,OAAO,YAAY,WAChB,QAAO,MAAK,EAAE,aAAa,gBAAgB,EAAE,UAAU,SAAS,KAAK,CAAC,CAAC,CACvE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,KAAK,CAAA;AAC1C;AAQA,SAAgB,oBAAoB,OAAwB;CAG1D,MAAM,eAA6B,OAAO,eAAe,CAAA,EAAA,CAAI,KAAI,QAAO;EACtE,UAAU,GAAG;EACb,WAAW,GAAG,cAAc,SAAS,eAAwB;CAC9D,EAAC;CAEF,OAAO,IAAI,kBAAkB;EAC3B,SAAS;GAAE,QAAQ;GAAuB,UAAU,sBAAsB;EAAE;EAC5E,MAAM;GAAE,QAAQ,CAAC,CAAC;GAAG,UAAU;EAAC;EAChC;CACD,CAAA;AACH;AAGA,SAAgB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