angular-dumb-lib 0.0.6 → 0.0.9

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 (122) hide show
  1. package/esm2022/angular-dumb-lib.mjs +5 -0
  2. package/esm2022/lib/angular-dumb-lib.component.mjs +20 -0
  3. package/esm2022/lib/angular-dumb-lib.module.mjs +22 -0
  4. package/esm2022/lib/angular-dumb-lib.service.mjs +15 -0
  5. package/esm2022/lib/components/atoms/button/button.component.mjs +34 -0
  6. package/esm2022/lib/components/atoms/datetime-picker/datetime-picker.component.mjs +58 -0
  7. package/esm2022/lib/components/atoms/file-selection/file-selection.component.mjs +85 -0
  8. package/esm2022/lib/components/atoms/input/input.component.mjs +57 -0
  9. package/esm2022/lib/components/atoms/loading/loading.component.mjs +25 -0
  10. package/esm2022/lib/components/atoms/selection/selection.component.mjs +92 -0
  11. package/esm2022/lib/components/atoms/slider/slider.component.mjs +42 -0
  12. package/esm2022/lib/components/atoms/tags/tags.component.mjs +62 -0
  13. package/esm2022/lib/components/molecules/cards/cards.component.mjs +22 -0
  14. package/esm2022/lib/components/molecules/content-design/content-design.component.mjs +32 -0
  15. package/esm2022/lib/components/molecules/form/form.component.mjs +71 -0
  16. package/esm2022/lib/components/molecules/modal/modal.component.mjs +45 -0
  17. package/esm2022/lib/components/molecules/paginator/paginator.component.mjs +118 -0
  18. package/esm2022/lib/components/molecules/table/table.component.mjs +51 -0
  19. package/esm2022/lib/components/pages/footer/footer.component.mjs +15 -0
  20. package/esm2022/lib/components/pages/login/login.component.mjs +31 -0
  21. package/esm2022/lib/components/pages/menu/menu.component.mjs +31 -0
  22. package/esm2022/lib/components/pages/version/version.component.mjs +26 -0
  23. package/esm2022/lib/shared/constants/constant.mjs +6 -0
  24. package/esm2022/lib/shared/enums/enum.mjs +69 -0
  25. package/esm2022/lib/shared/interfaces/interface.mjs +2 -0
  26. package/esm2022/public-api.mjs +25 -0
  27. package/fesm2022/angular-dumb-lib.mjs +915 -0
  28. package/fesm2022/angular-dumb-lib.mjs.map +1 -0
  29. package/index.d.ts +5 -0
  30. package/lib/angular-dumb-lib.component.d.ts +5 -0
  31. package/lib/angular-dumb-lib.module.d.ts +7 -0
  32. package/lib/angular-dumb-lib.service.d.ts +6 -0
  33. package/lib/components/atoms/button/button.component.d.ts +12 -0
  34. package/lib/components/atoms/datetime-picker/datetime-picker.component.d.ts +17 -0
  35. package/lib/components/atoms/file-selection/file-selection.component.d.ts +25 -0
  36. package/lib/components/atoms/input/input.component.d.ts +19 -0
  37. package/lib/components/atoms/loading/loading.component.d.ts +11 -0
  38. package/lib/components/atoms/selection/selection.component.d.ts +28 -0
  39. package/lib/components/atoms/slider/slider.component.d.ts +14 -0
  40. package/lib/components/atoms/tags/tags.component.d.ts +19 -0
  41. package/lib/components/molecules/cards/cards.component.d.ts +10 -0
  42. package/lib/components/molecules/content-design/content-design.component.d.ts +12 -0
  43. package/lib/components/molecules/form/form.component.d.ts +23 -0
  44. package/lib/components/molecules/modal/modal.component.d.ts +17 -0
  45. package/lib/components/molecules/paginator/paginator.component.d.ts +29 -0
  46. package/lib/components/molecules/table/table.component.d.ts +20 -0
  47. package/lib/components/pages/footer/footer.component.d.ts +8 -0
  48. package/lib/components/pages/login/login.component.d.ts +11 -0
  49. package/lib/components/pages/menu/menu.component.d.ts +14 -0
  50. package/lib/components/pages/version/version.component.d.ts +10 -0
  51. package/lib/shared/constants/constant.d.ts +3 -0
  52. package/lib/shared/enums/enum.d.ts +59 -0
  53. package/lib/shared/interfaces/interface.d.ts +58 -0
  54. package/package.json +16 -3
  55. package/public-api.d.ts +21 -0
  56. package/ng-package.json +0 -7
  57. package/src/lib/angular-dumb-lib.component.spec.ts +0 -21
  58. package/src/lib/angular-dumb-lib.component.ts +0 -15
  59. package/src/lib/angular-dumb-lib.module.ts +0 -19
  60. package/src/lib/angular-dumb-lib.service.spec.ts +0 -16
  61. package/src/lib/angular-dumb-lib.service.ts +0 -9
  62. package/src/lib/components/atoms/button/button.component.html +0 -15
  63. package/src/lib/components/atoms/button/button.component.scss +0 -76
  64. package/src/lib/components/atoms/button/button.component.ts +0 -33
  65. package/src/lib/components/atoms/datetime-picker/datetime-picker.component.html +0 -7
  66. package/src/lib/components/atoms/datetime-picker/datetime-picker.component.scss +0 -24
  67. package/src/lib/components/atoms/datetime-picker/datetime-picker.component.ts +0 -59
  68. package/src/lib/components/atoms/file-selection/file-selection.component.html +0 -24
  69. package/src/lib/components/atoms/file-selection/file-selection.component.scss +0 -35
  70. package/src/lib/components/atoms/file-selection/file-selection.component.ts +0 -86
  71. package/src/lib/components/atoms/input/input.component.html +0 -28
  72. package/src/lib/components/atoms/input/input.component.scss +0 -64
  73. package/src/lib/components/atoms/input/input.component.ts +0 -57
  74. package/src/lib/components/atoms/loading/loading.component.html +0 -3
  75. package/src/lib/components/atoms/loading/loading.component.scss +0 -36
  76. package/src/lib/components/atoms/loading/loading.component.ts +0 -21
  77. package/src/lib/components/atoms/selection/selection.component.html +0 -38
  78. package/src/lib/components/atoms/selection/selection.component.scss +0 -65
  79. package/src/lib/components/atoms/selection/selection.component.ts +0 -84
  80. package/src/lib/components/atoms/slider/slider.component.html +0 -14
  81. package/src/lib/components/atoms/slider/slider.component.scss +0 -50
  82. package/src/lib/components/atoms/slider/slider.component.ts +0 -37
  83. package/src/lib/components/atoms/tags/tags.component.html +0 -25
  84. package/src/lib/components/atoms/tags/tags.component.scss +0 -58
  85. package/src/lib/components/atoms/tags/tags.component.ts +0 -62
  86. package/src/lib/components/molecules/cards/cards.component.html +0 -12
  87. package/src/lib/components/molecules/cards/cards.component.scss +0 -14
  88. package/src/lib/components/molecules/cards/cards.component.ts +0 -19
  89. package/src/lib/components/molecules/content-design/content-design.component.html +0 -14
  90. package/src/lib/components/molecules/content-design/content-design.component.scss +0 -68
  91. package/src/lib/components/molecules/content-design/content-design.component.ts +0 -32
  92. package/src/lib/components/molecules/form/form.component.html +0 -22
  93. package/src/lib/components/molecules/form/form.component.scss +0 -17
  94. package/src/lib/components/molecules/form/form.component.ts +0 -64
  95. package/src/lib/components/molecules/modal/modal.component.html +0 -16
  96. package/src/lib/components/molecules/modal/modal.component.scss +0 -83
  97. package/src/lib/components/molecules/modal/modal.component.ts +0 -48
  98. package/src/lib/components/molecules/paginator/paginator.component.html +0 -25
  99. package/src/lib/components/molecules/paginator/paginator.component.scss +0 -27
  100. package/src/lib/components/molecules/paginator/paginator.component.ts +0 -126
  101. package/src/lib/components/molecules/table/table.component.html +0 -45
  102. package/src/lib/components/molecules/table/table.component.scss +0 -169
  103. package/src/lib/components/molecules/table/table.component.ts +0 -40
  104. package/src/lib/components/pages/footer/footer.component.html +0 -32
  105. package/src/lib/components/pages/footer/footer.component.scss +0 -69
  106. package/src/lib/components/pages/footer/footer.component.ts +0 -16
  107. package/src/lib/components/pages/login/login.component.html +0 -10
  108. package/src/lib/components/pages/login/login.component.scss +0 -32
  109. package/src/lib/components/pages/login/login.component.ts +0 -32
  110. package/src/lib/components/pages/menu/menu.component.html +0 -18
  111. package/src/lib/components/pages/menu/menu.component.scss +0 -87
  112. package/src/lib/components/pages/menu/menu.component.ts +0 -26
  113. package/src/lib/components/pages/version/version.component.html +0 -3
  114. package/src/lib/components/pages/version/version.component.scss +0 -0
  115. package/src/lib/components/pages/version/version.component.ts +0 -28
  116. package/src/lib/shared/constants/constant.ts +0 -7
  117. package/src/lib/shared/enums/enum.ts +0 -68
  118. package/src/lib/shared/interfaces/interface.ts +0 -64
  119. package/src/public-api.ts +0 -10
  120. package/tsconfig.lib.json +0 -14
  121. package/tsconfig.lib.prod.json +0 -10
  122. package/tsconfig.spec.json +0 -14
