@skysoftware-co/bayan-core-widgets-ui 0.0.4 → 0.0.8

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 (73) hide show
  1. package/.editorconfig +17 -0
  2. package/.github/copilot/WidgetDevelopmentGuide.md +632 -0
  3. package/.github/copilot/WidgetProjectStructure.md +81 -0
  4. package/.github/copilot/git.md +176 -0
  5. package/.github/copilot/guideline.md +466 -0
  6. package/.github/copilot-instructions.md +697 -0
  7. package/.github/prompts/As world class developer, create unit tests for.prompt.md +7 -0
  8. package/README.md +1 -337
  9. package/Web.config +7 -0
  10. package/angular.json +43 -0
  11. package/package.json +54 -31
  12. package/projects/bayan-core-ui/README.md +522 -0
  13. package/projects/bayan-core-ui/ng-package.json +7 -0
  14. package/projects/bayan-core-ui/package.json +36 -0
  15. package/projects/bayan-core-ui/src/assets/i18n/ar.json +725 -0
  16. package/projects/bayan-core-ui/src/assets/i18n/en.json +683 -0
  17. package/projects/bayan-core-ui/src/assets/i18n/fr.json +687 -0
  18. package/projects/bayan-core-ui/src/lib/shared/common-methods/navigation.utils.ts +21 -0
  19. package/projects/bayan-core-ui/src/lib/shared/menu.dtos.ts +107 -0
  20. package/projects/bayan-core-ui/src/lib/shared/menu.service.ts +157 -0
  21. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/about-dialog-widget/about-dialog-widget.component.html +37 -0
  22. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/about-dialog-widget/about-dialog-widget.component.ts +68 -0
  23. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/change-password-widget/change-password-widget.component.html +56 -0
  24. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/change-password-widget/change-password-widget.component.ts +158 -0
  25. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/global-search-widget/global-search-widget.component.html +39 -0
  26. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/global-search-widget/global-search-widget.component.ts +152 -0
  27. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/item-widget/item-widget.component.html +39 -0
  28. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/item-widget/item-widget.component.ts +80 -0
  29. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/notifications-widget/notifications-widget.component.html +10 -0
  30. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/notifications-widget/notifications-widget.component.ts +89 -0
  31. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/settings-widget/settings-widget.component.html +111 -0
  32. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/settings-widget/settings-widget.component.ts +235 -0
  33. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/user-panel-widget/user-panel-widget.component.html +54 -0
  34. package/projects/bayan-core-ui/src/lib/top-menu-widget/components/user-panel-widget/user-panel-widget.component.ts +140 -0
  35. package/projects/bayan-core-ui/src/lib/top-menu-widget/top-menu-widget.component.html +107 -0
  36. package/projects/bayan-core-ui/src/lib/top-menu-widget/top-menu-widget.component.ts +164 -0
  37. package/projects/bayan-core-ui/src/lib/top-menu-widget/top-menu-widget.models.ts +29 -0
  38. package/projects/bayan-core-ui/src/lib/top-menu-widget/top-menu-widget.styles.css +1378 -0
  39. package/projects/bayan-core-ui/src/public-api.ts +14 -0
  40. package/projects/bayan-core-ui/tsconfig.lib.json +16 -0
  41. package/projects/bayan-core-ui/tsconfig.lib.prod.json +9 -0
  42. package/projects/bayan-core-ui/tsconfig.spec.json +13 -0
  43. package/tsconfig.json +40 -0
  44. package/fesm2022/skysoftware-co-bayan-core-widgets-ui.mjs +0 -1092
  45. package/fesm2022/skysoftware-co-bayan-core-widgets-ui.mjs.map +0 -1
  46. package/index.d.ts +0 -6
  47. package/lib/shared/common-methods/navigation.utils.d.ts +0 -4
  48. package/lib/shared/common-methods/navigation.utils.d.ts.map +0 -1
  49. package/lib/shared/menu.dtos.d.ts +0 -91
  50. package/lib/shared/menu.dtos.d.ts.map +0 -1
  51. package/lib/shared/menu.service.d.ts +0 -24
  52. package/lib/shared/menu.service.d.ts.map +0 -1
  53. package/lib/top-menu-widget/components/about-dialog-widget/about-dialog-widget.component.d.ts +0 -18
  54. package/lib/top-menu-widget/components/about-dialog-widget/about-dialog-widget.component.d.ts.map +0 -1
  55. package/lib/top-menu-widget/components/change-password-widget/change-password-widget.component.d.ts +0 -30
  56. package/lib/top-menu-widget/components/change-password-widget/change-password-widget.component.d.ts.map +0 -1
  57. package/lib/top-menu-widget/components/global-search-widget/global-search-widget.component.d.ts +0 -59
  58. package/lib/top-menu-widget/components/global-search-widget/global-search-widget.component.d.ts.map +0 -1
  59. package/lib/top-menu-widget/components/item-widget/item-widget.component.d.ts +0 -29
  60. package/lib/top-menu-widget/components/item-widget/item-widget.component.d.ts.map +0 -1
  61. package/lib/top-menu-widget/components/notifications-widget/notifications-widget.component.d.ts +0 -23
  62. package/lib/top-menu-widget/components/notifications-widget/notifications-widget.component.d.ts.map +0 -1
  63. package/lib/top-menu-widget/components/settings-widget/settings-widget.component.d.ts +0 -37
  64. package/lib/top-menu-widget/components/settings-widget/settings-widget.component.d.ts.map +0 -1
  65. package/lib/top-menu-widget/components/user-panel-widget/user-panel-widget.component.d.ts +0 -43
  66. package/lib/top-menu-widget/components/user-panel-widget/user-panel-widget.component.d.ts.map +0 -1
  67. package/lib/top-menu-widget/top-menu-widget.component.d.ts +0 -76
  68. package/lib/top-menu-widget/top-menu-widget.component.d.ts.map +0 -1
  69. package/lib/top-menu-widget/top-menu-widget.models.d.ts +0 -36
  70. package/lib/top-menu-widget/top-menu-widget.models.d.ts.map +0 -1
  71. package/public-api.d.ts +0 -4
  72. package/public-api.d.ts.map +0 -1
  73. package/skysoftware-co-bayan-core-widgets-ui.d.ts.map +0 -1
