@memberjunction/ng-base-forms 6.2.0-edge.2 → 6.2.0-edge.4

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 (188) hide show
  1. package/dist/lib/apply/form-placement-dialog.component.d.ts +266 -0
  2. package/dist/lib/apply/form-placement-dialog.component.d.ts.map +1 -0
  3. package/dist/lib/apply/form-placement-dialog.component.js +1522 -0
  4. package/dist/lib/apply/form-placement-dialog.component.js.map +1 -0
  5. package/dist/lib/apply/form-placement-order.d.ts +37 -0
  6. package/dist/lib/apply/form-placement-order.d.ts.map +1 -0
  7. package/dist/lib/apply/form-placement-order.js +111 -0
  8. package/dist/lib/apply/form-placement-order.js.map +1 -0
  9. package/dist/lib/apply/form-placement-preview.component.d.ts +112 -0
  10. package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -0
  11. package/dist/lib/apply/form-placement-preview.component.js +346 -0
  12. package/dist/lib/apply/form-placement-preview.component.js.map +1 -0
  13. package/dist/lib/apply/form-placement-text.d.ts +61 -0
  14. package/dist/lib/apply/form-placement-text.d.ts.map +1 -0
  15. package/dist/lib/apply/form-placement-text.js +279 -0
  16. package/dist/lib/apply/form-placement-text.js.map +1 -0
  17. package/dist/lib/apply/form-placement.d.ts +320 -0
  18. package/dist/lib/apply/form-placement.d.ts.map +1 -0
  19. package/dist/lib/apply/form-placement.js +432 -0
  20. package/dist/lib/apply/form-placement.js.map +1 -0
  21. package/dist/lib/apply/form-slot-probe.service.d.ts +121 -0
  22. package/dist/lib/apply/form-slot-probe.service.d.ts.map +1 -0
  23. package/dist/lib/apply/form-slot-probe.service.js +264 -0
  24. package/dist/lib/apply/form-slot-probe.service.js.map +1 -0
  25. package/dist/lib/base-form-component-internals.d.ts +11 -0
  26. package/dist/lib/base-form-component-internals.d.ts.map +1 -0
  27. package/dist/lib/base-form-component-internals.js +33 -0
  28. package/dist/lib/base-form-component-internals.js.map +1 -0
  29. package/dist/lib/base-form-component.d.ts +132 -1
  30. package/dist/lib/base-form-component.d.ts.map +1 -1
  31. package/dist/lib/base-form-component.js +228 -19
  32. package/dist/lib/base-form-component.js.map +1 -1
  33. package/dist/lib/chrome/form-chrome.d.ts +90 -0
  34. package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
  35. package/dist/lib/chrome/form-chrome.js +142 -2
  36. package/dist/lib/chrome/form-chrome.js.map +1 -1
  37. package/dist/lib/chrome/form-composition-registry.d.ts +34 -0
  38. package/dist/lib/chrome/form-composition-registry.d.ts.map +1 -0
  39. package/dist/lib/chrome/form-composition-registry.js +56 -0
  40. package/dist/lib/chrome/form-composition-registry.js.map +1 -0
  41. package/dist/lib/chrome/form-composition-snapshot.d.ts +151 -0
  42. package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -0
  43. package/dist/lib/chrome/form-composition-snapshot.js +137 -0
  44. package/dist/lib/chrome/form-composition-snapshot.js.map +1 -0
  45. package/dist/lib/chrome/resolve-form-chrome.d.ts +15 -0
  46. package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
  47. package/dist/lib/chrome/resolve-form-chrome.js +31 -2
  48. package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
  49. package/dist/lib/container/record-form-container.component.d.ts +241 -5
  50. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  51. package/dist/lib/container/record-form-container.component.js +977 -249
  52. package/dist/lib/container/record-form-container.component.js.map +1 -1
  53. package/dist/lib/field/form-field.component.d.ts +17 -0
  54. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  55. package/dist/lib/field/form-field.component.js +41 -5
  56. package/dist/lib/field/form-field.component.js.map +1 -1
  57. package/dist/lib/form-state.service.d.ts +5 -0
  58. package/dist/lib/form-state.service.d.ts.map +1 -1
  59. package/dist/lib/form-state.service.js +6 -1
  60. package/dist/lib/form-state.service.js.map +1 -1
  61. package/dist/lib/host/entity-form-host.component.d.ts +16 -1
  62. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
  63. package/dist/lib/host/entity-form-host.component.js +27 -6
  64. package/dist/lib/host/entity-form-host.component.js.map +1 -1
  65. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
  66. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
  67. package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
  68. package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
  69. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
  70. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
  71. package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
  72. package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
  73. package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
  74. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
  75. package/dist/lib/interactive-form/interactive-form.component.js +4 -5
  76. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
  77. package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
  78. package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
  79. package/dist/lib/panel/collapsible-panel.component.js +148 -12
  80. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  81. package/dist/lib/panel-manager/form-audience.d.ts +46 -0
  82. package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
  83. package/dist/lib/panel-manager/form-audience.js +34 -0
  84. package/dist/lib/panel-manager/form-audience.js.map +1 -0
  85. package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
  86. package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
  87. package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
  88. package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
  89. package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
  90. package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
  91. package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
  92. package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
  93. package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
  94. package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
  95. package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
  96. package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
  97. package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
  98. package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
  99. package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
  100. package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
  101. package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
  102. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
  103. package/dist/lib/panel-slot/base-form-panel.js +76 -5
  104. package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
  105. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
  106. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
  107. package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
  108. package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
  109. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
  110. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
  111. package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
  112. package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
  113. package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
  114. package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
  115. package/dist/lib/panel-slot/form-contribution.js +245 -71
  116. package/dist/lib/panel-slot/form-contribution.js.map +1 -1
  117. package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
  118. package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
  119. package/dist/lib/panel-slot/form-contributions.component.js +43 -7
  120. package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
  121. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
  122. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
  123. package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
  124. package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
  125. package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
  126. package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
  127. package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
  128. package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
  129. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
  130. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
  131. package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
  132. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
  133. package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
  134. package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
  135. package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
  136. package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
  137. package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
  138. package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
  139. package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
  140. package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
  141. package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
  142. package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
  143. package/dist/lib/panel-slot/panel-hides.js +111 -0
  144. package/dist/lib/panel-slot/panel-hides.js.map +1 -0
  145. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
  146. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
  147. package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
  148. package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
  149. package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
  150. package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
  151. package/dist/lib/panel-slot/placement-preview.js +86 -0
  152. package/dist/lib/panel-slot/placement-preview.js.map +1 -0
  153. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
  154. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
  155. package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
  156. package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
  157. package/dist/lib/panel-slot/slot-order.d.ts +19 -0
  158. package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
  159. package/dist/lib/panel-slot/slot-order.js +53 -0
  160. package/dist/lib/panel-slot/slot-order.js.map +1 -0
  161. package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
  162. package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
  163. package/dist/lib/resolver/form-resolver.service.js +18 -8
  164. package/dist/lib/resolver/form-resolver.service.js.map +1 -1
  165. package/dist/lib/resolver/form-variants.d.ts +28 -0
  166. package/dist/lib/resolver/form-variants.d.ts.map +1 -0
  167. package/dist/lib/resolver/form-variants.js +40 -0
  168. package/dist/lib/resolver/form-variants.js.map +1 -0
  169. package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
  170. package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
  171. package/dist/lib/section-counts/form-section-counts.js +223 -0
  172. package/dist/lib/section-counts/form-section-counts.js.map +1 -0
  173. package/dist/lib/toolbar/form-toolbar.component.d.ts +7 -0
  174. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  175. package/dist/lib/toolbar/form-toolbar.component.js +194 -128
  176. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  177. package/dist/lib/types/form-types.d.ts +8 -0
  178. package/dist/lib/types/form-types.d.ts.map +1 -1
  179. package/dist/lib/types/form-types.js.map +1 -1
  180. package/dist/module.d.ts +29 -23
  181. package/dist/module.d.ts.map +1 -1
  182. package/dist/module.js +43 -5
  183. package/dist/module.js.map +1 -1
  184. package/dist/public-api.d.ts +20 -0
  185. package/dist/public-api.d.ts.map +1 -1
  186. package/dist/public-api.js +21 -0
  187. package/dist/public-api.js.map +1 -1
  188. package/package.json +20 -20
