@corp-products/ui-components 3.5.8 → 3.6.0

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 (148) hide show
  1. package/.storybook/main.ts +12 -0
  2. package/debug-storybook.log +53 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +25 -36
  5. package/src/enums/date-formatter.ts +22 -0
  6. package/src/helper/date-handler.ts +142 -0
  7. package/src/lib/alert-dialog/alert-dialog.component.html +22 -0
  8. package/src/lib/alert-dialog/alert-dialog.component.scss +0 -0
  9. package/src/lib/alert-dialog/alert-dialog.component.spec.ts +22 -0
  10. package/src/lib/alert-dialog/alert-dialog.component.ts +44 -0
  11. package/src/lib/alert-dialog/alert-dialog.interface.ts +6 -0
  12. package/src/lib/alert-dialog/alert-dialog.service.ts +33 -0
  13. package/src/lib/app-accordion/app-accordion.component.html +15 -0
  14. package/src/lib/app-accordion/app-accordion.component.scss +0 -0
  15. package/src/lib/app-accordion/app-accordion.component.spec.ts +21 -0
  16. package/src/lib/app-accordion/app-accordion.component.ts +21 -0
  17. package/src/lib/app-accordion/index.ts +2 -0
  18. package/src/lib/app-breadcrumb/app-breadcrumb.component.html +7 -0
  19. package/src/lib/app-breadcrumb/app-breadcrumb.component.scss +25 -0
  20. package/src/lib/app-breadcrumb/app-breadcrumb.component.ts +140 -0
  21. package/src/lib/app-breadcrumb/app-breadcrumb.interface.ts +15 -0
  22. package/src/lib/app-button/app-button.component.html +7 -0
  23. package/src/lib/app-button/app-button.component.scss +0 -0
  24. package/src/lib/app-button/app-button.component.ts +14 -0
  25. package/src/lib/app-button/app-button.ts +15 -0
  26. package/src/lib/app-button/index.ts +2 -0
  27. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.html +22 -0
  28. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.scss +39 -0
  29. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.spec.ts +21 -0
  30. package/src/lib/app-dropdown-menu/app-dropdown-menu.component.ts +43 -0
  31. package/src/lib/app-dropdown-menu/app-dropdown-menu.ts +17 -0
  32. package/src/lib/app-dropdown-menu/index.ts +2 -0
  33. package/src/lib/app-dropdown-menu/menu-popup.pipe.ts +18 -0
  34. package/src/lib/app-header/app-header.component.html +26 -0
  35. package/src/lib/app-header/app-header.component.scss +0 -0
  36. package/src/lib/app-header/app-header.component.ts +43 -0
  37. package/src/lib/app-side-menu/app-side-menu.component.html +20 -0
  38. package/src/lib/app-side-menu/app-side-menu.component.ts +28 -0
  39. package/src/lib/app-side-menu/routes-names.ts +28 -0
  40. package/src/lib/app-side-menu/side-menu-items.ts +45 -0
  41. package/src/lib/app-side-menu/side-menu.ts +12 -0
  42. package/src/lib/app-tabs/app-tab.interface.ts +27 -0
  43. package/src/lib/app-tabs/app-tabs.component.html +37 -0
  44. package/src/lib/app-tabs/app-tabs.component.scss +103 -0
  45. package/src/lib/app-tabs/app-tabs.component.spec.ts +21 -0
  46. package/src/lib/app-tabs/app-tabs.component.ts +67 -0
  47. package/src/lib/app-tabs/index.ts +2 -0
  48. package/src/lib/bottom-sheet/bottom-sheet.component.html +18 -0
  49. package/src/lib/bottom-sheet/bottom-sheet.component.scss +31 -0
  50. package/src/lib/bottom-sheet/bottom-sheet.component.ts +26 -0
  51. package/src/lib/confirmation-dialog/confirmation-dialog.component.html +37 -0
  52. package/src/lib/confirmation-dialog/confirmation-dialog.component.scss +0 -0
  53. package/src/lib/confirmation-dialog/confirmation-dialog.component.spec.ts +22 -0
  54. package/src/lib/confirmation-dialog/confirmation-dialog.component.ts +64 -0
  55. package/src/lib/confirmation-dialog/confirmation-dialog.interface.ts +13 -0
  56. package/src/lib/confirmation-dialog/confirmation-dialog.service.ts +34 -0
  57. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.html +27 -0
  58. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.scss +22 -0
  59. package/src/lib/dual-calender/date-picker-switcher/date-picker-switcher.component.ts +64 -0
  60. package/src/lib/dual-calender/dual-calendar.component.html +30 -0
  61. package/src/lib/dual-calender/dual-calendar.component.scss +265 -0
  62. package/src/lib/dual-calender/dual-calendar.component.ts +157 -0
  63. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.html +21 -0
  64. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.scss +0 -0
  65. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.spec.ts +21 -0
  66. package/src/lib/dual-calender/gregorian-calendar/gregorian-calendar.component.ts +65 -0
  67. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.html +10 -0
  68. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.scss +0 -0
  69. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.spec.ts +21 -0
  70. package/src/lib/dual-calender/hijri-calendar/hijri-calendar.component.ts +66 -0
  71. package/src/lib/dual-calender/services/gregorian-i18n.service.ts +123 -0
  72. package/src/lib/dual-calender/services/islamic-i18n.service.ts +119 -0
  73. package/src/lib/dual-calender/utils/date-i18n.utils.ts +58 -0
  74. package/src/lib/dynamic-form/dynamic-form.component.html +84 -0
  75. package/src/lib/dynamic-form/dynamic-form.component.scss +0 -0
  76. package/src/lib/dynamic-form/dynamic-form.component.spec.ts +21 -0
  77. package/src/lib/dynamic-form/dynamic-form.component.ts +58 -0
  78. package/src/lib/dynamic-form/dynamic-form.interface.ts +96 -0
  79. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.html +32 -0
  80. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.scss +3 -0
  81. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.component.ts +82 -0
  82. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.config.ts +31 -0
  83. package/src/lib/dynamic-side-bar-v2/dynamic-sidebar.service.ts +41 -0
  84. package/src/lib/form-components/@utils/form-utils.ts +12 -0
  85. package/src/lib/form-components/@utils/validations/error-keys.enum.ts +25 -0
  86. package/src/lib/form-components/@utils/validations/form-validation.service.ts +68 -0
  87. package/src/lib/form-components/@utils/validations/index.ts +4 -0
  88. package/src/lib/form-components/@utils/validations/numbers-only.validator.ts +10 -0
  89. package/src/lib/form-components/@utils/validations/validation-message.pipe.ts +24 -0
  90. package/src/lib/form-components/components/auto-complete/auto-complete.component.html +35 -0
  91. package/src/lib/form-components/components/auto-complete/auto-complete.component.scss +12 -0
  92. package/src/lib/form-components/components/auto-complete/auto-complete.component.spec.ts +21 -0
  93. package/src/lib/form-components/components/auto-complete/auto-complete.component.ts +82 -0
  94. package/src/lib/form-components/components/base-input.component.ts +35 -0
  95. package/src/lib/form-components/components/date-picker/date-picker.component.html +40 -0
  96. package/src/lib/form-components/components/date-picker/date-picker.component.scss +32 -0
  97. package/src/lib/form-components/components/date-picker/date-picker.component.spec.ts +21 -0
  98. package/src/lib/form-components/components/date-picker/date-picker.component.ts +81 -0
  99. package/src/lib/form-components/components/date-picker/date-picker.validator.ts +38 -0
  100. package/src/lib/form-components/components/input/input.component.html +80 -0
  101. package/src/lib/form-components/components/input/input.component.scss +46 -0
  102. package/src/lib/form-components/components/input/input.component.spec.ts +21 -0
  103. package/src/lib/form-components/components/input/input.component.ts +56 -0
  104. package/src/lib/form-components/components/select/select.component.html +123 -0
  105. package/src/lib/form-components/components/select/select.component.scss +53 -0
  106. package/src/lib/form-components/components/select/select.component.spec.ts +21 -0
  107. package/src/lib/form-components/components/select/select.component.ts +87 -0
  108. package/src/lib/form-components/components/select-button/select-button.component.html +21 -0
  109. package/src/lib/form-components/components/select-button/select-button.component.scss +0 -0
  110. package/src/lib/form-components/components/select-button/select-button.component.spec.ts +21 -0
  111. package/src/lib/form-components/components/select-button/select-button.component.ts +22 -0
  112. package/src/lib/form-components/components/switcher/switch.component.html +5 -0
  113. package/src/lib/form-components/components/switcher/switch.component.scss +0 -0
  114. package/src/lib/form-components/components/switcher/switch.component.spec.ts +21 -0
  115. package/src/lib/form-components/components/switcher/switch.component.ts +25 -0
  116. package/src/lib/form-components/index.ts +9 -0
  117. package/src/lib/form-components/interfaces/index.ts +1 -0
  118. package/src/lib/form-components/interfaces/label-value.ts +4 -0
  119. package/src/lib/ico-moon-icon/ico-moon-icon.component.ts +23 -0
  120. package/src/lib/read-more/read-more.component.html +17 -0
  121. package/src/lib/read-more/read-more.component.scss +0 -0
  122. package/src/lib/read-more/read-more.component.spec.ts +21 -0
  123. package/src/lib/read-more/read-more.component.ts +21 -0
  124. package/src/lib/side-bar/side-bar.component.html +24 -0
  125. package/src/lib/side-bar/side-bar.component.scss +22 -0
  126. package/src/lib/side-bar/side-bar.component.spec.ts +21 -0
  127. package/src/lib/side-bar/side-bar.component.ts +33 -0
  128. package/src/lib/side-bar-dynamic/data-injector.pipe.ts +15 -0
  129. package/src/lib/side-bar-dynamic/dynamic-sidebar.service.ts +116 -0
  130. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.html +42 -0
  131. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.scss +5 -0
  132. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.spec.ts +21 -0
  133. package/src/lib/side-bar-dynamic/side-bar-dynamic.component.ts +37 -0
  134. package/src/lib/side-bar-dynamic/side-bar-utils.ts +30 -0
  135. package/src/lib/side-bar-dynamic/sidebar-config.ts +48 -0
  136. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.html +20 -0
  137. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.scss +0 -0
  138. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.spec.ts +21 -0
  139. package/src/lib/user-autocomplete-card/user-autocomplete-card.component.ts +21 -0
  140. package/src/lib/user-info/user-info.component.html +10 -0
  141. package/src/lib/user-info/user-info.component.ts +11 -0
  142. package/src/public-api.ts +29 -0
  143. package/tsconfig.lib.json +18 -0
  144. package/tsconfig.lib.prod.json +11 -0
  145. package/tsconfig.spec.json +14 -0
  146. package/fesm2022/corp-products-ui-components.mjs +0 -2252
  147. package/fesm2022/corp-products-ui-components.mjs.map +0 -1
  148. package/index.d.ts +0 -720
