@c8y/tutorial 1019.6.10 → 1019.7.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.
Files changed (46) hide show
  1. package/cumulocity.config.ts +64 -8
  2. package/package.json +6 -6
  3. package/src/__mocks/scoped-mocks/device-data-grid.ts +47 -9
  4. package/src/__mocks/utils/common.ts +24 -6
  5. package/src/__mocks/utils/grid.ts +14 -0
  6. package/src/app/app.module.ts +3 -1
  7. package/src/app-icon/app-icon-example.component.html +109 -0
  8. package/src/app-icon/app-icon-example.component.ts +56 -0
  9. package/src/app-icon/app-icon-example.module.ts +22 -0
  10. package/src/breadcrumbs/basic-example/breadcrumbs-example.component.html +23 -0
  11. package/src/breadcrumbs/basic-example/breadcrumbs-example.component.ts +13 -0
  12. package/src/breadcrumbs/basic-example/breadcrumbs-example.module.ts +23 -0
  13. package/src/breadcrumbs/breadcrumbs.module.ts +14 -0
  14. package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.html +28 -0
  15. package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.ts +13 -0
  16. package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.module.ts +25 -0
  17. package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.component.html +30 -0
  18. package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.component.ts +13 -0
  19. package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.module.ts +25 -0
  20. package/src/breadcrumbs/index.ts +5 -0
  21. package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.component.html +21 -0
  22. package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.component.ts +13 -0
  23. package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.module.ts +25 -0
  24. package/src/device-connection-status/device-connection-status-example.component.html +145 -0
  25. package/src/device-connection-status/device-connection-status-example.component.ts +61 -0
  26. package/src/device-connection-status/device-connection-status-example.module.ts +23 -0
  27. package/src/hooks/action/logout-action/logout-action.component.ts +6 -2
  28. package/src/hooks/breadcrumbs/basic-view/basic-view.component.ts +3 -1
  29. package/src/modal/confirm-modal/confirm-modal-example.component.ts +43 -54
  30. package/src/modal/confirm-modal/delete-modal-example.component.ts +73 -0
  31. package/src/modal/ngx-modal/ngx-modal-example.component.ts +73 -21
  32. package/src/modal/ngx-modal/ngx-modal-example.module.ts +1 -1
  33. package/src/modal/ngx-modal/simple-modal-example.component.ts +45 -0
  34. package/src/modal/ngx-modal-accessibility/ngx-modal-accessibility-example.component.ts +47 -0
  35. package/src/modal/ngx-modal-accessibility/ngx-modal-accessibility-example.module.ts +24 -0
  36. package/src/modal/ngx-modal-accessibility/simple-modal-accessibility-example.component.ts +49 -0
  37. package/src/modal/ngx-modal-selectors/ngx-modal-selectors-example.component.ts +47 -0
  38. package/src/modal/ngx-modal-selectors/ngx-modal-selectors-example.module.ts +24 -0
  39. package/src/modal/ngx-modal-selectors/simple-modal-example-with-content-selectors.component.ts +72 -0
  40. package/src/modal/ngx-modal-sizes/large-modal-example.component.ts +45 -0
  41. package/src/modal/ngx-modal-sizes/medium-modal-example.component.ts +45 -0
  42. package/src/modal/ngx-modal-sizes/ngx-modal-sizes-example.component.ts +66 -0
  43. package/src/modal/ngx-modal-sizes/ngx-modal-sizes-example.module.ts +22 -0
  44. package/src/modal/ngx-modal-sizes/small-modal-example.component.ts +49 -0
  45. package/src/modal/simple-modal/modal-example.component.ts +0 -34
  46. package/src/modal/simple-modal/modal.example.module.ts +0 -21
@@ -1,34 +1,86 @@
1
1
  import { Component, TemplateRef } from '@angular/core';
2
2
  import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
