@memberjunction/ng-react 6.2.0-edge.0 → 6.2.0-edge.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/react-bridge.service.test.js +11 -3
- package/dist/__tests__/react-bridge.service.test.js.map +1 -1
- package/dist/lib/components/mj-react-component.component.d.ts +122 -12
- package/dist/lib/components/mj-react-component.component.js +299 -115
- package/dist/lib/components/mj-react-component.component.js.map +1 -1
- package/dist/lib/config/react-debug.config.d.ts +4 -0
- package/dist/lib/config/react-debug.config.js +10 -2
- package/dist/lib/config/react-debug.config.js.map +1 -1
- package/dist/lib/hooks/antd-dropdown-position-hook.d.ts +2 -0
- package/dist/lib/hooks/antd-dropdown-position-hook.js +5 -1
- package/dist/lib/hooks/antd-dropdown-position-hook.js.map +1 -1
- package/dist/lib/services/angular-adapter.service.d.ts +32 -0
- package/dist/lib/services/angular-adapter.service.js +78 -18
- package/dist/lib/services/angular-adapter.service.js.map +1 -1
- package/dist/lib/services/react-bridge.service.d.ts +26 -2
- package/dist/lib/services/react-bridge.service.js +66 -18
- package/dist/lib/services/react-bridge.service.js.map +1 -1
- package/dist/lib/services/script-loader.service.d.ts +17 -0
- package/dist/lib/services/script-loader.service.js +26 -6
- package/dist/lib/services/script-loader.service.js.map +1 -1
- package/package.json +10 -10
|
@@ -37,11 +37,11 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
37
37
|
* When this changes after initialization, the component will be reinitialized
|
|
38
38
|
* to load and render the new specification.
|
|
39
39
|
*/
|
|
40
|
-
set
|
|
40
|
+
set Component(value) {
|
|
41
41
|
const previousComponent = this._component;
|
|
42
42
|
this._component = value;
|
|
43
43
|
// If already initialized and component spec changed, reinitialize
|
|
44
|
-
if (this.
|
|
44
|
+
if (this.IsInitialized && value && previousComponent !== value) {
|
|
45
45
|
// Check if it's actually a different component (not just same reference)
|
|
46
46
|
const isDifferent = !previousComponent ||
|
|
47
47
|
previousComponent.name !== value.name ||
|
|
@@ -54,16 +54,40 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
54
54
|
// Same code, new styleOverrides (a regenerated spec whose only change is the
|
|
55
55
|
// requested styling): re-render in place — no teardown needed. The resolved
|
|
56
56
|
// spec must be kept in step because the styleOverrides getter prefers it.
|
|
57
|
-
if (this.
|
|
58
|
-
this.
|
|
57
|
+
if (this.ResolvedComponentSpec) {
|
|
58
|
+
this.ResolvedComponentSpec.styleOverrides = value.styleOverrides;
|
|
59
59
|
}
|
|
60
60
|
this.renderComponent();
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
get
|
|
64
|
+
get Component() {
|
|
65
65
|
return this._component;
|
|
66
66
|
}
|
|
67
|
+
/** @deprecated Use {@link Component}. */
|
|
68
|
+
get component() {
|
|
69
|
+
return this.Component;
|
|
70
|
+
}
|
|
71
|
+
/** @deprecated Use {@link Component}. */
|
|
72
|
+
set component(value) {
|
|
73
|
+
this.Component = value;
|
|
74
|
+
}
|
|
75
|
+
/** @deprecated Use {@link EnableLogging}. */
|
|
76
|
+
set enableLogging(value) {
|
|
77
|
+
this.EnableLogging = value;
|
|
78
|
+
}
|
|
79
|
+
/** @deprecated Use {@link EnableLogging}. */
|
|
80
|
+
get enableLogging() {
|
|
81
|
+
return this.EnableLogging;
|
|
82
|
+
}
|
|
83
|
+
/** @deprecated Use {@link UseComponentManager}. */
|
|
84
|
+
set useComponentManager(value) {
|
|
85
|
+
this.UseComponentManager = value;
|
|
86
|
+
}
|
|
87
|
+
/** @deprecated Use {@link UseComponentManager}. */
|
|
88
|
+
get useComponentManager() {
|
|
89
|
+
return this.UseComponentManager;
|
|
90
|
+
} // NEW: Use unified ComponentManager by default
|
|
67
91
|
set utilities(value) {
|
|
68
92
|
this._utilities = value;
|
|
69
93
|
}
|
|
@@ -71,17 +95,17 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
71
95
|
// Lazy initialization - only create default utilities when needed
|
|
72
96
|
if (!this._utilities) {
|
|
73
97
|
const runtimeUtils = createRuntimeUtilities();
|
|
74
|
-
this._utilities = runtimeUtils.buildUtilities(this.
|
|
75
|
-
if (this.
|
|
98
|
+
this._utilities = runtimeUtils.buildUtilities(this.EnableLogging, this.ProviderToUse);
|
|
99
|
+
if (this.EnableLogging) {
|
|
76
100
|
console.log('MJReactComponent: Auto-initialized utilities using createRuntimeUtilities()');
|
|
77
101
|
}
|
|
78
102
|
}
|
|
79
103
|
return this._utilities;
|
|
80
104
|
}
|
|
81
|
-
set
|
|
105
|
+
set Styles(value) {
|
|
82
106
|
this._styles = value;
|
|
83
107
|
}
|
|
84
|
-
get
|
|
108
|
+
get Styles() {
|
|
85
109
|
// An explicitly-provided styles input always wins — but user-requested overrides
|
|
86
110
|
// still layer on top, since they represent an explicit request rather than a theme.
|
|
87
111
|
if (this._styles) {
|
|
@@ -95,7 +119,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
95
119
|
if (!this._themeStyles || this._themeStylesKey !== key) {
|
|
96
120
|
this._themeStyles = BuildStylesFromTheme();
|
|
97
121
|
this._themeStylesKey = key;
|
|
98
|
-
if (this.
|
|
122
|
+
if (this.EnableLogging) {
|
|
99
123
|
console.log(`MJReactComponent: Bridged styles from live theme (key="${key}")`);
|
|
100
124
|
}
|
|
101
125
|
}
|
|
@@ -103,13 +127,21 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
103
127
|
// (the memo caches the theme, not the request).
|
|
104
128
|
return this.applyStyleOverridesMemoized(this._themeStyles);
|
|
105
129
|
}
|
|
130
|
+
/** @deprecated Use {@link Styles}. */
|
|
131
|
+
get styles() {
|
|
132
|
+
return this.Styles;
|
|
133
|
+
}
|
|
134
|
+
/** @deprecated Use {@link Styles}. */
|
|
135
|
+
set styles(value) {
|
|
136
|
+
this.Styles = value;
|
|
137
|
+
}
|
|
106
138
|
/**
|
|
107
139
|
* Explicitly user-requested styling from the spec being rendered, resolved above
|
|
108
140
|
* the theme. Reads the resolved spec when available (registry components resolve
|
|
109
141
|
* asynchronously) and falls back to the spec passed in.
|
|
110
142
|
*/
|
|
111
143
|
get styleOverrides() {
|
|
112
|
-
return this.
|
|
144
|
+
return this.ResolvedComponentSpec?.styleOverrides ?? this._component?.styleOverrides;
|
|
113
145
|
}
|
|
114
146
|
applyStyleOverridesMemoized(base) {
|
|
115
147
|
const overrides = this.styleOverrides;
|
|
@@ -150,7 +182,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
150
182
|
if (key !== this._themeStylesKey) {
|
|
151
183
|
this._themeStyles = undefined;
|
|
152
184
|
this._themeStylesKey = undefined;
|
|
153
|
-
if (this.
|
|
185
|
+
if (this.IsInitialized) {
|
|
154
186
|
this.renderComponent();
|
|
155
187
|
}
|
|
156
188
|
}
|
|
@@ -160,25 +192,73 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
160
192
|
attributeFilter: ['data-theme', 'data-theme-overlay'],
|
|
161
193
|
});
|
|
162
194
|
}
|
|
163
|
-
set
|
|
195
|
+
set SavedUserSettings(value) {
|
|
164
196
|
this._savedUserSettings = value || {};
|
|
165
197
|
// Re-render if component is initialized
|
|
166
|
-
if (this.
|
|
198
|
+
if (this.IsInitialized) {
|
|
167
199
|
this.renderComponent();
|
|
168
200
|
}
|
|
169
201
|
}
|
|
170
|
-
get
|
|
202
|
+
get SavedUserSettings() {
|
|
171
203
|
return this._savedUserSettings;
|
|
172
204
|
}
|
|
173
|
-
|
|
205
|
+
/** @deprecated Use {@link SavedUserSettings}. */
|
|
206
|
+
get savedUserSettings() {
|
|
207
|
+
return this.SavedUserSettings;
|
|
208
|
+
}
|
|
209
|
+
/** @deprecated Use {@link SavedUserSettings}. */
|
|
210
|
+
set savedUserSettings(value) {
|
|
211
|
+
this.SavedUserSettings = value;
|
|
212
|
+
}
|
|
213
|
+
set ComponentProps(value) {
|
|
174
214
|
this._componentProps = value ?? {};
|
|
175
|
-
if (this.
|
|
215
|
+
if (this.IsInitialized) {
|
|
176
216
|
this.renderComponent();
|
|
177
217
|
}
|
|
178
218
|
}
|
|
179
|
-
get
|
|
219
|
+
get ComponentProps() {
|
|
180
220
|
return this._componentProps;
|
|
181
221
|
}
|
|
222
|
+
/** @deprecated Use {@link ComponentProps}. */
|
|
223
|
+
get componentProps() {
|
|
224
|
+
return this.ComponentProps;
|
|
225
|
+
}
|
|
226
|
+
/** @deprecated Use {@link ComponentProps}. */
|
|
227
|
+
set componentProps(value) {
|
|
228
|
+
this.ComponentProps = value;
|
|
229
|
+
}
|
|
230
|
+
/** @deprecated Use {@link Container}. */
|
|
231
|
+
get container() {
|
|
232
|
+
return this.Container;
|
|
233
|
+
}
|
|
234
|
+
/** @deprecated Use {@link Container}. */
|
|
235
|
+
set container(value) {
|
|
236
|
+
this.Container = value;
|
|
237
|
+
}
|
|
238
|
+
/** @deprecated Use {@link IsInitialized}. */
|
|
239
|
+
get isInitialized() {
|
|
240
|
+
return this.IsInitialized;
|
|
241
|
+
}
|
|
242
|
+
/** @deprecated Use {@link IsInitialized}. */
|
|
243
|
+
set isInitialized(value) {
|
|
244
|
+
this.IsInitialized = value;
|
|
245
|
+
}
|
|
246
|
+
/** @deprecated Use {@link HasError}. */
|
|
247
|
+
get hasError() {
|
|
248
|
+
return this.HasError;
|
|
249
|
+
}
|
|
250
|
+
/** @deprecated Use {@link HasError}. */
|
|
251
|
+
set hasError(value) {
|
|
252
|
+
this.HasError = value;
|
|
253
|
+
}
|
|
254
|
+
/** @deprecated Use {@link ResolvedComponentSpec}. */
|
|
255
|
+
get resolvedComponentSpec() {
|
|
256
|
+
return this.ResolvedComponentSpec;
|
|
257
|
+
}
|
|
258
|
+
/** @deprecated Use {@link ResolvedComponentSpec}. */
|
|
259
|
+
set resolvedComponentSpec(value) {
|
|
260
|
+
this.ResolvedComponentSpec = value;
|
|
261
|
+
}
|
|
182
262
|
constructor(reactBridge, adapter, cdr, notificationService) {
|
|
183
263
|
super();
|
|
184
264
|
this.reactBridge = reactBridge;
|
|
@@ -190,8 +270,8 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
190
270
|
* Note: This does NOT control which React build (dev/prod) is loaded.
|
|
191
271
|
* To control React builds, use ReactDebugConfig.setDebugMode() at app startup.
|
|
192
272
|
*/
|
|
193
|
-
this.
|
|
194
|
-
this.
|
|
273
|
+
this.EnableLogging = false;
|
|
274
|
+
this.UseComponentManager = true;
|
|
195
275
|
this._savedUserSettings = {};
|
|
196
276
|
/**
|
|
197
277
|
* When `true` (default), the host transparently persists `savedUserSettings`
|
|
@@ -212,13 +292,61 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
212
292
|
* platform contract stable.
|
|
213
293
|
*/
|
|
214
294
|
this._componentProps = {};
|
|
215
|
-
this.
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
295
|
+
this.StateChange = new EventEmitter();
|
|
296
|
+
/**
|
|
297
|
+
* @deprecated Use {@link StateChange}.
|
|
298
|
+
*
|
|
299
|
+
* The same emitter under the old binding name, so a template still binding
|
|
300
|
+
* (stateChange) keeps working. Must stay AFTER StateChange: class fields
|
|
301
|
+
* initialise in order, and the other way round this captures undefined.
|
|
302
|
+
*/
|
|
303
|
+
this.stateChange = this.StateChange;
|
|
304
|
+
this.ComponentEvent = new EventEmitter();
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated Use {@link ComponentEvent}.
|
|
307
|
+
*
|
|
308
|
+
* The same emitter under the old binding name, so a template still binding
|
|
309
|
+
* (componentEvent) keeps working. Must stay AFTER ComponentEvent: class fields
|
|
310
|
+
* initialise in order, and the other way round this captures undefined.
|
|
311
|
+
*/
|
|
312
|
+
this.componentEvent = this.ComponentEvent;
|
|
313
|
+
this.RefreshData = new EventEmitter();
|
|
314
|
+
/**
|
|
315
|
+
* @deprecated Use {@link RefreshData}.
|
|
316
|
+
*
|
|
317
|
+
* The same emitter under the old binding name, so a template still binding
|
|
318
|
+
* (refreshData) keeps working. Must stay AFTER RefreshData: class fields
|
|
319
|
+
* initialise in order, and the other way round this captures undefined.
|
|
320
|
+
*/
|
|
321
|
+
this.refreshData = this.RefreshData;
|
|
322
|
+
this.OpenEntityRecord = new EventEmitter();
|
|
323
|
+
/**
|
|
324
|
+
* @deprecated Use {@link OpenEntityRecord}.
|
|
325
|
+
*
|
|
326
|
+
* The same emitter under the old binding name, so a template still binding
|
|
327
|
+
* (openEntityRecord) keeps working. Must stay AFTER OpenEntityRecord: class fields
|
|
328
|
+
* initialise in order, and the other way round this captures undefined.
|
|
329
|
+
*/
|
|
330
|
+
this.openEntityRecord = this.OpenEntityRecord;
|
|
331
|
+
this.UserSettingsChanged = new EventEmitter();
|
|
332
|
+
/**
|
|
333
|
+
* @deprecated Use {@link UserSettingsChanged}.
|
|
334
|
+
*
|
|
335
|
+
* The same emitter under the old binding name, so a template still binding
|
|
336
|
+
* (userSettingsChanged) keeps working. Must stay AFTER UserSettingsChanged: class fields
|
|
337
|
+
* initialise in order, and the other way round this captures undefined.
|
|
338
|
+
*/
|
|
339
|
+
this.userSettingsChanged = this.UserSettingsChanged;
|
|
220
340
|
/** Emitted once after the component successfully loads and resolvedComponentSpec is populated. */
|
|
221
|
-
this.
|
|
341
|
+
this.Initialized = new EventEmitter();
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated Use {@link Initialized}.
|
|
344
|
+
*
|
|
345
|
+
* The same emitter under the old binding name, so a template still binding
|
|
346
|
+
* (initialized) keeps working. Must stay AFTER Initialized: class fields
|
|
347
|
+
* initialise in order, and the other way round this captures undefined.
|
|
348
|
+
*/
|
|
349
|
+
this.initialized = this.Initialized;
|
|
222
350
|
// ─── Automatic data capture ───
|
|
223
351
|
// Stores RunView/RunQuery results for components that don't implement getCurrentDataState().
|
|
224
352
|
// Cleared on component reinitialize. Used as fallback in GetCurrentDataState().
|
|
@@ -228,19 +356,19 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
228
356
|
this.loadedDependencies = {};
|
|
229
357
|
this.destroyed$ = new Subject();
|
|
230
358
|
this.currentCallbacks = null;
|
|
231
|
-
this.
|
|
359
|
+
this.IsInitialized = false;
|
|
232
360
|
this.isRendering = false;
|
|
233
361
|
this.pendingRender = false;
|
|
234
362
|
this.isDestroying = false;
|
|
235
363
|
this.componentVersion = ''; // Store the version for resolver
|
|
236
|
-
this.
|
|
364
|
+
this.HasError = false;
|
|
237
365
|
/**
|
|
238
366
|
* Public property containing the fully resolved component specification.
|
|
239
367
|
* This includes all external code fetched from registries, allowing consumers
|
|
240
368
|
* to inspect the complete resolved specification including dependencies.
|
|
241
369
|
* Only populated after successful component initialization.
|
|
242
370
|
*/
|
|
243
|
-
this.
|
|
371
|
+
this.ResolvedComponentSpec = null;
|
|
244
372
|
// Generate unique component ID for resource tracking
|
|
245
373
|
this.componentId = `mj-react-component-${Date.now()}-${Math.random()}`;
|
|
246
374
|
}
|
|
@@ -260,7 +388,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
260
388
|
}
|
|
261
389
|
console.log(`🎬 [ngAfterViewInit] Starting component initialization:`, {
|
|
262
390
|
componentId: this.componentId,
|
|
263
|
-
componentName: this.
|
|
391
|
+
componentName: this.Component?.name,
|
|
264
392
|
timestamp: new Date().toISOString(),
|
|
265
393
|
registrySize: registrySize
|
|
266
394
|
});
|
|
@@ -292,11 +420,11 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
292
420
|
}
|
|
293
421
|
// Clear cached state from previous component
|
|
294
422
|
this.compiledComponent = null;
|
|
295
|
-
this.
|
|
423
|
+
this.ResolvedComponentSpec = null;
|
|
296
424
|
this.loadedDependencies = {};
|
|
297
425
|
this.componentVersion = '';
|
|
298
|
-
this.
|
|
299
|
-
this.
|
|
426
|
+
this.HasError = false;
|
|
427
|
+
this.IsInitialized = false;
|
|
300
428
|
this.capturedData = [];
|
|
301
429
|
// Unmount existing React root if present
|
|
302
430
|
if (this.reactRootId) {
|
|
@@ -320,7 +448,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
320
448
|
// Wait for React to be fully ready (handles first-load delay)
|
|
321
449
|
await this.reactBridge.waitForReactReady();
|
|
322
450
|
// NEW: Use ComponentManager if enabled (default: true)
|
|
323
|
-
if (this.
|
|
451
|
+
if (this.UseComponentManager) {
|
|
324
452
|
console.log(`🎯 [initializeComponent] Using NEW ComponentManager approach`);
|
|
325
453
|
await this.loadComponentWithManager();
|
|
326
454
|
// Component is already compiled and stored in this.compiledComponent
|
|
@@ -335,39 +463,39 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
335
463
|
// Get the already-registered component from the registry
|
|
336
464
|
const registry = this.adapter.getRegistry();
|
|
337
465
|
console.log(`🔍 [initializeComponent] Looking for component in registry:`, {
|
|
338
|
-
name: this.
|
|
339
|
-
namespace: this.
|
|
466
|
+
name: this.Component.name,
|
|
467
|
+
namespace: this.Component.namespace || 'Global',
|
|
340
468
|
version: this.componentVersion
|
|
341
469
|
});
|
|
342
470
|
// Let's also check what's actually in the registry
|
|
343
471
|
// Note: ComponentRegistry doesn't have a list() method, so we'll skip this for now
|
|
344
|
-
const componentWrapper = registry.get(this.
|
|
472
|
+
const componentWrapper = registry.get(this.Component.name, this.Component.namespace || 'Global', this.componentVersion);
|
|
345
473
|
console.log(`🔍 [initializeComponent] Registry.get result:`, {
|
|
346
474
|
found: !!componentWrapper,
|
|
347
475
|
type: componentWrapper ? typeof componentWrapper : 'undefined',
|
|
348
476
|
hasComponent: componentWrapper ? !!componentWrapper.component : false
|
|
349
477
|
});
|
|
350
478
|
if (!componentWrapper) {
|
|
351
|
-
const source = this.
|
|
479
|
+
const source = this.Component.registry ? `external registry ${this.Component.registry}` : 'local registry';
|
|
352
480
|
console.error(`❌ [initializeComponent] Component not found! Details:`, {
|
|
353
|
-
searchedName: this.
|
|
354
|
-
searchedNamespace: this.
|
|
481
|
+
searchedName: this.Component.name,
|
|
482
|
+
searchedNamespace: this.Component.namespace || 'Global',
|
|
355
483
|
searchedVersion: this.componentVersion,
|
|
356
484
|
source: source
|
|
357
485
|
});
|
|
358
|
-
throw new Error(`Component ${this.
|
|
486
|
+
throw new Error(`Component ${this.Component.name} was not found in registry after registration from ${source}`);
|
|
359
487
|
}
|
|
360
488
|
// The registry now stores ComponentObjects directly
|
|
361
489
|
// Validate it has the expected structure
|
|
362
490
|
if (!componentWrapper || typeof componentWrapper !== 'object') {
|
|
363
|
-
throw new Error(`Invalid component wrapper returned for ${this.
|
|
491
|
+
throw new Error(`Invalid component wrapper returned for ${this.Component.name}: ${typeof componentWrapper}`);
|
|
364
492
|
}
|
|
365
493
|
if (!componentWrapper.component) {
|
|
366
|
-
throw new Error(`Component wrapper missing 'component' property for ${this.
|
|
494
|
+
throw new Error(`Component wrapper missing 'component' property for ${this.Component.name}`);
|
|
367
495
|
}
|
|
368
496
|
// Now that we use a regular HOC wrapper, components should always be functions
|
|
369
497
|
if (typeof componentWrapper.component !== 'function') {
|
|
370
|
-
throw new Error(`Component is not a function for ${this.
|
|
498
|
+
throw new Error(`Component is not a function for ${this.Component.name}: ${typeof componentWrapper.component}`);
|
|
371
499
|
}
|
|
372
500
|
this.compiledComponent = componentWrapper;
|
|
373
501
|
} // End of else block for legacy approach
|
|
@@ -376,23 +504,23 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
376
504
|
if (!reactContext) {
|
|
377
505
|
throw new Error('React context not available');
|
|
378
506
|
}
|
|
379
|
-
this.reactRootId = reactRootManager.createRoot(this.
|
|
507
|
+
this.reactRootId = reactRootManager.createRoot(this.Container.nativeElement, (container) => reactContext.ReactDOM.createRoot(container), this.componentId);
|
|
380
508
|
// Seed savedUserSettings from durable per-user storage before the first
|
|
381
509
|
// render so the component mounts with the user's persisted preferences.
|
|
382
510
|
await this.seedUserSettingsFromStore();
|
|
383
511
|
// Initial render
|
|
384
512
|
this.renderComponent();
|
|
385
|
-
this.
|
|
513
|
+
this.IsInitialized = true;
|
|
386
514
|
// Trigger change detection since we're using OnPush
|
|
387
515
|
this.cdr.detectChanges();
|
|
388
516
|
// Notify parent that the component has successfully initialized and
|
|
389
517
|
// resolvedComponentSpec is now populated with the full spec from the registry
|
|
390
|
-
this.
|
|
518
|
+
this.Initialized.emit();
|
|
391
519
|
}
|
|
392
520
|
catch (error) {
|
|
393
|
-
this.
|
|
521
|
+
this.HasError = true;
|
|
394
522
|
LogError(`Failed to initialize React component: ${error}`);
|
|
395
|
-
this.
|
|
523
|
+
this.ComponentEvent.emit({
|
|
396
524
|
type: 'error',
|
|
397
525
|
payload: {
|
|
398
526
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -420,13 +548,13 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
420
548
|
async resolveComponentsWithVersion(spec, version, namespace = 'Global') {
|
|
421
549
|
const resolver = this.adapter.getResolver();
|
|
422
550
|
// Debug: Log what dependencies we're trying to resolve
|
|
423
|
-
if (this.
|
|
551
|
+
if (this.EnableLogging) {
|
|
424
552
|
console.log(`Resolving components for ${spec.name}. Dependencies:`, spec.dependencies);
|
|
425
553
|
}
|
|
426
554
|
// Use the runtime's resolver which now handles registry-based components
|
|
427
555
|
const resolved = await resolver.resolveComponents(spec, namespace, this.ProviderToUse.CurrentUser // Pass current user context for database operations
|
|
428
556
|
);
|
|
429
|
-
if (this.
|
|
557
|
+
if (this.EnableLogging) {
|
|
430
558
|
console.log(`Resolved ${Object.keys(resolved).length} components for version ${version}:`, Object.keys(resolved));
|
|
431
559
|
}
|
|
432
560
|
return resolved;
|
|
@@ -437,12 +565,12 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
437
565
|
async loadComponentWithManager() {
|
|
438
566
|
try {
|
|
439
567
|
const manager = this.adapter.getComponentManager();
|
|
440
|
-
console.log(`🚀 [ComponentManager] Loading component hierarchy: ${this.
|
|
568
|
+
console.log(`🚀 [ComponentManager] Loading component hierarchy: ${this.Component.name}`);
|
|
441
569
|
// Load the entire hierarchy with one simple call
|
|
442
|
-
const result = await manager.loadHierarchy(this.
|
|
570
|
+
const result = await manager.loadHierarchy(this.Component, {
|
|
443
571
|
contextUser: this.ProviderToUse.CurrentUser,
|
|
444
572
|
defaultNamespace: 'Global',
|
|
445
|
-
defaultVersion: this.
|
|
573
|
+
defaultVersion: this.Component.version || this.generateComponentHash(this.Component),
|
|
446
574
|
returnType: 'both'
|
|
447
575
|
});
|
|
448
576
|
if (!result.success) {
|
|
@@ -451,9 +579,9 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
451
579
|
throw new Error(`Component loading failed: ${errorMessages}`);
|
|
452
580
|
}
|
|
453
581
|
// Store the results (handle undefined values)
|
|
454
|
-
this.
|
|
582
|
+
this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);
|
|
455
583
|
this.compiledComponent = result.rootComponent || null;
|
|
456
|
-
this.componentVersion = result.resolvedSpec?.version || this.
|
|
584
|
+
this.componentVersion = result.resolvedSpec?.version || this.Component.version || 'latest';
|
|
457
585
|
// IMPORTANT: Store the loaded dependencies for use in renderComponent
|
|
458
586
|
this.loadedDependencies = result.components || {};
|
|
459
587
|
console.log(`✅ [ComponentManager] Successfully loaded hierarchy:`, {
|
|
@@ -476,20 +604,20 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
476
604
|
*/
|
|
477
605
|
async registerComponentHierarchy() {
|
|
478
606
|
// Use semantic version from spec or generate hash-based version for uniqueness
|
|
479
|
-
const version = this.
|
|
607
|
+
const version = this.Component.version || this.generateComponentHash(this.Component);
|
|
480
608
|
this.componentVersion = version; // Store for use in resolver
|
|
481
|
-
console.log(`🔍 [registerComponentHierarchy] Starting registration for ${this.
|
|
482
|
-
location: this.
|
|
483
|
-
registry: this.
|
|
484
|
-
namespace: this.
|
|
485
|
-
hasCode: !!this.
|
|
486
|
-
codeLength: this.
|
|
609
|
+
console.log(`🔍 [registerComponentHierarchy] Starting registration for ${this.Component.name}@${version}`, {
|
|
610
|
+
location: this.Component.location,
|
|
611
|
+
registry: this.Component.registry,
|
|
612
|
+
namespace: this.Component.namespace,
|
|
613
|
+
hasCode: !!this.Component.code,
|
|
614
|
+
codeLength: this.Component.code?.length || 0
|
|
487
615
|
});
|
|
488
616
|
// Check if already registered to avoid duplication
|
|
489
617
|
const registry = this.adapter.getRegistry();
|
|
490
|
-
const checkNamespace = this.
|
|
618
|
+
const checkNamespace = this.Component.namespace || 'Global';
|
|
491
619
|
console.log(`🔍 [registerComponentHierarchy] Checking registry for existing component:`, {
|
|
492
|
-
name: this.
|
|
620
|
+
name: this.Component.name,
|
|
493
621
|
namespace: checkNamespace,
|
|
494
622
|
version: version,
|
|
495
623
|
registrySize: registry.size(),
|
|
@@ -500,9 +628,9 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
500
628
|
totalSize: registry.size(),
|
|
501
629
|
registryInstance: registry.registryId || 'unknown'
|
|
502
630
|
});
|
|
503
|
-
const existingComponent = registry.get(this.
|
|
631
|
+
const existingComponent = registry.get(this.Component.name, checkNamespace, version);
|
|
504
632
|
if (existingComponent) {
|
|
505
|
-
console.log(`⚠️ [registerComponentHierarchy] Component ${this.
|
|
633
|
+
console.log(`⚠️ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered!`, {
|
|
506
634
|
existingType: typeof existingComponent,
|
|
507
635
|
hasComponent: !!existingComponent.component,
|
|
508
636
|
registrationTime: existingComponent.registeredAt || 'unknown',
|
|
@@ -510,13 +638,13 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
510
638
|
});
|
|
511
639
|
// For registry components, we need to check the resolved spec's libraries, not the input spec
|
|
512
640
|
// The input spec from Angular doesn't have library information for registry components
|
|
513
|
-
if (this.
|
|
641
|
+
if (this.Component.location === 'registry' && this.Component.registry) {
|
|
514
642
|
console.log(`📋 [registerComponentHierarchy] Component is from registry, need to fetch full spec to check libraries`);
|
|
515
643
|
// Continue to fetch the full spec below - don't return early
|
|
516
644
|
}
|
|
517
645
|
else {
|
|
518
646
|
// For local components, check using the input spec
|
|
519
|
-
const requiredLibraries = this.
|
|
647
|
+
const requiredLibraries = this.Component.libraries || [];
|
|
520
648
|
const runtimeLibraries = this.adapter.getRuntimeContext().libraries || {};
|
|
521
649
|
const missingLibraries = requiredLibraries.filter(lib => !runtimeLibraries[lib.globalVariable]);
|
|
522
650
|
if (missingLibraries.length > 0) {
|
|
@@ -528,7 +656,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
528
656
|
// Don't return early - continue to load libraries
|
|
529
657
|
}
|
|
530
658
|
else {
|
|
531
|
-
console.log(`✅ [registerComponentHierarchy] Component ${this.
|
|
659
|
+
console.log(`✅ [registerComponentHierarchy] Component ${this.Component.name}@${version} already registered with all libraries, skipping`);
|
|
532
660
|
return;
|
|
533
661
|
}
|
|
534
662
|
}
|
|
@@ -540,20 +668,20 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
540
668
|
await ComponentMetadataEngine.Instance.Config(false, this.ProviderToUse.CurrentUser);
|
|
541
669
|
// Use the runtime's hierarchy registrar
|
|
542
670
|
const registrar = new ComponentHierarchyRegistrar(this.adapter.getCompiler(), this.adapter.getRegistry(), this.adapter.getRuntimeContext());
|
|
543
|
-
console.log(`📦 [registerComponentHierarchy] Calling registrar.registerHierarchy for ${this.
|
|
544
|
-
hasStyles: !!this.
|
|
545
|
-
namespace: this.
|
|
671
|
+
console.log(`📦 [registerComponentHierarchy] Calling registrar.registerHierarchy for ${this.Component.name}`, {
|
|
672
|
+
hasStyles: !!this.Styles,
|
|
673
|
+
namespace: this.Component.namespace || 'Global',
|
|
546
674
|
version: version,
|
|
547
675
|
libraryCount: ComponentMetadataEngine.Instance.ComponentLibraries?.length || 0,
|
|
548
|
-
hasCode: !!this.
|
|
549
|
-
codeLength: this.
|
|
676
|
+
hasCode: !!this.Component.code,
|
|
677
|
+
codeLength: this.Component.code?.length || 0
|
|
550
678
|
});
|
|
551
679
|
// Register with proper configuration
|
|
552
680
|
// Pass the partial spec - the React runtime will handle fetching from registries
|
|
553
|
-
const result = await registrar.registerHierarchy(this.
|
|
681
|
+
const result = await registrar.registerHierarchy(this.Component, // Pass the original spec, not fetched
|
|
554
682
|
{
|
|
555
|
-
styles: this.
|
|
556
|
-
namespace: this.
|
|
683
|
+
styles: this.Styles,
|
|
684
|
+
namespace: this.Component.namespace || 'Global',
|
|
557
685
|
version: version,
|
|
558
686
|
allowOverride: false, // Each version is unique
|
|
559
687
|
allLibraries: ComponentMetadataEngine.Instance.ComponentLibraries,
|
|
@@ -567,7 +695,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
567
695
|
}
|
|
568
696
|
// Store the resolved spec from the registration result
|
|
569
697
|
if (result.resolvedSpec) {
|
|
570
|
-
this.
|
|
698
|
+
this.ResolvedComponentSpec = this.enrichSpecWithRegistryInfo(result.resolvedSpec || null);
|
|
571
699
|
console.log(`📋 [registerComponentHierarchy] Received resolved spec from runtime:`, {
|
|
572
700
|
name: result.resolvedSpec.name,
|
|
573
701
|
hasCode: !!result.resolvedSpec.code,
|
|
@@ -577,11 +705,11 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
577
705
|
}
|
|
578
706
|
console.log(`✅ [registerComponentHierarchy] Successfully registered ${result.registeredComponents.length} components:`, result.registeredComponents);
|
|
579
707
|
// Verify the component is actually in the registry
|
|
580
|
-
const verifyComponent = registry.get(this.
|
|
708
|
+
const verifyComponent = registry.get(this.Component.name, this.Component.namespace || 'Global', version);
|
|
581
709
|
console.log(`🔍 [registerComponentHierarchy] Verification - component in registry after registration:`, {
|
|
582
710
|
found: !!verifyComponent,
|
|
583
|
-
name: this.
|
|
584
|
-
namespace: this.
|
|
711
|
+
name: this.Component.name,
|
|
712
|
+
namespace: this.Component.namespace || 'Global',
|
|
585
713
|
version: version,
|
|
586
714
|
componentType: verifyComponent ? typeof verifyComponent : 'not found'
|
|
587
715
|
});
|
|
@@ -592,7 +720,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
592
720
|
* Applied to all resolved specs so any consumer of this wrapper benefits.
|
|
593
721
|
*/
|
|
594
722
|
enrichSpecWithRegistryInfo(spec) {
|
|
595
|
-
if (!spec || !this.
|
|
723
|
+
if (!spec || !this.Component)
|
|
596
724
|
return spec;
|
|
597
725
|
// Create a deep copy to avoid mutating the original
|
|
598
726
|
const enrichedSpec = JSON.parse(JSON.stringify(spec));
|
|
@@ -644,7 +772,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
644
772
|
});
|
|
645
773
|
}
|
|
646
774
|
};
|
|
647
|
-
processSpec(enrichedSpec, this.
|
|
775
|
+
processSpec(enrichedSpec, this.Component);
|
|
648
776
|
return enrichedSpec;
|
|
649
777
|
}
|
|
650
778
|
/**
|
|
@@ -672,8 +800,8 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
672
800
|
// Resolve components with the correct version using runtime's resolver
|
|
673
801
|
// SKIP this if using ComponentManager - components are already loaded!
|
|
674
802
|
let components = {};
|
|
675
|
-
if (!this.
|
|
676
|
-
components = await this.resolveComponentsWithVersion(this.
|
|
803
|
+
if (!this.UseComponentManager) {
|
|
804
|
+
components = await this.resolveComponentsWithVersion(this.Component, this.componentVersion);
|
|
677
805
|
}
|
|
678
806
|
else {
|
|
679
807
|
// Use the dependencies that were already loaded and unwrapped by ComponentManager
|
|
@@ -698,19 +826,19 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
698
826
|
utilities: wrappedUtilities,
|
|
699
827
|
callbacks: this.currentCallbacks,
|
|
700
828
|
components,
|
|
701
|
-
styles: this.
|
|
829
|
+
styles: this.Styles,
|
|
702
830
|
libraries, // Pass the loaded libraries to components
|
|
703
831
|
savedUserSettings: this._savedUserSettings,
|
|
704
832
|
onSaveUserSettings: this.handleSaveUserSettings.bind(this)
|
|
705
833
|
};
|
|
706
834
|
// Validate component before creating element
|
|
707
835
|
if (!this.compiledComponent.component) {
|
|
708
|
-
LogError(`Component is undefined for ${this.
|
|
836
|
+
LogError(`Component is undefined for ${this.Component.name} during render`);
|
|
709
837
|
return;
|
|
710
838
|
}
|
|
711
839
|
// Components should be functions after HOC wrapping
|
|
712
840
|
if (typeof this.compiledComponent.component !== 'function') {
|
|
713
|
-
LogError(`Component is not a function for ${this.
|
|
841
|
+
LogError(`Component is not a function for ${this.Component.name}: ${typeof this.compiledComponent.component}`);
|
|
714
842
|
return;
|
|
715
843
|
}
|
|
716
844
|
// Create error boundary
|
|
@@ -724,13 +852,13 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
724
852
|
// components don't read styles.* on their own and would otherwise render in their
|
|
725
853
|
// built-in light theme even in dark mode. One wrap themes every antd component in
|
|
726
854
|
// the subtree; no-op when antd isn't loaded.
|
|
727
|
-
const themedComponent = wrapWithLibraryThemeProviders(React, React.createElement(this.compiledComponent.component, props), libraries, this.
|
|
855
|
+
const themedComponent = wrapWithLibraryThemeProviders(React, React.createElement(this.compiledComponent.component, props), libraries, this.Styles);
|
|
728
856
|
const element = React.createElement(ErrorBoundary, null, themedComponent);
|
|
729
857
|
// Render with timeout protection using resource manager
|
|
730
858
|
const timeoutId = resourceManager.setTimeout(this.componentId, () => {
|
|
731
859
|
// Check if still rendering and not destroyed
|
|
732
860
|
if (this.isRendering && !this.isDestroying) {
|
|
733
|
-
this.
|
|
861
|
+
this.ComponentEvent.emit({
|
|
734
862
|
type: 'error',
|
|
735
863
|
payload: {
|
|
736
864
|
error: 'Component render timeout - possible infinite loop detected',
|
|
@@ -776,11 +904,11 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
776
904
|
// here is the only part that is Angular's: what "open" means.
|
|
777
905
|
const keyToUse = await resolveEntityRecordKey(entityName, key, this.ProviderToUse);
|
|
778
906
|
if (keyToUse) {
|
|
779
|
-
this.
|
|
907
|
+
this.OpenEntityRecord.emit({ entityName, key: keyToUse });
|
|
780
908
|
}
|
|
781
909
|
},
|
|
782
910
|
NotifyEvent: async (eventName, args) => {
|
|
783
|
-
this.
|
|
911
|
+
this.ComponentEvent.emit({ type: eventName, payload: args });
|
|
784
912
|
}
|
|
785
913
|
};
|
|
786
914
|
}
|
|
@@ -789,7 +917,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
789
917
|
*/
|
|
790
918
|
handleReactError(error, errorInfo) {
|
|
791
919
|
LogError(`React component error: ${error?.toString() || 'Unknown error'}`, errorInfo);
|
|
792
|
-
this.
|
|
920
|
+
this.ComponentEvent.emit({
|
|
793
921
|
type: 'error',
|
|
794
922
|
payload: {
|
|
795
923
|
error: error?.toString() || 'Unknown error',
|
|
@@ -823,9 +951,9 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
823
951
|
// Durably persist the latest settings for this user, scoped to this component.
|
|
824
952
|
this.persistUserSettings(this._savedUserSettings);
|
|
825
953
|
// Bubble the event up to parent containers (back-compat; no consumer required).
|
|
826
|
-
this.
|
|
954
|
+
this.UserSettingsChanged.emit({
|
|
827
955
|
settings: this._savedUserSettings,
|
|
828
|
-
componentName: this.
|
|
956
|
+
componentName: this.Component?.name,
|
|
829
957
|
timestamp: new Date()
|
|
830
958
|
});
|
|
831
959
|
}
|
|
@@ -862,7 +990,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
862
990
|
this._savedUserSettings = mergeUserSettings(this._savedUserSettings, stored);
|
|
863
991
|
}
|
|
864
992
|
catch (error) {
|
|
865
|
-
if (this.
|
|
993
|
+
if (this.EnableLogging) {
|
|
866
994
|
console.warn('MJReactComponent: failed to seed user settings from store', error);
|
|
867
995
|
}
|
|
868
996
|
}
|
|
@@ -890,7 +1018,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
890
1018
|
UserInfoEngine.Instance.SetSettingDebounced(key, serialized, user);
|
|
891
1019
|
}
|
|
892
1020
|
catch (error) {
|
|
893
|
-
if (this.
|
|
1021
|
+
if (this.EnableLogging) {
|
|
894
1022
|
console.warn('MJReactComponent: failed to persist user settings', error);
|
|
895
1023
|
}
|
|
896
1024
|
}
|
|
@@ -964,7 +1092,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
964
1092
|
* Builds a DataSnapshot from captured RunView/RunQuery results.
|
|
965
1093
|
* Returns null if no data was captured.
|
|
966
1094
|
*/
|
|
967
|
-
|
|
1095
|
+
buildCapturedDataSnapshot() {
|
|
968
1096
|
if (this.capturedData.length === 0)
|
|
969
1097
|
return null;
|
|
970
1098
|
const tables = this.capturedData.map((captured, idx) => {
|
|
@@ -996,7 +1124,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
996
1124
|
};
|
|
997
1125
|
return table;
|
|
998
1126
|
});
|
|
999
|
-
return DataSnapshot.FromTables(tables, this.
|
|
1127
|
+
return DataSnapshot.FromTables(tables, this.Component?.title ?? this.Component?.name);
|
|
1000
1128
|
}
|
|
1001
1129
|
/**
|
|
1002
1130
|
* Clean up resources
|
|
@@ -1019,7 +1147,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1019
1147
|
}
|
|
1020
1148
|
// Clear references
|
|
1021
1149
|
this.compiledComponent = null;
|
|
1022
|
-
this.
|
|
1150
|
+
this.IsInitialized = false;
|
|
1023
1151
|
this.capturedData = [];
|
|
1024
1152
|
// Trigger registry cleanup (guard: adapter may not be initialized if
|
|
1025
1153
|
// React bootstrap failed or was destroyed during retry)
|
|
@@ -1049,7 +1177,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1049
1177
|
*/
|
|
1050
1178
|
updateState(path, value) {
|
|
1051
1179
|
// Just emit the event, don't manage state here
|
|
1052
|
-
this.
|
|
1180
|
+
this.StateChange.emit({ path, value });
|
|
1053
1181
|
}
|
|
1054
1182
|
// =================================================================
|
|
1055
1183
|
// Standard Component Methods - Strongly Typed
|
|
@@ -1063,7 +1191,7 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1063
1191
|
const explicit = this.compiledComponent?.getCurrentDataState?.();
|
|
1064
1192
|
if (explicit && typeof explicit === 'object')
|
|
1065
1193
|
return explicit;
|
|
1066
|
-
return this.
|
|
1194
|
+
return this.buildCapturedDataSnapshot() ?? undefined;
|
|
1067
1195
|
}
|
|
1068
1196
|
/**
|
|
1069
1197
|
* Validates the current state of the component
|
|
@@ -1076,51 +1204,75 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1076
1204
|
* Checks if the component has unsaved changes
|
|
1077
1205
|
* @returns true if dirty, false otherwise
|
|
1078
1206
|
*/
|
|
1079
|
-
|
|
1207
|
+
IsDirty() {
|
|
1080
1208
|
return this.compiledComponent?.isDirty?.() || false;
|
|
1081
1209
|
}
|
|
1210
|
+
/** @deprecated Use {@link IsDirty}. */
|
|
1211
|
+
isDirty() {
|
|
1212
|
+
return this.IsDirty();
|
|
1213
|
+
}
|
|
1082
1214
|
/**
|
|
1083
1215
|
* Resets the component to its initial state
|
|
1084
1216
|
*/
|
|
1085
|
-
|
|
1217
|
+
Reset() {
|
|
1086
1218
|
this.compiledComponent?.reset?.();
|
|
1087
1219
|
}
|
|
1220
|
+
/** @deprecated Use {@link Reset}. */
|
|
1221
|
+
reset() {
|
|
1222
|
+
return this.Reset();
|
|
1223
|
+
}
|
|
1088
1224
|
/**
|
|
1089
1225
|
* Scrolls to a specific element or position within the component
|
|
1090
1226
|
* @param target - Element selector, element reference, or scroll options
|
|
1091
1227
|
*/
|
|
1092
|
-
|
|
1228
|
+
ScrollTo(target) {
|
|
1093
1229
|
this.compiledComponent?.scrollTo?.(target);
|
|
1094
1230
|
}
|
|
1231
|
+
/** @deprecated Use {@link ScrollTo}. */
|
|
1232
|
+
scrollTo(target) {
|
|
1233
|
+
return this.ScrollTo(target);
|
|
1234
|
+
}
|
|
1095
1235
|
/**
|
|
1096
1236
|
* Sets focus to a specific element within the component
|
|
1097
1237
|
* @param target - Element selector or element reference
|
|
1098
1238
|
*/
|
|
1099
|
-
|
|
1239
|
+
Focus(target) {
|
|
1100
1240
|
this.compiledComponent?.focus?.(target);
|
|
1101
1241
|
}
|
|
1242
|
+
/** @deprecated Use {@link Focus}. */
|
|
1243
|
+
focus(target) {
|
|
1244
|
+
return this.Focus(target);
|
|
1245
|
+
}
|
|
1102
1246
|
/**
|
|
1103
1247
|
* Invokes a custom method on the component
|
|
1104
1248
|
* @param methodName - Name of the method to invoke
|
|
1105
1249
|
* @param args - Arguments to pass to the method
|
|
1106
1250
|
* @returns The result of the method call, or undefined if method doesn't exist
|
|
1107
1251
|
*/
|
|
1108
|
-
|
|
1252
|
+
InvokeMethod(methodName, ...args) {
|
|
1109
1253
|
return this.compiledComponent?.invokeMethod?.(methodName, ...args);
|
|
1110
1254
|
}
|
|
1255
|
+
/** @deprecated Use {@link InvokeMethod}. */
|
|
1256
|
+
invokeMethod(methodName, ...args) {
|
|
1257
|
+
return this.InvokeMethod(methodName, ...args);
|
|
1258
|
+
}
|
|
1111
1259
|
/**
|
|
1112
1260
|
* Checks if a method is available on the component
|
|
1113
1261
|
* @param methodName - Name of the method to check
|
|
1114
1262
|
* @returns true if the method exists
|
|
1115
1263
|
*/
|
|
1116
|
-
|
|
1264
|
+
HasMethod(methodName) {
|
|
1117
1265
|
return this.compiledComponent?.hasMethod?.(methodName) || false;
|
|
1118
1266
|
}
|
|
1267
|
+
/** @deprecated Use {@link HasMethod}. */
|
|
1268
|
+
hasMethod(methodName) {
|
|
1269
|
+
return this.HasMethod(methodName);
|
|
1270
|
+
}
|
|
1119
1271
|
/**
|
|
1120
1272
|
* Print the component content
|
|
1121
1273
|
* Uses component's print method if available, otherwise uses window.print()
|
|
1122
1274
|
*/
|
|
1123
|
-
|
|
1275
|
+
Print() {
|
|
1124
1276
|
if (this.compiledComponent?.print) {
|
|
1125
1277
|
this.compiledComponent.print();
|
|
1126
1278
|
}
|
|
@@ -1128,12 +1280,16 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1128
1280
|
window.print();
|
|
1129
1281
|
}
|
|
1130
1282
|
}
|
|
1283
|
+
/** @deprecated Use {@link Print}. */
|
|
1284
|
+
print() {
|
|
1285
|
+
return this.Print();
|
|
1286
|
+
}
|
|
1131
1287
|
/**
|
|
1132
1288
|
* Force clear component registries
|
|
1133
1289
|
* Used by Component Studio for fresh loads
|
|
1134
1290
|
* This is a static method that can be called without a component instance
|
|
1135
1291
|
*/
|
|
1136
|
-
static
|
|
1292
|
+
static ForceClearRegistries() {
|
|
1137
1293
|
// Clear React runtime's component registry service
|
|
1138
1294
|
ComponentRegistryService.reset();
|
|
1139
1295
|
// Clear any cached hierarchy registrar
|
|
@@ -1142,6 +1298,10 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1142
1298
|
}
|
|
1143
1299
|
console.log('🧹 All component registries cleared for fresh load');
|
|
1144
1300
|
}
|
|
1301
|
+
/** @deprecated Use {@link ForceClearRegistries}. */
|
|
1302
|
+
static forceClearRegistries() {
|
|
1303
|
+
return this.ForceClearRegistries();
|
|
1304
|
+
}
|
|
1145
1305
|
/**
|
|
1146
1306
|
* Gets the current data state from the hosted React component.
|
|
1147
1307
|
* Falls back to a DataSnapshot built from intercepted RunView/RunQuery results
|
|
@@ -1163,8 +1323,8 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1163
1323
|
i0.ɵɵviewQuery(_c0, 7, ElementRef);
|
|
1164
1324
|
} if (rf & 2) {
|
|
1165
1325
|
let _t;
|
|
1166
|
-
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.
|
|
1167
|
-
} }, inputs: { component: "component", enableLogging: "enableLogging", useComponentManager: "useComponentManager", utilities: "utilities", styles: "styles", savedUserSettings: "savedUserSettings", UserStateScope: "UserStateScope", PersistUserSettings: "PersistUserSettings", componentProps: "componentProps" }, outputs: { stateChange: "stateChange", componentEvent: "componentEvent", refreshData: "refreshData", openEntityRecord: "openEntityRecord", userSettingsChanged: "userSettingsChanged", initialized: "initialized" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 3, consts: [["container", ""], [1, "react-component-wrapper"], [1, "react-component-container"], [1, "loading-overlay"], [1, "loading-spinner"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "loading-text"]], template: function MJReactComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1326
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.Container = _t.first);
|
|
1327
|
+
} }, inputs: { Component: "Component", component: "component", EnableLogging: "EnableLogging", enableLogging: "enableLogging", UseComponentManager: "UseComponentManager", useComponentManager: "useComponentManager", utilities: "utilities", Styles: "Styles", styles: "styles", SavedUserSettings: "SavedUserSettings", savedUserSettings: "savedUserSettings", UserStateScope: "UserStateScope", PersistUserSettings: "PersistUserSettings", ComponentProps: "ComponentProps", componentProps: "componentProps" }, outputs: { StateChange: "StateChange", stateChange: "stateChange", ComponentEvent: "ComponentEvent", componentEvent: "componentEvent", RefreshData: "RefreshData", refreshData: "refreshData", OpenEntityRecord: "OpenEntityRecord", openEntityRecord: "openEntityRecord", UserSettingsChanged: "UserSettingsChanged", userSettingsChanged: "userSettingsChanged", Initialized: "Initialized", initialized: "initialized" }, standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 4, vars: 3, consts: [["container", ""], [1, "react-component-wrapper"], [1, "react-component-container"], [1, "loading-overlay"], [1, "loading-spinner"], [1, "fa-solid", "fa-spinner", "fa-spin"], [1, "loading-text"]], template: function MJReactComponent_Template(rf, ctx) { if (rf & 1) {
|
|
1168
1328
|
i0.ɵɵelementStart(0, "div", 1);
|
|
1169
1329
|
i0.ɵɵelement(1, "div", 2, 0);
|
|
1170
1330
|
i0.ɵɵconditionalCreate(3, MJReactComponent_Conditional_3_Template, 5, 0, "div", 3);
|
|
@@ -1191,37 +1351,61 @@ export class MJReactComponent extends BaseAngularComponent {
|
|
|
1191
1351
|
}
|
|
1192
1352
|
</div>
|
|
1193
1353
|
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["\n :host {\n display: block;\n width: 100%;\n height: 100%;\n }\n .react-component-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n }\n .react-component-container {\n width: 100%;\n height: 100%;\n transition: opacity 0.3s ease;\n }\n .react-component-container.loading {\n opacity: 0;\n }\n .loading-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background-color: rgba(255, 255, 255, 0.9);\n z-index: 1;\n }\n .loading-spinner {\n font-size: 48px;\n color: #5B4FE9;\n margin-bottom: 16px;\n }\n .loading-text {\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", Roboto, sans-serif;\n font-size: 14px;\n color: #64748B;\n margin-top: 8px;\n }\n "] }]
|
|
1194
|
-
}], () => [{ type: i1.ReactBridgeService }, { type: i2.AngularAdapterService }, { type: i0.ChangeDetectorRef }, { type: i3.MJNotificationService }], {
|
|
1354
|
+
}], () => [{ type: i1.ReactBridgeService }, { type: i2.AngularAdapterService }, { type: i0.ChangeDetectorRef }, { type: i3.MJNotificationService }], { Component: [{
|
|
1355
|
+
type: Input
|
|
1356
|
+
}], component: [{
|
|
1357
|
+
type: Input
|
|
1358
|
+
}], EnableLogging: [{
|
|
1195
1359
|
type: Input
|
|
1196
1360
|
}], enableLogging: [{
|
|
1197
1361
|
type: Input
|
|
1362
|
+
}], UseComponentManager: [{
|
|
1363
|
+
type: Input
|
|
1198
1364
|
}], useComponentManager: [{
|
|
1199
1365
|
type: Input
|
|
1200
1366
|
}], utilities: [{
|
|
1201
1367
|
type: Input
|
|
1368
|
+
}], Styles: [{
|
|
1369
|
+
type: Input
|
|
1202
1370
|
}], styles: [{
|
|
1203
1371
|
type: Input
|
|
1372
|
+
}], SavedUserSettings: [{
|
|
1373
|
+
type: Input
|
|
1204
1374
|
}], savedUserSettings: [{
|
|
1205
1375
|
type: Input
|
|
1206
1376
|
}], UserStateScope: [{
|
|
1207
1377
|
type: Input
|
|
1208
1378
|
}], PersistUserSettings: [{
|
|
1209
1379
|
type: Input
|
|
1380
|
+
}], ComponentProps: [{
|
|
1381
|
+
type: Input
|
|
1210
1382
|
}], componentProps: [{
|
|
1211
1383
|
type: Input
|
|
1384
|
+
}], StateChange: [{
|
|
1385
|
+
type: Output
|
|
1212
1386
|
}], stateChange: [{
|
|
1213
1387
|
type: Output
|
|
1388
|
+
}], ComponentEvent: [{
|
|
1389
|
+
type: Output
|
|
1214
1390
|
}], componentEvent: [{
|
|
1215
1391
|
type: Output
|
|
1392
|
+
}], RefreshData: [{
|
|
1393
|
+
type: Output
|
|
1216
1394
|
}], refreshData: [{
|
|
1217
1395
|
type: Output
|
|
1396
|
+
}], OpenEntityRecord: [{
|
|
1397
|
+
type: Output
|
|
1218
1398
|
}], openEntityRecord: [{
|
|
1219
1399
|
type: Output
|
|
1400
|
+
}], UserSettingsChanged: [{
|
|
1401
|
+
type: Output
|
|
1220
1402
|
}], userSettingsChanged: [{
|
|
1221
1403
|
type: Output
|
|
1404
|
+
}], Initialized: [{
|
|
1405
|
+
type: Output
|
|
1222
1406
|
}], initialized: [{
|
|
1223
1407
|
type: Output
|
|
1224
|
-
}],
|
|
1408
|
+
}], Container: [{
|
|
1225
1409
|
type: ViewChild,
|
|
1226
1410
|
args: ['container', { read: ElementRef, static: true }]
|
|
1227
1411
|
}] }); })();
|