@mintplayer/ng-spark 22.2.0 → 22.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/fesm2022/mintplayer-ng-spark-client-operations.mjs +78 -4
  2. package/fesm2022/mintplayer-ng-spark-client-operations.mjs.map +1 -1
  3. package/fesm2022/mintplayer-ng-spark-grid.mjs +860 -0
  4. package/fesm2022/mintplayer-ng-spark-grid.mjs.map +1 -0
  5. package/fesm2022/mintplayer-ng-spark-models.mjs +160 -1
  6. package/fesm2022/mintplayer-ng-spark-models.mjs.map +1 -1
  7. package/fesm2022/mintplayer-ng-spark-pipes.mjs +31 -5
  8. package/fesm2022/mintplayer-ng-spark-pipes.mjs.map +1 -1
  9. package/fesm2022/mintplayer-ng-spark-po-create.mjs +2 -2
  10. package/fesm2022/mintplayer-ng-spark-po-create.mjs.map +1 -1
  11. package/fesm2022/mintplayer-ng-spark-po-detail.mjs +36 -153
  12. package/fesm2022/mintplayer-ng-spark-po-detail.mjs.map +1 -1
  13. package/fesm2022/mintplayer-ng-spark-po-edit.mjs +2 -2
  14. package/fesm2022/mintplayer-ng-spark-po-edit.mjs.map +1 -1
  15. package/fesm2022/mintplayer-ng-spark-po-form.mjs +4 -4
  16. package/fesm2022/mintplayer-ng-spark-po-form.mjs.map +1 -1
  17. package/fesm2022/mintplayer-ng-spark-query-list.mjs +148 -277
  18. package/fesm2022/mintplayer-ng-spark-query-list.mjs.map +1 -1
  19. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs +5 -3
  20. package/fesm2022/mintplayer-ng-spark-retry-action-modal.mjs.map +1 -1
  21. package/fesm2022/mintplayer-ng-spark.mjs +1 -1
  22. package/fesm2022/mintplayer-ng-spark.mjs.map +1 -1
  23. package/package.json +6 -2
  24. package/types/mintplayer-ng-spark-client-operations.d.ts +39 -4
  25. package/types/mintplayer-ng-spark-grid.d.ts +499 -0
  26. package/types/mintplayer-ng-spark-models.d.ts +74 -3
  27. package/types/mintplayer-ng-spark-po-detail.d.ts +19 -31
  28. package/types/mintplayer-ng-spark-query-list.d.ts +56 -36
@@ -2,13 +2,13 @@ import * as _angular_core from '@angular/core';
2
2
  import { TemplateRef, Type } from '@angular/core';
3
3
  import { Color } from '@mintplayer/ng-bootstrap';
4
4
  import { SparkLanguageService } from '@mintplayer/ng-spark/services';
5
- import { PersistentObject, EntityType, CustomActionDefinition, LookupReference, EntityAttributeDefinition, AttributeTab, AttributeGroup, SparkQuery } from '@mintplayer/ng-spark/models';
6
- import { DatatableSettings, BsDatatableFetch } from '@mintplayer/ng-bootstrap/datatable';
5
+ import { PersistentObject, EntityType, CustomActionDefinition, LookupReference, EntityAttributeDefinition, AttributeTab, AttributeGroup } from '@mintplayer/ng-spark/models';
7
6
 