@@ -0,0 +1,12 @@
1
+ import type { StorybookConfig } from '@storybook/angular';
2
+
3
+ const config: StorybookConfig = {
4
+ stories: ['../src/**/*.stories.ts'],
5
+ addons: ['@storybook/addon-essentials'],
6
+ framework: {
7
+ name: '@storybook/angular',
8
+ options: {},
9
+ },
10
+ };
11
+
12
+ export default config;
@@ -0,0 +1,53 @@
1
+ [14:40:41.151] [INFO] storybook v10.2.1
2
+ [14:40:41.896] [DEBUG] Getting package.json info for D:/stc projects/ui-components/projects/ui-components-lib/package.json...
3
+ [14:40:42.170] [WARN] You are currently using Storybook 10.2.1 but you have packages which are incompatible with it:
4
+
5
+ - @storybook/addon-essentials@8.6.14 which depends on 8.6.14
6
+ Repo: https://github.com/storybookjs/storybook/tree/next/code/addons/essentials
7
+
8
+ Please consider updating your packages or contacting the maintainers for compatibility details.
9
+
10
+ For more details on compatibility guidance, see:
11
+ https://github.com/storybookjs/storybook/issues/32836
12
+ [14:40:42.185] [ERROR] SB_CORE-SERVER_0002 (CriticalPresetLoadError): Storybook failed to load the following preset: @storybook/angular/preset.
13
+
14
+ Please check whether your setup is correct, the Storybook dependencies (and their peer dependencies) are installed correctly and there are no package version clashes.
15
+
16
+ If you believe this is a bug, please open an issue on Github.
17
+
18
+ Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@storybook/angular' imported from C:\Users\digi_\AppData\Local\npm-cache\_npx\6fe9a9991b157df1\node_modules\storybook\dist\_node-chunks\chunk-KYZVFZ4V.js
19
+ at packageResolve (node:internal/modules/esm/resolve:873:9)
20
+ at moduleResolve (node:internal/modules/esm/resolve:946:18)
21
+ at defaultResolve (node:internal/modules/esm/resolve:1188:11)
22
+ at nextResolve (node:internal/modules/esm/hooks:864:28)
23
+ at Hooks.resolve (node:internal/modules/esm/hooks:306:30)
24
+ at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
25
+ at [nodejs.internal.kHybridDispatch] (node:internal/event_target:831:20)
26
+ at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
27
+
28
+ More info:
29
+ 
30
+ at loadPreset (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-R3KAQRS5.js:10081:13)
31
+ at async Promise.all (index 0)
32
+ at async loadPresets (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-R3KAQRS5.js:10090:73)
33
+ at async getPresets (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-R3KAQRS5.js:10121:23)
34
+ at async buildDevStandalone (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/core-server/index.js:7532:17)
35
+ at async withTelemetry (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/_node-chunks/chunk-KNMEGL7N.js:218:12)
36
+ at async dev (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/bin/core.js:2734:3)
37
+ at async _Command.<anonymous> (file:///C:/Users/digi_/AppData/Local/npm-cache/_npx/6fe9a9991b157df1/node_modules/storybook/dist/bin/core.js:2801:92)
38
+ [14:40:42.195] [WARN] Broken build, fix the error above.
39
+ You may need to refresh the browser.
40
+ [14:40:42.436] [WARN] Failed to load preset: {"name":"D:/stc projects/ui-components/projects/ui-components-lib/node_modules/@storybook/addon-essentials/dist/preset.js"} on level 2
41
+ [14:40:42.437] [ERROR] Error: Cannot find module 'storybook/internal/common'
42
+ Require stack:
43
+ - .\node_modules\@storybook\addon-essentials\dist\preset.js
44
+ at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
45
+ at Module._load (node:internal/modules/cjs/loader:1043:27)
46
+ at Module.require (node:internal/modules/cjs/loader:1298:19)
47
+ at require (node:internal/modules/helpers:182:18)
48
+ at Object.<anonymous> (.\node_modules\@storybook\addon-essentials\dist\preset.js:4:14)
49
+ at Module._compile (node:internal/modules/cjs/loader:1529:14)
50
+ at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
51
+ at Module.load (node:internal/modules/cjs/loader:1275:32)
52
+ at Module._load (node:internal/modules/cjs/loader:1096:12)
53
+ at cjsLoader (node:internal/modules/esm/translators:298:15)
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ui-components-lib",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,36 +1,25 @@
1
- {
2
- "name": "@corp-products/ui-components",
3
- "version": "3.5.8",
4
- "author": "shireen Omar",
5
- "description": "shared UI components across our apps",
6
- "peerDependencies": {
7
- "@angular/common": ">=17.0.0 <21.0.0",
8
- "@angular/core": ">=17.0.0 <21.0.0",
9
- "@angular/animations": ">=17.0.0 <21.0.0",
10
- "primeng": ">=17.0.0 <21.0.0",
11
- "@ngx-translate/core": ">=15.0.0 <18.0.0"
12
- },
13
- "keywords": [
14
- "angular",
15
- "library"
16
- ],
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
- "license": "MIT",
21
- "sideEffects": false,
22
- "module": "fesm2022/corp-products-ui-components.mjs",
23
- "typings": "index.d.ts",
24
- "exports": {
25
- "./package.json": {
26
- "default": "./package.json"
27
- },
28
- ".": {
29
- "types": "./index.d.ts",
30
- "default": "./fesm2022/corp-products-ui-components.mjs"
31
- }
32
- },
33
- "dependencies": {
34
- "tslib": "^2.3.0"
35
- }
36
- }
1
+ {
2
+ "name": "@corp-products/ui-components",
3
+ "version": "3.6.0",
4
+ "scripts": {
5
+ "storybook": "npx storybook dev -p 6006"
6
+ },
7
+ "author": "shireen Omar",
8
+ "description": "shared UI components across our apps",
9
+ "peerDependencies": {
10
+ "@angular/animations": ">=17.0.0 <21.0.0",
11
+ "@angular/common": ">=17.0.0 <21.0.0",
12
+ "@angular/core": ">=17.0.0 <21.0.0",
13
+ "@ngx-translate/core": ">=15.0.0 <18.0.0",
14
+ "primeng": ">=17.0.0 <21.0.0"
15
+ },
16
+ "keywords": [
17
+ "angular",
18
+ "library"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "license": "MIT",
24
+ "sideEffects": false
25
+ }
@@ -0,0 +1,22 @@
1
+ export enum DateFormats {
2
+ DATE_ONLY = "yyyy-MM-dd",
3
+ DATE_UTC = "yyyy-MM-dd'T'HH:mm:ss'Z'",
4
+ DATE_TIME_FULL = "dd MMMM yyyy - hh:mm a",
5
+ DATE_TIME_SEMI = "yyyy/MM/dd - hh:mm a",
6
+ DATE = "dd MMMM yyyy",
7
+ DATE_TWO = "yyyy/MM/dd",
8
+ DAY_ONLY = "cccc",
9
+ TIME_ONLY = "hh:mm",
10
+ AM_PM = "a",
11
+ TIME = 'hh:mm a',
12
+ YEAR = 'yyyy',
13
+ MONTH = "MM",
14
+ DAY = "dd"
15
+ }
16
+
17
+ export enum TimeFormats {
18
+ HOURS12Format = "hh",
19
+ HOURS24Format = "HH",
20
+ MINUTES = "mm",
21
+ SECONDS = "ss"
22
+ }
@@ -0,0 +1,142 @@
1
+ import { DateTime, DateTimeMaybeValid, DateTimeOptions, LocaleOptions } from 'luxon';
2
+ import { DateFormats, TimeFormats } from '../enums/date-formatter';
3
+
4
+ export class DateHandler {
5
+ /**
6
+ * @param date `ISO string`
7
+ * @param format `format string`
8
+ * @param localeOptions `opts to override the configuration options on this DateTime` - default is system's locale
9
+ * @param isConvertedToUTC
10
+ * @description Returns a string representation of this DateTime formatted according to the specified format string.
11
+ */
12
+ static formatDate(
13
+ date: string,
14
+ format: DateFormats = DateFormats.DATE_TIME_FULL,
15
+ localeOptions?: LocaleOptions,
16
+ isConvertedToUTC?: boolean
17
+ ): string {
18
+ if (!date) {
19
+ return '';
20
+ }
21
+ return this.getDateTimeFromISO(date, isConvertedToUTC ? { zone: 'utc' } : {})
22
+ ?.toFormat(format, localeOptions)
23
+ .toLocaleString();
24
+ }
25
+
26
+ static getDateTimeFromISO(
27
+ date: string,
28
+ dateTimeOptions: DateTimeOptions = {}
29
+ ): DateTime<true> | DateTime<false> {
30
+ return DateTime.fromISO(date, dateTimeOptions);
31
+ }
32
+
33
+ static getJSDateFromISO(date: string): Date {
34
+ const dateTime = this.getDateTimeFromISO(date, { zone: 'utc' }); // Ensure it's in UTC
35
+ if (!dateTime.isValid) {
36
+ throw new Error('Invalid date format');
37
+ }
38
+ return new Date(
39
+ dateTime.year,
40
+ dateTime.month - 1,
41
+ dateTime.day,
42
+ dateTime.hour,
43
+ dateTime.minute,
44
+ dateTime.second,
45
+ dateTime.millisecond
46
+ );
47
+ }
48
+
49
+ static getUTCDateTime(date: string): string {
50
+ return this.getDateTimeFromISO(date)?.toUTC()?.toISO() as string;
51
+ }
52
+
53
+ static getUTCDateTimeFromJsDate(date: Date): string {
54
+ return this.getDateFromJsDate(new Date(date))?.toUTC()?.toISO() as string;
55
+ }
56
+
57
+ static getCurrentUTCDateTime(): string {
58
+ return DateTime.utc().toISO();
59
+ }
60
+
61
+ static getDateFromJsDate(date: Date): DateTimeMaybeValid {
62
+ return DateTime.fromJSDate(date);
63
+ }
64
+
65
+ static checkIfTwoDatesEqual(startDate: Date, endDate: Date): boolean {
66
+ return DateTime.fromJSDate(startDate).equals(DateTime.fromJSDate(endDate));
67
+ }
68
+
69
+ static getCurrentDateTime() {
70
+ return DateTime;
71
+ }
72
+
73
+ static constructDateTime(date: Date, time: Date, isConvertedToUTC?: boolean) {
74
+ const dateYear = this.getPartialDateOrTime(date, DateFormats.YEAR);
75
+ const dateMonth = this.getPartialDateOrTime(date, DateFormats.MONTH);
76
+ const dateDay = this.getPartialDateOrTime(date, DateFormats.DAY);
77
+
78
+ const dateHours = this.getPartialDateOrTime(time, TimeFormats.HOURS24Format, isConvertedToUTC);
79
+ const dateMinutes = this.getPartialDateOrTime(time, TimeFormats.MINUTES, isConvertedToUTC);
80
+ const dateSeconds = this.getPartialDateOrTime(time, TimeFormats.SECONDS, isConvertedToUTC);
81
+
82
+ return DateTime.utc(+dateYear, +dateMonth, +dateDay, +dateHours, +dateMinutes, +dateSeconds)
83
+ .toUTC()
84
+ .toISO();
85
+ }
86
+
87
+ static getPartialDateOrTime(
88
+ date: Date,
89
+ format: TimeFormats | DateFormats,
90
+ isConvertedToUTC?: boolean
91
+ ) {
92
+ return DateTime.fromJSDate(date, isConvertedToUTC ? { zone: 'utc' } : {}).toFormat(format);
93
+ }
94
+
95
+ static getValueFromJSDate(date: Date, unit: 'year' | 'month' | 'day'): number {
96
+ const dt = DateTime.fromJSDate(date);
97
+ switch (unit) {
98
+ case 'year':
99
+ return dt.year;
100
+ case 'month':
101
+ return dt.month;
102
+ case 'day':
103
+ return dt.day;
104
+ default:
105
+ throw new Error(`Unsupported unit: ${unit}`);
106
+ }
107
+ }
108
+
109
+ static getValueFromLocalDateTime(unit: 'hour' | 'minute' | 'second'): number {
110
+ const now = DateTime.local();
111
+ switch (unit) {
112
+ case 'hour':
113
+ return now.hour;
114
+ case 'minute':
115
+ return now.minute;
116
+ case 'second':
117
+ return now.second;
118
+ default:
119
+ throw new Error(`Unsupported unit: ${unit}`);
120
+ }
121
+ }
122
+
123
+ static getISODateTime(date: Date): string {
124
+ if (!date) {
125
+ throw new Error('Invalid date: date is null or undefined');
126
+ }
127
+
128
+ // Create a DateTime instance from the JS Date, preserving the date parts
129
+ // but using local time for the time parts
130
+ const dt = DateTime.local().set({
131
+ year: DateTime.fromJSDate(date).year,
132
+ month: DateTime.fromJSDate(date).month,
133
+ day: DateTime.fromJSDate(date).day,
134
+ hour: DateTime.local().hour,
135
+ minute: DateTime.local().minute,
136
+ second: DateTime.local().second,
137
+ millisecond: DateTime.local().millisecond,
138
+ });
139
+
140
+ return dt.toISO() as string;
141
+ }
142
+ }
@@ -0,0 +1,22 @@
1
+ @if (dynamicDialogConfig.data) {
2
+ <div class="alert-dialog">
3
+ <div class="dialog-wrapper">
4
+ @if (dynamicDialogConfig.data) {
5
+ <div class="alert-dialog__content my-4">
6
+ @if (dynamicDialogConfig.data.dialogIcon) {
7
+ <em [class]="dynamicDialogConfig.data.dialogIcon"></em>
8
+ }
9
+ <p class="alert-dialog__message mb-2">
10
+ {{ dynamicDialogConfig.data.message }}
11
+ </p>
12
+ </div>
13
+ }
14
+ <div class="alert-dialog__actions flex gap-2 mt-4">
15
+ <app-button [severity]="'primary'" variant="outlined"
16
+ [label]="dynamicDialogConfig.data.cancelBtnLabel??('actions.close' | translate)"
17
+ [id]="dynamicDialogConfig.data.cancelBtnId??'button_close_alert'" [styleClass]="'cancel-btn alert-btn'"
18
+ (click)="close()" />
19
+ </div>
20
+ </div>
21
+ </div>
22
+ }
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+
3
+ import { AlertDialogComponent } from "./alert-dialog.component";
4
+
5
+ describe("SharedAlertDialogComponent", () => {
6
+ let component: AlertDialogComponent;
7
+ let fixture: ComponentFixture<AlertDialogComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [AlertDialogComponent]
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(AlertDialogComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it("should create", () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -0,0 +1,44 @@
1
+ import { Component, DestroyRef, inject, OnInit, ViewEncapsulation } from '@angular/core';
2
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3
+ import { Router } from '@angular/router';
4
+ import { TranslatePipe } from '@ngx-translate/core';
5
+ import { AvatarModule } from 'primeng/avatar';
6
+ import {
7
+ DynamicDialogConfig,
8
+ DynamicDialogModule,
9
+ DynamicDialogRef,
10
+ DynamicDialogStyle
11
+ } from 'primeng/dynamicdialog';
12
+ import { AppButtonComponent } from '../app-button';
13
+ @Component({
14
+ selector: 'app-alert-dialog',
15
+ templateUrl: './alert-dialog.component.html',
16
+ styleUrls: ['./alert-dialog.component.scss'],
17
+ encapsulation: ViewEncapsulation.None,
18
+ standalone: true,
19
+ imports: [
20
+ AppButtonComponent,
21
+ AvatarModule,
22
+ DynamicDialogModule,
23
+ TranslatePipe,
24
+ ],
25
+ providers: [DynamicDialogStyle],
26
+ })
27
+ export class AlertDialogComponent extends DynamicDialogRef implements OnInit {
28
+ private readonly router = inject(Router);
29
+ readonly dynamicDialogConfig = inject(DynamicDialogConfig);
30
+ private readonly _destroyRef = inject(DestroyRef);
31
+ private readonly _ref = inject(DynamicDialogRef);
32
+
33
+ ngOnInit() {
34
+ this.router.events.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
35
+ if (this.dynamicDialogConfig) {
36
+ this._ref.close(false);
37
+ }
38
+ })
39
+ }
40
+
41
+ override close() {
42
+ this._ref.close(false);
43
+ }
44
+ }
@@ -0,0 +1,6 @@
1
+ export interface AlertDialogData {
2
+ header: string;
3
+ message: string;
4
+ cancelBtnId?: string;
5
+ cancelBtnLabel?: string;
6
+ }
@@ -0,0 +1,33 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
3
+ import { Observable, of } from 'rxjs';
4
+ import { filter, map } from 'rxjs/operators';
5
+ import { AlertDialogComponent } from './alert-dialog.component';
6
+ import { AlertDialogData } from './alert-dialog.interface';
7
+
8
+ @Injectable({
9
+ providedIn: 'root',
10
+ })
11
+ export class AlertDialogService {
12
+ private readonly dialogService = inject(DialogService);
13
+
14
+ open(data: AlertDialogData): Observable<boolean> {
15
+ const ref: DynamicDialogRef | null = this.dialogService.open(AlertDialogComponent, {
16
+ data,
17
+ header: data.header,
18
+ showHeader: true,
19
+ width: '600px',
20
+ closable: true,
21
+ modal: true,
22
+ styleClass: 'alert-dialog-wrapper',
23
+ });
24
+ if (!ref) {
25
+ return of(false); // or EMPTY / throwError — depending on your logic
26
+ }
27
+ // Emit true/false when dialog closes
28
+ return ref.onClose.pipe(
29
+ filter((res) => res !== undefined),
30
+ map((res) => !!res)
31
+ );
32
+ }
33
+ }
@@ -0,0 +1,15 @@
1
+ <p-accordion value="0">
2
+ <p-accordion-panel value="0" [class.!border-0]="!accordionPanelBorder">
3
+ <p-accordion-header>
4
+ <span class="flex items-center gap-2 w-full">
5
+ <app-ico-moon-card [iconClass]="'text-[24px] text-secondary'" [iconName]="'font-icon-'+iconName" />
6
+ <span class="font-bold whitespace-nowrap">{{title}}</span>
7
+ </span>
8
+ </p-accordion-header>
9
+ <p-accordion-content>
10
+ <div [ngClass]="{'border-t-2 border-gray-light pt-2': contentBorderTop, }">
11
+ <ng-content></ng-content>
12
+ </div>
13
+ </p-accordion-content>
14
+ </p-accordion-panel>
15
+ </p-accordion>
@@ -0,0 +1,21 @@
1
+ import { ComponentFixture, TestBed } from "@angular/core/testing";
2
+ import { AppAccordionComponent } from "./app-accordion.component";
3
+
4
+ describe("HeaderCardComponent", () => {
5
+ let component: AppAccordionComponent;
6
+ let fixture: ComponentFixture<AppAccordionComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [AppAccordionComponent]
11
+ }).compileComponents();
12
+
13
+ fixture = TestBed.createComponent(AppAccordionComponent);
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 { Component, Input } from "@angular/core";
2
+ import { CommonModule } from "@angular/common";
3
+ import { IcoMoonIconComponent } from '../ico-moon-icon/ico-moon-icon.component';
4
+ import { AccordionModule } from 'primeng/accordion';
5
+ import { DividerModule } from 'primeng/divider';
6
+
7
+ @Component({
8
+ selector: "app-accordion",
9
+ standalone: true,
10
+ imports: [CommonModule, DividerModule, AccordionModule, IcoMoonIconComponent],
11
+ templateUrl: "./app-accordion.component.html",
12
+ styleUrl: "./app-accordion.component.scss"
13
+ })
14
+ export class AppAccordionComponent {
15
+ @Input() iconName!: string;
16
+ @Input() iconClass!: string;
17
+ @Input() iconPathCount = 0;
18
+ @Input({required: true}) title!: string;
19
+ @Input() contentBorderTop: boolean = true;
20
+ @Input() accordionPanelBorder: boolean = true;
21
+ }
@@ -0,0 +1,2 @@
1
+ // export * from './app-button';
2
+ export * from './app-accordion.component';
@@ -0,0 +1,7 @@
1
+ @if(isShown) {
2
+ <nav class="flex gap-x-3 text-[12px] w-full items-center mb-5">
3
+ <div class="card flex justify-center">
4
+ <p-breadcrumb [model]="items"></p-breadcrumb>
5
+ </div>
6
+ </nav>
7
+ }
@@ -0,0 +1,25 @@
1
+ .p-breadcrumb-list {
2
+ li:first-child a {
3
+ @apply text-secondary;
4
+ }
5
+ .p-breadcrumb-separator {
6
+ transform: scale(0.7);
7
+ display: none;
8
+ }
9
+ }
10
+ .p-breadcrumb-item:not(:last-of-type) {
11
+ .p-breadcrumb-item-link {
12
+ padding: 0 4px;
13
+ }
14
+ .p-breadcrumb-item-label {
15
+ @apply text-light_red relative;
16
+ &:hover {
17
+ @apply text-light_red;
18
+ }
19
+ &::before {
20
+ content: '/';
21
+ @apply inline-block absolute text-gray-900;
22
+ inset-inline-end: -9px;
23
+ }
24
+ }
25
+ }