@memberjunction/ng-base-forms 6.2.0-edge.2 → 6.2.0-edge.3
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/dist/lib/apply/form-placement-dialog.component.d.ts +266 -0
- package/dist/lib/apply/form-placement-dialog.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-dialog.component.js +1522 -0
- package/dist/lib/apply/form-placement-dialog.component.js.map +1 -0
- package/dist/lib/apply/form-placement-order.d.ts +37 -0
- package/dist/lib/apply/form-placement-order.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-order.js +111 -0
- package/dist/lib/apply/form-placement-order.js.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts +112 -0
- package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-preview.component.js +346 -0
- package/dist/lib/apply/form-placement-preview.component.js.map +1 -0
- package/dist/lib/apply/form-placement-text.d.ts +61 -0
- package/dist/lib/apply/form-placement-text.d.ts.map +1 -0
- package/dist/lib/apply/form-placement-text.js +279 -0
- package/dist/lib/apply/form-placement-text.js.map +1 -0
- package/dist/lib/apply/form-placement.d.ts +320 -0
- package/dist/lib/apply/form-placement.d.ts.map +1 -0
- package/dist/lib/apply/form-placement.js +432 -0
- package/dist/lib/apply/form-placement.js.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts +121 -0
- package/dist/lib/apply/form-slot-probe.service.d.ts.map +1 -0
- package/dist/lib/apply/form-slot-probe.service.js +264 -0
- package/dist/lib/apply/form-slot-probe.service.js.map +1 -0
- package/dist/lib/base-form-component-internals.d.ts +11 -0
- package/dist/lib/base-form-component-internals.d.ts.map +1 -0
- package/dist/lib/base-form-component-internals.js +33 -0
- package/dist/lib/base-form-component-internals.js.map +1 -0
- package/dist/lib/base-form-component.d.ts +132 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +228 -19
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-chrome.d.ts +78 -0
- package/dist/lib/chrome/form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/form-chrome.js +128 -2
- package/dist/lib/chrome/form-chrome.js.map +1 -1
- package/dist/lib/chrome/form-composition-registry.d.ts +34 -0
- package/dist/lib/chrome/form-composition-registry.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-registry.js +56 -0
- package/dist/lib/chrome/form-composition-registry.js.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts +151 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -0
- package/dist/lib/chrome/form-composition-snapshot.js +137 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts +15 -0
- package/dist/lib/chrome/resolve-form-chrome.d.ts.map +1 -1
- package/dist/lib/chrome/resolve-form-chrome.js +31 -2
- package/dist/lib/chrome/resolve-form-chrome.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +240 -5
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +976 -249
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +17 -0
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +41 -5
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/form-state.service.d.ts +5 -0
- package/dist/lib/form-state.service.d.ts.map +1 -1
- package/dist/lib/form-state.service.js +6 -1
- package/dist/lib/form-state.service.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +16 -1
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +27 -6
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts +24 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.d.ts.map +1 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js +99 -0
- package/dist/lib/interactive-form/form-panel-host-props.builder.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts +109 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.d.ts.map +1 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js +424 -0
- package/dist/lib/interactive-form/interactive-form-panel.component.js.map +1 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts +2 -0
- package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.js +4 -5
- package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts +69 -1
- package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
- package/dist/lib/panel/collapsible-panel.component.js +148 -12
- package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
- package/dist/lib/panel-manager/form-audience.d.ts +46 -0
- package/dist/lib/panel-manager/form-audience.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-audience.js +34 -0
- package/dist/lib/panel-manager/form-audience.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts +150 -0
- package/dist/lib/panel-manager/form-panel-admin.service.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js +433 -0
- package/dist/lib/panel-manager/form-panel-admin.service.js.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts +255 -0
- package/dist/lib/panel-manager/form-panel-inventory.d.ts.map +1 -0
- package/dist/lib/panel-manager/form-panel-inventory.js +293 -0
- package/dist/lib/panel-manager/form-panel-inventory.js.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts +232 -0
- package/dist/lib/panel-manager/panel-manager.component.d.ts.map +1 -0
- package/dist/lib/panel-manager/panel-manager.component.js +1112 -0
- package/dist/lib/panel-manager/panel-manager.component.js.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts +40 -0
- package/dist/lib/panel-slot/base-contribution-panel.d.ts.map +1 -0
- package/dist/lib/panel-slot/base-contribution-panel.js +55 -0
- package/dist/lib/panel-slot/base-contribution-panel.js.map +1 -0
- package/dist/lib/panel-slot/base-form-panel.d.ts +116 -8
- package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -1
- package/dist/lib/panel-slot/base-form-panel.js +76 -5
- package/dist/lib/panel-slot/base-form-panel.js.map +1 -1
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts +29 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.d.ts.map +1 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js +214 -0
- package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -0
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts +6 -3
- package/dist/lib/panel-slot/collect-form-panel-registrations.d.ts.map +1 -1
- package/dist/lib/panel-slot/collect-form-panel-registrations.js +8 -14
- package/dist/lib/panel-slot/collect-form-panel-registrations.js.map +1 -1
- package/dist/lib/panel-slot/form-contribution.d.ts +170 -7
- package/dist/lib/panel-slot/form-contribution.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contribution.js +242 -64
- package/dist/lib/panel-slot/form-contribution.js.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.d.ts +16 -5
- package/dist/lib/panel-slot/form-contributions.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-contributions.component.js +43 -7
- package/dist/lib/panel-slot/form-contributions.component.js.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts +66 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +190 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -0
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts +52 -16
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +190 -66
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +11 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-slot-coordinator.service.js +17 -0
- package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -1
- package/dist/lib/panel-slot/merge-panel-validation.d.ts +7 -0
- package/dist/lib/panel-slot/merge-panel-validation.d.ts.map +1 -0
- package/dist/lib/panel-slot/merge-panel-validation.js +16 -0
- package/dist/lib/panel-slot/merge-panel-validation.js.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts +15 -0
- package/dist/lib/panel-slot/mount-form-contribution.d.ts.map +1 -0
- package/dist/lib/panel-slot/mount-form-contribution.js +37 -0
- package/dist/lib/panel-slot/mount-form-contribution.js.map +1 -0
- package/dist/lib/panel-slot/panel-hides.d.ts +35 -0
- package/dist/lib/panel-slot/panel-hides.d.ts.map +1 -0
- package/dist/lib/panel-slot/panel-hides.js +111 -0
- package/dist/lib/panel-slot/panel-hides.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts +16 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js +112 -0
- package/dist/lib/panel-slot/placement-preview-panel.component.js.map +1 -0
- package/dist/lib/panel-slot/placement-preview.d.ts +57 -0
- package/dist/lib/panel-slot/placement-preview.d.ts.map +1 -0
- package/dist/lib/panel-slot/placement-preview.js +86 -0
- package/dist/lib/panel-slot/placement-preview.js.map +1 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts +2 -0
- package/dist/lib/panel-slot/related-entity-grid-panel.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js +10 -3
- package/dist/lib/panel-slot/related-entity-grid-panel.component.js.map +1 -1
- package/dist/lib/panel-slot/slot-order.d.ts +19 -0
- package/dist/lib/panel-slot/slot-order.d.ts.map +1 -0
- package/dist/lib/panel-slot/slot-order.js +53 -0
- package/dist/lib/panel-slot/slot-order.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +4 -2
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +18 -8
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/resolver/form-variants.d.ts +28 -0
- package/dist/lib/resolver/form-variants.d.ts.map +1 -0
- package/dist/lib/resolver/form-variants.js +40 -0
- package/dist/lib/resolver/form-variants.js.map +1 -0
- package/dist/lib/section-counts/form-section-counts.d.ts +99 -0
- package/dist/lib/section-counts/form-section-counts.d.ts.map +1 -0
- package/dist/lib/section-counts/form-section-counts.js +223 -0
- package/dist/lib/section-counts/form-section-counts.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +7 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +194 -128
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-types.d.ts +8 -0
- package/dist/lib/types/form-types.d.ts.map +1 -1
- package/dist/lib/types/form-types.js.map +1 -1
- package/dist/module.d.ts +29 -23
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +43 -5
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +20 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +21 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { type IMetadataProvider } from '@memberjunction/core';
|
|
3
|
+
import type { FormPanelSlot } from '../panel-slot/base-form-panel';
|
|
4
|
+
import { type FormChromeGroup, type FormChromePanelSnapshot } from '../chrome/form-chrome';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
/** What a rendered form turned out to contain. */
|
|
7
|
+
export interface ProbedFormShape {
|
|
8
|
+
Slots: FormPanelSlot[];
|
|
9
|
+
/**
|
|
10
|
+
* Field sections the form drew, in document order, each with the inputs it draws.
|
|
11
|
+
* Replaceable a section or a single field at a time.
|
|
12
|
+
*/
|
|
13
|
+
Sections: Array<{
|
|
14
|
+
Key: string;
|
|
15
|
+
Title: string;
|
|
16
|
+
Fields: Array<{
|
|
17
|
+
Name: string;
|
|
18
|
+
Label: string;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
/** Every panel the form drew, including the related grids. Feeds the rail. */
|
|
22
|
+
Panels: FormChromePanelSnapshot[];
|
|
23
|
+
/** The rail the form will show, resolved the way the form itself resolves it. */
|
|
24
|
+
Groups: FormChromeGroup[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether the form shows a side rail. In a rail layout the chrome bundles every field
|
|
27
|
+
* section into one "Details" tab, so a user reading the section list sees names that
|
|
28
|
+
* are a level below anything the form shows them.
|
|
29
|
+
*/
|
|
30
|
+
Layout: 'accordion' | 'left-nav';
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Reads what an entity's form really contains, without opening the record.
|
|
34
|
+
*
|
|
35
|
+
* Both answers are properties of the form's Angular template rather than of any metadata.
|
|
36
|
+
* Slots: CodeGen emits a fixed three, the container adds `after-everything`, and a
|
|
37
|
+
* hand-written custom form can emit anything. Sections: a generated template is frozen at
|
|
38
|
+
* the last CodeGen run, so the sections it draws can differ from what the field metadata
|
|
39
|
+
* now says. The only authority for either is the rendered form.
|
|
40
|
+
*
|
|
41
|
+
* So this renders one — offscreen, against a new unsaved record, once per entity per
|
|
42
|
+
* session. That probe is cheap by construction: a related-entity grid renders only
|
|
43
|
+
* `@if (Record.IsSaved)`, so an unsaved record fires none of their queries, and the slot
|
|
44
|
+
* elements carry their position as a static HTML attribute, so reading them needs no
|
|
45
|
+
* injector access.
|
|
46
|
+
*
|
|
47
|
+
* Every failure returns an empty list rather than throwing. The caller treats empty as
|
|
48
|
+
* "unknown" and falls back, because a dialog that cannot answer this question should still
|
|
49
|
+
* open.
|
|
50
|
+
*/
|
|
51
|
+
export declare class FormSlotProbeService {
|
|
52
|
+
/** Entity name (lowercased) → what its form contains. */
|
|
53
|
+
private readonly cache;
|
|
54
|
+
/** Probes in flight, so two dialogs on one entity render one form between them. */
|
|
55
|
+
private readonly inflight;
|
|
56
|
+
/** A form that never signals readiness must not hold the dialog open. */
|
|
57
|
+
private static readonly TIMEOUT_MS;
|
|
58
|
+
/**
|
|
59
|
+
* What `entityName`'s form contains, with empty lists when it could not be read.
|
|
60
|
+
*
|
|
61
|
+
* @param host a `ViewContainerRef` inside `BaseFormsModule`. The form host is declared
|
|
62
|
+
* in that module, so it is created through a view in its scope rather than through
|
|
63
|
+
* the environment injector.
|
|
64
|
+
* @param provider the provider the form is drawn with; the global provider when omitted.
|
|
65
|
+
*/
|
|
66
|
+
Probe(host: ViewContainerRef, entityName: string, provider?: IMetadataProvider): Promise<ProbedFormShape>;
|
|
67
|
+
/** Section keys of the contributions already registered on this entity. */
|
|
68
|
+
private contributionKeys;
|
|
69
|
+
/**
|
|
70
|
+
* Drops the memo for one entity, or all of them. For a form that changed underneath: the
|
|
71
|
+
* Manage drawer and the apply flow call it after each write to the entity's panels.
|
|
72
|
+
*/
|
|
73
|
+
Forget(entityName?: string): void;
|
|
74
|
+
private render;
|
|
75
|
+
/**
|
|
76
|
+
* Out of the layout and out of the accessibility tree, but still rendered — the slot
|
|
77
|
+
* hosts have to reach `ngOnInit` for their elements to exist.
|
|
78
|
+
*/
|
|
79
|
+
private hide;
|
|
80
|
+
/** Resolves when the form has loaded, errored, or taken too long. */
|
|
81
|
+
private settled;
|
|
82
|
+
/**
|
|
83
|
+
* The slot positions present in the rendered form.
|
|
84
|
+
*
|
|
85
|
+
* Read from the DOM rather than from `FormSlotCoordinator`: the coordinator is provided
|
|
86
|
+
* per container and would have to be reached through the form's own injector, while the
|
|
87
|
+
* slot host publishes its position as `data-form-slot`.
|
|
88
|
+
*/
|
|
89
|
+
private readSlots;
|
|
90
|
+
/**
|
|
91
|
+
* Every panel the form drew, related grids included, in document order.
|
|
92
|
+
*
|
|
93
|
+
* The title comes from the first span inside the header, not from the header's own
|
|
94
|
+
* text: the header also carries the unsaved-changes and invalid-field indicators, so
|
|
95
|
+
* reading the whole node turns "Organization Identity" into "Organization Identity1".
|
|
96
|
+
*/
|
|
97
|
+
private readPanels;
|
|
98
|
+
/**
|
|
99
|
+
* The inputs each section draws, keyed by section key.
|
|
100
|
+
*
|
|
101
|
+
* A field belongs to the nearest panel above it, which is what `closest` answers —
|
|
102
|
+
* a nested panel would otherwise donate its fields to its parent as well. Read from
|
|
103
|
+
* `data-field-name` rather than from a component reference, so this stays a DOM sweep
|
|
104
|
+
* like the rest of the probe; a field a contribution already claims still carries the
|
|
105
|
+
* attribute, because the element exists even when it draws nothing.
|
|
106
|
+
*/
|
|
107
|
+
private readFields;
|
|
108
|
+
/**
|
|
109
|
+
* The rail the saved form will show.
|
|
110
|
+
*
|
|
111
|
+
* Resolved through the form's own chrome resolver rather than read off the probe's
|
|
112
|
+
* DOM. The probe renders a NEW record, and a related grid on an unsaved record has
|
|
113
|
+
* nothing to draw, so it leaves the rail — which drops the group count below the
|
|
114
|
+
* auto-left-nav threshold and makes a rail form report itself as an accordion. The
|
|
115
|
+
* panels are what the probe can see; the rail they form is computed.
|
|
116
|
+
*/
|
|
117
|
+
private resolveRail;
|
|
118
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormSlotProbeService, never>;
|
|
119
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FormSlotProbeService>;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=form-slot-probe.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-slot-probe.service.d.ts","sourceRoot":"","sources":["../../../src/lib/apply/form-slot-probe.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,gBAAgB,EAAE,MAAM,eAAe,CA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I;IAcZ,qEAAqE;IACrE,OAAO,CAAC,OAAO;IAmBf;;;;;;OAMG;IACH,OAAO,CAAC,SAAS;IASjB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;IAkBlB;;;;;;;;OAQG;IACH,OAAO,CAAC,UAAU;IAgBlB;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;yCArNV,oBAAoB;6CAApB,oBAAoB;CA6OhC"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { LogError, Metadata, ResolveFormLayout } from '@memberjunction/core';
|
|
3
|
+
import { MjEntityFormHostComponent } from '../host/entity-form-host.component';
|
|
4
|
+
import { ResolveFormChrome } from '../chrome/resolve-form-chrome';
|
|
5
|
+
import { FieldGroupsInDetails } from '../chrome/form-chrome';
|
|
6
|
+
import { CollectFormContributionRegistrations } from '../panel-slot/collect-form-contribution-registrations';
|
|
7
|
+
import { ResolveContributionKey } from '../panel-slot/form-contribution';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* Reads what an entity's form really contains, without opening the record.
|
|
11
|
+
*
|
|
12
|
+
* Both answers are properties of the form's Angular template rather than of any metadata.
|
|
13
|
+
* Slots: CodeGen emits a fixed three, the container adds `after-everything`, and a
|
|
14
|
+
* hand-written custom form can emit anything. Sections: a generated template is frozen at
|
|
15
|
+
* the last CodeGen run, so the sections it draws can differ from what the field metadata
|
|
16
|
+
* now says. The only authority for either is the rendered form.
|
|
17
|
+
*
|
|
18
|
+
* So this renders one — offscreen, against a new unsaved record, once per entity per
|
|
19
|
+
* session. That probe is cheap by construction: a related-entity grid renders only
|
|
20
|
+
* `@if (Record.IsSaved)`, so an unsaved record fires none of their queries, and the slot
|
|
21
|
+
* elements carry their position as a static HTML attribute, so reading them needs no
|
|
22
|
+
* injector access.
|
|
23
|
+
*
|
|
24
|
+
* Every failure returns an empty list rather than throwing. The caller treats empty as
|
|
25
|
+
* "unknown" and falls back, because a dialog that cannot answer this question should still
|
|
26
|
+
* open.
|
|
27
|
+
*/
|
|
28
|
+
export class FormSlotProbeService {
|
|
29
|
+
/** Entity name (lowercased) → what its form contains. */
|
|
30
|
+
cache = new Map();
|
|
31
|
+
/** Probes in flight, so two dialogs on one entity render one form between them. */
|
|
32
|
+
inflight = new Map();
|
|
33
|
+
/** A form that never signals readiness must not hold the dialog open. */
|
|
34
|
+
static TIMEOUT_MS = 5000;
|
|
35
|
+
/**
|
|
36
|
+
* What `entityName`'s form contains, with empty lists when it could not be read.
|
|
37
|
+
*
|
|
38
|
+
* @param host a `ViewContainerRef` inside `BaseFormsModule`. The form host is declared
|
|
39
|
+
* in that module, so it is created through a view in its scope rather than through
|
|
40
|
+
* the environment injector.
|
|
41
|
+
* @param provider the provider the form is drawn with; the global provider when omitted.
|
|
42
|
+
*/
|
|
43
|
+
async Probe(host, entityName, provider) {
|
|
44
|
+
const key = entityName.trim().toLowerCase();
|
|
45
|
+
if (!key)
|
|
46
|
+
return EMPTY_SHAPE;
|
|
47
|
+
const cached = this.cache.get(key);
|
|
48
|
+
if (cached)
|
|
49
|
+
return cached;
|
|
50
|
+
const running = this.inflight.get(key);
|
|
51
|
+
if (running)
|
|
52
|
+
return running;
|
|
53
|
+
const probe = this.render(host, entityName, provider ?? Metadata.Provider)
|
|
54
|
+
.catch((err) => {
|
|
55
|
+
LogError(`FormSlotProbeService: probe of '${entityName}' failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
56
|
+
return EMPTY_SHAPE;
|
|
57
|
+
})
|
|
58
|
+
.then((shape) => {
|
|
59
|
+
// A probe that a Forget overtook may have read the form before the change, so
|
|
60
|
+
// it is not cached. A form with no slots at all did not render; that is a failure
|
|
61
|
+
// to answer, not an answer, so it is not cached and a later attempt can succeed.
|
|
62
|
+
const current = this.inflight.get(key) === probe;
|
|
63
|
+
if (!current)
|
|
64
|
+
return shape;
|
|
65
|
+
this.inflight.delete(key);
|
|
66
|
+
if (shape.Slots.length > 0)
|
|
67
|
+
this.cache.set(key, shape);
|
|
68
|
+
return shape;
|
|
69
|
+
});
|
|
70
|
+
this.inflight.set(key, probe);
|
|
71
|
+
return probe;
|
|
72
|
+
}
|
|
73
|
+
/** Section keys of the contributions already registered on this entity. */
|
|
74
|
+
contributionKeys(entity, provider) {
|
|
75
|
+
return CollectFormContributionRegistrations(entity, provider)
|
|
76
|
+
.map((reg) => ResolveContributionKey(reg.Metadata))
|
|
77
|
+
.filter((key) => key.length > 0);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Drops the memo for one entity, or all of them. For a form that changed underneath: the
|
|
81
|
+
* Manage drawer and the apply flow call it after each write to the entity's panels.
|
|
82
|
+
*/
|
|
83
|
+
Forget(entityName) {
|
|
84
|
+
if (entityName) {
|
|
85
|
+
const key = entityName.trim().toLowerCase();
|
|
86
|
+
this.cache.delete(key);
|
|
87
|
+
this.inflight.delete(key);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.cache.clear();
|
|
91
|
+
this.inflight.clear();
|
|
92
|
+
}
|
|
93
|
+
async render(host, entityName, provider) {
|
|
94
|
+
const ref = host.createComponent(MjEntityFormHostComponent);
|
|
95
|
+
try {
|
|
96
|
+
this.hide(ref.location.nativeElement);
|
|
97
|
+
ref.instance.Provider = provider ?? null;
|
|
98
|
+
ref.instance.EntityName = entityName;
|
|
99
|
+
ref.changeDetectorRef.detectChanges();
|
|
100
|
+
await this.settled(ref.instance);
|
|
101
|
+
ref.changeDetectorRef.detectChanges();
|
|
102
|
+
const root = ref.location.nativeElement;
|
|
103
|
+
const panels = this.readPanels(root);
|
|
104
|
+
const rail = this.resolveRail(entityName, panels, provider);
|
|
105
|
+
const fieldsBySection = this.readFields(root);
|
|
106
|
+
return {
|
|
107
|
+
Slots: this.readSlots(root),
|
|
108
|
+
Sections: FieldGroupsInDetails(panels, rail.Groups).map((group) => ({
|
|
109
|
+
...group,
|
|
110
|
+
Fields: fieldsBySection.get(group.Key) ?? [],
|
|
111
|
+
})),
|
|
112
|
+
Panels: panels,
|
|
113
|
+
Groups: rail.Groups,
|
|
114
|
+
Layout: rail.Layout,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
ref.destroy();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Out of the layout and out of the accessibility tree, but still rendered — the slot
|
|
123
|
+
* hosts have to reach `ngOnInit` for their elements to exist.
|
|
124
|
+
*/
|
|
125
|
+
hide(element) {
|
|
126
|
+
element.setAttribute('aria-hidden', 'true');
|
|
127
|
+
Object.assign(element.style, {
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
left: '-99999px',
|
|
130
|
+
top: '0',
|
|
131
|
+
width: '1px',
|
|
132
|
+
height: '1px',
|
|
133
|
+
overflow: 'hidden',
|
|
134
|
+
visibility: 'hidden',
|
|
135
|
+
pointerEvents: 'none',
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Resolves when the form has loaded, errored, or taken too long. */
|
|
139
|
+
settled(instance) {
|
|
140
|
+
return new Promise((resolve) => {
|
|
141
|
+
let done = false;
|
|
142
|
+
const finish = () => {
|
|
143
|
+
if (done)
|
|
144
|
+
return;
|
|
145
|
+
done = true;
|
|
146
|
+
clearTimeout(timer);
|
|
147
|
+
loaded.unsubscribe();
|
|
148
|
+
failed.unsubscribe();
|
|
149
|
+
resolve();
|
|
150
|
+
};
|
|
151
|
+
const timer = setTimeout(finish, FormSlotProbeService.TIMEOUT_MS);
|
|
152
|
+
const loaded = instance.LoadComplete.subscribe(() => finish());
|
|
153
|
+
// A form the caller cannot open still emits its slots or none; either answer is
|
|
154
|
+
// better than waiting out the timeout.
|
|
155
|
+
const failed = instance.LoadError.subscribe(() => finish());
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The slot positions present in the rendered form.
|
|
160
|
+
*
|
|
161
|
+
* Read from the DOM rather than from `FormSlotCoordinator`: the coordinator is provided
|
|
162
|
+
* per container and would have to be reached through the form's own injector, while the
|
|
163
|
+
* slot host publishes its position as `data-form-slot`.
|
|
164
|
+
*/
|
|
165
|
+
readSlots(root) {
|
|
166
|
+
const found = new Set();
|
|
167
|
+
root.querySelectorAll('[data-form-slot]').forEach((node) => {
|
|
168
|
+
const slot = node.getAttribute('data-form-slot')?.trim();
|
|
169
|
+
if (slot)
|
|
170
|
+
found.add(slot);
|
|
171
|
+
});
|
|
172
|
+
return [...found];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Every panel the form drew, related grids included, in document order.
|
|
176
|
+
*
|
|
177
|
+
* The title comes from the first span inside the header, not from the header's own
|
|
178
|
+
* text: the header also carries the unsaved-changes and invalid-field indicators, so
|
|
179
|
+
* reading the whole node turns "Organization Identity" into "Organization Identity1".
|
|
180
|
+
*/
|
|
181
|
+
readPanels(root) {
|
|
182
|
+
const out = [];
|
|
183
|
+
const seen = new Set();
|
|
184
|
+
root.querySelectorAll('mj-collapsible-panel[data-section-key]').forEach((node) => {
|
|
185
|
+
const key = node.getAttribute('data-section-key')?.trim();
|
|
186
|
+
if (!key || seen.has(key))
|
|
187
|
+
return;
|
|
188
|
+
seen.add(key);
|
|
189
|
+
const title = node.querySelector('.mj-forms-panel-title span')?.textContent?.trim();
|
|
190
|
+
out.push({
|
|
191
|
+
SectionKey: key,
|
|
192
|
+
SectionName: title || key,
|
|
193
|
+
Variant: node.getAttribute('data-variant') || 'default',
|
|
194
|
+
Icon: node.getAttribute('data-icon') || undefined,
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The inputs each section draws, keyed by section key.
|
|
201
|
+
*
|
|
202
|
+
* A field belongs to the nearest panel above it, which is what `closest` answers —
|
|
203
|
+
* a nested panel would otherwise donate its fields to its parent as well. Read from
|
|
204
|
+
* `data-field-name` rather than from a component reference, so this stays a DOM sweep
|
|
205
|
+
* like the rest of the probe; a field a contribution already claims still carries the
|
|
206
|
+
* attribute, because the element exists even when it draws nothing.
|
|
207
|
+
*/
|
|
208
|
+
readFields(root) {
|
|
209
|
+
const out = new Map();
|
|
210
|
+
root.querySelectorAll('mj-form-field[data-field-name]').forEach((node) => {
|
|
211
|
+
const name = node.getAttribute('data-field-name')?.trim();
|
|
212
|
+
if (!name)
|
|
213
|
+
return;
|
|
214
|
+
const key = node.closest('mj-collapsible-panel[data-section-key]')
|
|
215
|
+
?.getAttribute('data-section-key')?.trim();
|
|
216
|
+
if (!key)
|
|
217
|
+
return;
|
|
218
|
+
const list = out.get(key) ?? [];
|
|
219
|
+
if (list.some((f) => f.Name === name))
|
|
220
|
+
return;
|
|
221
|
+
list.push({ Name: name, Label: node.getAttribute('data-field-label')?.trim() || name });
|
|
222
|
+
out.set(key, list);
|
|
223
|
+
});
|
|
224
|
+
return out;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The rail the saved form will show.
|
|
228
|
+
*
|
|
229
|
+
* Resolved through the form's own chrome resolver rather than read off the probe's
|
|
230
|
+
* DOM. The probe renders a NEW record, and a related grid on an unsaved record has
|
|
231
|
+
* nothing to draw, so it leaves the rail — which drops the group count below the
|
|
232
|
+
* auto-left-nav threshold and makes a rail form report itself as an accordion. The
|
|
233
|
+
* panels are what the probe can see; the rail they form is computed.
|
|
234
|
+
*/
|
|
235
|
+
resolveRail(entityName, panels, provider) {
|
|
236
|
+
const entity = provider?.EntityByName(entityName);
|
|
237
|
+
if (!entity) {
|
|
238
|
+
return { Groups: [], Layout: ResolveFormLayout(null, panels.length) };
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
const spec = ResolveFormChrome({
|
|
242
|
+
Entity: entity,
|
|
243
|
+
Panels: panels,
|
|
244
|
+
RelatedSchemaByEntityId: new Map(),
|
|
245
|
+
// Without these an installed contribution is indistinguishable from a
|
|
246
|
+
// field section, so it folds into Details and is counted as one of them.
|
|
247
|
+
ContributionSectionKeys: this.contributionKeys(entity, provider),
|
|
248
|
+
}).Spec;
|
|
249
|
+
return { Groups: spec.Groups, Layout: spec.Layout };
|
|
250
|
+
}
|
|
251
|
+
catch (err) {
|
|
252
|
+
LogError(`FormSlotProbeService: rail resolve for '${entityName}' failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
253
|
+
return { Groups: [], Layout: 'accordion' };
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
static ɵfac = function FormSlotProbeService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FormSlotProbeService)(); };
|
|
257
|
+
static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FormSlotProbeService, factory: FormSlotProbeService.ɵfac, providedIn: 'root' });
|
|
258
|
+
}
|
|
259
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormSlotProbeService, [{
|
|
260
|
+
type: Injectable,
|
|
261
|
+
args: [{ providedIn: 'root' }]
|
|
262
|
+
}], null, null); })();
|
|
263
|
+
const EMPTY_SHAPE = { Slots: [], Sections: [], Panels: [], Groups: [], Layout: 'accordion' };
|
|
264
|
+
//# sourceMappingURL=form-slot-probe.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-slot-probe.service.js","sourceRoot":"","sources":["../../../src/lib/apply/form-slot-probe.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,EAA2C,MAAM,sBAAsB,CAAC;AAEtH,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAsD,MAAM,uBAAuB,CAAC;AACjH,OAAO,EAAE,oCAAoC,EAAE,MAAM,uDAAuD,CAAC;AAC7G,OAAO,EAAE,sBAAsB,EAA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AAE;gBAClC,sEAAsE;gBACtE,yEAAyE;gBACzE,uBAAuB,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,QAAQ,CAAC;aACnE,CAAC,CAAC,IAAI,CAAC;YACR,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,QAAQ,CAAC,2CAA2C,UAAU,aAAa,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAC/H,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAC/C,CAAC;IACL,CAAC;8GA5OQ,oBAAoB;gEAApB,oBAAoB,WAApB,oBAAoB,mBADP,MAAM;;iFACnB,oBAAoB;cADhC,UAAU;eAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAgPlC,MAAM,WAAW,GAAoB,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Injectable, ViewContainerRef } from '@angular/core';\nimport { LogError, Metadata, ResolveFormLayout, type EntityInfo, type IMetadataProvider } from '@memberjunction/core';\nimport type { FormPanelSlot } from '../panel-slot/base-form-panel';\nimport { MjEntityFormHostComponent } from '../host/entity-form-host.component';\nimport { ResolveFormChrome } from '../chrome/resolve-form-chrome';\nimport { FieldGroupsInDetails, type FormChromeGroup, type FormChromePanelSnapshot } from '../chrome/form-chrome';\nimport { CollectFormContributionRegistrations } from '../panel-slot/collect-form-contribution-registrations';\nimport { ResolveContributionKey } from '../panel-slot/form-contribution';\n\n/** What a rendered form turned out to contain. */\nexport interface ProbedFormShape {\n Slots: FormPanelSlot[];\n /**\n * Field sections the form drew, in document order, each with the inputs it draws.\n * Replaceable a section or a single field at a time.\n */\n Sections: Array<{ Key: string; Title: string; Fields: Array<{ Name: string; Label: string }> }>;\n /** Every panel the form drew, including the related grids. Feeds the rail. */\n Panels: FormChromePanelSnapshot[];\n /** The rail the form will show, resolved the way the form itself resolves it. */\n Groups: FormChromeGroup[];\n /**\n * Whether the form shows a side rail. In a rail layout the chrome bundles every field\n * section into one \"Details\" tab, so a user reading the section list sees names that\n * are a level below anything the form shows them.\n */\n Layout: 'accordion' | 'left-nav';\n}\n\n/**\n * Reads what an entity's form really contains, without opening the record.\n *\n * Both answers are properties of the form's Angular template rather than of any metadata.\n * Slots: CodeGen emits a fixed three, the container adds `after-everything`, and a\n * hand-written custom form can emit anything. Sections: a generated template is frozen at\n * the last CodeGen run, so the sections it draws can differ from what the field metadata\n * now says. The only authority for either is the rendered form.\n *\n * So this renders one — offscreen, against a new unsaved record, once per entity per\n * session. That probe is cheap by construction: a related-entity grid renders only\n * `@if (Record.IsSaved)`, so an unsaved record fires none of their queries, and the slot\n * elements carry their position as a static HTML attribute, so reading them needs no\n * injector access.\n *\n * Every failure returns an empty list rather than throwing. The caller treats empty as\n * \"unknown\" and falls back, because a dialog that cannot answer this question should still\n * open.\n */\n@Injectable({ providedIn: 'root' })\nexport class FormSlotProbeService {\n /** Entity name (lowercased) → what its form contains. */\n private readonly cache = new Map<string, ProbedFormShape>();\n\n /** Probes in flight, so two dialogs on one entity render one form between them. */\n private readonly inflight = new Map<string, Promise<ProbedFormShape>>();\n\n /** A form that never signals readiness must not hold the dialog open. */\n private static readonly TIMEOUT_MS = 5000;\n\n /**\n * What `entityName`'s form contains, with empty lists when it could not be read.\n *\n * @param host a `ViewContainerRef` inside `BaseFormsModule`. The form host is declared\n * in that module, so it is created through a view in its scope rather than through\n * the environment injector.\n * @param provider the provider the form is drawn with; the global provider when omitted.\n */\n public async Probe(host: ViewContainerRef, entityName: string, provider?: IMetadataProvider): Promise<ProbedFormShape> {\n const key = entityName.trim().toLowerCase();\n if (!key) return EMPTY_SHAPE;\n\n const cached = this.cache.get(key);\n if (cached) return cached;\n\n const running = this.inflight.get(key);\n if (running) return running;\n\n const probe = this.render(host, entityName, provider ?? Metadata.Provider)\n .catch((err: unknown) => {\n LogError(`FormSlotProbeService: probe of '${entityName}' failed: ${err instanceof Error ? err.message : String(err)}`);\n return EMPTY_SHAPE;\n })\n .then((shape) => {\n // A probe that a Forget overtook may have read the form before the change, so\n // it is not cached. A form with no slots at all did not render; that is a failure\n // to answer, not an answer, so it is not cached and a later attempt can succeed.\n const current = this.inflight.get(key) === probe;\n if (!current) return shape;\n this.inflight.delete(key);\n if (shape.Slots.length > 0) this.cache.set(key, shape);\n return shape;\n });\n\n this.inflight.set(key, probe);\n return probe;\n }\n\n /** Section keys of the contributions already registered on this entity. */\n private contributionKeys(entity: EntityInfo, provider: IMetadataProvider | undefined): string[] {\n return CollectFormContributionRegistrations(entity, provider)\n .map((reg) => ResolveContributionKey(reg.Metadata))\n .filter((key) => key.length > 0);\n }\n\n /**\n * Drops the memo for one entity, or all of them. For a form that changed underneath: the\n * Manage drawer and the apply flow call it after each write to the entity's panels.\n */\n public Forget(entityName?: string): void {\n if (entityName) {\n const key = entityName.trim().toLowerCase();\n this.cache.delete(key);\n this.inflight.delete(key);\n return;\n }\n this.cache.clear();\n this.inflight.clear();\n }\n\n private async render(host: ViewContainerRef, entityName: string, provider: IMetadataProvider | undefined): Promise<ProbedFormShape> {\n const ref = host.createComponent(MjEntityFormHostComponent);\n try {\n this.hide(ref.location.nativeElement as HTMLElement);\n ref.instance.Provider = provider ?? null;\n ref.instance.EntityName = entityName;\n ref.changeDetectorRef.detectChanges();\n\n await this.settled(ref.instance);\n ref.changeDetectorRef.detectChanges();\n\n const root = ref.location.nativeElement as HTMLElement;\n const panels = this.readPanels(root);\n const rail = this.resolveRail(entityName, panels, provider);\n const fieldsBySection = this.readFields(root);\n return {\n Slots: this.readSlots(root),\n Sections: FieldGroupsInDetails(panels, rail.Groups).map((group) => ({\n ...group,\n Fields: fieldsBySection.get(group.Key) ?? [],\n })),\n Panels: panels,\n Groups: rail.Groups,\n Layout: rail.Layout,\n };\n } finally {\n ref.destroy();\n }\n }\n\n /**\n * Out of the layout and out of the accessibility tree, but still rendered — the slot\n * hosts have to reach `ngOnInit` for their elements to exist.\n */\n private hide(element: HTMLElement): void {\n element.setAttribute('aria-hidden', 'true');\n Object.assign(element.style, {\n position: 'absolute',\n left: '-99999px',\n top: '0',\n width: '1px',\n height: '1px',\n overflow: 'hidden',\n visibility: 'hidden',\n pointerEvents: 'none',\n });\n }\n\n /** Resolves when the form has loaded, errored, or taken too long. */\n private settled(instance: MjEntityFormHostComponent): Promise<void> {\n return new Promise<void>((resolve) => {\n let done = false;\n const finish = (): void => {\n if (done) return;\n done = true;\n clearTimeout(timer);\n loaded.unsubscribe();\n failed.unsubscribe();\n resolve();\n };\n const timer = setTimeout(finish, FormSlotProbeService.TIMEOUT_MS);\n const loaded = instance.LoadComplete.subscribe(() => finish());\n // A form the caller cannot open still emits its slots or none; either answer is\n // better than waiting out the timeout.\n const failed = instance.LoadError.subscribe(() => finish());\n });\n }\n\n /**\n * The slot positions present in the rendered form.\n *\n * Read from the DOM rather than from `FormSlotCoordinator`: the coordinator is provided\n * per container and would have to be reached through the form's own injector, while the\n * slot host publishes its position as `data-form-slot`.\n */\n private readSlots(root: HTMLElement): FormPanelSlot[] {\n const found = new Set<FormPanelSlot>();\n root.querySelectorAll('[data-form-slot]').forEach((node) => {\n const slot = node.getAttribute('data-form-slot')?.trim();\n if (slot) found.add(slot as FormPanelSlot);\n });\n return [...found];\n }\n\n /**\n * Every panel the form drew, related grids included, in document order.\n *\n * The title comes from the first span inside the header, not from the header's own\n * text: the header also carries the unsaved-changes and invalid-field indicators, so\n * reading the whole node turns \"Organization Identity\" into \"Organization Identity1\".\n */\n private readPanels(root: HTMLElement): FormChromePanelSnapshot[] {\n const out: FormChromePanelSnapshot[] = [];\n const seen = new Set<string>();\n root.querySelectorAll('mj-collapsible-panel[data-section-key]').forEach((node) => {\n const key = node.getAttribute('data-section-key')?.trim();\n if (!key || seen.has(key)) return;\n seen.add(key);\n const title = node.querySelector('.mj-forms-panel-title span')?.textContent?.trim();\n out.push({\n SectionKey: key,\n SectionName: title || key,\n Variant: node.getAttribute('data-variant') || 'default',\n Icon: node.getAttribute('data-icon') || undefined,\n });\n });\n return out;\n }\n\n /**\n * The inputs each section draws, keyed by section key.\n *\n * A field belongs to the nearest panel above it, which is what `closest` answers —\n * a nested panel would otherwise donate its fields to its parent as well. Read from\n * `data-field-name` rather than from a component reference, so this stays a DOM sweep\n * like the rest of the probe; a field a contribution already claims still carries the\n * attribute, because the element exists even when it draws nothing.\n */\n private readFields(root: HTMLElement): Map<string, Array<{ Name: string; Label: string }>> {\n const out = new Map<string, Array<{ Name: string; Label: string }>>();\n root.querySelectorAll('mj-form-field[data-field-name]').forEach((node) => {\n const name = node.getAttribute('data-field-name')?.trim();\n if (!name) return;\n const key = node.closest('mj-collapsible-panel[data-section-key]')\n ?.getAttribute('data-section-key')?.trim();\n if (!key) return;\n const list = out.get(key) ?? [];\n if (list.some((f) => f.Name === name)) return;\n list.push({ Name: name, Label: node.getAttribute('data-field-label')?.trim() || name });\n out.set(key, list);\n });\n return out;\n }\n\n /**\n * The rail the saved form will show.\n *\n * Resolved through the form's own chrome resolver rather than read off the probe's\n * DOM. The probe renders a NEW record, and a related grid on an unsaved record has\n * nothing to draw, so it leaves the rail — which drops the group count below the\n * auto-left-nav threshold and makes a rail form report itself as an accordion. The\n * panels are what the probe can see; the rail they form is computed.\n */\n private resolveRail(\n entityName: string,\n panels: FormChromePanelSnapshot[],\n provider: IMetadataProvider | undefined,\n ): { Groups: FormChromeGroup[]; Layout: 'accordion' | 'left-nav' } {\n const entity = provider?.EntityByName(entityName);\n if (!entity) {\n return { Groups: [], Layout: ResolveFormLayout(null, panels.length) };\n }\n try {\n const spec = ResolveFormChrome({\n Entity: entity,\n Panels: panels,\n RelatedSchemaByEntityId: new Map(),\n // Without these an installed contribution is indistinguishable from a\n // field section, so it folds into Details and is counted as one of them.\n ContributionSectionKeys: this.contributionKeys(entity, provider),\n }).Spec;\n return { Groups: spec.Groups, Layout: spec.Layout };\n } catch (err: unknown) {\n LogError(`FormSlotProbeService: rail resolve for '${entityName}' failed: ${err instanceof Error ? err.message : String(err)}`);\n return { Groups: [], Layout: 'accordion' };\n }\n }\n}\n\nconst EMPTY_SHAPE: ProbedFormShape = { Slots: [], Sections: [], Panels: [], Groups: [], Layout: 'accordion' };\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FormContext } from './types/form-types';
|
|
2
|
+
/**
|
|
3
|
+
* Field-wise comparison for {@link FormContext}. Scalars by identity; the key arrays by
|
|
4
|
+
* shallow content, so a freshly built array with the same keys does not read as a change.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FormContextsEqual(a: FormContext, b: FormContext): boolean;
|
|
7
|
+
export declare function SameKeys(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean;
|
|
8
|
+
/** Test seams — the helpers above are internal, but their behavior is load-bearing. */
|
|
9
|
+
export declare const FormContextsEqualForTest: typeof FormContextsEqual;
|
|
10
|
+
export declare const SameKeysForTest: typeof SameKeys;
|
|
11
|
+
//# sourceMappingURL=base-form-component-internals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-form-component-internals.d.ts","sourceRoot":"","sources":["../../src/lib/base-form-component-internals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAazE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAOpG;AAED,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,0BAAoB,CAAC;AAC1D,eAAO,MAAM,eAAe,iBAAW,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field-wise comparison for {@link FormContext}. Scalars by identity; the key arrays by
|
|
3
|
+
* shallow content, so a freshly built array with the same keys does not read as a change.
|
|
4
|
+
*/
|
|
5
|
+
export function FormContextsEqual(a, b) {
|
|
6
|
+
return a.sectionFilter === b.sectionFilter
|
|
7
|
+
&& a.showEmptyFields === b.showEmptyFields
|
|
8
|
+
&& a.showValidation === b.showValidation
|
|
9
|
+
&& a.validationErrors === b.validationErrors
|
|
10
|
+
&& a.collapsibleSections === b.collapsibleSections
|
|
11
|
+
&& a.enableRecordLinks === b.enableRecordLinks
|
|
12
|
+
&& a.showRelatedEntities === b.showRelatedEntities
|
|
13
|
+
&& a.allowSectionReorder === b.allowSectionReorder
|
|
14
|
+
&& SameKeys(a.hiddenSectionKeys, b.hiddenSectionKeys)
|
|
15
|
+
&& SameKeys(a.visibleSectionKeys, b.visibleSectionKeys)
|
|
16
|
+
&& SameKeys(a.claimedFieldNames, b.claimedFieldNames)
|
|
17
|
+
&& SameKeys(a.hiddenFieldNames, b.hiddenFieldNames);
|
|
18
|
+
}
|
|
19
|
+
export function SameKeys(a, b) {
|
|
20
|
+
if (a === b)
|
|
21
|
+
return true;
|
|
22
|
+
if (!a || !b || a.length !== b.length)
|
|
23
|
+
return false;
|
|
24
|
+
for (let i = 0; i < a.length; i++) {
|
|
25
|
+
if (a[i] !== b[i])
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
/** Test seams — the helpers above are internal, but their behavior is load-bearing. */
|
|
31
|
+
export const FormContextsEqualForTest = FormContextsEqual;
|
|
32
|
+
export const SameKeysForTest = SameKeys;
|
|
33
|
+
//# sourceMappingURL=base-form-component-internals.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QAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,uFAAuF;AACvF,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC","sourcesContent":["import type { FormContext } from './types/form-types';\n\n/**\n * Field-wise comparison for {@link FormContext}. Scalars by identity; the key arrays by\n * shallow content, so a freshly built array with the same keys does not read as a change.\n */\nexport function FormContextsEqual(a: FormContext, b: FormContext): boolean {\n return a.sectionFilter === b.sectionFilter\n && a.showEmptyFields === b.showEmptyFields\n && a.showValidation === b.showValidation\n && a.validationErrors === b.validationErrors\n && a.collapsibleSections === b.collapsibleSections\n && a.enableRecordLinks === b.enableRecordLinks\n && a.showRelatedEntities === b.showRelatedEntities\n && a.allowSectionReorder === b.allowSectionReorder\n && SameKeys(a.hiddenSectionKeys, b.hiddenSectionKeys)\n && SameKeys(a.visibleSectionKeys, b.visibleSectionKeys)\n && SameKeys(a.claimedFieldNames, b.claimedFieldNames)\n && SameKeys(a.hiddenFieldNames, b.hiddenFieldNames);\n}\n\nexport function SameKeys(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean {\n if (a === b) return true;\n if (!a || !b || a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/** Test seams — the helpers above are internal, but their behavior is load-bearing. */\nexport const FormContextsEqualForTest = FormContextsEqual;\nexport const SameKeysForTest = SameKeys;\n"]}
|