@memberjunction/ng-explorer-core 6.2.0-edge.5 → 6.2.0-edge.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +7 -2
  2. package/dist/app-routing.module.d.ts.map +1 -1
  3. package/dist/app-routing.module.js +12 -4
  4. package/dist/app-routing.module.js.map +1 -1
  5. package/dist/generated/lazy-feature-config.d.ts +1 -1
  6. package/dist/generated/lazy-feature-config.d.ts.map +1 -1
  7. package/dist/generated/lazy-feature-config.js +4 -2
  8. package/dist/generated/lazy-feature-config.js.map +1 -1
  9. package/dist/lib/resource-wrappers/record-form-mode.d.ts +44 -0
  10. package/dist/lib/resource-wrappers/record-form-mode.d.ts.map +1 -0
  11. package/dist/lib/resource-wrappers/record-form-mode.js +47 -0
  12. package/dist/lib/resource-wrappers/record-form-mode.js.map +1 -0
  13. package/dist/lib/resource-wrappers/record-resource.component.d.ts +56 -1
  14. package/dist/lib/resource-wrappers/record-resource.component.d.ts.map +1 -1
  15. package/dist/lib/resource-wrappers/record-resource.component.js +124 -9
  16. package/dist/lib/resource-wrappers/record-resource.component.js.map +1 -1
  17. package/dist/lib/resource-wrappers/standard-form-create.d.ts +4 -0
  18. package/dist/lib/resource-wrappers/standard-form-create.d.ts.map +1 -0
  19. package/dist/lib/resource-wrappers/standard-form-create.js +6 -0
  20. package/dist/lib/resource-wrappers/standard-form-create.js.map +1 -0
  21. package/dist/lib/resource-wrappers/view-resource.component.d.ts +18 -1
  22. package/dist/lib/resource-wrappers/view-resource.component.d.ts.map +1 -1
  23. package/dist/lib/resource-wrappers/view-resource.component.js +105 -39
  24. package/dist/lib/resource-wrappers/view-resource.component.js.map +1 -1
  25. package/dist/lib/shell/components/record-open/record-origin-crumb.component.d.ts.map +1 -1
  26. package/dist/lib/shell/components/record-open/record-origin-crumb.component.js +12 -8
  27. package/dist/lib/shell/components/record-open/record-origin-crumb.component.js.map +1 -1
  28. package/dist/lib/shell/components/tabs/component-cache-manager.d.ts +6 -0
  29. package/dist/lib/shell/components/tabs/component-cache-manager.d.ts.map +1 -1
  30. package/dist/lib/shell/components/tabs/component-cache-manager.js +18 -3
  31. package/dist/lib/shell/components/tabs/component-cache-manager.js.map +1 -1
  32. package/dist/lib/shell/components/tabs/tab-container.component.d.ts +2 -0
  33. package/dist/lib/shell/components/tabs/tab-container.component.d.ts.map +1 -1
  34. package/dist/lib/shell/components/tabs/tab-container.component.js +38 -10
  35. package/dist/lib/shell/components/tabs/tab-container.component.js.map +1 -1
  36. package/dist/lib/shell/shell-chrome-policy.d.ts +6 -0
  37. package/dist/lib/shell/shell-chrome-policy.d.ts.map +1 -1
  38. package/dist/lib/shell/shell-chrome-policy.js +1 -0
  39. package/dist/lib/shell/shell-chrome-policy.js.map +1 -1
  40. package/dist/lib/shell/shell.component.d.ts +23 -0
  41. package/dist/lib/shell/shell.component.d.ts.map +1 -1
  42. package/dist/lib/shell/shell.component.js +283 -71
  43. package/dist/lib/shell/shell.component.js.map +1 -1
  44. package/dist/lib/single-record/single-record.component.d.ts +27 -2
  45. package/dist/lib/single-record/single-record.component.d.ts.map +1 -1
  46. package/dist/lib/single-record/single-record.component.js +54 -8
  47. package/dist/lib/single-record/single-record.component.js.map +1 -1
  48. package/dist/lib/user-notifications/user-notifications.component.d.ts +10 -2
  49. package/dist/lib/user-notifications/user-notifications.component.d.ts.map +1 -1
  50. package/dist/lib/user-notifications/user-notifications.component.js +77 -22
  51. package/dist/lib/user-notifications/user-notifications.component.js.map +1 -1
  52. package/package.json +57 -57
