@memberjunction/ng-base-forms 6.2.0-edge.5 → 6.2.0-edge.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -2
- package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -1
- package/dist/lib/apply/form-placement-preview.component.js +1 -0
- package/dist/lib/apply/form-placement-preview.component.js.map +1 -1
- package/dist/lib/base-form-component.d.ts +23 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +54 -10
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.d.ts +52 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.js +4 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +107 -1
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +1495 -316
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +159 -14
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +1360 -469
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.d.ts +124 -0
- package/dist/lib/form-record-refresh.coordinator.d.ts.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.js +93 -13
- package/dist/lib/form-record-refresh.coordinator.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +104 -2
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +272 -34
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.js +1 -0
- package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-card.component.js +7 -4
- package/dist/lib/isa-related-panel/isa-related-card.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js +1 -2
- package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
- package/dist/lib/links/record-link-utils.d.ts +83 -0
- package/dist/lib/links/record-link-utils.d.ts.map +1 -0
- package/dist/lib/links/record-link-utils.js +232 -0
- package/dist/lib/links/record-link-utils.js.map +1 -0
- package/dist/lib/links/record-link.component.d.ts +50 -0
- package/dist/lib/links/record-link.component.d.ts.map +1 -0
- package/dist/lib/links/record-link.component.js +319 -0
- package/dist/lib/links/record-link.component.js.map +1 -0
- package/dist/lib/links/record-link.directive.d.ts +94 -0
- package/dist/lib/links/record-link.directive.d.ts.map +1 -0
- package/dist/lib/links/record-link.directive.js +277 -0
- package/dist/lib/links/record-link.directive.js.map +1 -0
- package/dist/lib/links/record-links-drawer.component.d.ts +21 -0
- package/dist/lib/links/record-links-drawer.component.d.ts.map +1 -0
- package/dist/lib/links/record-links-drawer.component.js +61 -0
- package/dist/lib/links/record-links-drawer.component.js.map +1 -0
- package/dist/lib/links/record-links.component.d.ts +255 -0
- package/dist/lib/links/record-links.component.d.ts.map +1 -0
- package/dist/lib/links/record-links.component.js +1546 -0
- package/dist/lib/links/record-links.component.js.map +1 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +3 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +6 -0
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts +194 -0
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js +1084 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts +105 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js +278 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +44 -1
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +51 -3
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts +21 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js +90 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts +189 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js +274 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +21 -1
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +295 -195
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts.map +1 -1
- package/dist/lib/types/form-toolbar-item.js.map +1 -1
- package/dist/lib/types/toolbar-config.d.ts +4 -0
- package/dist/lib/types/toolbar-config.d.ts.map +1 -1
- package/dist/lib/types/toolbar-config.js +6 -0
- package/dist/lib/types/toolbar-config.js.map +1 -1
- package/dist/module.d.ts +19 -14
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +39 -6
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +9 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -21,19 +21,40 @@ export interface EntityFormOverrideRow {
|
|
|
21
21
|
Name?: string;
|
|
22
22
|
Description?: string | null;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Which form a host should mount. `'default'` = the resolver's normal pick
|
|
26
|
+
* (interactive override, else the highest-priority class form);
|
|
27
|
+
* `'standard'` = the CodeGen-generated form (see
|
|
28
|
+
* {@link FormResolverService.ResolveStandardForm}).
|
|
29
|
+
*/
|
|
30
|
+
export type EntityFormMode = 'default' | 'standard';
|
|
31
|
+
/**
|
|
32
|
+
* Resolved form kind for a given (entity, user, roles) tuple. Every variant
|
|
33
|
+
* also carries `standard` — the CodeGen-generated form class, or null when no
|
|
34
|
+
* class form is registered — so a host can offer it when a custom form hides it.
|
|
35
|
+
*/
|
|
25
36
|
export type FormResolution = {
|
|
26
37
|
kind: 'interactive';
|
|
27
38
|
override: EntityFormOverrideRow;
|
|
28
39
|
variants: EntityFormOverrideRow[];
|
|
40
|
+
standard: Type<BaseFormComponent> | null;
|
|
29
41
|
} | {
|
|
30
42
|
kind: 'class';
|
|
31
43
|
subClass: Type<BaseFormComponent>;
|
|
32
44
|
variants: EntityFormOverrideRow[];
|
|
45
|
+
standard: Type<BaseFormComponent> | null;
|
|
33
46
|
} | {
|
|
34
47
|
kind: 'none';
|
|
35
48
|
variants: EntityFormOverrideRow[];
|
|
49
|
+
standard: Type<BaseFormComponent> | null;
|
|
36
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* True when a standard form exists AND the resolution is not already it —
|
|
53
|
+
* i.e. a custom form (a higher-priority class form or an interactive
|
|
54
|
+
* override) is hiding the CodeGen form. False for the common case of an
|
|
55
|
+
* entity whose only registration is the generated form.
|
|
56
|
+
*/
|
|
57
|
+
export declare function HasStandardFormAlternative(resolution: FormResolution): boolean;
|
|
37
58
|
/**
|
|
38
59
|
* Picks the form to render for an entity record and exposes the full list of
|
|
39
60
|
* applicable variants so the toolbar's variant switcher can offer alternates.
|
|
@@ -46,6 +67,12 @@ export type FormResolution = {
|
|
|
46
67
|
* the @RegisterClass + CodeGen-generated path used today.
|
|
47
68
|
* 3. None — caller surfaces the "no form registered" error.
|
|
48
69
|
*
|
|
70
|
+
* **Standard form.** Every resolution also carries `standard`, the
|
|
71
|
+
* CodeGen-generated form ({@link ResolveStandardForm}). Tiers 1 and 2 can
|
|
72
|
+
* both hide it — an override replaces it, and a custom `@RegisterClass` with
|
|
73
|
+
* a higher priority outranks it — so hosts use it as an escape hatch to reach
|
|
74
|
+
* every field of the entity.
|
|
75
|
+
*
|
|
49
76
|
* **Session selection.** If the user previously chose a non-default variant
|
|
50
77
|
* via the variant switcher and that choice is still applicable + Active, that
|
|
51
78
|
* choice wins over the default. Choice is keyed by entity name in
|
|
@@ -63,6 +90,22 @@ export type FormResolution = {
|
|
|
63
90
|
*/
|
|
64
91
|
export declare class FormResolverService {
|
|
65
92
|
ResolveFormForEntity(entity: EntityInfo, user: UserInfo, provider: IMetadataProvider): Promise<FormResolution>;
|
|
93
|
+
/**
|
|
94
|
+
* The CodeGen-generated ("standard") form class for an entity, or null
|
|
95
|
+
* when no class form is registered.
|
|
96
|
+
*
|
|
97
|
+
* **Why lowest priority = standard.** CodeGen emits
|
|
98
|
+
* `@RegisterClass(BaseFormComponent, '<Entity>')` with no priority, so
|
|
99
|
+
* ClassFactory auto-assigns `highest + 1` at registration time. A custom
|
|
100
|
+
* form either declares a higher explicit priority or extends the
|
|
101
|
+
* generated class (so it loads after it and gets a higher auto
|
|
102
|
+
* priority). The generated form is therefore the lowest-priority
|
|
103
|
+
* registration for the key. On a priority tie the FIRST registered wins
|
|
104
|
+
* here — the opposite of ClassFactory's winner rule (last wins), which is
|
|
105
|
+
* what makes a tied custom form outrank the generated one. With exactly
|
|
106
|
+
* one registration, that registration is the standard form.
|
|
107
|
+
*/
|
|
108
|
+
ResolveStandardForm(entity: EntityInfo): Type<BaseFormComponent> | null;
|
|
66
109
|
/**
|
|
67
110
|
* Public list-API for the variant switcher UI. Returns all variants
|
|
68
111
|
* applicable to (entity, user). Includes Active, Pending, and Inactive
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-resolver.service.d.ts","sourceRoot":"","sources":["../../../src/lib/resolver/form-resolver.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAGzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;;AAO3D;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,
|
|
1
|
+
{"version":3,"file":"form-resolver.service.d.ts","sourceRoot":"","sources":["../../../src/lib/resolver/form-resolver.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,IAAI,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,sBAAsB,CAAC;AAGzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;;AAO3D;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB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OAAO,CAAC,cAAc,CAAC;IAe1B;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAUvE;;;;;OAKG;IACG,qBAAqB,CACvB,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,iBAAiB,GAC5B,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAInC;;;;;;;;;;;OAWG;IACH,gBAAuB,yBAAyB,yBAAiC;IAEjF;;;OAGG;IACH,OAAO,CAAC,UAAU;IAIlB;;;;;;OAMG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAIhE;;;;;OAKG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAO5C;;;;;OAKG;IACH,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAK9C;;;;;OAKG;IACH,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;YAMvC,sBAAsB;IAgFpC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,UAAU;yCAjOT,mBAAmB;6CAAnB,mBAAmB;CAqP/B"}
|
|
@@ -6,6 +6,21 @@ import { BaseFormComponent } from '../base-form-component';
|
|
|
6
6
|
import { UserInfoEngine } from '@memberjunction/core-entities';
|
|
7
7
|
import { FORM_VARIANT_EXPLICIT_DEFAULT, FORM_VARIANT_SETTING_PREFIX, } from '@memberjunction/interactive-component-types/forms';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* True when a standard form exists AND the resolution is not already it —
|
|
11
|
+
* i.e. a custom form (a higher-priority class form or an interactive
|
|
12
|
+
* override) is hiding the CodeGen form. False for the common case of an
|
|
13
|
+
* entity whose only registration is the generated form.
|
|
14
|
+
*/
|
|
15
|
+
export function HasStandardFormAlternative(resolution) {
|
|
16
|
+
if (!resolution.standard)
|
|
17
|
+
return false;
|
|
18
|
+
if (resolution.kind === 'interactive')
|
|
19
|
+
return true;
|
|
20
|
+
if (resolution.kind === 'class')
|
|
21
|
+
return resolution.subClass !== resolution.standard;
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
9
24
|
/**
|
|
10
25
|
* UserInfoEngine setting-key prefix for per-user, per-entity form-variant
|
|
11
26
|
* preferences. Persisted to `MJ: User Settings` so the choice follows the
|
|
@@ -32,6 +47,12 @@ const VARIANT_SETTING_PREFIX = FORM_VARIANT_SETTING_PREFIX;
|
|
|
32
47
|
* the @RegisterClass + CodeGen-generated path used today.
|
|
33
48
|
* 3. None — caller surfaces the "no form registered" error.
|
|
34
49
|
*
|
|
50
|
+
* **Standard form.** Every resolution also carries `standard`, the
|
|
51
|
+
* CodeGen-generated form ({@link ResolveStandardForm}). Tiers 1 and 2 can
|
|
52
|
+
* both hide it — an override replaces it, and a custom `@RegisterClass` with
|
|
53
|
+
* a higher priority outranks it — so hosts use it as an escape hatch to reach
|
|
54
|
+
* every field of the entity.
|
|
55
|
+
*
|
|
35
56
|
* **Session selection.** If the user previously chose a non-default variant
|
|
36
57
|
* via the variant switcher and that choice is still applicable + Active, that
|
|
37
58
|
* choice wins over the default. Choice is keyed by entity name in
|
|
@@ -51,13 +72,40 @@ export class FormResolverService {
|
|
|
51
72
|
async ResolveFormForEntity(entity, user, provider) {
|
|
52
73
|
const variants = await this.listApplicableVariants(entity, user, provider);
|
|
53
74
|
const active = this.pickActive(entity, variants);
|
|
75
|
+
const standard = this.ResolveStandardForm(entity);
|
|
54
76
|
if (active) {
|
|
55
|
-
return { kind: 'interactive', override: active, variants };
|
|
77
|
+
return { kind: 'interactive', override: active, variants, standard };
|
|
56
78
|
}
|
|
57
79
|
const reg = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormComponent, entity.Name);
|
|
58
80
|
return reg
|
|
59
|
-
? { kind: 'class', subClass: reg.SubClass, variants }
|
|
60
|
-
: { kind: 'none', variants };
|
|
81
|
+
? { kind: 'class', subClass: reg.SubClass, variants, standard }
|
|
82
|
+
: { kind: 'none', variants, standard };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The CodeGen-generated ("standard") form class for an entity, or null
|
|
86
|
+
* when no class form is registered.
|
|
87
|
+
*
|
|
88
|
+
* **Why lowest priority = standard.** CodeGen emits
|
|
89
|
+
* `@RegisterClass(BaseFormComponent, '<Entity>')` with no priority, so
|
|
90
|
+
* ClassFactory auto-assigns `highest + 1` at registration time. A custom
|
|
91
|
+
* form either declares a higher explicit priority or extends the
|
|
92
|
+
* generated class (so it loads after it and gets a higher auto
|
|
93
|
+
* priority). The generated form is therefore the lowest-priority
|
|
94
|
+
* registration for the key. On a priority tie the FIRST registered wins
|
|
95
|
+
* here — the opposite of ClassFactory's winner rule (last wins), which is
|
|
96
|
+
* what makes a tied custom form outrank the generated one. With exactly
|
|
97
|
+
* one registration, that registration is the standard form.
|
|
98
|
+
*/
|
|
99
|
+
ResolveStandardForm(entity) {
|
|
100
|
+
const regs = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormComponent, entity.Name);
|
|
101
|
+
if (regs.length === 0)
|
|
102
|
+
return null;
|
|
103
|
+
let lowest = regs[0];
|
|
104
|
+
for (const r of regs) {
|
|
105
|
+
if (r.Priority < lowest.Priority)
|
|
106
|
+
lowest = r; // strict < keeps the FIRST on ties
|
|
107
|
+
}
|
|
108
|
+
return lowest.SubClass;
|
|
61
109
|
}
|
|
62
110
|
/**
|
|
63
111
|
* Public list-API for the variant switcher UI. Returns all variants
|
|
@@ -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,wBA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,UAAU,CAAC,CAAC,CAAC;YAC5F,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;6GA1NQ,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 { FormScopeAllowedOnEntity, InteractiveFormsEngine, IsSelectableFormOverride } from '@memberjunction/core-entities';\nimport { MJGlobal, UUIDsEqual } from '@memberjunction/global';\nimport { BaseFormComponent } from '../base-form-component';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport {\n FORM_VARIANT_EXPLICIT_DEFAULT,\n FORM_VARIANT_SETTING_PREFIX,\n} from '@memberjunction/interactive-component-types/forms';\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 = FORM_VARIANT_SETTING_PREFIX;\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 = FORM_VARIANT_EXPLICIT_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 and\n // pickActive() keep the ones IsSelectableFormOverride allows. Replaces\n // a per-LoadForm RunView with an in-memory predicate — sub-ms.\n // An identity or permission entity takes only the user's own forms.\n const applicable = InteractiveFormsEngine.Instance.Overrides.filter(o => {\n if (!o.EntityID || !UUIDsEqual(o.EntityID, entity.ID)) return false;\n if (!FormScopeAllowedOnEntity(entity.Name, o.Scope)) 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 is selectable (`IsSelectableFormOverride`:\n * Active, or the user's own form set aside by a later apply) → use it.\n * - Else → the stored choice is dropped, and the first Active row in\n * tier+priority order is used (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 // The user's own set-aside form is a legitimate choice, not history: applying a\n // second form sets the first one aside rather than merging into it, so the picker\n // offers both and the user's pick outranks which row happens to hold Active. A\n // shared form set aside was retracted, and a Pending row is a draft; neither renders.\n const sel = variants.find(v => IsSelectableFormOverride(v) && 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,wBAAwB,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC3H,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM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C;YAC5C,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,MAAM,EAAE,CAAC,CAAC,MAA2C;YACrD,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC,WAAW;SAC7B,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;;;;;;;;;;;;;;OAeG;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,gFAAgF;YAChF,kFAAkF;YAClF,+EAA+E;YAC/E,sFAAsF;YACtF,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;YAC5F,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;6GApPQ,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 { FormScopeAllowedOnEntity, InteractiveFormsEngine, IsSelectableFormOverride } from '@memberjunction/core-entities';\nimport { MJGlobal, UUIDsEqual } from '@memberjunction/global';\nimport { BaseFormComponent } from '../base-form-component';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport {\n FORM_VARIANT_EXPLICIT_DEFAULT,\n FORM_VARIANT_SETTING_PREFIX,\n} from '@memberjunction/interactive-component-types/forms';\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/**\n * Which form a host should mount. `'default'` = the resolver's normal pick\n * (interactive override, else the highest-priority class form);\n * `'standard'` = the CodeGen-generated form (see\n * {@link FormResolverService.ResolveStandardForm}).\n */\nexport type EntityFormMode = 'default' | 'standard';\n\n/**\n * Resolved form kind for a given (entity, user, roles) tuple. Every variant\n * also carries `standard` — the CodeGen-generated form class, or null when no\n * class form is registered — so a host can offer it when a custom form hides it.\n */\nexport type FormResolution =\n | { kind: 'interactive'; override: EntityFormOverrideRow; variants: EntityFormOverrideRow[]; standard: Type<BaseFormComponent> | null }\n | { kind: 'class'; subClass: Type<BaseFormComponent>; variants: EntityFormOverrideRow[]; standard: Type<BaseFormComponent> | null }\n | { kind: 'none'; variants: EntityFormOverrideRow[]; standard: Type<BaseFormComponent> | null };\n\n/**\n * True when a standard form exists AND the resolution is not already it —\n * i.e. a custom form (a higher-priority class form or an interactive\n * override) is hiding the CodeGen form. False for the common case of an\n * entity whose only registration is the generated form.\n */\nexport function HasStandardFormAlternative(resolution: FormResolution): boolean {\n if (!resolution.standard) return false;\n if (resolution.kind === 'interactive') return true;\n if (resolution.kind === 'class') return resolution.subClass !== resolution.standard;\n return false;\n}\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 = FORM_VARIANT_SETTING_PREFIX;\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 * **Standard form.** Every resolution also carries `standard`, the\n * CodeGen-generated form ({@link ResolveStandardForm}). Tiers 1 and 2 can\n * both hide it — an override replaces it, and a custom `@RegisterClass` with\n * a higher priority outranks it — so hosts use it as an escape hatch to reach\n * every field of the entity.\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 const standard = this.ResolveStandardForm(entity);\n\n if (active) {\n return { kind: 'interactive', override: active, variants, standard };\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, standard }\n : { kind: 'none', variants, standard };\n }\n\n /**\n * The CodeGen-generated (\"standard\") form class for an entity, or null\n * when no class form is registered.\n *\n * **Why lowest priority = standard.** CodeGen emits\n * `@RegisterClass(BaseFormComponent, '<Entity>')` with no priority, so\n * ClassFactory auto-assigns `highest + 1` at registration time. A custom\n * form either declares a higher explicit priority or extends the\n * generated class (so it loads after it and gets a higher auto\n * priority). The generated form is therefore the lowest-priority\n * registration for the key. On a priority tie the FIRST registered wins\n * here — the opposite of ClassFactory's winner rule (last wins), which is\n * what makes a tied custom form outrank the generated one. With exactly\n * one registration, that registration is the standard form.\n */\n ResolveStandardForm(entity: EntityInfo): Type<BaseFormComponent> | null {\n const regs = MJGlobal.Instance.ClassFactory.GetAllRegistrations(BaseFormComponent, entity.Name);\n if (regs.length === 0) return null;\n let lowest = regs[0];\n for (const r of regs) {\n if (r.Priority < lowest.Priority) lowest = r; // strict < keeps the FIRST on ties\n }\n return lowest.SubClass as Type<BaseFormComponent>;\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 = FORM_VARIANT_EXPLICIT_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 and\n // pickActive() keep the ones IsSelectableFormOverride allows. Replaces\n // a per-LoadForm RunView with an in-memory predicate — sub-ms.\n // An identity or permission entity takes only the user's own forms.\n const applicable = InteractiveFormsEngine.Instance.Overrides.filter(o => {\n if (!o.EntityID || !UUIDsEqual(o.EntityID, entity.ID)) return false;\n if (!FormScopeAllowedOnEntity(entity.Name, o.Scope)) 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 is selectable (`IsSelectableFormOverride`:\n * Active, or the user's own form set aside by a later apply) → use it.\n * - Else → the stored choice is dropped, and the first Active row in\n * tier+priority order is used (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 // The user's own set-aside form is a legitimate choice, not history: applying a\n // second form sets the first one aside rather than merging into it, so the picker\n // offers both and the user's pick outranks which row happens to hold Active. A\n // shared form set aside was retracted, and a Pending row is a draft; neither renders.\n const sel = variants.find(v => IsSelectableFormOverride(v) && 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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseFormToolbarAction, FormToolbarActionLifecycleContext } from '../base-form-toolbar-action';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in pluggable toolbar action for the Bidirectional Record Links drawer (`Key: 'links'`).
|
|
4
|
+
*
|
|
5
|
+
* Demonstrates the {@link BaseFormToolbarAction} lifecycle contract:
|
|
6
|
+
* - Registered globally (`EntityScope: '*'`) and pinnable (`Pinnable: true`).
|
|
7
|
+
* - During {@link OnPrewarm}, always computes the zero-cost in-memory outgoing links summary
|
|
8
|
+
* from the record's FK / polymorphic-FK fields, and **only** executes the network
|
|
9
|
+
* `GetRecordDependencies` pre-warm when the user has pinned the `Links` button (`ctx.IsPinned`)
|
|
10
|
+
* or when the button is visible on the main toolbar (`ctx.IsVisibleOnBar`).
|
|
11
|
+
* - If the user pins the `Links` button mid-session, {@link OnPinStateChanged} immediately
|
|
12
|
+
* triggers {@link OnPrewarm} so the badge count populates right away.
|
|
13
|
+
*/
|
|
14
|
+
export declare class RecordLinksToolbarAction extends BaseFormToolbarAction {
|
|
15
|
+
IsApplicable(ctx: FormToolbarActionLifecycleContext): boolean;
|
|
16
|
+
OnPrewarm(ctx: FormToolbarActionLifecycleContext): Promise<void>;
|
|
17
|
+
OnPinStateChanged(ctx: FormToolbarActionLifecycleContext, isPinned: boolean): Promise<void>;
|
|
18
|
+
OnRecordRefreshed(ctx: FormToolbarActionLifecycleContext): Promise<void>;
|
|
19
|
+
OnExecute(ctx: FormToolbarActionLifecycleContext): void;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=record-links-toolbar-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-links-toolbar-action.d.ts","sourceRoot":"","sources":["../../../../src/lib/toolbar/actions/record-links-toolbar-action.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,iCAAiC,EAEpC,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,qBAWa,wBAAyB,SAAQ,qBAAqB;IAC/C,YAAY,CAAC,GAAG,EAAE,iCAAiC,GAAG,OAAO;IAIvD,SAAS,CAAC,GAAG,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC;IAsChE,iBAAiB,CACnC,GAAG,EAAE,iCAAiC,EACtC,QAAQ,EAAE,OAAO,GAClB,OAAO,CAAC,IAAI,CAAC;IAMM,iBAAiB,CAAC,GAAG,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9E,SAAS,CAAC,GAAG,EAAE,iCAAiC,GAAG,IAAI;CAM1E"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LogError } from '@memberjunction/core';
|
|
8
|
+
import { MjRecordLinksComponent } from '../../links/record-links.component';
|
|
9
|
+
import { BaseFormToolbarAction, RegisterFormToolbarAction } from '../base-form-toolbar-action';
|
|
10
|
+
/**
|
|
11
|
+
* Built-in pluggable toolbar action for the Bidirectional Record Links drawer (`Key: 'links'`).
|
|
12
|
+
*
|
|
13
|
+
* Demonstrates the {@link BaseFormToolbarAction} lifecycle contract:
|
|
14
|
+
* - Registered globally (`EntityScope: '*'`) and pinnable (`Pinnable: true`).
|
|
15
|
+
* - During {@link OnPrewarm}, always computes the zero-cost in-memory outgoing links summary
|
|
16
|
+
* from the record's FK / polymorphic-FK fields, and **only** executes the network
|
|
17
|
+
* `GetRecordDependencies` pre-warm when the user has pinned the `Links` button (`ctx.IsPinned`)
|
|
18
|
+
* or when the button is visible on the main toolbar (`ctx.IsVisibleOnBar`).
|
|
19
|
+
* - If the user pins the `Links` button mid-session, {@link OnPinStateChanged} immediately
|
|
20
|
+
* triggers {@link OnPrewarm} so the badge count populates right away.
|
|
21
|
+
*/
|
|
22
|
+
let RecordLinksToolbarAction = class RecordLinksToolbarAction extends BaseFormToolbarAction {
|
|
23
|
+
IsApplicable(ctx) {
|
|
24
|
+
return Boolean(ctx.Record?.IsSaved && ctx.EntityInfo);
|
|
25
|
+
}
|
|
26
|
+
async OnPrewarm(ctx) {
|
|
27
|
+
const record = ctx.Record;
|
|
28
|
+
if (!record?.IsSaved || !record.EntityInfo) {
|
|
29
|
+
ctx.SetBadge(undefined);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// 1. Always compute the zero-cost in-memory outgoing links summary
|
|
33
|
+
const outgoingSummary = MjRecordLinksComponent.BuildOutgoingLinksSummary(record, ctx.Provider);
|
|
34
|
+
ctx.SetLinksSummary({
|
|
35
|
+
TotalCount: outgoingSummary.TotalCount,
|
|
36
|
+
OutgoingCount: outgoingSummary.OutgoingCount,
|
|
37
|
+
IncomingCount: outgoingSummary.IncomingCount,
|
|
38
|
+
ByEntity: outgoingSummary.ByEntity
|
|
39
|
+
});
|
|
40
|
+
ctx.SetBadge(outgoingSummary.TotalCount > 0 ? outgoingSummary.TotalCount : undefined);
|
|
41
|
+
// 2. Only pre-warm incoming GetRecordDependencies over the network if the button is pinned or visible on bar
|
|
42
|
+
if (!ctx.IsPinned && !ctx.IsVisibleOnBar) {
|
|
43
|
+
ctx.RequestChangeDetection();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const summary = await MjRecordLinksComponent.PrewarmRecordLinkCount(record, ctx.Provider);
|
|
48
|
+
ctx.SetLinksSummary({
|
|
49
|
+
TotalCount: summary.TotalCount,
|
|
50
|
+
OutgoingCount: summary.OutgoingCount,
|
|
51
|
+
IncomingCount: summary.IncomingCount,
|
|
52
|
+
ByEntity: summary.ByEntity
|
|
53
|
+
});
|
|
54
|
+
ctx.SetBadge(summary.TotalCount > 0 ? summary.TotalCount : undefined);
|
|
55
|
+
ctx.RequestChangeDetection();
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
LogError(`RecordLinksToolbarAction.OnPrewarm failed for ${record.EntityInfo.Name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async OnPinStateChanged(ctx, isPinned) {
|
|
62
|
+
if (isPinned) {
|
|
63
|
+
await this.OnPrewarm(ctx);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async OnRecordRefreshed(ctx) {
|
|
67
|
+
await this.OnPrewarm(ctx);
|
|
68
|
+
}
|
|
69
|
+
OnExecute(ctx) {
|
|
70
|
+
const nextOpen = !ctx.IsRecordLinksDrawerOpen();
|
|
71
|
+
ctx.SetRecordLinksDrawerOpen(nextOpen);
|
|
72
|
+
ctx.SetActive(nextOpen);
|
|
73
|
+
ctx.RequestChangeDetection();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
RecordLinksToolbarAction = __decorate([
|
|
77
|
+
RegisterFormToolbarAction({
|
|
78
|
+
Key: 'links',
|
|
79
|
+
EntityScope: '*',
|
|
80
|
+
MenuLabel: 'Links',
|
|
81
|
+
Description: 'View linked records',
|
|
82
|
+
Icon: 'fa-solid fa-diagram-project',
|
|
83
|
+
Mode: 'read',
|
|
84
|
+
Placement: 'actions',
|
|
85
|
+
Order: 65,
|
|
86
|
+
Pinnable: true
|
|
87
|
+
})
|
|
88
|
+
], RecordLinksToolbarAction);
|
|
89
|
+
export { RecordLinksToolbarAction };
|
|
90
|
+
//# sourceMappingURL=record-links-toolbar-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-links-toolbar-action.js","sourceRoot":"","sources":["../../../../src/lib/toolbar/actions/record-links-toolbar-action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EACH,qBAAqB,EAErB,yBAAyB,EAC5B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;GAWG;AAYI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,qBAAqB;IAC/C,YAAY,CAAC,GAAsC;QAC/D,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;IAEe,KAAK,CAAC,SAAS,CAAC,GAAsC;QAClE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACzC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO;QACX,CAAC;QAED,mEAAmE;QACnE,MAAM,eAAe,GAAG,sBAAsB,CAAC,yBAAyB,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC/F,GAAG,CAAC,eAAe,CAAC;YAChB,UAAU,EA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AEjB,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC;IAEe,KAAK,CAAC,iBAAiB,CAAC,GAAsC;QAC1E,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEe,SAAS,CAAC,GAAsC;QAC5D,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAChD,GAAG,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;QACvC,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxB,GAAG,CAAC,sBAAsB,EAAE,CAAC;IACjC,CAAC;CACJ,CAAA;AA9DY,wBAAwB;IAXpC,yBAAyB,CAAC;QACvB,GAAG,EAAE,OAAO;QACZ,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,OAAO;QAClB,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,6BAA6B;QACnC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;KACjB,CAAC;GACW,wBAAwB,CA8DpC","sourcesContent":["import { LogError } from '@memberjunction/core';\nimport { MjRecordLinksComponent } from '../../links/record-links.component';\nimport {\n BaseFormToolbarAction,\n FormToolbarActionLifecycleContext,\n RegisterFormToolbarAction\n} from '../base-form-toolbar-action';\n\n/**\n * Built-in pluggable toolbar action for the Bidirectional Record Links drawer (`Key: 'links'`).\n *\n * Demonstrates the {@link BaseFormToolbarAction} lifecycle contract:\n * - Registered globally (`EntityScope: '*'`) and pinnable (`Pinnable: true`).\n * - During {@link OnPrewarm}, always computes the zero-cost in-memory outgoing links summary\n * from the record's FK / polymorphic-FK fields, and **only** executes the network\n * `GetRecordDependencies` pre-warm when the user has pinned the `Links` button (`ctx.IsPinned`)\n * or when the button is visible on the main toolbar (`ctx.IsVisibleOnBar`).\n * - If the user pins the `Links` button mid-session, {@link OnPinStateChanged} immediately\n * triggers {@link OnPrewarm} so the badge count populates right away.\n */\n@RegisterFormToolbarAction({\n Key: 'links',\n EntityScope: '*',\n MenuLabel: 'Links',\n Description: 'View linked records',\n Icon: 'fa-solid fa-diagram-project',\n Mode: 'read',\n Placement: 'actions',\n Order: 65,\n Pinnable: true\n})\nexport class RecordLinksToolbarAction extends BaseFormToolbarAction {\n public override IsApplicable(ctx: FormToolbarActionLifecycleContext): boolean {\n return Boolean(ctx.Record?.IsSaved && ctx.EntityInfo);\n }\n\n public override async OnPrewarm(ctx: FormToolbarActionLifecycleContext): Promise<void> {\n const record = ctx.Record;\n if (!record?.IsSaved || !record.EntityInfo) {\n ctx.SetBadge(undefined);\n return;\n }\n\n // 1. Always compute the zero-cost in-memory outgoing links summary\n const outgoingSummary = MjRecordLinksComponent.BuildOutgoingLinksSummary(record, ctx.Provider);\n ctx.SetLinksSummary({\n TotalCount: outgoingSummary.TotalCount,\n OutgoingCount: outgoingSummary.OutgoingCount,\n IncomingCount: outgoingSummary.IncomingCount,\n ByEntity: outgoingSummary.ByEntity\n });\n ctx.SetBadge(outgoingSummary.TotalCount > 0 ? outgoingSummary.TotalCount : undefined);\n\n // 2. Only pre-warm incoming GetRecordDependencies over the network if the button is pinned or visible on bar\n if (!ctx.IsPinned && !ctx.IsVisibleOnBar) {\n ctx.RequestChangeDetection();\n return;\n }\n\n try {\n const summary = await MjRecordLinksComponent.PrewarmRecordLinkCount(record, ctx.Provider);\n ctx.SetLinksSummary({\n TotalCount: summary.TotalCount,\n OutgoingCount: summary.OutgoingCount,\n IncomingCount: summary.IncomingCount,\n ByEntity: summary.ByEntity\n });\n ctx.SetBadge(summary.TotalCount > 0 ? summary.TotalCount : undefined);\n ctx.RequestChangeDetection();\n } catch (e) {\n LogError(`RecordLinksToolbarAction.OnPrewarm failed for ${record.EntityInfo.Name}: ${e instanceof Error ? e.message : String(e)}`);\n }\n }\n\n public override async OnPinStateChanged(\n ctx: FormToolbarActionLifecycleContext,\n isPinned: boolean\n ): Promise<void> {\n if (isPinned) {\n await this.OnPrewarm(ctx);\n }\n }\n\n public override async OnRecordRefreshed(ctx: FormToolbarActionLifecycleContext): Promise<void> {\n await this.OnPrewarm(ctx);\n }\n\n public override OnExecute(ctx: FormToolbarActionLifecycleContext): void {\n const nextOpen = !ctx.IsRecordLinksDrawerOpen();\n ctx.SetRecordLinksDrawerOpen(nextOpen);\n ctx.SetActive(nextOpen);\n ctx.RequestChangeDetection();\n }\n}\n"]}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { BaseEntity, EntityInfo, IMetadataProvider } from '@memberjunction/core';
|
|
2
|
+
import type { BaseFormComponent } from '../base-form-component';
|
|
3
|
+
import type { FormAgentLinksSummary } from '../chrome/form-composition-snapshot';
|
|
4
|
+
import { FormToolbarItemConfig, ToolbarItemMode, ToolbarItemPlacement, ToolbarItemVariant } from '../types/form-toolbar-item';
|
|
5
|
+
/**
|
|
6
|
+
* Structured metadata attached to a {@link BaseFormToolbarAction} registration via
|
|
7
|
+
* `@RegisterClassEx(BaseFormToolbarAction, { key, priority?, metadata })` or
|
|
8
|
+
* {@link RegisterFormToolbarAction}.
|
|
9
|
+
*/
|
|
10
|
+
export interface FormToolbarActionRegistrationMetadata extends Record<string, unknown> {
|
|
11
|
+
/**
|
|
12
|
+
* Unique toolbar item key (e.g. `'links'`, `'send-invoice'`, `'approve-contract'`).
|
|
13
|
+
* When multiple registrations share the same `Key`, the registration with the highest
|
|
14
|
+
* ClassFactory `Priority` wins (last-wins override).
|
|
15
|
+
*/
|
|
16
|
+
Key: string;
|
|
17
|
+
/**
|
|
18
|
+
* Scope controlling which entity forms mount this toolbar action:
|
|
19
|
+
* - `'*'` (default): global — mounts on every entity form
|
|
20
|
+
* - Exact entity name (case-insensitive): e.g. `'MJ: AI Agents'`
|
|
21
|
+
* - Glob/wildcard pattern on entity name: e.g. `'MJ_BizApps_Orders:*'`, `'*Order*'`, `'MJ: AI *'`
|
|
22
|
+
* - Schema prefix: e.g. `'schema:mj_bizapps_accounting'` (matches `EntityInfo.SchemaName`)
|
|
23
|
+
* - Array of any of the above: e.g. `['Invoices', 'Credit Memos', 'MJ_BizApps_Orders:*']`
|
|
24
|
+
*/
|
|
25
|
+
EntityScope?: string | readonly string[];
|
|
26
|
+
/** Optional inline button label text. */
|
|
27
|
+
Text?: string;
|
|
28
|
+
/** Label displayed in the toolbar's More (`...`) menu. Defaults to `Text` or `Description`. */
|
|
29
|
+
MenuLabel?: string;
|
|
30
|
+
/** Tooltip text displayed on hover. */
|
|
31
|
+
Description?: string;
|
|
32
|
+
/** Font Awesome icon class (e.g. `'fa-solid fa-diagram-project'`). */
|
|
33
|
+
Icon?: string;
|
|
34
|
+
/** Visual button variant. Default: `'default'`. */
|
|
35
|
+
Variant?: ToolbarItemVariant;
|
|
36
|
+
/** Form mode(s) in which the button appears (`'read'` | `'edit'` | `'both'`). Default: `'read'`. */
|
|
37
|
+
Mode?: ToolbarItemMode;
|
|
38
|
+
/** Toolbar placement group (`'actions'` | `'right'` | `'overflow'`). Default: `'actions'`. */
|
|
39
|
+
Placement?: ToolbarItemPlacement;
|
|
40
|
+
/** Numeric sort order within its placement group. */
|
|
41
|
+
Order?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the action participates in per-user pinning (`mj.form.toolbar.pinnedActions`).
|
|
44
|
+
* When `true`, the button renders on the main bar only when pinned by the user (or in
|
|
45
|
+
* `DefaultPinnedActions`), and otherwise lives in the More (`...`) menu.
|
|
46
|
+
*/
|
|
47
|
+
Pinnable?: boolean;
|
|
48
|
+
/** Optional custom CSS class name. */
|
|
49
|
+
CssClass?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Convenience decorator for registering a {@link BaseFormToolbarAction} subclass with
|
|
53
|
+
* `MJGlobal.Instance.ClassFactory`.
|
|
54
|
+
*
|
|
55
|
+
* When subclassing an existing toolbar action plugin (such as `RecordLinksToolbarAction`),
|
|
56
|
+
* any metadata properties omitted here (including `Key`, `Icon`, `MenuLabel`, `Order`, `Pinnable`, etc.)
|
|
57
|
+
* are automatically inherited from the superclass registration at resolution time.
|
|
58
|
+
*/
|
|
59
|
+
export declare function RegisterFormToolbarAction(metadata?: Partial<FormToolbarActionRegistrationMetadata>, priority?: number): (constructor: Function) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Runtime context passed into every {@link BaseFormToolbarAction} lifecycle hook.
|
|
62
|
+
* Gives the action read access to the record, entity, provider, and toolbar visibility/pin state,
|
|
63
|
+
* plus callbacks to update its own badge, loading state, disabled state, active state, or host drawer.
|
|
64
|
+
*/
|
|
65
|
+
export interface FormToolbarActionLifecycleContext {
|
|
66
|
+
/** The active entity record on the form. */
|
|
67
|
+
readonly Record: BaseEntity;
|
|
68
|
+
/** Metadata for the active entity. */
|
|
69
|
+
readonly EntityInfo: EntityInfo;
|
|
70
|
+
/** Metadata provider scoped to the form. */
|
|
71
|
+
readonly Provider: IMetadataProvider;
|
|
72
|
+
/** Whether the form is currently in edit mode. */
|
|
73
|
+
readonly EditMode: boolean;
|
|
74
|
+
/** Whether the record currently has unsaved changes. */
|
|
75
|
+
readonly IsDirty: boolean;
|
|
76
|
+
/** Whether this toolbar action is currently pinned to the user's main toolbar. */
|
|
77
|
+
readonly IsPinned: boolean;
|
|
78
|
+
/** Whether this toolbar action is currently visible (either inline or pinned on the bar). */
|
|
79
|
+
readonly IsVisibleOnBar: boolean;
|
|
80
|
+
/** Optional reference to the host `BaseFormComponent`. */
|
|
81
|
+
readonly FormComponent: BaseFormComponent | null;
|
|
82
|
+
/** Update the badge count or text displayed on this toolbar button. */
|
|
83
|
+
SetBadge(badge: string | number | null | undefined): void;
|
|
84
|
+
/** Update the loading spinner state on this toolbar button. */
|
|
85
|
+
SetLoading(loading: boolean): void;
|
|
86
|
+
/** Update the disabled state (and optional disabled-reason tooltip) on this toolbar button. */
|
|
87
|
+
SetDisabled(disabled: boolean, reason?: string): void;
|
|
88
|
+
/** Update whether this toolbar button renders in its active/open state (e.g. while its drawer is open). */
|
|
89
|
+
SetActive(active: boolean): void;
|
|
90
|
+
/** Toggle or set the built-in Record Links drawer open state on the form container. */
|
|
91
|
+
SetRecordLinksDrawerOpen(open: boolean): void;
|
|
92
|
+
/** Return whether the built-in Record Links drawer is currently open on the form container. */
|
|
93
|
+
IsRecordLinksDrawerOpen(): boolean;
|
|
94
|
+
/** Publish an updated record links summary to the form container and AI agent context. */
|
|
95
|
+
SetLinksSummary(summary: FormAgentLinksSummary): void;
|
|
96
|
+
/** Request change detection on the host form container and toolbar. */
|
|
97
|
+
RequestChangeDetection(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Abstract base class for pluggable, lifecycle-aware form toolbar buttons.
|
|
101
|
+
*
|
|
102
|
+
* Subclasses register via `@RegisterFormToolbarAction({ Key: '...', EntityScope: '...', ... })`
|
|
103
|
+
* (or `@RegisterClassEx(BaseFormToolbarAction, { key: '...', metadata: { ... } })`).
|
|
104
|
+
*
|
|
105
|
+
* When `<mj-record-form-container>` initializes for an entity, it discovers all matching
|
|
106
|
+
* `BaseFormToolbarAction` registrations for that entity (supporting exact entity names, wildcard
|
|
107
|
+
* patterns like `'MJ_BizApps_Orders:*'`, schema prefixes like `'schema:mj_bizapps_accounting'`,
|
|
108
|
+
* or global `'*'`), instantiates each winning action, and invokes its lifecycle hooks:
|
|
109
|
+
* - {@link IsApplicable}
|
|
110
|
+
* - {@link OnInit}
|
|
111
|
+
* - {@link OnPrewarm} (where the action can inspect `ctx.IsPinned` / `ctx.IsVisibleOnBar` to decide whether to run network pre-warming)
|
|
112
|
+
* - {@link OnPinStateChanged}
|
|
113
|
+
* - {@link OnRecordSaved}
|
|
114
|
+
* - {@link OnRecordRefreshed}
|
|
115
|
+
* - {@link OnExecute}
|
|
116
|
+
* - {@link OnDestroy}
|
|
117
|
+
*/
|
|
118
|
+
export declare abstract class BaseFormToolbarAction {
|
|
119
|
+
/** Registration metadata populated by the host container when instantiated. */
|
|
120
|
+
Metadata: FormToolbarActionRegistrationMetadata;
|
|
121
|
+
/** Current badge value managed by this action instance. */
|
|
122
|
+
Badge: string | number | undefined;
|
|
123
|
+
/** Current loading spinner state managed by this action instance. */
|
|
124
|
+
IsLoading: boolean;
|
|
125
|
+
/** Current disabled state managed by this action instance. */
|
|
126
|
+
Disabled: boolean;
|
|
127
|
+
/** Optional tooltip explaining why the button is disabled. */
|
|
128
|
+
DisabledReason: string | undefined;
|
|
129
|
+
/** Whether the action's associated drawer/panel is currently active/open. */
|
|
130
|
+
IsActive: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Optional runtime guard beyond static `EntityScope` matching.
|
|
133
|
+
* Return `false` to hide/exclude this action for the current record or mode.
|
|
134
|
+
*/
|
|
135
|
+
IsApplicable(ctx: FormToolbarActionLifecycleContext): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Called when the form container binds to a record.
|
|
138
|
+
*/
|
|
139
|
+
OnInit(_ctx: FormToolbarActionLifecycleContext): void | Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Called during form badge-count pre-warming (`RecordReady`).
|
|
142
|
+
* Subclasses can inspect `ctx.IsPinned` or `ctx.IsVisibleOnBar` to decide whether to run
|
|
143
|
+
* network pre-fetch queries or defer them until {@link OnExecute} / {@link OnPinStateChanged}.
|
|
144
|
+
*/
|
|
145
|
+
OnPrewarm(_ctx: FormToolbarActionLifecycleContext): void | Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Called when the user pins or unpins this action in the toolbar's More (`...`) menu.
|
|
148
|
+
*/
|
|
149
|
+
OnPinStateChanged(_ctx: FormToolbarActionLifecycleContext, _isPinned: boolean): void | Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Called after the active record is saved or live-refreshed from the server.
|
|
152
|
+
*/
|
|
153
|
+
OnRecordRefreshed(_ctx: FormToolbarActionLifecycleContext): void | Promise<void>;
|
|
154
|
+
/**
|
|
155
|
+
* Called when the user clicks the toolbar button (either inline on the bar or inside the More menu).
|
|
156
|
+
*/
|
|
157
|
+
abstract OnExecute(ctx: FormToolbarActionLifecycleContext, event?: MouseEvent): void | Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Called when the host form container is destroyed or switches to a different entity.
|
|
160
|
+
*/
|
|
161
|
+
OnDestroy(): void;
|
|
162
|
+
/**
|
|
163
|
+
* Builds the `FormToolbarItemConfig` projection consumed by `<mj-form-toolbar>`.
|
|
164
|
+
*/
|
|
165
|
+
ToToolbarItemConfig(onTrigger: (event?: MouseEvent) => void | Promise<void>): FormToolbarItemConfig;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Evaluates whether a `FormToolbarActionRegistrationMetadata.EntityScope` matches the given `EntityInfo`.
|
|
169
|
+
*
|
|
170
|
+
* Supported scope patterns:
|
|
171
|
+
* - `undefined` or `'*'`: matches all entities
|
|
172
|
+
* - `'schema:<schemaName>'`: case-insensitive match against `entityInfo.SchemaName`
|
|
173
|
+
* - Glob pattern containing `'*'`: case-insensitive wildcard match against `entityInfo.Name`
|
|
174
|
+
* - Exact string: case-insensitive match against `entityInfo.Name`
|
|
175
|
+
* - Array of patterns: matches if any element in the array matches
|
|
176
|
+
*/
|
|
177
|
+
export declare function MatchesToolbarActionEntityScope(scope: string | readonly string[] | undefined, entityInfo: EntityInfo | null | undefined): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Discovers all `BaseFormToolbarAction` registrations in `MJGlobal.Instance.ClassFactory`
|
|
180
|
+
* (including subclasses registered via `@RegisterFormToolbarAction`, `@RegisterClass`, or
|
|
181
|
+
* `@RegisterClassEx` against either `BaseFormToolbarAction` or a concrete action superclass),
|
|
182
|
+
* merges inherited metadata up the class prototype chain, filters by `EntityScope` against
|
|
183
|
+
* `entityInfo`, and resolves a single winning action per `Key` where:
|
|
184
|
+
* 1. A subclass always overrides its superclass (`Sub.prototype instanceof Super`),
|
|
185
|
+
* 2. An entity-scoped registration overrides a global (`'*'`) registration of equal priority,
|
|
186
|
+
* 3. Higher ClassFactory `Priority` (and later registration order on ties) wins.
|
|
187
|
+
*/
|
|
188
|
+
export declare function ResolveFormToolbarActionsForEntity(entityInfo: EntityInfo | null | undefined): BaseFormToolbarAction[];
|
|
189
|
+
//# sourceMappingURL=base-form-toolbar-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-form-toolbar-action.d.ts","sourceRoot":"","sources":["../../../src/lib/toolbar/base-form-toolbar-action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EACH,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,WAAW,qCAAsC,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAClF;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAEzC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,+FAA+F;IAC/F,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,mDAAmD;IACnD,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAE7B,oGAAoG;IACpG,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAEjC,qDAAqD;IACrD,KAAK,CAAC,EAAE,M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