@mintplayer/ng-spark 22.28.1 → 22.30.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 (29) hide show
  1. package/README.md +1 -1
  2. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +82 -4
  3. package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
  4. package/fesm2022/mintplayer-ng-spark-grid.mjs +59 -18
  5. package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -1
  6. package/fesm2022/mintplayer-ng-spark-models.mjs +2 -1
  7. package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
  8. package/fesm2022/mintplayer-ng-spark-po-detail.mjs +14 -4
  9. package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
  10. package/fesm2022/mintplayer-ng-spark-po-form.mjs +6 -3
  11. package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
  12. package/fesm2022/mintplayer-ng-spark-query-list.mjs +5 -2
  13. package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
  14. package/fesm2022/mintplayer-ng-spark-renderers.mjs +109 -4
  15. package/fesm2022/mintplayer-ng-spark-renderers.mjs.map +1 -1
  16. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +36 -6
  17. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
  18. package/fesm2022/mintplayer-ng-spark-services.mjs +37 -5
  19. package/fesm2022/mintplayer-ng-spark-services.mjs.map +1 -1
  20. package/package.json +3 -3
  21. package/types/mintplayer-ng-spark-client-operations.d.ts +81 -4
  22. package/types/mintplayer-ng-spark-grid.d.ts +36 -4
  23. package/types/mintplayer-ng-spark-models.d.ts +28 -0
  24. package/types/mintplayer-ng-spark-po-detail.d.ts +8 -0
  25. package/types/mintplayer-ng-spark-po-form.d.ts +2 -0
  26. package/types/mintplayer-ng-spark-query-list.d.ts +2 -0
  27. package/types/mintplayer-ng-spark-renderers.d.ts +47 -0
  28. package/types/mintplayer-ng-spark-retry-action-modal.d.ts +1 -0
  29. package/types/mintplayer-ng-spark-services.d.ts +27 -1