@@ -0,0 +1,47 @@
1
+ import { FORM_MODE_QUERY_PARAM, ReadStandardFormQuery } from '@memberjunction/ng-shared';
2
+ import { UUIDsEqual } from '@memberjunction/global';
3
+ /**
4
+ * A record tab's form mode (MJ#4755) lives in its `form` query param, so the
5
+ * URL, back/forward, re-focus and a cached component all see one value.
6
+ * These are the decisions EntityRecordResource makes about it, kept pure so
7
+ * the component stays a thin caller.
8
+ */
9
+ /** The form mode a tab's query params ask for: `'standard'` only for `form=standard`. */
10
+ export function FormModeFromQueryParams(params) {
11
+ return ReadStandardFormQuery(params) ?? 'default';
12
+ }
13
+ /** The query-param patch that records `mode` on the tab (`null` removes the param). */
14
+ export function FormModeQueryParams(mode) {
15
+ return { [FORM_MODE_QUERY_PARAM]: mode === 'standard' ? 'standard' : null };
16
+ }
17
+ /**
18
+ * Whether a record component still owns its tab: the live tab hosts the same
19
+ * record (entity compared case- and whitespace-insensitively; record id via
20
+ * UUIDsEqual, like the tab identity guard — a save rewrites the component's id
21
+ * in the server's casing). False for a closed tab. A cached
22
+ * component whose tab id was reused for another record is not the owner, so
23
+ * that tab's `form` param is not addressed to it.
24
+ */
25
+ export function IsRecordTabOwner(liveTab, own) {
26
+ if (!liveTab)
27
+ return false;
28
+ const entityKey = (entity) => (entity ?? '').trim().toLowerCase();
29
+ return entityKey(liveTab.Entity) === entityKey(own.Entity) && UUIDsEqual(liveTab.RecordId, own.RecordId);
30
+ }
31
+ /**
32
+ * Follow the tab's query params. With a mounted form, switches through the
33
+ * host's guarded `SwitchFormMode`; a refusal (unsaved work) keeps the live
34
+ * mode and asks for a write-back. Without one (`switcher` null), the requested
35
+ * mode is simply adopted — the input binding carries it to the host at mount.
36
+ */
37
+ export function ReconcileFormMode(params, current, switcher) {
38
+ const desired = FormModeFromQueryParams(params);
39
+ if (desired === current)
40
+ return { Mode: current, WriteBack: null };
41
+ if (!switcher)
42
+ return { Mode: desired, WriteBack: null };
43
+ return switcher.SwitchFormMode(desired)
44
+ ? { Mode: desired, WriteBack: null }
45
+ : { Mode: current, WriteBack: FormModeQueryParams(current) };
46
+ }
47
+ //# sourceMappingURL=record-form-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-form-mode.js","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/record-form-mode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;A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,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE;QACpC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;AACjE,CAAC","sourcesContent":["import type { EntityFormMode } from '@memberjunction/ng-base-forms';\nimport { FORM_MODE_QUERY_PARAM, ReadStandardFormQuery } from '@memberjunction/ng-shared';\nimport { UUIDsEqual } from '@memberjunction/global';\n\n/**\n * A record tab's form mode (MJ#4755) lives in its `form` query param, so the\n * URL, back/forward, re-focus and a cached component all see one value.\n * These are the decisions EntityRecordResource makes about it, kept pure so\n * the component stays a thin caller.\n */\n\n/** The form mode a tab's query params ask for: `'standard'` only for `form=standard`. */\nexport function FormModeFromQueryParams(params: Record<string, string>): EntityFormMode {\n return ReadStandardFormQuery(params) ?? 'default';\n}\n\n/** The query-param patch that records `mode` on the tab (`null` removes the param). */\nexport function FormModeQueryParams(mode: EntityFormMode): Record<string, string | null> {\n return { [FORM_MODE_QUERY_PARAM]: mode === 'standard' ? 'standard' : null };\n}\n\n/** The record a tab hosts, or that a record component was opened for. */\nexport interface RecordTabIdentity {\n Entity: string | undefined;\n RecordId: string;\n}\n\n/**\n * Whether a record component still owns its tab: the live tab hosts the same\n * record (entity compared case- and whitespace-insensitively; record id via\n * UUIDsEqual, like the tab identity guard — a save rewrites the component's id\n * in the server's casing). False for a closed tab. A cached\n * component whose tab id was reused for another record is not the owner, so\n * that tab's `form` param is not addressed to it.\n */\nexport function IsRecordTabOwner(liveTab: RecordTabIdentity | null, own: RecordTabIdentity): boolean {\n if (!liveTab) return false;\n const entityKey = (entity: string | undefined): string => (entity ?? '').trim().toLowerCase();\n return entityKey(liveTab.Entity) === entityKey(own.Entity) && UUIDsEqual(liveTab.RecordId, own.RecordId);\n}\n\n/** Whatever can switch a mounted form (SingleRecordComponent → the form host). */\nexport interface FormModeSwitcher {\n SwitchFormMode(mode: EntityFormMode): boolean;\n}\n\n/** Outcome of following a query-param change. */\nexport interface FormModeReconciliation {\n /** The mode now in effect. */\n Mode: EntityFormMode;\n /** Params to write back when the switch was refused, so the URL matches the screen; else null. */\n WriteBack: Record<string, string | null> | null;\n}\n\n/**\n * Follow the tab's query params. With a mounted form, switches through the\n * host's guarded `SwitchFormMode`; a refusal (unsaved work) keeps the live\n * mode and asks for a write-back. Without one (`switcher` null), the requested\n * mode is simply adopted — the input binding carries it to the host at mount.\n */\nexport function ReconcileFormMode(\n params: Record<string, string>,\n current: EntityFormMode,\n switcher: FormModeSwitcher | null\n): FormModeReconciliation {\n const desired = FormModeFromQueryParams(params);\n if (desired === current) return { Mode: current, WriteBack: null };\n if (!switcher) return { Mode: desired, WriteBack: null };\n return switcher.SwitchFormMode(desired)\n ? { Mode: desired, WriteBack: null }\n : { Mode: current, WriteBack: FormModeQueryParams(current) };\n}\n"]}
@@ -2,7 +2,7 @@ import { OnInit } from '@angular/core';
2
2
  import { BaseResourceComponent } from '@memberjunction/ng-shared';
3
3
  import { ResourceData } from '@memberjunction/core-entities';
4
4
  import { CompositeKey, IMetadataProvider } from '@memberjunction/core';
5
- import { type FormCompositionSnapshot } from '@memberjunction/ng-base-forms';
5
+ import { EntityFormMode, type FormCompositionSnapshot } from '@memberjunction/ng-base-forms';
6
6
  import * as i0 from "@angular/core";
7
7
  export declare class EntityRecordResource extends BaseResourceComponent implements OnInit {
8
8
  private singleRecord?;
@@ -27,11 +27,66 @@ export declare class EntityRecordResource extends BaseResourceComponent implemen
27
27
  * the surface the user sees, and returning to this tab publishes it again.
28
28
  */
29
29
  OnCompositionChanged(snapshot: FormCompositionSnapshot): void;
30
+ /** Ensure the active form's agent context is published immediately when opening AI chat. */
31
+ OnAskAIRequested(): void;
30
32
  /** Publishes the kept context while this tab is on screen and the shell's context lacks it. */
31
33
  private publishAgentContext;
32
34
  /** True while the cache has this tab attached and it is the workspace's active tab. */
33
35
  private isOnScreen;
34
36
  get PrimaryKey(): CompositeKey;
37
+ /**
38
+ * Custom vs standard form (MJ#4755). The tab's `form` query param is the
39
+ * source of truth — the URL, back/forward, tab re-focus and a cached
40
+ * component all read it — and this tracks the mode actually on screen.
41
+ */
42
+ private _formMode;
43
+ /** The mode bound to the form host: seeded from the tab's params, so a deep link mounts the standard form directly. */
44
+ get FormMode(): EntityFormMode;
45
+ set Data(value: ResourceData);
46
+ get Data(): ResourceData;
47
+ private destroyed;
48
+ ngOnDestroy(): void;
49
+ /**
50
+ * Follow the tab's `form` param — a standard-form open that dedup routed
51
+ * to this tab, a deep link, back/forward, or a plain URL clearing it.
52
+ */
53
+ protected OnQueryParamsChanged(params: Record<string, string>, _source: 'popstate' | 'deeplink'): void;
54
+ /**
55
+ * Re-home after a cache reattach. A reattach to a DIFFERENT tab id replays
56
+ * that tab's params in the base class. A same-id reattach does not — and
57
+ * a delivery this component skipped while its tab hosted another record
58
+ * (see {@link applyFormModeParams}) is recorded as delivered, so it would
59
+ * never come again. Re-read the live params in that case.
60
+ */
61
+ RebindTabId(tabId: string): void;
62
+ /**
63
+ * The host switched forms and told us: the strip, a programmatic
64
+ * {@link SingleRecordComponent.SwitchFormMode} (including our own, from
65
+ * {@link applyFormModeParams}), or an interactive-variant pick (back to
66
+ * default). Record it on the tab, and so the URL. For our own switch this
67
+ * runs inside a query-param delivery, where UpdateQueryParams is suppressed
68
+ * — correct, since the tab already says it, and it cannot loop.
69
+ */
70
+ OnFormModeChange(mode: EntityFormMode): void;
71
+ /**
72
+ * Reconcile the mounted form with a tab's `form` param. Ignored unless this
73
+ * component still owns its tab: a cached (detached) record stays subscribed
74
+ * to its birth tab id, which may now host another record — whose params
75
+ * would otherwise reload this form in the background or raise a spurious
76
+ * "save or discard" warning.
77
+ */
78
+ private applyFormModeParams;
79
+ /**
80
+ * The switch was refused (unsaved work; the host warned the user): put the
81
+ * URL back to what is on screen. Deferred a microtask because
82
+ * UpdateQueryParams is suppressed for the whole delivery that called us;
83
+ * re-checked then, since the component may be gone or its tab reused.
84
+ */
85
+ private writeBackRefusedMode;
86
+ /** Re-read the live tab's params and reconcile (same-id cache reattach). */
87
+ private resyncFormModeFromTab;
88
+ /** Whether the live tab still hosts this component's record. */
89
+ private ownsTab;
35
90
  static GetPrimaryKey(data: ResourceData, provider?: IMetadataProvider): CompositeKey;
36
91
  GetResourceDisplayName(data: ResourceData): Promise<string>;
37
92
  GetResourceIconClass(data: ResourceData): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"record-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/record-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAqB,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAY,YAAY,EAAc,iBAAiB,EAA0B,MAAM,sBAAsB,CAAC;AAErH,OAAO,EAAgD,KAAK,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;;AAC3H,qBAOa,oBAAqB,SAAQ,qBAAsB,YAAW,MAAM;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAwB;IAE/E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAE3D,kFAAkF;IAClF,OAAO,CAAC,YAAY,CAA2C;IAE/D,wGAAwG;IACxF,SAAS,IAAI,OAAO;IAIpC,uFAAuF;IAChF,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAItC,QAAQ,IAAI,IAAI;IAahC;;;;;;;;;;;OAWG;IACI,oBAAoB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI;IAKpE,+FAA+F;IAC/F,OAAO,CAAC,mBAAmB;IAO3B,uFAAuF;IACvF,OAAO,CAAC,UAAU;IAMlB,IAAW,UAAU,IAAI,YAAY,CAEpC;WAEa,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,YAAY;IA4BrF,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA2B3D,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;yCA1HtD,oBAAoB;2CAApB,oBAAoB;CAuIhC"}
