@c8y/tutorial 1023.22.7 → 1023.22.11

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,12 +1,12 @@
1
1
  {
2
2
  "name": "@c8y/tutorial",
3
- "version": "1023.22.7",
3
+ "version": "1023.22.11",
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": "1023.22.7",
7
- "@c8y/ngx-components": "1023.22.7",
8
- "@c8y/client": "1023.22.7",
9
- "@c8y/bootstrap": "1023.22.7",
6
+ "@c8y/style": "1023.22.11",
7
+ "@c8y/ngx-components": "1023.22.11",
8
+ "@c8y/client": "1023.22.11",
9
+ "@c8y/bootstrap": "1023.22.11",
10
10
  "@angular/cdk": "^20.2.14",
11
11
  "monaco-editor": "~0.53.0",
12
12
  "ngx-bootstrap": "20.0.2",
@@ -14,8 +14,8 @@
14
14
  "rxjs": "7.8.2"
15
15
  },
16
16
  "devDependencies": {
17
- "@c8y/options": "1023.22.7",
18
- "@c8y/devkit": "1023.22.7"
17
+ "@c8y/options": "1023.22.11",
18
+ "@c8y/devkit": "1023.22.11"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@angular/common": ">=20 <21"
@@ -14,6 +14,7 @@ import {
14
14
  import { SubAssetsModule } from '@c8y/ngx-components/sub-assets';
15
15
  import { TooltipModule } from 'ngx-bootstrap/tooltip';
16
16
  import { JsonPipe } from '@angular/common';
17
+ import { PopoverDirective } from 'ngx-bootstrap/popover';
17
18
 
18
19
  @Component({
19
20
  selector: 'tut-properties-selector-inline',
@@ -126,11 +127,29 @@ import { JsonPipe } from '@angular/common';
126
127
  <span></span>
127
128
  <small>allowDragAndDrop</small>
128
129
  </label>
130
+ <label class="c8y-switch m-0">
131
+ <input type="checkbox" [(ngModel)]="usePreselectedProperties" />
132
+ <span></span>
133
+ <small>Use preselected properties</small>
134
+ <button
135
+ class="btn-help btn-help--sm"
136
+ [attr.aria-label]="'Help' | translate"
137
+ [popover]="helpRef"
138
+ placement="right"
139
+ triggers="focus"
140
+ container="body"
141
+ type="button"
142
+ [adaptivePosition]="true"
143
+ ></button>
144
+ <ng-template #helpRef>
145
+ <div [innerHTML]="preselectedPropertiesHelpText"></div>
146
+ </ng-template>
147
+ </label>
129
148
  </div>
130
149
  </div>
131
150
  <div class="col-xs-12 col-md-5">
132
151
  <div class="card">
133
- <div class="inner-scroll d-flex d-col bg-component" style="height: 623px">
152
+ <div class="inner-scroll d-flex d-col bg-component" style="height: 655px">
134
153
  <c8y-asset-property-list
135
154
  class="bg-component"
136
155
  [asset]="selectedAsset"
@@ -142,7 +161,8 @@ import { JsonPipe } from '@angular/common';
142
161
  expansionMode: expansionMode,
143
162
  showKey: showKey,
144
163
  allowAddingCustomProperties: allowAddingCustomProperties,
145
- allowDragAndDrop: allowDragAndDrop
164
+ allowDragAndDrop: allowDragAndDrop,
165
+ selectedProperties: usePreselectedProperties ? selectedProperties : []
146
166
  }"
147
167
  (selectedProperties)="onSelectedProperties($event)"
148
168
  >
@@ -162,7 +182,7 @@ import { JsonPipe } from '@angular/common';
162
182
  </div>
163
183
  </div>
164
184
  <div class="col-xs-12 col-md-4">
165
- <pre class="inner-scroll" style="height: 623px">{{ assetPropertiesOutput | json }}</pre>
185
+ <pre class="inner-scroll" style="height: 655px">{{ assetPropertiesOutput | json }}</pre>
166
186
  </div>
167
187
  </div>`,
168
188
  standalone: true,
@@ -175,10 +195,40 @@ import { JsonPipe } from '@angular/common';
175
195
  AssetPropertyActionDirective,
176
196
  C8yTranslatePipe,
177
197
  TooltipModule,
178
- JsonPipe
198
+ JsonPipe,
199
+ PopoverDirective
179
200
  ]
180
201
  })
181
202
  export class PropertiesSelectorInlineExampleComponent {
203
+ selectedProperties: AssetPropertyType[] = [
204
+ {
205
+ label: 'id',
206
+ name: 'id',
207
+ type: 'string',
208
+ isEditable: true,
209
+ c8y_JsonSchema: {
210
+ properties: {
211
+ id: {
212
+ key: 'id',
213
+ type: 'string',
214
+ label: 'id',
215
+ properties: {}
216
+ }
217
+ }
218
+ },
219
+ active: true
220
+ },
221
+ {
222
+ title: 'critical',
223
+ type: 'number',
224
+ name: 'critical',
225
+ label: 'critical',
226
+ keyPath: ['c8y_ActiveAlarmsStatus', 'critical'],
227
+ active: true
228
+ }
229
+ ];
230
+ preselectedPropertiesHelpText = `Use preselected properties defined in the component code: \n
231
+ <pre>${JSON.stringify(this.selectedProperties, null, 2)}</pre>`;
182
232
  inventoryService = inject(InventoryService);
183
233
  model: IIdentified;
184
234
  selectedAsset: IManagedObject;
@@ -193,6 +243,7 @@ export class PropertiesSelectorInlineExampleComponent {
193
243
  filterable = true;
194
244
  allowAddingCustomProperties = true;
195
245
  allowDragAndDrop = true;
246
+ usePreselectedProperties = false;
196
247
 
197
248
  selectionChanged(e: AssetSelectionChangeEvent) {
198
249
  this.selectedAsset = e.change.item;