barsa-novin-ray-core 2.2.93 → 2.3.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.
@@ -2637,10 +2637,20 @@ class DynamicComponentService {
2637
2637
  };
2638
2638
  }
2639
2639
  }
2640
- getComponentType(componentName, moduleName) {
2640
+ getComponentType(componentSelector, componentName, moduleName) {
2641
2641
  const moName = moduleName + 'Module';
2642
2642
  const module = this._dynamicModuleWithComponents[moName];
2643
- return module.ngModuleRef.dynamicComponents.find((c) => c.name === componentName + 'Component');
2643
+ const cmpName = componentName + 'Component';
2644
+ let x = module.ngModuleRef.dynamicComponents.find((c) => c.name.includes(cmpName));
2645
+ if (!x) {
2646
+ module.ngModuleRef.dynamicComponents.forEach((c) => {
2647
+ if (!x) {
2648
+ const cmp = c['ɵcmp'];
2649
+ cmp?.selectors?.length && (x = cmp.selectors[0].includes(componentSelector) ? c : null);
2650
+ }
2651
+ });
2652
+ }
2653
+ return x;
2644
2654
  }
2645
2655
  getComponentBySelector(selector, moduleName, injector) {
2646
2656
  const moName = moduleName + 'Module';
@@ -3270,6 +3280,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3270
3280
  type: Injectable
3271
3281
  }], ctorParameters: () => [{ type: i1.Router }, { type: PortalService }] });
3272
3282
 
3283
+ function formRoutes(authGuard = false) {
3284
+ return {
3285
+ path: 'form',
3286
+ canActivate: authGuard ? [AuthGuard] : [],
3287
+ loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((m) => m.BarsaSapUiFormPageModule)
3288
+ };
3289
+ }
3290
+
3273
3291
  class LocalStorageService {
3274
3292
  constructor() {
3275
3293
  this.localstorage = false;
@@ -3591,6 +3609,9 @@ class PortalService {
3591
3609
  }
3592
3610
  this.setValueOnObject(path, index + 1, modules, object[prop]);
3593
3611
  }
3612
+ getComponentType(moduleName, componentName, selector) {
3613
+ return this.dcm.getComponentType(selector, componentName, moduleName);
3614
+ }
3594
3615
  getComponent(moduleName, _modulePath, _componentName, selector, parentInjector) {
3595
3616
  return this.dcm.getComponentBySelector(selector, moduleName, parentInjector);
3596
3617
  }
@@ -3865,6 +3886,34 @@ class PortalService {
3865
3886
  });
3866
3887
  return x2;
3867
3888
  }
3889
+ _addPage(routes, page) {
3890
+ const portalService = this;
3891
+ function traverse(children, cpage) {
3892
+ const path = cpage.RoutePath;
3893
+ const pageComponent = portalService.getComponentType(cpage.Module, cpage.ComponentName, cpage.ComponentSelector);
3894
+ const newRoute = {
3895
+ path: (cpage.IsDefaultRoute === 'True' && path === '') || (path !== '' && typeof path !== 'undefined')
3896
+ ? path
3897
+ : cpage.Route.replace('/', ''),
3898
+ canActivate: cpage.HasAuthorize !== 'True' ? [] : [AuthGuard],
3899
+ resolve: { pageData: PortalPageResolver },
3900
+ component: pageComponent,
3901
+ outlet: cpage.Outlet,
3902
+ data: {
3903
+ pageData: {
3904
+ Module: cpage.Module,
3905
+ HasAuthorize: cpage.HasAuthorize === 'True',
3906
+ Route: cpage.Route
3907
+ }
3908
+ },
3909
+ children: [formRoutes()]
3910
+ };
3911
+ children.push(newRoute);
3912
+ // Recursively process each MetaObjectModel inside MoDataList
3913
+ cpage.ChildPageList.MoDataList.forEach((c) => traverse(newRoute.children, c));
3914
+ }
3915
+ traverse(routes, page);
3916
+ }
3868
3917
  loadPortalDataSync() {
3869
3918
  if (BarsaApi.LoginFormData?.error?.userMessage) {
3870
3919
  return;
@@ -3885,14 +3934,25 @@ class PortalService {
3885
3934
  });
3886
3935
  const pathToRemove = removePaged.map((d) => d.path);
3887
3936
  configRoute = configRoute.filter((c) => pathToRemove.indexOf(c.path) === -1);
3937
+ const newConfigRoutes = [];
3938
+ portalData.ChildPageList.MoDataList.forEach((c) => {
3939
+ this._addPage(newConfigRoutes, c);
3940
+ });
3888
3941
  if (defaultPage != null) {
3889
3942
  const defaultPageRoute = defaultPage.Route.replace('/', '');
3890
- const defaultPath = configRoute.find((c) => c.path === '');
3891
- defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3892
- configRoute.push({ path: '**', redirectTo: defaultPageRoute });
3943
+ if (portalData.IsDynamicRoute) {
3944
+ const defaultPath = newConfigRoutes.find((c) => c.path === '');
3945
+ defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3946
+ newConfigRoutes.push({ path: '**', redirectTo: defaultPageRoute });
3947
+ }
3948
+ else {
3949
+ const defaultPath = configRoute.find((c) => c.path === '');
3950
+ defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3951
+ configRoute.push({ path: '**', redirectTo: defaultPageRoute });
3952
+ }
3893
3953
  // const notFoundPath = configRoute.find((c) => c.path === '**');
3894
3954
  // notFoundPath && (notFoundPath.redirectTo = defaultPage.Route.replace('/', ''));
3895
- this._router.resetConfig(configRoute);
3955
+ this._router.resetConfig(portalData.IsDynamicRoute ? newConfigRoutes : configRoute);
3896
3956
  }
3897
3957
  }
3898
3958
  this.extractAllPages(portalData);
@@ -14567,14 +14627,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
14567
14627
  args: ['placeholder', { read: ViewContainerRef, static: true }]
14568
14628
  }] } });
14569
14629
 
14570
- function formRoutes(authGuard = false) {
14571
- return {
14572
- path: 'form',
14573
- canActivate: authGuard ? [AuthGuard] : [],
14574
- loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((m) => m.BarsaSapUiFormPageModule)
14575
- };
14576
- }
14577
-
14578
14630
  const children = [
14579
14631
  {
14580
14632
  path: 'popup',