1
+ {"version":3,"file":"record-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/record-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,MAAM,EAAqB,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,qBAAqB,EAAkC,MAAM,2BAA2B,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAY,YAAY,EAAc,iBAAiB,EAAoC,MAAM,sBAAsB,CAAC;AAG/H,OAAO,EAAyB,cAAc,EAAyB,KAAK,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;;AAC3I,qBAOa,oBAAqB,SAAQ,qBAAsB,YAAW,MAAM;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAwB;IAE/E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiC;IAE3D,kFAAkF;IAClF,OAAO,CAAC,YAAY,CAA2C;IAE/D,wGAAwG;IACxF,SAAS,IAAI,OAAO;IAIpC,uFAAuF;IAChF,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAItC,QAAQ,IAAI,IAAI;IAahC;;;;;;;;;;;OAWG;IACI,oBAAoB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI;IAKpE,4FAA4F;IACrF,gBAAgB,IAAI,IAAI;IAI/B,+FAA+F;IAC/F,OAAO,CAAC,mBAAmB;IAO3B,uFAAuF;IACvF,OAAO,CAAC,UAAU;IAMlB,IAAW,UAAU,IAAI,YAAY,CAEpC;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS,CAA6B;IAE9C,uHAAuH;IACvH,IAAW,QAAQ,IAAI,cAAc,CAEpC;IAED,IAAoB,IAAI,CAAC,KAAK,EAAE,YAAY,EAQ3C;IACD,IAAoB,IAAI,IAAI,YAAY,CAEvC;IAED,OAAO,CAAC,SAAS,CAAS;IAEV,WAAW,IAAI,IAAI;IAKnC;;;OAGG;cACgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,GAAG,UAAU,GAAG,IAAI;IAI/G;;;;;;OAMG;IACa,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAQhD;;;;;;;OAOG;IACI,gBAAgB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI;IAKnD;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAY5B,4EAA4E;IAC5E,OAAO,CAAC,qBAAqB;IAS7B,gEAAgE;IAChE,OAAO,CAAC,OAAO;WASD,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,EAAE,iBAAiB,GAAG,YAAY;IA4BrF,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IA2B3D,oBAAoB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;yCAzPtD,oBAAoB;2CAApB,oBAAoB;CAsQhC"}
@@ -7,11 +7,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var EntityRecordResource_1;
8
8
  import { Component, ViewChild, inject } from '@angular/core';
9
9
  import { asapScheduler, merge } from 'rxjs';
10
- import { filter, observeOn, takeUntil } from 'rxjs/operators';
11
- import { BaseResourceComponent } from '@memberjunction/ng-shared';
10
+ import { filter, observeOn, take, takeUntil } from 'rxjs/operators';
11
+ import { BaseResourceComponent, FormatEntityRecordDisplayTitle } from '@memberjunction/ng-shared';
12
12
  import { WorkspaceStateManager } from '@memberjunction/ng-base-application';
13
13
  import { RegisterClass } from '@memberjunction/global';
14
- import { Metadata, CompositeKey, IsNewEntityRecordUrlId } from '@memberjunction/core';
14
+ import { Metadata, CompositeKey, IsNewEntityRecordUrlId, LogError } from '@memberjunction/core';
15
+ import { FormModeFromQueryParams, FormModeQueryParams, IsRecordTabOwner, ReconcileFormMode } from './record-form-mode';
15
16
  import { SingleRecordComponent } from '../single-record/single-record.component';
16
17
  import { BuildFormAgentContext } from '@memberjunction/ng-base-forms';
17
18
  import * as i0 from "@angular/core";
@@ -55,6 +56,10 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
55
56
  this.agentContext = { Form: BuildFormAgentContext(snapshot) };
56
57
  this.publishAgentContext();
57
58
  }
59
+ /** Ensure the active form's agent context is published immediately when opening AI chat. */
60
+ OnAskAIRequested() {
61
+ this.publishAgentContext();
62
+ }
58
63
  /** Publishes the kept context while this tab is on screen and the shell's context lacks it. */
