@memberjunction/ng-base-forms 6.2.0 → 6.3.0-edge.0

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.
Files changed (57) hide show
  1. package/README.md +39 -8
  2. package/dist/lib/base-form-component.d.ts +20 -0
  3. package/dist/lib/base-form-component.d.ts.map +1 -1
  4. package/dist/lib/base-form-component.js +69 -7
  5. package/dist/lib/base-form-component.js.map +1 -1
  6. package/dist/lib/comments/comment-card-driver-host.component.d.ts +55 -0
  7. package/dist/lib/comments/comment-card-driver-host.component.d.ts.map +1 -0
  8. package/dist/lib/comments/comment-card-driver-host.component.js +134 -0
  9. package/dist/lib/comments/comment-card-driver-host.component.js.map +1 -0
  10. package/dist/lib/comments/field-suggestion-card.component.d.ts +43 -0
  11. package/dist/lib/comments/field-suggestion-card.component.d.ts.map +1 -0
  12. package/dist/lib/comments/field-suggestion-card.component.js +357 -0
  13. package/dist/lib/comments/field-suggestion-card.component.js.map +1 -0
  14. package/dist/lib/comments/form-record-comments-coordinator.service.d.ts +69 -7
  15. package/dist/lib/comments/form-record-comments-coordinator.service.d.ts.map +1 -1
  16. package/dist/lib/comments/form-record-comments-coordinator.service.js +251 -11
  17. package/dist/lib/comments/form-record-comments-coordinator.service.js.map +1 -1
  18. package/dist/lib/comments/record-comments.component.d.ts +31 -1
  19. package/dist/lib/comments/record-comments.component.d.ts.map +1 -1
  20. package/dist/lib/comments/record-comments.component.js +765 -465
  21. package/dist/lib/comments/record-comments.component.js.map +1 -1
  22. package/dist/lib/container/record-form-container.component.d.ts +6 -0
  23. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  24. package/dist/lib/container/record-form-container.component.js +286 -246
  25. package/dist/lib/container/record-form-container.component.js.map +1 -1
  26. package/dist/lib/field/form-field.component.d.ts +7 -3
  27. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  28. package/dist/lib/field/form-field.component.js +58 -22
  29. package/dist/lib/field/form-field.component.js.map +1 -1
  30. package/dist/lib/isa-related-panel/isa-related-panel.component.d.ts.map +1 -1
  31. package/dist/lib/isa-related-panel/isa-related-panel.component.js +10 -0
  32. package/dist/lib/isa-related-panel/isa-related-panel.component.js.map +1 -1
  33. package/dist/lib/panel-slot/collect-form-contribution-registrations.js +1 -1
  34. package/dist/lib/panel-slot/collect-form-contribution-registrations.js.map +1 -1
  35. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts +100 -0
  36. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.d.ts.map +1 -0
  37. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js +181 -0
  38. package/dist/lib/subtype-ui-driver/entity-subtype-ui-driver.js.map +1 -0
  39. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts +104 -0
  40. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.d.ts.map +1 -0
  41. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js +487 -0
  42. package/dist/lib/subtype-ui-driver/folded-subtype-section.component.js.map +1 -0
  43. package/dist/lib/toolbar/actions/record-comments-toolbar-action.js +2 -2
  44. package/dist/lib/toolbar/actions/record-comments-toolbar-action.js.map +1 -1
  45. package/dist/lib/toolbar/form-toolbar.component.d.ts +2 -0
  46. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  47. package/dist/lib/toolbar/form-toolbar.component.js +241 -290
  48. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  49. package/dist/module.d.ts +17 -14
  50. package/dist/module.d.ts.map +1 -1
  51. package/dist/module.js +25 -6
  52. package/dist/module.js.map +1 -1
  53. package/dist/public-api.d.ts +4 -0
  54. package/dist/public-api.d.ts.map +1 -1
  55. package/dist/public-api.js +4 -0
  56. package/dist/public-api.js.map +1 -1
  57. package/package.json +20 -20
