@sumaris-net/ngx-components 2.4.121 → 2.4.122-alpha1

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.
@@ -22776,6 +22776,25 @@ class MenuService extends StartableObservableService {
22776
22776
  await this.ready();
22777
22777
  return this._addSubMenuItem(newItem, opts);
22778
22778
  }
22779
+ detachSubMenus(currentPathParam, items, excludedItems) {
22780
+ items = items || this.data;
22781
+ excludedItems = excludedItems || [];
22782
+ items = items.filter(item => {
22783
+ if (!item.parentPath)
22784
+ return true; // Always keep root items
22785
+ // Keep each menu items in the scope of the current url path
22786
+ if (currentPathParam.path.startsWith(item.path))
22787
+ return true;
22788
+ // Else, exclude
22789
+ excludedItems.push(item);
22790
+ return false;
22791
+ });
22792
+ items.forEach(item => {
22793
+ const children = this.detachSubMenus(currentPathParam, item.$children.value || [], excludedItems);
22794
+ item.$children.next(children);
22795
+ });
22796
+ return items;
22797
+ }
22779
22798
  _addSubMenuItem(newItem, opts) {
22780
22799
  opts = {
22781
22800
  skipIfExists: false,
@@ -22967,29 +22986,6 @@ class MenuService extends StartableObservableService {
22967
22986
  }
22968
22987
  parent.$children.next(children);
22969
22988
  }
22970
- detachSubMenus(currentPathParam, items, excludedItems) {
22971
- items = items || this.data;
22972
- excludedItems = excludedItems || [];
22973
- items = items.filter(item => {
22974
- if (!item.parentPath)
22975
- return true; // Always keep root items
22976
- // Current route = param: keep it
22977
- // if (MenuItems.isParent(item, currentPathParam)) return true;
22978
- // Item parent path starts with the current path: keep it
22979
- // if (item.path?.startsWith(currentPathParam.path)) return true;
22980
- // Keep each menu items in the scope of the current url path
22981
- if (currentPathParam.path.startsWith(item.path))
22982
- return true;
22983
- // Else, exclude
22984
- excludedItems.push(item);
22985
- return false;
22986
- });
22987
- items.forEach(item => {
22988
- const children = this.detachSubMenus(currentPathParam, item.$children.value || [], excludedItems);
22989
- item.$children.next(children);
22990
- });
22991
- return items;
22992
- }
22993
22989
  }
22994
22990
  MenuService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuService, deps: [{ token: PlatformService }, { token: ConfigService }, { token: AccountService }, { token: i1$5.Router }, { token: ENVIRONMENT }, { token: APP_MENU_ITEMS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
22995
22991
  MenuService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: MenuService, providedIn: 'root' });