3
+ import {
4
+ C8yTranslateModule,
5
+ FormsModule,
6
+ HeaderModule,
7
+ ModalLabels,
8
+ ModalModule,
9
+ CoreModule
10
+ } from '@c8y/ngx-components';
11
+ import { SimpleModalExampleComponent } from './simple-modal-example.component';
3
12
 
4
13
  @Component({
5
- selector: 'ngx-modal-example',
6
- template: `<button class="btn btn-primary" type="button" (click)="openModal(template)">
7
- Create template modal
8
- </button>
9
-
14
+ selector: 'tut-ngx-modal',
15
+ template: `<div class="p-t-24">
16
+ <c8y-title>ngx-bootstrap modal example</c8y-title>
17
+ <div class="p-b-24 text-center">
18
+ <button class="btn btn-default" type="button" (click)="openTemplateModal(template)">
19
+ Modal with <code>TemplateRef</code>
20
+ </button>
21
+ </div>
22
+ <div class="p-b-24 text-center">
23
+ <button class="btn btn-default" type="button" (click)="openC8yComponentModal()">
24
+ Modal with <code>c8y-modal</code>
25
+ </button>
26
+ </div>
10
27
  <ng-template #template>
11
- <div class="modal-header">
12
- <h4 class="modal-title pull-left">Modal</h4>
13
- <button
14
- class="btn-close close pull-right"
15
- aria-label="Close"
16
- type="button"
17
- (click)="modalRef?.hide()"
18
- >
19
- <span class="visually-hidden" aria-hidden="true">&times;</span>
20
- </button>
21
- </div>
22
- <div class="modal-body">This is a modal.</div>
23
- </ng-template>`,
28
+ <c8y-modal
29
+ title="Export documents"
30
+ (onClose)="onTemplateRefClose($event)"
31
+ (onDismiss)="onTemplateRefDismiss($event)"
32
+ [labels]="labels"
33
+ [disabled]="true"
34
+ >
35
+ <c8y-list-group>
36
+ <c8y-li *ngFor="let a of listArray; let index = index">
37
+ <c8y-li-checkbox></c8y-li-checkbox>
38
+ <c8y-li-icon icon="file"></c8y-li-icon>
39
+ Document {{ index + 1 }}
40
+ </c8y-li>
41
+ </c8y-list-group>
42
+ </c8y-modal>
43
+ </ng-template>
44
+ </div>`,
24
45
  standalone: true,
25
- imports: []
46
+ imports: [
47
+ SimpleModalExampleComponent,
48
+ HeaderModule,
49
+ C8yTranslateModule,
50
+ FormsModule,
51
+ ModalModule,
52
+ CoreModule
53
+ ]
26
54
  })
27
55
  export class NgxModalExampleComponent {
28
56
  modalRef?: BsModalRef;
57
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
58
+ listArray = new Array(12);
29
59
  constructor(private modalService: BsModalService) {}
30
60
 
31
- openModal(template: TemplateRef<any>) {
32
- this.modalRef = this.modalService.show(template);
61
+ onTemplateRefDismiss(_) {
62
+ // eslint-disable-next-line no-console
63
+ console.log('On "Cancel" clicked');
64
+ this.modalRef.hide();
65
+ }
66
+
67
+ onTemplateRefClose(_) {
68
+ // eslint-disable-next-line no-console
69
+ console.log('On "Export" clicked');
70
+ this.modalRef.hide();
71
+ }
72
+
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ openTemplateModal(template: TemplateRef<any>) {
75
+ this.modalRef = this.modalService.show(template, { ignoreBackdropClick: true });
76
+ }
77
+
78
+ openC8yComponentModal(size: 'modal-sm' | 'modal-md' | 'modal-lg' = 'modal-md') {
79
+ this.modalService.show(SimpleModalExampleComponent, {
80
+ class: size,
81
+ ariaDescribedby: 'modal-body',
82
+ ariaLabelledBy: 'modal-title',
83
+ ignoreBackdropClick: true
84
+ }).content as SimpleModalExampleComponent;
33
85
  }
34
86
  }
@@ -13,7 +13,7 @@ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
13
13
  label: 'Ngx modal',
14
14
  path: '/modal/ngx-modal',
15
15
  icon: 'list-alt',
16
- priority: 10,
16
+ priority: 30,
17
17
  parent: 'Modal'
18
18
  })
