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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/lib/base-form-section-info.js +5 -5
  2. package/dist/lib/base-form-section-info.js.map +1 -1
  3. package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
  4. package/dist/lib/chrome/resolve-form-chrome.js +22 -12
  5. package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
  6. package/dist/lib/container/record-form-container.component.d.ts +20 -12
  7. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  8. package/dist/lib/container/record-form-container.component.js +129 -113
  9. package/dist/lib/container/record-form-container.component.js.map +1 -1
  10. package/dist/lib/explorer-entity-data-grid.component.d.ts +18 -1
  11. package/dist/lib/explorer-entity-data-grid.component.d.ts.map +1 -1
  12. package/dist/lib/explorer-entity-data-grid.component.js +38 -10
  13. package/dist/lib/explorer-entity-data-grid.component.js.map +1 -1
  14. package/dist/lib/field/form-field.component.d.ts +37 -5
  15. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  16. package/dist/lib/field/form-field.component.js +106 -20
  17. package/dist/lib/field/form-field.component.js.map +1 -1
  18. package/dist/lib/form-state.service.d.ts +58 -0
  19. package/dist/lib/form-state.service.d.ts.map +1 -1
  20. package/dist/lib/form-state.service.js +156 -40
  21. package/dist/lib/form-state.service.js.map +1 -1
  22. package/dist/lib/host/entity-form-host.component.d.ts +10 -2
  23. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
  24. package/dist/lib/host/entity-form-host.component.js +24 -8
  25. package/dist/lib/host/entity-form-host.component.js.map +1 -1
  26. package/dist/lib/interactive-form/interactive-form.component.d.ts +16 -4
  27. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
  28. package/dist/lib/interactive-form/interactive-form.component.js +38 -12
  29. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
  30. package/dist/lib/isa-related-panel/isa-related-card.component.d.ts +3 -3
  31. package/dist/lib/isa-related-panel/isa-related-card.component.js +6 -6
  32. package/dist/lib/isa-related-panel/isa-related-card.component.js.map +1 -1
  33. package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts +3 -3
  34. package/dist/lib/isa-related-panel/isa-related-panel.component.js +8 -8
  35. package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
  36. package/dist/lib/overlays/form-slide-in.component.d.ts +2 -0
  37. package/dist/lib/overlays/form-slide-in.component.d.ts.map +1 -1
  38. package/dist/lib/overlays/form-slide-in.component.js +5 -1
  39. package/dist/lib/overlays/form-slide-in.component.js.map +1 -1
  40. package/dist/lib/panel/collapsible-panel.component.d.ts +9 -9
  41. package/dist/lib/panel/collapsible-panel.component.js +23 -23
  42. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  43. package/dist/lib/panel-slot/base-form-panel.d.ts +2 -0
  44. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
  45. package/dist/lib/panel-slot/base-form-panel.js +5 -1
  46. package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
  47. package/dist/lib/panel-slot/form-contribution.d.ts +12 -0
  48. package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
  49. package/dist/lib/panel-slot/form-contribution.js +43 -10
  50. package/dist/lib/panel-slot/form-contribution.js.map +1 -1
  51. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +10 -0
  52. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
  53. package/dist/lib/panel-slot/form-slot-coordinator.service.js +25 -5
  54. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
  55. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
  56. package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
  57. package/dist/lib/panel-slot/related-entity-grid-panel.component.js +5 -1
  58. package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
  59. package/dist/lib/section-loader-component.d.ts +5 -1
  60. package/dist/lib/section-loader-component.d.ts.map +1 -1
  61. package/dist/lib/section-loader-component.js +13 -5
  62. package/dist/lib/section-loader-component.js.map +1 -1
  63. package/dist/lib/section-manager/section-manager.component.d.ts +2 -2
  64. package/dist/lib/section-manager/section-manager.component.js +6 -6
  65. package/dist/lib/section-manager/section-manager.component.js.map +1 -1
  66. package/dist/lib/toolbar/form-toolbar.component.d.ts +5 -5
  67. package/dist/lib/toolbar/form-toolbar.component.js +22 -22
  68. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  69. package/dist/lib/types/form-types.d.ts +2 -0
  70. package/dist/lib/types/form-types.d.ts.map +1 -1
  71. package/dist/lib/types/form-types.js +5 -1
  72. package/dist/lib/types/form-types.js.map +1 -1
  73. package/package.json +18 -18