59
64
  publishAgentContext() {
60
65
  const context = this.agentContext;
@@ -74,6 +79,116 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
74
79
  get PrimaryKey() {
75
80
  return EntityRecordResource_1.GetPrimaryKey(this.Data, this.ProviderToUse);
76
81
  }
82
+ /**
83
+ * Custom vs standard form (MJ#4755). The tab's `form` query param is the
84
+ * source of truth — the URL, back/forward, tab re-focus and a cached
85
+ * component all read it — and this tracks the mode actually on screen.
86
+ */
87
+ _formMode = 'default';
88
+ /** The mode bound to the form host: seeded from the tab's params, so a deep link mounts the standard form directly. */
89
+ get FormMode() {
90
+ return this._formMode;
91
+ }
92
+ set Data(value) {
93
+ super.Data = value;
94
+ // Seed only before the form mounts: afterwards a changed input would
95
+ // remount the host WITHOUT its unsaved-work guard. Later changes arrive
96
+ // through OnQueryParamsChanged instead.
97
+ if (!this.singleRecord) {
98
+ this._formMode = FormModeFromQueryParams(this.GetQueryParams());
99
+ }
100
+ }
101
+ get Data() {
102
+ return super.Data;
103
+ }
104
+ destroyed = false;
105
+ ngOnDestroy() {
106
+ this.destroyed = true;
107
+ super.ngOnDestroy();
108
+ }
109
+ /**
110
+ * Follow the tab's `form` param — a standard-form open that dedup routed
111
+ * to this tab, a deep link, back/forward, or a plain URL clearing it.
112
+ */
113
+ OnQueryParamsChanged(params, _source) {
114
+ this.applyFormModeParams(params);
115
+ }
116
+ /**
117
+ * Re-home after a cache reattach. A reattach to a DIFFERENT tab id replays
118
+ * that tab's params in the base class. A same-id reattach does not — and
119
+ * a delivery this component skipped while its tab hosted another record
120
+ * (see {@link applyFormModeParams}) is recorded as delivered, so it would
121
+ * never come again. Re-read the live params in that case.
122
+ */
123
+ RebindTabId(tabId) {
124
+ const sameTab = this.getTabId() === tabId;
125
+ super.RebindTabId(tabId);
126
+ if (sameTab) {
127
+ this.resyncFormModeFromTab();
128
+ }
129
+ }
130
+ /**
131
+ * The host switched forms and told us: the strip, a programmatic
132
+ * {@link SingleRecordComponent.SwitchFormMode} (including our own, from
133
+ * {@link applyFormModeParams}), or an interactive-variant pick (back to
134
+ * default). Record it on the tab, and so the URL. For our own switch this
135
+ * runs inside a query-param delivery, where UpdateQueryParams is suppressed
136
+ * — correct, since the tab already says it, and it cannot loop.
137
+ */
138
+ OnFormModeChange(mode) {
139
+ this._formMode = mode;
140
+ this.UpdateQueryParams(FormModeQueryParams(mode));
141
+ }
142
+ /**
143
+ * Reconcile the mounted form with a tab's `form` param. Ignored unless this
144
+ * component still owns its tab: a cached (detached) record stays subscribed
145
+ * to its birth tab id, which may now host another record — whose params
146
+ * would otherwise reload this form in the background or raise a spurious
147
+ * "save or discard" warning.
148
+ */
149
+ applyFormModeParams(params) {
150
+ if (!this.ownsTab())
151
+ return;
152
+ const result = ReconcileFormMode(params, this._formMode, this.singleRecord ?? null);
153
+ this._formMode = result.Mode;
154
+ if (result.WriteBack) {
155
+ this.writeBackRefusedMode(result.WriteBack);
156
+ }
157
+ }
158
+ /**
159
+ * The switch was refused (unsaved work; the host warned the user): put the
160
+ * URL back to what is on screen. Deferred a microtask because
161
+ * UpdateQueryParams is suppressed for the whole delivery that called us;
162
+ * re-checked then, since the component may be gone or its tab reused.
163
+ */
164
+ writeBackRefusedMode(writeBack) {
165
+ Promise.resolve()
166
+ .then(() => {
167
+ if (!this.destroyed && this.ownsTab()) {
168
+ this.UpdateQueryParams(writeBack);
169
+ }
170
+ })
171
+ .catch((err) => {
172
+ LogError(`EntityRecordResource: could not restore the form-mode query param for "${this.Data?.Configuration?.Entity}" (tab ${this.getTabId()}): ${err instanceof Error ? err.message : String(err)}`);
173
+ });
174
+ }
175
+ /** Re-read the live tab's params and reconcile (same-id cache reattach). */
176
+ resyncFormModeFromTab() {
177
+ const tabId = this.getTabId();
178
+ if (!tabId)
179
+ return;
180
+ // The workspace stream replays its current value on subscribe, so take(1) is a synchronous read.
181
+ this.navigationService.ObserveTabQueryParams(tabId)
182
+ .pipe(take(1))
183
+ .subscribe(params => this.applyFormModeParams(params));
184
+ }
185
+ /** Whether the live tab still hosts this component's record. */
186
+ ownsTab() {
187
+ const tabId = this.getTabId();
188
+ if (!tabId)
189
+ return false;
190
+ return IsRecordTabOwner(this.navigationService.GetTabRecordIdentity(tabId), { Entity: this.Data?.Configuration?.Entity, RecordId: this.Data?.ResourceRecordID || this.Data?.Configuration?.recordId || '' });
191
+ }
77
192
  static GetPrimaryKey(data, provider) {
78
193
  // global-provider-ok: static helper has no component instance scope; falls back to default provider
79
194
  const md = (provider ?? Metadata.Provider);
@@ -116,7 +231,7 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
116
231
  const pk = EntityRecordResource_1.GetPrimaryKey(data, this.ProviderToUse);
117
232
  if (pk.HasValue) {
118
233
  const name = await md.GetEntityRecordName(data.Configuration.Entity, pk);
119
- return name ? name : e.DisplayNameOrName;
234
+ return FormatEntityRecordDisplayTitle(e, data.Configuration.Entity, pk, name);
120
235
  }
121
236
  else {
122
237
  return `New ${e.DisplayNameOrName} Record`;
@@ -141,12 +256,12 @@ let EntityRecordResource = class EntityRecordResource extends BaseResourceCompon
141
256
  } if (rf & 2) {
142
257
  let _t;
143
258
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.singleRecord = _t.first);
144
- } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 3, consts: [[3, "loadComplete", "recordSaved", "recordDismissed", "EditModeChanged", "CompositionChanged", "PrimaryKey", "entityName", "newRecordValues"]], template: function EntityRecordResource_Template(rf, ctx) { if (rf & 1) {
259
+ } }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 4, consts: [[3, "FormModeChange", "loadComplete", "recordSaved", "recordDismissed", "EditModeChanged", "CompositionChanged", "AskAIRequested", "PrimaryKey", "entityName", "newRecordValues", "FormMode"]], template: function EntityRecordResource_Template(rf, ctx) { if (rf & 1) {
145
260
  i0.ɵɵelementStart(0, "mj-single-record", 0);
146
- i0.ɵɵlistener("loadComplete", function EntityRecordResource_Template_mj_single_record_loadComplete_0_listener() { return ctx.NotifyLoadComplete(); })("recordSaved", function EntityRecordResource_Template_mj_single_record_recordSaved_0_listener($event) { return ctx.ResourceRecordSaved($event); })("recordDismissed", function EntityRecordResource_Template_mj_single_record_recordDismissed_0_listener() { return ctx.NotifyCloseRequested(); })("EditModeChanged", function EntityRecordResource_Template_mj_single_record_EditModeChanged_0_listener($event) { return ctx.ResourceEditModeChanged($event); })("CompositionChanged", function EntityRecordResource_Template_mj_single_record_CompositionChanged_0_listener($event) { return ctx.OnCompositionChanged($event); });
261
+ i0.ɵɵlistener("FormModeChange", function EntityRecordResource_Template_mj_single_record_FormModeChange_0_listener($event) { return ctx.OnFormModeChange($event); })("loadComplete", function EntityRecordResource_Template_mj_single_record_loadComplete_0_listener() { return ctx.NotifyLoadComplete(); })("recordSaved", function EntityRecordResource_Template_mj_single_record_recordSaved_0_listener($event) { return ctx.ResourceRecordSaved($event); })("recordDismissed", function EntityRecordResource_Template_mj_single_record_recordDismissed_0_listener() { return ctx.NotifyCloseRequested(); })("EditModeChanged", function EntityRecordResource_Template_mj_single_record_EditModeChanged_0_listener($event) { return ctx.ResourceEditModeChanged($event); })("CompositionChanged", function EntityRecordResource_Template_mj_single_record_CompositionChanged_0_listener($event) { return ctx.OnCompositionChanged($event); })("AskAIRequested", function EntityRecordResource_Template_mj_single_record_AskAIRequested_0_listener() { return ctx.OnAskAIRequested(); });
147
262
  i0.ɵɵelementEnd();
148
263
  } if (rf & 2) {
149
- i0.ɵɵproperty("PrimaryKey", ctx.PrimaryKey)("entityName", ctx.Data.Configuration.Entity)("newRecordValues", ctx.Data.Configuration.NewRecordValues);
264
+ i0.ɵɵproperty("PrimaryKey", ctx.PrimaryKey)("entityName", ctx.Data.Configuration.Entity)("newRecordValues", ctx.Data.Configuration.NewRecordValues)("FormMode", ctx.FormMode);
150
265
  } }, dependencies: [i1.SingleRecordComponent], styles: ["[_nghost-%COMP%] { display: block; height: 100%; width: 100%; }"] });
151
266
  };
