@memberjunction/ng-base-forms 6.2.0-edge.1 → 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 (207) 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 +166 -1
  30. package/dist/lib/base-form-component.d.ts.map +1 -1
  31. package/dist/lib/base-form-component.js +296 -20
  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 +261 -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 +1180 -371
  52. package/dist/lib/container/record-form-container.component.js.map +1 -1
  53. package/dist/lib/duplicate-entry-check/duplicate-entry-check.d.ts +150 -0
  54. package/dist/lib/duplicate-entry-check/duplicate-entry-check.d.ts.map +1 -0
  55. package/dist/lib/duplicate-entry-check/duplicate-entry-check.js +263 -0
  56. package/dist/lib/duplicate-entry-check/duplicate-entry-check.js.map +1 -0
  57. package/dist/lib/field/form-field.component.d.ts +22 -0
  58. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  59. package/dist/lib/field/form-field.component.js +51 -6
  60. package/dist/lib/field/form-field.component.js.map +1 -1
  61. package/dist/lib/form-field-edit.coordinator.d.ts +25 -0
  62. package/dist/lib/form-field-edit.coordinator.d.ts.map +1 -0
  63. package/dist/lib/form-field-edit.coordinator.js +27 -0
  64. package/dist/lib/form-field-edit.coordinator.js.map +1 -0
  65. package/dist/lib/form-state.service.d.ts +5 -0
  66. package/dist/lib/form-state.service.d.ts.map +1 -1
  67. package/dist/lib/form-state.service.js +6 -1
  68. package/dist/lib/form-state.service.js.map +1 -1
  69. package/dist/lib/host/entity-form-host.component.d.ts +16 -1
  70. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
  71. package/dist/lib/host/entity-form-host.component.js +27 -6
  72. package/dist/lib/host/entity-form-host.component.js.map +1 -1
  73. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
  74. package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
  75. package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
  76. package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
  77. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
  78. package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
  79. package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
  80. package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
  81. package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
  82. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
  83. package/dist/lib/interactive-form/interactive-form.component.js +4 -5
  84. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
  85. package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
  86. package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
  87. package/dist/lib/panel/collapsible-panel.component.js +148 -12
  88. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  89. package/dist/lib/panel-manager/form-audience.d.ts +46 -0
  90. package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
  91. package/dist/lib/panel-manager/form-audience.js +34 -0
  92. package/dist/lib/panel-manager/form-audience.js.map +1 -0
  93. package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
  94. package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
  95. package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
  96. package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
  97. package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
  98. package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
  99. package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
  100. package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
  101. package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
  102. package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
  103. package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
  104. package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
  105. package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
  106. package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
  107. package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
  108. package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
  109. package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
  110. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
  111. package/dist/lib/panel-slot/base-form-panel.js +76 -5
  112. package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
  113. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
  114. package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
  115. package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
  116. package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
  117. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
  118. package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
  119. package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
  120. package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
  121. package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
  122. package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
  123. package/dist/lib/panel-slot/form-contribution.js +242 -64
  124. package/dist/lib/panel-slot/form-contribution.js.map +1 -1
  125. package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
  126. package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
  127. package/dist/lib/panel-slot/form-contributions.component.js +43 -7
  128. package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
  129. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
  130. package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
  131. package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
  132. package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
  133. package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
  134. package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
  135. package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
  136. package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
  137. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
  138. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
  139. package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
  140. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
  141. package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
  142. package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
  143. package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
  144. package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
  145. package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
  146. package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
  147. package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
  148. package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
  149. package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
  150. package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
  151. package/dist/lib/panel-slot/panel-hides.js +111 -0
  152. package/dist/lib/panel-slot/panel-hides.js.map +1 -0
  153. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
  154. package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
  155. package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
  156. package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
  157. package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
  158. package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
  159. package/dist/lib/panel-slot/placement-preview.js +86 -0
  160. package/dist/lib/panel-slot/placement-preview.js.map +1 -0
  161. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
  162. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
  163. package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
  164. package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
  165. package/dist/lib/panel-slot/slot-order.d.ts +19 -0
  166. package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
  167. package/dist/lib/panel-slot/slot-order.js +53 -0
  168. package/dist/lib/panel-slot/slot-order.js.map +1 -0
  169. package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
  170. package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
  171. package/dist/lib/resolver/form-resolver.service.js +18 -8
  172. package/dist/lib/resolver/form-resolver.service.js.map +1 -1
  173. package/dist/lib/resolver/form-variants.d.ts +28 -0
  174. package/dist/lib/resolver/form-variants.d.ts.map +1 -0
  175. package/dist/lib/resolver/form-variants.js +40 -0
  176. package/dist/lib/resolver/form-variants.js.map +1 -0
  177. package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
  178. package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
  179. package/dist/lib/section-counts/form-section-counts.js +223 -0
  180. package/dist/lib/section-counts/form-section-counts.js.map +1 -0
  181. package/dist/lib/toolbar/form-toolbar.component.d.ts +129 -2
  182. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  183. package/dist/lib/toolbar/form-toolbar.component.js +974 -307
  184. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  185. package/dist/lib/types/form-events.d.ts +6 -0
  186. package/dist/lib/types/form-events.d.ts.map +1 -1
  187. package/dist/lib/types/form-events.js +6 -0
  188. package/dist/lib/types/form-events.js.map +1 -1
  189. package/dist/lib/types/form-toolbar-item.d.ts +20 -1
  190. package/dist/lib/types/form-toolbar-item.d.ts.map +1 -1
  191. package/dist/lib/types/form-toolbar-item.js.map +1 -1
  192. package/dist/lib/types/form-types.d.ts +13 -0
  193. package/dist/lib/types/form-types.d.ts.map +1 -1
  194. package/dist/lib/types/form-types.js.map +1 -1
  195. package/dist/lib/types/toolbar-config.d.ts +16 -0
  196. package/dist/lib/types/toolbar-config.d.ts.map +1 -1
  197. package/dist/lib/types/toolbar-config.js +3 -0
  198. package/dist/lib/types/toolbar-config.js.map +1 -1
  199. package/dist/module.d.ts +29 -22
  200. package/dist/module.d.ts.map +1 -1
  201. package/dist/module.js +50 -8
  202. package/dist/module.js.map +1 -1
  203. package/dist/public-api.d.ts +22 -0
  204. package/dist/public-api.d.ts.map +1 -1
  205. package/dist/public-api.js +24 -0
  206. package/dist/public-api.js.map +1 -1
  207. package/package.json +20 -18
