@mintplayer/ng-spark 22.13.0 → 22.15.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.
@@ -237,6 +237,19 @@ interface EntityType {
237
237
  attributes: EntityAttributeDefinition[];
238
238
  /** Query aliases or IDs to display as related query tables on the detail page. */
239
239
  queries?: string[];
240
+ /**
241
+ * The definitions of this type's AsDetail row types, sent alongside it so a detail table can draw
242
+ * its columns.
243
+ *
244
+ * Needed because a row type usually has no rights of its own — a row is edited through its parent
245
+ * — and the entity-type catalogue is gated on `Query`. Resolving a row type from the catalogue
246
+ * therefore failed silently, and the table rendered with **no columns at all**.
247
+ *
248
+ * Per-caller and gated on the *parent's* right, which is the same gate that already ships each
249
+ * row's attribute schema inside `attr.objects`. Pruned server-side: no `queryType`, `indexName`,
250
+ * `queries` or `alias`.
251
+ */
252
+ detailTypes?: EntityType[];
240
253
  }
241
254
 
242
255
  type SparkQueryRenderMode = 'Pagination' | 'VirtualScrolling';
@@ -552,6 +565,26 @@ declare function nestedPoToDict(po: PersistentObject | null | undefined): Record
552
565
  * can never contain it.
553
566
  */
554
567
  declare const AS_DETAIL_SELF_BREADCRUMB_KEY = "__sparkBreadcrumb";
568
+ /**
569
+ * Reserved key under which a flattened nested object keeps its own row key — the value of whatever
570
+ * property the server registered as that type's `[ValueKey]`.
571
+ *
572
+ * A value object's key is not a model attribute (nothing declares `Id` in its model file), so it
573
+ * travels as the nested `PersistentObject`'s `id` and has to be carried across the flat-dict form
574
+ * state by hand. Before this existed, flattening dropped it and `dictToNestedPo` rebuilt `id` from
575
+ * `dict['Id']`, which is never present — so **every** embedded row reached the server with an empty
576
+ * id, and the fresh instance the mapper builds kept the guid its own field initializer had just
577
+ * minted.
578
+ *
579
+ * That is not cosmetic. Stored keys and incoming keys were then both plausible and never equal, so
580
+ * a save could not match rows: an edit was indistinguishable from a delete plus a create. Every
581
+ * per-row rule — preserving read-only fields, and the `New`/`Edit`/`Delete` rights of the row type —
582
+ * rests on this key surviving the round trip.
583
+ *
584
+ * Safe to carry, for the same reason the breadcrumb is: `dictToNestedPo` walks the entity type's
585
+ * attributes and never the dict's keys, so a reserved key is never sent back as an attribute.
586
+ */
587
+ declare const AS_DETAIL_ROW_KEY = "__sparkRowKey";
555
588
  /**
556
589
  * The breadcrumb the server resolved for a flattened object, or null when it resolved to nothing.
557
590
  *
@@ -561,6 +594,17 @@ declare const AS_DETAIL_SELF_BREADCRUMB_KEY = "__sparkBreadcrumb";
561
594
  * rendering nothing — it reads as a real value. `typeName` lets a caller filter it back out.
562
595
  */
563
596
  declare function selfBreadcrumb(row: Record<string, any> | null | undefined, typeName?: string): string | null;
597
+ /**
598
+ * The same filter as {@link selfBreadcrumb}, for a caller holding the server's breadcrumb string
599
+ * directly rather than a flattened row dict — `attr.object.breadcrumb` on a detail page, or a query
600
+ * cell's `breadcrumb`.
601
+ *
602
+ * Split out so there is exactly one answer to "is this the type-name placeholder?". The first
603
+ * implementation lived inside `selfBreadcrumb` and so covered only the two pipes that flatten a row
604
+ * first; the two that read the string straight off the wire kept printing `BuildFeedback` and
605
+ * `GateSettings` at users (#384). A second copy of the comparison is how that happens again.
606
+ */
607
+ declare function resolvedBreadcrumb(value: unknown, typeName?: string): string | null;
564
608
  /**
565
609
  * Reserved key under which {@link nestedPoToDisplayRow} stashes the server-resolved breadcrumb of
566
610
  * each reference attribute (keyed by attribute name). Lets an AsDetail reference cell render the
@@ -568,6 +612,16 @@ declare function selfBreadcrumb(row: Record<string, any> | null | undefined, typ
568
612
  * reference-query options page. Prefixed to avoid colliding with a real attribute name.
569
613
  */
570
614
  declare const AS_DETAIL_BREADCRUMBS_KEY = "__sparkBreadcrumbs";