@@ -1,3 +1,19 @@
1
+ /**
2
+ * Form contributions — pure resolve of what should appear on an entity form.
3
+ *
4
+ * A contribution is either a registered BaseFormPanel or the stock related-entity
5
+ * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory
6
+ * — the host queries registrations and feeds this.
7
+ *
8
+ * Contribution keys and section keys come from the shared key module in
9
+ * `@memberjunction/interactive-component-types/forms`, which the server actions use too.
10
+ * Section keys for related panels match CodeGen's camelCase (`angular-codegen.ts`), so
11
+ * hide-baked and skip-baked find the grid CodeGen emitted.
12
+ */
13
+ import type { ClassRegistration } from '@memberjunction/global';
14
+ import type { ComponentSpec } from '@memberjunction/interactive-component-types';
15
+ import { type FormContributionSpec } from '@memberjunction/interactive-component-types/forms';
16
+ import { type MJEntityFormContributionEntity } from '@memberjunction/core-entities';
1
17
  import { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';
2
18
  /** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */
3
19
  export interface FormContributionRelationship {
@@ -8,9 +24,46 @@ export interface FormContributionRelationship {
8
24
  DisplayName?: string | null;
9
25
  Sequence?: number | null;
10
26
  }
27
+ /** Which of the two registration sources produced a contribution. */
28
+ export type FormContributionRegistrationSource = 'class' | 'metadata';
11
29
  export interface FormContributionRegistration {
30
+ /**
31
+ * Rank within a `contributionKey` group, higher wins. For `'class'` registrations this
32
+ * is the ClassFactory registration priority; for `'metadata'` rows it is the row's
33
+ * `Precedence` column. Both mean the same thing here — higher wins — which is why one
34
+ * field carries both.
35
+ */
12
36
  Priority: number;
13
37
  Metadata: FormPanelRegistrationMetadata;
38
+ /** Omitted on legacy call sites, which are all compiled registrations. */
39
+ Source?: FormContributionRegistrationSource;
40
+ /** `MJ: Components.ID` the panel renders — metadata rows only. */
41
+ ComponentID?: string;
42
+ /** Parsed `Configuration` JSON for metadata rows. */
43
+ Configuration?: Record<string, unknown>;
44
+ Title?: string;
45
+ Icon?: string;
46
+ Presentation?: 'panel' | 'bare';
47
+ /** `MJ: Entity Form Contributions.ID` for metadata rows. */
48
+ RowID?: string;
49
+ /**
50
+ * Who a metadata row is for. Absent on compiled registrations, which apply to everyone the
51
+ * code puts them in front of. A `User` row a user can see is necessarily their own — the
52
+ * collector only returns personal rows for the current user.
53
+ */
54
+ Scope?: MJEntityFormContributionEntity['Scope'];
55
+ /** The ClassFactory registration for compiled panels — carries the component constructor. */
56
+ Registration?: ClassRegistration;
57
+ /**
58
+ * A panel the placement dialog is showing before it is saved. It draws its component when
59
+ * it carries one, else a placeholder. Only a form inside the dialog's preview sees one.
60
+ */
61
+ IsPreview?: boolean;
62
+ /**
63
+ * The component to render when it has not been saved yet, so there is no `ComponentID` to
64
+ * load. Only the placement preview sets it.
65
+ */
66
+ ComponentSpec?: ComponentSpec;
14
67
  }
15
68
  export interface ResolveFormContributionsInput {
16
69
  EntityName: string;
@@ -33,8 +86,17 @@ export interface FormContributionWinner {
33
86
  RelatedJoinField?: string;
34
87
  /** Field/other section this registered winner asked to hide. */
35
88
  ReplacesSectionKey?: string;
89
+ /** Fields this registered winner stands in for, so they are not drawn. */
90
+ ReplacesFieldNames?: readonly string[];
91
+ /** Further sections this registered winner stands in for, beyond `ReplacesSectionKey`. */
92
+ ReplacesSectionKeys?: readonly string[];
36
93
  BakedSectionKey: string;
37
94
  DisplayName: string;
95
+ /** Carried through from the registration so consumers can tell the two sources apart. */
96
+ Source?: FormContributionRegistrationSource;
97
+ ComponentID?: string;
98
+ Title?: string;
99
+ Presentation?: 'panel' | 'bare';
38
100
  }
39
101
  export interface ResolveFormContributionsResult {
40
102
  Winners: FormContributionWinner[];
@@ -43,15 +105,33 @@ export interface ResolveFormContributionsResult {
43
105
  /** Stock grids the host should mount (unclaimed and not already baked). */
44
106
  StockGrids: FormContributionWinner[];
45
107
  }
46
- /** Strip wrapping [] from a join field, matching CodeGen's tab-name helper. */
108
+ /** Strip wrapping [] from a join field. Uses the shared `StripJoinFieldBrackets`. */
47
109
  export declare function StripJoinFieldBrackets(joinField: string | null | undefined): string;
48
- /**
49
- * camelCase + identifier sanitize. Byte-compatible with
50
- * `CodeGenLib` `angular-codegen.ts` `camelCase` — do not "improve".
51
- */
110
+ /** camelCase + identifier sanitize, as CodeGen names sections. Uses the shared `FormSectionCamelCase`. */
52
111
  export declare function FormSectionCamelCase(str: string): string;
112
+ /** `related:<entity>:<join>`. Uses the shared `RelatedContributionKey`. */
53
113
  export declare function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string;
114
+ /**
115
+ * The key a registration collapses by: its own key, else the derived related key. Empty for a
116
+ * registration with neither, which never collapses. Uses the shared `ResolveContributionWriteKey`.
117
+ */
54
118
  export declare function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string;
119
+ /**
120
+ * The section key a registration's panel draws under, which the rail, the counts and the chrome
121
+ * group file it by.
122
+ *
123
+ * A row's panel draws under its contribution key ({@link ResolveContributionKey}), or
124
+ * `contribution:<row id>` when it has none. A compiled panel's template names its own section; by
125
+ * convention that is its `contributionKey`, or for a grid claim with no key, the related entity's
126
+ * name after its schema prefix, in camelCase. Empty for a compiled panel with neither.
127
+ */
128
+ export declare function ContributionSectionKey(registration: FormContributionRegistration): string;
129
+ /**
130
+ * A contribution spec as a registration: the one mapping for a saved row, the placement preview
131
+ * and the artifact viewer's preview. Ranked 0 and keyed only by the spec's own key; a caller that
132
+ * knows more (a row's precedence, a preview's derived key) sets it on the result.
133
+ */
134
+ export declare function ContributionSpecToRegistration(entityName: string, spec: FormContributionSpec, componentID?: string): FormContributionRegistration;
55
135
  /**
56
136
  * SectionKey CodeGen emits for a related-entity panel. When more than one
57
137
  * DisplayInForm relationship points at the same entity, the join field is
@@ -72,13 +152,56 @@ export declare function RelatedEntitySectionKey(relationship: FormContributionRe
72
152
  export declare function CreateRelatedEntitySectionKeyResolver(displayInFormPeers: readonly FormContributionRelationship[]): (relationship: FormContributionRelationship) => string;
73
153
  export declare function RelationshipDisplayName(relationship: FormContributionRelationship): string;
74
154
  /**
75
- * Last-wins collapse by contributionKey (or derived related key).
76
- * Highest Priority keeps the slot. Registrations without a key never collapse.
155
+ * Strict entity match shared by the composer and the slot host. `'*'` matches every form.
156
+ *
157
+ * Exported because the slot host used to run its own prefix-insensitive variant, which
158
+ * mounted panels the composer then ignored — the two sides disagreed about which panels
159
+ * existed. One predicate, used by both.
160
+ */
161
+ export declare function FormContributionEntityMatches(registeredEntity: string | null | undefined, formEntity: string): boolean;
162
+ /**
163
+ * A wildcard registration that claims a grid, a section or a rail tab, or names a section to draw
164
+ * in. It still mounts, but its claim is ignored: it would take that place from every form.
165
+ */
166
+ export declare function IsWildcardPlaceClaim(meta: FormPanelRegistrationMetadata): boolean;
167
+ /**
168
+ * Collapse by key ({@link ResolveContributionKey}, compared exactly). Highest Priority wins; on a
169
+ * tie the compiled registration wins, and between rows the narrower scope. Registrations without
170
+ * a key never collapse.
171
+ *
172
+ * The tie-break is an explicit comparator rather than input ordering, so the result does not
173
+ * depend on which source the caller concatenated first.
77
174
  */
78
175
  export declare function CollapseFormPanelRegistrations<T extends {
79
176
  Priority: number;
80
177
  Metadata: FormPanelRegistrationMetadata;
178
+ Source?: FormContributionRegistrationSource;
179
+ Scope?: FormContributionRegistration['Scope'];
81
180
  }>(registrations: readonly T[]): T[];
181
+ /** One form's contributions after the collapse. */
182
+ export interface ResolvedFormContributions {
183
+ /**
184
+ * The winners among the registrations for this entity or for every entity (`'*'`): one per
185
+ * key, and each registration that has no key.
186
+ */
187
+ readonly Winners: readonly FormContributionRegistration[];
188
+ /**
189
+ * The winners the rail files, by {@link ContributionSectionKey}: they name the entity rather
190
+ * than the wildcard, draw a section rather than a bare strip, and have a section key. Two
191
+ * winners filed under one section key keep the one that ranks higher in the collapse.
192
+ */
193
+ readonly RailItems: ReadonlyMap<string, FormContributionRegistration>;
194
+ }
195
+ /**
196
+ * The winning registrations on one entity's form, resolved once for the whole form.
197
+ *
198
+ * Every host that draws contributions filters these winners by its own slot or section, so a row
199
+ * that takes a key from a compiled panel draws where the row says, and the compiled panel draws
200
+ * nowhere. Memoized per input list, which the collector returns as a stable reference until
201
+ * something changes, so a caller must not change a list after passing it. The result is shared:
202
+ * callers must not mutate it.
203
+ */
204
+ export declare function ResolveFormContributionWinners(entityName: string, registrations: readonly FormContributionRegistration[]): ResolvedFormContributions;
82
205
  /**
83
206
  * Resolve what belongs on the form. Stock grids are only those the template
84
207
  * did not already bake and that no panel claimed.
@@ -88,4 +211,44 @@ export declare function ResolveFormContributions(input: ResolveFormContributions
88
211
  export declare function ContributionHiddenSectionKeys(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
89
212
  /** @deprecated Use {@link ContributionHiddenSectionKeys}. */
90
213
  export declare function ClaimedRelatedSectionKeys(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
214
+ /**
215
+ * Whether this registration is hosted by a section rather than by a slot.
216
+ *
217
+ * A contribution that names fields renders at the top of the section drawing them, which
218
+ * `<mj-form-field-panel-slot>` mounts. It still carries a `slot`, because every row does,
219
+ * so a slot host that went by slot alone would mount it a second time at the bottom of the
220
+ * form — the same panel twice, once in the group and once as a section of its own.
221
+ */
222
+ export declare function ContributionClaimsFields(metadata: Pick<FormPanelRegistrationMetadata, 'replacesFieldNames'> | null | undefined): boolean;
223
+ /**
224
+ * The section a registration names to draw in, or '' when it names none. A wildcard
225
+ * (`entity: '*'`) registration's section is ignored, because it would take that place on every
226
+ * form, so the panel draws at its slot.
227
+ */
228
+ export declare function PlacedInSectionKey(metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'inSectionKey'>> | null | undefined): string;
229
+ /**
230
+ * Whether this registration is drawn inside a section rather than by a slot: it stands in for
231
+ * fields, or it names a section to draw in ({@link PlacedInSectionKey}). The section's own host
232
+ * mounts it, so a slot host must not mount it a second time.
233
+ */
234
+ export declare function ContributionDrawsInSection(metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'replacesFieldNames' | 'inSectionKey'>> | null | undefined): boolean;
235
+ /** Where inside its section a section-hosted contribution draws. */
236
+ export declare function ContributionSectionPosition(metadata: Pick<FormPanelRegistrationMetadata, 'sectionPosition'> | null | undefined): 'start' | 'end';
237
+ /** Every section a contribution stands in for: the single key, then the list, without repeats. */
238
+ export declare function ReplacedSectionKeys(metadata: Pick<FormPanelRegistrationMetadata, 'replacesSectionKey' | 'replacesSectionKeys'> | null | undefined): string[];
239
+ /**
240
+ * Field names the winning contributions stand in for, so the form stops drawing them.
241
+ *
242
+ * Separate from {@link ContributionHiddenSectionKeys} because the two hide different
243
+ * things: a section key removes a whole card, a field name removes one input from inside
244
+ * one. The panel that made the claim renders at the top of the section that held those
245
+ * fields, which is the collapsible panel's job — this only says which fields are spoken for.
246
+ */
247
+ export declare function ContributionClaimedFieldNames(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
248
+ /**
249
+ * `DisplayInForm` relationships that can appear on the parent form (IS-A
250
+ * children excluded), in Sequence order — the same peer set
251
+ * {@link ResolveFormContributions} and {@link CreateRelatedEntitySectionKeyResolver} use.
252
+ */
253
+ export declare function VisibleFormRelationships<T extends FormContributionRelationship>(related: readonly T[], isaChildIds: readonly string[]): T[];
91
254
  //# sourceMappingURL=form-contribution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-contribution.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,6BAA6B,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEjF,0FAA0F;AAC1F,MA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,CAAC,SAAS,4BAA4B,EAC3E,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC/B,CAAC,EAAE,CAEL"}
@@ -1,45 +1,90 @@
1
- /**
2
- * Form contributions — pure resolve of what should appear on an entity form.
3
- *
4
- * A contribution is either a registered BaseFormPanel or the stock related-entity
5
- * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory
6
- * — the host queries registrations and feeds this.
7
- *
8
- * Section keys for related panels MUST match CodeGen's camelCase
9
- * (`angular-codegen.ts` `camelCase` + related-entity sectionKey). If they drift,
10
- * hide-baked and skip-baked miss and the user sees a double grid.
11
- */
12
- import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
13
- /** Strip wrapping [] from a join field, matching CodeGen's tab-name helper. */
1
+ import { DEFAULT_FORM_CONTRIBUTION_SLOT, FormSectionCamelCase as SharedFormSectionCamelCase, RelatedContributionKey as SharedRelatedContributionKey, RelatedGridSectionKey, ResolveContributionWriteKey, StripJoinFieldBrackets as SharedStripJoinFieldBrackets, } from '@memberjunction/interactive-component-types/forms';
2
+ import { CountByUUID, NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
3
+ import { FormContributionOutranks } from '@memberjunction/core-entities';
4
+ /** Strip wrapping [] from a join field. Uses the shared `StripJoinFieldBrackets`. */
14
5
  export function StripJoinFieldBrackets(joinField) {
15
- return (joinField ?? '').trim().replace(/^\[/, '').replace(/\]$/, '');
6
+ return SharedStripJoinFieldBrackets(joinField);
16
7
  }
17
- /**
18
- * camelCase + identifier sanitize. Byte-compatible with
19
- * `CodeGenLib` `angular-codegen.ts` `camelCase` — do not "improve".
20
- */
8
+ /** camelCase + identifier sanitize, as CodeGen names sections. Uses the shared `FormSectionCamelCase`. */
21
9
  export function FormSectionCamelCase(str) {
22
- const sanitized = str.replace(/[^a-zA-Z0-9\s]/g, ' ');
23
- let result = sanitized
24
- .replace(/\s(.)/g, (_match, char) => char.toUpperCase())
25
- .replace(/\s/g, '')
26
- .replace(/^(.)/, (_match, char) => char.toLowerCase());
27
- if (/^\d/.test(result)) {
28
- result = '_' + result;
29
- }
30
- return result.length === 0 ? 'section' : result;
10
+ return SharedFormSectionCamelCase(str);
31
11
  }
12
+ /** `related:<entity>:<join>`. Uses the shared `RelatedContributionKey`. */
32
13
  export function RelatedContributionKey(relatedEntity, joinField) {
33
- return `related:${relatedEntity.trim()}:${StripJoinFieldBrackets(joinField)}`;
14
+ return SharedRelatedContributionKey(relatedEntity, joinField);
34
15
  }
16
+ /**
17
+ * The key a registration collapses by: its own key, else the derived related key. Empty for a
18
+ * registration with neither, which never collapses. Uses the shared `ResolveContributionWriteKey`.
19
+ */
35
20
  export function ResolveContributionKey(meta) {
36
- if (meta.contributionKey && meta.contributionKey.trim().length > 0) {
37
- return meta.contributionKey.trim();
38
- }
39
- if (meta.relatedEntity && meta.relatedEntity.trim().length > 0) {
40
- return RelatedContributionKey(meta.relatedEntity, meta.relatedJoinField);
21
+ return ResolveContributionWriteKey(meta, meta.relatedEntity ?? null) ?? '';
22
+ }
23
+ /**
24
+ * The section key a registration's panel draws under, which the rail, the counts and the chrome
25
+ * group file it by.
26
+ *
27
+ * A row's panel draws under its contribution key ({@link ResolveContributionKey}), or
28
+ * `contribution:<row id>` when it has none. A compiled panel's template names its own section; by
29
+ * convention that is its `contributionKey`, or for a grid claim with no key, the related entity's
30
+ * name after its schema prefix, in camelCase. Empty for a compiled panel with neither.
31
+ */
32
+ export function ContributionSectionKey(registration) {
33
+ const meta = registration.Metadata;
34
+ if (registration.Source === 'metadata') {
35
+ return ResolveContributionKey(meta) || `contribution:${registration.RowID ?? registration.ComponentID ?? 'unknown'}`;
41
36
  }
42
- return '';
37
+ const own = meta.contributionKey?.trim();
38
+ if (own)
39
+ return own;
40
+ // The key compiled panel templates use (`contactMethods`), not the generated-form grid key.
41
+ const entityName = meta.relatedEntity?.split(':').pop()?.trim();
42
+ return entityName ? FormSectionCamelCase(entityName) : '';
43
+ }
44
+ /**
45
+ * A contribution spec as a registration: the one mapping for a saved row, the placement preview
46
+ * and the artifact viewer's preview. Ranked 0 and keyed only by the spec's own key; a caller that
47
+ * knows more (a row's precedence, a preview's derived key) sets it on the result.
48
+ */
49
+ export function ContributionSpecToRegistration(entityName, spec, componentID) {
50
+ const metadata = {
51
+ entity: entityName,
52
+ slot: spec.slot ?? DEFAULT_FORM_CONTRIBUTION_SLOT,
53
+ sortKey: spec.sortKey ?? 0,
54
+ presentation: spec.presentation,
55
+ };
56
+ if (spec.contributionKey)
57
+ metadata.contributionKey = spec.contributionKey;
58
+ if (spec.relatedEntity)
59
+ metadata.relatedEntity = spec.relatedEntity;
60
+ if (spec.relatedJoinField)
61
+ metadata.relatedJoinField = spec.relatedJoinField;
62
+ if (spec.replacesSectionKey)
63
+ metadata.replacesSectionKey = spec.replacesSectionKey;
64
+ if (spec.replacesFieldNames?.length)
65
+ metadata.replacesFieldNames = [...spec.replacesFieldNames];
66
+ if (spec.replacesSectionKeys?.length)
67
+ metadata.replacesSectionKeys = [...spec.replacesSectionKeys];
68
+ if (spec.inSectionKey)
69
+ metadata.inSectionKey = spec.inSectionKey;
70
+ if (spec.sectionPosition)
71
+ metadata.sectionPosition = spec.sectionPosition;
72
+ if (spec.inclusion)
73
+ metadata.inclusion = spec.inclusion;
74
+ if (spec.chromeGroup)
75
+ metadata.chromeGroup = spec.chromeGroup;
76
+ const registration = {
77
+ Priority: 0,
78
+ Metadata: metadata,
79
+ Source: 'metadata',
80
+ Title: spec.title,
81
+ Icon: spec.icon,
82
+ Presentation: spec.presentation,
83
+ Configuration: spec.configuration ?? {},
84
+ };
85
+ if (componentID)
86
+ registration.ComponentID = componentID;
87
+ return registration;
43
88
  }
44
89
  /**
45
90
  * SectionKey CodeGen emits for a related-entity panel. When more than one
@@ -60,10 +105,7 @@ export function RelatedEntitySectionKey(relationship, displayInFormPeers) {
60
105
  return relatedSectionKey(relationship, sameEntityCount > 1);
61
106
  }
62
107
  function relatedSectionKey(relationship, sharesRelatedEntity) {
63
- if (sharesRelatedEntity) {
64
- return FormSectionCamelCase(`${relationship.RelatedEntity} ${StripJoinFieldBrackets(relationship.RelatedEntityJoinField)}`);
65
- }
66
- return FormSectionCamelCase(relationship.RelatedEntity);
108
+ return RelatedGridSectionKey(relationship.RelatedEntity, relationship.RelatedEntityJoinField, sharesRelatedEntity);
67
109
  }
68
110
  /**
69
111
  * Builds a function that returns {@link RelatedEntitySectionKey}`(relationship, displayInFormPeers)`
@@ -77,12 +119,8 @@ function relatedSectionKey(relationship, sharesRelatedEntity) {
77
119
  * The returned function reflects the peers as they were when it was built.
78
120
  */
79
121
  export function CreateRelatedEntitySectionKeyResolver(displayInFormPeers) {
80
- const countByEntityID = new Map();
81
- for (const peer of displayInFormPeers) {
82
- const id = NormalizeUUID(peer.RelatedEntityID);
83
- countByEntityID.set(id, (countByEntityID.get(id) ?? 0) + 1);
84
- }
85
- return (relationship) => relatedSectionKey(relationship, (countByEntityID.get(NormalizeUUID(relationship.RelatedEntityID)) ?? 0) > 1);
122
+ const countByEntityID = CountByUUID(displayInFormPeers, (peer) => peer.RelatedEntityID);
123
+ return (relationship) => relatedSectionKey(relationship, (countByEntityID.Get(relationship.RelatedEntityID) ?? 0) > 1);
86
124
  }
87
125
  export function RelationshipDisplayName(relationship) {
88
126
  const named = relationship.DisplayName?.trim();
@@ -102,27 +140,44 @@ function visibleRelationships(related, isaChildIds) {
102
140
  return a.RelatedEntity.localeCompare(b.RelatedEntity);
103
141
  });
104
142
  }
105
- function entityMatches(registeredEntity, formEntity) {
143
+ /**
144
+ * Strict entity match shared by the composer and the slot host. `'*'` matches every form.
145
+ *
146
+ * Exported because the slot host used to run its own prefix-insensitive variant, which
147
+ * mounted panels the composer then ignored — the two sides disagreed about which panels
148
+ * existed. One predicate, used by both.
149
+ */
150
+ export function FormContributionEntityMatches(registeredEntity, formEntity) {
151
+ if (!registeredEntity)
152
+ return false;
106
153
  return registeredEntity === '*' || registeredEntity === formEntity;
107
154
  }
108
- function applicableRegistrations(entityName, registrations) {
109
- return registrations.filter((reg) => {
110
- const entity = reg.Metadata.entity;
111
- if (!entity || !entityMatches(entity, entityName))
112
- return false;
113
- // A related claim on entity:'*' would hide that grid on every form.
114
- // Claims must name the form entity.
115
- // Related / field-section claims on entity:'*' would hide panels on every
116
- // form. Those claims must name the form entity.
117
- if ((reg.Metadata.relatedEntity || reg.Metadata.replacesSectionKey) && entity === '*') {
118
- return false;
119
- }
120
- return true;
121
- });
155
+ /**
156
+ * A wildcard registration that claims a grid, a section or a rail tab, or names a section to draw
157
+ * in. It still mounts, but its claim is ignored: it would take that place from every form.
158
+ */
159
+ export function IsWildcardPlaceClaim(meta) {
160
+ return meta.entity === '*'
161
+ && (!!meta.relatedEntity || ReplacedSectionKeys(meta).length > 0 || !!meta.inSectionKey?.trim());
122
162
  }
123
163
  /**
124
- * Last-wins collapse by contributionKey (or derived related key).
125
- * Highest Priority keeps the slot. Registrations without a key never collapse.
164
+ * Whether `reg` beats `incumbent`, by the rule the server's composition answer also uses
165
+ * ({@link FormContributionOutranks}): higher Priority; on a tie a compiled registration beats any
166
+ * row, and between rows the narrower audience wins.
167
+ */
168
+ function outranks(reg, incumbent) {
169
+ return FormContributionOutranks(rankOf(reg), rankOf(incumbent));
170
+ }
171
+ function rankOf(reg) {
172
+ return { Precedence: reg.Priority, Scope: reg.Scope, Compiled: reg.Source !== 'metadata' };
173
+ }
174
+ /**
175
+ * Collapse by key ({@link ResolveContributionKey}, compared exactly). Highest Priority wins; on a
176
+ * tie the compiled registration wins, and between rows the narrower scope. Registrations without
177
+ * a key never collapse.
178
+ *
179
+ * The tie-break is an explicit comparator rather than input ordering, so the result does not
180
+ * depend on which source the caller concatenated first.
126
181
  */
127
182
  export function CollapseFormPanelRegistrations(registrations) {
128
183
  const winners = new Map();
@@ -130,19 +185,46 @@ export function CollapseFormPanelRegistrations(registrations) {
130
185
  for (const reg of registrations) {
131
186
  const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;
132
187
  const incumbent = winners.get(key);
133
- if (!incumbent || reg.Priority > incumbent.Priority) {
188
+ if (!incumbent || outranks(reg, incumbent)) {
134
189
  winners.set(key, reg);
135
190
  }
136
191
  }
137
192
  return [...winners.values()];
138
193
  }
139
- function collapseRegistrations(registrations) {
140
- const winners = new Map();
141
- for (const reg of CollapseFormPanelRegistrations(registrations)) {
142
- const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;
143
- winners.set(key, reg);
194
+ const resolvedMemo = new WeakMap();
195
+ /**
196
+ * The winning registrations on one entity's form, resolved once for the whole form.
197
+ *
198
+ * Every host that draws contributions filters these winners by its own slot or section, so a row
199
+ * that takes a key from a compiled panel draws where the row says, and the compiled panel draws
200
+ * nowhere. Memoized per input list, which the collector returns as a stable reference until
201
+ * something changes, so a caller must not change a list after passing it. The result is shared:
202
+ * callers must not mutate it.
203
+ */
204
+ export function ResolveFormContributionWinners(entityName, registrations) {
205
+ let byEntity = resolvedMemo.get(registrations);
206
+ const hit = byEntity?.get(entityName);
207
+ if (hit)
208
+ return hit;
209
+ const applicable = registrations.filter((reg) => FormContributionEntityMatches(reg.Metadata?.entity, entityName));
210
+ const winners = CollapseFormPanelRegistrations(applicable);
211
+ const railItems = new Map();
212
+ for (const reg of winners) {
213
+ const meta = reg.Metadata;
214
+ if (meta.entity !== entityName || reg.Presentation === 'bare' || meta.presentation === 'bare')
215
+ continue;
216
+ const key = ContributionSectionKey(reg);
217
+ const filed = key ? railItems.get(key) : undefined;
218
+ if (key && (!filed || outranks(reg, filed)))
219
+ railItems.set(key, reg);
220
+ }
221
+ const resolved = { Winners: winners, RailItems: railItems };
222
+ if (!byEntity) {
223
+ byEntity = new Map();
224
+ resolvedMemo.set(registrations, byEntity);
144
225
  }
145
- return winners;
226
+ byEntity.set(entityName, resolved);
227
+ return resolved;
146
228
  }
147
229
  function stockWinner(relationship, sectionKey) {
148
230
  const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);
@@ -169,8 +251,14 @@ function registeredWinner(key, reg, sectionKey, displayName) {
169
251
  RelatedEntity: meta.relatedEntity,
170
252
  RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,
171
253
  ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,
254
+ ReplacesFieldNames: meta.replacesFieldNames?.length ? [...meta.replacesFieldNames] : undefined,
255
+ ReplacesSectionKeys: meta.replacesSectionKeys?.length ? [...meta.replacesSectionKeys] : undefined,
172
256
  BakedSectionKey: sectionKey,
173
257
  DisplayName: displayName,
258
+ Source: reg.Source,
259
+ ComponentID: reg.ComponentID,
260
+ Title: reg.Title,
261
+ Presentation: reg.Presentation ?? meta.presentation,
174
262
  };
175
263
  }
176
264
  function sortWinners(winners) {
@@ -188,12 +276,16 @@ function sortWinners(winners) {
188
276
  */
189
277
  export function ResolveFormContributions(input) {
190
278
  const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);
191
- const collapsed = collapseRegistrations(applicableRegistrations(input.EntityName, input.Registrations));
279
+ const winners = ResolveFormContributionWinners(input.EntityName, input.Registrations).Winners;
192
280
  const baked = new Set(input.BakedSectionKeys);
193
281
  const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);
194
282
  const claimedKeys = new Set();
195
283
  const registered = [];
196
- for (const [key, reg] of collapsed) {
284
+ for (const reg of winners) {
285
+ // One winner per key per form: a wildcard place claim that won key K hides the entity's own K too.
286
+ if (IsWildcardPlaceClaim(reg.Metadata))
287
+ continue;
288
+ const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;
197
289
  const related = reg.Metadata.relatedEntity?.trim();
198
290
  const peer = related
199
291
  ? peers.find((rel) => {
@@ -207,7 +299,7 @@ export function ResolveFormContributions(input) {
207
299
  : undefined;
208
300
  const sectionKey = peer ? sectionKeyOf(peer) : '';
209
301
  if (related) {
210
- claimedKeys.add(key);
302
+ claimedKeys.add(RelatedContributionKey(related, reg.Metadata.relatedJoinField));
211
303
  // A claim that omits the join field covers every FK to that entity.
212
304
  if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {
213
305
  for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {
@@ -265,6 +357,9 @@ export function ContributionHiddenSectionKeys(entityName, relatedEntities, isaCh
265
357
  continue;
266
358
  if (winner.ReplacesSectionKey)
267
359
  keys.push(winner.ReplacesSectionKey);
360
+ for (const key of winner.ReplacesSectionKeys ?? [])
361
+ if (key.trim())
362
+ keys.push(key.trim());
268
363
  if (!winner.RelatedEntity)
269
364
  continue;
270
365
  const peer = peers.find((rel) => {
@@ -283,4 +378,83 @@ export function ContributionHiddenSectionKeys(entityName, relatedEntities, isaCh
283
378
  export function ClaimedRelatedSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations) {
284
379
  return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);
285
380
  }
381
+ /**
382
+ * Whether this registration is hosted by a section rather than by a slot.
383
+ *
384
+ * A contribution that names fields renders at the top of the section drawing them, which
385
+ * `<mj-form-field-panel-slot>` mounts. It still carries a `slot`, because every row does,
386
+ * so a slot host that went by slot alone would mount it a second time at the bottom of the
387
+ * form — the same panel twice, once in the group and once as a section of its own.
388
+ */
389
+ export function ContributionClaimsFields(metadata) {
390
+ return (metadata?.replacesFieldNames ?? []).some((name) => name.trim().length > 0);
391
+ }
392
+ /**
393
+ * The section a registration names to draw in, or '' when it names none. A wildcard
394
+ * (`entity: '*'`) registration's section is ignored, because it would take that place on every
395
+ * form, so the panel draws at its slot.
396
+ */
397
+ export function PlacedInSectionKey(metadata) {
398
+ if (!metadata || metadata.entity === '*')
399
+ return '';
400
+ return metadata.inSectionKey?.trim() ?? '';
401
+ }
402
+ /**
403
+ * Whether this registration is drawn inside a section rather than by a slot: it stands in for
404
+ * fields, or it names a section to draw in ({@link PlacedInSectionKey}). The section's own host
405
+ * mounts it, so a slot host must not mount it a second time.
406
+ */
407
+ export function ContributionDrawsInSection(metadata) {
408
+ return ContributionClaimsFields(metadata) || !!PlacedInSectionKey(metadata);
409
+ }
410
+ /** Where inside its section a section-hosted contribution draws. */
411
+ export function ContributionSectionPosition(metadata) {
412
+ return metadata?.sectionPosition === 'end' ? 'end' : 'start';
413
+ }
414
+ /** Every section a contribution stands in for: the single key, then the list, without repeats. */
415
+ export function ReplacedSectionKeys(metadata) {
416
+ const out = [];
417
+ for (const raw of [metadata?.replacesSectionKey, ...(metadata?.replacesSectionKeys ?? [])]) {
418
+ const key = raw?.trim();
419
+ if (key && !out.includes(key))
420
+ out.push(key);
421
+ }
422
+ return out;
423
+ }
424
+ /**
425
+ * Field names the winning contributions stand in for, so the form stops drawing them.
426
+ *
427
+ * Separate from {@link ContributionHiddenSectionKeys} because the two hide different
428
+ * things: a section key removes a whole card, a field name removes one input from inside
429
+ * one. The panel that made the claim renders at the top of the section that held those
430
+ * fields, which is the collapsible panel's job — this only says which fields are spoken for.
431
+ */
432
+ export function ContributionClaimedFieldNames(entityName, relatedEntities, isaChildEntityIDs, registrations) {
433
+ const resolved = ResolveFormContributions({
434
+ EntityName: entityName,
435
+ RelatedEntities: relatedEntities,
436
+ IsaChildEntityIDs: isaChildEntityIDs,
437
+ Registrations: registrations,
438
+ BakedSectionKeys: [],
439
+ ShowRelatedEntities: true,
440
+ });
441
+ const names = [];
442
+ for (const winner of resolved.Winners) {
443
+ if (winner.Kind !== 'registered')
444
+ continue;
445
+ for (const name of winner.ReplacesFieldNames ?? []) {
446
+ if (!names.includes(name))
447
+ names.push(name);
448
+ }
449
+ }
450
+ return names;
451
+ }
452
+ /**
453
+ * `DisplayInForm` relationships that can appear on the parent form (IS-A
454
+ * children excluded), in Sequence order — the same peer set
455
+ * {@link ResolveFormContributions} and {@link CreateRelatedEntitySectionKeyResolver} use.
456
+ */
457
+ export function VisibleFormRelationships(related, isaChildIds) {
458
+ return visibleRelationships(related, isaChildIds);
459
+ }
286
460
  //# sourceMappingURL=form-contribution.js.map