@memberjunction/ng-base-forms 6.2.0 → 6.3.0-edge.0
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/README.md +39 -8
- package/dist/lib/base-form-component.d.ts +20 -0
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +69 -7
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/comments/comment-card-driver-host.component.d.ts +55 -0
- package/dist/lib/comments/comment-card-driver-host.component.d.ts.map +1 -0
- package/dist/lib/comments/comment-card-driver-host.component.js +134 -0
- package/dist/lib/comments/comment-card-driver-host.component.js.map +1 -0
- package/dist/lib/comments/field-suggestion-card.component.d.ts +43 -0
- package/dist/lib/comments/field-suggestion-card.component.d.ts.map +1 -0
- package/dist/lib/comments/field-suggestion-card.component.js +357 -0
- package/dist/lib/comments/field-suggestion-card.component.js.map +1 -0
- package/dist/lib/comments/form-record-comments-coordinator.service.d.ts +69 -7
- package/dist/lib/comments/form-record-comments-coordinator.service.d.ts.map +1 -1
- package/dist/lib/comments/form-record-comments-coordinator.service.js +251 -11
- package/dist/lib/comments/form-record-comments-coordinator.service.js.map +1 -1
- package/dist/lib/comments/record-comments.component.d.ts +31 -1
- package/dist/lib/comments/record-comments.component.d.ts.map +1 -1
- package/dist/lib/comments/record-comments.component.js +765 -465
- package/dist/lib/comments/record-comments.component.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +6 -0
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +286 -246
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +7 -3
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +58 -22
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js +10 -0
- package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js +1 -1
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -1
- package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts +100 -0
- package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts.map +1 -0
- package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js +181 -0
- package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js.map +1 -0
- package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts +104 -0
- package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts.map +1 -0
- package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js +487 -0
- package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js.map +1 -0
- package/dist/lib/toolbar/actions/record-comments-toolbar-action.js +2 -2
- package/dist/lib/toolbar/actions/record-comments-toolbar-action.js.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.d.ts +2 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +241 -290
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/module.d.ts +17 -14
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +25 -6
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +4 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +4 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isa-related-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/isa-related-panel/isa-related-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACqB,YAAY,EAEtC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAC5C,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,UAAU,EAAc,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAA+C,cAAc,EAAE,MAAM,uBAAuB,CAAC;;AAGpG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAQa,0BAA2B,SAAQ,oBAAqB,YAAW,SAAS,EAAE,MAAM,EAAE,SAAS;IAC1G,OAAO,CAAC,GAAG,CAA6B;IACxC,OAAO,CAAC,aAAa,CAA4D;IACjF,OAAO,CAAC,QAAQ,CAAuB;IAEvC,wDAAwD;IAC/C,MAAM,EAAE,UAAU,GAAG,IAAI,CAAQ;IAE1C,iEAAiE;IACxD,QAAQ,UAAS;IAE1B,0EAA0E;IACjE,SAAS,UAAS;IAE3B,iDAAiD;IACvC,QAAQ,oCAA2C;IAE7D,qFAAqF;IACrF,YAAY,EAAE,cAAc,EAAE,CAAM;IAEpC,uDAAuD;IACvD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,oFAAoF;IACpF,IAAI,iBAAiB,IAAI,MAAM,CAI9B;IAED,0DAA0D;IAC1D,IAAI,gBAAgB,IAAI,YAAY,GAAG,IAAI,CAE1C;IAED,QAAQ,IAAI,IAAI;IAMhB,WAAW,IAAI,IAAI;IAKnB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAwBzC;;;;OAIG;YACW,oBAAoB;IAqBlC;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAuBlC;;;OAGG;YACW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"isa-related-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/isa-related-panel/isa-related-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACqB,YAAY,EAEtC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAC5C,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,UAAU,EAAc,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(this.Record, this.ProviderToUse);
|
|
194
194
|
const tree = BuildDescendantTree(descendants);
|
|
195
|
+
if (this.Record.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true) {
|
|
196
|
+
// Direct subtype child is already rendered inline in the form body; promote any
|
|
197
|
+
// non-folded deeper descendants rather than duplicating the folded child card.
|
|
198
|
+
for (const item of tree) {
|
|
199
|
+
if (item.Children.length > 0) {
|
|
200
|
+
this.RelatedItems.push(...item.Children);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
195
205
|
this.RelatedItems.push(...tree);
|
|
196
206
|
}
|
|
197
207
|
/** Relay navigation events from child cards */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isa-related-panel.component.js","sourceRoot":"","sources":["../../../src/lib/isa-related-panel/isa-related-panel.component.ts","../../../src/lib/isa-related-panel/isa-related-panel.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EACtC,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,EACL,iBAAiB,EAC/D,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAkB,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;;;;ICHxE,8BAAoE;IAClE,uBAAgC;IAClC,iBAAM;;;IAFoC,0CAAyB;;;IAFvE,8BAA2C;IACzC,yHAIC;IACH,iBAAM;;;IALJ,cAIC;IAJD,kCAIC;;;;IAMC,8CAOsC;IAApC,4OAAY,6BAAsB,KAAC;IACrC,iBAAsB;;;;IAFpB,AADA,AADA,AADA,AADA,AADA,+CAA8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AAC,CAAC;IAC5B,CAAC;qRA7IU,0BAA0B,yBAA1B,0BAA0B;6DAA1B,0BAA0B;YC3CvC,4FAA6B;;YAA7B,wDA6BC;;;iFDcY,0BAA0B;cARtC,SAAS;6BACI,KAAK,YACP,sBAAsB,mBACf,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI;;kBAUpC,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,MAAM;;kFAfI,0BAA0B","sourcesContent":["import {\n Component, Input, Output, EventEmitter,\n ChangeDetectionStrategy, ChangeDetectorRef, inject,\n OnChanges, OnInit, OnDestroy, SimpleChanges, ViewEncapsulation\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { BaseEntity, EntityInfo, CompositeKey } from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { FormNavigationEvent, EntityHierarchyNavigationEvent } from '../types/navigation-events';\nimport { DiscoverISADescendants, BuildDescendantTree, IsaRelatedItem } from './isa-hierarchy-utils';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\n\n/**\n * Container panel that discovers and displays IS-A related entity records\n * (siblings and children) for the current form's record.\n *\n * **Placement**: Sits to the right of the main form panels inside\n * `<mj-record-form-container>`. Hidden when in edit mode or when\n * no related IS-A records exist.\n *\n * **Data flow**:\n * - Receives the current `Record` (BaseEntity) as input\n * - Inspects `EntityInfo.ParentEntityInfo` and `ISAChildren` to discover related records\n * - Builds a tree structure for nested sub-card rendering\n * - Renders an `<mj-isa-related-card>` for each root-level related entity\n * (grandchildren render as nested sub-cards inside their parent card)\n *\n * @example\n * ```html\n * <mj-isa-related-panel\n * [Record]=\"record\"\n * (Navigate)=\"OnNavigate($event)\">\n * </mj-isa-related-panel>\n * ```\n */\n@Component({\n standalone: false,\n selector: 'mj-isa-related-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: './isa-related-panel.component.html',\n styleUrls: ['./isa-related-panel.component.css']\n})\nexport class MjIsaRelatedPanelComponent extends BaseAngularComponent implements OnChanges, OnInit, OnDestroy {\n private cdr = inject(ChangeDetectorRef);\n private recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n private destroy$ = new Subject<void>();\n\n /** The entity record currently displayed in the form */\n @Input() Record: BaseEntity | null = null;\n\n /** Whether the form is in edit mode (panel hides during edit) */\n @Input() EditMode = false;\n\n /** Whether the panel is collapsed (icon-only strip in full-width mode) */\n @Input() Collapsed = false;\n\n /** Emitted for navigation to a related record */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n /** Root-level related IS-A entities to display cards for (children nested inside) */\n RelatedItems: IsaRelatedItem[] = [];\n\n /** Whether there are any related IS-A items to show */\n get HasItems(): boolean {\n return this.RelatedItems.length > 0;\n }\n\n /** The current record's display name (to suppress in child cards when identical) */\n get CurrentRecordName(): string {\n if (!this.Record) return '';\n const name = this.Record.GetRecordName();\n return name ? String(name) : '';\n }\n\n /** The shared primary key for all IS-A related records */\n get SharedPrimaryKey(): CompositeKey | null {\n return this.Record?.PrimaryKey ?? null;\n }\n\n ngOnInit(): void {\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe(() => {\n void this.discoverRelatedItems();\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['Record']) {\n this.discoverRelatedItems();\n return;\n }\n\n // Leaving edit mode is the OTHER moment this answer can change, and until now nothing\n // re-asked. A save can ATTACH a subtype that did not exist when this panel last looked —\n // IS-A writes parent and child in one transaction — and the form deliberately keeps the\n // SAME record object across that save (EntityFormHostComponent's PrimaryKey setter skips\n // the reload when the incoming key is just the now-saved PK), so `changes['Record']` never\n // fires; and `FormRecordRefreshCoordinator.Notify()` is reached only from the Refresh\n // button. The result was a panel that stayed empty on a record that plainly had a subtype\n // until the user pressed Refresh.\n //\n // Re-discovering here is close to free on the common path: for a disjoint hierarchy\n // DiscoverISADescendants walks the in-memory ISAChild chain and issues no query at all.\n // An overlapping parent (AllowMultipleSubtypes) does load its child entities, so that\n // configuration pays one extra discovery per edit session.\n if (changes['EditMode'] && changes['EditMode'].previousValue === true && !this.EditMode) {\n this.discoverRelatedItems();\n }\n }\n\n /**\n * Discover IS-A related entities by examining the current record's\n * entity hierarchy. Finds siblings (other children of the same parent)\n * and all descendants (children, grandchildren, etc.) as a tree.\n */\n private async discoverRelatedItems(): Promise<void> {\n this.RelatedItems = [];\n\n if (!this.Record) return;\n\n const entityInfo = this.Record.EntityInfo;\n if (!entityInfo) return;\n\n // Case 1: Current entity is a child type — find siblings via parent\n if (entityInfo.IsChildType && entityInfo.ParentEntityInfo) {\n this.discoverSiblingsFromParent(entityInfo);\n }\n\n // Case 2: Current entity is a parent type — discover all descendants as tree\n if (entityInfo.IsParentType) {\n await this.discoverDescendants();\n }\n\n this.cdr.markForCheck();\n }\n\n /**\n * When viewing a child entity (e.g., Member), find sibling entities\n * (e.g., Speaker) that also have records with the same parent PK.\n * Uses the parent's ISAChildren if the parent uses overlapping subtypes.\n */\n private discoverSiblingsFromParent(entityInfo: EntityInfo): void {\n const parent = this.Record?.ISAParent;\n if (!parent) return;\n\n const parentInfo = entityInfo.ParentEntityInfo!;\n\n if (parentInfo.AllowMultipleSubtypes) {\n const children = parent.ISAChildren;\n if (children) {\n for (const child of children) {\n if (child.entityName !== entityInfo.Name) {\n this.RelatedItems.push({\n EntityName: child.entityName,\n Relationship: 'sibling',\n Depth: 0,\n Children: []\n });\n }\n }\n }\n }\n }\n\n /**\n * Recursively discover all IS-A descendants and build a tree structure.\n * Root-level children appear as top-level cards; grandchildren nest inside.\n */\n private async discoverDescendants(): Promise<void> {\n if (!this.Record) return;\n\n const descendants = await DiscoverISADescendants(this.Record, this.ProviderToUse);\n const tree = BuildDescendantTree(descendants);\n this.RelatedItems.push(...tree);\n }\n\n /** Relay navigation events from child cards */\n OnCardNavigate(event: EntityHierarchyNavigationEvent): void {\n this.Navigate.emit(event);\n }\n}\n","<!-- ISA Related Panel: side panel container for all related IS-A entity cards -->\n@if (HasItems && !EditMode) {\n <div class=\"mj-isa-panel\" [class.mj-isa-panel--collapsed]=\"Collapsed\">\n\n <!-- Collapsed state: icon-only strip -->\n @if (Collapsed) {\n <div class=\"mj-isa-panel__collapsed-strip\">\n @for (item of RelatedItems; track item.EntityName) {\n <div class=\"mj-isa-panel__collapsed-icon\" [title]=\"item.EntityName\">\n <i class=\"fa-solid fa-link\"></i>\n </div>\n }\n </div>\n } @else {\n <!-- Expanded state: full card list -->\n <div class=\"mj-isa-panel__cards\">\n @for (item of RelatedItems; track item.EntityName) {\n <mj-isa-related-card\n [EntityName]=\"item.EntityName\"\n [PrimaryKey]=\"SharedPrimaryKey\"\n [CurrentRecordName]=\"CurrentRecordName\"\n [Relationship]=\"item.Relationship\"\n [Depth]=\"item.Depth\"\n [Children]=\"item.Children\"\n (Navigate)=\"OnCardNavigate($event)\">\n </mj-isa-related-card>\n }\n </div>\n }\n </div>\n}\n"]}
|
|
1
|
+
{"version":3,"file":"isa-related-panel.component.js","sourceRoot":"","sources":["../../../src/lib/isa-related-panel/isa-related-panel.component.ts","../../../src/lib/isa-related-panel/isa-related-panel.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EACtC,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,EACL,iBAAiB,EAC/D,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAkB,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;;;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C,CAAC;QAClF,MAAM,IAAI,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC9C,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,qBAAqB,EAAE,YAAY,KAAK,IAAI,EAAE,CAAC;YACzE,gFAAgF;YAChF,+EAA+E;YAC/E,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;gBACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC3C,CAAC;YACH,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,+CAA+C;IAC/C,cAAc,CAAC,KAAqC;QAClD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;qRAvJU,0BAA0B,yBAA1B,0BAA0B;6DAA1B,0BAA0B;YC3CvC,4FAA6B;;YAA7B,wDA6BC;;;iFDcY,0BAA0B;cARtC,SAAS;6BACI,KAAK,YACP,sBAAsB,mBACf,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI;;kBAUpC,KAAK;;kBAGL,KAAK;;kBAGL,KAAK;;kBAGL,MAAM;;kFAfI,0BAA0B","sourcesContent":["import {\n Component, Input, Output, EventEmitter,\n ChangeDetectionStrategy, ChangeDetectorRef, inject,\n OnChanges, OnInit, OnDestroy, SimpleChanges, ViewEncapsulation\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { BaseEntity, EntityInfo, CompositeKey } from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { FormNavigationEvent, EntityHierarchyNavigationEvent } from '../types/navigation-events';\nimport { DiscoverISADescendants, BuildDescendantTree, IsaRelatedItem } from './isa-hierarchy-utils';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\n\n/**\n * Container panel that discovers and displays IS-A related entity records\n * (siblings and children) for the current form's record.\n *\n * **Placement**: Sits to the right of the main form panels inside\n * `<mj-record-form-container>`. Hidden when in edit mode or when\n * no related IS-A records exist.\n *\n * **Data flow**:\n * - Receives the current `Record` (BaseEntity) as input\n * - Inspects `EntityInfo.ParentEntityInfo` and `ISAChildren` to discover related records\n * - Builds a tree structure for nested sub-card rendering\n * - Renders an `<mj-isa-related-card>` for each root-level related entity\n * (grandchildren render as nested sub-cards inside their parent card)\n *\n * @example\n * ```html\n * <mj-isa-related-panel\n * [Record]=\"record\"\n * (Navigate)=\"OnNavigate($event)\">\n * </mj-isa-related-panel>\n * ```\n */\n@Component({\n standalone: false,\n selector: 'mj-isa-related-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: './isa-related-panel.component.html',\n styleUrls: ['./isa-related-panel.component.css']\n})\nexport class MjIsaRelatedPanelComponent extends BaseAngularComponent implements OnChanges, OnInit, OnDestroy {\n private cdr = inject(ChangeDetectorRef);\n private recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n private destroy$ = new Subject<void>();\n\n /** The entity record currently displayed in the form */\n @Input() Record: BaseEntity | null = null;\n\n /** Whether the form is in edit mode (panel hides during edit) */\n @Input() EditMode = false;\n\n /** Whether the panel is collapsed (icon-only strip in full-width mode) */\n @Input() Collapsed = false;\n\n /** Emitted for navigation to a related record */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n /** Root-level related IS-A entities to display cards for (children nested inside) */\n RelatedItems: IsaRelatedItem[] = [];\n\n /** Whether there are any related IS-A items to show */\n get HasItems(): boolean {\n return this.RelatedItems.length > 0;\n }\n\n /** The current record's display name (to suppress in child cards when identical) */\n get CurrentRecordName(): string {\n if (!this.Record) return '';\n const name = this.Record.GetRecordName();\n return name ? String(name) : '';\n }\n\n /** The shared primary key for all IS-A related records */\n get SharedPrimaryKey(): CompositeKey | null {\n return this.Record?.PrimaryKey ?? null;\n }\n\n ngOnInit(): void {\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe(() => {\n void this.discoverRelatedItems();\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['Record']) {\n this.discoverRelatedItems();\n return;\n }\n\n // Leaving edit mode is the OTHER moment this answer can change, and until now nothing\n // re-asked. A save can ATTACH a subtype that did not exist when this panel last looked —\n // IS-A writes parent and child in one transaction — and the form deliberately keeps the\n // SAME record object across that save (EntityFormHostComponent's PrimaryKey setter skips\n // the reload when the incoming key is just the now-saved PK), so `changes['Record']` never\n // fires; and `FormRecordRefreshCoordinator.Notify()` is reached only from the Refresh\n // button. The result was a panel that stayed empty on a record that plainly had a subtype\n // until the user pressed Refresh.\n //\n // Re-discovering here is close to free on the common path: for a disjoint hierarchy\n // DiscoverISADescendants walks the in-memory ISAChild chain and issues no query at all.\n // An overlapping parent (AllowMultipleSubtypes) does load its child entities, so that\n // configuration pays one extra discovery per edit session.\n if (changes['EditMode'] && changes['EditMode'].previousValue === true && !this.EditMode) {\n this.discoverRelatedItems();\n }\n }\n\n /**\n * Discover IS-A related entities by examining the current record's\n * entity hierarchy. Finds siblings (other children of the same parent)\n * and all descendants (children, grandchildren, etc.) as a tree.\n */\n private async discoverRelatedItems(): Promise<void> {\n this.RelatedItems = [];\n\n if (!this.Record) return;\n\n const entityInfo = this.Record.EntityInfo;\n if (!entityInfo) return;\n\n // Case 1: Current entity is a child type — find siblings via parent\n if (entityInfo.IsChildType && entityInfo.ParentEntityInfo) {\n this.discoverSiblingsFromParent(entityInfo);\n }\n\n // Case 2: Current entity is a parent type — discover all descendants as tree\n if (entityInfo.IsParentType) {\n await this.discoverDescendants();\n }\n\n this.cdr.markForCheck();\n }\n\n /**\n * When viewing a child entity (e.g., Member), find sibling entities\n * (e.g., Speaker) that also have records with the same parent PK.\n * Uses the parent's ISAChildren if the parent uses overlapping subtypes.\n */\n private discoverSiblingsFromParent(entityInfo: EntityInfo): void {\n const parent = this.Record?.ISAParent;\n if (!parent) return;\n\n const parentInfo = entityInfo.ParentEntityInfo!;\n\n if (parentInfo.AllowMultipleSubtypes) {\n const children = parent.ISAChildren;\n if (children) {\n for (const child of children) {\n if (child.entityName !== entityInfo.Name) {\n this.RelatedItems.push({\n EntityName: child.entityName,\n Relationship: 'sibling',\n Depth: 0,\n Children: []\n });\n }\n }\n }\n }\n }\n\n /**\n * Recursively discover all IS-A descendants and build a tree structure.\n * Root-level children appear as top-level cards; grandchildren nest inside.\n */\n private async discoverDescendants(): Promise<void> {\n if (!this.Record) return;\n\n const descendants = await DiscoverISADescendants(this.Record, this.ProviderToUse);\n const tree = BuildDescendantTree(descendants);\n if (this.Record.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true) {\n // Direct subtype child is already rendered inline in the form body; promote any\n // non-folded deeper descendants rather than duplicating the folded child card.\n for (const item of tree) {\n if (item.Children.length > 0) {\n this.RelatedItems.push(...item.Children);\n }\n }\n return;\n }\n this.RelatedItems.push(...tree);\n }\n\n /** Relay navigation events from child cards */\n OnCardNavigate(event: EntityHierarchyNavigationEvent): void {\n this.Navigate.emit(event);\n }\n}\n","<!-- ISA Related Panel: side panel container for all related IS-A entity cards -->\n@if (HasItems && !EditMode) {\n <div class=\"mj-isa-panel\" [class.mj-isa-panel--collapsed]=\"Collapsed\">\n\n <!-- Collapsed state: icon-only strip -->\n @if (Collapsed) {\n <div class=\"mj-isa-panel__collapsed-strip\">\n @for (item of RelatedItems; track item.EntityName) {\n <div class=\"mj-isa-panel__collapsed-icon\" [title]=\"item.EntityName\">\n <i class=\"fa-solid fa-link\"></i>\n </div>\n }\n </div>\n } @else {\n <!-- Expanded state: full card list -->\n <div class=\"mj-isa-panel__cards\">\n @for (item of RelatedItems; track item.EntityName) {\n <mj-isa-related-card\n [EntityName]=\"item.EntityName\"\n [PrimaryKey]=\"SharedPrimaryKey\"\n [CurrentRecordName]=\"CurrentRecordName\"\n [Relationship]=\"item.Relationship\"\n [Depth]=\"item.Depth\"\n [Children]=\"item.Children\"\n (Navigate)=\"OnCardNavigate($event)\">\n </mj-isa-related-card>\n }\n </div>\n }\n </div>\n}\n"]}
|
|
@@ -102,7 +102,7 @@ export function CollectClassFormPanelRegistrations() {
|
|
|
102
102
|
/** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */
|
|
103
103
|
export function MetadataContributionToRegistration(row) {
|
|
104
104
|
return {
|
|
105
|
-
...ContributionSpecToRegistration(row.Entity, contributionRowSpec(row), row.ComponentID),
|
|
105
|
+
...ContributionSpecToRegistration(row.Entity ?? '', contributionRowSpec(row), row.ComponentID),
|
|
106
106
|
Priority: row.Precedence ?? 0,
|
|
107
107
|
RowID: row.ID,
|
|
108
108
|
Scope: row.Scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-form-contribution-registrations.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-contribution-registrations.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAE,QAAQ,EAA2C,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,wBAAwB,EAAuC,MAAM,+BAA+B,CAAC;AAC9J,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAsC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAqC,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAA6B,MAAM,qBAAqB,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AAEH,MAAM,i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Q,CAAC,+DAA+D,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChI,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,QAAQ,CAAC,gEAAgE,MAAM,CAAC,IAAI,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjJ,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC;IACvG,IAAI,KAAK,CAAC,IAAI,IAAI,iBAAiB,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QACzC,IAAI,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["// packages/Angular/Generic/base-forms/src/lib/panel-slot/collect-form-contribution-registrations.ts\nimport { LogError, type EntityInfo, type IMetadataProvider } from '@memberjunction/core';\nimport { InteractiveFormsEngine, ParseClaimedFieldNames, ParseHiddenFormPanelKeys, type MJEntityFormContributionEntity } from '@memberjunction/core-entities';\nimport { MJGlobal, SafeJSONParse } from '@memberjunction/global';\nimport type { FormContributionSpec } from '@memberjunction/interactive-component-types/forms';\nimport { BaseFormPanel, type FormPanelRegistrationMetadata } from './base-form-panel';\nimport { ContributionSpecToRegistration, type FormContributionRegistration } from './form-contribution';\nimport { ForgetHiddenPanelsSettings, HiddenPanelsSetting, WithoutHiddenPanels } from './panel-hides';\nimport { WithPlacementPreview, type FormPlacementPreview } from './placement-preview';\n\n/**\n * One list of form contributions from two sources:\n * - compiled `BaseFormPanel` registrations in the ClassFactory (`Source: 'class'`)\n * - Active, scope-matching `MJ: Entity Form Contributions` rows (`Source: 'metadata'`)\n *\n * Rows come from the `InteractiveFormsEngine` singleton, which holds the rows of the\n * provider that loaded it.\n *\n * Memoized per (provider, entity, user). The memo key also folds in the ClassFactory\n * registration count (lazy-loaded OpenApp modules register late) and an engine\n * version that bumps on every `Contributions$` emission. The whole-form host\n * awaits the resolver — which Configs the engine — before the form mounts, so\n * slots normally see rows on first render; when the engine is cold this kicks a\n * `Config` and returns class registrations, and the emission re-fills the memo.\n */\n\nconst MAX_CACHE_ENTRIES = 16;\nconst cache = new Map<string, FormContributionRegistration[]>();\nlet engineVersion = 0;\nlet engineSubscribed = false;\n\nfunction ensureEngineSubscription(): void {\n if (engineSubscribed) return;\n engineSubscribed = true;\n try {\n InteractiveFormsEngine.Instance.Contributions$.subscribe(() => {\n engineVersion++;\n cache.clear();\n });\n } catch (err) {\n engineSubscribed = false;\n LogError(`CollectFormContributionRegistrations: could not subscribe to Contributions$: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n\n/**\n * Registration count, probed at most once per interval.\n *\n * The count is the memo's invalidation signal for lazily-registered panels, but\n * `GetAllRegistrations` filters every registration in the process (~2,000 in Explorer) and\n * allocates an array. This function sits on the hottest path in the form runtime —\n * `BaseFormComponent.formContext` is a getter bound in dozens of places per form and\n * re-evaluated on every change-detection pass — so probing per call is not affordable.\n * A lazily-loaded module's panels therefore appear within one interval rather than instantly,\n * which is the right trade: module loads are rare, change detection is not.\n */\nconst CLASS_COUNT_PROBE_INTERVAL_MS = 1000;\nlet lastClassCount = -1;\nlet lastClassCountAt = 0;\n\nfunction currentClassCount(): number {\n const now = Date.now();\n if (lastClassCount < 0 || now - lastClassCountAt >= CLASS_COUNT_PROBE_INTERVAL_MS) {\n lastClassCount = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormPanel).length;\n lastClassCountAt = now;\n }\n return lastClassCount;\n}\n\n/** Test seam and escape hatch — drops every memoized list and every remembered hide list. */\nexport function InvalidateFormContributionRegistrationCache(): void {\n cache.clear();\n ForgetHiddenPanelsSettings();\n lastClassCount = -1;\n lastClassCountAt = 0;\n providerKeys = new WeakMap<IMetadataProvider, string>();\n nextProviderKey = 0;\n}\n\n/**\n * Stable per-instance identity for a provider, without assuming it exposes a name\n * or an ID. A WeakMap keeps this from pinning providers in memory.\n */\nlet providerKeys = new WeakMap<IMetadataProvider, string>();\nlet nextProviderKey = 0;\nfunction ProviderCacheKey(provider: IMetadataProvider): string {\n let k = providerKeys.get(provider);\n if (!k) {\n k = `p${++nextProviderKey}`;\n providerKeys.set(provider, k);\n }\n return k;\n}\n\n/** Compiled `BaseFormPanel` registrations that declare an `entity`. */\nexport function CollectClassFormPanelRegistrations(): FormContributionRegistration[] {\n return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as Partial<FormPanelRegistrationMetadata>).entity;\n return typeof entity === 'string' && entity.length > 0;\n },\n ).map((reg) => ({\n Priority: reg.Priority,\n Metadata: reg.Metadata as FormPanelRegistrationMetadata,\n Source: 'class' as const,\n Registration: reg,\n }));\n}\n\n/** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */\nexport function MetadataContributionToRegistration(row: MJEntityFormContributionEntity): FormContributionRegistration {\n return {\n ...ContributionSpecToRegistration(row.Entity, contributionRowSpec(row), row.ComponentID),\n Priority: row.Precedence ?? 0,\n RowID: row.ID,\n Scope: row.Scope,\n };\n}\n\n/** The spec a stored row holds. */\nfunction contributionRowSpec(row: MJEntityFormContributionEntity): FormContributionSpec {\n const spec: FormContributionSpec = {\n slot: row.Slot,\n sortKey: row.SortKey ?? 0,\n presentation: row.Presentation,\n title: row.Title ?? row.Name,\n configuration: SafeJSONParse<Record<string, unknown>>(row.Configuration ?? '', false) ?? {},\n };\n if (row.Icon) spec.icon = row.Icon;\n if (row.ContributionKey) spec.contributionKey = row.ContributionKey;\n if (row.RelatedEntity) spec.relatedEntity = row.RelatedEntity;\n if (row.RelatedJoinField) spec.relatedJoinField = row.RelatedJoinField;\n if (row.ReplacesSectionKey) spec.replacesSectionKey = row.ReplacesSectionKey;\n const claimedFields = ParseClaimedFieldNames(row.ReplacesFieldNames);\n if (claimedFields.length > 0) spec.replacesFieldNames = claimedFields;\n const claimedSections = ParseClaimedFieldNames(row.ReplacesSectionKeys);\n if (claimedSections.length > 0) spec.replacesSectionKeys = claimedSections;\n if (row.InSectionKey) spec.inSectionKey = row.InSectionKey;\n if (row.SectionPosition) spec.sectionPosition = row.SectionPosition;\n if (row.Inclusion) spec.inclusion = row.Inclusion;\n if (row.ChromeGroup) spec.chromeGroup = row.ChromeGroup;\n return spec;\n}\n\nexport interface CollectFormContributionOptions {\n /**\n * Include the panels this user has hidden. Only the drawer wants these, to list them under\n * \"Hidden by you\" so a hide can be undone; everything that draws the form leaves it false.\n */\n IncludeHidden?: boolean;\n\n /**\n * The placement dialog's unsaved panel, added to the list. Passed only by a form the\n * dialog renders as its preview.\n */\n Preview?: FormPlacementPreview | null;\n}\n\n/**\n * Class registrations plus the rows that apply to (entity, current user).\n * Falls back to class-only when there is no entity or provider (standalone\n * panel composition outside a form).\n */\nexport function CollectFormContributionRegistrations(\n entity: EntityInfo | null | undefined,\n provider: IMetadataProvider | null | undefined,\n options?: CollectFormContributionOptions,\n): FormContributionRegistration[] {\n if (!entity || !provider) return CollectClassFormPanelRegistrations();\n return WithPlacementPreview(collectFromSources(entity, provider, options), options?.Preview);\n}\n\n/** Class registrations plus applicable rows, memoized. Everything but the preview. */\nfunction collectFromSources(\n entity: EntityInfo,\n provider: IMetadataProvider,\n options: CollectFormContributionOptions | undefined,\n): FormContributionRegistration[] {\n ensureEngineSubscription();\n const user = provider.CurrentUser;\n const userID = user?.ID ?? '';\n const roleIDs = (user?.UserRoles ?? []).map((r) => r.RoleID).filter((id): id is string => !!id);\n const classCount = currentClassCount();\n // The provider is part of the key. Every provider reads rows from the one engine\n // instance, but each has its own entity metadata and current user, so one provider's\n // list is never served to another.\n // The user's hidden panels are part of the identity too, so hiding one repaints at once\n // rather than waiting for an unrelated change to clear the memo. The setting itself is\n // remembered until the user's settings change (HiddenPanelsSetting), so this costs no scan.\n const includeHidden = options?.IncludeHidden === true;\n const hiddenSetting = includeHidden ? '' : HiddenPanelsSetting(entity.Name);\n const key = `${ProviderCacheKey(provider)}::${entity.Name}::${userID}::${classCount}::${engineVersion}` +\n `::${includeHidden ? 'all' : hiddenSetting}`;\n const hit = cache.get(key);\n if (hit) return hit;\n\n // Only past the cache: `GetAllRegistrationsByMetadata` filters every registration in the\n // process and runs a predicate on each. `BaseFormComponent.formContext` calls this getter\n // on every change-detection pass, so paying that scan per pass is precisely the cost this\n // memo exists to remove — it has to sit behind the cache, not in front of it.\n const classRegs = CollectClassFormPanelRegistrations();\n\n let rows: MJEntityFormContributionEntity[] = [];\n try {\n const engine = InteractiveFormsEngine.Instance;\n if (engine.IsPermissionConstrained) {\n // Expected on deployments where this role has no read on the new entity.\n // Not an error — the idiom used by FormResolverService and ApplicationManager.\n rows = [];\n } else if (engine.Loaded) {\n rows = engine.GetApplicableContributions(entity.ID, userID, roleIDs);\n } else {\n // Kick the load; the Contributions$ subscription above refills the memo when it\n // lands. `.catch` is load-bearing: a rejected Config here would otherwise surface\n // as an unhandled rejection on every entity whose form is opened.\n void engine.Config(false, user ?? undefined, provider).catch((err: unknown) => {\n LogError(`CollectFormContributionRegistrations: engine Config failed: ${err instanceof Error ? err.message : String(err)}`);\n });\n }\n } catch (err) {\n LogError(`CollectFormContributionRegistrations: engine read failed for ${entity.Name}: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const all = [...classRegs, ...rows.map(MetadataContributionToRegistration)];\n const merged = includeHidden ? all : WithoutHiddenPanels(all, ParseHiddenFormPanelKeys(hiddenSetting));\n if (cache.size >= MAX_CACHE_ENTRIES) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(key, merged);\n return merged;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"collect-form-contribution-registrations.js","sourceRoot":"","sources":["../../../src/lib/panel-slot/collect-form-contribution-registrations.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,OAAO,EAAE,QAAQ,EAA2C,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,wBAAwB,EAAuC,MAAM,+BAA+B,CAAC;AAC9J,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAsC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,8BAA8B,EAAqC,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,oBAAoB,EAA6B,MAAM,qBAAqB,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AAEH,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,KAAK,GAAG,IAAI,GAAG,EAA0C,CAAC;AAChE,IAAI,aAAa,GAAG,CAAC,CAAC;AACtB,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,SAAS,wBAAwB;IAC7B,IAAI,gBAAgB;QAAE,OAAO;IAC7B,gBAAgB,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC;QACD,sBAAsB,CAAC,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,EAAE;YAC1D,aAAa,EAAE,C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AM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjJ,CAAC;IAED,MAAM,GAAG,GAAG,CAAC,GAAG,SAAS,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,mBAAmB,CAAC,GAAG,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC,CAAC;IACvG,IAAI,KAAK,CAAC,IAAI,IAAI,iBAAiB,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QACzC,IAAI,MAAM,KAAK,SAAS;YAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACvB,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["// packages/Angular/Generic/base-forms/src/lib/panel-slot/collect-form-contribution-registrations.ts\nimport { LogError, type EntityInfo, type IMetadataProvider } from '@memberjunction/core';\nimport { InteractiveFormsEngine, ParseClaimedFieldNames, ParseHiddenFormPanelKeys, type MJEntityFormContributionEntity } from '@memberjunction/core-entities';\nimport { MJGlobal, SafeJSONParse } from '@memberjunction/global';\nimport type { FormContributionSpec } from '@memberjunction/interactive-component-types/forms';\nimport { BaseFormPanel, type FormPanelRegistrationMetadata } from './base-form-panel';\nimport { ContributionSpecToRegistration, type FormContributionRegistration } from './form-contribution';\nimport { ForgetHiddenPanelsSettings, HiddenPanelsSetting, WithoutHiddenPanels } from './panel-hides';\nimport { WithPlacementPreview, type FormPlacementPreview } from './placement-preview';\n\n/**\n * One list of form contributions from two sources:\n * - compiled `BaseFormPanel` registrations in the ClassFactory (`Source: 'class'`)\n * - Active, scope-matching `MJ: Entity Form Contributions` rows (`Source: 'metadata'`)\n *\n * Rows come from the `InteractiveFormsEngine` singleton, which holds the rows of the\n * provider that loaded it.\n *\n * Memoized per (provider, entity, user). The memo key also folds in the ClassFactory\n * registration count (lazy-loaded OpenApp modules register late) and an engine\n * version that bumps on every `Contributions$` emission. The whole-form host\n * awaits the resolver — which Configs the engine — before the form mounts, so\n * slots normally see rows on first render; when the engine is cold this kicks a\n * `Config` and returns class registrations, and the emission re-fills the memo.\n */\n\nconst MAX_CACHE_ENTRIES = 16;\nconst cache = new Map<string, FormContributionRegistration[]>();\nlet engineVersion = 0;\nlet engineSubscribed = false;\n\nfunction ensureEngineSubscription(): void {\n if (engineSubscribed) return;\n engineSubscribed = true;\n try {\n InteractiveFormsEngine.Instance.Contributions$.subscribe(() => {\n engineVersion++;\n cache.clear();\n });\n } catch (err) {\n engineSubscribed = false;\n LogError(`CollectFormContributionRegistrations: could not subscribe to Contributions$: ${err instanceof Error ? err.message : String(err)}`);\n }\n}\n\n/**\n * Registration count, probed at most once per interval.\n *\n * The count is the memo's invalidation signal for lazily-registered panels, but\n * `GetAllRegistrations` filters every registration in the process (~2,000 in Explorer) and\n * allocates an array. This function sits on the hottest path in the form runtime —\n * `BaseFormComponent.formContext` is a getter bound in dozens of places per form and\n * re-evaluated on every change-detection pass — so probing per call is not affordable.\n * A lazily-loaded module's panels therefore appear within one interval rather than instantly,\n * which is the right trade: module loads are rare, change detection is not.\n */\nconst CLASS_COUNT_PROBE_INTERVAL_MS = 1000;\nlet lastClassCount = -1;\nlet lastClassCountAt = 0;\n\nfunction currentClassCount(): number {\n const now = Date.now();\n if (lastClassCount < 0 || now - lastClassCountAt >= CLASS_COUNT_PROBE_INTERVAL_MS) {\n lastClassCount = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormPanel).length;\n lastClassCountAt = now;\n }\n return lastClassCount;\n}\n\n/** Test seam and escape hatch — drops every memoized list and every remembered hide list. */\nexport function InvalidateFormContributionRegistrationCache(): void {\n cache.clear();\n ForgetHiddenPanelsSettings();\n lastClassCount = -1;\n lastClassCountAt = 0;\n providerKeys = new WeakMap<IMetadataProvider, string>();\n nextProviderKey = 0;\n}\n\n/**\n * Stable per-instance identity for a provider, without assuming it exposes a name\n * or an ID. A WeakMap keeps this from pinning providers in memory.\n */\nlet providerKeys = new WeakMap<IMetadataProvider, string>();\nlet nextProviderKey = 0;\nfunction ProviderCacheKey(provider: IMetadataProvider): string {\n let k = providerKeys.get(provider);\n if (!k) {\n k = `p${++nextProviderKey}`;\n providerKeys.set(provider, k);\n }\n return k;\n}\n\n/** Compiled `BaseFormPanel` registrations that declare an `entity`. */\nexport function CollectClassFormPanelRegistrations(): FormContributionRegistration[] {\n return MJGlobal.Instance.ClassFactory.GetAllRegistrationsByMetadata(\n BaseFormPanel,\n (metadata) => {\n if (!metadata) return false;\n const entity = (metadata as Partial<FormPanelRegistrationMetadata>).entity;\n return typeof entity === 'string' && entity.length > 0;\n },\n ).map((reg) => ({\n Priority: reg.Priority,\n Metadata: reg.Metadata as FormPanelRegistrationMetadata,\n Source: 'class' as const,\n Registration: reg,\n }));\n}\n\n/** One `MJ: Entity Form Contributions` row as a registration, through {@link ContributionSpecToRegistration}. */\nexport function MetadataContributionToRegistration(row: MJEntityFormContributionEntity): FormContributionRegistration {\n return {\n ...ContributionSpecToRegistration(row.Entity ?? '', contributionRowSpec(row), row.ComponentID),\n Priority: row.Precedence ?? 0,\n RowID: row.ID,\n Scope: row.Scope,\n };\n}\n\n/** The spec a stored row holds. */\nfunction contributionRowSpec(row: MJEntityFormContributionEntity): FormContributionSpec {\n const spec: FormContributionSpec = {\n slot: row.Slot,\n sortKey: row.SortKey ?? 0,\n presentation: row.Presentation,\n title: row.Title ?? row.Name,\n configuration: SafeJSONParse<Record<string, unknown>>(row.Configuration ?? '', false) ?? {},\n };\n if (row.Icon) spec.icon = row.Icon;\n if (row.ContributionKey) spec.contributionKey = row.ContributionKey;\n if (row.RelatedEntity) spec.relatedEntity = row.RelatedEntity;\n if (row.RelatedJoinField) spec.relatedJoinField = row.RelatedJoinField;\n if (row.ReplacesSectionKey) spec.replacesSectionKey = row.ReplacesSectionKey;\n const claimedFields = ParseClaimedFieldNames(row.ReplacesFieldNames);\n if (claimedFields.length > 0) spec.replacesFieldNames = claimedFields;\n const claimedSections = ParseClaimedFieldNames(row.ReplacesSectionKeys);\n if (claimedSections.length > 0) spec.replacesSectionKeys = claimedSections;\n if (row.InSectionKey) spec.inSectionKey = row.InSectionKey;\n if (row.SectionPosition) spec.sectionPosition = row.SectionPosition;\n if (row.Inclusion) spec.inclusion = row.Inclusion;\n if (row.ChromeGroup) spec.chromeGroup = row.ChromeGroup;\n return spec;\n}\n\nexport interface CollectFormContributionOptions {\n /**\n * Include the panels this user has hidden. Only the drawer wants these, to list them under\n * \"Hidden by you\" so a hide can be undone; everything that draws the form leaves it false.\n */\n IncludeHidden?: boolean;\n\n /**\n * The placement dialog's unsaved panel, added to the list. Passed only by a form the\n * dialog renders as its preview.\n */\n Preview?: FormPlacementPreview | null;\n}\n\n/**\n * Class registrations plus the rows that apply to (entity, current user).\n * Falls back to class-only when there is no entity or provider (standalone\n * panel composition outside a form).\n */\nexport function CollectFormContributionRegistrations(\n entity: EntityInfo | null | undefined,\n provider: IMetadataProvider | null | undefined,\n options?: CollectFormContributionOptions,\n): FormContributionRegistration[] {\n if (!entity || !provider) return CollectClassFormPanelRegistrations();\n return WithPlacementPreview(collectFromSources(entity, provider, options), options?.Preview);\n}\n\n/** Class registrations plus applicable rows, memoized. Everything but the preview. */\nfunction collectFromSources(\n entity: EntityInfo,\n provider: IMetadataProvider,\n options: CollectFormContributionOptions | undefined,\n): FormContributionRegistration[] {\n ensureEngineSubscription();\n const user = provider.CurrentUser;\n const userID = user?.ID ?? '';\n const roleIDs = (user?.UserRoles ?? []).map((r) => r.RoleID).filter((id): id is string => !!id);\n const classCount = currentClassCount();\n // The provider is part of the key. Every provider reads rows from the one engine\n // instance, but each has its own entity metadata and current user, so one provider's\n // list is never served to another.\n // The user's hidden panels are part of the identity too, so hiding one repaints at once\n // rather than waiting for an unrelated change to clear the memo. The setting itself is\n // remembered until the user's settings change (HiddenPanelsSetting), so this costs no scan.\n const includeHidden = options?.IncludeHidden === true;\n const hiddenSetting = includeHidden ? '' : HiddenPanelsSetting(entity.Name);\n const key = `${ProviderCacheKey(provider)}::${entity.Name}::${userID}::${classCount}::${engineVersion}` +\n `::${includeHidden ? 'all' : hiddenSetting}`;\n const hit = cache.get(key);\n if (hit) return hit;\n\n // Only past the cache: `GetAllRegistrationsByMetadata` filters every registration in the\n // process and runs a predicate on each. `BaseFormComponent.formContext` calls this getter\n // on every change-detection pass, so paying that scan per pass is precisely the cost this\n // memo exists to remove — it has to sit behind the cache, not in front of it.\n const classRegs = CollectClassFormPanelRegistrations();\n\n let rows: MJEntityFormContributionEntity[] = [];\n try {\n const engine = InteractiveFormsEngine.Instance;\n if (engine.IsPermissionConstrained) {\n // Expected on deployments where this role has no read on the new entity.\n // Not an error — the idiom used by FormResolverService and ApplicationManager.\n rows = [];\n } else if (engine.Loaded) {\n rows = engine.GetApplicableContributions(entity.ID, userID, roleIDs);\n } else {\n // Kick the load; the Contributions$ subscription above refills the memo when it\n // lands. `.catch` is load-bearing: a rejected Config here would otherwise surface\n // as an unhandled rejection on every entity whose form is opened.\n void engine.Config(false, user ?? undefined, provider).catch((err: unknown) => {\n LogError(`CollectFormContributionRegistrations: engine Config failed: ${err instanceof Error ? err.message : String(err)}`);\n });\n }\n } catch (err) {\n LogError(`CollectFormContributionRegistrations: engine read failed for ${entity.Name}: ${err instanceof Error ? err.message : String(err)}`);\n }\n\n const all = [...classRegs, ...rows.map(MetadataContributionToRegistration)];\n const merged = includeHidden ? all : WithoutHiddenPanels(all, ParseHiddenFormPanelKeys(hiddenSetting));\n if (cache.size >= MAX_CACHE_ENTRIES) {\n const oldest = cache.keys().next().value;\n if (oldest !== undefined) cache.delete(oldest);\n }\n cache.set(key, merged);\n return merged;\n}\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { BaseEntity, EntityInfo, UserInfo, ValidationResult } from '@memberjunction/core';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import type { BaseFormComponent } from '../base-form-component';
|
|
5
|
+
import type { FormContext } from '../types/form-types';
|
|
6
|
+
import type { FormNavigationEvent } from '../types/navigation-events';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/**
|
|
9
|
+
* Identifies the host surface rendering an {@link EntitySubtypeUIDriverBase} component.
|
|
10
|
+
*
|
|
11
|
+
* - `'form-section'`: Mounted inside `<mj-folded-subtype-section>` on a parent entity's form
|
|
12
|
+
* when `SubtypeSelector.FoldIntoForm` is `true` and the active type row names a `UIDriver`.
|
|
13
|
+
* - `'comment-card'`: Mounted inside `<mj-record-comments>` when rendering a comment whose
|
|
14
|
+
* `CommentType.UIDriverClass` names this driver (for example `FieldSuggestionCardComponent`).
|
|
15
|
+
* - `'custom'`: Mounted by another type-driven host surface.
|
|
16
|
+
*/
|
|
17
|
+
export type SubtypeUIDriverSurface = 'form-section' | 'comment-card' | 'custom';
|
|
18
|
+
/**
|
|
19
|
+
* Control type rendered by `<mj-form-field>` for a generated subtype field.
|
|
20
|
+
*/
|
|
21
|
+
export type SubtypeFieldControlType = 'textbox' | 'textarea' | 'number' | 'datepicker' | 'checkbox' | 'select' | 'autocomplete' | 'code';
|
|
22
|
+
/**
|
|
23
|
+
* Read-mode link behavior rendered by `<mj-form-field>` for a generated subtype field.
|
|
24
|
+
*/
|
|
25
|
+
export type SubtypeFieldLinkType = 'Email' | 'URL' | 'Record' | 'None';
|
|
26
|
+
/**
|
|
27
|
+
* Computed field rendering descriptor for an IS-A child entity's own fields when
|
|
28
|
+
* `SubtypeSelector.FoldIntoForm` renders generated fields.
|
|
29
|
+
*/
|
|
30
|
+
export interface SubtypeGeneratedFieldSpec {
|
|
31
|
+
/** Exact field name on the child entity. */
|
|
32
|
+
FieldName: string;
|
|
33
|
+
/** Display label from entity field metadata. */
|
|
34
|
+
DisplayName: string;
|
|
35
|
+
/** Edit control type matching CodeGen's Angular form emitter. */
|
|
36
|
+
ControlType: SubtypeFieldControlType;
|
|
37
|
+
/** Read-only link rendering mode matching CodeGen's Angular form emitter. */
|
|
38
|
+
LinkType: SubtypeFieldLinkType;
|
|
39
|
+
/** Sequence order from metadata. */
|
|
40
|
+
Sequence: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Abstract base class for UI components resolved dynamically from a type table row via
|
|
44
|
+
* `IEntitySubtypeSelectorConfig.UIDriver` (`{ Path: string }`).
|
|
45
|
+
*
|
|
46
|
+
* Subclasses register with `@RegisterClass(EntitySubtypeUIDriverBase, 'YourUIDriverKey')`
|
|
47
|
+
* (where the key matches the string stored in the type row's `UIDriverClass` column).
|
|
48
|
+
*
|
|
49
|
+
* Host surfaces:
|
|
50
|
+
* 1. **Generated forms (`FoldIntoForm: true`)**: Replaces the child entity's default generated
|
|
51
|
+
* fields inside `<mj-folded-subtype-section>`.
|
|
52
|
+
* 2. **Comments & type-driven cards**: Renders custom cards (such as `FieldSuggestionCardComponent`)
|
|
53
|
+
* for records of that subtype.
|
|
54
|
+
*/
|
|
55
|
+
export declare abstract class EntitySubtypeUIDriverBase<TRecord extends BaseEntity = BaseEntity, TChild extends BaseEntity = BaseEntity> extends BaseAngularComponent {
|
|
56
|
+
/** The parent entity record whose type resolved this UI driver (e.g., Task or Comment). */
|
|
57
|
+
Record: TRecord | null;
|
|
58
|
+
/** The resolved IS-A child entity record (e.g., GitHubIssueTask or FieldSuggestion), when present. */
|
|
59
|
+
ChildRecord: TChild | null;
|
|
60
|
+
/**
|
|
61
|
+
* Optional target entity record when the subtype record is anchored to another entity
|
|
62
|
+
* (for example, the entity record that a `FieldSuggestion` proposes a value for).
|
|
63
|
+
*/
|
|
64
|
+
TargetRecord: BaseEntity | null;
|
|
65
|
+
/** Whether the host surface is currently in edit mode. */
|
|
66
|
+
EditMode: boolean;
|
|
67
|
+
/** Which surface mounted this driver (`'form-section'`, `'comment-card'`, or `'custom'`). */
|
|
68
|
+
Surface: SubtypeUIDriverSurface;
|
|
69
|
+
/** Host form component when mounted inside an entity record form. */
|
|
70
|
+
FormComponent: BaseFormComponent | null;
|
|
71
|
+
/** Host form context (search filter, empty-field visibility, validation state) when in a form. */
|
|
72
|
+
FormContext?: FormContext;
|
|
73
|
+
/** Optional structured metadata/context supplied by non-form host surfaces. */
|
|
74
|
+
DriverContext: Record<string, unknown> | null;
|
|
75
|
+
/** Emitted when the driver requests record or external navigation. */
|
|
76
|
+
Navigate: EventEmitter<FormNavigationEvent>;
|
|
77
|
+
/**
|
|
78
|
+
* Emitted when an interactive driver action mutates the subtype record or target record
|
|
79
|
+
* (e.g., accepting or rejecting a field suggestion, or posting a reply).
|
|
80
|
+
*/
|
|
81
|
+
RecordMutated: EventEmitter<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Optional validation hook invoked when `Surface === 'form-section'` before `SaveRecord()`.
|
|
84
|
+
* Default implementation reports valid.
|
|
85
|
+
*/
|
|
86
|
+
Validate(): ValidationResult | Promise<ValidationResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Synchronous validation snapshot used by synchronous `BaseFormComponent.Validate()` callers.
|
|
89
|
+
*/
|
|
90
|
+
LastKnownValidation(): ValidationResult;
|
|
91
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntitySubtypeUIDriverBase<any, any>, never>;
|
|
92
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<EntitySubtypeUIDriverBase<any, any>, never, never, { "Record": { "alias": "Record"; "required": false; }; "ChildRecord": { "alias": "ChildRecord"; "required": false; }; "TargetRecord": { "alias": "TargetRecord"; "required": false; }; "EditMode": { "alias": "EditMode"; "required": false; }; "Surface": { "alias": "Surface"; "required": false; }; "FormComponent": { "alias": "FormComponent"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; "DriverContext": { "alias": "DriverContext"; "required": false; }; }, { "Navigate": "Navigate"; "RecordMutated": "RecordMutated"; }, never, never, true, never>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Derives the ordered list of `<mj-form-field>` descriptors for an IS-A child entity's own
|
|
96
|
+
* fields, mirroring CodeGen's `generateSectionHTMLForAngular` / `isFieldRenderedInForm` rules
|
|
97
|
+
* and enforcing per-user field-level read security.
|
|
98
|
+
*/
|
|
99
|
+
export declare function ResolveGeneratedSubtypeFieldSpecs(childEntity: EntityInfo, user?: UserInfo | null): SubtypeGeneratedFieldSpec[];
|
|
100
|
+
//# sourceMappingURL=entity-subtype-ui-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-subtype-ui-driver.d.ts","sourceRoot":"","sources":["../../../src/lib/subtype-ui-driver/entity-subtype-ui-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAiB,MAAM,eAAe,CAAC;AACvE,OAAO,EACH,UAAU,EAIV,UAAU,EACV,QAAQ,EACR,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG,cAAc,GAAG,QAAQ,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC7B,SAAS,GACT,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,cAAc,GACd,MAAM,CAAC;AAEb;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvE;;;GAGG;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}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { Directive, EventEmitter, Input, Output } from '@angular/core';
|
|
2
|
+
import { EntityFieldTSType, EntityFieldValueListType, ValidationResult, } from '@memberjunction/core';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class for UI components resolved dynamically from a type table row via
|
|
7
|
+
* `IEntitySubtypeSelectorConfig.UIDriver` (`{ Path: string }`).
|
|
8
|
+
*
|
|
9
|
+
* Subclasses register with `@RegisterClass(EntitySubtypeUIDriverBase, 'YourUIDriverKey')`
|
|
10
|
+
* (where the key matches the string stored in the type row's `UIDriverClass` column).
|
|
11
|
+
*
|
|
12
|
+
* Host surfaces:
|
|
13
|
+
* 1. **Generated forms (`FoldIntoForm: true`)**: Replaces the child entity's default generated
|
|
14
|
+
* fields inside `<mj-folded-subtype-section>`.
|
|
15
|
+
* 2. **Comments & type-driven cards**: Renders custom cards (such as `FieldSuggestionCardComponent`)
|
|
16
|
+
* for records of that subtype.
|
|
17
|
+
*/
|
|
18
|
+
export class EntitySubtypeUIDriverBase extends BaseAngularComponent {
|
|
19
|
+
/** The parent entity record whose type resolved this UI driver (e.g., Task or Comment). */
|
|
20
|
+
Record = null;
|
|
21
|
+
/** The resolved IS-A child entity record (e.g., GitHubIssueTask or FieldSuggestion), when present. */
|
|
22
|
+
ChildRecord = null;
|
|
23
|
+
/**
|
|
24
|
+
* Optional target entity record when the subtype record is anchored to another entity
|
|
25
|
+
* (for example, the entity record that a `FieldSuggestion` proposes a value for).
|
|
26
|
+
*/
|
|
27
|
+
TargetRecord = null;
|
|
28
|
+
/** Whether the host surface is currently in edit mode. */
|
|
29
|
+
EditMode = false;
|
|
30
|
+
/** Which surface mounted this driver (`'form-section'`, `'comment-card'`, or `'custom'`). */
|
|
31
|
+
Surface = 'form-section';
|
|
32
|
+
/** Host form component when mounted inside an entity record form. */
|
|
33
|
+
FormComponent = null;
|
|
34
|
+
/** Host form context (search filter, empty-field visibility, validation state) when in a form. */
|
|
35
|
+
FormContext;
|
|
36
|
+
/** Optional structured metadata/context supplied by non-form host surfaces. */
|
|
37
|
+
DriverContext = null;
|
|
38
|
+
/** Emitted when the driver requests record or external navigation. */
|
|
39
|
+
Navigate = new EventEmitter();
|
|
40
|
+
/**
|
|
41
|
+
* Emitted when an interactive driver action mutates the subtype record or target record
|
|
42
|
+
* (e.g., accepting or rejecting a field suggestion, or posting a reply).
|
|
43
|
+
*/
|
|
44
|
+
RecordMutated = new EventEmitter();
|
|
45
|
+
/**
|
|
46
|
+
* Optional validation hook invoked when `Surface === 'form-section'` before `SaveRecord()`.
|
|
47
|
+
* Default implementation reports valid.
|
|
48
|
+
*/
|
|
49
|
+
Validate() {
|
|
50
|
+
const result = new ValidationResult();
|
|
51
|
+
result.Success = true;
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Synchronous validation snapshot used by synchronous `BaseFormComponent.Validate()` callers.
|
|
56
|
+
*/
|
|
57
|
+
LastKnownValidation() {
|
|
58
|
+
const result = new ValidationResult();
|
|
59
|
+
result.Success = true;
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
static ɵfac = /*@__PURE__*/ (() => { let ɵEntitySubtypeUIDriverBase_BaseFactory; return function EntitySubtypeUIDriverBase_Factory(__ngFactoryType__) { return (ɵEntitySubtypeUIDriverBase_BaseFactory || (ɵEntitySubtypeUIDriverBase_BaseFactory = i0.ɵɵgetInheritedFactory(EntitySubtypeUIDriverBase)))(__ngFactoryType__ || EntitySubtypeUIDriverBase); }; })();
|
|
63
|
+
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: EntitySubtypeUIDriverBase, inputs: { Record: "Record", ChildRecord: "ChildRecord", TargetRecord: "TargetRecord", EditMode: "EditMode", Surface: "Surface", FormComponent: "FormComponent", FormContext: "FormContext", DriverContext: "DriverContext" }, outputs: { Navigate: "Navigate", RecordMutated: "RecordMutated" }, features: [i0.ɵɵInheritDefinitionFeature] });
|
|
64
|
+
}
|
|
65
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntitySubtypeUIDriverBase, [{
|
|
66
|
+
type: Directive
|
|
67
|
+
}], null, { Record: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], ChildRecord: [{
|
|
70
|
+
type: Input
|
|
71
|
+
}], TargetRecord: [{
|
|
72
|
+
type: Input
|
|
73
|
+
}], EditMode: [{
|
|
74
|
+
type: Input
|
|
75
|
+
}], Surface: [{
|
|
76
|
+
type: Input
|
|
77
|
+
}], FormComponent: [{
|
|
78
|
+
type: Input
|
|
79
|
+
}], FormContext: [{
|
|
80
|
+
type: Input
|
|
81
|
+
}], DriverContext: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], Navigate: [{
|
|
84
|
+
type: Output
|
|
85
|
+
}], RecordMutated: [{
|
|
86
|
+
type: Output
|
|
87
|
+
}] }); })();
|
|
88
|
+
/**
|
|
89
|
+
* Derives the ordered list of `<mj-form-field>` descriptors for an IS-A child entity's own
|
|
90
|
+
* fields, mirroring CodeGen's `generateSectionHTMLForAngular` / `isFieldRenderedInForm` rules
|
|
91
|
+
* and enforcing per-user field-level read security.
|
|
92
|
+
*/
|
|
93
|
+
export function ResolveGeneratedSubtypeFieldSpecs(childEntity, user) {
|
|
94
|
+
const parentFieldNames = childEntity.ParentEntityFieldNames;
|
|
95
|
+
const virtualNameTargets = collectVirtualFKNameFieldTargets(childEntity);
|
|
96
|
+
const renderedFields = childEntity.Fields.filter((field) => isSubtypeFieldRenderedInForm(childEntity, field, parentFieldNames, virtualNameTargets, user)).sort((a, b) => a.Sequence - b.Sequence);
|
|
97
|
+
return renderedFields.map((field) => ({
|
|
98
|
+
FieldName: field.Name,
|
|
99
|
+
DisplayName: field.DisplayNameOrName,
|
|
100
|
+
ControlType: resolveSubtypeFieldControlType(field),
|
|
101
|
+
LinkType: resolveSubtypeFieldLinkType(field),
|
|
102
|
+
Sequence: field.Sequence,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
function collectVirtualFKNameFieldTargets(entity) {
|
|
106
|
+
const targets = new Set();
|
|
107
|
+
for (const field of entity.Fields) {
|
|
108
|
+
const mapped = field.RelatedEntityNameFieldMap?.trim();
|
|
109
|
+
if (mapped) {
|
|
110
|
+
targets.add(mapped.toLowerCase());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return targets;
|
|
114
|
+
}
|
|
115
|
+
function isSubtypeFieldRenderedInForm(entity, field, parentFieldNames, virtualNameTargets, user) {
|
|
116
|
+
if (field.IsPrimaryKey)
|
|
117
|
+
return false;
|
|
118
|
+
if (field.Name.toLowerCase() === 'id')
|
|
119
|
+
return false;
|
|
120
|
+
if (parentFieldNames.has(field.Name))
|
|
121
|
+
return false;
|
|
122
|
+
if (field.Name === '__mj_CreatedAt' || field.Name === '__mj_UpdatedAt')
|
|
123
|
+
return false;
|
|
124
|
+
if (!field.IncludeInGeneratedForm)
|
|
125
|
+
return false;
|
|
126
|
+
if (field.Status === 'Deprecated' || field.Status === 'Disabled')
|
|
127
|
+
return false;
|
|
128
|
+
if (field.IsVirtual && virtualNameTargets.has(field.Name.toLowerCase()))
|
|
129
|
+
return false;
|
|
130
|
+
if (field.IsBinaryFieldType)
|
|
131
|
+
return false;
|
|
132
|
+
if (user && !entity.IsFieldReadableByUser(field.Name, user))
|
|
133
|
+
return false;
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
function resolveSubtypeFieldControlType(field) {
|
|
137
|
+
let control = 'textbox';
|
|
138
|
+
if (!field.ReadOnly) {
|
|
139
|
+
if (field.ValueListTypeEnum !== EntityFieldValueListType.None) {
|
|
140
|
+
if (field.ValueListTypeEnum === EntityFieldValueListType.ListOrUserEntry) {
|
|
141
|
+
control = 'autocomplete';
|
|
142
|
+
}
|
|
143
|
+
else if (field.ValueListTypeEnum === EntityFieldValueListType.List) {
|
|
144
|
+
control = 'select';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
else if (field.TSType === EntityFieldTSType.Boolean) {
|
|
148
|
+
control = 'checkbox';
|
|
149
|
+
}
|
|
150
|
+
else if (field.TSType === EntityFieldTSType.Date) {
|
|
151
|
+
control = 'datepicker';
|
|
152
|
+
}
|
|
153
|
+
else if (field.TSType === EntityFieldTSType.Number) {
|
|
154
|
+
control = 'number';
|
|
155
|
+
}
|
|
156
|
+
else if (field.TSType === EntityFieldTSType.String) {
|
|
157
|
+
if (field.Length < 0 || field.MaxLength > 1000) {
|
|
158
|
+
control = 'textarea';
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
control = 'textbox';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (field.ExtendedType === 'Code') {
|
|
166
|
+
control = 'code';
|
|
167
|
+
}
|
|
168
|
+
return control;
|
|
169
|
+
}
|
|
170
|
+
function resolveSubtypeFieldLinkType(field) {
|
|
171
|
+
if (field.RelatedEntity && field.RelatedEntity.trim().length > 0) {
|
|
172
|
+
return 'Record';
|
|
173
|
+
}
|
|
174
|
+
const ext = field.ExtendedType?.trim().toLowerCase();
|
|
175
|
+
if (ext === 'url')
|
|
176
|
+
return 'URL';
|
|
177
|
+
if (ext === 'email')
|
|
178
|
+
return 'Email';
|
|
179
|
+
return 'None';
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=entity-subtype-ui-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-subtype-ui-driver.js","sourceRoot":"","sources":["../../../src/lib/subtype-ui-driver/entity-subtype-ui-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAGH,iBAAiB,EACjB,wBAAwB,EAGxB,gBAAgB,GACnB,MAAM,sBAAsB,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AAM,KAAK,iBAAiB,CAAC,OAAO,EAAE,CAAC;YACpD,OAAO,GAAG,UAAU,CAAC;QACzB,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,IAAI,EAAE,CAAC;YACjD,OAAO,GAAG,YAAY,CAAC;QAC3B,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO,GAAG,QAAQ,CAAC;QACvB,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,iBAAiB,CAAC,MAAM,EAAE,CAAC;YACnD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,EAAE,CAAC;gBAC7C,OAAO,GAAG,UAAU,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACJ,OAAO,GAAG,SAAS,CAAC;YACxB,CAAC;QACL,CAAC;IACL,CAAC;IAED,IAAI,KAAK,CAAC,YAAY,KAAK,MAAM,EAAE,CAAC;QAChC,OAAO,GAAG,MAAM,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAED,SAAS,2BAA2B,CAAC,KAAsB;IACvD,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/D,OAAO,QAAQ,CAAC;IACpB,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,GAAG,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IACpC,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { Directive, EventEmitter, Input, Output } from '@angular/core';\nimport {\n BaseEntity,\n EntityFieldInfo,\n EntityFieldTSType,\n EntityFieldValueListType,\n EntityInfo,\n UserInfo,\n ValidationResult,\n} from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport type { BaseFormComponent } from '../base-form-component';\nimport type { FormContext } from '../types/form-types';\nimport type { FormNavigationEvent } from '../types/navigation-events';\n\n/**\n * Identifies the host surface rendering an {@link EntitySubtypeUIDriverBase} component.\n *\n * - `'form-section'`: Mounted inside `<mj-folded-subtype-section>` on a parent entity's form\n * when `SubtypeSelector.FoldIntoForm` is `true` and the active type row names a `UIDriver`.\n * - `'comment-card'`: Mounted inside `<mj-record-comments>` when rendering a comment whose\n * `CommentType.UIDriverClass` names this driver (for example `FieldSuggestionCardComponent`).\n * - `'custom'`: Mounted by another type-driven host surface.\n */\nexport type SubtypeUIDriverSurface = 'form-section' | 'comment-card' | 'custom';\n\n/**\n * Control type rendered by `<mj-form-field>` for a generated subtype field.\n */\nexport type SubtypeFieldControlType =\n | 'textbox'\n | 'textarea'\n | 'number'\n | 'datepicker'\n | 'checkbox'\n | 'select'\n | 'autocomplete'\n | 'code';\n\n/**\n * Read-mode link behavior rendered by `<mj-form-field>` for a generated subtype field.\n */\nexport type SubtypeFieldLinkType = 'Email' | 'URL' | 'Record' | 'None';\n\n/**\n * Computed field rendering descriptor for an IS-A child entity's own fields when\n * `SubtypeSelector.FoldIntoForm` renders generated fields.\n */\nexport interface SubtypeGeneratedFieldSpec {\n /** Exact field name on the child entity. */\n FieldName: string;\n /** Display label from entity field metadata. */\n DisplayName: string;\n /** Edit control type matching CodeGen's Angular form emitter. */\n ControlType: SubtypeFieldControlType;\n /** Read-only link rendering mode matching CodeGen's Angular form emitter. */\n LinkType: SubtypeFieldLinkType;\n /** Sequence order from metadata. */\n Sequence: number;\n}\n\n/**\n * Abstract base class for UI components resolved dynamically from a type table row via\n * `IEntitySubtypeSelectorConfig.UIDriver` (`{ Path: string }`).\n *\n * Subclasses register with `@RegisterClass(EntitySubtypeUIDriverBase, 'YourUIDriverKey')`\n * (where the key matches the string stored in the type row's `UIDriverClass` column).\n *\n * Host surfaces:\n * 1. **Generated forms (`FoldIntoForm: true`)**: Replaces the child entity's default generated\n * fields inside `<mj-folded-subtype-section>`.\n * 2. **Comments & type-driven cards**: Renders custom cards (such as `FieldSuggestionCardComponent`)\n * for records of that subtype.\n */\n@Directive()\nexport abstract class EntitySubtypeUIDriverBase<\n TRecord extends BaseEntity = BaseEntity,\n TChild extends BaseEntity = BaseEntity,\n> extends BaseAngularComponent {\n /** The parent entity record whose type resolved this UI driver (e.g., Task or Comment). */\n @Input() Record: TRecord | null = null;\n\n /** The resolved IS-A child entity record (e.g., GitHubIssueTask or FieldSuggestion), when present. */\n @Input() ChildRecord: TChild | null = null;\n\n /**\n * Optional target entity record when the subtype record is anchored to another entity\n * (for example, the entity record that a `FieldSuggestion` proposes a value for).\n */\n @Input() TargetRecord: BaseEntity | null = null;\n\n /** Whether the host surface is currently in edit mode. */\n @Input() EditMode = false;\n\n /** Which surface mounted this driver (`'form-section'`, `'comment-card'`, or `'custom'`). */\n @Input() Surface: SubtypeUIDriverSurface = 'form-section';\n\n /** Host form component when mounted inside an entity record form. */\n @Input() FormComponent: BaseFormComponent | null = null;\n\n /** Host form context (search filter, empty-field visibility, validation state) when in a form. */\n @Input() FormContext?: FormContext;\n\n /** Optional structured metadata/context supplied by non-form host surfaces. */\n @Input() DriverContext: Record<string, unknown> | null = null;\n\n /** Emitted when the driver requests record or external navigation. */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n /**\n * Emitted when an interactive driver action mutates the subtype record or target record\n * (e.g., accepting or rejecting a field suggestion, or posting a reply).\n */\n @Output() RecordMutated = new EventEmitter<void>();\n\n /**\n * Optional validation hook invoked when `Surface === 'form-section'` before `SaveRecord()`.\n * Default implementation reports valid.\n */\n public Validate(): ValidationResult | Promise<ValidationResult> {\n const result = new ValidationResult();\n result.Success = true;\n return result;\n }\n\n /**\n * Synchronous validation snapshot used by synchronous `BaseFormComponent.Validate()` callers.\n */\n public LastKnownValidation(): ValidationResult {\n const result = new ValidationResult();\n result.Success = true;\n return result;\n }\n}\n\n/**\n * Derives the ordered list of `<mj-form-field>` descriptors for an IS-A child entity's own\n * fields, mirroring CodeGen's `generateSectionHTMLForAngular` / `isFieldRenderedInForm` rules\n * and enforcing per-user field-level read security.\n */\nexport function ResolveGeneratedSubtypeFieldSpecs(\n childEntity: EntityInfo,\n user?: UserInfo | null,\n): SubtypeGeneratedFieldSpec[] {\n const parentFieldNames = childEntity.ParentEntityFieldNames;\n const virtualNameTargets = collectVirtualFKNameFieldTargets(childEntity);\n\n const renderedFields = childEntity.Fields.filter((field) =>\n isSubtypeFieldRenderedInForm(childEntity, field, parentFieldNames, virtualNameTargets, user),\n ).sort((a, b) => a.Sequence - b.Sequence);\n\n return renderedFields.map((field) => ({\n FieldName: field.Name,\n DisplayName: field.DisplayNameOrName,\n ControlType: resolveSubtypeFieldControlType(field),\n LinkType: resolveSubtypeFieldLinkType(field),\n Sequence: field.Sequence,\n }));\n}\n\nfunction collectVirtualFKNameFieldTargets(entity: EntityInfo): Set<string> {\n const targets = new Set<string>();\n for (const field of entity.Fields) {\n const mapped = field.RelatedEntityNameFieldMap?.trim();\n if (mapped) {\n targets.add(mapped.toLowerCase());\n }\n }\n return targets;\n}\n\nfunction isSubtypeFieldRenderedInForm(\n entity: EntityInfo,\n field: EntityFieldInfo,\n parentFieldNames: Set<string>,\n virtualNameTargets: Set<string>,\n user?: UserInfo | null,\n): boolean {\n if (field.IsPrimaryKey) return false;\n if (field.Name.toLowerCase() === 'id') return false;\n if (parentFieldNames.has(field.Name)) return false;\n if (field.Name === '__mj_CreatedAt' || field.Name === '__mj_UpdatedAt') return false;\n if (!field.IncludeInGeneratedForm) return false;\n if (field.Status === 'Deprecated' || field.Status === 'Disabled') return false;\n if (field.IsVirtual && virtualNameTargets.has(field.Name.toLowerCase())) return false;\n if (field.IsBinaryFieldType) return false;\n if (user && !entity.IsFieldReadableByUser(field.Name, user)) return false;\n return true;\n}\n\nfunction resolveSubtypeFieldControlType(field: EntityFieldInfo): SubtypeFieldControlType {\n let control: SubtypeFieldControlType = 'textbox';\n\n if (!field.ReadOnly) {\n if (field.ValueListTypeEnum !== EntityFieldValueListType.None) {\n if (field.ValueListTypeEnum === EntityFieldValueListType.ListOrUserEntry) {\n control = 'autocomplete';\n } else if (field.ValueListTypeEnum === EntityFieldValueListType.List) {\n control = 'select';\n }\n } else if (field.TSType === EntityFieldTSType.Boolean) {\n control = 'checkbox';\n } else if (field.TSType === EntityFieldTSType.Date) {\n control = 'datepicker';\n } else if (field.TSType === EntityFieldTSType.Number) {\n control = 'number';\n } else if (field.TSType === EntityFieldTSType.String) {\n if (field.Length < 0 || field.MaxLength > 1000) {\n control = 'textarea';\n } else {\n control = 'textbox';\n }\n }\n }\n\n if (field.ExtendedType === 'Code') {\n control = 'code';\n }\n\n return control;\n}\n\nfunction resolveSubtypeFieldLinkType(field: EntityFieldInfo): SubtypeFieldLinkType {\n if (field.RelatedEntity && field.RelatedEntity.trim().length > 0) {\n return 'Record';\n }\n const ext = field.ExtendedType?.trim().toLowerCase();\n if (ext === 'url') return 'URL';\n if (ext === 'email') return 'Email';\n return 'None';\n}\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { DoCheck, EventEmitter, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { BaseEntity, EntityInfo, ValidationResult } from '@memberjunction/core';
|
|
3
|
+
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
4
|
+
import type { BaseFormComponent } from '../base-form-component';
|
|
5
|
+
import type { FormContext } from '../types/form-types';
|
|
6
|
+
import type { FormNavigationEvent } from '../types/navigation-events';
|
|
7
|
+
import { type SubtypeGeneratedFieldSpec } from './entity-subtype-ui-driver';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* Renders an entity's active IS-A subtype extension inline inside its parent form when
|
|
11
|
+
* `EntityInfo.SubtypeSelectorConfig?.FoldIntoForm === true`.
|
|
12
|
+
*
|
|
13
|
+
* Behavior:
|
|
14
|
+
* - Off unless the entity explicitly opts in with `"FoldIntoForm": true` in `SubtypeSelector`.
|
|
15
|
+
* - Immediately reconciles the prospective `ISAChild` as soon as a type is picked on `Record`
|
|
16
|
+
* (including on a brand-new record before its first save).
|
|
17
|
+
* - When `SubtypeSelector.UIDriver` resolves to a class registered with
|
|
18
|
+
* `@RegisterClass(EntitySubtypeUIDriverBase, key)`, mounts that component in place of the
|
|
19
|
+
* default generated fields.
|
|
20
|
+
* - Otherwise renders the resolved child entity's generated fields inside their own
|
|
21
|
+
* `<mj-collapsible-panel>`.
|
|
22
|
+
* - When a saved record already has a persisted child of one subtype and `OnSubtypeChange` is
|
|
23
|
+
* `'Refuse'`, surfaces an inline warning if the user selects a conflicting subtype in edit mode.
|
|
24
|
+
*/
|
|
25
|
+
export declare class MjFoldedSubtypeSectionComponent extends BaseAngularComponent implements OnInit, DoCheck, OnDestroy {
|
|
26
|
+
readonly HostDisplay = "contents";
|
|
27
|
+
private readonly cdr;
|
|
28
|
+
private readonly hostElement;
|
|
29
|
+
private readonly fieldEdits;
|
|
30
|
+
private readonly recordRefresh;
|
|
31
|
+
private readonly chrome;
|
|
32
|
+
private readonly destroy$;
|
|
33
|
+
private recordEventSub;
|
|
34
|
+
private editModeSub;
|
|
35
|
+
private _record;
|
|
36
|
+
private _formComponent;
|
|
37
|
+
private _formContext;
|
|
38
|
+
private _editMode;
|
|
39
|
+
private reconcileToken;
|
|
40
|
+
private lastWatchSignature;
|
|
41
|
+
private mountedUIDriverRef;
|
|
42
|
+
private mountedUIDriverKey;
|
|
43
|
+
/** Dynamic host anchor when a custom `UIDriver` component replaces generated fields. */
|
|
44
|
+
set UIDriverHost(vcr: ViewContainerRef | undefined);
|
|
45
|
+
private _uiDriverHost;
|
|
46
|
+
set Record(value: BaseEntity | null);
|
|
47
|
+
get Record(): BaseEntity | null;
|
|
48
|
+
set FormComponent(value: BaseFormComponent | null);
|
|
49
|
+
get FormComponent(): BaseFormComponent | null;
|
|
50
|
+
set FormContext(value: FormContext | undefined);
|
|
51
|
+
get FormContext(): FormContext | undefined;
|
|
52
|
+
set EditMode(value: boolean);
|
|
53
|
+
get EditMode(): boolean;
|
|
54
|
+
readonly Navigate: EventEmitter<FormNavigationEvent>;
|
|
55
|
+
/** Resolved child record currently displayed in the folded section, if any. */
|
|
56
|
+
ActiveChildRecord: BaseEntity | null;
|
|
57
|
+
/** Resolved `UIDriver` registration key when a registered `EntitySubtypeUIDriverBase` matches. */
|
|
58
|
+
ActiveUIDriverKey: string | null;
|
|
59
|
+
/** Derived field descriptors when rendering generated `<mj-form-field>` controls. */
|
|
60
|
+
GeneratedFieldSpecs: SubtypeGeneratedFieldSpec[];
|
|
61
|
+
/** Non-null when a saved record's subtype change conflicts with `OnSubtypeChange: 'Refuse'`. */
|
|
62
|
+
RefusalWarningMessage: string | null;
|
|
63
|
+
/** True when either a `UIDriver`, generated child fields, or a refusal warning should render. */
|
|
64
|
+
get ShouldRenderSection(): boolean;
|
|
65
|
+
/** Whether `FoldIntoForm` is enabled on the bound parent entity. */
|
|
66
|
+
get IsFoldEnabled(): boolean;
|
|
67
|
+
/** Metadata for the active child entity, if any. */
|
|
68
|
+
get ActiveChildEntityInfo(): EntityInfo | null;
|
|
69
|
+
/** Stable `SectionKey` for `<mj-collapsible-panel>` state persistence & chrome routing. */
|
|
70
|
+
get SectionKey(): string;
|
|
71
|
+
/** Human-readable section title shown in the collapsible panel header. */
|
|
72
|
+
get SectionTitle(): string;
|
|
73
|
+
/** FontAwesome icon class for the collapsible panel header. */
|
|
74
|
+
get SectionIcon(): string;
|
|
75
|
+
/** Whether the active child itself opts into `FoldIntoForm` for multi-level IS-A chains. */
|
|
76
|
+
get HasNestedFoldedSubtype(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* CSS flex `order` placing the folded subtype section immediately after the parent
|
|
79
|
+
* entity's own field sections and before related-entity grids.
|
|
80
|
+
*/
|
|
81
|
+
get SectionOrder(): number | null;
|
|
82
|
+
ngOnInit(): void;
|
|
83
|
+
ngDoCheck(): void;
|
|
84
|
+
ngOnDestroy(): void;
|
|
85
|
+
/** Validates any mounted custom `UIDriver` component (async-capable). */
|
|
86
|
+
Validate(): ValidationResult | Promise<ValidationResult>;
|
|
87
|
+
/** Synchronous validation snapshot from any mounted custom `UIDriver` component. */
|
|
88
|
+
LastKnownValidation(): ValidationResult;
|
|
89
|
+
OnNavigate(event: FormNavigationEvent): void;
|
|
90
|
+
private bindRecordSubscription;
|
|
91
|
+
private teardownRecordSubscription;
|
|
92
|
+
private shouldReconcileForField;
|
|
93
|
+
private firstHopSelectorFieldName;
|
|
94
|
+
private computeWatchSignature;
|
|
95
|
+
private reconcileSubtype;
|
|
96
|
+
private findRegisteredUIDriverKey;
|
|
97
|
+
private applyResolvedState;
|
|
98
|
+
private syncMountedUIDriver;
|
|
99
|
+
private pushInputsToMountedUIDriver;
|
|
100
|
+
private destroyMountedUIDriver;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MjFoldedSubtypeSectionComponent, never>;
|
|
102
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MjFoldedSubtypeSectionComponent, "mj-folded-subtype-section", never, { "Record": { "alias": "Record"; "required": false; }; "FormComponent": { "alias": "FormComponent"; "required": false; }; "FormContext": { "alias": "FormContext"; "required": false; }; "EditMode": { "alias": "EditMode"; "required": false; }; }, { "Navigate": "Navigate"; }, never, never, false, never>;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=folded-subtype-section.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"folded-subtype-section.component.d.ts","sourceRoot":"","sources":["../../../src/lib/subtype-ui-driver/folded-subtype-section.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,OAAO,EAEP,YAAY,EAGZ,SAAS,EACT,MAAM,EAIN,gBAAgB,EAGnB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,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