615
+ /**
616
+ * Whether a flattened-row key is one this module reserved rather than a model attribute.
617
+ *
618
+ * `nestedPoToDict` and `nestedPoToDisplayRow` stash the row key and the resolved breadcrumbs
619
+ * alongside the real values, which is safe on the way back — `dictToNestedPo` walks the entity
620
+ * type's attributes and never the dict's keys. It is *not* safe for anything that enumerates the
621
+ * dict to build display text: a caller joining `Object.values(dict)` prints the row's guid and its
622
+ * own breadcrumb as though they were fields.
623
+ */
624
+ declare function isReservedAsDetailKey(key: string): boolean;
571
625
  /**
572
626
  * Like {@link nestedPoToDict}, but for the read-only detail display path. In addition to each
573
627
  * attribute's value it preserves the server-resolved per-reference `breadcrumb` under
@@ -720,5 +774,5 @@ interface EvaluableAttribute {
720
774
  */
721
775
  declare function evaluateRules(attr: EvaluableAttribute, value: any): RuleFailure[];
722
776
 
723
- export { AS_DETAIL_BREADCRUMBS_KEY, AS_DETAIL_SELF_BREADCRUMB_KEY, ELookupDisplayType, EReferenceDisplayType, ShowedOn, applyOverlay, currentLanguage, dictToNestedPo, evaluateRules, filterQueryActions, hasShowedOnFlag, isPersistentObject, isQueryRow, mergeRefreshValues, nestedPoToDict, nestedPoToDisplayRow, overlayFromResponse, parseSelectionRule, resolveTranslation, selectionModeFor, selfBreadcrumb, valueFor };
777
+ export { AS_DETAIL_BREADCRUMBS_KEY, AS_DETAIL_ROW_KEY, AS_DETAIL_SELF_BREADCRUMB_KEY, ELookupDisplayType, EReferenceDisplayType, ShowedOn, applyOverlay, currentLanguage, dictToNestedPo, evaluateRules, filterQueryActions, hasShowedOnFlag, isPersistentObject, isQueryRow, isReservedAsDetailKey, mergeRefreshValues, nestedPoToDict, nestedPoToDisplayRow, overlayFromResponse, parseSelectionRule, resolveTranslation, resolvedBreadcrumb, selectionModeFor, selfBreadcrumb, valueFor };
724
778
  export type { AttributeGroup, AttributeOverlay, AttributeTab, CustomActionDefinition, EntityAttributeDefinition, EntityPermissions, EntityType, EntityTypeResolver, EvaluableAttribute, LookupReference, LookupReferenceListItem, LookupReferenceValue, PersistentObject, PersistentObjectAttribute, PersistentObjectPermissions, ProgramUnit, ProgramUnitGroup, ProgramUnitsConfiguration, QueryColumn, QueryResult, QueryResultItem, QueryResultItemValue, RefreshOverlay, RefreshedOption, RetryActionPayload, RetryActionResult, RuleFailure, SparkCellColumn, SparkQuery, SparkQueryRenderMode, SparkQuerySortColumn, SparkRow, SparkSelectionMode, StreamingErrorMessage, StreamingMessage, StreamingPatchItem, StreamingPatchMessage, StreamingSnapshotMessage, TranslatedString, ValidationError, ValidationErrorResponse, ValidationRule };
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { PipeTransform } from '@angular/core';
3
- import { TranslatedString, PersistentObject, EntityType, LookupReference, EntityAttributeDefinition, QueryResultItem, ProgramUnit, EntityPermissions, ELookupDisplayType, LookupReferenceValue, ValidationError, QueryColumn } from '@mintplayer/ng-spark/models';
3
+ import { TranslatedString, PersistentObject, EntityType, LookupReference, EntityAttributeDefinition, QueryResultItem, SparkRow, ProgramUnit, EntityPermissions, ELookupDisplayType, LookupReferenceValue, ValidationError, QueryColumn } from '@mintplayer/ng-spark/models';
4
4
 
