@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-field-panel-slot.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-field-panel-slot.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAET,KAAK,EAKL,SAAS,EACT,gBAAgB,EAChB,MAAM,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,OAAO,EACH,2BAA2B,EAC3B,kBAAkB,EAClB,8BAA8B,GAEjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;;;AAEtE;;;;;;;;;;;;;;GAcG;AAOH,MAAM,OAAO,2BAA2B;IACpC,oCAAoC;IAC3B,MAAM,CAAU;IACzB,6EAA6E;IACpE,UAAU,GAAsB,EAAE,CAAC;IAC5C,2EAA2E;IAClE,UAAU,GAAG,EAAE,CAAC;IACzB,mDAAmD;IAC1C,QAAQ,GAAoB,OAAO,CAAC;IAC7C,wEAAwE;IAC/D,MAAM,CAAc;IAC7B,+BAA+B;IACtB,aAAa,CAAqB;IAC3C,6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AAC;IACP,CAAC;IAEO,UAAU;QACd,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;qHA9HQ,2BAA2B;6DAA3B,2BAA2B;mCAgBP,gBAAgB;;;;;YAnBlC,iCAAqC;;;iFAGvC,2BAA2B;cANvC,SAAS;6BACM,KAAK,YACP,0BAA0B,YAC1B,uCAAuC;;kBAKhD,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,SAAS;mBAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAhBpD,2BAA2B","sourcesContent":["import {\n Component,\n ComponentRef,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n ViewChild,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport { Subject, skip, takeUntil } from 'rxjs';\nimport { BaseEntity, LogError } from '@memberjunction/core';\nimport { InteractiveFormsEngine } from '@memberjunction/core-entities';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { BaseFormPanel } from './base-form-panel';\nimport {\n ContributionSectionPosition,\n PlacedInSectionKey,\n ResolveFormContributionWinners,\n type FormContributionRegistration,\n} from './form-contribution';\nimport { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';\nimport { FORM_PLACEMENT_PREVIEW } from './placement-preview';\nimport { MountFormContribution } from './mount-form-contribution';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\nimport { FormSlotCoordinator } from './form-slot-coordinator.service';\n\n/**\n * `<mj-form-field-panel-slot>` — mounts the contributions drawn inside a section.\n *\n * Two kinds: a contribution that stands in for some of the section's fields, and one placed in\n * the section by its key without replacing anything. Either belongs inside the section, so it\n * reads as part of it rather than as a separate card elsewhere on the form.\n * `<mj-collapsible-panel>` renders two of these, one above its projected content and one below,\n * and each mounts the contributions whose `sectionPosition` matches it. A claimed field stops\n * drawing, which `FormContext.claimedFieldNames` handles.\n *\n * Distinct from `<mj-form-panel-slot>`, which selects by slot position. This one selects by\n * field, and its position is wherever the section is — there is no slot involved and no\n * fallback chain, because a claim on a field the form does not draw is simply not matched\n * by any section.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-field-panel-slot',\n template: `<ng-container #anchor></ng-container>`,\n styles: [`:host { display: contents; }`],\n})\nexport class FormFieldPanelSlotComponent implements OnInit, OnChanges, OnDestroy {\n /** The entity name being edited. */\n @Input() Entity!: string;\n /** The fields this section draws — the set a contribution may claim from. */\n @Input() FieldNames: readonly string[] = [];\n /** The section's key, which a contribution placed in the section names. */\n @Input() SectionKey = '';\n /** Which end of the section this host draws at. */\n @Input() Position: 'start' | 'end' = 'start';\n /** The record being edited, threaded through to every mounted panel. */\n @Input() Record!: BaseEntity;\n /** The host form component. */\n @Input() FormComponent!: BaseFormComponent;\n /** Optional form context. */\n @Input() FormContext?: FormContext;\n\n @ViewChild('anchor', { read: ViewContainerRef, static: true })\n private anchor!: ViewContainerRef;\n\n private mounted: ComponentRef<BaseFormPanel>[] = [];\n private readonly destroy$ = new Subject<void>();\n private readonly recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n /** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */\n private readonly preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });\n /** The form's slot coordinator, which says when the user hid or showed a panel. */\n private readonly slots = inject(FormSlotCoordinator, { optional: true });\n\n public ngOnInit(): void {\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe((record) => {\n for (const ref of this.mounted) ref.instance.OnRecordRefreshed(record);\n });\n // The engine's subject replays the current rows on subscribe, which ngOnChanges has\n // already mounted.\n try {\n InteractiveFormsEngine.Instance.Contributions$\n .pipe(skip(1), takeUntil(this.destroy$))\n .subscribe(() => this.remount());\n } catch {\n // No engine here — compiled registrations are the only source.\n }\n this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());\n this.slots?.PanelsChanged.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());\n }\n\n public ngOnChanges(changes: SimpleChanges): void {\n if (!this.Entity || !this.Record || !this.FormComponent) return;\n const structural = ['Entity', 'FieldNames', 'SectionKey', 'Position', 'Record', 'FormComponent'];\n const changed = structural.some((k) => changes[k] && changes[k].currentValue !== changes[k].previousValue);\n if (!changed && this.mounted.length > 0) {\n if (changes['FormContext']) {\n for (const ref of this.mounted) ref.instance.FormContext = this.FormContext;\n }\n return;\n }\n this.remount();\n }\n\n public ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n this.unmountAll();\n }\n\n /**\n * Registrations claiming one of this section's fields, mounted in place.\n *\n * A form that renders its own body composes nothing, so the check the slot host makes\n * applies here for the same reason.\n */\n private remount(): void {\n this.unmountAll();\n if (this.FormComponent?.OwnsEntireFormBody) return;\n const claims = this.claimsForFields();\n if (claims.length === 0) return;\n\n for (const reg of claims) {\n try {\n const ref = MountFormContribution(this.anchor, reg);\n if (!ref) continue;\n ref.instance.Record = this.Record;\n ref.instance.FormComponent = this.FormComponent;\n ref.instance.RegistrationMetadata = reg.Metadata;\n if (this.FormContext) ref.instance.FormContext = this.FormContext;\n this.FormComponent?.RegisterFormPanel?.(ref.instance);\n this.mounted.push(ref);\n } catch (e) {\n LogError(`[mj-form-field-panel-slot] Failed to mount a panel on ${this.Entity}: ${e instanceof Error ? e.message : String(e)}`);\n }\n }\n }\n\n /**\n * The form's winning registrations drawn at this end of this section, highest sort first:\n * those standing in for a field the section draws, and those placed in the section by its\n * key ({@link PlacedInSectionKey}, which ignores a wildcard's place). The collapse runs once\n * over every registration on the form, so a key a row took from a compiled panel draws where\n * the row says.\n */\n private claimsForFields(): FormContributionRegistration[] {\n const fields = new Set(this.FieldNames.filter((name) => !!name));\n const sectionKey = this.SectionKey.trim();\n if (fields.size === 0 && !sectionKey) return [];\n const all = CollectFormContributionRegistrations(\n this.Record?.EntityInfo ?? null, this.FormComponent?.ProviderToUse ?? null, { Preview: this.preview });\n // A field claim belongs to this section when any of its fields is one this section draws.\n // Any, not every: a claim naming a field the form stopped drawing still belongs where its\n // remaining fields are, and dropping it there would leave the panel nowhere while its\n // other fields stayed hidden.\n const matching = ResolveFormContributionWinners(this.Entity, all).Winners.filter((reg) => {\n if (ContributionSectionPosition(reg.Metadata) !== this.Position) return false;\n if (sectionKey && PlacedInSectionKey(reg.Metadata) === sectionKey) return true;\n const claimed = reg.Metadata.replacesFieldNames ?? [];\n return claimed.some((name) => fields.has(name.trim()));\n });\n return matching.sort((a, b) => {\n const aSort = a.Metadata.sortKey ?? 0;\n const bSort = b.Metadata.sortKey ?? 0;\n if (aSort !== bSort) return bSort - aSort;\n return b.Priority - a.Priority;\n });\n }\n\n private unmountAll(): void {\n for (const ref of this.mounted) this.FormComponent?.UnregisterFormPanel?.(ref.instance);\n this.anchor.clear();\n this.mounted = [];\n }\n}\n"]}
@@ -33,8 +33,8 @@ import * as i0 from "@angular/core";
33
33
  * get them in the preferred position.
34
34
  *
35
35
  * **Re-mount**: any input change OR a coordinator change (another slot
36
- * registers/deregisters) triggers a re-render so fallback assignments stay
37
- * correct as slots come and go.
36
+ * registers/deregisters, or the form's panel set changed) triggers a re-render
37
+ * so fallback assignments and hidden panels stay correct.
38
38
  */
39
39
  export declare class FormPanelSlotComponent implements OnInit, OnChanges, OnDestroy {
40
40
  private readonly coordinator?;
@@ -48,14 +48,30 @@ export declare class FormPanelSlotComponent implements OnInit, OnChanges, OnDest
48
48
  FormComponent: BaseFormComponent;
49
49
  /** Optional form context — same shape collapsible-panel chrome expects. */
50
50
  FormContext?: FormContext;
51
+ /** The position, on the element, so a form's slot set can be read without its injector. */
52
+ get HostSlot(): string;
51
53
  private anchor;
52
54
  private mounted;
53
55
  private readonly destroy$;
54
56
  private registeredSlot;
55
57
  private readonly recordRefresh;
58
+ /** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */
59
+ private readonly preview;
60
+ private readonly element;
56
61
  /** Tracks synchronous re-entry depth into remount() so a future refactor
57
62
  * that reintroduces a remount loop surfaces loudly instead of freezing. */
58
63
  private remountDepth;
64
+ private readonly warnedLooseEntities;
65
+ private awaitingContributions;
66
+ /**
67
+ * Process-wide, not per-instance. The readiness wait is a one-time courtesy so the first
68
+ * paint shows both sources together; once it has resolved — ready OR timed out — no slot
69
+ * host anywhere should pay it again. Per-instance state made a failing engine cost every
70
+ * slot on every form 1.5s apiece, which is far worse than the pop-in it was avoiding.
71
+ */
72
+ private static contributionGateResolved;
73
+ /** Bounded: a slow or unreachable engine must not leave the form blank. */
74
+ private static readonly READINESS_TIMEOUT_MS;
59
75
  constructor(coordinator?: FormSlotCoordinator | undefined);
60
76
  ngOnInit(): void;
61
77
  ngOnChanges(changes: SimpleChanges): void;
@@ -63,24 +79,44 @@ export declare class FormPanelSlotComponent implements OnInit, OnChanges, OnDest
63
79
  private notifyMountedPanels;
64
80
  private remount;
65
81
  /**
66
- * Find registrations whose metadata declares this exact entity (or the
67
- * `'*'` wildcard) + slot. A panel registered with `entity: '*'` is
68
- * entity-agnostic — it mounts on EVERY entity's form. Such panels are
69
- * expected to self-hide (render nothing) when they don't apply to the
70
- * current record, so the cross-cutting registration stays unobtrusive.
82
+ * The form's winning registrations that this slot mounts.
83
+ *
84
+ * The collapse runs once over every registration on the form (see
85
+ * `ResolveFormContributionWinners`), then this slot keeps the winners it hosts: those
86
+ * registered for this slot, and those whose slot is missing from the form when the
87
+ * coordinator resolves them to this one. A winner drawn inside a section is mounted by that
88
+ * section, not by a slot. A wildcard (`entity: '*'`) panel mounts on every form and is
89
+ * expected to hide itself where it does not apply.
90
+ */
91
+ private winnersForThisSlot;
92
+ /**
93
+ * Diagnostic for the old prefix-insensitive match. A loosely named registration no
94
+ * longer mounts here — and never hid its baked grid on the container side, which has
95
+ * always matched strictly.
96
+ *
97
+ * This runs on every resolve, not only when nothing matched strictly. Keying it on
98
+ * "nothing matched" would miss the likeliest case: a form where some panels are named
99
+ * correctly and one is not, where the broken one would vanish with no warning at all.
71
100
  */
72
- private findRegistrations;
73
- /** True when a registration's `entity` matches this slot's entity, or is the `'*'` wildcard. */
74
- private entityMatches;
101
+ private warnOnLooseRegistrations;
75
102
  /**
76
- * Find panels registered for a different slot that should mount HERE
77
- * because their preferred slot isn't present and this slot is the next
78
- * existing one in the fallback chain.
103
+ * Whether the slot can mount now, or should wait for contribution rows.
79
104
  *
80
- * Only meaningful when we have a coordinator (i.e., we're inside an
81
- * `<mj-record-form-container>`).
105
+ * It waits only while a load is actually in flight. An engine nobody has configured
106
+ * is not "about to be ready" — blocking on it would delay every host that does not
107
+ * use metadata contributions at all. Those hosts mount immediately and self-heal:
108
+ * the collector kicks `Config`, and the `Contributions$` subscription below remounts
109
+ * when rows arrive.
110
+ */
111
+ private contributionsReady;
112
+ /**
113
+ * Wait for the engine's load to finish, then remount once. Falls through on a timeout so a
114
+ * slow or unreachable engine degrades to compiled panels only rather than leaving the slot
115
+ * empty.
82
116
  */
83
- private findOrphans;
117
+ private awaitContributionsThenRemount;
118
+ /** Resolves when `loading` emits false, or after the readiness timeout, whichever is first. */
119
+ private static loadFinishedOrTimeout;
84
120
  private unmountAll;
85
121
  static ɵfac: i0.ɵɵFactoryDeclaration<FormPanelSlotComponent, [{ optional: true; }]>;
86
122
  static ɵcmp: i0.ɵɵComponentDeclaration<FormPanelSlotComponent, "mj-form-panel-slot", never, { "Entity": { "alias": "Entity"; "required": false; }; "Slot": { "alias": "Slot"; "required": false; }; "Record": { "alias": "Record"; "required": false; }; "FormComponent": { "alias": "FormComponent"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; }, {}, never, never, false, never>;
@@ -1 +1 @@
1
- {"version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C,cAAc,CAA8B;IACpD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4D;IAC1F,4FAA4F;IAC5F,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsD;IAC9E,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+C;IACvE;gFAC4E;IAC5E,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IACzD,OAAO,CAAC,qBAAqB,CAAS;IAEtC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB,CAAS;IAEhD,2EAA2E;IAC3E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAQ;gBAEX,WAAW,CAAC,EAAE,mBAAmB,YAAA;IAE1E,QAAQ,IAAI,IAAI;IA+BhB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IA4BzC,WAAW,IAAI,IAAI;IAUnB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,OAAO;IAsEf;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAgBhC;;;;;;;;OAQG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;;;OAIG;YACW,6BAA6B;IAuB3C,+FAA+F;IAC/F,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAcpC,OAAO,CAAC,UAAU;yCAzTT,sBAAsB;2CAAtB,sBAAsB;CA8TlC"}
@@ -1,9 +1,12 @@
1
- import { Component, Input, Optional, ViewChild, ViewContainerRef, inject, } from '@angular/core';
2
- import { Subject, takeUntil } from 'rxjs';
1
+ import { Component, ElementRef, HostBinding, Input, Optional, ViewChild, ViewContainerRef, inject, } from '@angular/core';
2
+ import { Subject, filter, skip, take, takeUntil } from 'rxjs';
3
3
  import { LogError } from '@memberjunction/core';
4
- import { MJGlobal } from '@memberjunction/global';
5
- import { BaseFormPanel } from './base-form-panel';
6
- import { CollapseFormPanelRegistrations } from './form-contribution';
4
+ import { InteractiveFormsEngine } from '@memberjunction/core-entities';
5
+ import { ContributionDrawsInSection, FormContributionEntityMatches, ResolveFormContributionWinners, } from './form-contribution';
6
+ import { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';
7
+ import { MountFormContribution } from './mount-form-contribution';
8
+ import { PanelHideKey } from './panel-hides';
9
+ import { FORM_PLACEMENT_PREVIEW } from './placement-preview';
7
10
  import { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';
8
11
  import * as i0 from "@angular/core";
9
12
  import * as i1 from "./form-slot-coordinator.service";
@@ -36,8 +39,8 @@ const _c0 = ["anchor"];
36
39
  * get them in the preferred position.
37
40
  *
38
41
  * **Re-mount**: any input change OR a coordinator change (another slot
39
- * registers/deregisters) triggers a re-render so fallback assignments stay
40
- * correct as slots come and go.
42
+ * registers/deregisters, or the form's panel set changed) triggers a re-render
43
+ * so fallback assignments and hidden panels stay correct.
41
44
  */
42
45
  export class FormPanelSlotComponent {
43
46
  coordinator;
@@ -51,14 +54,32 @@ export class FormPanelSlotComponent {
51
54
  FormComponent;
52
55
  /** Optional form context — same shape collapsible-panel chrome expects. */
53
56
  FormContext;
57
+ /** The position, on the element, so a form's slot set can be read without its injector. */
58
+ get HostSlot() {
59
+ return this.Slot ?? '';
60
+ }
54
61
  anchor;
55
62
  mounted = [];
56
63
  destroy$ = new Subject();
57
64
  registeredSlot = null;
58
65
  recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });
66
+ /** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */
67
+ preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });
68
+ element = inject(ElementRef);
59
69
  /** Tracks synchronous re-entry depth into remount() so a future refactor
60
70
  * that reintroduces a remount loop surfaces loudly instead of freezing. */
61
71
  remountDepth = 0;
72
+ warnedLooseEntities = new Set();
73
+ awaitingContributions = false;
74
+ /**
75
+ * Process-wide, not per-instance. The readiness wait is a one-time courtesy so the first
76
+ * paint shows both sources together; once it has resolved — ready OR timed out — no slot
77
+ * host anywhere should pay it again. Per-instance state made a failing engine cost every
78
+ * slot on every form 1.5s apiece, which is far worse than the pop-in it was avoiding.
79
+ */
80
+ static contributionGateResolved = false;
81
+ /** Bounded: a slow or unreachable engine must not leave the form blank. */
82
+ static READINESS_TIMEOUT_MS = 1500;
62
83
  constructor(coordinator) {
63
84
  this.coordinator = coordinator;
64
85
  }
@@ -73,9 +94,25 @@ export class FormPanelSlotComponent {
73
94
  .pipe(takeUntil(this.destroy$))
74
95
  .subscribe(() => this.remount());
75
96
  }
97
+ // A hide or show changes which panels win without any slot coming or going.
98
+ this.coordinator?.PanelsChanged
99
+ .pipe(takeUntil(this.destroy$))
100
+ .subscribe(() => this.remount());
76
101
  this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe((record) => {
77
102
  this.notifyMountedPanels(record);
78
103
  });
104
+ // Rows can arrive after the first paint (cold engine, a contribution saved in another
105
+ // tab). Without this the slot would keep showing whatever it mounted first. The engine's
106
+ // subject replays the current rows on subscribe, which ngOnChanges has already mounted.
107
+ try {
108
+ InteractiveFormsEngine.Instance.Contributions$
109
+ .pipe(skip(1), takeUntil(this.destroy$))
110
+ .subscribe(() => this.remount());
111
+ }
112
+ catch {
113
+ // No engine here — compiled registrations are the only source.
114
+ }
115
+ this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());
79
116
  }
80
117
  ngOnChanges(changes) {
81
118
  if (!this.Entity || !this.Slot || !this.Record || !this.FormComponent) {
@@ -118,6 +155,19 @@ export class FormPanelSlotComponent {
118
155
  }
119
156
  }
120
157
  remount() {
158
+ // A form that renders its own body bars every panel. Checked before the readiness
159
+ // gate so a barred slot never waits on the engine.
160
+ if (this.FormComponent?.OwnsEntireFormBody) {
161
+ this.unmountAll();
162
+ return;
163
+ }
164
+ // Compiled panels and rows mount together or not at all. Mounting compiled panels
165
+ // first and adding rows a tick later is visible — and for a `bare` hero that replaces
166
+ // a baked section, the user watches that section render and then vanish.
167
+ if (!this.contributionsReady()) {
168
+ void this.awaitContributionsThenRemount();
169
+ return;
170
+ }
121
171
  this.remountDepth++;
122
172
  if (this.remountDepth > 5) {
123
173
  console.error(`[mj-form-panel-slot] LOOP DETECTED — remount depth ${this.remountDepth} on slot=${this.Slot}. Bailing.`);
@@ -125,19 +175,7 @@ export class FormPanelSlotComponent {
125
175
  return;
126
176
  }
127
177
  this.unmountAll();
128
- // 1. Direct matches: panels registered for THIS slot.
129
- const direct = this.findRegistrations(this.Slot);
130
- // 2. Orphans: panels registered for some OTHER slot whose preferred
131
- // slot doesn't exist in this form, AND this slot host is the
132
- // coordinator-resolved fallback for them. Without a coordinator
133
- // (no parent container), no orphan handling — panels just bind
134
- // to their literal slot.
135
- const orphans = this.findOrphans();
136
- const all = CollapseFormPanelRegistrations([...direct, ...orphans].map((reg) => ({
137
- Priority: reg.Priority,
138
- Metadata: (reg.Metadata ?? { entity: this.Entity, slot: this.Slot }),
139
- Registration: reg,
140
- }))).map((row) => row.Registration);
178
+ const all = this.winnersForThisSlot();
141
179
  if (all.length === 0) {
142
180
  this.remountDepth--;
143
181
  return;
@@ -152,18 +190,28 @@ export class FormPanelSlotComponent {
152
190
  });
153
191
  for (const reg of all) {
154
192
  try {
155
- const ctor = reg.SubClass;
156
- const ref = this.anchor.createComponent(ctor);
193
+ const ref = MountFormContribution(this.anchor, reg);
194
+ if (!ref)
195
+ continue;
157
196
  ref.instance.Record = this.Record;
158
197
  ref.instance.FormComponent = this.FormComponent;
198
+ ref.instance.RegistrationMetadata = reg.Metadata;
199
+ ref.instance.SlotElement = this.element.nativeElement;
159
200
  if (this.FormContext)
160
201
  ref.instance.FormContext = this.FormContext;
161
202
  // Left-nav leftover height targets mj-collapsible-panel as a
162
203
  // flex child of .mj-forms-all-panels. The slot is already
163
204
  // display:contents; the mounted host must be too.
164
205
  const host = ref.location.nativeElement;
165
- if (host)
206
+ if (host) {
166
207
  host.style.display = 'contents';
208
+ // Lets the drawer tell a panel that drew something from one that self-hid,
209
+ // by reading the DOM the way the form probe does.
210
+ const hideKey = PanelHideKey(reg);
211
+ if (hideKey)
212
+ host.setAttribute('data-panel-key', hideKey);
213
+ }
214
+ this.FormComponent?.RegisterFormPanel?.(ref.instance);
167
215
  // No detectChanges() — Angular's normal CD pass picks the new
168
216
  // component up. Calling detectChanges() synchronously inside
169
217
  // an ongoing CD cycle (which is when ngOnChanges → remount
@@ -178,60 +226,131 @@ export class FormPanelSlotComponent {
178
226
  this.remountDepth--;
179
227
  }
180
228
  /**
181
- * Find registrations whose metadata declares this exact entity (or the
182
- * `'*'` wildcard) + slot. A panel registered with `entity: '*'` is
183
- * entity-agnostic — it mounts on EVERY entity's form. Such panels are
184
- * expected to self-hide (render nothing) when they don't apply to the
185
- * current record, so the cross-cutting registration stays unobtrusive.
229
+ * The form's winning registrations that this slot mounts.
230
+ *
231
+ * The collapse runs once over every registration on the form (see
232
+ * `ResolveFormContributionWinners`), then this slot keeps the winners it hosts: those
233
+ * registered for this slot, and those whose slot is missing from the form when the
234
+ * coordinator resolves them to this one. A winner drawn inside a section is mounted by that
235
+ * section, not by a slot. A wildcard (`entity: '*'`) panel mounts on every form and is
236
+ * expected to hide itself where it does not apply.
186
237
  */
187
- findRegistrations(slot) {
188
- return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, (metadata) => {
189
- if (!metadata)
238
+ winnersForThisSlot() {
239
+ const entity = this.Record?.EntityInfo ?? null;
240
+ const provider = this.FormComponent?.ProviderToUse ?? null;
241
+ const all = CollectFormContributionRegistrations(entity, provider, { Preview: this.preview });
242
+ this.warnOnLooseRegistrations(all);
243
+ return ResolveFormContributionWinners(this.Entity, all).Winners.filter((reg) => {
244
+ if (ContributionDrawsInSection(reg.Metadata))
190
245
  return false;
191
- const meta = metadata;
192
- return this.entityMatches(meta.entity) && meta.slot === slot;
246
+ const slot = reg.Metadata.slot;
247
+ if (slot === this.Slot)
248
+ return true;
249
+ // Without a coordinator (no parent container) a panel binds to its literal slot only.
250
+ return !!slot && !!this.coordinator && this.coordinator.resolveSlot(slot) === this.Slot;
193
251
  });
194
252
  }
195
- /** True when a registration's `entity` matches this slot's entity, or is the `'*'` wildcard. */
196
- entityMatches(registeredEntity) {
197
- if (!registeredEntity || !this.Entity)
198
- return false;
199
- if (registeredEntity === '*')
253
+ /**
254
+ * Diagnostic for the old prefix-insensitive match. A loosely named registration no
255
+ * longer mounts here — and never hid its baked grid on the container side, which has
256
+ * always matched strictly.
257
+ *
258
+ * This runs on every resolve, not only when nothing matched strictly. Keying it on
259
+ * "nothing matched" would miss the likeliest case: a form where some panels are named
260
+ * correctly and one is not, where the broken one would vanish with no warning at all.
261
+ */
262
+ warnOnLooseRegistrations(all) {
263
+ if (this.warnedLooseEntities.has(this.Entity))
264
+ return;
265
+ const strip = (v) => v.replace(/^mj[:_\s]+/i, '').replace(/[\s_]+/g, '').toLowerCase();
266
+ const loose = all.filter((reg) => {
267
+ const name = reg.Metadata?.entity;
268
+ return !!name && !FormContributionEntityMatches(name, this.Entity) && strip(name) === strip(this.Entity);
269
+ });
270
+ if (loose.length === 0)
271
+ return;
272
+ this.warnedLooseEntities.add(this.Entity);
273
+ const names = [...new Set(loose.map((reg) => reg.Metadata.entity))].join(', ');
274
+ console.warn(`[mj-form-panel-slot] ${loose.length} BaseFormPanel registration(s) name "${names}" but the form entity is ` +
275
+ `"${this.Entity}". Entity names must match exactly; these panels will not mount.`);
276
+ }
277
+ /**
278
+ * Whether the slot can mount now, or should wait for contribution rows.
279
+ *
280
+ * It waits only while a load is actually in flight. An engine nobody has configured
281
+ * is not "about to be ready" — blocking on it would delay every host that does not
282
+ * use metadata contributions at all. Those hosts mount immediately and self-heal:
283
+ * the collector kicks `Config`, and the `Contributions$` subscription below remounts
284
+ * when rows arrive.
285
+ */
286
+ contributionsReady() {
287
+ if (FormPanelSlotComponent.contributionGateResolved)
200
288
  return true;
201
- const a = registeredEntity.trim().toLowerCase();
202
- const b = this.Entity.trim().toLowerCase();
203
- if (a === b)
289
+ try {
290
+ const engine = InteractiveFormsEngine.Instance;
291
+ if (engine.ContributionsReady) {
292
+ FormPanelSlotComponent.contributionGateResolved = true;
293
+ return true;
294
+ }
295
+ if (!engine.LoadingSubject.value) {
296
+ // Nothing in flight — mount now rather than waiting on a load that may never start.
297
+ return true;
298
+ }
299
+ return false;
300
+ }
301
+ catch {
302
+ // No engine in this context (a panel composed outside a form host).
303
+ FormPanelSlotComponent.contributionGateResolved = true;
204
304
  return true;
205
- // Normalize schema prefixes like "MJ: " or "MJ_"
206
- const strip = (s) => s.replace(/^mj[:_\s]+/i, '').replace(/[\s_]+/g, '').toLowerCase();
207
- return strip(a) === strip(b);
305
+ }
208
306
  }
209
307
  /**
210
- * Find panels registered for a different slot that should mount HERE
211
- * because their preferred slot isn't present and this slot is the next
212
- * existing one in the fallback chain.
213
- *
214
- * Only meaningful when we have a coordinator (i.e., we're inside an
215
- * `<mj-record-form-container>`).
308
+ * Wait for the engine's load to finish, then remount once. Falls through on a timeout so a
309
+ * slow or unreachable engine degrades to compiled panels only rather than leaving the slot
310
+ * empty.
216
311
  */
217
- findOrphans() {
218
- if (!this.coordinator)
219
- return [];
220
- const allForEntity = MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, (metadata) => {
221
- if (!metadata)
222
- return false;
223
- const meta = metadata;
224
- return this.entityMatches(meta.entity) && meta.slot != null && meta.slot !== this.Slot;
225
- });
226
- return allForEntity.filter(reg => {
227
- const meta = reg.Metadata;
228
- if (!meta?.slot)
229
- return false;
230
- const resolved = this.coordinator.resolveSlot(meta.slot);
231
- return resolved === this.Slot;
312
+ async awaitContributionsThenRemount() {
313
+ if (this.awaitingContributions)
314
+ return;
315
+ this.awaitingContributions = true;
316
+ try {
317
+ const engine = InteractiveFormsEngine.Instance;
318
+ const outcome = await FormPanelSlotComponent.loadFinishedOrTimeout(engine.LoadingSubject);
319
+ if (!engine.ContributionsReady && !FormPanelSlotComponent.contributionGateResolved) {
320
+ // Once: the first slot to finish waiting closes the gate process-wide below.
321
+ LogError(outcome === 'timeout'
322
+ ? `[mj-form-panel-slot] contribution cache not ready after ${FormPanelSlotComponent.READINESS_TIMEOUT_MS}ms; mounting compiled panels only from here on.`
323
+ : '[mj-form-panel-slot] contribution cache failed to load; mounting compiled panels only from here on.');
324
+ }
325
+ }
326
+ catch (e) {
327
+ LogError(`[mj-form-panel-slot] waiting on contributions failed: ${e instanceof Error ? e.message : String(e)}`);
328
+ }
329
+ finally {
330
+ this.awaitingContributions = false;
331
+ // Ready or timed out, the gate is spent process-wide: from here every slot mounts
332
+ // whatever the collector returns rather than waiting again.
333
+ FormPanelSlotComponent.contributionGateResolved = true;
334
+ }
335
+ this.remount();
336
+ }
337
+ /** Resolves when `loading` emits false, or after the readiness timeout, whichever is first. */
338
+ static loadFinishedOrTimeout(loading) {
339
+ return new Promise((resolve) => {
340
+ let subscription = null;
341
+ const timer = setTimeout(() => {
342
+ subscription?.unsubscribe();
343
+ resolve('timeout');
344
+ }, FormPanelSlotComponent.READINESS_TIMEOUT_MS);
345
+ subscription = loading.pipe(filter((busy) => !busy), take(1)).subscribe(() => {
346
+ clearTimeout(timer);
347
+ resolve('loaded');
348
+ });
232
349
  });
233
350
  }
234
351
  unmountAll() {
352
+ for (const ref of this.mounted)
353
+ this.FormComponent?.UnregisterFormPanel?.(ref.instance);
235
354
  this.anchor.clear();
236
355
  this.mounted = [];
237
356
  }
@@ -241,6 +360,8 @@ export class FormPanelSlotComponent {
241
360
  } if (rf & 2) {
242
361
  let _t;
243
362
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.anchor = _t.first);
363
+ } }, hostVars: 1, hostBindings: function FormPanelSlotComponent_HostBindings(rf, ctx) { if (rf & 2) {
364
+ i0.ɵɵattribute("data-form-slot", ctx.HostSlot);
244
365
  } }, inputs: { Entity: "Entity", Slot: "Slot", Record: "Record", FormComponent: "FormComponent", FormContext: "FormContext" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 2, vars: 0, consts: [["anchor", ""]], template: function FormPanelSlotComponent_Template(rf, ctx) { if (rf & 1) {
245
366
  i0.ɵɵelementContainer(0, null, 0);
246
367
  } }, styles: ["[_nghost-%COMP%] { display: contents; }"] });
@@ -260,9 +381,12 @@ export class FormPanelSlotComponent {
260
381
  type: Input
261
382
  }], FormContext: [{
262
383
  type: Input
384
+ }], HostSlot: [{
385
+ type: HostBinding,
386
+ args: ['attr.data-form-slot']
263
387
  }], anchor: [{
264
388
  type: ViewChild,
265
389
  args: ['anchor', { read: ViewContainerRef, static: true }]
266
390
  }] }); })();
267
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormPanelSlotComponent, { className: "FormPanelSlotComponent", filePath: "src/lib/panel-slot/form-panel-slot.component.ts", lineNumber: 67 }); })();
391
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormPanelSlotComponent, { className: "FormPanelSlotComponent", filePath: "src/lib/panel-slot/form-panel-slot.component.ts", lineNumber: 77 }); })();
268
392
  //# sourceMappingURL=form-panel-slot.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-panel-slot.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-panel-slot.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAET,KAAK,EAIL,QAAQ,EAGR,SAAS,EACT,gBAAgB,EAChB,MAAM,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAc,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAqB,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAgD,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,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AAS;6BACM,KAAK,YACP,oBAAoB,YACpB,uCAAuC;;sBA+BpC,QAAQ;;kBArBpB,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,SAAS;mBAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAZpD,sBAAsB","sourcesContent":["import {\n Component,\n ComponentRef,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Optional,\n SimpleChanges,\n Type,\n ViewChild,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport { Subject, takeUntil } from 'rxjs';\nimport { BaseEntity, LogError } from '@memberjunction/core';\nimport { ClassRegistration, MJGlobal } from '@memberjunction/global';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { BaseFormPanel, FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';\nimport { FormSlotCoordinator } from './form-slot-coordinator.service';\nimport { CollapseFormPanelRegistrations } from './form-contribution';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\n\n/**\n * `<mj-form-panel-slot>` — dynamic slot host that discovers and mounts every\n * registered `BaseFormPanel` whose metadata matches the slot's `Entity` +\n * `Slot` inputs. Generated entity-form HTML emits one of these at each\n * well-known slot position so consumers can extend the form WITHOUT replacing\n * it via the custom-form override pattern.\n *\n * **Discovery**: uses `ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, ...)`\n * to find every panel registered with metadata `{ entity, slot }` matching this\n * slot. Registrations without a metadata bag (or without these required keys)\n * are silently ignored so legacy registrations don't accidentally bind.\n *\n * **Ordering**: registrations are sorted by `metadata.sortKey` descending —\n * higher number renders first within the slot. Use ranges (100/50/10) so future\n * panels can wedge in without renumbering. Ties fall back to the\n * `ClassRegistration.Priority` field (also descending), and finally to\n * registration order.\n *\n * **Fallback chain** (see `FormSlotCoordinator`): each slot host registers\n * with the per-form coordinator and additionally renders panels whose\n * REGISTERED slot is missing in the current form, when this host happens to\n * be the next-existing slot down the chain. The container template guarantees\n * an `after-everything` slot host, so fallback always terminates somewhere.\n * Downstream consumers running an older form template (no CodeGen rerun\n * yet) get every panel rendered at the bottom; consumers on the new template\n * get them in the preferred position.\n *\n * **Re-mount**: any input change OR a coordinator change (another slot\n * registers/deregisters) triggers a re-render so fallback assignments stay\n * correct as slots come and go.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-panel-slot',\n template: `<ng-container #anchor></ng-container>`,\n // `display: contents` makes the host element disappear from the layout\n // tree so the mounted panels (children) participate directly in the\n // parent's flex/grid layout. Without this, the parent's gap/spacing\n // rules treat all mounted panels as a SINGLE child (the slot host),\n // collapsing the spacing between them.\n styles: [`:host { display: contents; }`],\n})\nexport class FormPanelSlotComponent implements OnInit, OnChanges, OnDestroy {\n /** The entity name (e.g., `\"MJ: Content Sources\"`) being edited. */\n @Input() Entity!: string;\n /** Which slot position this host represents. */\n @Input() Slot!: FormPanelSlot;\n /** The record being edited — threaded through to every mounted panel. */\n @Input() Record!: BaseEntity;\n /** The host form component — used by panels for EditMode + dirty notifications. */\n @Input() FormComponent!: BaseFormComponent;\n /** Optional form context — same shape collapsible-panel chrome expects. */\n @Input() FormContext?: FormContext;\n\n @ViewChild('anchor', { read: ViewContainerRef, static: true })\n private anchor!: ViewContainerRef;\n\n private mounted: ComponentRef<BaseFormPanel>[] = [];\n private readonly destroy$ = new Subject<void>();\n private registeredSlot: FormPanelSlot | null = null;\n private readonly recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n /** Tracks synchronous re-entry depth into remount() so a future refactor\n * that reintroduces a remount loop surfaces loudly instead of freezing. */\n private remountDepth = 0;\n\n constructor(@Optional() private readonly coordinator?: FormSlotCoordinator) {}\n\n ngOnInit(): void {\n if (this.Slot && this.coordinator) {\n this.coordinator.registerSlot(this.Slot);\n this.registeredSlot = this.Slot;\n // Re-mount whenever the coordinator's known-slot set changes —\n // a panel that was previously orphaned to us might now have a\n // better slot available (or vice versa).\n this.coordinator.changes\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.remount());\n }\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe((record) => {\n this.notifyMountedPanels(record);\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.Entity || !this.Slot || !this.Record || !this.FormComponent) {\n // Inputs still being wired — wait for the next pass.\n return;\n }\n\n // Only remount when something that affects WHICH panels to mount has\n // changed. FormContext only flows through to mounted panels — pushing\n // it to the existing panels avoids an unmount/remount cycle.\n //\n // Critical for performance: the host form often reconstructs\n // formContext on every CD pass. Treating that as a structural change\n // would loop (remount → detectChanges → another CD → new FormContext\n // → remount again).\n const meaningfulKeys = ['Entity', 'Slot', 'Record', 'FormComponent'];\n const meaningfulChange = meaningfulKeys.some(k => changes[k]?.currentValue !== changes[k]?.previousValue);\n if (!meaningfulChange && changes['FormContext'] && this.mounted.length > 0) {\n for (const ref of this.mounted) {\n ref.instance.FormContext = this.FormContext;\n }\n return;\n }\n if (!meaningfulChange && this.mounted.length > 0) {\n return;\n }\n this.remount();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n if (this.coordinator && this.registeredSlot) {\n this.coordinator.deregisterSlot(this.registeredSlot);\n this.registeredSlot = null;\n }\n this.unmountAll();\n }\n\n private notifyMountedPanels(record: BaseEntity): void {\n for (const ref of this.mounted) {\n ref.instance.OnRecordRefreshed(record);\n }\n }\n\n private remount(): void {\n this.remountDepth++;\n if (this.remountDepth > 5) {\n console.error(`[mj-form-panel-slot] LOOP DETECTED — remount depth ${this.remountDepth} on slot=${this.Slot}. Bailing.`);\n this.remountDepth--;\n return;\n }\n this.unmountAll();\n\n // 1. Direct matches: panels registered for THIS slot.\n const direct = this.findRegistrations(this.Slot);\n\n // 2. Orphans: panels registered for some OTHER slot whose preferred\n // slot doesn't exist in this form, AND this slot host is the\n // coordinator-resolved fallback for them. Without a coordinator\n // (no parent container), no orphan handling — panels just bind\n // to their literal slot.\n const orphans = this.findOrphans();\n\n const all = CollapseFormPanelRegistrations(\n [...direct, ...orphans].map((reg) => ({\n Priority: reg.Priority,\n Metadata: (reg.Metadata ?? { entity: this.Entity, slot: this.Slot }) as FormPanelRegistrationMetadata,\n Registration: reg,\n })),\n ).map((row) => row.Registration);\n if (all.length === 0) {\n this.remountDepth--;\n return;\n }\n\n // Sort: higher sortKey first, then higher Priority, then registration order.\n all.sort((a, b) => {\n const aSort = (a.Metadata as FormPanelRegistrationMetadata | undefined)?.sortKey ?? 0;\n const bSort = (b.Metadata as FormPanelRegistrationMetadata | undefined)?.sortKey ?? 0;\n if (aSort !== bSort) return bSort - aSort;\n return b.Priority - a.Priority;\n });\n\n for (const reg of all) {\n try {\n const ctor = reg.SubClass as Type<BaseFormPanel>;\n const ref = this.anchor.createComponent(ctor);\n ref.instance.Record = this.Record;\n ref.instance.FormComponent = this.FormComponent;\n if (this.FormContext) ref.instance.FormContext = this.FormContext;\n // Left-nav leftover height targets mj-collapsible-panel as a\n // flex child of .mj-forms-all-panels. The slot is already\n // display:contents; the mounted host must be too.\n const host = ref.location.nativeElement as HTMLElement | null;\n if (host) host.style.display = 'contents';\n // No detectChanges() — Angular's normal CD pass picks the new\n // component up. Calling detectChanges() synchronously inside\n // an ongoing CD cycle (which is when ngOnChanges → remount\n // fires) can re-enter and cause an infinite loop if anything\n // upstream is reconstructing inputs on each CD pass.\n this.mounted.push(ref);\n } catch (e) {\n LogError(`[mj-form-panel-slot] Failed to mount panel for ${this.Entity}:${this.Slot}: ${e instanceof Error ? e.message : String(e)}`);\n }\n }\n this.remountDepth--;\n }\n\n /**\n * Find registrations whose metadata declares this exact entity (or the\n * `'*'` wildcard) + slot. A panel registered with `entity: '*'` is\n * entity-agnostic — it mounts on EVERY entity's form. Such panels are\n * expected to self-hide (render nothing) when they don't apply to the\n * current record, so the cross-cutting registration stays unobtrusive.\n */\n private findRegistrations(slot: FormPanelSlot): ClassRegistration[] {\n return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const meta = metadata as Partial<FormPanelRegistrationMetadata>;\n return this.entityMatches(meta.entity) && meta.slot === slot;\n },\n );\n }\n\n /** True when a registration's `entity` matches this slot's entity, or is the `'*'` wildcard. */\n private entityMatches(registeredEntity: string | undefined): boolean {\n if (!registeredEntity || !this.Entity) return false;\n if (registeredEntity === '*') return true;\n const a = registeredEntity.trim().toLowerCase();\n const b = this.Entity.trim().toLowerCase();\n if (a === b) return true;\n // Normalize schema prefixes like \"MJ: \" or \"MJ_\"\n const strip = (s: string) => s.replace(/^mj[:_\\s]+/i, '').replace(/[\\s_]+/g, '').toLowerCase();\n return strip(a) === strip(b);\n }\n\n /**\n * Find panels registered for a different slot that should mount HERE\n * because their preferred slot isn't present and this slot is the next\n * existing one in the fallback chain.\n *\n * Only meaningful when we have a coordinator (i.e., we're inside an\n * `<mj-record-form-container>`).\n */\n private findOrphans(): ClassRegistration[] {\n if (!this.coordinator) return [];\n\n const allForEntity = MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const meta = metadata as Partial<FormPanelRegistrationMetadata>;\n return this.entityMatches(meta.entity) && meta.slot != null && meta.slot !== this.Slot;\n },\n );\n\n return allForEntity.filter(reg => {\n const meta = reg.Metadata as FormPanelRegistrationMetadata | undefined;\n if (!meta?.slot) return false;\n const resolved = this.coordinator!.resolveSlot(meta.slot);\n return resolved === this.Slot;\n });\n }\n\n private unmountAll(): void {\n this.anchor.clear();\n this.mounted = [];\n }\n}\n"]}
