@c8y/tutorial 1021.36.0 → 1021.37.5
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
CHANGED
|
@@ -702,6 +702,13 @@ export default {
|
|
|
702
702
|
description: 'An introduction to asset selector tree devices example.',
|
|
703
703
|
scope: 'self'
|
|
704
704
|
},
|
|
705
|
+
{
|
|
706
|
+
name: 'Example of selectable nodes in the asset selector',
|
|
707
|
+
module: 'AssetSelectorNodeSelectableExampleModule',
|
|
708
|
+
path: './src/selector/asset-selector-example/node-selectable/asset-selector-node-selectable.module.ts',
|
|
709
|
+
description: 'Selectable nodes example for the asset-selector',
|
|
710
|
+
scope: 'self'
|
|
711
|
+
},
|
|
705
712
|
{
|
|
706
713
|
name: 'Introduction to asset selector tree search',
|
|
707
714
|
module: 'AssetSelectorTreeSearchModule',
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/tutorial",
|
|
3
|
-
"version": "1021.
|
|
3
|
+
"version": "1021.37.5",
|
|
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.
|
|
7
|
-
"@c8y/ngx-components": "1021.
|
|
8
|
-
"@c8y/client": "1021.
|
|
9
|
-
"@c8y/bootstrap": "1021.
|
|
6
|
+
"@c8y/style": "1021.37.5",
|
|
7
|
+
"@c8y/ngx-components": "1021.37.5",
|
|
8
|
+
"@c8y/client": "1021.37.5",
|
|
9
|
+
"@c8y/bootstrap": "1021.37.5",
|
|
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.
|
|
17
|
-
"@c8y/devkit": "1021.
|
|
16
|
+
"@c8y/options": "1021.37.5",
|
|
17
|
+
"@c8y/devkit": "1021.37.5"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@angular/common": ">=18 <19"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
import { AssetSelectorModule } from '@c8y/ngx-components/assets-navigator';
|
|
5
|
+
import { IIdentified } from '@c8y/client';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'asset-selector-tree-single',
|
|
9
|
+
template: `<c8y-title>Asset selector</c8y-title>
|
|
10
|
+
<div class="row">
|
|
11
|
+
<div class="col-sm-6">
|
|
12
|
+
<div class="card">
|
|
13
|
+
<div class="card-header separator">
|
|
14
|
+
<h4 class="card-title">Tree view node selectable</h4>
|
|
15
|
+
</div>
|
|
16
|
+
<c8y-asset-selector
|
|
17
|
+
(onSelected)="selectionChanged($event)"
|
|
18
|
+
[(ngModel)]="model"
|
|
19
|
+
[isNodeSelectable]="isNodeSelectable"
|
|
20
|
+
[config]="{
|
|
21
|
+
groupsSelectable: true,
|
|
22
|
+
multi: true
|
|
23
|
+
}"
|
|
24
|
+
></c8y-asset-selector>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
<div class="col-xs-12 col-sm-4 col-md-3">
|
|
28
|
+
<div class="card">
|
|
29
|
+
<div class="card-header separator">
|
|
30
|
+
<h4 class="card-title">Model</h4>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="card-inner-scroll">
|
|
33
|
+
<pre style="min-height: 98px"><code>{{ model | json }}</code></pre>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div> `,
|
|
38
|
+
standalone: true,
|
|
39
|
+
imports: [CommonModule, AssetSelectorModule, CoreModule]
|
|
40
|
+
})
|
|
41
|
+
export class AssetSelectorNodeSelectableExampleComponent {
|
|
42
|
+
model: IIdentified;
|
|
43
|
+
|
|
44
|
+
isNodeSelectable = node => {
|
|
45
|
+
// Only allow selecting assets of type building
|
|
46
|
+
return node.mo.type === 'building';
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
selectionChanged(e) {
|
|
50
|
+
console.log(e);
|
|
51
|
+
}
|
|
52
|
+
}
|
package/src/selector/asset-selector-example/node-selectable/asset-selector-node-selectable.module.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [BsDropdownModule.forRoot()],
|
|
7
|
+
providers: [
|
|
8
|
+
hookRoute({
|
|
9
|
+
path: 'selector/asset-selector-example/node-selectable',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./asset-selector-node-selectable.component').then(
|
|
12
|
+
m => m.AssetSelectorNodeSelectableExampleComponent
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
label: 'node selectable',
|
|
18
|
+
path: '/selector/asset-selector-example/node-selectable',
|
|
19
|
+
icon: 'th-list',
|
|
20
|
+
priority: -1,
|
|
21
|
+
parent: 'Asset selector'
|
|
22
|
+
})
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class AssetSelectorNodeSelectableExampleModule {}
|