@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.
- package/dist/lib/apply/form-placement-dialog.component.d.ts +266 -0
- package/dist/lib/apply/form-placement-dialog.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-dialog.component.js +1522 -0
- package/dist/lib/apply/form-placement-dialog.component.js.map +1 -0
- package/dist/lib/apply/form-placement-order.d.ts +37 -0
- package/dist/lib/apply/form-placement-order.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-order.js +111 -0
- package/dist/lib/apply/form-placement-order.js.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts +112 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.js +346 -0
- package/dist/lib/apply/form-placement-preview.component.js.map +1 -0
- package/dist/lib/apply/form-placement-text.d.ts +61 -0
- package/dist/lib/apply/form-placement-text.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-text.js +279 -0
- package/dist/lib/apply/form-placement-text.js.map +1 -0
- package/dist/lib/apply/form-placement.d.ts +320 -0
- package/dist/lib/apply/form-placement.d.ts.map +1 -0
- package/dist/lib/apply/form-placement.js +432 -0
- package/dist/lib/apply/form-placement.js.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts +121 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.js +264 -0
- package/dist/lib/apply/form-slot-probe.service.js.map +1 -0
- package/dist/lib/base-form-component-internals.d.ts +11 -0
- package/dist/lib/base-form-component-internals.d.ts.map +1 -0
- package/dist/lib/base-form-component-internals.js +33 -0
- package/dist/lib/base-form-component-internals.js.map +1 -0
- package/dist/lib/base-form-component.d.ts +132 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +228 -19
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-chrome.d.ts +78 -0
- package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/form-chrome.js +128 -2
- package/dist/lib/chrome/form-chrome.js.map +1 -1
- package/dist/lib/chrome/form-composition-registry.d.ts +34 -0
- package/dist/lib/chrome/form-composition-registry.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-registry.js +56 -0
- package/dist/lib/chrome/form-composition-registry.js.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts +151 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.js +137 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts +15 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/resolve-form-chrome.js +31 -2
- package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +240 -5
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +976 -249
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +17 -0
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +41 -5
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/form-state.service.d.ts +5 -0
- package/dist/lib/form-state.service.d.ts.map +1 -1
- package/dist/lib/form-state.service.js +6 -1
- package/dist/lib/form-state.service.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +16 -1
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +27 -6
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.js +4 -5
- package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.js +148 -12
- package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
- package/dist/lib/panel-manager/form-audience.d.ts +46 -0
- package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-audience.js +34 -0
- package/dist/lib/panel-manager/form-audience.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
- package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
- package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
- package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
- package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
- package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
- package/dist/lib/panel-slot/base-form-panel.js +76 -5
- package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
- package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
- package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
- package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
- package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contribution.js +242 -64
- package/dist/lib/panel-slot/form-contribution.js.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
- package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.js +43 -7
- package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
- package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
- package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
- package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
- package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
- package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
- package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
- package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
- package/dist/lib/panel-slot/panel-hides.js +111 -0
- package/dist/lib/panel-slot/panel-hides.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
- package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview.js +86 -0
- package/dist/lib/panel-slot/placement-preview.js.map +1 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/slot-order.d.ts +19 -0
- package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
- package/dist/lib/panel-slot/slot-order.js +53 -0
- package/dist/lib/panel-slot/slot-order.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +18 -8
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/resolver/form-variants.d.ts +28 -0
- package/dist/lib/resolver/form-variants.d.ts.map +1 -0
- package/dist/lib/resolver/form-variants.js +40 -0
- package/dist/lib/resolver/form-variants.js.map +1 -0
- package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
- package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
- package/dist/lib/section-counts/form-section-counts.js +223 -0
- package/dist/lib/section-counts/form-section-counts.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +7 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +194 -128
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-types.d.ts +8 -0
- package/dist/lib/types/form-types.d.ts.map +1 -1
- package/dist/lib/types/form-types.js.map +1 -1
- package/dist/module.d.ts +29 -23
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +43 -5
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +20 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +21 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-composition-snapshot.js","sourceRoot":"","sources":["../../../src/lib/chrome/form-composition-snapshot.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,qCAAqC,EACrC,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,GAG3B,MAAM,iCAAiC,CAAC;AACzC,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OAAO;QACH,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;QAC3C,UAAU,EAAE,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE;QACtC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YAC1C,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,eAAe,EAAE,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI;SAC5D,CAAC,CAAC;KACN,CAAC;AACN,CAAC","sourcesContent":["// packages/Angular/Generic/base-forms/src/lib/chrome/form-composition-snapshot.ts\nimport type { FormInclusion, FormRole } from '@memberjunction/core';\nimport type { FormPanelSlot } from '../panel-slot/base-form-panel';\nimport {\n CreateRelatedEntitySectionKeyResolver,\n RelatedContributionKey,\n ResolveContributionKey,\n ReplacedSectionKeys,\n ResolveFormContributionWinners,\n ResolveFormContributions,\n StripJoinFieldBrackets,\n VisibleFormRelationships,\n type FormContributionRegistration,\n type FormContributionRelationship,\n} from '../panel-slot/form-contribution';\nimport { IsPanelHiddenByUser } from '../panel-slot/panel-hides';\nimport type { FormChromeGroup, FormChromePanelSnapshot } from './form-chrome';\n\n/**\n * What is on this form right now — the input the apply flow needs to add or replace one piece.\n * Built by the container after every chrome resolve and, when it changed, published through\n * `BaseFormComponent.CompositionChanged` and the `FormCompositionRegistry`. It stays in the\n * browser: an agent is handed the compact {@link FormAgentContext} built from it.\n */\nexport interface FormCompositionSection {\n Key: string;\n Title: string;\n Variant: string;\n /** Rail group key, or null when the section is not in any first-class group. */\n Group: string | null;\n Hidden: boolean;\n /**\n * The inputs this section draws, so a panel can be offered one field to stand in for.\n * Empty for a section with no fields of its own, such as a related grid.\n */\n Fields: Array<{ Name: string; Label: string }>;\n}\n\nexport interface FormCompositionRelated {\n Entity: string;\n JoinField: string;\n SectionKey: string;\n Inclusion: FormInclusion | 'Auto';\n /** baked = in the template; stock = container fill-in; claimed = a contribution replaced it. */\n Source: 'baked' | 'stock' | 'claimed';\n}\n\nexport interface FormCompositionContribution {\n Key: string;\n Slot: FormPanelSlot;\n Source: 'class' | 'metadata';\n Title: string;\n Presentation: 'panel' | 'bare';\n /** Suppressed by an L3 rule or inclusion None, or hidden by this user. */\n Hidden: boolean;\n /** Last-wins rank; the apply flow uses incumbent + 1 to replace a compiled piece. */\n Precedence: number;\n /** Order among panels in the same slot, higher first. */\n SortKey: number;\n /** The section it is placed in, replacing nothing. */\n InSectionKey?: string;\n /** Where inside its section it draws. */\n SectionPosition?: 'start' | 'end';\n /** Fields it stands in for. */\n FieldNames?: string[];\n /** Blocks it stands in for. */\n SectionKeys?: string[];\n /** True when it stands in for a section, tab or grid. */\n ReplacesPlace?: boolean;\n}\n\n/** Which form the user sees: the standard form, or one full custom form. */\nexport interface FormCompositionChoice {\n /** True when a full custom form owns the whole body, so no section, grid or panel draws. */\n FullCustomForm: boolean;\n /** The `MJ: Entity Form Overrides` row the user sees, or null for the standard form. */\n OverrideID: string | null;\n /** The form's name in the form picker. */\n Label: string;\n}\n\nexport interface FormCompositionSnapshot {\n Entity: string;\n /**\n * The record this composition was built for, as `CompositeKey.ToURLSegment()`, which\n * `CompositeKey.FromURLSegment` reads back. Null for a record not saved yet.\n * `AdditionalContext` is app-global and replaced wholesale by whichever surface\n * published last, so a consumer needs to be able to tell which record a snapshot\n * describes rather than assuming it matches the conversation.\n */\n RecordPrimaryKey: string | null;\n FormChoice: FormCompositionChoice;\n Layout: 'accordion' | 'left-nav';\n Sections: FormCompositionSection[];\n Related: FormCompositionRelated[];\n Contributions: FormCompositionContribution[];\n /** The side rail this form shows, in order, with the panels filed under each item. */\n Rail: FormCompositionRailItem[];\n SlotsPresent: FormPanelSlot[];\n ChromeRuleCount: number;\n}\n\n/** One rail item, as a consumer outside the form needs it. */\nexport interface FormCompositionRailItem {\n Key: string;\n Title: string;\n Icon: string;\n SectionKeys: string[];\n IsMore: boolean;\n}\n\nexport interface BuildFormCompositionSnapshotInput {\n EntityName: string;\n RecordPrimaryKey: string | null;\n FormChoice: FormCompositionChoice;\n Layout: 'accordion' | 'left-nav';\n Groups: readonly FormChromeGroup[];\n /** Every section on the form, the hidden ones included. */\n Panels: readonly FormChromePanelSnapshot[];\n /** The sections in {@link Panels} the form does not show. */\n HiddenSectionKeys: ReadonlySet<string>;\n RelatedEntities: readonly FormContributionRelationship[];\n IsaChildEntityIDs: readonly string[];\n BakedSectionKeys: readonly string[];\n /** Every registration on the form, including the panels this user hid. */\n Registrations: readonly FormContributionRegistration[];\n /** The keys of the panels this user hid. Their registrations are listed, marked hidden. */\n HiddenPanelKeys?: readonly string[];\n /** SectionKey → resolved role for related grids (Primary | Detail). Detail reads as More. */\n RelatedRoles: ReadonlyMap<string, FormRole>;\n HiddenContributionKeys: ReadonlySet<string>;\n SlotsPresent: readonly FormPanelSlot[];\n ChromeRuleCount: number;\n}\n\nfunction groupOf(groups: readonly FormChromeGroup[], sectionKey: string): string | null {\n return groups.find((g) => !g.IsMore && g.SectionKeys.includes(sectionKey))?.Key ?? null;\n}\n\n/** A hero (`bare`) or a card (`panel`). `presentation` is the only statement of it, on both sources. */\nfunction presentationOf(reg: FormContributionRegistration): 'panel' | 'bare' {\n return reg.Presentation ?? reg.Metadata.presentation ?? 'panel';\n}\n\n/**\n * The contributions on the form, as the server's composition answer lists them: one winner per\n * key among the panels the form draws, then, marked hidden by the caller, the winners among the\n * panels this user hid whose keys no drawn panel holds. A hidden panel is out of the collapse, so\n * a panel it would have outranked holds its key.\n */\nfunction listedWinners(\n entityName: string,\n drawn: readonly FormContributionRegistration[],\n userHidden: readonly FormContributionRegistration[],\n): readonly FormContributionRegistration[] {\n const shown = ResolveFormContributionWinners(entityName, drawn).Winners;\n if (userHidden.length === 0) return shown;\n const shownKeys = new Set(shown.map((reg) => ResolveContributionKey(reg.Metadata)).filter((key) => !!key));\n const hiddenOnly = ResolveFormContributionWinners(entityName, userHidden).Winners\n .filter((reg) => !shownKeys.has(ResolveContributionKey(reg.Metadata)));\n return [...shown, ...hiddenOnly];\n}\n\nexport function BuildFormCompositionSnapshot(input: BuildFormCompositionSnapshotInput): FormCompositionSnapshot {\n const userHidden = new Set(input.HiddenPanelKeys ?? []);\n const isUserHidden = (reg: FormContributionRegistration) => IsPanelHiddenByUser(reg, userHidden);\n const drawn = userHidden.size > 0 ? input.Registrations.filter((reg) => !isUserHidden(reg)) : input.Registrations;\n const hiddenByUser = userHidden.size > 0 ? input.Registrations.filter(isUserHidden) : [];\n const resolved = ResolveFormContributions({\n EntityName: input.EntityName,\n RelatedEntities: input.RelatedEntities,\n IsaChildEntityIDs: input.IsaChildEntityIDs,\n Registrations: drawn,\n BakedSectionKeys: input.BakedSectionKeys,\n ShowRelatedEntities: true,\n });\n const stockKeys = new Set(resolved.StockGrids.map((g) => g.ContributionKey));\n const claimedKeys = new Set(\n resolved.Winners.filter((w) => w.Kind === 'registered' && w.RelatedEntity)\n .map((w) => RelatedContributionKey(w.RelatedEntity as string, w.RelatedJoinField)),\n );\n\n const visibleRelated = VisibleFormRelationships(input.RelatedEntities, input.IsaChildEntityIDs);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(visibleRelated);\n\n const related: FormCompositionRelated[] = visibleRelated.map((rel) => {\n const join = StripJoinFieldBrackets(rel.RelatedEntityJoinField);\n const key = RelatedContributionKey(rel.RelatedEntity, join);\n const sectionKey = sectionKeyOf(rel);\n const role = input.RelatedRoles.get(sectionKey);\n return {\n Entity: rel.RelatedEntity,\n JoinField: join,\n SectionKey: sectionKey,\n Inclusion: role === 'Primary' ? 'Primary' : role === 'Detail' ? 'More' : 'Auto',\n Source: claimedKeys.has(key) ? 'claimed' : stockKeys.has(key) ? 'stock' : 'baked',\n };\n });\n\n let unique = 0;\n const winners = listedWinners(input.EntityName, drawn, hiddenByUser);\n const contributions: FormCompositionContribution[] = winners.map((reg) => {\n const key = ResolveContributionKey(reg.Metadata) || `__unique:${unique++}`;\n return {\n Key: key,\n Slot: reg.Metadata.slot,\n Source: reg.Source ?? 'class',\n Title: reg.Title ?? reg.Metadata.contributionKey ?? key,\n Presentation: presentationOf(reg),\n Hidden: input.HiddenContributionKeys.has(key) || isUserHidden(reg),\n Precedence: reg.Priority,\n SortKey: reg.Metadata.sortKey ?? 0,\n ...(reg.Metadata.inSectionKey ? { InSectionKey: reg.Metadata.inSectionKey } : {}),\n ...(reg.Metadata.sectionPosition ? { SectionPosition: reg.Metadata.sectionPosition } : {}),\n ...(reg.Metadata.replacesFieldNames?.length ? { FieldNames: [...reg.Metadata.replacesFieldNames] } : {}),\n ...(ReplacedSectionKeys(reg.Metadata).length > 0 ? { SectionKeys: [...ReplacedSectionKeys(reg.Metadata)] } : {}),\n ...(ReplacedSectionKeys(reg.Metadata).length > 0 || reg.Metadata.relatedEntity ? { ReplacesPlace: true } : {}),\n };\n });\n\n return {\n Entity: input.EntityName,\n RecordPrimaryKey: input.RecordPrimaryKey,\n FormChoice: { ...input.FormChoice },\n Layout: input.Layout,\n Sections: input.Panels.map((p) => ({\n Key: p.SectionKey,\n Title: p.SectionName,\n Variant: p.Variant,\n Group: groupOf(input.Groups, p.SectionKey),\n Hidden: input.HiddenSectionKeys.has(p.SectionKey),\n Fields: (p.Fields ?? []).map((f) => ({ Name: f.Name, Label: f.Label })),\n })),\n Related: related,\n Contributions: contributions,\n Rail: input.Groups.map((group) => ({\n Key: group.Key,\n Title: group.Title,\n Icon: group.Icon,\n SectionKeys: [...group.SectionKeys],\n IsMore: group.IsMore === true,\n })),\n SlotsPresent: [...input.SlotsPresent],\n ChromeRuleCount: input.ChromeRuleCount,\n };\n}\n\n/** One section of {@link FormAgentContext}. */\nexport interface FormAgentContextSection {\n Key: string;\n Title: string;\n Variant: string;\n Hidden: boolean;\n /** The contribution that draws this section or stands in for it, or null when none does. */\n ContributionKey: string | null;\n}\n\n/**\n * The form the user is looking at, as an agent sees it in `AppContext.AdditionalContext.Form`.\n *\n * Every value of `AdditionalContext` goes into every agent prompt, so this carries only what\n * identifies the form and its sections. The rest (fields, rail, contribution details) stays in\n * the full {@link FormCompositionSnapshot}, which the apply flow reads from the\n * `FormCompositionRegistry`, and the `Get Form Composition For Entity` and\n * `Get Form Contributions For Entity` actions report it to an agent that needs it. Keep field\n * names stable.\n */\nexport interface FormAgentContext {\n Entity: string;\n /** The record, as `CompositeKey.ToURLSegment()`; null for a record not saved yet. */\n RecordPrimaryKey: string | null;\n FormChoice: FormCompositionChoice;\n Sections: FormAgentContextSection[];\n}\n\n/**\n * The compact {@link FormAgentContext} of a snapshot. Only contributions the form draws hold a\n * section: one that is hidden (by the user, or by inclusion `None`) holds none, so the section is\n * reported as the form draws it.\n */\nexport function BuildFormAgentContext(snapshot: FormCompositionSnapshot): FormAgentContext {\n const drawn = snapshot.Contributions.filter((c) => !c.Hidden);\n const contributionKeys = new Set(drawn.map((c) => c.Key));\n const holderBySection = new Map<string, string>();\n // Weakest claim first, so a stronger one overwrites it: a grid claim, then a block a\n // contribution stands in for, then the contribution's own section.\n for (const rel of snapshot.Related) {\n const key = RelatedContributionKey(rel.Entity, rel.JoinField);\n if (rel.Source === 'claimed' && contributionKeys.has(key)) holderBySection.set(rel.SectionKey, key);\n }\n for (const c of drawn) {\n for (const sectionKey of c.SectionKeys ?? []) holderBySection.set(sectionKey, c.Key);\n }\n for (const key of contributionKeys) holderBySection.set(key, key);\n return {\n Entity: snapshot.Entity,\n RecordPrimaryKey: snapshot.RecordPrimaryKey,\n FormChoice: { ...snapshot.FormChoice },\n Sections: snapshot.Sections.map((section) => ({\n Key: section.Key,\n Title: section.Title,\n Variant: section.Variant,\n Hidden: section.Hidden,\n ContributionKey: holderBySection.get(section.Key) ?? null,\n })),\n };\n}\n"]}
|
|
@@ -51,6 +51,12 @@ export interface ResolveFormChromeInput {
|
|
|
51
51
|
* appear for grids the template already owns (or chose not to show).
|
|
52
52
|
*/
|
|
53
53
|
IncludeUnbakedRelated?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Sections known to be empty whose metadata says to hide them or move them
|
|
56
|
+
* to More (`whenEmpty`). Applied AFTER the layout is chosen, so counts
|
|
57
|
+
* arriving never flip accordion ↔ left-nav. Omit / empty = no change.
|
|
58
|
+
*/
|
|
59
|
+
EmptySectionBehavior?: ReadonlyMap<string, 'hide' | 'more'>;
|
|
54
60
|
}
|
|
55
61
|
export interface ResolveFormChromeResult {
|
|
56
62
|
Spec: FormChromeSpec;
|
|
@@ -63,6 +69,15 @@ export interface ResolveFormChromeResult {
|
|
|
63
69
|
export declare function ResolveFormPolicy(entityName: string): BaseFormPolicy | null;
|
|
64
70
|
export declare function BuildRelatedFormRoleCandidates(entity: EntityInfo, relatedSchemaByEntityId: ReadonlyMap<string, string>, inboundCountByRelatedEntityId?: ReadonlyMap<string, number>): RelatedFormRoleCandidate[];
|
|
65
71
|
export declare function ResolveFormChrome(input: ResolveFormChromeInput): ResolveFormChromeResult;
|
|
72
|
+
/**
|
|
73
|
+
* Empty-section chrome (`whenEmpty`). `'hide'` removes the section from every
|
|
74
|
+
* group and from More. `'more'` moves a first-class group into More — only when
|
|
75
|
+
* EVERY section in that group is empty-`'more'`, so a merged Bill-To / Ship-To
|
|
76
|
+
* group with rows in one half stays put. Layout is left unchanged. Runs after
|
|
77
|
+
* user membership so a hidden-when-empty section never reappears through a
|
|
78
|
+
* persisted rail order, and after the policy decorate so it cannot be undone.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ApplyEmptySectionBehavior(spec: FormChromeSpec, behavior: ReadonlyMap<string, 'hide' | 'more'> | null | undefined, panels?: readonly FormChromePanelSnapshot[]): FormChromeSpec;
|
|
66
81
|
/**
|
|
67
82
|
* Policy may rename groups and swap icons. Membership (section keys and
|
|
68
83
|
* More vs first-class) is data — a violating decorate is ignored.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-form-chrome.d.ts","sourceRoot":"","sources":["../../../src/lib/chrome/resolve-form-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EAKV,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAE7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EACjC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,cAAc,EAA0B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,
|
|
1
|
+
{"version":3,"file":"resolve-form-chrome.d.ts","sourceRoot":"","sources":["../../../src/lib/chrome/resolve-form-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,UAAU,EAKV,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,wBAAwB,EAE7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EACjC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,cAAc,EAA0B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAMH,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACtB,MAAM,eAAe,CAAC;AAEvB,mEAAmE;AACnE,MAAM,WAAW,wBAAwB;IACrC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,qBAAqB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAsB;IACnC,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,0EAA0E;IAC1E,uBAAuB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,iDAAiD;IACjD,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI,CAAC;IAC7C;;;OAGG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,EAAE,CAYnB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CACzC,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,eAAe,GACxB,MAAM,EAAE,CAQV;AAED,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,EAAE,CAmBrF;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,wBAAwB,GAAG,IAAI,GAAG,SAAS,EACrD,MAAM,GAAE,SAAS,uBAAuB,EAAO,GAChD,cAAc,CA4BhB;AAED,sFAAsF;AACtF,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,MAAM,GAAE,SAAS,uBAAuB,EAAO,GAChD,cAAc,CAmChB"}
|
|
@@ -2,7 +2,7 @@ import { ApplyFormChromeRules, ContributionInclusionFromRules, ResolveFormLayout
|
|
|
2
2
|
import { MJGlobal } from '@memberjunction/global';
|
|
3
3
|
import { CreateRelatedEntitySectionKeyResolver } from '../panel-slot/form-contribution';
|
|
4
4
|
import { BaseFormPolicy } from './base-form-policy';
|
|
5
|
-
import { DETAILS_SECTION_KEY, MORE_SECTION_KEY, HumanizeEntityTitle, IsAlwaysMoreSection, } from './form-chrome';
|
|
5
|
+
import { DETAILS_SECTION_KEY, DETAILS_SECTION_TITLE, MORE_SECTION_KEY, HumanizeEntityTitle, IsAlwaysMoreSection, } from './form-chrome';
|
|
6
6
|
/**
|
|
7
7
|
* Last-wins `BaseFormPolicy` for this entity, or `null` when none is registered.
|
|
8
8
|
*/
|
|
@@ -58,12 +58,41 @@ export function ResolveFormChrome(input) {
|
|
|
58
58
|
const decorated = policy.DecorateChrome(defaultSpec, ctx);
|
|
59
59
|
const spec = TakeDecoratedChrome(defaultSpec, decorated ?? defaultSpec);
|
|
60
60
|
ApplyUserChromeMembership(spec, input.Membership, visiblePanels);
|
|
61
|
+
ApplyEmptySectionBehavior(spec, input.EmptySectionBehavior, visiblePanels);
|
|
61
62
|
ApplyFormChromeRuleTitles(spec, input.Entity, input.ChromeRules ?? []);
|
|
62
63
|
return { Spec: spec, RelatedRoles: resolution, PolicyUsed: true };
|
|
63
64
|
}
|
|
65
|
+
ApplyEmptySectionBehavior(defaultSpec, input.EmptySectionBehavior, visiblePanels);
|
|
64
66
|
ApplyFormChromeRuleTitles(defaultSpec, input.Entity, input.ChromeRules ?? []);
|
|
65
67
|
return { Spec: defaultSpec, RelatedRoles: resolution, PolicyUsed: false };
|
|
66
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Empty-section chrome (`whenEmpty`). `'hide'` removes the section from every
|
|
71
|
+
* group and from More. `'more'` moves a first-class group into More — only when
|
|
72
|
+
* EVERY section in that group is empty-`'more'`, so a merged Bill-To / Ship-To
|
|
73
|
+
* group with rows in one half stays put. Layout is left unchanged. Runs after
|
|
74
|
+
* user membership so a hidden-when-empty section never reappears through a
|
|
75
|
+
* persisted rail order, and after the policy decorate so it cannot be undone.
|
|
76
|
+
*/
|
|
77
|
+
export function ApplyEmptySectionBehavior(spec, behavior, panels = []) {
|
|
78
|
+
if (!behavior || behavior.size === 0)
|
|
79
|
+
return spec;
|
|
80
|
+
const hide = new Set([...behavior].filter(([, b]) => b === 'hide').map(([key]) => key));
|
|
81
|
+
const more = new Set(spec.MoreSectionKeys.filter((key) => !hide.has(key)));
|
|
82
|
+
for (const group of spec.Groups) {
|
|
83
|
+
if (group.IsMore)
|
|
84
|
+
continue;
|
|
85
|
+
group.SectionKeys = group.SectionKeys.filter((key) => !hide.has(key));
|
|
86
|
+
const keys = group.SectionKeys;
|
|
87
|
+
if (keys.length > 0 && keys.every((key) => behavior.get(key) === 'more')) {
|
|
88
|
+
for (const key of keys)
|
|
89
|
+
more.add(key);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
spec.Groups = spec.Groups.filter((g) => g.IsMore || g.SectionKeys.length > 0);
|
|
93
|
+
spec.MoreSectionKeys = spec.MoreSectionKeys.filter((key) => !hide.has(key));
|
|
94
|
+
return RebuildChromeSpecMembership(spec, [...more], panels);
|
|
95
|
+
}
|
|
67
96
|
/**
|
|
68
97
|
* Policy may rename groups and swap icons. Membership (section keys and
|
|
69
98
|
* More vs first-class) is data — a violating decorate is ignored.
|
|
@@ -212,7 +241,7 @@ export function BuildDefaultChromeSpec(panels, relatedRoles, formConfig, contrib
|
|
|
212
241
|
const firstField = panels.find((p) => p.SectionKey === fieldKeys[0]);
|
|
213
242
|
groups.push({
|
|
214
243
|
Key: DETAILS_SECTION_KEY,
|
|
215
|
-
Title:
|
|
244
|
+
Title: DETAILS_SECTION_TITLE,
|
|
216
245
|
Icon: firstField?.Icon?.trim() || 'fa-solid fa-id-card',
|
|
217
246
|
SectionKeys: fieldKeys,
|
|
218
247
|
IsMore: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-form-chrome.js","sourceRoot":"","sources":["../../../src/lib/chrome/resolve-form-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,8BAA8B,EAG9B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GAQ1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,qCAAqC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,cAAc,EAA0B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACH,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,GAItB,MAAM,eAAe,CAAC;AA6DvB;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAChD,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,6BAA6B,CAC9E,cAAc,EACd,CAAC,QAAQ,EAAE,EAA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,KAAK;iBAChB,CAAC,CAAC;YACP,CAAC;YACD,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IAED,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IAEnD,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,mBAAmB,EAAE,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtG,CAAC;AAED,SAAS,eAAe,CAAC,IAAoB;IACzC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;AAC9B,CAAC","sourcesContent":["import {\n ApplyFormChromeRules,\n ContributionInclusionFromRules,\n EntityInfo,\n EntityRelationshipInfo,\n ResolveFormLayout,\n ReadRelationshipSortKey,\n ResolveRelatedFormRoles,\n type FormChromeRule,\n type FormInclusion,\n type FormRole,\n type IEntityFormConfiguration,\n type RelatedFormRoleAssignment,\n type RelatedFormRoleCandidate,\n type RelatedFormRoleResolution,\n} from '@memberjunction/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { CreateRelatedEntitySectionKeyResolver } from '../panel-slot/form-contribution';\nimport { BaseFormPolicy, type FormChromeContext } from './base-form-policy';\nimport {\n DETAILS_SECTION_KEY,\n MORE_SECTION_KEY,\n HumanizeEntityTitle,\n IsAlwaysMoreSection,\n type FormChromeGroup,\n type FormChromePanelSnapshot,\n type FormChromeSpec,\n} from './form-chrome';\n\n/** User override of which sections live in More vs first-class. */\nexport interface ChromeMembershipOverride {\n moreSectionKeys?: readonly string[];\n firstClassSectionKeys?: readonly string[];\n}\n\nexport interface ResolveFormChromeInput {\n Entity: EntityInfo;\n Panels: FormChromePanelSnapshot[];\n /** Related-entity schema by entity ID. Built from the active provider. */\n RelatedSchemaByEntityId: ReadonlyMap<string, string>;\n /**\n * Section keys a contribution claimed or replaced. Must not appear in\n * the rail — otherwise a custom Contact Methods widget and the baked\n * grid merge into one group and both show.\n */\n HiddenSectionKeys?: readonly string[];\n /** Persisted user move-in / move-out of More. */\n Membership?: ChromeMembershipOverride | null;\n /**\n * RelatedEntityID (lowercase) → how many EntityRelationships point at\n * that entity. Used as graph in-degree by the smart ranker.\n */\n InboundRelationshipCountByEntityId?: ReadonlyMap<string, number>;\n /**\n * Section keys of registered form contributions (custom widgets). These\n * stay first-class instead of folding into Details, and rank above\n * stock related grids.\n */\n ContributionSectionKeys?: readonly string[];\n /** contribution SectionKey → details | more. Overrides first-class lift. */\n ContributionChromeGroupByKey?: ReadonlyMap<string, 'details' | 'more'>;\n /**\n * L1 inclusion from the winning contribution registration.\n * L3 `ChromeRules` still wins on the same key.\n */\n ContributionInclusionByKey?: ReadonlyMap<string, FormInclusion>;\n /** `sortKey` from the winning registration. Higher = earlier in the lead band. */\n ContributionSortKeyByKey?: ReadonlyMap<string, number>;\n /**\n * Install overlay (L3) from `MJ: Form Chrome Rules`. Empty when the\n * entity is not installed or the parent has no rows.\n */\n ChromeRules?: readonly FormChromeRule[];\n /**\n * When false, do not invent chrome groups for DisplayInForm related\n * that have no baked / contributed panel. Custom forms that set\n * `ShowRelatedEntities: false` use this so leftover More does not\n * appear for grids the template already owns (or chose not to show).\n */\n IncludeUnbakedRelated?: boolean;\n}\n\nexport interface ResolveFormChromeResult {\n Spec: FormChromeSpec;\n RelatedRoles: RelatedFormRoleResolution;\n PolicyUsed: boolean;\n}\n\n/**\n * Last-wins `BaseFormPolicy` for this entity, or `null` when none is registered.\n */\nexport function ResolveFormPolicy(entityName: string): BaseFormPolicy | null {\n const registrations = MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPolicy,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as { entity?: unknown }).entity;\n return typeof entity === 'string' && entity === entityName;\n },\n );\n if (registrations.length === 0) return null;\n const winner = [...registrations].sort((a, b) => (a.Priority ?? 0) - (b.Priority ?? 0)).at(-1);\n if (!winner?.SubClass) return null;\n const Ctor = winner.SubClass as new () => BaseFormPolicy;\n return new Ctor();\n}\n\nexport function BuildRelatedFormRoleCandidates(\n entity: EntityInfo,\n relatedSchemaByEntityId: ReadonlyMap<string, string>,\n inboundCountByRelatedEntityId: ReadonlyMap<string, number> = new Map(),\n): RelatedFormRoleCandidate[] {\n return entity.RelatedEntities.map((rel) =>\n toCandidate(rel, relatedSchemaByEntityId, inboundCountByRelatedEntityId),\n );\n}\n\nexport function ResolveFormChrome(input: ResolveFormChromeInput): ResolveFormChromeResult {\n const formConfig = input.Entity.ConfigurationObject?.UI?.Form ?? null;\n const ranked = ResolveRelatedFormRoles(\n input.Entity.SchemaName,\n formConfig,\n BuildRelatedFormRoleCandidates(\n input.Entity,\n input.RelatedSchemaByEntityId,\n input.InboundRelationshipCountByEntityId,\n ),\n );\n const assignments = ApplyFormChromeRules(\n input.Entity.ID ?? '',\n ranked.Assignments,\n input.ChromeRules ?? [],\n );\n const resolution: RelatedFormRoleResolution = { ...ranked, Assignments: assignments };\n\n const relatedRoles = mapRelatedRoles(input.Entity, assignments);\n const contributionGroups = applyContributionRules(\n input.Entity.ID ?? '',\n input.ContributionSectionKeys ?? [],\n input.ContributionChromeGroupByKey ?? new Map(),\n input.ContributionInclusionByKey ?? new Map(),\n input.ChromeRules ?? [],\n );\n const hidden = new Set(input.HiddenSectionKeys ?? []);\n for (const key of displayInFormFalseSectionKeys(input.Entity)) hidden.add(key);\n for (const key of noneInclusionSectionKeys(input.Entity, assignments)) hidden.add(key);\n for (const key of contributionGroups.hiddenKeys) hidden.add(key);\n const visiblePanels = input.Panels.filter((p) => !hidden.has(p.SectionKey));\n const defaultSpec = BuildDefaultChromeSpec(\n visiblePanels,\n relatedRoles,\n formConfig,\n input.ContributionSectionKeys,\n contributionGroups.chromeGroupByKey,\n );\n if (input.IncludeUnbakedRelated !== false) {\n addMissingRelatedGroups(defaultSpec, input.Entity, relatedRoles, hidden);\n }\n applyRelatedDisplayNames(defaultSpec, input.Entity);\n mergeRelatedGroupsByEntity(defaultSpec, input.Entity);\n sortFirstClassRelatedGroups(\n defaultSpec,\n input.Entity,\n assignments,\n input.ContributionSectionKeys,\n contributionGroups.leadKeys,\n input.ContributionSortKeyByKey ?? new Map(),\n );\n ApplyUserChromeMembership(defaultSpec, input.Membership, visiblePanels);\n\n const policy = ResolveFormPolicy(input.Entity.Name);\n if (policy) {\n const ctx: FormChromeContext = {\n Entity: input.Entity,\n RelatedRoles: resolution,\n Panels: input.Panels,\n PrimarySectionCount: countFirstClass(defaultSpec),\n };\n const decorated = policy.DecorateChrome(defaultSpec, ctx);\n const spec = TakeDecoratedChrome(defaultSpec, decorated ?? defaultSpec);\n ApplyUserChromeMembership(spec, input.Membership, visiblePanels);\n ApplyFormChromeRuleTitles(spec, input.Entity, input.ChromeRules ?? []);\n return { Spec: spec, RelatedRoles: resolution, PolicyUsed: true };\n }\n\n ApplyFormChromeRuleTitles(defaultSpec, input.Entity, input.ChromeRules ?? []);\n return { Spec: defaultSpec, RelatedRoles: resolution, PolicyUsed: false };\n}\n\n/**\n * Policy may rename groups and swap icons. Membership (section keys and\n * More vs first-class) is data — a violating decorate is ignored.\n */\nexport function TakeDecoratedChrome(base: FormChromeSpec, decorated: FormChromeSpec): FormChromeSpec {\n return sameChromeMembership(base, decorated) ? decorated : base;\n}\n\n/**\n * L3 Title overlay. Last Sequence wins. Blank Title is ignored so an\n * incomplete rule cannot wipe DisplayName. Applied after policy decorate\n * so an admin title survives an OpenApp policy rename.\n */\nexport function ApplyFormChromeRuleTitles(\n spec: FormChromeSpec,\n entity: EntityInfo,\n rules: readonly FormChromeRule[],\n): void {\n const parent = (entity.ID ?? '').trim().toLowerCase();\n if (!parent) return;\n const titled = rules\n .filter((rule) => chromeIdsEqual(rule.EntityID, parent) && hasChromeTitle(rule.Title))\n .sort((a, b) => (a.Sequence ?? 0) - (b.Sequence ?? 0));\n if (titled.length === 0) return;\n\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const keysByRelatedId = new Map<string, string[]>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const id = (rel.RelatedEntityID ?? '').trim().toLowerCase();\n if (!id) continue;\n const key = sectionKeyOf(rel);\n const list = keysByRelatedId.get(id) ?? [];\n list.push(key);\n keysByRelatedId.set(id, list);\n }\n\n const titleByKey = new Map<string, string>(spec.TitleBySectionKey);\n for (const rule of titled) {\n const title = (rule.Title ?? '').trim();\n if (rule.TargetKind === 'Contribution') {\n const key = (rule.ContributionKey ?? '').trim();\n if (key) titleByKey.set(key, title);\n continue;\n }\n const relatedId = (rule.RelatedEntityID ?? '').trim().toLowerCase();\n for (const key of keysByRelatedId.get(relatedId) ?? []) {\n titleByKey.set(key, title);\n }\n }\n if (titleByKey.size === 0) return;\n\n spec.TitleBySectionKey = titleByKey;\n for (const group of spec.Groups) {\n if (group.IsMore) continue;\n const override = group.SectionKeys\n .map((key) => titleByKey.get(key))\n .find((value): value is string => !!value)\n ?? titleByKey.get(group.Key);\n if (override) group.Title = override;\n }\n}\n\nfunction hasChromeTitle(title: string | null | undefined): boolean {\n return (title ?? '').trim().length > 0;\n}\n\nfunction chromeIdsEqual(a: string | null | undefined, b: string | null | undefined): boolean {\n const left = (a ?? '').trim().toLowerCase();\n const right = (b ?? '').trim().toLowerCase();\n return left.length > 0 && left === right;\n}\n\nfunction sameChromeMembership(a: FormChromeSpec, b: FormChromeSpec): boolean {\n return keyFingerprint(collectSectionKeys(a)) === keyFingerprint(collectSectionKeys(b))\n && keyFingerprint(a.MoreSectionKeys) === keyFingerprint(b.MoreSectionKeys);\n}\n\nfunction collectSectionKeys(spec: FormChromeSpec): string[] {\n return [...spec.Groups.flatMap((g) => g.SectionKeys), ...spec.MoreSectionKeys];\n}\n\nfunction keyFingerprint(keys: readonly string[]): string {\n return [...new Set(keys.filter((k) => !!k))].sort().join('\\0');\n}\n\nfunction applyContributionRules(\n parentEntityId: string,\n contributionSectionKeys: readonly string[],\n declared: ReadonlyMap<string, 'details' | 'more'>,\n l1InclusionByKey: ReadonlyMap<string, FormInclusion>,\n rules: readonly FormChromeRule[],\n): { chromeGroupByKey: Map<string, 'details' | 'more'>; hiddenKeys: string[]; leadKeys: string[] } {\n const chromeGroupByKey = new Map(declared);\n const hiddenKeys: string[] = [];\n const leadKeys: string[] = [];\n for (const key of contributionSectionKeys) {\n const inclusion = ContributionInclusionFromRules(parentEntityId, key, rules)\n ?? l1InclusionByKey.get(key)\n ?? null;\n applyContributionInclusion(key, inclusion, chromeGroupByKey, hiddenKeys);\n if (isLeadContribution(key, inclusion, chromeGroupByKey)) {\n leadKeys.push(key);\n }\n }\n return { chromeGroupByKey, hiddenKeys, leadKeys };\n}\n\nfunction applyContributionInclusion(\n key: string,\n inclusion: FormInclusion | null,\n chromeGroupByKey: Map<string, 'details' | 'more'>,\n hiddenKeys: string[],\n): void {\n if (inclusion == null) return;\n if (inclusion === 'None') {\n hiddenKeys.push(key);\n return;\n }\n if (inclusion === 'More') {\n chromeGroupByKey.set(key, 'more');\n }\n // Primary is its own first-class rail item. Do not fold into Details.\n}\n\nfunction isLeadContribution(\n key: string,\n inclusion: FormInclusion | null,\n chromeGroupByKey: ReadonlyMap<string, 'details' | 'more'>,\n): boolean {\n if (inclusion !== 'Primary') return false;\n const pinned = chromeGroupByKey.get(key);\n return pinned !== 'details' && pinned !== 'more';\n}\n\nexport function BuildDefaultChromeSpec(\n panels: FormChromePanelSnapshot[],\n relatedRoles: ReadonlyMap<string, FormRole>,\n formConfig: IEntityFormConfiguration | null,\n contributionSectionKeys: readonly string[] = [],\n contributionChromeGroupByKey: ReadonlyMap<string, 'details' | 'more'> = new Map(),\n): FormChromeSpec {\n const moreKeys: string[] = [];\n const fieldKeys: string[] = [];\n const relatedGroups: FormChromeGroup[] = [];\n const contributions = new Set(contributionSectionKeys);\n\n for (const panel of panels) {\n if (!panel.SectionKey) continue;\n if (IsAlwaysMoreSection(panel.SectionKey, panel.SectionName)) {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n const pinned = contributionChromeGroupByKey.get(panel.SectionKey);\n if (pinned === 'details') {\n fieldKeys.push(panel.SectionKey);\n continue;\n }\n if (pinned === 'more') {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n if (panel.Variant === 'related-entity' || contributions.has(panel.SectionKey)) {\n if (relatedRoles.get(panel.SectionKey) === 'Detail') {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n relatedGroups.push(relatedGroupFromPanel(panel));\n continue;\n }\n fieldKeys.push(panel.SectionKey);\n }\n\n const groups: FormChromeGroup[] = [];\n if (fieldKeys.length > 0) {\n const firstField = panels.find((p) => p.SectionKey === fieldKeys[0]);\n groups.push({\n Key: DETAILS_SECTION_KEY,\n Title: 'Details',\n Icon: firstField?.Icon?.trim() || 'fa-solid fa-id-card',\n SectionKeys: fieldKeys,\n IsMore: false,\n });\n }\n groups.push(...MergeChromeGroupsByTitle(relatedGroups));\n appendMoreGroup(groups, moreKeys);\n\n const layout = ResolveFormLayout(formConfig, groups.length);\n return {\n Layout: layout,\n Groups: groups,\n RelatedRoles: relatedRoles,\n MoreSectionKeys: moreKeys,\n };\n}\n\nfunction relatedRailIcon(rel: EntityRelationshipInfo): string {\n if (rel.DisplayIconType === 'Custom' && rel.DisplayIcon?.trim()) {\n return rel.DisplayIcon.trim();\n }\n if (rel.DisplayIcon?.trim()) return rel.DisplayIcon.trim();\n return 'fa-solid fa-table';\n}\n\nfunction relatedGroupFromPanel(panel: FormChromePanelSnapshot): FormChromeGroup {\n return {\n Key: panel.SectionKey,\n Title: HumanizeEntityTitle(panel.SectionName || panel.SectionKey),\n Icon: panel.Icon?.trim() || 'fa-solid fa-table',\n SectionKeys: [panel.SectionKey],\n IsMore: false,\n };\n}\n\n/** First SectionKey index in a user order; used to sort rail groups. */\nexport function ChromeGroupOrderIndex(group: FormChromeGroup, sectionOrder: readonly string[]): number {\n let min = Number.MAX_SAFE_INTEGER;\n for (const key of group.SectionKeys) {\n const index = sectionOrder.indexOf(key);\n if (index >= 0 && index < min) min = index;\n }\n return min;\n}\n\n/**\n * Layer a (possibly incomplete) user ranking on the current default rail.\n * Keys the user ranked keep that relative order. Keys they never ranked\n * (Overview, a new related grid) stay in their default slots instead of\n * falling to the end — `form.sections` does not list slot-mounted leads.\n */\nexport function OverlayChromeSectionOrder(\n defaultOrder: readonly string[],\n userOrder: readonly string[],\n): string[] {\n if (userOrder.length === 0) return [...defaultOrder];\n const defaultSet = new Set(defaultOrder);\n const userSet = new Set(userOrder);\n const result = userOrder.filter((key) => defaultSet.has(key));\n for (let i = 0; i < defaultOrder.length; i++) {\n const key = defaultOrder[i];\n if (userSet.has(key)) continue;\n let insertAt = 0;\n for (let j = i - 1; j >= 0; j--) {\n const idx = result.indexOf(defaultOrder[j]);\n if (idx >= 0) {\n insertAt = idx + 1;\n break;\n }\n }\n result.splice(insertAt, 0, key);\n }\n return result;\n}\n\n/** Reorder More children from a persisted section-key order. */\nexport function OrderMoreSectionKeys(\n moreKeys: readonly string[],\n sectionOrder: readonly string[],\n): string[] {\n return OverlayChromeSectionOrder(moreKeys, sectionOrder);\n}\n\n/**\n * Keep the first-class rail order from the previous spec when chrome\n * re-resolves (slot mount, grid load, contribution key appearing).\n * Clicking a rail item must not reshuffle the list.\n * New related groups append. New lead contributions (Overview) insert\n * into the lead band before Details. More stays last.\n * User drag still wins via {@link OrderChromeGroups}.\n */\nexport function StabilizeFirstClassGroupOrder(\n previous: FormChromeSpec | null | undefined,\n next: FormChromeSpec,\n): FormChromeSpec {\n if (!previous || previous.Groups.length === 0) return next;\n const details = next.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = next.Groups.filter((g) => g.IsMore);\n const leads = next.Groups.filter((g) => !g.IsMore && !!g.IsLead && g.Key !== DETAILS_SECTION_KEY);\n const related = next.Groups.filter((g) => !g.IsMore && !g.IsLead && g.Key !== DETAILS_SECTION_KEY);\n if (leads.length === 0 && related.length === 0) return next;\n\n const used = new Set<string>();\n const orderedLeads: FormChromeGroup[] = [];\n const orderedRelated: FormChromeGroup[] = [];\n const take = (bucket: FormChromeGroup[], group: FormChromeGroup | undefined): void => {\n if (!group || used.has(group.Key)) return;\n used.add(group.Key);\n bucket.push(group);\n };\n const matchIn = (pool: FormChromeGroup[], prev: FormChromeGroup): FormChromeGroup | undefined => {\n const prevTitle = prev.Title.trim().toLowerCase();\n const prevKeys = new Set(prev.SectionKeys);\n return pool.find((g) => g.Key === prev.Key)\n ?? pool.find((g) => g.SectionKeys.some((key) => prevKeys.has(key)))\n ?? pool.find((g) => g.Title.trim().toLowerCase() === prevTitle);\n };\n\n for (const prev of previous.Groups) {\n if (prev.IsMore || prev.Key === DETAILS_SECTION_KEY) continue;\n take(orderedLeads, matchIn(leads, prev));\n take(orderedRelated, matchIn(related, prev));\n }\n for (const group of leads) {\n take(orderedLeads, group);\n }\n for (const group of related) {\n take(orderedRelated, group);\n }\n next.Groups = [...orderedLeads, ...details, ...orderedRelated, ...more];\n return next;\n}\n\n/** Reorder first-class rail groups from a persisted section-key order. More stays last. */\nexport function OrderChromeGroups(\n groups: readonly FormChromeGroup[],\n sectionOrder: readonly string[],\n): FormChromeGroup[] {\n if (sectionOrder.length === 0) return [...groups];\n const more = groups.filter((g) => g.IsMore);\n const rest = groups.filter((g) => !g.IsMore);\n const defaultKeys = rest.flatMap((g) => g.SectionKeys);\n const overlaid = OverlayChromeSectionOrder(defaultKeys, sectionOrder);\n rest.sort((a, b) => {\n const ai = ChromeGroupOrderIndex(a, overlaid);\n const bi = ChromeGroupOrderIndex(b, overlaid);\n return ai - bi;\n });\n return [...rest, ...more];\n}\n\n/**\n * Move every SectionKey of `dragged` as a block in front of `target`\n * inside a section-order list. Used by left-nav rail drag/drop.\n */\nexport function MoveChromeGroupInSectionOrder(\n sectionOrder: readonly string[],\n dragged: FormChromeGroup,\n target: FormChromeGroup,\n): string[] {\n const draggedKeys = new Set(dragged.SectionKeys);\n const without = sectionOrder.filter((key) => !draggedKeys.has(key));\n const insertAt = without.findIndex((key) => target.SectionKeys.includes(key));\n const next = [...without];\n const at = insertAt >= 0 ? insertAt : next.length;\n next.splice(at, 0, ...dragged.SectionKeys);\n return next;\n}\n\n/** Collapse rail items that share a humanized title (From/To Relationships). */\nexport function MergeChromeGroupsByTitle(groups: FormChromeGroup[]): FormChromeGroup[] {\n const merged: FormChromeGroup[] = [];\n const byTitle = new Map<string, FormChromeGroup>();\n for (const group of groups) {\n const titleKey = group.Title.trim().toLowerCase();\n const existing = byTitle.get(titleKey);\n if (!existing) {\n const copy: FormChromeGroup = { ...group, SectionKeys: [...group.SectionKeys] };\n byTitle.set(titleKey, copy);\n merged.push(copy);\n continue;\n }\n for (const key of group.SectionKeys) {\n if (!existing.SectionKeys.includes(key)) {\n existing.SectionKeys.push(key);\n }\n }\n }\n return merged;\n}\n\n/**\n * Apply a persisted user membership (move in/out of More) onto a spec\n * in place. Always-more sections (System Metadata) cannot leave More.\n */\nexport function ApplyUserChromeMembership(\n spec: FormChromeSpec,\n override: ChromeMembershipOverride | null | undefined,\n panels: readonly FormChromePanelSnapshot[] = [],\n): FormChromeSpec {\n if (!override) return spec;\n const userMore = override.moreSectionKeys ?? [];\n const userFirst = override.firstClassSectionKeys ?? [];\n if (userMore.length === 0 && userFirst.length === 0) return spec;\n\n const more = new Set(spec.MoreSectionKeys);\n for (const key of userMore) {\n if (key) more.add(key);\n }\n const panelByKey = new Map(panels.map((p) => [p.SectionKey, p]));\n for (const key of userFirst) {\n if (!key) continue;\n const panel = panelByKey.get(key);\n if (!IsAlwaysMoreSection(key, panel?.SectionName)) {\n more.delete(key);\n }\n }\n for (const panel of panels) {\n if (IsAlwaysMoreSection(panel.SectionKey, panel.SectionName)) {\n more.add(panel.SectionKey);\n }\n }\n for (const key of spec.MoreSectionKeys) {\n if (IsAlwaysMoreSection(key)) more.add(key);\n }\n\n return RebuildChromeSpecMembership(spec, [...more], panels);\n}\n\n/** Rebuild Groups / MoreSectionKeys after membership changes. Layout is unchanged. */\nexport function RebuildChromeSpecMembership(\n spec: FormChromeSpec,\n moreKeys: readonly string[],\n panels: readonly FormChromePanelSnapshot[] = [],\n): FormChromeSpec {\n const moreSet = new Set(moreKeys);\n const panelByKey = new Map(panels.map((p) => [p.SectionKey, p]));\n const groups: FormChromeGroup[] = [];\n\n for (const group of spec.Groups) {\n if (group.IsMore) continue;\n const stay = group.SectionKeys.filter((key) => !moreSet.has(key));\n if (stay.length === 0) continue;\n groups.push({ ...group, SectionKeys: stay });\n }\n\n const firstClass = new Set(groups.flatMap((g) => g.SectionKeys));\n const allKnown = new Set<string>([\n ...spec.Groups.flatMap((g) => g.SectionKeys),\n ...spec.MoreSectionKeys,\n ...moreKeys,\n ]);\n for (const key of allKnown) {\n if (!key || moreSet.has(key) || firstClass.has(key)) continue;\n const panel = panelByKey.get(key);\n groups.push({\n Key: key,\n Title: HumanizeEntityTitle(panel?.SectionName || key),\n Icon: panel?.Icon?.trim() || 'fa-solid fa-table',\n SectionKeys: [key],\n IsMore: false,\n });\n firstClass.add(key);\n }\n\n appendMoreGroup(groups, [...moreSet]);\n spec.Groups = groups;\n spec.MoreSectionKeys = [...moreSet];\n return spec;\n}\n\n/** Prefer EntityRelationship.DisplayName on single-key related groups. */\nfunction applyRelatedDisplayNames(spec: FormChromeSpec, entity: EntityInfo): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const name = rel.DisplayName?.trim();\n if (!name) continue;\n const sectionKey = sectionKeyOf(rel);\n const group = spec.Groups.find((g) => !g.IsMore && g.SectionKeys.length === 1 && g.SectionKeys[0] === sectionKey);\n if (group) group.Title = name;\n }\n}\n\nfunction appendMoreGroup(groups: FormChromeGroup[], moreKeys: string[]): void {\n if (moreKeys.length === 0) return;\n const existing = groups.find((g) => g.IsMore);\n if (existing) {\n existing.SectionKeys = moreKeys;\n return;\n }\n groups.push({\n Key: MORE_SECTION_KEY,\n Title: 'More',\n Icon: 'fa-solid fa-ellipsis',\n SectionKeys: moreKeys,\n IsMore: true,\n });\n}\n\nfunction mapRelatedRoles(\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n): Map<string, FormRole> {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const byId = new Map(assignments.map((a) => [a.RelationshipID.toLowerCase(), a]));\n const roles = new Map<string, FormRole>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const sectionKey = sectionKeyOf(rel);\n roles.set(sectionKey, assignment.Role);\n }\n return roles;\n}\n\nfunction toCandidate(\n rel: EntityRelationshipInfo,\n relatedSchemaByEntityId: ReadonlyMap<string, string>,\n inboundCountByRelatedEntityId: ReadonlyMap<string, number> = new Map(),\n): RelatedFormRoleCandidate {\n const relatedId = rel.RelatedEntityID ?? '';\n const schema = relatedSchemaByEntityId.get(relatedId.toLowerCase())\n ?? relatedSchemaByEntityId.get(relatedId)\n ?? '';\n const inbound = inboundCountByRelatedEntityId.get(relatedId.toLowerCase())\n ?? inboundCountByRelatedEntityId.get(relatedId);\n return {\n ID: rel.ID,\n RelatedEntity: rel.RelatedEntity,\n RelatedEntityID: rel.RelatedEntityID,\n RelatedEntityJoinField: rel.RelatedEntityJoinField,\n RelatedEntitySchemaName: schema,\n DisplayInForm: rel.DisplayInForm,\n DisplayLocation: rel.DisplayLocation,\n DisplayComponentID: rel.DisplayComponentID,\n RelatedRecordCollection: rel.RelatedRecordCollection,\n JoinView: rel.JoinView,\n Type: rel.Type,\n Sequence: rel.Sequence,\n Configuration: rel.Configuration,\n InboundRelationshipCount: inbound,\n };\n}\n\n/** First-class rail: lead contributions, then Details, then related by Primary/score. */\nfunction sortFirstClassRelatedGroups(\n spec: FormChromeSpec,\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n contributionSectionKeys: readonly string[] = [],\n leadKeys: readonly string[] = [],\n sortKeyByKey: ReadonlyMap<string, number> = new Map(),\n): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const byId = new Map(assignments.map((a) => [a.RelationshipID.toLowerCase(), a]));\n const scoreByKey = new Map<string, number>();\n const explicitPrimary = new Set<string>();\n const contrib = new Set(contributionSectionKeys);\n const leadSet = new Set(leadKeys);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const key = sectionKeyOf(rel);\n const current = scoreByKey.get(key);\n scoreByKey.set(key, current == null ? assignment.Score : Math.max(current, assignment.Score));\n if (assignment.Reason === 'explicit-primary') explicitPrimary.add(key);\n }\n for (const key of contrib) {\n scoreByKey.set(key, (scoreByKey.get(key) ?? 0) + 150);\n }\n\n const details = spec.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = spec.Groups.filter((g) => g.IsMore);\n const firstClass = spec.Groups.filter((g) => !g.IsMore && g.Key !== DETAILS_SECTION_KEY);\n const leads: FormChromeGroup[] = [];\n const related: FormChromeGroup[] = [];\n for (const group of firstClass) {\n if (group.SectionKeys.some((key) => leadSet.has(key))) {\n group.IsLead = true;\n leads.push(group);\n } else {\n related.push(group);\n }\n }\n const combinedSort = mergeRelatedSortKeys(entity, displayInForm, sortKeyByKey);\n leads.sort((a, b) => groupSortKey(b, combinedSort) - groupSortKey(a, combinedSort));\n related.sort((a, b) => {\n const aSort = groupSortKey(a, combinedSort);\n const bSort = groupSortKey(b, combinedSort);\n if (aSort !== bSort) return bSort - aSort;\n const aExplicit = a.SectionKeys.some((key) => explicitPrimary.has(key));\n const bExplicit = b.SectionKeys.some((key) => explicitPrimary.has(key));\n if (aExplicit !== bExplicit) return aExplicit ? -1 : 1;\n return groupScore(b, scoreByKey) - groupScore(a, scoreByKey);\n });\n spec.Groups = [...leads, ...details, ...related, ...more];\n}\n\nfunction mergeRelatedSortKeys(\n entity: EntityInfo,\n displayInForm: readonly EntityRelationshipInfo[],\n contributionSortKeyByKey: ReadonlyMap<string, number>,\n): Map<string, number> {\n const merged = new Map(contributionSortKeyByKey);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const sort = ReadRelationshipSortKey(rel.Configuration);\n if (sort == null) continue;\n const key = sectionKeyOf(rel);\n const current = merged.get(key);\n merged.set(key, current == null ? sort : Math.max(current, sort));\n }\n return merged;\n}\n\nfunction groupSortKey(group: FormChromeGroup, sortKeyByKey: ReadonlyMap<string, number>): number {\n let max = Number.NEGATIVE_INFINITY;\n for (const key of group.SectionKeys) {\n const value = sortKeyByKey.get(key);\n if (value != null && value > max) max = value;\n }\n return max === Number.NEGATIVE_INFINITY ? 0 : max;\n}\n\nfunction noneInclusionSectionKeys(\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n): string[] {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const noneIds = new Set(\n assignments.filter((a) => a.Inclusion === 'None').map((a) => a.RelationshipID.toLowerCase()),\n );\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n return displayInForm\n .filter((rel) => noneIds.has((rel.ID ?? '').toLowerCase()))\n .map((rel) => sectionKeyOf(rel));\n}\n\nfunction displayInFormFalseSectionKeys(entity: EntityInfo): string[] {\n const all = entity.RelatedEntities ?? [];\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(all);\n return all\n .filter((rel) => !rel.DisplayInForm)\n .map((rel) => sectionKeyOf(rel));\n}\n\n/**\n * Collapse first-class groups that are the same related entity on different\n * join fields (Bill-To Orders + Ship-To Orders → one Orders rail item).\n */\nfunction mergeRelatedGroupsByEntity(spec: FormChromeSpec, entity: EntityInfo): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const entityIdByKey = new Map<string, string>();\n const titleByEntityId = new Map<string, string>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const key = sectionKeyOf(rel);\n const id = (rel.RelatedEntityID ?? '').toLowerCase();\n if (!id) continue;\n entityIdByKey.set(key, id);\n const named = rel.DisplayName?.trim();\n if (named) titleByEntityId.set(id, named);\n else if (!titleByEntityId.has(id)) {\n titleByEntityId.set(id, HumanizeEntityTitle(rel.RelatedEntity));\n }\n }\n\n const details = spec.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = spec.Groups.filter((g) => g.IsMore);\n const related = spec.Groups.filter((g) => !g.IsMore && g.Key !== DETAILS_SECTION_KEY);\n const merged: FormChromeGroup[] = [];\n const byEntity = new Map<string, FormChromeGroup>();\n\n for (const group of related) {\n const entityId = group.SectionKeys\n .map((key) => entityIdByKey.get(key))\n .find((id): id is string => !!id);\n if (!entityId) {\n merged.push(group);\n continue;\n }\n const existing = byEntity.get(entityId);\n if (!existing) {\n const copy: FormChromeGroup = {\n ...group,\n Title: titleByEntityId.get(entityId) || group.Title,\n SectionKeys: [...group.SectionKeys],\n };\n byEntity.set(entityId, copy);\n merged.push(copy);\n continue;\n }\n for (const key of group.SectionKeys) {\n if (!existing.SectionKeys.includes(key)) existing.SectionKeys.push(key);\n }\n const preferred = titleByEntityId.get(entityId);\n if (preferred) existing.Title = preferred;\n }\n\n spec.Groups = [...details, ...merged, ...more];\n}\n\nfunction groupScore(group: FormChromeGroup, scoreByKey: ReadonlyMap<string, number>): number {\n let max = Number.NEGATIVE_INFINITY;\n for (const key of group.SectionKeys) {\n const score = scoreByKey.get(key);\n if (score != null && score > max) max = score;\n }\n return max === Number.NEGATIVE_INFINITY ? 0 : max;\n}\n\nfunction addMissingRelatedGroups(\n spec: FormChromeSpec,\n entity: EntityInfo,\n relatedRoles: ReadonlyMap<string, FormRole>,\n hiddenSectionKeys: ReadonlySet<string> = new Set(),\n): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const known = new Set<string>([\n ...spec.Groups.flatMap((g) => g.SectionKeys),\n ...spec.MoreSectionKeys,\n ...hiddenSectionKeys,\n ]);\n\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const sectionKey = sectionKeyOf(rel);\n if (known.has(sectionKey) || hiddenSectionKeys.has(sectionKey)) continue;\n const role = relatedRoles.get(sectionKey);\n if (role === 'Detail') {\n spec.MoreSectionKeys.push(sectionKey);\n known.add(sectionKey);\n continue;\n }\n if (role === 'Primary') {\n const title = HumanizeEntityTitle(rel.DisplayName?.trim() || rel.RelatedEntity);\n const existing = spec.Groups.find(\n (g) => !g.IsMore && g.Title.trim().toLowerCase() === title.toLowerCase(),\n );\n if (existing) {\n existing.SectionKeys.push(sectionKey);\n } else {\n spec.Groups.push({\n Key: sectionKey,\n Title: title,\n Icon: relatedRailIcon(rel),\n SectionKeys: [sectionKey],\n IsMore: false,\n });\n }\n known.add(sectionKey);\n }\n }\n\n appendMoreGroup(spec.Groups, spec.MoreSectionKeys);\n\n spec.Layout = ResolveFormLayout(entity.ConfigurationObject?.UI?.Form ?? null, spec.Groups.length);\n}\n\nfunction countFirstClass(spec: FormChromeSpec): number {\n return spec.Groups.length;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resolve-form-chrome.js","sourceRoot":"","sources":["../../../src/lib/chrome/resolve-form-chrome.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,8BAA8B,EAG9B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GAQ1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,qCAAqC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EAAE,cAAc,EAA0B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EACH,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAm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ipInfo,\n ResolveFormLayout,\n ReadRelationshipSortKey,\n ResolveRelatedFormRoles,\n type FormChromeRule,\n type FormInclusion,\n type FormRole,\n type IEntityFormConfiguration,\n type RelatedFormRoleAssignment,\n type RelatedFormRoleCandidate,\n type RelatedFormRoleResolution,\n} from '@memberjunction/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { CreateRelatedEntitySectionKeyResolver } from '../panel-slot/form-contribution';\nimport { BaseFormPolicy, type FormChromeContext } from './base-form-policy';\nimport {\n DETAILS_SECTION_KEY,\n DETAILS_SECTION_TITLE,\n MORE_SECTION_KEY,\n HumanizeEntityTitle,\n IsAlwaysMoreSection,\n type FormChromeGroup,\n type FormChromePanelSnapshot,\n type FormChromeSpec,\n} from './form-chrome';\n\n/** User override of which sections live in More vs first-class. */\nexport interface ChromeMembershipOverride {\n moreSectionKeys?: readonly string[];\n firstClassSectionKeys?: readonly string[];\n}\n\nexport interface ResolveFormChromeInput {\n Entity: EntityInfo;\n Panels: FormChromePanelSnapshot[];\n /** Related-entity schema by entity ID. Built from the active provider. */\n RelatedSchemaByEntityId: ReadonlyMap<string, string>;\n /**\n * Section keys a contribution claimed or replaced. Must not appear in\n * the rail — otherwise a custom Contact Methods widget and the baked\n * grid merge into one group and both show.\n */\n HiddenSectionKeys?: readonly string[];\n /** Persisted user move-in / move-out of More. */\n Membership?: ChromeMembershipOverride | null;\n /**\n * RelatedEntityID (lowercase) → how many EntityRelationships point at\n * that entity. Used as graph in-degree by the smart ranker.\n */\n InboundRelationshipCountByEntityId?: ReadonlyMap<string, number>;\n /**\n * Section keys of registered form contributions (custom widgets). These\n * stay first-class instead of folding into Details, and rank above\n * stock related grids.\n */\n ContributionSectionKeys?: readonly string[];\n /** contribution SectionKey → details | more. Overrides first-class lift. */\n ContributionChromeGroupByKey?: ReadonlyMap<string, 'details' | 'more'>;\n /**\n * L1 inclusion from the winning contribution registration.\n * L3 `ChromeRules` still wins on the same key.\n */\n ContributionInclusionByKey?: ReadonlyMap<string, FormInclusion>;\n /** `sortKey` from the winning registration. Higher = earlier in the lead band. */\n ContributionSortKeyByKey?: ReadonlyMap<string, number>;\n /**\n * Install overlay (L3) from `MJ: Form Chrome Rules`. Empty when the\n * entity is not installed or the parent has no rows.\n */\n ChromeRules?: readonly FormChromeRule[];\n /**\n * When false, do not invent chrome groups for DisplayInForm related\n * that have no baked / contributed panel. Custom forms that set\n * `ShowRelatedEntities: false` use this so leftover More does not\n * appear for grids the template already owns (or chose not to show).\n */\n IncludeUnbakedRelated?: boolean;\n /**\n * Sections known to be empty whose metadata says to hide them or move them\n * to More (`whenEmpty`). Applied AFTER the layout is chosen, so counts\n * arriving never flip accordion ↔ left-nav. Omit / empty = no change.\n */\n EmptySectionBehavior?: ReadonlyMap<string, 'hide' | 'more'>;\n}\n\nexport interface ResolveFormChromeResult {\n Spec: FormChromeSpec;\n RelatedRoles: RelatedFormRoleResolution;\n PolicyUsed: boolean;\n}\n\n/**\n * Last-wins `BaseFormPolicy` for this entity, or `null` when none is registered.\n */\nexport function ResolveFormPolicy(entityName: string): BaseFormPolicy | null {\n const registrations = MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPolicy,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as { entity?: unknown }).entity;\n return typeof entity === 'string' && entity === entityName;\n },\n );\n if (registrations.length === 0) return null;\n const winner = [...registrations].sort((a, b) => (a.Priority ?? 0) - (b.Priority ?? 0)).at(-1);\n if (!winner?.SubClass) return null;\n const Ctor = winner.SubClass as new () => BaseFormPolicy;\n return new Ctor();\n}\n\nexport function BuildRelatedFormRoleCandidates(\n entity: EntityInfo,\n relatedSchemaByEntityId: ReadonlyMap<string, string>,\n inboundCountByRelatedEntityId: ReadonlyMap<string, number> = new Map(),\n): RelatedFormRoleCandidate[] {\n return entity.RelatedEntities.map((rel) =>\n toCandidate(rel, relatedSchemaByEntityId, inboundCountByRelatedEntityId),\n );\n}\n\nexport function ResolveFormChrome(input: ResolveFormChromeInput): ResolveFormChromeResult {\n const formConfig = input.Entity.ConfigurationObject?.UI?.Form ?? null;\n const ranked = ResolveRelatedFormRoles(\n input.Entity.SchemaName,\n formConfig,\n BuildRelatedFormRoleCandidates(\n input.Entity,\n input.RelatedSchemaByEntityId,\n input.InboundRelationshipCountByEntityId,\n ),\n );\n const assignments = ApplyFormChromeRules(\n input.Entity.ID ?? '',\n ranked.Assignments,\n input.ChromeRules ?? [],\n );\n const resolution: RelatedFormRoleResolution = { ...ranked, Assignments: assignments };\n\n const relatedRoles = mapRelatedRoles(input.Entity, assignments);\n const contributionGroups = applyContributionRules(\n input.Entity.ID ?? '',\n input.ContributionSectionKeys ?? [],\n input.ContributionChromeGroupByKey ?? new Map(),\n input.ContributionInclusionByKey ?? new Map(),\n input.ChromeRules ?? [],\n );\n const hidden = new Set(input.HiddenSectionKeys ?? []);\n for (const key of displayInFormFalseSectionKeys(input.Entity)) hidden.add(key);\n for (const key of noneInclusionSectionKeys(input.Entity, assignments)) hidden.add(key);\n for (const key of contributionGroups.hiddenKeys) hidden.add(key);\n const visiblePanels = input.Panels.filter((p) => !hidden.has(p.SectionKey));\n const defaultSpec = BuildDefaultChromeSpec(\n visiblePanels,\n relatedRoles,\n formConfig,\n input.ContributionSectionKeys,\n contributionGroups.chromeGroupByKey,\n );\n if (input.IncludeUnbakedRelated !== false) {\n addMissingRelatedGroups(defaultSpec, input.Entity, relatedRoles, hidden);\n }\n applyRelatedDisplayNames(defaultSpec, input.Entity);\n mergeRelatedGroupsByEntity(defaultSpec, input.Entity);\n sortFirstClassRelatedGroups(\n defaultSpec,\n input.Entity,\n assignments,\n input.ContributionSectionKeys,\n contributionGroups.leadKeys,\n input.ContributionSortKeyByKey ?? new Map(),\n );\n ApplyUserChromeMembership(defaultSpec, input.Membership, visiblePanels);\n\n const policy = ResolveFormPolicy(input.Entity.Name);\n if (policy) {\n const ctx: FormChromeContext = {\n Entity: input.Entity,\n RelatedRoles: resolution,\n Panels: input.Panels,\n PrimarySectionCount: countFirstClass(defaultSpec),\n };\n const decorated = policy.DecorateChrome(defaultSpec, ctx);\n const spec = TakeDecoratedChrome(defaultSpec, decorated ?? defaultSpec);\n ApplyUserChromeMembership(spec, input.Membership, visiblePanels);\n ApplyEmptySectionBehavior(spec, input.EmptySectionBehavior, visiblePanels);\n ApplyFormChromeRuleTitles(spec, input.Entity, input.ChromeRules ?? []);\n return { Spec: spec, RelatedRoles: resolution, PolicyUsed: true };\n }\n\n ApplyEmptySectionBehavior(defaultSpec, input.EmptySectionBehavior, visiblePanels);\n ApplyFormChromeRuleTitles(defaultSpec, input.Entity, input.ChromeRules ?? []);\n return { Spec: defaultSpec, RelatedRoles: resolution, PolicyUsed: false };\n}\n\n/**\n * Empty-section chrome (`whenEmpty`). `'hide'` removes the section from every\n * group and from More. `'more'` moves a first-class group into More — only when\n * EVERY section in that group is empty-`'more'`, so a merged Bill-To / Ship-To\n * group with rows in one half stays put. Layout is left unchanged. Runs after\n * user membership so a hidden-when-empty section never reappears through a\n * persisted rail order, and after the policy decorate so it cannot be undone.\n */\nexport function ApplyEmptySectionBehavior(\n spec: FormChromeSpec,\n behavior: ReadonlyMap<string, 'hide' | 'more'> | null | undefined,\n panels: readonly FormChromePanelSnapshot[] = [],\n): FormChromeSpec {\n if (!behavior || behavior.size === 0) return spec;\n const hide = new Set([...behavior].filter(([, b]) => b === 'hide').map(([key]) => key));\n const more = new Set(spec.MoreSectionKeys.filter((key) => !hide.has(key)));\n for (const group of spec.Groups) {\n if (group.IsMore) continue;\n group.SectionKeys = group.SectionKeys.filter((key) => !hide.has(key));\n const keys = group.SectionKeys;\n if (keys.length > 0 && keys.every((key) => behavior.get(key) === 'more')) {\n for (const key of keys) more.add(key);\n }\n }\n spec.Groups = spec.Groups.filter((g) => g.IsMore || g.SectionKeys.length > 0);\n spec.MoreSectionKeys = spec.MoreSectionKeys.filter((key) => !hide.has(key));\n return RebuildChromeSpecMembership(spec, [...more], panels);\n}\n\n/**\n * Policy may rename groups and swap icons. Membership (section keys and\n * More vs first-class) is data — a violating decorate is ignored.\n */\nexport function TakeDecoratedChrome(base: FormChromeSpec, decorated: FormChromeSpec): FormChromeSpec {\n return sameChromeMembership(base, decorated) ? decorated : base;\n}\n\n/**\n * L3 Title overlay. Last Sequence wins. Blank Title is ignored so an\n * incomplete rule cannot wipe DisplayName. Applied after policy decorate\n * so an admin title survives an OpenApp policy rename.\n */\nexport function ApplyFormChromeRuleTitles(\n spec: FormChromeSpec,\n entity: EntityInfo,\n rules: readonly FormChromeRule[],\n): void {\n const parent = (entity.ID ?? '').trim().toLowerCase();\n if (!parent) return;\n const titled = rules\n .filter((rule) => chromeIdsEqual(rule.EntityID, parent) && hasChromeTitle(rule.Title))\n .sort((a, b) => (a.Sequence ?? 0) - (b.Sequence ?? 0));\n if (titled.length === 0) return;\n\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const keysByRelatedId = new Map<string, string[]>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const id = (rel.RelatedEntityID ?? '').trim().toLowerCase();\n if (!id) continue;\n const key = sectionKeyOf(rel);\n const list = keysByRelatedId.get(id) ?? [];\n list.push(key);\n keysByRelatedId.set(id, list);\n }\n\n const titleByKey = new Map<string, string>(spec.TitleBySectionKey);\n for (const rule of titled) {\n const title = (rule.Title ?? '').trim();\n if (rule.TargetKind === 'Contribution') {\n const key = (rule.ContributionKey ?? '').trim();\n if (key) titleByKey.set(key, title);\n continue;\n }\n const relatedId = (rule.RelatedEntityID ?? '').trim().toLowerCase();\n for (const key of keysByRelatedId.get(relatedId) ?? []) {\n titleByKey.set(key, title);\n }\n }\n if (titleByKey.size === 0) return;\n\n spec.TitleBySectionKey = titleByKey;\n for (const group of spec.Groups) {\n if (group.IsMore) continue;\n const override = group.SectionKeys\n .map((key) => titleByKey.get(key))\n .find((value): value is string => !!value)\n ?? titleByKey.get(group.Key);\n if (override) group.Title = override;\n }\n}\n\nfunction hasChromeTitle(title: string | null | undefined): boolean {\n return (title ?? '').trim().length > 0;\n}\n\nfunction chromeIdsEqual(a: string | null | undefined, b: string | null | undefined): boolean {\n const left = (a ?? '').trim().toLowerCase();\n const right = (b ?? '').trim().toLowerCase();\n return left.length > 0 && left === right;\n}\n\nfunction sameChromeMembership(a: FormChromeSpec, b: FormChromeSpec): boolean {\n return keyFingerprint(collectSectionKeys(a)) === keyFingerprint(collectSectionKeys(b))\n && keyFingerprint(a.MoreSectionKeys) === keyFingerprint(b.MoreSectionKeys);\n}\n\nfunction collectSectionKeys(spec: FormChromeSpec): string[] {\n return [...spec.Groups.flatMap((g) => g.SectionKeys), ...spec.MoreSectionKeys];\n}\n\nfunction keyFingerprint(keys: readonly string[]): string {\n return [...new Set(keys.filter((k) => !!k))].sort().join('\\0');\n}\n\nfunction applyContributionRules(\n parentEntityId: string,\n contributionSectionKeys: readonly string[],\n declared: ReadonlyMap<string, 'details' | 'more'>,\n l1InclusionByKey: ReadonlyMap<string, FormInclusion>,\n rules: readonly FormChromeRule[],\n): { chromeGroupByKey: Map<string, 'details' | 'more'>; hiddenKeys: string[]; leadKeys: string[] } {\n const chromeGroupByKey = new Map(declared);\n const hiddenKeys: string[] = [];\n const leadKeys: string[] = [];\n for (const key of contributionSectionKeys) {\n const inclusion = ContributionInclusionFromRules(parentEntityId, key, rules)\n ?? l1InclusionByKey.get(key)\n ?? null;\n applyContributionInclusion(key, inclusion, chromeGroupByKey, hiddenKeys);\n if (isLeadContribution(key, inclusion, chromeGroupByKey)) {\n leadKeys.push(key);\n }\n }\n return { chromeGroupByKey, hiddenKeys, leadKeys };\n}\n\nfunction applyContributionInclusion(\n key: string,\n inclusion: FormInclusion | null,\n chromeGroupByKey: Map<string, 'details' | 'more'>,\n hiddenKeys: string[],\n): void {\n if (inclusion == null) return;\n if (inclusion === 'None') {\n hiddenKeys.push(key);\n return;\n }\n if (inclusion === 'More') {\n chromeGroupByKey.set(key, 'more');\n }\n // Primary is its own first-class rail item. Do not fold into Details.\n}\n\nfunction isLeadContribution(\n key: string,\n inclusion: FormInclusion | null,\n chromeGroupByKey: ReadonlyMap<string, 'details' | 'more'>,\n): boolean {\n if (inclusion !== 'Primary') return false;\n const pinned = chromeGroupByKey.get(key);\n return pinned !== 'details' && pinned !== 'more';\n}\n\nexport function BuildDefaultChromeSpec(\n panels: FormChromePanelSnapshot[],\n relatedRoles: ReadonlyMap<string, FormRole>,\n formConfig: IEntityFormConfiguration | null,\n contributionSectionKeys: readonly string[] = [],\n contributionChromeGroupByKey: ReadonlyMap<string, 'details' | 'more'> = new Map(),\n): FormChromeSpec {\n const moreKeys: string[] = [];\n const fieldKeys: string[] = [];\n const relatedGroups: FormChromeGroup[] = [];\n const contributions = new Set(contributionSectionKeys);\n\n for (const panel of panels) {\n if (!panel.SectionKey) continue;\n if (IsAlwaysMoreSection(panel.SectionKey, panel.SectionName)) {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n const pinned = contributionChromeGroupByKey.get(panel.SectionKey);\n if (pinned === 'details') {\n fieldKeys.push(panel.SectionKey);\n continue;\n }\n if (pinned === 'more') {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n if (panel.Variant === 'related-entity' || contributions.has(panel.SectionKey)) {\n if (relatedRoles.get(panel.SectionKey) === 'Detail') {\n moreKeys.push(panel.SectionKey);\n continue;\n }\n relatedGroups.push(relatedGroupFromPanel(panel));\n continue;\n }\n fieldKeys.push(panel.SectionKey);\n }\n\n const groups: FormChromeGroup[] = [];\n if (fieldKeys.length > 0) {\n const firstField = panels.find((p) => p.SectionKey === fieldKeys[0]);\n groups.push({\n Key: DETAILS_SECTION_KEY,\n Title: DETAILS_SECTION_TITLE,\n Icon: firstField?.Icon?.trim() || 'fa-solid fa-id-card',\n SectionKeys: fieldKeys,\n IsMore: false,\n });\n }\n groups.push(...MergeChromeGroupsByTitle(relatedGroups));\n appendMoreGroup(groups, moreKeys);\n\n const layout = ResolveFormLayout(formConfig, groups.length);\n return {\n Layout: layout,\n Groups: groups,\n RelatedRoles: relatedRoles,\n MoreSectionKeys: moreKeys,\n };\n}\n\nfunction relatedRailIcon(rel: EntityRelationshipInfo): string {\n if (rel.DisplayIconType === 'Custom' && rel.DisplayIcon?.trim()) {\n return rel.DisplayIcon.trim();\n }\n if (rel.DisplayIcon?.trim()) return rel.DisplayIcon.trim();\n return 'fa-solid fa-table';\n}\n\nfunction relatedGroupFromPanel(panel: FormChromePanelSnapshot): FormChromeGroup {\n return {\n Key: panel.SectionKey,\n Title: HumanizeEntityTitle(panel.SectionName || panel.SectionKey),\n Icon: panel.Icon?.trim() || 'fa-solid fa-table',\n SectionKeys: [panel.SectionKey],\n IsMore: false,\n };\n}\n\n/** First SectionKey index in a user order; used to sort rail groups. */\nexport function ChromeGroupOrderIndex(group: FormChromeGroup, sectionOrder: readonly string[]): number {\n let min = Number.MAX_SAFE_INTEGER;\n for (const key of group.SectionKeys) {\n const index = sectionOrder.indexOf(key);\n if (index >= 0 && index < min) min = index;\n }\n return min;\n}\n\n/**\n * Layer a (possibly incomplete) user ranking on the current default rail.\n * Keys the user ranked keep that relative order. Keys they never ranked\n * (Overview, a new related grid) stay in their default slots instead of\n * falling to the end — `form.sections` does not list slot-mounted leads.\n */\nexport function OverlayChromeSectionOrder(\n defaultOrder: readonly string[],\n userOrder: readonly string[],\n): string[] {\n if (userOrder.length === 0) return [...defaultOrder];\n const defaultSet = new Set(defaultOrder);\n const userSet = new Set(userOrder);\n const result = userOrder.filter((key) => defaultSet.has(key));\n for (let i = 0; i < defaultOrder.length; i++) {\n const key = defaultOrder[i];\n if (userSet.has(key)) continue;\n let insertAt = 0;\n for (let j = i - 1; j >= 0; j--) {\n const idx = result.indexOf(defaultOrder[j]);\n if (idx >= 0) {\n insertAt = idx + 1;\n break;\n }\n }\n result.splice(insertAt, 0, key);\n }\n return result;\n}\n\n/** Reorder More children from a persisted section-key order. */\nexport function OrderMoreSectionKeys(\n moreKeys: readonly string[],\n sectionOrder: readonly string[],\n): string[] {\n return OverlayChromeSectionOrder(moreKeys, sectionOrder);\n}\n\n/**\n * Keep the first-class rail order from the previous spec when chrome\n * re-resolves (slot mount, grid load, contribution key appearing).\n * Clicking a rail item must not reshuffle the list.\n * New related groups append. New lead contributions (Overview) insert\n * into the lead band before Details. More stays last.\n * User drag still wins via {@link OrderChromeGroups}.\n */\nexport function StabilizeFirstClassGroupOrder(\n previous: FormChromeSpec | null | undefined,\n next: FormChromeSpec,\n): FormChromeSpec {\n if (!previous || previous.Groups.length === 0) return next;\n const details = next.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = next.Groups.filter((g) => g.IsMore);\n const leads = next.Groups.filter((g) => !g.IsMore && !!g.IsLead && g.Key !== DETAILS_SECTION_KEY);\n const related = next.Groups.filter((g) => !g.IsMore && !g.IsLead && g.Key !== DETAILS_SECTION_KEY);\n if (leads.length === 0 && related.length === 0) return next;\n\n const used = new Set<string>();\n const orderedLeads: FormChromeGroup[] = [];\n const orderedRelated: FormChromeGroup[] = [];\n const take = (bucket: FormChromeGroup[], group: FormChromeGroup | undefined): void => {\n if (!group || used.has(group.Key)) return;\n used.add(group.Key);\n bucket.push(group);\n };\n const matchIn = (pool: FormChromeGroup[], prev: FormChromeGroup): FormChromeGroup | undefined => {\n const prevTitle = prev.Title.trim().toLowerCase();\n const prevKeys = new Set(prev.SectionKeys);\n return pool.find((g) => g.Key === prev.Key)\n ?? pool.find((g) => g.SectionKeys.some((key) => prevKeys.has(key)))\n ?? pool.find((g) => g.Title.trim().toLowerCase() === prevTitle);\n };\n\n for (const prev of previous.Groups) {\n if (prev.IsMore || prev.Key === DETAILS_SECTION_KEY) continue;\n take(orderedLeads, matchIn(leads, prev));\n take(orderedRelated, matchIn(related, prev));\n }\n for (const group of leads) {\n take(orderedLeads, group);\n }\n for (const group of related) {\n take(orderedRelated, group);\n }\n next.Groups = [...orderedLeads, ...details, ...orderedRelated, ...more];\n return next;\n}\n\n/** Reorder first-class rail groups from a persisted section-key order. More stays last. */\nexport function OrderChromeGroups(\n groups: readonly FormChromeGroup[],\n sectionOrder: readonly string[],\n): FormChromeGroup[] {\n if (sectionOrder.length === 0) return [...groups];\n const more = groups.filter((g) => g.IsMore);\n const rest = groups.filter((g) => !g.IsMore);\n const defaultKeys = rest.flatMap((g) => g.SectionKeys);\n const overlaid = OverlayChromeSectionOrder(defaultKeys, sectionOrder);\n rest.sort((a, b) => {\n const ai = ChromeGroupOrderIndex(a, overlaid);\n const bi = ChromeGroupOrderIndex(b, overlaid);\n return ai - bi;\n });\n return [...rest, ...more];\n}\n\n/**\n * Move every SectionKey of `dragged` as a block in front of `target`\n * inside a section-order list. Used by left-nav rail drag/drop.\n */\nexport function MoveChromeGroupInSectionOrder(\n sectionOrder: readonly string[],\n dragged: FormChromeGroup,\n target: FormChromeGroup,\n): string[] {\n const draggedKeys = new Set(dragged.SectionKeys);\n const without = sectionOrder.filter((key) => !draggedKeys.has(key));\n const insertAt = without.findIndex((key) => target.SectionKeys.includes(key));\n const next = [...without];\n const at = insertAt >= 0 ? insertAt : next.length;\n next.splice(at, 0, ...dragged.SectionKeys);\n return next;\n}\n\n/** Collapse rail items that share a humanized title (From/To Relationships). */\nexport function MergeChromeGroupsByTitle(groups: FormChromeGroup[]): FormChromeGroup[] {\n const merged: FormChromeGroup[] = [];\n const byTitle = new Map<string, FormChromeGroup>();\n for (const group of groups) {\n const titleKey = group.Title.trim().toLowerCase();\n const existing = byTitle.get(titleKey);\n if (!existing) {\n const copy: FormChromeGroup = { ...group, SectionKeys: [...group.SectionKeys] };\n byTitle.set(titleKey, copy);\n merged.push(copy);\n continue;\n }\n for (const key of group.SectionKeys) {\n if (!existing.SectionKeys.includes(key)) {\n existing.SectionKeys.push(key);\n }\n }\n }\n return merged;\n}\n\n/**\n * Apply a persisted user membership (move in/out of More) onto a spec\n * in place. Always-more sections (System Metadata) cannot leave More.\n */\nexport function ApplyUserChromeMembership(\n spec: FormChromeSpec,\n override: ChromeMembershipOverride | null | undefined,\n panels: readonly FormChromePanelSnapshot[] = [],\n): FormChromeSpec {\n if (!override) return spec;\n const userMore = override.moreSectionKeys ?? [];\n const userFirst = override.firstClassSectionKeys ?? [];\n if (userMore.length === 0 && userFirst.length === 0) return spec;\n\n const more = new Set(spec.MoreSectionKeys);\n for (const key of userMore) {\n if (key) more.add(key);\n }\n const panelByKey = new Map(panels.map((p) => [p.SectionKey, p]));\n for (const key of userFirst) {\n if (!key) continue;\n const panel = panelByKey.get(key);\n if (!IsAlwaysMoreSection(key, panel?.SectionName)) {\n more.delete(key);\n }\n }\n for (const panel of panels) {\n if (IsAlwaysMoreSection(panel.SectionKey, panel.SectionName)) {\n more.add(panel.SectionKey);\n }\n }\n for (const key of spec.MoreSectionKeys) {\n if (IsAlwaysMoreSection(key)) more.add(key);\n }\n\n return RebuildChromeSpecMembership(spec, [...more], panels);\n}\n\n/** Rebuild Groups / MoreSectionKeys after membership changes. Layout is unchanged. */\nexport function RebuildChromeSpecMembership(\n spec: FormChromeSpec,\n moreKeys: readonly string[],\n panels: readonly FormChromePanelSnapshot[] = [],\n): FormChromeSpec {\n const moreSet = new Set(moreKeys);\n const panelByKey = new Map(panels.map((p) => [p.SectionKey, p]));\n const groups: FormChromeGroup[] = [];\n\n for (const group of spec.Groups) {\n if (group.IsMore) continue;\n const stay = group.SectionKeys.filter((key) => !moreSet.has(key));\n if (stay.length === 0) continue;\n groups.push({ ...group, SectionKeys: stay });\n }\n\n const firstClass = new Set(groups.flatMap((g) => g.SectionKeys));\n const allKnown = new Set<string>([\n ...spec.Groups.flatMap((g) => g.SectionKeys),\n ...spec.MoreSectionKeys,\n ...moreKeys,\n ]);\n for (const key of allKnown) {\n if (!key || moreSet.has(key) || firstClass.has(key)) continue;\n const panel = panelByKey.get(key);\n groups.push({\n Key: key,\n Title: HumanizeEntityTitle(panel?.SectionName || key),\n Icon: panel?.Icon?.trim() || 'fa-solid fa-table',\n SectionKeys: [key],\n IsMore: false,\n });\n firstClass.add(key);\n }\n\n appendMoreGroup(groups, [...moreSet]);\n spec.Groups = groups;\n spec.MoreSectionKeys = [...moreSet];\n return spec;\n}\n\n/** Prefer EntityRelationship.DisplayName on single-key related groups. */\nfunction applyRelatedDisplayNames(spec: FormChromeSpec, entity: EntityInfo): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const name = rel.DisplayName?.trim();\n if (!name) continue;\n const sectionKey = sectionKeyOf(rel);\n const group = spec.Groups.find((g) => !g.IsMore && g.SectionKeys.length === 1 && g.SectionKeys[0] === sectionKey);\n if (group) group.Title = name;\n }\n}\n\nfunction appendMoreGroup(groups: FormChromeGroup[], moreKeys: string[]): void {\n if (moreKeys.length === 0) return;\n const existing = groups.find((g) => g.IsMore);\n if (existing) {\n existing.SectionKeys = moreKeys;\n return;\n }\n groups.push({\n Key: MORE_SECTION_KEY,\n Title: 'More',\n Icon: 'fa-solid fa-ellipsis',\n SectionKeys: moreKeys,\n IsMore: true,\n });\n}\n\nfunction mapRelatedRoles(\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n): Map<string, FormRole> {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const byId = new Map(assignments.map((a) => [a.RelationshipID.toLowerCase(), a]));\n const roles = new Map<string, FormRole>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const sectionKey = sectionKeyOf(rel);\n roles.set(sectionKey, assignment.Role);\n }\n return roles;\n}\n\nfunction toCandidate(\n rel: EntityRelationshipInfo,\n relatedSchemaByEntityId: ReadonlyMap<string, string>,\n inboundCountByRelatedEntityId: ReadonlyMap<string, number> = new Map(),\n): RelatedFormRoleCandidate {\n const relatedId = rel.RelatedEntityID ?? '';\n const schema = relatedSchemaByEntityId.get(relatedId.toLowerCase())\n ?? relatedSchemaByEntityId.get(relatedId)\n ?? '';\n const inbound = inboundCountByRelatedEntityId.get(relatedId.toLowerCase())\n ?? inboundCountByRelatedEntityId.get(relatedId);\n return {\n ID: rel.ID,\n RelatedEntity: rel.RelatedEntity,\n RelatedEntityID: rel.RelatedEntityID,\n RelatedEntityJoinField: rel.RelatedEntityJoinField,\n RelatedEntitySchemaName: schema,\n DisplayInForm: rel.DisplayInForm,\n DisplayLocation: rel.DisplayLocation,\n DisplayComponentID: rel.DisplayComponentID,\n RelatedRecordCollection: rel.RelatedRecordCollection,\n JoinView: rel.JoinView,\n Type: rel.Type,\n Sequence: rel.Sequence,\n Configuration: rel.Configuration,\n InboundRelationshipCount: inbound,\n };\n}\n\n/** First-class rail: lead contributions, then Details, then related by Primary/score. */\nfunction sortFirstClassRelatedGroups(\n spec: FormChromeSpec,\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n contributionSectionKeys: readonly string[] = [],\n leadKeys: readonly string[] = [],\n sortKeyByKey: ReadonlyMap<string, number> = new Map(),\n): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const byId = new Map(assignments.map((a) => [a.RelationshipID.toLowerCase(), a]));\n const scoreByKey = new Map<string, number>();\n const explicitPrimary = new Set<string>();\n const contrib = new Set(contributionSectionKeys);\n const leadSet = new Set(leadKeys);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const key = sectionKeyOf(rel);\n const current = scoreByKey.get(key);\n scoreByKey.set(key, current == null ? assignment.Score : Math.max(current, assignment.Score));\n if (assignment.Reason === 'explicit-primary') explicitPrimary.add(key);\n }\n for (const key of contrib) {\n scoreByKey.set(key, (scoreByKey.get(key) ?? 0) + 150);\n }\n\n const details = spec.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = spec.Groups.filter((g) => g.IsMore);\n const firstClass = spec.Groups.filter((g) => !g.IsMore && g.Key !== DETAILS_SECTION_KEY);\n const leads: FormChromeGroup[] = [];\n const related: FormChromeGroup[] = [];\n for (const group of firstClass) {\n if (group.SectionKeys.some((key) => leadSet.has(key))) {\n group.IsLead = true;\n leads.push(group);\n } else {\n related.push(group);\n }\n }\n const combinedSort = mergeRelatedSortKeys(entity, displayInForm, sortKeyByKey);\n leads.sort((a, b) => groupSortKey(b, combinedSort) - groupSortKey(a, combinedSort));\n related.sort((a, b) => {\n const aSort = groupSortKey(a, combinedSort);\n const bSort = groupSortKey(b, combinedSort);\n if (aSort !== bSort) return bSort - aSort;\n const aExplicit = a.SectionKeys.some((key) => explicitPrimary.has(key));\n const bExplicit = b.SectionKeys.some((key) => explicitPrimary.has(key));\n if (aExplicit !== bExplicit) return aExplicit ? -1 : 1;\n return groupScore(b, scoreByKey) - groupScore(a, scoreByKey);\n });\n spec.Groups = [...leads, ...details, ...related, ...more];\n}\n\nfunction mergeRelatedSortKeys(\n entity: EntityInfo,\n displayInForm: readonly EntityRelationshipInfo[],\n contributionSortKeyByKey: ReadonlyMap<string, number>,\n): Map<string, number> {\n const merged = new Map(contributionSortKeyByKey);\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const sort = ReadRelationshipSortKey(rel.Configuration);\n if (sort == null) continue;\n const key = sectionKeyOf(rel);\n const current = merged.get(key);\n merged.set(key, current == null ? sort : Math.max(current, sort));\n }\n return merged;\n}\n\nfunction groupSortKey(group: FormChromeGroup, sortKeyByKey: ReadonlyMap<string, number>): number {\n let max = Number.NEGATIVE_INFINITY;\n for (const key of group.SectionKeys) {\n const value = sortKeyByKey.get(key);\n if (value != null && value > max) max = value;\n }\n return max === Number.NEGATIVE_INFINITY ? 0 : max;\n}\n\nfunction noneInclusionSectionKeys(\n entity: EntityInfo,\n assignments: readonly RelatedFormRoleAssignment[],\n): string[] {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const noneIds = new Set(\n assignments.filter((a) => a.Inclusion === 'None').map((a) => a.RelationshipID.toLowerCase()),\n );\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n return displayInForm\n .filter((rel) => noneIds.has((rel.ID ?? '').toLowerCase()))\n .map((rel) => sectionKeyOf(rel));\n}\n\nfunction displayInFormFalseSectionKeys(entity: EntityInfo): string[] {\n const all = entity.RelatedEntities ?? [];\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(all);\n return all\n .filter((rel) => !rel.DisplayInForm)\n .map((rel) => sectionKeyOf(rel));\n}\n\n/**\n * Collapse first-class groups that are the same related entity on different\n * join fields (Bill-To Orders + Ship-To Orders → one Orders rail item).\n */\nfunction mergeRelatedGroupsByEntity(spec: FormChromeSpec, entity: EntityInfo): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const entityIdByKey = new Map<string, string>();\n const titleByEntityId = new Map<string, string>();\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const key = sectionKeyOf(rel);\n const id = (rel.RelatedEntityID ?? '').toLowerCase();\n if (!id) continue;\n entityIdByKey.set(key, id);\n const named = rel.DisplayName?.trim();\n if (named) titleByEntityId.set(id, named);\n else if (!titleByEntityId.has(id)) {\n titleByEntityId.set(id, HumanizeEntityTitle(rel.RelatedEntity));\n }\n }\n\n const details = spec.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);\n const more = spec.Groups.filter((g) => g.IsMore);\n const related = spec.Groups.filter((g) => !g.IsMore && g.Key !== DETAILS_SECTION_KEY);\n const merged: FormChromeGroup[] = [];\n const byEntity = new Map<string, FormChromeGroup>();\n\n for (const group of related) {\n const entityId = group.SectionKeys\n .map((key) => entityIdByKey.get(key))\n .find((id): id is string => !!id);\n if (!entityId) {\n merged.push(group);\n continue;\n }\n const existing = byEntity.get(entityId);\n if (!existing) {\n const copy: FormChromeGroup = {\n ...group,\n Title: titleByEntityId.get(entityId) || group.Title,\n SectionKeys: [...group.SectionKeys],\n };\n byEntity.set(entityId, copy);\n merged.push(copy);\n continue;\n }\n for (const key of group.SectionKeys) {\n if (!existing.SectionKeys.includes(key)) existing.SectionKeys.push(key);\n }\n const preferred = titleByEntityId.get(entityId);\n if (preferred) existing.Title = preferred;\n }\n\n spec.Groups = [...details, ...merged, ...more];\n}\n\nfunction groupScore(group: FormChromeGroup, scoreByKey: ReadonlyMap<string, number>): number {\n let max = Number.NEGATIVE_INFINITY;\n for (const key of group.SectionKeys) {\n const score = scoreByKey.get(key);\n if (score != null && score > max) max = score;\n }\n return max === Number.NEGATIVE_INFINITY ? 0 : max;\n}\n\nfunction addMissingRelatedGroups(\n spec: FormChromeSpec,\n entity: EntityInfo,\n relatedRoles: ReadonlyMap<string, FormRole>,\n hiddenSectionKeys: ReadonlySet<string> = new Set(),\n): void {\n const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);\n const known = new Set<string>([\n ...spec.Groups.flatMap((g) => g.SectionKeys),\n ...spec.MoreSectionKeys,\n ...hiddenSectionKeys,\n ]);\n\n const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);\n for (const rel of displayInForm) {\n const sectionKey = sectionKeyOf(rel);\n if (known.has(sectionKey) || hiddenSectionKeys.has(sectionKey)) continue;\n const role = relatedRoles.get(sectionKey);\n if (role === 'Detail') {\n spec.MoreSectionKeys.push(sectionKey);\n known.add(sectionKey);\n continue;\n }\n if (role === 'Primary') {\n const title = HumanizeEntityTitle(rel.DisplayName?.trim() || rel.RelatedEntity);\n const existing = spec.Groups.find(\n (g) => !g.IsMore && g.Title.trim().toLowerCase() === title.toLowerCase(),\n );\n if (existing) {\n existing.SectionKeys.push(sectionKey);\n } else {\n spec.Groups.push({\n Key: sectionKey,\n Title: title,\n Icon: relatedRailIcon(rel),\n SectionKeys: [sectionKey],\n IsMore: false,\n });\n }\n known.add(sectionKey);\n }\n }\n\n appendMoreGroup(spec.Groups, spec.MoreSectionKeys);\n\n spec.Layout = ResolveFormLayout(entity.ConfigurationObject?.UI?.Form ?? null, spec.Groups.length);\n}\n\nfunction countFirstClass(spec: FormChromeSpec): number {\n return spec.Groups.length;\n}\n"]}
|