@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
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form contributions — pure resolve of what should appear on an entity form.
|
|
3
|
+
*
|
|
4
|
+
* A contribution is either a registered BaseFormPanel or the stock related-entity
|
|
5
|
+
* grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory
|
|
6
|
+
* — the host queries registrations and feeds this.
|
|
7
|
+
*
|
|
8
|
+
* Contribution keys and section keys come from the shared key module in
|
|
9
|
+
* `@memberjunction/interactive-component-types/forms`, which the server actions use too.
|
|
10
|
+
* Section keys for related panels match CodeGen's camelCase (`angular-codegen.ts`), so
|
|
11
|
+
* hide-baked and skip-baked find the grid CodeGen emitted.
|
|
12
|
+
*/
|
|
13
|
+
import type { ClassRegistration } from '@memberjunction/global';
|
|
14
|
+
import type { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
15
|
+
import { type FormContributionSpec } from '@memberjunction/interactive-component-types/forms';
|
|
16
|
+
import { type MJEntityFormContributionEntity } from '@memberjunction/core-entities';
|
|
1
17
|
import { FormPanelRegistrationMetadata, FormPanelSlot } from './base-form-panel';
|
|
2
18
|
/** Minimum relationship shape the composer reads. Satisfied by EntityRelationshipInfo. */
|
|
3
19
|
export interface FormContributionRelationship {
|
|
@@ -8,9 +24,46 @@ export interface FormContributionRelationship {
|
|
|
8
24
|
DisplayName?: string | null;
|
|
9
25
|
Sequence?: number | null;
|
|
10
26
|
}
|
|
27
|
+
/** Which of the two registration sources produced a contribution. */
|
|
28
|
+
export type FormContributionRegistrationSource = 'class' | 'metadata';
|
|
11
29
|
export interface FormContributionRegistration {
|
|
30
|
+
/**
|
|
31
|
+
* Rank within a `contributionKey` group, higher wins. For `'class'` registrations this
|
|
32
|
+
* is the ClassFactory registration priority; for `'metadata'` rows it is the row's
|
|
33
|
+
* `Precedence` column. Both mean the same thing here — higher wins — which is why one
|
|
34
|
+
* field carries both.
|
|
35
|
+
*/
|
|
12
36
|
Priority: number;
|
|
13
37
|
Metadata: FormPanelRegistrationMetadata;
|
|
38
|
+
/** Omitted on legacy call sites, which are all compiled registrations. */
|
|
39
|
+
Source?: FormContributionRegistrationSource;
|
|
40
|
+
/** `MJ: Components.ID` the panel renders — metadata rows only. */
|
|
41
|
+
ComponentID?: string;
|
|
42
|
+
/** Parsed `Configuration` JSON for metadata rows. */
|
|
43
|
+
Configuration?: Record<string, unknown>;
|
|
44
|
+
Title?: string;
|
|
45
|
+
Icon?: string;
|
|
46
|
+
Presentation?: 'panel' | 'bare';
|
|
47
|
+
/** `MJ: Entity Form Contributions.ID` for metadata rows. */
|
|
48
|
+
RowID?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Who a metadata row is for. Absent on compiled registrations, which apply to everyone the
|
|
51
|
+
* code puts them in front of. A `User` row a user can see is necessarily their own — the
|
|
52
|
+
* collector only returns personal rows for the current user.
|
|
53
|
+
*/
|
|
54
|
+
Scope?: MJEntityFormContributionEntity['Scope'];
|
|
55
|
+
/** The ClassFactory registration for compiled panels — carries the component constructor. */
|
|
56
|
+
Registration?: ClassRegistration;
|
|
57
|
+
/**
|
|
58
|
+
* A panel the placement dialog is showing before it is saved. It draws its component when
|
|
59
|
+
* it carries one, else a placeholder. Only a form inside the dialog's preview sees one.
|
|
60
|
+
*/
|
|
61
|
+
IsPreview?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The component to render when it has not been saved yet, so there is no `ComponentID` to
|
|
64
|
+
* load. Only the placement preview sets it.
|
|
65
|
+
*/
|
|
66
|
+
ComponentSpec?: ComponentSpec;
|
|
14
67
|
}
|
|
15
68
|
export interface ResolveFormContributionsInput {
|
|
16
69
|
EntityName: string;
|
|
@@ -33,8 +86,17 @@ export interface FormContributionWinner {
|
|
|
33
86
|
RelatedJoinField?: string;
|
|
34
87
|
/** Field/other section this registered winner asked to hide. */
|
|
35
88
|
ReplacesSectionKey?: string;
|
|
89
|
+
/** Fields this registered winner stands in for, so they are not drawn. */
|
|
90
|
+
ReplacesFieldNames?: readonly string[];
|
|
91
|
+
/** Further sections this registered winner stands in for, beyond `ReplacesSectionKey`. */
|
|
92
|
+
ReplacesSectionKeys?: readonly string[];
|
|
36
93
|
BakedSectionKey: string;
|
|
37
94
|
DisplayName: string;
|
|
95
|
+
/** Carried through from the registration so consumers can tell the two sources apart. */
|
|
96
|
+
Source?: FormContributionRegistrationSource;
|
|
97
|
+
ComponentID?: string;
|
|
98
|
+
Title?: string;
|
|
99
|
+
Presentation?: 'panel' | 'bare';
|
|
38
100
|
}
|
|
39
101
|
export interface ResolveFormContributionsResult {
|
|
40
102
|
Winners: FormContributionWinner[];
|
|
@@ -43,15 +105,33 @@ export interface ResolveFormContributionsResult {
|
|
|
43
105
|
/** Stock grids the host should mount (unclaimed and not already baked). */
|
|
44
106
|
StockGrids: FormContributionWinner[];
|
|
45
107
|
}
|
|
46
|
-
/** Strip wrapping [] from a join field
|
|
108
|
+
/** Strip wrapping [] from a join field. Uses the shared `StripJoinFieldBrackets`. */
|
|
47
109
|
export declare function StripJoinFieldBrackets(joinField: string | null | undefined): string;
|
|
48
|
-
/**
|
|
49
|
-
* camelCase + identifier sanitize. Byte-compatible with
|
|
50
|
-
* `CodeGenLib` `angular-codegen.ts` `camelCase` — do not "improve".
|
|
51
|
-
*/
|
|
110
|
+
/** camelCase + identifier sanitize, as CodeGen names sections. Uses the shared `FormSectionCamelCase`. */
|
|
52
111
|
export declare function FormSectionCamelCase(str: string): string;
|
|
112
|
+
/** `related:<entity>:<join>`. Uses the shared `RelatedContributionKey`. */
|
|
53
113
|
export declare function RelatedContributionKey(relatedEntity: string, joinField?: string | null): string;
|
|
114
|
+
/**
|
|
115
|
+
* The key a registration collapses by: its own key, else the derived related key. Empty for a
|
|
116
|
+
* registration with neither, which never collapses. Uses the shared `ResolveContributionWriteKey`.
|
|
117
|
+
*/
|
|
54
118
|
export declare function ResolveContributionKey(meta: FormPanelRegistrationMetadata): string;
|
|
119
|
+
/**
|
|
120
|
+
* The section key a registration's panel draws under, which the rail, the counts and the chrome
|
|
121
|
+
* group file it by.
|
|
122
|
+
*
|
|
123
|
+
* A row's panel draws under its contribution key ({@link ResolveContributionKey}), or
|
|
124
|
+
* `contribution:<row id>` when it has none. A compiled panel's template names its own section; by
|
|
125
|
+
* convention that is its `contributionKey`, or for a grid claim with no key, the related entity's
|
|
126
|
+
* name after its schema prefix, in camelCase. Empty for a compiled panel with neither.
|
|
127
|
+
*/
|
|
128
|
+
export declare function ContributionSectionKey(registration: FormContributionRegistration): string;
|
|
129
|
+
/**
|
|
130
|
+
* A contribution spec as a registration: the one mapping for a saved row, the placement preview
|
|
131
|
+
* and the artifact viewer's preview. Ranked 0 and keyed only by the spec's own key; a caller that
|
|
132
|
+
* knows more (a row's precedence, a preview's derived key) sets it on the result.
|
|
133
|
+
*/
|
|
134
|
+
export declare function ContributionSpecToRegistration(entityName: string, spec: FormContributionSpec, componentID?: string): FormContributionRegistration;
|
|
55
135
|
/**
|
|
56
136
|
* SectionKey CodeGen emits for a related-entity panel. When more than one
|
|
57
137
|
* DisplayInForm relationship points at the same entity, the join field is
|
|
@@ -72,13 +152,56 @@ export declare function RelatedEntitySectionKey(relationship: FormContributionRe
|
|
|
72
152
|
export declare function CreateRelatedEntitySectionKeyResolver(displayInFormPeers: readonly FormContributionRelationship[]): (relationship: FormContributionRelationship) => string;
|
|
73
153
|
export declare function RelationshipDisplayName(relationship: FormContributionRelationship): string;
|
|
74
154
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
155
|
+
* Strict entity match shared by the composer and the slot host. `'*'` matches every form.
|
|
156
|
+
*
|
|
157
|
+
* Exported because the slot host used to run its own prefix-insensitive variant, which
|
|
158
|
+
* mounted panels the composer then ignored — the two sides disagreed about which panels
|
|
159
|
+
* existed. One predicate, used by both.
|
|
160
|
+
*/
|
|
161
|
+
export declare function FormContributionEntityMatches(registeredEntity: string | null | undefined, formEntity: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* A wildcard registration that claims a grid, a section or a rail tab, or names a section to draw
|
|
164
|
+
* in. It still mounts, but its claim is ignored: it would take that place from every form.
|
|
165
|
+
*/
|
|
166
|
+
export declare function IsWildcardPlaceClaim(meta: FormPanelRegistrationMetadata): boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Collapse by key ({@link ResolveContributionKey}, compared exactly). Highest Priority wins; on a
|
|
169
|
+
* tie the compiled registration wins, and between rows the narrower scope. Registrations without
|
|
170
|
+
* a key never collapse.
|
|
171
|
+
*
|
|
172
|
+
* The tie-break is an explicit comparator rather than input ordering, so the result does not
|
|
173
|
+
* depend on which source the caller concatenated first.
|
|
77
174
|
*/
|
|
78
175
|
export declare function CollapseFormPanelRegistrations<T extends {
|
|
79
176
|
Priority: number;
|
|
80
177
|
Metadata: FormPanelRegistrationMetadata;
|
|
178
|
+
Source?: FormContributionRegistrationSource;
|
|
179
|
+
Scope?: FormContributionRegistration['Scope'];
|
|
81
180
|
}>(registrations: readonly T[]): T[];
|
|
181
|
+
/** One form's contributions after the collapse. */
|
|
182
|
+
export interface ResolvedFormContributions {
|
|
183
|
+
/**
|
|
184
|
+
* The winners among the registrations for this entity or for every entity (`'*'`): one per
|
|
185
|
+
* key, and each registration that has no key.
|
|
186
|
+
*/
|
|
187
|
+
readonly Winners: readonly FormContributionRegistration[];
|
|
188
|
+
/**
|
|
189
|
+
* The winners the rail files, by {@link ContributionSectionKey}: they name the entity rather
|
|
190
|
+
* than the wildcard, draw a section rather than a bare strip, and have a section key. Two
|
|
191
|
+
* winners filed under one section key keep the one that ranks higher in the collapse.
|
|
192
|
+
*/
|
|
193
|
+
readonly RailItems: ReadonlyMap<string, FormContributionRegistration>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* The winning registrations on one entity's form, resolved once for the whole form.
|
|
197
|
+
*
|
|
198
|
+
* Every host that draws contributions filters these winners by its own slot or section, so a row
|
|
199
|
+
* that takes a key from a compiled panel draws where the row says, and the compiled panel draws
|
|
200
|
+
* nowhere. Memoized per input list, which the collector returns as a stable reference until
|
|
201
|
+
* something changes, so a caller must not change a list after passing it. The result is shared:
|
|
202
|
+
* callers must not mutate it.
|
|
203
|
+
*/
|
|
204
|
+
export declare function ResolveFormContributionWinners(entityName: string, registrations: readonly FormContributionRegistration[]): ResolvedFormContributions;
|
|
82
205
|
/**
|
|
83
206
|
* Resolve what belongs on the form. Stock grids are only those the template
|
|
84
207
|
* did not already bake and that no panel claimed.
|
|
@@ -88,4 +211,44 @@ export declare function ResolveFormContributions(input: ResolveFormContributions
|
|
|
88
211
|
export declare function ContributionHiddenSectionKeys(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
|
|
89
212
|
/** @deprecated Use {@link ContributionHiddenSectionKeys}. */
|
|
90
213
|
export declare function ClaimedRelatedSectionKeys(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
|
|
214
|
+
/**
|
|
215
|
+
* Whether this registration is hosted by a section rather than by a slot.
|
|
216
|
+
*
|
|
217
|
+
* A contribution that names fields renders at the top of the section drawing them, which
|
|
218
|
+
* `<mj-form-field-panel-slot>` mounts. It still carries a `slot`, because every row does,
|
|
219
|
+
* so a slot host that went by slot alone would mount it a second time at the bottom of the
|
|
220
|
+
* form — the same panel twice, once in the group and once as a section of its own.
|
|
221
|
+
*/
|
|
222
|
+
export declare function ContributionClaimsFields(metadata: Pick<FormPanelRegistrationMetadata, 'replacesFieldNames'> | null | undefined): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* The section a registration names to draw in, or '' when it names none. A wildcard
|
|
225
|
+
* (`entity: '*'`) registration's section is ignored, because it would take that place on every
|
|
226
|
+
* form, so the panel draws at its slot.
|
|
227
|
+
*/
|
|
228
|
+
export declare function PlacedInSectionKey(metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'inSectionKey'>> | null | undefined): string;
|
|
229
|
+
/**
|
|
230
|
+
* Whether this registration is drawn inside a section rather than by a slot: it stands in for
|
|
231
|
+
* fields, or it names a section to draw in ({@link PlacedInSectionKey}). The section's own host
|
|
232
|
+
* mounts it, so a slot host must not mount it a second time.
|
|
233
|
+
*/
|
|
234
|
+
export declare function ContributionDrawsInSection(metadata: Partial<Pick<FormPanelRegistrationMetadata, 'entity' | 'replacesFieldNames' | 'inSectionKey'>> | null | undefined): boolean;
|
|
235
|
+
/** Where inside its section a section-hosted contribution draws. */
|
|
236
|
+
export declare function ContributionSectionPosition(metadata: Pick<FormPanelRegistrationMetadata, 'sectionPosition'> | null | undefined): 'start' | 'end';
|
|
237
|
+
/** Every section a contribution stands in for: the single key, then the list, without repeats. */
|
|
238
|
+
export declare function ReplacedSectionKeys(metadata: Pick<FormPanelRegistrationMetadata, 'replacesSectionKey' | 'replacesSectionKeys'> | null | undefined): string[];
|
|
239
|
+
/**
|
|
240
|
+
* Field names the winning contributions stand in for, so the form stops drawing them.
|
|
241
|
+
*
|
|
242
|
+
* Separate from {@link ContributionHiddenSectionKeys} because the two hide different
|
|
243
|
+
* things: a section key removes a whole card, a field name removes one input from inside
|
|
244
|
+
* one. The panel that made the claim renders at the top of the section that held those
|
|
245
|
+
* fields, which is the collapsible panel's job — this only says which fields are spoken for.
|
|
246
|
+
*/
|
|
247
|
+
export declare function ContributionClaimedFieldNames(entityName: string, relatedEntities: readonly FormContributionRelationship[], isaChildEntityIDs: readonly string[], registrations: readonly FormContributionRegistration[]): string[];
|
|
248
|
+
/**
|
|
249
|
+
* `DisplayInForm` relationships that can appear on the parent form (IS-A
|
|
250
|
+
* children excluded), in Sequence order — the same peer set
|
|
251
|
+
* {@link ResolveFormContributions} and {@link CreateRelatedEntitySectionKeyResolver} use.
|
|
252
|
+
*/
|
|
253
|
+
export declare function VisibleFormRelationships<T extends FormContributionRelationship>(related: readonly T[], isaChildIds: readonly string[]): T[];
|
|
91
254
|
//# sourceMappingURL=form-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-contribution.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"form-contribution.d.ts","sourceRoot":"","sources":["../../../src/lib/panel-slot/form-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6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OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,cAAc,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GACrG,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,oBAAoB,GAAG,cAAc,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAC5H,OAAO,CAET;AAED,oEAAoE;AACpE,wBAAgB,2BAA2B,CACvC,QAAQ,EAAE,IAAI,CAAC,6BAA6B,EAAE,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,GACpF,OAAO,GAAG,KAAK,CAEjB;AAED,kGAAkG;AAClG,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,IAAI,CAAC,6BAA6B,EAAE,oBAAoB,GAAG,qBAAqB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/G,MAAM,EAAE,CAOV;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,SAAS,4BAA4B,EAAE,EACxD,iBAAiB,EAAE,SAAS,MAAM,EAAE,EACpC,aAAa,EAAE,SAAS,4BAA4B,EAAE,GACvD,MAAM,EAAE,CAiBV;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,4BAA4B,EAC3E,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,WAAW,EAAE,SAAS,MAAM,EAAE,GAC/B,CAAC,EAAE,CAEL"}
|
|
@@ -1,45 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
* Form contributions — pure resolve of what should appear on an entity form.
|
|
3
|
-
*
|
|
4
|
-
* A contribution is either a registered BaseFormPanel or the stock related-entity
|
|
5
|
-
* grid. Related claims replace the stock/baked grid. No Angular, no ClassFactory
|
|
6
|
-
* — the host queries registrations and feeds this.
|
|
7
|
-
*
|
|
8
|
-
* Section keys for related panels MUST match CodeGen's camelCase
|
|
9
|
-
* (`angular-codegen.ts` `camelCase` + related-entity sectionKey). If they drift,
|
|
10
|
-
* hide-baked and skip-baked miss and the user sees a double grid.
|
|
11
|
-
*/
|
|
1
|
+
import { DEFAULT_FORM_CONTRIBUTION_SLOT, FormSectionCamelCase as SharedFormSectionCamelCase, RelatedContributionKey as SharedRelatedContributionKey, RelatedGridSectionKey, ResolveContributionWriteKey, StripJoinFieldBrackets as SharedStripJoinFieldBrackets, } from '@memberjunction/interactive-component-types/forms';
|
|
12
2
|
import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
|
|
13
|
-
|
|
3
|
+
import { FormContributionOutranks } from '@memberjunction/core-entities';
|
|
4
|
+
/** Strip wrapping [] from a join field. Uses the shared `StripJoinFieldBrackets`. */
|
|
14
5
|
export function StripJoinFieldBrackets(joinField) {
|
|
15
|
-
return (joinField
|
|
6
|
+
return SharedStripJoinFieldBrackets(joinField);
|
|
16
7
|
}
|
|
17
|
-
/**
|
|
18
|
-
* camelCase + identifier sanitize. Byte-compatible with
|
|
19
|
-
* `CodeGenLib` `angular-codegen.ts` `camelCase` — do not "improve".
|
|
20
|
-
*/
|
|
8
|
+
/** camelCase + identifier sanitize, as CodeGen names sections. Uses the shared `FormSectionCamelCase`. */
|
|
21
9
|
export function FormSectionCamelCase(str) {
|
|
22
|
-
|
|
23
|
-
let result = sanitized
|
|
24
|
-
.replace(/\s(.)/g, (_match, char) => char.toUpperCase())
|
|
25
|
-
.replace(/\s/g, '')
|
|
26
|
-
.replace(/^(.)/, (_match, char) => char.toLowerCase());
|
|
27
|
-
if (/^\d/.test(result)) {
|
|
28
|
-
result = '_' + result;
|
|
29
|
-
}
|
|
30
|
-
return result.length === 0 ? 'section' : result;
|
|
10
|
+
return SharedFormSectionCamelCase(str);
|
|
31
11
|
}
|
|
12
|
+
/** `related:<entity>:<join>`. Uses the shared `RelatedContributionKey`. */
|
|
32
13
|
export function RelatedContributionKey(relatedEntity, joinField) {
|
|
33
|
-
return
|
|
14
|
+
return SharedRelatedContributionKey(relatedEntity, joinField);
|
|
34
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The key a registration collapses by: its own key, else the derived related key. Empty for a
|
|
18
|
+
* registration with neither, which never collapses. Uses the shared `ResolveContributionWriteKey`.
|
|
19
|
+
*/
|
|
35
20
|
export function ResolveContributionKey(meta) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
return ResolveContributionWriteKey(meta, meta.relatedEntity ?? null) ?? '';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The section key a registration's panel draws under, which the rail, the counts and the chrome
|
|
25
|
+
* group file it by.
|
|
26
|
+
*
|
|
27
|
+
* A row's panel draws under its contribution key ({@link ResolveContributionKey}), or
|
|
28
|
+
* `contribution:<row id>` when it has none. A compiled panel's template names its own section; by
|
|
29
|
+
* convention that is its `contributionKey`, or for a grid claim with no key, the related entity's
|
|
30
|
+
* name after its schema prefix, in camelCase. Empty for a compiled panel with neither.
|
|
31
|
+
*/
|
|
32
|
+
export function ContributionSectionKey(registration) {
|
|
33
|
+
const meta = registration.Metadata;
|
|
34
|
+
if (registration.Source === 'metadata') {
|
|
35
|
+
return ResolveContributionKey(meta) || `contribution:${registration.RowID ?? registration.ComponentID ?? 'unknown'}`;
|
|
41
36
|
}
|
|
42
|
-
|
|
37
|
+
const own = meta.contributionKey?.trim();
|
|
38
|
+
if (own)
|
|
39
|
+
return own;
|
|
40
|
+
// The key compiled panel templates use (`contactMethods`), not the generated-form grid key.
|
|
41
|
+
const entityName = meta.relatedEntity?.split(':').pop()?.trim();
|
|
42
|
+
return entityName ? FormSectionCamelCase(entityName) : '';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A contribution spec as a registration: the one mapping for a saved row, the placement preview
|
|
46
|
+
* and the artifact viewer's preview. Ranked 0 and keyed only by the spec's own key; a caller that
|
|
47
|
+
* knows more (a row's precedence, a preview's derived key) sets it on the result.
|
|
48
|
+
*/
|
|
49
|
+
export function ContributionSpecToRegistration(entityName, spec, componentID) {
|
|
50
|
+
const metadata = {
|
|
51
|
+
entity: entityName,
|
|
52
|
+
slot: spec.slot ?? DEFAULT_FORM_CONTRIBUTION_SLOT,
|
|
53
|
+
sortKey: spec.sortKey ?? 0,
|
|
54
|
+
presentation: spec.presentation,
|
|
55
|
+
};
|
|
56
|
+
if (spec.contributionKey)
|
|
57
|
+
metadata.contributionKey = spec.contributionKey;
|
|
58
|
+
if (spec.relatedEntity)
|
|
59
|
+
metadata.relatedEntity = spec.relatedEntity;
|
|
60
|
+
if (spec.relatedJoinField)
|
|
61
|
+
metadata.relatedJoinField = spec.relatedJoinField;
|
|
62
|
+
if (spec.replacesSectionKey)
|
|
63
|
+
metadata.replacesSectionKey = spec.replacesSectionKey;
|
|
64
|
+
if (spec.replacesFieldNames?.length)
|
|
65
|
+
metadata.replacesFieldNames = [...spec.replacesFieldNames];
|
|
66
|
+
if (spec.replacesSectionKeys?.length)
|
|
67
|
+
metadata.replacesSectionKeys = [...spec.replacesSectionKeys];
|
|
68
|
+
if (spec.inSectionKey)
|
|
69
|
+
metadata.inSectionKey = spec.inSectionKey;
|
|
70
|
+
if (spec.sectionPosition)
|
|
71
|
+
metadata.sectionPosition = spec.sectionPosition;
|
|
72
|
+
if (spec.inclusion)
|
|
73
|
+
metadata.inclusion = spec.inclusion;
|
|
74
|
+
if (spec.chromeGroup)
|
|
75
|
+
metadata.chromeGroup = spec.chromeGroup;
|
|
76
|
+
const registration = {
|
|
77
|
+
Priority: 0,
|
|
78
|
+
Metadata: metadata,
|
|
79
|
+
Source: 'metadata',
|
|
80
|
+
Title: spec.title,
|
|
81
|
+
Icon: spec.icon,
|
|
82
|
+
Presentation: spec.presentation,
|
|
83
|
+
Configuration: spec.configuration ?? {},
|
|
84
|
+
};
|
|
85
|
+
if (componentID)
|
|
86
|
+
registration.ComponentID = componentID;
|
|
87
|
+
return registration;
|
|
43
88
|
}
|
|
44
89
|
/**
|
|
45
90
|
* SectionKey CodeGen emits for a related-entity panel. When more than one
|
|
@@ -60,10 +105,7 @@ export function RelatedEntitySectionKey(relationship, displayInFormPeers) {
|
|
|
60
105
|
return relatedSectionKey(relationship, sameEntityCount > 1);
|
|
61
106
|
}
|
|
62
107
|
function relatedSectionKey(relationship, sharesRelatedEntity) {
|
|
63
|
-
|
|
64
|
-
return FormSectionCamelCase(`${relationship.RelatedEntity} ${StripJoinFieldBrackets(relationship.RelatedEntityJoinField)}`);
|
|
65
|
-
}
|
|
66
|
-
return FormSectionCamelCase(relationship.RelatedEntity);
|
|
108
|
+
return RelatedGridSectionKey(relationship.RelatedEntity, relationship.RelatedEntityJoinField, sharesRelatedEntity);
|
|
67
109
|
}
|
|
68
110
|
/**
|
|
69
111
|
* Builds a function that returns {@link RelatedEntitySectionKey}`(relationship, displayInFormPeers)`
|
|
@@ -102,27 +144,44 @@ function visibleRelationships(related, isaChildIds) {
|
|
|
102
144
|
return a.RelatedEntity.localeCompare(b.RelatedEntity);
|
|
103
145
|
});
|
|
104
146
|
}
|
|
105
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Strict entity match shared by the composer and the slot host. `'*'` matches every form.
|
|
149
|
+
*
|
|
150
|
+
* Exported because the slot host used to run its own prefix-insensitive variant, which
|
|
151
|
+
* mounted panels the composer then ignored — the two sides disagreed about which panels
|
|
152
|
+
* existed. One predicate, used by both.
|
|
153
|
+
*/
|
|
154
|
+
export function FormContributionEntityMatches(registeredEntity, formEntity) {
|
|
155
|
+
if (!registeredEntity)
|
|
156
|
+
return false;
|
|
106
157
|
return registeredEntity === '*' || registeredEntity === formEntity;
|
|
107
158
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// Related / field-section claims on entity:'*' would hide panels on every
|
|
116
|
-
// form. Those claims must name the form entity.
|
|
117
|
-
if ((reg.Metadata.relatedEntity || reg.Metadata.replacesSectionKey) && entity === '*') {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
return true;
|
|
121
|
-
});
|
|
159
|
+
/**
|
|
160
|
+
* A wildcard registration that claims a grid, a section or a rail tab, or names a section to draw
|
|
161
|
+
* in. It still mounts, but its claim is ignored: it would take that place from every form.
|
|
162
|
+
*/
|
|
163
|
+
export function IsWildcardPlaceClaim(meta) {
|
|
164
|
+
return meta.entity === '*'
|
|
165
|
+
&& (!!meta.relatedEntity || ReplacedSectionKeys(meta).length > 0 || !!meta.inSectionKey?.trim());
|
|
122
166
|
}
|
|
123
167
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
168
|
+
* Whether `reg` beats `incumbent`, by the rule the server's composition answer also uses
|
|
169
|
+
* ({@link FormContributionOutranks}): higher Priority; on a tie a compiled registration beats any
|
|
170
|
+
* row, and between rows the narrower audience wins.
|
|
171
|
+
*/
|
|
172
|
+
function outranks(reg, incumbent) {
|
|
173
|
+
return FormContributionOutranks(rankOf(reg), rankOf(incumbent));
|
|
174
|
+
}
|
|
175
|
+
function rankOf(reg) {
|
|
176
|
+
return { Precedence: reg.Priority, Scope: reg.Scope, Compiled: reg.Source !== 'metadata' };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Collapse by key ({@link ResolveContributionKey}, compared exactly). Highest Priority wins; on a
|
|
180
|
+
* tie the compiled registration wins, and between rows the narrower scope. Registrations without
|
|
181
|
+
* a key never collapse.
|
|
182
|
+
*
|
|
183
|
+
* The tie-break is an explicit comparator rather than input ordering, so the result does not
|
|
184
|
+
* depend on which source the caller concatenated first.
|
|
126
185
|
*/
|
|
127
186
|
export function CollapseFormPanelRegistrations(registrations) {
|
|
128
187
|
const winners = new Map();
|
|
@@ -130,19 +189,46 @@ export function CollapseFormPanelRegistrations(registrations) {
|
|
|
130
189
|
for (const reg of registrations) {
|
|
131
190
|
const key = ResolveContributionKey(reg.Metadata) || `__unique:${uniqueIndex++}`;
|
|
132
191
|
const incumbent = winners.get(key);
|
|
133
|
-
if (!incumbent || reg
|
|
192
|
+
if (!incumbent || outranks(reg, incumbent)) {
|
|
134
193
|
winners.set(key, reg);
|
|
135
194
|
}
|
|
136
195
|
}
|
|
137
196
|
return [...winners.values()];
|
|
138
197
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
198
|
+
const resolvedMemo = new WeakMap();
|
|
199
|
+
/**
|
|
200
|
+
* The winning registrations on one entity's form, resolved once for the whole form.
|
|
201
|
+
*
|
|
202
|
+
* Every host that draws contributions filters these winners by its own slot or section, so a row
|
|
203
|
+
* that takes a key from a compiled panel draws where the row says, and the compiled panel draws
|
|
204
|
+
* nowhere. Memoized per input list, which the collector returns as a stable reference until
|
|
205
|
+
* something changes, so a caller must not change a list after passing it. The result is shared:
|
|
206
|
+
* callers must not mutate it.
|
|
207
|
+
*/
|
|
208
|
+
export function ResolveFormContributionWinners(entityName, registrations) {
|
|
209
|
+
let byEntity = resolvedMemo.get(registrations);
|
|
210
|
+
const hit = byEntity?.get(entityName);
|
|
211
|
+
if (hit)
|
|
212
|
+
return hit;
|
|
213
|
+
const applicable = registrations.filter((reg) => FormContributionEntityMatches(reg.Metadata?.entity, entityName));
|
|
214
|
+
const winners = CollapseFormPanelRegistrations(applicable);
|
|
215
|
+
const railItems = new Map();
|
|
216
|
+
for (const reg of winners) {
|
|
217
|
+
const meta = reg.Metadata;
|
|
218
|
+
if (meta.entity !== entityName || reg.Presentation === 'bare' || meta.presentation === 'bare')
|
|
219
|
+
continue;
|
|
220
|
+
const key = ContributionSectionKey(reg);
|
|
221
|
+
const filed = key ? railItems.get(key) : undefined;
|
|
222
|
+
if (key && (!filed || outranks(reg, filed)))
|
|
223
|
+
railItems.set(key, reg);
|
|
224
|
+
}
|
|
225
|
+
const resolved = { Winners: winners, RailItems: railItems };
|
|
226
|
+
if (!byEntity) {
|
|
227
|
+
byEntity = new Map();
|
|
228
|
+
resolvedMemo.set(registrations, byEntity);
|
|
144
229
|
}
|
|
145
|
-
|
|
230
|
+
byEntity.set(entityName, resolved);
|
|
231
|
+
return resolved;
|
|
146
232
|
}
|
|
147
233
|
function stockWinner(relationship, sectionKey) {
|
|
148
234
|
const join = StripJoinFieldBrackets(relationship.RelatedEntityJoinField);
|
|
@@ -169,8 +255,14 @@ function registeredWinner(key, reg, sectionKey, displayName) {
|
|
|
169
255
|
RelatedEntity: meta.relatedEntity,
|
|
170
256
|
RelatedJoinField: meta.relatedJoinField ? StripJoinFieldBrackets(meta.relatedJoinField) : undefined,
|
|
171
257
|
ReplacesSectionKey: meta.replacesSectionKey?.trim() || undefined,
|
|
258
|
+
ReplacesFieldNames: meta.replacesFieldNames?.length ? [...meta.replacesFieldNames] : undefined,
|
|
259
|
+
ReplacesSectionKeys: meta.replacesSectionKeys?.length ? [...meta.replacesSectionKeys] : undefined,
|
|
172
260
|
BakedSectionKey: sectionKey,
|
|
173
261
|
DisplayName: displayName,
|
|
262
|
+
Source: reg.Source,
|
|
263
|
+
ComponentID: reg.ComponentID,
|
|
264
|
+
Title: reg.Title,
|
|
265
|
+
Presentation: reg.Presentation ?? meta.presentation,
|
|
174
266
|
};
|
|
175
267
|
}
|
|
176
268
|
function sortWinners(winners) {
|
|
@@ -188,12 +280,16 @@ function sortWinners(winners) {
|
|
|
188
280
|
*/
|
|
189
281
|
export function ResolveFormContributions(input) {
|
|
190
282
|
const peers = visibleRelationships(input.RelatedEntities, input.IsaChildEntityIDs);
|
|
191
|
-
const
|
|
283
|
+
const winners = ResolveFormContributionWinners(input.EntityName, input.Registrations).Winners;
|
|
192
284
|
const baked = new Set(input.BakedSectionKeys);
|
|
193
285
|
const sectionKeyOf = CreateRelatedEntitySectionKeyResolver(peers);
|
|
194
286
|
const claimedKeys = new Set();
|
|
195
287
|
const registered = [];
|
|
196
|
-
for (const
|
|
288
|
+
for (const reg of winners) {
|
|
289
|
+
// One winner per key per form: a wildcard place claim that won key K hides the entity's own K too.
|
|
290
|
+
if (IsWildcardPlaceClaim(reg.Metadata))
|
|
291
|
+
continue;
|
|
292
|
+
const key = ResolveContributionKey(reg.Metadata) || `${reg.Metadata.entity}:${reg.Metadata.slot}:${reg.Priority}`;
|
|
197
293
|
const related = reg.Metadata.relatedEntity?.trim();
|
|
198
294
|
const peer = related
|
|
199
295
|
? peers.find((rel) => {
|
|
@@ -207,7 +303,7 @@ export function ResolveFormContributions(input) {
|
|
|
207
303
|
: undefined;
|
|
208
304
|
const sectionKey = peer ? sectionKeyOf(peer) : '';
|
|
209
305
|
if (related) {
|
|
210
|
-
claimedKeys.add(
|
|
306
|
+
claimedKeys.add(RelatedContributionKey(related, reg.Metadata.relatedJoinField));
|
|
211
307
|
// A claim that omits the join field covers every FK to that entity.
|
|
212
308
|
if (!StripJoinFieldBrackets(reg.Metadata.relatedJoinField)) {
|
|
213
309
|
for (const match of peers.filter((rel) => rel.RelatedEntity === related)) {
|
|
@@ -265,6 +361,9 @@ export function ContributionHiddenSectionKeys(entityName, relatedEntities, isaCh
|
|
|
265
361
|
continue;
|
|
266
362
|
if (winner.ReplacesSectionKey)
|
|
267
363
|
keys.push(winner.ReplacesSectionKey);
|
|
364
|
+
for (const key of winner.ReplacesSectionKeys ?? [])
|
|
365
|
+
if (key.trim())
|
|
366
|
+
keys.push(key.trim());
|
|
268
367
|
if (!winner.RelatedEntity)
|
|
269
368
|
continue;
|
|
270
369
|
const peer = peers.find((rel) => {
|
|
@@ -283,4 +382,83 @@ export function ContributionHiddenSectionKeys(entityName, relatedEntities, isaCh
|
|
|
283
382
|
export function ClaimedRelatedSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations) {
|
|
284
383
|
return ContributionHiddenSectionKeys(entityName, relatedEntities, isaChildEntityIDs, registrations);
|
|
285
384
|
}
|
|
385
|
+
/**
|
|
386
|
+
* Whether this registration is hosted by a section rather than by a slot.
|
|
387
|
+
*
|
|
388
|
+
* A contribution that names fields renders at the top of the section drawing them, which
|
|
389
|
+
* `<mj-form-field-panel-slot>` mounts. It still carries a `slot`, because every row does,
|
|
390
|
+
* so a slot host that went by slot alone would mount it a second time at the bottom of the
|
|
391
|
+
* form — the same panel twice, once in the group and once as a section of its own.
|
|
392
|
+
*/
|
|
393
|
+
export function ContributionClaimsFields(metadata) {
|
|
394
|
+
return (metadata?.replacesFieldNames ?? []).some((name) => name.trim().length > 0);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* The section a registration names to draw in, or '' when it names none. A wildcard
|
|
398
|
+
* (`entity: '*'`) registration's section is ignored, because it would take that place on every
|
|
399
|
+
* form, so the panel draws at its slot.
|
|
400
|
+
*/
|
|
401
|
+
export function PlacedInSectionKey(metadata) {
|
|
402
|
+
if (!metadata || metadata.entity === '*')
|
|
403
|
+
return '';
|
|
404
|
+
return metadata.inSectionKey?.trim() ?? '';
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Whether this registration is drawn inside a section rather than by a slot: it stands in for
|
|
408
|
+
* fields, or it names a section to draw in ({@link PlacedInSectionKey}). The section's own host
|
|
409
|
+
* mounts it, so a slot host must not mount it a second time.
|
|
410
|
+
*/
|
|
411
|
+
export function ContributionDrawsInSection(metadata) {
|
|
412
|
+
return ContributionClaimsFields(metadata) || !!PlacedInSectionKey(metadata);
|
|
413
|
+
}
|
|
414
|
+
/** Where inside its section a section-hosted contribution draws. */
|
|
415
|
+
export function ContributionSectionPosition(metadata) {
|
|
416
|
+
return metadata?.sectionPosition === 'end' ? 'end' : 'start';
|
|
417
|
+
}
|
|
418
|
+
/** Every section a contribution stands in for: the single key, then the list, without repeats. */
|
|
419
|
+
export function ReplacedSectionKeys(metadata) {
|
|
420
|
+
const out = [];
|
|
421
|
+
for (const raw of [metadata?.replacesSectionKey, ...(metadata?.replacesSectionKeys ?? [])]) {
|
|
422
|
+
const key = raw?.trim();
|
|
423
|
+
if (key && !out.includes(key))
|
|
424
|
+
out.push(key);
|
|
425
|
+
}
|
|
426
|
+
return out;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Field names the winning contributions stand in for, so the form stops drawing them.
|
|
430
|
+
*
|
|
431
|
+
* Separate from {@link ContributionHiddenSectionKeys} because the two hide different
|
|
432
|
+
* things: a section key removes a whole card, a field name removes one input from inside
|
|
433
|
+
* one. The panel that made the claim renders at the top of the section that held those
|
|
434
|
+
* fields, which is the collapsible panel's job — this only says which fields are spoken for.
|
|
435
|
+
*/
|
|
436
|
+
export function ContributionClaimedFieldNames(entityName, relatedEntities, isaChildEntityIDs, registrations) {
|
|
437
|
+
const resolved = ResolveFormContributions({
|
|
438
|
+
EntityName: entityName,
|
|
439
|
+
RelatedEntities: relatedEntities,
|
|
440
|
+
IsaChildEntityIDs: isaChildEntityIDs,
|
|
441
|
+
Registrations: registrations,
|
|
442
|
+
BakedSectionKeys: [],
|
|
443
|
+
ShowRelatedEntities: true,
|
|
444
|
+
});
|
|
445
|
+
const names = [];
|
|
446
|
+
for (const winner of resolved.Winners) {
|
|
447
|
+
if (winner.Kind !== 'registered')
|
|
448
|
+
continue;
|
|
449
|
+
for (const name of winner.ReplacesFieldNames ?? []) {
|
|
450
|
+
if (!names.includes(name))
|
|
451
|
+
names.push(name);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return names;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* `DisplayInForm` relationships that can appear on the parent form (IS-A
|
|
458
|
+
* children excluded), in Sequence order — the same peer set
|
|
459
|
+
* {@link ResolveFormContributions} and {@link CreateRelatedEntitySectionKeyResolver} use.
|
|
460
|
+
*/
|
|
461
|
+
export function VisibleFormRelationships(related, isaChildIds) {
|
|
462
|
+
return visibleRelationships(related, isaChildIds);
|
|
463
|
+
}
|
|
286
464
|
//# sourceMappingURL=form-contribution.js.map
|