@memberjunction/ng-base-forms 5.43.0 → 5.44.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.
@@ -140,6 +140,11 @@ export class FormResolverService {
140
140
  LogError(`FormResolverService: InteractiveFormsEngine.Config failed: ${err instanceof Error ? err.message : String(err)}`);
141
141
  return [];
142
142
  }
143
+ // If the engine couldn't load due to permission denial, fall back to
144
+ // the generated form — no overrides available.
145
+ if (InteractiveFormsEngine.Instance.IsPermissionConstrained) {
146
+ return [];
147
+ }
143
148
  const userRoleIds = new Set((user.UserRoles ?? []).map(r => r.RoleID).filter((id) => !!id));
144
149
  // Filter cached overrides for this (entity, user, roles) tuple.
145
150
  // Includes Active + Pending + Inactive (the variant picker shows
@@ -1 +1 @@
1
- {"version":3,"file":"form-resolver.service.js","sourceRoot":"","sources":["../../../src/lib/resolver/form-resolver.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,eAAe,CAAC;AACjD,OAAO,EAA2C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;;AA4B/D;;;;;;;;;;;;GAYG;AACH,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,OAAO,mBAAmB;IAE5B,KAAK,CAAC,oBAAoB,CACtB,MAAkB,EAClB,IAAc,EACd,QAA2B;QAE3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC3E,MAAM,MAAM,G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,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,UAAU,KAAK,mBAAmB,CAAC,yBAAyB,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,UAAU,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;YACtF,IAAI,GAAG;gBAAE,OAAO,GAAG,CAAC;YACpB,iEAAiE;YACjE,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC;IAC7D,CAAC;6GA5MQ,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB,mBADN,MAAM;;iFACnB,mBAAmB;cAD/B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { IMetadataProvider, UserInfo, EntityInfo, LogError } from '@memberjunction/core';\nimport { InteractiveFormsEngine } from '@memberjunction/core-entities';\nimport { MJGlobal, UUIDsEqual } from '@memberjunction/global';\nimport { BaseFormComponent } from '../base-form-component';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\n\n/**\n * Slim row shape for an `EntityFormOverride` lookup. Resolution doesn't need\n * the full BaseEntity object — `simple` ResultType is faster and avoids a\n * compile-time dependency on the generated entity class. The row is only ever\n * read by the resolver; mutation goes through the generated entity in other\n * code paths (Studio, AI authoring).\n */\nexport interface EntityFormOverrideRow {\n ID: string;\n EntityID: string;\n ComponentID: string;\n Scope: 'User' | 'Role' | 'Global';\n UserID: string | null;\n RoleID: string | null;\n Priority: number;\n Status: 'Active' | 'Inactive' | 'Pending';\n Name?: string;\n Description?: string | null;\n}\n\n/** Resolved form kind for a given (entity, user, roles) tuple. */\nexport type FormResolution =\n | { kind: 'interactive'; override: EntityFormOverrideRow; variants: EntityFormOverrideRow[] }\n | { kind: 'class'; subClass: Type<BaseFormComponent>; variants: EntityFormOverrideRow[] }\n | { kind: 'none'; variants: EntityFormOverrideRow[] };\n\n/**\n * UserInfoEngine setting-key prefix for per-user, per-entity form-variant\n * preferences. Persisted to `MJ: User Settings` so the choice follows the\n * user across browsers and devices — localStorage is intentionally NOT used.\n *\n * Key format: `mj.formVariant.<entityname-lowercased>`.\n *\n * Value is one of:\n * - an `EntityFormOverride.ID` (UUID) → use that specific override\n * - {@link FormResolverService.EXPLICIT_DEFAULT_SENTINEL} → user picked\n * the CodeGen Angular fallback explicitly; resolver skips all overrides\n * - (key absent) → no preference, apply auto-pick rules\n */\nconst VARIANT_SETTING_PREFIX = 'mj.formVariant.';\n\n/**\n * Picks the form to render for an entity record and exposes the full list of\n * applicable variants so the toolbar's variant switcher can offer alternates.\n *\n * Tier order for the **default** pick:\n * 1. `EntityFormOverride` row matching the caller's User/Role/Global scope,\n * Status='Active', ordered by scope tier (User > Role > Global), then\n * Priority DESC, then `__mj_CreatedAt DESC`. First row wins.\n * 2. Existing `ClassFactory.GetRegistration(BaseFormComponent, entityName)` —\n * the @RegisterClass + CodeGen-generated path used today.\n * 3. None — caller surfaces the \"no form registered\" error.\n *\n * **Session selection.** If the user previously chose a non-default variant\n * via the variant switcher and that choice is still applicable + Active, that\n * choice wins over the default. Choice is keyed by entity name in\n * `localStorage`. Honoring this is part of the variant-switcher contract;\n * without it, switching variants would only last for the lifetime of the\n * record-form view.\n *\n * **Performance.** Backed by `InteractiveFormsEngine` (in MJCoreEntities)\n * — overrides are cached in memory with BaseEntity event-driven\n * invalidation, so resolution is an O(N) JS filter against a small\n * set instead of a per-LoadForm RunView round-trip. Cold latency\n * dropped from ~50ms to <1ms after the first load. The engine is\n * lazy-Config'd here on first resolution; users who never open a\n * record pay nothing.\n */\n@Injectable({ providedIn: 'root' })\nexport class FormResolverService {\n\n async ResolveFormForEntity(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<FormResolution> {\n const variants = await this.listApplicableVariants(entity, user, provider);\n const active = this.pickActive(entity, variants);\n\n if (active) {\n return { kind: 'interactive', override: active, variants };\n }\n\n const reg = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormComponent, entity.Name);\n return reg\n ? { kind: 'class', subClass: reg.SubClass as Type<BaseFormComponent>, variants }\n : { kind: 'none', variants };\n }\n\n /**\n * Public list-API for the variant switcher UI. Returns all variants\n * applicable to (entity, user). Includes Active, Pending, and Inactive\n * rows so the picker can offer \"switch back to v1.0.0\" alongside the\n * current active variant.\n */\n async ListVariantsForEntity(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<EntityFormOverrideRow[]> {\n return this.listApplicableVariants(entity, user, provider);\n }\n\n /**\n * Sentinel stored in localStorage when the user **explicitly picks the\n * \"Default form\"** option from the variant picker. Distinct from a\n * missing localStorage key (= \"no preference, use auto-pick rules\")\n * and from an override UUID. Without this sentinel, picking \"Default\"\n * cleared the preference and `pickActive` re-applied the auto-pick —\n * which always selects the first Active override, making the\n * CodeGen/Angular fallback unreachable from the UI.\n *\n * Format: a leading `__` makes it visually distinct from a UUID and\n * impossible to collide with one (UUIDs don't contain underscores).\n */\n public static readonly EXPLICIT_DEFAULT_SENTINEL = '__codegen-default__';\n\n /**\n * Build the per-entity setting key. Lowercased so case variants of\n * the entity name collapse onto a single record in `MJ: User Settings`.\n */\n private settingKey(entityName: string): string {\n return VARIANT_SETTING_PREFIX + entityName.toLowerCase();\n }\n\n /**\n * Persist a specific override choice. Pass the override UUID. Writes\n * via `UserInfoEngine.SetSettingDebounced` so rapid successive picks\n * don't hammer the DB. Use {@link SetExplicitDefault} to record \"user\n * wants the CodeGen Angular fallback\" and {@link ClearSelectedVariant}\n * to wipe the preference entirely (revert to auto-pick).\n */\n SetSelectedVariant(entityName: string, overrideID: string): void {\n UserInfoEngine.Instance.SetSettingDebounced(this.settingKey(entityName), overrideID);\n }\n\n /**\n * Record that the user explicitly picked the \"Default form\" row in\n * the picker. `pickActive` reads this sentinel and returns null even\n * when Active overrides exist for the entity, so the form-loading\n * path falls back to CodeGen's `@RegisterClass` lookup.\n */\n SetExplicitDefault(entityName: string): void {\n UserInfoEngine.Instance.SetSettingDebounced(\n this.settingKey(entityName),\n FormResolverService.EXPLICIT_DEFAULT_SENTINEL,\n );\n }\n\n /**\n * Wipe the user's stored preference for this entity. Next load\n * applies the auto-pick rules (first Active override in tier order).\n * Called internally when a saved override ID is no longer valid.\n * Fire-and-forget — the resolver doesn't need to await the delete.\n */\n ClearSelectedVariant(entityName: string): void {\n void UserInfoEngine.Instance.DeleteSetting(this.settingKey(entityName))\n .catch(err => LogError(`FormResolverService.ClearSelectedVariant: ${err instanceof Error ? err.message : String(err)}`));\n }\n\n /**\n * Read the user's previously-saved variant choice for the entity.\n * Synchronous because `UserInfoEngine` keeps the user-settings table\n * in memory after bootstrap. Returns the stored UUID, the explicit-\n * default sentinel, or null when no preference exists.\n */\n GetSelectedVariant(entityName: string): string | null {\n return UserInfoEngine.Instance.GetSetting(this.settingKey(entityName)) ?? null;\n }\n\n // ── internals ────────────────────────────────────────────────────────\n\n private async listApplicableVariants(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<EntityFormOverrideRow[]> {\n // Lazy-load the form-metadata engine on first call. No-op when\n // already loaded. BaseEngine's event subscription keeps the\n // cache fresh through save / delete / remote-invalidate — we\n // don't need `BypassCache: true` (the previous RunView path's\n // escape hatch) because the engine's invalidation IS that\n // freshness guarantee. See `InteractiveFormsEngine` doc-block.\n try {\n await InteractiveFormsEngine.Instance.Config(false, user, provider);\n } catch (err) {\n LogError(`FormResolverService: InteractiveFormsEngine.Config failed: ${err instanceof Error ? err.message : String(err)}`);\n return [];\n }\n\n const userRoleIds = new Set(\n (user.UserRoles ?? []).map(r => r.RoleID).filter((id): id is string => !!id),\n );\n\n // Filter cached overrides for this (entity, user, roles) tuple.\n // Includes Active + Pending + Inactive (the variant picker shows\n // all three; pickActive() filters to Active separately). Replaces\n // a per-LoadForm RunView with an in-memory predicate — sub-ms.\n const applicable = InteractiveFormsEngine.Instance.Overrides.filter(o => {\n if (!o.EntityID || !UUIDsEqual(o.EntityID, entity.ID)) return false;\n if (o.Scope === 'User') return !!o.UserID && o.UserID.toLowerCase() === user.ID.toLowerCase();\n if (o.Scope === 'Role') return !!o.RoleID && userRoleIds.has(o.RoleID);\n if (o.Scope === 'Global') return true;\n return false;\n });\n\n // Sort: User > Role > Global, then Priority DESC (higher beats),\n // then newest first. Matches the prior SQL ORDER BY semantics so\n // pickActive() / the variant switcher see the same order.\n const scopeRank = (s: string | null | undefined): number => {\n if (s === 'User') return 1;\n if (s === 'Role') return 2;\n if (s === 'Global') return 3;\n return 4;\n };\n applicable.sort((a, b) => {\n const sa = scopeRank(a.Scope);\n const sb = scopeRank(b.Scope);\n if (sa !== sb) return sa - sb;\n const pa = a.Priority ?? 0;\n const pb = b.Priority ?? 0;\n if (pa !== pb) return pb - pa; // Priority DESC\n const ca = a.__mj_CreatedAt instanceof Date ? a.__mj_CreatedAt.getTime() : 0;\n const cb = b.__mj_CreatedAt instanceof Date ? b.__mj_CreatedAt.getTime() : 0;\n return cb - ca; // newest first\n });\n\n // Project to the slim row shape the resolver returns. Keeps the\n // contract identical to the old RunView return so callers don't\n // change shape.\n return applicable.map(o => ({\n ID: o.ID,\n EntityID: o.EntityID,\n ComponentID: o.ComponentID,\n Scope: o.Scope as 'User' | 'Role' | 'Global',\n UserID: o.UserID,\n RoleID: o.RoleID,\n Priority: o.Priority,\n Status: o.Status as 'Active' | 'Inactive' | 'Pending',\n Name: o.Name,\n Description: o.Description,\n }));\n }\n\n /**\n * Pick the override that should actually render given the variant list\n * and the user's stored selection (if any).\n *\n * Selection rules:\n * - If the user explicitly picked the \"Default form\" row in the\n * variant picker (sentinel in localStorage) → return null so the\n * form-loading path falls back to CodeGen's `@RegisterClass` lookup.\n * This is what makes the Angular fallback reachable from the UI.\n * - Else if the user has a saved variant ID AND that variant is in\n * the applicable list AND it's Active → use it.\n * - Else → first Active row in tier+priority order (auto-pick).\n * - Else → null (fall back to CodeGen/@RegisterClass path).\n */\n private pickActive(\n entity: EntityInfo,\n variants: EntityFormOverrideRow[],\n ): EntityFormOverrideRow | null {\n const selectedID = this.GetSelectedVariant(entity.Name);\n if (selectedID === FormResolverService.EXPLICIT_DEFAULT_SENTINEL) {\n return null;\n }\n if (selectedID) {\n const sel = variants.find(v => v.Status === 'Active' && UUIDsEqual(v.ID, selectedID));\n if (sel) return sel;\n // Selection no longer valid — wipe it so future loads auto-pick.\n this.ClearSelectedVariant(entity.Name);\n }\n return variants.find(v => v.Status === 'Active') ?? null;\n }\n}\n"]}
1
+ {"version":3,"file":"form-resolver.service.js","sourceRoot":"","sources":["../../../src/lib/resolver/form-resolver.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,eAAe,CAAC;AACjD,OAAO,EAA2C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;;AA4B/D;;;;;;;;;;;;GAYG;AACH,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,OAAO,mBAAmB;IAE5B,KAAK,CAAC,oBAAoB,CACtB,MAAkB,EAClB,IAAc,EACd,QAA2B;QAE3B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,s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CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;SAC7B,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;;;;;;;;;;;;OAaG;IACK,UAAU,CACd,MAAkB,EAClB,QAAiC;QAEjC,MAAM,UAAU,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,IAAI,UAAU,KAAK,mBAAmB,CAAC,yBAAyB,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,IAAI,UAAU,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;YACtF,IAAI,GAAG;gBAAE,OAAO,GAAG,CAAC;YACpB,iEAAiE;YACjE,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC;IAC7D,CAAC;6GAlNQ,mBAAmB;gEAAnB,mBAAmB,WAAnB,mBAAmB,mBADN,MAAM;;iFACnB,mBAAmB;cAD/B,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE","sourcesContent":["import { Injectable, Type } from '@angular/core';\nimport { IMetadataProvider, UserInfo, EntityInfo, LogError } from '@memberjunction/core';\nimport { InteractiveFormsEngine } from '@memberjunction/core-entities';\nimport { MJGlobal, UUIDsEqual } from '@memberjunction/global';\nimport { BaseFormComponent } from '../base-form-component';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\n\n/**\n * Slim row shape for an `EntityFormOverride` lookup. Resolution doesn't need\n * the full BaseEntity object — `simple` ResultType is faster and avoids a\n * compile-time dependency on the generated entity class. The row is only ever\n * read by the resolver; mutation goes through the generated entity in other\n * code paths (Studio, AI authoring).\n */\nexport interface EntityFormOverrideRow {\n ID: string;\n EntityID: string;\n ComponentID: string;\n Scope: 'User' | 'Role' | 'Global';\n UserID: string | null;\n RoleID: string | null;\n Priority: number;\n Status: 'Active' | 'Inactive' | 'Pending';\n Name?: string;\n Description?: string | null;\n}\n\n/** Resolved form kind for a given (entity, user, roles) tuple. */\nexport type FormResolution =\n | { kind: 'interactive'; override: EntityFormOverrideRow; variants: EntityFormOverrideRow[] }\n | { kind: 'class'; subClass: Type<BaseFormComponent>; variants: EntityFormOverrideRow[] }\n | { kind: 'none'; variants: EntityFormOverrideRow[] };\n\n/**\n * UserInfoEngine setting-key prefix for per-user, per-entity form-variant\n * preferences. Persisted to `MJ: User Settings` so the choice follows the\n * user across browsers and devices — localStorage is intentionally NOT used.\n *\n * Key format: `mj.formVariant.<entityname-lowercased>`.\n *\n * Value is one of:\n * - an `EntityFormOverride.ID` (UUID) → use that specific override\n * - {@link FormResolverService.EXPLICIT_DEFAULT_SENTINEL} → user picked\n * the CodeGen Angular fallback explicitly; resolver skips all overrides\n * - (key absent) → no preference, apply auto-pick rules\n */\nconst VARIANT_SETTING_PREFIX = 'mj.formVariant.';\n\n/**\n * Picks the form to render for an entity record and exposes the full list of\n * applicable variants so the toolbar's variant switcher can offer alternates.\n *\n * Tier order for the **default** pick:\n * 1. `EntityFormOverride` row matching the caller's User/Role/Global scope,\n * Status='Active', ordered by scope tier (User > Role > Global), then\n * Priority DESC, then `__mj_CreatedAt DESC`. First row wins.\n * 2. Existing `ClassFactory.GetRegistration(BaseFormComponent, entityName)` —\n * the @RegisterClass + CodeGen-generated path used today.\n * 3. None — caller surfaces the \"no form registered\" error.\n *\n * **Session selection.** If the user previously chose a non-default variant\n * via the variant switcher and that choice is still applicable + Active, that\n * choice wins over the default. Choice is keyed by entity name in\n * `localStorage`. Honoring this is part of the variant-switcher contract;\n * without it, switching variants would only last for the lifetime of the\n * record-form view.\n *\n * **Performance.** Backed by `InteractiveFormsEngine` (in MJCoreEntities)\n * — overrides are cached in memory with BaseEntity event-driven\n * invalidation, so resolution is an O(N) JS filter against a small\n * set instead of a per-LoadForm RunView round-trip. Cold latency\n * dropped from ~50ms to <1ms after the first load. The engine is\n * lazy-Config'd here on first resolution; users who never open a\n * record pay nothing.\n */\n@Injectable({ providedIn: 'root' })\nexport class FormResolverService {\n\n async ResolveFormForEntity(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<FormResolution> {\n const variants = await this.listApplicableVariants(entity, user, provider);\n const active = this.pickActive(entity, variants);\n\n if (active) {\n return { kind: 'interactive', override: active, variants };\n }\n\n const reg = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormComponent, entity.Name);\n return reg\n ? { kind: 'class', subClass: reg.SubClass as Type<BaseFormComponent>, variants }\n : { kind: 'none', variants };\n }\n\n /**\n * Public list-API for the variant switcher UI. Returns all variants\n * applicable to (entity, user). Includes Active, Pending, and Inactive\n * rows so the picker can offer \"switch back to v1.0.0\" alongside the\n * current active variant.\n */\n async ListVariantsForEntity(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<EntityFormOverrideRow[]> {\n return this.listApplicableVariants(entity, user, provider);\n }\n\n /**\n * Sentinel stored in localStorage when the user **explicitly picks the\n * \"Default form\"** option from the variant picker. Distinct from a\n * missing localStorage key (= \"no preference, use auto-pick rules\")\n * and from an override UUID. Without this sentinel, picking \"Default\"\n * cleared the preference and `pickActive` re-applied the auto-pick —\n * which always selects the first Active override, making the\n * CodeGen/Angular fallback unreachable from the UI.\n *\n * Format: a leading `__` makes it visually distinct from a UUID and\n * impossible to collide with one (UUIDs don't contain underscores).\n */\n public static readonly EXPLICIT_DEFAULT_SENTINEL = '__codegen-default__';\n\n /**\n * Build the per-entity setting key. Lowercased so case variants of\n * the entity name collapse onto a single record in `MJ: User Settings`.\n */\n private settingKey(entityName: string): string {\n return VARIANT_SETTING_PREFIX + entityName.toLowerCase();\n }\n\n /**\n * Persist a specific override choice. Pass the override UUID. Writes\n * via `UserInfoEngine.SetSettingDebounced` so rapid successive picks\n * don't hammer the DB. Use {@link SetExplicitDefault} to record \"user\n * wants the CodeGen Angular fallback\" and {@link ClearSelectedVariant}\n * to wipe the preference entirely (revert to auto-pick).\n */\n SetSelectedVariant(entityName: string, overrideID: string): void {\n UserInfoEngine.Instance.SetSettingDebounced(this.settingKey(entityName), overrideID);\n }\n\n /**\n * Record that the user explicitly picked the \"Default form\" row in\n * the picker. `pickActive` reads this sentinel and returns null even\n * when Active overrides exist for the entity, so the form-loading\n * path falls back to CodeGen's `@RegisterClass` lookup.\n */\n SetExplicitDefault(entityName: string): void {\n UserInfoEngine.Instance.SetSettingDebounced(\n this.settingKey(entityName),\n FormResolverService.EXPLICIT_DEFAULT_SENTINEL,\n );\n }\n\n /**\n * Wipe the user's stored preference for this entity. Next load\n * applies the auto-pick rules (first Active override in tier order).\n * Called internally when a saved override ID is no longer valid.\n * Fire-and-forget — the resolver doesn't need to await the delete.\n */\n ClearSelectedVariant(entityName: string): void {\n void UserInfoEngine.Instance.DeleteSetting(this.settingKey(entityName))\n .catch(err => LogError(`FormResolverService.ClearSelectedVariant: ${err instanceof Error ? err.message : String(err)}`));\n }\n\n /**\n * Read the user's previously-saved variant choice for the entity.\n * Synchronous because `UserInfoEngine` keeps the user-settings table\n * in memory after bootstrap. Returns the stored UUID, the explicit-\n * default sentinel, or null when no preference exists.\n */\n GetSelectedVariant(entityName: string): string | null {\n return UserInfoEngine.Instance.GetSetting(this.settingKey(entityName)) ?? null;\n }\n\n // ── internals ────────────────────────────────────────────────────────\n\n private async listApplicableVariants(\n entity: EntityInfo,\n user: UserInfo,\n provider: IMetadataProvider,\n ): Promise<EntityFormOverrideRow[]> {\n // Lazy-load the form-metadata engine on first call. No-op when\n // already loaded. BaseEngine's event subscription keeps the\n // cache fresh through save / delete / remote-invalidate — we\n // don't need `BypassCache: true` (the previous RunView path's\n // escape hatch) because the engine's invalidation IS that\n // freshness guarantee. See `InteractiveFormsEngine` doc-block.\n try {\n await InteractiveFormsEngine.Instance.Config(false, user, provider);\n } catch (err) {\n LogError(`FormResolverService: InteractiveFormsEngine.Config failed: ${err instanceof Error ? err.message : String(err)}`);\n return [];\n }\n\n // If the engine couldn't load due to permission denial, fall back to\n // the generated form — no overrides available.\n if (InteractiveFormsEngine.Instance.IsPermissionConstrained) {\n return [];\n }\n\n const userRoleIds = new Set(\n (user.UserRoles ?? []).map(r => r.RoleID).filter((id): id is string => !!id),\n );\n\n // Filter cached overrides for this (entity, user, roles) tuple.\n // Includes Active + Pending + Inactive (the variant picker shows\n // all three; pickActive() filters to Active separately). Replaces\n // a per-LoadForm RunView with an in-memory predicate — sub-ms.\n const applicable = InteractiveFormsEngine.Instance.Overrides.filter(o => {\n if (!o.EntityID || !UUIDsEqual(o.EntityID, entity.ID)) return false;\n if (o.Scope === 'User') return !!o.UserID && o.UserID.toLowerCase() === user.ID.toLowerCase();\n if (o.Scope === 'Role') return !!o.RoleID && userRoleIds.has(o.RoleID);\n if (o.Scope === 'Global') return true;\n return false;\n });\n\n // Sort: User > Role > Global, then Priority DESC (higher beats),\n // then newest first. Matches the prior SQL ORDER BY semantics so\n // pickActive() / the variant switcher see the same order.\n const scopeRank = (s: string | null | undefined): number => {\n if (s === 'User') return 1;\n if (s === 'Role') return 2;\n if (s === 'Global') return 3;\n return 4;\n };\n applicable.sort((a, b) => {\n const sa = scopeRank(a.Scope);\n const sb = scopeRank(b.Scope);\n if (sa !== sb) return sa - sb;\n const pa = a.Priority ?? 0;\n const pb = b.Priority ?? 0;\n if (pa !== pb) return pb - pa; // Priority DESC\n const ca = a.__mj_CreatedAt instanceof Date ? a.__mj_CreatedAt.getTime() : 0;\n const cb = b.__mj_CreatedAt instanceof Date ? b.__mj_CreatedAt.getTime() : 0;\n return cb - ca; // newest first\n });\n\n // Project to the slim row shape the resolver returns. Keeps the\n // contract identical to the old RunView return so callers don't\n // change shape.\n return applicable.map(o => ({\n ID: o.ID,\n EntityID: o.EntityID,\n ComponentID: o.ComponentID,\n Scope: o.Scope as 'User' | 'Role' | 'Global',\n UserID: o.UserID,\n RoleID: o.RoleID,\n Priority: o.Priority,\n Status: o.Status as 'Active' | 'Inactive' | 'Pending',\n Name: o.Name,\n Description: o.Description,\n }));\n }\n\n /**\n * Pick the override that should actually render given the variant list\n * and the user's stored selection (if any).\n *\n * Selection rules:\n * - If the user explicitly picked the \"Default form\" row in the\n * variant picker (sentinel in localStorage) → return null so the\n * form-loading path falls back to CodeGen's `@RegisterClass` lookup.\n * This is what makes the Angular fallback reachable from the UI.\n * - Else if the user has a saved variant ID AND that variant is in\n * the applicable list AND it's Active → use it.\n * - Else → first Active row in tier+priority order (auto-pick).\n * - Else → null (fall back to CodeGen/@RegisterClass path).\n */\n private pickActive(\n entity: EntityInfo,\n variants: EntityFormOverrideRow[],\n ): EntityFormOverrideRow | null {\n const selectedID = this.GetSelectedVariant(entity.Name);\n if (selectedID === FormResolverService.EXPLICIT_DEFAULT_SENTINEL) {\n return null;\n }\n if (selectedID) {\n const sel = variants.find(v => v.Status === 'Active' && UUIDsEqual(v.ID, selectedID));\n if (sel) return sel;\n // Selection no longer valid — wipe it so future loads auto-pick.\n this.ClearSelectedVariant(entity.Name);\n }\n return variants.find(v => v.Status === 'Active') ?? null;\n }\n}\n"]}
package/dist/module.d.ts CHANGED
@@ -13,14 +13,15 @@ import * as i11 from "./lib/interactive-form/interactive-form.component";
13
13
  import * as i12 from "./lib/host/entity-form-host.component";
14
14
  import * as i13 from "@angular/common";
15
15
  import * as i14 from "@angular/forms";
16
- import * as i15 from "@memberjunction/ng-record-changes";
17
- import * as i16 from "@memberjunction/ng-list-management";
18
- import * as i17 from "@memberjunction/ng-entity-viewer";
19
- import * as i18 from "@memberjunction/ng-record-tags";
20
- import * as i19 from "@memberjunction/ng-react";
21
- import * as i20 from "@memberjunction/ng-markdown";
22
- import * as i21 from "@memberjunction/ng-code-editor";
23
- import * as i22 from "@memberjunction/ng-shared-generic";
16
+ import * as i15 from "@memberjunction/ng-ui-components";
17
+ import * as i16 from "@memberjunction/ng-record-changes";
18
+ import * as i17 from "@memberjunction/ng-list-management";
19
+ import * as i18 from "@memberjunction/ng-entity-viewer";
20
+ import * as i19 from "@memberjunction/ng-record-tags";
21
+ import * as i20 from "@memberjunction/ng-react";
22
+ import * as i21 from "@memberjunction/ng-markdown";
23
+ import * as i22 from "@memberjunction/ng-code-editor";
24
+ import * as i23 from "@memberjunction/ng-shared-generic";
24
25
  /**
25
26
  * BaseFormsModule - Form components and base classes for rendering and editing MemberJunction entity records.
26
27
  *
@@ -42,7 +43,7 @@ import * as i22 from "@memberjunction/ng-shared-generic";
42
43
  */
43
44
  export declare class BaseFormsModule {
44
45
  static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormsModule, never>;
45
- static ɵmod: i0.ɵɵNgModuleDeclaration<BaseFormsModule, [typeof i1.MjFormToolbarComponent, typeof i2.MjFormFieldComponent, typeof i3.MjCollapsiblePanelComponent, typeof i4.MjRecordFormContainerComponent, typeof i5.MjSectionManagerComponent, typeof i6.SectionLoaderComponent, typeof i7.ExplorerEntityDataGridComponent, typeof i8.MjIsaRelatedCardComponent, typeof i9.MjIsaRelatedPanelComponent, typeof i10.FormPanelSlotComponent, typeof i11.InteractiveFormComponent, typeof i12.MjEntityFormHostComponent], [typeof i13.CommonModule, typeof i14.FormsModule, typeof i15.RecordChangesModule, typeof i16.ListManagementModule, typeof i17.EntityViewerModule, typeof i18.RecordTagsModule, typeof i19.MJReactModule, typeof i20.MarkdownModule, typeof i21.CodeEditorModule, typeof i22.MJSafeRichHtmlPipe, typeof i22.SharedGenericModule], [typeof i1.MjFormToolbarComponent, typeof i2.MjFormFieldComponent, typeof i3.MjCollapsiblePanelComponent, typeof i4.MjRecordFormContainerComponent, typeof i5.MjSectionManagerComponent, typeof i6.SectionLoaderComponent, typeof i7.ExplorerEntityDataGridComponent, typeof i8.MjIsaRelatedCardComponent, typeof i9.MjIsaRelatedPanelComponent, typeof i10.FormPanelSlotComponent, typeof i11.InteractiveFormComponent, typeof i12.MjEntityFormHostComponent]>;
46
+ static ɵmod: i0.ɵɵNgModuleDeclaration<BaseFormsModule, [typeof i1.MjFormToolbarComponent, typeof i2.MjFormFieldComponent, typeof i3.MjCollapsiblePanelComponent, typeof i4.MjRecordFormContainerComponent, typeof i5.MjSectionManagerComponent, typeof i6.SectionLoaderComponent, typeof i7.ExplorerEntityDataGridComponent, typeof i8.MjIsaRelatedCardComponent, typeof i9.MjIsaRelatedPanelComponent, typeof i10.FormPanelSlotComponent, typeof i11.InteractiveFormComponent, typeof i12.MjEntityFormHostComponent], [typeof i13.CommonModule, typeof i14.FormsModule, typeof i15.MJEmptyStateComponent, typeof i15.MJAlertComponent, typeof i16.RecordChangesModule, typeof i17.ListManagementModule, typeof i18.EntityViewerModule, typeof i19.RecordTagsModule, typeof i20.MJReactModule, typeof i21.MarkdownModule, typeof i22.CodeEditorModule, typeof i23.MJSafeRichHtmlPipe, typeof i23.SharedGenericModule], [typeof i1.MjFormToolbarComponent, typeof i2.MjFormFieldComponent, typeof i3.MjCollapsiblePanelComponent, typeof i4.MjRecordFormContainerComponent, typeof i5.MjSectionManagerComponent, typeof i6.SectionLoaderComponent, typeof i7.ExplorerEntityDataGridComponent, typeof i8.MjIsaRelatedCardComponent, typeof i9.MjIsaRelatedPanelComponent, typeof i10.FormPanelSlotComponent, typeof i11.InteractiveFormComponent, typeof i12.MjEntityFormHostComponent]>;
46
47
  static ɵinj: i0.ɵɵInjectorDeclaration<BaseFormsModule>;
47
48
  }
48
49
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBA2Ca,eAAe;yCAAf,eAAe;0CAAf,eAAe;0CAAf,eAAe;CAAI"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBA6Ca,eAAe;yCAAf,eAAe;0CAAf,eAAe;0CAAf,eAAe;CAAI"}
package/dist/module.js CHANGED
@@ -19,6 +19,7 @@ import { MJReactModule } from '@memberjunction/ng-react';
19
19
  import { MarkdownModule } from '@memberjunction/ng-markdown';
