@memberjunction/ng-base-forms 6.1.5 → 6.1.7
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.
|
@@ -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;
|
|
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;IAQjC,+CAA+C;IAC/C,cAAc,CAAC,KAAK,EAAE,8BAA8B,GAAG,IAAI;yCA3IhD,0BAA0B;2CAA1B,0BAA0B;CA8ItC"}
|
|
@@ -117,6 +117,23 @@ export class MjIsaRelatedPanelComponent extends BaseAngularComponent {
|
|
|
117
117
|
ngOnChanges(changes) {
|
|
118
118
|
if (changes['Record']) {
|
|
119
119
|
this.DiscoverRelatedItems();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Leaving edit mode is the OTHER moment this answer can change, and until now nothing
|
|
123
|
+
// re-asked. A save can ATTACH a subtype that did not exist when this panel last looked —
|
|
124
|
+
// IS-A writes parent and child in one transaction — and the form deliberately keeps the
|
|
125
|
+
// SAME record object across that save (EntityFormHostComponent's PrimaryKey setter skips
|
|
126
|
+
// the reload when the incoming key is just the now-saved PK), so `changes['Record']` never
|
|
127
|
+
// fires; and `FormRecordRefreshCoordinator.Notify()` is reached only from the Refresh
|
|
128
|
+
// button. The result was a panel that stayed empty on a record that plainly had a subtype
|
|
129
|
+
// until the user pressed Refresh.
|
|
130
|
+
//
|
|
131
|
+
// Re-discovering here is close to free on the common path: for a disjoint hierarchy
|
|
132
|
+
// DiscoverISADescendants walks the in-memory ISAChild chain and issues no query at all.
|
|
133
|
+
// An overlapping parent (AllowMultipleSubtypes) does load its child entities, so that
|
|
134
|
+
// configuration pays one extra discovery per edit session.
|
|
135
|
+
if (changes['EditMode'] && changes['EditMode'].previousValue === true && !this.EditMode) {
|
|
136
|
+
this.DiscoverRelatedItems();
|
|
120
137
|
}
|
|
121
138
|
}
|
|
122
139
|
/**
|
|
@@ -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,EAC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AAI,CAAC,aAAa,CAAC,CAAC;QAClF,MAAM,IAAI,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAC;QAC9C,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;qRA3HU,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 }\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;;;;;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,+CAA8B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AC,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-base-forms",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.7",
|
|
4
4
|
"description": "MemberJunction: Generic Angular form components for rendering and editing entity records. Provides configurable toolbar, modern form fields (native HTML, no PrimeNG dependency), collapsible panels with IS-A inheritance support, and event-driven navigation. Zero Explorer dependencies - usable in any Angular application.",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@angular/compiler": "21.2.22",
|
|
22
22
|
"@angular/compiler-cli": "21.2.22",
|
|
23
|
-
"@memberjunction/ng-test-utils": "6.1.
|
|
23
|
+
"@memberjunction/ng-test-utils": "6.1.7",
|
|
24
24
|
"vitest": "^4.0.18"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
"@angular/forms": "^21.2.22"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@memberjunction/core": "6.1.
|
|
34
|
-
"@memberjunction/core-entities": "6.1.
|
|
35
|
-
"@memberjunction/global": "6.1.
|
|
36
|
-
"@memberjunction/interactive-component-types": "6.1.
|
|
37
|
-
"@memberjunction/ng-base-types": "6.1.
|
|
38
|
-
"@memberjunction/ng-code-editor": "6.1.
|
|
39
|
-
"@memberjunction/ng-entity-viewer": "6.1.
|
|
40
|
-
"@memberjunction/ng-file-storage": "6.1.
|
|
41
|
-
"@memberjunction/ng-list-management": "6.1.
|
|
42
|
-
"@memberjunction/ng-markdown": "6.1.
|
|
43
|
-
"@memberjunction/ng-notifications": "6.1.
|
|
44
|
-
"@memberjunction/ng-react": "6.1.
|
|
45
|
-
"@memberjunction/ng-record-changes": "6.1.
|
|
46
|
-
"@memberjunction/ng-record-tags": "6.1.
|
|
47
|
-
"@memberjunction/ng-shared-generic": "6.1.
|
|
48
|
-
"@memberjunction/ng-ui-components": "6.1.
|
|
33
|
+
"@memberjunction/core": "6.1.7",
|
|
34
|
+
"@memberjunction/core-entities": "6.1.7",
|
|
35
|
+
"@memberjunction/global": "6.1.7",
|
|
36
|
+
"@memberjunction/interactive-component-types": "6.1.7",
|
|
37
|
+
"@memberjunction/ng-base-types": "6.1.7",
|
|
38
|
+
"@memberjunction/ng-code-editor": "6.1.7",
|
|
39
|
+
"@memberjunction/ng-entity-viewer": "6.1.7",
|
|
40
|
+
"@memberjunction/ng-file-storage": "6.1.7",
|
|
41
|
+
"@memberjunction/ng-list-management": "6.1.7",
|
|
42
|
+
"@memberjunction/ng-markdown": "6.1.7",
|
|
43
|
+
"@memberjunction/ng-notifications": "6.1.7",
|
|
44
|
+
"@memberjunction/ng-react": "6.1.7",
|
|
45
|
+
"@memberjunction/ng-record-changes": "6.1.7",
|
|
46
|
+
"@memberjunction/ng-record-tags": "6.1.7",
|
|
47
|
+
"@memberjunction/ng-shared-generic": "6.1.7",
|
|
48
|
+
"@memberjunction/ng-ui-components": "6.1.7",
|
|
49
49
|
"rxjs": "^7.8.2",
|
|
50
50
|
"tslib": "^2.8.1"
|
|
51
51
|
},
|