@@ -85,6 +85,9 @@ var SparkQueryListComponent = class SparkQueryListComponent {
85
85
  isToolbarActionEnabled(action) {
86
86
  return this.grid()?.isToolbarActionEnabled(action) ?? false;
87
87
  }
88
+ toolbarActionUnavailableReason(action) {
89
+ return this.grid()?.actionUnavailableReason(action.definition) ?? null;
90
+ }
88
91
  runToolbarAction(action) {
89
92
  if (action.kind === "new") {
90
93
  this.onCreate();
@@ -339,7 +342,7 @@ var SparkQueryListComponent = class SparkQueryListComponent {
339
342
  isSignal: true
340
343
  }],
341
344
  ngImport: i0,
342
- template: "<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n",
345
+ template: "<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" [attr.title]=\"toolbarActionUnavailableReason(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n",
343
346
  styles: [".spark-actionbar{--_bleed-block: var(--spark-content-inset-block, 0px);--_bleed-inline: var(--spark-content-inset-inline, 0px);--_gutter: var(--spark-actionbar-gutter, 1rem);position:sticky;top:calc(-1 * var(--_bleed-block));z-index:400;background-color:var(--spark-shell-main-bg, var(--bs-body-bg));border-bottom:1px solid var(--bs-border-color);margin-bottom:1rem;margin-inline:calc(-1 * var(--_bleed-inline));padding-inline:calc(var(--_bleed-inline) + var(--_gutter))}.spark-actionbar .btn{border-radius:0}.spark-actionbar-wide{--spark-actionbar-gutter: 1.5rem}:host{display:flex;flex-direction:column;flex:1;min-height:0}:host.virtual-scrolling{margin:0 calc(-1 * var(--spark-main-padding, 1.5rem)) calc(-1 * var(--spark-main-padding, 1.5rem));--spark-content-inset-inline: 0px}:host.virtual-scrolling spark-query-grid{display:flex;flex-direction:column;min-height:0}:host.virtual-scrolling ::ng-deep bs-datatable{display:flex;flex-direction:column;min-height:0;--mp-datatable-virtual-max-height: 100%}:host.virtual-scrolling ::ng-deep bs-datatable mp-datatable{flex:1 1 auto;min-height:0}tr:hover{background-color:rgba(var(--bs-emphasis-color-rgb),.05)}td input[type=checkbox]:disabled{opacity:1;pointer-events:none}.spark-live-badge{font-size:.6em}.spark-url-filter-clear{background:none;border:0;padding:0 0 0 .25rem;color:inherit;line-height:1}\n"],
344
347
  dependencies: [
345
348
  {
@@ -531,7 +534,7 @@ i0.ɵɵngDeclareClassMetadata({
531
534
  ],
532
535
  changeDetection: ChangeDetectionStrategy.OnPush,
533
536
  host: { "[class.virtual-scrolling]": "isVirtualScrolling()" },
534
- template: "<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n",
537
+ template: "<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" [attr.title]=\"toolbarActionUnavailableReason(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n",
535
538
  styles: [".spark-actionbar{--_bleed-block: var(--spark-content-inset-block, 0px);--_bleed-inline: var(--spark-content-inset-inline, 0px);--_gutter: var(--spark-actionbar-gutter, 1rem);position:sticky;top:calc(-1 * var(--_bleed-block));z-index:400;background-color:var(--spark-shell-main-bg, var(--bs-body-bg));border-bottom:1px solid var(--bs-border-color);margin-bottom:1rem;margin-inline:calc(-1 * var(--_bleed-inline));padding-inline:calc(var(--_bleed-inline) + var(--_gutter))}.spark-actionbar .btn{border-radius:0}.spark-actionbar-wide{--spark-actionbar-gutter: 1.5rem}:host{display:flex;flex-direction:column;flex:1;min-height:0}:host.virtual-scrolling{margin:0 calc(-1 * var(--spark-main-padding, 1.5rem)) calc(-1 * var(--spark-main-padding, 1.5rem));--spark-content-inset-inline: 0px}:host.virtual-scrolling spark-query-grid{display:flex;flex-direction:column;min-height:0}:host.virtual-scrolling ::ng-deep bs-datatable{display:flex;flex-direction:column;min-height:0;--mp-datatable-virtual-max-height: 100%}:host.virtual-scrolling ::ng-deep bs-datatable mp-datatable{flex:1 1 auto;min-height:0}tr:hover{background-color:rgba(var(--bs-emphasis-color-rgb),.05)}td input[type=checkbox]:disabled{opacity:1;pointer-events:none}.spark-live-badge{font-size:.6em}.spark-url-filter-clear{background:none;border:0;padding:0 0 0 .25rem;color:inherit;line-height:1}\n"]
536
539
  }]
537
540
  }],
@@ -1 +1 @@
1
- {"version":3,"file":"mintplayer-ng-spark-query-list.mjs","names":[],"sources":["../../query-list/src/spark-query-list.component.ts","../../query-list/src/spark-query-list.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, input, output, signal, viewChild, TemplateRef } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subscription } from 'rxjs';\nimport { CommonModule, NgTemplateOutlet } from '@angular/common';\nimport { ActivatedRoute, ParamMap, Router } from '@angular/router';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsBadgeComponent } from '@mintplayer/ng-bootstrap/badge';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsGridComponent, BsGridRowDirective, BsGridColumnDirective } from '@mintplayer/ng-bootstrap/grid';\nimport { BsPriorityNavComponent, BsPriorityNavItemDirective } from '@mintplayer/ng-bootstrap/priority-nav';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { SparkService, SparkStreamingService, SparkLanguageService } from '@mintplayer/ng-spark/services';\nimport { TranslateKeyPipe, ResolveTranslationPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SparkQueryGridComponent, SparkQueryToolbarAction, SparkSearchBoxComponent, sparkActionClass } from '@mintplayer/ng-spark/grid';\nimport {\n CustomActionDefinition,\n StreamingMessage,\n QueryColumn,\n QueryColumnFilter,\n QueryResultItem,\n SparkDeletedFilter,\n isDateDataType,\n parseWireDate,\n type SparkSelectionModeSetting,\n} from '@mintplayer/ng-spark/models';\nimport { NgComponentOutlet } from '@angular/common';\nimport {\n SPARK_QUERY_LIST_ACTIONS,\n SparkQueryListContext,\n orderSparkExtensions,\n parseSparkDeletedParam,\n} from '@mintplayer/ng-spark/panels';\n\n/**\n * The routed query page: chrome around one {@link SparkQueryGridComponent}.\n *\n * It owns what is genuinely page-shaped and route-shaped, and nothing else:\n *\n * - **Route resolution.** It has no `queryId` input; it reads `paramMap`, and it serves two\n * routes — `query/:queryId`, and `po/:type`, which resolves an entity type to a query. That\n * second one is type-to-query resolution, not query rendering, and is why this component still\n * exists rather than the router pointing at the grid.\n * - **Streaming.** The websocket lives here so it stays out of every PO detail page's bundle;\n * the snapshot is filtered and sorted client-side and handed to the grid as `[data]`.\n * - The action bar, the caption, the LIVE badge, the search box and the New button.\n *\n * The grid itself — columns, cells, paging, the row link, selection, custom-action execution —\n * is the shared component. This page previously wrote out `<bs-datatable>` twice, once per\n * transport, with a shared row template between them; both are gone.\n */\n@Component({\n selector: 'spark-query-list',\n imports: [BsBadgeComponent, CommonModule, NgTemplateOutlet, NgComponentOutlet, BsAlertComponent, BsGridComponent, BsGridRowDirective, BsGridColumnDirective, BsPriorityNavComponent, BsPriorityNavItemDirective, BsSpinnerComponent, SparkIconComponent, SparkQueryGridComponent, SparkSearchBoxComponent, ResolveTranslationPipe, TranslateKeyPipe],\n templateUrl: './spark-query-list.component.html',\n styleUrl: './spark-query-list.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.virtual-scrolling]': 'isVirtualScrolling()'\n }\n})\nexport class SparkQueryListComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly sparkService = inject(SparkService);\n private readonly streamingService = inject(SparkStreamingService);\n private readonly destroyRef = inject(DestroyRef);\n protected readonly lang = inject(SparkLanguageService);\n\n extraActionsTemplate = input<TemplateRef<void> | null>(null);\n showCustomActions = input(true);\n\n /**\n * Overrides the query's own `selectionMode` (#467, R3), as the sub-query card's input does: for a\n * host that embeds this page and wants, say, `'none'` on a list the actions would make selectable.\n */\n selectionMode = input<SparkSelectionModeSetting | null>(null);\n\n /**\n * Forwarded to the grid, so a query PAGE can replace its row links — the same reason the card\n * forwards it. Without this the escape hatch existed only for a directly-embedded grid.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\n\n rowClicked = output<QueryResultItem>();\n createClicked = output<void>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n\n /** The query the grid should render, resolved from the route. Null until it is known. */\n queryId = signal<string | null>(null);\n errorMessage = signal<string | null>(null);\n searchTerm = signal('');\n\n private readonly grid = viewChild(SparkQueryGridComponent);\n\n /**\n * Grid state, surfaced for this page's chrome.\n *\n * Optional `viewChild`, read defensively: the action bar and caption render above the grid, so\n * on the first change-detection pass the query has not resolved yet.\n */\n protected readonly query = computed(() => this.grid()?.query() ?? null);\n protected readonly entityType = computed(() => this.grid()?.entityType() ?? null);\n protected readonly customActions = computed(() => this.grid()?.customActions() ?? []);\n protected readonly canCreate = computed(() => this.grid()?.offersCreate() ?? false);\n protected readonly resultCount = computed(() => this.grid()?.resultCount() ?? null);\n protected readonly isVirtualScrolling = computed(() => this.grid()?.isVirtualScrolling() ?? false);\n protected readonly gridError = computed(() => this.grid()?.errorMessage() ?? null);\n protected readonly permissions = computed(() => this.grid()?.permissions() ?? null);\n\n /** Add-on buttons for the action bar (#460, `SPARK_QUERY_LIST_ACTIONS`), e.g. the Deleted toggle. */\n protected readonly listActions = orderSparkExtensions(inject(SPARK_QUERY_LIST_ACTIONS, { optional: true }), a => a.priority ?? 60);\n\n /**\n * The soft-deletion mode (#460, T2), read from the route's `?deleted=` so the recycle bin survives\n * a reload and the back button from a row opened in it. `exclude` unless the route says otherwise.\n */\n protected readonly deletedMode = signal<SparkDeletedFilter>('exclude');\n\n /** Bumped by `context.reload()`; the grid treats any new value as \"re-run the query\". */\n private readonly reloadToken = signal(0);\n\n protected readonly listContext = computed((): SparkQueryListContext | null => {\n const query = this.query();\n if (!query) return null;\n return {\n query,\n entityType: this.entityType(),\n permissions: this.permissions(),\n deleted: this.deletedMode(),\n setDeleted: (mode: SparkDeletedFilter) => this.setDeleted(mode),\n reload: () => this.reloadToken.update(n => n + 1),\n };\n });\n\n protected readonly gridReloadToken = this.reloadToken.asReadonly();\n\n private setDeleted(mode: SparkDeletedFilter): void {\n this.router.navigate([], {\n relativeTo: this.route,\n queryParams: { deleted: mode === 'exclude' ? null : mode },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n }\n\n /** Whether an action's selection rule is satisfied. Delegated: the grid holds the selection. */\n /** @see SparkPoDetailComponent.customActionClass — same allow-list, same default. */\n protected customActionClass(action: CustomActionDefinition): string {\n const variant = action.variant?.toLowerCase();\n switch (variant) {\n case 'danger':\n case 'warning':\n case 'primary':\n case 'secondary':\n case 'success':\n return `btn btn-${variant}`;\n default:\n return 'btn btn-outline-primary';\n }\n }\n\n /** The grid's toolbar model (#460, M15), the same list the sub-query card renders. */\n protected readonly toolbarActions = computed(() => this.grid()?.toolbarActions() ?? []);\n\n protected toolbarActionClass(action: SparkQueryToolbarAction): string {\n // New keeps its solid primary look; the rest follow their variant.\n return action.kind === 'new' ? 'btn btn-primary' : sparkActionClass(action.definition);\n }\n\n protected isToolbarActionEnabled(action: SparkQueryToolbarAction): boolean {\n return this.grid()?.isToolbarActionEnabled(action) ?? false;\n }\n\n protected runToolbarAction(action: SparkQueryToolbarAction): void {\n if (action.kind === 'new') {\n // Through this page's own onCreate, so `createClicked` fires exactly as it always has.\n this.onCreate();\n return;\n }\n void this.grid()?.runToolbarAction(action);\n }\n\n protected isActionEnabled(action: CustomActionDefinition): boolean {\n return this.grid()?.isActionEnabled(action) ?? false;\n }\n\n // --- streaming ---------------------------------------------------------------\n\n isStreaming = signal(false);\n private streamingSub: Subscription | null = null;\n /** Columns as sent with the stream's snapshot; empty until it arrives. */\n protected readonly streamColumns = signal<QueryColumn[]>([]);\n private readonly allItems = signal<QueryResultItem[]>([]);\n private readonly streamItems = signal<QueryResultItem[]>([]);\n\n /**\n * Rows handed to the grid, or `null` to let it fetch for itself.\n *\n * Null for a normal query — an empty array would read as \"here are no rows\" and suppress the\n * fetch entirely.\n */\n protected readonly gridData = computed(() =>\n this.query()?.isStreamingQuery ? this.streamItems() : null);\n\n constructor() {\n this.route.paramMap.pipe(takeUntilDestroyed()).subscribe(params => {\n // The handler is async and this is a subscribe, so a rejection lands nowhere: the metadata\n // load would reject, the query would stay null, and the template would render a spinner\n // FOREVER — while this component has had an errorMessage surface all along that only the\n // fetch path ever reached.\n this.onParamsChange(params).catch((e: unknown) => this.reportLoadFailure(e as HttpErrorResponse));\n });\n\n // Separate from paramMap: switching the recycle bin on changes only the query string, and must\n // not re-resolve the query (which would reset page, sort and filters for nothing).\n this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(query => {\n this.deletedMode.set(parseSparkDeletedParam(query.get('deleted')) ?? 'exclude');\n this.applyUrlScope(query);\n });\n\n this.destroyRef.onDestroy(() => this.disconnectStreaming());\n\n // Connect the socket once the grid has resolved a streaming query, and disconnect whenever it\n // resolves anything else. The grid knows not to fetch for a streaming query, so there is no\n // window in which both transports are live.\n effect(() => {\n const q = this.query();\n if (q?.isStreamingQuery) {\n this.connectStreaming(q.id);\n } else {\n this.disconnectStreaming();\n }\n });\n\n // Client-side filter and sort for the streaming snapshot. The server never sees these: there\n // is no request to attach them to.\n effect(() => {\n this.searchTerm();\n this.grid()?.settings();\n this.allItems();\n if (this.isStreaming()) this.applyFilter();\n });\n }\n\n // --- URL scope: parent and column filters ----------------------------------------------------\n\n /**\n * The parent the URL scopes the query to (`?parentId=…&parentType=…`), sent exactly as a sub-query\n * sends its container. Both or neither: one without the other is ignored, as the server does.\n */\n protected readonly urlParentId = signal('');\n protected readonly urlParentType = signal('');\n\n /**\n * Column filters from the URL: every other query-string parameter, `?Language=en&Script=Latn`\n * (repeat a name for several values). The grid applies only those naming an attribute of the\n * query's type; the rest are ignored. This is the contributions History link's shape, and works for\n * any query.\n */\n protected readonly urlFilters = signal<QueryColumnFilter[]>([]);\n\n /** The URL filters the grid applied, as removable chips. */\n protected readonly activeUrlFilters = computed(() => this.grid()?.appliedPresetFilters() ?? []);\n\n /** Query-string names the page or the row links own, never column filters. */\n private static readonly reservedParams = new Set(['deleted', 'parentId', 'parentType', 'queryId', 'parentDeleted']);\n\n private applyUrlScope(query: ParamMap): void {\n const parentId = query.get('parentId') ?? '';\n const parentType = query.get('parentType') ?? '';\n const both = !!parentId && !!parentType;\n if (this.urlParentId() !== (both ? parentId : '')) this.urlParentId.set(both ? parentId : '');\n if (this.urlParentType() !== (both ? parentType : '')) this.urlParentType.set(both ? parentType : '');\n\n const filters: QueryColumnFilter[] = query.keys\n .filter(key => !SparkQueryListComponent.reservedParams.has(key))\n .map(key => ({ name: key, includes: query.getAll(key).filter(v => v !== '') }))\n .filter(f => f.includes.length > 0);\n // Only on a real change: a new array would refetch the grid for nothing (the Deleted toggle\n // also changes the query string).\n if (JSON.stringify(filters) !== JSON.stringify(this.urlFilters())) this.urlFilters.set(filters);\n }\n\n /** Drops one URL filter (its query-string parameter); the grid refetches. */\n protected clearUrlFilter(name: string): void {\n this.router.navigate([], { relativeTo: this.route, queryParams: { [name]: null }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n /** Drops the parent and every URL filter. */\n protected clearUrlScope(): void {\n const queryParams: Record<string, null> = { parentId: null, parentType: null };\n for (const filter of this.urlFilters()) queryParams[filter.name] = null;\n this.router.navigate([], { relativeTo: this.route, queryParams, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n protected filterValues(filter: QueryColumnFilter): string {\n return (filter.includes ?? []).map(v => String(v)).join(', ');\n }\n\n /** The column's label for a chip: the query's own column label, else the attribute's, else its name. */\n protected filterLabel(name: string): string {\n const attribute = this.entityType()?.attributes?.find(a => a.name === name);\n return this.lang.resolve(attribute?.label) || name;\n }\n\n private async onParamsChange(params: ParamMap): Promise<void> {\n this.errorMessage.set(null);\n this.queryId.set(null);\n this.allItems.set([]);\n this.streamItems.set([]);\n this.streamColumns.set([]);\n this.disconnectStreaming();\n\n const queryId = params.get('queryId');\n const typeParam = params.get('type');\n\n if (queryId) {\n this.queryId.set(queryId);\n return;\n }\n\n if (!typeParam) return;\n\n // `po/:type` — the route names an entity type, so find the query that lists it. The grid takes\n // a query, and this translation is the only reason it cannot take the route directly.\n const [entityTypes, queries] = await Promise.all([\n this.sparkService.getEntityTypes(),\n this.sparkService.getQueries(),\n ]);\n const entityType = entityTypes.find(t => t.id === typeParam || t.alias === typeParam);\n if (!entityType) {\n this.reportLoadFailure({ status: 404 } as HttpErrorResponse);\n return;\n }\n\n const singularName = entityType.name;\n const match = queries.find(q => {\n if (q.entityType === singularName) return true;\n const sourceName = q.source.includes('.') ? q.source.substring(q.source.indexOf('.') + 1) : q.source;\n return sourceName === singularName || sourceName === singularName + 's';\n });\n\n if (match) this.queryId.set(match.alias || match.id);\n else this.reportLoadFailure({ status: 404 } as HttpErrorResponse);\n }\n\n /**\n * A load failure has to render, not just be swallowed: a denied query answers 404 (audit M-3, so\n * existence is not leaked), which is indistinguishable from a missing one — hence a deliberately\n * generic message rather than a guess at which it was.\n */\n private reportLoadFailure(err: HttpErrorResponse): void {\n this.errorMessage.set(\n err?.status === 404\n ? (this.lang.t('spark.query.unavailable') || 'This list is not available.')\n : (err?.error?.error || err?.message || 'An unexpected error occurred'));\n }\n\n protected async onCustomAction(action: CustomActionDefinition): Promise<void> {\n await this.grid()?.onCustomAction(action);\n }\n\n protected onCreate(): void {\n this.createClicked.emit();\n const et = this.entityType();\n if (et) this.router.navigate(['/po', et.alias || et.id, 'new']);\n }\n\n protected clearSearch(): void {\n this.searchTerm.set('');\n }\n\n private connectStreaming(queryId: string): void {\n if (this.streamingSub) return;\n this.isStreaming.set(true);\n\n this.streamingSub = this.streamingService.connectToStreamingQuery(queryId).subscribe({\n next: (message) => this.handleStreamingMessage(message),\n error: (err) => {\n this.errorMessage.set(err?.message || 'Streaming connection failed');\n this.isStreaming.set(false);\n },\n complete: () => this.isStreaming.set(false),\n });\n }\n\n private disconnectStreaming(): void {\n if (this.streamingSub) {\n this.streamingSub.unsubscribe();\n this.streamingSub = null;\n }\n this.isStreaming.set(false);\n }\n\n private handleStreamingMessage(message: StreamingMessage): void {\n switch (message.type) {\n case 'snapshot':\n this.errorMessage.set(null);\n // Columns come with the snapshot and never change for the life of the stream, so they are\n // stored once and handed to the grid alongside the rows — a projection cannot describe\n // itself, and the grid has no entity-type metadata to fall back on any more.\n this.streamColumns.set(message.columns);\n this.allItems.set(message.data);\n break;\n\n case 'patch':\n if (message.updated.length > 0) {\n this.allItems.update(items => items.map(item => {\n const patch = message.updated.find(u => u.id === item.id);\n if (!patch) return item;\n return {\n ...item,\n values: item.values.map(v =>\n v.key in patch.values ? { ...v, value: patch.values[v.key] } : v),\n };\n }));\n }\n break;\n\n case 'error':\n this.errorMessage.set(message.message);\n break;\n }\n }\n\n private applyFilter(): void {\n let items = this.allItems();\n\n const term = this.searchTerm().toLowerCase();\n if (term) {\n items = items.filter(item =>\n item.values.some(v => String(v.value ?? '').toLowerCase().includes(term)));\n }\n\n // The datatable in `[data]` mode also sorts on header clicks, but the sort must survive a\n // patch: re-deriving from `allItems` without re-applying it would silently reorder the grid\n // under the user on every update.\n const sortCols = this.grid()?.settings().sortColumns ?? [];\n if (sortCols.length > 0) {\n const dataTypes = new Map(this.streamColumns().map(c => [c.name, c.dataType]));\n items = [...items].sort((a, b) => {\n for (const col of sortCols) {\n const aVal = a.values.find(v => v.key === col.property)?.value;\n const bVal = b.values.find(v => v.key === col.property)?.value;\n const cmp = compareStreamValues(aVal, bVal, dataTypes.get(col.property));\n if (cmp !== 0) return col.direction === 'descending' ? -cmp : cmp;\n }\n return 0;\n });\n }\n\n this.streamItems.set(items);\n }\n}\n\n/**\n * Orders two streamed cell values the way the server orders the same column.\n *\n * The values are what the wire carries: a date is the raw ISO string WITH its own offset and with\n * trailing fraction zeros trimmed (`…T09:00:00-05:00`, `…T09:00:00.5-05:00`), a number is a number.\n * Comparing them as text sorted dates by wall clock and `10` before `9`; a date compares by instant\n * and a number numerically (docs/datetimeoffset_query_sort_filter_PRD.md, F4).\n *\n * A missing value sorts first ascending, as the empty string always did.\n */\nfunction compareStreamValues(a: unknown, b: unknown, dataType: string | undefined): number {\n const aMissing = a === null || a === undefined || a === '';\n const bMissing = b === null || b === undefined || b === '';\n if (aMissing || bMissing) return aMissing === bMissing ? 0 : aMissing ? -1 : 1;\n\n if (isDateDataType(dataType)) {\n const aDate = parseWireDate(a);\n const bDate = parseWireDate(b);\n if (aDate && bDate) return aDate.getTime() - bDate.getTime();\n } else if (dataType === 'number' || dataType === 'decimal') {\n const aNumber = Number(a);\n const bNumber = Number(b);\n if (!isNaN(aNumber) && !isNaN(bNumber)) return aNumber - bNumber;\n }\n\n return String(a).localeCompare(String(b));\n}\n","<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8DA,IAAa,0BAAb,MAAa,wBAAuB;CACjB,QAAQ,OAAO,cAAc;CAC7B,SAAS,OAAO,MAAM;CACtB,eAAe,OAAO,YAAY;CAClC,mBAAmB,OAAO,qBAAqB;CAC/C,aAAa,OAAO,UAAU;CAC5B,OAAO,OAAO,oBAAoB;CAErD,uBAAuB,MAAgC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;CAC5D,oBAAoB,MAAM,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,oBAAA,CAAA,+BAAA,CAAA,CAAA;CAM/B,gBAAgB,MAAwC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAM7D,WAAW,MAA2D,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAE3E,aAAa,OAAM;CACnB,gBAAgB,OAAM;CACtB,uBAAuB,OAAM;CAE7B,SAAS;CAGT,UAAU,OAAsB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACrC,eAAe,OAAsB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,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,eAAA;EAAA,CAAA;EAAA,sBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,sBAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,uBAAuB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AAqX3D,SAAS,oBAAoB,GAAY,GAAY,UAA4B;CAC/E,MAAM,WAAW,MAAM,QAAQ,MAAM,UAAa,MAAM;CACxD,MAAM,WAAW,MAAM,QAAQ,MAAM,UAAa,MAAM;CACxD,IAAI,YAAY,UAAU,OAAO,aAAa,WAAW,IAAI,WAAW,KAAK;CAE7E,IAAI,eAAe,QAAQ,GAAG;EAC5B,MAAM,QAAQ,cAAc,CAAC;EAC7B,MAAM,QAAQ,cAAc,CAAC;EAC7B,IAAI,SAAS,OAAO,OAAO,MAAM,QAAO,IAAK,MAAM,QAAO;CAC5D,OAAO,IAAI,aAAa,YAAY,aAAa,WAAW;EAC1D,MAAM,UAAU,OAAO,CAAC;EACxB,MAAM,UAAU,OAAO,CAAC;EACxB,IAAI,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,OAAO,GAAG,OAAO,UAAU;CAC3D;CAEA,OAAO,OAAO,CAAC,CAAC,CAAC,cAAc,OAAO,CAAC,CAAC;AAC1C"}
1
+ {"version":3,"file":"mintplayer-ng-spark-query-list.mjs","names":[],"sources":["../../query-list/src/spark-query-list.component.ts","../../query-list/src/spark-query-list.component.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, DestroyRef, computed, effect, inject, input, output, signal, viewChild, TemplateRef } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Subscription } from 'rxjs';\nimport { CommonModule, NgTemplateOutlet } from '@angular/common';\nimport { ActivatedRoute, ParamMap, Router } from '@angular/router';\nimport { Color } from '@mintplayer/ng-bootstrap';\nimport { BsBadgeComponent } from '@mintplayer/ng-bootstrap/badge';\nimport { BsAlertComponent } from '@mintplayer/ng-bootstrap/alert';\nimport { BsGridComponent, BsGridRowDirective, BsGridColumnDirective } from '@mintplayer/ng-bootstrap/grid';\nimport { BsPriorityNavComponent, BsPriorityNavItemDirective } from '@mintplayer/ng-bootstrap/priority-nav';\nimport { BsSpinnerComponent } from '@mintplayer/ng-bootstrap/spinner';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { SparkService, SparkStreamingService, SparkLanguageService } from '@mintplayer/ng-spark/services';\nimport { TranslateKeyPipe, ResolveTranslationPipe } from '@mintplayer/ng-spark/pipes';\nimport { SparkIconComponent } from '@mintplayer/ng-spark/icon';\nimport { SparkQueryGridComponent, SparkQueryToolbarAction, SparkSearchBoxComponent, sparkActionClass } from '@mintplayer/ng-spark/grid';\nimport {\n CustomActionDefinition,\n StreamingMessage,\n QueryColumn,\n QueryColumnFilter,\n QueryResultItem,\n SparkDeletedFilter,\n isDateDataType,\n parseWireDate,\n type SparkSelectionModeSetting,\n} from '@mintplayer/ng-spark/models';\nimport { NgComponentOutlet } from '@angular/common';\nimport {\n SPARK_QUERY_LIST_ACTIONS,\n SparkQueryListContext,\n orderSparkExtensions,\n parseSparkDeletedParam,\n} from '@mintplayer/ng-spark/panels';\n\n/**\n * The routed query page: chrome around one {@link SparkQueryGridComponent}.\n *\n * It owns what is genuinely page-shaped and route-shaped, and nothing else:\n *\n * - **Route resolution.** It has no `queryId` input; it reads `paramMap`, and it serves two\n * routes — `query/:queryId`, and `po/:type`, which resolves an entity type to a query. That\n * second one is type-to-query resolution, not query rendering, and is why this component still\n * exists rather than the router pointing at the grid.\n * - **Streaming.** The websocket lives here so it stays out of every PO detail page's bundle;\n * the snapshot is filtered and sorted client-side and handed to the grid as `[data]`.\n * - The action bar, the caption, the LIVE badge, the search box and the New button.\n *\n * The grid itself — columns, cells, paging, the row link, selection, custom-action execution —\n * is the shared component. This page previously wrote out `<bs-datatable>` twice, once per\n * transport, with a shared row template between them; both are gone.\n */\n@Component({\n selector: 'spark-query-list',\n imports: [BsBadgeComponent, CommonModule, NgTemplateOutlet, NgComponentOutlet, BsAlertComponent, BsGridComponent, BsGridRowDirective, BsGridColumnDirective, BsPriorityNavComponent, BsPriorityNavItemDirective, BsSpinnerComponent, SparkIconComponent, SparkQueryGridComponent, SparkSearchBoxComponent, ResolveTranslationPipe, TranslateKeyPipe],\n templateUrl: './spark-query-list.component.html',\n styleUrl: './spark-query-list.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class.virtual-scrolling]': 'isVirtualScrolling()'\n }\n})\nexport class SparkQueryListComponent {\n private readonly route = inject(ActivatedRoute);\n private readonly router = inject(Router);\n private readonly sparkService = inject(SparkService);\n private readonly streamingService = inject(SparkStreamingService);\n private readonly destroyRef = inject(DestroyRef);\n protected readonly lang = inject(SparkLanguageService);\n\n extraActionsTemplate = input<TemplateRef<void> | null>(null);\n showCustomActions = input(true);\n\n /**\n * Overrides the query's own `selectionMode` (#467, R3), as the sub-query card's input does: for a\n * host that embeds this page and wants, say, `'none'` on a list the actions would make selectable.\n */\n selectionMode = input<SparkSelectionModeSetting | null>(null);\n\n /**\n * Forwarded to the grid, so a query PAGE can replace its row links — the same reason the card\n * forwards it. Without this the escape hatch existed only for a directly-embedded grid.\n */\n rowRoute = input<((row: QueryResultItem) => unknown[] | null) | null>(null);\n\n rowClicked = output<QueryResultItem>();\n createClicked = output<void>();\n customActionExecuted = output<{ action: CustomActionDefinition }>();\n\n colors = Color;\n\n /** The query the grid should render, resolved from the route. Null until it is known. */\n queryId = signal<string | null>(null);\n errorMessage = signal<string | null>(null);\n searchTerm = signal('');\n\n private readonly grid = viewChild(SparkQueryGridComponent);\n\n /**\n * Grid state, surfaced for this page's chrome.\n *\n * Optional `viewChild`, read defensively: the action bar and caption render above the grid, so\n * on the first change-detection pass the query has not resolved yet.\n */\n protected readonly query = computed(() => this.grid()?.query() ?? null);\n protected readonly entityType = computed(() => this.grid()?.entityType() ?? null);\n protected readonly customActions = computed(() => this.grid()?.customActions() ?? []);\n protected readonly canCreate = computed(() => this.grid()?.offersCreate() ?? false);\n protected readonly resultCount = computed(() => this.grid()?.resultCount() ?? null);\n protected readonly isVirtualScrolling = computed(() => this.grid()?.isVirtualScrolling() ?? false);\n protected readonly gridError = computed(() => this.grid()?.errorMessage() ?? null);\n protected readonly permissions = computed(() => this.grid()?.permissions() ?? null);\n\n /** Add-on buttons for the action bar (#460, `SPARK_QUERY_LIST_ACTIONS`), e.g. the Deleted toggle. */\n protected readonly listActions = orderSparkExtensions(inject(SPARK_QUERY_LIST_ACTIONS, { optional: true }), a => a.priority ?? 60);\n\n /**\n * The soft-deletion mode (#460, T2), read from the route's `?deleted=` so the recycle bin survives\n * a reload and the back button from a row opened in it. `exclude` unless the route says otherwise.\n */\n protected readonly deletedMode = signal<SparkDeletedFilter>('exclude');\n\n /** Bumped by `context.reload()`; the grid treats any new value as \"re-run the query\". */\n private readonly reloadToken = signal(0);\n\n protected readonly listContext = computed((): SparkQueryListContext | null => {\n const query = this.query();\n if (!query) return null;\n return {\n query,\n entityType: this.entityType(),\n permissions: this.permissions(),\n deleted: this.deletedMode(),\n setDeleted: (mode: SparkDeletedFilter) => this.setDeleted(mode),\n reload: () => this.reloadToken.update(n => n + 1),\n };\n });\n\n protected readonly gridReloadToken = this.reloadToken.asReadonly();\n\n private setDeleted(mode: SparkDeletedFilter): void {\n this.router.navigate([], {\n relativeTo: this.route,\n queryParams: { deleted: mode === 'exclude' ? null : mode },\n queryParamsHandling: 'merge',\n replaceUrl: true,\n });\n }\n\n /** Whether an action's selection rule is satisfied. Delegated: the grid holds the selection. */\n /** @see SparkPoDetailComponent.customActionClass — same allow-list, same default. */\n protected customActionClass(action: CustomActionDefinition): string {\n const variant = action.variant?.toLowerCase();\n switch (variant) {\n case 'danger':\n case 'warning':\n case 'primary':\n case 'secondary':\n case 'success':\n return `btn btn-${variant}`;\n default:\n return 'btn btn-outline-primary';\n }\n }\n\n /** The grid's toolbar model (#460, M15), the same list the sub-query card renders. */\n protected readonly toolbarActions = computed(() => this.grid()?.toolbarActions() ?? []);\n\n protected toolbarActionClass(action: SparkQueryToolbarAction): string {\n // New keeps its solid primary look; the rest follow their variant.\n return action.kind === 'new' ? 'btn btn-primary' : sparkActionClass(action.definition);\n }\n\n protected isToolbarActionEnabled(action: SparkQueryToolbarAction): boolean {\n return this.grid()?.isToolbarActionEnabled(action) ?? false;\n }\n\n /** The tooltip of an action disabled for want of its client method (`requiresClient`); null otherwise. */\n protected toolbarActionUnavailableReason(action: SparkQueryToolbarAction): string | null {\n return this.grid()?.actionUnavailableReason(action.definition) ?? null;\n }\n\n protected runToolbarAction(action: SparkQueryToolbarAction): void {\n if (action.kind === 'new') {\n // Through this page's own onCreate, so `createClicked` fires exactly as it always has.\n this.onCreate();\n return;\n }\n void this.grid()?.runToolbarAction(action);\n }\n\n protected isActionEnabled(action: CustomActionDefinition): boolean {\n return this.grid()?.isActionEnabled(action) ?? false;\n }\n\n // --- streaming ---------------------------------------------------------------\n\n isStreaming = signal(false);\n private streamingSub: Subscription | null = null;\n /** Columns as sent with the stream's snapshot; empty until it arrives. */\n protected readonly streamColumns = signal<QueryColumn[]>([]);\n private readonly allItems = signal<QueryResultItem[]>([]);\n private readonly streamItems = signal<QueryResultItem[]>([]);\n\n /**\n * Rows handed to the grid, or `null` to let it fetch for itself.\n *\n * Null for a normal query — an empty array would read as \"here are no rows\" and suppress the\n * fetch entirely.\n */\n protected readonly gridData = computed(() =>\n this.query()?.isStreamingQuery ? this.streamItems() : null);\n\n constructor() {\n this.route.paramMap.pipe(takeUntilDestroyed()).subscribe(params => {\n // The handler is async and this is a subscribe, so a rejection lands nowhere: the metadata\n // load would reject, the query would stay null, and the template would render a spinner\n // FOREVER — while this component has had an errorMessage surface all along that only the\n // fetch path ever reached.\n this.onParamsChange(params).catch((e: unknown) => this.reportLoadFailure(e as HttpErrorResponse));\n });\n\n // Separate from paramMap: switching the recycle bin on changes only the query string, and must\n // not re-resolve the query (which would reset page, sort and filters for nothing).\n this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(query => {\n this.deletedMode.set(parseSparkDeletedParam(query.get('deleted')) ?? 'exclude');\n this.applyUrlScope(query);\n });\n\n this.destroyRef.onDestroy(() => this.disconnectStreaming());\n\n // Connect the socket once the grid has resolved a streaming query, and disconnect whenever it\n // resolves anything else. The grid knows not to fetch for a streaming query, so there is no\n // window in which both transports are live.\n effect(() => {\n const q = this.query();\n if (q?.isStreamingQuery) {\n this.connectStreaming(q.id);\n } else {\n this.disconnectStreaming();\n }\n });\n\n // Client-side filter and sort for the streaming snapshot. The server never sees these: there\n // is no request to attach them to.\n effect(() => {\n this.searchTerm();\n this.grid()?.settings();\n this.allItems();\n if (this.isStreaming()) this.applyFilter();\n });\n }\n\n // --- URL scope: parent and column filters ----------------------------------------------------\n\n /**\n * The parent the URL scopes the query to (`?parentId=…&parentType=…`), sent exactly as a sub-query\n * sends its container. Both or neither: one without the other is ignored, as the server does.\n */\n protected readonly urlParentId = signal('');\n protected readonly urlParentType = signal('');\n\n /**\n * Column filters from the URL: every other query-string parameter, `?Language=en&Script=Latn`\n * (repeat a name for several values). The grid applies only those naming an attribute of the\n * query's type; the rest are ignored. This is the contributions History link's shape, and works for\n * any query.\n */\n protected readonly urlFilters = signal<QueryColumnFilter[]>([]);\n\n /** The URL filters the grid applied, as removable chips. */\n protected readonly activeUrlFilters = computed(() => this.grid()?.appliedPresetFilters() ?? []);\n\n /** Query-string names the page or the row links own, never column filters. */\n private static readonly reservedParams = new Set(['deleted', 'parentId', 'parentType', 'queryId', 'parentDeleted']);\n\n private applyUrlScope(query: ParamMap): void {\n const parentId = query.get('parentId') ?? '';\n const parentType = query.get('parentType') ?? '';\n const both = !!parentId && !!parentType;\n if (this.urlParentId() !== (both ? parentId : '')) this.urlParentId.set(both ? parentId : '');\n if (this.urlParentType() !== (both ? parentType : '')) this.urlParentType.set(both ? parentType : '');\n\n const filters: QueryColumnFilter[] = query.keys\n .filter(key => !SparkQueryListComponent.reservedParams.has(key))\n .map(key => ({ name: key, includes: query.getAll(key).filter(v => v !== '') }))\n .filter(f => f.includes.length > 0);\n // Only on a real change: a new array would refetch the grid for nothing (the Deleted toggle\n // also changes the query string).\n if (JSON.stringify(filters) !== JSON.stringify(this.urlFilters())) this.urlFilters.set(filters);\n }\n\n /** Drops one URL filter (its query-string parameter); the grid refetches. */\n protected clearUrlFilter(name: string): void {\n this.router.navigate([], { relativeTo: this.route, queryParams: { [name]: null }, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n /** Drops the parent and every URL filter. */\n protected clearUrlScope(): void {\n const queryParams: Record<string, null> = { parentId: null, parentType: null };\n for (const filter of this.urlFilters()) queryParams[filter.name] = null;\n this.router.navigate([], { relativeTo: this.route, queryParams, queryParamsHandling: 'merge', replaceUrl: true });\n }\n\n protected filterValues(filter: QueryColumnFilter): string {\n return (filter.includes ?? []).map(v => String(v)).join(', ');\n }\n\n /** The column's label for a chip: the query's own column label, else the attribute's, else its name. */\n protected filterLabel(name: string): string {\n const attribute = this.entityType()?.attributes?.find(a => a.name === name);\n return this.lang.resolve(attribute?.label) || name;\n }\n\n private async onParamsChange(params: ParamMap): Promise<void> {\n this.errorMessage.set(null);\n this.queryId.set(null);\n this.allItems.set([]);\n this.streamItems.set([]);\n this.streamColumns.set([]);\n this.disconnectStreaming();\n\n const queryId = params.get('queryId');\n const typeParam = params.get('type');\n\n if (queryId) {\n this.queryId.set(queryId);\n return;\n }\n\n if (!typeParam) return;\n\n // `po/:type` — the route names an entity type, so find the query that lists it. The grid takes\n // a query, and this translation is the only reason it cannot take the route directly.\n const [entityTypes, queries] = await Promise.all([\n this.sparkService.getEntityTypes(),\n this.sparkService.getQueries(),\n ]);\n const entityType = entityTypes.find(t => t.id === typeParam || t.alias === typeParam);\n if (!entityType) {\n this.reportLoadFailure({ status: 404 } as HttpErrorResponse);\n return;\n }\n\n const singularName = entityType.name;\n const match = queries.find(q => {\n if (q.entityType === singularName) return true;\n const sourceName = q.source.includes('.') ? q.source.substring(q.source.indexOf('.') + 1) : q.source;\n return sourceName === singularName || sourceName === singularName + 's';\n });\n\n if (match) this.queryId.set(match.alias || match.id);\n else this.reportLoadFailure({ status: 404 } as HttpErrorResponse);\n }\n\n /**\n * A load failure has to render, not just be swallowed: a denied query answers 404 (audit M-3, so\n * existence is not leaked), which is indistinguishable from a missing one — hence a deliberately\n * generic message rather than a guess at which it was.\n */\n private reportLoadFailure(err: HttpErrorResponse): void {\n this.errorMessage.set(\n err?.status === 404\n ? (this.lang.t('spark.query.unavailable') || 'This list is not available.')\n : (err?.error?.error || err?.message || 'An unexpected error occurred'));\n }\n\n protected async onCustomAction(action: CustomActionDefinition): Promise<void> {\n await this.grid()?.onCustomAction(action);\n }\n\n protected onCreate(): void {\n this.createClicked.emit();\n const et = this.entityType();\n if (et) this.router.navigate(['/po', et.alias || et.id, 'new']);\n }\n\n protected clearSearch(): void {\n this.searchTerm.set('');\n }\n\n private connectStreaming(queryId: string): void {\n if (this.streamingSub) return;\n this.isStreaming.set(true);\n\n this.streamingSub = this.streamingService.connectToStreamingQuery(queryId).subscribe({\n next: (message) => this.handleStreamingMessage(message),\n error: (err) => {\n this.errorMessage.set(err?.message || 'Streaming connection failed');\n this.isStreaming.set(false);\n },\n complete: () => this.isStreaming.set(false),\n });\n }\n\n private disconnectStreaming(): void {\n if (this.streamingSub) {\n this.streamingSub.unsubscribe();\n this.streamingSub = null;\n }\n this.isStreaming.set(false);\n }\n\n private handleStreamingMessage(message: StreamingMessage): void {\n switch (message.type) {\n case 'snapshot':\n this.errorMessage.set(null);\n // Columns come with the snapshot and never change for the life of the stream, so they are\n // stored once and handed to the grid alongside the rows — a projection cannot describe\n // itself, and the grid has no entity-type metadata to fall back on any more.\n this.streamColumns.set(message.columns);\n this.allItems.set(message.data);\n break;\n\n case 'patch':\n if (message.updated.length > 0) {\n this.allItems.update(items => items.map(item => {\n const patch = message.updated.find(u => u.id === item.id);\n if (!patch) return item;\n return {\n ...item,\n values: item.values.map(v =>\n v.key in patch.values ? { ...v, value: patch.values[v.key] } : v),\n };\n }));\n }\n break;\n\n case 'error':\n this.errorMessage.set(message.message);\n break;\n }\n }\n\n private applyFilter(): void {\n let items = this.allItems();\n\n const term = this.searchTerm().toLowerCase();\n if (term) {\n items = items.filter(item =>\n item.values.some(v => String(v.value ?? '').toLowerCase().includes(term)));\n }\n\n // The datatable in `[data]` mode also sorts on header clicks, but the sort must survive a\n // patch: re-deriving from `allItems` without re-applying it would silently reorder the grid\n // under the user on every update.\n const sortCols = this.grid()?.settings().sortColumns ?? [];\n if (sortCols.length > 0) {\n const dataTypes = new Map(this.streamColumns().map(c => [c.name, c.dataType]));\n items = [...items].sort((a, b) => {\n for (const col of sortCols) {\n const aVal = a.values.find(v => v.key === col.property)?.value;\n const bVal = b.values.find(v => v.key === col.property)?.value;\n const cmp = compareStreamValues(aVal, bVal, dataTypes.get(col.property));\n if (cmp !== 0) return col.direction === 'descending' ? -cmp : cmp;\n }\n return 0;\n });\n }\n\n this.streamItems.set(items);\n }\n}\n\n/**\n * Orders two streamed cell values the way the server orders the same column.\n *\n * The values are what the wire carries: a date is the raw ISO string WITH its own offset and with\n * trailing fraction zeros trimmed (`…T09:00:00-05:00`, `…T09:00:00.5-05:00`), a number is a number.\n * Comparing them as text sorted dates by wall clock and `10` before `9`; a date compares by instant\n * and a number numerically (docs/datetimeoffset_query_sort_filter_PRD.md, F4).\n *\n * A missing value sorts first ascending, as the empty string always did.\n */\nfunction compareStreamValues(a: unknown, b: unknown, dataType: string | undefined): number {\n const aMissing = a === null || a === undefined || a === '';\n const bMissing = b === null || b === undefined || b === '';\n if (aMissing || bMissing) return aMissing === bMissing ? 0 : aMissing ? -1 : 1;\n\n if (isDateDataType(dataType)) {\n const aDate = parseWireDate(a);\n const bDate = parseWireDate(b);\n if (aDate && bDate) return aDate.getTime() - bDate.getTime();\n } else if (dataType === 'number' || dataType === 'decimal') {\n const aNumber = Number(a);\n const bNumber = Number(b);\n if (!isNaN(aNumber) && !isNaN(bNumber)) return aNumber - bNumber;\n }\n\n return String(a).localeCompare(String(b));\n}\n","<div class=\"d-flex flex-column h-100\">\n <div class=\"spark-actionbar py-2 flex-shrink-0\" [class.spark-actionbar-wide]=\"isVirtualScrolling()\">\n <bs-priority-nav [moreLabel]=\"lang.t('common.more')\" [collapseAt]=\"'sm'\">\n <!-- The grid's toolbar model (#460 M15, #467 R3): New, Edit, Delete and the custom actions —\n the list the sub-query card renders too, labels and icons from the action catalogue.\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 @for (action of toolbarActions(); track action.name) {\n @if (action.kind !== 'custom' || showCustomActions()) {\n <button *bsPriorityNavItem=\"action.priority\" type=\"button\" [class]=\"toolbarActionClass(action)\"\n [attr.data-action]=\"action.name\"\n [disabled]=\"!isToolbarActionEnabled(action)\" [attr.title]=\"toolbarActionUnavailableReason(action)\" (click)=\"runToolbarAction(action)\">\n @if (action.definition.icon && action.kind !== 'custom') {\n <spark-icon [name]=\"action.definition.icon\" />\n }\n {{ action.definition.label | resolveTranslation }}\n </button>\n }\n }\n @if (extraActionsTemplate(); as extraActionsTpl) {\n <ng-container *bsPriorityNavItem=\"50\">\n <ng-container *ngTemplateOutlet=\"extraActionsTpl\"></ng-container>\n </ng-container>\n }\n <!-- Add-on actions (SPARK_QUERY_LIST_ACTIONS), e.g. the soft-delete Deleted toggle. -->\n @if (listContext(); as ctx) {\n @for (action of listActions; track action.id) {\n <ng-container *bsPriorityNavItem=\"action.priority ?? 60\">\n <ng-container *ngComponentOutlet=\"action.component; inputs: { context: ctx }\" />\n </ng-container>\n }\n }\n </bs-priority-nav>\n </div>\n\n <h2 class=\"mb-4 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n {{ (query()?.label | resolveTranslation) || query()?.name || ('common.loading' | t) }}\n @if (isStreaming()) {\n <bs-badge [type]=\"colors.success\" class=\"ms-2 align-middle spark-live-badge\">LIVE</bs-badge>\n }\n @if (deletedMode() === 'only') {\n <bs-badge [type]=\"colors.secondary\" class=\"ms-2 align-middle spark-deleted-badge\">{{ 'softDelete.deleted' | t }}</bs-badge>\n }\n </h2>\n\n @if (errorMessage(); as err) {\n <!-- The route could not be resolved to a query at all. A failure INSIDE the grid renders in\n the grid; this is the one it cannot report, because it never got a query id. -->\n <bs-alert [type]=\"colors.danger\" class=\"m-3 d-block\">\n {{ err }}\n </bs-alert>\n } @else if (queryId(); as qId) {\n <div class=\"flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <bs-grid>\n <div bsRow class=\"mb-3\">\n <div [md]=\"12\">\n <!-- The same box as the sub-query card's header (#460 M15): debounce, clear button. -->\n <spark-search-box [(term)]=\"searchTerm\" />\n </div>\n <!-- Its own full-width row rather than a column beside the box: the count is\n occasional, and reserving 8 columns for it shrank the search permanently. The\n @if moved out of the column so nothing reserves vertical space when absent. -->\n @if (searchTerm() && resultCount() !== null) {\n <div [md]=\"12\" class=\"text-end mt-1\">\n <span class=\"text-muted\">\n {{ resultCount() }} {{ resultCount() === 1 ? ('common.resultFound' | t) : ('common.resultsFound' | t) }}\n </span>\n </div>\n }\n </div>\n </bs-grid>\n </div>\n\n <!--\n One grid, both transports. `data` is null for a normal query, so the grid fetches and pages\n server-side; for a streaming query this page owns the socket and hands the filtered snapshot\n in. This used to be two near-identical <bs-datatable> blocks with a shared row template.\n -->\n <!-- The URL's scope (#contributions M5b): a parent and column filters from the query string, as\n the History link sends them. Shown so the narrowing is visible, and clearable. -->\n @if (urlParentId() || activeUrlFilters().length) {\n <div class=\"spark-url-filters d-flex flex-wrap align-items-center gap-2 mb-2 flex-shrink-0\" [class.px-4]=\"isVirtualScrolling()\">\n <span class=\"text-muted small\">{{ 'common.filteredBy' | t }}</span>\n @for (filter of activeUrlFilters(); track filter.name) {\n <bs-badge [type]=\"colors.secondary\" class=\"spark-url-filter\" [attr.data-filter]=\"filter.name\">\n {{ filterLabel(filter.name) }}: {{ filterValues(filter) }}\n <button type=\"button\" class=\"spark-url-filter-clear\" [attr.aria-label]=\"'common.clearFilter' | t\"\n (click)=\"clearUrlFilter(filter.name)\">\n <spark-icon name=\"x-circle\" />\n </button>\n </bs-badge>\n }\n <button type=\"button\" class=\"btn btn-sm btn-link spark-url-filters-clear\" (click)=\"clearUrlScope()\">\n {{ 'common.clearFilters' | t }}\n </button>\n </div>\n }\n\n <spark-query-grid class=\"flex-grow-1\"\n [queryId]=\"qId\"\n [parentId]=\"urlParentId()\"\n [parentType]=\"urlParentType()\"\n [presetFilters]=\"urlFilters()\"\n [data]=\"gridData()\"\n [columns]=\"gridData() ? streamColumns() : null\"\n [search]=\"searchTerm()\"\n [deleted]=\"deletedMode()\"\n [reloadToken]=\"gridReloadToken()\"\n [rowRoute]=\"rowRoute()\"\n [selectionModeSetting]=\"selectionMode()\"\n (rowClicked)=\"rowClicked.emit($event)\"\n (customActionExecuted)=\"customActionExecuted.emit($event)\" />\n } @else {\n <div class=\"text-center p-5\">\n <bs-spinner />\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8DA,IAAa,0BAAb,MAAa,wBAAuB;CACjB,QAAQ,OAAO,cAAc;CAC7B,SAAS,OAAO,MAAM;CACtB,eAAe,OAAO,YAAY;CAClC,mBAAmB,OAAO,qBAAqB;CAC/C,aAAa,OAAO,UAAU;CAC5B,OAAO,OAAO,oBAAoB;CAErD,uBAAuB,MAAgC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,uBAAA,CAAA,+BAAA,CAAA,CAAA;CAC5D,oBAAoB,MAAM,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,o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IAAI,SAAS,OAAO,OAAO,MAAM,QAAO,IAAK,MAAM,QAAO;CAC5D,OAAO,IAAI,aAAa,YAAY,aAAa,WAAW;EAC1D,MAAM,UAAU,OAAO,CAAC;EACxB,MAAM,UAAU,OAAO,CAAC;EACxB,IAAI,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,OAAO,GAAG,OAAO,UAAU;CAC3D;CAEA,OAAO,OAAO,CAAC,CAAC,CAAC,cAAc,OAAO,CAAC,CAAC;AAC1C"}
@@ -1,4 +1,5 @@
1
- import { InjectionToken, reflectComponentType } from "@angular/core";
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, InjectionToken, computed, input, reflectComponentType } from "@angular/core";
2
3
  import { ShowedOn, hasShowedOnFlag } from "@mintplayer/ng-spark/models";
3
4
  const declaredInputs = /* @__PURE__ */ new Map();
4
5
  function withDeclaredInputs(component, inputs) {
@@ -15,11 +16,115 @@ function rendererValue(attr) {
15
16
  function cellValue(value) {
16
17
  return value?.value;
17
18
  }
18
- const SPARK_ATTRIBUTE_RENDERERS = new InjectionToken("SparkAttributeRenderers", { factory: () => [] });
19
+ var SparkParagraphRendererComponent = class SparkParagraphRendererComponent {
20
+ value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
21
+ options = input(...ngDevMode ? [void 0, { debugName: "options" }] : /* istanbul ignore next */ []);
22
+ text = computed(() => {
23
+ const value = this.value();
24
+ return value === null || value === void 0 ? "" : String(value);
25
+ }, ...ngDevMode ? [{ debugName: "text" }] : /* istanbul ignore next */ []);
26
+ asHtml = computed(() => this.options()?.["sanitize"] === false, ...ngDevMode ? [{ debugName: "asHtml" }] : /* istanbul ignore next */ []);
27
+ paragraphs = computed(() => {
28
+ const text = this.text().replace(/\r\n?/g, "\n").trim();
29
+ if (!text) return [];
30
+ return text.split(/\n[ \t]*\n+/).map((paragraph) => paragraph.split("\n"));
31
+ }, ...ngDevMode ? [{ debugName: "paragraphs" }] : /* istanbul ignore next */ []);
32
+ static ɵfac = i0.ɵɵngDeclareFactory({
33
+ minVersion: "12.0.0",
34
+ version: "22.2.0",
35
+ ngImport: i0,
36
+ type: SparkParagraphRendererComponent,
37
+ deps: [],
38
+ target: i0.ɵɵFactoryTarget.Component
39
+ });
40
+ static ɵcmp = i0.ɵɵngDeclareComponent({
41
+ minVersion: "17.0.0",
42
+ version: "22.2.0",
43
+ type: SparkParagraphRendererComponent,
44
+ isStandalone: true,
45
+ selector: "spark-paragraph-renderer",
46
+ inputs: {
47
+ value: {
48
+ classPropertyName: "value",
49
+ publicName: "value",
50
+ isSignal: true,
51
+ isRequired: false,
52
+ transformFunction: null
53
+ },
54
+ options: {
55
+ classPropertyName: "options",
56
+ publicName: "options",
57
+ isSignal: true,
58
+ isRequired: false,
59
+ transformFunction: null
60
+ }
61
+ },
62
+ ngImport: i0,
63
+ template: `
64
+ @if (asHtml()) {
65
+ <div class="spark-paragraph" [innerHTML]="text()"></div>
66
+ } @else {
67
+ @for (paragraph of paragraphs(); track $index) {
68
+ <p class="spark-paragraph">@for (line of paragraph; track $index) {@if (!$first) {<br />}{{ line }}}</p>
69
+ }
70
+ }
71
+ `,
72
+ isInline: true,
73
+ styles: [":host{display:block}.spark-paragraph:last-child{margin-bottom:0}\n"],
74
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
75
+ });
76
+ };
77
+ i0.ɵɵngDeclareClassMetadata({
78
+ minVersion: "12.0.0",
79
+ version: "22.2.0",
80
+ ngImport: i0,
81
+ type: SparkParagraphRendererComponent,
82
+ decorators: [{
83
+ type: Component,
84
+ args: [{
85
+ selector: "spark-paragraph-renderer",
86
+ changeDetection: ChangeDetectionStrategy.OnPush,
87
+ template: `
88
+ @if (asHtml()) {
89
+ <div class="spark-paragraph" [innerHTML]="text()"></div>
90
+ } @else {
91
+ @for (paragraph of paragraphs(); track $index) {
92
+ <p class="spark-paragraph">@for (line of paragraph; track $index) {@if (!$first) {<br />}{{ line }}}</p>
93
+ }
94
+ }
95
+ `,
96
+ styles: [":host{display:block}.spark-paragraph:last-child{margin-bottom:0}\n"]
97
+ }]
98
+ }],
99
+ propDecorators: {
100
+ value: [{
101
+ type: i0.Input,
102
+ args: [{
103
+ isSignal: true,
104
+ alias: "value",
105
+ required: false
106
+ }]
107
+ }],
108
+ options: [{
109
+ type: i0.Input,
110
+ args: [{
111
+ isSignal: true,
112
+ alias: "options",
113
+ required: false
114
+ }]
115
+ }]
116
+ }
117
+ });
118
+ const sparkCoreRenderers = [{
119
+ name: "paragraph",
120
+ detailComponent: SparkParagraphRendererComponent,
121
+ fullWidth: true
122
+ }];
123
+ const SPARK_ATTRIBUTE_RENDERERS = new InjectionToken("SparkAttributeRenderers", { factory: () => [...sparkCoreRenderers] });
19
124
  function provideSparkAttributeRenderers(renderers) {
20
125
  return {
21
126
  provide: SPARK_ATTRIBUTE_RENDERERS,
22
- useValue: renderers
127
+ useValue: [...renderers, ...sparkCoreRenderers]
23
128
  };
24
129
  }
25
130
  function isRowRendered(attribute, registry) {
@@ -49,6 +154,6 @@ function rowRendererInputs(renderer, row, ownerId) {
49
154
  ownerId
50
155
  });
51
156
  }
52
- export { SPARK_ATTRIBUTE_RENDERERS, cellValue, isRowRendered, provideSparkAttributeRenderers, rendererValue, resolveRowRenderer, rowRendererInputs, withDeclaredInputs };
157
+ export { SPARK_ATTRIBUTE_RENDERERS, SparkParagraphRendererComponent, cellValue, isRowRendered, provideSparkAttributeRenderers, rendererValue, resolveRowRenderer, rowRendererInputs, sparkCoreRenderers, withDeclaredInputs };
53
158
 
54
159
  //# sourceMappingURL=mintplayer-ng-spark-renderers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mintplayer-ng-spark-renderers.mjs","names":[],"sources":["../../renderers/src/renderer-inputs.ts","../../renderers/src/spark-attribute-renderer-registry.ts","../../renderers/src/row-renderers.ts"],"sourcesContent":["import { reflectComponentType, Type } from '@angular/core';\nimport { PersistentObjectAttribute, QueryResultItemValue } from '@mintplayer/ng-spark/models';\n\n// Reflection result cached per component type: the input builders are template\n// expressions re-evaluated every CD pass (and query-list virtual-scrolls).\nconst declaredInputs = new Map<Type<any>, Set<string>>();\n\n/**\n * Drops entries the component doesn't declare, so every contract member is\n * genuinely optional — NgComponentOutlet throws on an undeclared input.\n */\nexport function withDeclaredInputs(component: Type<any>, inputs: Record<string, any>): Record<string, any> {\n let declared = declaredInputs.get(component);\n if (!declared) {\n declared = new Set(reflectComponentType(component)?.inputs.map(i => i.templateName) ?? []);\n declaredInputs.set(component, declared);\n }\n return Object.fromEntries(Object.entries(inputs).filter(([k]) => declared!.has(k)));\n}\n\n/**\n * The renderer-facing value of an attribute: the flat value, or for AsDetail\n * attributes (whose flat value the server nulls on purpose) the nested\n * PersistentObject (single) / PersistentObject[] (array).\n *\n * Used by the detail and edit paths, which still work in attributes.\n */\nexport function rendererValue(attr: PersistentObjectAttribute | undefined): any {\n return attr?.value ?? attr?.object ?? attr?.objects;\n}\n\n/**\n * The renderer-facing value of a query-result cell.\n *\n * A cell is a single channel: whatever a renderer needs is already on `value` — for a single-child\n * AsDetail column that is the nested PersistentObject itself, put there by the server so this\n * matches what {@link rendererValue} falls through to on a detail page. There is nothing to fall\n * back to, which is why this is deliberately not the same function: keeping them separate is what\n * stops a renderer silently receiving `undefined` because it was written against the attribute\n * shape's `object` / `objects` fields, which a row does not carry.\n */\nexport function cellValue(value: QueryResultItemValue | undefined): any {\n return value?.value;\n}\n","import { InjectionToken, Provider, Type } from '@angular/core';\n\nexport interface SparkAttributeRendererRegistration {\n /** The renderer name (must match attr.renderer in model JSON) */\n name: string;\n /** Component for the PO detail page. Must implement SparkAttributeDetailRenderer. Omit for a column/edit-only renderer. */\n detailComponent?: Type<any> | null;\n /** Component for query-list column cells. Must implement SparkAttributeColumnRenderer. Omit for a detail/edit-only renderer. */\n columnComponent?: Type<any> | null;\n /** Optional component for create/edit forms. Must implement SparkAttributeEditRenderer. When omitted, the default input is used. */\n editComponent?: Type<any>;\n /**\n * A **row** renderer for AsDetail tables (the PO detail page and the edit form). Attributes of a row\n * type that carry this renderer are not drawn as columns; instead the component is drawn ONCE per\n * row, under the row's first cell, given all of them. Must implement {@link SparkAttributeRowRenderer}.\n *\n * For facts about a row rather than columns of it — contributions' \"by Alice · 3 days ago ·\n * History (4)\" line collapses three read-only attributes into one. `rendererOptions` are taken from\n * the first such attribute (a library writes the same options on each).\n */\n rowComponent?: Type<any>;\n /**\n * Relabels this column's values in a filter panel (#431).\n *\n * A renderer is a component that paints arbitrary DOM, and a distinct value has no row, so it\n * cannot be instantiated to produce text for a filter list. The label therefore defaults to the\n * server-computed cell text: a status rendered as a coloured pill lists `Active`, a rating\n * rendered as stars lists `3`. This is the escape for when that is too raw — a value stored as\n * `2` whose cell reads \"High priority\".\n *\n * ⚠️ A **pure function**: no DOM, no component instantiation, no row context. There is no row to\n * give it, which is the whole reason the renderer itself cannot be used here.\n */\n filterLabel?: (value: unknown) => string;\n}\n\nexport const SPARK_ATTRIBUTE_RENDERERS = new InjectionToken<SparkAttributeRendererRegistration[]>(\n 'SparkAttributeRenderers',\n { factory: () => [] }\n);\n\n/**\n * Register custom attribute renderers globally.\n *\n * @example\n * provideSparkAttributeRenderers([\n * { name: 'video-player', detailComponent: VideoDetailComponent, columnComponent: VideoColumnComponent },\n * { name: 'color-swatch', detailComponent: ColorDetailComponent, columnComponent: ColorColumnComponent },\n * ])\n */\nexport function provideSparkAttributeRenderers(\n renderers: SparkAttributeRendererRegistration[]\n): Provider {\n return {\n provide: SPARK_ATTRIBUTE_RENDERERS,\n useValue: renderers,\n };\n}\n","import { Type } from '@angular/core';\nimport { EntityAttributeDefinition, EntityType, hasShowedOnFlag, ShowedOn } from '@mintplayer/ng-spark/models';\nimport { SparkAttributeRendererRegistration } from './spark-attribute-renderer-registry';\nimport { withDeclaredInputs } from './renderer-inputs';\n\n/** The row renderer of an AsDetail row type, resolved once per type (see `rowComponent`). */\nexport interface SparkResolvedRowRenderer {\n component: Type<any>;\n /** The row-type attributes carrying the renderer, in model order. */\n attributes: EntityAttributeDefinition[];\n /** `rendererOptions` of the first of them. */\n options: Record<string, any> | undefined;\n}\n\n/** Whether `attribute` is drawn by a row renderer (and therefore not as a column). */\nexport function isRowRendered(attribute: EntityAttributeDefinition, registry: readonly SparkAttributeRendererRegistration[] | null | undefined): boolean {\n if (!attribute.renderer || !registry?.length) return false;\n return registry.some(r => r.name === attribute.renderer && !!r.rowComponent);\n}\n\n/**\n * The first row renderer the row type's visible attributes name, or null. One per row: a row type\n * whose attributes name two different row renderers gets the first in model order.\n */\nexport function resolveRowRenderer(\n rowType: EntityType | null | undefined,\n registry: readonly SparkAttributeRendererRegistration[] | null | undefined,\n): SparkResolvedRowRenderer | null {\n if (!rowType || !registry?.length) return null;\n const ordered = [...(rowType.attributes ?? [])]\n .filter(a => hasShowedOnFlag(a.showedOn, ShowedOn.Query) || hasShowedOnFlag(a.showedOn, ShowedOn.PersistentObject))\n .sort((a, b) => a.order - b.order);\n for (const attribute of ordered) {\n const registration = attribute.renderer ? registry.find(r => r.name === attribute.renderer && r.rowComponent) : undefined;\n if (!registration) continue;\n const attributes = ordered.filter(a => a.renderer === registration.name);\n return { component: registration.rowComponent!, attributes, options: attributes[0]?.rendererOptions };\n }\n return null;\n}\n\n/** The input bag for a row renderer, filtered to what the component declares. */\nexport function rowRendererInputs(renderer: SparkResolvedRowRenderer, row: Record<string, any>, ownerId: string | undefined): Record<string, any> {\n return withDeclaredInputs(renderer.component, {\n row,\n attributes: renderer.attributes,\n options: renderer.options,\n ownerId,\n });\n}\n"],"mappings":";;AAKA,MAAM,iCAAiB,IAAI,IAAG;AAM9B,SAAgB,mBAAmB,WAAsB,QAA2B;CAClF,IAAI,WAAW,eAAe,IAAI,SAAS;CAC3C,IAAI,CAAC,UAAU;EACb,WAAW,IAAI,IAAI,qBAAqB,SAAS,CAAC,EAAE,OAAO,KAAI,MAAK,EAAE,YAAY,KAAK,CAAA,CAAE;EACzF,eAAe,IAAI,WAAW,QAAQ;CACxC;CACA,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EACA,YAAY,SAAS;EACrB,SAAS,SAAS;EAClB;CACD,CAAA;AACH"}
1
+ {"version":3,"file":"mintplayer-ng-spark-renderers.mjs","names":[],"sources":["../../renderers/src/renderer-inputs.ts","../../renderers/src/paragraph-renderer.component.ts","../../renderers/src/spark-attribute-renderer-registry.ts","../../renderers/src/row-renderers.ts"],"sourcesContent":["import { reflectComponentType, Type } from '@angular/core';\nimport { PersistentObjectAttribute, QueryResultItemValue } from '@mintplayer/ng-spark/models';\n\n// Reflection result cached per component type: the input builders are template\n// expressions re-evaluated every CD pass (and query-list virtual-scrolls).\nconst declaredInputs = new Map<Type<any>, Set<string>>();\n\n/**\n * Drops entries the component doesn't declare, so every contract member is\n * genuinely optional — NgComponentOutlet throws on an undeclared input.\n */\nexport function withDeclaredInputs(component: Type<any>, inputs: Record<string, any>): Record<string, any> {\n let declared = declaredInputs.get(component);\n if (!declared) {\n declared = new Set(reflectComponentType(component)?.inputs.map(i => i.templateName) ?? []);\n declaredInputs.set(component, declared);\n }\n return Object.fromEntries(Object.entries(inputs).filter(([k]) => declared!.has(k)));\n}\n\n/**\n * The renderer-facing value of an attribute: the flat value, or for AsDetail\n * attributes (whose flat value the server nulls on purpose) the nested\n * PersistentObject (single) / PersistentObject[] (array).\n *\n * Used by the detail and edit paths, which still work in attributes.\n */\nexport function rendererValue(attr: PersistentObjectAttribute | undefined): any {\n return attr?.value ?? attr?.object ?? attr?.objects;\n}\n\n/**\n * The renderer-facing value of a query-result cell.\n *\n * A cell is a single channel: whatever a renderer needs is already on `value` — for a single-child\n * AsDetail column that is the nested PersistentObject itself, put there by the server so this\n * matches what {@link rendererValue} falls through to on a detail page. There is nothing to fall\n * back to, which is why this is deliberately not the same function: keeping them separate is what\n * stops a renderer silently receiving `undefined` because it was written against the attribute\n * shape's `object` / `objects` fields, which a row does not carry.\n */\nexport function cellValue(value: QueryResultItemValue | undefined): any {\n return value?.value;\n}\n","import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core';\nimport { SparkAttributeDetailRenderer } from './spark-attribute-renderer';\n\n/**\n * The core `paragraph` renderer (generic passkeys page, D5): a read-only string shown as body text,\n * full width and without a label — an explanatory text block on a persistent object, filled from\n * translations by the actions class. Pair it with `showedOn: PersistentObject` so it never becomes a\n * grid column.\n *\n * **Escaped by default.** The value is interpolated, so markup in it is shown as text. A blank line\n * starts a new paragraph and a single newline is a line break.\n *\n * `\"rendererOptions\": { \"sanitize\": false }` renders the value as HTML instead, through Angular's\n * `[innerHTML]`, whose sanitizer still strips scripts, event handlers and `javascript:` URLs. There is\n * deliberately no `bypassSecurityTrustHtml` anywhere on this path: the opt-out is \"allow markup\",\n * never \"allow script\".\n */\n@Component({\n selector: 'spark-paragraph-renderer',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (asHtml()) {\n <div class=\"spark-paragraph\" [innerHTML]=\"text()\"></div>\n } @else {\n @for (paragraph of paragraphs(); track $index) {\n <p class=\"spark-paragraph\">@for (line of paragraph; track $index) {@if (!$first) {<br />}{{ line }}}</p>\n }\n }\n `,\n styles: [`\n :host { display: block; }\n .spark-paragraph:last-child { margin-bottom: 0; }\n `],\n})\nexport class SparkParagraphRendererComponent implements SparkAttributeDetailRenderer {\n readonly value = input<any>();\n readonly options = input<Record<string, any> | undefined>();\n\n protected readonly text = computed(() => {\n const value = this.value();\n return value === null || value === undefined ? '' : String(value);\n });\n\n /** Only an explicit `false` opts out of escaping; anything else, absent included, escapes. */\n protected readonly asHtml = computed(() => this.options()?.['sanitize'] === false);\n\n /** Paragraphs split on blank lines, each a list of its lines. */\n protected readonly paragraphs = computed(() => {\n const text = this.text().replace(/\\r\\n?/g, '\\n').trim();\n if (!text) return [];\n return text.split(/\\n[ \\t]*\\n+/).map(paragraph => paragraph.split('\\n'));\n });\n}\n","import { InjectionToken, Provider, Type } from '@angular/core';\nimport { SparkParagraphRendererComponent } from './paragraph-renderer.component';\n\nexport interface SparkAttributeRendererRegistration {\n /** The renderer name (must match attr.renderer in model JSON) */\n name: string;\n /** Component for the PO detail page. Must implement SparkAttributeDetailRenderer. Omit for a column/edit-only renderer. */\n detailComponent?: Type<any> | null;\n /** Component for query-list column cells. Must implement SparkAttributeColumnRenderer. Omit for a detail/edit-only renderer. */\n columnComponent?: Type<any> | null;\n /** Optional component for create/edit forms. Must implement SparkAttributeEditRenderer. When omitted, the default input is used. */\n editComponent?: Type<any>;\n /**\n * A **row** renderer for AsDetail tables (the PO detail page and the edit form). Attributes of a row\n * type that carry this renderer are not drawn as columns; instead the component is drawn ONCE per\n * row, under the row's first cell, given all of them. Must implement {@link SparkAttributeRowRenderer}.\n *\n * For facts about a row rather than columns of it — contributions' \"by Alice · 3 days ago ·\n * History (4)\" line collapses three read-only attributes into one. `rendererOptions` are taken from\n * the first such attribute (a library writes the same options on each).\n */\n rowComponent?: Type<any>;\n /**\n * Relabels this column's values in a filter panel (#431).\n *\n * A renderer is a component that paints arbitrary DOM, and a distinct value has no row, so it\n * cannot be instantiated to produce text for a filter list. The label therefore defaults to the\n * server-computed cell text: a status rendered as a coloured pill lists `Active`, a rating\n * rendered as stars lists `3`. This is the escape for when that is too raw — a value stored as\n * `2` whose cell reads \"High priority\".\n *\n * ⚠️ A **pure function**: no DOM, no component instantiation, no row context. There is no row to\n * give it, which is the whole reason the renderer itself cannot be used here.\n */\n filterLabel?: (value: unknown) => string;\n /**\n * The detail page draws the renderer across the whole row, with no label: for text blocks such\n * as the core `paragraph` renderer, which are body text rather than a labelled value.\n */\n fullWidth?: boolean;\n}\n\n/**\n * The renderers ng-spark ships itself, available in every app without registration. An app's own\n * registration of the same name wins (it comes first in the list).\n */\nexport const sparkCoreRenderers: readonly SparkAttributeRendererRegistration[] = [\n { name: 'paragraph', detailComponent: SparkParagraphRendererComponent, fullWidth: true },\n];\n\nexport const SPARK_ATTRIBUTE_RENDERERS = new InjectionToken<SparkAttributeRendererRegistration[]>(\n 'SparkAttributeRenderers',\n { factory: () => [...sparkCoreRenderers] }\n);\n\n/**\n * Register custom attribute renderers globally.\n *\n * @example\n * provideSparkAttributeRenderers([\n * { name: 'video-player', detailComponent: VideoDetailComponent, columnComponent: VideoColumnComponent },\n * { name: 'color-swatch', detailComponent: ColorDetailComponent, columnComponent: ColorColumnComponent },\n * ])\n */\nexport function provideSparkAttributeRenderers(\n renderers: SparkAttributeRendererRegistration[]\n): Provider {\n return {\n provide: SPARK_ATTRIBUTE_RENDERERS,\n // The app's first, so `find` by name lets it replace a core renderer.\n useValue: [...renderers, ...sparkCoreRenderers],\n };\n}\n","import { Type } from '@angular/core';\nimport { EntityAttributeDefinition, EntityType, hasShowedOnFlag, ShowedOn } from '@mintplayer/ng-spark/models';\nimport { SparkAttributeRendererRegistration } from './spark-attribute-renderer-registry';\nimport { withDeclaredInputs } from './renderer-inputs';\n\n/** The row renderer of an AsDetail row type, resolved once per type (see `rowComponent`). */\nexport interface SparkResolvedRowRenderer {\n component: Type<any>;\n /** The row-type attributes carrying the renderer, in model order. */\n attributes: EntityAttributeDefinition[];\n /** `rendererOptions` of the first of them. */\n options: Record<string, any> | undefined;\n}\n\n/** Whether `attribute` is drawn by a row renderer (and therefore not as a column). */\nexport function isRowRendered(attribute: EntityAttributeDefinition, registry: readonly SparkAttributeRendererRegistration[] | null | undefined): boolean {\n if (!attribute.renderer || !registry?.length) return false;\n return registry.some(r => r.name === attribute.renderer && !!r.rowComponent);\n}\n\n/**\n * The first row renderer the row type's visible attributes name, or null. One per row: a row type\n * whose attributes name two different row renderers gets the first in model order.\n */\nexport function resolveRowRenderer(\n rowType: EntityType | null | undefined,\n registry: readonly SparkAttributeRendererRegistration[] | null | undefined,\n): SparkResolvedRowRenderer | null {\n if (!rowType || !registry?.length) return null;\n const ordered = [...(rowType.attributes ?? [])]\n .filter(a => hasShowedOnFlag(a.showedOn, ShowedOn.Query) || hasShowedOnFlag(a.showedOn, ShowedOn.PersistentObject))\n .sort((a, b) => a.order - b.order);\n for (const attribute of ordered) {\n const registration = attribute.renderer ? registry.find(r => r.name === attribute.renderer && r.rowComponent) : undefined;\n if (!registration) continue;\n const attributes = ordered.filter(a => a.renderer === registration.name);\n return { component: registration.rowComponent!, attributes, options: attributes[0]?.rendererOptions };\n }\n return null;\n}\n\n/** The input bag for a row renderer, filtered to what the component declares. */\nexport function rowRendererInputs(renderer: SparkResolvedRowRenderer, row: Record<string, any>, ownerId: string | undefined): Record<string, any> {\n return withDeclaredInputs(renderer.component, {\n row,\n attributes: renderer.attributes,\n options: renderer.options,\n ownerId,\n });\n}\n"],"mappings":";;;AAKA,MAAM,iCAAiB,IAAI,IAAG;AAM9B,SAAgB,mBAAmB,WAAsB,QAA2B;CAClF,IAAI,WAAW,eAAe,IAAI,SAAS;CAC3C,IAAI,CAAC,UAAU;EACb,WAAW,IAAI,IAAI,qBAAqB,SAAS,CAAC,EAAE,OAAO,KAAI,MAAK,EAAE,YAAY,KAAK,CAAA,CAAE;EACzF,eAAe,IAAI,WAAW,QAAQ;CACxC;CACA,OAAO,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,SAAU,IAAI,CAAC,CAAC,CAAC;AACpF;AASA,SAAgB,cAAc,MAA2C;CACvE,OAAO,MAAM,SAAS,MAAM,UAAU,MAAM;AAC9C;AAYA,SAAgB,UAAU,OAAuC;CAC/D,OAAO,OAAO;AAChB;ACTA,IAAa,kCAAb,MAAa,gCAA+B;CACjC,QAAQ,MAAY,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACpB,UAAU,MAAwC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,OAAO,eAAc;EACtC,MAAM,QAAQ,KAAK,MAAK;EACxB,OAAO,UAAU,QAAQ,UAAU,SAAY,KAAK,OAAO,KAAK;CAClE,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAGiB,SAAS,eAAe,KAAK,QAAO,CAAE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I,eAC3C,2BACA,EAAE,eAAe,CAAC,GAAG,kBAAkB,EAAC,CAAE;AAY5C,SAAgB,+BACd,WAA+C;CAE/C,OAAO;EACL,SAAS;EAET,UAAU,CAAC,GAAG,WAAW,GAAG,kBAAkB;CAC/C;AACH;ACzDA,SAAgB,cAAc,WAAsC,UAA0E;CAC5I,IAAI,CAAC,UAAU,YAAY,CAAC,UAAU,QAAQ,OAAO;CACrD,OAAO,SAAS,MAAK,MAAK,EAAE,SAAS,UAAU,YAAY,CAAC,CAAC,EAAE,YAAY;AAC7E;AAMA,SAAgB,mBACd,SACA,UAA0E;CAE1E,IAAI,CAAC,WAAW,CAAC,UAAU,QAAQ,OAAO;CAC1C,MAAM,UAAU,CAAC,GAAI,QAAQ,cAAc,CAAA,CAAG,CAAC,CAC5C,QAAO,MAAK,gBAAgB,EAAE,UAAU,SAAS,KAAK,KAAK,gBAAgB,EAAE,UAAU,SAAS,gBAAgB,CAAC,CAAC,CAClH,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;CACnC,KAAK,MAAM,aAAa,SAAS;EAC/B,MAAM,eAAe,UAAU,WAAW,SAAS,MAAK,MAAK,EAAE,SAAS,UAAU,YAAY,EAAE,YAAY,IAAI;EAChH,IAAI,CAAC,cAAc;EACnB,MAAM,aAAa,QAAQ,QAAO,MAAK,EAAE,aAAa,aAAa,IAAI;EACvE,OAAO;GAAE,WAAW,aAAa;GAAe;GAAY,SAAS,WAAW,EAAE,EAAE;EAAe;CACrG;CACA,OAAO;AACT;AAGA,SAAgB,kBAAkB,UAAoC,KAA0B,SAA2B;CACzH,OAAO,mBAAmB,SAAS,WAAW;EAC5C;EACA,YAAY,SAAS;EACrB,SAAS,SAAS;EAClB;CACD,CAAA;AACH"}
@@ -6,11 +6,13 @@ import { BsModalBodyDirective, BsModalDirective, BsModalFooterDirective, BsModal
6
6
  import { BsButtonTypeDirective } from "@mintplayer/ng-bootstrap/button-type";
7
7
  import { RetryActionService, SparkService } from "@mintplayer/ng-spark/services";
8
8
  import { SparkPoFormComponent } from "@mintplayer/ng-spark/po-form";
9
- import { dictToNestedPo, nestedPoToDict } from "@mintplayer/ng-spark/models";
9
+ import { TranslateKeyPipe } from "@mintplayer/ng-spark/pipes";
10
+ import { SPARK_RETRY_CANCEL, dictToNestedPo, nestedPoToDict } from "@mintplayer/ng-spark/models";
10
11
  var SparkRetryActionModalComponent = class SparkRetryActionModalComponent {
11
12
  retryActionService = inject(RetryActionService);
12
13
  sparkService = inject(SparkService);
13
14
  colors = Color;
15
+ cancel = SPARK_RETRY_CANCEL;
14
16
  isOpen = computed(() => this.retryActionService.payload() !== null, ...ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []);
15
17
  entityType = signal(null, ...ngDevMode ? [{ debugName: "entityType" }] : /* istanbul ignore next */ []);
16
18
  formData = signal({}, ...ngDevMode ? [{ debugName: "formData" }] : /* istanbul ignore next */ []);
@@ -72,7 +74,7 @@ var SparkRetryActionModalComponent = class SparkRetryActionModalComponent {
72
74
  selector: "spark-retry-action-modal",
73
75
  ngImport: i0,
74
76
  template: `
75
- <bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption('Cancel')">
77
+ <bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption(cancel)">
76
78
  <div *bsModal>
77
79
  <div bsModalHeader>
78
80
  <h5 class="modal-title">{{ retryActionService.payload()?.title }}</h5>
@@ -93,11 +95,22 @@ var SparkRetryActionModalComponent = class SparkRetryActionModalComponent {
93
95
  @for (option of retryActionService.payload()?.options; track option) {
94
96
  <button
95
97
  type="button"
96
- [color]="option === 'Cancel' ? colors.secondary : colors.primary"
98
+ [color]="colors.primary"
97
99
  (click)="onOption(option)">
98
100
  {{ option }}
99
101
  </button>
100
102
  }
103
+ <!-- The prompt's Cancel is the client's, in the user's language; it answers the identifier
104
+ 'Cancel' whatever it reads, which is why the server asks for it with a flag. -->
105
+ @if (retryActionService.payload()?.cancellable) {
106
+ <button
107
+ type="button"
108
+ class="spark-retry-cancel"
109
+ [color]="colors.secondary"
110
+ (click)="onOption(cancel)">
111
+ {{ 'common.cancel' | t }}
112
+ </button>
113
+ }
101
114
  </div>
102
115
  </div>
103
116
  </bs-modal>
@@ -172,6 +185,11 @@ var SparkRetryActionModalComponent = class SparkRetryActionModalComponent {
172
185
  "nestedTriggerBlurred",
173
186
  "refreshOverlayChange"
174
187
  ]
188
+ },
189
+ {
190
+ kind: "pipe",
191
+ type: TranslateKeyPipe,
192
+ name: "t"
175
193
  }
176
194
  ],
177
195
  changeDetection: i0.ChangeDetectionStrategy.OnPush
@@ -194,10 +212,11 @@ i0.ɵɵngDeclareClassMetadata({
194
212
  BsModalBodyDirective,
195
213
  BsModalFooterDirective,
196
214
  BsButtonTypeDirective,
197
- SparkPoFormComponent
215
+ SparkPoFormComponent,
216
+ TranslateKeyPipe
198
217
  ],
199
218
  template: `
200
- <bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption('Cancel')">
219
+ <bs-modal [isOpen]="isOpen()" (isOpenChange)="!$event && onOption(cancel)">
201
220
  <div *bsModal>
202
221
  <div bsModalHeader>
203
222
  <h5 class="modal-title">{{ retryActionService.payload()?.title }}</h5>
@@ -218,11 +237,22 @@ i0.ɵɵngDeclareClassMetadata({
218
237
  @for (option of retryActionService.payload()?.options; track option) {
219
238
  <button
220
239
  type="button"
221
- [color]="option === 'Cancel' ? colors.secondary : colors.primary"
240
+ [color]="colors.primary"
222
241
  (click)="onOption(option)">
223
242
  {{ option }}
224
243
  </button>
225
244
  }
245
+ <!-- The prompt's Cancel is the client's, in the user's language; it answers the identifier
246
+ 'Cancel' whatever it reads, which is why the server asks for it with a flag. -->
247
+ @if (retryActionService.payload()?.cancellable) {
248
+ <button
249
+ type="button"
250
+ class="spark-retry-cancel"
251
+ [color]="colors.secondary"
252
+ (click)="onOption(cancel)">
253
+ {{ 'common.cancel' | t }}
254
+ </button>
255
+ }
226
256
  </div>
227
257
  </div>
228
258
  </bs-modal>