8
7
  declare class SparkPoDetailComponent {
9
8
  private readonly route;
10
9
  private readonly router;
11
10
  private readonly sparkService;
11
+ private readonly queryRefresh;
12
12
  protected readonly lang: SparkLanguageService;
13
13
  private readonly rendererRegistry;
14
14
  showCustomActions: _angular_core.InputSignal<boolean>;
@@ -17,6 +17,21 @@ declare class SparkPoDetailComponent {
17
17
  $implicit: PersistentObject;
18
18
  entityType: EntityType;
19
19
  }> | null>;
20
+ /**
21
+ * Header slots forwarded to every sub-query card on this page.
22
+ *
23
+ * A structural directive cannot cross a component boundary, and this component is created by
24
+ * the router — in a default app there is no `<spark-po-detail>` tag to project content into.
25
+ * So an app that wants slotted chrome on its sub-queries substitutes its own route component
26
+ * via `SparkRouteConfig.poDetail` and forwards the templates through here. Forwarding a
27
+ * `TemplateRef` as an input is already this component's idiom; see the two above.
28
+ *
29
+ * Each slot may target one query by alias, so a single forwarded set serves a page rendering
30
+ * several sub-queries.
31
+ */
32
+ queryIconTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
33
+ queryCaptionTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
34
+ queryActionsTemplate: _angular_core.InputSignal<TemplateRef<any> | null>;
20
35
  edited: _angular_core.OutputEmitterRef<void>;
21
36
  deleted: _angular_core.OutputEmitterRef<void>;
22
37
  customActionExecuted: _angular_core.OutputEmitterRef<{
@@ -56,34 +71,7 @@ declare class SparkPoDetailComponent {
56
71
  onDelete(): Promise<void>;
57
72
  onBack(): void;
58
73
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SparkPoDetailComponent, never>;
59
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SparkPoDetailComponent, "spark-po-detail", never, { "showCustomActions": { "alias": "showCustomActions"; "required": false; "isSignal": true; }; "extraActionsTemplate": { "alias": "extraActionsTemplate"; "required": false; "isSignal": true; }; "extraContentTemplate": { "alias": "extraContentTemplate"; "required": false; "isSignal": true; }; }, { "edited": "edited"; "deleted": "deleted"; "customActionExecuted": "customActionExecuted"; }, never, never, true, never>;
74
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SparkPoDetailComponent, "spark-po-detail", never, { "showCustomActions": { "alias": "showCustomActions"; "required": false; "isSignal": true; }; "extraActionsTemplate": { "alias": "extraActionsTemplate"; "required": false; "isSignal": true; }; "extraContentTemplate": { "alias": "extraContentTemplate"; "required": false; "isSignal": true; }; "queryIconTemplate": { "alias": "queryIconTemplate"; "required": false; "isSignal": true; }; "queryCaptionTemplate": { "alias": "queryCaptionTemplate"; "required": false; "isSignal": true; }; "queryActionsTemplate": { "alias": "queryActionsTemplate"; "required": false; "isSignal": true; }; }, { "edited": "edited"; "deleted": "deleted"; "customActionExecuted": "customActionExecuted"; }, never, never, true, never>;
60
75
  }
61
76
 
62
- declare class SparkSubQueryComponent {
63
- private readonly sparkService;
64
- private readonly rendererRegistry;
65
- queryId: _angular_core.InputSignal<string>;
66
- parentId: _angular_core.InputSignal<string>;
67
- parentType: _angular_core.InputSignal<string>;
68
- query: _angular_core.WritableSignal<SparkQuery | null>;
69
- entityType: _angular_core.WritableSignal<EntityType | null>;
70
- allEntityTypes: _angular_core.WritableSignal<EntityType[]>;
71
- resultCount: _angular_core.WritableSignal<number | null>;
72
- lookupReferenceOptions: _angular_core.WritableSignal<Record<string, LookupReference>>;
73
- loading: _angular_core.WritableSignal<boolean>;
74
- canRead: _angular_core.WritableSignal<boolean>;
75
- settings: _angular_core.WritableSignal<DatatableSettings>;
76
- fetchFn: _angular_core.WritableSignal<BsDatatableFetch<PersistentObject> | null>;
77
- isVirtualScrolling: _angular_core.Signal<boolean>;
78
- visibleAttributes: _angular_core.Signal<EntityAttributeDefinition[]>;
79
- constructor();
80
- private loadData;
81
- private makeFetch;
82
- private loadLookupReferenceOptions;
83
- getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null;
84
- getColumnRendererInputs(component: Type<any>, item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any>;
85
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<SparkSubQueryComponent, never>;
86
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SparkSubQueryComponent, "spark-sub-query", never, { "queryId": { "alias": "queryId"; "required": true; "isSignal": true; }; "parentId": { "alias": "parentId"; "required": true; "isSignal": true; }; "parentType": { "alias": "parentType"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
87
- }
88
-
89
- export { SparkPoDetailComponent, SparkSubQueryComponent };
77
+ export { SparkPoDetailComponent };
@@ -1,18 +1,34 @@
1
+ import * as _mintplayer_ng_spark_models from '@mintplayer/ng-spark/models';
2
+ import { PersistentObject, CustomActionDefinition } from '@mintplayer/ng-spark/models';
1
3
  import * as _angular_core from '@angular/core';
2
- import { TemplateRef, Type } from '@angular/core';
4
+ import { TemplateRef } from '@angular/core';
3
5
  import { Color } from '@mintplayer/ng-bootstrap';
4
- import { BsDatatableFetch, DatatableSettings } from '@mintplayer/ng-bootstrap/datatable';
5
6
  import { SparkLanguageService } from '@mintplayer/ng-spark/services';
6
- import { PersistentObject, CustomActionDefinition, SparkQuery, EntityType, LookupReference, EntityAttributeDefinition } from '@mintplayer/ng-spark/models';
7
7
 
8
+ /**
9
+ * The routed query page: chrome around one {@link SparkQueryGridComponent}.
10
+ *
11
+ * It owns what is genuinely page-shaped and route-shaped, and nothing else:
12
+ *
13
+ * - **Route resolution.** It has no `queryId` input; it reads `paramMap`, and it serves two
14
+ * routes — `query/:queryId`, and `po/:type`, which resolves an entity type to a query. That
15
+ * second one is type-to-query resolution, not query rendering, and is why this component still
16
+ * exists rather than the router pointing at the grid.
17
+ * - **Streaming.** The websocket lives here so it stays out of every PO detail page's bundle;
18
+ * the snapshot is filtered and sorted client-side and handed to the grid as `[data]`.
19
+ * - The action bar, the caption, the LIVE badge, the search box and the New button.
20
+ *
21
+ * The grid itself — columns, cells, paging, the row link, selection, custom-action execution —
22
+ * is the shared component. This page previously wrote out `<bs-datatable>` twice, once per
23
+ * transport, with a shared row template between them; both are gone.
24
+ */
8
25
  declare class SparkQueryListComponent {
9
26
  private readonly route;
10
27
  private readonly router;
11
28
  private readonly sparkService;
12
29
  private readonly streamingService;
13
- protected readonly lang: SparkLanguageService;
14
- private readonly rendererRegistry;
15
30
  private readonly destroyRef;
31
+ protected readonly lang: SparkLanguageService;
16
32
  extraActionsTemplate: _angular_core.InputSignal<TemplateRef<void> | null>;
17
33
  showCustomActions: _angular_core.InputSignal<boolean>;
18
34
  rowClicked: _angular_core.OutputEmitterRef<PersistentObject>;
@@ -21,44 +37,48 @@ declare class SparkQueryListComponent {
21
37
  action: CustomActionDefinition;
22
38
  }>;
23
39
  colors: typeof Color;
40
+ /** The query the grid should render, resolved from the route. Null until it is known. */
41
+ queryId: _angular_core.WritableSignal<string | null>;
24
42
  errorMessage: _angular_core.WritableSignal<string | null>;
25
- query: _angular_core.WritableSignal<SparkQuery | null>;
26
- entityType: _angular_core.WritableSignal<EntityType | null>;
27
- allEntityTypes: _angular_core.WritableSignal<EntityType[]>;
28
- lookupReferenceOptions: _angular_core.WritableSignal<Record<string, LookupReference>>;
29
- resultCount: _angular_core.WritableSignal<number | null>;
30
- searchTerm: string;
31
- canRead: _angular_core.WritableSignal<boolean>;
32
- canCreate: _angular_core.WritableSignal<boolean>;
33
- customActions: _angular_core.WritableSignal<CustomActionDefinition[]>;
43
+ searchTerm: _angular_core.WritableSignal<string>;
44
+ private readonly grid;
45
+ /**
46
+ * Grid state, surfaced for this page's chrome.
47
+ *
48
+ * Optional `viewChild`, read defensively: the action bar and caption render above the grid, so
49
+ * on the first change-detection pass the query has not resolved yet.
50
+ */
51
+ protected readonly query: _angular_core.Signal<_mintplayer_ng_spark_models.SparkQuery | null>;
52
+ protected readonly entityType: _angular_core.Signal<_mintplayer_ng_spark_models.EntityType | null>;
53
+ protected readonly customActions: _angular_core.Signal<CustomActionDefinition[]>;
54
+ protected readonly canCreate: _angular_core.Signal<boolean>;
55
+ protected readonly resultCount: _angular_core.Signal<number | null>;
56
+ protected readonly isVirtualScrolling: _angular_core.Signal<boolean>;
57
+ protected readonly gridError: _angular_core.Signal<string | null>;
58
+ /** Whether an action's selection rule is satisfied. Delegated: the grid holds the selection. */
59
+ protected isActionEnabled(action: CustomActionDefinition): boolean;
34
60
  isStreaming: _angular_core.WritableSignal<boolean>;
35
61
  private streamingSub;
36
- private allItems;
37
- streamItems: _angular_core.WritableSignal<PersistentObject[]>;
38
- fetchFn: _angular_core.WritableSignal<BsDatatableFetch<PersistentObject> | null>;
39
- settings: _angular_core.WritableSignal<DatatableSettings>;
62
+ private readonly allItems;
63
+ private readonly streamItems;
64
+ /**
65
+ * Rows handed to the grid, or `null` to let it fetch for itself.
66
+ *
67
+ * Null for a normal query — an empty array would read as "here are no rows" and suppress the
68
+ * fetch entirely.
69
+ */
70
+ protected readonly gridData: _angular_core.Signal<PersistentObject[] | null>;
40
71
  constructor();
41
72
  private onParamsChange;
42
- onCustomAction(action: CustomActionDefinition): Promise<void>;
43
- private resolveEntityTypeForQuery;
44
- private extractSourceName;
45
- private singularize;
46
73
  /**
47
- * Builds the server-side fetch callback the datatable invokes per page/sort.
48
- * Reads `searchTerm` live, so a settings change (or a new fetchFn identity)
49
- * refetches with the current search term.
74
+ * A load failure has to render, not just be swallowed: a denied query answers 404 (audit M-3, so
75
+ * existence is not leaked), which is indistinguishable from a missing one hence a deliberately
76
+ * generic message rather than a guess at which it was.
50
77
  */
51
- private makeFetch;
52
- /** Force a refetch (e.g. after a custom action) without changing page/sort. */
53
- private refresh;
54
- onSearchChange(): void;
55
- clearSearch(): void;
56
- isVirtualScrolling: _angular_core.Signal<boolean>;
57
- visibleAttributes: _angular_core.Signal<EntityAttributeDefinition[]>;
58
- getColumnRendererComponent(attr: EntityAttributeDefinition): Type<any> | null;
59
- getColumnRendererInputs(component: Type<any>, item: PersistentObject, attr: EntityAttributeDefinition): Record<string, any>;
60
- private loadLookupReferenceOptions;
61
- onCreate(): void;
78
+ private reportLoadFailure;
79
+ protected onCustomAction(action: CustomActionDefinition): Promise<void>;
80
+ protected onCreate(): void;
81
+ protected clearSearch(): void;
62
82
  private connectStreaming;
63
83
  private disconnectStreaming;
64
84
  private handleStreamingMessage;