@@ -0,0 +1,487 @@
1
+ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, EventEmitter, HostBinding, Input, Output, ViewChild, ViewContainerRef, ViewEncapsulation, inject, } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import { takeUntil } from 'rxjs/operators';
4
+ import { LogError, ValidationResult } from '@memberjunction/core';
5
+ import { MJGlobal } from '@memberjunction/global';
6
+ import { BaseAngularComponent } from '@memberjunction/ng-base-types';
7
+ import { FormFieldEditCoordinator } from '../form-field-edit.coordinator';
8
+ import { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';
9
+ import { FormChromeCoordinator } from '../chrome/form-chrome-coordinator.service';
10
+ import { EntitySubtypeUIDriverBase, ResolveGeneratedSubtypeFieldSpecs, } from './entity-subtype-ui-driver';
11
+ import * as i0 from "@angular/core";
12
+ import * as i1 from "@memberjunction/ng-ui-components";
13
+ import * as i2 from "../field/form-field.component";
14
+ import * as i3 from "../panel/collapsible-panel.component";
15
+ const _c0 = ["uiDriverHost"];
16
+ const _forTrack0 = ($index, $item) => $item.FieldName;
17
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_1_Template(rf, ctx) { if (rf & 1) {
18
+ i0.ɵɵelementStart(0, "div", 2)(1, "mj-alert", 6);
19
+ i0.ɵɵtext(2);
20
+ i0.ɵɵelementEnd()();
21
+ } if (rf & 2) {
22
+ const ctx_r1 = i0.ɵɵnextContext(2);
23
+ i0.ɵɵadvance(2);
24
+ i0.ɵɵtextInterpolate1(" ", ctx_r1.RefusalWarningMessage, " ");
25
+ } }
26
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_2_Template(rf, ctx) { if (rf & 1) {
27
+ i0.ɵɵelementStart(0, "div", 3);
28
+ i0.ɵɵelementContainer(1, null, 0);
29
+ i0.ɵɵelementEnd();
30
+ } }
31
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_3_For_2_Template(rf, ctx) { if (rf & 1) {
32
+ const _r3 = i0.ɵɵgetCurrentView();
33
+ i0.ɵɵelementStart(0, "mj-form-field", 8);
34
+ i0.ɵɵlistener("Navigate", function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_3_For_2_Template_mj_form_field_Navigate_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r1 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r1.OnNavigate($event)); });
35
+ i0.ɵɵelementEnd();
36
+ } if (rf & 2) {
37
+ const spec_r4 = ctx.$implicit;
38
+ const ctx_r1 = i0.ɵɵnextContext(3);
39
+ i0.ɵɵproperty("Provider", ctx_r1.Provider)("Record", ctx_r1.ActiveChildRecord)("FieldName", spec_r4.FieldName)("Type", spec_r4.ControlType)("LinkType", spec_r4.LinkType)("ShowLabel", true)("EditMode", ctx_r1.EditMode && ctx_r1.RefusalWarningMessage === null)("FormContext", ctx_r1.FormContext);
40
+ } }
41
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_3_Template(rf, ctx) { if (rf & 1) {
42
+ i0.ɵɵelementStart(0, "div", 4);
43
+ i0.ɵɵrepeaterCreate(1, MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_3_For_2_Template, 1, 8, "mj-form-field", 7, _forTrack0);
44
+ i0.ɵɵelementEnd();
45
+ } if (rf & 2) {
46
+ const ctx_r1 = i0.ɵɵnextContext(2);
47
+ i0.ɵɵadvance();
48
+ i0.ɵɵrepeater(ctx_r1.GeneratedFieldSpecs);
49
+ } }
50
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_4_Template(rf, ctx) { if (rf & 1) {
51
+ const _r5 = i0.ɵɵgetCurrentView();
52
+ i0.ɵɵelementStart(0, "mj-folded-subtype-section", 9);
53
+ i0.ɵɵlistener("Navigate", function MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_4_Template_mj_folded_subtype_section_Navigate_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.OnNavigate($event)); });
54
+ i0.ɵɵelementEnd();
55
+ } if (rf & 2) {
56
+ const ctx_r1 = i0.ɵɵnextContext(2);
57
+ i0.ɵɵproperty("Provider", ctx_r1.Provider)("Record", ctx_r1.ActiveChildRecord)("FormComponent", ctx_r1.FormComponent)("FormContext", ctx_r1.FormContext)("EditMode", ctx_r1.EditMode);
58
+ } }
59
+ function MjFoldedSubtypeSectionComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
60
+ const _r1 = i0.ɵɵgetCurrentView();
61
+ i0.ɵɵelementStart(0, "mj-collapsible-panel", 1);
62
+ i0.ɵɵlistener("Navigate", function MjFoldedSubtypeSectionComponent_Conditional_0_Template_mj_collapsible_panel_Navigate_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnNavigate($event)); });
63
+ i0.ɵɵconditionalCreate(1, MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_1_Template, 3, 1, "div", 2);
64
+ i0.ɵɵconditionalCreate(2, MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_2_Template, 3, 0, "div", 3)(3, MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_3_Template, 3, 0, "div", 4);
65
+ i0.ɵɵelementEnd();
66
+ i0.ɵɵconditionalCreate(4, MjFoldedSubtypeSectionComponent_Conditional_0_Conditional_4_Template, 1, 5, "mj-folded-subtype-section", 5);
67
+ } if (rf & 2) {
68
+ const ctx_r1 = i0.ɵɵnextContext();
69
+ i0.ɵɵproperty("SectionKey", ctx_r1.SectionKey)("SectionName", ctx_r1.SectionTitle)("Icon", ctx_r1.SectionIcon)("Form", ctx_r1.FormComponent)("FormContext", ctx_r1.FormContext)("Order", ctx_r1.SectionOrder)("DefaultExpanded", true);
70
+ i0.ɵɵadvance();
71
+ i0.ɵɵconditional(ctx_r1.RefusalWarningMessage ? 1 : -1);
72
+ i0.ɵɵadvance();
73
+ i0.ɵɵconditional(ctx_r1.ActiveUIDriverKey ? 2 : ctx_r1.ActiveChildRecord && ctx_r1.GeneratedFieldSpecs.length > 0 ? 3 : -1);
74
+ i0.ɵɵadvance(2);
75
+ i0.ɵɵconditional(ctx_r1.HasNestedFoldedSubtype && ctx_r1.ActiveChildRecord ? 4 : -1);
76
+ } }
77
+ /**
78
+ * Renders an entity's active IS-A subtype extension inline inside its parent form when
79
+ * `EntityInfo.SubtypeSelectorConfig?.FoldIntoForm === true`.
80
+ *
81
+ * Behavior:
82
+ * - Off unless the entity explicitly opts in with `"FoldIntoForm": true` in `SubtypeSelector`.
83
+ * - Immediately reconciles the prospective `ISAChild` as soon as a type is picked on `Record`
84
+ * (including on a brand-new record before its first save).
85
+ * - When `SubtypeSelector.UIDriver` resolves to a class registered with
86
+ * `@RegisterClass(EntitySubtypeUIDriverBase, key)`, mounts that component in place of the
87
+ * default generated fields.
88
+ * - Otherwise renders the resolved child entity's generated fields inside their own
89
+ * `<mj-collapsible-panel>`.
90
+ * - When a saved record already has a persisted child of one subtype and `OnSubtypeChange` is
91
+ * `'Refuse'`, surfaces an inline warning if the user selects a conflicting subtype in edit mode.
92
+ */
93
+ export class MjFoldedSubtypeSectionComponent extends BaseAngularComponent {
94
+ HostDisplay = 'contents';
95
+ cdr = inject(ChangeDetectorRef);
96
+ hostElement = inject(ElementRef);
97
+ fieldEdits = inject(FormFieldEditCoordinator, { optional: true });
98
+ recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });
99
+ chrome = inject(FormChromeCoordinator, { optional: true });
100
+ destroy$ = new Subject();
101
+ recordEventSub = null;
102
+ editModeSub = null;
103
+ _record = null;
104
+ _formComponent = null;
105
+ _formContext = undefined;
106
+ _editMode = false;
107
+ reconcileToken = 0;
108
+ lastWatchSignature = null;
109
+ mountedUIDriverRef = null;
110
+ mountedUIDriverKey = null;
111
+ /** Dynamic host anchor when a custom `UIDriver` component replaces generated fields. */
112
+ set UIDriverHost(vcr) {
113
+ this._uiDriverHost = vcr ?? null;
114
+ this.syncMountedUIDriver();
115
+ }
116
+ _uiDriverHost = null;
117
+ set Record(value) {
118
+ if (this._record === value)
119
+ return;
120
+ this.teardownRecordSubscription();
121
+ this._record = value;
122
+ this.lastWatchSignature = value && this.IsFoldEnabled ? this.computeWatchSignature(value) : null;
123
+ this.bindRecordSubscription(value);
124
+ void this.reconcileSubtype();
125
+ }
126
+ get Record() {
127
+ return this._record;
128
+ }
129
+ set FormComponent(value) {
130
+ if (this._formComponent === value)
131
+ return;
132
+ if (this._formComponent) {
133
+ this._formComponent.UnregisterSubtypeValidator(this);
134
+ }
135
+ this.editModeSub?.unsubscribe();
136
+ this.editModeSub = null;
137
+ this._formComponent = value;
138
+ if (value) {
139
+ value.RegisterSubtypeValidator(this);
140
+ this.editModeSub = value.EditModeChanged.subscribe(() => {
141
+ this.pushInputsToMountedUIDriver();
142
+ void this.reconcileSubtype();
143
+ this.cdr.markForCheck();
144
+ });
145
+ }
146
+ this.pushInputsToMountedUIDriver();
147
+ }
148
+ get FormComponent() {
149
+ return this._formComponent;
150
+ }
151
+ set FormContext(value) {
152
+ this._formContext = value;
153
+ this.pushInputsToMountedUIDriver();
154
+ }
155
+ get FormContext() {
156
+ return this._formContext ?? this._formComponent?.formContext;
157
+ }
158
+ set EditMode(value) {
159
+ this._editMode = value;
160
+ this.pushInputsToMountedUIDriver();
161
+ }
162
+ get EditMode() {
163
+ return this._formComponent ? this._formComponent.EditMode : this._editMode;
164
+ }
165
+ Navigate = new EventEmitter();
166
+ /** Resolved child record currently displayed in the folded section, if any. */
167
+ ActiveChildRecord = null;
168
+ /** Resolved `UIDriver` registration key when a registered `EntitySubtypeUIDriverBase` matches. */
169
+ ActiveUIDriverKey = null;
170
+ /** Derived field descriptors when rendering generated `<mj-form-field>` controls. */
171
+ GeneratedFieldSpecs = [];
172
+ /** Non-null when a saved record's subtype change conflicts with `OnSubtypeChange: 'Refuse'`. */
173
+ RefusalWarningMessage = null;
174
+ /** True when either a `UIDriver`, generated child fields, or a refusal warning should render. */
175
+ get ShouldRenderSection() {
176
+ if (!this.IsFoldEnabled)
177
+ return false;
178
+ if (this.ActiveUIDriverKey !== null)
179
+ return true;
180
+ if (this.RefusalWarningMessage !== null)
181
+ return true;
182
+ return this.ActiveChildRecord !== null && this.GeneratedFieldSpecs.length > 0;
183
+ }
184
+ /** Whether `FoldIntoForm` is enabled on the bound parent entity. */
185
+ get IsFoldEnabled() {
186
+ return this._record?.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true;
187
+ }
188
+ /** Metadata for the active child entity, if any. */
189
+ get ActiveChildEntityInfo() {
190
+ return this.ActiveChildRecord?.EntityInfo ?? null;
191
+ }
192
+ /** Stable `SectionKey` for `<mj-collapsible-panel>` state persistence & chrome routing. */
193
+ get SectionKey() {
194
+ if (this.ActiveChildEntityInfo) {
195
+ return `subtype_${this.ActiveChildEntityInfo.CodeName}`;
196
+ }
197
+ if (this.ActiveUIDriverKey) {
198
+ const safeKey = this.ActiveUIDriverKey.replace(/[^a-zA-Z0-9_]/g, '_');
199
+ return `subtype_ui_${safeKey}`;
200
+ }
201
+ return 'subtype_extension';
202
+ }
203
+ /** Human-readable section title shown in the collapsible panel header. */
204
+ get SectionTitle() {
205
+ if (this.ActiveChildEntityInfo) {
206
+ return this.ActiveChildEntityInfo.DisplayNameOrName;
207
+ }
208
+ return 'Type Details';
209
+ }
210
+ /** FontAwesome icon class for the collapsible panel header. */
211
+ get SectionIcon() {
212
+ return this.ActiveChildEntityInfo?.Icon || 'fa-solid fa-layer-group';
213
+ }
214
+ /** Whether the active child itself opts into `FoldIntoForm` for multi-level IS-A chains. */
215
+ get HasNestedFoldedSubtype() {
216
+ return Boolean(this.ActiveChildRecord &&
217
+ this.ActiveChildRecord.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true);
218
+ }
219
+ /**
220
+ * CSS flex `order` placing the folded subtype section immediately after the parent
221
+ * entity's own field sections and before related-entity grids.
222
+ */
223
+ get SectionOrder() {
224
+ const containerEl = this.hostElement.nativeElement.parentElement;
225
+ if (!containerEl || !this._formComponent?.getSectionDisplayOrder) {
226
+ return null;
227
+ }
228
+ let maxFieldOrder = null;
229
+ const panels = containerEl.querySelectorAll(':scope > mj-collapsible-panel');
230
+ panels.forEach((node) => {
231
+ const variant = node.getAttribute('data-variant') ?? 'default';
232
+ if (variant === 'related-entity')
233
+ return;
234
+ const key = node.getAttribute('data-section-key') ?? '';
235
+ if (!key || key === this.SectionKey)
236
+ return;
237
+ const order = this._formComponent.getSectionDisplayOrder(key);
238
+ if (maxFieldOrder === null || order > maxFieldOrder) {
239
+ maxFieldOrder = order;
240
+ }
241
+ });
242
+ return maxFieldOrder;
243
+ }
244
+ ngOnInit() {
245
+ this.fieldEdits?.Edited$.pipe(takeUntil(this.destroy$)).subscribe((edit) => {
246
+ if (this.shouldReconcileForField(edit.FieldName)) {
247
+ void this.reconcileSubtype();
248
+ }
249
+ });
250
+ this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe(() => {
251
+ void this.reconcileSubtype();
252
+ });
253
+ }
254
+ ngDoCheck() {
255
+ if (!this.IsFoldEnabled || !this._record)
256
+ return;
257
+ const sig = this.computeWatchSignature(this._record);
258
+ if (sig !== this.lastWatchSignature) {
259
+ this.lastWatchSignature = sig;
260
+ void this.reconcileSubtype();
261
+ }
262
+ }
263
+ ngOnDestroy() {
264
+ this.destroy$.next();
265
+ this.destroy$.complete();
266
+ this.teardownRecordSubscription();
267
+ this.editModeSub?.unsubscribe();
268
+ this.editModeSub = null;
269
+ if (this._formComponent) {
270
+ this._formComponent.UnregisterSubtypeValidator(this);
271
+ }
272
+ this.destroyMountedUIDriver();
273
+ }
274
+ /** Validates any mounted custom `UIDriver` component (async-capable). */
275
+ Validate() {
276
+ if (this.mountedUIDriverRef) {
277
+ return this.mountedUIDriverRef.instance.Validate();
278
+ }
279
+ const ok = new ValidationResult();
280
+ ok.Success = true;
281
+ return ok;
282
+ }
283
+ /** Synchronous validation snapshot from any mounted custom `UIDriver` component. */
284
+ LastKnownValidation() {
285
+ if (this.mountedUIDriverRef) {
286
+ return this.mountedUIDriverRef.instance.LastKnownValidation();
287
+ }
288
+ const ok = new ValidationResult();
289
+ ok.Success = true;
290
+ return ok;
291
+ }
292
+ OnNavigate(event) {
293
+ if (this._formComponent) {
294
+ this._formComponent.Navigate.emit(event);
295
+ }
296
+ this.Navigate.emit(event);
297
+ }
298
+ bindRecordSubscription(record) {
299
+ if (!record)
300
+ return;
301
+ this.recordEventSub = record.RegisterEventHandler((event) => {
302
+ if (event.type === 'load_complete' || event.type === 'save' || event.type === 'new_record') {
303
+ void this.reconcileSubtype();
304
+ }
305
+ });
306
+ }
307
+ teardownRecordSubscription() {
308
+ this.recordEventSub?.unsubscribe();
309
+ this.recordEventSub = null;
310
+ }
311
+ shouldReconcileForField(fieldName) {
312
+ if (!this._record || !fieldName)
313
+ return false;
314
+ const firstHop = this.firstHopSelectorFieldName(this._record);
315
+ if (!firstHop) {
316
+ // Entity may use a programmatic EntitySubtypeResolver; reconcile on any parent field edit.
317
+ return true;
318
+ }
319
+ return firstHop.toLowerCase() === fieldName.trim().toLowerCase();
320
+ }
321
+ firstHopSelectorFieldName(record) {
322
+ const path = record.EntityInfo?.SubtypeSelectorConfig?.Path?.trim();
323
+ if (!path)
324
+ return null;
325
+ const dotIdx = path.indexOf('.');
326
+ return dotIdx > 0 ? path.slice(0, dotIdx) : path;
327
+ }
328
+ computeWatchSignature(record) {
329
+ const firstHop = this.firstHopSelectorFieldName(record);
330
+ const rawVal = firstHop ? record.GetFieldByName(firstHop)?.Value : undefined;
331
+ const valKey = rawVal === null || rawVal === undefined ? '' : String(rawVal);
332
+ const childKey = record.ISAChild ? `${record.ISAChild.EntityInfo.Name}:${record.ISAChild.IsSaved ? '1' : '0'}` : '';
333
+ return `${valKey}|${childKey}`;
334
+ }
335
+ async reconcileSubtype() {
336
+ const token = ++this.reconcileToken;
337
+ const record = this._record;
338
+ if (!record || !this.IsFoldEnabled) {
339
+ this.applyResolvedState(null, null, [], null);
340
+ return;
341
+ }
342
+ try {
343
+ const prevSectionKey = this.ShouldRenderSection ? this.SectionKey : null;
344
+ await record.ReconcileISAChild();
345
+ if (token !== this.reconcileToken)
346
+ return;
347
+ const reconciledChild = record.ISAChild ?? null;
348
+ const targetEntityName = await record.ResolveSubtypeEntityName();
349
+ if (token !== this.reconcileToken)
350
+ return;
351
+ const uiDriverName = await record.ResolveSubtypeUIDriverName();
352
+ if (token !== this.reconcileToken)
353
+ return;
354
+ const resolvedUIDriverKey = this.findRegisteredUIDriverKey(uiDriverName);
355
+ let activeChild = reconciledChild;
356
+ let refusalMessage = null;
357
+ const savedChild = record.ISAChild?.IsSaved ? record.ISAChild : null;
358
+ if (savedChild && targetEntityName !== savedChild.EntityInfo.Name) {
359
+ const policy = record.EntityInfo.SubtypeSelectorConfig?.OnSubtypeChange ?? 'Refuse';
360
+ if (policy === 'Refuse') {
361
+ activeChild = savedChild;
362
+ refusalMessage =
363
+ `This record already has saved ${savedChild.EntityInfo.DisplayNameOrName} details. ` +
364
+ `Changing its type to ${targetEntityName ?? 'a type without that extension'} will be refused on save.`;
365
+ }
366
+ else {
367
+ // OnSubtypeChange === 'Replace': hide old saved child fields while editing toward a new/empty subtype
368
+ activeChild = null;
369
+ }
370
+ }
371
+ const specs = activeChild && resolvedUIDriverKey === null
372
+ ? ResolveGeneratedSubtypeFieldSpecs(activeChild.EntityInfo, this.ProviderToUse?.CurrentUser)
373
+ : [];
374
+ this.lastWatchSignature = this.computeWatchSignature(record);
375
+ this.applyResolvedState(activeChild, resolvedUIDriverKey, specs, refusalMessage);
376
+ const nextSectionKey = this.ShouldRenderSection ? this.SectionKey : null;
377
+ if (prevSectionKey !== nextSectionKey) {
378
+ // Schedule chrome refresh on next microtask after DOM updates
379
+ Promise.resolve().then(() => {
380
+ if (token === this.reconcileToken) {
381
+ this.chrome?.NotifySectionsChanged();
382
+ }
383
+ });
384
+ }
385
+ }
386
+ catch (e) {
387
+ LogError(`MjFoldedSubtypeSectionComponent.reconcileSubtype failed on ${record.EntityInfo?.Name}: ` +
388
+ `${e instanceof Error ? e.message : String(e)}`);
389
+ }
390
+ }
391
+ findRegisteredUIDriverKey(uiDriverName) {
392
+ if (!uiDriverName)
393
+ return null;
394
+ const reg = MJGlobal.Instance.ClassFactory.GetRegistration(EntitySubtypeUIDriverBase, uiDriverName);
395
+ return reg?.SubClass ? uiDriverName : null;
396
+ }
397
+ applyResolvedState(child, uiDriverKey, specs, refusalWarning) {
398
+ this.ActiveChildRecord = child;
399
+ this.ActiveUIDriverKey = uiDriverKey;
400
+ this.GeneratedFieldSpecs = specs;
401
+ this.RefusalWarningMessage = refusalWarning;
402
+ this.syncMountedUIDriver();
403
+ this.cdr.markForCheck();
404
+ }
405
+ syncMountedUIDriver() {
406
+ const key = this.ActiveUIDriverKey;
407
+ if (!key || !this._uiDriverHost) {
408
+ this.destroyMountedUIDriver();
409
+ return;
410
+ }
411
+ if (this.mountedUIDriverRef && this.mountedUIDriverKey === key) {
412
+ this.pushInputsToMountedUIDriver();
413
+ return;
414
+ }
415
+ this.destroyMountedUIDriver();
416
+ const reg = MJGlobal.Instance.ClassFactory.GetRegistration(EntitySubtypeUIDriverBase, key);
417
+ if (!reg?.SubClass)
418
+ return;
419
+ const componentType = reg.SubClass;
420
+ const ref = this._uiDriverHost.createComponent(componentType);
421
+ this.mountedUIDriverRef = ref;
422
+ this.mountedUIDriverKey = key;
423
+ const navSub = ref.instance.Navigate.subscribe((evt) => this.OnNavigate(evt));
424
+ const mutSub = ref.instance.RecordMutated.subscribe(() => this.cdr.markForCheck());
425
+ ref.onDestroy(() => {
426
+ navSub.unsubscribe();
427
+ mutSub.unsubscribe();
428
+ });
429
+ this.pushInputsToMountedUIDriver();
430
+ }
431
+ pushInputsToMountedUIDriver() {
432
+ if (!this.mountedUIDriverRef)
433
+ return;
434
+ const inst = this.mountedUIDriverRef.instance;
435
+ inst.Provider = this.Provider;
436
+ inst.Record = this._record;
437
+ inst.ChildRecord = this.ActiveChildRecord;
438
+ inst.EditMode = this.EditMode;
439
+ inst.Surface = 'form-section';
440
+ inst.FormComponent = this._formComponent;
441
+ inst.FormContext = this.FormContext;
442
+ this.mountedUIDriverRef.changeDetectorRef.markForCheck();
443
+ }
444
+ destroyMountedUIDriver() {
445
+ if (this.mountedUIDriverRef) {
446
+ this.mountedUIDriverRef.destroy();
447
+ this.mountedUIDriverRef = null;
448
+ this.mountedUIDriverKey = null;
449
+ }
450
+ this._uiDriverHost?.clear();
451
+ }
452
+ static ɵfac = /*@__PURE__*/ (() => { let ɵMjFoldedSubtypeSectionComponent_BaseFactory; return function MjFoldedSubtypeSectionComponent_Factory(__ngFactoryType__) { return (ɵMjFoldedSubtypeSectionComponent_BaseFactory || (ɵMjFoldedSubtypeSectionComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MjFoldedSubtypeSectionComponent)))(__ngFactoryType__ || MjFoldedSubtypeSectionComponent); }; })();
453
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MjFoldedSubtypeSectionComponent, selectors: [["mj-folded-subtype-section"]], viewQuery: function MjFoldedSubtypeSectionComponent_Query(rf, ctx) { if (rf & 1) {
454
+ i0.ɵɵviewQuery(_c0, 5, ViewContainerRef);
455
+ } if (rf & 2) {
456
+ let _t;
457
+ i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.UIDriverHost = _t.first);
458
+ } }, hostVars: 2, hostBindings: function MjFoldedSubtypeSectionComponent_HostBindings(rf, ctx) { if (rf & 2) {
459
+ i0.ɵɵstyleProp("display", ctx.HostDisplay);
460
+ } }, inputs: { Record: "Record", FormComponent: "FormComponent", FormContext: "FormContext", EditMode: "EditMode" }, outputs: { Navigate: "Navigate" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["uiDriverHost", ""], [3, "Navigate", "SectionKey", "SectionName", "Icon", "Form", "FormContext", "Order", "DefaultExpanded"], [1, "mj-folded-subtype-warning"], [1, "mj-folded-subtype-driver-host"], [1, "mj-folded-subtype-fields"], [3, "Provider", "Record", "FormComponent", "FormContext", "EditMode"], ["Variant", "warning", "Size", "sm", "Icon", "fa-solid fa-triangle-exclamation", "Role", "status"], [3, "Provider", "Record", "FieldName", "Type", "LinkType", "ShowLabel", "EditMode", "FormContext"], [3, "Navigate", "Provider", "Record", "FieldName", "Type", "LinkType", "ShowLabel", "EditMode", "FormContext"], [3, "Navigate", "Provider", "Record", "FormComponent", "FormContext", "EditMode"]], template: function MjFoldedSubtypeSectionComponent_Template(rf, ctx) { if (rf & 1) {
461
+ i0.ɵɵconditionalCreate(0, MjFoldedSubtypeSectionComponent_Conditional_0_Template, 5, 10);
462
+ } if (rf & 2) {
463
+ i0.ɵɵconditional(ctx.ShouldRenderSection ? 0 : -1);
464
+ } }, dependencies: [i1.MJAlertComponent, i2.MjFormFieldComponent, i3.MjCollapsiblePanelComponent, MjFoldedSubtypeSectionComponent], styles: [".mj-folded-subtype-warning {\n margin-bottom: var(--mj-space-3, 12px);\n}\n\n.mj-folded-subtype-driver-host {\n display: block;\n}\n\n.mj-folded-subtype-fields {\n display: contents;\n}\n"], encapsulation: 2, changeDetection: 0 });
465
+ }
466
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MjFoldedSubtypeSectionComponent, [{
467
+ type: Component,
468
+ args: [{ standalone: false, selector: 'mj-folded-subtype-section', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "@if (ShouldRenderSection) {\n <mj-collapsible-panel\n [SectionKey]=\"SectionKey\"\n [SectionName]=\"SectionTitle\"\n [Icon]=\"SectionIcon\"\n [Form]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [Order]=\"SectionOrder\"\n [DefaultExpanded]=\"true\"\n (Navigate)=\"OnNavigate($event)\">\n\n @if (RefusalWarningMessage) {\n <div class=\"mj-folded-subtype-warning\">\n <mj-alert\n Variant=\"warning\"\n Size=\"sm\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Role=\"status\">\n {{ RefusalWarningMessage }}\n </mj-alert>\n </div>\n }\n\n @if (ActiveUIDriverKey) {\n <div class=\"mj-folded-subtype-driver-host\">\n <ng-container #uiDriverHost></ng-container>\n </div>\n } @else if (ActiveChildRecord && GeneratedFieldSpecs.length > 0) {\n <div class=\"mj-folded-subtype-fields\">\n @for (spec of GeneratedFieldSpecs; track spec.FieldName) {\n <mj-form-field\n [Provider]=\"Provider\"\n [Record]=\"ActiveChildRecord\"\n [FieldName]=\"spec.FieldName\"\n [Type]=\"spec.ControlType\"\n [LinkType]=\"spec.LinkType\"\n [ShowLabel]=\"true\"\n [EditMode]=\"EditMode && RefusalWarningMessage === null\"\n [FormContext]=\"FormContext\"\n (Navigate)=\"OnNavigate($event)\">\n </mj-form-field>\n }\n </div>\n }\n </mj-collapsible-panel>\n\n @if (HasNestedFoldedSubtype && ActiveChildRecord) {\n <mj-folded-subtype-section\n [Provider]=\"Provider\"\n [Record]=\"ActiveChildRecord\"\n [FormComponent]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [EditMode]=\"EditMode\"\n (Navigate)=\"OnNavigate($event)\">\n </mj-folded-subtype-section>\n }\n}\n", styles: [".mj-folded-subtype-warning {\n margin-bottom: var(--mj-space-3, 12px);\n}\n\n.mj-folded-subtype-driver-host {\n display: block;\n}\n\n.mj-folded-subtype-fields {\n display: contents;\n}\n"] }]
469
+ }], null, { HostDisplay: [{
470
+ type: HostBinding,
471
+ args: ['style.display']
472
+ }], UIDriverHost: [{
473
+ type: ViewChild,
474
+ args: ['uiDriverHost', { read: ViewContainerRef }]
475
+ }], Record: [{
476
+ type: Input
477
+ }], FormComponent: [{
478
+ type: Input
479
+ }], FormContext: [{
480
+ type: Input
481
+ }], EditMode: [{
482
+ type: Input
483
+ }], Navigate: [{
484
+ type: Output
485
+ }] }); })();
486
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MjFoldedSubtypeSectionComponent, { className: "MjFoldedSubtypeSectionComponent", filePath: "src/lib/subtype-ui-driver/folded-subtype-section.component.ts", lineNumber: 61 }); })();
487
+ //# sourceMappingURL=folded-subtype-section.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folded-subtype-section.component.js","sourceRoot":"","sources":["../../../src/lib/subtype-ui-driver/folded-subtype-section.component.ts","../../../src/lib/subtype-ui-driver/folded-subtype-section.component.html"],"names":[],"mappings":"AAAA,OAAO,EACH,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EAGT,UAAU,EACV,YAAY,EACZ,WAAW,EACX,KAAK,EAGL,MAAM,EAEN,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,GACT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAA0B,QAAQ,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAIrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EACH,yBAAyB,EACzB,iCAAiC,GAEpC,MAAM,4BAA4B,CAAC;;;;;;;;ICrB5B,AADF,8BAAuC,kBAKrB;IACd,YACF;IACF,AADE,iBAAW,EACP;;;IAFF,eACF;IADE,6DACF;;;IAKF,8BAA2C;IACzC,iCAA2C;IAC7C,iBAAM;;;;IAIF,wCASkC;IAAhC,2OAAY,yBAAkB,KAAC;IACjC,iBAAgB;;;;IAFd,AADA,AADA,AADA,AADA,AADA,AADA,AADA,0CAAqB,oCACO,gCACA,6BACH,8BACC,mBACR,sEACqC,mCAC5B;;;IAVjC,8BAAsC;IACpC,wIAYC;IACH,iBAAM;;;IAbJ,cAYC;IAZD,yCAYC;;;;IAML,oDAMk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BAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QACnC,CAAC;QACD,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;ySA1ZQ,+BAA+B,yBAA/B,+BAA+B;6DAA/B,+BAA+B;mCAyBL,gBAAgB;;;;;YAzB1C,0CAA+B;;YC5D5C,wFAA2B;;YAA3B,kDAwDC;0GDIY,+BAA+B;;iFAA/B,+BAA+B;cAR3C,SAAS;6BACM,KAAK,YACP,2BAA2B,mBACpB,uBAAuB,CAAC,MAAM,iBAChC,iBAAiB,CAAC,IAAI;;kBAKpC,WAAW;mBAAC,eAAe;;kBAwB3B,SAAS;mBAAC,cAAc,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;;kBAOpD,KAAK;;kBAaL,KAAK;;kBAuBL,KAAK;;kBASL,KAAK;;kBASL,MAAM;;kFAtFE,+BAA+B","sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ComponentRef,\n DoCheck,\n ElementRef,\n EventEmitter,\n HostBinding,\n Input,\n OnDestroy,\n OnInit,\n Output,\n Type,\n ViewChild,\n ViewContainerRef,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { Subject, Subscription } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\nimport { BaseEntity, EntityInfo, LogError, ValidationResult } from '@memberjunction/core';\nimport { MJGlobal } from '@memberjunction/global';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport type { BaseFormComponent } from '../base-form-component';\nimport type { FormContext } from '../types/form-types';\nimport type { FormNavigationEvent } from '../types/navigation-events';\nimport { FormFieldEditCoordinator } from '../form-field-edit.coordinator';\nimport { FormRecordRefreshCoordinator } from '../form-record-refresh.coordinator';\nimport { FormChromeCoordinator } from '../chrome/form-chrome-coordinator.service';\nimport {\n EntitySubtypeUIDriverBase,\n ResolveGeneratedSubtypeFieldSpecs,\n type SubtypeGeneratedFieldSpec,\n} from './entity-subtype-ui-driver';\n\n/**\n * Renders an entity's active IS-A subtype extension inline inside its parent form when\n * `EntityInfo.SubtypeSelectorConfig?.FoldIntoForm === true`.\n *\n * Behavior:\n * - Off unless the entity explicitly opts in with `\"FoldIntoForm\": true` in `SubtypeSelector`.\n * - Immediately reconciles the prospective `ISAChild` as soon as a type is picked on `Record`\n * (including on a brand-new record before its first save).\n * - When `SubtypeSelector.UIDriver` resolves to a class registered with\n * `@RegisterClass(EntitySubtypeUIDriverBase, key)`, mounts that component in place of the\n * default generated fields.\n * - Otherwise renders the resolved child entity's generated fields inside their own\n * `<mj-collapsible-panel>`.\n * - When a saved record already has a persisted child of one subtype and `OnSubtypeChange` is\n * `'Refuse'`, surfaces an inline warning if the user selects a conflicting subtype in edit mode.\n */\n@Component({\n standalone: false,\n selector: 'mj-folded-subtype-section',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n templateUrl: './folded-subtype-section.component.html',\n styleUrls: ['./folded-subtype-section.component.css'],\n})\nexport class MjFoldedSubtypeSectionComponent extends BaseAngularComponent implements OnInit, DoCheck, OnDestroy {\n @HostBinding('style.display')\n public readonly HostDisplay = 'contents';\n\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly hostElement = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly fieldEdits = inject(FormFieldEditCoordinator, { optional: true });\n private readonly recordRefresh = inject(FormRecordRefreshCoordinator, { optional: true });\n private readonly chrome = inject(FormChromeCoordinator, { optional: true });\n\n private readonly destroy$ = new Subject<void>();\n private recordEventSub: Subscription | null = null;\n private editModeSub: Subscription | null = null;\n\n private _record: BaseEntity | null = null;\n private _formComponent: BaseFormComponent | null = null;\n private _formContext: FormContext | undefined = undefined;\n private _editMode = false;\n\n private reconcileToken = 0;\n private lastWatchSignature: string | null = null;\n private mountedUIDriverRef: ComponentRef<EntitySubtypeUIDriverBase> | null = null;\n private mountedUIDriverKey: string | null = null;\n\n /** Dynamic host anchor when a custom `UIDriver` component replaces generated fields. */\n @ViewChild('uiDriverHost', { read: ViewContainerRef })\n public set UIDriverHost(vcr: ViewContainerRef | undefined) {\n this._uiDriverHost = vcr ?? null;\n this.syncMountedUIDriver();\n }\n private _uiDriverHost: ViewContainerRef | null = null;\n\n @Input()\n public set Record(value: BaseEntity | null) {\n if (this._record === value) return;\n this.teardownRecordSubscription();\n this._record = value;\n this.lastWatchSignature = value && this.IsFoldEnabled ? this.computeWatchSignature(value) : null;\n this.bindRecordSubscription(value);\n void this.reconcileSubtype();\n }\n public get Record(): BaseEntity | null {\n return this._record;\n }\n\n @Input()\n public set FormComponent(value: BaseFormComponent | null) {\n if (this._formComponent === value) return;\n if (this._formComponent) {\n this._formComponent.UnregisterSubtypeValidator(this);\n }\n this.editModeSub?.unsubscribe();\n this.editModeSub = null;\n this._formComponent = value;\n if (value) {\n value.RegisterSubtypeValidator(this);\n this.editModeSub = value.EditModeChanged.subscribe(() => {\n this.pushInputsToMountedUIDriver();\n void this.reconcileSubtype();\n this.cdr.markForCheck();\n });\n }\n this.pushInputsToMountedUIDriver();\n }\n public get FormComponent(): BaseFormComponent | null {\n return this._formComponent;\n }\n\n @Input()\n public set FormContext(value: FormContext | undefined) {\n this._formContext = value;\n this.pushInputsToMountedUIDriver();\n }\n public get FormContext(): FormContext | undefined {\n return this._formContext ?? this._formComponent?.formContext;\n }\n\n @Input()\n public set EditMode(value: boolean) {\n this._editMode = value;\n this.pushInputsToMountedUIDriver();\n }\n public get EditMode(): boolean {\n return this._formComponent ? this._formComponent.EditMode : this._editMode;\n }\n\n @Output()\n public readonly Navigate = new EventEmitter<FormNavigationEvent>();\n\n /** Resolved child record currently displayed in the folded section, if any. */\n public ActiveChildRecord: BaseEntity | null = null;\n\n /** Resolved `UIDriver` registration key when a registered `EntitySubtypeUIDriverBase` matches. */\n public ActiveUIDriverKey: string | null = null;\n\n /** Derived field descriptors when rendering generated `<mj-form-field>` controls. */\n public GeneratedFieldSpecs: SubtypeGeneratedFieldSpec[] = [];\n\n /** Non-null when a saved record's subtype change conflicts with `OnSubtypeChange: 'Refuse'`. */\n public RefusalWarningMessage: string | null = null;\n\n /** True when either a `UIDriver`, generated child fields, or a refusal warning should render. */\n public get ShouldRenderSection(): boolean {\n if (!this.IsFoldEnabled) return false;\n if (this.ActiveUIDriverKey !== null) return true;\n if (this.RefusalWarningMessage !== null) return true;\n return this.ActiveChildRecord !== null && this.GeneratedFieldSpecs.length > 0;\n }\n\n /** Whether `FoldIntoForm` is enabled on the bound parent entity. */\n public get IsFoldEnabled(): boolean {\n return this._record?.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true;\n }\n\n /** Metadata for the active child entity, if any. */\n public get ActiveChildEntityInfo(): EntityInfo | null {\n return this.ActiveChildRecord?.EntityInfo ?? null;\n }\n\n /** Stable `SectionKey` for `<mj-collapsible-panel>` state persistence & chrome routing. */\n public get SectionKey(): string {\n if (this.ActiveChildEntityInfo) {\n return `subtype_${this.ActiveChildEntityInfo.CodeName}`;\n }\n if (this.ActiveUIDriverKey) {\n const safeKey = this.ActiveUIDriverKey.replace(/[^a-zA-Z0-9_]/g, '_');\n return `subtype_ui_${safeKey}`;\n }\n return 'subtype_extension';\n }\n\n /** Human-readable section title shown in the collapsible panel header. */\n public get SectionTitle(): string {\n if (this.ActiveChildEntityInfo) {\n return this.ActiveChildEntityInfo.DisplayNameOrName;\n }\n return 'Type Details';\n }\n\n /** FontAwesome icon class for the collapsible panel header. */\n public get SectionIcon(): string {\n return this.ActiveChildEntityInfo?.Icon || 'fa-solid fa-layer-group';\n }\n\n /** Whether the active child itself opts into `FoldIntoForm` for multi-level IS-A chains. */\n public get HasNestedFoldedSubtype(): boolean {\n return Boolean(\n this.ActiveChildRecord &&\n this.ActiveChildRecord.EntityInfo?.SubtypeSelectorConfig?.FoldIntoForm === true,\n );\n }\n\n /**\n * CSS flex `order` placing the folded subtype section immediately after the parent\n * entity's own field sections and before related-entity grids.\n */\n public get SectionOrder(): number | null {\n const containerEl = this.hostElement.nativeElement.parentElement;\n if (!containerEl || !this._formComponent?.getSectionDisplayOrder) {\n return null;\n }\n let maxFieldOrder: number | null = null;\n const panels = containerEl.querySelectorAll(':scope > mj-collapsible-panel');\n panels.forEach((node: Element) => {\n const variant = node.getAttribute('data-variant') ?? 'default';\n if (variant === 'related-entity') return;\n const key = node.getAttribute('data-section-key') ?? '';\n if (!key || key === this.SectionKey) return;\n const order = this._formComponent!.getSectionDisplayOrder(key);\n if (maxFieldOrder === null || order > maxFieldOrder) {\n maxFieldOrder = order;\n }\n });\n return maxFieldOrder;\n }\n\n public ngOnInit(): void {\n this.fieldEdits?.Edited$.pipe(takeUntil(this.destroy$)).subscribe((edit) => {\n if (this.shouldReconcileForField(edit.FieldName)) {\n void this.reconcileSubtype();\n }\n });\n this.recordRefresh?.Refreshed$.pipe(takeUntil(this.destroy$)).subscribe(() => {\n void this.reconcileSubtype();\n });\n }\n\n public ngDoCheck(): void {\n if (!this.IsFoldEnabled || !this._record) return;\n const sig = this.computeWatchSignature(this._record);\n if (sig !== this.lastWatchSignature) {\n this.lastWatchSignature = sig;\n void this.reconcileSubtype();\n }\n }\n\n public ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n this.teardownRecordSubscription();\n this.editModeSub?.unsubscribe();\n this.editModeSub = null;\n if (this._formComponent) {\n this._formComponent.UnregisterSubtypeValidator(this);\n }\n this.destroyMountedUIDriver();\n }\n\n /** Validates any mounted custom `UIDriver` component (async-capable). */\n public Validate(): ValidationResult | Promise<ValidationResult> {\n if (this.mountedUIDriverRef) {\n return this.mountedUIDriverRef.instance.Validate();\n }\n const ok = new ValidationResult();\n ok.Success = true;\n return ok;\n }\n\n /** Synchronous validation snapshot from any mounted custom `UIDriver` component. */\n public LastKnownValidation(): ValidationResult {\n if (this.mountedUIDriverRef) {\n return this.mountedUIDriverRef.instance.LastKnownValidation();\n }\n const ok = new ValidationResult();\n ok.Success = true;\n return ok;\n }\n\n public OnNavigate(event: FormNavigationEvent): void {\n if (this._formComponent) {\n this._formComponent.Navigate.emit(event);\n }\n this.Navigate.emit(event);\n }\n\n private bindRecordSubscription(record: BaseEntity | null): void {\n if (!record) return;\n this.recordEventSub = record.RegisterEventHandler((event) => {\n if (event.type === 'load_complete' || event.type === 'save' || event.type === 'new_record') {\n void this.reconcileSubtype();\n }\n });\n }\n\n private teardownRecordSubscription(): void {\n this.recordEventSub?.unsubscribe();\n this.recordEventSub = null;\n }\n\n private shouldReconcileForField(fieldName: string): boolean {\n if (!this._record || !fieldName) return false;\n const firstHop = this.firstHopSelectorFieldName(this._record);\n if (!firstHop) {\n // Entity may use a programmatic EntitySubtypeResolver; reconcile on any parent field edit.\n return true;\n }\n return firstHop.toLowerCase() === fieldName.trim().toLowerCase();\n }\n\n private firstHopSelectorFieldName(record: BaseEntity): string | null {\n const path = record.EntityInfo?.SubtypeSelectorConfig?.Path?.trim();\n if (!path) return null;\n const dotIdx = path.indexOf('.');\n return dotIdx > 0 ? path.slice(0, dotIdx) : path;\n }\n\n private computeWatchSignature(record: BaseEntity): string {\n const firstHop = this.firstHopSelectorFieldName(record);\n const rawVal = firstHop ? record.GetFieldByName(firstHop)?.Value : undefined;\n const valKey = rawVal === null || rawVal === undefined ? '' : String(rawVal);\n const childKey = record.ISAChild ? `${record.ISAChild.EntityInfo.Name}:${record.ISAChild.IsSaved ? '1' : '0'}` : '';\n return `${valKey}|${childKey}`;\n }\n\n private async reconcileSubtype(): Promise<void> {\n const token = ++this.reconcileToken;\n const record = this._record;\n\n if (!record || !this.IsFoldEnabled) {\n this.applyResolvedState(null, null, [], null);\n return;\n }\n\n try {\n const prevSectionKey = this.ShouldRenderSection ? this.SectionKey : null;\n\n await record.ReconcileISAChild();\n if (token !== this.reconcileToken) return;\n const reconciledChild = record.ISAChild ?? null;\n\n const targetEntityName = await record.ResolveSubtypeEntityName();\n if (token !== this.reconcileToken) return;\n\n const uiDriverName = await record.ResolveSubtypeUIDriverName();\n if (token !== this.reconcileToken) return;\n\n const resolvedUIDriverKey = this.findRegisteredUIDriverKey(uiDriverName);\n\n let activeChild: BaseEntity | null = reconciledChild;\n let refusalMessage: string | null = null;\n\n const savedChild = record.ISAChild?.IsSaved ? record.ISAChild : null;\n if (savedChild && targetEntityName !== savedChild.EntityInfo.Name) {\n const policy = record.EntityInfo.SubtypeSelectorConfig?.OnSubtypeChange ?? 'Refuse';\n if (policy === 'Refuse') {\n activeChild = savedChild;\n refusalMessage =\n `This record already has saved ${savedChild.EntityInfo.DisplayNameOrName} details. ` +\n `Changing its type to ${targetEntityName ?? 'a type without that extension'} will be refused on save.`;\n } else {\n // OnSubtypeChange === 'Replace': hide old saved child fields while editing toward a new/empty subtype\n activeChild = null;\n }\n }\n\n const specs =\n activeChild && resolvedUIDriverKey === null\n ? ResolveGeneratedSubtypeFieldSpecs(activeChild.EntityInfo, this.ProviderToUse?.CurrentUser)\n : [];\n\n this.lastWatchSignature = this.computeWatchSignature(record);\n this.applyResolvedState(activeChild, resolvedUIDriverKey, specs, refusalMessage);\n\n const nextSectionKey = this.ShouldRenderSection ? this.SectionKey : null;\n if (prevSectionKey !== nextSectionKey) {\n // Schedule chrome refresh on next microtask after DOM updates\n Promise.resolve().then(() => {\n if (token === this.reconcileToken) {\n this.chrome?.NotifySectionsChanged();\n }\n });\n }\n } catch (e) {\n LogError(\n `MjFoldedSubtypeSectionComponent.reconcileSubtype failed on ${record.EntityInfo?.Name}: ` +\n `${e instanceof Error ? e.message : String(e)}`,\n );\n }\n }\n\n private findRegisteredUIDriverKey(uiDriverName: string | null): string | null {\n if (!uiDriverName) return null;\n const reg = MJGlobal.Instance.ClassFactory.GetRegistration(EntitySubtypeUIDriverBase, uiDriverName);\n return reg?.SubClass ? uiDriverName : null;\n }\n\n private applyResolvedState(\n child: BaseEntity | null,\n uiDriverKey: string | null,\n specs: SubtypeGeneratedFieldSpec[],\n refusalWarning: string | null,\n ): void {\n this.ActiveChildRecord = child;\n this.ActiveUIDriverKey = uiDriverKey;\n this.GeneratedFieldSpecs = specs;\n this.RefusalWarningMessage = refusalWarning;\n this.syncMountedUIDriver();\n this.cdr.markForCheck();\n }\n\n private syncMountedUIDriver(): void {\n const key = this.ActiveUIDriverKey;\n if (!key || !this._uiDriverHost) {\n this.destroyMountedUIDriver();\n return;\n }\n if (this.mountedUIDriverRef && this.mountedUIDriverKey === key) {\n this.pushInputsToMountedUIDriver();\n return;\n }\n\n this.destroyMountedUIDriver();\n const reg = MJGlobal.Instance.ClassFactory.GetRegistration(EntitySubtypeUIDriverBase, key);\n if (!reg?.SubClass) return;\n\n const componentType = reg.SubClass as Type<EntitySubtypeUIDriverBase>;\n const ref = this._uiDriverHost.createComponent(componentType);\n this.mountedUIDriverRef = ref;\n this.mountedUIDriverKey = key;\n\n const navSub = ref.instance.Navigate.subscribe((evt: FormNavigationEvent) => this.OnNavigate(evt));\n const mutSub = ref.instance.RecordMutated.subscribe(() => this.cdr.markForCheck());\n ref.onDestroy(() => {\n navSub.unsubscribe();\n mutSub.unsubscribe();\n });\n\n this.pushInputsToMountedUIDriver();\n }\n\n private pushInputsToMountedUIDriver(): void {\n if (!this.mountedUIDriverRef) return;\n const inst = this.mountedUIDriverRef.instance;\n inst.Provider = this.Provider;\n inst.Record = this._record;\n inst.ChildRecord = this.ActiveChildRecord;\n inst.EditMode = this.EditMode;\n inst.Surface = 'form-section';\n inst.FormComponent = this._formComponent;\n inst.FormContext = this.FormContext;\n this.mountedUIDriverRef.changeDetectorRef.markForCheck();\n }\n\n private destroyMountedUIDriver(): void {\n if (this.mountedUIDriverRef) {\n this.mountedUIDriverRef.destroy();\n this.mountedUIDriverRef = null;\n this.mountedUIDriverKey = null;\n }\n this._uiDriverHost?.clear();\n }\n}\n","@if (ShouldRenderSection) {\n <mj-collapsible-panel\n [SectionKey]=\"SectionKey\"\n [SectionName]=\"SectionTitle\"\n [Icon]=\"SectionIcon\"\n [Form]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [Order]=\"SectionOrder\"\n [DefaultExpanded]=\"true\"\n (Navigate)=\"OnNavigate($event)\">\n\n @if (RefusalWarningMessage) {\n <div class=\"mj-folded-subtype-warning\">\n <mj-alert\n Variant=\"warning\"\n Size=\"sm\"\n Icon=\"fa-solid fa-triangle-exclamation\"\n Role=\"status\">\n {{ RefusalWarningMessage }}\n </mj-alert>\n </div>\n }\n\n @if (ActiveUIDriverKey) {\n <div class=\"mj-folded-subtype-driver-host\">\n <ng-container #uiDriverHost></ng-container>\n </div>\n } @else if (ActiveChildRecord && GeneratedFieldSpecs.length > 0) {\n <div class=\"mj-folded-subtype-fields\">\n @for (spec of GeneratedFieldSpecs; track spec.FieldName) {\n <mj-form-field\n [Provider]=\"Provider\"\n [Record]=\"ActiveChildRecord\"\n [FieldName]=\"spec.FieldName\"\n [Type]=\"spec.ControlType\"\n [LinkType]=\"spec.LinkType\"\n [ShowLabel]=\"true\"\n [EditMode]=\"EditMode && RefusalWarningMessage === null\"\n [FormContext]=\"FormContext\"\n (Navigate)=\"OnNavigate($event)\">\n </mj-form-field>\n }\n </div>\n }\n </mj-collapsible-panel>\n\n @if (HasNestedFoldedSubtype && ActiveChildRecord) {\n <mj-folded-subtype-section\n [Provider]=\"Provider\"\n [Record]=\"ActiveChildRecord\"\n [FormComponent]=\"FormComponent\"\n [FormContext]=\"FormContext\"\n [EditMode]=\"EditMode\"\n (Navigate)=\"OnNavigate($event)\">\n </mj-folded-subtype-section>\n }\n}\n"]}
@@ -39,8 +39,8 @@ RecordCommentsToolbarAction = __decorate([
39
39
  RegisterFormToolbarAction({
40
40
  Key: 'comments',
41
41
  EntityScope: '*',
42
- MenuLabel: 'Comments',
43
- Description: 'View all comments on this record',
42
+ MenuLabel: 'Notes & suggestions',
43
+ Description: 'View notes and field suggestions on this record',
44
44
  Icon: 'fa-regular fa-comment-dots',
45
45
  Mode: 'read',
46
46
  Placement: 'actions',
@@ -1 +1 @@
1
- {"version":3,"file":"record-comments-toolbar-action.js","sourceRoot":"","sources":["../../../../src/lib/toolbar/actions/record-comments-toolbar-action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,qBAAqB,EAErB,yBAAyB,EAC5B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;GAQG;AAYI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,qBAAqB;IAClD,YAAY,CAAC,GAAsC;QAC/D,OAAO,OAAO,CACV,GAAG,CAAC,MAAM,EAAE,OAAO;YACnB,GAAG,CAAC,UAAU;YACd,GAAG,CAAC,UAAU,CAAC,mBAAmB,KAAK,KAAK,CAC/C,CAAC;IACN,CAAC;IAEe,SAAS,CAAC,GAAsC;QAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,qBAAqB,EAAE,EAAE,IAAI,CAAC,CAAC;QACjD,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC5C,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;IAEe,iBAAiB,CAAC,GAAsC;QACpE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAEe,SAAS,CAAC,GAAsC;QAC5D,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,KAAK,CAAC,CAAC;QAChE,GAAG,CAAC,2BAA2B,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC5C,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxB,GAAG,CAAC,sBAAsB,EAAE,CAAC;IACjC,CAAC;CACJ,CAAA;AAzBY,2BAA2B;IAXvC,yBAAyB,CAAC;QACvB,GAAG,EAAE,UAAU;QACf,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,UAAU;QACrB,WAAW,EAAE,kCAAkC;QAC/C,IAAI,EAAE,4BAA4B;QAClC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;KACjB,CAAC;GACW,2BAA2B,CAyBvC","sourcesContent":["import {\n BaseFormToolbarAction,\n FormToolbarActionLifecycleContext,\n RegisterFormToolbarAction\n} from '../base-form-toolbar-action';\n\n/**\n * Built-in pluggable toolbar action for the Anchored Record Comments drawer (`Key: 'comments'`).\n *\n * - Registered globally (`EntityScope: '*'`) and pinnable (`Pinnable: true`).\n * - Available in both `'read'` and `'edit'` modes (`Mode: 'both'`) so collaborators can read\n * and reply to field/section comments while editing a record.\n * - Badge count reflects the number of open (unresolved) anchored comment threads on the record,\n * pre-warmed by {@link FormRecordCommentsCoordinatorService}.\n */\n@RegisterFormToolbarAction({\n Key: 'comments',\n EntityScope: '*',\n MenuLabel: 'Comments',\n Description: 'View all comments on this record',\n Icon: 'fa-regular fa-comment-dots',\n Mode: 'read',\n Placement: 'actions',\n Order: 62,\n Pinnable: true\n})\nexport class RecordCommentsToolbarAction extends BaseFormToolbarAction {\n public override IsApplicable(ctx: FormToolbarActionLifecycleContext): boolean {\n return Boolean(\n ctx.Record?.IsSaved &&\n ctx.EntityInfo &&\n ctx.EntityInfo.AllowRecordComments !== false\n );\n }\n\n public override OnPrewarm(ctx: FormToolbarActionLifecycleContext): void {\n const count = ctx.GetRecordCommentCount?.() ?? 0;\n ctx.SetBadge(count > 0 ? count : undefined);\n ctx.SetActive(Boolean(ctx.IsRecordCommentsDrawerOpen?.()));\n }\n\n public override OnRecordRefreshed(ctx: FormToolbarActionLifecycleContext): void {\n this.OnPrewarm(ctx);\n }\n\n public override OnExecute(ctx: FormToolbarActionLifecycleContext): void {\n const nextOpen = !(ctx.IsRecordCommentsDrawerOpen?.() ?? false);\n ctx.SetRecordCommentsDrawerOpen?.(nextOpen);\n ctx.SetActive(nextOpen);\n ctx.RequestChangeDetection();\n }\n}\n"]}
1
+ {"version":3,"file":"record-comments-toolbar-action.js","sourceRoot":"","sources":["../../../../src/lib/toolbar/actions/record-comments-toolbar-action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACH,qBAAqB,EAErB,yBAAyB,EAC5B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;GAQG;AAYI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,qBAAqB;IAClD,YAAY,CAAC,GAAsC;QAC/D,OAAO,OAAO,CACV,GAAG,CAAC,MAAM,EAAE,OAAO;YACnB,GAAG,CAAC,UAAU;YACd,GAAG,CAAC,UAAU,CAAC,mBAAmB,KAAK,KAAK,CAC/C,CAAC;IACN,CAAC;IAEe,SAAS,CAAC,GAAsC;QAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,qBAAqB,EAAE,EAAE,IAAI,CAAC,CAAC;QACjD,GAAG,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC5C,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAC,CAAC;IAC/D,CAAC;IAEe,iBAAiB,CAAC,GAAsC;QACpE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAEe,SAAS,CAAC,GAAsC;QAC5D,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,0BAA0B,EAAE,EAAE,IAAI,KAAK,CAAC,CAAC;QAChE,GAAG,CAAC,2BAA2B,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC5C,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxB,GAAG,CAAC,sBAAsB,EAAE,CAAC;IACjC,CAAC;CACJ,CAAA;AAzBY,2BAA2B;IAXvC,yBAAyB,CAAC;QACvB,GAAG,EAAE,UAAU;QACf,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,qBAAqB;QAChC,WAAW,EAAE,iDAAiD;QAC9D,IAAI,EAAE,4BAA4B;QAClC,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,SAAS;QACpB,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,IAAI;KACjB,CAAC;GACW,2BAA2B,CAyBvC","sourcesContent":["import {\n BaseFormToolbarAction,\n FormToolbarActionLifecycleContext,\n RegisterFormToolbarAction\n} from '../base-form-toolbar-action';\n\n/**\n * Built-in pluggable toolbar action for the Anchored Record Comments drawer (`Key: 'comments'`).\n *\n * - Registered globally (`EntityScope: '*'`) and pinnable (`Pinnable: true`).\n * - Available in both `'read'` and `'edit'` modes (`Mode: 'both'`) so collaborators can read\n * and reply to field/section comments while editing a record.\n * - Badge count reflects the number of open (unresolved) anchored comment threads on the record,\n * pre-warmed by {@link FormRecordCommentsCoordinatorService}.\n */\n@RegisterFormToolbarAction({\n Key: 'comments',\n EntityScope: '*',\n MenuLabel: 'Notes & suggestions',\n Description: 'View notes and field suggestions on this record',\n Icon: 'fa-regular fa-comment-dots',\n Mode: 'read',\n Placement: 'actions',\n Order: 62,\n Pinnable: true\n})\nexport class RecordCommentsToolbarAction extends BaseFormToolbarAction {\n public override IsApplicable(ctx: FormToolbarActionLifecycleContext): boolean {\n return Boolean(\n ctx.Record?.IsSaved &&\n ctx.EntityInfo &&\n ctx.EntityInfo.AllowRecordComments !== false\n );\n }\n\n public override OnPrewarm(ctx: FormToolbarActionLifecycleContext): void {\n const count = ctx.GetRecordCommentCount?.() ?? 0;\n ctx.SetBadge(count > 0 ? count : undefined);\n ctx.SetActive(Boolean(ctx.IsRecordCommentsDrawerOpen?.()));\n }\n\n public override OnRecordRefreshed(ctx: FormToolbarActionLifecycleContext): void {\n this.OnPrewarm(ctx);\n }\n\n public override OnExecute(ctx: FormToolbarActionLifecycleContext): void {\n const nextOpen = !(ctx.IsRecordCommentsDrawerOpen?.() ?? false);\n ctx.SetRecordCommentsDrawerOpen?.(nextOpen);\n ctx.SetActive(nextOpen);\n ctx.RequestChangeDetection();\n }\n}\n"]}
@@ -317,6 +317,8 @@ export declare class MjFormToolbarComponent extends BaseAngularComponent impleme
317
317
  OnEdit(): void;
318
318
  OnSave(): void;
319
319
  OnCancel(): void;
320
+ /** The Discard confirm's message: how many unsaved changes the user is about to lose. */
321
+ get DiscardMessage(): string;
320
322
  OnDiscardConfirm(): void;
321
323
  OnDiscardCancel(): void;
322
324
  private emitCancel;