shirkasoft-ui-components 1.3.11 → 1.3.12
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 +117 -7
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs +96 -10
- package/fesm2022/shirkasoft-ui-components-rail-sidebar.mjs.map +1 -1
- package/fesm2022/shirkasoft-ui-components-table.mjs +862 -212
- package/fesm2022/shirkasoft-ui-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/shirkasoft-ui-components-rail-sidebar.d.ts +41 -7
- package/types/shirkasoft-ui-components-table.d.ts +305 -41
package/README.md
CHANGED
|
@@ -360,7 +360,7 @@ interface FileUploadError {
|
|
|
360
360
|
|
|
361
361
|
### Table (`shk-table`)
|
|
362
362
|
|
|
363
|
-
Data table with sorting, column filters, global search, pagination, row actions, and header actions. Supports client and server-side mode.
|
|
363
|
+
Data table with sorting, column filter menus (match modes, multiple rules with Match All / Match Any, typed filters), global search, a "Clear" button, optional gridlines with resizable columns (`showGridlines`), pagination, row actions, and header actions. Supports client and server-side mode.
|
|
364
364
|
|
|
365
365
|
```html
|
|
366
366
|
<shk-table
|
|
@@ -381,16 +381,34 @@ Data table with sorting, column filters, global search, pagination, row actions,
|
|
|
381
381
|
|
|
382
382
|
```typescript
|
|
383
383
|
interface Column {
|
|
384
|
-
field: string;
|
|
384
|
+
field: string; // dot paths allowed: 'country.name'
|
|
385
385
|
header: string;
|
|
386
386
|
sortable?: boolean;
|
|
387
387
|
filter?: boolean;
|
|
388
388
|
filterPlaceholder?: string;
|
|
389
|
-
width?: string;
|
|
389
|
+
width?: string; // min width on narrow containers
|
|
390
|
+
minWidth?: string; // min width always (e.g. '12rem')
|
|
390
391
|
defaultSort?: true;
|
|
391
|
-
filterType?: 'text' | 'exact' | 'select';
|
|
392
|
-
filterOptions?: { label: string; value: any }[];
|
|
393
|
-
|
|
392
|
+
filterType?: 'text' | 'exact' | 'numeric' | 'date' | 'select' | 'multiselect' | 'boolean' | 'range';
|
|
393
|
+
filterOptions?: { label: string; value: any; image?: string }[];
|
|
394
|
+
filterField?: string; // property used to filter/sort when different from `field`
|
|
395
|
+
filterMatchMode?: FilterMatchMode;
|
|
396
|
+
showMatchModes?: boolean; // default true for text/numeric/date
|
|
397
|
+
showOperator?: boolean; // "Match All / Match Any", default true for text/numeric/date
|
|
398
|
+
showAddButton?: boolean; // "Add Rule", default true for text/numeric/date
|
|
399
|
+
maxConstraints?: number; // default 2
|
|
400
|
+
filterMenuTitle?: string; // e.g. 'Agent Picker'
|
|
401
|
+
filterMin?: number; // range filter bounds/step (0, 100, 1)
|
|
402
|
+
filterMax?: number;
|
|
403
|
+
filterStep?: number;
|
|
404
|
+
template?: 'text' | 'tag' | 'progress' | 'boolean' | 'date' | 'currency';
|
|
405
|
+
dateFormat?: string; // template 'date', default 'dd/MM/yyyy'
|
|
406
|
+
currency?: string; // template 'currency', default 'USD'
|
|
407
|
+
image?: (row: any) => string | undefined; // avatar/flag before the text
|
|
408
|
+
imageWidth?: number; // default 28
|
|
409
|
+
required?: boolean; // with validateRequired: flags rows where it's empty
|
|
410
|
+
missingMessage?: string; // text in the empty cell (default "Falta <header>")
|
|
411
|
+
isMissing?: (row: any) => boolean; // custom rule (default: null/undefined/blank/[])
|
|
394
412
|
format?: (row: any) => string;
|
|
395
413
|
tagValue?: (row: any) => string;
|
|
396
414
|
tagSeverity?: (row: any) => 'success' | 'danger' | 'warn' | 'info' | undefined;
|
|
@@ -431,8 +449,20 @@ interface PageChangeEvent {
|
|
|
431
449
|
pageCount: number;
|
|
432
450
|
}
|
|
433
451
|
|
|
452
|
+
type FilterMatchMode =
|
|
453
|
+
| 'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' // text
|
|
454
|
+
| 'lt' | 'lte' | 'gt' | 'gte' // numeric
|
|
455
|
+
| 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter' // date
|
|
456
|
+
| 'in' | 'between'; // multiselect / range
|
|
457
|
+
|
|
458
|
+
interface ColumnFilterState {
|
|
459
|
+
operator: 'and' | 'or';
|
|
460
|
+
rules: { matchMode: FilterMatchMode; value: any }[];
|
|
461
|
+
}
|
|
462
|
+
|
|
434
463
|
interface FilterChangeEvent {
|
|
435
|
-
filters: { [key: string]: any };
|
|
464
|
+
filters: { [key: string]: any }; // first active rule value per column
|
|
465
|
+
filterMeta: { [key: string]: ColumnFilterState }; // full state per column
|
|
436
466
|
}
|
|
437
467
|
```
|
|
438
468
|
|
|
@@ -451,6 +481,17 @@ interface FilterChangeEvent {
|
|
|
451
481
|
| `defaultSortOrder` | `number` | `1` |
|
|
452
482
|
| `showSearch` | `boolean` | `true` |
|
|
453
483
|
| `searchPlaceholder` | `string` | `''` |
|
|
484
|
+
| `globalFilterFields` | `string[]` (dot paths) | `[]` (all primitive values) |
|
|
485
|
+
| `showGridlines` | `boolean` | `false` |
|
|
486
|
+
| `validateRequired` | `boolean` | `false` |
|
|
487
|
+
| `resizableColumns` | `boolean` (only with `showGridlines`) | `true` |
|
|
488
|
+
| `columnWidths` | `Record<string, number>` (two-way `[(columnWidths)]`) | `{}` |
|
|
489
|
+
| `stateKey` | `string` (persists column widths) | `''` |
|
|
490
|
+
| `stateStorage` | `'local' \| 'session'` | `'local'` |
|
|
491
|
+
| `rowHover` | `boolean` | `true` |
|
|
492
|
+
| `showClearButton` | `boolean` | `true` |
|
|
493
|
+
| `showPageReport` | `boolean` | `true` |
|
|
494
|
+
| `showRowsPerPage` | `boolean` | `true` |
|
|
454
495
|
| `emptyMessage` | `string` | `''` |
|
|
455
496
|
| `serverSide` | `boolean` | `false` |
|
|
456
497
|
| `totalRecords` | `number` | `0` |
|
|
@@ -470,6 +511,7 @@ interface FilterChangeEvent {
|
|
|
470
511
|
| `searchChange` | `string` |
|
|
471
512
|
| `filterClick` | `string` |
|
|
472
513
|
| `refresh` | `void` |
|
|
514
|
+
| `columnResize` | `{ field: string; width: number \| null }` |
|
|
473
515
|
| `selectionChange` | `any[]` |
|
|
474
516
|
|
|
475
517
|
**Row selection.** With `[selectable]="true"` a leading checkbox column is rendered. The header checkbox selects/deselects the rows of the current page (indeterminate when partially selected); selection persists across pages and is keyed by `dataKey`. While rows are selected, `bulkActions` appear in the header and receive the selected rows. In client mode, rows removed from `data` are dropped from the selection automatically (not while `loading` is true, nor while `data` is still empty before the first load); in server mode, reset it via `[(selection)]` or `clearSelection()`. The selection is independent of the global search and column filters: rows hidden by a filter stay selected and are passed to `bulkActions` too.
|
|
@@ -481,6 +523,61 @@ interface FilterChangeEvent {
|
|
|
481
523
|
|
|
482
524
|
i18n keys used: `table.selected` (`{{count}}`), `table.selectAll`, `table.selectRow` (`{{index}}`), `table.clearSelection`.
|
|
483
525
|
|
|
526
|
+
**Column filters.** Each filterable column shows a filter button that opens a menu:
|
|
527
|
+
|
|
528
|
+
- `text` / `exact` / `numeric` / `date`: match mode selector, up to `maxConstraints` rules combined with *Match All* / *Match Any*, **Add Rule** / **Remove Rule**, and **Clear** / **Apply** buttons. Changes apply on *Apply* or Enter. Text matching ignores case and accents; the default text match mode is `contains` (`equals` for `exact`).
|
|
529
|
+
- `select` / `multiselect`: option list (with optional `image`), applied immediately.
|
|
530
|
+
- `boolean`: tri-state checkbox (any → yes → no), applied immediately.
|
|
531
|
+
- `range`: two-thumb slider between `filterMin` and `filterMax`, applied on release.
|
|
532
|
+
|
|
533
|
+
**Missing data validation.** Opt-in with `[validateRequired]="true"` and mark the mandatory columns with `required: true`. Rows where one of them is empty (`null`, `undefined`, blank text or empty array; `0` and `false` are valid) get a warning background and stripe, a ⚠ icon whose tooltip lists the missing fields, and the empty cell shows "Falta <header>" (or `missingMessage`). The caption shows how many rows are incomplete (whole dataset in client mode, current page in server mode). Use `isMissing: (row) => boolean` for custom rules.
|
|
534
|
+
|
|
535
|
+
```typescript
|
|
536
|
+
cols: Column[] = [
|
|
537
|
+
{ field: 'name', header: 'Nombre', required: true },
|
|
538
|
+
{ field: 'email', header: 'Email', required: true, missingMessage: 'Sin correo' },
|
|
539
|
+
];
|
|
540
|
+
```
|
|
541
|
+
```html
|
|
542
|
+
<shk-table [data]="users" [columns]="cols" [validateRequired]="true" />
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
i18n: `table.missing.{summary, row, cell, column}` (Spanish fallbacks).
|
|
546
|
+
|
|
547
|
+
**Resizable columns.** With `[showGridlines]="true"` each header has a handle on its right border: drag it to widen/narrow the column (minimum 60px; the table scrolls horizontally when it no longer fits), use the arrow keys on it (Shift = 50px steps), or double click it to go back to the automatic width. Disable it with `[resizableColumns]="false"`. Every change emits `columnResize`.
|
|
548
|
+
|
|
549
|
+
To keep the widths, either give the table a `stateKey` (saved in `localStorage` under `<stateKey>:columnWidths`, or `sessionStorage` with `stateStorage="session"`, and restored on load), or bind `[(columnWidths)]` to save them yourself (e.g. in the user's preferences). With both, the stored widths win on load. `resetColumnWidths()` resets every column (and clears the stored state).
|
|
550
|
+
|
|
551
|
+
```html
|
|
552
|
+
<shk-table [data]="customers" [columns]="columns" [showGridlines]="true" stateKey="customers" />
|
|
553
|
+
|
|
554
|
+
<!-- or handle the persistence yourself -->
|
|
555
|
+
<shk-table [data]="customers" [columns]="columns" [showGridlines]="true"
|
|
556
|
+
[(columnWidths)]="widths" (columnResize)="savePreferences()" />
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
The **Clear** button in the caption resets the search, every column filter, the sort and the page. In server mode, `filterChange` carries both the simple `filters` map and the full `filterMeta`.
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
columns: Column[] = [
|
|
563
|
+
{ field: 'name', header: 'Name', filter: true, filterPlaceholder: 'Search by name' },
|
|
564
|
+
{ field: 'agent', header: 'Agent', filter: true, filterType: 'multiselect', filterMenuTitle: 'Agent Picker',
|
|
565
|
+
filterOptions: agents.map((a) => ({ label: a.name, value: a.name, image: a.avatar })), image: (r) => r.avatar },
|
|
566
|
+
{ field: 'date', header: 'Date', filter: true, filterType: 'date', template: 'date' },
|
|
567
|
+
{ field: 'balance', header: 'Balance', filter: true, filterType: 'numeric', template: 'currency', currency: 'USD' },
|
|
568
|
+
{ field: 'status', header: 'Status', filter: true, filterType: 'select', filterOptions: statuses, template: 'tag' },
|
|
569
|
+
{ field: 'activity', header: 'Activity', filter: true, filterType: 'range', template: 'progress' },
|
|
570
|
+
{ field: 'verified', header: 'Verified', filter: true, filterType: 'boolean', template: 'boolean' },
|
|
571
|
+
];
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
```html
|
|
575
|
+
<shk-table [data]="customers" [columns]="columns" [showGridlines]="true"
|
|
576
|
+
[globalFilterFields]="['name', 'country.name', 'agent', 'status']" searchPlaceholder="Search keyword" />
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
Filter i18n keys (built-in Spanish fallbacks when missing): `table.clear`, `table.clearFilters`, `table.resizeColumn`, `table.filter.{matchAll, matchAny, addRule, removeRule, apply, clear, any, selectedCount, yes, no}`, `table.filter.matchModes.<mode>`, `table.{firstPage, prevPage, nextPage, lastPage}`.
|
|
580
|
+
|
|
484
581
|
---
|
|
485
582
|
|
|
486
583
|
### Modal (`shk-modal`)
|
|
@@ -833,6 +930,12 @@ interface RailSidebarItem {
|
|
|
833
930
|
| `labelPipe` | `(label) => string` | identidad (para transloco) |
|
|
834
931
|
| `railWidth` | `string` | `'4.5rem'` |
|
|
835
932
|
| `expandedWidth` | `string` | `'16.5rem'` |
|
|
933
|
+
| `responsive` | `boolean` | `true` — hamburguesa + drawer debajo de `mobileBreakpoint` |
|
|
934
|
+
| `mobileBreakpoint` | `number` | `1024` (px de ancho de ventana) |
|
|
935
|
+
| `mobileOpen` | `boolean` (model) | `false` — drawer abierto en móvil |
|
|
936
|
+
| `showMobileToggle` | `boolean` | `true` — botón hamburguesa propio |
|
|
937
|
+
| `openMenuLabel` | `string` | `'Abrir menú'` |
|
|
938
|
+
| `closeMenuLabel` | `string` | `'Cerrar menú'` |
|
|
836
939
|
|
|
837
940
|
| Output | Type |
|
|
838
941
|
| ----------------- | ---------------------- |
|
|
@@ -843,6 +946,13 @@ interface RailSidebarItem {
|
|
|
843
946
|
| `toggleSidebar` | `void` |
|
|
844
947
|
| `workspaceClick` | `void` |
|
|
845
948
|
|
|
949
|
+
**Móvil.** Con una ventana más angosta que `mobileBreakpoint`, el sidebar no ocupa ancho: muestra un botón hamburguesa (arriba a la izquierda) y el menú completo (rail + panel) se abre como drawer sobre el contenido. Se cierra tocando el fondo, con Escape, con la X del panel o al elegir una opción; mientras está abierto la página no hace scroll. Si tu app ya tiene una barra superior, usa `[showMobileToggle]="false"` y abre/cierra con `[(mobileOpen)]`:
|
|
950
|
+
|
|
951
|
+
```html
|
|
952
|
+
<button class="lg:hidden" (click)="menuOpen.set(true)">☰</button>
|
|
953
|
+
<shk-rail-sidebar [sections]="sections" [showMobileToggle]="false" [(mobileOpen)]="menuOpen" />
|
|
954
|
+
```
|
|
955
|
+
|
|
846
956
|
---
|
|
847
957
|
|
|
848
958
|
### Skeleton (`shk-skeleton`)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, model, output, signal, computed, effect, Component } from '@angular/core';
|
|
2
|
+
import { inject, PLATFORM_ID, Injector, input, model, output, signal, computed, viewChild, effect, untracked, afterNextRender, HostListener, Component } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { LucideMenu, LucideDynamicIcon } from '@lucide/angular';
|
|
4
|
+
import { isPlatformBrowser, CommonModule } from '@angular/common';
|
|
5
|
+
import { LucideMenu, LucideX, LucideDynamicIcon } from '@lucide/angular';
|
|
6
6
|
import { getIcon } from 'shirkasoft-ui-components/utils';
|
|
7
7
|
import { TooltipComponent } from 'shirkasoft-ui-components/tooltip';
|
|
8
8
|
|
|
@@ -11,12 +11,20 @@ import { TooltipComponent } from 'shirkasoft-ui-components/tooltip';
|
|
|
11
11
|
* Authors: Roberto Valladares Martin (Ansem13), Julio César García García (Sanjuli14).
|
|
12
12
|
* Belongs to Shirkasoft.
|
|
13
13
|
*/
|
|
14
|
+
/** Counter used to generate unique element ids per instance. */
|
|
15
|
+
let nextRailId = 0;
|
|
14
16
|
/**
|
|
15
17
|
* Narrow "rail" sidebar that expands into sections. Supports sections, roles,
|
|
16
|
-
* language switching, collapse/expand and responsive tooltips.
|
|
18
|
+
* language switching, collapse/expand and responsive tooltips. Below
|
|
19
|
+
* `mobileBreakpoint` it turns into an off-canvas drawer opened from a
|
|
20
|
+
* hamburger button, so it doesn't take any width from the page.
|
|
17
21
|
*/
|
|
18
22
|
class RailSidebarComponent {
|
|
19
23
|
constructor() {
|
|
24
|
+
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
25
|
+
this.injector = inject(Injector);
|
|
26
|
+
/** Unique id of the drawer (for aria-controls). */
|
|
27
|
+
this.uid = `shk-rail-${nextRailId++}`;
|
|
20
28
|
/** Sections presented as expandable areas of the rail. */
|
|
21
29
|
this.sections = input([], ...(ngDevMode ? [{ debugName: "sections" }] : /* istanbul ignore next */ []));
|
|
22
30
|
/** Current location url used to detect the active section/item. */
|
|
@@ -49,6 +57,21 @@ class RailSidebarComponent {
|
|
|
49
57
|
this.collapseTooltip = input('Colapsar', ...(ngDevMode ? [{ debugName: "collapseTooltip" }] : /* istanbul ignore next */ []));
|
|
50
58
|
/** Tooltip for expanding the sidebar. */
|
|
51
59
|
this.expandTooltip = input('Expandir', ...(ngDevMode ? [{ debugName: "expandTooltip" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/** Turns the sidebar into a hamburger + drawer below `mobileBreakpoint`. */
|
|
61
|
+
this.responsive = input(true, ...(ngDevMode ? [{ debugName: "responsive" }] : /* istanbul ignore next */ []));
|
|
62
|
+
/** Viewport width (px) under which the mobile drawer is used. */
|
|
63
|
+
this.mobileBreakpoint = input(1024, ...(ngDevMode ? [{ debugName: "mobileBreakpoint" }] : /* istanbul ignore next */ []));
|
|
64
|
+
/**
|
|
65
|
+
* Renders the built-in hamburger button on mobile. Set it to false when the
|
|
66
|
+
* app has its own top bar and toggles `[(mobileOpen)]` itself.
|
|
67
|
+
*/
|
|
68
|
+
this.showMobileToggle = input(true, ...(ngDevMode ? [{ debugName: "showMobileToggle" }] : /* istanbul ignore next */ []));
|
|
69
|
+
/** Mobile drawer open state, bindable with [(mobileOpen)]. */
|
|
70
|
+
this.mobileOpen = model(false, ...(ngDevMode ? [{ debugName: "mobileOpen" }] : /* istanbul ignore next */ []));
|
|
71
|
+
/** Accessible label of the hamburger button. */
|
|
72
|
+
this.openMenuLabel = input('Abrir menú', ...(ngDevMode ? [{ debugName: "openMenuLabel" }] : /* istanbul ignore next */ []));
|
|
73
|
+
/** Accessible label of the drawer close button. */
|
|
74
|
+
this.closeMenuLabel = input('Cerrar menú', ...(ngDevMode ? [{ debugName: "closeMenuLabel" }] : /* istanbul ignore next */ []));
|
|
52
75
|
/** Emitted when a section is selected, with its key and optional route. */
|
|
53
76
|
this.sectionSelected = output();
|
|
54
77
|
/** Emitted when a navigation item is clicked. */
|
|
@@ -62,10 +85,19 @@ class RailSidebarComponent {
|
|
|
62
85
|
/** Emitted when the workspace/home entry is clicked. */
|
|
63
86
|
this.workspaceClick = output();
|
|
64
87
|
this.getIcon = (name) => getIcon(name, LucideMenu);
|
|
88
|
+
this.closeIcon = LucideX;
|
|
89
|
+
/** Current viewport width (updated on resize). */
|
|
90
|
+
this.viewportWidth = signal(this.isBrowser ? window.innerWidth : Number.MAX_SAFE_INTEGER, ...(ngDevMode ? [{ debugName: "viewportWidth" }] : /* istanbul ignore next */ []));
|
|
91
|
+
/** Whether the mobile drawer mode is active. */
|
|
92
|
+
this.isMobile = computed(() => this.responsive() && this.viewportWidth() < this.mobileBreakpoint(), ...(ngDevMode ? [{ debugName: "isMobile" }] : /* istanbul ignore next */ []));
|
|
93
|
+
/** Whether the section panel is shown (always in the mobile drawer). */
|
|
94
|
+
this.expanded = computed(() => this.isMobile() || !this.collapsed(), ...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
95
|
+
this.hamburgerBtn = viewChild('hamburger', ...(ngDevMode ? [{ debugName: "hamburgerBtn" }] : /* istanbul ignore next */ []));
|
|
96
|
+
this.closeBtn = viewChild('closeBtn', ...(ngDevMode ? [{ debugName: "closeBtn" }] : /* istanbul ignore next */ []));
|
|
65
97
|
/** Set of group ids currently expanded. */
|
|
66
98
|
this.expandedGroups = signal(new Set(), ...(ngDevMode ? [{ debugName: "expandedGroups" }] : /* istanbul ignore next */ []));
|
|
67
99
|
/** Current sidebar width depending on the collapsed state. */
|
|
68
|
-
this.width = computed(() => this.
|
|
100
|
+
this.width = computed(() => this.expanded() ? this.expandedWidth() : this.railWidth(), ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
69
101
|
/** The section currently selected. */
|
|
70
102
|
this.activeSection = computed(() => this.sections().find((s) => s.key === this.activeSectionKey()) ?? null, ...(ngDevMode ? [{ debugName: "activeSection" }] : /* istanbul ignore next */ []));
|
|
71
103
|
/** Items of the active section, filtered by role. */
|
|
@@ -78,6 +110,20 @@ class RailSidebarComponent {
|
|
|
78
110
|
return role ? item.roles.includes(role) : false;
|
|
79
111
|
});
|
|
80
112
|
}, ...(ngDevMode ? [{ debugName: "navItems" }] : /* istanbul ignore next */ []));
|
|
113
|
+
// Leaving mobile mode closes the drawer.
|
|
114
|
+
effect(() => {
|
|
115
|
+
if (!this.isMobile() && untracked(this.mobileOpen))
|
|
116
|
+
this.mobileOpen.set(false);
|
|
117
|
+
});
|
|
118
|
+
// Lock the page scroll while the drawer is open.
|
|
119
|
+
effect((onCleanup) => {
|
|
120
|
+
if (!this.isBrowser || !(this.isMobile() && this.mobileOpen()))
|
|
121
|
+
return;
|
|
122
|
+
const body = document.body;
|
|
123
|
+
const previous = body.style.overflow;
|
|
124
|
+
body.style.overflow = 'hidden';
|
|
125
|
+
onCleanup(() => (body.style.overflow = previous));
|
|
126
|
+
});
|
|
81
127
|
effect(() => {
|
|
82
128
|
const url = this.activeUrl();
|
|
83
129
|
if (!url)
|
|
@@ -93,6 +139,26 @@ class RailSidebarComponent {
|
|
|
93
139
|
}
|
|
94
140
|
});
|
|
95
141
|
}
|
|
142
|
+
onResize() {
|
|
143
|
+
if (this.isBrowser)
|
|
144
|
+
this.viewportWidth.set(window.innerWidth);
|
|
145
|
+
}
|
|
146
|
+
onEscape() {
|
|
147
|
+
if (this.isMobile() && this.mobileOpen())
|
|
148
|
+
this.closeMobile();
|
|
149
|
+
}
|
|
150
|
+
/** Opens the mobile drawer and moves the focus into it. */
|
|
151
|
+
openMobile() {
|
|
152
|
+
this.mobileOpen.set(true);
|
|
153
|
+
afterNextRender(() => this.closeBtn()?.nativeElement.focus(), { injector: this.injector });
|
|
154
|
+
}
|
|
155
|
+
/** Closes the mobile drawer and gives the focus back to the hamburger. */
|
|
156
|
+
closeMobile() {
|
|
157
|
+
if (!this.mobileOpen())
|
|
158
|
+
return;
|
|
159
|
+
this.mobileOpen.set(false);
|
|
160
|
+
afterNextRender(() => this.hamburgerBtn()?.nativeElement.focus(), { injector: this.injector });
|
|
161
|
+
}
|
|
96
162
|
/** Applies the `labelPipe` transform to a label. */
|
|
97
163
|
label(label) {
|
|
98
164
|
return this.labelPipe()(label);
|
|
@@ -156,7 +222,7 @@ class RailSidebarComponent {
|
|
|
156
222
|
onSectionClick(section) {
|
|
157
223
|
this.activeSectionKey.set(section.key);
|
|
158
224
|
this.sectionSelected.emit({ key: section.key, routerLink: section.routerLink });
|
|
159
|
-
if (this.collapsed()) {
|
|
225
|
+
if (!this.isMobile() && this.collapsed()) {
|
|
160
226
|
this.collapsed.set(false);
|
|
161
227
|
this.toggleSidebar.emit(false);
|
|
162
228
|
}
|
|
@@ -166,15 +232,23 @@ class RailSidebarComponent {
|
|
|
166
232
|
if (item.disabled)
|
|
167
233
|
return;
|
|
168
234
|
this.itemClick.emit(item);
|
|
235
|
+
if (this.isMobile())
|
|
236
|
+
this.closeMobile();
|
|
169
237
|
}
|
|
170
238
|
/** Emits `workspaceClick` and expands the sidebar if it was collapsed. */
|
|
171
239
|
onWorkspace() {
|
|
172
240
|
this.workspaceClick.emit();
|
|
173
|
-
if (this.collapsed()) {
|
|
241
|
+
if (!this.isMobile() && this.collapsed()) {
|
|
174
242
|
this.collapsed.set(false);
|
|
175
243
|
this.toggleSidebar.emit(false);
|
|
176
244
|
}
|
|
177
245
|
}
|
|
246
|
+
/** Emits `logoutRequested` (closing the mobile drawer). */
|
|
247
|
+
onLogout() {
|
|
248
|
+
this.logoutRequested.emit();
|
|
249
|
+
if (this.isMobile())
|
|
250
|
+
this.closeMobile();
|
|
251
|
+
}
|
|
178
252
|
/** Cycles to the next language and emits `setLang`. */
|
|
179
253
|
onToggleLang() {
|
|
180
254
|
const langs = this.langs();
|
|
@@ -186,16 +260,28 @@ class RailSidebarComponent {
|
|
|
186
260
|
}
|
|
187
261
|
/** Toggles collapse and emits `toggleSidebar`. */
|
|
188
262
|
onToggleSidebar() {
|
|
263
|
+
if (this.isMobile()) {
|
|
264
|
+
this.closeMobile();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
189
267
|
this.collapsed.update((v) => !v);
|
|
190
268
|
this.toggleSidebar.emit(this.collapsed());
|
|
191
269
|
}
|
|
192
270
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: RailSidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
193
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: RailSidebarComponent, isStandalone: true, selector: "shk-rail-sidebar", inputs: { sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null }, activeUrl: { classPropertyName: "activeUrl", publicName: "activeUrl", isSignal: true, isRequired: false, transformFunction: null }, activeSectionKey: { classPropertyName: "activeSectionKey", publicName: "activeSectionKey", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, activeLang: { classPropertyName: "activeLang", publicName: "activeLang", isSignal: true, isRequired: false, transformFunction: null }, langs: { classPropertyName: "langs", publicName: "langs", isSignal: true, isRequired: false, transformFunction: null }, logo: { classPropertyName: "logo", publicName: "logo", isSignal: true, isRequired: false, transformFunction: null }, appName: { classPropertyName: "appName", publicName: "appName", isSignal: true, isRequired: false, transformFunction: null }, userRole: { classPropertyName: "userRole", publicName: "userRole", isSignal: true, isRequired: false, transformFunction: null }, labelPipe: { classPropertyName: "labelPipe", publicName: "labelPipe", isSignal: true, isRequired: false, transformFunction: null }, railWidth: { classPropertyName: "railWidth", publicName: "railWidth", isSignal: true, isRequired: false, transformFunction: null }, expandedWidth: { classPropertyName: "expandedWidth", publicName: "expandedWidth", isSignal: true, isRequired: false, transformFunction: null }, workspaceTooltip: { classPropertyName: "workspaceTooltip", publicName: "workspaceTooltip", isSignal: true, isRequired: false, transformFunction: null }, logoutTooltip: { classPropertyName: "logoutTooltip", publicName: "logoutTooltip", isSignal: true, isRequired: false, transformFunction: null }, collapseTooltip: { classPropertyName: "collapseTooltip", publicName: "collapseTooltip", isSignal: true, isRequired: false, transformFunction: null }, expandTooltip: { classPropertyName: "expandTooltip", publicName: "expandTooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeSectionKey: "activeSectionKeyChange", collapsed: "collapsedChange", sectionSelected: "sectionSelected", itemClick: "itemClick", setLang: "setLang", logoutRequested: "logoutRequested", toggleSidebar: "toggleSidebar", workspaceClick: "workspaceClick" }, ngImport: i0, template: "<aside\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-white dark:[background-color:var(--shk-surface-50)] border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"collapsed()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 dark:[background-color:var(--shk-surface-200)] border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n @if (collapsed()) {\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [lucideIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [lucideIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"logoutRequested.emit()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (!collapsed()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-white dark:[background-color:var(--shk-surface-50)]\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ appName() }}\n </span>\n <button\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [title]=\"collapseTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 dark:[color:var(--shk-surface-500)] block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border dark:[border-color:var(--shk-surface-200)] pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.dark:[color:var(--shk-surface-400)]]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [lucideIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n", styles: [":host{display:block;height:100%}.rail-workspace{cursor:pointer;transition:opacity .2s ease,box-shadow .2s ease}.rail-workspace.is-collapsed:hover{cursor:col-resize}.rail-workspace .rail-app-icon,.rail-workspace .rail-toggle-icon{grid-area:1 / 1 / 2 / 2;transition:opacity .2s ease}.rail-toggle-icon,.rail-workspace.is-collapsed:hover .rail-app-icon{opacity:0}.rail-workspace.is-collapsed:hover .rail-toggle-icon{opacity:1}.rail-icon{background:transparent;color:var(--shk-surface-700);border:1px solid transparent;transition:transform .18s ease,color .18s ease,background-color .18s ease,box-shadow .18s ease}.rail-icon svg{stroke-width:1.8}.rail-icon:hover{background:var(--shk-surface-100);color:var(--shk-primary-600)}.dark .rail-icon:hover{background:var(--shk-surface-200);color:var(--shk-primary-400)}.rail-icon.is-active{background:var(--shk-primary-600);color:#fff;box-shadow:0 1px 2px #0003}.dark .rail-icon.is-active{background:var(--shk-primary-500);color:#fff}.rail-logout:hover{color:var(--shk-error-500)}.dark .rail-logout:hover{color:var(--shk-error-400)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "component", type: TooltipComponent, selector: "shk-tooltip", inputs: ["text", "position", "mode", "offset"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }] }); }
|
|
271
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.23", type: RailSidebarComponent, isStandalone: true, selector: "shk-rail-sidebar", inputs: { sections: { classPropertyName: "sections", publicName: "sections", isSignal: true, isRequired: false, transformFunction: null }, activeUrl: { classPropertyName: "activeUrl", publicName: "activeUrl", isSignal: true, isRequired: false, transformFunction: null }, activeSectionKey: { classPropertyName: "activeSectionKey", publicName: "activeSectionKey", isSignal: true, isRequired: false, transformFunction: null }, collapsed: { classPropertyName: "collapsed", publicName: "collapsed", isSignal: true, isRequired: false, transformFunction: null }, activeLang: { classPropertyName: "activeLang", publicName: "activeLang", isSignal: true, isRequired: false, transformFunction: null }, langs: { classPropertyName: "langs", publicName: "langs", isSignal: true, isRequired: false, transformFunction: null }, logo: { classPropertyName: "logo", publicName: "logo", isSignal: true, isRequired: false, transformFunction: null }, appName: { classPropertyName: "appName", publicName: "appName", isSignal: true, isRequired: false, transformFunction: null }, userRole: { classPropertyName: "userRole", publicName: "userRole", isSignal: true, isRequired: false, transformFunction: null }, labelPipe: { classPropertyName: "labelPipe", publicName: "labelPipe", isSignal: true, isRequired: false, transformFunction: null }, railWidth: { classPropertyName: "railWidth", publicName: "railWidth", isSignal: true, isRequired: false, transformFunction: null }, expandedWidth: { classPropertyName: "expandedWidth", publicName: "expandedWidth", isSignal: true, isRequired: false, transformFunction: null }, workspaceTooltip: { classPropertyName: "workspaceTooltip", publicName: "workspaceTooltip", isSignal: true, isRequired: false, transformFunction: null }, logoutTooltip: { classPropertyName: "logoutTooltip", publicName: "logoutTooltip", isSignal: true, isRequired: false, transformFunction: null }, collapseTooltip: { classPropertyName: "collapseTooltip", publicName: "collapseTooltip", isSignal: true, isRequired: false, transformFunction: null }, expandTooltip: { classPropertyName: "expandTooltip", publicName: "expandTooltip", isSignal: true, isRequired: false, transformFunction: null }, responsive: { classPropertyName: "responsive", publicName: "responsive", isSignal: true, isRequired: false, transformFunction: null }, mobileBreakpoint: { classPropertyName: "mobileBreakpoint", publicName: "mobileBreakpoint", isSignal: true, isRequired: false, transformFunction: null }, showMobileToggle: { classPropertyName: "showMobileToggle", publicName: "showMobileToggle", isSignal: true, isRequired: false, transformFunction: null }, mobileOpen: { classPropertyName: "mobileOpen", publicName: "mobileOpen", isSignal: true, isRequired: false, transformFunction: null }, openMenuLabel: { classPropertyName: "openMenuLabel", publicName: "openMenuLabel", isSignal: true, isRequired: false, transformFunction: null }, closeMenuLabel: { classPropertyName: "closeMenuLabel", publicName: "closeMenuLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activeSectionKey: "activeSectionKeyChange", collapsed: "collapsedChange", mobileOpen: "mobileOpenChange", sectionSelected: "sectionSelected", itemClick: "itemClick", setLang: "setLang", logoutRequested: "logoutRequested", toggleSidebar: "toggleSidebar", workspaceClick: "workspaceClick" }, host: { listeners: { "window:resize": "onResize()", "document:keydown.escape": "onEscape()" }, properties: { "class.rail-is-mobile": "isMobile()" } }, viewQueries: [{ propertyName: "hamburgerBtn", first: true, predicate: ["hamburger"], descendants: true, isSignal: true }, { propertyName: "closeBtn", first: true, predicate: ["closeBtn"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (isMobile()) {\n <!-- Mobile: hamburger button + backdrop (the aside becomes a drawer) -->\n @if (showMobileToggle() && !mobileOpen()) {\n <button\n #hamburger\n type=\"button\"\n class=\"rail-hamburger _shk-bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [attr.aria-label]=\"openMenuLabel()\"\n aria-expanded=\"false\"\n [attr.aria-controls]=\"uid\"\n (click)=\"openMobile()\"\n >\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"w-5 h-5\"></svg>\n </button>\n }\n <div class=\"rail-backdrop\" [class.is-open]=\"mobileOpen()\" (click)=\"closeMobile()\"></div>\n}\n\n<aside\n [id]=\"uid\"\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-white dark:[background-color:var(--shk-surface-50)] border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [class.rail-drawer]=\"isMobile()\"\n [class.is-open]=\"isMobile() && mobileOpen()\"\n [attr.role]=\"isMobile() ? 'dialog' : null\"\n [attr.aria-modal]=\"isMobile() && mobileOpen() ? 'true' : null\"\n [attr.aria-label]=\"isMobile() ? appName() || openMenuLabel() : null\"\n [attr.inert]=\"isMobile() && !mobileOpen() ? '' : null\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"!expanded()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 dark:[background-color:var(--shk-surface-200)] border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n @if (!expanded()) {\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [lucideIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [lucideIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"onLogout()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (expanded()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-white dark:[background-color:var(--shk-surface-50)]\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ appName() }}\n </span>\n <button\n #closeBtn\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [title]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n [attr.aria-label]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n >\n <svg [lucideIcon]=\"isMobile() ? closeIcon : getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 dark:[color:var(--shk-surface-500)] block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border dark:[border-color:var(--shk-surface-200)] pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.dark:[color:var(--shk-surface-400)]]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [lucideIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n", styles: [":host{display:block;height:100%}:host(.rail-is-mobile){position:relative;width:0;min-width:0;flex:0 0 0;overflow:visible}.rail-hamburger{position:absolute;top:.75rem;left:.75rem;z-index:30;display:grid;place-items:center;width:2.5rem;height:2.5rem;border-radius:.625rem;box-shadow:0 1px 3px #0000001f;cursor:pointer;transition:background-color .15s ease}.rail-hamburger:hover{background-color:var(--shk-surface-100)}.rail-hamburger:focus-visible{outline:2px solid var(--shk-primary-500);outline-offset:2px}.rail-backdrop{position:fixed;inset:0;z-index:49;background-color:var(--shk-bg-overlay, rgba(0, 0, 0, .4));opacity:0;pointer-events:none;transition:opacity .25s ease}.rail-backdrop.is-open{opacity:1;pointer-events:auto}.rail-drawer{position:fixed;top:0;left:0;bottom:0;z-index:50;height:100dvh;max-width:85vw;transform:translate(-100%);visibility:hidden;transition:transform .25s ease,visibility 0s linear .25s}.rail-drawer.is-open{transform:translate(0);visibility:visible;box-shadow:0 10px 30px #00000040;transition:transform .25s ease}@media(prefers-reduced-motion:reduce){.rail-drawer,.rail-drawer.is-open,.rail-backdrop{transition:none}}.rail-workspace{cursor:pointer;transition:opacity .2s ease,box-shadow .2s ease}.rail-workspace.is-collapsed:hover{cursor:col-resize}.rail-workspace .rail-app-icon,.rail-workspace .rail-toggle-icon{grid-area:1 / 1 / 2 / 2;transition:opacity .2s ease}.rail-toggle-icon,.rail-workspace.is-collapsed:hover .rail-app-icon{opacity:0}.rail-workspace.is-collapsed:hover .rail-toggle-icon{opacity:1}.rail-icon{background:transparent;color:var(--shk-surface-700);border:1px solid transparent;transition:transform .18s ease,color .18s ease,background-color .18s ease,box-shadow .18s ease}.rail-icon svg{stroke-width:1.8}.rail-icon:hover{background:var(--shk-surface-100);color:var(--shk-primary-600)}.dark .rail-icon:hover{background:var(--shk-surface-200);color:var(--shk-primary-400)}.rail-icon.is-active{background:var(--shk-primary-600);color:#fff;box-shadow:0 1px 2px #0003}.dark .rail-icon.is-active{background:var(--shk-primary-500);color:#fff}.rail-logout:hover{color:var(--shk-error-500)}.dark .rail-logout:hover{color:var(--shk-error-400)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: LucideDynamicIcon, selector: "svg[lucideIcon]", inputs: ["lucideIcon"] }, { kind: "component", type: TooltipComponent, selector: "shk-tooltip", inputs: ["text", "position", "mode", "offset"] }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }] }); }
|
|
194
272
|
}
|
|
195
273
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.23", ngImport: i0, type: RailSidebarComponent, decorators: [{
|
|
196
274
|
type: Component,
|
|
197
|
-
args: [{ selector: 'shk-rail-sidebar', standalone: true, imports: [CommonModule, LucideDynamicIcon, TooltipComponent], template: "<aside\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-white dark:[background-color:var(--shk-surface-50)] border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"collapsed()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 dark:[background-color:var(--shk-surface-200)] border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n @if (collapsed()) {\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [lucideIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [lucideIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"logoutRequested.emit()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (!collapsed()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-white dark:[background-color:var(--shk-surface-50)]\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ appName() }}\n </span>\n <button\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [title]=\"collapseTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 dark:[color:var(--shk-surface-500)] block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border dark:[border-color:var(--shk-surface-200)] pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.dark:[color:var(--shk-surface-400)]]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [lucideIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n", styles: [":host{display:block;height:100%}.rail-workspace{cursor:pointer;transition:opacity .2s ease,box-shadow .2s ease}.rail-workspace.is-collapsed:hover{cursor:col-resize}.rail-workspace .rail-app-icon,.rail-workspace .rail-toggle-icon{grid-area:1 / 1 / 2 / 2;transition:opacity .2s ease}.rail-toggle-icon,.rail-workspace.is-collapsed:hover .rail-app-icon{opacity:0}.rail-workspace.is-collapsed:hover .rail-toggle-icon{opacity:1}.rail-icon{background:transparent;color:var(--shk-surface-700);border:1px solid transparent;transition:transform .18s ease,color .18s ease,background-color .18s ease,box-shadow .18s ease}.rail-icon svg{stroke-width:1.8}.rail-icon:hover{background:var(--shk-surface-100);color:var(--shk-primary-600)}.dark .rail-icon:hover{background:var(--shk-surface-200);color:var(--shk-primary-400)}.rail-icon.is-active{background:var(--shk-primary-600);color:#fff;box-shadow:0 1px 2px #0003}.dark .rail-icon.is-active{background:var(--shk-primary-500);color:#fff}.rail-logout:hover{color:var(--shk-error-500)}.dark .rail-logout:hover{color:var(--shk-error-400)}\n"] }]
|
|
198
|
-
|
|
275
|
+
args: [{ selector: 'shk-rail-sidebar', standalone: true, imports: [CommonModule, LucideDynamicIcon, TooltipComponent], host: {
|
|
276
|
+
'[class.rail-is-mobile]': 'isMobile()',
|
|
277
|
+
}, template: "@if (isMobile()) {\n <!-- Mobile: hamburger button + backdrop (the aside becomes a drawer) -->\n @if (showMobileToggle() && !mobileOpen()) {\n <button\n #hamburger\n type=\"button\"\n class=\"rail-hamburger _shk-bg-white dark:[background-color:var(--shk-surface-100)] border _shk-border dark:[border-color:var(--shk-surface-200)] _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"\n [attr.aria-label]=\"openMenuLabel()\"\n aria-expanded=\"false\"\n [attr.aria-controls]=\"uid\"\n (click)=\"openMobile()\"\n >\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"w-5 h-5\"></svg>\n </button>\n }\n <div class=\"rail-backdrop\" [class.is-open]=\"mobileOpen()\" (click)=\"closeMobile()\"></div>\n}\n\n<aside\n [id]=\"uid\"\n class=\"h-full flex overflow-hidden shrink-0 _shk-bg-white dark:[background-color:var(--shk-surface-50)] border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [class.rail-drawer]=\"isMobile()\"\n [class.is-open]=\"isMobile() && mobileOpen()\"\n [attr.role]=\"isMobile() ? 'dialog' : null\"\n [attr.aria-modal]=\"isMobile() && mobileOpen() ? 'true' : null\"\n [attr.aria-label]=\"isMobile() ? appName() || openMenuLabel() : null\"\n [attr.inert]=\"isMobile() && !mobileOpen() ? '' : null\"\n [style.width]=\"width()\"\n>\n <!-- Rail: vertical icon column -->\n <div\n class=\"h-full flex flex-col items-center shrink-0 px-[0.3rem] py-2 gap-1 border-r _shk-border dark:[border-color:var(--shk-surface-100)]\"\n [style.width]=\"railWidth()\"\n >\n <!-- Workspace / logo -->\n <div class=\"flex items-center justify-center w-full\">\n <button\n type=\"button\"\n (click)=\"onWorkspace()\"\n [class.is-collapsed]=\"!expanded()\"\n class=\"rail-workspace w-[3.2rem] h-[3.2rem] rounded-xl _shk-bg-surface-100 dark:[background-color:var(--shk-surface-200)] border-none grid place-items-center p-0 relative transition-all\"\n [title]=\"workspaceTooltip()\"\n >\n @if (logo()) {\n <img [src]=\"logo()\" alt=\"Logo\" class=\"rail-app-icon w-8 h-8 object-contain\" />\n } @else {\n <svg [lucideIcon]=\"getIcon('menu')\" class=\"rail-app-icon w-6 h-6 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n @if (!expanded()) {\n <svg [lucideIcon]=\"getIcon('panel-right')\" class=\"rail-toggle-icon w-5 h-5 _shk-text-surface-700 dark:[color:var(--shk-surface-700)]\"></svg>\n }\n </button>\n </div>\n\n <!-- Section actions -->\n <div class=\"rail-actions flex-1 flex flex-col items-center gap-1 pt-1\">\n @for (section of sections(); track section.key) {\n <shk-tooltip [text]=\"label(section.label)\" position=\"right\" mode=\"fixed\">\n <button\n type=\"button\"\n (click)=\"onSectionClick(section)\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [class.is-active]=\"isSectionActive(section)\"\n [attr.aria-label]=\"label(section.label)\"\n >\n <svg [lucideIcon]=\"getIcon(section.icon)\" class=\"w-5 h-5\"></svg>\n </button>\n </shk-tooltip>\n }\n </div>\n\n <!-- Bottom: language + logout -->\n <div class=\"rail-bottom mt-auto flex flex-col items-center gap-1\">\n <button\n type=\"button\"\n (click)=\"onToggleLang()\"\n class=\"rail-icon w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"activeLang()\"\n >\n <div class=\"flex flex-col items-center gap-[0.15rem]\">\n <svg [lucideIcon]=\"getIcon('languages')\" class=\"w-5 h-5\"></svg>\n <span class=\"rail-lang-code text-[0.5rem] font-bold tracking-[0.05em] leading-none\">{{ activeLang() | uppercase }}</span>\n </div>\n </button>\n\n <button\n type=\"button\"\n (click)=\"onLogout()\"\n class=\"rail-icon rail-logout w-[3.4rem] h-[3.4rem] rounded-[0.85rem] grid place-items-center transition-all cursor-pointer\"\n [title]=\"logoutTooltip()\"\n >\n <svg [lucideIcon]=\"getIcon('log-out')\" class=\"w-5 h-5\"></svg>\n </button>\n </div>\n </div>\n\n <!-- Nav: section panel (hidden when collapsed) -->\n @if (expanded()) {\n <div class=\"flex-1 min-w-0 flex flex-col _shk-bg-white dark:[background-color:var(--shk-surface-50)]\">\n <!-- Brand header -->\n <div class=\"flex items-center justify-between gap-2 px-3 py-4 border-b _shk-border dark:[border-color:var(--shk-surface-100)]\">\n <span class=\"nav-app text-base font-bold whitespace-nowrap overflow-hidden text-ellipsis _shk-text-surface-800 dark:[color:var(--shk-surface-800)]\">\n {{ appName() }}\n </span>\n <button\n #closeBtn\n type=\"button\"\n (click)=\"onToggleSidebar()\"\n class=\"nav-toggle w-[1.8rem] h-[1.8rem] rounded-lg border-none bg-transparent grid place-items-center cursor-pointer shrink-0 transition-colors _shk-text-surface-700 dark:[color:var(--shk-surface-700)] hover:[background-color:var(--shk-surface-100)] dark:hover:[background-color:var(--shk-surface-200)]\"\n [title]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n [attr.aria-label]=\"isMobile() ? closeMenuLabel() : collapseTooltip()\"\n >\n <svg [lucideIcon]=\"isMobile() ? closeIcon : getIcon('panel-right')\" class=\"w-4 h-4\"></svg>\n </button>\n </div>\n\n <!-- Menu -->\n <nav class=\"flex-1 overflow-y-auto _shk-scrollbar px-2 py-3\">\n @if (activeSection()) {\n <div class=\"px-2 pb-3\">\n <span class=\"nav-section-label text-xs font-bold tracking-[0.08em] uppercase _shk-text-surface-400 dark:[color:var(--shk-surface-500)] block whitespace-nowrap overflow-hidden text-ellipsis\">\n {{ label(activeSection()!.label) }}\n </span>\n </div>\n }\n\n <ul class=\"space-y-1\">\n @for (item of navItems(); track item.id) {\n @if (item.separator) {\n <li class=\"my-2 border-t _shk-border dark:[border-color:var(--shk-surface-200)]\"></li>\n }\n\n @if (item.children?.length) {\n <!-- Expandable group -->\n <li>\n <button\n type=\"button\"\n (click)=\"toggleGroup(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isGroupActive(item)\"\n [class._shk-text-white]=\"isGroupActive(item)\"\n [class.shadow-md]=\"isGroupActive(item)\"\n [class._shk-text-surface-700]=\"!isGroupActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isGroupActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isGroupActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isGroupActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n <svg\n [lucideIcon]=\"getIcon('chevron-down')\"\n class=\"w-4 h-4 transition-transform duration-200 shrink-0\"\n [class.rotate-180]=\"isGroupExpanded(item)\"\n ></svg>\n </button>\n\n @if (isGroupExpanded(item)) {\n <ul class=\"ml-3 mt-1 space-y-1 border-l-2 _shk-border dark:[border-color:var(--shk-surface-200)] pl-2\">\n @for (child of item.children; track child.id) {\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(child)\"\n class=\"w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary-soft]=\"isItemActive(child)\"\n [class._shk-bg-primary-soft-dark]=\"isItemActive(child)\"\n [class._shk-text-primary-700]=\"isItemActive(child)\"\n [class.dark:[color:var(--shk-primary-300)]]=\"isItemActive(child)\"\n [class._shk-text-surface-600]=\"!isItemActive(child)\"\n [class.dark:[color:var(--shk-surface-400)]]=\"!isItemActive(child)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(child)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(child)\"\n [class.hover:[color:var(--shk-surface-900)]]=\"!isItemActive(child)\"\n [class.dark:hover:[color:var(--shk-surface-700)]]=\"!isItemActive(child)\"\n >\n @if (child.icon) {\n <svg [lucideIcon]=\"getIcon(child.icon)\" class=\"w-4 h-4 shrink-0\"></svg>\n }\n <span class=\"whitespace-nowrap overflow-hidden\">{{ label(child.label) }}</span>\n @if (isItemActive(child)) {\n <span class=\"w-1.5 h-1.5 rounded-full _shk-bg-primary shrink-0 ml-auto\"></span>\n }\n </button>\n </li>\n }\n </ul>\n }\n </li>\n } @else {\n <!-- Standalone item -->\n <li>\n <button\n type=\"button\"\n (click)=\"onItemClick(item)\"\n class=\"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-all duration-200\"\n [class._shk-bg-primary]=\"isItemActive(item)\"\n [class._shk-text-white]=\"isItemActive(item)\"\n [class.shadow-md]=\"isItemActive(item)\"\n [class._shk-text-surface-700]=\"!isItemActive(item)\"\n [class.dark:[color:var(--shk-surface-600)]]=\"!isItemActive(item)\"\n [class.hover:[background-color:var(--shk-surface-100)]]=\"!isItemActive(item)\"\n [class.dark:hover:[background-color:var(--shk-surface-200)]]=\"!isItemActive(item)\"\n >\n @if (item.icon) {\n <svg [lucideIcon]=\"getIcon(item.icon)\" class=\"w-5 h-5 shrink-0\"></svg>\n }\n <span class=\"flex-1 text-left whitespace-nowrap overflow-hidden\">{{ label(item.label) }}</span>\n @if (item.badge !== undefined) {\n <span class=\"text-xs font-bold px-2 py-0.5 rounded-full _shk-bg-primary _shk-text-white shrink-0\">\n {{ item.badge }}\n </span>\n }\n </button>\n </li>\n }\n }\n </ul>\n </nav>\n </div>\n }\n</aside>\n", styles: [":host{display:block;height:100%}:host(.rail-is-mobile){position:relative;width:0;min-width:0;flex:0 0 0;overflow:visible}.rail-hamburger{position:absolute;top:.75rem;left:.75rem;z-index:30;display:grid;place-items:center;width:2.5rem;height:2.5rem;border-radius:.625rem;box-shadow:0 1px 3px #0000001f;cursor:pointer;transition:background-color .15s ease}.rail-hamburger:hover{background-color:var(--shk-surface-100)}.rail-hamburger:focus-visible{outline:2px solid var(--shk-primary-500);outline-offset:2px}.rail-backdrop{position:fixed;inset:0;z-index:49;background-color:var(--shk-bg-overlay, rgba(0, 0, 0, .4));opacity:0;pointer-events:none;transition:opacity .25s ease}.rail-backdrop.is-open{opacity:1;pointer-events:auto}.rail-drawer{position:fixed;top:0;left:0;bottom:0;z-index:50;height:100dvh;max-width:85vw;transform:translate(-100%);visibility:hidden;transition:transform .25s ease,visibility 0s linear .25s}.rail-drawer.is-open{transform:translate(0);visibility:visible;box-shadow:0 10px 30px #00000040;transition:transform .25s ease}@media(prefers-reduced-motion:reduce){.rail-drawer,.rail-drawer.is-open,.rail-backdrop{transition:none}}.rail-workspace{cursor:pointer;transition:opacity .2s ease,box-shadow .2s ease}.rail-workspace.is-collapsed:hover{cursor:col-resize}.rail-workspace .rail-app-icon,.rail-workspace .rail-toggle-icon{grid-area:1 / 1 / 2 / 2;transition:opacity .2s ease}.rail-toggle-icon,.rail-workspace.is-collapsed:hover .rail-app-icon{opacity:0}.rail-workspace.is-collapsed:hover .rail-toggle-icon{opacity:1}.rail-icon{background:transparent;color:var(--shk-surface-700);border:1px solid transparent;transition:transform .18s ease,color .18s ease,background-color .18s ease,box-shadow .18s ease}.rail-icon svg{stroke-width:1.8}.rail-icon:hover{background:var(--shk-surface-100);color:var(--shk-primary-600)}.dark .rail-icon:hover{background:var(--shk-surface-200);color:var(--shk-primary-400)}.rail-icon.is-active{background:var(--shk-primary-600);color:#fff;box-shadow:0 1px 2px #0003}.dark .rail-icon.is-active{background:var(--shk-primary-500);color:#fff}.rail-logout:hover{color:var(--shk-error-500)}.dark .rail-logout:hover{color:var(--shk-error-400)}\n"] }]
|
|
278
|
+
}], ctorParameters: () => [], propDecorators: { sections: [{ type: i0.Input, args: [{ isSignal: true, alias: "sections", required: false }] }], activeUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeUrl", required: false }] }], activeSectionKey: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeSectionKey", required: false }] }, { type: i0.Output, args: ["activeSectionKeyChange"] }], collapsed: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapsed", required: false }] }, { type: i0.Output, args: ["collapsedChange"] }], activeLang: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeLang", required: false }] }], langs: [{ type: i0.Input, args: [{ isSignal: true, alias: "langs", required: false }] }], logo: [{ type: i0.Input, args: [{ isSignal: true, alias: "logo", required: false }] }], appName: [{ type: i0.Input, args: [{ isSignal: true, alias: "appName", required: false }] }], userRole: [{ type: i0.Input, args: [{ isSignal: true, alias: "userRole", required: false }] }], labelPipe: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPipe", required: false }] }], railWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "railWidth", required: false }] }], expandedWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedWidth", required: false }] }], workspaceTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "workspaceTooltip", required: false }] }], logoutTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "logoutTooltip", required: false }] }], collapseTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapseTooltip", required: false }] }], expandTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandTooltip", required: false }] }], responsive: [{ type: i0.Input, args: [{ isSignal: true, alias: "responsive", required: false }] }], mobileBreakpoint: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileBreakpoint", required: false }] }], showMobileToggle: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMobileToggle", required: false }] }], mobileOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "mobileOpen", required: false }] }, { type: i0.Output, args: ["mobileOpenChange"] }], openMenuLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "openMenuLabel", required: false }] }], closeMenuLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeMenuLabel", required: false }] }], sectionSelected: [{ type: i0.Output, args: ["sectionSelected"] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], setLang: [{ type: i0.Output, args: ["setLang"] }], logoutRequested: [{ type: i0.Output, args: ["logoutRequested"] }], toggleSidebar: [{ type: i0.Output, args: ["toggleSidebar"] }], workspaceClick: [{ type: i0.Output, args: ["workspaceClick"] }], hamburgerBtn: [{ type: i0.ViewChild, args: ['hamburger', { isSignal: true }] }], closeBtn: [{ type: i0.ViewChild, args: ['closeBtn', { isSignal: true }] }], onResize: [{
|
|
279
|
+
type: HostListener,
|
|
280
|
+
args: ['window:resize']
|
|
281
|
+
}], onEscape: [{
|
|
282
|
+
type: HostListener,
|
|
283
|
+
args: ['document:keydown.escape']
|
|
284
|
+
}] } });
|
|
199
285
|
|
|
200
286
|
/**
|
|
201
287
|
* Generated bundle index. Do not edit.
|