@ojiepermana/angular-navigation 22.0.43 → 22.0.45
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/README.md +9 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-BQgpBy1I.mjs +432 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-BY-DXx81.mjs +569 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-CACN0O3T.mjs +637 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-SK1lXswT.mjs +423 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-SlMGlTuA.mjs +2225 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +3 -3
- package/fesm2022/ojiepermana-angular-navigation.mjs +1 -4022
- package/package.json +2 -2
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ElementRef, input, output, computed, signal, Component } from '@angular/core';
|
|
4
|
+
import { IconComponent } from '@ojiepermana/angular-component/icon';
|
|
5
|
+
import { cn } from '@ojiepermana/angular-component/utils';
|
|
6
|
+
import { N as NavigationEntryGridComponent } from './ojiepermana-angular-navigation-navigation-entry-grid.component-BY-DXx81.mjs';
|
|
7
|
+
import { N as NavigationItemComponent, a as NavigationItemContentComponent } from './ojiepermana-angular-navigation-ojiepermana-angular-navigation-SlMGlTuA.mjs';
|
|
8
|
+
import { NavigationService } from '@ojiepermana/angular-navigation/service';
|
|
9
|
+
|
|
10
|
+
class NavigationHorizontalComponent {
|
|
11
|
+
nav = inject(NavigationService);
|
|
12
|
+
host = inject(ElementRef);
|
|
13
|
+
navId = input('default', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "navId" }] : /* istanbul ignore next */ []));
|
|
15
|
+
items = input([], /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
17
|
+
/** Posisi bar terhadap konten: `bottom` membuka panel ke atas; selain itu ke bawah. */
|
|
18
|
+
position = input('top', /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
20
|
+
typeStyle = input('flat', /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "typeStyle" }] : /* istanbul ignore next */ []));
|
|
22
|
+
compact = input(false, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
24
|
+
itemClass = input('', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "itemClass" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/** Kelas Tailwind untuk container `<li>` group navbar. */
|
|
27
|
+
groupClass = input('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "groupClass" }] : /* istanbul ignore next */ []));
|
|
29
|
+
activeIds = input(new Set(), /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "activeIds" }] : /* istanbul ignore next */ []));
|
|
31
|
+
activeUrl = input(null, /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "activeUrl" }] : /* istanbul ignore next */ []));
|
|
33
|
+
iconTemplate = input(undefined, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []));
|
|
35
|
+
collapseTree = input('stairs', /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "collapseTree" }] : /* istanbul ignore next */ []));
|
|
37
|
+
openedIds = input([], /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "openedIds" }] : /* istanbul ignore next */ []));
|
|
39
|
+
openedIdsChange = output();
|
|
40
|
+
itemSelected = output();
|
|
41
|
+
isBorderRail = computed(() => this.typeStyle() === 'border-rail', /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "isBorderRail" }] : /* istanbul ignore next */ []));
|
|
43
|
+
isBottom = computed(() => this.position() === 'bottom', /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "isBottom" }] : /* istanbul ignore next */ []));
|
|
45
|
+
/** Kelas tambahan untuk NavigationItem leaf di row saat style border-rail aktif. */
|
|
46
|
+
navItemClass = computed(() => cn(this.itemClass(), this.isBorderRail() && 'rounded-none hover:bg-transparent hover:text-primary'), /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "navItemClass" }] : /* istanbul ignore next */ []));
|
|
48
|
+
listClasses = computed(() => cn('flex h-full min-w-0 items-center justify-center gap-1 list-none p-0'), /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "listClasses" }] : /* istanbul ignore next */ []));
|
|
50
|
+
isItemActive(item) {
|
|
51
|
+
return this.nav.isItemActive(item, this.activeIds(), this.activeUrl());
|
|
52
|
+
}
|
|
53
|
+
isPanelOpen(item) {
|
|
54
|
+
return this.nav.isPanelOpen(this.navId(), item);
|
|
55
|
+
}
|
|
56
|
+
togglePanel(item) {
|
|
57
|
+
if (!this.isPanelOpen(item)) {
|
|
58
|
+
this.measurePanelPlacement();
|
|
59
|
+
}
|
|
60
|
+
this.nav.togglePanel(this.navId(), item);
|
|
61
|
+
}
|
|
62
|
+
onWindowResize() {
|
|
63
|
+
if (this.nav.currentPanelKey(this.navId())) {
|
|
64
|
+
this.measurePanelPlacement();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** Klik di luar menubar/panel menutup panel mega yang sedang terbuka. */
|
|
68
|
+
onDocumentClick(event) {
|
|
69
|
+
if (!this.nav.currentPanelKey(this.navId())) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const target = event.target;
|
|
73
|
+
if (target && !this.host.nativeElement.contains(target)) {
|
|
74
|
+
this.nav.closePanel(this.navId());
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Lebar & posisi kiri panel mengikuti container parent dari `Navigation`
|
|
79
|
+
* (wrapper display:contents dilewati). `null` = pengukuran tak tersedia dan
|
|
80
|
+
* panel jatuh ke lebar host (inset-x-0).
|
|
81
|
+
*/
|
|
82
|
+
panelPlacement = signal(null, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "panelPlacement" }] : /* istanbul ignore next */ []));
|
|
84
|
+
measurePanelPlacement() {
|
|
85
|
+
const hostEl = this.host.nativeElement;
|
|
86
|
+
const navEl = hostEl.closest('[data-navigation-id]');
|
|
87
|
+
let container = navEl?.parentElement ?? hostEl.parentElement;
|
|
88
|
+
while (container && container.getBoundingClientRect().width <= 0 && container.parentElement) {
|
|
89
|
+
container = container.parentElement;
|
|
90
|
+
}
|
|
91
|
+
const containerRect = (container ?? hostEl).getBoundingClientRect();
|
|
92
|
+
const hostRect = hostEl.getBoundingClientRect();
|
|
93
|
+
if (containerRect.width <= 0) {
|
|
94
|
+
this.panelPlacement.set(null);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.panelPlacement.set({
|
|
98
|
+
left: containerRect.left - hostRect.left,
|
|
99
|
+
width: containerRect.width,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
compactLabel(item) {
|
|
103
|
+
return this.nav.compactLabel(item, this.compact());
|
|
104
|
+
}
|
|
105
|
+
titleFor(item) {
|
|
106
|
+
return this.nav.titleFor(item, this.compact());
|
|
107
|
+
}
|
|
108
|
+
/** Container `<li>` group navbar; consumer atur lewat `nav-group-class` atau `item.classes.container`. */
|
|
109
|
+
groupContainerClasses(item) {
|
|
110
|
+
return cn(this.groupClass(), item.classes?.container);
|
|
111
|
+
}
|
|
112
|
+
triggerClasses(item) {
|
|
113
|
+
return cn('nav-trigger nav-text group/nav inline-flex min-w-0 items-center gap-3 rounded-md font-medium transition-colors', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50', 'h-9 px-3 py-2', this.compact() && 'w-10 justify-center px-0', this.isBorderRail()
|
|
114
|
+
? this.isPanelOpen(item) || this.isItemActive(item)
|
|
115
|
+
? 'rounded-none text-primary'
|
|
116
|
+
: 'rounded-none text-foreground/80 hover:text-primary'
|
|
117
|
+
: this.isItemActive(item)
|
|
118
|
+
? 'bg-accent text-accent-foreground'
|
|
119
|
+
: 'text-foreground/80 hover:bg-accent hover:text-accent-foreground', item.classes?.wrapper, this.itemClass());
|
|
120
|
+
}
|
|
121
|
+
chevronClasses(item) {
|
|
122
|
+
return cn('ml-auto shrink-0 self-center transition-transform duration-200', this.isPanelOpen(item) && 'rotate-90');
|
|
123
|
+
}
|
|
124
|
+
panelClasses() {
|
|
125
|
+
// Panel mega selebar container parent, menempel rapat tanpa gap pada sisi bar:
|
|
126
|
+
// nav-position top membuka ke bawah (sisi atas siku), bottom membuka ke atas
|
|
127
|
+
// (sisi bawah siku) sehingga sambungan border selalu menyatu dengan bar.
|
|
128
|
+
// Border-rail: sisi kiri/kanan panel dibiarkan ditangani rail vertikal dari
|
|
129
|
+
// layout; panel hanya menggambar border atas & bawah 1.5px senada rail.
|
|
130
|
+
// Panel dibiarkan pada tepi bawah bar (`top-full`) tanpa offset, sehingga border
|
|
131
|
+
// atasnya sejajar dengan border-bottom bar (mis. yang dipasang consumer).
|
|
132
|
+
return cn('absolute z-50 bg-popover text-popover-foreground shadow-lg',
|
|
133
|
+
// Batasi tinggi ke viewport (dikurangi area bar) lalu scroll vertikal supaya
|
|
134
|
+
// menu dengan item banyak tetap bisa diakses tanpa keluar layar.
|
|
135
|
+
'max-h-[calc(100dvh-5rem)] overflow-x-hidden overflow-y-auto overscroll-contain', this.isBottom() ? 'bottom-full' : 'top-full', !this.panelPlacement() && 'inset-x-0', this.isBorderRail()
|
|
136
|
+
? 'rounded-none border-y-[1.5px] border-border'
|
|
137
|
+
: cn('rounded-xl border border-[hsl(var(--border)/var(--opacity-70))]', this.isBottom() ? 'rounded-b-none' : 'rounded-t-none'));
|
|
138
|
+
}
|
|
139
|
+
onKeydown(event) {
|
|
140
|
+
if (event.key === 'Escape') {
|
|
141
|
+
const panelKey = this.nav.currentPanelKey(this.navId());
|
|
142
|
+
this.nav.closePanel(this.navId());
|
|
143
|
+
this.focusOpenPanelTrigger(panelKey);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const rootItems = this.rootFocusItems();
|
|
147
|
+
if (rootItems.length === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const currentIndex = rootItems.indexOf(document.activeElement);
|
|
151
|
+
if (currentIndex === -1) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
// ArrowDown membuka panel di posisi top; ArrowUp di posisi bottom (panel di atas bar).
|
|
155
|
+
if (event.key === (this.isBottom() ? 'ArrowUp' : 'ArrowDown')) {
|
|
156
|
+
const currentItem = rootItems[currentIndex];
|
|
157
|
+
if (currentItem.getAttribute('aria-haspopup') === 'menu') {
|
|
158
|
+
event.preventDefault();
|
|
159
|
+
currentItem.click();
|
|
160
|
+
queueMicrotask(() => this.focusFirstPanelItem(this.nav.currentPanelKey(this.navId())));
|
|
161
|
+
}
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
const direction = event.key === 'ArrowRight' ? 1 : -1;
|
|
167
|
+
const nextIndex = (currentIndex + direction + rootItems.length) % rootItems.length;
|
|
168
|
+
rootItems[nextIndex]?.focus();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
onPanelKeydown(event) {
|
|
172
|
+
if (event.key !== 'Escape') {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
const panelKey = this.nav.currentPanelKey(this.navId());
|
|
177
|
+
this.nav.closePanel(this.navId());
|
|
178
|
+
this.focusOpenPanelTrigger(panelKey);
|
|
179
|
+
}
|
|
180
|
+
rootFocusItems() {
|
|
181
|
+
return Array.from(this.host.nativeElement.querySelectorAll('[data-navigation-root-item="true"]'));
|
|
182
|
+
}
|
|
183
|
+
focusOpenPanelTrigger(panelKey) {
|
|
184
|
+
if (!panelKey) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
const trigger = this.host.nativeElement.querySelector(`[data-navigation-item-key="${panelKey}"] [data-navigation-root-item="true"]`);
|
|
188
|
+
trigger?.focus();
|
|
189
|
+
}
|
|
190
|
+
focusFirstPanelItem(panelKey) {
|
|
191
|
+
if (!panelKey) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const panel = this.host.nativeElement.querySelector(`[data-navigation-panel="${panelKey}"]`);
|
|
195
|
+
const item = panel?.querySelector('a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])');
|
|
196
|
+
item?.focus();
|
|
197
|
+
}
|
|
198
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NavigationHorizontalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
199
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.4", type: NavigationHorizontalComponent, isStandalone: true, selector: "NavigationHorizontal", inputs: { navId: { classPropertyName: "navId", publicName: "navId", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, typeStyle: { classPropertyName: "typeStyle", publicName: "typeStyle", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, itemClass: { classPropertyName: "itemClass", publicName: "itemClass", isSignal: true, isRequired: false, transformFunction: null }, groupClass: { classPropertyName: "groupClass", publicName: "groupClass", isSignal: true, isRequired: false, transformFunction: null }, activeIds: { classPropertyName: "activeIds", publicName: "activeIds", isSignal: true, isRequired: false, transformFunction: null }, activeUrl: { classPropertyName: "activeUrl", publicName: "activeUrl", isSignal: true, isRequired: false, transformFunction: null }, iconTemplate: { classPropertyName: "iconTemplate", publicName: "iconTemplate", isSignal: true, isRequired: false, transformFunction: null }, collapseTree: { classPropertyName: "collapseTree", publicName: "collapseTree", isSignal: true, isRequired: false, transformFunction: null }, openedIds: { classPropertyName: "openedIds", publicName: "openedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openedIdsChange: "openedIdsChange", itemSelected: "itemSelected" }, host: { listeners: { "window:resize": "onWindowResize()", "document:click": "onDocumentClick($event)" }, classAttribute: "relative block h-full w-full" }, ngImport: i0, template: `
|
|
200
|
+
<ul [class]="listClasses()" role="menubar" (keydown)="onKeydown($event)">
|
|
201
|
+
@for (item of items(); track item.key) {
|
|
202
|
+
@switch (item.type) {
|
|
203
|
+
@case ('group') {
|
|
204
|
+
<ng-container
|
|
205
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
206
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
207
|
+
/>
|
|
208
|
+
}
|
|
209
|
+
@case ('collapsible') {
|
|
210
|
+
<ng-container
|
|
211
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
212
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
213
|
+
/>
|
|
214
|
+
}
|
|
215
|
+
@case ('mega') {
|
|
216
|
+
<ng-container
|
|
217
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
218
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
219
|
+
/>
|
|
220
|
+
}
|
|
221
|
+
@default {
|
|
222
|
+
<li
|
|
223
|
+
NavigationItem
|
|
224
|
+
[navId]="navId()"
|
|
225
|
+
[item]="item"
|
|
226
|
+
[level]="0"
|
|
227
|
+
[orientation]="'horizontal'"
|
|
228
|
+
[compact]="compact()"
|
|
229
|
+
[itemClass]="navItemClass()"
|
|
230
|
+
[activeIds]="activeIds()"
|
|
231
|
+
[activeUrl]="activeUrl()"
|
|
232
|
+
[iconTemplate]="iconTemplate()"
|
|
233
|
+
[collapseTree]="collapseTree()"
|
|
234
|
+
[openedIds]="openedIds()"
|
|
235
|
+
(openedIdsChange)="openedIdsChange.emit($event)"
|
|
236
|
+
(itemSelected)="itemSelected.emit($event)"
|
|
237
|
+
></li>
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
</ul>
|
|
242
|
+
|
|
243
|
+
<ng-template #branchTemplate let-item>
|
|
244
|
+
<li
|
|
245
|
+
role="none"
|
|
246
|
+
[class]="groupContainerClasses(item)"
|
|
247
|
+
[attr.data-navigation-item-key]="item.key"
|
|
248
|
+
>
|
|
249
|
+
<button
|
|
250
|
+
type="button"
|
|
251
|
+
role="menuitem"
|
|
252
|
+
data-navigation-root-item="true"
|
|
253
|
+
[class]="triggerClasses(item)"
|
|
254
|
+
[attr.aria-expanded]="isPanelOpen(item)"
|
|
255
|
+
[attr.aria-controls]="item.panelId"
|
|
256
|
+
[attr.aria-haspopup]="'menu'"
|
|
257
|
+
[attr.aria-label]="compactLabel(item)"
|
|
258
|
+
[attr.title]="titleFor(item)"
|
|
259
|
+
[disabled]="item.disabled || null"
|
|
260
|
+
(click)="togglePanel(item)"
|
|
261
|
+
>
|
|
262
|
+
<NavigationItemContent
|
|
263
|
+
[item]="item"
|
|
264
|
+
[active]="isItemActive(item)"
|
|
265
|
+
[compact]="compact()"
|
|
266
|
+
[orientation]="'horizontal'"
|
|
267
|
+
[level]="0"
|
|
268
|
+
[iconTemplate]="iconTemplate()"
|
|
269
|
+
/>
|
|
270
|
+
<Icon name="chevron_right" [size]="16" [class]="chevronClasses(item)" />
|
|
271
|
+
</button>
|
|
272
|
+
|
|
273
|
+
@if (isPanelOpen(item)) {
|
|
274
|
+
<div
|
|
275
|
+
[id]="item.panelId"
|
|
276
|
+
role="menu"
|
|
277
|
+
[class]="panelClasses()"
|
|
278
|
+
[style.left.px]="panelPlacement()?.left"
|
|
279
|
+
[style.width.px]="panelPlacement()?.width"
|
|
280
|
+
[attr.data-navigation-panel]="item.key"
|
|
281
|
+
(keydown)="onPanelKeydown($event)"
|
|
282
|
+
>
|
|
283
|
+
<NavigationEntryGrid
|
|
284
|
+
[navId]="navId()"
|
|
285
|
+
[branch]="item"
|
|
286
|
+
[typeStyle]="typeStyle()"
|
|
287
|
+
[itemClass]="itemClass()"
|
|
288
|
+
[activeIds]="activeIds()"
|
|
289
|
+
[activeUrl]="activeUrl()"
|
|
290
|
+
[iconTemplate]="iconTemplate()"
|
|
291
|
+
[collapseTree]="collapseTree()"
|
|
292
|
+
[openedIds]="openedIds()"
|
|
293
|
+
(openedIdsChange)="openedIdsChange.emit($event)"
|
|
294
|
+
(itemSelected)="itemSelected.emit($event)"
|
|
295
|
+
/>
|
|
296
|
+
</div>
|
|
297
|
+
}
|
|
298
|
+
</li>
|
|
299
|
+
</ng-template>
|
|
300
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "Icon", inputs: ["name", "class", "size", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: NavigationEntryGridComponent, selector: "NavigationEntryGrid", inputs: ["navId", "branch", "typeStyle", "itemClass", "activeIds", "activeUrl", "iconTemplate", "collapseTree", "openedIds"], outputs: ["openedIdsChange", "itemSelected"] }, { kind: "component", type: NavigationItemComponent, selector: "li[NavigationItem]", inputs: ["navId", "item", "level", "orientation", "compact", "itemClass", "activeIds", "activeUrl", "iconTemplate", "collapseTree", "straightRail", "straightRailActive", "firstInBranch", "lastInBranch", "openedIds"], outputs: ["openedIdsChange", "itemSelected"] }, { kind: "component", type: NavigationItemContentComponent, selector: "NavigationItemContent", inputs: ["item", "active", "compact", "orientation", "level", "collapseTree", "iconTemplate"] }] });
|
|
301
|
+
}
|
|
302
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.4", ngImport: i0, type: NavigationHorizontalComponent, decorators: [{
|
|
303
|
+
type: Component,
|
|
304
|
+
args: [{
|
|
305
|
+
selector: 'NavigationHorizontal',
|
|
306
|
+
imports: [
|
|
307
|
+
NgTemplateOutlet,
|
|
308
|
+
IconComponent,
|
|
309
|
+
NavigationEntryGridComponent,
|
|
310
|
+
NavigationItemComponent,
|
|
311
|
+
NavigationItemContentComponent,
|
|
312
|
+
],
|
|
313
|
+
host: {
|
|
314
|
+
class: 'relative block h-full w-full',
|
|
315
|
+
'(window:resize)': 'onWindowResize()',
|
|
316
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
317
|
+
},
|
|
318
|
+
template: `
|
|
319
|
+
<ul [class]="listClasses()" role="menubar" (keydown)="onKeydown($event)">
|
|
320
|
+
@for (item of items(); track item.key) {
|
|
321
|
+
@switch (item.type) {
|
|
322
|
+
@case ('group') {
|
|
323
|
+
<ng-container
|
|
324
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
325
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
326
|
+
/>
|
|
327
|
+
}
|
|
328
|
+
@case ('collapsible') {
|
|
329
|
+
<ng-container
|
|
330
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
331
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
332
|
+
/>
|
|
333
|
+
}
|
|
334
|
+
@case ('mega') {
|
|
335
|
+
<ng-container
|
|
336
|
+
[ngTemplateOutlet]="branchTemplate"
|
|
337
|
+
[ngTemplateOutletContext]="{ $implicit: item }"
|
|
338
|
+
/>
|
|
339
|
+
}
|
|
340
|
+
@default {
|
|
341
|
+
<li
|
|
342
|
+
NavigationItem
|
|
343
|
+
[navId]="navId()"
|
|
344
|
+
[item]="item"
|
|
345
|
+
[level]="0"
|
|
346
|
+
[orientation]="'horizontal'"
|
|
347
|
+
[compact]="compact()"
|
|
348
|
+
[itemClass]="navItemClass()"
|
|
349
|
+
[activeIds]="activeIds()"
|
|
350
|
+
[activeUrl]="activeUrl()"
|
|
351
|
+
[iconTemplate]="iconTemplate()"
|
|
352
|
+
[collapseTree]="collapseTree()"
|
|
353
|
+
[openedIds]="openedIds()"
|
|
354
|
+
(openedIdsChange)="openedIdsChange.emit($event)"
|
|
355
|
+
(itemSelected)="itemSelected.emit($event)"
|
|
356
|
+
></li>
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
</ul>
|
|
361
|
+
|
|
362
|
+
<ng-template #branchTemplate let-item>
|
|
363
|
+
<li
|
|
364
|
+
role="none"
|
|
365
|
+
[class]="groupContainerClasses(item)"
|
|
366
|
+
[attr.data-navigation-item-key]="item.key"
|
|
367
|
+
>
|
|
368
|
+
<button
|
|
369
|
+
type="button"
|
|
370
|
+
role="menuitem"
|
|
371
|
+
data-navigation-root-item="true"
|
|
372
|
+
[class]="triggerClasses(item)"
|
|
373
|
+
[attr.aria-expanded]="isPanelOpen(item)"
|
|
374
|
+
[attr.aria-controls]="item.panelId"
|
|
375
|
+
[attr.aria-haspopup]="'menu'"
|
|
376
|
+
[attr.aria-label]="compactLabel(item)"
|
|
377
|
+
[attr.title]="titleFor(item)"
|
|
378
|
+
[disabled]="item.disabled || null"
|
|
379
|
+
(click)="togglePanel(item)"
|
|
380
|
+
>
|
|
381
|
+
<NavigationItemContent
|
|
382
|
+
[item]="item"
|
|
383
|
+
[active]="isItemActive(item)"
|
|
384
|
+
[compact]="compact()"
|
|
385
|
+
[orientation]="'horizontal'"
|
|
386
|
+
[level]="0"
|
|
387
|
+
[iconTemplate]="iconTemplate()"
|
|
388
|
+
/>
|
|
389
|
+
<Icon name="chevron_right" [size]="16" [class]="chevronClasses(item)" />
|
|
390
|
+
</button>
|
|
391
|
+
|
|
392
|
+
@if (isPanelOpen(item)) {
|
|
393
|
+
<div
|
|
394
|
+
[id]="item.panelId"
|
|
395
|
+
role="menu"
|
|
396
|
+
[class]="panelClasses()"
|
|
397
|
+
[style.left.px]="panelPlacement()?.left"
|
|
398
|
+
[style.width.px]="panelPlacement()?.width"
|
|
399
|
+
[attr.data-navigation-panel]="item.key"
|
|
400
|
+
(keydown)="onPanelKeydown($event)"
|
|
401
|
+
>
|
|
402
|
+
<NavigationEntryGrid
|
|
403
|
+
[navId]="navId()"
|
|
404
|
+
[branch]="item"
|
|
405
|
+
[typeStyle]="typeStyle()"
|
|
406
|
+
[itemClass]="itemClass()"
|
|
407
|
+
[activeIds]="activeIds()"
|
|
408
|
+
[activeUrl]="activeUrl()"
|
|
409
|
+
[iconTemplate]="iconTemplate()"
|
|
410
|
+
[collapseTree]="collapseTree()"
|
|
411
|
+
[openedIds]="openedIds()"
|
|
412
|
+
(openedIdsChange)="openedIdsChange.emit($event)"
|
|
413
|
+
(itemSelected)="itemSelected.emit($event)"
|
|
414
|
+
/>
|
|
415
|
+
</div>
|
|
416
|
+
}
|
|
417
|
+
</li>
|
|
418
|
+
</ng-template>
|
|
419
|
+
`,
|
|
420
|
+
}]
|
|
421
|
+
}], propDecorators: { navId: [{ type: i0.Input, args: [{ isSignal: true, alias: "navId", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], typeStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "typeStyle", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], itemClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemClass", required: false }] }], groupClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "groupClass", required: false }] }], activeIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeIds", required: false }] }], activeUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeUrl", required: false }] }], iconTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconTemplate", required: false }] }], collapseTree: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapseTree", required: false }] }], openedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "openedIds", required: false }] }], openedIdsChange: [{ type: i0.Output, args: ["openedIdsChange"] }], itemSelected: [{ type: i0.Output, args: ["itemSelected"] }] } });
|
|
422
|
+
|
|
423
|
+
export { NavigationHorizontalComponent };
|