@memberjunction/ng-base-forms 5.37.0 → 5.39.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 (114) hide show
  1. package/README.md +53 -0
  2. package/dist/lib/base-form-component.d.ts +46 -0
  3. package/dist/lib/base-form-component.d.ts.map +1 -1
  4. package/dist/lib/base-form-component.js +68 -2
  5. package/dist/lib/base-form-component.js.map +1 -1
  6. package/dist/lib/container/record-form-container.component.d.ts +77 -1
  7. package/dist/lib/container/record-form-container.component.d.ts.map +1 -1
  8. package/dist/lib/container/record-form-container.component.js +157 -39
  9. package/dist/lib/container/record-form-container.component.js.map +1 -1
  10. package/dist/lib/field/fk-search-utils.d.ts +31 -0
  11. package/dist/lib/field/fk-search-utils.d.ts.map +1 -0
  12. package/dist/lib/field/fk-search-utils.js +47 -0
  13. package/dist/lib/field/fk-search-utils.js.map +1 -0
  14. package/dist/lib/field/form-field.component.d.ts +401 -6
  15. package/dist/lib/field/form-field.component.d.ts.map +1 -1
  16. package/dist/lib/field/form-field.component.js +1646 -214
  17. package/dist/lib/field/form-field.component.js.map +1 -1
  18. package/dist/lib/field/linked-field-options.d.ts +76 -0
  19. package/dist/lib/field/linked-field-options.d.ts.map +1 -0
  20. package/dist/lib/field/linked-field-options.js +80 -0
  21. package/dist/lib/field/linked-field-options.js.map +1 -0
  22. package/dist/lib/host/entity-form-host.component.d.ts +159 -0
  23. package/dist/lib/host/entity-form-host.component.d.ts.map +1 -0
  24. package/dist/lib/host/entity-form-host.component.js +539 -0
  25. package/dist/lib/host/entity-form-host.component.js.map +1 -0
  26. package/dist/lib/interactive-form/interactive-form.component.d.ts +181 -0
  27. package/dist/lib/interactive-form/interactive-form.component.d.ts.map +1 -0
  28. package/dist/lib/interactive-form/interactive-form.component.js +560 -0
  29. package/dist/lib/interactive-form/interactive-form.component.js.map +1 -0
  30. package/dist/lib/isa-related-panel/isa-related-card.component.js +2 -2
  31. package/dist/lib/overlays/base-form-overlay.d.ts +114 -0
  32. package/dist/lib/overlays/base-form-overlay.d.ts.map +1 -0
  33. package/dist/lib/overlays/base-form-overlay.js +227 -0
  34. package/dist/lib/overlays/base-form-overlay.js.map +1 -0
  35. package/dist/lib/overlays/form-dialog.component.d.ts +35 -0
  36. package/dist/lib/overlays/form-dialog.component.d.ts.map +1 -0
  37. package/dist/lib/overlays/form-dialog.component.js +92 -0
  38. package/dist/lib/overlays/form-dialog.component.js.map +1 -0
  39. package/dist/lib/overlays/form-presenter.service.d.ts +37 -0
  40. package/dist/lib/overlays/form-presenter.service.d.ts.map +1 -0
  41. package/dist/lib/overlays/form-presenter.service.js +130 -0
  42. package/dist/lib/overlays/form-presenter.service.js.map +1 -0
  43. package/dist/lib/overlays/form-presenter.types.d.ts +65 -0
  44. package/dist/lib/overlays/form-presenter.types.d.ts.map +1 -0
  45. package/dist/lib/overlays/form-presenter.types.js +25 -0
  46. package/dist/lib/overlays/form-presenter.types.js.map +1 -0
  47. package/dist/lib/overlays/form-slide-in.component.d.ts +38 -0
  48. package/dist/lib/overlays/form-slide-in.component.d.ts.map +1 -0
  49. package/dist/lib/overlays/form-slide-in.component.js +106 -0
  50. package/dist/lib/overlays/form-slide-in.component.js.map +1 -0
  51. package/dist/lib/overlays/form-window.component.d.ts +32 -0
  52. package/dist/lib/overlays/form-window.component.d.ts.map +1 -0
  53. package/dist/lib/overlays/form-window.component.js +93 -0
  54. package/dist/lib/overlays/form-window.component.js.map +1 -0
  55. package/dist/lib/panel/collapsible-panel.component.d.ts +19 -2
  56. package/dist/lib/panel/collapsible-panel.component.d.ts.map +1 -1
  57. package/dist/lib/panel/collapsible-panel.component.js +70 -13
  58. package/dist/lib/panel/collapsible-panel.component.js.map +1 -1
  59. package/dist/lib/panel-slot/base-form-panel.d.ts +97 -0
  60. package/dist/lib/panel-slot/base-form-panel.d.ts.map +1 -0
  61. package/dist/lib/panel-slot/base-form-panel.js +64 -0
  62. package/dist/lib/panel-slot/base-form-panel.js.map +1 -0
  63. package/dist/lib/panel-slot/form-panel-slot.component.d.ts +78 -0
  64. package/dist/lib/panel-slot/form-panel-slot.component.d.ts.map +1 -0
  65. package/dist/lib/panel-slot/form-panel-slot.component.js +227 -0
  66. package/dist/lib/panel-slot/form-panel-slot.component.js.map +1 -0
  67. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts +57 -0
  68. package/dist/lib/panel-slot/form-slot-coordinator.service.d.ts.map +1 -0
  69. package/dist/lib/panel-slot/form-slot-coordinator.service.js +104 -0
  70. package/dist/lib/panel-slot/form-slot-coordinator.service.js.map +1 -0
  71. package/dist/lib/resolver/form-resolver.service.d.ts +139 -0
  72. package/dist/lib/resolver/form-resolver.service.d.ts.map +1 -0
  73. package/dist/lib/resolver/form-resolver.service.js +235 -0
  74. package/dist/lib/resolver/form-resolver.service.js.map +1 -0
  75. package/dist/lib/section-manager/section-manager.component.js +2 -2
  76. package/dist/lib/toolbar/form-toolbar.component.d.ts +56 -1
  77. package/dist/lib/toolbar/form-toolbar.component.d.ts.map +1 -1
  78. package/dist/lib/toolbar/form-toolbar.component.js +294 -136
  79. package/dist/lib/toolbar/form-toolbar.component.js.map +1 -1
  80. package/dist/lib/types/entity-form-config.d.ts +125 -0
  81. package/dist/lib/types/entity-form-config.d.ts.map +1 -0
  82. package/dist/lib/types/entity-form-config.js +75 -0
  83. package/dist/lib/types/entity-form-config.js.map +1 -0
  84. package/dist/lib/types/form-types.d.ts +24 -0
  85. package/dist/lib/types/form-types.d.ts.map +1 -1
  86. package/dist/lib/types/form-types.js.map +1 -1
  87. package/dist/lib/types/navigation-events.d.ts +64 -2
  88. package/dist/lib/types/navigation-events.d.ts.map +1 -1
  89. package/dist/lib/types/navigation-events.js.map +1 -1
  90. package/dist/lib/types/toolbar-config.d.ts +11 -0
  91. package/dist/lib/types/toolbar-config.d.ts.map +1 -1
  92. package/dist/lib/types/toolbar-config.js +3 -0
  93. package/dist/lib/types/toolbar-config.js.map +1 -1
  94. package/dist/module.d.ts +14 -7
  95. package/dist/module.d.ts.map +1 -1
  96. package/dist/module.js +40 -7
  97. package/dist/module.js.map +1 -1
  98. package/dist/public-api.d.ts +15 -0
  99. package/dist/public-api.d.ts.map +1 -1
  100. package/dist/public-api.js +21 -0
  101. package/dist/public-api.js.map +1 -1
  102. package/package.json +17 -11
  103. package/dist/__tests__/sanity.test.d.ts +0 -2
  104. package/dist/__tests__/sanity.test.d.ts.map +0 -1
  105. package/dist/__tests__/sanity.test.js +0 -12
  106. package/dist/__tests__/sanity.test.js.map +0 -1
  107. package/dist/__tests__/tag-count-badge.test.d.ts +0 -2
  108. package/dist/__tests__/tag-count-badge.test.d.ts.map +0 -1
  109. package/dist/__tests__/tag-count-badge.test.js +0 -70
  110. package/dist/__tests__/tag-count-badge.test.js.map +0 -1
  111. package/dist/lib/__tests__/base-forms.test.d.ts +0 -2
  112. package/dist/lib/__tests__/base-forms.test.d.ts.map +0 -1
  113. package/dist/lib/__tests__/base-forms.test.js +0 -256
  114. package/dist/lib/__tests__/base-forms.test.js.map +0 -1
