barsa-novin-ray-core 2.3.40 → 2.3.42

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.
@@ -3020,10 +3020,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
3020
3020
  }] });
3021
3021
 
3022
3022
  class MultipleGroupByPipe {
3023
- /** Inserted by Angular inject() migration for backwards compatibility */
3024
3023
  constructor() {
3025
3024
  this.bbbPipe = inject(BbbTranslatePipe);
3026
- this.visibleValuePipe = inject(VisibleValuePipe);
3027
3025
  }
3028
3026
  transform(collection, sortSettings) {
3029
3027
  if (sortSettings.length === 0) {
@@ -3104,7 +3102,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
3104
3102
  name: 'multipleGroupBy',
3105
3103
  standalone: false
3106
3104
  }]
3107
- }], ctorParameters: () => [] });
3105
+ }] });
3108
3106
 
3109
3107
  class PictureFieldSourcePipe {
3110
3108
  constructor() { }
@@ -4942,7 +4940,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
4942
4940
 
4943
4941
  class AuthGuard {
4944
4942
  constructor() {
4945
- this.portalService = inject(PortalService);
4943
+ this._portalService = inject(PortalService);
4946
4944
  this.router = inject(Router);
4947
4945
  }
4948
4946
  canActivate(activatedRouteSnapshot
@@ -4951,19 +4949,19 @@ class AuthGuard {
4951
4949
  const url = decodeURI(activatedRouteSnapshot._routerState.url);
4952
4950
  let url2 = url.split('/').find((c) => c && !c.startsWith('(')) ?? '';
4953
4951
  url2 = '/' + url2;
4954
- return this.portalService.getPageData(url2, false).pipe(map((pageData) => {
4952
+ return this._portalService.getPageData(url2, false).pipe(map((pageData) => {
4955
4953
  const pageNeedAuthorize = pageData?.HasAuthorize || pageData == null ? true : false;
4956
4954
  const hasAuthorized = (!BarsaApi.LoginFormData.IsAnonymous && BarsaApi.LoginFormData.IsUserLoggedIn) ||
4957
4955
  !pageNeedAuthorize;
4958
4956
  return { hasAuthorized, pageData };
4959
- }), withLatestFrom(this.portalService.loginRoute$), tap(([pageInfo, loginRoute]) => {
4957
+ }), withLatestFrom(this._portalService.loginRoute$), tap(([pageInfo, loginRoute]) => {
4960
4958
  if (!pageInfo.hasAuthorized) {
4961
4959
  this.router.navigate([loginRoute]);
4962
4960
  }
4963
4961
  }), tap(([pageInfo, _]) => {
4964
4962
  if (pageInfo.hasAuthorized) {
4965
4963
  const needChangePassword = BarsaApi.Ul.ApplicationCtrlr.AdvancedSecurityLogin?.NeedChangePassword;
4966
- const changepasswordRoute = pageInfo.pageData?.ChildPageList.MoDataList.find((c) => c.IsChangePasswordRoute || c.IsChangePasswordRoute === 'True')?.Route || 'changepassword';
4964
+ const changepasswordRoute = this._portalService.getListOfChildPage(pageInfo.pageData).find((c) => c.IsChangePasswordRoute || c.IsChangePasswordRoute === 'True')?.Route || 'changepassword';
4967
4965
  const path = activatedRouteSnapshot.routeConfig?.path;
4968
4966
  if (changepasswordRoute &&
4969
4967
  path &&
@@ -5122,8 +5120,10 @@ class ApplicationCtrlrService {
5122
5120
  }
5123
5121
  selectedSystem(systemId) {
5124
5122
  this._selectedSystemId$.next(systemId);
5125
- this.selectNavGroup(this._selectedNavGroupId$.getValue()[systemId], false);
5126
- this.selectNavGroupItem(this._selectedNavGroupItemId$.getValue()[systemId]);
5123
+ const selectedNavGroupId = this._selectedNavGroupId$.getValue()[systemId];
5124
+ const selectedNavGroupItemId = this._selectedNavGroupItemId$.getValue()[systemId];
5125
+ this.selectNavGroup(selectedNavGroupId, false);
5126
+ this.selectNavGroupItem(selectedNavGroupItemId);
5127
5127
  }
5128
5128
  selectSystemCommand(command) {
5129
5129
  this.selectSystemCommandId(command.Key);
@@ -5170,6 +5170,13 @@ class ApplicationCtrlrService {
5170
5170
  sidebarToggled(value) {
5171
5171
  this._sidebarToggle$.next(value);
5172
5172
  }
5173
+ selectedReportId(reportId) {
5174
+ const selectedReport = this._selectedReportId$.getValue();
5175
+ const selectedSystemId = this._selectedSystemId$.getValue();
5176
+ const systemId = selectedSystemId;
5177
+ selectedReport[systemId] = reportId;
5178
+ this._selectedReportId$.next(selectedReport);
5179
+ }
5173
5180
  loadSystem(id, resolve, reject) {
5174
5181
  BarsaApi.Ul.ApplicationCtrlr._loadSystem(id, true, (data) => {
5175
5182
  resolve(data);
@@ -5276,7 +5283,7 @@ class RedirectHomeGuard {
5276
5283
  return of(!BarsaApi.LoginFormData.IsAnonymous && BarsaApi.LoginFormData.IsUserLoggedIn).pipe(withLatestFrom(this._portalService.portalData$), tap(([hasAuthorized, portalData]) => {
5277
5284
  if (hasAuthorized) {
5278
5285
  const homePage = this._portalService.DefaultPage ||
5279
- portalData?.ChildPageList.MoDataList.find((c) => c.IsDefaultRoute === 'True');
5286
+ this._portalService.getListOfChildPage(portalData).find((c) => c.IsDefaultRoute === 'True');
5280
5287
  const homeRoute = homePage?.Route || '/';
5281
5288
  this.router.navigate([homeRoute]);
5282
5289
  }
@@ -5637,11 +5644,18 @@ class PortalService {
5637
5644
  setUserLoginStatus(status) {
5638
5645
  this._loggedInSource.next(status);
5639
5646
  }
5647
+ getListOfChildPage(model) {
5648
+ return !model
5649
+ ? []
5650
+ : model.ChildPageList2?.MoDataList.length
5651
+ ? model.ChildPageList2.MoDataList
5652
+ : model.ChildPageList?.MoDataList || [];
5653
+ }
5640
5654
  extractAllPages(portalData) {
5641
5655
  if (!portalData) {
5642
5656
  return;
5643
5657
  }
5644
- portalData.ChildPageList.MoDataList.forEach((pageData) => {
5658
+ this.getListOfChildPage(portalData).forEach((pageData) => {
5645
5659
  this.addChildPages(pageData);
5646
5660
  });
5647
5661
  }
@@ -5650,7 +5664,7 @@ class PortalService {
5650
5664
  return;
5651
5665
  }
5652
5666
  const config = this._router.config;
5653
- portalData.ChildPageList.MoDataList.forEach((pageData) => {
5667
+ this.getListOfChildPage(portalData).forEach((pageData) => {
5654
5668
  const path = pageData.Route.replace('/', '');
5655
5669
  config.push(this.createRoute(pageData, path, pageData.HasAuthorize, pageData.PageModule?.$Caption, null, null));
5656
5670
  if (pageData.IsDefaultRoute || pageData.IsDefaultRoute === 'True') {
@@ -5682,10 +5696,10 @@ class PortalService {
5682
5696
  }
5683
5697
  addChildPages(pageData) {
5684
5698
  this.pages.push(pageData);
5685
- if (!pageData.ChildPageList?.MoDataList?.length) {
5699
+ if (!this.getListOfChildPage(pageData).length) {
5686
5700
  return;
5687
5701
  }
5688
- pageData.ChildPageList.MoDataList.forEach((childPage) => {
5702
+ this.getListOfChildPage(pageData).forEach((childPage) => {
5689
5703
  this.addChildPages(childPage);
5690
5704
  });
5691
5705
  }
@@ -5758,12 +5772,7 @@ class PortalService {
5758
5772
  return this.cachedPageData[url];
5759
5773
  }
5760
5774
  const pageData = this.findPageByRoute(url);
5761
- this.cachedPageData[url] = this.apiService
5762
- .loadPortalPageData(pageData?.Id, this.portalDataSource.getValue()?.ChildPageList.TypeDefId)
5763
- .pipe(map((pageMo) => pageMo.Data.Mo), tap((pageMo) => {
5764
- this.addChildRoute(pageMo, pageMo.ChildPageList);
5765
- this.addChildPages(pageMo);
5766
- }), publishReplay(1), refCount());
5775
+ this._addToCachePageData(pageData, url);
5767
5776
  // this.cachedPageData[url] = this.portalData$.pipe(
5768
5777
  // filter((portalData) => portalData != null),
5769
5778
  // map((portalData) => ),
@@ -5784,12 +5793,7 @@ class PortalService {
5784
5793
  if (this.cachedPageData[id]) {
5785
5794
  return this.cachedPageData[id];
5786
5795
  }
5787
- this.cachedPageData[id] = this.apiService
5788
- .loadPortalPageData(id, this.portalDataSource.getValue()?.ChildPageList.TypeDefId)
5789
- .pipe(map((pageMo) => pageMo.Data.Mo), tap((pageMo) => {
5790
- this.addChildRoute(pageMo, pageMo.ChildPageList);
5791
- this.addChildPages(pageMo);
5792
- }), publishReplay(1), refCount());
5796
+ this._addToCachePageData(pageData, id);
5793
5797
  // this.cachedPageData[url] = this.portalData$.pipe(
5794
5798
  // filter((portalData) => portalData != null),
5795
5799
  // map((portalData) => ),
@@ -5850,36 +5854,34 @@ class PortalService {
5850
5854
  if (x2) {
5851
5855
  return;
5852
5856
  }
5853
- x2 = this._getDefaultPage(element.ChildPageList?.MoDataList);
5857
+ x2 = this._getDefaultPage(this.getListOfChildPage(element));
5854
5858
  });
5855
5859
  return x2;
5856
5860
  }
5857
5861
  _addPage(routes, page) {
5858
5862
  const portalService = this;
5859
- function traverse(children, cpage) {
5863
+ const traverse = (children, cpage) => {
5860
5864
  const path = cpage.RoutePath;
5861
5865
  const pageComponent = portalService.getComponentType(cpage.Module, cpage.ComponentName, cpage.ComponentSelector);
5862
5866
  const newRoute = {
5863
5867
  path: (cpage.IsDefaultRoute === 'True' && path === '') || (path !== '' && typeof path !== 'undefined')
5864
5868
  ? path
5865
5869
  : cpage.Route.replace('/', ''),
5866
- canActivate: cpage.HasAuthorize === 'True' ? [AuthGuard] : cpage.IsLoginRoute ? [RedirectHomeGuard] : [],
5870
+ canActivate: cpage.HasAuthorize === 'True' ? [AuthGuard] : cpage.IsLoginRoute === 'True' ? [RedirectHomeGuard] : [],
5867
5871
  resolve: { pageData: PortalPageResolver },
5868
5872
  component: pageComponent,
5869
5873
  outlet: cpage.Outlet ? cpage.Outlet : undefined,
5870
5874
  data: {
5871
5875
  pageData: {
5872
- Module: cpage.Module,
5873
- HasAuthorize: cpage.HasAuthorize === 'True',
5874
- Route: cpage.Route
5876
+ ...cpage
5875
5877
  }
5876
5878
  },
5877
5879
  children: [formRoutes()]
5878
5880
  };
5879
5881
  children.push(newRoute);
5880
5882
  // Recursively process each MetaObjectModel inside MoDataList
5881
- cpage.ChildPageList.MoDataList.forEach((c) => traverse(newRoute.children, c));
5882
- }
5883
+ this.getListOfChildPage(cpage).forEach((c) => traverse(newRoute.children, c));
5884
+ };
5883
5885
  traverse(routes, page);
5884
5886
  }
5885
5887
  loadPortalDataSync() {
@@ -5890,21 +5892,21 @@ class PortalService {
5890
5892
  const portalSetting = BarsaApi.Ext.decode(portalSettingStr);
5891
5893
  const portalData = portalSetting;
5892
5894
  if (portalData) {
5893
- const defaultPage = this._getDefaultPage(portalData.ChildPageList.MoDataList);
5895
+ const defaultPage = this._getDefaultPage(this.getListOfChildPage(portalData));
5894
5896
  const isdynamicroute = portalData.IsDynamicRoute === 'True';
5895
5897
  this.DefaultPage = defaultPage;
5896
5898
  let configRoute = this._router.config;
5897
5899
  const removePaged = [];
5898
5900
  configRoute.forEach((c, index) => {
5899
5901
  const route = '/' + c.path;
5900
- if (c.path !== '' && portalData.ChildPageList.MoDataList.findIndex((d) => d.Route === route) === -1) {
5902
+ if (c.path !== '' && this.getListOfChildPage(portalData).findIndex((d) => d.Route === route) === -1) {
5901
5903
  removePaged.push(c);
5902
5904
  }
5903
5905
  });
5904
5906
  const pathToRemove = removePaged.map((d) => d.path);
5905
5907
  configRoute = configRoute.filter((c) => pathToRemove.indexOf(c.path) === -1);
5906
5908
  const newConfigRoutes = [];
5907
- portalData.ChildPageList.MoDataList.forEach((c) => {
5909
+ this.getListOfChildPage(portalData).forEach((c) => {
5908
5910
  this._addPage(newConfigRoutes, c);
5909
5911
  });
5910
5912
  if (defaultPage != null) {
@@ -5945,7 +5947,7 @@ class PortalService {
5945
5947
  }
5946
5948
  get loginRoute$() {
5947
5949
  return this.portalData$.pipe(map((portalData) => {
5948
- const loginPage = portalData?.ChildPageList.MoDataList.find((c) => c.IsLoginRoute === 'True');
5950
+ const loginPage = this.getListOfChildPage(portalData).find((c) => c.IsLoginRoute === 'True');
5949
5951
  return loginPage?.Route || 'login';
5950
5952
  }));
5951
5953
  }
@@ -6131,6 +6133,28 @@ class PortalService {
6131
6133
  }
6132
6134
  }
6133
6135
  }
6136
+ loadSystem(id = 0) {
6137
+ if (BarsaApi.LoginFormData?.error?.userMessage) {
6138
+ return Promise.reject(BarsaApi.LoginFormData?.error?.userMessage);
6139
+ }
6140
+ if (id === 0) {
6141
+ BarsaApi.Ul.ApplicationCtrlr.DefaultSystemId = null;
6142
+ }
6143
+ return new Promise((resolve, reject) => {
6144
+ this._applicationCtrlrService.loadSystem(id, (data) => {
6145
+ resolve(data);
6146
+ }, (err) => {
6147
+ reject(err);
6148
+ });
6149
+ });
6150
+ }
6151
+ _addToCachePageData(pageData, url) {
6152
+ const x = this.portalDataSource.getValue();
6153
+ const typedefIdX = x?.ChildPageList?.TypeDefId || x?.ChildPageList2?.TypeDefId;
6154
+ this.cachedPageData[url] = this.apiService.loadPortalPageData(pageData?.Id, typedefIdX).pipe(map((pageMo) => pageMo.Data.Mo), tap((pageMo) => {
6155
+ this.addChildPages(pageMo);
6156
+ }), publishReplay(1), refCount());
6157
+ }
6134
6158
  _getUlvParamsBy(reportName, reportId) {
6135
6159
  return {
6136
6160
  Flags: {
@@ -6154,21 +6178,6 @@ class PortalService {
6154
6178
  });
6155
6179
  });
6156
6180
  }
6157
- loadSystem(id = 0) {
6158
- if (BarsaApi.LoginFormData?.error?.userMessage) {
6159
- return Promise.reject(BarsaApi.LoginFormData?.error?.userMessage);
6160
- }
6161
- if (id === 0) {
6162
- BarsaApi.Ul.ApplicationCtrlr.DefaultSystemId = null;
6163
- }
6164
- return new Promise((resolve, reject) => {
6165
- this._applicationCtrlrService.loadSystem(id, (data) => {
6166
- resolve(data);
6167
- }, (err) => {
6168
- reject(err);
6169
- });
6170
- });
6171
- }
6172
6181
  _removePushAction() {
6173
6182
  const pushActionStr = this._localStorage.getItem('pushAction');
6174
6183
  if (pushActionStr) {
@@ -9422,7 +9431,9 @@ class PageBaseComponent extends ContainerComponent {
9422
9431
  return placeholders;
9423
9432
  }
9424
9433
  getModules(pageData) {
9425
- return BarsaApi.Common.Util.TryGetValue(pageData, 'ModuleList.MoDataList', []);
9434
+ const x = BarsaApi.Common.Util.TryGetValue(pageData, 'ModuleList.MoDataList', []);
9435
+ const x2 = BarsaApi.Common.Util.TryGetValue(pageData, 'ModuleList2.MoDataList', []);
9436
+ return x2.length ? x2 : x;
9426
9437
  }
9427
9438
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PageBaseComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
9428
9439
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: PageBaseComponent, isStandalone: false, selector: "bnrc-page-base", usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }