aril 1.2.47 → 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.
- package/boot/config/apps/src/interfaces.d.ts +14 -0
- package/esm2022/boot/bridge/index.mjs +1 -1
- package/esm2022/boot/bridge/src/mfe-bridge.mjs +1 -1
- package/esm2022/boot/bridge/src/provide-mfe-bridge.mjs +1 -1
- package/esm2022/boot/config/api/index.mjs +1 -1
- package/esm2022/boot/config/apps/src/apps.service.mjs +1 -1
- package/esm2022/boot/config/apps/src/auth.guard.mjs +1 -1
- package/esm2022/boot/config/apps/src/interfaces.mjs +1 -1
- package/esm2022/boot/config/apps/src/route-permissions.mjs +1 -1
- package/esm2022/boot/config/plugins/src/getNgZone.mjs +1 -1
- package/esm2022/boot/config/plugins/src/interfaces.mjs +1 -1
- package/esm2022/boot/config/plugins/src/plugins.service.mjs +1 -1
- package/esm2022/boot/config/translate/primeng/i18n/tr.mjs +1 -1
- package/esm2022/boot/host/src/app.component.mjs +1 -1
- package/esm2022/boot/mfe/src/app.component.mjs +13 -13
- package/esm2022/boot/mfe/src/bootstrap.mjs +1 -1
- package/esm2022/boot/pages/index.mjs +1 -1
- package/esm2022/boot/pages/src/forbidden.component.mjs +51 -51
- package/esm2022/boot/pages/src/notFound.component.mjs +47 -47
- package/esm2022/http/lib/enums.mjs +1 -1
- package/esm2022/http/src/serviceBase.mjs +1 -1
- package/esm2022/http/src/serviceStateMethods.mjs +1 -1
- package/esm2022/keycloak/src/auth.interceptor.mjs +1 -1
- package/esm2022/provider/src/prodiveHostRouter.mjs +1 -1
- package/esm2022/provider/src/provideHostKeycloak.mjs +1 -1
- package/esm2022/superset/index.mjs +1 -1
- package/esm2022/theme/layout/app/breadcrumb/app.breadcrumb.component.mjs +1 -1
- package/esm2022/theme/layout/app/expandableMenu/expandable-menu.component.mjs +16 -8
- package/esm2022/theme/layout/app/general-search/general-search.component.mjs +1 -1
- package/esm2022/theme/layout/app/site-map/site-map-sidebar.component.mjs +1 -1
- package/esm2022/theme/layout/app/static-sidebar/static-sidebar.component.mjs +19 -11
- package/esm2022/theme/layout/index.mjs +1 -1
- package/esm2022/theme/layout/service/interfaces/enum.mjs +1 -1
- package/esm2022/theme/layout/service/interfaces/interfaces.mjs +1 -1
- package/esm2022/theme/layout/service/menu-action-confirm.mjs +73 -0
- package/esm2022/theme/layout/service/selection-group.service.mjs +72 -6
- package/esm2022/ui/autoComplete/src/auto-complete.component.mjs +1 -1
- package/esm2022/ui/button/src/button.component.mjs +1 -1
- package/esm2022/ui/chip/src/chip.component.mjs +1 -1
- package/esm2022/ui/form/src/form-submit-button.component.mjs +3 -3
- package/esm2022/ui/table/src/table.component.mjs +3 -3
- package/esm2022/ui/table-expand/src/table.component.mjs +3 -3
- package/esm2022/ui/treeTable/src/tree-table.component.mjs +1 -1
- package/esm2022/ui-business/assetPicker/index.mjs +1 -1
- package/esm2022/ui-business/assetPicker/src/asset-picker.component.mjs +3 -3
- package/esm2022/ui-business/detailed-overlay-panel/src/detailed-overlay-panel.component.mjs +3 -3
- package/esm2022/ui-business/enumPicker/src/interface.mjs +1 -1
- package/esm2022/ui-business/multiAssetPicker/index.mjs +1 -1
- package/esm2022/ui-business/multiAssetPicker/src/multi-asset-picker.component.mjs +3 -3
- package/esm2022/ui-business/pdf-preview-modal/index.mjs +1 -1
- package/esm2022/ui-business/pdf-preview-modal/src/open-pdf-preview.mjs +1 -1
- package/esm2022/ui-business/pdf-preview-modal/src/pdf-preview-modal.component.mjs +27 -27
- package/esm2022/ui-business/ref-value/src/ref-value.component.mjs +3 -3
- package/esm2022/ui-business/trace-drawer/index.mjs +1 -1
- package/esm2022/ui-business/trace-drawer/src/app-log.service.mjs +1 -1
- package/esm2022/ui-business/trace-drawer/src/trace-log.service.mjs +1 -1
- package/esm2022/ui-business/trace-id/index.mjs +1 -1
- package/esm2022/ui-business/trace-id/src/trace-id.component.mjs +3 -3
- package/esm2022/util/activity/index.mjs +1 -1
- package/esm2022/util/activity/src/activity.constants.mjs +1 -1
- package/esm2022/util/activity/src/activity.service.mjs +1 -1
- package/esm2022/util/activity/src/activity.types.mjs +1 -1
- package/esm2022/util/directives/src/detail-page-customization/detail-page-customization.directive.mjs +1 -1
- package/esm2022/util/pipes/src/translate-json/translate-json.pipe.mjs +1 -1
- package/fesm2022/{aril-app.component-YBy2gyza.mjs → aril-app.component-BUjucZ0J.mjs} +13 -13
- package/fesm2022/aril-app.component-BUjucZ0J.mjs.map +1 -0
- package/fesm2022/aril-boot-bridge.mjs.map +1 -1
- package/fesm2022/aril-boot-config-apps.mjs.map +1 -1
- package/fesm2022/aril-boot-config-plugins.mjs.map +1 -1
- package/fesm2022/aril-boot-config-translate.mjs.map +1 -1
- package/fesm2022/aril-boot-host.mjs.map +1 -1
- package/fesm2022/{aril-boot-mfe-app.component-GbZAGlTf.mjs → aril-boot-mfe-app.component-D1w8I2ug.mjs} +14 -14
- package/fesm2022/aril-boot-mfe-app.component-D1w8I2ug.mjs.map +1 -0
- package/fesm2022/{aril-boot-mfe-aril-boot-mfe-I5xT2fQx.mjs → aril-boot-mfe-aril-boot-mfe-JHrhKvhU.mjs} +2 -2
- package/fesm2022/aril-boot-mfe-aril-boot-mfe-JHrhKvhU.mjs.map +1 -0
- package/fesm2022/aril-boot-mfe.mjs +1 -1
- package/fesm2022/aril-boot-pages.mjs +96 -96
- package/fesm2022/aril-boot-pages.mjs.map +1 -1
- package/fesm2022/aril-http.mjs.map +1 -1
- package/fesm2022/aril-keycloak.mjs.map +1 -1
- package/fesm2022/aril-provider.mjs.map +1 -1
- package/fesm2022/aril-theme-layout.mjs +184 -33
- package/fesm2022/aril-theme-layout.mjs.map +1 -1
- package/fesm2022/aril-ui-autoComplete.mjs.map +1 -1
- package/fesm2022/aril-ui-business-assetPicker.mjs +2 -2
- package/fesm2022/aril-ui-business-assetPicker.mjs.map +1 -1
- package/fesm2022/aril-ui-business-detailed-overlay-panel.mjs +2 -2
- package/fesm2022/aril-ui-business-detailed-overlay-panel.mjs.map +1 -1
- package/fesm2022/aril-ui-business-multiAssetPicker.mjs +2 -2
- package/fesm2022/aril-ui-business-multiAssetPicker.mjs.map +1 -1
- package/fesm2022/aril-ui-business-pdf-preview-modal.mjs +26 -26
- package/fesm2022/aril-ui-business-pdf-preview-modal.mjs.map +1 -1
- package/fesm2022/aril-ui-business-ref-value.mjs +2 -2
- package/fesm2022/aril-ui-business-ref-value.mjs.map +1 -1
- package/fesm2022/aril-ui-business-trace-drawer.mjs.map +1 -1
- package/fesm2022/aril-ui-business-trace-id.mjs +2 -2
- package/fesm2022/aril-ui-business-trace-id.mjs.map +1 -1
- package/fesm2022/aril-ui-button.mjs.map +1 -1
- package/fesm2022/aril-ui-chip.mjs.map +1 -1
- package/fesm2022/aril-ui-form.mjs +2 -2
- package/fesm2022/aril-ui-form.mjs.map +1 -1
- package/fesm2022/aril-ui-table-expand.mjs +2 -2
- package/fesm2022/aril-ui-table-expand.mjs.map +1 -1
- package/fesm2022/aril-ui-table.mjs +2 -2
- package/fesm2022/aril-ui-table.mjs.map +1 -1
- package/fesm2022/aril-ui-treeTable.mjs.map +1 -1
- package/fesm2022/aril-util-activity.mjs.map +1 -1
- package/fesm2022/aril-util-directives.mjs.map +1 -1
- package/fesm2022/aril-util-pipes.mjs.map +1 -1
- package/fesm2022/aril.mjs +1 -1
- package/fesm2022/aril.mjs.map +1 -1
- package/package.json +66 -66
- package/theme/layout/app/breadcrumb/app.breadcrumb.component.ts +127 -127
- package/theme/layout/app/expandableMenu/expandable-menu.component.d.ts +4 -1
- package/theme/layout/app/expandableMenu/expandable-menu.component.html +137 -137
- package/theme/layout/app/expandableMenu/expandable-menu.component.ts +387 -373
- package/theme/layout/app/general-search/general-search.component.ts +93 -93
- package/theme/layout/app/site-map/site-map-sidebar.component.ts +195 -195
- package/theme/layout/app/static-sidebar/static-sidebar.component.d.ts +4 -1
- package/theme/layout/app/static-sidebar/static-sidebar.component.html +162 -162
- package/theme/layout/app/static-sidebar/static-sidebar.component.ts +357 -343
- package/theme/layout/index.ts +9 -9
- package/theme/layout/service/interfaces/enum.ts +19 -19
- package/theme/layout/service/interfaces/interfaces.d.ts +7 -0
- package/theme/layout/service/interfaces/interfaces.ts +8 -0
- package/theme/layout/service/menu-action-confirm.d.ts +15 -0
- package/theme/layout/service/menu-action-confirm.ts +112 -0
- package/theme/layout/service/selection-group.service.d.ts +12 -0
- package/theme/layout/service/selection-group.service.ts +78 -7
- package/theme/styles/layout/_fonts.scss +81 -81
- package/theme/styles/theme/base/components/input/_inputtext.scss +104 -104
- package/theme/styles/theme/base/components/overlay/_sidebar.scss +27 -27
- package/theme/styles/theme/base/components/panel/_stepper.scss +205 -205
- package/theme/styles/theme/dark/_variables.scss +933 -933
- package/theme/styles/theme/light/_variables.scss +940 -940
- package/ui/table/src/table.component.d.ts +1 -1
- package/fesm2022/aril-app.component-YBy2gyza.mjs.map +0 -1
- package/fesm2022/aril-boot-mfe-app.component-GbZAGlTf.mjs.map +0 -1
- package/fesm2022/aril-boot-mfe-aril-boot-mfe-I5xT2fQx.mjs.map +0 -1
|
@@ -1,343 +1,357 @@
|
|
|
1
|
-
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
|
-
import { Component, OnDestroy, OnInit, Signal, signal } from '@angular/core';
|
|
4
|
-
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
private
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
private readonly
|
|
65
|
-
private readonly
|
|
66
|
-
private readonly
|
|
67
|
-
private readonly
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
return
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
node.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
1
|
+
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
3
|
+
import { Component, OnDestroy, OnInit, Signal, signal } from '@angular/core';
|
|
4
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
5
|
+
import { FormsModule } from '@angular/forms';
|
|
6
|
+
import { NavigationEnd, Router, RouterLink } from '@angular/router';
|
|
7
|
+
|
|
8
|
+
import { ConfirmationService } from 'primeng/api';
|
|
9
|
+
import { InputTextModule } from 'primeng/inputtext';
|
|
10
|
+
import { ScrollPanelModule } from 'primeng/scrollpanel';
|
|
11
|
+
import { TooltipModule } from 'primeng/tooltip';
|
|
12
|
+
|
|
13
|
+
import { TranslocoModule, TranslocoService } from '@ngneat/transloco';
|
|
14
|
+
import { Subscription, filter } from 'rxjs';
|
|
15
|
+
|
|
16
|
+
import { bridge } from 'aril/boot/bridge';
|
|
17
|
+
import { MenuItemAction, PluginMenuItem } from 'aril/boot/config/apps';
|
|
18
|
+
import { TranslateJsonPipe } from 'aril/util/pipes';
|
|
19
|
+
|
|
20
|
+
import { LayoutService } from '../../service/app.layout.service';
|
|
21
|
+
import { AppMenuService } from '../../service/app.menu.service';
|
|
22
|
+
import { confirmMenuAction, isGetAction } from '../../service/menu-action-confirm';
|
|
23
|
+
|
|
24
|
+
interface MenuNode {
|
|
25
|
+
key: string;
|
|
26
|
+
label: any;
|
|
27
|
+
icon?: string;
|
|
28
|
+
routerLink?: string;
|
|
29
|
+
action?: MenuItemAction;
|
|
30
|
+
children?: MenuNode[];
|
|
31
|
+
expanded: boolean;
|
|
32
|
+
actionLoading?: boolean;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Component({
|
|
36
|
+
standalone: true,
|
|
37
|
+
selector: 'app-static-sidebar',
|
|
38
|
+
imports: [
|
|
39
|
+
RouterLink,
|
|
40
|
+
NgClass,
|
|
41
|
+
NgTemplateOutlet,
|
|
42
|
+
ScrollPanelModule,
|
|
43
|
+
TooltipModule,
|
|
44
|
+
FormsModule,
|
|
45
|
+
TranslocoModule,
|
|
46
|
+
InputTextModule
|
|
47
|
+
],
|
|
48
|
+
templateUrl: './static-sidebar.component.html',
|
|
49
|
+
styleUrl: './static-sidebar.component.scss',
|
|
50
|
+
providers: [TranslateJsonPipe]
|
|
51
|
+
})
|
|
52
|
+
export class StaticSidebarComponent implements OnInit, OnDestroy {
|
|
53
|
+
activeLang: Signal<string>;
|
|
54
|
+
menuNodes = signal<MenuNode[]>([]);
|
|
55
|
+
filteredNodes = signal<MenuNode[]>([]);
|
|
56
|
+
searchTerm = signal<string>('');
|
|
57
|
+
|
|
58
|
+
private routerSubscription: Subscription | null = null;
|
|
59
|
+
private actionSubscription: Subscription | null = null;
|
|
60
|
+
|
|
61
|
+
private readonly MAX_LENGTH = { level0: 25, level1: 20, level2: 16, level3: 13 };
|
|
62
|
+
|
|
63
|
+
constructor(
|
|
64
|
+
private readonly menuService: AppMenuService,
|
|
65
|
+
private readonly router: Router,
|
|
66
|
+
private readonly layoutService: LayoutService,
|
|
67
|
+
private readonly translateJsonPipe: TranslateJsonPipe,
|
|
68
|
+
private readonly translocoService: TranslocoService,
|
|
69
|
+
private readonly http: HttpClient,
|
|
70
|
+
private readonly confirmationService: ConfirmationService
|
|
71
|
+
) {
|
|
72
|
+
this.activeLang = toSignal(this.translocoService.langChanges$, { initialValue: 'tr' });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get isCollapsed(): boolean {
|
|
76
|
+
return this.layoutService.isStaticSidebarCollapsed();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get topLevelNodes(): MenuNode[] {
|
|
80
|
+
return this.menuNodes();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
ngOnInit() {
|
|
84
|
+
this.buildMenuTree();
|
|
85
|
+
this.routerSubscription = this.router.events
|
|
86
|
+
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
87
|
+
.subscribe(() => this.buildMenuTree());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
ngOnDestroy() {
|
|
91
|
+
this.routerSubscription?.unsubscribe();
|
|
92
|
+
this.actionSubscription?.unsubscribe();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
isTextTruncated(label: any, lang: string | null, level = 0): boolean {
|
|
96
|
+
if (!label || !lang || !label[lang]) return false;
|
|
97
|
+
const text = label[lang];
|
|
98
|
+
const len = text.length;
|
|
99
|
+
const limits = [this.MAX_LENGTH.level0, this.MAX_LENGTH.level1, this.MAX_LENGTH.level2, this.MAX_LENGTH.level3];
|
|
100
|
+
return len > limits[Math.min(level, 3)];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
isMobile(): boolean {
|
|
104
|
+
return this.layoutService.isMobile();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
buildMenuTree() {
|
|
108
|
+
const menuItems = this.getMenuItems();
|
|
109
|
+
const nodes = this.convertToMenuNodes(menuItems);
|
|
110
|
+
this.menuNodes.set(nodes);
|
|
111
|
+
this.filteredNodes.set([...nodes]);
|
|
112
|
+
this.expandActiveMenu();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private expandActiveMenu() {
|
|
116
|
+
const nodes = this.menuNodes();
|
|
117
|
+
this.findAndExpandActiveNode(nodes);
|
|
118
|
+
this.filteredNodes.set([...this.filteredNodes()]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
private findAndExpandActiveNode(nodes: MenuNode[]): MenuNode | null {
|
|
122
|
+
for (const node of nodes) {
|
|
123
|
+
if (this.isActiveRouteForNode(node)) {
|
|
124
|
+
return node;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (node.children && node.children.length > 0) {
|
|
128
|
+
const activeChild = this.findAndExpandActiveNode(node.children);
|
|
129
|
+
if (activeChild) {
|
|
130
|
+
// we find active child and then opened its parent nodes
|
|
131
|
+
node.expanded = true;
|
|
132
|
+
return activeChild;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
convertToMenuNodes(items: PluginMenuItem[], parentKey = ''): MenuNode[] {
|
|
140
|
+
return items
|
|
141
|
+
.filter((item) => !item.separator)
|
|
142
|
+
.map((item, index) => {
|
|
143
|
+
const key = parentKey ? `${parentKey}-${index}` : `${index}`;
|
|
144
|
+
const node: MenuNode = {
|
|
145
|
+
key,
|
|
146
|
+
label: item.label,
|
|
147
|
+
icon: item.icon,
|
|
148
|
+
routerLink: item.action ? undefined : item.routerLink,
|
|
149
|
+
action: item.action,
|
|
150
|
+
expanded: false
|
|
151
|
+
};
|
|
152
|
+
if (item.items && item.items.length > 0) {
|
|
153
|
+
node.children = this.convertToMenuNodes(item.items, key);
|
|
154
|
+
}
|
|
155
|
+
return node;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
getMenuItems(): PluginMenuItem[] {
|
|
160
|
+
return bridge.isHostMode() ? bridge.hostMenuItems() : this.menuService.menuItems();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
getLocalText(text: any): string {
|
|
164
|
+
return this.translateJsonPipe.transform(text);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
isActiveRouteForNode(node: MenuNode): boolean {
|
|
168
|
+
if (!node.routerLink) return false;
|
|
169
|
+
const currentUrl = this.router.url;
|
|
170
|
+
const hashUrl = currentUrl.indexOf('#') > -1 ? currentUrl.split('#')[1] : currentUrl;
|
|
171
|
+
if (hashUrl === node.routerLink || hashUrl === '/' + node.routerLink) return true;
|
|
172
|
+
return (
|
|
173
|
+
node.routerLink !== '/' &&
|
|
174
|
+
(hashUrl.startsWith(node.routerLink + '/') || hashUrl.startsWith('/' + node.routerLink + '/'))
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// use on collapsed mode
|
|
179
|
+
isNodeOrChildActive(node: MenuNode): boolean {
|
|
180
|
+
if (this.isActiveRouteForNode(node)) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
if (node.children && node.children.length > 0) {
|
|
184
|
+
return node.children.some((child) => this.isNodeOrChildActive(child));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
isTopLevelNodeActive(node: MenuNode): boolean {
|
|
191
|
+
return this.isNodeOrChildActive(node);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
isChildNodeActive(node: MenuNode): boolean {
|
|
195
|
+
return this.isActiveRouteForNode(node);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
toggleNode(node: MenuNode, level = 0) {
|
|
199
|
+
const wasExpanded = node.expanded;
|
|
200
|
+
if (level === 0) {
|
|
201
|
+
// Diğer ana menüleri kapat
|
|
202
|
+
this.closeOtherTopLevelNodes(node);
|
|
203
|
+
}
|
|
204
|
+
node.expanded = !wasExpanded;
|
|
205
|
+
|
|
206
|
+
this.filteredNodes.set([...this.filteredNodes()]);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
private closeOtherTopLevelNodes(exceptNode: MenuNode) {
|
|
210
|
+
const nodes = this.menuNodes();
|
|
211
|
+
nodes.forEach((node) => {
|
|
212
|
+
if (node !== exceptNode) {
|
|
213
|
+
node.expanded = false;
|
|
214
|
+
this.closeAllChildNodes(node);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private closeAllChildNodes(node: MenuNode) {
|
|
220
|
+
if (node.children) {
|
|
221
|
+
node.children.forEach((child) => {
|
|
222
|
+
child.expanded = false;
|
|
223
|
+
this.closeAllChildNodes(child);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
onMenuItemClick() {
|
|
229
|
+
if (this.isMobile()) {
|
|
230
|
+
this.layoutService.closeMobileMenu();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
this.searchTerm.set('');
|
|
234
|
+
this.filteredNodes.set(this.menuNodes() || []);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
onActionItemClick(node: MenuNode, event: Event) {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
event.stopPropagation();
|
|
240
|
+
|
|
241
|
+
if (!node.action || node.actionLoading) return;
|
|
242
|
+
|
|
243
|
+
confirmMenuAction(
|
|
244
|
+
{ confirmationService: this.confirmationService, translocoService: this.translocoService },
|
|
245
|
+
node.action,
|
|
246
|
+
this.getLocalText(node.label),
|
|
247
|
+
() => this.runActionNode(node)
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
private runActionNode(node: MenuNode): void {
|
|
252
|
+
if (!node.action) return;
|
|
253
|
+
|
|
254
|
+
// Cancel any previous action request
|
|
255
|
+
this.actionSubscription?.unsubscribe();
|
|
256
|
+
|
|
257
|
+
node.actionLoading = true;
|
|
258
|
+
|
|
259
|
+
const request$ =
|
|
260
|
+
isGetAction(node.action) ?
|
|
261
|
+
this.http.get(node.action.url)
|
|
262
|
+
: this.http.post(node.action.url, node.action.body ?? {});
|
|
263
|
+
|
|
264
|
+
this.actionSubscription = request$.subscribe({
|
|
265
|
+
next: (response: any) => {
|
|
266
|
+
node.actionLoading = false;
|
|
267
|
+
const route = this.buildSuccessRoute(node.action!, response);
|
|
268
|
+
this.router.navigate([route]);
|
|
269
|
+
this.onMenuItemClick();
|
|
270
|
+
},
|
|
271
|
+
error: () => {
|
|
272
|
+
node.actionLoading = false;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private buildSuccessRoute(action: MenuItemAction, response: any): string {
|
|
278
|
+
if (!action.successRouteResponseKey) return action.successRoute;
|
|
279
|
+
|
|
280
|
+
const value = this.getValueByPath(response, action.successRouteResponseKey);
|
|
281
|
+
if (value === undefined || value === null) return action.successRoute;
|
|
282
|
+
|
|
283
|
+
return `${action.successRoute}/${value}`;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private getValueByPath(obj: any, path: string): any {
|
|
287
|
+
if (!obj || !path) return undefined;
|
|
288
|
+
|
|
289
|
+
return path.split('.').reduce((current, key) => {
|
|
290
|
+
if (current === undefined || current === null) return undefined;
|
|
291
|
+
|
|
292
|
+
// Handle array access like 'result[0]'
|
|
293
|
+
const arrayMatch = key.match(/^(.+?)\[(\d+)\]$/);
|
|
294
|
+
if (arrayMatch) {
|
|
295
|
+
const arrayKey = arrayMatch[1];
|
|
296
|
+
const index = parseInt(arrayMatch[2], 10);
|
|
297
|
+
return current[arrayKey]?.[index];
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return current[key];
|
|
301
|
+
}, obj);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
onCollapsedItemClick(node: MenuNode) {
|
|
305
|
+
if (this.isCollapsed) {
|
|
306
|
+
this.layoutService.onMenuToggle();
|
|
307
|
+
}
|
|
308
|
+
this.closeOtherTopLevelNodes(node);
|
|
309
|
+
if (node.children && node.children.length > 0) {
|
|
310
|
+
node.expanded = true;
|
|
311
|
+
}
|
|
312
|
+
this.filteredNodes.set([...this.filteredNodes()]);
|
|
313
|
+
if (node.routerLink) {
|
|
314
|
+
this.onMenuItemClick();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
onSearchChange(): void {
|
|
319
|
+
const currentLang = this.translocoService.getActiveLang();
|
|
320
|
+
const currentSearchTerm = this.searchTerm()?.toLocaleLowerCase(currentLang)?.trim();
|
|
321
|
+
if (!currentSearchTerm) {
|
|
322
|
+
this.filteredNodes.set(this.menuNodes() || []);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
this.filteredNodes.set(this.filterNodes(this.menuNodes(), currentSearchTerm));
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
private filterNodes(nodes: MenuNode[], searchTerm: string): MenuNode[] {
|
|
329
|
+
const filtered: MenuNode[] = [];
|
|
330
|
+
const currentLang = this.translocoService.getActiveLang();
|
|
331
|
+
|
|
332
|
+
for (const node of nodes) {
|
|
333
|
+
// Convert label to string for search based on active language
|
|
334
|
+
const labelText =
|
|
335
|
+
typeof node.label === 'string' ?
|
|
336
|
+
node.label
|
|
337
|
+
: (node.label as any)?.[currentLang] || (node.label as any)?.tr || (node.label as any)?.en || '';
|
|
338
|
+
|
|
339
|
+
const matches = labelText.toLocaleLowerCase(currentLang).includes(searchTerm);
|
|
340
|
+
let filteredChildren: MenuNode[] = [];
|
|
341
|
+
|
|
342
|
+
if (node.children) {
|
|
343
|
+
filteredChildren = this.filterNodes(node.children, searchTerm);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (matches || filteredChildren.length > 0) {
|
|
347
|
+
filtered.push({
|
|
348
|
+
...node,
|
|
349
|
+
children: filteredChildren.length > 0 ? filteredChildren : node.children,
|
|
350
|
+
expanded: filteredChildren.length > 0
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
return filtered;
|
|
356
|
+
}
|
|
357
|
+
}
|