@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
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { Component, Input, Output, EventEmitter, ViewChild, ViewContainerRef, ChangeDetectorRef, inject } from '@angular/core';
|
|
2
|
-
import { CompositeKey, FieldValueCollection, EntityFieldTSType } from '@memberjunction/core';
|
|
2
|
+
import { CompositeKey, FieldValueCollection, EntityFieldTSType, LogError } from '@memberjunction/core';
|
|
3
3
|
import { MJGlobal } from '@memberjunction/global';
|
|
4
4
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
5
5
|
import { BaseFormSectionComponent } from '../base-form-section-component';
|
|
6
6
|
import { InteractiveFormComponent } from '../interactive-form/interactive-form.component';
|
|
7
|
-
import { FormResolverService } from '../resolver/form-resolver.service';
|
|
7
|
+
import { FormResolverService, HasStandardFormAlternative as hasStandardFormAlternative } from '../resolver/form-resolver.service';
|
|
8
8
|
import { FormVariantChoices } from '../resolver/form-variants';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
|
-
import * as i1 from "@memberjunction/ng-
|
|
10
|
+
import * as i1 from "@memberjunction/ng-ui-components";
|
|
11
|
+
import * as i2 from "@memberjunction/ng-shared-generic";
|
|
11
12
|
const _c0 = ["anchor"];
|
|
13
|
+
const _c1 = ["modeSwitch"];
|
|
12
14
|
function MjEntityFormHostComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
-
i0.ɵɵelementStart(0, "div",
|
|
14
|
-
i0.ɵɵelement(1, "mj-loading",
|
|
15
|
+
i0.ɵɵelementStart(0, "div", 2);
|
|
16
|
+
i0.ɵɵelement(1, "mj-loading", 5);
|
|
15
17
|
i0.ɵɵelementEnd();
|
|
16
18
|
} }
|
|
17
19
|
function MjEntityFormHostComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
-
i0.ɵɵelementStart(0, "div",
|
|
19
|
-
i0.ɵɵelement(1, "i",
|
|
20
|
-
i0.ɵɵelementStart(2, "h3",
|
|
20
|
+
i0.ɵɵelementStart(0, "div", 3);
|
|
21
|
+
i0.ɵɵelement(1, "i", 6);
|
|
22
|
+
i0.ɵɵelementStart(2, "h3", 7);
|
|
21
23
|
i0.ɵɵtext(3);
|
|
22
24
|
i0.ɵɵelementEnd();
|
|
23
|
-
i0.ɵɵelementStart(4, "p",
|
|
25
|
+
i0.ɵɵelementStart(4, "p", 8);
|
|
24
26
|
i0.ɵɵtext(5);
|
|
25
27
|
i0.ɵɵelementEnd()();
|
|
26
28
|
} if (rf & 2) {
|
|
@@ -30,7 +32,27 @@ function MjEntityFormHostComponent_Conditional_1_Template(rf, ctx) { if (rf & 1)
|
|
|
30
32
|
i0.ɵɵadvance(2);
|
|
31
33
|
i0.ɵɵtextInterpolate(ctx_r0.errorDetail);
|
|
32
34
|
} }
|
|
33
|
-
function
|
|
35
|
+
function MjEntityFormHostComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
|
|
36
|
+
const _r2 = i0.ɵɵgetCurrentView();
|
|
37
|
+
i0.ɵɵelementStart(0, "div", 4);
|
|
38
|
+
i0.ɵɵelement(1, "i", 9);
|
|
39
|
+
i0.ɵɵelementStart(2, "span", 10);
|
|
40
|
+
i0.ɵɵtext(3);
|
|
41
|
+
i0.ɵɵelementEnd();
|
|
42
|
+
i0.ɵɵelementStart(4, "button", 11, 1);
|
|
43
|
+
i0.ɵɵlistener("click", function MjEntityFormHostComponent_Conditional_2_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r0.OnModeSwitchClick()); });
|
|
44
|
+
i0.ɵɵtext(6);
|
|
45
|
+
i0.ɵɵelementEnd()();
|
|
46
|
+
} if (rf & 2) {
|
|
47
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
48
|
+
i0.ɵɵadvance();
|
|
49
|
+
i0.ɵɵclassProp("fa-wand-magic-sparkles", ctx_r0.FormMode === "default")("fa-table-list", ctx_r0.FormMode === "standard");
|
|
50
|
+
i0.ɵɵadvance(2);
|
|
51
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.FormMode === "standard" ? "Standard form \u2014 all form fields, same permissions." : "Custom view. Some fields may only be editable in the standard form.", " ");
|
|
52
|
+
i0.ɵɵadvance(3);
|
|
53
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.FormMode === "standard" ? "Back to custom view" : "Open standard form", " ");
|
|
54
|
+
} }
|
|
55
|
+
function MjEntityFormHostComponent_ng_template_3_Template(rf, ctx) { }
|
|
34
56
|
/**
|
|
35
57
|
* Presentation-agnostic host that renders ANY MemberJunction entity form —
|
|
36
58
|
* generated (`@RegisterClass` / CodeGen), custom (`*Extended`), or interactive
|
|
@@ -58,12 +80,23 @@ function MjEntityFormHostComponent_ng_template_2_Template(rf, ctx) { }
|
|
|
58
80
|
* ```html
|
|
59
81
|
* <mj-entity-form-host [Record]="myEntity" [Config]="DIALOG_FORM_CONFIG"></mj-entity-form-host>
|
|
60
82
|
* ```
|
|
83
|
+
*
|
|
84
|
+
* **Standard-form switch.** When a custom form (a higher-priority class form or
|
|
85
|
+
* an interactive override) hides the CodeGen-generated form, the host renders a
|
|
86
|
+
* one-line strip above it offering "Open standard form" — every field, same
|
|
87
|
+
* permissions — and back. It lives here rather than in `<mj-form-toolbar>`
|
|
88
|
+
* because a fully custom form may not render the toolbar at all, which would
|
|
89
|
+
* leave the generated form unreachable. Surfaces drive/persist the choice via
|
|
90
|
+
* {@link FormMode} / {@link FormModeChange}; hosts that must not offer it set
|
|
91
|
+
* {@link ShowFormModeSwitch} to false.
|
|
61
92
|
*/
|
|
62
93
|
export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
63
94
|
cdr = inject(ChangeDetectorRef);
|
|
64
95
|
formResolver = inject(FormResolverService);
|
|
65
96
|
/** Anchor for the dynamically-created form component. Always present in the DOM. */
|
|
66
97
|
anchor;
|
|
98
|
+
/** The strip's switch button — present only while the strip renders. */
|
|
99
|
+
modeSwitchButton;
|
|
67
100
|
// ── Inputs ──────────────────────────────────────────────────────────────
|
|
68
101
|
_entityName = null;
|
|
69
102
|
/** Entity name to load a record for. Ignored when {@link Record} is supplied. */
|
|
@@ -118,6 +151,23 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
118
151
|
get EditMode() { return this._editMode; }
|
|
119
152
|
/** Per-instance form presentation config (toolbar, sections, width, links). */
|
|
120
153
|
Config = null;
|
|
154
|
+
_formMode = 'default';
|
|
155
|
+
/**
|
|
156
|
+
* Which form to mount: `'default'` = the resolver's normal pick; `'standard'`
|
|
157
|
+
* = the CodeGen-generated form, even when a custom form outranks it. Falls
|
|
158
|
+
* back to the default (and logs) when the entity has no standard form.
|
|
159
|
+
* A change after the view initializes reloads the form.
|
|
160
|
+
*/
|
|
161
|
+
set FormMode(value) {
|
|
162
|
+
const next = value ?? 'default';
|
|
163
|
+
const changed = this._formMode !== next;
|
|
164
|
+
this._formMode = next;
|
|
165
|
+
if (changed && this._viewInitialized)
|
|
166
|
+
this.reload();
|
|
167
|
+
}
|
|
168
|
+
get FormMode() { return this._formMode; }
|
|
169
|
+
/** Offer the standard-form strip when a custom form hides the generated one. Set false to suppress it. */
|
|
170
|
+
ShowFormModeSwitch = true;
|
|
121
171
|
// ── Outputs ─────────────────────────────────────────────────────────────
|
|
122
172
|
/** Form navigation request (record link, new record, hierarchy, email, external, dismiss). */
|
|
123
173
|
Navigate = new EventEmitter();
|
|
@@ -145,6 +195,8 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
145
195
|
LoadError = new EventEmitter();
|
|
146
196
|
/** The live form instance, emitted right after it's created (for power-user wiring). */
|
|
147
197
|
FormCreated = new EventEmitter();
|
|
198
|
+
/** The user switched between the custom and the standard form (so the surface can persist it, e.g. in the URL). */
|
|
199
|
+
FormModeChange = new EventEmitter();
|
|
148
200
|
/**
|
|
149
201
|
* Re-emitted form `EditModeChanged` (true = edit started, false = ended),
|
|
150
202
|
* plus one `true` right after mount when the form was created already in
|
|
@@ -152,6 +204,8 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
152
204
|
* in that path, so without this the shell would never hear about it.
|
|
153
205
|
*/
|
|
154
206
|
EditModeChanged = new EventEmitter();
|
|
207
|
+
/** Emitted when the user clicks the "Ask AI" button on the form toolbar. */
|
|
208
|
+
AskAIRequested = new EventEmitter();
|
|
155
209
|
// ── State ───────────────────────────────────────────────────────────────
|
|
156
210
|
Loading = true;
|
|
157
211
|
/** @deprecated Use {@link Loading}. */
|
|
@@ -172,6 +226,12 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
172
226
|
this.ErrorTitle = value;
|
|
173
227
|
}
|
|
174
228
|
errorDetail = null;
|
|
229
|
+
/**
|
|
230
|
+
* True when a custom form is hiding the standard (CodeGen) form — so the
|
|
231
|
+
* switch strip has somewhere to go. Stays true while the standard form is
|
|
232
|
+
* the one mounted, so the strip can offer the way back.
|
|
233
|
+
*/
|
|
234
|
+
HasStandardFormAlternative = false;
|
|
175
235
|
_formComponentRef = null;
|
|
176
236
|
_sectionRef = null;
|
|
177
237
|
_isSection = false;
|
|
@@ -179,6 +239,26 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
179
239
|
_saveHandlerSub = null;
|
|
180
240
|
_formEventSubs = [];
|
|
181
241
|
_viewInitialized = false;
|
|
242
|
+
/**
|
|
243
|
+
* An unsaved new record carried across a form switch. A brand-new record is
|
|
244
|
+
* always `Dirty` (never saved), so the dirty guard can't protect it; instead
|
|
245
|
+
* the switch re-binds the same live instance rather than creating a fresh one,
|
|
246
|
+
* so whatever the user typed survives. Consumed by the next {@link obtainRecord}.
|
|
247
|
+
*/
|
|
248
|
+
_carryNewRecord = null;
|
|
249
|
+
/**
|
|
250
|
+
* Set when the strip's own button started a switch. The reload unmounts the
|
|
251
|
+
* strip (and the focused button with it), so focus is handed to the new
|
|
252
|
+
* button once the mount completes instead of falling to `<body>`.
|
|
253
|
+
*/
|
|
254
|
+
_refocusModeSwitch = false;
|
|
255
|
+
/**
|
|
256
|
+
* Bumped by every {@link teardown} (so by every reload and by destroy). A
|
|
257
|
+
* load captures it on entry and gives up after any `await` once it has
|
|
258
|
+
* moved: a superseded load must not mount, emit, register a save handler,
|
|
259
|
+
* or report a failure over the load that replaced it.
|
|
260
|
+
*/
|
|
261
|
+
_loadGeneration = 0;
|
|
182
262
|
/** The live form component instance, or null before mount / after teardown. */
|
|
183
263
|
get Form() {
|
|
184
264
|
return this._formComponentRef?.instance ?? null;
|
|
@@ -230,15 +310,70 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
230
310
|
return false;
|
|
231
311
|
return f.RefreshRecord();
|
|
232
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Switch between the custom (`'default'`) and the standard form. Refuses —
|
|
315
|
+
* returning false and emitting a `warning` Notification — when remounting
|
|
316
|
+
* would silently discard unsaved work (see {@link hasUnsavedWorkToLose}).
|
|
317
|
+
* A brand-new record is carried across instead (see {@link _carryNewRecord}).
|
|
318
|
+
* With a form mounted but no standard alternative (the generated form is
|
|
319
|
+
* the only one), both modes mount the same form: the mode is recorded and
|
|
320
|
+
* emitted, with no reload and so nothing for the unsaved-work guard to
|
|
321
|
+
* protect. The error state is excluded: `fail()` also clears
|
|
322
|
+
* `HasStandardFormAlternative` and `Loading`, and there the switch must
|
|
323
|
+
* still reload — it is the retry of the failed load.
|
|
324
|
+
*/
|
|
325
|
+
SwitchFormMode(mode) {
|
|
326
|
+
if (mode === this._formMode)
|
|
327
|
+
return true;
|
|
328
|
+
if (!this.HasStandardFormAlternative && !this.Loading && !this.ErrorTitle) {
|
|
329
|
+
this._formMode = mode;
|
|
330
|
+
this.FormModeChange.emit(mode);
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
if (this.hasUnsavedWorkToLose()) {
|
|
334
|
+
this.Notification.emit({ Message: 'Save or discard your changes before switching forms.', Type: 'warning', Duration: 4000 });
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
const record = this._currentRecord;
|
|
338
|
+
// A bound Record input is reused by every reload anyway; only a host-created new record needs carrying.
|
|
339
|
+
if (record && !record.IsSaved && !this._record)
|
|
340
|
+
this._carryNewRecord = record;
|
|
341
|
+
this._formMode = mode;
|
|
342
|
+
this.FormModeChange.emit(mode);
|
|
343
|
+
this.reload();
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
/** Template handler for the strip's button: switch, and keep keyboard focus on the button. */
|
|
347
|
+
OnModeSwitchClick() {
|
|
348
|
+
this._refocusModeSwitch = true;
|
|
349
|
+
const next = this._formMode === 'standard' ? 'default' : 'standard';
|
|
350
|
+
if (!this.SwitchFormMode(next))
|
|
351
|
+
this._refocusModeSwitch = false; // refused: the button never left
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Whether tearing the mounted form down would lose unsaved work. A saved
|
|
355
|
+
* record's field edits count; a brand-new record's don't, because its live
|
|
356
|
+
* instance is carried across the switch. Work the form holds outside the
|
|
357
|
+
* record (pending related records, designer/canvas state) always counts —
|
|
358
|
+
* it lives in the form component, which the switch destroys.
|
|
359
|
+
*/
|
|
360
|
+
hasUnsavedWorkToLose() {
|
|
361
|
+
const record = this._currentRecord;
|
|
362
|
+
if (record?.IsSaved && record.Dirty)
|
|
363
|
+
return true;
|
|
364
|
+
return this.Form?.HasUnsavedChangesBeyondRecord ?? false;
|
|
365
|
+
}
|
|
233
366
|
// ── Core: resolve → load → create → bind → wire ──────────────────────────
|
|
234
367
|
reload() {
|
|
235
368
|
this.teardown();
|
|
236
369
|
this.Loading = true;
|
|
370
|
+
this.HasStandardFormAlternative = false;
|
|
237
371
|
this.ErrorTitle = null;
|
|
238
372
|
this.errorDetail = null;
|
|
239
373
|
void this.loadAndMount();
|
|
240
374
|
}
|
|
241
375
|
async loadAndMount() {
|
|
376
|
+
const generation = this._loadGeneration;
|
|
242
377
|
const md = this.ProviderToUse;
|
|
243
378
|
// When a pre-loaded record is supplied, derive the entity from it.
|
|
244
379
|
const entityName = this._record?.EntityInfo?.Name ?? this._entityName;
|
|
@@ -255,28 +390,38 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
255
390
|
const permissions = entity.GetUserPermisions(md.CurrentUser);
|
|
256
391
|
// Section mode short-circuits the full-form resolver / container.
|
|
257
392
|
if (this.SectionName) {
|
|
258
|
-
await this.mountSection(entityName, permissions);
|
|
393
|
+
await this.mountSection(entityName, permissions, generation);
|
|
259
394
|
return;
|
|
260
395
|
}
|
|
261
396
|
const resolution = await this.formResolver.ResolveFormForEntity(entity, md.CurrentUser, md);
|
|
397
|
+
if (this.isSuperseded(generation))
|
|
398
|
+
return;
|
|
399
|
+
this.HasStandardFormAlternative = hasStandardFormAlternative(resolution);
|
|
262
400
|
if (resolution.kind === 'none') {
|
|
263
401
|
this.fail(`No form is registered for "${entityName}".`, `No EntityFormOverride or class-based form (@RegisterClass(BaseFormComponent, '${entityName}')) was found. Run CodeGen or register a custom form.`);
|
|
264
402
|
return;
|
|
265
403
|
}
|
|
266
|
-
const record = await this.obtainRecord(entityName, md);
|
|
267
|
-
if (!record)
|
|
268
|
-
return; //
|
|
404
|
+
const record = await this.obtainRecord(entityName, generation, md);
|
|
405
|
+
if (!record || this.isSuperseded(generation))
|
|
406
|
+
return; // a failure already called fail()
|
|
269
407
|
// Emit Saved on the record's own save event (covers all save paths).
|
|
270
408
|
this._saveHandlerSub = record.RegisterEventHandler((e) => {
|
|
271
409
|
if (e.type === 'save')
|
|
272
410
|
this.Saved.emit(record);
|
|
273
411
|
});
|
|
412
|
+
const standardForm = this.standardFormToMount(resolution, entityName);
|
|
274
413
|
this.anchor.clear();
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
414
|
+
let componentRef;
|
|
415
|
+
if (standardForm) {
|
|
416
|
+
componentRef = this.anchor.createComponent(standardForm);
|
|
417
|
+
}
|
|
418
|
+
else if (resolution.kind === 'interactive') {
|
|
419
|
+
const interactiveRef = this.anchor.createComponent(InteractiveFormComponent);
|
|
420
|
+
interactiveRef.instance.ComponentID = resolution.override.ComponentID;
|
|
421
|
+
componentRef = interactiveRef;
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
componentRef = this.anchor.createComponent(resolution.subClass);
|
|
280
425
|
}
|
|
281
426
|
this._formComponentRef = componentRef;
|
|
282
427
|
this._currentRecord = record;
|
|
@@ -286,6 +431,9 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
286
431
|
instance.Config = this.effectiveConfigFor(record);
|
|
287
432
|
instance.EditMode = this._editMode ?? this.Config?.StartInEditMode ?? !record.IsSaved;
|
|
288
433
|
this.applyVariants(instance, resolution, entityName);
|
|
434
|
+
// The picker's "current" row describes the resolver's pick; the standard form is none of them.
|
|
435
|
+
if (standardForm)
|
|
436
|
+
instance.CurrentVariantID = null;
|
|
289
437
|
this.subscribeToFormEvents(instance);
|
|
290
438
|
this.announceInitialEditMode(instance);
|
|
291
439
|
this.FormCreated.emit(instance);
|
|
@@ -295,12 +443,65 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
295
443
|
}
|
|
296
444
|
catch (err) {
|
|
297
445
|
const msg = err instanceof Error ? err.message : String(err);
|
|
446
|
+
if (this.isSuperseded(generation)) {
|
|
447
|
+
LogError(`MjEntityFormHost: a superseded load of "${entityName}" failed: ${msg}`);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
298
450
|
this.fail(`Failed to load ${entityName} record.`, `An unexpected error occurred: ${msg}`);
|
|
299
451
|
}
|
|
300
452
|
finally {
|
|
301
|
-
this
|
|
302
|
-
this.
|
|
453
|
+
// The load that replaced this one owns Loading, change detection and focus.
|
|
454
|
+
if (!this.isSuperseded(generation))
|
|
455
|
+
this.settleLoad();
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
/** Whether a newer load (or destroy) has replaced the load that captured `generation`. */
|
|
459
|
+
isSuperseded(generation) {
|
|
460
|
+
return generation !== this._loadGeneration;
|
|
461
|
+
}
|
|
462
|
+
/** End the current load: clear the loading state, render, and restore the switch's focus. */
|
|
463
|
+
settleLoad() {
|
|
464
|
+
this.Loading = false;
|
|
465
|
+
this.cdr.detectChanges();
|
|
466
|
+
this.restoreModeSwitchFocus();
|
|
467
|
+
}
|
|
468
|
+
/** After a strip-initiated switch, hand focus to the re-rendered switch button (if the strip is back). */
|
|
469
|
+
restoreModeSwitchFocus() {
|
|
470
|
+
if (!this._refocusModeSwitch)
|
|
471
|
+
return;
|
|
472
|
+
this._refocusModeSwitch = false;
|
|
473
|
+
this.modeSwitchButton?.nativeElement.focus();
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* The standard form class to mount instead of the resolver's pick, or null
|
|
477
|
+
* to mount the pick. Only non-null in `'standard'` mode when a custom form is
|
|
478
|
+
* actually hiding the standard one; when the pick already IS the standard
|
|
479
|
+
* form there is nothing to swap. A `'standard'` request for an entity with
|
|
480
|
+
* no standard form falls back to the pick and logs, so a stale deep link
|
|
481
|
+
* can't break the record.
|
|
482
|
+
*/
|
|
483
|
+
standardFormToMount(resolution, entityName) {
|
|
484
|
+
if (this._formMode !== 'standard')
|
|
485
|
+
return null;
|
|
486
|
+
if (!resolution.standard) {
|
|
487
|
+
this.logMissingStandardFormOnce(entityName);
|
|
488
|
+
return null;
|
|
303
489
|
}
|
|
490
|
+
return hasStandardFormAlternative(resolution) ? resolution.standard : null;
|
|
491
|
+
}
|
|
492
|
+
/** Entities this host has already logged a missing standard form for (lowercased names). */
|
|
493
|
+
_missingStandardLogged = new Set();
|
|
494
|
+
/**
|
|
495
|
+
* Log the "standard requested, none registered" fallback once per entity per
|
|
496
|
+
* host. A stale `?form=standard` would otherwise log on every reload (each
|
|
497
|
+
* variant pick, switch or input change).
|
|
498
|
+
*/
|
|
499
|
+
logMissingStandardFormOnce(entityName) {
|
|
500
|
+
const key = entityName.trim().toLowerCase();
|
|
501
|
+
if (this._missingStandardLogged.has(key))
|
|
502
|
+
return;
|
|
503
|
+
this._missingStandardLogged.add(key);
|
|
504
|
+
LogError(`MjEntityFormHost: standard form requested for "${entityName}" but none is registered; showing the default form`);
|
|
304
505
|
}
|
|
305
506
|
/**
|
|
306
507
|
* The config to bind for a given record. For brand-new (unsaved) records we hide the
|
|
@@ -325,15 +526,15 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
325
526
|
* variants, container, or form-event surface — section components are bare
|
|
326
527
|
* field editors; the host saves the record directly (see {@link Save}).
|
|
327
528
|
*/
|
|
328
|
-
async mountSection(entityName, permissions) {
|
|
529
|
+
async mountSection(entityName, permissions, generation) {
|
|
329
530
|
const key = `${entityName}.${this.SectionName}`;
|
|
330
531
|
const reg = MJGlobal.Instance.ClassFactory.GetRegistration(BaseFormSectionComponent, key);
|
|
331
532
|
if (!reg?.SubClass) {
|
|
332
533
|
this.fail(`No form section "${this.SectionName}" is registered for "${entityName}".`, `Expected a @RegisterClass(BaseFormSectionComponent, '${key}'). Check the section name.`);
|
|
333
534
|
return;
|
|
334
535
|
}
|
|
335
|
-
const record = await this.obtainRecord(entityName);
|
|
336
|
-
if (!record)
|
|
536
|
+
const record = await this.obtainRecord(entityName, generation);
|
|
537
|
+
if (!record || this.isSuperseded(generation))
|
|
337
538
|
return;
|
|
338
539
|
this._saveHandlerSub = record.RegisterEventHandler((e) => {
|
|
339
540
|
if (e.type === 'save')
|
|
@@ -351,18 +552,30 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
351
552
|
this.RecordReady.emit(record);
|
|
352
553
|
this.LoadComplete.emit();
|
|
353
554
|
}
|
|
354
|
-
/**
|
|
355
|
-
|
|
555
|
+
/**
|
|
556
|
+
* Resolve the BaseEntity to bind: the supplied instance, or a freshly loaded/new one.
|
|
557
|
+
* Returns null on failure; reports it through {@link fail} only while `generation` is still current.
|
|
558
|
+
*/
|
|
559
|
+
async obtainRecord(entityName, generation, md = this.ProviderToUse) {
|
|
356
560
|
if (this._record)
|
|
357
561
|
return this._record;
|
|
562
|
+
const carried = this._carryNewRecord;
|
|
563
|
+
this._carryNewRecord = null;
|
|
564
|
+
// Only honor the carry for the same new record — an input swap since the switch loads normally.
|
|
565
|
+
if (carried && carried.EntityInfo.Name === entityName && !this._primaryKey.HasValue)
|
|
566
|
+
return carried;
|
|
358
567
|
const record = await md.GetEntityObject(entityName, md.CurrentUser);
|
|
359
568
|
if (!record) {
|
|
569
|
+
if (this.isSuperseded(generation))
|
|
570
|
+
return null;
|
|
360
571
|
this.fail(`Failed to load ${entityName} record.`, `Unable to instantiate entity "${entityName}".`);
|
|
361
572
|
return null;
|
|
362
573
|
}
|
|
363
574
|
if (this._primaryKey.HasValue) {
|
|
364
575
|
const loadOk = await record.InnerLoad(this._primaryKey);
|
|
365
576
|
if (!loadOk) {
|
|
577
|
+
if (this.isSuperseded(generation))
|
|
578
|
+
return null;
|
|
366
579
|
this.fail(`Could not load ${entityName} record.`, record.LatestResult?.Message
|
|
367
580
|
? `Server error: ${record.LatestResult.Message}`
|
|
368
581
|
: `InnerLoad returned false for key ${this._primaryKey.ToString()}.`);
|
|
@@ -386,6 +599,11 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
386
599
|
else {
|
|
387
600
|
this.formResolver.SetSelectedVariant(entityName, variantID);
|
|
388
601
|
}
|
|
602
|
+
// Picking a variant means "show me that one" — leave the standard form.
|
|
603
|
+
if (this._formMode === 'standard') {
|
|
604
|
+
this._formMode = 'default';
|
|
605
|
+
this.FormModeChange.emit('default');
|
|
606
|
+
}
|
|
389
607
|
// Reload via the resolver so tier/priority + the new selection apply.
|
|
390
608
|
this._record = null; // force a fresh load against the new variant
|
|
391
609
|
this.reload();
|
|
@@ -395,6 +613,9 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
395
613
|
subscribeToFormEvents(form) {
|
|
396
614
|
this.cleanupFormSubs();
|
|
397
615
|
this._formEventSubs.push(form.Navigate.subscribe(e => this.Navigate.emit(e)), form.Notification.subscribe(e => this.Notification.emit(e)), form.RecordSaved.subscribe(e => this.RecordSaved.emit(e)), form.RecordRefreshed.subscribe(e => this.RecordRefreshed.emit(e.Record)), form.RecordDeleted.subscribe(e => this.RecordDeleted.emit(e)), form.RecordSaveFailed.subscribe(e => this.RecordSaveFailed.emit(e)), form.ValidationFailed.subscribe(e => this.ValidationFailed.emit(e)), form.RecordReady.subscribe(e => this.RecordReady.emit(e)), form.EditModeChanged.subscribe(e => this.EditModeChanged.emit(e)));
|
|
616
|
+
if (form.AskAIRequested) {
|
|
617
|
+
this._formEventSubs.push(form.AskAIRequested.subscribe(() => this.AskAIRequested?.emit()));
|
|
618
|
+
}
|
|
398
619
|
// Surface 'dismiss' navigation as a first-class Dismissed event too.
|
|
399
620
|
this._formEventSubs.push(form.Navigate.subscribe(e => { if (e.Kind === 'dismiss')
|
|
400
621
|
this.Dismissed.emit(); }));
|
|
@@ -464,6 +685,7 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
464
685
|
this.ErrorTitle = title;
|
|
465
686
|
this.errorDetail = detail;
|
|
466
687
|
this.Loading = false;
|
|
688
|
+
this.HasStandardFormAlternative = false; // no form mounted → nothing to switch between
|
|
467
689
|
if (this._formComponentRef) {
|
|
468
690
|
try {
|
|
469
691
|
this._formComponentRef.destroy();
|
|
@@ -498,6 +720,7 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
498
720
|
this._formEventSubs = [];
|
|
499
721
|
}
|
|
500
722
|
teardown() {
|
|
723
|
+
this._loadGeneration++;
|
|
501
724
|
this.cleanupFormSubs();
|
|
502
725
|
if (this._saveHandlerSub) {
|
|
503
726
|
this._saveHandlerSub.unsubscribe();
|
|
@@ -523,26 +746,33 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
523
746
|
}
|
|
524
747
|
static ɵfac = /*@__PURE__*/ (() => { let ɵMjEntityFormHostComponent_BaseFactory; return function MjEntityFormHostComponent_Factory(__ngFactoryType__) { return (ɵMjEntityFormHostComponent_BaseFactory || (ɵMjEntityFormHostComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MjEntityFormHostComponent)))(__ngFactoryType__ || MjEntityFormHostComponent); }; })();
|
|
525
748
|
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MjEntityFormHostComponent, selectors: [["mj-entity-form-host"]], viewQuery: function MjEntityFormHostComponent_Query(rf, ctx) { if (rf & 1) {
|
|
526
|
-
i0.ɵɵviewQuery(_c0, 7, ViewContainerRef);
|
|
749
|
+
i0.ɵɵviewQuery(_c0, 7, ViewContainerRef)(_c1, 5);
|
|
527
750
|
} if (rf & 2) {
|
|
528
751
|
let _t;
|
|
529
752
|
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.anchor = _t.first);
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
i0.ɵɵconditionalCreate(
|
|
533
|
-
i0.ɵɵ
|
|
753
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.modeSwitchButton = _t.first);
|
|
754
|
+
} }, inputs: { EntityName: "EntityName", PrimaryKey: "PrimaryKey", Record: "Record", NewRecordValues: "NewRecordValues", SectionName: "SectionName", EditMode: "EditMode", Config: "Config", FormMode: "FormMode", ShowFormModeSwitch: "ShowFormModeSwitch" }, outputs: { Navigate: "Navigate", Notification: "Notification", Saved: "Saved", RecordSaved: "RecordSaved", RecordRefreshed: "RecordRefreshed", RecordDeleted: "RecordDeleted", RecordSaveFailed: "RecordSaveFailed", ValidationFailed: "ValidationFailed", RecordReady: "RecordReady", Dismissed: "Dismissed", LoadComplete: "LoadComplete", LoadError: "LoadError", FormCreated: "FormCreated", FormModeChange: "FormModeChange", EditModeChanged: "EditModeChanged", AskAIRequested: "AskAIRequested" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 5, vars: 3, consts: [["anchor", ""], ["modeSwitch", ""], [1, "mj-form-host-loading"], ["role", "alert", 1, "mj-form-host-error"], [1, "mj-form-host-mode-strip"], ["text", "Loading record..."], [1, "fa-solid", "fa-triangle-exclamation", "mj-form-host-error-icon"], [1, "mj-form-host-error-title"], [1, "mj-form-host-error-detail"], ["aria-hidden", "true", 1, "fa-solid"], ["aria-live", "polite", 1, "mj-form-host-mode-text"], ["mjButton", "", "Variant", "outline", "Size", "sm", "type", "button", 1, "mj-form-host-mode-switch", 3, "click"]], template: function MjEntityFormHostComponent_Template(rf, ctx) { if (rf & 1) {
|
|
755
|
+
i0.ɵɵconditionalCreate(0, MjEntityFormHostComponent_Conditional_0_Template, 2, 0, "div", 2);
|
|
756
|
+
i0.ɵɵconditionalCreate(1, MjEntityFormHostComponent_Conditional_1_Template, 6, 2, "div", 3);
|
|
757
|
+
i0.ɵɵconditionalCreate(2, MjEntityFormHostComponent_Conditional_2_Template, 7, 6, "div", 4);
|
|
758
|
+
i0.ɵɵtemplate(3, MjEntityFormHostComponent_ng_template_3_Template, 0, 0, "ng-template", null, 0, i0.ɵɵtemplateRefExtractor);
|
|
534
759
|
} if (rf & 2) {
|
|
535
760
|
i0.ɵɵconditional(ctx.loading ? 0 : -1);
|
|
536
761
|
i0.ɵɵadvance();
|
|
537
762
|
i0.ɵɵconditional(!ctx.loading && ctx.errorTitle ? 1 : -1);
|
|
538
|
-
|
|
763
|
+
i0.ɵɵadvance();
|
|
764
|
+
i0.ɵɵconditional(!ctx.Loading && ctx.ShowFormModeSwitch && ctx.HasStandardFormAlternative ? 2 : -1);
|
|
765
|
+
} }, dependencies: [i1.MJButtonDirective, i2.LoadingComponent], styles: ["\n\n\n\n[_nghost-%COMP%] {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n\n\n\n\n\n[_nghost-%COMP%] > :not(.mj-form-host-mode-strip):not(.mj-form-host-loading):not(.mj-form-host-error) {\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.mj-form-host-mode-strip[_ngcontent-%COMP%] {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 16px;\n font-size: 13px;\n color: var(--mj-text-secondary);\n background: var(--mj-bg-surface-sunken);\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.mj-form-host-mode-text[_ngcontent-%COMP%] {\n flex: 1;\n min-width: 0;\n}\n\n.mj-form-host-loading[_ngcontent-%COMP%] {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 200px;\n height: 100%;\n}\n\n.mj-form-host-error[_ngcontent-%COMP%] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 40px 24px;\n text-align: center;\n color: var(--mj-text-secondary);\n}\n\n.mj-form-host-error-icon[_ngcontent-%COMP%] {\n font-size: 32px;\n color: var(--mj-status-error);\n margin-bottom: 8px;\n}\n\n.mj-form-host-error-title[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--mj-text-primary);\n}\n\n.mj-form-host-error-detail[_ngcontent-%COMP%] {\n margin: 0;\n font-size: 13px;\n max-width: 560px;\n line-height: 1.5;\n color: var(--mj-text-muted);\n}"] });
|
|
539
766
|
}
|
|
540
767
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MjEntityFormHostComponent, [{
|
|
541
768
|
type: Component,
|
|
542
|
-
args: [{ standalone: false, selector: 'mj-entity-form-host', template: "<!-- Loading state -->\n@if (loading) {\n <div class=\"mj-form-host-loading\">\n <mj-loading text=\"Loading record...\"></mj-loading>\n </div>\n}\n\n<!-- Error state -->\n@if (!loading && errorTitle) {\n <div class=\"mj-form-host-error\" role=\"alert\">\n <i class=\"fa-solid fa-triangle-exclamation mj-form-host-error-icon\"></i>\n <h3 class=\"mj-form-host-error-title\">{{ errorTitle }}</h3>\n <p class=\"mj-form-host-error-detail\">{{ errorDetail }}</p>\n </div>\n}\n\n<!--\n Anchor for the dynamically-created form component. Always present (static)\n so the ViewContainerRef resolves at AfterViewInit. The form's own template\n carries the <mj-record-form-container>, so nothing wraps it here.\n-->\n<ng-template #anchor></ng-template>\n", styles: [":host {\n display:
|
|
769
|
+
args: [{ standalone: false, selector: 'mj-entity-form-host', template: "<!-- Loading state -->\n@if (loading) {\n <div class=\"mj-form-host-loading\">\n <mj-loading text=\"Loading record...\"></mj-loading>\n </div>\n}\n\n<!-- Error state -->\n@if (!loading && errorTitle) {\n <div class=\"mj-form-host-error\" role=\"alert\">\n <i class=\"fa-solid fa-triangle-exclamation mj-form-host-error-icon\"></i>\n <h3 class=\"mj-form-host-error-title\">{{ errorTitle }}</h3>\n <p class=\"mj-form-host-error-detail\">{{ errorDetail }}</p>\n </div>\n}\n\n<!--\n Standard-form switch: only when a custom form hides the CodeGen form. Placed\n above the anchor so the dynamically-created form renders below it.\n-->\n@if (!Loading && ShowFormModeSwitch && HasStandardFormAlternative) {\n <div class=\"mj-form-host-mode-strip\">\n <i class=\"fa-solid\" [class.fa-wand-magic-sparkles]=\"FormMode === 'default'\" [class.fa-table-list]=\"FormMode === 'standard'\" aria-hidden=\"true\"></i>\n <span class=\"mj-form-host-mode-text\" aria-live=\"polite\">\n {{ FormMode === 'standard' ? 'Standard form \u2014 all form fields, same permissions.' : 'Custom view. Some fields may only be editable in the standard form.' }}\n </span>\n <button #modeSwitch mjButton Variant=\"outline\" Size=\"sm\" type=\"button\"\n class=\"mj-form-host-mode-switch\"\n (click)=\"OnModeSwitchClick()\">\n {{ FormMode === 'standard' ? 'Back to custom view' : 'Open standard form' }}\n </button>\n </div>\n}\n\n<!--\n Anchor for the dynamically-created form component. Always present (static)\n so the ViewContainerRef resolves at AfterViewInit. The form's own template\n carries the <mj-record-form-container>, so nothing wraps it here.\n-->\n<ng-template #anchor></ng-template>\n", styles: ["/*\n * Column flex so an optional mode strip can sit above a full-height form\n * without pushing it past the host's height.\n */\n:host {\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n\n/*\n * The dynamically-created form is inserted after the anchor as a direct child,\n * but is not stamped with this component's content attribute \u2014 hence ::ng-deep\n * (scoped to direct children of this host) to let it take the remaining height.\n */\n:host ::ng-deep > :not(.mj-form-host-mode-strip):not(.mj-form-host-loading):not(.mj-form-host-error) {\n flex: 1 1 auto;\n min-height: 0;\n}\n\n.mj-form-host-mode-strip {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 16px;\n font-size: 13px;\n color: var(--mj-text-secondary);\n background: var(--mj-bg-surface-sunken);\n border-bottom: 1px solid var(--mj-border-subtle);\n}\n\n.mj-form-host-mode-text {\n flex: 1;\n min-width: 0;\n}\n\n.mj-form-host-loading {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 200px;\n height: 100%;\n}\n\n.mj-form-host-error {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 40px 24px;\n text-align: center;\n color: var(--mj-text-secondary);\n}\n\n.mj-form-host-error-icon {\n font-size: 32px;\n color: var(--mj-status-error);\n margin-bottom: 8px;\n}\n\n.mj-form-host-error-title {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--mj-text-primary);\n}\n\n.mj-form-host-error-detail {\n margin: 0;\n font-size: 13px;\n max-width: 560px;\n line-height: 1.5;\n color: var(--mj-text-muted);\n}\n"] }]
|
|
543
770
|
}], null, { anchor: [{
|
|
544
771
|
type: ViewChild,
|
|
545
772
|
args: ['anchor', { read: ViewContainerRef, static: true }]
|
|
773
|
+
}], modeSwitchButton: [{
|
|
774
|
+
type: ViewChild,
|
|
775
|
+
args: ['modeSwitch']
|
|
546
776
|
}], EntityName: [{
|
|
547
777
|
type: Input
|
|
548
778
|
}], PrimaryKey: [{
|
|
@@ -557,6 +787,10 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
557
787
|
type: Input
|
|
558
788
|
}], Config: [{
|
|
559
789
|
type: Input
|
|
790
|
+
}], FormMode: [{
|
|
791
|
+
type: Input
|
|
792
|
+
}], ShowFormModeSwitch: [{
|
|
793
|
+
type: Input
|
|
560
794
|
}], Navigate: [{
|
|
561
795
|
type: Output
|
|
562
796
|
}], Notification: [{
|
|
@@ -583,8 +817,12 @@ export class MjEntityFormHostComponent extends BaseAngularComponent {
|
|
|
583
817
|
type: Output
|
|
584
818
|
}], FormCreated: [{
|
|
585
819
|
type: Output
|
|
820
|
+
}], FormModeChange: [{
|
|
821
|
+
type: Output
|
|
586
822
|
}], EditModeChanged: [{
|
|
587
823
|
type: Output
|
|
824
|
+
}], AskAIRequested: [{
|
|
825
|
+
type: Output
|
|
588
826
|
}] }); })();
|
|
589
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MjEntityFormHostComponent, { className: "MjEntityFormHostComponent", filePath: "src/lib/host/entity-form-host.component.ts", lineNumber:
|
|
827
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MjEntityFormHostComponent, { className: "MjEntityFormHostComponent", filePath: "src/lib/host/entity-form-host.component.ts", lineNumber: 70 }); })();
|
|
590
828
|
//# sourceMappingURL=entity-form-host.component.js.map
|