@memberjunction/ng-base-forms 6.1.4 → 6.2.0-edge.1

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 (103) hide show
  1. package/dist/lib/base-form-component.d.ts.map +1 -1
  2. package/dist/lib/base-form-component.js +43 -40
  3. package/dist/lib/base-form-component.js.map +1 -1
  4. package/dist/lib/base-form-section-info.js +5 -5
  5. package/dist/lib/base-form-section-info.js.map +1 -1
  6. package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
  7. package/dist/lib/chrome/resolve-form-chrome.js +22 -12
  8. package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
  9. package/dist/lib/container/record-form-container.component.d.ts +24 -13
  10. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  11. package/dist/lib/container/record-form-container.component.js +233 -182
  12. package/dist/lib/container/record-form-container.component.js.map +1 -1
  13. package/dist/lib/explorer-entity-data-grid.component.d.ts +32 -2
  14. package/dist/lib/explorer-entity-data-grid.component.d.ts.map +1 -1
  15. package/dist/lib/explorer-entity-data-grid.component.js +54 -13
  16. package/dist/lib/explorer-entity-data-grid.component.js.map +1 -1
  17. package/dist/lib/field/default-fk-lookup-strategy.d.ts +60 -0
  18. package/dist/lib/field/default-fk-lookup-strategy.d.ts.map +1 -0
  19. package/dist/lib/field/default-fk-lookup-strategy.js +173 -0
  20. package/dist/lib/field/default-fk-lookup-strategy.js.map +1 -0
  21. package/dist/lib/field/fk-lookup-strategy.d.ts +124 -0
  22. package/dist/lib/field/fk-lookup-strategy.d.ts.map +1 -0
  23. package/dist/lib/field/fk-lookup-strategy.js +97 -0
  24. package/dist/lib/field/fk-lookup-strategy.js.map +1 -0
  25. package/dist/lib/field/fk-search-utils.d.ts +33 -2
  26. package/dist/lib/field/fk-search-utils.d.ts.map +1 -1
  27. package/dist/lib/field/fk-search-utils.js +56 -3
  28. package/dist/lib/field/fk-search-utils.js.map +1 -1
  29. package/dist/lib/field/form-field.component.d.ts +166 -11
  30. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  31. package/dist/lib/field/form-field.component.js +742 -338
  32. package/dist/lib/field/form-field.component.js.map +1 -1
  33. package/dist/lib/field/linked-field-options.d.ts +16 -0
  34. package/dist/lib/field/linked-field-options.d.ts.map +1 -1
  35. package/dist/lib/field/linked-field-options.js +17 -0
  36. package/dist/lib/field/linked-field-options.js.map +1 -1
  37. package/dist/lib/form-state.service.d.ts +58 -0
  38. package/dist/lib/form-state.service.d.ts.map +1 -1
  39. package/dist/lib/form-state.service.js +156 -40
  40. package/dist/lib/form-state.service.js.map +1 -1
  41. package/dist/lib/host/entity-form-host.component.d.ts +10 -2
  42. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
  43. package/dist/lib/host/entity-form-host.component.js +24 -8
  44. package/dist/lib/host/entity-form-host.component.js.map +1 -1
  45. package/dist/lib/interactive-form/interactive-form.component.d.ts +16 -4
  46. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
  47. package/dist/lib/interactive-form/interactive-form.component.js +38 -12
  48. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
  49. package/dist/lib/isa-related-panel/isa-related-card.component.d.ts +3 -3
  50. package/dist/lib/isa-related-panel/isa-related-card.component.d.ts.map +1 -1
  51. package/dist/lib/isa-related-panel/isa-related-card.component.js +12 -8
  52. package/dist/lib/isa-related-panel/isa-related-card.component.js.map +1 -1
  53. package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts +3 -3
  54. package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts.map +1 -1
  55. package/dist/lib/isa-related-panel/isa-related-panel.component.js +24 -7
  56. package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
  57. package/dist/lib/overlays/form-slide-in.component.d.ts +2 -0
  58. package/dist/lib/overlays/form-slide-in.component.d.ts.map +1 -1
  59. package/dist/lib/overlays/form-slide-in.component.js +5 -1
  60. package/dist/lib/overlays/form-slide-in.component.js.map +1 -1
  61. package/dist/lib/panel/collapsible-panel.component.d.ts +72 -9
  62. package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
  63. package/dist/lib/panel/collapsible-panel.component.js +185 -43
  64. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  65. package/dist/lib/panel-slot/base-form-panel.d.ts +2 -0
  66. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
  67. package/dist/lib/panel-slot/base-form-panel.js +5 -1
  68. package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
  69. package/dist/lib/panel-slot/form-contribution.d.ts +12 -0
  70. package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
  71. package/dist/lib/panel-slot/form-contribution.js +43 -10
  72. package/dist/lib/panel-slot/form-contribution.js.map +1 -1
  73. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +10 -0
  74. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
  75. package/dist/lib/panel-slot/form-slot-coordinator.service.js +25 -5
  76. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
  77. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
  78. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
  79. package/dist/lib/panel-slot/related-entity-grid-panel.component.js +5 -1
  80. package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
  81. package/dist/lib/section-indicators/form-section-field-host.d.ts +53 -0
  82. package/dist/lib/section-indicators/form-section-field-host.d.ts.map +1 -0
  83. package/dist/lib/section-indicators/form-section-field-host.js +23 -0
  84. package/dist/lib/section-indicators/form-section-field-host.js.map +1 -0
  85. package/dist/lib/section-loader-component.d.ts +5 -1
  86. package/dist/lib/section-loader-component.d.ts.map +1 -1
  87. package/dist/lib/section-loader-component.js +13 -5
  88. package/dist/lib/section-loader-component.js.map +1 -1
  89. package/dist/lib/section-manager/section-manager.component.d.ts +2 -2
  90. package/dist/lib/section-manager/section-manager.component.js +6 -6
  91. package/dist/lib/section-manager/section-manager.component.js.map +1 -1
  92. package/dist/lib/toolbar/form-toolbar.component.d.ts +5 -5
  93. package/dist/lib/toolbar/form-toolbar.component.js +22 -22
  94. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  95. package/dist/lib/types/form-types.d.ts +2 -0
  96. package/dist/lib/types/form-types.d.ts.map +1 -1
  97. package/dist/lib/types/form-types.js +5 -1
  98. package/dist/lib/types/form-types.js.map +1 -1
  99. package/dist/public-api.d.ts +3 -0
  100. package/dist/public-api.d.ts.map +1 -1
  101. package/dist/public-api.js +3 -0
  102. package/dist/public-api.js.map +1 -1
  103. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"form-contribution.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAqDpD,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAoC;IACvE,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC5C,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACtD,IAAI,MAAM,GAAG,SAAS;SACjB,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;SAC/D,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;SAClB,OAAO,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IACnE,IAAI,KAAK,C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AAI,CAAC;AAChB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,yBAAyB,CACrC,UAAkB,EAClB,eAAwD,EACxD,iBAAoC,EACpC,aAAsD;IAEtD,OAAO,6BAA6B,CAAC,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AACxG,CAAC","sourcesContent":["/**\n * Form contributions — pure resolve of what should appear on an entity form.\n *\n * A contribution is either a registered BaseFormPanel or the stock related-entity\n * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory\n * — the host queries registrations and feeds this.\n *\n * Section keys for related panels MUST match CodeGen's camelCase\n * (`angular-codegen.ts` `camelCase` + related-entity sectionKey). If they drift,\n * hide-baked and skip-baked miss and the user sees a double grid.\n */\nimport { UUIDsEqual } from '@memberjunction/global';\nimport { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';\n\n/** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */\nexport interface FormContributionRelationship {\n RelatedEntity: string;\n RelatedEntityID: string;\n RelatedEntityJoinField: string;\n DisplayInForm: boolean;\n DisplayName?: string | null;\n Sequence?: number | null;\n}\n\nexport interface FormContributionRegistration {\n Priority: number;\n Metadata: FormPanelRegistrationMetadata;\n}\n\nexport interface ResolveFormContributionsInput {\n EntityName: string;\n RelatedEntities: readonly FormContributionRelationship[];\n /** IS-A child entity IDs — CodeGen skips these (shown in the ISA side panel). */\n IsaChildEntityIDs: readonly string[];\n Registrations: readonly FormContributionRegistration[];\n /** SectionKeys already projected as Variant=\"related-entity\" in the form template. */\n BakedSectionKeys: readonly string[];\n ShowRelatedEntities: boolean;\n}\n\nexport type FormContributionKind = 'registered' | 'stock-grid';\n\nexport interface FormContributionWinner {\n ContributionKey: string;\n Slot: FormPanelSlot;\n SortKey: number;\n Priority: number;\n Kind: FormContributionKind;\n RelatedEntity?: string;\n RelatedJoinField?: string;\n /** Field/other section this registered winner asked to hide. */\n ReplacesSectionKey?: string;\n BakedSectionKey: string;\n DisplayName: string;\n}\n\nexport interface ResolveFormContributionsResult {\n Winners: FormContributionWinner[];\n /** CodeGen section keys to hide because a registered panel claimed them. */\n HiddenBakedSectionKeys: string[];\n /** Stock grids the host should mount (unclaimed and not already baked). */\n StockGrids: FormContributionWinner[];\n}\n\n/** Strip wrapping [] from a join field, matching CodeGen's tab-name helper. */\nexport function StripJoinFieldBrackets(joinField: string | null | undefined): string {\n return (joinField ?? '').trim().replace(/^\\[/, '').replace(/\\]$/, '');\n}\n\n/**\n * camelCase + identifier sanitize. Byte-compatible with\n * `CodeGenLib` `angular-codegen.ts` `camelCase` — do not \"improve\".\n */\nexport function FormSectionCamelCase(str: string): string {\n const sanitized = str.replace(/[^a-zA-Z0-9\\s]/g, ' ');\n let result = sanitized\n .replace(/\\s(.)/g, (_match, char: string) => char.toUpperCase())\n .replace(/\\s/g, '')\n .replace(/^(.)/, (_match, char: string) => char.toLowerCase());\n if (/^\\d/.test(result)) {\n result = '_' + result;\n }\n return result.length === 0 ? 'section' : result;\n}\n\nexport function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string {\n return `related:${relatedEntity.trim()}:${StripJoinFieldBrackets(joinField)}`;\n}\n\nexport function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string {\n if (meta.contributionKey && meta.contributionKey.trim().length > 0) {\n return meta.contributionKey.trim();\n }\n if (meta.relatedEntity && meta.relatedEntity.trim().length > 0) {\n return RelatedContributionKey(meta.relatedEntity, meta.relatedJoinField);\n }\n return '';\n}\n\n/**\n * SectionKey CodeGen emits for a related-entity panel. When more than one\n * DisplayInForm relationship points at the same entity, the join field is\n * appended so BillTo / ShipTo do not collide.\n */\nexport function RelatedEntitySectionKey(\n relationship: FormContributionRelationship,\n displayInFormPeers: readonly FormContributionRelationship[],\n): string {\n const sameEntity = displayInFormPeers.filter((peer) =>\n UUIDsEqual(peer.RelatedEntityID, relationship.RelatedEntityID),\n );\n if (sameEntity.length > 1) {\n return FormSectionCamelCase(\n `${relationship.RelatedEntity} ${StripJoinFieldBrackets(relationship.RelatedEntityJoinField)}`,\n );\n }\n return FormSectionCamelCase(relationship.RelatedEntity);\n}\n\nexport function RelationshipDisplayName(relationship: FormContributionRelationship): string {\n const named = relationship.DisplayName?.trim();\n const raw = named && named.length > 0 ? named : relationship.RelatedEntity;\n return raw.replace(/^[A-Za-z][A-Za-z0-9_]*:\\s+/, '').trim() || raw;\n}\n\nfunction isIsaChild(relationship: FormContributionRelationship, isaChildIds: readonly string[]): boolean {\n return isaChildIds.some((id) => UUIDsEqual(id, relationship.RelatedEntityID));\n}\n\nfunction visibleRelationships(\n related: readonly FormContributionRelationship[],\n isaChildIds: readonly string[],\n): FormContributionRelationship[] {\n const visible = related.filter((rel) => rel.DisplayInForm && !isIsaChild(rel, isaChildIds));\n return [...visible].sort((a, b) => {\n const aSeq = a.Sequence ?? 999999;\n const bSeq = b.Sequence ?? 999999;\n if (aSeq !== bSeq) return aSeq - bSeq;\n return a.RelatedEntity.localeCompare(b.RelatedEntity);\n });\n}\n\nfunction entityMatches(registeredEntity: string, formEntity: string): boolean {\n return registeredEntity === '*' || registeredEntity === formEntity;\n}\n\nfunction applicableRegistrations(\n entityName: string,\n registrations: readonly FormContributionRegistration[],\n): FormContributionRegistration[] {\n return registrations.filter((reg) => {\n const entity = reg.Metadata.entity;\n if (!entity || !entityMatches(entity, entityName)) return false;\n // A related claim on entity:'*' would hide that grid on every form.\n // Claims must name the form entity.\n // Related / field-section claims on entity:'*' would hide panels on every\n // form. Those claims must name the form entity.\n if ((reg.Metadata.relatedEntity || reg.Metadata.replacesSectionKey) && entity === '*') {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Last-wins collapse by contributionKey (or derived related key).\n * Highest Priority keeps the slot. Registrations without a key never collapse.\n */\nexport function CollapseFormPanelRegistrations<T extends { Priority: number; Metadata: FormPanelRegistrationMetadata }>(\n registrations: readonly T[],\n): T[] {\n const winners = new Map<string, T>();\n let uniqueIndex = 0;\n for (const reg of registrations) {\n const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;\n const incumbent = winners.get(key);\n if (!incumbent || reg.Priority > incumbent.Priority) {\n winners.set(key, reg);\n }\n }\n return [...winners.values()];\n}\n\nfunction collapseRegistrations(\n registrations: readonly FormContributionRegistration[],\n): Map<string, FormContributionRegistration> {\n const winners = new Map<string, FormContributionRegistration>();\n for (const reg of CollapseFormPanelRegistrations(registrations)) {\n const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;\n winners.set(key, reg);\n }\n return winners;\n}\n\nfunction stockWinner(\n relationship: FormContributionRelationship,\n peers: readonly FormContributionRelationship[],\n): FormContributionWinner {\n const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);\n return {\n ContributionKey: RelatedContributionKey(relationship.RelatedEntity, join),\n Slot: 'after-related',\n SortKey: -(relationship.Sequence ?? 0),\n Priority: 0,\n Kind: 'stock-grid',\n RelatedEntity: relationship.RelatedEntity,\n RelatedJoinField: join,\n BakedSectionKey: RelatedEntitySectionKey(relationship, peers),\n DisplayName: RelationshipDisplayName(relationship),\n };\n}\n\nfunction registeredWinner(\n key: string,\n reg: FormContributionRegistration,\n sectionKey: string,\n displayName: string,\n): FormContributionWinner {\n const meta = reg.Metadata;\n return {\n ContributionKey: key,\n Slot: meta.slot,\n SortKey: meta.sortKey ?? 0,\n Priority: reg.Priority,\n Kind: 'registered',\n RelatedEntity: meta.relatedEntity,\n RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,\n ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,\n BakedSectionKey: sectionKey,\n DisplayName: displayName,\n };\n}\n\nfunction sortWinners(winners: FormContributionWinner[]): FormContributionWinner[] {\n return [...winners].sort((a, b) => {\n if (a.SortKey !== b.SortKey) return b.SortKey - a.SortKey;\n if (a.Priority !== b.Priority) return b.Priority - a.Priority;\n return a.ContributionKey.localeCompare(b.ContributionKey);\n });\n}\n\n/**\n * Resolve what belongs on the form. Stock grids are only those the template\n * did not already bake and that no panel claimed.\n */\nexport function ResolveFormContributions(input: ResolveFormContributionsInput): ResolveFormContributionsResult {\n const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);\n const collapsed = collapseRegistrations(applicableRegistrations(input.EntityName, input.Registrations));\n const baked = new Set(input.BakedSectionKeys);\n\n const claimedKeys = new Set<string>();\n const registered: FormContributionWinner[] = [];\n for (const [key, reg] of collapsed) {\n const related = reg.Metadata.relatedEntity?.trim();\n const peer = related\n ? peers.find((rel) => {\n if (rel.RelatedEntity !== related) return false;\n const wantJoin = StripJoinFieldBrackets(reg.Metadata.relatedJoinField);\n if (!wantJoin) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === wantJoin;\n })\n : undefined;\n const sectionKey = peer ? RelatedEntitySectionKey(peer, peers) : '';\n if (related) {\n claimedKeys.add(key);\n // A claim that omits the join field covers every FK to that entity.\n if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {\n for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {\n claimedKeys.add(RelatedContributionKey(match.RelatedEntity, match.RelatedEntityJoinField));\n }\n }\n }\n registered.push(\n registeredWinner(key, reg, sectionKey, peer ? RelationshipDisplayName(peer) : related ?? key),\n );\n }\n\n const hiddenBaked: string[] = [];\n const stock: FormContributionWinner[] = [];\n if (input.ShowRelatedEntities) {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = RelatedEntitySectionKey(rel, peers);\n if (claimedKeys.has(key)) {\n if (baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n continue;\n }\n if (baked.has(sectionKey)) continue;\n stock.push(stockWinner(rel, peers));\n }\n } else {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = RelatedEntitySectionKey(rel, peers);\n if (claimedKeys.has(key) && baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n }\n }\n\n return {\n Winners: sortWinners([...registered, ...stock]),\n HiddenBakedSectionKeys: hiddenBaked,\n StockGrids: sortWinners(stock),\n };\n}\n\n/** Section keys a form should hide because a winning contribution claimed them. */\nexport function ContributionHiddenSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n const resolved = ResolveFormContributions({\n EntityName: entityName,\n RelatedEntities: relatedEntities,\n IsaChildEntityIDs: isaChildEntityIDs,\n Registrations: registrations,\n BakedSectionKeys: [],\n ShowRelatedEntities: true,\n });\n const peers = visibleRelationships(relatedEntities, isaChildEntityIDs);\n const keys: string[] = [];\n for (const winner of resolved.Winners) {\n if (winner.Kind !== 'registered') continue;\n if (winner.ReplacesSectionKey) keys.push(winner.ReplacesSectionKey);\n if (!winner.RelatedEntity) continue;\n const peer = peers.find((rel) => {\n if (rel.RelatedEntity !== winner.RelatedEntity) return false;\n if (!winner.RelatedJoinField) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === winner.RelatedJoinField;\n });\n if (peer) keys.push(RelatedEntitySectionKey(peer, peers));\n }\n return keys;\n}\n\n/** @deprecated Use {@link ContributionHiddenSectionKeys}. */\nexport function ClaimedRelatedSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);\n}\n"]}