20
20
  import { CodeEditorModule } from '@memberjunction/ng-code-editor';
21
21
  import { MJSafeRichHtmlPipe, SharedGenericModule } from '@memberjunction/ng-shared-generic';
22
+ import { MJEmptyStateComponent, MJAlertComponent } from '@memberjunction/ng-ui-components';
22
23
  import { InteractiveFormComponent } from './lib/interactive-form/interactive-form.component';
23
24
  import { MjEntityFormHostComponent } from './lib/host/entity-form-host.component';
24
25
  import * as i0 from "@angular/core";
@@ -46,6 +47,8 @@ export class BaseFormsModule {
46
47
  static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BaseFormsModule });
47
48
  static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
48
49
  FormsModule,
50
+ MJEmptyStateComponent,
51
+ MJAlertComponent,
49
52
  RecordChangesModule,
50
53
  ListManagementModule,
51
54
  EntityViewerModule,
@@ -75,6 +78,8 @@ export class BaseFormsModule {
75
78
  imports: [
76
79
  CommonModule,
77
80
  FormsModule,
81
+ MJEmptyStateComponent,
82
+ MJAlertComponent,
78
83
  RecordChangesModule,
79
84
  ListManagementModule,
80
85
  EntityViewerModule,
@@ -114,6 +119,8 @@ export class BaseFormsModule {
114
119
  InteractiveFormComponent,
115
120
  MjEntityFormHostComponent], imports: [CommonModule,
116
121
  FormsModule,
122
+ MJEmptyStateComponent,
123
+ MJAlertComponent,
117
124
  RecordChangesModule,
118
125
  ListManagementModule,
119
126
  EntityViewerModule,
@@ -1 +1 @@
1
- {"version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Ac;QACd,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB,aAGnB,sBAAsB;QACtB,oBAAoB;QACpB,2BAA2B;QAC3B,8BAA8B;QAC9B,yBAAyB;QACzB,sBAAsB;QACtB,+BAA+B;QAC/B,yBAAyB;QACzB,0BAA0B;QAC1B,sBAAsB;QACtB,wBAAwB;QACxB,yBAAyB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MjFormToolbarComponent } from './lib/toolbar/form-toolbar.component';\nimport { MjFormFieldComponent } from './lib/field/form-field.component';\nimport { MjCollapsiblePanelComponent } from './lib/panel/collapsible-panel.component';\nimport { MjRecordFormContainerComponent } from './lib/container/record-form-container.component';\nimport { MjSectionManagerComponent } from './lib/section-manager/section-manager.component';\nimport { SectionLoaderComponent } from './lib/section-loader-component';\nimport { ExplorerEntityDataGridComponent } from './lib/explorer-entity-data-grid.component';\nimport { MjIsaRelatedCardComponent } from './lib/isa-related-panel/isa-related-card.component';\nimport { MjIsaRelatedPanelComponent } from './lib/isa-related-panel/isa-related-panel.component';\nimport { FormPanelSlotComponent } from './lib/panel-slot/form-panel-slot.component';\nimport { RecordChangesModule } from '@memberjunction/ng-record-changes';\nimport { ListManagementModule } from '@memberjunction/ng-list-management';\nimport { EntityViewerModule } from '@memberjunction/ng-entity-viewer';\nimport { RecordTagsModule } from '@memberjunction/ng-record-tags';\nimport { MJReactModule } from '@memberjunction/ng-react';\nimport { MarkdownModule } from '@memberjunction/ng-markdown';\nimport { CodeEditorModule } from '@memberjunction/ng-code-editor';\nimport { MJSafeRichHtmlPipe, SharedGenericModule } from '@memberjunction/ng-shared-generic';\nimport { InteractiveFormComponent } from './lib/interactive-form/interactive-form.component';\nimport { MjEntityFormHostComponent } from './lib/host/entity-form-host.component';\n\n/**\n * BaseFormsModule - Form components and base classes for rendering and editing MemberJunction entity records.\n *\n * Provides:\n * - **MjRecordFormContainerComponent** (`<mj-record-form-container>`): Top-level container\n * with sticky toolbar, section state management, and content slots.\n * - **MjFormToolbarComponent** (`<mj-form-toolbar>`): Configurable toolbar with read/edit mode\n * actions, IS-A hierarchy breadcrumb, section controls, and inline delete dialog.\n * - **MjCollapsiblePanelComponent** (`<mj-collapsible-panel>`): Collapsible section with\n * drag-to-reorder, search filtering, and inherited/related variants.\n * - **MjFormFieldComponent** (`<mj-form-field>`): Entity field renderer with clean read-only\n * display and modern edit-mode inputs (native HTML with custom select and autocomplete).\n * - **SectionLoaderComponent** (`<mj-form-section>`): Dynamic section loader via ClassFactory.\n * - **ExplorerEntityDataGridComponent** (`<mj-explorer-entity-data-grid>`): Data grid wrapper\n * for related entity sections with Navigate event support.\n *\n * All navigation actions are emitted as events via {@link FormNavigationEvent}.\n * The host application subscribes and maps to its own routing system.\n */\n@NgModule({\n declarations: [\n MjFormToolbarComponent,\n MjFormFieldComponent,\n MjCollapsiblePanelComponent,\n MjRecordFormContainerComponent,\n MjSectionManagerComponent,\n SectionLoaderComponent,\n ExplorerEntityDataGridComponent,\n MjIsaRelatedCardComponent,\n MjIsaRelatedPanelComponent,\n FormPanelSlotComponent,\n InteractiveFormComponent,\n MjEntityFormHostComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n RecordChangesModule,\n ListManagementModule,\n EntityViewerModule,\n RecordTagsModule,\n MJReactModule,\n MarkdownModule,\n CodeEditorModule,\n MJSafeRichHtmlPipe,\n SharedGenericModule\n ],\n exports: [\n MjFormToolbarComponent,\n MjFormFieldComponent,\n MjCollapsiblePanelComponent,\n MjRecordFormContainerComponent,\n MjSectionManagerComponent,\n SectionLoaderComponent,\n ExplorerEntityDataGridComponent,\n MjIsaRelatedCardComponent,\n MjIsaRelatedPanelComponent,\n FormPanelSlotComponent,\n InteractiveFormComponent,\n MjEntityFormHostComponent\n ]\n})\nexport class BaseFormsModule { }\n"]}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Q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gBAAgB;QAChB,mBAAmB;QACnB,oBAAoB;QACpB,kBAAkB;QAClB,gBAAgB;QAChB,aAAa;QACb,cAAc;QACd,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB,aAGnB,sBAAsB;QACtB,oBAAoB;QACpB,2BAA2B;QAC3B,8BAA8B;QAC9B,yBAAyB;QACzB,sBAAsB;QACtB,+BAA+B;QAC/B,yBAAyB;QACzB,0BAA0B;QAC1B,sBAAsB;QACtB,wBAAwB;QACxB,yBAAyB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MjFormToolbarComponent } from './lib/toolbar/form-toolbar.component';\nimport { MjFormFieldComponent } from './lib/field/form-field.component';\nimport { MjCollapsiblePanelComponent } from './lib/panel/collapsible-panel.component';\nimport { MjRecordFormContainerComponent } from './lib/container/record-form-container.component';\nimport { MjSectionManagerComponent } from './lib/section-manager/section-manager.component';\nimport { SectionLoaderComponent } from './lib/section-loader-component';\nimport { ExplorerEntityDataGridComponent } from './lib/explorer-entity-data-grid.component';\nimport { MjIsaRelatedCardComponent } from './lib/isa-related-panel/isa-related-card.component';\nimport { MjIsaRelatedPanelComponent } from './lib/isa-related-panel/isa-related-panel.component';\nimport { FormPanelSlotComponent } from './lib/panel-slot/form-panel-slot.component';\nimport { RecordChangesModule } from '@memberjunction/ng-record-changes';\nimport { ListManagementModule } from '@memberjunction/ng-list-management';\nimport { EntityViewerModule } from '@memberjunction/ng-entity-viewer';\nimport { RecordTagsModule } from '@memberjunction/ng-record-tags';\nimport { MJReactModule } from '@memberjunction/ng-react';\nimport { MarkdownModule } from '@memberjunction/ng-markdown';\nimport { CodeEditorModule } from '@memberjunction/ng-code-editor';\nimport { MJSafeRichHtmlPipe, SharedGenericModule } from '@memberjunction/ng-shared-generic';\nimport { MJEmptyStateComponent, MJAlertComponent } from '@memberjunction/ng-ui-components';\nimport { InteractiveFormComponent } from './lib/interactive-form/interactive-form.component';\nimport { MjEntityFormHostComponent } from './lib/host/entity-form-host.component';\n\n/**\n * BaseFormsModule - Form components and base classes for rendering and editing MemberJunction entity records.\n *\n * Provides:\n * - **MjRecordFormContainerComponent** (`<mj-record-form-container>`): Top-level container\n * with sticky toolbar, section state management, and content slots.\n * - **MjFormToolbarComponent** (`<mj-form-toolbar>`): Configurable toolbar with read/edit mode\n * actions, IS-A hierarchy breadcrumb, section controls, and inline delete dialog.\n * - **MjCollapsiblePanelComponent** (`<mj-collapsible-panel>`): Collapsible section with\n * drag-to-reorder, search filtering, and inherited/related variants.\n * - **MjFormFieldComponent** (`<mj-form-field>`): Entity field renderer with clean read-only\n * display and modern edit-mode inputs (native HTML with custom select and autocomplete).\n * - **SectionLoaderComponent** (`<mj-form-section>`): Dynamic section loader via ClassFactory.\n * - **ExplorerEntityDataGridComponent** (`<mj-explorer-entity-data-grid>`): Data grid wrapper\n * for related entity sections with Navigate event support.\n *\n * All navigation actions are emitted as events via {@link FormNavigationEvent}.\n * The host application subscribes and maps to its own routing system.\n */\n@NgModule({\n declarations: [\n MjFormToolbarComponent,\n MjFormFieldComponent,\n MjCollapsiblePanelComponent,\n MjRecordFormContainerComponent,\n MjSectionManagerComponent,\n SectionLoaderComponent,\n ExplorerEntityDataGridComponent,\n MjIsaRelatedCardComponent,\n MjIsaRelatedPanelComponent,\n FormPanelSlotComponent,\n InteractiveFormComponent,\n MjEntityFormHostComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n MJEmptyStateComponent,\n MJAlertComponent,\n RecordChangesModule,\n ListManagementModule,\n EntityViewerModule,\n RecordTagsModule,\n MJReactModule,\n MarkdownModule,\n CodeEditorModule,\n MJSafeRichHtmlPipe,\n SharedGenericModule\n ],\n exports: [\n MjFormToolbarComponent,\n MjFormFieldComponent,\n MjCollapsiblePanelComponent,\n MjRecordFormContainerComponent,\n MjSectionManagerComponent,\n SectionLoaderComponent,\n ExplorerEntityDataGridComponent,\n MjIsaRelatedCardComponent,\n MjIsaRelatedPanelComponent,\n FormPanelSlotComponent,\n InteractiveFormComponent,\n MjEntityFormHostComponent\n ]\n})\nexport class BaseFormsModule { }\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-base-forms",
3
- "version": "5.43.0",
3
+ "version": "5.44.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",
@@ -25,7 +25,9 @@
25
25
  "license": "ISC",
26
26
  "devDependencies": {
27
27
  "@angular/compiler": "21.1.3",
28
- "@angular/compiler-cli": "21.1.3"
28
+ "@angular/compiler-cli": "21.1.3",
29
+ "@memberjunction/ng-test-utils": "5.44.0",
30
+ "vitest": "^4.0.18"
29
31
  },
30
32
  "peerDependencies": {
31
33
  "@angular/animations": "21.1.3",
@@ -36,21 +38,21 @@
36
38
  "primeng": "21.1.1"
37
39
  },
38
40
  "dependencies": {
39
- "@memberjunction/core": "5.43.0",
40
- "@memberjunction/core-entities": "5.43.0",
41
- "@memberjunction/global": "5.43.0",
42
- "@memberjunction/interactive-component-types": "5.43.0",
43
- "@memberjunction/ng-base-types": "5.43.0",
44
- "@memberjunction/ng-code-editor": "5.43.0",
45
- "@memberjunction/ng-entity-viewer": "5.43.0",
46
- "@memberjunction/ng-list-management": "5.43.0",
47
- "@memberjunction/ng-markdown": "5.43.0",
48
- "@memberjunction/ng-notifications": "5.43.0",
49
- "@memberjunction/ng-react": "5.43.0",
50
- "@memberjunction/ng-record-changes": "5.43.0",
51
- "@memberjunction/ng-record-tags": "5.43.0",
52
- "@memberjunction/ng-shared-generic": "5.43.0",
53
- "@memberjunction/ng-ui-components": "5.43.0",
41
+ "@memberjunction/core": "5.44.0",
42
+ "@memberjunction/core-entities": "5.44.0",
43
+ "@memberjunction/global": "5.44.0",
44
+ "@memberjunction/interactive-component-types": "5.44.0",
45
+ "@memberjunction/ng-base-types": "5.44.0",
46
+ "@memberjunction/ng-code-editor": "5.44.0",
47
+ "@memberjunction/ng-entity-viewer": "5.44.0",
48
+ "@memberjunction/ng-list-management": "5.44.0",
49
+ "@memberjunction/ng-markdown": "5.44.0",
50
+ "@memberjunction/ng-notifications": "5.44.0",
51
+ "@memberjunction/ng-react": "5.44.0",
52
+ "@memberjunction/ng-record-changes": "5.44.0",
53
+ "@memberjunction/ng-record-tags": "5.44.0",
54
+ "@memberjunction/ng-shared-generic": "5.44.0",
55
+ "@memberjunction/ng-ui-components": "5.44.0",
54
56
  "rxjs": "^7.8.2",
55
57
  "tslib": "^2.8.1"
56
58
  },