1
+ {"version":3,"file":"form-panel-slot.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-panel-slot.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EAET,UAAU,EACV,WAAW,EACX,KAAK,EAIL,QAAQ,EAER,SAAS,EACT,gBAAgB,EAChB,MAAM,GACT,MAAM,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ACzE,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,CAAC,QAAQ,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAEO,UAAU;QACd,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,aAAa,EAAE,mBAAmB,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACxF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;gHA7TQ,sBAAsB;6DAAtB,sBAAsB;mCAkBF,gBAAgB;;;;;;;YA1BlC,iCAAqC;;;iFAQvC,sBAAsB;cAXlC,SAAS;6BACM,KAAK,YACP,oBAAoB,YACpB,uCAAuC;;sBAqDpC,QAAQ;;kBA3CpB,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAEL,KAAK;;kBAGL,WAAW;mBAAC,qBAAqB;;kBAKjC,SAAS;mBAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAlBpD,sBAAsB","sourcesContent":["import {\n Component,\n ComponentRef,\n ElementRef,\n HostBinding,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Optional,\n SimpleChanges,\n ViewChild,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport { Subject, filter, skip, take, takeUntil, type Observable, type Subscription } from 'rxjs';\nimport { BaseEntity, LogError } from '@memberjunction/core';\nimport { InteractiveFormsEngine } from '@memberjunction/core-entities';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport { BaseFormPanel, FormPanelSlot } from './base-form-panel';\nimport { FormSlotCoordinator } from './form-slot-coordinator.service';\nimport {\n ContributionDrawsInSection,\n FormContributionEntityMatches,\n ResolveFormContributionWinners,\n type FormContributionRegistration,\n} from './form-contribution';\nimport { CollectFormContributionRegistrations } from './collect-form-contribution-registrations';\nimport { MountFormContribution } from './mount-form-contribution';\nimport { PanelHideKey } from './panel-hides';\nimport { FORM_PLACEMENT_PREVIEW } from './placement-preview';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\n\n/**\n * `<mj-form-panel-slot>` — dynamic slot host that discovers and mounts every\n * registered `BaseFormPanel` whose metadata matches the slot's `Entity` +\n * `Slot` inputs. Generated entity-form HTML emits one of these at each\n * well-known slot position so consumers can extend the form WITHOUT replacing\n * it via the custom-form override pattern.\n *\n * **Discovery**: uses `ClassFactory.GetAllRegistrationsByMetadata(BaseFormPanel, ...)`\n * to find every panel registered with metadata `{ entity, slot }` matching this\n * slot. Registrations without a metadata bag (or without these required keys)\n * are silently ignored so legacy registrations don't accidentally bind.\n *\n * **Ordering**: registrations are sorted by `metadata.sortKey` descending —\n * higher number renders first within the slot. Use ranges (100/50/10) so future\n * panels can wedge in without renumbering. Ties fall back to the\n * `ClassRegistration.Priority` field (also descending), and finally to\n * registration order.\n *\n * **Fallback chain** (see `FormSlotCoordinator`): each slot host registers\n * with the per-form coordinator and additionally renders panels whose\n * REGISTERED slot is missing in the current form, when this host happens to\n * be the next-existing slot down the chain. The container template guarantees\n * an `after-everything` slot host, so fallback always terminates somewhere.\n * Downstream consumers running an older form template (no CodeGen rerun\n * yet) get every panel rendered at the bottom; consumers on the new template\n * get them in the preferred position.\n *\n * **Re-mount**: any input change OR a coordinator change (another slot\n * registers/deregisters, or the form's panel set changed) triggers a re-render\n * so fallback assignments and hidden panels stay correct.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-panel-slot',\n template: `<ng-container #anchor></ng-container>`,\n // `display: contents` makes the host element disappear from the layout\n // tree so the mounted panels (children) participate directly in the\n // parent's flex/grid layout. Without this, the parent's gap/spacing\n // rules treat all mounted panels as a SINGLE child (the slot host),\n // collapsing the spacing between them.\n styles: [`:host { display: contents; }`],\n})\nexport class FormPanelSlotComponent implements OnInit, OnChanges, OnDestroy {\n /** The entity name (e.g., `\"MJ: Content Sources\"`) being edited. */\n @Input() Entity!: string;\n /** Which slot position this host represents. */\n @Input() Slot!: FormPanelSlot;\n /** The record being edited — threaded through to every mounted panel. */\n @Input() Record!: BaseEntity;\n /** The host form component — used by panels for EditMode + dirty notifications. */\n @Input() FormComponent!: BaseFormComponent;\n /** Optional form context — same shape collapsible-panel chrome expects. */\n @Input() FormContext?: FormContext;\n\n /** The position, on the element, so a form's slot set can be read without its injector. */\n @HostBinding('attr.data-form-slot')\n get HostSlot(): string {\n return this.Slot ?? '';\n }\n\n @ViewChild('anchor', { read: ViewContainerRef, static: true })\n private anchor!: ViewContainerRef;\n\n private mounted: ComponentRef<BaseFormPanel>[] = [];\n private readonly destroy$ = new Subject<void>();\n private registeredSlot: FormPanelSlot | null = null;\n private readonly recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n /** The placement dialog's unsaved panel, when this slot is on the dialog's preview form. */\n private readonly preview = inject(FORM_PLACEMENT_PREVIEW, { optional: true });\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n /** Tracks synchronous re-entry depth into remount() so a future refactor\n * that reintroduces a remount loop surfaces loudly instead of freezing. */\n private remountDepth = 0;\n private readonly warnedLooseEntities = new Set<string>();\n private awaitingContributions = false;\n\n /**\n * Process-wide, not per-instance. The readiness wait is a one-time courtesy so the first\n * paint shows both sources together; once it has resolved — ready OR timed out — no slot\n * host anywhere should pay it again. Per-instance state made a failing engine cost every\n * slot on every form 1.5s apiece, which is far worse than the pop-in it was avoiding.\n */\n private static contributionGateResolved = false;\n\n /** Bounded: a slow or unreachable engine must not leave the form blank. */\n private static readonly READINESS_TIMEOUT_MS = 1500;\n\n constructor(@Optional() private readonly coordinator?: FormSlotCoordinator) {}\n\n ngOnInit(): void {\n if (this.Slot && this.coordinator) {\n this.coordinator.registerSlot(this.Slot);\n this.registeredSlot = this.Slot;\n // Re-mount whenever the coordinator's known-slot set changes —\n // a panel that was previously orphaned to us might now have a\n // better slot available (or vice versa).\n this.coordinator.changes\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.remount());\n }\n // A hide or show changes which panels win without any slot coming or going.\n this.coordinator?.PanelsChanged\n .pipe(takeUntil(this.destroy$))\n .subscribe(() => this.remount());\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe((record) => {\n this.notifyMountedPanels(record);\n });\n // Rows can arrive after the first paint (cold engine, a contribution saved in another\n // tab). Without this the slot would keep showing whatever it mounted first. The engine's\n // subject replays the current rows on subscribe, which ngOnChanges has already mounted.\n try {\n InteractiveFormsEngine.Instance.Contributions$\n .pipe(skip(1), takeUntil(this.destroy$))\n .subscribe(() => this.remount());\n } catch {\n // No engine here — compiled registrations are the only source.\n }\n this.preview?.Changed$.pipe(takeUntil(this.destroy$)).subscribe(() => this.remount());\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (!this.Entity || !this.Slot || !this.Record || !this.FormComponent) {\n // Inputs still being wired — wait for the next pass.\n return;\n }\n\n // Only remount when something that affects WHICH panels to mount has\n // changed. FormContext only flows through to mounted panels — pushing\n // it to the existing panels avoids an unmount/remount cycle.\n //\n // Critical for performance: the host form often reconstructs\n // formContext on every CD pass. Treating that as a structural change\n // would loop (remount → detectChanges → another CD → new FormContext\n // → remount again).\n const meaningfulKeys = ['Entity', 'Slot', 'Record', 'FormComponent'];\n const meaningfulChange = meaningfulKeys.some(k => changes[k]?.currentValue !== changes[k]?.previousValue);\n if (!meaningfulChange && changes['FormContext'] && this.mounted.length > 0) {\n for (const ref of this.mounted) {\n ref.instance.FormContext = this.FormContext;\n }\n return;\n }\n if (!meaningfulChange && this.mounted.length > 0) {\n return;\n }\n this.remount();\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n if (this.coordinator && this.registeredSlot) {\n this.coordinator.deregisterSlot(this.registeredSlot);\n this.registeredSlot = null;\n }\n this.unmountAll();\n }\n\n private notifyMountedPanels(record: BaseEntity): void {\n for (const ref of this.mounted) {\n ref.instance.OnRecordRefreshed(record);\n }\n }\n\n private remount(): void {\n // A form that renders its own body bars every panel. Checked before the readiness\n // gate so a barred slot never waits on the engine.\n if (this.FormComponent?.OwnsEntireFormBody) {\n this.unmountAll();\n return;\n }\n // Compiled panels and rows mount together or not at all. Mounting compiled panels\n // first and adding rows a tick later is visible — and for a `bare` hero that replaces\n // a baked section, the user watches that section render and then vanish.\n if (!this.contributionsReady()) {\n void this.awaitContributionsThenRemount();\n return;\n }\n this.remountDepth++;\n if (this.remountDepth > 5) {\n console.error(`[mj-form-panel-slot] LOOP DETECTED — remount depth ${this.remountDepth} on slot=${this.Slot}. Bailing.`);\n this.remountDepth--;\n return;\n }\n this.unmountAll();\n\n const all = this.winnersForThisSlot();\n if (all.length === 0) {\n this.remountDepth--;\n return;\n }\n\n // Sort: higher sortKey first, then higher Priority, then registration order.\n all.sort((a, b) => {\n const aSort = a.Metadata?.sortKey ?? 0;\n const bSort = b.Metadata?.sortKey ?? 0;\n if (aSort !== bSort) return bSort - aSort;\n return b.Priority - a.Priority;\n });\n\n for (const reg of all) {\n try {\n const ref = MountFormContribution(this.anchor, reg);\n if (!ref) continue;\n ref.instance.Record = this.Record;\n ref.instance.FormComponent = this.FormComponent;\n ref.instance.RegistrationMetadata = reg.Metadata;\n ref.instance.SlotElement = this.element.nativeElement;\n if (this.FormContext) ref.instance.FormContext = this.FormContext;\n // Left-nav leftover height targets mj-collapsible-panel as a\n // flex child of .mj-forms-all-panels. The slot is already\n // display:contents; the mounted host must be too.\n const host = ref.location.nativeElement as HTMLElement | null;\n if (host) {\n host.style.display = 'contents';\n // Lets the drawer tell a panel that drew something from one that self-hid,\n // by reading the DOM the way the form probe does.\n const hideKey = PanelHideKey(reg);\n if (hideKey) host.setAttribute('data-panel-key', hideKey);\n }\n this.FormComponent?.RegisterFormPanel?.(ref.instance);\n // No detectChanges() — Angular's normal CD pass picks the new\n // component up. Calling detectChanges() synchronously inside\n // an ongoing CD cycle (which is when ngOnChanges → remount\n // fires) can re-enter and cause an infinite loop if anything\n // upstream is reconstructing inputs on each CD pass.\n this.mounted.push(ref);\n } catch (e) {\n LogError(`[mj-form-panel-slot] Failed to mount panel for ${this.Entity}:${this.Slot}: ${e instanceof Error ? e.message : String(e)}`);\n }\n }\n this.remountDepth--;\n }\n\n /**\n * The form's winning registrations that this slot mounts.\n *\n * The collapse runs once over every registration on the form (see\n * `ResolveFormContributionWinners`), then this slot keeps the winners it hosts: those\n * registered for this slot, and those whose slot is missing from the form when the\n * coordinator resolves them to this one. A winner drawn inside a section is mounted by that\n * section, not by a slot. A wildcard (`entity: '*'`) panel mounts on every form and is\n * expected to hide itself where it does not apply.\n */\n private winnersForThisSlot(): FormContributionRegistration[] {\n const entity = this.Record?.EntityInfo ?? null;\n const provider = this.FormComponent?.ProviderToUse ?? null;\n const all = CollectFormContributionRegistrations(entity, provider, { Preview: this.preview });\n this.warnOnLooseRegistrations(all);\n return ResolveFormContributionWinners(this.Entity, all).Winners.filter((reg) => {\n if (ContributionDrawsInSection(reg.Metadata)) return false;\n const slot = reg.Metadata.slot;\n if (slot === this.Slot) return true;\n // Without a coordinator (no parent container) a panel binds to its literal slot only.\n return !!slot && !!this.coordinator && this.coordinator.resolveSlot(slot) === this.Slot;\n });\n }\n\n /**\n * Diagnostic for the old prefix-insensitive match. A loosely named registration no\n * longer mounts here — and never hid its baked grid on the container side, which has\n * always matched strictly.\n *\n * This runs on every resolve, not only when nothing matched strictly. Keying it on\n * \"nothing matched\" would miss the likeliest case: a form where some panels are named\n * correctly and one is not, where the broken one would vanish with no warning at all.\n */\n private warnOnLooseRegistrations(all: readonly FormContributionRegistration[]): void {\n if (this.warnedLooseEntities.has(this.Entity)) return;\n const strip = (v: string) => v.replace(/^mj[:_\\s]+/i, '').replace(/[\\s_]+/g, '').toLowerCase();\n const loose = all.filter((reg) => {\n const name = reg.Metadata?.entity;\n return !!name && !FormContributionEntityMatches(name, this.Entity) && strip(name) === strip(this.Entity);\n });\n if (loose.length === 0) return;\n this.warnedLooseEntities.add(this.Entity);\n const names = [...new Set(loose.map((reg) => reg.Metadata.entity))].join(', ');\n console.warn(\n `[mj-form-panel-slot] ${loose.length} BaseFormPanel registration(s) name \"${names}\" but the form entity is ` +\n `\"${this.Entity}\". Entity names must match exactly; these panels will not mount.`,\n );\n }\n\n /**\n * Whether the slot can mount now, or should wait for contribution rows.\n *\n * It waits only while a load is actually in flight. An engine nobody has configured\n * is not \"about to be ready\" — blocking on it would delay every host that does not\n * use metadata contributions at all. Those hosts mount immediately and self-heal:\n * the collector kicks `Config`, and the `Contributions$` subscription below remounts\n * when rows arrive.\n */\n private contributionsReady(): boolean {\n if (FormPanelSlotComponent.contributionGateResolved) return true;\n try {\n const engine = InteractiveFormsEngine.Instance;\n if (engine.ContributionsReady) {\n FormPanelSlotComponent.contributionGateResolved = true;\n return true;\n }\n if (!engine.LoadingSubject.value) {\n // Nothing in flight — mount now rather than waiting on a load that may never start.\n return true;\n }\n return false;\n } catch {\n // No engine in this context (a panel composed outside a form host).\n FormPanelSlotComponent.contributionGateResolved = true;\n return true;\n }\n }\n\n /**\n * Wait for the engine's load to finish, then remount once. Falls through on a timeout so a\n * slow or unreachable engine degrades to compiled panels only rather than leaving the slot\n * empty.\n */\n private async awaitContributionsThenRemount(): Promise<void> {\n if (this.awaitingContributions) return;\n this.awaitingContributions = true;\n try {\n const engine = InteractiveFormsEngine.Instance;\n const outcome = await FormPanelSlotComponent.loadFinishedOrTimeout(engine.LoadingSubject);\n if (!engine.ContributionsReady && !FormPanelSlotComponent.contributionGateResolved) {\n // Once: the first slot to finish waiting closes the gate process-wide below.\n LogError(outcome === 'timeout'\n ? `[mj-form-panel-slot] contribution cache not ready after ${FormPanelSlotComponent.READINESS_TIMEOUT_MS}ms; mounting compiled panels only from here on.`\n : '[mj-form-panel-slot] contribution cache failed to load; mounting compiled panels only from here on.');\n }\n } catch (e) {\n LogError(`[mj-form-panel-slot] waiting on contributions failed: ${e instanceof Error ? e.message : String(e)}`);\n } finally {\n this.awaitingContributions = false;\n // Ready or timed out, the gate is spent process-wide: from here every slot mounts\n // whatever the collector returns rather than waiting again.\n FormPanelSlotComponent.contributionGateResolved = true;\n }\n this.remount();\n }\n\n /** Resolves when `loading` emits false, or after the readiness timeout, whichever is first. */\n private static loadFinishedOrTimeout(loading: Observable<boolean>): Promise<'loaded' | 'timeout'> {\n return new Promise((resolve) => {\n let subscription: Subscription | null = null;\n const timer = setTimeout(() => {\n subscription?.unsubscribe();\n resolve('timeout');\n }, FormPanelSlotComponent.READINESS_TIMEOUT_MS);\n subscription = loading.pipe(filter((busy) => !busy), take(1)).subscribe(() => {\n clearTimeout(timer);\n resolve('loaded');\n });\n });\n }\n\n private unmountAll(): void {\n for (const ref of this.mounted) this.FormComponent?.UnregisterFormPanel?.(ref.instance);\n this.anchor.clear();\n this.mounted = [];\n }\n}\n"]}