1
+ {"version":3,"file":"form-contribution.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAqDnE,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,SAAoC;IACvE,OAAO,CAAC,SAAS,IAAI,EA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sB,CAAC,GAAG,CAAC,sBAAsB,CAAC,KAAK,MAAM,CAAC,gBAAgB,CAAC;QAC1F,CAAC,CAAC,CAAC;QACH,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,yBAAyB,CACrC,UAAkB,EAClB,eAAwD,EACxD,iBAAoC,EACpC,aAAsD;IAEtD,OAAO,6BAA6B,CAAC,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAAC;AACxG,CAAC","sourcesContent":["/**\n * Form contributions — pure resolve of what should appear on an entity form.\n *\n * A contribution is either a registered BaseFormPanel or the stock related-entity\n * grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory\n * — the host queries registrations and feeds this.\n *\n * Section keys for related panels MUST match CodeGen's camelCase\n * (`angular-codegen.ts` `camelCase` + related-entity sectionKey). If they drift,\n * hide-baked and skip-baked miss and the user sees a double grid.\n */\nimport { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';\nimport { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';\n\n/** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */\nexport interface FormContributionRelationship {\n RelatedEntity: string;\n RelatedEntityID: string;\n RelatedEntityJoinField: string;\n DisplayInForm: boolean;\n DisplayName?: string | null;\n Sequence?: number | null;\n}\n\nexport interface FormContributionRegistration {\n Priority: number;\n Metadata: FormPanelRegistrationMetadata;\n}\n\nexport interface ResolveFormContributionsInput {\n EntityName: string;\n RelatedEntities: readonly FormContributionRelationship[];\n /** IS-A child entity IDs — CodeGen skips these (shown in the ISA side panel). */\n IsaChildEntityIDs: readonly string[];\n Registrations: readonly FormContributionRegistration[];\n /** SectionKeys already projected as Variant=\"related-entity\" in the form template. */\n BakedSectionKeys: readonly string[];\n ShowRelatedEntities: boolean;\n}\n\nexport type FormContributionKind = 'registered' | 'stock-grid';\n\nexport interface FormContributionWinner {\n ContributionKey: string;\n Slot: FormPanelSlot;\n SortKey: number;\n Priority: number;\n Kind: FormContributionKind;\n RelatedEntity?: string;\n RelatedJoinField?: string;\n /** Field/other section this registered winner asked to hide. */\n ReplacesSectionKey?: string;\n BakedSectionKey: string;\n DisplayName: string;\n}\n\nexport interface ResolveFormContributionsResult {\n Winners: FormContributionWinner[];\n /** CodeGen section keys to hide because a registered panel claimed them. */\n HiddenBakedSectionKeys: string[];\n /** Stock grids the host should mount (unclaimed and not already baked). */\n StockGrids: FormContributionWinner[];\n}\n\n/** Strip wrapping [] from a join field, matching CodeGen's tab-name helper. */\nexport function StripJoinFieldBrackets(joinField: string | null | undefined): string {\n return (joinField ?? '').trim().replace(/^\\[/, '').replace(/\\]$/, '');\n}\n\n/**\n * camelCase + identifier sanitize. Byte-compatible with\n * `CodeGenLib` `angular-codegen.ts` `camelCase` — do not \"improve\".\n */\nexport function FormSectionCamelCase(str: string): string {\n const sanitized = str.replace(/[^a-zA-Z0-9\\s]/g, ' ');\n let result = sanitized\n .replace(/\\s(.)/g, (_match, char: string) => char.toUpperCase())\n .replace(/\\s/g, '')\n .replace(/^(.)/, (_match, char: string) => char.toLowerCase());\n if (/^\\d/.test(result)) {\n result = '_' + result;\n }\n return result.length === 0 ? 'section' : result;\n}\n\nexport function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string {\n return `related:${relatedEntity.trim()}:${StripJoinFieldBrackets(joinField)}`;\n}\n\nexport function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string {\n if (meta.contributionKey && meta.contributionKey.trim().length > 0) {\n return meta.contributionKey.trim();\n }\n if (meta.relatedEntity && meta.relatedEntity.trim().length > 0) {\n return RelatedContributionKey(meta.relatedEntity, meta.relatedJoinField);\n }\n return '';\n}\n\n/**\n * SectionKey CodeGen emits for a related-entity panel. When more than one\n * DisplayInForm relationship points at the same entity, the join field is\n * appended so BillTo / ShipTo do not collide.\n */\nexport function RelatedEntitySectionKey(\n relationship: FormContributionRelationship,\n displayInFormPeers: readonly FormContributionRelationship[],\n): string {\n // Normalize the target once and stop at the second match. UUIDsEqual's `===` fast path\n // misses on every peer that points elsewhere, so a filter over UUIDsEqual lowercases both\n // sides of every comparison. To key many relationships against the same peers, use\n // CreateRelatedEntitySectionKeyResolver instead.\n const target = NormalizeUUID(relationship.RelatedEntityID);\n let sameEntityCount = 0;\n for (const peer of displayInFormPeers) {\n if (NormalizeUUID(peer.RelatedEntityID) === target && ++sameEntityCount > 1) break;\n }\n return relatedSectionKey(relationship, sameEntityCount > 1);\n}\n\nfunction relatedSectionKey(relationship: FormContributionRelationship, sharesRelatedEntity: boolean): string {\n if (sharesRelatedEntity) {\n return FormSectionCamelCase(\n `${relationship.RelatedEntity} ${StripJoinFieldBrackets(relationship.RelatedEntityJoinField)}`,\n );\n }\n return FormSectionCamelCase(relationship.RelatedEntity);\n}\n\n/**\n * Builds a function that returns {@link RelatedEntitySectionKey}`(relationship, displayInFormPeers)`\n * for any relationship, against the ONE peer set passed here. Build it once per peer set, then\n * call it once per relationship. The relationship does not have to be in the peer set; it is keyed\n * by how many peers share its related entity.\n *\n * Building counts each related entity once, so keying all n peers is O(n). Calling\n * RelatedEntitySectionKey per peer is O(n²), which on an entity with ~150 DisplayInForm\n * relationships (MJ: Users), resolved on every change-detection pass, pegged a CPU core.\n * The returned function reflects the peers as they were when it was built.\n */\nexport function CreateRelatedEntitySectionKeyResolver(\n displayInFormPeers: readonly FormContributionRelationship[],\n): (relationship: FormContributionRelationship) => string {\n const countByEntityID = new Map<string, number>();\n for (const peer of displayInFormPeers) {\n const id = NormalizeUUID(peer.RelatedEntityID);\n countByEntityID.set(id, (countByEntityID.get(id) ?? 0) + 1);\n }\n return (relationship) =>\n relatedSectionKey(relationship, (countByEntityID.get(NormalizeUUID(relationship.RelatedEntityID)) ?? 0) > 1);\n}\n\nexport function RelationshipDisplayName(relationship: FormContributionRelationship): string {\n const named = relationship.DisplayName?.trim();\n const raw = named && named.length > 0 ? named : relationship.RelatedEntity;\n return raw.replace(/^[A-Za-z][A-Za-z0-9_]*:\\s+/, '').trim() || raw;\n}\n\nfunction isIsaChild(relationship: FormContributionRelationship, isaChildIds: readonly string[]): boolean {\n return isaChildIds.some((id) => UUIDsEqual(id, relationship.RelatedEntityID));\n}\n\nfunction visibleRelationships(\n related: readonly FormContributionRelationship[],\n isaChildIds: readonly string[],\n): FormContributionRelationship[] {\n const visible = related.filter((rel) => rel.DisplayInForm && !isIsaChild(rel, isaChildIds));\n return [...visible].sort((a, b) => {\n const aSeq = a.Sequence ?? 999999;\n const bSeq = b.Sequence ?? 999999;\n if (aSeq !== bSeq) return aSeq - bSeq;\n return a.RelatedEntity.localeCompare(b.RelatedEntity);\n });\n}\n\nfunction entityMatches(registeredEntity: string, formEntity: string): boolean {\n return registeredEntity === '*' || registeredEntity === formEntity;\n}\n\nfunction applicableRegistrations(\n entityName: string,\n registrations: readonly FormContributionRegistration[],\n): FormContributionRegistration[] {\n return registrations.filter((reg) => {\n const entity = reg.Metadata.entity;\n if (!entity || !entityMatches(entity, entityName)) return false;\n // A related claim on entity:'*' would hide that grid on every form.\n // Claims must name the form entity.\n // Related / field-section claims on entity:'*' would hide panels on every\n // form. Those claims must name the form entity.\n if ((reg.Metadata.relatedEntity || reg.Metadata.replacesSectionKey) && entity === '*') {\n return false;\n }\n return true;\n });\n}\n\n/**\n * Last-wins collapse by contributionKey (or derived related key).\n * Highest Priority keeps the slot. Registrations without a key never collapse.\n */\nexport function CollapseFormPanelRegistrations<T extends { Priority: number; Metadata: FormPanelRegistrationMetadata }>(\n registrations: readonly T[],\n): T[] {\n const winners = new Map<string, T>();\n let uniqueIndex = 0;\n for (const reg of registrations) {\n const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;\n const incumbent = winners.get(key);\n if (!incumbent || reg.Priority > incumbent.Priority) {\n winners.set(key, reg);\n }\n }\n return [...winners.values()];\n}\n\nfunction collapseRegistrations(\n registrations: readonly FormContributionRegistration[],\n): Map<string, FormContributionRegistration> {\n const winners = new Map<string, FormContributionRegistration>();\n for (const reg of CollapseFormPanelRegistrations(registrations)) {\n const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;\n winners.set(key, reg);\n }\n return winners;\n}\n\nfunction stockWinner(relationship: FormContributionRelationship, sectionKey: string): FormContributionWinner {\n const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);\n return {\n ContributionKey: RelatedContributionKey(relationship.RelatedEntity, join),\n Slot: 'after-related',\n SortKey: -(relationship.Sequence ?? 0),\n Priority: 0,\n Kind: 'stock-grid',\n RelatedEntity: relationship.RelatedEntity,\n RelatedJoinField: join,\n BakedSectionKey: sectionKey,\n DisplayName: RelationshipDisplayName(relationship),\n };\n}\n\nfunction registeredWinner(\n key: string,\n reg: FormContributionRegistration,\n sectionKey: string,\n displayName: string,\n): FormContributionWinner {\n const meta = reg.Metadata;\n return {\n ContributionKey: key,\n Slot: meta.slot,\n SortKey: meta.sortKey ?? 0,\n Priority: reg.Priority,\n Kind: 'registered',\n RelatedEntity: meta.relatedEntity,\n RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,\n ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,\n BakedSectionKey: sectionKey,\n DisplayName: displayName,\n };\n}\n\nfunction sortWinners(winners: FormContributionWinner[]): FormContributionWinner[] {\n return [...winners].sort((a, b) => {\n if (a.SortKey !== b.SortKey) return b.SortKey - a.SortKey;\n if (a.Priority !== b.Priority) return b.Priority - a.Priority;\n return a.ContributionKey.localeCompare(b.ContributionKey);\n });\n}\n\n/**\n * Resolve what belongs on the form. Stock grids are only those the template\n * did not already bake and that no panel claimed.\n */\nexport function ResolveFormContributions(input: ResolveFormContributionsInput): ResolveFormContributionsResult {\n const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);\n const collapsed = collapseRegistrations(applicableRegistrations(input.EntityName, input.Registrations));\n const baked = new Set(input.BakedSectionKeys);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n\n const claimedKeys = new Set<string>();\n const registered: FormContributionWinner[] = [];\n for (const [key, reg] of collapsed) {\n const related = reg.Metadata.relatedEntity?.trim();\n const peer = related\n ? peers.find((rel) => {\n if (rel.RelatedEntity !== related) return false;\n const wantJoin = StripJoinFieldBrackets(reg.Metadata.relatedJoinField);\n if (!wantJoin) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === wantJoin;\n })\n : undefined;\n const sectionKey = peer ? sectionKeyOf(peer) : '';\n if (related) {\n claimedKeys.add(key);\n // A claim that omits the join field covers every FK to that entity.\n if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {\n for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {\n claimedKeys.add(RelatedContributionKey(match.RelatedEntity, match.RelatedEntityJoinField));\n }\n }\n }\n registered.push(\n registeredWinner(key, reg, sectionKey, peer ? RelationshipDisplayName(peer) : related ?? key),\n );\n }\n\n const hiddenBaked: string[] = [];\n const stock: FormContributionWinner[] = [];\n if (input.ShowRelatedEntities) {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key)) {\n if (baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n continue;\n }\n if (baked.has(sectionKey)) continue;\n stock.push(stockWinner(rel, sectionKey));\n }\n } else {\n for (const rel of peers) {\n const key = RelatedContributionKey(rel.RelatedEntity, rel.RelatedEntityJoinField);\n const sectionKey = sectionKeyOf(rel);\n if (claimedKeys.has(key) && baked.has(sectionKey)) hiddenBaked.push(sectionKey);\n }\n }\n\n return {\n Winners: sortWinners([...registered, ...stock]),\n HiddenBakedSectionKeys: hiddenBaked,\n StockGrids: sortWinners(stock),\n };\n}\n\n/** Section keys a form should hide because a winning contribution claimed them. */\nexport function ContributionHiddenSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n const resolved = ResolveFormContributions({\n EntityName: entityName,\n RelatedEntities: relatedEntities,\n IsaChildEntityIDs: isaChildEntityIDs,\n Registrations: registrations,\n BakedSectionKeys: [],\n ShowRelatedEntities: true,\n });\n const peers = visibleRelationships(relatedEntities, isaChildEntityIDs);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);\n const keys: string[] = [];\n for (const winner of resolved.Winners) {\n if (winner.Kind !== 'registered') continue;\n if (winner.ReplacesSectionKey) keys.push(winner.ReplacesSectionKey);\n if (!winner.RelatedEntity) continue;\n const peer = peers.find((rel) => {\n if (rel.RelatedEntity !== winner.RelatedEntity) return false;\n if (!winner.RelatedJoinField) return true;\n return StripJoinFieldBrackets(rel.RelatedEntityJoinField) === winner.RelatedJoinField;\n });\n if (peer) keys.push(sectionKeyOf(peer));\n }\n return keys;\n}\n\n/** @deprecated Use {@link ContributionHiddenSectionKeys}. */\nexport function ClaimedRelatedSectionKeys(\n entityName: string,\n relatedEntities: readonly FormContributionRelationship[],\n isaChildEntityIDs: readonly string[],\n registrations: readonly FormContributionRegistration[],\n): string[] {\n return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);\n}\n"]}
@@ -29,9 +29,15 @@ export declare class FormSlotCoordinator {
29
29
  * caused by a future refactor surfaces loudly instead of freezing. */
30
30
  private emitDepth;
31
31
  /** Slot host calls this on init. Idempotent — safe if invoked twice. */
32
+ RegisterSlot(slot: FormPanelSlot): void;
33
+ /** @deprecated Use {@link RegisterSlot}. */
32
34
  registerSlot(slot: FormPanelSlot): void;
33
35
  /** Slot host calls this on destroy. */
36
+ DeregisterSlot(slot: FormPanelSlot): void;
37
+ /** @deprecated Use {@link DeregisterSlot}. */
34
38
  deregisterSlot(slot: FormPanelSlot): void;
39
+ HasSlot(slot: FormPanelSlot): boolean;
40
+ /** @deprecated Use {@link HasSlot}. */
35
41
  hasSlot(slot: FormPanelSlot): boolean;
36
42
  /**
37
43
  * Resolve a preferred slot to the slot that should ACTUALLY render the
@@ -42,8 +48,12 @@ export declare class FormSlotCoordinator {
42
48
  * present — the container guarantees `after-everything` exists, so this
43
49
  * should never happen in practice.
44
50
  */
51
+ ResolveSlot(preferred: FormPanelSlot): FormPanelSlot | null;
52
+ /** @deprecated Use {@link ResolveSlot}. */
45
53
  resolveSlot(preferred: FormPanelSlot): FormPanelSlot | null;
46
54
  /** RxJS stream that fires whenever a slot registers or deregisters. */
55
+ get Changes(): import("rxjs").Observable<void>;
56
+ /** @deprecated Use {@link Changes}. */
47
57
  get changes(): import("rxjs").Observable<void>;
48
58
  /**
49
59
  * Emit with re-entrancy detection. If we're already in the middle of an
@@ -1 +1 @@
1
- {"version":3,"file":"form-slot-coordinator.service.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-slot-coordinator.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EAM1C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD;2EACuE;IACvE,OAAO,CAAC,SAAS,CAAK;IAEtB,wEAAwE;IACjE,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAO9C,uCAAuC;IAChC,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAOzC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAI5C;;;;;;;;OAQG;IACI,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI;IAYlE,uEAAuE;IACvE,IAAW,OAAO,oCAEjB;IAED;;;;OAIG;IACH,OAAO,CAAC,QAAQ;yCA1DP,mBAAmB;6CAAnB,mBAAmB;CAsE/B"}
1
+ {"version":3,"file":"form-slot-coordinator.service.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-slot-coordinator.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,EAM1C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAuB;IAChD;2EACuE;IACvE,OAAO,CAAC,SAAS,CAAK;IAEtB,wEAAwE;IACjE,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAO9C,4CAA4C;IACrC,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAI9C,uCAAuC;IAChC,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAOhD,8CAA8C;IACvC,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAIzC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAI5C,uCAAuC;IAChC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAI5C;;;;;;;;OAQG;IACI,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI;IAYlE,2CAA2C;IACpC,WAAW,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI;IAIlE,uEAAuE;IACvE,IAAW,OAAO,oCAEjB;IAED,uCAAuC;IACvC,IAAW,OAAO,oCAEjB;IAED;;;;OAIG;IACH,OAAO,CAAC,QAAQ;yCAnFP,mBAAmB;6CAAnB,mBAAmB;CA+F/B"}
@@ -36,22 +36,34 @@ export class FormSlotCoordinator {
36
36
  * caused by a future refactor surfaces loudly instead of freezing. */
37
37
  emitDepth = 0;
38
38
  /** Slot host calls this on init. Idempotent — safe if invoked twice. */
39
- registerSlot(slot) {
39
+ RegisterSlot(slot) {
40
40
  if (!this.presentSlots.has(slot)) {
41
41
  this.presentSlots.add(slot);
42
42
  this.safeEmit('registerSlot');
43
43
  }
44
44
  }
45
+ /** @deprecated Use {@link RegisterSlot}. */
46
+ registerSlot(slot) {
47
+ return this.RegisterSlot(slot);
48
+ }
45
49
  /** Slot host calls this on destroy. */
46
- deregisterSlot(slot) {
50
+ DeregisterSlot(slot) {
47
51
  if (this.presentSlots.has(slot)) {
48
52
  this.presentSlots.delete(slot);
49
53
  this.safeEmit('deregisterSlot');
50
54
  }
51
55
  }
52
- hasSlot(slot) {
56
+ /** @deprecated Use {@link DeregisterSlot}. */
57
+ deregisterSlot(slot) {
58
+ return this.DeregisterSlot(slot);
59
+ }
60
+ HasSlot(slot) {
53
61
  return this.presentSlots.has(slot);
54
62
  }
63
+ /** @deprecated Use {@link HasSlot}. */
64
+ hasSlot(slot) {
65
+ return this.HasSlot(slot);
66
+ }
55
67
  /**
56
68
  * Resolve a preferred slot to the slot that should ACTUALLY render the
57
69
  * panel. Returns the preferred slot if it's present; otherwise walks
@@ -61,7 +73,7 @@ export class FormSlotCoordinator {
61
73
  * present — the container guarantees `after-everything` exists, so this
62
74
  * should never happen in practice.
63
75
  */
64
- resolveSlot(preferred) {
76
+ ResolveSlot(preferred) {
65
77
  const startIdx = FORM_SLOT_CHAIN.indexOf(preferred);
66
78
  if (startIdx === -1)
67
79
  return null;
@@ -73,10 +85,18 @@ export class FormSlotCoordinator {
73
85
  }
74
86
  return null;
75
87
  }
88
+ /** @deprecated Use {@link ResolveSlot}. */
89
+ resolveSlot(preferred) {
90
+ return this.ResolveSlot(preferred);
91
+ }
76
92
  /** RxJS stream that fires whenever a slot registers or deregisters. */
77
- get changes() {
93
+ get Changes() {
78
94
  return this.changes$.asObservable();
79
95
  }
96
+ /** @deprecated Use {@link Changes}. */
97
+ get changes() {
98
+ return this.Changes;
99
+ }
80
100
  /**
81
101
  * Emit with re-entrancy detection. If we're already in the middle of an
82
102
  * emit (i.e., a subscriber triggered another emit), log loudly so the loop
@@ -1 +1 @@
1
- {"version":3,"file":"form-slot-coordinator.service.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-slot-coordinator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;;AAG/B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC5C,UAAU;IACV,eAAe;IACf,cAAc;IACd,eAAe;IACf,kBAAkB;CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,mBAAmB;IACX,YAAY,GAAG,IAAI,GAAG,EAAiB,CAAC;IACxC,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;IAChD;2EACuE;IAC/D,SAAS,GAAG,CAAC,CAAC;IAEtB,wEAAwE;IACjE,YAAY,CAAC,IAAmB;QACnC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAED,uCAAuC;IAChC,cAAc,CAAC,IAAmB;QACrC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAEM,OAAO,CAAC,IAAmB;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACI,WAAW,CAAC,SAAwB;QACvC,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,QAAQ,KAAK,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrD,MAAM,SAAS,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;YACrC,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACnC,OAAO,SAAS,CAAC;YACrB,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,uEAAuE;IACvE,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACK,QAAQ,CAAC,KAAa;QAC1B,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,oDAAoD,IAAI,CAAC,SAAS,SAAS,KAAK,kCAAkC,CAAC,CAAC;YAClI,OAAO;QACX,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACL,CAAC;6GArEQ,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB;;iFAAnB,mBAAmB;cAD/B,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { FormPanelSlot } from './base-form-panel';\n\n/**\n * Document-order chain used by the slot host to figure out where to render a\n * panel whose preferred slot is missing in the current form. Walks forward:\n * a panel registered for `after-fields` looks for the next existing slot down\n * the chain (`after-related`, then `after-everything`) until it finds one.\n *\n * The chain is intentionally short — these are the only positions any panel\n * should ever need. New positions can be added by inserting into this array\n * at the right document-order position.\n */\nexport const FORM_SLOT_CHAIN: FormPanelSlot[] = [\n 'top-area',\n 'before-fields',\n 'after-fields',\n 'after-related',\n 'after-everything',\n];\n\n/**\n * Per-form coordinator that tracks which slot positions are physically present\n * in the current form's DOM. Provided at the `<mj-record-form-container>` level\n * (one instance per form) so descendant slot hosts can register themselves and\n * compute the fallback chain.\n *\n * The container template guarantees an `after-everything` slot host at the very\n * bottom of the form body — so panels whose preferred slot is missing always\n * have a final landing spot. Pre-CodeGen-regen forms still display every\n * panel; post-regen forms display them at the better position.\n */\n@Injectable()\nexport class FormSlotCoordinator {\n private readonly presentSlots = new Set<FormPanelSlot>();\n private readonly changes$ = new Subject<void>();\n /** Tracks synchronous re-entry depth into safeEmit so an emit storm\n * caused by a future refactor surfaces loudly instead of freezing. */\n private emitDepth = 0;\n\n /** Slot host calls this on init. Idempotent — safe if invoked twice. */\n public registerSlot(slot: FormPanelSlot): void {\n if (!this.presentSlots.has(slot)) {\n this.presentSlots.add(slot);\n this.safeEmit('registerSlot');\n }\n }\n\n /** Slot host calls this on destroy. */\n public deregisterSlot(slot: FormPanelSlot): void {\n if (this.presentSlots.has(slot)) {\n this.presentSlots.delete(slot);\n this.safeEmit('deregisterSlot');\n }\n }\n\n public hasSlot(slot: FormPanelSlot): boolean {\n return this.presentSlots.has(slot);\n }\n\n /**\n * Resolve a preferred slot to the slot that should ACTUALLY render the\n * panel. Returns the preferred slot if it's present; otherwise walks\n * forward in the chain to find the next existing slot.\n *\n * Returns null only in the (impossible) case where no slot at all is\n * present — the container guarantees `after-everything` exists, so this\n * should never happen in practice.\n */\n public resolveSlot(preferred: FormPanelSlot): FormPanelSlot | null {\n const startIdx = FORM_SLOT_CHAIN.indexOf(preferred);\n if (startIdx === -1) return null;\n for (let i = startIdx; i < FORM_SLOT_CHAIN.length; i++) {\n const candidate = FORM_SLOT_CHAIN[i];\n if (this.presentSlots.has(candidate)) {\n return candidate;\n }\n }\n return null;\n }\n\n /** RxJS stream that fires whenever a slot registers or deregisters. */\n public get changes() {\n return this.changes$.asObservable();\n }\n\n /**\n * Emit with re-entrancy detection. If we're already in the middle of an\n * emit (i.e., a subscriber triggered another emit), log loudly so the loop\n * is visible in the console instead of silently freezing the browser.\n */\n private safeEmit(cause: string): void {\n if (this.emitDepth > 10) {\n console.error(`[FormSlotCoordinator] LOOP DETECTED — emit depth ${this.emitDepth} from ${cause}. Bailing out to prevent freeze.`);\n return;\n }\n this.emitDepth++;\n try {\n this.changes$.next();\n } finally {\n this.emitDepth--;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"form-slot-coordinator.service.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-slot-coordinator.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;;AAG/B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC5C,UAAU;IACV,eAAe;IACf,cAAc;IACd,eAAe;IACf,kBAAkB;CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,MAAM,OAAO,mBAAmB;IACX,YAAY,GAAG,IAAI,GAAG,EAAiB,CAAC;IACxC,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;IAChD;2EACuE;IAC/D,SAAS,GAAG,CAAC,CAAC;IAEtB,wEAAwE;IACjE,YAAY,CAAC,IAAmB;QACnC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAED,4CAA4C;IACrC,YAAY,CAAC,IAAmB;QAC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ACvE,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IACxC,CAAC;IAED,uCAAuC;IACvC,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACK,QAAQ,CAAC,KAAa;QAC1B,IAAI,IAAI,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,oDAAoD,IAAI,CAAC,SAAS,SAAS,KAAK,kCAAkC,CAAC,CAAC;YAClI,OAAO;QACX,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,CAAC;YACD,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACL,CAAC;6GA9FQ,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB;;iFAAnB,mBAAmB;cAD/B,UAAU","sourcesContent":["import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { FormPanelSlot } from './base-form-panel';\n\n/**\n * Document-order chain used by the slot host to figure out where to render a\n * panel whose preferred slot is missing in the current form. Walks forward:\n * a panel registered for `after-fields` looks for the next existing slot down\n * the chain (`after-related`, then `after-everything`) until it finds one.\n *\n * The chain is intentionally short — these are the only positions any panel\n * should ever need. New positions can be added by inserting into this array\n * at the right document-order position.\n */\nexport const FORM_SLOT_CHAIN: FormPanelSlot[] = [\n 'top-area',\n 'before-fields',\n 'after-fields',\n 'after-related',\n 'after-everything',\n];\n\n/**\n * Per-form coordinator that tracks which slot positions are physically present\n * in the current form's DOM. Provided at the `<mj-record-form-container>` level\n * (one instance per form) so descendant slot hosts can register themselves and\n * compute the fallback chain.\n *\n * The container template guarantees an `after-everything` slot host at the very\n * bottom of the form body — so panels whose preferred slot is missing always\n * have a final landing spot. Pre-CodeGen-regen forms still display every\n * panel; post-regen forms display them at the better position.\n */\n@Injectable()\nexport class FormSlotCoordinator {\n private readonly presentSlots = new Set<FormPanelSlot>();\n private readonly changes$ = new Subject<void>();\n /** Tracks synchronous re-entry depth into safeEmit so an emit storm\n * caused by a future refactor surfaces loudly instead of freezing. */\n private emitDepth = 0;\n\n /** Slot host calls this on init. Idempotent — safe if invoked twice. */\n public RegisterSlot(slot: FormPanelSlot): void {\n if (!this.presentSlots.has(slot)) {\n this.presentSlots.add(slot);\n this.safeEmit('registerSlot');\n }\n }\n\n /** @deprecated Use {@link RegisterSlot}. */\n public registerSlot(slot: FormPanelSlot): void {\n return this.RegisterSlot(slot);\n }\n\n /** Slot host calls this on destroy. */\n public DeregisterSlot(slot: FormPanelSlot): void {\n if (this.presentSlots.has(slot)) {\n this.presentSlots.delete(slot);\n this.safeEmit('deregisterSlot');\n }\n }\n\n /** @deprecated Use {@link DeregisterSlot}. */\n public deregisterSlot(slot: FormPanelSlot): void {\n return this.DeregisterSlot(slot);\n }\n\n public HasSlot(slot: FormPanelSlot): boolean {\n return this.presentSlots.has(slot);\n }\n\n /** @deprecated Use {@link HasSlot}. */\n public hasSlot(slot: FormPanelSlot): boolean {\n return this.HasSlot(slot);\n }\n\n /**\n * Resolve a preferred slot to the slot that should ACTUALLY render the\n * panel. Returns the preferred slot if it's present; otherwise walks\n * forward in the chain to find the next existing slot.\n *\n * Returns null only in the (impossible) case where no slot at all is\n * present — the container guarantees `after-everything` exists, so this\n * should never happen in practice.\n */\n public ResolveSlot(preferred: FormPanelSlot): FormPanelSlot | null {\n const startIdx = FORM_SLOT_CHAIN.indexOf(preferred);\n if (startIdx === -1) return null;\n for (let i = startIdx; i < FORM_SLOT_CHAIN.length; i++) {\n const candidate = FORM_SLOT_CHAIN[i];\n if (this.presentSlots.has(candidate)) {\n return candidate;\n }\n }\n return null;\n }\n\n /** @deprecated Use {@link ResolveSlot}. */\n public resolveSlot(preferred: FormPanelSlot): FormPanelSlot | null {\n return this.ResolveSlot(preferred);\n }\n\n /** RxJS stream that fires whenever a slot registers or deregisters. */\n public get Changes() {\n return this.changes$.asObservable();\n }\n\n /** @deprecated Use {@link Changes}. */\n public get changes() {\n return this.Changes;\n }\n\n /**\n * Emit with re-entrancy detection. If we're already in the middle of an\n * emit (i.e., a subscriber triggered another emit), log loudly so the loop\n * is visible in the console instead of silently freezing the browser.\n */\n private safeEmit(cause: string): void {\n if (this.emitDepth > 10) {\n console.error(`[FormSlotCoordinator] LOOP DETECTED — emit depth ${this.emitDepth} from ${cause}. Bailing out to prevent freeze.`);\n return;\n }\n this.emitDepth++;\n try {\n this.changes$.next();\n } finally {\n this.emitDepth--;\n }\n }\n}\n"]}
@@ -14,6 +14,8 @@ export declare class RelatedEntityGridPanelComponent {
14
14
  Record: BaseEntity;
15
15
  FormComponent: BaseFormComponent;
16
16
  FormContext?: FormContext;
17
+ OnDataLoad(event: AfterDataLoadEventArgs): void;
18
+ /** @deprecated Use {@link OnDataLoad}. */
17
19
  onDataLoad(event: AfterDataLoadEventArgs): void;
18
20
  get GridIcon(): string;
19
21
  static ɵfac: i0.ɵɵFactoryDeclaration<RelatedEntityGridPanelComponent, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"related-entity-grid-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/related-entity-grid-panel.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;;AAElE;;;;GAIG;AACH,qBA0Ba,+BAA+B;IAC/B,YAAY,EAAG,sBAAsB,CAAC;IACtC,MAAM,EAAG,UAAU,CAAC;IACpB,aAAa,EAAG,iBAAiB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE5B,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAItD,IAAW,QAAQ,IAAI,MAAM,CAK5B;yCAfQ,+BAA+B;2CAA/B,+BAA+B;CAgB3C"}
1
+ {"version":3,"file":"related-entity-grid-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/related-entity-grid-panel.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;;AAElE;;;;GAIG;AACH,qBA0Ba,+BAA+B;IAC/B,YAAY,EAAG,sBAAsB,CAAC;IACtC,MAAM,EAAG,UAAU,CAAC;IACpB,aAAa,EAAG,iBAAiB,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAE5B,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAItD,0CAA0C;IACnC,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAItD,IAAW,QAAQ,IAAI,MAAM,CAK5B;yCApBQ,+BAA+B;2CAA/B,+BAA+B;CAqB3C"}
@@ -21,9 +21,13 @@ export class RelatedEntityGridPanelComponent {
21
21
  Record;
22
22
  FormComponent;
23
23
  FormContext;
24
- onDataLoad(event) {
24
+ OnDataLoad(event) {
25
25
  this.FormComponent.SetSectionRowCount(this.Contribution.BakedSectionKey, event.totalRowCount);
26
26
  }
27
+ /** @deprecated Use {@link OnDataLoad}. */
28
+ onDataLoad(event) {
29
+ return this.OnDataLoad(event);
30
+ }
27
31
  get GridIcon() {
28
32
  const name = this.Contribution.RelatedEntity;
29
33
  if (!name)
@@ -1 +1 @@
1
- {"version":3,"file":"related-entity-grid-panel.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/related-entity-grid-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;;;;;IAyBjC,uDAMyC;IAArC,AADA,qOAAY,2CAAoC,KAAC,kOAChC,yBAAkB,KAAC;IACxC,iBAA+B;;;IAH3B,AADA,AADA,AADA,8JAA4H,kIACf,0FAClC,qBACvD;;AAtBxC;;;;GAIG;AA2BH,MAAM,OAAO,+BAA+B;IAC/B,YAAY,CAA0B;IACtC,MAAM,CAAc;IACpB,aAAa,CAAqB;IAClC,WAAW,CAAe;IAE5B,UAAU,CAAC,KAA6B;QAC3C,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAClG,CAAC;IAED,IAAW,QAAQ;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,IAAI;YAAE,OAAO,aAAa,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC/E,OAAO,IAAI,IAAI,aAAa,CAAC;IACjC,CAAC;yHAfQ,+BAA+B;6DAA/B,+BAA+B;YAtBpC,+CAO8B;YAC1B,0HAAsB;YAU1B,iBAAuB;;YAXnB,AADA,AADA,AAFA,AADA,AADA,6DAA2C,6CACH,sBACvB,2BAEK,gCACK,0BACF;YACzB,cASC;YATD,6CASC;;;iFAKA,+BAA+B;cA1B3C,SAAS;6BACM,KAAK,YACP,8BAA8B,YAC9B;;;;;;;;;;;;;;;;;;;;KAoBT;;kBAIA,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kFAJG,+BAA+B","sourcesContent":["import { Component, Input } from '@angular/core';\nimport { BaseEntity } from '@memberjunction/core';\nimport type { AfterDataLoadEventArgs } from '@memberjunction/ng-entity-viewer';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport type { FormContributionWinner } from './form-contribution';\n\n/**\n * Stock related-entity grid the composer mounts when a DisplayInForm\n * relationship is neither baked into the form template nor claimed by a\n * registered panel. Mirrors the CodeGen EntityDataGrid template.\n */\n@Component({\n standalone: false,\n selector: 'mj-related-entity-grid-panel',\n template: `\n <mj-collapsible-panel\n [SectionKey]=\"Contribution.BakedSectionKey\"\n [SectionName]=\"Contribution.DisplayName\"\n [Icon]=\"GridIcon\"\n Variant=\"related-entity\"\n [Form]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [DefaultExpanded]=\"false\">\n @if (Record.IsSaved) {\n <mj-explorer-entity-data-grid\n [Params]=\"FormComponent.BuildRelationshipViewParamsByEntityName(Contribution.RelatedEntity!, Contribution.RelatedJoinField)\"\n [NewRecordValues]=\"FormComponent.NewRecordValues(Contribution.RelatedEntity!, Contribution.RelatedJoinField)\"\n [AllowLoad]=\"FormComponent.IsSectionExpanded(Contribution.BakedSectionKey)\"\n [ShowToolbar]=\"true\"\n (Navigate)=\"FormComponent.OnFormNavigate($event)\"\n (AfterDataLoad)=\"onDataLoad($event)\">\n </mj-explorer-entity-data-grid>\n }\n </mj-collapsible-panel>\n `,\n styles: [`:host { display: contents; }`],\n})\nexport class RelatedEntityGridPanelComponent {\n @Input() Contribution!: FormContributionWinner;\n @Input() Record!: BaseEntity;\n @Input() FormComponent!: BaseFormComponent;\n @Input() FormContext?: FormContext;\n\n public onDataLoad(event: AfterDataLoadEventArgs): void {\n this.FormComponent.SetSectionRowCount(this.Contribution.BakedSectionKey, event.totalRowCount);\n }\n\n public get GridIcon(): string {\n const name = this.Contribution.RelatedEntity;\n if (!name) return 'fa fa-table';\n const icon = this.FormComponent.ProviderToUse.EntityByName(name)?.Icon?.trim();\n return icon || 'fa fa-table';\n }\n}\n"]}
1
+ {"version":3,"file":"related-entity-grid-panel.component.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/related-entity-grid-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;;;;;;IAyBjC,uDAMyC;IAArC,AADA,qOAAY,2CAAoC,KAAC,kOAChC,yBAAkB,KAAC;IACxC,iBAA+B;;;IAH3B,AADA,AADA,AADA,8JAA4H,kIACf,0FAClC,qBACvD;;AAtBxC;;;;GAIG;AA2BH,MAAM,OAAO,+BAA+B;IAC/B,YAAY,CAA0B;IACtC,MAAM,CAAc;IACpB,aAAa,CAAqB;IAClC,WAAW,CAAe;IAE5B,UAAU,CAAC,KAA6B;QAC3C,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAClG,CAAC;IAED,0CAA0C;IACnC,UAAU,CAAC,KAA6B;QAC3C,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAED,IAAW,QAAQ;QACf,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,IAAI;YAAE,OAAO,aAAa,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC/E,OAAO,IAAI,IAAI,aAAa,CAAC;IACjC,CAAC;yHApBQ,+BAA+B;6DAA/B,+BAA+B;YAtBpC,+CAO8B;YAC1B,0HAAsB;YAU1B,iBAAuB;;YAXnB,AADA,AADA,AAFA,AADA,AADA,6DAA2C,6CACH,sBACvB,2BAEK,gCACK,0BACF;YACzB,cASC;YATD,6CASC;;;iFAKA,+BAA+B;cA1B3C,SAAS;6BACM,KAAK,YACP,8BAA8B,YAC9B;;;;;;;;;;;;;;;;;;;;KAoBT;;kBAIA,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kFAJG,+BAA+B","sourcesContent":["import { Component, Input } from '@angular/core';\nimport { BaseEntity } from '@memberjunction/core';\nimport type { AfterDataLoadEventArgs } from '@memberjunction/ng-entity-viewer';\nimport { BaseFormComponent } from '../base-form-component';\nimport { FormContext } from '../types/form-types';\nimport type { FormContributionWinner } from './form-contribution';\n\n/**\n * Stock related-entity grid the composer mounts when a DisplayInForm\n * relationship is neither baked into the form template nor claimed by a\n * registered panel. Mirrors the CodeGen EntityDataGrid template.\n */\n@Component({\n standalone: false,\n selector: 'mj-related-entity-grid-panel',\n template: `\n <mj-collapsible-panel\n [SectionKey]=\"Contribution.BakedSectionKey\"\n [SectionName]=\"Contribution.DisplayName\"\n [Icon]=\"GridIcon\"\n Variant=\"related-entity\"\n [Form]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [DefaultExpanded]=\"false\">\n @if (Record.IsSaved) {\n <mj-explorer-entity-data-grid\n [Params]=\"FormComponent.BuildRelationshipViewParamsByEntityName(Contribution.RelatedEntity!, Contribution.RelatedJoinField)\"\n [NewRecordValues]=\"FormComponent.NewRecordValues(Contribution.RelatedEntity!, Contribution.RelatedJoinField)\"\n [AllowLoad]=\"FormComponent.IsSectionExpanded(Contribution.BakedSectionKey)\"\n [ShowToolbar]=\"true\"\n (Navigate)=\"FormComponent.OnFormNavigate($event)\"\n (AfterDataLoad)=\"onDataLoad($event)\">\n </mj-explorer-entity-data-grid>\n }\n </mj-collapsible-panel>\n `,\n styles: [`:host { display: contents; }`],\n})\nexport class RelatedEntityGridPanelComponent {\n @Input() Contribution!: FormContributionWinner;\n @Input() Record!: BaseEntity;\n @Input() FormComponent!: BaseFormComponent;\n @Input() FormContext?: FormContext;\n\n public OnDataLoad(event: AfterDataLoadEventArgs): void {\n this.FormComponent.SetSectionRowCount(this.Contribution.BakedSectionKey, event.totalRowCount);\n }\n\n /** @deprecated Use {@link OnDataLoad}. */\n public onDataLoad(event: AfterDataLoadEventArgs): void {\n return this.OnDataLoad(event);\n }\n\n public get GridIcon(): string {\n const name = this.Contribution.RelatedEntity;\n if (!name) return 'fa fa-table';\n const icon = this.FormComponent.ProviderToUse.EntityByName(name)?.Icon?.trim();\n return icon || 'fa fa-table';\n }\n}\n"]}
@@ -0,0 +1,53 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import type { MjFormFieldComponent } from '../field/form-field.component';
3
+ import type { FormContext } from '../types/form-types';
4
+ /**
5
+ * The section a form field sits inside, reached through the element injector rather than a
6
+ * content query.
7
+ *
8
+ * `mj-collapsible-panel` derives a section's state (unsaved edits, invalid or required-and-empty
9
+ * fields, which validation failures it owns, whether it has anything to show) from its
10
+ * `mj-form-field`s. It used to find them with `@ContentChildren` alone, and a content query stops
11
+ * at a component view boundary: a field declared inside a widget component's own template, with
12
+ * the widget projected into the panel, was invisible to the section. Such a section reported no
13
+ * required-and-empty count before a save and claimed none of the field-named errors a failed save
14
+ * published, so the rail never badged it even while its fields sat red.
15
+ *
16
+ * The element injector follows the element tree across those boundaries, so a field can find the
17
+ * panel it renders inside no matter how many component views sit between them. The panel provides
18
+ * itself under {@link FORM_SECTION_FIELD_HOST}; every `mj-form-field` injects the token optionally
19
+ * and registers on construction, so a field rendered outside any section is simply unregistered.
20
+ */
21
+ export interface FormSectionFieldHost {
22
+ /** Declare a field that renders inside this section. Idempotent for the same instance. */
23
+ RegisterField(field: MjFormFieldComponent): void;
24
+ /** Withdraw a field on destroy. A field never registered is ignored. */
25
+ UnregisterField(field: MjFormFieldComponent): void;
26
+ /**
27
+ * A registered field's inputs changed (`EditMode`, `Record`, `FormContext`, …), so its state
28
+ * as the section reads it may have too.
29
+ *
30
+ * Why the section has to be TOLD, when a projected field never tells it anything: a projected
31
+ * field's inputs are bound in the same view as the section's own host bindings, and Angular
32
+ * evaluates a view's template bindings before its host bindings, so the section always reads a
33
+ * projected field after that field was updated. A field inside a child component's view is
34
+ * refreshed AFTER the section's host bindings and after the rail that reads the section, so
35
+ * anything derived from its inputs would be one pass stale — or, in dev mode, an
36
+ * `ExpressionChangedAfterItHasBeenChecked` error. The host records the change in a signal its
37
+ * readers depend on, which makes Angular re-run those views before its no-changes check.
38
+ */
39
+ NotifyFieldChanged(field: MjFormFieldComponent): void;
40
+ }
41
+ export declare const FORM_SECTION_FIELD_HOST: InjectionToken<FormSectionFieldHost>;
42
+ /**
43
+ * Whether a `FormContext` change alters anything a section derives from a field.
44
+ *
45
+ * `BaseFormComponent.formContext` is a getter that builds a fresh object on every access, so a
46
+ * field's `[FormContext]` input changes identity on every pass and `ngOnChanges` fires every pass.
47
+ * Notifying the section each time would dirty the panel and the rail after they were checked and
48
+ * force an extra refresh per tick with nothing changed. Only these members feed the section's
49
+ * counts: `showValidation` / `validationRevision` / `validationErrors` (whether a field paints an
50
+ * error) and `showEmptyFields` (whether an empty read-only field is hidden).
51
+ */
52
+ export declare function SectionRelevantFormContextChanged(previous: FormContext | null | undefined, next: FormContext | null | undefined): boolean;
53
+ //# sourceMappingURL=form-section-field-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-section-field-host.d.ts","sourceRoot":"","sources":["../../../src/lib/section-indicators/form-section-field-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACjD,wEAAwE;IACxE,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnD;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvD;AAED,eAAO,MAAM,uBAAuB,sCAAsE,CAAC;AAE3G;;;;;;;;;GASG;AACH,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,EACxC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,OAAO,CAOT"}
@@ -0,0 +1,23 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export const FORM_SECTION_FIELD_HOST = new InjectionToken('FORM_SECTION_FIELD_HOST');
3
+ /**
4
+ * Whether a `FormContext` change alters anything a section derives from a field.
5
+ *
6
+ * `BaseFormComponent.formContext` is a getter that builds a fresh object on every access, so a
7
+ * field's `[FormContext]` input changes identity on every pass and `ngOnChanges` fires every pass.
8
+ * Notifying the section each time would dirty the panel and the rail after they were checked and
9
+ * force an extra refresh per tick with nothing changed. Only these members feed the section's
10
+ * counts: `showValidation` / `validationRevision` / `validationErrors` (whether a field paints an
11
+ * error) and `showEmptyFields` (whether an empty read-only field is hidden).
12
+ */
13
+ export function SectionRelevantFormContextChanged(previous, next) {
14
+ if (previous === next)
15
+ return false;
16
+ if (!previous || !next)
17
+ return true;
18
+ return previous.showValidation !== next.showValidation
19
+ || previous.validationRevision !== next.validationRevision
20
+ || previous.validationErrors !== next.validationErrors
21
+ || previous.showEmptyFields !== next.showEmptyFields;
22
+ }
23
+ //# sourceMappingURL=form-section-field-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-section-field-host.js","sourceRoot":"","sources":["../../../src/lib/section-indicators/form-section-field-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA0C/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,cAAc,CAAuB,yBAAyB,CAAC,CAAC;AAE3G;;;;;;;;;GASG;AACH,MAAM,UAAU,iCAAiC,CAC/C,QAAwC,EACxC,IAAoC;IAEpC,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,QAAQ,CAAC,cAAc,KAAK,IAAI,CAAC,cAAc;WACjD,QAAQ,CAAC,kBAAkB,KAAK,IAAI,CAAC,kBAAkB;WACvD,QAAQ,CAAC,gBAAgB,KAAK,IAAI,CAAC,gBAAgB;WACnD,QAAQ,CAAC,eAAe,KAAK,IAAI,CAAC,eAAe,CAAC;AACzD,CAAC","sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { MjFormFieldComponent } from '../field/form-field.component';\nimport type { FormContext } from '../types/form-types';\n\n/**\n * The section a form field sits inside, reached through the element injector rather than a\n * content query.\n *\n * `mj-collapsible-panel` derives a section's state (unsaved edits, invalid or required-and-empty\n * fields, which validation failures it owns, whether it has anything to show) from its\n * `mj-form-field`s. It used to find them with `@ContentChildren` alone, and a content query stops\n * at a component view boundary: a field declared inside a widget component's own template, with\n * the widget projected into the panel, was invisible to the section. Such a section reported no\n * required-and-empty count before a save and claimed none of the field-named errors a failed save\n * published, so the rail never badged it even while its fields sat red.\n *\n * The element injector follows the element tree across those boundaries, so a field can find the\n * panel it renders inside no matter how many component views sit between them. The panel provides\n * itself under {@link FORM_SECTION_FIELD_HOST}; every `mj-form-field` injects the token optionally\n * and registers on construction, so a field rendered outside any section is simply unregistered.\n */\nexport interface FormSectionFieldHost {\n /** Declare a field that renders inside this section. Idempotent for the same instance. */\n RegisterField(field: MjFormFieldComponent): void;\n /** Withdraw a field on destroy. A field never registered is ignored. */\n UnregisterField(field: MjFormFieldComponent): void;\n /**\n * A registered field's inputs changed (`EditMode`, `Record`, `FormContext`, …), so its state\n * as the section reads it may have too.\n *\n * Why the section has to be TOLD, when a projected field never tells it anything: a projected\n * field's inputs are bound in the same view as the section's own host bindings, and Angular\n * evaluates a view's template bindings before its host bindings, so the section always reads a\n * projected field after that field was updated. A field inside a child component's view is\n * refreshed AFTER the section's host bindings and after the rail that reads the section, so\n * anything derived from its inputs would be one pass stale — or, in dev mode, an\n * `ExpressionChangedAfterItHasBeenChecked` error. The host records the change in a signal its\n * readers depend on, which makes Angular re-run those views before its no-changes check.\n */\n NotifyFieldChanged(field: MjFormFieldComponent): void;\n}\n\nexport const FORM_SECTION_FIELD_HOST = new InjectionToken<FormSectionFieldHost>('FORM_SECTION_FIELD_HOST');\n\n/**\n * Whether a `FormContext` change alters anything a section derives from a field.\n *\n * `BaseFormComponent.formContext` is a getter that builds a fresh object on every access, so a\n * field's `[FormContext]` input changes identity on every pass and `ngOnChanges` fires every pass.\n * Notifying the section each time would dirty the panel and the rail after they were checked and\n * force an extra refresh per tick with nothing changed. Only these members feed the section's\n * counts: `showValidation` / `validationRevision` / `validationErrors` (whether a field paints an\n * error) and `showEmptyFields` (whether an empty read-only field is hidden).\n */\nexport function SectionRelevantFormContextChanged(\n previous: FormContext | null | undefined,\n next: FormContext | null | undefined,\n): boolean {\n if (previous === next) return false;\n if (!previous || !next) return true;\n return previous.showValidation !== next.showValidation\n || previous.validationRevision !== next.validationRevision\n || previous.validationErrors !== next.validationErrors\n || previous.showEmptyFields !== next.showEmptyFields;\n}\n"]}
@@ -8,7 +8,11 @@ export declare class SectionLoaderComponent implements AfterViewInit, OnDestroy,
8
8
  record: BaseEntity;
9
9
  EditMode: boolean;
10
10
  LoadComplete: EventEmitter<void>;
11
- container: ViewContainerRef;
11
+ Container: ViewContainerRef;
12
+ /** @deprecated Use {@link Container}. */
13
+ get container(): ViewContainerRef;
14
+ /** @deprecated Use {@link Container}. */
15
+ set container(value: ViewContainerRef);
12
16
  private _sectionObj;
13
17
  constructor(cdr: ChangeDetectorRef);
14
18
  ngOnChanges(changes: SimpleChanges): void;
@@ -1 +1 @@
1
- {"version":3,"file":"section-loader-component.d.ts","sourceRoot":"","sources":["../../src/lib/section-loader-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAa,gBAA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,IAAI,gBAAgB,CAEhC;IACD,yCAAyC;IACzC,IAAI,SAAS,CAAC,KAAK,EAAE,gBAAgB,EAEpC;IAED,OAAO,CAAC,WAAW,CAAyC;gBACxC,GAAG,EAAE,iBAAiB;IAE1C,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAOzC,eAAe,IAAI,IAAI;IAOvB,OAAO,CAAC,aAAa;IAiBrB,WAAW;yCApDF,sBAAsB;2CAAtB,sBAAsB;CAwDlC"}
@@ -11,7 +11,15 @@ export class SectionLoaderComponent {
11
11
  record;
12
12
  EditMode = false;
13
13
  LoadComplete = new EventEmitter();
14
- container;
14
+ Container;
15
+ /** @deprecated Use {@link Container}. */
16
+ get container() {
17
+ return this.Container;
18
+ }
19
+ /** @deprecated Use {@link Container}. */
20
+ set container(value) {
21
+ this.Container = value;
22
+ }
15
23
  _sectionObj = null;
16
24
  constructor(cdr) {
17
25
  this.cdr = cdr;
@@ -32,7 +40,7 @@ export class SectionLoaderComponent {
32
40
  //console.log("loading component?", `${this.Entity}.${this.Section}`);
33
41
  const sectionInfo = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormSectionComponent, `${this.Entity}.${this.Section}`);
34
42
  if (sectionInfo) {
35
- const componentRef = this.container.createComponent(sectionInfo.SubClass);
43
+ const componentRef = this.Container.createComponent(sectionInfo.SubClass);
36
44
  // pass in record and edit mode
37
45
  this._sectionObj = componentRef.instance;
38
46
  this._sectionObj.record = this.record;
@@ -46,14 +54,14 @@ export class SectionLoaderComponent {
46
54
  }
47
55
  ngOnDestroy() {
48
56
  // Don't forget to cleanup dynamically created components
49
- this.container.clear();
57
+ this.Container.clear();
50
58
  }
51
59
  static ɵfac = function SectionLoaderComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || SectionLoaderComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
52
60
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SectionLoaderComponent, selectors: [["mj-form-section"]], viewQuery: function SectionLoaderComponent_Query(rf, ctx) { if (rf & 1) {
53
61
  i0.ɵɵviewQuery(_c0, 5, ViewContainerRef);
54
62
  } if (rf & 2) {
55
63
  let _t;
56
- i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.container = _t.first);
64
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.Container = _t.first);
57
65
  } }, inputs: { Entity: "Entity", Section: "Section", record: "record", EditMode: "EditMode" }, outputs: { LoadComplete: "LoadComplete" }, standalone: false, features: [i0.ɵɵNgOnChangesFeature], decls: 3, vars: 0, consts: [["container", ""], [1, "form-section"]], template: function SectionLoaderComponent_Template(rf, ctx) { if (rf & 1) {
58
66
  i0.ɵɵelementStart(0, "div", 1);
59
67
  i0.ɵɵtemplate(1, SectionLoaderComponent_ng_template_1_Template, 0, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
@@ -77,7 +85,7 @@ export class SectionLoaderComponent {
77
85
  type: Input
78
86
  }], LoadComplete: [{
79
87
  type: Output
80
- }], container: [{
88
+ }], Container: [{
81
89
  type: ViewChild,
82
90
  args: ['container', { read: ViewContainerRef }]
83
91
  }] }); })();
@@ -1 +1 @@
1
- {"version":3,"file":"section-loader-component.js","sourceRoot":"","sources":["../../src/lib/section-loader-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,SAAS,EAAE,gBAAgB,EAA2C,MAAM,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AACjL,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;;;AAQzE,MAAM,OAAO,sBAAsB;IAUX;IATX,MAAM,CAAU;IAChB,OAAO,CAAU;IACjB,MAAM,CAAc;IACpB,QAAQ,GAAY,KAAK,CAAC;IACzB,YAAY,GAAuB,IAAI,YAAY,EAAQ,CAAC;IAElB,SAAS,CAAo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C;IAC3B,CAAC;IAED,WAAW;QACT,yDAAyD;QACzD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;gHA9CQ,sBAAsB;6DAAtB,sBAAsB;mCAOC,gBAAgB;;;;;YATvC,8BAA0B;YAAA,wHAAwB;YAAc,iBAAM;;;iFAEtE,sBAAsB;cALlC,SAAS;eAAC;gBACT,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,iBAAiB;gBAC3B,QAAQ,EAAE,wEAAwE;aACnF;;kBAEI,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kBAEN,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;;kFAPzC,sBAAsB","sourcesContent":["import { Component, Input, OnDestroy, ViewChild, ViewContainerRef, AfterViewInit, OnChanges, SimpleChanges, Output, EventEmitter, ChangeDetectorRef, Type } from '@angular/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { BaseFormSectionComponent } from './base-form-section-component';\nimport { BaseEntity } from '@memberjunction/core';\n\n@Component({\n standalone: false,\n selector: 'mj-form-section',\n template: `<div class=\"form-section\"><ng-template #container></ng-template></div>`\n})\nexport class SectionLoaderComponent implements AfterViewInit, OnDestroy, OnChanges {\n @Input() Entity!: string;\n @Input() Section!: string;\n @Input() record!: BaseEntity;\n @Input() EditMode: boolean = false;\n @Output() LoadComplete: EventEmitter<void> = new EventEmitter<void>();\n\n @ViewChild('container', { read: ViewContainerRef }) container!: ViewContainerRef;\n \n private _sectionObj: BaseFormSectionComponent | null = null;\n constructor(private cdr: ChangeDetectorRef) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n // react to EditMode change\n if (changes['EditMode'] && !changes['EditMode'].firstChange && this._sectionObj) {\n this._sectionObj.EditMode = this.EditMode;\n }\n }\n\n ngAfterViewInit(): void {\n // do this via a promise in order to defer the load by one pass of the event loop\n // because that results in Angular not complaining about change detection due to dynamic\n // nature of the inner component\n Promise.resolve().then(() => this.loadComponent());\n }\n\n private loadComponent() { \n //console.log(\"loading component?\", `${this.Entity}.${this.Section}`);\n const sectionInfo = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormSectionComponent,`${this.Entity}.${this.Section}`);\n if (sectionInfo) {\n const componentRef = this.container.createComponent(sectionInfo.SubClass as Type<BaseFormSectionComponent>); \n // pass in record and edit mode\n this._sectionObj = <BaseFormSectionComponent>componentRef.instance;\n this._sectionObj.record = this.record;\n this._sectionObj.EditMode = this.EditMode;\n this.cdr.detectChanges(); // Manually trigger change detection so that the call below to LoadComplete.emit() will occur after DOM is updated\n }\n else{\n console.log(\"no section info\");\n }\n this.LoadComplete.emit();\n }\n \n ngOnDestroy() {\n // Don't forget to cleanup dynamically created components\n this.container.clear();\n }\n}"]}
1
+ {"version":3,"file":"section-loader-component.js","sourceRoot":"","sources":["../../src/lib/section-loader-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAa,SAAS,EAAE,gBAAgB,EAA2C,MAAM,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AACjL,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;;;;AAQzE,MAAM,OAAO,sBAAsB;IAmBX;IAlBX,MAAM,CAAU;IAChB,OAAO,CAAU;IACjB,MAAM,CAAc;IACpB,QAAQ,GAAY,KAAK,CAAC;IACzB,YAAY,GAAuB,IAAI,YAAY,EAAQ,CAAC;IAElB,SAAS,CAAoB;IAEjF,yCAAyC;IACzC,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IACD,yCAAyC;IACzC,IAAI,SAAS,CAAC,KAAuB;QACnC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IACzB,CAAC;IAEO,WAAW,GAAoC,IAAI,CAAC;IAC5D,YAAoB,GAAsB;QAAtB,QAAG,GAAH,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EAAE,CAAC;IACzB,CAAC;gHAvDQ,sBAAsB;6DAAtB,sBAAsB;mCAOC,gBAAgB;;;;;YATvC,8BAA0B;YAAA,wHAAwB;YAAc,iBAAM;;;iFAEtE,sBAAsB;cALlC,SAAS;eAAC;gBACT,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,iBAAiB;gBAC3B,QAAQ,EAAE,wEAAwE;aACnF;;kBAEI,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kBAEN,SAAS;mBAAC,WAAW,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;;kFAPzC,sBAAsB","sourcesContent":["import { Component, Input, OnDestroy, ViewChild, ViewContainerRef, AfterViewInit, OnChanges, SimpleChanges, Output, EventEmitter, ChangeDetectorRef, Type } from '@angular/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { BaseFormSectionComponent } from './base-form-section-component';\nimport { BaseEntity } from '@memberjunction/core';\n\n@Component({\n standalone: false,\n selector: 'mj-form-section',\n template: `<div class=\"form-section\"><ng-template #container></ng-template></div>`\n})\nexport class SectionLoaderComponent implements AfterViewInit, OnDestroy, OnChanges {\n @Input() Entity!: string;\n @Input() Section!: string;\n @Input() record!: BaseEntity;\n @Input() EditMode: boolean = false;\n @Output() LoadComplete: EventEmitter<void> = new EventEmitter<void>();\n\n @ViewChild('container', { read: ViewContainerRef }) Container!: ViewContainerRef;\n\n /** @deprecated Use {@link Container}. */\n get container(): ViewContainerRef {\n return this.Container;\n }\n /** @deprecated Use {@link Container}. */\n set container(value: ViewContainerRef) {\n this.Container = value;\n }\n \n private _sectionObj: BaseFormSectionComponent | null = null;\n constructor(private cdr: ChangeDetectorRef) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n // react to EditMode change\n if (changes['EditMode'] && !changes['EditMode'].firstChange && this._sectionObj) {\n this._sectionObj.EditMode = this.EditMode;\n }\n }\n\n ngAfterViewInit(): void {\n // do this via a promise in order to defer the load by one pass of the event loop\n // because that results in Angular not complaining about change detection due to dynamic\n // nature of the inner component\n Promise.resolve().then(() => this.loadComponent());\n }\n\n private loadComponent() { \n //console.log(\"loading component?\", `${this.Entity}.${this.Section}`);\n const sectionInfo = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormSectionComponent,`${this.Entity}.${this.Section}`);\n if (sectionInfo) {\n const componentRef = this.Container.createComponent(sectionInfo.SubClass as Type<BaseFormSectionComponent>); \n // pass in record and edit mode\n this._sectionObj = <BaseFormSectionComponent>componentRef.instance;\n this._sectionObj.record = this.record;\n this._sectionObj.EditMode = this.EditMode;\n this.cdr.detectChanges(); // Manually trigger change detection so that the call below to LoadComplete.emit() will occur after DOM is updated\n }\n else{\n console.log(\"no section info\");\n }\n this.LoadComplete.emit();\n }\n \n ngOnDestroy() {\n // Don't forget to cleanup dynamically created components\n this.Container.clear();\n }\n}"]}
@@ -71,8 +71,8 @@ export declare class MjSectionManagerComponent implements OnChanges {
71
71
  OnReset(): void;
72
72
  GetVariantIcon(variant: PanelVariant): string;
73
73
  GetVariantLabel(variant: PanelVariant): string;
74
- private RebuildOrderedSections;
75
- private ApplyOrder;
74
+ private rebuildOrderedSections;
75
+ private applyOrder;
76
76
  static ɵfac: i0.ɵɵFactoryDeclaration<MjSectionManagerComponent, never>;
77
77
  static ɵcmp: i0.ɵɵComponentDeclaration<MjSectionManagerComponent, "mj-section-manager", never, { "Sections": { "alias": "Sections"; "required": false; }; "SectionOrder": { "alias": "SectionOrder"; "required": false; }; "MoreSectionKeys": { "alias": "MoreSectionKeys"; "required": false; }; "LockedMoreKeys": { "alias": "LockedMoreKeys"; "required": false; }; "Visible": { "alias": "Visible"; "required": false; }; }, { "SectionOrderChange": "SectionOrderChange"; "MembershipChange": "MembershipChange"; "Closed": "Closed"; "ResetRequested": "ResetRequested"; }, never, never, false, never>;
78
78
  }
@@ -221,7 +221,7 @@ export class MjSectionManagerComponent {
221
221
  MoreSections = [];
222
222
  ngOnChanges(changes) {
223
223
  if (changes['Sections'] || changes['SectionOrder'] || changes['MoreSectionKeys'] || changes['LockedMoreKeys']) {
224
- this.RebuildOrderedSections();
224
+ this.rebuildOrderedSections();
225
225
  }
226
226
  }
227
227
  get HasMoreGroup() {
@@ -245,7 +245,7 @@ export class MjSectionManagerComponent {
245
245
  const newOrder = this.OrderedSections.map(s => s.SectionKey);
246
246
  [newOrder[index - 1], newOrder[index]] = [newOrder[index], newOrder[index - 1]];
247
247
  this.SectionOrderChange.emit(newOrder);
248
- this.ApplyOrder(newOrder);
248
+ this.applyOrder(newOrder);
249
249
  }
250
250
  OnMoveDown(index) {
251
251
  if (index >= this.OrderedSections.length - 1)
@@ -253,7 +253,7 @@ export class MjSectionManagerComponent {
253
253
  const newOrder = this.OrderedSections.map(s => s.SectionKey);
254
254
  [newOrder[index], newOrder[index + 1]] = [newOrder[index + 1], newOrder[index]];
255
255
  this.SectionOrderChange.emit(newOrder);
256
- this.ApplyOrder(newOrder);
256
+ this.applyOrder(newOrder);
257
257
  }
258
258
  OnMoveGroupUp(list, index) {
259
259
  if (index <= 0)
@@ -292,7 +292,7 @@ export class MjSectionManagerComponent {
292
292
  ? [...keys, ...other.map((s) => s.SectionKey)]
293
293
  : [...other.map((s) => s.SectionKey), ...keys];
294
294
  this.SectionOrderChange.emit(combined);
295
- this.ApplyOrder(combined);
295
+ this.applyOrder(combined);
296
296
  }
297
297
  OnReset() {
298
298
  this.ResetRequested.emit();
@@ -311,7 +311,7 @@ export class MjSectionManagerComponent {
311
311
  default: return 'Fields';
312
312
  }
313
313
  }
314
- RebuildOrderedSections() {
314
+ rebuildOrderedSections() {
315
315
  if (!this.Sections || this.Sections.length === 0) {
316
316
  this.OrderedSections = [];
317
317
  return;
@@ -341,7 +341,7 @@ export class MjSectionManagerComponent {
341
341
  this.MoreSections = ordered.filter((s) => moreSet.has(s.SectionKey));
342
342
  this.cdr.markForCheck();
343
343
  }
344
- ApplyOrder(newOrder) {
344
+ applyOrder(newOrder) {
345
345
  const sectionMap = new Map();
346
346
  for (const s of this.OrderedSections) {
347
347
  sectionMap.set(s.SectionKey, s);