@smartsoft001/angular 2.96.0 → 2.98.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.
|
@@ -452,53 +452,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0", ngImpor
|
|
|
452
452
|
const DYNAMIC_COMPONENTS_STORE = new InjectionToken('DYNAMIC_COMPONENTS_STORE');
|
|
453
453
|
class DynamicComponentStorageService {
|
|
454
454
|
static get(key, moduleRef) {
|
|
455
|
-
// Changed DynamicComponentType to string
|
|
456
455
|
const getComponents = (k, m) => {
|
|
457
|
-
// Changed DynamicComponentType to string
|
|
458
456
|
if (!m)
|
|
459
457
|
return [];
|
|
460
|
-
// Attempt to get components from the DYNAMIC_COMPONENTS_STORE first
|
|
461
458
|
const fromStore = m.injector.get(DYNAMIC_COMPONENTS_STORE, null);
|
|
462
|
-
|
|
463
|
-
if (fromStore) {
|
|
464
|
-
declarations = fromStore;
|
|
465
|
-
}
|
|
466
|
-
else if (m.instance &&
|
|
467
|
-
m.instance.constructor &&
|
|
468
|
-
m.instance.constructor['ɵmod']) {
|
|
469
|
-
// Fallback to internal Angular API if DYNAMIC_COMPONENTS_STORE is not provided
|
|
470
|
-
// This is fragile and might break in future Angular versions.
|
|
471
|
-
declarations =
|
|
472
|
-
m.instance.constructor['ɵmod'].declarations || [];
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
console.warn('DynamicComponentStorageService: Could not retrieve declarations from moduleRef.');
|
|
476
|
-
}
|
|
477
|
-
return declarations.filter((c) => c['smartType'] === k);
|
|
459
|
+
return (fromStore ? fromStore : m.instance.constructor['ɵmod'].declarations).filter((c) => c['smartType'] === k);
|
|
478
460
|
};
|
|
479
461
|
let components = getComponents(key, moduleRef);
|
|
480
|
-
// Attempt to look in the root AppModule if not found in the current moduleRef
|
|
481
462
|
if (!components.length && moduleRef) {
|
|
482
|
-
const applicationRef = moduleRef.injector.get(ApplicationRef
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
applicationRef.components
|
|
486
|
-
// Try to find AppComponent, otherwise use the first available component's injector
|
|
487
|
-
let appComponentInjector = applicationRef.components.find((t) => t.componentType.name === 'AppComponent')?.injector;
|
|
488
|
-
if (!appComponentInjector) {
|
|
489
|
-
appComponentInjector = applicationRef.components[0]?.injector;
|
|
490
|
-
}
|
|
491
|
-
if (appComponentInjector) {
|
|
492
|
-
const appModuleRef = appComponentInjector.get(NgModuleRef, null);
|
|
493
|
-
if (appModuleRef && appModuleRef !== moduleRef) {
|
|
494
|
-
// Avoid infinite loop if already root
|
|
495
|
-
components = getComponents(key, appModuleRef);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
463
|
+
const applicationRef = moduleRef.injector.get(ApplicationRef);
|
|
464
|
+
let appComponentInjector = applicationRef.components.find((t) => t.componentType.name === 'AppComponent')?.injector;
|
|
465
|
+
if (!appComponentInjector) {
|
|
466
|
+
appComponentInjector = applicationRef.components[0]?.injector;
|
|
498
467
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
468
|
+
if (!appComponentInjector) {
|
|
469
|
+
return [];
|
|
470
|
+
}
|
|
471
|
+
const appModuleRef = appComponentInjector.get(NgModuleRef);
|
|
472
|
+
components = getComponents(key, appModuleRef);
|
|
502
473
|
}
|
|
503
474
|
return components;
|
|
504
475
|
}
|
|
@@ -6501,7 +6472,7 @@ class ListComponent extends CreateDynamicComponent('list') {
|
|
|
6501
6472
|
this._options.update((options) => {
|
|
6502
6473
|
return {
|
|
6503
6474
|
...options,
|
|
6504
|
-
fields: _.sortBy(getModelFieldsWithOptions(new (this._options().type)())
|
|
6475
|
+
fields: _.sortBy(getModelFieldsWithOptions(new (this._options().type)())?.filter((item) => item?.options?.list), (item) => (item?.options?.list).order),
|
|
6505
6476
|
};
|
|
6506
6477
|
});
|
|
6507
6478
|
}
|