152
267
  EntityRecordResource = EntityRecordResource_1 = __decorate([
@@ -155,10 +270,10 @@ EntityRecordResource = EntityRecordResource_1 = __decorate([
155
270
  export { EntityRecordResource };
156
271
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(EntityRecordResource, [{
157
272
  type: Component,
158
- args: [{ standalone: false, selector: 'mj-record-resource', template: `<mj-single-record [PrimaryKey]="this.PrimaryKey" [entityName]="Data.Configuration.Entity" [newRecordValues]="Data.Configuration.NewRecordValues" (loadComplete)="NotifyLoadComplete()" (recordSaved)="ResourceRecordSaved($event)" (recordDismissed)="NotifyCloseRequested()" (EditModeChanged)="ResourceEditModeChanged($event)" (CompositionChanged)="OnCompositionChanged($event)"></mj-single-record>`, styles: [":host { display: block; height: 100%; width: 100%; }"] }]
273
+ args: [{ standalone: false, selector: 'mj-record-resource', template: `<mj-single-record [PrimaryKey]="this.PrimaryKey" [entityName]="Data.Configuration.Entity" [newRecordValues]="Data.Configuration.NewRecordValues" [FormMode]="FormMode" (FormModeChange)="OnFormModeChange($event)" (loadComplete)="NotifyLoadComplete()" (recordSaved)="ResourceRecordSaved($event)" (recordDismissed)="NotifyCloseRequested()" (EditModeChanged)="ResourceEditModeChanged($event)" (CompositionChanged)="OnCompositionChanged($event)" (AskAIRequested)="OnAskAIRequested()"></mj-single-record>`, styles: [":host { display: block; height: 100%; width: 100%; }"] }]
159
274
  }], null, { singleRecord: [{
160
275
  type: ViewChild,
161
276
  args: [SingleRecordComponent]
162
277
  }] }); })();
163
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityRecordResource, { className: "EntityRecordResource", filePath: "src/lib/resource-wrappers/record-resource.component.ts", lineNumber: 18 }); })();
278
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(EntityRecordResource, { className: "EntityRecordResource", filePath: "src/lib/resource-wrappers/record-resource.component.ts", lineNumber: 19 }); })();
164
279
  //# sourceMappingURL=record-resource.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"record-resource.component.js","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/record-resource.component.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,SAAS,EAAU,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAiC,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACrH,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAuD,MAAM,+BAA+B,CAAC;;;AAQpH,IAAM,oBAAoB,GAA1B,MA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6BACI,KAAK,YACL,oBAAoB,YAEpB,2YAA2Y;;kBAGpZ,SAAS;mBAAC,qBAAqB;;kFADvB,oBAAoB","sourcesContent":["import { Component, OnInit, ViewChild, inject } from '@angular/core';\nimport { asapScheduler, merge } from 'rxjs';\nimport { filter, observeOn, takeUntil } from 'rxjs/operators';\nimport { BaseResourceComponent } from '@memberjunction/ng-shared';\nimport { WorkspaceStateManager } from '@memberjunction/ng-base-application';\nimport { ResourceData } from '@memberjunction/core-entities';\nimport { RegisterClass } from '@memberjunction/global';\nimport { Metadata, CompositeKey, EntityInfo, IMetadataProvider, IsNewEntityRecordUrlId } from '@memberjunction/core';\nimport { SingleRecordComponent } from '../single-record/single-record.component';\nimport { BuildFormAgentContext, type FormAgentContext, type FormCompositionSnapshot } from '@memberjunction/ng-base-forms';\n@RegisterClass(BaseResourceComponent, 'RecordResource')\n@Component({\n standalone: false,\n selector: 'mj-record-resource',\n styles: [`:host { display: block; height: 100%; width: 100%; }`],\n template: `<mj-single-record [PrimaryKey]=\"this.PrimaryKey\" [entityName]=\"Data.Configuration.Entity\" [newRecordValues]=\"Data.Configuration.NewRecordValues\" (loadComplete)=\"NotifyLoadComplete()\" (recordSaved)=\"ResourceRecordSaved($event)\" (recordDismissed)=\"NotifyCloseRequested()\" (EditModeChanged)=\"ResourceEditModeChanged($event)\" (CompositionChanged)=\"OnCompositionChanged($event)\"></mj-single-record>`\n})\nexport class EntityRecordResource extends BaseResourceComponent implements OnInit {\n @ViewChild(SingleRecordComponent) private singleRecord?: SingleRecordComponent;\n\n private readonly workspace = inject(WorkspaceStateManager);\n\n /** The form context this tab last reported, kept so it can be published again. */\n private agentContext: { Form: FormAgentContext } | null = null;\n\n /** Fallback read for the pool predicate; promotion via ResourceEditModeChanged is the primary guard. */\n public override IsEditing(): boolean {\n return this.singleRecord?.IsEditing() === true;\n }\n\n /** The hosted form entered or left edit mode; the shell promotes the tab on `true`. */\n public ResourceEditModeChanged(editing: boolean): void {\n this.NotifyEditModeChanged(editing);\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n // Publish the kept context again when the shell's app context lacks it, or when the cache\n // reattaches this tab. Deferred, so a publish never runs inside another subscriber's\n // AppContextSnapshot$ delivery.\n merge(\n this.navigationService.AppContextSnapshot$,\n this.navigationService.ResourceReattached$.pipe(filter((resource) => resource === this)),\n )\n .pipe(observeOn(asapScheduler), takeUntil(this.destroy$))\n .subscribe(() => this.publishAgentContext());\n }\n\n /**\n * Report the form to the agent context, so an agent asked to build a panel for this record\n * knows what the form shows. The agent gets the compact form ({@link BuildFormAgentContext}):\n * entity, record, which form, and the sections. The full snapshot stays in the browser, in\n * the `FormCompositionRegistry` the apply flow reads.\n *\n * The shell folds this into `AppContextSnapshot.AdditionalContext` and assigns that wholesale,\n * so the last publisher wins app-wide, and it rebuilds the app context without it on every tab\n * switch. So the context is kept here and published only while this tab is the one on screen\n * (attached and the active tab): a background tab's late resolve cannot replace the context of\n * the surface the user sees, and returning to this tab publishes it again.\n */\n public OnCompositionChanged(snapshot: FormCompositionSnapshot): void {\n this.agentContext = { Form: BuildFormAgentContext(snapshot) };\n this.publishAgentContext();\n }\n\n /** Publishes the kept context while this tab is on screen and the shell's context lacks it. */\n private publishAgentContext(): void {\n const context = this.agentContext;\n if (!context || !this.isOnScreen()) return;\n if (this.navigationService.AppContextSnapshot$.value?.AdditionalContext === context) return;\n this.navigationService.SetAgentContext(this, context);\n }\n\n /** True while the cache has this tab attached and it is the workspace's active tab. */\n private isOnScreen(): boolean {\n if (this.navigationService.IsResourceDetached(this)) return false;\n const tabId = this.getTabId();\n return !!tabId && this.workspace.GetActiveTabId() === tabId;\n }\n\n public get PrimaryKey(): CompositeKey {\n return EntityRecordResource.GetPrimaryKey(this.Data, this.ProviderToUse);\n }\n\n public static GetPrimaryKey(data: ResourceData, provider?: IMetadataProvider): CompositeKey {\n // global-provider-ok: static helper has no component instance scope; falls back to default provider\n const md = (provider ?? Metadata.Provider) as IMetadataProvider;\n const requested = (data.Configuration.Entity ?? '').trim();\n // Prefer EntityByName (project rule: never use Entities.find for\n // single-entity lookups — case/whitespace tolerant + O(1) map). Fall\n // back to DisplayName match for callers (AI agents, hand-typed URLs,\n // external CTAs) that pass the human-readable display name instead\n // of the canonical Name (e.g. \"Users\" for \"MJ: Users\").\n let e: EntityInfo | undefined = md.EntityByName(requested);\n if (!e) {\n const lowered = requested.toLowerCase();\n e = md.Entities.find((x: EntityInfo) =>\n (x.DisplayName ?? '').trim().toLowerCase() === lowered);\n }\n if (!e){\n throw new Error(`Entity ${data.Configuration.Entity} not found in metadata (tried Name and DisplayName)`);\n }\n\n if (IsNewEntityRecordUrlId(data.ResourceRecordID)) {\n return new CompositeKey();\n }\n\n let compositeKey: CompositeKey = new CompositeKey();\n compositeKey.LoadFromURLSegment(e, data.ResourceRecordID);\n return compositeKey;\n }\n\n async GetResourceDisplayName(data: ResourceData): Promise<string> {\n if (!data.Configuration.Entity) {\n return '';\n }\n\n const md = this.ProviderToUse;\n let e = md.EntityByName(data.Configuration.Entity);\n if (!e) {\n // Same DisplayName fallback as GetPrimaryKey — keeps the\n // breadcrumb/title in sync when a CTA used the display name.\n const lowered = (data.Configuration.Entity ?? '').trim().toLowerCase();\n e = md.Entities.find((x: EntityInfo) =>\n (x.DisplayName ?? '').trim().toLowerCase() === lowered);\n }\n if (!e) {\n return '';\n }\n\n const pk: CompositeKey = EntityRecordResource.GetPrimaryKey(data, this.ProviderToUse);\n if (pk.HasValue) {\n const name = await md.GetEntityRecordName(data.Configuration.Entity, pk);\n return name ? name : e.DisplayNameOrName;\n } else {\n return `New ${e.DisplayNameOrName} Record`;\n }\n }\n\n async GetResourceIconClass(data: ResourceData): Promise<string> {\n if (!data.Configuration.Entity){\n return ''\n }\n else {\n const md = this.ProviderToUse;\n const e = md.Entities.find(e => e.Name.trim().toLowerCase() === data.Configuration.Entity.trim().toLowerCase());\n if (e)\n return e?.Icon;\n else\n return '';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"record-resource.component.js","sour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oBAAoB;IAPhC,aAAa,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;GAO1C,oBAAoB,CAsQhC;;iFAtQY,oBAAoB;cANhC,SAAS;6BACI,KAAK,YACL,oBAAoB,YAEpB,mfAAmf;;kBAG5f,SAAS;mBAAC,qBAAqB;;kFADvB,oBAAoB","sourcesContent":["import { Component, OnInit, ViewChild, inject } from '@angular/core';\nimport { asapScheduler, merge } from 'rxjs';\nimport { filter, observeOn, take, takeUntil } from 'rxjs/operators';\nimport { BaseResourceComponent, FormatEntityRecordDisplayTitle } from '@memberjunction/ng-shared';\nimport { WorkspaceStateManager } from '@memberjunction/ng-base-application';\nimport { ResourceData } from '@memberjunction/core-entities';\nimport { RegisterClass } from '@memberjunction/global';\nimport { Metadata, CompositeKey, EntityInfo, IMetadataProvider, IsNewEntityRecordUrlId, LogError } from '@memberjunction/core';\nimport { FormModeFromQueryParams, FormModeQueryParams, IsRecordTabOwner, ReconcileFormMode } from './record-form-mode';\nimport { SingleRecordComponent } from '../single-record/single-record.component';\nimport { BuildFormAgentContext, EntityFormMode, type FormAgentContext, type FormCompositionSnapshot } from '@memberjunction/ng-base-forms';\n@RegisterClass(BaseResourceComponent, 'RecordResource')\n@Component({\n standalone: false,\n selector: 'mj-record-resource',\n styles: [`:host { display: block; height: 100%; width: 100%; }`],\n template: `<mj-single-record [PrimaryKey]=\"this.PrimaryKey\" [entityName]=\"Data.Configuration.Entity\" [newRecordValues]=\"Data.Configuration.NewRecordValues\" [FormMode]=\"FormMode\" (FormModeChange)=\"OnFormModeChange($event)\" (loadComplete)=\"NotifyLoadComplete()\" (recordSaved)=\"ResourceRecordSaved($event)\" (recordDismissed)=\"NotifyCloseRequested()\" (EditModeChanged)=\"ResourceEditModeChanged($event)\" (CompositionChanged)=\"OnCompositionChanged($event)\" (AskAIRequested)=\"OnAskAIRequested()\"></mj-single-record>`\n})\nexport class EntityRecordResource extends BaseResourceComponent implements OnInit {\n @ViewChild(SingleRecordComponent) private singleRecord?: SingleRecordComponent;\n\n private readonly workspace = inject(WorkspaceStateManager);\n\n /** The form context this tab last reported, kept so it can be published again. */\n private agentContext: { Form: FormAgentContext } | null = null;\n\n /** Fallback read for the pool predicate; promotion via ResourceEditModeChanged is the primary guard. */\n public override IsEditing(): boolean {\n return this.singleRecord?.IsEditing() === true;\n }\n\n /** The hosted form entered or left edit mode; the shell promotes the tab on `true`. */\n public ResourceEditModeChanged(editing: boolean): void {\n this.NotifyEditModeChanged(editing);\n }\n\n public override ngOnInit(): void {\n super.ngOnInit();\n // Publish the kept context again when the shell's app context lacks it, or when the cache\n // reattaches this tab. Deferred, so a publish never runs inside another subscriber's\n // AppContextSnapshot$ delivery.\n merge(\n this.navigationService.AppContextSnapshot$,\n this.navigationService.ResourceReattached$.pipe(filter((resource) => resource === this)),\n )\n .pipe(observeOn(asapScheduler), takeUntil(this.destroy$))\n .subscribe(() => this.publishAgentContext());\n }\n\n /**\n * Report the form to the agent context, so an agent asked to build a panel for this record\n * knows what the form shows. The agent gets the compact form ({@link BuildFormAgentContext}):\n * entity, record, which form, and the sections. The full snapshot stays in the browser, in\n * the `FormCompositionRegistry` the apply flow reads.\n *\n * The shell folds this into `AppContextSnapshot.AdditionalContext` and assigns that wholesale,\n * so the last publisher wins app-wide, and it rebuilds the app context without it on every tab\n * switch. So the context is kept here and published only while this tab is the one on screen\n * (attached and the active tab): a background tab's late resolve cannot replace the context of\n * the surface the user sees, and returning to this tab publishes it again.\n */\n public OnCompositionChanged(snapshot: FormCompositionSnapshot): void {\n this.agentContext = { Form: BuildFormAgentContext(snapshot) };\n this.publishAgentContext();\n }\n\n /** Ensure the active form's agent context is published immediately when opening AI chat. */\n public OnAskAIRequested(): void {\n this.publishAgentContext();\n }\n\n /** Publishes the kept context while this tab is on screen and the shell's context lacks it. */\n private publishAgentContext(): void {\n const context = this.agentContext;\n if (!context || !this.isOnScreen()) return;\n if (this.navigationService.AppContextSnapshot$.value?.AdditionalContext === context) return;\n this.navigationService.SetAgentContext(this, context);\n }\n\n /** True while the cache has this tab attached and it is the workspace's active tab. */\n private isOnScreen(): boolean {\n if (this.navigationService.IsResourceDetached(this)) return false;\n const tabId = this.getTabId();\n return !!tabId && this.workspace.GetActiveTabId() === tabId;\n }\n\n public get PrimaryKey(): CompositeKey {\n return EntityRecordResource.GetPrimaryKey(this.Data, this.ProviderToUse);\n }\n\n /**\n * Custom vs standard form (MJ#4755). The tab's `form` query param is the\n * source of truth — the URL, back/forward, tab re-focus and a cached\n * component all read it — and this tracks the mode actually on screen.\n */\n private _formMode: EntityFormMode = 'default';\n\n /** The mode bound to the form host: seeded from the tab's params, so a deep link mounts the standard form directly. */\n public get FormMode(): EntityFormMode {\n return this._formMode;\n }\n\n public override set Data(value: ResourceData) {\n super.Data = value;\n // Seed only before the form mounts: afterwards a changed input would\n // remount the host WITHOUT its unsaved-work guard. Later changes arrive\n // through OnQueryParamsChanged instead.\n if (!this.singleRecord) {\n this._formMode = FormModeFromQueryParams(this.GetQueryParams());\n }\n }\n public override get Data(): ResourceData {\n return super.Data;\n }\n\n private destroyed = false;\n\n public override ngOnDestroy(): void {\n this.destroyed = true;\n super.ngOnDestroy();\n }\n\n /**\n * Follow the tab's `form` param — a standard-form open that dedup routed\n * to this tab, a deep link, back/forward, or a plain URL clearing it.\n */\n protected override OnQueryParamsChanged(params: Record<string, string>, _source: 'popstate' | 'deeplink'): void {\n this.applyFormModeParams(params);\n }\n\n /**\n * Re-home after a cache reattach. A reattach to a DIFFERENT tab id replays\n * that tab's params in the base class. A same-id reattach does not — and\n * a delivery this component skipped while its tab hosted another record\n * (see {@link applyFormModeParams}) is recorded as delivered, so it would\n * never come again. Re-read the live params in that case.\n */\n public override RebindTabId(tabId: string): void {\n const sameTab = this.getTabId() === tabId;\n super.RebindTabId(tabId);\n if (sameTab) {\n this.resyncFormModeFromTab();\n }\n }\n\n /**\n * The host switched forms and told us: the strip, a programmatic\n * {@link SingleRecordComponent.SwitchFormMode} (including our own, from\n * {@link applyFormModeParams}), or an interactive-variant pick (back to\n * default). Record it on the tab, and so the URL. For our own switch this\n * runs inside a query-param delivery, where UpdateQueryParams is suppressed\n * — correct, since the tab already says it, and it cannot loop.\n */\n public OnFormModeChange(mode: EntityFormMode): void {\n this._formMode = mode;\n this.UpdateQueryParams(FormModeQueryParams(mode));\n }\n\n /**\n * Reconcile the mounted form with a tab's `form` param. Ignored unless this\n * component still owns its tab: a cached (detached) record stays subscribed\n * to its birth tab id, which may now host another record — whose params\n * would otherwise reload this form in the background or raise a spurious\n * \"save or discard\" warning.\n */\n private applyFormModeParams(params: Record<string, string>): void {\n if (!this.ownsTab()) return;\n const result = ReconcileFormMode(params, this._formMode, this.singleRecord ?? null);\n this._formMode = result.Mode;\n if (result.WriteBack) {\n this.writeBackRefusedMode(result.WriteBack);\n }\n }\n\n /**\n * The switch was refused (unsaved work; the host warned the user): put the\n * URL back to what is on screen. Deferred a microtask because\n * UpdateQueryParams is suppressed for the whole delivery that called us;\n * re-checked then, since the component may be gone or its tab reused.\n */\n private writeBackRefusedMode(writeBack: Record<string, string | null>): void {\n Promise.resolve()\n .then(() => {\n if (!this.destroyed && this.ownsTab()) {\n this.UpdateQueryParams(writeBack);\n }\n })\n .catch((err: unknown) => {\n LogError(`EntityRecordResource: could not restore the form-mode query param for \"${this.Data?.Configuration?.Entity}\" (tab ${this.getTabId()}): ${err instanceof Error ? err.message : String(err)}`);\n });\n }\n\n /** Re-read the live tab's params and reconcile (same-id cache reattach). */\n private resyncFormModeFromTab(): void {\n const tabId = this.getTabId();\n if (!tabId) return;\n // The workspace stream replays its current value on subscribe, so take(1) is a synchronous read.\n this.navigationService.ObserveTabQueryParams(tabId)\n .pipe(take(1))\n .subscribe(params => this.applyFormModeParams(params));\n }\n\n /** Whether the live tab still hosts this component's record. */\n private ownsTab(): boolean {\n const tabId = this.getTabId();\n if (!tabId) return false;\n return IsRecordTabOwner(\n this.navigationService.GetTabRecordIdentity(tabId),\n { Entity: this.Data?.Configuration?.Entity, RecordId: this.Data?.ResourceRecordID || this.Data?.Configuration?.recordId || '' }\n );\n }\n\n public static GetPrimaryKey(data: ResourceData, provider?: IMetadataProvider): CompositeKey {\n // global-provider-ok: static helper has no component instance scope; falls back to default provider\n const md = (provider ?? Metadata.Provider) as IMetadataProvider;\n const requested = (data.Configuration.Entity ?? '').trim();\n // Prefer EntityByName (project rule: never use Entities.find for\n // single-entity lookups — case/whitespace tolerant + O(1) map). Fall\n // back to DisplayName match for callers (AI agents, hand-typed URLs,\n // external CTAs) that pass the human-readable display name instead\n // of the canonical Name (e.g. \"Users\" for \"MJ: Users\").\n let e: EntityInfo | undefined = md.EntityByName(requested);\n if (!e) {\n const lowered = requested.toLowerCase();\n e = md.Entities.find((x: EntityInfo) =>\n (x.DisplayName ?? '').trim().toLowerCase() === lowered);\n }\n if (!e){\n throw new Error(`Entity ${data.Configuration.Entity} not found in metadata (tried Name and DisplayName)`);\n }\n\n if (IsNewEntityRecordUrlId(data.ResourceRecordID)) {\n return new CompositeKey();\n }\n\n let compositeKey: CompositeKey = new CompositeKey();\n compositeKey.LoadFromURLSegment(e, data.ResourceRecordID);\n return compositeKey;\n }\n\n async GetResourceDisplayName(data: ResourceData): Promise<string> {\n if (!data.Configuration.Entity) {\n return '';\n }\n\n const md = this.ProviderToUse;\n let e = md.EntityByName(data.Configuration.Entity);\n if (!e) {\n // Same DisplayName fallback as GetPrimaryKey — keeps the\n // breadcrumb/title in sync when a CTA used the display name.\n const lowered = (data.Configuration.Entity ?? '').trim().toLowerCase();\n e = md.Entities.find((x: EntityInfo) =>\n (x.DisplayName ?? '').trim().toLowerCase() === lowered);\n }\n if (!e) {\n return '';\n }\n\n const pk: CompositeKey = EntityRecordResource.GetPrimaryKey(data, this.ProviderToUse);\n if (pk.HasValue) {\n const name = await md.GetEntityRecordName(data.Configuration.Entity, pk);\n return FormatEntityRecordDisplayTitle(e, data.Configuration.Entity, pk, name);\n } else {\n return `New ${e.DisplayNameOrName} Record`;\n }\n }\n\n async GetResourceIconClass(data: ResourceData): Promise<string> {\n if (!data.Configuration.Entity){\n return ''\n }\n else {\n const md = this.ProviderToUse;\n const e = md.Entities.find(e => e.Name.trim().toLowerCase() === data.Configuration.Entity.trim().toLowerCase());\n if (e)\n return e?.Icon;\n else\n return '';\n }\n }\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import { FormResolution } from '@memberjunction/ng-base-forms';
