@memberjunction/ng-base-forms 6.2.0-edge.5 → 6.2.0-edge.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +195 -2
- package/dist/lib/apply/form-placement-preview.component.d.ts.map +1 -1
- package/dist/lib/apply/form-placement-preview.component.js +1 -0
- package/dist/lib/apply/form-placement-preview.component.js.map +1 -1
- package/dist/lib/base-form-component.d.ts +23 -1
- package/dist/lib/base-form-component.d.ts.map +1 -1
- package/dist/lib/base-form-component.js +54 -10
- package/dist/lib/base-form-component.js.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.d.ts +52 -0
- package/dist/lib/chrome/form-composition-snapshot.d.ts.map +1 -1
- package/dist/lib/chrome/form-composition-snapshot.js +4 -0
- package/dist/lib/chrome/form-composition-snapshot.js.map +1 -1
- package/dist/lib/container/record-form-container.component.d.ts +107 -1
- package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
- package/dist/lib/container/record-form-container.component.js +1495 -316
- package/dist/lib/container/record-form-container.component.js.map +1 -1
- package/dist/lib/field/form-field.component.d.ts +159 -14
- package/dist/lib/field/form-field.component.d.ts.map +1 -1
- package/dist/lib/field/form-field.component.js +1360 -469
- package/dist/lib/field/form-field.component.js.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.d.ts +124 -0
- package/dist/lib/form-record-refresh.coordinator.d.ts.map +1 -1
- package/dist/lib/form-record-refresh.coordinator.js +93 -13
- package/dist/lib/form-record-refresh.coordinator.js.map +1 -1
- package/dist/lib/host/entity-form-host.component.d.ts +104 -2
- package/dist/lib/host/entity-form-host.component.d.ts.map +1 -1
- package/dist/lib/host/entity-form-host.component.js +272 -34
- package/dist/lib/host/entity-form-host.component.js.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -1
- package/dist/lib/interactive-form/interactive-form.component.js +1 -0
- package/dist/lib/interactive-form/interactive-form.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-card.component.js +7 -4
- package/dist/lib/isa-related-panel/isa-related-card.component.js.map +1 -1
- package/dist/lib/isa-related-panel/isa-related-panel.component.js +1 -2
- package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
- package/dist/lib/links/record-link-utils.d.ts +83 -0
- package/dist/lib/links/record-link-utils.d.ts.map +1 -0
- package/dist/lib/links/record-link-utils.js +232 -0
- package/dist/lib/links/record-link-utils.js.map +1 -0
- package/dist/lib/links/record-link.component.d.ts +50 -0
- package/dist/lib/links/record-link.component.d.ts.map +1 -0
- package/dist/lib/links/record-link.component.js +319 -0
- package/dist/lib/links/record-link.component.js.map +1 -0
- package/dist/lib/links/record-link.directive.d.ts +94 -0
- package/dist/lib/links/record-link.directive.d.ts.map +1 -0
- package/dist/lib/links/record-link.directive.js +277 -0
- package/dist/lib/links/record-link.directive.js.map +1 -0
- package/dist/lib/links/record-links-drawer.component.d.ts +21 -0
- package/dist/lib/links/record-links-drawer.component.d.ts.map +1 -0
- package/dist/lib/links/record-links-drawer.component.js +61 -0
- package/dist/lib/links/record-links-drawer.component.js.map +1 -0
- package/dist/lib/links/record-links.component.d.ts +255 -0
- package/dist/lib/links/record-links.component.d.ts.map +1 -0
- package/dist/lib/links/record-links.component.js +1546 -0
- package/dist/lib/links/record-links.component.js.map +1 -0
- package/dist/lib/panel-slot/form-field-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js +3 -1
- package/dist/lib/panel-slot/form-field-panel-slot.component.js.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -1
- package/dist/lib/panel-slot/form-panel-slot.component.js +6 -0
- package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -1
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts +194 -0
- package/dist/lib/preview-popover/record-preview-popover.component.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js +1084 -0
- package/dist/lib/preview-popover/record-preview-popover.component.js.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts +105 -0
- package/dist/lib/preview-popover/record-preview-popover.service.d.ts.map +1 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js +278 -0
- package/dist/lib/preview-popover/record-preview-popover.service.js.map +1 -0
- package/dist/lib/resolver/form-resolver.service.d.ts +44 -1
- package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -1
- package/dist/lib/resolver/form-resolver.service.js +51 -3
- package/dist/lib/resolver/form-resolver.service.js.map +1 -1
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts +21 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js +90 -0
- package/dist/lib/toolbar/actions/record-links-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts +189 -0
- package/dist/lib/toolbar/base-form-toolbar-action.d.ts.map +1 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js +274 -0
- package/dist/lib/toolbar/base-form-toolbar-action.js.map +1 -0
- package/dist/lib/toolbar/form-toolbar.component.d.ts +21 -1
- package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
- package/dist/lib/toolbar/form-toolbar.component.js +295 -195
- package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts +1 -1
- package/dist/lib/types/form-toolbar-item.d.ts.map +1 -1
- package/dist/lib/types/form-toolbar-item.js.map +1 -1
- package/dist/lib/types/toolbar-config.d.ts +4 -0
- package/dist/lib/types/toolbar-config.d.ts.map +1 -1
- package/dist/lib/types/toolbar-config.js +6 -0
- package/dist/lib/types/toolbar-config.js.map +1 -1
- package/dist/module.d.ts +19 -14
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +39 -6
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +9 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +9 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +20 -20
package/README.md
CHANGED
|
@@ -20,13 +20,16 @@ per-surface code and no regeneration.
|
|
|
20
20
|
| Area | Key exports | Notes |
|
|
21
21
|
|------|-------------|-------|
|
|
22
22
|
| **Form base** | `BaseFormComponent`, `BaseFormSectionComponent`, `MjRecordFormContainerComponent`, `MjCollapsiblePanelComponent`, `MjFormFieldComponent` | The form itself + its toolbar/section container. Generated forms extend `BaseFormComponent`. |
|
|
23
|
-
| **Form host** | `MjEntityFormHostComponent` (`<mj-entity-form-host>`) | Presentation-agnostic: resolve → load → create → bind → re-emit → teardown. Supports full forms and single sections (`SectionName`). |
|
|
23
|
+
| **Form host** | `MjEntityFormHostComponent` (`<mj-entity-form-host>`) | Presentation-agnostic: resolve → load → create → bind → re-emit → teardown. Supports full forms and single sections (`SectionName`). Standard-form switch: `FormMode`, `ShowFormModeSwitch`, `FormModeChange`, `SwitchFormMode()` — see [Standard-form switch](#standard-form-switch). |
|
|
24
24
|
| **Overlay shells** | `MjFormDialogComponent`, `MjFormSlideInComponent`, `MjFormWindowComponent` (standalone) | Declarative dialog / slide-in / floating-window around the host. |
|
|
25
25
|
| **Imperative API** | `MJFormPresenterService.Open(...)` → `MJFormRef` | One call to open any form on any surface. |
|
|
26
26
|
| **Per-instance config** | `EntityFormConfig` + `TAB_/DIALOG_/SLIDEIN_FORM_CONFIG` | Toolbar / related sections / collapsibility / width / record-links. Applied via the form reference — **no regeneration**. |
|
|
27
|
-
| **Form resolution** | `FormResolverService` | Picks generated / custom / interactive-override form + variants (cached via `InteractiveFormsEngine`). |
|
|
27
|
+
| **Form resolution** | `FormResolverService` | Picks generated / custom / interactive-override form + variants (cached via `InteractiveFormsEngine`). `FormResolution.standard`, `ResolveStandardForm()` and `HasStandardFormAlternative()` expose the generated form a custom one hides. |
|
|
28
28
|
| **Form extension** | `BaseFormPanel` + `<mj-form-panel-slot>` + `<mj-form-contributions>` | Inject custom sections; claim a related-entity grid; fill in unbaked `DisplayInForm` relationships. See [PANELS.md](./PANELS.md) and [`/plans/form-contributions.md`](../../../../plans/form-contributions.md). |
|
|
29
29
|
| **Form chrome** | `ResolveFormChrome`, `BaseFormPolicy`, `MJ: Form Chrome Rules` | L0–L4 stack: inclusion, Auto ranker, install overlay, user order. Policy is cosmetics only. Left-nav related grids fill leftover column height (`display: contents` on slot hosts; no accordion pixel pin). `SetSectionRowCount` upserts so contribution badges appear. Section search matches title/`MatchesSearch`, not `IsVisible`. See [Forms Architecture §7d](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7d-form-chrome--accordion-left-nav-and-more). |
|
|
30
|
+
| **Pluggable toolbar actions** | `BaseFormToolbarAction`, `@RegisterFormToolbarAction`, `RecordLinksToolbarAction`, `ResolveFormToolbarActionsForEntity` | Register toolbar buttons with `EntityScope` (`'*'`, exact entity, glob wildcard, `schema:*`, or array) and lifecycle hooks (`IsApplicable`, `OnInit`, `OnPrewarm`, `OnPinStateChanged`, `OnRecordSaved`, `OnRecordRefreshed`, `OnExecute`, `OnDestroy`). Supports subclassing & prototype-chain metadata inheritance. See [Pluggable toolbar actions](#pluggable-toolbar-actions) and [Forms Architecture §7e](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7e-pluggable-form-toolbar-actions-baseformtoolbaraction--registerformtoolbaraction). |
|
|
31
|
+
| **Record links & hover cards** | `MjRecordLinksComponent` (`<mj-record-links>`), `MjRecordPreviewPopoverComponent` (`<mj-record-preview-popover>`), `MjRecordPreviewDirective` (`[mjRecordPreview]`) | Bidirectional record links drawer (outbound FKs, inbound related entities, polymorphic links) with pin-aware pre-warming and Sage `LinksSummary` context; hover preview cards on read-mode FK links. See [Forms Architecture §7f](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7f-bidirectional-record-links-mj-record-links--hover-preview-cards-mj-record-preview-popover). |
|
|
32
|
+
| **Time-travel version preview** | `MjRecordFormContainerComponent` (`ActiveVersionPreview`, `OnPreviewVersionSelected`, `OnStepVersionPreview`, `OnExitVersionPreview`), `FormSlotCoordinator.VersionPreviewChanged$` | Rehydrates historical `FullRecordJSON` + `ChangesJSON` snapshots directly inside the form with a top Time-Travel Scrubber Bar and changed-field jump chips. See [Forms Architecture §7g](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7g-in-form-time-travel-version-preview--record-changes-activity-sparkline). |
|
|
30
33
|
| **New-record defaults** | `BaseFormComponent.NewRecordValues` / `NewRecordValuesForJoinFields` | Related grids copy every join field onto the child. Explorer persists them as `/record/:entity/new?NewRecordValues=...`. |
|
|
31
34
|
|
|
32
35
|
## Quick start
|
|
@@ -48,9 +51,199 @@ const saved = await ref.AfterSaved(); // BaseEntity | null
|
|
|
48
51
|
[(Visible)]="show" (Saved)="onSaved($event)"></mj-form-dialog>
|
|
49
52
|
```
|
|
50
53
|
|
|
54
|
+
## Standard-form switch
|
|
55
|
+
|
|
56
|
+
A custom class form registered at a higher priority, or an active interactive
|
|
57
|
+
override (`EntityFormOverride`), hides the CodeGen-generated form for its
|
|
58
|
+
entity. Before MJ#4755 the generated form was unreachable — even a hand-built
|
|
59
|
+
record URL resolved to the custom form — and an entity whose custom form only
|
|
60
|
+
handles existing records had no way to create one.
|
|
61
|
+
|
|
62
|
+
`<mj-entity-form-host>` now shows a slim "Open standard form" / "Back to custom
|
|
63
|
+
view" strip whenever a custom form hides the generated one. Entities whose only
|
|
64
|
+
registration is the generated form (the common case) get no strip.
|
|
65
|
+
|
|
66
|
+
| Member | Kind | Purpose |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `FormMode: EntityFormMode` | `@Input` | `'default'` (the resolver's normal pick) or `'standard'` (the generated form). A change after the view initializes reloads the form and does **not** emit `FormModeChange`. If the entity has no standard form, the host falls back to the default and logs. |
|
|
69
|
+
| `ShowFormModeSwitch = true` | `@Input` | Set `false` to hide the strip; `FormMode` is still honoured. |
|
|
70
|
+
| `FormModeChange: EventEmitter<EntityFormMode>` | `@Output` | Emits when the mode changes from inside the host — the strip, `SwitchFormMode()`, or picking an interactive variant (which returns to `'default'`) — so the surface can persist it. |
|
|
71
|
+
| `SwitchFormMode(mode): boolean` | method | Switch programmatically. Returns `false` when refused (see below), `true` otherwise (including when already in `mode`). |
|
|
72
|
+
|
|
73
|
+
**What "standard" means.** The standard form is the **lowest-priority**
|
|
74
|
+
`BaseFormComponent` registration for the entity
|
|
75
|
+
(`FormResolverService.ResolveStandardForm`). CodeGen registers its form with no
|
|
76
|
+
explicit priority, and a custom form either declares a higher one or extends the
|
|
77
|
+
generated class (so it registers later and gets a higher auto priority).
|
|
78
|
+
`HasStandardFormAlternative(resolution)` is true only when that form exists and
|
|
79
|
+
is not the one already mounted.
|
|
80
|
+
|
|
81
|
+
**Unsaved work is never discarded.** A switch remounts the form, so the host
|
|
82
|
+
refuses it — returning `false` and emitting a `warning` `Notification` — when:
|
|
83
|
+
|
|
84
|
+
- a **saved** record is dirty (`record.IsSaved && record.Dirty`), or
|
|
85
|
+
- the form holds unsaved work outside the record's own fields
|
|
86
|
+
(`BaseFormComponent.HasUnsavedChangesBeyondRecord`: pending related-record
|
|
87
|
+
edits/deletes or `HasAdditionalUnsavedChanges`), for new and saved records alike.
|
|
88
|
+
|
|
89
|
+
**A new record keeps its values.** An unsaved new record (with no other pending
|
|
90
|
+
work) switches freely: the live record instance is carried into the other form,
|
|
91
|
+
so fields already typed survive the switch.
|
|
92
|
+
|
|
93
|
+
**Permissions are unchanged.** The standard form enforces the same entity
|
|
94
|
+
permissions as any other form; switching grants nothing.
|
|
95
|
+
|
|
96
|
+
**In Explorer** the mode lives in the record tab's `form` query param
|
|
97
|
+
(`?form=standard`), which is the source of truth. `NavigationOptions.formMode`,
|
|
98
|
+
a `?form=standard` deep link, back/forward and tab re-focus all reach the
|
|
99
|
+
mounted record through `OnQueryParamsChanged`, which switches via
|
|
100
|
+
`SwitchFormMode` (so the unsaved-work guard still applies; a refused switch
|
|
101
|
+
writes the on-screen mode back to the URL). A strip switch writes the param
|
|
102
|
+
back, so the URL records the requested mode, and a record URL without `form`
|
|
103
|
+
means the default form. (When the entity has no standard form, the host falls
|
|
104
|
+
back to the default form even if `form=standard` is requested.)
|
|
105
|
+
|
|
106
|
+
## Pluggable toolbar actions
|
|
107
|
+
|
|
108
|
+
Toolbar buttons in `<mj-form-toolbar>` are extensible through **`BaseFormToolbarAction`** and **`@RegisterFormToolbarAction(metadata, priority?)`**.
|
|
109
|
+
|
|
110
|
+
### 1. Registering a new toolbar action
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import {
|
|
114
|
+
BaseFormToolbarAction,
|
|
115
|
+
RegisterFormToolbarAction,
|
|
116
|
+
type FormToolbarActionLifecycleContext,
|
|
117
|
+
} from '@memberjunction/ng-base-forms';
|
|
118
|
+
|
|
119
|
+
@RegisterFormToolbarAction({
|
|
120
|
+
Key: 'audit-verify',
|
|
121
|
+
MenuLabel: 'Verify Record',
|
|
122
|
+
Tooltip: 'Run verification checks',
|
|
123
|
+
Icon: 'fa-solid fa-circle-check',
|
|
124
|
+
EntityScope: ['MJ_BizApps_Common: People', 'MJ_BizApps_Orders:*'], // '*', exact name, glob, 'schema:x', or string[]
|
|
125
|
+
Order: 50,
|
|
126
|
+
Pinnable: true,
|
|
127
|
+
Mode: 'action', // 'action' | 'toggle-drawer'
|
|
128
|
+
})
|
|
129
|
+
export class VerifyRecordToolbarAction extends BaseFormToolbarAction {
|
|
130
|
+
public override async OnPrewarm(ctx: FormToolbarActionLifecycleContext): Promise<void> {
|
|
131
|
+
if (!ctx.IsPinned) return; // Avoid background queries unless pinned to the toolbar
|
|
132
|
+
ctx.SetBadge('✓');
|
|
133
|
+
ctx.RequestChangeDetection();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public override async OnExecute(ctx: FormToolbarActionLifecycleContext): Promise<void> {
|
|
137
|
+
// Handle button click
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Subclassing & overriding an existing toolbar button
|
|
143
|
+
|
|
144
|
+
You can subclass an existing toolbar action plugin (such as `RecordLinksToolbarAction`) to override it either globally (`EntityScope: '*'`) or for specific entities.
|
|
145
|
+
|
|
146
|
+
- **Prototype metadata inheritance**: `ResolveFormToolbarActionsForEntity` walks the prototype chain and merges ancestor registration metadata (`{ ...ancestorMetadata, ...childMetadata }`). You only need to declare the properties you are overriding (`Key`, `Icon`, `Order`, `Pinnable`, and `Mode` are inherited automatically).
|
|
147
|
+
- **3-tier winner resolution per `Key`**:
|
|
148
|
+
1. A subclass (`Sub.prototype instanceof Super`) always overrides its superclass.
|
|
149
|
+
2. An entity-specific `EntityScope` overrides a global (`'*'`) scope of equal priority.
|
|
150
|
+
3. Higher ClassFactory `Priority` wins.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import {
|
|
154
|
+
RecordLinksToolbarAction,
|
|
155
|
+
RegisterFormToolbarAction,
|
|
156
|
+
} from '@memberjunction/ng-base-forms';
|
|
157
|
+
|
|
158
|
+
@RegisterFormToolbarAction({
|
|
159
|
+
EntityScope: 'MJ_BizApps_Common: People',
|
|
160
|
+
MenuLabel: 'Person Graph',
|
|
161
|
+
})
|
|
162
|
+
export class PersonLinksToolbarAction extends RecordLinksToolbarAction {
|
|
163
|
+
// Inherits Key: 'links', Icon, Order, Pinnable, and Mode from RecordLinksToolbarAction
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Declarative Record Links (`[mjRecordLink]` & `<mj-record-link>`)
|
|
168
|
+
|
|
169
|
+
Any custom form header, `BaseFormPanel`, or dashboard widget can attach MemberJunction's full record-linking UX (hover-intent `<mj-record-preview-popover>`, inline Quick Edit with live propagation back to virtual display fields on `Record`, standard + polymorphic FK resolution, and click/Ctrl+Click `FormNavigationEvent` navigation) using `[mjRecordLink]` or `<mj-record-link>`:
|
|
170
|
+
|
|
171
|
+
### 1. Field-Driven Mode (`[mjRecordLink]="Record" FieldName="..."`)
|
|
172
|
+
|
|
173
|
+
Resolves the target entity, primary key, and companion virtual display column (e.g., `CurrentOrganizationName`) directly from `Record.EntityInfo.Fields` metadata (supporting both standard `RelatedEntity` FKs and polymorphic `EntityIDFieldName` pairs):
|
|
174
|
+
|
|
175
|
+
```html
|
|
176
|
+
<button
|
|
177
|
+
type="button"
|
|
178
|
+
class="biz-hero__stat-val"
|
|
179
|
+
[mjRecordLink]="Record"
|
|
180
|
+
FieldName="CurrentOrganizationID"
|
|
181
|
+
(Navigate)="Navigate.emit($event)">
|
|
182
|
+
{{ Record.CurrentOrganizationName }}
|
|
183
|
+
</button>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 2. Direct Mode (`mjRecordLink [EntityName]="..." [RecordID]="..."`)
|
|
187
|
+
|
|
188
|
+
Use when linking from a custom projection, DTO, or list row where no `BaseEntity` field metadata is involved:
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<button
|
|
192
|
+
type="button"
|
|
193
|
+
mjRecordLink
|
|
194
|
+
[EntityName]="'MJ_BizApps_Common: People'"
|
|
195
|
+
[RecordID]="row.PersonID"
|
|
196
|
+
[DisplayName]="row.PersonName"
|
|
197
|
+
(Navigate)="Navigate.emit($event)">
|
|
198
|
+
{{ row.PersonName }}
|
|
199
|
+
</button>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 3. Ready-Made `<mj-record-link>` Component
|
|
203
|
+
|
|
204
|
+
Renders an inline hyperlink, pill chip (`Variant="chip"`), or link box (`Variant="box"`) and automatically resolves the target record's display name via `GetEntityRecordName` when `DisplayName` is omitted:
|
|
205
|
+
|
|
206
|
+
```html
|
|
207
|
+
<mj-record-link
|
|
208
|
+
[Record]="Record"
|
|
209
|
+
FieldName="CurrentOrganizationID"
|
|
210
|
+
Variant="chip"
|
|
211
|
+
(Navigate)="Navigate.emit($event)">
|
|
212
|
+
</mj-record-link>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 4. Pluggable Hover Preview Card (`MjRecordPreviewPopoverComponent` & `@RegisterClass`)
|
|
216
|
+
|
|
217
|
+
The singleton `MjRecordPreviewPopoverService` mounts a single `<mj-record-preview-popover>` at `document.body` featuring the **Option A** UX:
|
|
218
|
+
- **Header action micro-cluster**: Copyable compact Record ID (`9FAF60…C577`), Quick Edit (`[✎]`), and Open in New Tab (`[↗]`) sit in the top-right header.
|
|
219
|
+
- **Clickable record title**: Clicking the record title (`Mathieu Grantham →`) navigates directly to the record (`Ctrl`/`Cmd`-click or middle-click opens in a new tab), eliminating redundant bottom buttons in Read mode.
|
|
220
|
+
- **Auto-spanning wide fields**: Wide values (`Email`, `URL`, `Title`, or values `> 22` characters) automatically span both columns (`grid-column: 1 / -1`) so they never truncate prematurely.
|
|
221
|
+
- **Contextual Quick Edit footer & cancellable save event**: Entering Quick Edit reveals a slim `Cancel` / `Save` footer bar and emits `BeforeQuickEditSave` (cancellable via `args.Cancel = true`) and `AfterQuickEditSaved` / `RecordUpdated`.
|
|
222
|
+
|
|
223
|
+
You can subclass `MjRecordPreviewPopoverComponent` and register your custom preview card with `@RegisterClass` so `MjRecordPreviewPopoverService` instantiates your subclass dynamically via `MJGlobal.Instance.ClassFactory`:
|
|
224
|
+
|
|
225
|
+
- **Global override (all entities)**: `@RegisterClass(MjRecordPreviewPopoverComponent)`
|
|
226
|
+
- **Schema or wildcard override**: `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common:*')` or `@RegisterClass(MjRecordPreviewPopoverComponent, 'schema:mj_bizapps_common')`
|
|
227
|
+
- **Entity-specific override**: `@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common: People')`
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
231
|
+
import { EntityFieldInfo, EntityInfo } from '@memberjunction/core';
|
|
232
|
+
import { MjRecordPreviewPopoverComponent } from '@memberjunction/ng-base-forms';
|
|
233
|
+
|
|
234
|
+
@RegisterClass(MjRecordPreviewPopoverComponent, 'MJ_BizApps_Common: People')
|
|
235
|
+
export class CustomPersonPreviewPopoverComponent extends MjRecordPreviewPopoverComponent {
|
|
236
|
+
protected override selectPreviewFields(entityInfo: EntityInfo): EntityFieldInfo[] {
|
|
237
|
+
// Customize which summary fields appear on the People hover card
|
|
238
|
+
return super.selectPreviewFields(entityInfo);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
51
243
|
## Related docs
|
|
52
244
|
|
|
53
245
|
- **Architecture (read first):** [/guides/FORMS_ARCHITECTURE_GUIDE.md](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md)
|
|
54
246
|
- **Inject custom sections into a form:** [PANELS.md](./PANELS.md)
|
|
55
247
|
- **Form chrome (rail / More / inclusion):** [Forms Architecture §7d](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7d-form-chrome--accordion-left-nav-and-more)
|
|
248
|
+
- **Pluggable toolbar actions & Record Links:** [Forms Architecture §7e–§7g](../../../../guides/FORMS_ARCHITECTURE_GUIDE.md#7e-pluggable-form-toolbar-actions-baseformtoolbaraction--registerformtoolbaraction)
|
|
56
249
|
- **Custom-form override + toolbar pattern:** [packages/Angular/CLAUDE.md](../../CLAUDE.md)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-placement-preview.component.d.ts","sourceRoot":"","sources":["../../../src/lib/apply/form-placement-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAA4C,YAAY,EAAiB,SAAS,EAElG,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAsC,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;;AAUpE;;;;;;;;;;;GAWG;A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AO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,gBAAgB,CAAiC;IACzD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,aAAa,CAAM;IAC3B,yEAAyE;IACzE,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAE1C,eAAe,IAAI,IAAI;IAavB,WAAW,IAAI,IAAI;IAQnB,QAAQ,IAAI,IAAI;IAMhB,WAAW,IAAI,IAAI;IAI1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAS1B,oEAAoE;YACtD,aAAa;IAmB3B;;;OAGG;YACW,YAAY;
|
|
1
|
+
{"version":3,"file":"form-placement-preview.component.d.ts","sourceRoot":"","sources":["../../../src/lib/apply/form-placement-preview.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EAA4C,YAAY,EAAiB,SAAS,EAElG,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAsC,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;;AAUpE;;;;;;;;;;;GAWG;AACH,qBAUa,+BAAgC,SAAQ,oBAAqB,YAAW,aAAa,EAAE,SAAS;IACzG;;;OAGG;IACH,gBAAuB,eAAe,QAAQ;IAE9C,sFAAsF;IACtF,OAAO,CAAC,MAAM,CAAC,QAAQ,C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/D,OAAO,CAAC,SAAS,CAA8C;IAC/D,OAAO,CAAC,aAAa,CAAM;IAC3B,yEAAyE;IACzE,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAE1C,eAAe,IAAI,IAAI;IAavB,WAAW,IAAI,IAAI;IAQnB,QAAQ,IAAI,IAAI;IAMhB,WAAW,IAAI,IAAI;IAI1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAS1B,oEAAoE;YACtD,aAAa;IAmB3B;;;OAGG;YACW,YAAY;IAyB1B;;;OAGG;IACH,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,eAAe;IAQvB,mGAAmG;IACnG,OAAO,CAAC,OAAO;IAmBf;;;;;OAKG;IACH,OAAO,CAAC,WAAW;yCAlPV,+BAA+B;2CAA/B,+BAA+B;CA0P3C"}
|
|
@@ -210,6 +210,7 @@ export class MjFormPlacementPreviewComponent extends BaseAngularComponent {
|
|
|
210
210
|
Fields: nameField && !keyFields.includes(nameField) ? [...keyFields, nameField] : keyFields,
|
|
211
211
|
OrderBy: nameField ? `${nameField} ASC` : '__mj_CreatedAt DESC',
|
|
212
212
|
MaxRows: 1,
|
|
213
|
+
SkipTotalRowCount: true,
|
|
213
214
|
ResultType: 'simple',
|
|
214
215
|
}, provider.CurrentUser);
|
|
215
216
|
const row = result.Success ? result.Results?.[0] : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-placement-preview.component.js","sourceRoot":"","sources":["../../../src/lib/apply/form-placement-preview.component.ts","../../../src/lib/apply/form-placement-preview.component.html"],"names":[],"mappings":"AAAA,OAAO,EACY,iBAAiB,EAAE,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAa,MAAM,EACvG,SAAS,EAAE,MAAM,GACpB,MAAM,eAAe,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,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnE,CAAC;ySAxPQ,+BAA+B,yBAA/B,+BAA+B;6DAA/B,+BAA+B;;;;;;4RAL7B;gBACP,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,oBAAoB,EAAE,EAAE;gBACjF,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE;aAC9D;YCvCL,+FAAmB;YAIjB,AADF,iCAAsE,gBAGpB;YAC9C,iHAAsB;YAaxB,iBAAM;YAEN,iGAAe;YAKjB,iBAAM;;YA3BN,0CAEC;YACqC,cAA+B;YAA/B,+CAA+B;YAE9D,eAA6B;YAC7B,AADA,6CAA6B,yCACa;YAC7C,eAYC;YAZD,6CAYC;YAGH,cAIC;YAJD,sCAIC;;;iFDeU,+BAA+B;cAV3C,SAAS;6BACM,KAAK,YACP,2BAA2B,aAG1B;oBACP,EAAE,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,oBAAoB,EAAE,EAAE;oBACjF,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,gBAAgB,EAAE;iBAC9D;;kBAeA,KAAK;;kBAaL,KAAK;;kBAOL,KAAK;;kBAOL,KAAK;;kBAOL,KAAK;;kBAOL,KAAK;;kBAOL,MAAM;;kBAEN,SAAS;mBAAC,UAAU,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kBACtC,SAAS;mBAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAhE3B,+BAA+B","sourcesContent":["import {\n AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, NgZone, OnDestroy, Output,\n ViewChild, inject,\n} from '@angular/core';\nimport { CompositeKey, LogError, RunView, type EntityInfo } from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport type { FormContributionSpec } from '@memberjunction/interactive-component-types/forms';\nimport type { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { FORM_PLACEMENT_PREVIEW, FormPlacementPreview } from '../panel-slot/placement-preview';\nimport type { EntityFormConfig } from '../types/entity-form-config';\nimport { FormStateService } from '../form-state.service';\n\n/** A form state of its own for the preview, kept in memory, so the user's real form is untouched. */\nfunction previewFormState(): FormStateService {\n const state = new FormStateService();\n state.Persist = false;\n return state;\n}\n\n/**\n * The entity's real form, scaled down, with the placement dialog's panel drawn on it.\n *\n * The form is rendered by the same host every other surface uses, with a\n * {@link FormPlacementPreview} provided to it, so the form itself places the unsaved panel,\n * hides what it replaces and gives it a rail item.\n *\n * Read-only: the form is `inert` and every answer is made in the dialog's controls. The form\n * shows the rail tab the panel is on; the preview scrolls to it. It has a form state of its own,\n * held in memory, so opening that tab and its sections changes neither the user's saved form state\n * nor the real form open behind the dialog.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-placement-preview',\n templateUrl: './form-placement-preview.component.html',\n styleUrls: ['./form-placement-preview.component.css'],\n providers: [\n { provide: FORM_PLACEMENT_PREVIEW, useFactory: () => new FormPlacementPreview() },\n { provide: FormStateService, useFactory: previewFormState },\n ],\n})\nexport class MjFormPlacementPreviewComponent extends BaseAngularComponent implements AfterViewInit, OnDestroy {\n /**\n * The narrowest width the form is laid out at. A narrower column shows it scaled down; a\n * wider one shows it at its real size, never enlarged.\n */\n public static readonly MIN_STAGE_WIDTH = 1100;\n\n /** A form that never finishes loading must not leave the dialog without a preview. */\n private static readonly LOAD_TIMEOUT_MS = 10000;\n\n /** How long the answers must be still before the panel is redrawn. */\n private static readonly REDRAW_DELAY_MS = 150;\n\n @Input()\n set EntityName(value: string) {\n const changed = value !== this._entityName;\n this._entityName = value;\n this.showSpec();\n if (changed) this.queueResolveRecord();\n }\n get EntityName(): string { return this._entityName; }\n\n /**\n * The record to show. Null shows a sample: the entity's first record, as Form Builder's\n * preview picks it, or a new empty record when the entity has none.\n */\n @Input()\n set RecordKey(value: CompositeKey | null) {\n this._recordKey = value;\n this.queueResolveRecord();\n }\n\n /** The panel to draw on the form. */\n @Input()\n set Spec(value: FormContributionSpec | null) {\n this._spec = value;\n this.showSpec();\n }\n\n /** The saved row the panel is an edit of, left off the preview. */\n @Input()\n set ReplacesRowID(value: string | null) {\n this._replacesRowID = value;\n this.showSpec();\n }\n\n /** The panel's component, not saved yet. Drawn in place of the placeholder. */\n @Input()\n set PanelComponentSpec(value: ComponentSpec | null) {\n this._componentSpec = value;\n this.showSpec();\n }\n\n /** The saved component of the panel being edited. Drawn in place of the placeholder. */\n @Input()\n set PanelComponentID(value: string | null) {\n this._componentID = value;\n this.showSpec();\n }\n\n /** The form did not render, so the dialog should show its list instead. */\n @Output() Failed = new EventEmitter<void>();\n\n @ViewChild('viewport', { static: true }) private viewport!: ElementRef<HTMLElement>;\n @ViewChild('stage', { static: true }) private stage!: ElementRef<HTMLElement>;\n\n public PrimaryKey = new CompositeKey();\n /** False until the record to show is known, so the form is drawn once, not blank and then again. */\n public RecordResolved = false;\n /** Which record the preview shows, in words. */\n public RecordLabel = '';\n public readonly FormConfig: EntityFormConfig = { Toolbar: null, EnableRecordLinks: false };\n public Scale = 1;\n public StageWidth = MjFormPlacementPreviewComponent.MIN_STAGE_WIDTH;\n public StageHeight = 0;\n public Loaded = false;\n\n private _entityName = '';\n private _recordKey: CompositeKey | null = null;\n private resolveRun = 0;\n private resolveQueued = false;\n private _spec: FormContributionSpec | null = null;\n private _replacesRowID: string | null = null;\n private _componentSpec: ComponentSpec | null = null;\n private _componentID: string | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private frame = 0;\n private loadTimer: ReturnType<typeof setTimeout> | null = null;\n private showTimer: ReturnType<typeof setTimeout> | null = null;\n private sizeSignature = '';\n /** Set after each redraw, until the panel has been brought into view. */\n private revealPending = false;\n\n private readonly preview = inject(FORM_PLACEMENT_PREVIEW);\n private readonly zone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n public ngAfterViewInit(): void {\n this.zone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver(() => this.scheduleMeasure());\n this.resizeObserver.observe(this.viewport.nativeElement);\n this.resizeObserver.observe(this.stage.nativeElement);\n this.mutationObserver = new MutationObserver(() => this.scheduleMeasure());\n this.mutationObserver.observe(this.stage.nativeElement, {\n childList: true, subtree: true, attributes: true, attributeFilter: ['class', 'style', 'hidden'],\n });\n });\n this.loadTimer = setTimeout(() => { if (!this.Loaded) this.Failed.emit(); }, MjFormPlacementPreviewComponent.LOAD_TIMEOUT_MS);\n }\n\n public ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n if (this.frame) cancelAnimationFrame(this.frame);\n if (this.loadTimer) clearTimeout(this.loadTimer);\n if (this.showTimer) clearTimeout(this.showTimer);\n }\n\n public OnLoaded(): void {\n this.Loaded = true;\n if (this.loadTimer) clearTimeout(this.loadTimer);\n this.scheduleMeasure();\n }\n\n public OnLoadError(): void {\n this.Failed.emit();\n }\n\n /**\n * Resolves the record once the current round of input changes is over, so the entity and the\n * record key arriving together look up a sample record once.\n */\n private queueResolveRecord(): void {\n if (this.resolveQueued) return;\n this.resolveQueued = true;\n queueMicrotask(() => {\n this.resolveQueued = false;\n void this.resolveRecord();\n });\n }\n\n /** Settles which record the form shows, then lets the form draw. */\n private async resolveRecord(): Promise<void> {\n const run = ++this.resolveRun;\n this.RecordResolved = false;\n this.Loaded = false;\n const entity = this._entityName ? this.ProviderToUse?.EntityByName(this._entityName) : undefined;\n let key = this._recordKey;\n let label = key ? 'Showing the record you have open' : '';\n if (!key && entity) {\n const sample = await this.sampleRecord(entity);\n if (run !== this.resolveRun) return;\n key = sample?.Key ?? null;\n label = sample ? `Showing ${sample.Label}, a sample record` : 'Showing a new, empty record — this entity has no records yet';\n }\n this.PrimaryKey = key ?? new CompositeKey();\n this.RecordLabel = label;\n this.RecordResolved = !!this._entityName;\n this.cdr.markForCheck();\n }\n\n /**\n * The entity's first record, ordered the way Form Builder's preview orders it: by name when\n * the entity has a name field, so every user sees the same one, else newest first.\n */\n private async sampleRecord(entity: EntityInfo): Promise<{ Key: CompositeKey; Label: string } | null> {\n const provider = this.ProviderToUse;\n if (!provider) return null;\n const nameField = entity.NameField?.Name;\n const keyFields = entity.PrimaryKeys.map((pk) => pk.Name);\n try {\n const result = await RunView.FromMetadataProvider(provider).RunView<Record<string, unknown>>({\n EntityName: entity.Name,\n Fields: nameField && !keyFields.includes(nameField) ? [...keyFields, nameField] : keyFields,\n OrderBy: nameField ? `${nameField} ASC` : '__mj_CreatedAt DESC',\n MaxRows: 1,\n ResultType: 'simple',\n }, provider.CurrentUser);\n const row = result.Success ? result.Results?.[0] : undefined;\n if (!row) return null;\n const key = CompositeKey.FromEntityRecord(entity, row);\n const name = nameField ? String(row[nameField] ?? '').trim() : '';\n return { Key: key, Label: name ? `“${name}”` : 'the first record' };\n } catch (err) {\n LogError(`MjFormPlacementPreviewComponent: sample record for ${entity.Name} failed: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n }\n\n /**\n * Redraws the panel on the form, shortly after the last change. Each redraw remounts the\n * panel's component, so typing a label must not remount it on every key.\n */\n private showSpec(): void {\n if (this.showTimer) clearTimeout(this.showTimer);\n this.showTimer = setTimeout(() => {\n this.showTimer = null;\n const component = this._componentSpec || this._componentID\n ? { Spec: this._componentSpec, ComponentID: this._componentID }\n : null;\n this.preview.Show(this.EntityName, this._spec, this._replacesRowID, component);\n this.revealPending = true;\n this.scheduleMeasure();\n }, MjFormPlacementPreviewComponent.REDRAW_DELAY_MS);\n }\n\n private scheduleMeasure(): void {\n if (this.frame) return;\n this.frame = requestAnimationFrame(() => {\n this.frame = 0;\n this.measure();\n });\n }\n\n /** Fit the stage to the viewport, then keep the panel in view. Enters Angular only on a change. */\n private measure(): void {\n const viewport = this.viewport.nativeElement;\n const stage = this.stage.nativeElement;\n const available = viewport.clientWidth;\n const width = available > 0 ? Math.max(MjFormPlacementPreviewComponent.MIN_STAGE_WIDTH, available) : this.StageWidth;\n const scale = available > 0 ? available / width : this.Scale;\n const height = stage.offsetHeight * scale;\n if (this.Loaded && this.revealPending) this.revealPanel(stage);\n const signature = `${width}|${scale}|${height}`;\n if (signature === this.sizeSignature) return;\n this.sizeSignature = signature;\n this.zone.run(() => {\n this.StageWidth = width;\n this.Scale = scale;\n this.StageHeight = height;\n this.cdr.markForCheck();\n });\n }\n\n /**\n * Scrolls the panel into view once it draws after a redraw.\n *\n * On a form with a side rail the form itself shows the tab that holds the panel; this only\n * waits for it to draw and then brings it into view.\n */\n private revealPanel(stage: HTMLElement): void {\n const panel = stage.querySelector<HTMLElement>('[data-placement-preview]');\n if (!panel) return;\n const box = (panel.querySelector('mj-collapsible-panel') ?? panel).getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return;\n this.revealPending = false;\n panel.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }\n}\n","@if (RecordLabel) {\n <p class=\"mj-pp-record\"><i class=\"fa-solid fa-eye\" aria-hidden=\"true\"></i> {{ RecordLabel }}</p>\n}\n<div class=\"mj-pp-viewport\" #viewport [style.height.px]=\"StageHeight\">\n <div class=\"mj-pp-stage\" #stage inert\n [style.width.px]=\"StageWidth\"\n [style.transform]=\"'scale(' + Scale + ')'\">\n @if (RecordResolved) {\n <!-- Read-only: a preview shows the form as it reads, and an empty required field in\n edit mode would paint the whole form with validation errors. -->\n <mj-entity-form-host\n [Provider]=\"Provider\"\n [EntityName]=\"EntityName\"\n [PrimaryKey]=\"PrimaryKey\"\n [EditMode]=\"false\"\n [Config]=\"FormConfig\"\n (LoadComplete)=\"OnLoaded()\"\n (LoadError)=\"OnLoadError()\">\n </mj-entity-form-host>\n }\n </div>\n\n @if (!Loaded) {\n <div class=\"mj-pp-loading\">\n <mj-loading text=\"Drawing the form…\" size=\"small\"></mj-loading>\n </div>\n }\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"form-placement-preview.component.js","sourceRoot":"","sources":["../../../src/lib/apply/form-placement-preview.component.ts","../../../src/lib/apply/form-placement-preview.component.html"],"names":[],"mappings":"AAAA,OAAO,EACY,iBAAiB,EAAE,SAAS,EAAc,YAAY,EAAE,KAAK,EAAE,MAAM,EAAa,MAAM,EACvG,SAAS,EAAE,MAAM,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAmB,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;ICTvD,4BAAwB;IAAA,uBAAkD;IAAC,YAAiB;IAAA,iBAAI;;;IAArB,eAAiB;IAAjB,8CAAiB;;;;IASxF,8CAO8B;IAA5B,AADA,8NAAgB,iBAAU,KAAC,2MACd,oBAAa,KAAC;IAC7B,iBAAsB;;;IAHpB,AADA,AADA,AADA,AADA,0CAAqB,iCACI,iCACA,mBACP,6BACG;;;IAQzB,8BAA2B;IACzB,gCAA+D;IACjE,iBAAM;;ADbV,qGAAqG;AACrG,SAAS,gBAAgB;IACrB,MAAM,KAAK,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACrC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;GAWG;AAWH,MAAM,OAAO,+BAAgC,SAAQ,oBAAoB;IACrE;;;OAGG;IACI,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IAE9C,sFAAsF;IAC9E,MAAM,CAAU,eAAe,GAAG,KAAK,CAAC;IAEhD,sEAAsE;IAC9D,MAAM,CAAU,eAAe,GAAG,GAAG,CAAC;IAE9C,IACI,UAAU,CAAC,KAAa;QACxB,MAAM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I,EAAE;;kBACtC,SAAS;mBAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;kFAhE3B,+BAA+B","sourcesContent":["import {\n AfterViewInit, ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, NgZone, OnDestroy, Output,\n ViewChild, inject,\n} from '@angular/core';\nimport { CompositeKey, LogError, RunView, type EntityInfo } from '@memberjunction/core';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport type { FormContributionSpec } from '@memberjunction/interactive-component-types/forms';\nimport type { ComponentSpec } from '@memberjunction/interactive-component-types';\nimport { FORM_PLACEMENT_PREVIEW, FormPlacementPreview } from '../panel-slot/placement-preview';\nimport type { EntityFormConfig } from '../types/entity-form-config';\nimport { FormStateService } from '../form-state.service';\n\n/** A form state of its own for the preview, kept in memory, so the user's real form is untouched. */\nfunction previewFormState(): FormStateService {\n const state = new FormStateService();\n state.Persist = false;\n return state;\n}\n\n/**\n * The entity's real form, scaled down, with the placement dialog's panel drawn on it.\n *\n * The form is rendered by the same host every other surface uses, with a\n * {@link FormPlacementPreview} provided to it, so the form itself places the unsaved panel,\n * hides what it replaces and gives it a rail item.\n *\n * Read-only: the form is `inert` and every answer is made in the dialog's controls. The form\n * shows the rail tab the panel is on; the preview scrolls to it. It has a form state of its own,\n * held in memory, so opening that tab and its sections changes neither the user's saved form state\n * nor the real form open behind the dialog.\n */\n@Component({\n standalone: false,\n selector: 'mj-form-placement-preview',\n templateUrl: './form-placement-preview.component.html',\n styleUrls: ['./form-placement-preview.component.css'],\n providers: [\n { provide: FORM_PLACEMENT_PREVIEW, useFactory: () => new FormPlacementPreview() },\n { provide: FormStateService, useFactory: previewFormState },\n ],\n})\nexport class MjFormPlacementPreviewComponent extends BaseAngularComponent implements AfterViewInit, OnDestroy {\n /**\n * The narrowest width the form is laid out at. A narrower column shows it scaled down; a\n * wider one shows it at its real size, never enlarged.\n */\n public static readonly MIN_STAGE_WIDTH = 1100;\n\n /** A form that never finishes loading must not leave the dialog without a preview. */\n private static readonly LOAD_TIMEOUT_MS = 10000;\n\n /** How long the answers must be still before the panel is redrawn. */\n private static readonly REDRAW_DELAY_MS = 150;\n\n @Input()\n set EntityName(value: string) {\n const changed = value !== this._entityName;\n this._entityName = value;\n this.showSpec();\n if (changed) this.queueResolveRecord();\n }\n get EntityName(): string { return this._entityName; }\n\n /**\n * The record to show. Null shows a sample: the entity's first record, as Form Builder's\n * preview picks it, or a new empty record when the entity has none.\n */\n @Input()\n set RecordKey(value: CompositeKey | null) {\n this._recordKey = value;\n this.queueResolveRecord();\n }\n\n /** The panel to draw on the form. */\n @Input()\n set Spec(value: FormContributionSpec | null) {\n this._spec = value;\n this.showSpec();\n }\n\n /** The saved row the panel is an edit of, left off the preview. */\n @Input()\n set ReplacesRowID(value: string | null) {\n this._replacesRowID = value;\n this.showSpec();\n }\n\n /** The panel's component, not saved yet. Drawn in place of the placeholder. */\n @Input()\n set PanelComponentSpec(value: ComponentSpec | null) {\n this._componentSpec = value;\n this.showSpec();\n }\n\n /** The saved component of the panel being edited. Drawn in place of the placeholder. */\n @Input()\n set PanelComponentID(value: string | null) {\n this._componentID = value;\n this.showSpec();\n }\n\n /** The form did not render, so the dialog should show its list instead. */\n @Output() Failed = new EventEmitter<void>();\n\n @ViewChild('viewport', { static: true }) private viewport!: ElementRef<HTMLElement>;\n @ViewChild('stage', { static: true }) private stage!: ElementRef<HTMLElement>;\n\n public PrimaryKey = new CompositeKey();\n /** False until the record to show is known, so the form is drawn once, not blank and then again. */\n public RecordResolved = false;\n /** Which record the preview shows, in words. */\n public RecordLabel = '';\n public readonly FormConfig: EntityFormConfig = { Toolbar: null, EnableRecordLinks: false };\n public Scale = 1;\n public StageWidth = MjFormPlacementPreviewComponent.MIN_STAGE_WIDTH;\n public StageHeight = 0;\n public Loaded = false;\n\n private _entityName = '';\n private _recordKey: CompositeKey | null = null;\n private resolveRun = 0;\n private resolveQueued = false;\n private _spec: FormContributionSpec | null = null;\n private _replacesRowID: string | null = null;\n private _componentSpec: ComponentSpec | null = null;\n private _componentID: string | null = null;\n private resizeObserver: ResizeObserver | null = null;\n private mutationObserver: MutationObserver | null = null;\n private frame = 0;\n private loadTimer: ReturnType<typeof setTimeout> | null = null;\n private showTimer: ReturnType<typeof setTimeout> | null = null;\n private sizeSignature = '';\n /** Set after each redraw, until the panel has been brought into view. */\n private revealPending = false;\n\n private readonly preview = inject(FORM_PLACEMENT_PREVIEW);\n private readonly zone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n public ngAfterViewInit(): void {\n this.zone.runOutsideAngular(() => {\n this.resizeObserver = new ResizeObserver(() => this.scheduleMeasure());\n this.resizeObserver.observe(this.viewport.nativeElement);\n this.resizeObserver.observe(this.stage.nativeElement);\n this.mutationObserver = new MutationObserver(() => this.scheduleMeasure());\n this.mutationObserver.observe(this.stage.nativeElement, {\n childList: true, subtree: true, attributes: true, attributeFilter: ['class', 'style', 'hidden'],\n });\n });\n this.loadTimer = setTimeout(() => { if (!this.Loaded) this.Failed.emit(); }, MjFormPlacementPreviewComponent.LOAD_TIMEOUT_MS);\n }\n\n public ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n this.mutationObserver?.disconnect();\n if (this.frame) cancelAnimationFrame(this.frame);\n if (this.loadTimer) clearTimeout(this.loadTimer);\n if (this.showTimer) clearTimeout(this.showTimer);\n }\n\n public OnLoaded(): void {\n this.Loaded = true;\n if (this.loadTimer) clearTimeout(this.loadTimer);\n this.scheduleMeasure();\n }\n\n public OnLoadError(): void {\n this.Failed.emit();\n }\n\n /**\n * Resolves the record once the current round of input changes is over, so the entity and the\n * record key arriving together look up a sample record once.\n */\n private queueResolveRecord(): void {\n if (this.resolveQueued) return;\n this.resolveQueued = true;\n queueMicrotask(() => {\n this.resolveQueued = false;\n void this.resolveRecord();\n });\n }\n\n /** Settles which record the form shows, then lets the form draw. */\n private async resolveRecord(): Promise<void> {\n const run = ++this.resolveRun;\n this.RecordResolved = false;\n this.Loaded = false;\n const entity = this._entityName ? this.ProviderToUse?.EntityByName(this._entityName) : undefined;\n let key = this._recordKey;\n let label = key ? 'Showing the record you have open' : '';\n if (!key && entity) {\n const sample = await this.sampleRecord(entity);\n if (run !== this.resolveRun) return;\n key = sample?.Key ?? null;\n label = sample ? `Showing ${sample.Label}, a sample record` : 'Showing a new, empty record — this entity has no records yet';\n }\n this.PrimaryKey = key ?? new CompositeKey();\n this.RecordLabel = label;\n this.RecordResolved = !!this._entityName;\n this.cdr.markForCheck();\n }\n\n /**\n * The entity's first record, ordered the way Form Builder's preview orders it: by name when\n * the entity has a name field, so every user sees the same one, else newest first.\n */\n private async sampleRecord(entity: EntityInfo): Promise<{ Key: CompositeKey; Label: string } | null> {\n const provider = this.ProviderToUse;\n if (!provider) return null;\n const nameField = entity.NameField?.Name;\n const keyFields = entity.PrimaryKeys.map((pk) => pk.Name);\n try {\n const result = await RunView.FromMetadataProvider(provider).RunView<Record<string, unknown>>({\n EntityName: entity.Name,\n Fields: nameField && !keyFields.includes(nameField) ? [...keyFields, nameField] : keyFields,\n OrderBy: nameField ? `${nameField} ASC` : '__mj_CreatedAt DESC',\n MaxRows: 1,\n SkipTotalRowCount: true,\n ResultType: 'simple',\n }, provider.CurrentUser);\n const row = result.Success ? result.Results?.[0] : undefined;\n if (!row) return null;\n const key = CompositeKey.FromEntityRecord(entity, row);\n const name = nameField ? String(row[nameField] ?? '').trim() : '';\n return { Key: key, Label: name ? `“${name}”` : 'the first record' };\n } catch (err) {\n LogError(`MjFormPlacementPreviewComponent: sample record for ${entity.Name} failed: ${err instanceof Error ? err.message : String(err)}`);\n return null;\n }\n }\n\n /**\n * Redraws the panel on the form, shortly after the last change. Each redraw remounts the\n * panel's component, so typing a label must not remount it on every key.\n */\n private showSpec(): void {\n if (this.showTimer) clearTimeout(this.showTimer);\n this.showTimer = setTimeout(() => {\n this.showTimer = null;\n const component = this._componentSpec || this._componentID\n ? { Spec: this._componentSpec, ComponentID: this._componentID }\n : null;\n this.preview.Show(this.EntityName, this._spec, this._replacesRowID, component);\n this.revealPending = true;\n this.scheduleMeasure();\n }, MjFormPlacementPreviewComponent.REDRAW_DELAY_MS);\n }\n\n private scheduleMeasure(): void {\n if (this.frame) return;\n this.frame = requestAnimationFrame(() => {\n this.frame = 0;\n this.measure();\n });\n }\n\n /** Fit the stage to the viewport, then keep the panel in view. Enters Angular only on a change. */\n private measure(): void {\n const viewport = this.viewport.nativeElement;\n const stage = this.stage.nativeElement;\n const available = viewport.clientWidth;\n const width = available > 0 ? Math.max(MjFormPlacementPreviewComponent.MIN_STAGE_WIDTH, available) : this.StageWidth;\n const scale = available > 0 ? available / width : this.Scale;\n const height = stage.offsetHeight * scale;\n if (this.Loaded && this.revealPending) this.revealPanel(stage);\n const signature = `${width}|${scale}|${height}`;\n if (signature === this.sizeSignature) return;\n this.sizeSignature = signature;\n this.zone.run(() => {\n this.StageWidth = width;\n this.Scale = scale;\n this.StageHeight = height;\n this.cdr.markForCheck();\n });\n }\n\n /**\n * Scrolls the panel into view once it draws after a redraw.\n *\n * On a form with a side rail the form itself shows the tab that holds the panel; this only\n * waits for it to draw and then brings it into view.\n */\n private revealPanel(stage: HTMLElement): void {\n const panel = stage.querySelector<HTMLElement>('[data-placement-preview]');\n if (!panel) return;\n const box = (panel.querySelector('mj-collapsible-panel') ?? panel).getBoundingClientRect();\n if (box.width === 0 && box.height === 0) return;\n this.revealPending = false;\n panel.scrollIntoView({ block: 'nearest', behavior: 'smooth' });\n }\n}\n","@if (RecordLabel) {\n <p class=\"mj-pp-record\"><i class=\"fa-solid fa-eye\" aria-hidden=\"true\"></i> {{ RecordLabel }}</p>\n}\n<div class=\"mj-pp-viewport\" #viewport [style.height.px]=\"StageHeight\">\n <div class=\"mj-pp-stage\" #stage inert\n [style.width.px]=\"StageWidth\"\n [style.transform]=\"'scale(' + Scale + ')'\">\n @if (RecordResolved) {\n <!-- Read-only: a preview shows the form as it reads, and an empty required field in\n edit mode would paint the whole form with validation errors. -->\n <mj-entity-form-host\n [Provider]=\"Provider\"\n [EntityName]=\"EntityName\"\n [PrimaryKey]=\"PrimaryKey\"\n [EditMode]=\"false\"\n [Config]=\"FormConfig\"\n (LoadComplete)=\"OnLoaded()\"\n (LoadError)=\"OnLoadError()\">\n </mj-entity-form-host>\n }\n </div>\n\n @if (!Loaded) {\n <div class=\"mj-pp-loading\">\n <mj-loading text=\"Drawing the form…\" size=\"small\"></mj-loading>\n </div>\n }\n</div>\n"]}
|
|
@@ -209,6 +209,11 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
|
|
|
209
209
|
*/
|
|
210
210
|
CompositionSnapshot: FormCompositionSnapshot | null;
|
|
211
211
|
CompositionChanged: EventEmitter<FormCompositionSnapshot>;
|
|
212
|
+
/**
|
|
213
|
+
* Emitted when the user clicks the "Ask AI" action in the form toolbar to open the
|
|
214
|
+
* AI chat overlay with this record's live context.
|
|
215
|
+
*/
|
|
216
|
+
AskAIRequested: EventEmitter<void>;
|
|
212
217
|
private readonly _formPanels;
|
|
213
218
|
/** Slot hosts register every mounted panel so validation can include panel-owned checks. */
|
|
214
219
|
RegisterFormPanel(panel: BaseFormPanel): void;
|
|
@@ -243,6 +248,23 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
|
|
|
243
248
|
* extra state.
|
|
244
249
|
*/
|
|
245
250
|
get HasAdditionalUnsavedChanges(): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the form holds unsaved work that its record's own fields don't show: pending related
|
|
253
|
+
* records (a child grid's edits or deletes) or {@link HasAdditionalUnsavedChanges}. Hosts consult
|
|
254
|
+
* it before tearing the form down (e.g. the standard-form switch); combine with `record.Dirty`
|
|
255
|
+
* for the full picture.
|
|
256
|
+
*
|
|
257
|
+
* A pure read, unlike {@link PendingRecordsDirty}: that path raises EDITING_COMPLETE (child grids
|
|
258
|
+
* commit in-progress cell edits on it) and rebuilds `_pendingRecords`, which the save pipeline
|
|
259
|
+
* owns. Here descendants only report their pending changes into a throwaway event, so asking
|
|
260
|
+
* changes nothing. An edit still open in a grid cell (not yet committed to its entity) is not seen.
|
|
261
|
+
*
|
|
262
|
+
* Entries the form itself already holds in `PendingRecords` count too, but only while editing:
|
|
263
|
+
* some forms add related-record changes there directly instead of reporting them on the event
|
|
264
|
+
* (the AI Agent form's "Remove action", added actions and prompts), and `CancelEdit` reverts
|
|
265
|
+
* saves but leaves delete entries in the list, so outside edit mode they are stale.
|
|
266
|
+
*/
|
|
267
|
+
get HasUnsavedChangesBeyondRecord(): boolean;
|
|
246
268
|
protected PendingRecordsDirty(): boolean;
|
|
247
269
|
protected PopulatePendingRecords(): void;
|
|
248
270
|
protected ValidatePendingRecords(): ValidationResult[];
|
|
@@ -568,6 +590,6 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
|
|
|
568
590
|
*/
|
|
569
591
|
OnListManagementRequested(): void;
|
|
570
592
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormComponent, never>;
|
|
571
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormComponent, never, never, {}, { "Navigate": "Navigate"; "Notification": "Notification"; "RecordSaved": "RecordSaved"; "RecordRefreshed": "RecordRefreshed"; "RecordDeleted": "RecordDeleted"; "RecordSaveFailed": "RecordSaveFailed"; "RecordDeleteFailed": "RecordDeleteFailed"; "ValidationFailed": "ValidationFailed"; "RecordReady": "RecordReady"; "EditModeChanged": "EditModeChanged"; "CompositionChanged": "CompositionChanged"; "SectionRowCountChanged": "SectionRowCountChanged"; }, never, never, true, never>;
|
|
593
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BaseFormComponent, never, never, {}, { "Navigate": "Navigate"; "Notification": "Notification"; "RecordSaved": "RecordSaved"; "RecordRefreshed": "RecordRefreshed"; "RecordDeleted": "RecordDeleted"; "RecordSaveFailed": "RecordSaveFailed"; "RecordDeleteFailed": "RecordDeleteFailed"; "ValidationFailed": "ValidationFailed"; "RecordReady": "RecordReady"; "EditModeChanged": "EditModeChanged"; "CompositionChanged": "CompositionChanged"; "AskAIRequested": "AskAIRequested"; "SectionRowCountChanged": "SectionRowCountChanged"; }, never, never, true, never>;
|
|
572
594
|
}
|
|
573
595
|
//# sourceMappingURL=base-form-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-form-component.d.ts","sourceRoot":"","sources":["../../src/lib/base-form-component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAAE,MAAM,EAAE,SAAS,EAClB,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAC9C,YAAY,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,oBAAoB,EAC9D,sBAAsB,EAAE,oBAAoB,EAAE,iCAAiC,EACrE,aAAa,EACvB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AACzH,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAE/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB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;;;OAIG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB/C;;;OAGG;IACU,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/C;;;OAGG;IACI,kBAAkB,IAAI,IAAI;IAIjC;;;OAGG;IACI,yBAAyB,IAAI,IAAI;yCAloDpB,iBAAiB;2CAAjB,iBAAiB;CAwoDtC"}
|
|
@@ -238,6 +238,11 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
238
238
|
*/
|
|
239
239
|
CompositionSnapshot = null;
|
|
240
240
|
CompositionChanged = new EventEmitter();
|
|
241
|
+
/**
|
|
242
|
+
* Emitted when the user clicks the "Ask AI" action in the form toolbar to open the
|
|
243
|
+
* AI chat overlay with this record's live context.
|
|
244
|
+
*/
|
|
245
|
+
AskAIRequested = new EventEmitter();
|
|
241
246
|
_formPanels = new Set();
|
|
242
247
|
/** Slot hosts register every mounted panel so validation can include panel-owned checks. */
|
|
243
248
|
RegisterFormPanel(panel) {
|
|
@@ -323,6 +328,31 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
323
328
|
get HasAdditionalUnsavedChanges() {
|
|
324
329
|
return false;
|
|
325
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Whether the form holds unsaved work that its record's own fields don't show: pending related
|
|
333
|
+
* records (a child grid's edits or deletes) or {@link HasAdditionalUnsavedChanges}. Hosts consult
|
|
334
|
+
* it before tearing the form down (e.g. the standard-form switch); combine with `record.Dirty`
|
|
335
|
+
* for the full picture.
|
|
336
|
+
*
|
|
337
|
+
* A pure read, unlike {@link PendingRecordsDirty}: that path raises EDITING_COMPLETE (child grids
|
|
338
|
+
* commit in-progress cell edits on it) and rebuilds `_pendingRecords`, which the save pipeline
|
|
339
|
+
* owns. Here descendants only report their pending changes into a throwaway event, so asking
|
|
340
|
+
* changes nothing. An edit still open in a grid cell (not yet committed to its entity) is not seen.
|
|
341
|
+
*
|
|
342
|
+
* Entries the form itself already holds in `PendingRecords` count too, but only while editing:
|
|
343
|
+
* some forms add related-record changes there directly instead of reporting them on the event
|
|
344
|
+
* (the AI Agent form's "Remove action", added actions and prompts), and `CancelEdit` reverts
|
|
345
|
+
* saves but leaves delete entries in the list, so outside edit mode they are stale.
|
|
346
|
+
*/
|
|
347
|
+
get HasUnsavedChangesBeyondRecord() {
|
|
348
|
+
if (this.HasAdditionalUnsavedChanges)
|
|
349
|
+
return true;
|
|
350
|
+
const isUnsaved = (p) => p.action === 'delete' || p.entityObject.Dirty;
|
|
351
|
+
if (this.EditMode && this._pendingRecords.some(isUnsaved))
|
|
352
|
+
return true;
|
|
353
|
+
const reported = this.RaiseEvent(BaseFormComponentEventCodes.POPULATE_PENDING_RECORDS).pendingChanges;
|
|
354
|
+
return reported.some(isUnsaved);
|
|
355
|
+
}
|
|
326
356
|
PendingRecordsDirty() {
|
|
327
357
|
this.PopulatePendingRecords();
|
|
328
358
|
const pendingRecords = this.PendingRecords;
|
|
@@ -616,18 +646,30 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
616
646
|
if (this._pendingRecords.length > 0) {
|
|
617
647
|
const md = this.ProviderToUse;
|
|
618
648
|
const tg = await md.CreateTransactionGroup();
|
|
619
|
-
this.record.
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
649
|
+
const members = [this.record, ...this._pendingRecords.map(x => x.entityObject)];
|
|
650
|
+
try {
|
|
651
|
+
this.record.TransactionGroup = tg;
|
|
652
|
+
await this.record.Save();
|
|
653
|
+
for (const x of this._pendingRecords) {
|
|
654
|
+
x.entityObject.TransactionGroup = tg;
|
|
655
|
+
if (x.action === 'save') {
|
|
656
|
+
await x.entityObject.Save();
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
await x.entityObject.Delete();
|
|
660
|
+
}
|
|
625
661
|
}
|
|
626
|
-
|
|
627
|
-
|
|
662
|
+
return await tg.Submit();
|
|
663
|
+
}
|
|
664
|
+
finally {
|
|
665
|
+
// A member that keeps this group after Submit would queue its next Save()/Delete() into a
|
|
666
|
+
// group that is already complete, and that call would report success without sending anything.
|
|
667
|
+
for (const member of members) {
|
|
668
|
+
if (member.TransactionGroup === tg) {
|
|
669
|
+
member.TransactionGroup = null;
|
|
670
|
+
}
|
|
628
671
|
}
|
|
629
672
|
}
|
|
630
|
-
return await tg.Submit();
|
|
631
673
|
}
|
|
632
674
|
else {
|
|
633
675
|
return await this.record.Save();
|
|
@@ -1459,7 +1501,7 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
1459
1501
|
} if (rf & 2) {
|
|
1460
1502
|
let _t;
|
|
1461
1503
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.collapsiblePanels = _t);
|
|
1462
|
-
} }, outputs: { Navigate: "Navigate", Notification: "Notification", RecordSaved: "RecordSaved", RecordRefreshed: "RecordRefreshed", RecordDeleted: "RecordDeleted", RecordSaveFailed: "RecordSaveFailed", RecordDeleteFailed: "RecordDeleteFailed", ValidationFailed: "ValidationFailed", RecordReady: "RecordReady", EditModeChanged: "EditModeChanged", CompositionChanged: "CompositionChanged", SectionRowCountChanged: "SectionRowCountChanged" }, features: [i0.ɵɵInheritDefinitionFeature] });
|
|
1504
|
+
} }, outputs: { Navigate: "Navigate", Notification: "Notification", RecordSaved: "RecordSaved", RecordRefreshed: "RecordRefreshed", RecordDeleted: "RecordDeleted", RecordSaveFailed: "RecordSaveFailed", RecordDeleteFailed: "RecordDeleteFailed", ValidationFailed: "ValidationFailed", RecordReady: "RecordReady", EditModeChanged: "EditModeChanged", CompositionChanged: "CompositionChanged", AskAIRequested: "AskAIRequested", SectionRowCountChanged: "SectionRowCountChanged" }, features: [i0.ɵɵInheritDefinitionFeature] });
|
|
1463
1505
|
}
|
|
1464
1506
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseFormComponent, [{
|
|
1465
1507
|
type: Directive
|
|
@@ -1485,6 +1527,8 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
1485
1527
|
type: Output
|
|
1486
1528
|
}], CompositionChanged: [{
|
|
1487
1529
|
type: Output
|
|
1530
|
+
}], AskAIRequested: [{
|
|
1531
|
+
type: Output
|
|
1488
1532
|
}], SectionRowCountChanged: [{
|
|
1489
1533
|
type: Output
|
|
1490
1534
|
}], collapsiblePanels: [{
|