@@ -1 +1 @@
1
- {"version":3,"file":"base-form-panel.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/base-form-panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAc,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;;AAkHxF;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,OAAgB,aAAa;IAC/B;;;;OAIG;IAE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C,aAAa,EAAE,kBAAkB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACI,iBAAiB,CAAC,GAAuB;QAC5C,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,mBAAmB,CAAC,GAAuB,EAAE,KAAa;QAC7D,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;uGA/GiB,aAAa;6DAAb,aAAa;YAAb,0CAAa;;;iFAAb,aAAa;cADlC,SAAS;;kBAOL,WAAW;mBAAC,eAAe;;kBAI3B,KAAK;;kBAEL,KAAK;;kBAEL,KAAK","sourcesContent":["import { Directive, HostBinding, Input } from '@angular/core';\nimport { BaseEntity, ValidationResult, type FormInclusion } from '@memberjunction/core';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { FormToolbarItemConfig, FormToolbarItemKey } from '../types/form-toolbar-item';\n\n/**\n * Well-known slot positions where panels can be injected into a generated\n * entity form. Used as the `slot` field in a panel's registration metadata.\n *\n * Slot positions inside the form, top to bottom:\n *\n * ┌─ <mj-record-form-container>\n * │ [top-area slot] ← CodeGen-emitted; rare (entities with top-area section)\n * │ [before-fields slot] ← CodeGen-emitted; banners / warnings above field panels\n * │ <connection details>\n * │ <other generated field panels>\n * │ [after-fields slot] ← CodeGen-emitted; typed config knobs, secondary settings — most common slot\n * │ <content items grid>\n * │ <other related-entity grids>\n * │ [after-related slot] ← CodeGen-emitted; bottom-of-form addenda\n * │ [after-everything slot] ← Container-emitted; ALWAYS present (fallback target)\n * └─ </mj-record-form-container>\n *\n * Pick the slot that matches the panel's role. `after-fields` is the default\n * for most \"additional settings\" panels — it sits in the field column, before\n * the related-entity grids.\n *\n * **Fallback behavior** — see `FormSlotCoordinator`. If the registered slot is\n * missing in the current form (CodeGen hasn't been rerun against the new\n * template emitter), the panel walks forward in the chain until it finds an\n * existing slot. `after-everything` is always emitted by the container, so\n * fallback never dead-ends. Pre-CodeGen-regen forms show every panel at the\n * bottom of the form; post-regen forms show them in the preferred position.\n */\nexport type FormPanelSlot =\n | 'top-area'\n | 'before-fields'\n | 'after-fields'\n | 'after-related'\n | 'after-everything';\n\n/**\n * Shape of the `metadata` object every BaseFormPanel registration MUST attach\n * via `@RegisterClass(BaseFormPanel, { metadata: {...} })`. The\n * `<mj-form-panel-slot>` host filters registrations by matching against this\n * shape — registrations without it are silently ignored.\n *\n * - `entity` — the exact entity name (case-sensitive equality enforced by the\n * slot host), OR the wildcard `'*'` to register an\n * **entity-agnostic** panel that mounts on EVERY entity's form.\n * Wildcard panels are expected to self-hide (render nothing) when\n * they don't apply to the current record, so the cross-cutting\n * registration stays unobtrusive on forms it has no business on.\n * - `slot` — which slot the panel renders into.\n * - `sortKey`— higher = earlier within the slot. Defaults to 0 if omitted.\n * Use ranges (e.g., 100/50/10) so future panels can wedge in\n * without recomputing every neighbor's sort.\n */\nexport interface FormPanelRegistrationMetadata extends Record<string, unknown> {\n entity: string;\n slot: FormPanelSlot;\n sortKey?: number;\n /**\n * Identity for last-wins collapse. Two registrations with the same key\n * compete; highest ClassFactory `Priority` wins. Omit to derive:\n * `related:${relatedEntity}:${relatedJoinField}` when claiming a\n * relationship, otherwise the registration is unique and never collapses.\n */\n contributionKey?: string;\n /**\n * When set, this panel **replaces** the default related-entity grid for\n * that relationship on `entity`'s form. The baked CodeGen panel (if any)\n * is hidden; the stock fill-in grid is not mounted.\n */\n relatedEntity?: string;\n /**\n * Disambiguates two FKs to the same related entity (BillTo vs ShipTo).\n * Compared after stripping wrapping `[]`.\n */\n relatedJoinField?: string;\n /**\n * CodeGen `SectionKey` of a baked field (or other) panel this contribution\n * replaces — e.g. `'details'`, `'personalIdentity'`. Hidden at runtime via\n * `HiddenSectionKeys`. Use with `slot: 'before-fields'` for a form hero that\n * is not a collapsible panel. Must name a concrete `entity` (not `'*'`).\n */\n replacesSectionKey?: string;\n /**\n * Pin this contribution to a chrome bucket instead of its own rail item.\n * `'details'` — leftover own-fields group. `'more'` — overflow folder.\n */\n chromeGroup?: 'details' | 'more';\n /**\n * L1 inclusion for this contribution (same verbs as relationships).\n * `'Primary'` — own first-class rail item, in the lead band before Details.\n * `'More'` — overflow folder. `'None'` — hidden.\n * L3 `MJ: Form Chrome Rules` still wins. `chromeGroup` still merges.\n */\n inclusion?: FormInclusion;\n\n /**\n * Open a NEW (unsaved) record on this contribution instead of the first first-class group.\n *\n * A saved record opens where the user last was, or on the lead group. That is right for reading a\n * record and wrong for creating one: the lead group is usually a summary, and a summary of a record\n * with no data is a page of blanks the user has to look past to find where typing starts.\n *\n * Only consulted when the record is unsaved, so it cannot change how an existing record opens.\n * If several contributions on one entity set it, the highest ClassFactory `Priority` wins, matching\n * how every other conflict between registrations is settled.\n */\n leadsWhenUnsaved?: boolean;\n}\n\n/**\n * Abstract base for every dynamically-injectable form panel.\n *\n * Subclasses are standalone Angular components decorated with\n * `@RegisterClass(BaseFormPanel, { metadata: { entity, slot, sortKey? } })`.\n * At runtime, `<mj-form-panel-slot>` discovers matching registrations via\n * `ClassFactory.GetAllRegistrationsByMetadata`, instantiates each via\n * `ViewContainerRef.createComponent`, and wires `Record` + `FormComponent` +\n * `FormContext` into the inputs.\n *\n * Lifecycle hooks: standard Angular `ngOnInit` / `ngOnDestroy` work as usual.\n * `Record` is guaranteed to be set before the first change-detection pass.\n *\n * Optional `validate()` returns a synchronous validation result; the parent\n * `BaseFormComponent.Save()` path will surface it via the existing validation\n * pipeline when called. Panels that don't validate anything beyond what the\n * record itself does can leave this method off.\n */\n@Directive()\nexport abstract class BaseFormPanel<TRecord extends BaseEntity = BaseEntity> {\n /**\n * Slot-mounted hosts must not sit in the left-nav flex column — leftover\n * height targets `mj-collapsible-panel` as a direct child of\n * `.mj-forms-all-panels`. `display: contents` makes the inner panel that child.\n */\n @HostBinding('style.display')\n readonly HostDisplay = 'contents';\n\n /** The entity record being edited. Set by the slot host before view init. */\n @Input() Record!: TRecord;\n /** The host form component (use for EditMode, dirty notifications, etc). Set by the slot host. */\n @Input() FormComponent!: BaseFormComponent;\n /** Optional form context — same shape the collapsible-panel chrome expects. Set by the slot host. */\n @Input() FormContext?: FormContext;\n\n /**\n * Convenience getter for read-only / edit-mode rendering. Falls back to\n * `false` when the panel is shown outside a `BaseFormComponent` host (e.g.,\n * a dashboard quick-edit dialog reusing the same panel — see the\n * \"composable panel\" docs).\n */\n public get EditMode(): boolean {\n return this.FormComponent?.EditMode ?? false;\n }\n\n /**\n * Override to add per-panel validation that should block the parent form's\n * Save(). Return `{ Success: true, Errors: [] }` when valid, or include\n * `ValidationErrorInfo` entries to surface field-level errors. The default\n * implementation reports valid (panels that don't need extra validation\n * can leave this method off).\n */\n public Validate(): ValidationResult {\n // Inline construction — ValidationResult is a class in @memberjunction/core,\n // not a plain interface, so callers can construct via `new`.\n const result = new ValidationResult();\n result.Success = true;\n return result;\n }\n\n /** @deprecated Use {@link Validate}. */\n public validate(): ValidationResult {\n return this.Validate();\n }\n\n /**\n * Called after the parent form reloads the current record from the database.\n * Default is a no-op. Override to refresh panel-owned data that is not a\n * related-entity grid (those already subscribe to\n * {@link FormRecordRefreshCoordinator} themselves).\n */\n public OnRecordRefreshed(_record: TRecord): void {\n // Subclasses can override\n }\n\n /**\n * Registers a dynamic toolbar action item / button into the host form toolbar.\n */\n public RegisterToolbarItem(item: FormToolbarItemConfig): void {\n this.FormComponent?.RegisterToolbarItem(item);\n }\n\n /**\n * Unregisters a previously registered dynamic toolbar item by key.\n */\n public UnregisterToolbarItem(key: string): void {\n this.FormComponent?.UnregisterToolbarItem(key);\n }\n\n /**\n * Configures overrides for any toolbar item (standard built-in items like 'edit',\n * 'delete', 'favorite', 'history', etc., or custom items).\n */\n public ConfigureToolbarItem(key: FormToolbarItemKey, overrides: Partial<FormToolbarItemConfig>): void {\n this.FormComponent?.ConfigureToolbarItem(key, overrides);\n }\n\n /**\n * Dynamically hides a toolbar item by key.\n */\n public HideToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.HideToolbarItem(key);\n }\n\n /**\n * Dynamically shows a toolbar item by key.\n */\n public ShowToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.ShowToolbarItem(key);\n }\n\n /**\n * Dynamically disables a toolbar item by key, with an optional reason string for the tooltip.\n */\n public DisableToolbarItem(key: FormToolbarItemKey, reason?: string): void {\n this.FormComponent?.DisableToolbarItem(key, reason);\n }\n\n /**\n * Dynamically enables a toolbar item by key.\n */\n public EnableToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.EnableToolbarItem(key);\n }\n\n /**\n * Sets the numeric display order for a toolbar item.\n */\n public SetToolbarItemOrder(key: FormToolbarItemKey, order: number): void {\n this.FormComponent?.SetToolbarItemOrder(key, order);\n }\n}\n"]}
1
+ {"version":3,"file":"base-form-panel.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/base-form-panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAc,gBAAgB,EAA0C,MAAM,sBAAsB,CAAC;AAI5G,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;;AAgL1D;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,OAAgB,aAAa;IAC/B;;;;OAIG;IAEM,WAAW,GAAG,UAAU,CAAC;IAElC,6EAA6E;IACpE,MAAM,CAAW;IAC1B,kGAAkG;IACzF,aAAa,CAAqB;IAC3C,qGAAqG;IAC5F,WAAW,CAAe;IAEnC;;;;;;OAMG;IACM,oBAAoB,CAAiC;IAE9D;;;OAGG;IACI,WAAW,GAAuB,IAAI,CAAC;IAE9C;;;OAGG;IACH,IAAc,aAAa;QACvB,OAAO,IAAI,CAAC,oBA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IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,mBAAmB,CAAC,GAAuB,EAAE,KAAa;QAC7D,IAAI,CAAC,aAAa,EAAE,mBAAmB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;uGAtLiB,aAAa;6DAAb,aAAa;YAAb,0CAAa;;;iFAAb,aAAa;cADlC,SAAS;;kBAOL,WAAW;mBAAC,eAAe;;kBAI3B,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBASL,KAAK","sourcesContent":["import { Directive, HostBinding, Input } from '@angular/core';\nimport { BaseEntity, ValidationResult, type FormInclusion, type FormWhenEmpty } from '@memberjunction/core';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { FormToolbarItemConfig, FormToolbarItemKey } from '../types/form-toolbar-item';\nimport { ANCHORED_SLOTS, SlotAnchorSectionKey, SlotDisplayOrder } from './slot-order';\nimport { ReplacedSectionKeys } from './form-contribution';\n\n/**\n * Well-known slot positions where panels can be injected into a generated\n * entity form. Used as the `slot` field in a panel's registration metadata.\n *\n * Slot positions inside the form, top to bottom:\n *\n * ┌─ <mj-record-form-container>\n * │ [top-area slot] ← CodeGen-emitted; rare (entities with top-area section)\n * │ [before-fields slot] ← CodeGen-emitted; banners / warnings above field panels\n * │ <connection details>\n * │ <other generated field panels>\n * │ [after-fields slot] ← CodeGen-emitted; typed config knobs, secondary settings — most common slot\n * │ <content items grid>\n * │ <other related-entity grids>\n * │ [after-related slot] ← CodeGen-emitted; bottom-of-form addenda\n * │ [after-everything slot] ← Container-emitted; ALWAYS present (fallback target)\n * └─ </mj-record-form-container>\n *\n * Pick the slot that matches the panel's role. `after-fields` is the default\n * for most \"additional settings\" panels — it sits in the field column, before\n * the related-entity grids.\n *\n * **Fallback behavior** — see `FormSlotCoordinator`. If the registered slot is\n * missing in the current form (CodeGen hasn't been rerun against the new\n * template emitter), the panel walks forward in the chain until it finds an\n * existing slot. `after-everything` is always emitted by the container, so\n * fallback never dead-ends. Pre-CodeGen-regen forms show every panel at the\n * bottom of the form; post-regen forms show them in the preferred position.\n */\nexport type FormPanelSlot =\n | 'top-area'\n | 'before-fields'\n | 'after-fields'\n | 'after-related'\n | 'after-everything';\n\n/**\n * Shape of the `metadata` object every BaseFormPanel registration MUST attach\n * via `@RegisterClass(BaseFormPanel, { metadata: {...} })`. The\n * `<mj-form-panel-slot>` host filters registrations by matching against this\n * shape — registrations without it are silently ignored.\n *\n * - `entity` — the exact entity name (case-sensitive equality enforced by the\n * slot host), OR the wildcard `'*'` to register an\n * **entity-agnostic** panel that mounts on EVERY entity's form.\n * Wildcard panels are expected to self-hide (render nothing) when\n * they don't apply to the current record, so the cross-cutting\n * registration stays unobtrusive on forms it has no business on.\n * - `slot` — which slot the panel renders into.\n * - `sortKey`— higher = earlier within the slot. Defaults to 0 if omitted.\n * Use ranges (e.g., 100/50/10) so future panels can wedge in\n * without recomputing every neighbor's sort.\n */\nexport interface FormPanelRegistrationMetadata extends Record<string, unknown> {\n entity: string;\n slot: FormPanelSlot;\n sortKey?: number;\n /**\n * Identity for last-wins collapse. Two registrations with the same key\n * compete; highest ClassFactory `Priority` wins. Omit to derive:\n * `related:${relatedEntity}:${relatedJoinField}` when claiming a\n * relationship, otherwise the registration is unique and never collapses.\n */\n contributionKey?: string;\n /**\n * When set, this panel **replaces** the default related-entity grid for\n * that relationship on `entity`'s form. The baked CodeGen panel (if any)\n * is hidden; the stock fill-in grid is not mounted.\n */\n relatedEntity?: string;\n /**\n * Disambiguates two FKs to the same related entity (BillTo vs ShipTo).\n * Compared after stripping wrapping `[]`.\n */\n relatedJoinField?: string;\n /**\n * CodeGen `SectionKey` of a baked field (or other) panel this contribution\n * replaces — e.g. `'details'`, `'personalIdentity'`. Hidden at runtime via\n * `HiddenSectionKeys`. Use with `slot: 'before-fields'` for a form hero that\n * is not a collapsible panel. Must name a concrete `entity` (not `'*'`).\n */\n replacesSectionKey?: string;\n /**\n * Fields this contribution stands in for, all within one section. The panel renders at\n * the top of that section and the named fields are not drawn. Use instead of\n * `replacesSectionKey` when the panel replaces some inputs rather than a whole group.\n */\n replacesFieldNames?: readonly string[];\n /**\n * Sections this contribution stands in for, all within one tab. It draws in the place of the\n * first of them in the form's order, and the others are not drawn.\n */\n replacesSectionKeys?: readonly string[];\n /** A section this contribution draws inside, replacing nothing. */\n inSectionKey?: string;\n /** Where inside its section it draws, for `inSectionKey` and field claims. Absent means the start. */\n sectionPosition?: 'start' | 'end';\n /**\n * Pin this contribution to a chrome bucket instead of its own rail item.\n * `'details'` — leftover own-fields group. `'more'` — overflow folder.\n */\n chromeGroup?: 'details' | 'more';\n /**\n * L1 inclusion for this contribution (same verbs as relationships).\n * `'Primary'` — own first-class rail item, in the lead band before Details.\n * `'More'` — overflow folder. `'None'` — hidden.\n * L3 `MJ: Form Chrome Rules` still wins. `chromeGroup` still merges.\n */\n inclusion?: FormInclusion;\n\n /**\n * `'bare'` = a hero strip that draws no collapsible chrome and is never a rail item.\n * `'panel'` (default) = a normal collapsible section.\n *\n * This is how a compiled panel declares hero-ness, and it is the same field a\n * `MJ: Entity Form Contributions` row carries, so the container treats both sources\n * identically instead of guessing from a contribution key.\n */\n presentation?: 'panel' | 'bare';\n\n /**\n * Open a NEW (unsaved) record on this contribution instead of the first first-class group.\n *\n * A saved record opens where the user last was, or on the lead group. That is right for reading a\n * record and wrong for creating one: the lead group is usually a summary, and a summary of a record\n * with no data is a page of blanks the user has to look past to find where typing starts.\n *\n * Only consulted when the record is unsaved, so it cannot change how an existing record opens.\n * If several contributions on one entity set it, the highest ClassFactory `Priority` wins, matching\n * how every other conflict between registrations is settled.\n */\n leadsWhenUnsaved?: boolean;\n\n /**\n * What the form does with this contribution's section when it has 0 rows.\n * `'show'` (default) | `'hide'` | `'more'` (moved into the More folder while\n * empty). Same verbs as `EntityRelationship.Configuration.UI.whenEmpty`; omit to\n * inherit the parent entity's `UI.Form.RelatedWhenEmpty`.\n */\n whenEmpty?: FormWhenEmpty;\n /**\n * The `SectionKey` of the `<mj-collapsible-panel>` this contribution renders,\n * when it differs from {@link contributionKey} (e.g. `contributionKey: 'links'`\n * rendering `SectionKey=\"activityParticipants\"`). Counts, badges and `whenEmpty`\n * are keyed by the section the user sees. Omit when they are the same.\n */\n sectionKey?: string;\n /**\n * Prefetch this contribution's row count when the record loads and show it as\n * a badge. Omit to inherit the parent entity's `UI.Form.ShowRelatedCounts`\n * (default `true`).\n */\n showCount?: boolean;\n /**\n * What to count for this contribution. Omit to derive it from\n * {@link relatedEntity} / {@link relatedJoinField}. `false` disables the\n * prefetch. A contribution with no count source can still report its own\n * count after it mounts via `FormComponent.SetSectionRowCount(key, n)`.\n */\n count?: FormContributionCountSpec | false;\n}\n\n/** The related rows a contribution's badge / empty check counts. */\nexport interface FormContributionCountSpec {\n /** Entity to count (e.g. `'MJ_BizApps_Orders: Order Headers'`). */\n entity: string;\n /**\n * FK field(s) on {@link entity} that point at the parent record. Several\n * fields are ORed (Bill-To OR Ship-To). Omit when the entity has exactly one\n * relationship to the parent.\n */\n joinFields?: string[];\n}\n\n/**\n * Abstract base for every dynamically-injectable form panel.\n *\n * Subclasses are standalone Angular components decorated with\n * `@RegisterClass(BaseFormPanel, { metadata: { entity, slot, sortKey? } })`.\n * At runtime, `<mj-form-panel-slot>` discovers matching registrations via\n * `ClassFactory.GetAllRegistrationsByMetadata`, instantiates each via\n * `ViewContainerRef.createComponent`, and wires `Record` + `FormComponent` +\n * `FormContext` into the inputs.\n *\n * Lifecycle hooks: standard Angular `ngOnInit` / `ngOnDestroy` work as usual.\n * `Record` is guaranteed to be set before the first change-detection pass.\n *\n * Optional `Validate()` returns a validation result, or a Promise of one.\n * `BaseFormComponent.SaveRecord()` awaits every mounted panel's result and refuses the\n * save when one fails. Panels that don't validate anything beyond what the\n * record itself does can leave this method off.\n */\n@Directive()\nexport abstract class BaseFormPanel<TRecord extends BaseEntity = BaseEntity> {\n /**\n * Slot-mounted hosts must not sit in the left-nav flex column — leftover\n * height targets `mj-collapsible-panel` as a direct child of\n * `.mj-forms-all-panels`. `display: contents` makes the inner panel that child.\n */\n @HostBinding('style.display')\n readonly HostDisplay = 'contents';\n\n /** The entity record being edited. Set by the slot host before view init. */\n @Input() Record!: TRecord;\n /** The host form component (use for EditMode, dirty notifications, etc). Set by the slot host. */\n @Input() FormComponent!: BaseFormComponent;\n /** Optional form context — same shape the collapsible-panel chrome expects. Set by the slot host. */\n @Input() FormContext?: FormContext;\n\n /**\n * The registration this panel was mounted from. Set by the slot host.\n *\n * A panel reads its own slot from here, which is the only way it can know where in the\n * form it was asked to sit: the class registration is looked up by the host, not by the\n * panel, so nothing else on the instance carries it.\n */\n @Input() RegistrationMetadata?: FormPanelRegistrationMetadata;\n\n /**\n * The slot element the panel was mounted in, set by the slot host. It is where the panel is\n * on the page, which {@link DisplayOrder} reads its neighbours from.\n */\n public SlotElement: HTMLElement | null = null;\n\n /**\n * The registration a subclass answers from. Overridden where the panel holds its\n * registration somewhere other than {@link RegistrationMetadata}.\n */\n protected get PanelMetadata(): FormPanelRegistrationMetadata | undefined {\n return this.RegistrationMetadata;\n }\n\n /**\n * Flex order for the panel's own `mj-collapsible-panel`, to pass as `[Order]`.\n *\n * A panel's section key is not in the form's section order, so without this the form\n * falls back to the section count and draws every panel at the bottom whatever slot it\n * asked for. A panel standing in for a section takes that section's place instead, so\n * replacing something does not also move it.\n *\n * A slot between the form's blocks takes the order of the section beside it on the page,\n * so the panel draws where the slot is (see {@link SlotAnchorSectionKey}). The very top and\n * the very bottom keep fixed bands: the bottom has to stay below the More folder.\n */\n public get DisplayOrder(): number {\n const metadata = this.PanelMetadata;\n // Standing in for several sections, it takes the place of whichever comes first.\n const places = ReplacedSectionKeys(metadata)\n .map((key) => this.FormComponent?.getSectionOrderIndex?.(key))\n .filter((index): index is number => index != null);\n if (places.length > 0) return Math.min(...places);\n return this.anchoredOrder() ?? SlotDisplayOrder(metadata?.slot ?? 'after-everything', metadata?.sortKey ?? 0);\n }\n\n /** The order of the section beside the slot this panel is in, or null when there is none to read. */\n private anchoredOrder(): number | null {\n const slot = this.SlotElement?.getAttribute('data-form-slot') as FormPanelSlot | null | undefined;\n if (!slot || !ANCHORED_SLOTS.has(slot) || !this.FormComponent?.getSectionDisplayOrder) return null;\n const anchor = SlotAnchorSectionKey(this.SlotElement!);\n return anchor ? this.FormComponent.getSectionDisplayOrder(anchor.Key) : null;\n }\n\n /**\n * Convenience getter for read-only / edit-mode rendering. Falls back to\n * `false` when the panel is shown outside a `BaseFormComponent` host (e.g.,\n * a dashboard quick-edit dialog reusing the same panel — see the\n * \"composable panel\" docs).\n */\n public get EditMode(): boolean {\n return this.FormComponent?.EditMode ?? false;\n }\n\n /**\n * Override to add per-panel validation that should block the parent form's\n * `SaveRecord()`. Return `{ Success: true, Errors: [] }` when valid, or include\n * `ValidationErrorInfo` entries to surface field-level errors. The default\n * implementation reports valid (panels that don't need extra validation\n * can leave this method off).\n *\n * May return a Promise: a panel that validates against the server has no\n * synchronous answer. `BaseFormComponent.ValidateAsync()` awaits it, which is\n * what `SaveRecord()` calls.\n */\n public Validate(): ValidationResult | Promise<ValidationResult> {\n // Inline construction — ValidationResult is a class in @memberjunction/core,\n // not a plain interface, so callers can construct via `new`.\n const result = new ValidationResult();\n result.Success = true;\n return result;\n }\n\n /** @deprecated Use {@link Validate}. */\n public validate(): ValidationResult | Promise<ValidationResult> {\n return this.Validate();\n }\n\n /**\n * The panel's validity as already known, with no awaiting and no work.\n *\n * Synchronous callers (`BaseFormComponent.Validate()`) use this; it reports valid\n * unless the panel has cached a failing result from an earlier validation. A panel\n * whose `Validate()` is asynchronous should override this to return its last\n * reported state so synchronous callers are not simply blind to it.\n */\n public LastKnownValidation(): ValidationResult {\n const result = new ValidationResult();\n result.Success = true;\n return result;\n }\n\n /**\n * Called after the parent form reloads the current record from the database.\n * Default is a no-op. Override to refresh panel-owned data that is not a\n * related-entity grid (those already subscribe to\n * {@link FormRecordRefreshCoordinator} themselves).\n */\n public OnRecordRefreshed(_record: TRecord): void {\n // Subclasses can override\n }\n\n /**\n * Registers a dynamic toolbar action item / button into the host form toolbar.\n */\n public RegisterToolbarItem(item: FormToolbarItemConfig): void {\n this.FormComponent?.RegisterToolbarItem(item);\n }\n\n /**\n * Unregisters a previously registered dynamic toolbar item by key.\n */\n public UnregisterToolbarItem(key: string): void {\n this.FormComponent?.UnregisterToolbarItem(key);\n }\n\n /**\n * Configures overrides for any toolbar item (standard built-in items like 'edit',\n * 'delete', 'favorite', 'history', etc., or custom items).\n */\n public ConfigureToolbarItem(key: FormToolbarItemKey, overrides: Partial<FormToolbarItemConfig>): void {\n this.FormComponent?.ConfigureToolbarItem(key, overrides);\n }\n\n /**\n * Dynamically hides a toolbar item by key.\n */\n public HideToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.HideToolbarItem(key);\n }\n\n /**\n * Dynamically shows a toolbar item by key.\n */\n public ShowToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.ShowToolbarItem(key);\n }\n\n /**\n * Dynamically disables a toolbar item by key, with an optional reason string for the tooltip.\n */\n public DisableToolbarItem(key: FormToolbarItemKey, reason?: string): void {\n this.FormComponent?.DisableToolbarItem(key, reason);\n }\n\n /**\n * Dynamically enables a toolbar item by key.\n */\n public EnableToolbarItem(key: FormToolbarItemKey): void {\n this.FormComponent?.EnableToolbarItem(key);\n }\n\n /**\n * Sets the numeric display order for a toolbar item.\n */\n public SetToolbarItemOrder(key: FormToolbarItemKey, order: number): void {\n this.FormComponent?.SetToolbarItemOrder(key, order);\n }\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import { type EntityInfo, type IMetadataProvider } from '@memberjunction/core';
2
+ import { type MJEntityFormContributionEntity } from '@memberjunction/core-entities';
3
+ import { type FormContributionRegistration } from './form-contribution';
4
+ import { type FormPlacementPreview } from './placement-preview';
5
+ /** Test seam and escape hatch — drops every memoized list and every remembered hide list. */
6
+ export declare function InvalidateFormContributionRegistrationCache(): void;
7
+ /** Compiled `BaseFormPanel` registrations that declare an `entity`. */
8
+ export declare function CollectClassFormPanelRegistrations(): FormContributionRegistration[];
9
+ /** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */
10
+ export declare function MetadataContributionToRegistration(row: MJEntityFormContributionEntity): FormContributionRegistration;
11
+ export interface CollectFormContributionOptions {
12
+ /**
13
+ * Include the panels this user has hidden. Only the drawer wants these, to list them under
14
+ * "Hidden by you" so a hide can be undone; everything that draws the form leaves it false.
15
+ */
16
+ IncludeHidden?: boolean;
17
+ /**
18
+ * The placement dialog's unsaved panel, added to the list. Passed only by a form the
19
+ * dialog renders as its preview.
20
+ */
21
+ Preview?: FormPlacementPreview | null;
22
+ }
23
+ /**
24
+ * Class registrations plus the rows that apply to (entity, current user).
25
+ * Falls back to class-only when there is no entity or provider (standalone
26
+ * panel composition outside a form).
27
+ */
28
+ export declare function CollectFormContributionRegistrations(entity: EntityInfo | null | undefined, provider: IMetadataProvider | null | undefined, options?: CollectFormContributionOptions): FormContributionRegistration[];
29
+ //# sourceMappingURL=collect-form-contribution-registrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-form-contribution-registrations.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-contribution-registrations.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAA4E,KAAK,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAI9J,OAAO,EAAkC,KAAK,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExG,OAAO,EAAwB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AA6DtF,6FAA6F;AAC7F,wBAAgB,2CAA2C,IAAI,IAAI,CAOlE;AAiBD,uEAAuE;AACvE,wBAAgB,kCAAkC,IAAI,4BAA4B,EAAE,CAcnF;AAED,iHAAiH;AACjH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,8BAA8B,GAAG,4BAA4B,CAOpH;AA2BD,MAAM,WAAW,8BAA8B;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAChD,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACrC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,EAC9C,OAAO,CAAC,EAAE,8BAA8B,GACzC,4BAA4B,EAAE,CAGhC"}
@@ -0,0 +1,214 @@
1
+ // packages/Angular/Generic/base-forms/src/lib/panel-slot/collect-form-contribution-registrations.ts
2
+ import { LogError } from '@memberjunction/core';
3
+ import { InteractiveFormsEngine, ParseClaimedFieldNames, ParseHiddenFormPanelKeys } from '@memberjunction/core-entities';
4
+ import { MJGlobal, SafeJSONParse } from '@memberjunction/global';
5
+ import { BaseFormPanel } from './base-form-panel';
6
+ import { ContributionSpecToRegistration } from './form-contribution';
7
+ import { ForgetHiddenPanelsSettings, HiddenPanelsSetting, WithoutHiddenPanels } from './panel-hides';
8
+ import { WithPlacementPreview } from './placement-preview';
9
+ /**
10
+ * One list of form contributions from two sources:
11
+ * - compiled `BaseFormPanel` registrations in the ClassFactory (`Source: 'class'`)
12
+ * - Active, scope-matching `MJ: Entity Form Contributions` rows (`Source: 'metadata'`)
13
+ *
14
+ * Rows come from the `InteractiveFormsEngine` singleton, which holds the rows of the
15
+ * provider that loaded it.
16
+ *
17
+ * Memoized per (provider, entity, user). The memo key also folds in the ClassFactory
18
+ * registration count (lazy-loaded OpenApp modules register late) and an engine
19
+ * version that bumps on every `Contributions$` emission. The whole-form host
20
+ * awaits the resolver — which Configs the engine — before the form mounts, so
21
+ * slots normally see rows on first render; when the engine is cold this kicks a
22
+ * `Config` and returns class registrations, and the emission re-fills the memo.
23
+ */
24
+ const MAX_CACHE_ENTRIES = 16;
25
+ const cache = new Map();
26
+ let engineVersion = 0;
27
+ let engineSubscribed = false;
28
+ function ensureEngineSubscription() {
29
+ if (engineSubscribed)
30
+ return;
31
+ engineSubscribed = true;
32
+ try {
33
+ InteractiveFormsEngine.Instance.Contributions$.subscribe(() => {
34
+ engineVersion++;
35
+ cache.clear();
36
+ });
37
+ }
38
+ catch (err) {
39
+ engineSubscribed = false;
40
+ LogError(`CollectFormContributionRegistrations: could not subscribe to Contributions$: ${err instanceof Error ? err.message : String(err)}`);
41
+ }
42
+ }
43
+ /**
44
+ * Registration count, probed at most once per interval.
45
+ *
46
+ * The count is the memo's invalidation signal for lazily-registered panels, but
47
+ * `GetAllRegistrations` filters every registration in the process (~2,000 in Explorer) and
48
+ * allocates an array. This function sits on the hottest path in the form runtime —
49
+ * `BaseFormComponent.formContext` is a getter bound in dozens of places per form and
50
+ * re-evaluated on every change-detection pass — so probing per call is not affordable.
51
+ * A lazily-loaded module's panels therefore appear within one interval rather than instantly,
52
+ * which is the right trade: module loads are rare, change detection is not.
53
+ */
54
+ const CLASS_COUNT_PROBE_INTERVAL_MS = 1000;
55
+ let lastClassCount = -1;
56
+ let lastClassCountAt = 0;
57
+ function currentClassCount() {
58
+ const now = Date.now();
59
+ if (lastClassCount < 0 || now - lastClassCountAt >= CLASS_COUNT_PROBE_INTERVAL_MS) {
60
+ lastClassCount = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormPanel).length;
61
+ lastClassCountAt = now;
62
+ }
63
+ return lastClassCount;
64
+ }
65
+ /** Test seam and escape hatch — drops every memoized list and every remembered hide list. */
66
+ export function InvalidateFormContributionRegistrationCache() {
67
+ cache.clear();
68
+ ForgetHiddenPanelsSettings();
69
+ lastClassCount = -1;
70
+ lastClassCountAt = 0;
71
+ providerKeys = new WeakMap();
72
+ nextProviderKey = 0;
73
+ }
74
+ /**
75
+ * Stable per-instance identity for a provider, without assuming it exposes a name
76
+ * or an ID. A WeakMap keeps this from pinning providers in memory.
77
+ */
78
+ let providerKeys = new WeakMap();
79
+ let nextProviderKey = 0;
80
+ function ProviderCacheKey(provider) {
81
+ let k = providerKeys.get(provider);
82
+ if (!k) {
83
+ k = `p${++nextProviderKey}`;
84
+ providerKeys.set(provider, k);
85
+ }
86
+ return k;
87
+ }
88
+ /** Compiled `BaseFormPanel` registrations that declare an `entity`. */
89
+ export function CollectClassFormPanelRegistrations() {
90
+ return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, (metadata) => {
91
+ if (!metadata)
92
+ return false;
93
+ const entity = metadata.entity;
94
+ return typeof entity === 'string' && entity.length > 0;
95
+ }).map((reg) => ({
96
+ Priority: reg.Priority,
97
+ Metadata: reg.Metadata,
98
+ Source: 'class',
99
+ Registration: reg,
100
+ }));
101
+ }
102
+ /** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */
103
+ export function MetadataContributionToRegistration(row) {
104
+ return {
105
+ ...ContributionSpecToRegistration(row.Entity, contributionRowSpec(row), row.ComponentID),
106
+ Priority: row.Precedence ?? 0,
107
+ RowID: row.ID,
108
+ Scope: row.Scope,
109
+ };
110
+ }
111
+ /** The spec a stored row holds. */
112
+ function contributionRowSpec(row) {
113
+ const spec = {
114
+ slot: row.Slot,
115
+ sortKey: row.SortKey ?? 0,
116
+ presentation: row.Presentation,
117
+ title: row.Title ?? row.Name,
118
+ configuration: SafeJSONParse(row.Configuration ?? '', false) ?? {},
119
+ };
120
+ if (row.Icon)
121
+ spec.icon = row.Icon;
122
+ if (row.ContributionKey)
123
+ spec.contributionKey = row.ContributionKey;
124
+ if (row.RelatedEntity)
125
+ spec.relatedEntity = row.RelatedEntity;
126
+ if (row.RelatedJoinField)
127
+ spec.relatedJoinField = row.RelatedJoinField;
128
+ if (row.ReplacesSectionKey)
129
+ spec.replacesSectionKey = row.ReplacesSectionKey;
130
+ const claimedFields = ParseClaimedFieldNames(row.ReplacesFieldNames);
131
+ if (claimedFields.length > 0)
132
+ spec.replacesFieldNames = claimedFields;
133
+ const claimedSections = ParseClaimedFieldNames(row.ReplacesSectionKeys);
134
+ if (claimedSections.length > 0)
135
+ spec.replacesSectionKeys = claimedSections;
136
+ if (row.InSectionKey)
137
+ spec.inSectionKey = row.InSectionKey;
138
+ if (row.SectionPosition)
139
+ spec.sectionPosition = row.SectionPosition;
140
+ if (row.Inclusion)
141
+ spec.inclusion = row.Inclusion;
142
+ if (row.ChromeGroup)
143
+ spec.chromeGroup = row.ChromeGroup;
144
+ return spec;
145
+ }
146
+ /**
147
+ * Class registrations plus the rows that apply to (entity, current user).
148
+ * Falls back to class-only when there is no entity or provider (standalone
149
+ * panel composition outside a form).
150
+ */
151
+ export function CollectFormContributionRegistrations(entity, provider, options) {
152
+ if (!entity || !provider)
153
+ return CollectClassFormPanelRegistrations();
154
+ return WithPlacementPreview(collectFromSources(entity, provider, options), options?.Preview);
155
+ }
156
+ /** Class registrations plus applicable rows, memoized. Everything but the preview. */
157
+ function collectFromSources(entity, provider, options) {
158
+ ensureEngineSubscription();
159
+ const user = provider.CurrentUser;
160
+ const userID = user?.ID ?? '';
161
+ const roleIDs = (user?.UserRoles ?? []).map((r) => r.RoleID).filter((id) => !!id);
162
+ const classCount = currentClassCount();
163
+ // The provider is part of the key. Every provider reads rows from the one engine
164
+ // instance, but each has its own entity metadata and current user, so one provider's
165
+ // list is never served to another.
166
+ // The user's hidden panels are part of the identity too, so hiding one repaints at once
167
+ // rather than waiting for an unrelated change to clear the memo. The setting itself is
168
+ // remembered until the user's settings change (HiddenPanelsSetting), so this costs no scan.
169
+ const includeHidden = options?.IncludeHidden === true;
170
+ const hiddenSetting = includeHidden ? '' : HiddenPanelsSetting(entity.Name);
171
+ const key = `${ProviderCacheKey(provider)}::${entity.Name}::${userID}::${classCount}::${engineVersion}` +
172
+ `::${includeHidden ? 'all' : hiddenSetting}`;
173
+ const hit = cache.get(key);
174
+ if (hit)
175
+ return hit;
176
+ // Only past the cache: `GetAllRegistrationsByMetadata` filters every registration in the
177
+ // process and runs a predicate on each. `BaseFormComponent.formContext` calls this getter
178
+ // on every change-detection pass, so paying that scan per pass is precisely the cost this
179
+ // memo exists to remove — it has to sit behind the cache, not in front of it.
180
+ const classRegs = CollectClassFormPanelRegistrations();
181
+ let rows = [];
182
+ try {
183
+ const engine = InteractiveFormsEngine.Instance;
184
+ if (engine.IsPermissionConstrained) {
185
+ // Expected on deployments where this role has no read on the new entity.
186
+ // Not an error — the idiom used by FormResolverService and ApplicationManager.
187
+ rows = [];
188
+ }
189
+ else if (engine.Loaded) {
190
+ rows = engine.GetApplicableContributions(entity.ID, userID, roleIDs);
191
+ }
192
+ else {
193
+ // Kick the load; the Contributions$ subscription above refills the memo when it
194
+ // lands. `.catch` is load-bearing: a rejected Config here would otherwise surface
195
+ // as an unhandled rejection on every entity whose form is opened.
196
+ void engine.Config(false, user ?? undefined, provider).catch((err) => {
197
+ LogError(`CollectFormContributionRegistrations: engine Config failed: ${err instanceof Error ? err.message : String(err)}`);
198
+ });
199
+ }
200
+ }
201
+ catch (err) {
202
+ LogError(`CollectFormContributionRegistrations: engine read failed for ${entity.Name}: ${err instanceof Error ? err.message : String(err)}`);
203
+ }
204
+ const all = [...classRegs, ...rows.map(MetadataContributionToRegistration)];
205
+ const merged = includeHidden ? all : WithoutHiddenPanels(all, ParseHiddenFormPanelKeys(hiddenSetting));
206
+ if (cache.size >= MAX_CACHE_ENTRIES) {
207
+ const oldest = cache.keys().next().value;
208
+ if (oldest !== undefined)
209
+ cache.delete(oldest);
210
+ }
211
+ cache.set(key, merged);
212
+ return merged;
213
+ }
214
+ //# sourceMappingURL=collect-form-contribution-registrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collect-form-contribution-registrations.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-contribution-registrations.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAE,QAAQ,EAA2C,MAAM,sBAAsB,CAAC;AACzF,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AK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["// packages/Angular/Generic/base-forms/src/lib/panel-slot/collect-form-contribution-registrations.ts\nimport { LogError, type EntityInfo, type IMetadataProvider } from '@memberjunction/core';\nimport { InteractiveFormsEngine, ParseClaimedFieldNames, ParseHiddenFormPanelKeys, type MJEntityFormContributionEntity } from '@memberjunction/core-entities';\nimport { MJGlobal, SafeJSONParse } from '@memberjunction/global';\nimport type { FormContributionSpec } from '@memberjunction/interactive-component-types/forms';\nimport { BaseFormPanel, type FormPanelRegistrationMetadata } from './base-form-panel';\nimport { ContributionSpecToRegistration, type FormContributionRegistration } from './form-contribution';\nimport { ForgetHiddenPanelsSettings, HiddenPanelsSetting, WithoutHiddenPanels } from './panel-hides';\nimport { WithPlacementPreview, type FormPlacementPreview } from './placement-preview';\n\n/**\n * One list of form contributions from two sources:\n * - compiled `BaseFormPanel` registrations in the ClassFactory (`Source: 'class'`)\n * - Active, scope-matching `MJ: Entity Form Contributions` rows (`Source: 'metadata'`)\n *\n * Rows come from the `InteractiveFormsEngine` singleton, which holds the rows of the\n * provider that loaded it.\n *\n * Memoized per (provider, entity, user). The memo key also folds in the ClassFactory\n * registration count (lazy-loaded OpenApp modules register late) and an engine\n * version that bumps on every `Contributions$` emission. The whole-form host\n * awaits the resolver — which Configs the engine — before the form mounts, so\n * slots normally see rows on first render; when the engine is cold this kicks a\n * `Config` and returns class registrations, and the emission re-fills the memo.\n */\n\nconst MAX_CACHE_ENTRIES = 16;\nconst cache = new Map<string, FormContributionRegistration[]>();\nlet engineVersion = 0;\nlet engineSubscribed = false;\n\nfunction ensureEngineSubscription(): void {\n if (engineSubscribed) return;\n engineSubscribed = true;\n try {\n InteractiveFormsEngine.Instance.Contributions$.subscribe(() => {\n engineVersion++;\n cache.clear();\n });\n } catch (err) {\n engineSubscribed = false;\n LogError(`CollectFormContributionRegistrations: could not subscribe to Contributions$: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n\n/**\n * Registration count, probed at most once per interval.\n *\n * The count is the memo's invalidation signal for lazily-registered panels, but\n * `GetAllRegistrations` filters every registration in the process (~2,000 in Explorer) and\n * allocates an array. This function sits on the hottest path in the form runtime —\n * `BaseFormComponent.formContext` is a getter bound in dozens of places per form and\n * re-evaluated on every change-detection pass — so probing per call is not affordable.\n * A lazily-loaded module's panels therefore appear within one interval rather than instantly,\n * which is the right trade: module loads are rare, change detection is not.\n */\nconst CLASS_COUNT_PROBE_INTERVAL_MS = 1000;\nlet lastClassCount = -1;\nlet lastClassCountAt = 0;\n\nfunction currentClassCount(): number {\n const now = Date.now();\n if (lastClassCount < 0 || now - lastClassCountAt >= CLASS_COUNT_PROBE_INTERVAL_MS) {\n lastClassCount = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormPanel).length;\n lastClassCountAt = now;\n }\n return lastClassCount;\n}\n\n/** Test seam and escape hatch — drops every memoized list and every remembered hide list. */\nexport function InvalidateFormContributionRegistrationCache(): void {\n cache.clear();\n ForgetHiddenPanelsSettings();\n lastClassCount = -1;\n lastClassCountAt = 0;\n providerKeys = new WeakMap<IMetadataProvider, string>();\n nextProviderKey = 0;\n}\n\n/**\n * Stable per-instance identity for a provider, without assuming it exposes a name\n * or an ID. A WeakMap keeps this from pinning providers in memory.\n */\nlet providerKeys = new WeakMap<IMetadataProvider, string>();\nlet nextProviderKey = 0;\nfunction ProviderCacheKey(provider: IMetadataProvider): string {\n let k = providerKeys.get(provider);\n if (!k) {\n k = `p${++nextProviderKey}`;\n providerKeys.set(provider, k);\n }\n return k;\n}\n\n/** Compiled `BaseFormPanel` registrations that declare an `entity`. */\nexport function CollectClassFormPanelRegistrations(): FormContributionRegistration[] {\n return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as Partial<FormPanelRegistrationMetadata>).entity;\n return typeof entity === 'string' && entity.length > 0;\n },\n ).map((reg) => ({\n Priority: reg.Priority,\n Metadata: reg.Metadata as FormPanelRegistrationMetadata,\n Source: 'class' as const,\n Registration: reg,\n }));\n}\n\n/** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */\nexport function MetadataContributionToRegistration(row: MJEntityFormContributionEntity): FormContributionRegistration {\n return {\n ...ContributionSpecToRegistration(row.Entity, contributionRowSpec(row), row.ComponentID),\n Priority: row.Precedence ?? 0,\n RowID: row.ID,\n Scope: row.Scope,\n };\n}\n\n/** The spec a stored row holds. */\nfunction contributionRowSpec(row: MJEntityFormContributionEntity): FormContributionSpec {\n const spec: FormContributionSpec = {\n slot: row.Slot,\n sortKey: row.SortKey ?? 0,\n presentation: row.Presentation,\n title: row.Title ?? row.Name,\n configuration: SafeJSONParse<Record<string, unknown>>(row.Configuration ?? '', false) ?? {},\n };\n if (row.Icon) spec.icon = row.Icon;\n if (row.ContributionKey) spec.contributionKey = row.ContributionKey;\n if (row.RelatedEntity) spec.relatedEntity = row.RelatedEntity;\n if (row.RelatedJoinField) spec.relatedJoinField = row.RelatedJoinField;\n if (row.ReplacesSectionKey) spec.replacesSectionKey = row.ReplacesSectionKey;\n const claimedFields = ParseClaimedFieldNames(row.ReplacesFieldNames);\n if (claimedFields.length > 0) spec.replacesFieldNames = claimedFields;\n const claimedSections = ParseClaimedFieldNames(row.ReplacesSectionKeys);\n if (claimedSections.length > 0) spec.replacesSectionKeys = claimedSections;\n if (row.InSectionKey) spec.inSectionKey = row.InSectionKey;\n if (row.SectionPosition) spec.sectionPosition = row.SectionPosition;\n if (row.Inclusion) spec.inclusion = row.Inclusion;\n if (row.ChromeGroup) spec.chromeGroup = row.ChromeGroup;\n return spec;\n}\n\nexport interface CollectFormContributionOptions {\n /**\n * Include the panels this user has hidden. Only the drawer wants these, to list them under\n * \"Hidden by you\" so a hide can be undone; everything that draws the form leaves it false.\n */\n IncludeHidden?: boolean;\n\n /**\n * The placement dialog's unsaved panel, added to the list. Passed only by a form the\n * dialog renders as its preview.\n */\n Preview?: FormPlacementPreview | null;\n}\n\n/**\n * Class registrations plus the rows that apply to (entity, current user).\n * Falls back to class-only when there is no entity or provider (standalone\n * panel composition outside a form).\n */\nexport function CollectFormContributionRegistrations(\n entity: EntityInfo | null | undefined,\n provider: IMetadataProvider | null | undefined,\n options?: CollectFormContributionOptions,\n): FormContributionRegistration[] {\n if (!entity || !provider) return CollectClassFormPanelRegistrations();\n return WithPlacementPreview(collectFromSources(entity, provider, options), options?.Preview);\n}\n\n/** Class registrations plus applicable rows, memoized. Everything but the preview. */\nfunction collectFromSources(\n entity: EntityInfo,\n provider: IMetadataProvider,\n options: CollectFormContributionOptions | undefined,\n): FormContributionRegistration[] {\n ensureEngineSubscription();\n const user = provider.CurrentUser;\n const userID = user?.ID ?? '';\n const roleIDs = (user?.UserRoles ?? []).map((r) => r.RoleID).filter((id): id is string => !!id);\n const classCount = currentClassCount();\n // The provider is part of the key. Every provider reads rows from the one engine\n // instance, but each has its own entity metadata and current user, so one provider's\n // list is never served to another.\n // The user's hidden panels are part of the identity too, so hiding one repaints at once\n // rather than waiting for an unrelated change to clear the memo. The setting itself is\n // remembered until the user's settings change (HiddenPanelsSetting), so this costs no scan.\n const includeHidden = options?.IncludeHidden === true;\n const hiddenSetting = includeHidden ? '' : HiddenPanelsSetting(entity.Name);\n const key = `${ProviderCacheKey(provider)}::${entity.Name}::${userID}::${classCount}::${engineVersion}` +\n `::${includeHidden ? 'all' : hiddenSetting}`;\n const hit = cache.get(key);\n if (hit) return hit;\n\n // Only past the cache: `GetAllRegistrationsByMetadata` filters every registration in the\n // process and runs a predicate on each. `BaseFormComponent.formContext` calls this getter\n // on every change-detection pass, so paying that scan per pass is precisely the cost this\n // memo exists to remove — it has to sit behind the cache, not in front of it.\n const classRegs = CollectClassFormPanelRegistrations();\n\n let rows: MJEntityFormContributionEntity[] = [];\n try {\n const engine = InteractiveFormsEngine.Instance;\n if (engine.IsPermissionConstrained) {\n // Expected on deployments where this role has no read on the new entity.\n // Not an error — the idiom used by FormResolverService and ApplicationManager.\n rows = [];\n } else if (engine.Loaded) {\n rows = engine.GetApplicableContributions(entity.ID, userID, roleIDs);\n } else {\n // Kick the load; the Contributions$ subscription above refills the memo when it\n // lands. `.catch` is load-bearing: a rejected Config here would otherwise surface\n // as an unhandled rejection on every entity whose form is opened.\n void engine.Config(false, user ?? undefined, provider).catch((err: unknown) => {\n LogError(`CollectFormContributionRegistrations: engine Config failed: ${err instanceof Error ? err.message : String(err)}`);\n });\n }\n } catch (err) {\n LogError(`CollectFormContributionRegistrations: engine read failed for ${entity.Name}: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const all = [...classRegs, ...rows.map(MetadataContributionToRegistration)];\n const merged = includeHidden ? all : WithoutHiddenPanels(all, ParseHiddenFormPanelKeys(hiddenSetting));\n if (cache.size >= MAX_CACHE_ENTRIES) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(key, merged);\n return merged;\n}\n"]}
@@ -1,8 +1,11 @@
1
1
  import type { FormContributionRegistration } from './form-contribution';