2
+ /** Offer "New in standard form" only when a custom form hides the standard one AND the user may create. */
3
+ export declare function ShouldOfferStandardFormCreate(resolution: FormResolution, canCreate: boolean): boolean;
4
+ //# sourceMappingURL=standard-form-create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-form-create.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/standard-form-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA8B,MAAM,+BAA+B,CAAC;AAE3F,2GAA2G;AAC3G,wBAAgB,6BAA6B,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAErG"}
@@ -0,0 +1,6 @@
1
+ import { HasStandardFormAlternative } from '@memberjunction/ng-base-forms';
2
+ /** Offer "New in standard form" only when a custom form hides the standard one AND the user may create. */
3
+ export function ShouldOfferStandardFormCreate(resolution, canCreate) {
4
+ return canCreate && HasStandardFormAlternative(resolution);
5
+ }
6
+ //# sourceMappingURL=standard-form-create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-form-create.js","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/standard-form-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3F,2GAA2G;AAC3G,MAAM,UAAU,6BAA6B,CAAC,UAA0B,EAAE,SAAkB;IAC1F,OAAO,SAAS,IAAI,0BAA0B,CAAC,UAAU,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { FormResolution, HasStandardFormAlternative } from '@memberjunction/ng-base-forms';\n\n/** Offer \"New in standard form\" only when a custom form hides the standard one AND the user may create. */\nexport function ShouldOfferStandardFormCreate(resolution: FormResolution, canCreate: boolean): boolean {\n return canCreate && HasStandardFormAlternative(resolution);\n}\n"]}
@@ -39,11 +39,17 @@ export declare class UserViewResource extends BaseResourceComponent {
39
39
  /** @deprecated Use {@link EntityInfo}. */
40
40
  set entityInfo(value: EntityInfo | null);
41
41
  ViewEntity: MJUserViewEntityExtended | null;
42
+ /**
43
+ * Show "New in standard form" (MJ#4755): a custom form hides the CodeGen
44
+ * form for this entity and the user may create. Resolved after load.
45
+ */
46
+ ShowNewInStandardForm: boolean;
42
47
  /** @deprecated Use {@link ViewEntity}. */
43
48
  get viewEntity(): MJUserViewEntityExtended | null;
44
49
  /** @deprecated Use {@link ViewEntity}. */
45
50
  set viewEntity(value: MJUserViewEntityExtended | null);
46
51
  GridState: ViewGridState | null;
52
+ AlternateBaseView: string | null;
47
53
  /** @deprecated Use {@link GridState}. */
48
54
  get gridState(): ViewGridState | null;
49
55
  /** @deprecated Use {@link GridState}. */
@@ -74,6 +80,7 @@ export declare class UserViewResource extends BaseResourceComponent {
74
80
  /** @deprecated Use {@link IsSavingAsList}. */
75
81
  set isSavingAsList(value: boolean);
76
82
  private dataLoaded;
83
+ private formResolver;
77
84
  private get metadata();
78
85
  constructor(cdr: ChangeDetectorRef, exportService: ExportService);
79
86
  ngOnInit(): void;
@@ -88,7 +95,7 @@ export declare class UserViewResource extends BaseResourceComponent {
88
95
  */
89
96
  private loadViewById;
90
97
  /**
91
- * Load a dynamic view (no saved view, just entity + filter)
98
+ * Load a dynamic view (no saved view, just entity + filter + optional alternate base view)
92
99
  */
93
100
  private loadDynamicView;
94
101
  /**
@@ -150,6 +157,16 @@ export declare class UserViewResource extends BaseResourceComponent {
150
157
  OnCreateNewRecord(): void;
151
158
  /** @deprecated Use {@link OnCreateNewRecord}. */
152
159
  onCreateNewRecord(): void;
160
+ /**
161
+ * Create a new record in the CodeGen standard form (MJ#4755) — the escape
162
+ * hatch for entities whose custom form cannot create records.
163
+ */
164
+ OnCreateNewRecordInStandardForm(): void;
165
+ /**
166
+ * Decide whether to offer "New in standard form" for the loaded entity.
167
+ * Discards the answer if the view moved to another entity meanwhile.
168
+ */
169
+ private refreshStandardFormCreate;
153
170
  /**
154
171
  * Open the Save-as-List dialog. Only meaningful for saved views (a
155
172
  * ViewID is required to materialize). Dynamic views fall back to a
@@ -1 +1 @@
1
- {"version":3,"file":"view-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/view-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,iBAAiB,EAAU,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAY,MAAM,+BAA+B,CAAC;AAEjG,OAAO,EAA0B,UAAU,EAA+B,MAAM,sBAAsB,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,qBAAqB,EAAE,2BAA2B,EAA8B,MAAM,kCAAkC,CAAC;AACpK,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;;AAE/E;;;;;;;;;;;GAWG;AACH,qBAmHa,gBAAiB,SAAQ,qBAAqB;IAmHnD,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,aAAa;IAnHiB,gBAAgB,EAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAExF,gDAAgD;IAChD,IAAI,gBAAgB,IAAI,UAAU,CAAC,cAAc,CAAC,CAEjD;IACD,gDAAgD;IAChD,IAAI,gBAAgB,CAAC,KAAK,EAAE,UAAU,CAAC,cAAc,CAAC,EAErD;IAC0B,eAAe,CAAC,EAAE,qBAAqB,CAAC;IAEnE,+CAA+C;IAC/C,IAAI,eAAe,IAAI,qBAAqB,GAAG,SAAS,CAEvD;IACD,+CAA+C;IAC/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M,CAAC;IAc1E;;OAEG;IACY,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzE;;OAEG;IACI,iBAAiB,IAAI,IAAI;IAOhC,iDAAiD;IAC1C,iBAAiB,IAAI,IAAI;IAIhC;;;;OAIG;IACI,YAAY,IAAI,IAAI;IAa3B,4CAA4C;IACrC,YAAY,IAAI,IAAI;IAIpB,qBAAqB,IAAI,IAAI;IAKpC,qDAAqD;IAC9C,qBAAqB,IAAI,IAAI;IAIvB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoC7E,kDAAkD;IACrC,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK7E;;OAEG;IACH,OAAO,CAAC,gBAAgB;yCAviBf,gBAAgB;2CAAhB,gBAAgB;CAmjB5B"}
1
+ {"version":3,"file":"view-resource.component.d.ts","sourceRoot":"","sources":["../../../src/lib/resource-wrappers/view-resource.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,iBAAiB,EAAkB,MAAM,eAAe,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAwC,MAAM,2BAA2B,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAY,MAAM,+BAA+B,CAAC;AAEjG,OAAO,EAA0B,UAAU,EAAyC,MAAM,sBAAsB,CAAC;AAEjH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,qBAAqB,EAAE,2BAA2B,EAA8B,MAAM,kCAAkC,CAAC;AACpK,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;;AAG/E;;;;;;;;;;;GAWG;AACH,qBAmHa,gBAAiB,SAAQ,qBAAqB;IA2HnD,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,aAAa;IA3HiB,gBA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