aril 1.2.48 → 1.2.49

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 (134) hide show
  1. package/boot/config/apps/src/interfaces.d.ts +14 -0
  2. package/esm2022/boot/bridge/index.mjs +1 -1
  3. package/esm2022/boot/bridge/src/mfe-bridge.mjs +1 -1
  4. package/esm2022/boot/bridge/src/provide-mfe-bridge.mjs +1 -1
  5. package/esm2022/boot/config/api/index.mjs +1 -1
  6. package/esm2022/boot/config/apps/src/apps.service.mjs +1 -1
  7. package/esm2022/boot/config/apps/src/auth.guard.mjs +1 -1
  8. package/esm2022/boot/config/apps/src/interfaces.mjs +1 -1
  9. package/esm2022/boot/config/apps/src/route-permissions.mjs +1 -1
  10. package/esm2022/boot/config/plugins/src/getNgZone.mjs +1 -1
  11. package/esm2022/boot/config/plugins/src/interfaces.mjs +1 -1
  12. package/esm2022/boot/config/plugins/src/plugins.service.mjs +1 -1
  13. package/esm2022/boot/config/translate/primeng/i18n/tr.mjs +1 -1
  14. package/esm2022/boot/host/src/app.component.mjs +1 -1
  15. package/esm2022/boot/mfe/src/app.component.mjs +13 -13
  16. package/esm2022/boot/mfe/src/bootstrap.mjs +1 -1
  17. package/esm2022/boot/pages/index.mjs +1 -1
  18. package/esm2022/boot/pages/src/forbidden.component.mjs +51 -51
  19. package/esm2022/boot/pages/src/notFound.component.mjs +47 -47
  20. package/esm2022/http/lib/enums.mjs +1 -1
  21. package/esm2022/http/src/serviceBase.mjs +1 -1
  22. package/esm2022/http/src/serviceStateMethods.mjs +1 -1
  23. package/esm2022/keycloak/src/auth.interceptor.mjs +1 -1
  24. package/esm2022/provider/src/prodiveHostRouter.mjs +1 -1
  25. package/esm2022/provider/src/provideHostKeycloak.mjs +1 -1
  26. package/esm2022/superset/index.mjs +1 -1
  27. package/esm2022/theme/layout/app/breadcrumb/app.breadcrumb.component.mjs +1 -1
  28. package/esm2022/theme/layout/app/expandableMenu/expandable-menu.component.mjs +16 -8
  29. package/esm2022/theme/layout/app/general-search/general-search.component.mjs +1 -1
  30. package/esm2022/theme/layout/app/site-map/site-map-sidebar.component.mjs +1 -1
  31. package/esm2022/theme/layout/app/static-sidebar/static-sidebar.component.mjs +19 -11
  32. package/esm2022/theme/layout/index.mjs +1 -1
  33. package/esm2022/theme/layout/service/interfaces/enum.mjs +1 -1
  34. package/esm2022/theme/layout/service/menu-action-confirm.mjs +73 -0
  35. package/esm2022/theme/layout/service/selection-group.service.mjs +1 -1
  36. package/esm2022/ui/autoComplete/src/auto-complete.component.mjs +1 -1
  37. package/esm2022/ui/button/src/button.component.mjs +1 -1
  38. package/esm2022/ui/chip/src/chip.component.mjs +1 -1
  39. package/esm2022/ui/form/src/form-submit-button.component.mjs +3 -3
  40. package/esm2022/ui/table/src/table.component.mjs +3 -3
  41. package/esm2022/ui/table-expand/src/table.component.mjs +3 -3
  42. package/esm2022/ui/treeTable/src/tree-table.component.mjs +1 -1
  43. package/esm2022/ui-business/assetPicker/index.mjs +1 -1
  44. package/esm2022/ui-business/assetPicker/src/asset-picker.component.mjs +3 -3
  45. package/esm2022/ui-business/detailed-overlay-panel/src/detailed-overlay-panel.component.mjs +3 -3
  46. package/esm2022/ui-business/enumPicker/src/interface.mjs +1 -1
  47. package/esm2022/ui-business/multiAssetPicker/index.mjs +1 -1
  48. package/esm2022/ui-business/multiAssetPicker/src/multi-asset-picker.component.mjs +3 -3
  49. package/esm2022/ui-business/pdf-preview-modal/index.mjs +1 -1
  50. package/esm2022/ui-business/pdf-preview-modal/src/open-pdf-preview.mjs +1 -1
  51. package/esm2022/ui-business/pdf-preview-modal/src/pdf-preview-modal.component.mjs +27 -27
  52. package/esm2022/ui-business/ref-value/src/ref-value.component.mjs +3 -3
  53. package/esm2022/ui-business/trace-drawer/index.mjs +1 -1
  54. package/esm2022/ui-business/trace-drawer/src/app-log.service.mjs +1 -1
  55. package/esm2022/ui-business/trace-drawer/src/trace-log.service.mjs +1 -1
  56. package/esm2022/ui-business/trace-id/index.mjs +1 -1
  57. package/esm2022/ui-business/trace-id/src/trace-id.component.mjs +3 -3
  58. package/esm2022/util/activity/index.mjs +1 -1
  59. package/esm2022/util/activity/src/activity.constants.mjs +1 -1
  60. package/esm2022/util/activity/src/activity.service.mjs +1 -1
  61. package/esm2022/util/activity/src/activity.types.mjs +1 -1
  62. package/esm2022/util/directives/src/detail-page-customization/detail-page-customization.directive.mjs +1 -1
  63. package/esm2022/util/pipes/src/translate-json/translate-json.pipe.mjs +1 -1
  64. package/fesm2022/{aril-app.component-YBy2gyza.mjs → aril-app.component-BUjucZ0J.mjs} +13 -13
  65. package/fesm2022/aril-app.component-BUjucZ0J.mjs.map +1 -0
  66. package/fesm2022/aril-boot-bridge.mjs.map +1 -1
  67. package/fesm2022/aril-boot-config-apps.mjs.map +1 -1
  68. package/fesm2022/aril-boot-config-plugins.mjs.map +1 -1
  69. package/fesm2022/aril-boot-config-translate.mjs.map +1 -1
  70. package/fesm2022/aril-boot-host.mjs.map +1 -1
  71. package/fesm2022/{aril-boot-mfe-app.component-GbZAGlTf.mjs → aril-boot-mfe-app.component-D1w8I2ug.mjs} +14 -14
  72. package/fesm2022/aril-boot-mfe-app.component-D1w8I2ug.mjs.map +1 -0
  73. package/fesm2022/{aril-boot-mfe-aril-boot-mfe-I5xT2fQx.mjs → aril-boot-mfe-aril-boot-mfe-JHrhKvhU.mjs} +2 -2
  74. package/fesm2022/aril-boot-mfe-aril-boot-mfe-JHrhKvhU.mjs.map +1 -0
  75. package/fesm2022/aril-boot-mfe.mjs +1 -1
  76. package/fesm2022/aril-boot-pages.mjs +96 -96
  77. package/fesm2022/aril-boot-pages.mjs.map +1 -1
  78. package/fesm2022/aril-http.mjs.map +1 -1
  79. package/fesm2022/aril-keycloak.mjs.map +1 -1
  80. package/fesm2022/aril-provider.mjs.map +1 -1
  81. package/fesm2022/aril-theme-layout.mjs +113 -28
  82. package/fesm2022/aril-theme-layout.mjs.map +1 -1
  83. package/fesm2022/aril-ui-autoComplete.mjs.map +1 -1
  84. package/fesm2022/aril-ui-business-assetPicker.mjs +2 -2
  85. package/fesm2022/aril-ui-business-assetPicker.mjs.map +1 -1
  86. package/fesm2022/aril-ui-business-detailed-overlay-panel.mjs +2 -2
  87. package/fesm2022/aril-ui-business-detailed-overlay-panel.mjs.map +1 -1
  88. package/fesm2022/aril-ui-business-multiAssetPicker.mjs +2 -2
  89. package/fesm2022/aril-ui-business-multiAssetPicker.mjs.map +1 -1
  90. package/fesm2022/aril-ui-business-pdf-preview-modal.mjs +26 -26
  91. package/fesm2022/aril-ui-business-pdf-preview-modal.mjs.map +1 -1
  92. package/fesm2022/aril-ui-business-ref-value.mjs +2 -2
  93. package/fesm2022/aril-ui-business-ref-value.mjs.map +1 -1
  94. package/fesm2022/aril-ui-business-trace-drawer.mjs.map +1 -1
  95. package/fesm2022/aril-ui-business-trace-id.mjs +2 -2
  96. package/fesm2022/aril-ui-business-trace-id.mjs.map +1 -1
  97. package/fesm2022/aril-ui-button.mjs.map +1 -1
  98. package/fesm2022/aril-ui-chip.mjs.map +1 -1
  99. package/fesm2022/aril-ui-form.mjs +2 -2
  100. package/fesm2022/aril-ui-form.mjs.map +1 -1
  101. package/fesm2022/aril-ui-table-expand.mjs +2 -2
  102. package/fesm2022/aril-ui-table-expand.mjs.map +1 -1
  103. package/fesm2022/aril-ui-table.mjs +2 -2
  104. package/fesm2022/aril-ui-table.mjs.map +1 -1
  105. package/fesm2022/aril-ui-treeTable.mjs.map +1 -1
  106. package/fesm2022/aril-util-activity.mjs.map +1 -1
  107. package/fesm2022/aril-util-directives.mjs.map +1 -1
  108. package/fesm2022/aril-util-pipes.mjs.map +1 -1
  109. package/fesm2022/aril.mjs +1 -1
  110. package/fesm2022/aril.mjs.map +1 -1
  111. package/package.json +104 -104
  112. package/theme/layout/app/breadcrumb/app.breadcrumb.component.ts +127 -127
  113. package/theme/layout/app/expandableMenu/expandable-menu.component.d.ts +4 -1
  114. package/theme/layout/app/expandableMenu/expandable-menu.component.html +137 -137
  115. package/theme/layout/app/expandableMenu/expandable-menu.component.ts +387 -373
  116. package/theme/layout/app/general-search/general-search.component.ts +93 -93
  117. package/theme/layout/app/site-map/site-map-sidebar.component.ts +195 -195
  118. package/theme/layout/app/static-sidebar/static-sidebar.component.d.ts +4 -1
  119. package/theme/layout/app/static-sidebar/static-sidebar.component.html +162 -162
  120. package/theme/layout/app/static-sidebar/static-sidebar.component.ts +357 -343
  121. package/theme/layout/index.ts +9 -9
  122. package/theme/layout/service/interfaces/enum.ts +19 -19
  123. package/theme/layout/service/menu-action-confirm.d.ts +15 -0
  124. package/theme/layout/service/menu-action-confirm.ts +112 -0
  125. package/theme/layout/service/selection-group.service.ts +144 -144
  126. package/theme/styles/layout/_fonts.scss +81 -81
  127. package/theme/styles/theme/base/components/input/_inputtext.scss +104 -104
  128. package/theme/styles/theme/base/components/overlay/_sidebar.scss +27 -27
  129. package/theme/styles/theme/base/components/panel/_stepper.scss +205 -205
  130. package/theme/styles/theme/dark/_variables.scss +933 -933
  131. package/theme/styles/theme/light/_variables.scss +940 -940
  132. package/fesm2022/aril-app.component-YBy2gyza.mjs.map +0 -1
  133. package/fesm2022/aril-boot-mfe-app.component-GbZAGlTf.mjs.map +0 -1
  134. package/fesm2022/aril-boot-mfe-aril-boot-mfe-I5xT2fQx.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