2
2
  /**
3
- * Every BaseFormPanel registration that carries an `entity` metadata field.
4
- * Used by the composer and by `BaseFormComponent.formContext` to hide baked
5
- * related sections a panel has claimed.
3
+ * Every compiled BaseFormPanel registration that carries an `entity` metadata field. Compiled
4
+ * registrations only: no `MJ: Entity Form Contributions` rows, and the user's hidden panels are
5
+ * not removed.
6
+ *
7
+ * @deprecated Use `CollectFormContributionRegistrations(entity, provider)`, which returns the
8
+ * compiled registrations together with the rows that apply to the entity and the current user.
6
9
  */
7
10
  export declare function CollectFormPanelRegistrations(): FormContributionRegistration[];
8
11
  //# sourceMappingURL=collect-form-panel-registrations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect-form-panel-registrations.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-panel-registrations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,4BAA4B,EAAE,CAY9E"}
1
+ {"version":3,"file":"collect-form-panel-registrations.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-panel-registrations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxE;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,IAAI,4BAA4B,EAAE,CAE9E"}
@@ -1,19 +1,13 @@
1
- import { MJGlobal } from '@memberjunction/global';
2
- import { BaseFormPanel } from './base-form-panel';
1
+ import { CollectClassFormPanelRegistrations } from './collect-form-contribution-registrations';
3
2
  /**
4
- * Every BaseFormPanel registration that carries an `entity` metadata field.
5
- * Used by the composer and by `BaseFormComponent.formContext` to hide baked
6
- * related sections a panel has claimed.
3
+ * Every compiled BaseFormPanel registration that carries an `entity` metadata field. Compiled
4
+ * registrations only: no `MJ: Entity Form Contributions` rows, and the user's hidden panels are
5
+ * not removed.
6
+ *
7
+ * @deprecated Use `CollectFormContributionRegistrations(entity, provider)`, which returns the
8
+ * compiled registrations together with the rows that apply to the entity and the current user.
7
9
  */
