@c8y/tutorial 1024.15.7 → 1024.15.13

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,14 +1,14 @@
1
1
  {
2
2
  "name": "@c8y/tutorial",
3
- "version": "1024.15.7",
3
+ "version": "1024.15.13",
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
6
  "@angular/animations": "^21.2.0",
7
7
  "@angular/cdk": "^21.2.0",
8
- "@c8y/bootstrap": "1024.15.7",
9
- "@c8y/client": "1024.15.7",
10
- "@c8y/ngx-components": "1024.15.7",
11
- "@c8y/style": "1024.15.7",
8
+ "@c8y/bootstrap": "1024.15.13",
9
+ "@c8y/client": "1024.15.13",
10
+ "@c8y/ngx-components": "1024.15.13",
11
+ "@c8y/style": "1024.15.13",
12
12
  "gridstack": "^12.4.2",
13
13
  "leaflet": "1.9.4",
14
14
  "monaco-editor": "~0.53.0",
@@ -17,8 +17,8 @@
17
17
  "zone.js": "~0.15.1"
18
18
  },
19
19
  "devDependencies": {
20
- "@c8y/devkit": "1024.15.7",
21
- "@c8y/options": "1024.15.7"
20
+ "@c8y/devkit": "1024.15.13",
21
+ "@c8y/options": "1024.15.13"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@angular/common": ">=21 <22"
@@ -5,7 +5,9 @@ import {
5
5
  CoreModule,
6
6
  FormsModule,
7
7
  HeaderModule,
8
- ModalModule
8
+ ModalModule,
9
+ ModalService,
10
+ Status
9
11
  } from '@c8y/ngx-components';
10
12
  import { SimpleModalAccessibilityExampleComponent } from './simple-modal-accessibility-example.component';
11
13
 
@@ -21,6 +23,12 @@ import { SimpleModalAccessibilityExampleComponent } from './simple-modal-accessi
21
23
  >
22
24
  Create component modal with with ModalComponent and custom ids
23
25
  </button>
26
+ <button class="btn btn-default m-8" type="button" (click)="closeDashboardDetails()">
27
+ Confirm modal with default ids and initial focus
28
+ </button>
29
+ @if (lastConfirmChoice) {
30
+ <p class="text-muted" role="status">You chose: {{ lastConfirmChoice }}</p>
31
+ }
24
32
  </div>
25
33
  </div>`,
26
34
  standalone: true,
@@ -34,7 +42,13 @@ import { SimpleModalAccessibilityExampleComponent } from './simple-modal-accessi
34
42
  ]
35
43
  })
36
44
  export class NgxModalAccessibilityExampleComponent {
37
- constructor(private modalService: BsModalService) {}
45
+ /** The label of the button the user picked in the confirm dialog, shown instead of logging it. */
46
+ lastConfirmChoice = '';
47
+
48
+ constructor(
49
+ private modalService: BsModalService,
50
+ private modal: ModalService
51
+ ) {}
38
52
 
39
53
  openComponentModalWithContentSelectors() {
40
54
  this.modalService.show(SimpleModalAccessibilityExampleComponent, {
@@ -42,6 +56,25 @@ export class NgxModalAccessibilityExampleComponent {
42
56
  ariaDescribedby: 'modal-body-custom',
43
57
  ariaLabelledBy: 'modal-title-custom',
44
58
  ignoreBackdropClick: true
45
- }).content as SimpleModalAccessibilityExampleComponent;
59
+ });
60
+ }
61
+
62
+ /**
63
+ * `ModalService.confirm` already points `aria-labelledby` and `aria-describedby` at the
64
+ * default `modal-title` and `modal-body` ids, so the title and the warning are announced
65
+ * when the dialog opens, and focus starts on "Cancel".
66
+ */
67
+ async closeDashboardDetails() {
68
+ try {
69
+ await this.modal.confirm(
70
+ 'Close dashboard details',
71
+ 'Are you sure you want to close dashboard details? All unsaved changes will be lost.',
72
+ Status.WARNING,
73
+ { ok: 'Close', cancel: 'Cancel' }
74
+ );
75
+ this.lastConfirmChoice = 'Close';
76
+ } catch {
77
+ this.lastConfirmChoice = 'Cancel';
78
+ }
46
79
  }
47
80
  }