@c8y/tutorial 1019.24.2 → 1020.0.4
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/NOTICES +8357 -6666
- package/cumulocity.config.ts +208 -200
- package/package.json +13 -10
- package/src/__mocks/mock.module.ts +21 -0
- package/src/__mocks/scoped-mocks/lists.ts +70 -0
- package/src/__mocks/utils/generators/alarms.ts +6 -14
- package/src/alert/alert-example.components.html +98 -96
- package/src/app/app.module.ts +5 -1
- package/src/asset-navigator/asset-navigator-example.module.ts +21 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.component.ts +0 -1
- package/src/dashboard-tabs/dashboard-tabs.component.ts +95 -0
- package/src/dashboard-tabs/dashboard-tabs.module.ts +20 -0
- package/src/dashboard-tabs/index.ts +1 -0
- package/src/for-of-directive/for-of-example.component.html +83 -16
- package/src/for-of-directive/for-of-example.component.ts +17 -3
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-example.component.ts +21 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.component.html +28 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.component.ts +91 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.module.ts +26 -0
- package/src/grids/client-grid-example/client-grid-example.component.html +1 -0
- package/src/grids/device-grid-example/device-grid-example.component.html +1 -0
- package/src/grids/empty-grid-example/empty-grid-example.component.html +1 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-example.component.ts +12 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.component.html +18 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.component.ts +84 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.module.ts +24 -0
- package/src/grids/server-grid-example/server-grid-example.component.html +1 -0
- package/src/grids/server-grid-example/server-grid-example.component.ts +2 -1
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-example.component.ts +12 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.html +18 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.ts +84 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.module.ts +26 -0
- package/src/hooks/navigator-route/navigator-route.module.ts +2 -2
- package/src/hooks/tabs/tab.ts +1 -1
- package/src/list/list/list-check/list-check.component.html +40 -28
- package/src/list/list/list-check/list-check.component.ts +45 -7
- package/src/list/list/list-timeline/list-timeline.component.html +1 -1
- package/src/list/list/list-timeline/list-timeline.component.ts +7 -3
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.ts +7 -12
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.ts +11 -26
- package/src/main.ts +6 -4
- package/src/polyfills.ts +1 -1
- package/src/popconfirm/pop-confirm-example.component.ts +8 -6
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.component.ts +2 -2
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.html +58 -68
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.component.ts +1 -1
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.component.ts +2 -2
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.component.ts +12 -16
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.component.ts +14 -18
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.component.ts +17 -21
- package/src/translations/new-translate/new-translation.component.html +3 -3
- package/src/widget/demo-widget-config.component.ts +7 -2
|
@@ -13,19 +13,33 @@ import { map, tap } from 'rxjs/operators';
|
|
|
13
13
|
export class ForOfExampleComponent {
|
|
14
14
|
devices: IResultList<IManagedObject>;
|
|
15
15
|
filterPipe: ForOfFilterPipe = pipe(tap());
|
|
16
|
+
config = {
|
|
17
|
+
loadMore: 'auto',
|
|
18
|
+
filter: '',
|
|
19
|
+
pageSize: 10,
|
|
20
|
+
maxIterations: 12
|
|
21
|
+
};
|
|
16
22
|
|
|
17
|
-
constructor(private inventoryService: InventoryService) {
|
|
23
|
+
constructor(private inventoryService: InventoryService) {}
|
|
24
|
+
|
|
25
|
+
ngOnInit(): void {
|
|
18
26
|
this.loadDevices();
|
|
19
27
|
}
|
|
20
28
|
|
|
21
29
|
async loadDevices() {
|
|
22
30
|
this.devices = await this.inventoryService.list({
|
|
23
|
-
pageSize:
|
|
31
|
+
pageSize: this.config.pageSize,
|
|
24
32
|
withTotalPages: true,
|
|
25
|
-
fragmentType: 'c8y_IsDevice'
|
|
33
|
+
fragmentType: 'c8y_IsDevice',
|
|
34
|
+
currentPage: 1
|
|
26
35
|
});
|
|
27
36
|
}
|
|
28
37
|
|
|
38
|
+
async reload() {
|
|
39
|
+
await this.loadDevices();
|
|
40
|
+
this.setPipe(this.config.filter);
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
setPipe(filterStr: string) {
|
|
30
44
|
this.filterPipe = pipe(
|
|
31
45
|
map((data: []) => {
|
package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-example.component.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'c8y-async-expandable-row-example',
|
|
6
|
+
template: `<div id="{{ context.id }}">Context ID: {{ context.id }}</div>`,
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule]
|
|
9
|
+
})
|
|
10
|
+
export class AsyncExpandableRowsComponent implements OnInit {
|
|
11
|
+
@Input() context: any;
|
|
12
|
+
@Input() asyncRenderSuccess: () => void;
|
|
13
|
+
@Input() asyncRenderFail: () => void;
|
|
14
|
+
|
|
15
|
+
ngOnInit() {
|
|
16
|
+
// simulate async data loading with a timeout
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
this.asyncRenderSuccess();
|
|
19
|
+
}, 2000);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<c8y-title>Data grid examples - asynchronous expandable rows</c8y-title>
|
|
2
|
+
|
|
3
|
+
<c8y-data-grid
|
|
4
|
+
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
5
|
+
[title]="title"
|
|
6
|
+
[columns]="columns"
|
|
7
|
+
[displayOptions]="displayOptions"
|
|
8
|
+
[rows]="data"
|
|
9
|
+
[pagination]="pagination"
|
|
10
|
+
[selectable]="selectable"
|
|
11
|
+
[expandableRows]="'ASYNC'"
|
|
12
|
+
(itemsSelect)="onItemsSelect($event)"
|
|
13
|
+
[actionControls]="actionControls"
|
|
14
|
+
>
|
|
15
|
+
<div
|
|
16
|
+
*c8yExpandableRow="
|
|
17
|
+
let context;
|
|
18
|
+
let asyncRenderSuccess = asyncRenderSuccess;
|
|
19
|
+
let asyncRenderFail = asyncRenderFail
|
|
20
|
+
"
|
|
21
|
+
>
|
|
22
|
+
<c8y-async-expandable-row-example
|
|
23
|
+
[context]="context"
|
|
24
|
+
[asyncRenderSuccess]="asyncRenderSuccess"
|
|
25
|
+
[asyncRenderFail]="asyncRenderFail"
|
|
26
|
+
></c8y-async-expandable-row-example>
|
|
27
|
+
</div>
|
|
28
|
+
</c8y-data-grid>
|
package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.component.ts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { RouterModule } from '@angular/router';
|
|
3
|
+
import { ActionControl, DisplayOptions, Column, CoreModule, Pagination } from '@c8y/ngx-components';
|
|
4
|
+
import { DeviceGridModule } from '@c8y/ngx-components/device-grid';
|
|
5
|
+
import { getData } from '../client-grid-example/data';
|
|
6
|
+
import { AsyncExpandableRowsComponent } from './async-expandable-rows-example.component';
|
|
7
|
+
import { ContextDashboardModule } from '@c8y/ngx-components/context-dashboard';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'c8y-async-expandable-rows-grid-example',
|
|
11
|
+
templateUrl: './async-expandable-rows-grid-example.component.html',
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [
|
|
14
|
+
CoreModule,
|
|
15
|
+
DeviceGridModule,
|
|
16
|
+
RouterModule,
|
|
17
|
+
AsyncExpandableRowsComponent,
|
|
18
|
+
ContextDashboardModule
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class AsyncExpandableRowsGridComponent implements OnInit {
|
|
22
|
+
/** This will be used as a title for the data grid. */
|
|
23
|
+
title = 'Devices';
|
|
24
|
+
|
|
25
|
+
displayOptions: DisplayOptions = {
|
|
26
|
+
bordered: false,
|
|
27
|
+
striped: true,
|
|
28
|
+
filter: true,
|
|
29
|
+
gridHeader: true,
|
|
30
|
+
hover: false
|
|
31
|
+
};
|
|
32
|
+
columns: Column[] = [
|
|
33
|
+
{
|
|
34
|
+
name: 'id',
|
|
35
|
+
header: 'ID',
|
|
36
|
+
path: 'id',
|
|
37
|
+
filterable: true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'name',
|
|
41
|
+
header: 'Name',
|
|
42
|
+
path: 'name',
|
|
43
|
+
filterable: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'type',
|
|
47
|
+
header: 'Type',
|
|
48
|
+
path: 'type',
|
|
49
|
+
filterable: true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'creationTime',
|
|
53
|
+
header: 'Creation time',
|
|
54
|
+
path: 'creationTime',
|
|
55
|
+
filterable: true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'lastUpdated',
|
|
59
|
+
header: 'Last updated',
|
|
60
|
+
path: 'lastUpdated',
|
|
61
|
+
filterable: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'owner',
|
|
65
|
+
header: 'Owner',
|
|
66
|
+
path: 'owner',
|
|
67
|
+
filterable: true
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
actionControls: ActionControl[] = [];
|
|
71
|
+
pagination: Pagination = {
|
|
72
|
+
pageSize: 30,
|
|
73
|
+
currentPage: 1
|
|
74
|
+
};
|
|
75
|
+
selectable = true;
|
|
76
|
+
data: any[];
|
|
77
|
+
|
|
78
|
+
ngOnInit() {
|
|
79
|
+
this.data = getData();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
onItemsSelect(selectedItemIds) {
|
|
83
|
+
console.log('selected items:');
|
|
84
|
+
console.dir(selectedItemIds);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onFilter(filter) {
|
|
88
|
+
console.log('filter changed:');
|
|
89
|
+
console.log(filter);
|
|
90
|
+
}
|
|
91
|
+
}
|
package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.module.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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: 'grids/async-expandable-rows-grid-example',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./async-expandable-rows-grid-example.component').then(
|
|
12
|
+
m => m.AsyncExpandableRowsGridComponent
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
priority: 5,
|
|
18
|
+
path: 'grids/async-expandable-rows-grid-example',
|
|
19
|
+
icon: 'table',
|
|
20
|
+
label: 'Asynchronous expandable rows grid',
|
|
21
|
+
parent: 'Data grid examples'
|
|
22
|
+
})
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class AsyncExpandableRowsGridExampleModule {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'c8y-expandable-row-example',
|
|
6
|
+
template: `<div id="{{ context.id }}">Context ID: {{ context.id }}</div>`,
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule]
|
|
9
|
+
})
|
|
10
|
+
export class ExpandableRowsComponent {
|
|
11
|
+
@Input() context: any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<c8y-title>Data grid examples</c8y-title>
|
|
2
|
+
|
|
3
|
+
<c8y-data-grid
|
|
4
|
+
[title]="title"
|
|
5
|
+
[columns]="columns"
|
|
6
|
+
[displayOptions]="displayOptions"
|
|
7
|
+
[rows]="data"
|
|
8
|
+
[pagination]="pagination"
|
|
9
|
+
[selectable]="selectable"
|
|
10
|
+
[expandableRows]="true"
|
|
11
|
+
(itemsSelect)="onItemsSelect($event)"
|
|
12
|
+
[actionControls]="actionControls"
|
|
13
|
+
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
14
|
+
>
|
|
15
|
+
<div *c8yExpandableRow="let context">
|
|
16
|
+
<c8y-expandable-row-example [context]="context"></c8y-expandable-row-example>
|
|
17
|
+
</div>
|
|
18
|
+
</c8y-data-grid>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { RouterModule } from '@angular/router';
|
|
3
|
+
import { ActionControl, DisplayOptions, Column, CoreModule, Pagination } from '@c8y/ngx-components';
|
|
4
|
+
import { DeviceGridModule } from '@c8y/ngx-components/device-grid';
|
|
5
|
+
import { getData } from '../client-grid-example/data';
|
|
6
|
+
import { ExpandableRowsComponent } from './expandable-rows-example.component';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'c8y-expandable-rows-grid-example',
|
|
10
|
+
templateUrl: './expandable-rows-grid-example.component.html',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [CoreModule, DeviceGridModule, RouterModule, ExpandableRowsComponent]
|
|
13
|
+
})
|
|
14
|
+
export class ExpandableRowsGridComponent implements OnInit {
|
|
15
|
+
/** This will be used as a title for the data grid. */
|
|
16
|
+
title = 'Devices';
|
|
17
|
+
|
|
18
|
+
displayOptions: DisplayOptions = {
|
|
19
|
+
bordered: false,
|
|
20
|
+
striped: true,
|
|
21
|
+
filter: true,
|
|
22
|
+
gridHeader: true,
|
|
23
|
+
hover: false
|
|
24
|
+
};
|
|
25
|
+
columns: Column[] = [
|
|
26
|
+
{
|
|
27
|
+
name: 'id',
|
|
28
|
+
header: 'ID',
|
|
29
|
+
path: 'id',
|
|
30
|
+
filterable: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'name',
|
|
34
|
+
header: 'Name',
|
|
35
|
+
path: 'name',
|
|
36
|
+
filterable: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'type',
|
|
40
|
+
header: 'Type',
|
|
41
|
+
path: 'type',
|
|
42
|
+
filterable: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'creationTime',
|
|
46
|
+
header: 'Creation time',
|
|
47
|
+
path: 'creationTime',
|
|
48
|
+
filterable: true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'lastUpdated',
|
|
52
|
+
header: 'Last updated',
|
|
53
|
+
path: 'lastUpdated',
|
|
54
|
+
filterable: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'owner',
|
|
58
|
+
header: 'Owner',
|
|
59
|
+
path: 'owner',
|
|
60
|
+
filterable: true
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
actionControls: ActionControl[] = [];
|
|
64
|
+
pagination: Pagination = {
|
|
65
|
+
pageSize: 30,
|
|
66
|
+
currentPage: 1
|
|
67
|
+
};
|
|
68
|
+
selectable = true;
|
|
69
|
+
data: any[];
|
|
70
|
+
|
|
71
|
+
ngOnInit() {
|
|
72
|
+
this.data = getData();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onItemsSelect(selectedItemIds) {
|
|
76
|
+
console.log('selected items:');
|
|
77
|
+
console.dir(selectedItemIds);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onFilter(filter) {
|
|
81
|
+
console.log('filter changed:');
|
|
82
|
+
console.log(filter);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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: 'grids/expandable-rows-grid-example',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./expandable-rows-grid-example.component').then(m => m.ExpandableRowsGridComponent)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
priority: 5,
|
|
16
|
+
path: 'grids/expandable-rows-grid-example',
|
|
17
|
+
icon: 'table',
|
|
18
|
+
label: 'Expandable rows grid',
|
|
19
|
+
parent: 'Data grid examples'
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
]
|
|
23
|
+
})
|
|
24
|
+
export class ExpandableRowsGridExampleModule {}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'c8y-sync-expandable-row-example',
|
|
6
|
+
template: `<div id="{{ context.id }}">Context ID: {{ context.id }}</div>`,
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule]
|
|
9
|
+
})
|
|
10
|
+
export class SyncExpandableRowsComponent {
|
|
11
|
+
@Input() context: any;
|
|
12
|
+
}
|
package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.html
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<c8y-title>Data grid examples - synchronous expandable rows</c8y-title>
|
|
2
|
+
|
|
3
|
+
<c8y-data-grid
|
|
4
|
+
class="content-fullpage d-flex d-col border-top border-bottom"
|
|
5
|
+
[title]="title"
|
|
6
|
+
[columns]="columns"
|
|
7
|
+
[displayOptions]="displayOptions"
|
|
8
|
+
[rows]="data"
|
|
9
|
+
[pagination]="pagination"
|
|
10
|
+
[selectable]="selectable"
|
|
11
|
+
[expandableRows]="'SYNC'"
|
|
12
|
+
(itemsSelect)="onItemsSelect($event)"
|
|
13
|
+
[actionControls]="actionControls"
|
|
14
|
+
>
|
|
15
|
+
<div *c8yExpandableRow="let context">
|
|
16
|
+
<c8y-sync-expandable-row-example [context]="context"></c8y-sync-expandable-row-example>
|
|
17
|
+
</div>
|
|
18
|
+
</c8y-data-grid>
|
package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { RouterModule } from '@angular/router';
|
|
3
|
+
import { ActionControl, DisplayOptions, Column, CoreModule, Pagination } from '@c8y/ngx-components';
|
|
4
|
+
import { DeviceGridModule } from '@c8y/ngx-components/device-grid';
|
|
5
|
+
import { getData } from '../client-grid-example/data';
|
|
6
|
+
import { SyncExpandableRowsComponent } from './sync-expandable-rows-example.component';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'c8y-sync-expandable-rows-grid-example',
|
|
10
|
+
templateUrl: './sync-expandable-rows-grid-example.component.html',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [CoreModule, DeviceGridModule, RouterModule, SyncExpandableRowsComponent]
|
|
13
|
+
})
|
|
14
|
+
export class SyncExpandableRowsGridComponent implements OnInit {
|
|
15
|
+
/** This will be used as a title for the data grid. */
|
|
16
|
+
title = 'Devices';
|
|
17
|
+
|
|
18
|
+
displayOptions: DisplayOptions = {
|
|
19
|
+
bordered: false,
|
|
20
|
+
striped: true,
|
|
21
|
+
filter: true,
|
|
22
|
+
gridHeader: true,
|
|
23
|
+
hover: false
|
|
24
|
+
};
|
|
25
|
+
columns: Column[] = [
|
|
26
|
+
{
|
|
27
|
+
name: 'id',
|
|
28
|
+
header: 'ID',
|
|
29
|
+
path: 'id',
|
|
30
|
+
filterable: true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'name',
|
|
34
|
+
header: 'Name',
|
|
35
|
+
path: 'name',
|
|
36
|
+
filterable: true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'type',
|
|
40
|
+
header: 'Type',
|
|
41
|
+
path: 'type',
|
|
42
|
+
filterable: true
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'creationTime',
|
|
46
|
+
header: 'Creation time',
|
|
47
|
+
path: 'creationTime',
|
|
48
|
+
filterable: true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'lastUpdated',
|
|
52
|
+
header: 'Last updated',
|
|
53
|
+
path: 'lastUpdated',
|
|
54
|
+
filterable: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'owner',
|
|
58
|
+
header: 'Owner',
|
|
59
|
+
path: 'owner',
|
|
60
|
+
filterable: true
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
actionControls: ActionControl[] = [];
|
|
64
|
+
pagination: Pagination = {
|
|
65
|
+
pageSize: 30,
|
|
66
|
+
currentPage: 1
|
|
67
|
+
};
|
|
68
|
+
selectable = true;
|
|
69
|
+
data: any[];
|
|
70
|
+
|
|
71
|
+
ngOnInit() {
|
|
72
|
+
this.data = getData();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onItemsSelect(selectedItemIds) {
|
|
76
|
+
console.log('selected items:');
|
|
77
|
+
console.dir(selectedItemIds);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onFilter(filter) {
|
|
81
|
+
console.log('filter changed:');
|
|
82
|
+
console.log(filter);
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.module.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
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: 'grids/sync-expandable-rows-grid-example',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./sync-expandable-rows-grid-example.component').then(
|
|
12
|
+
m => m.SyncExpandableRowsGridComponent
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
priority: 5,
|
|
18
|
+
path: 'grids/sync-expandable-rows-grid-example',
|
|
19
|
+
icon: 'table',
|
|
20
|
+
label: 'Synchronous expandable rows grid',
|
|
21
|
+
parent: 'Data grid examples'
|
|
22
|
+
})
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
export class SyncExpandableRowsGridExampleModule {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
2
|
+
import { NavigatorNode, NavigatorNodeData, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
3
|
|
|
4
4
|
export const hooks = [
|
|
5
5
|
hookRoute({
|
|
@@ -13,7 +13,7 @@ export const hooks = [
|
|
|
13
13
|
icon: 'navigation',
|
|
14
14
|
label: 'Navigator-route',
|
|
15
15
|
parent: 'Hooks'
|
|
16
|
-
})
|
|
16
|
+
} as NavigatorNodeData)
|
|
17
17
|
)
|
|
18
18
|
];
|
|
19
19
|
|
package/src/hooks/tabs/tab.ts
CHANGED
|
@@ -18,7 +18,7 @@ export class ExampleTabFactory implements TabFactory {
|
|
|
18
18
|
* but these tabs should only displayed if the URL matches
|
|
19
19
|
* something like: .../apps/tutorial-application/#/world/
|
|
20
20
|
*/
|
|
21
|
-
if (this.router.url.match(
|
|
21
|
+
if (this.router.url.match(/\/tabs/g)) {
|
|
22
22
|
/**
|
|
23
23
|
* mandatory for a Tab is the path (string) and the label (string)
|
|
24
24
|
* A click on the tab will load the given path and therefore angular loads the
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
<c8y-title>List example</c8y-title>
|
|
2
2
|
|
|
3
3
|
<c8y-list-group>
|
|
4
|
-
<c8y-li>
|
|
5
|
-
<c8y-li-checkbox (onSelect)="checkAll = $event"></c8y-li-checkbox>
|
|
6
|
-
<label>All devices</label>
|
|
7
|
-
</c8y-li>
|
|
8
|
-
<c8y-li
|
|
9
|
-
*c8yFor="let device of devices; loadMore: 'show'"
|
|
10
|
-
#li
|
|
11
|
-
>
|
|
4
|
+
<c8y-li class="page-sticky-header">
|
|
12
5
|
<c8y-li-checkbox
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(click)="$event.stopPropagation()"
|
|
6
|
+
(onSelect)="checkAll($event)"
|
|
7
|
+
[indeterminate]="isIndeterminate$ | async"
|
|
16
8
|
></c8y-li-checkbox>
|
|
17
|
-
<c8y-li-icon
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
{{ device.name || '-' }}
|
|
23
|
-
</button>
|
|
24
|
-
<c8y-li-action
|
|
25
|
-
icon="times"
|
|
26
|
-
(click)="deleteDevice(device.id)"
|
|
27
|
-
>
|
|
28
|
-
Delete
|
|
29
|
-
</c8y-li-action>
|
|
30
|
-
<c8y-li-collapse>
|
|
31
|
-
id:
|
|
32
|
-
<a [routerLink]="['/device', device.id]">{{ device.id }}</a>
|
|
33
|
-
</c8y-li-collapse>
|
|
9
|
+
<c8y-li-icon
|
|
10
|
+
[icon]="'file'"
|
|
11
|
+
style="opacity: 0"
|
|
12
|
+
></c8y-li-icon>
|
|
13
|
+
<span>Devices</span>
|
|
34
14
|
</c8y-li>
|
|
15
|
+
<ng-template
|
|
16
|
+
c8yFor
|
|
17
|
+
let-device
|
|
18
|
+
[c8yForOf]="devices"
|
|
19
|
+
[c8yForLoadMore]="'show'"
|
|
20
|
+
(c8yForChange)="itemsChange($event)"
|
|
21
|
+
>
|
|
22
|
+
<c8y-li #li>
|
|
23
|
+
<c8y-li-checkbox
|
|
24
|
+
[selected]="isSelected(device)"
|
|
25
|
+
(onSelect)="updateSelected($event, device)"
|
|
26
|
+
(click)="$event.stopPropagation()"
|
|
27
|
+
></c8y-li-checkbox>
|
|
28
|
+
<c8y-li-icon [icon]="'exchange'"></c8y-li-icon>
|
|
29
|
+
<button
|
|
30
|
+
class="btn-clean"
|
|
31
|
+
(click)="li.collapsed = !li.collapsed"
|
|
32
|
+
>
|
|
33
|
+
{{ device.name || '-' }} {{ totalLoaded }}
|
|
34
|
+
</button>
|
|
35
|
+
<c8y-li-action
|
|
36
|
+
icon="delete"
|
|
37
|
+
(click)="deleteDevice(device.id)"
|
|
38
|
+
>
|
|
39
|
+
Delete
|
|
40
|
+
</c8y-li-action>
|
|
41
|
+
<c8y-li-collapse>
|
|
42
|
+
id:
|
|
43
|
+
<a [routerLink]="['/device', device.id]">{{ device.id }}</a>
|
|
44
|
+
</c8y-li-collapse>
|
|
45
|
+
</c8y-li>
|
|
46
|
+
</ng-template>
|
|
35
47
|
</c8y-list-group>
|