@corp-products/ui-components 3.2.8 → 3.2.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 (138) hide show
  1. package/ng-package.json +7 -0
  2. package/package.json +22 -36
  3. package/src/enums/date-formatter.ts +21 -0
  4. package/src/helper/date-handler.ts +142 -0
  5. package/src/lib/app-accordion/app-accordion.component.html +15 -0
  6. package/src/lib/app-accordion/app-accordion.component.scss +0 -0
  7. package/src/lib/app-accordion/app-accordion.component.spec.ts +21 -0
  8. package/src/lib/app-accordion/app-accordion.component.ts +21 -0
  9. package/src/lib/app-accordion/index.ts +2 -0
  10. package/src/lib/app-breadcrumb/app-breadcrumb.component.html +7 -0
  11. package/src/lib/app-breadcrumb/app-breadcrumb.component.scss +25 -0
  12. package/src/lib/app-breadcrumb/app-breadcrumb.component.ts +140 -0
  13. package/src/lib/app-breadcrumb/app-breadcrumb.interface.ts +15 -0
  14. package/src/lib/app-button/app-button.component.html +7 -0
  15. package/src/lib/app-button/app-button.component.scss +0 -0
  16. package/src/lib/app-button/app-button.component.ts +14 -0
  17. package/src/lib/app-button/app-button.ts +15 -0
  18. package/src/lib/app-button/index.ts +2 -0
  19. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.html +22 -0
  20. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.scss +39 -0
  21. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.spec.ts +21 -0
  22. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.ts +43 -0
  23. package/src/lib/app-dropdown-menu/app-dropdown-menu.ts +17 -0
  24. package/src/lib/app-dropdown-menu/index.ts +2 -0
  25. package/src/lib/app-dropdown-menu/menu-popup.pipe.ts +18 -0
  26. package/src/lib/app-header/app-header.component.html +26 -0
  27. package/src/lib/app-header/app-header.component.scss +0 -0
  28. package/src/lib/app-header/app-header.component.ts +43 -0
  29. package/src/lib/app-side-menu/app-side-menu.component.html +20 -0
  30. package/src/lib/app-side-menu/app-side-menu.component.ts +28 -0
  31. package/src/lib/app-side-menu/routes-names.ts +28 -0
  32. package/src/lib/app-side-menu/side-menu-items.ts +45 -0
  33. package/src/lib/app-side-menu/side-menu.ts +12 -0
  34. package/src/lib/app-tabs/app-tab.interface.ts +27 -0
  35. package/src/lib/app-tabs/app-tabs.component.html +37 -0
  36. package/src/lib/app-tabs/app-tabs.component.scss +103 -0
  37. package/src/lib/app-tabs/app-tabs.component.spec.ts +21 -0
  38. package/src/lib/app-tabs/app-tabs.component.ts +67 -0
  39. package/src/lib/app-tabs/index.ts +2 -0
  40. package/src/lib/bottom-sheet/bottom-sheet.component.html +18 -0
  41. package/src/lib/bottom-sheet/bottom-sheet.component.scss +31 -0
  42. package/src/lib/bottom-sheet/bottom-sheet.component.ts +26 -0
  43. package/src/lib/confirmation-dialog/confirmation-dialog.component.html +37 -0
  44. package/src/lib/confirmation-dialog/confirmation-dialog.component.scss +0 -0
  45. package/src/lib/confirmation-dialog/confirmation-dialog.component.spec.ts +22 -0
  46. package/src/lib/confirmation-dialog/confirmation-dialog.component.ts +64 -0
  47. package/src/lib/confirmation-dialog/confirmation-dialog.interface.ts +13 -0
  48. package/src/lib/confirmation-dialog/confirmation-dialog.service.ts +34 -0
  49. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.html +27 -0
  50. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.scss +22 -0
  51. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.ts +64 -0
  52. package/src/lib/dual-calender/dual-calendar.component.html +31 -0
  53. package/src/lib/dual-calender/dual-calendar.component.scss +229 -0
  54. package/src/lib/dual-calender/dual-calendar.component.ts +107 -0
  55. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.html +10 -0
  56. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.scss +0 -0
  57. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.spec.ts +21 -0
  58. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.ts +59 -0
  59. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.html +10 -0
  60. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.scss +0 -0
  61. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.spec.ts +21 -0
  62. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.ts +59 -0
  63. package/src/lib/dual-calender/services/gregorian-i18n.service.ts +123 -0
  64. package/src/lib/dual-calender/services/islamic-i18n.service.ts +119 -0
  65. package/src/lib/dual-calender/utils/date-i18n.utils.ts +58 -0
  66. package/src/lib/dynamic-form/dynamic-form.component.html +86 -0
  67. package/src/lib/dynamic-form/dynamic-form.component.scss +0 -0
  68. package/src/lib/dynamic-form/dynamic-form.component.spec.ts +21 -0
  69. package/src/lib/dynamic-form/dynamic-form.component.ts +58 -0
  70. package/src/lib/dynamic-form/dynamic-form.interface.ts +94 -0
  71. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.html +32 -0
  72. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.scss +3 -0
  73. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.ts +82 -0
  74. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.config.ts +31 -0
  75. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.service.ts +41 -0
  76. package/src/lib/form-components/@utils/form-utils.ts +12 -0
  77. package/src/lib/form-components/@utils/validations/error-keys.enum.ts +24 -0
  78. package/src/lib/form-components/@utils/validations/form-validation.service.ts +68 -0
  79. package/src/lib/form-components/@utils/validations/index.ts +3 -0
  80. package/src/lib/form-components/@utils/validations/validation-message.pipe.ts +24 -0
  81. package/src/lib/form-components/components/auto-complete/auto-complete.component.html +35 -0
  82. package/src/lib/form-components/components/auto-complete/auto-complete.component.scss +7 -0
  83. package/src/lib/form-components/components/auto-complete/auto-complete.component.spec.ts +21 -0
  84. package/src/lib/form-components/components/auto-complete/auto-complete.component.ts +57 -0
  85. package/src/lib/form-components/components/base-input.component.ts +35 -0
  86. package/src/lib/form-components/components/date-picker/date-picker.component.html +41 -0
  87. package/src/lib/form-components/components/date-picker/date-picker.component.scss +16 -0
  88. package/src/lib/form-components/components/date-picker/date-picker.component.spec.ts +21 -0
  89. package/src/lib/form-components/components/date-picker/date-picker.component.ts +54 -0
  90. package/src/lib/form-components/components/input/input.component.html +63 -0
  91. package/src/lib/form-components/components/input/input.component.scss +41 -0
  92. package/src/lib/form-components/components/input/input.component.spec.ts +21 -0
  93. package/src/lib/form-components/components/input/input.component.ts +45 -0
  94. package/src/lib/form-components/components/select/select.component.html +111 -0
  95. package/src/lib/form-components/components/select/select.component.scss +43 -0
  96. package/src/lib/form-components/components/select/select.component.spec.ts +21 -0
  97. package/src/lib/form-components/components/select/select.component.ts +56 -0
  98. package/src/lib/form-components/components/select-button/select-button.component.html +21 -0
  99. package/src/lib/form-components/components/select-button/select-button.component.scss +0 -0
  100. package/src/lib/form-components/components/select-button/select-button.component.spec.ts +21 -0
  101. package/src/lib/form-components/components/select-button/select-button.component.ts +22 -0
  102. package/src/lib/form-components/components/switcher/switch.component.html +5 -0
  103. package/src/lib/form-components/components/switcher/switch.component.scss +0 -0
  104. package/src/lib/form-components/components/switcher/switch.component.spec.ts +21 -0
  105. package/src/lib/form-components/components/switcher/switch.component.ts +25 -0
  106. package/src/lib/form-components/index.ts +9 -0
  107. package/src/lib/form-components/interfaces/index.ts +1 -0
  108. package/src/lib/form-components/interfaces/label-value.ts +4 -0
  109. package/src/lib/ico-moon-icon/ico-moon-icon.component.ts +23 -0
  110. package/src/lib/read-more/read-more.component.html +17 -0
  111. package/src/lib/read-more/read-more.component.scss +0 -0
  112. package/src/lib/read-more/read-more.component.spec.ts +21 -0
  113. package/src/lib/read-more/read-more.component.ts +21 -0
  114. package/src/lib/side-bar/side-bar.component.html +24 -0
  115. package/src/lib/side-bar/side-bar.component.scss +22 -0
  116. package/src/lib/side-bar/side-bar.component.spec.ts +21 -0
  117. package/src/lib/side-bar/side-bar.component.ts +33 -0
  118. package/src/lib/side-bar-dynamic/data-injector.pipe.ts +15 -0
  119. package/src/lib/side-bar-dynamic/dynamic-sidebar.service.ts +116 -0
  120. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.html +42 -0
  121. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.scss +5 -0
  122. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.spec.ts +21 -0
  123. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.ts +37 -0
  124. package/src/lib/side-bar-dynamic/side-bar-utils.ts +30 -0
  125. package/src/lib/side-bar-dynamic/sidebar-config.ts +48 -0
  126. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.html +20 -0
  127. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.scss +0 -0
  128. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.spec.ts +21 -0
  129. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.ts +21 -0
  130. package/src/lib/user-info/user-info.component.html +10 -0
  131. package/src/lib/user-info/user-info.component.ts +11 -0
  132. package/src/public-api.ts +26 -0
  133. package/tsconfig.lib.json +18 -0
  134. package/tsconfig.lib.prod.json +11 -0
  135. package/tsconfig.spec.json +14 -0
  136. package/fesm2022/corp-products-ui-components.mjs +0 -1416
  137. package/fesm2022/corp-products-ui-components.mjs.map +0 -1
  138. package/index.d.ts +0 -625
