@sumaris-net/ngx-components 2.4.131 → 2.4.133

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "2.4.131",
4
+ "version": "2.4.133",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -11,13 +11,13 @@ import { ConfigService } from '../services/config.service';
11
11
  import { PlatformService } from '../services/platform.service';
12
12
  import { LocalSettingsService } from '../services/local-settings.service';
13
13
  import { NetworkService } from '../services/network.service';
14
- import { MenuItem } from '../menu/menu.model';
14
+ import { IMenuItem } from '../menu/menu.model';
15
15
  import { ShowToastOptions } from '../../shared/toast/toasts';
16
16
  import { Environment } from '../../../environments/environment.class';
17
17
  import { HistoryPageReference } from '../services/model/history.model';
18
18
  import * as i0 from "@angular/core";
19
19
  export declare function getRandomImage(files: String[]): String;
20
- export declare const APP_HOME_BUTTONS: InjectionToken<MenuItem[]>;
20
+ export declare const APP_HOME_BUTTONS: InjectionToken<IMenuItem[]>;
21
21
  export declare class HomePage implements OnDestroy {
22
22
  private accountService;
23
23
  private modalCtrl;
@@ -30,7 +30,7 @@ export declare class HomePage implements OnDestroy {
30
30
  settings: LocalSettingsService;
31
31
  protected environment: Environment;
32
32
  locales: LocaleConfig[];
33
- buttons: MenuItem[];
33
+ buttons: IMenuItem[];
34
34
  private readonly _debug;
35
35
  private _started;
36
36
  private _subscription;
@@ -50,10 +50,10 @@ export declare class HomePage implements OnDestroy {
50
50
  contentStyle: any;
51
51
  pageHistory: HistoryPageReference[];
52
52
  offline: boolean;
53
- $filteredButtons: BehaviorSubject<MenuItem[]>;
53
+ $filteredButtons: BehaviorSubject<IMenuItem[]>;
54
54
  readonly showAccountButton: boolean;
55
55
  get currentLocaleCode(): string;
56
- constructor(accountService: AccountService, modalCtrl: ModalController, translate: TranslateService, toastController: ToastController, configService: ConfigService, platform: PlatformService, cd: ChangeDetectorRef, network: NetworkService, settings: LocalSettingsService, environment: Environment, locales: LocaleConfig[], buttons: MenuItem[]);
56
+ constructor(accountService: AccountService, modalCtrl: ModalController, translate: TranslateService, toastController: ToastController, configService: ConfigService, platform: PlatformService, cd: ChangeDetectorRef, network: NetworkService, settings: LocalSettingsService, environment: Environment, locales: LocaleConfig[], buttons: IMenuItem[]);
57
57
  ngOnDestroy(): void;
58
58
  login(): Promise<void>;
59
59
  register(): Promise<void>;
@@ -6,11 +6,11 @@ import { TranslateService } from '@ngx-translate/core';
6
6
  import { ConfigService } from '../services/config.service';
7
7
  import { PlatformService } from '../services/platform.service';
8
8
  import { MenuService, SplitPaneShowWhen } from './menu.service';
9
- import { MenuItem, MenuOptions } from './menu.model';
9
+ import { IMenuItem, MenuOptions } from './menu.model';
10
10
  import { ActivatedRoute, Router } from '@angular/router';
11
11
  import { RxStrategyNames } from '@rx-angular/cdk/render-strategies';
12
12
  import * as i0 from "@angular/core";
13
- export declare const APP_MENU_ITEMS: InjectionToken<MenuItem[]>;
13
+ export declare const APP_MENU_ITEMS: InjectionToken<IMenuItem[]>;
14
14
  export declare const APP_MENU_OPTIONS: InjectionToken<MenuOptions>;
15
15
  export declare class MenuComponent implements OnInit {
16
16
  protected platformService: PlatformService;
@@ -27,7 +27,7 @@ export declare class MenuComponent implements OnInit {
27
27
  protected environment: any;
28
28
  protected route: ActivatedRoute;
29
29
  protected options: MenuOptions;
30
- protected items: MenuItem[];
30
+ protected items: IMenuItem[];
31
31
  id: string;
32
32
  menuId: string;
33
33
  side: string;
@@ -45,12 +45,12 @@ export declare class MenuComponent implements OnInit {
45
45
  private readonly _debug;
46
46
  private _subscription;
47
47
  constructor(platformService: PlatformService, accountService: AccountService, navController: NavController, menu: MenuController, modalCtrl: ModalController, alertController: AlertController, translate: TranslateService, configService: ConfigService, cd: ChangeDetectorRef, menuService: MenuService, router: Router, environment: any, route: ActivatedRoute, // Modal editor give 'null'
48
- options: MenuOptions, items: MenuItem[]);
48
+ options: MenuOptions, items: IMenuItem[]);
49
49
  ngOnInit(): Promise<void>;
50
50
  onLogin(account: Account): Promise<void>;
51
51
  onLogout(skipRedirect?: boolean): Promise<void>;
52
52
  logout(): Promise<void>;
53
- trackByFn(index: number, item: MenuItem): string;
53
+ trackByFn(index: number, item: IMenuItem): string;
54
54
  enable(value: boolean): Promise<void>;
55
55
  open(): Promise<boolean>;
56
56
  close(): Promise<boolean>;
@@ -67,7 +67,7 @@ export declare class MenuComponent implements OnInit {
67
67
  }): void;
68
68
  protected detectChanges(): void;
69
69
  protected markForCheck(): void;
70
- protected togglePinSubMenu(event: Event, item: MenuItem): void;
70
+ protected togglePinned(event: Event, item: IMenuItem): void;
71
71
  static ɵfac: i0.ɵɵFactoryDeclaration<MenuComponent, [null, null, null, null, null, null, null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
72
72
  static ɵcmp: i0.ɵɵComponentDeclaration<MenuComponent, "app-menu", never, { "id": "id"; "menuId": "menuId"; "side": "side"; "contentId": "contentId"; "logo": "logo"; "appName": "appName"; "appVersion": "appVersion"; "rxStrategy": "rxStrategy"; }, {}, never, ["*", "[headerBottomRight]"], false>;
73
73
  }
@@ -4,8 +4,7 @@ import { IconRef } from '../../shared/types';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  import { MenuPathParam } from './menu.service';
6
6
  import { Account } from '../services/model/account.model';
7
- export interface MenuItem extends IconRef {
8
- id?: number;
7
+ export interface IMenuItem extends IconRef {
9
8
  title: string;
10
9
  path?: string;
11
10
  after?: string;
@@ -28,7 +27,45 @@ export interface MenuItem extends IconRef {
28
27
  [key: string]: string;
29
28
  };
30
29
  pinned?: boolean;
31
- $children?: BehaviorSubject<MenuItem[]>;
30
+ id?: number;
31
+ children?: IMenuItem[];
32
+ }
33
+ export declare class MenuItem implements IMenuItem {
34
+ id?: number;
35
+ _title: string;
36
+ titleProperty?: string;
37
+ titleArgs?: {
38
+ [key: string]: string;
39
+ };
40
+ path?: string;
41
+ pathParams?: {
42
+ [key: string]: string;
43
+ };
44
+ parentPath?: string;
45
+ parentPathParams?: {
46
+ [key: string]: string;
47
+ };
48
+ after?: string;
49
+ before?: string;
50
+ action?: string | any;
51
+ profile?: UserProfileLabel;
52
+ exactProfile?: UserProfileLabel;
53
+ color?: string;
54
+ cssClass?: string;
55
+ ifProperty?: string;
56
+ pinned?: boolean;
57
+ parent?: MenuItem;
58
+ $title: BehaviorSubject<string>;
59
+ $children: BehaviorSubject<MenuItem[]>;
60
+ static fromObject(source: any): MenuItem;
61
+ fromObject(source: any): void;
62
+ asObject(): any;
63
+ get children(): MenuItem[];
64
+ set children(value: MenuItem[]);
65
+ get title(): string;
66
+ set title(value: string);
67
+ get detached(): boolean;
68
+ isPinned(): any;
32
69
  }
33
70
  export declare class MenuItems {
34
71
  /**
@@ -37,7 +74,21 @@ export declare class MenuItems {
37
74
  * @param mainItem
38
75
  * @param otherItem
39
76
  */
40
- static isSame(mainItem: MenuItem, otherItem: MenuItem): boolean;
77
+ static isSame(mainItem: IMenuItem, otherItem: IMenuItem): boolean;
78
+ /**
79
+ * Compare, without checking the children and the title
80
+ *
81
+ * @param mainItem
82
+ * @param otherItem
83
+ */
84
+ static isSameIdOrPathAndParams(mainItem: IMenuItem, otherItem: IMenuItem): boolean;
85
+ /**
86
+ * Compare, without checking the children
87
+ *
88
+ * @param mainItem
89
+ * @param otherItem
90
+ */
91
+ static isSamePathAndParams(mainItem: IMenuItem, otherItem: IMenuItem): boolean;
41
92
  /**
42
93
  * All key/value of the mainParams should exist (and be equals) in the other params
43
94
  *
@@ -49,16 +100,15 @@ export declare class MenuItems {
49
100
  }, otherParams: {
50
101
  [key: string]: string;
51
102
  }): boolean;
52
- static prepareItem(item: MenuItem): MenuItem;
53
- static isParent(child: MenuItem, parent: MenuItem | MenuPathParam): boolean;
54
- static checkIfVisible(item: MenuItem, account: Account, config: Configuration, opts?: {
103
+ static isParent(child: IMenuItem, parent: IMenuItem | MenuPathParam): boolean;
104
+ static checkIfVisible(item: IMenuItem, account: Account, config: Configuration, opts?: {
55
105
  isLogin?: boolean;
56
106
  debug?: boolean;
57
107
  logPrefix?: string;
58
108
  }): boolean;
59
- static isPinned(item: MenuItem): any;
109
+ static checkIfSubMenuVisible(item: MenuItem, currentPathParam: MenuPathParam): boolean;
60
110
  static parsePathWithQuery(pathWithQuery: string): MenuPathParam;
61
- static getUrl(item: MenuItem): string;
111
+ static getUrl(item: IMenuItem): string;
62
112
  static getUrlFromPathAndParams(path: string, params?: any): string;
63
113
  }
64
114
  export declare class MenuOptions {
@@ -4,9 +4,11 @@ import * as i2 from "./sub-menu-tab.directive";
4
4
  import * as i3 from "../../shared/shared.module";
5
5
  import * as i4 from "@angular/router";
6
6
  import * as i5 from "@rx-angular/template/for";
7
- import * as i6 from "@ngx-translate/core";
7
+ import * as i6 from "@rx-angular/template/if";
8
+ import * as i7 from "@rx-angular/template/let";
9
+ import * as i8 from "@ngx-translate/core";
8
10
  export declare class AppMenuModule {
9
11
  static ɵfac: i0.ɵɵFactoryDeclaration<AppMenuModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<AppMenuModule, [typeof i1.MenuComponent, typeof i2.SubMenuTabDirective], [typeof i3.SharedModule, typeof i4.RouterModule, typeof i5.ForModule, typeof i6.TranslateModule], [typeof i6.TranslateModule, typeof i1.MenuComponent, typeof i2.SubMenuTabDirective]>;
12
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AppMenuModule, [typeof i1.MenuComponent, typeof i2.SubMenuTabDirective], [typeof i3.SharedModule, typeof i4.RouterModule, typeof i5.ForModule, typeof i6.IfModule, typeof i7.LetModule, typeof i8.TranslateModule], [typeof i8.TranslateModule, typeof i1.MenuComponent, typeof i2.SubMenuTabDirective]>;
11
13
  static ɵinj: i0.ɵɵInjectorDeclaration<AppMenuModule>;
12
14
  }
@@ -1,5 +1,5 @@
1
1
  import { BehaviorSubject, Observable } from 'rxjs';
2
- import { MenuItem } from './menu.model';
2
+ import { IMenuItem, MenuItem } from './menu.model';
3
3
  import { Router } from '@angular/router';
4
4
  import { Environment } from '../../../environments/environment.class';
5
5
  import { PlatformService } from '../services/platform.service';
@@ -13,7 +13,6 @@ export declare type SplitPaneShowWhen = boolean | 'lg';
13
13
  export declare const DEFAULT_MENU_SHOW_WHEN: SplitPaneShowWhen;
14
14
  export interface AddSubMenuItemsOption {
15
15
  skipIfExists?: boolean;
16
- availableParents?: MenuItem[];
17
16
  }
18
17
  export interface MenuPathParam {
19
18
  path: string;
@@ -29,34 +28,43 @@ export declare class MenuService extends StartableObservableService<MenuItem[]>
29
28
  protected environment: Environment;
30
29
  readonly accountChanges: BehaviorSubject<Account>;
31
30
  private _staticItems;
32
- private _detachedItems;
31
+ private _detachedSubItems;
33
32
  private _itemCounter;
34
33
  private readonly _logPrefix;
35
34
  private readonly _$opened;
36
35
  private readonly _$splitPaneWhen;
37
36
  private readonly _$enabled;
38
37
  private readonly _$listenRoute;
39
- constructor(platformService: PlatformService, configService: ConfigService, accountService: AccountService, router: Router, environment: Environment, staticItems?: MenuItem[]);
38
+ constructor(platformService: PlatformService, configService: ConfigService, accountService: AccountService, router: Router, environment: Environment, staticItems?: IMenuItem[]);
40
39
  get opened(): Observable<boolean>;
41
40
  get splitPaneWhen(): Observable<SplitPaneShowWhen>;
42
41
  get enabled(): Observable<boolean>;
43
42
  enable(value: boolean): void;
44
43
  setSplitPaneShowWhen(value: SplitPaneShowWhen): void;
45
44
  toggleSplitPaneWhen(): void;
45
+ loadOrCreate(source: Partial<IMenuItem>): MenuItem;
46
+ computeId(item: MenuItem): number;
47
+ computeNewId(): number;
46
48
  _markAsOpened(): void;
47
49
  _markAsClosed(): void;
48
- addSubMenuItems(newItems: MenuItem[], opts?: AddSubMenuItemsOption): Promise<MenuItem[]>;
49
- addSubMenuItem(newItem: MenuItem, opts?: AddSubMenuItemsOption): Promise<MenuItem>;
50
- removeSubMenuItem(item: MenuItem): void;
51
- detachSubMenuItem(pathParam: MenuPathParam): void;
50
+ addSubMenuItems(sources: IMenuItem[], opts?: {
51
+ skipIfExists?: boolean;
52
+ }): Promise<MenuItem[]>;
53
+ addSubMenuItem(item: IMenuItem, opts?: {
54
+ skipIfExists?: boolean;
55
+ }): Promise<MenuItem>;
56
+ removeSubMenuItem(item: IMenuItem): void;
57
+ unpinned(source: IMenuItem): void;
58
+ private _detachSubMenuItems;
59
+ private _detachToParent;
60
+ private _findExistingId;
52
61
  protected ngOnStart(): Promise<MenuItem[]>;
53
- protected _addSubMenuItem(newItem: MenuItem, opts?: AddSubMenuItemsOption): MenuItem;
54
- protected _loadMenuItems(config: Configuration | null, account: Account | null): Promise<MenuItem[]>;
55
- protected _findExistingItem(item: MenuItem, items?: MenuItem[]): MenuItem;
56
- protected _findParent(childItem: MenuItem, availableParents?: MenuItem[]): MenuItem;
57
- protected _addMenuToParent(parent: MenuItem, child: MenuItem): void;
58
- protected _detachStoreAndRestore(pathParam: MenuPathParam): void;
59
- protected _detachSubMenus(currentPathParam: MenuPathParam, items?: MenuItem[], excludedItems?: MenuItem[]): MenuItem[];
62
+ private _addSubMenuItems;
63
+ private _addSubMenuItem;
64
+ protected _loadMenuItems(config: Configuration | null, account: Account | null): MenuItem[];
65
+ private _findExistingItem;
66
+ private _findParent;
67
+ private _attachMenuToParent;
60
68
  static ɵfac: i0.ɵɵFactoryDeclaration<MenuService, [null, null, null, null, null, { optional: true; }]>;
61
69
  static ɵprov: i0.ɵɵInjectableDeclaration<MenuService>;
62
70
  }
@@ -2,6 +2,7 @@ import { AfterViewInit, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { MatTab, MatTabGroup } from '@angular/material/tabs';
3
3
  import { Router } from '@angular/router';
4
4
  import { MenuService } from './menu.service';
5
+ import { IconRef } from '../../shared/types';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class SubMenuTabDirective implements OnChanges, AfterViewInit {
7
8
  private menuService;
@@ -13,12 +14,16 @@ export declare class SubMenuTabDirective implements OnChanges, AfterViewInit {
13
14
  parentPath: string;
14
15
  path: string;
15
16
  subMenuTitle: string;
17
+ subMenuIcon: IconRef;
16
18
  private _menuItem;
19
+ private _debug;
17
20
  constructor(menuService: MenuService, tabGroup: MatTabGroup, tab: MatTab, router: Router);
18
21
  ngAfterViewInit(): void;
19
22
  ngOnChanges(changes: SimpleChanges): void;
20
- private _computeMenuItem;
21
- private _addItemToMenu;
23
+ private _removeToMenu;
24
+ private _addToMenu;
25
+ private get menuItem();
26
+ private get title();
22
27
  static ɵfac: i0.ɵɵFactoryDeclaration<SubMenuTabDirective, never>;
23
- static ɵdir: i0.ɵɵDirectiveDeclaration<SubMenuTabDirective, "[appSubMenuTab]", never, { "label": "label"; "disabled": "disabled"; "parentPath": "parentPath"; "path": "path"; "subMenuTitle": "subMenuTitle"; }, {}, never, never, false>;
28
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SubMenuTabDirective, "[appSubMenuTab]", never, { "label": "label"; "disabled": "disabled"; "parentPath": "parentPath"; "path": "path"; "subMenuTitle": "subMenuTitle"; "subMenuIcon": "subMenuIcon"; }, {}, never, never, false>;
24
29
  }
@@ -2,24 +2,22 @@ import { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
2
2
  import { MenuService } from '../menu.service';
3
3
  import { AppTabEditor } from '../../form/entity/editor.class';
4
4
  import { ActivatedRoute, Router } from '@angular/router';
5
- import { AlertController, IonToggle, NavController } from '@ionic/angular';
5
+ import { AlertController, NavController } from '@ionic/angular';
6
6
  import { TranslateService } from '@ngx-translate/core';
7
- import { BehaviorSubject } from 'rxjs';
7
+ import { Subject } from 'rxjs';
8
8
  import * as i0 from "@angular/core";
9
9
  export declare class MenuTestingPage extends AppTabEditor implements OnInit, OnDestroy, AfterViewInit {
10
10
  protected menuService: MenuService;
11
- toggleThird: IonToggle;
12
11
  protected logPrefix: string;
13
12
  protected childPath: string;
14
13
  protected thirdTabTitle: string;
15
14
  protected parentPath: string;
15
+ protected path: string;
16
16
  protected showOtherLinks: boolean;
17
- protected $title: BehaviorSubject<string>;
18
- protected $secondTabTitle: BehaviorSubject<string>;
17
+ protected $title: Subject<string>;
18
+ protected $secondTabTitle: Subject<string>;
19
19
  protected set title(value: string);
20
- protected get title(): string;
21
20
  protected set secondTabTitle(value: string);
22
- protected get secondTabTitle(): string;
23
21
  constructor(route: ActivatedRoute, // Modal editor give 'null'
24
22
  router: Router, navController: NavController, alertCtrl: AlertController, translate: TranslateService, menuService: MenuService);
25
23
  ngOnInit(): void;
@@ -31,6 +29,8 @@ export declare class MenuTestingPage extends AppTabEditor implements OnInit, OnD
31
29
  save(event: Event | undefined, options: any): Promise<boolean>;
32
30
  changeTitle(event?: UIEvent): void;
33
31
  changeSecondTabTitle(event?: UIEvent): void;
32
+ addSubMenuItem(event?: UIEvent): void;
33
+ addOutsideRouteSubMenuItem(event?: UIEvent, pinned?: boolean): void;
34
34
  protected enableMenu(value: boolean): void;
35
35
  protected toggleSplitPaneWhen(): void;
36
36
  protected initSubMenu(): Promise<void>;
@@ -14,9 +14,9 @@ import { AlertController, NavController } from '@ionic/angular';
14
14
  import { Property } from '../../shared/types';
15
15
  import { CanLeave } from '../../shared/guard/component-dirty.guard';
16
16
  import { ISelectPeerModalOptions } from '../peer/select-peer.modal';
17
- import { MenuItem } from '../menu/menu.model';
17
+ import { IMenuItem } from '../menu/menu.model';
18
18
  import * as i0 from "@angular/core";
19
- export declare const APP_SETTINGS_MENU_ITEMS: InjectionToken<MenuItem[]>;
19
+ export declare const APP_SETTINGS_MENU_ITEMS: InjectionToken<IMenuItem[]>;
20
20
  export declare class SettingsPage extends AppForm<LocalSettings> implements OnInit, OnDestroy, CanLeave {
21
21
  protected platform: PlatformService;
22
22
  protected navController: NavController;
@@ -33,7 +33,7 @@ export declare class SettingsPage extends AppForm<LocalSettings> implements OnIn
33
33
  mobile: boolean;
34
34
  saving: boolean;
35
35
  usageModes: UsageMode[];
36
- menuItems: MenuItem[];
36
+ menuItems: IMenuItem[];
37
37
  propertyDefinitions: FormFieldDefinition[];
38
38
  propertyDefinitionsByKey: FormFieldDefinitionMap;
39
39
  propertyDefinitionsByIndex: {
@@ -44,7 +44,7 @@ export declare class SettingsPage extends AppForm<LocalSettings> implements OnIn
44
44
  get accountInheritance(): boolean;
45
45
  get isLogin(): boolean;
46
46
  get propertiesForm(): UntypedFormArray;
47
- constructor(injector: Injector, platform: PlatformService, navController: NavController, validatorService: LocalSettingsValidatorService, alertCtrl: AlertController, translate: TranslateService, formBuilder: UntypedFormBuilder, accountService: AccountService, settings: LocalSettingsService, cd: ChangeDetectorRef, network: NetworkService, locales: LocaleConfig[], menuItems?: MenuItem[]);
47
+ constructor(injector: Injector, platform: PlatformService, navController: NavController, validatorService: LocalSettingsValidatorService, alertCtrl: AlertController, translate: TranslateService, formBuilder: UntypedFormBuilder, accountService: AccountService, settings: LocalSettingsService, cd: ChangeDetectorRef, network: NetworkService, locales: LocaleConfig[], menuItems?: IMenuItem[]);
48
48
  ngOnInit(): Promise<void>;
49
49
  getPropertyDefinition(index: number): FormFieldDefinition;
50
50
  updatePropertyDefinition(index: number): FormFieldDefinition;
@@ -59,7 +59,7 @@ export declare class SettingsPage extends AppForm<LocalSettings> implements OnIn
59
59
  cancel(event?: Event): Promise<void>;
60
60
  close(event?: Event): Promise<boolean>;
61
61
  clearCache(event?: Event): Promise<void>;
62
- executeAction(event: Event, item: MenuItem): Promise<void>;
62
+ executeAction(event: Event, item: IMenuItem): Promise<void>;
63
63
  protected getValue(): Promise<LocalSettings>;
64
64
  protected getJsonValueToSave(): Promise<any>;
65
65
  protected markForCheck(): void;