@@ -0,0 +1,164 @@
1
+ import { BayanCoreTopMenuService } from '../shared/menu.service';
2
+ import { TopMenuShortcut, PropertyOption, SystemModule, EmployeeNamesModeOption } from '../shared/menu.dtos';
3
+ import { CommonModule, DOCUMENT } from '@angular/common';
4
+ import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, inject, signal } from '@angular/core';
5
+ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
6
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
7
+ import { faQuestionCircle } from '@fortawesome/pro-solid-svg-icons';
8
+ import { Router } from '@angular/router';
9
+ import { DxToolbarModule } from 'devextreme-angular';
10
+ import { TranslatePipe } from '@skysoftware-co/sky-components-ui';
11
+ import { isExternalNavigation, resolveUrl } from '../shared/common-methods/navigation.utils';
12
+ import {
13
+ TopMenuWidgetAboutDialogConfig,
14
+ TopMenuWidgetChangePasswordDialogConfig,
15
+ TopMenuWidgetChangePasswordPayload
16
+ } from './top-menu-widget.models';
17
+ import { BayanCoreAboutDialogWidgetComponent } from './components/about-dialog-widget/about-dialog-widget.component';
18
+ import { BayanCoreChangePasswordWidgetComponent } from './components/change-password-widget/change-password-widget.component';
19
+ import { BayanCoreGlobalSearchWidgetComponent } from './components/global-search-widget/global-search-widget.component';
20
+ import { BayanCoreItemWidgetComponent } from './components/item-widget/item-widget.component';
21
+ import { BayanCoreNotificationsWidgetComponent } from './components/notifications-widget/notifications-widget.component';
22
+ import { BayanCoreSettingsWidgetComponent } from './components/settings-widget/settings-widget.component';
23
+ import { BayanCoreUserPanelWidgetComponent } from './components/user-panel-widget/user-panel-widget.component';
24
+
25
+ @Component({
26
+ selector: 'bayan-core-top-menu-widget',
27
+ standalone: true,
28
+ imports: [
29
+ CommonModule,
30
+ DxToolbarModule,
31
+ FontAwesomeModule,
32
+ TranslatePipe,
33
+ BayanCoreItemWidgetComponent,
34
+ BayanCoreGlobalSearchWidgetComponent,
35
+ BayanCoreUserPanelWidgetComponent,
36
+ BayanCoreSettingsWidgetComponent,
37
+ BayanCoreNotificationsWidgetComponent,
38
+ ],
39
+ templateUrl: './top-menu-widget.component.html',
40
+ styleUrls: ['./top-menu-widget.styles.css'],
41
+ changeDetection: ChangeDetectionStrategy.OnPush,
42
+ })
43
+ export class BayanCoreTopMenuWidgetComponent implements OnInit {
44
+ globalSearchWidget?: BayanCoreGlobalSearchWidgetComponent;
45
+ private readonly document = inject(DOCUMENT);
46
+ private readonly router = inject(Router);
47
+ private readonly menuService = inject(BayanCoreTopMenuService);
48
+
49
+ openDropdownIndex: number|null = null;
50
+
51
+ @Input() baseUrl = '';
52
+ @Input() systemModule : SystemModule | null =null;
53
+ menuItems: TopMenuShortcut[] = [];
54
+
55
+ @Input() sidebarCollapsed = false;
56
+ @Input() homeUrl: string | null = null;
57
+ @Input() logoUrl = 'https://cdn-dev.skysoftware.cloud/bayan/images/logo-enterprise-dark.png';
58
+ @Input() collapsedLogoUrl = 'https://cdn-dev.skysoftware.cloud/bayan/images/logo-collapsed.png';
59
+ @Output() logoClick = new EventEmitter<void>();
60
+
61
+ @Input() isSsoLogin = false;
62
+
63
+ // Removed useInternalDialogs and all related logic
64
+
65
+ @Input() showGlobalSearch = true;
66
+ @Input() showUserPanel = true;
67
+ @Input() showSettings = true;
68
+ @Input() showShortcutMenus = true;
69
+ @Input() showNotifications = true;
70
+ @Input() notificationsTitle = 'Notifications';
71
+
72
+ @Input() showHelp = true;
73
+ @Input() helpTitle = 'Help';
74
+ @Input() helpUrl: string | null = 'https://docs.bayan.solutions/Bayan/index.html';
75
+ @Input() helpIcon: IconDefinition = faQuestionCircle;
76
+ @Input() helpAnchorClass = 'menu-icon-btn';
77
+ @Input() helpUrlTarget: '_self' | '_blank' | string = '_blank';
78
+ @Input() licenseUrl = '';
79
+ @Input() releaseNotesUrl = '';
80
+ @Input() supportUrl = 'https://skyits.com/contact';
81
+
82
+ @Output() helpClick = new EventEmitter<void>();
83
+ @Output() menuItemClick = new EventEmitter<TopMenuShortcut>();
84
+ @Output() searchSubmit = new EventEmitter<string>();
85
+ @Output() propertyChanged = new EventEmitter<PropertyOption>();
86
+ @Output() signOutClick = new EventEmitter<void>();
87
+ @Output() alternateNamesChange = new EventEmitter<boolean>();
88
+ @Output() employeeNameModeChange = new EventEmitter<EmployeeNamesModeOption>();
89
+
90
+ readonly aboutVisible = signal(false);
91
+ readonly changePasswordVisible = signal(false);
92
+
93
+ ActivePropertyChanged = false;
94
+ ActivePropertyId: number = 0;
95
+
96
+ ngOnInit(): void {
97
+ this.loadShortcutMenus();
98
+ }
99
+
100
+ ngOnChanges(changes: any): void {
101
+ if (
102
+ (changes['baseUrl'] && !changes['baseUrl'].firstChange && changes['baseUrl'].previousValue !== changes['baseUrl'].currentValue) ||
103
+ (changes['ActivePropertyId'] && !changes['ActivePropertyId'].firstChange && changes['ActivePropertyId'].previousValue !== changes['ActivePropertyId'].currentValue) ||
104
+ (changes['systemModule'] && !changes['systemModule'].firstChange && changes['systemModule'].previousValue !== changes['systemModule'].currentValue)
105
+ ) {
106
+ this.globalSearchWidget?.reset();
107
+ }
108
+ }
109
+
110
+ onEmployeeNameModeChange(event: any): void {
111
+ this.employeeNameModeChange.emit(event);
112
+ }
113
+
114
+ getLogoSrc(): string | null {
115
+ if (this.sidebarCollapsed) {
116
+ return this.collapsedLogoUrl || null;
117
+ }
118
+
119
+ return this.logoUrl || null;
120
+ }
121
+
122
+ onLogoClicked(event?: Event): void {
123
+ event?.preventDefault();
124
+ if(this.homeUrl){
125
+ window.location.href = this.homeUrl;
126
+ return;
127
+ }
128
+
129
+ this.logoClick.emit();
130
+ }
131
+
132
+ onHelpClicked(event?: Event): void {
133
+ event?.preventDefault();
134
+ if(this.helpUrl){
135
+ window.open(this.helpUrl, this.helpUrlTarget);
136
+ return;
137
+ }
138
+ this.helpClick.emit();
139
+ }
140
+
141
+ onPropertyChanged(property: PropertyOption): void {
142
+ this.ActivePropertyChanged = !this.ActivePropertyChanged;
143
+ this.ActivePropertyId = property.PropertyId;
144
+ this.loadShortcutMenus();
145
+ this.propertyChanged.emit(property);
146
+ }
147
+
148
+ private loadShortcutMenus(): void {
149
+ this.menuItems=[];
150
+ if(!this.showShortcutMenus) return;
151
+ if(!this.baseUrl) return;
152
+ if(!this.systemModule) return;
153
+
154
+ if (this.ActivePropertyId > 0) {
155
+ this.menuService.getMicroserviceTopMenusShortcut(this.baseUrl, this.ActivePropertyId, this.systemModule)
156
+ .subscribe({
157
+ next: (menus: any) => this.menuItems = menus ?? [],
158
+ error: () => this.menuItems = []
159
+ });
160
+ } else {
161
+ this.menuItems = [];
162
+ }
163
+ }
164
+ }
@@ -0,0 +1,29 @@
1
+ import { SystemModule } from '../shared/menu.dtos';
2
+
3
+ export interface TopMenuWidgetAboutDialogConfig {
4
+ title?: string;
5
+ logoUrl?: string;
6
+ version?: string;
7
+ versionLabel?: string;
8
+ copyright?: string;
9
+ statusLabel?: string;
10
+ licenseButtonLabel?: string;
11
+ releaseNotesButtonLabel?: string;
12
+ supportButtonLabel?: string;
13
+ closeButtonLabel?: string;
14
+ }
15
+
16
+ export interface TopMenuWidgetChangePasswordPayload {
17
+ currentPassword: string;
18
+ newPassword: string;
19
+ confirmNewPassword: string;
20
+ }
21
+
22
+ export interface TopMenuWidgetChangePasswordDialogConfig {
23
+ title: string;
24
+ currentPasswordLabel: string;
25
+ newPasswordLabel: string;
26
+ confirmNewPasswordLabel: string;
27
+ primaryButtonText: string;
28
+ }
29
+