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

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 +78 -0
  34. package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
  35. package/dist/lib/chrome/form-chrome.js +128 -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 +240 -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 +976 -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 +242 -64
  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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-placement.d.ts","sourceRoot":"","sources":["../../../src/lib/apply/form-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKH,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC5B,MAAM,mDAAmD,CAAC;AAG3D,wEAAwE;AACxE,MAAM,WAAW,kBAAkB;IAC/B,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,2DAA2D;AAC3D,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAC1C;AAED,sEAAsE;AACtE,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,iDAAiD;AACjD,MAAM,WAAW,qBAAqB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,wFAAwF;IACxF,eAAe,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC;IACzC,yEAAyE;IACzE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAA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is written.
3
+ *
4
+ * A generated panel arrives carrying a `formContribution` block. Its **identity** —
5
+ * `presentation`, `title`, `icon` — describes what the component is. Its **placement** — slot
6
+ * and claims — is a proposal: the dialog starts from every claim the open form can honour and
7
+ * from a fixed default for the rest, and the user confirms or changes it.
8
+ *
9
+ * Everything here is pure. The component holds a {@link FormPlacementState} and renders it;
10
+ * these functions decide what that state means. The sentences that describe a state are in
11
+ * `form-placement-text.ts`, and the order of panels in one position is in
12
+ * `form-placement-order.ts`.
13
+ */
14
+ import { DEFAULT_FORM_CONTRIBUTION_SLOT, FORM_CONTRIBUTION_SLOTS, GENERATED_FORM_CONTRIBUTION_SLOTS, StripJoinFieldBrackets, } from '@memberjunction/interactive-component-types/forms';
15
+ import { DETAILS_SECTION_KEY, ReplacedSectionChromeGroup, SlotChromeGroup } from '../chrome/form-chrome';
16
+ /**
17
+ * Whether the form bundles its field sections into a Details tab.
18
+ *
19
+ * Only a rail layout does. An accordion shows every section in place, so there is no tab
20
+ * to stand in for and the section list means exactly what it says.
21
+ */
22
+ export function HasDetailsTab(context) {
23
+ return context.Layout === 'left-nav' && context.Sections.length > 0;
24
+ }
25
+ /**
26
+ * Whether the form shows a side rail, so there are tabs a user can point at.
27
+ *
28
+ * The rail groups exist whatever the layout — an accordion form uses them to decide what
29
+ * is visible, it just draws no rail. So a non-empty `Rail` does not mean the user sees
30
+ * tabs, and offering to "replace a whole tab" on a form that shows none describes
31
+ * something that is not on their screen.
32
+ */
33
+ export function ShowsRail(context) {
34
+ return context.Layout === 'left-nav' && context.Rail.length > 0;
35
+ }
36
+ /**
37
+ * The blocks in the preview that this choice will take off the form.
38
+ *
39
+ * The replace choices differ only in how much they cover — a whole tab is every field
40
+ * group in it, one field group is one of those — and saying that in a label has not been
41
+ * enough. Marking the blocks themselves shows the difference instead of describing it.
42
+ */
43
+ export function ReplacedPreviewKeys(state, context) {
44
+ if (state.ReplaceMode === 'rail-tab') {
45
+ const tab = context.Rail.find((item) => item.Key === state.ReplaceRailKey);
46
+ return new Set(tab?.SectionKeys ?? []);
47
+ }
48
+ if (state.ReplaceMode === 'section')
49
+ return new Set(ChosenSectionKeys(state, context));
50
+ return new Set();
51
+ }
52
+ /**
53
+ * Whether the form's targets are not known yet: no sections, and none read from the form.
54
+ * A claim cannot be checked against such a context, so it is kept as it stands.
55
+ */
56
+ export function TargetsUnread(context) {
57
+ return context.Sections.length === 0 && !context.TargetsVerified;
58
+ }
59
+ /**
60
+ * The sections the `section` mode stands in for, in the form's order and kept to sections the
61
+ * form draws. The list when one is set, else the single key.
62
+ */
63
+ export function ChosenSectionKeys(state, context) {
64
+ const wanted = state.ReplaceSectionKeys.length > 0 ? state.ReplaceSectionKeys : [state.ReplaceSectionKey];
65
+ const keys = wanted.map((key) => key.trim()).filter((key) => key.length > 0);
66
+ if (TargetsUnread(context))
67
+ return keys;
68
+ return context.Sections.map((s) => s.Key).filter((key) => keys.includes(key));
69
+ }
70
+ /** The section drawing this field, or null when no section on the form does. */
71
+ export function SectionHoldingField(context, fieldName) {
72
+ const name = (fieldName ?? '').trim();
73
+ if (!name)
74
+ return null;
75
+ return context.Sections.find((s) => (s.Fields ?? []).some((f) => f.Name === name)) ?? null;
76
+ }
77
+ /** Sections that draw at least one field, so there is something to choose from. */
78
+ export function SectionsWithFields(context) {
79
+ if (!context.TargetsVerified)
80
+ return [];
81
+ return context.Sections.filter((s) => (s.Fields ?? []).length > 0);
82
+ }
83
+ /** The fields of one section, by key. Empty for a section the form does not draw. */
84
+ export function FieldsInSection(context, sectionKey) {
85
+ const key = (sectionKey ?? '').trim();
86
+ if (!key)
87
+ return [];
88
+ return context.Sections.find((s) => s.Key === key)?.Fields ?? [];
89
+ }
90
+ /**
91
+ * The chosen field names, kept to the ones the chosen section really draws.
92
+ *
93
+ * The section and the names are held apart in the state, so switching section leaves a
94
+ * stale set behind. Filtering here rather than on every change keeps the state simple and
95
+ * means a section the form stopped drawing cannot smuggle a claim through.
96
+ */
97
+ export function ChosenFieldNames(state, context) {
98
+ if (TargetsUnread(context))
99
+ return [...state.ReplaceFieldNames];
100
+ const available = FieldsInSection(context, state.ReplaceFieldSectionKey);
101
+ return state.ReplaceFieldNames.filter((name) => available.some((f) => f.Name === name));
102
+ }
103
+ /** The section a field claim starts on: the first one with fields to offer. */
104
+ export function DefaultFieldSectionKey(context) {
105
+ return SectionsWithFields(context)[0]?.Key ?? '';
106
+ }
107
+ /** Tabs a panel may stand in for — every rail item, on a form that shows a rail. */
108
+ export function ReplaceableRailTabs(context) {
109
+ return ShowsRail(context) ? context.Rail : [];
110
+ }
111
+ /** The tab the dialog starts on: Details when the form has one, else the first. */
112
+ export function DefaultRailKeyFor(context) {
113
+ const tabs = ReplaceableRailTabs(context);
114
+ if (tabs.some((item) => item.Key === DETAILS_SECTION_KEY))
115
+ return DETAILS_SECTION_KEY;
116
+ return tabs[0]?.Key ?? '';
117
+ }
118
+ /**
119
+ * Which rail item the panel will appear under, given the answers so far.
120
+ *
121
+ * Replacing something puts the panel where that thing was, so the answer is the item
122
+ * holding it. Replacing nothing gives the panel a rail item of its own, and null says so:
123
+ * the preview then draws a new item rather than highlighting an existing one.
124
+ */
125
+ export function TargetRailItem(state, context) {
126
+ if (state.Presentation === 'bare' || !ShowsRail(context))
127
+ return null;
128
+ const holding = (sectionKey) => context.Rail.find((item) => item.SectionKeys.includes(sectionKey)) ?? null;
129
+ if (state.ReplaceMode === 'rail-tab') {
130
+ return context.Rail.find((item) => item.Key === state.ReplaceRailKey) ?? null;
131
+ }
132
+ if (state.ReplaceMode === 'section')
133
+ return holding(ChosenSectionKeys(state, context)[0] ?? '');
134
+ if (state.ReplaceMode === 'field') {
135
+ return state.ReplaceFieldSectionKey ? holding(state.ReplaceFieldSectionKey) : null;
136
+ }
137
+ if (state.ReplaceMode === 'related') {
138
+ const target = context.Related[state.ReplaceRelatedIndex];
139
+ if (!target)
140
+ return null;
141
+ return context.Rail.find((item) => item.Title === target.DisplayName) ?? null;
142
+ }
143
+ if (state.ReplaceMode === 'contribution') {
144
+ const target = context.Existing[state.ReplaceContributionIndex];
145
+ return target ? holding(target.Key) : null;
146
+ }
147
+ // Claiming nothing, the slot decides: a position among the field sections puts the
148
+ // panel in the tab those sections make up.
149
+ if (SlotChromeGroup(state.Slot) === 'details') {
150
+ return context.Rail.find((item) => item.Key === DETAILS_SECTION_KEY) ?? null;
151
+ }
152
+ return null;
153
+ }
154
+ /**
155
+ * Where each slot sits, said plainly.
156
+ *
157
+ * A slot is a position between the things already on the form, not a thing on the form,
158
+ * and its stored name does not say that on its own — `before-fields` next to
159
+ * `Contact Information` reads like a second piece of content. Both names are shown: the
160
+ * plain one so the choice is legible, the stored one so a user who reads it here
161
+ * recognises it in a row later.
162
+ */
163
+ const SLOT_NAMES = {
164
+ 'top-area': 'Above everything',
165
+ 'before-fields': 'Before the fields',
166
+ 'after-fields': 'After the fields',
167
+ 'after-related': 'After the related grids',
168
+ 'after-everything': 'At the very bottom',
169
+ };
170
+ /** The slots, top to bottom. */
171
+ export const FORM_PLACEMENT_SLOTS = FORM_CONTRIBUTION_SLOTS.map((slot) => ({ Slot: slot, Name: SLOT_NAMES[slot] ?? slot, Label: slot }));
172
+ /**
173
+ * Whether the form emits this slot.
174
+ *
175
+ * An empty {@link FormPlacementContext.SlotsPresent} means nobody has told us, not that the
176
+ * form has no slots, so the generated shape stands in. That shape excludes `top-area`, which
177
+ * no form emits — offering it would send the panel to the bottom of the form under a label
178
+ * that says the opposite.
179
+ */
180
+ export function SlotIsOnForm(context, slot) {
181
+ const present = context.SlotsPresent.length > 0
182
+ ? context.SlotsPresent
183
+ : GENERATED_FORM_CONTRIBUTION_SLOTS;
184
+ return present.includes(slot);
185
+ }
186
+ /** The preferred slot, unless this form does not emit it — then the first one it does. */
187
+ export function DefaultSlotFor(context) {
188
+ if (SlotIsOnForm(context, DEFAULT_FORM_CONTRIBUTION_SLOT))
189
+ return DEFAULT_FORM_CONTRIBUTION_SLOT;
190
+ return context.SlotsPresent[0] ?? GENERATED_FORM_CONTRIBUTION_SLOTS[0] ?? DEFAULT_FORM_CONTRIBUTION_SLOT;
191
+ }
192
+ /**
193
+ * The starting answers.
194
+ *
195
+ * The fixed default. A host that wants the dialog to start from a proposal's claims seeds it
196
+ * with {@link PlacementStateFromContribution}.
197
+ *
198
+ * The one thing that moves the default is the form: starting on a slot the form does not
199
+ * emit would put the panel at the bottom no matter what the dialog showed.
200
+ */
201
+ export function InitialPlacementState(proposal, context) {
202
+ return {
203
+ Slot: DefaultSlotFor(context),
204
+ Presentation: proposal?.presentation === 'bare' ? 'bare' : 'panel',
205
+ Title: (proposal?.title ?? '').trim(),
206
+ Icon: (proposal?.icon ?? '').trim(),
207
+ ReplaceMode: 'none',
208
+ ReplaceRailKey: DefaultRailKeyFor(context),
209
+ ReplaceSectionKey: context.Sections[0]?.Key ?? '',
210
+ ReplaceSectionKeys: [],
211
+ InSectionKey: '',
212
+ SectionPosition: 'start',
213
+ ReplaceFieldSectionKey: DefaultFieldSectionKey(context),
214
+ ReplaceFieldNames: [],
215
+ ReplaceRelatedIndex: 0,
216
+ ReplaceContributionIndex: 0,
217
+ SortKey: null,
218
+ ActivateNow: !context.FullCustomForm,
219
+ KeepOff: false,
220
+ };
221
+ }
222
+ /**
223
+ * The starting answers read from a contribution block: the user's own earlier choice when
224
+ * editing a saved row, or a generated panel's proposal when applying one. A claim the form
225
+ * cannot honour falls back to the default.
226
+ *
227
+ * While the form is unread ({@link TargetsUnread}), a section, tab, field or in-section claim
228
+ * cannot be checked, so it is passed through as stated. A grid or panel claim is still checked
229
+ * against the context's grids and panels. A field claim is matched against the sections' fields
230
+ * whether or not those were read from the form, so it can name fields the dialog does not offer.
231
+ *
232
+ * @param activeNow Whether the panel is on now, so the edit keeps it on.
233
+ * @param keepOff Whether the panel is off now, so the edit keeps it off rather than making it a draft.
234
+ */
235
+ export function PlacementStateFromContribution(spec, context, activeNow, keepOff = false) {
236
+ // A claim that cannot be checked is kept as stored: Details and More are tabs, any other key a section.
237
+ const unread = TargetsUnread(context);
238
+ const railKey = (spec.replacesSectionKey ?? '').trim();
239
+ const listed = (spec.replacesSectionKeys ?? [])
240
+ .map((k) => k.trim())
241
+ .filter((k) => k.length > 0 && (unread || context.Sections.some((s) => s.Key === k)));
242
+ const unreadTab = unread && railKeyChromeGroup(railKey) !== null;
243
+ const sectionKey = context.Sections.some((s) => s.Key === railKey)
244
+ ? railKey
245
+ : listed[0] ?? (unread && !unreadTab ? railKey : '');
246
+ const isRailTab = !!railKey && !sectionKey
247
+ && (unreadTab || ReplaceableRailTabs(context).some((tab) => tab.Key === railKey));
248
+ // A claim is read back against the section holding the first field the form still
249
+ // draws. A claim whose fields have all gone is dropped rather than shown against a
250
+ // section it no longer touches.
251
+ const claimedFields = (spec.replacesFieldNames ?? []).map((n) => n.trim()).filter((n) => n.length > 0);
252
+ const fieldSection = claimedFields
253
+ .map((name) => SectionHoldingField(context, name))
254
+ .find((section) => section != null) ?? null;
255
+ const keptFields = fieldSection
256
+ ? claimedFields.filter((name) => (fieldSection.Fields ?? []).some((f) => f.Name === name))
257
+ : unread ? claimedFields : [];
258
+ const relatedIndex = relatedTargetIndex(context, spec);
259
+ const contributionIndex = spec.contributionKey
260
+ ? context.Existing.findIndex((e) => e.Key === spec.contributionKey)
261
+ : -1;
262
+ // A section to draw inside must be one the form draws, unless the form was never read.
263
+ const inSectionKey = (spec.inSectionKey ?? '').trim();
264
+ const keptInSectionKey = inSectionKey && (unread || context.Sections.some((s) => s.Key === inSectionKey))
265
+ ? inSectionKey
266
+ : '';
267
+ let mode = 'none';
268
+ if (isRailTab)
269
+ mode = 'rail-tab';
270
+ else if (sectionKey)
271
+ mode = 'section';
272
+ else if (keptFields.length > 0)
273
+ mode = 'field';
274
+ else if (relatedIndex >= 0)
275
+ mode = 'related';
276
+ else if (contributionIndex >= 0)
277
+ mode = 'contribution';
278
+ return {
279
+ Slot: spec.slot && SlotIsOnForm(context, spec.slot) ? spec.slot : DefaultSlotFor(context),
280
+ Presentation: spec.presentation === 'bare' ? 'bare' : 'panel',
281
+ Title: (spec.title ?? '').trim(),
282
+ Icon: (spec.icon ?? '').trim(),
283
+ ReplaceMode: mode,
284
+ ReplaceRailKey: isRailTab ? railKey : DefaultRailKeyFor(context),
285
+ ReplaceSectionKey: sectionKey || context.Sections[0]?.Key || '',
286
+ ReplaceSectionKeys: listed.length > 1 ? listed : [],
287
+ InSectionKey: mode === 'none' ? keptInSectionKey : '',
288
+ SectionPosition: spec.sectionPosition === 'end' ? 'end' : 'start',
289
+ ReplaceFieldSectionKey: fieldSection?.Key || DefaultFieldSectionKey(context),
290
+ ReplaceFieldNames: keptFields,
291
+ ReplaceRelatedIndex: relatedIndex >= 0 ? relatedIndex : 0,
292
+ ReplaceContributionIndex: contributionIndex >= 0 ? contributionIndex : 0,
293
+ SortKey: spec.sortKey ?? null,
294
+ ActivateNow: activeNow,
295
+ KeepOff: !activeNow && keepOff,
296
+ };
297
+ }
298
+ /**
299
+ * Whether a panel standing in for this tab has to be filed into it: `details` or `more` for the
300
+ * two tabs the chrome layer assembles from their members, null for any other tab, which is named
301
+ * after the panels it holds and dissolves when they are all replaced.
302
+ */
303
+ function railKeyChromeGroup(railKey) {
304
+ return ReplacedSectionChromeGroup(railKey, null);
305
+ }
306
+ /**
307
+ * The grid a stored related claim names. Matched on the join field too when the claim has one,
308
+ * because two grids can show the same entity. -1 when the form shows no such grid.
309
+ */
310
+ function relatedTargetIndex(context, spec) {
311
+ if (!spec.relatedEntity)
312
+ return -1;
313
+ const join = StripJoinFieldBrackets(spec.relatedJoinField);
314
+ return context.Related.findIndex((r) => r.Entity === spec.relatedEntity
315
+ && (!join || StripJoinFieldBrackets(r.JoinField) === join));
316
+ }
317
+ /**
318
+ * The block an edited row is written back with.
319
+ *
320
+ * {@link ResolvePlacementDecision} writes a key only when the user chose to replace a panel, and
321
+ * the write path derives one otherwise. For a row already saved, that would change its identity
322
+ * on every edit. So a decision with no key and no grid claim keeps the row's own key, unless that
323
+ * key was the claim the user just dropped: the key of a panel the dialog listed, or a grid key.
324
+ *
325
+ * @param existing The other panels the dialog offered to replace.
326
+ */
327
+ export function KeepEditedRowKey(contribution, row, existing) {
328
+ const key = row.ContributionKey?.trim();
329
+ if (!key || contribution.contributionKey || contribution.relatedEntity)
330
+ return contribution;
331
+ if (existing.some((e) => e.Key === key))
332
+ return contribution;
333
+ // Any grid key, whatever casing or join field it was written with.
334
+ if (key.startsWith('related:'))
335
+ return contribution;
336
+ return { ...contribution, contributionKey: key };
337
+ }
338
+ /**
339
+ * The state as a contribution block.
340
+ *
341
+ * `sortKey` is written only once the user has placed the panel among others in its position,
342
+ * and `contributionKey` is set only when the user chose to
343
+ * take over a named panel. A key is what makes one contribution replace another, so it is
344
+ * written when a replacement is meant and left for the write path to derive otherwise — the
345
+ * duplicate check compares those strings literally, and two algorithms would not agree.
346
+ * The proposal's `configuration` is carried through; a field claim also writes the chosen
347
+ * fields into `configuration.fields`.
348
+ */
349
+ export function ResolvePlacementDecision(state, context, proposal) {
350
+ const contribution = {
351
+ slot: state.Slot,
352
+ presentation: state.Presentation,
353
+ title: state.Title.trim() || (proposal?.title ?? 'Panel'),
354
+ };
355
+ const icon = state.Icon.trim();
356
+ if (icon)
357
+ contribution.icon = icon;
358
+ if (state.SortKey != null)
359
+ contribution.sortKey = state.SortKey;
360
+ const configuration = proposal?.configuration;
361
+ if (configuration && Object.keys(configuration).length > 0) {
362
+ contribution.configuration = { ...configuration };
363
+ }
364
+ if (state.ReplaceMode === 'rail-tab') {
365
+ const key = state.ReplaceRailKey.trim();
366
+ if (key) {
367
+ contribution.replacesSectionKey = key;
368
+ // Details and More are assembled from their members, so a panel standing in
369
+ // for one has to join it or the emptied tab is left behind. Every other tab
370
+ // IS its members, so emptying it leaves the panel to become the tab itself.
371
+ // A bare strip is never a rail item, so it joins nothing.
372
+ const group = railKeyChromeGroup(key);
373
+ if (group && state.Presentation !== 'bare')
374
+ contribution.chromeGroup = group;
375
+ }
376
+ }
377
+ else if (state.ReplaceMode === 'section') {
378
+ const keys = ChosenSectionKeys(state, context);
379
+ if (keys.length === 1)
380
+ contribution.replacesSectionKey = keys[0];
381
+ else if (keys.length > 1)
382
+ contribution.replacesSectionKeys = keys;
383
+ // Panels drawing in one place break ties by page order, so they share one slot and the
384
+ // slot sorts them by `sortKey`, as the order list does.
385
+ if (keys.length > 0 && SlotIsOnForm(context, 'before-fields'))
386
+ contribution.slot = 'before-fields';
387
+ }
388
+ else if (state.ReplaceMode === 'field') {
389
+ writeFieldClaim(contribution, ChosenFieldNames(state, context), state.SectionPosition);
390
+ }
391
+ else if (state.ReplaceMode === 'related') {
392
+ const target = context.Related[state.ReplaceRelatedIndex];
393
+ if (target) {
394
+ contribution.relatedEntity = target.Entity;
395
+ if (target.JoinField)
396
+ contribution.relatedJoinField = target.JoinField;
397
+ }
398
+ }
399
+ else if (state.ReplaceMode === 'contribution') {
400
+ const target = context.Existing[state.ReplaceContributionIndex];
401
+ if (target?.Key)
402
+ contribution.contributionKey = target.Key;
403
+ }
404
+ else if (state.InSectionKey.trim()) {
405
+ contribution.inSectionKey = state.InSectionKey.trim();
406
+ contribution.sectionPosition = state.SectionPosition;
407
+ }
408
+ return { Contribution: contribution, ActivateNow: state.ActivateNow, KeepOff: !state.ActivateNow && state.KeepOff };
409
+ }
410
+ /**
411
+ * A claim on the chosen fields: `replacesFieldNames`, the same names in `configuration.fields`
412
+ * (the list a field panel draws, while the host applies edits only for claimed fields), and
413
+ * the position when it is the end. With no names it writes nothing.
414
+ */
415
+ function writeFieldClaim(contribution, names, position) {
416
+ if (names.length === 0)
417
+ return;
418
+ contribution.replacesFieldNames = names;
419
+ contribution.configuration = { ...(contribution.configuration ?? {}), fields: [...names] };
420
+ if (position === 'end')
421
+ contribution.sectionPosition = 'end';
422
+ }
423
+ /**
424
+ * The proposal merged onto the spec the write path sends.
425
+ *
426
+ * The spec is what the component runs from, so it is copied rather than edited: the caller
427
+ * may still be showing the original in a preview.
428
+ */
429
+ export function ApplyDecisionToSpec(spec, decision) {
430
+ return { ...spec, formContribution: decision.Contribution };
431
+ }
432
+ //# sourceMappingURL=form-placement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-placement.js","sourceRoot":"","sources":["../../../src/lib/apply/form-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACH,8BAA8B,EAC9B,uBAAuB,EACvB,iCAAiC,EACjC,sBAAsB,GAIzB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA6GzG;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B;IACvD,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,OAA6B;IACnD,OAAO,OAAO,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAC/B,KAAyB,EACzB,OAA6B;IAE7B,IAAI,KAAK,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,cAAc,CAAC,CAAC;QAC3E,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,WAAW,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS;QAAE,OAAO,IAAI,GAAG,CAAC,iBAAiB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACvF,OAAO,IAAI,GAAG,EAAU,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH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,YAAkC,EAAE,KAAe,EAAE,QAA+C;IACzH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC/B,YAAY,CAAC,kBAAkB,GAAG,KAAK,CAAC;IACxC,YAAY,CAAC,aAAa,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC;IAC3F,IAAI,QAAQ,KAAK,KAAK;QAAE,YAAY,CAAC,eAAe,GAAG,KAAK,CAAC;AACjE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAAO,EACP,QAA+B;IAE/B,OAAO,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC;AAChE,CAAC","sourcesContent":["/**\n * @fileoverview The placement decision — what the user answers before a panel is written.\n *\n * A generated panel arrives carrying a `formContribution` block. Its **identity** —\n * `presentation`, `title`, `icon` — describes what the component is. Its **placement** — slot\n * and claims — is a proposal: the dialog starts from every claim the open form can honour and\n * from a fixed default for the rest, and the user confirms or changes it.\n *\n * Everything here is pure. The component holds a {@link FormPlacementState} and renders it;\n * these functions decide what that state means. The sentences that describe a state are in\n * `form-placement-text.ts`, and the order of panels in one position is in\n * `form-placement-order.ts`.\n */\n\nimport {\n DEFAULT_FORM_CONTRIBUTION_SLOT,\n FORM_CONTRIBUTION_SLOTS,\n GENERATED_FORM_CONTRIBUTION_SLOTS,\n StripJoinFieldBrackets,\n type FormContributionPresentation,\n type FormContributionSlot,\n type FormContributionSpec,\n} from '@memberjunction/interactive-component-types/forms';\nimport { DETAILS_SECTION_KEY, ReplacedSectionChromeGroup, SlotChromeGroup } from '../chrome/form-chrome';\n\n/** One input inside a field section, which a panel may stand in for. */\nexport interface FormPlacementField {\n /** The entity field name, which is what reaches the database. */\n Name: string;\n /** What the form labels it, for the reader. */\n Label: string;\n}\n\n/** A field section on the form, which a panel may hide. */\nexport interface FormPlacementSection {\n Key: string;\n Title: string;\n /**\n * The inputs this section draws. Empty when the targets were derived rather than read\n * from a form, in which case replacing one field is not offered: naming a field the\n * form does not draw would hide nothing and report no error.\n */\n Fields?: readonly FormPlacementField[];\n}\n\n/** A related-record grid on the form, which a panel may take over. */\nexport interface FormPlacementRelated {\n Entity: string;\n JoinField: string;\n DisplayName: string;\n}\n\n/** A panel already registered on this entity. */\nexport interface FormPlacementExisting {\n Key: string;\n Slot: string;\n Title: string;\n /** Order among panels in the same position, higher first. Absent means 0. */\n SortKey?: number;\n /** The section it is placed in, replacing nothing. */\n InSectionKey?: string | null;\n /** Where inside its section it draws, for a placement in a section or a field claim. */\n SectionPosition?: 'start' | 'end' | null;\n /** Fields it stands in for; it draws inside the section holding them. */\n FieldNames?: readonly string[];\n /** Blocks it stands in for; it draws in the place of the first. */\n SectionKeys?: readonly string[];\n /** True when it stands in for a section, tab or grid, so it draws in that place, not at a position. */\n ReplacesPlace?: boolean;\n}\n\n/** One item in the form's side rail, and the panels it holds. */\nexport interface FormPlacementRailItem {\n Key: string;\n Title: string;\n Icon: string;\n /** Section keys of the panels filed under this item. */\n SectionKeys: readonly string[];\n IsMore: boolean;\n}\n\n/**\n * What the form actually contains, so the dialog offers real targets.\n *\n * `FullCustomForm` is the case with no good answer yet: a full custom form renders its own\n * body, so a panel applied to that entity is stored and never seen.\n */\nexport interface FormPlacementContext {\n EntityName: string;\n Sections: readonly FormPlacementSection[];\n Related: readonly FormPlacementRelated[];\n Existing: readonly FormPlacementExisting[];\n /**\n * Slots this form emits. A slot outside this list still accepts a panel, but the slot\n * coordinator sends it down the fallback chain to the container's `after-everything`\n * terminator — the bottom of the form. A generated form emits whichever slots CodeGen\n * knew about when it last ran, so the set differs from form to form.\n */\n SlotsPresent: readonly FormContributionSlot[];\n /**\n * Whether {@link SlotsPresent} was read from a form, rather than assumed from the shape\n * CodeGen produces. Separate from {@link TargetsVerified} because the two are learned\n * apart: a slot probe answers the slot question without answering the section question.\n */\n SlotsVerified: boolean;\n /**\n * How the form arranges itself. In `left-nav` the chrome folds every field section into\n * one \"Details\" tab, so the section names the user can choose from are a level below\n * anything the form shows them.\n */\n Layout: 'accordion' | 'left-nav';\n /**\n * The rail the form shows, in order. Empty when it could not be resolved, which the\n * preview treats as \"no rail to draw\" rather than as a form with no sections.\n */\n Rail: readonly FormPlacementRailItem[];\n FullCustomForm: boolean;\n /**\n * Whether these targets came from the form itself.\n *\n * True means the open form reported them, so a section key here is one the form\n * really renders. False means they were derived from entity metadata on the server,\n * which is a different thing: a generated form is frozen at the moment CodeGen last\n * ran, so a field recategorised since then moves in the metadata and not on the form.\n * A key that only exists in the metadata hides nothing and reports no error.\n */\n TargetsVerified: boolean;\n}\n\n/** Whether the panel adds to the form or takes something's place. */\nexport type FormPlacementReplaceMode = 'none' | 'rail-tab' | 'section' | 'field' | 'related' | 'contribution';\n\n/**\n * Whether the form bundles its field sections into a Details tab.\n *\n * Only a rail layout does. An accordion shows every section in place, so there is no tab\n * to stand in for and the section list means exactly what it says.\n */\nexport function HasDetailsTab(context: FormPlacementContext): boolean {\n return context.Layout === 'left-nav' && context.Sections.length > 0;\n}\n\n/**\n * Whether the form shows a side rail, so there are tabs a user can point at.\n *\n * The rail groups exist whatever the layout — an accordion form uses them to decide what\n * is visible, it just draws no rail. So a non-empty `Rail` does not mean the user sees\n * tabs, and offering to \"replace a whole tab\" on a form that shows none describes\n * something that is not on their screen.\n */\nexport function ShowsRail(context: FormPlacementContext): boolean {\n return context.Layout === 'left-nav' && context.Rail.length > 0;\n}\n\n/**\n * The blocks in the preview that this choice will take off the form.\n *\n * The replace choices differ only in how much they cover — a whole tab is every field\n * group in it, one field group is one of those — and saying that in a label has not been\n * enough. Marking the blocks themselves shows the difference instead of describing it.\n */\nexport function ReplacedPreviewKeys(\n state: FormPlacementState,\n context: FormPlacementContext,\n): ReadonlySet<string> {\n if (state.ReplaceMode === 'rail-tab') {\n const tab = context.Rail.find((item) => item.Key === state.ReplaceRailKey);\n return new Set(tab?.SectionKeys ?? []);\n }\n if (state.ReplaceMode === 'section') return new Set(ChosenSectionKeys(state, context));\n return new Set<string>();\n}\n\n/**\n * Whether the form's targets are not known yet: no sections, and none read from the form.\n * A claim cannot be checked against such a context, so it is kept as it stands.\n */\nexport function TargetsUnread(context: FormPlacementContext): boolean {\n return context.Sections.length === 0 && !context.TargetsVerified;\n}\n\n/**\n * The sections the `section` mode stands in for, in the form's order and kept to sections the\n * form draws. The list when one is set, else the single key.\n */\nexport function ChosenSectionKeys(state: FormPlacementState, context: FormPlacementContext): string[] {\n const wanted = state.ReplaceSectionKeys.length > 0 ? state.ReplaceSectionKeys : [state.ReplaceSectionKey];\n const keys = wanted.map((key) => key.trim()).filter((key) => key.length > 0);\n if (TargetsUnread(context)) return keys;\n return context.Sections.map((s) => s.Key).filter((key) => keys.includes(key));\n}\n\n/** The section drawing this field, or null when no section on the form does. */\nexport function SectionHoldingField(\n context: FormPlacementContext,\n fieldName: string,\n): FormPlacementSection | null {\n const name = (fieldName ?? '').trim();\n if (!name) return null;\n return context.Sections.find((s) => (s.Fields ?? []).some((f) => f.Name === name)) ?? null;\n}\n\n/** Sections that draw at least one field, so there is something to choose from. */\nexport function SectionsWithFields(context: FormPlacementContext): readonly FormPlacementSection[] {\n if (!context.TargetsVerified) return [];\n return context.Sections.filter((s) => (s.Fields ?? []).length > 0);\n}\n\n/** The fields of one section, by key. Empty for a section the form does not draw. */\nexport function FieldsInSection(\n context: FormPlacementContext,\n sectionKey: string,\n): readonly FormPlacementField[] {\n const key = (sectionKey ?? '').trim();\n if (!key) return [];\n return context.Sections.find((s) => s.Key === key)?.Fields ?? [];\n}\n\n/**\n * The chosen field names, kept to the ones the chosen section really draws.\n *\n * The section and the names are held apart in the state, so switching section leaves a\n * stale set behind. Filtering here rather than on every change keeps the state simple and\n * means a section the form stopped drawing cannot smuggle a claim through.\n */\nexport function ChosenFieldNames(state: FormPlacementState, context: FormPlacementContext): string[] {\n if (TargetsUnread(context)) return [...state.ReplaceFieldNames];\n const available = FieldsInSection(context, state.ReplaceFieldSectionKey);\n return state.ReplaceFieldNames.filter((name) => available.some((f) => f.Name === name));\n}\n\n/** The section a field claim starts on: the first one with fields to offer. */\nexport function DefaultFieldSectionKey(context: FormPlacementContext): string {\n return SectionsWithFields(context)[0]?.Key ?? '';\n}\n\n/** Tabs a panel may stand in for — every rail item, on a form that shows a rail. */\nexport function ReplaceableRailTabs(context: FormPlacementContext): readonly FormPlacementRailItem[] {\n return ShowsRail(context) ? context.Rail : [];\n}\n\n/** The tab the dialog starts on: Details when the form has one, else the first. */\nexport function DefaultRailKeyFor(context: FormPlacementContext): string {\n const tabs = ReplaceableRailTabs(context);\n if (tabs.some((item) => item.Key === DETAILS_SECTION_KEY)) return DETAILS_SECTION_KEY;\n return tabs[0]?.Key ?? '';\n}\n\n/**\n * Which rail item the panel will appear under, given the answers so far.\n *\n * Replacing something puts the panel where that thing was, so the answer is the item\n * holding it. Replacing nothing gives the panel a rail item of its own, and null says so:\n * the preview then draws a new item rather than highlighting an existing one.\n */\nexport function TargetRailItem(\n state: FormPlacementState,\n context: FormPlacementContext,\n): FormPlacementRailItem | null {\n if (state.Presentation === 'bare' || !ShowsRail(context)) return null;\n const holding = (sectionKey: string): FormPlacementRailItem | null =>\n context.Rail.find((item) => item.SectionKeys.includes(sectionKey)) ?? null;\n\n if (state.ReplaceMode === 'rail-tab') {\n return context.Rail.find((item) => item.Key === state.ReplaceRailKey) ?? null;\n }\n if (state.ReplaceMode === 'section') return holding(ChosenSectionKeys(state, context)[0] ?? '');\n if (state.ReplaceMode === 'field') {\n return state.ReplaceFieldSectionKey ? holding(state.ReplaceFieldSectionKey) : null;\n }\n if (state.ReplaceMode === 'related') {\n const target = context.Related[state.ReplaceRelatedIndex];\n if (!target) return null;\n return context.Rail.find((item) => item.Title === target.DisplayName) ?? null;\n }\n if (state.ReplaceMode === 'contribution') {\n const target = context.Existing[state.ReplaceContributionIndex];\n return target ? holding(target.Key) : null;\n }\n // Claiming nothing, the slot decides: a position among the field sections puts the\n // panel in the tab those sections make up.\n if (SlotChromeGroup(state.Slot) === 'details') {\n return context.Rail.find((item) => item.Key === DETAILS_SECTION_KEY) ?? null;\n }\n return null;\n}\n\n/** The editable answers. One field per control in the dialog. */\nexport interface FormPlacementState {\n Slot: FormContributionSlot;\n Presentation: FormContributionPresentation;\n Title: string;\n Icon: string;\n ReplaceMode: FormPlacementReplaceMode;\n /** Key of the rail tab to stand in for, when the mode is `rail-tab`. */\n ReplaceRailKey: string;\n ReplaceSectionKey: string;\n /**\n * Sections to stand in for, when the `section` mode names more than one. Empty means the\n * one in {@link ReplaceSectionKey}.\n */\n ReplaceSectionKeys: string[];\n /** Section to draw inside, replacing nothing. Empty means the panel goes at {@link Slot}. */\n InSectionKey: string;\n /** Where inside its section the panel draws: for {@link InSectionKey} and for a field claim. */\n SectionPosition: 'start' | 'end';\n /** Section whose fields the `field` mode chooses from. */\n ReplaceFieldSectionKey: string;\n /** Entity field names to stand in for, all inside {@link ReplaceFieldSectionKey}. */\n ReplaceFieldNames: string[];\n ReplaceRelatedIndex: number;\n ReplaceContributionIndex: number;\n /**\n * Order among the panels in the same position, higher first. Null leaves it unset: a new\n * panel saves 0, and an edited one keeps the order it has.\n */\n SortKey: number | null;\n ActivateNow: boolean;\n /**\n * Keeps a panel that is off, off, rather than saving it as a draft. Only an edit of a panel\n * that is off offers it, and it is false whenever {@link ActivateNow} is true.\n */\n KeepOff: boolean;\n}\n\n/**\n * A proposal's claim the dialog does not offer because the form could not confirm it: the\n * fields, sections or tab the panel was built to stand in for, or the section it was built to\n * sit inside.\n */\nexport type FormPlacementDroppedClaim =\n | { Kind: 'field'; FieldNames: readonly string[] }\n | { Kind: 'section'; SectionKeys: readonly string[] }\n | { Kind: 'rail-tab'; RailKey: string }\n | { Kind: 'in-section'; SectionKey: string };\n\n/** The answers, in the shape the write path consumes. */\nexport interface FormPlacementDecision {\n /** Merged into `spec.formContribution` before the create action runs. */\n Contribution: FormContributionSpec;\n /** False leaves the row Pending — stored, rendering for nobody. */\n ActivateNow: boolean;\n /** True leaves a row that is off, off, rather than Pending. */\n KeepOff?: boolean;\n}\n\n/** One position a panel can take, named twice: for the reader and for the record. */\nexport interface FormPlacementSlotChoice {\n Slot: FormContributionSlot;\n /** Where it is on the form, in plain words. What the dialog leads with. */\n Name: string;\n /** The slot's own name, which is what reaches the database. Shown beside it. */\n Label: string;\n}\n\n/**\n * Where each slot sits, said plainly.\n *\n * A slot is a position between the things already on the form, not a thing on the form,\n * and its stored name does not say that on its own — `before-fields` next to\n * `Contact Information` reads like a second piece of content. Both names are shown: the\n * plain one so the choice is legible, the stored one so a user who reads it here\n * recognises it in a row later.\n */\nconst SLOT_NAMES: Record<FormContributionSlot, string> = {\n 'top-area': 'Above everything',\n 'before-fields': 'Before the fields',\n 'after-fields': 'After the fields',\n 'after-related': 'After the related grids',\n 'after-everything': 'At the very bottom',\n};\n\n/** The slots, top to bottom. */\nexport const FORM_PLACEMENT_SLOTS: readonly FormPlacementSlotChoice[] =\n FORM_CONTRIBUTION_SLOTS.map((slot) => ({ Slot: slot, Name: SLOT_NAMES[slot] ?? slot, Label: slot }));\n\n/**\n * Whether the form emits this slot.\n *\n * An empty {@link FormPlacementContext.SlotsPresent} means nobody has told us, not that the\n * form has no slots, so the generated shape stands in. That shape excludes `top-area`, which\n * no form emits — offering it would send the panel to the bottom of the form under a label\n * that says the opposite.\n */\nexport function SlotIsOnForm(context: FormPlacementContext, slot: FormContributionSlot): boolean {\n const present = context.SlotsPresent.length > 0\n ? context.SlotsPresent\n : GENERATED_FORM_CONTRIBUTION_SLOTS;\n return present.includes(slot);\n}\n\n/** The preferred slot, unless this form does not emit it — then the first one it does. */\nexport function DefaultSlotFor(context: FormPlacementContext): FormContributionSlot {\n if (SlotIsOnForm(context, DEFAULT_FORM_CONTRIBUTION_SLOT)) return DEFAULT_FORM_CONTRIBUTION_SLOT;\n return context.SlotsPresent[0] ?? GENERATED_FORM_CONTRIBUTION_SLOTS[0] ?? DEFAULT_FORM_CONTRIBUTION_SLOT;\n}\n\n/**\n * The starting answers.\n *\n * The fixed default. A host that wants the dialog to start from a proposal's claims seeds it\n * with {@link PlacementStateFromContribution}.\n *\n * The one thing that moves the default is the form: starting on a slot the form does not\n * emit would put the panel at the bottom no matter what the dialog showed.\n */\nexport function InitialPlacementState(\n proposal: FormContributionSpec | null,\n context: FormPlacementContext,\n): FormPlacementState {\n return {\n Slot: DefaultSlotFor(context),\n Presentation: proposal?.presentation === 'bare' ? 'bare' : 'panel',\n Title: (proposal?.title ?? '').trim(),\n Icon: (proposal?.icon ?? '').trim(),\n ReplaceMode: 'none',\n ReplaceRailKey: DefaultRailKeyFor(context),\n ReplaceSectionKey: context.Sections[0]?.Key ?? '',\n ReplaceSectionKeys: [],\n InSectionKey: '',\n SectionPosition: 'start',\n ReplaceFieldSectionKey: DefaultFieldSectionKey(context),\n ReplaceFieldNames: [],\n ReplaceRelatedIndex: 0,\n ReplaceContributionIndex: 0,\n SortKey: null,\n ActivateNow: !context.FullCustomForm,\n KeepOff: false,\n };\n}\n\n/**\n * The starting answers read from a contribution block: the user's own earlier choice when\n * editing a saved row, or a generated panel's proposal when applying one. A claim the form\n * cannot honour falls back to the default.\n *\n * While the form is unread ({@link TargetsUnread}), a section, tab, field or in-section claim\n * cannot be checked, so it is passed through as stated. A grid or panel claim is still checked\n * against the context's grids and panels. A field claim is matched against the sections' fields\n * whether or not those were read from the form, so it can name fields the dialog does not offer.\n *\n * @param activeNow Whether the panel is on now, so the edit keeps it on.\n * @param keepOff Whether the panel is off now, so the edit keeps it off rather than making it a draft.\n */\nexport function PlacementStateFromContribution(\n spec: FormContributionSpec,\n context: FormPlacementContext,\n activeNow: boolean,\n keepOff = false,\n): FormPlacementState {\n // A claim that cannot be checked is kept as stored: Details and More are tabs, any other key a section.\n const unread = TargetsUnread(context);\n const railKey = (spec.replacesSectionKey ?? '').trim();\n const listed = (spec.replacesSectionKeys ?? [])\n .map((k) => k.trim())\n .filter((k) => k.length > 0 && (unread || context.Sections.some((s) => s.Key === k)));\n const unreadTab = unread && railKeyChromeGroup(railKey) !== null;\n const sectionKey = context.Sections.some((s) => s.Key === railKey)\n ? railKey\n : listed[0] ?? (unread && !unreadTab ? railKey : '');\n const isRailTab = !!railKey && !sectionKey\n && (unreadTab || ReplaceableRailTabs(context).some((tab) => tab.Key === railKey));\n\n // A claim is read back against the section holding the first field the form still\n // draws. A claim whose fields have all gone is dropped rather than shown against a\n // section it no longer touches.\n const claimedFields = (spec.replacesFieldNames ?? []).map((n) => n.trim()).filter((n) => n.length > 0);\n const fieldSection = claimedFields\n .map((name) => SectionHoldingField(context, name))\n .find((section): section is FormPlacementSection => section != null) ?? null;\n const keptFields = fieldSection\n ? claimedFields.filter((name) => (fieldSection.Fields ?? []).some((f) => f.Name === name))\n : unread ? claimedFields : [];\n\n const relatedIndex = relatedTargetIndex(context, spec);\n const contributionIndex = spec.contributionKey\n ? context.Existing.findIndex((e) => e.Key === spec.contributionKey)\n : -1;\n\n // A section to draw inside must be one the form draws, unless the form was never read.\n const inSectionKey = (spec.inSectionKey ?? '').trim();\n const keptInSectionKey = inSectionKey && (unread || context.Sections.some((s) => s.Key === inSectionKey))\n ? inSectionKey\n : '';\n\n let mode: FormPlacementReplaceMode = 'none';\n if (isRailTab) mode = 'rail-tab';\n else if (sectionKey) mode = 'section';\n else if (keptFields.length > 0) mode = 'field';\n else if (relatedIndex >= 0) mode = 'related';\n else if (contributionIndex >= 0) mode = 'contribution';\n\n return {\n Slot: spec.slot && SlotIsOnForm(context, spec.slot) ? spec.slot : DefaultSlotFor(context),\n Presentation: spec.presentation === 'bare' ? 'bare' : 'panel',\n Title: (spec.title ?? '').trim(),\n Icon: (spec.icon ?? '').trim(),\n ReplaceMode: mode,\n ReplaceRailKey: isRailTab ? railKey : DefaultRailKeyFor(context),\n ReplaceSectionKey: sectionKey || context.Sections[0]?.Key || '',\n ReplaceSectionKeys: listed.length > 1 ? listed : [],\n InSectionKey: mode === 'none' ? keptInSectionKey : '',\n SectionPosition: spec.sectionPosition === 'end' ? 'end' : 'start',\n ReplaceFieldSectionKey: fieldSection?.Key || DefaultFieldSectionKey(context),\n ReplaceFieldNames: keptFields,\n ReplaceRelatedIndex: relatedIndex >= 0 ? relatedIndex : 0,\n ReplaceContributionIndex: contributionIndex >= 0 ? contributionIndex : 0,\n SortKey: spec.sortKey ?? null,\n ActivateNow: activeNow,\n KeepOff: !activeNow && keepOff,\n };\n}\n\n/**\n * Whether a panel standing in for this tab has to be filed into it: `details` or `more` for the\n * two tabs the chrome layer assembles from their members, null for any other tab, which is named\n * after the panels it holds and dissolves when they are all replaced.\n */\nfunction railKeyChromeGroup(railKey: string): 'details' | 'more' | null {\n return ReplacedSectionChromeGroup(railKey, null);\n}\n\n/**\n * The grid a stored related claim names. Matched on the join field too when the claim has one,\n * because two grids can show the same entity. -1 when the form shows no such grid.\n */\nfunction relatedTargetIndex(context: FormPlacementContext, spec: FormContributionSpec): number {\n if (!spec.relatedEntity) return -1;\n const join = StripJoinFieldBrackets(spec.relatedJoinField);\n return context.Related.findIndex((r) => r.Entity === spec.relatedEntity\n && (!join || StripJoinFieldBrackets(r.JoinField) === join));\n}\n\n/**\n * The block an edited row is written back with.\n *\n * {@link ResolvePlacementDecision} writes a key only when the user chose to replace a panel, and\n * the write path derives one otherwise. For a row already saved, that would change its identity\n * on every edit. So a decision with no key and no grid claim keeps the row's own key, unless that\n * key was the claim the user just dropped: the key of a panel the dialog listed, or a grid key.\n *\n * @param existing The other panels the dialog offered to replace.\n */\nexport function KeepEditedRowKey(\n contribution: FormContributionSpec,\n row: { ContributionKey: string | null },\n existing: readonly FormPlacementExisting[],\n): FormContributionSpec {\n const key = row.ContributionKey?.trim();\n if (!key || contribution.contributionKey || contribution.relatedEntity) return contribution;\n if (existing.some((e) => e.Key === key)) return contribution;\n // Any grid key, whatever casing or join field it was written with.\n if (key.startsWith('related:')) return contribution;\n return { ...contribution, contributionKey: key };\n}\n\n/**\n * The state as a contribution block.\n *\n * `sortKey` is written only once the user has placed the panel among others in its position,\n * and `contributionKey` is set only when the user chose to\n * take over a named panel. A key is what makes one contribution replace another, so it is\n * written when a replacement is meant and left for the write path to derive otherwise — the\n * duplicate check compares those strings literally, and two algorithms would not agree.\n * The proposal's `configuration` is carried through; a field claim also writes the chosen\n * fields into `configuration.fields`.\n */\nexport function ResolvePlacementDecision(\n state: FormPlacementState,\n context: FormPlacementContext,\n proposal: FormContributionSpec | null,\n): FormPlacementDecision {\n const contribution: FormContributionSpec = {\n slot: state.Slot,\n presentation: state.Presentation,\n title: state.Title.trim() || (proposal?.title ?? 'Panel'),\n };\n\n const icon = state.Icon.trim();\n if (icon) contribution.icon = icon;\n if (state.SortKey != null) contribution.sortKey = state.SortKey;\n\n const configuration = proposal?.configuration;\n if (configuration && Object.keys(configuration).length > 0) {\n contribution.configuration = { ...configuration };\n }\n\n if (state.ReplaceMode === 'rail-tab') {\n const key = state.ReplaceRailKey.trim();\n if (key) {\n contribution.replacesSectionKey = key;\n // Details and More are assembled from their members, so a panel standing in\n // for one has to join it or the emptied tab is left behind. Every other tab\n // IS its members, so emptying it leaves the panel to become the tab itself.\n // A bare strip is never a rail item, so it joins nothing.\n const group = railKeyChromeGroup(key);\n if (group && state.Presentation !== 'bare') contribution.chromeGroup = group;\n }\n } else if (state.ReplaceMode === 'section') {\n const keys = ChosenSectionKeys(state, context);\n if (keys.length === 1) contribution.replacesSectionKey = keys[0];\n else if (keys.length > 1) contribution.replacesSectionKeys = keys;\n // Panels drawing in one place break ties by page order, so they share one slot and the\n // slot sorts them by `sortKey`, as the order list does.\n if (keys.length > 0 && SlotIsOnForm(context, 'before-fields')) contribution.slot = 'before-fields';\n } else if (state.ReplaceMode === 'field') {\n writeFieldClaim(contribution, ChosenFieldNames(state, context), state.SectionPosition);\n } else if (state.ReplaceMode === 'related') {\n const target = context.Related[state.ReplaceRelatedIndex];\n if (target) {\n contribution.relatedEntity = target.Entity;\n if (target.JoinField) contribution.relatedJoinField = target.JoinField;\n }\n } else if (state.ReplaceMode === 'contribution') {\n const target = context.Existing[state.ReplaceContributionIndex];\n if (target?.Key) contribution.contributionKey = target.Key;\n } else if (state.InSectionKey.trim()) {\n contribution.inSectionKey = state.InSectionKey.trim();\n contribution.sectionPosition = state.SectionPosition;\n }\n\n return { Contribution: contribution, ActivateNow: state.ActivateNow, KeepOff: !state.ActivateNow && state.KeepOff };\n}\n\n/**\n * A claim on the chosen fields: `replacesFieldNames`, the same names in `configuration.fields`\n * (the list a field panel draws, while the host applies edits only for claimed fields), and\n * the position when it is the end. With no names it writes nothing.\n */\nfunction writeFieldClaim(contribution: FormContributionSpec, names: string[], position: FormPlacementState['SectionPosition']): void {\n if (names.length === 0) return;\n contribution.replacesFieldNames = names;\n contribution.configuration = { ...(contribution.configuration ?? {}), fields: [...names] };\n if (position === 'end') contribution.sectionPosition = 'end';\n}\n\n/**\n * The proposal merged onto the spec the write path sends.\n *\n * The spec is what the component runs from, so it is copied rather than edited: the caller\n * may still be showing the original in a preview.\n */\nexport function ApplyDecisionToSpec<T extends { formContribution?: FormContributionSpec }>(\n spec: T,\n decision: FormPlacementDecision,\n): T {\n return { ...spec, formContribution: decision.Contribution };\n}\n"]}