@c8y/tutorial 1024.15.16 → 1024.16.10

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.
@@ -58,6 +58,13 @@ export default {
58
58
  description: 'An introduction to asset selector',
59
59
  scope: 'self'
60
60
  },
61
+ {
62
+ name: 'Introduction to icon selector',
63
+ module: 'NgxIconSelectorExampleModule',
64
+ path: './src/selector/icon-selector-example/icon-selector-example.module.ts',
65
+ description: 'An introduction to the icon selector component.',
66
+ scope: 'self'
67
+ },
61
68
  {
62
69
  name: 'Introduction Example Module',
63
70
  module: 'IntroductionExampleModule',
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@c8y/tutorial",
3
- "version": "1024.15.16",
3
+ "version": "1024.16.10",
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.16",
9
- "@c8y/client": "1024.15.16",
10
- "@c8y/ngx-components": "1024.15.16",
11
- "@c8y/style": "1024.15.16",
8
+ "@c8y/bootstrap": "1024.16.10",
9
+ "@c8y/client": "1024.16.10",
10
+ "@c8y/ngx-components": "1024.16.10",
11
+ "@c8y/style": "1024.16.10",
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.16",
21
- "@c8y/options": "1024.15.16"
20
+ "@c8y/devkit": "1024.16.10",
21
+ "@c8y/options": "1024.16.10"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "@angular/common": ">=21 <22"
@@ -320,6 +320,38 @@
320
320
  <div>This is content that is projected by default and always shown.</div>
321
321
  }
322
322
 
323
+ <!-- Action bar below the input box. Project any control and place it left, right or in the
324
+ overflow (more) dropdown. -->
325
+ <c8y-ai-chat-action placement="left">
326
+ <button
327
+ class="btn btn-link btn-sm"
328
+ type="button"
329
+ (click)="clearMessages()"
330
+ >
331
+ <i c8yIcon="delete-bin"></i> {{ 'Clear chat' | translate }}
332
+ </button>
333
+ </c8y-ai-chat-action>
334
+
335
+ <c8y-ai-chat-action placement="right">
336
+ <button
337
+ class="btn btn-link btn-sm"
338
+ type="button"
339
+ (click)="reloadComponent()"
340
+ >
341
+ {{ 'Reset example' | translate }}
342
+ </button>
343
+ </c8y-ai-chat-action>
344
+
345
+ <c8y-ai-chat-action placement="more">
346
+ <button
347
+ class="dropdown-item"
348
+ type="button"
349
+ (click)="clearMessages()"
350
+ >
351
+ <i c8yIcon="delete-bin"></i> {{ 'Clear chat' | translate }}
352
+ </button>
353
+ </c8y-ai-chat-action>
354
+
323
355
  <c8y-ai-chat-suggestion
324
356
  [label]="'Create device '"
325
357
  [prompt]="'AHOI, create a new device'"
@@ -4,6 +4,7 @@ import { FormsModule } from '@angular/forms';
4
4
  import { CoreModule, LoadingComponent } from '@c8y/ngx-components';
5
5
  import { AIMessage, AssistantMessageDisplayConfig, ChatConfig } from '@c8y/ngx-components/ai';
