@c8y/tutorial 1022.8.0 → 1022.9.6
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/cumulocity.config.ts +14 -0
- package/package.json +7 -7
- package/src/hooks/query-param-bottom-drawer/example-button.component.ts +21 -0
- package/src/hooks/query-param-bottom-drawer/example-component.ts +35 -0
- package/src/hooks/query-param-bottom-drawer/index.ts +1 -0
- package/src/hooks/query-param-bottom-drawer/query-param-bottom-drawer.module.ts +36 -0
- package/src/hooks/query-param-modal/example-button.component.ts +22 -0
- package/src/hooks/query-param-modal/example-component.ts +17 -0
- package/src/hooks/query-param-modal/indext.ts +1 -0
- package/src/hooks/query-param-modal/query-param-modal.module.ts +39 -0
package/cumulocity.config.ts
CHANGED
|
@@ -486,6 +486,20 @@ export default {
|
|
|
486
486
|
description: 'An example for hooking into the shown versions.',
|
|
487
487
|
scope: 'self'
|
|
488
488
|
},
|
|
489
|
+
{
|
|
490
|
+
name: 'Query param bottom drawer hook sample',
|
|
491
|
+
module: 'QueryParamBottomDrawerModule',
|
|
492
|
+
path: './src/hooks/query-param-bottom-drawer/query-param-bottom-drawer.module.ts',
|
|
493
|
+
description: 'An example for hooking into the query param bottom drawer.',
|
|
494
|
+
scope: 'self'
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
name: 'Query param modal hook sample',
|
|
498
|
+
module: 'QueryParamModalModule',
|
|
499
|
+
path: './src/hooks/query-param-modal/query-param-modal.module.ts',
|
|
500
|
+
description: 'An example for hooking into the query param modal.',
|
|
501
|
+
scope: 'self'
|
|
502
|
+
},
|
|
489
503
|
{
|
|
490
504
|
name: 'pop confirm example',
|
|
491
505
|
module: 'PopConfirmExampleModule',
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/tutorial",
|
|
3
|
-
"version": "1022.
|
|
3
|
+
"version": "1022.9.6",
|
|
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": "1022.
|
|
7
|
-
"@c8y/ngx-components": "1022.
|
|
8
|
-
"@c8y/client": "1022.
|
|
9
|
-
"@c8y/bootstrap": "1022.
|
|
6
|
+
"@c8y/style": "1022.9.6",
|
|
7
|
+
"@c8y/ngx-components": "1022.9.6",
|
|
8
|
+
"@c8y/client": "1022.9.6",
|
|
9
|
+
"@c8y/bootstrap": "1022.9.6",
|
|
10
10
|
"@angular/cdk": "^19.2.18",
|
|
11
11
|
"ngx-bootstrap": "19.0.2",
|
|
12
12
|
"leaflet": "1.9.4",
|
|
13
13
|
"rxjs": "7.8.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@c8y/options": "1022.
|
|
17
|
-
"@c8y/devkit": "1022.
|
|
16
|
+
"@c8y/options": "1022.9.6",
|
|
17
|
+
"@c8y/devkit": "1022.9.6"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@angular/common": ">=19 <20"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-example-button',
|
|
6
|
+
template: ` <button (click)="addQueryParam()">Add Query Param</button> `
|
|
7
|
+
})
|
|
8
|
+
export class ExampleButtonComponent {
|
|
9
|
+
constructor(
|
|
10
|
+
private router: Router,
|
|
11
|
+
private route: ActivatedRoute
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
addQueryParam() {
|
|
15
|
+
this.router.navigate([], {
|
|
16
|
+
relativeTo: this.route,
|
|
17
|
+
queryParams: { showExampleComponent: true },
|
|
18
|
+
queryParamsHandling: 'merge'
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-example-component',
|
|
6
|
+
template: `<p>This component was rendered via <code>hookQueryParamBottomDrawer</code></p>
|
|
7
|
+
<div class="text-center card-footer p-24 separator">
|
|
8
|
+
<button class="btn btn-default" title="{{ 'Close' }}" type="button" (click)="close()">
|
|
9
|
+
{{ 'Close' }}
|
|
10
|
+
</button>
|
|
11
|
+
</div>`
|
|
12
|
+
})
|
|
13
|
+
export class ExampleComponent {
|
|
14
|
+
shouldClose: Promise<boolean>;
|
|
15
|
+
private resolveClose!: (value: boolean | PromiseLike<boolean>) => void;
|
|
16
|
+
|
|
17
|
+
private readonly router = inject(Router);
|
|
18
|
+
private readonly route = inject(ActivatedRoute);
|
|
19
|
+
|
|
20
|
+
constructor() {
|
|
21
|
+
this.shouldClose = new Promise<boolean>(resolve => {
|
|
22
|
+
this.resolveClose = resolve;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
close() {
|
|
27
|
+
this.resolveClose(true);
|
|
28
|
+
this.router.navigate([], {
|
|
29
|
+
relativeTo: this.route,
|
|
30
|
+
queryParams: { showExampleComponent: null },
|
|
31
|
+
queryParamsHandling: 'merge',
|
|
32
|
+
replaceUrl: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './query-param-bottom-drawer.module';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
CommonModule,
|
|
4
|
+
hookNavigator,
|
|
5
|
+
hookQueryParamBottomDrawer,
|
|
6
|
+
hookRoute,
|
|
7
|
+
NavigatorNode
|
|
8
|
+
} from '@c8y/ngx-components';
|
|
9
|
+
import { ExampleComponent } from './example-component';
|
|
10
|
+
|
|
11
|
+
@NgModule({
|
|
12
|
+
declarations: [],
|
|
13
|
+
imports: [CommonModule],
|
|
14
|
+
providers: [
|
|
15
|
+
hookRoute({
|
|
16
|
+
path: 'hooks/query-param-bottom-drawer',
|
|
17
|
+
loadComponent: () => import('./example-button.component').then(m => m.ExampleButtonComponent)
|
|
18
|
+
}),
|
|
19
|
+
hookNavigator(
|
|
20
|
+
new NavigatorNode({
|
|
21
|
+
priority: 70,
|
|
22
|
+
path: 'hooks/query-param-bottom-drawer',
|
|
23
|
+
icon: 'filter',
|
|
24
|
+
label: 'QueyParamBottomDrawer',
|
|
25
|
+
parent: 'Hooks'
|
|
26
|
+
})
|
|
27
|
+
),
|
|
28
|
+
hookQueryParamBottomDrawer({
|
|
29
|
+
queryParam: 'showExampleComponent',
|
|
30
|
+
closeOnNavigation: false,
|
|
31
|
+
disableClickOutside: true,
|
|
32
|
+
component: ExampleComponent
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
})
|
|
36
|
+
export class QueryParamBottomDrawerModule {}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { Router, ActivatedRoute } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-example-button',
|
|
6
|
+
template: ` <button (click)="addQueryParam()">Add Query Param</button> `
|
|
7
|
+
})
|
|
8
|
+
export class ExampleButtonComponent {
|
|
9
|
+
constructor(
|
|
10
|
+
private router: Router,
|
|
11
|
+
private route: ActivatedRoute
|
|
12
|
+
) {}
|
|
13
|
+
|
|
14
|
+
addQueryParam() {
|
|
15
|
+
this.router.navigate([], {
|
|
16
|
+
relativeTo: this.route,
|
|
17
|
+
queryParams: { showExampleModalComponent: true },
|
|
18
|
+
queryParamsHandling: 'merge',
|
|
19
|
+
replaceUrl: true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core';
|
|
2
|
+
import { BsModalRef } from 'ngx-bootstrap/modal';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-example-component',
|
|
6
|
+
template: `<p>This component was rendered via <code>hookQueryParamModal</code></p>
|
|
7
|
+
<button class="btn btn-default" title="{{ 'Close' }}" type="button" (click)="cancel()">
|
|
8
|
+
{{ 'Close' }}
|
|
9
|
+
</button>`
|
|
10
|
+
})
|
|
11
|
+
export class ExampleComponent {
|
|
12
|
+
private readonly bsModalRef = inject(BsModalRef);
|
|
13
|
+
|
|
14
|
+
cancel() {
|
|
15
|
+
this.bsModalRef.hide();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './query-param-modal.module';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
CommonModule,
|
|
4
|
+
hookNavigator,
|
|
5
|
+
hookQueryParamModal,
|
|
6
|
+
hookRoute,
|
|
7
|
+
NavigatorNode
|
|
8
|
+
} from '@c8y/ngx-components';
|
|
9
|
+
import { ExampleComponent } from './example-component';
|
|
10
|
+
|
|
11
|
+
@NgModule({
|
|
12
|
+
declarations: [],
|
|
13
|
+
imports: [CommonModule],
|
|
14
|
+
providers: [
|
|
15
|
+
hookRoute({
|
|
16
|
+
path: 'hooks/query-param-modal',
|
|
17
|
+
loadComponent: () => import('./example-button.component').then(m => m.ExampleButtonComponent)
|
|
18
|
+
}),
|
|
19
|
+
hookNavigator(
|
|
20
|
+
new NavigatorNode({
|
|
21
|
+
priority: 70,
|
|
22
|
+
path: 'hooks/query-param-modal',
|
|
23
|
+
icon: 'navigation-toolbar-top',
|
|
24
|
+
label: 'QueryParamModal',
|
|
25
|
+
parent: 'Hooks'
|
|
26
|
+
})
|
|
27
|
+
),
|
|
28
|
+
hookQueryParamModal({
|
|
29
|
+
queryParam: 'showExampleModalComponent',
|
|
30
|
+
component: ExampleComponent,
|
|
31
|
+
modalConfig: {
|
|
32
|
+
class: 'modal-lg',
|
|
33
|
+
ignoreBackdropClick: true,
|
|
34
|
+
keyboard: false
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
39
|
+
export class QueryParamModalModule {}
|