- export * from './app/layout/app.layout.component';
2
- export * from './app/layout/mfe.layout.component';
3
- export * from './service/app.menu.service';
4
- export * from './service/selection-group.service';
5
- export * from './service/breadcrumb.service';
6
- export * from './service/app.layout.service';
7
- export * from './app/favorite-pages/favorite-pages.service';
8
- export * from './service/interfaces/enum';
9
- export * from './service/interfaces/interfaces';
1
+ export * from './app/layout/app.layout.component';
2
+ export * from './app/layout/mfe.layout.component';
3
+ export * from './service/app.menu.service';
4
+ export * from './service/selection-group.service';
5
+ export * from './service/breadcrumb.service';
6
+ export * from './service/app.layout.service';
7
+ export * from './app/favorite-pages/favorite-pages.service';
8
+ export * from './service/interfaces/enum';
9
+ export * from './service/interfaces/interfaces';
@@ -1,19 +1,19 @@
1
- export enum LanguageCode {
2
- TR = 'tr',
3
- EN = 'en'
4
- }
5
-
6
- export enum ActivityTypesEnum {
7
- SMS = 'SMS',
8
- EMAIL = 'MAIL'
9
- }
10
-
11
- export enum DetailNotificationTypeEnum {
12
- TODO_ITEM = 'TODO_ITEM',
13
- BATCH_JOB = 'BATCH_JOB'
14
- }
15
-
16
- export enum Environment {
17
- DG = 'dg',
18
- PER = 'per'
19
- }
1
+ export enum LanguageCode {
2
+ TR = 'tr',
3
+ EN = 'en'
4
+ }
5
+
6
+ export enum ActivityTypesEnum {
7
+ SMS = 'SMS',
8
+ EMAIL = 'MAIL'
9
+ }
10
+
11
+ export enum DetailNotificationTypeEnum {
12
+ TODO_ITEM = 'TODO_ITEM',
13
+ BATCH_JOB = 'BATCH_JOB'
14
+ }
15
+
16
+ export enum Environment {
17
+ DG = 'dg',
18
+ PER = 'per'
19
+ }
@@ -0,0 +1,15 @@
1
+ import { ConfirmationService } from 'primeng/api';
2
+ import { TranslocoService } from '@ngneat/transloco';
3
+ import { MenuItemAction } from 'aril/boot/config/apps';
4
+ export interface MenuActionConfirmDeps {
5
+ confirmationService: ConfirmationService;
6
+ translocoService: TranslocoService;
7
+ }
8
+ /**
9
+ * A menu action is a write on the server the moment the item is clicked — a wizard menu item starts
10
+ * a state machine — so confirmation is the default for every method but GET. `confirm: false` opts out.
11
+ */
12
+ export declare function isGetAction(action: MenuItemAction): boolean;
13
+ export declare function menuActionNeedsConfirm(action?: MenuItemAction): boolean;
14
+ /** Runs `accept` directly when no confirmation is needed, otherwise asks first. */
15
+ export declare function confirmMenuAction(deps: MenuActionConfirmDeps, action: MenuItemAction, menuLabel: string, accept: () => void): void;
@@ -0,0 +1,112 @@
1
+ import { ConfirmationService } from 'primeng/api';
2
+
3
+ import { TranslocoService } from '@ngneat/transloco';
4
+
5
+ import { MenuItemAction, MenuItemActionConfirm } from 'aril/boot/config/apps';
6
+
7
+ /** Confirm dialog anchored once in the layout templates (`<p-confirmDialog key="confirmDialog-root" />`). */
8
+ const CONFIRM_DIALOG_KEY = 'confirmDialog-root';
9
+ const HEADER_KEY = 'menuActionConfirmHeader';
10
+ const MESSAGE_KEY = 'menuActionConfirmMessage';
11
+
12
+ /** Used when the host application has not translated the keys above yet. */
13
+ const HEADER_FALLBACK: Record<string, string> = {
14
+ tr: 'İşlem Onayı',
15
+ en: 'Confirm Action'
16
+ };
17
+
18
+ const MESSAGE_FALLBACK: Record<string, string> = {
19
+ tr: '"{{menu}}" süreci başlatılacak. Devam edilsin mi?',
20
+ en: 'The "{{menu}}" process will be started. Do you want to continue?'
21
+ };
22
+
23
+ export interface MenuActionConfirmDeps {
24
+ confirmationService: ConfirmationService;
25
+ translocoService: TranslocoService;
26
+ }
27
+
28
+ /**
29
+ * A menu action is a write on the server the moment the item is clicked — a wizard menu item starts
30
+ * a state machine — so confirmation is the default for every method but GET. `confirm: false` opts out.
31
+ */
32
+ export function isGetAction(action: MenuItemAction): boolean {
33
+ return (action.method ?? '').toUpperCase() === 'GET';
34
+ }
35
+
36
+ export function menuActionNeedsConfirm(action?: MenuItemAction): boolean {
37
+ if (!action) {
38
+ return false;
39
+ }
40
+
41
+ if (action.confirm === false) {
42
+ return false;
43
+ }
44
+
45
+ if (action.confirm) {
46
+ return true;
47
+ }
48
+
49
+ return !isGetAction(action);
50
+ }
51
+
52
+ /** Runs `accept` directly when no confirmation is needed, otherwise asks first. */
53
+ export function confirmMenuAction(
54
+ deps: MenuActionConfirmDeps,
55
+ action: MenuItemAction,
56
+ menuLabel: string,
57
+ accept: () => void
58
+ ): void {
59
+ if (!menuActionNeedsConfirm(action)) {
60
+ accept();
61
+ return;
62
+ }
63
+
64
+ const options: MenuItemActionConfirm = action.confirm && typeof action.confirm === 'object' ? action.confirm : {};
65
+
66
+ deps.confirmationService.confirm({
67
+ key: CONFIRM_DIALOG_KEY,
68
+ header: buildHeader(deps.translocoService, options),
69
+ message: buildMessage(deps.translocoService, options, menuLabel),
70
+ icon: 'pi pi-info-circle',
71
+ acceptLabel: deps.translocoService.translate('acceptButtonLabel'),
72
+ rejectLabel: deps.translocoService.translate('rejectButtonLabel'),
73
+ acceptButtonStyleClass: 'p-button-success',
74
+ rejectButtonStyleClass: 'p-button-danger',
75
+ accept
76
+ });
77
+ }
78
+
79
+ function buildHeader(translocoService: TranslocoService, options: MenuItemActionConfirm): string {
80
+ const key = options.headerKey ?? HEADER_KEY;
81
+
82
+ return translateOrFallback(translocoService, key, {}, HEADER_FALLBACK);
83
+ }
84
+
85
+ function buildMessage(translocoService: TranslocoService, options: MenuItemActionConfirm, menuLabel: string): string {
86
+ if (options.message) {
87
+ return options.message;
88
+ }
89
+
90
+ const key = options.messageKey ?? MESSAGE_KEY;
91
+
92
+ return translateOrFallback(translocoService, key, { menu: menuLabel }, MESSAGE_FALLBACK);
93
+ }
94
+
95
+ function translateOrFallback(
96
+ translocoService: TranslocoService,
97
+ key: string,
98
+ params: Record<string, string>,
99
+ fallbacks: Record<string, string>
100
+ ): string {
101
+ const translated = translocoService.translate(key, params);
102
+
103
+ // Transloco echoes the key back when it is missing from the host application's dictionary.
104
+ if (translated && translated !== key) {
105
+ return translated;
106
+ }
107
+
108
+ const lang = translocoService.getActiveLang();
109
+ const fallback = fallbacks[lang] ?? fallbacks['en'];
110
+
111
+ return Object.entries(params).reduce((text, [name, value]) => text.split(`{{${name}}}`).join(value), fallback);
112
+ }
@@ -1,144 +1,144 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { Injectable, effect, signal } from '@angular/core';
3
-
4
- import { take } from 'rxjs';
5
-
6
- import { API_CONFIGS } from 'aril/boot/config/api';
7
-
8
- import { SelectionGroupDTO, SelectionGroupVersionDTO, SelectionRequestDTO } from './interfaces/interfaces';
9
-
10
- const STORAGE_KEY = 'selection-groups';
11
-
12
- @Injectable({
13
- providedIn: 'root'
14
- })
15
- export class SelectionGroupService {
16
- selectionGroups = signal<{ [key: string]: SelectionGroupDTO | null }>({});
17
-
18
- private loading = new Map<string, boolean>();
19
- private loaded = new Map<string, boolean>();
20
-
21
- constructor(private http: HttpClient) {
22
- this.loadStatesFromLocalStorage();
23
- this.revalidateCachedGroups();
24
-
25
- effect(() => {
26
- try {
27
- const encodedData = btoa(encodeURI(JSON.stringify(this.selectionGroups())));
28
- localStorage.setItem(STORAGE_KEY, encodedData);
29
- } catch (e) {
30
- // Kota dolduysa ya da depolama kapalıysa yalnızca önbellek kaybolur; gruplar sunucudan çekilmeye devam eder.
31
- console.warn('Selection groups could not be cached', e);
32
- }
33
- });
34
- }
35
-
36
- private async loadStatesFromLocalStorage() {
37
- const selectionGroups = localStorage.getItem(STORAGE_KEY);
38
-
39
- if (selectionGroups) {
40
- try {
41
- const decodedData = decodeURI(atob(selectionGroups));
42
- this.selectionGroups.set(JSON.parse(decodedData));
43
- } catch (e) {
44
- console.error(e);
45
- }
46
- }
47
- }
48
-
49
- /**
50
- * Önbellek kendi başına bayatlar: bir grubun etiketi sunucuda değiştiğinde localStorage'daki
51
- * kopya güncellenmez ve kullanıcı eski etiketi süresiz görür. Bu yüzden açılışta grup sürümleri
52
- * okunur ve yalnız değişenler düşürülür; düşen grubu bileşenlerin mevcut "grup yoksa fetchEnum"
53
- * yolu yeniden çeker.
54
- *
55
- * Sürüm listesi alınamazsa önbelleğe DOKUNULMAZ: davranış bu durumda bugünküne eşitlenir,
56
- * yani tazelik kaybedilir ama hiçbir etiket kaybolmaz.
57
- */
58
- private revalidateCachedGroups() {
59
- if (!Object.keys(this.selectionGroups()).length) return;
60
-
61
- this.http
62
- .get<SelectionGroupVersionDTO[]>(this.hostApi() + '/selection-group/versions')
63
- .pipe(take(1))
64
- .subscribe({
65
- next: (versions) => {
66
- // Gövdesiz/biçimsiz yanıt "sürüm bilinmiyor" demektir; hata yolundaki gibi önbellek korunur.
67
- if (!Array.isArray(versions)) return;
68
- this.dropStaleGroups(versions);
69
- },
70
- error: () => {
71
- console.debug('Selection group versions unavailable; cached groups are kept as is.');
72
- }
73
- });
74
- }
75
-
76
- private dropStaleGroups(versions: SelectionGroupVersionDTO[]) {
77
- const serverVersions = new Map(versions.map((version) => [version.groupName, version.version]));
78
-
79
- this.selectionGroups.update((groups) => {
80
- const next = { ...groups };
81
- let dropped = false;
82
-
83
- for (const key of Object.keys(next)) {
84
- const group = next[key];
85
- if (!group) continue;
86
-
87
- // Yalnız localStorage'dan gelen girdiler doğrulanır. Bu oturumda istenmiş bir grup zaten
88
- // tazedir ve düşürülmemelidir: tüketiciler kendi "istedim" kaydını tuttuğu için (bkz.
89
- // TableComponent.requestedEnumKeys) düşen grubu yeniden istemezler ve seçenekleri
90
- // kalıcı olarak boş kalır. `has`, süren istekleri de kapsar: fetchEnum başlarken false,
91
- // biterken true yazar.
92
- if (this.loaded.has(key)) continue;
93
-
94
- // Anahtar `groupName~parentSelectionKey` biçimindedir: aynı grubun her parent varyantı
95
- // ayrı bir girdidir ve grup değiştiğinde hepsi birlikte düşmelidir.
96
- const serverVersion = serverVersions.get(key.split('~')[0]);
97
-
98
- // Sunucu yalnız Fixed grupların sürümünü döndürür. Sürümü gelmeyen grup ya Dynamic'tir
99
- // (içeriği sorgudan üretilir, doğrulanamaz) ya da silinmiştir; ikisinde de tutulmaz.
100
- if (serverVersion !== undefined && serverVersion === group.version) continue;
101
-
102
- delete next[key];
103
- dropped = true;
104
- }
105
-
106
- return dropped ? next : groups;
107
- });
108
- }
109
-
110
- fetchEnum(groupName: string, parentSelectionKey: string = 'ALL') {
111
- const key = groupName + '~' + parentSelectionKey;
112
-
113
- if (this.loaded.get(key) || this.loading.get(key)) return;
114
-
115
- const payload: SelectionRequestDTO = {
116
- groupName,
117
- parentSelectionKey
118
- };
119
-
120
- this.loading.set(key, true);
121
- this.loaded.set(key, false);
122
-
123
- this.http
124
- .post<SelectionGroupDTO>(this.hostApi() + '/selection-group/load', payload)
125
- .pipe(take(1))
126
- .subscribe((selectionGroup) => {
127
- this.loading.set(key, false);
128
- this.loaded.set(key, true);
129
-
130
- this.selectionGroups.update((groups) => ({
131
- ...groups,
132
- [key]: selectionGroup
133
- }));
134
- });
135
- }
136
-
137
- private hostApi(): string {
138
- return API_CONFIGS.api.replace(/\/[^\/]+\/v1$/, `/host/v1`);
139
- }
140
-
141
- isLoading(groupName: string): boolean {
142
- return this.loading.get(groupName) ?? false;
143
- }
144
- }
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Injectable, effect, signal } from '@angular/core';
3
+
4
+ import { take } from 'rxjs';
5
+
6
+ import { API_CONFIGS } from 'aril/boot/config/api';
7
+
8
+ import { SelectionGroupDTO, SelectionGroupVersionDTO, SelectionRequestDTO } from './interfaces/interfaces';
9
+
10
+ const STORAGE_KEY = 'selection-groups';
11
+
12
+ @Injectable({
13
+ providedIn: 'root'
14
+ })
15
+ export class SelectionGroupService {
16
+ selectionGroups = signal<{ [key: string]: SelectionGroupDTO | null }>({});
17
+
18
+ private loading = new Map<string, boolean>();
19
+ private loaded = new Map<string, boolean>();
20
+
21
+ constructor(private http: HttpClient) {
22
+ this.loadStatesFromLocalStorage();
23
+ this.revalidateCachedGroups();
24
+
25
+ effect(() => {
26
+ try {
27
+ const encodedData = btoa(encodeURI(JSON.stringify(this.selectionGroups())));
28
+ localStorage.setItem(STORAGE_KEY, encodedData);
29
+ } catch (e) {
30
+ // Kota dolduysa ya da depolama kapalıysa yalnızca önbellek kaybolur; gruplar sunucudan çekilmeye devam eder.
31
+ console.warn('Selection groups could not be cached', e);
32
+ }
33
+ });
34
+ }
35
+
36
+ private async loadStatesFromLocalStorage() {
37
+ const selectionGroups = localStorage.getItem(STORAGE_KEY);
38
+
39
+ if (selectionGroups) {
40
+ try {
41
+ const decodedData = decodeURI(atob(selectionGroups));
42
+ this.selectionGroups.set(JSON.parse(decodedData));
43
+ } catch (e) {
44
+ console.error(e);
45
+ }
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Önbellek kendi başına bayatlar: bir grubun etiketi sunucuda değiştiğinde localStorage'daki
51
+ * kopya güncellenmez ve kullanıcı eski etiketi süresiz görür. Bu yüzden açılışta grup sürümleri
52
+ * okunur ve yalnız değişenler düşürülür; düşen grubu bileşenlerin mevcut "grup yoksa fetchEnum"
53
+ * yolu yeniden çeker.
54
+ *
55
+ * Sürüm listesi alınamazsa önbelleğe DOKUNULMAZ: davranış bu durumda bugünküne eşitlenir,
56
+ * yani tazelik kaybedilir ama hiçbir etiket kaybolmaz.
57
+ */
58
+ private revalidateCachedGroups() {
59
+ if (!Object.keys(this.selectionGroups()).length) return;
60
+
61
+ this.http
62
+ .get<SelectionGroupVersionDTO[]>(this.hostApi() + '/selection-group/versions')
63
+ .pipe(take(1))
64
+ .subscribe({
65
+ next: (versions) => {
66
+ // Gövdesiz/biçimsiz yanıt "sürüm bilinmiyor" demektir; hata yolundaki gibi önbellek korunur.
67
+ if (!Array.isArray(versions)) return;
68
+ this.dropStaleGroups(versions);
69
+ },
70
+ error: () => {
71
+ console.debug('Selection group versions unavailable; cached groups are kept as is.');
72
+ }
73
+ });
74
+ }
75
+
76
+ private dropStaleGroups(versions: SelectionGroupVersionDTO[]) {
77
+ const serverVersions = new Map(versions.map((version) => [version.groupName, version.version]));
78
+
79
+ this.selectionGroups.update((groups) => {
80
+ const next = { ...groups };
81
+ let dropped = false;
82
+
83
+ for (const key of Object.keys(next)) {
84
+ const group = next[key];
85
+ if (!group) continue;
86
+
87
+ // Yalnız localStorage'dan gelen girdiler doğrulanır. Bu oturumda istenmiş bir grup zaten
88
+ // tazedir ve düşürülmemelidir: tüketiciler kendi "istedim" kaydını tuttuğu için (bkz.
89
+ // TableComponent.requestedEnumKeys) düşen grubu yeniden istemezler ve seçenekleri
90
+ // kalıcı olarak boş kalır. `has`, süren istekleri de kapsar: fetchEnum başlarken false,
91
+ // biterken true yazar.
92
+ if (this.loaded.has(key)) continue;
93
+
94
+ // Anahtar `groupName~parentSelectionKey` biçimindedir: aynı grubun her parent varyantı
95
+ // ayrı bir girdidir ve grup değiştiğinde hepsi birlikte düşmelidir.
96
+ const serverVersion = serverVersions.get(key.split('~')[0]);
97
+
98
+ // Sunucu yalnız Fixed grupların sürümünü döndürür. Sürümü gelmeyen grup ya Dynamic'tir
99
+ // (içeriği sorgudan üretilir, doğrulanamaz) ya da silinmiştir; ikisinde de tutulmaz.
100
+ if (serverVersion !== undefined && serverVersion === group.version) continue;
101
+
102
+ delete next[key];
103
+ dropped = true;
104
+ }
105
+
106
+ return dropped ? next : groups;
107
+ });
108
+ }
109
+
110
+ fetchEnum(groupName: string, parentSelectionKey: string = 'ALL') {
111
+ const key = groupName + '~' + parentSelectionKey;
112
+
113
+ if (this.loaded.get(key) || this.loading.get(key)) return;
114
+
115
+ const payload: SelectionRequestDTO = {
116
+ groupName,
117
+ parentSelectionKey
118
+ };
119
+
120
+ this.loading.set(key, true);
121
+ this.loaded.set(key, false);
122
+
123
+ this.http
124
+ .post<SelectionGroupDTO>(this.hostApi() + '/selection-group/load', payload)
125
+ .pipe(take(1))
126
+ .subscribe((selectionGroup) => {
127
+ this.loading.set(key, false);
128
+ this.loaded.set(key, true);
129
+
130
+ this.selectionGroups.update((groups) => ({
131
+ ...groups,
132
+ [key]: selectionGroup
133
+ }));
134
+ });
135
+ }
136
+
137
+ private hostApi(): string {
138
+ return API_CONFIGS.api.replace(/\/[^\/]+\/v1$/, `/host/v1`);
139
+ }
140
+
141
+ isLoading(groupName: string): boolean {
142
+ return this.loading.get(groupName) ?? false;
143
+ }
144
+ }
@@ -1,81 +1,81 @@
1
- /* poppins-regular - latin */
2
- @font-face {
3
- font-family: 'Poppins';
4
- font-style: normal;
5
- font-weight: 400;
6
- src:
7
- local(''),
8
- url('../../fonts/poppins-v20-latin-regular.woff2') format('woff2'),
9
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
10
- }
11
- /* poppins-500 - latin */
12
- @font-face {
13
- font-family: 'Poppins';
14
- font-style: normal;
15
- font-weight: 500;
16
- src:
17
- local(''),
18
- url('../../fonts/poppins-v20-latin-500.woff2') format('woff2'),
19
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
20
- }
21
- /* poppins-600 - latin */
22
- @font-face {
23
- font-family: 'Poppins';
24
- font-style: normal;
25
- font-weight: 600;
26
- src:
27
- local(''),
28
- url('../../fonts/poppins-v20-latin-600.woff2') format('woff2'),
29
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-600.woff') format('woff');
30
- }
31
- /* poppins-700 - latin */
32
- @font-face {
33
- font-family: 'Poppins';
34
- font-style: normal;
35
- font-weight: 700;
36
- src:
37
- local(''),
38
- url('../../fonts/poppins-v20-latin-700.woff2') format('woff2'),
39
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-700.woff') format('woff');
40
- }
41
-
42
- @font-face {
43
- font-family: 'Inter';
44
- font-style: normal;
45
- font-weight: 400;
46
- src:
47
- local(''),
48
- url('../../fonts/Inter/woff/Inter18pt-Regular.woff2') format('woff2'),
49
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
50
- }
51
-
52
-
53
- @font-face {
54
- font-family: 'Inter';
55
- font-style: normal;
56
- font-weight: 500;
57
- src:
58
- local(''),
59
- url('../../fonts/Inter/woff/Inter18pt-Medium.woff2') format('woff2'),
60
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Medium.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
61
- }
62
-
63
- @font-face {
64
- font-family: 'Inter';
65
- font-style: normal;
66
- font-weight: 600;
67
- src:
68
- local(''),
69
- url('../../fonts/Inter/woff/Inter18pt-SemiBold.woff2') format('woff2'),
70
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-SemiBold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
71
- }
72
-
73
- @font-face {
74
- font-family: 'Inter';
75
- font-style: normal;
76
- font-weight: 700;
77
- src:
78
- local(''),
79
- url('../../fonts/Inter/woff/Inter18pt-Bold.woff2') format('woff2'),
80
- /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Bold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
81
- }
1
+ /* poppins-regular - latin */
2
+ @font-face {
3
+ font-family: 'Poppins';
4
+ font-style: normal;
5
+ font-weight: 400;
6
+ src:
7
+ local(''),
8
+ url('../../fonts/poppins-v20-latin-regular.woff2') format('woff2'),
9
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
10
+ }
11
+ /* poppins-500 - latin */
12
+ @font-face {
13
+ font-family: 'Poppins';
14
+ font-style: normal;
15
+ font-weight: 500;
16
+ src:
17
+ local(''),
18
+ url('../../fonts/poppins-v20-latin-500.woff2') format('woff2'),
19
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-500.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
20
+ }
21
+ /* poppins-600 - latin */
22
+ @font-face {
23
+ font-family: 'Poppins';
24
+ font-style: normal;
25
+ font-weight: 600;
26
+ src:
27
+ local(''),
28
+ url('../../fonts/poppins-v20-latin-600.woff2') format('woff2'),
29
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-600.woff') format('woff');
30
+ }
31
+ /* poppins-700 - latin */
32
+ @font-face {
33
+ font-family: 'Poppins';
34
+ font-style: normal;
35
+ font-weight: 700;
36
+ src:
37
+ local(''),
38
+ url('../../fonts/poppins-v20-latin-700.woff2') format('woff2'),
39
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/poppins-v20-latin-700.woff') format('woff');
40
+ }
41
+
42
+ @font-face {
43
+ font-family: 'Inter';
44
+ font-style: normal;
45
+ font-weight: 400;
46
+ src:
47
+ local(''),
48
+ url('../../fonts/Inter/woff/Inter18pt-Regular.woff2') format('woff2'),
49
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Regular.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
50
+ }
51
+
52
+
53
+ @font-face {
54
+ font-family: 'Inter';
55
+ font-style: normal;
56
+ font-weight: 500;
57
+ src:
58
+ local(''),
59
+ url('../../fonts/Inter/woff/Inter18pt-Medium.woff2') format('woff2'),
60
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Medium.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
61
+ }
62
+
63
+ @font-face {
64
+ font-family: 'Inter';
65
+ font-style: normal;
66
+ font-weight: 600;
67
+ src:
68
+ local(''),
69
+ url('../../fonts/Inter/woff/Inter18pt-SemiBold.woff2') format('woff2'),
70
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-SemiBold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
71
+ }
72
+
73
+ @font-face {
74
+ font-family: 'Inter';
75
+ font-style: normal;
76
+ font-weight: 700;
77
+ src:
78
+ local(''),
79
+ url('../../fonts/Inter/woff/Inter18pt-Bold.woff2') format('woff2'),
80
+ /* Chrome 26+, Opera 23+, Firefox 39+ */ url('../../fonts/Inter/woff/Inter18pt-Bold.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
81
+ }