barsa-novin-ray-core 2.2.93 → 2.3.1

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.
@@ -3270,6 +3270,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
3270
3270
  type: Injectable
3271
3271
  }], ctorParameters: () => [{ type: i1.Router }, { type: PortalService }] });
3272
3272
 
3273
+ function formRoutes(authGuard = false) {
3274
+ return {
3275
+ path: 'form',
3276
+ canActivate: authGuard ? [AuthGuard] : [],
3277
+ loadChildren: () => Promise.resolve().then(function () { return barsaSapUiFormPage_module; }).then((m) => m.BarsaSapUiFormPageModule)
3278
+ };
3279
+ }
3280
+
3273
3281
  class LocalStorageService {
3274
3282
  constructor() {
3275
3283
  this.localstorage = false;
@@ -3591,6 +3599,9 @@ class PortalService {
3591
3599
  }
3592
3600
  this.setValueOnObject(path, index + 1, modules, object[prop]);
3593
3601
  }
3602
+ getComponentType(moduleName, componentName, _selector) {
3603
+ return this.dcm.getComponentType(componentName, moduleName);
3604
+ }
3594
3605
  getComponent(moduleName, _modulePath, _componentName, selector, parentInjector) {
3595
3606
  return this.dcm.getComponentBySelector(selector, moduleName, parentInjector);
3596
3607
  }
@@ -3865,6 +3876,34 @@ class PortalService {
3865
3876
  });
3866
3877
  return x2;
3867
3878
  }
3879
+ _addPage(routes, page) {
3880
+ const portalService = this;
3881
+ function traverse(children, cpage) {
3882
+ const path = cpage.RoutePath;
3883
+ const pageComponent = portalService.getComponentType(cpage.Module, cpage.ComponentName, cpage.ComponentSelector);
3884
+ const newRoute = {
3885
+ path: (cpage.IsDefaultRoute === 'True' && path === '') || (path !== '' && typeof path !== 'undefined')
3886
+ ? path
3887
+ : cpage.Route.replace('/', ''),
3888
+ canActivate: cpage.HasAuthorize !== 'True' ? [] : [AuthGuard],
3889
+ resolve: { pageData: PortalPageResolver },
3890
+ component: pageComponent,
3891
+ outlet: cpage.Outlet,
3892
+ data: {
3893
+ pageData: {
3894
+ Module: cpage.Module,
3895
+ HasAuthorize: cpage.HasAuthorize === 'True',
3896
+ Route: cpage.Route
3897
+ }
3898
+ },
3899
+ children: [formRoutes()]
3900
+ };
3901
+ children.push(newRoute);
3902
+ // Recursively process each MetaObjectModel inside MoDataList
3903
+ cpage.ChildPageList.MoDataList.forEach((c) => traverse(newRoute.children, c));
3904
+ }
3905
+ traverse(routes, page);
3906
+ }
3868
3907
  loadPortalDataSync() {
3869
3908
  if (BarsaApi.LoginFormData?.error?.userMessage) {
3870
3909
  return;
@@ -3885,14 +3924,25 @@ class PortalService {
3885
3924
  });
3886
3925
  const pathToRemove = removePaged.map((d) => d.path);
3887
3926
  configRoute = configRoute.filter((c) => pathToRemove.indexOf(c.path) === -1);
3927
+ const newConfigRoutes = [];
3928
+ portalData.ChildPageList.MoDataList.forEach((c) => {
3929
+ this._addPage(newConfigRoutes, c);
3930
+ });
3888
3931
  if (defaultPage != null) {
3889
3932
  const defaultPageRoute = defaultPage.Route.replace('/', '');
3890
- const defaultPath = configRoute.find((c) => c.path === '');
3891
- defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3892
- configRoute.push({ path: '**', redirectTo: defaultPageRoute });
3933
+ if (portalData.IsDynamicRoute) {
3934
+ const defaultPath = newConfigRoutes.find((c) => c.path === '');
3935
+ defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3936
+ newConfigRoutes.push({ path: '**', redirectTo: defaultPageRoute });
3937
+ }
3938
+ else {
3939
+ const defaultPath = configRoute.find((c) => c.path === '');
3940
+ defaultPath && (defaultPath.redirectTo = defaultPageRoute);
3941
+ configRoute.push({ path: '**', redirectTo: defaultPageRoute });
3942
+ }
3893
3943
  // const notFoundPath = configRoute.find((c) => c.path === '**');
3894
3944
  // notFoundPath && (notFoundPath.redirectTo = defaultPage.Route.replace('/', ''));
3895
- this._router.resetConfig(configRoute);
3945
+ this._router.resetConfig(portalData.IsDynamicRoute ? newConfigRoutes : configRoute);
3896
3946
  }
3897
3947
  }
3898
3948
  this.extractAllPages(portalData);
@@ -14567,14 +14617,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
14567
14617
  args: ['placeholder', { read: ViewContainerRef, static: true }]
14568
14618
  }] } });
14569
14619
 
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
14620
  const children = [
14579
14621
  {
14580
14622
  path: 'popup',