@c8y/tutorial 1021.0.11 → 1021.2.1

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.
@@ -736,6 +736,13 @@ export default {
736
736
  path: './src/typeahead/typeahead-example.module.ts',
737
737
  description: 'This is an example for the typeahead component.',
738
738
  scope: 'self'
739
+ },
740
+ {
741
+ name: 'Countdown',
742
+ module: 'CountdownExampleModule',
743
+ path: './src/countdown/countdown-example.module.ts',
744
+ description: 'This is an example for the countdown component.',
745
+ scope: 'self'
739
746
  }
740
747
  ]
741
748
  },
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@c8y/tutorial",
3
- "version": "1021.0.11",
3
+ "version": "1021.2.1",
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.0.11",
7
- "@c8y/ngx-components": "1021.0.11",
8
- "@c8y/client": "1021.0.11",
9
- "@c8y/bootstrap": "1021.0.11",
6
+ "@c8y/style": "1021.2.1",
7
+ "@c8y/ngx-components": "1021.2.1",
8
+ "@c8y/client": "1021.2.1",
9
+ "@c8y/bootstrap": "1021.2.1",
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.0.11",
17
- "@c8y/devkit": "1021.0.11"
16
+ "@c8y/options": "1021.2.1",
17
+ "@c8y/devkit": "1021.2.1"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@angular/common": ">=18 <19"
Binary file
@@ -0,0 +1,35 @@
1
+ <div class="time-elapsed">
2
+ <!-- important -->
3
+ <c8y-countdown-interval
4
+ [countdownInterval]="10000"
5
+ (countdownEnded)="onCountdownEnded()"
6
+ ></c8y-countdown-interval>
7
+ <!-- /important -->
8
+ </div>
9
+ <div class="container-fluid p-24 text-center">
10
+ <button
11
+ class="btn btn-default"
12
+ (click)="startCountdown()"
13
+ >
14
+ Start
15
+ </button>
16
+ <button
17
+ class="btn btn-default"
18
+ (click)="stopCountdown()"
19
+ >
20
+ Stop
21
+ </button>
22
+ <button
23
+ class="btn btn-default"
24
+ (click)="stopCountdownAtZero()"
25
+ >
26
+ Stop at 0
27
+ </button>
28
+ <button
29
+ class="btn btn-default"
30
+ (click)="resetCountdown()"
31
+ >
32
+ Reset
33
+ </button>
34
+ </div>
35
+ `
@@ -0,0 +1,43 @@
1
+ import { AfterViewInit, Component, ViewChild } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ CountdownIntervalComponent,
5
+ CountdownIntervalModule
6
+ } from '@c8y/ngx-components';
7
+
8
+ @Component({
9
+ selector: 'tut-countdown-example',
10
+ templateUrl: './countdown-example.component.html',
11
+ standalone: true,
12
+ imports: [CommonModule, CountdownIntervalModule]
13
+ })
14
+ export class CountdownExampleComponent implements AfterViewInit {
15
+ @ViewChild(CountdownIntervalComponent)
16
+ countdownIntervalComponent: CountdownIntervalComponent;
17
+
18
+ ngAfterViewInit(): void {
19
+ this.startCountdown(); // We need to start the countdown at some point, for example, in AfterViewInit
20
+ }
21
+
22
+ startCountdown(): void {
23
+ this.countdownIntervalComponent.start();
24
+ }
25
+
26
+ stopCountdown(): void {
27
+ this.countdownIntervalComponent.stop();
28
+ }
29
+
30
+ stopCountdownAtZero(): void {
31
+ this.countdownIntervalComponent.stop(true);
32
+ }
33
+
34
+ resetCountdown(): void {
35
+ this.countdownIntervalComponent.reset();
36
+ }
37
+
38
+ onCountdownEnded(): void {
39
+ console.log('Countdown Ended!');
40
+
41
+ this.resetCountdown();
42
+ }
43
+ }
@@ -0,0 +1,21 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+
4
+ @NgModule({
5
+ providers: [
6
+ hookRoute({
7
+ path: 'help',
8
+ loadComponent: () =>
9
+ import('./countdown-example.component').then(m => m.CountdownExampleComponent)
10
+ }),
11
+ hookNavigator(
12
+ new NavigatorNode({
13
+ path: '/countdown',
14
+ label: 'Countdown',
15
+ icon: 'hand-o-right',
16
+ priority: 110
17
+ })
18
+ )
19
+ ]
20
+ })
21
+ export class CountdownExampleModule {}