5
5
  declare class TranslateKeyPipe implements PipeTransform {
6
6
  private readonly lang;
@@ -41,8 +41,21 @@ declare class ReferenceDisplayValuePipe implements PipeTransform {
41
41
  static ɵpipe: i0.ɵɵPipeDeclaration<ReferenceDisplayValuePipe, "referenceDisplayValue", true>;
42
42
  }
43
43
 
44
+ /**
45
+ * The text a reference picker's result grid shows in one column.
46
+ *
47
+ * ⚠️ **Reads the row through {@link valueFor}, not through a shape it assumes.** This used to do
48
+ * `item.attributes.find(...)`, which is the `PersistentObject` shape — but a picker's rows are
49
+ * `QueryResultItem`s, which carry `values` (`[{ key, value, breadcrumb }]`) and have no `attributes`
50
+ * at all. Every cell therefore threw `can't access property "find", item.attributes is undefined`,
51
+ * and the picker rendered nothing selectable.
52
+ *
53
+ * There are three row shapes in this codebase and `valueFor` exists precisely so a consumer does not
54
+ * have to know which one it was handed. Using it is also what keeps this working if a picker is ever
55
+ * pointed at an AsDetail sub-table, whose rows are the flat record shape.
56
+ */
44
57
  declare class ReferenceAttrValuePipe implements PipeTransform {
45
- transform(item: PersistentObject, attrName: string): any;
58
+ transform(item: SparkRow, attrName: string): any;
46
59
  static ɵfac: i0.ɵɵFactoryDeclaration<ReferenceAttrValuePipe, never>;
47
60
  static ɵpipe: i0.ɵɵPipeDeclaration<ReferenceAttrValuePipe, "referenceAttrValue", true>;
48
61
  }
@@ -157,6 +170,23 @@ declare class CanDeleteDetailRowPipe implements PipeTransform {
157
170
  static ɵpipe: i0.ɵɵPipeDeclaration<CanDeleteDetailRowPipe, "canDeleteDetailRow", true>;
158
171
  }
159
172
 
173
+ /**
174
+ * Whether the caller may edit rows of an AsDetail attribute's row type.
175
+ *
176
+ * The third of the `can*DetailRow` family, and the one the server was already answering. `canEdit`
177
+ * has been computed, shipped and fetched per AsDetail attribute since row rights landed — it was
178
+ * simply never read for the row path, so the form offered an edit the save would undo.
179
+ *
180
+ * ⚠️ Apply this **read-only, never hidden**. A row the caller may not edit must stay fully
181
+ * readable; hiding the inputs would hide the data, which is a worse answer than showing it
182
+ * uneditable.
183
+ */
184
+ declare class CanEditDetailRowPipe implements PipeTransform {
185
+ transform(attr: EntityAttributeDefinition, permissions: Record<string, EntityPermissions>): boolean;
186
+ static ɵfac: i0.ɵɵFactoryDeclaration<CanEditDetailRowPipe, never>;
187
+ static ɵpipe: i0.ɵɵPipeDeclaration<CanEditDetailRowPipe, "canEditDetailRow", true>;
188
+ }
189
+
160
190
  declare class LookupDisplayTypePipe implements PipeTransform {
161
191
  transform(attr: EntityAttributeDefinition, lookupRefOptions: Record<string, LookupReference>): ELookupDisplayType;
162
192
  static ɵfac: i0.ɵɵFactoryDeclaration<LookupDisplayTypePipe, never>;
@@ -235,5 +265,5 @@ declare class QueryReferenceChipsPipe implements PipeTransform {
235
265
  static ɵpipe: i0.ɵɵPipeDeclaration<QueryReferenceChipsPipe, "queryReferenceChips", true>;
236
266
  }
237
267
 
238
- export { ArrayValuePipe, AsDetailCellValuePipe, AsDetailColumnsPipe, AsDetailDisplayValuePipe, AsDetailTypePipe, AttributeValuePipe, CanCreateDetailRowPipe, CanDeleteDetailRowPipe, ErrorForAttributePipe, IconNamePipe, InlineRefOptionsPipe, InputTypePipe, LookupDisplayTypePipe, LookupDisplayValuePipe, LookupOptionsPipe, QueryCellValuePipe, QueryReferenceChipsPipe, RawAttributeValuePipe, ReferenceAttrValuePipe, ReferenceChipsPipe, ReferenceDisplayValuePipe, ReferenceLinkRoutePipe, ResolveTranslationPipe, RouterLinkPipe, TranslateKeyPipe };
268
+ export { ArrayValuePipe, AsDetailCellValuePipe, AsDetailColumnsPipe, AsDetailDisplayValuePipe, AsDetailTypePipe, AttributeValuePipe, CanCreateDetailRowPipe, CanDeleteDetailRowPipe, CanEditDetailRowPipe, ErrorForAttributePipe, IconNamePipe, InlineRefOptionsPipe, InputTypePipe, LookupDisplayTypePipe, LookupDisplayValuePipe, LookupOptionsPipe, QueryCellValuePipe, QueryReferenceChipsPipe, RawAttributeValuePipe, ReferenceAttrValuePipe, ReferenceChipsPipe, ReferenceDisplayValuePipe, ReferenceLinkRoutePipe, ResolveTranslationPipe, RouterLinkPipe, TranslateKeyPipe };
239
269
  export type { AsDetailCellValue, ReferenceChip };