@@ -1,68 +0,0 @@
1
- .content-designer {
2
- display: flex;
3
- gap: 20px;
4
- flex-wrap: wrap;
5
- justify-content: space-between;
6
- align-items: center;
7
- text-align: center;
8
-
9
- img {
10
- max-width: 100%;
11
- height: auto;
12
- }
13
-
14
- .content {
15
- p {
16
- text-align: justify;
17
- }
18
- }
19
-
20
- // Common styles for left and right layouts
21
- &.left,
22
- &.right {
23
- flex-direction: row;
24
- .image,
25
- .content {
26
- flex: 1;
27
- width: 50%;
28
- padding: 0 20px;
29
- }
30
- .content {
31
- text-align: justify;
32
- }
33
- .image {
34
- display: flex;
35
- }
36
- }
37
-
38
- // Specific override for left layout
39
- &.left {
40
- flex-direction: row-reverse;
41
- .image {
42
- justify-content: end;
43
- }
44
- }
45
-
46
- &.right {
47
- .image {
48
- justify-content: start;
49
- }
50
- }
51
-
52
-
53
- // Common styles for up and down layouts
54
- &.up,
55
- &.down {
56
- flex-direction: column;
57
-
58
- .image {
59
- width: 100%;
60
- justify-content: center;
61
- }
62
- }
63
-
64
- // Specific override for up layout
65
- &.up {
66
- flex-direction: column-reverse;
67
- }
68
- }
@@ -1,32 +0,0 @@
1
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
2
- import { IContentDesign } from '../../../shared/interfaces/interface';
3
- import { ContentDirection } from '../../../shared/enums/enum';
4
- import { ButtonComponent } from '../../atoms/button/button.component';
5
- import { CommonModule } from '@angular/common';
6
-
7
- @Component({
8
- selector: 'app-content-design',
9
- standalone: true,
10
- templateUrl: './content-design.component.html',
11
- styleUrls: ['./content-design.component.scss'],
12
- imports: [CommonModule, ButtonComponent]
13
- })
14
- export class ContentDesignComponent implements OnInit {
15
- @Input() content!: IContentDesign;
16
-
17
- @Output() clickEvent = new EventEmitter<void>();
18
-
19
- constructor(
20
- ) { }
21
-
22
- ngOnInit() {
23
- this.content = {
24
- contentDirection: ContentDirection.left,
25
- ...this.content,
26
- }
27
- }
28
-
29
- onButtonClick() {
30
- this.clickEvent.emit();
31
- }
32
- }
@@ -1,22 +0,0 @@
1
- <form (ngSubmit)="onSubmit()" #form="ngForm" [formGroup]="formGroup">
2
- <ng-container *ngFor="let inputConfig of inputConfigs">
3
- <app-input *ngIf="checkFormConfigType(inputConfig.type) === 'textual'"
4
- [formControlName]="inputConfig.name"
5
- [config]="inputConfig"
6
- [required]="inputConfig.required"></app-input>
7
-
8
- <app-selection *ngIf="checkFormConfigType(inputConfig.type) === 'selection'"
9
- [formControlName]="inputConfig.name"
10
- [label]="inputConfig.label?? ''"
11
- [options]= "inputConfig.options">
12
- </app-selection>
13
-
14
- <app-file-selection
15
- [formControlName]="inputConfig.name"
16
- *ngIf="checkFormConfigType(inputConfig.type) === 'file'"
17
- [label]="inputConfig.name ">
18
- </app-file-selection>
19
- </ng-container>
20
-
21
- <app-button [config]="buttonConfig"></app-button>
22
- </form>
@@ -1,17 +0,0 @@
1
- form {
2
- display: flex;
3
- flex-direction: column;
4
- gap: 15px;
5
- }
6
-
7
- label {
8
- display: block;
9
- margin-bottom: 0.5rem;
10
- }
11
-
12
- input, textarea {
13
- width: 100%;
14
- padding: 0.5rem;
15
- border: 1px solid #ccc;
16
- border-radius: 0.25rem;
17
- }
@@ -1,64 +0,0 @@
1
- import { Component, EventEmitter, Input, Output } from '@angular/core';
2
- import { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
3
- import { InputGroupType, InputType } from '../../../shared/enums/enum';
4
- import { selectionInputTypes, textualInputTypes } from '../../../shared/constants/constant';
5
- import { CommonModule } from '@angular/common';
6
- import { ButtonComponent, InputComponent } from 'angular-dumb-lib';
7
- import { SelectionComponent } from '../../atoms/selection/selection.component';
8
- import { FileSelectionComponent } from '../../atoms/file-selection/file-selection.component';
9
- import { IInputConfig } from '../../../shared/interfaces/interface';
10
- import { IButtonConfig } from 'dist/angular-dumb-lib/lib/shared/interfaces/interface';
11
-
12
-
13
- @Component({
14
- selector: 'app-form',
15
- standalone: true,
16
- templateUrl: './form.component.html',
17
- styleUrls: ['./form.component.scss'],
18
- imports: [CommonModule, InputComponent, SelectionComponent,
19
- FileSelectionComponent, ButtonComponent, FormsModule, ReactiveFormsModule]
20
- })
21
- export class FormComponent {
22
- @Input() formGroup!: FormGroup;
23
- @Input() inputConfigs!: Array<IInputConfig>;
24
- @Input() buttonConfig: IButtonConfig = {
25
- label: "Submit"
26
- }
27
- @Input() validationMessages!: { [key: string]: string };
28
-
29
- @Output() formSubmit = new EventEmitter<any>();
30
- @Output() formChange = new EventEmitter<{ controlName: string; value: any }>();
31
-
32
- // Define the editor configuration
33
-
34
- onSubmit() {
35
- if (this.formGroup.valid) {
36
- this.formSubmit.emit(this.formGroup.value);
37
- }
38
- else {
39
- console.log('Form not valid');
40
- }
41
- }
42
-
43
- onValueChange(controlName: string, value: any) {
44
- this.formChange.emit({ controlName, value });
45
- }
46
-
47
- checkFormConfigType(inputType: InputType | undefined): InputGroupType {
48
- if(inputType) {
49
- if(textualInputTypes.includes(inputType)) {
50
- return InputGroupType.textual;
51
- }
52
- if(selectionInputTypes.includes(inputType)) {
53
- return InputGroupType.selection;
54
- }
55
- if(inputType === InputType.file) {
56
- return InputGroupType.file;
57
- }
58
- if(inputType === InputType.datetime) {
59
- return InputGroupType.datetime;
60
- }
61
- }
62
- return InputGroupType.textual;
63
- }
64
- }
@@ -1,16 +0,0 @@
1
- <div class="modal-overlay" (click)="handleOverlayClick($event)" *ngIf="modalEvent?.isModalVisible">
2
- <div class="modal-content" (click)="handleContentClick($event)">
3
- <div class="modal-header">
4
- <h2>{{modalEvent.title }}</h2>
5
- <button class="close-btn" (click)="closeModal()">
6
- <i class="material-icons">close</i>
7
- </button>
8
- </div>
9
- <div *ngIf="modalEvent.params && modalEvent.params['content']">{{modalEvent.params['content'] | translate}}</div>
10
- <ng-container *ngTemplateOutlet="modalEvent.template; context: modalEvent.params"></ng-container>
11
- <div *ngIf="!modalEvent?.isDialog" class="buttons">
12
- <app-button [config]="okConfig" (clickEvent)="ok()"></app-button>
13
- <app-button [config]="cancelConfig" (clickEvent)="cancel()"></app-button>
14
- </div>
15
- </div>
16
- </div>
@@ -1,83 +0,0 @@
1
- .modal-overlay {
2
- display: flex;
3
- align-items: center;
4
- justify-content: center;
5
- position: fixed;
6
- top: 0;
7
- left: 0;
8
- width: 100%;
9
- height: 100%;
10
- background-color: rgba(0, 0, 0, 0.5);
11
- z-index: 50;
12
- }
13
-
14
- .modal-content {
15
- display: flex;
16
- flex-direction: column;
17
- gap: 20px;
18
- background-color: #fff;
19
- color: #000;
20
- border-radius: 0.5rem;
21
- padding: 2rem;
22
- max-width: 600px;
23
- width: 100%;
24
- max-height: calc(100vh - 7rem); /* Full height */
25
- overflow-y: auto; /* Scroll if content is longer than modal */
26
-
27
- &.dark-mode {
28
- background-color: #27272a; // dark:bg-zinc-800
29
- color: #d1d5db; // dark:text-zinc-300
30
- }
31
-
32
- .modal-header {
33
- display: flex;
34
- flex-direction: row;
35
- justify-content: space-between;
36
- }
37
- }
38
-
39
- h2 {
40
- font-size: 2rem;
41
- font-weight: bold;
42
- margin: unset;
43
- }
44
-
45
- p {
46
- color: #4b5563; // text-zinc-600
47
- margin-bottom: 1.5rem;
48
-
49
- &.dark-mode {
50
- color: #d1d5db; // dark:text-zinc-300
51
- }
52
- }
53
-
54
- .modal-actions {
55
- display: flex;
56
- justify-content: flex-end;
57
- }
58
-
59
- .close-btn {
60
- background-color: transparent;
61
- border: none;
62
- font-size: 1.5rem;
63
- cursor: pointer;
64
- padding: 0;
65
- display: flex;
66
- align-items: center;
67
- }
68
-
69
- .close-btn i.material-icons {
70
- font-size: 24px;
71
- color: #888;
72
- }
73
-
74
- .close-btn:hover i.material-icons {
75
- color: #444;
76
- }
77
-
78
- .buttons {
79
- display: flex;
80
- flex-direction: row;
81
- justify-content: end;
82
- gap: 15px;
83
- }
@@ -1,48 +0,0 @@
1
- import { Component, Input, OnInit } from '@angular/core';
2
- import { IButtonConfig, IModalEvent } from '../../../shared/interfaces/interface';
3
- import { CommonModule } from '@angular/common';
4
- import { ButtonComponent } from 'angular-dumb-lib';
5
-
6
- @Component({
7
- selector: 'app-modal',
8
- standalone: true,
9
- templateUrl: './modal.component.html',
10
- styleUrls: ['./modal.component.scss'],
11
- imports: [CommonModule, ButtonComponent]
12
- })
13
- export class ModalComponent implements OnInit {
14
- @Input() modalEvent!: IModalEvent;
15
- okConfig: IButtonConfig = {
16
- label: "Ok"
17
- }
18
- cancelConfig: IButtonConfig = {
19
- label: "Cancel"
20
- }
21
- constructor() { }
22
-
23
- ngOnInit() {
24
- }
25
-
26
- closeModal() {
27
- this.modalEvent.isModalVisible = false;
28
- }
29
-
30
- handleOverlayClick(event: MouseEvent) {
31
- this.closeModal();
32
- }
33
-
34
- handleContentClick(event: MouseEvent) {
35
- event.stopPropagation();
36
- }
37
-
38
- ok() {
39
- if (this.modalEvent && this.modalEvent.onOk) {
40
- this.modalEvent.onOk();
41
- this.closeModal();
42
- }
43
- }
44
-
45
- cancel() {
46
- this.closeModal();
47
- }
48
- }
@@ -1,25 +0,0 @@
1
- <div class="table-footer">
2
- <div class="number-of-page">
3
- <app-selection [options] = "itemsPerPageList"
4
- [selectedValue]="this.itemsPerPage"
5
- (selectedChange) = "onChangeNumberOfPage($event)">
6
- </app-selection>
7
- <app-input [config]="inputConfig"></app-input>
8
- </div>
9
- <div class="paginator">
10
- <app-button (clickEvent)="selectPage(selectedPage - 1)"
11
- [config]="previousButtonConfig"/>
12
-
13
- <!-- Page Numbers -->
14
- <ng-container *ngFor="let page of pageNumbers">
15
- <app-button
16
- (clickEvent)="selectPage(page)"
17
- [config]="getPageButtonConfig(page)">
18
- </app-button>
19
- </ng-container>
20
-
21
- <!-- Next Button -->
22
- <app-button (clickEvent)="selectPage(selectedPage + 1)"
23
- [config]="nextButtonConfig"/>
24
- </div>
25
- </div>
@@ -1,27 +0,0 @@
1
- body {
2
- color: #566787;
3
- background: #f5f5f5;
4
- font-family: 'Varela Round', sans-serif;
5
- font-size: 13px;
6
- }
7
-
8
- .table-footer {
9
- display: flex;
10
-
11
- .number-of-page {
12
- width: 70%;
13
- display: flex;
14
- align-items: center;
15
- gap: 20px;
16
- }
17
-
18
- .paginator {
19
- display: flex;
20
- justify-content: flex-end;
21
- width: 100%;
22
-
23
- app-button {
24
- margin: 0 2px;
25
- }
26
- }
27
- }
@@ -1,126 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
3
- import { IButtonConfig, IDropdownOption, IInputConfig, IPaginator } from '../../../shared/interfaces/interface';
4
- import { ButtonType, InputDirection } from '../../../shared/enums/enum';
5
- import { ButtonComponent, InputComponent } from 'angular-dumb-lib';
6
- import { SelectionComponent } from '../../atoms/selection/selection.component';
7
-
8
- @Component({
9
- selector: 'app-paginator',
10
- standalone: true,
11
- templateUrl: './paginator.component.html',
12
- styleUrls: ['./paginator.component.scss'],
13
- imports: [CommonModule, ButtonComponent, SelectionComponent, InputComponent]
14
- })
15
- export class PaginatorComponent implements OnInit {
16
- itemsPerPageList: IDropdownOption[] = [];
17
- inputConfig: IInputConfig = {
18
- label: 'Go to page',
19
- direction: InputDirection.horizontal,
20
- name: 'inputConfig',
21
- required: false
22
- }
23
- previousButtonConfig: IButtonConfig = {
24
- iconValue: 'chevron_left',
25
- type: ButtonType.button,
26
- isDisabled: true
27
- }
28
- nextButtonConfig: IButtonConfig = {
29
- iconValue: 'chevron_right',
30
- type: ButtonType.button,
31
- isDisabled: false
32
- }
33
- numberOfPage: number = 0;
34
- itemsPerPage: number = 0;
35
- selectedPage: number = 0;
36
- buttonType!: ButtonType;
37
- inputDirection!: InputDirection;
38
-
39
- @Input() totalRecords: number = 0;
40
-
41
- @Output() paginator = new EventEmitter<IPaginator>();
42
-
43
- constructor() {}
44
-
45
- get pageNumbers(): number[] {
46
- return Array.from({ length: this.numberOfPage }, (_, i) => i + 1);
47
- }
48
-
49
- ngOnInit() {
50
- this.itemsPerPageList = [
51
- {
52
- label: "3",
53
- value: 1
54
- },
55
- {
56
- label: "5",
57
- value: 2
58
- },
59
- {
60
- label: "20",
61
- value: 3
62
- }
63
- ];
64
- this.selectedPage = 1;
65
- this.buttonType = ButtonType.button;
66
- this.inputDirection = InputDirection.horizontal;
67
- this.itemsPerPage = parseInt(this.itemsPerPageList[0].label);
68
- this.calculateNumberOfPage(this.totalRecords, this.itemsPerPage);
69
- this.updateButtonConfigs();
70
- this.emitPaging();
71
- }
72
-
73
- ngOnChanges(): void {
74
- this.calculateNumberOfPage(this.totalRecords, this.itemsPerPage);
75
- }
76
-
77
- selectPage(i: number) {
78
- this.selectedPage = i;
79
- this.updateButtonConfigs();
80
- this.emitPaging();
81
- }
82
-
83
- onChangeNumberOfPage(itemsPerPageId: string) {
84
- this.selectedPage = 1;
85
- this.itemsPerPage = parseInt(this.itemsPerPageList.find(i=> i.value === parseInt(itemsPerPageId))?.label??
86
- this.itemsPerPage.toString());
87
-
88
- this.calculateNumberOfPage(this.totalRecords, this.itemsPerPage);
89
- this.updateButtonConfigs();
90
- this.emitPaging();
91
- }
92
-
93
- private emitPaging() {
94
- let paging: IPaginator = {
95
- itemsPerPage: this.itemsPerPage,
96
- selectedPage: this.selectedPage
97
- }
98
- this.paginator.emit(paging);
99
- }
100
-
101
- private calculateNumberOfPage (totalRecords: number, itemsPerPage: number): number {
102
- return this.numberOfPage = Math.ceil(totalRecords/itemsPerPage);
103
- }
104
-
105
- private updateButtonConfigs() {
106
- // Re-assign the button configuration to trigger change detection
107
- this.previousButtonConfig = {
108
- ...this.previousButtonConfig,
109
- isDisabled: this.selectedPage <= 1
110
- };
111
- this.nextButtonConfig = {
112
- ...this.nextButtonConfig,
113
- isDisabled: this.selectedPage >= this.numberOfPage
114
- };
115
- }
116
-
117
- // Method to return config for page number buttons
118
- getPageButtonConfig(page: number): IButtonConfig {
119
- return {
120
- label: page.toString(),
121
- type: ButtonType.button,
122
- isActive: page === this.selectedPage, // Set active state based on selectedPage
123
- isDisabled: false // Page buttons are never disabled
124
- };
125
- }
126
- }
@@ -1,45 +0,0 @@
1
- <div class="container-xl table-wrapper">
2
- <div class="table-title">
3
- <h2><b>{{tableName }}</b></h2>
4
- </div>
5
- <div class="loading-wrapper">
6
- <ng-container *ngIf="!(loadingState | async); else loading; then table">
7
- </ng-container>
8
- </div>
9
- <app-paginator [totalRecords] = "totalRecords" (paginator)="changePaginator($event)"></app-paginator>
10
- </div>
11
-
12
- <ng-template #loading>
13
- <div class="loading-wrapper">
14
- <app-loading></app-loading>
15
- </div>
16
- </ng-template>
17
-
18
- <ng-template #table>
19
- <ng-container *ngIf="totalRecords == 0; then emptyContent; else tableContent">
20
- </ng-container>
21
- </ng-template>
22
-
23
- <ng-template #tableContent>
24
- <p-table [value]="items" class="table table-striped table-hover">
25
- <ng-template pTemplate="header">
26
- <tr>
27
- <th>
28
- <ng-content select="[selectAllCheckbox]"></ng-content>
29
- </th>
30
- <ng-container *ngFor=" let col of columns">
31
- <th>{{col.name }}</th>
32
- </ng-container>
33
- </tr>
34
- </ng-template>
35
- <ng-template pTemplate="body" let-item>
36
- <ng-container [ngTemplateOutlet]="bodyTemplate" [ngTemplateOutletContext]="{item:item}"></ng-container>
37
- </ng-template>
38
- </p-table>
39
- </ng-template>
40
-
41
- <ng-template #emptyContent>
42
- <div class="no-record-message">
43
- <div>No records</div>
44
- </div>
45
- </ng-template>