@memberjunction/ng-base-forms 5.34.1 → 5.36.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.
@@ -1 +1 @@
1
- {"version":3,"file":"base-form-component.d.ts","sourceRoot":"","sources":["../../src/lib/base-form-component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,MAAM,EAAE,SAAS,EAClB,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAC9C,YAAY,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,oBAAoB,EAC9D,sBAAsB,EAAE,oBAAoB,EAAE,iCAAiC,EACrE,aAAa,EACvB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;;AAExD;;;;;;;;;;;;;;;GAeG;AACH,8BACsB,iBAAkB,SAAQ,mBAAoB,YAAW,aAAa,EAAE,MAAM,EAAE,SAAS;IACtG,QAAQ,EAAE,OAAO,CAAS;IAC1B,gBAAgB,EAAE,OAAO,CAAS;IAClC,mBAAmB,EAAE,OAAO,CAAS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AAiB,IAAI,IAAI;IAOzB,qBAAqB,IAAI,OAAO;IAQhC,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAUzD;;;;OAIG;IACI,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI;IAIvD;;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB/C;;;OAGG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;;OAGG;IACI,kBAAkB,IAAI,IAAI;IAIjC;;;OAGG;IACI,yBAAyB,IAAI,IAAI;yCA55BpB,iBAAiB;2CAAjB,iBAAiB;CAk6BtC"}
@@ -579,11 +579,17 @@ export class BaseFormComponent extends BaseRecordComponent {
579
579
  return this.sectionMap.get(sectionKey);
580
580
  }
581
581
  IsSectionExpanded(sectionKey, defaultExpanded) {
582
+ const section = this.sectionMap.get(sectionKey);
583
+ // When the caller doesn't pass an explicit default, fall back to the value seeded by
584
+ // initSections() — related-entity and System Metadata panels are seeded collapsed there.
585
+ // Without this, FormStateService falls back to its global DEFAULT_SECTION_STATE (isExpanded=true),
586
+ // which reports a never-before-visited related-entity panel as expanded and causes its data grid
587
+ // (bound [AllowLoad]="IsSectionExpanded(key)") to fetch on form open even while the panel is collapsed.
588
+ const resolvedDefault = defaultExpanded !== undefined ? defaultExpanded : section?.isExpanded;
582
589
  const entityName = this.getEntityName();
583
590
  if (entityName) {
584
- return this.formStateService.isSectionExpanded(entityName, sectionKey, defaultExpanded);
591
+ return this.formStateService.isSectionExpanded(entityName, sectionKey, resolvedDefault);
585
592
  }
586
- const section = this.sectionMap.get(sectionKey);
587
593
  return section ? section.isExpanded : (defaultExpanded !== undefined ? defaultExpanded : true);
588
594
  }
589
595
  SetSectionExpanded(sectionKey, isExpanded) {
@@ -1 +1 @@
1
- {"version":3,"file":"base-form-component.js","sourceRoot":"","sources":["../../src/lib/base-form-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAC6B,SAAS,EAC3C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AE,CAAC;YACX,MAAM,QAAQ,GAAG,yBAAyB,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB;QAC5B,MAAM,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,yBAAyB;QAC9B,4DAA4D;QAC5D,mEAAmE;IACrE,CAAC;iPAz5BmB,iBAAiB,yBAAjB,iBAAiB;6DAAjB,iBAAiB;2BAgFvB,2BAA2B;;;;;;iFAhFrB,iBAAiB;cADtC,SAAS;;kBAiDP,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAON,MAAM;;kBAON,YAAY;mBAAC,2BAA2B","sourcesContent":["import {\n AfterViewInit, OnInit, OnDestroy, Directive,\n ViewChildren, QueryList, ElementRef, ChangeDetectorRef,\n Output, EventEmitter, inject\n} from '@angular/core';\n\nimport { Subject, Subscription, debounceTime } from 'rxjs';\nimport {\n EntityInfo, ValidationResult, BaseEntity, EntityPermissionType,\n EntityRelationshipInfo, EntityOrganicKeyInfo, EntityOrganicKeyRelatedEntityInfo,\n Metadata, RunViewParams, LogError,\n RecordDependency, BaseEntityEvent, CompositeKey, RunView, RunViewResult\n} from '@memberjunction/core';\nimport { MJEventType, MJGlobal, ValidationErrorInfo } from '@memberjunction/global';\nimport { FormEditingCompleteEvent, PendingRecordItem, BaseFormComponentEventCodes } from '@memberjunction/ng-base-types';\nimport { MJListEntity } from '@memberjunction/core-entities';\n\nimport { BaseRecordComponent } from './base-record-component';\nimport { BaseFormSectionInfo } from './base-form-section-info';\nimport { MjCollapsiblePanelComponent } from './panel/collapsible-panel.component';\nimport { FormNavigationEvent } from './types/navigation-events';\nimport {\n FormContext,\n FormNotificationEvent,\n RecordSavedEvent,\n RecordDeletedEvent,\n RecordSaveFailedEvent,\n RecordDeleteFailedEvent,\n ValidationFailedEvent\n} from './types/form-types';\nimport { FormStateService } from './form-state.service';\n\n/**\n * Abstract base class for all entity record forms in MemberJunction.\n *\n * Generated forms (via CodeGen) and custom forms extend this class.\n * It provides core form logic — section management, validation, pending records,\n * permissions, favorites, related entity helpers — with ZERO Explorer dependencies.\n *\n * Instead of calling Explorer services directly, events are emitted via @Output:\n * - **Navigate**: Form navigation requests (record links, new records, external links)\n * - **Notification**: User-facing notifications (save success, validation errors, etc.)\n * - **RecordSaved**: Emitted after a successful save\n * - **RecordDeleted**: Emitted after a successful delete\n *\n * The host application (e.g. SingleRecordComponent in Explorer) subscribes to\n * these events and maps them to its own services (NavigationService, SharedService, etc.).\n */\n@Directive()\nexport abstract class BaseFormComponent extends BaseRecordComponent implements AfterViewInit, OnInit, OnDestroy {\n public EditMode: boolean = false;\n public FavoriteInitDone: boolean = false;\n public isHistoryDialogOpen: boolean = false;\n public IsTagsPanelOpen: boolean = false;\n public TagCount: number = 0;\n public showDeleteDialog: boolean = false;\n public showCreateDialog: boolean = false;\n\n /**\n * Height of the top area when a splitter layout is used.\n * Referenced by CodeGen-generated templates for entities with \"top area\" sections.\n */\n public TopAreaHeight: string = '300px';\n\n /**\n * Size of the top area as a percentage (0-100) for angular-split.\n * Used by CodeGen-generated templates with as-split.\n */\n public TopAreaSize: number = 40;\n\n /**\n * Size of the bottom area as a percentage (0-100) for angular-split.\n * Used by CodeGen-generated templates with as-split.\n */\n public BottomAreaSize: number = 60;\n\n /**\n * Called when the splitter layout changes (for entities with \"top area\" sections).\n * No-op in the generic version; override in host application if splitter resizing is needed.\n */\n public splitterLayoutChange(): void {\n // No-op — host application can override\n }\n\n private _pendingRecords: PendingRecordItem[] = [];\n\n // #region Injected Dependencies (no constructor params)\n\n protected elementRef = inject(ElementRef);\n public cdr = inject(ChangeDetectorRef);\n protected formStateService = inject(FormStateService);\n\n // #endregion\n\n // #region @Output Events\n\n /** Emitted when navigation is requested (record link, external link, email, new record, etc.) */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n /** Emitted when a user-facing notification should be shown */\n @Output() Notification = new EventEmitter<FormNotificationEvent>();\n\n /** Emitted after a record is saved successfully */\n @Output() RecordSaved = new EventEmitter<RecordSavedEvent>();\n\n /** Emitted after a record is deleted successfully */\n @Output() RecordDeleted = new EventEmitter<RecordDeletedEvent>();\n\n /** Emitted when a record save fails */\n @Output() RecordSaveFailed = new EventEmitter<RecordSaveFailedEvent>();\n\n /** Emitted when a record delete fails */\n @Output() RecordDeleteFailed = new EventEmitter<RecordDeleteFailedEvent>();\n\n /** Emitted when validation fails before save */\n @Output() ValidationFailed = new EventEmitter<ValidationFailedEvent>();\n\n /**\n * Emitted once after ngOnInit completes and the record is fully initialized\n * (favorites loaded, form state initialized). This is the safe point for\n * the container to start loading badge counts and other record-dependent data.\n */\n @Output() RecordReady = new EventEmitter<BaseEntity>();\n\n // #endregion\n\n /** Subscription to form state changes */\n private formStateSubscription?: Subscription;\n\n @ViewChildren(MjCollapsiblePanelComponent) collapsiblePanels!: QueryList<MjCollapsiblePanelComponent>;\n\n async ngOnInit() {\n if (this.record) {\n if (!this.record.IsSaved) {\n this.StartEditMode();\n }\n const md = this.ProviderToUse;\n // Bind FormStateService to the same provider this form is using.\n this.formStateService.Provider = md;\n this._isFavorite = await md.GetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey);\n this.FavoriteInitDone = true;\n\n // Initialize form state from User Settings\n const entityName = this.getEntityName();\n if (entityName) {\n await this.formStateService.initializeState(entityName);\n this.formStateSubscription = this.formStateService.getState$(entityName).subscribe(state => {\n this.showEmptyFields = state.showEmptyFields;\n this.cdr.markForCheck();\n });\n }\n }\n\n // Signal that the record is fully initialized and ready for dependent operations\n if (this.record) {\n this.RecordReady.emit(this.record);\n }\n\n // Set up debounced filter subscription\n this.filterSubscription = this.filterSubject\n .pipe(debounceTime(100))\n .subscribe(searchTerm => {\n this.searchFilter = searchTerm;\n // After change detection propagates FormContext to panels and they update\n // their IsVisible state, expand any visible (matching) sections that are collapsed\n if (searchTerm) {\n Promise.resolve().then(() => this.expandMatchingSections());\n }\n });\n }\n\n ngAfterViewInit(): void {\n // Subclasses can override for post-view-init logic\n }\n\n ngOnDestroy(): void {\n if (this.filterSubscription) {\n this.filterSubscription.unsubscribe();\n }\n if (this.formStateSubscription) {\n this.formStateSubscription.unsubscribe();\n }\n }\n\n // #region Pending Records\n\n protected get PendingRecords(): PendingRecordItem[] {\n return this._pendingRecords;\n }\n\n protected PendingRecordsDirty(): boolean {\n this.PopulatePendingRecords();\n const pendingRecords = this.PendingRecords;\n if (pendingRecords && pendingRecords.length > 0) {\n for (const p of pendingRecords) {\n if (p.action === 'delete')\n return true;\n else if (p.entityObject.Dirty)\n return true;\n }\n }\n return false;\n }\n\n protected PopulatePendingRecords() {\n this._pendingRecords = [];\n this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE);\n const result = this.RaiseEvent(BaseFormComponentEventCodes.POPULATE_PENDING_RECORDS);\n if (result && result.pendingChanges) {\n for (const p of result.pendingChanges)\n this.PendingRecords.push(p);\n }\n }\n\n protected ValidatePendingRecords(): ValidationResult[] {\n const results: ValidationResult[] = [];\n for (let i = 0; i < this._pendingRecords.length; i++) {\n const pendingRecord = this._pendingRecords[i];\n results.push(pendingRecord.entityObject.Validate());\n }\n return results;\n }\n\n // #endregion\n\n // #region Edit Mode\n\n public StartEditMode(): void {\n this.EditMode = true;\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setEditMode(entityName, true);\n }\n }\n\n public EndEditMode(): void {\n this.EditMode = false;\n this.clearValidationState();\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setEditMode(entityName, false);\n }\n }\n\n public handleHistoryDialog(): void {\n this.isHistoryDialogOpen = !this.isHistoryDialogOpen;\n }\n\n public HandleTagsPanel(): void {\n this.IsTagsPanelOpen = !this.IsTagsPanelOpen;\n }\n\n // #endregion\n\n // #region Core Form Operations\n\n public Validate(): ValidationResult {\n const valResults = (<BaseEntity>this.record).Validate();\n const pendingValResults = this.ValidatePendingRecords();\n for (let i = 0; i < pendingValResults.length; i++) {\n const pendingValResult = pendingValResults[i];\n if (!pendingValResult.Success) {\n valResults.Success = false;\n valResults.Errors.push(...pendingValResult.Errors);\n }\n }\n return valResults;\n }\n\n protected RaiseEvent(eventCode: BaseFormComponentEventCodes) {\n const event = new FormEditingCompleteEvent();\n event.elementRef = this.elementRef;\n event.subEventCode = eventCode;\n\n MJGlobal.Instance.RaiseEvent({\n event: MJEventType.ComponentEvent,\n component: this,\n eventCode: BaseFormComponentEventCodes.BASE_CODE,\n args: event\n });\n\n return event;\n }\n\n public async SaveRecord(StopEditModeAfterSave: boolean): Promise<boolean> {\n try {\n try {\n (document.activeElement as HTMLElement).blur();\n this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE);\n } catch (_e) {\n // ignore blur errors\n }\n\n if (this.record) {\n this.PopulatePendingRecords();\n const valResults = this.Validate();\n if (valResults.Success) {\n const result = await this.InternalSaveRecord();\n if (result) {\n this._pendingRecords = [];\n this.clearValidationState();\n if (StopEditModeAfterSave)\n this.EndEditMode();\n\n this.Notification.emit({ Message: 'Record saved successfully', Type: 'success', Duration: 2500 });\n this.RecordSaved.emit({\n EntityName: this.record.EntityInfo.Name,\n RecordId: this.record.PrimaryKey.ToString(),\n Result: { Success: true }\n });\n return true;\n } else {\n const serverMsg = this.record.LatestResult?.Message || '';\n const errorMsg = serverMsg ? `Save failed: ${serverMsg}` : 'Error saving record';\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordSaveFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n } else {\n // Broadcast validation errors to all fields via FormContext\n this._showValidation = true;\n this._validationErrors = valResults.Errors;\n this.cdr.markForCheck();\n\n const errorMessages = valResults.Errors.map(x => x.Message);\n this.Notification.emit({\n Message: 'Validation Errors\\n' + errorMessages.join('\\n'),\n Type: 'warning',\n Duration: 5000\n });\n this.ValidationFailed.emit({ EntityName: this.record.EntityInfo.Name, Errors: errorMessages });\n }\n }\n\n LogError(\"Could not save record: Record not found\");\n return false;\n } catch (e) {\n const errorMsg = 'Error saving record: ' + e;\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n if (this.record) {\n this.RecordSaveFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n return false;\n }\n }\n\n public CancelEdit() {\n if (this.record) {\n const r = <BaseEntity>this.record;\n if (r.Dirty || this.PendingRecordsDirty()) {\n // Revert is safe here — the toolbar's discard dialog already confirmed with the user\n r.Revert();\n\n const pendingRecords = this.PendingRecords;\n if (pendingRecords && pendingRecords.length > 0) {\n pendingRecords.forEach(p => {\n if (p.action === 'save')\n p.entityObject.Revert();\n });\n }\n this.RaiseEvent(BaseFormComponentEventCodes.REVERT_PENDING_CHANGES);\n }\n this.EndEditMode();\n }\n }\n\n protected async InternalSaveRecord(): Promise<boolean> {\n if (this.record) {\n if (this._pendingRecords.length > 0) {\n const md = this.ProviderToUse;\n const tg = await md.CreateTransactionGroup();\n this.record.TransactionGroup = tg;\n await this.record.Save();\n\n for (const x of this._pendingRecords) {\n x.entityObject.TransactionGroup = tg;\n if (x.action === 'save') {\n await x.entityObject.Save();\n } else {\n await x.entityObject.Delete();\n }\n }\n return await tg.Submit();\n } else {\n return await this.record.Save();\n }\n } else {\n return false;\n }\n }\n\n public async Wait(duration: number): Promise<void> {\n return new Promise<void>(resolve => setTimeout(resolve, duration));\n }\n\n // #endregion\n\n // #region Permissions\n\n private _userPermissions: { permission: EntityPermissionType; canDo: boolean }[] = [];\n\n public CheckUserPermission(type: EntityPermissionType): boolean {\n try {\n if (this.record) {\n const perm = this._userPermissions.find(x => x.permission === type);\n if (perm)\n return perm.canDo;\n else {\n const result = this.record.CheckPermissions(type, false);\n this._userPermissions.push({ permission: type, canDo: result });\n return result;\n }\n } else {\n return false;\n }\n } catch (e) {\n LogError(e);\n return false;\n }\n }\n\n public get UserCanEdit(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Update);\n }\n\n public get UserCanRead(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Read);\n }\n\n public get UserCanCreate(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Create);\n }\n\n public get UserCanDelete(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Delete);\n }\n\n // #endregion\n\n // #region Grid Edit Mode\n\n public GridEditMode(): \"None\" | \"Save\" | \"Queue\" {\n return this.EditMode ? \"Queue\" : \"None\";\n }\n\n // #endregion\n\n // #region Favorites\n\n private _isFavorite: boolean = false;\n\n public get IsFavorite(): boolean {\n return this._isFavorite;\n }\n\n public async RemoveFavorite(): Promise<void> {\n return this.SetFavoriteStatus(false);\n }\n\n public async MakeFavorite(): Promise<void> {\n return this.SetFavoriteStatus(true);\n }\n\n public async SetFavoriteStatus(isFavorite: boolean) {\n const md = this.ProviderToUse;\n await md.SetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey, isFavorite, md.CurrentUser);\n this._isFavorite = isFavorite;\n }\n\n // #endregion\n\n // #region Related Entity Helpers\n\n public BuildRelationshipViewParams(item: EntityRelationshipInfo): RunViewParams {\n return EntityInfo.BuildRelationshipViewParams(this.record, item);\n }\n\n public BuildRelationshipViewParamsByEntityName(relatedEntityName: string, relatedEntityJoinField?: string): RunViewParams {\n const eri = this.GetEntityRelationshipByRelatedEntityName(relatedEntityName, relatedEntityJoinField);\n if (eri)\n return this.BuildRelationshipViewParams(eri);\n else\n return {};\n }\n\n public GetEntityRelationshipByRelatedEntityName(relatedEntityName: string, relatedEntityJoinField?: string): EntityRelationshipInfo | undefined {\n if (this.record) {\n const r = <BaseEntity>this.record;\n const ret = r.EntityInfo.RelatedEntities.filter(x => x.RelatedEntity.trim().toLowerCase() === relatedEntityName.trim().toLowerCase());\n if (ret.length > 1 && relatedEntityJoinField) {\n const ret2 = ret.find(x => x.RelatedEntityJoinField.trim().toLowerCase() === relatedEntityJoinField.trim().toLowerCase());\n if (ret2)\n return ret2;\n } else if (ret.length === 1) {\n return ret[0];\n } else {\n return undefined;\n }\n }\n return undefined;\n }\n\n public NewRecordValues(relatedEntityName: string): Record<string, unknown> {\n const eri = this.GetEntityRelationshipByRelatedEntityName(relatedEntityName);\n if (eri)\n return this.NewRecordValuesByEntityRelationship(eri);\n else\n return {};\n }\n\n public NewRecordValuesByEntityRelationship(item: EntityRelationshipInfo): Record<string, unknown> {\n return EntityInfo.BuildRelationshipNewRecordValues(this.record, item);\n }\n\n public GetRelatedEntityTabDisplayName(relatedEntityName: string): string {\n if (this.record) {\n const eri = (<BaseEntity>this.record).EntityInfo.RelatedEntities.find(x => x.RelatedEntity === relatedEntityName);\n if (eri)\n return eri.DisplayName;\n }\n return relatedEntityName;\n }\n\n public get HasRelatedEntities(): boolean {\n if (this.record) {\n const relatedEntities = (<BaseEntity>this.record).EntityInfo.RelatedEntities;\n return relatedEntities && relatedEntities.length > 0;\n }\n return false;\n }\n\n // #endregion\n\n // #region Organic Key Helpers\n\n /**\n * Returns all active organic keys for the current entity, or an empty array if none.\n */\n public get OrganicKeys(): EntityOrganicKeyInfo[] {\n if (this.record) {\n return (<BaseEntity>this.record).EntityInfo.OrganicKeys || [];\n }\n return [];\n }\n\n /**\n * Whether the current entity has any active organic keys with related entities configured.\n */\n public get HasOrganicKeys(): boolean {\n return this.OrganicKeys.some(ok => ok.RelatedEntities.length > 0);\n }\n\n /**\n * Returns all organic key related entities across all organic keys, flattened and sorted.\n */\n public get AllOrganicKeyRelatedEntities(): { OrganicKey: EntityOrganicKeyInfo; RelatedEntity: EntityOrganicKeyRelatedEntityInfo }[] {\n const result: { OrganicKey: EntityOrganicKeyInfo; RelatedEntity: EntityOrganicKeyRelatedEntityInfo }[] = [];\n for (const ok of this.OrganicKeys) {\n for (const re of ok.RelatedEntities) {\n result.push({ OrganicKey: ok, RelatedEntity: re });\n }\n }\n return result;\n }\n\n /**\n * Builds RunViewParams for a specific organic key related entity.\n */\n public BuildOrganicKeyViewParams(\n organicKeyRelatedEntity: EntityOrganicKeyRelatedEntityInfo,\n organicKey: EntityOrganicKeyInfo\n ): RunViewParams {\n if (this.record) {\n return EntityInfo.BuildOrganicKeyViewParams(this.record, organicKeyRelatedEntity, organicKey);\n }\n return {};\n }\n\n /**\n * Convenience method to build organic key view params by organic key name and related entity name.\n */\n public BuildOrganicKeyViewParamsByNames(organicKeyName: string, relatedEntityName: string): RunViewParams {\n const ok = this.OrganicKeys.find(k => k.Name.trim().toLowerCase() === organicKeyName.trim().toLowerCase());\n if (ok) {\n const re = ok.RelatedEntities.find(r => r.RelatedEntity.trim().toLowerCase() === relatedEntityName.trim().toLowerCase());\n if (re) {\n return this.BuildOrganicKeyViewParams(re, ok);\n }\n }\n return {};\n }\n\n // #endregion\n\n // #region Entity Info & Dependencies\n\n public get EntityInfo(): EntityInfo | undefined {\n try {\n const r = <BaseEntity>this.record;\n if (r)\n return r.EntityInfo;\n else\n return undefined;\n } catch (e) {\n LogError(e);\n return undefined;\n }\n }\n\n public async ShowDependencies() {\n const md = this.ProviderToUse;\n const dep = await md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.PrimaryKey);\n console.log('Dependencies for: ' + this.record.EntityInfo.Name + ' ' + this.record.PrimaryKey.ToString());\n console.log(dep);\n }\n\n public ShowChanges(): void {\n if (this.record) {\n const changes = this.record.GetAll(false, true);\n const oldValues = this.record.GetAll(true, true);\n const message =\n 'Changes for: ' + this.record.EntityInfo.Name + ' ' + this.record.PrimaryKey.ToString() +\n '\\n\\n' + JSON.stringify(changes, null, 2) +\n '\\n\\nOld Values\\n\\n' + JSON.stringify(oldValues, null, 2);\n console.log(message);\n this.Notification.emit({ Message: message, Type: 'info', Duration: 30000 });\n }\n }\n\n public async GetListsCanAddTo(): Promise<MJListEntity[]> {\n if (!this.record) {\n LogError('Unable to fetch List records: Record not found');\n return [];\n }\n\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const md = this.ProviderToUse;\n\n const rvResult: RunViewResult<MJListEntity> = await rv.RunView({\n EntityName: 'MJ: Lists',\n ExtraFilter: `UserID = '${md.CurrentUser.ID}' AND EntityID = '${this.record.EntityInfo.ID}'`,\n ResultType: 'entity_object'\n });\n\n if (!rvResult.Success) {\n LogError('Error running view to fetch lists', undefined, rvResult.ErrorMessage);\n return [];\n }\n\n return rvResult.Results;\n }\n\n public async GetRecordDependencies(): Promise<RecordDependency[]> {\n const md = this.ProviderToUse;\n const dependencies: RecordDependency[] = await md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.PrimaryKey);\n return dependencies;\n }\n\n // #endregion\n\n // #region Collapsible Section Management\n\n protected sections: BaseFormSectionInfo[] = [];\n private sectionMap: Map<string, BaseFormSectionInfo> = new Map();\n\n public searchFilter: string = '';\n public showEmptyFields: boolean = false;\n\n /** Whether to show all validation errors on fields (set after save failure) */\n private _showValidation = false;\n /** Validation errors from the most recent failed save attempt */\n private _validationErrors: ValidationErrorInfo[] = [];\n\n public get formContext(): FormContext {\n return {\n sectionFilter: this.searchFilter,\n showEmptyFields: this.showEmptyFields,\n showValidation: this._showValidation,\n validationErrors: this._validationErrors\n };\n }\n\n /** Clears all validation display state (called on save success, cancel, end edit) */\n private clearValidationState(): void {\n this._showValidation = false;\n this._validationErrors = [];\n }\n\n private filterSubject = new Subject<string>();\n private filterSubscription?: Subscription;\n\n protected initSections(sections: (BaseFormSectionInfo | { sectionKey: string; sectionName: string; isExpanded: boolean; rowCount?: number; metadata?: unknown })[]): void {\n this.sections = sections.map(s =>\n s instanceof BaseFormSectionInfo\n ? s\n : new BaseFormSectionInfo(s.sectionKey, s.sectionName, s.isExpanded, s.rowCount, s.metadata)\n );\n this.sectionMap.clear();\n this.sections.forEach(section => {\n this.sectionMap.set(section.sectionKey, section);\n });\n }\n\n protected getSection(sectionKey: string): BaseFormSectionInfo | undefined {\n return this.sectionMap.get(sectionKey);\n }\n\n public IsSectionExpanded(sectionKey: string, defaultExpanded?: boolean): boolean {\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.isSectionExpanded(entityName, sectionKey, defaultExpanded);\n }\n const section = this.sectionMap.get(sectionKey);\n return section ? section.isExpanded : (defaultExpanded !== undefined ? defaultExpanded : true);\n }\n\n public SetSectionExpanded(sectionKey: string, isExpanded: boolean): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionExpanded(entityName, sectionKey, isExpanded);\n }\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.isExpanded = isExpanded;\n }\n }\n\n public GetSectionRowCount(sectionKey: string): number | undefined {\n const section = this.sectionMap.get(sectionKey);\n return section?.rowCount;\n }\n\n public SetSectionRowCount(sectionKey: string, rowCount: number): void {\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.rowCount = rowCount;\n }\n }\n\n public GetSectionPanelHeight(sectionKey: string): number | undefined {\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.getSectionPanelHeight(entityName, sectionKey);\n }\n return undefined;\n }\n\n public SetSectionPanelHeight(sectionKey: string, height: number): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionPanelHeight(entityName, sectionKey, height);\n }\n }\n\n public toggleSection(sectionKey: string): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.toggleSection(entityName, sectionKey);\n }\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.isExpanded = !section.isExpanded;\n }\n }\n\n /**\n * Expand any sections that are visible (match the current filter) but currently collapsed.\n * Called after filter changes so the user can immediately see matching content.\n */\n private expandMatchingSections(): void {\n if (!this.collapsiblePanels) return;\n this.collapsiblePanels.forEach(panel => {\n if (panel.IsVisible && !panel.Expanded) {\n this.SetSectionExpanded(panel.SectionKey, true);\n }\n });\n }\n\n public expandAllSections(): void {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n this.formStateService.expandAllSections(entityName, sectionKeys);\n }\n this.sections.forEach(section => {\n section.isExpanded = true;\n });\n }\n\n public collapseAllSections(): void {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n this.formStateService.collapseAllSections(entityName, sectionKeys);\n }\n this.sections.forEach(section => {\n section.isExpanded = false;\n });\n }\n\n public getExpandedCount(): number {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n return this.formStateService.getExpandedCount(entityName, sectionKeys);\n }\n return this.sections.filter(section => section.isExpanded).length;\n }\n\n public getVisibleSectionCount(): number {\n if (!this.collapsiblePanels || this.collapsiblePanels.length === 0) {\n return this.sections.length;\n }\n return this.collapsiblePanels.filter(panel => panel.IsVisible).length;\n }\n\n public getTotalSectionCount(): number {\n return this.sections.length;\n }\n\n public onFilterChange(searchTerm: string): void {\n this.filterSubject.next(searchTerm);\n }\n\n public getEntityName(): string {\n return this.record?.EntityInfo?.Name || '';\n }\n\n /**\n * Component-level default width mode, used when the user has NOT\n * explicitly chosen a width for this entity yet (first visit, nothing\n * persisted in User Settings). Subclasses can override this — for\n * example, custom forms with full-bleed layouts should return\n * `'full-width'` here and the container will respect it on first open.\n *\n * Once the user toggles the width via the toolbar, their choice\n * persists via `setFormWidthMode()` and takes priority over this\n * default on subsequent opens.\n */\n public getDefaultFormWidthMode(): 'centered' | 'full-width' {\n return 'centered';\n }\n\n public getFormWidthMode(): 'centered' | 'full-width' {\n const entityName = this.getEntityName();\n if (entityName && this.formStateService.hasExplicitWidthMode(entityName)) {\n return this.formStateService.getWidthMode(entityName);\n }\n return this.getDefaultFormWidthMode();\n }\n\n public setFormWidthMode(widthMode: 'centered' | 'full-width'): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setWidthMode(entityName, widthMode);\n }\n }\n\n public toggleFormWidthMode(): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.toggleWidthMode(entityName);\n }\n }\n\n // #endregion\n\n // #region Section Ordering\n\n public getSectionOrder(): string[] {\n const entityName = this.getEntityName();\n if (entityName) {\n const customOrder = this.formStateService.getSectionOrder(entityName);\n if (customOrder && customOrder.length > 0) {\n return customOrder;\n }\n }\n return this.sections.map(s => s.sectionKey);\n }\n\n public setSectionOrder(sectionOrder: string[]): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionOrder(entityName, sectionOrder);\n }\n }\n\n public resetSectionOrder(): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.resetSectionOrder(entityName);\n }\n }\n\n public hasCustomSectionOrder(): boolean {\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.hasCustomSectionOrder(entityName);\n }\n return false;\n }\n\n public getSectionDisplayOrder(sectionKey: string): number {\n const order = this.getSectionOrder();\n const index = order.indexOf(sectionKey);\n return index >= 0 ? index : this.sections.length;\n }\n\n // #endregion\n\n // #region Form Container Event Handlers\n\n /**\n * Handles navigation events from the form container and related entity grids.\n * Relays the event upward via the Navigate @Output for the host application to handle.\n * Generated form templates bind this as: (Navigate)=\"OnFormNavigate($event)\"\n */\n public OnFormNavigate(event: FormNavigationEvent): void {\n this.Navigate.emit(event);\n }\n\n /**\n * Handles delete requests from the form container.\n * Emits RecordDeleted on success, RecordDeleteFailed on failure.\n * Generated form templates bind this as: (DeleteRequested)=\"OnDeleteRequested()\"\n */\n public async OnDeleteRequested(): Promise<void> {\n if (!this.record || !this.record.IsSaved) return;\n try {\n const result = await this.record.Delete();\n if (result) {\n this.Notification.emit({ Message: 'Record deleted successfully', Type: 'success', Duration: 2500 });\n this.RecordDeleted.emit({\n EntityName: this.record.EntityInfo.Name,\n RecordId: this.record.PrimaryKey.ToString()\n });\n } else {\n const errorMsg = 'Error deleting record';\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordDeleteFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n } catch (e) {\n const errorMsg = 'Error deleting record: ' + e;\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordDeleteFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n }\n\n /**\n * Handles favorite toggle from the form container.\n * Generated form templates bind this as: (FavoriteToggled)=\"OnFavoriteToggled()\"\n */\n public async OnFavoriteToggled(): Promise<void> {\n await this.SetFavoriteStatus(!this.IsFavorite);\n }\n\n /**\n * Handles history view requests from the form container.\n * Generated form templates bind this as: (HistoryRequested)=\"OnHistoryRequested()\"\n */\n public OnHistoryRequested(): void {\n this.handleHistoryDialog();\n }\n\n /**\n * Handles list management requests from the form container.\n * Generated form templates bind this as: (ListManagementRequested)=\"OnListManagementRequested()\"\n */\n public OnListManagementRequested(): void {\n // List management dialog is handled by the host application\n // Subclasses can override this to implement custom list management\n }\n\n // #endregion\n}\n"]}
1
+ {"version":3,"file":"base-form-component.js","sourceRoot":"","sources":["../../src/lib/base-form-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAC6B,SAAS,EAC3C,YAAY,EAAa,UAAU,EAAE,iBAAiB,EACtD,MAAM,EAAE,YAAY,EAAE,MAAM,EAC7B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAgB,YAAY,EAAE,MAAM,MAAM,CAAC;AAC3D,OAAO,EACL,UAAU,EAAgC,oB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YACX,MAAM,QAAQ,GAAG,yBAAyB,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7E,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC;QACpG,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB;QAC5B,MAAM,IAAI,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,yBAAyB;QAC9B,4DAA4D;QAC5D,mEAAmE;IACrE,CAAC;iPA/5BmB,iBAAiB,yBAAjB,iBAAiB;6DAAjB,iBAAiB;2BAgFvB,2BAA2B;;;;;;iFAhFrB,iBAAiB;cADtC,SAAS;;kBAiDP,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAGN,MAAM;;kBAON,MAAM;;kBAON,YAAY;mBAAC,2BAA2B","sourcesContent":["import {\n AfterViewInit, OnInit, OnDestroy, Directive,\n ViewChildren, QueryList, ElementRef, ChangeDetectorRef,\n Output, EventEmitter, inject\n} from '@angular/core';\n\nimport { Subject, Subscription, debounceTime } from 'rxjs';\nimport {\n EntityInfo, ValidationResult, BaseEntity, EntityPermissionType,\n EntityRelationshipInfo, EntityOrganicKeyInfo, EntityOrganicKeyRelatedEntityInfo,\n Metadata, RunViewParams, LogError,\n RecordDependency, BaseEntityEvent, CompositeKey, RunView, RunViewResult\n} from '@memberjunction/core';\nimport { MJEventType, MJGlobal, ValidationErrorInfo } from '@memberjunction/global';\nimport { FormEditingCompleteEvent, PendingRecordItem, BaseFormComponentEventCodes } from '@memberjunction/ng-base-types';\nimport { MJListEntity } from '@memberjunction/core-entities';\n\nimport { BaseRecordComponent } from './base-record-component';\nimport { BaseFormSectionInfo } from './base-form-section-info';\nimport { MjCollapsiblePanelComponent } from './panel/collapsible-panel.component';\nimport { FormNavigationEvent } from './types/navigation-events';\nimport {\n FormContext,\n FormNotificationEvent,\n RecordSavedEvent,\n RecordDeletedEvent,\n RecordSaveFailedEvent,\n RecordDeleteFailedEvent,\n ValidationFailedEvent\n} from './types/form-types';\nimport { FormStateService } from './form-state.service';\n\n/**\n * Abstract base class for all entity record forms in MemberJunction.\n *\n * Generated forms (via CodeGen) and custom forms extend this class.\n * It provides core form logic — section management, validation, pending records,\n * permissions, favorites, related entity helpers — with ZERO Explorer dependencies.\n *\n * Instead of calling Explorer services directly, events are emitted via @Output:\n * - **Navigate**: Form navigation requests (record links, new records, external links)\n * - **Notification**: User-facing notifications (save success, validation errors, etc.)\n * - **RecordSaved**: Emitted after a successful save\n * - **RecordDeleted**: Emitted after a successful delete\n *\n * The host application (e.g. SingleRecordComponent in Explorer) subscribes to\n * these events and maps them to its own services (NavigationService, SharedService, etc.).\n */\n@Directive()\nexport abstract class BaseFormComponent extends BaseRecordComponent implements AfterViewInit, OnInit, OnDestroy {\n public EditMode: boolean = false;\n public FavoriteInitDone: boolean = false;\n public isHistoryDialogOpen: boolean = false;\n public IsTagsPanelOpen: boolean = false;\n public TagCount: number = 0;\n public showDeleteDialog: boolean = false;\n public showCreateDialog: boolean = false;\n\n /**\n * Height of the top area when a splitter layout is used.\n * Referenced by CodeGen-generated templates for entities with \"top area\" sections.\n */\n public TopAreaHeight: string = '300px';\n\n /**\n * Size of the top area as a percentage (0-100) for angular-split.\n * Used by CodeGen-generated templates with as-split.\n */\n public TopAreaSize: number = 40;\n\n /**\n * Size of the bottom area as a percentage (0-100) for angular-split.\n * Used by CodeGen-generated templates with as-split.\n */\n public BottomAreaSize: number = 60;\n\n /**\n * Called when the splitter layout changes (for entities with \"top area\" sections).\n * No-op in the generic version; override in host application if splitter resizing is needed.\n */\n public splitterLayoutChange(): void {\n // No-op — host application can override\n }\n\n private _pendingRecords: PendingRecordItem[] = [];\n\n // #region Injected Dependencies (no constructor params)\n\n protected elementRef = inject(ElementRef);\n public cdr = inject(ChangeDetectorRef);\n protected formStateService = inject(FormStateService);\n\n // #endregion\n\n // #region @Output Events\n\n /** Emitted when navigation is requested (record link, external link, email, new record, etc.) */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n /** Emitted when a user-facing notification should be shown */\n @Output() Notification = new EventEmitter<FormNotificationEvent>();\n\n /** Emitted after a record is saved successfully */\n @Output() RecordSaved = new EventEmitter<RecordSavedEvent>();\n\n /** Emitted after a record is deleted successfully */\n @Output() RecordDeleted = new EventEmitter<RecordDeletedEvent>();\n\n /** Emitted when a record save fails */\n @Output() RecordSaveFailed = new EventEmitter<RecordSaveFailedEvent>();\n\n /** Emitted when a record delete fails */\n @Output() RecordDeleteFailed = new EventEmitter<RecordDeleteFailedEvent>();\n\n /** Emitted when validation fails before save */\n @Output() ValidationFailed = new EventEmitter<ValidationFailedEvent>();\n\n /**\n * Emitted once after ngOnInit completes and the record is fully initialized\n * (favorites loaded, form state initialized). This is the safe point for\n * the container to start loading badge counts and other record-dependent data.\n */\n @Output() RecordReady = new EventEmitter<BaseEntity>();\n\n // #endregion\n\n /** Subscription to form state changes */\n private formStateSubscription?: Subscription;\n\n @ViewChildren(MjCollapsiblePanelComponent) collapsiblePanels!: QueryList<MjCollapsiblePanelComponent>;\n\n async ngOnInit() {\n if (this.record) {\n if (!this.record.IsSaved) {\n this.StartEditMode();\n }\n const md = this.ProviderToUse;\n // Bind FormStateService to the same provider this form is using.\n this.formStateService.Provider = md;\n this._isFavorite = await md.GetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey);\n this.FavoriteInitDone = true;\n\n // Initialize form state from User Settings\n const entityName = this.getEntityName();\n if (entityName) {\n await this.formStateService.initializeState(entityName);\n this.formStateSubscription = this.formStateService.getState$(entityName).subscribe(state => {\n this.showEmptyFields = state.showEmptyFields;\n this.cdr.markForCheck();\n });\n }\n }\n\n // Signal that the record is fully initialized and ready for dependent operations\n if (this.record) {\n this.RecordReady.emit(this.record);\n }\n\n // Set up debounced filter subscription\n this.filterSubscription = this.filterSubject\n .pipe(debounceTime(100))\n .subscribe(searchTerm => {\n this.searchFilter = searchTerm;\n // After change detection propagates FormContext to panels and they update\n // their IsVisible state, expand any visible (matching) sections that are collapsed\n if (searchTerm) {\n Promise.resolve().then(() => this.expandMatchingSections());\n }\n });\n }\n\n ngAfterViewInit(): void {\n // Subclasses can override for post-view-init logic\n }\n\n ngOnDestroy(): void {\n if (this.filterSubscription) {\n this.filterSubscription.unsubscribe();\n }\n if (this.formStateSubscription) {\n this.formStateSubscription.unsubscribe();\n }\n }\n\n // #region Pending Records\n\n protected get PendingRecords(): PendingRecordItem[] {\n return this._pendingRecords;\n }\n\n protected PendingRecordsDirty(): boolean {\n this.PopulatePendingRecords();\n const pendingRecords = this.PendingRecords;\n if (pendingRecords && pendingRecords.length > 0) {\n for (const p of pendingRecords) {\n if (p.action === 'delete')\n return true;\n else if (p.entityObject.Dirty)\n return true;\n }\n }\n return false;\n }\n\n protected PopulatePendingRecords() {\n this._pendingRecords = [];\n this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE);\n const result = this.RaiseEvent(BaseFormComponentEventCodes.POPULATE_PENDING_RECORDS);\n if (result && result.pendingChanges) {\n for (const p of result.pendingChanges)\n this.PendingRecords.push(p);\n }\n }\n\n protected ValidatePendingRecords(): ValidationResult[] {\n const results: ValidationResult[] = [];\n for (let i = 0; i < this._pendingRecords.length; i++) {\n const pendingRecord = this._pendingRecords[i];\n results.push(pendingRecord.entityObject.Validate());\n }\n return results;\n }\n\n // #endregion\n\n // #region Edit Mode\n\n public StartEditMode(): void {\n this.EditMode = true;\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setEditMode(entityName, true);\n }\n }\n\n public EndEditMode(): void {\n this.EditMode = false;\n this.clearValidationState();\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setEditMode(entityName, false);\n }\n }\n\n public handleHistoryDialog(): void {\n this.isHistoryDialogOpen = !this.isHistoryDialogOpen;\n }\n\n public HandleTagsPanel(): void {\n this.IsTagsPanelOpen = !this.IsTagsPanelOpen;\n }\n\n // #endregion\n\n // #region Core Form Operations\n\n public Validate(): ValidationResult {\n const valResults = (<BaseEntity>this.record).Validate();\n const pendingValResults = this.ValidatePendingRecords();\n for (let i = 0; i < pendingValResults.length; i++) {\n const pendingValResult = pendingValResults[i];\n if (!pendingValResult.Success) {\n valResults.Success = false;\n valResults.Errors.push(...pendingValResult.Errors);\n }\n }\n return valResults;\n }\n\n protected RaiseEvent(eventCode: BaseFormComponentEventCodes) {\n const event = new FormEditingCompleteEvent();\n event.elementRef = this.elementRef;\n event.subEventCode = eventCode;\n\n MJGlobal.Instance.RaiseEvent({\n event: MJEventType.ComponentEvent,\n component: this,\n eventCode: BaseFormComponentEventCodes.BASE_CODE,\n args: event\n });\n\n return event;\n }\n\n public async SaveRecord(StopEditModeAfterSave: boolean): Promise<boolean> {\n try {\n try {\n (document.activeElement as HTMLElement).blur();\n this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE);\n } catch (_e) {\n // ignore blur errors\n }\n\n if (this.record) {\n this.PopulatePendingRecords();\n const valResults = this.Validate();\n if (valResults.Success) {\n const result = await this.InternalSaveRecord();\n if (result) {\n this._pendingRecords = [];\n this.clearValidationState();\n if (StopEditModeAfterSave)\n this.EndEditMode();\n\n this.Notification.emit({ Message: 'Record saved successfully', Type: 'success', Duration: 2500 });\n this.RecordSaved.emit({\n EntityName: this.record.EntityInfo.Name,\n RecordId: this.record.PrimaryKey.ToString(),\n Result: { Success: true }\n });\n return true;\n } else {\n const serverMsg = this.record.LatestResult?.Message || '';\n const errorMsg = serverMsg ? `Save failed: ${serverMsg}` : 'Error saving record';\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordSaveFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n } else {\n // Broadcast validation errors to all fields via FormContext\n this._showValidation = true;\n this._validationErrors = valResults.Errors;\n this.cdr.markForCheck();\n\n const errorMessages = valResults.Errors.map(x => x.Message);\n this.Notification.emit({\n Message: 'Validation Errors\\n' + errorMessages.join('\\n'),\n Type: 'warning',\n Duration: 5000\n });\n this.ValidationFailed.emit({ EntityName: this.record.EntityInfo.Name, Errors: errorMessages });\n }\n }\n\n LogError(\"Could not save record: Record not found\");\n return false;\n } catch (e) {\n const errorMsg = 'Error saving record: ' + e;\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n if (this.record) {\n this.RecordSaveFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n return false;\n }\n }\n\n public CancelEdit() {\n if (this.record) {\n const r = <BaseEntity>this.record;\n if (r.Dirty || this.PendingRecordsDirty()) {\n // Revert is safe here — the toolbar's discard dialog already confirmed with the user\n r.Revert();\n\n const pendingRecords = this.PendingRecords;\n if (pendingRecords && pendingRecords.length > 0) {\n pendingRecords.forEach(p => {\n if (p.action === 'save')\n p.entityObject.Revert();\n });\n }\n this.RaiseEvent(BaseFormComponentEventCodes.REVERT_PENDING_CHANGES);\n }\n this.EndEditMode();\n }\n }\n\n protected async InternalSaveRecord(): Promise<boolean> {\n if (this.record) {\n if (this._pendingRecords.length > 0) {\n const md = this.ProviderToUse;\n const tg = await md.CreateTransactionGroup();\n this.record.TransactionGroup = tg;\n await this.record.Save();\n\n for (const x of this._pendingRecords) {\n x.entityObject.TransactionGroup = tg;\n if (x.action === 'save') {\n await x.entityObject.Save();\n } else {\n await x.entityObject.Delete();\n }\n }\n return await tg.Submit();\n } else {\n return await this.record.Save();\n }\n } else {\n return false;\n }\n }\n\n public async Wait(duration: number): Promise<void> {\n return new Promise<void>(resolve => setTimeout(resolve, duration));\n }\n\n // #endregion\n\n // #region Permissions\n\n private _userPermissions: { permission: EntityPermissionType; canDo: boolean }[] = [];\n\n public CheckUserPermission(type: EntityPermissionType): boolean {\n try {\n if (this.record) {\n const perm = this._userPermissions.find(x => x.permission === type);\n if (perm)\n return perm.canDo;\n else {\n const result = this.record.CheckPermissions(type, false);\n this._userPermissions.push({ permission: type, canDo: result });\n return result;\n }\n } else {\n return false;\n }\n } catch (e) {\n LogError(e);\n return false;\n }\n }\n\n public get UserCanEdit(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Update);\n }\n\n public get UserCanRead(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Read);\n }\n\n public get UserCanCreate(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Create);\n }\n\n public get UserCanDelete(): boolean {\n return this.CheckUserPermission(EntityPermissionType.Delete);\n }\n\n // #endregion\n\n // #region Grid Edit Mode\n\n public GridEditMode(): \"None\" | \"Save\" | \"Queue\" {\n return this.EditMode ? \"Queue\" : \"None\";\n }\n\n // #endregion\n\n // #region Favorites\n\n private _isFavorite: boolean = false;\n\n public get IsFavorite(): boolean {\n return this._isFavorite;\n }\n\n public async RemoveFavorite(): Promise<void> {\n return this.SetFavoriteStatus(false);\n }\n\n public async MakeFavorite(): Promise<void> {\n return this.SetFavoriteStatus(true);\n }\n\n public async SetFavoriteStatus(isFavorite: boolean) {\n const md = this.ProviderToUse;\n await md.SetRecordFavoriteStatus(md.CurrentUser.ID, this.record.EntityInfo.Name, this.record.PrimaryKey, isFavorite, md.CurrentUser);\n this._isFavorite = isFavorite;\n }\n\n // #endregion\n\n // #region Related Entity Helpers\n\n public BuildRelationshipViewParams(item: EntityRelationshipInfo): RunViewParams {\n return EntityInfo.BuildRelationshipViewParams(this.record, item);\n }\n\n public BuildRelationshipViewParamsByEntityName(relatedEntityName: string, relatedEntityJoinField?: string): RunViewParams {\n const eri = this.GetEntityRelationshipByRelatedEntityName(relatedEntityName, relatedEntityJoinField);\n if (eri)\n return this.BuildRelationshipViewParams(eri);\n else\n return {};\n }\n\n public GetEntityRelationshipByRelatedEntityName(relatedEntityName: string, relatedEntityJoinField?: string): EntityRelationshipInfo | undefined {\n if (this.record) {\n const r = <BaseEntity>this.record;\n const ret = r.EntityInfo.RelatedEntities.filter(x => x.RelatedEntity.trim().toLowerCase() === relatedEntityName.trim().toLowerCase());\n if (ret.length > 1 && relatedEntityJoinField) {\n const ret2 = ret.find(x => x.RelatedEntityJoinField.trim().toLowerCase() === relatedEntityJoinField.trim().toLowerCase());\n if (ret2)\n return ret2;\n } else if (ret.length === 1) {\n return ret[0];\n } else {\n return undefined;\n }\n }\n return undefined;\n }\n\n public NewRecordValues(relatedEntityName: string): Record<string, unknown> {\n const eri = this.GetEntityRelationshipByRelatedEntityName(relatedEntityName);\n if (eri)\n return this.NewRecordValuesByEntityRelationship(eri);\n else\n return {};\n }\n\n public NewRecordValuesByEntityRelationship(item: EntityRelationshipInfo): Record<string, unknown> {\n return EntityInfo.BuildRelationshipNewRecordValues(this.record, item);\n }\n\n public GetRelatedEntityTabDisplayName(relatedEntityName: string): string {\n if (this.record) {\n const eri = (<BaseEntity>this.record).EntityInfo.RelatedEntities.find(x => x.RelatedEntity === relatedEntityName);\n if (eri)\n return eri.DisplayName;\n }\n return relatedEntityName;\n }\n\n public get HasRelatedEntities(): boolean {\n if (this.record) {\n const relatedEntities = (<BaseEntity>this.record).EntityInfo.RelatedEntities;\n return relatedEntities && relatedEntities.length > 0;\n }\n return false;\n }\n\n // #endregion\n\n // #region Organic Key Helpers\n\n /**\n * Returns all active organic keys for the current entity, or an empty array if none.\n */\n public get OrganicKeys(): EntityOrganicKeyInfo[] {\n if (this.record) {\n return (<BaseEntity>this.record).EntityInfo.OrganicKeys || [];\n }\n return [];\n }\n\n /**\n * Whether the current entity has any active organic keys with related entities configured.\n */\n public get HasOrganicKeys(): boolean {\n return this.OrganicKeys.some(ok => ok.RelatedEntities.length > 0);\n }\n\n /**\n * Returns all organic key related entities across all organic keys, flattened and sorted.\n */\n public get AllOrganicKeyRelatedEntities(): { OrganicKey: EntityOrganicKeyInfo; RelatedEntity: EntityOrganicKeyRelatedEntityInfo }[] {\n const result: { OrganicKey: EntityOrganicKeyInfo; RelatedEntity: EntityOrganicKeyRelatedEntityInfo }[] = [];\n for (const ok of this.OrganicKeys) {\n for (const re of ok.RelatedEntities) {\n result.push({ OrganicKey: ok, RelatedEntity: re });\n }\n }\n return result;\n }\n\n /**\n * Builds RunViewParams for a specific organic key related entity.\n */\n public BuildOrganicKeyViewParams(\n organicKeyRelatedEntity: EntityOrganicKeyRelatedEntityInfo,\n organicKey: EntityOrganicKeyInfo\n ): RunViewParams {\n if (this.record) {\n return EntityInfo.BuildOrganicKeyViewParams(this.record, organicKeyRelatedEntity, organicKey);\n }\n return {};\n }\n\n /**\n * Convenience method to build organic key view params by organic key name and related entity name.\n */\n public BuildOrganicKeyViewParamsByNames(organicKeyName: string, relatedEntityName: string): RunViewParams {\n const ok = this.OrganicKeys.find(k => k.Name.trim().toLowerCase() === organicKeyName.trim().toLowerCase());\n if (ok) {\n const re = ok.RelatedEntities.find(r => r.RelatedEntity.trim().toLowerCase() === relatedEntityName.trim().toLowerCase());\n if (re) {\n return this.BuildOrganicKeyViewParams(re, ok);\n }\n }\n return {};\n }\n\n // #endregion\n\n // #region Entity Info & Dependencies\n\n public get EntityInfo(): EntityInfo | undefined {\n try {\n const r = <BaseEntity>this.record;\n if (r)\n return r.EntityInfo;\n else\n return undefined;\n } catch (e) {\n LogError(e);\n return undefined;\n }\n }\n\n public async ShowDependencies() {\n const md = this.ProviderToUse;\n const dep = await md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.PrimaryKey);\n console.log('Dependencies for: ' + this.record.EntityInfo.Name + ' ' + this.record.PrimaryKey.ToString());\n console.log(dep);\n }\n\n public ShowChanges(): void {\n if (this.record) {\n const changes = this.record.GetAll(false, true);\n const oldValues = this.record.GetAll(true, true);\n const message =\n 'Changes for: ' + this.record.EntityInfo.Name + ' ' + this.record.PrimaryKey.ToString() +\n '\\n\\n' + JSON.stringify(changes, null, 2) +\n '\\n\\nOld Values\\n\\n' + JSON.stringify(oldValues, null, 2);\n console.log(message);\n this.Notification.emit({ Message: message, Type: 'info', Duration: 30000 });\n }\n }\n\n public async GetListsCanAddTo(): Promise<MJListEntity[]> {\n if (!this.record) {\n LogError('Unable to fetch List records: Record not found');\n return [];\n }\n\n const rv = RunView.FromMetadataProvider(this.ProviderToUse);\n const md = this.ProviderToUse;\n\n const rvResult: RunViewResult<MJListEntity> = await rv.RunView({\n EntityName: 'MJ: Lists',\n ExtraFilter: `UserID = '${md.CurrentUser.ID}' AND EntityID = '${this.record.EntityInfo.ID}'`,\n ResultType: 'entity_object'\n });\n\n if (!rvResult.Success) {\n LogError('Error running view to fetch lists', undefined, rvResult.ErrorMessage);\n return [];\n }\n\n return rvResult.Results;\n }\n\n public async GetRecordDependencies(): Promise<RecordDependency[]> {\n const md = this.ProviderToUse;\n const dependencies: RecordDependency[] = await md.GetRecordDependencies(this.record.EntityInfo.Name, this.record.PrimaryKey);\n return dependencies;\n }\n\n // #endregion\n\n // #region Collapsible Section Management\n\n protected sections: BaseFormSectionInfo[] = [];\n private sectionMap: Map<string, BaseFormSectionInfo> = new Map();\n\n public searchFilter: string = '';\n public showEmptyFields: boolean = false;\n\n /** Whether to show all validation errors on fields (set after save failure) */\n private _showValidation = false;\n /** Validation errors from the most recent failed save attempt */\n private _validationErrors: ValidationErrorInfo[] = [];\n\n public get formContext(): FormContext {\n return {\n sectionFilter: this.searchFilter,\n showEmptyFields: this.showEmptyFields,\n showValidation: this._showValidation,\n validationErrors: this._validationErrors\n };\n }\n\n /** Clears all validation display state (called on save success, cancel, end edit) */\n private clearValidationState(): void {\n this._showValidation = false;\n this._validationErrors = [];\n }\n\n private filterSubject = new Subject<string>();\n private filterSubscription?: Subscription;\n\n protected initSections(sections: (BaseFormSectionInfo | { sectionKey: string; sectionName: string; isExpanded: boolean; rowCount?: number; metadata?: unknown })[]): void {\n this.sections = sections.map(s =>\n s instanceof BaseFormSectionInfo\n ? s\n : new BaseFormSectionInfo(s.sectionKey, s.sectionName, s.isExpanded, s.rowCount, s.metadata)\n );\n this.sectionMap.clear();\n this.sections.forEach(section => {\n this.sectionMap.set(section.sectionKey, section);\n });\n }\n\n protected getSection(sectionKey: string): BaseFormSectionInfo | undefined {\n return this.sectionMap.get(sectionKey);\n }\n\n public IsSectionExpanded(sectionKey: string, defaultExpanded?: boolean): boolean {\n const section = this.sectionMap.get(sectionKey);\n // When the caller doesn't pass an explicit default, fall back to the value seeded by\n // initSections() — related-entity and System Metadata panels are seeded collapsed there.\n // Without this, FormStateService falls back to its global DEFAULT_SECTION_STATE (isExpanded=true),\n // which reports a never-before-visited related-entity panel as expanded and causes its data grid\n // (bound [AllowLoad]=\"IsSectionExpanded(key)\") to fetch on form open even while the panel is collapsed.\n const resolvedDefault = defaultExpanded !== undefined ? defaultExpanded : section?.isExpanded;\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.isSectionExpanded(entityName, sectionKey, resolvedDefault);\n }\n return section ? section.isExpanded : (defaultExpanded !== undefined ? defaultExpanded : true);\n }\n\n public SetSectionExpanded(sectionKey: string, isExpanded: boolean): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionExpanded(entityName, sectionKey, isExpanded);\n }\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.isExpanded = isExpanded;\n }\n }\n\n public GetSectionRowCount(sectionKey: string): number | undefined {\n const section = this.sectionMap.get(sectionKey);\n return section?.rowCount;\n }\n\n public SetSectionRowCount(sectionKey: string, rowCount: number): void {\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.rowCount = rowCount;\n }\n }\n\n public GetSectionPanelHeight(sectionKey: string): number | undefined {\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.getSectionPanelHeight(entityName, sectionKey);\n }\n return undefined;\n }\n\n public SetSectionPanelHeight(sectionKey: string, height: number): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionPanelHeight(entityName, sectionKey, height);\n }\n }\n\n public toggleSection(sectionKey: string): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.toggleSection(entityName, sectionKey);\n }\n const section = this.sectionMap.get(sectionKey);\n if (section) {\n section.isExpanded = !section.isExpanded;\n }\n }\n\n /**\n * Expand any sections that are visible (match the current filter) but currently collapsed.\n * Called after filter changes so the user can immediately see matching content.\n */\n private expandMatchingSections(): void {\n if (!this.collapsiblePanels) return;\n this.collapsiblePanels.forEach(panel => {\n if (panel.IsVisible && !panel.Expanded) {\n this.SetSectionExpanded(panel.SectionKey, true);\n }\n });\n }\n\n public expandAllSections(): void {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n this.formStateService.expandAllSections(entityName, sectionKeys);\n }\n this.sections.forEach(section => {\n section.isExpanded = true;\n });\n }\n\n public collapseAllSections(): void {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n this.formStateService.collapseAllSections(entityName, sectionKeys);\n }\n this.sections.forEach(section => {\n section.isExpanded = false;\n });\n }\n\n public getExpandedCount(): number {\n const entityName = this.getEntityName();\n const sectionKeys = this.sections.map(s => s.sectionKey);\n if (entityName && sectionKeys.length > 0) {\n return this.formStateService.getExpandedCount(entityName, sectionKeys);\n }\n return this.sections.filter(section => section.isExpanded).length;\n }\n\n public getVisibleSectionCount(): number {\n if (!this.collapsiblePanels || this.collapsiblePanels.length === 0) {\n return this.sections.length;\n }\n return this.collapsiblePanels.filter(panel => panel.IsVisible).length;\n }\n\n public getTotalSectionCount(): number {\n return this.sections.length;\n }\n\n public onFilterChange(searchTerm: string): void {\n this.filterSubject.next(searchTerm);\n }\n\n public getEntityName(): string {\n return this.record?.EntityInfo?.Name || '';\n }\n\n /**\n * Component-level default width mode, used when the user has NOT\n * explicitly chosen a width for this entity yet (first visit, nothing\n * persisted in User Settings). Subclasses can override this — for\n * example, custom forms with full-bleed layouts should return\n * `'full-width'` here and the container will respect it on first open.\n *\n * Once the user toggles the width via the toolbar, their choice\n * persists via `setFormWidthMode()` and takes priority over this\n * default on subsequent opens.\n */\n public getDefaultFormWidthMode(): 'centered' | 'full-width' {\n return 'centered';\n }\n\n public getFormWidthMode(): 'centered' | 'full-width' {\n const entityName = this.getEntityName();\n if (entityName && this.formStateService.hasExplicitWidthMode(entityName)) {\n return this.formStateService.getWidthMode(entityName);\n }\n return this.getDefaultFormWidthMode();\n }\n\n public setFormWidthMode(widthMode: 'centered' | 'full-width'): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setWidthMode(entityName, widthMode);\n }\n }\n\n public toggleFormWidthMode(): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.toggleWidthMode(entityName);\n }\n }\n\n // #endregion\n\n // #region Section Ordering\n\n public getSectionOrder(): string[] {\n const entityName = this.getEntityName();\n if (entityName) {\n const customOrder = this.formStateService.getSectionOrder(entityName);\n if (customOrder && customOrder.length > 0) {\n return customOrder;\n }\n }\n return this.sections.map(s => s.sectionKey);\n }\n\n public setSectionOrder(sectionOrder: string[]): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.setSectionOrder(entityName, sectionOrder);\n }\n }\n\n public resetSectionOrder(): void {\n const entityName = this.getEntityName();\n if (entityName) {\n this.formStateService.resetSectionOrder(entityName);\n }\n }\n\n public hasCustomSectionOrder(): boolean {\n const entityName = this.getEntityName();\n if (entityName) {\n return this.formStateService.hasCustomSectionOrder(entityName);\n }\n return false;\n }\n\n public getSectionDisplayOrder(sectionKey: string): number {\n const order = this.getSectionOrder();\n const index = order.indexOf(sectionKey);\n return index >= 0 ? index : this.sections.length;\n }\n\n // #endregion\n\n // #region Form Container Event Handlers\n\n /**\n * Handles navigation events from the form container and related entity grids.\n * Relays the event upward via the Navigate @Output for the host application to handle.\n * Generated form templates bind this as: (Navigate)=\"OnFormNavigate($event)\"\n */\n public OnFormNavigate(event: FormNavigationEvent): void {\n this.Navigate.emit(event);\n }\n\n /**\n * Handles delete requests from the form container.\n * Emits RecordDeleted on success, RecordDeleteFailed on failure.\n * Generated form templates bind this as: (DeleteRequested)=\"OnDeleteRequested()\"\n */\n public async OnDeleteRequested(): Promise<void> {\n if (!this.record || !this.record.IsSaved) return;\n try {\n const result = await this.record.Delete();\n if (result) {\n this.Notification.emit({ Message: 'Record deleted successfully', Type: 'success', Duration: 2500 });\n this.RecordDeleted.emit({\n EntityName: this.record.EntityInfo.Name,\n RecordId: this.record.PrimaryKey.ToString()\n });\n } else {\n const errorMsg = 'Error deleting record';\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordDeleteFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n } catch (e) {\n const errorMsg = 'Error deleting record: ' + e;\n this.Notification.emit({ Message: errorMsg, Type: 'error', Duration: 5000 });\n this.RecordDeleteFailed.emit({ EntityName: this.record.EntityInfo.Name, ErrorMessage: errorMsg });\n }\n }\n\n /**\n * Handles favorite toggle from the form container.\n * Generated form templates bind this as: (FavoriteToggled)=\"OnFavoriteToggled()\"\n */\n public async OnFavoriteToggled(): Promise<void> {\n await this.SetFavoriteStatus(!this.IsFavorite);\n }\n\n /**\n * Handles history view requests from the form container.\n * Generated form templates bind this as: (HistoryRequested)=\"OnHistoryRequested()\"\n */\n public OnHistoryRequested(): void {\n this.handleHistoryDialog();\n }\n\n /**\n * Handles list management requests from the form container.\n * Generated form templates bind this as: (ListManagementRequested)=\"OnListManagementRequested()\"\n */\n public OnListManagementRequested(): void {\n // List management dialog is handled by the host application\n // Subclasses can override this to implement custom list management\n }\n\n // #endregion\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { EventEmitter } from '@angular/core';
1
+ import { EventEmitter, AfterViewInit, OnDestroy } from '@angular/core';
2
2
  import { RunViewParams } from '@memberjunction/core';
3
3
  import { EntityDataGridComponent, AfterRowDoubleClickEventArgs, AfterRowClickEventArgs, AfterDataLoadEventArgs, GridToolbarConfig, GridSelectionMode } from '@memberjunction/ng-entity-viewer';
4
4
  import { EntityInfo } from '@memberjunction/core';
@@ -10,8 +10,11 @@ import * as i0 from "@angular/core";
10
10
  *
11
11
  * This component is used by CodeGen for related entity grids in forms.
12
12
  */
13
- export declare class ExplorerEntityDataGridComponent {
13
+ export declare class ExplorerEntityDataGridComponent implements AfterViewInit, OnDestroy {
14
14
  innerGrid: EntityDataGridComponent;
15
+ private elementRef;
16
+ private cdr;
17
+ private ngZone;
15
18
  Params: RunViewParams | null;
16
19
  NewRecordValues: Record<string, unknown>;
17
20
  AllowLoad: boolean;
@@ -19,6 +22,27 @@ export declare class ExplorerEntityDataGridComponent {
19
22
  Height: number | 'auto' | 'fit-content';
20
23
  ToolbarConfig: GridToolbarConfig;
21
24
  SelectionMode: GridSelectionMode;
25
+ /**
26
+ * When true (default), the inner grid does not fetch until this component's host
27
+ * element first scrolls into the viewport. This prevents related-entity grids on a
28
+ * form — which are always rendered in the DOM (the collapsible panel hides them via
29
+ * CSS, not @if) — from firing a RunView on form open while they're collapsed or below
30
+ * the fold. The first time the panel becomes visible (scrolled into view and expanded,
31
+ * giving the host non-zero area), the grid loads with its normal spinner.
32
+ * Set to false to restore eager loading for consumers that always want immediate data.
33
+ */
34
+ DeferLoadUntilVisible: boolean;
35
+ /** True once the host has first intersected the viewport (or deferral is disabled / unsupported). */
36
+ private _hasBeenVisible;
37
+ private _visibilityObserver?;
38
+ /**
39
+ * Effective AllowLoad passed to the inner grid: the form's AllowLoad AND
40
+ * (deferral disabled OR the panel has been seen at least once).
41
+ */
42
+ get EffectiveAllowLoad(): boolean;
43
+ ngAfterViewInit(): void;
44
+ ngOnDestroy(): void;
45
+ private onBecameVisible;
22
46
  /**
23
47
  * When true, double-clicking a row emits a Navigate event.
24
48
  * Defaults to true.
@@ -43,6 +67,6 @@ export declare class ExplorerEntityDataGridComponent {
43
67
  defaultValues: Record<string, unknown>;
44
68
  }): void;
45
69
  static ɵfac: i0.ɵɵFactoryDeclaration<ExplorerEntityDataGridComponent, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<ExplorerEntityDataGridComponent, "mj-explorer-entity-data-grid", never, { "Params": { "alias": "Params"; "required": false; }; "NewRecordValues": { "alias": "NewRecordValues"; "required": false; }; "AllowLoad": { "alias": "AllowLoad"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "ToolbarConfig": { "alias": "ToolbarConfig"; "required": false; }; "SelectionMode": { "alias": "SelectionMode"; "required": false; }; "NavigateOnDoubleClick": { "alias": "NavigateOnDoubleClick"; "required": false; }; }, { "AfterRowDoubleClick": "AfterRowDoubleClick"; "AfterRowClick": "AfterRowClick"; "AfterDataLoad": "AfterDataLoad"; "Navigate": "Navigate"; }, never, never, false, never>;
70
+ static ɵcmp: i0.ɵɵComponentDeclaration<ExplorerEntityDataGridComponent, "mj-explorer-entity-data-grid", never, { "Params": { "alias": "Params"; "required": false; }; "NewRecordValues": { "alias": "NewRecordValues"; "required": false; }; "AllowLoad": { "alias": "AllowLoad"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "ToolbarConfig": { "alias": "ToolbarConfig"; "required": false; }; "SelectionMode": { "alias": "SelectionMode"; "required": false; }; "DeferLoadUntilVisible": { "alias": "DeferLoadUntilVisible"; "required": false; }; "NavigateOnDoubleClick": { "alias": "NavigateOnDoubleClick"; "required": false; }; }, { "AfterRowDoubleClick": "AfterRowDoubleClick"; "AfterRowClick": "AfterRowClick"; "AfterDataLoad": "AfterDataLoad"; "Navigate": "Navigate"; }, never, never, false, never>;
47
71
  }
48
72
  //# sourceMappingURL=explorer-entity-data-grid.component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"explorer-entity-data-grid.component.d.ts","sourceRoot":"","sources":["../../src/lib/explorer-entity-data-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAa,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACH,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EAEpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;;AAEhE;;;;;GAKG;AACH,qBA2Ba,+BAA+B;IAChB,SAAS,EAAG,uBAAuB,CAAC;IAGnD,MAAM,EAAE,aAAa,GAAG,IAAI,CAAQ;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAC9C,SAAS,EAAE,OAAO,CAAQ;IAC1B,WAAW,EAAE,OAAO,CAAQ;IAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAU;IACjD,aAAa,EAAE,iBAAiB,CAAM;IACtC,aAAa,EAAE,iBAAiB,CAAY;IAErD;;;OAGG;IACM,qBAAqB,EAAE,OAAO,CAAQ;IAGrC,mBAAmB,6CAAoD;IACvE,aAAa,uCAA8C;IAC3D,aAAa,uCAA8C;IAErE,6EAA6E;IACnE,QAAQ,oCAA2C;IAE7D,gBAAgB,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI;IAoB3D,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAK/C,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAK/C;;;;;OAKG;IACH,uBAAuB,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;yCA9D/F,+BAA+B;2CAA/B,+BAA+B;CAqE3C"}
1
+ {"version":3,"file":"explorer-entity-data-grid.component.d.ts","sourceRoot":"","sources":["../../src/lib/explorer-entity-data-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAoD,aAAa,EAAE,SAAS,EAAU,MAAM,eAAe,CAAC;AAC3J,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACH,uBAAuB,EACvB,4BAA4B,EAC5B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EAEpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;;AAEhE;;;;;GAKG;AACH,qBA2Ba,+BAAgC,YAAW,aAAa,EAAE,SAAS;IACpD,SAAS,EAAG,uBAAuB,CAAC;IAE5D,OAAO,CAAC,UAAU,CAAsB;IACxC,OAAO,CAAC,GAAG,CAA6B;IACxC,OAAO,CAAC,MAAM,CAAkB;IAGvB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAQ;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAC9C,SAAS,EAAE,OAAO,CAAQ;IAC1B,WAAW,EAAE,OAAO,CAAQ;IAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAU;IACjD,aAAa,EAAE,iBAAiB,CAAM;IACtC,aAAa,EAAE,iBAAiB,CAAY;IAErD;;;;;;;;OAQG;IACM,qBAAqB,EAAE,OAAO,CAAQ;IAE/C,qGAAqG;IACrG,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,mBAAmB,CAAC,CAAuB;IAEnD;;;OAGG;IACH,IAAI,kBAAkB,IAAI,OAAO,CAEhC;IAED,eAAe,IAAI,IAAI;IAuBvB,WAAW,IAAI,IAAI;IAKnB,OAAO,CAAC,eAAe;IAcvB;;;OAGG;IACM,qBAAqB,EAAE,OAAO,CAAQ;IAGrC,mBAAmB,6CAAoD;IACvE,aAAa,uCAA8C;IAC3D,aAAa,uCAA8C;IAErE,6EAA6E;IACnE,QAAQ,oCAA2C;IAE7D,gBAAgB,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI;IAoB3D,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAK/C,UAAU,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI;IAK/C;;;;;OAKG;IACH,uBAAuB,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,UAAU,CAAC;QAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI;yCAnI/F,+BAA+B;2CAA/B,+BAA+B;CA0I3C"}
@@ -1,4 +1,4 @@
1
- import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';
1
+ import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, ChangeDetectorRef, NgZone, inject } from '@angular/core';
2
2
  import { buildCompositeKey } from '@memberjunction/ng-entity-viewer';
3
3
  import * as i0 from "@angular/core";
4
4
  import * as i1 from "@memberjunction/ng-entity-viewer";
@@ -11,6 +11,9 @@ const _c0 = ["innerGrid"];
11
11
  */
12
12
  export class ExplorerEntityDataGridComponent {
13
13
  innerGrid;
14
+ elementRef = inject(ElementRef);
15
+ cdr = inject(ChangeDetectorRef);
16
+ ngZone = inject(NgZone);
14
17
  // Pass-through inputs from EntityDataGridComponent
15
18
  Params = null;
16
19
  NewRecordValues = {};
@@ -19,6 +22,62 @@ export class ExplorerEntityDataGridComponent {
19
22
  Height = 'auto';
20
23
  ToolbarConfig = {};
21
24
  SelectionMode = 'single';
25
+ /**
26
+ * When true (default), the inner grid does not fetch until this component's host
27
+ * element first scrolls into the viewport. This prevents related-entity grids on a
28
+ * form — which are always rendered in the DOM (the collapsible panel hides them via
29
+ * CSS, not @if) — from firing a RunView on form open while they're collapsed or below
30
+ * the fold. The first time the panel becomes visible (scrolled into view and expanded,
31
+ * giving the host non-zero area), the grid loads with its normal spinner.
32
+ * Set to false to restore eager loading for consumers that always want immediate data.
33
+ */
34
+ DeferLoadUntilVisible = true;
35
+ /** True once the host has first intersected the viewport (or deferral is disabled / unsupported). */
36
+ _hasBeenVisible = false;
37
+ _visibilityObserver;
38
+ /**
39
+ * Effective AllowLoad passed to the inner grid: the form's AllowLoad AND
40
+ * (deferral disabled OR the panel has been seen at least once).
41
+ */
42
+ get EffectiveAllowLoad() {
43
+ return this.AllowLoad && (!this.DeferLoadUntilVisible || this._hasBeenVisible);
44
+ }
45
+ ngAfterViewInit() {
46
+ if (!this.DeferLoadUntilVisible || typeof IntersectionObserver === 'undefined') {
47
+ // Deferral off or unsupported environment — preserve eager-load behavior.
48
+ this._hasBeenVisible = true;
49
+ return;
50
+ }
51
+ // Observe outside Angular so scroll churn doesn't trigger change detection;
52
+ // we re-enter the zone only on the one-shot "became visible" transition.
53
+ this.ngZone.runOutsideAngular(() => {
54
+ this._visibilityObserver = new IntersectionObserver((entries) => {
55
+ if (entries.some(e => e.isIntersecting)) {
56
+ this.onBecameVisible();
57
+ }
58
+ },
59
+ // Small positive rootMargin pre-loads just before the panel scrolls fully into view.
60
+ { root: null, rootMargin: '200px', threshold: 0 });
61
+ this._visibilityObserver.observe(this.elementRef.nativeElement);
62
+ });
63
+ }
64
+ ngOnDestroy() {
65
+ this._visibilityObserver?.disconnect();
66
+ this._visibilityObserver = undefined;
67
+ }
68
+ onBecameVisible() {
69
+ if (this._hasBeenVisible) {
70
+ return;
71
+ }
72
+ // One-shot: once loaded we never need to observe again.
73
+ this._visibilityObserver?.disconnect();
74
+ this._visibilityObserver = undefined;
75
+ this.ngZone.run(() => {
76
+ this._hasBeenVisible = true;
77
+ // Flip EffectiveAllowLoad → true, which drives the inner grid's AllowLoad setter to load.
78
+ this.cdr.detectChanges();
79
+ });
80
+ }
22
81
  /**
23
82
  * When true, double-clicking a row emits a Navigate event.
24
83
  * Defaults to true.
@@ -74,13 +133,13 @@ export class ExplorerEntityDataGridComponent {
74
133
  } if (rf & 2) {
75
134
  let _t;
76
135
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.innerGrid = _t.first);
77
- } }, inputs: { Params: "Params", NewRecordValues: "NewRecordValues", AllowLoad: "AllowLoad", ShowToolbar: "ShowToolbar", Height: "Height", ToolbarConfig: "ToolbarConfig", SelectionMode: "SelectionMode", NavigateOnDoubleClick: "NavigateOnDoubleClick" }, outputs: { AfterRowDoubleClick: "AfterRowDoubleClick", AfterRowClick: "AfterRowClick", AfterDataLoad: "AfterDataLoad", Navigate: "Navigate" }, standalone: false, decls: 2, vars: 7, consts: [["innerGrid", ""], [3, "AfterRowDoubleClick", "AfterRowClick", "AfterDataLoad", "NewRecordTabRequested", "Params", "NewRecordValues", "AllowLoad", "ShowToolbar", "Height", "ToolbarConfig", "SelectionMode"]], template: function ExplorerEntityDataGridComponent_Template(rf, ctx) { if (rf & 1) {
136
+ } }, inputs: { Params: "Params", NewRecordValues: "NewRecordValues", AllowLoad: "AllowLoad", ShowToolbar: "ShowToolbar", Height: "Height", ToolbarConfig: "ToolbarConfig", SelectionMode: "SelectionMode", DeferLoadUntilVisible: "DeferLoadUntilVisible", NavigateOnDoubleClick: "NavigateOnDoubleClick" }, outputs: { AfterRowDoubleClick: "AfterRowDoubleClick", AfterRowClick: "AfterRowClick", AfterDataLoad: "AfterDataLoad", Navigate: "Navigate" }, standalone: false, decls: 2, vars: 7, consts: [["innerGrid", ""], [3, "AfterRowDoubleClick", "AfterRowClick", "AfterDataLoad", "NewRecordTabRequested", "Params", "NewRecordValues", "AllowLoad", "ShowToolbar", "Height", "ToolbarConfig", "SelectionMode"]], template: function ExplorerEntityDataGridComponent_Template(rf, ctx) { if (rf & 1) {
78
137
  const _r1 = i0.ɵɵgetCurrentView();
79
138
  i0.ɵɵelementStart(0, "mj-entity-data-grid", 1, 0);
80
139
  i0.ɵɵlistener("AfterRowDoubleClick", function ExplorerEntityDataGridComponent_Template_mj_entity_data_grid_AfterRowDoubleClick_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onRowDoubleClick($event)); })("AfterRowClick", function ExplorerEntityDataGridComponent_Template_mj_entity_data_grid_AfterRowClick_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onRowClick($event)); })("AfterDataLoad", function ExplorerEntityDataGridComponent_Template_mj_entity_data_grid_AfterDataLoad_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onDataLoad($event)); })("NewRecordTabRequested", function ExplorerEntityDataGridComponent_Template_mj_entity_data_grid_NewRecordTabRequested_0_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.onNewRecordTabRequested($event)); });
81
140
  i0.ɵɵelementEnd();
82
141
  } if (rf & 2) {
83
- i0.ɵɵproperty("Params", ctx.Params)("NewRecordValues", ctx.NewRecordValues)("AllowLoad", ctx.AllowLoad)("ShowToolbar", ctx.ShowToolbar)("Height", ctx.Height)("ToolbarConfig", ctx.ToolbarConfig)("SelectionMode", ctx.SelectionMode);
142
+ i0.ɵɵproperty("Params", ctx.Params)("NewRecordValues", ctx.NewRecordValues)("AllowLoad", ctx.EffectiveAllowLoad)("ShowToolbar", ctx.ShowToolbar)("Height", ctx.Height)("ToolbarConfig", ctx.ToolbarConfig)("SelectionMode", ctx.SelectionMode);
84
143
  } }, dependencies: [i1.EntityDataGridComponent], styles: ["[_nghost-%COMP%] {\n display: block;\n height: 100%;\n width: 100%;\n }"] });
85
144
  }
86
145
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ExplorerEntityDataGridComponent, [{
@@ -90,7 +149,7 @@ export class ExplorerEntityDataGridComponent {
90
149
  #innerGrid
91
150
  [Params]="Params"
92
151
  [NewRecordValues]="NewRecordValues"
93
- [AllowLoad]="AllowLoad"
152
+ [AllowLoad]="EffectiveAllowLoad"
94
153
  [ShowToolbar]="ShowToolbar"
95
154
  [Height]="Height"
96
155
  [ToolbarConfig]="ToolbarConfig"
@@ -118,6 +177,8 @@ export class ExplorerEntityDataGridComponent {
118
177
  type: Input
119
178
  }], SelectionMode: [{
120
179
  type: Input
180
+ }], DeferLoadUntilVisible: [{
181
+ type: Input
121
182
  }], NavigateOnDoubleClick: [{
122
183
  type: Input
123
184
  }], AfterRowDoubleClick: [{
@@ -1 +1 @@
1
- {"version":3,"file":"explorer-entity-data-grid.component.js","sourceRoot":"","sources":["../../src/lib/explorer-entity-data-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAElF,OAAO,EAOH,iBAAiB,EACpB,MAAM,kCAAkC,CAAC;;;;AAI1C;;;;;GAKG;AA4BH,MAAM,OAAO,+BAA+B;IAChB,SAAS,CAA2B;IAE5D,mDAAmD;IAC1C,MAAM,GAAyB,IAAI,CAAC;IACpC,eAAe,GAA4B,EAAE,CAAC;IAC9C,SAAS,GAAY,IAAI,CAAC;IAC1B,WAAW,GAAY,IAAI,CAAC;IAC5B,MAAM,GAAoC,MAAM,CAAC;IACjD,aAAa,GAAsB,EAAE,CAAC;IACtC,aAAa,GAAsB,QAAQ,CAAC;IAErD;;;OAGG;IACM,qBAAqB,GAAY,IAAI,CAAC;IAE/C,6CAA6C;IACnC,mBAAmB,GAAG,IAAI,YAAY,EAAgC,CAAC;IACvE,aAAa,GAAG,IAAI,YAAY,EAA0B,CAAC;IAC3D,aAAa,GAAG,IAAI,YAAY,EAA0B,CAAC;IAErE,6EAA6E;IACnE,QAAQ,GAAG,IAAI,YAAY,EAAuB,CAAC;IAE7D,gBAAgB,CAAC,KAAmC;QAChD,sCAAsC;QACtC,IAAI,CAAC,m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AAS;6BACI,KAAK,YACL,8BAA8B,YAC9B;;;;;;;;;;;;;;;KAeT;;kBAUA,SAAS;mBAAC,WAAW;;kBAGrB,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAML,KAAK;;kBAGL,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBAGN,MAAM;;kFAxBE,+BAA+B","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild } from '@angular/core';\nimport { RunViewParams } from '@memberjunction/core';\nimport {\n EntityDataGridComponent,\n AfterRowDoubleClickEventArgs,\n AfterRowClickEventArgs,\n AfterDataLoadEventArgs,\n GridToolbarConfig,\n GridSelectionMode,\n buildCompositeKey\n} from '@memberjunction/ng-entity-viewer';\nimport { EntityInfo } from '@memberjunction/core';\nimport { FormNavigationEvent } from './types/navigation-events';\n\n/**\n * Wrapper for EntityDataGridComponent that emits navigation events on row double-click.\n * The host application subscribes to Navigate events and maps them to its routing system.\n *\n * This component is used by CodeGen for related entity grids in forms.\n */\n@Component({\n standalone: false,\n selector: 'mj-explorer-entity-data-grid',\n template: `\n <mj-entity-data-grid\n #innerGrid\n [Params]=\"Params\"\n [NewRecordValues]=\"NewRecordValues\"\n [AllowLoad]=\"AllowLoad\"\n [ShowToolbar]=\"ShowToolbar\"\n [Height]=\"Height\"\n [ToolbarConfig]=\"ToolbarConfig\"\n [SelectionMode]=\"SelectionMode\"\n (AfterRowDoubleClick)=\"onRowDoubleClick($event)\"\n (AfterRowClick)=\"onRowClick($event)\"\n (AfterDataLoad)=\"onDataLoad($event)\"\n (NewRecordTabRequested)=\"onNewRecordTabRequested($event)\">\n </mj-entity-data-grid>\n `,\n styles: [`\n :host {\n display: block;\n height: 100%;\n width: 100%;\n }\n `]\n})\nexport class ExplorerEntityDataGridComponent {\n @ViewChild('innerGrid') innerGrid!: EntityDataGridComponent;\n\n // Pass-through inputs from EntityDataGridComponent\n @Input() Params: RunViewParams | null = null;\n @Input() NewRecordValues: Record<string, unknown> = {};\n @Input() AllowLoad: boolean = true;\n @Input() ShowToolbar: boolean = true;\n @Input() Height: number | 'auto' | 'fit-content' = 'auto';\n @Input() ToolbarConfig: GridToolbarConfig = {};\n @Input() SelectionMode: GridSelectionMode = 'single';\n\n /**\n * When true, double-clicking a row emits a Navigate event.\n * Defaults to true.\n */\n @Input() NavigateOnDoubleClick: boolean = true;\n\n // Re-emit events for consumers who need them\n @Output() AfterRowDoubleClick = new EventEmitter<AfterRowDoubleClickEventArgs>();\n @Output() AfterRowClick = new EventEmitter<AfterRowClickEventArgs>();\n @Output() AfterDataLoad = new EventEmitter<AfterDataLoadEventArgs>();\n\n /** Emitted when a row is double-clicked and NavigateOnDoubleClick is true */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n onRowDoubleClick(event: AfterRowDoubleClickEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterRowDoubleClick.emit(event);\n\n // Emit navigation event if enabled\n if (this.NavigateOnDoubleClick && event.row) {\n // Use the inner grid's resolved EntityInfo - works for both ViewID and EntityName params\n const entityInfo = this.innerGrid?.EntityInfo;\n if (!entityInfo) return;\n\n const pkey = buildCompositeKey(event.row, entityInfo);\n\n this.Navigate.emit({\n Kind: 'record',\n EntityName: entityInfo.Name,\n PrimaryKey: pkey\n });\n }\n }\n\n onRowClick(event: AfterRowClickEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterRowClick.emit(event);\n }\n\n onDataLoad(event: AfterDataLoadEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterDataLoad.emit(event);\n }\n\n /**\n * The inner grid's \"New\" button bubbles up here. We re-emit as a\n * `new-record` Navigate event so the host form (and Explorer's\n * SingleRecordComponent) can call NavigationService.OpenNewEntityRecord\n * and pre-populate the foreign-key fields from NewRecordValues.\n */\n onNewRecordTabRequested(event: { entityInfo: EntityInfo; defaultValues: Record<string, unknown> }): void {\n this.Navigate.emit({\n Kind: 'new-record',\n EntityName: event.entityInfo.Name,\n DefaultValues: event.defaultValues,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"explorer-entity-data-grid.component.js","sourceRoot":"","sources":["../../src/lib/explorer-entity-data-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,EAA4B,MAAM,EAAE,MAAM,eAAe,CAAC;AAE3J,OAAO,EAOH,iBAAiB,EACpB,MAAM,kCAAkC,CAAC;;;;AAI1C;;;;;GAKG;AA4BH,MAAM,OAAO,+BAA+B;IAChB,SAAS,CAA2B;IAEpD,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAChC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAEhC,mDAAmD;IAC1C,MAAM,GAAyB,IAAI,CAAC;IACpC,eAAe,GAA4B,EAAE,CAAC;IAC9C,SAAS,GAAY,IAAI,CAAC;IAC1B,WAAW,GAAY,IAAI,CAAC;IAC5B,MAAM,GAAoC,MAAM,CAAC;IACjD,aAAa,GAAsB,EAAE,CAAC;IACtC,aAAa,GAAsB,QAAQ,CAAC;IAErD;;;;;;;;OAQG;IACM,qBAAqB,GAAY,IAAI,CAAC;IAE/C,qGAAqG;IAC7F,eAAe,GAAG,KAAK,CAAC;IACxB,mBAAmB,CAAwB;IAEnD;;;OAGG;IACH,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC;IACnF,CAAC;IAED,eAAe;QACX,IAAI,CAAC,IAAI,CAAC,qBAAqB,IAAI,OAAO,oBAAoB,KAAK,WAAW,EAAE,CAAC;YAC7E,0EAA0E;YAC1E,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,OAAO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,wLACX,mCAA+B,KAAC;YAC7D,iBAAsB;;YALlB,AADA,AADA,AADA,AADA,AADA,AADA,mCAAiB,wCACkB,qCACH,gCACL,sBACV,oCACc,oCACA;;;iFAe9B,+BAA+B;cA3B3C,SAAS;6BACI,KAAK,YACL,8BAA8B,YAC9B;;;;;;;;;;;;;;;KAeT;;kBAUA,SAAS;mBAAC,WAAW;;kBAOrB,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAWL,KAAK;;kBA4DL,KAAK;;kBAGL,MAAM;;kBACN,MAAM;;kBACN,MAAM;;kBAGN,MAAM;;kFA7FE,+BAA+B","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, ChangeDetectorRef, NgZone, AfterViewInit, OnDestroy, inject } from '@angular/core';\nimport { RunViewParams } from '@memberjunction/core';\nimport {\n EntityDataGridComponent,\n AfterRowDoubleClickEventArgs,\n AfterRowClickEventArgs,\n AfterDataLoadEventArgs,\n GridToolbarConfig,\n GridSelectionMode,\n buildCompositeKey\n} from '@memberjunction/ng-entity-viewer';\nimport { EntityInfo } from '@memberjunction/core';\nimport { FormNavigationEvent } from './types/navigation-events';\n\n/**\n * Wrapper for EntityDataGridComponent that emits navigation events on row double-click.\n * The host application subscribes to Navigate events and maps them to its routing system.\n *\n * This component is used by CodeGen for related entity grids in forms.\n */\n@Component({\n standalone: false,\n selector: 'mj-explorer-entity-data-grid',\n template: `\n <mj-entity-data-grid\n #innerGrid\n [Params]=\"Params\"\n [NewRecordValues]=\"NewRecordValues\"\n [AllowLoad]=\"EffectiveAllowLoad\"\n [ShowToolbar]=\"ShowToolbar\"\n [Height]=\"Height\"\n [ToolbarConfig]=\"ToolbarConfig\"\n [SelectionMode]=\"SelectionMode\"\n (AfterRowDoubleClick)=\"onRowDoubleClick($event)\"\n (AfterRowClick)=\"onRowClick($event)\"\n (AfterDataLoad)=\"onDataLoad($event)\"\n (NewRecordTabRequested)=\"onNewRecordTabRequested($event)\">\n </mj-entity-data-grid>\n `,\n styles: [`\n :host {\n display: block;\n height: 100%;\n width: 100%;\n }\n `]\n})\nexport class ExplorerEntityDataGridComponent implements AfterViewInit, OnDestroy {\n @ViewChild('innerGrid') innerGrid!: EntityDataGridComponent;\n\n private elementRef = inject(ElementRef);\n private cdr = inject(ChangeDetectorRef);\n private ngZone = inject(NgZone);\n\n // Pass-through inputs from EntityDataGridComponent\n @Input() Params: RunViewParams | null = null;\n @Input() NewRecordValues: Record<string, unknown> = {};\n @Input() AllowLoad: boolean = true;\n @Input() ShowToolbar: boolean = true;\n @Input() Height: number | 'auto' | 'fit-content' = 'auto';\n @Input() ToolbarConfig: GridToolbarConfig = {};\n @Input() SelectionMode: GridSelectionMode = 'single';\n\n /**\n * When true (default), the inner grid does not fetch until this component's host\n * element first scrolls into the viewport. This prevents related-entity grids on a\n * form — which are always rendered in the DOM (the collapsible panel hides them via\n * CSS, not @if) — from firing a RunView on form open while they're collapsed or below\n * the fold. The first time the panel becomes visible (scrolled into view and expanded,\n * giving the host non-zero area), the grid loads with its normal spinner.\n * Set to false to restore eager loading for consumers that always want immediate data.\n */\n @Input() DeferLoadUntilVisible: boolean = true;\n\n /** True once the host has first intersected the viewport (or deferral is disabled / unsupported). */\n private _hasBeenVisible = false;\n private _visibilityObserver?: IntersectionObserver;\n\n /**\n * Effective AllowLoad passed to the inner grid: the form's AllowLoad AND\n * (deferral disabled OR the panel has been seen at least once).\n */\n get EffectiveAllowLoad(): boolean {\n return this.AllowLoad && (!this.DeferLoadUntilVisible || this._hasBeenVisible);\n }\n\n ngAfterViewInit(): void {\n if (!this.DeferLoadUntilVisible || typeof IntersectionObserver === 'undefined') {\n // Deferral off or unsupported environment — preserve eager-load behavior.\n this._hasBeenVisible = true;\n return;\n }\n\n // Observe outside Angular so scroll churn doesn't trigger change detection;\n // we re-enter the zone only on the one-shot \"became visible\" transition.\n this.ngZone.runOutsideAngular(() => {\n this._visibilityObserver = new IntersectionObserver(\n (entries) => {\n if (entries.some(e => e.isIntersecting)) {\n this.onBecameVisible();\n }\n },\n // Small positive rootMargin pre-loads just before the panel scrolls fully into view.\n { root: null, rootMargin: '200px', threshold: 0 }\n );\n this._visibilityObserver.observe(this.elementRef.nativeElement);\n });\n }\n\n ngOnDestroy(): void {\n this._visibilityObserver?.disconnect();\n this._visibilityObserver = undefined;\n }\n\n private onBecameVisible(): void {\n if (this._hasBeenVisible) {\n return;\n }\n // One-shot: once loaded we never need to observe again.\n this._visibilityObserver?.disconnect();\n this._visibilityObserver = undefined;\n this.ngZone.run(() => {\n this._hasBeenVisible = true;\n // Flip EffectiveAllowLoad → true, which drives the inner grid's AllowLoad setter to load.\n this.cdr.detectChanges();\n });\n }\n\n /**\n * When true, double-clicking a row emits a Navigate event.\n * Defaults to true.\n */\n @Input() NavigateOnDoubleClick: boolean = true;\n\n // Re-emit events for consumers who need them\n @Output() AfterRowDoubleClick = new EventEmitter<AfterRowDoubleClickEventArgs>();\n @Output() AfterRowClick = new EventEmitter<AfterRowClickEventArgs>();\n @Output() AfterDataLoad = new EventEmitter<AfterDataLoadEventArgs>();\n\n /** Emitted when a row is double-clicked and NavigateOnDoubleClick is true */\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n onRowDoubleClick(event: AfterRowDoubleClickEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterRowDoubleClick.emit(event);\n\n // Emit navigation event if enabled\n if (this.NavigateOnDoubleClick && event.row) {\n // Use the inner grid's resolved EntityInfo - works for both ViewID and EntityName params\n const entityInfo = this.innerGrid?.EntityInfo;\n if (!entityInfo) return;\n\n const pkey = buildCompositeKey(event.row, entityInfo);\n\n this.Navigate.emit({\n Kind: 'record',\n EntityName: entityInfo.Name,\n PrimaryKey: pkey\n });\n }\n }\n\n onRowClick(event: AfterRowClickEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterRowClick.emit(event);\n }\n\n onDataLoad(event: AfterDataLoadEventArgs): void {\n // Re-emit the event for any consumers\n this.AfterDataLoad.emit(event);\n }\n\n /**\n * The inner grid's \"New\" button bubbles up here. We re-emit as a\n * `new-record` Navigate event so the host form (and Explorer's\n * SingleRecordComponent) can call NavigationService.OpenNewEntityRecord\n * and pre-populate the foreign-key fields from NewRecordValues.\n */\n onNewRecordTabRequested(event: { entityInfo: EntityInfo; defaultValues: Record<string, unknown> }): void {\n this.Navigate.emit({\n Kind: 'new-record',\n EntityName: event.entityInfo.Name,\n DefaultValues: event.defaultValues,\n });\n }\n}\n"]}
@@ -2,8 +2,14 @@
2
2
  * State for an individual form section (panel)
3
3
  */
4
4
  export interface FormSectionState {
5
- /** Whether the section is currently expanded */
6
- isExpanded: boolean;
5
+ /**
6
+ * Whether the section is currently expanded. Optional: `undefined` means the user has
7
+ * never explicitly expanded/collapsed this section, so the section's seeded default
8
+ * (passed by the caller / from `initSections()`) should govern. This must stay decoupled
9
+ * from `panelHeight` — persisting a height must NOT imply an expansion state, otherwise
10
+ * measuring a collapsed panel on load would silently mark it expanded.
11
+ */
12
+ isExpanded?: boolean;
7
13
  /** User-resized panel height in pixels (related-entity panels only) */
8
14
  panelHeight?: number;
9
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.interface.d.ts","sourceRoot":"","sources":["../../src/lib/form-state.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,+CAA+C;IAC/C,eAAe,EAAE,OAAO,CAAC;IACzB,oGAAoG;IACpG,SAAS,EAAE,UAAU,GAAG,YAAY,CAAC;IACrC;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAIhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,gBAEnC,CAAC"}
1
+ {"version":3,"file":"form-state.interface.d.ts","sourceRoot":"","sources":["../../src/lib/form-state.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACtB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC3C,+CAA+C;IAC/C,eAAe,EAAE,OAAO,CAAC;IACzB,oGAAoG;IACpG,SAAS,EAAE,UAAU,GAAG,YAAY,CAAC;IACrC;;;;;;;;;;OAUG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAIhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,gBAEnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.interface.js","sourceRoot":"","sources":["../../src/lib/form-state.interface.ts"],"names":[],"mappings":"AAoCA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc;IACzC,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,KAAK;IACtB,SAAS,EAAE,UAAU;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD,UAAU,EAAE,IAAI;CACnB,CAAC","sourcesContent":["/**\n * State for an individual form section (panel)\n */\nexport interface FormSectionState {\n /** Whether the section is currently expanded */\n isExpanded: boolean;\n /** User-resized panel height in pixels (related-entity panels only) */\n panelHeight?: number;\n}\n\n/**\n * Complete form state for an entity, persisted to User Settings\n */\nexport interface FormState {\n /** Per-section state, keyed by sectionKey */\n sections: Record<string, FormSectionState>;\n /** Whether to show fields with empty values */\n showEmptyFields: boolean;\n /** Form width mode - 'centered' uses max-width constraint, 'full-width' uses all available space */\n widthMode: 'centered' | 'full-width';\n /**\n * Whether `widthMode` reflects an explicit user choice (via the toolbar\n * width-toggle button) vs. a default carried along in the serialized\n * blob. Only true when `setWidthMode` has been called. Callers that want\n * to honor a component-level default should check this flag before\n * using `widthMode` — see `BaseFormComponent.getFormWidthMode`.\n *\n * Optional because pre-existing persisted blobs predate this flag; they\n * are treated as non-explicit so custom forms with their own defaults\n * can take precedence on upgrade.\n */\n widthModeExplicit?: boolean;\n /** Custom section ordering - array of sectionKeys in user's preferred order */\n sectionOrder?: string[];\n}\n\n/**\n * Default state for a new form (when no saved state exists)\n */\nexport const DEFAULT_FORM_STATE: FormState = {\n sections: {},\n showEmptyFields: false,\n widthMode: 'centered'\n};\n\n/**\n * Default state for a new section (when section not yet in saved state)\n */\nexport const DEFAULT_SECTION_STATE: FormSectionState = {\n isExpanded: true\n};\n"]}
1
+ {"version":3,"file":"form-state.interface.js","sourceRoot":"","sources":["../../src/lib/form-state.interface.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAc;IACzC,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,KAAK;IACtB,SAAS,EAAE,UAAU;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACnD,UAAU,EAAE,IAAI;CACnB,CAAC","sourcesContent":["/**\n * State for an individual form section (panel)\n */\nexport interface FormSectionState {\n /**\n * Whether the section is currently expanded. Optional: `undefined` means the user has\n * never explicitly expanded/collapsed this section, so the section's seeded default\n * (passed by the caller / from `initSections()`) should govern. This must stay decoupled\n * from `panelHeight` — persisting a height must NOT imply an expansion state, otherwise\n * measuring a collapsed panel on load would silently mark it expanded.\n */\n isExpanded?: boolean;\n /** User-resized panel height in pixels (related-entity panels only) */\n panelHeight?: number;\n}\n\n/**\n * Complete form state for an entity, persisted to User Settings\n */\nexport interface FormState {\n /** Per-section state, keyed by sectionKey */\n sections: Record<string, FormSectionState>;\n /** Whether to show fields with empty values */\n showEmptyFields: boolean;\n /** Form width mode - 'centered' uses max-width constraint, 'full-width' uses all available space */\n widthMode: 'centered' | 'full-width';\n /**\n * Whether `widthMode` reflects an explicit user choice (via the toolbar\n * width-toggle button) vs. a default carried along in the serialized\n * blob. Only true when `setWidthMode` has been called. Callers that want\n * to honor a component-level default should check this flag before\n * using `widthMode` — see `BaseFormComponent.getFormWidthMode`.\n *\n * Optional because pre-existing persisted blobs predate this flag; they\n * are treated as non-explicit so custom forms with their own defaults\n * can take precedence on upgrade.\n */\n widthModeExplicit?: boolean;\n /** Custom section ordering - array of sectionKeys in user's preferred order */\n sectionOrder?: string[];\n}\n\n/**\n * Default state for a new form (when no saved state exists)\n */\nexport const DEFAULT_FORM_STATE: FormState = {\n sections: {},\n showEmptyFields: false,\n widthMode: 'centered'\n};\n\n/**\n * Default state for a new section (when section not yet in saved state)\n */\nexport const DEFAULT_SECTION_STATE: FormSectionState = {\n isExpanded: true\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.service.d.ts","sourceRoot":"","sources":["../../src/lib/form-state.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,UAAU,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAY,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAA6C,MAAM,wBAAwB,CAAC;;AAIhH;;;;GAIG;AACH,qBAGa,gBAAgB;IACzB,gDAAgD;IAChD,OAAO,CAAC,UAAU,CAAiD;IAEnE,oDAAoD;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E,GAAG,IAAI;IAWjE;;;OAGG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAQ3C;;;;OAIG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAKlD;;;;;;;OAOG;IACH,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAUvD;;;;;OAKG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM;IAYnE;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAIrB;;OAEG;YACW,SAAS;IA+BvB;;;;OAIG;IACH,OAAO,CAAC,SAAS;yCAtbR,gBAAgB;6CAAhB,gBAAgB;CAoc5B"}
@@ -94,11 +94,14 @@ export class FormStateService {
94
94
  isSectionExpanded(entityName, sectionKey, defaultExpanded) {
95
95
  const state = this.getCurrentState(entityName);
96
96
  const sectionState = state.sections[sectionKey];
97
- if (sectionState) {
97
+ // Only honor a persisted expansion when it was EXPLICITLY set. A section entry that
98
+ // exists solely to hold a panelHeight has isExpanded === undefined and must fall through
99
+ // to the caller's seeded default (collapsed for related-entity panels).
100
+ if (sectionState && sectionState.isExpanded !== undefined) {
98
101
  return sectionState.isExpanded;
99
102
  }
100
- // No persisted state - use provided default or fall back to DEFAULT_SECTION_STATE
101
- return defaultExpanded !== undefined ? defaultExpanded : DEFAULT_SECTION_STATE.isExpanded;
103
+ // No explicit persisted state - use provided default or fall back to DEFAULT_SECTION_STATE
104
+ return defaultExpanded !== undefined ? defaultExpanded : (DEFAULT_SECTION_STATE.isExpanded ?? true);
102
105
  }
103
106
  /**
104
107
  * Set section expanded state.
@@ -318,7 +321,9 @@ export class FormStateService {
318
321
  const state = this.getCurrentState(entityName);
319
322
  return sectionKeys.filter(key => {
320
323
  const section = state.sections[key];
321
- return section ? section.isExpanded : DEFAULT_SECTION_STATE.isExpanded;
324
+ // No entry seeded global default; entry with explicit value → that value;
325
+ // entry with only a panelHeight (isExpanded undefined) → treat as collapsed.
326
+ return section ? (section.isExpanded ?? false) : DEFAULT_SECTION_STATE.isExpanded;
322
327
  }).length;
323
328
  }
324
329
  // -------------------- Private Methods --------------------
@@ -339,7 +344,10 @@ export class FormStateService {
339
344
  updateSectionState(entityName, sectionKey, updates) {
340
345
  const subject = this.getOrCreateSubject(entityName);
341
346
  const currentState = subject.value;
342
- const currentSection = currentState.sections[sectionKey] || { ...DEFAULT_SECTION_STATE };
347
+ // Start from the existing entry or an EMPTY object — do NOT seed DEFAULT_SECTION_STATE.
348
+ // Seeding it would force isExpanded:true onto a section that's only being given a
349
+ // panelHeight, silently expanding panels the user never opened.
350
+ const currentSection = currentState.sections[sectionKey] || {};
343
351
  const newState = {
344
352
  ...currentState,
345
353
  sections: {
@@ -1 +1 @@
1
- {"version":3,"file":"form-state.service.js","sourceRoot":"","sources":["../../src/lib/form-state.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAA+B,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;;AAEhH,MAAM,kBAAkB,GAAG,aAAa,CAAC;AAEzC;;;;GAIG;AAIH,MAAM,OAAO,gBAAgB;IACzB,gDAAgD;IACxC,UAAU,GAAG,IAAI,GAAG,EAAsC,CAAC;IAEnE,oDAAoD;IAC5C,cAAc,GAAG,IAAI,GAAG,EAAU,CAAC;IAE3C,wDAAwD;IAChD,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE3D,yEAAyE;IACjE,eAAe,GAAG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,gBAAgB,mBAFb,MAAM;;iFAET,gBAAgB;cAH5B,UAAU;eAAC;gBACR,UAAU,EAAE,MAAM;aACrB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { Metadata, IMetadataProvider } from '@memberjunction/core';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport { FormState, FormSectionState, DEFAULT_FORM_STATE, DEFAULT_SECTION_STATE } from './form-state.interface';\n\nconst SETTING_KEY_PREFIX = 'Form.State.';\n\n/**\n * Service for managing form state persistence per entity.\n * State is stored in the User Settings entity and shared reactively\n * across all form instances for the same entity.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class FormStateService {\n /** Cache of BehaviorSubjects per entity name */\n private stateCache = new Map<string, BehaviorSubject<FormState>>();\n\n /** Track which entities have been loaded from DB */\n private loadedEntities = new Set<string>();\n\n /** Track loading promises to prevent duplicate loads */\n private loadingPromises = new Map<string, Promise<void>>();\n\n /** Track which entities are currently in edit mode (saves suppressed) */\n private editingEntities = new Set<string>();\n\n private _provider: IMetadataProvider | null = null;\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n private get metadata(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n /**\n * Get the observable state for an entity.\n * Automatically loads from User Settings on first access.\n * @param entityName The entity name\n * @returns Observable of the form state\n */\n getState$(entityName: string): Observable<FormState> {\n return this.getOrCreateSubject(entityName).asObservable();\n }\n\n /**\n * Get the current state value for an entity.\n * @param entityName The entity name\n * @returns Current form state\n */\n getCurrentState(entityName: string): FormState {\n return this.getOrCreateSubject(entityName).value;\n }\n\n /**\n * Initialize state for an entity by loading from User Settings.\n * Call this when a form component initializes.\n * @param entityName The entity name\n */\n async initializeState(entityName: string): Promise<FormState> {\n // If already loaded, return current state\n if (this.loadedEntities.has(entityName)) {\n return this.getCurrentState(entityName);\n }\n\n // If currently loading, wait for that promise\n const existingPromise = this.loadingPromises.get(entityName);\n if (existingPromise) {\n await existingPromise;\n return this.getCurrentState(entityName);\n }\n\n // Start loading\n const loadPromise = this.loadState(entityName);\n this.loadingPromises.set(entityName, loadPromise);\n\n try {\n await loadPromise;\n this.loadedEntities.add(entityName);\n return this.getCurrentState(entityName);\n } finally {\n this.loadingPromises.delete(entityName);\n }\n }\n\n /**\n * Get section state, returning defaults if section doesn't exist yet.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @returns Section state with defaults applied\n */\n getSectionState(entityName: string, sectionKey: string): FormSectionState {\n const state = this.getCurrentState(entityName);\n return state.sections[sectionKey] || { ...DEFAULT_SECTION_STATE };\n }\n\n /**\n * Check if a section is expanded.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param defaultExpanded Optional default value to use when no persisted state exists (defaults to DEFAULT_SECTION_STATE.isExpanded)\n * @returns True if expanded\n */\n isSectionExpanded(entityName: string, sectionKey: string, defaultExpanded?: boolean): boolean {\n const state = this.getCurrentState(entityName);\n const sectionState = state.sections[sectionKey];\n if (sectionState) {\n return sectionState.isExpanded;\n }\n // No persisted state - use provided default or fall back to DEFAULT_SECTION_STATE\n return defaultExpanded !== undefined ? defaultExpanded : DEFAULT_SECTION_STATE.isExpanded;\n }\n\n /**\n * Set section expanded state.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param isExpanded Whether the section is expanded\n */\n setSectionExpanded(entityName: string, sectionKey: string, isExpanded: boolean): void {\n this.updateSectionState(entityName, sectionKey, { isExpanded });\n }\n\n /**\n * Get the persisted panel height for a section.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @returns Panel height in pixels, or undefined if no custom height is set\n */\n getSectionPanelHeight(entityName: string, sectionKey: string): number | undefined {\n const state = this.getCurrentState(entityName);\n return state.sections[sectionKey]?.panelHeight;\n }\n\n /**\n * Set the panel height for a section (persisted to User Settings).\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param height Panel height in pixels\n */\n setSectionPanelHeight(entityName: string, sectionKey: string, height: number): void {\n this.updateSectionState(entityName, sectionKey, { panelHeight: height });\n }\n\n /**\n * Toggle section expanded state.\n * @param entityName The entity name\n * @param sectionKey The section key\n */\n toggleSection(entityName: string, sectionKey: string): void {\n const current = this.isSectionExpanded(entityName, sectionKey);\n this.setSectionExpanded(entityName, sectionKey, !current);\n }\n\n /**\n * Get form width mode.\n * @param entityName The entity name\n * @returns Width mode ('centered' or 'full-width')\n */\n getWidthMode(entityName: string): 'centered' | 'full-width' {\n return this.getCurrentState(entityName).widthMode;\n }\n\n /**\n * Whether this entity has had an EXPLICIT widthMode set via the toolbar\n * width-toggle (and thus the user's choice should win over component\n * defaults). Returns false for pre-existing persisted blobs that had a\n * default `widthMode` serialized as a side effect of other state saves.\n */\n hasExplicitWidthMode(entityName: string): boolean {\n return this.getCurrentState(entityName).widthModeExplicit === true;\n }\n\n /**\n * Set form width mode. Marks the preference as explicit so it wins over\n * any component-level default in `BaseFormComponent.getFormWidthMode`.\n */\n setWidthMode(entityName: string, widthMode: 'centered' | 'full-width'): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n widthMode,\n widthModeExplicit: true\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Toggle form width mode between centered and full-width.\n * @param entityName The entity name\n */\n toggleWidthMode(entityName: string): void {\n const current = this.getWidthMode(entityName);\n this.setWidthMode(entityName, current === 'centered' ? 'full-width' : 'centered');\n }\n\n /**\n * Get showEmptyFields preference for an entity.\n * @param entityName The entity name\n * @returns Whether to show empty fields\n */\n getShowEmptyFields(entityName: string): boolean {\n return this.getCurrentState(entityName).showEmptyFields;\n }\n\n /**\n * Set showEmptyFields preference for an entity.\n * @param entityName The entity name\n * @param show Whether to show empty fields\n */\n setShowEmptyFields(entityName: string, show: boolean): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n showEmptyFields: show\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Expand all sections for an entity.\n * @param entityName The entity name\n * @param sectionKeys Array of all section keys to expand\n */\n expandAllSections(entityName: string, sectionKeys: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newSections = { ...currentState.sections };\n\n for (const key of sectionKeys) {\n newSections[key] = {\n ...DEFAULT_SECTION_STATE,\n ...newSections[key],\n isExpanded: true\n };\n }\n\n subject.next({ ...currentState, sections: newSections });\n this.queueSave(entityName);\n }\n\n /**\n * Collapse all sections for an entity.\n * @param entityName The entity name\n * @param sectionKeys Array of all section keys to collapse\n */\n collapseAllSections(entityName: string, sectionKeys: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newSections = { ...currentState.sections };\n\n for (const key of sectionKeys) {\n newSections[key] = {\n ...DEFAULT_SECTION_STATE,\n ...newSections[key],\n isExpanded: false\n };\n }\n\n subject.next({ ...currentState, sections: newSections });\n this.queueSave(entityName);\n }\n\n /**\n * Reset state to defaults for an entity.\n * @param entityName The entity name\n */\n resetToDefaults(entityName: string): void {\n const subject = this.getOrCreateSubject(entityName);\n subject.next({ ...DEFAULT_FORM_STATE });\n this.queueSave(entityName);\n }\n\n /**\n * Get the custom section order for an entity.\n * @param entityName The entity name\n * @returns Array of section keys in user's preferred order, or undefined if using default order\n */\n getSectionOrder(entityName: string): string[] | undefined {\n return this.getCurrentState(entityName).sectionOrder;\n }\n\n /**\n * Set the custom section order for an entity.\n * @param entityName The entity name\n * @param sectionOrder Array of section keys in the desired order\n */\n setSectionOrder(entityName: string, sectionOrder: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n sectionOrder\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Reset the section order to default (removes custom ordering).\n * @param entityName The entity name\n */\n resetSectionOrder(entityName: string): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const { sectionOrder: _, ...stateWithoutOrder } = currentState;\n subject.next(stateWithoutOrder as FormState);\n this.queueSave(entityName);\n }\n\n /**\n * Check if a custom section order exists for an entity.\n * @param entityName The entity name\n * @returns True if custom order exists\n */\n hasCustomSectionOrder(entityName: string): boolean {\n const order = this.getSectionOrder(entityName);\n return order !== undefined && order.length > 0;\n }\n\n /**\n * Set edit mode for an entity. While in edit mode, state changes update\n * the in-memory BehaviorSubject (so the UI stays reactive) but skip\n * database persistence. When edit mode ends, a single save is queued\n * to persist the final layout state.\n * @param entityName The entity name\n * @param editing Whether the form is entering (true) or exiting (false) edit mode\n */\n setEditMode(entityName: string, editing: boolean): void {\n if (editing) {\n this.editingEntities.add(entityName);\n } else {\n this.editingEntities.delete(entityName);\n // Persist the final state once on exit\n this.queueSave(entityName);\n }\n }\n\n /**\n * Get the count of expanded sections.\n * @param entityName The entity name\n * @param sectionKeys Array of section keys to check\n * @returns Number of expanded sections\n */\n getExpandedCount(entityName: string, sectionKeys: string[]): number {\n const state = this.getCurrentState(entityName);\n return sectionKeys.filter(key => {\n const section = state.sections[key];\n return section ? section.isExpanded : DEFAULT_SECTION_STATE.isExpanded;\n }).length;\n }\n\n // -------------------- Private Methods --------------------\n\n /**\n * Get or create the BehaviorSubject for an entity.\n */\n private getOrCreateSubject(entityName: string): BehaviorSubject<FormState> {\n let subject = this.stateCache.get(entityName);\n if (!subject) {\n subject = new BehaviorSubject<FormState>({ ...DEFAULT_FORM_STATE });\n this.stateCache.set(entityName, subject);\n }\n return subject;\n }\n\n /**\n * Update a single section's state.\n */\n private updateSectionState(entityName: string, sectionKey: string, updates: Partial<FormSectionState>): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const currentSection = currentState.sections[sectionKey] || { ...DEFAULT_SECTION_STATE };\n\n const newState: FormState = {\n ...currentState,\n sections: {\n ...currentState.sections,\n [sectionKey]: {\n ...currentSection,\n ...updates\n }\n }\n };\n\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Generate the User Settings key for an entity.\n */\n private getSettingKey(entityName: string): string {\n return `${SETTING_KEY_PREFIX}${entityName}`;\n }\n\n /**\n * Load state from User Settings using UserInfoEngine for cached access.\n */\n private async loadState(entityName: string): Promise<void> {\n try {\n const userId = this.metadata.CurrentUser?.ID;\n if (!userId) {\n return;\n }\n\n const settingKey = this.getSettingKey(entityName);\n const engine = UserInfoEngine.Instance;\n\n // Find setting from cached user settings\n const setting = engine.UserSettings.find(s => s.Setting === settingKey);\n\n const subject = this.getOrCreateSubject(entityName);\n\n if (setting?.Value) {\n const savedState = JSON.parse(setting.Value) as Partial<FormState>;\n // Merge with defaults to handle new properties. `widthModeExplicit`\n // rides along with the blob — pre-existing blobs won't have it,\n // which is the desired behavior (component defaults win).\n subject.next({ ...DEFAULT_FORM_STATE, ...savedState });\n } else {\n // No saved state, use defaults\n subject.next({ ...DEFAULT_FORM_STATE });\n }\n } catch (error) {\n console.warn(`Failed to load form state for ${entityName}:`, error);\n // Keep default state on error\n }\n }\n\n /**\n * Queue a debounced save using UserInfoEngine's centralized debounce.\n * Skipped when the entity is in edit mode to avoid persisting transient\n * layout changes made while editing a record.\n */\n private queueSave(entityName: string): void {\n if (this.editingEntities.has(entityName)) {\n return;\n }\n\n const userId = this.metadata.CurrentUser?.ID;\n if (!userId) {\n return;\n }\n\n const settingKey = this.getSettingKey(entityName);\n const state = this.getCurrentState(entityName);\n UserInfoEngine.Instance.SetSettingDebounced(settingKey, JSON.stringify(state));\n }\n}\n"]}
1
+ {"version":3,"file":"form-state.service.js","sourceRoot":"","sources":["../../src/lib/form-state.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAqB,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAA+B,kBAAkB,EAA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IAAI,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACvC,OAAO;QACX,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO;QACX,CAAC;QAED,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC/C,cAAc,CAAC,QAAQ,CAAC,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IACnF,CAAC;0GAncQ,gBAAgB;gEAAhB,gBAAgB,WAAhB,gBAAgB,mBAFb,MAAM;;iFAET,gBAAgB;cAH5B,UAAU;eAAC;gBACR,UAAU,EAAE,MAAM;aACrB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { Metadata, IMetadataProvider } from '@memberjunction/core';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport { FormState, FormSectionState, DEFAULT_FORM_STATE, DEFAULT_SECTION_STATE } from './form-state.interface';\n\nconst SETTING_KEY_PREFIX = 'Form.State.';\n\n/**\n * Service for managing form state persistence per entity.\n * State is stored in the User Settings entity and shared reactively\n * across all form instances for the same entity.\n */\n@Injectable({\n providedIn: 'root'\n})\nexport class FormStateService {\n /** Cache of BehaviorSubjects per entity name */\n private stateCache = new Map<string, BehaviorSubject<FormState>>();\n\n /** Track which entities have been loaded from DB */\n private loadedEntities = new Set<string>();\n\n /** Track loading promises to prevent duplicate loads */\n private loadingPromises = new Map<string, Promise<void>>();\n\n /** Track which entities are currently in edit mode (saves suppressed) */\n private editingEntities = new Set<string>();\n\n private _provider: IMetadataProvider | null = null;\n\n /**\n * Set the metadata provider this service should use. When unset, falls back to Metadata.Provider.\n */\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n private get metadata(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n /**\n * Get the observable state for an entity.\n * Automatically loads from User Settings on first access.\n * @param entityName The entity name\n * @returns Observable of the form state\n */\n getState$(entityName: string): Observable<FormState> {\n return this.getOrCreateSubject(entityName).asObservable();\n }\n\n /**\n * Get the current state value for an entity.\n * @param entityName The entity name\n * @returns Current form state\n */\n getCurrentState(entityName: string): FormState {\n return this.getOrCreateSubject(entityName).value;\n }\n\n /**\n * Initialize state for an entity by loading from User Settings.\n * Call this when a form component initializes.\n * @param entityName The entity name\n */\n async initializeState(entityName: string): Promise<FormState> {\n // If already loaded, return current state\n if (this.loadedEntities.has(entityName)) {\n return this.getCurrentState(entityName);\n }\n\n // If currently loading, wait for that promise\n const existingPromise = this.loadingPromises.get(entityName);\n if (existingPromise) {\n await existingPromise;\n return this.getCurrentState(entityName);\n }\n\n // Start loading\n const loadPromise = this.loadState(entityName);\n this.loadingPromises.set(entityName, loadPromise);\n\n try {\n await loadPromise;\n this.loadedEntities.add(entityName);\n return this.getCurrentState(entityName);\n } finally {\n this.loadingPromises.delete(entityName);\n }\n }\n\n /**\n * Get section state, returning defaults if section doesn't exist yet.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @returns Section state with defaults applied\n */\n getSectionState(entityName: string, sectionKey: string): FormSectionState {\n const state = this.getCurrentState(entityName);\n return state.sections[sectionKey] || { ...DEFAULT_SECTION_STATE };\n }\n\n /**\n * Check if a section is expanded.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param defaultExpanded Optional default value to use when no persisted state exists (defaults to DEFAULT_SECTION_STATE.isExpanded)\n * @returns True if expanded\n */\n isSectionExpanded(entityName: string, sectionKey: string, defaultExpanded?: boolean): boolean {\n const state = this.getCurrentState(entityName);\n const sectionState = state.sections[sectionKey];\n // Only honor a persisted expansion when it was EXPLICITLY set. A section entry that\n // exists solely to hold a panelHeight has isExpanded === undefined and must fall through\n // to the caller's seeded default (collapsed for related-entity panels).\n if (sectionState && sectionState.isExpanded !== undefined) {\n return sectionState.isExpanded;\n }\n // No explicit persisted state - use provided default or fall back to DEFAULT_SECTION_STATE\n return defaultExpanded !== undefined ? defaultExpanded : (DEFAULT_SECTION_STATE.isExpanded ?? true);\n }\n\n /**\n * Set section expanded state.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param isExpanded Whether the section is expanded\n */\n setSectionExpanded(entityName: string, sectionKey: string, isExpanded: boolean): void {\n this.updateSectionState(entityName, sectionKey, { isExpanded });\n }\n\n /**\n * Get the persisted panel height for a section.\n * @param entityName The entity name\n * @param sectionKey The section key\n * @returns Panel height in pixels, or undefined if no custom height is set\n */\n getSectionPanelHeight(entityName: string, sectionKey: string): number | undefined {\n const state = this.getCurrentState(entityName);\n return state.sections[sectionKey]?.panelHeight;\n }\n\n /**\n * Set the panel height for a section (persisted to User Settings).\n * @param entityName The entity name\n * @param sectionKey The section key\n * @param height Panel height in pixels\n */\n setSectionPanelHeight(entityName: string, sectionKey: string, height: number): void {\n this.updateSectionState(entityName, sectionKey, { panelHeight: height });\n }\n\n /**\n * Toggle section expanded state.\n * @param entityName The entity name\n * @param sectionKey The section key\n */\n toggleSection(entityName: string, sectionKey: string): void {\n const current = this.isSectionExpanded(entityName, sectionKey);\n this.setSectionExpanded(entityName, sectionKey, !current);\n }\n\n /**\n * Get form width mode.\n * @param entityName The entity name\n * @returns Width mode ('centered' or 'full-width')\n */\n getWidthMode(entityName: string): 'centered' | 'full-width' {\n return this.getCurrentState(entityName).widthMode;\n }\n\n /**\n * Whether this entity has had an EXPLICIT widthMode set via the toolbar\n * width-toggle (and thus the user's choice should win over component\n * defaults). Returns false for pre-existing persisted blobs that had a\n * default `widthMode` serialized as a side effect of other state saves.\n */\n hasExplicitWidthMode(entityName: string): boolean {\n return this.getCurrentState(entityName).widthModeExplicit === true;\n }\n\n /**\n * Set form width mode. Marks the preference as explicit so it wins over\n * any component-level default in `BaseFormComponent.getFormWidthMode`.\n */\n setWidthMode(entityName: string, widthMode: 'centered' | 'full-width'): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n widthMode,\n widthModeExplicit: true\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Toggle form width mode between centered and full-width.\n * @param entityName The entity name\n */\n toggleWidthMode(entityName: string): void {\n const current = this.getWidthMode(entityName);\n this.setWidthMode(entityName, current === 'centered' ? 'full-width' : 'centered');\n }\n\n /**\n * Get showEmptyFields preference for an entity.\n * @param entityName The entity name\n * @returns Whether to show empty fields\n */\n getShowEmptyFields(entityName: string): boolean {\n return this.getCurrentState(entityName).showEmptyFields;\n }\n\n /**\n * Set showEmptyFields preference for an entity.\n * @param entityName The entity name\n * @param show Whether to show empty fields\n */\n setShowEmptyFields(entityName: string, show: boolean): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n showEmptyFields: show\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Expand all sections for an entity.\n * @param entityName The entity name\n * @param sectionKeys Array of all section keys to expand\n */\n expandAllSections(entityName: string, sectionKeys: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newSections = { ...currentState.sections };\n\n for (const key of sectionKeys) {\n newSections[key] = {\n ...DEFAULT_SECTION_STATE,\n ...newSections[key],\n isExpanded: true\n };\n }\n\n subject.next({ ...currentState, sections: newSections });\n this.queueSave(entityName);\n }\n\n /**\n * Collapse all sections for an entity.\n * @param entityName The entity name\n * @param sectionKeys Array of all section keys to collapse\n */\n collapseAllSections(entityName: string, sectionKeys: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newSections = { ...currentState.sections };\n\n for (const key of sectionKeys) {\n newSections[key] = {\n ...DEFAULT_SECTION_STATE,\n ...newSections[key],\n isExpanded: false\n };\n }\n\n subject.next({ ...currentState, sections: newSections });\n this.queueSave(entityName);\n }\n\n /**\n * Reset state to defaults for an entity.\n * @param entityName The entity name\n */\n resetToDefaults(entityName: string): void {\n const subject = this.getOrCreateSubject(entityName);\n subject.next({ ...DEFAULT_FORM_STATE });\n this.queueSave(entityName);\n }\n\n /**\n * Get the custom section order for an entity.\n * @param entityName The entity name\n * @returns Array of section keys in user's preferred order, or undefined if using default order\n */\n getSectionOrder(entityName: string): string[] | undefined {\n return this.getCurrentState(entityName).sectionOrder;\n }\n\n /**\n * Set the custom section order for an entity.\n * @param entityName The entity name\n * @param sectionOrder Array of section keys in the desired order\n */\n setSectionOrder(entityName: string, sectionOrder: string[]): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const newState: FormState = {\n ...currentState,\n sectionOrder\n };\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Reset the section order to default (removes custom ordering).\n * @param entityName The entity name\n */\n resetSectionOrder(entityName: string): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n const { sectionOrder: _, ...stateWithoutOrder } = currentState;\n subject.next(stateWithoutOrder as FormState);\n this.queueSave(entityName);\n }\n\n /**\n * Check if a custom section order exists for an entity.\n * @param entityName The entity name\n * @returns True if custom order exists\n */\n hasCustomSectionOrder(entityName: string): boolean {\n const order = this.getSectionOrder(entityName);\n return order !== undefined && order.length > 0;\n }\n\n /**\n * Set edit mode for an entity. While in edit mode, state changes update\n * the in-memory BehaviorSubject (so the UI stays reactive) but skip\n * database persistence. When edit mode ends, a single save is queued\n * to persist the final layout state.\n * @param entityName The entity name\n * @param editing Whether the form is entering (true) or exiting (false) edit mode\n */\n setEditMode(entityName: string, editing: boolean): void {\n if (editing) {\n this.editingEntities.add(entityName);\n } else {\n this.editingEntities.delete(entityName);\n // Persist the final state once on exit\n this.queueSave(entityName);\n }\n }\n\n /**\n * Get the count of expanded sections.\n * @param entityName The entity name\n * @param sectionKeys Array of section keys to check\n * @returns Number of expanded sections\n */\n getExpandedCount(entityName: string, sectionKeys: string[]): number {\n const state = this.getCurrentState(entityName);\n return sectionKeys.filter(key => {\n const section = state.sections[key];\n // No entry → seeded global default; entry with explicit value → that value;\n // entry with only a panelHeight (isExpanded undefined) → treat as collapsed.\n return section ? (section.isExpanded ?? false) : DEFAULT_SECTION_STATE.isExpanded;\n }).length;\n }\n\n // -------------------- Private Methods --------------------\n\n /**\n * Get or create the BehaviorSubject for an entity.\n */\n private getOrCreateSubject(entityName: string): BehaviorSubject<FormState> {\n let subject = this.stateCache.get(entityName);\n if (!subject) {\n subject = new BehaviorSubject<FormState>({ ...DEFAULT_FORM_STATE });\n this.stateCache.set(entityName, subject);\n }\n return subject;\n }\n\n /**\n * Update a single section's state.\n */\n private updateSectionState(entityName: string, sectionKey: string, updates: Partial<FormSectionState>): void {\n const subject = this.getOrCreateSubject(entityName);\n const currentState = subject.value;\n // Start from the existing entry or an EMPTY object — do NOT seed DEFAULT_SECTION_STATE.\n // Seeding it would force isExpanded:true onto a section that's only being given a\n // panelHeight, silently expanding panels the user never opened.\n const currentSection = currentState.sections[sectionKey] || {};\n\n const newState: FormState = {\n ...currentState,\n sections: {\n ...currentState.sections,\n [sectionKey]: {\n ...currentSection,\n ...updates\n }\n }\n };\n\n subject.next(newState);\n this.queueSave(entityName);\n }\n\n /**\n * Generate the User Settings key for an entity.\n */\n private getSettingKey(entityName: string): string {\n return `${SETTING_KEY_PREFIX}${entityName}`;\n }\n\n /**\n * Load state from User Settings using UserInfoEngine for cached access.\n */\n private async loadState(entityName: string): Promise<void> {\n try {\n const userId = this.metadata.CurrentUser?.ID;\n if (!userId) {\n return;\n }\n\n const settingKey = this.getSettingKey(entityName);\n const engine = UserInfoEngine.Instance;\n\n // Find setting from cached user settings\n const setting = engine.UserSettings.find(s => s.Setting === settingKey);\n\n const subject = this.getOrCreateSubject(entityName);\n\n if (setting?.Value) {\n const savedState = JSON.parse(setting.Value) as Partial<FormState>;\n // Merge with defaults to handle new properties. `widthModeExplicit`\n // rides along with the blob — pre-existing blobs won't have it,\n // which is the desired behavior (component defaults win).\n subject.next({ ...DEFAULT_FORM_STATE, ...savedState });\n } else {\n // No saved state, use defaults\n subject.next({ ...DEFAULT_FORM_STATE });\n }\n } catch (error) {\n console.warn(`Failed to load form state for ${entityName}:`, error);\n // Keep default state on error\n }\n }\n\n /**\n * Queue a debounced save using UserInfoEngine's centralized debounce.\n * Skipped when the entity is in edit mode to avoid persisting transient\n * layout changes made while editing a record.\n */\n private queueSave(entityName: string): void {\n if (this.editingEntities.has(entityName)) {\n return;\n }\n\n const userId = this.metadata.CurrentUser?.ID;\n if (!userId) {\n return;\n }\n\n const settingKey = this.getSettingKey(entityName);\n const state = this.getCurrentState(entityName);\n UserInfoEngine.Instance.SetSettingDebounced(settingKey, JSON.stringify(state));\n }\n}\n"]}
@@ -94,6 +94,8 @@ export declare class MjCollapsiblePanelComponent implements OnInit, OnChanges, A
94
94
  private panelContentRef?;
95
95
  private resizeObserver?;
96
96
  private resizeDebounceTimer?;
97
+ /** ResizeObserver fires once synchronously on observe(); that initial measurement is not a user resize. */
98
+ private resizeObserverPrimed;
97
99
  /**
98
100
  * Persisted panel height for related-entity panels.
99
101
  * Returns undefined to let CSS default (400px) apply.
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-panel.component.d.ts","sourceRoot":"","sources":["../../../src/lib/panel/collapsible-panel.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACqB,YAAY,EAEtC,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAC3D,SAAS,EAE3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,s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MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAgB9B,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAUnC,SAAS,IAAI,IAAI;IAOjB,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,gBAAgB;IAaxB;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IAStC;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IA0B3B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,+BAA+B;yCAxV5B,2BAA2B;2CAA3B,2BAA2B;CA8WvC"}
@@ -145,6 +145,8 @@ export class MjCollapsiblePanelComponent {
145
145
  panelContentRef;
146
146
  resizeObserver;
147
147
  resizeDebounceTimer;
148
+ /** ResizeObserver fires once synchronously on observe(); that initial measurement is not a user resize. */
149
+ resizeObserverPrimed = false;
148
150
  /**
149
151
  * Persisted panel height for related-entity panels.
150
152
  * Returns undefined to let CSS default (400px) apply.
@@ -323,6 +325,17 @@ export class MjCollapsiblePanelComponent {
323
325
  // Run outside Angular zone to avoid triggering change detection on every resize frame
324
326
  this.ngZone.runOutsideAngular(() => {
325
327
  this.resizeObserver = new ResizeObserver((entries) => {
328
+ // Skip the synchronous initial fire emitted when observe() is called — it's the
329
+ // panel's own first measurement on load, not a user-initiated resize. Persisting
330
+ // it would write a spurious panelHeight for every panel on form open.
331
+ if (!this.resizeObserverPrimed) {
332
+ this.resizeObserverPrimed = true;
333
+ return;
334
+ }
335
+ // Only a height change while the panel is expanded reflects a genuine user drag of
336
+ // the resize handle. Ignore reflows while collapsed (e.g. content settling on load).
337
+ if (!this.Expanded)
338
+ return;
326
339
  const entry = entries[0];
327
340
  if (!entry)
328
341
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"collapsible-panel.component.js","sourceRoot":"","sources":["../../../src/lib/panel/collapsible-panel.component.ts","../../../src/lib/panel/collapsible-panel.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAAE,KAAK,EAAE,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ectorRef, inject,\n OnChanges, SimpleChanges, OnInit, AfterContentInit, AfterViewInit, OnDestroy,\n ContentChildren, QueryList, HostBinding, HostListener, ElementRef,\n ViewChild, NgZone, ViewEncapsulation\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { FormContext, PanelVariant, PanelDragStartEvent, PanelDropEvent } from '../types/form-types';\nimport { FormNavigationEvent } from '../types/navigation-events';\nimport { MjFormFieldComponent } from '../field/form-field.component';\nimport { CompositeKey } from '@memberjunction/core';\nimport { EscapeHTML, HighlightSearchMatches } from '@memberjunction/global';\n\n/**\n * Reusable collapsible panel for form sections.\n *\n * Supports three visual variants:\n * - **default**: White card with accent border (standard field sections)\n * - **related-entity**: Blue-accented card with row count badge (related entity grids)\n * - **inherited**: Purple-accented card with \"Inherited from X\" badge (IS-A parent field sections)\n *\n * Features:\n * - Expand/collapse with smooth animation\n * - Search filtering (hides non-matching panels, highlights matched names)\n * - Drag-to-reorder sections\n * - Inheritable \"Inherited from X\" badge with navigation event\n * - Row count badge for related entity sections\n *\n * @example\n * ```html\n * <mj-collapsible-panel\n * SectionKey=\"productDetails\"\n * SectionName=\"Product Details\"\n * Icon=\"fa fa-box\"\n * Variant=\"inherited\"\n * InheritedFromEntity=\"Products\"\n * [Form]=\"formComponent\"\n * [FormContext]=\"formContext\"\n * (Navigate)=\"onNavigate($event)\">\n * <mj-form-field ...></mj-form-field>\n * </mj-collapsible-panel>\n * ```\n */\n@Component({\n standalone: false,\n selector: 'mj-collapsible-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None, // Required to style projected content (grids, etc.)\n templateUrl: './collapsible-panel.component.html',\n styleUrls: ['./collapsible-panel.component.css']\n})\nexport class MjCollapsiblePanelComponent implements OnInit, OnChanges, AfterContentInit, AfterViewInit, OnDestroy {\n private cdr = inject(ChangeDetectorRef);\n private elementRef = inject(ElementRef);\n private ngZone = inject(NgZone);\n\n /** Unique key for state persistence */\n @Input() SectionKey = '';\n\n /** Display name shown in the panel header */\n @Input() SectionName = '';\n\n /** Font Awesome icon class for the panel header */\n @Input() Icon = 'fa fa-folder';\n\n /**\n * Reference to the parent form component for state delegation.\n * Expected to have IsSectionExpanded, SetSectionExpanded, getSectionDisplayOrder methods.\n */\n @Input() Form: unknown;\n\n /** Form-level context (search filter, showEmptyFields) */\n @Input() FormContext?: FormContext;\n\n /** Panel visual variant */\n @Input() Variant: PanelVariant = 'default';\n\n /** Row count badge for related entity sections */\n @Input() BadgeCount: number | undefined;\n\n /** Default expanded state when no persisted state exists */\n @Input() DefaultExpanded: boolean | undefined;\n\n /**\n * For 'inherited' variant: the parent entity name this section's fields come from.\n * Displayed as \"Inherited from X\" badge and used for navigation.\n */\n @Input() InheritedFromEntity = '';\n\n /**\n * For 'inherited' variant: the primary key to navigate to when clicking the badge.\n * (Shared PK in IS-A relationships.)\n */\n @Input() InheritedRecordPrimaryKey?: CompositeKey;\n\n // ---- Deprecated camelCase aliases (backward compat) ----\n\n /** @deprecated Use [SectionKey] instead */\n @Input('sectionKey') set _deprecatedSectionKey(value: string) { this.SectionKey = value; }\n\n /** @deprecated Use [SectionName] instead */\n @Input('sectionName') set _deprecatedSectionName(value: string) { this.SectionName = value; }\n\n /** @deprecated Use [Icon] instead */\n @Input('icon') set _deprecatedIcon(value: string) { this.Icon = value; }\n\n /** @deprecated Use [Form] instead */\n @Input('form') set _deprecatedForm(value: unknown) { this.Form = value; }\n\n /** @deprecated Use [FormContext] instead */\n @Input('formContext') set _deprecatedFormContext(value: FormContext | undefined) { this.FormContext = value; }\n\n // ---- Outputs ----\n\n @Output() DragStarted = new EventEmitter<PanelDragStartEvent>();\n @Output() DragEnded = new EventEmitter<void>();\n @Output() PanelDrop = new EventEmitter<PanelDropEvent>();\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n // ---- Content Children ----\n\n @ContentChildren(MjFormFieldComponent, { descendants: true }) FieldComponents!: QueryList<MjFormFieldComponent>;\n\n // ---- State ----\n\n DisplayName = '';\n FieldNames = '';\n IsVisible = true;\n\n @HostBinding('class')\n get HostClass(): string {\n const classes = [`mj-panel--${this.Variant}`];\n if (!this.IsVisible) classes.push('mj-search-hidden');\n if (this.IsDragging) classes.push('mj-dragging');\n if (this.IsDragOver) classes.push('mj-drag-over');\n return classes.join(' ');\n }\n\n @HostBinding('style.order')\n get CssOrder(): number {\n const formRef = this.Form as { getSectionDisplayOrder?: (key: string) => number };\n return formRef?.getSectionDisplayOrder ? formRef.getSectionDisplayOrder(this.SectionKey) : 0;\n }\n\n IsDragging = false;\n IsDragOver = false;\n\n // ---- Event relay ----\n\n /** Signals re-subscription when ContentChildren change */\n private fieldNavReset$ = new Subject<void>();\n\n // ---- Panel content resize ----\n\n @ViewChild('panelContent') private panelContentRef?: ElementRef<HTMLElement>;\n private resizeObserver?: ResizeObserver;\n private resizeDebounceTimer?: ReturnType<typeof setTimeout>;\n\n /**\n * Persisted panel height for related-entity panels.\n * Returns undefined to let CSS default (400px) apply.\n */\n get PanelContentHeight(): number | undefined {\n if (this.Variant !== 'related-entity') return undefined;\n const formRef = this.Form as { GetSectionPanelHeight?: (key: string) => number | undefined };\n return formRef?.GetSectionPanelHeight?.(this.SectionKey);\n }\n\n /** Whether drag-to-reorder is allowed (from FormContext) */\n get ReorderAllowed(): boolean {\n return this.FormContext?.allowSectionReorder !== false;\n }\n\n /** Whether the panel is expanded (delegates to form state) */\n get Expanded(): boolean {\n const formRef = this.Form as { IsSectionExpanded?: (key: string, defaultExpanded?: boolean) => boolean };\n return formRef?.IsSectionExpanded ? formRef.IsSectionExpanded(this.SectionKey, this.DefaultExpanded) : true;\n }\n\n // ---- Lifecycle ----\n\n ngOnInit(): void {\n this.DisplayName = this.SectionName;\n }\n\n ngAfterContentInit(): void {\n this.UpdateFieldNames();\n this.SubscribeToFieldNavigateEvents();\n this.FieldComponents.changes.subscribe(() => {\n this.UpdateFieldNames();\n this.SubscribeToFieldNavigateEvents();\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['SectionName']) {\n this.DisplayName = this.SectionName;\n }\n if (changes['SectionName'] || changes['FormContext']) {\n this.UpdateVisibilityAndHighlighting();\n }\n if (changes['FormContext'] && this.FieldComponents) {\n this.FieldComponents.forEach(field => {\n field.FormContext = this.FormContext;\n });\n }\n }\n\n ngAfterViewInit(): void {\n this.SetupResizeObserver();\n }\n\n ngOnDestroy(): void {\n this.fieldNavReset$.next();\n this.fieldNavReset$.complete();\n this.resizeObserver?.disconnect();\n if (this.resizeDebounceTimer) {\n clearTimeout(this.resizeDebounceTimer);\n }\n }\n\n // ---- Actions ----\n\n Toggle(): void {\n const formRef = this.Form as { SetSectionExpanded?: (key: string, expanded: boolean) => void };\n if (formRef?.SetSectionExpanded) {\n formRef.SetSectionExpanded(this.SectionKey, !this.Expanded);\n this.cdr.markForCheck();\n }\n }\n\n /**\n * Navigate to the parent entity when clicking the \"Inherited from X\" badge.\n * Derives the PrimaryKey from the Form's record when InheritedRecordPrimaryKey\n * is not explicitly provided (which is the common case in generated templates).\n */\n OnInheritedBadgeClick(event: MouseEvent): void {\n event.stopPropagation();\n if (!this.InheritedFromEntity) return;\n\n const primaryKey = this.InheritedRecordPrimaryKey\n ?? (this.Form as { record?: { PrimaryKey: CompositeKey } })?.record?.PrimaryKey\n ?? new CompositeKey([]);\n\n this.Navigate.emit({\n Kind: 'entity-hierarchy',\n EntityName: this.InheritedFromEntity,\n PrimaryKey: primaryKey,\n Direction: 'parent'\n });\n }\n\n // ---- Drag and Drop ----\n\n @HostListener('dragover', ['$event'])\n OnDragOver(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n event.stopPropagation();\n if (event.dataTransfer?.types.includes('text/plain')) {\n this.IsDragOver = true;\n }\n }\n\n @HostListener('dragleave', ['$event'])\n OnDragLeave(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n this.IsDragOver = false;\n }\n\n @HostListener('drop', ['$event'])\n OnDrop(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n event.stopPropagation();\n this.IsDragOver = false;\n\n const sourceSectionKey = event.dataTransfer?.getData('text/plain');\n if (sourceSectionKey && sourceSectionKey !== this.SectionKey) {\n this.PanelDrop.emit({\n SourceSectionKey: sourceSectionKey,\n TargetSectionKey: this.SectionKey\n });\n this.ReorderSections(sourceSectionKey, this.SectionKey);\n }\n }\n\n OnDragStart(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n this.IsDragging = true;\n event.dataTransfer?.setData('text/plain', this.SectionKey);\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = 'move';\n }\n this.DragStarted.emit({ SectionKey: this.SectionKey, Event: event });\n }\n\n OnDragEnd(): void {\n this.IsDragging = false;\n this.DragEnded.emit();\n }\n\n // ---- Private Methods ----\n\n private ReorderSections(sourceSectionKey: string, targetSectionKey: string): void {\n const formRef = this.Form as {\n getSectionOrder?: () => string[];\n setSectionOrder?: (order: string[]) => void;\n };\n if (!formRef?.getSectionOrder || !formRef?.setSectionOrder) return;\n\n const currentOrder = formRef.getSectionOrder();\n const sourceIndex = currentOrder.indexOf(sourceSectionKey);\n const targetIndex = currentOrder.indexOf(targetSectionKey);\n if (sourceIndex === -1 || targetIndex === -1) return;\n\n const newOrder = [...currentOrder];\n newOrder.splice(sourceIndex, 1);\n newOrder.splice(targetIndex, 0, sourceSectionKey);\n formRef.setSectionOrder(newOrder);\n this.cdr.markForCheck();\n }\n\n private UpdateFieldNames(): void {\n if (this.FieldComponents) {\n const names: string[] = [];\n this.FieldComponents.forEach(field => {\n if (field.DisplayName) {\n names.push(field.DisplayName.toLowerCase());\n }\n });\n this.FieldNames = names.join(' ');\n this.UpdateVisibilityAndHighlighting();\n }\n }\n\n /**\n * Subscribes to Navigate events from all child form-field components\n * and relays them through this panel's Navigate output.\n */\n private SubscribeToFieldNavigateEvents(): void {\n this.fieldNavReset$.next(); // tear down previous subscriptions\n this.FieldComponents.forEach(field => {\n field.Navigate.pipe(takeUntil(this.fieldNavReset$)).subscribe((event: FormNavigationEvent) => {\n this.Navigate.emit(event);\n });\n });\n }\n\n /**\n * Sets up a ResizeObserver on the panel content div for related-entity panels.\n * When the user drags the CSS resize handle, we persist the new height.\n */\n private SetupResizeObserver(): void {\n if (this.Variant !== 'related-entity' || !this.panelContentRef) return;\n\n const el = this.panelContentRef.nativeElement;\n // Run outside Angular zone to avoid triggering change detection on every resize frame\n this.ngZone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver((entries) => {\n const entry = entries[0];\n if (!entry) return;\n const newHeight = Math.round(entry.contentRect.height);\n this.DebouncePersistHeight(newHeight);\n });\n this.resizeObserver.observe(el);\n });\n }\n\n /**\n * Debounces height persistence so we don't write to DB on every resize frame.\n */\n private DebouncePersistHeight(height: number): void {\n if (this.resizeDebounceTimer) {\n clearTimeout(this.resizeDebounceTimer);\n }\n this.resizeDebounceTimer = setTimeout(() => {\n const formRef = this.Form as { SetSectionPanelHeight?: (key: string, height: number) => void };\n formRef?.SetSectionPanelHeight?.(this.SectionKey, height);\n }, 500);\n }\n\n private UpdateVisibilityAndHighlighting(): void {\n const searchTerm = (this.FormContext?.sectionFilter || '').toLowerCase().trim();\n\n if (!searchTerm) {\n this.IsVisible = true;\n this.DisplayName = this.SectionName;\n this.cdr.markForCheck();\n return;\n }\n\n const sectionMatches = this.SectionName.toLowerCase().includes(searchTerm);\n const fieldsMatch = this.FieldNames.includes(searchTerm);\n this.IsVisible = sectionMatches || fieldsMatch;\n\n // DisplayName is bound to `[innerHTML]` in the template — must always be HTML-safe.\n this.DisplayName =\n this.IsVisible && sectionMatches\n ? HighlightSearchMatches(this.SectionName, searchTerm, 'mj-forms-search-highlight')\n : EscapeHTML(this.SectionName);\n\n this.cdr.markForCheck();\n }\n}\n","<div class=\"mj-forms-panel\"\n [class.mj-forms-panel--related]=\"Variant === 'related-entity'\"\n [class.mj-forms-panel--inherited]=\"Variant === 'inherited'\"\n [attr.data-section-key]=\"SectionKey\">\n\n <!-- Panel Header -->\n <div class=\"mj-forms-panel-header\" role=\"button\" tabindex=\"0\" (click)=\"Toggle()\">\n <!-- Drag Handle (hidden when reorder disabled) -->\n @if (ReorderAllowed) {\n <div class=\"mj-forms-drag-handle\"\n title=\"Drag to reorder sections\"\n draggable=\"true\"\n (dragstart)=\"OnDragStart($event)\"\n (dragend)=\"OnDragEnd()\"\n (click)=\"$event.stopPropagation()\">\n <i class=\"fa-solid fa-grip-vertical\"></i>\n </div>\n }\n\n <!-- Icon + Title -->\n <div class=\"mj-forms-panel-title-group\">\n <i [class]=\"Icon\" class=\"mj-forms-panel-icon\"></i>\n <h3 class=\"mj-forms-panel-title\">\n <span [innerHTML]=\"DisplayName\"></span>\n <!-- Row count badge for related entities -->\n @if (BadgeCount !== undefined) {\n <span class=\"mj-forms-row-count-badge\" [class.mj-forms-row-count-badge--zero]=\"BadgeCount === 0\">\n {{ BadgeCount }}\n </span>\n }\n </h3>\n </div>\n\n <!-- Inherited From badge (IS-A) -->\n @if (Variant === 'inherited' && InheritedFromEntity) {\n <a class=\"mj-forms-inherited-badge\" (click)=\"OnInheritedBadgeClick($event)\"\n [title]=\"'View parent record: ' + InheritedFromEntity\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n Inherited from {{ InheritedFromEntity }}\n </a>\n }\n\n <!-- Chevron -->\n <div class=\"mj-forms-panel-chevron\">\n <i [class]=\"Expanded ? 'fa fa-chevron-up' : 'fa fa-chevron-down'\"></i>\n </div>\n </div>\n\n <!-- Panel Body -->\n <div class=\"mj-forms-panel-body\" [class.mj-forms-panel-body--collapsed]=\"!Expanded\">\n <div class=\"mj-forms-panel-content\"\n #panelContent\n [style.height.px]=\"PanelContentHeight\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n"]}
1
+ {"version":3,"file":"collapsible-panel.component.js","sourceRoot":"","sources":["../../../src/lib/panel/collapsible-panel.component.ts","../../../src/lib/panel/collapsible-panel.component.html"],"names":[],"mappings":"AAAA,OA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AE;;kBAQ3D,WAAW;mBAAC,OAAO;;kBASnB,WAAW;mBAAC,aAAa;;kBAgBzB,SAAS;mBAAC,cAAc;;kBAsGxB,YAAY;mBAAC,UAAU,EAAE,CAAC,QAAQ,CAAC;;kBAUnC,YAAY;mBAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;;kBAOpC,YAAY;mBAAC,MAAM,EAAE,CAAC,QAAQ,CAAC;;kFA9NrB,2BAA2B","sourcesContent":["import {\n Component, Input, Output, EventEmitter,\n ChangeDetectionStrategy, ChangeDetectorRef, inject,\n OnChanges, SimpleChanges, OnInit, AfterContentInit, AfterViewInit, OnDestroy,\n ContentChildren, QueryList, HostBinding, HostListener, ElementRef,\n ViewChild, NgZone, ViewEncapsulation\n} from '@angular/core';\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { FormContext, PanelVariant, PanelDragStartEvent, PanelDropEvent } from '../types/form-types';\nimport { FormNavigationEvent } from '../types/navigation-events';\nimport { MjFormFieldComponent } from '../field/form-field.component';\nimport { CompositeKey } from '@memberjunction/core';\nimport { EscapeHTML, HighlightSearchMatches } from '@memberjunction/global';\n\n/**\n * Reusable collapsible panel for form sections.\n *\n * Supports three visual variants:\n * - **default**: White card with accent border (standard field sections)\n * - **related-entity**: Blue-accented card with row count badge (related entity grids)\n * - **inherited**: Purple-accented card with \"Inherited from X\" badge (IS-A parent field sections)\n *\n * Features:\n * - Expand/collapse with smooth animation\n * - Search filtering (hides non-matching panels, highlights matched names)\n * - Drag-to-reorder sections\n * - Inheritable \"Inherited from X\" badge with navigation event\n * - Row count badge for related entity sections\n *\n * @example\n * ```html\n * <mj-collapsible-panel\n * SectionKey=\"productDetails\"\n * SectionName=\"Product Details\"\n * Icon=\"fa fa-box\"\n * Variant=\"inherited\"\n * InheritedFromEntity=\"Products\"\n * [Form]=\"formComponent\"\n * [FormContext]=\"formContext\"\n * (Navigate)=\"onNavigate($event)\">\n * <mj-form-field ...></mj-form-field>\n * </mj-collapsible-panel>\n * ```\n */\n@Component({\n standalone: false,\n selector: 'mj-collapsible-panel',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None, // Required to style projected content (grids, etc.)\n templateUrl: './collapsible-panel.component.html',\n styleUrls: ['./collapsible-panel.component.css']\n})\nexport class MjCollapsiblePanelComponent implements OnInit, OnChanges, AfterContentInit, AfterViewInit, OnDestroy {\n private cdr = inject(ChangeDetectorRef);\n private elementRef = inject(ElementRef);\n private ngZone = inject(NgZone);\n\n /** Unique key for state persistence */\n @Input() SectionKey = '';\n\n /** Display name shown in the panel header */\n @Input() SectionName = '';\n\n /** Font Awesome icon class for the panel header */\n @Input() Icon = 'fa fa-folder';\n\n /**\n * Reference to the parent form component for state delegation.\n * Expected to have IsSectionExpanded, SetSectionExpanded, getSectionDisplayOrder methods.\n */\n @Input() Form: unknown;\n\n /** Form-level context (search filter, showEmptyFields) */\n @Input() FormContext?: FormContext;\n\n /** Panel visual variant */\n @Input() Variant: PanelVariant = 'default';\n\n /** Row count badge for related entity sections */\n @Input() BadgeCount: number | undefined;\n\n /** Default expanded state when no persisted state exists */\n @Input() DefaultExpanded: boolean | undefined;\n\n /**\n * For 'inherited' variant: the parent entity name this section's fields come from.\n * Displayed as \"Inherited from X\" badge and used for navigation.\n */\n @Input() InheritedFromEntity = '';\n\n /**\n * For 'inherited' variant: the primary key to navigate to when clicking the badge.\n * (Shared PK in IS-A relationships.)\n */\n @Input() InheritedRecordPrimaryKey?: CompositeKey;\n\n // ---- Deprecated camelCase aliases (backward compat) ----\n\n /** @deprecated Use [SectionKey] instead */\n @Input('sectionKey') set _deprecatedSectionKey(value: string) { this.SectionKey = value; }\n\n /** @deprecated Use [SectionName] instead */\n @Input('sectionName') set _deprecatedSectionName(value: string) { this.SectionName = value; }\n\n /** @deprecated Use [Icon] instead */\n @Input('icon') set _deprecatedIcon(value: string) { this.Icon = value; }\n\n /** @deprecated Use [Form] instead */\n @Input('form') set _deprecatedForm(value: unknown) { this.Form = value; }\n\n /** @deprecated Use [FormContext] instead */\n @Input('formContext') set _deprecatedFormContext(value: FormContext | undefined) { this.FormContext = value; }\n\n // ---- Outputs ----\n\n @Output() DragStarted = new EventEmitter<PanelDragStartEvent>();\n @Output() DragEnded = new EventEmitter<void>();\n @Output() PanelDrop = new EventEmitter<PanelDropEvent>();\n @Output() Navigate = new EventEmitter<FormNavigationEvent>();\n\n // ---- Content Children ----\n\n @ContentChildren(MjFormFieldComponent, { descendants: true }) FieldComponents!: QueryList<MjFormFieldComponent>;\n\n // ---- State ----\n\n DisplayName = '';\n FieldNames = '';\n IsVisible = true;\n\n @HostBinding('class')\n get HostClass(): string {\n const classes = [`mj-panel--${this.Variant}`];\n if (!this.IsVisible) classes.push('mj-search-hidden');\n if (this.IsDragging) classes.push('mj-dragging');\n if (this.IsDragOver) classes.push('mj-drag-over');\n return classes.join(' ');\n }\n\n @HostBinding('style.order')\n get CssOrder(): number {\n const formRef = this.Form as { getSectionDisplayOrder?: (key: string) => number };\n return formRef?.getSectionDisplayOrder ? formRef.getSectionDisplayOrder(this.SectionKey) : 0;\n }\n\n IsDragging = false;\n IsDragOver = false;\n\n // ---- Event relay ----\n\n /** Signals re-subscription when ContentChildren change */\n private fieldNavReset$ = new Subject<void>();\n\n // ---- Panel content resize ----\n\n @ViewChild('panelContent') private panelContentRef?: ElementRef<HTMLElement>;\n private resizeObserver?: ResizeObserver;\n private resizeDebounceTimer?: ReturnType<typeof setTimeout>;\n /** ResizeObserver fires once synchronously on observe(); that initial measurement is not a user resize. */\n private resizeObserverPrimed = false;\n\n /**\n * Persisted panel height for related-entity panels.\n * Returns undefined to let CSS default (400px) apply.\n */\n get PanelContentHeight(): number | undefined {\n if (this.Variant !== 'related-entity') return undefined;\n const formRef = this.Form as { GetSectionPanelHeight?: (key: string) => number | undefined };\n return formRef?.GetSectionPanelHeight?.(this.SectionKey);\n }\n\n /** Whether drag-to-reorder is allowed (from FormContext) */\n get ReorderAllowed(): boolean {\n return this.FormContext?.allowSectionReorder !== false;\n }\n\n /** Whether the panel is expanded (delegates to form state) */\n get Expanded(): boolean {\n const formRef = this.Form as { IsSectionExpanded?: (key: string, defaultExpanded?: boolean) => boolean };\n return formRef?.IsSectionExpanded ? formRef.IsSectionExpanded(this.SectionKey, this.DefaultExpanded) : true;\n }\n\n // ---- Lifecycle ----\n\n ngOnInit(): void {\n this.DisplayName = this.SectionName;\n }\n\n ngAfterContentInit(): void {\n this.UpdateFieldNames();\n this.SubscribeToFieldNavigateEvents();\n this.FieldComponents.changes.subscribe(() => {\n this.UpdateFieldNames();\n this.SubscribeToFieldNavigateEvents();\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['SectionName']) {\n this.DisplayName = this.SectionName;\n }\n if (changes['SectionName'] || changes['FormContext']) {\n this.UpdateVisibilityAndHighlighting();\n }\n if (changes['FormContext'] && this.FieldComponents) {\n this.FieldComponents.forEach(field => {\n field.FormContext = this.FormContext;\n });\n }\n }\n\n ngAfterViewInit(): void {\n this.SetupResizeObserver();\n }\n\n ngOnDestroy(): void {\n this.fieldNavReset$.next();\n this.fieldNavReset$.complete();\n this.resizeObserver?.disconnect();\n if (this.resizeDebounceTimer) {\n clearTimeout(this.resizeDebounceTimer);\n }\n }\n\n // ---- Actions ----\n\n Toggle(): void {\n const formRef = this.Form as { SetSectionExpanded?: (key: string, expanded: boolean) => void };\n if (formRef?.SetSectionExpanded) {\n formRef.SetSectionExpanded(this.SectionKey, !this.Expanded);\n this.cdr.markForCheck();\n }\n }\n\n /**\n * Navigate to the parent entity when clicking the \"Inherited from X\" badge.\n * Derives the PrimaryKey from the Form's record when InheritedRecordPrimaryKey\n * is not explicitly provided (which is the common case in generated templates).\n */\n OnInheritedBadgeClick(event: MouseEvent): void {\n event.stopPropagation();\n if (!this.InheritedFromEntity) return;\n\n const primaryKey = this.InheritedRecordPrimaryKey\n ?? (this.Form as { record?: { PrimaryKey: CompositeKey } })?.record?.PrimaryKey\n ?? new CompositeKey([]);\n\n this.Navigate.emit({\n Kind: 'entity-hierarchy',\n EntityName: this.InheritedFromEntity,\n PrimaryKey: primaryKey,\n Direction: 'parent'\n });\n }\n\n // ---- Drag and Drop ----\n\n @HostListener('dragover', ['$event'])\n OnDragOver(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n event.stopPropagation();\n if (event.dataTransfer?.types.includes('text/plain')) {\n this.IsDragOver = true;\n }\n }\n\n @HostListener('dragleave', ['$event'])\n OnDragLeave(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n this.IsDragOver = false;\n }\n\n @HostListener('drop', ['$event'])\n OnDrop(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n event.preventDefault();\n event.stopPropagation();\n this.IsDragOver = false;\n\n const sourceSectionKey = event.dataTransfer?.getData('text/plain');\n if (sourceSectionKey && sourceSectionKey !== this.SectionKey) {\n this.PanelDrop.emit({\n SourceSectionKey: sourceSectionKey,\n TargetSectionKey: this.SectionKey\n });\n this.ReorderSections(sourceSectionKey, this.SectionKey);\n }\n }\n\n OnDragStart(event: DragEvent): void {\n if (!this.ReorderAllowed) return;\n this.IsDragging = true;\n event.dataTransfer?.setData('text/plain', this.SectionKey);\n if (event.dataTransfer) {\n event.dataTransfer.effectAllowed = 'move';\n }\n this.DragStarted.emit({ SectionKey: this.SectionKey, Event: event });\n }\n\n OnDragEnd(): void {\n this.IsDragging = false;\n this.DragEnded.emit();\n }\n\n // ---- Private Methods ----\n\n private ReorderSections(sourceSectionKey: string, targetSectionKey: string): void {\n const formRef = this.Form as {\n getSectionOrder?: () => string[];\n setSectionOrder?: (order: string[]) => void;\n };\n if (!formRef?.getSectionOrder || !formRef?.setSectionOrder) return;\n\n const currentOrder = formRef.getSectionOrder();\n const sourceIndex = currentOrder.indexOf(sourceSectionKey);\n const targetIndex = currentOrder.indexOf(targetSectionKey);\n if (sourceIndex === -1 || targetIndex === -1) return;\n\n const newOrder = [...currentOrder];\n newOrder.splice(sourceIndex, 1);\n newOrder.splice(targetIndex, 0, sourceSectionKey);\n formRef.setSectionOrder(newOrder);\n this.cdr.markForCheck();\n }\n\n private UpdateFieldNames(): void {\n if (this.FieldComponents) {\n const names: string[] = [];\n this.FieldComponents.forEach(field => {\n if (field.DisplayName) {\n names.push(field.DisplayName.toLowerCase());\n }\n });\n this.FieldNames = names.join(' ');\n this.UpdateVisibilityAndHighlighting();\n }\n }\n\n /**\n * Subscribes to Navigate events from all child form-field components\n * and relays them through this panel's Navigate output.\n */\n private SubscribeToFieldNavigateEvents(): void {\n this.fieldNavReset$.next(); // tear down previous subscriptions\n this.FieldComponents.forEach(field => {\n field.Navigate.pipe(takeUntil(this.fieldNavReset$)).subscribe((event: FormNavigationEvent) => {\n this.Navigate.emit(event);\n });\n });\n }\n\n /**\n * Sets up a ResizeObserver on the panel content div for related-entity panels.\n * When the user drags the CSS resize handle, we persist the new height.\n */\n private SetupResizeObserver(): void {\n if (this.Variant !== 'related-entity' || !this.panelContentRef) return;\n\n const el = this.panelContentRef.nativeElement;\n // Run outside Angular zone to avoid triggering change detection on every resize frame\n this.ngZone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver((entries) => {\n // Skip the synchronous initial fire emitted when observe() is called — it's the\n // panel's own first measurement on load, not a user-initiated resize. Persisting\n // it would write a spurious panelHeight for every panel on form open.\n if (!this.resizeObserverPrimed) {\n this.resizeObserverPrimed = true;\n return;\n }\n // Only a height change while the panel is expanded reflects a genuine user drag of\n // the resize handle. Ignore reflows while collapsed (e.g. content settling on load).\n if (!this.Expanded) return;\n const entry = entries[0];\n if (!entry) return;\n const newHeight = Math.round(entry.contentRect.height);\n this.DebouncePersistHeight(newHeight);\n });\n this.resizeObserver.observe(el);\n });\n }\n\n /**\n * Debounces height persistence so we don't write to DB on every resize frame.\n */\n private DebouncePersistHeight(height: number): void {\n if (this.resizeDebounceTimer) {\n clearTimeout(this.resizeDebounceTimer);\n }\n this.resizeDebounceTimer = setTimeout(() => {\n const formRef = this.Form as { SetSectionPanelHeight?: (key: string, height: number) => void };\n formRef?.SetSectionPanelHeight?.(this.SectionKey, height);\n }, 500);\n }\n\n private UpdateVisibilityAndHighlighting(): void {\n const searchTerm = (this.FormContext?.sectionFilter || '').toLowerCase().trim();\n\n if (!searchTerm) {\n this.IsVisible = true;\n this.DisplayName = this.SectionName;\n this.cdr.markForCheck();\n return;\n }\n\n const sectionMatches = this.SectionName.toLowerCase().includes(searchTerm);\n const fieldsMatch = this.FieldNames.includes(searchTerm);\n this.IsVisible = sectionMatches || fieldsMatch;\n\n // DisplayName is bound to `[innerHTML]` in the template — must always be HTML-safe.\n this.DisplayName =\n this.IsVisible && sectionMatches\n ? HighlightSearchMatches(this.SectionName, searchTerm, 'mj-forms-search-highlight')\n : EscapeHTML(this.SectionName);\n\n this.cdr.markForCheck();\n }\n}\n","<div class=\"mj-forms-panel\"\n [class.mj-forms-panel--related]=\"Variant === 'related-entity'\"\n [class.mj-forms-panel--inherited]=\"Variant === 'inherited'\"\n [attr.data-section-key]=\"SectionKey\">\n\n <!-- Panel Header -->\n <div class=\"mj-forms-panel-header\" role=\"button\" tabindex=\"0\" (click)=\"Toggle()\">\n <!-- Drag Handle (hidden when reorder disabled) -->\n @if (ReorderAllowed) {\n <div class=\"mj-forms-drag-handle\"\n title=\"Drag to reorder sections\"\n draggable=\"true\"\n (dragstart)=\"OnDragStart($event)\"\n (dragend)=\"OnDragEnd()\"\n (click)=\"$event.stopPropagation()\">\n <i class=\"fa-solid fa-grip-vertical\"></i>\n </div>\n }\n\n <!-- Icon + Title -->\n <div class=\"mj-forms-panel-title-group\">\n <i [class]=\"Icon\" class=\"mj-forms-panel-icon\"></i>\n <h3 class=\"mj-forms-panel-title\">\n <span [innerHTML]=\"DisplayName\"></span>\n <!-- Row count badge for related entities -->\n @if (BadgeCount !== undefined) {\n <span class=\"mj-forms-row-count-badge\" [class.mj-forms-row-count-badge--zero]=\"BadgeCount === 0\">\n {{ BadgeCount }}\n </span>\n }\n </h3>\n </div>\n\n <!-- Inherited From badge (IS-A) -->\n @if (Variant === 'inherited' && InheritedFromEntity) {\n <a class=\"mj-forms-inherited-badge\" (click)=\"OnInheritedBadgeClick($event)\"\n [title]=\"'View parent record: ' + InheritedFromEntity\">\n <i class=\"fa-solid fa-arrow-up\"></i>\n Inherited from {{ InheritedFromEntity }}\n </a>\n }\n\n <!-- Chevron -->\n <div class=\"mj-forms-panel-chevron\">\n <i [class]=\"Expanded ? 'fa fa-chevron-up' : 'fa fa-chevron-down'\"></i>\n </div>\n </div>\n\n <!-- Panel Body -->\n <div class=\"mj-forms-panel-body\" [class.mj-forms-panel-body--collapsed]=\"!Expanded\">\n <div class=\"mj-forms-panel-content\"\n #panelContent\n [style.height.px]=\"PanelContentHeight\">\n <ng-content></ng-content>\n </div>\n </div>\n</div>\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-base-forms",
3
- "version": "5.34.1",
3
+ "version": "5.36.0",
4
4
  "description": "MemberJunction: Generic Angular form components for rendering and editing entity records. Provides configurable toolbar, modern form fields (PrimeNG unstyled), 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",
@@ -36,15 +36,15 @@
36
36
  "primeng": "21.1.1"
37
37
  },
38
38
  "dependencies": {
39
- "@memberjunction/core": "5.34.1",
40
- "@memberjunction/core-entities": "5.34.1",
41
- "@memberjunction/global": "5.34.1",
42
- "@memberjunction/ng-base-types": "5.34.1",
43
- "@memberjunction/ng-list-management": "5.34.1",
44
- "@memberjunction/ng-notifications": "5.34.1",
45
- "@memberjunction/ng-record-changes": "5.34.1",
46
- "@memberjunction/ng-record-tags": "5.34.1",
47
- "@memberjunction/ng-entity-viewer": "5.34.1",
39
+ "@memberjunction/core": "5.36.0",
40
+ "@memberjunction/core-entities": "5.36.0",
41
+ "@memberjunction/global": "5.36.0",
42
+ "@memberjunction/ng-base-types": "5.36.0",
43
+ "@memberjunction/ng-list-management": "5.36.0",
44
+ "@memberjunction/ng-notifications": "5.36.0",
45
+ "@memberjunction/ng-record-changes": "5.36.0",
46
+ "@memberjunction/ng-record-tags": "5.36.0",
47
+ "@memberjunction/ng-entity-viewer": "5.36.0",
48
48
  "rxjs": "^7.8.2",
49
49
  "tslib": "^2.8.1"
50
50
  },