8
10
  export function CollectFormPanelRegistrations() {
9
- return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, (metadata) => {
10
- if (!metadata)
11
- return false;
12
- const entity = metadata.entity;
13
- return typeof entity === 'string' && entity.length > 0;
14
- }).map((reg) => ({
15
- Priority: reg.Priority,
16
- Metadata: reg.Metadata,
17
- }));
11
+ return CollectClassFormPanelRegistrations();
18
12
  }
19
13
  //# sourceMappingURL=collect-form-panel-registrations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collect-form-panel-registrations.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-panel-registrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAiC,MAAM,mBAAmB,CAAC;AAGjF;;;;GAIG;AACH,MAAM,UAAU,6BAA6B;IACzC,OAAO,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,6BAA6B,CAC/D,aAAa,EACb,CAAC,QAAQ,EAAE,EAAE;QACT,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5B,MAAM,MAAM,GAAI,QAAmD,CAAC,MAAM,CAAC;QAC3E,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3D,CAAC,CACJ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACZ,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,QAAQ,EAAE,GAAG,CAAC,QAAyC;KAC1D,CAAC,CAAC,CAAC;AACR,CAAC","sourcesContent":["import { MJGlobal } from '@memberjunction/global';\nimport { BaseFormPanel, FormPanelRegistrationMetadata } from './base-form-panel';\nimport type { FormContributionRegistration } from './form-contribution';\n\n/**\n * Every BaseFormPanel registration that carries an `entity` metadata field.\n * Used by the composer and by `BaseFormComponent.formContext` to hide baked\n * related sections a panel has claimed.\n */\nexport function CollectFormPanelRegistrations(): FormContributionRegistration[] {\n return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as Partial<FormPanelRegistrationMetadata>).entity;\n return typeof entity === 'string' && entity.length > 0;\n },\n ).map((reg) => ({\n Priority: reg.Priority,\n Metadata: reg.Metadata as FormPanelRegistrationMetadata,\n }));\n}\n"]}
1
+ {"version":3,"file":"collect-form-panel-registrations.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-panel-registrations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAE/F;;;;;;;GAOG;AACH,MAAM,UAAU,6BAA6B;IACzC,OAAO,kCAAkC,EAAE,CAAC;AAChD,CAAC","sourcesContent":["import type { FormContributionRegistration } from './form-contribution';\nimport { CollectClassFormPanelRegistrations } from './collect-form-contribution-registrations';\n\n/**\n * Every compiled BaseFormPanel registration that carries an `entity` metadata field. Compiled\n * registrations only: no `MJ: Entity Form Contributions` rows, and the user's hidden panels are\n * not removed.\n *\n * @deprecated Use `CollectFormContributionRegistrations(entity, provider)`, which returns the\n * compiled registrations together with the rows that apply to the entity and the current user.\n */\nexport function CollectFormPanelRegistrations(): FormContributionRegistration[] {\n return CollectClassFormPanelRegistrations();\n}\n"]}