6
6
  import {
7
+ AiChatActionComponent,
7
8
  AiChatAssistantMessageComponent,
8
9
  AiChatComponent,
9
10
  AiChatMessageActionComponent,
@@ -21,6 +22,7 @@ import { gettext } from '@c8y/ngx-components/gettext';
21
22
  AiChatMessageComponent,
22
23
  AiChatMessageActionComponent,
23
24
  AiChatSuggestionComponent,
25
+ AiChatActionComponent,
24
26
  LoadingComponent,
25
27
  NgComponentOutlet,
26
28
  CoreModule,
@@ -127,6 +129,11 @@ export class ChatExampleComponent {
127
129
  this.updateDisplayMessages();
128
130
  }
129
131
 
132
+ clearMessages() {
133
+ this.messages = [];
134
+ this.updateDisplayMessages();
135
+ }
136
+
130
137
  reloadComponent() {
131
138
  // Reload the component by toggling the flag
132
139
  this.showComponent = false;
@@ -1,5 +1,5 @@
1
1
  import { Component } from '@angular/core';
2
- import { CellRendererContext } from '@c8y/ngx-components';
2
+ import { CellRendererContext, IconDirective } from '@c8y/ngx-components';
3
3
 
4
4
  /**
5
5
  * The example component for custom header renderer.
@@ -14,7 +14,8 @@ import { CellRendererContext } from '@c8y/ngx-components';
14
14
  </span>
15
15
  `,
16
16
  selector: 'example-type-header-cell-renderer',
17
- standalone: true
17
+ standalone: true,
18
+ imports: [IconDirective]
18
19
  })
19
20
  export class TypeHeaderCellRendererComponent {
20
21
  constructor(public context: CellRendererContext) {}
@@ -30,8 +30,12 @@ import { SimpleModalExampleComponent } from './simple-modal-example.component';
30
30
  (onClose)="onTemplateRefClose($event)"
31
31
  (onDismiss)="onTemplateRefDismiss($event)"
32
32
  [labels]="labels"
33
+ [headerClasses]="'dialog-header'"
33
34
  [disabled]="true"
34
35
  >
36
+ <ng-container c8y-modal-title>
37
+ <span [c8yIcon]="'export'"></span>
38
+ </ng-container>
35
39
  <c8y-list-group>
36
40
  <c8y-li *ngFor="let a of listArray; let index = index">
37
41
  <c8y-li-checkbox></c8y-li-checkbox>
@@ -81,6 +85,6 @@ export class NgxModalExampleComponent {
81
85
  ariaDescribedby: 'modal-body',
82
86
  ariaLabelledBy: 'modal-title',
83
87
  ignoreBackdropClick: true
84
- }).content as SimpleModalExampleComponent;
88
+ });
85
89
  }
86
90
  }
@@ -16,8 +16,12 @@ import {
16
16
  (onClose)="onClose($event)"
17
17
  (onDismiss)="onDismiss($event)"
18
18
  [labels]="labels"
19
+ [headerClasses]="'dialog-header'"
19
20
  [disabled]="true"
20
21
  >
22
+ <ng-container c8y-modal-title>
23
+ <span [c8yIcon]="'export'"></span>
24
+ </ng-container>
21
25
  <c8y-list-group>
22
26
  <c8y-li *ngFor="let a of listArray; let index = index">
23
27
  <c8y-li-checkbox></c8y-li-checkbox>
@@ -3,6 +3,7 @@ import {
3
3
  CommonModule,
4
4
  FormsModule,
5
5
  HeaderModule,
6
+ IconDirective,
6
7
  ListGroupModule,
7
8
  ModalLabels,
8
9
  ModalModule
@@ -32,7 +33,7 @@ import {
32
33
  </c8y-modal>
33
34
  `,
34
35
  standalone: true,
35
- imports: [ModalModule, HeaderModule, CommonModule, FormsModule, ListGroupModule]
36
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, ListGroupModule, IconDirective]
36
37
  })
37
38
  export class SimpleModalAccessibilityExampleComponent {
38
39
  labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
@@ -1,5 +1,11 @@
1
1
  import { Component, ViewChild } from '@angular/core';
2
- import { CommonModule, FormsModule, HeaderModule, ModalModule } from '@c8y/ngx-components';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ IconDirective,
7
+ ModalModule
8
+ } from '@c8y/ngx-components';
3
9
 
4
10
  @Component({
5
11
  selector: 'tut-simple-modal-with-selectors',
@@ -46,7 +52,7 @@ import { CommonModule, FormsModule, HeaderModule, ModalModule } from '@c8y/ngx-c
46
52
  </c8y-modal>
47
53
  `,
48
54
  standalone: true,
49
- imports: [ModalModule, HeaderModule, CommonModule, FormsModule]
55
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, IconDirective]
50
56
  })
51
57
  export class SimpleModalExampleWithContentSelectorsComponent {
52
58
  smartGroup = {
@@ -16,8 +16,12 @@ import {
16
16
  (onClose)="onClose($event)"
17
17
  (onDismiss)="onDismiss($event)"
18
18
  [labels]="labels"
19
+ [headerClasses]="'dialog-header'"
19
20
  [disabled]="true"
20
21
  >
22
+ <ng-container c8y-modal-title>
23
+ <span [c8yIcon]="'export'"></span>
24
+ </ng-container>
21
25
  <c8y-list-group>
22
26
  <c8y-li *ngFor="let a of listArray; let index = index">
23
27
  <c8y-li-checkbox></c8y-li-checkbox>
@@ -16,8 +16,12 @@ import {
16
16
  (onClose)="onClose($event)"
17
17
  (onDismiss)="onDismiss($event)"
18
18
  [labels]="labels"
19
+ [headerClasses]="'dialog-header'"
19
20
  [disabled]="true"
20
21
  >
22
+ <ng-container c8y-modal-title>
23
+ <span [c8yIcon]="'export'"></span>
24
+ </ng-container>
21
25
  <c8y-list-group>
22
26
  <c8y-li *ngFor="let a of listArray; let index = index">
23
27
  <c8y-li-checkbox></c8y-li-checkbox>
@@ -3,6 +3,7 @@ import { gettext } from '@c8y/ngx-components/gettext';
3
3
  import {
4
4
  CommonModule,
5
5
  HeaderModule,
6
+ IconDirective,
6
7
  ModalModule,
7
8
  PopoverConfirmButtons,
8
9
  PopoverConfirmComponent
@@ -29,7 +30,7 @@ import {
29
30
  ></c8y-popover-confirm>
30
31
  </div>`,
31
32
  standalone: true,
32
- imports: [ModalModule, CommonModule, HeaderModule]
33
+ imports: [ModalModule, CommonModule, HeaderModule, IconDirective]
33
34
  })
34
35
  export class PopConfirmExampleComponent {
35
36
  // you can provide custom buttons
@@ -59,7 +60,7 @@ export class PopConfirmExampleComponent {
59
60
  }
60
61
  // eslint-disable-next-line no-console
61
62
  console.log('You successfully deleted the item!');
62
- } catch (e) {
63
+ } catch {
63
64
  // do nothing or display "deletion failed" message
64
65
  }
65
66
  }
@@ -0,0 +1,38 @@
1
+ <c8y-title>Icon selector examples</c8y-title>
2
+ <div class="">
3
+ <p class="m-b-8 text-bold">{{ 'Browsing and selecting' | translate }}</p>
4
+ <!-- important -->
5
+ <div
6
+ class="bg-component border-all"
7
+ style="height: 480px; overflow-y: auto"
8
+ >
9
+ <c8y-icon-selector (onSelect)="onSelect($event)"></c8y-icon-selector>
10
+ </div>
11
+ <!-- /important -->
12
+ @if (selectedIcon(); as icon) {
13
+ <p class="m-t-8 d-flex a-i-center gap-8">
14
+ <span>{{ 'Selected' | translate }}:</span>
15
+ <i
16
+ [c8yIcon]="icon"
17
+ aria-hidden="true"
18
+ ></i>
19
+ <code>{{ icon }}</code>
20
+ </p>
21
+ }
22
+
23
+ <p class="m-t-24 m-b-8 text-bold">{{ 'Form integration' | translate }}</p>
24
+ <form [formGroup]="form">
25
+ <div class="d-inline-block">
26
+ <!-- important -->
27
+ <c8y-icon-selector-wrapper
28
+ [canRemoveIcon]="true"
29
+ [iconSize]="32"
30
+ formControlName="icon"
31
+ ></c8y-icon-selector-wrapper>
32
+ <!-- /important -->
33
+ </div>
34
+ </form>
35
+ <p class="m-t-8">
36
+ <code>{{ form.value | json }}</code>
37
+ </p>
38
+ </div>
@@ -0,0 +1,36 @@
1
+ import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
2
+ import { JsonPipe } from '@angular/common';
3
+ import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
4
+ import { C8yTranslatePipe, IconDirective, TitleComponent } from '@c8y/ngx-components';
5
+ import {
6
+ IconSelectorComponent,
7
+ IconSelectorWrapperComponent
8
+ } from '@c8y/ngx-components/icon-selector';
9
+
10
+ @Component({
11
+ selector: 'c8y-icon-selector-example',
12
+ templateUrl: './icon-selector-example.component.html',
13
+ changeDetection: ChangeDetectionStrategy.OnPush,
14
+ imports: [
15
+ JsonPipe,
16
+ ReactiveFormsModule,
17
+ C8yTranslatePipe,
18
+ IconDirective,
19
+ TitleComponent,
20
+ IconSelectorComponent,
21
+ IconSelectorWrapperComponent
22
+ ]
23
+ })
24
+ export class IconSelectorExampleComponent {
25
+ /** Last icon chosen from the inline selector grid. */
26
+ protected readonly selectedIcon = signal<string | undefined>(undefined);
27
+
28
+ /** Form-bound icon selection driven by the icon-selector wrapper. */
29
+ protected readonly form = new FormGroup({
30
+ icon: new FormControl('c8y-device')
31
+ });
32
+
33
+ protected onSelect(icon: string | undefined): void {
34
+ this.selectedIcon.set(icon);
35
+ }
36
+ }
@@ -0,0 +1,23 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
4
+
5
+ @NgModule({
6
+ imports: [CommonModule],
7
+ providers: [
8
+ hookRoute({
9
+ path: 'icon-selector',
10
+ loadComponent: () =>
11
+ import('./icon-selector-example.component').then(m => m.IconSelectorExampleComponent)
12
+ }),
13
+ hookNavigator(
14
+ new NavigatorNode({
15
+ path: '/icon-selector',
16
+ label: 'Icon selector',
17
+ icon: 'c8y-circle-star',
18
+ priority: 85
19
+ })
20
+ )
21
+ ]
22
+ })
23
+ export class NgxIconSelectorExampleModule {}