19
19
  )
@@ -0,0 +1,45 @@
1
+ import { Component } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ ModalLabels,
7
+ ModalModule,
8
+ CoreModule
9
+ } from '@c8y/ngx-components';
10
+
11
+ @Component({
12
+ selector: 'tut-simple-modal',
13
+ template: `
14
+ <c8y-modal
15
+ title="Export documents"
16
+ (onClose)="onClose($event)"
17
+ (onDismiss)="onDismiss($event)"
18
+ [labels]="labels"
19
+ [disabled]="true"
20
+ >
21
+ <c8y-list-group>
22
+ <c8y-li *ngFor="let a of listArray; let index = index">
23
+ <c8y-li-checkbox></c8y-li-checkbox>
24
+ <c8y-li-icon icon="file"></c8y-li-icon>
25
+ Document {{ index + 1 }}
26
+ </c8y-li>
27
+ </c8y-list-group>
28
+ </c8y-modal>
29
+ `,
30
+ standalone: true,
31
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, CoreModule]
32
+ })
33
+ export class SimpleModalExampleComponent {
34
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
35
+ listArray = new Array(12);
36
+ onDismiss(_) {
37
+ // eslint-disable-next-line no-console
38
+ console.log('On "Cancel" clicked');
39
+ }
40
+
41
+ onClose(_) {
42
+ // eslint-disable-next-line no-console
43
+ console.log('On "Export" clicked');
44
+ }
45
+ }
@@ -0,0 +1,47 @@
1
+ import { Component } from '@angular/core';
2
+ import { BsModalService } from 'ngx-bootstrap/modal';
3
+ import {
4
+ C8yTranslateModule,
5
+ CoreModule,
6
+ FormsModule,
7
+ HeaderModule,
8
+ ModalModule
9
+ } from '@c8y/ngx-components';
10
+ import { SimpleModalAccessibilityExampleComponent } from './simple-modal-accessibility-example.component';
11
+
12
+ @Component({
13
+ selector: 'tut-ngx-modal-accessibility',
14
+ template: `<div>
15
+ <c8y-title>ngx-bootstrap modal example with custom ids</c8y-title>
16
+ <div class="p-t-24 p-b-24 text-center">
17
+ <button
18
+ class="btn btn-default m-8"
19
+ type="button"
20
+ (click)="openComponentModalWithContentSelectors()"
21
+ >
22
+ Create component modal with with ModalComponent and custom ids
23
+ </button>
24
+ </div>
25
+ </div>`,
26
+ standalone: true,
27
+ imports: [
28
+ HeaderModule,
29
+ SimpleModalAccessibilityExampleComponent,
30
+ C8yTranslateModule,
31
+ FormsModule,
32
+ ModalModule,
33
+ CoreModule
34
+ ]
35
+ })
36
+ export class NgxModalAccessibilityExampleComponent {
37
+ constructor(private modalService: BsModalService) {}
38
+
39
+ openComponentModalWithContentSelectors() {
40
+ this.modalService.show(SimpleModalAccessibilityExampleComponent, {
41
+ class: 'modal-sm',
42
+ ariaDescribedby: 'modal-body-custom',
43
+ ariaLabelledBy: 'modal-title-custom',
44
+ ignoreBackdropClick: true
45
+ }).content as SimpleModalAccessibilityExampleComponent;
46
+ }
47
+ }
@@ -0,0 +1,24 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+
4
+ @NgModule({
5
+ providers: [
6
+ hookRoute({
7
+ path: 'modal/ngx-modal-accessibility',
8
+ loadComponent: () =>
9
+ import('./ngx-modal-accessibility-example.component').then(
10
+ m => m.NgxModalAccessibilityExampleComponent
11
+ )
12
+ }),
13
+ hookNavigator(
14
+ new NavigatorNode({
15
+ label: 'Ngx modal accessibility',
16
+ path: '/modal/ngx-modal-accessibility',
17
+ icon: 'list-alt',
18
+ priority: 10,
19
+ parent: 'Modal'
20
+ })
21
+ )
22
+ ]
23
+ })
24
+ export class NgxModalAccessibilityExampleModule {}
@@ -0,0 +1,49 @@
1
+ import { Component } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ ListGroupModule,
7
+ ModalLabels,
8
+ ModalModule
9
+ } from '@c8y/ngx-components';
10
+
11
+ @Component({
12
+ selector: 'tut-simple-modal-with-selectors',
13
+ template: `
14
+ <c8y-modal
15
+ (onClose)="onClose($event)"
16
+ (onDismiss)="onDismiss($event)"
17
+ [labels]="labels"
18
+ [headerClasses]="'dialog-header'"
19
+ [disabled]="true"
20
+ >
21
+ <ng-container c8y-modal-title>
22
+ <span [c8yIcon]="'export'"></span>
23
+ <div class="modal-title" id="modal-title-custom">Export documents</div>
24
+ </ng-container>
25
+ <c8y-list-group id="modal-body-custom">
26
+ <c8y-li *ngFor="let a of listArray; let index = index">
27
+ <c8y-li-checkbox></c8y-li-checkbox>
28
+ <c8y-li-icon icon="file"></c8y-li-icon>
29
+ Document {{ index + 1 }}
30
+ </c8y-li>
31
+ </c8y-list-group>
32
+ </c8y-modal>
33
+ `,
34
+ standalone: true,
35
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, ListGroupModule]
36
+ })
37
+ export class SimpleModalAccessibilityExampleComponent {
38
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
39
+ listArray = new Array(12);
40
+ onDismiss(_) {
41
+ // eslint-disable-next-line no-console
42
+ console.log('On "Cancel" clicked');
43
+ }
44
+
45
+ onClose(_) {
46
+ // eslint-disable-next-line no-console
47
+ console.log('On "Export" clicked');
48
+ }
49
+ }
@@ -0,0 +1,47 @@
1
+ import { Component } from '@angular/core';
2
+ import { BsModalService } from 'ngx-bootstrap/modal';
3
+ import {
4
+ C8yTranslateModule,
5
+ CoreModule,
6
+ FormsModule,
7
+ HeaderModule,
8
+ ModalModule
9
+ } from '@c8y/ngx-components';
10
+ import { SimpleModalExampleWithContentSelectorsComponent } from './simple-modal-example-with-content-selectors.component';
11
+
12
+ @Component({
13
+ selector: 'tut-ngx-modal-selectors',
14
+ template: `<div>
15
+ <c8y-title>ngx-bootstrap modal example with ng-content selectors</c8y-title>
16
+ <div class="p-t-24 p-b-24 text-center">
17
+ <button
18
+ class="btn btn-default m-8"
19
+ type="button"
20
+ (click)="openComponentModalWithContentSelectors()"
21
+ >
22
+ Modal with <code>c8y-modal</code> and <code>ng-content</code> selectors
23
+ </button>
24
+ </div>
25
+ </div>`,
26
+ standalone: true,
27
+ imports: [
28
+ HeaderModule,
29
+ SimpleModalExampleWithContentSelectorsComponent,
30
+ C8yTranslateModule,
31
+ FormsModule,
32
+ ModalModule,
33
+ CoreModule
34
+ ]
35
+ })
36
+ export class NgxModalSelectorsExampleComponent {
37
+ constructor(private modalService: BsModalService) {}
38
+
39
+ openComponentModalWithContentSelectors() {
40
+ this.modalService.show(SimpleModalExampleWithContentSelectorsComponent, {
41
+ class: 'modal-sm',
42
+ ariaDescribedby: 'modal-body',
43
+ ariaLabelledBy: 'modal-title',
44
+ ignoreBackdropClick: true
45
+ }).content as SimpleModalExampleWithContentSelectorsComponent;
46
+ }
47
+ }
@@ -0,0 +1,24 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+
4
+ @NgModule({
5
+ providers: [
6
+ hookRoute({
7
+ path: 'modal/ngx-modal-selectors',
8
+ loadComponent: () =>
9
+ import('./ngx-modal-selectors-example.component').then(
10
+ m => m.NgxModalSelectorsExampleComponent
11
+ )
12
+ }),
13
+ hookNavigator(
14
+ new NavigatorNode({
15
+ label: 'Ngx modal selectors',
16
+ path: '/modal/ngx-modal-selectors',
17
+ icon: 'list-alt',
18
+ priority: 10,
19
+ parent: 'Modal'
20
+ })
21
+ )
22
+ ]
23
+ })
24
+ export class NgxModalSelectorsExampleModule {}
@@ -0,0 +1,72 @@
1
+ import { Component, ViewChild } from '@angular/core';
2
+ import { CommonModule, FormsModule, HeaderModule, ModalModule } from '@c8y/ngx-components';
3
+
4
+ @Component({
5
+ selector: 'tut-simple-modal-with-selectors',
6
+ template: `
7
+ <c8y-modal
8
+ title="Create smart group"
9
+ [headerClasses]="'dialog-header'"
10
+ [customFooter]="true"
11
+ #modal
12
+ >
13
+ <ng-container c8y-modal-title>
14
+ <span [c8yIcon]="'c8y-group-smart'"></span>
15
+ </ng-container>
16
+
17
+ <form class="p-24" #createSmartGroup="ngForm" c8y-modal-body>
18
+ <c8y-form-group>
19
+ <label for="name" translate> Smart group name </label>
20
+ <input
21
+ class="form-control"
22
+ id="name"
23
+ placeholder="{{ 'e.g. My smart group' }}"
24
+ name="name"
25
+ type="text"
26
+ autocomplete="off"
27
+ required
28
+ [(ngModel)]="smartGroup.name"
29
+ />
30
+ </c8y-form-group>
31
+ </form>
32
+
33
+ <div class="modal-footer" c8y-modal-footer-custom>
34
+ <button class="btn btn-default" (click)="onCustomFooterCancel()">
35
+ {{ 'Cancel' }}
36
+ </button>
37
+ <button
38
+ class="btn btn-primary"
39
+ (click)="onCustomFooterContinue()"
40
+ [disabled]="createSmartGroup.form.invalid || pending"
41
+ [ngClass]="{ 'btn-pending': pending }"
42
+ >
43
+ {{ 'Continue' }}
44
+ </button>
45
+ </div>
46
+ </c8y-modal>
47
+ `,
48
+ standalone: true,
49
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule]
50
+ })
51
+ export class SimpleModalExampleWithContentSelectorsComponent {
52
+ smartGroup = {
53
+ name: ''
54
+ };
55
+ pending = false;
56
+
57
+ @ViewChild('modal', { static: false }) private modal;
58
+
59
+ onCustomFooterCancel(): void {
60
+ console.log('On custom footer Cancel');
61
+ this.modal._dismiss();
62
+ }
63
+
64
+ onCustomFooterContinue(): void {
65
+ this.pending = true;
66
+ console.log('On custom footer Continue');
67
+ setTimeout(() => {
68
+ this.modal._dismiss();
69
+ this.pending = false;
70
+ }, 1000);
71
+ }
72
+ }
@@ -0,0 +1,45 @@
1
+ import { Component } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ ModalLabels,
7
+ ModalModule,
8
+ CoreModule
9
+ } from '@c8y/ngx-components';
10
+
11
+ @Component({
12
+ selector: 'tut-simple-modal',
13
+ template: `
14
+ <c8y-modal
15
+ title="Export documents"
16
+ (onClose)="onClose($event)"
17
+ (onDismiss)="onDismiss($event)"
18
+ [labels]="labels"
19
+ [disabled]="true"
20
+ >
21
+ <c8y-list-group>
22
+ <c8y-li *ngFor="let a of listArray; let index = index">
23
+ <c8y-li-checkbox></c8y-li-checkbox>
24
+ <c8y-li-icon icon="file"></c8y-li-icon>
25
+ Document {{ index + 1 }}
26
+ </c8y-li>
27
+ </c8y-list-group>
28
+ </c8y-modal>
29
+ `,
30
+ standalone: true,
31
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, CoreModule]
32
+ })
33
+ export class LargeModalExampleComponent {
34
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
35
+ listArray = new Array(12);
36
+ onDismiss(_) {
37
+ // eslint-disable-next-line no-console
38
+ console.log('On "Cancel" clicked');
39
+ }
40
+
41
+ onClose(_) {
42
+ // eslint-disable-next-line no-console
43
+ console.log('On "Export" clicked');
44
+ }
45
+ }
@@ -0,0 +1,45 @@
1
+ import { Component } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ ModalLabels,
7
+ ModalModule,
8
+ CoreModule
9
+ } from '@c8y/ngx-components';
10
+
11
+ @Component({
12
+ selector: 'tut-simple-modal',
13
+ template: `
14
+ <c8y-modal
15
+ title="Export documents"
16
+ (onClose)="onClose($event)"
17
+ (onDismiss)="onDismiss($event)"
18
+ [labels]="labels"
19
+ [disabled]="true"
20
+ >
21
+ <c8y-list-group>
22
+ <c8y-li *ngFor="let a of listArray; let index = index">
23
+ <c8y-li-checkbox></c8y-li-checkbox>
24
+ <c8y-li-icon icon="file"></c8y-li-icon>
25
+ Document {{ index + 1 }}
26
+ </c8y-li>
27
+ </c8y-list-group>
28
+ </c8y-modal>
29
+ `,
30
+ standalone: true,
31
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, CoreModule]
32
+ })
33
+ export class MediumModalExampleComponent {
34
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
35
+ listArray = new Array(12);
36
+ onDismiss(_) {
37
+ // eslint-disable-next-line no-console
38
+ console.log('On "Cancel" clicked');
39
+ }
40
+
41
+ onClose(_) {
42
+ // eslint-disable-next-line no-console
43
+ console.log('On "Export" clicked');
44
+ }
45
+ }
@@ -0,0 +1,66 @@
1
+ import { Component } from '@angular/core';
2
+ import { BsModalService } from 'ngx-bootstrap/modal';
3
+ import {
4
+ C8yTranslateModule,
5
+ CoreModule,
6
+ FormsModule,
7
+ HeaderModule,
8
+ ModalModule
9
+ } from '@c8y/ngx-components';
10
+ import { SmallModalExampleComponent } from './small-modal-example.component';
11
+ import { MediumModalExampleComponent } from './medium-modal-example.component';
12
+ import { LargeModalExampleComponent } from './large-modal-example.component';
13
+
14
+ @Component({
15
+ selector: 'tut-ngx-modal-sizes',
16
+ template: `<div>
17
+ <c8y-title>ngx-bootstrap modal sizes example</c8y-title>
18
+ <div class="p-t-24 p-b-24 text-center">
19
+ <button class="btn btn-default m-8" type="button" (click)="openModalSm()">
20
+ Modal with size <code>modal-sm</code>
21
+ </button>
22
+ </div>
23
+ <div class="p-b-24 text-center">
24
+ <button class="btn btn-default m-8" type="button" (click)="openModalMd()">
25
+ Modal with size <code>modal-md</code>
26
+ </button>
27
+ </div>
28
+ <div class="p-b-24 text-center">
29
+ <button class="btn btn-default m-8" type="button" (click)="openModalLg()">
30
+ Modal with size <code>modal-lg</code>
31
+ </button>
32
+ </div>
33
+ </div>`,
34
+ standalone: true,
35
+ imports: [HeaderModule, C8yTranslateModule, FormsModule, ModalModule, CoreModule]
36
+ })
37
+ export class NgxModalSizesExampleComponent {
38
+ constructor(private modalService: BsModalService) {}
39
+
40
+ openModalSm() {
41
+ this.modalService.show(SmallModalExampleComponent, {
42
+ class: 'modal-sm',
43
+ ariaDescribedby: 'modal-body',
44
+ ariaLabelledBy: 'modal-title',
45
+ ignoreBackdropClick: true
46
+ }).content as SmallModalExampleComponent;
47
+ }
48
+
49
+ openModalMd() {
50
+ this.modalService.show(MediumModalExampleComponent, {
51
+ class: 'modal-md',
52
+ ariaDescribedby: 'modal-body',
53
+ ariaLabelledBy: 'modal-title',
54
+ ignoreBackdropClick: true
55
+ }).content as MediumModalExampleComponent;
56
+ }
57
+
58
+ openModalLg() {
59
+ this.modalService.show(LargeModalExampleComponent, {
60
+ class: 'modal-lg',
61
+ ariaDescribedby: 'modal-body',
62
+ ariaLabelledBy: 'modal-title',
63
+ ignoreBackdropClick: true
64
+ }).content as LargeModalExampleComponent;
65
+ }
66
+ }
@@ -0,0 +1,22 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
3
+
4
+ @NgModule({
5
+ providers: [
6
+ hookRoute({
7
+ path: 'modal/ngx-modal-sizes',
8
+ loadComponent: () =>
9
+ import('./ngx-modal-sizes-example.component').then(m => m.NgxModalSizesExampleComponent)
10
+ }),
11
+ hookNavigator(
12
+ new NavigatorNode({
13
+ label: 'Ngx modal sizes',
14
+ path: '/modal/ngx-modal-sizes',
15
+ icon: 'list-alt',
16
+ priority: 20,
17
+ parent: 'Modal'
18
+ })
19
+ )
20
+ ]
21
+ })
22
+ export class NgxModalSizesExampleModule {}
@@ -0,0 +1,49 @@
1
+ import { Component } from '@angular/core';
2
+ import {
3
+ CommonModule,
4
+ FormsModule,
5
+ HeaderModule,
6
+ ModalLabels,
7
+ ModalModule,
8
+ CoreModule
9
+ } from '@c8y/ngx-components';
10
+
11
+ @Component({
12
+ selector: 'tut-simple-modal',
13
+ template: `
14
+ <c8y-modal
15
+ title="Export documents"
16
+ (onClose)="onClose($event)"
17
+ (onDismiss)="onDismiss($event)"
18
+ [labels]="labels"
19
+ [headerClasses]="'dialog-header'"
20
+ [disabled]="true"
21
+ >
22
+ <ng-container c8y-modal-title>
23
+ <span [c8yIcon]="'export'"></span>
24
+ </ng-container>
25
+ <c8y-list-group>
26
+ <c8y-li *ngFor="let a of listArray; let index = index">
27
+ <c8y-li-checkbox></c8y-li-checkbox>
28
+ <c8y-li-icon icon="file"></c8y-li-icon>
29
+ Document {{ index + 1 }}
30
+ </c8y-li>
31
+ </c8y-list-group>
32
+ </c8y-modal>
33
+ `,
34
+ standalone: true,
35
+ imports: [ModalModule, HeaderModule, CommonModule, FormsModule, CoreModule]
36
+ })
37
+ export class SmallModalExampleComponent {
38
+ labels: ModalLabels = { ok: 'Export', cancel: 'Cancel' };
39
+ listArray = new Array(12);
40
+ onDismiss(_) {
41
+ // eslint-disable-next-line no-console
42
+ console.log('On "Cancel" clicked');
43
+ }
44
+
45
+ onClose(_) {
46
+ // eslint-disable-next-line no-console
47
+ console.log('On "Export" clicked');
48
+ }
49
+ }