@c8y/tutorial 1021.52.0 → 1021.54.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.
@@ -457,6 +457,13 @@ export default {
457
457
  description: 'An example for hooking into the left drawer.',
458
458
  scope: 'self'
459
459
  },
460
+ {
461
+ name: 'User menu hook sample',
462
+ module: 'TutorialUserMenuModule',
463
+ path: './src/hooks/user-menu-item/user-menu.module.ts',
464
+ description: 'An example for hooking into the user menu items.',
465
+ scope: 'self'
466
+ },
460
467
  {
461
468
  name: 'Version hook sample',
462
469
  module: 'TutorialVersionModule',
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@c8y/tutorial",
3
- "version": "1021.52.0",
3
+ "version": "1021.54.2",
4
4
  "description": "This package is used to scaffold a tutorial for Cumulocity IoT Web SDK which explains a lot of concepts.",
5
5
  "dependencies": {
6
- "@c8y/style": "1021.52.0",
7
- "@c8y/ngx-components": "1021.52.0",
8
- "@c8y/client": "1021.52.0",
9
- "@c8y/bootstrap": "1021.52.0",
6
+ "@c8y/style": "1021.54.2",
7
+ "@c8y/ngx-components": "1021.54.2",
8
+ "@c8y/client": "1021.54.2",
9
+ "@c8y/bootstrap": "1021.54.2",
10
10
  "@angular/cdk": "^18.2.10",
11
11
  "ngx-bootstrap": "18.0.0",
12
12
  "leaflet": "1.9.4",
13
13
  "rxjs": "^7.8.1"
14
14
  },
15
15
  "devDependencies": {
16
- "@c8y/options": "1021.52.0",
17
- "@c8y/devkit": "1021.52.0"
16
+ "@c8y/options": "1021.54.2",
17
+ "@c8y/devkit": "1021.54.2"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@angular/common": ">=18 <19"
@@ -0,0 +1,22 @@
1
+ import { Injectable } from '@angular/core';
2
+ import { ExtensionFactory, UserMenuItem } from '@c8y/ngx-components';
3
+ import { Observable, of } from 'rxjs';
4
+
5
+ @Injectable()
6
+ export class CustomUserMenuFactory implements ExtensionFactory<UserMenuItem> {
7
+ protected userMenuItem: UserMenuItem = {
8
+ icon: 'user',
9
+ label: 'Example',
10
+ click: () => console.log('I am the first example'),
11
+ priority: 100
12
+ };
13
+
14
+ /**
15
+ * The Item will be shown in the right drawer user menu.
16
+ * @description Returns the user menu item. The returned menu item could be a Promise, Observable, or a static object.
17
+ * @returns The user menu item.
18
+ */
19
+ get(): Observable<UserMenuItem> {
20
+ return of(this.userMenuItem);
21
+ }
22
+ }
@@ -0,0 +1 @@
1
+ export * from './user-menu.module';
@@ -0,0 +1,20 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { hookUserMenu } from '@c8y/ngx-components';
4
+ import { CustomUserMenuFactory } from './custom-user-menu-factory.service';
5
+
6
+ @NgModule({
7
+ imports: [CommonModule],
8
+ declarations: [],
9
+ providers: [
10
+ // Both examples will be shown in the right drawer user menu. Note that they will not be shown in codex.
11
+ hookUserMenu(CustomUserMenuFactory),
12
+ hookUserMenu({
13
+ icon: 'user',
14
+ label: 'Example 2',
15
+ click: () => console.log('I am the second example'),
16
+ priority: 100
17
+ })
18
+ ]
19
+ })
20
+ export class TutorialUserMenuModule {}