@@ -0,0 +1,22 @@
1
+ .sidebar {
2
+ &.show {
3
+ @apply min-w-[550px];
4
+ }
5
+ }
6
+
7
+ .p-drawer-header , .p-drawer-footer{
8
+ background-color: var(--gray-100);
9
+ }
10
+
11
+ .p-drawer-header{
12
+ --p-drawer-header-padding: 0.75rem var(--p-overlay-modal-padding);
13
+ font-weight: 500;
14
+ }
15
+
16
+ .p-drawer-footer{
17
+ --p-drawer-footer-padding: 0.75rem var(--p-overlay-modal-padding);
18
+ }
19
+
20
+ .p-drawer-content{
21
+ padding-top: var(--p-overlay-modal-padding) !important;
22
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { SideBarComponent } from './side-bar.component';
3
+
4
+ describe('SideBarComponent', () => {
5
+ let component: SideBarComponent;
6
+ let fixture: ComponentFixture<SideBarComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [SideBarComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(SideBarComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,33 @@
1
+ import { NgClass, NgTemplateOutlet } from "@angular/common";
2
+ import { Component, EventEmitter, Input, Output, TemplateRef, ViewEncapsulation } from "@angular/core";
3
+ import { PrimeTemplate } from "primeng/api";
4
+ import { Drawer } from "primeng/drawer";
5
+ import { TooltipModule } from "primeng/tooltip";
6
+
7
+ @Component({
8
+ selector: "app-side-bar",
9
+ standalone: true,
10
+ imports: [PrimeTemplate, Drawer, NgClass, NgTemplateOutlet, TooltipModule],
11
+ templateUrl: "./side-bar.component.html",
12
+ styleUrl: "./side-bar.component.scss",
13
+ encapsulation: ViewEncapsulation.None
14
+ })
15
+ export class SideBarComponent {
16
+ @Input() show = false;
17
+ @Input() title: string;
18
+ @Input() closable = true;
19
+ @Input() dismissible = false;
20
+ @Input() closeOnEscape = false;
21
+ @Input() sidebarSize: "sm" | "md" | "lg" | "xl" = "sm";
22
+ @Input() styleClass = "";
23
+ @Output() hide = new EventEmitter<boolean>();
24
+ @Output() onShow = new EventEmitter<boolean>();
25
+ @Input() contentTemplate!: TemplateRef<unknown>;
26
+ @Input() footerTemplate!: TemplateRef<unknown>;
27
+ @Input() position = 'left';
28
+
29
+ hideSidebar() {
30
+ this.show = false;
31
+ this.hide.emit(false);
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ import {inject, Injector, Pipe, PipeTransform} from '@angular/core';
2
+ import { createCustomInjector, SIDEBAR_DATA } from './side-bar-utils';
3
+
4
+ @Pipe({
5
+ name: 'dataInjector',
6
+ standalone: true,
7
+ pure: true
8
+ })
9
+ export class DataInjectorPipe implements PipeTransform {
10
+ injector = inject(Injector);
11
+
12
+ transform(data: unknown): Injector {
13
+ return createCustomInjector(this.injector, SIDEBAR_DATA, data);
14
+ }
15
+ }
@@ -0,0 +1,116 @@
1
+ import { ApplicationRef, ComponentRef, createComponent, EmbeddedViewRef, EnvironmentInjector, Injectable, Type } from "@angular/core";
2
+ import { AbstractControl } from "@angular/forms";
3
+ import { BehaviorSubject, Subject } from "rxjs";
4
+ import { SideBarDynamicComponent } from "./side-bar-dynamic.component";
5
+ import { SidebarConfig, SidebarConfigDefaults } from "./sidebar-config";
6
+ import { SidebarActionEvent, SidebarActionType } from "./side-bar-utils";
7
+
8
+ @Injectable({
9
+ providedIn: "root"
10
+ })
11
+ export class DynamicSidebarService {
12
+ contentComponentRef: Type<any> | null = null;
13
+ contentComponentData: unknown;
14
+ sidebarConfig: SidebarConfig = this.getDefaultConfig();
15
+ activeForm: AbstractControl | null = null;
16
+ private componentRef: ComponentRef<SideBarDynamicComponent> | null = null;
17
+ private sidebarAction$ = new Subject<SidebarActionEvent>();
18
+ action$ = this.sidebarAction$.asObservable();
19
+ private sidebarSideEffectAction$ = new Subject<SidebarActionEvent>();
20
+ sideEffectAction$ = this.sidebarSideEffectAction$.asObservable();
21
+ private isOpen$ = new BehaviorSubject<boolean>(false);
22
+ isOpenObservable$ = this.isOpen$.asObservable();
23
+
24
+ constructor(private environmentInjector: EnvironmentInjector, private appRef: ApplicationRef) {}
25
+
26
+ // Action notifications
27
+ notifyAction(type: SidebarActionType, payload?: any): void {
28
+ this.sidebarAction$.next({type, payload});
29
+ }
30
+
31
+ notifySideEffectAction(type: SidebarActionType, payload?: any): void {
32
+ this.sidebarSideEffectAction$.next({type, payload});
33
+ }
34
+
35
+ // Form management
36
+ setActiveForm(control: AbstractControl): void {
37
+ this.activeForm = control;
38
+ }
39
+
40
+ resetActiveForm(): void {
41
+ this.activeForm = null;
42
+ }
43
+
44
+ isButtonDisabled(): boolean {
45
+ if (!this.activeForm) {
46
+ return false;
47
+ }
48
+ return this.activeForm.invalid || this.activeForm.untouched;
49
+ }
50
+
51
+ open(component: unknown, config: SidebarConfig, data?: any): void {
52
+ // Close any existing sidebar before opening a new one
53
+ // TODO Need to Review
54
+ if (!component) {
55
+ return;
56
+ }
57
+
58
+ this.close();
59
+ this.contentComponentRef = component as Type<any>;
60
+ this.contentComponentData = data;
61
+ this.sidebarConfig = {...this.getDefaultConfig(), ...config};
62
+
63
+ this.componentRef = createComponent(SideBarDynamicComponent, {
64
+ environmentInjector: this.environmentInjector,
65
+ });
66
+ // Attach the component to the Angular application
67
+ this.appRef.attachView(this.componentRef.hostView);
68
+
69
+ // Append the component to the DOM
70
+ const domElem = (this.componentRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;
71
+ document.body.appendChild(domElem);
72
+ }
73
+
74
+ /**
75
+ * Closes the currently open sidebar, if any.
76
+ */
77
+ close(): void {
78
+ if (this.componentRef) {
79
+ // Detach the view and destroy the component
80
+ this.appRef.detachView(this.componentRef.hostView);
81
+ this.componentRef.destroy();
82
+ this.componentRef = null;
83
+
84
+ // Reset content and configuration
85
+ this.contentComponentRef = null;
86
+ this.contentComponentData = null;
87
+ this.sidebarConfig = this.getDefaultConfig();
88
+ this.isOpen$.next(false);
89
+ this.resetActiveForm();
90
+ this.notifySideEffectAction(SidebarActionType.CLOSE);
91
+ }
92
+ }
93
+
94
+ cancel(): void {
95
+ this.notifyAction(SidebarActionType.CANCEL);
96
+ }
97
+
98
+ submit(flag: boolean = false): void {
99
+ const actionType = flag ? SidebarActionType.SaveMore : SidebarActionType.SAVE;
100
+ this.notifyAction(actionType, {withClose: flag});
101
+ }
102
+
103
+ /**
104
+ * Provides the default configuration for the sidebar.
105
+ * @returns The default SidebarConfig object.
106
+ */
107
+ private getDefaultConfig(): SidebarConfig {
108
+ return {
109
+ ...SidebarConfigDefaults,
110
+ show: false,
111
+ visible: false,
112
+ closable: false,
113
+ dismissible: true
114
+ };
115
+ }
116
+ }
@@ -0,0 +1,42 @@
1
+ <p-drawer (onHide)="dynamicSidebarService.close()" [(visible)]="sidebarConfig.visible"
2
+ [closable]="sidebarConfig.closable" [closeOnEscape]="sidebarConfig.closeOnEscape"
3
+ [dismissible]="sidebarConfig.dismissible" [ngClass]="{ show: sidebarConfig.show }" [position]="'left'" appendTo="body"
4
+ id="main-drawer"
5
+ styleClass="p-drawer-{{ sidebarConfig.sidebarSize }} custom-content bg-white {{ sidebarConfig.styleClass }}">
6
+ <ng-template pTemplate="header">{{ sidebarConfig.title }}</ng-template>
7
+ <ng-template pTemplate="content">
8
+ <ng-container [ngComponentOutletInjector]="dynamicSidebarService.contentComponentData | dataInjector"
9
+ [ngComponentOutlet]="dynamicSidebarService.contentComponentRef"></ng-container>
10
+ </ng-template>
11
+ @if (sidebarConfig.showSaveBtn || sidebarConfig.showSaveAndMoreBtn || sidebarConfig.showCancelBtn) {
12
+ <ng-template pTemplate="footer">
13
+ <section class="flex justify-between bg-gray-200 py-4" id="sidebar-footer">
14
+ <div class="flex gap-2">
15
+ @if (sidebarConfig.showSaveBtn) {
16
+ <app-button (clickEmitter)="dynamicSidebarService.submit(true)"
17
+ [disabled]="dynamicSidebarService.isButtonDisabled()"
18
+ [icon]="sidebarConfig!.actions!.save!.icon || 'font-icon-plus'"
19
+ [iconPos]="sidebarConfig!.actions!.save!.iconPos || 'right'"
20
+ [styleClass]="sidebarConfig!.actions!.save!.style || 'danger'"
21
+ [title]="sidebarConfig!.actions!.save!.title || ('actions.save' | translate)"
22
+ [variant]="sidebarConfig!.actions!.save!.variant" />
23
+ }
24
+ @if (sidebarConfig.showSaveAndMoreBtn) {
25
+ <app-button (clickEmitter)="dynamicSidebarService.submit()"
26
+ [disabled]="dynamicSidebarService.isButtonDisabled()"
27
+ [icon]="sidebarConfig!.actions!.saveAndMore!.icon || 'font-icon-plus'"
28
+ [iconPos]="sidebarConfig!.actions!.saveAndMore!.iconPos || 'right'"
29
+ [styleClass]="sidebarConfig!.actions!.saveAndMore!.style || 'danger'"
30
+ [title]="sidebarConfig!.actions!.saveAndMore!.title || ('actions.save_and_and_more' | translate)"
31
+ [variant]="sidebarConfig!.actions!.saveAndMore!.variant" />
32
+
33
+ }
34
+ </div>
35
+ @if (sidebarConfig.showCancelBtn) {
36
+ <app-button (clickEmitter)="dynamicSidebarService.cancel()" [styleClass]="'secondary'"
37
+ [title]="'actions.cancel' | translate" />
38
+ }
39
+ </section>
40
+ </ng-template>
41
+ }
42
+ </p-drawer>
@@ -0,0 +1,5 @@
1
+ .sidebar {
2
+ &.show {
3
+ min-width: 550px;
4
+ }
5
+ }
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { DynamicSideBarComponent } from 'libs/ui-components/src/lib/dynamic-side-bar/dynamic-side-bar.component';
3
+
4
+ describe('SideBarComponent', () => {
5
+ let component: DynamicSideBarComponent;
6
+ let fixture: ComponentFixture<DynamicSideBarComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [DynamicSideBarComponent],
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(DynamicSideBarComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it('should create', () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,37 @@
1
+ import {NgClass, NgComponentOutlet} from "@angular/common";
2
+ import {Component, inject, Injector, OnDestroy, OnInit} from '@angular/core';
3
+ import {PrimeTemplate} from "primeng/api";
4
+ import {Drawer} from "primeng/drawer";
5
+ import { Location } from '@angular/common';
6
+ import {TranslatePipe} from "@ngx-translate/core";
7
+ import { DataInjectorPipe } from "./data-injector.pipe";
8
+ import { AppButtonComponent } from "../app-button";
9
+ import { DynamicSidebarService } from "./dynamic-sidebar.service";
10
+ import { createCustomInjector, SIDEBAR_DATA } from "./side-bar-utils";
11
+ @Component({
12
+ selector: "app-side-bar-dynamic",
13
+ templateUrl: "./side-bar-dynamic.component.html",
14
+ styleUrls: ["./side-bar-dynamic.component.scss"],
15
+ standalone: true,
16
+ imports: [Drawer, NgClass, NgComponentOutlet, PrimeTemplate, DataInjectorPipe, AppButtonComponent, TranslatePipe]
17
+ })
18
+ export class SideBarDynamicComponent implements OnInit, OnDestroy {
19
+ dynamicSidebarService = inject(DynamicSidebarService);
20
+ parentInjector = inject(Injector);
21
+ location = inject(Location);
22
+ private popStateListener: any;
23
+ sidebarConfig = this.dynamicSidebarService.sidebarConfig;
24
+ ngOnInit() {
25
+ //To close a sidebar when the browser back button is pressed
26
+ this.popStateListener = this.location.subscribe(() => {
27
+ if (this.dynamicSidebarService.sidebarConfig.visible) {
28
+ this.dynamicSidebarService.close();
29
+ }
30
+ });
31
+ }
32
+
33
+ ngOnDestroy() {
34
+ // reset Sidebar token
35
+ createCustomInjector(this.parentInjector, SIDEBAR_DATA, null);
36
+ }
37
+ }
@@ -0,0 +1,30 @@
1
+ import {InjectionToken, Injector} from "@angular/core";
2
+
3
+ export const SIDEBAR_DATA = new InjectionToken<any>('SIDEBAR_DATA');
4
+
5
+ export function createCustomInjector(parentInjector: Injector, injectionToken: InjectionToken<unknown>, data: unknown): Injector {
6
+ return Injector.create({
7
+ parent: parentInjector,
8
+ providers: [
9
+ {
10
+ provide: injectionToken,
11
+ useValue: data ?? null
12
+ }
13
+ ]
14
+ })
15
+ };
16
+
17
+
18
+ export enum SidebarActionType {
19
+ SAVE = 'SAVE',
20
+ SaveMore = 'SaveMore',
21
+ CANCEL = 'CANCEL',
22
+ SUBMIT = 'SUBMIT',
23
+ CLOSE = 'CLOSE',
24
+ CloseWithData = 'CloseWithData',
25
+ }
26
+
27
+ export interface SidebarActionEvent {
28
+ type: SidebarActionType;
29
+ payload?: any;
30
+ }
@@ -0,0 +1,48 @@
1
+ import { AppButtonIconPos, AppButtonSeverity, AppButtonSize, AppButtonVariant } from "../app-button";
2
+
3
+ export interface SidebarActionConfig {
4
+ title?: string;
5
+ icon?: string;
6
+ size?: AppButtonSize;
7
+ style?: AppButtonSeverity;
8
+ iconPos?: AppButtonIconPos;
9
+ variant?: AppButtonVariant;
10
+ }
11
+
12
+ export interface SidebarConfig {
13
+ title: string;
14
+ show: boolean;
15
+ visible: boolean;
16
+ closable: boolean;
17
+ dismissible: boolean;
18
+ closeOnEscape: boolean;
19
+ sidebarSize: "sm" | "md" | "lg" | "xl";
20
+ styleClass?: string;
21
+ showCancelBtn: boolean;
22
+ showSaveBtn: boolean;
23
+ showSaveAndMoreBtn: boolean;
24
+ actions?: {
25
+ cancel?: SidebarActionConfig;
26
+ save?: SidebarActionConfig;
27
+ saveAndMore?: SidebarActionConfig;
28
+ };
29
+ }
30
+
31
+ export const SidebarConfigDefaults: SidebarConfig = {
32
+ title: "",
33
+ show: true,
34
+ visible: true,
35
+ closable: true,
36
+ dismissible: false,
37
+ closeOnEscape: false,
38
+ sidebarSize: "md",
39
+ showCancelBtn: false,
40
+ showSaveBtn: false,
41
+ showSaveAndMoreBtn: false,
42
+ actions: {
43
+ save: {},
44
+ saveAndMore: {
45
+ variant: "outlined"
46
+ }
47
+ }
48
+ };
@@ -0,0 +1,20 @@
1
+ <div class="flex gap-2 items-center justify-between p-4 rounded mb-4 border border-dotted border-gray-300 bg-gray-100">
2
+ <div class="flex gap-4 items-center">
3
+ <img [alt]="userData.name" [src]="userData.profileImage" class="rounded-full object-cover w-[48px] h-[48px]" />
4
+ <div class="flex flex-col justify-end">
5
+ <h4 class="font-bold text-[12px] text-gray-800 truncate max-w-[135px] dir-ltr">
6
+ {{ userData.name }}
7
+ </h4>
8
+ <p class="text-[12px] text-gray-700">{{ explicitRole ? explicitRole : userData.position.name }}</p>
9
+ </div>
10
+ </div>
11
+ <div class="flex-1 flex flex-col items-end">
12
+ <p class="text-[12px] text-purple-700 truncate max-w-[90px] dir-ltr">{{ userData.email }}</p>
13
+ <p class="text-[12px] text-gray-600 dir-ltr">{{ userData.contact.mobile }}</p>
14
+ </div>
15
+ @if (showDeleteAction){
16
+ <div class="flex gap-1 flex-nowrap">
17
+ <app-button (clickEmitter)="onDelete()" [rounded]="true" [size]="'large'" [text]="true" icon="font-icon-trash"/>
18
+ </div>
19
+ }
20
+ </div>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { BaseCardComponent } from "../base-card/base-card.component";
3
+
4
+ describe("BaseCardComponent", () => {
5
+ let component: BaseCardComponent;
6
+ let fixture: ComponentFixture<BaseCardComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [BaseCardComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(BaseCardComponent);
14
+ component = fixture.componentInstance;
15
+ fixture.detectChanges();
16
+ });
17
+
18
+ it("should create", () => {
19
+ expect(component).toBeTruthy();
20
+ });
21
+ });
@@ -0,0 +1,21 @@
1
+ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from "@angular/core";
2
+ import { AppButtonComponent } from "../app-button";
3
+
4
+ @Component({
5
+ selector: "app-user-autocomplete-card",
6
+ standalone: true,
7
+ imports: [AppButtonComponent],
8
+ templateUrl: "./user-autocomplete-card.component.html",
9
+ styleUrl: "./user-autocomplete-card.component.scss",
10
+ changeDetection: ChangeDetectionStrategy.OnPush
11
+ })
12
+ export class UserAutocompleteCardComponent {
13
+ @Output() select = new EventEmitter<any>();
14
+ @Output() delete = new EventEmitter<any>();
15
+ @Input({ required: true }) userData: any;
16
+ @Input() explicitRole = "";
17
+ @Input() showDeleteAction = true;
18
+ onDelete() {
19
+ this.delete.emit(this.userData);
20
+ }
21
+ }
@@ -0,0 +1,10 @@
1
+ <div class="flex items-center gap-2">
2
+ <img
3
+ [alt]="name"
4
+ [src]="profileImage"
5
+ class="rounded-full object-cover w-[24px] h-[24px]"
6
+ height="24"
7
+ width="24"
8
+ />
9
+ <p class="text-[14px]">{{ name }}</p>
10
+ </div>
@@ -0,0 +1,11 @@
1
+ import { Component, Input } from "@angular/core";
2
+
3
+ @Component({
4
+ selector: "user-info",
5
+ templateUrl: "./user-info.component.html",
6
+ standalone: true
7
+ })
8
+ export class UserInfoComponent {
9
+ @Input() profileImage: string;
10
+ @Input() name: string;
11
+ }
@@ -0,0 +1,26 @@
1
+
2
+ export * from './lib/app-button';
3
+ export * from './lib/app-tabs';
4
+ export * from './lib/app-dropdown-menu';
5
+ export * from './lib/side-bar/side-bar.component';
6
+ export * from './lib/ico-moon-icon/ico-moon-icon.component';
7
+ export * from './lib/user-info/user-info.component';
8
+ export * from './lib/confirmation-dialog/confirmation-dialog.component';
9
+ export * from './lib/read-more/read-more.component';
10
+ export * from './lib/app-accordion/app-accordion.component';
11
+ export * from './lib/dynamic-form/dynamic-form.interface';
12
+ export * from './lib/dynamic-form/dynamic-form.component';
13
+ export * from './lib/form-components';
14
+ export * from './lib/user-autocomplete-card/user-autocomplete-card.component';
15
+ export * from './lib/app-breadcrumb/app-breadcrumb.component';
16
+ export * from './lib/app-breadcrumb/app-breadcrumb.interface';
17
+ export * from './lib/side-bar-dynamic/dynamic-sidebar.service';
18
+ export * from './lib/side-bar-dynamic/sidebar-config';
19
+ export * from './lib/confirmation-dialog/confirmation-dialog.service';
20
+ export * from './lib/confirmation-dialog/confirmation-dialog.interface';
21
+ export * from './lib/bottom-sheet/bottom-sheet.component';
22
+ export * from './lib/dynamic-side-bar-v2/dynamic-sidebar.service';
23
+ export * from './lib/dynamic-side-bar-v2/dynamic-sidebar.config';
24
+ export * from './lib/dual-calender/dual-calendar.component';
25
+
26
+
@@ -0,0 +1,18 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/lib",
7
+ "declaration": true,
8
+ "declarationMap": true,
9
+ "inlineSources": true,
10
+ "types": []
11
+ },
12
+ "include": [
13
+ "src/**/*.ts"
14
+ ],
15
+ "exclude": [
16
+ "**/*.spec.ts"
17
+ ]
18
+ }
@@ -0,0 +1,11 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "./tsconfig.lib.json",
5
+ "compilerOptions": {
6
+ "declarationMap": false
7
+ },
8
+ "angularCompilerOptions": {
9
+ "compilationMode": "partial"
10
+ }
11
+ }
@@ -0,0 +1,14 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "extends": "../../tsconfig.json",
5
+ "compilerOptions": {
6
+ "outDir": "../../out-tsc/spec",
7
+ "types": [
8
+ "jasmine"
9
+ ]
10
+ },
11
+ "include": [
12
+ "src/**/*.ts"
13
+ ]
14
+ }