@@ -0,0 +1,181 @@
1
+ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
+ import { BaseEntity } from '@memberjunction/core';
3
+ import { ComponentSpec } from '@memberjunction/interactive-component-types';
4
+ import { FormHostProps } from '@memberjunction/interactive-component-types/forms';
5
+ import { MJReactComponent, ReactComponentEvent } from '@memberjunction/ng-react';
6
+ import { BaseFormComponent } from '../base-form-component';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Wraps a Component (the IC kind — declared `componentRole: 'form'`) so it can
10
+ * stand in for an Angular form on any entity.
11
+ *
12
+ * **Layering invariant:** the React component never touches BaseEntity. This
13
+ * wrapper owns the entity lifecycle (`record.Save`, `record.Delete`, mode
14
+ * transitions). The React component sees only the snapshot in
15
+ * {@link FormHostProps} and communicates back via `BeforeSave` /
16
+ * `BeforeDelete` / `EditModeChangeRequested` events plus its dirty-field diff.
17
+ *
18
+ * Instantiated by `SingleRecordComponent.LoadForm` when the resolver finds an
19
+ * `EntityFormOverride` matching the user's scope. Behaves exactly like the
20
+ * generated Angular form from the host's perspective: same `record` setter,
21
+ * same `EditMode` toggle, same outputs.
22
+ */
23
+ export declare class InteractiveFormComponent extends BaseFormComponent implements OnInit, OnDestroy {
24
+ /**
25
+ * The bound record. Backed by a setter so swapping records *after*
26
+ * the component has mounted (e.g. Form Builder cockpit preview record
27
+ * picker) triggers a fresh `originalSnapshot` capture + a
28
+ * `formHostProps` rebuild — without this, the React form keeps
29
+ * rendering the original record's values even after the input
30
+ * changes. Guarded on `_recordInitialized` so the post-mount path
31
+ * doesn't fire during the first input assignment (handled by
32
+ * `ngOnInit`, which sets both `originalSnapshot` and `formHostProps`).
33
+ */
34
+ private _record;
35
+ private _recordInitialized;
36
+ set record(value: BaseEntity);
37
+ get record(): BaseEntity;
38
+ /**
39
+ * The Component row ID resolved for this (entity, user, roles) tuple. Set
40
+ * by `SingleRecordComponent.LoadForm` after the resolver returns an
41
+ * override.
42
+ */
43
+ ComponentID: string | null;
44
+ /**
45
+ * Loaded ComponentSpec, parsed from the Component row's `Specification` JSON.
46
+ *
47
+ * Two ways to populate this:
48
+ * 1. **Via `ComponentID`** (the standard path): set the input, ngOnInit
49
+ * fetches the row from `MJ: Components` and assigns the parsed spec.
50
+ * 2. **Direct assignment** (the artifact-viewer path): the caller already
51
+ * has the spec in hand (parsed from an artifact JSON blob) and sets
52
+ * `componentSpec` directly. In that case `ComponentID` should be left
53
+ * null and the DB fetch is skipped.
54
+ */
55
+ componentSpec: ComponentSpec | null;
56
+ /**
57
+ * When true, render the React component **without** the
58
+ * `<mj-record-form-container>` wrapper — i.e. no toolbar (no Save /
59
+ * Cancel / Edit / Delete / History / Tags / Lists).
60
+ *
61
+ * Used by the Form Builder cockpit's Preview tab where the toolbar's
62
+ * actions don't apply (Save would save the *record*, but the cockpit's
63
+ * own Save button saves the *spec*; History/Tags assume a real
64
+ * persistent record, but the preview record can be a synthetic
65
+ * NewRecord). Keeping just the form body produces a clean "this is
66
+ * what the form looks like" view.
67
+ */
68
+ previewMode: boolean;
69
+ /** FormHostProps passed to the React component. Recomputed when record or mode changes. */
70
+ formHostProps: FormHostProps | null;
71
+ /** Loaded-spec error (component row missing, JSON parse failure, etc.). */
72
+ private _loadError;
73
+ /**
74
+ * Loaded-spec error (component row missing, JSON parse failure,
75
+ * React-runtime bootstrap failure, etc.). Setter auto-emits
76
+ * `LoadErrorChanged` so host surfaces (e.g. Form Builder cockpit
77
+ * Preview tab) can show their own error state — retrospective fix #10.
78
+ */
79
+ get loadError(): string | null;
80
+ set loadError(v: string | null);
81
+ LoadErrorChanged: EventEmitter<string | null>;
82
+ /** Tracks last-known field snapshot for computing the dirty-field diff on save. */
83
+ private originalSnapshot;
84
+ /**
85
+ * Reference to the mounted React component. Used by the SaveRecord /
86
+ * CancelEdit overrides below to invoke the component's registered
87
+ * `RequestSave` / `RequestCancel` methods when the host toolbar fires
88
+ * Save/Cancel — so the single user-visible Save lives on the toolbar
89
+ * (consistent with every other entity form in MJ) and not duplicated
90
+ * inside the form body.
91
+ */
92
+ reactComponent?: MJReactComponent;
93
+ /**
94
+ * Promise resolver populated when `SaveRecord` invokes `RequestSave`
95
+ * on the React component. `handleBeforeSave` resolves it after the
96
+ * BeforeSave-driven entity save completes, so SaveRecord can return
97
+ * a meaningful success boolean and honor `StopEditModeAfterSave`.
98
+ */
99
+ private pendingSaveResolver;
100
+ private readonly changeDetector;
101
+ private readonly reactBridge;
102
+ ngOnInit(): Promise<void>;
103
+ /**
104
+ * Called by the React component via `mj-react-component`'s `componentEvent`
105
+ * @Output. Maps the form-role event names to BaseEntity operations.
106
+ */
107
+ OnReactComponentEvent(event: ReactComponentEvent): Promise<void>;
108
+ /**
109
+ * Apply the React component's dirty-field diff to the BaseEntity, save,
110
+ * and refresh the snapshot. Errors surface via `LatestResult.CompleteMessage`
111
+ * per the BaseEntity Save contract.
112
+ *
113
+ * Resolves `pendingSaveResolver` if {@link SaveRecord} initiated this
114
+ * flow via the toolbar — so the toolbar can return a meaningful boolean
115
+ * and honor `StopEditModeAfterSave`.
116
+ */
117
+ private handleBeforeSave;
118
+ private resolvePendingSave;
119
+ private handleBeforeDelete;
120
+ private handleEditModeChangeRequested;
121
+ /**
122
+ * Propagate Angular-toolbar-driven mode changes into the React component's
123
+ * `FormHostProps.mode`. Without these overrides, clicking Edit on the
124
+ * `<mj-record-form-container>` toolbar flips `this.EditMode` but the React
125
+ * side still sees `mode: 'view'`.
126
+ */
127
+ StartEditMode(): void;
128
+ EndEditMode(): void;
129
+ /**
130
+ * Toolbar **Save** override. Routes the click through the React
131
+ * component's registered `RequestSave` method so the React layer can
132
+ * (a) run its own validation, (b) flush its draft state, (c) emit
133
+ * `BeforeSave` with the dirty-field diff — exactly the flow the
134
+ * in-form Save button would trigger. The wrapper then awaits the
135
+ * BeforeSave handler via `pendingSaveResolver`, gets a real
136
+ * success/failure boolean, and honors `StopEditModeAfterSave`.
137
+ *
138
+ * Falls back to the base implementation for components that haven't
139
+ * registered `RequestSave` — preserves correctness for forms that
140
+ * keep their own in-form Save button (older sample, hand-authored
141
+ * forms that pre-date this contract).
142
+ */
143
+ SaveRecord(StopEditModeAfterSave: boolean): Promise<boolean>;
144
+ /**
145
+ * Toolbar **Cancel** override. Asks the React component to discard
146
+ * its draft via `RequestCancel`, then flips out of edit mode the
147
+ * same way the base implementation would. The React component is
148
+ * expected to (a) clear its local draft state and (b) emit
149
+ * `EditModeChangeRequested({ requestedMode: 'view' })` — though we
150
+ * call `EndEditMode` here directly anyway, so even a no-op handler
151
+ * leaves the form in a coherent state.
152
+ */
153
+ CancelEdit(): void;
154
+ /**
155
+ * Resolve the Component row, parse its `Specification`, and surface either
156
+ * the spec or an error. Backed by `InteractiveFormsEngine` (in-memory
157
+ * cache, BaseEntity event-driven invalidation) so this is a sub-ms JS
158
+ * lookup once the engine has loaded — the engine handles freshness
159
+ * via remote-invalidate events, replacing the prior RunView's
160
+ * `BypassCache: true` escape hatch. Falls through to a one-shot
161
+ * RunView only on engine-cache miss (defensive — the engine should
162
+ * always have a Type='Form' Component, but if a brand-new Component
163
+ * was just created on the server and the invalidation event hasn't
164
+ * propagated yet, we still want to render rather than blank-screen).
165
+ */
166
+ private loadComponentSpec;
167
+ /**
168
+ * Build `FormHostProps` from the current record + permissions + edit mode.
169
+ * Called whenever the record loads, mode changes, or save completes.
170
+ */
171
+ private rebuildFormHostProps;
172
+ private primaryKeyToPlain;
173
+ static ɵfac: i0.ɵɵFactoryDeclaration<InteractiveFormComponent, never>;
174
+ static ɵcmp: i0.ɵɵComponentDeclaration<InteractiveFormComponent, "mj-interactive-form", never, { "record": { "alias": "record"; "required": false; }; "ComponentID": { "alias": "ComponentID"; "required": false; }; "componentSpec": { "alias": "componentSpec"; "required": false; }; "previewMode": { "alias": "previewMode"; "required": false; }; }, { "LoadErrorChanged": "LoadErrorChanged"; }, never, never, false, never>;
175
+ }
176
+ /**
177
+ * Tree-shaking guard. Imported and called from public-api.ts so bundlers don't
178
+ * drop the component when no consumer references it by name.
179
+ */
180
+ export declare function LoadInteractiveFormComponent(): void;
181
+ //# sourceMappingURL=interactive-form.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-form.component.d.ts","sourceRoot":"","sources":["../../../src/lib/interactive-form/interactive-form.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,YAAY,EAAS,SAAS,EAAE,MAAM,EAA6B,MAAM,eAAe,CAAC;AAChI,OAAO,EAAE,UAAU,EAAmC,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EACH,aAAa,EAOhB,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAsB,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;;AAE3D;;;;;;;;;;;;;;GAcG;AACH,qBAKa,wBAAyB,SAAQ,iBAA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