@@ -6,23 +6,23 @@ export class BaseFormSectionInfo {
6
6
  /**
7
7
  * Unique key for the section (used for lookups and bindings)
8
8
  */
9
- sectionKey;
9
+ sectionKey; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
10
10
  /**
11
11
  * Display name for the section
12
12
  */
13
- sectionName;
13
+ sectionName; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
14
14
  /**
15
15
  * Whether the section is currently expanded
16
16
  */
17
- isExpanded;
17
+ isExpanded; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply
18
18
  /**
19
19
  * Optional row count for related entity sections (populated after grid loads)
20
20
  */
21
- rowCount;
21
+ rowCount; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member
22
22
  /**
23
23
  * Optional custom metadata for the section
24
24
  */
25
- metadata;
25
+ metadata; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member
26
26
  constructor(sectionKey, sectionName, isExpanded = false, rowCount, metadata) {
27
27
  this.sectionKey = sectionKey;
28
28
  this.sectionName = sectionName;
@@ -1 +1 @@
1
- {"version":3,"file":"base-form-section-info.js","sourceRoot":"","sources":["../../src/lib/base-form-section-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC5B;;OAEG;IACH,UAAU,CAAS;IAEnB;;OAEG;IACH,WAAW,CAAS;IAEpB;;OAEG;IACH,UAAU,CAAU;IAEpB;;OAEG;IACH,QAAQ,CAAU;IAElB;;OAEG;IACH,QAAQ,CAAK;IAEb,YAAY,UAAkB,EAAE,WAAmB,EAAE,aAAsB,KAAK,EAAE,QAAiB,EAAE,QAAY;QAC7G,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/**\n * Information about a form section, including its expanded state and optional metadata.\n * Generic type M allows subclasses to extend with custom metadata.\n */\nexport class BaseFormSectionInfo<M = any> {\n /**\n * Unique key for the section (used for lookups and bindings)\n */\n sectionKey: string;\n\n /**\n * Display name for the section\n */\n sectionName: string;\n\n /**\n * Whether the section is currently expanded\n */\n isExpanded: boolean;\n\n /**\n * Optional row count for related entity sections (populated after grid loads)\n */\n rowCount?: number;\n\n /**\n * Optional custom metadata for the section\n */\n metadata?: M;\n\n constructor(sectionKey: string, sectionName: string, isExpanded: boolean = false, rowCount?: number, metadata?: M) {\n this.sectionKey = sectionKey;\n this.sectionName = sectionName;\n this.isExpanded = isExpanded;\n this.rowCount = rowCount;\n this.metadata = metadata;\n }\n}\n"]}
1
+ {"version":3,"file":"base-form-section-info.js","sourceRoot":"","sources":["../../src/lib/base-form-section-info.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAC5B;;OAEG;IACH,UAAU,CAAS,CAAE,sIAAsI;IAE3J;;OAEG;IACH,WAAW,CAAS,CAAE,sIAAsI;IAE5J;;OAEG;IACH,UAAU,CAAU,CAAE,sIAAsI;IAE5J;;OAEG;IACH,QAAQ,CAAU,CAAE,yHAAyH;IAE7I;;OAEG;IACH,QAAQ,CAAK,CAAE,yHAAyH;IAExI,YAAY,UAAkB,EAAE,WAAmB,EAAE,aAAsB,KAAK,EAAE,QAAiB,EAAE,QAAY;QAC7G,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["/**\n * Information about a form section, including its expanded state and optional metadata.\n * Generic type M allows subclasses to extend with custom metadata.\n */\nexport class BaseFormSectionInfo<M = any> {\n /**\n * Unique key for the section (used for lookups and bindings)\n */\n sectionKey: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n /**\n * Display name for the section\n */\n sectionName: string; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n /**\n * Whether the section is currently expanded\n */\n isExpanded: boolean; // case-violation-ok-legacy-back-compat: object literals are assigned to this class, so an accessor stub changes what they must supply\n\n /**\n * Optional row count for related entity sections (populated after grid loads)\n */\n rowCount?: number; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n\n /**\n * Optional custom metadata for the section\n */\n metadata?: M; // case-violation-ok-legacy-back-compat: an accessor cannot be optional, so a stub would turn this into a required member\n\n constructor(sectionKey: string, sectionName: string, isExpanded: boolean = false, rowCount?: number, metadata?: M) {\n this.sectionKey = sectionKey;\n this.sectionName = sectionName;\n this.isExpanded = isExpanded;\n this.rowCount = rowCount;\n this.metadata = metadata;\n }\n}\n"]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,yBAAyB,CACrC,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC7B,MAAM,EAAE,CAmBV;AAED,gEAAgE;AAChE,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,YAAY,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,EAAE,CAEV;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,QAAQ,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EAC3C,IAAI,EAAE,cAAc,GACrB,cAAc,CAqChB;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,SAAS,eAAe,EAAE,EAClC,YAAY,EAAE,SAAS,MAAM,EAAE,GAChC,eAAe,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"}
@@ -1,6 +1,6 @@
1
1
  import { ApplyFormChromeRules, ContributionInclusionFromRules, ResolveFormLayout, ReadRelationshipSortKey, ResolveRelatedFormRoles, } from '@memberjunction/core';
2
2
  import { MJGlobal } from '@memberjunction/global';
3
- import { RelatedEntitySectionKey } from '../panel-slot/form-contribution';
3
+ import { CreateRelatedEntitySectionKeyResolver } from '../panel-slot/form-contribution';
4
4
  import { BaseFormPolicy } from './base-form-policy';
5
5
  import { DETAILS_SECTION_KEY, MORE_SECTION_KEY, HumanizeEntityTitle, IsAlwaysMoreSection, } from './form-chrome';
6
6
  /**
@@ -87,11 +87,12 @@ export function ApplyFormChromeRuleTitles(spec, entity, rules) {
87
87
  return;
88
88
  const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);
89
89
  const keysByRelatedId = new Map();
90
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
90
91
  for (const rel of displayInForm) {
91
92
  const id = (rel.RelatedEntityID ?? '').trim().toLowerCase();
92
93
  if (!id)
93
94
  continue;
94
- const key = RelatedEntitySectionKey(rel, displayInForm);
95
+ const key = sectionKeyOf(rel);
95
96
  const list = keysByRelatedId.get(id) ?? [];
96
97
  list.push(key);
97
98
  keysByRelatedId.set(id, list);
@@ -118,7 +119,8 @@ export function ApplyFormChromeRuleTitles(spec, entity, rules) {
118
119
  continue;
119
120
  const override = group.SectionKeys
120
121
  .map((key) => titleByKey.get(key))
121
- .find((value) => !!value);
122
+ .find((value) => !!value)
123
+ ?? titleByKey.get(group.Key);
122
124
  if (override)
123
125
  group.Title = override;
124
126
  }
@@ -298,7 +300,7 @@ export function StabilizeFirstClassGroupOrder(previous, next) {
298
300
  return next;
299
301
  const details = next.Groups.filter((g) => g.Key === DETAILS_SECTION_KEY);
300
302
  const more = next.Groups.filter((g) => g.IsMore);
301
- const leads = next.Groups.filter((g) => !!g.IsLead);
303
+ const leads = next.Groups.filter((g) => !g.IsMore && !!g.IsLead && g.Key !== DETAILS_SECTION_KEY);
302
304
  const related = next.Groups.filter((g) => !g.IsMore && !g.IsLead && g.Key !== DETAILS_SECTION_KEY);
303
305
  if (leads.length === 0 && related.length === 0)
304
306
  return next;
@@ -458,11 +460,12 @@ export function RebuildChromeSpecMembership(spec, moreKeys, panels = []) {
458
460
  /** Prefer EntityRelationship.DisplayName on single-key related groups. */
459
461
  function applyRelatedDisplayNames(spec, entity) {
460
462
  const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);
463
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
461
464
  for (const rel of displayInForm) {
462
465
  const name = rel.DisplayName?.trim();
463
466
  if (!name)
464
467
  continue;
465
- const sectionKey = RelatedEntitySectionKey(rel, displayInForm);
468
+ const sectionKey = sectionKeyOf(rel);
466
469
  const group = spec.Groups.find((g) => !g.IsMore && g.SectionKeys.length === 1 && g.SectionKeys[0] === sectionKey);
467
470
  if (group)
468
471
  group.Title = name;
@@ -488,11 +491,12 @@ function mapRelatedRoles(entity, assignments) {
488
491
  const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);
489
492
  const byId = new Map(assignments.map((a) => [a.RelationshipID.toLowerCase(), a]));
490
493
  const roles = new Map();
494
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
491
495
  for (const rel of displayInForm) {
492
496
  const assignment = byId.get((rel.ID ?? '').toLowerCase());
493
497
  if (!assignment)
494
498
  continue;
495
- const sectionKey = RelatedEntitySectionKey(rel, displayInForm);
499
+ const sectionKey = sectionKeyOf(rel);
496
500
  roles.set(sectionKey, assignment.Role);
497
501
  }
498
502
  return roles;
@@ -529,11 +533,12 @@ function sortFirstClassRelatedGroups(spec, entity, assignments, contributionSect
529
533
  const explicitPrimary = new Set();
530
534
  const contrib = new Set(contributionSectionKeys);
531
535
  const leadSet = new Set(leadKeys);
536
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
532
537
  for (const rel of displayInForm) {
533
538
  const assignment = byId.get((rel.ID ?? '').toLowerCase());
534
539
  if (!assignment)
535
540
  continue;
536
- const key = RelatedEntitySectionKey(rel, displayInForm);
541
+ const key = sectionKeyOf(rel);
537
542
  const current = scoreByKey.get(key);
538
543
  scoreByKey.set(key, current == null ? assignment.Score : Math.max(current, assignment.Score));
539
544
  if (assignment.Reason === 'explicit-primary')
@@ -573,11 +578,12 @@ function sortFirstClassRelatedGroups(spec, entity, assignments, contributionSect
573
578
  }
574
579
  function mergeRelatedSortKeys(entity, displayInForm, contributionSortKeyByKey) {
575
580
  const merged = new Map(contributionSortKeyByKey);
581
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
576
582
  for (const rel of displayInForm) {
577
583
  const sort = ReadRelationshipSortKey(rel.Configuration);
578
584
  if (sort == null)
579
585
  continue;
580
- const key = RelatedEntitySectionKey(rel, displayInForm);
586
+ const key = sectionKeyOf(rel);
581
587
  const current = merged.get(key);
582
588
  merged.set(key, current == null ? sort : Math.max(current, sort));
583
589
  }
@@ -595,15 +601,17 @@ function groupSortKey(group, sortKeyByKey) {
595
601
  function noneInclusionSectionKeys(entity, assignments) {
596
602
  const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);
597
603
  const noneIds = new Set(assignments.filter((a) => a.Inclusion === 'None').map((a) => a.RelationshipID.toLowerCase()));
604
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
598
605
  return displayInForm
599
606
  .filter((rel) => noneIds.has((rel.ID ?? '').toLowerCase()))
600
- .map((rel) => RelatedEntitySectionKey(rel, displayInForm));
607
+ .map((rel) => sectionKeyOf(rel));
601
608
  }
602
609
  function displayInFormFalseSectionKeys(entity) {
603
610
  const all = entity.RelatedEntities ?? [];
611
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(all);
604
612
  return all
605
613
  .filter((rel) => !rel.DisplayInForm)
606
- .map((rel) => RelatedEntitySectionKey(rel, all));
614
+ .map((rel) => sectionKeyOf(rel));
607
615
  }
608
616
  /**
609
617
  * Collapse first-class groups that are the same related entity on different
@@ -613,8 +621,9 @@ function mergeRelatedGroupsByEntity(spec, entity) {
613
621
  const displayInForm = entity.RelatedEntities.filter((rel) => rel.DisplayInForm);
614
622
  const entityIdByKey = new Map();
615
623
  const titleByEntityId = new Map();
624
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
616
625
  for (const rel of displayInForm) {
617
- const key = RelatedEntitySectionKey(rel, displayInForm);
626
+ const key = sectionKeyOf(rel);
618
627
  const id = (rel.RelatedEntityID ?? '').toLowerCase();
619
628
  if (!id)
620
629
  continue;
@@ -676,8 +685,9 @@ function addMissingRelatedGroups(spec, entity, relatedRoles, hiddenSectionKeys =
676
685
  ...spec.MoreSectionKeys,
677
686
  ...hiddenSectionKeys,
678
687
  ]);
688
+ const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(displayInForm);
679
689
  for (const rel of displayInForm) {
680
- const sectionKey = RelatedEntitySectionKey(rel, displayInForm);
690
+ const sectionKey = sectionKeyOf(rel);
681
691
  if (known.has(sectionKey) || hiddenSectionKeys.has(sectionKey))
682
692
  continue;
683
693
  const role = relatedRoles.get(sectionKey);
@@ -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,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,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,EAAE;QACT,IAAI,CAAC,Q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shipSortKey,\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 { RelatedEntitySectionKey } 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 for (const rel of displayInForm) {\n const id = (rel.RelatedEntityID ?? '').trim().toLowerCase();\n if (!id) continue;\n const key = RelatedEntitySectionKey(rel, displayInForm);\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 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.IsLead);\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 for (const rel of displayInForm) {\n const name = rel.DisplayName?.trim();\n if (!name) continue;\n const sectionKey = RelatedEntitySectionKey(rel, displayInForm);\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 for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const sectionKey = RelatedEntitySectionKey(rel, displayInForm);\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 for (const rel of displayInForm) {\n const assignment = byId.get((rel.ID ?? '').toLowerCase());\n if (!assignment) continue;\n const key = RelatedEntitySectionKey(rel, displayInForm);\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 for (const rel of displayInForm) {\n const sort = ReadRelationshipSortKey(rel.Configuration);\n if (sort == null) continue;\n const key = RelatedEntitySectionKey(rel, displayInForm);\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 return displayInForm\n .filter((rel) => noneIds.has((rel.ID ?? '').toLowerCase()))\n .map((rel) => RelatedEntitySectionKey(rel, displayInForm));\n}\n\nfunction displayInFormFalseSectionKeys(entity: EntityInfo): string[] {\n const all = entity.RelatedEntities ?? [];\n return all\n .filter((rel) => !rel.DisplayInForm)\n .map((rel) => RelatedEntitySectionKey(rel, all));\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 for (const rel of displayInForm) {\n const key = RelatedEntitySectionKey(rel, displayInForm);\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 for (const rel of displayInForm) {\n const sectionKey = RelatedEntitySectionKey(rel, displayInForm);\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,E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QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAC3E,CAAC;YACF,IAAI,QAAQ,EAAE,CAAC;gBACX,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;oBACb,GAAG,EAAE,UAAU;oBACf,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC;oBAC1B,WAAW,EAAE,CAAC,UAAU,CAAC;oBACzB,MAAM,EAAE,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"]}
@@ -199,6 +199,8 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
199
199
  AfterSectionActivated: EventEmitter<AfterSectionActivatedEventArgs>;
200
200
  Panels: QueryList<MjCollapsiblePanelComponent>;
201
201
  /** Typed accessor for the form component reference */
202
+ get Fc(): BaseFormComponent | null;
203
+ /** @deprecated Use {@link Fc}. */
202
204
  get fc(): BaseFormComponent | null;
203
205
  get EffectiveRecord(): BaseEntity;
204
206
  get EffectiveEditMode(): boolean;
@@ -346,7 +348,7 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
346
348
  private scheduleChromeResolve;
347
349
  private loadChromeRulesIfNeeded;
348
350
  private loadChromeRules;
349
- private ResolveChrome;
351
+ private resolveChrome;
350
352
  private expandActiveGroupSections;
351
353
  private ensureActiveGroupVisible;
352
354
  private groupMatchesSearch;
@@ -378,14 +380,14 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
378
380
  private buildInboundRelationshipCounts;
379
381
  private chromePrefKey;
380
382
  /** Delegates to the pure decision in `form-chrome-rail-pref`, supplying this form's registrations. */
381
- private UnsavedLeadGroupKey;
382
- private RestoreChromePrefs;
383
- private PersistChromePrefs;
383
+ private unsavedLeadGroupKey;
384
+ private restoreChromePrefs;
385
+ private persistChromePrefs;
384
386
  /**
385
387
  * Subscribes to Navigate events from all child collapsible panels
386
388
  * and relays them through this container's Navigate output.
387
389
  */
388
- private SubscribeToPanelNavigateEvents;
390
+ private subscribeToPanelNavigateEvents;
389
391
  /**
390
392
  * Monitor record dirty state changes and trigger change detection.
391
393
  * This ensures the edit banner updates when fields are modified.
@@ -401,22 +403,22 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
401
403
  * All queries run in parallel for performance.
402
404
  */
403
405
  private badgeCountsLoaded;
404
- private LoadBadgeCounts;
406
+ private loadBadgeCounts;
405
407
  /**
406
408
  * Queries the count of linked attachments for the current entity + record
407
409
  * and updates the AttachmentCount badge on the toolbar.
408
410
  */
409
- private LoadAttachmentCount;
411
+ private loadAttachmentCount;
410
412
  /**
411
413
  * Queries the count of tagged items for the current entity + record
412
414
  * and updates the TagCount badge on the toolbar.
413
415
  */
414
- private LoadTagCount;
416
+ private loadTagCount;
415
417
  /**
416
418
  * Queries the count of record change entries for the current entity + record
417
419
  * and updates the VersionCount badge on the toolbar.
418
420
  */
419
- private LoadVersionCount;
421
+ private loadVersionCount;
420
422
  /**
421
423
  * Navigation events are always re-emitted for the host app to handle.
422
424
  */
@@ -434,7 +436,7 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
434
436
  * The save operation creates a new RecordChange entry server-side, so we need
435
437
  * to update the UI to reflect the new version.
436
438
  */
437
- private RefreshAfterSave;
439
+ private refreshAfterSave;
438
440
  /**
439
441
  * Cancel: delegate to FormComponent if available, otherwise re-emit.
440
442
  */
@@ -450,7 +452,7 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
450
452
  * the record itself (badges, open history drawer) and broadcast to
451
453
  * in-form listeners (related grids, IS-A panel, custom panels).
452
454
  */
453
- private OnFormRecordRefreshed;
455
+ private onFormRecordRefreshed;
454
456
  /**
455
457
  * Delete, Favorite, History, Lists, ShowChanges: always re-emit for host app.
456
458
  */
@@ -503,7 +505,11 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
503
505
  OnResetSectionOrder(): void;
504
506
  /** Whether the variant dropdown menu is currently open. Toggled by the
505
507
  * control's click handler; closed on blur or after a row is picked. */
506
- _variantMenuOpen: boolean;
508
+ VariantMenuOpen: boolean;
509
+ /** @deprecated Use {@link VariantMenuOpen}. */
510
+ get _variantMenuOpen(): boolean;
511
+ /** @deprecated Use {@link VariantMenuOpen}. */
512
+ set _variantMenuOpen(value: boolean);
507
513
  /**
508
514
  * Effective variants — prefer the form component's list (set by the host
509
515
  * resolver) when present, fall back to the directly-bound @Input. This
@@ -519,6 +525,8 @@ export declare class MjRecordFormContainerComponent extends BaseAngularComponent
519
525
  /** Label for the currently-selected variant (or "Default form" if none). */
520
526
  get CurrentVariantLabel(): string;
521
527
  /** Compact subtitle: scope + status, e.g. "User · Active". */
528
+ VariantSubtitle(v: VariantPickerItem): string;
529
+ /** @deprecated Use {@link VariantSubtitle}. */
522
530
  variantSubtitle(v: VariantPickerItem): string;
523
531
  /**
524
532
  * User picked an item from the variant menu. If the host installed a